@angular/core 6.0.0-rc.3 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/bundles/core-testing.umd.js +95 -19
  2. package/bundles/core-testing.umd.js.map +1 -1
  3. package/bundles/core-testing.umd.min.js +10 -11
  4. package/bundles/core-testing.umd.min.js.map +1 -1
  5. package/bundles/core.umd.js +555 -389
  6. package/bundles/core.umd.js.map +1 -1
  7. package/bundles/core.umd.min.js +77 -77
  8. package/bundles/core.umd.min.js.map +1 -1
  9. package/core.metadata.json +1 -1
  10. package/esm2015/index.js +2 -2
  11. package/esm2015/public_api.js +2 -2
  12. package/esm2015/src/application_ref.js +6 -6
  13. package/esm2015/src/change_detection/change_detection_util.js +3 -3
  14. package/esm2015/src/change_detection/change_detector_ref.js +2 -2
  15. package/esm2015/src/change_detection/constants.js +1 -1
  16. package/esm2015/src/change_detection/differs/default_iterable_differ.js +15 -15
  17. package/esm2015/src/change_detection/differs/default_keyvalue_differ.js +2 -2
  18. package/esm2015/src/change_detection/differs/iterable_differs.js +15 -7
  19. package/esm2015/src/change_detection/differs/keyvalue_differs.js +6 -6
  20. package/esm2015/src/change_detection/pipe_transform.js +2 -2
  21. package/esm2015/src/core.js +4 -4
  22. package/esm2015/src/core_private_export.js +2 -2
  23. package/esm2015/src/core_render3_private_export.js +2 -2
  24. package/esm2015/src/di/defs.js +36 -19
  25. package/esm2015/src/di/injectable.js +3 -3
  26. package/esm2015/src/di/injection_token.js +2 -2
  27. package/esm2015/src/di/injector.js +35 -14
  28. package/esm2015/src/di/metadata.js +11 -11
  29. package/esm2015/src/di/provider.js +9 -9
  30. package/esm2015/src/di/r3_injector.js +12 -12
  31. package/esm2015/src/di/reflective_errors.js +3 -3
  32. package/esm2015/src/di.js +1 -1
  33. package/esm2015/src/error_handler.js +2 -2
  34. package/esm2015/src/event_emitter.js +2 -2
  35. package/esm2015/src/linker/compiler.js +2 -2
  36. package/esm2015/src/linker/component_factory.js +3 -3
  37. package/esm2015/src/linker/component_factory_resolver.js +2 -2
  38. package/esm2015/src/linker/element_ref.js +3 -3
  39. package/esm2015/src/linker/ng_module_factory.js +2 -2
  40. package/esm2015/src/linker/ng_module_factory_loader.js +2 -2
  41. package/esm2015/src/linker/query_list.js +2 -2
  42. package/esm2015/src/linker/template_ref.js +2 -2
  43. package/esm2015/src/linker/view_container_ref.js +2 -2
  44. package/esm2015/src/linker/view_ref.js +2 -2
  45. package/esm2015/src/metadata/di.js +12 -12
  46. package/esm2015/src/metadata/directives.js +15 -15
  47. package/esm2015/src/metadata/lifecycle_hooks.js +10 -10
  48. package/esm2015/src/metadata/ng_module.js +5 -5
  49. package/esm2015/src/metadata/view.js +1 -1
  50. package/esm2015/src/render3/assert.js +13 -1
  51. package/esm2015/src/render3/component.js +2 -1
  52. package/esm2015/src/render3/definition.js +4 -4
  53. package/esm2015/src/render3/di.js +61 -89
  54. package/esm2015/src/render3/hooks.js +7 -7
  55. package/esm2015/src/render3/index.js +1 -1
  56. package/esm2015/src/render3/instructions.js +128 -79
  57. package/esm2015/src/render3/interfaces/definition.js +9 -1
  58. package/esm2015/src/render3/interfaces/injector.js +1 -3
  59. package/esm2015/src/render3/interfaces/node.js +7 -11
  60. package/esm2015/src/render3/interfaces/view.js +17 -3
  61. package/esm2015/src/render3/node_manipulation.js +23 -3
  62. package/esm2015/src/render3/query.js +9 -7
  63. package/esm2015/src/sanitization/security.js +2 -2
  64. package/esm2015/src/type.js +2 -2
  65. package/esm2015/src/util/decorators.js +2 -2
  66. package/esm2015/src/util/lang.js +2 -2
  67. package/esm2015/src/version.js +4 -4
  68. package/esm2015/src/view/ng_module.js +5 -2
  69. package/esm2015/src/view/refs.js +1 -1
  70. package/esm2015/testing/src/async.js +2 -2
  71. package/esm2015/testing/src/async_fallback.js +2 -2
  72. package/esm2015/testing/src/component_fixture.js +2 -2
  73. package/esm2015/testing/src/test_bed.js +3 -3
  74. package/esm5/src/application_ref.js +7 -7
  75. package/esm5/src/change_detection/change_detection_util.js +7 -7
  76. package/esm5/src/change_detection/change_detector_ref.js +4 -4
  77. package/esm5/src/change_detection/constants.js +4 -4
  78. package/esm5/src/change_detection/differs/default_iterable_differ.js +18 -18
  79. package/esm5/src/change_detection/differs/default_keyvalue_differ.js +3 -3
  80. package/esm5/src/change_detection/differs/iterable_differs.js +9 -11
  81. package/esm5/src/change_detection/differs/keyvalue_differs.js +4 -4
  82. package/esm5/src/change_detection/pipe_transform.js +1 -1
  83. package/esm5/src/core_private_export.js +2 -2
  84. package/esm5/src/core_render3_private_export.js +2 -2
  85. package/esm5/src/di/defs.js +3 -6
  86. package/esm5/src/di/injectable.js +2 -2
  87. package/esm5/src/di/injection_token.js +4 -4
  88. package/esm5/src/di/injector.js +26 -11
  89. package/esm5/src/di/metadata.js +6 -6
  90. package/esm5/src/di/provider.js +1 -1
  91. package/esm5/src/di/r3_injector.js +12 -12
  92. package/esm5/src/di/reflective_errors.js +3 -3
  93. package/esm5/src/di.js +2 -2
  94. package/esm5/src/error_handler.js +4 -4
  95. package/esm5/src/event_emitter.js +4 -4
  96. package/esm5/src/linker/compiler.js +2 -2
  97. package/esm5/src/linker/component_factory.js +7 -7
  98. package/esm5/src/linker/component_factory_resolver.js +2 -2
  99. package/esm5/src/linker/element_ref.js +4 -4
  100. package/esm5/src/linker/ng_module_factory.js +4 -4
  101. package/esm5/src/linker/ng_module_factory_loader.js +4 -4
  102. package/esm5/src/linker/query_list.js +4 -4
  103. package/esm5/src/linker/template_ref.js +4 -4
  104. package/esm5/src/linker/view_container_ref.js +4 -4
  105. package/esm5/src/linker/view_ref.js +4 -4
  106. package/esm5/src/metadata/di.js +9 -9
  107. package/esm5/src/metadata/directives.js +8 -8
  108. package/esm5/src/metadata/lifecycle_hooks.js +1 -1
  109. package/esm5/src/metadata/ng_module.js +3 -3
  110. package/esm5/src/metadata/view.js +4 -4
  111. package/esm5/src/render3/assert.js +6 -1
  112. package/esm5/src/render3/component.js +2 -1
  113. package/esm5/src/render3/definition.js +1 -1
  114. package/esm5/src/render3/di.js +51 -74
  115. package/esm5/src/render3/hooks.js +6 -6
  116. package/esm5/src/render3/index.js +1 -1
  117. package/esm5/src/render3/instructions.js +123 -76
  118. package/esm5/src/render3/interfaces/definition.js +1 -1
  119. package/esm5/src/render3/interfaces/injector.js +1 -1
  120. package/esm5/src/render3/interfaces/node.js +1 -1
  121. package/esm5/src/render3/interfaces/view.js +1 -1
  122. package/esm5/src/render3/node_manipulation.js +20 -2
  123. package/esm5/src/render3/query.js +9 -7
  124. package/esm5/src/sanitization/security.js +7 -7
  125. package/esm5/src/type.js +2 -2
  126. package/esm5/src/util/decorators.js +1 -1
  127. package/esm5/src/util/lang.js +2 -2
  128. package/esm5/src/version.js +6 -6
  129. package/esm5/src/view/ng_module.js +5 -2
  130. package/esm5/src/view/refs.js +1 -1
  131. package/esm5/testing/src/async.js +2 -2
  132. package/esm5/testing/src/async_fallback.js +2 -2
  133. package/esm5/testing/src/component_fixture.js +4 -4
  134. package/esm5/testing/src/test_bed.js +5 -5
  135. package/fesm2015/core.js +468 -372
  136. package/fesm2015/core.js.map +1 -1
  137. package/fesm2015/testing.js +6 -6
  138. package/fesm2015/testing.js.map +1 -1
  139. package/fesm5/core.js +403 -321
  140. package/fesm5/core.js.map +1 -1
  141. package/fesm5/testing.js +6 -6
  142. package/fesm5/testing.js.map +1 -1
  143. package/package.json +5 -4
  144. package/src/application_ref.d.ts +5 -5
  145. package/src/change_detection/change_detection_util.d.ts +2 -2
  146. package/src/change_detection/change_detector_ref.d.ts +1 -1
  147. package/src/change_detection/constants.d.ts +1 -1
  148. package/src/change_detection/differs/default_iterable_differ.d.ts +1 -1
  149. package/src/change_detection/differs/iterable_differs.d.ts +8 -7
  150. package/src/change_detection/differs/keyvalue_differs.d.ts +5 -5
  151. package/src/change_detection/pipe_transform.d.ts +1 -1
  152. package/src/core_private_export.d.ts +1 -1
  153. package/src/core_render3_private_export.d.ts +1 -1
  154. package/src/di/defs.d.ts +29 -10
  155. package/src/di/injectable.d.ts +3 -3
  156. package/src/di/injection_token.d.ts +3 -4
  157. package/src/di/injector.d.ts +14 -11
  158. package/src/di/metadata.d.ts +20 -20
  159. package/src/di/provider.d.ts +10 -10
  160. package/src/di/r3_injector.d.ts +3 -3
  161. package/src/di/reflective_errors.d.ts +2 -2
  162. package/src/di.d.ts +1 -1
  163. package/src/error_handler.d.ts +1 -1
  164. package/src/event_emitter.d.ts +1 -1
  165. package/src/linker/compiler.d.ts +1 -1
  166. package/src/linker/component_factory.d.ts +2 -2
  167. package/src/linker/component_factory_resolver.d.ts +1 -1
  168. package/src/linker/element_ref.d.ts +2 -2
  169. package/src/linker/ng_module_factory.d.ts +1 -1
  170. package/src/linker/ng_module_factory_loader.d.ts +1 -1
  171. package/src/linker/query_list.d.ts +1 -1
  172. package/src/linker/template_ref.d.ts +1 -1
  173. package/src/linker/view_container_ref.d.ts +1 -1
  174. package/src/linker/view_ref.d.ts +1 -1
  175. package/src/metadata/di.d.ts +21 -21
  176. package/src/metadata/directives.d.ts +28 -28
  177. package/src/metadata/lifecycle_hooks.d.ts +9 -9
  178. package/src/metadata/ng_module.d.ts +5 -5
  179. package/src/metadata/view.d.ts +1 -1
  180. package/src/render3/assert.d.ts +1 -0
  181. package/src/render3/definition.d.ts +3 -3
  182. package/src/render3/di.d.ts +4 -14
  183. package/src/render3/index.d.ts +2 -1
  184. package/src/render3/instructions.d.ts +3 -3
  185. package/src/render3/interfaces/definition.d.ts +23 -4
  186. package/src/render3/interfaces/injector.d.ts +0 -2
  187. package/src/render3/interfaces/node.d.ts +7 -13
  188. package/src/render3/interfaces/view.d.ts +16 -3
  189. package/src/render3/node_manipulation.d.ts +3 -2
  190. package/src/sanitization/security.d.ts +2 -2
  191. package/src/type.d.ts +1 -1
  192. package/src/util/decorators.d.ts +1 -1
  193. package/src/version.d.ts +2 -2
  194. package/testing/src/async.d.ts +1 -1
  195. package/testing/src/async_fallback.d.ts +1 -1
  196. package/testing/src/component_fixture.d.ts +1 -1
  197. package/testing/src/test_bed.d.ts +2 -2
  198. package/testing.d.ts +1 -1
@@ -1,14 +1,96 @@
1
1
  /**
2
- * @license Angular v6.0.0-rc.3
2
+ * @license Angular v6.0.0
3
3
  * (c) 2010-2018 Google, Inc. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
7
  (function (global, factory) {
8
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('tslib'), require('rxjs'), require('rxjs/operators')) :
9
- typeof define === 'function' && define.amd ? define(['exports', 'tslib', 'rxjs', 'rxjs/operators'], factory) :
10
- (factory((global.npm_package = {}),global.tslib,global.rxjs,global.rxjs.operators));
11
- }(this, (function (exports,tslib_1,rxjs,operators) { 'use strict';
8
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('rxjs'), require('rxjs/operators')) :
9
+ typeof define === 'function' && define.amd ? define('@angular/core', ['exports', 'rxjs', 'rxjs/operators'], factory) :
10
+ (factory((global.ng = global.ng || {}, global.ng.core = {}),global.rxjs,global.rxjs.operators));
11
+ }(this, (function (exports,rxjs,operators) { 'use strict';
12
+
13
+ /*! *****************************************************************************
14
+ Copyright (c) Microsoft Corporation. All rights reserved.
15
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
16
+ this file except in compliance with the License. You may obtain a copy of the
17
+ License at http://www.apache.org/licenses/LICENSE-2.0
18
+
19
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
20
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
21
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
22
+ MERCHANTABLITY OR NON-INFRINGEMENT.
23
+
24
+ See the Apache Version 2.0 License for specific language governing permissions
25
+ and limitations under the License.
26
+ ***************************************************************************** */
27
+ /* global Reflect, Promise */
28
+
29
+ var extendStatics = Object.setPrototypeOf ||
30
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
31
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
32
+
33
+ function __extends(d, b) {
34
+ extendStatics(d, b);
35
+ function __() { this.constructor = d; }
36
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
37
+ }
38
+
39
+ var __assign = Object.assign || function __assign(t) {
40
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
41
+ s = arguments[i];
42
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
43
+ }
44
+ return t;
45
+ };
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+ function __values(o) {
62
+ var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
63
+ if (m) return m.call(o);
64
+ return {
65
+ next: function () {
66
+ if (o && i >= o.length) o = void 0;
67
+ return { value: o && o[i++], done: !o };
68
+ }
69
+ };
70
+ }
71
+
72
+ function __read(o, n) {
73
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
74
+ if (!m) return o;
75
+ var i = m.call(o), r, ar = [], e;
76
+ try {
77
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
78
+ }
79
+ catch (error) { e = { error: error }; }
80
+ finally {
81
+ try {
82
+ if (r && !r.done && (m = i["return"])) m.call(i);
83
+ }
84
+ finally { if (e) throw e.error; }
85
+ }
86
+ return ar;
87
+ }
88
+
89
+ function __spread() {
90
+ for (var ar = [], i = 0; i < arguments.length; i++)
91
+ ar = ar.concat(__read(arguments[i]));
92
+ return ar;
93
+ }
12
94
 
13
95
  /**
14
96
  * @license
@@ -35,8 +117,7 @@
35
117
  */
36
118
  function defineInjectable(opts) {
37
119
  return {
38
- providedIn: opts.providedIn || null,
39
- factory: opts.factory,
120
+ providedIn: opts.providedIn || null, factory: opts.factory, value: undefined,
40
121
  };
41
122
  }
42
123
  /**
@@ -61,9 +142,7 @@ function defineInjectable(opts) {
61
142
  */
62
143
  function defineInjector(options) {
63
144
  return {
64
- factory: options.factory,
65
- providers: options.providers || [],
66
- imports: options.imports || [],
145
+ factory: options.factory, providers: options.providers || [], imports: options.imports || [],
67
146
  };
68
147
  }
69
148
 
@@ -110,7 +189,7 @@ function defineInjector(options) {
110
189
  *
111
190
  * {@example core/di/ts/injector_spec.ts region='InjectionToken'}
112
191
  *
113
- * @stable
192
+ *
114
193
  */
115
194
  var InjectionToken = /** @class */ (function () {
116
195
  function InjectionToken(_desc, options) {
@@ -152,12 +231,12 @@ function makeDecorator(name, props, parentClass, chainFn, typeFn) {
152
231
  args[_i] = arguments[_i];
153
232
  }
154
233
  if (this instanceof DecoratorFactory) {
155
- metaCtor.call.apply(metaCtor, tslib_1.__spread([this], args));
234
+ metaCtor.call.apply(metaCtor, __spread([this], args));
156
235
  return this;
157
236
  }
158
- var annotationInstance = new ((_a = DecoratorFactory).bind.apply(_a, tslib_1.__spread([void 0], args)))();
237
+ var annotationInstance = new ((_a = DecoratorFactory).bind.apply(_a, __spread([void 0], args)))();
159
238
  var TypeDecorator = function TypeDecorator(cls) {
160
- typeFn && typeFn.apply(void 0, tslib_1.__spread([cls], args));
239
+ typeFn && typeFn.apply(void 0, __spread([cls], args));
161
240
  // Use of Object.defineProperty is important since it creates non-enumerable property which
162
241
  // prevents the property is copied during subclassing.
163
242
  var annotations = cls.hasOwnProperty(ANNOTATIONS) ?
@@ -185,7 +264,7 @@ function makeMetadataCtor(props) {
185
264
  args[_i] = arguments[_i];
186
265
  }
187
266
  if (props) {
188
- var values = props.apply(void 0, tslib_1.__spread(args));
267
+ var values = props.apply(void 0, __spread(args));
189
268
  for (var propName in values) {
190
269
  this[propName] = values[propName];
191
270
  }
@@ -203,7 +282,7 @@ function makeParamDecorator(name, props, parentClass) {
203
282
  metaCtor.apply(this, args);
204
283
  return this;
205
284
  }
206
- var annotationInstance = new ((_a = ParamDecoratorFactory).bind.apply(_a, tslib_1.__spread([void 0], args)))();
285
+ var annotationInstance = new ((_a = ParamDecoratorFactory).bind.apply(_a, __spread([void 0], args)))();
207
286
  ParamDecorator.annotation = annotationInstance;
208
287
  return ParamDecorator;
209
288
  function ParamDecorator(cls, unusedKey, index) {
@@ -240,7 +319,7 @@ function makePropDecorator(name, props, parentClass) {
240
319
  metaCtor.apply(this, args);
241
320
  return this;
242
321
  }
243
- var decoratorInstance = new ((_a = PropDecoratorFactory).bind.apply(_a, tslib_1.__spread([void 0], args)))();
322
+ var decoratorInstance = new ((_a = PropDecoratorFactory).bind.apply(_a, __spread([void 0], args)))();
244
323
  return function PropDecorator(target, name) {
245
324
  var constructor = target.constructor;
246
325
  // Use of Object.defineProperty is important since it creates non-enumerable property which
@@ -306,7 +385,7 @@ var ANALYZE_FOR_ENTRY_COMPONENTS = new InjectionToken('AnalyzeForEntryComponents
306
385
  /**
307
386
  * Attribute decorator and metadata.
308
387
  *
309
- * @stable
388
+ *
310
389
  * @Annotation
311
390
  */
312
391
  var Attribute = makeParamDecorator('Attribute', function (attributeName) { return ({ attributeName: attributeName }); });
@@ -316,7 +395,7 @@ var Attribute = makeParamDecorator('Attribute', function (attributeName) { retur
316
395
  * See {@link ContentChildren}, {@link ContentChild}, {@link ViewChildren}, {@link ViewChild} for
317
396
  * more information.
318
397
  *
319
- * @stable
398
+ *
320
399
  */
321
400
  var Query = /** @class */ (function () {
322
401
  function Query() {
@@ -326,41 +405,41 @@ var Query = /** @class */ (function () {
326
405
  /**
327
406
  * ContentChildren decorator and metadata.
328
407
  *
329
- * @stable
408
+ *
330
409
  * @Annotation
331
410
  */
332
411
  var ContentChildren = makePropDecorator('ContentChildren', function (selector, data) {
333
412
  if (data === void 0) { data = {}; }
334
- return (tslib_1.__assign({ selector: selector, first: false, isViewQuery: false, descendants: false }, data));
413
+ return (__assign({ selector: selector, first: false, isViewQuery: false, descendants: false }, data));
335
414
  }, Query);
336
415
  /**
337
416
  * ContentChild decorator and metadata.
338
417
  *
339
- * @stable
418
+ *
340
419
  * @Annotation
341
420
  */
342
421
  var ContentChild = makePropDecorator('ContentChild', function (selector, data) {
343
422
  if (data === void 0) { data = {}; }
344
- return (tslib_1.__assign({ selector: selector, first: true, isViewQuery: false, descendants: true }, data));
423
+ return (__assign({ selector: selector, first: true, isViewQuery: false, descendants: true }, data));
345
424
  }, Query);
346
425
  /**
347
426
  * ViewChildren decorator and metadata.
348
427
  *
349
- * @stable
428
+ *
350
429
  * @Annotation
351
430
  */
352
431
  var ViewChildren = makePropDecorator('ViewChildren', function (selector, data) {
353
432
  if (data === void 0) { data = {}; }
354
- return (tslib_1.__assign({ selector: selector, first: false, isViewQuery: true, descendants: true }, data));
433
+ return (__assign({ selector: selector, first: false, isViewQuery: true, descendants: true }, data));
355
434
  }, Query);
356
435
  /**
357
436
  * ViewChild decorator and metadata.
358
437
  *
359
- * @stable
438
+ *
360
439
  * @Annotation
361
440
  */
362
441
  var ViewChild = makePropDecorator('ViewChild', function (selector, data) {
363
- return (tslib_1.__assign({ selector: selector, first: true, isViewQuery: true, descendants: true }, data));
442
+ return (__assign({ selector: selector, first: true, isViewQuery: true, descendants: true }, data));
364
443
  }, Query);
365
444
 
366
445
  /**
@@ -380,18 +459,18 @@ var ViewChild = makePropDecorator('ViewChild', function (selector, data) {
380
459
  /**
381
460
  * Describes within the change detector which strategy will be used the next time change
382
461
  * detection is triggered.
383
- * @stable
462
+ *
384
463
  */
385
464
  /**
386
465
  * Describes within the change detector which strategy will be used the next time change
387
466
  * detection is triggered.
388
- * @stable
467
+ *
389
468
  */
390
469
 
391
470
  /**
392
471
  * Describes within the change detector which strategy will be used the next time change
393
472
  * detection is triggered.
394
- * @stable
473
+ *
395
474
  */
396
475
  (function (ChangeDetectionStrategy) {
397
476
  /**
@@ -460,7 +539,7 @@ function isDefaultChangeDetectionStrategy(changeDetectionStrategy) {
460
539
  /**
461
540
  * Directive decorator and metadata.
462
541
  *
463
- * @stable
542
+ *
464
543
  * @Annotation
465
544
  */
466
545
  var Directive = makeDecorator('Directive', function (dir) {
@@ -470,12 +549,12 @@ var Directive = makeDecorator('Directive', function (dir) {
470
549
  /**
471
550
  * Component decorator and metadata.
472
551
  *
473
- * @stable
552
+ *
474
553
  * @Annotation
475
554
  */
476
555
  var Component = makeDecorator('Component', function (c) {
477
556
  if (c === void 0) { c = {}; }
478
- return (tslib_1.__assign({ changeDetection: exports.ChangeDetectionStrategy.Default }, c));
557
+ return (__assign({ changeDetection: exports.ChangeDetectionStrategy.Default }, c));
479
558
  }, Directive);
480
559
  /**
481
560
  * Pipe decorator and metadata.
@@ -486,35 +565,35 @@ var Component = makeDecorator('Component', function (c) {
486
565
  * To use the pipe include a reference to the pipe class in
487
566
  * {@link NgModule#declarations}.
488
567
  *
489
- * @stable
568
+ *
490
569
  * @Annotation
491
570
  */
492
- var Pipe = makeDecorator('Pipe', function (p) { return (tslib_1.__assign({ pure: true }, p)); });
571
+ var Pipe = makeDecorator('Pipe', function (p) { return (__assign({ pure: true }, p)); });
493
572
  /**
494
573
  * Input decorator and metadata.
495
574
  *
496
- * @stable
575
+ *
497
576
  * @Annotation
498
577
  */
499
578
  var Input = makePropDecorator('Input', function (bindingPropertyName) { return ({ bindingPropertyName: bindingPropertyName }); });
500
579
  /**
501
580
  * Output decorator and metadata.
502
581
  *
503
- * @stable
582
+ *
504
583
  * @Annotation
505
584
  */
506
585
  var Output = makePropDecorator('Output', function (bindingPropertyName) { return ({ bindingPropertyName: bindingPropertyName }); });
507
586
  /**
508
587
  * HostBinding decorator and metadata.
509
588
  *
510
- * @stable
589
+ *
511
590
  * @Annotation
512
591
  */
513
592
  var HostBinding = makePropDecorator('HostBinding', function (hostPropertyName) { return ({ hostPropertyName: hostPropertyName }); });
514
593
  /**
515
594
  * HostListener decorator and metadata.
516
595
  *
517
- * @stable
596
+ *
518
597
  * @Annotation
519
598
  */
520
599
  var HostListener = makePropDecorator('HostListener', function (eventName, args) { return ({ eventName: eventName, args: args }); });
@@ -534,7 +613,7 @@ var HostListener = makePropDecorator('HostListener', function (eventName, args)
534
613
  * An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by
535
614
  * the `MyCustomComponent` constructor function.
536
615
  *
537
- * @stable
616
+ *
538
617
  */
539
618
  var Type = Function;
540
619
  function isType(v) {
@@ -635,7 +714,7 @@ var ReflectionCapabilities = /** @class */ (function () {
635
714
  for (var _i = 0; _i < arguments.length; _i++) {
636
715
  args[_i] = arguments[_i];
637
716
  }
638
- return new (t.bind.apply(t, tslib_1.__spread([void 0], args)))();
717
+ return new (t.bind.apply(t, __spread([void 0], args)))();
639
718
  }; };
640
719
  /** @internal */
641
720
  /** @internal */
@@ -793,9 +872,9 @@ var ReflectionCapabilities = /** @class */ (function () {
793
872
  Object.keys(ownPropMetadata).forEach(function (propName) {
794
873
  var decorators = [];
795
874
  if (propMetadata.hasOwnProperty(propName)) {
796
- decorators.push.apply(decorators, tslib_1.__spread(propMetadata[propName]));
875
+ decorators.push.apply(decorators, __spread(propMetadata[propName]));
797
876
  }
798
- decorators.push.apply(decorators, tslib_1.__spread(ownPropMetadata[propName]));
877
+ decorators.push.apply(decorators, __spread(ownPropMetadata[propName]));
799
878
  propMetadata[propName] = decorators;
800
879
  });
801
880
  }
@@ -840,7 +919,7 @@ function convertTsickleDecoratorIntoMetadata(decoratorInvocations) {
840
919
  var decoratorType = decoratorInvocation.type;
841
920
  var annotationCls = decoratorType.annotationCls;
842
921
  var annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : [];
843
- return new (annotationCls.bind.apply(annotationCls, tslib_1.__spread([void 0], annotationArgs)))();
922
+ return new (annotationCls.bind.apply(annotationCls, __spread([void 0], annotationArgs)))();
844
923
  });
845
924
  }
846
925
  function getParentCtor(ctor) {
@@ -923,35 +1002,35 @@ function resolveForwardRef(type) {
923
1002
  /**
924
1003
  * Inject decorator and metadata.
925
1004
  *
926
- * @stable
1005
+ *
927
1006
  * @Annotation
928
1007
  */
929
1008
  var Inject = makeParamDecorator('Inject', function (token) { return ({ token: token }); });
930
1009
  /**
931
1010
  * Optional decorator and metadata.
932
1011
  *
933
- * @stable
1012
+ *
934
1013
  * @Annotation
935
1014
  */
936
1015
  var Optional = makeParamDecorator('Optional');
937
1016
  /**
938
1017
  * Self decorator and metadata.
939
1018
  *
940
- * @stable
1019
+ *
941
1020
  * @Annotation
942
1021
  */
943
1022
  var Self = makeParamDecorator('Self');
944
1023
  /**
945
1024
  * SkipSelf decorator and metadata.
946
1025
  *
947
- * @stable
1026
+ *
948
1027
  * @Annotation
949
1028
  */
950
1029
  var SkipSelf = makeParamDecorator('SkipSelf');
951
1030
  /**
952
1031
  * Host decorator and metadata.
953
1032
  *
954
- * @stable
1033
+ *
955
1034
  * @Annotation
956
1035
  */
957
1036
  var Host = makeParamDecorator('Host');
@@ -1007,7 +1086,7 @@ var NullInjector = /** @class */ (function () {
1007
1086
  * `Injector` returns itself when given `Injector` as a token:
1008
1087
  * {@example core/di/ts/injector_spec.ts region='injectInjector'}
1009
1088
  *
1010
- * @stable
1089
+ *
1011
1090
  */
1012
1091
  var Injector = /** @class */ (function () {
1013
1092
  function Injector() {
@@ -1202,7 +1281,7 @@ function tryResolveToken(token, record, records, parent, notFoundValue, flags) {
1202
1281
  }
1203
1282
  function resolveToken(token, record, records, parent, notFoundValue, flags) {
1204
1283
  var value;
1205
- if (record && !(flags & 1 /* SkipSelf */)) {
1284
+ if (record && !(flags & 4 /* SkipSelf */)) {
1206
1285
  // If we don't have a record, this implies that we don't own the provider hence don't know how
1207
1286
  // to resolve it.
1208
1287
  value = record.value;
@@ -1230,7 +1309,7 @@ function resolveToken(token, record, records, parent, notFoundValue, flags) {
1230
1309
  !childRecord && !(options & 4 /* CheckParent */) ? NULL_INJECTOR : parent, options & 1 /* Optional */ ? null : Injector.THROW_IF_NOT_FOUND, 0 /* Default */));
1231
1310
  }
1232
1311
  }
1233
- record.value = value = useNew ? new ((_a = fn).bind.apply(_a, tslib_1.__spread([void 0], deps)))() : fn.apply(obj, deps);
1312
+ record.value = value = useNew ? new ((_a = fn).bind.apply(_a, __spread([void 0], deps)))() : fn.apply(obj, deps);
1234
1313
  }
1235
1314
  }
1236
1315
  else if (!(flags & 2 /* Self */)) {
@@ -1310,18 +1389,34 @@ function getClosureSafeProperty$1(objWithPropertyToExtract) {
1310
1389
  }
1311
1390
  throw Error('!prop');
1312
1391
  }
1313
- var _currentInjector = null;
1392
+ /**
1393
+ * Current injector value used by `inject`.
1394
+ * - `undefined`: it is an error to call `inject`
1395
+ * - `null`: `inject` can be called but there is no injector (limp-mode).
1396
+ * - Injector instance: Use the injector for resolution.
1397
+ */
1398
+ var _currentInjector = undefined;
1314
1399
  function setCurrentInjector(injector) {
1315
1400
  var former = _currentInjector;
1316
1401
  _currentInjector = injector;
1317
1402
  return former;
1318
1403
  }
1319
- function inject(token, notFoundValue, flags) {
1404
+ function inject(token, flags) {
1320
1405
  if (flags === void 0) { flags = 0 /* Default */; }
1321
- if (_currentInjector === null) {
1406
+ if (_currentInjector === undefined) {
1322
1407
  throw new Error("inject() must be called from an injection context");
1323
1408
  }
1324
- return _currentInjector.get(token, notFoundValue, flags);
1409
+ else if (_currentInjector === null) {
1410
+ var injectableDef = token.ngInjectableDef;
1411
+ if (injectableDef && injectableDef.providedIn == 'root') {
1412
+ return injectableDef.value === undefined ? injectableDef.value = injectableDef.factory() :
1413
+ injectableDef.value;
1414
+ }
1415
+ throw new Error("Injector: NOT_FOUND [" + stringify(token) + "]");
1416
+ }
1417
+ else {
1418
+ return _currentInjector.get(token, flags & 8 /* Optional */ ? null : undefined, flags);
1419
+ }
1325
1420
  }
1326
1421
  function injectArgs(types) {
1327
1422
  var args = [];
@@ -1332,17 +1427,17 @@ function injectArgs(types) {
1332
1427
  throw new Error('Arguments array must have arguments.');
1333
1428
  }
1334
1429
  var type = undefined;
1335
- var defaultValue = undefined;
1430
+ var flags = 0;
1336
1431
  for (var j = 0; j < arg.length; j++) {
1337
1432
  var meta = arg[j];
1338
1433
  if (meta instanceof Optional || meta.__proto__.ngMetadataName === 'Optional') {
1339
- defaultValue = null;
1434
+ flags |= 8 /* Optional */;
1340
1435
  }
1341
1436
  else if (meta instanceof SkipSelf || meta.__proto__.ngMetadataName === 'SkipSelf') {
1342
-
1437
+ flags |= 4 /* SkipSelf */;
1343
1438
  }
1344
1439
  else if (meta instanceof Self || meta.__proto__.ngMetadataName === 'Self') {
1345
-
1440
+ flags |= 2 /* Self */;
1346
1441
  }
1347
1442
  else if (meta instanceof Inject) {
1348
1443
  type = meta.token;
@@ -1351,7 +1446,7 @@ function injectArgs(types) {
1351
1446
  type = meta;
1352
1447
  }
1353
1448
  }
1354
- args.push(inject((type), defaultValue, 0 /* Default */));
1449
+ args.push(inject((type), flags));
1355
1450
  }
1356
1451
  else {
1357
1452
  args.push(inject(arg));
@@ -1376,7 +1471,7 @@ function convertInjectableProviderToFactory(type, provider) {
1376
1471
  var reflectionCapabilities = new ReflectionCapabilities();
1377
1472
  var deps_1 = reflectionCapabilities.parameters(type);
1378
1473
  // TODO - convert to flags.
1379
- return function () { return new (type.bind.apply(type, tslib_1.__spread([void 0], injectArgs(deps_1))))(); };
1474
+ return function () { return new (type.bind.apply(type, __spread([void 0], injectArgs(deps_1))))(); };
1380
1475
  }
1381
1476
  if (USE_VALUE in provider) {
1382
1477
  var valueProvider_1 = provider;
@@ -1388,7 +1483,7 @@ function convertInjectableProviderToFactory(type, provider) {
1388
1483
  }
1389
1484
  else if (provider.useFactory) {
1390
1485
  var factoryProvider_1 = provider;
1391
- return function () { return factoryProvider_1.useFactory.apply(factoryProvider_1, tslib_1.__spread(injectArgs(factoryProvider_1.deps || EMPTY_ARRAY))); };
1486
+ return function () { return factoryProvider_1.useFactory.apply(factoryProvider_1, __spread(injectArgs(factoryProvider_1.deps || EMPTY_ARRAY))); };
1392
1487
  }
1393
1488
  else if (provider.useClass) {
1394
1489
  var classProvider_1 = provider;
@@ -1398,7 +1493,7 @@ function convertInjectableProviderToFactory(type, provider) {
1398
1493
  deps_2 = reflectionCapabilities.parameters(type);
1399
1494
  }
1400
1495
  return function () {
1401
- return new ((_a = classProvider_1.useClass).bind.apply(_a, tslib_1.__spread([void 0], injectArgs(deps_2))))();
1496
+ return new ((_a = classProvider_1.useClass).bind.apply(_a, __spread([void 0], injectArgs(deps_2))))();
1402
1497
  var _a;
1403
1498
  };
1404
1499
  }
@@ -1408,13 +1503,13 @@ function convertInjectableProviderToFactory(type, provider) {
1408
1503
  var reflectionCapabilities = new ReflectionCapabilities();
1409
1504
  deps_3 = reflectionCapabilities.parameters(type);
1410
1505
  }
1411
- return function () { return new (type.bind.apply(type, tslib_1.__spread([void 0], injectArgs((deps_3)))))(); };
1506
+ return function () { return new (type.bind.apply(type, __spread([void 0], injectArgs((deps_3)))))(); };
1412
1507
  }
1413
1508
  }
1414
1509
  /**
1415
1510
  * Injectable decorator and metadata.
1416
1511
  *
1417
- * @stable
1512
+ *
1418
1513
  * @Annotation
1419
1514
  */
1420
1515
  var Injectable = makeDecorator('Injectable', undefined, undefined, undefined, function (injectableType, options) {
@@ -1440,7 +1535,7 @@ var Injectable = makeDecorator('Injectable', undefined, undefined, undefined, fu
1440
1535
  * - any properties on elements with a `-` in their name which is the common rule for custom
1441
1536
  * elements.
1442
1537
  *
1443
- * @stable
1538
+ *
1444
1539
  */
1445
1540
  var CUSTOM_ELEMENTS_SCHEMA = {
1446
1541
  name: 'custom-elements'
@@ -1456,13 +1551,13 @@ var NO_ERRORS_SCHEMA = {
1456
1551
  /**
1457
1552
  * NgModule decorator and metadata.
1458
1553
  *
1459
- * @stable
1554
+ *
1460
1555
  * @Annotation
1461
1556
  */
1462
1557
  var NgModule = makeDecorator('NgModule', function (ngModule) { return ngModule; }, undefined, undefined, function (moduleType, metadata) {
1463
1558
  var imports = (metadata && metadata.imports) || [];
1464
1559
  if (metadata && metadata.exports) {
1465
- imports = tslib_1.__spread(imports, [metadata.exports]);
1560
+ imports = __spread(imports, [metadata.exports]);
1466
1561
  }
1467
1562
  moduleType.ngInjectorDef = defineInjector({
1468
1563
  factory: convertInjectableProviderToFactory(moduleType, { useClass: moduleType }),
@@ -1489,20 +1584,20 @@ var NgModule = makeDecorator('NgModule', function (ngModule) { return ngModule;
1489
1584
  * Defines template and style encapsulation options available for Component's {@link Component}.
1490
1585
  *
1491
1586
  * See {@link Component#encapsulation encapsulation}.
1492
- * @stable
1587
+ *
1493
1588
  */
1494
1589
  /**
1495
1590
  * Defines template and style encapsulation options available for Component's {@link Component}.
1496
1591
  *
1497
1592
  * See {@link Component#encapsulation encapsulation}.
1498
- * @stable
1593
+ *
1499
1594
  */
1500
1595
 
1501
1596
  /**
1502
1597
  * Defines template and style encapsulation options available for Component's {@link Component}.
1503
1598
  *
1504
1599
  * See {@link Component#encapsulation encapsulation}.
1505
- * @stable
1600
+ *
1506
1601
  */
1507
1602
  (function (ViewEncapsulation) {
1508
1603
  /**
@@ -1545,7 +1640,7 @@ var NgModule = makeDecorator('NgModule', function (ngModule) { return ngModule;
1545
1640
  /**
1546
1641
  * @description Represents the version of Angular
1547
1642
  *
1548
- * @stable
1643
+ *
1549
1644
  */
1550
1645
  var Version = /** @class */ (function () {
1551
1646
  function Version(full) {
@@ -1557,9 +1652,9 @@ var Version = /** @class */ (function () {
1557
1652
  return Version;
1558
1653
  }());
1559
1654
  /**
1560
- * @stable
1655
+ *
1561
1656
  */
1562
- var VERSION = new Version('6.0.0-rc.3');
1657
+ var VERSION = new Version('6.0.0');
1563
1658
 
1564
1659
  /**
1565
1660
  * @license
@@ -1587,7 +1682,7 @@ function defaultErrorLogger(console) {
1587
1682
  for (var _i = 1; _i < arguments.length; _i++) {
1588
1683
  values[_i - 1] = arguments[_i];
1589
1684
  }
1590
- console.error.apply(console, tslib_1.__spread(values));
1685
+ console.error.apply(console, __spread(values));
1591
1686
  }
1592
1687
 
1593
1688
  /**
@@ -1621,7 +1716,7 @@ function defaultErrorLogger(console) {
1621
1716
  * class MyModule {}
1622
1717
  * ```
1623
1718
  *
1624
- * @stable
1719
+ *
1625
1720
  */
1626
1721
  var ErrorHandler = /** @class */ (function () {
1627
1722
  function ErrorHandler() {
@@ -1829,7 +1924,7 @@ function invalidProviderError(provider) {
1829
1924
  *
1830
1925
  * expect(() => Injector.resolveAndCreate([A,B])).toThrowError();
1831
1926
  * ```
1832
- * @stable
1927
+ *
1833
1928
  */
1834
1929
  function noAnnotationError(typeOrFunc, params) {
1835
1930
  var signature = [];
@@ -1859,7 +1954,7 @@ function noAnnotationError(typeOrFunc, params) {
1859
1954
  *
1860
1955
  * expect(() => injector.getAt(100)).toThrowError();
1861
1956
  * ```
1862
- * @stable
1957
+ *
1863
1958
  */
1864
1959
  function outOfBoundsError(index) {
1865
1960
  return Error("Index " + index + " is out-of-bounds.");
@@ -2613,7 +2708,7 @@ var ReflectiveInjector_ = /** @class */ (function () {
2613
2708
  }
2614
2709
  var obj;
2615
2710
  try {
2616
- obj = factory.apply(void 0, tslib_1.__spread(deps));
2711
+ obj = factory.apply(void 0, __spread(deps));
2617
2712
  }
2618
2713
  catch (e) {
2619
2714
  throw instantiationError(this, e, e.stack, provider.key);
@@ -2754,7 +2849,7 @@ function getNullInjector() {
2754
2849
  return NULL_INJECTOR$1;
2755
2850
  }
2756
2851
  /**
2757
- * Create a new `Injector` which is configured using `InjectorDefType`s.
2852
+ * Create a new `Injector` which is configured using `InjectorType`s.
2758
2853
  *
2759
2854
  * @experimental
2760
2855
  */
@@ -2772,7 +2867,7 @@ var R3Injector = /** @class */ (function () {
2772
2867
  */
2773
2868
  this.records = new Map();
2774
2869
  /**
2775
- * The transitive set of `InjectorDefType`s which define this injector.
2870
+ * The transitive set of `InjectorType`s which define this injector.
2776
2871
  */
2777
2872
  this.injectorDefTypes = new Set();
2778
2873
  /**
@@ -2783,7 +2878,7 @@ var R3Injector = /** @class */ (function () {
2783
2878
  * Flag indicating that this injector was previously destroyed.
2784
2879
  */
2785
2880
  this.destroyed = false;
2786
- // Start off by creating Records for every provider declared in every InjectorDefType
2881
+ // Start off by creating Records for every provider declared in every InjectorType
2787
2882
  // included transitively in `def`.
2788
2883
  deepForEach([def], function (injectorDef) { return _this.processInjectorType(injectorDef, new Set()); });
2789
2884
  // Make sure the INJECTOR token provides this injector.
@@ -2791,7 +2886,7 @@ var R3Injector = /** @class */ (function () {
2791
2886
  // Detect whether this injector has the APP_ROOT_SCOPE token and thus should provide
2792
2887
  // any injectable scoped to APP_ROOT_SCOPE.
2793
2888
  this.isRootInjector = this.records.has(APP_ROOT);
2794
- // Eagerly instantiate the InjectorDefType classes themselves.
2889
+ // Eagerly instantiate the InjectorType classes themselves.
2795
2890
  this.injectorDefTypes.forEach(function (defType) { return _this.get(defType); });
2796
2891
  }
2797
2892
  /**
@@ -2835,7 +2930,7 @@ var R3Injector = /** @class */ (function () {
2835
2930
  var previousInjector = setCurrentInjector(this);
2836
2931
  try {
2837
2932
  // Check for the SkipSelf flag.
2838
- if (!(flags & 1 /* SkipSelf */)) {
2933
+ if (!(flags & 4 /* SkipSelf */)) {
2839
2934
  // SkipSelf isn't set, check if the record belongs to this injector.
2840
2935
  var record = this.records.get(token);
2841
2936
  if (record === undefined) {
@@ -2872,28 +2967,28 @@ var R3Injector = /** @class */ (function () {
2872
2967
  }
2873
2968
  };
2874
2969
  /**
2875
- * Add an `InjectorDefType` or `InjectorDefTypeWithProviders` and all of its transitive providers
2970
+ * Add an `InjectorType` or `InjectorDefTypeWithProviders` and all of its transitive providers
2876
2971
  * to this injector.
2877
2972
  */
2878
2973
  /**
2879
- * Add an `InjectorDefType` or `InjectorDefTypeWithProviders` and all of its transitive providers
2974
+ * Add an `InjectorType` or `InjectorDefTypeWithProviders` and all of its transitive providers
2880
2975
  * to this injector.
2881
2976
  */
2882
2977
  R3Injector.prototype.processInjectorType = /**
2883
- * Add an `InjectorDefType` or `InjectorDefTypeWithProviders` and all of its transitive providers
2978
+ * Add an `InjectorType` or `InjectorDefTypeWithProviders` and all of its transitive providers
2884
2979
  * to this injector.
2885
2980
  */
2886
2981
  function (defOrWrappedDef, parents) {
2887
2982
  var _this = this;
2888
2983
  defOrWrappedDef = resolveForwardRef(defOrWrappedDef);
2889
- // Either the defOrWrappedDef is an InjectorDefType (with ngInjectorDef) or an
2984
+ // Either the defOrWrappedDef is an InjectorType (with ngInjectorDef) or an
2890
2985
  // InjectorDefTypeWithProviders (aka ModuleWithProviders). Detecting either is a megamorphic
2891
2986
  // read, so care is taken to only do the read once.
2892
2987
  // First attempt to read the ngInjectorDef.
2893
2988
  var def = defOrWrappedDef.ngInjectorDef;
2894
2989
  // If that's not present, then attempt to read ngModule from the InjectorDefTypeWithProviders.
2895
2990
  var ngModule = (def == null) && defOrWrappedDef.ngModule || undefined;
2896
- // Determine the InjectorDefType. In the case where `defOrWrappedDef` is an `InjectorDefType`,
2991
+ // Determine the InjectorType. In the case where `defOrWrappedDef` is an `InjectorType`,
2897
2992
  // then this is easy. In the case of an InjectorDefTypeWithProviders, then the definition type
2898
2993
  // is the `ngModule`.
2899
2994
  var defType = (ngModule === undefined) ? defOrWrappedDef : ngModule;
@@ -2914,7 +3009,7 @@ var R3Injector = /** @class */ (function () {
2914
3009
  if (parents.has(defType)) {
2915
3010
  throw new Error("Circular dependency: type " + stringify(defType) + " ends up importing itself.");
2916
3011
  }
2917
- // Track the InjectorDefType and add a provider for it.
3012
+ // Track the InjectorType and add a provider for it.
2918
3013
  this.injectorDefTypes.add(defType);
2919
3014
  this.records.set(defType, makeRecord(def.factory));
2920
3015
  // Add providers in the same way that @NgModule resolution did:
@@ -3028,12 +3123,12 @@ function providerToRecord(provider) {
3028
3123
  factory = function () { return inject(provider.useExisting); };
3029
3124
  }
3030
3125
  else if (isFactoryProvider(provider)) {
3031
- factory = function () { return provider.useFactory.apply(provider, tslib_1.__spread(injectArgs(provider.deps || []))); };
3126
+ factory = function () { return provider.useFactory.apply(provider, __spread(injectArgs(provider.deps || []))); };
3032
3127
  }
3033
3128
  else {
3034
3129
  var classRef_1 = provider.useClass || token;
3035
3130
  if (hasDeps(provider)) {
3036
- factory = function () { return new ((classRef_1).bind.apply((classRef_1), tslib_1.__spread([void 0], injectArgs(provider.deps))))(); };
3131
+ factory = function () { return new ((classRef_1).bind.apply((classRef_1), __spread([void 0], injectArgs(provider.deps))))(); };
3037
3132
  }
3038
3133
  else {
3039
3134
  return injectableDefRecord(classRef_1);
@@ -3105,7 +3200,7 @@ function isPromise(obj) {
3105
3200
  * Determine if the argument is an Observable
3106
3201
  */
3107
3202
  function isObservable(obj) {
3108
- // TODO use Symbol.observable when https://github.com/ReactiveX/rxjs/issues/2415 will be resolved
3203
+ // TODO: use Symbol.observable when https://github.com/ReactiveX/rxjs/issues/2415 will be resolved
3109
3204
  return !!obj && typeof obj.subscribe === 'function';
3110
3205
  }
3111
3206
 
@@ -3292,7 +3387,7 @@ function _throwError() {
3292
3387
  * Each `@NgModule` provides an own `Compiler` to its injector,
3293
3388
  * that will use the directives/pipes of the ng module for compilation
3294
3389
  * of components.
3295
- * @stable
3390
+ *
3296
3391
  */
3297
3392
  var Compiler = /** @class */ (function () {
3298
3393
  function Compiler() {
@@ -3401,7 +3496,7 @@ var CompilerFactory = /** @class */ (function () {
3401
3496
  * `ComponentRef` provides access to the Component Instance as well other objects related to this
3402
3497
  * Component Instance and allows you to destroy the Component Instance via the {@link #destroy}
3403
3498
  * method.
3404
- * @stable
3499
+ *
3405
3500
  */
3406
3501
  var ComponentRef = /** @class */ (function () {
3407
3502
  function ComponentRef() {
@@ -3409,7 +3504,7 @@ var ComponentRef = /** @class */ (function () {
3409
3504
  return ComponentRef;
3410
3505
  }());
3411
3506
  /**
3412
- * @stable
3507
+ *
3413
3508
  */
3414
3509
  var ComponentFactory = /** @class */ (function () {
3415
3510
  function ComponentFactory() {
@@ -3440,7 +3535,7 @@ var _NullComponentFactoryResolver = /** @class */ (function () {
3440
3535
  return _NullComponentFactoryResolver;
3441
3536
  }());
3442
3537
  /**
3443
- * @stable
3538
+ *
3444
3539
  */
3445
3540
  var ComponentFactoryResolver = /** @class */ (function () {
3446
3541
  function ComponentFactoryResolver() {
@@ -3471,7 +3566,7 @@ var CodegenComponentFactoryResolver = /** @class */ (function () {
3471
3566
  return CodegenComponentFactoryResolver;
3472
3567
  }());
3473
3568
  var ComponentFactoryBoundToModule = /** @class */ (function (_super) {
3474
- tslib_1.__extends(ComponentFactoryBoundToModule, _super);
3569
+ __extends(ComponentFactoryBoundToModule, _super);
3475
3570
  function ComponentFactoryBoundToModule(factory, ngModule) {
3476
3571
  var _this = _super.call(this) || this;
3477
3572
  _this.factory = factory;
@@ -3502,7 +3597,7 @@ var ComponentFactoryBoundToModule = /** @class */ (function (_super) {
3502
3597
  * `NgModuleRef` provides access to the NgModule Instance as well other objects related to this
3503
3598
  * NgModule Instance.
3504
3599
  *
3505
- * @stable
3600
+ *
3506
3601
  */
3507
3602
  var NgModuleRef = /** @class */ (function () {
3508
3603
  function NgModuleRef() {
@@ -3682,10 +3777,10 @@ var wtfEndTimeRange = wtfEnabled ? endTimeRange : function (r) { return null; };
3682
3777
  * https://github.com/jhusain/observable-spec
3683
3778
  *
3684
3779
  * Once a reference implementation of the spec is available, switch to it.
3685
- * @stable
3780
+ *
3686
3781
  */
3687
3782
  var EventEmitter = /** @class */ (function (_super) {
3688
- tslib_1.__extends(EventEmitter, _super);
3783
+ __extends(EventEmitter, _super);
3689
3784
  /**
3690
3785
  * Creates an instance of {@link EventEmitter}, which depending on `isAsync`,
3691
3786
  * delivers events synchronously or asynchronously.
@@ -4509,7 +4604,7 @@ var ALLOW_MULTIPLE_PLATFORMS = new InjectionToken('AllowMultipleToken');
4509
4604
  * does not result in additional changes to any bindings (also known as
4510
4605
  * unidirectional data flow).
4511
4606
  *
4512
- * @stable
4607
+ *
4513
4608
  */
4514
4609
  function enableProdMode() {
4515
4610
  if (_runModeLocked) {
@@ -4623,7 +4718,7 @@ function getPlatform() {
4623
4718
  * A page's platform is initialized implicitly when a platform is created via a platform factory
4624
4719
  * (e.g. {@link platformBrowser}), or explicitly by calling the {@link createPlatform} function.
4625
4720
  *
4626
- * @stable
4721
+ *
4627
4722
  */
4628
4723
  var PlatformRef = /** @class */ (function () {
4629
4724
  /** @internal */
@@ -4747,7 +4842,7 @@ var PlatformRef = /** @class */ (function () {
4747
4842
  *
4748
4843
  * let moduleRef = platformBrowser().bootstrapModule(MyModule);
4749
4844
  * ```
4750
- * @stable
4845
+ *
4751
4846
  */
4752
4847
  /**
4753
4848
  * Creates an instance of an `@NgModule` for a given platform using the given runtime compiler.
@@ -4762,7 +4857,7 @@ var PlatformRef = /** @class */ (function () {
4762
4857
  *
4763
4858
  * let moduleRef = platformBrowser().bootstrapModule(MyModule);
4764
4859
  * ```
4765
- * @stable
4860
+ *
4766
4861
  */
4767
4862
  PlatformRef.prototype.bootstrapModule = /**
4768
4863
  * Creates an instance of an `@NgModule` for a given platform using the given runtime compiler.
@@ -4777,7 +4872,7 @@ var PlatformRef = /** @class */ (function () {
4777
4872
  *
4778
4873
  * let moduleRef = platformBrowser().bootstrapModule(MyModule);
4779
4874
  * ```
4780
- * @stable
4875
+ *
4781
4876
  */
4782
4877
  function (moduleType, compilerOptions) {
4783
4878
  var _this = this;
@@ -4890,14 +4985,14 @@ function optionsReducer(dst, objs) {
4890
4985
  dst = objs.reduce(optionsReducer, dst);
4891
4986
  }
4892
4987
  else {
4893
- dst = tslib_1.__assign({}, dst, objs);
4988
+ dst = __assign({}, dst, objs);
4894
4989
  }
4895
4990
  return dst;
4896
4991
  }
4897
4992
  /**
4898
4993
  * A reference to an Angular application running on a page.
4899
4994
  *
4900
- * @stable
4995
+ *
4901
4996
  */
4902
4997
  var ApplicationRef = /** @class */ (function () {
4903
4998
  /** @internal */
@@ -5303,7 +5398,7 @@ var Renderer2 = /** @class */ (function () {
5303
5398
  * XSS attacks. Carefully review any use of `ElementRef` in your code. For more detail, see the
5304
5399
  * [Security Guide](http://g.co/ng/security).
5305
5400
  *
5306
- * @stable
5401
+ *
5307
5402
  */
5308
5403
  // Note: We don't expose things like `Injector`, `ViewContainer`, ... here,
5309
5404
  // i.e. users have to ask for what they need. With that, we can build better analysis tools
@@ -5324,7 +5419,7 @@ var ElementRef = /** @class */ (function () {
5324
5419
  */
5325
5420
  /**
5326
5421
  * Used to load ng module factories.
5327
- * @stable
5422
+ *
5328
5423
  */
5329
5424
  var NgModuleFactoryLoader = /** @class */ (function () {
5330
5425
  function NgModuleFactoryLoader() {
@@ -5386,7 +5481,7 @@ function getModuleFactory(id) {
5386
5481
  * @ViewChildren(Item) items:QueryList<Item>;
5387
5482
  * }
5388
5483
  * ```
5389
- * @stable
5484
+ *
5390
5485
  */
5391
5486
  var QueryList = /** @class */ (function () {
5392
5487
  function QueryList() {
@@ -5551,7 +5646,7 @@ var SystemJsNgModuleLoader = /** @class */ (function () {
5551
5646
  };
5552
5647
  SystemJsNgModuleLoader.prototype.loadAndCompile = function (path) {
5553
5648
  var _this = this;
5554
- var _a = tslib_1.__read(path.split(_SEPARATOR), 2), module = _a[0], exportName = _a[1];
5649
+ var _a = __read(path.split(_SEPARATOR), 2), module = _a[0], exportName = _a[1];
5555
5650
  if (exportName === undefined) {
5556
5651
  exportName = 'default';
5557
5652
  }
@@ -5561,7 +5656,7 @@ var SystemJsNgModuleLoader = /** @class */ (function () {
5561
5656
  .then(function (type) { return _this._compiler.compileModuleAsync(type); });
5562
5657
  };
5563
5658
  SystemJsNgModuleLoader.prototype.loadFactory = function (path) {
5564
- var _a = tslib_1.__read(path.split(_SEPARATOR), 2), module = _a[0], exportName = _a[1];
5659
+ var _a = __read(path.split(_SEPARATOR), 2), module = _a[0], exportName = _a[1];
5565
5660
  var factoryClassSuffix = FACTORY_CLASS_SUFFIX;
5566
5661
  if (exportName === undefined) {
5567
5662
  exportName = 'default';
@@ -5605,7 +5700,7 @@ function checkNotEmpty(value, modulePath, exportName) {
5605
5700
  *
5606
5701
  * To instantiate Embedded Views based on a Template, use {@link ViewContainerRef#
5607
5702
  * createEmbeddedView}, which will create the View and attach it to the View Container.
5608
- * @stable
5703
+ *
5609
5704
  */
5610
5705
  var TemplateRef = /** @class */ (function () {
5611
5706
  function TemplateRef() {
@@ -5636,7 +5731,7 @@ var TemplateRef = /** @class */ (function () {
5636
5731
  *
5637
5732
  * To access a `ViewContainerRef` of an Element, you can either place a {@link Directive} injected
5638
5733
  * with `ViewContainerRef` on the Element, or you obtain it via a {@link ViewChild} query.
5639
- * @stable
5734
+ *
5640
5735
  */
5641
5736
  var ViewContainerRef = /** @class */ (function () {
5642
5737
  function ViewContainerRef() {
@@ -5652,7 +5747,7 @@ var ViewContainerRef = /** @class */ (function () {
5652
5747
  * found in the LICENSE file at https://angular.io/license
5653
5748
  */
5654
5749
  /**
5655
- * @stable
5750
+ *
5656
5751
  */
5657
5752
  var ChangeDetectorRef = /** @class */ (function () {
5658
5753
  function ChangeDetectorRef() {
@@ -5668,10 +5763,10 @@ var ChangeDetectorRef = /** @class */ (function () {
5668
5763
  * found in the LICENSE file at https://angular.io/license
5669
5764
  */
5670
5765
  /**
5671
- * @stable
5766
+ *
5672
5767
  */
5673
5768
  var ViewRef = /** @class */ (function (_super) {
5674
- tslib_1.__extends(ViewRef, _super);
5769
+ __extends(ViewRef, _super);
5675
5770
  function ViewRef() {
5676
5771
  return _super !== null && _super.apply(this, arguments) || this;
5677
5772
  }
@@ -5732,7 +5827,7 @@ var ViewRef = /** @class */ (function (_super) {
5732
5827
  * @experimental
5733
5828
  */
5734
5829
  var EmbeddedViewRef = /** @class */ (function (_super) {
5735
- tslib_1.__extends(EmbeddedViewRef, _super);
5830
+ __extends(EmbeddedViewRef, _super);
5736
5831
  function EmbeddedViewRef() {
5737
5832
  return _super !== null && _super.apply(this, arguments) || this;
5738
5833
  }
@@ -5807,7 +5902,7 @@ var DebugNode = /** @class */ (function () {
5807
5902
  * @experimental All debugging apis are currently experimental.
5808
5903
  */
5809
5904
  var DebugElement = /** @class */ (function (_super) {
5810
- tslib_1.__extends(DebugElement, _super);
5905
+ __extends(DebugElement, _super);
5811
5906
  function DebugElement(nativeNode, parent, _debugContext) {
5812
5907
  var _this = _super.call(this, nativeNode, parent, _debugContext) || this;
5813
5908
  _this.properties = {};
@@ -5835,7 +5930,7 @@ var DebugElement = /** @class */ (function (_super) {
5835
5930
  var _this = this;
5836
5931
  var siblingIndex = this.childNodes.indexOf(child);
5837
5932
  if (siblingIndex !== -1) {
5838
- (_a = this.childNodes).splice.apply(_a, tslib_1.__spread([siblingIndex + 1, 0], newChildren));
5933
+ (_a = this.childNodes).splice.apply(_a, __spread([siblingIndex + 1, 0], newChildren));
5839
5934
  newChildren.forEach(function (c) {
5840
5935
  if (c.parent) {
5841
5936
  c.parent.removeChild(c);
@@ -5973,7 +6068,7 @@ function devModeEqual(a, b) {
5973
6068
  * return WrappedValue.wrap(this._latestValue); // this will force update
5974
6069
  * }
5975
6070
  * ```
5976
- * @stable
6071
+ *
5977
6072
  */
5978
6073
  var WrappedValue = /** @class */ (function () {
5979
6074
  function WrappedValue(value) {
@@ -6004,7 +6099,7 @@ var WrappedValue = /** @class */ (function () {
6004
6099
  }());
6005
6100
  /**
6006
6101
  * Represents a basic change from a previous to a new value.
6007
- * @stable
6102
+ *
6008
6103
  */
6009
6104
  var SimpleChange = /** @class */ (function () {
6010
6105
  function SimpleChange(previousValue, currentValue, firstChange) {
@@ -6314,7 +6409,7 @@ var DefaultIterableDiffer = /** @class */ (function () {
6314
6409
  this._movesHead = this._movesTail = null;
6315
6410
  this._removalsHead = this._removalsTail = null;
6316
6411
  this._identityChangesHead = this._identityChangesTail = null;
6317
- // todo(vicb) when assert gets supported
6412
+ // TODO(vicb): when assert gets supported
6318
6413
  // assert(!this.isDirty);
6319
6414
  }
6320
6415
  };
@@ -6565,12 +6660,12 @@ var DefaultIterableDiffer = /** @class */ (function () {
6565
6660
  function (record, prevRecord, index) {
6566
6661
  this._insertAfter(record, prevRecord, index);
6567
6662
  if (this._additionsTail === null) {
6568
- // todo(vicb)
6663
+ // TODO(vicb):
6569
6664
  // assert(this._additionsHead === null);
6570
6665
  this._additionsTail = this._additionsHead = record;
6571
6666
  }
6572
6667
  else {
6573
- // todo(vicb)
6668
+ // TODO(vicb):
6574
6669
  // assert(_additionsTail._nextAdded === null);
6575
6670
  // assert(record._nextAdded === null);
6576
6671
  this._additionsTail = this._additionsTail._nextAdded = record;
@@ -6581,12 +6676,12 @@ var DefaultIterableDiffer = /** @class */ (function () {
6581
6676
  /** @internal */
6582
6677
  DefaultIterableDiffer.prototype._insertAfter = /** @internal */
6583
6678
  function (record, prevRecord, index) {
6584
- // todo(vicb)
6679
+ // TODO(vicb):
6585
6680
  // assert(record != prevRecord);
6586
6681
  // assert(record._next === null);
6587
6682
  // assert(record._prev === null);
6588
6683
  var next = prevRecord === null ? this._itHead : prevRecord._next;
6589
- // todo(vicb)
6684
+ // TODO(vicb):
6590
6685
  // assert(next != record);
6591
6686
  // assert(prevRecord != record);
6592
6687
  record._next = next;
@@ -6625,7 +6720,7 @@ var DefaultIterableDiffer = /** @class */ (function () {
6625
6720
  }
6626
6721
  var prev = record._prev;
6627
6722
  var next = record._next;
6628
- // todo(vicb)
6723
+ // TODO(vicb):
6629
6724
  // assert((record._prev = null) === null);
6630
6725
  // assert((record._next = null) === null);
6631
6726
  if (prev === null) {
@@ -6646,18 +6741,18 @@ var DefaultIterableDiffer = /** @class */ (function () {
6646
6741
  /** @internal */
6647
6742
  DefaultIterableDiffer.prototype._addToMoves = /** @internal */
6648
6743
  function (record, toIndex) {
6649
- // todo(vicb)
6744
+ // TODO(vicb):
6650
6745
  // assert(record._nextMoved === null);
6651
6746
  if (record.previousIndex === toIndex) {
6652
6747
  return record;
6653
6748
  }
6654
6749
  if (this._movesTail === null) {
6655
- // todo(vicb)
6750
+ // TODO(vicb):
6656
6751
  // assert(_movesHead === null);
6657
6752
  this._movesTail = this._movesHead = record;
6658
6753
  }
6659
6754
  else {
6660
- // todo(vicb)
6755
+ // TODO(vicb):
6661
6756
  // assert(_movesTail._nextMoved === null);
6662
6757
  this._movesTail = this._movesTail._nextMoved = record;
6663
6758
  }
@@ -6671,13 +6766,13 @@ var DefaultIterableDiffer = /** @class */ (function () {
6671
6766
  record.currentIndex = null;
6672
6767
  record._nextRemoved = null;
6673
6768
  if (this._removalsTail === null) {
6674
- // todo(vicb)
6769
+ // TODO(vicb):
6675
6770
  // assert(_removalsHead === null);
6676
6771
  this._removalsTail = this._removalsHead = record;
6677
6772
  record._prevRemoved = null;
6678
6773
  }
6679
6774
  else {
6680
- // todo(vicb)
6775
+ // TODO(vicb):
6681
6776
  // assert(_removalsTail._nextRemoved === null);
6682
6777
  // assert(record._nextRemoved === null);
6683
6778
  record._prevRemoved = this._removalsTail;
@@ -6701,7 +6796,7 @@ var DefaultIterableDiffer = /** @class */ (function () {
6701
6796
  return DefaultIterableDiffer;
6702
6797
  }());
6703
6798
  /**
6704
- * @stable
6799
+ *
6705
6800
  */
6706
6801
  var IterableChangeRecord_ = /** @class */ (function () {
6707
6802
  function IterableChangeRecord_(item, trackById) {
@@ -6762,10 +6857,10 @@ var _DuplicateItemRecordList = /** @class */ (function () {
6762
6857
  record._prevDup = null;
6763
6858
  }
6764
6859
  else {
6765
- // todo(vicb)
6860
+ // TODO(vicb):
6766
6861
  // assert(record.item == _head.item ||
6767
6862
  // record.item is num && record.item.isNaN && _head.item is num && _head.item.isNaN);
6768
- // todo(vicb)
6863
+ // TODO(vicb):
6769
6864
  // assert(record.item == _head.item ||
6770
6865
  // record.item is num && record.item.isNaN && _head.item is num && _head.item.isNaN);
6771
6866
  this._tail._nextDup = record;
@@ -6807,7 +6902,7 @@ var _DuplicateItemRecordList = /** @class */ (function () {
6807
6902
  * Returns whether the list of duplicates is empty.
6808
6903
  */
6809
6904
  function (record) {
6810
- // todo(vicb)
6905
+ // TODO(vicb):
6811
6906
  // assert(() {
6812
6907
  // // verify that the record being removed is in the list.
6813
6908
  // for (IterableChangeRecord_ cursor = _head; cursor != null; cursor = cursor._nextDup) {
@@ -7182,7 +7277,7 @@ var DefaultKeyValueDiffer = /** @class */ (function () {
7182
7277
  return DefaultKeyValueDiffer;
7183
7278
  }());
7184
7279
  /**
7185
- * @stable
7280
+ *
7186
7281
  */
7187
7282
  var KeyValueChangeRecord_ = /** @class */ (function () {
7188
7283
  function KeyValueChangeRecord_(key) {
@@ -7214,7 +7309,7 @@ var KeyValueChangeRecord_ = /** @class */ (function () {
7214
7309
  */
7215
7310
  /**
7216
7311
  * A repository of different iterable diffing strategies used by NgFor, NgClass, and others.
7217
- * @stable
7312
+ *
7218
7313
  */
7219
7314
  var IterableDiffers = /** @class */ (function () {
7220
7315
  function IterableDiffers(factories) {
@@ -7309,6 +7404,10 @@ var IterableDiffers = /** @class */ (function () {
7309
7404
  throw new Error("Cannot find a differ supporting object '" + iterable + "' of type '" + getTypeNameForDebugging(iterable) + "'");
7310
7405
  }
7311
7406
  };
7407
+ IterableDiffers.ngInjectableDef = defineInjectable({
7408
+ providedIn: 'root',
7409
+ factory: function () { return new IterableDiffers([new DefaultIterableDifferFactory()]); }
7410
+ });
7312
7411
  return IterableDiffers;
7313
7412
  }());
7314
7413
  function getTypeNameForDebugging(type) {
@@ -7324,7 +7423,7 @@ function getTypeNameForDebugging(type) {
7324
7423
  */
7325
7424
  /**
7326
7425
  * A repository of different Map diffing strategies used by NgClass, NgStyle, and others.
7327
- * @stable
7426
+ *
7328
7427
  */
7329
7428
  var KeyValueDiffers = /** @class */ (function () {
7330
7429
  function KeyValueDiffers(factories) {
@@ -7931,7 +8030,7 @@ function sanitizeSrcset(srcset) {
7931
8030
  function tagSet(tags) {
7932
8031
  var res = {};
7933
8032
  try {
7934
- for (var _a = tslib_1.__values(tags.split(',')), _b = _a.next(); !_b.done; _b = _a.next()) {
8033
+ for (var _a = __values(tags.split(',')), _b = _a.next(); !_b.done; _b = _a.next()) {
7935
8034
  var t = _b.value;
7936
8035
  res[t] = true;
7937
8036
  }
@@ -7953,7 +8052,7 @@ function merge$1() {
7953
8052
  }
7954
8053
  var res = {};
7955
8054
  try {
7956
- for (var sets_1 = tslib_1.__values(sets), sets_1_1 = sets_1.next(); !sets_1_1.done; sets_1_1 = sets_1.next()) {
8055
+ for (var sets_1 = __values(sets), sets_1_1 = sets_1.next(); !sets_1_1.done; sets_1_1 = sets_1.next()) {
7957
8056
  var s = sets_1_1.value;
7958
8057
  for (var v in s) {
7959
8058
  if (s.hasOwnProperty(v))
@@ -8284,7 +8383,7 @@ function _sanitizeStyle(value) {
8284
8383
  *
8285
8384
  * See DomSanitizer for more details on security in Angular applications.
8286
8385
  *
8287
- * @stable
8386
+ *
8288
8387
  */
8289
8388
  /**
8290
8389
  * A SecurityContext marks a location that has dangerous security implications, e.g. a DOM property
@@ -8293,7 +8392,7 @@ function _sanitizeStyle(value) {
8293
8392
  *
8294
8393
  * See DomSanitizer for more details on security in Angular applications.
8295
8394
  *
8296
- * @stable
8395
+ *
8297
8396
  */
8298
8397
 
8299
8398
  /**
@@ -8303,7 +8402,7 @@ function _sanitizeStyle(value) {
8303
8402
  *
8304
8403
  * See DomSanitizer for more details on security in Angular applications.
8305
8404
  *
8306
- * @stable
8405
+ *
8307
8406
  */
8308
8407
  (function (SecurityContext) {
8309
8408
  SecurityContext[SecurityContext["NONE"] = 0] = "NONE";
@@ -8316,7 +8415,7 @@ function _sanitizeStyle(value) {
8316
8415
  /**
8317
8416
  * Sanitizer is used by the views to sanitize potentially dangerous values.
8318
8417
  *
8319
- * @stable
8418
+ *
8320
8419
  */
8321
8420
  var Sanitizer = /** @class */ (function () {
8322
8421
  function Sanitizer() {
@@ -8618,7 +8717,7 @@ function splitMatchedQueriesDsl(matchedQueriesDsl) {
8618
8717
  var references = {};
8619
8718
  if (matchedQueriesDsl) {
8620
8719
  matchedQueriesDsl.forEach(function (_a) {
8621
- var _b = tslib_1.__read(_a, 2), queryId = _b[0], valueType = _b[1];
8720
+ var _b = __read(_a, 2), queryId = _b[0], valueType = _b[1];
8622
8721
  if (typeof queryId === 'number') {
8623
8722
  matchedQueries[queryId] = valueType;
8624
8723
  matchedQueryIds |= filterQueryId(queryId);
@@ -8635,7 +8734,7 @@ function splitDepsDsl(deps, sourceName) {
8635
8734
  var token;
8636
8735
  var flags;
8637
8736
  if (Array.isArray(value)) {
8638
- _a = tslib_1.__read(value, 2), flags = _a[0], token = _a[1];
8737
+ _a = __read(value, 2), flags = _a[0], token = _a[1];
8639
8738
  }
8640
8739
  else {
8641
8740
  flags = 0 /* None */;
@@ -8887,13 +8986,13 @@ function elementDef(checkIndex, flags, matchedQueriesDsl, ngContentIndex, childC
8887
8986
  var ns = (null);
8888
8987
  var name = (null);
8889
8988
  if (namespaceAndName) {
8890
- _b = tslib_1.__read(splitNamespace(namespaceAndName), 2), ns = _b[0], name = _b[1];
8989
+ _b = __read(splitNamespace(namespaceAndName), 2), ns = _b[0], name = _b[1];
8891
8990
  }
8892
8991
  bindings = bindings || [];
8893
8992
  var bindingDefs = new Array(bindings.length);
8894
8993
  for (var i = 0; i < bindings.length; i++) {
8895
- var _c = tslib_1.__read(bindings[i], 3), bindingFlags = _c[0], namespaceAndName_1 = _c[1], suffixOrSecurityContext = _c[2];
8896
- var _d = tslib_1.__read(splitNamespace(namespaceAndName_1), 2), ns_1 = _d[0], name_1 = _d[1];
8994
+ var _c = __read(bindings[i], 3), bindingFlags = _c[0], namespaceAndName_1 = _c[1], suffixOrSecurityContext = _c[2];
8995
+ var _d = __read(splitNamespace(namespaceAndName_1), 2), ns_1 = _d[0], name_1 = _d[1];
8897
8996
  var securityContext = (undefined);
8898
8997
  var suffix = (undefined);
8899
8998
  switch (bindingFlags & 15 /* Types */) {
@@ -8911,7 +9010,7 @@ function elementDef(checkIndex, flags, matchedQueriesDsl, ngContentIndex, childC
8911
9010
  outputs = outputs || [];
8912
9011
  var outputDefs = new Array(outputs.length);
8913
9012
  for (var i = 0; i < outputs.length; i++) {
8914
- var _e = tslib_1.__read(outputs[i], 2), target = _e[0], eventName = _e[1];
9013
+ var _e = __read(outputs[i], 2), target = _e[0], eventName = _e[1];
8915
9014
  outputDefs[i] = {
8916
9015
  type: 0 /* ElementOutput */,
8917
9016
  target: target, eventName: eventName,
@@ -8920,8 +9019,8 @@ function elementDef(checkIndex, flags, matchedQueriesDsl, ngContentIndex, childC
8920
9019
  }
8921
9020
  fixedAttrs = fixedAttrs || [];
8922
9021
  var attrs = fixedAttrs.map(function (_a) {
8923
- var _b = tslib_1.__read(_a, 2), namespaceAndName = _b[0], value = _b[1];
8924
- var _c = tslib_1.__read(splitNamespace(namespaceAndName), 2), ns = _c[0], name = _c[1];
9022
+ var _b = __read(_a, 2), namespaceAndName = _b[0], value = _b[1];
9023
+ var _c = __read(splitNamespace(namespaceAndName), 2), ns = _c[0], name = _c[1];
8925
9024
  return [ns, name, value];
8926
9025
  });
8927
9026
  componentRendererType = resolveRendererType2(componentRendererType);
@@ -8987,7 +9086,7 @@ function createElement(view, renderHost, def) {
8987
9086
  }
8988
9087
  if (elDef.attrs) {
8989
9088
  for (var i = 0; i < elDef.attrs.length; i++) {
8990
- var _a = tslib_1.__read(elDef.attrs[i], 3), ns = _a[0], name_2 = _a[1], value = _a[2];
9089
+ var _a = __read(elDef.attrs[i], 3), ns = _a[0], name_2 = _a[1], value = _a[2];
8991
9090
  renderer.setAttribute(el, name_2, value, ns);
8992
9091
  }
8993
9092
  }
@@ -9171,7 +9270,10 @@ function initNgModule(data) {
9171
9270
  for (var i = 0; i < def.providers.length; i++) {
9172
9271
  var provDef = def.providers[i];
9173
9272
  if (!(provDef.flags & 4096 /* LazyProvider */)) {
9174
- providers[i] = _createProviderInstance$1(data, provDef);
9273
+ // Make sure the provider has not been already initialized outside this loop.
9274
+ if (providers[i] === undefined) {
9275
+ providers[i] = _createProviderInstance$1(data, provDef);
9276
+ }
9175
9277
  }
9176
9278
  }
9177
9279
  }
@@ -9264,7 +9366,7 @@ function _createClass(ngModule, ctor, deps) {
9264
9366
  for (var i = 0; i < len; i++) {
9265
9367
  depValues[i] = resolveNgModuleDep(ngModule, deps[i]);
9266
9368
  }
9267
- return new (ctor.bind.apply(ctor, tslib_1.__spread([void 0], depValues)))();
9369
+ return new (ctor.bind.apply(ctor, __spread([void 0], depValues)))();
9268
9370
  }
9269
9371
  }
9270
9372
  function _callFactory(ngModule, factory, deps) {
@@ -9283,7 +9385,7 @@ function _callFactory(ngModule, factory, deps) {
9283
9385
  for (var i = 0; i < len; i++) {
9284
9386
  depValues[i] = resolveNgModuleDep(ngModule, deps[i]);
9285
9387
  }
9286
- return factory.apply(void 0, tslib_1.__spread(depValues));
9388
+ return factory.apply(void 0, __spread(depValues));
9287
9389
  }
9288
9390
  }
9289
9391
  function callNgModuleLifecycle(ngModule, lifecycles) {
@@ -9446,7 +9548,7 @@ function getComponentViewDefinitionFactory(componentFactory) {
9446
9548
  return componentFactory.viewDefFactory;
9447
9549
  }
9448
9550
  var ComponentFactory_ = /** @class */ (function (_super) {
9449
- tslib_1.__extends(ComponentFactory_, _super);
9551
+ __extends(ComponentFactory_, _super);
9450
9552
  function ComponentFactory_(selector, componentType, viewDefFactory, _inputs, _outputs, ngContentSelectors) {
9451
9553
  var _this =
9452
9554
  // Attention: this ctor is called as top level function.
@@ -9510,7 +9612,7 @@ var ComponentFactory_ = /** @class */ (function (_super) {
9510
9612
  return ComponentFactory_;
9511
9613
  }(ComponentFactory));
9512
9614
  var ComponentRef_ = /** @class */ (function (_super) {
9513
- tslib_1.__extends(ComponentRef_, _super);
9615
+ __extends(ComponentRef_, _super);
9514
9616
  function ComponentRef_(_view, _viewRef, _component) {
9515
9617
  var _this = _super.call(this) || this;
9516
9618
  _this._view = _view;
@@ -9727,7 +9829,7 @@ function createTemplateData(view, def) {
9727
9829
  return new TemplateRef_(view, def);
9728
9830
  }
9729
9831
  var TemplateRef_ = /** @class */ (function (_super) {
9730
- tslib_1.__extends(TemplateRef_, _super);
9832
+ __extends(TemplateRef_, _super);
9731
9833
  function TemplateRef_(_parentView, _def) {
9732
9834
  var _this = _super.call(this) || this;
9733
9835
  _this._parentView = _parentView;
@@ -9786,7 +9888,7 @@ var RendererAdapter = /** @class */ (function () {
9786
9888
  return this.delegate.selectRootElement(selectorOrNode);
9787
9889
  };
9788
9890
  RendererAdapter.prototype.createElement = function (parent, namespaceAndName) {
9789
- var _a = tslib_1.__read(splitNamespace(namespaceAndName), 2), ns = _a[0], name = _a[1];
9891
+ var _a = __read(splitNamespace(namespaceAndName), 2), ns = _a[0], name = _a[1];
9790
9892
  var el = this.delegate.createElement(name, ns);
9791
9893
  if (parent) {
9792
9894
  this.delegate.appendChild(parent, el);
@@ -9842,7 +9944,7 @@ var RendererAdapter = /** @class */ (function () {
9842
9944
  this.delegate.setProperty(renderElement, propertyName, propertyValue);
9843
9945
  };
9844
9946
  RendererAdapter.prototype.setElementAttribute = function (renderElement, namespaceAndName, attributeValue) {
9845
- var _a = tslib_1.__read(splitNamespace(namespaceAndName), 2), ns = _a[0], name = _a[1];
9947
+ var _a = __read(splitNamespace(namespaceAndName), 2), ns = _a[0], name = _a[1];
9846
9948
  if (attributeValue != null) {
9847
9949
  this.delegate.setAttribute(renderElement, name, attributeValue, ns);
9848
9950
  }
@@ -9892,7 +9994,7 @@ var NgModuleRef_ = /** @class */ (function () {
9892
9994
  if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
9893
9995
  if (injectFlags === void 0) { injectFlags = 0 /* Default */; }
9894
9996
  var flags = 0;
9895
- if (injectFlags & 1 /* SkipSelf */) {
9997
+ if (injectFlags & 4 /* SkipSelf */) {
9896
9998
  flags |= 1 /* SkipSelf */;
9897
9999
  }
9898
10000
  else if (injectFlags & 2 /* Self */) {
@@ -9941,7 +10043,7 @@ function directiveDef(checkIndex, flags, matchedQueries, childCount, ctor, deps,
9941
10043
  var bindings = [];
9942
10044
  if (props) {
9943
10045
  for (var prop in props) {
9944
- var _a = tslib_1.__read(props[prop], 2), bindingIndex = _a[0], nonMinifiedName = _a[1];
10046
+ var _a = __read(props[prop], 2), bindingIndex = _a[0], nonMinifiedName = _a[1];
9945
10047
  bindings[bindingIndex] = {
9946
10048
  flags: 8 /* TypeProperty */,
9947
10049
  name: prop, nonMinifiedName: nonMinifiedName,
@@ -10145,7 +10247,7 @@ function createClass(view, elDef, allowPrivateServices, ctor, deps) {
10145
10247
  for (var i = 0; i < len; i++) {
10146
10248
  depValues[i] = resolveDep(view, elDef, allowPrivateServices, deps[i]);
10147
10249
  }
10148
- return new (ctor.bind.apply(ctor, tslib_1.__spread([void 0], depValues)))();
10250
+ return new (ctor.bind.apply(ctor, __spread([void 0], depValues)))();
10149
10251
  }
10150
10252
  }
10151
10253
  function callFactory(view, elDef, allowPrivateServices, factory, deps) {
@@ -10164,7 +10266,7 @@ function callFactory(view, elDef, allowPrivateServices, factory, deps) {
10164
10266
  for (var i = 0; i < len; i++) {
10165
10267
  depValues[i] = resolveDep(view, elDef, allowPrivateServices, deps[i]);
10166
10268
  }
10167
- return factory.apply(void 0, tslib_1.__spread(depValues));
10269
+ return factory.apply(void 0, __spread(depValues));
10168
10270
  }
10169
10271
  }
10170
10272
  // This default value is when checking the hierarchy for a token.
@@ -10839,7 +10941,7 @@ function checkAndUpdatePureExpressionDynamic(view, def, values) {
10839
10941
  case 128 /* TypePurePipe */:
10840
10942
  var pipe = values[0];
10841
10943
  var params = values.slice(1);
10842
- value = pipe.transform.apply(pipe, tslib_1.__spread(params));
10944
+ value = pipe.transform.apply(pipe, __spread(params));
10843
10945
  break;
10844
10946
  }
10845
10947
  data.value = value;
@@ -11949,7 +12051,7 @@ function debugUpdateRenderer(view, checkType) {
11949
12051
  }
11950
12052
  }
11951
12053
  function debugCheckAndUpdateNode(view, nodeDef, argStyle, givenValues) {
11952
- var changed = checkAndUpdateNode.apply(void 0, tslib_1.__spread([view, nodeDef, argStyle], givenValues));
12054
+ var changed = checkAndUpdateNode.apply(void 0, __spread([view, nodeDef, argStyle], givenValues));
11953
12055
  if (changed) {
11954
12056
  var values = argStyle === 1 /* Dynamic */ ? givenValues[0] : givenValues;
11955
12057
  if (nodeDef.flags & 16384 /* TypeDirective */) {
@@ -11984,7 +12086,7 @@ function debugCheckAndUpdateNode(view, nodeDef, argStyle, givenValues) {
11984
12086
  }
11985
12087
  }
11986
12088
  function debugCheckNoChangesNode(view, nodeDef, argStyle, values) {
11987
- checkNoChangesNode.apply(void 0, tslib_1.__spread([view, nodeDef, argStyle], values));
12089
+ checkNoChangesNode.apply(void 0, __spread([view, nodeDef, argStyle], values));
11988
12090
  }
11989
12091
  function normalizeDebugBindingName(name) {
11990
12092
  // Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
@@ -12146,7 +12248,7 @@ var DebugContext_ = /** @class */ (function () {
12146
12248
  var nodeLogger = function () {
12147
12249
  currRenderNodeIndex++;
12148
12250
  if (currRenderNodeIndex === renderNodeIndex) {
12149
- return (_a = console.error).bind.apply(_a, tslib_1.__spread([console], values));
12251
+ return (_a = console.error).bind.apply(_a, __spread([console], values));
12150
12252
  }
12151
12253
  else {
12152
12254
  return NOOP;
@@ -12156,7 +12258,7 @@ var DebugContext_ = /** @class */ (function () {
12156
12258
  logViewDef.factory(nodeLogger);
12157
12259
  if (currRenderNodeIndex < renderNodeIndex) {
12158
12260
  console.error('Illegal state: the ViewDefinitionFactory did not call the logger!');
12159
- console.error.apply(console, tslib_1.__spread(values));
12261
+ console.error.apply(console, __spread(values));
12160
12262
  }
12161
12263
  };
12162
12264
  return DebugContext_;
@@ -12394,7 +12496,7 @@ function createNgModuleFactory(ngModuleType, bootstrapComponents, defFactory) {
12394
12496
  return new NgModuleFactory_(ngModuleType, bootstrapComponents, defFactory);
12395
12497
  }
12396
12498
  var NgModuleFactory_ = /** @class */ (function (_super) {
12397
- tslib_1.__extends(NgModuleFactory_, _super);
12499
+ __extends(NgModuleFactory_, _super);
12398
12500
  function NgModuleFactory_(moduleType, _bootstrapComponents, _ngModuleDefFactory) {
12399
12501
  var _this =
12400
12502
  // Attention: this ctor is called as top level function.
@@ -12460,6 +12562,11 @@ function assertLessThan(actual, expected, msg) {
12460
12562
  throwError(msg);
12461
12563
  }
12462
12564
  }
12565
+ function assertGreaterThan(actual, expected, msg) {
12566
+ if (actual <= expected) {
12567
+ throwError(msg);
12568
+ }
12569
+ }
12463
12570
  function assertNull(actual, msg) {
12464
12571
  if (actual != null) {
12465
12572
  throwError(msg);
@@ -12519,8 +12626,8 @@ function queueLifecycleHooks(flags, currentView) {
12519
12626
  var tView = currentView.tView;
12520
12627
  if (tView.firstTemplatePass === true) {
12521
12628
  var start = flags >> 13;
12522
- var size = (flags & 8190 /* SIZE_MASK */) >> 1;
12523
- var end = start + size;
12629
+ var count = flags & 4095;
12630
+ var end = start + count;
12524
12631
  // It's necessary to loop through the directives at elementEnd() (rather than processing in
12525
12632
  // directiveCreate) so we can preserve the current hook order. Content, view, and destroy
12526
12633
  // hooks for projected components and directives must be called *before* their hosts.
@@ -12564,9 +12671,9 @@ function queueDestroyHooks(def, tView, i) {
12564
12671
  * @param currentView The current view
12565
12672
  */
12566
12673
  function executeInitHooks(currentView, tView, creationMode) {
12567
- if (currentView.lifecycleStage === 1 /* INIT */) {
12674
+ if (currentView.lifecycleStage === 1 /* Init */) {
12568
12675
  executeHooks((currentView.directives), tView.initHooks, tView.checkHooks, creationMode);
12569
- currentView.lifecycleStage = 2 /* AFTER_INIT */;
12676
+ currentView.lifecycleStage = 2 /* AfterInit */;
12570
12677
  }
12571
12678
  }
12572
12679
  /**
@@ -12707,6 +12814,64 @@ var domRendererFactory3 = {
12707
12814
  // Note: This hack is necessary so we don't erroneously get a circular dependency
12708
12815
  // failure based on types.
12709
12816
 
12817
+ /**
12818
+ * @license
12819
+ * Copyright Google Inc. All Rights Reserved.
12820
+ *
12821
+ * Use of this source code is governed by an MIT-style license that can be
12822
+ * found in the LICENSE file at https://angular.io/license
12823
+ */
12824
+ /**
12825
+ * Must use this method for CD (instead of === ) since NaN !== NaN
12826
+ */
12827
+ function isDifferent(a, b) {
12828
+ // NaN is the only value that is not equal to itself so the first
12829
+ // test checks if both a and b are not NaN
12830
+ return !(a !== a && b !== b) && a !== b;
12831
+ }
12832
+ function stringify$1(value) {
12833
+ if (typeof value == 'function')
12834
+ return value.name || value;
12835
+ if (typeof value == 'string')
12836
+ return value;
12837
+ if (value == null)
12838
+ return '';
12839
+ return '' + value;
12840
+ }
12841
+ /**
12842
+ * Function that throws a "not implemented" error so it's clear certain
12843
+ * behaviors/methods aren't yet ready.
12844
+ *
12845
+ * @returns Not implemented error
12846
+ */
12847
+ function notImplemented() {
12848
+ return new Error('NotImplemented');
12849
+ }
12850
+ /**
12851
+ * Flattens an array in non-recursive way. Input arrays are not modified.
12852
+ */
12853
+ function flatten$1(list) {
12854
+ var result = [];
12855
+ var i = 0;
12856
+ while (i < list.length) {
12857
+ var item = list[i];
12858
+ if (Array.isArray(item)) {
12859
+ if (item.length > 0) {
12860
+ list = item.concat(list.slice(i + 1));
12861
+ i = 0;
12862
+ }
12863
+ else {
12864
+ i++;
12865
+ }
12866
+ }
12867
+ else {
12868
+ result.push(item);
12869
+ i++;
12870
+ }
12871
+ }
12872
+ return result;
12873
+ }
12874
+
12710
12875
  /**
12711
12876
  * @license
12712
12877
  * Copyright Google Inc. All Rights Reserved.
@@ -12837,6 +13002,10 @@ function findFirstRNode(rootNode) {
12837
13002
  }
12838
13003
  return null;
12839
13004
  }
13005
+ function createTextNode(value, renderer) {
13006
+ return isProceduralRenderer(renderer) ? renderer.createText(stringify$1(value)) :
13007
+ renderer.createTextNode(stringify$1(value));
13008
+ }
12840
13009
  function addRemoveViewFromContainer(container, rootNode, insertMode, beforeNode) {
12841
13010
  ngDevMode && assertNodeType(container, 0 /* Container */);
12842
13011
  ngDevMode && assertNodeType(rootNode, 2 /* View */);
@@ -12849,6 +13018,15 @@ function addRemoveViewFromContainer(container, rootNode, insertMode, beforeNode)
12849
13018
  var renderer = container.view.renderer;
12850
13019
  if (node.type === 3 /* Element */) {
12851
13020
  if (insertMode) {
13021
+ if (!node.native) {
13022
+ // If the native element doesn't exist, this is a bound text node that hasn't yet been
13023
+ // created because update mode has not run (occurs when a bound text node is a root
13024
+ // node of a dynamically created view). See textBinding() in instructions for ctx.
13025
+ // If the native element doesn't exist, this is a bound text node that hasn't yet been
13026
+ // created because update mode has not run (occurs when a bound text node is a root
13027
+ // node of a dynamically created view). See textBinding() in instructions for ctx.
13028
+ node.native = createTextNode('', renderer);
13029
+ }
12852
13030
  isProceduralRenderer(renderer) ?
12853
13031
  renderer.insertBefore(parent, (node.native), beforeNode) :
12854
13032
  parent.insertBefore((node.native), beforeNode, true);
@@ -12982,6 +13160,7 @@ function removeView(container, removeIndex) {
12982
13160
  setViewNext(views[removeIndex - 1], viewNode.next);
12983
13161
  }
12984
13162
  views.splice(removeIndex, 1);
13163
+ viewNode.next = null;
12985
13164
  destroyViewTree(viewNode.data);
12986
13165
  addRemoveViewFromContainer(container, viewNode, false);
12987
13166
  // Notify query that view has been removed
@@ -13137,7 +13316,7 @@ function appendProjectedNode(node, currentParent, currentView) {
13137
13316
  if (node.type !== 0 /* Container */) {
13138
13317
  appendChild(currentParent, node.native, currentView);
13139
13318
  }
13140
- else if (canInsertNativeNode(currentParent, currentView)) {
13319
+ else {
13141
13320
  // The node we are adding is a Container and we are adding it to Element which
13142
13321
  // is not a component (no more re-projection).
13143
13322
  // Alternatively a container is projected at the root of a component's template
@@ -13150,6 +13329,9 @@ function appendProjectedNode(node, currentParent, currentView) {
13150
13329
  addRemoveViewFromContainer(node, views[i], true, null);
13151
13330
  }
13152
13331
  }
13332
+ if (node.dynamicLContainerNode) {
13333
+ node.dynamicLContainerNode.data.renderParent = currentParent;
13334
+ }
13153
13335
  }
13154
13336
 
13155
13337
  /**
@@ -13286,64 +13468,6 @@ function matchingSelectorIndex(tNode, selectors, textSelectors) {
13286
13468
  return 0;
13287
13469
  }
13288
13470
 
13289
- /**
13290
- * @license
13291
- * Copyright Google Inc. All Rights Reserved.
13292
- *
13293
- * Use of this source code is governed by an MIT-style license that can be
13294
- * found in the LICENSE file at https://angular.io/license
13295
- */
13296
- /**
13297
- * Must use this method for CD (instead of === ) since NaN !== NaN
13298
- */
13299
- function isDifferent(a, b) {
13300
- // NaN is the only value that is not equal to itself so the first
13301
- // test checks if both a and b are not NaN
13302
- return !(a !== a && b !== b) && a !== b;
13303
- }
13304
- function stringify$1(value) {
13305
- if (typeof value == 'function')
13306
- return value.name || value;
13307
- if (typeof value == 'string')
13308
- return value;
13309
- if (value == null)
13310
- return '';
13311
- return '' + value;
13312
- }
13313
- /**
13314
- * Function that throws a "not implemented" error so it's clear certain
13315
- * behaviors/methods aren't yet ready.
13316
- *
13317
- * @returns Not implemented error
13318
- */
13319
- function notImplemented() {
13320
- return new Error('NotImplemented');
13321
- }
13322
- /**
13323
- * Flattens an array in non-recursive way. Input arrays are not modified.
13324
- */
13325
- function flatten$1(list) {
13326
- var result = [];
13327
- var i = 0;
13328
- while (i < list.length) {
13329
- var item = list[i];
13330
- if (Array.isArray(item)) {
13331
- if (item.length > 0) {
13332
- list = item.concat(list.slice(i + 1));
13333
- i = 0;
13334
- }
13335
- else {
13336
- i++;
13337
- }
13338
- }
13339
- else {
13340
- result.push(item);
13341
- i++;
13342
- }
13343
- }
13344
- return result;
13345
- }
13346
-
13347
13471
  /** Called when directives inject each other (creating a circular dependency) */
13348
13472
  function throwCyclicDependencyError(token) {
13349
13473
  throw new Error("Cannot instantiate cyclic dependency! " + token);
@@ -13474,10 +13598,6 @@ var data;
13474
13598
  * unknown at compile-time and thus space cannot be reserved in data[].
13475
13599
  */
13476
13600
  var directives;
13477
- /**
13478
- * Points to the next binding index to read or write to.
13479
- */
13480
- var bindingIndex;
13481
13601
  /**
13482
13602
  * When a view is destroyed, listeners need to be released and outputs need to be
13483
13603
  * unsubscribed. This cleanup array stores both listener data (in chunks of 4)
@@ -13520,12 +13640,14 @@ function enterView(newView, host) {
13520
13640
  var oldView = currentView;
13521
13641
  data = newView && newView.data;
13522
13642
  directives = newView && newView.directives;
13523
- bindingIndex = newView && newView.bindingStartIndex || 0;
13524
13643
  tData = newView && newView.tView.data;
13525
13644
  creationMode = newView && (newView.flags & 1 /* CreationMode */) === 1 /* CreationMode */;
13526
13645
  firstTemplatePass = newView && newView.tView.firstTemplatePass;
13527
13646
  cleanup = newView && newView.cleanup;
13528
13647
  renderer = newView && newView.renderer;
13648
+ if (newView && newView.bindingIndex < 0) {
13649
+ newView.bindingIndex = newView.bindingStartIndex;
13650
+ }
13529
13651
  if (host != null) {
13530
13652
  previousOrParentNode = host;
13531
13653
  isParent = true;
@@ -13544,7 +13666,8 @@ function leaveView(newView) {
13544
13666
  }
13545
13667
  // Views should be clean and in update mode after being checked, so these bits are cleared
13546
13668
  currentView.flags &= ~(1 /* CreationMode */ | 4 /* Dirty */);
13547
- currentView.lifecycleStage = 1 /* INIT */;
13669
+ currentView.lifecycleStage = 1 /* Init */;
13670
+ currentView.bindingIndex = -1;
13548
13671
  enterView(newView, null);
13549
13672
  }
13550
13673
  /** Refreshes directives in this view and triggers any init/content hooks. */
@@ -13598,12 +13721,14 @@ function createLView(viewId, renderer, tView, template, context, flags) {
13598
13721
  child: null,
13599
13722
  tail: null,
13600
13723
  next: null,
13601
- bindingStartIndex: null,
13724
+ bindingStartIndex: -1,
13725
+ bindingIndex: -1,
13602
13726
  template: template,
13603
13727
  context: context,
13604
13728
  dynamicViewCount: 0,
13605
- lifecycleStage: 1 /* INIT */,
13729
+ lifecycleStage: 1 /* Init */,
13606
13730
  queries: null,
13731
+ injector: currentView && currentView.injector,
13607
13732
  };
13608
13733
  return newView;
13609
13734
  }
@@ -13695,25 +13820,22 @@ function resetApplicationState() {
13695
13820
  * @param pipes Pipe defs that should be used for matching
13696
13821
  */
13697
13822
 
13698
- function renderEmbeddedTemplate(viewNode, template, context, renderer) {
13823
+ function renderEmbeddedTemplate(viewNode, template, context, renderer, directives, pipes) {
13699
13824
  var _isParent = isParent;
13700
13825
  var _previousOrParentNode = previousOrParentNode;
13701
13826
  var oldView;
13702
13827
  try {
13703
13828
  isParent = true;
13704
13829
  previousOrParentNode = (null);
13705
- var cm = false;
13830
+ var rf = 2;
13706
13831
  if (viewNode == null) {
13707
- // TODO: revisit setting currentView when re-writing view containers
13708
- var directives_1 = currentView && currentView.tView.directiveRegistry;
13709
- var pipes = currentView && currentView.tView.pipeRegistry;
13710
- var tView = getOrCreateTView(template, directives_1, pipes);
13832
+ var tView = getOrCreateTView(template, directives || null, pipes || null);
13711
13833
  var lView = createLView(-1, renderer, tView, template, context, 2 /* CheckAlways */);
13712
13834
  viewNode = createLNode(null, 2 /* View */, null, lView);
13713
- cm = true;
13835
+ rf = 1 /* Create */;
13714
13836
  }
13715
13837
  oldView = enterView(viewNode.data, viewNode);
13716
- template(context, cm);
13838
+ template(rf, context);
13717
13839
  refreshDirectives();
13718
13840
  refreshDynamicChildren();
13719
13841
  }
@@ -13731,7 +13853,8 @@ function renderComponentOrTemplate(node, hostView, componentOrContext, template)
13731
13853
  rendererFactory.begin();
13732
13854
  }
13733
13855
  if (template) {
13734
- template((componentOrContext), creationMode);
13856
+ template(getRenderFlags(hostView), (componentOrContext));
13857
+ refreshDynamicChildren();
13735
13858
  refreshDirectives();
13736
13859
  }
13737
13860
  else {
@@ -13749,6 +13872,19 @@ function renderComponentOrTemplate(node, hostView, componentOrContext, template)
13749
13872
  leaveView(oldView);
13750
13873
  }
13751
13874
  }
13875
+ /**
13876
+ * This function returns the default configuration of rendering flags depending on when the
13877
+ * template is in creation mode or update mode. By default, the update block is run with the
13878
+ * creation block when the view is in creation mode. Otherwise, the update block is run
13879
+ * alone.
13880
+ *
13881
+ * Dynamically created views do NOT use this configuration (update block and create block are
13882
+ * always run separately).
13883
+ */
13884
+ function getRenderFlags(view) {
13885
+ return view.flags & 1 /* CreationMode */ ? 1 /* Create */ | 2 /* Update */ :
13886
+ 2 /* Update */;
13887
+ }
13752
13888
  /**
13753
13889
  * Create DOM element. The instruction must later be followed by `elementEnd()` call.
13754
13890
  *
@@ -13763,7 +13899,7 @@ function renderComponentOrTemplate(node, hostView, componentOrContext, template)
13763
13899
  */
13764
13900
  function elementStart(index, name, attrs, localRefs) {
13765
13901
  ngDevMode &&
13766
- assertNull(currentView.bindingStartIndex, 'elements should be created before any bindings');
13902
+ assertEqual(currentView.bindingStartIndex, -1, 'elements should be created before any bindings');
13767
13903
  var native = renderer.createElement(name);
13768
13904
  var node = createLNode(index, 3 /* Element */, (native), null);
13769
13905
  if (attrs)
@@ -13790,6 +13926,7 @@ function createDirectivesAndLocals(index, name, attrs, localRefs, containerData)
13790
13926
  * (so dependencies are always created before the directives that inject them).
13791
13927
  */
13792
13928
  function cacheMatchingDirectivesForNode(tNode, tView, localRefs) {
13929
+ // Please make sure to have explicit type for `exportsMap`. Inferred type triggers bug in tsickle.
13793
13930
  var exportsMap = localRefs ? { '': -1 } : null;
13794
13931
  var matches = tView.currentMatches = findDirectiveMatches(tNode);
13795
13932
  if (matches) {
@@ -13812,9 +13949,9 @@ function findDirectiveMatches(tNode) {
13812
13949
  var def = registry[i];
13813
13950
  if (isNodeMatchingSelectorList(tNode, (def.selectors))) {
13814
13951
  if (def.template) {
13815
- if (tNode.flags & 1 /* Component */)
13952
+ if (tNode.flags & 4096 /* isComponent */)
13816
13953
  throwMultipleComponentError(tNode);
13817
- tNode.flags = 1 /* Component */;
13954
+ tNode.flags = 4096 /* isComponent */;
13818
13955
  }
13819
13956
  if (def.diPublic)
13820
13957
  def.diPublic(def);
@@ -13857,18 +13994,19 @@ function initChangeDetectorIfExisting(injector, instance, view) {
13857
13994
  }
13858
13995
  }
13859
13996
  function isComponent(tNode) {
13860
- return (tNode.flags & 1 /* Component */) === 1 /* Component */;
13997
+ return (tNode.flags & 4096 /* isComponent */) === 4096 /* isComponent */;
13861
13998
  }
13862
13999
  /**
13863
14000
  * This function instantiates the given directives.
13864
14001
  */
13865
14002
  function instantiateDirectivesDirectly() {
13866
14003
  var tNode = (previousOrParentNode.tNode);
13867
- var size = (tNode.flags & 8190 /* SIZE_MASK */) >> 1;
13868
- if (size > 0) {
13869
- var startIndex = tNode.flags >> 13;
14004
+ var count = tNode.flags & 4095;
14005
+ if (count > 0) {
14006
+ var start = tNode.flags >> 13;
14007
+ var end = start + count;
13870
14008
  var tDirectives = (currentView.tView.directives);
13871
- for (var i = startIndex; i < startIndex + size; i++) {
14009
+ for (var i = start; i < end; i++) {
13872
14010
  var def = tDirectives[i];
13873
14011
  directiveCreate(i, def.factory(), def);
13874
14012
  }
@@ -14001,7 +14139,7 @@ function hostElement(tag, rNode, def) {
14001
14139
  var node = createLNode(0, 3 /* Element */, rNode, createLView(-1, renderer, getOrCreateTView(def.template, def.directiveDefs, def.pipeDefs), null, null, def.onPush ? 4 /* Dirty */ : 2 /* CheckAlways */));
14002
14140
  if (firstTemplatePass) {
14003
14141
  node.tNode = createTNode(tag, null, null);
14004
- node.tNode.flags = 1 /* Component */;
14142
+ node.tNode.flags = 4096 /* isComponent */;
14005
14143
  if (def.diPublic)
14006
14144
  def.diPublic(def);
14007
14145
  currentView.tView.directives = [def];
@@ -14175,13 +14313,14 @@ function setInputsForProperty(inputs, value) {
14175
14313
  * @returns PropertyAliases|null aggregate of all properties if any, `null` otherwise
14176
14314
  */
14177
14315
  function generatePropertyAliases(tNodeFlags, direction) {
14178
- var size = (tNodeFlags & 8190 /* SIZE_MASK */) >> 1;
14316
+ var count = tNodeFlags & 4095;
14179
14317
  var propStore = null;
14180
- if (size > 0) {
14318
+ if (count > 0) {
14181
14319
  var start = tNodeFlags >> 13;
14320
+ var end = start + count;
14182
14321
  var isInput = direction === 0;
14183
14322
  var defs = (currentView.tView.directives);
14184
- for (var i = start, ii = start + size; i < ii; i++) {
14323
+ for (var i = start; i < end; i++) {
14185
14324
  var directiveDef = defs[i];
14186
14325
  var propertyAliasMap = isInput ? directiveDef.inputs : directiveDef.outputs;
14187
14326
  for (var publicName in propertyAliasMap) {
@@ -14301,11 +14440,8 @@ function elementStyle(index, value) {
14301
14440
  */
14302
14441
  function text(index, value) {
14303
14442
  ngDevMode &&
14304
- assertNull(currentView.bindingStartIndex, 'text nodes should be created before bindings');
14305
- var textNode = value != null ?
14306
- (isProceduralRenderer(renderer) ? renderer.createText(stringify$1(value)) :
14307
- renderer.createTextNode(stringify$1(value))) :
14308
- null;
14443
+ assertEqual(currentView.bindingStartIndex, -1, 'text nodes should be created before bindings');
14444
+ var textNode = value != null ? createTextNode(value, renderer) : null;
14309
14445
  var node = createLNode(index, 3 /* Element */, textNode);
14310
14446
  // Text nodes are self closing.
14311
14447
  isParent = false;
@@ -14330,9 +14466,7 @@ function textBinding(index, value) {
14330
14466
  }
14331
14467
  else {
14332
14468
  // Node was created but DOM node creation was delayed. Create and append now.
14333
- existingNode.native = isProceduralRenderer(renderer) ?
14334
- renderer.createText(stringify$1(value)) :
14335
- renderer.createTextNode(stringify$1(value));
14469
+ existingNode.native = createTextNode(value, renderer);
14336
14470
  insertChild(existingNode, currentView);
14337
14471
  }
14338
14472
  }
@@ -14348,7 +14482,7 @@ function textBinding(index, value) {
14348
14482
  function directiveCreate(index, directive, directiveDef) {
14349
14483
  var instance = baseDirectiveCreate(index, directive, directiveDef);
14350
14484
  ngDevMode && assertNotNull(previousOrParentNode.tNode, 'previousOrParentNode.tNode');
14351
- var tNode = (previousOrParentNode.tNode);
14485
+ var tNode = previousOrParentNode.tNode;
14352
14486
  var isComponent = directiveDef.template;
14353
14487
  if (isComponent) {
14354
14488
  addComponentLogic(index, directive, directiveDef);
@@ -14384,7 +14518,7 @@ function addComponentLogic(index, instance, def) {
14384
14518
  */
14385
14519
  function baseDirectiveCreate(index, directive, directiveDef) {
14386
14520
  ngDevMode &&
14387
- assertNull(currentView.bindingStartIndex, 'directives should be created before any bindings');
14521
+ assertEqual(currentView.bindingStartIndex, -1, 'directives should be created before any bindings');
14388
14522
  ngDevMode && assertPreviousIsParent();
14389
14523
  Object.defineProperty(directive, NG_HOST_SYMBOL, { enumerable: false, value: previousOrParentNode });
14390
14524
  if (directives == null)
@@ -14393,9 +14527,21 @@ function baseDirectiveCreate(index, directive, directiveDef) {
14393
14527
  directives[index] = directive;
14394
14528
  if (firstTemplatePass) {
14395
14529
  var flags = previousOrParentNode.tNode.flags;
14396
- previousOrParentNode.tNode.flags = (flags & 8190 /* SIZE_MASK */) === 0 ?
14397
- (index << 13 /* INDX_SHIFT */) | 2 /* SIZE_SKIP */ | flags & 1 /* Component */ :
14398
- flags + 2 /* SIZE_SKIP */;
14530
+ if ((flags & 4095 /* DirectiveCountMask */) === 0) {
14531
+ // When the first directive is created:
14532
+ // - save the index,
14533
+ // - set the number of directives to 1
14534
+ // When the first directive is created:
14535
+ // - save the index,
14536
+ // - set the number of directives to 1
14537
+ previousOrParentNode.tNode.flags =
14538
+ index << 13 /* DirectiveStartingIndexShift */ | flags & 4096 /* isComponent */ | 1;
14539
+ }
14540
+ else {
14541
+ // Only need to bump the size when subsequent directives are created
14542
+ ngDevMode && assertNotEqual(flags & 4095 /* DirectiveCountMask */, 4095 /* DirectiveCountMask */, 'Reached the max number of directives');
14543
+ previousOrParentNode.tNode.flags++;
14544
+ }
14399
14545
  }
14400
14546
  else {
14401
14547
  var diPublic = directiveDef.diPublic;
@@ -14483,8 +14629,7 @@ function createLContainer(parentLNode, currentView, template) {
14483
14629
  * @param localRefs A set of local reference bindings on the element.
14484
14630
  */
14485
14631
  function container(index, template, tagName, attrs, localRefs) {
14486
- ngDevMode &&
14487
- assertNull(currentView.bindingStartIndex, 'container nodes should be created before any bindings');
14632
+ ngDevMode && assertEqual(currentView.bindingStartIndex, -1, 'container nodes should be created before any bindings');
14488
14633
  var currentParent = isParent ? previousOrParentNode : previousOrParentNode.parent;
14489
14634
  var lContainer = createLContainer(currentParent, currentView, template);
14490
14635
  var node = createLNode(index, 0 /* Container */, undefined, lContainer);
@@ -14550,6 +14695,7 @@ function refreshDynamicChildren() {
14550
14695
  var container_1 = current;
14551
14696
  for (var i = 0; i < container_1.views.length; i++) {
14552
14697
  var view = container_1.views[i];
14698
+ // The directives and pipes are not needed here as an existing view is only being refreshed.
14553
14699
  renderEmbeddedTemplate(view, (view.data.template), (view.data.context), renderer);
14554
14700
  }
14555
14701
  }
@@ -14594,12 +14740,12 @@ function embeddedViewStart(viewBlockId) {
14594
14740
  var container = (isParent ? previousOrParentNode : previousOrParentNode.parent);
14595
14741
  ngDevMode && assertNodeType(container, 0 /* Container */);
14596
14742
  var lContainer = container.data;
14597
- var existingViewNode = scanForView(container, lContainer.nextIndex, viewBlockId);
14598
- if (existingViewNode) {
14599
- previousOrParentNode = existingViewNode;
14743
+ var viewNode = scanForView(container, lContainer.nextIndex, viewBlockId);
14744
+ if (viewNode) {
14745
+ previousOrParentNode = viewNode;
14600
14746
  ngDevMode && assertNodeType(previousOrParentNode, 2 /* View */);
14601
14747
  isParent = true;
14602
- enterView(existingViewNode.data, existingViewNode);
14748
+ enterView(viewNode.data, viewNode);
14603
14749
  }
14604
14750
  else {
14605
14751
  // When we create a new LView, we always reset the state of the instructions.
@@ -14607,9 +14753,9 @@ function embeddedViewStart(viewBlockId) {
14607
14753
  if (lContainer.queries) {
14608
14754
  newView.queries = lContainer.queries.enterView(lContainer.nextIndex);
14609
14755
  }
14610
- enterView(newView, createLNode(null, 2 /* View */, null, newView));
14756
+ enterView(newView, viewNode = createLNode(null, 2 /* View */, null, newView));
14611
14757
  }
14612
- return !existingViewNode;
14758
+ return getRenderFlags(viewNode.data);
14613
14759
  }
14614
14760
  /**
14615
14761
  * Initialize the TView (e.g. static data) for the active embedded view.
@@ -14643,6 +14789,9 @@ function embeddedViewEnd() {
14643
14789
  ngDevMode && assertNodeType(containerNode, 0 /* Container */);
14644
14790
  var lContainer = containerNode.data;
14645
14791
  if (creationMode) {
14792
+ // When projected nodes are going to be inserted, the renderParent of the dynamic container
14793
+ // used by the ViewContainerRef must be set.
14794
+ setRenderParentInProjectedNodes(lContainer.renderParent, viewNode);
14646
14795
  // it is a new view, insert it into collection of views for a given container
14647
14796
  insertView(containerNode, viewNode, lContainer.nextIndex);
14648
14797
  }
@@ -14652,6 +14801,30 @@ function embeddedViewEnd() {
14652
14801
  ngDevMode && assertEqual(isParent, false, 'isParent');
14653
14802
  ngDevMode && assertNodeType(previousOrParentNode, 2 /* View */);
14654
14803
  }
14804
+ /**
14805
+ * For nodes which are projected inside an embedded view, this function sets the renderParent
14806
+ * of their dynamic LContainerNode.
14807
+ * @param renderParent the renderParent of the LContainer which contains the embedded view.
14808
+ * @param viewNode the embedded view.
14809
+ */
14810
+ function setRenderParentInProjectedNodes(renderParent, viewNode) {
14811
+ if (renderParent != null) {
14812
+ var node = viewNode.child;
14813
+ while (node) {
14814
+ if (node.type === 1 /* Projection */) {
14815
+ var nodeToProject = node.data.head;
14816
+ var lastNodeToProject = node.data.tail;
14817
+ while (nodeToProject) {
14818
+ if (nodeToProject.dynamicLContainerNode) {
14819
+ nodeToProject.dynamicLContainerNode.data.renderParent = renderParent;
14820
+ }
14821
+ nodeToProject = nodeToProject === lastNodeToProject ? null : nodeToProject.pNextOrParent;
14822
+ }
14823
+ }
14824
+ node = node.next;
14825
+ }
14826
+ }
14827
+ }
14655
14828
  /**
14656
14829
  * Refreshes components by entering the component view and processing its bindings, queries, etc.
14657
14830
  *
@@ -14776,6 +14949,7 @@ function projection(nodeIndex, localIndex, selectorIndex, attrs) {
14776
14949
  }
14777
14950
  }
14778
14951
  if (canInsertNativeNode(currentParent, currentView)) {
14952
+ ngDevMode && assertNodeType(currentParent, 3 /* Element */);
14779
14953
  // process each node in the list of projected nodes:
14780
14954
  var nodeToProject = node.data.head;
14781
14955
  var lastNodeToProject = node.data.tail;
@@ -14839,7 +15013,7 @@ function wrapListenerWithDirtyLogic(view, listenerFn) {
14839
15013
  * whenever the event fires. Also wraps with preventDefault behavior.
14840
15014
  */
14841
15015
  function wrapListenerWithDirtyAndDefault(view, listenerFn) {
14842
- return function (e) {
15016
+ return function wrapListenerIn_markViewDirty(e) {
14843
15017
  markViewDirty(view);
14844
15018
  if (listenerFn(e) === false) {
14845
15019
  e.preventDefault();
@@ -14955,7 +15129,7 @@ function detectChangesInternal(hostView, hostNode, def, component) {
14955
15129
  var oldView = enterView(hostView, hostNode);
14956
15130
  var template = def.template;
14957
15131
  try {
14958
- template(component, creationMode);
15132
+ template(getRenderFlags(hostView), component);
14959
15133
  refreshDirectives();
14960
15134
  refreshDynamicChildren();
14961
15135
  }
@@ -14991,12 +15165,9 @@ var NO_CHANGE = {};
14991
15165
  * (ie `bind()`, `interpolationX()`, `pureFunctionX()`)
14992
15166
  */
14993
15167
  function initBindings() {
14994
- // `bindingIndex` is initialized when the view is first entered when not in creation mode
14995
- ngDevMode &&
14996
- assertEqual(creationMode, true, 'should only be called in creationMode for performance reasons');
14997
- if (currentView.bindingStartIndex == null) {
14998
- bindingIndex = currentView.bindingStartIndex = data.length;
14999
- }
15168
+ ngDevMode && assertEqual(currentView.bindingStartIndex, -1, 'Binding start index should only be set once, when null');
15169
+ ngDevMode && assertEqual(currentView.bindingIndex, -1, 'Binding index should not yet be set ' + currentView.bindingIndex);
15170
+ currentView.bindingIndex = currentView.bindingStartIndex = data.length;
15000
15171
  }
15001
15172
  /**
15002
15173
  * Creates a single value binding.
@@ -15004,16 +15175,16 @@ function initBindings() {
15004
15175
  * @param value Value to diff
15005
15176
  */
15006
15177
  function bind(value) {
15007
- if (creationMode) {
15178
+ if (currentView.bindingStartIndex < 0) {
15008
15179
  initBindings();
15009
- return data[bindingIndex++] = value;
15180
+ return data[currentView.bindingIndex++] = value;
15010
15181
  }
15011
- var changed = value !== NO_CHANGE && isDifferent(data[bindingIndex], value);
15182
+ var changed = value !== NO_CHANGE && isDifferent(data[currentView.bindingIndex], value);
15012
15183
  if (changed) {
15013
- throwErrorIfNoChangesMode(creationMode, checkNoChangesMode, data[bindingIndex], value);
15014
- data[bindingIndex] = value;
15184
+ throwErrorIfNoChangesMode(creationMode, checkNoChangesMode, data[currentView.bindingIndex], value);
15185
+ data[currentView.bindingIndex] = value;
15015
15186
  }
15016
- bindingIndex++;
15187
+ currentView.bindingIndex++;
15017
15188
  return changed ? value : NO_CHANGE;
15018
15189
  }
15019
15190
  /**
@@ -15136,25 +15307,25 @@ function loadDirective(index) {
15136
15307
  }
15137
15308
  /** Gets the current binding value and increments the binding index. */
15138
15309
  function consumeBinding() {
15139
- ngDevMode && assertDataInRange(bindingIndex);
15310
+ ngDevMode && assertDataInRange(currentView.bindingIndex);
15140
15311
  ngDevMode &&
15141
- assertNotEqual(data[bindingIndex], NO_CHANGE, 'Stored value should never be NO_CHANGE.');
15142
- return data[bindingIndex++];
15312
+ assertNotEqual(data[currentView.bindingIndex], NO_CHANGE, 'Stored value should never be NO_CHANGE.');
15313
+ return data[currentView.bindingIndex++];
15143
15314
  }
15144
15315
  /** Updates binding if changed, then returns whether it was updated. */
15145
15316
  function bindingUpdated(value) {
15146
15317
  ngDevMode && assertNotEqual(value, NO_CHANGE, 'Incoming value should never be NO_CHANGE.');
15147
- if (creationMode) {
15318
+ if (currentView.bindingStartIndex < 0) {
15148
15319
  initBindings();
15149
15320
  }
15150
- else if (isDifferent(data[bindingIndex], value)) {
15151
- throwErrorIfNoChangesMode(creationMode, checkNoChangesMode, data[bindingIndex], value);
15321
+ else if (isDifferent(data[currentView.bindingIndex], value)) {
15322
+ throwErrorIfNoChangesMode(creationMode, checkNoChangesMode, data[currentView.bindingIndex], value);
15152
15323
  }
15153
15324
  else {
15154
- bindingIndex++;
15325
+ currentView.bindingIndex++;
15155
15326
  return false;
15156
15327
  }
15157
- data[bindingIndex++] = value;
15328
+ data[currentView.bindingIndex++] = value;
15158
15329
  return true;
15159
15330
  }
15160
15331
  /** Updates binding if changed, then returns the latest value. */
@@ -15732,7 +15903,7 @@ var ViewRef$1 = /** @class */ (function () {
15732
15903
  return ViewRef;
15733
15904
  }());
15734
15905
  var EmbeddedViewRef$1 = /** @class */ (function (_super) {
15735
- tslib_1.__extends(EmbeddedViewRef, _super);
15906
+ __extends(EmbeddedViewRef, _super);
15736
15907
  function EmbeddedViewRef(viewNode, template, context) {
15737
15908
  var _this = _super.call(this, viewNode.data, context) || this;
15738
15909
  _this._lViewNode = viewNode;
@@ -15815,6 +15986,7 @@ function renderComponent(componentType /* Type as workaround for: Microsoft/Type
15815
15986
  clean: CLEAN_PROMISE,
15816
15987
  };
15817
15988
  var rootView = createLView(-1, rendererFactory.createRenderer(hostNode, componentDef.rendererType), createTView(null, null), null, rootContext, componentDef.onPush ? 4 /* Dirty */ : 2 /* CheckAlways */);
15989
+ rootView.injector = opts.injector || null;
15818
15990
  var oldView = enterView(rootView, (null));
15819
15991
  var elementNode;
15820
15992
  try {
@@ -15851,6 +16023,17 @@ function renderComponent(componentType /* Type as workaround for: Microsoft/Type
15851
16023
  * ```
15852
16024
  */
15853
16025
 
16026
+ /**
16027
+ * Retrieve the root context for any component by walking the parent `LView` until
16028
+ * reaching the root `LView`.
16029
+ *
16030
+ * @param component any component
16031
+ */
16032
+ function getRootContext(component) {
16033
+ var rootContext = getRootView(component).context;
16034
+ ngDevMode && assertNotNull(rootContext, 'rootContext');
16035
+ return rootContext;
16036
+ }
15854
16037
  /**
15855
16038
  * Retrieve the host element of the component.
15856
16039
  *
@@ -15887,6 +16070,9 @@ function renderComponent(componentType /* Type as workaround for: Microsoft/Type
15887
16070
  * @param component Component to wait upon
15888
16071
  * @returns Promise which resolves when the component is rendered.
15889
16072
  */
16073
+ function whenRendered(component) {
16074
+ return getRootContext(component).clean;
16075
+ }
15890
16076
 
15891
16077
  /**
15892
16078
  * @license
@@ -15979,23 +16165,12 @@ function getOrCreateNodeInjectorForNode(node) {
15979
16165
  cbf5: parentInjector == null ? 0 : parentInjector.cbf5 | parentInjector.bf5,
15980
16166
  cbf6: parentInjector == null ? 0 : parentInjector.cbf6 | parentInjector.bf6,
15981
16167
  cbf7: parentInjector == null ? 0 : parentInjector.cbf7 | parentInjector.bf7,
15982
- injector: null,
15983
16168
  templateRef: null,
15984
16169
  viewContainerRef: null,
15985
16170
  elementRef: null,
15986
16171
  changeDetectorRef: null
15987
16172
  };
15988
16173
  }
15989
- /**
15990
- * Constructs an injection error with the given text and token.
15991
- *
15992
- * @param text The text of the error
15993
- * @param token The token associated with the error
15994
- * @returns The error that was created
15995
- */
15996
- function createInjectionError(text$$1, token) {
15997
- return new Error("ElementInjector: " + text$$1 + " [" + stringify$1(token) + "]");
15998
- }
15999
16174
  /**
16000
16175
  * Makes a directive public to the DI system by adding it to an injector's bloom filter.
16001
16176
  *
@@ -16013,33 +16188,9 @@ function diPublicInInjector(di, def) {
16013
16188
  function diPublic(def) {
16014
16189
  diPublicInInjector(getOrCreateNodeInjector(), def);
16015
16190
  }
16016
- /**
16017
- * Searches for an instance of the given type up the injector tree and returns
16018
- * that instance if found.
16019
- *
16020
- * If not found, it will propagate up to the next parent injector until the token
16021
- * is found or the top is reached.
16022
- *
16023
- * Usage example (in factory function):
16024
- *
16025
- * class SomeDirective {
16026
- * constructor(directive: DirectiveA) {}
16027
- *
16028
- * static ngDirectiveDef = defineDirective({
16029
- * type: SomeDirective,
16030
- * factory: () => new SomeDirective(directiveInject(DirectiveA))
16031
- * });
16032
- * }
16033
- *
16034
- * NOTE: use `directiveInject` with `@Directive`, `@Component`, and `@Pipe`. For
16035
- * all other injection use `inject` which does not walk the DOM render tree.
16036
- *
16037
- * @param token The directive type to search for
16038
- * @param flags Injection flags (e.g. CheckParent)
16039
- * @returns The instance found
16040
- */
16041
- function directiveInject(token, flags, defaultValue) {
16042
- return getOrCreateInjectable(getOrCreateNodeInjector(), token, flags, defaultValue);
16191
+ function directiveInject(token, flags) {
16192
+ if (flags === void 0) { flags = 0 /* Default */; }
16193
+ return getOrCreateInjectable(getOrCreateNodeInjector(), token, flags);
16043
16194
  }
16044
16195
  /**
16045
16196
  * Creates an ElementRef and stores it on the injector.
@@ -16142,7 +16293,8 @@ function getOrCreateHostChangeDetector(currentNode) {
16142
16293
  var existingRef = hostInjector && hostInjector.changeDetectorRef;
16143
16294
  return existingRef ?
16144
16295
  existingRef :
16145
- createViewRef(hostNode.data, hostNode.view.directives[hostNode.tNode.flags >> 13 /* INDX_SHIFT */]);
16296
+ createViewRef(hostNode.data, hostNode.view
16297
+ .directives[hostNode.tNode.flags >> 13 /* DirectiveStartingIndexShift */]);
16146
16298
  }
16147
16299
  /**
16148
16300
  * If the node is an embedded view, traverses up the view tree to return the closest
@@ -16172,19 +16324,19 @@ function getClosestComponentAncestor(node) {
16172
16324
  * @param flags Injection flags (e.g. CheckParent)
16173
16325
  * @returns The instance found
16174
16326
  */
16175
- function getOrCreateInjectable(di, token, flags, defaultValue) {
16327
+ function getOrCreateInjectable(di, token, flags) {
16176
16328
  var bloomHash = bloomHashBit(token);
16177
16329
  // If the token has a bloom hash, then it is a directive that is public to the injection system
16178
16330
  // (diPublic). If there is no hash, fall back to the module injector.
16179
16331
  if (bloomHash === null) {
16180
- var moduleInjector = di.injector;
16181
- if (!moduleInjector) {
16182
- if (defaultValue != null) {
16183
- return defaultValue;
16184
- }
16185
- throw createInjectionError('NotFound', token);
16332
+ var moduleInjector = getPreviousOrParentNode().view.injector;
16333
+ var formerInjector = setCurrentInjector(moduleInjector);
16334
+ try {
16335
+ return inject(token, flags);
16336
+ }
16337
+ finally {
16338
+ setCurrentInjector(formerInjector);
16186
16339
  }
16187
- moduleInjector.get(token);
16188
16340
  }
16189
16341
  else {
16190
16342
  var injector = di;
@@ -16200,20 +16352,17 @@ function getOrCreateInjectable(di, token, flags, defaultValue) {
16200
16352
  // At this point, we have an injector which *may* contain the token, so we step through the
16201
16353
  // directives associated with the injector's corresponding node to get the directive instance.
16202
16354
  var node = injector.node;
16203
- // The size of the node's directive's list is stored in certain bits of the node's flags,
16204
- // so exact it with a mask and shift it back such that the bits reflect the real value.
16205
16355
  var flags_1 = node.tNode.flags;
16206
- var size = (flags_1 & 8190 /* SIZE_MASK */) >> 1;
16207
- if (size !== 0) {
16208
- // The start index of the directives list is also part of the node's flags, but there is
16209
- // nothing to the "left" of it so it doesn't need a mask.
16356
+ var count = flags_1 & 4095;
16357
+ if (count !== 0) {
16210
16358
  var start = flags_1 >> 13;
16359
+ var end = start + count;
16211
16360
  var defs = (node.view.tView.directives);
16212
- for (var i = start, ii = start + size; i < ii; i++) {
16361
+ for (var i = start; i < end; i++) {
16213
16362
  // Get the definition for the directive at this index and, if it is injectable (diPublic),
16214
16363
  // and matches the given token, return the directive instance.
16215
16364
  var directiveDef = defs[i];
16216
- if (directiveDef.diPublic && directiveDef.type == token) {
16365
+ if (directiveDef.type === token && directiveDef.diPublic) {
16217
16366
  return getDirectiveInstance(node.view.directives[i]);
16218
16367
  }
16219
16368
  }
@@ -16231,7 +16380,7 @@ function getOrCreateInjectable(di, token, flags, defaultValue) {
16231
16380
  }
16232
16381
  // No directive was found for the given token.
16233
16382
  // TODO: implement optional, check-self, and check-parent.
16234
- throw createInjectionError('Not found', token);
16383
+ throw new Error('Implement');
16235
16384
  }
16236
16385
  function searchMatchesQueuedForCreation(node, token) {
16237
16386
  var matches = node.view.tView.currentMatches;
@@ -16401,7 +16550,7 @@ var ViewContainerRef$1 = /** @class */ (function () {
16401
16550
  };
16402
16551
  ViewContainerRef.prototype.insert = function (viewRef, index) {
16403
16552
  var lViewNode = viewRef._lViewNode;
16404
- var adjustedIdx = this._adjustAndAssertIndex(index);
16553
+ var adjustedIdx = this._adjustIndex(index);
16405
16554
  insertView(this._lContainerNode, lViewNode, adjustedIdx);
16406
16555
  // invalidate cache of next sibling RNode (we do similar operation in the containerRefreshEnd
16407
16556
  // instruction)
@@ -16421,23 +16570,33 @@ var ViewContainerRef$1 = /** @class */ (function () {
16421
16570
  }
16422
16571
  return viewRef;
16423
16572
  };
16424
- ViewContainerRef.prototype.move = function (viewRef, currentIndex) {
16425
- throw notImplemented();
16573
+ ViewContainerRef.prototype.move = function (viewRef, newIndex) {
16574
+ var index = this.indexOf(viewRef);
16575
+ this.detach(index);
16576
+ this.insert(viewRef, this._adjustIndex(newIndex));
16577
+ return viewRef;
16426
16578
  };
16427
- ViewContainerRef.prototype.indexOf = function (viewRef) { throw notImplemented(); };
16579
+ ViewContainerRef.prototype.indexOf = function (viewRef) { return this._viewRefs.indexOf(viewRef); };
16428
16580
  ViewContainerRef.prototype.remove = function (index) {
16429
- var adjustedIdx = this._adjustAndAssertIndex(index);
16581
+ this.detach(index);
16582
+ // TODO(ml): proper destroy of the ViewRef, i.e. recursively destroy the LviewNode and its
16583
+ // children, delete DOM nodes and QueryList, trigger hooks (onDestroy), destroy the renderer,
16584
+ // detach projected nodes
16585
+ };
16586
+ ViewContainerRef.prototype.detach = function (index) {
16587
+ var adjustedIdx = this._adjustIndex(index, -1);
16430
16588
  removeView(this._lContainerNode, adjustedIdx);
16431
- this._viewRefs.splice(adjustedIdx, 1);
16589
+ return this._viewRefs.splice(adjustedIdx, 1)[0] || null;
16432
16590
  };
16433
- ViewContainerRef.prototype.detach = function (index) { throw notImplemented(); };
16434
- ViewContainerRef.prototype._adjustAndAssertIndex = function (index) {
16591
+ ViewContainerRef.prototype._adjustIndex = function (index, shift) {
16592
+ if (shift === void 0) { shift = 0; }
16435
16593
  if (index == null) {
16436
- index = this._lContainerNode.data.views.length;
16594
+ return this._lContainerNode.data.views.length + shift;
16437
16595
  }
16438
- else {
16596
+ if (ngDevMode) {
16597
+ assertGreaterThan(index, -1, 'index must be positive');
16439
16598
  // +1 because it's legal to insert at the end.
16440
- ngDevMode && assertLessThan(index, this._lContainerNode.data.views.length + 1, 'index');
16599
+ assertLessThan(index, this._lContainerNode.data.views.length + 1 + shift, 'index');
16441
16600
  }
16442
16601
  return index;
16443
16602
  };
@@ -16453,16 +16612,19 @@ var ViewContainerRef$1 = /** @class */ (function () {
16453
16612
  function getOrCreateTemplateRef(di) {
16454
16613
  ngDevMode && assertNodeType(di.node, 0 /* Container */);
16455
16614
  var data = di.node.data;
16456
- return di.templateRef || (di.templateRef = new TemplateRef$1(getOrCreateElementRef(di), (data.template), getRenderer()));
16615
+ var tView = di.node.view.tView;
16616
+ return di.templateRef || (di.templateRef = new TemplateRef$1(getOrCreateElementRef(di), (data.template), getRenderer(), tView.directiveRegistry, tView.pipeRegistry));
16457
16617
  }
16458
16618
  var TemplateRef$1 = /** @class */ (function () {
16459
- function TemplateRef(elementRef, template, _renderer) {
16619
+ function TemplateRef(elementRef, template, _renderer, _directives, _pipes) {
16460
16620
  this._renderer = _renderer;
16621
+ this._directives = _directives;
16622
+ this._pipes = _pipes;
16461
16623
  this.elementRef = elementRef;
16462
16624
  this._template = template;
16463
16625
  }
16464
16626
  TemplateRef.prototype.createEmbeddedView = function (context) {
16465
- var viewNode = renderEmbeddedTemplate(null, this._template, context, this._renderer);
16627
+ var viewNode = renderEmbeddedTemplate(null, this._template, context, this._renderer, this._directives, this._pipes);
16466
16628
  return addDestroyable(new EmbeddedViewRef$1(viewNode, this._template, context));
16467
16629
  };
16468
16630
  return TemplateRef;
@@ -17118,13 +17280,15 @@ function getIdxOfMatchingSelector(tNode, selector) {
17118
17280
  * @param type Type of a directive to look for.
17119
17281
  * @returns Index of a found directive or null when none found.
17120
17282
  */
17121
- function geIdxOfMatchingDirective(node, type) {
17283
+ function getIdxOfMatchingDirective(node, type) {
17122
17284
  var defs = (node.view.tView.directives);
17123
17285
  var flags = node.tNode.flags;
17124
- var size = (flags & 8190 /* SIZE_MASK */) >> 1;
17125
- for (var i = flags >> 13 /* INDX_SHIFT */, ii = i + size; i < ii; i++) {
17286
+ var count = flags & 4095;
17287
+ var start = flags >> 13;
17288
+ var end = start + count;
17289
+ for (var i = start; i < end; i++) {
17126
17290
  var def = defs[i];
17127
- if (def.diPublic && def.type === type) {
17291
+ if (def.type === type && def.diPublic) {
17128
17292
  return i;
17129
17293
  }
17130
17294
  }
@@ -17135,7 +17299,7 @@ function readFromNodeInjector(nodeInjector, node, read, directiveIdx) {
17135
17299
  return read.read(nodeInjector, node, directiveIdx);
17136
17300
  }
17137
17301
  else {
17138
- var matchingIdx = geIdxOfMatchingDirective(node, read);
17302
+ var matchingIdx = getIdxOfMatchingDirective(node, read);
17139
17303
  if (matchingIdx !== null) {
17140
17304
  return node.view.directives[matchingIdx];
17141
17305
  }
@@ -17148,7 +17312,7 @@ function add(query, node) {
17148
17312
  var predicate = query.predicate;
17149
17313
  var type = predicate.type;
17150
17314
  if (type) {
17151
- var directiveIdx = geIdxOfMatchingDirective(node, type);
17315
+ var directiveIdx = getIdxOfMatchingDirective(node, type);
17152
17316
  if (directiveIdx !== null) {
17153
17317
  // a node is matching a predicate - determine what to read
17154
17318
  // if read token and / or strategy is not specified, use type as read token
@@ -17663,6 +17827,8 @@ exports.NO_ERRORS_SCHEMA = NO_ERRORS_SCHEMA;
17663
17827
  exports.NgModule = NgModule;
17664
17828
  exports.Version = Version;
17665
17829
  exports.VERSION = VERSION;
17830
+ exports.defineInjectable = defineInjectable;
17831
+ exports.defineInjector = defineInjector;
17666
17832
  exports.forwardRef = forwardRef;
17667
17833
  exports.resolveForwardRef = resolveForwardRef;
17668
17834
  exports.Injectable = Injectable;
@@ -17679,8 +17845,6 @@ exports.Optional = Optional;
17679
17845
  exports.Self = Self;
17680
17846
  exports.SkipSelf = SkipSelf;
17681
17847
  exports.Host = Host;
17682
- exports.defineInjectable = defineInjectable;
17683
- exports.defineInjector = defineInjector;
17684
17848
  exports.NgZone = NgZone;
17685
17849
  exports.RenderComponentType = RenderComponentType;
17686
17850
  exports.Renderer = Renderer;
@@ -17720,6 +17884,7 @@ exports.ɵdevModeEqual = devModeEqual;
17720
17884
  exports.ɵisListLikeIterable = isListLikeIterable;
17721
17885
  exports.ɵisDefaultChangeDetectionStrategy = isDefaultChangeDetectionStrategy;
17722
17886
  exports.ɵConsole = Console;
17887
+ exports.ɵinject = inject;
17723
17888
  exports.ɵsetCurrentInjector = setCurrentInjector;
17724
17889
  exports.ɵAPP_ROOT = APP_ROOT;
17725
17890
  exports.ɵComponentFactory = ComponentFactory;
@@ -17802,6 +17967,7 @@ exports.ɵv = embeddedViewEnd;
17802
17967
  exports.ɵst = store;
17803
17968
  exports.ɵld = load;
17804
17969
  exports.ɵPp = pipe;
17970
+ exports.ɵwhenRendered = whenRendered;
17805
17971
  exports.ɵbypassSanitizationTrustHtml = bypassSanitizationTrustHtml;
17806
17972
  exports.ɵbypassSanitizationTrustStyle = bypassSanitizationTrustStyle;
17807
17973
  exports.ɵbypassSanitizationTrustScript = bypassSanitizationTrustScript;