Project

General

Profile

1
import * as tslib_1 from "tslib";
2
/**
3
 * @license Angular v4.4.6
4
 * (c) 2010-2017 Google, Inc. https://angular.io/
5
 * License: MIT
6
 */
7
import { Attribute, ChangeDetectorRef, ComponentFactoryResolver, Directive, ElementRef, EventEmitter, Host, Inject, Injectable, InjectionToken, Input, IterableDiffers, KeyValueDiffers, LOCALE_ID, NgModule, NgModuleRef, Optional, Pipe, Renderer, TemplateRef, Version, ViewContainerRef, WrappedValue, isDevMode, ɵisListLikeIterable, ɵisObservable, ɵisPromise, ɵstringify } from '@angular/core';
8
/**
9
 * @license
10
 * Copyright Google Inc. All Rights Reserved.
11
 *
12
 * Use of this source code is governed by an MIT-style license that can be
13
 * found in the LICENSE file at https://angular.io/license
14
 */
15
/**
16
 * This class should not be used directly by an application developer. Instead, use
17
 * {\@link Location}.
18
 *
19
 * `PlatformLocation` encapsulates all calls to DOM apis, which allows the Router to be platform
20
 * agnostic.
21
 * This means that we can have different implementation of `PlatformLocation` for the different
22
 * platforms that angular supports. For example, `\@angular/platform-browser` provides an
23
 * implementation specific to the browser environment, while `\@angular/platform-webworker` provides
24
 * one suitable for use with web workers.
25
 *
26
 * The `PlatformLocation` class is used directly by all implementations of {\@link LocationStrategy}
27
 * when they need to interact with the DOM apis like pushState, popState, etc...
28
 *
29
 * {\@link LocationStrategy} in turn is used by the {\@link Location} service which is used directly
30
 * by the {\@link Router} in order to navigate between routes. Since all interactions between {\@link
31
 * Router} /
32
 * {\@link Location} / {\@link LocationStrategy} and DOM apis flow through the `PlatformLocation`
33
 * class they are all platform independent.
34
 *
35
 * \@stable
36
 * @abstract
37
 */
38
var PlatformLocation = (function () {
39
    function PlatformLocation() {
40
    }
41
    /**
42
     * @abstract
43
     * @return {?}
44
     */
45
    PlatformLocation.prototype.getBaseHrefFromDOM = function () { };
46
    /**
47
     * @abstract
48
     * @param {?} fn
49
     * @return {?}
50
     */
51
    PlatformLocation.prototype.onPopState = function (fn) { };
52
    /**
53
     * @abstract
54
     * @param {?} fn
55
     * @return {?}
56
     */
57
    PlatformLocation.prototype.onHashChange = function (fn) { };
58
    /**
59
     * @abstract
60
     * @return {?}
61
     */
62
    PlatformLocation.prototype.pathname = function () { };
63
    /**
64
     * @abstract
65
     * @return {?}
66
     */
67
    PlatformLocation.prototype.search = function () { };
68
    /**
69
     * @abstract
70
     * @return {?}
71
     */
72
    PlatformLocation.prototype.hash = function () { };
73
    /**
74
     * @abstract
75
     * @param {?} state
76
     * @param {?} title
77
     * @param {?} url
78
     * @return {?}
79
     */
80
    PlatformLocation.prototype.replaceState = function (state, title, url) { };
81
    /**
82
     * @abstract
83
     * @param {?} state
84
     * @param {?} title
85
     * @param {?} url
86
     * @return {?}
87
     */
88
    PlatformLocation.prototype.pushState = function (state, title, url) { };
89
    /**
90
     * @abstract
91
     * @return {?}
92
     */
93
    PlatformLocation.prototype.forward = function () { };
94
    /**
95
     * @abstract
96
     * @return {?}
97
     */
98
    PlatformLocation.prototype.back = function () { };
99
    return PlatformLocation;
100
}());
101
/**
102
 * \@whatItDoes indicates when a location is initialized
103
 * \@experimental
104
 */
105
var LOCATION_INITIALIZED = new InjectionToken('Location Initialized');
106
/**
107
 * @license
108
 * Copyright Google Inc. All Rights Reserved.
109
 *
110
 * Use of this source code is governed by an MIT-style license that can be
111
 * found in the LICENSE file at https://angular.io/license
112
 */
113
/**
114
 * `LocationStrategy` is responsible for representing and reading route state
115
 * from the browser's URL. Angular provides two strategies:
116
 * {\@link HashLocationStrategy} and {\@link PathLocationStrategy}.
117
 *
118
 * This is used under the hood of the {\@link Location} service.
119
 *
120
 * Applications should use the {\@link Router} or {\@link Location} services to
121
 * interact with application route state.
122
 *
123
 * For instance, {\@link HashLocationStrategy} produces URLs like
124
 * `http://example.com#/foo`, and {\@link PathLocationStrategy} produces
125
 * `http://example.com/foo` as an equivalent URL.
126
 *
127
 * See these two classes for more.
128
 *
129
 * \@stable
130
 * @abstract
131
 */
132
var LocationStrategy = (function () {
133
    function LocationStrategy() {
134
    }
135
    /**
136
     * @abstract
137
     * @param {?=} includeHash
138
     * @return {?}
139
     */
140
    LocationStrategy.prototype.path = function (includeHash) { };
141
    /**
142
     * @abstract
143
     * @param {?} internal
144
     * @return {?}
145
     */
146
    LocationStrategy.prototype.prepareExternalUrl = function (internal) { };
147
    /**
148
     * @abstract
149
     * @param {?} state
150
     * @param {?} title
151
     * @param {?} url
152
     * @param {?} queryParams
153
     * @return {?}
154
     */
155
    LocationStrategy.prototype.pushState = function (state, title, url, queryParams) { };
156
    /**
157
     * @abstract
158
     * @param {?} state
159
     * @param {?} title
160
     * @param {?} url
161
     * @param {?} queryParams
162
     * @return {?}
163
     */
164
    LocationStrategy.prototype.replaceState = function (state, title, url, queryParams) { };
165
    /**
166
     * @abstract
167
     * @return {?}
168
     */
169
    LocationStrategy.prototype.forward = function () { };
170
    /**
171
     * @abstract
172
     * @return {?}
173
     */
174
    LocationStrategy.prototype.back = function () { };
175
    /**
176
     * @abstract
177
     * @param {?} fn
178
     * @return {?}
179
     */
180
    LocationStrategy.prototype.onPopState = function (fn) { };
181
    /**
182
     * @abstract
183
     * @return {?}
184
     */
185
    LocationStrategy.prototype.getBaseHref = function () { };
186
    return LocationStrategy;
187
}());
188
/**
189
 * The `APP_BASE_HREF` token represents the base href to be used with the
190
 * {\@link PathLocationStrategy}.
191
 *
192
 * If you're using {\@link PathLocationStrategy}, you must provide a provider to a string
193
 * representing the URL prefix that should be preserved when generating and recognizing
194
 * URLs.
195
 *
196
 * ### Example
197
 *
198
 * ```typescript
199
 * import {Component, NgModule} from '\@angular/core';
200
 * import {APP_BASE_HREF} from '\@angular/common';
201
 *
202
 * \@NgModule({
203
 *   providers: [{provide: APP_BASE_HREF, useValue: '/my/app'}]
204
 * })
205
 * class AppModule {}
206
 * ```
207
 *
208
 * \@stable
209
 */
210
var APP_BASE_HREF = new InjectionToken('appBaseHref');
211
/**
212
 * @license
213
 * Copyright Google Inc. All Rights Reserved.
214
 *
215
 * Use of this source code is governed by an MIT-style license that can be
216
 * found in the LICENSE file at https://angular.io/license
217
 */
218
/**
219
 * \@whatItDoes `Location` is a service that applications can use to interact with a browser's URL.
220
 * \@description
221
 * Depending on which {\@link LocationStrategy} is used, `Location` will either persist
222
 * to the URL's path or the URL's hash segment.
223
 *
224
 * Note: it's better to use {\@link Router#navigate} service to trigger route changes. Use
225
 * `Location` only if you need to interact with or create normalized URLs outside of
226
 * routing.
227
 *
228
 * `Location` is responsible for normalizing the URL against the application's base href.
229
 * A normalized URL is absolute from the URL host, includes the application's base href, and has no
230
 * trailing slash:
231
 * - `/my/app/user/123` is normalized
232
 * - `my/app/user/123` **is not** normalized
233
 * - `/my/app/user/123/` **is not** normalized
234
 *
235
 * ### Example
236
 * {\@example common/location/ts/path_location_component.ts region='LocationComponent'}
237
 * \@stable
238
 */
239
var Location = (function () {
240
    /**
241
     * @param {?} platformStrategy
242
     */
243
    function Location(platformStrategy) {
244
        var _this = this;
245
        /**
246
         * \@internal
247
         */
248
        this._subject = new EventEmitter();
249
        this._platformStrategy = platformStrategy;
250
        var browserBaseHref = this._platformStrategy.getBaseHref();
251
        this._baseHref = Location.stripTrailingSlash(_stripIndexHtml(browserBaseHref));
252
        this._platformStrategy.onPopState(function (ev) {
253
            _this._subject.emit({
254
                'url': _this.path(true),
255
                'pop': true,
256
                'type': ev.type,
257
            });
258
        });
259
    }
260
    /**
261
     * @param {?=} includeHash
262
     * @return {?}
263
     */
264
    Location.prototype.path = function (includeHash) {
265
        if (includeHash === void 0) { includeHash = false; }
266
        return this.normalize(this._platformStrategy.path(includeHash));
267
    };
268
    /**
269
     * Normalizes the given path and compares to the current normalized path.
270
     * @param {?} path
271
     * @param {?=} query
272
     * @return {?}
273
     */
274
    Location.prototype.isCurrentPathEqualTo = function (path, query) {
275
        if (query === void 0) { query = ''; }
276
        return this.path() == this.normalize(path + Location.normalizeQueryParams(query));
277
    };
278
    /**
279
     * Given a string representing a URL, returns the normalized URL path without leading or
280
     * trailing slashes.
281
     * @param {?} url
282
     * @return {?}
283
     */
284
    Location.prototype.normalize = function (url) {
285
        return Location.stripTrailingSlash(_stripBaseHref(this._baseHref, _stripIndexHtml(url)));
286
    };
287
    /**
288
     * Given a string representing a URL, returns the platform-specific external URL path.
289
     * If the given URL doesn't begin with a leading slash (`'/'`), this method adds one
290
     * before normalizing. This method will also add a hash if `HashLocationStrategy` is
291
     * used, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use.
292
     * @param {?} url
293
     * @return {?}
294
     */
295
    Location.prototype.prepareExternalUrl = function (url) {
296
        if (url && url[0] !== '/') {
297
            url = '/' + url;
298
        }
299
        return this._platformStrategy.prepareExternalUrl(url);
300
    };
301
    /**
302
     * Changes the browsers URL to the normalized version of the given URL, and pushes a
303
     * new item onto the platform's history.
304
     * @param {?} path
305
     * @param {?=} query
306
     * @return {?}
307
     */
308
    Location.prototype.go = function (path, query) {
309
        if (query === void 0) { query = ''; }
310
        this._platformStrategy.pushState(null, '', path, query);
311
    };
312
    /**
313
     * Changes the browsers URL to the normalized version of the given URL, and replaces
314
     * the top item on the platform's history stack.
315
     * @param {?} path
316
     * @param {?=} query
317
     * @return {?}
318
     */
319
    Location.prototype.replaceState = function (path, query) {
320
        if (query === void 0) { query = ''; }
321
        this._platformStrategy.replaceState(null, '', path, query);
322
    };
323
    /**
324
     * Navigates forward in the platform's history.
325
     * @return {?}
326
     */
327
    Location.prototype.forward = function () { this._platformStrategy.forward(); };
328
    /**
329
     * Navigates back in the platform's history.
330
     * @return {?}
331
     */
332
    Location.prototype.back = function () { this._platformStrategy.back(); };
333
    /**
334
     * Subscribe to the platform's `popState` events.
335
     * @param {?} onNext
336
     * @param {?=} onThrow
337
     * @param {?=} onReturn
338
     * @return {?}
339
     */
340
    Location.prototype.subscribe = function (onNext, onThrow, onReturn) {
341
        return this._subject.subscribe({ next: onNext, error: onThrow, complete: onReturn });
342
    };
343
    /**
344
     * Given a string of url parameters, prepend with '?' if needed, otherwise return parameters as
345
     * is.
346
     * @param {?} params
347
     * @return {?}
348
     */
349
    Location.normalizeQueryParams = function (params) {
350
        return params && params[0] !== '?' ? '?' + params : params;
351
    };
352
    /**
353
     * Given 2 parts of a url, join them with a slash if needed.
354
     * @param {?} start
355
     * @param {?} end
356
     * @return {?}
357
     */
358
    Location.joinWithSlash = function (start, end) {
359
        if (start.length == 0) {
360
            return end;
361
        }
362
        if (end.length == 0) {
363
            return start;
364
        }
365
        var /** @type {?} */ slashes = 0;
366
        if (start.endsWith('/')) {
367
            slashes++;
368
        }
369
        if (end.startsWith('/')) {
370
            slashes++;
371
        }
372
        if (slashes == 2) {
373
            return start + end.substring(1);
374
        }
375
        if (slashes == 1) {
376
            return start + end;
377
        }
378
        return start + '/' + end;
379
    };
380
    /**
381
     * If url has a trailing slash, remove it, otherwise return url as is. This
382
     * method looks for the first occurence of either #, ?, or the end of the
383
     * line as `/` characters after any of these should not be replaced.
384
     * @param {?} url
385
     * @return {?}
386
     */
387
    Location.stripTrailingSlash = function (url) {
388
        var /** @type {?} */ match = url.match(/#|\?|$/);
389
        var /** @type {?} */ pathEndIdx = match && match.index || url.length;
390
        var /** @type {?} */ droppedSlashIdx = pathEndIdx - (url[pathEndIdx - 1] === '/' ? 1 : 0);
391
        return url.slice(0, droppedSlashIdx) + url.slice(pathEndIdx);
392
    };
393
    return Location;
394
}());
395
Location.decorators = [
396
    { type: Injectable },
397
];
398
/**
399
 * @nocollapse
400
 */
401
Location.ctorParameters = function () { return [
402
    { type: LocationStrategy, },
403
]; };
404
/**
405
 * @param {?} baseHref
406
 * @param {?} url
407
 * @return {?}
408
 */
409
function _stripBaseHref(baseHref, url) {
410
    return baseHref && url.startsWith(baseHref) ? url.substring(baseHref.length) : url;
411
}
412
/**
413
 * @param {?} url
414
 * @return {?}
415
 */
416
function _stripIndexHtml(url) {
417
    return url.replace(/\/index.html$/, '');
418
}
419
/**
420
 * @license
421
 * Copyright Google Inc. All Rights Reserved.
422
 *
423
 * Use of this source code is governed by an MIT-style license that can be
424
 * found in the LICENSE file at https://angular.io/license
425
 */
426
/**
427
 * \@whatItDoes Use URL hash for storing application location data.
428
 * \@description
429
 * `HashLocationStrategy` is a {\@link LocationStrategy} used to configure the
430
 * {\@link Location} service to represent its state in the
431
 * [hash fragment](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax)
432
 * of the browser's URL.
433
 *
434
 * For instance, if you call `location.go('/foo')`, the browser's URL will become
435
 * `example.com#/foo`.
436
 *
437
 * ### Example
438
 *
439
 * {\@example common/location/ts/hash_location_component.ts region='LocationComponent'}
440
 *
441
 * \@stable
442
 */
443
var HashLocationStrategy = (function (_super) {
444
    tslib_1.__extends(HashLocationStrategy, _super);
445
    /**
446
     * @param {?} _platformLocation
447
     * @param {?=} _baseHref
448
     */
449
    function HashLocationStrategy(_platformLocation, _baseHref) {
450
        var _this = _super.call(this) || this;
451
        _this._platformLocation = _platformLocation;
452
        _this._baseHref = '';
453
        if (_baseHref != null) {
454
            _this._baseHref = _baseHref;
455
        }
456
        return _this;
457
    }
458
    /**
459
     * @param {?} fn
460
     * @return {?}
461
     */
462
    HashLocationStrategy.prototype.onPopState = function (fn) {
463
        this._platformLocation.onPopState(fn);
464
        this._platformLocation.onHashChange(fn);
465
    };
466
    /**
467
     * @return {?}
468
     */
469
    HashLocationStrategy.prototype.getBaseHref = function () { return this._baseHref; };
470
    /**
471
     * @param {?=} includeHash
472
     * @return {?}
473
     */
474
    HashLocationStrategy.prototype.path = function (includeHash) {
475
        if (includeHash === void 0) { includeHash = false; }
476
        // the hash value is always prefixed with a `#`
477
        // and if it is empty then it will stay empty
478
        var /** @type {?} */ path = this._platformLocation.hash;
479
        if (path == null)
480
            path = '#';
481
        return path.length > 0 ? path.substring(1) : path;
482
    };
483
    /**
484
     * @param {?} internal
485
     * @return {?}
486
     */
487
    HashLocationStrategy.prototype.prepareExternalUrl = function (internal) {
488
        var /** @type {?} */ url = Location.joinWithSlash(this._baseHref, internal);
489
        return url.length > 0 ? ('#' + url) : url;
490
    };
491
    /**
492
     * @param {?} state
493
     * @param {?} title
494
     * @param {?} path
495
     * @param {?} queryParams
496
     * @return {?}
497
     */
498
    HashLocationStrategy.prototype.pushState = function (state, title, path, queryParams) {
499
        var /** @type {?} */ url = this.prepareExternalUrl(path + Location.normalizeQueryParams(queryParams));
500
        if (url.length == 0) {
501
            url = this._platformLocation.pathname;
502
        }
503
        this._platformLocation.pushState(state, title, url);
504
    };
505
    /**
506
     * @param {?} state
507
     * @param {?} title
508
     * @param {?} path
509
     * @param {?} queryParams
510
     * @return {?}
511
     */
512
    HashLocationStrategy.prototype.replaceState = function (state, title, path, queryParams) {
513
        var /** @type {?} */ url = this.prepareExternalUrl(path + Location.normalizeQueryParams(queryParams));
514
        if (url.length == 0) {
515
            url = this._platformLocation.pathname;
516
        }
517
        this._platformLocation.replaceState(state, title, url);
518
    };
519
    /**
520
     * @return {?}
521
     */
522
    HashLocationStrategy.prototype.forward = function () { this._platformLocation.forward(); };
523
    /**
524
     * @return {?}
525
     */
526
    HashLocationStrategy.prototype.back = function () { this._platformLocation.back(); };
527
    return HashLocationStrategy;
528
}(LocationStrategy));
529
HashLocationStrategy.decorators = [
530
    { type: Injectable },
531
];
532
/**
533
 * @nocollapse
534
 */
535
HashLocationStrategy.ctorParameters = function () { return [
536
    { type: PlatformLocation, },
537
    { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [APP_BASE_HREF,] },] },
538
]; };
539
/**
540
 * @license
541
 * Copyright Google Inc. All Rights Reserved.
542
 *
543
 * Use of this source code is governed by an MIT-style license that can be
544
 * found in the LICENSE file at https://angular.io/license
545
 */
546
/**
547
 * \@whatItDoes Use URL for storing application location data.
548
 * \@description
549
 * `PathLocationStrategy` is a {\@link LocationStrategy} used to configure the
550
 * {\@link Location} service to represent its state in the
551
 * [path](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax) of the
552
 * browser's URL.
553
 *
554
 * If you're using `PathLocationStrategy`, you must provide a {\@link APP_BASE_HREF}
555
 * or add a base element to the document. This URL prefix that will be preserved
556
 * when generating and recognizing URLs.
557
 *
558
 * For instance, if you provide an `APP_BASE_HREF` of `'/my/app'` and call
559
 * `location.go('/foo')`, the browser's URL will become
560
 * `example.com/my/app/foo`.
561
 *
562
 * Similarly, if you add `<base href='/my/app'/>` to the document and call
563
 * `location.go('/foo')`, the browser's URL will become
564
 * `example.com/my/app/foo`.
565
 *
566
 * ### Example
567
 *
568
 * {\@example common/location/ts/path_location_component.ts region='LocationComponent'}
569
 *
570
 * \@stable
571
 */
572
var PathLocationStrategy = (function (_super) {
573
    tslib_1.__extends(PathLocationStrategy, _super);
574
    /**
575
     * @param {?} _platformLocation
576
     * @param {?=} href
577
     */
578
    function PathLocationStrategy(_platformLocation, href) {
579
        var _this = _super.call(this) || this;
580
        _this._platformLocation = _platformLocation;
581
        if (href == null) {
582
            href = _this._platformLocation.getBaseHrefFromDOM();
583
        }
584
        if (href == null) {
585
            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.");
586
        }
587
        _this._baseHref = href;
588
        return _this;
589
    }
590
    /**
591
     * @param {?} fn
592
     * @return {?}
593
     */
594
    PathLocationStrategy.prototype.onPopState = function (fn) {
595
        this._platformLocation.onPopState(fn);
596
        this._platformLocation.onHashChange(fn);
597
    };
598
    /**
599
     * @return {?}
600
     */
601
    PathLocationStrategy.prototype.getBaseHref = function () { return this._baseHref; };
602
    /**
603
     * @param {?} internal
604
     * @return {?}
605
     */
606
    PathLocationStrategy.prototype.prepareExternalUrl = function (internal) {
607
        return Location.joinWithSlash(this._baseHref, internal);
608
    };
609
    /**
610
     * @param {?=} includeHash
611
     * @return {?}
612
     */
613
    PathLocationStrategy.prototype.path = function (includeHash) {
614
        if (includeHash === void 0) { includeHash = false; }
615
        var /** @type {?} */ pathname = this._platformLocation.pathname +
616
            Location.normalizeQueryParams(this._platformLocation.search);
617
        var /** @type {?} */ hash = this._platformLocation.hash;
618
        return hash && includeHash ? "" + pathname + hash : pathname;
619
    };
620
    /**
621
     * @param {?} state
622
     * @param {?} title
623
     * @param {?} url
624
     * @param {?} queryParams
625
     * @return {?}
626
     */
627
    PathLocationStrategy.prototype.pushState = function (state, title, url, queryParams) {
628
        var /** @type {?} */ externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams));
629
        this._platformLocation.pushState(state, title, externalUrl);
630
    };
631
    /**
632
     * @param {?} state
633
     * @param {?} title
634
     * @param {?} url
635
     * @param {?} queryParams
636
     * @return {?}
637
     */
638
    PathLocationStrategy.prototype.replaceState = function (state, title, url, queryParams) {
639
        var /** @type {?} */ externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams));
640
        this._platformLocation.replaceState(state, title, externalUrl);
641
    };
642
    /**
643
     * @return {?}
644
     */
645
    PathLocationStrategy.prototype.forward = function () { this._platformLocation.forward(); };
646
    /**
647
     * @return {?}
648
     */
649
    PathLocationStrategy.prototype.back = function () { this._platformLocation.back(); };
650
    return PathLocationStrategy;
651
}(LocationStrategy));
652
PathLocationStrategy.decorators = [
653
    { type: Injectable },
654
];
655
/**
656
 * @nocollapse
657
 */
658
PathLocationStrategy.ctorParameters = function () { return [
659
    { type: PlatformLocation, },
660
    { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [APP_BASE_HREF,] },] },
661
]; };
662
/**
663
 * @license
664
 * Copyright Google Inc. All Rights Reserved.
665
 *
666
 * Use of this source code is governed by an MIT-style license that can be
667
 * found in the LICENSE file at https://angular.io/license
668
 */
669
/**
670
 * @license
671
 * Copyright Google Inc. All Rights Reserved.
672
 *
673
 * Use of this source code is governed by an MIT-style license that can be
674
 * found in the LICENSE file at https://angular.io/license
675
 */
676
/**
677
 * \@experimental
678
 * @abstract
679
 */
680
var NgLocalization = (function () {
681
    function NgLocalization() {
682
    }
683
    /**
684
     * @abstract
685
     * @param {?} value
686
     * @return {?}
687
     */
688
    NgLocalization.prototype.getPluralCategory = function (value) { };
689
    return NgLocalization;
690
}());
691
/**
692
 * Returns the plural category for a given value.
693
 * - "=value" when the case exists,
694
 * - the plural category otherwise
695
 *
696
 * \@internal
697
 * @param {?} value
698
 * @param {?} cases
699
 * @param {?} ngLocalization
700
 * @return {?}
701
 */
702
function getPluralCategory(value, cases, ngLocalization) {
703
    var /** @type {?} */ key = "=" + value;
704
    if (cases.indexOf(key) > -1) {
705
        return key;
706
    }
707
    key = ngLocalization.getPluralCategory(value);
708
    if (cases.indexOf(key) > -1) {
709
        return key;
710
    }
711
    if (cases.indexOf('other') > -1) {
712
        return 'other';
713
    }
714
    throw new Error("No plural message found for value \"" + value + "\"");
715
}
716
/**
717
 * Returns the plural case based on the locale
718
 *
719
 * \@experimental
720
 */
721
var NgLocaleLocalization = (function (_super) {
722
    tslib_1.__extends(NgLocaleLocalization, _super);
723
    /**
724
     * @param {?} locale
725
     */
726
    function NgLocaleLocalization(locale) {
727
        var _this = _super.call(this) || this;
728
        _this.locale = locale;
729
        return _this;
730
    }
731
    /**
732
     * @param {?} value
733
     * @return {?}
734
     */
735
    NgLocaleLocalization.prototype.getPluralCategory = function (value) {
736
        var /** @type {?} */ plural = getPluralCase(this.locale, value);
737
        switch (plural) {
738
            case Plural.Zero:
739
                return 'zero';
740
            case Plural.One:
741
                return 'one';
742
            case Plural.Two:
743
                return 'two';
744
            case Plural.Few:
745
                return 'few';
746
            case Plural.Many:
747
                return 'many';
748
            default:
749
                return 'other';
750
        }
751
    };
752
    return NgLocaleLocalization;
753
}(NgLocalization));
754
NgLocaleLocalization.decorators = [
755
    { type: Injectable },
756
];
757
/**
758
 * @nocollapse
759
 */
760
NgLocaleLocalization.ctorParameters = function () { return [
761
    { type: undefined, decorators: [{ type: Inject, args: [LOCALE_ID,] },] },
762
]; };
763
var Plural = {};
764
Plural.Zero = 0;
765
Plural.One = 1;
766
Plural.Two = 2;
767
Plural.Few = 3;
768
Plural.Many = 4;
769
Plural.Other = 5;
770
Plural[Plural.Zero] = "Zero";
771
Plural[Plural.One] = "One";
772
Plural[Plural.Two] = "Two";
773
Plural[Plural.Few] = "Few";
774
Plural[Plural.Many] = "Many";
775
Plural[Plural.Other] = "Other";
776
/**
777
 * Returns the plural case based on the locale
778
 *
779
 * \@experimental
780
 * @param {?} locale
781
 * @param {?} nLike
782
 * @return {?}
783
 */
784
function getPluralCase(locale, nLike) {
785
    // TODO(vicb): lazy compute
786
    if (typeof nLike === 'string') {
787
        nLike = parseInt(/** @type {?} */ (nLike), 10);
788
    }
789
    var /** @type {?} */ n = (nLike);
790
    var /** @type {?} */ nDecimal = n.toString().replace(/^[^.]*\.?/, '');
791
    var /** @type {?} */ i = Math.floor(Math.abs(n));
792
    var /** @type {?} */ v = nDecimal.length;
793
    var /** @type {?} */ f = parseInt(nDecimal, 10);
794
    var /** @type {?} */ t = parseInt(n.toString().replace(/^[^.]*\.?|0+$/g, ''), 10) || 0;
795
    var /** @type {?} */ lang = locale.split('-')[0].toLowerCase();
796
    switch (lang) {
797
        case 'af':
798
        case 'asa':
799
        case 'az':
800
        case 'bem':
801
        case 'bez':
802
        case 'bg':
803
        case 'brx':
804
        case 'ce':
805
        case 'cgg':
806
        case 'chr':
807
        case 'ckb':
808
        case 'ee':
809
        case 'el':
810
        case 'eo':
811
        case 'es':
812
        case 'eu':
813
        case 'fo':
814
        case 'fur':
815
        case 'gsw':
816
        case 'ha':
817
        case 'haw':
818
        case 'hu':
819
        case 'jgo':
820
        case 'jmc':
821
        case 'ka':
822
        case 'kk':
823
        case 'kkj':
824
        case 'kl':
825
        case 'ks':
826
        case 'ksb':
827
        case 'ky':
828
        case 'lb':
829
        case 'lg':
830
        case 'mas':
831
        case 'mgo':
832
        case 'ml':
833
        case 'mn':
834
        case 'nb':
835
        case 'nd':
836
        case 'ne':
837
        case 'nn':
838
        case 'nnh':
839
        case 'nyn':
840
        case 'om':
841
        case 'or':
842
        case 'os':
843
        case 'ps':
844
        case 'rm':
845
        case 'rof':
846
        case 'rwk':
847
        case 'saq':
848
        case 'seh':
849
        case 'sn':
850
        case 'so':
851
        case 'sq':
852
        case 'ta':
853
        case 'te':
854
        case 'teo':
855
        case 'tk':
856
        case 'tr':
857
        case 'ug':
858
        case 'uz':
859
        case 'vo':
860
        case 'vun':
861
        case 'wae':
862
        case 'xog':
863
            if (n === 1)
864
                return Plural.One;
865
            return Plural.Other;
866
        case 'ak':
867
        case 'ln':
868
        case 'mg':
869
        case 'pa':
870
        case 'ti':
871
            if (n === Math.floor(n) && n >= 0 && n <= 1)
872
                return Plural.One;
873
            return Plural.Other;
874
        case 'am':
875
        case 'as':
876
        case 'bn':
877
        case 'fa':
878
        case 'gu':
879
        case 'hi':
880
        case 'kn':
881
        case 'mr':
882
        case 'zu':
883
            if (i === 0 || n === 1)
884
                return Plural.One;
885
            return Plural.Other;
886
        case 'ar':
887
            if (n === 0)
888
                return Plural.Zero;
889
            if (n === 1)
890
                return Plural.One;
891
            if (n === 2)
892
                return Plural.Two;
893
            if (n % 100 === Math.floor(n % 100) && n % 100 >= 3 && n % 100 <= 10)
894
                return Plural.Few;
895
            if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 99)
896
                return Plural.Many;
897
            return Plural.Other;
898
        case 'ast':
899
        case 'ca':
900
        case 'de':
901
        case 'en':
902
        case 'et':
903
        case 'fi':
904
        case 'fy':
905
        case 'gl':
906
        case 'it':
907
        case 'nl':
908
        case 'sv':
909
        case 'sw':
910
        case 'ur':
911
        case 'yi':
912
            if (i === 1 && v === 0)
913
                return Plural.One;
914
            return Plural.Other;
915
        case 'be':
916
            if (n % 10 === 1 && !(n % 100 === 11))
917
                return Plural.One;
918
            if (n % 10 === Math.floor(n % 10) && n % 10 >= 2 && n % 10 <= 4 &&
919
                !(n % 100 >= 12 && n % 100 <= 14))
920
                return Plural.Few;
921
            if (n % 10 === 0 || n % 10 === Math.floor(n % 10) && n % 10 >= 5 && n % 10 <= 9 ||
922
                n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 14)
923
                return Plural.Many;
924
            return Plural.Other;
925
        case 'br':
926
            if (n % 10 === 1 && !(n % 100 === 11 || n % 100 === 71 || n % 100 === 91))
927
                return Plural.One;
928
            if (n % 10 === 2 && !(n % 100 === 12 || n % 100 === 72 || n % 100 === 92))
929
                return Plural.Two;
930
            if (n % 10 === Math.floor(n % 10) && (n % 10 >= 3 && n % 10 <= 4 || n % 10 === 9) &&
931
                !(n % 100 >= 10 && n % 100 <= 19 || n % 100 >= 70 && n % 100 <= 79 ||
932
                    n % 100 >= 90 && n % 100 <= 99))
933
                return Plural.Few;
934
            if (!(n === 0) && n % 1e6 === 0)
935
                return Plural.Many;
936
            return Plural.Other;
937
        case 'bs':
938
        case 'hr':
939
        case 'sr':
940
            if (v === 0 && i % 10 === 1 && !(i % 100 === 11) || f % 10 === 1 && !(f % 100 === 11))
941
                return Plural.One;
942
            if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 &&
943
                !(i % 100 >= 12 && i % 100 <= 14) ||
944
                f % 10 === Math.floor(f % 10) && f % 10 >= 2 && f % 10 <= 4 &&
945
                    !(f % 100 >= 12 && f % 100 <= 14))
946
                return Plural.Few;
947
            return Plural.Other;
948
        case 'cs':
949
        case 'sk':
950
            if (i === 1 && v === 0)
951
                return Plural.One;
952
            if (i === Math.floor(i) && i >= 2 && i <= 4 && v === 0)
953
                return Plural.Few;
954
            if (!(v === 0))
955
                return Plural.Many;
956
            return Plural.Other;
957
        case 'cy':
958
            if (n === 0)
959
                return Plural.Zero;
960
            if (n === 1)
961
                return Plural.One;
962
            if (n === 2)
963
                return Plural.Two;
964
            if (n === 3)
965
                return Plural.Few;
966
            if (n === 6)
967
                return Plural.Many;
968
            return Plural.Other;
969
        case 'da':
970
            if (n === 1 || !(t === 0) && (i === 0 || i === 1))
971
                return Plural.One;
972
            return Plural.Other;
973
        case 'dsb':
974
        case 'hsb':
975
            if (v === 0 && i % 100 === 1 || f % 100 === 1)
976
                return Plural.One;
977
            if (v === 0 && i % 100 === 2 || f % 100 === 2)
978
                return Plural.Two;
979
            if (v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 3 && i % 100 <= 4 ||
980
                f % 100 === Math.floor(f % 100) && f % 100 >= 3 && f % 100 <= 4)
981
                return Plural.Few;
982
            return Plural.Other;
983
        case 'ff':
984
        case 'fr':
985
        case 'hy':
986
        case 'kab':
987
            if (i === 0 || i === 1)
988
                return Plural.One;
989
            return Plural.Other;
990
        case 'fil':
991
            if (v === 0 && (i === 1 || i === 2 || i === 3) ||
992
                v === 0 && !(i % 10 === 4 || i % 10 === 6 || i % 10 === 9) ||
993
                !(v === 0) && !(f % 10 === 4 || f % 10 === 6 || f % 10 === 9))
994
                return Plural.One;
995
            return Plural.Other;
996
        case 'ga':
997
            if (n === 1)
998
                return Plural.One;
999
            if (n === 2)
1000
                return Plural.Two;
1001
            if (n === Math.floor(n) && n >= 3 && n <= 6)
1002
                return Plural.Few;
1003
            if (n === Math.floor(n) && n >= 7 && n <= 10)
1004
                return Plural.Many;
1005
            return Plural.Other;
1006
        case 'gd':
1007
            if (n === 1 || n === 11)
1008
                return Plural.One;
1009
            if (n === 2 || n === 12)
1010
                return Plural.Two;
1011
            if (n === Math.floor(n) && (n >= 3 && n <= 10 || n >= 13 && n <= 19))
1012
                return Plural.Few;
1013
            return Plural.Other;
1014
        case 'gv':
1015
            if (v === 0 && i % 10 === 1)
1016
                return Plural.One;
1017
            if (v === 0 && i % 10 === 2)
1018
                return Plural.Two;
1019
            if (v === 0 &&
1020
                (i % 100 === 0 || i % 100 === 20 || i % 100 === 40 || i % 100 === 60 || i % 100 === 80))
1021
                return Plural.Few;
1022
            if (!(v === 0))
1023
                return Plural.Many;
1024
            return Plural.Other;
1025
        case 'he':
1026
            if (i === 1 && v === 0)
1027
                return Plural.One;
1028
            if (i === 2 && v === 0)
1029
                return Plural.Two;
1030
            if (v === 0 && !(n >= 0 && n <= 10) && n % 10 === 0)
1031
                return Plural.Many;
1032
            return Plural.Other;
1033
        case 'is':
1034
            if (t === 0 && i % 10 === 1 && !(i % 100 === 11) || !(t === 0))
1035
                return Plural.One;
1036
            return Plural.Other;
1037
        case 'ksh':
1038
            if (n === 0)
1039
                return Plural.Zero;
1040
            if (n === 1)
1041
                return Plural.One;
1042
            return Plural.Other;
1043
        case 'kw':
1044
        case 'naq':
1045
        case 'se':
1046
        case 'smn':
1047
            if (n === 1)
1048
                return Plural.One;
1049
            if (n === 2)
1050
                return Plural.Two;
1051
            return Plural.Other;
1052
        case 'lag':
1053
            if (n === 0)
1054
                return Plural.Zero;
1055
            if ((i === 0 || i === 1) && !(n === 0))
1056
                return Plural.One;
1057
            return Plural.Other;
1058
        case 'lt':
1059
            if (n % 10 === 1 && !(n % 100 >= 11 && n % 100 <= 19))
1060
                return Plural.One;
1061
            if (n % 10 === Math.floor(n % 10) && n % 10 >= 2 && n % 10 <= 9 &&
1062
                !(n % 100 >= 11 && n % 100 <= 19))
1063
                return Plural.Few;
1064
            if (!(f === 0))
1065
                return Plural.Many;
1066
            return Plural.Other;
1067
        case 'lv':
1068
        case 'prg':
1069
            if (n % 10 === 0 || n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 19 ||
1070
                v === 2 && f % 100 === Math.floor(f % 100) && f % 100 >= 11 && f % 100 <= 19)
1071
                return Plural.Zero;
1072
            if (n % 10 === 1 && !(n % 100 === 11) || v === 2 && f % 10 === 1 && !(f % 100 === 11) ||
1073
                !(v === 2) && f % 10 === 1)
1074
                return Plural.One;
1075
            return Plural.Other;
1076
        case 'mk':
1077
            if (v === 0 && i % 10 === 1 || f % 10 === 1)
1078
                return Plural.One;
1079
            return Plural.Other;
1080
        case 'mt':
1081
            if (n === 1)
1082
                return Plural.One;
1083
            if (n === 0 || n % 100 === Math.floor(n % 100) && n % 100 >= 2 && n % 100 <= 10)
1084
                return Plural.Few;
1085
            if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 19)
1086
                return Plural.Many;
1087
            return Plural.Other;
1088
        case 'pl':
1089
            if (i === 1 && v === 0)
1090
                return Plural.One;
1091
            if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 &&
1092
                !(i % 100 >= 12 && i % 100 <= 14))
1093
                return Plural.Few;
1094
            if (v === 0 && !(i === 1) && i % 10 === Math.floor(i % 10) && i % 10 >= 0 && i % 10 <= 1 ||
1095
                v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 5 && i % 10 <= 9 ||
1096
                v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 12 && i % 100 <= 14)
1097
                return Plural.Many;
1098
            return Plural.Other;
1099
        case 'pt':
1100
            if (n === Math.floor(n) && n >= 0 && n <= 2 && !(n === 2))
1101
                return Plural.One;
1102
            return Plural.Other;
1103
        case 'ro':
1104
            if (i === 1 && v === 0)
1105
                return Plural.One;
1106
            if (!(v === 0) || n === 0 ||
1107
                !(n === 1) && n % 100 === Math.floor(n % 100) && n % 100 >= 1 && n % 100 <= 19)
1108
                return Plural.Few;
1109
            return Plural.Other;
1110
        case 'ru':
1111
        case 'uk':
1112
            if (v === 0 && i % 10 === 1 && !(i % 100 === 11))
1113
                return Plural.One;
1114
            if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 &&
1115
                !(i % 100 >= 12 && i % 100 <= 14))
1116
                return Plural.Few;
1117
            if (v === 0 && i % 10 === 0 ||
1118
                v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 5 && i % 10 <= 9 ||
1119
                v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 11 && i % 100 <= 14)
1120
                return Plural.Many;
1121
            return Plural.Other;
1122
        case 'shi':
1123
            if (i === 0 || n === 1)
1124
                return Plural.One;
1125
            if (n === Math.floor(n) && n >= 2 && n <= 10)
1126
                return Plural.Few;
1127
            return Plural.Other;
1128
        case 'si':
1129
            if (n === 0 || n === 1 || i === 0 && f === 1)
1130
                return Plural.One;
1131
            return Plural.Other;
1132
        case 'sl':
1133
            if (v === 0 && i % 100 === 1)
1134
                return Plural.One;
1135
            if (v === 0 && i % 100 === 2)
1136
                return Plural.Two;
1137
            if (v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 3 && i % 100 <= 4 || !(v === 0))
1138
                return Plural.Few;
1139
            return Plural.Other;
1140
        case 'tzm':
1141
            if (n === Math.floor(n) && n >= 0 && n <= 1 || n === Math.floor(n) && n >= 11 && n <= 99)
1142
                return Plural.One;
1143
            return Plural.Other;
1144
        // When there is no specification, the default is always "other"
1145
        // Spec: http://cldr.unicode.org/index/cldr-spec/plural-rules
1146
        // > other (required—general plural form — also used if the language only has a single form)
1147
        default:
1148
            return Plural.Other;
1149
    }
1150
}
1151
/**
1152
 * @license
1153
 * Copyright Google Inc. All Rights Reserved.
1154
 *
1155
 * Use of this source code is governed by an MIT-style license that can be
1156
 * found in the LICENSE file at https://angular.io/license
1157
 * @param {?} cookieStr
1158
 * @param {?} name
1159
 * @return {?}
1160
 */
1161
function parseCookieValue(cookieStr, name) {
1162
    name = encodeURIComponent(name);
1163
    for (var _i = 0, _a = cookieStr.split(';'); _i < _a.length; _i++) {
1164
        var cookie = _a[_i];
1165
        var /** @type {?} */ eqIndex = cookie.indexOf('=');
1166
        var _b = eqIndex == -1 ? [cookie, ''] : [cookie.slice(0, eqIndex), cookie.slice(eqIndex + 1)], cookieName = _b[0], cookieValue = _b[1];
1167
        if (cookieName.trim() === name) {
1168
            return decodeURIComponent(cookieValue);
1169
        }
1170
    }
1171
    return null;
1172
}
1173
/**
1174
 * @license
1175
 * Copyright Google Inc. All Rights Reserved.
1176
 *
1177
 * Use of this source code is governed by an MIT-style license that can be
1178
 * found in the LICENSE file at https://angular.io/license
1179
 */
1180
/**
1181
 * \@ngModule CommonModule
1182
 *
1183
 * \@whatItDoes Adds and removes CSS classes on an HTML element.
1184
 *
1185
 * \@howToUse
1186
 * ```
1187
 *     <some-element [ngClass]="'first second'">...</some-element>
1188
 *
1189
 *     <some-element [ngClass]="['first', 'second']">...</some-element>
1190
 *
1191
 *     <some-element [ngClass]="{'first': true, 'second': true, 'third': false}">...</some-element>
1192
 *
1193
 *     <some-element [ngClass]="stringExp|arrayExp|objExp">...</some-element>
1194
 *
1195
 *     <some-element [ngClass]="{'class1 class2 class3' : true}">...</some-element>
1196
 * ```
1197
 *
1198
 * \@description
1199
 *
1200
 * The CSS classes are updated as follows, depending on the type of the expression evaluation:
1201
 * - `string` - the CSS classes listed in the string (space delimited) are added,
1202
 * - `Array` - the CSS classes declared as Array elements are added,
1203
 * - `Object` - keys are CSS classes that get added when the expression given in the value
1204
 *              evaluates to a truthy value, otherwise they are removed.
1205
 *
1206
 * \@stable
1207
 */
1208
var NgClass = (function () {
1209
    /**
1210
     * @param {?} _iterableDiffers
1211
     * @param {?} _keyValueDiffers
1212
     * @param {?} _ngEl
1213
     * @param {?} _renderer
1214
     */
1215
    function NgClass(_iterableDiffers, _keyValueDiffers, _ngEl, _renderer) {
1216
        this._iterableDiffers = _iterableDiffers;
1217
        this._keyValueDiffers = _keyValueDiffers;
1218
        this._ngEl = _ngEl;
1219
        this._renderer = _renderer;
1220
        this._initialClasses = [];
1221
    }
1222
    Object.defineProperty(NgClass.prototype, "klass", {
1223
        /**
1224
         * @param {?} v
1225
         * @return {?}
1226
         */
1227
        set: function (v) {
1228
            this._applyInitialClasses(true);
1229
            this._initialClasses = typeof v === 'string' ? v.split(/\s+/) : [];
1230
            this._applyInitialClasses(false);
1231
            this._applyClasses(this._rawClass, false);
1232
        },
1233
        enumerable: true,
1234
        configurable: true
1235
    });
1236
    Object.defineProperty(NgClass.prototype, "ngClass", {
1237
        /**
1238
         * @param {?} v
1239
         * @return {?}
1240
         */
1241
        set: function (v) {
1242
            this._cleanupClasses(this._rawClass);
1243
            this._iterableDiffer = null;
1244
            this._keyValueDiffer = null;
1245
            this._rawClass = typeof v === 'string' ? v.split(/\s+/) : v;
1246
            if (this._rawClass) {
1247
                if (ɵisListLikeIterable(this._rawClass)) {
1248
                    this._iterableDiffer = this._iterableDiffers.find(this._rawClass).create();
1249
                }
1250
                else {
1251
                    this._keyValueDiffer = this._keyValueDiffers.find(this._rawClass).create();
1252
                }
1253
            }
1254
        },
1255
        enumerable: true,
1256
        configurable: true
1257
    });
1258
    /**
1259
     * @return {?}
1260
     */
1261
    NgClass.prototype.ngDoCheck = function () {
1262
        if (this._iterableDiffer) {
1263
            var /** @type {?} */ iterableChanges = this._iterableDiffer.diff(/** @type {?} */ (this._rawClass));
1264
            if (iterableChanges) {
1265
                this._applyIterableChanges(iterableChanges);
1266
            }
1267
        }
1268
        else if (this._keyValueDiffer) {
1269
            var /** @type {?} */ keyValueChanges = this._keyValueDiffer.diff(/** @type {?} */ (this._rawClass));
1270
            if (keyValueChanges) {
1271
                this._applyKeyValueChanges(keyValueChanges);
1272
            }
1273
        }
1274
    };
1275
    /**
1276
     * @param {?} rawClassVal
1277
     * @return {?}
1278
     */
1279
    NgClass.prototype._cleanupClasses = function (rawClassVal) {
1280
        this._applyClasses(rawClassVal, true);
1281
        this._applyInitialClasses(false);
1282
    };
1283
    /**
1284
     * @param {?} changes
1285
     * @return {?}
1286
     */
1287
    NgClass.prototype._applyKeyValueChanges = function (changes) {
1288
        var _this = this;
1289
        changes.forEachAddedItem(function (record) { return _this._toggleClass(record.key, record.currentValue); });
1290
        changes.forEachChangedItem(function (record) { return _this._toggleClass(record.key, record.currentValue); });
1291
        changes.forEachRemovedItem(function (record) {
1292
            if (record.previousValue) {
1293
                _this._toggleClass(record.key, false);
1294
            }
1295
        });
1296
    };
1297
    /**
1298
     * @param {?} changes
1299
     * @return {?}
1300
     */
1301
    NgClass.prototype._applyIterableChanges = function (changes) {
1302
        var _this = this;
1303
        changes.forEachAddedItem(function (record) {
1304
            if (typeof record.item === 'string') {
1305
                _this._toggleClass(record.item, true);
1306
            }
1307
            else {
1308
                throw new Error("NgClass can only toggle CSS classes expressed as strings, got " + ɵstringify(record.item));
1309
            }
1310
        });
1311
        changes.forEachRemovedItem(function (record) { return _this._toggleClass(record.item, false); });
1312
    };
1313
    /**
1314
     * @param {?} isCleanup
1315
     * @return {?}
1316
     */
1317
    NgClass.prototype._applyInitialClasses = function (isCleanup) {
1318
        var _this = this;
1319
        this._initialClasses.forEach(function (klass) { return _this._toggleClass(klass, !isCleanup); });
1320
    };
1321
    /**
1322
     * @param {?} rawClassVal
1323
     * @param {?} isCleanup
1324
     * @return {?}
1325
     */
1326
    NgClass.prototype._applyClasses = function (rawClassVal, isCleanup) {
1327
        var _this = this;
1328
        if (rawClassVal) {
1329
            if (Array.isArray(rawClassVal) || rawClassVal instanceof Set) {
1330
                ((rawClassVal)).forEach(function (klass) { return _this._toggleClass(klass, !isCleanup); });
1331
            }
1332
            else {
1333
                Object.keys(rawClassVal).forEach(function (klass) {
1334
                    if (rawClassVal[klass] != null)
1335
                        _this._toggleClass(klass, !isCleanup);
1336
                });
1337
            }
1338
        }
1339
    };
1340
    /**
1341
     * @param {?} klass
1342
     * @param {?} enabled
1343
     * @return {?}
1344
     */
1345
    NgClass.prototype._toggleClass = function (klass, enabled) {
1346
        var _this = this;
1347
        klass = klass.trim();
1348
        if (klass) {
1349
            klass.split(/\s+/g).forEach(function (klass) { _this._renderer.setElementClass(_this._ngEl.nativeElement, klass, !!enabled); });
1350
        }
1351
    };
1352
    return NgClass;
1353
}());
1354
NgClass.decorators = [
1355
    { type: Directive, args: [{ selector: '[ngClass]' },] },
1356
];
1357
/**
1358
 * @nocollapse
1359
 */
1360
NgClass.ctorParameters = function () { return [
1361
    { type: IterableDiffers, },
1362
    { type: KeyValueDiffers, },
1363
    { type: ElementRef, },
1364
    { type: Renderer, },
1365
]; };
1366
NgClass.propDecorators = {
1367
    'klass': [{ type: Input, args: ['class',] },],
1368
    'ngClass': [{ type: Input },],
1369
};
1370
/**
1371
 * @license
1372
 * Copyright Google Inc. All Rights Reserved.
1373
 *
1374
 * Use of this source code is governed by an MIT-style license that can be
1375
 * found in the LICENSE file at https://angular.io/license
1376
 */
1377
/**
1378
 * Instantiates a single {\@link Component} type and inserts its Host View into current View.
1379
 * `NgComponentOutlet` provides a declarative approach for dynamic component creation.
1380
 *
1381
 * `NgComponentOutlet` requires a component type, if a falsy value is set the view will clear and
1382
 * any existing component will get destroyed.
1383
 *
1384
 * ### Fine tune control
1385
 *
1386
 * You can control the component creation process by using the following optional attributes:
1387
 *
1388
 * * `ngComponentOutletInjector`: Optional custom {\@link Injector} that will be used as parent for
1389
 * the Component. Defaults to the injector of the current view container.
1390
 *
1391
 * * `ngComponentOutletContent`: Optional list of projectable nodes to insert into the content
1392
 * section of the component, if exists.
1393
 *
1394
 * * `ngComponentOutletNgModuleFactory`: Optional module factory to allow dynamically loading other
1395
 * module, then load a component from that module.
1396
 *
1397
 * ### Syntax
1398
 *
1399
 * Simple
1400
 * ```
1401
 * <ng-container *ngComponentOutlet="componentTypeExpression"></ng-container>
1402
 * ```
1403
 *
1404
 * Customized injector/content
1405
 * ```
1406
 * <ng-container *ngComponentOutlet="componentTypeExpression;
1407
 *                                   injector: injectorExpression;
1408
 *                                   content: contentNodesExpression;">
1409
 * </ng-container>
1410
 * ```
1411
 *
1412
 * Customized ngModuleFactory
1413
 * ```
1414
 * <ng-container *ngComponentOutlet="componentTypeExpression;
1415
 *                                   ngModuleFactory: moduleFactory;">
1416
 * </ng-container>
1417
 * ```
1418
 * ## Example
1419
 *
1420
 * {\@example common/ngComponentOutlet/ts/module.ts region='SimpleExample'}
1421
 *
1422
 * A more complete example with additional options:
1423
 *
1424
 * {\@example common/ngComponentOutlet/ts/module.ts region='CompleteExample'}
1425
 * A more complete example with ngModuleFactory:
1426
 *
1427
 * {\@example common/ngComponentOutlet/ts/module.ts region='NgModuleFactoryExample'}
1428
 *
1429
 * \@experimental
1430
 */
1431
var NgComponentOutlet = (function () {
1432
    /**
1433
     * @param {?} _viewContainerRef
1434
     */
1435
    function NgComponentOutlet(_viewContainerRef) {
1436
        this._viewContainerRef = _viewContainerRef;
1437
        this._componentRef = null;
1438
        this._moduleRef = null;
1439
    }
1440
    /**
1441
     * @param {?} changes
1442
     * @return {?}
1443
     */
1444
    NgComponentOutlet.prototype.ngOnChanges = function (changes) {
1445
        this._viewContainerRef.clear();
1446
        this._componentRef = null;
1447
        if (this.ngComponentOutlet) {
1448
            var /** @type {?} */ elInjector = this.ngComponentOutletInjector || this._viewContainerRef.parentInjector;
1449
            if (changes['ngComponentOutletNgModuleFactory']) {
1450
                if (this._moduleRef)
1451
                    this._moduleRef.destroy();
1452
                if (this.ngComponentOutletNgModuleFactory) {
1453
                    var /** @type {?} */ parentModule = elInjector.get(NgModuleRef);
1454
                    this._moduleRef = this.ngComponentOutletNgModuleFactory.create(parentModule.injector);
1455
                }
1456
                else {
1457
                    this._moduleRef = null;
1458
                }
1459
            }
1460
            var /** @type {?} */ componentFactoryResolver = this._moduleRef ? this._moduleRef.componentFactoryResolver :
1461
                elInjector.get(ComponentFactoryResolver);
1462
            var /** @type {?} */ componentFactory = componentFactoryResolver.resolveComponentFactory(this.ngComponentOutlet);
1463
            this._componentRef = this._viewContainerRef.createComponent(componentFactory, this._viewContainerRef.length, elInjector, this.ngComponentOutletContent);
1464
        }
1465
    };
1466
    /**
1467
     * @return {?}
1468
     */
1469
    NgComponentOutlet.prototype.ngOnDestroy = function () {
1470
        if (this._moduleRef)
1471
            this._moduleRef.destroy();
1472
    };
1473
    return NgComponentOutlet;
1474
}());
1475
NgComponentOutlet.decorators = [
1476
    { type: Directive, args: [{ selector: '[ngComponentOutlet]' },] },
1477
];
1478
/**
1479
 * @nocollapse
1480
 */
1481
NgComponentOutlet.ctorParameters = function () { return [
1482
    { type: ViewContainerRef, },
1483
]; };
1484
NgComponentOutlet.propDecorators = {
1485
    'ngComponentOutlet': [{ type: Input },],
1486
    'ngComponentOutletInjector': [{ type: Input },],
1487
    'ngComponentOutletContent': [{ type: Input },],
1488
    'ngComponentOutletNgModuleFactory': [{ type: Input },],
1489
};
1490
/**
1491
 * @license
1492
 * Copyright Google Inc. All Rights Reserved.
1493
 *
1494
 * Use of this source code is governed by an MIT-style license that can be
1495
 * found in the LICENSE file at https://angular.io/license
1496
 */
1497
/**
1498
 * \@stable
1499
 */
1500
var NgForOfContext = (function () {
1501
    /**
1502
     * @param {?} $implicit
1503
     * @param {?} ngForOf
1504
     * @param {?} index
1505
     * @param {?} count
1506
     */
1507
    function NgForOfContext($implicit, ngForOf, index, count) {
1508
        this.$implicit = $implicit;
1509
        this.ngForOf = ngForOf;
1510
        this.index = index;
1511
        this.count = count;
1512
    }
1513
    Object.defineProperty(NgForOfContext.prototype, "first", {
1514
        /**
1515
         * @return {?}
1516
         */
1517
        get: function () { return this.index === 0; },
1518
        enumerable: true,
1519
        configurable: true
1520
    });
1521
    Object.defineProperty(NgForOfContext.prototype, "last", {
1522
        /**
1523
         * @return {?}
1524
         */
1525
        get: function () { return this.index === this.count - 1; },
1526
        enumerable: true,
1527
        configurable: true
1528
    });
1529
    Object.defineProperty(NgForOfContext.prototype, "even", {
1530
        /**
1531
         * @return {?}
1532
         */
1533
        get: function () { return this.index % 2 === 0; },
1534
        enumerable: true,
1535
        configurable: true
1536
    });
1537
    Object.defineProperty(NgForOfContext.prototype, "odd", {
1538
        /**
1539
         * @return {?}
1540
         */
1541
        get: function () { return !this.even; },
1542
        enumerable: true,
1543
        configurable: true
1544
    });
1545
    return NgForOfContext;
1546
}());
1547
/**
1548
 * The `NgForOf` directive instantiates a template once per item from an iterable. The context
1549
 * for each instantiated template inherits from the outer context with the given loop variable
1550
 * set to the current item from the iterable.
1551
 *
1552
 * ### Local Variables
1553
 *
1554
 * `NgForOf` provides several exported values that can be aliased to local variables:
1555
 *
1556
 * - `$implicit: T`: The value of the individual items in the iterable (`ngForOf`).
1557
 * - `ngForOf: NgIterable<T>`: The value of the iterable expression. Useful when the expression is
1558
 * more complex then a property access, for example when using the async pipe (`userStreams |
1559
 * async`).
1560
 * - `index: number`: The index of the current item in the iterable.
1561
 * - `first: boolean`: True when the item is the first item in the iterable.
1562
 * - `last: boolean`: True when the item is the last item in the iterable.
1563
 * - `even: boolean`: True when the item has an even index in the iterable.
1564
 * - `odd: boolean`: True when the item has an odd index in the iterable.
1565
 *
1566
 * ```
1567
 * <li *ngFor="let user of userObservable | async as users; index as i; first as isFirst">
1568
 *    {{i}}/{{users.length}}. {{user}} <span *ngIf="isFirst">default</span>
1569
 * </li>
1570
 * ```
1571
 *
1572
 * ### Change Propagation
1573
 *
1574
 * When the contents of the iterator changes, `NgForOf` makes the corresponding changes to the DOM:
1575
 *
1576
 * * When an item is added, a new instance of the template is added to the DOM.
1577
 * * When an item is removed, its template instance is removed from the DOM.
1578
 * * When items are reordered, their respective templates are reordered in the DOM.
1579
 * * Otherwise, the DOM element for that item will remain the same.
1580
 *
1581
 * Angular uses object identity to track insertions and deletions within the iterator and reproduce
1582
 * those changes in the DOM. This has important implications for animations and any stateful
1583
 * controls (such as `<input>` elements which accept user input) that are present. Inserted rows can
1584
 * be animated in, deleted rows can be animated out, and unchanged rows retain any unsaved state
1585
 * such as user input.
1586
 *
1587
 * It is possible for the identities of elements in the iterator to change while the data does not.
1588
 * This can happen, for example, if the iterator produced from an RPC to the server, and that
1589
 * RPC is re-run. Even if the data hasn't changed, the second response will produce objects with
1590
 * different identities, and Angular will tear down the entire DOM and rebuild it (as if all old
1591
 * elements were deleted and all new elements inserted). This is an expensive operation and should
1592
 * be avoided if possible.
1593
 *
1594
 * To customize the default tracking algorithm, `NgForOf` supports `trackBy` option.
1595
 * `trackBy` takes a function which has two arguments: `index` and `item`.
1596
 * If `trackBy` is given, Angular tracks changes by the return value of the function.
1597
 *
1598
 * ### Syntax
1599
 *
1600
 * - `<li *ngFor="let item of items; index as i; trackBy: trackByFn">...</li>`
1601
 * - `<li template="ngFor let item of items; index as i; trackBy: trackByFn">...</li>`
1602
 *
1603
 * With `<ng-template>` element:
1604
 *
1605
 * ```
1606
 * <ng-template ngFor let-item [ngForOf]="items" let-i="index" [ngForTrackBy]="trackByFn">
1607
 *   <li>...</li>
1608
 * </ng-template>
1609
 * ```
1610
 *
1611
 * ### Example
1612
 *
1613
 * See a [live demo](http://plnkr.co/edit/KVuXxDp0qinGDyo307QW?p=preview) for a more detailed
1614
 * example.
1615
 *
1616
 * \@stable
1617
 */
1618
var NgForOf = (function () {
1619
    /**
1620
     * @param {?} _viewContainer
1621
     * @param {?} _template
1622
     * @param {?} _differs
1623
     */
1624
    function NgForOf(_viewContainer, _template, _differs) {
1625
        this._viewContainer = _viewContainer;
1626
        this._template = _template;
1627
        this._differs = _differs;
1628
        this._differ = null;
1629
    }
1630
    Object.defineProperty(NgForOf.prototype, "ngForTrackBy", {
1631
        /**
1632
         * @return {?}
1633
         */
1634
        get: function () { return this._trackByFn; },
1635
        /**
1636
         * @param {?} fn
1637
         * @return {?}
1638
         */
1639
        set: function (fn) {
1640
            if (isDevMode() && fn != null && typeof fn !== 'function') {
1641
                // TODO(vicb): use a log service once there is a public one available
1642
                if ((console) && (console.warn)) {
1643
                    console.warn("trackBy must be a function, but received " + JSON.stringify(fn) + ". " +
1644
                        "See https://angular.io/docs/ts/latest/api/common/index/NgFor-directive.html#!#change-propagation for more information.");
1645
                }
1646
            }
1647
            this._trackByFn = fn;
1648
        },
1649
        enumerable: true,
1650
        configurable: true
1651
    });
1652
    Object.defineProperty(NgForOf.prototype, "ngForTemplate", {
1653
        /**
1654
         * @param {?} value
1655
         * @return {?}
1656
         */
1657
        set: function (value) {
1658
            // TODO(TS2.1): make TemplateRef<Partial<NgForRowOf<T>>> once we move to TS v2.1
1659
            // The current type is too restrictive; a template that just uses index, for example,
1660
            // should be acceptable.
1661
            if (value) {
1662
                this._template = value;
1663
            }
1664
        },
1665
        enumerable: true,
1666
        configurable: true
1667
    });
1668
    /**
1669
     * @param {?} changes
1670
     * @return {?}
1671
     */
1672
    NgForOf.prototype.ngOnChanges = function (changes) {
1673
        if ('ngForOf' in changes) {
1674
            // React on ngForOf changes only once all inputs have been initialized
1675
            var /** @type {?} */ value = changes['ngForOf'].currentValue;
1676
            if (!this._differ && value) {
1677
                try {
1678
                    this._differ = this._differs.find(value).create(this.ngForTrackBy);
1679
                }
1680
                catch (e) {
1681
                    throw new Error("Cannot find a differ supporting object '" + value + "' of type '" + getTypeNameForDebugging(value) + "'. NgFor only supports binding to Iterables such as Arrays.");
1682
                }
1683
            }
1684
        }
1685
    };
1686
    /**
1687
     * @return {?}
1688
     */
1689
    NgForOf.prototype.ngDoCheck = function () {
1690
        if (this._differ) {
1691
            var /** @type {?} */ changes = this._differ.diff(this.ngForOf);
1692
            if (changes)
1693
                this._applyChanges(changes);
1694
        }
1695
    };
1696
    /**
1697
     * @param {?} changes
1698
     * @return {?}
1699
     */
1700
    NgForOf.prototype._applyChanges = function (changes) {
1701
        var _this = this;
1702
        var /** @type {?} */ insertTuples = [];
1703
        changes.forEachOperation(function (item, adjustedPreviousIndex, currentIndex) {
1704
            if (item.previousIndex == null) {
1705
                var /** @type {?} */ view = _this._viewContainer.createEmbeddedView(_this._template, new NgForOfContext(/** @type {?} */ ((null)), _this.ngForOf, -1, -1), currentIndex);
1706
                var /** @type {?} */ tuple = new RecordViewTuple(item, view);
1707
                insertTuples.push(tuple);
1708
            }
1709
            else if (currentIndex == null) {
1710
                _this._viewContainer.remove(adjustedPreviousIndex);
1711
            }
1712
            else {
1713
                var /** @type {?} */ view = ((_this._viewContainer.get(adjustedPreviousIndex)));
1714
                _this._viewContainer.move(view, currentIndex);
1715
                var /** @type {?} */ tuple = new RecordViewTuple(item, /** @type {?} */ (view));
1716
                insertTuples.push(tuple);
1717
            }
1718
        });
1719
        for (var /** @type {?} */ i = 0; i < insertTuples.length; i++) {
1720
            this._perViewChange(insertTuples[i].view, insertTuples[i].record);
1721
        }
1722
        for (var /** @type {?} */ i = 0, /** @type {?} */ ilen = this._viewContainer.length; i < ilen; i++) {
1723
            var /** @type {?} */ viewRef = (this._viewContainer.get(i));
1724
            viewRef.context.index = i;
1725
            viewRef.context.count = ilen;
1726
        }
1727
        changes.forEachIdentityChange(function (record) {
1728
            var /** @type {?} */ viewRef = (_this._viewContainer.get(record.currentIndex));
1729
            viewRef.context.$implicit = record.item;
1730
        });
1731
    };
1732
    /**
1733
     * @param {?} view
1734
     * @param {?} record
1735
     * @return {?}
1736
     */
1737
    NgForOf.prototype._perViewChange = function (view, record) {
1738
        view.context.$implicit = record.item;
1739
    };
1740
    return NgForOf;
1741
}());
1742
NgForOf.decorators = [
1743
    { type: Directive, args: [{ selector: '[ngFor][ngForOf]' },] },
1744
];
1745
/**
1746
 * @nocollapse
1747
 */
1748
NgForOf.ctorParameters = function () { return [
1749
    { type: ViewContainerRef, },
1750
    { type: TemplateRef, },
1751
    { type: IterableDiffers, },
1752
]; };
1753
NgForOf.propDecorators = {
1754
    'ngForOf': [{ type: Input },],
1755
    'ngForTrackBy': [{ type: Input },],
1756
    'ngForTemplate': [{ type: Input },],
1757
};
1758
var RecordViewTuple = (function () {
1759
    /**
1760
     * @param {?} record
1761
     * @param {?} view
1762
     */
1763
    function RecordViewTuple(record, view) {
1764
        this.record = record;
1765
        this.view = view;
1766
    }
1767
    return RecordViewTuple;
1768
}());
1769
/**
1770
 * @deprecated from v4.0.0 - Use NgForOf instead.
1771
 */
1772
var NgFor = NgForOf;
1773
/**
1774
 * @param {?} type
1775
 * @return {?}
1776
 */
1777
function getTypeNameForDebugging(type) {
1778
    return type['name'] || typeof type;
1779
}
1780
/**
1781
 * @license
1782
 * Copyright Google Inc. All Rights Reserved.
1783
 *
1784
 * Use of this source code is governed by an MIT-style license that can be
1785
 * found in the LICENSE file at https://angular.io/license
1786
 */
1787
/**
1788
 * Conditionally includes a template based on the value of an `expression`.
1789
 *
1790
 * `ngIf` evaluates the `expression` and then renders the `then` or `else` template in its place
1791
 * when expression is truthy or falsy respectively. Typically the:
1792
 *  - `then` template is the inline template of `ngIf` unless bound to a different value.
1793
 *  - `else` template is blank unless it is bound.
1794
 *
1795
 * ## Most common usage
1796
 *
1797
 * The most common usage of the `ngIf` directive is to conditionally show the inline template as
1798
 * seen in this example:
1799
 * {\@example common/ngIf/ts/module.ts region='NgIfSimple'}
1800
 *
1801
 * ## Showing an alternative template using `else`
1802
 *
1803
 * If it is necessary to display a template when the `expression` is falsy use the `else` template
1804
 * binding as shown. Note that the `else` binding points to a `<ng-template>` labeled `#elseBlock`.
1805
 * The template can be defined anywhere in the component view but is typically placed right after
1806
 * `ngIf` for readability.
1807
 *
1808
 * {\@example common/ngIf/ts/module.ts region='NgIfElse'}
1809
 *
1810
 * ## Using non-inlined `then` template
1811
 *
1812
 * Usually the `then` template is the inlined template of the `ngIf`, but it can be changed using
1813
 * a binding (just like `else`). Because `then` and `else` are bindings, the template references can
1814
 * change at runtime as shown in this example.
1815
 *
1816
 * {\@example common/ngIf/ts/module.ts region='NgIfThenElse'}
1817
 *
1818
 * ## Storing conditional result in a variable
1819
 *
1820
 * A common pattern is that we need to show a set of properties from the same object. If the
1821
 * object is undefined, then we have to use the safe-traversal-operator `?.` to guard against
1822
 * dereferencing a `null` value. This is especially the case when waiting on async data such as
1823
 * when using the `async` pipe as shown in following example:
1824
 *
1825
 * ```
1826
 * Hello {{ (userStream|async)?.last }}, {{ (userStream|async)?.first }}!
1827
 * ```
1828
 *
1829
 * There are several inefficiencies in the above example:
1830
 *  - We create multiple subscriptions on `userStream`. One for each `async` pipe, or two in the
1831
 *    example above.
1832
 *  - We cannot display an alternative screen while waiting for the data to arrive asynchronously.
1833
 *  - We have to use the safe-traversal-operator `?.` to access properties, which is cumbersome.
1834
 *  - We have to place the `async` pipe in parenthesis.
1835
 *
1836
 * A better way to do this is to use `ngIf` and store the result of the condition in a local
1837
 * variable as shown in the the example below:
1838
 *
1839
 * {\@example common/ngIf/ts/module.ts region='NgIfAs'}
1840
 *
1841
 * Notice that:
1842
 *  - We use only one `async` pipe and hence only one subscription gets created.
1843
 *  - `ngIf` stores the result of the `userStream|async` in the local variable `user`.
1844
 *  - The local `user` can then be bound repeatedly in a more efficient way.
1845
 *  - No need to use the safe-traversal-operator `?.` to access properties as `ngIf` will only
1846
 *    display the data if `userStream` returns a value.
1847
 *  - We can display an alternative template while waiting for the data.
1848
 *
1849
 * ### Syntax
1850
 *
1851
 * Simple form:
1852
 * - `<div *ngIf="condition">...</div>`
1853
 * - `<div template="ngIf condition">...</div>`
1854
 * - `<ng-template [ngIf]="condition"><div>...</div></ng-template>`
1855
 *
1856
 * Form with an else block:
1857
 * ```
1858
 * <div *ngIf="condition; else elseBlock">...</div>
1859
 * <ng-template #elseBlock>...</ng-template>
1860
 * ```
1861
 *
1862
 * Form with a `then` and `else` block:
1863
 * ```
1864
 * <div *ngIf="condition; then thenBlock else elseBlock"></div>
1865
 * <ng-template #thenBlock>...</ng-template>
1866
 * <ng-template #elseBlock>...</ng-template>
1867
 * ```
1868
 *
1869
 * Form with storing the value locally:
1870
 * ```
1871
 * <div *ngIf="condition as value; else elseBlock">{{value}}</div>
1872
 * <ng-template #elseBlock>...</ng-template>
1873
 * ```
1874
 *
1875
 * \@stable
1876
 */
1877
var NgIf = (function () {
1878
    /**
1879
     * @param {?} _viewContainer
1880
     * @param {?} templateRef
1881
     */
1882
    function NgIf(_viewContainer, templateRef) {
1883
        this._viewContainer = _viewContainer;
1884
        this._context = new NgIfContext();
1885
        this._thenTemplateRef = null;
1886
        this._elseTemplateRef = null;
1887
        this._thenViewRef = null;
1888
        this._elseViewRef = null;
1889
        this._thenTemplateRef = templateRef;
1890
    }
1891
    Object.defineProperty(NgIf.prototype, "ngIf", {
1892
        /**
1893
         * @param {?} condition
1894
         * @return {?}
1895
         */
1896
        set: function (condition) {
1897
            this._context.$implicit = this._context.ngIf = condition;
1898
            this._updateView();
1899
        },
1900
        enumerable: true,
1901
        configurable: true
1902
    });
1903
    Object.defineProperty(NgIf.prototype, "ngIfThen", {
1904
        /**
1905
         * @param {?} templateRef
1906
         * @return {?}
1907
         */
1908
        set: function (templateRef) {
1909
            this._thenTemplateRef = templateRef;
1910
            this._thenViewRef = null; // clear previous view if any.
1911
            this._updateView();
1912
        },
1913
        enumerable: true,
1914
        configurable: true
1915
    });
1916
    Object.defineProperty(NgIf.prototype, "ngIfElse", {
1917
        /**
1918
         * @param {?} templateRef
1919
         * @return {?}
1920
         */
1921
        set: function (templateRef) {
1922
            this._elseTemplateRef = templateRef;
1923
            this._elseViewRef = null; // clear previous view if any.
1924
            this._updateView();
1925
        },
1926
        enumerable: true,
1927
        configurable: true
1928
    });
1929
    /**
1930
     * @return {?}
1931
     */
1932
    NgIf.prototype._updateView = function () {
1933
        if (this._context.$implicit) {
1934
            if (!this._thenViewRef) {
1935
                this._viewContainer.clear();
1936
                this._elseViewRef = null;
1937
                if (this._thenTemplateRef) {
1938
                    this._thenViewRef =
1939
                        this._viewContainer.createEmbeddedView(this._thenTemplateRef, this._context);
1940
                }
1941
            }
1942
        }
1943
        else {
1944
            if (!this._elseViewRef) {
1945
                this._viewContainer.clear();
1946
                this._thenViewRef = null;
1947
                if (this._elseTemplateRef) {
1948
                    this._elseViewRef =
1949
                        this._viewContainer.createEmbeddedView(this._elseTemplateRef, this._context);
1950
                }
1951
            }
1952
        }
1953
    };
1954
    return NgIf;
1955
}());
1956
NgIf.decorators = [
1957
    { type: Directive, args: [{ selector: '[ngIf]' },] },
1958
];
1959
/**
1960
 * @nocollapse
1961
 */
1962
NgIf.ctorParameters = function () { return [
1963
    { type: ViewContainerRef, },
1964
    { type: TemplateRef, },
1965
]; };
1966
NgIf.propDecorators = {
1967
    'ngIf': [{ type: Input },],
1968
    'ngIfThen': [{ type: Input },],
1969
    'ngIfElse': [{ type: Input },],
1970
};
1971
/**
1972
 * \@stable
1973
 */
1974
var NgIfContext = (function () {
1975
    function NgIfContext() {
1976
        this.$implicit = null;
1977
        this.ngIf = null;
1978
    }
1979
    return NgIfContext;
1980
}());
1981
/**
1982
 * @license
1983
 * Copyright Google Inc. All Rights Reserved.
1984
 *
1985
 * Use of this source code is governed by an MIT-style license that can be
1986
 * found in the LICENSE file at https://angular.io/license
1987
 */
1988
var SwitchView = (function () {
1989
    /**
1990
     * @param {?} _viewContainerRef
1991
     * @param {?} _templateRef
1992
     */
1993
    function SwitchView(_viewContainerRef, _templateRef) {
1994
        this._viewContainerRef = _viewContainerRef;
1995
        this._templateRef = _templateRef;
1996
        this._created = false;
1997
    }
1998
    /**
1999
     * @return {?}
2000
     */
2001
    SwitchView.prototype.create = function () {
2002
        this._created = true;
2003
        this._viewContainerRef.createEmbeddedView(this._templateRef);
2004
    };
2005
    /**
2006
     * @return {?}
2007
     */
2008
    SwitchView.prototype.destroy = function () {
2009
        this._created = false;
2010
        this._viewContainerRef.clear();
2011
    };
2012
    /**
2013
     * @param {?} created
2014
     * @return {?}
2015
     */
2016
    SwitchView.prototype.enforceState = function (created) {
2017
        if (created && !this._created) {
2018
            this.create();
2019
        }
2020
        else if (!created && this._created) {
2021
            this.destroy();
2022
        }
2023
    };
2024
    return SwitchView;
2025
}());
2026
/**
2027
 * \@ngModule CommonModule
2028
 *
2029
 * \@whatItDoes Adds / removes DOM sub-trees when the nest match expressions matches the switch
2030
 *             expression.
2031
 *
2032
 * \@howToUse
2033
 * ```
2034
 *     <container-element [ngSwitch]="switch_expression">
2035
 *       <some-element *ngSwitchCase="match_expression_1">...</some-element>
2036
 *       <some-element *ngSwitchCase="match_expression_2">...</some-element>
2037
 *       <some-other-element *ngSwitchCase="match_expression_3">...</some-other-element>
2038
 *       <ng-container *ngSwitchCase="match_expression_3">
2039
 *         <!-- use a ng-container to group multiple root nodes -->
2040
 *         <inner-element></inner-element>
2041
 *         <inner-other-element></inner-other-element>
2042
 *       </ng-container>
2043
 *       <some-element *ngSwitchDefault>...</some-element>
2044
 *     </container-element>
2045
 * ```
2046
 * \@description
2047
 *
2048
 * `NgSwitch` stamps out nested views when their match expression value matches the value of the
2049
 * switch expression.
2050
 *
2051
 * In other words:
2052
 * - you define a container element (where you place the directive with a switch expression on the
2053
 * `[ngSwitch]="..."` attribute)
2054
 * - you define inner views inside the `NgSwitch` and place a `*ngSwitchCase` attribute on the view
2055
 * root elements.
2056
 *
2057
 * Elements within `NgSwitch` but outside of a `NgSwitchCase` or `NgSwitchDefault` directives will
2058
 * be preserved at the location.
2059
 *
2060
 * The `ngSwitchCase` directive informs the parent `NgSwitch` of which view to display when the
2061
 * expression is evaluated.
2062
 * When no matching expression is found on a `ngSwitchCase` view, the `ngSwitchDefault` view is
2063
 * stamped out.
2064
 *
2065
 * \@stable
2066
 */
2067
var NgSwitch = (function () {
2068
    function NgSwitch() {
2069
        this._defaultUsed = false;
2070
        this._caseCount = 0;
2071
        this._lastCaseCheckIndex = 0;
2072
        this._lastCasesMatched = false;
2073
    }
2074
    Object.defineProperty(NgSwitch.prototype, "ngSwitch", {
2075
        /**
2076
         * @param {?} newValue
2077
         * @return {?}
2078
         */
2079
        set: function (newValue) {
2080
            this._ngSwitch = newValue;
2081
            if (this._caseCount === 0) {
2082
                this._updateDefaultCases(true);
2083
            }
2084
        },
2085
        enumerable: true,
2086
        configurable: true
2087
    });
2088
    /**
2089
     * \@internal
2090
     * @return {?}
2091
     */
2092
    NgSwitch.prototype._addCase = function () { return this._caseCount++; };
2093
    /**
2094
     * \@internal
2095
     * @param {?} view
2096
     * @return {?}
2097
     */
2098
    NgSwitch.prototype._addDefault = function (view) {
2099
        if (!this._defaultViews) {
2100
            this._defaultViews = [];
2101
        }
2102
        this._defaultViews.push(view);
2103
    };
2104
    /**
2105
     * \@internal
2106
     * @param {?} value
2107
     * @return {?}
2108
     */
2109
    NgSwitch.prototype._matchCase = function (value) {
2110
        var /** @type {?} */ matched = value == this._ngSwitch;
2111
        this._lastCasesMatched = this._lastCasesMatched || matched;
2112
        this._lastCaseCheckIndex++;
2113
        if (this._lastCaseCheckIndex === this._caseCount) {
2114
            this._updateDefaultCases(!this._lastCasesMatched);
2115
            this._lastCaseCheckIndex = 0;
2116
            this._lastCasesMatched = false;
2117
        }
2118
        return matched;
2119
    };
2120
    /**
2121
     * @param {?} useDefault
2122
     * @return {?}
2123
     */
2124
    NgSwitch.prototype._updateDefaultCases = function (useDefault) {
2125
        if (this._defaultViews && useDefault !== this._defaultUsed) {
2126
            this._defaultUsed = useDefault;
2127
            for (var /** @type {?} */ i = 0; i < this._defaultViews.length; i++) {
2128
                var /** @type {?} */ defaultView = this._defaultViews[i];
2129
                defaultView.enforceState(useDefault);
2130
            }
2131
        }
2132
    };
2133
    return NgSwitch;
2134
}());
2135
NgSwitch.decorators = [
2136
    { type: Directive, args: [{ selector: '[ngSwitch]' },] },
2137
];
2138
/**
2139
 * @nocollapse
2140
 */
2141
NgSwitch.ctorParameters = function () { return []; };
2142
NgSwitch.propDecorators = {
2143
    'ngSwitch': [{ type: Input },],
2144
};
2145
/**
2146
 * \@ngModule CommonModule
2147
 *
2148
 * \@whatItDoes Creates a view that will be added/removed from the parent {\@link NgSwitch} when the
2149
 *             given expression evaluate to respectively the same/different value as the switch
2150
 *             expression.
2151
 *
2152
 * \@howToUse
2153
 * ```
2154
 * <container-element [ngSwitch]="switch_expression">
2155
 *   <some-element *ngSwitchCase="match_expression_1">...</some-element>
2156
 * </container-element>
2157
 * ```
2158
 * \@description
2159
 *
2160
 * Insert the sub-tree when the expression evaluates to the same value as the enclosing switch
2161
 * expression.
2162
 *
2163
 * If multiple match expressions match the switch expression value, all of them are displayed.
2164
 *
2165
 * See {\@link NgSwitch} for more details and example.
2166
 *
2167
 * \@stable
2168
 */
2169
var NgSwitchCase = (function () {
2170
    /**
2171
     * @param {?} viewContainer
2172
     * @param {?} templateRef
2173
     * @param {?} ngSwitch
2174
     */
2175
    function NgSwitchCase(viewContainer, templateRef, ngSwitch) {
2176
        this.ngSwitch = ngSwitch;
2177
        ngSwitch._addCase();
2178
        this._view = new SwitchView(viewContainer, templateRef);
2179
    }
2180
    /**
2181
     * @return {?}
2182
     */
2183
    NgSwitchCase.prototype.ngDoCheck = function () { this._view.enforceState(this.ngSwitch._matchCase(this.ngSwitchCase)); };
2184
    return NgSwitchCase;
2185
}());
2186
NgSwitchCase.decorators = [
2187
    { type: Directive, args: [{ selector: '[ngSwitchCase]' },] },
2188
];
2189
/**
2190
 * @nocollapse
2191
 */
2192
NgSwitchCase.ctorParameters = function () { return [
2193
    { type: ViewContainerRef, },
2194
    { type: TemplateRef, },
2195
    { type: NgSwitch, decorators: [{ type: Host },] },
2196
]; };
2197
NgSwitchCase.propDecorators = {
2198
    'ngSwitchCase': [{ type: Input },],
2199
};
2200
/**
2201
 * \@ngModule CommonModule
2202
 * \@whatItDoes Creates a view that is added to the parent {\@link NgSwitch} when no case expressions
2203
 * match the
2204
 *             switch expression.
2205
 *
2206
 * \@howToUse
2207
 * ```
2208
 * <container-element [ngSwitch]="switch_expression">
2209
 *   <some-element *ngSwitchCase="match_expression_1">...</some-element>
2210
 *   <some-other-element *ngSwitchDefault>...</some-other-element>
2211
 * </container-element>
2212
 * ```
2213
 *
2214
 * \@description
2215
 *
2216
 * Insert the sub-tree when no case expressions evaluate to the same value as the enclosing switch
2217
 * expression.
2218
 *
2219
 * See {\@link NgSwitch} for more details and example.
2220
 *
2221
 * \@stable
2222
 */
2223
var NgSwitchDefault = (function () {
2224
    /**
2225
     * @param {?} viewContainer
2226
     * @param {?} templateRef
2227
     * @param {?} ngSwitch
2228
     */
2229
    function NgSwitchDefault(viewContainer, templateRef, ngSwitch) {
2230
        ngSwitch._addDefault(new SwitchView(viewContainer, templateRef));
2231
    }
2232
    return NgSwitchDefault;
2233
}());
2234
NgSwitchDefault.decorators = [
2235
    { type: Directive, args: [{ selector: '[ngSwitchDefault]' },] },
2236
];
2237
/**
2238
 * @nocollapse
2239
 */
2240
NgSwitchDefault.ctorParameters = function () { return [
2241
    { type: ViewContainerRef, },
2242
    { type: TemplateRef, },
2243
    { type: NgSwitch, decorators: [{ type: Host },] },
2244
]; };
2245
/**
2246
 * @license
2247
 * Copyright Google Inc. All Rights Reserved.
2248
 *
2249
 * Use of this source code is governed by an MIT-style license that can be
2250
 * found in the LICENSE file at https://angular.io/license
2251
 */
2252
/**
2253
 * \@ngModule CommonModule
2254
 *
2255
 * \@whatItDoes Adds / removes DOM sub-trees based on a numeric value. Tailored for pluralization.
2256
 *
2257
 * \@howToUse
2258
 * ```
2259
 * <some-element [ngPlural]="value">
2260
 *   <ng-template ngPluralCase="=0">there is nothing</ng-template>
2261
 *   <ng-template ngPluralCase="=1">there is one</ng-template>
2262
 *   <ng-template ngPluralCase="few">there are a few</ng-template>
2263
 * </some-element>
2264
 * ```
2265
 *
2266
 * \@description
2267
 *
2268
 * Displays DOM sub-trees that match the switch expression value, or failing that, DOM sub-trees
2269
 * that match the switch expression's pluralization category.
2270
 *
2271
 * To use this directive you must provide a container element that sets the `[ngPlural]` attribute
2272
 * to a switch expression. Inner elements with a `[ngPluralCase]` will display based on their
2273
 * expression:
2274
 * - if `[ngPluralCase]` is set to a value starting with `=`, it will only display if the value
2275
 *   matches the switch expression exactly,
2276
 * - otherwise, the view will be treated as a "category match", and will only display if exact
2277
 *   value matches aren't found and the value maps to its category for the defined locale.
2278
 *
2279
 * See http://cldr.unicode.org/index/cldr-spec/plural-rules
2280
 *
2281
 * \@experimental
2282
 */
2283
var NgPlural = (function () {
2284
    /**
2285
     * @param {?} _localization
2286
     */
2287
    function NgPlural(_localization) {
2288
        this._localization = _localization;
2289
        this._caseViews = {};
2290
    }
2291
    Object.defineProperty(NgPlural.prototype, "ngPlural", {
2292
        /**
2293
         * @param {?} value
2294
         * @return {?}
2295
         */
2296
        set: function (value) {
2297
            this._switchValue = value;
2298
            this._updateView();
2299
        },
2300
        enumerable: true,
2301
        configurable: true
2302
    });
2303
    /**
2304
     * @param {?} value
2305
     * @param {?} switchView
2306
     * @return {?}
2307
     */
2308
    NgPlural.prototype.addCase = function (value, switchView) { this._caseViews[value] = switchView; };
2309
    /**
2310
     * @return {?}
2311
     */
2312
    NgPlural.prototype._updateView = function () {
2313
        this._clearViews();
2314
        var /** @type {?} */ cases = Object.keys(this._caseViews);
2315
        var /** @type {?} */ key = getPluralCategory(this._switchValue, cases, this._localization);
2316
        this._activateView(this._caseViews[key]);
2317
    };
2318
    /**
2319
     * @return {?}
2320
     */
2321
    NgPlural.prototype._clearViews = function () {
2322
        if (this._activeView)
2323
            this._activeView.destroy();
2324
    };
2325
    /**
2326
     * @param {?} view
2327
     * @return {?}
2328
     */
2329
    NgPlural.prototype._activateView = function (view) {
2330
        if (view) {
2331
            this._activeView = view;
2332
            this._activeView.create();
2333
        }
2334
    };
2335
    return NgPlural;
2336
}());
2337
NgPlural.decorators = [
2338
    { type: Directive, args: [{ selector: '[ngPlural]' },] },
2339
];
2340
/**
2341
 * @nocollapse
2342
 */
2343
NgPlural.ctorParameters = function () { return [
2344
    { type: NgLocalization, },
2345
]; };
2346
NgPlural.propDecorators = {
2347
    'ngPlural': [{ type: Input },],
2348
};
2349
/**
2350
 * \@ngModule CommonModule
2351
 *
2352
 * \@whatItDoes Creates a view that will be added/removed from the parent {\@link NgPlural} when the
2353
 *             given expression matches the plural expression according to CLDR rules.
2354
 *
2355
 * \@howToUse
2356
 * ```
2357
 * <some-element [ngPlural]="value">
2358
 *   <ng-template ngPluralCase="=0">...</ng-template>
2359
 *   <ng-template ngPluralCase="other">...</ng-template>
2360
 * </some-element>
2361
 * ```
2362
 *
2363
 * See {\@link NgPlural} for more details and example.
2364
 *
2365
 * \@experimental
2366
 */
2367
var NgPluralCase = (function () {
2368
    /**
2369
     * @param {?} value
2370
     * @param {?} template
2371
     * @param {?} viewContainer
2372
     * @param {?} ngPlural
2373
     */
2374
    function NgPluralCase(value, template, viewContainer, ngPlural) {
2375
        this.value = value;
2376
        var isANumber = !isNaN(Number(value));
2377
        ngPlural.addCase(isANumber ? "=" + value : value, new SwitchView(viewContainer, template));
2378
    }
2379
    return NgPluralCase;
2380
}());
2381
NgPluralCase.decorators = [
2382
    { type: Directive, args: [{ selector: '[ngPluralCase]' },] },
2383
];
2384
/**
2385
 * @nocollapse
2386
 */
2387
NgPluralCase.ctorParameters = function () { return [
2388
    { type: undefined, decorators: [{ type: Attribute, args: ['ngPluralCase',] },] },
2389
    { type: TemplateRef, },
2390
    { type: ViewContainerRef, },
2391
    { type: NgPlural, decorators: [{ type: Host },] },
2392
]; };
2393
/**
2394
 * @license
2395
 * Copyright Google Inc. All Rights Reserved.
2396
 *
2397
 * Use of this source code is governed by an MIT-style license that can be
2398
 * found in the LICENSE file at https://angular.io/license
2399
 */
2400
/**
2401
 * \@ngModule CommonModule
2402
 *
2403
 * \@whatItDoes Update an HTML element styles.
2404
 *
2405
 * \@howToUse
2406
 * ```
2407
 * <some-element [ngStyle]="{'font-style': styleExp}">...</some-element>
2408
 *
2409
 * <some-element [ngStyle]="{'max-width.px': widthExp}">...</some-element>
2410
 *
2411
 * <some-element [ngStyle]="objExp">...</some-element>
2412
 * ```
2413
 *
2414
 * \@description
2415
 *
2416
 * The styles are updated according to the value of the expression evaluation:
2417
 * - keys are style names with an optional `.<unit>` suffix (ie 'top.px', 'font-style.em'),
2418
 * - values are the values assigned to those properties (expressed in the given unit).
2419
 *
2420
 * \@stable
2421
 */
2422
var NgStyle = (function () {
2423
    /**
2424
     * @param {?} _differs
2425
     * @param {?} _ngEl
2426
     * @param {?} _renderer
2427
     */
2428
    function NgStyle(_differs, _ngEl, _renderer) {
2429
        this._differs = _differs;
2430
        this._ngEl = _ngEl;
2431
        this._renderer = _renderer;
2432
    }
2433
    Object.defineProperty(NgStyle.prototype, "ngStyle", {
2434
        /**
2435
         * @param {?} v
2436
         * @return {?}
2437
         */
2438
        set: function (v) {
2439
            this._ngStyle = v;
2440
            if (!this._differ && v) {
2441
                this._differ = this._differs.find(v).create();
2442
            }
2443
        },
2444
        enumerable: true,
2445
        configurable: true
2446
    });
2447
    /**
2448
     * @return {?}
2449
     */
2450
    NgStyle.prototype.ngDoCheck = function () {
2451
        if (this._differ) {
2452
            var /** @type {?} */ changes = this._differ.diff(this._ngStyle);
2453
            if (changes) {
2454
                this._applyChanges(changes);
2455
            }
2456
        }
2457
    };
2458
    /**
2459
     * @param {?} changes
2460
     * @return {?}
2461
     */
2462
    NgStyle.prototype._applyChanges = function (changes) {
2463
        var _this = this;
2464
        changes.forEachRemovedItem(function (record) { return _this._setStyle(record.key, null); });
2465
        changes.forEachAddedItem(function (record) { return _this._setStyle(record.key, record.currentValue); });
2466
        changes.forEachChangedItem(function (record) { return _this._setStyle(record.key, record.currentValue); });
2467
    };
2468
    /**
2469
     * @param {?} nameAndUnit
2470
     * @param {?} value
2471
     * @return {?}
2472
     */
2473
    NgStyle.prototype._setStyle = function (nameAndUnit, value) {
2474
        var _a = nameAndUnit.split('.'), name = _a[0], unit = _a[1];
2475
        value = value != null && unit ? "" + value + unit : value;
2476
        this._renderer.setElementStyle(this._ngEl.nativeElement, name, /** @type {?} */ (value));
2477
    };
2478
    return NgStyle;
2479
}());
2480
NgStyle.decorators = [
2481
    { type: Directive, args: [{ selector: '[ngStyle]' },] },
2482
];
2483
/**
2484
 * @nocollapse
2485
 */
2486
NgStyle.ctorParameters = function () { return [
2487
    { type: KeyValueDiffers, },
2488
    { type: ElementRef, },
2489
    { type: Renderer, },
2490
]; };
2491
NgStyle.propDecorators = {
2492
    'ngStyle': [{ type: Input },],
2493
};
2494
/**
2495
 * @license
2496
 * Copyright Google Inc. All Rights Reserved.
2497
 *
2498
 * Use of this source code is governed by an MIT-style license that can be
2499
 * found in the LICENSE file at https://angular.io/license
2500
 */
2501
/**
2502
 * \@ngModule CommonModule
2503
 *
2504
 * \@whatItDoes Inserts an embedded view from a prepared `TemplateRef`
2505
 *
2506
 * \@howToUse
2507
 * ```
2508
 * <ng-container *ngTemplateOutlet="templateRefExp; context: contextExp"></ng-container>
2509
 * ```
2510
 *
2511
 * \@description
2512
 *
2513
 * You can attach a context object to the `EmbeddedViewRef` by setting `[ngTemplateOutletContext]`.
2514
 * `[ngTemplateOutletContext]` should be an object, the object's keys will be available for binding
2515
 * by the local template `let` declarations.
2516
 *
2517
 * Note: using the key `$implicit` in the context object will set it's value as default.
2518
 *
2519
 * ## Example
2520
 *
2521
 * {\@example common/ngTemplateOutlet/ts/module.ts region='NgTemplateOutlet'}
2522
 *
2523
 * \@experimental
2524
 */
2525
var NgTemplateOutlet = (function () {
2526
    /**
2527
     * @param {?} _viewContainerRef
2528
     */
2529
    function NgTemplateOutlet(_viewContainerRef) {
2530
        this._viewContainerRef = _viewContainerRef;
2531
    }
2532
    Object.defineProperty(NgTemplateOutlet.prototype, "ngOutletContext", {
2533
        /**
2534
         * @deprecated v4.0.0 - Renamed to ngTemplateOutletContext.
2535
         * @param {?} context
2536
         * @return {?}
2537
         */
2538
        set: function (context) { this.ngTemplateOutletContext = context; },
2539
        enumerable: true,
2540
        configurable: true
2541
    });
2542
    /**
2543
     * @param {?} changes
2544
     * @return {?}
2545
     */
2546
    NgTemplateOutlet.prototype.ngOnChanges = function (changes) {
2547
        if (this._viewRef) {
2548
            this._viewContainerRef.remove(this._viewContainerRef.indexOf(this._viewRef));
2549
        }
2550
        if (this.ngTemplateOutlet) {
2551
            this._viewRef = this._viewContainerRef.createEmbeddedView(this.ngTemplateOutlet, this.ngTemplateOutletContext);
2552
        }
2553
    };
2554
    return NgTemplateOutlet;
2555
}());
2556
NgTemplateOutlet.decorators = [
2557
    { type: Directive, args: [{ selector: '[ngTemplateOutlet]' },] },
2558
];
2559
/**
2560
 * @nocollapse
2561
 */
2562
NgTemplateOutlet.ctorParameters = function () { return [
2563
    { type: ViewContainerRef, },
2564
]; };
2565
NgTemplateOutlet.propDecorators = {
2566
    'ngTemplateOutletContext': [{ type: Input },],
2567
    'ngTemplateOutlet': [{ type: Input },],
2568
    'ngOutletContext': [{ type: Input },],
2569
};
2570
/**
2571
 * @license
2572
 * Copyright Google Inc. All Rights Reserved.
2573
 *
2574
 * Use of this source code is governed by an MIT-style license that can be
2575
 * found in the LICENSE file at https://angular.io/license
2576
 */
2577
/**
2578
 * A collection of Angular directives that are likely to be used in each and every Angular
2579
 * application.
2580
 */
2581
var COMMON_DIRECTIVES = [
2582
    NgClass,
2583
    NgComponentOutlet,
2584
    NgForOf,
2585
    NgIf,
2586
    NgTemplateOutlet,
2587
    NgStyle,
2588
    NgSwitch,
2589
    NgSwitchCase,
2590
    NgSwitchDefault,
2591
    NgPlural,
2592
    NgPluralCase,
2593
];
2594
/**
2595
 * A collection of deprecated directives that are no longer part of the core module.
2596
 */
2597
/**
2598
 * @license
2599
 * Copyright Google Inc. All Rights Reserved.
2600
 *
2601
 * Use of this source code is governed by an MIT-style license that can be
2602
 * found in the LICENSE file at https://angular.io/license
2603
 */
2604
/**
2605
 * @param {?} type
2606
 * @param {?} value
2607
 * @return {?}
2608
 */
2609
function invalidPipeArgumentError(type, value) {
2610
    return Error("InvalidPipeArgument: '" + value + "' for pipe '" + ɵstringify(type) + "'");
2611
}
2612
/**
2613
 * @license
2614
 * Copyright Google Inc. All Rights Reserved.
2615
 *
2616
 * Use of this source code is governed by an MIT-style license that can be
2617
 * found in the LICENSE file at https://angular.io/license
2618
 */
2619
var ObservableStrategy = (function () {
2620
    function ObservableStrategy() {
2621
    }
2622
    /**
2623
     * @param {?} async
2624
     * @param {?} updateLatestValue
2625
     * @return {?}
2626
     */
2627
    ObservableStrategy.prototype.createSubscription = function (async, updateLatestValue) {
2628
        return async.subscribe({ next: updateLatestValue, error: function (e) { throw e; } });
2629
    };
2630
    /**
2631
     * @param {?} subscription
2632
     * @return {?}
2633
     */
2634
    ObservableStrategy.prototype.dispose = function (subscription) { subscription.unsubscribe(); };
2635
    /**
2636
     * @param {?} subscription
2637
     * @return {?}
2638
     */
2639
    ObservableStrategy.prototype.onDestroy = function (subscription) { subscription.unsubscribe(); };
2640
    return ObservableStrategy;
2641
}());
2642
var PromiseStrategy = (function () {
2643
    function PromiseStrategy() {
2644
    }
2645
    /**
2646
     * @param {?} async
2647
     * @param {?} updateLatestValue
2648
     * @return {?}
2649
     */
2650
    PromiseStrategy.prototype.createSubscription = function (async, updateLatestValue) {
2651
        return async.then(updateLatestValue, function (e) { throw e; });
2652
    };
2653
    /**
2654
     * @param {?} subscription
2655
     * @return {?}
2656
     */
2657
    PromiseStrategy.prototype.dispose = function (subscription) { };
2658
    /**
2659
     * @param {?} subscription
2660
     * @return {?}
2661
     */
2662
    PromiseStrategy.prototype.onDestroy = function (subscription) { };
2663
    return PromiseStrategy;
2664
}());
2665
var _promiseStrategy = new PromiseStrategy();
2666
var _observableStrategy = new ObservableStrategy();
2667
/**
2668
 * \@ngModule CommonModule
2669
 * \@whatItDoes Unwraps a value from an asynchronous primitive.
2670
 * \@howToUse `observable_or_promise_expression | async`
2671
 * \@description
2672
 * The `async` pipe subscribes to an `Observable` or `Promise` and returns the latest value it has
2673
 * emitted. When a new value is emitted, the `async` pipe marks the component to be checked for
2674
 * changes. When the component gets destroyed, the `async` pipe unsubscribes automatically to avoid
2675
 * potential memory leaks.
2676
 *
2677
 *
2678
 * ## Examples
2679
 *
2680
 * This example binds a `Promise` to the view. Clicking the `Resolve` button resolves the
2681
 * promise.
2682
 *
2683
 * {\@example common/pipes/ts/async_pipe.ts region='AsyncPipePromise'}
2684
 *
2685
 * It's also possible to use `async` with Observables. The example below binds the `time` Observable
2686
 * to the view. The Observable continuously updates the view with the current time.
2687
 *
2688
 * {\@example common/pipes/ts/async_pipe.ts region='AsyncPipeObservable'}
2689
 *
2690
 * \@stable
2691
 */
2692
var AsyncPipe = (function () {
2693
    /**
2694
     * @param {?} _ref
2695
     */
2696
    function AsyncPipe(_ref) {
2697
        this._ref = _ref;
2698
        this._latestValue = null;
2699
        this._latestReturnedValue = null;
2700
        this._subscription = null;
2701
        this._obj = null;
2702
        this._strategy = ((null));
2703
    }
2704
    /**
2705
     * @return {?}
2706
     */
2707
    AsyncPipe.prototype.ngOnDestroy = function () {
2708
        if (this._subscription) {
2709
            this._dispose();
2710
        }
2711
    };
2712
    /**
2713
     * @param {?} obj
2714
     * @return {?}
2715
     */
2716
    AsyncPipe.prototype.transform = function (obj) {
2717
        if (!this._obj) {
2718
            if (obj) {
2719
                this._subscribe(obj);
2720
            }
2721
            this._latestReturnedValue = this._latestValue;
2722
            return this._latestValue;
2723
        }
2724
        if (obj !== this._obj) {
2725
            this._dispose();
2726
            return this.transform(/** @type {?} */ (obj));
2727
        }
2728
        if (this._latestValue === this._latestReturnedValue) {
2729
            return this._latestReturnedValue;
2730
        }
2731
        this._latestReturnedValue = this._latestValue;
2732
        return WrappedValue.wrap(this._latestValue);
2733
    };
2734
    /**
2735
     * @param {?} obj
2736
     * @return {?}
2737
     */
2738
    AsyncPipe.prototype._subscribe = function (obj) {
2739
        var _this = this;
2740
        this._obj = obj;
2741
        this._strategy = this._selectStrategy(obj);
2742
        this._subscription = this._strategy.createSubscription(obj, function (value) { return _this._updateLatestValue(obj, value); });
2743
    };
2744
    /**
2745
     * @param {?} obj
2746
     * @return {?}
2747
     */
2748
    AsyncPipe.prototype._selectStrategy = function (obj) {
2749
        if (ɵisPromise(obj)) {
2750
            return _promiseStrategy;
2751
        }
2752
        if (ɵisObservable(obj)) {
2753
            return _observableStrategy;
2754
        }
2755
        throw invalidPipeArgumentError(AsyncPipe, obj);
2756
    };
2757
    /**
2758
     * @return {?}
2759
     */
2760
    AsyncPipe.prototype._dispose = function () {
2761
        this._strategy.dispose(/** @type {?} */ ((this._subscription)));
2762
        this._latestValue = null;
2763
        this._latestReturnedValue = null;
2764
        this._subscription = null;
2765
        this._obj = null;
2766
    };
2767
    /**
2768
     * @param {?} async
2769
     * @param {?} value
2770
     * @return {?}
2771
     */
2772
    AsyncPipe.prototype._updateLatestValue = function (async, value) {
2773
        if (async === this._obj) {
2774
            this._latestValue = value;
2775
            this._ref.markForCheck();
2776
        }
2777
    };
2778
    return AsyncPipe;
2779
}());
2780
AsyncPipe.decorators = [
2781
    { type: Pipe, args: [{ name: 'async', pure: false },] },
2782
];
2783
/**
2784
 * @nocollapse
2785
 */
2786
AsyncPipe.ctorParameters = function () { return [
2787
    { type: ChangeDetectorRef, },
2788
]; };
2789
/**
2790
 * @license
2791
 * Copyright Google Inc. All Rights Reserved.
2792
 *
2793
 * Use of this source code is governed by an MIT-style license that can be
2794
 * found in the LICENSE file at https://angular.io/license
2795
 */
2796
/**
2797
 * Transforms text to lowercase.
2798
 *
2799
 * {\@example  common/pipes/ts/lowerupper_pipe.ts region='LowerUpperPipe' }
2800
 *
2801
 * \@stable
2802
 */
2803
var LowerCasePipe = (function () {
2804
    function LowerCasePipe() {
2805
    }
2806
    /**
2807
     * @param {?} value
2808
     * @return {?}
2809
     */
2810
    LowerCasePipe.prototype.transform = function (value) {
2811
        if (!value)
2812
            return value;
2813
        if (typeof value !== 'string') {
2814
            throw invalidPipeArgumentError(LowerCasePipe, value);
2815
        }
2816
        return value.toLowerCase();
2817
    };
2818
    return LowerCasePipe;
2819
}());
2820
LowerCasePipe.decorators = [
2821
    { type: Pipe, args: [{ name: 'lowercase' },] },
2822
];
2823
/**
2824
 * @nocollapse
2825
 */
2826
LowerCasePipe.ctorParameters = function () { return []; };
2827
/**
2828
 * Helper method to transform a single word to titlecase.
2829
 *
2830
 * \@stable
2831
 * @param {?} word
2832
 * @return {?}
2833
 */
2834
function titleCaseWord(word) {
2835
    if (!word)
2836
        return word;
2837
    return word[0].toUpperCase() + word.substr(1).toLowerCase();
2838
}
2839
/**
2840
 * Transforms text to titlecase.
2841
 *
2842
 * \@stable
2843
 */
2844
var TitleCasePipe = (function () {
2845
    function TitleCasePipe() {
2846
    }
2847
    /**
2848
     * @param {?} value
2849
     * @return {?}
2850
     */
2851
    TitleCasePipe.prototype.transform = function (value) {
2852
        if (!value)
2853
            return value;
2854
        if (typeof value !== 'string') {
2855
            throw invalidPipeArgumentError(TitleCasePipe, value);
2856
        }
2857
        return value.split(/\b/g).map(function (word) { return titleCaseWord(word); }).join('');
2858
    };
2859
    return TitleCasePipe;
2860
}());
2861
TitleCasePipe.decorators = [
2862
    { type: Pipe, args: [{ name: 'titlecase' },] },
2863
];
2864
/**
2865
 * @nocollapse
2866
 */
2867
TitleCasePipe.ctorParameters = function () { return []; };
2868
/**
2869
 * Transforms text to uppercase.
2870
 *
2871
 * \@stable
2872
 */
2873
var UpperCasePipe = (function () {
2874
    function UpperCasePipe() {
2875
    }
2876
    /**
2877
     * @param {?} value
2878
     * @return {?}
2879
     */
2880
    UpperCasePipe.prototype.transform = function (value) {
2881
        if (!value)
2882
            return value;
2883
        if (typeof value !== 'string') {
2884
            throw invalidPipeArgumentError(UpperCasePipe, value);
2885
        }
2886
        return value.toUpperCase();
2887
    };
2888
    return UpperCasePipe;
2889
}());
2890
UpperCasePipe.decorators = [
2891
    { type: Pipe, args: [{ name: 'uppercase' },] },
2892
];
2893
/**
2894
 * @nocollapse
2895
 */
2896
UpperCasePipe.ctorParameters = function () { return []; };
2897
var NumberFormatStyle = {};
2898
NumberFormatStyle.Decimal = 0;
2899
NumberFormatStyle.Percent = 1;
2900
NumberFormatStyle.Currency = 2;
2901
NumberFormatStyle[NumberFormatStyle.Decimal] = "Decimal";
2902
NumberFormatStyle[NumberFormatStyle.Percent] = "Percent";
2903
NumberFormatStyle[NumberFormatStyle.Currency] = "Currency";
2904
var NumberFormatter = (function () {
2905
    function NumberFormatter() {
2906
    }
2907
    /**
2908
     * @param {?} num
2909
     * @param {?} locale
2910
     * @param {?} style
2911
     * @param {?=} opts
2912
     * @return {?}
2913
     */
2914
    NumberFormatter.format = function (num, locale, style, opts) {
2915
        if (opts === void 0) { opts = {}; }
2916
        var minimumIntegerDigits = opts.minimumIntegerDigits, minimumFractionDigits = opts.minimumFractionDigits, maximumFractionDigits = opts.maximumFractionDigits, currency = opts.currency, _a = opts.currencyAsSymbol, currencyAsSymbol = _a === void 0 ? false : _a;
2917
        var /** @type {?} */ options = {
2918
            minimumIntegerDigits: minimumIntegerDigits,
2919
            minimumFractionDigits: minimumFractionDigits,
2920
            maximumFractionDigits: maximumFractionDigits,
2921
            style: NumberFormatStyle[style].toLowerCase()
2922
        };
2923
        if (style == NumberFormatStyle.Currency) {
2924
            options.currency = typeof currency == 'string' ? currency : undefined;
2925
            options.currencyDisplay = currencyAsSymbol ? 'symbol' : 'code';
2926
        }
2927
        return new Intl.NumberFormat(locale, options).format(num);
2928
    };
2929
    return NumberFormatter;
2930
}());
2931
var DATE_FORMATS_SPLIT = /((?:[^yMLdHhmsazZEwGjJ']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|J+|j+|m+|s+|a|z|Z|G+|w+))(.*)/;
2932
var PATTERN_ALIASES = {
2933
    // Keys are quoted so they do not get renamed during closure compilation.
2934
    'yMMMdjms': datePartGetterFactory(combine([
2935
        digitCondition('year', 1),
2936
        nameCondition('month', 3),
2937
        digitCondition('day', 1),
2938
        digitCondition('hour', 1),
2939
        digitCondition('minute', 1),
2940
        digitCondition('second', 1),
2941
    ])),
2942
    'yMdjm': datePartGetterFactory(combine([
2943
        digitCondition('year', 1), digitCondition('month', 1), digitCondition('day', 1),
2944
        digitCondition('hour', 1), digitCondition('minute', 1)
2945
    ])),
2946
    'yMMMMEEEEd': datePartGetterFactory(combine([
2947
        digitCondition('year', 1), nameCondition('month', 4), nameCondition('weekday', 4),
2948
        digitCondition('day', 1)
2949
    ])),
2950
    'yMMMMd': datePartGetterFactory(combine([digitCondition('year', 1), nameCondition('month', 4), digitCondition('day', 1)])),
2951
    'yMMMd': datePartGetterFactory(combine([digitCondition('year', 1), nameCondition('month', 3), digitCondition('day', 1)])),
2952
    'yMd': datePartGetterFactory(combine([digitCondition('year', 1), digitCondition('month', 1), digitCondition('day', 1)])),
2953
    'jms': datePartGetterFactory(combine([digitCondition('hour', 1), digitCondition('second', 1), digitCondition('minute', 1)])),
2954
    'jm': datePartGetterFactory(combine([digitCondition('hour', 1), digitCondition('minute', 1)]))
2955
};
2956
var DATE_FORMATS = {
2957
    // Keys are quoted so they do not get renamed.
2958
    'yyyy': datePartGetterFactory(digitCondition('year', 4)),
2959
    'yy': datePartGetterFactory(digitCondition('year', 2)),
2960
    'y': datePartGetterFactory(digitCondition('year', 1)),
2961
    'MMMM': datePartGetterFactory(nameCondition('month', 4)),
2962
    'MMM': datePartGetterFactory(nameCondition('month', 3)),
2963
    'MM': datePartGetterFactory(digitCondition('month', 2)),
2964
    'M': datePartGetterFactory(digitCondition('month', 1)),
2965
    'LLLL': datePartGetterFactory(nameCondition('month', 4)),
2966
    'L': datePartGetterFactory(nameCondition('month', 1)),
2967
    'dd': datePartGetterFactory(digitCondition('day', 2)),
2968
    'd': datePartGetterFactory(digitCondition('day', 1)),
2969
    'HH': digitModifier(hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 2), false)))),
2970
    'H': hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), false))),
2971
    'hh': digitModifier(hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 2), true)))),
2972
    'h': hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))),
2973
    'jj': datePartGetterFactory(digitCondition('hour', 2)),
2974
    'j': datePartGetterFactory(digitCondition('hour', 1)),
2975
    'mm': digitModifier(datePartGetterFactory(digitCondition('minute', 2))),
2976
    'm': datePartGetterFactory(digitCondition('minute', 1)),
2977
    'ss': digitModifier(datePartGetterFactory(digitCondition('second', 2))),
2978
    's': datePartGetterFactory(digitCondition('second', 1)),
2979
    // while ISO 8601 requires fractions to be prefixed with `.` or `,`
2980
    // we can be just safely rely on using `sss` since we currently don't support single or two digit
2981
    // fractions
2982
    'sss': datePartGetterFactory(digitCondition('second', 3)),
2983
    'EEEE': datePartGetterFactory(nameCondition('weekday', 4)),
2984
    'EEE': datePartGetterFactory(nameCondition('weekday', 3)),
2985
    'EE': datePartGetterFactory(nameCondition('weekday', 2)),
2986
    'E': datePartGetterFactory(nameCondition('weekday', 1)),
2987
    'a': hourClockExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))),
2988
    'Z': timeZoneGetter('short'),
2989
    'z': timeZoneGetter('long'),
2990
    'ww': datePartGetterFactory({}),
2991
    // first Thursday of the year. not support ?
2992
    'w': datePartGetterFactory({}),
2993
    // of the year not support ?
2994
    'G': datePartGetterFactory(nameCondition('era', 1)),
2995
    'GG': datePartGetterFactory(nameCondition('era', 2)),
2996
    'GGG': datePartGetterFactory(nameCondition('era', 3)),
2997
    'GGGG': datePartGetterFactory(nameCondition('era', 4))
2998
};
2999
/**
3000
 * @param {?} inner
3001
 * @return {?}
3002
 */
3003
function digitModifier(inner) {
3004
    return function (date, locale) {
3005
        var /** @type {?} */ result = inner(date, locale);
3006
        return result.length == 1 ? '0' + result : result;
3007
    };
3008
}
3009
/**
3010
 * @param {?} inner
3011
 * @return {?}
3012
 */
3013
function hourClockExtractor(inner) {
3014
    return function (date, locale) { return inner(date, locale).split(' ')[1]; };
3015
}
3016
/**
3017
 * @param {?} inner
3018
 * @return {?}
3019
 */
3020
function hourExtractor(inner) {
3021
    return function (date, locale) { return inner(date, locale).split(' ')[0]; };
3022
}
3023
/**
3024
 * @param {?} date
3025
 * @param {?} locale
3026
 * @param {?} options
3027
 * @return {?}
3028
 */
3029
function intlDateFormat(date, locale, options) {
3030
    return new Intl.DateTimeFormat(locale, options).format(date).replace(/[\u200e\u200f]/g, '');
3031
}
3032
/**
3033
 * @param {?} timezone
3034
 * @return {?}
3035
 */
3036
function timeZoneGetter(timezone) {
3037
    // To workaround `Intl` API restriction for single timezone let format with 24 hours
3038
    var /** @type {?} */ options = { hour: '2-digit', hour12: false, timeZoneName: timezone };
3039
    return function (date, locale) {
3040
        var /** @type {?} */ result = intlDateFormat(date, locale, options);
3041
        // Then extract first 3 letters that related to hours
3042
        return result ? result.substring(3) : '';
3043
    };
3044
}
3045
/**
3046
 * @param {?} options
3047
 * @param {?} value
3048
 * @return {?}
3049
 */
3050
function hour12Modify(options, value) {
3051
    options.hour12 = value;
3052
    return options;
3053
}
3054
/**
3055
 * @param {?} prop
3056
 * @param {?} len
3057
 * @return {?}
3058
 */
3059
function digitCondition(prop, len) {
3060
    var /** @type {?} */ result = {};
3061
    result[prop] = len === 2 ? '2-digit' : 'numeric';
3062
    return result;
3063
}
3064
/**
3065
 * @param {?} prop
3066
 * @param {?} len
3067
 * @return {?}
3068
 */
3069
function nameCondition(prop, len) {
3070
    var /** @type {?} */ result = {};
3071
    if (len < 4) {
3072
        result[prop] = len > 1 ? 'short' : 'narrow';
3073
    }
3074
    else {
3075
        result[prop] = 'long';
3076
    }
3077
    return result;
3078
}
3079
/**
3080
 * @param {?} options
3081
 * @return {?}
3082
 */
3083
function combine(options) {
3084
    return options.reduce(function (merged, opt) { return (Object.assign({}, merged, opt)); }, {});
3085
}
3086
/**
3087
 * @param {?} ret
3088
 * @return {?}
3089
 */
3090
function datePartGetterFactory(ret) {
3091
    return function (date, locale) { return intlDateFormat(date, locale, ret); };
3092
}
3093
var DATE_FORMATTER_CACHE = new Map();
3094
/**
3095
 * @param {?} format
3096
 * @param {?} date
3097
 * @param {?} locale
3098
 * @return {?}
3099
 */
3100
function dateFormatter(format, date, locale) {
3101
    var /** @type {?} */ fn = PATTERN_ALIASES[format];
3102
    if (fn)
3103
        return fn(date, locale);
3104
    var /** @type {?} */ cacheKey = format;
3105
    var /** @type {?} */ parts = DATE_FORMATTER_CACHE.get(cacheKey);
3106
    if (!parts) {
3107
        parts = [];
3108
        var /** @type {?} */ match = void 0;
3109
        DATE_FORMATS_SPLIT.exec(format);
3110
        var /** @type {?} */ _format = format;
3111
        while (_format) {
3112
            match = DATE_FORMATS_SPLIT.exec(_format);
3113
            if (match) {
3114
                parts = parts.concat(match.slice(1));
3115
                _format = ((parts.pop()));
3116
            }
3117
            else {
3118
                parts.push(_format);
3119
                _format = null;
3120
            }
3121
        }
3122
        DATE_FORMATTER_CACHE.set(cacheKey, parts);
3123
    }
3124
    return parts.reduce(function (text, part) {
3125
        var /** @type {?} */ fn = DATE_FORMATS[part];
3126
        return text + (fn ? fn(date, locale) : partToTime(part));
3127
    }, '');
3128
}
3129
/**
3130
 * @param {?} part
3131
 * @return {?}
3132
 */
3133
function partToTime(part) {
3134
    return part === '\'\'' ? '\'' : part.replace(/(^'|'$)/g, '').replace(/''/g, '\'');
3135
}
3136
var DateFormatter = (function () {
3137
    function DateFormatter() {
3138
    }
3139
    /**
3140
     * @param {?} date
3141
     * @param {?} locale
3142
     * @param {?} pattern
3143
     * @return {?}
3144
     */
3145
    DateFormatter.format = function (date, locale, pattern) {
3146
        return dateFormatter(pattern, date, locale);
3147
    };
3148
    return DateFormatter;
3149
}());
3150
/**
3151
 * @license
3152
 * Copyright Google Inc. All Rights Reserved.
3153
 *
3154
 * Use of this source code is governed by an MIT-style license that can be
3155
 * found in the LICENSE file at https://angular.io/license
3156
 */
3157
var _NUMBER_FORMAT_REGEXP = /^(\d+)?\.((\d+)(-(\d+))?)?$/;
3158
/**
3159
 * @param {?} pipe
3160
 * @param {?} locale
3161
 * @param {?} value
3162
 * @param {?} style
3163
 * @param {?=} digits
3164
 * @param {?=} currency
3165
 * @param {?=} currencyAsSymbol
3166
 * @return {?}
3167
 */
3168
function formatNumber(pipe, locale, value, style, digits, currency, currencyAsSymbol) {
3169
    if (currency === void 0) { currency = null; }
3170
    if (currencyAsSymbol === void 0) { currencyAsSymbol = false; }
3171
    if (value == null)
3172
        return null;
3173
    // Convert strings to numbers
3174
    value = typeof value === 'string' && isNumeric(value) ? +value : value;
3175
    if (typeof value !== 'number') {
3176
        throw invalidPipeArgumentError(pipe, value);
3177
    }
3178
    var /** @type {?} */ minInt = undefined;
3179
    var /** @type {?} */ minFraction = undefined;
3180
    var /** @type {?} */ maxFraction = undefined;
3181
    if (style !== NumberFormatStyle.Currency) {
3182
        // rely on Intl default for currency
3183
        minInt = 1;
3184
        minFraction = 0;
3185
        maxFraction = 3;
3186
    }
3187
    if (digits) {
3188
        var /** @type {?} */ parts = digits.match(_NUMBER_FORMAT_REGEXP);
3189
        if (parts === null) {
3190
            throw new Error(digits + " is not a valid digit info for number pipes");
3191
        }
3192
        if (parts[1] != null) {
3193
            minInt = parseIntAutoRadix(parts[1]);
3194
        }
3195
        if (parts[3] != null) {
3196
            minFraction = parseIntAutoRadix(parts[3]);
3197
        }
3198
        if (parts[5] != null) {
3199
            maxFraction = parseIntAutoRadix(parts[5]);
3200
        }
3201
    }
3202
    return NumberFormatter.format(/** @type {?} */ (value), locale, style, {
3203
        minimumIntegerDigits: minInt,
3204
        minimumFractionDigits: minFraction,
3205
        maximumFractionDigits: maxFraction,
3206
        currency: currency,
3207
        currencyAsSymbol: currencyAsSymbol,
3208
    });
3209
}
3210
/**
3211
 * \@ngModule CommonModule
3212
 * \@whatItDoes Formats a number according to locale rules.
3213
 * \@howToUse `number_expression | number[:digitInfo]`
3214
 *
3215
 * Formats a number as text. Group sizing and separator and other locale-specific
3216
 * configurations are based on the active locale.
3217
 *
3218
 * where `expression` is a number:
3219
 *  - `digitInfo` is a `string` which has a following format: <br>
3220
 *     <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>
3221
 *   - `minIntegerDigits` is the minimum number of integer digits to use. Defaults to `1`.
3222
 *   - `minFractionDigits` is the minimum number of digits after fraction. Defaults to `0`.
3223
 *   - `maxFractionDigits` is the maximum number of digits after fraction. Defaults to `3`.
3224
 *
3225
 * For more information on the acceptable range for each of these numbers and other
3226
 * details see your native internationalization library.
3227
 *
3228
 * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers
3229
 * and may require a polyfill. See [Browser Support](guide/browser-support) for details.
3230
 *
3231
 * ### Example
3232
 *
3233
 * {\@example common/pipes/ts/number_pipe.ts region='NumberPipe'}
3234
 *
3235
 * \@stable
3236
 */
3237
var DecimalPipe = (function () {
3238
    /**
3239
     * @param {?} _locale
3240
     */
3241
    function DecimalPipe(_locale) {
3242
        this._locale = _locale;
3243
    }
3244
    /**
3245
     * @param {?} value
3246
     * @param {?=} digits
3247
     * @return {?}
3248
     */
3249
    DecimalPipe.prototype.transform = function (value, digits) {
3250
        return formatNumber(DecimalPipe, this._locale, value, NumberFormatStyle.Decimal, digits);
3251
    };
3252
    return DecimalPipe;
3253
}());
3254
DecimalPipe.decorators = [
3255
    { type: Pipe, args: [{ name: 'number' },] },
3256
];
3257
/**
3258
 * @nocollapse
3259
 */
3260
DecimalPipe.ctorParameters = function () { return [
3261
    { type: undefined, decorators: [{ type: Inject, args: [LOCALE_ID,] },] },
3262
]; };
3263
/**
3264
 * \@ngModule CommonModule
3265
 * \@whatItDoes Formats a number as a percentage according to locale rules.
3266
 * \@howToUse `number_expression | percent[:digitInfo]`
3267
 *
3268
 * \@description
3269
 *
3270
 * Formats a number as percentage.
3271
 *
3272
 * - `digitInfo` See {\@link DecimalPipe} for detailed description.
3273
 *
3274
 * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers
3275
 * and may require a polyfill. See [Browser Support](guide/browser-support) for details.
3276
 *
3277
 * ### Example
3278
 *
3279
 * {\@example common/pipes/ts/number_pipe.ts region='PercentPipe'}
3280
 *
3281
 * \@stable
3282
 */
3283
var PercentPipe = (function () {
3284
    /**
3285
     * @param {?} _locale
3286
     */
3287
    function PercentPipe(_locale) {
3288
        this._locale = _locale;
3289
    }
3290
    /**
3291
     * @param {?} value
3292
     * @param {?=} digits
3293
     * @return {?}
3294
     */
3295
    PercentPipe.prototype.transform = function (value, digits) {
3296
        return formatNumber(PercentPipe, this._locale, value, NumberFormatStyle.Percent, digits);
3297
    };
3298
    return PercentPipe;
3299
}());
3300
PercentPipe.decorators = [
3301
    { type: Pipe, args: [{ name: 'percent' },] },
3302
];
3303
/**
3304
 * @nocollapse
3305
 */
3306
PercentPipe.ctorParameters = function () { return [
3307
    { type: undefined, decorators: [{ type: Inject, args: [LOCALE_ID,] },] },
3308
]; };
3309
/**
3310
 * \@ngModule CommonModule
3311
 * \@whatItDoes Formats a number as currency using locale rules.
3312
 * \@howToUse `number_expression | currency[:currencyCode[:symbolDisplay[:digitInfo]]]`
3313
 * \@description
3314
 *
3315
 * Use `currency` to format a number as currency.
3316
 *
3317
 * - `currencyCode` is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, such
3318
 *    as `USD` for the US dollar and `EUR` for the euro.
3319
 * - `symbolDisplay` is a boolean indicating whether to use the currency symbol or code.
3320
 *   - `true`: use symbol (e.g. `$`).
3321
 *   - `false`(default): use code (e.g. `USD`).
3322
 * - `digitInfo` See {\@link DecimalPipe} for detailed description.
3323
 *
3324
 * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers
3325
 * and may require a polyfill. See [Browser Support](guide/browser-support) for details.
3326
 *
3327
 * ### Example
3328
 *
3329
 * {\@example common/pipes/ts/number_pipe.ts region='CurrencyPipe'}
3330
 *
3331
 * \@stable
3332
 */
3333
var CurrencyPipe = (function () {
3334
    /**
3335
     * @param {?} _locale
3336
     */
3337
    function CurrencyPipe(_locale) {
3338
        this._locale = _locale;
3339
    }
3340
    /**
3341
     * @param {?} value
3342
     * @param {?=} currencyCode
3343
     * @param {?=} symbolDisplay
3344
     * @param {?=} digits
3345
     * @return {?}
3346
     */
3347
    CurrencyPipe.prototype.transform = function (value, currencyCode, symbolDisplay, digits) {
3348
        if (currencyCode === void 0) { currencyCode = 'USD'; }
3349
        if (symbolDisplay === void 0) { symbolDisplay = false; }
3350
        return formatNumber(CurrencyPipe, this._locale, value, NumberFormatStyle.Currency, digits, currencyCode, symbolDisplay);
3351
    };
3352
    return CurrencyPipe;
3353
}());
3354
CurrencyPipe.decorators = [
3355
    { type: Pipe, args: [{ name: 'currency' },] },
3356
];
3357
/**
3358
 * @nocollapse
3359
 */
3360
CurrencyPipe.ctorParameters = function () { return [
3361
    { type: undefined, decorators: [{ type: Inject, args: [LOCALE_ID,] },] },
3362
]; };
3363
/**
3364
 * @param {?} text
3365
 * @return {?}
3366
 */
3367
function parseIntAutoRadix(text) {
3368
    var /** @type {?} */ result = parseInt(text);
3369
    if (isNaN(result)) {
3370
        throw new Error('Invalid integer literal when parsing ' + text);
3371
    }
3372
    return result;
3373
}
3374
/**
3375
 * @param {?} value
3376
 * @return {?}
3377
 */
3378
function isNumeric(value) {
3379
    return !isNaN(value - parseFloat(value));
3380
}
3381
/**
3382
 * @license
3383
 * Copyright Google Inc. All Rights Reserved.
3384
 *
3385
 * Use of this source code is governed by an MIT-style license that can be
3386
 * found in the LICENSE file at https://angular.io/license
3387
 */
3388
var ISO8601_DATE_REGEX = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
3389
/**
3390
 * \@ngModule CommonModule
3391
 * \@whatItDoes Formats a date according to locale rules.
3392
 * \@howToUse `date_expression | date[:format]`
3393
 * \@description
3394
 *
3395
 * Where:
3396
 * - `expression` is a date object or a number (milliseconds since UTC epoch) or an ISO string
3397
 * (https://www.w3.org/TR/NOTE-datetime).
3398
 * - `format` indicates which date/time components to include. The format can be predefined as
3399
 *   shown below or custom as shown in the table.
3400
 *   - `'medium'`: equivalent to `'yMMMdjms'` (e.g. `Sep 3, 2010, 12:05:08 PM` for `en-US`)
3401
 *   - `'short'`: equivalent to `'yMdjm'` (e.g. `9/3/2010, 12:05 PM` for `en-US`)
3402
 *   - `'fullDate'`: equivalent to `'yMMMMEEEEd'` (e.g. `Friday, September 3, 2010` for `en-US`)
3403
 *   - `'longDate'`: equivalent to `'yMMMMd'` (e.g. `September 3, 2010` for `en-US`)
3404
 *   - `'mediumDate'`: equivalent to `'yMMMd'` (e.g. `Sep 3, 2010` for `en-US`)
3405
 *   - `'shortDate'`: equivalent to `'yMd'` (e.g. `9/3/2010` for `en-US`)
3406
 *   - `'mediumTime'`: equivalent to `'jms'` (e.g. `12:05:08 PM` for `en-US`)
3407
 *   - `'shortTime'`: equivalent to `'jm'` (e.g. `12:05 PM` for `en-US`)
3408
 *
3409
 *
3410
 *  | Component | Symbol | Narrow | Short Form   | Long Form         | Numeric   | 2-digit   |
3411
 *  |-----------|:------:|--------|--------------|-------------------|-----------|-----------|
3412
 *  | era       |   G    | G (A)  | GGG (AD)     | GGGG (Anno Domini)| -         | -         |
3413
 *  | year      |   y    | -      | -            | -                 | y (2015)  | yy (15)   |
3414
 *  | month     |   M    | L (S)  | MMM (Sep)    | MMMM (September)  | M (9)     | MM (09)   |
3415
 *  | day       |   d    | -      | -            | -                 | d (3)     | dd (03)   |
3416
 *  | weekday   |   E    | E (S)  | EEE (Sun)    | EEEE (Sunday)     | -         | -         |
3417
 *  | hour      |   j    | -      | -            | -                 | j (1 PM)  | jj (1 PM) |
3418
 *  | hour12    |   h    | -      | -            | -                 | h (1)     | hh (01)   |
3419
 *  | hour24    |   H    | -      | -            | -                 | H (13)    | HH (13)   |
3420
 *  | minute    |   m    | -      | -            | -                 | m (5)     | mm (05)   |
3421
 *  | second    |   s    | -      | -            | -                 | s (9)     | ss (09)   |
3422
 *  | timezone  |   z    | -      | -            | z (Pacific Standard Time)| -  | -         |
3423
 *  | timezone  |   Z    | -      | Z (GMT-8:00) | -                 | -         | -         |
3424
 *  | timezone  |   a    | -      | a (PM)       | -                 | -         | -         |
3425
 *
3426
 * In javascript, only the components specified will be respected (not the ordering,
3427
 * punctuations, ...) and details of the formatting will be dependent on the locale.
3428
 *
3429
 * Timezone of the formatted text will be the local system timezone of the end-user's machine.
3430
 *
3431
 * When the expression is a ISO string without time (e.g. 2016-09-19) the time zone offset is not
3432
 * applied and the formatted text will have the same day, month and year of the expression.
3433
 *
3434
 * WARNINGS:
3435
 * - this pipe is marked as pure hence it will not be re-evaluated when the input is mutated.
3436
 *   Instead users should treat the date as an immutable object and change the reference when the
3437
 *   pipe needs to re-run (this is to avoid reformatting the date on every change detection run
3438
 *   which would be an expensive operation).
3439
 * - this pipe uses the Internationalization API. Therefore it is only reliable in Chrome and Opera
3440
 *   browsers.
3441
 *
3442
 * ### Examples
3443
 *
3444
 * Assuming `dateObj` is (year: 2015, month: 6, day: 15, hour: 21, minute: 43, second: 11)
3445
 * in the _local_ time and locale is 'en-US':
3446
 *
3447
 * ```
3448
 *     {{ dateObj | date }}               // output is 'Jun 15, 2015'
3449
 *     {{ dateObj | date:'medium' }}      // output is 'Jun 15, 2015, 9:43:11 PM'
3450
 *     {{ dateObj | date:'shortTime' }}   // output is '9:43 PM'
3451
 *     {{ dateObj | date:'mmss' }}        // output is '43:11'
3452
 * ```
3453
 *
3454
 * {\@example common/pipes/ts/date_pipe.ts region='DatePipe'}
3455
 *
3456
 * \@stable
3457
 */
3458
var DatePipe = (function () {
3459
    /**
3460
     * @param {?} _locale
3461
     */
3462
    function DatePipe(_locale) {
3463
        this._locale = _locale;
3464
    }
3465
    /**
3466
     * @param {?} value
3467
     * @param {?=} pattern
3468
     * @return {?}
3469
     */
3470
    DatePipe.prototype.transform = function (value, pattern) {
3471
        if (pattern === void 0) { pattern = 'mediumDate'; }
3472
        var /** @type {?} */ date;
3473
        if (isBlank(value) || value !== value)
3474
            return null;
3475
        if (typeof value === 'string') {
3476
            value = value.trim();
3477
        }
3478
        if (isDate(value)) {
3479
            date = value;
3480
        }
3481
        else if (isNumeric(value)) {
3482
            date = new Date(parseFloat(value));
3483
        }
3484
        else if (typeof value === 'string' && /^(\d{4}-\d{1,2}-\d{1,2})$/.test(value)) {
3485
            /**
3486
             * For ISO Strings without time the day, month and year must be extracted from the ISO String
3487
             * before Date creation to avoid time offset and errors in the new Date.
3488
             * If we only replace '-' with ',' in the ISO String ("2015,01,01"), and try to create a new
3489
             * date, some browsers (e.g. IE 9) will throw an invalid Date error
3490
             * If we leave the '-' ("2015-01-01") and try to create a new Date("2015-01-01") the timeoffset
3491
             * is applied
3492
             * Note: ISO months are 0 for January, 1 for February, ...
3493
             */
3494
            var _a = value.split('-').map(function (val) { return parseInt(val, 10); }), y = _a[0], m = _a[1], d = _a[2];
3495
            date = new Date(y, m - 1, d);
3496
        }
3497
        else {
3498
            date = new Date(value);
3499
        }
3500
        if (!isDate(date)) {
3501
            var /** @type {?} */ match = void 0;
3502
            if ((typeof value === 'string') && (match = value.match(ISO8601_DATE_REGEX))) {
3503
                date = isoStringToDate(match);
3504
            }
3505
            else {
3506
                throw invalidPipeArgumentError(DatePipe, value);
3507
            }
3508
        }
3509
        return DateFormatter.format(date, this._locale, DatePipe._ALIASES[pattern] || pattern);
3510
    };
3511
    return DatePipe;
3512
}());
3513
/**
3514
 * \@internal
3515
 */
3516
DatePipe._ALIASES = {
3517
    'medium': 'yMMMdjms',
3518
    'short': 'yMdjm',
3519
    'fullDate': 'yMMMMEEEEd',
3520
    'longDate': 'yMMMMd',
3521
    'mediumDate': 'yMMMd',
3522
    'shortDate': 'yMd',
3523
    'mediumTime': 'jms',
3524
    'shortTime': 'jm'
3525
};
3526
DatePipe.decorators = [
3527
    { type: Pipe, args: [{ name: 'date', pure: true },] },
3528
];
3529
/**
3530
 * @nocollapse
3531
 */
3532
DatePipe.ctorParameters = function () { return [
3533
    { type: undefined, decorators: [{ type: Inject, args: [LOCALE_ID,] },] },
3534
]; };
3535
/**
3536
 * @param {?} obj
3537
 * @return {?}
3538
 */
3539
function isBlank(obj) {
3540
    return obj == null || obj === '';
3541
}
3542
/**
3543
 * @param {?} obj
3544
 * @return {?}
3545
 */
3546
function isDate(obj) {
3547
    return obj instanceof Date && !isNaN(obj.valueOf());
3548
}
3549
/**
3550
 * @param {?} match
3551
 * @return {?}
3552
 */
3553
function isoStringToDate(match) {
3554
    var /** @type {?} */ date = new Date(0);
3555
    var /** @type {?} */ tzHour = 0;
3556
    var /** @type {?} */ tzMin = 0;
3557
    var /** @type {?} */ dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;
3558
    var /** @type {?} */ timeSetter = match[8] ? date.setUTCHours : date.setHours;
3559
    if (match[9]) {
3560
        tzHour = toInt(match[9] + match[10]);
3561
        tzMin = toInt(match[9] + match[11]);
3562
    }
3563
    dateSetter.call(date, toInt(match[1]), toInt(match[2]) - 1, toInt(match[3]));
3564
    var /** @type {?} */ h = toInt(match[4] || '0') - tzHour;
3565
    var /** @type {?} */ m = toInt(match[5] || '0') - tzMin;
3566
    var /** @type {?} */ s = toInt(match[6] || '0');
3567
    var /** @type {?} */ ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000);
3568
    timeSetter.call(date, h, m, s, ms);
3569
    return date;
3570
}
3571
/**
3572
 * @param {?} str
3573
 * @return {?}
3574
 */
3575
function toInt(str) {
3576
    return parseInt(str, 10);
3577
}
3578
/**
3579
 * @license
3580
 * Copyright Google Inc. All Rights Reserved.
3581
 *
3582
 * Use of this source code is governed by an MIT-style license that can be
3583
 * found in the LICENSE file at https://angular.io/license
3584
 */
3585
var _INTERPOLATION_REGEXP = /#/g;
3586
/**
3587
 * \@ngModule CommonModule
3588
 * \@whatItDoes Maps a value to a string that pluralizes the value according to locale rules.
3589
 * \@howToUse `expression | i18nPlural:mapping`
3590
 * \@description
3591
 *
3592
 *  Where:
3593
 *  - `expression` is a number.
3594
 *  - `mapping` is an object that mimics the ICU format, see
3595
 *    http://userguide.icu-project.org/formatparse/messages
3596
 *
3597
 *  ## Example
3598
 *
3599
 * {\@example common/pipes/ts/i18n_pipe.ts region='I18nPluralPipeComponent'}
3600
 *
3601
 * \@experimental
3602
 */
3603
var I18nPluralPipe = (function () {
3604
    /**
3605
     * @param {?} _localization
3606
     */
3607
    function I18nPluralPipe(_localization) {
3608
        this._localization = _localization;
3609
    }
3610
    /**
3611
     * @param {?} value
3612
     * @param {?} pluralMap
3613
     * @return {?}
3614
     */
3615
    I18nPluralPipe.prototype.transform = function (value, pluralMap) {
3616
        if (value == null)
3617
            return '';
3618
        if (typeof pluralMap !== 'object' || pluralMap === null) {
3619
            throw invalidPipeArgumentError(I18nPluralPipe, pluralMap);
3620
        }
3621
        var /** @type {?} */ key = getPluralCategory(value, Object.keys(pluralMap), this._localization);
3622
        return pluralMap[key].replace(_INTERPOLATION_REGEXP, value.toString());
3623
    };
3624
    return I18nPluralPipe;
3625
}());
3626
I18nPluralPipe.decorators = [
3627
    { type: Pipe, args: [{ name: 'i18nPlural', pure: true },] },
3628
];
3629
/**
3630
 * @nocollapse
3631
 */
3632
I18nPluralPipe.ctorParameters = function () { return [
3633
    { type: NgLocalization, },
3634
]; };
3635
/**
3636
 * @license
3637
 * Copyright Google Inc. All Rights Reserved.
3638
 *
3639
 * Use of this source code is governed by an MIT-style license that can be
3640
 * found in the LICENSE file at https://angular.io/license
3641
 */
3642
/**
3643
 * \@ngModule CommonModule
3644
 * \@whatItDoes Generic selector that displays the string that matches the current value.
3645
 * \@howToUse `expression | i18nSelect:mapping`
3646
 * \@description
3647
 *
3648
 *  Where `mapping` is an object that indicates the text that should be displayed
3649
 *  for different values of the provided `expression`.
3650
 *  If none of the keys of the mapping match the value of the `expression`, then the content
3651
 *  of the `other` key is returned when present, otherwise an empty string is returned.
3652
 *
3653
 *  ## Example
3654
 *
3655
 * {\@example common/pipes/ts/i18n_pipe.ts region='I18nSelectPipeComponent'}
3656
 *
3657
 *  \@experimental
3658
 */
3659
var I18nSelectPipe = (function () {
3660
    function I18nSelectPipe() {
3661
    }
3662
    /**
3663
     * @param {?} value
3664
     * @param {?} mapping
3665
     * @return {?}
3666
     */
3667
    I18nSelectPipe.prototype.transform = function (value, mapping) {
3668
        if (value == null)
3669
            return '';
3670
        if (typeof mapping !== 'object' || typeof value !== 'string') {
3671
            throw invalidPipeArgumentError(I18nSelectPipe, mapping);
3672
        }
3673
        if (mapping.hasOwnProperty(value)) {
3674
            return mapping[value];
3675
        }
3676
        if (mapping.hasOwnProperty('other')) {
3677
            return mapping['other'];
3678
        }
3679
        return '';
3680
    };
3681
    return I18nSelectPipe;
3682
}());
3683
I18nSelectPipe.decorators = [
3684
    { type: Pipe, args: [{ name: 'i18nSelect', pure: true },] },
3685
];
3686
/**
3687
 * @nocollapse
3688
 */
3689
I18nSelectPipe.ctorParameters = function () { return []; };
3690
/**
3691
 * @license
3692
 * Copyright Google Inc. All Rights Reserved.
3693
 *
3694
 * Use of this source code is governed by an MIT-style license that can be
3695
 * found in the LICENSE file at https://angular.io/license
3696
 */
3697
/**
3698
 * \@ngModule CommonModule
3699
 * \@whatItDoes Converts value into JSON string.
3700
 * \@howToUse `expression | json`
3701
 * \@description
3702
 *
3703
 * Converts value into string using `JSON.stringify`. Useful for debugging.
3704
 *
3705
 * ### Example
3706
 * {\@example common/pipes/ts/json_pipe.ts region='JsonPipe'}
3707
 *
3708
 * \@stable
3709
 */
3710
var JsonPipe = (function () {
3711
    function JsonPipe() {
3712
    }
3713
    /**
3714
     * @param {?} value
3715
     * @return {?}
3716
     */
3717
    JsonPipe.prototype.transform = function (value) { return JSON.stringify(value, null, 2); };
3718
    return JsonPipe;
3719
}());
3720
JsonPipe.decorators = [
3721
    { type: Pipe, args: [{ name: 'json', pure: false },] },
3722
];
3723
/**
3724
 * @nocollapse
3725
 */
3726
JsonPipe.ctorParameters = function () { return []; };
3727
/**
3728
 * @license
3729
 * Copyright Google Inc. All Rights Reserved.
3730
 *
3731
 * Use of this source code is governed by an MIT-style license that can be
3732
 * found in the LICENSE file at https://angular.io/license
3733
 */
3734
/**
3735
 * \@ngModule CommonModule
3736
 * \@whatItDoes Creates a new List or String containing a subset (slice) of the elements.
3737
 * \@howToUse `array_or_string_expression | slice:start[:end]`
3738
 * \@description
3739
 *
3740
 * Where the input expression is a `List` or `String`, and:
3741
 * - `start`: The starting index of the subset to return.
3742
 *   - **a positive integer**: return the item at `start` index and all items after
3743
 *     in the list or string expression.
3744
 *   - **a negative integer**: return the item at `start` index from the end and all items after
3745
 *     in the list or string expression.
3746
 *   - **if positive and greater than the size of the expression**: return an empty list or string.
3747
 *   - **if negative and greater than the size of the expression**: return entire list or string.
3748
 * - `end`: The ending index of the subset to return.
3749
 *   - **omitted**: return all items until the end.
3750
 *   - **if positive**: return all items before `end` index of the list or string.
3751
 *   - **if negative**: return all items before `end` index from the end of the list or string.
3752
 *
3753
 * All behavior is based on the expected behavior of the JavaScript API `Array.prototype.slice()`
3754
 * and `String.prototype.slice()`.
3755
 *
3756
 * When operating on a [List], the returned list is always a copy even when all
3757
 * the elements are being returned.
3758
 *
3759
 * When operating on a blank value, the pipe returns the blank value.
3760
 *
3761
 * ## List Example
3762
 *
3763
 * This `ngFor` example:
3764
 *
3765
 * {\@example common/pipes/ts/slice_pipe.ts region='SlicePipe_list'}
3766
 *
3767
 * produces the following:
3768
 *
3769
 *     <li>b</li>
3770
 *     <li>c</li>
3771
 *
3772
 * ## String Examples
3773
 *
3774
 * {\@example common/pipes/ts/slice_pipe.ts region='SlicePipe_string'}
3775
 *
3776
 * \@stable
3777
 */
3778
var SlicePipe = (function () {
3779
    function SlicePipe() {
3780
    }
3781
    /**
3782
     * @param {?} value
3783
     * @param {?} start
3784
     * @param {?=} end
3785
     * @return {?}
3786
     */
3787
    SlicePipe.prototype.transform = function (value, start, end) {
3788
        if (value == null)
3789
            return value;
3790
        if (!this.supports(value)) {
3791
            throw invalidPipeArgumentError(SlicePipe, value);
3792
        }
3793
        return value.slice(start, end);
3794
    };
3795
    /**
3796
     * @param {?} obj
3797
     * @return {?}
3798
     */
3799
    SlicePipe.prototype.supports = function (obj) { return typeof obj === 'string' || Array.isArray(obj); };
3800
    return SlicePipe;
3801
}());
3802
SlicePipe.decorators = [
3803
    { type: Pipe, args: [{ name: 'slice', pure: false },] },
3804
];
3805
/**
3806
 * @nocollapse
3807
 */
3808
SlicePipe.ctorParameters = function () { return []; };
3809
/**
3810
 * @license
3811
 * Copyright Google Inc. All Rights Reserved.
3812
 *
3813
 * Use of this source code is governed by an MIT-style license that can be
3814
 * found in the LICENSE file at https://angular.io/license
3815
 */
3816
/**
3817
 * @module
3818
 * @description
3819
 * This module provides a set of common Pipes.
3820
 */
3821
/**
3822
 * A collection of Angular pipes that are likely to be used in each and every application.
3823
 */
3824
var COMMON_PIPES = [
3825
    AsyncPipe,
3826
    UpperCasePipe,
3827
    LowerCasePipe,
3828
    JsonPipe,
3829
    SlicePipe,
3830
    DecimalPipe,
3831
    PercentPipe,
3832
    TitleCasePipe,
3833
    CurrencyPipe,
3834
    DatePipe,
3835
    I18nPluralPipe,
3836
    I18nSelectPipe,
3837
];
3838
/**
3839
 * @license
3840
 * Copyright Google Inc. All Rights Reserved.
3841
 *
3842
 * Use of this source code is governed by an MIT-style license that can be
3843
 * found in the LICENSE file at https://angular.io/license
3844
 */
3845
/**
3846
 * The module that includes all the basic Angular directives like {\@link NgIf}, {\@link NgForOf}, ...
3847
 *
3848
 * \@stable
3849
 */
3850
var CommonModule = (function () {
3851
    function CommonModule() {
3852
    }
3853
    return CommonModule;
3854
}());
3855
CommonModule.decorators = [
3856
    { type: NgModule, args: [{
3857
                declarations: [COMMON_DIRECTIVES, COMMON_PIPES],
3858
                exports: [COMMON_DIRECTIVES, COMMON_PIPES],
3859
                providers: [
3860
                    { provide: NgLocalization, useClass: NgLocaleLocalization },
3861
                ],
3862
            },] },
3863
];
3864
/**
3865
 * @nocollapse
3866
 */
3867
CommonModule.ctorParameters = function () { return []; };
3868
/**
3869
 * I18N pipes are being changed to move away from using the JS Intl API.
3870
 *
3871
 * The former pipes relying on the Intl API will be moved to this module while the `CommonModule`
3872
 * will contain the new pipes that do not rely on Intl.
3873
 *
3874
 * As a first step this module is created empty to ease the migration.
3875
 *
3876
 * see https://github.com/angular/angular/pull/18284
3877
 *
3878
 * @deprecated from v5
3879
 */
3880
var DeprecatedI18NPipesModule = (function () {
3881
    function DeprecatedI18NPipesModule() {
3882
    }
3883
    return DeprecatedI18NPipesModule;
3884
}());
3885
DeprecatedI18NPipesModule.decorators = [
3886
    { type: NgModule, args: [{ declarations: [], exports: [] },] },
3887
];
3888
/**
3889
 * @nocollapse
3890
 */
3891
DeprecatedI18NPipesModule.ctorParameters = function () { return []; };
3892
/**
3893
 * @license
3894
 * Copyright Google Inc. All Rights Reserved.
3895
 *
3896
 * Use of this source code is governed by an MIT-style license that can be
3897
 * found in the LICENSE file at https://angular.io/license
3898
 */
3899
/**
3900
 * A DI Token representing the main rendering context. In a browser this is the DOM Document.
3901
 *
3902
 * Note: Document might not be available in the Application Context when Application and Rendering
3903
 * Contexts are not the same (e.g. when running the application into a Web Worker).
3904
 *
3905
 * \@stable
3906
 */
3907
var DOCUMENT = new InjectionToken('DocumentToken');
3908
/**
3909
 * @license
3910
 * Copyright Google Inc. All Rights Reserved.
3911
 *
3912
 * Use of this source code is governed by an MIT-style license that can be
3913
 * found in the LICENSE file at https://angular.io/license
3914
 */
3915
var PLATFORM_BROWSER_ID = 'browser';
3916
var PLATFORM_SERVER_ID = 'server';
3917
var PLATFORM_WORKER_APP_ID = 'browserWorkerApp';
3918
var PLATFORM_WORKER_UI_ID = 'browserWorkerUi';
3919
/**
3920
 * Returns whether a platform id represents a browser platform.
3921
 * \@experimental
3922
 * @param {?} platformId
3923
 * @return {?}
3924
 */
3925
function isPlatformBrowser(platformId) {
3926
    return platformId === PLATFORM_BROWSER_ID;
3927
}
3928
/**
3929
 * Returns whether a platform id represents a server platform.
3930
 * \@experimental
3931
 * @param {?} platformId
3932
 * @return {?}
3933
 */
3934
function isPlatformServer(platformId) {
3935
    return platformId === PLATFORM_SERVER_ID;
3936
}
3937
/**
3938
 * Returns whether a platform id represents a web worker app platform.
3939
 * \@experimental
3940
 * @param {?} platformId
3941
 * @return {?}
3942
 */
3943
function isPlatformWorkerApp(platformId) {
3944
    return platformId === PLATFORM_WORKER_APP_ID;
3945
}
3946
/**
3947
 * Returns whether a platform id represents a web worker UI platform.
3948
 * \@experimental
3949
 * @param {?} platformId
3950
 * @return {?}
3951
 */
3952
function isPlatformWorkerUi(platformId) {
3953
    return platformId === PLATFORM_WORKER_UI_ID;
3954
}
3955
/**
3956
 * @license
3957
 * Copyright Google Inc. All Rights Reserved.
3958
 *
3959
 * Use of this source code is governed by an MIT-style license that can be
3960
 * found in the LICENSE file at https://angular.io/license
3961
 */
3962
/**
3963
 * @module
3964
 * @description
3965
 * Entry point for all public APIs of the common package.
3966
 */
3967
/**
3968
 * \@stable
3969
 */
3970
var VERSION = new Version('4.4.6');
3971
/**
3972
 * @license
3973
 * Copyright Google Inc. All Rights Reserved.
3974
 *
3975
 * Use of this source code is governed by an MIT-style license that can be
3976
 * found in the LICENSE file at https://angular.io/license
3977
 */
3978
/**
3979
 * @module
3980
 * @description
3981
 * Entry point for all public APIs of the common package.
3982
 */
3983
/**
3984
 * @license
3985
 * Copyright Google Inc. All Rights Reserved.
3986
 *
3987
 * Use of this source code is governed by an MIT-style license that can be
3988
 * found in the LICENSE file at https://angular.io/license
3989
 */
3990
/**
3991
 * @module
3992
 * @description
3993
 * Entry point for all public APIs of the common package.
3994
 */
3995
// This file only reexports content of the `src` folder. Keep it that way.
3996
/**
3997
 * Generated bundle index. Do not edit.
3998
 */
3999
export { NgLocaleLocalization, NgLocalization, parseCookieValue as ɵparseCookieValue, CommonModule, DeprecatedI18NPipesModule, NgClass, NgFor, NgForOf, NgForOfContext, NgIf, NgIfContext, NgPlural, NgPluralCase, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgTemplateOutlet, NgComponentOutlet, DOCUMENT, AsyncPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, JsonPipe, LowerCasePipe, CurrencyPipe, DecimalPipe, PercentPipe, SlicePipe, UpperCasePipe, TitleCasePipe, PLATFORM_BROWSER_ID as ɵPLATFORM_BROWSER_ID, PLATFORM_SERVER_ID as ɵPLATFORM_SERVER_ID, PLATFORM_WORKER_APP_ID as ɵPLATFORM_WORKER_APP_ID, PLATFORM_WORKER_UI_ID as ɵPLATFORM_WORKER_UI_ID, isPlatformBrowser, isPlatformServer, isPlatformWorkerApp, isPlatformWorkerUi, VERSION, PlatformLocation, LOCATION_INITIALIZED, LocationStrategy, APP_BASE_HREF, HashLocationStrategy, PathLocationStrategy, Location, COMMON_DIRECTIVES as ɵa, COMMON_PIPES as ɵb };
4000
//# sourceMappingURL=common.es5.js.map
(1-1/4)