{"version":3,"file":"common.umd.js","sources":["../../../../packages/common/src/common_module.ts","../../../../packages/common/src/pipes/index.ts","../../../../packages/common/src/pipes/slice_pipe.ts","../../../../packages/common/src/pipes/json_pipe.ts","../../../../packages/common/src/pipes/i18n_select_pipe.ts","../../../../packages/common/src/pipes/i18n_plural_pipe.ts","../../../../packages/common/src/pipes/date_pipe.ts","../../../../packages/common/src/pipes/number_pipe.ts","../../../../packages/common/src/pipes/intl.ts","../../../../packages/common/src/pipes/case_conversion_pipes.ts","../../../../packages/common/src/pipes/async_pipe.ts","../../../../packages/common/src/pipes/invalid_pipe_argument_error.ts","../../../../packages/common/src/directives/index.ts","../../../../packages/common/src/directives/ng_template_outlet.ts","../../../../packages/common/src/directives/ng_style.ts","../../../../packages/common/src/directives/ng_plural.ts","../../../../packages/common/src/directives/ng_switch.ts","../../../../packages/common/src/directives/ng_if.ts","../../../../packages/common/src/directives/ng_for_of.ts","../../../../packages/common/src/directives/ng_component_outlet.ts","../../../../packages/common/src/directives/ng_class.ts","../../../../packages/common/src/cookie.ts","../../../../packages/common/src/localization.ts","../../../../packages/common/src/location/index.ts","../../../../packages/common/src/location/path_location_strategy.ts","../../../../packages/common/src/location/hash_location_strategy.ts","../../../../packages/common/src/location/location.ts","../../../../packages/common/src/location/location_strategy.ts","../../../../packages/common/src/location/platform_location.ts","../../../../node_modules/tslib/tslib.es6.js"],"sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n\nimport {NgModule} from '@angular/core';\n\nimport {COMMON_DEPRECATED_DIRECTIVES, COMMON_DIRECTIVES} from './directives/index';\nimport {NgLocaleLocalization, NgLocalization} from './localization';\nimport {COMMON_PIPES} from './pipes/index';\n/**\n * The module that includes all the basic Angular directives like {\\@link NgIf}, {\\@link NgForOf}, ...\n * \n * \\@stable\n */\nexport class CommonModule {\nstatic decorators: DecoratorInvocation[] = [\n{ type: NgModule, args: [{\n declarations: [COMMON_DIRECTIVES, COMMON_PIPES],\n exports: [COMMON_DIRECTIVES, COMMON_PIPES],\n providers: [\n {provide: NgLocalization, useClass: NgLocaleLocalization},\n ],\n}, ] },\n];\n/**\n * @nocollapse\n */\nstatic ctorParameters: () => ({type: any, decorators?: DecoratorInvocation[]}|null)[] = () => [\n];\n}\n\nfunction CommonModule_tsickle_Closure_declarations() {\n/** @type {?} */\nCommonModule.decorators;\n/**\n * @nocollapse\n * @type {?}\n */\nCommonModule.ctorParameters;\n}\n\n/**\n * I18N pipes are being changed to move away from using the JS Intl API.\n * \n * The former pipes relying on the Intl API will be moved to this module while the `CommonModule`\n * will contain the new pipes that do not rely on Intl.\n * \n * As a first step this module is created empty to ease the migration.\n * \n * see https://github.com/angular/angular/pull/18284\n * \n * @deprecated from v5\n */\nexport class DeprecatedI18NPipesModule {\nstatic decorators: DecoratorInvocation[] = [\n{ type: NgModule, args: [{declarations: [], exports: []}, ] },\n];\n/**\n * @nocollapse\n */\nstatic ctorParameters: () => ({type: any, decorators?: DecoratorInvocation[]}|null)[] = () => [\n];\n}\n\nfunction DeprecatedI18NPipesModule_tsickle_Closure_declarations() {\n/** @type {?} */\nDeprecatedI18NPipesModule.decorators;\n/**\n * @nocollapse\n * @type {?}\n */\nDeprecatedI18NPipesModule.ctorParameters;\n}\n\n\ninterface DecoratorInvocation {\n type: Function;\n args?: any[];\n}\n","/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * @module\n * @description\n * This module provides a set of common Pipes.\n */\n\nimport {AsyncPipe} from './async_pipe';\nimport {LowerCasePipe, TitleCasePipe, UpperCasePipe} from './case_conversion_pipes';\nimport {DatePipe} from './date_pipe';\nimport {I18nPluralPipe} from './i18n_plural_pipe';\nimport {I18nSelectPipe} from './i18n_select_pipe';\nimport {JsonPipe} from './json_pipe';\nimport {CurrencyPipe, DecimalPipe, PercentPipe} from './number_pipe';\nimport {SlicePipe} from './slice_pipe';\n\nexport {\n AsyncPipe,\n CurrencyPipe,\n DatePipe,\n DecimalPipe,\n I18nPluralPipe,\n I18nSelectPipe,\n JsonPipe,\n LowerCasePipe,\n PercentPipe,\n SlicePipe,\n TitleCasePipe,\n UpperCasePipe\n};\n/**\n * A collection of Angular pipes that are likely to be used in each and every application.\n */\nexport const COMMON_PIPES = [\n AsyncPipe,\n UpperCasePipe,\n LowerCasePipe,\n JsonPipe,\n SlicePipe,\n DecimalPipe,\n PercentPipe,\n TitleCasePipe,\n CurrencyPipe,\n DatePipe,\n I18nPluralPipe,\n I18nSelectPipe,\n];\n","/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n\nimport {Pipe, PipeTransform} from '@angular/core';\nimport {invalidPipeArgumentError} from './invalid_pipe_argument_error';\n/**\n * \\@ngModule CommonModule\n * \\@whatItDoes Creates a new List or String containing a subset (slice) of the elements.\n * \\@howToUse `array_or_string_expression | slice:start[:end]`\n * \\@description \n * \n * Where the input expression is a `List` or `String`, and:\n * - `start`: The starting index of the subset to return.\n * - **a positive integer**: return the item at `start` index and all items after\n * in the list or string expression.\n * - **a negative integer**: return the item at `start` index from the end and all items after\n * in the list or string expression.\n * - **if positive and greater than the size of the expression**: return an empty list or string.\n * - **if negative and greater than the size of the expression**: return entire list or string.\n * - `end`: The ending index of the subset to return.\n * - **omitted**: return all items until the end.\n * - **if positive**: return all items before `end` index of the list or string.\n * - **if negative**: return all items before `end` index from the end of the list or string.\n * \n * All behavior is based on the expected behavior of the JavaScript API `Array.prototype.slice()`\n * and `String.prototype.slice()`.\n * \n * When operating on a [List], the returned list is always a copy even when all\n * the elements are being returned.\n * \n * When operating on a blank value, the pipe returns the blank value.\n * \n * ## List Example\n * \n * This `ngFor` example:\n * \n * {\\@example common/pipes/ts/slice_pipe.ts region='SlicePipe_list'}\n * \n * produces the following:\n * \n *
{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}
\n * - `minIntegerDigits` is the minimum number of integer digits to use. Defaults to `1`.\n * - `minFractionDigits` is the minimum number of digits after fraction. Defaults to `0`.\n * - `maxFractionDigits` is the maximum number of digits after fraction. Defaults to `3`.\n * \n * For more information on the acceptable range for each of these numbers and other\n * details see your native internationalization library.\n * \n * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers\n * and may require a polyfill. See [Browser Support](guide/browser-support) for details.\n * \n * ### Example\n * \n * {\\@example common/pipes/ts/number_pipe.ts region='NumberPipe'}\n * \n * \\@stable\n */\nexport class DecimalPipe implements PipeTransform {\n/**\n * @param {?} _locale\n */\nconstructor(\nprivate _locale: string) {}\n/**\n * @param {?} value\n * @param {?=} digits\n * @return {?}\n */\ntransform(value: any, digits?: string): string|null {\n return formatNumber(DecimalPipe, this._locale, value, NumberFormatStyle.Decimal, digits);\n }\nstatic decorators: DecoratorInvocation[] = [\n{ type: Pipe, args: [{name: 'number'}, ] },\n];\n/**\n * @nocollapse\n */\nstatic ctorParameters: () => ({type: any, decorators?: DecoratorInvocation[]}|null)[] = () => [\n{type: undefined, decorators: [{ type: Inject, args: [LOCALE_ID, ] }, ]},\n];\n}\n\nfunction DecimalPipe_tsickle_Closure_declarations() {\n/** @type {?} */\nDecimalPipe.decorators;\n/**\n * @nocollapse\n * @type {?}\n */\nDecimalPipe.ctorParameters;\n/** @type {?} */\nDecimalPipe.prototype._locale;\n}\n\n/**\n * \\@ngModule CommonModule\n * \\@whatItDoes Formats a number as a percentage according to locale rules.\n * \\@howToUse `number_expression | percent[:digitInfo]`\n * \n * \\@description \n * \n * Formats a number as percentage.\n * \n * - `digitInfo` See {\\@link DecimalPipe} for detailed description.\n * \n * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers\n * and may require a polyfill. See [Browser Support](guide/browser-support) for details.\n * \n * ### Example\n * \n * {\\@example common/pipes/ts/number_pipe.ts region='PercentPipe'}\n * \n * \\@stable\n */\nexport class PercentPipe implements PipeTransform {\n/**\n * @param {?} _locale\n */\nconstructor(\nprivate _locale: string) {}\n/**\n * @param {?} value\n * @param {?=} digits\n * @return {?}\n */\ntransform(value: any, digits?: string): string|null {\n return formatNumber(PercentPipe, this._locale, value, NumberFormatStyle.Percent, digits);\n }\nstatic decorators: DecoratorInvocation[] = [\n{ type: Pipe, args: [{name: 'percent'}, ] },\n];\n/**\n * @nocollapse\n */\nstatic ctorParameters: () => ({type: any, decorators?: DecoratorInvocation[]}|null)[] = () => [\n{type: undefined, decorators: [{ type: Inject, args: [LOCALE_ID, ] }, ]},\n];\n}\n\nfunction PercentPipe_tsickle_Closure_declarations() {\n/** @type {?} */\nPercentPipe.decorators;\n/**\n * @nocollapse\n * @type {?}\n */\nPercentPipe.ctorParameters;\n/** @type {?} */\nPercentPipe.prototype._locale;\n}\n\n/**\n * \\@ngModule CommonModule\n * \\@whatItDoes Formats a number as currency using locale rules.\n * \\@howToUse `number_expression | currency[:currencyCode[:symbolDisplay[:digitInfo]]]`\n * \\@description \n * \n * Use `currency` to format a number as currency.\n * \n * - `currencyCode` is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, such\n * as `USD` for the US dollar and `EUR` for the euro.\n * - `symbolDisplay` is a boolean indicating whether to use the currency symbol or code.\n * - `true`: use symbol (e.g. `$`).\n * - `false`(default): use code (e.g. `USD`).\n * - `digitInfo` See {\\@link DecimalPipe} for detailed description.\n * \n * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers\n * and may require a polyfill. See [Browser Support](guide/browser-support) for details.\n * \n * ### Example\n * \n * {\\@example common/pipes/ts/number_pipe.ts region='CurrencyPipe'}\n * \n * \\@stable\n */\nexport class CurrencyPipe implements PipeTransform {\n/**\n * @param {?} _locale\n */\nconstructor(\nprivate _locale: string) {}\n/**\n * @param {?} value\n * @param {?=} currencyCode\n * @param {?=} symbolDisplay\n * @param {?=} digits\n * @return {?}\n */\ntransform(\n value: any, currencyCode: string = 'USD', symbolDisplay: boolean = false,\n digits?: string): string|null {\n return formatNumber(\n CurrencyPipe, this._locale, value, NumberFormatStyle.Currency, digits, currencyCode,\n symbolDisplay);\n }\nstatic decorators: DecoratorInvocation[] = [\n{ type: Pipe, args: [{name: 'currency'}, ] },\n];\n/**\n * @nocollapse\n */\nstatic ctorParameters: () => ({type: any, decorators?: DecoratorInvocation[]}|null)[] = () => [\n{type: undefined, decorators: [{ type: Inject, args: [LOCALE_ID, ] }, ]},\n];\n}\n\nfunction CurrencyPipe_tsickle_Closure_declarations() {\n/** @type {?} */\nCurrencyPipe.decorators;\n/**\n * @nocollapse\n * @type {?}\n */\nCurrencyPipe.ctorParameters;\n/** @type {?} */\nCurrencyPipe.prototype._locale;\n}\n\n/**\n * @param {?} text\n * @return {?}\n */\nfunction parseIntAutoRadix(text: string): number {\n const /** @type {?} */ result: number = parseInt(text);\n if (isNaN(result)) {\n throw new Error('Invalid integer literal when parsing ' + text);\n }\n return result;\n}\n/**\n * @param {?} value\n * @return {?}\n */\nexport function isNumeric(value: any): boolean {\n return !isNaN(value - parseFloat(value));\n}\n\ninterface DecoratorInvocation {\n type: Function;\n args?: any[];\n}\n","\nexport type NumberFormatStyle = number;\nexport let NumberFormatStyle: any = {};\nNumberFormatStyle.Decimal = 0;\nNumberFormatStyle.Percent = 1;\nNumberFormatStyle.Currency = 2;\nNumberFormatStyle[NumberFormatStyle.Decimal] = \"Decimal\";\nNumberFormatStyle[NumberFormatStyle.Percent] = \"Percent\";\nNumberFormatStyle[NumberFormatStyle.Currency] = \"Currency\";\n\nexport class NumberFormatter {\n/**\n * @param {?} num\n * @param {?} locale\n * @param {?} style\n * @param {?=} opts\n * @return {?}\n */\nstatic format(num: number, locale: string, style: NumberFormatStyle, opts: {\n minimumIntegerDigits?: number,\n minimumFractionDigits?: number,\n maximumFractionDigits?: number,\n currency?: string|null,\n currencyAsSymbol?: boolean\n } = {}): string {\n const {minimumIntegerDigits, minimumFractionDigits, maximumFractionDigits, currency,\n currencyAsSymbol = false} = opts;\n const /** @type {?} */ options: Intl.NumberFormatOptions = {\n minimumIntegerDigits,\n minimumFractionDigits,\n maximumFractionDigits,\n style: NumberFormatStyle[style].toLowerCase()\n };\n\n if (style == NumberFormatStyle.Currency) {\n options.currency = typeof currency == 'string' ? currency : undefined;\n options.currencyDisplay = currencyAsSymbol ? 'symbol' : 'code';\n }\n return new Intl.NumberFormat(locale, options).format(num);\n }\n}\n\ntype DateFormatterFn = (date: Date, locale: string) => string;\n\nconst /** @type {?} */ DATE_FORMATS_SPLIT =\n /((?:[^yMLdHhmsazZEwGjJ']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|J+|j+|m+|s+|a|z|Z|G+|w+))(.*)/;\n\nconst /** @type {?} */ PATTERN_ALIASES: {[format: string]: DateFormatterFn} = {\n // Keys are quoted so they do not get renamed during closure compilation.\n 'yMMMdjms': datePartGetterFactory(combine([\n digitCondition('year', 1),\n nameCondition('month', 3),\n digitCondition('day', 1),\n digitCondition('hour', 1),\n digitCondition('minute', 1),\n digitCondition('second', 1),\n ])),\n 'yMdjm': datePartGetterFactory(combine([\n digitCondition('year', 1), digitCondition('month', 1), digitCondition('day', 1),\n digitCondition('hour', 1), digitCondition('minute', 1)\n ])),\n 'yMMMMEEEEd': datePartGetterFactory(combine([\n digitCondition('year', 1), nameCondition('month', 4), nameCondition('weekday', 4),\n digitCondition('day', 1)\n ])),\n 'yMMMMd': datePartGetterFactory(\n combine([digitCondition('year', 1), nameCondition('month', 4), digitCondition('day', 1)])),\n 'yMMMd': datePartGetterFactory(\n combine([digitCondition('year', 1), nameCondition('month', 3), digitCondition('day', 1)])),\n 'yMd': datePartGetterFactory(\n combine([digitCondition('year', 1), digitCondition('month', 1), digitCondition('day', 1)])),\n 'jms': datePartGetterFactory(combine(\n [digitCondition('hour', 1), digitCondition('second', 1), digitCondition('minute', 1)])),\n 'jm': datePartGetterFactory(combine([digitCondition('hour', 1), digitCondition('minute', 1)]))\n};\n\nconst /** @type {?} */ DATE_FORMATS: {[format: string]: DateFormatterFn} = {\n // Keys are quoted so they do not get renamed.\n 'yyyy': datePartGetterFactory(digitCondition('year', 4)),\n 'yy': datePartGetterFactory(digitCondition('year', 2)),\n 'y': datePartGetterFactory(digitCondition('year', 1)),\n 'MMMM': datePartGetterFactory(nameCondition('month', 4)),\n 'MMM': datePartGetterFactory(nameCondition('month', 3)),\n 'MM': datePartGetterFactory(digitCondition('month', 2)),\n 'M': datePartGetterFactory(digitCondition('month', 1)),\n 'LLLL': datePartGetterFactory(nameCondition('month', 4)),\n 'L': datePartGetterFactory(nameCondition('month', 1)),\n 'dd': datePartGetterFactory(digitCondition('day', 2)),\n 'd': datePartGetterFactory(digitCondition('day', 1)),\n 'HH': digitModifier(\n hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 2), false)))),\n 'H': hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), false))),\n 'hh': digitModifier(\n hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 2), true)))),\n 'h': hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))),\n 'jj': datePartGetterFactory(digitCondition('hour', 2)),\n 'j': datePartGetterFactory(digitCondition('hour', 1)),\n 'mm': digitModifier(datePartGetterFactory(digitCondition('minute', 2))),\n 'm': datePartGetterFactory(digitCondition('minute', 1)),\n 'ss': digitModifier(datePartGetterFactory(digitCondition('second', 2))),\n 's': datePartGetterFactory(digitCondition('second', 1)),\n // while ISO 8601 requires fractions to be prefixed with `.` or `,`\n // we can be just safely rely on using `sss` since we currently don't support single or two digit\n // fractions\n 'sss': datePartGetterFactory(digitCondition('second', 3)),\n 'EEEE': datePartGetterFactory(nameCondition('weekday', 4)),\n 'EEE': datePartGetterFactory(nameCondition('weekday', 3)),\n 'EE': datePartGetterFactory(nameCondition('weekday', 2)),\n 'E': datePartGetterFactory(nameCondition('weekday', 1)),\n 'a': hourClockExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))),\n 'Z': timeZoneGetter('short'),\n 'z': timeZoneGetter('long'),\n 'ww': datePartGetterFactory({}), // Week of year, padded (00-53). Week 01 is the week with the\n // first Thursday of the year. not support ?\n 'w':\n datePartGetterFactory({}), // Week of year (0-53). Week 1 is the week with the first Thursday\n // of the year not support ?\n 'G': datePartGetterFactory(nameCondition('era', 1)),\n 'GG': datePartGetterFactory(nameCondition('era', 2)),\n 'GGG': datePartGetterFactory(nameCondition('era', 3)),\n 'GGGG': datePartGetterFactory(nameCondition('era', 4))\n};\n/**\n * @param {?} inner\n * @return {?}\n */\nfunction digitModifier(inner: DateFormatterFn): DateFormatterFn {\n return function(date: Date, locale: string): string {\n const /** @type {?} */ result = inner(date, locale);\n return result.length == 1 ? '0' + result : result;\n };\n}\n/**\n * @param {?} inner\n * @return {?}\n */\nfunction hourClockExtractor(inner: DateFormatterFn): DateFormatterFn {\n return function(date: Date, locale: string): string { return inner(date, locale).split(' ')[1]; };\n}\n/**\n * @param {?} inner\n * @return {?}\n */\nfunction hourExtractor(inner: DateFormatterFn): DateFormatterFn {\n return function(date: Date, locale: string): string { return inner(date, locale).split(' ')[0]; };\n}\n/**\n * @param {?} date\n * @param {?} locale\n * @param {?} options\n * @return {?}\n */\nfunction intlDateFormat(date: Date, locale: string, options: Intl.DateTimeFormatOptions): string {\n return new Intl.DateTimeFormat(locale, options).format(date).replace(/[\\u200e\\u200f]/g, '');\n}\n/**\n * @param {?} timezone\n * @return {?}\n */\nfunction timeZoneGetter(timezone: string): DateFormatterFn {\n // To workaround `Intl` API restriction for single timezone let format with 24 hours\n const /** @type {?} */ options = {hour: '2-digit', hour12: false, timeZoneName: timezone};\n return function(date: Date, locale: string): string {\n const /** @type {?} */ result = intlDateFormat(date, locale, options);\n // Then extract first 3 letters that related to hours\n return result ? result.substring(3) : '';\n };\n}\n/**\n * @param {?} options\n * @param {?} value\n * @return {?}\n */\nfunction hour12Modify(\n options: Intl.DateTimeFormatOptions, value: boolean): Intl.DateTimeFormatOptions {\n options.hour12 = value;\n return options;\n}\n/**\n * @param {?} prop\n * @param {?} len\n * @return {?}\n */\nfunction digitCondition(prop: string, len: number): Intl.DateTimeFormatOptions {\n const /** @type {?} */ result: {[k: string]: string} = {};\n result[prop] = len === 2 ? '2-digit' : 'numeric';\n return result;\n}\n/**\n * @param {?} prop\n * @param {?} len\n * @return {?}\n */\nfunction nameCondition(prop: string, len: number): Intl.DateTimeFormatOptions {\n const /** @type {?} */ result: {[k: string]: string} = {};\n if (len < 4) {\n result[prop] = len > 1 ? 'short' : 'narrow';\n } else {\n result[prop] = 'long';\n }\n\n return result;\n}\n/**\n * @param {?} options\n * @return {?}\n */\nfunction combine(options: Intl.DateTimeFormatOptions[]): Intl.DateTimeFormatOptions {\n return options.reduce((merged, opt) => ({...merged, ...opt}), {});\n}\n/**\n * @param {?} ret\n * @return {?}\n */\nfunction datePartGetterFactory(ret: Intl.DateTimeFormatOptions): DateFormatterFn {\n return (date: Date, locale: string): string => intlDateFormat(date, locale, ret);\n}\n\nconst /** @type {?} */ DATE_FORMATTER_CACHE = new Map