{"ast":null,"code":"/**\n * @license Angular v18.2.10\n * (c) 2010-2024 Google LLC. https://angular.io/\n * License: MIT\n */\n\nconst _SELECTOR_REGEXP = new RegExp('(\\\\:not\\\\()|' +\n// 1: \":not(\"\n'(([\\\\.\\\\#]?)[-\\\\w]+)|' +\n// 2: \"tag\"; 3: \".\"/\"#\";\n// \"-\" should appear first in the regexp below as FF31 parses \"[.-\\w]\" as a range\n// 4: attribute; 5: attribute_string; 6: attribute_value\n'(?:\\\\[([-.\\\\w*\\\\\\\\$]+)(?:=([\"\\']?)([^\\\\]\"\\']*)\\\\5)?\\\\])|' +\n// \"[name]\", \"[name=value]\",\n// \"[name=\"value\"]\",\n// \"[name='value']\"\n'(\\\\))|' +\n// 7: \")\"\n'(\\\\s*,\\\\s*)',\n// 8: \",\"\n'g');\n/**\n * A css selector contains an element name,\n * css classes and attribute/value pairs with the purpose\n * of selecting subsets out of them.\n */\nclass CssSelector {\n constructor() {\n this.element = null;\n this.classNames = [];\n /**\n * The selectors are encoded in pairs where:\n * - even locations are attribute names\n * - odd locations are attribute values.\n *\n * Example:\n * Selector: `[key1=value1][key2]` would parse to:\n * ```\n * ['key1', 'value1', 'key2', '']\n * ```\n */\n this.attrs = [];\n this.notSelectors = [];\n }\n static parse(selector) {\n const results = [];\n const _addResult = (res, cssSel) => {\n if (cssSel.notSelectors.length > 0 && !cssSel.element && cssSel.classNames.length == 0 && cssSel.attrs.length == 0) {\n cssSel.element = '*';\n }\n res.push(cssSel);\n };\n let cssSelector = new CssSelector();\n let match;\n let current = cssSelector;\n let inNot = false;\n _SELECTOR_REGEXP.lastIndex = 0;\n while (match = _SELECTOR_REGEXP.exec(selector)) {\n if (match[1 /* SelectorRegexp.NOT */]) {\n if (inNot) {\n throw new Error('Nesting :not in a selector is not allowed');\n }\n inNot = true;\n current = new CssSelector();\n cssSelector.notSelectors.push(current);\n }\n const tag = match[2 /* SelectorRegexp.TAG */];\n if (tag) {\n const prefix = match[3 /* SelectorRegexp.PREFIX */];\n if (prefix === '#') {\n // #hash\n current.addAttribute('id', tag.slice(1));\n } else if (prefix === '.') {\n // Class\n current.addClassName(tag.slice(1));\n } else {\n // Element\n current.setElement(tag);\n }\n }\n const attribute = match[4 /* SelectorRegexp.ATTRIBUTE */];\n if (attribute) {\n current.addAttribute(current.unescapeAttribute(attribute), match[6 /* SelectorRegexp.ATTRIBUTE_VALUE */]);\n }\n if (match[7 /* SelectorRegexp.NOT_END */]) {\n inNot = false;\n current = cssSelector;\n }\n if (match[8 /* SelectorRegexp.SEPARATOR */]) {\n if (inNot) {\n throw new Error('Multiple selectors in :not are not supported');\n }\n _addResult(results, cssSelector);\n cssSelector = current = new CssSelector();\n }\n }\n _addResult(results, cssSelector);\n return results;\n }\n /**\n * Unescape `\\$` sequences from the CSS attribute selector.\n *\n * This is needed because `$` can have a special meaning in CSS selectors,\n * but we might want to match an attribute that contains `$`.\n * [MDN web link for more\n * info](https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors).\n * @param attr the attribute to unescape.\n * @returns the unescaped string.\n */\n unescapeAttribute(attr) {\n let result = '';\n let escaping = false;\n for (let i = 0; i < attr.length; i++) {\n const char = attr.charAt(i);\n if (char === '\\\\') {\n escaping = true;\n continue;\n }\n if (char === '$' && !escaping) {\n throw new Error(`Error in attribute selector \"${attr}\". ` + `Unescaped \"$\" is not supported. Please escape with \"\\\\$\".`);\n }\n escaping = false;\n result += char;\n }\n return result;\n }\n /**\n * Escape `$` sequences from the CSS attribute selector.\n *\n * This is needed because `$` can have a special meaning in CSS selectors,\n * with this method we are escaping `$` with `\\$'.\n * [MDN web link for more\n * info](https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors).\n * @param attr the attribute to escape.\n * @returns the escaped string.\n */\n escapeAttribute(attr) {\n return attr.replace(/\\\\/g, '\\\\\\\\').replace(/\\$/g, '\\\\$');\n }\n isElementSelector() {\n return this.hasElementSelector() && this.classNames.length == 0 && this.attrs.length == 0 && this.notSelectors.length === 0;\n }\n hasElementSelector() {\n return !!this.element;\n }\n setElement(element = null) {\n this.element = element;\n }\n getAttrs() {\n const result = [];\n if (this.classNames.length > 0) {\n result.push('class', this.classNames.join(' '));\n }\n return result.concat(this.attrs);\n }\n addAttribute(name, value = '') {\n this.attrs.push(name, value && value.toLowerCase() || '');\n }\n addClassName(name) {\n this.classNames.push(name.toLowerCase());\n }\n toString() {\n let res = this.element || '';\n if (this.classNames) {\n this.classNames.forEach(klass => res += `.${klass}`);\n }\n if (this.attrs) {\n for (let i = 0; i < this.attrs.length; i += 2) {\n const name = this.escapeAttribute(this.attrs[i]);\n const value = this.attrs[i + 1];\n res += `[${name}${value ? '=' + value : ''}]`;\n }\n }\n this.notSelectors.forEach(notSelector => res += `:not(${notSelector})`);\n return res;\n }\n}\n/**\n * Reads a list of CssSelectors and allows to calculate which ones\n * are contained in a given CssSelector.\n */\nclass SelectorMatcher {\n constructor() {\n this._elementMap = new Map();\n this._elementPartialMap = new Map();\n this._classMap = new Map();\n this._classPartialMap = new Map();\n this._attrValueMap = new Map();\n this._attrValuePartialMap = new Map();\n this._listContexts = [];\n }\n static createNotMatcher(notSelectors) {\n const notMatcher = new SelectorMatcher();\n notMatcher.addSelectables(notSelectors, null);\n return notMatcher;\n }\n addSelectables(cssSelectors, callbackCtxt) {\n let listContext = null;\n if (cssSelectors.length > 1) {\n listContext = new SelectorListContext(cssSelectors);\n this._listContexts.push(listContext);\n }\n for (let i = 0; i < cssSelectors.length; i++) {\n this._addSelectable(cssSelectors[i], callbackCtxt, listContext);\n }\n }\n /**\n * Add an object that can be found later on by calling `match`.\n * @param cssSelector A css selector\n * @param callbackCtxt An opaque object that will be given to the callback of the `match` function\n */\n _addSelectable(cssSelector, callbackCtxt, listContext) {\n let matcher = this;\n const element = cssSelector.element;\n const classNames = cssSelector.classNames;\n const attrs = cssSelector.attrs;\n const selectable = new SelectorContext(cssSelector, callbackCtxt, listContext);\n if (element) {\n const isTerminal = attrs.length === 0 && classNames.length === 0;\n if (isTerminal) {\n this._addTerminal(matcher._elementMap, element, selectable);\n } else {\n matcher = this._addPartial(matcher._elementPartialMap, element);\n }\n }\n if (classNames) {\n for (let i = 0; i < classNames.length; i++) {\n const isTerminal = attrs.length === 0 && i === classNames.length - 1;\n const className = classNames[i];\n if (isTerminal) {\n this._addTerminal(matcher._classMap, className, selectable);\n } else {\n matcher = this._addPartial(matcher._classPartialMap, className);\n }\n }\n }\n if (attrs) {\n for (let i = 0; i < attrs.length; i += 2) {\n const isTerminal = i === attrs.length - 2;\n const name = attrs[i];\n const value = attrs[i + 1];\n if (isTerminal) {\n const terminalMap = matcher._attrValueMap;\n let terminalValuesMap = terminalMap.get(name);\n if (!terminalValuesMap) {\n terminalValuesMap = new Map();\n terminalMap.set(name, terminalValuesMap);\n }\n this._addTerminal(terminalValuesMap, value, selectable);\n } else {\n const partialMap = matcher._attrValuePartialMap;\n let partialValuesMap = partialMap.get(name);\n if (!partialValuesMap) {\n partialValuesMap = new Map();\n partialMap.set(name, partialValuesMap);\n }\n matcher = this._addPartial(partialValuesMap, value);\n }\n }\n }\n }\n _addTerminal(map, name, selectable) {\n let terminalList = map.get(name);\n if (!terminalList) {\n terminalList = [];\n map.set(name, terminalList);\n }\n terminalList.push(selectable);\n }\n _addPartial(map, name) {\n let matcher = map.get(name);\n if (!matcher) {\n matcher = new SelectorMatcher();\n map.set(name, matcher);\n }\n return matcher;\n }\n /**\n * Find the objects that have been added via `addSelectable`\n * whose css selector is contained in the given css selector.\n * @param cssSelector A css selector\n * @param matchedCallback This callback will be called with the object handed into `addSelectable`\n * @return boolean true if a match was found\n */\n match(cssSelector, matchedCallback) {\n let result = false;\n const element = cssSelector.element;\n const classNames = cssSelector.classNames;\n const attrs = cssSelector.attrs;\n for (let i = 0; i < this._listContexts.length; i++) {\n this._listContexts[i].alreadyMatched = false;\n }\n result = this._matchTerminal(this._elementMap, element, cssSelector, matchedCallback) || result;\n result = this._matchPartial(this._elementPartialMap, element, cssSelector, matchedCallback) || result;\n if (classNames) {\n for (let i = 0; i < classNames.length; i++) {\n const className = classNames[i];\n result = this._matchTerminal(this._classMap, className, cssSelector, matchedCallback) || result;\n result = this._matchPartial(this._classPartialMap, className, cssSelector, matchedCallback) || result;\n }\n }\n if (attrs) {\n for (let i = 0; i < attrs.length; i += 2) {\n const name = attrs[i];\n const value = attrs[i + 1];\n const terminalValuesMap = this._attrValueMap.get(name);\n if (value) {\n result = this._matchTerminal(terminalValuesMap, '', cssSelector, matchedCallback) || result;\n }\n result = this._matchTerminal(terminalValuesMap, value, cssSelector, matchedCallback) || result;\n const partialValuesMap = this._attrValuePartialMap.get(name);\n if (value) {\n result = this._matchPartial(partialValuesMap, '', cssSelector, matchedCallback) || result;\n }\n result = this._matchPartial(partialValuesMap, value, cssSelector, matchedCallback) || result;\n }\n }\n return result;\n }\n /** @internal */\n _matchTerminal(map, name, cssSelector, matchedCallback) {\n if (!map || typeof name !== 'string') {\n return false;\n }\n let selectables = map.get(name) || [];\n const starSelectables = map.get('*');\n if (starSelectables) {\n selectables = selectables.concat(starSelectables);\n }\n if (selectables.length === 0) {\n return false;\n }\n let selectable;\n let result = false;\n for (let i = 0; i < selectables.length; i++) {\n selectable = selectables[i];\n result = selectable.finalize(cssSelector, matchedCallback) || result;\n }\n return result;\n }\n /** @internal */\n _matchPartial(map, name, cssSelector, matchedCallback) {\n if (!map || typeof name !== 'string') {\n return false;\n }\n const nestedSelector = map.get(name);\n if (!nestedSelector) {\n return false;\n }\n // TODO(perf): get rid of recursion and measure again\n // TODO(perf): don't pass the whole selector into the recursion,\n // but only the not processed parts\n return nestedSelector.match(cssSelector, matchedCallback);\n }\n}\nclass SelectorListContext {\n constructor(selectors) {\n this.selectors = selectors;\n this.alreadyMatched = false;\n }\n}\n// Store context to pass back selector and context when a selector is matched\nclass SelectorContext {\n constructor(selector, cbContext, listContext) {\n this.selector = selector;\n this.cbContext = cbContext;\n this.listContext = listContext;\n this.notSelectors = selector.notSelectors;\n }\n finalize(cssSelector, callback) {\n let result = true;\n if (this.notSelectors.length > 0 && (!this.listContext || !this.listContext.alreadyMatched)) {\n const notMatcher = SelectorMatcher.createNotMatcher(this.notSelectors);\n result = !notMatcher.match(cssSelector, null);\n }\n if (result && callback && (!this.listContext || !this.listContext.alreadyMatched)) {\n if (this.listContext) {\n this.listContext.alreadyMatched = true;\n }\n callback(this.selector, this.cbContext);\n }\n return result;\n }\n}\n\n// Attention:\n// Stores the default value of `emitDistinctChangesOnly` when the `emitDistinctChangesOnly` is not\n// explicitly set.\nconst emitDistinctChangesOnlyDefaultValue = true;\nvar ViewEncapsulation;\n(function (ViewEncapsulation) {\n ViewEncapsulation[ViewEncapsulation[\"Emulated\"] = 0] = \"Emulated\";\n // Historically the 1 value was for `Native` encapsulation which has been removed as of v11.\n ViewEncapsulation[ViewEncapsulation[\"None\"] = 2] = \"None\";\n ViewEncapsulation[ViewEncapsulation[\"ShadowDom\"] = 3] = \"ShadowDom\";\n})(ViewEncapsulation || (ViewEncapsulation = {}));\nvar ChangeDetectionStrategy;\n(function (ChangeDetectionStrategy) {\n ChangeDetectionStrategy[ChangeDetectionStrategy[\"OnPush\"] = 0] = \"OnPush\";\n ChangeDetectionStrategy[ChangeDetectionStrategy[\"Default\"] = 1] = \"Default\";\n})(ChangeDetectionStrategy || (ChangeDetectionStrategy = {}));\n/** Flags describing an input for a directive. */\nvar InputFlags;\n(function (InputFlags) {\n InputFlags[InputFlags[\"None\"] = 0] = \"None\";\n InputFlags[InputFlags[\"SignalBased\"] = 1] = \"SignalBased\";\n InputFlags[InputFlags[\"HasDecoratorInputTransform\"] = 2] = \"HasDecoratorInputTransform\";\n})(InputFlags || (InputFlags = {}));\nconst CUSTOM_ELEMENTS_SCHEMA = {\n name: 'custom-elements'\n};\nconst NO_ERRORS_SCHEMA = {\n name: 'no-errors-schema'\n};\nconst Type$1 = Function;\nvar SecurityContext;\n(function (SecurityContext) {\n SecurityContext[SecurityContext[\"NONE\"] = 0] = \"NONE\";\n SecurityContext[SecurityContext[\"HTML\"] = 1] = \"HTML\";\n SecurityContext[SecurityContext[\"STYLE\"] = 2] = \"STYLE\";\n SecurityContext[SecurityContext[\"SCRIPT\"] = 3] = \"SCRIPT\";\n SecurityContext[SecurityContext[\"URL\"] = 4] = \"URL\";\n SecurityContext[SecurityContext[\"RESOURCE_URL\"] = 5] = \"RESOURCE_URL\";\n})(SecurityContext || (SecurityContext = {}));\nvar MissingTranslationStrategy;\n(function (MissingTranslationStrategy) {\n MissingTranslationStrategy[MissingTranslationStrategy[\"Error\"] = 0] = \"Error\";\n MissingTranslationStrategy[MissingTranslationStrategy[\"Warning\"] = 1] = \"Warning\";\n MissingTranslationStrategy[MissingTranslationStrategy[\"Ignore\"] = 2] = \"Ignore\";\n})(MissingTranslationStrategy || (MissingTranslationStrategy = {}));\nfunction parserSelectorToSimpleSelector(selector) {\n const classes = selector.classNames && selector.classNames.length ? [8 /* SelectorFlags.CLASS */, ...selector.classNames] : [];\n const elementName = selector.element && selector.element !== '*' ? selector.element : '';\n return [elementName, ...selector.attrs, ...classes];\n}\nfunction parserSelectorToNegativeSelector(selector) {\n const classes = selector.classNames && selector.classNames.length ? [8 /* SelectorFlags.CLASS */, ...selector.classNames] : [];\n if (selector.element) {\n return [1 /* SelectorFlags.NOT */ | 4 /* SelectorFlags.ELEMENT */, selector.element, ...selector.attrs, ...classes];\n } else if (selector.attrs.length) {\n return [1 /* SelectorFlags.NOT */ | 2 /* SelectorFlags.ATTRIBUTE */, ...selector.attrs, ...classes];\n } else {\n return selector.classNames && selector.classNames.length ? [1 /* SelectorFlags.NOT */ | 8 /* SelectorFlags.CLASS */, ...selector.classNames] : [];\n }\n}\nfunction parserSelectorToR3Selector(selector) {\n const positive = parserSelectorToSimpleSelector(selector);\n const negative = selector.notSelectors && selector.notSelectors.length ? selector.notSelectors.map(notSelector => parserSelectorToNegativeSelector(notSelector)) : [];\n return positive.concat(...negative);\n}\nfunction parseSelectorToR3Selector(selector) {\n return selector ? CssSelector.parse(selector).map(parserSelectorToR3Selector) : [];\n}\nvar core = /*#__PURE__*/Object.freeze({\n __proto__: null,\n emitDistinctChangesOnlyDefaultValue: emitDistinctChangesOnlyDefaultValue,\n get ViewEncapsulation() {\n return ViewEncapsulation;\n },\n get ChangeDetectionStrategy() {\n return ChangeDetectionStrategy;\n },\n get InputFlags() {\n return InputFlags;\n },\n CUSTOM_ELEMENTS_SCHEMA: CUSTOM_ELEMENTS_SCHEMA,\n NO_ERRORS_SCHEMA: NO_ERRORS_SCHEMA,\n Type: Type$1,\n get SecurityContext() {\n return SecurityContext;\n },\n get MissingTranslationStrategy() {\n return MissingTranslationStrategy;\n },\n parseSelectorToR3Selector: parseSelectorToR3Selector\n});\n\n/**\n * A lazily created TextEncoder instance for converting strings into UTF-8 bytes\n */\nlet textEncoder;\n/**\n * Return the message id or compute it using the XLIFF1 digest.\n */\nfunction digest$1(message) {\n return message.id || computeDigest(message);\n}\n/**\n * Compute the message id using the XLIFF1 digest.\n */\nfunction computeDigest(message) {\n return sha1(serializeNodes(message.nodes).join('') + `[${message.meaning}]`);\n}\n/**\n * Return the message id or compute it using the XLIFF2/XMB/$localize digest.\n */\nfunction decimalDigest(message, preservePlaceholders) {\n return message.id || computeDecimalDigest(message, preservePlaceholders);\n}\n/**\n * Compute the message id using the XLIFF2/XMB/$localize digest.\n */\nfunction computeDecimalDigest(message, preservePlaceholders) {\n const visitor = new _SerializerIgnoreExpVisitor(preservePlaceholders);\n const parts = message.nodes.map(a => a.visit(visitor, null));\n return computeMsgId(parts.join(''), message.meaning);\n}\n/**\n * Serialize the i18n ast to something xml-like in order to generate an UID.\n *\n * The visitor is also used in the i18n parser tests\n *\n * @internal\n */\nclass _SerializerVisitor {\n visitText(text, context) {\n return text.value;\n }\n visitContainer(container, context) {\n return `[${container.children.map(child => child.visit(this)).join(', ')}]`;\n }\n visitIcu(icu, context) {\n const strCases = Object.keys(icu.cases).map(k => `${k} {${icu.cases[k].visit(this)}}`);\n return `{${icu.expression}, ${icu.type}, ${strCases.join(', ')}}`;\n }\n visitTagPlaceholder(ph, context) {\n return ph.isVoid ? `` : `${ph.children.map(child => child.visit(this)).join(', ')}`;\n }\n visitPlaceholder(ph, context) {\n return ph.value ? `${ph.value}` : ``;\n }\n visitIcuPlaceholder(ph, context) {\n return `${ph.value.visit(this)}`;\n }\n visitBlockPlaceholder(ph, context) {\n return `${ph.children.map(child => child.visit(this)).join(', ')}`;\n }\n}\nconst serializerVisitor$1 = new _SerializerVisitor();\nfunction serializeNodes(nodes) {\n return nodes.map(a => a.visit(serializerVisitor$1, null));\n}\n/**\n * Serialize the i18n ast to something xml-like in order to generate an UID.\n *\n * Ignore the expressions so that message IDs stays identical if only the expression changes.\n *\n * @internal\n */\nclass _SerializerIgnoreExpVisitor extends _SerializerVisitor {\n constructor(preservePlaceholders) {\n super();\n this.preservePlaceholders = preservePlaceholders;\n }\n visitPlaceholder(ph, context) {\n // Do not take the expression into account when `preservePlaceholders` is disabled.\n return this.preservePlaceholders ? super.visitPlaceholder(ph, context) : ``;\n }\n visitIcu(icu) {\n let strCases = Object.keys(icu.cases).map(k => `${k} {${icu.cases[k].visit(this)}}`);\n // Do not take the expression into account\n return `{${icu.type}, ${strCases.join(', ')}}`;\n }\n}\n/**\n * Compute the SHA1 of the given string\n *\n * see https://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf\n *\n * WARNING: this function has not been designed not tested with security in mind.\n * DO NOT USE IT IN A SECURITY SENSITIVE CONTEXT.\n */\nfunction sha1(str) {\n textEncoder ??= new TextEncoder();\n const utf8 = [...textEncoder.encode(str)];\n const words32 = bytesToWords32(utf8, Endian.Big);\n const len = utf8.length * 8;\n const w = new Uint32Array(80);\n let a = 0x67452301,\n b = 0xefcdab89,\n c = 0x98badcfe,\n d = 0x10325476,\n e = 0xc3d2e1f0;\n words32[len >> 5] |= 0x80 << 24 - len % 32;\n words32[(len + 64 >> 9 << 4) + 15] = len;\n for (let i = 0; i < words32.length; i += 16) {\n const h0 = a,\n h1 = b,\n h2 = c,\n h3 = d,\n h4 = e;\n for (let j = 0; j < 80; j++) {\n if (j < 16) {\n w[j] = words32[i + j];\n } else {\n w[j] = rol32(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1);\n }\n const fkVal = fk(j, b, c, d);\n const f = fkVal[0];\n const k = fkVal[1];\n const temp = [rol32(a, 5), f, e, k, w[j]].reduce(add32);\n e = d;\n d = c;\n c = rol32(b, 30);\n b = a;\n a = temp;\n }\n a = add32(a, h0);\n b = add32(b, h1);\n c = add32(c, h2);\n d = add32(d, h3);\n e = add32(e, h4);\n }\n // Convert the output parts to a 160-bit hexadecimal string\n return toHexU32(a) + toHexU32(b) + toHexU32(c) + toHexU32(d) + toHexU32(e);\n}\n/**\n * Convert and format a number as a string representing a 32-bit unsigned hexadecimal number.\n * @param value The value to format as a string.\n * @returns A hexadecimal string representing the value.\n */\nfunction toHexU32(value) {\n // unsigned right shift of zero ensures an unsigned 32-bit number\n return (value >>> 0).toString(16).padStart(8, '0');\n}\nfunction fk(index, b, c, d) {\n if (index < 20) {\n return [b & c | ~b & d, 0x5a827999];\n }\n if (index < 40) {\n return [b ^ c ^ d, 0x6ed9eba1];\n }\n if (index < 60) {\n return [b & c | b & d | c & d, 0x8f1bbcdc];\n }\n return [b ^ c ^ d, 0xca62c1d6];\n}\n/**\n * Compute the fingerprint of the given string\n *\n * The output is 64 bit number encoded as a decimal string\n *\n * based on:\n * https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/GoogleJsMessageIdGenerator.java\n */\nfunction fingerprint(str) {\n textEncoder ??= new TextEncoder();\n const utf8 = textEncoder.encode(str);\n const view = new DataView(utf8.buffer, utf8.byteOffset, utf8.byteLength);\n let hi = hash32(view, utf8.length, 0);\n let lo = hash32(view, utf8.length, 102072);\n if (hi == 0 && (lo == 0 || lo == 1)) {\n hi = hi ^ 0x130f9bef;\n lo = lo ^ -0x6b5f56d8;\n }\n return BigInt.asUintN(32, BigInt(hi)) << BigInt(32) | BigInt.asUintN(32, BigInt(lo));\n}\nfunction computeMsgId(msg, meaning = '') {\n let msgFingerprint = fingerprint(msg);\n if (meaning) {\n // Rotate the 64-bit message fingerprint one bit to the left and then add the meaning\n // fingerprint.\n msgFingerprint = BigInt.asUintN(64, msgFingerprint << BigInt(1)) | msgFingerprint >> BigInt(63) & BigInt(1);\n msgFingerprint += fingerprint(meaning);\n }\n return BigInt.asUintN(63, msgFingerprint).toString();\n}\nfunction hash32(view, length, c) {\n let a = 0x9e3779b9,\n b = 0x9e3779b9;\n let index = 0;\n const end = length - 12;\n for (; index <= end; index += 12) {\n a += view.getUint32(index, true);\n b += view.getUint32(index + 4, true);\n c += view.getUint32(index + 8, true);\n const res = mix(a, b, c);\n a = res[0], b = res[1], c = res[2];\n }\n const remainder = length - index;\n // the first byte of c is reserved for the length\n c += length;\n if (remainder >= 4) {\n a += view.getUint32(index, true);\n index += 4;\n if (remainder >= 8) {\n b += view.getUint32(index, true);\n index += 4;\n // Partial 32-bit word for c\n if (remainder >= 9) {\n c += view.getUint8(index++) << 8;\n }\n if (remainder >= 10) {\n c += view.getUint8(index++) << 16;\n }\n if (remainder === 11) {\n c += view.getUint8(index++) << 24;\n }\n } else {\n // Partial 32-bit word for b\n if (remainder >= 5) {\n b += view.getUint8(index++);\n }\n if (remainder >= 6) {\n b += view.getUint8(index++) << 8;\n }\n if (remainder === 7) {\n b += view.getUint8(index++) << 16;\n }\n }\n } else {\n // Partial 32-bit word for a\n if (remainder >= 1) {\n a += view.getUint8(index++);\n }\n if (remainder >= 2) {\n a += view.getUint8(index++) << 8;\n }\n if (remainder === 3) {\n a += view.getUint8(index++) << 16;\n }\n }\n return mix(a, b, c)[2];\n}\nfunction mix(a, b, c) {\n a -= b;\n a -= c;\n a ^= c >>> 13;\n b -= c;\n b -= a;\n b ^= a << 8;\n c -= a;\n c -= b;\n c ^= b >>> 13;\n a -= b;\n a -= c;\n a ^= c >>> 12;\n b -= c;\n b -= a;\n b ^= a << 16;\n c -= a;\n c -= b;\n c ^= b >>> 5;\n a -= b;\n a -= c;\n a ^= c >>> 3;\n b -= c;\n b -= a;\n b ^= a << 10;\n c -= a;\n c -= b;\n c ^= b >>> 15;\n return [a, b, c];\n}\n// Utils\nvar Endian;\n(function (Endian) {\n Endian[Endian[\"Little\"] = 0] = \"Little\";\n Endian[Endian[\"Big\"] = 1] = \"Big\";\n})(Endian || (Endian = {}));\nfunction add32(a, b) {\n return add32to64(a, b)[1];\n}\nfunction add32to64(a, b) {\n const low = (a & 0xffff) + (b & 0xffff);\n const high = (a >>> 16) + (b >>> 16) + (low >>> 16);\n return [high >>> 16, high << 16 | low & 0xffff];\n}\n// Rotate a 32b number left `count` position\nfunction rol32(a, count) {\n return a << count | a >>> 32 - count;\n}\nfunction bytesToWords32(bytes, endian) {\n const size = bytes.length + 3 >>> 2;\n const words32 = [];\n for (let i = 0; i < size; i++) {\n words32[i] = wordAt(bytes, i * 4, endian);\n }\n return words32;\n}\nfunction byteAt(bytes, index) {\n return index >= bytes.length ? 0 : bytes[index];\n}\nfunction wordAt(bytes, index, endian) {\n let word = 0;\n if (endian === Endian.Big) {\n for (let i = 0; i < 4; i++) {\n word += byteAt(bytes, index + i) << 24 - 8 * i;\n }\n } else {\n for (let i = 0; i < 4; i++) {\n word += byteAt(bytes, index + i) << 8 * i;\n }\n }\n return word;\n}\n\n//// Types\nvar TypeModifier;\n(function (TypeModifier) {\n TypeModifier[TypeModifier[\"None\"] = 0] = \"None\";\n TypeModifier[TypeModifier[\"Const\"] = 1] = \"Const\";\n})(TypeModifier || (TypeModifier = {}));\nclass Type {\n constructor(modifiers = TypeModifier.None) {\n this.modifiers = modifiers;\n }\n hasModifier(modifier) {\n return (this.modifiers & modifier) !== 0;\n }\n}\nvar BuiltinTypeName;\n(function (BuiltinTypeName) {\n BuiltinTypeName[BuiltinTypeName[\"Dynamic\"] = 0] = \"Dynamic\";\n BuiltinTypeName[BuiltinTypeName[\"Bool\"] = 1] = \"Bool\";\n BuiltinTypeName[BuiltinTypeName[\"String\"] = 2] = \"String\";\n BuiltinTypeName[BuiltinTypeName[\"Int\"] = 3] = \"Int\";\n BuiltinTypeName[BuiltinTypeName[\"Number\"] = 4] = \"Number\";\n BuiltinTypeName[BuiltinTypeName[\"Function\"] = 5] = \"Function\";\n BuiltinTypeName[BuiltinTypeName[\"Inferred\"] = 6] = \"Inferred\";\n BuiltinTypeName[BuiltinTypeName[\"None\"] = 7] = \"None\";\n})(BuiltinTypeName || (BuiltinTypeName = {}));\nclass BuiltinType extends Type {\n constructor(name, modifiers) {\n super(modifiers);\n this.name = name;\n }\n visitType(visitor, context) {\n return visitor.visitBuiltinType(this, context);\n }\n}\nclass ExpressionType extends Type {\n constructor(value, modifiers, typeParams = null) {\n super(modifiers);\n this.value = value;\n this.typeParams = typeParams;\n }\n visitType(visitor, context) {\n return visitor.visitExpressionType(this, context);\n }\n}\nclass ArrayType extends Type {\n constructor(of, modifiers) {\n super(modifiers);\n this.of = of;\n }\n visitType(visitor, context) {\n return visitor.visitArrayType(this, context);\n }\n}\nclass MapType extends Type {\n constructor(valueType, modifiers) {\n super(modifiers);\n this.valueType = valueType || null;\n }\n visitType(visitor, context) {\n return visitor.visitMapType(this, context);\n }\n}\nclass TransplantedType extends Type {\n constructor(type, modifiers) {\n super(modifiers);\n this.type = type;\n }\n visitType(visitor, context) {\n return visitor.visitTransplantedType(this, context);\n }\n}\nconst DYNAMIC_TYPE = new BuiltinType(BuiltinTypeName.Dynamic);\nconst INFERRED_TYPE = new BuiltinType(BuiltinTypeName.Inferred);\nconst BOOL_TYPE = new BuiltinType(BuiltinTypeName.Bool);\nconst INT_TYPE = new BuiltinType(BuiltinTypeName.Int);\nconst NUMBER_TYPE = new BuiltinType(BuiltinTypeName.Number);\nconst STRING_TYPE = new BuiltinType(BuiltinTypeName.String);\nconst FUNCTION_TYPE = new BuiltinType(BuiltinTypeName.Function);\nconst NONE_TYPE = new BuiltinType(BuiltinTypeName.None);\n///// Expressions\nvar UnaryOperator;\n(function (UnaryOperator) {\n UnaryOperator[UnaryOperator[\"Minus\"] = 0] = \"Minus\";\n UnaryOperator[UnaryOperator[\"Plus\"] = 1] = \"Plus\";\n})(UnaryOperator || (UnaryOperator = {}));\nvar BinaryOperator;\n(function (BinaryOperator) {\n BinaryOperator[BinaryOperator[\"Equals\"] = 0] = \"Equals\";\n BinaryOperator[BinaryOperator[\"NotEquals\"] = 1] = \"NotEquals\";\n BinaryOperator[BinaryOperator[\"Identical\"] = 2] = \"Identical\";\n BinaryOperator[BinaryOperator[\"NotIdentical\"] = 3] = \"NotIdentical\";\n BinaryOperator[BinaryOperator[\"Minus\"] = 4] = \"Minus\";\n BinaryOperator[BinaryOperator[\"Plus\"] = 5] = \"Plus\";\n BinaryOperator[BinaryOperator[\"Divide\"] = 6] = \"Divide\";\n BinaryOperator[BinaryOperator[\"Multiply\"] = 7] = \"Multiply\";\n BinaryOperator[BinaryOperator[\"Modulo\"] = 8] = \"Modulo\";\n BinaryOperator[BinaryOperator[\"And\"] = 9] = \"And\";\n BinaryOperator[BinaryOperator[\"Or\"] = 10] = \"Or\";\n BinaryOperator[BinaryOperator[\"BitwiseOr\"] = 11] = \"BitwiseOr\";\n BinaryOperator[BinaryOperator[\"BitwiseAnd\"] = 12] = \"BitwiseAnd\";\n BinaryOperator[BinaryOperator[\"Lower\"] = 13] = \"Lower\";\n BinaryOperator[BinaryOperator[\"LowerEquals\"] = 14] = \"LowerEquals\";\n BinaryOperator[BinaryOperator[\"Bigger\"] = 15] = \"Bigger\";\n BinaryOperator[BinaryOperator[\"BiggerEquals\"] = 16] = \"BiggerEquals\";\n BinaryOperator[BinaryOperator[\"NullishCoalesce\"] = 17] = \"NullishCoalesce\";\n})(BinaryOperator || (BinaryOperator = {}));\nfunction nullSafeIsEquivalent(base, other) {\n if (base == null || other == null) {\n return base == other;\n }\n return base.isEquivalent(other);\n}\nfunction areAllEquivalentPredicate(base, other, equivalentPredicate) {\n const len = base.length;\n if (len !== other.length) {\n return false;\n }\n for (let i = 0; i < len; i++) {\n if (!equivalentPredicate(base[i], other[i])) {\n return false;\n }\n }\n return true;\n}\nfunction areAllEquivalent(base, other) {\n return areAllEquivalentPredicate(base, other, (baseElement, otherElement) => baseElement.isEquivalent(otherElement));\n}\nclass Expression {\n constructor(type, sourceSpan) {\n this.type = type || null;\n this.sourceSpan = sourceSpan || null;\n }\n prop(name, sourceSpan) {\n return new ReadPropExpr(this, name, null, sourceSpan);\n }\n key(index, type, sourceSpan) {\n return new ReadKeyExpr(this, index, type, sourceSpan);\n }\n callFn(params, sourceSpan, pure) {\n return new InvokeFunctionExpr(this, params, null, sourceSpan, pure);\n }\n instantiate(params, type, sourceSpan) {\n return new InstantiateExpr(this, params, type, sourceSpan);\n }\n conditional(trueCase, falseCase = null, sourceSpan) {\n return new ConditionalExpr(this, trueCase, falseCase, null, sourceSpan);\n }\n equals(rhs, sourceSpan) {\n return new BinaryOperatorExpr(BinaryOperator.Equals, this, rhs, null, sourceSpan);\n }\n notEquals(rhs, sourceSpan) {\n return new BinaryOperatorExpr(BinaryOperator.NotEquals, this, rhs, null, sourceSpan);\n }\n identical(rhs, sourceSpan) {\n return new BinaryOperatorExpr(BinaryOperator.Identical, this, rhs, null, sourceSpan);\n }\n notIdentical(rhs, sourceSpan) {\n return new BinaryOperatorExpr(BinaryOperator.NotIdentical, this, rhs, null, sourceSpan);\n }\n minus(rhs, sourceSpan) {\n return new BinaryOperatorExpr(BinaryOperator.Minus, this, rhs, null, sourceSpan);\n }\n plus(rhs, sourceSpan) {\n return new BinaryOperatorExpr(BinaryOperator.Plus, this, rhs, null, sourceSpan);\n }\n divide(rhs, sourceSpan) {\n return new BinaryOperatorExpr(BinaryOperator.Divide, this, rhs, null, sourceSpan);\n }\n multiply(rhs, sourceSpan) {\n return new BinaryOperatorExpr(BinaryOperator.Multiply, this, rhs, null, sourceSpan);\n }\n modulo(rhs, sourceSpan) {\n return new BinaryOperatorExpr(BinaryOperator.Modulo, this, rhs, null, sourceSpan);\n }\n and(rhs, sourceSpan) {\n return new BinaryOperatorExpr(BinaryOperator.And, this, rhs, null, sourceSpan);\n }\n bitwiseOr(rhs, sourceSpan, parens = true) {\n return new BinaryOperatorExpr(BinaryOperator.BitwiseOr, this, rhs, null, sourceSpan, parens);\n }\n bitwiseAnd(rhs, sourceSpan, parens = true) {\n return new BinaryOperatorExpr(BinaryOperator.BitwiseAnd, this, rhs, null, sourceSpan, parens);\n }\n or(rhs, sourceSpan) {\n return new BinaryOperatorExpr(BinaryOperator.Or, this, rhs, null, sourceSpan);\n }\n lower(rhs, sourceSpan) {\n return new BinaryOperatorExpr(BinaryOperator.Lower, this, rhs, null, sourceSpan);\n }\n lowerEquals(rhs, sourceSpan) {\n return new BinaryOperatorExpr(BinaryOperator.LowerEquals, this, rhs, null, sourceSpan);\n }\n bigger(rhs, sourceSpan) {\n return new BinaryOperatorExpr(BinaryOperator.Bigger, this, rhs, null, sourceSpan);\n }\n biggerEquals(rhs, sourceSpan) {\n return new BinaryOperatorExpr(BinaryOperator.BiggerEquals, this, rhs, null, sourceSpan);\n }\n isBlank(sourceSpan) {\n // Note: We use equals by purpose here to compare to null and undefined in JS.\n // We use the typed null to allow strictNullChecks to narrow types.\n return this.equals(TYPED_NULL_EXPR, sourceSpan);\n }\n nullishCoalesce(rhs, sourceSpan) {\n return new BinaryOperatorExpr(BinaryOperator.NullishCoalesce, this, rhs, null, sourceSpan);\n }\n toStmt() {\n return new ExpressionStatement(this, null);\n }\n}\nclass ReadVarExpr extends Expression {\n constructor(name, type, sourceSpan) {\n super(type, sourceSpan);\n this.name = name;\n }\n isEquivalent(e) {\n return e instanceof ReadVarExpr && this.name === e.name;\n }\n isConstant() {\n return false;\n }\n visitExpression(visitor, context) {\n return visitor.visitReadVarExpr(this, context);\n }\n clone() {\n return new ReadVarExpr(this.name, this.type, this.sourceSpan);\n }\n set(value) {\n return new WriteVarExpr(this.name, value, null, this.sourceSpan);\n }\n}\nclass TypeofExpr extends Expression {\n constructor(expr, type, sourceSpan) {\n super(type, sourceSpan);\n this.expr = expr;\n }\n visitExpression(visitor, context) {\n return visitor.visitTypeofExpr(this, context);\n }\n isEquivalent(e) {\n return e instanceof TypeofExpr && e.expr.isEquivalent(this.expr);\n }\n isConstant() {\n return this.expr.isConstant();\n }\n clone() {\n return new TypeofExpr(this.expr.clone());\n }\n}\nclass WrappedNodeExpr extends Expression {\n constructor(node, type, sourceSpan) {\n super(type, sourceSpan);\n this.node = node;\n }\n isEquivalent(e) {\n return e instanceof WrappedNodeExpr && this.node === e.node;\n }\n isConstant() {\n return false;\n }\n visitExpression(visitor, context) {\n return visitor.visitWrappedNodeExpr(this, context);\n }\n clone() {\n return new WrappedNodeExpr(this.node, this.type, this.sourceSpan);\n }\n}\nclass WriteVarExpr extends Expression {\n constructor(name, value, type, sourceSpan) {\n super(type || value.type, sourceSpan);\n this.name = name;\n this.value = value;\n }\n isEquivalent(e) {\n return e instanceof WriteVarExpr && this.name === e.name && this.value.isEquivalent(e.value);\n }\n isConstant() {\n return false;\n }\n visitExpression(visitor, context) {\n return visitor.visitWriteVarExpr(this, context);\n }\n clone() {\n return new WriteVarExpr(this.name, this.value.clone(), this.type, this.sourceSpan);\n }\n toDeclStmt(type, modifiers) {\n return new DeclareVarStmt(this.name, this.value, type, modifiers, this.sourceSpan);\n }\n toConstDecl() {\n return this.toDeclStmt(INFERRED_TYPE, StmtModifier.Final);\n }\n}\nclass WriteKeyExpr extends Expression {\n constructor(receiver, index, value, type, sourceSpan) {\n super(type || value.type, sourceSpan);\n this.receiver = receiver;\n this.index = index;\n this.value = value;\n }\n isEquivalent(e) {\n return e instanceof WriteKeyExpr && this.receiver.isEquivalent(e.receiver) && this.index.isEquivalent(e.index) && this.value.isEquivalent(e.value);\n }\n isConstant() {\n return false;\n }\n visitExpression(visitor, context) {\n return visitor.visitWriteKeyExpr(this, context);\n }\n clone() {\n return new WriteKeyExpr(this.receiver.clone(), this.index.clone(), this.value.clone(), this.type, this.sourceSpan);\n }\n}\nclass WritePropExpr extends Expression {\n constructor(receiver, name, value, type, sourceSpan) {\n super(type || value.type, sourceSpan);\n this.receiver = receiver;\n this.name = name;\n this.value = value;\n }\n isEquivalent(e) {\n return e instanceof WritePropExpr && this.receiver.isEquivalent(e.receiver) && this.name === e.name && this.value.isEquivalent(e.value);\n }\n isConstant() {\n return false;\n }\n visitExpression(visitor, context) {\n return visitor.visitWritePropExpr(this, context);\n }\n clone() {\n return new WritePropExpr(this.receiver.clone(), this.name, this.value.clone(), this.type, this.sourceSpan);\n }\n}\nclass InvokeFunctionExpr extends Expression {\n constructor(fn, args, type, sourceSpan, pure = false) {\n super(type, sourceSpan);\n this.fn = fn;\n this.args = args;\n this.pure = pure;\n }\n // An alias for fn, which allows other logic to handle calls and property reads together.\n get receiver() {\n return this.fn;\n }\n isEquivalent(e) {\n return e instanceof InvokeFunctionExpr && this.fn.isEquivalent(e.fn) && areAllEquivalent(this.args, e.args) && this.pure === e.pure;\n }\n isConstant() {\n return false;\n }\n visitExpression(visitor, context) {\n return visitor.visitInvokeFunctionExpr(this, context);\n }\n clone() {\n return new InvokeFunctionExpr(this.fn.clone(), this.args.map(arg => arg.clone()), this.type, this.sourceSpan, this.pure);\n }\n}\nclass TaggedTemplateExpr extends Expression {\n constructor(tag, template, type, sourceSpan) {\n super(type, sourceSpan);\n this.tag = tag;\n this.template = template;\n }\n isEquivalent(e) {\n return e instanceof TaggedTemplateExpr && this.tag.isEquivalent(e.tag) && areAllEquivalentPredicate(this.template.elements, e.template.elements, (a, b) => a.text === b.text) && areAllEquivalent(this.template.expressions, e.template.expressions);\n }\n isConstant() {\n return false;\n }\n visitExpression(visitor, context) {\n return visitor.visitTaggedTemplateExpr(this, context);\n }\n clone() {\n return new TaggedTemplateExpr(this.tag.clone(), this.template.clone(), this.type, this.sourceSpan);\n }\n}\nclass InstantiateExpr extends Expression {\n constructor(classExpr, args, type, sourceSpan) {\n super(type, sourceSpan);\n this.classExpr = classExpr;\n this.args = args;\n }\n isEquivalent(e) {\n return e instanceof InstantiateExpr && this.classExpr.isEquivalent(e.classExpr) && areAllEquivalent(this.args, e.args);\n }\n isConstant() {\n return false;\n }\n visitExpression(visitor, context) {\n return visitor.visitInstantiateExpr(this, context);\n }\n clone() {\n return new InstantiateExpr(this.classExpr.clone(), this.args.map(arg => arg.clone()), this.type, this.sourceSpan);\n }\n}\nclass LiteralExpr extends Expression {\n constructor(value, type, sourceSpan) {\n super(type, sourceSpan);\n this.value = value;\n }\n isEquivalent(e) {\n return e instanceof LiteralExpr && this.value === e.value;\n }\n isConstant() {\n return true;\n }\n visitExpression(visitor, context) {\n return visitor.visitLiteralExpr(this, context);\n }\n clone() {\n return new LiteralExpr(this.value, this.type, this.sourceSpan);\n }\n}\nclass TemplateLiteral {\n constructor(elements, expressions) {\n this.elements = elements;\n this.expressions = expressions;\n }\n clone() {\n return new TemplateLiteral(this.elements.map(el => el.clone()), this.expressions.map(expr => expr.clone()));\n }\n}\nclass TemplateLiteralElement {\n constructor(text, sourceSpan, rawText) {\n this.text = text;\n this.sourceSpan = sourceSpan;\n // If `rawText` is not provided, try to extract the raw string from its\n // associated `sourceSpan`. If that is also not available, \"fake\" the raw\n // string instead by escaping the following control sequences:\n // - \"\\\" would otherwise indicate that the next character is a control character.\n // - \"`\" and \"${\" are template string control sequences that would otherwise prematurely\n // indicate the end of the template literal element.\n this.rawText = rawText ?? sourceSpan?.toString() ?? escapeForTemplateLiteral(escapeSlashes(text));\n }\n clone() {\n return new TemplateLiteralElement(this.text, this.sourceSpan, this.rawText);\n }\n}\nclass LiteralPiece {\n constructor(text, sourceSpan) {\n this.text = text;\n this.sourceSpan = sourceSpan;\n }\n}\nclass PlaceholderPiece {\n /**\n * Create a new instance of a `PlaceholderPiece`.\n *\n * @param text the name of this placeholder (e.g. `PH_1`).\n * @param sourceSpan the location of this placeholder in its localized message the source code.\n * @param associatedMessage reference to another message that this placeholder is associated with.\n * The `associatedMessage` is mainly used to provide a relationship to an ICU message that has\n * been extracted out from the message containing the placeholder.\n */\n constructor(text, sourceSpan, associatedMessage) {\n this.text = text;\n this.sourceSpan = sourceSpan;\n this.associatedMessage = associatedMessage;\n }\n}\nconst MEANING_SEPARATOR$1 = '|';\nconst ID_SEPARATOR$1 = '@@';\nconst LEGACY_ID_INDICATOR = '␟';\nclass LocalizedString extends Expression {\n constructor(metaBlock, messageParts, placeHolderNames, expressions, sourceSpan) {\n super(STRING_TYPE, sourceSpan);\n this.metaBlock = metaBlock;\n this.messageParts = messageParts;\n this.placeHolderNames = placeHolderNames;\n this.expressions = expressions;\n }\n isEquivalent(e) {\n // return e instanceof LocalizedString && this.message === e.message;\n return false;\n }\n isConstant() {\n return false;\n }\n visitExpression(visitor, context) {\n return visitor.visitLocalizedString(this, context);\n }\n clone() {\n return new LocalizedString(this.metaBlock, this.messageParts, this.placeHolderNames, this.expressions.map(expr => expr.clone()), this.sourceSpan);\n }\n /**\n * Serialize the given `meta` and `messagePart` into \"cooked\" and \"raw\" strings that can be used\n * in a `$localize` tagged string. The format of the metadata is the same as that parsed by\n * `parseI18nMeta()`.\n *\n * @param meta The metadata to serialize\n * @param messagePart The first part of the tagged string\n */\n serializeI18nHead() {\n let metaBlock = this.metaBlock.description || '';\n if (this.metaBlock.meaning) {\n metaBlock = `${this.metaBlock.meaning}${MEANING_SEPARATOR$1}${metaBlock}`;\n }\n if (this.metaBlock.customId) {\n metaBlock = `${metaBlock}${ID_SEPARATOR$1}${this.metaBlock.customId}`;\n }\n if (this.metaBlock.legacyIds) {\n this.metaBlock.legacyIds.forEach(legacyId => {\n metaBlock = `${metaBlock}${LEGACY_ID_INDICATOR}${legacyId}`;\n });\n }\n return createCookedRawString(metaBlock, this.messageParts[0].text, this.getMessagePartSourceSpan(0));\n }\n getMessagePartSourceSpan(i) {\n return this.messageParts[i]?.sourceSpan ?? this.sourceSpan;\n }\n getPlaceholderSourceSpan(i) {\n return this.placeHolderNames[i]?.sourceSpan ?? this.expressions[i]?.sourceSpan ?? this.sourceSpan;\n }\n /**\n * Serialize the given `placeholderName` and `messagePart` into \"cooked\" and \"raw\" strings that\n * can be used in a `$localize` tagged string.\n *\n * The format is `:[@@]:`.\n *\n * The `associated-id` is the message id of the (usually an ICU) message to which this placeholder\n * refers.\n *\n * @param partIndex The index of the message part to serialize.\n */\n serializeI18nTemplatePart(partIndex) {\n const placeholder = this.placeHolderNames[partIndex - 1];\n const messagePart = this.messageParts[partIndex];\n let metaBlock = placeholder.text;\n if (placeholder.associatedMessage?.legacyIds.length === 0) {\n metaBlock += `${ID_SEPARATOR$1}${computeMsgId(placeholder.associatedMessage.messageString, placeholder.associatedMessage.meaning)}`;\n }\n return createCookedRawString(metaBlock, messagePart.text, this.getMessagePartSourceSpan(partIndex));\n }\n}\nconst escapeSlashes = str => str.replace(/\\\\/g, '\\\\\\\\');\nconst escapeStartingColon = str => str.replace(/^:/, '\\\\:');\nconst escapeColons = str => str.replace(/:/g, '\\\\:');\nconst escapeForTemplateLiteral = str => str.replace(/`/g, '\\\\`').replace(/\\${/g, '$\\\\{');\n/**\n * Creates a `{cooked, raw}` object from the `metaBlock` and `messagePart`.\n *\n * The `raw` text must have various character sequences escaped:\n * * \"\\\" would otherwise indicate that the next character is a control character.\n * * \"`\" and \"${\" are template string control sequences that would otherwise prematurely indicate\n * the end of a message part.\n * * \":\" inside a metablock would prematurely indicate the end of the metablock.\n * * \":\" at the start of a messagePart with no metablock would erroneously indicate the start of a\n * metablock.\n *\n * @param metaBlock Any metadata that should be prepended to the string\n * @param messagePart The message part of the string\n */\nfunction createCookedRawString(metaBlock, messagePart, range) {\n if (metaBlock === '') {\n return {\n cooked: messagePart,\n raw: escapeForTemplateLiteral(escapeStartingColon(escapeSlashes(messagePart))),\n range\n };\n } else {\n return {\n cooked: `:${metaBlock}:${messagePart}`,\n raw: escapeForTemplateLiteral(`:${escapeColons(escapeSlashes(metaBlock))}:${escapeSlashes(messagePart)}`),\n range\n };\n }\n}\nclass ExternalExpr extends Expression {\n constructor(value, type, typeParams = null, sourceSpan) {\n super(type, sourceSpan);\n this.value = value;\n this.typeParams = typeParams;\n }\n isEquivalent(e) {\n return e instanceof ExternalExpr && this.value.name === e.value.name && this.value.moduleName === e.value.moduleName && this.value.runtime === e.value.runtime;\n }\n isConstant() {\n return false;\n }\n visitExpression(visitor, context) {\n return visitor.visitExternalExpr(this, context);\n }\n clone() {\n return new ExternalExpr(this.value, this.type, this.typeParams, this.sourceSpan);\n }\n}\nclass ExternalReference {\n constructor(moduleName, name, runtime) {\n this.moduleName = moduleName;\n this.name = name;\n this.runtime = runtime;\n }\n}\nclass ConditionalExpr extends Expression {\n constructor(condition, trueCase, falseCase = null, type, sourceSpan) {\n super(type || trueCase.type, sourceSpan);\n this.condition = condition;\n this.falseCase = falseCase;\n this.trueCase = trueCase;\n }\n isEquivalent(e) {\n return e instanceof ConditionalExpr && this.condition.isEquivalent(e.condition) && this.trueCase.isEquivalent(e.trueCase) && nullSafeIsEquivalent(this.falseCase, e.falseCase);\n }\n isConstant() {\n return false;\n }\n visitExpression(visitor, context) {\n return visitor.visitConditionalExpr(this, context);\n }\n clone() {\n return new ConditionalExpr(this.condition.clone(), this.trueCase.clone(), this.falseCase?.clone(), this.type, this.sourceSpan);\n }\n}\nclass DynamicImportExpr extends Expression {\n constructor(url, sourceSpan) {\n super(null, sourceSpan);\n this.url = url;\n }\n isEquivalent(e) {\n return e instanceof DynamicImportExpr && this.url === e.url;\n }\n isConstant() {\n return false;\n }\n visitExpression(visitor, context) {\n return visitor.visitDynamicImportExpr(this, context);\n }\n clone() {\n return new DynamicImportExpr(this.url, this.sourceSpan);\n }\n}\nclass NotExpr extends Expression {\n constructor(condition, sourceSpan) {\n super(BOOL_TYPE, sourceSpan);\n this.condition = condition;\n }\n isEquivalent(e) {\n return e instanceof NotExpr && this.condition.isEquivalent(e.condition);\n }\n isConstant() {\n return false;\n }\n visitExpression(visitor, context) {\n return visitor.visitNotExpr(this, context);\n }\n clone() {\n return new NotExpr(this.condition.clone(), this.sourceSpan);\n }\n}\nclass FnParam {\n constructor(name, type = null) {\n this.name = name;\n this.type = type;\n }\n isEquivalent(param) {\n return this.name === param.name;\n }\n clone() {\n return new FnParam(this.name, this.type);\n }\n}\nclass FunctionExpr extends Expression {\n constructor(params, statements, type, sourceSpan, name) {\n super(type, sourceSpan);\n this.params = params;\n this.statements = statements;\n this.name = name;\n }\n isEquivalent(e) {\n return (e instanceof FunctionExpr || e instanceof DeclareFunctionStmt) && areAllEquivalent(this.params, e.params) && areAllEquivalent(this.statements, e.statements);\n }\n isConstant() {\n return false;\n }\n visitExpression(visitor, context) {\n return visitor.visitFunctionExpr(this, context);\n }\n toDeclStmt(name, modifiers) {\n return new DeclareFunctionStmt(name, this.params, this.statements, this.type, modifiers, this.sourceSpan);\n }\n clone() {\n // TODO: Should we deep clone statements?\n return new FunctionExpr(this.params.map(p => p.clone()), this.statements, this.type, this.sourceSpan, this.name);\n }\n}\nclass ArrowFunctionExpr extends Expression {\n // Note that `body: Expression` represents `() => expr` whereas\n // `body: Statement[]` represents `() => { expr }`.\n constructor(params, body, type, sourceSpan) {\n super(type, sourceSpan);\n this.params = params;\n this.body = body;\n }\n isEquivalent(e) {\n if (!(e instanceof ArrowFunctionExpr) || !areAllEquivalent(this.params, e.params)) {\n return false;\n }\n if (this.body instanceof Expression && e.body instanceof Expression) {\n return this.body.isEquivalent(e.body);\n }\n if (Array.isArray(this.body) && Array.isArray(e.body)) {\n return areAllEquivalent(this.body, e.body);\n }\n return false;\n }\n isConstant() {\n return false;\n }\n visitExpression(visitor, context) {\n return visitor.visitArrowFunctionExpr(this, context);\n }\n clone() {\n // TODO: Should we deep clone statements?\n return new ArrowFunctionExpr(this.params.map(p => p.clone()), Array.isArray(this.body) ? this.body : this.body.clone(), this.type, this.sourceSpan);\n }\n toDeclStmt(name, modifiers) {\n return new DeclareVarStmt(name, this, INFERRED_TYPE, modifiers, this.sourceSpan);\n }\n}\nclass UnaryOperatorExpr extends Expression {\n constructor(operator, expr, type, sourceSpan, parens = true) {\n super(type || NUMBER_TYPE, sourceSpan);\n this.operator = operator;\n this.expr = expr;\n this.parens = parens;\n }\n isEquivalent(e) {\n return e instanceof UnaryOperatorExpr && this.operator === e.operator && this.expr.isEquivalent(e.expr);\n }\n isConstant() {\n return false;\n }\n visitExpression(visitor, context) {\n return visitor.visitUnaryOperatorExpr(this, context);\n }\n clone() {\n return new UnaryOperatorExpr(this.operator, this.expr.clone(), this.type, this.sourceSpan, this.parens);\n }\n}\nclass BinaryOperatorExpr extends Expression {\n constructor(operator, lhs, rhs, type, sourceSpan, parens = true) {\n super(type || lhs.type, sourceSpan);\n this.operator = operator;\n this.rhs = rhs;\n this.parens = parens;\n this.lhs = lhs;\n }\n isEquivalent(e) {\n return e instanceof BinaryOperatorExpr && this.operator === e.operator && this.lhs.isEquivalent(e.lhs) && this.rhs.isEquivalent(e.rhs);\n }\n isConstant() {\n return false;\n }\n visitExpression(visitor, context) {\n return visitor.visitBinaryOperatorExpr(this, context);\n }\n clone() {\n return new BinaryOperatorExpr(this.operator, this.lhs.clone(), this.rhs.clone(), this.type, this.sourceSpan, this.parens);\n }\n}\nclass ReadPropExpr extends Expression {\n constructor(receiver, name, type, sourceSpan) {\n super(type, sourceSpan);\n this.receiver = receiver;\n this.name = name;\n }\n // An alias for name, which allows other logic to handle property reads and keyed reads together.\n get index() {\n return this.name;\n }\n isEquivalent(e) {\n return e instanceof ReadPropExpr && this.receiver.isEquivalent(e.receiver) && this.name === e.name;\n }\n isConstant() {\n return false;\n }\n visitExpression(visitor, context) {\n return visitor.visitReadPropExpr(this, context);\n }\n set(value) {\n return new WritePropExpr(this.receiver, this.name, value, null, this.sourceSpan);\n }\n clone() {\n return new ReadPropExpr(this.receiver.clone(), this.name, this.type, this.sourceSpan);\n }\n}\nclass ReadKeyExpr extends Expression {\n constructor(receiver, index, type, sourceSpan) {\n super(type, sourceSpan);\n this.receiver = receiver;\n this.index = index;\n }\n isEquivalent(e) {\n return e instanceof ReadKeyExpr && this.receiver.isEquivalent(e.receiver) && this.index.isEquivalent(e.index);\n }\n isConstant() {\n return false;\n }\n visitExpression(visitor, context) {\n return visitor.visitReadKeyExpr(this, context);\n }\n set(value) {\n return new WriteKeyExpr(this.receiver, this.index, value, null, this.sourceSpan);\n }\n clone() {\n return new ReadKeyExpr(this.receiver.clone(), this.index.clone(), this.type, this.sourceSpan);\n }\n}\nclass LiteralArrayExpr extends Expression {\n constructor(entries, type, sourceSpan) {\n super(type, sourceSpan);\n this.entries = entries;\n }\n isConstant() {\n return this.entries.every(e => e.isConstant());\n }\n isEquivalent(e) {\n return e instanceof LiteralArrayExpr && areAllEquivalent(this.entries, e.entries);\n }\n visitExpression(visitor, context) {\n return visitor.visitLiteralArrayExpr(this, context);\n }\n clone() {\n return new LiteralArrayExpr(this.entries.map(e => e.clone()), this.type, this.sourceSpan);\n }\n}\nclass LiteralMapEntry {\n constructor(key, value, quoted) {\n this.key = key;\n this.value = value;\n this.quoted = quoted;\n }\n isEquivalent(e) {\n return this.key === e.key && this.value.isEquivalent(e.value);\n }\n clone() {\n return new LiteralMapEntry(this.key, this.value.clone(), this.quoted);\n }\n}\nclass LiteralMapExpr extends Expression {\n constructor(entries, type, sourceSpan) {\n super(type, sourceSpan);\n this.entries = entries;\n this.valueType = null;\n if (type) {\n this.valueType = type.valueType;\n }\n }\n isEquivalent(e) {\n return e instanceof LiteralMapExpr && areAllEquivalent(this.entries, e.entries);\n }\n isConstant() {\n return this.entries.every(e => e.value.isConstant());\n }\n visitExpression(visitor, context) {\n return visitor.visitLiteralMapExpr(this, context);\n }\n clone() {\n const entriesClone = this.entries.map(entry => entry.clone());\n return new LiteralMapExpr(entriesClone, this.type, this.sourceSpan);\n }\n}\nclass CommaExpr extends Expression {\n constructor(parts, sourceSpan) {\n super(parts[parts.length - 1].type, sourceSpan);\n this.parts = parts;\n }\n isEquivalent(e) {\n return e instanceof CommaExpr && areAllEquivalent(this.parts, e.parts);\n }\n isConstant() {\n return false;\n }\n visitExpression(visitor, context) {\n return visitor.visitCommaExpr(this, context);\n }\n clone() {\n return new CommaExpr(this.parts.map(p => p.clone()));\n }\n}\nconst NULL_EXPR = new LiteralExpr(null, null, null);\nconst TYPED_NULL_EXPR = new LiteralExpr(null, INFERRED_TYPE, null);\n//// Statements\nvar StmtModifier;\n(function (StmtModifier) {\n StmtModifier[StmtModifier[\"None\"] = 0] = \"None\";\n StmtModifier[StmtModifier[\"Final\"] = 1] = \"Final\";\n StmtModifier[StmtModifier[\"Private\"] = 2] = \"Private\";\n StmtModifier[StmtModifier[\"Exported\"] = 4] = \"Exported\";\n StmtModifier[StmtModifier[\"Static\"] = 8] = \"Static\";\n})(StmtModifier || (StmtModifier = {}));\nclass LeadingComment {\n constructor(text, multiline, trailingNewline) {\n this.text = text;\n this.multiline = multiline;\n this.trailingNewline = trailingNewline;\n }\n toString() {\n return this.multiline ? ` ${this.text} ` : this.text;\n }\n}\nclass JSDocComment extends LeadingComment {\n constructor(tags) {\n super('', /* multiline */true, /* trailingNewline */true);\n this.tags = tags;\n }\n toString() {\n return serializeTags(this.tags);\n }\n}\nclass Statement {\n constructor(modifiers = StmtModifier.None, sourceSpan = null, leadingComments) {\n this.modifiers = modifiers;\n this.sourceSpan = sourceSpan;\n this.leadingComments = leadingComments;\n }\n hasModifier(modifier) {\n return (this.modifiers & modifier) !== 0;\n }\n addLeadingComment(leadingComment) {\n this.leadingComments = this.leadingComments ?? [];\n this.leadingComments.push(leadingComment);\n }\n}\nclass DeclareVarStmt extends Statement {\n constructor(name, value, type, modifiers, sourceSpan, leadingComments) {\n super(modifiers, sourceSpan, leadingComments);\n this.name = name;\n this.value = value;\n this.type = type || value && value.type || null;\n }\n isEquivalent(stmt) {\n return stmt instanceof DeclareVarStmt && this.name === stmt.name && (this.value ? !!stmt.value && this.value.isEquivalent(stmt.value) : !stmt.value);\n }\n visitStatement(visitor, context) {\n return visitor.visitDeclareVarStmt(this, context);\n }\n}\nclass DeclareFunctionStmt extends Statement {\n constructor(name, params, statements, type, modifiers, sourceSpan, leadingComments) {\n super(modifiers, sourceSpan, leadingComments);\n this.name = name;\n this.params = params;\n this.statements = statements;\n this.type = type || null;\n }\n isEquivalent(stmt) {\n return stmt instanceof DeclareFunctionStmt && areAllEquivalent(this.params, stmt.params) && areAllEquivalent(this.statements, stmt.statements);\n }\n visitStatement(visitor, context) {\n return visitor.visitDeclareFunctionStmt(this, context);\n }\n}\nclass ExpressionStatement extends Statement {\n constructor(expr, sourceSpan, leadingComments) {\n super(StmtModifier.None, sourceSpan, leadingComments);\n this.expr = expr;\n }\n isEquivalent(stmt) {\n return stmt instanceof ExpressionStatement && this.expr.isEquivalent(stmt.expr);\n }\n visitStatement(visitor, context) {\n return visitor.visitExpressionStmt(this, context);\n }\n}\nclass ReturnStatement extends Statement {\n constructor(value, sourceSpan = null, leadingComments) {\n super(StmtModifier.None, sourceSpan, leadingComments);\n this.value = value;\n }\n isEquivalent(stmt) {\n return stmt instanceof ReturnStatement && this.value.isEquivalent(stmt.value);\n }\n visitStatement(visitor, context) {\n return visitor.visitReturnStmt(this, context);\n }\n}\nclass IfStmt extends Statement {\n constructor(condition, trueCase, falseCase = [], sourceSpan, leadingComments) {\n super(StmtModifier.None, sourceSpan, leadingComments);\n this.condition = condition;\n this.trueCase = trueCase;\n this.falseCase = falseCase;\n }\n isEquivalent(stmt) {\n return stmt instanceof IfStmt && this.condition.isEquivalent(stmt.condition) && areAllEquivalent(this.trueCase, stmt.trueCase) && areAllEquivalent(this.falseCase, stmt.falseCase);\n }\n visitStatement(visitor, context) {\n return visitor.visitIfStmt(this, context);\n }\n}\nclass RecursiveAstVisitor$1 {\n visitType(ast, context) {\n return ast;\n }\n visitExpression(ast, context) {\n if (ast.type) {\n ast.type.visitType(this, context);\n }\n return ast;\n }\n visitBuiltinType(type, context) {\n return this.visitType(type, context);\n }\n visitExpressionType(type, context) {\n type.value.visitExpression(this, context);\n if (type.typeParams !== null) {\n type.typeParams.forEach(param => this.visitType(param, context));\n }\n return this.visitType(type, context);\n }\n visitArrayType(type, context) {\n return this.visitType(type, context);\n }\n visitMapType(type, context) {\n return this.visitType(type, context);\n }\n visitTransplantedType(type, context) {\n return type;\n }\n visitWrappedNodeExpr(ast, context) {\n return ast;\n }\n visitTypeofExpr(ast, context) {\n return this.visitExpression(ast, context);\n }\n visitReadVarExpr(ast, context) {\n return this.visitExpression(ast, context);\n }\n visitWriteVarExpr(ast, context) {\n ast.value.visitExpression(this, context);\n return this.visitExpression(ast, context);\n }\n visitWriteKeyExpr(ast, context) {\n ast.receiver.visitExpression(this, context);\n ast.index.visitExpression(this, context);\n ast.value.visitExpression(this, context);\n return this.visitExpression(ast, context);\n }\n visitWritePropExpr(ast, context) {\n ast.receiver.visitExpression(this, context);\n ast.value.visitExpression(this, context);\n return this.visitExpression(ast, context);\n }\n visitDynamicImportExpr(ast, context) {\n return this.visitExpression(ast, context);\n }\n visitInvokeFunctionExpr(ast, context) {\n ast.fn.visitExpression(this, context);\n this.visitAllExpressions(ast.args, context);\n return this.visitExpression(ast, context);\n }\n visitTaggedTemplateExpr(ast, context) {\n ast.tag.visitExpression(this, context);\n this.visitAllExpressions(ast.template.expressions, context);\n return this.visitExpression(ast, context);\n }\n visitInstantiateExpr(ast, context) {\n ast.classExpr.visitExpression(this, context);\n this.visitAllExpressions(ast.args, context);\n return this.visitExpression(ast, context);\n }\n visitLiteralExpr(ast, context) {\n return this.visitExpression(ast, context);\n }\n visitLocalizedString(ast, context) {\n return this.visitExpression(ast, context);\n }\n visitExternalExpr(ast, context) {\n if (ast.typeParams) {\n ast.typeParams.forEach(type => type.visitType(this, context));\n }\n return this.visitExpression(ast, context);\n }\n visitConditionalExpr(ast, context) {\n ast.condition.visitExpression(this, context);\n ast.trueCase.visitExpression(this, context);\n ast.falseCase.visitExpression(this, context);\n return this.visitExpression(ast, context);\n }\n visitNotExpr(ast, context) {\n ast.condition.visitExpression(this, context);\n return this.visitExpression(ast, context);\n }\n visitFunctionExpr(ast, context) {\n this.visitAllStatements(ast.statements, context);\n return this.visitExpression(ast, context);\n }\n visitArrowFunctionExpr(ast, context) {\n if (Array.isArray(ast.body)) {\n this.visitAllStatements(ast.body, context);\n } else {\n this.visitExpression(ast.body, context);\n }\n return this.visitExpression(ast, context);\n }\n visitUnaryOperatorExpr(ast, context) {\n ast.expr.visitExpression(this, context);\n return this.visitExpression(ast, context);\n }\n visitBinaryOperatorExpr(ast, context) {\n ast.lhs.visitExpression(this, context);\n ast.rhs.visitExpression(this, context);\n return this.visitExpression(ast, context);\n }\n visitReadPropExpr(ast, context) {\n ast.receiver.visitExpression(this, context);\n return this.visitExpression(ast, context);\n }\n visitReadKeyExpr(ast, context) {\n ast.receiver.visitExpression(this, context);\n ast.index.visitExpression(this, context);\n return this.visitExpression(ast, context);\n }\n visitLiteralArrayExpr(ast, context) {\n this.visitAllExpressions(ast.entries, context);\n return this.visitExpression(ast, context);\n }\n visitLiteralMapExpr(ast, context) {\n ast.entries.forEach(entry => entry.value.visitExpression(this, context));\n return this.visitExpression(ast, context);\n }\n visitCommaExpr(ast, context) {\n this.visitAllExpressions(ast.parts, context);\n return this.visitExpression(ast, context);\n }\n visitAllExpressions(exprs, context) {\n exprs.forEach(expr => expr.visitExpression(this, context));\n }\n visitDeclareVarStmt(stmt, context) {\n if (stmt.value) {\n stmt.value.visitExpression(this, context);\n }\n if (stmt.type) {\n stmt.type.visitType(this, context);\n }\n return stmt;\n }\n visitDeclareFunctionStmt(stmt, context) {\n this.visitAllStatements(stmt.statements, context);\n if (stmt.type) {\n stmt.type.visitType(this, context);\n }\n return stmt;\n }\n visitExpressionStmt(stmt, context) {\n stmt.expr.visitExpression(this, context);\n return stmt;\n }\n visitReturnStmt(stmt, context) {\n stmt.value.visitExpression(this, context);\n return stmt;\n }\n visitIfStmt(stmt, context) {\n stmt.condition.visitExpression(this, context);\n this.visitAllStatements(stmt.trueCase, context);\n this.visitAllStatements(stmt.falseCase, context);\n return stmt;\n }\n visitAllStatements(stmts, context) {\n stmts.forEach(stmt => stmt.visitStatement(this, context));\n }\n}\nfunction leadingComment(text, multiline = false, trailingNewline = true) {\n return new LeadingComment(text, multiline, trailingNewline);\n}\nfunction jsDocComment(tags = []) {\n return new JSDocComment(tags);\n}\nfunction variable(name, type, sourceSpan) {\n return new ReadVarExpr(name, type, sourceSpan);\n}\nfunction importExpr(id, typeParams = null, sourceSpan) {\n return new ExternalExpr(id, null, typeParams, sourceSpan);\n}\nfunction importType(id, typeParams, typeModifiers) {\n return id != null ? expressionType(importExpr(id, typeParams, null), typeModifiers) : null;\n}\nfunction expressionType(expr, typeModifiers, typeParams) {\n return new ExpressionType(expr, typeModifiers, typeParams);\n}\nfunction transplantedType(type, typeModifiers) {\n return new TransplantedType(type, typeModifiers);\n}\nfunction typeofExpr(expr) {\n return new TypeofExpr(expr);\n}\nfunction literalArr(values, type, sourceSpan) {\n return new LiteralArrayExpr(values, type, sourceSpan);\n}\nfunction literalMap(values, type = null) {\n return new LiteralMapExpr(values.map(e => new LiteralMapEntry(e.key, e.value, e.quoted)), type, null);\n}\nfunction unary(operator, expr, type, sourceSpan) {\n return new UnaryOperatorExpr(operator, expr, type, sourceSpan);\n}\nfunction not(expr, sourceSpan) {\n return new NotExpr(expr, sourceSpan);\n}\nfunction fn(params, body, type, sourceSpan, name) {\n return new FunctionExpr(params, body, type, sourceSpan, name);\n}\nfunction arrowFn(params, body, type, sourceSpan) {\n return new ArrowFunctionExpr(params, body, type, sourceSpan);\n}\nfunction ifStmt(condition, thenClause, elseClause, sourceSpan, leadingComments) {\n return new IfStmt(condition, thenClause, elseClause, sourceSpan, leadingComments);\n}\nfunction taggedTemplate(tag, template, type, sourceSpan) {\n return new TaggedTemplateExpr(tag, template, type, sourceSpan);\n}\nfunction literal(value, type, sourceSpan) {\n return new LiteralExpr(value, type, sourceSpan);\n}\nfunction localizedString(metaBlock, messageParts, placeholderNames, expressions, sourceSpan) {\n return new LocalizedString(metaBlock, messageParts, placeholderNames, expressions, sourceSpan);\n}\nfunction isNull(exp) {\n return exp instanceof LiteralExpr && exp.value === null;\n}\n/*\n * Serializes a `Tag` into a string.\n * Returns a string like \" @foo {bar} baz\" (note the leading whitespace before `@foo`).\n */\nfunction tagToString(tag) {\n let out = '';\n if (tag.tagName) {\n out += ` @${tag.tagName}`;\n }\n if (tag.text) {\n if (tag.text.match(/\\/\\*|\\*\\//)) {\n throw new Error('JSDoc text cannot contain \"/*\" and \"*/\"');\n }\n out += ' ' + tag.text.replace(/@/g, '\\\\@');\n }\n return out;\n}\nfunction serializeTags(tags) {\n if (tags.length === 0) return '';\n if (tags.length === 1 && tags[0].tagName && !tags[0].text) {\n // The JSDOC comment is a single simple tag: e.g `/** @tagname */`.\n return `*${tagToString(tags[0])} `;\n }\n let out = '*\\n';\n for (const tag of tags) {\n out += ' *';\n // If the tagToString is multi-line, insert \" * \" prefixes on lines.\n out += tagToString(tag).replace(/\\n/g, '\\n * ');\n out += '\\n';\n }\n out += ' ';\n return out;\n}\nvar output_ast = /*#__PURE__*/Object.freeze({\n __proto__: null,\n get TypeModifier() {\n return TypeModifier;\n },\n Type: Type,\n get BuiltinTypeName() {\n return BuiltinTypeName;\n },\n BuiltinType: BuiltinType,\n ExpressionType: ExpressionType,\n ArrayType: ArrayType,\n MapType: MapType,\n TransplantedType: TransplantedType,\n DYNAMIC_TYPE: DYNAMIC_TYPE,\n INFERRED_TYPE: INFERRED_TYPE,\n BOOL_TYPE: BOOL_TYPE,\n INT_TYPE: INT_TYPE,\n NUMBER_TYPE: NUMBER_TYPE,\n STRING_TYPE: STRING_TYPE,\n FUNCTION_TYPE: FUNCTION_TYPE,\n NONE_TYPE: NONE_TYPE,\n get UnaryOperator() {\n return UnaryOperator;\n },\n get BinaryOperator() {\n return BinaryOperator;\n },\n nullSafeIsEquivalent: nullSafeIsEquivalent,\n areAllEquivalent: areAllEquivalent,\n Expression: Expression,\n ReadVarExpr: ReadVarExpr,\n TypeofExpr: TypeofExpr,\n WrappedNodeExpr: WrappedNodeExpr,\n WriteVarExpr: WriteVarExpr,\n WriteKeyExpr: WriteKeyExpr,\n WritePropExpr: WritePropExpr,\n InvokeFunctionExpr: InvokeFunctionExpr,\n TaggedTemplateExpr: TaggedTemplateExpr,\n InstantiateExpr: InstantiateExpr,\n LiteralExpr: LiteralExpr,\n TemplateLiteral: TemplateLiteral,\n TemplateLiteralElement: TemplateLiteralElement,\n LiteralPiece: LiteralPiece,\n PlaceholderPiece: PlaceholderPiece,\n LocalizedString: LocalizedString,\n ExternalExpr: ExternalExpr,\n ExternalReference: ExternalReference,\n ConditionalExpr: ConditionalExpr,\n DynamicImportExpr: DynamicImportExpr,\n NotExpr: NotExpr,\n FnParam: FnParam,\n FunctionExpr: FunctionExpr,\n ArrowFunctionExpr: ArrowFunctionExpr,\n UnaryOperatorExpr: UnaryOperatorExpr,\n BinaryOperatorExpr: BinaryOperatorExpr,\n ReadPropExpr: ReadPropExpr,\n ReadKeyExpr: ReadKeyExpr,\n LiteralArrayExpr: LiteralArrayExpr,\n LiteralMapEntry: LiteralMapEntry,\n LiteralMapExpr: LiteralMapExpr,\n CommaExpr: CommaExpr,\n NULL_EXPR: NULL_EXPR,\n TYPED_NULL_EXPR: TYPED_NULL_EXPR,\n get StmtModifier() {\n return StmtModifier;\n },\n LeadingComment: LeadingComment,\n JSDocComment: JSDocComment,\n Statement: Statement,\n DeclareVarStmt: DeclareVarStmt,\n DeclareFunctionStmt: DeclareFunctionStmt,\n ExpressionStatement: ExpressionStatement,\n ReturnStatement: ReturnStatement,\n IfStmt: IfStmt,\n RecursiveAstVisitor: RecursiveAstVisitor$1,\n leadingComment: leadingComment,\n jsDocComment: jsDocComment,\n variable: variable,\n importExpr: importExpr,\n importType: importType,\n expressionType: expressionType,\n transplantedType: transplantedType,\n typeofExpr: typeofExpr,\n literalArr: literalArr,\n literalMap: literalMap,\n unary: unary,\n not: not,\n fn: fn,\n arrowFn: arrowFn,\n ifStmt: ifStmt,\n taggedTemplate: taggedTemplate,\n literal: literal,\n localizedString: localizedString,\n isNull: isNull\n});\nconst CONSTANT_PREFIX = '_c';\n/**\n * `ConstantPool` tries to reuse literal factories when two or more literals are identical.\n * We determine whether literals are identical by creating a key out of their AST using the\n * `KeyVisitor`. This constant is used to replace dynamic expressions which can't be safely\n * converted into a key. E.g. given an expression `{foo: bar()}`, since we don't know what\n * the result of `bar` will be, we create a key that looks like `{foo: }`. Note\n * that we use a variable, rather than something like `null` in order to avoid collisions.\n */\nconst UNKNOWN_VALUE_KEY = variable('');\n/**\n * Context to use when producing a key.\n *\n * This ensures we see the constant not the reference variable when producing\n * a key.\n */\nconst KEY_CONTEXT = {};\n/**\n * Generally all primitive values are excluded from the `ConstantPool`, but there is an exclusion\n * for strings that reach a certain length threshold. This constant defines the length threshold for\n * strings.\n */\nconst POOL_INCLUSION_LENGTH_THRESHOLD_FOR_STRINGS = 50;\n/**\n * A node that is a place-holder that allows the node to be replaced when the actual\n * node is known.\n *\n * This allows the constant pool to change an expression from a direct reference to\n * a constant to a shared constant. It returns a fix-up node that is later allowed to\n * change the referenced expression.\n */\nclass FixupExpression extends Expression {\n constructor(resolved) {\n super(resolved.type);\n this.resolved = resolved;\n this.shared = false;\n this.original = resolved;\n }\n visitExpression(visitor, context) {\n if (context === KEY_CONTEXT) {\n // When producing a key we want to traverse the constant not the\n // variable used to refer to it.\n return this.original.visitExpression(visitor, context);\n } else {\n return this.resolved.visitExpression(visitor, context);\n }\n }\n isEquivalent(e) {\n return e instanceof FixupExpression && this.resolved.isEquivalent(e.resolved);\n }\n isConstant() {\n return true;\n }\n clone() {\n throw new Error(`Not supported.`);\n }\n fixup(expression) {\n this.resolved = expression;\n this.shared = true;\n }\n}\n/**\n * A constant pool allows a code emitter to share constant in an output context.\n *\n * The constant pool also supports sharing access to ivy definitions references.\n */\nclass ConstantPool {\n constructor(isClosureCompilerEnabled = false) {\n this.isClosureCompilerEnabled = isClosureCompilerEnabled;\n this.statements = [];\n this.literals = new Map();\n this.literalFactories = new Map();\n this.sharedConstants = new Map();\n /**\n * Constant pool also tracks claimed names from {@link uniqueName}.\n * This is useful to avoid collisions if variables are intended to be\n * named a certain way- but may conflict. We wouldn't want to always suffix\n * them with unique numbers.\n */\n this._claimedNames = new Map();\n this.nextNameIndex = 0;\n }\n getConstLiteral(literal, forceShared) {\n if (literal instanceof LiteralExpr && !isLongStringLiteral(literal) || literal instanceof FixupExpression) {\n // Do no put simple literals into the constant pool or try to produce a constant for a\n // reference to a constant.\n return literal;\n }\n const key = GenericKeyFn.INSTANCE.keyOf(literal);\n let fixup = this.literals.get(key);\n let newValue = false;\n if (!fixup) {\n fixup = new FixupExpression(literal);\n this.literals.set(key, fixup);\n newValue = true;\n }\n if (!newValue && !fixup.shared || newValue && forceShared) {\n // Replace the expression with a variable\n const name = this.freshName();\n let definition;\n let usage;\n if (this.isClosureCompilerEnabled && isLongStringLiteral(literal)) {\n // For string literals, Closure will **always** inline the string at\n // **all** usages, duplicating it each time. For large strings, this\n // unnecessarily bloats bundle size. To work around this restriction, we\n // wrap the string in a function, and call that function for each usage.\n // This tricks Closure into using inline logic for functions instead of\n // string literals. Function calls are only inlined if the body is small\n // enough to be worth it. By doing this, very large strings will be\n // shared across multiple usages, rather than duplicating the string at\n // each usage site.\n //\n // const myStr = function() { return \"very very very long string\"; };\n // const usage1 = myStr();\n // const usage2 = myStr();\n definition = variable(name).set(new FunctionExpr([],\n // Params.\n [\n // Statements.\n new ReturnStatement(literal)]));\n usage = variable(name).callFn([]);\n } else {\n // Just declare and use the variable directly, without a function call\n // indirection. This saves a few bytes and avoids an unnecessary call.\n definition = variable(name).set(literal);\n usage = variable(name);\n }\n this.statements.push(definition.toDeclStmt(INFERRED_TYPE, StmtModifier.Final));\n fixup.fixup(usage);\n }\n return fixup;\n }\n getSharedConstant(def, expr) {\n const key = def.keyOf(expr);\n if (!this.sharedConstants.has(key)) {\n const id = this.freshName();\n this.sharedConstants.set(key, variable(id));\n this.statements.push(def.toSharedConstantDeclaration(id, expr));\n }\n return this.sharedConstants.get(key);\n }\n getLiteralFactory(literal) {\n // Create a pure function that builds an array of a mix of constant and variable expressions\n if (literal instanceof LiteralArrayExpr) {\n const argumentsForKey = literal.entries.map(e => e.isConstant() ? e : UNKNOWN_VALUE_KEY);\n const key = GenericKeyFn.INSTANCE.keyOf(literalArr(argumentsForKey));\n return this._getLiteralFactory(key, literal.entries, entries => literalArr(entries));\n } else {\n const expressionForKey = literalMap(literal.entries.map(e => ({\n key: e.key,\n value: e.value.isConstant() ? e.value : UNKNOWN_VALUE_KEY,\n quoted: e.quoted\n })));\n const key = GenericKeyFn.INSTANCE.keyOf(expressionForKey);\n return this._getLiteralFactory(key, literal.entries.map(e => e.value), entries => literalMap(entries.map((value, index) => ({\n key: literal.entries[index].key,\n value,\n quoted: literal.entries[index].quoted\n }))));\n }\n }\n // TODO: useUniqueName(false) is necessary for naming compatibility with\n // TemplateDefinitionBuilder, but should be removed once Template Pipeline is the default.\n getSharedFunctionReference(fn, prefix, useUniqueName = true) {\n const isArrow = fn instanceof ArrowFunctionExpr;\n for (const current of this.statements) {\n // Arrow functions are saved as variables so we check if the\n // value of the variable is the same as the arrow function.\n if (isArrow && current instanceof DeclareVarStmt && current.value?.isEquivalent(fn)) {\n return variable(current.name);\n }\n // Function declarations are saved as function statements\n // so we compare them directly to the passed-in function.\n if (!isArrow && current instanceof DeclareFunctionStmt && fn instanceof FunctionExpr && fn.isEquivalent(current)) {\n return variable(current.name);\n }\n }\n // Otherwise declare the function.\n const name = useUniqueName ? this.uniqueName(prefix) : prefix;\n this.statements.push(fn instanceof FunctionExpr ? fn.toDeclStmt(name, StmtModifier.Final) : new DeclareVarStmt(name, fn, INFERRED_TYPE, StmtModifier.Final, fn.sourceSpan));\n return variable(name);\n }\n _getLiteralFactory(key, values, resultMap) {\n let literalFactory = this.literalFactories.get(key);\n const literalFactoryArguments = values.filter(e => !e.isConstant());\n if (!literalFactory) {\n const resultExpressions = values.map((e, index) => e.isConstant() ? this.getConstLiteral(e, true) : variable(`a${index}`));\n const parameters = resultExpressions.filter(isVariable).map(e => new FnParam(e.name, DYNAMIC_TYPE));\n const pureFunctionDeclaration = arrowFn(parameters, resultMap(resultExpressions), INFERRED_TYPE);\n const name = this.freshName();\n this.statements.push(variable(name).set(pureFunctionDeclaration).toDeclStmt(INFERRED_TYPE, StmtModifier.Final));\n literalFactory = variable(name);\n this.literalFactories.set(key, literalFactory);\n }\n return {\n literalFactory,\n literalFactoryArguments\n };\n }\n /**\n * Produce a unique name in the context of this pool.\n *\n * The name might be unique among different prefixes if any of the prefixes end in\n * a digit so the prefix should be a constant string (not based on user input) and\n * must not end in a digit.\n */\n uniqueName(name, alwaysIncludeSuffix = true) {\n const count = this._claimedNames.get(name) ?? 0;\n const result = count === 0 && !alwaysIncludeSuffix ? `${name}` : `${name}${count}`;\n this._claimedNames.set(name, count + 1);\n return result;\n }\n freshName() {\n return this.uniqueName(CONSTANT_PREFIX);\n }\n}\nclass GenericKeyFn {\n static {\n this.INSTANCE = new GenericKeyFn();\n }\n keyOf(expr) {\n if (expr instanceof LiteralExpr && typeof expr.value === 'string') {\n return `\"${expr.value}\"`;\n } else if (expr instanceof LiteralExpr) {\n return String(expr.value);\n } else if (expr instanceof LiteralArrayExpr) {\n const entries = [];\n for (const entry of expr.entries) {\n entries.push(this.keyOf(entry));\n }\n return `[${entries.join(',')}]`;\n } else if (expr instanceof LiteralMapExpr) {\n const entries = [];\n for (const entry of expr.entries) {\n let key = entry.key;\n if (entry.quoted) {\n key = `\"${key}\"`;\n }\n entries.push(key + ':' + this.keyOf(entry.value));\n }\n return `{${entries.join(',')}}`;\n } else if (expr instanceof ExternalExpr) {\n return `import(\"${expr.value.moduleName}\", ${expr.value.name})`;\n } else if (expr instanceof ReadVarExpr) {\n return `read(${expr.name})`;\n } else if (expr instanceof TypeofExpr) {\n return `typeof(${this.keyOf(expr.expr)})`;\n } else {\n throw new Error(`${this.constructor.name} does not handle expressions of type ${expr.constructor.name}`);\n }\n }\n}\nfunction isVariable(e) {\n return e instanceof ReadVarExpr;\n}\nfunction isLongStringLiteral(expr) {\n return expr instanceof LiteralExpr && typeof expr.value === 'string' && expr.value.length >= POOL_INCLUSION_LENGTH_THRESHOLD_FOR_STRINGS;\n}\nconst CORE = '@angular/core';\nclass Identifiers {\n /* Methods */\n static {\n this.NEW_METHOD = 'factory';\n }\n static {\n this.TRANSFORM_METHOD = 'transform';\n }\n static {\n this.PATCH_DEPS = 'patchedDeps';\n }\n static {\n this.core = {\n name: null,\n moduleName: CORE\n };\n }\n /* Instructions */\n static {\n this.namespaceHTML = {\n name: 'ɵɵnamespaceHTML',\n moduleName: CORE\n };\n }\n static {\n this.namespaceMathML = {\n name: 'ɵɵnamespaceMathML',\n moduleName: CORE\n };\n }\n static {\n this.namespaceSVG = {\n name: 'ɵɵnamespaceSVG',\n moduleName: CORE\n };\n }\n static {\n this.element = {\n name: 'ɵɵelement',\n moduleName: CORE\n };\n }\n static {\n this.elementStart = {\n name: 'ɵɵelementStart',\n moduleName: CORE\n };\n }\n static {\n this.elementEnd = {\n name: 'ɵɵelementEnd',\n moduleName: CORE\n };\n }\n static {\n this.advance = {\n name: 'ɵɵadvance',\n moduleName: CORE\n };\n }\n static {\n this.syntheticHostProperty = {\n name: 'ɵɵsyntheticHostProperty',\n moduleName: CORE\n };\n }\n static {\n this.syntheticHostListener = {\n name: 'ɵɵsyntheticHostListener',\n moduleName: CORE\n };\n }\n static {\n this.attribute = {\n name: 'ɵɵattribute',\n moduleName: CORE\n };\n }\n static {\n this.attributeInterpolate1 = {\n name: 'ɵɵattributeInterpolate1',\n moduleName: CORE\n };\n }\n static {\n this.attributeInterpolate2 = {\n name: 'ɵɵattributeInterpolate2',\n moduleName: CORE\n };\n }\n static {\n this.attributeInterpolate3 = {\n name: 'ɵɵattributeInterpolate3',\n moduleName: CORE\n };\n }\n static {\n this.attributeInterpolate4 = {\n name: 'ɵɵattributeInterpolate4',\n moduleName: CORE\n };\n }\n static {\n this.attributeInterpolate5 = {\n name: 'ɵɵattributeInterpolate5',\n moduleName: CORE\n };\n }\n static {\n this.attributeInterpolate6 = {\n name: 'ɵɵattributeInterpolate6',\n moduleName: CORE\n };\n }\n static {\n this.attributeInterpolate7 = {\n name: 'ɵɵattributeInterpolate7',\n moduleName: CORE\n };\n }\n static {\n this.attributeInterpolate8 = {\n name: 'ɵɵattributeInterpolate8',\n moduleName: CORE\n };\n }\n static {\n this.attributeInterpolateV = {\n name: 'ɵɵattributeInterpolateV',\n moduleName: CORE\n };\n }\n static {\n this.classProp = {\n name: 'ɵɵclassProp',\n moduleName: CORE\n };\n }\n static {\n this.elementContainerStart = {\n name: 'ɵɵelementContainerStart',\n moduleName: CORE\n };\n }\n static {\n this.elementContainerEnd = {\n name: 'ɵɵelementContainerEnd',\n moduleName: CORE\n };\n }\n static {\n this.elementContainer = {\n name: 'ɵɵelementContainer',\n moduleName: CORE\n };\n }\n static {\n this.styleMap = {\n name: 'ɵɵstyleMap',\n moduleName: CORE\n };\n }\n static {\n this.styleMapInterpolate1 = {\n name: 'ɵɵstyleMapInterpolate1',\n moduleName: CORE\n };\n }\n static {\n this.styleMapInterpolate2 = {\n name: 'ɵɵstyleMapInterpolate2',\n moduleName: CORE\n };\n }\n static {\n this.styleMapInterpolate3 = {\n name: 'ɵɵstyleMapInterpolate3',\n moduleName: CORE\n };\n }\n static {\n this.styleMapInterpolate4 = {\n name: 'ɵɵstyleMapInterpolate4',\n moduleName: CORE\n };\n }\n static {\n this.styleMapInterpolate5 = {\n name: 'ɵɵstyleMapInterpolate5',\n moduleName: CORE\n };\n }\n static {\n this.styleMapInterpolate6 = {\n name: 'ɵɵstyleMapInterpolate6',\n moduleName: CORE\n };\n }\n static {\n this.styleMapInterpolate7 = {\n name: 'ɵɵstyleMapInterpolate7',\n moduleName: CORE\n };\n }\n static {\n this.styleMapInterpolate8 = {\n name: 'ɵɵstyleMapInterpolate8',\n moduleName: CORE\n };\n }\n static {\n this.styleMapInterpolateV = {\n name: 'ɵɵstyleMapInterpolateV',\n moduleName: CORE\n };\n }\n static {\n this.classMap = {\n name: 'ɵɵclassMap',\n moduleName: CORE\n };\n }\n static {\n this.classMapInterpolate1 = {\n name: 'ɵɵclassMapInterpolate1',\n moduleName: CORE\n };\n }\n static {\n this.classMapInterpolate2 = {\n name: 'ɵɵclassMapInterpolate2',\n moduleName: CORE\n };\n }\n static {\n this.classMapInterpolate3 = {\n name: 'ɵɵclassMapInterpolate3',\n moduleName: CORE\n };\n }\n static {\n this.classMapInterpolate4 = {\n name: 'ɵɵclassMapInterpolate4',\n moduleName: CORE\n };\n }\n static {\n this.classMapInterpolate5 = {\n name: 'ɵɵclassMapInterpolate5',\n moduleName: CORE\n };\n }\n static {\n this.classMapInterpolate6 = {\n name: 'ɵɵclassMapInterpolate6',\n moduleName: CORE\n };\n }\n static {\n this.classMapInterpolate7 = {\n name: 'ɵɵclassMapInterpolate7',\n moduleName: CORE\n };\n }\n static {\n this.classMapInterpolate8 = {\n name: 'ɵɵclassMapInterpolate8',\n moduleName: CORE\n };\n }\n static {\n this.classMapInterpolateV = {\n name: 'ɵɵclassMapInterpolateV',\n moduleName: CORE\n };\n }\n static {\n this.styleProp = {\n name: 'ɵɵstyleProp',\n moduleName: CORE\n };\n }\n static {\n this.stylePropInterpolate1 = {\n name: 'ɵɵstylePropInterpolate1',\n moduleName: CORE\n };\n }\n static {\n this.stylePropInterpolate2 = {\n name: 'ɵɵstylePropInterpolate2',\n moduleName: CORE\n };\n }\n static {\n this.stylePropInterpolate3 = {\n name: 'ɵɵstylePropInterpolate3',\n moduleName: CORE\n };\n }\n static {\n this.stylePropInterpolate4 = {\n name: 'ɵɵstylePropInterpolate4',\n moduleName: CORE\n };\n }\n static {\n this.stylePropInterpolate5 = {\n name: 'ɵɵstylePropInterpolate5',\n moduleName: CORE\n };\n }\n static {\n this.stylePropInterpolate6 = {\n name: 'ɵɵstylePropInterpolate6',\n moduleName: CORE\n };\n }\n static {\n this.stylePropInterpolate7 = {\n name: 'ɵɵstylePropInterpolate7',\n moduleName: CORE\n };\n }\n static {\n this.stylePropInterpolate8 = {\n name: 'ɵɵstylePropInterpolate8',\n moduleName: CORE\n };\n }\n static {\n this.stylePropInterpolateV = {\n name: 'ɵɵstylePropInterpolateV',\n moduleName: CORE\n };\n }\n static {\n this.nextContext = {\n name: 'ɵɵnextContext',\n moduleName: CORE\n };\n }\n static {\n this.resetView = {\n name: 'ɵɵresetView',\n moduleName: CORE\n };\n }\n static {\n this.templateCreate = {\n name: 'ɵɵtemplate',\n moduleName: CORE\n };\n }\n static {\n this.defer = {\n name: 'ɵɵdefer',\n moduleName: CORE\n };\n }\n static {\n this.deferWhen = {\n name: 'ɵɵdeferWhen',\n moduleName: CORE\n };\n }\n static {\n this.deferOnIdle = {\n name: 'ɵɵdeferOnIdle',\n moduleName: CORE\n };\n }\n static {\n this.deferOnImmediate = {\n name: 'ɵɵdeferOnImmediate',\n moduleName: CORE\n };\n }\n static {\n this.deferOnTimer = {\n name: 'ɵɵdeferOnTimer',\n moduleName: CORE\n };\n }\n static {\n this.deferOnHover = {\n name: 'ɵɵdeferOnHover',\n moduleName: CORE\n };\n }\n static {\n this.deferOnInteraction = {\n name: 'ɵɵdeferOnInteraction',\n moduleName: CORE\n };\n }\n static {\n this.deferOnViewport = {\n name: 'ɵɵdeferOnViewport',\n moduleName: CORE\n };\n }\n static {\n this.deferPrefetchWhen = {\n name: 'ɵɵdeferPrefetchWhen',\n moduleName: CORE\n };\n }\n static {\n this.deferPrefetchOnIdle = {\n name: 'ɵɵdeferPrefetchOnIdle',\n moduleName: CORE\n };\n }\n static {\n this.deferPrefetchOnImmediate = {\n name: 'ɵɵdeferPrefetchOnImmediate',\n moduleName: CORE\n };\n }\n static {\n this.deferPrefetchOnTimer = {\n name: 'ɵɵdeferPrefetchOnTimer',\n moduleName: CORE\n };\n }\n static {\n this.deferPrefetchOnHover = {\n name: 'ɵɵdeferPrefetchOnHover',\n moduleName: CORE\n };\n }\n static {\n this.deferPrefetchOnInteraction = {\n name: 'ɵɵdeferPrefetchOnInteraction',\n moduleName: CORE\n };\n }\n static {\n this.deferPrefetchOnViewport = {\n name: 'ɵɵdeferPrefetchOnViewport',\n moduleName: CORE\n };\n }\n static {\n this.deferEnableTimerScheduling = {\n name: 'ɵɵdeferEnableTimerScheduling',\n moduleName: CORE\n };\n }\n static {\n this.conditional = {\n name: 'ɵɵconditional',\n moduleName: CORE\n };\n }\n static {\n this.repeater = {\n name: 'ɵɵrepeater',\n moduleName: CORE\n };\n }\n static {\n this.repeaterCreate = {\n name: 'ɵɵrepeaterCreate',\n moduleName: CORE\n };\n }\n static {\n this.repeaterTrackByIndex = {\n name: 'ɵɵrepeaterTrackByIndex',\n moduleName: CORE\n };\n }\n static {\n this.repeaterTrackByIdentity = {\n name: 'ɵɵrepeaterTrackByIdentity',\n moduleName: CORE\n };\n }\n static {\n this.componentInstance = {\n name: 'ɵɵcomponentInstance',\n moduleName: CORE\n };\n }\n static {\n this.text = {\n name: 'ɵɵtext',\n moduleName: CORE\n };\n }\n static {\n this.enableBindings = {\n name: 'ɵɵenableBindings',\n moduleName: CORE\n };\n }\n static {\n this.disableBindings = {\n name: 'ɵɵdisableBindings',\n moduleName: CORE\n };\n }\n static {\n this.getCurrentView = {\n name: 'ɵɵgetCurrentView',\n moduleName: CORE\n };\n }\n static {\n this.textInterpolate = {\n name: 'ɵɵtextInterpolate',\n moduleName: CORE\n };\n }\n static {\n this.textInterpolate1 = {\n name: 'ɵɵtextInterpolate1',\n moduleName: CORE\n };\n }\n static {\n this.textInterpolate2 = {\n name: 'ɵɵtextInterpolate2',\n moduleName: CORE\n };\n }\n static {\n this.textInterpolate3 = {\n name: 'ɵɵtextInterpolate3',\n moduleName: CORE\n };\n }\n static {\n this.textInterpolate4 = {\n name: 'ɵɵtextInterpolate4',\n moduleName: CORE\n };\n }\n static {\n this.textInterpolate5 = {\n name: 'ɵɵtextInterpolate5',\n moduleName: CORE\n };\n }\n static {\n this.textInterpolate6 = {\n name: 'ɵɵtextInterpolate6',\n moduleName: CORE\n };\n }\n static {\n this.textInterpolate7 = {\n name: 'ɵɵtextInterpolate7',\n moduleName: CORE\n };\n }\n static {\n this.textInterpolate8 = {\n name: 'ɵɵtextInterpolate8',\n moduleName: CORE\n };\n }\n static {\n this.textInterpolateV = {\n name: 'ɵɵtextInterpolateV',\n moduleName: CORE\n };\n }\n static {\n this.restoreView = {\n name: 'ɵɵrestoreView',\n moduleName: CORE\n };\n }\n static {\n this.pureFunction0 = {\n name: 'ɵɵpureFunction0',\n moduleName: CORE\n };\n }\n static {\n this.pureFunction1 = {\n name: 'ɵɵpureFunction1',\n moduleName: CORE\n };\n }\n static {\n this.pureFunction2 = {\n name: 'ɵɵpureFunction2',\n moduleName: CORE\n };\n }\n static {\n this.pureFunction3 = {\n name: 'ɵɵpureFunction3',\n moduleName: CORE\n };\n }\n static {\n this.pureFunction4 = {\n name: 'ɵɵpureFunction4',\n moduleName: CORE\n };\n }\n static {\n this.pureFunction5 = {\n name: 'ɵɵpureFunction5',\n moduleName: CORE\n };\n }\n static {\n this.pureFunction6 = {\n name: 'ɵɵpureFunction6',\n moduleName: CORE\n };\n }\n static {\n this.pureFunction7 = {\n name: 'ɵɵpureFunction7',\n moduleName: CORE\n };\n }\n static {\n this.pureFunction8 = {\n name: 'ɵɵpureFunction8',\n moduleName: CORE\n };\n }\n static {\n this.pureFunctionV = {\n name: 'ɵɵpureFunctionV',\n moduleName: CORE\n };\n }\n static {\n this.pipeBind1 = {\n name: 'ɵɵpipeBind1',\n moduleName: CORE\n };\n }\n static {\n this.pipeBind2 = {\n name: 'ɵɵpipeBind2',\n moduleName: CORE\n };\n }\n static {\n this.pipeBind3 = {\n name: 'ɵɵpipeBind3',\n moduleName: CORE\n };\n }\n static {\n this.pipeBind4 = {\n name: 'ɵɵpipeBind4',\n moduleName: CORE\n };\n }\n static {\n this.pipeBindV = {\n name: 'ɵɵpipeBindV',\n moduleName: CORE\n };\n }\n static {\n this.hostProperty = {\n name: 'ɵɵhostProperty',\n moduleName: CORE\n };\n }\n static {\n this.property = {\n name: 'ɵɵproperty',\n moduleName: CORE\n };\n }\n static {\n this.propertyInterpolate = {\n name: 'ɵɵpropertyInterpolate',\n moduleName: CORE\n };\n }\n static {\n this.propertyInterpolate1 = {\n name: 'ɵɵpropertyInterpolate1',\n moduleName: CORE\n };\n }\n static {\n this.propertyInterpolate2 = {\n name: 'ɵɵpropertyInterpolate2',\n moduleName: CORE\n };\n }\n static {\n this.propertyInterpolate3 = {\n name: 'ɵɵpropertyInterpolate3',\n moduleName: CORE\n };\n }\n static {\n this.propertyInterpolate4 = {\n name: 'ɵɵpropertyInterpolate4',\n moduleName: CORE\n };\n }\n static {\n this.propertyInterpolate5 = {\n name: 'ɵɵpropertyInterpolate5',\n moduleName: CORE\n };\n }\n static {\n this.propertyInterpolate6 = {\n name: 'ɵɵpropertyInterpolate6',\n moduleName: CORE\n };\n }\n static {\n this.propertyInterpolate7 = {\n name: 'ɵɵpropertyInterpolate7',\n moduleName: CORE\n };\n }\n static {\n this.propertyInterpolate8 = {\n name: 'ɵɵpropertyInterpolate8',\n moduleName: CORE\n };\n }\n static {\n this.propertyInterpolateV = {\n name: 'ɵɵpropertyInterpolateV',\n moduleName: CORE\n };\n }\n static {\n this.i18n = {\n name: 'ɵɵi18n',\n moduleName: CORE\n };\n }\n static {\n this.i18nAttributes = {\n name: 'ɵɵi18nAttributes',\n moduleName: CORE\n };\n }\n static {\n this.i18nExp = {\n name: 'ɵɵi18nExp',\n moduleName: CORE\n };\n }\n static {\n this.i18nStart = {\n name: 'ɵɵi18nStart',\n moduleName: CORE\n };\n }\n static {\n this.i18nEnd = {\n name: 'ɵɵi18nEnd',\n moduleName: CORE\n };\n }\n static {\n this.i18nApply = {\n name: 'ɵɵi18nApply',\n moduleName: CORE\n };\n }\n static {\n this.i18nPostprocess = {\n name: 'ɵɵi18nPostprocess',\n moduleName: CORE\n };\n }\n static {\n this.pipe = {\n name: 'ɵɵpipe',\n moduleName: CORE\n };\n }\n static {\n this.projection = {\n name: 'ɵɵprojection',\n moduleName: CORE\n };\n }\n static {\n this.projectionDef = {\n name: 'ɵɵprojectionDef',\n moduleName: CORE\n };\n }\n static {\n this.reference = {\n name: 'ɵɵreference',\n moduleName: CORE\n };\n }\n static {\n this.inject = {\n name: 'ɵɵinject',\n moduleName: CORE\n };\n }\n static {\n this.injectAttribute = {\n name: 'ɵɵinjectAttribute',\n moduleName: CORE\n };\n }\n static {\n this.directiveInject = {\n name: 'ɵɵdirectiveInject',\n moduleName: CORE\n };\n }\n static {\n this.invalidFactory = {\n name: 'ɵɵinvalidFactory',\n moduleName: CORE\n };\n }\n static {\n this.invalidFactoryDep = {\n name: 'ɵɵinvalidFactoryDep',\n moduleName: CORE\n };\n }\n static {\n this.templateRefExtractor = {\n name: 'ɵɵtemplateRefExtractor',\n moduleName: CORE\n };\n }\n static {\n this.forwardRef = {\n name: 'forwardRef',\n moduleName: CORE\n };\n }\n static {\n this.resolveForwardRef = {\n name: 'resolveForwardRef',\n moduleName: CORE\n };\n }\n static {\n this.ɵɵdefineInjectable = {\n name: 'ɵɵdefineInjectable',\n moduleName: CORE\n };\n }\n static {\n this.declareInjectable = {\n name: 'ɵɵngDeclareInjectable',\n moduleName: CORE\n };\n }\n static {\n this.InjectableDeclaration = {\n name: 'ɵɵInjectableDeclaration',\n moduleName: CORE\n };\n }\n static {\n this.resolveWindow = {\n name: 'ɵɵresolveWindow',\n moduleName: CORE\n };\n }\n static {\n this.resolveDocument = {\n name: 'ɵɵresolveDocument',\n moduleName: CORE\n };\n }\n static {\n this.resolveBody = {\n name: 'ɵɵresolveBody',\n moduleName: CORE\n };\n }\n static {\n this.getComponentDepsFactory = {\n name: 'ɵɵgetComponentDepsFactory',\n moduleName: CORE\n };\n }\n static {\n this.defineComponent = {\n name: 'ɵɵdefineComponent',\n moduleName: CORE\n };\n }\n static {\n this.declareComponent = {\n name: 'ɵɵngDeclareComponent',\n moduleName: CORE\n };\n }\n static {\n this.setComponentScope = {\n name: 'ɵɵsetComponentScope',\n moduleName: CORE\n };\n }\n static {\n this.ChangeDetectionStrategy = {\n name: 'ChangeDetectionStrategy',\n moduleName: CORE\n };\n }\n static {\n this.ViewEncapsulation = {\n name: 'ViewEncapsulation',\n moduleName: CORE\n };\n }\n static {\n this.ComponentDeclaration = {\n name: 'ɵɵComponentDeclaration',\n moduleName: CORE\n };\n }\n static {\n this.FactoryDeclaration = {\n name: 'ɵɵFactoryDeclaration',\n moduleName: CORE\n };\n }\n static {\n this.declareFactory = {\n name: 'ɵɵngDeclareFactory',\n moduleName: CORE\n };\n }\n static {\n this.FactoryTarget = {\n name: 'ɵɵFactoryTarget',\n moduleName: CORE\n };\n }\n static {\n this.defineDirective = {\n name: 'ɵɵdefineDirective',\n moduleName: CORE\n };\n }\n static {\n this.declareDirective = {\n name: 'ɵɵngDeclareDirective',\n moduleName: CORE\n };\n }\n static {\n this.DirectiveDeclaration = {\n name: 'ɵɵDirectiveDeclaration',\n moduleName: CORE\n };\n }\n static {\n this.InjectorDef = {\n name: 'ɵɵInjectorDef',\n moduleName: CORE\n };\n }\n static {\n this.InjectorDeclaration = {\n name: 'ɵɵInjectorDeclaration',\n moduleName: CORE\n };\n }\n static {\n this.defineInjector = {\n name: 'ɵɵdefineInjector',\n moduleName: CORE\n };\n }\n static {\n this.declareInjector = {\n name: 'ɵɵngDeclareInjector',\n moduleName: CORE\n };\n }\n static {\n this.NgModuleDeclaration = {\n name: 'ɵɵNgModuleDeclaration',\n moduleName: CORE\n };\n }\n static {\n this.ModuleWithProviders = {\n name: 'ModuleWithProviders',\n moduleName: CORE\n };\n }\n static {\n this.defineNgModule = {\n name: 'ɵɵdefineNgModule',\n moduleName: CORE\n };\n }\n static {\n this.declareNgModule = {\n name: 'ɵɵngDeclareNgModule',\n moduleName: CORE\n };\n }\n static {\n this.setNgModuleScope = {\n name: 'ɵɵsetNgModuleScope',\n moduleName: CORE\n };\n }\n static {\n this.registerNgModuleType = {\n name: 'ɵɵregisterNgModuleType',\n moduleName: CORE\n };\n }\n static {\n this.PipeDeclaration = {\n name: 'ɵɵPipeDeclaration',\n moduleName: CORE\n };\n }\n static {\n this.definePipe = {\n name: 'ɵɵdefinePipe',\n moduleName: CORE\n };\n }\n static {\n this.declarePipe = {\n name: 'ɵɵngDeclarePipe',\n moduleName: CORE\n };\n }\n static {\n this.declareClassMetadata = {\n name: 'ɵɵngDeclareClassMetadata',\n moduleName: CORE\n };\n }\n static {\n this.declareClassMetadataAsync = {\n name: 'ɵɵngDeclareClassMetadataAsync',\n moduleName: CORE\n };\n }\n static {\n this.setClassMetadata = {\n name: 'ɵsetClassMetadata',\n moduleName: CORE\n };\n }\n static {\n this.setClassMetadataAsync = {\n name: 'ɵsetClassMetadataAsync',\n moduleName: CORE\n };\n }\n static {\n this.setClassDebugInfo = {\n name: 'ɵsetClassDebugInfo',\n moduleName: CORE\n };\n }\n static {\n this.queryRefresh = {\n name: 'ɵɵqueryRefresh',\n moduleName: CORE\n };\n }\n static {\n this.viewQuery = {\n name: 'ɵɵviewQuery',\n moduleName: CORE\n };\n }\n static {\n this.loadQuery = {\n name: 'ɵɵloadQuery',\n moduleName: CORE\n };\n }\n static {\n this.contentQuery = {\n name: 'ɵɵcontentQuery',\n moduleName: CORE\n };\n }\n // Signal queries\n static {\n this.viewQuerySignal = {\n name: 'ɵɵviewQuerySignal',\n moduleName: CORE\n };\n }\n static {\n this.contentQuerySignal = {\n name: 'ɵɵcontentQuerySignal',\n moduleName: CORE\n };\n }\n static {\n this.queryAdvance = {\n name: 'ɵɵqueryAdvance',\n moduleName: CORE\n };\n }\n // Two-way bindings\n static {\n this.twoWayProperty = {\n name: 'ɵɵtwoWayProperty',\n moduleName: CORE\n };\n }\n static {\n this.twoWayBindingSet = {\n name: 'ɵɵtwoWayBindingSet',\n moduleName: CORE\n };\n }\n static {\n this.twoWayListener = {\n name: 'ɵɵtwoWayListener',\n moduleName: CORE\n };\n }\n static {\n this.declareLet = {\n name: 'ɵɵdeclareLet',\n moduleName: CORE\n };\n }\n static {\n this.storeLet = {\n name: 'ɵɵstoreLet',\n moduleName: CORE\n };\n }\n static {\n this.readContextLet = {\n name: 'ɵɵreadContextLet',\n moduleName: CORE\n };\n }\n static {\n this.NgOnChangesFeature = {\n name: 'ɵɵNgOnChangesFeature',\n moduleName: CORE\n };\n }\n static {\n this.InheritDefinitionFeature = {\n name: 'ɵɵInheritDefinitionFeature',\n moduleName: CORE\n };\n }\n static {\n this.CopyDefinitionFeature = {\n name: 'ɵɵCopyDefinitionFeature',\n moduleName: CORE\n };\n }\n static {\n this.StandaloneFeature = {\n name: 'ɵɵStandaloneFeature',\n moduleName: CORE\n };\n }\n static {\n this.ProvidersFeature = {\n name: 'ɵɵProvidersFeature',\n moduleName: CORE\n };\n }\n static {\n this.HostDirectivesFeature = {\n name: 'ɵɵHostDirectivesFeature',\n moduleName: CORE\n };\n }\n static {\n this.InputTransformsFeatureFeature = {\n name: 'ɵɵInputTransformsFeature',\n moduleName: CORE\n };\n }\n static {\n this.listener = {\n name: 'ɵɵlistener',\n moduleName: CORE\n };\n }\n static {\n this.getInheritedFactory = {\n name: 'ɵɵgetInheritedFactory',\n moduleName: CORE\n };\n }\n // sanitization-related functions\n static {\n this.sanitizeHtml = {\n name: 'ɵɵsanitizeHtml',\n moduleName: CORE\n };\n }\n static {\n this.sanitizeStyle = {\n name: 'ɵɵsanitizeStyle',\n moduleName: CORE\n };\n }\n static {\n this.sanitizeResourceUrl = {\n name: 'ɵɵsanitizeResourceUrl',\n moduleName: CORE\n };\n }\n static {\n this.sanitizeScript = {\n name: 'ɵɵsanitizeScript',\n moduleName: CORE\n };\n }\n static {\n this.sanitizeUrl = {\n name: 'ɵɵsanitizeUrl',\n moduleName: CORE\n };\n }\n static {\n this.sanitizeUrlOrResourceUrl = {\n name: 'ɵɵsanitizeUrlOrResourceUrl',\n moduleName: CORE\n };\n }\n static {\n this.trustConstantHtml = {\n name: 'ɵɵtrustConstantHtml',\n moduleName: CORE\n };\n }\n static {\n this.trustConstantResourceUrl = {\n name: 'ɵɵtrustConstantResourceUrl',\n moduleName: CORE\n };\n }\n static {\n this.validateIframeAttribute = {\n name: 'ɵɵvalidateIframeAttribute',\n moduleName: CORE\n };\n }\n // type-checking\n static {\n this.InputSignalBrandWriteType = {\n name: 'ɵINPUT_SIGNAL_BRAND_WRITE_TYPE',\n moduleName: CORE\n };\n }\n static {\n this.UnwrapDirectiveSignalInputs = {\n name: 'ɵUnwrapDirectiveSignalInputs',\n moduleName: CORE\n };\n }\n static {\n this.unwrapWritableSignal = {\n name: 'ɵunwrapWritableSignal',\n moduleName: CORE\n };\n }\n}\nconst DASH_CASE_REGEXP = /-+([a-z0-9])/g;\nfunction dashCaseToCamelCase(input) {\n return input.replace(DASH_CASE_REGEXP, (...m) => m[1].toUpperCase());\n}\nfunction splitAtColon(input, defaultValues) {\n return _splitAt(input, ':', defaultValues);\n}\nfunction splitAtPeriod(input, defaultValues) {\n return _splitAt(input, '.', defaultValues);\n}\nfunction _splitAt(input, character, defaultValues) {\n const characterIndex = input.indexOf(character);\n if (characterIndex == -1) return defaultValues;\n return [input.slice(0, characterIndex).trim(), input.slice(characterIndex + 1).trim()];\n}\nfunction noUndefined(val) {\n return val === undefined ? null : val;\n}\nfunction error(msg) {\n throw new Error(`Internal Error: ${msg}`);\n}\n// Escape characters that have a special meaning in Regular Expressions\nfunction escapeRegExp(s) {\n return s.replace(/([.*+?^=!:${}()|[\\]\\/\\\\])/g, '\\\\$1');\n}\nfunction utf8Encode(str) {\n let encoded = [];\n for (let index = 0; index < str.length; index++) {\n let codePoint = str.charCodeAt(index);\n // decode surrogate\n // see https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae\n if (codePoint >= 0xd800 && codePoint <= 0xdbff && str.length > index + 1) {\n const low = str.charCodeAt(index + 1);\n if (low >= 0xdc00 && low <= 0xdfff) {\n index++;\n codePoint = (codePoint - 0xd800 << 10) + low - 0xdc00 + 0x10000;\n }\n }\n if (codePoint <= 0x7f) {\n encoded.push(codePoint);\n } else if (codePoint <= 0x7ff) {\n encoded.push(codePoint >> 6 & 0x1f | 0xc0, codePoint & 0x3f | 0x80);\n } else if (codePoint <= 0xffff) {\n encoded.push(codePoint >> 12 | 0xe0, codePoint >> 6 & 0x3f | 0x80, codePoint & 0x3f | 0x80);\n } else if (codePoint <= 0x1fffff) {\n encoded.push(codePoint >> 18 & 0x07 | 0xf0, codePoint >> 12 & 0x3f | 0x80, codePoint >> 6 & 0x3f | 0x80, codePoint & 0x3f | 0x80);\n }\n }\n return encoded;\n}\nfunction stringify(token) {\n if (typeof token === 'string') {\n return token;\n }\n if (Array.isArray(token)) {\n return '[' + token.map(stringify).join(', ') + ']';\n }\n if (token == null) {\n return '' + token;\n }\n if (token.overriddenName) {\n return `${token.overriddenName}`;\n }\n if (token.name) {\n return `${token.name}`;\n }\n if (!token.toString) {\n return 'object';\n }\n // WARNING: do not try to `JSON.stringify(token)` here\n // see https://github.com/angular/angular/issues/23440\n const res = token.toString();\n if (res == null) {\n return '' + res;\n }\n const newLineIndex = res.indexOf('\\n');\n return newLineIndex === -1 ? res : res.substring(0, newLineIndex);\n}\nclass Version {\n constructor(full) {\n this.full = full;\n const splits = full.split('.');\n this.major = splits[0];\n this.minor = splits[1];\n this.patch = splits.slice(2).join('.');\n }\n}\nconst _global = globalThis;\nfunction newArray(size, value) {\n const list = [];\n for (let i = 0; i < size; i++) {\n list.push(value);\n }\n return list;\n}\n/**\n * Partitions a given array into 2 arrays, based on a boolean value returned by the condition\n * function.\n *\n * @param arr Input array that should be partitioned\n * @param conditionFn Condition function that is called for each item in a given array and returns a\n * boolean value.\n */\nfunction partitionArray(arr, conditionFn) {\n const truthy = [];\n const falsy = [];\n for (const item of arr) {\n (conditionFn(item) ? truthy : falsy).push(item);\n }\n return [truthy, falsy];\n}\n\n// https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit\nconst VERSION$1 = 3;\nconst JS_B64_PREFIX = '# sourceMappingURL=data:application/json;base64,';\nclass SourceMapGenerator {\n constructor(file = null) {\n this.file = file;\n this.sourcesContent = new Map();\n this.lines = [];\n this.lastCol0 = 0;\n this.hasMappings = false;\n }\n // The content is `null` when the content is expected to be loaded using the URL\n addSource(url, content = null) {\n if (!this.sourcesContent.has(url)) {\n this.sourcesContent.set(url, content);\n }\n return this;\n }\n addLine() {\n this.lines.push([]);\n this.lastCol0 = 0;\n return this;\n }\n addMapping(col0, sourceUrl, sourceLine0, sourceCol0) {\n if (!this.currentLine) {\n throw new Error(`A line must be added before mappings can be added`);\n }\n if (sourceUrl != null && !this.sourcesContent.has(sourceUrl)) {\n throw new Error(`Unknown source file \"${sourceUrl}\"`);\n }\n if (col0 == null) {\n throw new Error(`The column in the generated code must be provided`);\n }\n if (col0 < this.lastCol0) {\n throw new Error(`Mapping should be added in output order`);\n }\n if (sourceUrl && (sourceLine0 == null || sourceCol0 == null)) {\n throw new Error(`The source location must be provided when a source url is provided`);\n }\n this.hasMappings = true;\n this.lastCol0 = col0;\n this.currentLine.push({\n col0,\n sourceUrl,\n sourceLine0,\n sourceCol0\n });\n return this;\n }\n /**\n * @internal strip this from published d.ts files due to\n * https://github.com/microsoft/TypeScript/issues/36216\n */\n get currentLine() {\n return this.lines.slice(-1)[0];\n }\n toJSON() {\n if (!this.hasMappings) {\n return null;\n }\n const sourcesIndex = new Map();\n const sources = [];\n const sourcesContent = [];\n Array.from(this.sourcesContent.keys()).forEach((url, i) => {\n sourcesIndex.set(url, i);\n sources.push(url);\n sourcesContent.push(this.sourcesContent.get(url) || null);\n });\n let mappings = '';\n let lastCol0 = 0;\n let lastSourceIndex = 0;\n let lastSourceLine0 = 0;\n let lastSourceCol0 = 0;\n this.lines.forEach(segments => {\n lastCol0 = 0;\n mappings += segments.map(segment => {\n // zero-based starting column of the line in the generated code\n let segAsStr = toBase64VLQ(segment.col0 - lastCol0);\n lastCol0 = segment.col0;\n if (segment.sourceUrl != null) {\n // zero-based index into the “sources” list\n segAsStr += toBase64VLQ(sourcesIndex.get(segment.sourceUrl) - lastSourceIndex);\n lastSourceIndex = sourcesIndex.get(segment.sourceUrl);\n // the zero-based starting line in the original source\n segAsStr += toBase64VLQ(segment.sourceLine0 - lastSourceLine0);\n lastSourceLine0 = segment.sourceLine0;\n // the zero-based starting column in the original source\n segAsStr += toBase64VLQ(segment.sourceCol0 - lastSourceCol0);\n lastSourceCol0 = segment.sourceCol0;\n }\n return segAsStr;\n }).join(',');\n mappings += ';';\n });\n mappings = mappings.slice(0, -1);\n return {\n 'file': this.file || '',\n 'version': VERSION$1,\n 'sourceRoot': '',\n 'sources': sources,\n 'sourcesContent': sourcesContent,\n 'mappings': mappings\n };\n }\n toJsComment() {\n return this.hasMappings ? '//' + JS_B64_PREFIX + toBase64String(JSON.stringify(this, null, 0)) : '';\n }\n}\nfunction toBase64String(value) {\n let b64 = '';\n const encoded = utf8Encode(value);\n for (let i = 0; i < encoded.length;) {\n const i1 = encoded[i++];\n const i2 = i < encoded.length ? encoded[i++] : null;\n const i3 = i < encoded.length ? encoded[i++] : null;\n b64 += toBase64Digit(i1 >> 2);\n b64 += toBase64Digit((i1 & 3) << 4 | (i2 === null ? 0 : i2 >> 4));\n b64 += i2 === null ? '=' : toBase64Digit((i2 & 15) << 2 | (i3 === null ? 0 : i3 >> 6));\n b64 += i2 === null || i3 === null ? '=' : toBase64Digit(i3 & 63);\n }\n return b64;\n}\nfunction toBase64VLQ(value) {\n value = value < 0 ? (-value << 1) + 1 : value << 1;\n let out = '';\n do {\n let digit = value & 31;\n value = value >> 5;\n if (value > 0) {\n digit = digit | 32;\n }\n out += toBase64Digit(digit);\n } while (value > 0);\n return out;\n}\nconst B64_DIGITS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\nfunction toBase64Digit(value) {\n if (value < 0 || value >= 64) {\n throw new Error(`Can only encode value in the range [0, 63]`);\n }\n return B64_DIGITS[value];\n}\nconst _SINGLE_QUOTE_ESCAPE_STRING_RE = /'|\\\\|\\n|\\r|\\$/g;\nconst _LEGAL_IDENTIFIER_RE = /^[$A-Z_][0-9A-Z_$]*$/i;\nconst _INDENT_WITH = ' ';\nclass _EmittedLine {\n constructor(indent) {\n this.indent = indent;\n this.partsLength = 0;\n this.parts = [];\n this.srcSpans = [];\n }\n}\nclass EmitterVisitorContext {\n static createRoot() {\n return new EmitterVisitorContext(0);\n }\n constructor(_indent) {\n this._indent = _indent;\n this._lines = [new _EmittedLine(_indent)];\n }\n /**\n * @internal strip this from published d.ts files due to\n * https://github.com/microsoft/TypeScript/issues/36216\n */\n get _currentLine() {\n return this._lines[this._lines.length - 1];\n }\n println(from, lastPart = '') {\n this.print(from || null, lastPart, true);\n }\n lineIsEmpty() {\n return this._currentLine.parts.length === 0;\n }\n lineLength() {\n return this._currentLine.indent * _INDENT_WITH.length + this._currentLine.partsLength;\n }\n print(from, part, newLine = false) {\n if (part.length > 0) {\n this._currentLine.parts.push(part);\n this._currentLine.partsLength += part.length;\n this._currentLine.srcSpans.push(from && from.sourceSpan || null);\n }\n if (newLine) {\n this._lines.push(new _EmittedLine(this._indent));\n }\n }\n removeEmptyLastLine() {\n if (this.lineIsEmpty()) {\n this._lines.pop();\n }\n }\n incIndent() {\n this._indent++;\n if (this.lineIsEmpty()) {\n this._currentLine.indent = this._indent;\n }\n }\n decIndent() {\n this._indent--;\n if (this.lineIsEmpty()) {\n this._currentLine.indent = this._indent;\n }\n }\n toSource() {\n return this.sourceLines.map(l => l.parts.length > 0 ? _createIndent(l.indent) + l.parts.join('') : '').join('\\n');\n }\n toSourceMapGenerator(genFilePath, startsAtLine = 0) {\n const map = new SourceMapGenerator(genFilePath);\n let firstOffsetMapped = false;\n const mapFirstOffsetIfNeeded = () => {\n if (!firstOffsetMapped) {\n // Add a single space so that tools won't try to load the file from disk.\n // Note: We are using virtual urls like `ng:///`, so we have to\n // provide a content here.\n map.addSource(genFilePath, ' ').addMapping(0, genFilePath, 0, 0);\n firstOffsetMapped = true;\n }\n };\n for (let i = 0; i < startsAtLine; i++) {\n map.addLine();\n mapFirstOffsetIfNeeded();\n }\n this.sourceLines.forEach((line, lineIdx) => {\n map.addLine();\n const spans = line.srcSpans;\n const parts = line.parts;\n let col0 = line.indent * _INDENT_WITH.length;\n let spanIdx = 0;\n // skip leading parts without source spans\n while (spanIdx < spans.length && !spans[spanIdx]) {\n col0 += parts[spanIdx].length;\n spanIdx++;\n }\n if (spanIdx < spans.length && lineIdx === 0 && col0 === 0) {\n firstOffsetMapped = true;\n } else {\n mapFirstOffsetIfNeeded();\n }\n while (spanIdx < spans.length) {\n const span = spans[spanIdx];\n const source = span.start.file;\n const sourceLine = span.start.line;\n const sourceCol = span.start.col;\n map.addSource(source.url, source.content).addMapping(col0, source.url, sourceLine, sourceCol);\n col0 += parts[spanIdx].length;\n spanIdx++;\n // assign parts without span or the same span to the previous segment\n while (spanIdx < spans.length && (span === spans[spanIdx] || !spans[spanIdx])) {\n col0 += parts[spanIdx].length;\n spanIdx++;\n }\n }\n });\n return map;\n }\n spanOf(line, column) {\n const emittedLine = this._lines[line];\n if (emittedLine) {\n let columnsLeft = column - _createIndent(emittedLine.indent).length;\n for (let partIndex = 0; partIndex < emittedLine.parts.length; partIndex++) {\n const part = emittedLine.parts[partIndex];\n if (part.length > columnsLeft) {\n return emittedLine.srcSpans[partIndex];\n }\n columnsLeft -= part.length;\n }\n }\n return null;\n }\n /**\n * @internal strip this from published d.ts files due to\n * https://github.com/microsoft/TypeScript/issues/36216\n */\n get sourceLines() {\n if (this._lines.length && this._lines[this._lines.length - 1].parts.length === 0) {\n return this._lines.slice(0, -1);\n }\n return this._lines;\n }\n}\nclass AbstractEmitterVisitor {\n constructor(_escapeDollarInStrings) {\n this._escapeDollarInStrings = _escapeDollarInStrings;\n }\n printLeadingComments(stmt, ctx) {\n if (stmt.leadingComments === undefined) {\n return;\n }\n for (const comment of stmt.leadingComments) {\n if (comment instanceof JSDocComment) {\n ctx.print(stmt, `/*${comment.toString()}*/`, comment.trailingNewline);\n } else {\n if (comment.multiline) {\n ctx.print(stmt, `/* ${comment.text} */`, comment.trailingNewline);\n } else {\n comment.text.split('\\n').forEach(line => {\n ctx.println(stmt, `// ${line}`);\n });\n }\n }\n }\n }\n visitExpressionStmt(stmt, ctx) {\n this.printLeadingComments(stmt, ctx);\n stmt.expr.visitExpression(this, ctx);\n ctx.println(stmt, ';');\n return null;\n }\n visitReturnStmt(stmt, ctx) {\n this.printLeadingComments(stmt, ctx);\n ctx.print(stmt, `return `);\n stmt.value.visitExpression(this, ctx);\n ctx.println(stmt, ';');\n return null;\n }\n visitIfStmt(stmt, ctx) {\n this.printLeadingComments(stmt, ctx);\n ctx.print(stmt, `if (`);\n stmt.condition.visitExpression(this, ctx);\n ctx.print(stmt, `) {`);\n const hasElseCase = stmt.falseCase != null && stmt.falseCase.length > 0;\n if (stmt.trueCase.length <= 1 && !hasElseCase) {\n ctx.print(stmt, ` `);\n this.visitAllStatements(stmt.trueCase, ctx);\n ctx.removeEmptyLastLine();\n ctx.print(stmt, ` `);\n } else {\n ctx.println();\n ctx.incIndent();\n this.visitAllStatements(stmt.trueCase, ctx);\n ctx.decIndent();\n if (hasElseCase) {\n ctx.println(stmt, `} else {`);\n ctx.incIndent();\n this.visitAllStatements(stmt.falseCase, ctx);\n ctx.decIndent();\n }\n }\n ctx.println(stmt, `}`);\n return null;\n }\n visitWriteVarExpr(expr, ctx) {\n const lineWasEmpty = ctx.lineIsEmpty();\n if (!lineWasEmpty) {\n ctx.print(expr, '(');\n }\n ctx.print(expr, `${expr.name} = `);\n expr.value.visitExpression(this, ctx);\n if (!lineWasEmpty) {\n ctx.print(expr, ')');\n }\n return null;\n }\n visitWriteKeyExpr(expr, ctx) {\n const lineWasEmpty = ctx.lineIsEmpty();\n if (!lineWasEmpty) {\n ctx.print(expr, '(');\n }\n expr.receiver.visitExpression(this, ctx);\n ctx.print(expr, `[`);\n expr.index.visitExpression(this, ctx);\n ctx.print(expr, `] = `);\n expr.value.visitExpression(this, ctx);\n if (!lineWasEmpty) {\n ctx.print(expr, ')');\n }\n return null;\n }\n visitWritePropExpr(expr, ctx) {\n const lineWasEmpty = ctx.lineIsEmpty();\n if (!lineWasEmpty) {\n ctx.print(expr, '(');\n }\n expr.receiver.visitExpression(this, ctx);\n ctx.print(expr, `.${expr.name} = `);\n expr.value.visitExpression(this, ctx);\n if (!lineWasEmpty) {\n ctx.print(expr, ')');\n }\n return null;\n }\n visitInvokeFunctionExpr(expr, ctx) {\n const shouldParenthesize = expr.fn instanceof ArrowFunctionExpr;\n if (shouldParenthesize) {\n ctx.print(expr.fn, '(');\n }\n expr.fn.visitExpression(this, ctx);\n if (shouldParenthesize) {\n ctx.print(expr.fn, ')');\n }\n ctx.print(expr, `(`);\n this.visitAllExpressions(expr.args, ctx, ',');\n ctx.print(expr, `)`);\n return null;\n }\n visitTaggedTemplateExpr(expr, ctx) {\n expr.tag.visitExpression(this, ctx);\n ctx.print(expr, '`' + expr.template.elements[0].rawText);\n for (let i = 1; i < expr.template.elements.length; i++) {\n ctx.print(expr, '${');\n expr.template.expressions[i - 1].visitExpression(this, ctx);\n ctx.print(expr, `}${expr.template.elements[i].rawText}`);\n }\n ctx.print(expr, '`');\n return null;\n }\n visitWrappedNodeExpr(ast, ctx) {\n throw new Error('Abstract emitter cannot visit WrappedNodeExpr.');\n }\n visitTypeofExpr(expr, ctx) {\n ctx.print(expr, 'typeof ');\n expr.expr.visitExpression(this, ctx);\n }\n visitReadVarExpr(ast, ctx) {\n ctx.print(ast, ast.name);\n return null;\n }\n visitInstantiateExpr(ast, ctx) {\n ctx.print(ast, `new `);\n ast.classExpr.visitExpression(this, ctx);\n ctx.print(ast, `(`);\n this.visitAllExpressions(ast.args, ctx, ',');\n ctx.print(ast, `)`);\n return null;\n }\n visitLiteralExpr(ast, ctx) {\n const value = ast.value;\n if (typeof value === 'string') {\n ctx.print(ast, escapeIdentifier(value, this._escapeDollarInStrings));\n } else {\n ctx.print(ast, `${value}`);\n }\n return null;\n }\n visitLocalizedString(ast, ctx) {\n const head = ast.serializeI18nHead();\n ctx.print(ast, '$localize `' + head.raw);\n for (let i = 1; i < ast.messageParts.length; i++) {\n ctx.print(ast, '${');\n ast.expressions[i - 1].visitExpression(this, ctx);\n ctx.print(ast, `}${ast.serializeI18nTemplatePart(i).raw}`);\n }\n ctx.print(ast, '`');\n return null;\n }\n visitConditionalExpr(ast, ctx) {\n ctx.print(ast, `(`);\n ast.condition.visitExpression(this, ctx);\n ctx.print(ast, '? ');\n ast.trueCase.visitExpression(this, ctx);\n ctx.print(ast, ': ');\n ast.falseCase.visitExpression(this, ctx);\n ctx.print(ast, `)`);\n return null;\n }\n visitDynamicImportExpr(ast, ctx) {\n ctx.print(ast, `import(${ast.url})`);\n }\n visitNotExpr(ast, ctx) {\n ctx.print(ast, '!');\n ast.condition.visitExpression(this, ctx);\n return null;\n }\n visitUnaryOperatorExpr(ast, ctx) {\n let opStr;\n switch (ast.operator) {\n case UnaryOperator.Plus:\n opStr = '+';\n break;\n case UnaryOperator.Minus:\n opStr = '-';\n break;\n default:\n throw new Error(`Unknown operator ${ast.operator}`);\n }\n if (ast.parens) ctx.print(ast, `(`);\n ctx.print(ast, opStr);\n ast.expr.visitExpression(this, ctx);\n if (ast.parens) ctx.print(ast, `)`);\n return null;\n }\n visitBinaryOperatorExpr(ast, ctx) {\n let opStr;\n switch (ast.operator) {\n case BinaryOperator.Equals:\n opStr = '==';\n break;\n case BinaryOperator.Identical:\n opStr = '===';\n break;\n case BinaryOperator.NotEquals:\n opStr = '!=';\n break;\n case BinaryOperator.NotIdentical:\n opStr = '!==';\n break;\n case BinaryOperator.And:\n opStr = '&&';\n break;\n case BinaryOperator.BitwiseOr:\n opStr = '|';\n break;\n case BinaryOperator.BitwiseAnd:\n opStr = '&';\n break;\n case BinaryOperator.Or:\n opStr = '||';\n break;\n case BinaryOperator.Plus:\n opStr = '+';\n break;\n case BinaryOperator.Minus:\n opStr = '-';\n break;\n case BinaryOperator.Divide:\n opStr = '/';\n break;\n case BinaryOperator.Multiply:\n opStr = '*';\n break;\n case BinaryOperator.Modulo:\n opStr = '%';\n break;\n case BinaryOperator.Lower:\n opStr = '<';\n break;\n case BinaryOperator.LowerEquals:\n opStr = '<=';\n break;\n case BinaryOperator.Bigger:\n opStr = '>';\n break;\n case BinaryOperator.BiggerEquals:\n opStr = '>=';\n break;\n case BinaryOperator.NullishCoalesce:\n opStr = '??';\n break;\n default:\n throw new Error(`Unknown operator ${ast.operator}`);\n }\n if (ast.parens) ctx.print(ast, `(`);\n ast.lhs.visitExpression(this, ctx);\n ctx.print(ast, ` ${opStr} `);\n ast.rhs.visitExpression(this, ctx);\n if (ast.parens) ctx.print(ast, `)`);\n return null;\n }\n visitReadPropExpr(ast, ctx) {\n ast.receiver.visitExpression(this, ctx);\n ctx.print(ast, `.`);\n ctx.print(ast, ast.name);\n return null;\n }\n visitReadKeyExpr(ast, ctx) {\n ast.receiver.visitExpression(this, ctx);\n ctx.print(ast, `[`);\n ast.index.visitExpression(this, ctx);\n ctx.print(ast, `]`);\n return null;\n }\n visitLiteralArrayExpr(ast, ctx) {\n ctx.print(ast, `[`);\n this.visitAllExpressions(ast.entries, ctx, ',');\n ctx.print(ast, `]`);\n return null;\n }\n visitLiteralMapExpr(ast, ctx) {\n ctx.print(ast, `{`);\n this.visitAllObjects(entry => {\n ctx.print(ast, `${escapeIdentifier(entry.key, this._escapeDollarInStrings, entry.quoted)}:`);\n entry.value.visitExpression(this, ctx);\n }, ast.entries, ctx, ',');\n ctx.print(ast, `}`);\n return null;\n }\n visitCommaExpr(ast, ctx) {\n ctx.print(ast, '(');\n this.visitAllExpressions(ast.parts, ctx, ',');\n ctx.print(ast, ')');\n return null;\n }\n visitAllExpressions(expressions, ctx, separator) {\n this.visitAllObjects(expr => expr.visitExpression(this, ctx), expressions, ctx, separator);\n }\n visitAllObjects(handler, expressions, ctx, separator) {\n let incrementedIndent = false;\n for (let i = 0; i < expressions.length; i++) {\n if (i > 0) {\n if (ctx.lineLength() > 80) {\n ctx.print(null, separator, true);\n if (!incrementedIndent) {\n // continuation are marked with double indent.\n ctx.incIndent();\n ctx.incIndent();\n incrementedIndent = true;\n }\n } else {\n ctx.print(null, separator, false);\n }\n }\n handler(expressions[i]);\n }\n if (incrementedIndent) {\n // continuation are marked with double indent.\n ctx.decIndent();\n ctx.decIndent();\n }\n }\n visitAllStatements(statements, ctx) {\n statements.forEach(stmt => stmt.visitStatement(this, ctx));\n }\n}\nfunction escapeIdentifier(input, escapeDollar, alwaysQuote = true) {\n if (input == null) {\n return null;\n }\n const body = input.replace(_SINGLE_QUOTE_ESCAPE_STRING_RE, (...match) => {\n if (match[0] == '$') {\n return escapeDollar ? '\\\\$' : '$';\n } else if (match[0] == '\\n') {\n return '\\\\n';\n } else if (match[0] == '\\r') {\n return '\\\\r';\n } else {\n return `\\\\${match[0]}`;\n }\n });\n const requiresQuotes = alwaysQuote || !_LEGAL_IDENTIFIER_RE.test(body);\n return requiresQuotes ? `'${body}'` : body;\n}\nfunction _createIndent(count) {\n let res = '';\n for (let i = 0; i < count; i++) {\n res += _INDENT_WITH;\n }\n return res;\n}\nfunction typeWithParameters(type, numParams) {\n if (numParams === 0) {\n return expressionType(type);\n }\n const params = [];\n for (let i = 0; i < numParams; i++) {\n params.push(DYNAMIC_TYPE);\n }\n return expressionType(type, undefined, params);\n}\nconst ANIMATE_SYMBOL_PREFIX = '@';\nfunction prepareSyntheticPropertyName(name) {\n return `${ANIMATE_SYMBOL_PREFIX}${name}`;\n}\nfunction prepareSyntheticListenerName(name, phase) {\n return `${ANIMATE_SYMBOL_PREFIX}${name}.${phase}`;\n}\nfunction getSafePropertyAccessString(accessor, name) {\n const escapedName = escapeIdentifier(name, false, false);\n return escapedName !== name ? `${accessor}[${escapedName}]` : `${accessor}.${name}`;\n}\nfunction prepareSyntheticListenerFunctionName(name, phase) {\n return `animation_${name}_${phase}`;\n}\nfunction jitOnlyGuardedExpression(expr) {\n return guardedExpression('ngJitMode', expr);\n}\nfunction devOnlyGuardedExpression(expr) {\n return guardedExpression('ngDevMode', expr);\n}\nfunction guardedExpression(guard, expr) {\n const guardExpr = new ExternalExpr({\n name: guard,\n moduleName: null\n });\n const guardNotDefined = new BinaryOperatorExpr(BinaryOperator.Identical, new TypeofExpr(guardExpr), literal('undefined'));\n const guardUndefinedOrTrue = new BinaryOperatorExpr(BinaryOperator.Or, guardNotDefined, guardExpr, /* type */undefined, /* sourceSpan */undefined, true);\n return new BinaryOperatorExpr(BinaryOperator.And, guardUndefinedOrTrue, expr);\n}\nfunction wrapReference(value) {\n const wrapped = new WrappedNodeExpr(value);\n return {\n value: wrapped,\n type: wrapped\n };\n}\nfunction refsToArray(refs, shouldForwardDeclare) {\n const values = literalArr(refs.map(ref => ref.value));\n return shouldForwardDeclare ? arrowFn([], values) : values;\n}\nfunction createMayBeForwardRefExpression(expression, forwardRef) {\n return {\n expression,\n forwardRef\n };\n}\n/**\n * Convert a `MaybeForwardRefExpression` to an `Expression`, possibly wrapping its expression in a\n * `forwardRef()` call.\n *\n * If `MaybeForwardRefExpression.forwardRef` is `ForwardRefHandling.Unwrapped` then the expression\n * was originally wrapped in a `forwardRef()` call to prevent the value from being eagerly evaluated\n * in the code.\n *\n * See `packages/compiler-cli/src/ngtsc/annotations/src/injectable.ts` and\n * `packages/compiler/src/jit_compiler_facade.ts` for more information.\n */\nfunction convertFromMaybeForwardRefExpression({\n expression,\n forwardRef\n}) {\n switch (forwardRef) {\n case 0 /* ForwardRefHandling.None */:\n case 1 /* ForwardRefHandling.Wrapped */:\n return expression;\n case 2 /* ForwardRefHandling.Unwrapped */:\n return generateForwardRef(expression);\n }\n}\n/**\n * Generate an expression that has the given `expr` wrapped in the following form:\n *\n * ```\n * forwardRef(() => expr)\n * ```\n */\nfunction generateForwardRef(expr) {\n return importExpr(Identifiers.forwardRef).callFn([arrowFn([], expr)]);\n}\nvar R3FactoryDelegateType;\n(function (R3FactoryDelegateType) {\n R3FactoryDelegateType[R3FactoryDelegateType[\"Class\"] = 0] = \"Class\";\n R3FactoryDelegateType[R3FactoryDelegateType[\"Function\"] = 1] = \"Function\";\n})(R3FactoryDelegateType || (R3FactoryDelegateType = {}));\nvar FactoryTarget$1;\n(function (FactoryTarget) {\n FactoryTarget[FactoryTarget[\"Directive\"] = 0] = \"Directive\";\n FactoryTarget[FactoryTarget[\"Component\"] = 1] = \"Component\";\n FactoryTarget[FactoryTarget[\"Injectable\"] = 2] = \"Injectable\";\n FactoryTarget[FactoryTarget[\"Pipe\"] = 3] = \"Pipe\";\n FactoryTarget[FactoryTarget[\"NgModule\"] = 4] = \"NgModule\";\n})(FactoryTarget$1 || (FactoryTarget$1 = {}));\n/**\n * Construct a factory function expression for the given `R3FactoryMetadata`.\n */\nfunction compileFactoryFunction(meta) {\n const t = variable('__ngFactoryType__');\n let baseFactoryVar = null;\n // The type to instantiate via constructor invocation. If there is no delegated factory, meaning\n // this type is always created by constructor invocation, then this is the type-to-create\n // parameter provided by the user (t) if specified, or the current type if not. If there is a\n // delegated factory (which is used to create the current type) then this is only the type-to-\n // create parameter (t).\n const typeForCtor = !isDelegatedFactoryMetadata(meta) ? new BinaryOperatorExpr(BinaryOperator.Or, t, meta.type.value) : t;\n let ctorExpr = null;\n if (meta.deps !== null) {\n // There is a constructor (either explicitly or implicitly defined).\n if (meta.deps !== 'invalid') {\n ctorExpr = new InstantiateExpr(typeForCtor, injectDependencies(meta.deps, meta.target));\n }\n } else {\n // There is no constructor, use the base class' factory to construct typeForCtor.\n baseFactoryVar = variable(`ɵ${meta.name}_BaseFactory`);\n ctorExpr = baseFactoryVar.callFn([typeForCtor]);\n }\n const body = [];\n let retExpr = null;\n function makeConditionalFactory(nonCtorExpr) {\n const r = variable('__ngConditionalFactory__');\n body.push(r.set(NULL_EXPR).toDeclStmt());\n const ctorStmt = ctorExpr !== null ? r.set(ctorExpr).toStmt() : importExpr(Identifiers.invalidFactory).callFn([]).toStmt();\n body.push(ifStmt(t, [ctorStmt], [r.set(nonCtorExpr).toStmt()]));\n return r;\n }\n if (isDelegatedFactoryMetadata(meta)) {\n // This type is created with a delegated factory. If a type parameter is not specified, call\n // the factory instead.\n const delegateArgs = injectDependencies(meta.delegateDeps, meta.target);\n // Either call `new delegate(...)` or `delegate(...)` depending on meta.delegateType.\n const factoryExpr = new (meta.delegateType === R3FactoryDelegateType.Class ? InstantiateExpr : InvokeFunctionExpr)(meta.delegate, delegateArgs);\n retExpr = makeConditionalFactory(factoryExpr);\n } else if (isExpressionFactoryMetadata(meta)) {\n // TODO(alxhub): decide whether to lower the value here or in the caller\n retExpr = makeConditionalFactory(meta.expression);\n } else {\n retExpr = ctorExpr;\n }\n if (retExpr === null) {\n // The expression cannot be formed so render an `ɵɵinvalidFactory()` call.\n body.push(importExpr(Identifiers.invalidFactory).callFn([]).toStmt());\n } else if (baseFactoryVar !== null) {\n // This factory uses a base factory, so call `ɵɵgetInheritedFactory()` to compute it.\n const getInheritedFactoryCall = importExpr(Identifiers.getInheritedFactory).callFn([meta.type.value]);\n // Memoize the base factoryFn: `baseFactory || (baseFactory = ɵɵgetInheritedFactory(...))`\n const baseFactory = new BinaryOperatorExpr(BinaryOperator.Or, baseFactoryVar, baseFactoryVar.set(getInheritedFactoryCall));\n body.push(new ReturnStatement(baseFactory.callFn([typeForCtor])));\n } else {\n // This is straightforward factory, just return it.\n body.push(new ReturnStatement(retExpr));\n }\n let factoryFn = fn([new FnParam(t.name, DYNAMIC_TYPE)], body, INFERRED_TYPE, undefined, `${meta.name}_Factory`);\n if (baseFactoryVar !== null) {\n // There is a base factory variable so wrap its declaration along with the factory function into\n // an IIFE.\n factoryFn = arrowFn([], [new DeclareVarStmt(baseFactoryVar.name), new ReturnStatement(factoryFn)]).callFn([], /* sourceSpan */undefined, /* pure */true);\n }\n return {\n expression: factoryFn,\n statements: [],\n type: createFactoryType(meta)\n };\n}\nfunction createFactoryType(meta) {\n const ctorDepsType = meta.deps !== null && meta.deps !== 'invalid' ? createCtorDepsType(meta.deps) : NONE_TYPE;\n return expressionType(importExpr(Identifiers.FactoryDeclaration, [typeWithParameters(meta.type.type, meta.typeArgumentCount), ctorDepsType]));\n}\nfunction injectDependencies(deps, target) {\n return deps.map((dep, index) => compileInjectDependency(dep, target, index));\n}\nfunction compileInjectDependency(dep, target, index) {\n // Interpret the dependency according to its resolved type.\n if (dep.token === null) {\n return importExpr(Identifiers.invalidFactoryDep).callFn([literal(index)]);\n } else if (dep.attributeNameType === null) {\n // Build up the injection flags according to the metadata.\n const flags = 0 /* InjectFlags.Default */ | (dep.self ? 2 /* InjectFlags.Self */ : 0) | (dep.skipSelf ? 4 /* InjectFlags.SkipSelf */ : 0) | (dep.host ? 1 /* InjectFlags.Host */ : 0) | (dep.optional ? 8 /* InjectFlags.Optional */ : 0) | (target === FactoryTarget$1.Pipe ? 16 /* InjectFlags.ForPipe */ : 0);\n // If this dependency is optional or otherwise has non-default flags, then additional\n // parameters describing how to inject the dependency must be passed to the inject function\n // that's being used.\n let flagsParam = flags !== 0 /* InjectFlags.Default */ || dep.optional ? literal(flags) : null;\n // Build up the arguments to the injectFn call.\n const injectArgs = [dep.token];\n if (flagsParam) {\n injectArgs.push(flagsParam);\n }\n const injectFn = getInjectFn(target);\n return importExpr(injectFn).callFn(injectArgs);\n } else {\n // The `dep.attributeTypeName` value is defined, which indicates that this is an `@Attribute()`\n // type dependency. For the generated JS we still want to use the `dep.token` value in case the\n // name given for the attribute is not a string literal. For example given `@Attribute(foo())`,\n // we want to generate `ɵɵinjectAttribute(foo())`.\n //\n // The `dep.attributeTypeName` is only actually used (in `createCtorDepType()`) to generate\n // typings.\n return importExpr(Identifiers.injectAttribute).callFn([dep.token]);\n }\n}\nfunction createCtorDepsType(deps) {\n let hasTypes = false;\n const attributeTypes = deps.map(dep => {\n const type = createCtorDepType(dep);\n if (type !== null) {\n hasTypes = true;\n return type;\n } else {\n return literal(null);\n }\n });\n if (hasTypes) {\n return expressionType(literalArr(attributeTypes));\n } else {\n return NONE_TYPE;\n }\n}\nfunction createCtorDepType(dep) {\n const entries = [];\n if (dep.attributeNameType !== null) {\n entries.push({\n key: 'attribute',\n value: dep.attributeNameType,\n quoted: false\n });\n }\n if (dep.optional) {\n entries.push({\n key: 'optional',\n value: literal(true),\n quoted: false\n });\n }\n if (dep.host) {\n entries.push({\n key: 'host',\n value: literal(true),\n quoted: false\n });\n }\n if (dep.self) {\n entries.push({\n key: 'self',\n value: literal(true),\n quoted: false\n });\n }\n if (dep.skipSelf) {\n entries.push({\n key: 'skipSelf',\n value: literal(true),\n quoted: false\n });\n }\n return entries.length > 0 ? literalMap(entries) : null;\n}\nfunction isDelegatedFactoryMetadata(meta) {\n return meta.delegateType !== undefined;\n}\nfunction isExpressionFactoryMetadata(meta) {\n return meta.expression !== undefined;\n}\nfunction getInjectFn(target) {\n switch (target) {\n case FactoryTarget$1.Component:\n case FactoryTarget$1.Directive:\n case FactoryTarget$1.Pipe:\n return Identifiers.directiveInject;\n case FactoryTarget$1.NgModule:\n case FactoryTarget$1.Injectable:\n default:\n return Identifiers.inject;\n }\n}\nclass ParserError {\n constructor(message, input, errLocation, ctxLocation) {\n this.input = input;\n this.errLocation = errLocation;\n this.ctxLocation = ctxLocation;\n this.message = `Parser Error: ${message} ${errLocation} [${input}] in ${ctxLocation}`;\n }\n}\nclass ParseSpan {\n constructor(start, end) {\n this.start = start;\n this.end = end;\n }\n toAbsolute(absoluteOffset) {\n return new AbsoluteSourceSpan(absoluteOffset + this.start, absoluteOffset + this.end);\n }\n}\nclass AST {\n constructor(span,\n /**\n * Absolute location of the expression AST in a source code file.\n */\n sourceSpan) {\n this.span = span;\n this.sourceSpan = sourceSpan;\n }\n toString() {\n return 'AST';\n }\n}\nclass ASTWithName extends AST {\n constructor(span, sourceSpan, nameSpan) {\n super(span, sourceSpan);\n this.nameSpan = nameSpan;\n }\n}\nclass EmptyExpr$1 extends AST {\n visit(visitor, context = null) {\n // do nothing\n }\n}\nclass ImplicitReceiver extends AST {\n visit(visitor, context = null) {\n return visitor.visitImplicitReceiver(this, context);\n }\n}\n/**\n * Receiver when something is accessed through `this` (e.g. `this.foo`). Note that this class\n * inherits from `ImplicitReceiver`, because accessing something through `this` is treated the\n * same as accessing it implicitly inside of an Angular template (e.g. `[attr.title]=\"this.title\"`\n * is the same as `[attr.title]=\"title\"`.). Inheriting allows for the `this` accesses to be treated\n * the same as implicit ones, except for a couple of exceptions like `$event` and `$any`.\n * TODO: we should find a way for this class not to extend from `ImplicitReceiver` in the future.\n */\nclass ThisReceiver extends ImplicitReceiver {\n visit(visitor, context = null) {\n return visitor.visitThisReceiver?.(this, context);\n }\n}\n/**\n * Multiple expressions separated by a semicolon.\n */\nclass Chain extends AST {\n constructor(span, sourceSpan, expressions) {\n super(span, sourceSpan);\n this.expressions = expressions;\n }\n visit(visitor, context = null) {\n return visitor.visitChain(this, context);\n }\n}\nclass Conditional extends AST {\n constructor(span, sourceSpan, condition, trueExp, falseExp) {\n super(span, sourceSpan);\n this.condition = condition;\n this.trueExp = trueExp;\n this.falseExp = falseExp;\n }\n visit(visitor, context = null) {\n return visitor.visitConditional(this, context);\n }\n}\nclass PropertyRead extends ASTWithName {\n constructor(span, sourceSpan, nameSpan, receiver, name) {\n super(span, sourceSpan, nameSpan);\n this.receiver = receiver;\n this.name = name;\n }\n visit(visitor, context = null) {\n return visitor.visitPropertyRead(this, context);\n }\n}\nclass PropertyWrite extends ASTWithName {\n constructor(span, sourceSpan, nameSpan, receiver, name, value) {\n super(span, sourceSpan, nameSpan);\n this.receiver = receiver;\n this.name = name;\n this.value = value;\n }\n visit(visitor, context = null) {\n return visitor.visitPropertyWrite(this, context);\n }\n}\nclass SafePropertyRead extends ASTWithName {\n constructor(span, sourceSpan, nameSpan, receiver, name) {\n super(span, sourceSpan, nameSpan);\n this.receiver = receiver;\n this.name = name;\n }\n visit(visitor, context = null) {\n return visitor.visitSafePropertyRead(this, context);\n }\n}\nclass KeyedRead extends AST {\n constructor(span, sourceSpan, receiver, key) {\n super(span, sourceSpan);\n this.receiver = receiver;\n this.key = key;\n }\n visit(visitor, context = null) {\n return visitor.visitKeyedRead(this, context);\n }\n}\nclass SafeKeyedRead extends AST {\n constructor(span, sourceSpan, receiver, key) {\n super(span, sourceSpan);\n this.receiver = receiver;\n this.key = key;\n }\n visit(visitor, context = null) {\n return visitor.visitSafeKeyedRead(this, context);\n }\n}\nclass KeyedWrite extends AST {\n constructor(span, sourceSpan, receiver, key, value) {\n super(span, sourceSpan);\n this.receiver = receiver;\n this.key = key;\n this.value = value;\n }\n visit(visitor, context = null) {\n return visitor.visitKeyedWrite(this, context);\n }\n}\nclass BindingPipe extends ASTWithName {\n constructor(span, sourceSpan, exp, name, args, nameSpan) {\n super(span, sourceSpan, nameSpan);\n this.exp = exp;\n this.name = name;\n this.args = args;\n }\n visit(visitor, context = null) {\n return visitor.visitPipe(this, context);\n }\n}\nclass LiteralPrimitive extends AST {\n constructor(span, sourceSpan, value) {\n super(span, sourceSpan);\n this.value = value;\n }\n visit(visitor, context = null) {\n return visitor.visitLiteralPrimitive(this, context);\n }\n}\nclass LiteralArray extends AST {\n constructor(span, sourceSpan, expressions) {\n super(span, sourceSpan);\n this.expressions = expressions;\n }\n visit(visitor, context = null) {\n return visitor.visitLiteralArray(this, context);\n }\n}\nclass LiteralMap extends AST {\n constructor(span, sourceSpan, keys, values) {\n super(span, sourceSpan);\n this.keys = keys;\n this.values = values;\n }\n visit(visitor, context = null) {\n return visitor.visitLiteralMap(this, context);\n }\n}\nclass Interpolation$1 extends AST {\n constructor(span, sourceSpan, strings, expressions) {\n super(span, sourceSpan);\n this.strings = strings;\n this.expressions = expressions;\n }\n visit(visitor, context = null) {\n return visitor.visitInterpolation(this, context);\n }\n}\nclass Binary extends AST {\n constructor(span, sourceSpan, operation, left, right) {\n super(span, sourceSpan);\n this.operation = operation;\n this.left = left;\n this.right = right;\n }\n visit(visitor, context = null) {\n return visitor.visitBinary(this, context);\n }\n}\n/**\n * For backwards compatibility reasons, `Unary` inherits from `Binary` and mimics the binary AST\n * node that was originally used. This inheritance relation can be deleted in some future major,\n * after consumers have been given a chance to fully support Unary.\n */\nclass Unary extends Binary {\n /**\n * Creates a unary minus expression \"-x\", represented as `Binary` using \"0 - x\".\n */\n static createMinus(span, sourceSpan, expr) {\n return new Unary(span, sourceSpan, '-', expr, '-', new LiteralPrimitive(span, sourceSpan, 0), expr);\n }\n /**\n * Creates a unary plus expression \"+x\", represented as `Binary` using \"x - 0\".\n */\n static createPlus(span, sourceSpan, expr) {\n return new Unary(span, sourceSpan, '+', expr, '-', expr, new LiteralPrimitive(span, sourceSpan, 0));\n }\n /**\n * During the deprecation period this constructor is private, to avoid consumers from creating\n * a `Unary` with the fallback properties for `Binary`.\n */\n constructor(span, sourceSpan, operator, expr, binaryOp, binaryLeft, binaryRight) {\n super(span, sourceSpan, binaryOp, binaryLeft, binaryRight);\n this.operator = operator;\n this.expr = expr;\n // Redeclare the properties that are inherited from `Binary` as `never`, as consumers should not\n // depend on these fields when operating on `Unary`.\n this.left = null;\n this.right = null;\n this.operation = null;\n }\n visit(visitor, context = null) {\n if (visitor.visitUnary !== undefined) {\n return visitor.visitUnary(this, context);\n }\n return visitor.visitBinary(this, context);\n }\n}\nclass PrefixNot extends AST {\n constructor(span, sourceSpan, expression) {\n super(span, sourceSpan);\n this.expression = expression;\n }\n visit(visitor, context = null) {\n return visitor.visitPrefixNot(this, context);\n }\n}\nclass NonNullAssert extends AST {\n constructor(span, sourceSpan, expression) {\n super(span, sourceSpan);\n this.expression = expression;\n }\n visit(visitor, context = null) {\n return visitor.visitNonNullAssert(this, context);\n }\n}\nclass Call extends AST {\n constructor(span, sourceSpan, receiver, args, argumentSpan) {\n super(span, sourceSpan);\n this.receiver = receiver;\n this.args = args;\n this.argumentSpan = argumentSpan;\n }\n visit(visitor, context = null) {\n return visitor.visitCall(this, context);\n }\n}\nclass SafeCall extends AST {\n constructor(span, sourceSpan, receiver, args, argumentSpan) {\n super(span, sourceSpan);\n this.receiver = receiver;\n this.args = args;\n this.argumentSpan = argumentSpan;\n }\n visit(visitor, context = null) {\n return visitor.visitSafeCall(this, context);\n }\n}\n/**\n * Records the absolute position of a text span in a source file, where `start` and `end` are the\n * starting and ending byte offsets, respectively, of the text span in a source file.\n */\nclass AbsoluteSourceSpan {\n constructor(start, end) {\n this.start = start;\n this.end = end;\n }\n}\nclass ASTWithSource extends AST {\n constructor(ast, source, location, absoluteOffset, errors) {\n super(new ParseSpan(0, source === null ? 0 : source.length), new AbsoluteSourceSpan(absoluteOffset, source === null ? absoluteOffset : absoluteOffset + source.length));\n this.ast = ast;\n this.source = source;\n this.location = location;\n this.errors = errors;\n }\n visit(visitor, context = null) {\n if (visitor.visitASTWithSource) {\n return visitor.visitASTWithSource(this, context);\n }\n return this.ast.visit(visitor, context);\n }\n toString() {\n return `${this.source} in ${this.location}`;\n }\n}\nclass VariableBinding {\n /**\n * @param sourceSpan entire span of the binding.\n * @param key name of the LHS along with its span.\n * @param value optional value for the RHS along with its span.\n */\n constructor(sourceSpan, key, value) {\n this.sourceSpan = sourceSpan;\n this.key = key;\n this.value = value;\n }\n}\nclass ExpressionBinding {\n /**\n * @param sourceSpan entire span of the binding.\n * @param key binding name, like ngForOf, ngForTrackBy, ngIf, along with its\n * span. Note that the length of the span may not be the same as\n * `key.source.length`. For example,\n * 1. key.source = ngFor, key.span is for \"ngFor\"\n * 2. key.source = ngForOf, key.span is for \"of\"\n * 3. key.source = ngForTrackBy, key.span is for \"trackBy\"\n * @param value optional expression for the RHS.\n */\n constructor(sourceSpan, key, value) {\n this.sourceSpan = sourceSpan;\n this.key = key;\n this.value = value;\n }\n}\nclass RecursiveAstVisitor {\n visit(ast, context) {\n // The default implementation just visits every node.\n // Classes that extend RecursiveAstVisitor should override this function\n // to selectively visit the specified node.\n ast.visit(this, context);\n }\n visitUnary(ast, context) {\n this.visit(ast.expr, context);\n }\n visitBinary(ast, context) {\n this.visit(ast.left, context);\n this.visit(ast.right, context);\n }\n visitChain(ast, context) {\n this.visitAll(ast.expressions, context);\n }\n visitConditional(ast, context) {\n this.visit(ast.condition, context);\n this.visit(ast.trueExp, context);\n this.visit(ast.falseExp, context);\n }\n visitPipe(ast, context) {\n this.visit(ast.exp, context);\n this.visitAll(ast.args, context);\n }\n visitImplicitReceiver(ast, context) {}\n visitThisReceiver(ast, context) {}\n visitInterpolation(ast, context) {\n this.visitAll(ast.expressions, context);\n }\n visitKeyedRead(ast, context) {\n this.visit(ast.receiver, context);\n this.visit(ast.key, context);\n }\n visitKeyedWrite(ast, context) {\n this.visit(ast.receiver, context);\n this.visit(ast.key, context);\n this.visit(ast.value, context);\n }\n visitLiteralArray(ast, context) {\n this.visitAll(ast.expressions, context);\n }\n visitLiteralMap(ast, context) {\n this.visitAll(ast.values, context);\n }\n visitLiteralPrimitive(ast, context) {}\n visitPrefixNot(ast, context) {\n this.visit(ast.expression, context);\n }\n visitNonNullAssert(ast, context) {\n this.visit(ast.expression, context);\n }\n visitPropertyRead(ast, context) {\n this.visit(ast.receiver, context);\n }\n visitPropertyWrite(ast, context) {\n this.visit(ast.receiver, context);\n this.visit(ast.value, context);\n }\n visitSafePropertyRead(ast, context) {\n this.visit(ast.receiver, context);\n }\n visitSafeKeyedRead(ast, context) {\n this.visit(ast.receiver, context);\n this.visit(ast.key, context);\n }\n visitCall(ast, context) {\n this.visit(ast.receiver, context);\n this.visitAll(ast.args, context);\n }\n visitSafeCall(ast, context) {\n this.visit(ast.receiver, context);\n this.visitAll(ast.args, context);\n }\n // This is not part of the AstVisitor interface, just a helper method\n visitAll(asts, context) {\n for (const ast of asts) {\n this.visit(ast, context);\n }\n }\n}\nclass AstTransformer {\n visitImplicitReceiver(ast, context) {\n return ast;\n }\n visitThisReceiver(ast, context) {\n return ast;\n }\n visitInterpolation(ast, context) {\n return new Interpolation$1(ast.span, ast.sourceSpan, ast.strings, this.visitAll(ast.expressions));\n }\n visitLiteralPrimitive(ast, context) {\n return new LiteralPrimitive(ast.span, ast.sourceSpan, ast.value);\n }\n visitPropertyRead(ast, context) {\n return new PropertyRead(ast.span, ast.sourceSpan, ast.nameSpan, ast.receiver.visit(this), ast.name);\n }\n visitPropertyWrite(ast, context) {\n return new PropertyWrite(ast.span, ast.sourceSpan, ast.nameSpan, ast.receiver.visit(this), ast.name, ast.value.visit(this));\n }\n visitSafePropertyRead(ast, context) {\n return new SafePropertyRead(ast.span, ast.sourceSpan, ast.nameSpan, ast.receiver.visit(this), ast.name);\n }\n visitLiteralArray(ast, context) {\n return new LiteralArray(ast.span, ast.sourceSpan, this.visitAll(ast.expressions));\n }\n visitLiteralMap(ast, context) {\n return new LiteralMap(ast.span, ast.sourceSpan, ast.keys, this.visitAll(ast.values));\n }\n visitUnary(ast, context) {\n switch (ast.operator) {\n case '+':\n return Unary.createPlus(ast.span, ast.sourceSpan, ast.expr.visit(this));\n case '-':\n return Unary.createMinus(ast.span, ast.sourceSpan, ast.expr.visit(this));\n default:\n throw new Error(`Unknown unary operator ${ast.operator}`);\n }\n }\n visitBinary(ast, context) {\n return new Binary(ast.span, ast.sourceSpan, ast.operation, ast.left.visit(this), ast.right.visit(this));\n }\n visitPrefixNot(ast, context) {\n return new PrefixNot(ast.span, ast.sourceSpan, ast.expression.visit(this));\n }\n visitNonNullAssert(ast, context) {\n return new NonNullAssert(ast.span, ast.sourceSpan, ast.expression.visit(this));\n }\n visitConditional(ast, context) {\n return new Conditional(ast.span, ast.sourceSpan, ast.condition.visit(this), ast.trueExp.visit(this), ast.falseExp.visit(this));\n }\n visitPipe(ast, context) {\n return new BindingPipe(ast.span, ast.sourceSpan, ast.exp.visit(this), ast.name, this.visitAll(ast.args), ast.nameSpan);\n }\n visitKeyedRead(ast, context) {\n return new KeyedRead(ast.span, ast.sourceSpan, ast.receiver.visit(this), ast.key.visit(this));\n }\n visitKeyedWrite(ast, context) {\n return new KeyedWrite(ast.span, ast.sourceSpan, ast.receiver.visit(this), ast.key.visit(this), ast.value.visit(this));\n }\n visitCall(ast, context) {\n return new Call(ast.span, ast.sourceSpan, ast.receiver.visit(this), this.visitAll(ast.args), ast.argumentSpan);\n }\n visitSafeCall(ast, context) {\n return new SafeCall(ast.span, ast.sourceSpan, ast.receiver.visit(this), this.visitAll(ast.args), ast.argumentSpan);\n }\n visitAll(asts) {\n const res = [];\n for (let i = 0; i < asts.length; ++i) {\n res[i] = asts[i].visit(this);\n }\n return res;\n }\n visitChain(ast, context) {\n return new Chain(ast.span, ast.sourceSpan, this.visitAll(ast.expressions));\n }\n visitSafeKeyedRead(ast, context) {\n return new SafeKeyedRead(ast.span, ast.sourceSpan, ast.receiver.visit(this), ast.key.visit(this));\n }\n}\n// A transformer that only creates new nodes if the transformer makes a change or\n// a change is made a child node.\nclass AstMemoryEfficientTransformer {\n visitImplicitReceiver(ast, context) {\n return ast;\n }\n visitThisReceiver(ast, context) {\n return ast;\n }\n visitInterpolation(ast, context) {\n const expressions = this.visitAll(ast.expressions);\n if (expressions !== ast.expressions) return new Interpolation$1(ast.span, ast.sourceSpan, ast.strings, expressions);\n return ast;\n }\n visitLiteralPrimitive(ast, context) {\n return ast;\n }\n visitPropertyRead(ast, context) {\n const receiver = ast.receiver.visit(this);\n if (receiver !== ast.receiver) {\n return new PropertyRead(ast.span, ast.sourceSpan, ast.nameSpan, receiver, ast.name);\n }\n return ast;\n }\n visitPropertyWrite(ast, context) {\n const receiver = ast.receiver.visit(this);\n const value = ast.value.visit(this);\n if (receiver !== ast.receiver || value !== ast.value) {\n return new PropertyWrite(ast.span, ast.sourceSpan, ast.nameSpan, receiver, ast.name, value);\n }\n return ast;\n }\n visitSafePropertyRead(ast, context) {\n const receiver = ast.receiver.visit(this);\n if (receiver !== ast.receiver) {\n return new SafePropertyRead(ast.span, ast.sourceSpan, ast.nameSpan, receiver, ast.name);\n }\n return ast;\n }\n visitLiteralArray(ast, context) {\n const expressions = this.visitAll(ast.expressions);\n if (expressions !== ast.expressions) {\n return new LiteralArray(ast.span, ast.sourceSpan, expressions);\n }\n return ast;\n }\n visitLiteralMap(ast, context) {\n const values = this.visitAll(ast.values);\n if (values !== ast.values) {\n return new LiteralMap(ast.span, ast.sourceSpan, ast.keys, values);\n }\n return ast;\n }\n visitUnary(ast, context) {\n const expr = ast.expr.visit(this);\n if (expr !== ast.expr) {\n switch (ast.operator) {\n case '+':\n return Unary.createPlus(ast.span, ast.sourceSpan, expr);\n case '-':\n return Unary.createMinus(ast.span, ast.sourceSpan, expr);\n default:\n throw new Error(`Unknown unary operator ${ast.operator}`);\n }\n }\n return ast;\n }\n visitBinary(ast, context) {\n const left = ast.left.visit(this);\n const right = ast.right.visit(this);\n if (left !== ast.left || right !== ast.right) {\n return new Binary(ast.span, ast.sourceSpan, ast.operation, left, right);\n }\n return ast;\n }\n visitPrefixNot(ast, context) {\n const expression = ast.expression.visit(this);\n if (expression !== ast.expression) {\n return new PrefixNot(ast.span, ast.sourceSpan, expression);\n }\n return ast;\n }\n visitNonNullAssert(ast, context) {\n const expression = ast.expression.visit(this);\n if (expression !== ast.expression) {\n return new NonNullAssert(ast.span, ast.sourceSpan, expression);\n }\n return ast;\n }\n visitConditional(ast, context) {\n const condition = ast.condition.visit(this);\n const trueExp = ast.trueExp.visit(this);\n const falseExp = ast.falseExp.visit(this);\n if (condition !== ast.condition || trueExp !== ast.trueExp || falseExp !== ast.falseExp) {\n return new Conditional(ast.span, ast.sourceSpan, condition, trueExp, falseExp);\n }\n return ast;\n }\n visitPipe(ast, context) {\n const exp = ast.exp.visit(this);\n const args = this.visitAll(ast.args);\n if (exp !== ast.exp || args !== ast.args) {\n return new BindingPipe(ast.span, ast.sourceSpan, exp, ast.name, args, ast.nameSpan);\n }\n return ast;\n }\n visitKeyedRead(ast, context) {\n const obj = ast.receiver.visit(this);\n const key = ast.key.visit(this);\n if (obj !== ast.receiver || key !== ast.key) {\n return new KeyedRead(ast.span, ast.sourceSpan, obj, key);\n }\n return ast;\n }\n visitKeyedWrite(ast, context) {\n const obj = ast.receiver.visit(this);\n const key = ast.key.visit(this);\n const value = ast.value.visit(this);\n if (obj !== ast.receiver || key !== ast.key || value !== ast.value) {\n return new KeyedWrite(ast.span, ast.sourceSpan, obj, key, value);\n }\n return ast;\n }\n visitAll(asts) {\n const res = [];\n let modified = false;\n for (let i = 0; i < asts.length; ++i) {\n const original = asts[i];\n const value = original.visit(this);\n res[i] = value;\n modified = modified || value !== original;\n }\n return modified ? res : asts;\n }\n visitChain(ast, context) {\n const expressions = this.visitAll(ast.expressions);\n if (expressions !== ast.expressions) {\n return new Chain(ast.span, ast.sourceSpan, expressions);\n }\n return ast;\n }\n visitCall(ast, context) {\n const receiver = ast.receiver.visit(this);\n const args = this.visitAll(ast.args);\n if (receiver !== ast.receiver || args !== ast.args) {\n return new Call(ast.span, ast.sourceSpan, receiver, args, ast.argumentSpan);\n }\n return ast;\n }\n visitSafeCall(ast, context) {\n const receiver = ast.receiver.visit(this);\n const args = this.visitAll(ast.args);\n if (receiver !== ast.receiver || args !== ast.args) {\n return new SafeCall(ast.span, ast.sourceSpan, receiver, args, ast.argumentSpan);\n }\n return ast;\n }\n visitSafeKeyedRead(ast, context) {\n const obj = ast.receiver.visit(this);\n const key = ast.key.visit(this);\n if (obj !== ast.receiver || key !== ast.key) {\n return new SafeKeyedRead(ast.span, ast.sourceSpan, obj, key);\n }\n return ast;\n }\n}\n// Bindings\nclass ParsedProperty {\n constructor(name, expression, type, sourceSpan, keySpan, valueSpan) {\n this.name = name;\n this.expression = expression;\n this.type = type;\n this.sourceSpan = sourceSpan;\n this.keySpan = keySpan;\n this.valueSpan = valueSpan;\n this.isLiteral = this.type === ParsedPropertyType.LITERAL_ATTR;\n this.isAnimation = this.type === ParsedPropertyType.ANIMATION;\n }\n}\nvar ParsedPropertyType;\n(function (ParsedPropertyType) {\n ParsedPropertyType[ParsedPropertyType[\"DEFAULT\"] = 0] = \"DEFAULT\";\n ParsedPropertyType[ParsedPropertyType[\"LITERAL_ATTR\"] = 1] = \"LITERAL_ATTR\";\n ParsedPropertyType[ParsedPropertyType[\"ANIMATION\"] = 2] = \"ANIMATION\";\n ParsedPropertyType[ParsedPropertyType[\"TWO_WAY\"] = 3] = \"TWO_WAY\";\n})(ParsedPropertyType || (ParsedPropertyType = {}));\nvar ParsedEventType;\n(function (ParsedEventType) {\n // DOM or Directive event\n ParsedEventType[ParsedEventType[\"Regular\"] = 0] = \"Regular\";\n // Animation specific event\n ParsedEventType[ParsedEventType[\"Animation\"] = 1] = \"Animation\";\n // Event side of a two-way binding (e.g. `[(property)]=\"expression\"`).\n ParsedEventType[ParsedEventType[\"TwoWay\"] = 2] = \"TwoWay\";\n})(ParsedEventType || (ParsedEventType = {}));\nclass ParsedEvent {\n constructor(name, targetOrPhase, type, handler, sourceSpan, handlerSpan, keySpan) {\n this.name = name;\n this.targetOrPhase = targetOrPhase;\n this.type = type;\n this.handler = handler;\n this.sourceSpan = sourceSpan;\n this.handlerSpan = handlerSpan;\n this.keySpan = keySpan;\n }\n}\n/**\n * ParsedVariable represents a variable declaration in a microsyntax expression.\n */\nclass ParsedVariable {\n constructor(name, value, sourceSpan, keySpan, valueSpan) {\n this.name = name;\n this.value = value;\n this.sourceSpan = sourceSpan;\n this.keySpan = keySpan;\n this.valueSpan = valueSpan;\n }\n}\nvar BindingType;\n(function (BindingType) {\n // A regular binding to a property (e.g. `[property]=\"expression\"`).\n BindingType[BindingType[\"Property\"] = 0] = \"Property\";\n // A binding to an element attribute (e.g. `[attr.name]=\"expression\"`).\n BindingType[BindingType[\"Attribute\"] = 1] = \"Attribute\";\n // A binding to a CSS class (e.g. `[class.name]=\"condition\"`).\n BindingType[BindingType[\"Class\"] = 2] = \"Class\";\n // A binding to a style rule (e.g. `[style.rule]=\"expression\"`).\n BindingType[BindingType[\"Style\"] = 3] = \"Style\";\n // A binding to an animation reference (e.g. `[animate.key]=\"expression\"`).\n BindingType[BindingType[\"Animation\"] = 4] = \"Animation\";\n // Property side of a two-way binding (e.g. `[(property)]=\"expression\"`).\n BindingType[BindingType[\"TwoWay\"] = 5] = \"TwoWay\";\n})(BindingType || (BindingType = {}));\nclass BoundElementProperty {\n constructor(name, type, securityContext, value, unit, sourceSpan, keySpan, valueSpan) {\n this.name = name;\n this.type = type;\n this.securityContext = securityContext;\n this.value = value;\n this.unit = unit;\n this.sourceSpan = sourceSpan;\n this.keySpan = keySpan;\n this.valueSpan = valueSpan;\n }\n}\nvar TagContentType;\n(function (TagContentType) {\n TagContentType[TagContentType[\"RAW_TEXT\"] = 0] = \"RAW_TEXT\";\n TagContentType[TagContentType[\"ESCAPABLE_RAW_TEXT\"] = 1] = \"ESCAPABLE_RAW_TEXT\";\n TagContentType[TagContentType[\"PARSABLE_DATA\"] = 2] = \"PARSABLE_DATA\";\n})(TagContentType || (TagContentType = {}));\nfunction splitNsName(elementName, fatal = true) {\n if (elementName[0] != ':') {\n return [null, elementName];\n }\n const colonIndex = elementName.indexOf(':', 1);\n if (colonIndex === -1) {\n if (fatal) {\n throw new Error(`Unsupported format \"${elementName}\" expecting \":namespace:name\"`);\n } else {\n return [null, elementName];\n }\n }\n return [elementName.slice(1, colonIndex), elementName.slice(colonIndex + 1)];\n}\n// `` tags work the same regardless the namespace\nfunction isNgContainer(tagName) {\n return splitNsName(tagName)[1] === 'ng-container';\n}\n// `` tags work the same regardless the namespace\nfunction isNgContent(tagName) {\n return splitNsName(tagName)[1] === 'ng-content';\n}\n// `` tags work the same regardless the namespace\nfunction isNgTemplate(tagName) {\n return splitNsName(tagName)[1] === 'ng-template';\n}\nfunction getNsPrefix(fullName) {\n return fullName === null ? null : splitNsName(fullName)[0];\n}\nfunction mergeNsAndName(prefix, localName) {\n return prefix ? `:${prefix}:${localName}` : localName;\n}\n\n/**\n * This is an R3 `Node`-like wrapper for a raw `html.Comment` node. We do not currently\n * require the implementation of a visitor for Comments as they are only collected at\n * the top-level of the R3 AST, and only if `Render3ParseOptions['collectCommentNodes']`\n * is true.\n */\nclass Comment$1 {\n constructor(value, sourceSpan) {\n this.value = value;\n this.sourceSpan = sourceSpan;\n }\n visit(_visitor) {\n throw new Error('visit() not implemented for Comment');\n }\n}\nclass Text$3 {\n constructor(value, sourceSpan) {\n this.value = value;\n this.sourceSpan = sourceSpan;\n }\n visit(visitor) {\n return visitor.visitText(this);\n }\n}\nclass BoundText {\n constructor(value, sourceSpan, i18n) {\n this.value = value;\n this.sourceSpan = sourceSpan;\n this.i18n = i18n;\n }\n visit(visitor) {\n return visitor.visitBoundText(this);\n }\n}\n/**\n * Represents a text attribute in the template.\n *\n * `valueSpan` may not be present in cases where there is no value `
`.\n * `keySpan` may also not be present for synthetic attributes from ICU expansions.\n */\nclass TextAttribute {\n constructor(name, value, sourceSpan, keySpan, valueSpan, i18n) {\n this.name = name;\n this.value = value;\n this.sourceSpan = sourceSpan;\n this.keySpan = keySpan;\n this.valueSpan = valueSpan;\n this.i18n = i18n;\n }\n visit(visitor) {\n return visitor.visitTextAttribute(this);\n }\n}\nclass BoundAttribute {\n constructor(name, type, securityContext, value, unit, sourceSpan, keySpan, valueSpan, i18n) {\n this.name = name;\n this.type = type;\n this.securityContext = securityContext;\n this.value = value;\n this.unit = unit;\n this.sourceSpan = sourceSpan;\n this.keySpan = keySpan;\n this.valueSpan = valueSpan;\n this.i18n = i18n;\n }\n static fromBoundElementProperty(prop, i18n) {\n if (prop.keySpan === undefined) {\n throw new Error(`Unexpected state: keySpan must be defined for bound attributes but was not for ${prop.name}: ${prop.sourceSpan}`);\n }\n return new BoundAttribute(prop.name, prop.type, prop.securityContext, prop.value, prop.unit, prop.sourceSpan, prop.keySpan, prop.valueSpan, i18n);\n }\n visit(visitor) {\n return visitor.visitBoundAttribute(this);\n }\n}\nclass BoundEvent {\n constructor(name, type, handler, target, phase, sourceSpan, handlerSpan, keySpan) {\n this.name = name;\n this.type = type;\n this.handler = handler;\n this.target = target;\n this.phase = phase;\n this.sourceSpan = sourceSpan;\n this.handlerSpan = handlerSpan;\n this.keySpan = keySpan;\n }\n static fromParsedEvent(event) {\n const target = event.type === ParsedEventType.Regular ? event.targetOrPhase : null;\n const phase = event.type === ParsedEventType.Animation ? event.targetOrPhase : null;\n if (event.keySpan === undefined) {\n throw new Error(`Unexpected state: keySpan must be defined for bound event but was not for ${event.name}: ${event.sourceSpan}`);\n }\n return new BoundEvent(event.name, event.type, event.handler, target, phase, event.sourceSpan, event.handlerSpan, event.keySpan);\n }\n visit(visitor) {\n return visitor.visitBoundEvent(this);\n }\n}\nclass Element$1 {\n constructor(name, attributes, inputs, outputs, children, references, sourceSpan, startSourceSpan, endSourceSpan, i18n) {\n this.name = name;\n this.attributes = attributes;\n this.inputs = inputs;\n this.outputs = outputs;\n this.children = children;\n this.references = references;\n this.sourceSpan = sourceSpan;\n this.startSourceSpan = startSourceSpan;\n this.endSourceSpan = endSourceSpan;\n this.i18n = i18n;\n }\n visit(visitor) {\n return visitor.visitElement(this);\n }\n}\nclass DeferredTrigger {\n constructor(nameSpan, sourceSpan, prefetchSpan, whenOrOnSourceSpan) {\n this.nameSpan = nameSpan;\n this.sourceSpan = sourceSpan;\n this.prefetchSpan = prefetchSpan;\n this.whenOrOnSourceSpan = whenOrOnSourceSpan;\n }\n visit(visitor) {\n return visitor.visitDeferredTrigger(this);\n }\n}\nclass BoundDeferredTrigger extends DeferredTrigger {\n constructor(value, sourceSpan, prefetchSpan, whenSourceSpan) {\n // BoundDeferredTrigger is for 'when' triggers. These aren't really \"triggers\" and don't have a\n // nameSpan. Trigger names are the built in event triggers like hover, interaction, etc.\n super( /** nameSpan */null, sourceSpan, prefetchSpan, whenSourceSpan);\n this.value = value;\n }\n}\nclass IdleDeferredTrigger extends DeferredTrigger {}\nclass ImmediateDeferredTrigger extends DeferredTrigger {}\nclass HoverDeferredTrigger extends DeferredTrigger {\n constructor(reference, nameSpan, sourceSpan, prefetchSpan, onSourceSpan) {\n super(nameSpan, sourceSpan, prefetchSpan, onSourceSpan);\n this.reference = reference;\n }\n}\nclass TimerDeferredTrigger extends DeferredTrigger {\n constructor(delay, nameSpan, sourceSpan, prefetchSpan, onSourceSpan) {\n super(nameSpan, sourceSpan, prefetchSpan, onSourceSpan);\n this.delay = delay;\n }\n}\nclass InteractionDeferredTrigger extends DeferredTrigger {\n constructor(reference, nameSpan, sourceSpan, prefetchSpan, onSourceSpan) {\n super(nameSpan, sourceSpan, prefetchSpan, onSourceSpan);\n this.reference = reference;\n }\n}\nclass ViewportDeferredTrigger extends DeferredTrigger {\n constructor(reference, nameSpan, sourceSpan, prefetchSpan, onSourceSpan) {\n super(nameSpan, sourceSpan, prefetchSpan, onSourceSpan);\n this.reference = reference;\n }\n}\nclass BlockNode {\n constructor(nameSpan, sourceSpan, startSourceSpan, endSourceSpan) {\n this.nameSpan = nameSpan;\n this.sourceSpan = sourceSpan;\n this.startSourceSpan = startSourceSpan;\n this.endSourceSpan = endSourceSpan;\n }\n}\nclass DeferredBlockPlaceholder extends BlockNode {\n constructor(children, minimumTime, nameSpan, sourceSpan, startSourceSpan, endSourceSpan, i18n) {\n super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);\n this.children = children;\n this.minimumTime = minimumTime;\n this.i18n = i18n;\n }\n visit(visitor) {\n return visitor.visitDeferredBlockPlaceholder(this);\n }\n}\nclass DeferredBlockLoading extends BlockNode {\n constructor(children, afterTime, minimumTime, nameSpan, sourceSpan, startSourceSpan, endSourceSpan, i18n) {\n super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);\n this.children = children;\n this.afterTime = afterTime;\n this.minimumTime = minimumTime;\n this.i18n = i18n;\n }\n visit(visitor) {\n return visitor.visitDeferredBlockLoading(this);\n }\n}\nclass DeferredBlockError extends BlockNode {\n constructor(children, nameSpan, sourceSpan, startSourceSpan, endSourceSpan, i18n) {\n super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);\n this.children = children;\n this.i18n = i18n;\n }\n visit(visitor) {\n return visitor.visitDeferredBlockError(this);\n }\n}\nclass DeferredBlock extends BlockNode {\n constructor(children, triggers, prefetchTriggers, placeholder, loading, error, nameSpan, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan, i18n) {\n super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);\n this.children = children;\n this.placeholder = placeholder;\n this.loading = loading;\n this.error = error;\n this.mainBlockSpan = mainBlockSpan;\n this.i18n = i18n;\n this.triggers = triggers;\n this.prefetchTriggers = prefetchTriggers;\n // We cache the keys since we know that they won't change and we\n // don't want to enumarate them every time we're traversing the AST.\n this.definedTriggers = Object.keys(triggers);\n this.definedPrefetchTriggers = Object.keys(prefetchTriggers);\n }\n visit(visitor) {\n return visitor.visitDeferredBlock(this);\n }\n visitAll(visitor) {\n this.visitTriggers(this.definedTriggers, this.triggers, visitor);\n this.visitTriggers(this.definedPrefetchTriggers, this.prefetchTriggers, visitor);\n visitAll$1(visitor, this.children);\n const remainingBlocks = [this.placeholder, this.loading, this.error].filter(x => x !== null);\n visitAll$1(visitor, remainingBlocks);\n }\n visitTriggers(keys, triggers, visitor) {\n visitAll$1(visitor, keys.map(k => triggers[k]));\n }\n}\nclass SwitchBlock extends BlockNode {\n constructor(expression, cases,\n /**\n * These blocks are only captured to allow for autocompletion in the language service. They\n * aren't meant to be processed in any other way.\n */\n unknownBlocks, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {\n super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);\n this.expression = expression;\n this.cases = cases;\n this.unknownBlocks = unknownBlocks;\n }\n visit(visitor) {\n return visitor.visitSwitchBlock(this);\n }\n}\nclass SwitchBlockCase extends BlockNode {\n constructor(expression, children, sourceSpan, startSourceSpan, endSourceSpan, nameSpan, i18n) {\n super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);\n this.expression = expression;\n this.children = children;\n this.i18n = i18n;\n }\n visit(visitor) {\n return visitor.visitSwitchBlockCase(this);\n }\n}\nclass ForLoopBlock extends BlockNode {\n constructor(item, expression, trackBy, trackKeywordSpan, contextVariables, children, empty, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan, nameSpan, i18n) {\n super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);\n this.item = item;\n this.expression = expression;\n this.trackBy = trackBy;\n this.trackKeywordSpan = trackKeywordSpan;\n this.contextVariables = contextVariables;\n this.children = children;\n this.empty = empty;\n this.mainBlockSpan = mainBlockSpan;\n this.i18n = i18n;\n }\n visit(visitor) {\n return visitor.visitForLoopBlock(this);\n }\n}\nclass ForLoopBlockEmpty extends BlockNode {\n constructor(children, sourceSpan, startSourceSpan, endSourceSpan, nameSpan, i18n) {\n super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);\n this.children = children;\n this.i18n = i18n;\n }\n visit(visitor) {\n return visitor.visitForLoopBlockEmpty(this);\n }\n}\nclass IfBlock extends BlockNode {\n constructor(branches, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {\n super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);\n this.branches = branches;\n }\n visit(visitor) {\n return visitor.visitIfBlock(this);\n }\n}\nclass IfBlockBranch extends BlockNode {\n constructor(expression, children, expressionAlias, sourceSpan, startSourceSpan, endSourceSpan, nameSpan, i18n) {\n super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);\n this.expression = expression;\n this.children = children;\n this.expressionAlias = expressionAlias;\n this.i18n = i18n;\n }\n visit(visitor) {\n return visitor.visitIfBlockBranch(this);\n }\n}\nclass UnknownBlock {\n constructor(name, sourceSpan, nameSpan) {\n this.name = name;\n this.sourceSpan = sourceSpan;\n this.nameSpan = nameSpan;\n }\n visit(visitor) {\n return visitor.visitUnknownBlock(this);\n }\n}\nclass LetDeclaration$1 {\n constructor(name, value, sourceSpan, nameSpan, valueSpan) {\n this.name = name;\n this.value = value;\n this.sourceSpan = sourceSpan;\n this.nameSpan = nameSpan;\n this.valueSpan = valueSpan;\n }\n visit(visitor) {\n return visitor.visitLetDeclaration(this);\n }\n}\nclass Template {\n constructor(\n // tagName is the name of the container element, if applicable.\n // `null` is a special case for when there is a structural directive on an `ng-template` so\n // the renderer can differentiate between the synthetic template and the one written in the\n // file.\n tagName, attributes, inputs, outputs, templateAttrs, children, references, variables, sourceSpan, startSourceSpan, endSourceSpan, i18n) {\n this.tagName = tagName;\n this.attributes = attributes;\n this.inputs = inputs;\n this.outputs = outputs;\n this.templateAttrs = templateAttrs;\n this.children = children;\n this.references = references;\n this.variables = variables;\n this.sourceSpan = sourceSpan;\n this.startSourceSpan = startSourceSpan;\n this.endSourceSpan = endSourceSpan;\n this.i18n = i18n;\n }\n visit(visitor) {\n return visitor.visitTemplate(this);\n }\n}\nclass Content {\n constructor(selector, attributes, children, sourceSpan, i18n) {\n this.selector = selector;\n this.attributes = attributes;\n this.children = children;\n this.sourceSpan = sourceSpan;\n this.i18n = i18n;\n this.name = 'ng-content';\n }\n visit(visitor) {\n return visitor.visitContent(this);\n }\n}\nclass Variable {\n constructor(name, value, sourceSpan, keySpan, valueSpan) {\n this.name = name;\n this.value = value;\n this.sourceSpan = sourceSpan;\n this.keySpan = keySpan;\n this.valueSpan = valueSpan;\n }\n visit(visitor) {\n return visitor.visitVariable(this);\n }\n}\nclass Reference {\n constructor(name, value, sourceSpan, keySpan, valueSpan) {\n this.name = name;\n this.value = value;\n this.sourceSpan = sourceSpan;\n this.keySpan = keySpan;\n this.valueSpan = valueSpan;\n }\n visit(visitor) {\n return visitor.visitReference(this);\n }\n}\nclass Icu$1 {\n constructor(vars, placeholders, sourceSpan, i18n) {\n this.vars = vars;\n this.placeholders = placeholders;\n this.sourceSpan = sourceSpan;\n this.i18n = i18n;\n }\n visit(visitor) {\n return visitor.visitIcu(this);\n }\n}\nclass RecursiveVisitor$1 {\n visitElement(element) {\n visitAll$1(this, element.attributes);\n visitAll$1(this, element.inputs);\n visitAll$1(this, element.outputs);\n visitAll$1(this, element.children);\n visitAll$1(this, element.references);\n }\n visitTemplate(template) {\n visitAll$1(this, template.attributes);\n visitAll$1(this, template.inputs);\n visitAll$1(this, template.outputs);\n visitAll$1(this, template.children);\n visitAll$1(this, template.references);\n visitAll$1(this, template.variables);\n }\n visitDeferredBlock(deferred) {\n deferred.visitAll(this);\n }\n visitDeferredBlockPlaceholder(block) {\n visitAll$1(this, block.children);\n }\n visitDeferredBlockError(block) {\n visitAll$1(this, block.children);\n }\n visitDeferredBlockLoading(block) {\n visitAll$1(this, block.children);\n }\n visitSwitchBlock(block) {\n visitAll$1(this, block.cases);\n }\n visitSwitchBlockCase(block) {\n visitAll$1(this, block.children);\n }\n visitForLoopBlock(block) {\n const blockItems = [block.item, ...block.contextVariables, ...block.children];\n block.empty && blockItems.push(block.empty);\n visitAll$1(this, blockItems);\n }\n visitForLoopBlockEmpty(block) {\n visitAll$1(this, block.children);\n }\n visitIfBlock(block) {\n visitAll$1(this, block.branches);\n }\n visitIfBlockBranch(block) {\n const blockItems = block.children;\n block.expressionAlias && blockItems.push(block.expressionAlias);\n visitAll$1(this, blockItems);\n }\n visitContent(content) {\n visitAll$1(this, content.children);\n }\n visitVariable(variable) {}\n visitReference(reference) {}\n visitTextAttribute(attribute) {}\n visitBoundAttribute(attribute) {}\n visitBoundEvent(attribute) {}\n visitText(text) {}\n visitBoundText(text) {}\n visitIcu(icu) {}\n visitDeferredTrigger(trigger) {}\n visitUnknownBlock(block) {}\n visitLetDeclaration(decl) {}\n}\nfunction visitAll$1(visitor, nodes) {\n const result = [];\n if (visitor.visit) {\n for (const node of nodes) {\n visitor.visit(node) || node.visit(visitor);\n }\n } else {\n for (const node of nodes) {\n const newNode = node.visit(visitor);\n if (newNode) {\n result.push(newNode);\n }\n }\n }\n return result;\n}\nclass Message {\n /**\n * @param nodes message AST\n * @param placeholders maps placeholder names to static content and their source spans\n * @param placeholderToMessage maps placeholder names to messages (used for nested ICU messages)\n * @param meaning\n * @param description\n * @param customId\n */\n constructor(nodes, placeholders, placeholderToMessage, meaning, description, customId) {\n this.nodes = nodes;\n this.placeholders = placeholders;\n this.placeholderToMessage = placeholderToMessage;\n this.meaning = meaning;\n this.description = description;\n this.customId = customId;\n /** The ids to use if there are no custom id and if `i18nLegacyMessageIdFormat` is not empty */\n this.legacyIds = [];\n this.id = this.customId;\n this.messageString = serializeMessage(this.nodes);\n if (nodes.length) {\n this.sources = [{\n filePath: nodes[0].sourceSpan.start.file.url,\n startLine: nodes[0].sourceSpan.start.line + 1,\n startCol: nodes[0].sourceSpan.start.col + 1,\n endLine: nodes[nodes.length - 1].sourceSpan.end.line + 1,\n endCol: nodes[0].sourceSpan.start.col + 1\n }];\n } else {\n this.sources = [];\n }\n }\n}\nclass Text$2 {\n constructor(value, sourceSpan) {\n this.value = value;\n this.sourceSpan = sourceSpan;\n }\n visit(visitor, context) {\n return visitor.visitText(this, context);\n }\n}\n// TODO(vicb): do we really need this node (vs an array) ?\nclass Container {\n constructor(children, sourceSpan) {\n this.children = children;\n this.sourceSpan = sourceSpan;\n }\n visit(visitor, context) {\n return visitor.visitContainer(this, context);\n }\n}\nclass Icu {\n constructor(expression, type, cases, sourceSpan, expressionPlaceholder) {\n this.expression = expression;\n this.type = type;\n this.cases = cases;\n this.sourceSpan = sourceSpan;\n this.expressionPlaceholder = expressionPlaceholder;\n }\n visit(visitor, context) {\n return visitor.visitIcu(this, context);\n }\n}\nclass TagPlaceholder {\n constructor(tag, attrs, startName, closeName, children, isVoid,\n // TODO sourceSpan should cover all (we need a startSourceSpan and endSourceSpan)\n sourceSpan, startSourceSpan, endSourceSpan) {\n this.tag = tag;\n this.attrs = attrs;\n this.startName = startName;\n this.closeName = closeName;\n this.children = children;\n this.isVoid = isVoid;\n this.sourceSpan = sourceSpan;\n this.startSourceSpan = startSourceSpan;\n this.endSourceSpan = endSourceSpan;\n }\n visit(visitor, context) {\n return visitor.visitTagPlaceholder(this, context);\n }\n}\nclass Placeholder {\n constructor(value, name, sourceSpan) {\n this.value = value;\n this.name = name;\n this.sourceSpan = sourceSpan;\n }\n visit(visitor, context) {\n return visitor.visitPlaceholder(this, context);\n }\n}\nclass IcuPlaceholder {\n constructor(value, name, sourceSpan) {\n this.value = value;\n this.name = name;\n this.sourceSpan = sourceSpan;\n }\n visit(visitor, context) {\n return visitor.visitIcuPlaceholder(this, context);\n }\n}\nclass BlockPlaceholder {\n constructor(name, parameters, startName, closeName, children, sourceSpan, startSourceSpan, endSourceSpan) {\n this.name = name;\n this.parameters = parameters;\n this.startName = startName;\n this.closeName = closeName;\n this.children = children;\n this.sourceSpan = sourceSpan;\n this.startSourceSpan = startSourceSpan;\n this.endSourceSpan = endSourceSpan;\n }\n visit(visitor, context) {\n return visitor.visitBlockPlaceholder(this, context);\n }\n}\n// Clone the AST\nclass CloneVisitor {\n visitText(text, context) {\n return new Text$2(text.value, text.sourceSpan);\n }\n visitContainer(container, context) {\n const children = container.children.map(n => n.visit(this, context));\n return new Container(children, container.sourceSpan);\n }\n visitIcu(icu, context) {\n const cases = {};\n Object.keys(icu.cases).forEach(key => cases[key] = icu.cases[key].visit(this, context));\n const msg = new Icu(icu.expression, icu.type, cases, icu.sourceSpan, icu.expressionPlaceholder);\n return msg;\n }\n visitTagPlaceholder(ph, context) {\n const children = ph.children.map(n => n.visit(this, context));\n return new TagPlaceholder(ph.tag, ph.attrs, ph.startName, ph.closeName, children, ph.isVoid, ph.sourceSpan, ph.startSourceSpan, ph.endSourceSpan);\n }\n visitPlaceholder(ph, context) {\n return new Placeholder(ph.value, ph.name, ph.sourceSpan);\n }\n visitIcuPlaceholder(ph, context) {\n return new IcuPlaceholder(ph.value, ph.name, ph.sourceSpan);\n }\n visitBlockPlaceholder(ph, context) {\n const children = ph.children.map(n => n.visit(this, context));\n return new BlockPlaceholder(ph.name, ph.parameters, ph.startName, ph.closeName, children, ph.sourceSpan, ph.startSourceSpan, ph.endSourceSpan);\n }\n}\n// Visit all the nodes recursively\nclass RecurseVisitor {\n visitText(text, context) {}\n visitContainer(container, context) {\n container.children.forEach(child => child.visit(this));\n }\n visitIcu(icu, context) {\n Object.keys(icu.cases).forEach(k => {\n icu.cases[k].visit(this);\n });\n }\n visitTagPlaceholder(ph, context) {\n ph.children.forEach(child => child.visit(this));\n }\n visitPlaceholder(ph, context) {}\n visitIcuPlaceholder(ph, context) {}\n visitBlockPlaceholder(ph, context) {\n ph.children.forEach(child => child.visit(this));\n }\n}\n/**\n * Serialize the message to the Localize backtick string format that would appear in compiled code.\n */\nfunction serializeMessage(messageNodes) {\n const visitor = new LocalizeMessageStringVisitor();\n const str = messageNodes.map(n => n.visit(visitor)).join('');\n return str;\n}\nclass LocalizeMessageStringVisitor {\n visitText(text) {\n return text.value;\n }\n visitContainer(container) {\n return container.children.map(child => child.visit(this)).join('');\n }\n visitIcu(icu) {\n const strCases = Object.keys(icu.cases).map(k => `${k} {${icu.cases[k].visit(this)}}`);\n return `{${icu.expressionPlaceholder}, ${icu.type}, ${strCases.join(' ')}}`;\n }\n visitTagPlaceholder(ph) {\n const children = ph.children.map(child => child.visit(this)).join('');\n return `{$${ph.startName}}${children}{$${ph.closeName}}`;\n }\n visitPlaceholder(ph) {\n return `{$${ph.name}}`;\n }\n visitIcuPlaceholder(ph) {\n return `{$${ph.name}}`;\n }\n visitBlockPlaceholder(ph) {\n const children = ph.children.map(child => child.visit(this)).join('');\n return `{$${ph.startName}}${children}{$${ph.closeName}}`;\n }\n}\nclass Serializer {\n // Creates a name mapper, see `PlaceholderMapper`\n // Returning `null` means that no name mapping is used.\n createNameMapper(message) {\n return null;\n }\n}\n/**\n * A simple mapper that take a function to transform an internal name to a public name\n */\nclass SimplePlaceholderMapper extends RecurseVisitor {\n // create a mapping from the message\n constructor(message, mapName) {\n super();\n this.mapName = mapName;\n this.internalToPublic = {};\n this.publicToNextId = {};\n this.publicToInternal = {};\n message.nodes.forEach(node => node.visit(this));\n }\n toPublicName(internalName) {\n return this.internalToPublic.hasOwnProperty(internalName) ? this.internalToPublic[internalName] : null;\n }\n toInternalName(publicName) {\n return this.publicToInternal.hasOwnProperty(publicName) ? this.publicToInternal[publicName] : null;\n }\n visitText(text, context) {\n return null;\n }\n visitTagPlaceholder(ph, context) {\n this.visitPlaceholderName(ph.startName);\n super.visitTagPlaceholder(ph, context);\n this.visitPlaceholderName(ph.closeName);\n }\n visitPlaceholder(ph, context) {\n this.visitPlaceholderName(ph.name);\n }\n visitBlockPlaceholder(ph, context) {\n this.visitPlaceholderName(ph.startName);\n super.visitBlockPlaceholder(ph, context);\n this.visitPlaceholderName(ph.closeName);\n }\n visitIcuPlaceholder(ph, context) {\n this.visitPlaceholderName(ph.name);\n }\n // XMB placeholders could only contains A-Z, 0-9 and _\n visitPlaceholderName(internalName) {\n if (!internalName || this.internalToPublic.hasOwnProperty(internalName)) {\n return;\n }\n let publicName = this.mapName(internalName);\n if (this.publicToInternal.hasOwnProperty(publicName)) {\n // Create a new XMB when it has already been used\n const nextId = this.publicToNextId[publicName];\n this.publicToNextId[publicName] = nextId + 1;\n publicName = `${publicName}_${nextId}`;\n } else {\n this.publicToNextId[publicName] = 1;\n }\n this.internalToPublic[internalName] = publicName;\n this.publicToInternal[publicName] = internalName;\n }\n}\nclass _Visitor$2 {\n visitTag(tag) {\n const strAttrs = this._serializeAttributes(tag.attrs);\n if (tag.children.length == 0) {\n return `<${tag.name}${strAttrs}/>`;\n }\n const strChildren = tag.children.map(node => node.visit(this));\n return `<${tag.name}${strAttrs}>${strChildren.join('')}`;\n }\n visitText(text) {\n return text.value;\n }\n visitDeclaration(decl) {\n return ``;\n }\n _serializeAttributes(attrs) {\n const strAttrs = Object.keys(attrs).map(name => `${name}=\"${attrs[name]}\"`).join(' ');\n return strAttrs.length > 0 ? ' ' + strAttrs : '';\n }\n visitDoctype(doctype) {\n return ``;\n }\n}\nconst _visitor = new _Visitor$2();\nfunction serialize(nodes) {\n return nodes.map(node => node.visit(_visitor)).join('');\n}\nclass Declaration {\n constructor(unescapedAttrs) {\n this.attrs = {};\n Object.keys(unescapedAttrs).forEach(k => {\n this.attrs[k] = escapeXml(unescapedAttrs[k]);\n });\n }\n visit(visitor) {\n return visitor.visitDeclaration(this);\n }\n}\nclass Doctype {\n constructor(rootTag, dtd) {\n this.rootTag = rootTag;\n this.dtd = dtd;\n }\n visit(visitor) {\n return visitor.visitDoctype(this);\n }\n}\nclass Tag {\n constructor(name, unescapedAttrs = {}, children = []) {\n this.name = name;\n this.children = children;\n this.attrs = {};\n Object.keys(unescapedAttrs).forEach(k => {\n this.attrs[k] = escapeXml(unescapedAttrs[k]);\n });\n }\n visit(visitor) {\n return visitor.visitTag(this);\n }\n}\nclass Text$1 {\n constructor(unescapedValue) {\n this.value = escapeXml(unescapedValue);\n }\n visit(visitor) {\n return visitor.visitText(this);\n }\n}\nclass CR extends Text$1 {\n constructor(ws = 0) {\n super(`\\n${new Array(ws + 1).join(' ')}`);\n }\n}\nconst _ESCAPED_CHARS = [[/&/g, '&'], [/\"/g, '"'], [/'/g, '''], [//g, '>']];\n// Escape `_ESCAPED_CHARS` characters in the given text with encoded entities\nfunction escapeXml(text) {\n return _ESCAPED_CHARS.reduce((text, entry) => text.replace(entry[0], entry[1]), text);\n}\n\n/**\n * Defines the `handler` value on the serialized XMB, indicating that Angular\n * generated the bundle. This is useful for analytics in Translation Console.\n *\n * NOTE: Keep in sync with\n * packages/localize/tools/src/extract/translation_files/xmb_translation_serializer.ts.\n */\nconst _XMB_HANDLER = 'angular';\nconst _MESSAGES_TAG = 'messagebundle';\nconst _MESSAGE_TAG = 'msg';\nconst _PLACEHOLDER_TAG$3 = 'ph';\nconst _EXAMPLE_TAG = 'ex';\nconst _SOURCE_TAG$2 = 'source';\nconst _DOCTYPE = `\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n`;\nclass Xmb extends Serializer {\n constructor(preservePlaceholders = true) {\n super();\n this.preservePlaceholders = preservePlaceholders;\n }\n write(messages, locale) {\n const exampleVisitor = new ExampleVisitor();\n const visitor = new _Visitor$1();\n const rootNode = new Tag(_MESSAGES_TAG);\n rootNode.attrs['handler'] = _XMB_HANDLER;\n messages.forEach(message => {\n const attrs = {\n id: message.id\n };\n if (message.description) {\n attrs['desc'] = message.description;\n }\n if (message.meaning) {\n attrs['meaning'] = message.meaning;\n }\n let sourceTags = [];\n message.sources.forEach(source => {\n sourceTags.push(new Tag(_SOURCE_TAG$2, {}, [new Text$1(`${source.filePath}:${source.startLine}${source.endLine !== source.startLine ? ',' + source.endLine : ''}`)]));\n });\n rootNode.children.push(new CR(2), new Tag(_MESSAGE_TAG, attrs, [...sourceTags, ...visitor.serialize(message.nodes)]));\n });\n rootNode.children.push(new CR());\n return serialize([new Declaration({\n version: '1.0',\n encoding: 'UTF-8'\n }), new CR(), new Doctype(_MESSAGES_TAG, _DOCTYPE), new CR(), exampleVisitor.addDefaultExamples(rootNode), new CR()]);\n }\n load(content, url) {\n throw new Error('Unsupported');\n }\n digest(message) {\n return digest(message, this.preservePlaceholders);\n }\n createNameMapper(message) {\n return new SimplePlaceholderMapper(message, toPublicName);\n }\n}\nclass _Visitor$1 {\n visitText(text, context) {\n return [new Text$1(text.value)];\n }\n visitContainer(container, context) {\n const nodes = [];\n container.children.forEach(node => nodes.push(...node.visit(this)));\n return nodes;\n }\n visitIcu(icu, context) {\n const nodes = [new Text$1(`{${icu.expressionPlaceholder}, ${icu.type}, `)];\n Object.keys(icu.cases).forEach(c => {\n nodes.push(new Text$1(`${c} {`), ...icu.cases[c].visit(this), new Text$1(`} `));\n });\n nodes.push(new Text$1(`}`));\n return nodes;\n }\n visitTagPlaceholder(ph, context) {\n const startTagAsText = new Text$1(`<${ph.tag}>`);\n const startEx = new Tag(_EXAMPLE_TAG, {}, [startTagAsText]);\n // TC requires PH to have a non empty EX, and uses the text node to show the \"original\" value.\n const startTagPh = new Tag(_PLACEHOLDER_TAG$3, {\n name: ph.startName\n }, [startEx, startTagAsText]);\n if (ph.isVoid) {\n // void tags have no children nor closing tags\n return [startTagPh];\n }\n const closeTagAsText = new Text$1(``);\n const closeEx = new Tag(_EXAMPLE_TAG, {}, [closeTagAsText]);\n // TC requires PH to have a non empty EX, and uses the text node to show the \"original\" value.\n const closeTagPh = new Tag(_PLACEHOLDER_TAG$3, {\n name: ph.closeName\n }, [closeEx, closeTagAsText]);\n return [startTagPh, ...this.serialize(ph.children), closeTagPh];\n }\n visitPlaceholder(ph, context) {\n const interpolationAsText = new Text$1(`{{${ph.value}}}`);\n // Example tag needs to be not-empty for TC.\n const exTag = new Tag(_EXAMPLE_TAG, {}, [interpolationAsText]);\n return [\n // TC requires PH to have a non empty EX, and uses the text node to show the \"original\" value.\n new Tag(_PLACEHOLDER_TAG$3, {\n name: ph.name\n }, [exTag, interpolationAsText])];\n }\n visitBlockPlaceholder(ph, context) {\n const startAsText = new Text$1(`@${ph.name}`);\n const startEx = new Tag(_EXAMPLE_TAG, {}, [startAsText]);\n // TC requires PH to have a non empty EX, and uses the text node to show the \"original\" value.\n const startTagPh = new Tag(_PLACEHOLDER_TAG$3, {\n name: ph.startName\n }, [startEx, startAsText]);\n const closeAsText = new Text$1(`}`);\n const closeEx = new Tag(_EXAMPLE_TAG, {}, [closeAsText]);\n // TC requires PH to have a non empty EX, and uses the text node to show the \"original\" value.\n const closeTagPh = new Tag(_PLACEHOLDER_TAG$3, {\n name: ph.closeName\n }, [closeEx, closeAsText]);\n return [startTagPh, ...this.serialize(ph.children), closeTagPh];\n }\n visitIcuPlaceholder(ph, context) {\n const icuExpression = ph.value.expression;\n const icuType = ph.value.type;\n const icuCases = Object.keys(ph.value.cases).map(value => value + ' {...}').join(' ');\n const icuAsText = new Text$1(`{${icuExpression}, ${icuType}, ${icuCases}}`);\n const exTag = new Tag(_EXAMPLE_TAG, {}, [icuAsText]);\n return [\n // TC requires PH to have a non empty EX, and uses the text node to show the \"original\" value.\n new Tag(_PLACEHOLDER_TAG$3, {\n name: ph.name\n }, [exTag, icuAsText])];\n }\n serialize(nodes) {\n return [].concat(...nodes.map(node => node.visit(this)));\n }\n}\nfunction digest(message, preservePlaceholders) {\n return decimalDigest(message, preservePlaceholders);\n}\n// TC requires at least one non-empty example on placeholders\nclass ExampleVisitor {\n addDefaultExamples(node) {\n node.visit(this);\n return node;\n }\n visitTag(tag) {\n if (tag.name === _PLACEHOLDER_TAG$3) {\n if (!tag.children || tag.children.length == 0) {\n const exText = new Text$1(tag.attrs['name'] || '...');\n tag.children = [new Tag(_EXAMPLE_TAG, {}, [exText])];\n }\n } else if (tag.children) {\n tag.children.forEach(node => node.visit(this));\n }\n }\n visitText(text) {}\n visitDeclaration(decl) {}\n visitDoctype(doctype) {}\n}\n// XMB/XTB placeholders can only contain A-Z, 0-9 and _\nfunction toPublicName(internalName) {\n return internalName.toUpperCase().replace(/[^A-Z0-9_]/g, '_');\n}\n\n/** Name of the i18n attributes **/\nconst I18N_ATTR = 'i18n';\nconst I18N_ATTR_PREFIX = 'i18n-';\n/** Prefix of var expressions used in ICUs */\nconst I18N_ICU_VAR_PREFIX = 'VAR_';\nfunction isI18nAttribute(name) {\n return name === I18N_ATTR || name.startsWith(I18N_ATTR_PREFIX);\n}\nfunction hasI18nAttrs(element) {\n return element.attrs.some(attr => isI18nAttribute(attr.name));\n}\nfunction icuFromI18nMessage(message) {\n return message.nodes[0];\n}\nfunction placeholdersToParams(placeholders) {\n const params = {};\n placeholders.forEach((values, key) => {\n params[key] = literal(values.length > 1 ? `[${values.join('|')}]` : values[0]);\n });\n return params;\n}\n/**\n * Format the placeholder names in a map of placeholders to expressions.\n *\n * The placeholder names are converted from \"internal\" format (e.g. `START_TAG_DIV_1`) to \"external\"\n * format (e.g. `startTagDiv_1`).\n *\n * @param params A map of placeholder names to expressions.\n * @param useCamelCase whether to camelCase the placeholder name when formatting.\n * @returns A new map of formatted placeholder names to expressions.\n */\nfunction formatI18nPlaceholderNamesInMap(params = {}, useCamelCase) {\n const _params = {};\n if (params && Object.keys(params).length) {\n Object.keys(params).forEach(key => _params[formatI18nPlaceholderName(key, useCamelCase)] = params[key]);\n }\n return _params;\n}\n/**\n * Converts internal placeholder names to public-facing format\n * (for example to use in goog.getMsg call).\n * Example: `START_TAG_DIV_1` is converted to `startTagDiv_1`.\n *\n * @param name The placeholder name that should be formatted\n * @returns Formatted placeholder name\n */\nfunction formatI18nPlaceholderName(name, useCamelCase = true) {\n const publicName = toPublicName(name);\n if (!useCamelCase) {\n return publicName;\n }\n const chunks = publicName.split('_');\n if (chunks.length === 1) {\n // if no \"_\" found - just lowercase the value\n return name.toLowerCase();\n }\n let postfix;\n // eject last element if it's a number\n if (/^\\d+$/.test(chunks[chunks.length - 1])) {\n postfix = chunks.pop();\n }\n let raw = chunks.shift().toLowerCase();\n if (chunks.length) {\n raw += chunks.map(c => c.charAt(0).toUpperCase() + c.slice(1).toLowerCase()).join('');\n }\n return postfix ? `${raw}_${postfix}` : raw;\n}\n\n/**\n * Checks whether an object key contains potentially unsafe chars, thus the key should be wrapped in\n * quotes. Note: we do not wrap all keys into quotes, as it may have impact on minification and may\n * not work in some cases when object keys are mangled by a minifier.\n *\n * TODO(FW-1136): this is a temporary solution, we need to come up with a better way of working with\n * inputs that contain potentially unsafe chars.\n */\nconst UNSAFE_OBJECT_KEY_NAME_REGEXP = /[-.]/;\n/** Name of the temporary to use during data binding */\nconst TEMPORARY_NAME = '_t';\n/** Name of the context parameter passed into a template function */\nconst CONTEXT_NAME = 'ctx';\n/** Name of the RenderFlag passed into a template function */\nconst RENDER_FLAGS = 'rf';\n/**\n * Creates an allocator for a temporary variable.\n *\n * A variable declaration is added to the statements the first time the allocator is invoked.\n */\nfunction temporaryAllocator(pushStatement, name) {\n let temp = null;\n return () => {\n if (!temp) {\n pushStatement(new DeclareVarStmt(TEMPORARY_NAME, undefined, DYNAMIC_TYPE));\n temp = variable(name);\n }\n return temp;\n };\n}\nfunction invalid(arg) {\n throw new Error(`Invalid state: Visitor ${this.constructor.name} doesn't handle ${arg.constructor.name}`);\n}\nfunction asLiteral(value) {\n if (Array.isArray(value)) {\n return literalArr(value.map(asLiteral));\n }\n return literal(value, INFERRED_TYPE);\n}\n/**\n * Serializes inputs and outputs for `defineDirective` and `defineComponent`.\n *\n * This will attempt to generate optimized data structures to minimize memory or\n * file size of fully compiled applications.\n */\nfunction conditionallyCreateDirectiveBindingLiteral(map, forInputs) {\n const keys = Object.getOwnPropertyNames(map);\n if (keys.length === 0) {\n return null;\n }\n return literalMap(keys.map(key => {\n const value = map[key];\n let declaredName;\n let publicName;\n let minifiedName;\n let expressionValue;\n if (typeof value === 'string') {\n // canonical syntax: `dirProp: publicProp`\n declaredName = key;\n minifiedName = key;\n publicName = value;\n expressionValue = asLiteral(publicName);\n } else {\n minifiedName = key;\n declaredName = value.classPropertyName;\n publicName = value.bindingPropertyName;\n const differentDeclaringName = publicName !== declaredName;\n const hasDecoratorInputTransform = value.transformFunction !== null;\n let flags = InputFlags.None;\n // Build up input flags\n if (value.isSignal) {\n flags |= InputFlags.SignalBased;\n }\n if (hasDecoratorInputTransform) {\n flags |= InputFlags.HasDecoratorInputTransform;\n }\n // Inputs, compared to outputs, will track their declared name (for `ngOnChanges`), support\n // decorator input transform functions, or store flag information if there is any.\n if (forInputs && (differentDeclaringName || hasDecoratorInputTransform || flags !== InputFlags.None)) {\n const result = [literal(flags), asLiteral(publicName)];\n if (differentDeclaringName || hasDecoratorInputTransform) {\n result.push(asLiteral(declaredName));\n if (hasDecoratorInputTransform) {\n result.push(value.transformFunction);\n }\n }\n expressionValue = literalArr(result);\n } else {\n expressionValue = asLiteral(publicName);\n }\n }\n return {\n key: minifiedName,\n // put quotes around keys that contain potentially unsafe characters\n quoted: UNSAFE_OBJECT_KEY_NAME_REGEXP.test(minifiedName),\n value: expressionValue\n };\n }));\n}\n/**\n * A representation for an object literal used during codegen of definition objects. The generic\n * type `T` allows to reference a documented type of the generated structure, such that the\n * property names that are set can be resolved to their documented declaration.\n */\nclass DefinitionMap {\n constructor() {\n this.values = [];\n }\n set(key, value) {\n if (value) {\n const existing = this.values.find(value => value.key === key);\n if (existing) {\n existing.value = value;\n } else {\n this.values.push({\n key: key,\n value,\n quoted: false\n });\n }\n }\n }\n toLiteralMap() {\n return literalMap(this.values);\n }\n}\n/**\n * Creates a `CssSelector` from an AST node.\n */\nfunction createCssSelectorFromNode(node) {\n const elementName = node instanceof Element$1 ? node.name : 'ng-template';\n const attributes = getAttrsForDirectiveMatching(node);\n const cssSelector = new CssSelector();\n const elementNameNoNs = splitNsName(elementName)[1];\n cssSelector.setElement(elementNameNoNs);\n Object.getOwnPropertyNames(attributes).forEach(name => {\n const nameNoNs = splitNsName(name)[1];\n const value = attributes[name];\n cssSelector.addAttribute(nameNoNs, value);\n if (name.toLowerCase() === 'class') {\n const classes = value.trim().split(/\\s+/);\n classes.forEach(className => cssSelector.addClassName(className));\n }\n });\n return cssSelector;\n}\n/**\n * Extract a map of properties to values for a given element or template node, which can be used\n * by the directive matching machinery.\n *\n * @param elOrTpl the element or template in question\n * @return an object set up for directive matching. For attributes on the element/template, this\n * object maps a property name to its (static) value. For any bindings, this map simply maps the\n * property name to an empty string.\n */\nfunction getAttrsForDirectiveMatching(elOrTpl) {\n const attributesMap = {};\n if (elOrTpl instanceof Template && elOrTpl.tagName !== 'ng-template') {\n elOrTpl.templateAttrs.forEach(a => attributesMap[a.name] = '');\n } else {\n elOrTpl.attributes.forEach(a => {\n if (!isI18nAttribute(a.name)) {\n attributesMap[a.name] = a.value;\n }\n });\n elOrTpl.inputs.forEach(i => {\n if (i.type === BindingType.Property || i.type === BindingType.TwoWay) {\n attributesMap[i.name] = '';\n }\n });\n elOrTpl.outputs.forEach(o => {\n attributesMap[o.name] = '';\n });\n }\n return attributesMap;\n}\nfunction compileInjectable(meta, resolveForwardRefs) {\n let result = null;\n const factoryMeta = {\n name: meta.name,\n type: meta.type,\n typeArgumentCount: meta.typeArgumentCount,\n deps: [],\n target: FactoryTarget$1.Injectable\n };\n if (meta.useClass !== undefined) {\n // meta.useClass has two modes of operation. Either deps are specified, in which case `new` is\n // used to instantiate the class with dependencies injected, or deps are not specified and\n // the factory of the class is used to instantiate it.\n //\n // A special case exists for useClass: Type where Type is the injectable type itself and no\n // deps are specified, in which case 'useClass' is effectively ignored.\n const useClassOnSelf = meta.useClass.expression.isEquivalent(meta.type.value);\n let deps = undefined;\n if (meta.deps !== undefined) {\n deps = meta.deps;\n }\n if (deps !== undefined) {\n // factory: () => new meta.useClass(...deps)\n result = compileFactoryFunction({\n ...factoryMeta,\n delegate: meta.useClass.expression,\n delegateDeps: deps,\n delegateType: R3FactoryDelegateType.Class\n });\n } else if (useClassOnSelf) {\n result = compileFactoryFunction(factoryMeta);\n } else {\n result = {\n statements: [],\n expression: delegateToFactory(meta.type.value, meta.useClass.expression, resolveForwardRefs)\n };\n }\n } else if (meta.useFactory !== undefined) {\n if (meta.deps !== undefined) {\n result = compileFactoryFunction({\n ...factoryMeta,\n delegate: meta.useFactory,\n delegateDeps: meta.deps || [],\n delegateType: R3FactoryDelegateType.Function\n });\n } else {\n result = {\n statements: [],\n expression: arrowFn([], meta.useFactory.callFn([]))\n };\n }\n } else if (meta.useValue !== undefined) {\n // Note: it's safe to use `meta.useValue` instead of the `USE_VALUE in meta` check used for\n // client code because meta.useValue is an Expression which will be defined even if the actual\n // value is undefined.\n result = compileFactoryFunction({\n ...factoryMeta,\n expression: meta.useValue.expression\n });\n } else if (meta.useExisting !== undefined) {\n // useExisting is an `inject` call on the existing token.\n result = compileFactoryFunction({\n ...factoryMeta,\n expression: importExpr(Identifiers.inject).callFn([meta.useExisting.expression])\n });\n } else {\n result = {\n statements: [],\n expression: delegateToFactory(meta.type.value, meta.type.value, resolveForwardRefs)\n };\n }\n const token = meta.type.value;\n const injectableProps = new DefinitionMap();\n injectableProps.set('token', token);\n injectableProps.set('factory', result.expression);\n // Only generate providedIn property if it has a non-null value\n if (meta.providedIn.expression.value !== null) {\n injectableProps.set('providedIn', convertFromMaybeForwardRefExpression(meta.providedIn));\n }\n const expression = importExpr(Identifiers.ɵɵdefineInjectable).callFn([injectableProps.toLiteralMap()], undefined, true);\n return {\n expression,\n type: createInjectableType(meta),\n statements: result.statements\n };\n}\nfunction createInjectableType(meta) {\n return new ExpressionType(importExpr(Identifiers.InjectableDeclaration, [typeWithParameters(meta.type.type, meta.typeArgumentCount)]));\n}\nfunction delegateToFactory(type, useType, unwrapForwardRefs) {\n if (type.node === useType.node) {\n // The types are the same, so we can simply delegate directly to the type's factory.\n // ```\n // factory: type.ɵfac\n // ```\n return useType.prop('ɵfac');\n }\n if (!unwrapForwardRefs) {\n // The type is not wrapped in a `forwardRef()`, so we create a simple factory function that\n // accepts a sub-type as an argument.\n // ```\n // factory: function(t) { return useType.ɵfac(t); }\n // ```\n return createFactoryFunction(useType);\n }\n // The useType is actually wrapped in a `forwardRef()` so we need to resolve that before\n // calling its factory.\n // ```\n // factory: function(t) { return core.resolveForwardRef(type).ɵfac(t); }\n // ```\n const unwrappedType = importExpr(Identifiers.resolveForwardRef).callFn([useType]);\n return createFactoryFunction(unwrappedType);\n}\nfunction createFactoryFunction(type) {\n const t = new FnParam('__ngFactoryType__', DYNAMIC_TYPE);\n return arrowFn([t], type.prop('ɵfac').callFn([variable(t.name)]));\n}\nconst UNUSABLE_INTERPOLATION_REGEXPS = [/@/,\n// control flow reserved symbol\n/^\\s*$/,\n// empty\n/[<>]/,\n// html tag\n/^[{}]$/,\n// i18n expansion\n/&(#|[a-z])/i,\n// character reference,\n/^\\/\\// // comment\n];\nfunction assertInterpolationSymbols(identifier, value) {\n if (value != null && !(Array.isArray(value) && value.length == 2)) {\n throw new Error(`Expected '${identifier}' to be an array, [start, end].`);\n } else if (value != null) {\n const start = value[0];\n const end = value[1];\n // Check for unusable interpolation symbols\n UNUSABLE_INTERPOLATION_REGEXPS.forEach(regexp => {\n if (regexp.test(start) || regexp.test(end)) {\n throw new Error(`['${start}', '${end}'] contains unusable interpolation symbol.`);\n }\n });\n }\n}\nclass InterpolationConfig {\n static fromArray(markers) {\n if (!markers) {\n return DEFAULT_INTERPOLATION_CONFIG;\n }\n assertInterpolationSymbols('interpolation', markers);\n return new InterpolationConfig(markers[0], markers[1]);\n }\n constructor(start, end) {\n this.start = start;\n this.end = end;\n }\n}\nconst DEFAULT_INTERPOLATION_CONFIG = new InterpolationConfig('{{', '}}');\nconst DEFAULT_CONTAINER_BLOCKS = new Set(['switch']);\nconst $EOF = 0;\nconst $BSPACE = 8;\nconst $TAB = 9;\nconst $LF = 10;\nconst $VTAB = 11;\nconst $FF = 12;\nconst $CR = 13;\nconst $SPACE = 32;\nconst $BANG = 33;\nconst $DQ = 34;\nconst $HASH = 35;\nconst $$ = 36;\nconst $PERCENT = 37;\nconst $AMPERSAND = 38;\nconst $SQ = 39;\nconst $LPAREN = 40;\nconst $RPAREN = 41;\nconst $STAR = 42;\nconst $PLUS = 43;\nconst $COMMA = 44;\nconst $MINUS = 45;\nconst $PERIOD = 46;\nconst $SLASH = 47;\nconst $COLON = 58;\nconst $SEMICOLON = 59;\nconst $LT = 60;\nconst $EQ = 61;\nconst $GT = 62;\nconst $QUESTION = 63;\nconst $0 = 48;\nconst $7 = 55;\nconst $9 = 57;\nconst $A = 65;\nconst $E = 69;\nconst $F = 70;\nconst $X = 88;\nconst $Z = 90;\nconst $LBRACKET = 91;\nconst $BACKSLASH = 92;\nconst $RBRACKET = 93;\nconst $CARET = 94;\nconst $_ = 95;\nconst $a = 97;\nconst $b = 98;\nconst $e = 101;\nconst $f = 102;\nconst $n = 110;\nconst $r = 114;\nconst $t = 116;\nconst $u = 117;\nconst $v = 118;\nconst $x = 120;\nconst $z = 122;\nconst $LBRACE = 123;\nconst $BAR = 124;\nconst $RBRACE = 125;\nconst $NBSP = 160;\nconst $PIPE = 124;\nconst $TILDA = 126;\nconst $AT = 64;\nconst $BT = 96;\nfunction isWhitespace(code) {\n return code >= $TAB && code <= $SPACE || code == $NBSP;\n}\nfunction isDigit(code) {\n return $0 <= code && code <= $9;\n}\nfunction isAsciiLetter(code) {\n return code >= $a && code <= $z || code >= $A && code <= $Z;\n}\nfunction isAsciiHexDigit(code) {\n return code >= $a && code <= $f || code >= $A && code <= $F || isDigit(code);\n}\nfunction isNewLine(code) {\n return code === $LF || code === $CR;\n}\nfunction isOctalDigit(code) {\n return $0 <= code && code <= $7;\n}\nfunction isQuote(code) {\n return code === $SQ || code === $DQ || code === $BT;\n}\nclass ParseLocation {\n constructor(file, offset, line, col) {\n this.file = file;\n this.offset = offset;\n this.line = line;\n this.col = col;\n }\n toString() {\n return this.offset != null ? `${this.file.url}@${this.line}:${this.col}` : this.file.url;\n }\n moveBy(delta) {\n const source = this.file.content;\n const len = source.length;\n let offset = this.offset;\n let line = this.line;\n let col = this.col;\n while (offset > 0 && delta < 0) {\n offset--;\n delta++;\n const ch = source.charCodeAt(offset);\n if (ch == $LF) {\n line--;\n const priorLine = source.substring(0, offset - 1).lastIndexOf(String.fromCharCode($LF));\n col = priorLine > 0 ? offset - priorLine : offset;\n } else {\n col--;\n }\n }\n while (offset < len && delta > 0) {\n const ch = source.charCodeAt(offset);\n offset++;\n delta--;\n if (ch == $LF) {\n line++;\n col = 0;\n } else {\n col++;\n }\n }\n return new ParseLocation(this.file, offset, line, col);\n }\n // Return the source around the location\n // Up to `maxChars` or `maxLines` on each side of the location\n getContext(maxChars, maxLines) {\n const content = this.file.content;\n let startOffset = this.offset;\n if (startOffset != null) {\n if (startOffset > content.length - 1) {\n startOffset = content.length - 1;\n }\n let endOffset = startOffset;\n let ctxChars = 0;\n let ctxLines = 0;\n while (ctxChars < maxChars && startOffset > 0) {\n startOffset--;\n ctxChars++;\n if (content[startOffset] == '\\n') {\n if (++ctxLines == maxLines) {\n break;\n }\n }\n }\n ctxChars = 0;\n ctxLines = 0;\n while (ctxChars < maxChars && endOffset < content.length - 1) {\n endOffset++;\n ctxChars++;\n if (content[endOffset] == '\\n') {\n if (++ctxLines == maxLines) {\n break;\n }\n }\n }\n return {\n before: content.substring(startOffset, this.offset),\n after: content.substring(this.offset, endOffset + 1)\n };\n }\n return null;\n }\n}\nclass ParseSourceFile {\n constructor(content, url) {\n this.content = content;\n this.url = url;\n }\n}\nclass ParseSourceSpan {\n /**\n * Create an object that holds information about spans of tokens/nodes captured during\n * lexing/parsing of text.\n *\n * @param start\n * The location of the start of the span (having skipped leading trivia).\n * Skipping leading trivia makes source-spans more \"user friendly\", since things like HTML\n * elements will appear to begin at the start of the opening tag, rather than at the start of any\n * leading trivia, which could include newlines.\n *\n * @param end\n * The location of the end of the span.\n *\n * @param fullStart\n * The start of the token without skipping the leading trivia.\n * This is used by tooling that splits tokens further, such as extracting Angular interpolations\n * from text tokens. Such tooling creates new source-spans relative to the original token's\n * source-span. If leading trivia characters have been skipped then the new source-spans may be\n * incorrectly offset.\n *\n * @param details\n * Additional information (such as identifier names) that should be associated with the span.\n */\n constructor(start, end, fullStart = start, details = null) {\n this.start = start;\n this.end = end;\n this.fullStart = fullStart;\n this.details = details;\n }\n toString() {\n return this.start.file.content.substring(this.start.offset, this.end.offset);\n }\n}\nvar ParseErrorLevel;\n(function (ParseErrorLevel) {\n ParseErrorLevel[ParseErrorLevel[\"WARNING\"] = 0] = \"WARNING\";\n ParseErrorLevel[ParseErrorLevel[\"ERROR\"] = 1] = \"ERROR\";\n})(ParseErrorLevel || (ParseErrorLevel = {}));\nclass ParseError {\n constructor(span, msg, level = ParseErrorLevel.ERROR) {\n this.span = span;\n this.msg = msg;\n this.level = level;\n }\n contextualMessage() {\n const ctx = this.span.start.getContext(100, 3);\n return ctx ? `${this.msg} (\"${ctx.before}[${ParseErrorLevel[this.level]} ->]${ctx.after}\")` : this.msg;\n }\n toString() {\n const details = this.span.details ? `, ${this.span.details}` : '';\n return `${this.contextualMessage()}: ${this.span.start}${details}`;\n }\n}\n/**\n * Generates Source Span object for a given R3 Type for JIT mode.\n *\n * @param kind Component or Directive.\n * @param typeName name of the Component or Directive.\n * @param sourceUrl reference to Component or Directive source.\n * @returns instance of ParseSourceSpan that represent a given Component or Directive.\n */\nfunction r3JitTypeSourceSpan(kind, typeName, sourceUrl) {\n const sourceFileName = `in ${kind} ${typeName} in ${sourceUrl}`;\n const sourceFile = new ParseSourceFile('', sourceFileName);\n return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1));\n}\nlet _anonymousTypeIndex = 0;\nfunction identifierName(compileIdentifier) {\n if (!compileIdentifier || !compileIdentifier.reference) {\n return null;\n }\n const ref = compileIdentifier.reference;\n if (ref['__anonymousType']) {\n return ref['__anonymousType'];\n }\n if (ref['__forward_ref__']) {\n // We do not want to try to stringify a `forwardRef()` function because that would cause the\n // inner function to be evaluated too early, defeating the whole point of the `forwardRef`.\n return '__forward_ref__';\n }\n let identifier = stringify(ref);\n if (identifier.indexOf('(') >= 0) {\n // case: anonymous functions!\n identifier = `anonymous_${_anonymousTypeIndex++}`;\n ref['__anonymousType'] = identifier;\n } else {\n identifier = sanitizeIdentifier(identifier);\n }\n return identifier;\n}\nfunction sanitizeIdentifier(name) {\n return name.replace(/\\W/g, '_');\n}\n\n/**\n * In TypeScript, tagged template functions expect a \"template object\", which is an array of\n * \"cooked\" strings plus a `raw` property that contains an array of \"raw\" strings. This is\n * typically constructed with a function called `__makeTemplateObject(cooked, raw)`, but it may not\n * be available in all environments.\n *\n * This is a JavaScript polyfill that uses __makeTemplateObject when it's available, but otherwise\n * creates an inline helper with the same functionality.\n *\n * In the inline function, if `Object.defineProperty` is available we use that to attach the `raw`\n * array.\n */\nconst makeTemplateObjectPolyfill = '(this&&this.__makeTemplateObject||function(e,t){return Object.defineProperty?Object.defineProperty(e,\"raw\",{value:t}):e.raw=t,e})';\nclass AbstractJsEmitterVisitor extends AbstractEmitterVisitor {\n constructor() {\n super(false);\n }\n visitWrappedNodeExpr(ast, ctx) {\n throw new Error('Cannot emit a WrappedNodeExpr in Javascript.');\n }\n visitDeclareVarStmt(stmt, ctx) {\n ctx.print(stmt, `var ${stmt.name}`);\n if (stmt.value) {\n ctx.print(stmt, ' = ');\n stmt.value.visitExpression(this, ctx);\n }\n ctx.println(stmt, `;`);\n return null;\n }\n visitTaggedTemplateExpr(ast, ctx) {\n // The following convoluted piece of code is effectively the downlevelled equivalent of\n // ```\n // tag`...`\n // ```\n // which is effectively like:\n // ```\n // tag(__makeTemplateObject(cooked, raw), expression1, expression2, ...);\n // ```\n const elements = ast.template.elements;\n ast.tag.visitExpression(this, ctx);\n ctx.print(ast, `(${makeTemplateObjectPolyfill}(`);\n ctx.print(ast, `[${elements.map(part => escapeIdentifier(part.text, false)).join(', ')}], `);\n ctx.print(ast, `[${elements.map(part => escapeIdentifier(part.rawText, false)).join(', ')}])`);\n ast.template.expressions.forEach(expression => {\n ctx.print(ast, ', ');\n expression.visitExpression(this, ctx);\n });\n ctx.print(ast, ')');\n return null;\n }\n visitFunctionExpr(ast, ctx) {\n ctx.print(ast, `function${ast.name ? ' ' + ast.name : ''}(`);\n this._visitParams(ast.params, ctx);\n ctx.println(ast, `) {`);\n ctx.incIndent();\n this.visitAllStatements(ast.statements, ctx);\n ctx.decIndent();\n ctx.print(ast, `}`);\n return null;\n }\n visitArrowFunctionExpr(ast, ctx) {\n ctx.print(ast, '(');\n this._visitParams(ast.params, ctx);\n ctx.print(ast, ') =>');\n if (Array.isArray(ast.body)) {\n ctx.println(ast, `{`);\n ctx.incIndent();\n this.visitAllStatements(ast.body, ctx);\n ctx.decIndent();\n ctx.print(ast, `}`);\n } else {\n const isObjectLiteral = ast.body instanceof LiteralMapExpr;\n if (isObjectLiteral) {\n ctx.print(ast, '(');\n }\n ast.body.visitExpression(this, ctx);\n if (isObjectLiteral) {\n ctx.print(ast, ')');\n }\n }\n return null;\n }\n visitDeclareFunctionStmt(stmt, ctx) {\n ctx.print(stmt, `function ${stmt.name}(`);\n this._visitParams(stmt.params, ctx);\n ctx.println(stmt, `) {`);\n ctx.incIndent();\n this.visitAllStatements(stmt.statements, ctx);\n ctx.decIndent();\n ctx.println(stmt, `}`);\n return null;\n }\n visitLocalizedString(ast, ctx) {\n // The following convoluted piece of code is effectively the downlevelled equivalent of\n // ```\n // $localize `...`\n // ```\n // which is effectively like:\n // ```\n // $localize(__makeTemplateObject(cooked, raw), expression1, expression2, ...);\n // ```\n ctx.print(ast, `$localize(${makeTemplateObjectPolyfill}(`);\n const parts = [ast.serializeI18nHead()];\n for (let i = 1; i < ast.messageParts.length; i++) {\n parts.push(ast.serializeI18nTemplatePart(i));\n }\n ctx.print(ast, `[${parts.map(part => escapeIdentifier(part.cooked, false)).join(', ')}], `);\n ctx.print(ast, `[${parts.map(part => escapeIdentifier(part.raw, false)).join(', ')}])`);\n ast.expressions.forEach(expression => {\n ctx.print(ast, ', ');\n expression.visitExpression(this, ctx);\n });\n ctx.print(ast, ')');\n return null;\n }\n _visitParams(params, ctx) {\n this.visitAllObjects(param => ctx.print(null, param.name), params, ctx, ',');\n }\n}\n\n/**\n * @fileoverview\n * A module to facilitate use of a Trusted Types policy within the JIT\n * compiler. It lazily constructs the Trusted Types policy, providing helper\n * utilities for promoting strings to Trusted Types. When Trusted Types are not\n * available, strings are used as a fallback.\n * @security All use of this module is security-sensitive and should go through\n * security review.\n */\n/**\n * The Trusted Types policy, or null if Trusted Types are not\n * enabled/supported, or undefined if the policy has not been created yet.\n */\nlet policy;\n/**\n * Returns the Trusted Types policy, or null if Trusted Types are not\n * enabled/supported. The first call to this function will create the policy.\n */\nfunction getPolicy() {\n if (policy === undefined) {\n const trustedTypes = _global['trustedTypes'];\n policy = null;\n if (trustedTypes) {\n try {\n policy = trustedTypes.createPolicy('angular#unsafe-jit', {\n createScript: s => s\n });\n } catch {\n // trustedTypes.createPolicy throws if called with a name that is\n // already registered, even in report-only mode. Until the API changes,\n // catch the error not to break the applications functionally. In such\n // cases, the code will fall back to using strings.\n }\n }\n }\n return policy;\n}\n/**\n * Unsafely promote a string to a TrustedScript, falling back to strings when\n * Trusted Types are not available.\n * @security In particular, it must be assured that the provided string will\n * never cause an XSS vulnerability if used in a context that will be\n * interpreted and executed as a script by a browser, e.g. when calling eval.\n */\nfunction trustedScriptFromString(script) {\n return getPolicy()?.createScript(script) || script;\n}\n/**\n * Unsafely call the Function constructor with the given string arguments.\n * @security This is a security-sensitive function; any use of this function\n * must go through security review. In particular, it must be assured that it\n * is only called from the JIT compiler, as use in other code can lead to XSS\n * vulnerabilities.\n */\nfunction newTrustedFunctionForJIT(...args) {\n if (!_global['trustedTypes']) {\n // In environments that don't support Trusted Types, fall back to the most\n // straightforward implementation:\n return new Function(...args);\n }\n // Chrome currently does not support passing TrustedScript to the Function\n // constructor. The following implements the workaround proposed on the page\n // below, where the Chromium bug is also referenced:\n // https://github.com/w3c/webappsec-trusted-types/wiki/Trusted-Types-for-function-constructor\n const fnArgs = args.slice(0, -1).join(',');\n const fnBody = args[args.length - 1];\n const body = `(function anonymous(${fnArgs}\n) { ${fnBody}\n})`;\n // Using eval directly confuses the compiler and prevents this module from\n // being stripped out of JS binaries even if not used. The global['eval']\n // indirection fixes that.\n const fn = _global['eval'](trustedScriptFromString(body));\n if (fn.bind === undefined) {\n // Workaround for a browser bug that only exists in Chrome 83, where passing\n // a TrustedScript to eval just returns the TrustedScript back without\n // evaluating it. In that case, fall back to the most straightforward\n // implementation:\n return new Function(...args);\n }\n // To completely mimic the behavior of calling \"new Function\", two more\n // things need to happen:\n // 1. Stringifying the resulting function should return its source code\n fn.toString = () => body;\n // 2. When calling the resulting function, `this` should refer to `global`\n return fn.bind(_global);\n // When Trusted Types support in Function constructors is widely available,\n // the implementation of this function can be simplified to:\n // return new Function(...args.map(a => trustedScriptFromString(a)));\n}\n\n/**\n * A helper class to manage the evaluation of JIT generated code.\n */\nclass JitEvaluator {\n /**\n *\n * @param sourceUrl The URL of the generated code.\n * @param statements An array of Angular statement AST nodes to be evaluated.\n * @param refResolver Resolves `o.ExternalReference`s into values.\n * @param createSourceMaps If true then create a source-map for the generated code and include it\n * inline as a source-map comment.\n * @returns A map of all the variables in the generated code.\n */\n evaluateStatements(sourceUrl, statements, refResolver, createSourceMaps) {\n const converter = new JitEmitterVisitor(refResolver);\n const ctx = EmitterVisitorContext.createRoot();\n // Ensure generated code is in strict mode\n if (statements.length > 0 && !isUseStrictStatement(statements[0])) {\n statements = [literal('use strict').toStmt(), ...statements];\n }\n converter.visitAllStatements(statements, ctx);\n converter.createReturnStmt(ctx);\n return this.evaluateCode(sourceUrl, ctx, converter.getArgs(), createSourceMaps);\n }\n /**\n * Evaluate a piece of JIT generated code.\n * @param sourceUrl The URL of this generated code.\n * @param ctx A context object that contains an AST of the code to be evaluated.\n * @param vars A map containing the names and values of variables that the evaluated code might\n * reference.\n * @param createSourceMap If true then create a source-map for the generated code and include it\n * inline as a source-map comment.\n * @returns The result of evaluating the code.\n */\n evaluateCode(sourceUrl, ctx, vars, createSourceMap) {\n let fnBody = `\"use strict\";${ctx.toSource()}\\n//# sourceURL=${sourceUrl}`;\n const fnArgNames = [];\n const fnArgValues = [];\n for (const argName in vars) {\n fnArgValues.push(vars[argName]);\n fnArgNames.push(argName);\n }\n if (createSourceMap) {\n // using `new Function(...)` generates a header, 1 line of no arguments, 2 lines otherwise\n // E.g. ```\n // function anonymous(a,b,c\n // /**/) { ... }```\n // We don't want to hard code this fact, so we auto detect it via an empty function first.\n const emptyFn = newTrustedFunctionForJIT(...fnArgNames.concat('return null;')).toString();\n const headerLines = emptyFn.slice(0, emptyFn.indexOf('return null;')).split('\\n').length - 1;\n fnBody += `\\n${ctx.toSourceMapGenerator(sourceUrl, headerLines).toJsComment()}`;\n }\n const fn = newTrustedFunctionForJIT(...fnArgNames.concat(fnBody));\n return this.executeFunction(fn, fnArgValues);\n }\n /**\n * Execute a JIT generated function by calling it.\n *\n * This method can be overridden in tests to capture the functions that are generated\n * by this `JitEvaluator` class.\n *\n * @param fn A function to execute.\n * @param args The arguments to pass to the function being executed.\n * @returns The return value of the executed function.\n */\n executeFunction(fn, args) {\n return fn(...args);\n }\n}\n/**\n * An Angular AST visitor that converts AST nodes into executable JavaScript code.\n */\nclass JitEmitterVisitor extends AbstractJsEmitterVisitor {\n constructor(refResolver) {\n super();\n this.refResolver = refResolver;\n this._evalArgNames = [];\n this._evalArgValues = [];\n this._evalExportedVars = [];\n }\n createReturnStmt(ctx) {\n const stmt = new ReturnStatement(new LiteralMapExpr(this._evalExportedVars.map(resultVar => new LiteralMapEntry(resultVar, variable(resultVar), false))));\n stmt.visitStatement(this, ctx);\n }\n getArgs() {\n const result = {};\n for (let i = 0; i < this._evalArgNames.length; i++) {\n result[this._evalArgNames[i]] = this._evalArgValues[i];\n }\n return result;\n }\n visitExternalExpr(ast, ctx) {\n this._emitReferenceToExternal(ast, this.refResolver.resolveExternalReference(ast.value), ctx);\n return null;\n }\n visitWrappedNodeExpr(ast, ctx) {\n this._emitReferenceToExternal(ast, ast.node, ctx);\n return null;\n }\n visitDeclareVarStmt(stmt, ctx) {\n if (stmt.hasModifier(StmtModifier.Exported)) {\n this._evalExportedVars.push(stmt.name);\n }\n return super.visitDeclareVarStmt(stmt, ctx);\n }\n visitDeclareFunctionStmt(stmt, ctx) {\n if (stmt.hasModifier(StmtModifier.Exported)) {\n this._evalExportedVars.push(stmt.name);\n }\n return super.visitDeclareFunctionStmt(stmt, ctx);\n }\n _emitReferenceToExternal(ast, value, ctx) {\n let id = this._evalArgValues.indexOf(value);\n if (id === -1) {\n id = this._evalArgValues.length;\n this._evalArgValues.push(value);\n const name = identifierName({\n reference: value\n }) || 'val';\n this._evalArgNames.push(`jit_${name}_${id}`);\n }\n ctx.print(ast, this._evalArgNames[id]);\n }\n}\nfunction isUseStrictStatement(statement) {\n return statement.isEquivalent(literal('use strict').toStmt());\n}\nfunction compileInjector(meta) {\n const definitionMap = new DefinitionMap();\n if (meta.providers !== null) {\n definitionMap.set('providers', meta.providers);\n }\n if (meta.imports.length > 0) {\n definitionMap.set('imports', literalArr(meta.imports));\n }\n const expression = importExpr(Identifiers.defineInjector).callFn([definitionMap.toLiteralMap()], undefined, true);\n const type = createInjectorType(meta);\n return {\n expression,\n type,\n statements: []\n };\n}\nfunction createInjectorType(meta) {\n return new ExpressionType(importExpr(Identifiers.InjectorDeclaration, [new ExpressionType(meta.type.type)]));\n}\n\n/**\n * Implementation of `CompileReflector` which resolves references to @angular/core\n * symbols at runtime, according to a consumer-provided mapping.\n *\n * Only supports `resolveExternalReference`, all other methods throw.\n */\nclass R3JitReflector {\n constructor(context) {\n this.context = context;\n }\n resolveExternalReference(ref) {\n // This reflector only handles @angular/core imports.\n if (ref.moduleName !== '@angular/core') {\n throw new Error(`Cannot resolve external reference to ${ref.moduleName}, only references to @angular/core are supported.`);\n }\n if (!this.context.hasOwnProperty(ref.name)) {\n throw new Error(`No value provided for @angular/core symbol '${ref.name}'.`);\n }\n return this.context[ref.name];\n }\n}\n\n/**\n * How the selector scope of an NgModule (its declarations, imports, and exports) should be emitted\n * as a part of the NgModule definition.\n */\nvar R3SelectorScopeMode;\n(function (R3SelectorScopeMode) {\n /**\n * Emit the declarations inline into the module definition.\n *\n * This option is useful in certain contexts where it's known that JIT support is required. The\n * tradeoff here is that this emit style prevents directives and pipes from being tree-shaken if\n * they are unused, but the NgModule is used.\n */\n R3SelectorScopeMode[R3SelectorScopeMode[\"Inline\"] = 0] = \"Inline\";\n /**\n * Emit the declarations using a side effectful function call, `ɵɵsetNgModuleScope`, that is\n * guarded with the `ngJitMode` flag.\n *\n * This form of emit supports JIT and can be optimized away if the `ngJitMode` flag is set to\n * false, which allows unused directives and pipes to be tree-shaken.\n */\n R3SelectorScopeMode[R3SelectorScopeMode[\"SideEffect\"] = 1] = \"SideEffect\";\n /**\n * Don't generate selector scopes at all.\n *\n * This is useful for contexts where JIT support is known to be unnecessary.\n */\n R3SelectorScopeMode[R3SelectorScopeMode[\"Omit\"] = 2] = \"Omit\";\n})(R3SelectorScopeMode || (R3SelectorScopeMode = {}));\n/**\n * The type of the NgModule meta data.\n * - Global: Used for full and partial compilation modes which mainly includes R3References.\n * - Local: Used for the local compilation mode which mainly includes the raw expressions as appears\n * in the NgModule decorator.\n */\nvar R3NgModuleMetadataKind;\n(function (R3NgModuleMetadataKind) {\n R3NgModuleMetadataKind[R3NgModuleMetadataKind[\"Global\"] = 0] = \"Global\";\n R3NgModuleMetadataKind[R3NgModuleMetadataKind[\"Local\"] = 1] = \"Local\";\n})(R3NgModuleMetadataKind || (R3NgModuleMetadataKind = {}));\n/**\n * Construct an `R3NgModuleDef` for the given `R3NgModuleMetadata`.\n */\nfunction compileNgModule(meta) {\n const statements = [];\n const definitionMap = new DefinitionMap();\n definitionMap.set('type', meta.type.value);\n // Assign bootstrap definition. In local compilation mode (i.e., for\n // `R3NgModuleMetadataKind.LOCAL`) we assign the bootstrap field using the runtime\n // `ɵɵsetNgModuleScope`.\n if (meta.kind === R3NgModuleMetadataKind.Global && meta.bootstrap.length > 0) {\n definitionMap.set('bootstrap', refsToArray(meta.bootstrap, meta.containsForwardDecls));\n }\n if (meta.selectorScopeMode === R3SelectorScopeMode.Inline) {\n // If requested to emit scope information inline, pass the `declarations`, `imports` and\n // `exports` to the `ɵɵdefineNgModule()` call directly.\n if (meta.declarations.length > 0) {\n definitionMap.set('declarations', refsToArray(meta.declarations, meta.containsForwardDecls));\n }\n if (meta.imports.length > 0) {\n definitionMap.set('imports', refsToArray(meta.imports, meta.containsForwardDecls));\n }\n if (meta.exports.length > 0) {\n definitionMap.set('exports', refsToArray(meta.exports, meta.containsForwardDecls));\n }\n } else if (meta.selectorScopeMode === R3SelectorScopeMode.SideEffect) {\n // In this mode, scope information is not passed into `ɵɵdefineNgModule` as it\n // would prevent tree-shaking of the declarations, imports and exports references. Instead, it's\n // patched onto the NgModule definition with a `ɵɵsetNgModuleScope` call that's guarded by the\n // `ngJitMode` flag.\n const setNgModuleScopeCall = generateSetNgModuleScopeCall(meta);\n if (setNgModuleScopeCall !== null) {\n statements.push(setNgModuleScopeCall);\n }\n } else {\n // Selector scope emit was not requested, so skip it.\n }\n if (meta.schemas !== null && meta.schemas.length > 0) {\n definitionMap.set('schemas', literalArr(meta.schemas.map(ref => ref.value)));\n }\n if (meta.id !== null) {\n definitionMap.set('id', meta.id);\n // Generate a side-effectful call to register this NgModule by its id, as per the semantics of\n // NgModule ids.\n statements.push(importExpr(Identifiers.registerNgModuleType).callFn([meta.type.value, meta.id]).toStmt());\n }\n const expression = importExpr(Identifiers.defineNgModule).callFn([definitionMap.toLiteralMap()], undefined, true);\n const type = createNgModuleType(meta);\n return {\n expression,\n type,\n statements\n };\n}\n/**\n * This function is used in JIT mode to generate the call to `ɵɵdefineNgModule()` from a call to\n * `ɵɵngDeclareNgModule()`.\n */\nfunction compileNgModuleDeclarationExpression(meta) {\n const definitionMap = new DefinitionMap();\n definitionMap.set('type', new WrappedNodeExpr(meta.type));\n if (meta.bootstrap !== undefined) {\n definitionMap.set('bootstrap', new WrappedNodeExpr(meta.bootstrap));\n }\n if (meta.declarations !== undefined) {\n definitionMap.set('declarations', new WrappedNodeExpr(meta.declarations));\n }\n if (meta.imports !== undefined) {\n definitionMap.set('imports', new WrappedNodeExpr(meta.imports));\n }\n if (meta.exports !== undefined) {\n definitionMap.set('exports', new WrappedNodeExpr(meta.exports));\n }\n if (meta.schemas !== undefined) {\n definitionMap.set('schemas', new WrappedNodeExpr(meta.schemas));\n }\n if (meta.id !== undefined) {\n definitionMap.set('id', new WrappedNodeExpr(meta.id));\n }\n return importExpr(Identifiers.defineNgModule).callFn([definitionMap.toLiteralMap()]);\n}\nfunction createNgModuleType(meta) {\n if (meta.kind === R3NgModuleMetadataKind.Local) {\n return new ExpressionType(meta.type.value);\n }\n const {\n type: moduleType,\n declarations,\n exports,\n imports,\n includeImportTypes,\n publicDeclarationTypes\n } = meta;\n return new ExpressionType(importExpr(Identifiers.NgModuleDeclaration, [new ExpressionType(moduleType.type), publicDeclarationTypes === null ? tupleTypeOf(declarations) : tupleOfTypes(publicDeclarationTypes), includeImportTypes ? tupleTypeOf(imports) : NONE_TYPE, tupleTypeOf(exports)]));\n}\n/**\n * Generates a function call to `ɵɵsetNgModuleScope` with all necessary information so that the\n * transitive module scope can be computed during runtime in JIT mode. This call is marked pure\n * such that the references to declarations, imports and exports may be elided causing these\n * symbols to become tree-shakeable.\n */\nfunction generateSetNgModuleScopeCall(meta) {\n const scopeMap = new DefinitionMap();\n if (meta.kind === R3NgModuleMetadataKind.Global) {\n if (meta.declarations.length > 0) {\n scopeMap.set('declarations', refsToArray(meta.declarations, meta.containsForwardDecls));\n }\n } else {\n if (meta.declarationsExpression) {\n scopeMap.set('declarations', meta.declarationsExpression);\n }\n }\n if (meta.kind === R3NgModuleMetadataKind.Global) {\n if (meta.imports.length > 0) {\n scopeMap.set('imports', refsToArray(meta.imports, meta.containsForwardDecls));\n }\n } else {\n if (meta.importsExpression) {\n scopeMap.set('imports', meta.importsExpression);\n }\n }\n if (meta.kind === R3NgModuleMetadataKind.Global) {\n if (meta.exports.length > 0) {\n scopeMap.set('exports', refsToArray(meta.exports, meta.containsForwardDecls));\n }\n } else {\n if (meta.exportsExpression) {\n scopeMap.set('exports', meta.exportsExpression);\n }\n }\n if (meta.kind === R3NgModuleMetadataKind.Local && meta.bootstrapExpression) {\n scopeMap.set('bootstrap', meta.bootstrapExpression);\n }\n if (Object.keys(scopeMap.values).length === 0) {\n return null;\n }\n // setNgModuleScope(...)\n const fnCall = new InvokeFunctionExpr( /* fn */importExpr(Identifiers.setNgModuleScope), /* args */[meta.type.value, scopeMap.toLiteralMap()]);\n // (ngJitMode guard) && setNgModuleScope(...)\n const guardedCall = jitOnlyGuardedExpression(fnCall);\n // function() { (ngJitMode guard) && setNgModuleScope(...); }\n const iife = new FunctionExpr( /* params */[], /* statements */[guardedCall.toStmt()]);\n // (function() { (ngJitMode guard) && setNgModuleScope(...); })()\n const iifeCall = new InvokeFunctionExpr( /* fn */iife, /* args */[]);\n return iifeCall.toStmt();\n}\nfunction tupleTypeOf(exp) {\n const types = exp.map(ref => typeofExpr(ref.type));\n return exp.length > 0 ? expressionType(literalArr(types)) : NONE_TYPE;\n}\nfunction tupleOfTypes(types) {\n const typeofTypes = types.map(type => typeofExpr(type));\n return types.length > 0 ? expressionType(literalArr(typeofTypes)) : NONE_TYPE;\n}\nfunction compilePipeFromMetadata(metadata) {\n const definitionMapValues = [];\n // e.g. `name: 'myPipe'`\n definitionMapValues.push({\n key: 'name',\n value: literal(metadata.pipeName),\n quoted: false\n });\n // e.g. `type: MyPipe`\n definitionMapValues.push({\n key: 'type',\n value: metadata.type.value,\n quoted: false\n });\n // e.g. `pure: true`\n definitionMapValues.push({\n key: 'pure',\n value: literal(metadata.pure),\n quoted: false\n });\n if (metadata.isStandalone) {\n definitionMapValues.push({\n key: 'standalone',\n value: literal(true),\n quoted: false\n });\n }\n const expression = importExpr(Identifiers.definePipe).callFn([literalMap(definitionMapValues)], undefined, true);\n const type = createPipeType(metadata);\n return {\n expression,\n type,\n statements: []\n };\n}\nfunction createPipeType(metadata) {\n return new ExpressionType(importExpr(Identifiers.PipeDeclaration, [typeWithParameters(metadata.type.type, metadata.typeArgumentCount), new ExpressionType(new LiteralExpr(metadata.pipeName)), new ExpressionType(new LiteralExpr(metadata.isStandalone))]));\n}\nvar R3TemplateDependencyKind;\n(function (R3TemplateDependencyKind) {\n R3TemplateDependencyKind[R3TemplateDependencyKind[\"Directive\"] = 0] = \"Directive\";\n R3TemplateDependencyKind[R3TemplateDependencyKind[\"Pipe\"] = 1] = \"Pipe\";\n R3TemplateDependencyKind[R3TemplateDependencyKind[\"NgModule\"] = 2] = \"NgModule\";\n})(R3TemplateDependencyKind || (R3TemplateDependencyKind = {}));\n\n/**\n * The following set contains all keywords that can be used in the animation css shorthand\n * property and is used during the scoping of keyframes to make sure such keywords\n * are not modified.\n */\nconst animationKeywords = new Set([\n// global values\n'inherit', 'initial', 'revert', 'unset',\n// animation-direction\n'alternate', 'alternate-reverse', 'normal', 'reverse',\n// animation-fill-mode\n'backwards', 'both', 'forwards', 'none',\n// animation-play-state\n'paused', 'running',\n// animation-timing-function\n'ease', 'ease-in', 'ease-in-out', 'ease-out', 'linear', 'step-start', 'step-end',\n// `steps()` function\n'end', 'jump-both', 'jump-end', 'jump-none', 'jump-start', 'start']);\n/**\n * The following array contains all of the CSS at-rule identifiers which are scoped.\n */\nconst scopedAtRuleIdentifiers = ['@media', '@supports', '@document', '@layer', '@container', '@scope', '@starting-style'];\n/**\n * The following class has its origin from a port of shadowCSS from webcomponents.js to TypeScript.\n * It has since diverge in many ways to tailor Angular's needs.\n *\n * Source:\n * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js\n *\n * The original file level comment is reproduced below\n */\n/*\n This is a limited shim for ShadowDOM css styling.\n https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#styles\n\n The intention here is to support only the styling features which can be\n relatively simply implemented. The goal is to allow users to avoid the\n most obvious pitfalls and do so without compromising performance significantly.\n For ShadowDOM styling that's not covered here, a set of best practices\n can be provided that should allow users to accomplish more complex styling.\n\n The following is a list of specific ShadowDOM styling features and a brief\n discussion of the approach used to shim.\n\n Shimmed features:\n\n * :host, :host-context: ShadowDOM allows styling of the shadowRoot's host\n element using the :host rule. To shim this feature, the :host styles are\n reformatted and prefixed with a given scope name and promoted to a\n document level stylesheet.\n For example, given a scope name of .foo, a rule like this:\n\n :host {\n background: red;\n }\n }\n\n becomes:\n\n .foo {\n background: red;\n }\n\n * encapsulation: Styles defined within ShadowDOM, apply only to\n dom inside the ShadowDOM.\n The selectors are scoped by adding an attribute selector suffix to each\n simple selector that contains the host element tag name. Each element\n in the element's ShadowDOM template is also given the scope attribute.\n Thus, these rules match only elements that have the scope attribute.\n For example, given a scope name of x-foo, a rule like this:\n\n div {\n font-weight: bold;\n }\n\n becomes:\n\n div[x-foo] {\n font-weight: bold;\n }\n\n Note that elements that are dynamically added to a scope must have the scope\n selector added to them manually.\n\n * upper/lower bound encapsulation: Styles which are defined outside a\n shadowRoot should not cross the ShadowDOM boundary and should not apply\n inside a shadowRoot.\n\n This styling behavior is not emulated. Some possible ways to do this that\n were rejected due to complexity and/or performance concerns include: (1) reset\n every possible property for every possible selector for a given scope name;\n (2) re-implement css in javascript.\n\n As an alternative, users should make sure to use selectors\n specific to the scope in which they are working.\n\n * ::distributed: This behavior is not emulated. It's often not necessary\n to style the contents of a specific insertion point and instead, descendants\n of the host element can be styled selectively. Users can also create an\n extra node around an insertion point and style that node's contents\n via descendent selectors. For example, with a shadowRoot like this:\n\n \n \n\n could become:\n\n \n
\n \n
\n\n Note the use of @polyfill in the comment above a ShadowDOM specific style\n declaration. This is a directive to the styling shim to use the selector\n in comments in lieu of the next selector when running under polyfill.\n*/\nclass ShadowCss {\n constructor() {\n /**\n * Regular expression used to extrapolate the possible keyframes from an\n * animation declaration (with possibly multiple animation definitions)\n *\n * The regular expression can be divided in three parts\n * - (^|\\s+|,)\n * captures how many (if any) leading whitespaces are present or a comma\n * - (?:(?:(['\"])((?:\\\\\\\\|\\\\\\2|(?!\\2).)+)\\2)|(-?[A-Za-z][\\w\\-]*))\n * captures two different possible keyframes, ones which are quoted or ones which are valid css\n * idents (custom properties excluded)\n * - (?=[,\\s;]|$)\n * simply matches the end of the possible keyframe, valid endings are: a comma, a space, a\n * semicolon or the end of the string\n */\n this._animationDeclarationKeyframesRe = /(^|\\s+|,)(?:(?:(['\"])((?:\\\\\\\\|\\\\\\2|(?!\\2).)+)\\2)|(-?[A-Za-z][\\w\\-]*))(?=[,\\s]|$)/g;\n }\n /*\n * Shim some cssText with the given selector. Returns cssText that can be included in the document\n *\n * The selector is the attribute added to all elements inside the host,\n * The hostSelector is the attribute added to the host itself.\n */\n shimCssText(cssText, selector, hostSelector = '') {\n // **NOTE**: Do not strip comments as this will cause component sourcemaps to break\n // due to shift in lines.\n // Collect comments and replace them with a placeholder, this is done to avoid complicating\n // the rule parsing RegExp and keep it safer.\n const comments = [];\n cssText = cssText.replace(_commentRe, m => {\n if (m.match(_commentWithHashRe)) {\n comments.push(m);\n } else {\n // Replace non hash comments with empty lines.\n // This is done so that we do not leak any sensitive data in comments.\n const newLinesMatches = m.match(_newLinesRe);\n comments.push((newLinesMatches?.join('') ?? '') + '\\n');\n }\n return COMMENT_PLACEHOLDER;\n });\n cssText = this._insertDirectives(cssText);\n const scopedCssText = this._scopeCssText(cssText, selector, hostSelector);\n // Add back comments at the original position.\n let commentIdx = 0;\n return scopedCssText.replace(_commentWithHashPlaceHolderRe, () => comments[commentIdx++]);\n }\n _insertDirectives(cssText) {\n cssText = this._insertPolyfillDirectivesInCssText(cssText);\n return this._insertPolyfillRulesInCssText(cssText);\n }\n /**\n * Process styles to add scope to keyframes.\n *\n * Modify both the names of the keyframes defined in the component styles and also the css\n * animation rules using them.\n *\n * Animation rules using keyframes defined elsewhere are not modified to allow for globally\n * defined keyframes.\n *\n * For example, we convert this css:\n *\n * ```\n * .box {\n * animation: box-animation 1s forwards;\n * }\n *\n * @keyframes box-animation {\n * to {\n * background-color: green;\n * }\n * }\n * ```\n *\n * to this:\n *\n * ```\n * .box {\n * animation: scopeName_box-animation 1s forwards;\n * }\n *\n * @keyframes scopeName_box-animation {\n * to {\n * background-color: green;\n * }\n * }\n * ```\n *\n * @param cssText the component's css text that needs to be scoped.\n * @param scopeSelector the component's scope selector.\n *\n * @returns the scoped css text.\n */\n _scopeKeyframesRelatedCss(cssText, scopeSelector) {\n const unscopedKeyframesSet = new Set();\n const scopedKeyframesCssText = processRules(cssText, rule => this._scopeLocalKeyframeDeclarations(rule, scopeSelector, unscopedKeyframesSet));\n return processRules(scopedKeyframesCssText, rule => this._scopeAnimationRule(rule, scopeSelector, unscopedKeyframesSet));\n }\n /**\n * Scopes local keyframes names, returning the updated css rule and it also\n * adds the original keyframe name to a provided set to collect all keyframes names\n * so that it can later be used to scope the animation rules.\n *\n * For example, it takes a rule such as:\n *\n * ```\n * @keyframes box-animation {\n * to {\n * background-color: green;\n * }\n * }\n * ```\n *\n * and returns:\n *\n * ```\n * @keyframes scopeName_box-animation {\n * to {\n * background-color: green;\n * }\n * }\n * ```\n * and as a side effect it adds \"box-animation\" to the `unscopedKeyframesSet` set\n *\n * @param cssRule the css rule to process.\n * @param scopeSelector the component's scope selector.\n * @param unscopedKeyframesSet the set of unscoped keyframes names (which can be\n * modified as a side effect)\n *\n * @returns the css rule modified with the scoped keyframes name.\n */\n _scopeLocalKeyframeDeclarations(rule, scopeSelector, unscopedKeyframesSet) {\n return {\n ...rule,\n selector: rule.selector.replace(/(^@(?:-webkit-)?keyframes(?:\\s+))(['\"]?)(.+)\\2(\\s*)$/, (_, start, quote, keyframeName, endSpaces) => {\n unscopedKeyframesSet.add(unescapeQuotes(keyframeName, quote));\n return `${start}${quote}${scopeSelector}_${keyframeName}${quote}${endSpaces}`;\n })\n };\n }\n /**\n * Function used to scope a keyframes name (obtained from an animation declaration)\n * using an existing set of unscopedKeyframes names to discern if the scoping needs to be\n * performed (keyframes names of keyframes not defined in the component's css need not to be\n * scoped).\n *\n * @param keyframe the keyframes name to check.\n * @param scopeSelector the component's scope selector.\n * @param unscopedKeyframesSet the set of unscoped keyframes names.\n *\n * @returns the scoped name of the keyframe, or the original name is the name need not to be\n * scoped.\n */\n _scopeAnimationKeyframe(keyframe, scopeSelector, unscopedKeyframesSet) {\n return keyframe.replace(/^(\\s*)(['\"]?)(.+?)\\2(\\s*)$/, (_, spaces1, quote, name, spaces2) => {\n name = `${unscopedKeyframesSet.has(unescapeQuotes(name, quote)) ? scopeSelector + '_' : ''}${name}`;\n return `${spaces1}${quote}${name}${quote}${spaces2}`;\n });\n }\n /**\n * Scope an animation rule so that the keyframes mentioned in such rule\n * are scoped if defined in the component's css and left untouched otherwise.\n *\n * It can scope values of both the 'animation' and 'animation-name' properties.\n *\n * @param rule css rule to scope.\n * @param scopeSelector the component's scope selector.\n * @param unscopedKeyframesSet the set of unscoped keyframes names.\n *\n * @returns the updated css rule.\n **/\n _scopeAnimationRule(rule, scopeSelector, unscopedKeyframesSet) {\n let content = rule.content.replace(/((?:^|\\s+|;)(?:-webkit-)?animation\\s*:\\s*),*([^;]+)/g, (_, start, animationDeclarations) => start + animationDeclarations.replace(this._animationDeclarationKeyframesRe, (original, leadingSpaces, quote = '', quotedName, nonQuotedName) => {\n if (quotedName) {\n return `${leadingSpaces}${this._scopeAnimationKeyframe(`${quote}${quotedName}${quote}`, scopeSelector, unscopedKeyframesSet)}`;\n } else {\n return animationKeywords.has(nonQuotedName) ? original : `${leadingSpaces}${this._scopeAnimationKeyframe(nonQuotedName, scopeSelector, unscopedKeyframesSet)}`;\n }\n }));\n content = content.replace(/((?:^|\\s+|;)(?:-webkit-)?animation-name(?:\\s*):(?:\\s*))([^;]+)/g, (_match, start, commaSeparatedKeyframes) => `${start}${commaSeparatedKeyframes.split(',').map(keyframe => this._scopeAnimationKeyframe(keyframe, scopeSelector, unscopedKeyframesSet)).join(',')}`);\n return {\n ...rule,\n content\n };\n }\n /*\n * Process styles to convert native ShadowDOM rules that will trip\n * up the css parser; we rely on decorating the stylesheet with inert rules.\n *\n * For example, we convert this rule:\n *\n * polyfill-next-selector { content: ':host menu-item'; }\n * ::content menu-item {\n *\n * to this:\n *\n * scopeName menu-item {\n *\n **/\n _insertPolyfillDirectivesInCssText(cssText) {\n return cssText.replace(_cssContentNextSelectorRe, function (...m) {\n return m[2] + '{';\n });\n }\n /*\n * Process styles to add rules which will only apply under the polyfill\n *\n * For example, we convert this rule:\n *\n * polyfill-rule {\n * content: ':host menu-item';\n * ...\n * }\n *\n * to this:\n *\n * scopeName menu-item {...}\n *\n **/\n _insertPolyfillRulesInCssText(cssText) {\n return cssText.replace(_cssContentRuleRe, (...m) => {\n const rule = m[0].replace(m[1], '').replace(m[2], '');\n return m[4] + rule;\n });\n }\n /* Ensure styles are scoped. Pseudo-scoping takes a rule like:\n *\n * .foo {... }\n *\n * and converts this to\n *\n * scopeName .foo { ... }\n */\n _scopeCssText(cssText, scopeSelector, hostSelector) {\n const unscopedRules = this._extractUnscopedRulesFromCssText(cssText);\n // replace :host and :host-context -shadowcsshost and -shadowcsshost respectively\n cssText = this._insertPolyfillHostInCssText(cssText);\n cssText = this._convertColonHost(cssText);\n cssText = this._convertColonHostContext(cssText);\n cssText = this._convertShadowDOMSelectors(cssText);\n if (scopeSelector) {\n cssText = this._scopeKeyframesRelatedCss(cssText, scopeSelector);\n cssText = this._scopeSelectors(cssText, scopeSelector, hostSelector);\n }\n cssText = cssText + '\\n' + unscopedRules;\n return cssText.trim();\n }\n /*\n * Process styles to add rules which will only apply under the polyfill\n * and do not process via CSSOM. (CSSOM is destructive to rules on rare\n * occasions, e.g. -webkit-calc on Safari.)\n * For example, we convert this rule:\n *\n * @polyfill-unscoped-rule {\n * content: 'menu-item';\n * ... }\n *\n * to this:\n *\n * menu-item {...}\n *\n **/\n _extractUnscopedRulesFromCssText(cssText) {\n let r = '';\n let m;\n _cssContentUnscopedRuleRe.lastIndex = 0;\n while ((m = _cssContentUnscopedRuleRe.exec(cssText)) !== null) {\n const rule = m[0].replace(m[2], '').replace(m[1], m[4]);\n r += rule + '\\n\\n';\n }\n return r;\n }\n /*\n * convert a rule like :host(.foo) > .bar { }\n *\n * to\n *\n * .foo > .bar\n */\n _convertColonHost(cssText) {\n return cssText.replace(_cssColonHostRe, (_, hostSelectors, otherSelectors) => {\n if (hostSelectors) {\n const convertedSelectors = [];\n const hostSelectorArray = hostSelectors.split(',').map(p => p.trim());\n for (const hostSelector of hostSelectorArray) {\n if (!hostSelector) break;\n const convertedSelector = _polyfillHostNoCombinator + hostSelector.replace(_polyfillHost, '') + otherSelectors;\n convertedSelectors.push(convertedSelector);\n }\n return convertedSelectors.join(',');\n } else {\n return _polyfillHostNoCombinator + otherSelectors;\n }\n });\n }\n /*\n * convert a rule like :host-context(.foo) > .bar { }\n *\n * to\n *\n * .foo > .bar, .foo > .bar { }\n *\n * and\n *\n * :host-context(.foo:host) .bar { ... }\n *\n * to\n *\n * .foo .bar { ... }\n */\n _convertColonHostContext(cssText) {\n return cssText.replace(_cssColonHostContextReGlobal, selectorText => {\n // We have captured a selector that contains a `:host-context` rule.\n // For backward compatibility `:host-context` may contain a comma separated list of selectors.\n // Each context selector group will contain a list of host-context selectors that must match\n // an ancestor of the host.\n // (Normally `contextSelectorGroups` will only contain a single array of context selectors.)\n const contextSelectorGroups = [[]];\n // There may be more than `:host-context` in this selector so `selectorText` could look like:\n // `:host-context(.one):host-context(.two)`.\n // Execute `_cssColonHostContextRe` over and over until we have extracted all the\n // `:host-context` selectors from this selector.\n let match;\n while (match = _cssColonHostContextRe.exec(selectorText)) {\n // `match` = [':host-context()', , ]\n // The `` could actually be a comma separated list: `:host-context(.one, .two)`.\n const newContextSelectors = (match[1] ?? '').trim().split(',').map(m => m.trim()).filter(m => m !== '');\n // We must duplicate the current selector group for each of these new selectors.\n // For example if the current groups are:\n // ```\n // [\n // ['a', 'b', 'c'],\n // ['x', 'y', 'z'],\n // ]\n // ```\n // And we have a new set of comma separated selectors: `:host-context(m,n)` then the new\n // groups are:\n // ```\n // [\n // ['a', 'b', 'c', 'm'],\n // ['x', 'y', 'z', 'm'],\n // ['a', 'b', 'c', 'n'],\n // ['x', 'y', 'z', 'n'],\n // ]\n // ```\n const contextSelectorGroupsLength = contextSelectorGroups.length;\n repeatGroups(contextSelectorGroups, newContextSelectors.length);\n for (let i = 0; i < newContextSelectors.length; i++) {\n for (let j = 0; j < contextSelectorGroupsLength; j++) {\n contextSelectorGroups[j + i * contextSelectorGroupsLength].push(newContextSelectors[i]);\n }\n }\n // Update the `selectorText` and see repeat to see if there are more `:host-context`s.\n selectorText = match[2];\n }\n // The context selectors now must be combined with each other to capture all the possible\n // selectors that `:host-context` can match. See `combineHostContextSelectors()` for more\n // info about how this is done.\n return contextSelectorGroups.map(contextSelectors => combineHostContextSelectors(contextSelectors, selectorText)).join(', ');\n });\n }\n /*\n * Convert combinators like ::shadow and pseudo-elements like ::content\n * by replacing with space.\n */\n _convertShadowDOMSelectors(cssText) {\n return _shadowDOMSelectorsRe.reduce((result, pattern) => result.replace(pattern, ' '), cssText);\n }\n // change a selector like 'div' to 'name div'\n _scopeSelectors(cssText, scopeSelector, hostSelector) {\n return processRules(cssText, rule => {\n let selector = rule.selector;\n let content = rule.content;\n if (rule.selector[0] !== '@') {\n selector = this._scopeSelector(rule.selector, scopeSelector, hostSelector);\n } else if (scopedAtRuleIdentifiers.some(atRule => rule.selector.startsWith(atRule))) {\n content = this._scopeSelectors(rule.content, scopeSelector, hostSelector);\n } else if (rule.selector.startsWith('@font-face') || rule.selector.startsWith('@page')) {\n content = this._stripScopingSelectors(rule.content);\n }\n return new CssRule(selector, content);\n });\n }\n /**\n * Handle a css text that is within a rule that should not contain scope selectors by simply\n * removing them! An example of such a rule is `@font-face`.\n *\n * `@font-face` rules cannot contain nested selectors. Nor can they be nested under a selector.\n * Normally this would be a syntax error by the author of the styles. But in some rare cases, such\n * as importing styles from a library, and applying `:host ::ng-deep` to the imported styles, we\n * can end up with broken css if the imported styles happen to contain @font-face rules.\n *\n * For example:\n *\n * ```\n * :host ::ng-deep {\n * import 'some/lib/containing/font-face';\n * }\n *\n * Similar logic applies to `@page` rules which can contain a particular set of properties,\n * as well as some specific at-rules. Since they can't be encapsulated, we have to strip\n * any scoping selectors from them. For more information: https://www.w3.org/TR/css-page-3\n * ```\n */\n _stripScopingSelectors(cssText) {\n return processRules(cssText, rule => {\n const selector = rule.selector.replace(_shadowDeepSelectors, ' ').replace(_polyfillHostNoCombinatorRe, ' ');\n return new CssRule(selector, rule.content);\n });\n }\n _scopeSelector(selector, scopeSelector, hostSelector) {\n return selector.split(/ ?, ?/).map(part => part.split(_shadowDeepSelectors)).map(deepParts => {\n const [shallowPart, ...otherParts] = deepParts;\n const applyScope = shallowPart => {\n if (this._selectorNeedsScoping(shallowPart, scopeSelector)) {\n return this._applySelectorScope(shallowPart, scopeSelector, hostSelector);\n } else {\n return shallowPart;\n }\n };\n return [applyScope(shallowPart), ...otherParts].join(' ');\n }).join(', ');\n }\n _selectorNeedsScoping(selector, scopeSelector) {\n const re = this._makeScopeMatcher(scopeSelector);\n return !re.test(selector);\n }\n _makeScopeMatcher(scopeSelector) {\n const lre = /\\[/g;\n const rre = /\\]/g;\n scopeSelector = scopeSelector.replace(lre, '\\\\[').replace(rre, '\\\\]');\n return new RegExp('^(' + scopeSelector + ')' + _selectorReSuffix, 'm');\n }\n // scope via name and [is=name]\n _applySimpleSelectorScope(selector, scopeSelector, hostSelector) {\n // In Android browser, the lastIndex is not reset when the regex is used in String.replace()\n _polyfillHostRe.lastIndex = 0;\n if (_polyfillHostRe.test(selector)) {\n const replaceBy = `[${hostSelector}]`;\n return selector.replace(_polyfillHostNoCombinatorRe, (hnc, selector) => {\n return selector.replace(/([^:]*)(:*)(.*)/, (_, before, colon, after) => {\n return before + replaceBy + colon + after;\n });\n }).replace(_polyfillHostRe, replaceBy + ' ');\n }\n return scopeSelector + ' ' + selector;\n }\n // return a selector with [name] suffix on each simple selector\n // e.g. .foo.bar > .zot becomes .foo[name].bar[name] > .zot[name] /** @internal */\n _applySelectorScope(selector, scopeSelector, hostSelector) {\n const isRe = /\\[is=([^\\]]*)\\]/g;\n scopeSelector = scopeSelector.replace(isRe, (_, ...parts) => parts[0]);\n const attrName = '[' + scopeSelector + ']';\n const _scopeSelectorPart = p => {\n let scopedP = p.trim();\n if (!scopedP) {\n return p;\n }\n if (p.includes(_polyfillHostNoCombinator)) {\n scopedP = this._applySimpleSelectorScope(p, scopeSelector, hostSelector);\n } else {\n // remove :host since it should be unnecessary\n const t = p.replace(_polyfillHostRe, '');\n if (t.length > 0) {\n const matches = t.match(/([^:]*)(:*)(.*)/);\n if (matches) {\n scopedP = matches[1] + attrName + matches[2] + matches[3];\n }\n }\n }\n return scopedP;\n };\n const safeContent = new SafeSelector(selector);\n selector = safeContent.content();\n let scopedSelector = '';\n let startIndex = 0;\n let res;\n const sep = /( |>|\\+|~(?!=))\\s*/g;\n // If a selector appears before :host it should not be shimmed as it\n // matches on ancestor elements and not on elements in the host's shadow\n // `:host-context(div)` is transformed to\n // `-shadowcsshost-no-combinatordiv, div -shadowcsshost-no-combinator`\n // the `div` is not part of the component in the 2nd selectors and should not be scoped.\n // Historically `component-tag:host` was matching the component so we also want to preserve\n // this behavior to avoid breaking legacy apps (it should not match).\n // The behavior should be:\n // - `tag:host` -> `tag[h]` (this is to avoid breaking legacy apps, should not match anything)\n // - `tag :host` -> `tag [h]` (`tag` is not scoped because it's considered part of a\n // `:host-context(tag)`)\n const hasHost = selector.includes(_polyfillHostNoCombinator);\n // Only scope parts after the first `-shadowcsshost-no-combinator` when it is present\n let shouldScope = !hasHost;\n while ((res = sep.exec(selector)) !== null) {\n const separator = res[1];\n // Do not trim the selector, as otherwise this will break sourcemaps\n // when they are defined on multiple lines\n // Example:\n // div,\n // p { color: red}\n const part = selector.slice(startIndex, res.index);\n // A space following an escaped hex value and followed by another hex character\n // (ie: \".\\fc ber\" for \".über\") is not a separator between 2 selectors\n // also keep in mind that backslashes are replaced by a placeholder by SafeSelector\n // These escaped selectors happen for example when esbuild runs with optimization.minify.\n if (part.match(/__esc-ph-(\\d+)__/) && selector[res.index + 1]?.match(/[a-fA-F\\d]/)) {\n continue;\n }\n shouldScope = shouldScope || part.includes(_polyfillHostNoCombinator);\n const scopedPart = shouldScope ? _scopeSelectorPart(part) : part;\n scopedSelector += `${scopedPart} ${separator} `;\n startIndex = sep.lastIndex;\n }\n const part = selector.substring(startIndex);\n shouldScope = shouldScope || part.includes(_polyfillHostNoCombinator);\n scopedSelector += shouldScope ? _scopeSelectorPart(part) : part;\n // replace the placeholders with their original values\n return safeContent.restore(scopedSelector);\n }\n _insertPolyfillHostInCssText(selector) {\n return selector.replace(_colonHostContextRe, _polyfillHostContext).replace(_colonHostRe, _polyfillHost);\n }\n}\nclass SafeSelector {\n constructor(selector) {\n this.placeholders = [];\n this.index = 0;\n // Replaces attribute selectors with placeholders.\n // The WS in [attr=\"va lue\"] would otherwise be interpreted as a selector separator.\n selector = this._escapeRegexMatches(selector, /(\\[[^\\]]*\\])/g);\n // CSS allows for certain special characters to be used in selectors if they're escaped.\n // E.g. `.foo:blue` won't match a class called `foo:blue`, because the colon denotes a\n // pseudo-class, but writing `.foo\\:blue` will match, because the colon was escaped.\n // Replace all escape sequences (`\\` followed by a character) with a placeholder so\n // that our handling of pseudo-selectors doesn't mess with them.\n // Escaped characters have a specific placeholder so they can be detected separately.\n selector = selector.replace(/(\\\\.)/g, (_, keep) => {\n const replaceBy = `__esc-ph-${this.index}__`;\n this.placeholders.push(keep);\n this.index++;\n return replaceBy;\n });\n // Replaces the expression in `:nth-child(2n + 1)` with a placeholder.\n // WS and \"+\" would otherwise be interpreted as selector separators.\n this._content = selector.replace(/(:nth-[-\\w]+)(\\([^)]+\\))/g, (_, pseudo, exp) => {\n const replaceBy = `__ph-${this.index}__`;\n this.placeholders.push(exp);\n this.index++;\n return pseudo + replaceBy;\n });\n }\n restore(content) {\n return content.replace(/__(?:ph|esc-ph)-(\\d+)__/g, (_ph, index) => this.placeholders[+index]);\n }\n content() {\n return this._content;\n }\n /**\n * Replaces all of the substrings that match a regex within a\n * special string (e.g. `__ph-0__`, `__ph-1__`, etc).\n */\n _escapeRegexMatches(content, pattern) {\n return content.replace(pattern, (_, keep) => {\n const replaceBy = `__ph-${this.index}__`;\n this.placeholders.push(keep);\n this.index++;\n return replaceBy;\n });\n }\n}\nconst _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\\s]*?(['\"])(.*?)\\1[;\\s]*}([^{]*?){/gim;\nconst _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\\s]*(['\"])(.*?)\\3)[;\\s]*[^}]*}/gim;\nconst _cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content:[\\s]*(['\"])(.*?)\\3)[;\\s]*[^}]*}/gim;\nconst _polyfillHost = '-shadowcsshost';\n// note: :host-context pre-processed to -shadowcsshostcontext.\nconst _polyfillHostContext = '-shadowcsscontext';\nconst _parenSuffix = '(?:\\\\((' + '(?:\\\\([^)(]*\\\\)|[^)(]*)+?' + ')\\\\))?([^,{]*)';\nconst _cssColonHostRe = new RegExp(_polyfillHost + _parenSuffix, 'gim');\nconst _cssColonHostContextReGlobal = new RegExp(_polyfillHostContext + _parenSuffix, 'gim');\nconst _cssColonHostContextRe = new RegExp(_polyfillHostContext + _parenSuffix, 'im');\nconst _polyfillHostNoCombinator = _polyfillHost + '-no-combinator';\nconst _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\\s]*)/;\nconst _shadowDOMSelectorsRe = [/::shadow/g, /::content/g,\n// Deprecated selectors\n/\\/shadow-deep\\//g, /\\/shadow\\//g];\n// The deep combinator is deprecated in the CSS spec\n// Support for `>>>`, `deep`, `::ng-deep` is then also deprecated and will be removed in the future.\n// see https://github.com/angular/angular/pull/17677\nconst _shadowDeepSelectors = /(?:>>>)|(?:\\/deep\\/)|(?:::ng-deep)/g;\nconst _selectorReSuffix = '([>\\\\s~+[.,{:][\\\\s\\\\S]*)?$';\nconst _polyfillHostRe = /-shadowcsshost/gim;\nconst _colonHostRe = /:host/gim;\nconst _colonHostContextRe = /:host-context/gim;\nconst _newLinesRe = /\\r?\\n/g;\nconst _commentRe = /\\/\\*[\\s\\S]*?\\*\\//g;\nconst _commentWithHashRe = /\\/\\*\\s*#\\s*source(Mapping)?URL=/g;\nconst COMMENT_PLACEHOLDER = '%COMMENT%';\nconst _commentWithHashPlaceHolderRe = new RegExp(COMMENT_PLACEHOLDER, 'g');\nconst BLOCK_PLACEHOLDER = '%BLOCK%';\nconst _ruleRe = new RegExp(`(\\\\s*(?:${COMMENT_PLACEHOLDER}\\\\s*)*)([^;\\\\{\\\\}]+?)(\\\\s*)((?:{%BLOCK%}?\\\\s*;?)|(?:\\\\s*;))`, 'g');\nconst CONTENT_PAIRS = new Map([['{', '}']]);\nconst COMMA_IN_PLACEHOLDER = '%COMMA_IN_PLACEHOLDER%';\nconst SEMI_IN_PLACEHOLDER = '%SEMI_IN_PLACEHOLDER%';\nconst COLON_IN_PLACEHOLDER = '%COLON_IN_PLACEHOLDER%';\nconst _cssCommaInPlaceholderReGlobal = new RegExp(COMMA_IN_PLACEHOLDER, 'g');\nconst _cssSemiInPlaceholderReGlobal = new RegExp(SEMI_IN_PLACEHOLDER, 'g');\nconst _cssColonInPlaceholderReGlobal = new RegExp(COLON_IN_PLACEHOLDER, 'g');\nclass CssRule {\n constructor(selector, content) {\n this.selector = selector;\n this.content = content;\n }\n}\nfunction processRules(input, ruleCallback) {\n const escaped = escapeInStrings(input);\n const inputWithEscapedBlocks = escapeBlocks(escaped, CONTENT_PAIRS, BLOCK_PLACEHOLDER);\n let nextBlockIndex = 0;\n const escapedResult = inputWithEscapedBlocks.escapedString.replace(_ruleRe, (...m) => {\n const selector = m[2];\n let content = '';\n let suffix = m[4];\n let contentPrefix = '';\n if (suffix && suffix.startsWith('{' + BLOCK_PLACEHOLDER)) {\n content = inputWithEscapedBlocks.blocks[nextBlockIndex++];\n suffix = suffix.substring(BLOCK_PLACEHOLDER.length + 1);\n contentPrefix = '{';\n }\n const rule = ruleCallback(new CssRule(selector, content));\n return `${m[1]}${rule.selector}${m[3]}${contentPrefix}${rule.content}${suffix}`;\n });\n return unescapeInStrings(escapedResult);\n}\nclass StringWithEscapedBlocks {\n constructor(escapedString, blocks) {\n this.escapedString = escapedString;\n this.blocks = blocks;\n }\n}\nfunction escapeBlocks(input, charPairs, placeholder) {\n const resultParts = [];\n const escapedBlocks = [];\n let openCharCount = 0;\n let nonBlockStartIndex = 0;\n let blockStartIndex = -1;\n let openChar;\n let closeChar;\n for (let i = 0; i < input.length; i++) {\n const char = input[i];\n if (char === '\\\\') {\n i++;\n } else if (char === closeChar) {\n openCharCount--;\n if (openCharCount === 0) {\n escapedBlocks.push(input.substring(blockStartIndex, i));\n resultParts.push(placeholder);\n nonBlockStartIndex = i;\n blockStartIndex = -1;\n openChar = closeChar = undefined;\n }\n } else if (char === openChar) {\n openCharCount++;\n } else if (openCharCount === 0 && charPairs.has(char)) {\n openChar = char;\n closeChar = charPairs.get(char);\n openCharCount = 1;\n blockStartIndex = i + 1;\n resultParts.push(input.substring(nonBlockStartIndex, blockStartIndex));\n }\n }\n if (blockStartIndex !== -1) {\n escapedBlocks.push(input.substring(blockStartIndex));\n resultParts.push(placeholder);\n } else {\n resultParts.push(input.substring(nonBlockStartIndex));\n }\n return new StringWithEscapedBlocks(resultParts.join(''), escapedBlocks);\n}\n/**\n * Object containing as keys characters that should be substituted by placeholders\n * when found in strings during the css text parsing, and as values the respective\n * placeholders\n */\nconst ESCAPE_IN_STRING_MAP = {\n ';': SEMI_IN_PLACEHOLDER,\n ',': COMMA_IN_PLACEHOLDER,\n ':': COLON_IN_PLACEHOLDER\n};\n/**\n * Parse the provided css text and inside strings (meaning, inside pairs of unescaped single or\n * double quotes) replace specific characters with their respective placeholders as indicated\n * by the `ESCAPE_IN_STRING_MAP` map.\n *\n * For example convert the text\n * `animation: \"my-anim:at\\\"ion\" 1s;`\n * to\n * `animation: \"my-anim%COLON_IN_PLACEHOLDER%at\\\"ion\" 1s;`\n *\n * This is necessary in order to remove the meaning of some characters when found inside strings\n * (for example `;` indicates the end of a css declaration, `,` the sequence of values and `:` the\n * division between property and value during a declaration, none of these meanings apply when such\n * characters are within strings and so in order to prevent parsing issues they need to be replaced\n * with placeholder text for the duration of the css manipulation process).\n *\n * @param input the original css text.\n *\n * @returns the css text with specific characters in strings replaced by placeholders.\n **/\nfunction escapeInStrings(input) {\n let result = input;\n let currentQuoteChar = null;\n for (let i = 0; i < result.length; i++) {\n const char = result[i];\n if (char === '\\\\') {\n i++;\n } else {\n if (currentQuoteChar !== null) {\n // index i is inside a quoted sub-string\n if (char === currentQuoteChar) {\n currentQuoteChar = null;\n } else {\n const placeholder = ESCAPE_IN_STRING_MAP[char];\n if (placeholder) {\n result = `${result.substr(0, i)}${placeholder}${result.substr(i + 1)}`;\n i += placeholder.length - 1;\n }\n }\n } else if (char === \"'\" || char === '\"') {\n currentQuoteChar = char;\n }\n }\n }\n return result;\n}\n/**\n * Replace in a string all occurrences of keys in the `ESCAPE_IN_STRING_MAP` map with their\n * original representation, this is simply used to revert the changes applied by the\n * escapeInStrings function.\n *\n * For example it reverts the text:\n * `animation: \"my-anim%COLON_IN_PLACEHOLDER%at\\\"ion\" 1s;`\n * to it's original form of:\n * `animation: \"my-anim:at\\\"ion\" 1s;`\n *\n * Note: For the sake of simplicity this function does not check that the placeholders are\n * actually inside strings as it would anyway be extremely unlikely to find them outside of strings.\n *\n * @param input the css text containing the placeholders.\n *\n * @returns the css text without the placeholders.\n */\nfunction unescapeInStrings(input) {\n let result = input.replace(_cssCommaInPlaceholderReGlobal, ',');\n result = result.replace(_cssSemiInPlaceholderReGlobal, ';');\n result = result.replace(_cssColonInPlaceholderReGlobal, ':');\n return result;\n}\n/**\n * Unescape all quotes present in a string, but only if the string was actually already\n * quoted.\n *\n * This generates a \"canonical\" representation of strings which can be used to match strings\n * which would otherwise only differ because of differently escaped quotes.\n *\n * For example it converts the string (assumed to be quoted):\n * `this \\\\\"is\\\\\" a \\\\'\\\\\\\\'test`\n * to:\n * `this \"is\" a '\\\\\\\\'test`\n * (note that the latter backslashes are not removed as they are not actually escaping the single\n * quote)\n *\n *\n * @param input the string possibly containing escaped quotes.\n * @param isQuoted boolean indicating whether the string was quoted inside a bigger string (if not\n * then it means that it doesn't represent an inner string and thus no unescaping is required)\n *\n * @returns the string in the \"canonical\" representation without escaped quotes.\n */\nfunction unescapeQuotes(str, isQuoted) {\n return !isQuoted ? str : str.replace(/((?:^|[^\\\\])(?:\\\\\\\\)*)\\\\(?=['\"])/g, '$1');\n}\n/**\n * Combine the `contextSelectors` with the `hostMarker` and the `otherSelectors`\n * to create a selector that matches the same as `:host-context()`.\n *\n * Given a single context selector `A` we need to output selectors that match on the host and as an\n * ancestor of the host:\n *\n * ```\n * A , A {}\n * ```\n *\n * When there is more than one context selector we also have to create combinations of those\n * selectors with each other. For example if there are `A` and `B` selectors the output is:\n *\n * ```\n * AB, AB , A B,\n * B A, A B , B A {}\n * ```\n *\n * And so on...\n *\n * @param contextSelectors an array of context selectors that will be combined.\n * @param otherSelectors the rest of the selectors that are not context selectors.\n */\nfunction combineHostContextSelectors(contextSelectors, otherSelectors) {\n const hostMarker = _polyfillHostNoCombinator;\n _polyfillHostRe.lastIndex = 0; // reset the regex to ensure we get an accurate test\n const otherSelectorsHasHost = _polyfillHostRe.test(otherSelectors);\n // If there are no context selectors then just output a host marker\n if (contextSelectors.length === 0) {\n return hostMarker + otherSelectors;\n }\n const combined = [contextSelectors.pop() || ''];\n while (contextSelectors.length > 0) {\n const length = combined.length;\n const contextSelector = contextSelectors.pop();\n for (let i = 0; i < length; i++) {\n const previousSelectors = combined[i];\n // Add the new selector as a descendant of the previous selectors\n combined[length * 2 + i] = previousSelectors + ' ' + contextSelector;\n // Add the new selector as an ancestor of the previous selectors\n combined[length + i] = contextSelector + ' ' + previousSelectors;\n // Add the new selector to act on the same element as the previous selectors\n combined[i] = contextSelector + previousSelectors;\n }\n }\n // Finally connect the selector to the `hostMarker`s: either acting directly on the host\n // (A) or as an ancestor (A ).\n return combined.map(s => otherSelectorsHasHost ? `${s}${otherSelectors}` : `${s}${hostMarker}${otherSelectors}, ${s} ${hostMarker}${otherSelectors}`).join(',');\n}\n/**\n * Mutate the given `groups` array so that there are `multiples` clones of the original array\n * stored.\n *\n * For example `repeatGroups([a, b], 3)` will result in `[a, b, a, b, a, b]` - but importantly the\n * newly added groups will be clones of the original.\n *\n * @param groups An array of groups of strings that will be repeated. This array is mutated\n * in-place.\n * @param multiples The number of times the current groups should appear.\n */\nfunction repeatGroups(groups, multiples) {\n const length = groups.length;\n for (let i = 1; i < multiples; i++) {\n for (let j = 0; j < length; j++) {\n groups[j + i * length] = groups[j].slice(0);\n }\n }\n}\n\n/**\n * Distinguishes different kinds of IR operations.\n *\n * Includes both creation and update operations.\n */\nvar OpKind;\n(function (OpKind) {\n /**\n * A special operation type which is used to represent the beginning and end nodes of a linked\n * list of operations.\n */\n OpKind[OpKind[\"ListEnd\"] = 0] = \"ListEnd\";\n /**\n * An operation which wraps an output AST statement.\n */\n OpKind[OpKind[\"Statement\"] = 1] = \"Statement\";\n /**\n * An operation which declares and initializes a `SemanticVariable`.\n */\n OpKind[OpKind[\"Variable\"] = 2] = \"Variable\";\n /**\n * An operation to begin rendering of an element.\n */\n OpKind[OpKind[\"ElementStart\"] = 3] = \"ElementStart\";\n /**\n * An operation to render an element with no children.\n */\n OpKind[OpKind[\"Element\"] = 4] = \"Element\";\n /**\n * An operation which declares an embedded view.\n */\n OpKind[OpKind[\"Template\"] = 5] = \"Template\";\n /**\n * An operation to end rendering of an element previously started with `ElementStart`.\n */\n OpKind[OpKind[\"ElementEnd\"] = 6] = \"ElementEnd\";\n /**\n * An operation to begin an `ng-container`.\n */\n OpKind[OpKind[\"ContainerStart\"] = 7] = \"ContainerStart\";\n /**\n * An operation for an `ng-container` with no children.\n */\n OpKind[OpKind[\"Container\"] = 8] = \"Container\";\n /**\n * An operation to end an `ng-container`.\n */\n OpKind[OpKind[\"ContainerEnd\"] = 9] = \"ContainerEnd\";\n /**\n * An operation disable binding for subsequent elements, which are descendants of a non-bindable\n * node.\n */\n OpKind[OpKind[\"DisableBindings\"] = 10] = \"DisableBindings\";\n /**\n * An op to conditionally render a template.\n */\n OpKind[OpKind[\"Conditional\"] = 11] = \"Conditional\";\n /**\n * An operation to re-enable binding, after it was previously disabled.\n */\n OpKind[OpKind[\"EnableBindings\"] = 12] = \"EnableBindings\";\n /**\n * An operation to render a text node.\n */\n OpKind[OpKind[\"Text\"] = 13] = \"Text\";\n /**\n * An operation declaring an event listener for an element.\n */\n OpKind[OpKind[\"Listener\"] = 14] = \"Listener\";\n /**\n * An operation to interpolate text into a text node.\n */\n OpKind[OpKind[\"InterpolateText\"] = 15] = \"InterpolateText\";\n /**\n * An intermediate binding op, that has not yet been processed into an individual property,\n * attribute, style, etc.\n */\n OpKind[OpKind[\"Binding\"] = 16] = \"Binding\";\n /**\n * An operation to bind an expression to a property of an element.\n */\n OpKind[OpKind[\"Property\"] = 17] = \"Property\";\n /**\n * An operation to bind an expression to a style property of an element.\n */\n OpKind[OpKind[\"StyleProp\"] = 18] = \"StyleProp\";\n /**\n * An operation to bind an expression to a class property of an element.\n */\n OpKind[OpKind[\"ClassProp\"] = 19] = \"ClassProp\";\n /**\n * An operation to bind an expression to the styles of an element.\n */\n OpKind[OpKind[\"StyleMap\"] = 20] = \"StyleMap\";\n /**\n * An operation to bind an expression to the classes of an element.\n */\n OpKind[OpKind[\"ClassMap\"] = 21] = \"ClassMap\";\n /**\n * An operation to advance the runtime's implicit slot context during the update phase of a view.\n */\n OpKind[OpKind[\"Advance\"] = 22] = \"Advance\";\n /**\n * An operation to instantiate a pipe.\n */\n OpKind[OpKind[\"Pipe\"] = 23] = \"Pipe\";\n /**\n * An operation to associate an attribute with an element.\n */\n OpKind[OpKind[\"Attribute\"] = 24] = \"Attribute\";\n /**\n * An attribute that has been extracted for inclusion in the consts array.\n */\n OpKind[OpKind[\"ExtractedAttribute\"] = 25] = \"ExtractedAttribute\";\n /**\n * An operation that configures a `@defer` block.\n */\n OpKind[OpKind[\"Defer\"] = 26] = \"Defer\";\n /**\n * An operation that controls when a `@defer` loads.\n */\n OpKind[OpKind[\"DeferOn\"] = 27] = \"DeferOn\";\n /**\n * An operation that controls when a `@defer` loads, using a custom expression as the condition.\n */\n OpKind[OpKind[\"DeferWhen\"] = 28] = \"DeferWhen\";\n /**\n * An i18n message that has been extracted for inclusion in the consts array.\n */\n OpKind[OpKind[\"I18nMessage\"] = 29] = \"I18nMessage\";\n /**\n * A host binding property.\n */\n OpKind[OpKind[\"HostProperty\"] = 30] = \"HostProperty\";\n /**\n * A namespace change, which causes the subsequent elements to be processed as either HTML or SVG.\n */\n OpKind[OpKind[\"Namespace\"] = 31] = \"Namespace\";\n /**\n * Configure a content projeciton definition for the view.\n */\n OpKind[OpKind[\"ProjectionDef\"] = 32] = \"ProjectionDef\";\n /**\n * Create a content projection slot.\n */\n OpKind[OpKind[\"Projection\"] = 33] = \"Projection\";\n /**\n * Create a repeater creation instruction op.\n */\n OpKind[OpKind[\"RepeaterCreate\"] = 34] = \"RepeaterCreate\";\n /**\n * An update up for a repeater.\n */\n OpKind[OpKind[\"Repeater\"] = 35] = \"Repeater\";\n /**\n * An operation to bind an expression to the property side of a two-way binding.\n */\n OpKind[OpKind[\"TwoWayProperty\"] = 36] = \"TwoWayProperty\";\n /**\n * An operation declaring the event side of a two-way binding.\n */\n OpKind[OpKind[\"TwoWayListener\"] = 37] = \"TwoWayListener\";\n /**\n * A creation-time operation that initializes the slot for a `@let` declaration.\n */\n OpKind[OpKind[\"DeclareLet\"] = 38] = \"DeclareLet\";\n /**\n * An update-time operation that stores the current value of a `@let` declaration.\n */\n OpKind[OpKind[\"StoreLet\"] = 39] = \"StoreLet\";\n /**\n * The start of an i18n block.\n */\n OpKind[OpKind[\"I18nStart\"] = 40] = \"I18nStart\";\n /**\n * A self-closing i18n on a single element.\n */\n OpKind[OpKind[\"I18n\"] = 41] = \"I18n\";\n /**\n * The end of an i18n block.\n */\n OpKind[OpKind[\"I18nEnd\"] = 42] = \"I18nEnd\";\n /**\n * An expression in an i18n message.\n */\n OpKind[OpKind[\"I18nExpression\"] = 43] = \"I18nExpression\";\n /**\n * An instruction that applies a set of i18n expressions.\n */\n OpKind[OpKind[\"I18nApply\"] = 44] = \"I18nApply\";\n /**\n * An instruction to create an ICU expression.\n */\n OpKind[OpKind[\"IcuStart\"] = 45] = \"IcuStart\";\n /**\n * An instruction to update an ICU expression.\n */\n OpKind[OpKind[\"IcuEnd\"] = 46] = \"IcuEnd\";\n /**\n * An instruction representing a placeholder in an ICU expression.\n */\n OpKind[OpKind[\"IcuPlaceholder\"] = 47] = \"IcuPlaceholder\";\n /**\n * An i18n context containing information needed to generate an i18n message.\n */\n OpKind[OpKind[\"I18nContext\"] = 48] = \"I18nContext\";\n /**\n * A creation op that corresponds to i18n attributes on an element.\n */\n OpKind[OpKind[\"I18nAttributes\"] = 49] = \"I18nAttributes\";\n})(OpKind || (OpKind = {}));\n/**\n * Distinguishes different kinds of IR expressions.\n */\nvar ExpressionKind;\n(function (ExpressionKind) {\n /**\n * Read of a variable in a lexical scope.\n */\n ExpressionKind[ExpressionKind[\"LexicalRead\"] = 0] = \"LexicalRead\";\n /**\n * A reference to the current view context.\n */\n ExpressionKind[ExpressionKind[\"Context\"] = 1] = \"Context\";\n /**\n * A reference to the view context, for use inside a track function.\n */\n ExpressionKind[ExpressionKind[\"TrackContext\"] = 2] = \"TrackContext\";\n /**\n * Read of a variable declared in a `VariableOp`.\n */\n ExpressionKind[ExpressionKind[\"ReadVariable\"] = 3] = \"ReadVariable\";\n /**\n * Runtime operation to navigate to the next view context in the view hierarchy.\n */\n ExpressionKind[ExpressionKind[\"NextContext\"] = 4] = \"NextContext\";\n /**\n * Runtime operation to retrieve the value of a local reference.\n */\n ExpressionKind[ExpressionKind[\"Reference\"] = 5] = \"Reference\";\n /**\n * A call storing the value of a `@let` declaration.\n */\n ExpressionKind[ExpressionKind[\"StoreLet\"] = 6] = \"StoreLet\";\n /**\n * A reference to a `@let` declaration read from the context view.\n */\n ExpressionKind[ExpressionKind[\"ContextLetReference\"] = 7] = \"ContextLetReference\";\n /**\n * Runtime operation to snapshot the current view context.\n */\n ExpressionKind[ExpressionKind[\"GetCurrentView\"] = 8] = \"GetCurrentView\";\n /**\n * Runtime operation to restore a snapshotted view.\n */\n ExpressionKind[ExpressionKind[\"RestoreView\"] = 9] = \"RestoreView\";\n /**\n * Runtime operation to reset the current view context after `RestoreView`.\n */\n ExpressionKind[ExpressionKind[\"ResetView\"] = 10] = \"ResetView\";\n /**\n * Defines and calls a function with change-detected arguments.\n */\n ExpressionKind[ExpressionKind[\"PureFunctionExpr\"] = 11] = \"PureFunctionExpr\";\n /**\n * Indicates a positional parameter to a pure function definition.\n */\n ExpressionKind[ExpressionKind[\"PureFunctionParameterExpr\"] = 12] = \"PureFunctionParameterExpr\";\n /**\n * Binding to a pipe transformation.\n */\n ExpressionKind[ExpressionKind[\"PipeBinding\"] = 13] = \"PipeBinding\";\n /**\n * Binding to a pipe transformation with a variable number of arguments.\n */\n ExpressionKind[ExpressionKind[\"PipeBindingVariadic\"] = 14] = \"PipeBindingVariadic\";\n /*\n * A safe property read requiring expansion into a null check.\n */\n ExpressionKind[ExpressionKind[\"SafePropertyRead\"] = 15] = \"SafePropertyRead\";\n /**\n * A safe keyed read requiring expansion into a null check.\n */\n ExpressionKind[ExpressionKind[\"SafeKeyedRead\"] = 16] = \"SafeKeyedRead\";\n /**\n * A safe function call requiring expansion into a null check.\n */\n ExpressionKind[ExpressionKind[\"SafeInvokeFunction\"] = 17] = \"SafeInvokeFunction\";\n /**\n * An intermediate expression that will be expanded from a safe read into an explicit ternary.\n */\n ExpressionKind[ExpressionKind[\"SafeTernaryExpr\"] = 18] = \"SafeTernaryExpr\";\n /**\n * An empty expression that will be stipped before generating the final output.\n */\n ExpressionKind[ExpressionKind[\"EmptyExpr\"] = 19] = \"EmptyExpr\";\n /*\n * An assignment to a temporary variable.\n */\n ExpressionKind[ExpressionKind[\"AssignTemporaryExpr\"] = 20] = \"AssignTemporaryExpr\";\n /**\n * A reference to a temporary variable.\n */\n ExpressionKind[ExpressionKind[\"ReadTemporaryExpr\"] = 21] = \"ReadTemporaryExpr\";\n /**\n * An expression that will cause a literal slot index to be emitted.\n */\n ExpressionKind[ExpressionKind[\"SlotLiteralExpr\"] = 22] = \"SlotLiteralExpr\";\n /**\n * A test expression for a conditional op.\n */\n ExpressionKind[ExpressionKind[\"ConditionalCase\"] = 23] = \"ConditionalCase\";\n /**\n * An expression that will be automatically extracted to the component const array.\n */\n ExpressionKind[ExpressionKind[\"ConstCollected\"] = 24] = \"ConstCollected\";\n /**\n * Operation that sets the value of a two-way binding.\n */\n ExpressionKind[ExpressionKind[\"TwoWayBindingSet\"] = 25] = \"TwoWayBindingSet\";\n})(ExpressionKind || (ExpressionKind = {}));\nvar VariableFlags;\n(function (VariableFlags) {\n VariableFlags[VariableFlags[\"None\"] = 0] = \"None\";\n /**\n * Always inline this variable, regardless of the number of times it's used.\n * An `AlwaysInline` variable may not depend on context, because doing so may cause side effects\n * that are illegal when multi-inlined. (The optimizer will enforce this constraint.)\n */\n VariableFlags[VariableFlags[\"AlwaysInline\"] = 1] = \"AlwaysInline\";\n})(VariableFlags || (VariableFlags = {}));\n/**\n * Distinguishes between different kinds of `SemanticVariable`s.\n */\nvar SemanticVariableKind;\n(function (SemanticVariableKind) {\n /**\n * Represents the context of a particular view.\n */\n SemanticVariableKind[SemanticVariableKind[\"Context\"] = 0] = \"Context\";\n /**\n * Represents an identifier declared in the lexical scope of a view.\n */\n SemanticVariableKind[SemanticVariableKind[\"Identifier\"] = 1] = \"Identifier\";\n /**\n * Represents a saved state that can be used to restore a view in a listener handler function.\n */\n SemanticVariableKind[SemanticVariableKind[\"SavedView\"] = 2] = \"SavedView\";\n /**\n * An alias generated by a special embedded view type (e.g. a `@for` block).\n */\n SemanticVariableKind[SemanticVariableKind[\"Alias\"] = 3] = \"Alias\";\n})(SemanticVariableKind || (SemanticVariableKind = {}));\n/**\n * Whether to compile in compatibilty mode. In compatibility mode, the template pipeline will\n * attempt to match the output of `TemplateDefinitionBuilder` as exactly as possible, at the cost\n * of producing quirky or larger code in some cases.\n */\nvar CompatibilityMode;\n(function (CompatibilityMode) {\n CompatibilityMode[CompatibilityMode[\"Normal\"] = 0] = \"Normal\";\n CompatibilityMode[CompatibilityMode[\"TemplateDefinitionBuilder\"] = 1] = \"TemplateDefinitionBuilder\";\n})(CompatibilityMode || (CompatibilityMode = {}));\n/**\n * Enumeration of the types of attributes which can be applied to an element.\n */\nvar BindingKind;\n(function (BindingKind) {\n /**\n * Static attributes.\n */\n BindingKind[BindingKind[\"Attribute\"] = 0] = \"Attribute\";\n /**\n * Class bindings.\n */\n BindingKind[BindingKind[\"ClassName\"] = 1] = \"ClassName\";\n /**\n * Style bindings.\n */\n BindingKind[BindingKind[\"StyleProperty\"] = 2] = \"StyleProperty\";\n /**\n * Dynamic property bindings.\n */\n BindingKind[BindingKind[\"Property\"] = 3] = \"Property\";\n /**\n * Property or attribute bindings on a template.\n */\n BindingKind[BindingKind[\"Template\"] = 4] = \"Template\";\n /**\n * Internationalized attributes.\n */\n BindingKind[BindingKind[\"I18n\"] = 5] = \"I18n\";\n /**\n * Animation property bindings.\n */\n BindingKind[BindingKind[\"Animation\"] = 6] = \"Animation\";\n /**\n * Property side of a two-way binding.\n */\n BindingKind[BindingKind[\"TwoWayProperty\"] = 7] = \"TwoWayProperty\";\n})(BindingKind || (BindingKind = {}));\n/**\n * Enumeration of possible times i18n params can be resolved.\n */\nvar I18nParamResolutionTime;\n(function (I18nParamResolutionTime) {\n /**\n * Param is resolved at message creation time. Most params should be resolved at message creation\n * time. However, ICU params need to be handled in post-processing.\n */\n I18nParamResolutionTime[I18nParamResolutionTime[\"Creation\"] = 0] = \"Creation\";\n /**\n * Param is resolved during post-processing. This should be used for params whose value comes from\n * an ICU.\n */\n I18nParamResolutionTime[I18nParamResolutionTime[\"Postproccessing\"] = 1] = \"Postproccessing\";\n})(I18nParamResolutionTime || (I18nParamResolutionTime = {}));\n/**\n * The contexts in which an i18n expression can be used.\n */\nvar I18nExpressionFor;\n(function (I18nExpressionFor) {\n /**\n * This expression is used as a value (i.e. inside an i18n block).\n */\n I18nExpressionFor[I18nExpressionFor[\"I18nText\"] = 0] = \"I18nText\";\n /**\n * This expression is used in a binding.\n */\n I18nExpressionFor[I18nExpressionFor[\"I18nAttribute\"] = 1] = \"I18nAttribute\";\n})(I18nExpressionFor || (I18nExpressionFor = {}));\n/**\n * Flags that describe what an i18n param value. These determine how the value is serialized into\n * the final map.\n */\nvar I18nParamValueFlags;\n(function (I18nParamValueFlags) {\n I18nParamValueFlags[I18nParamValueFlags[\"None\"] = 0] = \"None\";\n /**\n * This value represents an element tag.\n */\n I18nParamValueFlags[I18nParamValueFlags[\"ElementTag\"] = 1] = \"ElementTag\";\n /**\n * This value represents a template tag.\n */\n I18nParamValueFlags[I18nParamValueFlags[\"TemplateTag\"] = 2] = \"TemplateTag\";\n /**\n * This value represents the opening of a tag.\n */\n I18nParamValueFlags[I18nParamValueFlags[\"OpenTag\"] = 4] = \"OpenTag\";\n /**\n * This value represents the closing of a tag.\n */\n I18nParamValueFlags[I18nParamValueFlags[\"CloseTag\"] = 8] = \"CloseTag\";\n /**\n * This value represents an i18n expression index.\n */\n I18nParamValueFlags[I18nParamValueFlags[\"ExpressionIndex\"] = 16] = \"ExpressionIndex\";\n})(I18nParamValueFlags || (I18nParamValueFlags = {}));\n/**\n * Whether the active namespace is HTML, MathML, or SVG mode.\n */\nvar Namespace;\n(function (Namespace) {\n Namespace[Namespace[\"HTML\"] = 0] = \"HTML\";\n Namespace[Namespace[\"SVG\"] = 1] = \"SVG\";\n Namespace[Namespace[\"Math\"] = 2] = \"Math\";\n})(Namespace || (Namespace = {}));\n/**\n * The type of a `@defer` trigger, for use in the ir.\n */\nvar DeferTriggerKind;\n(function (DeferTriggerKind) {\n DeferTriggerKind[DeferTriggerKind[\"Idle\"] = 0] = \"Idle\";\n DeferTriggerKind[DeferTriggerKind[\"Immediate\"] = 1] = \"Immediate\";\n DeferTriggerKind[DeferTriggerKind[\"Timer\"] = 2] = \"Timer\";\n DeferTriggerKind[DeferTriggerKind[\"Hover\"] = 3] = \"Hover\";\n DeferTriggerKind[DeferTriggerKind[\"Interaction\"] = 4] = \"Interaction\";\n DeferTriggerKind[DeferTriggerKind[\"Viewport\"] = 5] = \"Viewport\";\n})(DeferTriggerKind || (DeferTriggerKind = {}));\n/**\n * Kinds of i18n contexts. They can be created because of root i18n blocks, or ICUs.\n */\nvar I18nContextKind;\n(function (I18nContextKind) {\n I18nContextKind[I18nContextKind[\"RootI18n\"] = 0] = \"RootI18n\";\n I18nContextKind[I18nContextKind[\"Icu\"] = 1] = \"Icu\";\n I18nContextKind[I18nContextKind[\"Attr\"] = 2] = \"Attr\";\n})(I18nContextKind || (I18nContextKind = {}));\nvar TemplateKind;\n(function (TemplateKind) {\n TemplateKind[TemplateKind[\"NgTemplate\"] = 0] = \"NgTemplate\";\n TemplateKind[TemplateKind[\"Structural\"] = 1] = \"Structural\";\n TemplateKind[TemplateKind[\"Block\"] = 2] = \"Block\";\n})(TemplateKind || (TemplateKind = {}));\n\n/**\n * Marker symbol for `ConsumesSlotOpTrait`.\n */\nconst ConsumesSlot = Symbol('ConsumesSlot');\n/**\n * Marker symbol for `DependsOnSlotContextOpTrait`.\n */\nconst DependsOnSlotContext = Symbol('DependsOnSlotContext');\n/**\n * Marker symbol for `ConsumesVars` trait.\n */\nconst ConsumesVarsTrait = Symbol('ConsumesVars');\n/**\n * Marker symbol for `UsesVarOffset` trait.\n */\nconst UsesVarOffset = Symbol('UsesVarOffset');\n/**\n * Default values for most `ConsumesSlotOpTrait` fields (used with the spread operator to initialize\n * implementors of the trait).\n */\nconst TRAIT_CONSUMES_SLOT = {\n [ConsumesSlot]: true,\n numSlotsUsed: 1\n};\n/**\n * Default values for most `DependsOnSlotContextOpTrait` fields (used with the spread operator to\n * initialize implementors of the trait).\n */\nconst TRAIT_DEPENDS_ON_SLOT_CONTEXT = {\n [DependsOnSlotContext]: true\n};\n/**\n * Default values for `UsesVars` fields (used with the spread operator to initialize\n * implementors of the trait).\n */\nconst TRAIT_CONSUMES_VARS = {\n [ConsumesVarsTrait]: true\n};\n/**\n * Test whether an operation implements `ConsumesSlotOpTrait`.\n */\nfunction hasConsumesSlotTrait(op) {\n return op[ConsumesSlot] === true;\n}\nfunction hasDependsOnSlotContextTrait(value) {\n return value[DependsOnSlotContext] === true;\n}\nfunction hasConsumesVarsTrait(value) {\n return value[ConsumesVarsTrait] === true;\n}\n/**\n * Test whether an expression implements `UsesVarOffsetTrait`.\n */\nfunction hasUsesVarOffsetTrait(expr) {\n return expr[UsesVarOffset] === true;\n}\n\n/**\n * Create a `StatementOp`.\n */\nfunction createStatementOp(statement) {\n return {\n kind: OpKind.Statement,\n statement,\n ...NEW_OP\n };\n}\n/**\n * Create a `VariableOp`.\n */\nfunction createVariableOp(xref, variable, initializer, flags) {\n return {\n kind: OpKind.Variable,\n xref,\n variable,\n initializer,\n flags,\n ...NEW_OP\n };\n}\n/**\n * Static structure shared by all operations.\n *\n * Used as a convenience via the spread operator (`...NEW_OP`) when creating new operations, and\n * ensures the fields are always in the same order.\n */\nconst NEW_OP = {\n debugListId: null,\n prev: null,\n next: null\n};\n\n/**\n * Create an `InterpolationTextOp`.\n */\nfunction createInterpolateTextOp(xref, interpolation, sourceSpan) {\n return {\n kind: OpKind.InterpolateText,\n target: xref,\n interpolation,\n sourceSpan,\n ...TRAIT_DEPENDS_ON_SLOT_CONTEXT,\n ...TRAIT_CONSUMES_VARS,\n ...NEW_OP\n };\n}\nclass Interpolation {\n constructor(strings, expressions, i18nPlaceholders) {\n this.strings = strings;\n this.expressions = expressions;\n this.i18nPlaceholders = i18nPlaceholders;\n if (i18nPlaceholders.length !== 0 && i18nPlaceholders.length !== expressions.length) {\n throw new Error(`Expected ${expressions.length} placeholders to match interpolation expression count, but got ${i18nPlaceholders.length}`);\n }\n }\n}\n/**\n * Create a `BindingOp`, not yet transformed into a particular type of binding.\n */\nfunction createBindingOp(target, kind, name, expression, unit, securityContext, isTextAttribute, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan) {\n return {\n kind: OpKind.Binding,\n bindingKind: kind,\n target,\n name,\n expression,\n unit,\n securityContext,\n isTextAttribute,\n isStructuralTemplateAttribute,\n templateKind,\n i18nContext: null,\n i18nMessage,\n sourceSpan,\n ...NEW_OP\n };\n}\n/**\n * Create a `PropertyOp`.\n */\nfunction createPropertyOp(target, name, expression, isAnimationTrigger, securityContext, isStructuralTemplateAttribute, templateKind, i18nContext, i18nMessage, sourceSpan) {\n return {\n kind: OpKind.Property,\n target,\n name,\n expression,\n isAnimationTrigger,\n securityContext,\n sanitizer: null,\n isStructuralTemplateAttribute,\n templateKind,\n i18nContext,\n i18nMessage,\n sourceSpan,\n ...TRAIT_DEPENDS_ON_SLOT_CONTEXT,\n ...TRAIT_CONSUMES_VARS,\n ...NEW_OP\n };\n}\n/**\n * Create a `TwoWayPropertyOp`.\n */\nfunction createTwoWayPropertyOp(target, name, expression, securityContext, isStructuralTemplateAttribute, templateKind, i18nContext, i18nMessage, sourceSpan) {\n return {\n kind: OpKind.TwoWayProperty,\n target,\n name,\n expression,\n securityContext,\n sanitizer: null,\n isStructuralTemplateAttribute,\n templateKind,\n i18nContext,\n i18nMessage,\n sourceSpan,\n ...TRAIT_DEPENDS_ON_SLOT_CONTEXT,\n ...TRAIT_CONSUMES_VARS,\n ...NEW_OP\n };\n}\n/** Create a `StylePropOp`. */\nfunction createStylePropOp(xref, name, expression, unit, sourceSpan) {\n return {\n kind: OpKind.StyleProp,\n target: xref,\n name,\n expression,\n unit,\n sourceSpan,\n ...TRAIT_DEPENDS_ON_SLOT_CONTEXT,\n ...TRAIT_CONSUMES_VARS,\n ...NEW_OP\n };\n}\n/**\n * Create a `ClassPropOp`.\n */\nfunction createClassPropOp(xref, name, expression, sourceSpan) {\n return {\n kind: OpKind.ClassProp,\n target: xref,\n name,\n expression,\n sourceSpan,\n ...TRAIT_DEPENDS_ON_SLOT_CONTEXT,\n ...TRAIT_CONSUMES_VARS,\n ...NEW_OP\n };\n}\n/** Create a `StyleMapOp`. */\nfunction createStyleMapOp(xref, expression, sourceSpan) {\n return {\n kind: OpKind.StyleMap,\n target: xref,\n expression,\n sourceSpan,\n ...TRAIT_DEPENDS_ON_SLOT_CONTEXT,\n ...TRAIT_CONSUMES_VARS,\n ...NEW_OP\n };\n}\n/**\n * Create a `ClassMapOp`.\n */\nfunction createClassMapOp(xref, expression, sourceSpan) {\n return {\n kind: OpKind.ClassMap,\n target: xref,\n expression,\n sourceSpan,\n ...TRAIT_DEPENDS_ON_SLOT_CONTEXT,\n ...TRAIT_CONSUMES_VARS,\n ...NEW_OP\n };\n}\n/**\n * Create an `AttributeOp`.\n */\nfunction createAttributeOp(target, namespace, name, expression, securityContext, isTextAttribute, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan) {\n return {\n kind: OpKind.Attribute,\n target,\n namespace,\n name,\n expression,\n securityContext,\n sanitizer: null,\n isTextAttribute,\n isStructuralTemplateAttribute,\n templateKind,\n i18nContext: null,\n i18nMessage,\n sourceSpan,\n ...TRAIT_DEPENDS_ON_SLOT_CONTEXT,\n ...TRAIT_CONSUMES_VARS,\n ...NEW_OP\n };\n}\n/**\n * Create an `AdvanceOp`.\n */\nfunction createAdvanceOp(delta, sourceSpan) {\n return {\n kind: OpKind.Advance,\n delta,\n sourceSpan,\n ...NEW_OP\n };\n}\n/**\n * Create a conditional op, which will display an embedded view according to a condtion.\n */\nfunction createConditionalOp(target, test, conditions, sourceSpan) {\n return {\n kind: OpKind.Conditional,\n target,\n test,\n conditions,\n processed: null,\n sourceSpan,\n contextValue: null,\n ...NEW_OP,\n ...TRAIT_DEPENDS_ON_SLOT_CONTEXT,\n ...TRAIT_CONSUMES_VARS\n };\n}\nfunction createRepeaterOp(repeaterCreate, targetSlot, collection, sourceSpan) {\n return {\n kind: OpKind.Repeater,\n target: repeaterCreate,\n targetSlot,\n collection,\n sourceSpan,\n ...NEW_OP,\n ...TRAIT_DEPENDS_ON_SLOT_CONTEXT\n };\n}\nfunction createDeferWhenOp(target, expr, prefetch, sourceSpan) {\n return {\n kind: OpKind.DeferWhen,\n target,\n expr,\n prefetch,\n sourceSpan,\n ...NEW_OP,\n ...TRAIT_DEPENDS_ON_SLOT_CONTEXT,\n ...TRAIT_CONSUMES_VARS\n };\n}\n/**\n * Create an i18n expression op.\n */\nfunction createI18nExpressionOp(context, target, i18nOwner, handle, expression, icuPlaceholder, i18nPlaceholder, resolutionTime, usage, name, sourceSpan) {\n return {\n kind: OpKind.I18nExpression,\n context,\n target,\n i18nOwner,\n handle,\n expression,\n icuPlaceholder,\n i18nPlaceholder,\n resolutionTime,\n usage,\n name,\n sourceSpan,\n ...NEW_OP,\n ...TRAIT_CONSUMES_VARS,\n ...TRAIT_DEPENDS_ON_SLOT_CONTEXT\n };\n}\n/**\n * Creates an op to apply i18n expression ops.\n */\nfunction createI18nApplyOp(owner, handle, sourceSpan) {\n return {\n kind: OpKind.I18nApply,\n owner,\n handle,\n sourceSpan,\n ...NEW_OP\n };\n}\n/**\n * Creates a `StoreLetOp`.\n */\nfunction createStoreLetOp(target, declaredName, value, sourceSpan) {\n return {\n kind: OpKind.StoreLet,\n target,\n declaredName,\n value,\n sourceSpan,\n ...TRAIT_DEPENDS_ON_SLOT_CONTEXT,\n ...TRAIT_CONSUMES_VARS,\n ...NEW_OP\n };\n}\nvar _a, _b, _c, _d, _e, _f, _g, _h;\n/**\n * Check whether a given `o.Expression` is a logical IR expression type.\n */\nfunction isIrExpression(expr) {\n return expr instanceof ExpressionBase;\n}\n/**\n * Base type used for all logical IR expressions.\n */\nclass ExpressionBase extends Expression {\n constructor(sourceSpan = null) {\n super(null, sourceSpan);\n }\n}\n/**\n * Logical expression representing a lexical read of a variable name.\n */\nclass LexicalReadExpr extends ExpressionBase {\n constructor(name) {\n super();\n this.name = name;\n this.kind = ExpressionKind.LexicalRead;\n }\n visitExpression(visitor, context) {}\n isEquivalent(other) {\n // We assume that the lexical reads are in the same context, which must be true for parent\n // expressions to be equivalent.\n // TODO: is this generally safe?\n return this.name === other.name;\n }\n isConstant() {\n return false;\n }\n transformInternalExpressions() {}\n clone() {\n return new LexicalReadExpr(this.name);\n }\n}\n/**\n * Runtime operation to retrieve the value of a local reference.\n */\nclass ReferenceExpr extends ExpressionBase {\n constructor(target, targetSlot, offset) {\n super();\n this.target = target;\n this.targetSlot = targetSlot;\n this.offset = offset;\n this.kind = ExpressionKind.Reference;\n }\n visitExpression() {}\n isEquivalent(e) {\n return e instanceof ReferenceExpr && e.target === this.target;\n }\n isConstant() {\n return false;\n }\n transformInternalExpressions() {}\n clone() {\n return new ReferenceExpr(this.target, this.targetSlot, this.offset);\n }\n}\nclass StoreLetExpr extends ExpressionBase {\n static {\n _a = ConsumesVarsTrait, _b = DependsOnSlotContext;\n }\n constructor(target, value, sourceSpan) {\n super();\n this.target = target;\n this.value = value;\n this.sourceSpan = sourceSpan;\n this.kind = ExpressionKind.StoreLet;\n this[_a] = true;\n this[_b] = true;\n }\n visitExpression() {}\n isEquivalent(e) {\n return e instanceof StoreLetExpr && e.target === this.target && e.value.isEquivalent(this.value);\n }\n isConstant() {\n return false;\n }\n transformInternalExpressions(transform, flags) {\n this.value = transformExpressionsInExpression(this.value, transform, flags);\n }\n clone() {\n return new StoreLetExpr(this.target, this.value, this.sourceSpan);\n }\n}\nclass ContextLetReferenceExpr extends ExpressionBase {\n constructor(target, targetSlot) {\n super();\n this.target = target;\n this.targetSlot = targetSlot;\n this.kind = ExpressionKind.ContextLetReference;\n }\n visitExpression() {}\n isEquivalent(e) {\n return e instanceof ContextLetReferenceExpr && e.target === this.target;\n }\n isConstant() {\n return false;\n }\n transformInternalExpressions() {}\n clone() {\n return new ContextLetReferenceExpr(this.target, this.targetSlot);\n }\n}\n/**\n * A reference to the current view context (usually the `ctx` variable in a template function).\n */\nclass ContextExpr extends ExpressionBase {\n constructor(view) {\n super();\n this.view = view;\n this.kind = ExpressionKind.Context;\n }\n visitExpression() {}\n isEquivalent(e) {\n return e instanceof ContextExpr && e.view === this.view;\n }\n isConstant() {\n return false;\n }\n transformInternalExpressions() {}\n clone() {\n return new ContextExpr(this.view);\n }\n}\n/**\n * A reference to the current view context inside a track function.\n */\nclass TrackContextExpr extends ExpressionBase {\n constructor(view) {\n super();\n this.view = view;\n this.kind = ExpressionKind.TrackContext;\n }\n visitExpression() {}\n isEquivalent(e) {\n return e instanceof TrackContextExpr && e.view === this.view;\n }\n isConstant() {\n return false;\n }\n transformInternalExpressions() {}\n clone() {\n return new TrackContextExpr(this.view);\n }\n}\n/**\n * Runtime operation to navigate to the next view context in the view hierarchy.\n */\nclass NextContextExpr extends ExpressionBase {\n constructor() {\n super();\n this.kind = ExpressionKind.NextContext;\n this.steps = 1;\n }\n visitExpression() {}\n isEquivalent(e) {\n return e instanceof NextContextExpr && e.steps === this.steps;\n }\n isConstant() {\n return false;\n }\n transformInternalExpressions() {}\n clone() {\n const expr = new NextContextExpr();\n expr.steps = this.steps;\n return expr;\n }\n}\n/**\n * Runtime operation to snapshot the current view context.\n *\n * The result of this operation can be stored in a variable and later used with the `RestoreView`\n * operation.\n */\nclass GetCurrentViewExpr extends ExpressionBase {\n constructor() {\n super();\n this.kind = ExpressionKind.GetCurrentView;\n }\n visitExpression() {}\n isEquivalent(e) {\n return e instanceof GetCurrentViewExpr;\n }\n isConstant() {\n return false;\n }\n transformInternalExpressions() {}\n clone() {\n return new GetCurrentViewExpr();\n }\n}\n/**\n * Runtime operation to restore a snapshotted view.\n */\nclass RestoreViewExpr extends ExpressionBase {\n constructor(view) {\n super();\n this.view = view;\n this.kind = ExpressionKind.RestoreView;\n }\n visitExpression(visitor, context) {\n if (typeof this.view !== 'number') {\n this.view.visitExpression(visitor, context);\n }\n }\n isEquivalent(e) {\n if (!(e instanceof RestoreViewExpr) || typeof e.view !== typeof this.view) {\n return false;\n }\n if (typeof this.view === 'number') {\n return this.view === e.view;\n } else {\n return this.view.isEquivalent(e.view);\n }\n }\n isConstant() {\n return false;\n }\n transformInternalExpressions(transform, flags) {\n if (typeof this.view !== 'number') {\n this.view = transformExpressionsInExpression(this.view, transform, flags);\n }\n }\n clone() {\n return new RestoreViewExpr(this.view instanceof Expression ? this.view.clone() : this.view);\n }\n}\n/**\n * Runtime operation to reset the current view context after `RestoreView`.\n */\nclass ResetViewExpr extends ExpressionBase {\n constructor(expr) {\n super();\n this.expr = expr;\n this.kind = ExpressionKind.ResetView;\n }\n visitExpression(visitor, context) {\n this.expr.visitExpression(visitor, context);\n }\n isEquivalent(e) {\n return e instanceof ResetViewExpr && this.expr.isEquivalent(e.expr);\n }\n isConstant() {\n return false;\n }\n transformInternalExpressions(transform, flags) {\n this.expr = transformExpressionsInExpression(this.expr, transform, flags);\n }\n clone() {\n return new ResetViewExpr(this.expr.clone());\n }\n}\nclass TwoWayBindingSetExpr extends ExpressionBase {\n constructor(target, value) {\n super();\n this.target = target;\n this.value = value;\n this.kind = ExpressionKind.TwoWayBindingSet;\n }\n visitExpression(visitor, context) {\n this.target.visitExpression(visitor, context);\n this.value.visitExpression(visitor, context);\n }\n isEquivalent(other) {\n return this.target.isEquivalent(other.target) && this.value.isEquivalent(other.value);\n }\n isConstant() {\n return false;\n }\n transformInternalExpressions(transform, flags) {\n this.target = transformExpressionsInExpression(this.target, transform, flags);\n this.value = transformExpressionsInExpression(this.value, transform, flags);\n }\n clone() {\n return new TwoWayBindingSetExpr(this.target, this.value);\n }\n}\n/**\n * Read of a variable declared as an `ir.VariableOp` and referenced through its `ir.XrefId`.\n */\nclass ReadVariableExpr extends ExpressionBase {\n constructor(xref) {\n super();\n this.xref = xref;\n this.kind = ExpressionKind.ReadVariable;\n this.name = null;\n }\n visitExpression() {}\n isEquivalent(other) {\n return other instanceof ReadVariableExpr && other.xref === this.xref;\n }\n isConstant() {\n return false;\n }\n transformInternalExpressions() {}\n clone() {\n const expr = new ReadVariableExpr(this.xref);\n expr.name = this.name;\n return expr;\n }\n}\nclass PureFunctionExpr extends ExpressionBase {\n static {\n _c = ConsumesVarsTrait, _d = UsesVarOffset;\n }\n constructor(expression, args) {\n super();\n this.kind = ExpressionKind.PureFunctionExpr;\n this[_c] = true;\n this[_d] = true;\n this.varOffset = null;\n /**\n * Once extracted to the `ConstantPool`, a reference to the function which defines the computation\n * of `body`.\n */\n this.fn = null;\n this.body = expression;\n this.args = args;\n }\n visitExpression(visitor, context) {\n this.body?.visitExpression(visitor, context);\n for (const arg of this.args) {\n arg.visitExpression(visitor, context);\n }\n }\n isEquivalent(other) {\n if (!(other instanceof PureFunctionExpr) || other.args.length !== this.args.length) {\n return false;\n }\n return other.body !== null && this.body !== null && other.body.isEquivalent(this.body) && other.args.every((arg, idx) => arg.isEquivalent(this.args[idx]));\n }\n isConstant() {\n return false;\n }\n transformInternalExpressions(transform, flags) {\n if (this.body !== null) {\n // TODO: figure out if this is the right flag to pass here.\n this.body = transformExpressionsInExpression(this.body, transform, flags | VisitorContextFlag.InChildOperation);\n } else if (this.fn !== null) {\n this.fn = transformExpressionsInExpression(this.fn, transform, flags);\n }\n for (let i = 0; i < this.args.length; i++) {\n this.args[i] = transformExpressionsInExpression(this.args[i], transform, flags);\n }\n }\n clone() {\n const expr = new PureFunctionExpr(this.body?.clone() ?? null, this.args.map(arg => arg.clone()));\n expr.fn = this.fn?.clone() ?? null;\n expr.varOffset = this.varOffset;\n return expr;\n }\n}\nclass PureFunctionParameterExpr extends ExpressionBase {\n constructor(index) {\n super();\n this.index = index;\n this.kind = ExpressionKind.PureFunctionParameterExpr;\n }\n visitExpression() {}\n isEquivalent(other) {\n return other instanceof PureFunctionParameterExpr && other.index === this.index;\n }\n isConstant() {\n return true;\n }\n transformInternalExpressions() {}\n clone() {\n return new PureFunctionParameterExpr(this.index);\n }\n}\nclass PipeBindingExpr extends ExpressionBase {\n static {\n _e = ConsumesVarsTrait, _f = UsesVarOffset;\n }\n constructor(target, targetSlot, name, args) {\n super();\n this.target = target;\n this.targetSlot = targetSlot;\n this.name = name;\n this.args = args;\n this.kind = ExpressionKind.PipeBinding;\n this[_e] = true;\n this[_f] = true;\n this.varOffset = null;\n }\n visitExpression(visitor, context) {\n for (const arg of this.args) {\n arg.visitExpression(visitor, context);\n }\n }\n isEquivalent() {\n return false;\n }\n isConstant() {\n return false;\n }\n transformInternalExpressions(transform, flags) {\n for (let idx = 0; idx < this.args.length; idx++) {\n this.args[idx] = transformExpressionsInExpression(this.args[idx], transform, flags);\n }\n }\n clone() {\n const r = new PipeBindingExpr(this.target, this.targetSlot, this.name, this.args.map(a => a.clone()));\n r.varOffset = this.varOffset;\n return r;\n }\n}\nclass PipeBindingVariadicExpr extends ExpressionBase {\n static {\n _g = ConsumesVarsTrait, _h = UsesVarOffset;\n }\n constructor(target, targetSlot, name, args, numArgs) {\n super();\n this.target = target;\n this.targetSlot = targetSlot;\n this.name = name;\n this.args = args;\n this.numArgs = numArgs;\n this.kind = ExpressionKind.PipeBindingVariadic;\n this[_g] = true;\n this[_h] = true;\n this.varOffset = null;\n }\n visitExpression(visitor, context) {\n this.args.visitExpression(visitor, context);\n }\n isEquivalent() {\n return false;\n }\n isConstant() {\n return false;\n }\n transformInternalExpressions(transform, flags) {\n this.args = transformExpressionsInExpression(this.args, transform, flags);\n }\n clone() {\n const r = new PipeBindingVariadicExpr(this.target, this.targetSlot, this.name, this.args.clone(), this.numArgs);\n r.varOffset = this.varOffset;\n return r;\n }\n}\nclass SafePropertyReadExpr extends ExpressionBase {\n constructor(receiver, name) {\n super();\n this.receiver = receiver;\n this.name = name;\n this.kind = ExpressionKind.SafePropertyRead;\n }\n // An alias for name, which allows other logic to handle property reads and keyed reads together.\n get index() {\n return this.name;\n }\n visitExpression(visitor, context) {\n this.receiver.visitExpression(visitor, context);\n }\n isEquivalent() {\n return false;\n }\n isConstant() {\n return false;\n }\n transformInternalExpressions(transform, flags) {\n this.receiver = transformExpressionsInExpression(this.receiver, transform, flags);\n }\n clone() {\n return new SafePropertyReadExpr(this.receiver.clone(), this.name);\n }\n}\nclass SafeKeyedReadExpr extends ExpressionBase {\n constructor(receiver, index, sourceSpan) {\n super(sourceSpan);\n this.receiver = receiver;\n this.index = index;\n this.kind = ExpressionKind.SafeKeyedRead;\n }\n visitExpression(visitor, context) {\n this.receiver.visitExpression(visitor, context);\n this.index.visitExpression(visitor, context);\n }\n isEquivalent() {\n return false;\n }\n isConstant() {\n return false;\n }\n transformInternalExpressions(transform, flags) {\n this.receiver = transformExpressionsInExpression(this.receiver, transform, flags);\n this.index = transformExpressionsInExpression(this.index, transform, flags);\n }\n clone() {\n return new SafeKeyedReadExpr(this.receiver.clone(), this.index.clone(), this.sourceSpan);\n }\n}\nclass SafeInvokeFunctionExpr extends ExpressionBase {\n constructor(receiver, args) {\n super();\n this.receiver = receiver;\n this.args = args;\n this.kind = ExpressionKind.SafeInvokeFunction;\n }\n visitExpression(visitor, context) {\n this.receiver.visitExpression(visitor, context);\n for (const a of this.args) {\n a.visitExpression(visitor, context);\n }\n }\n isEquivalent() {\n return false;\n }\n isConstant() {\n return false;\n }\n transformInternalExpressions(transform, flags) {\n this.receiver = transformExpressionsInExpression(this.receiver, transform, flags);\n for (let i = 0; i < this.args.length; i++) {\n this.args[i] = transformExpressionsInExpression(this.args[i], transform, flags);\n }\n }\n clone() {\n return new SafeInvokeFunctionExpr(this.receiver.clone(), this.args.map(a => a.clone()));\n }\n}\nclass SafeTernaryExpr extends ExpressionBase {\n constructor(guard, expr) {\n super();\n this.guard = guard;\n this.expr = expr;\n this.kind = ExpressionKind.SafeTernaryExpr;\n }\n visitExpression(visitor, context) {\n this.guard.visitExpression(visitor, context);\n this.expr.visitExpression(visitor, context);\n }\n isEquivalent() {\n return false;\n }\n isConstant() {\n return false;\n }\n transformInternalExpressions(transform, flags) {\n this.guard = transformExpressionsInExpression(this.guard, transform, flags);\n this.expr = transformExpressionsInExpression(this.expr, transform, flags);\n }\n clone() {\n return new SafeTernaryExpr(this.guard.clone(), this.expr.clone());\n }\n}\nclass EmptyExpr extends ExpressionBase {\n constructor() {\n super(...arguments);\n this.kind = ExpressionKind.EmptyExpr;\n }\n visitExpression(visitor, context) {}\n isEquivalent(e) {\n return e instanceof EmptyExpr;\n }\n isConstant() {\n return true;\n }\n clone() {\n return new EmptyExpr();\n }\n transformInternalExpressions() {}\n}\nclass AssignTemporaryExpr extends ExpressionBase {\n constructor(expr, xref) {\n super();\n this.expr = expr;\n this.xref = xref;\n this.kind = ExpressionKind.AssignTemporaryExpr;\n this.name = null;\n }\n visitExpression(visitor, context) {\n this.expr.visitExpression(visitor, context);\n }\n isEquivalent() {\n return false;\n }\n isConstant() {\n return false;\n }\n transformInternalExpressions(transform, flags) {\n this.expr = transformExpressionsInExpression(this.expr, transform, flags);\n }\n clone() {\n const a = new AssignTemporaryExpr(this.expr.clone(), this.xref);\n a.name = this.name;\n return a;\n }\n}\nclass ReadTemporaryExpr extends ExpressionBase {\n constructor(xref) {\n super();\n this.xref = xref;\n this.kind = ExpressionKind.ReadTemporaryExpr;\n this.name = null;\n }\n visitExpression(visitor, context) {}\n isEquivalent() {\n return this.xref === this.xref;\n }\n isConstant() {\n return false;\n }\n transformInternalExpressions(transform, flags) {}\n clone() {\n const r = new ReadTemporaryExpr(this.xref);\n r.name = this.name;\n return r;\n }\n}\nclass SlotLiteralExpr extends ExpressionBase {\n constructor(slot) {\n super();\n this.slot = slot;\n this.kind = ExpressionKind.SlotLiteralExpr;\n }\n visitExpression(visitor, context) {}\n isEquivalent(e) {\n return e instanceof SlotLiteralExpr && e.slot === this.slot;\n }\n isConstant() {\n return true;\n }\n clone() {\n return new SlotLiteralExpr(this.slot);\n }\n transformInternalExpressions() {}\n}\nclass ConditionalCaseExpr extends ExpressionBase {\n /**\n * Create an expression for one branch of a conditional.\n * @param expr The expression to be tested for this case. Might be null, as in an `else` case.\n * @param target The Xref of the view to be displayed if this condition is true.\n */\n constructor(expr, target, targetSlot, alias = null) {\n super();\n this.expr = expr;\n this.target = target;\n this.targetSlot = targetSlot;\n this.alias = alias;\n this.kind = ExpressionKind.ConditionalCase;\n }\n visitExpression(visitor, context) {\n if (this.expr !== null) {\n this.expr.visitExpression(visitor, context);\n }\n }\n isEquivalent(e) {\n return e instanceof ConditionalCaseExpr && e.expr === this.expr;\n }\n isConstant() {\n return true;\n }\n clone() {\n return new ConditionalCaseExpr(this.expr, this.target, this.targetSlot);\n }\n transformInternalExpressions(transform, flags) {\n if (this.expr !== null) {\n this.expr = transformExpressionsInExpression(this.expr, transform, flags);\n }\n }\n}\nclass ConstCollectedExpr extends ExpressionBase {\n constructor(expr) {\n super();\n this.expr = expr;\n this.kind = ExpressionKind.ConstCollected;\n }\n transformInternalExpressions(transform, flags) {\n this.expr = transform(this.expr, flags);\n }\n visitExpression(visitor, context) {\n this.expr.visitExpression(visitor, context);\n }\n isEquivalent(e) {\n if (!(e instanceof ConstCollectedExpr)) {\n return false;\n }\n return this.expr.isEquivalent(e.expr);\n }\n isConstant() {\n return this.expr.isConstant();\n }\n clone() {\n return new ConstCollectedExpr(this.expr);\n }\n}\n/**\n * Visits all `Expression`s in the AST of `op` with the `visitor` function.\n */\nfunction visitExpressionsInOp(op, visitor) {\n transformExpressionsInOp(op, (expr, flags) => {\n visitor(expr, flags);\n return expr;\n }, VisitorContextFlag.None);\n}\nvar VisitorContextFlag;\n(function (VisitorContextFlag) {\n VisitorContextFlag[VisitorContextFlag[\"None\"] = 0] = \"None\";\n VisitorContextFlag[VisitorContextFlag[\"InChildOperation\"] = 1] = \"InChildOperation\";\n})(VisitorContextFlag || (VisitorContextFlag = {}));\nfunction transformExpressionsInInterpolation(interpolation, transform, flags) {\n for (let i = 0; i < interpolation.expressions.length; i++) {\n interpolation.expressions[i] = transformExpressionsInExpression(interpolation.expressions[i], transform, flags);\n }\n}\n/**\n * Transform all `Expression`s in the AST of `op` with the `transform` function.\n *\n * All such operations will be replaced with the result of applying `transform`, which may be an\n * identity transformation.\n */\nfunction transformExpressionsInOp(op, transform, flags) {\n switch (op.kind) {\n case OpKind.StyleProp:\n case OpKind.StyleMap:\n case OpKind.ClassProp:\n case OpKind.ClassMap:\n case OpKind.Binding:\n if (op.expression instanceof Interpolation) {\n transformExpressionsInInterpolation(op.expression, transform, flags);\n } else {\n op.expression = transformExpressionsInExpression(op.expression, transform, flags);\n }\n break;\n case OpKind.Property:\n case OpKind.HostProperty:\n case OpKind.Attribute:\n if (op.expression instanceof Interpolation) {\n transformExpressionsInInterpolation(op.expression, transform, flags);\n } else {\n op.expression = transformExpressionsInExpression(op.expression, transform, flags);\n }\n op.sanitizer = op.sanitizer && transformExpressionsInExpression(op.sanitizer, transform, flags);\n break;\n case OpKind.TwoWayProperty:\n op.expression = transformExpressionsInExpression(op.expression, transform, flags);\n op.sanitizer = op.sanitizer && transformExpressionsInExpression(op.sanitizer, transform, flags);\n break;\n case OpKind.I18nExpression:\n op.expression = transformExpressionsInExpression(op.expression, transform, flags);\n break;\n case OpKind.InterpolateText:\n transformExpressionsInInterpolation(op.interpolation, transform, flags);\n break;\n case OpKind.Statement:\n transformExpressionsInStatement(op.statement, transform, flags);\n break;\n case OpKind.Variable:\n op.initializer = transformExpressionsInExpression(op.initializer, transform, flags);\n break;\n case OpKind.Conditional:\n for (const condition of op.conditions) {\n if (condition.expr === null) {\n // This is a default case.\n continue;\n }\n condition.expr = transformExpressionsInExpression(condition.expr, transform, flags);\n }\n if (op.processed !== null) {\n op.processed = transformExpressionsInExpression(op.processed, transform, flags);\n }\n if (op.contextValue !== null) {\n op.contextValue = transformExpressionsInExpression(op.contextValue, transform, flags);\n }\n break;\n case OpKind.Listener:\n case OpKind.TwoWayListener:\n for (const innerOp of op.handlerOps) {\n transformExpressionsInOp(innerOp, transform, flags | VisitorContextFlag.InChildOperation);\n }\n break;\n case OpKind.ExtractedAttribute:\n op.expression = op.expression && transformExpressionsInExpression(op.expression, transform, flags);\n op.trustedValueFn = op.trustedValueFn && transformExpressionsInExpression(op.trustedValueFn, transform, flags);\n break;\n case OpKind.RepeaterCreate:\n op.track = transformExpressionsInExpression(op.track, transform, flags);\n if (op.trackByFn !== null) {\n op.trackByFn = transformExpressionsInExpression(op.trackByFn, transform, flags);\n }\n break;\n case OpKind.Repeater:\n op.collection = transformExpressionsInExpression(op.collection, transform, flags);\n break;\n case OpKind.Defer:\n if (op.loadingConfig !== null) {\n op.loadingConfig = transformExpressionsInExpression(op.loadingConfig, transform, flags);\n }\n if (op.placeholderConfig !== null) {\n op.placeholderConfig = transformExpressionsInExpression(op.placeholderConfig, transform, flags);\n }\n if (op.resolverFn !== null) {\n op.resolverFn = transformExpressionsInExpression(op.resolverFn, transform, flags);\n }\n break;\n case OpKind.I18nMessage:\n for (const [placeholder, expr] of op.params) {\n op.params.set(placeholder, transformExpressionsInExpression(expr, transform, flags));\n }\n for (const [placeholder, expr] of op.postprocessingParams) {\n op.postprocessingParams.set(placeholder, transformExpressionsInExpression(expr, transform, flags));\n }\n break;\n case OpKind.DeferWhen:\n op.expr = transformExpressionsInExpression(op.expr, transform, flags);\n break;\n case OpKind.StoreLet:\n op.value = transformExpressionsInExpression(op.value, transform, flags);\n break;\n case OpKind.Advance:\n case OpKind.Container:\n case OpKind.ContainerEnd:\n case OpKind.ContainerStart:\n case OpKind.DeferOn:\n case OpKind.DisableBindings:\n case OpKind.Element:\n case OpKind.ElementEnd:\n case OpKind.ElementStart:\n case OpKind.EnableBindings:\n case OpKind.I18n:\n case OpKind.I18nApply:\n case OpKind.I18nContext:\n case OpKind.I18nEnd:\n case OpKind.I18nStart:\n case OpKind.IcuEnd:\n case OpKind.IcuStart:\n case OpKind.Namespace:\n case OpKind.Pipe:\n case OpKind.Projection:\n case OpKind.ProjectionDef:\n case OpKind.Template:\n case OpKind.Text:\n case OpKind.I18nAttributes:\n case OpKind.IcuPlaceholder:\n case OpKind.DeclareLet:\n // These operations contain no expressions.\n break;\n default:\n throw new Error(`AssertionError: transformExpressionsInOp doesn't handle ${OpKind[op.kind]}`);\n }\n}\n/**\n * Transform all `Expression`s in the AST of `expr` with the `transform` function.\n *\n * All such operations will be replaced with the result of applying `transform`, which may be an\n * identity transformation.\n */\nfunction transformExpressionsInExpression(expr, transform, flags) {\n if (expr instanceof ExpressionBase) {\n expr.transformInternalExpressions(transform, flags);\n } else if (expr instanceof BinaryOperatorExpr) {\n expr.lhs = transformExpressionsInExpression(expr.lhs, transform, flags);\n expr.rhs = transformExpressionsInExpression(expr.rhs, transform, flags);\n } else if (expr instanceof UnaryOperatorExpr) {\n expr.expr = transformExpressionsInExpression(expr.expr, transform, flags);\n } else if (expr instanceof ReadPropExpr) {\n expr.receiver = transformExpressionsInExpression(expr.receiver, transform, flags);\n } else if (expr instanceof ReadKeyExpr) {\n expr.receiver = transformExpressionsInExpression(expr.receiver, transform, flags);\n expr.index = transformExpressionsInExpression(expr.index, transform, flags);\n } else if (expr instanceof WritePropExpr) {\n expr.receiver = transformExpressionsInExpression(expr.receiver, transform, flags);\n expr.value = transformExpressionsInExpression(expr.value, transform, flags);\n } else if (expr instanceof WriteKeyExpr) {\n expr.receiver = transformExpressionsInExpression(expr.receiver, transform, flags);\n expr.index = transformExpressionsInExpression(expr.index, transform, flags);\n expr.value = transformExpressionsInExpression(expr.value, transform, flags);\n } else if (expr instanceof InvokeFunctionExpr) {\n expr.fn = transformExpressionsInExpression(expr.fn, transform, flags);\n for (let i = 0; i < expr.args.length; i++) {\n expr.args[i] = transformExpressionsInExpression(expr.args[i], transform, flags);\n }\n } else if (expr instanceof LiteralArrayExpr) {\n for (let i = 0; i < expr.entries.length; i++) {\n expr.entries[i] = transformExpressionsInExpression(expr.entries[i], transform, flags);\n }\n } else if (expr instanceof LiteralMapExpr) {\n for (let i = 0; i < expr.entries.length; i++) {\n expr.entries[i].value = transformExpressionsInExpression(expr.entries[i].value, transform, flags);\n }\n } else if (expr instanceof ConditionalExpr) {\n expr.condition = transformExpressionsInExpression(expr.condition, transform, flags);\n expr.trueCase = transformExpressionsInExpression(expr.trueCase, transform, flags);\n if (expr.falseCase !== null) {\n expr.falseCase = transformExpressionsInExpression(expr.falseCase, transform, flags);\n }\n } else if (expr instanceof TypeofExpr) {\n expr.expr = transformExpressionsInExpression(expr.expr, transform, flags);\n } else if (expr instanceof WriteVarExpr) {\n expr.value = transformExpressionsInExpression(expr.value, transform, flags);\n } else if (expr instanceof LocalizedString) {\n for (let i = 0; i < expr.expressions.length; i++) {\n expr.expressions[i] = transformExpressionsInExpression(expr.expressions[i], transform, flags);\n }\n } else if (expr instanceof NotExpr) {\n expr.condition = transformExpressionsInExpression(expr.condition, transform, flags);\n } else if (expr instanceof TaggedTemplateExpr) {\n expr.tag = transformExpressionsInExpression(expr.tag, transform, flags);\n expr.template.expressions = expr.template.expressions.map(e => transformExpressionsInExpression(e, transform, flags));\n } else if (expr instanceof ArrowFunctionExpr) {\n if (Array.isArray(expr.body)) {\n for (let i = 0; i < expr.body.length; i++) {\n transformExpressionsInStatement(expr.body[i], transform, flags);\n }\n } else {\n expr.body = transformExpressionsInExpression(expr.body, transform, flags);\n }\n } else if (expr instanceof WrappedNodeExpr) {\n // TODO: Do we need to transform any TS nodes nested inside of this expression?\n } else if (expr instanceof ReadVarExpr || expr instanceof ExternalExpr || expr instanceof LiteralExpr) {\n // No action for these types.\n } else {\n throw new Error(`Unhandled expression kind: ${expr.constructor.name}`);\n }\n return transform(expr, flags);\n}\n/**\n * Transform all `Expression`s in the AST of `stmt` with the `transform` function.\n *\n * All such operations will be replaced with the result of applying `transform`, which may be an\n * identity transformation.\n */\nfunction transformExpressionsInStatement(stmt, transform, flags) {\n if (stmt instanceof ExpressionStatement) {\n stmt.expr = transformExpressionsInExpression(stmt.expr, transform, flags);\n } else if (stmt instanceof ReturnStatement) {\n stmt.value = transformExpressionsInExpression(stmt.value, transform, flags);\n } else if (stmt instanceof DeclareVarStmt) {\n if (stmt.value !== undefined) {\n stmt.value = transformExpressionsInExpression(stmt.value, transform, flags);\n }\n } else if (stmt instanceof IfStmt) {\n stmt.condition = transformExpressionsInExpression(stmt.condition, transform, flags);\n for (const caseStatement of stmt.trueCase) {\n transformExpressionsInStatement(caseStatement, transform, flags);\n }\n for (const caseStatement of stmt.falseCase) {\n transformExpressionsInStatement(caseStatement, transform, flags);\n }\n } else {\n throw new Error(`Unhandled statement kind: ${stmt.constructor.name}`);\n }\n}\n/**\n * Checks whether the given expression is a string literal.\n */\nfunction isStringLiteral(expr) {\n return expr instanceof LiteralExpr && typeof expr.value === 'string';\n}\n\n/**\n * A linked list of `Op` nodes of a given subtype.\n *\n * @param OpT specific subtype of `Op` nodes which this list contains.\n */\nclass OpList {\n static {\n this.nextListId = 0;\n }\n constructor() {\n /**\n * Debug ID of this `OpList` instance.\n */\n this.debugListId = OpList.nextListId++;\n // OpList uses static head/tail nodes of a special `ListEnd` type.\n // This avoids the need for special casing of the first and last list\n // elements in all list operations.\n this.head = {\n kind: OpKind.ListEnd,\n next: null,\n prev: null,\n debugListId: this.debugListId\n };\n this.tail = {\n kind: OpKind.ListEnd,\n next: null,\n prev: null,\n debugListId: this.debugListId\n };\n // Link `head` and `tail` together at the start (list is empty).\n this.head.next = this.tail;\n this.tail.prev = this.head;\n }\n /**\n * Push a new operation to the tail of the list.\n */\n push(op) {\n if (Array.isArray(op)) {\n for (const o of op) {\n this.push(o);\n }\n return;\n }\n OpList.assertIsNotEnd(op);\n OpList.assertIsUnowned(op);\n op.debugListId = this.debugListId;\n // The old \"previous\" node (which might be the head, if the list is empty).\n const oldLast = this.tail.prev;\n // Insert `op` following the old last node.\n op.prev = oldLast;\n oldLast.next = op;\n // Connect `op` with the list tail.\n op.next = this.tail;\n this.tail.prev = op;\n }\n /**\n * Prepend one or more nodes to the start of the list.\n */\n prepend(ops) {\n if (ops.length === 0) {\n return;\n }\n for (const op of ops) {\n OpList.assertIsNotEnd(op);\n OpList.assertIsUnowned(op);\n op.debugListId = this.debugListId;\n }\n const first = this.head.next;\n let prev = this.head;\n for (const op of ops) {\n prev.next = op;\n op.prev = prev;\n prev = op;\n }\n prev.next = first;\n first.prev = prev;\n }\n /**\n * `OpList` is iterable via the iteration protocol.\n *\n * It's safe to mutate the part of the list that has already been returned by the iterator, up to\n * and including the last operation returned. Mutations beyond that point _may_ be safe, but may\n * also corrupt the iteration position and should be avoided.\n */\n *[Symbol.iterator]() {\n let current = this.head.next;\n while (current !== this.tail) {\n // Guards against corruption of the iterator state by mutations to the tail of the list during\n // iteration.\n OpList.assertIsOwned(current, this.debugListId);\n const next = current.next;\n yield current;\n current = next;\n }\n }\n *reversed() {\n let current = this.tail.prev;\n while (current !== this.head) {\n OpList.assertIsOwned(current, this.debugListId);\n const prev = current.prev;\n yield current;\n current = prev;\n }\n }\n /**\n * Replace `oldOp` with `newOp` in the list.\n */\n static replace(oldOp, newOp) {\n OpList.assertIsNotEnd(oldOp);\n OpList.assertIsNotEnd(newOp);\n OpList.assertIsOwned(oldOp);\n OpList.assertIsUnowned(newOp);\n newOp.debugListId = oldOp.debugListId;\n if (oldOp.prev !== null) {\n oldOp.prev.next = newOp;\n newOp.prev = oldOp.prev;\n }\n if (oldOp.next !== null) {\n oldOp.next.prev = newOp;\n newOp.next = oldOp.next;\n }\n oldOp.debugListId = null;\n oldOp.prev = null;\n oldOp.next = null;\n }\n /**\n * Replace `oldOp` with some number of new operations in the list (which may include `oldOp`).\n */\n static replaceWithMany(oldOp, newOps) {\n if (newOps.length === 0) {\n // Replacing with an empty list -> pure removal.\n OpList.remove(oldOp);\n return;\n }\n OpList.assertIsNotEnd(oldOp);\n OpList.assertIsOwned(oldOp);\n const listId = oldOp.debugListId;\n oldOp.debugListId = null;\n for (const newOp of newOps) {\n OpList.assertIsNotEnd(newOp);\n // `newOp` might be `oldOp`, but at this point it's been marked as unowned.\n OpList.assertIsUnowned(newOp);\n }\n // It should be safe to reuse `oldOp` in the `newOps` list - maybe you want to sandwich an\n // operation between two new ops.\n const {\n prev: oldPrev,\n next: oldNext\n } = oldOp;\n oldOp.prev = null;\n oldOp.next = null;\n let prev = oldPrev;\n for (const newOp of newOps) {\n this.assertIsUnowned(newOp);\n newOp.debugListId = listId;\n prev.next = newOp;\n newOp.prev = prev;\n // This _should_ be the case, but set it just in case.\n newOp.next = null;\n prev = newOp;\n }\n // At the end of iteration, `prev` holds the last node in the list.\n const first = newOps[0];\n const last = prev;\n // Replace `oldOp` with the chain `first` -> `last`.\n if (oldPrev !== null) {\n oldPrev.next = first;\n first.prev = oldPrev;\n }\n if (oldNext !== null) {\n oldNext.prev = last;\n last.next = oldNext;\n }\n }\n /**\n * Remove the given node from the list which contains it.\n */\n static remove(op) {\n OpList.assertIsNotEnd(op);\n OpList.assertIsOwned(op);\n op.prev.next = op.next;\n op.next.prev = op.prev;\n // Break any link between the node and this list to safeguard against its usage in future\n // operations.\n op.debugListId = null;\n op.prev = null;\n op.next = null;\n }\n /**\n * Insert `op` before `target`.\n */\n static insertBefore(op, target) {\n if (Array.isArray(op)) {\n for (const o of op) {\n this.insertBefore(o, target);\n }\n return;\n }\n OpList.assertIsOwned(target);\n if (target.prev === null) {\n throw new Error(`AssertionError: illegal operation on list start`);\n }\n OpList.assertIsNotEnd(op);\n OpList.assertIsUnowned(op);\n op.debugListId = target.debugListId;\n // Just in case.\n op.prev = null;\n target.prev.next = op;\n op.prev = target.prev;\n op.next = target;\n target.prev = op;\n }\n /**\n * Insert `op` after `target`.\n */\n static insertAfter(op, target) {\n OpList.assertIsOwned(target);\n if (target.next === null) {\n throw new Error(`AssertionError: illegal operation on list end`);\n }\n OpList.assertIsNotEnd(op);\n OpList.assertIsUnowned(op);\n op.debugListId = target.debugListId;\n target.next.prev = op;\n op.next = target.next;\n op.prev = target;\n target.next = op;\n }\n /**\n * Asserts that `op` does not currently belong to a list.\n */\n static assertIsUnowned(op) {\n if (op.debugListId !== null) {\n throw new Error(`AssertionError: illegal operation on owned node: ${OpKind[op.kind]}`);\n }\n }\n /**\n * Asserts that `op` currently belongs to a list. If `byList` is passed, `op` is asserted to\n * specifically belong to that list.\n */\n static assertIsOwned(op, byList) {\n if (op.debugListId === null) {\n throw new Error(`AssertionError: illegal operation on unowned node: ${OpKind[op.kind]}`);\n } else if (byList !== undefined && op.debugListId !== byList) {\n throw new Error(`AssertionError: node belongs to the wrong list (expected ${byList}, actual ${op.debugListId})`);\n }\n }\n /**\n * Asserts that `op` is not a special `ListEnd` node.\n */\n static assertIsNotEnd(op) {\n if (op.kind === OpKind.ListEnd) {\n throw new Error(`AssertionError: illegal operation on list head or tail`);\n }\n }\n}\nclass SlotHandle {\n constructor() {\n this.slot = null;\n }\n}\n\n/**\n * The set of OpKinds that represent the creation of an element or container\n */\nconst elementContainerOpKinds = new Set([OpKind.Element, OpKind.ElementStart, OpKind.Container, OpKind.ContainerStart, OpKind.Template, OpKind.RepeaterCreate]);\n/**\n * Checks whether the given operation represents the creation of an element or container.\n */\nfunction isElementOrContainerOp(op) {\n return elementContainerOpKinds.has(op.kind);\n}\n/**\n * Create an `ElementStartOp`.\n */\nfunction createElementStartOp(tag, xref, namespace, i18nPlaceholder, startSourceSpan, wholeSourceSpan) {\n return {\n kind: OpKind.ElementStart,\n xref,\n tag,\n handle: new SlotHandle(),\n attributes: null,\n localRefs: [],\n nonBindable: false,\n namespace,\n i18nPlaceholder,\n startSourceSpan,\n wholeSourceSpan,\n ...TRAIT_CONSUMES_SLOT,\n ...NEW_OP\n };\n}\n/**\n * Create a `TemplateOp`.\n */\nfunction createTemplateOp(xref, templateKind, tag, functionNameSuffix, namespace, i18nPlaceholder, startSourceSpan, wholeSourceSpan) {\n return {\n kind: OpKind.Template,\n xref,\n templateKind,\n attributes: null,\n tag,\n handle: new SlotHandle(),\n functionNameSuffix,\n decls: null,\n vars: null,\n localRefs: [],\n nonBindable: false,\n namespace,\n i18nPlaceholder,\n startSourceSpan,\n wholeSourceSpan,\n ...TRAIT_CONSUMES_SLOT,\n ...NEW_OP\n };\n}\nfunction createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, emptyTag, i18nPlaceholder, emptyI18nPlaceholder, startSourceSpan, wholeSourceSpan) {\n return {\n kind: OpKind.RepeaterCreate,\n attributes: null,\n xref: primaryView,\n handle: new SlotHandle(),\n emptyView,\n track,\n trackByFn: null,\n tag,\n emptyTag,\n emptyAttributes: null,\n functionNameSuffix: 'For',\n namespace: Namespace.HTML,\n nonBindable: false,\n localRefs: [],\n decls: null,\n vars: null,\n varNames,\n usesComponentInstance: false,\n i18nPlaceholder,\n emptyI18nPlaceholder,\n startSourceSpan,\n wholeSourceSpan,\n ...TRAIT_CONSUMES_SLOT,\n ...NEW_OP,\n ...TRAIT_CONSUMES_VARS,\n numSlotsUsed: emptyView === null ? 2 : 3\n };\n}\n/**\n * Create an `ElementEndOp`.\n */\nfunction createElementEndOp(xref, sourceSpan) {\n return {\n kind: OpKind.ElementEnd,\n xref,\n sourceSpan,\n ...NEW_OP\n };\n}\nfunction createDisableBindingsOp(xref) {\n return {\n kind: OpKind.DisableBindings,\n xref,\n ...NEW_OP\n };\n}\nfunction createEnableBindingsOp(xref) {\n return {\n kind: OpKind.EnableBindings,\n xref,\n ...NEW_OP\n };\n}\n/**\n * Create a `TextOp`.\n */\nfunction createTextOp(xref, initialValue, icuPlaceholder, sourceSpan) {\n return {\n kind: OpKind.Text,\n xref,\n handle: new SlotHandle(),\n initialValue,\n icuPlaceholder,\n sourceSpan,\n ...TRAIT_CONSUMES_SLOT,\n ...NEW_OP\n };\n}\n/**\n * Create a `ListenerOp`. Host bindings reuse all the listener logic.\n */\nfunction createListenerOp(target, targetSlot, name, tag, handlerOps, animationPhase, eventTarget, hostListener, sourceSpan) {\n const handlerList = new OpList();\n handlerList.push(handlerOps);\n return {\n kind: OpKind.Listener,\n target,\n targetSlot,\n tag,\n hostListener,\n name,\n handlerOps: handlerList,\n handlerFnName: null,\n consumesDollarEvent: false,\n isAnimationListener: animationPhase !== null,\n animationPhase,\n eventTarget,\n sourceSpan,\n ...NEW_OP\n };\n}\n/**\n * Create a `TwoWayListenerOp`.\n */\nfunction createTwoWayListenerOp(target, targetSlot, name, tag, handlerOps, sourceSpan) {\n const handlerList = new OpList();\n handlerList.push(handlerOps);\n return {\n kind: OpKind.TwoWayListener,\n target,\n targetSlot,\n tag,\n name,\n handlerOps: handlerList,\n handlerFnName: null,\n sourceSpan,\n ...NEW_OP\n };\n}\nfunction createPipeOp(xref, slot, name) {\n return {\n kind: OpKind.Pipe,\n xref,\n handle: slot,\n name,\n ...NEW_OP,\n ...TRAIT_CONSUMES_SLOT\n };\n}\nfunction createNamespaceOp(namespace) {\n return {\n kind: OpKind.Namespace,\n active: namespace,\n ...NEW_OP\n };\n}\nfunction createProjectionDefOp(def) {\n return {\n kind: OpKind.ProjectionDef,\n def,\n ...NEW_OP\n };\n}\nfunction createProjectionOp(xref, selector, i18nPlaceholder, fallbackView, sourceSpan) {\n return {\n kind: OpKind.Projection,\n xref,\n handle: new SlotHandle(),\n selector,\n i18nPlaceholder,\n fallbackView,\n projectionSlotIndex: 0,\n attributes: null,\n localRefs: [],\n sourceSpan,\n ...NEW_OP,\n ...TRAIT_CONSUMES_SLOT,\n numSlotsUsed: fallbackView === null ? 1 : 2\n };\n}\n/**\n * Create an `ExtractedAttributeOp`.\n */\nfunction createExtractedAttributeOp(target, bindingKind, namespace, name, expression, i18nContext, i18nMessage, securityContext) {\n return {\n kind: OpKind.ExtractedAttribute,\n target,\n bindingKind,\n namespace,\n name,\n expression,\n i18nContext,\n i18nMessage,\n securityContext,\n trustedValueFn: null,\n ...NEW_OP\n };\n}\nfunction createDeferOp(xref, main, mainSlot, ownResolverFn, resolverFn, sourceSpan) {\n return {\n kind: OpKind.Defer,\n xref,\n handle: new SlotHandle(),\n mainView: main,\n mainSlot,\n loadingView: null,\n loadingSlot: null,\n loadingConfig: null,\n loadingMinimumTime: null,\n loadingAfterTime: null,\n placeholderView: null,\n placeholderSlot: null,\n placeholderConfig: null,\n placeholderMinimumTime: null,\n errorView: null,\n errorSlot: null,\n ownResolverFn,\n resolverFn,\n sourceSpan,\n ...NEW_OP,\n ...TRAIT_CONSUMES_SLOT,\n numSlotsUsed: 2\n };\n}\nfunction createDeferOnOp(defer, trigger, prefetch, sourceSpan) {\n return {\n kind: OpKind.DeferOn,\n defer,\n trigger,\n prefetch,\n sourceSpan,\n ...NEW_OP\n };\n}\n/**\n * Creates a `DeclareLetOp`.\n */\nfunction createDeclareLetOp(xref, declaredName, sourceSpan) {\n return {\n kind: OpKind.DeclareLet,\n xref,\n declaredName,\n sourceSpan,\n handle: new SlotHandle(),\n ...TRAIT_CONSUMES_SLOT,\n ...NEW_OP\n };\n}\n/**\n * Create an `ExtractedMessageOp`.\n */\nfunction createI18nMessageOp(xref, i18nContext, i18nBlock, message, messagePlaceholder, params, postprocessingParams, needsPostprocessing) {\n return {\n kind: OpKind.I18nMessage,\n xref,\n i18nContext,\n i18nBlock,\n message,\n messagePlaceholder,\n params,\n postprocessingParams,\n needsPostprocessing,\n subMessages: [],\n ...NEW_OP\n };\n}\n/**\n * Create an `I18nStartOp`.\n */\nfunction createI18nStartOp(xref, message, root, sourceSpan) {\n return {\n kind: OpKind.I18nStart,\n xref,\n handle: new SlotHandle(),\n root: root ?? xref,\n message,\n messageIndex: null,\n subTemplateIndex: null,\n context: null,\n sourceSpan,\n ...NEW_OP,\n ...TRAIT_CONSUMES_SLOT\n };\n}\n/**\n * Create an `I18nEndOp`.\n */\nfunction createI18nEndOp(xref, sourceSpan) {\n return {\n kind: OpKind.I18nEnd,\n xref,\n sourceSpan,\n ...NEW_OP\n };\n}\n/**\n * Creates an ICU start op.\n */\nfunction createIcuStartOp(xref, message, messagePlaceholder, sourceSpan) {\n return {\n kind: OpKind.IcuStart,\n xref,\n message,\n messagePlaceholder,\n context: null,\n sourceSpan,\n ...NEW_OP\n };\n}\n/**\n * Creates an ICU end op.\n */\nfunction createIcuEndOp(xref) {\n return {\n kind: OpKind.IcuEnd,\n xref,\n ...NEW_OP\n };\n}\n/**\n * Creates an ICU placeholder op.\n */\nfunction createIcuPlaceholderOp(xref, name, strings) {\n return {\n kind: OpKind.IcuPlaceholder,\n xref,\n name,\n strings,\n expressionPlaceholders: [],\n ...NEW_OP\n };\n}\nfunction createI18nContextOp(contextKind, xref, i18nBlock, message, sourceSpan) {\n if (i18nBlock === null && contextKind !== I18nContextKind.Attr) {\n throw new Error('AssertionError: i18nBlock must be provided for non-attribute contexts.');\n }\n return {\n kind: OpKind.I18nContext,\n contextKind,\n xref,\n i18nBlock,\n message,\n sourceSpan,\n params: new Map(),\n postprocessingParams: new Map(),\n ...NEW_OP\n };\n}\nfunction createI18nAttributesOp(xref, handle, target) {\n return {\n kind: OpKind.I18nAttributes,\n xref,\n handle,\n target,\n i18nAttributesConfig: null,\n ...NEW_OP,\n ...TRAIT_CONSUMES_SLOT\n };\n}\nfunction createHostPropertyOp(name, expression, isAnimationTrigger, i18nContext, securityContext, sourceSpan) {\n return {\n kind: OpKind.HostProperty,\n name,\n expression,\n isAnimationTrigger,\n i18nContext,\n securityContext,\n sanitizer: null,\n sourceSpan,\n ...TRAIT_CONSUMES_VARS,\n ...NEW_OP\n };\n}\n\n/**\n * When referenced in the template's context parameters, this indicates a reference to the entire\n * context object, rather than a specific parameter.\n */\nconst CTX_REF = 'CTX_REF_MARKER';\nvar CompilationJobKind;\n(function (CompilationJobKind) {\n CompilationJobKind[CompilationJobKind[\"Tmpl\"] = 0] = \"Tmpl\";\n CompilationJobKind[CompilationJobKind[\"Host\"] = 1] = \"Host\";\n CompilationJobKind[CompilationJobKind[\"Both\"] = 2] = \"Both\";\n})(CompilationJobKind || (CompilationJobKind = {}));\n/**\n * An entire ongoing compilation, which will result in one or more template functions when complete.\n * Contains one or more corresponding compilation units.\n */\nclass CompilationJob {\n constructor(componentName, pool, compatibility) {\n this.componentName = componentName;\n this.pool = pool;\n this.compatibility = compatibility;\n this.kind = CompilationJobKind.Both;\n /**\n * Tracks the next `ir.XrefId` which can be assigned as template structures are ingested.\n */\n this.nextXrefId = 0;\n }\n /**\n * Generate a new unique `ir.XrefId` in this job.\n */\n allocateXrefId() {\n return this.nextXrefId++;\n }\n}\n/**\n * Compilation-in-progress of a whole component's template, including the main template and any\n * embedded views or host bindings.\n */\nclass ComponentCompilationJob extends CompilationJob {\n constructor(componentName, pool, compatibility, relativeContextFilePath, i18nUseExternalIds, deferMeta, allDeferrableDepsFn) {\n super(componentName, pool, compatibility);\n this.relativeContextFilePath = relativeContextFilePath;\n this.i18nUseExternalIds = i18nUseExternalIds;\n this.deferMeta = deferMeta;\n this.allDeferrableDepsFn = allDeferrableDepsFn;\n this.kind = CompilationJobKind.Tmpl;\n this.fnSuffix = 'Template';\n this.views = new Map();\n /**\n * Causes ngContentSelectors to be emitted, for content projection slots in the view. Possibly a\n * reference into the constant pool.\n */\n this.contentSelectors = null;\n /**\n * Constant expressions used by operations within this component's compilation.\n *\n * This will eventually become the `consts` array in the component definition.\n */\n this.consts = [];\n /**\n * Initialization statements needed to set up the consts.\n */\n this.constsInitializers = [];\n this.root = new ViewCompilationUnit(this, this.allocateXrefId(), null);\n this.views.set(this.root.xref, this.root);\n }\n /**\n * Add a `ViewCompilation` for a new embedded view to this compilation.\n */\n allocateView(parent) {\n const view = new ViewCompilationUnit(this, this.allocateXrefId(), parent);\n this.views.set(view.xref, view);\n return view;\n }\n get units() {\n return this.views.values();\n }\n /**\n * Add a constant `o.Expression` to the compilation and return its index in the `consts` array.\n */\n addConst(newConst, initializers) {\n for (let idx = 0; idx < this.consts.length; idx++) {\n if (this.consts[idx].isEquivalent(newConst)) {\n return idx;\n }\n }\n const idx = this.consts.length;\n this.consts.push(newConst);\n if (initializers) {\n this.constsInitializers.push(...initializers);\n }\n return idx;\n }\n}\n/**\n * A compilation unit is compiled into a template function. Some example units are views and host\n * bindings.\n */\nclass CompilationUnit {\n constructor(xref) {\n this.xref = xref;\n /**\n * List of creation operations for this view.\n *\n * Creation operations may internally contain other operations, including update operations.\n */\n this.create = new OpList();\n /**\n * List of update operations for this view.\n */\n this.update = new OpList();\n /**\n * Name of the function which will be generated for this unit.\n *\n * May be `null` if not yet determined.\n */\n this.fnName = null;\n /**\n * Number of variable slots used within this view, or `null` if variables have not yet been\n * counted.\n */\n this.vars = null;\n }\n /**\n * Iterate over all `ir.Op`s within this view.\n *\n * Some operations may have child operations, which this iterator will visit.\n */\n *ops() {\n for (const op of this.create) {\n yield op;\n if (op.kind === OpKind.Listener || op.kind === OpKind.TwoWayListener) {\n for (const listenerOp of op.handlerOps) {\n yield listenerOp;\n }\n }\n }\n for (const op of this.update) {\n yield op;\n }\n }\n}\n/**\n * Compilation-in-progress of an individual view within a template.\n */\nclass ViewCompilationUnit extends CompilationUnit {\n constructor(job, xref, parent) {\n super(xref);\n this.job = job;\n this.parent = parent;\n /**\n * Map of declared variables available within this view to the property on the context object\n * which they alias.\n */\n this.contextVariables = new Map();\n /**\n * Set of aliases available within this view. An alias is a variable whose provided expression is\n * inlined at every location it is used. It may also depend on context variables, by name.\n */\n this.aliases = new Set();\n /**\n * Number of declaration slots used within this view, or `null` if slots have not yet been\n * allocated.\n */\n this.decls = null;\n }\n}\n/**\n * Compilation-in-progress of a host binding, which contains a single unit for that host binding.\n */\nclass HostBindingCompilationJob extends CompilationJob {\n constructor(componentName, pool, compatibility) {\n super(componentName, pool, compatibility);\n this.kind = CompilationJobKind.Host;\n this.fnSuffix = 'HostBindings';\n this.root = new HostBindingCompilationUnit(this);\n }\n get units() {\n return [this.root];\n }\n}\nclass HostBindingCompilationUnit extends CompilationUnit {\n constructor(job) {\n super(0);\n this.job = job;\n /**\n * Much like an element can have attributes, so can a host binding function.\n */\n this.attributes = null;\n }\n}\n\n/**\n * Find any function calls to `$any`, excluding `this.$any`, and delete them, since they have no\n * runtime effects.\n */\nfunction deleteAnyCasts(job) {\n for (const unit of job.units) {\n for (const op of unit.ops()) {\n transformExpressionsInOp(op, removeAnys, VisitorContextFlag.None);\n }\n }\n}\nfunction removeAnys(e) {\n if (e instanceof InvokeFunctionExpr && e.fn instanceof LexicalReadExpr && e.fn.name === '$any') {\n if (e.args.length !== 1) {\n throw new Error('The $any builtin function expects exactly one argument.');\n }\n return e.args[0];\n }\n return e;\n}\n\n/**\n * Adds apply operations after i18n expressions.\n */\nfunction applyI18nExpressions(job) {\n const i18nContexts = new Map();\n for (const unit of job.units) {\n for (const op of unit.create) {\n if (op.kind === OpKind.I18nContext) {\n i18nContexts.set(op.xref, op);\n }\n }\n }\n for (const unit of job.units) {\n for (const op of unit.update) {\n // Only add apply after expressions that are not followed by more expressions.\n if (op.kind === OpKind.I18nExpression && needsApplication(i18nContexts, op)) {\n // TODO: what should be the source span for the apply op?\n OpList.insertAfter(createI18nApplyOp(op.i18nOwner, op.handle, null), op);\n }\n }\n }\n}\n/**\n * Checks whether the given expression op needs to be followed with an apply op.\n */\nfunction needsApplication(i18nContexts, op) {\n // If the next op is not another expression, we need to apply.\n if (op.next?.kind !== OpKind.I18nExpression) {\n return true;\n }\n const context = i18nContexts.get(op.context);\n const nextContext = i18nContexts.get(op.next.context);\n if (context === undefined) {\n throw new Error(\"AssertionError: expected an I18nContextOp to exist for the I18nExpressionOp's context\");\n }\n if (nextContext === undefined) {\n throw new Error(\"AssertionError: expected an I18nContextOp to exist for the next I18nExpressionOp's context\");\n }\n // If the next op is an expression targeting a different i18n block (or different element, in the\n // case of i18n attributes), we need to apply.\n // First, handle the case of i18n blocks.\n if (context.i18nBlock !== null) {\n // This is a block context. Compare the blocks.\n if (context.i18nBlock !== nextContext.i18nBlock) {\n return true;\n }\n return false;\n }\n // Second, handle the case of i18n attributes.\n if (op.i18nOwner !== op.next.i18nOwner) {\n return true;\n }\n return false;\n}\n\n/**\n * Updates i18n expression ops to target the last slot in their owning i18n block, and moves them\n * after the last update instruction that depends on that slot.\n */\nfunction assignI18nSlotDependencies(job) {\n for (const unit of job.units) {\n // The first update op.\n let updateOp = unit.update.head;\n // I18n expressions currently being moved during the iteration.\n let i18nExpressionsInProgress = [];\n // Non-null while we are iterating through an i18nStart/i18nEnd pair\n let state = null;\n for (const createOp of unit.create) {\n if (createOp.kind === OpKind.I18nStart) {\n state = {\n blockXref: createOp.xref,\n lastSlotConsumer: createOp.xref\n };\n } else if (createOp.kind === OpKind.I18nEnd) {\n for (const op of i18nExpressionsInProgress) {\n op.target = state.lastSlotConsumer;\n OpList.insertBefore(op, updateOp);\n }\n i18nExpressionsInProgress.length = 0;\n state = null;\n }\n if (hasConsumesSlotTrait(createOp)) {\n if (state !== null) {\n state.lastSlotConsumer = createOp.xref;\n }\n while (true) {\n if (updateOp.next === null) {\n break;\n }\n if (state !== null && updateOp.kind === OpKind.I18nExpression && updateOp.usage === I18nExpressionFor.I18nText && updateOp.i18nOwner === state.blockXref) {\n const opToRemove = updateOp;\n updateOp = updateOp.next;\n OpList.remove(opToRemove);\n i18nExpressionsInProgress.push(opToRemove);\n continue;\n }\n if (hasDependsOnSlotContextTrait(updateOp) && updateOp.target !== createOp.xref) {\n break;\n }\n updateOp = updateOp.next;\n }\n }\n }\n }\n}\n\n/**\n * Gets a map of all elements in the given view by their xref id.\n */\nfunction createOpXrefMap(unit) {\n const map = new Map();\n for (const op of unit.create) {\n if (!hasConsumesSlotTrait(op)) {\n continue;\n }\n map.set(op.xref, op);\n // TODO(dylhunn): `@for` loops with `@empty` blocks need to be special-cased here,\n // because the slot consumer trait currently only supports one slot per consumer and we\n // need two. This should be revisited when making the refactors mentioned in:\n // https://github.com/angular/angular/pull/53620#discussion_r1430918822\n if (op.kind === OpKind.RepeaterCreate && op.emptyView !== null) {\n map.set(op.emptyView, op);\n }\n }\n return map;\n}\n\n/**\n * Find all extractable attribute and binding ops, and create ExtractedAttributeOps for them.\n * In cases where no instruction needs to be generated for the attribute or binding, it is removed.\n */\nfunction extractAttributes(job) {\n for (const unit of job.units) {\n const elements = createOpXrefMap(unit);\n for (const op of unit.ops()) {\n switch (op.kind) {\n case OpKind.Attribute:\n extractAttributeOp(unit, op, elements);\n break;\n case OpKind.Property:\n if (!op.isAnimationTrigger) {\n let bindingKind;\n if (op.i18nMessage !== null && op.templateKind === null) {\n // If the binding has an i18n context, it is an i18n attribute, and should have that\n // kind in the consts array.\n bindingKind = BindingKind.I18n;\n } else if (op.isStructuralTemplateAttribute) {\n bindingKind = BindingKind.Template;\n } else {\n bindingKind = BindingKind.Property;\n }\n OpList.insertBefore(\n // Deliberately null i18nMessage value\n createExtractedAttributeOp(op.target, bindingKind, null, op.name, /* expression */null, /* i18nContext */null, /* i18nMessage */null, op.securityContext), lookupElement$2(elements, op.target));\n }\n break;\n case OpKind.TwoWayProperty:\n OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.TwoWayProperty, null, op.name, /* expression */null, /* i18nContext */null, /* i18nMessage */null, op.securityContext), lookupElement$2(elements, op.target));\n break;\n case OpKind.StyleProp:\n case OpKind.ClassProp:\n // TODO: Can style or class bindings be i18n attributes?\n // The old compiler treated empty style bindings as regular bindings for the purpose of\n // directive matching. That behavior is incorrect, but we emulate it in compatibility\n // mode.\n if (unit.job.compatibility === CompatibilityMode.TemplateDefinitionBuilder && op.expression instanceof EmptyExpr) {\n OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.Property, null, op.name, /* expression */null, /* i18nContext */null, /* i18nMessage */null, SecurityContext.STYLE), lookupElement$2(elements, op.target));\n }\n break;\n case OpKind.Listener:\n if (!op.isAnimationListener) {\n const extractedAttributeOp = createExtractedAttributeOp(op.target, BindingKind.Property, null, op.name, /* expression */null, /* i18nContext */null, /* i18nMessage */null, SecurityContext.NONE);\n if (job.kind === CompilationJobKind.Host) {\n if (job.compatibility) {\n // TemplateDefinitionBuilder does not extract listener bindings to the const array\n // (which is honestly pretty inconsistent).\n break;\n }\n // This attribute will apply to the enclosing host binding compilation unit, so order\n // doesn't matter.\n unit.create.push(extractedAttributeOp);\n } else {\n OpList.insertBefore(extractedAttributeOp, lookupElement$2(elements, op.target));\n }\n }\n break;\n case OpKind.TwoWayListener:\n // Two-way listeners aren't supported in host bindings.\n if (job.kind !== CompilationJobKind.Host) {\n const extractedAttributeOp = createExtractedAttributeOp(op.target, BindingKind.Property, null, op.name, /* expression */null, /* i18nContext */null, /* i18nMessage */null, SecurityContext.NONE);\n OpList.insertBefore(extractedAttributeOp, lookupElement$2(elements, op.target));\n }\n break;\n }\n }\n }\n}\n/**\n * Looks up an element in the given map by xref ID.\n */\nfunction lookupElement$2(elements, xref) {\n const el = elements.get(xref);\n if (el === undefined) {\n throw new Error('All attributes should have an element-like target.');\n }\n return el;\n}\n/**\n * Extracts an attribute binding.\n */\nfunction extractAttributeOp(unit, op, elements) {\n if (op.expression instanceof Interpolation) {\n return;\n }\n let extractable = op.isTextAttribute || op.expression.isConstant();\n if (unit.job.compatibility === CompatibilityMode.TemplateDefinitionBuilder) {\n // TemplateDefinitionBuilder only extracts text attributes. It does not extract attriibute\n // bindings, even if they are constants.\n extractable &&= op.isTextAttribute;\n }\n if (extractable) {\n const extractedAttributeOp = createExtractedAttributeOp(op.target, op.isStructuralTemplateAttribute ? BindingKind.Template : BindingKind.Attribute, op.namespace, op.name, op.expression, op.i18nContext, op.i18nMessage, op.securityContext);\n if (unit.job.kind === CompilationJobKind.Host) {\n // This attribute will apply to the enclosing host binding compilation unit, so order doesn't\n // matter.\n unit.create.push(extractedAttributeOp);\n } else {\n const ownerOp = lookupElement$2(elements, op.target);\n OpList.insertBefore(extractedAttributeOp, ownerOp);\n }\n OpList.remove(op);\n }\n}\n\n/**\n * Looks up an element in the given map by xref ID.\n */\nfunction lookupElement$1(elements, xref) {\n const el = elements.get(xref);\n if (el === undefined) {\n throw new Error('All attributes should have an element-like target.');\n }\n return el;\n}\nfunction specializeBindings(job) {\n const elements = new Map();\n for (const unit of job.units) {\n for (const op of unit.create) {\n if (!isElementOrContainerOp(op)) {\n continue;\n }\n elements.set(op.xref, op);\n }\n }\n for (const unit of job.units) {\n for (const op of unit.ops()) {\n if (op.kind !== OpKind.Binding) {\n continue;\n }\n switch (op.bindingKind) {\n case BindingKind.Attribute:\n if (op.name === 'ngNonBindable') {\n OpList.remove(op);\n const target = lookupElement$1(elements, op.target);\n target.nonBindable = true;\n } else {\n const [namespace, name] = splitNsName(op.name);\n OpList.replace(op, createAttributeOp(op.target, namespace, name, op.expression, op.securityContext, op.isTextAttribute, op.isStructuralTemplateAttribute, op.templateKind, op.i18nMessage, op.sourceSpan));\n }\n break;\n case BindingKind.Property:\n case BindingKind.Animation:\n if (job.kind === CompilationJobKind.Host) {\n OpList.replace(op, createHostPropertyOp(op.name, op.expression, op.bindingKind === BindingKind.Animation, op.i18nContext, op.securityContext, op.sourceSpan));\n } else {\n OpList.replace(op, createPropertyOp(op.target, op.name, op.expression, op.bindingKind === BindingKind.Animation, op.securityContext, op.isStructuralTemplateAttribute, op.templateKind, op.i18nContext, op.i18nMessage, op.sourceSpan));\n }\n break;\n case BindingKind.TwoWayProperty:\n if (!(op.expression instanceof Expression)) {\n // We shouldn't be able to hit this code path since interpolations in two-way bindings\n // result in a parser error. We assert here so that downstream we can assume that\n // the value is always an expression.\n throw new Error(`Expected value of two-way property binding \"${op.name}\" to be an expression`);\n }\n OpList.replace(op, createTwoWayPropertyOp(op.target, op.name, op.expression, op.securityContext, op.isStructuralTemplateAttribute, op.templateKind, op.i18nContext, op.i18nMessage, op.sourceSpan));\n break;\n case BindingKind.I18n:\n case BindingKind.ClassName:\n case BindingKind.StyleProperty:\n throw new Error(`Unhandled binding of kind ${BindingKind[op.bindingKind]}`);\n }\n }\n }\n}\nconst CHAINABLE = new Set([Identifiers.attribute, Identifiers.classProp, Identifiers.element, Identifiers.elementContainer, Identifiers.elementContainerEnd, Identifiers.elementContainerStart, Identifiers.elementEnd, Identifiers.elementStart, Identifiers.hostProperty, Identifiers.i18nExp, Identifiers.listener, Identifiers.listener, Identifiers.property, Identifiers.styleProp, Identifiers.stylePropInterpolate1, Identifiers.stylePropInterpolate2, Identifiers.stylePropInterpolate3, Identifiers.stylePropInterpolate4, Identifiers.stylePropInterpolate5, Identifiers.stylePropInterpolate6, Identifiers.stylePropInterpolate7, Identifiers.stylePropInterpolate8, Identifiers.stylePropInterpolateV, Identifiers.syntheticHostListener, Identifiers.syntheticHostProperty, Identifiers.templateCreate, Identifiers.twoWayProperty, Identifiers.twoWayListener, Identifiers.declareLet]);\n/**\n * Chaining results in repeated call expressions, causing a deep AST of receiver expressions. To prevent running out of\n * stack depth the maximum number of chained instructions is limited to this threshold, which has been selected\n * arbitrarily.\n */\nconst MAX_CHAIN_LENGTH = 256;\n/**\n * Post-process a reified view compilation and convert sequential calls to chainable instructions\n * into chain calls.\n *\n * For example, two `elementStart` operations in sequence:\n *\n * ```typescript\n * elementStart(0, 'div');\n * elementStart(1, 'span');\n * ```\n *\n * Can be called as a chain instead:\n *\n * ```typescript\n * elementStart(0, 'div')(1, 'span');\n * ```\n */\nfunction chain(job) {\n for (const unit of job.units) {\n chainOperationsInList(unit.create);\n chainOperationsInList(unit.update);\n }\n}\nfunction chainOperationsInList(opList) {\n let chain = null;\n for (const op of opList) {\n if (op.kind !== OpKind.Statement || !(op.statement instanceof ExpressionStatement)) {\n // This type of statement isn't chainable.\n chain = null;\n continue;\n }\n if (!(op.statement.expr instanceof InvokeFunctionExpr) || !(op.statement.expr.fn instanceof ExternalExpr)) {\n // This is a statement, but not an instruction-type call, so not chainable.\n chain = null;\n continue;\n }\n const instruction = op.statement.expr.fn.value;\n if (!CHAINABLE.has(instruction)) {\n // This instruction isn't chainable.\n chain = null;\n continue;\n }\n // This instruction can be chained. It can either be added on to the previous chain (if\n // compatible) or it can be the start of a new chain.\n if (chain !== null && chain.instruction === instruction && chain.length < MAX_CHAIN_LENGTH) {\n // This instruction can be added onto the previous chain.\n const expression = chain.expression.callFn(op.statement.expr.args, op.statement.expr.sourceSpan, op.statement.expr.pure);\n chain.expression = expression;\n chain.op.statement = expression.toStmt();\n chain.length++;\n OpList.remove(op);\n } else {\n // Leave this instruction alone for now, but consider it the start of a new chain.\n chain = {\n op,\n instruction,\n expression: op.statement.expr,\n length: 1\n };\n }\n }\n}\n\n/**\n * Attribute interpolations of the form `[attr.foo]=\"{{foo}}\"\"` should be \"collapsed\" into a plain\n * attribute instruction, instead of an `attributeInterpolate` instruction.\n *\n * (We cannot do this for singleton property interpolations, because `propertyInterpolate`\n * stringifies its expression.)\n *\n * The reification step is also capable of performing this transformation, but doing it early in the\n * pipeline allows other phases to accurately know what instruction will be emitted.\n */\nfunction collapseSingletonInterpolations(job) {\n for (const unit of job.units) {\n for (const op of unit.update) {\n const eligibleOpKind = op.kind === OpKind.Attribute;\n if (eligibleOpKind && op.expression instanceof Interpolation && op.expression.strings.length === 2 && op.expression.strings.every(s => s === '')) {\n op.expression = op.expression.expressions[0];\n }\n }\n }\n}\n\n/**\n * Collapse the various conditions of conditional ops (if, switch) into a single test expression.\n */\nfunction generateConditionalExpressions(job) {\n for (const unit of job.units) {\n for (const op of unit.ops()) {\n if (op.kind !== OpKind.Conditional) {\n continue;\n }\n let test;\n // Any case with a `null` condition is `default`. If one exists, default to it instead.\n const defaultCase = op.conditions.findIndex(cond => cond.expr === null);\n if (defaultCase >= 0) {\n const slot = op.conditions.splice(defaultCase, 1)[0].targetSlot;\n test = new SlotLiteralExpr(slot);\n } else {\n // By default, a switch evaluates to `-1`, causing no template to be displayed.\n test = literal(-1);\n }\n // Switch expressions assign their main test to a temporary, to avoid re-executing it.\n let tmp = op.test == null ? null : new AssignTemporaryExpr(op.test, job.allocateXrefId());\n // For each remaining condition, test whether the temporary satifies the check. (If no temp is\n // present, just check each expression directly.)\n for (let i = op.conditions.length - 1; i >= 0; i--) {\n let conditionalCase = op.conditions[i];\n if (conditionalCase.expr === null) {\n continue;\n }\n if (tmp !== null) {\n const useTmp = i === 0 ? tmp : new ReadTemporaryExpr(tmp.xref);\n conditionalCase.expr = new BinaryOperatorExpr(BinaryOperator.Identical, useTmp, conditionalCase.expr);\n } else if (conditionalCase.alias !== null) {\n const caseExpressionTemporaryXref = job.allocateXrefId();\n conditionalCase.expr = new AssignTemporaryExpr(conditionalCase.expr, caseExpressionTemporaryXref);\n op.contextValue = new ReadTemporaryExpr(caseExpressionTemporaryXref);\n }\n test = new ConditionalExpr(conditionalCase.expr, new SlotLiteralExpr(conditionalCase.targetSlot), test);\n }\n // Save the resulting aggregate Joost-expression.\n op.processed = test;\n // Clear the original conditions array, since we no longer need it, and don't want it to\n // affect subsequent phases (e.g. pipe creation).\n op.conditions = [];\n }\n }\n}\nconst BINARY_OPERATORS = new Map([['&&', BinaryOperator.And], ['>', BinaryOperator.Bigger], ['>=', BinaryOperator.BiggerEquals], ['|', BinaryOperator.BitwiseOr], ['&', BinaryOperator.BitwiseAnd], ['/', BinaryOperator.Divide], ['==', BinaryOperator.Equals], ['===', BinaryOperator.Identical], ['<', BinaryOperator.Lower], ['<=', BinaryOperator.LowerEquals], ['-', BinaryOperator.Minus], ['%', BinaryOperator.Modulo], ['*', BinaryOperator.Multiply], ['!=', BinaryOperator.NotEquals], ['!==', BinaryOperator.NotIdentical], ['??', BinaryOperator.NullishCoalesce], ['||', BinaryOperator.Or], ['+', BinaryOperator.Plus]]);\nfunction namespaceForKey(namespacePrefixKey) {\n const NAMESPACES = new Map([['svg', Namespace.SVG], ['math', Namespace.Math]]);\n if (namespacePrefixKey === null) {\n return Namespace.HTML;\n }\n return NAMESPACES.get(namespacePrefixKey) ?? Namespace.HTML;\n}\nfunction keyForNamespace(namespace) {\n const NAMESPACES = new Map([['svg', Namespace.SVG], ['math', Namespace.Math]]);\n for (const [k, n] of NAMESPACES.entries()) {\n if (n === namespace) {\n return k;\n }\n }\n return null; // No namespace prefix for HTML\n}\nfunction prefixWithNamespace(strippedTag, namespace) {\n if (namespace === Namespace.HTML) {\n return strippedTag;\n }\n return `:${keyForNamespace(namespace)}:${strippedTag}`;\n}\nfunction literalOrArrayLiteral(value) {\n if (Array.isArray(value)) {\n return literalArr(value.map(literalOrArrayLiteral));\n }\n return literal(value);\n}\n\n/**\n * Converts the semantic attributes of element-like operations (elements, templates) into constant\n * array expressions, and lifts them into the overall component `consts`.\n */\nfunction collectElementConsts(job) {\n // Collect all extracted attributes.\n const allElementAttributes = new Map();\n for (const unit of job.units) {\n for (const op of unit.create) {\n if (op.kind === OpKind.ExtractedAttribute) {\n const attributes = allElementAttributes.get(op.target) || new ElementAttributes(job.compatibility);\n allElementAttributes.set(op.target, attributes);\n attributes.add(op.bindingKind, op.name, op.expression, op.namespace, op.trustedValueFn);\n OpList.remove(op);\n }\n }\n }\n // Serialize the extracted attributes into the const array.\n if (job instanceof ComponentCompilationJob) {\n for (const unit of job.units) {\n for (const op of unit.create) {\n // TODO: Simplify and combine these cases.\n if (op.kind == OpKind.Projection) {\n const attributes = allElementAttributes.get(op.xref);\n if (attributes !== undefined) {\n const attrArray = serializeAttributes(attributes);\n if (attrArray.entries.length > 0) {\n op.attributes = attrArray;\n }\n }\n } else if (isElementOrContainerOp(op)) {\n op.attributes = getConstIndex(job, allElementAttributes, op.xref);\n // TODO(dylhunn): `@for` loops with `@empty` blocks need to be special-cased here,\n // because the slot consumer trait currently only supports one slot per consumer and we\n // need two. This should be revisited when making the refactors mentioned in:\n // https://github.com/angular/angular/pull/53620#discussion_r1430918822\n if (op.kind === OpKind.RepeaterCreate && op.emptyView !== null) {\n op.emptyAttributes = getConstIndex(job, allElementAttributes, op.emptyView);\n }\n }\n }\n }\n } else if (job instanceof HostBindingCompilationJob) {\n // TODO: If the host binding case further diverges, we may want to split it into its own\n // phase.\n for (const [xref, attributes] of allElementAttributes.entries()) {\n if (xref !== job.root.xref) {\n throw new Error(`An attribute would be const collected into the host binding's template function, but is not associated with the root xref.`);\n }\n const attrArray = serializeAttributes(attributes);\n if (attrArray.entries.length > 0) {\n job.root.attributes = attrArray;\n }\n }\n }\n}\nfunction getConstIndex(job, allElementAttributes, xref) {\n const attributes = allElementAttributes.get(xref);\n if (attributes !== undefined) {\n const attrArray = serializeAttributes(attributes);\n if (attrArray.entries.length > 0) {\n return job.addConst(attrArray);\n }\n }\n return null;\n}\n/**\n * Shared instance of an empty array to avoid unnecessary array allocations.\n */\nconst FLYWEIGHT_ARRAY = Object.freeze([]);\n/**\n * Container for all of the various kinds of attributes which are applied on an element.\n */\nclass ElementAttributes {\n get attributes() {\n return this.byKind.get(BindingKind.Attribute) ?? FLYWEIGHT_ARRAY;\n }\n get classes() {\n return this.byKind.get(BindingKind.ClassName) ?? FLYWEIGHT_ARRAY;\n }\n get styles() {\n return this.byKind.get(BindingKind.StyleProperty) ?? FLYWEIGHT_ARRAY;\n }\n get bindings() {\n return this.propertyBindings ?? FLYWEIGHT_ARRAY;\n }\n get template() {\n return this.byKind.get(BindingKind.Template) ?? FLYWEIGHT_ARRAY;\n }\n get i18n() {\n return this.byKind.get(BindingKind.I18n) ?? FLYWEIGHT_ARRAY;\n }\n constructor(compatibility) {\n this.compatibility = compatibility;\n this.known = new Map();\n this.byKind = new Map();\n this.propertyBindings = null;\n this.projectAs = null;\n }\n isKnown(kind, name) {\n const nameToValue = this.known.get(kind) ?? new Set();\n this.known.set(kind, nameToValue);\n if (nameToValue.has(name)) {\n return true;\n }\n nameToValue.add(name);\n return false;\n }\n add(kind, name, value, namespace, trustedValueFn) {\n // TemplateDefinitionBuilder puts duplicate attribute, class, and style values into the consts\n // array. This seems inefficient, we can probably keep just the first one or the last value\n // (whichever actually gets applied when multiple values are listed for the same attribute).\n const allowDuplicates = this.compatibility === CompatibilityMode.TemplateDefinitionBuilder && (kind === BindingKind.Attribute || kind === BindingKind.ClassName || kind === BindingKind.StyleProperty);\n if (!allowDuplicates && this.isKnown(kind, name)) {\n return;\n }\n // TODO: Can this be its own phase\n if (name === 'ngProjectAs') {\n if (value === null || !(value instanceof LiteralExpr) || value.value == null || typeof value.value?.toString() !== 'string') {\n throw Error('ngProjectAs must have a string literal value');\n }\n this.projectAs = value.value.toString();\n // TODO: TemplateDefinitionBuilder allows `ngProjectAs` to also be assigned as a literal\n // attribute. Is this sane?\n }\n const array = this.arrayFor(kind);\n array.push(...getAttributeNameLiterals(namespace, name));\n if (kind === BindingKind.Attribute || kind === BindingKind.StyleProperty) {\n if (value === null) {\n throw Error('Attribute, i18n attribute, & style element attributes must have a value');\n }\n if (trustedValueFn !== null) {\n if (!isStringLiteral(value)) {\n throw Error('AssertionError: extracted attribute value should be string literal');\n }\n array.push(taggedTemplate(trustedValueFn, new TemplateLiteral([new TemplateLiteralElement(value.value)], []), undefined, value.sourceSpan));\n } else {\n array.push(value);\n }\n }\n }\n arrayFor(kind) {\n if (kind === BindingKind.Property || kind === BindingKind.TwoWayProperty) {\n this.propertyBindings ??= [];\n return this.propertyBindings;\n } else {\n if (!this.byKind.has(kind)) {\n this.byKind.set(kind, []);\n }\n return this.byKind.get(kind);\n }\n }\n}\n/**\n * Gets an array of literal expressions representing the attribute's namespaced name.\n */\nfunction getAttributeNameLiterals(namespace, name) {\n const nameLiteral = literal(name);\n if (namespace) {\n return [literal(0 /* core.AttributeMarker.NamespaceURI */), literal(namespace), nameLiteral];\n }\n return [nameLiteral];\n}\n/**\n * Serializes an ElementAttributes object into an array expression.\n */\nfunction serializeAttributes({\n attributes,\n bindings,\n classes,\n i18n,\n projectAs,\n styles,\n template\n}) {\n const attrArray = [...attributes];\n if (projectAs !== null) {\n // Parse the attribute value into a CssSelectorList. Note that we only take the\n // first selector, because we don't support multiple selectors in ngProjectAs.\n const parsedR3Selector = parseSelectorToR3Selector(projectAs)[0];\n attrArray.push(literal(5 /* core.AttributeMarker.ProjectAs */), literalOrArrayLiteral(parsedR3Selector));\n }\n if (classes.length > 0) {\n attrArray.push(literal(1 /* core.AttributeMarker.Classes */), ...classes);\n }\n if (styles.length > 0) {\n attrArray.push(literal(2 /* core.AttributeMarker.Styles */), ...styles);\n }\n if (bindings.length > 0) {\n attrArray.push(literal(3 /* core.AttributeMarker.Bindings */), ...bindings);\n }\n if (template.length > 0) {\n attrArray.push(literal(4 /* core.AttributeMarker.Template */), ...template);\n }\n if (i18n.length > 0) {\n attrArray.push(literal(6 /* core.AttributeMarker.I18n */), ...i18n);\n }\n return literalArr(attrArray);\n}\n\n/**\n * Some binding instructions in the update block may actually correspond to i18n bindings. In that\n * case, they should be replaced with i18nExp instructions for the dynamic portions.\n */\nfunction convertI18nBindings(job) {\n const i18nAttributesByElem = new Map();\n for (const unit of job.units) {\n for (const op of unit.create) {\n if (op.kind === OpKind.I18nAttributes) {\n i18nAttributesByElem.set(op.target, op);\n }\n }\n for (const op of unit.update) {\n switch (op.kind) {\n case OpKind.Property:\n case OpKind.Attribute:\n if (op.i18nContext === null) {\n continue;\n }\n if (!(op.expression instanceof Interpolation)) {\n continue;\n }\n const i18nAttributesForElem = i18nAttributesByElem.get(op.target);\n if (i18nAttributesForElem === undefined) {\n throw new Error('AssertionError: An i18n attribute binding instruction requires the owning element to have an I18nAttributes create instruction');\n }\n if (i18nAttributesForElem.target !== op.target) {\n throw new Error('AssertionError: Expected i18nAttributes target element to match binding target element');\n }\n const ops = [];\n for (let i = 0; i < op.expression.expressions.length; i++) {\n const expr = op.expression.expressions[i];\n if (op.expression.i18nPlaceholders.length !== op.expression.expressions.length) {\n throw new Error(`AssertionError: An i18n attribute binding instruction requires the same number of expressions and placeholders, but found ${op.expression.i18nPlaceholders.length} placeholders and ${op.expression.expressions.length} expressions`);\n }\n ops.push(createI18nExpressionOp(op.i18nContext, i18nAttributesForElem.target, i18nAttributesForElem.xref, i18nAttributesForElem.handle, expr, null, op.expression.i18nPlaceholders[i], I18nParamResolutionTime.Creation, I18nExpressionFor.I18nAttribute, op.name, op.sourceSpan));\n }\n OpList.replaceWithMany(op, ops);\n break;\n }\n }\n }\n}\n\n/**\n * Resolve the dependency function of a deferred block.\n */\nfunction resolveDeferDepsFns(job) {\n for (const unit of job.units) {\n for (const op of unit.create) {\n if (op.kind === OpKind.Defer) {\n if (op.resolverFn !== null) {\n continue;\n }\n if (op.ownResolverFn !== null) {\n if (op.handle.slot === null) {\n throw new Error('AssertionError: slot must be assigned before extracting defer deps functions');\n }\n const fullPathName = unit.fnName?.replace('_Template', '');\n op.resolverFn = job.pool.getSharedFunctionReference(op.ownResolverFn, `${fullPathName}_Defer_${op.handle.slot}_DepsFn`, /* Don't use unique names for TDB compatibility */false);\n }\n }\n }\n }\n}\n\n/**\n * Create one helper context op per i18n block (including generate descending blocks).\n *\n * Also, if an ICU exists inside an i18n block that also contains other localizable content (such as\n * string), create an additional helper context op for the ICU.\n *\n * These context ops are later used for generating i18n messages. (Although we generate at least one\n * context op per nested view, we will collect them up the tree later, to generate a top-level\n * message.)\n */\nfunction createI18nContexts(job) {\n // Create i18n context ops for i18n attrs.\n const attrContextByMessage = new Map();\n for (const unit of job.units) {\n for (const op of unit.ops()) {\n switch (op.kind) {\n case OpKind.Binding:\n case OpKind.Property:\n case OpKind.Attribute:\n case OpKind.ExtractedAttribute:\n if (op.i18nMessage === null) {\n continue;\n }\n if (!attrContextByMessage.has(op.i18nMessage)) {\n const i18nContext = createI18nContextOp(I18nContextKind.Attr, job.allocateXrefId(), null, op.i18nMessage, null);\n unit.create.push(i18nContext);\n attrContextByMessage.set(op.i18nMessage, i18nContext.xref);\n }\n op.i18nContext = attrContextByMessage.get(op.i18nMessage);\n break;\n }\n }\n }\n // Create i18n context ops for root i18n blocks.\n const blockContextByI18nBlock = new Map();\n for (const unit of job.units) {\n for (const op of unit.create) {\n switch (op.kind) {\n case OpKind.I18nStart:\n if (op.xref === op.root) {\n const contextOp = createI18nContextOp(I18nContextKind.RootI18n, job.allocateXrefId(), op.xref, op.message, null);\n unit.create.push(contextOp);\n op.context = contextOp.xref;\n blockContextByI18nBlock.set(op.xref, contextOp);\n }\n break;\n }\n }\n }\n // Assign i18n contexts for child i18n blocks. These don't need their own conext, instead they\n // should inherit from their root i18n block.\n for (const unit of job.units) {\n for (const op of unit.create) {\n if (op.kind === OpKind.I18nStart && op.xref !== op.root) {\n const rootContext = blockContextByI18nBlock.get(op.root);\n if (rootContext === undefined) {\n throw Error('AssertionError: Root i18n block i18n context should have been created.');\n }\n op.context = rootContext.xref;\n blockContextByI18nBlock.set(op.xref, rootContext);\n }\n }\n }\n // Create or assign i18n contexts for ICUs.\n let currentI18nOp = null;\n for (const unit of job.units) {\n for (const op of unit.create) {\n switch (op.kind) {\n case OpKind.I18nStart:\n currentI18nOp = op;\n break;\n case OpKind.I18nEnd:\n currentI18nOp = null;\n break;\n case OpKind.IcuStart:\n if (currentI18nOp === null) {\n throw Error('AssertionError: Unexpected ICU outside of an i18n block.');\n }\n if (op.message.id !== currentI18nOp.message.id) {\n // This ICU is a sub-message inside its parent i18n block message. We need to give it\n // its own context.\n const contextOp = createI18nContextOp(I18nContextKind.Icu, job.allocateXrefId(), currentI18nOp.root, op.message, null);\n unit.create.push(contextOp);\n op.context = contextOp.xref;\n } else {\n // This ICU is the only translatable content in its parent i18n block. We need to\n // convert the parent's context into an ICU context.\n op.context = currentI18nOp.context;\n blockContextByI18nBlock.get(currentI18nOp.xref).contextKind = I18nContextKind.Icu;\n }\n break;\n }\n }\n }\n}\n\n/**\n * Deduplicate text bindings, e.g.
\n */\nfunction deduplicateTextBindings(job) {\n const seen = new Map();\n for (const unit of job.units) {\n for (const op of unit.update.reversed()) {\n if (op.kind === OpKind.Binding && op.isTextAttribute) {\n const seenForElement = seen.get(op.target) || new Set();\n if (seenForElement.has(op.name)) {\n if (job.compatibility === CompatibilityMode.TemplateDefinitionBuilder) {\n // For most duplicated attributes, TemplateDefinitionBuilder lists all of the values in\n // the consts array. However, for style and class attributes it only keeps the last one.\n // We replicate that behavior here since it has actual consequences for apps with\n // duplicate class or style attrs.\n if (op.name === 'style' || op.name === 'class') {\n OpList.remove(op);\n }\n } else {\n // TODO: Determine the correct behavior. It would probably make sense to merge multiple\n // style and class attributes. Alternatively we could just throw an error, as HTML\n // doesn't permit duplicate attributes.\n }\n }\n seenForElement.add(op.name);\n seen.set(op.target, seenForElement);\n }\n }\n }\n}\n\n/**\n * Defer instructions take a configuration array, which should be collected into the component\n * consts. This phase finds the config options, and creates the corresponding const array.\n */\nfunction configureDeferInstructions(job) {\n for (const unit of job.units) {\n for (const op of unit.create) {\n if (op.kind !== OpKind.Defer) {\n continue;\n }\n if (op.placeholderMinimumTime !== null) {\n op.placeholderConfig = new ConstCollectedExpr(literalOrArrayLiteral([op.placeholderMinimumTime]));\n }\n if (op.loadingMinimumTime !== null || op.loadingAfterTime !== null) {\n op.loadingConfig = new ConstCollectedExpr(literalOrArrayLiteral([op.loadingMinimumTime, op.loadingAfterTime]));\n }\n }\n }\n}\n\n/**\n * Some `defer` conditions can reference other elements in the template, using their local reference\n * names. However, the semantics are quite different from the normal local reference system: in\n * particular, we need to look at local reference names in enclosing views. This phase resolves\n * all such references to actual xrefs.\n */\nfunction resolveDeferTargetNames(job) {\n const scopes = new Map();\n function getScopeForView(view) {\n if (scopes.has(view.xref)) {\n return scopes.get(view.xref);\n }\n const scope = new Scope$1();\n for (const op of view.create) {\n // add everything that can be referenced.\n if (!isElementOrContainerOp(op) || op.localRefs === null) {\n continue;\n }\n if (!Array.isArray(op.localRefs)) {\n throw new Error('LocalRefs were already processed, but were needed to resolve defer targets.');\n }\n for (const ref of op.localRefs) {\n if (ref.target !== '') {\n continue;\n }\n scope.targets.set(ref.name, {\n xref: op.xref,\n slot: op.handle\n });\n }\n }\n scopes.set(view.xref, scope);\n return scope;\n }\n function resolveTrigger(deferOwnerView, op, placeholderView) {\n switch (op.trigger.kind) {\n case DeferTriggerKind.Idle:\n case DeferTriggerKind.Immediate:\n case DeferTriggerKind.Timer:\n return;\n case DeferTriggerKind.Hover:\n case DeferTriggerKind.Interaction:\n case DeferTriggerKind.Viewport:\n if (op.trigger.targetName === null) {\n // A `null` target name indicates we should default to the first element in the\n // placeholder block.\n if (placeholderView === null) {\n throw new Error('defer on trigger with no target name must have a placeholder block');\n }\n const placeholder = job.views.get(placeholderView);\n if (placeholder == undefined) {\n throw new Error('AssertionError: could not find placeholder view for defer on trigger');\n }\n for (const placeholderOp of placeholder.create) {\n if (hasConsumesSlotTrait(placeholderOp) && (isElementOrContainerOp(placeholderOp) || placeholderOp.kind === OpKind.Projection)) {\n op.trigger.targetXref = placeholderOp.xref;\n op.trigger.targetView = placeholderView;\n op.trigger.targetSlotViewSteps = -1;\n op.trigger.targetSlot = placeholderOp.handle;\n return;\n }\n }\n return;\n }\n let view = placeholderView !== null ? job.views.get(placeholderView) : deferOwnerView;\n let step = placeholderView !== null ? -1 : 0;\n while (view !== null) {\n const scope = getScopeForView(view);\n if (scope.targets.has(op.trigger.targetName)) {\n const {\n xref,\n slot\n } = scope.targets.get(op.trigger.targetName);\n op.trigger.targetXref = xref;\n op.trigger.targetView = view.xref;\n op.trigger.targetSlotViewSteps = step;\n op.trigger.targetSlot = slot;\n return;\n }\n view = view.parent !== null ? job.views.get(view.parent) : null;\n step++;\n }\n break;\n default:\n throw new Error(`Trigger kind ${op.trigger.kind} not handled`);\n }\n }\n // Find the defer ops, and assign the data about their targets.\n for (const unit of job.units) {\n const defers = new Map();\n for (const op of unit.create) {\n switch (op.kind) {\n case OpKind.Defer:\n defers.set(op.xref, op);\n break;\n case OpKind.DeferOn:\n const deferOp = defers.get(op.defer);\n resolveTrigger(unit, op, deferOp.placeholderView);\n break;\n }\n }\n }\n}\nclass Scope$1 {\n constructor() {\n this.targets = new Map();\n }\n}\nconst REPLACEMENTS = new Map([[OpKind.ElementEnd, [OpKind.ElementStart, OpKind.Element]], [OpKind.ContainerEnd, [OpKind.ContainerStart, OpKind.Container]], [OpKind.I18nEnd, [OpKind.I18nStart, OpKind.I18n]]]);\n/**\n * Op kinds that should not prevent merging of start/end ops.\n */\nconst IGNORED_OP_KINDS = new Set([OpKind.Pipe]);\n/**\n * Replace sequences of mergable instructions (e.g. `ElementStart` and `ElementEnd`) with a\n * consolidated instruction (e.g. `Element`).\n */\nfunction collapseEmptyInstructions(job) {\n for (const unit of job.units) {\n for (const op of unit.create) {\n // Find end ops that may be able to be merged.\n const opReplacements = REPLACEMENTS.get(op.kind);\n if (opReplacements === undefined) {\n continue;\n }\n const [startKind, mergedKind] = opReplacements;\n // Locate the previous (non-ignored) op.\n let prevOp = op.prev;\n while (prevOp !== null && IGNORED_OP_KINDS.has(prevOp.kind)) {\n prevOp = prevOp.prev;\n }\n // If the previous op is the corresponding start op, we can megre.\n if (prevOp !== null && prevOp.kind === startKind) {\n // Transmute the start instruction to the merged version. This is safe as they're designed\n // to be identical apart from the `kind`.\n prevOp.kind = mergedKind;\n // Remove the end instruction.\n OpList.remove(op);\n }\n }\n }\n}\n\n/**\n * Safe read expressions such as `a?.b` have different semantics in Angular templates as\n * compared to JavaScript. In particular, they default to `null` instead of `undefined`. This phase\n * finds all unresolved safe read expressions, and converts them into the appropriate output AST\n * reads, guarded by null checks. We generate temporaries as needed, to avoid re-evaluating the same\n * sub-expression multiple times.\n */\nfunction expandSafeReads(job) {\n for (const unit of job.units) {\n for (const op of unit.ops()) {\n transformExpressionsInOp(op, e => safeTransform(e, {\n job\n }), VisitorContextFlag.None);\n transformExpressionsInOp(op, ternaryTransform, VisitorContextFlag.None);\n }\n }\n}\n// A lookup set of all the expression kinds that require a temporary variable to be generated.\nconst requiresTemporary = [InvokeFunctionExpr, LiteralArrayExpr, LiteralMapExpr, SafeInvokeFunctionExpr, PipeBindingExpr].map(e => e.constructor.name);\nfunction needsTemporaryInSafeAccess(e) {\n // TODO: We probably want to use an expression visitor to recursively visit all descendents.\n // However, that would potentially do a lot of extra work (because it cannot short circuit), so we\n // implement the logic ourselves for now.\n if (e instanceof UnaryOperatorExpr) {\n return needsTemporaryInSafeAccess(e.expr);\n } else if (e instanceof BinaryOperatorExpr) {\n return needsTemporaryInSafeAccess(e.lhs) || needsTemporaryInSafeAccess(e.rhs);\n } else if (e instanceof ConditionalExpr) {\n if (e.falseCase && needsTemporaryInSafeAccess(e.falseCase)) return true;\n return needsTemporaryInSafeAccess(e.condition) || needsTemporaryInSafeAccess(e.trueCase);\n } else if (e instanceof NotExpr) {\n return needsTemporaryInSafeAccess(e.condition);\n } else if (e instanceof AssignTemporaryExpr) {\n return needsTemporaryInSafeAccess(e.expr);\n } else if (e instanceof ReadPropExpr) {\n return needsTemporaryInSafeAccess(e.receiver);\n } else if (e instanceof ReadKeyExpr) {\n return needsTemporaryInSafeAccess(e.receiver) || needsTemporaryInSafeAccess(e.index);\n }\n // TODO: Switch to a method which is exhaustive of newly added expression subtypes.\n return e instanceof InvokeFunctionExpr || e instanceof LiteralArrayExpr || e instanceof LiteralMapExpr || e instanceof SafeInvokeFunctionExpr || e instanceof PipeBindingExpr;\n}\nfunction temporariesIn(e) {\n const temporaries = new Set();\n // TODO: Although it's not currently supported by the transform helper, we should be able to\n // short-circuit exploring the tree to do less work. In particular, we don't have to penetrate\n // into the subexpressions of temporary assignments.\n transformExpressionsInExpression(e, e => {\n if (e instanceof AssignTemporaryExpr) {\n temporaries.add(e.xref);\n }\n return e;\n }, VisitorContextFlag.None);\n return temporaries;\n}\nfunction eliminateTemporaryAssignments(e, tmps, ctx) {\n // TODO: We can be more efficient than the transform helper here. We don't need to visit any\n // descendents of temporary assignments.\n transformExpressionsInExpression(e, e => {\n if (e instanceof AssignTemporaryExpr && tmps.has(e.xref)) {\n const read = new ReadTemporaryExpr(e.xref);\n // `TemplateDefinitionBuilder` has the (accidental?) behavior of generating assignments of\n // temporary variables to themselves. This happens because some subexpression that the\n // temporary refers to, possibly through nested temporaries, has a function call. We copy that\n // behavior here.\n return ctx.job.compatibility === CompatibilityMode.TemplateDefinitionBuilder ? new AssignTemporaryExpr(read, read.xref) : read;\n }\n return e;\n }, VisitorContextFlag.None);\n return e;\n}\n/**\n * Creates a safe ternary guarded by the input expression, and with a body generated by the provided\n * callback on the input expression. Generates a temporary variable assignment if needed, and\n * deduplicates nested temporary assignments if needed.\n */\nfunction safeTernaryWithTemporary(guard, body, ctx) {\n let result;\n if (needsTemporaryInSafeAccess(guard)) {\n const xref = ctx.job.allocateXrefId();\n result = [new AssignTemporaryExpr(guard, xref), new ReadTemporaryExpr(xref)];\n } else {\n result = [guard, guard.clone()];\n // Consider an expression like `a?.[b?.c()]?.d`. The `b?.c()` will be transformed first,\n // introducing a temporary assignment into the key. Then, as part of expanding the `?.d`. That\n // assignment will be duplicated into both the guard and expression sides. We de-duplicate it,\n // by transforming it from an assignment into a read on the expression side.\n eliminateTemporaryAssignments(result[1], temporariesIn(result[0]), ctx);\n }\n return new SafeTernaryExpr(result[0], body(result[1]));\n}\nfunction isSafeAccessExpression(e) {\n return e instanceof SafePropertyReadExpr || e instanceof SafeKeyedReadExpr || e instanceof SafeInvokeFunctionExpr;\n}\nfunction isUnsafeAccessExpression(e) {\n return e instanceof ReadPropExpr || e instanceof ReadKeyExpr || e instanceof InvokeFunctionExpr;\n}\nfunction isAccessExpression(e) {\n return isSafeAccessExpression(e) || isUnsafeAccessExpression(e);\n}\nfunction deepestSafeTernary(e) {\n if (isAccessExpression(e) && e.receiver instanceof SafeTernaryExpr) {\n let st = e.receiver;\n while (st.expr instanceof SafeTernaryExpr) {\n st = st.expr;\n }\n return st;\n }\n return null;\n}\n// TODO: When strict compatibility with TemplateDefinitionBuilder is not required, we can use `&&`\n// instead to save some code size.\nfunction safeTransform(e, ctx) {\n if (!isAccessExpression(e)) {\n return e;\n }\n const dst = deepestSafeTernary(e);\n if (dst) {\n if (e instanceof InvokeFunctionExpr) {\n dst.expr = dst.expr.callFn(e.args);\n return e.receiver;\n }\n if (e instanceof ReadPropExpr) {\n dst.expr = dst.expr.prop(e.name);\n return e.receiver;\n }\n if (e instanceof ReadKeyExpr) {\n dst.expr = dst.expr.key(e.index);\n return e.receiver;\n }\n if (e instanceof SafeInvokeFunctionExpr) {\n dst.expr = safeTernaryWithTemporary(dst.expr, r => r.callFn(e.args), ctx);\n return e.receiver;\n }\n if (e instanceof SafePropertyReadExpr) {\n dst.expr = safeTernaryWithTemporary(dst.expr, r => r.prop(e.name), ctx);\n return e.receiver;\n }\n if (e instanceof SafeKeyedReadExpr) {\n dst.expr = safeTernaryWithTemporary(dst.expr, r => r.key(e.index), ctx);\n return e.receiver;\n }\n } else {\n if (e instanceof SafeInvokeFunctionExpr) {\n return safeTernaryWithTemporary(e.receiver, r => r.callFn(e.args), ctx);\n }\n if (e instanceof SafePropertyReadExpr) {\n return safeTernaryWithTemporary(e.receiver, r => r.prop(e.name), ctx);\n }\n if (e instanceof SafeKeyedReadExpr) {\n return safeTernaryWithTemporary(e.receiver, r => r.key(e.index), ctx);\n }\n }\n return e;\n}\nfunction ternaryTransform(e) {\n if (!(e instanceof SafeTernaryExpr)) {\n return e;\n }\n return new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.Equals, e.guard, NULL_EXPR), NULL_EXPR, e.expr);\n}\n\n/**\n * The escape sequence used indicate message param values.\n */\nconst ESCAPE$1 = '\\uFFFD';\n/**\n * Marker used to indicate an element tag.\n */\nconst ELEMENT_MARKER = '#';\n/**\n * Marker used to indicate a template tag.\n */\nconst TEMPLATE_MARKER = '*';\n/**\n * Marker used to indicate closing of an element or template tag.\n */\nconst TAG_CLOSE_MARKER = '/';\n/**\n * Marker used to indicate the sub-template context.\n */\nconst CONTEXT_MARKER = ':';\n/**\n * Marker used to indicate the start of a list of values.\n */\nconst LIST_START_MARKER = '[';\n/**\n * Marker used to indicate the end of a list of values.\n */\nconst LIST_END_MARKER = ']';\n/**\n * Delimiter used to separate multiple values in a list.\n */\nconst LIST_DELIMITER = '|';\n/**\n * Formats the param maps on extracted message ops into a maps of `Expression` objects that can be\n * used in the final output.\n */\nfunction extractI18nMessages(job) {\n // Create an i18n message for each context.\n // TODO: Merge the context op with the message op since they're 1:1 anyways.\n const i18nMessagesByContext = new Map();\n const i18nBlocks = new Map();\n const i18nContexts = new Map();\n for (const unit of job.units) {\n for (const op of unit.create) {\n switch (op.kind) {\n case OpKind.I18nContext:\n const i18nMessageOp = createI18nMessage(job, op);\n unit.create.push(i18nMessageOp);\n i18nMessagesByContext.set(op.xref, i18nMessageOp);\n i18nContexts.set(op.xref, op);\n break;\n case OpKind.I18nStart:\n i18nBlocks.set(op.xref, op);\n break;\n }\n }\n }\n // Associate sub-messages for ICUs with their root message. At this point we can also remove the\n // ICU start/end ops, as they are no longer needed.\n let currentIcu = null;\n for (const unit of job.units) {\n for (const op of unit.create) {\n switch (op.kind) {\n case OpKind.IcuStart:\n currentIcu = op;\n OpList.remove(op);\n // Skip any contexts not associated with an ICU.\n const icuContext = i18nContexts.get(op.context);\n if (icuContext.contextKind !== I18nContextKind.Icu) {\n continue;\n }\n // Skip ICUs that share a context with their i18n message. These represent root-level\n // ICUs, not sub-messages.\n const i18nBlock = i18nBlocks.get(icuContext.i18nBlock);\n if (i18nBlock.context === icuContext.xref) {\n continue;\n }\n // Find the root message and push this ICUs message as a sub-message.\n const rootI18nBlock = i18nBlocks.get(i18nBlock.root);\n const rootMessage = i18nMessagesByContext.get(rootI18nBlock.context);\n if (rootMessage === undefined) {\n throw Error('AssertionError: ICU sub-message should belong to a root message.');\n }\n const subMessage = i18nMessagesByContext.get(icuContext.xref);\n subMessage.messagePlaceholder = op.messagePlaceholder;\n rootMessage.subMessages.push(subMessage.xref);\n break;\n case OpKind.IcuEnd:\n currentIcu = null;\n OpList.remove(op);\n break;\n case OpKind.IcuPlaceholder:\n // Add ICU placeholders to the message, then remove the ICU placeholder ops.\n if (currentIcu === null || currentIcu.context == null) {\n throw Error('AssertionError: Unexpected ICU placeholder outside of i18n context');\n }\n const msg = i18nMessagesByContext.get(currentIcu.context);\n msg.postprocessingParams.set(op.name, literal(formatIcuPlaceholder(op)));\n OpList.remove(op);\n break;\n }\n }\n }\n}\n/**\n * Create an i18n message op from an i18n context op.\n */\nfunction createI18nMessage(job, context, messagePlaceholder) {\n let formattedParams = formatParams(context.params);\n const formattedPostprocessingParams = formatParams(context.postprocessingParams);\n let needsPostprocessing = [...context.params.values()].some(v => v.length > 1);\n return createI18nMessageOp(job.allocateXrefId(), context.xref, context.i18nBlock, context.message, messagePlaceholder ?? null, formattedParams, formattedPostprocessingParams, needsPostprocessing);\n}\n/**\n * Formats an ICU placeholder into a single string with expression placeholders.\n */\nfunction formatIcuPlaceholder(op) {\n if (op.strings.length !== op.expressionPlaceholders.length + 1) {\n throw Error(`AssertionError: Invalid ICU placeholder with ${op.strings.length} strings and ${op.expressionPlaceholders.length} expressions`);\n }\n const values = op.expressionPlaceholders.map(formatValue);\n return op.strings.flatMap((str, i) => [str, values[i] || '']).join('');\n}\n/**\n * Formats a map of `I18nParamValue[]` values into a map of `Expression` values.\n */\nfunction formatParams(params) {\n const formattedParams = new Map();\n for (const [placeholder, placeholderValues] of params) {\n const serializedValues = formatParamValues(placeholderValues);\n if (serializedValues !== null) {\n formattedParams.set(placeholder, literal(serializedValues));\n }\n }\n return formattedParams;\n}\n/**\n * Formats an `I18nParamValue[]` into a string (or null for empty array).\n */\nfunction formatParamValues(values) {\n if (values.length === 0) {\n return null;\n }\n const serializedValues = values.map(value => formatValue(value));\n return serializedValues.length === 1 ? serializedValues[0] : `${LIST_START_MARKER}${serializedValues.join(LIST_DELIMITER)}${LIST_END_MARKER}`;\n}\n/**\n * Formats a single `I18nParamValue` into a string\n */\nfunction formatValue(value) {\n // Element tags with a structural directive use a special form that concatenates the element and\n // template values.\n if (value.flags & I18nParamValueFlags.ElementTag && value.flags & I18nParamValueFlags.TemplateTag) {\n if (typeof value.value !== 'object') {\n throw Error('AssertionError: Expected i18n param value to have an element and template slot');\n }\n const elementValue = formatValue({\n ...value,\n value: value.value.element,\n flags: value.flags & ~I18nParamValueFlags.TemplateTag\n });\n const templateValue = formatValue({\n ...value,\n value: value.value.template,\n flags: value.flags & ~I18nParamValueFlags.ElementTag\n });\n // TODO(mmalerba): This is likely a bug in TemplateDefinitionBuilder, we should not need to\n // record the template value twice. For now I'm re-implementing the behavior here to keep the\n // output consistent with TemplateDefinitionBuilder.\n if (value.flags & I18nParamValueFlags.OpenTag && value.flags & I18nParamValueFlags.CloseTag) {\n return `${templateValue}${elementValue}${templateValue}`;\n }\n // To match the TemplateDefinitionBuilder output, flip the order depending on whether the\n // values represent a closing or opening tag (or both).\n // TODO(mmalerba): Figure out if this makes a difference in terms of either functionality,\n // or the resulting message ID. If not, we can remove the special-casing in the future.\n return value.flags & I18nParamValueFlags.CloseTag ? `${elementValue}${templateValue}` : `${templateValue}${elementValue}`;\n }\n // Self-closing tags use a special form that concatenates the start and close tag values.\n if (value.flags & I18nParamValueFlags.OpenTag && value.flags & I18nParamValueFlags.CloseTag) {\n return `${formatValue({\n ...value,\n flags: value.flags & ~I18nParamValueFlags.CloseTag\n })}${formatValue({\n ...value,\n flags: value.flags & ~I18nParamValueFlags.OpenTag\n })}`;\n }\n // If there are no special flags, just return the raw value.\n if (value.flags === I18nParamValueFlags.None) {\n return `${value.value}`;\n }\n // Encode the remaining flags as part of the value.\n let tagMarker = '';\n let closeMarker = '';\n if (value.flags & I18nParamValueFlags.ElementTag) {\n tagMarker = ELEMENT_MARKER;\n } else if (value.flags & I18nParamValueFlags.TemplateTag) {\n tagMarker = TEMPLATE_MARKER;\n }\n if (tagMarker !== '') {\n closeMarker = value.flags & I18nParamValueFlags.CloseTag ? TAG_CLOSE_MARKER : '';\n }\n const context = value.subTemplateIndex === null ? '' : `${CONTEXT_MARKER}${value.subTemplateIndex}`;\n return `${ESCAPE$1}${closeMarker}${tagMarker}${value.value}${context}${ESCAPE$1}`;\n}\n\n/**\n * Generate `ir.AdvanceOp`s in between `ir.UpdateOp`s that ensure the runtime's implicit slot\n * context will be advanced correctly.\n */\nfunction generateAdvance(job) {\n for (const unit of job.units) {\n // First build a map of all of the declarations in the view that have assigned slots.\n const slotMap = new Map();\n for (const op of unit.create) {\n if (!hasConsumesSlotTrait(op)) {\n continue;\n } else if (op.handle.slot === null) {\n throw new Error(`AssertionError: expected slots to have been allocated before generating advance() calls`);\n }\n slotMap.set(op.xref, op.handle.slot);\n }\n // Next, step through the update operations and generate `ir.AdvanceOp`s as required to ensure\n // the runtime's implicit slot counter will be set to the correct slot before executing each\n // update operation which depends on it.\n //\n // To do that, we track what the runtime's slot counter will be through the update operations.\n let slotContext = 0;\n for (const op of unit.update) {\n let consumer = null;\n if (hasDependsOnSlotContextTrait(op)) {\n consumer = op;\n } else {\n visitExpressionsInOp(op, expr => {\n if (consumer === null && hasDependsOnSlotContextTrait(expr)) {\n consumer = expr;\n }\n });\n }\n if (consumer === null) {\n continue;\n }\n if (!slotMap.has(consumer.target)) {\n // We expect ops that _do_ depend on the slot counter to point at declarations that exist in\n // the `slotMap`.\n throw new Error(`AssertionError: reference to unknown slot for target ${consumer.target}`);\n }\n const slot = slotMap.get(consumer.target);\n // Does the slot counter need to be adjusted?\n if (slotContext !== slot) {\n // If so, generate an `ir.AdvanceOp` to advance the counter.\n const delta = slot - slotContext;\n if (delta < 0) {\n throw new Error(`AssertionError: slot counter should never need to move backwards`);\n }\n OpList.insertBefore(createAdvanceOp(delta, consumer.sourceSpan), op);\n slotContext = slot;\n }\n }\n }\n}\n\n/**\n * Locate projection slots, populate the each component's `ngContentSelectors` literal field,\n * populate `project` arguments, and generate the required `projectionDef` instruction for the job's\n * root view.\n */\nfunction generateProjectionDefs(job) {\n // TODO: Why does TemplateDefinitionBuilder force a shared constant?\n const share = job.compatibility === CompatibilityMode.TemplateDefinitionBuilder;\n // Collect all selectors from this component, and its nested views. Also, assign each projection a\n // unique ascending projection slot index.\n const selectors = [];\n let projectionSlotIndex = 0;\n for (const unit of job.units) {\n for (const op of unit.create) {\n if (op.kind === OpKind.Projection) {\n selectors.push(op.selector);\n op.projectionSlotIndex = projectionSlotIndex++;\n }\n }\n }\n if (selectors.length > 0) {\n // Create the projectionDef array. If we only found a single wildcard selector, then we use the\n // default behavior with no arguments instead.\n let defExpr = null;\n if (selectors.length > 1 || selectors[0] !== '*') {\n const def = selectors.map(s => s === '*' ? s : parseSelectorToR3Selector(s));\n defExpr = job.pool.getConstLiteral(literalOrArrayLiteral(def), share);\n }\n // Create the ngContentSelectors constant.\n job.contentSelectors = job.pool.getConstLiteral(literalOrArrayLiteral(selectors), share);\n // The projection def instruction goes at the beginning of the root view, before any\n // `projection` instructions.\n job.root.create.prepend([createProjectionDefOp(defExpr)]);\n }\n}\n\n/**\n * Generate a preamble sequence for each view creation block and listener function which declares\n * any variables that be referenced in other operations in the block.\n *\n * Variables generated include:\n * * a saved view context to be used to restore the current view in event listeners.\n * * the context of the restored view within event listener handlers.\n * * context variables from the current view as well as all parent views (including the root\n * context if needed).\n * * local references from elements within the current view and any lexical parents.\n *\n * Variables are generated here unconditionally, and may optimized away in future operations if it\n * turns out their values (and any side effects) are unused.\n */\nfunction generateVariables(job) {\n recursivelyProcessView(job.root, /* there is no parent scope for the root view */null);\n}\n/**\n * Process the given `ViewCompilation` and generate preambles for it and any listeners that it\n * declares.\n *\n * @param `parentScope` a scope extracted from the parent view which captures any variables which\n * should be inherited by this view. `null` if the current view is the root view.\n */\nfunction recursivelyProcessView(view, parentScope) {\n // Extract a `Scope` from this view.\n const scope = getScopeForView(view, parentScope);\n for (const op of view.create) {\n switch (op.kind) {\n case OpKind.Template:\n // Descend into child embedded views.\n recursivelyProcessView(view.job.views.get(op.xref), scope);\n break;\n case OpKind.Projection:\n if (op.fallbackView !== null) {\n recursivelyProcessView(view.job.views.get(op.fallbackView), scope);\n }\n break;\n case OpKind.RepeaterCreate:\n // Descend into child embedded views.\n recursivelyProcessView(view.job.views.get(op.xref), scope);\n if (op.emptyView) {\n recursivelyProcessView(view.job.views.get(op.emptyView), scope);\n }\n break;\n case OpKind.Listener:\n case OpKind.TwoWayListener:\n // Prepend variables to listener handler functions.\n op.handlerOps.prepend(generateVariablesInScopeForView(view, scope, true));\n break;\n }\n }\n view.update.prepend(generateVariablesInScopeForView(view, scope, false));\n}\n/**\n * Process a view and generate a `Scope` representing the variables available for reference within\n * that view.\n */\nfunction getScopeForView(view, parent) {\n const scope = {\n view: view.xref,\n viewContextVariable: {\n kind: SemanticVariableKind.Context,\n name: null,\n view: view.xref\n },\n contextVariables: new Map(),\n aliases: view.aliases,\n references: [],\n letDeclarations: [],\n parent\n };\n for (const identifier of view.contextVariables.keys()) {\n scope.contextVariables.set(identifier, {\n kind: SemanticVariableKind.Identifier,\n name: null,\n identifier,\n local: false\n });\n }\n for (const op of view.create) {\n switch (op.kind) {\n case OpKind.ElementStart:\n case OpKind.Template:\n if (!Array.isArray(op.localRefs)) {\n throw new Error(`AssertionError: expected localRefs to be an array`);\n }\n // Record available local references from this element.\n for (let offset = 0; offset < op.localRefs.length; offset++) {\n scope.references.push({\n name: op.localRefs[offset].name,\n targetId: op.xref,\n targetSlot: op.handle,\n offset,\n variable: {\n kind: SemanticVariableKind.Identifier,\n name: null,\n identifier: op.localRefs[offset].name,\n local: false\n }\n });\n }\n break;\n case OpKind.DeclareLet:\n scope.letDeclarations.push({\n targetId: op.xref,\n targetSlot: op.handle,\n variable: {\n kind: SemanticVariableKind.Identifier,\n name: null,\n identifier: op.declaredName,\n local: false\n }\n });\n break;\n }\n }\n return scope;\n}\n/**\n * Generate declarations for all variables that are in scope for a given view.\n *\n * This is a recursive process, as views inherit variables available from their parent view, which\n * itself may have inherited variables, etc.\n */\nfunction generateVariablesInScopeForView(view, scope, isListener) {\n const newOps = [];\n if (scope.view !== view.xref) {\n // Before generating variables for a parent view, we need to switch to the context of the parent\n // view with a `nextContext` expression. This context switching operation itself declares a\n // variable, because the context of the view may be referenced directly.\n newOps.push(createVariableOp(view.job.allocateXrefId(), scope.viewContextVariable, new NextContextExpr(), VariableFlags.None));\n }\n // Add variables for all context variables available in this scope's view.\n const scopeView = view.job.views.get(scope.view);\n for (const [name, value] of scopeView.contextVariables) {\n const context = new ContextExpr(scope.view);\n // We either read the context, or, if the variable is CTX_REF, use the context directly.\n const variable = value === CTX_REF ? context : new ReadPropExpr(context, value);\n // Add the variable declaration.\n newOps.push(createVariableOp(view.job.allocateXrefId(), scope.contextVariables.get(name), variable, VariableFlags.None));\n }\n for (const alias of scopeView.aliases) {\n newOps.push(createVariableOp(view.job.allocateXrefId(), alias, alias.expression.clone(), VariableFlags.AlwaysInline));\n }\n // Add variables for all local references declared for elements in this scope.\n for (const ref of scope.references) {\n newOps.push(createVariableOp(view.job.allocateXrefId(), ref.variable, new ReferenceExpr(ref.targetId, ref.targetSlot, ref.offset), VariableFlags.None));\n }\n if (scope.view !== view.xref || isListener) {\n for (const decl of scope.letDeclarations) {\n newOps.push(createVariableOp(view.job.allocateXrefId(), decl.variable, new ContextLetReferenceExpr(decl.targetId, decl.targetSlot), VariableFlags.None));\n }\n }\n if (scope.parent !== null) {\n // Recursively add variables from the parent scope.\n newOps.push(...generateVariablesInScopeForView(view, scope.parent, false));\n }\n return newOps;\n}\n\n/**\n * `ir.ConstCollectedExpr` may be present in any IR expression. This means that expression needs to\n * be lifted into the component const array, and replaced with a reference to the const array at its\n *\n * usage site. This phase walks the IR and performs this transformation.\n */\nfunction collectConstExpressions(job) {\n for (const unit of job.units) {\n for (const op of unit.ops()) {\n transformExpressionsInOp(op, expr => {\n if (!(expr instanceof ConstCollectedExpr)) {\n return expr;\n }\n return literal(job.addConst(expr.expr));\n }, VisitorContextFlag.None);\n }\n }\n}\nconst STYLE_DOT = 'style.';\nconst CLASS_DOT = 'class.';\nconst STYLE_BANG = 'style!';\nconst CLASS_BANG = 'class!';\nconst BANG_IMPORTANT = '!important';\n/**\n * Host bindings are compiled using a different parser entrypoint, and are parsed quite differently\n * as a result. Therefore, we need to do some extra parsing for host style properties, as compared\n * to non-host style properties.\n * TODO: Unify host bindings and non-host bindings in the parser.\n */\nfunction parseHostStyleProperties(job) {\n for (const op of job.root.update) {\n if (!(op.kind === OpKind.Binding && op.bindingKind === BindingKind.Property)) {\n continue;\n }\n if (op.name.endsWith(BANG_IMPORTANT)) {\n // Delete any `!important` suffixes from the binding name.\n op.name = op.name.substring(0, op.name.length - BANG_IMPORTANT.length);\n }\n if (op.name.startsWith(STYLE_DOT)) {\n op.bindingKind = BindingKind.StyleProperty;\n op.name = op.name.substring(STYLE_DOT.length);\n if (!isCssCustomProperty(op.name)) {\n op.name = hyphenate$1(op.name);\n }\n const {\n property,\n suffix\n } = parseProperty(op.name);\n op.name = property;\n op.unit = suffix;\n } else if (op.name.startsWith(STYLE_BANG)) {\n op.bindingKind = BindingKind.StyleProperty;\n op.name = 'style';\n } else if (op.name.startsWith(CLASS_DOT)) {\n op.bindingKind = BindingKind.ClassName;\n op.name = parseProperty(op.name.substring(CLASS_DOT.length)).property;\n } else if (op.name.startsWith(CLASS_BANG)) {\n op.bindingKind = BindingKind.ClassName;\n op.name = parseProperty(op.name.substring(CLASS_BANG.length)).property;\n }\n }\n}\n/**\n * Checks whether property name is a custom CSS property.\n * See: https://www.w3.org/TR/css-variables-1\n */\nfunction isCssCustomProperty(name) {\n return name.startsWith('--');\n}\nfunction hyphenate$1(value) {\n return value.replace(/[a-z][A-Z]/g, v => {\n return v.charAt(0) + '-' + v.charAt(1);\n }).toLowerCase();\n}\nfunction parseProperty(name) {\n const overrideIndex = name.indexOf('!important');\n if (overrideIndex !== -1) {\n name = overrideIndex > 0 ? name.substring(0, overrideIndex) : '';\n }\n let suffix = null;\n let property = name;\n const unitIndex = name.lastIndexOf('.');\n if (unitIndex > 0) {\n suffix = name.slice(unitIndex + 1);\n property = name.substring(0, unitIndex);\n }\n return {\n property,\n suffix\n };\n}\nfunction mapEntry(key, value) {\n return {\n key,\n value,\n quoted: false\n };\n}\nfunction mapLiteral(obj, quoted = false) {\n return literalMap(Object.keys(obj).map(key => ({\n key,\n quoted,\n value: obj[key]\n })));\n}\nclass IcuSerializerVisitor {\n visitText(text) {\n return text.value;\n }\n visitContainer(container) {\n return container.children.map(child => child.visit(this)).join('');\n }\n visitIcu(icu) {\n const strCases = Object.keys(icu.cases).map(k => `${k} {${icu.cases[k].visit(this)}}`);\n const result = `{${icu.expressionPlaceholder}, ${icu.type}, ${strCases.join(' ')}}`;\n return result;\n }\n visitTagPlaceholder(ph) {\n return ph.isVoid ? this.formatPh(ph.startName) : `${this.formatPh(ph.startName)}${ph.children.map(child => child.visit(this)).join('')}${this.formatPh(ph.closeName)}`;\n }\n visitPlaceholder(ph) {\n return this.formatPh(ph.name);\n }\n visitBlockPlaceholder(ph) {\n return `${this.formatPh(ph.startName)}${ph.children.map(child => child.visit(this)).join('')}${this.formatPh(ph.closeName)}`;\n }\n visitIcuPlaceholder(ph, context) {\n return this.formatPh(ph.name);\n }\n formatPh(value) {\n return `{${formatI18nPlaceholderName(value, /* useCamelCase */false)}}`;\n }\n}\nconst serializer = new IcuSerializerVisitor();\nfunction serializeIcuNode(icu) {\n return icu.visit(serializer);\n}\nclass NodeWithI18n {\n constructor(sourceSpan, i18n) {\n this.sourceSpan = sourceSpan;\n this.i18n = i18n;\n }\n}\nclass Text extends NodeWithI18n {\n constructor(value, sourceSpan, tokens, i18n) {\n super(sourceSpan, i18n);\n this.value = value;\n this.tokens = tokens;\n }\n visit(visitor, context) {\n return visitor.visitText(this, context);\n }\n}\nclass Expansion extends NodeWithI18n {\n constructor(switchValue, type, cases, sourceSpan, switchValueSourceSpan, i18n) {\n super(sourceSpan, i18n);\n this.switchValue = switchValue;\n this.type = type;\n this.cases = cases;\n this.switchValueSourceSpan = switchValueSourceSpan;\n }\n visit(visitor, context) {\n return visitor.visitExpansion(this, context);\n }\n}\nclass ExpansionCase {\n constructor(value, expression, sourceSpan, valueSourceSpan, expSourceSpan) {\n this.value = value;\n this.expression = expression;\n this.sourceSpan = sourceSpan;\n this.valueSourceSpan = valueSourceSpan;\n this.expSourceSpan = expSourceSpan;\n }\n visit(visitor, context) {\n return visitor.visitExpansionCase(this, context);\n }\n}\nclass Attribute extends NodeWithI18n {\n constructor(name, value, sourceSpan, keySpan, valueSpan, valueTokens, i18n) {\n super(sourceSpan, i18n);\n this.name = name;\n this.value = value;\n this.keySpan = keySpan;\n this.valueSpan = valueSpan;\n this.valueTokens = valueTokens;\n }\n visit(visitor, context) {\n return visitor.visitAttribute(this, context);\n }\n}\nclass Element extends NodeWithI18n {\n constructor(name, attrs, children, sourceSpan, startSourceSpan, endSourceSpan = null, i18n) {\n super(sourceSpan, i18n);\n this.name = name;\n this.attrs = attrs;\n this.children = children;\n this.startSourceSpan = startSourceSpan;\n this.endSourceSpan = endSourceSpan;\n }\n visit(visitor, context) {\n return visitor.visitElement(this, context);\n }\n}\nclass Comment {\n constructor(value, sourceSpan) {\n this.value = value;\n this.sourceSpan = sourceSpan;\n }\n visit(visitor, context) {\n return visitor.visitComment(this, context);\n }\n}\nclass Block extends NodeWithI18n {\n constructor(name, parameters, children, sourceSpan, nameSpan, startSourceSpan, endSourceSpan = null, i18n) {\n super(sourceSpan, i18n);\n this.name = name;\n this.parameters = parameters;\n this.children = children;\n this.nameSpan = nameSpan;\n this.startSourceSpan = startSourceSpan;\n this.endSourceSpan = endSourceSpan;\n }\n visit(visitor, context) {\n return visitor.visitBlock(this, context);\n }\n}\nclass BlockParameter {\n constructor(expression, sourceSpan) {\n this.expression = expression;\n this.sourceSpan = sourceSpan;\n }\n visit(visitor, context) {\n return visitor.visitBlockParameter(this, context);\n }\n}\nclass LetDeclaration {\n constructor(name, value, sourceSpan, nameSpan, valueSpan) {\n this.name = name;\n this.value = value;\n this.sourceSpan = sourceSpan;\n this.nameSpan = nameSpan;\n this.valueSpan = valueSpan;\n }\n visit(visitor, context) {\n return visitor.visitLetDeclaration(this, context);\n }\n}\nfunction visitAll(visitor, nodes, context = null) {\n const result = [];\n const visit = visitor.visit ? ast => visitor.visit(ast, context) || ast.visit(visitor, context) : ast => ast.visit(visitor, context);\n nodes.forEach(ast => {\n const astResult = visit(ast);\n if (astResult) {\n result.push(astResult);\n }\n });\n return result;\n}\nclass RecursiveVisitor {\n constructor() {}\n visitElement(ast, context) {\n this.visitChildren(context, visit => {\n visit(ast.attrs);\n visit(ast.children);\n });\n }\n visitAttribute(ast, context) {}\n visitText(ast, context) {}\n visitComment(ast, context) {}\n visitExpansion(ast, context) {\n return this.visitChildren(context, visit => {\n visit(ast.cases);\n });\n }\n visitExpansionCase(ast, context) {}\n visitBlock(block, context) {\n this.visitChildren(context, visit => {\n visit(block.parameters);\n visit(block.children);\n });\n }\n visitBlockParameter(ast, context) {}\n visitLetDeclaration(decl, context) {}\n visitChildren(context, cb) {\n let results = [];\n let t = this;\n function visit(children) {\n if (children) results.push(visitAll(t, children, context));\n }\n cb(visit);\n return Array.prototype.concat.apply([], results);\n }\n}\n\n// Mapping between all HTML entity names and their unicode representation.\n// Generated from https://html.spec.whatwg.org/multipage/entities.json by stripping\n// the `&` and `;` from the keys and removing the duplicates.\n// see https://www.w3.org/TR/html51/syntax.html#named-character-references\nconst NAMED_ENTITIES = {\n 'AElig': '\\u00C6',\n 'AMP': '\\u0026',\n 'amp': '\\u0026',\n 'Aacute': '\\u00C1',\n 'Abreve': '\\u0102',\n 'Acirc': '\\u00C2',\n 'Acy': '\\u0410',\n 'Afr': '\\uD835\\uDD04',\n 'Agrave': '\\u00C0',\n 'Alpha': '\\u0391',\n 'Amacr': '\\u0100',\n 'And': '\\u2A53',\n 'Aogon': '\\u0104',\n 'Aopf': '\\uD835\\uDD38',\n 'ApplyFunction': '\\u2061',\n 'af': '\\u2061',\n 'Aring': '\\u00C5',\n 'angst': '\\u00C5',\n 'Ascr': '\\uD835\\uDC9C',\n 'Assign': '\\u2254',\n 'colone': '\\u2254',\n 'coloneq': '\\u2254',\n 'Atilde': '\\u00C3',\n 'Auml': '\\u00C4',\n 'Backslash': '\\u2216',\n 'setminus': '\\u2216',\n 'setmn': '\\u2216',\n 'smallsetminus': '\\u2216',\n 'ssetmn': '\\u2216',\n 'Barv': '\\u2AE7',\n 'Barwed': '\\u2306',\n 'doublebarwedge': '\\u2306',\n 'Bcy': '\\u0411',\n 'Because': '\\u2235',\n 'becaus': '\\u2235',\n 'because': '\\u2235',\n 'Bernoullis': '\\u212C',\n 'Bscr': '\\u212C',\n 'bernou': '\\u212C',\n 'Beta': '\\u0392',\n 'Bfr': '\\uD835\\uDD05',\n 'Bopf': '\\uD835\\uDD39',\n 'Breve': '\\u02D8',\n 'breve': '\\u02D8',\n 'Bumpeq': '\\u224E',\n 'HumpDownHump': '\\u224E',\n 'bump': '\\u224E',\n 'CHcy': '\\u0427',\n 'COPY': '\\u00A9',\n 'copy': '\\u00A9',\n 'Cacute': '\\u0106',\n 'Cap': '\\u22D2',\n 'CapitalDifferentialD': '\\u2145',\n 'DD': '\\u2145',\n 'Cayleys': '\\u212D',\n 'Cfr': '\\u212D',\n 'Ccaron': '\\u010C',\n 'Ccedil': '\\u00C7',\n 'Ccirc': '\\u0108',\n 'Cconint': '\\u2230',\n 'Cdot': '\\u010A',\n 'Cedilla': '\\u00B8',\n 'cedil': '\\u00B8',\n 'CenterDot': '\\u00B7',\n 'centerdot': '\\u00B7',\n 'middot': '\\u00B7',\n 'Chi': '\\u03A7',\n 'CircleDot': '\\u2299',\n 'odot': '\\u2299',\n 'CircleMinus': '\\u2296',\n 'ominus': '\\u2296',\n 'CirclePlus': '\\u2295',\n 'oplus': '\\u2295',\n 'CircleTimes': '\\u2297',\n 'otimes': '\\u2297',\n 'ClockwiseContourIntegral': '\\u2232',\n 'cwconint': '\\u2232',\n 'CloseCurlyDoubleQuote': '\\u201D',\n 'rdquo': '\\u201D',\n 'rdquor': '\\u201D',\n 'CloseCurlyQuote': '\\u2019',\n 'rsquo': '\\u2019',\n 'rsquor': '\\u2019',\n 'Colon': '\\u2237',\n 'Proportion': '\\u2237',\n 'Colone': '\\u2A74',\n 'Congruent': '\\u2261',\n 'equiv': '\\u2261',\n 'Conint': '\\u222F',\n 'DoubleContourIntegral': '\\u222F',\n 'ContourIntegral': '\\u222E',\n 'conint': '\\u222E',\n 'oint': '\\u222E',\n 'Copf': '\\u2102',\n 'complexes': '\\u2102',\n 'Coproduct': '\\u2210',\n 'coprod': '\\u2210',\n 'CounterClockwiseContourIntegral': '\\u2233',\n 'awconint': '\\u2233',\n 'Cross': '\\u2A2F',\n 'Cscr': '\\uD835\\uDC9E',\n 'Cup': '\\u22D3',\n 'CupCap': '\\u224D',\n 'asympeq': '\\u224D',\n 'DDotrahd': '\\u2911',\n 'DJcy': '\\u0402',\n 'DScy': '\\u0405',\n 'DZcy': '\\u040F',\n 'Dagger': '\\u2021',\n 'ddagger': '\\u2021',\n 'Darr': '\\u21A1',\n 'Dashv': '\\u2AE4',\n 'DoubleLeftTee': '\\u2AE4',\n 'Dcaron': '\\u010E',\n 'Dcy': '\\u0414',\n 'Del': '\\u2207',\n 'nabla': '\\u2207',\n 'Delta': '\\u0394',\n 'Dfr': '\\uD835\\uDD07',\n 'DiacriticalAcute': '\\u00B4',\n 'acute': '\\u00B4',\n 'DiacriticalDot': '\\u02D9',\n 'dot': '\\u02D9',\n 'DiacriticalDoubleAcute': '\\u02DD',\n 'dblac': '\\u02DD',\n 'DiacriticalGrave': '\\u0060',\n 'grave': '\\u0060',\n 'DiacriticalTilde': '\\u02DC',\n 'tilde': '\\u02DC',\n 'Diamond': '\\u22C4',\n 'diam': '\\u22C4',\n 'diamond': '\\u22C4',\n 'DifferentialD': '\\u2146',\n 'dd': '\\u2146',\n 'Dopf': '\\uD835\\uDD3B',\n 'Dot': '\\u00A8',\n 'DoubleDot': '\\u00A8',\n 'die': '\\u00A8',\n 'uml': '\\u00A8',\n 'DotDot': '\\u20DC',\n 'DotEqual': '\\u2250',\n 'doteq': '\\u2250',\n 'esdot': '\\u2250',\n 'DoubleDownArrow': '\\u21D3',\n 'Downarrow': '\\u21D3',\n 'dArr': '\\u21D3',\n 'DoubleLeftArrow': '\\u21D0',\n 'Leftarrow': '\\u21D0',\n 'lArr': '\\u21D0',\n 'DoubleLeftRightArrow': '\\u21D4',\n 'Leftrightarrow': '\\u21D4',\n 'hArr': '\\u21D4',\n 'iff': '\\u21D4',\n 'DoubleLongLeftArrow': '\\u27F8',\n 'Longleftarrow': '\\u27F8',\n 'xlArr': '\\u27F8',\n 'DoubleLongLeftRightArrow': '\\u27FA',\n 'Longleftrightarrow': '\\u27FA',\n 'xhArr': '\\u27FA',\n 'DoubleLongRightArrow': '\\u27F9',\n 'Longrightarrow': '\\u27F9',\n 'xrArr': '\\u27F9',\n 'DoubleRightArrow': '\\u21D2',\n 'Implies': '\\u21D2',\n 'Rightarrow': '\\u21D2',\n 'rArr': '\\u21D2',\n 'DoubleRightTee': '\\u22A8',\n 'vDash': '\\u22A8',\n 'DoubleUpArrow': '\\u21D1',\n 'Uparrow': '\\u21D1',\n 'uArr': '\\u21D1',\n 'DoubleUpDownArrow': '\\u21D5',\n 'Updownarrow': '\\u21D5',\n 'vArr': '\\u21D5',\n 'DoubleVerticalBar': '\\u2225',\n 'par': '\\u2225',\n 'parallel': '\\u2225',\n 'shortparallel': '\\u2225',\n 'spar': '\\u2225',\n 'DownArrow': '\\u2193',\n 'ShortDownArrow': '\\u2193',\n 'darr': '\\u2193',\n 'downarrow': '\\u2193',\n 'DownArrowBar': '\\u2913',\n 'DownArrowUpArrow': '\\u21F5',\n 'duarr': '\\u21F5',\n 'DownBreve': '\\u0311',\n 'DownLeftRightVector': '\\u2950',\n 'DownLeftTeeVector': '\\u295E',\n 'DownLeftVector': '\\u21BD',\n 'leftharpoondown': '\\u21BD',\n 'lhard': '\\u21BD',\n 'DownLeftVectorBar': '\\u2956',\n 'DownRightTeeVector': '\\u295F',\n 'DownRightVector': '\\u21C1',\n 'rhard': '\\u21C1',\n 'rightharpoondown': '\\u21C1',\n 'DownRightVectorBar': '\\u2957',\n 'DownTee': '\\u22A4',\n 'top': '\\u22A4',\n 'DownTeeArrow': '\\u21A7',\n 'mapstodown': '\\u21A7',\n 'Dscr': '\\uD835\\uDC9F',\n 'Dstrok': '\\u0110',\n 'ENG': '\\u014A',\n 'ETH': '\\u00D0',\n 'Eacute': '\\u00C9',\n 'Ecaron': '\\u011A',\n 'Ecirc': '\\u00CA',\n 'Ecy': '\\u042D',\n 'Edot': '\\u0116',\n 'Efr': '\\uD835\\uDD08',\n 'Egrave': '\\u00C8',\n 'Element': '\\u2208',\n 'in': '\\u2208',\n 'isin': '\\u2208',\n 'isinv': '\\u2208',\n 'Emacr': '\\u0112',\n 'EmptySmallSquare': '\\u25FB',\n 'EmptyVerySmallSquare': '\\u25AB',\n 'Eogon': '\\u0118',\n 'Eopf': '\\uD835\\uDD3C',\n 'Epsilon': '\\u0395',\n 'Equal': '\\u2A75',\n 'EqualTilde': '\\u2242',\n 'eqsim': '\\u2242',\n 'esim': '\\u2242',\n 'Equilibrium': '\\u21CC',\n 'rightleftharpoons': '\\u21CC',\n 'rlhar': '\\u21CC',\n 'Escr': '\\u2130',\n 'expectation': '\\u2130',\n 'Esim': '\\u2A73',\n 'Eta': '\\u0397',\n 'Euml': '\\u00CB',\n 'Exists': '\\u2203',\n 'exist': '\\u2203',\n 'ExponentialE': '\\u2147',\n 'ee': '\\u2147',\n 'exponentiale': '\\u2147',\n 'Fcy': '\\u0424',\n 'Ffr': '\\uD835\\uDD09',\n 'FilledSmallSquare': '\\u25FC',\n 'FilledVerySmallSquare': '\\u25AA',\n 'blacksquare': '\\u25AA',\n 'squarf': '\\u25AA',\n 'squf': '\\u25AA',\n 'Fopf': '\\uD835\\uDD3D',\n 'ForAll': '\\u2200',\n 'forall': '\\u2200',\n 'Fouriertrf': '\\u2131',\n 'Fscr': '\\u2131',\n 'GJcy': '\\u0403',\n 'GT': '\\u003E',\n 'gt': '\\u003E',\n 'Gamma': '\\u0393',\n 'Gammad': '\\u03DC',\n 'Gbreve': '\\u011E',\n 'Gcedil': '\\u0122',\n 'Gcirc': '\\u011C',\n 'Gcy': '\\u0413',\n 'Gdot': '\\u0120',\n 'Gfr': '\\uD835\\uDD0A',\n 'Gg': '\\u22D9',\n 'ggg': '\\u22D9',\n 'Gopf': '\\uD835\\uDD3E',\n 'GreaterEqual': '\\u2265',\n 'ge': '\\u2265',\n 'geq': '\\u2265',\n 'GreaterEqualLess': '\\u22DB',\n 'gel': '\\u22DB',\n 'gtreqless': '\\u22DB',\n 'GreaterFullEqual': '\\u2267',\n 'gE': '\\u2267',\n 'geqq': '\\u2267',\n 'GreaterGreater': '\\u2AA2',\n 'GreaterLess': '\\u2277',\n 'gl': '\\u2277',\n 'gtrless': '\\u2277',\n 'GreaterSlantEqual': '\\u2A7E',\n 'geqslant': '\\u2A7E',\n 'ges': '\\u2A7E',\n 'GreaterTilde': '\\u2273',\n 'gsim': '\\u2273',\n 'gtrsim': '\\u2273',\n 'Gscr': '\\uD835\\uDCA2',\n 'Gt': '\\u226B',\n 'NestedGreaterGreater': '\\u226B',\n 'gg': '\\u226B',\n 'HARDcy': '\\u042A',\n 'Hacek': '\\u02C7',\n 'caron': '\\u02C7',\n 'Hat': '\\u005E',\n 'Hcirc': '\\u0124',\n 'Hfr': '\\u210C',\n 'Poincareplane': '\\u210C',\n 'HilbertSpace': '\\u210B',\n 'Hscr': '\\u210B',\n 'hamilt': '\\u210B',\n 'Hopf': '\\u210D',\n 'quaternions': '\\u210D',\n 'HorizontalLine': '\\u2500',\n 'boxh': '\\u2500',\n 'Hstrok': '\\u0126',\n 'HumpEqual': '\\u224F',\n 'bumpe': '\\u224F',\n 'bumpeq': '\\u224F',\n 'IEcy': '\\u0415',\n 'IJlig': '\\u0132',\n 'IOcy': '\\u0401',\n 'Iacute': '\\u00CD',\n 'Icirc': '\\u00CE',\n 'Icy': '\\u0418',\n 'Idot': '\\u0130',\n 'Ifr': '\\u2111',\n 'Im': '\\u2111',\n 'image': '\\u2111',\n 'imagpart': '\\u2111',\n 'Igrave': '\\u00CC',\n 'Imacr': '\\u012A',\n 'ImaginaryI': '\\u2148',\n 'ii': '\\u2148',\n 'Int': '\\u222C',\n 'Integral': '\\u222B',\n 'int': '\\u222B',\n 'Intersection': '\\u22C2',\n 'bigcap': '\\u22C2',\n 'xcap': '\\u22C2',\n 'InvisibleComma': '\\u2063',\n 'ic': '\\u2063',\n 'InvisibleTimes': '\\u2062',\n 'it': '\\u2062',\n 'Iogon': '\\u012E',\n 'Iopf': '\\uD835\\uDD40',\n 'Iota': '\\u0399',\n 'Iscr': '\\u2110',\n 'imagline': '\\u2110',\n 'Itilde': '\\u0128',\n 'Iukcy': '\\u0406',\n 'Iuml': '\\u00CF',\n 'Jcirc': '\\u0134',\n 'Jcy': '\\u0419',\n 'Jfr': '\\uD835\\uDD0D',\n 'Jopf': '\\uD835\\uDD41',\n 'Jscr': '\\uD835\\uDCA5',\n 'Jsercy': '\\u0408',\n 'Jukcy': '\\u0404',\n 'KHcy': '\\u0425',\n 'KJcy': '\\u040C',\n 'Kappa': '\\u039A',\n 'Kcedil': '\\u0136',\n 'Kcy': '\\u041A',\n 'Kfr': '\\uD835\\uDD0E',\n 'Kopf': '\\uD835\\uDD42',\n 'Kscr': '\\uD835\\uDCA6',\n 'LJcy': '\\u0409',\n 'LT': '\\u003C',\n 'lt': '\\u003C',\n 'Lacute': '\\u0139',\n 'Lambda': '\\u039B',\n 'Lang': '\\u27EA',\n 'Laplacetrf': '\\u2112',\n 'Lscr': '\\u2112',\n 'lagran': '\\u2112',\n 'Larr': '\\u219E',\n 'twoheadleftarrow': '\\u219E',\n 'Lcaron': '\\u013D',\n 'Lcedil': '\\u013B',\n 'Lcy': '\\u041B',\n 'LeftAngleBracket': '\\u27E8',\n 'lang': '\\u27E8',\n 'langle': '\\u27E8',\n 'LeftArrow': '\\u2190',\n 'ShortLeftArrow': '\\u2190',\n 'larr': '\\u2190',\n 'leftarrow': '\\u2190',\n 'slarr': '\\u2190',\n 'LeftArrowBar': '\\u21E4',\n 'larrb': '\\u21E4',\n 'LeftArrowRightArrow': '\\u21C6',\n 'leftrightarrows': '\\u21C6',\n 'lrarr': '\\u21C6',\n 'LeftCeiling': '\\u2308',\n 'lceil': '\\u2308',\n 'LeftDoubleBracket': '\\u27E6',\n 'lobrk': '\\u27E6',\n 'LeftDownTeeVector': '\\u2961',\n 'LeftDownVector': '\\u21C3',\n 'dharl': '\\u21C3',\n 'downharpoonleft': '\\u21C3',\n 'LeftDownVectorBar': '\\u2959',\n 'LeftFloor': '\\u230A',\n 'lfloor': '\\u230A',\n 'LeftRightArrow': '\\u2194',\n 'harr': '\\u2194',\n 'leftrightarrow': '\\u2194',\n 'LeftRightVector': '\\u294E',\n 'LeftTee': '\\u22A3',\n 'dashv': '\\u22A3',\n 'LeftTeeArrow': '\\u21A4',\n 'mapstoleft': '\\u21A4',\n 'LeftTeeVector': '\\u295A',\n 'LeftTriangle': '\\u22B2',\n 'vartriangleleft': '\\u22B2',\n 'vltri': '\\u22B2',\n 'LeftTriangleBar': '\\u29CF',\n 'LeftTriangleEqual': '\\u22B4',\n 'ltrie': '\\u22B4',\n 'trianglelefteq': '\\u22B4',\n 'LeftUpDownVector': '\\u2951',\n 'LeftUpTeeVector': '\\u2960',\n 'LeftUpVector': '\\u21BF',\n 'uharl': '\\u21BF',\n 'upharpoonleft': '\\u21BF',\n 'LeftUpVectorBar': '\\u2958',\n 'LeftVector': '\\u21BC',\n 'leftharpoonup': '\\u21BC',\n 'lharu': '\\u21BC',\n 'LeftVectorBar': '\\u2952',\n 'LessEqualGreater': '\\u22DA',\n 'leg': '\\u22DA',\n 'lesseqgtr': '\\u22DA',\n 'LessFullEqual': '\\u2266',\n 'lE': '\\u2266',\n 'leqq': '\\u2266',\n 'LessGreater': '\\u2276',\n 'lessgtr': '\\u2276',\n 'lg': '\\u2276',\n 'LessLess': '\\u2AA1',\n 'LessSlantEqual': '\\u2A7D',\n 'leqslant': '\\u2A7D',\n 'les': '\\u2A7D',\n 'LessTilde': '\\u2272',\n 'lesssim': '\\u2272',\n 'lsim': '\\u2272',\n 'Lfr': '\\uD835\\uDD0F',\n 'Ll': '\\u22D8',\n 'Lleftarrow': '\\u21DA',\n 'lAarr': '\\u21DA',\n 'Lmidot': '\\u013F',\n 'LongLeftArrow': '\\u27F5',\n 'longleftarrow': '\\u27F5',\n 'xlarr': '\\u27F5',\n 'LongLeftRightArrow': '\\u27F7',\n 'longleftrightarrow': '\\u27F7',\n 'xharr': '\\u27F7',\n 'LongRightArrow': '\\u27F6',\n 'longrightarrow': '\\u27F6',\n 'xrarr': '\\u27F6',\n 'Lopf': '\\uD835\\uDD43',\n 'LowerLeftArrow': '\\u2199',\n 'swarr': '\\u2199',\n 'swarrow': '\\u2199',\n 'LowerRightArrow': '\\u2198',\n 'searr': '\\u2198',\n 'searrow': '\\u2198',\n 'Lsh': '\\u21B0',\n 'lsh': '\\u21B0',\n 'Lstrok': '\\u0141',\n 'Lt': '\\u226A',\n 'NestedLessLess': '\\u226A',\n 'll': '\\u226A',\n 'Map': '\\u2905',\n 'Mcy': '\\u041C',\n 'MediumSpace': '\\u205F',\n 'Mellintrf': '\\u2133',\n 'Mscr': '\\u2133',\n 'phmmat': '\\u2133',\n 'Mfr': '\\uD835\\uDD10',\n 'MinusPlus': '\\u2213',\n 'mnplus': '\\u2213',\n 'mp': '\\u2213',\n 'Mopf': '\\uD835\\uDD44',\n 'Mu': '\\u039C',\n 'NJcy': '\\u040A',\n 'Nacute': '\\u0143',\n 'Ncaron': '\\u0147',\n 'Ncedil': '\\u0145',\n 'Ncy': '\\u041D',\n 'NegativeMediumSpace': '\\u200B',\n 'NegativeThickSpace': '\\u200B',\n 'NegativeThinSpace': '\\u200B',\n 'NegativeVeryThinSpace': '\\u200B',\n 'ZeroWidthSpace': '\\u200B',\n 'NewLine': '\\u000A',\n 'Nfr': '\\uD835\\uDD11',\n 'NoBreak': '\\u2060',\n 'NonBreakingSpace': '\\u00A0',\n 'nbsp': '\\u00A0',\n 'Nopf': '\\u2115',\n 'naturals': '\\u2115',\n 'Not': '\\u2AEC',\n 'NotCongruent': '\\u2262',\n 'nequiv': '\\u2262',\n 'NotCupCap': '\\u226D',\n 'NotDoubleVerticalBar': '\\u2226',\n 'npar': '\\u2226',\n 'nparallel': '\\u2226',\n 'nshortparallel': '\\u2226',\n 'nspar': '\\u2226',\n 'NotElement': '\\u2209',\n 'notin': '\\u2209',\n 'notinva': '\\u2209',\n 'NotEqual': '\\u2260',\n 'ne': '\\u2260',\n 'NotEqualTilde': '\\u2242\\u0338',\n 'nesim': '\\u2242\\u0338',\n 'NotExists': '\\u2204',\n 'nexist': '\\u2204',\n 'nexists': '\\u2204',\n 'NotGreater': '\\u226F',\n 'ngt': '\\u226F',\n 'ngtr': '\\u226F',\n 'NotGreaterEqual': '\\u2271',\n 'nge': '\\u2271',\n 'ngeq': '\\u2271',\n 'NotGreaterFullEqual': '\\u2267\\u0338',\n 'ngE': '\\u2267\\u0338',\n 'ngeqq': '\\u2267\\u0338',\n 'NotGreaterGreater': '\\u226B\\u0338',\n 'nGtv': '\\u226B\\u0338',\n 'NotGreaterLess': '\\u2279',\n 'ntgl': '\\u2279',\n 'NotGreaterSlantEqual': '\\u2A7E\\u0338',\n 'ngeqslant': '\\u2A7E\\u0338',\n 'nges': '\\u2A7E\\u0338',\n 'NotGreaterTilde': '\\u2275',\n 'ngsim': '\\u2275',\n 'NotHumpDownHump': '\\u224E\\u0338',\n 'nbump': '\\u224E\\u0338',\n 'NotHumpEqual': '\\u224F\\u0338',\n 'nbumpe': '\\u224F\\u0338',\n 'NotLeftTriangle': '\\u22EA',\n 'nltri': '\\u22EA',\n 'ntriangleleft': '\\u22EA',\n 'NotLeftTriangleBar': '\\u29CF\\u0338',\n 'NotLeftTriangleEqual': '\\u22EC',\n 'nltrie': '\\u22EC',\n 'ntrianglelefteq': '\\u22EC',\n 'NotLess': '\\u226E',\n 'nless': '\\u226E',\n 'nlt': '\\u226E',\n 'NotLessEqual': '\\u2270',\n 'nle': '\\u2270',\n 'nleq': '\\u2270',\n 'NotLessGreater': '\\u2278',\n 'ntlg': '\\u2278',\n 'NotLessLess': '\\u226A\\u0338',\n 'nLtv': '\\u226A\\u0338',\n 'NotLessSlantEqual': '\\u2A7D\\u0338',\n 'nleqslant': '\\u2A7D\\u0338',\n 'nles': '\\u2A7D\\u0338',\n 'NotLessTilde': '\\u2274',\n 'nlsim': '\\u2274',\n 'NotNestedGreaterGreater': '\\u2AA2\\u0338',\n 'NotNestedLessLess': '\\u2AA1\\u0338',\n 'NotPrecedes': '\\u2280',\n 'npr': '\\u2280',\n 'nprec': '\\u2280',\n 'NotPrecedesEqual': '\\u2AAF\\u0338',\n 'npre': '\\u2AAF\\u0338',\n 'npreceq': '\\u2AAF\\u0338',\n 'NotPrecedesSlantEqual': '\\u22E0',\n 'nprcue': '\\u22E0',\n 'NotReverseElement': '\\u220C',\n 'notni': '\\u220C',\n 'notniva': '\\u220C',\n 'NotRightTriangle': '\\u22EB',\n 'nrtri': '\\u22EB',\n 'ntriangleright': '\\u22EB',\n 'NotRightTriangleBar': '\\u29D0\\u0338',\n 'NotRightTriangleEqual': '\\u22ED',\n 'nrtrie': '\\u22ED',\n 'ntrianglerighteq': '\\u22ED',\n 'NotSquareSubset': '\\u228F\\u0338',\n 'NotSquareSubsetEqual': '\\u22E2',\n 'nsqsube': '\\u22E2',\n 'NotSquareSuperset': '\\u2290\\u0338',\n 'NotSquareSupersetEqual': '\\u22E3',\n 'nsqsupe': '\\u22E3',\n 'NotSubset': '\\u2282\\u20D2',\n 'nsubset': '\\u2282\\u20D2',\n 'vnsub': '\\u2282\\u20D2',\n 'NotSubsetEqual': '\\u2288',\n 'nsube': '\\u2288',\n 'nsubseteq': '\\u2288',\n 'NotSucceeds': '\\u2281',\n 'nsc': '\\u2281',\n 'nsucc': '\\u2281',\n 'NotSucceedsEqual': '\\u2AB0\\u0338',\n 'nsce': '\\u2AB0\\u0338',\n 'nsucceq': '\\u2AB0\\u0338',\n 'NotSucceedsSlantEqual': '\\u22E1',\n 'nsccue': '\\u22E1',\n 'NotSucceedsTilde': '\\u227F\\u0338',\n 'NotSuperset': '\\u2283\\u20D2',\n 'nsupset': '\\u2283\\u20D2',\n 'vnsup': '\\u2283\\u20D2',\n 'NotSupersetEqual': '\\u2289',\n 'nsupe': '\\u2289',\n 'nsupseteq': '\\u2289',\n 'NotTilde': '\\u2241',\n 'nsim': '\\u2241',\n 'NotTildeEqual': '\\u2244',\n 'nsime': '\\u2244',\n 'nsimeq': '\\u2244',\n 'NotTildeFullEqual': '\\u2247',\n 'ncong': '\\u2247',\n 'NotTildeTilde': '\\u2249',\n 'nap': '\\u2249',\n 'napprox': '\\u2249',\n 'NotVerticalBar': '\\u2224',\n 'nmid': '\\u2224',\n 'nshortmid': '\\u2224',\n 'nsmid': '\\u2224',\n 'Nscr': '\\uD835\\uDCA9',\n 'Ntilde': '\\u00D1',\n 'Nu': '\\u039D',\n 'OElig': '\\u0152',\n 'Oacute': '\\u00D3',\n 'Ocirc': '\\u00D4',\n 'Ocy': '\\u041E',\n 'Odblac': '\\u0150',\n 'Ofr': '\\uD835\\uDD12',\n 'Ograve': '\\u00D2',\n 'Omacr': '\\u014C',\n 'Omega': '\\u03A9',\n 'ohm': '\\u03A9',\n 'Omicron': '\\u039F',\n 'Oopf': '\\uD835\\uDD46',\n 'OpenCurlyDoubleQuote': '\\u201C',\n 'ldquo': '\\u201C',\n 'OpenCurlyQuote': '\\u2018',\n 'lsquo': '\\u2018',\n 'Or': '\\u2A54',\n 'Oscr': '\\uD835\\uDCAA',\n 'Oslash': '\\u00D8',\n 'Otilde': '\\u00D5',\n 'Otimes': '\\u2A37',\n 'Ouml': '\\u00D6',\n 'OverBar': '\\u203E',\n 'oline': '\\u203E',\n 'OverBrace': '\\u23DE',\n 'OverBracket': '\\u23B4',\n 'tbrk': '\\u23B4',\n 'OverParenthesis': '\\u23DC',\n 'PartialD': '\\u2202',\n 'part': '\\u2202',\n 'Pcy': '\\u041F',\n 'Pfr': '\\uD835\\uDD13',\n 'Phi': '\\u03A6',\n 'Pi': '\\u03A0',\n 'PlusMinus': '\\u00B1',\n 'plusmn': '\\u00B1',\n 'pm': '\\u00B1',\n 'Popf': '\\u2119',\n 'primes': '\\u2119',\n 'Pr': '\\u2ABB',\n 'Precedes': '\\u227A',\n 'pr': '\\u227A',\n 'prec': '\\u227A',\n 'PrecedesEqual': '\\u2AAF',\n 'pre': '\\u2AAF',\n 'preceq': '\\u2AAF',\n 'PrecedesSlantEqual': '\\u227C',\n 'prcue': '\\u227C',\n 'preccurlyeq': '\\u227C',\n 'PrecedesTilde': '\\u227E',\n 'precsim': '\\u227E',\n 'prsim': '\\u227E',\n 'Prime': '\\u2033',\n 'Product': '\\u220F',\n 'prod': '\\u220F',\n 'Proportional': '\\u221D',\n 'prop': '\\u221D',\n 'propto': '\\u221D',\n 'varpropto': '\\u221D',\n 'vprop': '\\u221D',\n 'Pscr': '\\uD835\\uDCAB',\n 'Psi': '\\u03A8',\n 'QUOT': '\\u0022',\n 'quot': '\\u0022',\n 'Qfr': '\\uD835\\uDD14',\n 'Qopf': '\\u211A',\n 'rationals': '\\u211A',\n 'Qscr': '\\uD835\\uDCAC',\n 'RBarr': '\\u2910',\n 'drbkarow': '\\u2910',\n 'REG': '\\u00AE',\n 'circledR': '\\u00AE',\n 'reg': '\\u00AE',\n 'Racute': '\\u0154',\n 'Rang': '\\u27EB',\n 'Rarr': '\\u21A0',\n 'twoheadrightarrow': '\\u21A0',\n 'Rarrtl': '\\u2916',\n 'Rcaron': '\\u0158',\n 'Rcedil': '\\u0156',\n 'Rcy': '\\u0420',\n 'Re': '\\u211C',\n 'Rfr': '\\u211C',\n 'real': '\\u211C',\n 'realpart': '\\u211C',\n 'ReverseElement': '\\u220B',\n 'SuchThat': '\\u220B',\n 'ni': '\\u220B',\n 'niv': '\\u220B',\n 'ReverseEquilibrium': '\\u21CB',\n 'leftrightharpoons': '\\u21CB',\n 'lrhar': '\\u21CB',\n 'ReverseUpEquilibrium': '\\u296F',\n 'duhar': '\\u296F',\n 'Rho': '\\u03A1',\n 'RightAngleBracket': '\\u27E9',\n 'rang': '\\u27E9',\n 'rangle': '\\u27E9',\n 'RightArrow': '\\u2192',\n 'ShortRightArrow': '\\u2192',\n 'rarr': '\\u2192',\n 'rightarrow': '\\u2192',\n 'srarr': '\\u2192',\n 'RightArrowBar': '\\u21E5',\n 'rarrb': '\\u21E5',\n 'RightArrowLeftArrow': '\\u21C4',\n 'rightleftarrows': '\\u21C4',\n 'rlarr': '\\u21C4',\n 'RightCeiling': '\\u2309',\n 'rceil': '\\u2309',\n 'RightDoubleBracket': '\\u27E7',\n 'robrk': '\\u27E7',\n 'RightDownTeeVector': '\\u295D',\n 'RightDownVector': '\\u21C2',\n 'dharr': '\\u21C2',\n 'downharpoonright': '\\u21C2',\n 'RightDownVectorBar': '\\u2955',\n 'RightFloor': '\\u230B',\n 'rfloor': '\\u230B',\n 'RightTee': '\\u22A2',\n 'vdash': '\\u22A2',\n 'RightTeeArrow': '\\u21A6',\n 'map': '\\u21A6',\n 'mapsto': '\\u21A6',\n 'RightTeeVector': '\\u295B',\n 'RightTriangle': '\\u22B3',\n 'vartriangleright': '\\u22B3',\n 'vrtri': '\\u22B3',\n 'RightTriangleBar': '\\u29D0',\n 'RightTriangleEqual': '\\u22B5',\n 'rtrie': '\\u22B5',\n 'trianglerighteq': '\\u22B5',\n 'RightUpDownVector': '\\u294F',\n 'RightUpTeeVector': '\\u295C',\n 'RightUpVector': '\\u21BE',\n 'uharr': '\\u21BE',\n 'upharpoonright': '\\u21BE',\n 'RightUpVectorBar': '\\u2954',\n 'RightVector': '\\u21C0',\n 'rharu': '\\u21C0',\n 'rightharpoonup': '\\u21C0',\n 'RightVectorBar': '\\u2953',\n 'Ropf': '\\u211D',\n 'reals': '\\u211D',\n 'RoundImplies': '\\u2970',\n 'Rrightarrow': '\\u21DB',\n 'rAarr': '\\u21DB',\n 'Rscr': '\\u211B',\n 'realine': '\\u211B',\n 'Rsh': '\\u21B1',\n 'rsh': '\\u21B1',\n 'RuleDelayed': '\\u29F4',\n 'SHCHcy': '\\u0429',\n 'SHcy': '\\u0428',\n 'SOFTcy': '\\u042C',\n 'Sacute': '\\u015A',\n 'Sc': '\\u2ABC',\n 'Scaron': '\\u0160',\n 'Scedil': '\\u015E',\n 'Scirc': '\\u015C',\n 'Scy': '\\u0421',\n 'Sfr': '\\uD835\\uDD16',\n 'ShortUpArrow': '\\u2191',\n 'UpArrow': '\\u2191',\n 'uarr': '\\u2191',\n 'uparrow': '\\u2191',\n 'Sigma': '\\u03A3',\n 'SmallCircle': '\\u2218',\n 'compfn': '\\u2218',\n 'Sopf': '\\uD835\\uDD4A',\n 'Sqrt': '\\u221A',\n 'radic': '\\u221A',\n 'Square': '\\u25A1',\n 'squ': '\\u25A1',\n 'square': '\\u25A1',\n 'SquareIntersection': '\\u2293',\n 'sqcap': '\\u2293',\n 'SquareSubset': '\\u228F',\n 'sqsub': '\\u228F',\n 'sqsubset': '\\u228F',\n 'SquareSubsetEqual': '\\u2291',\n 'sqsube': '\\u2291',\n 'sqsubseteq': '\\u2291',\n 'SquareSuperset': '\\u2290',\n 'sqsup': '\\u2290',\n 'sqsupset': '\\u2290',\n 'SquareSupersetEqual': '\\u2292',\n 'sqsupe': '\\u2292',\n 'sqsupseteq': '\\u2292',\n 'SquareUnion': '\\u2294',\n 'sqcup': '\\u2294',\n 'Sscr': '\\uD835\\uDCAE',\n 'Star': '\\u22C6',\n 'sstarf': '\\u22C6',\n 'Sub': '\\u22D0',\n 'Subset': '\\u22D0',\n 'SubsetEqual': '\\u2286',\n 'sube': '\\u2286',\n 'subseteq': '\\u2286',\n 'Succeeds': '\\u227B',\n 'sc': '\\u227B',\n 'succ': '\\u227B',\n 'SucceedsEqual': '\\u2AB0',\n 'sce': '\\u2AB0',\n 'succeq': '\\u2AB0',\n 'SucceedsSlantEqual': '\\u227D',\n 'sccue': '\\u227D',\n 'succcurlyeq': '\\u227D',\n 'SucceedsTilde': '\\u227F',\n 'scsim': '\\u227F',\n 'succsim': '\\u227F',\n 'Sum': '\\u2211',\n 'sum': '\\u2211',\n 'Sup': '\\u22D1',\n 'Supset': '\\u22D1',\n 'Superset': '\\u2283',\n 'sup': '\\u2283',\n 'supset': '\\u2283',\n 'SupersetEqual': '\\u2287',\n 'supe': '\\u2287',\n 'supseteq': '\\u2287',\n 'THORN': '\\u00DE',\n 'TRADE': '\\u2122',\n 'trade': '\\u2122',\n 'TSHcy': '\\u040B',\n 'TScy': '\\u0426',\n 'Tab': '\\u0009',\n 'Tau': '\\u03A4',\n 'Tcaron': '\\u0164',\n 'Tcedil': '\\u0162',\n 'Tcy': '\\u0422',\n 'Tfr': '\\uD835\\uDD17',\n 'Therefore': '\\u2234',\n 'there4': '\\u2234',\n 'therefore': '\\u2234',\n 'Theta': '\\u0398',\n 'ThickSpace': '\\u205F\\u200A',\n 'ThinSpace': '\\u2009',\n 'thinsp': '\\u2009',\n 'Tilde': '\\u223C',\n 'sim': '\\u223C',\n 'thicksim': '\\u223C',\n 'thksim': '\\u223C',\n 'TildeEqual': '\\u2243',\n 'sime': '\\u2243',\n 'simeq': '\\u2243',\n 'TildeFullEqual': '\\u2245',\n 'cong': '\\u2245',\n 'TildeTilde': '\\u2248',\n 'ap': '\\u2248',\n 'approx': '\\u2248',\n 'asymp': '\\u2248',\n 'thickapprox': '\\u2248',\n 'thkap': '\\u2248',\n 'Topf': '\\uD835\\uDD4B',\n 'TripleDot': '\\u20DB',\n 'tdot': '\\u20DB',\n 'Tscr': '\\uD835\\uDCAF',\n 'Tstrok': '\\u0166',\n 'Uacute': '\\u00DA',\n 'Uarr': '\\u219F',\n 'Uarrocir': '\\u2949',\n 'Ubrcy': '\\u040E',\n 'Ubreve': '\\u016C',\n 'Ucirc': '\\u00DB',\n 'Ucy': '\\u0423',\n 'Udblac': '\\u0170',\n 'Ufr': '\\uD835\\uDD18',\n 'Ugrave': '\\u00D9',\n 'Umacr': '\\u016A',\n 'UnderBar': '\\u005F',\n 'lowbar': '\\u005F',\n 'UnderBrace': '\\u23DF',\n 'UnderBracket': '\\u23B5',\n 'bbrk': '\\u23B5',\n 'UnderParenthesis': '\\u23DD',\n 'Union': '\\u22C3',\n 'bigcup': '\\u22C3',\n 'xcup': '\\u22C3',\n 'UnionPlus': '\\u228E',\n 'uplus': '\\u228E',\n 'Uogon': '\\u0172',\n 'Uopf': '\\uD835\\uDD4C',\n 'UpArrowBar': '\\u2912',\n 'UpArrowDownArrow': '\\u21C5',\n 'udarr': '\\u21C5',\n 'UpDownArrow': '\\u2195',\n 'updownarrow': '\\u2195',\n 'varr': '\\u2195',\n 'UpEquilibrium': '\\u296E',\n 'udhar': '\\u296E',\n 'UpTee': '\\u22A5',\n 'bot': '\\u22A5',\n 'bottom': '\\u22A5',\n 'perp': '\\u22A5',\n 'UpTeeArrow': '\\u21A5',\n 'mapstoup': '\\u21A5',\n 'UpperLeftArrow': '\\u2196',\n 'nwarr': '\\u2196',\n 'nwarrow': '\\u2196',\n 'UpperRightArrow': '\\u2197',\n 'nearr': '\\u2197',\n 'nearrow': '\\u2197',\n 'Upsi': '\\u03D2',\n 'upsih': '\\u03D2',\n 'Upsilon': '\\u03A5',\n 'Uring': '\\u016E',\n 'Uscr': '\\uD835\\uDCB0',\n 'Utilde': '\\u0168',\n 'Uuml': '\\u00DC',\n 'VDash': '\\u22AB',\n 'Vbar': '\\u2AEB',\n 'Vcy': '\\u0412',\n 'Vdash': '\\u22A9',\n 'Vdashl': '\\u2AE6',\n 'Vee': '\\u22C1',\n 'bigvee': '\\u22C1',\n 'xvee': '\\u22C1',\n 'Verbar': '\\u2016',\n 'Vert': '\\u2016',\n 'VerticalBar': '\\u2223',\n 'mid': '\\u2223',\n 'shortmid': '\\u2223',\n 'smid': '\\u2223',\n 'VerticalLine': '\\u007C',\n 'verbar': '\\u007C',\n 'vert': '\\u007C',\n 'VerticalSeparator': '\\u2758',\n 'VerticalTilde': '\\u2240',\n 'wr': '\\u2240',\n 'wreath': '\\u2240',\n 'VeryThinSpace': '\\u200A',\n 'hairsp': '\\u200A',\n 'Vfr': '\\uD835\\uDD19',\n 'Vopf': '\\uD835\\uDD4D',\n 'Vscr': '\\uD835\\uDCB1',\n 'Vvdash': '\\u22AA',\n 'Wcirc': '\\u0174',\n 'Wedge': '\\u22C0',\n 'bigwedge': '\\u22C0',\n 'xwedge': '\\u22C0',\n 'Wfr': '\\uD835\\uDD1A',\n 'Wopf': '\\uD835\\uDD4E',\n 'Wscr': '\\uD835\\uDCB2',\n 'Xfr': '\\uD835\\uDD1B',\n 'Xi': '\\u039E',\n 'Xopf': '\\uD835\\uDD4F',\n 'Xscr': '\\uD835\\uDCB3',\n 'YAcy': '\\u042F',\n 'YIcy': '\\u0407',\n 'YUcy': '\\u042E',\n 'Yacute': '\\u00DD',\n 'Ycirc': '\\u0176',\n 'Ycy': '\\u042B',\n 'Yfr': '\\uD835\\uDD1C',\n 'Yopf': '\\uD835\\uDD50',\n 'Yscr': '\\uD835\\uDCB4',\n 'Yuml': '\\u0178',\n 'ZHcy': '\\u0416',\n 'Zacute': '\\u0179',\n 'Zcaron': '\\u017D',\n 'Zcy': '\\u0417',\n 'Zdot': '\\u017B',\n 'Zeta': '\\u0396',\n 'Zfr': '\\u2128',\n 'zeetrf': '\\u2128',\n 'Zopf': '\\u2124',\n 'integers': '\\u2124',\n 'Zscr': '\\uD835\\uDCB5',\n 'aacute': '\\u00E1',\n 'abreve': '\\u0103',\n 'ac': '\\u223E',\n 'mstpos': '\\u223E',\n 'acE': '\\u223E\\u0333',\n 'acd': '\\u223F',\n 'acirc': '\\u00E2',\n 'acy': '\\u0430',\n 'aelig': '\\u00E6',\n 'afr': '\\uD835\\uDD1E',\n 'agrave': '\\u00E0',\n 'alefsym': '\\u2135',\n 'aleph': '\\u2135',\n 'alpha': '\\u03B1',\n 'amacr': '\\u0101',\n 'amalg': '\\u2A3F',\n 'and': '\\u2227',\n 'wedge': '\\u2227',\n 'andand': '\\u2A55',\n 'andd': '\\u2A5C',\n 'andslope': '\\u2A58',\n 'andv': '\\u2A5A',\n 'ang': '\\u2220',\n 'angle': '\\u2220',\n 'ange': '\\u29A4',\n 'angmsd': '\\u2221',\n 'measuredangle': '\\u2221',\n 'angmsdaa': '\\u29A8',\n 'angmsdab': '\\u29A9',\n 'angmsdac': '\\u29AA',\n 'angmsdad': '\\u29AB',\n 'angmsdae': '\\u29AC',\n 'angmsdaf': '\\u29AD',\n 'angmsdag': '\\u29AE',\n 'angmsdah': '\\u29AF',\n 'angrt': '\\u221F',\n 'angrtvb': '\\u22BE',\n 'angrtvbd': '\\u299D',\n 'angsph': '\\u2222',\n 'angzarr': '\\u237C',\n 'aogon': '\\u0105',\n 'aopf': '\\uD835\\uDD52',\n 'apE': '\\u2A70',\n 'apacir': '\\u2A6F',\n 'ape': '\\u224A',\n 'approxeq': '\\u224A',\n 'apid': '\\u224B',\n 'apos': '\\u0027',\n 'aring': '\\u00E5',\n 'ascr': '\\uD835\\uDCB6',\n 'ast': '\\u002A',\n 'midast': '\\u002A',\n 'atilde': '\\u00E3',\n 'auml': '\\u00E4',\n 'awint': '\\u2A11',\n 'bNot': '\\u2AED',\n 'backcong': '\\u224C',\n 'bcong': '\\u224C',\n 'backepsilon': '\\u03F6',\n 'bepsi': '\\u03F6',\n 'backprime': '\\u2035',\n 'bprime': '\\u2035',\n 'backsim': '\\u223D',\n 'bsim': '\\u223D',\n 'backsimeq': '\\u22CD',\n 'bsime': '\\u22CD',\n 'barvee': '\\u22BD',\n 'barwed': '\\u2305',\n 'barwedge': '\\u2305',\n 'bbrktbrk': '\\u23B6',\n 'bcy': '\\u0431',\n 'bdquo': '\\u201E',\n 'ldquor': '\\u201E',\n 'bemptyv': '\\u29B0',\n 'beta': '\\u03B2',\n 'beth': '\\u2136',\n 'between': '\\u226C',\n 'twixt': '\\u226C',\n 'bfr': '\\uD835\\uDD1F',\n 'bigcirc': '\\u25EF',\n 'xcirc': '\\u25EF',\n 'bigodot': '\\u2A00',\n 'xodot': '\\u2A00',\n 'bigoplus': '\\u2A01',\n 'xoplus': '\\u2A01',\n 'bigotimes': '\\u2A02',\n 'xotime': '\\u2A02',\n 'bigsqcup': '\\u2A06',\n 'xsqcup': '\\u2A06',\n 'bigstar': '\\u2605',\n 'starf': '\\u2605',\n 'bigtriangledown': '\\u25BD',\n 'xdtri': '\\u25BD',\n 'bigtriangleup': '\\u25B3',\n 'xutri': '\\u25B3',\n 'biguplus': '\\u2A04',\n 'xuplus': '\\u2A04',\n 'bkarow': '\\u290D',\n 'rbarr': '\\u290D',\n 'blacklozenge': '\\u29EB',\n 'lozf': '\\u29EB',\n 'blacktriangle': '\\u25B4',\n 'utrif': '\\u25B4',\n 'blacktriangledown': '\\u25BE',\n 'dtrif': '\\u25BE',\n 'blacktriangleleft': '\\u25C2',\n 'ltrif': '\\u25C2',\n 'blacktriangleright': '\\u25B8',\n 'rtrif': '\\u25B8',\n 'blank': '\\u2423',\n 'blk12': '\\u2592',\n 'blk14': '\\u2591',\n 'blk34': '\\u2593',\n 'block': '\\u2588',\n 'bne': '\\u003D\\u20E5',\n 'bnequiv': '\\u2261\\u20E5',\n 'bnot': '\\u2310',\n 'bopf': '\\uD835\\uDD53',\n 'bowtie': '\\u22C8',\n 'boxDL': '\\u2557',\n 'boxDR': '\\u2554',\n 'boxDl': '\\u2556',\n 'boxDr': '\\u2553',\n 'boxH': '\\u2550',\n 'boxHD': '\\u2566',\n 'boxHU': '\\u2569',\n 'boxHd': '\\u2564',\n 'boxHu': '\\u2567',\n 'boxUL': '\\u255D',\n 'boxUR': '\\u255A',\n 'boxUl': '\\u255C',\n 'boxUr': '\\u2559',\n 'boxV': '\\u2551',\n 'boxVH': '\\u256C',\n 'boxVL': '\\u2563',\n 'boxVR': '\\u2560',\n 'boxVh': '\\u256B',\n 'boxVl': '\\u2562',\n 'boxVr': '\\u255F',\n 'boxbox': '\\u29C9',\n 'boxdL': '\\u2555',\n 'boxdR': '\\u2552',\n 'boxdl': '\\u2510',\n 'boxdr': '\\u250C',\n 'boxhD': '\\u2565',\n 'boxhU': '\\u2568',\n 'boxhd': '\\u252C',\n 'boxhu': '\\u2534',\n 'boxminus': '\\u229F',\n 'minusb': '\\u229F',\n 'boxplus': '\\u229E',\n 'plusb': '\\u229E',\n 'boxtimes': '\\u22A0',\n 'timesb': '\\u22A0',\n 'boxuL': '\\u255B',\n 'boxuR': '\\u2558',\n 'boxul': '\\u2518',\n 'boxur': '\\u2514',\n 'boxv': '\\u2502',\n 'boxvH': '\\u256A',\n 'boxvL': '\\u2561',\n 'boxvR': '\\u255E',\n 'boxvh': '\\u253C',\n 'boxvl': '\\u2524',\n 'boxvr': '\\u251C',\n 'brvbar': '\\u00A6',\n 'bscr': '\\uD835\\uDCB7',\n 'bsemi': '\\u204F',\n 'bsol': '\\u005C',\n 'bsolb': '\\u29C5',\n 'bsolhsub': '\\u27C8',\n 'bull': '\\u2022',\n 'bullet': '\\u2022',\n 'bumpE': '\\u2AAE',\n 'cacute': '\\u0107',\n 'cap': '\\u2229',\n 'capand': '\\u2A44',\n 'capbrcup': '\\u2A49',\n 'capcap': '\\u2A4B',\n 'capcup': '\\u2A47',\n 'capdot': '\\u2A40',\n 'caps': '\\u2229\\uFE00',\n 'caret': '\\u2041',\n 'ccaps': '\\u2A4D',\n 'ccaron': '\\u010D',\n 'ccedil': '\\u00E7',\n 'ccirc': '\\u0109',\n 'ccups': '\\u2A4C',\n 'ccupssm': '\\u2A50',\n 'cdot': '\\u010B',\n 'cemptyv': '\\u29B2',\n 'cent': '\\u00A2',\n 'cfr': '\\uD835\\uDD20',\n 'chcy': '\\u0447',\n 'check': '\\u2713',\n 'checkmark': '\\u2713',\n 'chi': '\\u03C7',\n 'cir': '\\u25CB',\n 'cirE': '\\u29C3',\n 'circ': '\\u02C6',\n 'circeq': '\\u2257',\n 'cire': '\\u2257',\n 'circlearrowleft': '\\u21BA',\n 'olarr': '\\u21BA',\n 'circlearrowright': '\\u21BB',\n 'orarr': '\\u21BB',\n 'circledS': '\\u24C8',\n 'oS': '\\u24C8',\n 'circledast': '\\u229B',\n 'oast': '\\u229B',\n 'circledcirc': '\\u229A',\n 'ocir': '\\u229A',\n 'circleddash': '\\u229D',\n 'odash': '\\u229D',\n 'cirfnint': '\\u2A10',\n 'cirmid': '\\u2AEF',\n 'cirscir': '\\u29C2',\n 'clubs': '\\u2663',\n 'clubsuit': '\\u2663',\n 'colon': '\\u003A',\n 'comma': '\\u002C',\n 'commat': '\\u0040',\n 'comp': '\\u2201',\n 'complement': '\\u2201',\n 'congdot': '\\u2A6D',\n 'copf': '\\uD835\\uDD54',\n 'copysr': '\\u2117',\n 'crarr': '\\u21B5',\n 'cross': '\\u2717',\n 'cscr': '\\uD835\\uDCB8',\n 'csub': '\\u2ACF',\n 'csube': '\\u2AD1',\n 'csup': '\\u2AD0',\n 'csupe': '\\u2AD2',\n 'ctdot': '\\u22EF',\n 'cudarrl': '\\u2938',\n 'cudarrr': '\\u2935',\n 'cuepr': '\\u22DE',\n 'curlyeqprec': '\\u22DE',\n 'cuesc': '\\u22DF',\n 'curlyeqsucc': '\\u22DF',\n 'cularr': '\\u21B6',\n 'curvearrowleft': '\\u21B6',\n 'cularrp': '\\u293D',\n 'cup': '\\u222A',\n 'cupbrcap': '\\u2A48',\n 'cupcap': '\\u2A46',\n 'cupcup': '\\u2A4A',\n 'cupdot': '\\u228D',\n 'cupor': '\\u2A45',\n 'cups': '\\u222A\\uFE00',\n 'curarr': '\\u21B7',\n 'curvearrowright': '\\u21B7',\n 'curarrm': '\\u293C',\n 'curlyvee': '\\u22CE',\n 'cuvee': '\\u22CE',\n 'curlywedge': '\\u22CF',\n 'cuwed': '\\u22CF',\n 'curren': '\\u00A4',\n 'cwint': '\\u2231',\n 'cylcty': '\\u232D',\n 'dHar': '\\u2965',\n 'dagger': '\\u2020',\n 'daleth': '\\u2138',\n 'dash': '\\u2010',\n 'hyphen': '\\u2010',\n 'dbkarow': '\\u290F',\n 'rBarr': '\\u290F',\n 'dcaron': '\\u010F',\n 'dcy': '\\u0434',\n 'ddarr': '\\u21CA',\n 'downdownarrows': '\\u21CA',\n 'ddotseq': '\\u2A77',\n 'eDDot': '\\u2A77',\n 'deg': '\\u00B0',\n 'delta': '\\u03B4',\n 'demptyv': '\\u29B1',\n 'dfisht': '\\u297F',\n 'dfr': '\\uD835\\uDD21',\n 'diamondsuit': '\\u2666',\n 'diams': '\\u2666',\n 'digamma': '\\u03DD',\n 'gammad': '\\u03DD',\n 'disin': '\\u22F2',\n 'div': '\\u00F7',\n 'divide': '\\u00F7',\n 'divideontimes': '\\u22C7',\n 'divonx': '\\u22C7',\n 'djcy': '\\u0452',\n 'dlcorn': '\\u231E',\n 'llcorner': '\\u231E',\n 'dlcrop': '\\u230D',\n 'dollar': '\\u0024',\n 'dopf': '\\uD835\\uDD55',\n 'doteqdot': '\\u2251',\n 'eDot': '\\u2251',\n 'dotminus': '\\u2238',\n 'minusd': '\\u2238',\n 'dotplus': '\\u2214',\n 'plusdo': '\\u2214',\n 'dotsquare': '\\u22A1',\n 'sdotb': '\\u22A1',\n 'drcorn': '\\u231F',\n 'lrcorner': '\\u231F',\n 'drcrop': '\\u230C',\n 'dscr': '\\uD835\\uDCB9',\n 'dscy': '\\u0455',\n 'dsol': '\\u29F6',\n 'dstrok': '\\u0111',\n 'dtdot': '\\u22F1',\n 'dtri': '\\u25BF',\n 'triangledown': '\\u25BF',\n 'dwangle': '\\u29A6',\n 'dzcy': '\\u045F',\n 'dzigrarr': '\\u27FF',\n 'eacute': '\\u00E9',\n 'easter': '\\u2A6E',\n 'ecaron': '\\u011B',\n 'ecir': '\\u2256',\n 'eqcirc': '\\u2256',\n 'ecirc': '\\u00EA',\n 'ecolon': '\\u2255',\n 'eqcolon': '\\u2255',\n 'ecy': '\\u044D',\n 'edot': '\\u0117',\n 'efDot': '\\u2252',\n 'fallingdotseq': '\\u2252',\n 'efr': '\\uD835\\uDD22',\n 'eg': '\\u2A9A',\n 'egrave': '\\u00E8',\n 'egs': '\\u2A96',\n 'eqslantgtr': '\\u2A96',\n 'egsdot': '\\u2A98',\n 'el': '\\u2A99',\n 'elinters': '\\u23E7',\n 'ell': '\\u2113',\n 'els': '\\u2A95',\n 'eqslantless': '\\u2A95',\n 'elsdot': '\\u2A97',\n 'emacr': '\\u0113',\n 'empty': '\\u2205',\n 'emptyset': '\\u2205',\n 'emptyv': '\\u2205',\n 'varnothing': '\\u2205',\n 'emsp13': '\\u2004',\n 'emsp14': '\\u2005',\n 'emsp': '\\u2003',\n 'eng': '\\u014B',\n 'ensp': '\\u2002',\n 'eogon': '\\u0119',\n 'eopf': '\\uD835\\uDD56',\n 'epar': '\\u22D5',\n 'eparsl': '\\u29E3',\n 'eplus': '\\u2A71',\n 'epsi': '\\u03B5',\n 'epsilon': '\\u03B5',\n 'epsiv': '\\u03F5',\n 'straightepsilon': '\\u03F5',\n 'varepsilon': '\\u03F5',\n 'equals': '\\u003D',\n 'equest': '\\u225F',\n 'questeq': '\\u225F',\n 'equivDD': '\\u2A78',\n 'eqvparsl': '\\u29E5',\n 'erDot': '\\u2253',\n 'risingdotseq': '\\u2253',\n 'erarr': '\\u2971',\n 'escr': '\\u212F',\n 'eta': '\\u03B7',\n 'eth': '\\u00F0',\n 'euml': '\\u00EB',\n 'euro': '\\u20AC',\n 'excl': '\\u0021',\n 'fcy': '\\u0444',\n 'female': '\\u2640',\n 'ffilig': '\\uFB03',\n 'fflig': '\\uFB00',\n 'ffllig': '\\uFB04',\n 'ffr': '\\uD835\\uDD23',\n 'filig': '\\uFB01',\n 'fjlig': '\\u0066\\u006A',\n 'flat': '\\u266D',\n 'fllig': '\\uFB02',\n 'fltns': '\\u25B1',\n 'fnof': '\\u0192',\n 'fopf': '\\uD835\\uDD57',\n 'fork': '\\u22D4',\n 'pitchfork': '\\u22D4',\n 'forkv': '\\u2AD9',\n 'fpartint': '\\u2A0D',\n 'frac12': '\\u00BD',\n 'half': '\\u00BD',\n 'frac13': '\\u2153',\n 'frac14': '\\u00BC',\n 'frac15': '\\u2155',\n 'frac16': '\\u2159',\n 'frac18': '\\u215B',\n 'frac23': '\\u2154',\n 'frac25': '\\u2156',\n 'frac34': '\\u00BE',\n 'frac35': '\\u2157',\n 'frac38': '\\u215C',\n 'frac45': '\\u2158',\n 'frac56': '\\u215A',\n 'frac58': '\\u215D',\n 'frac78': '\\u215E',\n 'frasl': '\\u2044',\n 'frown': '\\u2322',\n 'sfrown': '\\u2322',\n 'fscr': '\\uD835\\uDCBB',\n 'gEl': '\\u2A8C',\n 'gtreqqless': '\\u2A8C',\n 'gacute': '\\u01F5',\n 'gamma': '\\u03B3',\n 'gap': '\\u2A86',\n 'gtrapprox': '\\u2A86',\n 'gbreve': '\\u011F',\n 'gcirc': '\\u011D',\n 'gcy': '\\u0433',\n 'gdot': '\\u0121',\n 'gescc': '\\u2AA9',\n 'gesdot': '\\u2A80',\n 'gesdoto': '\\u2A82',\n 'gesdotol': '\\u2A84',\n 'gesl': '\\u22DB\\uFE00',\n 'gesles': '\\u2A94',\n 'gfr': '\\uD835\\uDD24',\n 'gimel': '\\u2137',\n 'gjcy': '\\u0453',\n 'glE': '\\u2A92',\n 'gla': '\\u2AA5',\n 'glj': '\\u2AA4',\n 'gnE': '\\u2269',\n 'gneqq': '\\u2269',\n 'gnap': '\\u2A8A',\n 'gnapprox': '\\u2A8A',\n 'gne': '\\u2A88',\n 'gneq': '\\u2A88',\n 'gnsim': '\\u22E7',\n 'gopf': '\\uD835\\uDD58',\n 'gscr': '\\u210A',\n 'gsime': '\\u2A8E',\n 'gsiml': '\\u2A90',\n 'gtcc': '\\u2AA7',\n 'gtcir': '\\u2A7A',\n 'gtdot': '\\u22D7',\n 'gtrdot': '\\u22D7',\n 'gtlPar': '\\u2995',\n 'gtquest': '\\u2A7C',\n 'gtrarr': '\\u2978',\n 'gvertneqq': '\\u2269\\uFE00',\n 'gvnE': '\\u2269\\uFE00',\n 'hardcy': '\\u044A',\n 'harrcir': '\\u2948',\n 'harrw': '\\u21AD',\n 'leftrightsquigarrow': '\\u21AD',\n 'hbar': '\\u210F',\n 'hslash': '\\u210F',\n 'planck': '\\u210F',\n 'plankv': '\\u210F',\n 'hcirc': '\\u0125',\n 'hearts': '\\u2665',\n 'heartsuit': '\\u2665',\n 'hellip': '\\u2026',\n 'mldr': '\\u2026',\n 'hercon': '\\u22B9',\n 'hfr': '\\uD835\\uDD25',\n 'hksearow': '\\u2925',\n 'searhk': '\\u2925',\n 'hkswarow': '\\u2926',\n 'swarhk': '\\u2926',\n 'hoarr': '\\u21FF',\n 'homtht': '\\u223B',\n 'hookleftarrow': '\\u21A9',\n 'larrhk': '\\u21A9',\n 'hookrightarrow': '\\u21AA',\n 'rarrhk': '\\u21AA',\n 'hopf': '\\uD835\\uDD59',\n 'horbar': '\\u2015',\n 'hscr': '\\uD835\\uDCBD',\n 'hstrok': '\\u0127',\n 'hybull': '\\u2043',\n 'iacute': '\\u00ED',\n 'icirc': '\\u00EE',\n 'icy': '\\u0438',\n 'iecy': '\\u0435',\n 'iexcl': '\\u00A1',\n 'ifr': '\\uD835\\uDD26',\n 'igrave': '\\u00EC',\n 'iiiint': '\\u2A0C',\n 'qint': '\\u2A0C',\n 'iiint': '\\u222D',\n 'tint': '\\u222D',\n 'iinfin': '\\u29DC',\n 'iiota': '\\u2129',\n 'ijlig': '\\u0133',\n 'imacr': '\\u012B',\n 'imath': '\\u0131',\n 'inodot': '\\u0131',\n 'imof': '\\u22B7',\n 'imped': '\\u01B5',\n 'incare': '\\u2105',\n 'infin': '\\u221E',\n 'infintie': '\\u29DD',\n 'intcal': '\\u22BA',\n 'intercal': '\\u22BA',\n 'intlarhk': '\\u2A17',\n 'intprod': '\\u2A3C',\n 'iprod': '\\u2A3C',\n 'iocy': '\\u0451',\n 'iogon': '\\u012F',\n 'iopf': '\\uD835\\uDD5A',\n 'iota': '\\u03B9',\n 'iquest': '\\u00BF',\n 'iscr': '\\uD835\\uDCBE',\n 'isinE': '\\u22F9',\n 'isindot': '\\u22F5',\n 'isins': '\\u22F4',\n 'isinsv': '\\u22F3',\n 'itilde': '\\u0129',\n 'iukcy': '\\u0456',\n 'iuml': '\\u00EF',\n 'jcirc': '\\u0135',\n 'jcy': '\\u0439',\n 'jfr': '\\uD835\\uDD27',\n 'jmath': '\\u0237',\n 'jopf': '\\uD835\\uDD5B',\n 'jscr': '\\uD835\\uDCBF',\n 'jsercy': '\\u0458',\n 'jukcy': '\\u0454',\n 'kappa': '\\u03BA',\n 'kappav': '\\u03F0',\n 'varkappa': '\\u03F0',\n 'kcedil': '\\u0137',\n 'kcy': '\\u043A',\n 'kfr': '\\uD835\\uDD28',\n 'kgreen': '\\u0138',\n 'khcy': '\\u0445',\n 'kjcy': '\\u045C',\n 'kopf': '\\uD835\\uDD5C',\n 'kscr': '\\uD835\\uDCC0',\n 'lAtail': '\\u291B',\n 'lBarr': '\\u290E',\n 'lEg': '\\u2A8B',\n 'lesseqqgtr': '\\u2A8B',\n 'lHar': '\\u2962',\n 'lacute': '\\u013A',\n 'laemptyv': '\\u29B4',\n 'lambda': '\\u03BB',\n 'langd': '\\u2991',\n 'lap': '\\u2A85',\n 'lessapprox': '\\u2A85',\n 'laquo': '\\u00AB',\n 'larrbfs': '\\u291F',\n 'larrfs': '\\u291D',\n 'larrlp': '\\u21AB',\n 'looparrowleft': '\\u21AB',\n 'larrpl': '\\u2939',\n 'larrsim': '\\u2973',\n 'larrtl': '\\u21A2',\n 'leftarrowtail': '\\u21A2',\n 'lat': '\\u2AAB',\n 'latail': '\\u2919',\n 'late': '\\u2AAD',\n 'lates': '\\u2AAD\\uFE00',\n 'lbarr': '\\u290C',\n 'lbbrk': '\\u2772',\n 'lbrace': '\\u007B',\n 'lcub': '\\u007B',\n 'lbrack': '\\u005B',\n 'lsqb': '\\u005B',\n 'lbrke': '\\u298B',\n 'lbrksld': '\\u298F',\n 'lbrkslu': '\\u298D',\n 'lcaron': '\\u013E',\n 'lcedil': '\\u013C',\n 'lcy': '\\u043B',\n 'ldca': '\\u2936',\n 'ldrdhar': '\\u2967',\n 'ldrushar': '\\u294B',\n 'ldsh': '\\u21B2',\n 'le': '\\u2264',\n 'leq': '\\u2264',\n 'leftleftarrows': '\\u21C7',\n 'llarr': '\\u21C7',\n 'leftthreetimes': '\\u22CB',\n 'lthree': '\\u22CB',\n 'lescc': '\\u2AA8',\n 'lesdot': '\\u2A7F',\n 'lesdoto': '\\u2A81',\n 'lesdotor': '\\u2A83',\n 'lesg': '\\u22DA\\uFE00',\n 'lesges': '\\u2A93',\n 'lessdot': '\\u22D6',\n 'ltdot': '\\u22D6',\n 'lfisht': '\\u297C',\n 'lfr': '\\uD835\\uDD29',\n 'lgE': '\\u2A91',\n 'lharul': '\\u296A',\n 'lhblk': '\\u2584',\n 'ljcy': '\\u0459',\n 'llhard': '\\u296B',\n 'lltri': '\\u25FA',\n 'lmidot': '\\u0140',\n 'lmoust': '\\u23B0',\n 'lmoustache': '\\u23B0',\n 'lnE': '\\u2268',\n 'lneqq': '\\u2268',\n 'lnap': '\\u2A89',\n 'lnapprox': '\\u2A89',\n 'lne': '\\u2A87',\n 'lneq': '\\u2A87',\n 'lnsim': '\\u22E6',\n 'loang': '\\u27EC',\n 'loarr': '\\u21FD',\n 'longmapsto': '\\u27FC',\n 'xmap': '\\u27FC',\n 'looparrowright': '\\u21AC',\n 'rarrlp': '\\u21AC',\n 'lopar': '\\u2985',\n 'lopf': '\\uD835\\uDD5D',\n 'loplus': '\\u2A2D',\n 'lotimes': '\\u2A34',\n 'lowast': '\\u2217',\n 'loz': '\\u25CA',\n 'lozenge': '\\u25CA',\n 'lpar': '\\u0028',\n 'lparlt': '\\u2993',\n 'lrhard': '\\u296D',\n 'lrm': '\\u200E',\n 'lrtri': '\\u22BF',\n 'lsaquo': '\\u2039',\n 'lscr': '\\uD835\\uDCC1',\n 'lsime': '\\u2A8D',\n 'lsimg': '\\u2A8F',\n 'lsquor': '\\u201A',\n 'sbquo': '\\u201A',\n 'lstrok': '\\u0142',\n 'ltcc': '\\u2AA6',\n 'ltcir': '\\u2A79',\n 'ltimes': '\\u22C9',\n 'ltlarr': '\\u2976',\n 'ltquest': '\\u2A7B',\n 'ltrPar': '\\u2996',\n 'ltri': '\\u25C3',\n 'triangleleft': '\\u25C3',\n 'lurdshar': '\\u294A',\n 'luruhar': '\\u2966',\n 'lvertneqq': '\\u2268\\uFE00',\n 'lvnE': '\\u2268\\uFE00',\n 'mDDot': '\\u223A',\n 'macr': '\\u00AF',\n 'strns': '\\u00AF',\n 'male': '\\u2642',\n 'malt': '\\u2720',\n 'maltese': '\\u2720',\n 'marker': '\\u25AE',\n 'mcomma': '\\u2A29',\n 'mcy': '\\u043C',\n 'mdash': '\\u2014',\n 'mfr': '\\uD835\\uDD2A',\n 'mho': '\\u2127',\n 'micro': '\\u00B5',\n 'midcir': '\\u2AF0',\n 'minus': '\\u2212',\n 'minusdu': '\\u2A2A',\n 'mlcp': '\\u2ADB',\n 'models': '\\u22A7',\n 'mopf': '\\uD835\\uDD5E',\n 'mscr': '\\uD835\\uDCC2',\n 'mu': '\\u03BC',\n 'multimap': '\\u22B8',\n 'mumap': '\\u22B8',\n 'nGg': '\\u22D9\\u0338',\n 'nGt': '\\u226B\\u20D2',\n 'nLeftarrow': '\\u21CD',\n 'nlArr': '\\u21CD',\n 'nLeftrightarrow': '\\u21CE',\n 'nhArr': '\\u21CE',\n 'nLl': '\\u22D8\\u0338',\n 'nLt': '\\u226A\\u20D2',\n 'nRightarrow': '\\u21CF',\n 'nrArr': '\\u21CF',\n 'nVDash': '\\u22AF',\n 'nVdash': '\\u22AE',\n 'nacute': '\\u0144',\n 'nang': '\\u2220\\u20D2',\n 'napE': '\\u2A70\\u0338',\n 'napid': '\\u224B\\u0338',\n 'napos': '\\u0149',\n 'natur': '\\u266E',\n 'natural': '\\u266E',\n 'ncap': '\\u2A43',\n 'ncaron': '\\u0148',\n 'ncedil': '\\u0146',\n 'ncongdot': '\\u2A6D\\u0338',\n 'ncup': '\\u2A42',\n 'ncy': '\\u043D',\n 'ndash': '\\u2013',\n 'neArr': '\\u21D7',\n 'nearhk': '\\u2924',\n 'nedot': '\\u2250\\u0338',\n 'nesear': '\\u2928',\n 'toea': '\\u2928',\n 'nfr': '\\uD835\\uDD2B',\n 'nharr': '\\u21AE',\n 'nleftrightarrow': '\\u21AE',\n 'nhpar': '\\u2AF2',\n 'nis': '\\u22FC',\n 'nisd': '\\u22FA',\n 'njcy': '\\u045A',\n 'nlE': '\\u2266\\u0338',\n 'nleqq': '\\u2266\\u0338',\n 'nlarr': '\\u219A',\n 'nleftarrow': '\\u219A',\n 'nldr': '\\u2025',\n 'nopf': '\\uD835\\uDD5F',\n 'not': '\\u00AC',\n 'notinE': '\\u22F9\\u0338',\n 'notindot': '\\u22F5\\u0338',\n 'notinvb': '\\u22F7',\n 'notinvc': '\\u22F6',\n 'notnivb': '\\u22FE',\n 'notnivc': '\\u22FD',\n 'nparsl': '\\u2AFD\\u20E5',\n 'npart': '\\u2202\\u0338',\n 'npolint': '\\u2A14',\n 'nrarr': '\\u219B',\n 'nrightarrow': '\\u219B',\n 'nrarrc': '\\u2933\\u0338',\n 'nrarrw': '\\u219D\\u0338',\n 'nscr': '\\uD835\\uDCC3',\n 'nsub': '\\u2284',\n 'nsubE': '\\u2AC5\\u0338',\n 'nsubseteqq': '\\u2AC5\\u0338',\n 'nsup': '\\u2285',\n 'nsupE': '\\u2AC6\\u0338',\n 'nsupseteqq': '\\u2AC6\\u0338',\n 'ntilde': '\\u00F1',\n 'nu': '\\u03BD',\n 'num': '\\u0023',\n 'numero': '\\u2116',\n 'numsp': '\\u2007',\n 'nvDash': '\\u22AD',\n 'nvHarr': '\\u2904',\n 'nvap': '\\u224D\\u20D2',\n 'nvdash': '\\u22AC',\n 'nvge': '\\u2265\\u20D2',\n 'nvgt': '\\u003E\\u20D2',\n 'nvinfin': '\\u29DE',\n 'nvlArr': '\\u2902',\n 'nvle': '\\u2264\\u20D2',\n 'nvlt': '\\u003C\\u20D2',\n 'nvltrie': '\\u22B4\\u20D2',\n 'nvrArr': '\\u2903',\n 'nvrtrie': '\\u22B5\\u20D2',\n 'nvsim': '\\u223C\\u20D2',\n 'nwArr': '\\u21D6',\n 'nwarhk': '\\u2923',\n 'nwnear': '\\u2927',\n 'oacute': '\\u00F3',\n 'ocirc': '\\u00F4',\n 'ocy': '\\u043E',\n 'odblac': '\\u0151',\n 'odiv': '\\u2A38',\n 'odsold': '\\u29BC',\n 'oelig': '\\u0153',\n 'ofcir': '\\u29BF',\n 'ofr': '\\uD835\\uDD2C',\n 'ogon': '\\u02DB',\n 'ograve': '\\u00F2',\n 'ogt': '\\u29C1',\n 'ohbar': '\\u29B5',\n 'olcir': '\\u29BE',\n 'olcross': '\\u29BB',\n 'olt': '\\u29C0',\n 'omacr': '\\u014D',\n 'omega': '\\u03C9',\n 'omicron': '\\u03BF',\n 'omid': '\\u29B6',\n 'oopf': '\\uD835\\uDD60',\n 'opar': '\\u29B7',\n 'operp': '\\u29B9',\n 'or': '\\u2228',\n 'vee': '\\u2228',\n 'ord': '\\u2A5D',\n 'order': '\\u2134',\n 'orderof': '\\u2134',\n 'oscr': '\\u2134',\n 'ordf': '\\u00AA',\n 'ordm': '\\u00BA',\n 'origof': '\\u22B6',\n 'oror': '\\u2A56',\n 'orslope': '\\u2A57',\n 'orv': '\\u2A5B',\n 'oslash': '\\u00F8',\n 'osol': '\\u2298',\n 'otilde': '\\u00F5',\n 'otimesas': '\\u2A36',\n 'ouml': '\\u00F6',\n 'ovbar': '\\u233D',\n 'para': '\\u00B6',\n 'parsim': '\\u2AF3',\n 'parsl': '\\u2AFD',\n 'pcy': '\\u043F',\n 'percnt': '\\u0025',\n 'period': '\\u002E',\n 'permil': '\\u2030',\n 'pertenk': '\\u2031',\n 'pfr': '\\uD835\\uDD2D',\n 'phi': '\\u03C6',\n 'phiv': '\\u03D5',\n 'straightphi': '\\u03D5',\n 'varphi': '\\u03D5',\n 'phone': '\\u260E',\n 'pi': '\\u03C0',\n 'piv': '\\u03D6',\n 'varpi': '\\u03D6',\n 'planckh': '\\u210E',\n 'plus': '\\u002B',\n 'plusacir': '\\u2A23',\n 'pluscir': '\\u2A22',\n 'plusdu': '\\u2A25',\n 'pluse': '\\u2A72',\n 'plussim': '\\u2A26',\n 'plustwo': '\\u2A27',\n 'pointint': '\\u2A15',\n 'popf': '\\uD835\\uDD61',\n 'pound': '\\u00A3',\n 'prE': '\\u2AB3',\n 'prap': '\\u2AB7',\n 'precapprox': '\\u2AB7',\n 'precnapprox': '\\u2AB9',\n 'prnap': '\\u2AB9',\n 'precneqq': '\\u2AB5',\n 'prnE': '\\u2AB5',\n 'precnsim': '\\u22E8',\n 'prnsim': '\\u22E8',\n 'prime': '\\u2032',\n 'profalar': '\\u232E',\n 'profline': '\\u2312',\n 'profsurf': '\\u2313',\n 'prurel': '\\u22B0',\n 'pscr': '\\uD835\\uDCC5',\n 'psi': '\\u03C8',\n 'puncsp': '\\u2008',\n 'qfr': '\\uD835\\uDD2E',\n 'qopf': '\\uD835\\uDD62',\n 'qprime': '\\u2057',\n 'qscr': '\\uD835\\uDCC6',\n 'quatint': '\\u2A16',\n 'quest': '\\u003F',\n 'rAtail': '\\u291C',\n 'rHar': '\\u2964',\n 'race': '\\u223D\\u0331',\n 'racute': '\\u0155',\n 'raemptyv': '\\u29B3',\n 'rangd': '\\u2992',\n 'range': '\\u29A5',\n 'raquo': '\\u00BB',\n 'rarrap': '\\u2975',\n 'rarrbfs': '\\u2920',\n 'rarrc': '\\u2933',\n 'rarrfs': '\\u291E',\n 'rarrpl': '\\u2945',\n 'rarrsim': '\\u2974',\n 'rarrtl': '\\u21A3',\n 'rightarrowtail': '\\u21A3',\n 'rarrw': '\\u219D',\n 'rightsquigarrow': '\\u219D',\n 'ratail': '\\u291A',\n 'ratio': '\\u2236',\n 'rbbrk': '\\u2773',\n 'rbrace': '\\u007D',\n 'rcub': '\\u007D',\n 'rbrack': '\\u005D',\n 'rsqb': '\\u005D',\n 'rbrke': '\\u298C',\n 'rbrksld': '\\u298E',\n 'rbrkslu': '\\u2990',\n 'rcaron': '\\u0159',\n 'rcedil': '\\u0157',\n 'rcy': '\\u0440',\n 'rdca': '\\u2937',\n 'rdldhar': '\\u2969',\n 'rdsh': '\\u21B3',\n 'rect': '\\u25AD',\n 'rfisht': '\\u297D',\n 'rfr': '\\uD835\\uDD2F',\n 'rharul': '\\u296C',\n 'rho': '\\u03C1',\n 'rhov': '\\u03F1',\n 'varrho': '\\u03F1',\n 'rightrightarrows': '\\u21C9',\n 'rrarr': '\\u21C9',\n 'rightthreetimes': '\\u22CC',\n 'rthree': '\\u22CC',\n 'ring': '\\u02DA',\n 'rlm': '\\u200F',\n 'rmoust': '\\u23B1',\n 'rmoustache': '\\u23B1',\n 'rnmid': '\\u2AEE',\n 'roang': '\\u27ED',\n 'roarr': '\\u21FE',\n 'ropar': '\\u2986',\n 'ropf': '\\uD835\\uDD63',\n 'roplus': '\\u2A2E',\n 'rotimes': '\\u2A35',\n 'rpar': '\\u0029',\n 'rpargt': '\\u2994',\n 'rppolint': '\\u2A12',\n 'rsaquo': '\\u203A',\n 'rscr': '\\uD835\\uDCC7',\n 'rtimes': '\\u22CA',\n 'rtri': '\\u25B9',\n 'triangleright': '\\u25B9',\n 'rtriltri': '\\u29CE',\n 'ruluhar': '\\u2968',\n 'rx': '\\u211E',\n 'sacute': '\\u015B',\n 'scE': '\\u2AB4',\n 'scap': '\\u2AB8',\n 'succapprox': '\\u2AB8',\n 'scaron': '\\u0161',\n 'scedil': '\\u015F',\n 'scirc': '\\u015D',\n 'scnE': '\\u2AB6',\n 'succneqq': '\\u2AB6',\n 'scnap': '\\u2ABA',\n 'succnapprox': '\\u2ABA',\n 'scnsim': '\\u22E9',\n 'succnsim': '\\u22E9',\n 'scpolint': '\\u2A13',\n 'scy': '\\u0441',\n 'sdot': '\\u22C5',\n 'sdote': '\\u2A66',\n 'seArr': '\\u21D8',\n 'sect': '\\u00A7',\n 'semi': '\\u003B',\n 'seswar': '\\u2929',\n 'tosa': '\\u2929',\n 'sext': '\\u2736',\n 'sfr': '\\uD835\\uDD30',\n 'sharp': '\\u266F',\n 'shchcy': '\\u0449',\n 'shcy': '\\u0448',\n 'shy': '\\u00AD',\n 'sigma': '\\u03C3',\n 'sigmaf': '\\u03C2',\n 'sigmav': '\\u03C2',\n 'varsigma': '\\u03C2',\n 'simdot': '\\u2A6A',\n 'simg': '\\u2A9E',\n 'simgE': '\\u2AA0',\n 'siml': '\\u2A9D',\n 'simlE': '\\u2A9F',\n 'simne': '\\u2246',\n 'simplus': '\\u2A24',\n 'simrarr': '\\u2972',\n 'smashp': '\\u2A33',\n 'smeparsl': '\\u29E4',\n 'smile': '\\u2323',\n 'ssmile': '\\u2323',\n 'smt': '\\u2AAA',\n 'smte': '\\u2AAC',\n 'smtes': '\\u2AAC\\uFE00',\n 'softcy': '\\u044C',\n 'sol': '\\u002F',\n 'solb': '\\u29C4',\n 'solbar': '\\u233F',\n 'sopf': '\\uD835\\uDD64',\n 'spades': '\\u2660',\n 'spadesuit': '\\u2660',\n 'sqcaps': '\\u2293\\uFE00',\n 'sqcups': '\\u2294\\uFE00',\n 'sscr': '\\uD835\\uDCC8',\n 'star': '\\u2606',\n 'sub': '\\u2282',\n 'subset': '\\u2282',\n 'subE': '\\u2AC5',\n 'subseteqq': '\\u2AC5',\n 'subdot': '\\u2ABD',\n 'subedot': '\\u2AC3',\n 'submult': '\\u2AC1',\n 'subnE': '\\u2ACB',\n 'subsetneqq': '\\u2ACB',\n 'subne': '\\u228A',\n 'subsetneq': '\\u228A',\n 'subplus': '\\u2ABF',\n 'subrarr': '\\u2979',\n 'subsim': '\\u2AC7',\n 'subsub': '\\u2AD5',\n 'subsup': '\\u2AD3',\n 'sung': '\\u266A',\n 'sup1': '\\u00B9',\n 'sup2': '\\u00B2',\n 'sup3': '\\u00B3',\n 'supE': '\\u2AC6',\n 'supseteqq': '\\u2AC6',\n 'supdot': '\\u2ABE',\n 'supdsub': '\\u2AD8',\n 'supedot': '\\u2AC4',\n 'suphsol': '\\u27C9',\n 'suphsub': '\\u2AD7',\n 'suplarr': '\\u297B',\n 'supmult': '\\u2AC2',\n 'supnE': '\\u2ACC',\n 'supsetneqq': '\\u2ACC',\n 'supne': '\\u228B',\n 'supsetneq': '\\u228B',\n 'supplus': '\\u2AC0',\n 'supsim': '\\u2AC8',\n 'supsub': '\\u2AD4',\n 'supsup': '\\u2AD6',\n 'swArr': '\\u21D9',\n 'swnwar': '\\u292A',\n 'szlig': '\\u00DF',\n 'target': '\\u2316',\n 'tau': '\\u03C4',\n 'tcaron': '\\u0165',\n 'tcedil': '\\u0163',\n 'tcy': '\\u0442',\n 'telrec': '\\u2315',\n 'tfr': '\\uD835\\uDD31',\n 'theta': '\\u03B8',\n 'thetasym': '\\u03D1',\n 'thetav': '\\u03D1',\n 'vartheta': '\\u03D1',\n 'thorn': '\\u00FE',\n 'times': '\\u00D7',\n 'timesbar': '\\u2A31',\n 'timesd': '\\u2A30',\n 'topbot': '\\u2336',\n 'topcir': '\\u2AF1',\n 'topf': '\\uD835\\uDD65',\n 'topfork': '\\u2ADA',\n 'tprime': '\\u2034',\n 'triangle': '\\u25B5',\n 'utri': '\\u25B5',\n 'triangleq': '\\u225C',\n 'trie': '\\u225C',\n 'tridot': '\\u25EC',\n 'triminus': '\\u2A3A',\n 'triplus': '\\u2A39',\n 'trisb': '\\u29CD',\n 'tritime': '\\u2A3B',\n 'trpezium': '\\u23E2',\n 'tscr': '\\uD835\\uDCC9',\n 'tscy': '\\u0446',\n 'tshcy': '\\u045B',\n 'tstrok': '\\u0167',\n 'uHar': '\\u2963',\n 'uacute': '\\u00FA',\n 'ubrcy': '\\u045E',\n 'ubreve': '\\u016D',\n 'ucirc': '\\u00FB',\n 'ucy': '\\u0443',\n 'udblac': '\\u0171',\n 'ufisht': '\\u297E',\n 'ufr': '\\uD835\\uDD32',\n 'ugrave': '\\u00F9',\n 'uhblk': '\\u2580',\n 'ulcorn': '\\u231C',\n 'ulcorner': '\\u231C',\n 'ulcrop': '\\u230F',\n 'ultri': '\\u25F8',\n 'umacr': '\\u016B',\n 'uogon': '\\u0173',\n 'uopf': '\\uD835\\uDD66',\n 'upsi': '\\u03C5',\n 'upsilon': '\\u03C5',\n 'upuparrows': '\\u21C8',\n 'uuarr': '\\u21C8',\n 'urcorn': '\\u231D',\n 'urcorner': '\\u231D',\n 'urcrop': '\\u230E',\n 'uring': '\\u016F',\n 'urtri': '\\u25F9',\n 'uscr': '\\uD835\\uDCCA',\n 'utdot': '\\u22F0',\n 'utilde': '\\u0169',\n 'uuml': '\\u00FC',\n 'uwangle': '\\u29A7',\n 'vBar': '\\u2AE8',\n 'vBarv': '\\u2AE9',\n 'vangrt': '\\u299C',\n 'varsubsetneq': '\\u228A\\uFE00',\n 'vsubne': '\\u228A\\uFE00',\n 'varsubsetneqq': '\\u2ACB\\uFE00',\n 'vsubnE': '\\u2ACB\\uFE00',\n 'varsupsetneq': '\\u228B\\uFE00',\n 'vsupne': '\\u228B\\uFE00',\n 'varsupsetneqq': '\\u2ACC\\uFE00',\n 'vsupnE': '\\u2ACC\\uFE00',\n 'vcy': '\\u0432',\n 'veebar': '\\u22BB',\n 'veeeq': '\\u225A',\n 'vellip': '\\u22EE',\n 'vfr': '\\uD835\\uDD33',\n 'vopf': '\\uD835\\uDD67',\n 'vscr': '\\uD835\\uDCCB',\n 'vzigzag': '\\u299A',\n 'wcirc': '\\u0175',\n 'wedbar': '\\u2A5F',\n 'wedgeq': '\\u2259',\n 'weierp': '\\u2118',\n 'wp': '\\u2118',\n 'wfr': '\\uD835\\uDD34',\n 'wopf': '\\uD835\\uDD68',\n 'wscr': '\\uD835\\uDCCC',\n 'xfr': '\\uD835\\uDD35',\n 'xi': '\\u03BE',\n 'xnis': '\\u22FB',\n 'xopf': '\\uD835\\uDD69',\n 'xscr': '\\uD835\\uDCCD',\n 'yacute': '\\u00FD',\n 'yacy': '\\u044F',\n 'ycirc': '\\u0177',\n 'ycy': '\\u044B',\n 'yen': '\\u00A5',\n 'yfr': '\\uD835\\uDD36',\n 'yicy': '\\u0457',\n 'yopf': '\\uD835\\uDD6A',\n 'yscr': '\\uD835\\uDCCE',\n 'yucy': '\\u044E',\n 'yuml': '\\u00FF',\n 'zacute': '\\u017A',\n 'zcaron': '\\u017E',\n 'zcy': '\\u0437',\n 'zdot': '\\u017C',\n 'zeta': '\\u03B6',\n 'zfr': '\\uD835\\uDD37',\n 'zhcy': '\\u0436',\n 'zigrarr': '\\u21DD',\n 'zopf': '\\uD835\\uDD6B',\n 'zscr': '\\uD835\\uDCCF',\n 'zwj': '\\u200D',\n 'zwnj': '\\u200C'\n};\n// The &ngsp; pseudo-entity is denoting a space.\n// 0xE500 is a PUA (Private Use Areas) unicode character\n// This is inspired by the Angular Dart implementation.\nconst NGSP_UNICODE = '\\uE500';\nNAMED_ENTITIES['ngsp'] = NGSP_UNICODE;\nclass TokenError extends ParseError {\n constructor(errorMsg, tokenType, span) {\n super(span, errorMsg);\n this.tokenType = tokenType;\n }\n}\nclass TokenizeResult {\n constructor(tokens, errors, nonNormalizedIcuExpressions) {\n this.tokens = tokens;\n this.errors = errors;\n this.nonNormalizedIcuExpressions = nonNormalizedIcuExpressions;\n }\n}\nfunction tokenize(source, url, getTagDefinition, options = {}) {\n const tokenizer = new _Tokenizer(new ParseSourceFile(source, url), getTagDefinition, options);\n tokenizer.tokenize();\n return new TokenizeResult(mergeTextTokens(tokenizer.tokens), tokenizer.errors, tokenizer.nonNormalizedIcuExpressions);\n}\nconst _CR_OR_CRLF_REGEXP = /\\r\\n?/g;\nfunction _unexpectedCharacterErrorMsg(charCode) {\n const char = charCode === $EOF ? 'EOF' : String.fromCharCode(charCode);\n return `Unexpected character \"${char}\"`;\n}\nfunction _unknownEntityErrorMsg(entitySrc) {\n return `Unknown entity \"${entitySrc}\" - use the \"&#;\" or \"&#x;\" syntax`;\n}\nfunction _unparsableEntityErrorMsg(type, entityStr) {\n return `Unable to parse entity \"${entityStr}\" - ${type} character reference entities must end with \";\"`;\n}\nvar CharacterReferenceType;\n(function (CharacterReferenceType) {\n CharacterReferenceType[\"HEX\"] = \"hexadecimal\";\n CharacterReferenceType[\"DEC\"] = \"decimal\";\n})(CharacterReferenceType || (CharacterReferenceType = {}));\nclass _ControlFlowError {\n constructor(error) {\n this.error = error;\n }\n}\n// See https://www.w3.org/TR/html51/syntax.html#writing-html-documents\nclass _Tokenizer {\n /**\n * @param _file The html source file being tokenized.\n * @param _getTagDefinition A function that will retrieve a tag definition for a given tag name.\n * @param options Configuration of the tokenization.\n */\n constructor(_file, _getTagDefinition, options) {\n this._getTagDefinition = _getTagDefinition;\n this._currentTokenStart = null;\n this._currentTokenType = null;\n this._expansionCaseStack = [];\n this._inInterpolation = false;\n this.tokens = [];\n this.errors = [];\n this.nonNormalizedIcuExpressions = [];\n this._tokenizeIcu = options.tokenizeExpansionForms || false;\n this._interpolationConfig = options.interpolationConfig || DEFAULT_INTERPOLATION_CONFIG;\n this._leadingTriviaCodePoints = options.leadingTriviaChars && options.leadingTriviaChars.map(c => c.codePointAt(0) || 0);\n const range = options.range || {\n endPos: _file.content.length,\n startPos: 0,\n startLine: 0,\n startCol: 0\n };\n this._cursor = options.escapedString ? new EscapedCharacterCursor(_file, range) : new PlainCharacterCursor(_file, range);\n this._preserveLineEndings = options.preserveLineEndings || false;\n this._i18nNormalizeLineEndingsInICUs = options.i18nNormalizeLineEndingsInICUs || false;\n this._tokenizeBlocks = options.tokenizeBlocks ?? true;\n this._tokenizeLet = options.tokenizeLet ?? true;\n try {\n this._cursor.init();\n } catch (e) {\n this.handleError(e);\n }\n }\n _processCarriageReturns(content) {\n if (this._preserveLineEndings) {\n return content;\n }\n // https://www.w3.org/TR/html51/syntax.html#preprocessing-the-input-stream\n // In order to keep the original position in the source, we can not\n // pre-process it.\n // Instead CRs are processed right before instantiating the tokens.\n return content.replace(_CR_OR_CRLF_REGEXP, '\\n');\n }\n tokenize() {\n while (this._cursor.peek() !== $EOF) {\n const start = this._cursor.clone();\n try {\n if (this._attemptCharCode($LT)) {\n if (this._attemptCharCode($BANG)) {\n if (this._attemptCharCode($LBRACKET)) {\n this._consumeCdata(start);\n } else if (this._attemptCharCode($MINUS)) {\n this._consumeComment(start);\n } else {\n this._consumeDocType(start);\n }\n } else if (this._attemptCharCode($SLASH)) {\n this._consumeTagClose(start);\n } else {\n this._consumeTagOpen(start);\n }\n } else if (this._tokenizeLet &&\n // Use `peek` instead of `attempCharCode` since we\n // don't want to advance in case it's not `@let`.\n this._cursor.peek() === $AT && !this._inInterpolation && this._attemptStr('@let')) {\n this._consumeLetDeclaration(start);\n } else if (this._tokenizeBlocks && this._attemptCharCode($AT)) {\n this._consumeBlockStart(start);\n } else if (this._tokenizeBlocks && !this._inInterpolation && !this._isInExpansionCase() && !this._isInExpansionForm() && this._attemptCharCode($RBRACE)) {\n this._consumeBlockEnd(start);\n } else if (!(this._tokenizeIcu && this._tokenizeExpansionForm())) {\n // In (possibly interpolated) text the end of the text is given by `isTextEnd()`, while\n // the premature end of an interpolation is given by the start of a new HTML element.\n this._consumeWithInterpolation(5 /* TokenType.TEXT */, 8 /* TokenType.INTERPOLATION */, () => this._isTextEnd(), () => this._isTagStart());\n }\n } catch (e) {\n this.handleError(e);\n }\n }\n this._beginToken(33 /* TokenType.EOF */);\n this._endToken([]);\n }\n _getBlockName() {\n // This allows us to capture up something like `@else if`, but not `@ if`.\n let spacesInNameAllowed = false;\n const nameCursor = this._cursor.clone();\n this._attemptCharCodeUntilFn(code => {\n if (isWhitespace(code)) {\n return !spacesInNameAllowed;\n }\n if (isBlockNameChar(code)) {\n spacesInNameAllowed = true;\n return false;\n }\n return true;\n });\n return this._cursor.getChars(nameCursor).trim();\n }\n _consumeBlockStart(start) {\n this._beginToken(24 /* TokenType.BLOCK_OPEN_START */, start);\n const startToken = this._endToken([this._getBlockName()]);\n if (this._cursor.peek() === $LPAREN) {\n // Advance past the opening paren.\n this._cursor.advance();\n // Capture the parameters.\n this._consumeBlockParameters();\n // Allow spaces before the closing paren.\n this._attemptCharCodeUntilFn(isNotWhitespace);\n if (this._attemptCharCode($RPAREN)) {\n // Allow spaces after the paren.\n this._attemptCharCodeUntilFn(isNotWhitespace);\n } else {\n startToken.type = 28 /* TokenType.INCOMPLETE_BLOCK_OPEN */;\n return;\n }\n }\n if (this._attemptCharCode($LBRACE)) {\n this._beginToken(25 /* TokenType.BLOCK_OPEN_END */);\n this._endToken([]);\n } else {\n startToken.type = 28 /* TokenType.INCOMPLETE_BLOCK_OPEN */;\n }\n }\n _consumeBlockEnd(start) {\n this._beginToken(26 /* TokenType.BLOCK_CLOSE */, start);\n this._endToken([]);\n }\n _consumeBlockParameters() {\n // Trim the whitespace until the first parameter.\n this._attemptCharCodeUntilFn(isBlockParameterChar);\n while (this._cursor.peek() !== $RPAREN && this._cursor.peek() !== $EOF) {\n this._beginToken(27 /* TokenType.BLOCK_PARAMETER */);\n const start = this._cursor.clone();\n let inQuote = null;\n let openParens = 0;\n // Consume the parameter until the next semicolon or brace.\n // Note that we skip over semicolons/braces inside of strings.\n while (this._cursor.peek() !== $SEMICOLON && this._cursor.peek() !== $EOF || inQuote !== null) {\n const char = this._cursor.peek();\n // Skip to the next character if it was escaped.\n if (char === $BACKSLASH) {\n this._cursor.advance();\n } else if (char === inQuote) {\n inQuote = null;\n } else if (inQuote === null && isQuote(char)) {\n inQuote = char;\n } else if (char === $LPAREN && inQuote === null) {\n openParens++;\n } else if (char === $RPAREN && inQuote === null) {\n if (openParens === 0) {\n break;\n } else if (openParens > 0) {\n openParens--;\n }\n }\n this._cursor.advance();\n }\n this._endToken([this._cursor.getChars(start)]);\n // Skip to the next parameter.\n this._attemptCharCodeUntilFn(isBlockParameterChar);\n }\n }\n _consumeLetDeclaration(start) {\n this._beginToken(29 /* TokenType.LET_START */, start);\n // Require at least one white space after the `@let`.\n if (isWhitespace(this._cursor.peek())) {\n this._attemptCharCodeUntilFn(isNotWhitespace);\n } else {\n const token = this._endToken([this._cursor.getChars(start)]);\n token.type = 32 /* TokenType.INCOMPLETE_LET */;\n return;\n }\n const startToken = this._endToken([this._getLetDeclarationName()]);\n // Skip over white space before the equals character.\n this._attemptCharCodeUntilFn(isNotWhitespace);\n // Expect an equals sign.\n if (!this._attemptCharCode($EQ)) {\n startToken.type = 32 /* TokenType.INCOMPLETE_LET */;\n return;\n }\n // Skip spaces after the equals.\n this._attemptCharCodeUntilFn(code => isNotWhitespace(code) && !isNewLine(code));\n this._consumeLetDeclarationValue();\n // Terminate the `@let` with a semicolon.\n const endChar = this._cursor.peek();\n if (endChar === $SEMICOLON) {\n this._beginToken(31 /* TokenType.LET_END */);\n this._endToken([]);\n this._cursor.advance();\n } else {\n startToken.type = 32 /* TokenType.INCOMPLETE_LET */;\n startToken.sourceSpan = this._cursor.getSpan(start);\n }\n }\n _getLetDeclarationName() {\n const nameCursor = this._cursor.clone();\n let allowDigit = false;\n this._attemptCharCodeUntilFn(code => {\n if (isAsciiLetter(code) || code === $$ || code === $_ ||\n // `@let` names can't start with a digit, but digits are valid anywhere else in the name.\n allowDigit && isDigit(code)) {\n allowDigit = true;\n return false;\n }\n return true;\n });\n return this._cursor.getChars(nameCursor).trim();\n }\n _consumeLetDeclarationValue() {\n const start = this._cursor.clone();\n this._beginToken(30 /* TokenType.LET_VALUE */, start);\n while (this._cursor.peek() !== $EOF) {\n const char = this._cursor.peek();\n // `@let` declarations terminate with a semicolon.\n if (char === $SEMICOLON) {\n break;\n }\n // If we hit a quote, skip over its content since we don't care what's inside.\n if (isQuote(char)) {\n this._cursor.advance();\n this._attemptCharCodeUntilFn(inner => {\n if (inner === $BACKSLASH) {\n this._cursor.advance();\n return false;\n }\n return inner === char;\n });\n }\n this._cursor.advance();\n }\n this._endToken([this._cursor.getChars(start)]);\n }\n /**\n * @returns whether an ICU token has been created\n * @internal\n */\n _tokenizeExpansionForm() {\n if (this.isExpansionFormStart()) {\n this._consumeExpansionFormStart();\n return true;\n }\n if (isExpansionCaseStart(this._cursor.peek()) && this._isInExpansionForm()) {\n this._consumeExpansionCaseStart();\n return true;\n }\n if (this._cursor.peek() === $RBRACE) {\n if (this._isInExpansionCase()) {\n this._consumeExpansionCaseEnd();\n return true;\n }\n if (this._isInExpansionForm()) {\n this._consumeExpansionFormEnd();\n return true;\n }\n }\n return false;\n }\n _beginToken(type, start = this._cursor.clone()) {\n this._currentTokenStart = start;\n this._currentTokenType = type;\n }\n _endToken(parts, end) {\n if (this._currentTokenStart === null) {\n throw new TokenError('Programming error - attempted to end a token when there was no start to the token', this._currentTokenType, this._cursor.getSpan(end));\n }\n if (this._currentTokenType === null) {\n throw new TokenError('Programming error - attempted to end a token which has no token type', null, this._cursor.getSpan(this._currentTokenStart));\n }\n const token = {\n type: this._currentTokenType,\n parts,\n sourceSpan: (end ?? this._cursor).getSpan(this._currentTokenStart, this._leadingTriviaCodePoints)\n };\n this.tokens.push(token);\n this._currentTokenStart = null;\n this._currentTokenType = null;\n return token;\n }\n _createError(msg, span) {\n if (this._isInExpansionForm()) {\n msg += ` (Do you have an unescaped \"{\" in your template? Use \"{{ '{' }}\") to escape it.)`;\n }\n const error = new TokenError(msg, this._currentTokenType, span);\n this._currentTokenStart = null;\n this._currentTokenType = null;\n return new _ControlFlowError(error);\n }\n handleError(e) {\n if (e instanceof CursorError) {\n e = this._createError(e.msg, this._cursor.getSpan(e.cursor));\n }\n if (e instanceof _ControlFlowError) {\n this.errors.push(e.error);\n } else {\n throw e;\n }\n }\n _attemptCharCode(charCode) {\n if (this._cursor.peek() === charCode) {\n this._cursor.advance();\n return true;\n }\n return false;\n }\n _attemptCharCodeCaseInsensitive(charCode) {\n if (compareCharCodeCaseInsensitive(this._cursor.peek(), charCode)) {\n this._cursor.advance();\n return true;\n }\n return false;\n }\n _requireCharCode(charCode) {\n const location = this._cursor.clone();\n if (!this._attemptCharCode(charCode)) {\n throw this._createError(_unexpectedCharacterErrorMsg(this._cursor.peek()), this._cursor.getSpan(location));\n }\n }\n _attemptStr(chars) {\n const len = chars.length;\n if (this._cursor.charsLeft() < len) {\n return false;\n }\n const initialPosition = this._cursor.clone();\n for (let i = 0; i < len; i++) {\n if (!this._attemptCharCode(chars.charCodeAt(i))) {\n // If attempting to parse the string fails, we want to reset the parser\n // to where it was before the attempt\n this._cursor = initialPosition;\n return false;\n }\n }\n return true;\n }\n _attemptStrCaseInsensitive(chars) {\n for (let i = 0; i < chars.length; i++) {\n if (!this._attemptCharCodeCaseInsensitive(chars.charCodeAt(i))) {\n return false;\n }\n }\n return true;\n }\n _requireStr(chars) {\n const location = this._cursor.clone();\n if (!this._attemptStr(chars)) {\n throw this._createError(_unexpectedCharacterErrorMsg(this._cursor.peek()), this._cursor.getSpan(location));\n }\n }\n _attemptCharCodeUntilFn(predicate) {\n while (!predicate(this._cursor.peek())) {\n this._cursor.advance();\n }\n }\n _requireCharCodeUntilFn(predicate, len) {\n const start = this._cursor.clone();\n this._attemptCharCodeUntilFn(predicate);\n if (this._cursor.diff(start) < len) {\n throw this._createError(_unexpectedCharacterErrorMsg(this._cursor.peek()), this._cursor.getSpan(start));\n }\n }\n _attemptUntilChar(char) {\n while (this._cursor.peek() !== char) {\n this._cursor.advance();\n }\n }\n _readChar() {\n // Don't rely upon reading directly from `_input` as the actual char value\n // may have been generated from an escape sequence.\n const char = String.fromCodePoint(this._cursor.peek());\n this._cursor.advance();\n return char;\n }\n _consumeEntity(textTokenType) {\n this._beginToken(9 /* TokenType.ENCODED_ENTITY */);\n const start = this._cursor.clone();\n this._cursor.advance();\n if (this._attemptCharCode($HASH)) {\n const isHex = this._attemptCharCode($x) || this._attemptCharCode($X);\n const codeStart = this._cursor.clone();\n this._attemptCharCodeUntilFn(isDigitEntityEnd);\n if (this._cursor.peek() != $SEMICOLON) {\n // Advance cursor to include the peeked character in the string provided to the error\n // message.\n this._cursor.advance();\n const entityType = isHex ? CharacterReferenceType.HEX : CharacterReferenceType.DEC;\n throw this._createError(_unparsableEntityErrorMsg(entityType, this._cursor.getChars(start)), this._cursor.getSpan());\n }\n const strNum = this._cursor.getChars(codeStart);\n this._cursor.advance();\n try {\n const charCode = parseInt(strNum, isHex ? 16 : 10);\n this._endToken([String.fromCharCode(charCode), this._cursor.getChars(start)]);\n } catch {\n throw this._createError(_unknownEntityErrorMsg(this._cursor.getChars(start)), this._cursor.getSpan());\n }\n } else {\n const nameStart = this._cursor.clone();\n this._attemptCharCodeUntilFn(isNamedEntityEnd);\n if (this._cursor.peek() != $SEMICOLON) {\n // No semicolon was found so abort the encoded entity token that was in progress, and treat\n // this as a text token\n this._beginToken(textTokenType, start);\n this._cursor = nameStart;\n this._endToken(['&']);\n } else {\n const name = this._cursor.getChars(nameStart);\n this._cursor.advance();\n const char = NAMED_ENTITIES[name];\n if (!char) {\n throw this._createError(_unknownEntityErrorMsg(name), this._cursor.getSpan(start));\n }\n this._endToken([char, `&${name};`]);\n }\n }\n }\n _consumeRawText(consumeEntities, endMarkerPredicate) {\n this._beginToken(consumeEntities ? 6 /* TokenType.ESCAPABLE_RAW_TEXT */ : 7 /* TokenType.RAW_TEXT */);\n const parts = [];\n while (true) {\n const tagCloseStart = this._cursor.clone();\n const foundEndMarker = endMarkerPredicate();\n this._cursor = tagCloseStart;\n if (foundEndMarker) {\n break;\n }\n if (consumeEntities && this._cursor.peek() === $AMPERSAND) {\n this._endToken([this._processCarriageReturns(parts.join(''))]);\n parts.length = 0;\n this._consumeEntity(6 /* TokenType.ESCAPABLE_RAW_TEXT */);\n this._beginToken(6 /* TokenType.ESCAPABLE_RAW_TEXT */);\n } else {\n parts.push(this._readChar());\n }\n }\n this._endToken([this._processCarriageReturns(parts.join(''))]);\n }\n _consumeComment(start) {\n this._beginToken(10 /* TokenType.COMMENT_START */, start);\n this._requireCharCode($MINUS);\n this._endToken([]);\n this._consumeRawText(false, () => this._attemptStr('-->'));\n this._beginToken(11 /* TokenType.COMMENT_END */);\n this._requireStr('-->');\n this._endToken([]);\n }\n _consumeCdata(start) {\n this._beginToken(12 /* TokenType.CDATA_START */, start);\n this._requireStr('CDATA[');\n this._endToken([]);\n this._consumeRawText(false, () => this._attemptStr(']]>'));\n this._beginToken(13 /* TokenType.CDATA_END */);\n this._requireStr(']]>');\n this._endToken([]);\n }\n _consumeDocType(start) {\n this._beginToken(18 /* TokenType.DOC_TYPE */, start);\n const contentStart = this._cursor.clone();\n this._attemptUntilChar($GT);\n const content = this._cursor.getChars(contentStart);\n this._cursor.advance();\n this._endToken([content]);\n }\n _consumePrefixAndName() {\n const nameOrPrefixStart = this._cursor.clone();\n let prefix = '';\n while (this._cursor.peek() !== $COLON && !isPrefixEnd(this._cursor.peek())) {\n this._cursor.advance();\n }\n let nameStart;\n if (this._cursor.peek() === $COLON) {\n prefix = this._cursor.getChars(nameOrPrefixStart);\n this._cursor.advance();\n nameStart = this._cursor.clone();\n } else {\n nameStart = nameOrPrefixStart;\n }\n this._requireCharCodeUntilFn(isNameEnd, prefix === '' ? 0 : 1);\n const name = this._cursor.getChars(nameStart);\n return [prefix, name];\n }\n _consumeTagOpen(start) {\n let tagName;\n let prefix;\n let openTagToken;\n try {\n if (!isAsciiLetter(this._cursor.peek())) {\n throw this._createError(_unexpectedCharacterErrorMsg(this._cursor.peek()), this._cursor.getSpan(start));\n }\n openTagToken = this._consumeTagOpenStart(start);\n prefix = openTagToken.parts[0];\n tagName = openTagToken.parts[1];\n this._attemptCharCodeUntilFn(isNotWhitespace);\n while (this._cursor.peek() !== $SLASH && this._cursor.peek() !== $GT && this._cursor.peek() !== $LT && this._cursor.peek() !== $EOF) {\n this._consumeAttributeName();\n this._attemptCharCodeUntilFn(isNotWhitespace);\n if (this._attemptCharCode($EQ)) {\n this._attemptCharCodeUntilFn(isNotWhitespace);\n this._consumeAttributeValue();\n }\n this._attemptCharCodeUntilFn(isNotWhitespace);\n }\n this._consumeTagOpenEnd();\n } catch (e) {\n if (e instanceof _ControlFlowError) {\n if (openTagToken) {\n // We errored before we could close the opening tag, so it is incomplete.\n openTagToken.type = 4 /* TokenType.INCOMPLETE_TAG_OPEN */;\n } else {\n // When the start tag is invalid, assume we want a \"<\" as text.\n // Back to back text tokens are merged at the end.\n this._beginToken(5 /* TokenType.TEXT */, start);\n this._endToken(['<']);\n }\n return;\n }\n throw e;\n }\n const contentTokenType = this._getTagDefinition(tagName).getContentType(prefix);\n if (contentTokenType === TagContentType.RAW_TEXT) {\n this._consumeRawTextWithTagClose(prefix, tagName, false);\n } else if (contentTokenType === TagContentType.ESCAPABLE_RAW_TEXT) {\n this._consumeRawTextWithTagClose(prefix, tagName, true);\n }\n }\n _consumeRawTextWithTagClose(prefix, tagName, consumeEntities) {\n this._consumeRawText(consumeEntities, () => {\n if (!this._attemptCharCode($LT)) return false;\n if (!this._attemptCharCode($SLASH)) return false;\n this._attemptCharCodeUntilFn(isNotWhitespace);\n if (!this._attemptStrCaseInsensitive(tagName)) return false;\n this._attemptCharCodeUntilFn(isNotWhitespace);\n return this._attemptCharCode($GT);\n });\n this._beginToken(3 /* TokenType.TAG_CLOSE */);\n this._requireCharCodeUntilFn(code => code === $GT, 3);\n this._cursor.advance(); // Consume the `>`\n this._endToken([prefix, tagName]);\n }\n _consumeTagOpenStart(start) {\n this._beginToken(0 /* TokenType.TAG_OPEN_START */, start);\n const parts = this._consumePrefixAndName();\n return this._endToken(parts);\n }\n _consumeAttributeName() {\n const attrNameStart = this._cursor.peek();\n if (attrNameStart === $SQ || attrNameStart === $DQ) {\n throw this._createError(_unexpectedCharacterErrorMsg(attrNameStart), this._cursor.getSpan());\n }\n this._beginToken(14 /* TokenType.ATTR_NAME */);\n const prefixAndName = this._consumePrefixAndName();\n this._endToken(prefixAndName);\n }\n _consumeAttributeValue() {\n if (this._cursor.peek() === $SQ || this._cursor.peek() === $DQ) {\n const quoteChar = this._cursor.peek();\n this._consumeQuote(quoteChar);\n // In an attribute then end of the attribute value and the premature end to an interpolation\n // are both triggered by the `quoteChar`.\n const endPredicate = () => this._cursor.peek() === quoteChar;\n this._consumeWithInterpolation(16 /* TokenType.ATTR_VALUE_TEXT */, 17 /* TokenType.ATTR_VALUE_INTERPOLATION */, endPredicate, endPredicate);\n this._consumeQuote(quoteChar);\n } else {\n const endPredicate = () => isNameEnd(this._cursor.peek());\n this._consumeWithInterpolation(16 /* TokenType.ATTR_VALUE_TEXT */, 17 /* TokenType.ATTR_VALUE_INTERPOLATION */, endPredicate, endPredicate);\n }\n }\n _consumeQuote(quoteChar) {\n this._beginToken(15 /* TokenType.ATTR_QUOTE */);\n this._requireCharCode(quoteChar);\n this._endToken([String.fromCodePoint(quoteChar)]);\n }\n _consumeTagOpenEnd() {\n const tokenType = this._attemptCharCode($SLASH) ? 2 /* TokenType.TAG_OPEN_END_VOID */ : 1 /* TokenType.TAG_OPEN_END */;\n this._beginToken(tokenType);\n this._requireCharCode($GT);\n this._endToken([]);\n }\n _consumeTagClose(start) {\n this._beginToken(3 /* TokenType.TAG_CLOSE */, start);\n this._attemptCharCodeUntilFn(isNotWhitespace);\n const prefixAndName = this._consumePrefixAndName();\n this._attemptCharCodeUntilFn(isNotWhitespace);\n this._requireCharCode($GT);\n this._endToken(prefixAndName);\n }\n _consumeExpansionFormStart() {\n this._beginToken(19 /* TokenType.EXPANSION_FORM_START */);\n this._requireCharCode($LBRACE);\n this._endToken([]);\n this._expansionCaseStack.push(19 /* TokenType.EXPANSION_FORM_START */);\n this._beginToken(7 /* TokenType.RAW_TEXT */);\n const condition = this._readUntil($COMMA);\n const normalizedCondition = this._processCarriageReturns(condition);\n if (this._i18nNormalizeLineEndingsInICUs) {\n // We explicitly want to normalize line endings for this text.\n this._endToken([normalizedCondition]);\n } else {\n // We are not normalizing line endings.\n const conditionToken = this._endToken([condition]);\n if (normalizedCondition !== condition) {\n this.nonNormalizedIcuExpressions.push(conditionToken);\n }\n }\n this._requireCharCode($COMMA);\n this._attemptCharCodeUntilFn(isNotWhitespace);\n this._beginToken(7 /* TokenType.RAW_TEXT */);\n const type = this._readUntil($COMMA);\n this._endToken([type]);\n this._requireCharCode($COMMA);\n this._attemptCharCodeUntilFn(isNotWhitespace);\n }\n _consumeExpansionCaseStart() {\n this._beginToken(20 /* TokenType.EXPANSION_CASE_VALUE */);\n const value = this._readUntil($LBRACE).trim();\n this._endToken([value]);\n this._attemptCharCodeUntilFn(isNotWhitespace);\n this._beginToken(21 /* TokenType.EXPANSION_CASE_EXP_START */);\n this._requireCharCode($LBRACE);\n this._endToken([]);\n this._attemptCharCodeUntilFn(isNotWhitespace);\n this._expansionCaseStack.push(21 /* TokenType.EXPANSION_CASE_EXP_START */);\n }\n _consumeExpansionCaseEnd() {\n this._beginToken(22 /* TokenType.EXPANSION_CASE_EXP_END */);\n this._requireCharCode($RBRACE);\n this._endToken([]);\n this._attemptCharCodeUntilFn(isNotWhitespace);\n this._expansionCaseStack.pop();\n }\n _consumeExpansionFormEnd() {\n this._beginToken(23 /* TokenType.EXPANSION_FORM_END */);\n this._requireCharCode($RBRACE);\n this._endToken([]);\n this._expansionCaseStack.pop();\n }\n /**\n * Consume a string that may contain interpolation expressions.\n *\n * The first token consumed will be of `tokenType` and then there will be alternating\n * `interpolationTokenType` and `tokenType` tokens until the `endPredicate()` returns true.\n *\n * If an interpolation token ends prematurely it will have no end marker in its `parts` array.\n *\n * @param textTokenType the kind of tokens to interleave around interpolation tokens.\n * @param interpolationTokenType the kind of tokens that contain interpolation.\n * @param endPredicate a function that should return true when we should stop consuming.\n * @param endInterpolation a function that should return true if there is a premature end to an\n * interpolation expression - i.e. before we get to the normal interpolation closing marker.\n */\n _consumeWithInterpolation(textTokenType, interpolationTokenType, endPredicate, endInterpolation) {\n this._beginToken(textTokenType);\n const parts = [];\n while (!endPredicate()) {\n const current = this._cursor.clone();\n if (this._interpolationConfig && this._attemptStr(this._interpolationConfig.start)) {\n this._endToken([this._processCarriageReturns(parts.join(''))], current);\n parts.length = 0;\n this._consumeInterpolation(interpolationTokenType, current, endInterpolation);\n this._beginToken(textTokenType);\n } else if (this._cursor.peek() === $AMPERSAND) {\n this._endToken([this._processCarriageReturns(parts.join(''))]);\n parts.length = 0;\n this._consumeEntity(textTokenType);\n this._beginToken(textTokenType);\n } else {\n parts.push(this._readChar());\n }\n }\n // It is possible that an interpolation was started but not ended inside this text token.\n // Make sure that we reset the state of the lexer correctly.\n this._inInterpolation = false;\n this._endToken([this._processCarriageReturns(parts.join(''))]);\n }\n /**\n * Consume a block of text that has been interpreted as an Angular interpolation.\n *\n * @param interpolationTokenType the type of the interpolation token to generate.\n * @param interpolationStart a cursor that points to the start of this interpolation.\n * @param prematureEndPredicate a function that should return true if the next characters indicate\n * an end to the interpolation before its normal closing marker.\n */\n _consumeInterpolation(interpolationTokenType, interpolationStart, prematureEndPredicate) {\n const parts = [];\n this._beginToken(interpolationTokenType, interpolationStart);\n parts.push(this._interpolationConfig.start);\n // Find the end of the interpolation, ignoring content inside quotes.\n const expressionStart = this._cursor.clone();\n let inQuote = null;\n let inComment = false;\n while (this._cursor.peek() !== $EOF && (prematureEndPredicate === null || !prematureEndPredicate())) {\n const current = this._cursor.clone();\n if (this._isTagStart()) {\n // We are starting what looks like an HTML element in the middle of this interpolation.\n // Reset the cursor to before the `<` character and end the interpolation token.\n // (This is actually wrong but here for backward compatibility).\n this._cursor = current;\n parts.push(this._getProcessedChars(expressionStart, current));\n this._endToken(parts);\n return;\n }\n if (inQuote === null) {\n if (this._attemptStr(this._interpolationConfig.end)) {\n // We are not in a string, and we hit the end interpolation marker\n parts.push(this._getProcessedChars(expressionStart, current));\n parts.push(this._interpolationConfig.end);\n this._endToken(parts);\n return;\n } else if (this._attemptStr('//')) {\n // Once we are in a comment we ignore any quotes\n inComment = true;\n }\n }\n const char = this._cursor.peek();\n this._cursor.advance();\n if (char === $BACKSLASH) {\n // Skip the next character because it was escaped.\n this._cursor.advance();\n } else if (char === inQuote) {\n // Exiting the current quoted string\n inQuote = null;\n } else if (!inComment && inQuote === null && isQuote(char)) {\n // Entering a new quoted string\n inQuote = char;\n }\n }\n // We hit EOF without finding a closing interpolation marker\n parts.push(this._getProcessedChars(expressionStart, this._cursor));\n this._endToken(parts);\n }\n _getProcessedChars(start, end) {\n return this._processCarriageReturns(end.getChars(start));\n }\n _isTextEnd() {\n if (this._isTagStart() || this._cursor.peek() === $EOF) {\n return true;\n }\n if (this._tokenizeIcu && !this._inInterpolation) {\n if (this.isExpansionFormStart()) {\n // start of an expansion form\n return true;\n }\n if (this._cursor.peek() === $RBRACE && this._isInExpansionCase()) {\n // end of and expansion case\n return true;\n }\n }\n if (this._tokenizeBlocks && !this._inInterpolation && !this._isInExpansion() && (this._cursor.peek() === $AT || this._cursor.peek() === $RBRACE)) {\n return true;\n }\n return false;\n }\n /**\n * Returns true if the current cursor is pointing to the start of a tag\n * (opening/closing/comments/cdata/etc).\n */\n _isTagStart() {\n if (this._cursor.peek() === $LT) {\n // We assume that `<` followed by whitespace is not the start of an HTML element.\n const tmp = this._cursor.clone();\n tmp.advance();\n // If the next character is alphabetic, ! nor / then it is a tag start\n const code = tmp.peek();\n if ($a <= code && code <= $z || $A <= code && code <= $Z || code === $SLASH || code === $BANG) {\n return true;\n }\n }\n return false;\n }\n _readUntil(char) {\n const start = this._cursor.clone();\n this._attemptUntilChar(char);\n return this._cursor.getChars(start);\n }\n _isInExpansion() {\n return this._isInExpansionCase() || this._isInExpansionForm();\n }\n _isInExpansionCase() {\n return this._expansionCaseStack.length > 0 && this._expansionCaseStack[this._expansionCaseStack.length - 1] === 21 /* TokenType.EXPANSION_CASE_EXP_START */;\n }\n _isInExpansionForm() {\n return this._expansionCaseStack.length > 0 && this._expansionCaseStack[this._expansionCaseStack.length - 1] === 19 /* TokenType.EXPANSION_FORM_START */;\n }\n isExpansionFormStart() {\n if (this._cursor.peek() !== $LBRACE) {\n return false;\n }\n if (this._interpolationConfig) {\n const start = this._cursor.clone();\n const isInterpolation = this._attemptStr(this._interpolationConfig.start);\n this._cursor = start;\n return !isInterpolation;\n }\n return true;\n }\n}\nfunction isNotWhitespace(code) {\n return !isWhitespace(code) || code === $EOF;\n}\nfunction isNameEnd(code) {\n return isWhitespace(code) || code === $GT || code === $LT || code === $SLASH || code === $SQ || code === $DQ || code === $EQ || code === $EOF;\n}\nfunction isPrefixEnd(code) {\n return (code < $a || $z < code) && (code < $A || $Z < code) && (code < $0 || code > $9);\n}\nfunction isDigitEntityEnd(code) {\n return code === $SEMICOLON || code === $EOF || !isAsciiHexDigit(code);\n}\nfunction isNamedEntityEnd(code) {\n return code === $SEMICOLON || code === $EOF || !isAsciiLetter(code);\n}\nfunction isExpansionCaseStart(peek) {\n return peek !== $RBRACE;\n}\nfunction compareCharCodeCaseInsensitive(code1, code2) {\n return toUpperCaseCharCode(code1) === toUpperCaseCharCode(code2);\n}\nfunction toUpperCaseCharCode(code) {\n return code >= $a && code <= $z ? code - $a + $A : code;\n}\nfunction isBlockNameChar(code) {\n return isAsciiLetter(code) || isDigit(code) || code === $_;\n}\nfunction isBlockParameterChar(code) {\n return code !== $SEMICOLON && isNotWhitespace(code);\n}\nfunction mergeTextTokens(srcTokens) {\n const dstTokens = [];\n let lastDstToken = undefined;\n for (let i = 0; i < srcTokens.length; i++) {\n const token = srcTokens[i];\n if (lastDstToken && lastDstToken.type === 5 /* TokenType.TEXT */ && token.type === 5 /* TokenType.TEXT */ || lastDstToken && lastDstToken.type === 16 /* TokenType.ATTR_VALUE_TEXT */ && token.type === 16 /* TokenType.ATTR_VALUE_TEXT */) {\n lastDstToken.parts[0] += token.parts[0];\n lastDstToken.sourceSpan.end = token.sourceSpan.end;\n } else {\n lastDstToken = token;\n dstTokens.push(lastDstToken);\n }\n }\n return dstTokens;\n}\nclass PlainCharacterCursor {\n constructor(fileOrCursor, range) {\n if (fileOrCursor instanceof PlainCharacterCursor) {\n this.file = fileOrCursor.file;\n this.input = fileOrCursor.input;\n this.end = fileOrCursor.end;\n const state = fileOrCursor.state;\n // Note: avoid using `{...fileOrCursor.state}` here as that has a severe performance penalty.\n // In ES5 bundles the object spread operator is translated into the `__assign` helper, which\n // is not optimized by VMs as efficiently as a raw object literal. Since this constructor is\n // called in tight loops, this difference matters.\n this.state = {\n peek: state.peek,\n offset: state.offset,\n line: state.line,\n column: state.column\n };\n } else {\n if (!range) {\n throw new Error('Programming error: the range argument must be provided with a file argument.');\n }\n this.file = fileOrCursor;\n this.input = fileOrCursor.content;\n this.end = range.endPos;\n this.state = {\n peek: -1,\n offset: range.startPos,\n line: range.startLine,\n column: range.startCol\n };\n }\n }\n clone() {\n return new PlainCharacterCursor(this);\n }\n peek() {\n return this.state.peek;\n }\n charsLeft() {\n return this.end - this.state.offset;\n }\n diff(other) {\n return this.state.offset - other.state.offset;\n }\n advance() {\n this.advanceState(this.state);\n }\n init() {\n this.updatePeek(this.state);\n }\n getSpan(start, leadingTriviaCodePoints) {\n start = start || this;\n let fullStart = start;\n if (leadingTriviaCodePoints) {\n while (this.diff(start) > 0 && leadingTriviaCodePoints.indexOf(start.peek()) !== -1) {\n if (fullStart === start) {\n start = start.clone();\n }\n start.advance();\n }\n }\n const startLocation = this.locationFromCursor(start);\n const endLocation = this.locationFromCursor(this);\n const fullStartLocation = fullStart !== start ? this.locationFromCursor(fullStart) : startLocation;\n return new ParseSourceSpan(startLocation, endLocation, fullStartLocation);\n }\n getChars(start) {\n return this.input.substring(start.state.offset, this.state.offset);\n }\n charAt(pos) {\n return this.input.charCodeAt(pos);\n }\n advanceState(state) {\n if (state.offset >= this.end) {\n this.state = state;\n throw new CursorError('Unexpected character \"EOF\"', this);\n }\n const currentChar = this.charAt(state.offset);\n if (currentChar === $LF) {\n state.line++;\n state.column = 0;\n } else if (!isNewLine(currentChar)) {\n state.column++;\n }\n state.offset++;\n this.updatePeek(state);\n }\n updatePeek(state) {\n state.peek = state.offset >= this.end ? $EOF : this.charAt(state.offset);\n }\n locationFromCursor(cursor) {\n return new ParseLocation(cursor.file, cursor.state.offset, cursor.state.line, cursor.state.column);\n }\n}\nclass EscapedCharacterCursor extends PlainCharacterCursor {\n constructor(fileOrCursor, range) {\n if (fileOrCursor instanceof EscapedCharacterCursor) {\n super(fileOrCursor);\n this.internalState = {\n ...fileOrCursor.internalState\n };\n } else {\n super(fileOrCursor, range);\n this.internalState = this.state;\n }\n }\n advance() {\n this.state = this.internalState;\n super.advance();\n this.processEscapeSequence();\n }\n init() {\n super.init();\n this.processEscapeSequence();\n }\n clone() {\n return new EscapedCharacterCursor(this);\n }\n getChars(start) {\n const cursor = start.clone();\n let chars = '';\n while (cursor.internalState.offset < this.internalState.offset) {\n chars += String.fromCodePoint(cursor.peek());\n cursor.advance();\n }\n return chars;\n }\n /**\n * Process the escape sequence that starts at the current position in the text.\n *\n * This method is called to ensure that `peek` has the unescaped value of escape sequences.\n */\n processEscapeSequence() {\n const peek = () => this.internalState.peek;\n if (peek() === $BACKSLASH) {\n // We have hit an escape sequence so we need the internal state to become independent\n // of the external state.\n this.internalState = {\n ...this.state\n };\n // Move past the backslash\n this.advanceState(this.internalState);\n // First check for standard control char sequences\n if (peek() === $n) {\n this.state.peek = $LF;\n } else if (peek() === $r) {\n this.state.peek = $CR;\n } else if (peek() === $v) {\n this.state.peek = $VTAB;\n } else if (peek() === $t) {\n this.state.peek = $TAB;\n } else if (peek() === $b) {\n this.state.peek = $BSPACE;\n } else if (peek() === $f) {\n this.state.peek = $FF;\n }\n // Now consider more complex sequences\n else if (peek() === $u) {\n // Unicode code-point sequence\n this.advanceState(this.internalState); // advance past the `u` char\n if (peek() === $LBRACE) {\n // Variable length Unicode, e.g. `\\x{123}`\n this.advanceState(this.internalState); // advance past the `{` char\n // Advance past the variable number of hex digits until we hit a `}` char\n const digitStart = this.clone();\n let length = 0;\n while (peek() !== $RBRACE) {\n this.advanceState(this.internalState);\n length++;\n }\n this.state.peek = this.decodeHexDigits(digitStart, length);\n } else {\n // Fixed length Unicode, e.g. `\\u1234`\n const digitStart = this.clone();\n this.advanceState(this.internalState);\n this.advanceState(this.internalState);\n this.advanceState(this.internalState);\n this.state.peek = this.decodeHexDigits(digitStart, 4);\n }\n } else if (peek() === $x) {\n // Hex char code, e.g. `\\x2F`\n this.advanceState(this.internalState); // advance past the `x` char\n const digitStart = this.clone();\n this.advanceState(this.internalState);\n this.state.peek = this.decodeHexDigits(digitStart, 2);\n } else if (isOctalDigit(peek())) {\n // Octal char code, e.g. `\\012`,\n let octal = '';\n let length = 0;\n let previous = this.clone();\n while (isOctalDigit(peek()) && length < 3) {\n previous = this.clone();\n octal += String.fromCodePoint(peek());\n this.advanceState(this.internalState);\n length++;\n }\n this.state.peek = parseInt(octal, 8);\n // Backup one char\n this.internalState = previous.internalState;\n } else if (isNewLine(this.internalState.peek)) {\n // Line continuation `\\` followed by a new line\n this.advanceState(this.internalState); // advance over the newline\n this.state = this.internalState;\n } else {\n // If none of the `if` blocks were executed then we just have an escaped normal character.\n // In that case we just, effectively, skip the backslash from the character.\n this.state.peek = this.internalState.peek;\n }\n }\n }\n decodeHexDigits(start, length) {\n const hex = this.input.slice(start.internalState.offset, start.internalState.offset + length);\n const charCode = parseInt(hex, 16);\n if (!isNaN(charCode)) {\n return charCode;\n } else {\n start.state = start.internalState;\n throw new CursorError('Invalid hexadecimal escape sequence', start);\n }\n }\n}\nclass CursorError {\n constructor(msg, cursor) {\n this.msg = msg;\n this.cursor = cursor;\n }\n}\nclass TreeError extends ParseError {\n static create(elementName, span, msg) {\n return new TreeError(elementName, span, msg);\n }\n constructor(elementName, span, msg) {\n super(span, msg);\n this.elementName = elementName;\n }\n}\nclass ParseTreeResult {\n constructor(rootNodes, errors) {\n this.rootNodes = rootNodes;\n this.errors = errors;\n }\n}\nclass Parser$1 {\n constructor(getTagDefinition) {\n this.getTagDefinition = getTagDefinition;\n }\n parse(source, url, options) {\n const tokenizeResult = tokenize(source, url, this.getTagDefinition, options);\n const parser = new _TreeBuilder(tokenizeResult.tokens, this.getTagDefinition);\n parser.build();\n return new ParseTreeResult(parser.rootNodes, tokenizeResult.errors.concat(parser.errors));\n }\n}\nclass _TreeBuilder {\n constructor(tokens, getTagDefinition) {\n this.tokens = tokens;\n this.getTagDefinition = getTagDefinition;\n this._index = -1;\n this._containerStack = [];\n this.rootNodes = [];\n this.errors = [];\n this._advance();\n }\n build() {\n while (this._peek.type !== 33 /* TokenType.EOF */) {\n if (this._peek.type === 0 /* TokenType.TAG_OPEN_START */ || this._peek.type === 4 /* TokenType.INCOMPLETE_TAG_OPEN */) {\n this._consumeStartTag(this._advance());\n } else if (this._peek.type === 3 /* TokenType.TAG_CLOSE */) {\n this._consumeEndTag(this._advance());\n } else if (this._peek.type === 12 /* TokenType.CDATA_START */) {\n this._closeVoidElement();\n this._consumeCdata(this._advance());\n } else if (this._peek.type === 10 /* TokenType.COMMENT_START */) {\n this._closeVoidElement();\n this._consumeComment(this._advance());\n } else if (this._peek.type === 5 /* TokenType.TEXT */ || this._peek.type === 7 /* TokenType.RAW_TEXT */ || this._peek.type === 6 /* TokenType.ESCAPABLE_RAW_TEXT */) {\n this._closeVoidElement();\n this._consumeText(this._advance());\n } else if (this._peek.type === 19 /* TokenType.EXPANSION_FORM_START */) {\n this._consumeExpansion(this._advance());\n } else if (this._peek.type === 24 /* TokenType.BLOCK_OPEN_START */) {\n this._closeVoidElement();\n this._consumeBlockOpen(this._advance());\n } else if (this._peek.type === 26 /* TokenType.BLOCK_CLOSE */) {\n this._closeVoidElement();\n this._consumeBlockClose(this._advance());\n } else if (this._peek.type === 28 /* TokenType.INCOMPLETE_BLOCK_OPEN */) {\n this._closeVoidElement();\n this._consumeIncompleteBlock(this._advance());\n } else if (this._peek.type === 29 /* TokenType.LET_START */) {\n this._closeVoidElement();\n this._consumeLet(this._advance());\n } else if (this._peek.type === 32 /* TokenType.INCOMPLETE_LET */) {\n this._closeVoidElement();\n this._consumeIncompleteLet(this._advance());\n } else {\n // Skip all other tokens...\n this._advance();\n }\n }\n for (const leftoverContainer of this._containerStack) {\n // Unlike HTML elements, blocks aren't closed implicitly by the end of the file.\n if (leftoverContainer instanceof Block) {\n this.errors.push(TreeError.create(leftoverContainer.name, leftoverContainer.sourceSpan, `Unclosed block \"${leftoverContainer.name}\"`));\n }\n }\n }\n _advance() {\n const prev = this._peek;\n if (this._index < this.tokens.length - 1) {\n // Note: there is always an EOF token at the end\n this._index++;\n }\n this._peek = this.tokens[this._index];\n return prev;\n }\n _advanceIf(type) {\n if (this._peek.type === type) {\n return this._advance();\n }\n return null;\n }\n _consumeCdata(_startToken) {\n this._consumeText(this._advance());\n this._advanceIf(13 /* TokenType.CDATA_END */);\n }\n _consumeComment(token) {\n const text = this._advanceIf(7 /* TokenType.RAW_TEXT */);\n const endToken = this._advanceIf(11 /* TokenType.COMMENT_END */);\n const value = text != null ? text.parts[0].trim() : null;\n const sourceSpan = endToken == null ? token.sourceSpan : new ParseSourceSpan(token.sourceSpan.start, endToken.sourceSpan.end, token.sourceSpan.fullStart);\n this._addToParent(new Comment(value, sourceSpan));\n }\n _consumeExpansion(token) {\n const switchValue = this._advance();\n const type = this._advance();\n const cases = [];\n // read =\n while (this._peek.type === 20 /* TokenType.EXPANSION_CASE_VALUE */) {\n const expCase = this._parseExpansionCase();\n if (!expCase) return; // error\n cases.push(expCase);\n }\n // read the final }\n if (this._peek.type !== 23 /* TokenType.EXPANSION_FORM_END */) {\n this.errors.push(TreeError.create(null, this._peek.sourceSpan, `Invalid ICU message. Missing '}'.`));\n return;\n }\n const sourceSpan = new ParseSourceSpan(token.sourceSpan.start, this._peek.sourceSpan.end, token.sourceSpan.fullStart);\n this._addToParent(new Expansion(switchValue.parts[0], type.parts[0], cases, sourceSpan, switchValue.sourceSpan));\n this._advance();\n }\n _parseExpansionCase() {\n const value = this._advance();\n // read {\n if (this._peek.type !== 21 /* TokenType.EXPANSION_CASE_EXP_START */) {\n this.errors.push(TreeError.create(null, this._peek.sourceSpan, `Invalid ICU message. Missing '{'.`));\n return null;\n }\n // read until }\n const start = this._advance();\n const exp = this._collectExpansionExpTokens(start);\n if (!exp) return null;\n const end = this._advance();\n exp.push({\n type: 33 /* TokenType.EOF */,\n parts: [],\n sourceSpan: end.sourceSpan\n });\n // parse everything in between { and }\n const expansionCaseParser = new _TreeBuilder(exp, this.getTagDefinition);\n expansionCaseParser.build();\n if (expansionCaseParser.errors.length > 0) {\n this.errors = this.errors.concat(expansionCaseParser.errors);\n return null;\n }\n const sourceSpan = new ParseSourceSpan(value.sourceSpan.start, end.sourceSpan.end, value.sourceSpan.fullStart);\n const expSourceSpan = new ParseSourceSpan(start.sourceSpan.start, end.sourceSpan.end, start.sourceSpan.fullStart);\n return new ExpansionCase(value.parts[0], expansionCaseParser.rootNodes, sourceSpan, value.sourceSpan, expSourceSpan);\n }\n _collectExpansionExpTokens(start) {\n const exp = [];\n const expansionFormStack = [21 /* TokenType.EXPANSION_CASE_EXP_START */];\n while (true) {\n if (this._peek.type === 19 /* TokenType.EXPANSION_FORM_START */ || this._peek.type === 21 /* TokenType.EXPANSION_CASE_EXP_START */) {\n expansionFormStack.push(this._peek.type);\n }\n if (this._peek.type === 22 /* TokenType.EXPANSION_CASE_EXP_END */) {\n if (lastOnStack(expansionFormStack, 21 /* TokenType.EXPANSION_CASE_EXP_START */)) {\n expansionFormStack.pop();\n if (expansionFormStack.length === 0) return exp;\n } else {\n this.errors.push(TreeError.create(null, start.sourceSpan, `Invalid ICU message. Missing '}'.`));\n return null;\n }\n }\n if (this._peek.type === 23 /* TokenType.EXPANSION_FORM_END */) {\n if (lastOnStack(expansionFormStack, 19 /* TokenType.EXPANSION_FORM_START */)) {\n expansionFormStack.pop();\n } else {\n this.errors.push(TreeError.create(null, start.sourceSpan, `Invalid ICU message. Missing '}'.`));\n return null;\n }\n }\n if (this._peek.type === 33 /* TokenType.EOF */) {\n this.errors.push(TreeError.create(null, start.sourceSpan, `Invalid ICU message. Missing '}'.`));\n return null;\n }\n exp.push(this._advance());\n }\n }\n _consumeText(token) {\n const tokens = [token];\n const startSpan = token.sourceSpan;\n let text = token.parts[0];\n if (text.length > 0 && text[0] === '\\n') {\n const parent = this._getContainer();\n if (parent != null && parent.children.length === 0 && this.getTagDefinition(parent.name).ignoreFirstLf) {\n text = text.substring(1);\n tokens[0] = {\n type: token.type,\n sourceSpan: token.sourceSpan,\n parts: [text]\n };\n }\n }\n while (this._peek.type === 8 /* TokenType.INTERPOLATION */ || this._peek.type === 5 /* TokenType.TEXT */ || this._peek.type === 9 /* TokenType.ENCODED_ENTITY */) {\n token = this._advance();\n tokens.push(token);\n if (token.type === 8 /* TokenType.INTERPOLATION */) {\n // For backward compatibility we decode HTML entities that appear in interpolation\n // expressions. This is arguably a bug, but it could be a considerable breaking change to\n // fix it. It should be addressed in a larger project to refactor the entire parser/lexer\n // chain after View Engine has been removed.\n text += token.parts.join('').replace(/&([^;]+);/g, decodeEntity);\n } else if (token.type === 9 /* TokenType.ENCODED_ENTITY */) {\n text += token.parts[0];\n } else {\n text += token.parts.join('');\n }\n }\n if (text.length > 0) {\n const endSpan = token.sourceSpan;\n this._addToParent(new Text(text, new ParseSourceSpan(startSpan.start, endSpan.end, startSpan.fullStart, startSpan.details), tokens));\n }\n }\n _closeVoidElement() {\n const el = this._getContainer();\n if (el instanceof Element && this.getTagDefinition(el.name).isVoid) {\n this._containerStack.pop();\n }\n }\n _consumeStartTag(startTagToken) {\n const [prefix, name] = startTagToken.parts;\n const attrs = [];\n while (this._peek.type === 14 /* TokenType.ATTR_NAME */) {\n attrs.push(this._consumeAttr(this._advance()));\n }\n const fullName = this._getElementFullName(prefix, name, this._getClosestParentElement());\n let selfClosing = false;\n // Note: There could have been a tokenizer error\n // so that we don't get a token for the end tag...\n if (this._peek.type === 2 /* TokenType.TAG_OPEN_END_VOID */) {\n this._advance();\n selfClosing = true;\n const tagDef = this.getTagDefinition(fullName);\n if (!(tagDef.canSelfClose || getNsPrefix(fullName) !== null || tagDef.isVoid)) {\n this.errors.push(TreeError.create(fullName, startTagToken.sourceSpan, `Only void, custom and foreign elements can be self closed \"${startTagToken.parts[1]}\"`));\n }\n } else if (this._peek.type === 1 /* TokenType.TAG_OPEN_END */) {\n this._advance();\n selfClosing = false;\n }\n const end = this._peek.sourceSpan.fullStart;\n const span = new ParseSourceSpan(startTagToken.sourceSpan.start, end, startTagToken.sourceSpan.fullStart);\n // Create a separate `startSpan` because `span` will be modified when there is an `end` span.\n const startSpan = new ParseSourceSpan(startTagToken.sourceSpan.start, end, startTagToken.sourceSpan.fullStart);\n const el = new Element(fullName, attrs, [], span, startSpan, undefined);\n const parentEl = this._getContainer();\n this._pushContainer(el, parentEl instanceof Element && this.getTagDefinition(parentEl.name).isClosedByChild(el.name));\n if (selfClosing) {\n // Elements that are self-closed have their `endSourceSpan` set to the full span, as the\n // element start tag also represents the end tag.\n this._popContainer(fullName, Element, span);\n } else if (startTagToken.type === 4 /* TokenType.INCOMPLETE_TAG_OPEN */) {\n // We already know the opening tag is not complete, so it is unlikely it has a corresponding\n // close tag. Let's optimistically parse it as a full element and emit an error.\n this._popContainer(fullName, Element, null);\n this.errors.push(TreeError.create(fullName, span, `Opening tag \"${fullName}\" not terminated.`));\n }\n }\n _pushContainer(node, isClosedByChild) {\n if (isClosedByChild) {\n this._containerStack.pop();\n }\n this._addToParent(node);\n this._containerStack.push(node);\n }\n _consumeEndTag(endTagToken) {\n const fullName = this._getElementFullName(endTagToken.parts[0], endTagToken.parts[1], this._getClosestParentElement());\n if (this.getTagDefinition(fullName).isVoid) {\n this.errors.push(TreeError.create(fullName, endTagToken.sourceSpan, `Void elements do not have end tags \"${endTagToken.parts[1]}\"`));\n } else if (!this._popContainer(fullName, Element, endTagToken.sourceSpan)) {\n const errMsg = `Unexpected closing tag \"${fullName}\". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags`;\n this.errors.push(TreeError.create(fullName, endTagToken.sourceSpan, errMsg));\n }\n }\n /**\n * Closes the nearest element with the tag name `fullName` in the parse tree.\n * `endSourceSpan` is the span of the closing tag, or null if the element does\n * not have a closing tag (for example, this happens when an incomplete\n * opening tag is recovered).\n */\n _popContainer(expectedName, expectedType, endSourceSpan) {\n let unexpectedCloseTagDetected = false;\n for (let stackIndex = this._containerStack.length - 1; stackIndex >= 0; stackIndex--) {\n const node = this._containerStack[stackIndex];\n if ((node.name === expectedName || expectedName === null) && node instanceof expectedType) {\n // Record the parse span with the element that is being closed. Any elements that are\n // removed from the element stack at this point are closed implicitly, so they won't get\n // an end source span (as there is no explicit closing element).\n node.endSourceSpan = endSourceSpan;\n node.sourceSpan.end = endSourceSpan !== null ? endSourceSpan.end : node.sourceSpan.end;\n this._containerStack.splice(stackIndex, this._containerStack.length - stackIndex);\n return !unexpectedCloseTagDetected;\n }\n // Blocks and most elements are not self closing.\n if (node instanceof Block || node instanceof Element && !this.getTagDefinition(node.name).closedByParent) {\n // Note that we encountered an unexpected close tag but continue processing the element\n // stack so we can assign an `endSourceSpan` if there is a corresponding start tag for this\n // end tag in the stack.\n unexpectedCloseTagDetected = true;\n }\n }\n return false;\n }\n _consumeAttr(attrName) {\n const fullName = mergeNsAndName(attrName.parts[0], attrName.parts[1]);\n let attrEnd = attrName.sourceSpan.end;\n // Consume any quote\n if (this._peek.type === 15 /* TokenType.ATTR_QUOTE */) {\n this._advance();\n }\n // Consume the attribute value\n let value = '';\n const valueTokens = [];\n let valueStartSpan = undefined;\n let valueEnd = undefined;\n // NOTE: We need to use a new variable `nextTokenType` here to hide the actual type of\n // `_peek.type` from TS. Otherwise TS will narrow the type of `_peek.type` preventing it from\n // being able to consider `ATTR_VALUE_INTERPOLATION` as an option. This is because TS is not\n // able to see that `_advance()` will actually mutate `_peek`.\n const nextTokenType = this._peek.type;\n if (nextTokenType === 16 /* TokenType.ATTR_VALUE_TEXT */) {\n valueStartSpan = this._peek.sourceSpan;\n valueEnd = this._peek.sourceSpan.end;\n while (this._peek.type === 16 /* TokenType.ATTR_VALUE_TEXT */ || this._peek.type === 17 /* TokenType.ATTR_VALUE_INTERPOLATION */ || this._peek.type === 9 /* TokenType.ENCODED_ENTITY */) {\n const valueToken = this._advance();\n valueTokens.push(valueToken);\n if (valueToken.type === 17 /* TokenType.ATTR_VALUE_INTERPOLATION */) {\n // For backward compatibility we decode HTML entities that appear in interpolation\n // expressions. This is arguably a bug, but it could be a considerable breaking change to\n // fix it. It should be addressed in a larger project to refactor the entire parser/lexer\n // chain after View Engine has been removed.\n value += valueToken.parts.join('').replace(/&([^;]+);/g, decodeEntity);\n } else if (valueToken.type === 9 /* TokenType.ENCODED_ENTITY */) {\n value += valueToken.parts[0];\n } else {\n value += valueToken.parts.join('');\n }\n valueEnd = attrEnd = valueToken.sourceSpan.end;\n }\n }\n // Consume any quote\n if (this._peek.type === 15 /* TokenType.ATTR_QUOTE */) {\n const quoteToken = this._advance();\n attrEnd = quoteToken.sourceSpan.end;\n }\n const valueSpan = valueStartSpan && valueEnd && new ParseSourceSpan(valueStartSpan.start, valueEnd, valueStartSpan.fullStart);\n return new Attribute(fullName, value, new ParseSourceSpan(attrName.sourceSpan.start, attrEnd, attrName.sourceSpan.fullStart), attrName.sourceSpan, valueSpan, valueTokens.length > 0 ? valueTokens : undefined, undefined);\n }\n _consumeBlockOpen(token) {\n const parameters = [];\n while (this._peek.type === 27 /* TokenType.BLOCK_PARAMETER */) {\n const paramToken = this._advance();\n parameters.push(new BlockParameter(paramToken.parts[0], paramToken.sourceSpan));\n }\n if (this._peek.type === 25 /* TokenType.BLOCK_OPEN_END */) {\n this._advance();\n }\n const end = this._peek.sourceSpan.fullStart;\n const span = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);\n // Create a separate `startSpan` because `span` will be modified when there is an `end` span.\n const startSpan = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);\n const block = new Block(token.parts[0], parameters, [], span, token.sourceSpan, startSpan);\n this._pushContainer(block, false);\n }\n _consumeBlockClose(token) {\n if (!this._popContainer(null, Block, token.sourceSpan)) {\n this.errors.push(TreeError.create(null, token.sourceSpan, `Unexpected closing block. The block may have been closed earlier. ` + `If you meant to write the } character, you should use the \"}\" ` + `HTML entity instead.`));\n }\n }\n _consumeIncompleteBlock(token) {\n const parameters = [];\n while (this._peek.type === 27 /* TokenType.BLOCK_PARAMETER */) {\n const paramToken = this._advance();\n parameters.push(new BlockParameter(paramToken.parts[0], paramToken.sourceSpan));\n }\n const end = this._peek.sourceSpan.fullStart;\n const span = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);\n // Create a separate `startSpan` because `span` will be modified when there is an `end` span.\n const startSpan = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);\n const block = new Block(token.parts[0], parameters, [], span, token.sourceSpan, startSpan);\n this._pushContainer(block, false);\n // Incomplete blocks don't have children so we close them immediately and report an error.\n this._popContainer(null, Block, null);\n this.errors.push(TreeError.create(token.parts[0], span, `Incomplete block \"${token.parts[0]}\". If you meant to write the @ character, ` + `you should use the \"@\" HTML entity instead.`));\n }\n _consumeLet(startToken) {\n const name = startToken.parts[0];\n let valueToken;\n let endToken;\n if (this._peek.type !== 30 /* TokenType.LET_VALUE */) {\n this.errors.push(TreeError.create(startToken.parts[0], startToken.sourceSpan, `Invalid @let declaration \"${name}\". Declaration must have a value.`));\n return;\n } else {\n valueToken = this._advance();\n }\n // Type cast is necessary here since TS narrowed the type of `peek` above.\n if (this._peek.type !== 31 /* TokenType.LET_END */) {\n this.errors.push(TreeError.create(startToken.parts[0], startToken.sourceSpan, `Unterminated @let declaration \"${name}\". Declaration must be terminated with a semicolon.`));\n return;\n } else {\n endToken = this._advance();\n }\n const end = endToken.sourceSpan.fullStart;\n const span = new ParseSourceSpan(startToken.sourceSpan.start, end, startToken.sourceSpan.fullStart);\n // The start token usually captures the `@let`. Construct a name span by\n // offsetting the start by the length of any text before the name.\n const startOffset = startToken.sourceSpan.toString().lastIndexOf(name);\n const nameStart = startToken.sourceSpan.start.moveBy(startOffset);\n const nameSpan = new ParseSourceSpan(nameStart, startToken.sourceSpan.end);\n const node = new LetDeclaration(name, valueToken.parts[0], span, nameSpan, valueToken.sourceSpan);\n this._addToParent(node);\n }\n _consumeIncompleteLet(token) {\n // Incomplete `@let` declaration may end up with an empty name.\n const name = token.parts[0] ?? '';\n const nameString = name ? ` \"${name}\"` : '';\n // If there's at least a name, we can salvage an AST node that can be used for completions.\n if (name.length > 0) {\n const startOffset = token.sourceSpan.toString().lastIndexOf(name);\n const nameStart = token.sourceSpan.start.moveBy(startOffset);\n const nameSpan = new ParseSourceSpan(nameStart, token.sourceSpan.end);\n const valueSpan = new ParseSourceSpan(token.sourceSpan.start, token.sourceSpan.start.moveBy(0));\n const node = new LetDeclaration(name, '', token.sourceSpan, nameSpan, valueSpan);\n this._addToParent(node);\n }\n this.errors.push(TreeError.create(token.parts[0], token.sourceSpan, `Incomplete @let declaration${nameString}. ` + `@let declarations must be written as \\`@let = ;\\``));\n }\n _getContainer() {\n return this._containerStack.length > 0 ? this._containerStack[this._containerStack.length - 1] : null;\n }\n _getClosestParentElement() {\n for (let i = this._containerStack.length - 1; i > -1; i--) {\n if (this._containerStack[i] instanceof Element) {\n return this._containerStack[i];\n }\n }\n return null;\n }\n _addToParent(node) {\n const parent = this._getContainer();\n if (parent === null) {\n this.rootNodes.push(node);\n } else {\n parent.children.push(node);\n }\n }\n _getElementFullName(prefix, localName, parentElement) {\n if (prefix === '') {\n prefix = this.getTagDefinition(localName).implicitNamespacePrefix || '';\n if (prefix === '' && parentElement != null) {\n const parentTagName = splitNsName(parentElement.name)[1];\n const parentTagDefinition = this.getTagDefinition(parentTagName);\n if (!parentTagDefinition.preventNamespaceInheritance) {\n prefix = getNsPrefix(parentElement.name);\n }\n }\n }\n return mergeNsAndName(prefix, localName);\n }\n}\nfunction lastOnStack(stack, element) {\n return stack.length > 0 && stack[stack.length - 1] === element;\n}\n/**\n * Decode the `entity` string, which we believe is the contents of an HTML entity.\n *\n * If the string is not actually a valid/known entity then just return the original `match` string.\n */\nfunction decodeEntity(match, entity) {\n if (NAMED_ENTITIES[entity] !== undefined) {\n return NAMED_ENTITIES[entity] || match;\n }\n if (/^#x[a-f0-9]+$/i.test(entity)) {\n return String.fromCodePoint(parseInt(entity.slice(2), 16));\n }\n if (/^#\\d+$/.test(entity)) {\n return String.fromCodePoint(parseInt(entity.slice(1), 10));\n }\n return match;\n}\nconst PRESERVE_WS_ATTR_NAME = 'ngPreserveWhitespaces';\nconst SKIP_WS_TRIM_TAGS = new Set(['pre', 'template', 'textarea', 'script', 'style']);\n// Equivalent to \\s with \\u00a0 (non-breaking space) excluded.\n// Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp\nconst WS_CHARS = ' \\f\\n\\r\\t\\v\\u1680\\u180e\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff';\nconst NO_WS_REGEXP = new RegExp(`[^${WS_CHARS}]`);\nconst WS_REPLACE_REGEXP = new RegExp(`[${WS_CHARS}]{2,}`, 'g');\nfunction hasPreserveWhitespacesAttr(attrs) {\n return attrs.some(attr => attr.name === PRESERVE_WS_ATTR_NAME);\n}\n/**\n * &ngsp; is a placeholder for non-removable space\n * &ngsp; is converted to the 0xE500 PUA (Private Use Areas) unicode character\n * and later on replaced by a space.\n */\nfunction replaceNgsp(value) {\n // lexer is replacing the &ngsp; pseudo-entity with NGSP_UNICODE\n return value.replace(new RegExp(NGSP_UNICODE, 'g'), ' ');\n}\n/**\n * This visitor can walk HTML parse tree and remove / trim text nodes using the following rules:\n * - consider spaces, tabs and new lines as whitespace characters;\n * - drop text nodes consisting of whitespace characters only;\n * - for all other text nodes replace consecutive whitespace characters with one space;\n * - convert &ngsp; pseudo-entity to a single space;\n *\n * Removal and trimming of whitespaces have positive performance impact (less code to generate\n * while compiling templates, faster view creation). At the same time it can be \"destructive\"\n * in some cases (whitespaces can influence layout). Because of the potential of breaking layout\n * this visitor is not activated by default in Angular 5 and people need to explicitly opt-in for\n * whitespace removal. The default option for whitespace removal will be revisited in Angular 6\n * and might be changed to \"on\" by default.\n *\n * If `originalNodeMap` is provided, the transformed nodes will be mapped back to their original\n * inputs. Any output nodes not in the map were not transformed. This supports correlating and\n * porting information between the trimmed nodes and original nodes (such as `i18n` properties)\n * such that trimming whitespace does not does not drop required information from the node.\n */\nclass WhitespaceVisitor {\n constructor(preserveSignificantWhitespace, originalNodeMap, requireContext = true) {\n this.preserveSignificantWhitespace = preserveSignificantWhitespace;\n this.originalNodeMap = originalNodeMap;\n this.requireContext = requireContext;\n // How many ICU expansions which are currently being visited. ICUs can be nested, so this\n // tracks the current depth of nesting. If this depth is greater than 0, then this visitor is\n // currently processing content inside an ICU expansion.\n this.icuExpansionDepth = 0;\n }\n visitElement(element, context) {\n if (SKIP_WS_TRIM_TAGS.has(element.name) || hasPreserveWhitespacesAttr(element.attrs)) {\n // don't descent into elements where we need to preserve whitespaces\n // but still visit all attributes to eliminate one used as a market to preserve WS\n const newElement = new Element(element.name, visitAllWithSiblings(this, element.attrs), element.children, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.i18n);\n this.originalNodeMap?.set(newElement, element);\n return newElement;\n }\n const newElement = new Element(element.name, element.attrs, visitAllWithSiblings(this, element.children), element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.i18n);\n this.originalNodeMap?.set(newElement, element);\n return newElement;\n }\n visitAttribute(attribute, context) {\n return attribute.name !== PRESERVE_WS_ATTR_NAME ? attribute : null;\n }\n visitText(text, context) {\n const isNotBlank = text.value.match(NO_WS_REGEXP);\n const hasExpansionSibling = context && (context.prev instanceof Expansion || context.next instanceof Expansion);\n // Do not trim whitespace within ICU expansions when preserving significant whitespace.\n // Historically, ICU whitespace was never trimmed and this is really a bug. However fixing it\n // would change message IDs which we can't easily do. Instead we only trim ICU whitespace within\n // ICU expansions when not preserving significant whitespace, which is the new behavior where it\n // most matters.\n const inIcuExpansion = this.icuExpansionDepth > 0;\n if (inIcuExpansion && this.preserveSignificantWhitespace) return text;\n if (isNotBlank || hasExpansionSibling) {\n // Process the whitespace in the tokens of this Text node\n const tokens = text.tokens.map(token => token.type === 5 /* TokenType.TEXT */ ? createWhitespaceProcessedTextToken(token) : token);\n // Fully trim message when significant whitespace is not preserved.\n if (!this.preserveSignificantWhitespace && tokens.length > 0) {\n // The first token should only call `.trimStart()` and the last token\n // should only call `.trimEnd()`, but there might be only one token which\n // needs to call both.\n const firstToken = tokens[0];\n tokens.splice(0, 1, trimLeadingWhitespace(firstToken, context));\n const lastToken = tokens[tokens.length - 1]; // Could be the same as the first token.\n tokens.splice(tokens.length - 1, 1, trimTrailingWhitespace(lastToken, context));\n }\n // Process the whitespace of the value of this Text node. Also trim the leading/trailing\n // whitespace when we don't need to preserve significant whitespace.\n const processed = processWhitespace(text.value);\n const value = this.preserveSignificantWhitespace ? processed : trimLeadingAndTrailingWhitespace(processed, context);\n const result = new Text(value, text.sourceSpan, tokens, text.i18n);\n this.originalNodeMap?.set(result, text);\n return result;\n }\n return null;\n }\n visitComment(comment, context) {\n return comment;\n }\n visitExpansion(expansion, context) {\n this.icuExpansionDepth++;\n let newExpansion;\n try {\n newExpansion = new Expansion(expansion.switchValue, expansion.type, visitAllWithSiblings(this, expansion.cases), expansion.sourceSpan, expansion.switchValueSourceSpan, expansion.i18n);\n } finally {\n this.icuExpansionDepth--;\n }\n this.originalNodeMap?.set(newExpansion, expansion);\n return newExpansion;\n }\n visitExpansionCase(expansionCase, context) {\n const newExpansionCase = new ExpansionCase(expansionCase.value, visitAllWithSiblings(this, expansionCase.expression), expansionCase.sourceSpan, expansionCase.valueSourceSpan, expansionCase.expSourceSpan);\n this.originalNodeMap?.set(newExpansionCase, expansionCase);\n return newExpansionCase;\n }\n visitBlock(block, context) {\n const newBlock = new Block(block.name, block.parameters, visitAllWithSiblings(this, block.children), block.sourceSpan, block.nameSpan, block.startSourceSpan, block.endSourceSpan);\n this.originalNodeMap?.set(newBlock, block);\n return newBlock;\n }\n visitBlockParameter(parameter, context) {\n return parameter;\n }\n visitLetDeclaration(decl, context) {\n return decl;\n }\n visit(_node, context) {\n // `visitAllWithSiblings` provides context necessary for ICU messages to be handled correctly.\n // Prefer that over calling `html.visitAll` directly on this visitor.\n if (this.requireContext && !context) {\n throw new Error(`WhitespaceVisitor requires context. Visit via \\`visitAllWithSiblings\\` to get this context.`);\n }\n return false;\n }\n}\nfunction trimLeadingWhitespace(token, context) {\n if (token.type !== 5 /* TokenType.TEXT */) return token;\n const isFirstTokenInTag = !context?.prev;\n if (!isFirstTokenInTag) return token;\n return transformTextToken(token, text => text.trimStart());\n}\nfunction trimTrailingWhitespace(token, context) {\n if (token.type !== 5 /* TokenType.TEXT */) return token;\n const isLastTokenInTag = !context?.next;\n if (!isLastTokenInTag) return token;\n return transformTextToken(token, text => text.trimEnd());\n}\nfunction trimLeadingAndTrailingWhitespace(text, context) {\n const isFirstTokenInTag = !context?.prev;\n const isLastTokenInTag = !context?.next;\n const maybeTrimmedStart = isFirstTokenInTag ? text.trimStart() : text;\n const maybeTrimmed = isLastTokenInTag ? maybeTrimmedStart.trimEnd() : maybeTrimmedStart;\n return maybeTrimmed;\n}\nfunction createWhitespaceProcessedTextToken({\n type,\n parts,\n sourceSpan\n}) {\n return {\n type,\n parts: [processWhitespace(parts[0])],\n sourceSpan\n };\n}\nfunction transformTextToken({\n type,\n parts,\n sourceSpan\n}, transform) {\n // `TextToken` only ever has one part as defined in its type, so we just transform the first element.\n return {\n type,\n parts: [transform(parts[0])],\n sourceSpan\n };\n}\nfunction processWhitespace(text) {\n return replaceNgsp(text).replace(WS_REPLACE_REGEXP, ' ');\n}\nfunction removeWhitespaces(htmlAstWithErrors, preserveSignificantWhitespace) {\n return new ParseTreeResult(visitAllWithSiblings(new WhitespaceVisitor(preserveSignificantWhitespace), htmlAstWithErrors.rootNodes), htmlAstWithErrors.errors);\n}\nfunction visitAllWithSiblings(visitor, nodes) {\n const result = [];\n nodes.forEach((ast, i) => {\n const context = {\n prev: nodes[i - 1],\n next: nodes[i + 1]\n };\n const astResult = ast.visit(visitor, context);\n if (astResult) {\n result.push(astResult);\n }\n });\n return result;\n}\nvar TokenType;\n(function (TokenType) {\n TokenType[TokenType[\"Character\"] = 0] = \"Character\";\n TokenType[TokenType[\"Identifier\"] = 1] = \"Identifier\";\n TokenType[TokenType[\"PrivateIdentifier\"] = 2] = \"PrivateIdentifier\";\n TokenType[TokenType[\"Keyword\"] = 3] = \"Keyword\";\n TokenType[TokenType[\"String\"] = 4] = \"String\";\n TokenType[TokenType[\"Operator\"] = 5] = \"Operator\";\n TokenType[TokenType[\"Number\"] = 6] = \"Number\";\n TokenType[TokenType[\"Error\"] = 7] = \"Error\";\n})(TokenType || (TokenType = {}));\nconst KEYWORDS = ['var', 'let', 'as', 'null', 'undefined', 'true', 'false', 'if', 'else', 'this'];\nclass Lexer {\n tokenize(text) {\n const scanner = new _Scanner(text);\n const tokens = [];\n let token = scanner.scanToken();\n while (token != null) {\n tokens.push(token);\n token = scanner.scanToken();\n }\n return tokens;\n }\n}\nclass Token {\n constructor(index, end, type, numValue, strValue) {\n this.index = index;\n this.end = end;\n this.type = type;\n this.numValue = numValue;\n this.strValue = strValue;\n }\n isCharacter(code) {\n return this.type == TokenType.Character && this.numValue == code;\n }\n isNumber() {\n return this.type == TokenType.Number;\n }\n isString() {\n return this.type == TokenType.String;\n }\n isOperator(operator) {\n return this.type == TokenType.Operator && this.strValue == operator;\n }\n isIdentifier() {\n return this.type == TokenType.Identifier;\n }\n isPrivateIdentifier() {\n return this.type == TokenType.PrivateIdentifier;\n }\n isKeyword() {\n return this.type == TokenType.Keyword;\n }\n isKeywordLet() {\n return this.type == TokenType.Keyword && this.strValue == 'let';\n }\n isKeywordAs() {\n return this.type == TokenType.Keyword && this.strValue == 'as';\n }\n isKeywordNull() {\n return this.type == TokenType.Keyword && this.strValue == 'null';\n }\n isKeywordUndefined() {\n return this.type == TokenType.Keyword && this.strValue == 'undefined';\n }\n isKeywordTrue() {\n return this.type == TokenType.Keyword && this.strValue == 'true';\n }\n isKeywordFalse() {\n return this.type == TokenType.Keyword && this.strValue == 'false';\n }\n isKeywordThis() {\n return this.type == TokenType.Keyword && this.strValue == 'this';\n }\n isError() {\n return this.type == TokenType.Error;\n }\n toNumber() {\n return this.type == TokenType.Number ? this.numValue : -1;\n }\n toString() {\n switch (this.type) {\n case TokenType.Character:\n case TokenType.Identifier:\n case TokenType.Keyword:\n case TokenType.Operator:\n case TokenType.PrivateIdentifier:\n case TokenType.String:\n case TokenType.Error:\n return this.strValue;\n case TokenType.Number:\n return this.numValue.toString();\n default:\n return null;\n }\n }\n}\nfunction newCharacterToken(index, end, code) {\n return new Token(index, end, TokenType.Character, code, String.fromCharCode(code));\n}\nfunction newIdentifierToken(index, end, text) {\n return new Token(index, end, TokenType.Identifier, 0, text);\n}\nfunction newPrivateIdentifierToken(index, end, text) {\n return new Token(index, end, TokenType.PrivateIdentifier, 0, text);\n}\nfunction newKeywordToken(index, end, text) {\n return new Token(index, end, TokenType.Keyword, 0, text);\n}\nfunction newOperatorToken(index, end, text) {\n return new Token(index, end, TokenType.Operator, 0, text);\n}\nfunction newStringToken(index, end, text) {\n return new Token(index, end, TokenType.String, 0, text);\n}\nfunction newNumberToken(index, end, n) {\n return new Token(index, end, TokenType.Number, n, '');\n}\nfunction newErrorToken(index, end, message) {\n return new Token(index, end, TokenType.Error, 0, message);\n}\nconst EOF = new Token(-1, -1, TokenType.Character, 0, '');\nclass _Scanner {\n constructor(input) {\n this.input = input;\n this.peek = 0;\n this.index = -1;\n this.length = input.length;\n this.advance();\n }\n advance() {\n this.peek = ++this.index >= this.length ? $EOF : this.input.charCodeAt(this.index);\n }\n scanToken() {\n const input = this.input,\n length = this.length;\n let peek = this.peek,\n index = this.index;\n // Skip whitespace.\n while (peek <= $SPACE) {\n if (++index >= length) {\n peek = $EOF;\n break;\n } else {\n peek = input.charCodeAt(index);\n }\n }\n this.peek = peek;\n this.index = index;\n if (index >= length) {\n return null;\n }\n // Handle identifiers and numbers.\n if (isIdentifierStart(peek)) return this.scanIdentifier();\n if (isDigit(peek)) return this.scanNumber(index);\n const start = index;\n switch (peek) {\n case $PERIOD:\n this.advance();\n return isDigit(this.peek) ? this.scanNumber(start) : newCharacterToken(start, this.index, $PERIOD);\n case $LPAREN:\n case $RPAREN:\n case $LBRACE:\n case $RBRACE:\n case $LBRACKET:\n case $RBRACKET:\n case $COMMA:\n case $COLON:\n case $SEMICOLON:\n return this.scanCharacter(start, peek);\n case $SQ:\n case $DQ:\n return this.scanString();\n case $HASH:\n return this.scanPrivateIdentifier();\n case $PLUS:\n case $MINUS:\n case $STAR:\n case $SLASH:\n case $PERCENT:\n case $CARET:\n return this.scanOperator(start, String.fromCharCode(peek));\n case $QUESTION:\n return this.scanQuestion(start);\n case $LT:\n case $GT:\n return this.scanComplexOperator(start, String.fromCharCode(peek), $EQ, '=');\n case $BANG:\n case $EQ:\n return this.scanComplexOperator(start, String.fromCharCode(peek), $EQ, '=', $EQ, '=');\n case $AMPERSAND:\n return this.scanComplexOperator(start, '&', $AMPERSAND, '&');\n case $BAR:\n return this.scanComplexOperator(start, '|', $BAR, '|');\n case $NBSP:\n while (isWhitespace(this.peek)) this.advance();\n return this.scanToken();\n }\n this.advance();\n return this.error(`Unexpected character [${String.fromCharCode(peek)}]`, 0);\n }\n scanCharacter(start, code) {\n this.advance();\n return newCharacterToken(start, this.index, code);\n }\n scanOperator(start, str) {\n this.advance();\n return newOperatorToken(start, this.index, str);\n }\n /**\n * Tokenize a 2/3 char long operator\n *\n * @param start start index in the expression\n * @param one first symbol (always part of the operator)\n * @param twoCode code point for the second symbol\n * @param two second symbol (part of the operator when the second code point matches)\n * @param threeCode code point for the third symbol\n * @param three third symbol (part of the operator when provided and matches source expression)\n */\n scanComplexOperator(start, one, twoCode, two, threeCode, three) {\n this.advance();\n let str = one;\n if (this.peek == twoCode) {\n this.advance();\n str += two;\n }\n if (threeCode != null && this.peek == threeCode) {\n this.advance();\n str += three;\n }\n return newOperatorToken(start, this.index, str);\n }\n scanIdentifier() {\n const start = this.index;\n this.advance();\n while (isIdentifierPart(this.peek)) this.advance();\n const str = this.input.substring(start, this.index);\n return KEYWORDS.indexOf(str) > -1 ? newKeywordToken(start, this.index, str) : newIdentifierToken(start, this.index, str);\n }\n /** Scans an ECMAScript private identifier. */\n scanPrivateIdentifier() {\n const start = this.index;\n this.advance();\n if (!isIdentifierStart(this.peek)) {\n return this.error('Invalid character [#]', -1);\n }\n while (isIdentifierPart(this.peek)) this.advance();\n const identifierName = this.input.substring(start, this.index);\n return newPrivateIdentifierToken(start, this.index, identifierName);\n }\n scanNumber(start) {\n let simple = this.index === start;\n let hasSeparators = false;\n this.advance(); // Skip initial digit.\n while (true) {\n if (isDigit(this.peek)) {\n // Do nothing.\n } else if (this.peek === $_) {\n // Separators are only valid when they're surrounded by digits. E.g. `1_0_1` is\n // valid while `_101` and `101_` are not. The separator can't be next to the decimal\n // point or another separator either. Note that it's unlikely that we'll hit a case where\n // the underscore is at the start, because that's a valid identifier and it will be picked\n // up earlier in the parsing. We validate for it anyway just in case.\n if (!isDigit(this.input.charCodeAt(this.index - 1)) || !isDigit(this.input.charCodeAt(this.index + 1))) {\n return this.error('Invalid numeric separator', 0);\n }\n hasSeparators = true;\n } else if (this.peek === $PERIOD) {\n simple = false;\n } else if (isExponentStart(this.peek)) {\n this.advance();\n if (isExponentSign(this.peek)) this.advance();\n if (!isDigit(this.peek)) return this.error('Invalid exponent', -1);\n simple = false;\n } else {\n break;\n }\n this.advance();\n }\n let str = this.input.substring(start, this.index);\n if (hasSeparators) {\n str = str.replace(/_/g, '');\n }\n const value = simple ? parseIntAutoRadix(str) : parseFloat(str);\n return newNumberToken(start, this.index, value);\n }\n scanString() {\n const start = this.index;\n const quote = this.peek;\n this.advance(); // Skip initial quote.\n let buffer = '';\n let marker = this.index;\n const input = this.input;\n while (this.peek != quote) {\n if (this.peek == $BACKSLASH) {\n buffer += input.substring(marker, this.index);\n let unescapedCode;\n this.advance(); // mutates this.peek\n // @ts-expect-error see microsoft/TypeScript#9998\n if (this.peek == $u) {\n // 4 character hex code for unicode character.\n const hex = input.substring(this.index + 1, this.index + 5);\n if (/^[0-9a-f]+$/i.test(hex)) {\n unescapedCode = parseInt(hex, 16);\n } else {\n return this.error(`Invalid unicode escape [\\\\u${hex}]`, 0);\n }\n for (let i = 0; i < 5; i++) {\n this.advance();\n }\n } else {\n unescapedCode = unescape(this.peek);\n this.advance();\n }\n buffer += String.fromCharCode(unescapedCode);\n marker = this.index;\n } else if (this.peek == $EOF) {\n return this.error('Unterminated quote', 0);\n } else {\n this.advance();\n }\n }\n const last = input.substring(marker, this.index);\n this.advance(); // Skip terminating quote.\n return newStringToken(start, this.index, buffer + last);\n }\n scanQuestion(start) {\n this.advance();\n let str = '?';\n // Either `a ?? b` or 'a?.b'.\n if (this.peek === $QUESTION || this.peek === $PERIOD) {\n str += this.peek === $PERIOD ? '.' : '?';\n this.advance();\n }\n return newOperatorToken(start, this.index, str);\n }\n error(message, offset) {\n const position = this.index + offset;\n return newErrorToken(position, this.index, `Lexer Error: ${message} at column ${position} in expression [${this.input}]`);\n }\n}\nfunction isIdentifierStart(code) {\n return $a <= code && code <= $z || $A <= code && code <= $Z || code == $_ || code == $$;\n}\nfunction isIdentifier(input) {\n if (input.length == 0) return false;\n const scanner = new _Scanner(input);\n if (!isIdentifierStart(scanner.peek)) return false;\n scanner.advance();\n while (scanner.peek !== $EOF) {\n if (!isIdentifierPart(scanner.peek)) return false;\n scanner.advance();\n }\n return true;\n}\nfunction isIdentifierPart(code) {\n return isAsciiLetter(code) || isDigit(code) || code == $_ || code == $$;\n}\nfunction isExponentStart(code) {\n return code == $e || code == $E;\n}\nfunction isExponentSign(code) {\n return code == $MINUS || code == $PLUS;\n}\nfunction unescape(code) {\n switch (code) {\n case $n:\n return $LF;\n case $f:\n return $FF;\n case $r:\n return $CR;\n case $t:\n return $TAB;\n case $v:\n return $VTAB;\n default:\n return code;\n }\n}\nfunction parseIntAutoRadix(text) {\n const result = parseInt(text);\n if (isNaN(result)) {\n throw new Error('Invalid integer literal when parsing ' + text);\n }\n return result;\n}\nclass SplitInterpolation {\n constructor(strings, expressions, offsets) {\n this.strings = strings;\n this.expressions = expressions;\n this.offsets = offsets;\n }\n}\nclass TemplateBindingParseResult {\n constructor(templateBindings, warnings, errors) {\n this.templateBindings = templateBindings;\n this.warnings = warnings;\n this.errors = errors;\n }\n}\nclass Parser {\n constructor(_lexer) {\n this._lexer = _lexer;\n this.errors = [];\n }\n parseAction(input, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {\n this._checkNoInterpolation(input, location, interpolationConfig);\n const sourceToLex = this._stripComments(input);\n const tokens = this._lexer.tokenize(sourceToLex);\n const ast = new _ParseAST(input, location, absoluteOffset, tokens, 1 /* ParseFlags.Action */, this.errors, 0).parseChain();\n return new ASTWithSource(ast, input, location, absoluteOffset, this.errors);\n }\n parseBinding(input, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {\n const ast = this._parseBindingAst(input, location, absoluteOffset, interpolationConfig);\n return new ASTWithSource(ast, input, location, absoluteOffset, this.errors);\n }\n checkSimpleExpression(ast) {\n const checker = new SimpleExpressionChecker();\n ast.visit(checker);\n return checker.errors;\n }\n // Host bindings parsed here\n parseSimpleBinding(input, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {\n const ast = this._parseBindingAst(input, location, absoluteOffset, interpolationConfig);\n const errors = this.checkSimpleExpression(ast);\n if (errors.length > 0) {\n this._reportError(`Host binding expression cannot contain ${errors.join(' ')}`, input, location);\n }\n return new ASTWithSource(ast, input, location, absoluteOffset, this.errors);\n }\n _reportError(message, input, errLocation, ctxLocation) {\n this.errors.push(new ParserError(message, input, errLocation, ctxLocation));\n }\n _parseBindingAst(input, location, absoluteOffset, interpolationConfig) {\n this._checkNoInterpolation(input, location, interpolationConfig);\n const sourceToLex = this._stripComments(input);\n const tokens = this._lexer.tokenize(sourceToLex);\n return new _ParseAST(input, location, absoluteOffset, tokens, 0 /* ParseFlags.None */, this.errors, 0).parseChain();\n }\n /**\n * Parse microsyntax template expression and return a list of bindings or\n * parsing errors in case the given expression is invalid.\n *\n * For example,\n * ```\n *
\n * ^ ^ absoluteValueOffset for `templateValue`\n * absoluteKeyOffset for `templateKey`\n * ```\n * contains three bindings:\n * 1. ngFor -> null\n * 2. item -> NgForOfContext.$implicit\n * 3. ngForOf -> items\n *\n * This is apparent from the de-sugared template:\n * ```\n * \n * ```\n *\n * @param templateKey name of directive, without the * prefix. For example: ngIf, ngFor\n * @param templateValue RHS of the microsyntax attribute\n * @param templateUrl template filename if it's external, component filename if it's inline\n * @param absoluteKeyOffset start of the `templateKey`\n * @param absoluteValueOffset start of the `templateValue`\n */\n parseTemplateBindings(templateKey, templateValue, templateUrl, absoluteKeyOffset, absoluteValueOffset) {\n const tokens = this._lexer.tokenize(templateValue);\n const parser = new _ParseAST(templateValue, templateUrl, absoluteValueOffset, tokens, 0 /* ParseFlags.None */, this.errors, 0 /* relative offset */);\n return parser.parseTemplateBindings({\n source: templateKey,\n span: new AbsoluteSourceSpan(absoluteKeyOffset, absoluteKeyOffset + templateKey.length)\n });\n }\n parseInterpolation(input, location, absoluteOffset, interpolatedTokens, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {\n const {\n strings,\n expressions,\n offsets\n } = this.splitInterpolation(input, location, interpolatedTokens, interpolationConfig);\n if (expressions.length === 0) return null;\n const expressionNodes = [];\n for (let i = 0; i < expressions.length; ++i) {\n const expressionText = expressions[i].text;\n const sourceToLex = this._stripComments(expressionText);\n const tokens = this._lexer.tokenize(sourceToLex);\n const ast = new _ParseAST(input, location, absoluteOffset, tokens, 0 /* ParseFlags.None */, this.errors, offsets[i]).parseChain();\n expressionNodes.push(ast);\n }\n return this.createInterpolationAst(strings.map(s => s.text), expressionNodes, input, location, absoluteOffset);\n }\n /**\n * Similar to `parseInterpolation`, but treats the provided string as a single expression\n * element that would normally appear within the interpolation prefix and suffix (`{{` and `}}`).\n * This is used for parsing the switch expression in ICUs.\n */\n parseInterpolationExpression(expression, location, absoluteOffset) {\n const sourceToLex = this._stripComments(expression);\n const tokens = this._lexer.tokenize(sourceToLex);\n const ast = new _ParseAST(expression, location, absoluteOffset, tokens, 0 /* ParseFlags.None */, this.errors, 0).parseChain();\n const strings = ['', '']; // The prefix and suffix strings are both empty\n return this.createInterpolationAst(strings, [ast], expression, location, absoluteOffset);\n }\n createInterpolationAst(strings, expressions, input, location, absoluteOffset) {\n const span = new ParseSpan(0, input.length);\n const interpolation = new Interpolation$1(span, span.toAbsolute(absoluteOffset), strings, expressions);\n return new ASTWithSource(interpolation, input, location, absoluteOffset, this.errors);\n }\n /**\n * Splits a string of text into \"raw\" text segments and expressions present in interpolations in\n * the string.\n * Returns `null` if there are no interpolations, otherwise a\n * `SplitInterpolation` with splits that look like\n * ... \n */\n splitInterpolation(input, location, interpolatedTokens, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {\n const strings = [];\n const expressions = [];\n const offsets = [];\n const inputToTemplateIndexMap = interpolatedTokens ? getIndexMapForOriginalTemplate(interpolatedTokens) : null;\n let i = 0;\n let atInterpolation = false;\n let extendLastString = false;\n let {\n start: interpStart,\n end: interpEnd\n } = interpolationConfig;\n while (i < input.length) {\n if (!atInterpolation) {\n // parse until starting {{\n const start = i;\n i = input.indexOf(interpStart, i);\n if (i === -1) {\n i = input.length;\n }\n const text = input.substring(start, i);\n strings.push({\n text,\n start,\n end: i\n });\n atInterpolation = true;\n } else {\n // parse from starting {{ to ending }} while ignoring content inside quotes.\n const fullStart = i;\n const exprStart = fullStart + interpStart.length;\n const exprEnd = this._getInterpolationEndIndex(input, interpEnd, exprStart);\n if (exprEnd === -1) {\n // Could not find the end of the interpolation; do not parse an expression.\n // Instead we should extend the content on the last raw string.\n atInterpolation = false;\n extendLastString = true;\n break;\n }\n const fullEnd = exprEnd + interpEnd.length;\n const text = input.substring(exprStart, exprEnd);\n if (text.trim().length === 0) {\n this._reportError('Blank expressions are not allowed in interpolated strings', input, `at column ${i} in`, location);\n }\n expressions.push({\n text,\n start: fullStart,\n end: fullEnd\n });\n const startInOriginalTemplate = inputToTemplateIndexMap?.get(fullStart) ?? fullStart;\n const offset = startInOriginalTemplate + interpStart.length;\n offsets.push(offset);\n i = fullEnd;\n atInterpolation = false;\n }\n }\n if (!atInterpolation) {\n // If we are now at a text section, add the remaining content as a raw string.\n if (extendLastString) {\n const piece = strings[strings.length - 1];\n piece.text += input.substring(i);\n piece.end = input.length;\n } else {\n strings.push({\n text: input.substring(i),\n start: i,\n end: input.length\n });\n }\n }\n return new SplitInterpolation(strings, expressions, offsets);\n }\n wrapLiteralPrimitive(input, location, absoluteOffset) {\n const span = new ParseSpan(0, input == null ? 0 : input.length);\n return new ASTWithSource(new LiteralPrimitive(span, span.toAbsolute(absoluteOffset), input), input, location, absoluteOffset, this.errors);\n }\n _stripComments(input) {\n const i = this._commentStart(input);\n return i != null ? input.substring(0, i) : input;\n }\n _commentStart(input) {\n let outerQuote = null;\n for (let i = 0; i < input.length - 1; i++) {\n const char = input.charCodeAt(i);\n const nextChar = input.charCodeAt(i + 1);\n if (char === $SLASH && nextChar == $SLASH && outerQuote == null) return i;\n if (outerQuote === char) {\n outerQuote = null;\n } else if (outerQuote == null && isQuote(char)) {\n outerQuote = char;\n }\n }\n return null;\n }\n _checkNoInterpolation(input, location, {\n start,\n end\n }) {\n let startIndex = -1;\n let endIndex = -1;\n for (const charIndex of this._forEachUnquotedChar(input, 0)) {\n if (startIndex === -1) {\n if (input.startsWith(start)) {\n startIndex = charIndex;\n }\n } else {\n endIndex = this._getInterpolationEndIndex(input, end, charIndex);\n if (endIndex > -1) {\n break;\n }\n }\n }\n if (startIndex > -1 && endIndex > -1) {\n this._reportError(`Got interpolation (${start}${end}) where expression was expected`, input, `at column ${startIndex} in`, location);\n }\n }\n /**\n * Finds the index of the end of an interpolation expression\n * while ignoring comments and quoted content.\n */\n _getInterpolationEndIndex(input, expressionEnd, start) {\n for (const charIndex of this._forEachUnquotedChar(input, start)) {\n if (input.startsWith(expressionEnd, charIndex)) {\n return charIndex;\n }\n // Nothing else in the expression matters after we've\n // hit a comment so look directly for the end token.\n if (input.startsWith('//', charIndex)) {\n return input.indexOf(expressionEnd, charIndex);\n }\n }\n return -1;\n }\n /**\n * Generator used to iterate over the character indexes of a string that are outside of quotes.\n * @param input String to loop through.\n * @param start Index within the string at which to start.\n */\n *_forEachUnquotedChar(input, start) {\n let currentQuote = null;\n let escapeCount = 0;\n for (let i = start; i < input.length; i++) {\n const char = input[i];\n // Skip the characters inside quotes. Note that we only care about the outer-most\n // quotes matching up and we need to account for escape characters.\n if (isQuote(input.charCodeAt(i)) && (currentQuote === null || currentQuote === char) && escapeCount % 2 === 0) {\n currentQuote = currentQuote === null ? char : null;\n } else if (currentQuote === null) {\n yield i;\n }\n escapeCount = char === '\\\\' ? escapeCount + 1 : 0;\n }\n }\n}\n/** Describes a stateful context an expression parser is in. */\nvar ParseContextFlags;\n(function (ParseContextFlags) {\n ParseContextFlags[ParseContextFlags[\"None\"] = 0] = \"None\";\n /**\n * A Writable context is one in which a value may be written to an lvalue.\n * For example, after we see a property access, we may expect a write to the\n * property via the \"=\" operator.\n * prop\n * ^ possible \"=\" after\n */\n ParseContextFlags[ParseContextFlags[\"Writable\"] = 1] = \"Writable\";\n})(ParseContextFlags || (ParseContextFlags = {}));\nclass _ParseAST {\n constructor(input, location, absoluteOffset, tokens, parseFlags, errors, offset) {\n this.input = input;\n this.location = location;\n this.absoluteOffset = absoluteOffset;\n this.tokens = tokens;\n this.parseFlags = parseFlags;\n this.errors = errors;\n this.offset = offset;\n this.rparensExpected = 0;\n this.rbracketsExpected = 0;\n this.rbracesExpected = 0;\n this.context = ParseContextFlags.None;\n // Cache of expression start and input indeces to the absolute source span they map to, used to\n // prevent creating superfluous source spans in `sourceSpan`.\n // A serial of the expression start and input index is used for mapping because both are stateful\n // and may change for subsequent expressions visited by the parser.\n this.sourceSpanCache = new Map();\n this.index = 0;\n }\n peek(offset) {\n const i = this.index + offset;\n return i < this.tokens.length ? this.tokens[i] : EOF;\n }\n get next() {\n return this.peek(0);\n }\n /** Whether all the parser input has been processed. */\n get atEOF() {\n return this.index >= this.tokens.length;\n }\n /**\n * Index of the next token to be processed, or the end of the last token if all have been\n * processed.\n */\n get inputIndex() {\n return this.atEOF ? this.currentEndIndex : this.next.index + this.offset;\n }\n /**\n * End index of the last processed token, or the start of the first token if none have been\n * processed.\n */\n get currentEndIndex() {\n if (this.index > 0) {\n const curToken = this.peek(-1);\n return curToken.end + this.offset;\n }\n // No tokens have been processed yet; return the next token's start or the length of the input\n // if there is no token.\n if (this.tokens.length === 0) {\n return this.input.length + this.offset;\n }\n return this.next.index + this.offset;\n }\n /**\n * Returns the absolute offset of the start of the current token.\n */\n get currentAbsoluteOffset() {\n return this.absoluteOffset + this.inputIndex;\n }\n /**\n * Retrieve a `ParseSpan` from `start` to the current position (or to `artificialEndIndex` if\n * provided).\n *\n * @param start Position from which the `ParseSpan` will start.\n * @param artificialEndIndex Optional ending index to be used if provided (and if greater than the\n * natural ending index)\n */\n span(start, artificialEndIndex) {\n let endIndex = this.currentEndIndex;\n if (artificialEndIndex !== undefined && artificialEndIndex > this.currentEndIndex) {\n endIndex = artificialEndIndex;\n }\n // In some unusual parsing scenarios (like when certain tokens are missing and an `EmptyExpr` is\n // being created), the current token may already be advanced beyond the `currentEndIndex`. This\n // appears to be a deep-seated parser bug.\n //\n // As a workaround for now, swap the start and end indices to ensure a valid `ParseSpan`.\n // TODO(alxhub): fix the bug upstream in the parser state, and remove this workaround.\n if (start > endIndex) {\n const tmp = endIndex;\n endIndex = start;\n start = tmp;\n }\n return new ParseSpan(start, endIndex);\n }\n sourceSpan(start, artificialEndIndex) {\n const serial = `${start}@${this.inputIndex}:${artificialEndIndex}`;\n if (!this.sourceSpanCache.has(serial)) {\n this.sourceSpanCache.set(serial, this.span(start, artificialEndIndex).toAbsolute(this.absoluteOffset));\n }\n return this.sourceSpanCache.get(serial);\n }\n advance() {\n this.index++;\n }\n /**\n * Executes a callback in the provided context.\n */\n withContext(context, cb) {\n this.context |= context;\n const ret = cb();\n this.context ^= context;\n return ret;\n }\n consumeOptionalCharacter(code) {\n if (this.next.isCharacter(code)) {\n this.advance();\n return true;\n } else {\n return false;\n }\n }\n peekKeywordLet() {\n return this.next.isKeywordLet();\n }\n peekKeywordAs() {\n return this.next.isKeywordAs();\n }\n /**\n * Consumes an expected character, otherwise emits an error about the missing expected character\n * and skips over the token stream until reaching a recoverable point.\n *\n * See `this.error` and `this.skip` for more details.\n */\n expectCharacter(code) {\n if (this.consumeOptionalCharacter(code)) return;\n this.error(`Missing expected ${String.fromCharCode(code)}`);\n }\n consumeOptionalOperator(op) {\n if (this.next.isOperator(op)) {\n this.advance();\n return true;\n } else {\n return false;\n }\n }\n expectOperator(operator) {\n if (this.consumeOptionalOperator(operator)) return;\n this.error(`Missing expected operator ${operator}`);\n }\n prettyPrintToken(tok) {\n return tok === EOF ? 'end of input' : `token ${tok}`;\n }\n expectIdentifierOrKeyword() {\n const n = this.next;\n if (!n.isIdentifier() && !n.isKeyword()) {\n if (n.isPrivateIdentifier()) {\n this._reportErrorForPrivateIdentifier(n, 'expected identifier or keyword');\n } else {\n this.error(`Unexpected ${this.prettyPrintToken(n)}, expected identifier or keyword`);\n }\n return null;\n }\n this.advance();\n return n.toString();\n }\n expectIdentifierOrKeywordOrString() {\n const n = this.next;\n if (!n.isIdentifier() && !n.isKeyword() && !n.isString()) {\n if (n.isPrivateIdentifier()) {\n this._reportErrorForPrivateIdentifier(n, 'expected identifier, keyword or string');\n } else {\n this.error(`Unexpected ${this.prettyPrintToken(n)}, expected identifier, keyword, or string`);\n }\n return '';\n }\n this.advance();\n return n.toString();\n }\n parseChain() {\n const exprs = [];\n const start = this.inputIndex;\n while (this.index < this.tokens.length) {\n const expr = this.parsePipe();\n exprs.push(expr);\n if (this.consumeOptionalCharacter($SEMICOLON)) {\n if (!(this.parseFlags & 1 /* ParseFlags.Action */)) {\n this.error('Binding expression cannot contain chained expression');\n }\n while (this.consumeOptionalCharacter($SEMICOLON)) {} // read all semicolons\n } else if (this.index < this.tokens.length) {\n const errorIndex = this.index;\n this.error(`Unexpected token '${this.next}'`);\n // The `error` call above will skip ahead to the next recovery point in an attempt to\n // recover part of the expression, but that might be the token we started from which will\n // lead to an infinite loop. If that's the case, break the loop assuming that we can't\n // parse further.\n if (this.index === errorIndex) {\n break;\n }\n }\n }\n if (exprs.length === 0) {\n // We have no expressions so create an empty expression that spans the entire input length\n const artificialStart = this.offset;\n const artificialEnd = this.offset + this.input.length;\n return new EmptyExpr$1(this.span(artificialStart, artificialEnd), this.sourceSpan(artificialStart, artificialEnd));\n }\n if (exprs.length == 1) return exprs[0];\n return new Chain(this.span(start), this.sourceSpan(start), exprs);\n }\n parsePipe() {\n const start = this.inputIndex;\n let result = this.parseExpression();\n if (this.consumeOptionalOperator('|')) {\n if (this.parseFlags & 1 /* ParseFlags.Action */) {\n this.error(`Cannot have a pipe in an action expression`);\n }\n do {\n const nameStart = this.inputIndex;\n let nameId = this.expectIdentifierOrKeyword();\n let nameSpan;\n let fullSpanEnd = undefined;\n if (nameId !== null) {\n nameSpan = this.sourceSpan(nameStart);\n } else {\n // No valid identifier was found, so we'll assume an empty pipe name ('').\n nameId = '';\n // However, there may have been whitespace present between the pipe character and the next\n // token in the sequence (or the end of input). We want to track this whitespace so that\n // the `BindingPipe` we produce covers not just the pipe character, but any trailing\n // whitespace beyond it. Another way of thinking about this is that the zero-length name\n // is assumed to be at the end of any whitespace beyond the pipe character.\n //\n // Therefore, we push the end of the `ParseSpan` for this pipe all the way up to the\n // beginning of the next token, or until the end of input if the next token is EOF.\n fullSpanEnd = this.next.index !== -1 ? this.next.index : this.input.length + this.offset;\n // The `nameSpan` for an empty pipe name is zero-length at the end of any whitespace\n // beyond the pipe character.\n nameSpan = new ParseSpan(fullSpanEnd, fullSpanEnd).toAbsolute(this.absoluteOffset);\n }\n const args = [];\n while (this.consumeOptionalCharacter($COLON)) {\n args.push(this.parseExpression());\n // If there are additional expressions beyond the name, then the artificial end for the\n // name is no longer relevant.\n }\n result = new BindingPipe(this.span(start), this.sourceSpan(start, fullSpanEnd), result, nameId, args, nameSpan);\n } while (this.consumeOptionalOperator('|'));\n }\n return result;\n }\n parseExpression() {\n return this.parseConditional();\n }\n parseConditional() {\n const start = this.inputIndex;\n const result = this.parseLogicalOr();\n if (this.consumeOptionalOperator('?')) {\n const yes = this.parsePipe();\n let no;\n if (!this.consumeOptionalCharacter($COLON)) {\n const end = this.inputIndex;\n const expression = this.input.substring(start, end);\n this.error(`Conditional expression ${expression} requires all 3 expressions`);\n no = new EmptyExpr$1(this.span(start), this.sourceSpan(start));\n } else {\n no = this.parsePipe();\n }\n return new Conditional(this.span(start), this.sourceSpan(start), result, yes, no);\n } else {\n return result;\n }\n }\n parseLogicalOr() {\n // '||'\n const start = this.inputIndex;\n let result = this.parseLogicalAnd();\n while (this.consumeOptionalOperator('||')) {\n const right = this.parseLogicalAnd();\n result = new Binary(this.span(start), this.sourceSpan(start), '||', result, right);\n }\n return result;\n }\n parseLogicalAnd() {\n // '&&'\n const start = this.inputIndex;\n let result = this.parseNullishCoalescing();\n while (this.consumeOptionalOperator('&&')) {\n const right = this.parseNullishCoalescing();\n result = new Binary(this.span(start), this.sourceSpan(start), '&&', result, right);\n }\n return result;\n }\n parseNullishCoalescing() {\n // '??'\n const start = this.inputIndex;\n let result = this.parseEquality();\n while (this.consumeOptionalOperator('??')) {\n const right = this.parseEquality();\n result = new Binary(this.span(start), this.sourceSpan(start), '??', result, right);\n }\n return result;\n }\n parseEquality() {\n // '==','!=','===','!=='\n const start = this.inputIndex;\n let result = this.parseRelational();\n while (this.next.type == TokenType.Operator) {\n const operator = this.next.strValue;\n switch (operator) {\n case '==':\n case '===':\n case '!=':\n case '!==':\n this.advance();\n const right = this.parseRelational();\n result = new Binary(this.span(start), this.sourceSpan(start), operator, result, right);\n continue;\n }\n break;\n }\n return result;\n }\n parseRelational() {\n // '<', '>', '<=', '>='\n const start = this.inputIndex;\n let result = this.parseAdditive();\n while (this.next.type == TokenType.Operator) {\n const operator = this.next.strValue;\n switch (operator) {\n case '<':\n case '>':\n case '<=':\n case '>=':\n this.advance();\n const right = this.parseAdditive();\n result = new Binary(this.span(start), this.sourceSpan(start), operator, result, right);\n continue;\n }\n break;\n }\n return result;\n }\n parseAdditive() {\n // '+', '-'\n const start = this.inputIndex;\n let result = this.parseMultiplicative();\n while (this.next.type == TokenType.Operator) {\n const operator = this.next.strValue;\n switch (operator) {\n case '+':\n case '-':\n this.advance();\n let right = this.parseMultiplicative();\n result = new Binary(this.span(start), this.sourceSpan(start), operator, result, right);\n continue;\n }\n break;\n }\n return result;\n }\n parseMultiplicative() {\n // '*', '%', '/'\n const start = this.inputIndex;\n let result = this.parsePrefix();\n while (this.next.type == TokenType.Operator) {\n const operator = this.next.strValue;\n switch (operator) {\n case '*':\n case '%':\n case '/':\n this.advance();\n let right = this.parsePrefix();\n result = new Binary(this.span(start), this.sourceSpan(start), operator, result, right);\n continue;\n }\n break;\n }\n return result;\n }\n parsePrefix() {\n if (this.next.type == TokenType.Operator) {\n const start = this.inputIndex;\n const operator = this.next.strValue;\n let result;\n switch (operator) {\n case '+':\n this.advance();\n result = this.parsePrefix();\n return Unary.createPlus(this.span(start), this.sourceSpan(start), result);\n case '-':\n this.advance();\n result = this.parsePrefix();\n return Unary.createMinus(this.span(start), this.sourceSpan(start), result);\n case '!':\n this.advance();\n result = this.parsePrefix();\n return new PrefixNot(this.span(start), this.sourceSpan(start), result);\n }\n }\n return this.parseCallChain();\n }\n parseCallChain() {\n const start = this.inputIndex;\n let result = this.parsePrimary();\n while (true) {\n if (this.consumeOptionalCharacter($PERIOD)) {\n result = this.parseAccessMember(result, start, false);\n } else if (this.consumeOptionalOperator('?.')) {\n if (this.consumeOptionalCharacter($LPAREN)) {\n result = this.parseCall(result, start, true);\n } else {\n result = this.consumeOptionalCharacter($LBRACKET) ? this.parseKeyedReadOrWrite(result, start, true) : this.parseAccessMember(result, start, true);\n }\n } else if (this.consumeOptionalCharacter($LBRACKET)) {\n result = this.parseKeyedReadOrWrite(result, start, false);\n } else if (this.consumeOptionalCharacter($LPAREN)) {\n result = this.parseCall(result, start, false);\n } else if (this.consumeOptionalOperator('!')) {\n result = new NonNullAssert(this.span(start), this.sourceSpan(start), result);\n } else {\n return result;\n }\n }\n }\n parsePrimary() {\n const start = this.inputIndex;\n if (this.consumeOptionalCharacter($LPAREN)) {\n this.rparensExpected++;\n const result = this.parsePipe();\n this.rparensExpected--;\n this.expectCharacter($RPAREN);\n return result;\n } else if (this.next.isKeywordNull()) {\n this.advance();\n return new LiteralPrimitive(this.span(start), this.sourceSpan(start), null);\n } else if (this.next.isKeywordUndefined()) {\n this.advance();\n return new LiteralPrimitive(this.span(start), this.sourceSpan(start), void 0);\n } else if (this.next.isKeywordTrue()) {\n this.advance();\n return new LiteralPrimitive(this.span(start), this.sourceSpan(start), true);\n } else if (this.next.isKeywordFalse()) {\n this.advance();\n return new LiteralPrimitive(this.span(start), this.sourceSpan(start), false);\n } else if (this.next.isKeywordThis()) {\n this.advance();\n return new ThisReceiver(this.span(start), this.sourceSpan(start));\n } else if (this.consumeOptionalCharacter($LBRACKET)) {\n this.rbracketsExpected++;\n const elements = this.parseExpressionList($RBRACKET);\n this.rbracketsExpected--;\n this.expectCharacter($RBRACKET);\n return new LiteralArray(this.span(start), this.sourceSpan(start), elements);\n } else if (this.next.isCharacter($LBRACE)) {\n return this.parseLiteralMap();\n } else if (this.next.isIdentifier()) {\n return this.parseAccessMember(new ImplicitReceiver(this.span(start), this.sourceSpan(start)), start, false);\n } else if (this.next.isNumber()) {\n const value = this.next.toNumber();\n this.advance();\n return new LiteralPrimitive(this.span(start), this.sourceSpan(start), value);\n } else if (this.next.isString()) {\n const literalValue = this.next.toString();\n this.advance();\n return new LiteralPrimitive(this.span(start), this.sourceSpan(start), literalValue);\n } else if (this.next.isPrivateIdentifier()) {\n this._reportErrorForPrivateIdentifier(this.next, null);\n return new EmptyExpr$1(this.span(start), this.sourceSpan(start));\n } else if (this.index >= this.tokens.length) {\n this.error(`Unexpected end of expression: ${this.input}`);\n return new EmptyExpr$1(this.span(start), this.sourceSpan(start));\n } else {\n this.error(`Unexpected token ${this.next}`);\n return new EmptyExpr$1(this.span(start), this.sourceSpan(start));\n }\n }\n parseExpressionList(terminator) {\n const result = [];\n do {\n if (!this.next.isCharacter(terminator)) {\n result.push(this.parsePipe());\n } else {\n break;\n }\n } while (this.consumeOptionalCharacter($COMMA));\n return result;\n }\n parseLiteralMap() {\n const keys = [];\n const values = [];\n const start = this.inputIndex;\n this.expectCharacter($LBRACE);\n if (!this.consumeOptionalCharacter($RBRACE)) {\n this.rbracesExpected++;\n do {\n const keyStart = this.inputIndex;\n const quoted = this.next.isString();\n const key = this.expectIdentifierOrKeywordOrString();\n const literalMapKey = {\n key,\n quoted\n };\n keys.push(literalMapKey);\n // Properties with quoted keys can't use the shorthand syntax.\n if (quoted) {\n this.expectCharacter($COLON);\n values.push(this.parsePipe());\n } else if (this.consumeOptionalCharacter($COLON)) {\n values.push(this.parsePipe());\n } else {\n literalMapKey.isShorthandInitialized = true;\n const span = this.span(keyStart);\n const sourceSpan = this.sourceSpan(keyStart);\n values.push(new PropertyRead(span, sourceSpan, sourceSpan, new ImplicitReceiver(span, sourceSpan), key));\n }\n } while (this.consumeOptionalCharacter($COMMA) && !this.next.isCharacter($RBRACE));\n this.rbracesExpected--;\n this.expectCharacter($RBRACE);\n }\n return new LiteralMap(this.span(start), this.sourceSpan(start), keys, values);\n }\n parseAccessMember(readReceiver, start, isSafe) {\n const nameStart = this.inputIndex;\n const id = this.withContext(ParseContextFlags.Writable, () => {\n const id = this.expectIdentifierOrKeyword() ?? '';\n if (id.length === 0) {\n this.error(`Expected identifier for property access`, readReceiver.span.end);\n }\n return id;\n });\n const nameSpan = this.sourceSpan(nameStart);\n let receiver;\n if (isSafe) {\n if (this.consumeOptionalOperator('=')) {\n this.error(\"The '?.' operator cannot be used in the assignment\");\n receiver = new EmptyExpr$1(this.span(start), this.sourceSpan(start));\n } else {\n receiver = new SafePropertyRead(this.span(start), this.sourceSpan(start), nameSpan, readReceiver, id);\n }\n } else {\n if (this.consumeOptionalOperator('=')) {\n if (!(this.parseFlags & 1 /* ParseFlags.Action */)) {\n this.error('Bindings cannot contain assignments');\n return new EmptyExpr$1(this.span(start), this.sourceSpan(start));\n }\n const value = this.parseConditional();\n receiver = new PropertyWrite(this.span(start), this.sourceSpan(start), nameSpan, readReceiver, id, value);\n } else {\n receiver = new PropertyRead(this.span(start), this.sourceSpan(start), nameSpan, readReceiver, id);\n }\n }\n return receiver;\n }\n parseCall(receiver, start, isSafe) {\n const argumentStart = this.inputIndex;\n this.rparensExpected++;\n const args = this.parseCallArguments();\n const argumentSpan = this.span(argumentStart, this.inputIndex).toAbsolute(this.absoluteOffset);\n this.expectCharacter($RPAREN);\n this.rparensExpected--;\n const span = this.span(start);\n const sourceSpan = this.sourceSpan(start);\n return isSafe ? new SafeCall(span, sourceSpan, receiver, args, argumentSpan) : new Call(span, sourceSpan, receiver, args, argumentSpan);\n }\n parseCallArguments() {\n if (this.next.isCharacter($RPAREN)) return [];\n const positionals = [];\n do {\n positionals.push(this.parsePipe());\n } while (this.consumeOptionalCharacter($COMMA));\n return positionals;\n }\n /**\n * Parses an identifier, a keyword, a string with an optional `-` in between,\n * and returns the string along with its absolute source span.\n */\n expectTemplateBindingKey() {\n let result = '';\n let operatorFound = false;\n const start = this.currentAbsoluteOffset;\n do {\n result += this.expectIdentifierOrKeywordOrString();\n operatorFound = this.consumeOptionalOperator('-');\n if (operatorFound) {\n result += '-';\n }\n } while (operatorFound);\n return {\n source: result,\n span: new AbsoluteSourceSpan(start, start + result.length)\n };\n }\n /**\n * Parse microsyntax template expression and return a list of bindings or\n * parsing errors in case the given expression is invalid.\n *\n * For example,\n * ```\n *
\n * ```\n * contains five bindings:\n * 1. ngFor -> null\n * 2. item -> NgForOfContext.$implicit\n * 3. ngForOf -> items\n * 4. i -> NgForOfContext.index\n * 5. ngForTrackBy -> func\n *\n * For a full description of the microsyntax grammar, see\n * https://gist.github.com/mhevery/d3530294cff2e4a1b3fe15ff75d08855\n *\n * @param templateKey name of the microsyntax directive, like ngIf, ngFor,\n * without the *, along with its absolute span.\n */\n parseTemplateBindings(templateKey) {\n const bindings = [];\n // The first binding is for the template key itself\n // In *ngFor=\"let item of items\", key = \"ngFor\", value = null\n // In *ngIf=\"cond | pipe\", key = \"ngIf\", value = \"cond | pipe\"\n bindings.push(...this.parseDirectiveKeywordBindings(templateKey));\n while (this.index < this.tokens.length) {\n // If it starts with 'let', then this must be variable declaration\n const letBinding = this.parseLetBinding();\n if (letBinding) {\n bindings.push(letBinding);\n } else {\n // Two possible cases here, either `value \"as\" key` or\n // \"directive-keyword expression\". We don't know which case, but both\n // \"value\" and \"directive-keyword\" are template binding key, so consume\n // the key first.\n const key = this.expectTemplateBindingKey();\n // Peek at the next token, if it is \"as\" then this must be variable\n // declaration.\n const binding = this.parseAsBinding(key);\n if (binding) {\n bindings.push(binding);\n } else {\n // Otherwise the key must be a directive keyword, like \"of\". Transform\n // the key to actual key. Eg. of -> ngForOf, trackBy -> ngForTrackBy\n key.source = templateKey.source + key.source.charAt(0).toUpperCase() + key.source.substring(1);\n bindings.push(...this.parseDirectiveKeywordBindings(key));\n }\n }\n this.consumeStatementTerminator();\n }\n return new TemplateBindingParseResult(bindings, [] /* warnings */, this.errors);\n }\n parseKeyedReadOrWrite(receiver, start, isSafe) {\n return this.withContext(ParseContextFlags.Writable, () => {\n this.rbracketsExpected++;\n const key = this.parsePipe();\n if (key instanceof EmptyExpr$1) {\n this.error(`Key access cannot be empty`);\n }\n this.rbracketsExpected--;\n this.expectCharacter($RBRACKET);\n if (this.consumeOptionalOperator('=')) {\n if (isSafe) {\n this.error(\"The '?.' operator cannot be used in the assignment\");\n } else {\n const value = this.parseConditional();\n return new KeyedWrite(this.span(start), this.sourceSpan(start), receiver, key, value);\n }\n } else {\n return isSafe ? new SafeKeyedRead(this.span(start), this.sourceSpan(start), receiver, key) : new KeyedRead(this.span(start), this.sourceSpan(start), receiver, key);\n }\n return new EmptyExpr$1(this.span(start), this.sourceSpan(start));\n });\n }\n /**\n * Parse a directive keyword, followed by a mandatory expression.\n * For example, \"of items\", \"trackBy: func\".\n * The bindings are: ngForOf -> items, ngForTrackBy -> func\n * There could be an optional \"as\" binding that follows the expression.\n * For example,\n * ```\n * *ngFor=\"let item of items | slice:0:1 as collection\".\n * ^^ ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^\n * keyword bound target optional 'as' binding\n * ```\n *\n * @param key binding key, for example, ngFor, ngIf, ngForOf, along with its\n * absolute span.\n */\n parseDirectiveKeywordBindings(key) {\n const bindings = [];\n this.consumeOptionalCharacter($COLON); // trackBy: trackByFunction\n const value = this.getDirectiveBoundTarget();\n let spanEnd = this.currentAbsoluteOffset;\n // The binding could optionally be followed by \"as\". For example,\n // *ngIf=\"cond | pipe as x\". In this case, the key in the \"as\" binding\n // is \"x\" and the value is the template key itself (\"ngIf\"). Note that the\n // 'key' in the current context now becomes the \"value\" in the next binding.\n const asBinding = this.parseAsBinding(key);\n if (!asBinding) {\n this.consumeStatementTerminator();\n spanEnd = this.currentAbsoluteOffset;\n }\n const sourceSpan = new AbsoluteSourceSpan(key.span.start, spanEnd);\n bindings.push(new ExpressionBinding(sourceSpan, key, value));\n if (asBinding) {\n bindings.push(asBinding);\n }\n return bindings;\n }\n /**\n * Return the expression AST for the bound target of a directive keyword\n * binding. For example,\n * ```\n * *ngIf=\"condition | pipe\"\n * ^^^^^^^^^^^^^^^^ bound target for \"ngIf\"\n * *ngFor=\"let item of items\"\n * ^^^^^ bound target for \"ngForOf\"\n * ```\n */\n getDirectiveBoundTarget() {\n if (this.next === EOF || this.peekKeywordAs() || this.peekKeywordLet()) {\n return null;\n }\n const ast = this.parsePipe(); // example: \"condition | async\"\n const {\n start,\n end\n } = ast.span;\n const value = this.input.substring(start, end);\n return new ASTWithSource(ast, value, this.location, this.absoluteOffset + start, this.errors);\n }\n /**\n * Return the binding for a variable declared using `as`. Note that the order\n * of the key-value pair in this declaration is reversed. For example,\n * ```\n * *ngFor=\"let item of items; index as i\"\n * ^^^^^ ^\n * value key\n * ```\n *\n * @param value name of the value in the declaration, \"ngIf\" in the example\n * above, along with its absolute span.\n */\n parseAsBinding(value) {\n if (!this.peekKeywordAs()) {\n return null;\n }\n this.advance(); // consume the 'as' keyword\n const key = this.expectTemplateBindingKey();\n this.consumeStatementTerminator();\n const sourceSpan = new AbsoluteSourceSpan(value.span.start, this.currentAbsoluteOffset);\n return new VariableBinding(sourceSpan, key, value);\n }\n /**\n * Return the binding for a variable declared using `let`. For example,\n * ```\n * *ngFor=\"let item of items; let i=index;\"\n * ^^^^^^^^ ^^^^^^^^^^^\n * ```\n * In the first binding, `item` is bound to `NgForOfContext.$implicit`.\n * In the second binding, `i` is bound to `NgForOfContext.index`.\n */\n parseLetBinding() {\n if (!this.peekKeywordLet()) {\n return null;\n }\n const spanStart = this.currentAbsoluteOffset;\n this.advance(); // consume the 'let' keyword\n const key = this.expectTemplateBindingKey();\n let value = null;\n if (this.consumeOptionalOperator('=')) {\n value = this.expectTemplateBindingKey();\n }\n this.consumeStatementTerminator();\n const sourceSpan = new AbsoluteSourceSpan(spanStart, this.currentAbsoluteOffset);\n return new VariableBinding(sourceSpan, key, value);\n }\n /**\n * Consume the optional statement terminator: semicolon or comma.\n */\n consumeStatementTerminator() {\n this.consumeOptionalCharacter($SEMICOLON) || this.consumeOptionalCharacter($COMMA);\n }\n /**\n * Records an error and skips over the token stream until reaching a recoverable point. See\n * `this.skip` for more details on token skipping.\n */\n error(message, index = null) {\n this.errors.push(new ParserError(message, this.input, this.locationText(index), this.location));\n this.skip();\n }\n locationText(index = null) {\n if (index == null) index = this.index;\n return index < this.tokens.length ? `at column ${this.tokens[index].index + 1} in` : `at the end of the expression`;\n }\n /**\n * Records an error for an unexpected private identifier being discovered.\n * @param token Token representing a private identifier.\n * @param extraMessage Optional additional message being appended to the error.\n */\n _reportErrorForPrivateIdentifier(token, extraMessage) {\n let errorMessage = `Private identifiers are not supported. Unexpected private identifier: ${token}`;\n if (extraMessage !== null) {\n errorMessage += `, ${extraMessage}`;\n }\n this.error(errorMessage);\n }\n /**\n * Error recovery should skip tokens until it encounters a recovery point.\n *\n * The following are treated as unconditional recovery points:\n * - end of input\n * - ';' (parseChain() is always the root production, and it expects a ';')\n * - '|' (since pipes may be chained and each pipe expression may be treated independently)\n *\n * The following are conditional recovery points:\n * - ')', '}', ']' if one of calling productions is expecting one of these symbols\n * - This allows skip() to recover from errors such as '(a.) + 1' allowing more of the AST to\n * be retained (it doesn't skip any tokens as the ')' is retained because of the '(' begins\n * an '(' ')' production).\n * The recovery points of grouping symbols must be conditional as they must be skipped if\n * none of the calling productions are not expecting the closing token else we will never\n * make progress in the case of an extraneous group closing symbol (such as a stray ')').\n * That is, we skip a closing symbol if we are not in a grouping production.\n * - '=' in a `Writable` context\n * - In this context, we are able to recover after seeing the `=` operator, which\n * signals the presence of an independent rvalue expression following the `=` operator.\n *\n * If a production expects one of these token it increments the corresponding nesting count,\n * and then decrements it just prior to checking if the token is in the input.\n */\n skip() {\n let n = this.next;\n while (this.index < this.tokens.length && !n.isCharacter($SEMICOLON) && !n.isOperator('|') && (this.rparensExpected <= 0 || !n.isCharacter($RPAREN)) && (this.rbracesExpected <= 0 || !n.isCharacter($RBRACE)) && (this.rbracketsExpected <= 0 || !n.isCharacter($RBRACKET)) && (!(this.context & ParseContextFlags.Writable) || !n.isOperator('='))) {\n if (this.next.isError()) {\n this.errors.push(new ParserError(this.next.toString(), this.input, this.locationText(), this.location));\n }\n this.advance();\n n = this.next;\n }\n }\n}\nclass SimpleExpressionChecker extends RecursiveAstVisitor {\n constructor() {\n super(...arguments);\n this.errors = [];\n }\n visitPipe() {\n this.errors.push('pipes');\n }\n}\n/**\n * Computes the real offset in the original template for indexes in an interpolation.\n *\n * Because templates can have encoded HTML entities and the input passed to the parser at this stage\n * of the compiler is the _decoded_ value, we need to compute the real offset using the original\n * encoded values in the interpolated tokens. Note that this is only a special case handling for\n * `MlParserTokenType.ENCODED_ENTITY` token types. All other interpolated tokens are expected to\n * have parts which exactly match the input string for parsing the interpolation.\n *\n * @param interpolatedTokens The tokens for the interpolated value.\n *\n * @returns A map of index locations in the decoded template to indexes in the original template\n */\nfunction getIndexMapForOriginalTemplate(interpolatedTokens) {\n let offsetMap = new Map();\n let consumedInOriginalTemplate = 0;\n let consumedInInput = 0;\n let tokenIndex = 0;\n while (tokenIndex < interpolatedTokens.length) {\n const currentToken = interpolatedTokens[tokenIndex];\n if (currentToken.type === 9 /* MlParserTokenType.ENCODED_ENTITY */) {\n const [decoded, encoded] = currentToken.parts;\n consumedInOriginalTemplate += encoded.length;\n consumedInInput += decoded.length;\n } else {\n const lengthOfParts = currentToken.parts.reduce((sum, current) => sum + current.length, 0);\n consumedInInput += lengthOfParts;\n consumedInOriginalTemplate += lengthOfParts;\n }\n offsetMap.set(consumedInInput, consumedInOriginalTemplate);\n tokenIndex++;\n }\n return offsetMap;\n}\n\n// =================================================================================================\n// =================================================================================================\n// =========== S T O P - S T O P - S T O P - S T O P - S T O P - S T O P ===========\n// =================================================================================================\n// =================================================================================================\n//\n// DO NOT EDIT THIS LIST OF SECURITY SENSITIVE PROPERTIES WITHOUT A SECURITY REVIEW!\n// Reach out to mprobst for details.\n//\n// =================================================================================================\n/** Map from tagName|propertyName to SecurityContext. Properties applying to all tags use '*'. */\nlet _SECURITY_SCHEMA;\nfunction SECURITY_SCHEMA() {\n if (!_SECURITY_SCHEMA) {\n _SECURITY_SCHEMA = {};\n // Case is insignificant below, all element and attribute names are lower-cased for lookup.\n registerContext(SecurityContext.HTML, ['iframe|srcdoc', '*|innerHTML', '*|outerHTML']);\n registerContext(SecurityContext.STYLE, ['*|style']);\n // NB: no SCRIPT contexts here, they are never allowed due to the parser stripping them.\n registerContext(SecurityContext.URL, ['*|formAction', 'area|href', 'area|ping', 'audio|src', 'a|href', 'a|ping', 'blockquote|cite', 'body|background', 'del|cite', 'form|action', 'img|src', 'input|src', 'ins|cite', 'q|cite', 'source|src', 'track|src', 'video|poster', 'video|src']);\n registerContext(SecurityContext.RESOURCE_URL, ['applet|code', 'applet|codebase', 'base|href', 'embed|src', 'frame|src', 'head|profile', 'html|manifest', 'iframe|src', 'link|href', 'media|src', 'object|codebase', 'object|data', 'script|src']);\n }\n return _SECURITY_SCHEMA;\n}\nfunction registerContext(ctx, specs) {\n for (const spec of specs) _SECURITY_SCHEMA[spec.toLowerCase()] = ctx;\n}\n/**\n * The set of security-sensitive attributes of an `