{"ast":null,"code":"/**\n * @license Angular v16.2.12\n * (c) 2010-2022 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 = {}));\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 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 * Represents a big integer using a buffer of its individual digits, with the least significant\n * digit stored at the beginning of the array (little endian).\n *\n * For performance reasons, each instance is mutable. The addition operation can be done in-place\n * to reduce memory pressure of allocation for the digits array.\n */\nclass BigInteger {\n static zero() {\n return new BigInteger([0]);\n }\n static one() {\n return new BigInteger([1]);\n }\n /**\n * Creates a big integer using its individual digits in little endian storage.\n */\n constructor(digits) {\n this.digits = digits;\n }\n /**\n * Creates a clone of this instance.\n */\n clone() {\n return new BigInteger(this.digits.slice());\n }\n /**\n * Returns a new big integer with the sum of `this` and `other` as its value. This does not mutate\n * `this` but instead returns a new instance, unlike `addToSelf`.\n */\n add(other) {\n const result = this.clone();\n result.addToSelf(other);\n return result;\n }\n /**\n * Adds `other` to the instance itself, thereby mutating its value.\n */\n addToSelf(other) {\n const maxNrOfDigits = Math.max(this.digits.length, other.digits.length);\n let carry = 0;\n for (let i = 0; i < maxNrOfDigits; i++) {\n let digitSum = carry;\n if (i < this.digits.length) {\n digitSum += this.digits[i];\n }\n if (i < other.digits.length) {\n digitSum += other.digits[i];\n }\n if (digitSum >= 10) {\n this.digits[i] = digitSum - 10;\n carry = 1;\n } else {\n this.digits[i] = digitSum;\n carry = 0;\n }\n }\n // Apply a remaining carry if needed.\n if (carry > 0) {\n this.digits[maxNrOfDigits] = 1;\n }\n }\n /**\n * Builds the decimal string representation of the big integer. As this is stored in\n * little endian, the digits are concatenated in reverse order.\n */\n toString() {\n let res = '';\n for (let i = this.digits.length - 1; i >= 0; i--) {\n res += this.digits[i];\n }\n return res;\n }\n}\n/**\n * Represents a big integer which is optimized for multiplication operations, as its power-of-twos\n * are memoized. See `multiplyBy()` for details on the multiplication algorithm.\n */\nclass BigIntForMultiplication {\n constructor(value) {\n this.powerOfTwos = [value];\n }\n /**\n * Returns the big integer itself.\n */\n getValue() {\n return this.powerOfTwos[0];\n }\n /**\n * Computes the value for `num * b`, where `num` is a JS number and `b` is a big integer. The\n * value for `b` is represented by a storage model that is optimized for this computation.\n *\n * This operation is implemented in N(log2(num)) by continuous halving of the number, where the\n * least-significant bit (LSB) is tested in each iteration. If the bit is set, the bit's index is\n * used as exponent into the power-of-two multiplication of `b`.\n *\n * As an example, consider the multiplication num=42, b=1337. In binary 42 is 0b00101010 and the\n * algorithm unrolls into the following iterations:\n *\n * Iteration | num | LSB | b * 2^iter | Add? | product\n * -----------|------------|------|------------|------|--------\n * 0 | 0b00101010 | 0 | 1337 | No | 0\n * 1 | 0b00010101 | 1 | 2674 | Yes | 2674\n * 2 | 0b00001010 | 0 | 5348 | No | 2674\n * 3 | 0b00000101 | 1 | 10696 | Yes | 13370\n * 4 | 0b00000010 | 0 | 21392 | No | 13370\n * 5 | 0b00000001 | 1 | 42784 | Yes | 56154\n * 6 | 0b00000000 | 0 | 85568 | No | 56154\n *\n * The computed product of 56154 is indeed the correct result.\n *\n * The `BigIntForMultiplication` representation for a big integer provides memoized access to the\n * power-of-two values to reduce the workload in computing those values.\n */\n multiplyBy(num) {\n const product = BigInteger.zero();\n this.multiplyByAndAddTo(num, product);\n return product;\n }\n /**\n * See `multiplyBy()` for details. This function allows for the computed product to be added\n * directly to the provided result big integer.\n */\n multiplyByAndAddTo(num, result) {\n for (let exponent = 0; num !== 0; num = num >>> 1, exponent++) {\n if (num & 1) {\n const value = this.getMultipliedByPowerOfTwo(exponent);\n result.addToSelf(value);\n }\n }\n }\n /**\n * Computes and memoizes the big integer value for `this.number * 2^exponent`.\n */\n getMultipliedByPowerOfTwo(exponent) {\n // Compute the powers up until the requested exponent, where each value is computed from its\n // predecessor. This is simple as `this.number * 2^(exponent - 1)` only has to be doubled (i.e.\n // added to itself) to reach `this.number * 2^exponent`.\n for (let i = this.powerOfTwos.length; i <= exponent; i++) {\n const previousPower = this.powerOfTwos[i - 1];\n this.powerOfTwos[i] = previousPower.add(previousPower);\n }\n return this.powerOfTwos[exponent];\n }\n}\n/**\n * Represents an exponentiation operation for the provided base, of which exponents are computed and\n * memoized. The results are represented by a `BigIntForMultiplication` which is tailored for\n * multiplication operations by memoizing the power-of-twos. This effectively results in a matrix\n * representation that is lazily computed upon request.\n */\nclass BigIntExponentiation {\n constructor(base) {\n this.base = base;\n this.exponents = [new BigIntForMultiplication(BigInteger.one())];\n }\n /**\n * Compute the value for `this.base^exponent`, resulting in a big integer that is optimized for\n * further multiplication operations.\n */\n toThePowerOf(exponent) {\n // Compute the results up until the requested exponent, where every value is computed from its\n // predecessor. This is because `this.base^(exponent - 1)` only has to be multiplied by `base`\n // to reach `this.base^exponent`.\n for (let i = this.exponents.length; i <= exponent; i++) {\n const value = this.exponents[i - 1].multiplyBy(this.base);\n this.exponents[i] = new BigIntForMultiplication(value);\n }\n return this.exponents[exponent];\n }\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) {\n return message.id || computeDecimalDigest(message);\n}\n/**\n * Compute the message id using the XLIFF2/XMB/$localize digest.\n */\nfunction computeDecimalDigest(message) {\n const visitor = new _SerializerIgnoreIcuExpVisitor();\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}\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 ICU expressions so that message IDs stays identical if only the expression changes.\n *\n * @internal\n */\nclass _SerializerIgnoreIcuExpVisitor extends _SerializerVisitor {\n visitIcu(icu, context) {\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 [hi, lo];\n}\nfunction computeMsgId(msg, meaning = '') {\n let msgFingerprint = fingerprint(msg);\n if (meaning) {\n const meaningFingerprint = fingerprint(meaning);\n msgFingerprint = add64(rol64(msgFingerprint, 1), meaningFingerprint);\n }\n const hi = msgFingerprint[0];\n const lo = msgFingerprint[1];\n return wordsToDecimalString(hi & 0x7fffffff, lo);\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}\n// clang-format off\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// clang-format on\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}\nfunction add64(a, b) {\n const ah = a[0],\n al = a[1];\n const bh = b[0],\n bl = b[1];\n const result = add32to64(al, bl);\n const carry = result[0];\n const l = result[1];\n const h = add32(add32(ah, bh), carry);\n return [h, l];\n}\n// Rotate a 32b number left `count` position\nfunction rol32(a, count) {\n return a << count | a >>> 32 - count;\n}\n// Rotate a 64b number left `count` position\nfunction rol64(num, count) {\n const hi = num[0],\n lo = num[1];\n const h = hi << count | lo >>> 32 - count;\n const l = lo << count | hi >>> 32 - count;\n return [h, l];\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 * Create a shared exponentiation pool for base-256 computations. This shared pool provides memoized\n * power-of-256 results with memoized power-of-two computations for efficient multiplication.\n *\n * For our purposes, this can be safely stored as a global without memory concerns. The reason is\n * that we encode two words, so only need the 0th (for the low word) and 4th (for the high word)\n * exponent.\n */\nconst base256 = new BigIntExponentiation(256);\n/**\n * Represents two 32-bit words as a single decimal number. This requires a big integer storage\n * model as JS numbers are not accurate enough to represent the 64-bit number.\n *\n * Based on https://www.danvk.org/hex2dec.html\n */\nfunction wordsToDecimalString(hi, lo) {\n // Encode the four bytes in lo in the lower digits of the decimal number.\n // Note: the multiplication results in lo itself but represented by a big integer using its\n // decimal digits.\n const decimal = base256.toThePowerOf(0).multiplyBy(lo);\n // Encode the four bytes in hi above the four lo bytes. lo is a maximum of (2^8)^4, which is why\n // this multiplication factor is applied.\n base256.toThePowerOf(4).multiplyByAndAddTo(hi, decimal);\n return decimal.toString();\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[\"BitwiseAnd\"] = 11] = \"BitwiseAnd\";\n BinaryOperator[BinaryOperator[\"Lower\"] = 12] = \"Lower\";\n BinaryOperator[BinaryOperator[\"LowerEquals\"] = 13] = \"LowerEquals\";\n BinaryOperator[BinaryOperator[\"Bigger\"] = 14] = \"Bigger\";\n BinaryOperator[BinaryOperator[\"BiggerEquals\"] = 15] = \"BiggerEquals\";\n BinaryOperator[BinaryOperator[\"NullishCoalesce\"] = 16] = \"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 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 && 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 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 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 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 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 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 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 _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 = fn(parameters, [new ReturnStatement(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.\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(prefix) {\n return `${prefix}${this.nextNameIndex++}`;\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.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.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.setClassMetadata = {\n name: 'ɵsetClassMetadata',\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 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}\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 expr.fn.visitExpression(this, ctx);\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.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 ? fn([], [new ReturnStatement(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([fn([], [new ReturnStatement(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('t');\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('r');\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', 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 = fn([], [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}\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 === 0 /* ParsedEventType.Regular */ ? event.targetOrPhase : null;\n const phase = event.type === 1 /* 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(sourceSpan) {\n this.sourceSpan = sourceSpan;\n }\n visit(visitor) {\n return visitor.visitDeferredTrigger(this);\n }\n}\nclass BoundDeferredTrigger extends DeferredTrigger {\n constructor(value, sourceSpan) {\n super(sourceSpan);\n this.value = value;\n }\n}\nclass IdleDeferredTrigger extends DeferredTrigger {}\nclass ImmediateDeferredTrigger extends DeferredTrigger {}\nclass HoverDeferredTrigger extends DeferredTrigger {}\nclass TimerDeferredTrigger extends DeferredTrigger {\n constructor(delay, sourceSpan) {\n super(sourceSpan);\n this.delay = delay;\n }\n}\nclass InteractionDeferredTrigger extends DeferredTrigger {\n constructor(reference, sourceSpan) {\n super(sourceSpan);\n this.reference = reference;\n }\n}\nclass ViewportDeferredTrigger extends DeferredTrigger {\n constructor(reference, sourceSpan) {\n super(sourceSpan);\n this.reference = reference;\n }\n}\nclass DeferredBlockPlaceholder {\n constructor(children, minimumTime, sourceSpan, startSourceSpan, endSourceSpan) {\n this.children = children;\n this.minimumTime = minimumTime;\n this.sourceSpan = sourceSpan;\n this.startSourceSpan = startSourceSpan;\n this.endSourceSpan = endSourceSpan;\n }\n visit(visitor) {\n return visitor.visitDeferredBlockPlaceholder(this);\n }\n}\nclass DeferredBlockLoading {\n constructor(children, afterTime, minimumTime, sourceSpan, startSourceSpan, endSourceSpan) {\n this.children = children;\n this.afterTime = afterTime;\n this.minimumTime = minimumTime;\n this.sourceSpan = sourceSpan;\n this.startSourceSpan = startSourceSpan;\n this.endSourceSpan = endSourceSpan;\n }\n visit(visitor) {\n return visitor.visitDeferredBlockLoading(this);\n }\n}\nclass DeferredBlockError {\n constructor(children, sourceSpan, startSourceSpan, endSourceSpan) {\n this.children = children;\n this.sourceSpan = sourceSpan;\n this.startSourceSpan = startSourceSpan;\n this.endSourceSpan = endSourceSpan;\n }\n visit(visitor) {\n return visitor.visitDeferredBlockError(this);\n }\n}\nclass DeferredBlock {\n constructor(children, triggers, prefetchTriggers, placeholder, loading, error, sourceSpan, startSourceSpan, endSourceSpan) {\n this.children = children;\n this.triggers = triggers;\n this.prefetchTriggers = prefetchTriggers;\n this.placeholder = placeholder;\n this.loading = loading;\n this.error = error;\n this.sourceSpan = sourceSpan;\n this.startSourceSpan = startSourceSpan;\n this.endSourceSpan = endSourceSpan;\n }\n visit(visitor) {\n return visitor.visitDeferredBlock(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, sourceSpan, i18n) {\n this.selector = selector;\n this.attributes = attributes;\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 visitAll$1(this, deferred.triggers);\n visitAll$1(this, deferred.prefetchTriggers);\n visitAll$1(this, deferred.children);\n deferred.placeholder?.visit(this);\n deferred.loading?.visit(this);\n deferred.error?.visit(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 visitContent(content) {}\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}\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}\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}\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}\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}\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 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}\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 write(messages, locale) {\n const exampleVisitor = new ExampleVisitor();\n const visitor = new _Visitor$1();\n let rootNode = new Tag(_MESSAGES_TAG);\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);\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 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) {\n return decimalDigest(message);\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/* Closure variables holding messages must be named `MSG_[A-Z0-9]+` */\nconst CLOSURE_TRANSLATION_VAR_PREFIX = 'MSG_';\n/**\n * Prefix for non-`goog.getMsg` i18n-related vars.\n * Note: the prefix uses lowercase characters intentionally due to a Closure behavior that\n * considers variables like `I18N_0` as constants and throws an error when their value changes.\n */\nconst TRANSLATION_VAR_PREFIX = 'i18n_';\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_';\n/** Prefix of ICU expressions for post processing */\nconst I18N_ICU_MAPPING_PREFIX = 'I18N_EXP_';\n/** Placeholder wrapper for i18n expressions **/\nconst I18N_PLACEHOLDER_SYMBOL = '�';\nfunction isI18nAttribute(name) {\n return name === I18N_ATTR || name.startsWith(I18N_ATTR_PREFIX);\n}\nfunction isI18nRootNode(meta) {\n return meta instanceof Message;\n}\nfunction isSingleI18nIcu(meta) {\n return isI18nRootNode(meta) && meta.nodes.length === 1 && meta.nodes[0] instanceof Icu;\n}\nfunction hasI18nMeta(node) {\n return !!node.i18n;\n}\nfunction hasI18nAttrs(element) {\n return element.attrs.some(attr => isI18nAttribute(attr.name));\n}\nfunction icuFromI18nMessage(message) {\n return message.nodes[0];\n}\nfunction wrapI18nPlaceholder(content, contextId = 0) {\n const blockId = contextId > 0 ? `:${contextId}` : '';\n return `${I18N_PLACEHOLDER_SYMBOL}${content}${blockId}${I18N_PLACEHOLDER_SYMBOL}`;\n}\nfunction assembleI18nBoundString(strings, bindingStartIndex = 0, contextId = 0) {\n if (!strings.length) return '';\n let acc = '';\n const lastIdx = strings.length - 1;\n for (let i = 0; i < lastIdx; i++) {\n acc += `${strings[i]}${wrapI18nPlaceholder(bindingStartIndex + i, contextId)}`;\n }\n acc += strings[lastIdx];\n return acc;\n}\nfunction getSeqNumberGenerator(startsAt = 0) {\n let current = startsAt;\n return () => current++;\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}\nfunction updatePlaceholderMap(map, name, ...values) {\n const current = map.get(name) || [];\n current.push(...values);\n map.set(name, current);\n}\nfunction assembleBoundTextPlaceholders(meta, bindingStartIndex = 0, contextId = 0) {\n const startIdx = bindingStartIndex;\n const placeholders = new Map();\n const node = meta instanceof Message ? meta.nodes.find(node => node instanceof Container) : meta;\n if (node) {\n node.children.filter(child => child instanceof Placeholder).forEach((child, idx) => {\n const content = wrapI18nPlaceholder(startIdx + idx, contextId);\n updatePlaceholderMap(placeholders, child.name, content);\n });\n }\n return placeholders;\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 * Generates a prefix for translation const name.\n *\n * @param extra Additional local prefix that should be injected into translation var name\n * @returns Complete translation const prefix\n */\nfunction getTranslationConstPrefix(extra) {\n return `${CLOSURE_TRANSLATION_VAR_PREFIX}${extra}`.toUpperCase();\n}\n/**\n * Generate AST to declare a variable. E.g. `var I18N_1;`.\n * @param variable the name of the variable to declare.\n */\nfunction declareI18nVariable(variable) {\n return new DeclareVarStmt(variable.name, undefined, INFERRED_TYPE, undefined, variable.sourceSpan);\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 * bot work in some cases when object keys are mangled by 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/** The prefix reference variables */\nconst REFERENCE_PREFIX = '_r';\n/** The name of the implicit context reference */\nconst IMPLICIT_REFERENCE = '$implicit';\n/** Non bindable attribute name **/\nconst NON_BINDABLE_ATTR = 'ngNonBindable';\n/** Name for the variable keeping track of the context returned by `ɵɵrestoreView`. */\nconst RESTORED_VIEW_CONTEXT_NAME = 'restoredCtx';\n/**\n * Maximum length of a single instruction chain. Because our output AST uses recursion, we're\n * limited in how many expressions we can nest before we reach the call stack limit. This\n * length is set very conservatively in order to reduce the chance of problems.\n */\nconst MAX_CHAIN_LENGTH = 500;\n/** Instructions that support chaining. */\nconst CHAINABLE_INSTRUCTIONS = new Set([Identifiers.element, Identifiers.elementStart, Identifiers.elementEnd, Identifiers.elementContainer, Identifiers.elementContainerStart, Identifiers.elementContainerEnd, Identifiers.i18nExp, Identifiers.listener, Identifiers.classProp, Identifiers.syntheticHostListener, Identifiers.hostProperty, Identifiers.syntheticHostProperty, Identifiers.property, Identifiers.propertyInterpolate1, Identifiers.propertyInterpolate2, Identifiers.propertyInterpolate3, Identifiers.propertyInterpolate4, Identifiers.propertyInterpolate5, Identifiers.propertyInterpolate6, Identifiers.propertyInterpolate7, Identifiers.propertyInterpolate8, Identifiers.propertyInterpolateV, Identifiers.attribute, Identifiers.attributeInterpolate1, Identifiers.attributeInterpolate2, Identifiers.attributeInterpolate3, Identifiers.attributeInterpolate4, Identifiers.attributeInterpolate5, Identifiers.attributeInterpolate6, Identifiers.attributeInterpolate7, Identifiers.attributeInterpolate8, Identifiers.attributeInterpolateV, Identifiers.styleProp, Identifiers.stylePropInterpolate1, Identifiers.stylePropInterpolate2, Identifiers.stylePropInterpolate3, Identifiers.stylePropInterpolate4, Identifiers.stylePropInterpolate5, Identifiers.stylePropInterpolate6, Identifiers.stylePropInterpolate7, Identifiers.stylePropInterpolate8, Identifiers.stylePropInterpolateV, Identifiers.textInterpolate, Identifiers.textInterpolate1, Identifiers.textInterpolate2, Identifiers.textInterpolate3, Identifiers.textInterpolate4, Identifiers.textInterpolate5, Identifiers.textInterpolate6, Identifiers.textInterpolate7, Identifiers.textInterpolate8, Identifiers.textInterpolateV]);\n/** Generates a call to a single instruction. */\nfunction invokeInstruction(span, reference, params) {\n return importExpr(reference, null, span).callFn(params, span);\n}\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(statements, name) {\n let temp = null;\n return () => {\n if (!temp) {\n statements.push(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}\nfunction conditionallyCreateDirectiveBindingLiteral(map, keepDeclared) {\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 if (keepDeclared && (publicName !== declaredName || value.transformFunction != null)) {\n const expressionKeys = [asLiteral(publicName), asLiteral(declaredName)];\n if (value.transformFunction != null) {\n expressionKeys.push(value.transformFunction);\n }\n expressionValue = literalArr(expressionKeys);\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 * Remove trailing null nodes as they are implied.\n */\nfunction trimTrailingNulls(parameters) {\n while (isNull(parameters[parameters.length - 1])) {\n parameters.pop();\n }\n return parameters;\n}\nfunction getQueryPredicate(query, constantPool) {\n if (Array.isArray(query.predicate)) {\n let predicate = [];\n query.predicate.forEach(selector => {\n // Each item in predicates array may contain strings with comma-separated refs\n // (for ex. 'ref, ref1, ..., refN'), thus we extract individual refs and store them\n // as separate array entities\n const selectors = selector.split(',').map(token => literal(token.trim()));\n predicate.push(...selectors);\n });\n return constantPool.getConstLiteral(literalArr(predicate), true);\n } else {\n // The original predicate may have been wrapped in a `forwardRef()` call.\n switch (query.predicate.forwardRef) {\n case 0 /* ForwardRefHandling.None */:\n case 2 /* ForwardRefHandling.Unwrapped */:\n return query.predicate.expression;\n case 1 /* ForwardRefHandling.Wrapped */:\n return importExpr(Identifiers.resolveForwardRef).callFn([query.predicate.expression]);\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 this.values.push({\n key: key,\n value,\n quoted: false\n });\n }\n }\n toLiteralMap() {\n return literalMap(this.values);\n }\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 === 0 /* BindingType.Property */) {\n attributesMap[i.name] = '';\n }\n });\n elOrTpl.outputs.forEach(o => {\n attributesMap[o.name] = '';\n });\n }\n return attributesMap;\n}\n/**\n * Gets the number of arguments expected to be passed to a generated instruction in the case of\n * interpolation instructions.\n * @param interpolation An interpolation ast\n */\nfunction getInterpolationArgsLength(interpolation) {\n const {\n expressions,\n strings\n } = interpolation;\n if (expressions.length === 1 && strings.length === 2 && strings[0] === '' && strings[1] === '') {\n // If the interpolation has one interpolated value, but the prefix and suffix are both empty\n // strings, we only pass one argument, to a special instruction like `propertyInterpolate` or\n // `textInterpolate`.\n return 1;\n } else {\n return expressions.length + strings.length;\n }\n}\n/**\n * Generates the final instruction call statements based on the passed in configuration.\n * Will try to chain instructions as much as possible, if chaining is supported.\n */\nfunction getInstructionStatements(instructions) {\n const statements = [];\n let pendingExpression = null;\n let pendingExpressionType = null;\n let chainLength = 0;\n for (const current of instructions) {\n const resolvedParams = (typeof current.paramsOrFn === 'function' ? current.paramsOrFn() : current.paramsOrFn) ?? [];\n const params = Array.isArray(resolvedParams) ? resolvedParams : [resolvedParams];\n // If the current instruction is the same as the previous one\n // and it can be chained, add another call to the chain.\n if (chainLength < MAX_CHAIN_LENGTH && pendingExpressionType === current.reference && CHAINABLE_INSTRUCTIONS.has(pendingExpressionType)) {\n // We'll always have a pending expression when there's a pending expression type.\n pendingExpression = pendingExpression.callFn(params, pendingExpression.sourceSpan);\n chainLength++;\n } else {\n if (pendingExpression !== null) {\n statements.push(pendingExpression.toStmt());\n }\n pendingExpression = invokeInstruction(current.span, current.reference, params);\n pendingExpressionType = current.reference;\n chainLength = 0;\n }\n }\n // Since the current instruction adds the previous one to the statements,\n // we may be left with the final one at the end that is still pending.\n if (pendingExpression !== null) {\n statements.push(pendingExpression.toStmt());\n }\n return statements;\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: fn([], [new ReturnStatement(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 return fn([new FnParam('t', DYNAMIC_TYPE)], [new ReturnStatement(type.prop('ɵfac').callFn([variable('t')]))]);\n}\nconst UNUSABLE_INTERPOLATION_REGEXPS = [/^\\s*$/, /[<>]/, /^[{}]$/, /&(#|[a-z])/i, /^\\/\\// // 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 $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 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 policy = null;\n if (_global.trustedTypes) {\n try {\n policy = _global.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\n if (meta.kind === R3NgModuleMetadataKind.Global) {\n if (meta.bootstrap.length > 0) {\n definitionMap.set('bootstrap', refsToArray(meta.bootstrap, meta.containsForwardDecls));\n }\n } else {\n if (meta.bootstrapExpression) {\n definitionMap.set('bootstrap', meta.bootstrapExpression);\n }\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 (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 = {}));\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 = {}));\nclass ParsedEvent {\n // Regular events have a target\n // Animation events have a phase\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}\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}\nclass EventHandlerVars {\n static {\n this.event = variable('$event');\n }\n}\n/**\n * Converts the given expression AST into an executable output AST, assuming the expression is\n * used in an action binding (e.g. an event handler).\n */\nfunction convertActionBinding(localResolver, implicitReceiver, action, bindingId, baseSourceSpan, implicitReceiverAccesses, globals) {\n if (!localResolver) {\n localResolver = new DefaultLocalResolver(globals);\n }\n const actionWithoutBuiltins = convertPropertyBindingBuiltins({\n createLiteralArrayConverter: argCount => {\n // Note: no caching for literal arrays in actions.\n return args => literalArr(args);\n },\n createLiteralMapConverter: keys => {\n // Note: no caching for literal maps in actions.\n return values => {\n const entries = keys.map((k, i) => ({\n key: k.key,\n value: values[i],\n quoted: k.quoted\n }));\n return literalMap(entries);\n };\n },\n createPipeConverter: name => {\n throw new Error(`Illegal State: Actions are not allowed to contain pipes. Pipe: ${name}`);\n }\n }, action);\n const visitor = new _AstToIrVisitor(localResolver, implicitReceiver, bindingId, /* supportsInterpolation */false, baseSourceSpan, implicitReceiverAccesses);\n const actionStmts = [];\n flattenStatements(actionWithoutBuiltins.visit(visitor, _Mode.Statement), actionStmts);\n prependTemporaryDecls(visitor.temporaryCount, bindingId, actionStmts);\n if (visitor.usesImplicitReceiver) {\n localResolver.notifyImplicitReceiverUse();\n }\n const lastIndex = actionStmts.length - 1;\n if (lastIndex >= 0) {\n const lastStatement = actionStmts[lastIndex];\n // Ensure that the value of the last expression statement is returned\n if (lastStatement instanceof ExpressionStatement) {\n actionStmts[lastIndex] = new ReturnStatement(lastStatement.expr);\n }\n }\n return actionStmts;\n}\nfunction convertPropertyBindingBuiltins(converterFactory, ast) {\n return convertBuiltins(converterFactory, ast);\n}\nclass ConvertPropertyBindingResult {\n constructor(stmts, currValExpr) {\n this.stmts = stmts;\n this.currValExpr = currValExpr;\n }\n}\n/**\n * Converts the given expression AST into an executable output AST, assuming the expression\n * is used in property binding. The expression has to be preprocessed via\n * `convertPropertyBindingBuiltins`.\n */\nfunction convertPropertyBinding(localResolver, implicitReceiver, expressionWithoutBuiltins, bindingId) {\n if (!localResolver) {\n localResolver = new DefaultLocalResolver();\n }\n const visitor = new _AstToIrVisitor(localResolver, implicitReceiver, bindingId, /* supportsInterpolation */false);\n const outputExpr = expressionWithoutBuiltins.visit(visitor, _Mode.Expression);\n const stmts = getStatementsFromVisitor(visitor, bindingId);\n if (visitor.usesImplicitReceiver) {\n localResolver.notifyImplicitReceiverUse();\n }\n return new ConvertPropertyBindingResult(stmts, outputExpr);\n}\n/**\n * Given some expression, such as a binding or interpolation expression, and a context expression to\n * look values up on, visit each facet of the given expression resolving values from the context\n * expression such that a list of arguments can be derived from the found values that can be used as\n * arguments to an external update instruction.\n *\n * @param localResolver The resolver to use to look up expressions by name appropriately\n * @param contextVariableExpression The expression representing the context variable used to create\n * the final argument expressions\n * @param expressionWithArgumentsToExtract The expression to visit to figure out what values need to\n * be resolved and what arguments list to build.\n * @param bindingId A name prefix used to create temporary variable names if they're needed for the\n * arguments generated\n * @returns An array of expressions that can be passed as arguments to instruction expressions like\n * `o.importExpr(R3.propertyInterpolate).callFn(result)`\n */\nfunction convertUpdateArguments(localResolver, contextVariableExpression, expressionWithArgumentsToExtract, bindingId) {\n const visitor = new _AstToIrVisitor(localResolver, contextVariableExpression, bindingId, /* supportsInterpolation */true);\n const outputExpr = visitor.visitInterpolation(expressionWithArgumentsToExtract, _Mode.Expression);\n if (visitor.usesImplicitReceiver) {\n localResolver.notifyImplicitReceiverUse();\n }\n const stmts = getStatementsFromVisitor(visitor, bindingId);\n const args = outputExpr.args;\n return {\n stmts,\n args\n };\n}\nfunction getStatementsFromVisitor(visitor, bindingId) {\n const stmts = [];\n for (let i = 0; i < visitor.temporaryCount; i++) {\n stmts.push(temporaryDeclaration(bindingId, i));\n }\n return stmts;\n}\nfunction convertBuiltins(converterFactory, ast) {\n const visitor = new _BuiltinAstConverter(converterFactory);\n return ast.visit(visitor);\n}\nfunction temporaryName(bindingId, temporaryNumber) {\n return `tmp_${bindingId}_${temporaryNumber}`;\n}\nfunction temporaryDeclaration(bindingId, temporaryNumber) {\n return new DeclareVarStmt(temporaryName(bindingId, temporaryNumber));\n}\nfunction prependTemporaryDecls(temporaryCount, bindingId, statements) {\n for (let i = temporaryCount - 1; i >= 0; i--) {\n statements.unshift(temporaryDeclaration(bindingId, i));\n }\n}\nvar _Mode;\n(function (_Mode) {\n _Mode[_Mode[\"Statement\"] = 0] = \"Statement\";\n _Mode[_Mode[\"Expression\"] = 1] = \"Expression\";\n})(_Mode || (_Mode = {}));\nfunction ensureStatementMode(mode, ast) {\n if (mode !== _Mode.Statement) {\n throw new Error(`Expected a statement, but saw ${ast}`);\n }\n}\nfunction ensureExpressionMode(mode, ast) {\n if (mode !== _Mode.Expression) {\n throw new Error(`Expected an expression, but saw ${ast}`);\n }\n}\nfunction convertToStatementIfNeeded(mode, expr) {\n if (mode === _Mode.Statement) {\n return expr.toStmt();\n } else {\n return expr;\n }\n}\nclass _BuiltinAstConverter extends AstTransformer {\n constructor(_converterFactory) {\n super();\n this._converterFactory = _converterFactory;\n }\n visitPipe(ast, context) {\n const args = [ast.exp, ...ast.args].map(ast => ast.visit(this, context));\n return new BuiltinFunctionCall(ast.span, ast.sourceSpan, args, this._converterFactory.createPipeConverter(ast.name, args.length));\n }\n visitLiteralArray(ast, context) {\n const args = ast.expressions.map(ast => ast.visit(this, context));\n return new BuiltinFunctionCall(ast.span, ast.sourceSpan, args, this._converterFactory.createLiteralArrayConverter(ast.expressions.length));\n }\n visitLiteralMap(ast, context) {\n const args = ast.values.map(ast => ast.visit(this, context));\n return new BuiltinFunctionCall(ast.span, ast.sourceSpan, args, this._converterFactory.createLiteralMapConverter(ast.keys));\n }\n}\nclass _AstToIrVisitor {\n constructor(_localResolver, _implicitReceiver, bindingId, supportsInterpolation, baseSourceSpan, implicitReceiverAccesses) {\n this._localResolver = _localResolver;\n this._implicitReceiver = _implicitReceiver;\n this.bindingId = bindingId;\n this.supportsInterpolation = supportsInterpolation;\n this.baseSourceSpan = baseSourceSpan;\n this.implicitReceiverAccesses = implicitReceiverAccesses;\n this._nodeMap = new Map();\n this._resultMap = new Map();\n this._currentTemporary = 0;\n this.temporaryCount = 0;\n this.usesImplicitReceiver = false;\n }\n visitUnary(ast, mode) {\n let op;\n switch (ast.operator) {\n case '+':\n op = UnaryOperator.Plus;\n break;\n case '-':\n op = UnaryOperator.Minus;\n break;\n default:\n throw new Error(`Unsupported operator ${ast.operator}`);\n }\n return convertToStatementIfNeeded(mode, new UnaryOperatorExpr(op, this._visit(ast.expr, _Mode.Expression), undefined, this.convertSourceSpan(ast.span)));\n }\n visitBinary(ast, mode) {\n let op;\n switch (ast.operation) {\n case '+':\n op = BinaryOperator.Plus;\n break;\n case '-':\n op = BinaryOperator.Minus;\n break;\n case '*':\n op = BinaryOperator.Multiply;\n break;\n case '/':\n op = BinaryOperator.Divide;\n break;\n case '%':\n op = BinaryOperator.Modulo;\n break;\n case '&&':\n op = BinaryOperator.And;\n break;\n case '||':\n op = BinaryOperator.Or;\n break;\n case '==':\n op = BinaryOperator.Equals;\n break;\n case '!=':\n op = BinaryOperator.NotEquals;\n break;\n case '===':\n op = BinaryOperator.Identical;\n break;\n case '!==':\n op = BinaryOperator.NotIdentical;\n break;\n case '<':\n op = BinaryOperator.Lower;\n break;\n case '>':\n op = BinaryOperator.Bigger;\n break;\n case '<=':\n op = BinaryOperator.LowerEquals;\n break;\n case '>=':\n op = BinaryOperator.BiggerEquals;\n break;\n case '??':\n return this.convertNullishCoalesce(ast, mode);\n default:\n throw new Error(`Unsupported operation ${ast.operation}`);\n }\n return convertToStatementIfNeeded(mode, new BinaryOperatorExpr(op, this._visit(ast.left, _Mode.Expression), this._visit(ast.right, _Mode.Expression), undefined, this.convertSourceSpan(ast.span)));\n }\n visitChain(ast, mode) {\n ensureStatementMode(mode, ast);\n return this.visitAll(ast.expressions, mode);\n }\n visitConditional(ast, mode) {\n const value = this._visit(ast.condition, _Mode.Expression);\n return convertToStatementIfNeeded(mode, value.conditional(this._visit(ast.trueExp, _Mode.Expression), this._visit(ast.falseExp, _Mode.Expression), this.convertSourceSpan(ast.span)));\n }\n visitPipe(ast, mode) {\n throw new Error(`Illegal state: Pipes should have been converted into functions. Pipe: ${ast.name}`);\n }\n visitImplicitReceiver(ast, mode) {\n ensureExpressionMode(mode, ast);\n this.usesImplicitReceiver = true;\n return this._implicitReceiver;\n }\n visitThisReceiver(ast, mode) {\n return this.visitImplicitReceiver(ast, mode);\n }\n visitInterpolation(ast, mode) {\n if (!this.supportsInterpolation) {\n throw new Error('Unexpected interpolation');\n }\n ensureExpressionMode(mode, ast);\n let args = [];\n for (let i = 0; i < ast.strings.length - 1; i++) {\n args.push(literal(ast.strings[i]));\n args.push(this._visit(ast.expressions[i], _Mode.Expression));\n }\n args.push(literal(ast.strings[ast.strings.length - 1]));\n // If we're dealing with an interpolation of 1 value with an empty prefix and suffix, reduce the\n // args returned to just the value, because we're going to pass it to a special instruction.\n const strings = ast.strings;\n if (strings.length === 2 && strings[0] === '' && strings[1] === '') {\n // Single argument interpolate instructions.\n args = [args[1]];\n } else if (ast.expressions.length >= 9) {\n // 9 or more arguments must be passed to the `interpolateV`-style instructions, which accept\n // an array of arguments\n args = [literalArr(args)];\n }\n return new InterpolationExpression(args);\n }\n visitKeyedRead(ast, mode) {\n const leftMostSafe = this.leftMostSafeNode(ast);\n if (leftMostSafe) {\n return this.convertSafeAccess(ast, leftMostSafe, mode);\n } else {\n return convertToStatementIfNeeded(mode, this._visit(ast.receiver, _Mode.Expression).key(this._visit(ast.key, _Mode.Expression)));\n }\n }\n visitKeyedWrite(ast, mode) {\n const obj = this._visit(ast.receiver, _Mode.Expression);\n const key = this._visit(ast.key, _Mode.Expression);\n const value = this._visit(ast.value, _Mode.Expression);\n if (obj === this._implicitReceiver) {\n this._localResolver.maybeRestoreView();\n }\n return convertToStatementIfNeeded(mode, obj.key(key).set(value));\n }\n visitLiteralArray(ast, mode) {\n throw new Error(`Illegal State: literal arrays should have been converted into functions`);\n }\n visitLiteralMap(ast, mode) {\n throw new Error(`Illegal State: literal maps should have been converted into functions`);\n }\n visitLiteralPrimitive(ast, mode) {\n // For literal values of null, undefined, true, or false allow type interference\n // to infer the type.\n const type = ast.value === null || ast.value === undefined || ast.value === true || ast.value === true ? INFERRED_TYPE : undefined;\n return convertToStatementIfNeeded(mode, literal(ast.value, type, this.convertSourceSpan(ast.span)));\n }\n _getLocal(name, receiver) {\n if (this._localResolver.globals?.has(name) && receiver instanceof ThisReceiver) {\n return null;\n }\n return this._localResolver.getLocal(name);\n }\n visitPrefixNot(ast, mode) {\n return convertToStatementIfNeeded(mode, not(this._visit(ast.expression, _Mode.Expression)));\n }\n visitNonNullAssert(ast, mode) {\n return convertToStatementIfNeeded(mode, this._visit(ast.expression, _Mode.Expression));\n }\n visitPropertyRead(ast, mode) {\n const leftMostSafe = this.leftMostSafeNode(ast);\n if (leftMostSafe) {\n return this.convertSafeAccess(ast, leftMostSafe, mode);\n } else {\n let result = null;\n const prevUsesImplicitReceiver = this.usesImplicitReceiver;\n const receiver = this._visit(ast.receiver, _Mode.Expression);\n if (receiver === this._implicitReceiver) {\n result = this._getLocal(ast.name, ast.receiver);\n if (result) {\n // Restore the previous \"usesImplicitReceiver\" state since the implicit\n // receiver has been replaced with a resolved local expression.\n this.usesImplicitReceiver = prevUsesImplicitReceiver;\n this.addImplicitReceiverAccess(ast.name);\n }\n }\n if (result == null) {\n result = receiver.prop(ast.name, this.convertSourceSpan(ast.span));\n }\n return convertToStatementIfNeeded(mode, result);\n }\n }\n visitPropertyWrite(ast, mode) {\n const receiver = this._visit(ast.receiver, _Mode.Expression);\n const prevUsesImplicitReceiver = this.usesImplicitReceiver;\n let varExpr = null;\n if (receiver === this._implicitReceiver) {\n const localExpr = this._getLocal(ast.name, ast.receiver);\n if (localExpr) {\n if (localExpr instanceof ReadPropExpr) {\n // If the local variable is a property read expression, it's a reference\n // to a 'context.property' value and will be used as the target of the\n // write expression.\n varExpr = localExpr;\n // Restore the previous \"usesImplicitReceiver\" state since the implicit\n // receiver has been replaced with a resolved local expression.\n this.usesImplicitReceiver = prevUsesImplicitReceiver;\n this.addImplicitReceiverAccess(ast.name);\n } else {\n // Otherwise it's an error.\n const receiver = ast.name;\n const value = ast.value instanceof PropertyRead ? ast.value.name : undefined;\n throw new Error(`Cannot assign value \"${value}\" to template variable \"${receiver}\". Template variables are read-only.`);\n }\n }\n }\n // If no local expression could be produced, use the original receiver's\n // property as the target.\n if (varExpr === null) {\n varExpr = receiver.prop(ast.name, this.convertSourceSpan(ast.span));\n }\n return convertToStatementIfNeeded(mode, varExpr.set(this._visit(ast.value, _Mode.Expression)));\n }\n visitSafePropertyRead(ast, mode) {\n return this.convertSafeAccess(ast, this.leftMostSafeNode(ast), mode);\n }\n visitSafeKeyedRead(ast, mode) {\n return this.convertSafeAccess(ast, this.leftMostSafeNode(ast), mode);\n }\n visitAll(asts, mode) {\n return asts.map(ast => this._visit(ast, mode));\n }\n visitCall(ast, mode) {\n const leftMostSafe = this.leftMostSafeNode(ast);\n if (leftMostSafe) {\n return this.convertSafeAccess(ast, leftMostSafe, mode);\n }\n const convertedArgs = this.visitAll(ast.args, _Mode.Expression);\n if (ast instanceof BuiltinFunctionCall) {\n return convertToStatementIfNeeded(mode, ast.converter(convertedArgs));\n }\n const receiver = ast.receiver;\n if (receiver instanceof PropertyRead && receiver.receiver instanceof ImplicitReceiver && !(receiver.receiver instanceof ThisReceiver) && receiver.name === '$any') {\n if (convertedArgs.length !== 1) {\n throw new Error(`Invalid call to $any, expected 1 argument but received ${convertedArgs.length || 'none'}`);\n }\n return convertToStatementIfNeeded(mode, convertedArgs[0]);\n }\n const call = this._visit(receiver, _Mode.Expression).callFn(convertedArgs, this.convertSourceSpan(ast.span));\n return convertToStatementIfNeeded(mode, call);\n }\n visitSafeCall(ast, mode) {\n return this.convertSafeAccess(ast, this.leftMostSafeNode(ast), mode);\n }\n _visit(ast, mode) {\n const result = this._resultMap.get(ast);\n if (result) return result;\n return (this._nodeMap.get(ast) || ast).visit(this, mode);\n }\n convertSafeAccess(ast, leftMostSafe, mode) {\n // If the expression contains a safe access node on the left it needs to be converted to\n // an expression that guards the access to the member by checking the receiver for blank. As\n // execution proceeds from left to right, the left most part of the expression must be guarded\n // first but, because member access is left associative, the right side of the expression is at\n // the top of the AST. The desired result requires lifting a copy of the left part of the\n // expression up to test it for blank before generating the unguarded version.\n // Consider, for example the following expression: a?.b.c?.d.e\n // This results in the ast:\n // .\n // / \\\n // ?. e\n // / \\\n // . d\n // / \\\n // ?. c\n // / \\\n // a b\n // The following tree should be generated:\n //\n // /---- ? ----\\\n // / | \\\n // a /--- ? ---\\ null\n // / | \\\n // . . null\n // / \\ / \\\n // . c . e\n // / \\ / \\\n // a b . d\n // / \\\n // . c\n // / \\\n // a b\n //\n // Notice that the first guard condition is the left hand of the left most safe access node\n // which comes in as leftMostSafe to this routine.\n let guardedExpression = this._visit(leftMostSafe.receiver, _Mode.Expression);\n let temporary = undefined;\n if (this.needsTemporaryInSafeAccess(leftMostSafe.receiver)) {\n // If the expression has method calls or pipes then we need to save the result into a\n // temporary variable to avoid calling stateful or impure code more than once.\n temporary = this.allocateTemporary();\n // Preserve the result in the temporary variable\n guardedExpression = temporary.set(guardedExpression);\n // Ensure all further references to the guarded expression refer to the temporary instead.\n this._resultMap.set(leftMostSafe.receiver, temporary);\n }\n const condition = guardedExpression.isBlank();\n // Convert the ast to an unguarded access to the receiver's member. The map will substitute\n // leftMostNode with its unguarded version in the call to `this.visit()`.\n if (leftMostSafe instanceof SafeCall) {\n this._nodeMap.set(leftMostSafe, new Call(leftMostSafe.span, leftMostSafe.sourceSpan, leftMostSafe.receiver, leftMostSafe.args, leftMostSafe.argumentSpan));\n } else if (leftMostSafe instanceof SafeKeyedRead) {\n this._nodeMap.set(leftMostSafe, new KeyedRead(leftMostSafe.span, leftMostSafe.sourceSpan, leftMostSafe.receiver, leftMostSafe.key));\n } else {\n this._nodeMap.set(leftMostSafe, new PropertyRead(leftMostSafe.span, leftMostSafe.sourceSpan, leftMostSafe.nameSpan, leftMostSafe.receiver, leftMostSafe.name));\n }\n // Recursively convert the node now without the guarded member access.\n const access = this._visit(ast, _Mode.Expression);\n // Remove the mapping. This is not strictly required as the converter only traverses each node\n // once but is safer if the conversion is changed to traverse the nodes more than once.\n this._nodeMap.delete(leftMostSafe);\n // If we allocated a temporary, release it.\n if (temporary) {\n this.releaseTemporary(temporary);\n }\n // Produce the conditional\n return convertToStatementIfNeeded(mode, condition.conditional(NULL_EXPR, access));\n }\n convertNullishCoalesce(ast, mode) {\n const left = this._visit(ast.left, _Mode.Expression);\n const right = this._visit(ast.right, _Mode.Expression);\n const temporary = this.allocateTemporary();\n this.releaseTemporary(temporary);\n // Generate the following expression. It is identical to how TS\n // transpiles binary expressions with a nullish coalescing operator.\n // let temp;\n // (temp = a) !== null && temp !== undefined ? temp : b;\n return convertToStatementIfNeeded(mode, temporary.set(left).notIdentical(NULL_EXPR).and(temporary.notIdentical(literal(undefined))).conditional(temporary, right));\n }\n // Given an expression of the form a?.b.c?.d.e then the left most safe node is\n // the (a?.b). The . and ?. are left associative thus can be rewritten as:\n // ((((a?.c).b).c)?.d).e. This returns the most deeply nested safe read or\n // safe method call as this needs to be transformed initially to:\n // a == null ? null : a.c.b.c?.d.e\n // then to:\n // a == null ? null : a.b.c == null ? null : a.b.c.d.e\n leftMostSafeNode(ast) {\n const visit = (visitor, ast) => {\n return (this._nodeMap.get(ast) || ast).visit(visitor);\n };\n return ast.visit({\n visitUnary(ast) {\n return null;\n },\n visitBinary(ast) {\n return null;\n },\n visitChain(ast) {\n return null;\n },\n visitConditional(ast) {\n return null;\n },\n visitCall(ast) {\n return visit(this, ast.receiver);\n },\n visitSafeCall(ast) {\n return visit(this, ast.receiver) || ast;\n },\n visitImplicitReceiver(ast) {\n return null;\n },\n visitThisReceiver(ast) {\n return null;\n },\n visitInterpolation(ast) {\n return null;\n },\n visitKeyedRead(ast) {\n return visit(this, ast.receiver);\n },\n visitKeyedWrite(ast) {\n return null;\n },\n visitLiteralArray(ast) {\n return null;\n },\n visitLiteralMap(ast) {\n return null;\n },\n visitLiteralPrimitive(ast) {\n return null;\n },\n visitPipe(ast) {\n return null;\n },\n visitPrefixNot(ast) {\n return null;\n },\n visitNonNullAssert(ast) {\n return visit(this, ast.expression);\n },\n visitPropertyRead(ast) {\n return visit(this, ast.receiver);\n },\n visitPropertyWrite(ast) {\n return null;\n },\n visitSafePropertyRead(ast) {\n return visit(this, ast.receiver) || ast;\n },\n visitSafeKeyedRead(ast) {\n return visit(this, ast.receiver) || ast;\n }\n });\n }\n // Returns true of the AST includes a method or a pipe indicating that, if the\n // expression is used as the target of a safe property or method access then\n // the expression should be stored into a temporary variable.\n needsTemporaryInSafeAccess(ast) {\n const visit = (visitor, ast) => {\n return ast && (this._nodeMap.get(ast) || ast).visit(visitor);\n };\n const visitSome = (visitor, ast) => {\n return ast.some(ast => visit(visitor, ast));\n };\n return ast.visit({\n visitUnary(ast) {\n return visit(this, ast.expr);\n },\n visitBinary(ast) {\n return visit(this, ast.left) || visit(this, ast.right);\n },\n visitChain(ast) {\n return false;\n },\n visitConditional(ast) {\n return visit(this, ast.condition) || visit(this, ast.trueExp) || visit(this, ast.falseExp);\n },\n visitCall(ast) {\n return true;\n },\n visitSafeCall(ast) {\n return true;\n },\n visitImplicitReceiver(ast) {\n return false;\n },\n visitThisReceiver(ast) {\n return false;\n },\n visitInterpolation(ast) {\n return visitSome(this, ast.expressions);\n },\n visitKeyedRead(ast) {\n return false;\n },\n visitKeyedWrite(ast) {\n return false;\n },\n visitLiteralArray(ast) {\n return true;\n },\n visitLiteralMap(ast) {\n return true;\n },\n visitLiteralPrimitive(ast) {\n return false;\n },\n visitPipe(ast) {\n return true;\n },\n visitPrefixNot(ast) {\n return visit(this, ast.expression);\n },\n visitNonNullAssert(ast) {\n return visit(this, ast.expression);\n },\n visitPropertyRead(ast) {\n return false;\n },\n visitPropertyWrite(ast) {\n return false;\n },\n visitSafePropertyRead(ast) {\n return false;\n },\n visitSafeKeyedRead(ast) {\n return false;\n }\n });\n }\n allocateTemporary() {\n const tempNumber = this._currentTemporary++;\n this.temporaryCount = Math.max(this._currentTemporary, this.temporaryCount);\n return new ReadVarExpr(temporaryName(this.bindingId, tempNumber));\n }\n releaseTemporary(temporary) {\n this._currentTemporary--;\n if (temporary.name != temporaryName(this.bindingId, this._currentTemporary)) {\n throw new Error(`Temporary ${temporary.name} released out of order`);\n }\n }\n /**\n * Creates an absolute `ParseSourceSpan` from the relative `ParseSpan`.\n *\n * `ParseSpan` objects are relative to the start of the expression.\n * This method converts these to full `ParseSourceSpan` objects that\n * show where the span is within the overall source file.\n *\n * @param span the relative span to convert.\n * @returns a `ParseSourceSpan` for the given span or null if no\n * `baseSourceSpan` was provided to this class.\n */\n convertSourceSpan(span) {\n if (this.baseSourceSpan) {\n const start = this.baseSourceSpan.start.moveBy(span.start);\n const end = this.baseSourceSpan.start.moveBy(span.end);\n const fullStart = this.baseSourceSpan.fullStart.moveBy(span.start);\n return new ParseSourceSpan(start, end, fullStart);\n } else {\n return null;\n }\n }\n /** Adds the name of an AST to the list of implicit receiver accesses. */\n addImplicitReceiverAccess(name) {\n if (this.implicitReceiverAccesses) {\n this.implicitReceiverAccesses.add(name);\n }\n }\n}\nfunction flattenStatements(arg, output) {\n if (Array.isArray(arg)) {\n arg.forEach(entry => flattenStatements(entry, output));\n } else {\n output.push(arg);\n }\n}\nfunction unsupported() {\n throw new Error('Unsupported operation');\n}\nclass InterpolationExpression extends Expression {\n constructor(args) {\n super(null, null);\n this.args = args;\n this.isConstant = unsupported;\n this.isEquivalent = unsupported;\n this.visitExpression = unsupported;\n this.clone = unsupported;\n }\n}\nclass DefaultLocalResolver {\n constructor(globals) {\n this.globals = globals;\n }\n notifyImplicitReceiverUse() {}\n maybeRestoreView() {}\n getLocal(name) {\n if (name === EventHandlerVars.event.name) {\n return EventHandlerVars.event;\n }\n return null;\n }\n}\nclass BuiltinFunctionCall extends Call {\n constructor(span, sourceSpan, args, converter) {\n super(span, sourceSpan, new EmptyExpr$1(span, sourceSpan), args, null);\n this.converter = converter;\n }\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 `