/**
* @license Angular v2.4.5
* (c) 2010-2016 Google, Inc. https://angular.io/
* License: MIT
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core')) :
typeof define === 'function' && define.amd ? define(['exports', '@angular/core'], factory) :
(factory((global.ng = global.ng || {}, global.ng.common = global.ng.common || {}),global.ng.core));
}(this, function (exports,_angular_core) { 'use strict';
/**
* This class should not be used directly by an application developer. Instead, use
* {\@link Location}.
*
* `PlatformLocation` encapsulates all calls to DOM apis, which allows the Router to be platform
* agnostic.
* This means that we can have different implementation of `PlatformLocation` for the different
* platforms
* that angular supports. For example, the default `PlatformLocation` is {\@link
* BrowserPlatformLocation},
* however when you run your app in a WebWorker you use {\@link WebWorkerPlatformLocation}.
*
* The `PlatformLocation` class is used directly by all implementations of {\@link LocationStrategy}
* when
* they need to interact with the DOM apis like pushState, popState, etc...
*
* {\@link LocationStrategy} in turn is used by the {\@link Location} service which is used directly
* by
* the {\@link Router} in order to navigate between routes. Since all interactions between {\@link
* Router} /
* {\@link Location} / {\@link LocationStrategy} and DOM apis flow through the `PlatformLocation`
* class
* they are all platform independent.
*
* \@stable
* @abstract
*/
var PlatformLocation = (function () {
function PlatformLocation() {
}
/**
* @abstract
* @return {?}
*/
PlatformLocation.prototype.getBaseHrefFromDOM = function () { };
/**
* @abstract
* @param {?} fn
* @return {?}
*/
PlatformLocation.prototype.onPopState = function (fn) { };
/**
* @abstract
* @param {?} fn
* @return {?}
*/
PlatformLocation.prototype.onHashChange = function (fn) { };
Object.defineProperty(PlatformLocation.prototype, "pathname", {
/**
* @return {?}
*/
get: function () { return null; },
enumerable: true,
configurable: true
});
Object.defineProperty(PlatformLocation.prototype, "search", {
/**
* @return {?}
*/
get: function () { return null; },
enumerable: true,
configurable: true
});
Object.defineProperty(PlatformLocation.prototype, "hash", {
/**
* @return {?}
*/
get: function () { return null; },
enumerable: true,
configurable: true
});
/**
* @abstract
* @param {?} state
* @param {?} title
* @param {?} url
* @return {?}
*/
PlatformLocation.prototype.replaceState = function (state, title, url) { };
/**
* @abstract
* @param {?} state
* @param {?} title
* @param {?} url
* @return {?}
*/
PlatformLocation.prototype.pushState = function (state, title, url) { };
/**
* @abstract
* @return {?}
*/
PlatformLocation.prototype.forward = function () { };
/**
* @abstract
* @return {?}
*/
PlatformLocation.prototype.back = function () { };
return PlatformLocation;
}());
/**
* `LocationStrategy` is responsible for representing and reading route state
* from the browser's URL. Angular provides two strategies:
* {\@link HashLocationStrategy} and {\@link PathLocationStrategy}.
*
* This is used under the hood of the {\@link Location} service.
*
* Applications should use the {\@link Router} or {\@link Location} services to
* interact with application route state.
*
* For instance, {\@link HashLocationStrategy} produces URLs like
* `http://example.com#/foo`, and {\@link PathLocationStrategy} produces
* `http://example.com/foo` as an equivalent URL.
*
* See these two classes for more.
*
* \@stable
* @abstract
*/
var LocationStrategy = (function () {
function LocationStrategy() {
}
/**
* @abstract
* @param {?=} includeHash
* @return {?}
*/
LocationStrategy.prototype.path = function (includeHash) { };
/**
* @abstract
* @param {?} internal
* @return {?}
*/
LocationStrategy.prototype.prepareExternalUrl = function (internal) { };
/**
* @abstract
* @param {?} state
* @param {?} title
* @param {?} url
* @param {?} queryParams
* @return {?}
*/
LocationStrategy.prototype.pushState = function (state, title, url, queryParams) { };
/**
* @abstract
* @param {?} state
* @param {?} title
* @param {?} url
* @param {?} queryParams
* @return {?}
*/
LocationStrategy.prototype.replaceState = function (state, title, url, queryParams) { };
/**
* @abstract
* @return {?}
*/
LocationStrategy.prototype.forward = function () { };
/**
* @abstract
* @return {?}
*/
LocationStrategy.prototype.back = function () { };
/**
* @abstract
* @param {?} fn
* @return {?}
*/
LocationStrategy.prototype.onPopState = function (fn) { };
/**
* @abstract
* @return {?}
*/
LocationStrategy.prototype.getBaseHref = function () { };
return LocationStrategy;
}());
/**
* The `APP_BASE_HREF` token represents the base href to be used with the
* {@link PathLocationStrategy}.
*
* If you're using {@link PathLocationStrategy}, you must provide a provider to a string
* representing the URL prefix that should be preserved when generating and recognizing
* URLs.
*
* ### Example
*
* ```typescript
* import {Component, NgModule} from '@angular/core';
* import {APP_BASE_HREF} from '@angular/common';
*
* @NgModule({
* providers: [{provide: APP_BASE_HREF, useValue: '/my/app'}]
* })
* class AppModule {}
* ```
*
* @stable
*/
var /** @type {?} */ APP_BASE_HREF = new _angular_core.OpaqueToken('appBaseHref');
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var /** @type {?} */ globalScope;
if (typeof window === 'undefined') {
if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {
// TODO: Replace any with WorkerGlobalScope from lib.webworker.d.ts #3492
globalScope = (self);
}
else {
globalScope = (global);
}
}
else {
globalScope = (window);
}
// Need to declare a new variable for global here since TypeScript
// exports the original value of the symbol.
var /** @type {?} */ _global = globalScope;
/**
* @param {?} type
* @return {?}
*/
function getTypeNameForDebugging(type) {
return type['name'] || typeof type;
}
// TODO: remove calls to assert in production environment
// Note: Can't just export this and import in in other files
// as `assert` is a reserved keyword in Dart
_global.assert = function assert(condition) {
// TODO: to be fixed properly via #2830, noop for now
};
/**
* @param {?} obj
* @return {?}
*/
function isPresent(obj) {
return obj != null;
}
/**
* @param {?} obj
* @return {?}
*/
function isBlank(obj) {
return obj == null;
}
/**
* @param {?} obj
* @return {?}
*/
function isDate(obj) {
return obj instanceof Date && !isNaN(obj.valueOf());
}
/**
* @param {?} token
* @return {?}
*/
function stringify(token) {
if (typeof token === 'string') {
return token;
}
if (token == null) {
return '' + token;
}
if (token.overriddenName) {
return "" + token.overriddenName;
}
if (token.name) {
return "" + token.name;
}
var /** @type {?} */ res = token.toString();
var /** @type {?} */ newLineIndex = res.indexOf('\n');
return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
}
var NumberWrapper = (function () {
function NumberWrapper() {
}
/**
* @param {?} text
* @return {?}
*/
NumberWrapper.parseIntAutoRadix = function (text) {
var /** @type {?} */ result = parseInt(text);
if (isNaN(result)) {
throw new Error('Invalid integer literal when parsing ' + text);
}
return result;
};
/**
* @param {?} value
* @return {?}
*/
NumberWrapper.isNumeric = function (value) { return !isNaN(value - parseFloat(value)); };
return NumberWrapper;
}());
/**
* @param {?} o
* @return {?}
*/
function isJsObject(o) {
return o !== null && (typeof o === 'function' || typeof o === 'object');
}
var /** @type {?} */ _symbolIterator = null;
/**
* @return {?}
*/
function getSymbolIterator() {
if (!_symbolIterator) {
if (((globalScope)).Symbol && Symbol.iterator) {
_symbolIterator = Symbol.iterator;
}
else {
// es6-shim specific logic
var /** @type {?} */ keys = Object.getOwnPropertyNames(Map.prototype);
for (var /** @type {?} */ i = 0; i < keys.length; ++i) {
var /** @type {?} */ key = keys[i];
if (key !== 'entries' && key !== 'size' &&
((Map)).prototype[key] === Map.prototype['entries']) {
_symbolIterator = key;
}
}
}
}
return _symbolIterator;
}
/**
* \@whatItDoes `Location` is a service that applications can use to interact with a browser's URL.
* \@description
* Depending on which {\@link LocationStrategy} is used, `Location` will either persist
* to the URL's path or the URL's hash segment.
*
* Note: it's better to use {\@link Router#navigate} service to trigger route changes. Use
* `Location` only if you need to interact with or create normalized URLs outside of
* routing.
*
* `Location` is responsible for normalizing the URL against the application's base href.
* A normalized URL is absolute from the URL host, includes the application's base href, and has no
* trailing slash:
* - `/my/app/user/123` is normalized
* - `my/app/user/123` **is not** normalized
* - `/my/app/user/123/` **is not** normalized
*
* ### Example
* {\@example common/location/ts/path_location_component.ts region='LocationComponent'}
* \@stable
*/
var Location = (function () {
/**
* @param {?} platformStrategy
*/
function Location(platformStrategy) {
var _this = this;
/** @internal */
this._subject = new _angular_core.EventEmitter();
this._platformStrategy = platformStrategy;
var browserBaseHref = this._platformStrategy.getBaseHref();
this._baseHref = Location.stripTrailingSlash(_stripIndexHtml(browserBaseHref));
this._platformStrategy.onPopState(function (ev) {
_this._subject.emit({
'url': _this.path(true),
'pop': true,
'type': ev.type,
});
});
}
/**
* @param {?=} includeHash
* @return {?}
*/
Location.prototype.path = function (includeHash) {
if (includeHash === void 0) { includeHash = false; }
return this.normalize(this._platformStrategy.path(includeHash));
};
/**
* Normalizes the given path and compares to the current normalized path.
* @param {?} path
* @param {?=} query
* @return {?}
*/
Location.prototype.isCurrentPathEqualTo = function (path, query) {
if (query === void 0) { query = ''; }
return this.path() == this.normalize(path + Location.normalizeQueryParams(query));
};
/**
* Given a string representing a URL, returns the normalized URL path without leading or
* trailing slashes.
* @param {?} url
* @return {?}
*/
Location.prototype.normalize = function (url) {
return Location.stripTrailingSlash(_stripBaseHref(this._baseHref, _stripIndexHtml(url)));
};
/**
* Given a string representing a URL, returns the platform-specific external URL path.
* If the given URL doesn't begin with a leading slash (`'/'`), this method adds one
* before normalizing. This method will also add a hash if `HashLocationStrategy` is
* used, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use.
* @param {?} url
* @return {?}
*/
Location.prototype.prepareExternalUrl = function (url) {
if (url && url[0] !== '/') {
url = '/' + url;
}
return this._platformStrategy.prepareExternalUrl(url);
};
/**
* Changes the browsers URL to the normalized version of the given URL, and pushes a
* new item onto the platform's history.
* @param {?} path
* @param {?=} query
* @return {?}
*/
Location.prototype.go = function (path, query) {
if (query === void 0) { query = ''; }
this._platformStrategy.pushState(null, '', path, query);
};
/**
* Changes the browsers URL to the normalized version of the given URL, and replaces
* the top item on the platform's history stack.
* @param {?} path
* @param {?=} query
* @return {?}
*/
Location.prototype.replaceState = function (path, query) {
if (query === void 0) { query = ''; }
this._platformStrategy.replaceState(null, '', path, query);
};
/**
* Navigates forward in the platform's history.
* @return {?}
*/
Location.prototype.forward = function () { this._platformStrategy.forward(); };
/**
* Navigates back in the platform's history.
* @return {?}
*/
Location.prototype.back = function () { this._platformStrategy.back(); };
/**
* Subscribe to the platform's `popState` events.
* @param {?} onNext
* @param {?=} onThrow
* @param {?=} onReturn
* @return {?}
*/
Location.prototype.subscribe = function (onNext, onThrow, onReturn) {
if (onThrow === void 0) { onThrow = null; }
if (onReturn === void 0) { onReturn = null; }
return this._subject.subscribe({ next: onNext, error: onThrow, complete: onReturn });
};
/**
* Given a string of url parameters, prepend with '?' if needed, otherwise return parameters as
* is.
* @param {?} params
* @return {?}
*/
Location.normalizeQueryParams = function (params) {
return params && params[0] !== '?' ? '?' + params : params;
};
/**
* Given 2 parts of a url, join them with a slash if needed.
* @param {?} start
* @param {?} end
* @return {?}
*/
Location.joinWithSlash = function (start, end) {
if (start.length == 0) {
return end;
}
if (end.length == 0) {
return start;
}
var /** @type {?} */ slashes = 0;
if (start.endsWith('/')) {
slashes++;
}
if (end.startsWith('/')) {
slashes++;
}
if (slashes == 2) {
return start + end.substring(1);
}
if (slashes == 1) {
return start + end;
}
return start + '/' + end;
};
/**
* If url has a trailing slash, remove it, otherwise return url as is.
* @param {?} url
* @return {?}
*/
Location.stripTrailingSlash = function (url) { return url.replace(/\/$/, ''); };
Location.decorators = [
{ type: _angular_core.Injectable },
];
/** @nocollapse */
Location.ctorParameters = function () { return [
{ type: LocationStrategy, },
]; };
return Location;
}());
/**
* @param {?} baseHref
* @param {?} url
* @return {?}
*/
function _stripBaseHref(baseHref, url) {
return baseHref && url.startsWith(baseHref) ? url.substring(baseHref.length) : url;
}
/**
* @param {?} url
* @return {?}
*/
function _stripIndexHtml(url) {
return url.replace(/\/index.html$/, '');
}
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
/**
* \@whatItDoes Use URL hash for storing application location data.
* \@description
* `HashLocationStrategy` is a {\@link LocationStrategy} used to configure the
* {\@link Location} service to represent its state in the
* [hash fragment](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax)
* of the browser's URL.
*
* For instance, if you call `location.go('/foo')`, the browser's URL will become
* `example.com#/foo`.
*
* ### Example
*
* {\@example common/location/ts/hash_location_component.ts region='LocationComponent'}
*
* \@stable
*/
var HashLocationStrategy = (function (_super) {
__extends(HashLocationStrategy, _super);
/**
* @param {?} _platformLocation
* @param {?=} _baseHref
*/
function HashLocationStrategy(_platformLocation, _baseHref) {
_super.call(this);
this._platformLocation = _platformLocation;
this._baseHref = '';
if (isPresent(_baseHref)) {
this._baseHref = _baseHref;
}
}
/**
* @param {?} fn
* @return {?}
*/
HashLocationStrategy.prototype.onPopState = function (fn) {
this._platformLocation.onPopState(fn);
this._platformLocation.onHashChange(fn);
};
/**
* @return {?}
*/
HashLocationStrategy.prototype.getBaseHref = function () { return this._baseHref; };
/**
* @param {?=} includeHash
* @return {?}
*/
HashLocationStrategy.prototype.path = function (includeHash) {
if (includeHash === void 0) { includeHash = false; }
// the hash value is always prefixed with a `#`
// and if it is empty then it will stay empty
var /** @type {?} */ path = this._platformLocation.hash;
if (!isPresent(path))
path = '#';
return path.length > 0 ? path.substring(1) : path;
};
/**
* @param {?} internal
* @return {?}
*/
HashLocationStrategy.prototype.prepareExternalUrl = function (internal) {
var /** @type {?} */ url = Location.joinWithSlash(this._baseHref, internal);
return url.length > 0 ? ('#' + url) : url;
};
/**
* @param {?} state
* @param {?} title
* @param {?} path
* @param {?} queryParams
* @return {?}
*/
HashLocationStrategy.prototype.pushState = function (state, title, path, queryParams) {
var /** @type {?} */ url = this.prepareExternalUrl(path + Location.normalizeQueryParams(queryParams));
if (url.length == 0) {
url = this._platformLocation.pathname;
}
this._platformLocation.pushState(state, title, url);
};
/**
* @param {?} state
* @param {?} title
* @param {?} path
* @param {?} queryParams
* @return {?}
*/
HashLocationStrategy.prototype.replaceState = function (state, title, path, queryParams) {
var /** @type {?} */ url = this.prepareExternalUrl(path + Location.normalizeQueryParams(queryParams));
if (url.length == 0) {
url = this._platformLocation.pathname;
}
this._platformLocation.replaceState(state, title, url);
};
/**
* @return {?}
*/
HashLocationStrategy.prototype.forward = function () { this._platformLocation.forward(); };
/**
* @return {?}
*/
HashLocationStrategy.prototype.back = function () { this._platformLocation.back(); };
HashLocationStrategy.decorators = [
{ type: _angular_core.Injectable },
];
/** @nocollapse */
HashLocationStrategy.ctorParameters = function () { return [
{ type: PlatformLocation, },
{ type: undefined, decorators: [{ type: _angular_core.Optional }, { type: _angular_core.Inject, args: [APP_BASE_HREF,] },] },
]; };
return HashLocationStrategy;
}(LocationStrategy));
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var __extends$1 = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
/**
* \@whatItDoes Use URL for storing application location data.
* \@description
* `PathLocationStrategy` is a {\@link LocationStrategy} used to configure the
* {\@link Location} service to represent its state in the
* [path](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax) of the
* browser's URL.
*
* If you're using `PathLocationStrategy`, you must provide a {\@link APP_BASE_HREF}
* or add a base element to the document. This URL prefix that will be preserved
* when generating and recognizing URLs.
*
* For instance, if you provide an `APP_BASE_HREF` of `'/my/app'` and call
* `location.go('/foo')`, the browser's URL will become
* `example.com/my/app/foo`.
*
* Similarly, if you add `` to the document and call
* `location.go('/foo')`, the browser's URL will become
* `example.com/my/app/foo`.
*
* ### Example
*
* {\@example common/location/ts/path_location_component.ts region='LocationComponent'}
*
* \@stable
*/
var PathLocationStrategy = (function (_super) {
__extends$1(PathLocationStrategy, _super);
/**
* @param {?} _platformLocation
* @param {?=} href
*/
function PathLocationStrategy(_platformLocation, href) {
_super.call(this);
this._platformLocation = _platformLocation;
if (isBlank(href)) {
href = this._platformLocation.getBaseHrefFromDOM();
}
if (isBlank(href)) {
throw new Error("No base href set. Please provide a value for the APP_BASE_HREF token or add a base element to the document.");
}
this._baseHref = href;
}
/**
* @param {?} fn
* @return {?}
*/
PathLocationStrategy.prototype.onPopState = function (fn) {
this._platformLocation.onPopState(fn);
this._platformLocation.onHashChange(fn);
};
/**
* @return {?}
*/
PathLocationStrategy.prototype.getBaseHref = function () { return this._baseHref; };
/**
* @param {?} internal
* @return {?}
*/
PathLocationStrategy.prototype.prepareExternalUrl = function (internal) {
return Location.joinWithSlash(this._baseHref, internal);
};
/**
* @param {?=} includeHash
* @return {?}
*/
PathLocationStrategy.prototype.path = function (includeHash) {
if (includeHash === void 0) { includeHash = false; }
var /** @type {?} */ pathname = this._platformLocation.pathname +
Location.normalizeQueryParams(this._platformLocation.search);
var /** @type {?} */ hash = this._platformLocation.hash;
return hash && includeHash ? "" + pathname + hash : pathname;
};
/**
* @param {?} state
* @param {?} title
* @param {?} url
* @param {?} queryParams
* @return {?}
*/
PathLocationStrategy.prototype.pushState = function (state, title, url, queryParams) {
var /** @type {?} */ externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams));
this._platformLocation.pushState(state, title, externalUrl);
};
/**
* @param {?} state
* @param {?} title
* @param {?} url
* @param {?} queryParams
* @return {?}
*/
PathLocationStrategy.prototype.replaceState = function (state, title, url, queryParams) {
var /** @type {?} */ externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams));
this._platformLocation.replaceState(state, title, externalUrl);
};
/**
* @return {?}
*/
PathLocationStrategy.prototype.forward = function () { this._platformLocation.forward(); };
/**
* @return {?}
*/
PathLocationStrategy.prototype.back = function () { this._platformLocation.back(); };
PathLocationStrategy.decorators = [
{ type: _angular_core.Injectable },
];
/** @nocollapse */
PathLocationStrategy.ctorParameters = function () { return [
{ type: PlatformLocation, },
{ type: undefined, decorators: [{ type: _angular_core.Optional }, { type: _angular_core.Inject, args: [APP_BASE_HREF,] },] },
]; };
return PathLocationStrategy;
}(LocationStrategy));
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var __extends$2 = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
/**
* \@experimental
* @abstract
*/
var NgLocalization = (function () {
function NgLocalization() {
}
/**
* @abstract
* @param {?} value
* @return {?}
*/
NgLocalization.prototype.getPluralCategory = function (value) { };
return NgLocalization;
}());
/**
* Returns the plural category for a given value.
* - "=value" when the case exists,
* - the plural category otherwise
*
* \@internal
* @param {?} value
* @param {?} cases
* @param {?} ngLocalization
* @return {?}
*/
function getPluralCategory(value, cases, ngLocalization) {
var /** @type {?} */ key = "=" + value;
if (cases.indexOf(key) > -1) {
return key;
}
key = ngLocalization.getPluralCategory(value);
if (cases.indexOf(key) > -1) {
return key;
}
if (cases.indexOf('other') > -1) {
return 'other';
}
throw new Error("No plural message found for value \"" + value + "\"");
}
/**
* Returns the plural case based on the locale
*
* \@experimental
*/
var NgLocaleLocalization = (function (_super) {
__extends$2(NgLocaleLocalization, _super);
/**
* @param {?} _locale
*/
function NgLocaleLocalization(_locale) {
_super.call(this);
this._locale = _locale;
}
/**
* @param {?} value
* @return {?}
*/
NgLocaleLocalization.prototype.getPluralCategory = function (value) {
var /** @type {?} */ plural = getPluralCase(this._locale, value);
switch (plural) {
case Plural.Zero:
return 'zero';
case Plural.One:
return 'one';
case Plural.Two:
return 'two';
case Plural.Few:
return 'few';
case Plural.Many:
return 'many';
default:
return 'other';
}
};
NgLocaleLocalization.decorators = [
{ type: _angular_core.Injectable },
];
/** @nocollapse */
NgLocaleLocalization.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_core.LOCALE_ID,] },] },
]; };
return NgLocaleLocalization;
}(NgLocalization));
var Plural = {};
Plural.Zero = 0;
Plural.One = 1;
Plural.Two = 2;
Plural.Few = 3;
Plural.Many = 4;
Plural.Other = 5;
Plural[Plural.Zero] = "Zero";
Plural[Plural.One] = "One";
Plural[Plural.Two] = "Two";
Plural[Plural.Few] = "Few";
Plural[Plural.Many] = "Many";
Plural[Plural.Other] = "Other";
/**
* Returns the plural case based on the locale
*
* \@experimental
* @param {?} locale
* @param {?} nLike
* @return {?}
*/
function getPluralCase(locale, nLike) {
// TODO(vicb): lazy compute
if (typeof nLike === 'string') {
nLike = parseInt(/** @type {?} */ (nLike), 10);
}
var /** @type {?} */ n = (nLike);
var /** @type {?} */ nDecimal = n.toString().replace(/^[^.]*\.?/, '');
var /** @type {?} */ i = Math.floor(Math.abs(n));
var /** @type {?} */ v = nDecimal.length;
var /** @type {?} */ f = parseInt(nDecimal, 10);
var /** @type {?} */ t = parseInt(n.toString().replace(/^[^.]*\.?|0+$/g, ''), 10) || 0;
var /** @type {?} */ lang = locale.split('-')[0].toLowerCase();
switch (lang) {
case 'af':
case 'asa':
case 'az':
case 'bem':
case 'bez':
case 'bg':
case 'brx':
case 'ce':
case 'cgg':
case 'chr':
case 'ckb':
case 'ee':
case 'el':
case 'eo':
case 'es':
case 'eu':
case 'fo':
case 'fur':
case 'gsw':
case 'ha':
case 'haw':
case 'hu':
case 'jgo':
case 'jmc':
case 'ka':
case 'kk':
case 'kkj':
case 'kl':
case 'ks':
case 'ksb':
case 'ky':
case 'lb':
case 'lg':
case 'mas':
case 'mgo':
case 'ml':
case 'mn':
case 'nb':
case 'nd':
case 'ne':
case 'nn':
case 'nnh':
case 'nyn':
case 'om':
case 'or':
case 'os':
case 'ps':
case 'rm':
case 'rof':
case 'rwk':
case 'saq':
case 'seh':
case 'sn':
case 'so':
case 'sq':
case 'ta':
case 'te':
case 'teo':
case 'tk':
case 'tr':
case 'ug':
case 'uz':
case 'vo':
case 'vun':
case 'wae':
case 'xog':
if (n === 1)
return Plural.One;
return Plural.Other;
case 'agq':
case 'bas':
case 'cu':
case 'dav':
case 'dje':
case 'dua':
case 'dyo':
case 'ebu':
case 'ewo':
case 'guz':
case 'kam':
case 'khq':
case 'ki':
case 'kln':
case 'kok':
case 'ksf':
case 'lrc':
case 'lu':
case 'luo':
case 'luy':
case 'mer':
case 'mfe':
case 'mgh':
case 'mua':
case 'mzn':
case 'nmg':
case 'nus':
case 'qu':
case 'rn':
case 'rw':
case 'sbp':
case 'twq':
case 'vai':
case 'yav':
case 'yue':
case 'zgh':
case 'ak':
case 'ln':
case 'mg':
case 'pa':
case 'ti':
if (n === Math.floor(n) && n >= 0 && n <= 1)
return Plural.One;
return Plural.Other;
case 'am':
case 'as':
case 'bn':
case 'fa':
case 'gu':
case 'hi':
case 'kn':
case 'mr':
case 'zu':
if (i === 0 || n === 1)
return Plural.One;
return Plural.Other;
case 'ar':
if (n === 0)
return Plural.Zero;
if (n === 1)
return Plural.One;
if (n === 2)
return Plural.Two;
if (n % 100 === Math.floor(n % 100) && n % 100 >= 3 && n % 100 <= 10)
return Plural.Few;
if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 99)
return Plural.Many;
return Plural.Other;
case 'ast':
case 'ca':
case 'de':
case 'en':
case 'et':
case 'fi':
case 'fy':
case 'gl':
case 'it':
case 'nl':
case 'sv':
case 'sw':
case 'ur':
case 'yi':
if (i === 1 && v === 0)
return Plural.One;
return Plural.Other;
case 'be':
if (n % 10 === 1 && !(n % 100 === 11))
return Plural.One;
if (n % 10 === Math.floor(n % 10) && n % 10 >= 2 && n % 10 <= 4 &&
!(n % 100 >= 12 && n % 100 <= 14))
return Plural.Few;
if (n % 10 === 0 || n % 10 === Math.floor(n % 10) && n % 10 >= 5 && n % 10 <= 9 ||
n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 14)
return Plural.Many;
return Plural.Other;
case 'br':
if (n % 10 === 1 && !(n % 100 === 11 || n % 100 === 71 || n % 100 === 91))
return Plural.One;
if (n % 10 === 2 && !(n % 100 === 12 || n % 100 === 72 || n % 100 === 92))
return Plural.Two;
if (n % 10 === Math.floor(n % 10) && (n % 10 >= 3 && n % 10 <= 4 || n % 10 === 9) &&
!(n % 100 >= 10 && n % 100 <= 19 || n % 100 >= 70 && n % 100 <= 79 ||
n % 100 >= 90 && n % 100 <= 99))
return Plural.Few;
if (!(n === 0) && n % 1e6 === 0)
return Plural.Many;
return Plural.Other;
case 'bs':
case 'hr':
case 'sr':
if (v === 0 && i % 10 === 1 && !(i % 100 === 11) || f % 10 === 1 && !(f % 100 === 11))
return Plural.One;
if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 &&
!(i % 100 >= 12 && i % 100 <= 14) ||
f % 10 === Math.floor(f % 10) && f % 10 >= 2 && f % 10 <= 4 &&
!(f % 100 >= 12 && f % 100 <= 14))
return Plural.Few;
return Plural.Other;
case 'cs':
case 'sk':
if (i === 1 && v === 0)
return Plural.One;
if (i === Math.floor(i) && i >= 2 && i <= 4 && v === 0)
return Plural.Few;
if (!(v === 0))
return Plural.Many;
return Plural.Other;
case 'cy':
if (n === 0)
return Plural.Zero;
if (n === 1)
return Plural.One;
if (n === 2)
return Plural.Two;
if (n === 3)
return Plural.Few;
if (n === 6)
return Plural.Many;
return Plural.Other;
case 'da':
if (n === 1 || !(t === 0) && (i === 0 || i === 1))
return Plural.One;
return Plural.Other;
case 'dsb':
case 'hsb':
if (v === 0 && i % 100 === 1 || f % 100 === 1)
return Plural.One;
if (v === 0 && i % 100 === 2 || f % 100 === 2)
return Plural.Two;
if (v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 3 && i % 100 <= 4 ||
f % 100 === Math.floor(f % 100) && f % 100 >= 3 && f % 100 <= 4)
return Plural.Few;
return Plural.Other;
case 'ff':
case 'fr':
case 'hy':
case 'kab':
if (i === 0 || i === 1)
return Plural.One;
return Plural.Other;
case 'fil':
if (v === 0 && (i === 1 || i === 2 || i === 3) ||
v === 0 && !(i % 10 === 4 || i % 10 === 6 || i % 10 === 9) ||
!(v === 0) && !(f % 10 === 4 || f % 10 === 6 || f % 10 === 9))
return Plural.One;
return Plural.Other;
case 'ga':
if (n === 1)
return Plural.One;
if (n === 2)
return Plural.Two;
if (n === Math.floor(n) && n >= 3 && n <= 6)
return Plural.Few;
if (n === Math.floor(n) && n >= 7 && n <= 10)
return Plural.Many;
return Plural.Other;
case 'gd':
if (n === 1 || n === 11)
return Plural.One;
if (n === 2 || n === 12)
return Plural.Two;
if (n === Math.floor(n) && (n >= 3 && n <= 10 || n >= 13 && n <= 19))
return Plural.Few;
return Plural.Other;
case 'gv':
if (v === 0 && i % 10 === 1)
return Plural.One;
if (v === 0 && i % 10 === 2)
return Plural.Two;
if (v === 0 &&
(i % 100 === 0 || i % 100 === 20 || i % 100 === 40 || i % 100 === 60 || i % 100 === 80))
return Plural.Few;
if (!(v === 0))
return Plural.Many;
return Plural.Other;
case 'he':
if (i === 1 && v === 0)
return Plural.One;
if (i === 2 && v === 0)
return Plural.Two;
if (v === 0 && !(n >= 0 && n <= 10) && n % 10 === 0)
return Plural.Many;
return Plural.Other;
case 'is':
if (t === 0 && i % 10 === 1 && !(i % 100 === 11) || !(t === 0))
return Plural.One;
return Plural.Other;
case 'ksh':
if (n === 0)
return Plural.Zero;
if (n === 1)
return Plural.One;
return Plural.Other;
case 'kw':
case 'naq':
case 'se':
case 'smn':
if (n === 1)
return Plural.One;
if (n === 2)
return Plural.Two;
return Plural.Other;
case 'lag':
if (n === 0)
return Plural.Zero;
if ((i === 0 || i === 1) && !(n === 0))
return Plural.One;
return Plural.Other;
case 'lt':
if (n % 10 === 1 && !(n % 100 >= 11 && n % 100 <= 19))
return Plural.One;
if (n % 10 === Math.floor(n % 10) && n % 10 >= 2 && n % 10 <= 9 &&
!(n % 100 >= 11 && n % 100 <= 19))
return Plural.Few;
if (!(f === 0))
return Plural.Many;
return Plural.Other;
case 'lv':
case 'prg':
if (n % 10 === 0 || n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 19 ||
v === 2 && f % 100 === Math.floor(f % 100) && f % 100 >= 11 && f % 100 <= 19)
return Plural.Zero;
if (n % 10 === 1 && !(n % 100 === 11) || v === 2 && f % 10 === 1 && !(f % 100 === 11) ||
!(v === 2) && f % 10 === 1)
return Plural.One;
return Plural.Other;
case 'mk':
if (v === 0 && i % 10 === 1 || f % 10 === 1)
return Plural.One;
return Plural.Other;
case 'mt':
if (n === 1)
return Plural.One;
if (n === 0 || n % 100 === Math.floor(n % 100) && n % 100 >= 2 && n % 100 <= 10)
return Plural.Few;
if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 19)
return Plural.Many;
return Plural.Other;
case 'pl':
if (i === 1 && v === 0)
return Plural.One;
if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 &&
!(i % 100 >= 12 && i % 100 <= 14))
return Plural.Few;
if (v === 0 && !(i === 1) && i % 10 === Math.floor(i % 10) && i % 10 >= 0 && i % 10 <= 1 ||
v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 5 && i % 10 <= 9 ||
v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 12 && i % 100 <= 14)
return Plural.Many;
return Plural.Other;
case 'pt':
if (n === Math.floor(n) && n >= 0 && n <= 2 && !(n === 2))
return Plural.One;
return Plural.Other;
case 'ro':
if (i === 1 && v === 0)
return Plural.One;
if (!(v === 0) || n === 0 ||
!(n === 1) && n % 100 === Math.floor(n % 100) && n % 100 >= 1 && n % 100 <= 19)
return Plural.Few;
return Plural.Other;
case 'ru':
case 'uk':
if (v === 0 && i % 10 === 1 && !(i % 100 === 11))
return Plural.One;
if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 &&
!(i % 100 >= 12 && i % 100 <= 14))
return Plural.Few;
if (v === 0 && i % 10 === 0 ||
v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 5 && i % 10 <= 9 ||
v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 11 && i % 100 <= 14)
return Plural.Many;
return Plural.Other;
case 'shi':
if (i === 0 || n === 1)
return Plural.One;
if (n === Math.floor(n) && n >= 2 && n <= 10)
return Plural.Few;
return Plural.Other;
case 'si':
if (n === 0 || n === 1 || i === 0 && f === 1)
return Plural.One;
return Plural.Other;
case 'sl':
if (v === 0 && i % 100 === 1)
return Plural.One;
if (v === 0 && i % 100 === 2)
return Plural.Two;
if (v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 3 && i % 100 <= 4 || !(v === 0))
return Plural.Few;
return Plural.Other;
case 'tzm':
if (n === Math.floor(n) && n >= 0 && n <= 1 || n === Math.floor(n) && n >= 11 && n <= 99)
return Plural.One;
return Plural.Other;
default:
return Plural.Other;
}
}
/**
* @param {?} obj
* @return {?}
*/
function isListLikeIterable(obj) {
if (!isJsObject(obj))
return false;
return Array.isArray(obj) ||
(!(obj instanceof Map) &&
getSymbolIterator() in obj); // JS Iterable have a Symbol.iterator prop
}
/**
* \@ngModule CommonModule
*
* \@whatItDoes Adds and removes CSS classes on an HTML element.
*
* \@howToUse
* ```
* ...
*
* ...
*
* ...
*
* ...
*
* ...
* ```
*
* \@description
*
* The CSS classes are updated as follows, depending on the type of the expression evaluation:
* - `string` - the CSS classes listed in the string (space delimited) are added,
* - `Array` - the CSS classes declared as Array elements are added,
* - `Object` - keys are CSS classes that get added when the expression given in the value
* evaluates to a truthy value, otherwise they are removed.
*
* \@stable
*/
var NgClass = (function () {
/**
* @param {?} _iterableDiffers
* @param {?} _keyValueDiffers
* @param {?} _ngEl
* @param {?} _renderer
*/
function NgClass(_iterableDiffers, _keyValueDiffers, _ngEl, _renderer) {
this._iterableDiffers = _iterableDiffers;
this._keyValueDiffers = _keyValueDiffers;
this._ngEl = _ngEl;
this._renderer = _renderer;
this._initialClasses = [];
}
Object.defineProperty(NgClass.prototype, "klass", {
/**
* @param {?} v
* @return {?}
*/
set: function (v) {
this._applyInitialClasses(true);
this._initialClasses = typeof v === 'string' ? v.split(/\s+/) : [];
this._applyInitialClasses(false);
this._applyClasses(this._rawClass, false);
},
enumerable: true,
configurable: true
});
Object.defineProperty(NgClass.prototype, "ngClass", {
/**
* @param {?} v
* @return {?}
*/
set: function (v) {
this._cleanupClasses(this._rawClass);
this._iterableDiffer = null;
this._keyValueDiffer = null;
this._rawClass = typeof v === 'string' ? v.split(/\s+/) : v;
if (this._rawClass) {
if (isListLikeIterable(this._rawClass)) {
this._iterableDiffer = this._iterableDiffers.find(this._rawClass).create(null);
}
else {
this._keyValueDiffer = this._keyValueDiffers.find(this._rawClass).create(null);
}
}
},
enumerable: true,
configurable: true
});
/**
* @return {?}
*/
NgClass.prototype.ngDoCheck = function () {
if (this._iterableDiffer) {
var /** @type {?} */ changes = this._iterableDiffer.diff(this._rawClass);
if (changes) {
this._applyIterableChanges(changes);
}
}
else if (this._keyValueDiffer) {
var /** @type {?} */ changes = this._keyValueDiffer.diff(this._rawClass);
if (changes) {
this._applyKeyValueChanges(changes);
}
}
};
/**
* @param {?} rawClassVal
* @return {?}
*/
NgClass.prototype._cleanupClasses = function (rawClassVal) {
this._applyClasses(rawClassVal, true);
this._applyInitialClasses(false);
};
/**
* @param {?} changes
* @return {?}
*/
NgClass.prototype._applyKeyValueChanges = function (changes) {
var _this = this;
changes.forEachAddedItem(function (record) { return _this._toggleClass(record.key, record.currentValue); });
changes.forEachChangedItem(function (record) { return _this._toggleClass(record.key, record.currentValue); });
changes.forEachRemovedItem(function (record) {
if (record.previousValue) {
_this._toggleClass(record.key, false);
}
});
};
/**
* @param {?} changes
* @return {?}
*/
NgClass.prototype._applyIterableChanges = function (changes) {
var _this = this;
changes.forEachAddedItem(function (record) {
if (typeof record.item === 'string') {
_this._toggleClass(record.item, true);
}
else {
throw new Error("NgClass can only toggle CSS classes expressed as strings, got " + stringify(record.item));
}
});
changes.forEachRemovedItem(function (record) { return _this._toggleClass(record.item, false); });
};
/**
* @param {?} isCleanup
* @return {?}
*/
NgClass.prototype._applyInitialClasses = function (isCleanup) {
var _this = this;
this._initialClasses.forEach(function (klass) { return _this._toggleClass(klass, !isCleanup); });
};
/**
* @param {?} rawClassVal
* @param {?} isCleanup
* @return {?}
*/
NgClass.prototype._applyClasses = function (rawClassVal, isCleanup) {
var _this = this;
if (rawClassVal) {
if (Array.isArray(rawClassVal) || rawClassVal instanceof Set) {
((rawClassVal)).forEach(function (klass) { return _this._toggleClass(klass, !isCleanup); });
}
else {
Object.keys(rawClassVal).forEach(function (klass) {
if (rawClassVal[klass] != null)
_this._toggleClass(klass, !isCleanup);
});
}
}
};
/**
* @param {?} klass
* @param {?} enabled
* @return {?}
*/
NgClass.prototype._toggleClass = function (klass, enabled) {
var _this = this;
klass = klass.trim();
if (klass) {
klass.split(/\s+/g).forEach(function (klass) { _this._renderer.setElementClass(_this._ngEl.nativeElement, klass, enabled); });
}
};
NgClass.decorators = [
{ type: _angular_core.Directive, args: [{ selector: '[ngClass]' },] },
];
/** @nocollapse */
NgClass.ctorParameters = function () { return [
{ type: _angular_core.IterableDiffers, },
{ type: _angular_core.KeyValueDiffers, },
{ type: _angular_core.ElementRef, },
{ type: _angular_core.Renderer, },
]; };
NgClass.propDecorators = {
'klass': [{ type: _angular_core.Input, args: ['class',] },],
'ngClass': [{ type: _angular_core.Input },],
};
return NgClass;
}());
var NgForRow = (function () {
/**
* @param {?} $implicit
* @param {?} index
* @param {?} count
*/
function NgForRow($implicit, index, count) {
this.$implicit = $implicit;
this.index = index;
this.count = count;
}
Object.defineProperty(NgForRow.prototype, "first", {
/**
* @return {?}
*/
get: function () { return this.index === 0; },
enumerable: true,
configurable: true
});
Object.defineProperty(NgForRow.prototype, "last", {
/**
* @return {?}
*/
get: function () { return this.index === this.count - 1; },
enumerable: true,
configurable: true
});
Object.defineProperty(NgForRow.prototype, "even", {
/**
* @return {?}
*/
get: function () { return this.index % 2 === 0; },
enumerable: true,
configurable: true
});
Object.defineProperty(NgForRow.prototype, "odd", {
/**
* @return {?}
*/
get: function () { return !this.even; },
enumerable: true,
configurable: true
});
return NgForRow;
}());
/**
* The `NgFor` directive instantiates a template once per item from an iterable. The context for
* each instantiated template inherits from the outer context with the given loop variable set
* to the current item from the iterable.
*
* ### Local Variables
*
* `NgFor` provides several exported values that can be aliased to local variables:
*
* * `index` will be set to the current loop iteration for each template context.
* * `first` will be set to a boolean value indicating whether the item is the first one in the
* iteration.
* * `last` will be set to a boolean value indicating whether the item is the last one in the
* iteration.
* * `even` will be set to a boolean value indicating whether this item has an even index.
* * `odd` will be set to a boolean value indicating whether this item has an odd index.
*
* ### Change Propagation
*
* When the contents of the iterator changes, `NgFor` makes the corresponding changes to the DOM:
*
* * When an item is added, a new instance of the template is added to the DOM.
* * When an item is removed, its template instance is removed from the DOM.
* * When items are reordered, their respective templates are reordered in the DOM.
* * Otherwise, the DOM element for that item will remain the same.
*
* Angular uses object identity to track insertions and deletions within the iterator and reproduce
* those changes in the DOM. This has important implications for animations and any stateful
* controls
* (such as `` elements which accept user input) that are present. Inserted rows can be
* animated in, deleted rows can be animated out, and unchanged rows retain any unsaved state such
* as user input.
*
* It is possible for the identities of elements in the iterator to change while the data does not.
* This can happen, for example, if the iterator produced from an RPC to the server, and that
* RPC is re-run. Even if the data hasn't changed, the second response will produce objects with
* different identities, and Angular will tear down the entire DOM and rebuild it (as if all old
* elements were deleted and all new elements inserted). This is an expensive operation and should
* be avoided if possible.
*
* To customize the default tracking algorithm, `NgFor` supports `trackBy` option.
* `trackBy` takes a function which has two arguments: `index` and `item`.
* If `trackBy` is given, Angular tracks changes by the return value of the function.
*
* ### Syntax
*
* - `
...
`
* - `
...
`
*
* With `` element:
*
* ```
*
*
...
*
* ```
*
* ### Example
*
* See a [live demo](http://plnkr.co/edit/KVuXxDp0qinGDyo307QW?p=preview) for a more detailed
* example.
*
* \@stable
*/
var NgFor = (function () {
/**
* @param {?} _viewContainer
* @param {?} _template
* @param {?} _differs
* @param {?} _cdr
*/
function NgFor(_viewContainer, _template, _differs, _cdr) {
this._viewContainer = _viewContainer;
this._template = _template;
this._differs = _differs;
this._cdr = _cdr;
this._differ = null;
}
Object.defineProperty(NgFor.prototype, "ngForTrackBy", {
/**
* @return {?}
*/
get: function () { return this._trackByFn; },
/**
* @param {?} fn
* @return {?}
*/
set: function (fn) {
if (_angular_core.isDevMode() && fn != null && typeof fn !== 'function') {
// TODO(vicb): use a log service once there is a public one available
if ((console) && (console.warn)) {
console.warn(("trackBy must be a function, but received " + JSON.stringify(fn) + ". ") +
"See https://angular.io/docs/ts/latest/api/common/index/NgFor-directive.html#!#change-propagation for more information.");
}
}
this._trackByFn = fn;
},
enumerable: true,
configurable: true
});
Object.defineProperty(NgFor.prototype, "ngForTemplate", {
/**
* @param {?} value
* @return {?}
*/
set: function (value) {
if (value) {
this._template = value;
}
},
enumerable: true,
configurable: true
});
/**
* @param {?} changes
* @return {?}
*/
NgFor.prototype.ngOnChanges = function (changes) {
if ('ngForOf' in changes) {
// React on ngForOf changes only once all inputs have been initialized
var /** @type {?} */ value = changes['ngForOf'].currentValue;
if (!this._differ && value) {
try {
this._differ = this._differs.find(value).create(this._cdr, this.ngForTrackBy);
}
catch (e) {
throw new Error("Cannot find a differ supporting object '" + value + "' of type '" + getTypeNameForDebugging(value) + "'. NgFor only supports binding to Iterables such as Arrays.");
}
}
}
};
/**
* @return {?}
*/
NgFor.prototype.ngDoCheck = function () {
if (this._differ) {
var /** @type {?} */ changes = this._differ.diff(this.ngForOf);
if (changes)
this._applyChanges(changes);
}
};
/**
* @param {?} changes
* @return {?}
*/
NgFor.prototype._applyChanges = function (changes) {
var _this = this;
var /** @type {?} */ insertTuples = [];
changes.forEachOperation(function (item, adjustedPreviousIndex, currentIndex) {
if (item.previousIndex == null) {
var /** @type {?} */ view = _this._viewContainer.createEmbeddedView(_this._template, new NgForRow(null, null, null), currentIndex);
var /** @type {?} */ tuple = new RecordViewTuple(item, view);
insertTuples.push(tuple);
}
else if (currentIndex == null) {
_this._viewContainer.remove(adjustedPreviousIndex);
}
else {
var /** @type {?} */ view = _this._viewContainer.get(adjustedPreviousIndex);
_this._viewContainer.move(view, currentIndex);
var /** @type {?} */ tuple = new RecordViewTuple(item, /** @type {?} */ (view));
insertTuples.push(tuple);
}
});
for (var /** @type {?} */ i = 0; i < insertTuples.length; i++) {
this._perViewChange(insertTuples[i].view, insertTuples[i].record);
}
for (var /** @type {?} */ i = 0, /** @type {?} */ ilen = this._viewContainer.length; i < ilen; i++) {
var /** @type {?} */ viewRef = (this._viewContainer.get(i));
viewRef.context.index = i;
viewRef.context.count = ilen;
}
changes.forEachIdentityChange(function (record) {
var /** @type {?} */ viewRef = (_this._viewContainer.get(record.currentIndex));
viewRef.context.$implicit = record.item;
});
};
/**
* @param {?} view
* @param {?} record
* @return {?}
*/
NgFor.prototype._perViewChange = function (view, record) {
view.context.$implicit = record.item;
};
NgFor.decorators = [
{ type: _angular_core.Directive, args: [{ selector: '[ngFor][ngForOf]' },] },
];
/** @nocollapse */
NgFor.ctorParameters = function () { return [
{ type: _angular_core.ViewContainerRef, },
{ type: _angular_core.TemplateRef, },
{ type: _angular_core.IterableDiffers, },
{ type: _angular_core.ChangeDetectorRef, },
]; };
NgFor.propDecorators = {
'ngForOf': [{ type: _angular_core.Input },],
'ngForTrackBy': [{ type: _angular_core.Input },],
'ngForTemplate': [{ type: _angular_core.Input },],
};
return NgFor;
}());
var RecordViewTuple = (function () {
/**
* @param {?} record
* @param {?} view
*/
function RecordViewTuple(record, view) {
this.record = record;
this.view = view;
}
return RecordViewTuple;
}());
/**
* Removes or recreates a portion of the DOM tree based on an {expression}.
*
* If the expression assigned to `ngIf` evaluates to a falsy value then the element
* is removed from the DOM, otherwise a clone of the element is reinserted into the DOM.
*
* ### Example ([live demo](http://plnkr.co/edit/fe0kgemFBtmQOY31b4tw?p=preview)):
*
* ```
*