@angular/core 14.0.0 → 14.0.3

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 (40) hide show
  1. package/esm2020/src/application_ref.mjs +10 -24
  2. package/esm2020/src/change_detection/differs/default_iterable_differ.mjs +3 -5
  3. package/esm2020/src/change_detection/differs/default_keyvalue_differ.mjs +3 -5
  4. package/esm2020/src/change_detection/differs/iterable_differs.mjs +3 -5
  5. package/esm2020/src/change_detection/differs/keyvalue_differs.mjs +2 -5
  6. package/esm2020/src/di/injector_compatibility.mjs +4 -9
  7. package/esm2020/src/di/provider_collection.mjs +1 -1
  8. package/esm2020/src/error_handler.mjs +4 -7
  9. package/esm2020/src/errors.mjs +6 -3
  10. package/esm2020/src/render3/component.mjs +9 -9
  11. package/esm2020/src/render3/definition.mjs +4 -4
  12. package/esm2020/src/render3/features/inherit_definition_feature.mjs +3 -5
  13. package/esm2020/src/render3/features/standalone_feature.mjs +4 -4
  14. package/esm2020/src/render3/instructions/all.mjs +2 -2
  15. package/esm2020/src/render3/instructions/element.mjs +3 -79
  16. package/esm2020/src/render3/instructions/element_validation.mjs +264 -0
  17. package/esm2020/src/render3/instructions/shared.mjs +7 -184
  18. package/esm2020/src/render3/interfaces/definition.mjs +1 -1
  19. package/esm2020/src/render3/jit/directive.mjs +20 -3
  20. package/esm2020/src/render3/jit/module.mjs +3 -2
  21. package/esm2020/src/render3/pipe.mjs +20 -6
  22. package/esm2020/src/render3/state.mjs +1 -3
  23. package/esm2020/src/render3/view_ref.mjs +3 -5
  24. package/esm2020/src/sanitization/sanitization.mjs +4 -9
  25. package/esm2020/src/util/errors.mjs +1 -8
  26. package/esm2020/src/version.mjs +1 -1
  27. package/esm2020/testing/src/logger.mjs +3 -3
  28. package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
  29. package/esm2020/testing/src/r3_test_bed_compiler.mjs +30 -25
  30. package/fesm2015/core.mjs +636 -644
  31. package/fesm2015/core.mjs.map +1 -1
  32. package/fesm2015/testing.mjs +633 -630
  33. package/fesm2015/testing.mjs.map +1 -1
  34. package/fesm2020/core.mjs +637 -645
  35. package/fesm2020/core.mjs.map +1 -1
  36. package/fesm2020/testing.mjs +634 -631
  37. package/fesm2020/testing.mjs.map +1 -1
  38. package/index.d.ts +7 -6
  39. package/package.json +1 -1
  40. package/testing/index.d.ts +1 -1
package/fesm2015/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.0.0
2
+ * @license Angular v14.0.3
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -181,9 +181,12 @@ function formatRuntimeError(code, message) {
181
181
  // Error code might be a negative number, which is a special marker that instructs the logic to
182
182
  // generate a link to the error details page on angular.io.
183
183
  const fullCode = `NG0${Math.abs(code)}`;
184
- let errorMessage = `${fullCode}${message ? ': ' + message : ''}`;
184
+ let errorMessage = `${fullCode}${message ? ': ' + message.trim() : ''}`;
185
185
  if (ngDevMode && code < 0) {
186
- errorMessage = `${errorMessage}. Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/${fullCode}`;
186
+ const addPeriodSeparator = !errorMessage.match(/[.,;!?]$/);
187
+ const separator = addPeriodSeparator ? '.' : '';
188
+ errorMessage =
189
+ `${errorMessage}${separator} Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/${fullCode}`;
187
190
  }
188
191
  return errorMessage;
189
192
  }
@@ -864,7 +867,8 @@ const NG_ELEMENT_ID = getClosureSafeProperty({ __NG_ELEMENT_ID__: getClosureSafe
864
867
  * Use of this source code is governed by an MIT-style license that can be
865
868
  * found in the LICENSE file at https://angular.io/license
866
869
  */
867
- let _renderCompCount = 0;
870
+ /** Counter used to generate unique IDs for component definitions. */
871
+ let componentDefCount = 0;
868
872
  /**
869
873
  * Create a component definition object.
870
874
  *
@@ -917,7 +921,7 @@ function ɵɵdefineComponent(componentDefinition) {
917
921
  features: componentDefinition.features || null,
918
922
  data: componentDefinition.data || {},
919
923
  encapsulation: componentDefinition.encapsulation || ViewEncapsulation$1.Emulated,
920
- id: 'c',
924
+ id: `c${componentDefCount++}`,
921
925
  styles: componentDefinition.styles || EMPTY_ARRAY,
922
926
  _: null,
923
927
  setInput: null,
@@ -926,7 +930,6 @@ function ɵɵdefineComponent(componentDefinition) {
926
930
  };
927
931
  const dependencies = componentDefinition.dependencies;
928
932
  const feature = componentDefinition.features;
929
- def.id += _renderCompCount++;
930
933
  def.inputs = invertObject(componentDefinition.inputs, declaredInputs),
931
934
  def.outputs = invertObject(componentDefinition.outputs),
932
935
  feature && feature.forEach((fn) => fn(def));
@@ -1933,7 +1936,6 @@ function getLView() {
1933
1936
  function getTView() {
1934
1937
  return instructionState.lFrame.tView;
1935
1938
  }
1936
- // TODO(crisbeto): revert the @noinline once Closure issue is resolved.
1937
1939
  /**
1938
1940
  * Restores `contextViewData` to the given OpaqueViewState instance.
1939
1941
  *
@@ -1945,7 +1947,6 @@ function getTView() {
1945
1947
  * @returns Context of the restored OpaqueViewState instance.
1946
1948
  *
1947
1949
  * @codeGenApi
1948
- * @noinline Disable inlining due to issue with Closure in listeners inside embedded views.
1949
1950
  */
1950
1951
  function ɵɵrestoreView(viewToRestore) {
1951
1952
  instructionState.lFrame.contextLView = viewToRestore;
@@ -4836,10 +4837,8 @@ function setCurrentInjector(injector) {
4836
4837
  }
4837
4838
  function injectInjectorOnly(token, flags = InjectFlags.Default) {
4838
4839
  if (_currentInjector === undefined) {
4839
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
4840
- `inject() must be called from an injection context (a constructor, a factory function or a field initializer)` :
4841
- '';
4842
- throw new RuntimeError(-203 /* RuntimeErrorCode.MISSING_INJECTION_CONTEXT */, errorMessage);
4840
+ throw new RuntimeError(-203 /* RuntimeErrorCode.MISSING_INJECTION_CONTEXT */, ngDevMode &&
4841
+ `inject() must be called from an injection context (a constructor, a factory function or a field initializer)`);
4843
4842
  }
4844
4843
  else if (_currentInjector === null) {
4845
4844
  return injectRootLimpMode(token, undefined, flags);
@@ -4945,10 +4944,7 @@ function injectArgs(types) {
4945
4944
  const arg = resolveForwardRef(types[i]);
4946
4945
  if (Array.isArray(arg)) {
4947
4946
  if (arg.length === 0) {
4948
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
4949
- 'Arguments array must have arguments.' :
4950
- '';
4951
- throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, errorMessage);
4947
+ throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, ngDevMode && 'Arguments array must have arguments.');
4952
4948
  }
4953
4949
  let type = undefined;
4954
4950
  let flags = InjectFlags.Default;
@@ -6199,10 +6195,8 @@ function ɵɵsanitizeResourceUrl(unsafeResourceUrl) {
6199
6195
  if (allowSanitizationBypassAndThrow(unsafeResourceUrl, "ResourceURL" /* BypassType.ResourceUrl */)) {
6200
6196
  return trustedScriptURLFromStringBypass(unwrapSafeValue(unsafeResourceUrl));
6201
6197
  }
6202
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
6203
- 'unsafe value used in a resource URL context (see https://g.co/ng/security#xss)' :
6204
- '';
6205
- throw new RuntimeError(904 /* RuntimeErrorCode.UNSAFE_VALUE_IN_RESOURCE_URL */, errorMessage);
6198
+ throw new RuntimeError(904 /* RuntimeErrorCode.UNSAFE_VALUE_IN_RESOURCE_URL */, ngDevMode &&
6199
+ 'unsafe value used in a resource URL context (see https://g.co/ng/security#xss)');
6206
6200
  }
6207
6201
  /**
6208
6202
  * A `script` sanitizer which only lets trusted javascript through.
@@ -6224,10 +6218,7 @@ function ɵɵsanitizeScript(unsafeScript) {
6224
6218
  if (allowSanitizationBypassAndThrow(unsafeScript, "Script" /* BypassType.Script */)) {
6225
6219
  return trustedScriptFromStringBypass(unwrapSafeValue(unsafeScript));
6226
6220
  }
6227
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
6228
- 'unsafe value used in a script context' :
6229
- '';
6230
- throw new RuntimeError(905 /* RuntimeErrorCode.UNSAFE_VALUE_IN_SCRIPT */, errorMessage);
6221
+ throw new RuntimeError(905 /* RuntimeErrorCode.UNSAFE_VALUE_IN_SCRIPT */, ngDevMode && 'unsafe value used in a script context');
6231
6222
  }
6232
6223
  /**
6233
6224
  * A template tag function for promoting the associated constant literal to a
@@ -6334,6 +6325,155 @@ function getSanitizer() {
6334
6325
  return lView && lView[SANITIZER];
6335
6326
  }
6336
6327
 
6328
+ /**
6329
+ * @license
6330
+ * Copyright Google LLC All Rights Reserved.
6331
+ *
6332
+ * Use of this source code is governed by an MIT-style license that can be
6333
+ * found in the LICENSE file at https://angular.io/license
6334
+ */
6335
+ const ERROR_ORIGINAL_ERROR = 'ngOriginalError';
6336
+ function wrappedError(message, originalError) {
6337
+ const msg = `${message} caused by: ${originalError instanceof Error ? originalError.message : originalError}`;
6338
+ const error = Error(msg);
6339
+ error[ERROR_ORIGINAL_ERROR] = originalError;
6340
+ return error;
6341
+ }
6342
+ function getOriginalError(error) {
6343
+ return error[ERROR_ORIGINAL_ERROR];
6344
+ }
6345
+
6346
+ /**
6347
+ * @license
6348
+ * Copyright Google LLC All Rights Reserved.
6349
+ *
6350
+ * Use of this source code is governed by an MIT-style license that can be
6351
+ * found in the LICENSE file at https://angular.io/license
6352
+ */
6353
+ /**
6354
+ * Provides a hook for centralized exception handling.
6355
+ *
6356
+ * The default implementation of `ErrorHandler` prints error messages to the `console`. To
6357
+ * intercept error handling, write a custom exception handler that replaces this default as
6358
+ * appropriate for your app.
6359
+ *
6360
+ * @usageNotes
6361
+ * ### Example
6362
+ *
6363
+ * ```
6364
+ * class MyErrorHandler implements ErrorHandler {
6365
+ * handleError(error) {
6366
+ * // do something with the exception
6367
+ * }
6368
+ * }
6369
+ *
6370
+ * @NgModule({
6371
+ * providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
6372
+ * })
6373
+ * class MyModule {}
6374
+ * ```
6375
+ *
6376
+ * @publicApi
6377
+ */
6378
+ class ErrorHandler {
6379
+ constructor() {
6380
+ /**
6381
+ * @internal
6382
+ */
6383
+ this._console = console;
6384
+ }
6385
+ handleError(error) {
6386
+ const originalError = this._findOriginalError(error);
6387
+ this._console.error('ERROR', error);
6388
+ if (originalError) {
6389
+ this._console.error('ORIGINAL ERROR', originalError);
6390
+ }
6391
+ }
6392
+ /** @internal */
6393
+ _findOriginalError(error) {
6394
+ let e = error && getOriginalError(error);
6395
+ while (e && getOriginalError(e)) {
6396
+ e = getOriginalError(e);
6397
+ }
6398
+ return e || null;
6399
+ }
6400
+ }
6401
+
6402
+ /**
6403
+ * @license
6404
+ * Copyright Google LLC All Rights Reserved.
6405
+ *
6406
+ * Use of this source code is governed by an MIT-style license that can be
6407
+ * found in the LICENSE file at https://angular.io/license
6408
+ */
6409
+ /**
6410
+ * Disallowed strings in the comment.
6411
+ *
6412
+ * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
6413
+ */
6414
+ const COMMENT_DISALLOWED = /^>|^->|<!--|-->|--!>|<!-$/g;
6415
+ /**
6416
+ * Delimiter in the disallowed strings which needs to be wrapped with zero with character.
6417
+ */
6418
+ const COMMENT_DELIMITER = /(<|>)/;
6419
+ const COMMENT_DELIMITER_ESCAPED = '\u200B$1\u200B';
6420
+ /**
6421
+ * Escape the content of comment strings so that it can be safely inserted into a comment node.
6422
+ *
6423
+ * The issue is that HTML does not specify any way to escape comment end text inside the comment.
6424
+ * Consider: `<!-- The way you close a comment is with ">", and "->" at the beginning or by "-->" or
6425
+ * "--!>" at the end. -->`. Above the `"-->"` is meant to be text not an end to the comment. This
6426
+ * can be created programmatically through DOM APIs. (`<!--` are also disallowed.)
6427
+ *
6428
+ * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
6429
+ *
6430
+ * ```
6431
+ * div.innerHTML = div.innerHTML
6432
+ * ```
6433
+ *
6434
+ * One would expect that the above code would be safe to do, but it turns out that because comment
6435
+ * text is not escaped, the comment may contain text which will prematurely close the comment
6436
+ * opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
6437
+ * may contain such text and expect them to be safe.)
6438
+ *
6439
+ * This function escapes the comment text by looking for comment delimiters (`<` and `>`) and
6440
+ * surrounding them with `_>_` where the `_` is a zero width space `\u200B`. The result is that if a
6441
+ * comment contains any of the comment start/end delimiters (such as `<!--`, `-->` or `--!>`) the
6442
+ * text it will render normally but it will not cause the HTML parser to close/open the comment.
6443
+ *
6444
+ * @param value text to make safe for comment node by escaping the comment open/close character
6445
+ * sequence.
6446
+ */
6447
+ function escapeCommentText(value) {
6448
+ return value.replace(COMMENT_DISALLOWED, (text) => text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED));
6449
+ }
6450
+
6451
+ /**
6452
+ * @license
6453
+ * Copyright Google LLC All Rights Reserved.
6454
+ *
6455
+ * Use of this source code is governed by an MIT-style license that can be
6456
+ * found in the LICENSE file at https://angular.io/license
6457
+ */
6458
+ function normalizeDebugBindingName(name) {
6459
+ // Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
6460
+ name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
6461
+ return `ng-reflect-${name}`;
6462
+ }
6463
+ const CAMEL_CASE_REGEXP = /([A-Z])/g;
6464
+ function camelCaseToDashCase(input) {
6465
+ return input.replace(CAMEL_CASE_REGEXP, (...m) => '-' + m[1].toLowerCase());
6466
+ }
6467
+ function normalizeDebugBindingValue(value) {
6468
+ try {
6469
+ // Limit the size of the value as otherwise the DOM just gets polluted.
6470
+ return value != null ? value.toString().slice(0, 30) : value;
6471
+ }
6472
+ catch (e) {
6473
+ return '[ERROR] Exception while trying to serialize the value';
6474
+ }
6475
+ }
6476
+
6337
6477
  /**
6338
6478
  * @license
6339
6479
  * Copyright Google LLC All Rights Reserved.
@@ -6689,216 +6829,26 @@ function getDirectivesAtNodeIndex(nodeIndex, lView, includeComponents) {
6689
6829
  return lView.slice(directiveStartIndex, directiveEndIndex);
6690
6830
  }
6691
6831
  function getComponentAtNodeIndex(nodeIndex, lView) {
6692
- const tNode = lView[TVIEW].data[nodeIndex];
6693
- let directiveStartIndex = tNode.directiveStart;
6694
- return tNode.flags & 2 /* TNodeFlags.isComponentHost */ ? lView[directiveStartIndex] : null;
6695
- }
6696
- /**
6697
- * Returns a map of local references (local reference name => element or directive instance) that
6698
- * exist on a given element.
6699
- */
6700
- function discoverLocalRefs(lView, nodeIndex) {
6701
- const tNode = lView[TVIEW].data[nodeIndex];
6702
- if (tNode && tNode.localNames) {
6703
- const result = {};
6704
- let localIndex = tNode.index + 1;
6705
- for (let i = 0; i < tNode.localNames.length; i += 2) {
6706
- result[tNode.localNames[i]] = lView[localIndex];
6707
- localIndex++;
6708
- }
6709
- return result;
6710
- }
6711
- return null;
6712
- }
6713
-
6714
- /**
6715
- * @license
6716
- * Copyright Google LLC All Rights Reserved.
6717
- *
6718
- * Use of this source code is governed by an MIT-style license that can be
6719
- * found in the LICENSE file at https://angular.io/license
6720
- */
6721
- const ERROR_ORIGINAL_ERROR = 'ngOriginalError';
6722
- const ERROR_LOGGER = 'ngErrorLogger';
6723
- function wrappedError(message, originalError) {
6724
- const msg = `${message} caused by: ${originalError instanceof Error ? originalError.message : originalError}`;
6725
- const error = Error(msg);
6726
- error[ERROR_ORIGINAL_ERROR] = originalError;
6727
- return error;
6728
- }
6729
- function getOriginalError(error) {
6730
- return error[ERROR_ORIGINAL_ERROR];
6731
- }
6732
- function getErrorLogger(error) {
6733
- return error && error[ERROR_LOGGER] || defaultErrorLogger;
6734
- }
6735
- function defaultErrorLogger(console, ...values) {
6736
- console.error(...values);
6737
- }
6738
-
6739
- /**
6740
- * @license
6741
- * Copyright Google LLC All Rights Reserved.
6742
- *
6743
- * Use of this source code is governed by an MIT-style license that can be
6744
- * found in the LICENSE file at https://angular.io/license
6745
- */
6746
- /**
6747
- * Provides a hook for centralized exception handling.
6748
- *
6749
- * The default implementation of `ErrorHandler` prints error messages to the `console`. To
6750
- * intercept error handling, write a custom exception handler that replaces this default as
6751
- * appropriate for your app.
6752
- *
6753
- * @usageNotes
6754
- * ### Example
6755
- *
6756
- * ```
6757
- * class MyErrorHandler implements ErrorHandler {
6758
- * handleError(error) {
6759
- * // do something with the exception
6760
- * }
6761
- * }
6762
- *
6763
- * @NgModule({
6764
- * providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
6765
- * })
6766
- * class MyModule {}
6767
- * ```
6768
- *
6769
- * @publicApi
6770
- */
6771
- class ErrorHandler {
6772
- constructor() {
6773
- /**
6774
- * @internal
6775
- */
6776
- this._console = console;
6777
- }
6778
- handleError(error) {
6779
- const originalError = this._findOriginalError(error);
6780
- // Note: Browser consoles show the place from where console.error was called.
6781
- // We can use this to give users additional information about the error.
6782
- const errorLogger = getErrorLogger(error);
6783
- errorLogger(this._console, `ERROR`, error);
6784
- if (originalError) {
6785
- errorLogger(this._console, `ORIGINAL ERROR`, originalError);
6786
- }
6787
- }
6788
- /** @internal */
6789
- _findOriginalError(error) {
6790
- let e = error && getOriginalError(error);
6791
- while (e && getOriginalError(e)) {
6792
- e = getOriginalError(e);
6793
- }
6794
- return e || null;
6795
- }
6796
- }
6797
-
6798
- /**
6799
- * @license
6800
- * Copyright Google LLC All Rights Reserved.
6801
- *
6802
- * Use of this source code is governed by an MIT-style license that can be
6803
- * found in the LICENSE file at https://angular.io/license
6804
- */
6805
- /**
6806
- * Defines a schema that allows an NgModule to contain the following:
6807
- * - Non-Angular elements named with dash case (`-`).
6808
- * - Element properties named with dash case (`-`).
6809
- * Dash case is the naming convention for custom elements.
6810
- *
6811
- * @publicApi
6812
- */
6813
- const CUSTOM_ELEMENTS_SCHEMA = {
6814
- name: 'custom-elements'
6815
- };
6816
- /**
6817
- * Defines a schema that allows any property on any element.
6818
- *
6819
- * This schema allows you to ignore the errors related to any unknown elements or properties in a
6820
- * template. The usage of this schema is generally discouraged because it prevents useful validation
6821
- * and may hide real errors in your template. Consider using the `CUSTOM_ELEMENTS_SCHEMA` instead.
6822
- *
6823
- * @publicApi
6824
- */
6825
- const NO_ERRORS_SCHEMA = {
6826
- name: 'no-errors-schema'
6827
- };
6828
-
6829
- /**
6830
- * @license
6831
- * Copyright Google LLC All Rights Reserved.
6832
- *
6833
- * Use of this source code is governed by an MIT-style license that can be
6834
- * found in the LICENSE file at https://angular.io/license
6835
- */
6836
- /**
6837
- * Disallowed strings in the comment.
6838
- *
6839
- * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
6840
- */
6841
- const COMMENT_DISALLOWED = /^>|^->|<!--|-->|--!>|<!-$/g;
6842
- /**
6843
- * Delimiter in the disallowed strings which needs to be wrapped with zero with character.
6844
- */
6845
- const COMMENT_DELIMITER = /(<|>)/;
6846
- const COMMENT_DELIMITER_ESCAPED = '\u200B$1\u200B';
6847
- /**
6848
- * Escape the content of comment strings so that it can be safely inserted into a comment node.
6849
- *
6850
- * The issue is that HTML does not specify any way to escape comment end text inside the comment.
6851
- * Consider: `<!-- The way you close a comment is with ">", and "->" at the beginning or by "-->" or
6852
- * "--!>" at the end. -->`. Above the `"-->"` is meant to be text not an end to the comment. This
6853
- * can be created programmatically through DOM APIs. (`<!--` are also disallowed.)
6854
- *
6855
- * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
6856
- *
6857
- * ```
6858
- * div.innerHTML = div.innerHTML
6859
- * ```
6860
- *
6861
- * One would expect that the above code would be safe to do, but it turns out that because comment
6862
- * text is not escaped, the comment may contain text which will prematurely close the comment
6863
- * opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
6864
- * may contain such text and expect them to be safe.)
6865
- *
6866
- * This function escapes the comment text by looking for comment delimiters (`<` and `>`) and
6867
- * surrounding them with `_>_` where the `_` is a zero width space `\u200B`. The result is that if a
6868
- * comment contains any of the comment start/end delimiters (such as `<!--`, `-->` or `--!>`) the
6869
- * text it will render normally but it will not cause the HTML parser to close/open the comment.
6870
- *
6871
- * @param value text to make safe for comment node by escaping the comment open/close character
6872
- * sequence.
6873
- */
6874
- function escapeCommentText(value) {
6875
- return value.replace(COMMENT_DISALLOWED, (text) => text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED));
6832
+ const tNode = lView[TVIEW].data[nodeIndex];
6833
+ let directiveStartIndex = tNode.directiveStart;
6834
+ return tNode.flags & 2 /* TNodeFlags.isComponentHost */ ? lView[directiveStartIndex] : null;
6876
6835
  }
6877
-
6878
6836
  /**
6879
- * @license
6880
- * Copyright Google LLC All Rights Reserved.
6881
- *
6882
- * Use of this source code is governed by an MIT-style license that can be
6883
- * found in the LICENSE file at https://angular.io/license
6837
+ * Returns a map of local references (local reference name => element or directive instance) that
6838
+ * exist on a given element.
6884
6839
  */
6885
- function normalizeDebugBindingName(name) {
6886
- // Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
6887
- name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
6888
- return `ng-reflect-${name}`;
6889
- }
6890
- const CAMEL_CASE_REGEXP = /([A-Z])/g;
6891
- function camelCaseToDashCase(input) {
6892
- return input.replace(CAMEL_CASE_REGEXP, (...m) => '-' + m[1].toLowerCase());
6893
- }
6894
- function normalizeDebugBindingValue(value) {
6895
- try {
6896
- // Limit the size of the value as otherwise the DOM just gets polluted.
6897
- return value != null ? value.toString().slice(0, 30) : value;
6898
- }
6899
- catch (e) {
6900
- return '[ERROR] Exception while trying to serialize the value';
6840
+ function discoverLocalRefs(lView, nodeIndex) {
6841
+ const tNode = lView[TVIEW].data[nodeIndex];
6842
+ if (tNode && tNode.localNames) {
6843
+ const result = {};
6844
+ let localIndex = tNode.index + 1;
6845
+ for (let i = 0; i < tNode.localNames.length; i += 2) {
6846
+ result[tNode.localNames[i]] = lView[localIndex];
6847
+ localIndex++;
6848
+ }
6849
+ return result;
6901
6850
  }
6851
+ return null;
6902
6852
  }
6903
6853
 
6904
6854
  /**
@@ -10340,113 +10290,403 @@ class ReflectiveInjector_ {
10340
10290
  return this.objs[i];
10341
10291
  }
10342
10292
  }
10343
- return UNDEFINED;
10293
+ return UNDEFINED;
10294
+ }
10295
+ /** @internal */
10296
+ _throwOrNull(key, notFoundValue) {
10297
+ if (notFoundValue !== THROW_IF_NOT_FOUND) {
10298
+ return notFoundValue;
10299
+ }
10300
+ else {
10301
+ throw noProviderError(this, key);
10302
+ }
10303
+ }
10304
+ /** @internal */
10305
+ _getByKeySelf(key, notFoundValue) {
10306
+ const obj = this._getObjByKeyId(key.id);
10307
+ return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue);
10308
+ }
10309
+ /** @internal */
10310
+ _getByKeyDefault(key, notFoundValue, visibility) {
10311
+ let inj;
10312
+ if (visibility instanceof SkipSelf) {
10313
+ inj = this.parent;
10314
+ }
10315
+ else {
10316
+ inj = this;
10317
+ }
10318
+ while (inj instanceof ReflectiveInjector_) {
10319
+ const inj_ = inj;
10320
+ const obj = inj_._getObjByKeyId(key.id);
10321
+ if (obj !== UNDEFINED)
10322
+ return obj;
10323
+ inj = inj_.parent;
10324
+ }
10325
+ if (inj !== null) {
10326
+ return inj.get(key.token, notFoundValue);
10327
+ }
10328
+ else {
10329
+ return this._throwOrNull(key, notFoundValue);
10330
+ }
10331
+ }
10332
+ get displayName() {
10333
+ const providers = _mapProviders(this, (b) => ' "' + b.key.displayName + '" ')
10334
+ .join(', ');
10335
+ return `ReflectiveInjector(providers: [${providers}])`;
10336
+ }
10337
+ toString() {
10338
+ return this.displayName;
10339
+ }
10340
+ }
10341
+ ReflectiveInjector_.INJECTOR_KEY = ( /* @__PURE__ */ReflectiveKey.get(Injector));
10342
+ function _mapProviders(injector, fn) {
10343
+ const res = [];
10344
+ for (let i = 0; i < injector._providers.length; ++i) {
10345
+ res[i] = fn(injector.getProviderAtIndex(i));
10346
+ }
10347
+ return res;
10348
+ }
10349
+
10350
+ /**
10351
+ * @license
10352
+ * Copyright Google LLC All Rights Reserved.
10353
+ *
10354
+ * Use of this source code is governed by an MIT-style license that can be
10355
+ * found in the LICENSE file at https://angular.io/license
10356
+ */
10357
+
10358
+ /**
10359
+ * @license
10360
+ * Copyright Google LLC All Rights Reserved.
10361
+ *
10362
+ * Use of this source code is governed by an MIT-style license that can be
10363
+ * found in the LICENSE file at https://angular.io/license
10364
+ */
10365
+
10366
+ /**
10367
+ * @license
10368
+ * Copyright Google LLC All Rights Reserved.
10369
+ *
10370
+ * Use of this source code is governed by an MIT-style license that can be
10371
+ * found in the LICENSE file at https://angular.io/license
10372
+ */
10373
+ function ɵɵdirectiveInject(token, flags = InjectFlags.Default) {
10374
+ const lView = getLView();
10375
+ // Fall back to inject() if view hasn't been created. This situation can happen in tests
10376
+ // if inject utilities are used before bootstrapping.
10377
+ if (lView === null) {
10378
+ // Verify that we will not get into infinite loop.
10379
+ ngDevMode && assertInjectImplementationNotEqual(ɵɵdirectiveInject);
10380
+ return ɵɵinject(token, flags);
10381
+ }
10382
+ const tNode = getCurrentTNode();
10383
+ return getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags);
10384
+ }
10385
+ /**
10386
+ * Throws an error indicating that a factory function could not be generated by the compiler for a
10387
+ * particular class.
10388
+ *
10389
+ * This instruction allows the actual error message to be optimized away when ngDevMode is turned
10390
+ * off, saving bytes of generated code while still providing a good experience in dev mode.
10391
+ *
10392
+ * The name of the class is not mentioned here, but will be in the generated factory function name
10393
+ * and thus in the stack trace.
10394
+ *
10395
+ * @codeGenApi
10396
+ */
10397
+ function ɵɵinvalidFactory() {
10398
+ const msg = ngDevMode ? `This constructor was not compatible with Dependency Injection.` : 'invalid';
10399
+ throw new Error(msg);
10400
+ }
10401
+
10402
+ /**
10403
+ * @license
10404
+ * Copyright Google LLC All Rights Reserved.
10405
+ *
10406
+ * Use of this source code is governed by an MIT-style license that can be
10407
+ * found in the LICENSE file at https://angular.io/license
10408
+ */
10409
+ /**
10410
+ * Defines a schema that allows an NgModule to contain the following:
10411
+ * - Non-Angular elements named with dash case (`-`).
10412
+ * - Element properties named with dash case (`-`).
10413
+ * Dash case is the naming convention for custom elements.
10414
+ *
10415
+ * @publicApi
10416
+ */
10417
+ const CUSTOM_ELEMENTS_SCHEMA = {
10418
+ name: 'custom-elements'
10419
+ };
10420
+ /**
10421
+ * Defines a schema that allows any property on any element.
10422
+ *
10423
+ * This schema allows you to ignore the errors related to any unknown elements or properties in a
10424
+ * template. The usage of this schema is generally discouraged because it prevents useful validation
10425
+ * and may hide real errors in your template. Consider using the `CUSTOM_ELEMENTS_SCHEMA` instead.
10426
+ *
10427
+ * @publicApi
10428
+ */
10429
+ const NO_ERRORS_SCHEMA = {
10430
+ name: 'no-errors-schema'
10431
+ };
10432
+
10433
+ /**
10434
+ * @license
10435
+ * Copyright Google LLC All Rights Reserved.
10436
+ *
10437
+ * Use of this source code is governed by an MIT-style license that can be
10438
+ * found in the LICENSE file at https://angular.io/license
10439
+ */
10440
+ let shouldThrowErrorOnUnknownElement = false;
10441
+ /**
10442
+ * Sets a strict mode for JIT-compiled components to throw an error on unknown elements,
10443
+ * instead of just logging the error.
10444
+ * (for AOT-compiled ones this check happens at build time).
10445
+ */
10446
+ function ɵsetUnknownElementStrictMode(shouldThrow) {
10447
+ shouldThrowErrorOnUnknownElement = shouldThrow;
10448
+ }
10449
+ /**
10450
+ * Gets the current value of the strict mode.
10451
+ */
10452
+ function ɵgetUnknownElementStrictMode() {
10453
+ return shouldThrowErrorOnUnknownElement;
10454
+ }
10455
+ let shouldThrowErrorOnUnknownProperty = false;
10456
+ /**
10457
+ * Sets a strict mode for JIT-compiled components to throw an error on unknown properties,
10458
+ * instead of just logging the error.
10459
+ * (for AOT-compiled ones this check happens at build time).
10460
+ */
10461
+ function ɵsetUnknownPropertyStrictMode(shouldThrow) {
10462
+ shouldThrowErrorOnUnknownProperty = shouldThrow;
10463
+ }
10464
+ /**
10465
+ * Gets the current value of the strict mode.
10466
+ */
10467
+ function ɵgetUnknownPropertyStrictMode() {
10468
+ return shouldThrowErrorOnUnknownProperty;
10469
+ }
10470
+ /**
10471
+ * Validates that the element is known at runtime and produces
10472
+ * an error if it's not the case.
10473
+ * This check is relevant for JIT-compiled components (for AOT-compiled
10474
+ * ones this check happens at build time).
10475
+ *
10476
+ * The element is considered known if either:
10477
+ * - it's a known HTML element
10478
+ * - it's a known custom element
10479
+ * - the element matches any directive
10480
+ * - the element is allowed by one of the schemas
10481
+ *
10482
+ * @param element Element to validate
10483
+ * @param lView An `LView` that represents a current component that is being rendered
10484
+ * @param tagName Name of the tag to check
10485
+ * @param schemas Array of schemas
10486
+ * @param hasDirectives Boolean indicating that the element matches any directive
10487
+ */
10488
+ function validateElementIsKnown(element, lView, tagName, schemas, hasDirectives) {
10489
+ // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
10490
+ // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
10491
+ // defined as an array (as an empty array in case `schemas` field is not defined) and we should
10492
+ // execute the check below.
10493
+ if (schemas === null)
10494
+ return;
10495
+ // If the element matches any directive, it's considered as valid.
10496
+ if (!hasDirectives && tagName !== null) {
10497
+ // The element is unknown if it's an instance of HTMLUnknownElement, or it isn't registered
10498
+ // as a custom element. Note that unknown elements with a dash in their name won't be instances
10499
+ // of HTMLUnknownElement in browsers that support web components.
10500
+ const isUnknown =
10501
+ // Note that we can't check for `typeof HTMLUnknownElement === 'function'`,
10502
+ // because while most browsers return 'function', IE returns 'object'.
10503
+ (typeof HTMLUnknownElement !== 'undefined' && HTMLUnknownElement &&
10504
+ element instanceof HTMLUnknownElement) ||
10505
+ (typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
10506
+ !customElements.get(tagName));
10507
+ if (isUnknown && !matchingSchemas(schemas, tagName)) {
10508
+ const isHostStandalone = isHostComponentStandalone(lView);
10509
+ const templateLocation = getTemplateLocationDetails(lView);
10510
+ const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
10511
+ let message = `'${tagName}' is not a known element${templateLocation}:\n`;
10512
+ message += `1. If '${tagName}' is an Angular component, then verify that it is ${isHostStandalone ? 'included in the \'@Component.imports\' of this component' :
10513
+ 'a part of an @NgModule where this component is declared'}.\n`;
10514
+ if (tagName && tagName.indexOf('-') > -1) {
10515
+ message +=
10516
+ `2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`;
10517
+ }
10518
+ else {
10519
+ message +=
10520
+ `2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`;
10521
+ }
10522
+ if (shouldThrowErrorOnUnknownElement) {
10523
+ throw new RuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message);
10524
+ }
10525
+ else {
10526
+ console.error(formatRuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message));
10527
+ }
10528
+ }
10344
10529
  }
10345
- /** @internal */
10346
- _throwOrNull(key, notFoundValue) {
10347
- if (notFoundValue !== THROW_IF_NOT_FOUND) {
10348
- return notFoundValue;
10349
- }
10350
- else {
10351
- throw noProviderError(this, key);
10352
- }
10530
+ }
10531
+ /**
10532
+ * Validates that the property of the element is known at runtime and returns
10533
+ * false if it's not the case.
10534
+ * This check is relevant for JIT-compiled components (for AOT-compiled
10535
+ * ones this check happens at build time).
10536
+ *
10537
+ * The property is considered known if either:
10538
+ * - it's a known property of the element
10539
+ * - the element is allowed by one of the schemas
10540
+ * - the property is used for animations
10541
+ *
10542
+ * @param element Element to validate
10543
+ * @param propName Name of the property to check
10544
+ * @param tagName Name of the tag hosting the property
10545
+ * @param schemas Array of schemas
10546
+ */
10547
+ function isPropertyValid(element, propName, tagName, schemas) {
10548
+ // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
10549
+ // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
10550
+ // defined as an array (as an empty array in case `schemas` field is not defined) and we should
10551
+ // execute the check below.
10552
+ if (schemas === null)
10553
+ return true;
10554
+ // The property is considered valid if the element matches the schema, it exists on the element,
10555
+ // or it is synthetic, and we are in a browser context (web worker nodes should be skipped).
10556
+ if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) {
10557
+ return true;
10353
10558
  }
10354
- /** @internal */
10355
- _getByKeySelf(key, notFoundValue) {
10356
- const obj = this._getObjByKeyId(key.id);
10357
- return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue);
10559
+ // Note: `typeof Node` returns 'function' in most browsers, but on IE it is 'object' so we
10560
+ // need to account for both here, while being careful with `typeof null` also returning 'object'.
10561
+ return typeof Node === 'undefined' || Node === null || !(element instanceof Node);
10562
+ }
10563
+ /**
10564
+ * Logs or throws an error that a property is not supported on an element.
10565
+ *
10566
+ * @param propName Name of the invalid property
10567
+ * @param tagName Name of the tag hosting the property
10568
+ * @param nodeType Type of the node hosting the property
10569
+ * @param lView An `LView` that represents a current component
10570
+ */
10571
+ function handleUnknownPropertyError(propName, tagName, nodeType, lView) {
10572
+ // Special-case a situation when a structural directive is applied to
10573
+ // an `<ng-template>` element, for example: `<ng-template *ngIf="true">`.
10574
+ // In this case the compiler generates the `ɵɵtemplate` instruction with
10575
+ // the `null` as the tagName. The directive matching logic at runtime relies
10576
+ // on this effect (see `isInlineTemplate`), thus using the 'ng-template' as
10577
+ // a default value of the `tNode.value` is not feasible at this moment.
10578
+ if (!tagName && nodeType === 4 /* TNodeType.Container */) {
10579
+ tagName = 'ng-template';
10358
10580
  }
10359
- /** @internal */
10360
- _getByKeyDefault(key, notFoundValue, visibility) {
10361
- let inj;
10362
- if (visibility instanceof SkipSelf) {
10363
- inj = this.parent;
10364
- }
10365
- else {
10366
- inj = this;
10367
- }
10368
- while (inj instanceof ReflectiveInjector_) {
10369
- const inj_ = inj;
10370
- const obj = inj_._getObjByKeyId(key.id);
10371
- if (obj !== UNDEFINED)
10372
- return obj;
10373
- inj = inj_.parent;
10374
- }
10375
- if (inj !== null) {
10376
- return inj.get(key.token, notFoundValue);
10581
+ const isHostStandalone = isHostComponentStandalone(lView);
10582
+ const templateLocation = getTemplateLocationDetails(lView);
10583
+ let message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'${templateLocation}.`;
10584
+ const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
10585
+ const importLocation = isHostStandalone ?
10586
+ 'included in the \'@Component.imports\' of this component' :
10587
+ 'a part of an @NgModule where this component is declared';
10588
+ if (KNOWN_CONTROL_FLOW_DIRECTIVES.has(propName)) {
10589
+ // Most likely this is a control flow directive (such as `*ngIf`) used in
10590
+ // a template, but the `CommonModule` is not imported.
10591
+ message += `\nIf the '${propName}' is an Angular control flow directive, ` +
10592
+ `please make sure that the 'CommonModule' is ${importLocation}.`;
10593
+ }
10594
+ else {
10595
+ // May be an Angular component, which is not imported/declared?
10596
+ message += `\n1. If '${tagName}' is an Angular component and it has the ` +
10597
+ `'${propName}' input, then verify that it is ${importLocation}.`;
10598
+ // May be a Web Component?
10599
+ if (tagName && tagName.indexOf('-') > -1) {
10600
+ message += `\n2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' ` +
10601
+ `to the ${schemas} of this component to suppress this message.`;
10602
+ message += `\n3. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
10603
+ `the ${schemas} of this component.`;
10377
10604
  }
10378
10605
  else {
10379
- return this._throwOrNull(key, notFoundValue);
10606
+ // If it's expected, the error can be suppressed by the `NO_ERRORS_SCHEMA` schema.
10607
+ message += `\n2. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
10608
+ `the ${schemas} of this component.`;
10380
10609
  }
10381
10610
  }
10382
- get displayName() {
10383
- const providers = _mapProviders(this, (b) => ' "' + b.key.displayName + '" ')
10384
- .join(', ');
10385
- return `ReflectiveInjector(providers: [${providers}])`;
10386
- }
10387
- toString() {
10388
- return this.displayName;
10611
+ if (shouldThrowErrorOnUnknownProperty) {
10612
+ throw new RuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message);
10389
10613
  }
10390
- }
10391
- ReflectiveInjector_.INJECTOR_KEY = ( /* @__PURE__ */ReflectiveKey.get(Injector));
10392
- function _mapProviders(injector, fn) {
10393
- const res = [];
10394
- for (let i = 0; i < injector._providers.length; ++i) {
10395
- res[i] = fn(injector.getProviderAtIndex(i));
10614
+ else {
10615
+ console.error(formatRuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message));
10396
10616
  }
10397
- return res;
10398
10617
  }
10399
-
10400
10618
  /**
10401
- * @license
10402
- * Copyright Google LLC All Rights Reserved.
10619
+ * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
10620
+ * and must **not** be used in production bundles. The function makes megamorphic reads, which might
10621
+ * be too slow for production mode and also it relies on the constructor function being available.
10403
10622
  *
10404
- * Use of this source code is governed by an MIT-style license that can be
10405
- * found in the LICENSE file at https://angular.io/license
10406
- */
10407
-
10408
- /**
10409
- * @license
10410
- * Copyright Google LLC All Rights Reserved.
10623
+ * Gets a reference to the host component def (where a current component is declared).
10411
10624
  *
10412
- * Use of this source code is governed by an MIT-style license that can be
10413
- * found in the LICENSE file at https://angular.io/license
10625
+ * @param lView An `LView` that represents a current component that is being rendered.
10414
10626
  */
10415
-
10627
+ function getDeclarationComponentDef(lView) {
10628
+ !ngDevMode && throwError('Must never be called in production mode');
10629
+ const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
10630
+ const context = declarationLView[CONTEXT];
10631
+ // Unable to obtain a context.
10632
+ if (!context)
10633
+ return null;
10634
+ return context.constructor ? getComponentDef(context.constructor) : null;
10635
+ }
10416
10636
  /**
10417
- * @license
10418
- * Copyright Google LLC All Rights Reserved.
10637
+ * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
10638
+ * and must **not** be used in production bundles. The function makes megamorphic reads, which might
10639
+ * be too slow for production mode.
10419
10640
  *
10420
- * Use of this source code is governed by an MIT-style license that can be
10421
- * found in the LICENSE file at https://angular.io/license
10641
+ * Checks if the current component is declared inside of a standalone component template.
10642
+ *
10643
+ * @param lView An `LView` that represents a current component that is being rendered.
10422
10644
  */
10423
- function ɵɵdirectiveInject(token, flags = InjectFlags.Default) {
10424
- const lView = getLView();
10425
- // Fall back to inject() if view hasn't been created. This situation can happen in tests
10426
- // if inject utilities are used before bootstrapping.
10427
- if (lView === null) {
10428
- // Verify that we will not get into infinite loop.
10429
- ngDevMode && assertInjectImplementationNotEqual(ɵɵdirectiveInject);
10430
- return ɵɵinject(token, flags);
10431
- }
10432
- const tNode = getCurrentTNode();
10433
- return getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags);
10645
+ function isHostComponentStandalone(lView) {
10646
+ !ngDevMode && throwError('Must never be called in production mode');
10647
+ const componentDef = getDeclarationComponentDef(lView);
10648
+ // Treat host component as non-standalone if we can't obtain the def.
10649
+ return !!(componentDef === null || componentDef === void 0 ? void 0 : componentDef.standalone);
10434
10650
  }
10435
10651
  /**
10436
- * Throws an error indicating that a factory function could not be generated by the compiler for a
10437
- * particular class.
10438
- *
10439
- * This instruction allows the actual error message to be optimized away when ngDevMode is turned
10440
- * off, saving bytes of generated code while still providing a good experience in dev mode.
10652
+ * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
10653
+ * and must **not** be used in production bundles. The function makes megamorphic reads, which might
10654
+ * be too slow for production mode.
10441
10655
  *
10442
- * The name of the class is not mentioned here, but will be in the generated factory function name
10443
- * and thus in the stack trace.
10656
+ * Constructs a string describing the location of the host component template. The function is used
10657
+ * in dev mode to produce error messages.
10444
10658
  *
10445
- * @codeGenApi
10659
+ * @param lView An `LView` that represents a current component that is being rendered.
10446
10660
  */
10447
- function ɵɵinvalidFactory() {
10448
- const msg = ngDevMode ? `This constructor was not compatible with Dependency Injection.` : 'invalid';
10449
- throw new Error(msg);
10661
+ function getTemplateLocationDetails(lView) {
10662
+ var _a;
10663
+ !ngDevMode && throwError('Must never be called in production mode');
10664
+ const hostComponentDef = getDeclarationComponentDef(lView);
10665
+ const componentClassName = (_a = hostComponentDef === null || hostComponentDef === void 0 ? void 0 : hostComponentDef.type) === null || _a === void 0 ? void 0 : _a.name;
10666
+ return componentClassName ? ` (used in the '${componentClassName}' component template)` : '';
10667
+ }
10668
+ /**
10669
+ * The set of known control flow directives.
10670
+ * We use this set to produce a more precises error message with a note
10671
+ * that the `CommonModule` should also be included.
10672
+ */
10673
+ const KNOWN_CONTROL_FLOW_DIRECTIVES = new Set(['ngIf', 'ngFor', 'ngSwitch', 'ngSwitchCase', 'ngSwitchDefault']);
10674
+ /**
10675
+ * Returns true if the tag name is allowed by specified schemas.
10676
+ * @param schemas Array of schemas
10677
+ * @param tagName Name of the tag
10678
+ */
10679
+ function matchingSchemas(schemas, tagName) {
10680
+ if (schemas !== null) {
10681
+ for (let i = 0; i < schemas.length; i++) {
10682
+ const schema = schemas[i];
10683
+ if (schema === NO_ERRORS_SCHEMA ||
10684
+ schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf('-') > -1) {
10685
+ return true;
10686
+ }
10687
+ }
10688
+ }
10689
+ return false;
10450
10690
  }
10451
10691
 
10452
10692
  /**
@@ -11246,30 +11486,15 @@ class LContainerDebug {
11246
11486
  }
11247
11487
  get host() {
11248
11488
  return this._raw_lContainer[HOST];
11249
- }
11250
- get native() {
11251
- return this._raw_lContainer[NATIVE];
11252
- }
11253
- get next() {
11254
- return toDebug(this._raw_lContainer[NEXT]);
11255
- }
11256
- }
11257
-
11258
- let shouldThrowErrorOnUnknownProperty = false;
11259
- /**
11260
- * Sets a strict mode for JIT-compiled components to throw an error on unknown properties,
11261
- * instead of just logging the error.
11262
- * (for AOT-compiled ones this check happens at build time).
11263
- */
11264
- function ɵsetUnknownPropertyStrictMode(shouldThrow) {
11265
- shouldThrowErrorOnUnknownProperty = shouldThrow;
11266
- }
11267
- /**
11268
- * Gets the current value of the strict mode.
11269
- */
11270
- function ɵgetUnknownPropertyStrictMode() {
11271
- return shouldThrowErrorOnUnknownProperty;
11489
+ }
11490
+ get native() {
11491
+ return this._raw_lContainer[NATIVE];
11492
+ }
11493
+ get next() {
11494
+ return toDebug(this._raw_lContainer[NEXT]);
11495
+ }
11272
11496
  }
11497
+
11273
11498
  /**
11274
11499
  * A permanent marker promise which signifies that the current CD tree is
11275
11500
  * clean.
@@ -11428,56 +11653,6 @@ function createTNodeAtIndex(tView, index, type, name, attrs) {
11428
11653
  }
11429
11654
  return tNode;
11430
11655
  }
11431
- /**
11432
- * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
11433
- * and must **not** be used in production bundles. The function makes megamorphic reads, which might
11434
- * be too slow for production mode and also it relies on the constructor function being available.
11435
- *
11436
- * Gets a reference to the host component def (where a current component is declared).
11437
- *
11438
- * @param lView An `LView` that represents a current component that is being rendered.
11439
- */
11440
- function getDeclarationComponentDef(lView) {
11441
- !ngDevMode && throwError('Must never be called in production mode');
11442
- const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
11443
- const context = declarationLView[CONTEXT];
11444
- // Unable to obtain a context.
11445
- if (!context)
11446
- return null;
11447
- return context.constructor ? getComponentDef(context.constructor) : null;
11448
- }
11449
- /**
11450
- * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
11451
- * and must **not** be used in production bundles. The function makes megamorphic reads, which might
11452
- * be too slow for production mode.
11453
- *
11454
- * Checks if the current component is declared inside of a standalone component template.
11455
- *
11456
- * @param lView An `LView` that represents a current component that is being rendered.
11457
- */
11458
- function isHostComponentStandalone(lView) {
11459
- !ngDevMode && throwError('Must never be called in production mode');
11460
- const componentDef = getDeclarationComponentDef(lView);
11461
- // Treat host component as non-standalone if we can't obtain the def.
11462
- return !!(componentDef === null || componentDef === void 0 ? void 0 : componentDef.standalone);
11463
- }
11464
- /**
11465
- * WARNING: this is a **dev-mode only** function (thus should always be guarded by the `ngDevMode`)
11466
- * and must **not** be used in production bundles. The function makes megamorphic reads, which might
11467
- * be too slow for production mode.
11468
- *
11469
- * Constructs a string describing the location of the host component template. The function is used
11470
- * in dev mode to produce error messages.
11471
- *
11472
- * @param lView An `LView` that represents a current component that is being rendered.
11473
- */
11474
- function getTemplateLocationDetails(lView) {
11475
- var _a;
11476
- !ngDevMode && throwError('Must never be called in production mode');
11477
- const hostComponentDef = getDeclarationComponentDef(lView);
11478
- const componentClassName = (_a = hostComponentDef === null || hostComponentDef === void 0 ? void 0 : hostComponentDef.type) === null || _a === void 0 ? void 0 : _a.name;
11479
- return componentClassName ? ` (used in the '${componentClassName}' component template)` : '';
11480
- }
11481
11656
  /**
11482
11657
  * When elements are created dynamically after a view blueprint is created (e.g. through
11483
11658
  * i18nApply()), we need to adjust the blueprint for future
@@ -12144,10 +12319,8 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
12144
12319
  propName = mapPropName(propName);
12145
12320
  if (ngDevMode) {
12146
12321
  validateAgainstEventProperties(propName);
12147
- if (!validateProperty(element, tNode.value, propName, tView.schemas)) {
12148
- // Return here since we only log warnings for unknown properties.
12149
- handleUnknownPropertyError(propName, tNode, lView);
12150
- return;
12322
+ if (!isPropertyValid(element, propName, tNode.value, tView.schemas)) {
12323
+ handleUnknownPropertyError(propName, tNode.value, tNode.type, lView);
12151
12324
  }
12152
12325
  ngDevMode.rendererSetProperty++;
12153
12326
  }
@@ -12166,7 +12339,7 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
12166
12339
  // If the node is a container and the property didn't
12167
12340
  // match any of the inputs or schemas we should throw.
12168
12341
  if (ngDevMode && !matchingSchemas(tView.schemas, tNode.value)) {
12169
- handleUnknownPropertyError(propName, tNode, lView);
12342
+ handleUnknownPropertyError(propName, tNode.value, tNode.type, lView);
12170
12343
  }
12171
12344
  }
12172
12345
  }
@@ -12218,116 +12391,6 @@ function setNgReflectProperties(lView, element, type, dataValue, value) {
12218
12391
  }
12219
12392
  }
12220
12393
  }
12221
- /**
12222
- * Validates that the property of the element is known at runtime and returns
12223
- * false if it's not the case.
12224
- * This check is relevant for JIT-compiled components (for AOT-compiled
12225
- * ones this check happens at build time).
12226
- *
12227
- * The property is considered known if either:
12228
- * - it's a known property of the element
12229
- * - the element is allowed by one of the schemas
12230
- * - the property is used for animations
12231
- *
12232
- * @param element Element to validate
12233
- * @param tagName Name of the tag to check
12234
- * @param propName Name of the property to check
12235
- * @param schemas Array of schemas
12236
- */
12237
- function validateProperty(element, tagName, propName, schemas) {
12238
- // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
12239
- // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
12240
- // defined as an array (as an empty array in case `schemas` field is not defined) and we should
12241
- // execute the check below.
12242
- if (schemas === null)
12243
- return true;
12244
- // The property is considered valid if the element matches the schema, it exists on the element,
12245
- // or it is synthetic, and we are in a browser context (web worker nodes should be skipped).
12246
- if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) {
12247
- return true;
12248
- }
12249
- // Note: `typeof Node` returns 'function' in most browsers, but on IE it is 'object' so we
12250
- // need to account for both here, while being careful with `typeof null` also returning 'object'.
12251
- return typeof Node === 'undefined' || Node === null || !(element instanceof Node);
12252
- }
12253
- /**
12254
- * Returns true if the tag name is allowed by specified schemas.
12255
- * @param schemas Array of schemas
12256
- * @param tagName Name of the tag
12257
- */
12258
- function matchingSchemas(schemas, tagName) {
12259
- if (schemas !== null) {
12260
- for (let i = 0; i < schemas.length; i++) {
12261
- const schema = schemas[i];
12262
- if (schema === NO_ERRORS_SCHEMA ||
12263
- schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf('-') > -1) {
12264
- return true;
12265
- }
12266
- }
12267
- }
12268
- return false;
12269
- }
12270
- /**
12271
- * The set of known control flow directives.
12272
- * We use this set to produce a more precises error message with a note
12273
- * that the `CommonModule` should also be included.
12274
- */
12275
- const KNOWN_CONTROL_FLOW_DIRECTIVES = new Set(['ngIf', 'ngFor', 'ngSwitch', 'ngSwitchCase', 'ngSwitchDefault']);
12276
- /**
12277
- * Logs or throws an error that a property is not supported on an element.
12278
- *
12279
- * @param propName Name of the invalid property.
12280
- * @param tNode A `TNode` that represents a current component that is being rendered.
12281
- * @param lView An `LView` that represents a current component that is being rendered.
12282
- */
12283
- function handleUnknownPropertyError(propName, tNode, lView) {
12284
- let tagName = tNode.value;
12285
- // Special-case a situation when a structural directive is applied to
12286
- // an `<ng-template>` element, for example: `<ng-template *ngIf="true">`.
12287
- // In this case the compiler generates the `ɵɵtemplate` instruction with
12288
- // the `null` as the tagName. The directive matching logic at runtime relies
12289
- // on this effect (see `isInlineTemplate`), thus using the 'ng-template' as
12290
- // a default value of the `tNode.value` is not feasible at this moment.
12291
- if (!tagName && tNode.type === 4 /* TNodeType.Container */) {
12292
- tagName = 'ng-template';
12293
- }
12294
- const isHostStandalone = isHostComponentStandalone(lView);
12295
- const templateLocation = getTemplateLocationDetails(lView);
12296
- let message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'${templateLocation}.`;
12297
- const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
12298
- const importLocation = isHostStandalone ?
12299
- 'included in the \'@Component.imports\' of this component' :
12300
- 'a part of an @NgModule where this component is declared';
12301
- if (KNOWN_CONTROL_FLOW_DIRECTIVES.has(propName)) {
12302
- // Most likely this is a control flow directive (such as `*ngIf`) used in
12303
- // a template, but the `CommonModule` is not imported.
12304
- message += `\nIf the '${propName}' is an Angular control flow directive, ` +
12305
- `please make sure that the 'CommonModule' is ${importLocation}.`;
12306
- }
12307
- else {
12308
- // May be an Angular component, which is not imported/declared?
12309
- message += `\n1. If '${tagName}' is an Angular component and it has the ` +
12310
- `'${propName}' input, then verify that it is ${importLocation}.`;
12311
- // May be a Web Component?
12312
- if (tagName && tagName.indexOf('-') > -1) {
12313
- message += `\n2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' ` +
12314
- `to the ${schemas} of this component to suppress this message.`;
12315
- message += `\n3. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
12316
- `the ${schemas} of this component.`;
12317
- }
12318
- else {
12319
- // If it's expected, the error can be suppressed by the `NO_ERRORS_SCHEMA` schema.
12320
- message += `\n2. To allow any property add 'NO_ERRORS_SCHEMA' to ` +
12321
- `the ${schemas} of this component.`;
12322
- }
12323
- }
12324
- if (shouldThrowErrorOnUnknownProperty) {
12325
- throw new RuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message);
12326
- }
12327
- else {
12328
- console.error(formatRuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message));
12329
- }
12330
- }
12331
12394
  /**
12332
12395
  * Instantiate a root component.
12333
12396
  */
@@ -13901,7 +13964,11 @@ function createRootComponent(componentView, componentDef, rootLView, rootContext
13901
13964
  const component = instantiateRootComponent(tView, rootLView, componentDef);
13902
13965
  rootContext.components.push(component);
13903
13966
  componentView[CONTEXT] = component;
13904
- hostFeatures && hostFeatures.forEach((feature) => feature(component, componentDef));
13967
+ if (hostFeatures !== null) {
13968
+ for (const feature of hostFeatures) {
13969
+ feature(component, componentDef);
13970
+ }
13971
+ }
13905
13972
  // We want to generate an empty QueryList for root content queries for backwards
13906
13973
  // compatibility with ViewEngine.
13907
13974
  if (componentDef.contentQueries) {
@@ -13942,13 +14009,10 @@ function createRootContext(scheduler, playerHandler) {
13942
14009
  * renderComponent(AppComponent, {hostFeatures: [LifecycleHooksFeature]});
13943
14010
  * ```
13944
14011
  */
13945
- function LifecycleHooksFeature(component, def) {
13946
- const lView = readPatchedLView(component);
13947
- ngDevMode && assertDefined(lView, 'LView is required');
13948
- const tView = lView[TVIEW];
14012
+ function LifecycleHooksFeature() {
13949
14013
  const tNode = getCurrentTNode();
13950
14014
  ngDevMode && assertDefined(tNode, 'TNode is required');
13951
- registerPostOrderHooks(tView, tNode);
14015
+ registerPostOrderHooks(getLView()[TVIEW], tNode);
13952
14016
  }
13953
14017
  /**
13954
14018
  * Wait on component until it is rendered.
@@ -13998,10 +14062,8 @@ function ɵɵInheritDefinitionFeature(definition) {
13998
14062
  }
13999
14063
  else {
14000
14064
  if (superType.ɵcmp) {
14001
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
14002
- `Directives cannot inherit Components. Directive ${stringifyForError(definition.type)} is attempting to extend component ${stringifyForError(superType)}` :
14003
- '';
14004
- throw new RuntimeError(903 /* RuntimeErrorCode.INVALID_INHERITANCE */, errorMessage);
14065
+ throw new RuntimeError(903 /* RuntimeErrorCode.INVALID_INHERITANCE */, ngDevMode &&
14066
+ `Directives cannot inherit Components. Directive ${stringifyForError(definition.type)} is attempting to extend component ${stringifyForError(superType)}`);
14005
14067
  }
14006
14068
  // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
14007
14069
  superDef = superType.ɵdir;
@@ -15083,21 +15145,6 @@ function setDirectiveInputsWhichShadowsStyling(tView, tNode, lView, value, isCla
15083
15145
  * Use of this source code is governed by an MIT-style license that can be
15084
15146
  * found in the LICENSE file at https://angular.io/license
15085
15147
  */
15086
- let shouldThrowErrorOnUnknownElement = false;
15087
- /**
15088
- * Sets a strict mode for JIT-compiled components to throw an error on unknown elements,
15089
- * instead of just logging the error.
15090
- * (for AOT-compiled ones this check happens at build time).
15091
- */
15092
- function ɵsetUnknownElementStrictMode(shouldThrow) {
15093
- shouldThrowErrorOnUnknownElement = shouldThrow;
15094
- }
15095
- /**
15096
- * Gets the current value of the strict mode.
15097
- */
15098
- function ɵgetUnknownElementStrictMode() {
15099
- return shouldThrowErrorOnUnknownElement;
15100
- }
15101
15148
  function elementStartFirstCreatePass(index, tView, lView, native, name, attrsIndex, localRefsIndex) {
15102
15149
  ngDevMode && assertFirstCreatePass(tView);
15103
15150
  ngDevMode && ngDevMode.firstCreatePass++;
@@ -15231,67 +15278,6 @@ function ɵɵelement(index, name, attrsIndex, localRefsIndex) {
15231
15278
  ɵɵelementEnd();
15232
15279
  return ɵɵelement;
15233
15280
  }
15234
- /**
15235
- * Validates that the element is known at runtime and produces
15236
- * an error if it's not the case.
15237
- * This check is relevant for JIT-compiled components (for AOT-compiled
15238
- * ones this check happens at build time).
15239
- *
15240
- * The element is considered known if either:
15241
- * - it's a known HTML element
15242
- * - it's a known custom element
15243
- * - the element matches any directive
15244
- * - the element is allowed by one of the schemas
15245
- *
15246
- * @param element Element to validate
15247
- * @param lView An `LView` that represents a current component that is being rendered.
15248
- * @param tagName Name of the tag to check
15249
- * @param schemas Array of schemas
15250
- * @param hasDirectives Boolean indicating that the element matches any directive
15251
- */
15252
- function validateElementIsKnown(element, lView, tagName, schemas, hasDirectives) {
15253
- // If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
15254
- // mode where this check happens at compile time. In JIT mode, `schemas` is always present and
15255
- // defined as an array (as an empty array in case `schemas` field is not defined) and we should
15256
- // execute the check below.
15257
- if (schemas === null)
15258
- return;
15259
- // If the element matches any directive, it's considered as valid.
15260
- if (!hasDirectives && tagName !== null) {
15261
- // The element is unknown if it's an instance of HTMLUnknownElement, or it isn't registered
15262
- // as a custom element. Note that unknown elements with a dash in their name won't be instances
15263
- // of HTMLUnknownElement in browsers that support web components.
15264
- const isUnknown =
15265
- // Note that we can't check for `typeof HTMLUnknownElement === 'function'`,
15266
- // because while most browsers return 'function', IE returns 'object'.
15267
- (typeof HTMLUnknownElement !== 'undefined' && HTMLUnknownElement &&
15268
- element instanceof HTMLUnknownElement) ||
15269
- (typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
15270
- !customElements.get(tagName));
15271
- if (isUnknown && !matchingSchemas(schemas, tagName)) {
15272
- const isHostStandalone = isHostComponentStandalone(lView);
15273
- const templateLocation = getTemplateLocationDetails(lView);
15274
- const schemas = `'${isHostStandalone ? '@Component' : '@NgModule'}.schemas'`;
15275
- let message = `'${tagName}' is not a known element${templateLocation}:\n`;
15276
- message += `1. If '${tagName}' is an Angular component, then verify that it is ${isHostStandalone ? 'included in the \'@Component.imports\' of this component' :
15277
- 'a part of an @NgModule where this component is declared'}.\n`;
15278
- if (tagName && tagName.indexOf('-') > -1) {
15279
- message +=
15280
- `2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`;
15281
- }
15282
- else {
15283
- message +=
15284
- `2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`;
15285
- }
15286
- if (shouldThrowErrorOnUnknownElement) {
15287
- throw new RuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message);
15288
- }
15289
- else {
15290
- console.error(formatRuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message));
15291
- }
15292
- }
15293
- }
15294
- }
15295
15281
 
15296
15282
  /**
15297
15283
  * @license
@@ -21774,7 +21760,7 @@ class Version {
21774
21760
  /**
21775
21761
  * @publicApi
21776
21762
  */
21777
- const VERSION = new Version('14.0.0');
21763
+ const VERSION = new Version('14.0.3');
21778
21764
 
21779
21765
  /**
21780
21766
  * @license
@@ -22112,8 +22098,7 @@ class ViewRef$1 {
22112
22098
  }
22113
22099
  attachToViewContainerRef() {
22114
22100
  if (this._appRef) {
22115
- const errorMessage = ngDevMode ? 'This view is already attached directly to the ApplicationRef!' : '';
22116
- throw new RuntimeError(902 /* RuntimeErrorCode.VIEW_ALREADY_ATTACHED */, errorMessage);
22101
+ throw new RuntimeError(902 /* RuntimeErrorCode.VIEW_ALREADY_ATTACHED */, ngDevMode && 'This view is already attached directly to the ApplicationRef!');
22117
22102
  }
22118
22103
  this._attachedToViewContainer = true;
22119
22104
  }
@@ -22123,8 +22108,7 @@ class ViewRef$1 {
22123
22108
  }
22124
22109
  attachToAppRef(appRef) {
22125
22110
  if (this._attachedToViewContainer) {
22126
- const errorMessage = ngDevMode ? 'This view is already attached to a ViewContainer!' : '';
22127
- throw new RuntimeError(902 /* RuntimeErrorCode.VIEW_ALREADY_ATTACHED */, errorMessage);
22111
+ throw new RuntimeError(902 /* RuntimeErrorCode.VIEW_ALREADY_ATTACHED */, ngDevMode && 'This view is already attached to a ViewContainer!');
22128
22112
  }
22129
22113
  this._appRef = appRef;
22130
22114
  }
@@ -22474,14 +22458,14 @@ class StandaloneService {
22474
22458
  if (!componentDef.standalone) {
22475
22459
  return null;
22476
22460
  }
22477
- if (!this.cachedInjectors.has(componentDef)) {
22461
+ if (!this.cachedInjectors.has(componentDef.id)) {
22478
22462
  const providers = internalImportProvidersFrom(false, componentDef.type);
22479
22463
  const standaloneInjector = providers.length > 0 ?
22480
22464
  createEnvironmentInjector([providers], this._injector, `Standalone[${componentDef.type.name}]`) :
22481
22465
  null;
22482
- this.cachedInjectors.set(componentDef, standaloneInjector);
22466
+ this.cachedInjectors.set(componentDef.id, standaloneInjector);
22483
22467
  }
22484
- return this.cachedInjectors.get(componentDef);
22468
+ return this.cachedInjectors.get(componentDef.id);
22485
22469
  }
22486
22470
  ngOnDestroy() {
22487
22471
  try {
@@ -22981,13 +22965,26 @@ function getPipeDef(name, registry) {
22981
22965
  }
22982
22966
  }
22983
22967
  if (ngDevMode) {
22984
- const lView = getLView();
22985
- const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
22986
- const context = declarationLView[CONTEXT];
22987
- const component = context ? ` in the '${context.constructor.name}' component` : '';
22988
- throw new RuntimeError(-302 /* RuntimeErrorCode.PIPE_NOT_FOUND */, `The pipe '${name}' could not be found${component}!`);
22968
+ throw new RuntimeError(-302 /* RuntimeErrorCode.PIPE_NOT_FOUND */, getPipeNotFoundErrorMessage(name));
22989
22969
  }
22990
22970
  }
22971
+ /**
22972
+ * Generates a helpful error message for the user when a pipe is not found.
22973
+ *
22974
+ * @param name Name of the missing pipe
22975
+ * @returns The error message
22976
+ */
22977
+ function getPipeNotFoundErrorMessage(name) {
22978
+ const lView = getLView();
22979
+ const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
22980
+ const context = declarationLView[CONTEXT];
22981
+ const hostIsStandalone = isHostComponentStandalone(lView);
22982
+ const componentInfoMessage = context ? ` in the '${context.constructor.name}' component` : '';
22983
+ const verifyMessage = `Verify that it is ${hostIsStandalone ? 'included in the \'@Component.imports\' of this component' :
22984
+ 'declared or imported in this module'}`;
22985
+ const errorMessage = `The pipe '${name}' could not be found${componentInfoMessage}. ${verifyMessage}`;
22986
+ return errorMessage;
22987
+ }
22991
22988
  /**
22992
22989
  * Invokes a pipe with 1 arguments.
22993
22990
  *
@@ -24802,6 +24799,7 @@ function setScopeOnDeclaredComponents(moduleType, ngModule) {
24802
24799
  const declarations = flatten(ngModule.declarations || EMPTY_ARRAY);
24803
24800
  const transitiveScopes = transitiveScopesFor(moduleType);
24804
24801
  declarations.forEach(declaration => {
24802
+ declaration = resolveForwardRef(declaration);
24805
24803
  if (declaration.hasOwnProperty(NG_COMP_DEF)) {
24806
24804
  // A `ɵcmp` field exists - go ahead and patch the component directly.
24807
24805
  const component = declaration;
@@ -24832,7 +24830,7 @@ function patchComponentDefWithScope(componentDef, transitiveScopes) {
24832
24830
  }
24833
24831
  /**
24834
24832
  * Compute the pair of transitive scopes (compilation scope and exported scope) for a given type
24835
- * (eaither a NgModule or a standalone component / directive / pipe).
24833
+ * (either a NgModule or a standalone component / directive / pipe).
24836
24834
  */
24837
24835
  function transitiveScopesFor(type) {
24838
24836
  if (isNgModule(type)) {
@@ -25141,14 +25139,20 @@ function getStandaloneDefFunctions(type, imports) {
25141
25139
  // Standalone components are always able to self-reference, so include the component's own
25142
25140
  // definition in its `directiveDefs`.
25143
25141
  cachedDirectiveDefs = [getComponentDef(type)];
25142
+ const seen = new Set();
25144
25143
  for (const rawDep of imports) {
25145
25144
  ngDevMode && verifyStandaloneImport(rawDep, type);
25146
25145
  const dep = resolveForwardRef(rawDep);
25146
+ if (seen.has(dep)) {
25147
+ continue;
25148
+ }
25149
+ seen.add(dep);
25147
25150
  if (!!getNgModuleDef(dep)) {
25148
25151
  const scope = transitiveScopesFor(dep);
25149
25152
  for (const dir of scope.exported.directives) {
25150
25153
  const def = getComponentDef(dir) || getDirectiveDef(dir);
25151
- if (def) {
25154
+ if (def && !seen.has(dir)) {
25155
+ seen.add(dir);
25152
25156
  cachedDirectiveDefs.push(def);
25153
25157
  }
25154
25158
  }
@@ -25166,11 +25170,22 @@ function getStandaloneDefFunctions(type, imports) {
25166
25170
  const pipeDefs = () => {
25167
25171
  if (cachedPipeDefs === null) {
25168
25172
  cachedPipeDefs = [];
25173
+ const seen = new Set();
25169
25174
  for (const rawDep of imports) {
25170
25175
  const dep = resolveForwardRef(rawDep);
25176
+ if (seen.has(dep)) {
25177
+ continue;
25178
+ }
25179
+ seen.add(dep);
25171
25180
  if (!!getNgModuleDef(dep)) {
25172
25181
  const scope = transitiveScopesFor(dep);
25173
- cachedPipeDefs.push(...Array.from(scope.exported.pipes).map(pipe => getPipeDef$1(pipe)));
25182
+ for (const pipe of scope.exported.pipes) {
25183
+ const def = getPipeDef$1(pipe);
25184
+ if (def && !seen.has(pipe)) {
25185
+ seen.add(pipe);
25186
+ cachedPipeDefs.push(def);
25187
+ }
25188
+ }
25174
25189
  }
25175
25190
  else {
25176
25191
  const def = getPipeDef$1(dep);
@@ -26950,10 +26965,8 @@ class NgProbeToken {
26950
26965
  */
26951
26966
  function createPlatform(injector) {
26952
26967
  if (_platformInjector && !_platformInjector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
26953
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
26954
- 'There can be only one platform. Destroy the previous one to create a new one.' :
26955
- '';
26956
- throw new RuntimeError(400 /* RuntimeErrorCode.MULTIPLE_PLATFORMS */, errorMessage);
26968
+ throw new RuntimeError(400 /* RuntimeErrorCode.MULTIPLE_PLATFORMS */, ngDevMode &&
26969
+ 'There can be only one platform. Destroy the previous one to create a new one.');
26957
26970
  }
26958
26971
  publishDefaultGlobalUtils();
26959
26972
  _platformInjector = injector;
@@ -27073,8 +27086,7 @@ function createPlatformFactory(parentPlatformFactory, name, providers = []) {
27073
27086
  function assertPlatform(requiredToken) {
27074
27087
  const platform = getPlatform();
27075
27088
  if (!platform) {
27076
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ? 'No platform exists!' : '';
27077
- throw new RuntimeError(401 /* RuntimeErrorCode.PLATFORM_NOT_FOUND */, errorMessage);
27089
+ throw new RuntimeError(401 /* RuntimeErrorCode.PLATFORM_NOT_FOUND */, ngDevMode && 'No platform exists!');
27078
27090
  }
27079
27091
  if ((typeof ngDevMode === 'undefined' || ngDevMode) &&
27080
27092
  !platform.injector.get(requiredToken, null)) {
@@ -27154,10 +27166,7 @@ class PlatformRef {
27154
27166
  const moduleRef = moduleFactory.create(ngZoneInjector);
27155
27167
  const exceptionHandler = moduleRef.injector.get(ErrorHandler, null);
27156
27168
  if (!exceptionHandler) {
27157
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27158
- 'No ErrorHandler. Is platform module (BrowserModule) included?' :
27159
- '';
27160
- throw new RuntimeError(402 /* RuntimeErrorCode.ERROR_HANDLER_NOT_FOUND */, errorMessage);
27169
+ throw new RuntimeError(402 /* RuntimeErrorCode.ERROR_HANDLER_NOT_FOUND */, ngDevMode && 'No ErrorHandler. Is platform module (BrowserModule) included?');
27161
27170
  }
27162
27171
  ngZone.runOutsideAngular(() => {
27163
27172
  const subscription = ngZone.onError.subscribe({
@@ -27213,12 +27222,10 @@ class PlatformRef {
27213
27222
  moduleRef.instance.ngDoBootstrap(appRef);
27214
27223
  }
27215
27224
  else {
27216
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27225
+ throw new RuntimeError(403 /* RuntimeErrorCode.BOOTSTRAP_COMPONENTS_NOT_FOUND */, ngDevMode &&
27217
27226
  `The module ${stringify(moduleRef.instance.constructor)} was bootstrapped, ` +
27218
27227
  `but it does not declare "@NgModule.bootstrap" components nor a "ngDoBootstrap" method. ` +
27219
- `Please define one of these.` :
27220
- '';
27221
- throw new RuntimeError(403 /* RuntimeErrorCode.BOOTSTRAP_COMPONENTS_NOT_FOUND */, errorMessage);
27228
+ `Please define one of these.`);
27222
27229
  }
27223
27230
  this._modules.push(moduleRef);
27224
27231
  }
@@ -27241,10 +27248,7 @@ class PlatformRef {
27241
27248
  */
27242
27249
  destroy() {
27243
27250
  if (this._destroyed) {
27244
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27245
- 'The platform has already been destroyed!' :
27246
- '';
27247
- throw new RuntimeError(404 /* RuntimeErrorCode.PLATFORM_ALREADY_DESTROYED */, errorMessage);
27251
+ throw new RuntimeError(404 /* RuntimeErrorCode.PLATFORM_ALREADY_DESTROYED */, ngDevMode && 'The platform has already been destroyed!');
27248
27252
  }
27249
27253
  this._modules.slice().forEach(module => module.destroy());
27250
27254
  this._destroyListeners.forEach(listener => listener());
@@ -27578,10 +27582,7 @@ class ApplicationRef {
27578
27582
  tick() {
27579
27583
  NG_DEV_MODE && this.warnIfDestroyed();
27580
27584
  if (this._runningTick) {
27581
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
27582
- 'ApplicationRef.tick is called recursively' :
27583
- '';
27584
- throw new RuntimeError(101 /* RuntimeErrorCode.RECURSIVE_APPLICATION_REF_TICK */, errorMessage);
27585
+ throw new RuntimeError(101 /* RuntimeErrorCode.RECURSIVE_APPLICATION_REF_TICK */, ngDevMode && 'ApplicationRef.tick is called recursively');
27585
27586
  }
27586
27587
  try {
27587
27588
  this._runningTick = true;
@@ -27670,7 +27671,7 @@ class ApplicationRef {
27670
27671
  */
27671
27672
  destroy() {
27672
27673
  if (this._destroyed) {
27673
- throw new RuntimeError(406 /* RuntimeErrorCode.APPLICATION_REF_ALREADY_DESTROYED */, NG_DEV_MODE && 'This instance of the `ApplicationRef` has already been destroyed.');
27674
+ throw new RuntimeError(406 /* RuntimeErrorCode.APPLICATION_REF_ALREADY_DESTROYED */, ngDevMode && 'This instance of the `ApplicationRef` has already been destroyed.');
27674
27675
  }
27675
27676
  const injector = this._injector;
27676
27677
  // Check that this injector instance supports destroy operation.
@@ -28709,10 +28710,8 @@ class DefaultIterableDiffer {
28709
28710
  if (collection == null)
28710
28711
  collection = [];
28711
28712
  if (!isListLikeIterable(collection)) {
28712
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
28713
- `Error trying to diff '${stringify(collection)}'. Only arrays and iterables are allowed` :
28714
- '';
28715
- throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, errorMessage);
28713
+ throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, ngDevMode &&
28714
+ `Error trying to diff '${stringify(collection)}'. Only arrays and iterables are allowed`);
28716
28715
  }
28717
28716
  if (this.check(collection)) {
28718
28717
  return this;
@@ -29313,10 +29312,8 @@ class DefaultKeyValueDiffer {
29313
29312
  map = new Map();
29314
29313
  }
29315
29314
  else if (!(map instanceof Map || isJsObject(map))) {
29316
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
29317
- `Error trying to diff '${stringify(map)}'. Only maps and objects are allowed` :
29318
- '';
29319
- throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, errorMessage);
29315
+ throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, ngDevMode &&
29316
+ `Error trying to diff '${stringify(map)}'. Only maps and objects are allowed`);
29320
29317
  }
29321
29318
  return this.check(map) ? this : null;
29322
29319
  }
@@ -29563,10 +29560,8 @@ class IterableDiffers {
29563
29560
  return factory;
29564
29561
  }
29565
29562
  else {
29566
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
29567
- `Cannot find a differ supporting object '${iterable}' of type '${getTypeNameForDebugging(iterable)}'` :
29568
- '';
29569
- throw new RuntimeError(901 /* RuntimeErrorCode.NO_SUPPORTING_DIFFER_FACTORY */, errorMessage);
29563
+ throw new RuntimeError(901 /* RuntimeErrorCode.NO_SUPPORTING_DIFFER_FACTORY */, ngDevMode &&
29564
+ `Cannot find a differ supporting object '${iterable}' of type '${getTypeNameForDebugging(iterable)}'`);
29570
29565
  }
29571
29566
  }
29572
29567
  }
@@ -29640,10 +29635,7 @@ class KeyValueDiffers {
29640
29635
  if (factory) {
29641
29636
  return factory;
29642
29637
  }
29643
- const errorMessage = (typeof ngDevMode === 'undefined' || ngDevMode) ?
29644
- `Cannot find a differ supporting object '${kv}'` :
29645
- '';
29646
- throw new RuntimeError(901 /* RuntimeErrorCode.NO_SUPPORTING_DIFFER_FACTORY */, errorMessage);
29638
+ throw new RuntimeError(901 /* RuntimeErrorCode.NO_SUPPORTING_DIFFER_FACTORY */, ngDevMode && `Cannot find a differ supporting object '${kv}'`);
29647
29639
  }
29648
29640
  }
29649
29641
  /** @nocollapse */