@angular/core 19.2.0-next.0 → 19.2.0-next.2

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 (37) hide show
  1. package/fesm2022/core.mjs +953 -1124
  2. package/fesm2022/core.mjs.map +1 -1
  3. package/fesm2022/primitives/event-dispatch.mjs +2 -1
  4. package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
  5. package/fesm2022/primitives/signals.mjs +1 -1
  6. package/fesm2022/rxjs-interop.mjs +2 -7
  7. package/fesm2022/rxjs-interop.mjs.map +1 -1
  8. package/fesm2022/testing.mjs +4 -4
  9. package/index.d.ts +42 -23
  10. package/package.json +1 -1
  11. package/primitives/event-dispatch/index.d.ts +1 -1
  12. package/primitives/signals/index.d.ts +1 -1
  13. package/rxjs-interop/index.d.ts +12 -2
  14. package/schematics/bundles/{apply_import_manager-deecd687.js → apply_import_manager-d8ea426b.js} +3 -3
  15. package/schematics/bundles/{checker-78667e44.js → checker-9af84be9.js} +6 -5
  16. package/schematics/bundles/cleanup-unused-imports.js +6 -6
  17. package/schematics/bundles/{compiler_host-38c8eab2.js → compiler_host-dbff2781.js} +2 -2
  18. package/schematics/bundles/control-flow-migration.js +3 -3
  19. package/schematics/bundles/explicit-standalone-flag.js +5 -5
  20. package/schematics/bundles/{imports-abe29092.js → imports-31a38653.js} +1 -1
  21. package/schematics/bundles/{index-6713e562.js → index-23b503a4.js} +4 -4
  22. package/schematics/bundles/{index-de135c2f.js → index-93e324de.js} +4 -4
  23. package/schematics/bundles/inject-migration.js +6 -6
  24. package/schematics/bundles/{leading_space-d190b83b.js → leading_space-6e7a8ec6.js} +1 -1
  25. package/schematics/bundles/{migrate_ts_type_references-e6411f51.js → migrate_ts_type_references-c6615b87.js} +6 -6
  26. package/schematics/bundles/{nodes-a9f0b985.js → nodes-88c2157f.js} +2 -2
  27. package/schematics/bundles/output-migration.js +6 -6
  28. package/schematics/bundles/pending-tasks.js +5 -5
  29. package/schematics/bundles/{program-b0d98952.js → program-66386e72.js} +101 -27
  30. package/schematics/bundles/{project_tsconfig_paths-e9ccccbf.js → project_tsconfig_paths-6c9cde78.js} +1 -1
  31. package/schematics/bundles/provide-initializer.js +5 -5
  32. package/schematics/bundles/route-lazy-loading.js +4 -4
  33. package/schematics/bundles/signal-input-migration.js +8 -8
  34. package/schematics/bundles/signal-queries-migration.js +8 -8
  35. package/schematics/bundles/signals.js +8 -8
  36. package/schematics/bundles/standalone-migration.js +8 -8
  37. package/testing/index.d.ts +1 -1
package/fesm2022/core.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  /**
2
- * @license Angular v19.2.0-next.0
2
+ * @license Angular v19.2.0-next.2
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
- import { SIGNAL_NODE as SIGNAL_NODE$1, signalSetFn as signalSetFn$1, producerAccessed as producerAccessed$1, SIGNAL as SIGNAL$1, getActiveConsumer as getActiveConsumer$1, setActiveConsumer as setActiveConsumer$1, createSignal as createSignal$1, signalUpdateFn as signalUpdateFn$1, consumerDestroy as consumerDestroy$1, REACTIVE_NODE as REACTIVE_NODE$1, consumerBeforeComputation as consumerBeforeComputation$1, consumerAfterComputation as consumerAfterComputation$1, consumerPollProducersForChange as consumerPollProducersForChange$1, createComputed as createComputed$1, setThrowInvalidWriteToSignalError as setThrowInvalidWriteToSignalError$1, producerUpdateValueVersion as producerUpdateValueVersion$1, producerMarkClean as producerMarkClean$1, defaultEquals as defaultEquals$1, createWatch as createWatch$1, isInNotificationPhase as isInNotificationPhase$1 } from '@angular/core/primitives/signals';
7
+ import { SIGNAL_NODE as SIGNAL_NODE$1, signalSetFn as signalSetFn$1, producerAccessed as producerAccessed$1, SIGNAL as SIGNAL$1, getActiveConsumer as getActiveConsumer$1, setActiveConsumer as setActiveConsumer$1, createSignal as createSignal$1, signalUpdateFn as signalUpdateFn$1, consumerDestroy as consumerDestroy$1, REACTIVE_NODE as REACTIVE_NODE$1, consumerBeforeComputation as consumerBeforeComputation$1, consumerAfterComputation as consumerAfterComputation$1, consumerPollProducersForChange as consumerPollProducersForChange$1, createComputed as createComputed$1, setThrowInvalidWriteToSignalError as setThrowInvalidWriteToSignalError$1, createLinkedSignal as createLinkedSignal$1, linkedSignalSetFn as linkedSignalSetFn$1, linkedSignalUpdateFn as linkedSignalUpdateFn$1, createWatch as createWatch$1, isInNotificationPhase as isInNotificationPhase$1 } from '@angular/core/primitives/signals';
8
8
  export { SIGNAL as ɵSIGNAL } from '@angular/core/primitives/signals';
9
9
  import { BehaviorSubject, Subject, Subscription } from 'rxjs';
10
10
  import { Attribute as Attribute$1, clearAppScopedEarlyEventContract, EventContract, EventContractContainer, getAppScopedQueuedEventInfos, EventDispatcher, registerDispatcher, isEarlyEventType, isCaptureEventType, EventPhase } from '@angular/core/primitives/event-dispatch';
@@ -2963,6 +2963,7 @@ function isComponentDef(def) {
2963
2963
  return !!def.template;
2964
2964
  }
2965
2965
  function isRootView(target) {
2966
+ // Determines whether a given LView is marked as a root view.
2966
2967
  return (target[FLAGS] & 512 /* LViewFlags.IsRoot */) !== 0;
2967
2968
  }
2968
2969
  function isProjectionTNode(tNode) {
@@ -3066,7 +3067,7 @@ function assertProjectionSlots(lView, errMessage) {
3066
3067
  function assertParentView(lView, errMessage) {
3067
3068
  assertDefined(lView, errMessage || "Component views should always have a parent view (component's host view)");
3068
3069
  }
3069
- function assertNoDuplicateDirectives(directives) {
3070
+ function assertNoDuplicateDirectives$1(directives) {
3070
3071
  // The array needs at least two elements in order to have duplicates.
3071
3072
  if (directives.length < 2) {
3072
3073
  return;
@@ -4059,7 +4060,7 @@ function ɵɵnamespaceHTML() {
4059
4060
  function namespaceHTMLInternal() {
4060
4061
  instructionState.lFrame.currentNamespace = null;
4061
4062
  }
4062
- function getNamespace$1() {
4063
+ function getNamespace() {
4063
4064
  return instructionState.lFrame.currentNamespace;
4064
4065
  }
4065
4066
  let _wasLastNodeCreated = true;
@@ -5617,7 +5618,7 @@ function lookupTokenUsingEmbeddedInjector(tNode, lView, token, flags, notFoundVa
5617
5618
  while (currentTNode !== null &&
5618
5619
  currentLView !== null &&
5619
5620
  currentLView[FLAGS] & 2048 /* LViewFlags.HasEmbeddedViewInjector */ &&
5620
- !(currentLView[FLAGS] & 512 /* LViewFlags.IsRoot */)) {
5621
+ !isRootView(currentLView)) {
5621
5622
  ngDevMode && assertTNodeForLView(currentTNode, currentLView);
5622
5623
  // Note that this lookup on the node injector is using the `Self` flag, because
5623
5624
  // we don't want the node injector to look at any parent injectors since we
@@ -7799,8 +7800,7 @@ function getDirectivesAtNodeIndex(nodeIndex, lView) {
7799
7800
  }
7800
7801
  function getComponentAtNodeIndex(nodeIndex, lView) {
7801
7802
  const tNode = lView[TVIEW].data[nodeIndex];
7802
- const { directiveStart, componentOffset } = tNode;
7803
- return componentOffset > -1 ? lView[directiveStart + componentOffset] : null;
7803
+ return isComponentHost(tNode) ? lView[tNode.directiveStart + tNode.componentOffset] : null;
7804
7804
  }
7805
7805
  /**
7806
7806
  * Returns a map of local references (local reference name => element or directive instance) that
@@ -7829,7 +7829,7 @@ function discoverLocalRefs(lView, nodeIndex) {
7829
7829
  function getRootView(componentOrLView) {
7830
7830
  ngDevMode && assertDefined(componentOrLView, 'component');
7831
7831
  let lView = isLView(componentOrLView) ? componentOrLView : readPatchedLView(componentOrLView);
7832
- while (lView && !(lView[FLAGS] & 512 /* LViewFlags.IsRoot */)) {
7832
+ while (lView && !isRootView(lView)) {
7833
7833
  lView = getLViewParent(lView);
7834
7834
  }
7835
7835
  ngDevMode && assertLView(lView);
@@ -7947,7 +7947,7 @@ function getOwningComponent(elementOrDir) {
7947
7947
  while (lView[TVIEW].type === 2 /* TViewType.Embedded */ && (parent = getLViewParent(lView))) {
7948
7948
  lView = parent;
7949
7949
  }
7950
- return lView[FLAGS] & 512 /* LViewFlags.IsRoot */ ? null : lView[CONTEXT];
7950
+ return isRootView(lView) ? null : lView[CONTEXT];
7951
7951
  }
7952
7952
  /**
7953
7953
  * Retrieves all root components associated with a DOM element, directive or component instance.
@@ -11648,14 +11648,6 @@ function getExpressionChangedErrorDetails(lView, bindingIndex, oldValue, newValu
11648
11648
  return { propName: undefined, oldValue, newValue };
11649
11649
  }
11650
11650
 
11651
- /** Flags describing an input for a directive. */
11652
- var InputFlags;
11653
- (function (InputFlags) {
11654
- InputFlags[InputFlags["None"] = 0] = "None";
11655
- InputFlags[InputFlags["SignalBased"] = 1] = "SignalBased";
11656
- InputFlags[InputFlags["HasDecoratorInputTransform"] = 2] = "HasDecoratorInputTransform";
11657
- })(InputFlags || (InputFlags = {}));
11658
-
11659
11651
  /**
11660
11652
  * Returns an index of `classToSearch` in `className` taking token boundaries into account.
11661
11653
  *
@@ -12087,131 +12079,15 @@ function extractAttrsAndClassesFromSelector(selector) {
12087
12079
  }
12088
12080
  i++;
12089
12081
  }
12090
- return { attrs, classes };
12082
+ if (classes.length) {
12083
+ attrs.push(1 /* AttributeMarker.Classes */, ...classes);
12084
+ }
12085
+ return attrs;
12091
12086
  }
12092
12087
 
12093
12088
  /** A special value which designates that a value has not changed. */
12094
12089
  const NO_CHANGE = typeof ngDevMode === 'undefined' || ngDevMode ? { __brand__: 'NO_CHANGE' } : {};
12095
12090
 
12096
- /**
12097
- * Advances to an element for later binding instructions.
12098
- *
12099
- * Used in conjunction with instructions like {@link property} to act on elements with specified
12100
- * indices, for example those created with {@link element} or {@link elementStart}.
12101
- *
12102
- * ```ts
12103
- * (rf: RenderFlags, ctx: any) => {
12104
- * if (rf & 1) {
12105
- * text(0, 'Hello');
12106
- * text(1, 'Goodbye')
12107
- * element(2, 'div');
12108
- * }
12109
- * if (rf & 2) {
12110
- * advance(2); // Advance twice to the <div>.
12111
- * property('title', 'test');
12112
- * }
12113
- * }
12114
- * ```
12115
- * @param delta Number of elements to advance forwards by.
12116
- *
12117
- * @codeGenApi
12118
- */
12119
- function ɵɵadvance(delta = 1) {
12120
- ngDevMode && assertGreaterThan(delta, 0, 'Can only advance forward');
12121
- selectIndexInternal(getTView(), getLView(), getSelectedIndex() + delta, !!ngDevMode && isInCheckNoChangesMode());
12122
- }
12123
- function selectIndexInternal(tView, lView, index, checkNoChangesMode) {
12124
- ngDevMode && assertIndexInDeclRange(lView[TVIEW], index);
12125
- // Flush the initial hooks for elements in the view that have been added up to this point.
12126
- // PERF WARNING: do NOT extract this to a separate function without running benchmarks
12127
- if (!checkNoChangesMode) {
12128
- const hooksInitPhaseCompleted = (lView[FLAGS] & 3 /* LViewFlags.InitPhaseStateMask */) === 3 /* InitPhaseState.InitPhaseCompleted */;
12129
- if (hooksInitPhaseCompleted) {
12130
- const preOrderCheckHooks = tView.preOrderCheckHooks;
12131
- if (preOrderCheckHooks !== null) {
12132
- executeCheckHooks(lView, preOrderCheckHooks, index);
12133
- }
12134
- }
12135
- else {
12136
- const preOrderHooks = tView.preOrderHooks;
12137
- if (preOrderHooks !== null) {
12138
- executeInitAndCheckHooks(lView, preOrderHooks, 0 /* InitPhaseState.OnInitHooksToBeRun */, index);
12139
- }
12140
- }
12141
- }
12142
- // We must set the selected index *after* running the hooks, because hooks may have side-effects
12143
- // that cause other template functions to run, thus updating the selected index, which is global
12144
- // state. If we run `setSelectedIndex` *before* we run the hooks, in some cases the selected index
12145
- // will be altered by the time we leave the `ɵɵadvance` instruction.
12146
- setSelectedIndex(index);
12147
- }
12148
-
12149
- function ɵɵdirectiveInject(token, flags = InjectFlags.Default) {
12150
- const lView = getLView();
12151
- // Fall back to inject() if view hasn't been created. This situation can happen in tests
12152
- // if inject utilities are used before bootstrapping.
12153
- if (lView === null) {
12154
- // Verify that we will not get into infinite loop.
12155
- ngDevMode && assertInjectImplementationNotEqual(ɵɵdirectiveInject);
12156
- return ɵɵinject(token, flags);
12157
- }
12158
- const tNode = getCurrentTNode();
12159
- const value = getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags);
12160
- ngDevMode && emitInjectEvent(token, value, flags);
12161
- return value;
12162
- }
12163
- /**
12164
- * Throws an error indicating that a factory function could not be generated by the compiler for a
12165
- * particular class.
12166
- *
12167
- * This instruction allows the actual error message to be optimized away when ngDevMode is turned
12168
- * off, saving bytes of generated code while still providing a good experience in dev mode.
12169
- *
12170
- * The name of the class is not mentioned here, but will be in the generated factory function name
12171
- * and thus in the stack trace.
12172
- *
12173
- * @codeGenApi
12174
- */
12175
- function ɵɵinvalidFactory() {
12176
- const msg = ngDevMode
12177
- ? `This constructor was not compatible with Dependency Injection.`
12178
- : 'invalid';
12179
- throw new Error(msg);
12180
- }
12181
-
12182
- function writeToDirectiveInput(def, instance, publicName, privateName, flags, value) {
12183
- const prevConsumer = setActiveConsumer$1(null);
12184
- try {
12185
- // If we know we are dealing with a signal input, we cache its reference
12186
- // in a tree-shakable way. The input signal node can then be used for
12187
- // value transform execution or actual value updates without introducing
12188
- // additional megamorphic accesses for accessing the instance field.
12189
- let inputSignalNode = null;
12190
- if ((flags & InputFlags.SignalBased) !== 0) {
12191
- const field = instance[privateName];
12192
- inputSignalNode = field[SIGNAL$1];
12193
- }
12194
- // If there is a signal node and a transform, run it before potentially
12195
- // delegating to features like `NgOnChanges`.
12196
- if (inputSignalNode !== null && inputSignalNode.transformFn !== undefined) {
12197
- value = inputSignalNode.transformFn(value);
12198
- }
12199
- // If there is a decorator input transform, run it.
12200
- if ((flags & InputFlags.HasDecoratorInputTransform) !== 0) {
12201
- value = def.inputTransforms[privateName].call(instance, value);
12202
- }
12203
- if (def.setInput !== null) {
12204
- def.setInput(instance, inputSignalNode, value, publicName, privateName);
12205
- }
12206
- else {
12207
- applyValueToInputField(instance, inputSignalNode, privateName, value);
12208
- }
12209
- }
12210
- finally {
12211
- setActiveConsumer$1(prevConsumer);
12212
- }
12213
- }
12214
-
12215
12091
  function createTextNode(renderer, value) {
12216
12092
  ngDevMode && ngDevMode.rendererCreateTextNode++;
12217
12093
  ngDevMode && ngDevMode.rendererSetText++;
@@ -12328,6 +12204,100 @@ function setupStaticAttributes(renderer, element, tNode) {
12328
12204
  }
12329
12205
  }
12330
12206
 
12207
+ /**
12208
+ * Advances to an element for later binding instructions.
12209
+ *
12210
+ * Used in conjunction with instructions like {@link property} to act on elements with specified
12211
+ * indices, for example those created with {@link element} or {@link elementStart}.
12212
+ *
12213
+ * ```ts
12214
+ * (rf: RenderFlags, ctx: any) => {
12215
+ * if (rf & 1) {
12216
+ * text(0, 'Hello');
12217
+ * text(1, 'Goodbye')
12218
+ * element(2, 'div');
12219
+ * }
12220
+ * if (rf & 2) {
12221
+ * advance(2); // Advance twice to the <div>.
12222
+ * property('title', 'test');
12223
+ * }
12224
+ * }
12225
+ * ```
12226
+ * @param delta Number of elements to advance forwards by.
12227
+ *
12228
+ * @codeGenApi
12229
+ */
12230
+ function ɵɵadvance(delta = 1) {
12231
+ ngDevMode && assertGreaterThan(delta, 0, 'Can only advance forward');
12232
+ selectIndexInternal(getTView(), getLView(), getSelectedIndex() + delta, !!ngDevMode && isInCheckNoChangesMode());
12233
+ }
12234
+ function selectIndexInternal(tView, lView, index, checkNoChangesMode) {
12235
+ ngDevMode && assertIndexInDeclRange(lView[TVIEW], index);
12236
+ // Flush the initial hooks for elements in the view that have been added up to this point.
12237
+ // PERF WARNING: do NOT extract this to a separate function without running benchmarks
12238
+ if (!checkNoChangesMode) {
12239
+ const hooksInitPhaseCompleted = (lView[FLAGS] & 3 /* LViewFlags.InitPhaseStateMask */) === 3 /* InitPhaseState.InitPhaseCompleted */;
12240
+ if (hooksInitPhaseCompleted) {
12241
+ const preOrderCheckHooks = tView.preOrderCheckHooks;
12242
+ if (preOrderCheckHooks !== null) {
12243
+ executeCheckHooks(lView, preOrderCheckHooks, index);
12244
+ }
12245
+ }
12246
+ else {
12247
+ const preOrderHooks = tView.preOrderHooks;
12248
+ if (preOrderHooks !== null) {
12249
+ executeInitAndCheckHooks(lView, preOrderHooks, 0 /* InitPhaseState.OnInitHooksToBeRun */, index);
12250
+ }
12251
+ }
12252
+ }
12253
+ // We must set the selected index *after* running the hooks, because hooks may have side-effects
12254
+ // that cause other template functions to run, thus updating the selected index, which is global
12255
+ // state. If we run `setSelectedIndex` *before* we run the hooks, in some cases the selected index
12256
+ // will be altered by the time we leave the `ɵɵadvance` instruction.
12257
+ setSelectedIndex(index);
12258
+ }
12259
+
12260
+ /** Flags describing an input for a directive. */
12261
+ var InputFlags;
12262
+ (function (InputFlags) {
12263
+ InputFlags[InputFlags["None"] = 0] = "None";
12264
+ InputFlags[InputFlags["SignalBased"] = 1] = "SignalBased";
12265
+ InputFlags[InputFlags["HasDecoratorInputTransform"] = 2] = "HasDecoratorInputTransform";
12266
+ })(InputFlags || (InputFlags = {}));
12267
+
12268
+ function writeToDirectiveInput(def, instance, publicName, privateName, flags, value) {
12269
+ const prevConsumer = setActiveConsumer$1(null);
12270
+ try {
12271
+ // If we know we are dealing with a signal input, we cache its reference
12272
+ // in a tree-shakable way. The input signal node can then be used for
12273
+ // value transform execution or actual value updates without introducing
12274
+ // additional megamorphic accesses for accessing the instance field.
12275
+ let inputSignalNode = null;
12276
+ if ((flags & InputFlags.SignalBased) !== 0) {
12277
+ const field = instance[privateName];
12278
+ inputSignalNode = field[SIGNAL$1];
12279
+ }
12280
+ // If there is a signal node and a transform, run it before potentially
12281
+ // delegating to features like `NgOnChanges`.
12282
+ if (inputSignalNode !== null && inputSignalNode.transformFn !== undefined) {
12283
+ value = inputSignalNode.transformFn(value);
12284
+ }
12285
+ // If there is a decorator input transform, run it.
12286
+ if ((flags & InputFlags.HasDecoratorInputTransform) !== 0) {
12287
+ value = def.inputTransforms[privateName].call(instance, value);
12288
+ }
12289
+ if (def.setInput !== null) {
12290
+ def.setInput(instance, inputSignalNode, value, publicName, privateName);
12291
+ }
12292
+ else {
12293
+ applyValueToInputField(instance, inputSignalNode, privateName, value);
12294
+ }
12295
+ }
12296
+ finally {
12297
+ setActiveConsumer$1(prevConsumer);
12298
+ }
12299
+ }
12300
+
12331
12301
  function createLView(parentLView, tView, context, flags, host, tHostNode, environment, renderer, injector, embeddedViewInjector, hydrationInfo) {
12332
12302
  const lView = tView.blueprint.slice();
12333
12303
  lView[HOST] = host;
@@ -12361,34 +12331,6 @@ function createLView(parentLView, tView, context, flags, host, tHostNode, enviro
12361
12331
  tView.type == 2 /* TViewType.Embedded */ ? parentLView[DECLARATION_COMPONENT_VIEW] : lView;
12362
12332
  return lView;
12363
12333
  }
12364
- /**
12365
- * When elements are created dynamically after a view blueprint is created (e.g. through
12366
- * i18nApply()), we need to adjust the blueprint for future
12367
- * template passes.
12368
- *
12369
- * @param tView `TView` associated with `LView`
12370
- * @param lView The `LView` containing the blueprint to adjust
12371
- * @param numSlotsToAlloc The number of slots to alloc in the LView, should be >0
12372
- * @param initialValue Initial value to store in blueprint
12373
- */
12374
- function allocExpando(tView, lView, numSlotsToAlloc, initialValue) {
12375
- if (numSlotsToAlloc === 0)
12376
- return -1;
12377
- if (ngDevMode) {
12378
- assertFirstCreatePass(tView);
12379
- assertSame(tView, lView[TVIEW], '`LView` must be associated with `TView`!');
12380
- assertEqual(tView.data.length, lView.length, 'Expecting LView to be same size as TView');
12381
- assertEqual(tView.data.length, tView.blueprint.length, 'Expecting Blueprint to be same size as TView');
12382
- assertFirstUpdatePass(tView);
12383
- }
12384
- const allocIdx = lView.length;
12385
- for (let i = 0; i < numSlotsToAlloc; i++) {
12386
- lView.push(initialValue);
12387
- tView.blueprint.push(initialValue);
12388
- tView.data.push(null);
12389
- }
12390
- return allocIdx;
12391
- }
12392
12334
  function executeTemplate(tView, lView, templateFn, rf, context) {
12393
12335
  const prevSelectedIndex = getSelectedIndex();
12394
12336
  const isUpdatePhase = rf & 2 /* RenderFlags.Update */;
@@ -12416,10 +12358,17 @@ function executeTemplate(tView, lView, templateFn, rf, context) {
12416
12358
  /**
12417
12359
  * Creates directive instances.
12418
12360
  */
12419
- function createDirectivesInstances(tView, lView, tNode) {
12361
+ function createDirectivesInstancesInInstruction(tView, lView, tNode) {
12420
12362
  if (!getBindingsEnabled())
12421
12363
  return;
12422
- instantiateAllDirectives(tView, lView, tNode, getNativeByTNode(tNode, lView));
12364
+ attachPatchData(getNativeByTNode(tNode, lView), lView);
12365
+ createDirectivesInstances(tView, lView, tNode);
12366
+ }
12367
+ /**
12368
+ * Creates directive instances.
12369
+ */
12370
+ function createDirectivesInstances(tView, lView, tNode) {
12371
+ instantiateAllDirectives(tView, lView, tNode);
12423
12372
  if ((tNode.flags & 64 /* TNodeFlags.hasHostBindings */) === 64 /* TNodeFlags.hasHostBindings */) {
12424
12373
  invokeDirectivesHostBindings(tView, lView, tNode);
12425
12374
  }
@@ -12594,106 +12543,6 @@ function applyRootElementTransformImpl(rootElement) {
12594
12543
  function enableApplyRootElementTransformImpl() {
12595
12544
  _applyRootElementTransformImpl = applyRootElementTransformImpl;
12596
12545
  }
12597
- function captureNodeBindings(mode, aliasMap, directiveIndex, bindingsResult, hostDirectiveAliasMap) {
12598
- for (let publicName in aliasMap) {
12599
- if (!aliasMap.hasOwnProperty(publicName)) {
12600
- continue;
12601
- }
12602
- const value = aliasMap[publicName];
12603
- if (value === undefined) {
12604
- continue;
12605
- }
12606
- bindingsResult ??= {};
12607
- let internalName;
12608
- let inputFlags = InputFlags.None;
12609
- // For inputs, the value might be an array capturing additional
12610
- // input flags.
12611
- if (Array.isArray(value)) {
12612
- internalName = value[0];
12613
- inputFlags = value[1];
12614
- }
12615
- else {
12616
- internalName = value;
12617
- }
12618
- // If there are no host directive mappings, we want to remap using the alias map from the
12619
- // definition itself. If there is an alias map, it has two functions:
12620
- // 1. It serves as an allowlist of bindings that are exposed by the host directives. Only the
12621
- // ones inside the host directive map will be exposed on the host.
12622
- // 2. The public name of the property is aliased using the host directive alias map, rather
12623
- // than the alias map from the definition.
12624
- let finalPublicName = publicName;
12625
- if (hostDirectiveAliasMap !== null) {
12626
- // If there is no mapping, it's not part of the allowlist and this input/output
12627
- // is not captured and should be ignored.
12628
- if (!hostDirectiveAliasMap.hasOwnProperty(publicName)) {
12629
- continue;
12630
- }
12631
- finalPublicName = hostDirectiveAliasMap[publicName];
12632
- }
12633
- if (mode === 0 /* CaptureNodeBindingMode.Inputs */) {
12634
- addPropertyBinding(bindingsResult, directiveIndex, finalPublicName, internalName, inputFlags);
12635
- }
12636
- else {
12637
- addPropertyBinding(bindingsResult, directiveIndex, finalPublicName, internalName);
12638
- }
12639
- }
12640
- return bindingsResult;
12641
- }
12642
- function addPropertyBinding(bindings, directiveIndex, publicName, internalName, inputFlags) {
12643
- let values;
12644
- if (bindings.hasOwnProperty(publicName)) {
12645
- (values = bindings[publicName]).push(directiveIndex, internalName);
12646
- }
12647
- else {
12648
- values = bindings[publicName] = [directiveIndex, internalName];
12649
- }
12650
- if (inputFlags !== undefined) {
12651
- values.push(inputFlags);
12652
- }
12653
- }
12654
- /**
12655
- * Initializes data structures required to work with directive inputs and outputs.
12656
- * Initialization is done for all directives matched on a given TNode.
12657
- */
12658
- function initializeInputAndOutputAliases(tView, tNode, hostDirectiveDefinitionMap) {
12659
- ngDevMode && assertFirstCreatePass(tView);
12660
- const start = tNode.directiveStart;
12661
- const end = tNode.directiveEnd;
12662
- const tViewData = tView.data;
12663
- const tNodeAttrs = tNode.attrs;
12664
- const inputsFromAttrs = [];
12665
- let inputsStore = null;
12666
- let outputsStore = null;
12667
- for (let directiveIndex = start; directiveIndex < end; directiveIndex++) {
12668
- const directiveDef = tViewData[directiveIndex];
12669
- const aliasData = hostDirectiveDefinitionMap
12670
- ? hostDirectiveDefinitionMap.get(directiveDef)
12671
- : null;
12672
- const aliasedInputs = aliasData ? aliasData.inputs : null;
12673
- const aliasedOutputs = aliasData ? aliasData.outputs : null;
12674
- inputsStore = captureNodeBindings(0 /* CaptureNodeBindingMode.Inputs */, directiveDef.inputs, directiveIndex, inputsStore, aliasedInputs);
12675
- outputsStore = captureNodeBindings(1 /* CaptureNodeBindingMode.Outputs */, directiveDef.outputs, directiveIndex, outputsStore, aliasedOutputs);
12676
- // Do not use unbound attributes as inputs to structural directives, since structural
12677
- // directive inputs can only be set using microsyntax (e.g. `<div *dir="exp">`).
12678
- // TODO(FW-1930): microsyntax expressions may also contain unbound/static attributes, which
12679
- // should be set for inline templates.
12680
- const initialInputs = inputsStore !== null && tNodeAttrs !== null && !isInlineTemplate(tNode)
12681
- ? generateInitialInputs(inputsStore, directiveIndex, tNodeAttrs)
12682
- : null;
12683
- inputsFromAttrs.push(initialInputs);
12684
- }
12685
- if (inputsStore !== null) {
12686
- if (inputsStore.hasOwnProperty('class')) {
12687
- tNode.flags |= 8 /* TNodeFlags.hasClassInput */;
12688
- }
12689
- if (inputsStore.hasOwnProperty('style')) {
12690
- tNode.flags |= 16 /* TNodeFlags.hasStyleInput */;
12691
- }
12692
- }
12693
- tNode.initialInputs = inputsFromAttrs;
12694
- tNode.inputs = inputsStore;
12695
- tNode.outputs = outputsStore;
12696
- }
12697
12546
  /**
12698
12547
  * Mapping between attributes names that don't correspond to their element property names.
12699
12548
  *
@@ -12794,149 +12643,21 @@ function setNgReflectProperties(lView, element, type, dataValue, value) {
12794
12643
  }
12795
12644
  }
12796
12645
  }
12797
- /**
12798
- * Resolve the matched directives on a node.
12799
- */
12800
- function resolveDirectives(tView, lView, tNode, localRefs) {
12801
- // Please make sure to have explicit type for `exportsMap`. Inferred type triggers bug in
12802
- // tsickle.
12803
- ngDevMode && assertFirstCreatePass(tView);
12804
- if (getBindingsEnabled()) {
12805
- const exportsMap = localRefs === null ? null : { '': -1 };
12806
- const matchResult = findDirectiveDefMatches(tView, tNode);
12807
- let directiveDefs;
12808
- let hostDirectiveDefs;
12809
- if (matchResult === null) {
12810
- directiveDefs = hostDirectiveDefs = null;
12811
- }
12812
- else {
12813
- [directiveDefs, hostDirectiveDefs] = matchResult;
12814
- }
12815
- if (directiveDefs !== null) {
12816
- initializeDirectives(tView, lView, tNode, directiveDefs, exportsMap, hostDirectiveDefs);
12817
- }
12818
- if (exportsMap)
12819
- cacheMatchingLocalNames(tNode, localRefs, exportsMap);
12820
- }
12821
- // Merge the template attrs last so that they have the highest priority.
12822
- tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, tNode.attrs);
12823
- }
12824
- /** Initializes the data structures necessary for a list of directives to be instantiated. */
12825
- function initializeDirectives(tView, lView, tNode, directives, exportsMap, hostDirectiveDefs) {
12826
- ngDevMode && assertFirstCreatePass(tView);
12827
- // Publishes the directive types to DI so they can be injected. Needs to
12828
- // happen in a separate pass before the TNode flags have been initialized.
12829
- for (let i = 0; i < directives.length; i++) {
12830
- diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, lView), tView, directives[i].type);
12831
- }
12832
- initTNodeFlags(tNode, tView.data.length, directives.length);
12833
- // When the same token is provided by several directives on the same node, some rules apply in
12834
- // the viewEngine:
12835
- // - viewProviders have priority over providers
12836
- // - the last directive in NgModule.declarations has priority over the previous one
12837
- // So to match these rules, the order in which providers are added in the arrays is very
12838
- // important.
12839
- for (let i = 0; i < directives.length; i++) {
12840
- const def = directives[i];
12841
- if (def.providersResolver)
12842
- def.providersResolver(def);
12843
- }
12844
- let preOrderHooksFound = false;
12845
- let preOrderCheckHooksFound = false;
12846
- let directiveIdx = allocExpando(tView, lView, directives.length, null);
12847
- ngDevMode &&
12848
- assertSame(directiveIdx, tNode.directiveStart, 'TNode.directiveStart should point to just allocated space');
12849
- for (let i = 0; i < directives.length; i++) {
12850
- const def = directives[i];
12851
- // Merge the attrs in the order of matches. This assumes that the first directive is the
12852
- // component itself, so that the component has the least priority.
12853
- tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, def.hostAttrs);
12854
- configureViewWithDirective(tView, tNode, lView, directiveIdx, def);
12855
- saveNameToExportMap(directiveIdx, def, exportsMap);
12856
- if (def.contentQueries !== null)
12857
- tNode.flags |= 4 /* TNodeFlags.hasContentQuery */;
12858
- if (def.hostBindings !== null || def.hostAttrs !== null || def.hostVars !== 0)
12859
- tNode.flags |= 64 /* TNodeFlags.hasHostBindings */;
12860
- const lifeCycleHooks = def.type.prototype;
12861
- // Only push a node index into the preOrderHooks array if this is the first
12862
- // pre-order hook found on this node.
12863
- if (!preOrderHooksFound &&
12864
- (lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngOnInit || lifeCycleHooks.ngDoCheck)) {
12865
- // We will push the actual hook function into this array later during dir instantiation.
12866
- // We cannot do it now because we must ensure hooks are registered in the same
12867
- // order that directives are created (i.e. injection order).
12868
- (tView.preOrderHooks ??= []).push(tNode.index);
12869
- preOrderHooksFound = true;
12870
- }
12871
- if (!preOrderCheckHooksFound && (lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngDoCheck)) {
12872
- (tView.preOrderCheckHooks ??= []).push(tNode.index);
12873
- preOrderCheckHooksFound = true;
12874
- }
12875
- directiveIdx++;
12876
- }
12877
- initializeInputAndOutputAliases(tView, tNode, hostDirectiveDefs);
12878
- }
12879
- /**
12880
- * Add `hostBindings` to the `TView.hostBindingOpCodes`.
12881
- *
12882
- * @param tView `TView` to which the `hostBindings` should be added.
12883
- * @param tNode `TNode` the element which contains the directive
12884
- * @param directiveIdx Directive index in view.
12885
- * @param directiveVarsIdx Where will the directive's vars be stored
12886
- * @param def `ComponentDef`/`DirectiveDef`, which contains the `hostVars`/`hostBindings` to add.
12887
- */
12888
- function registerHostBindingOpCodes(tView, tNode, directiveIdx, directiveVarsIdx, def) {
12889
- ngDevMode && assertFirstCreatePass(tView);
12890
- const hostBindings = def.hostBindings;
12891
- if (hostBindings) {
12892
- let hostBindingOpCodes = tView.hostBindingOpCodes;
12893
- if (hostBindingOpCodes === null) {
12894
- hostBindingOpCodes = tView.hostBindingOpCodes = [];
12895
- }
12896
- const elementIndx = ~tNode.index;
12897
- if (lastSelectedElementIdx(hostBindingOpCodes) != elementIndx) {
12898
- // Conditionally add select element so that we are more efficient in execution.
12899
- // NOTE: this is strictly not necessary and it trades code size for runtime perf.
12900
- // (We could just always add it.)
12901
- hostBindingOpCodes.push(elementIndx);
12902
- }
12903
- hostBindingOpCodes.push(directiveIdx, directiveVarsIdx, hostBindings);
12904
- }
12905
- }
12906
- /**
12907
- * Returns the last selected element index in the `HostBindingOpCodes`
12908
- *
12909
- * For perf reasons we don't need to update the selected element index in `HostBindingOpCodes` only
12910
- * if it changes. This method returns the last index (or '0' if not found.)
12911
- *
12912
- * Selected element index are only the ones which are negative.
12913
- */
12914
- function lastSelectedElementIdx(hostBindingOpCodes) {
12915
- let i = hostBindingOpCodes.length;
12916
- while (i > 0) {
12917
- const value = hostBindingOpCodes[--i];
12918
- if (typeof value === 'number' && value < 0) {
12919
- return value;
12920
- }
12921
- }
12922
- return 0;
12923
- }
12924
12646
  /**
12925
12647
  * Instantiate all the directives that were previously resolved on the current node.
12926
12648
  */
12927
- function instantiateAllDirectives(tView, lView, tNode, native) {
12649
+ function instantiateAllDirectives(tView, lView, tNode) {
12928
12650
  const start = tNode.directiveStart;
12929
12651
  const end = tNode.directiveEnd;
12930
12652
  // The component view needs to be created before creating the node injector
12931
12653
  // since it is used to inject some special symbols like `ChangeDetectorRef`.
12932
12654
  if (isComponentHost(tNode)) {
12933
12655
  ngDevMode && assertTNodeType(tNode, 3 /* TNodeType.AnyRNode */);
12934
- addComponentLogic(lView, tNode, tView.data[start + tNode.componentOffset]);
12656
+ createComponentLView(lView, tNode, tView.data[start + tNode.componentOffset]);
12935
12657
  }
12936
12658
  if (!tView.firstCreatePass) {
12937
12659
  getOrCreateNodeInjectorForNode(tNode, lView);
12938
12660
  }
12939
- attachPatchData(native, lView);
12940
12661
  const initialInputs = tNode.initialInputs;
12941
12662
  for (let i = start; i < end; i++) {
12942
12663
  const def = tView.data[i];
@@ -12992,140 +12713,28 @@ function findDirectiveDefMatches(tView, tNode) {
12992
12713
  ngDevMode && assertTNodeType(tNode, 3 /* TNodeType.AnyRNode */ | 12 /* TNodeType.AnyContainer */);
12993
12714
  const registry = tView.directiveRegistry;
12994
12715
  let matches = null;
12995
- let hostDirectiveDefs = null;
12996
12716
  if (registry) {
12997
12717
  for (let i = 0; i < registry.length; i++) {
12998
12718
  const def = registry[i];
12999
12719
  if (isNodeMatchingSelectorList(tNode, def.selectors, /* isProjectionMode */ false)) {
13000
- matches || (matches = []);
12720
+ matches ??= [];
13001
12721
  if (isComponentDef(def)) {
13002
12722
  if (ngDevMode) {
13003
12723
  assertTNodeType(tNode, 2 /* TNodeType.Element */, `"${tNode.value}" tags cannot be used as component hosts. ` +
13004
12724
  `Please use a different tag to activate the ${stringify(def.type)} component.`);
13005
- if (isComponentHost(tNode)) {
12725
+ if (matches.length && isComponentDef(matches[0])) {
13006
12726
  throwMultipleComponentError(tNode, matches.find(isComponentDef).type, def.type);
13007
12727
  }
13008
12728
  }
13009
- // Components are inserted at the front of the matches array so that their lifecycle
13010
- // hooks run before any directive lifecycle hooks. This appears to be for ViewEngine
13011
- // compatibility. This logic doesn't make sense with host directives, because it
13012
- // would allow the host directives to undo any overrides the host may have made.
13013
- // To handle this case, the host directives of components are inserted at the beginning
13014
- // of the array, followed by the component. As such, the insertion order is as follows:
13015
- // 1. Host directives belonging to the selector-matched component.
13016
- // 2. Selector-matched component.
13017
- // 3. Host directives belonging to selector-matched directives.
13018
- // 4. Selector-matched directives.
13019
- if (def.findHostDirectiveDefs !== null) {
13020
- const hostDirectiveMatches = [];
13021
- hostDirectiveDefs = hostDirectiveDefs || new Map();
13022
- def.findHostDirectiveDefs(def, hostDirectiveMatches, hostDirectiveDefs);
13023
- // Add all host directives declared on this component, followed by the component itself.
13024
- // Host directives should execute first so the host has a chance to override changes
13025
- // to the DOM made by them.
13026
- matches.unshift(...hostDirectiveMatches, def);
13027
- // Component is offset starting from the beginning of the host directives array.
13028
- const componentOffset = hostDirectiveMatches.length;
13029
- markAsComponentHost(tView, tNode, componentOffset);
13030
- }
13031
- else {
13032
- // No host directives on this component, just add the
13033
- // component def to the beginning of the matches.
13034
- matches.unshift(def);
13035
- markAsComponentHost(tView, tNode, 0);
13036
- }
12729
+ matches.unshift(def);
13037
12730
  }
13038
12731
  else {
13039
- // Append any host directives to the matches first.
13040
- hostDirectiveDefs = hostDirectiveDefs || new Map();
13041
- def.findHostDirectiveDefs?.(def, matches, hostDirectiveDefs);
13042
12732
  matches.push(def);
13043
12733
  }
13044
12734
  }
13045
12735
  }
13046
12736
  }
13047
- ngDevMode && matches !== null && assertNoDuplicateDirectives(matches);
13048
- return matches === null ? null : [matches, hostDirectiveDefs];
13049
- }
13050
- /**
13051
- * Marks a given TNode as a component's host. This consists of:
13052
- * - setting the component offset on the TNode.
13053
- * - storing index of component's host element so it will be queued for view refresh during CD.
13054
- */
13055
- function markAsComponentHost(tView, hostTNode, componentOffset) {
13056
- ngDevMode && assertFirstCreatePass(tView);
13057
- ngDevMode && assertGreaterThan(componentOffset, -1, 'componentOffset must be great than -1');
13058
- hostTNode.componentOffset = componentOffset;
13059
- (tView.components ??= []).push(hostTNode.index);
13060
- }
13061
- /** Caches local names and their matching directive indices for query and template lookups. */
13062
- function cacheMatchingLocalNames(tNode, localRefs, exportsMap) {
13063
- if (localRefs) {
13064
- const localNames = (tNode.localNames = []);
13065
- // Local names must be stored in tNode in the same order that localRefs are defined
13066
- // in the template to ensure the data is loaded in the same slots as their refs
13067
- // in the template (for template queries).
13068
- for (let i = 0; i < localRefs.length; i += 2) {
13069
- const index = exportsMap[localRefs[i + 1]];
13070
- if (index == null)
13071
- throw new RuntimeError(-301 /* RuntimeErrorCode.EXPORT_NOT_FOUND */, ngDevMode && `Export of name '${localRefs[i + 1]}' not found!`);
13072
- localNames.push(localRefs[i], index);
13073
- }
13074
- }
13075
- }
13076
- /**
13077
- * Builds up an export map as directives are created, so local refs can be quickly mapped
13078
- * to their directive instances.
13079
- */
13080
- function saveNameToExportMap(directiveIdx, def, exportsMap) {
13081
- if (exportsMap) {
13082
- if (def.exportAs) {
13083
- for (let i = 0; i < def.exportAs.length; i++) {
13084
- exportsMap[def.exportAs[i]] = directiveIdx;
13085
- }
13086
- }
13087
- if (isComponentDef(def))
13088
- exportsMap[''] = directiveIdx;
13089
- }
13090
- }
13091
- /**
13092
- * Initializes the flags on the current node, setting all indices to the initial index,
13093
- * the directive count to 0, and adding the isComponent flag.
13094
- * @param index the initial index
13095
- */
13096
- function initTNodeFlags(tNode, index, numberOfDirectives) {
13097
- ngDevMode &&
13098
- assertNotEqual(numberOfDirectives, tNode.directiveEnd - tNode.directiveStart, 'Reached the max number of directives');
13099
- tNode.flags |= 1 /* TNodeFlags.isDirectiveHost */;
13100
- // When the first directive is created on a node, save the index
13101
- tNode.directiveStart = index;
13102
- tNode.directiveEnd = index + numberOfDirectives;
13103
- tNode.providerIndexes = index;
13104
- }
13105
- /**
13106
- * Setup directive for instantiation.
13107
- *
13108
- * We need to create a `NodeInjectorFactory` which is then inserted in both the `Blueprint` as well
13109
- * as `LView`. `TView` gets the `DirectiveDef`.
13110
- *
13111
- * @param tView `TView`
13112
- * @param tNode `TNode`
13113
- * @param lView `LView`
13114
- * @param directiveIndex Index where the directive will be stored in the Expando.
13115
- * @param def `DirectiveDef`
13116
- */
13117
- function configureViewWithDirective(tView, tNode, lView, directiveIndex, def) {
13118
- ngDevMode &&
13119
- assertGreaterThanOrEqual(directiveIndex, HEADER_OFFSET, 'Must be in Expando section');
13120
- tView.data[directiveIndex] = def;
13121
- const directiveFactory = def.factory || (def.factory = getFactoryDef(def.type, true));
13122
- // Even though `directiveFactory` will already be using `ɵɵdirectiveInject` in its generated code,
13123
- // we also want to support `inject()` directly from the directive constructor context so we set
13124
- // `ɵɵdirectiveInject` as the inject implementation here too.
13125
- const nodeInjectorFactory = new NodeInjectorFactory(directiveFactory, isComponentDef(def), ɵɵdirectiveInject);
13126
- tView.blueprint[directiveIndex] = nodeInjectorFactory;
13127
- lView[directiveIndex] = nodeInjectorFactory;
13128
- registerHostBindingOpCodes(tView, tNode, directiveIndex, allocExpando(tView, lView, def.hostVars, NO_CHANGE), def);
12737
+ return matches;
13129
12738
  }
13130
12739
  /**
13131
12740
  * Gets the initial set of LView flags based on the component definition that the LView represents.
@@ -13141,7 +12750,7 @@ function getInitialLViewFlagsFromDef(def) {
13141
12750
  }
13142
12751
  return flags;
13143
12752
  }
13144
- function addComponentLogic(lView, hostTNode, def) {
12753
+ function createComponentLView(lView, hostTNode, def) {
13145
12754
  const native = getNativeByTNode(hostTNode, lView);
13146
12755
  const tView = getOrCreateComponentTView(def);
13147
12756
  // Only component views should be added to the view tree directly. Embedded views are
@@ -13150,7 +12759,7 @@ function addComponentLogic(lView, hostTNode, def) {
13150
12759
  const componentView = addToEndOfViewTree(lView, createLView(lView, tView, null, getInitialLViewFlagsFromDef(def), native, hostTNode, null, rendererFactory.createRenderer(native, def), null, null, null));
13151
12760
  // Component view will always be created before any injected LContainers,
13152
12761
  // so this is a regular element, wrap it with the component view
13153
- lView[hostTNode.index] = componentView;
12762
+ return (lView[hostTNode.index] = componentView);
13154
12763
  }
13155
12764
  function elementAttributeInternal(tNode, lView, name, value, sanitizer, namespace) {
13156
12765
  if (ngDevMode) {
@@ -13198,58 +12807,6 @@ function setInputsFromAttrs(lView, directiveIndex, instance, def, tNode, initial
13198
12807
  }
13199
12808
  }
13200
12809
  }
13201
- /**
13202
- * Generates initialInputData for a node and stores it in the template's static storage
13203
- * so subsequent template invocations don't have to recalculate it.
13204
- *
13205
- * initialInputData is an array containing values that need to be set as input properties
13206
- * for directives on this node, but only once on creation. We need this array to support
13207
- * the case where you set an @Input property of a directive using attribute-like syntax.
13208
- * e.g. if you have a `name` @Input, you can set it once like this:
13209
- *
13210
- * <my-component name="Bess"></my-component>
13211
- *
13212
- * @param inputs Input alias map that was generated from the directive def inputs.
13213
- * @param directiveIndex Index of the directive that is currently being processed.
13214
- * @param attrs Static attrs on this node.
13215
- */
13216
- function generateInitialInputs(inputs, directiveIndex, attrs) {
13217
- let inputsToStore = null;
13218
- let i = 0;
13219
- while (i < attrs.length) {
13220
- const attrName = attrs[i];
13221
- if (attrName === 0 /* AttributeMarker.NamespaceURI */) {
13222
- // We do not allow inputs on namespaced attributes.
13223
- i += 4;
13224
- continue;
13225
- }
13226
- else if (attrName === 5 /* AttributeMarker.ProjectAs */) {
13227
- // Skip over the `ngProjectAs` value.
13228
- i += 2;
13229
- continue;
13230
- }
13231
- // If we hit any other attribute markers, we're done anyway. None of those are valid inputs.
13232
- if (typeof attrName === 'number')
13233
- break;
13234
- if (inputs.hasOwnProperty(attrName)) {
13235
- if (inputsToStore === null)
13236
- inputsToStore = [];
13237
- // Find the input's public name from the input store. Note that we can be found easier
13238
- // through the directive def, but we want to do it using the inputs store so that it can
13239
- // account for host directive aliases.
13240
- const inputConfig = inputs[attrName];
13241
- for (let j = 0; j < inputConfig.length; j += 3) {
13242
- if (inputConfig[j] === directiveIndex) {
13243
- inputsToStore.push(attrName, inputConfig[j + 1], inputConfig[j + 2], attrs[i + 1]);
13244
- // A directive can't have multiple inputs with the same name so we can break here.
13245
- break;
13246
- }
13247
- }
13248
- }
13249
- i += 2;
13250
- }
13251
- return inputsToStore;
13252
- }
13253
12810
  //////////////////////////
13254
12811
  //// ViewContainer & View
13255
12812
  //////////////////////////
@@ -13548,6 +13105,15 @@ function ensureIcuContainerVisitorLoaded(loader) {
13548
13105
  }
13549
13106
  }
13550
13107
 
13108
+ /**
13109
+ * Checks whether a TNode is considered detached, i.e. not present in the
13110
+ * translated i18n template. We should not attempt hydration for such nodes
13111
+ * and instead, use a regular "creation mode".
13112
+ */
13113
+ function isDetachedByI18n(tNode) {
13114
+ return (tNode.flags & 32 /* TNodeFlags.isDetached */) === 32 /* TNodeFlags.isDetached */;
13115
+ }
13116
+
13551
13117
  /**
13552
13118
  * NOTE: for performance reasons, the possible actions are inlined within the function instead of
13553
13119
  * being passed as an argument.
@@ -14024,10 +13590,9 @@ function getClosestRElement(tView, tNode, lView) {
14024
13590
  }
14025
13591
  else {
14026
13592
  ngDevMode && assertTNodeType(parentTNode, 3 /* TNodeType.AnyRNode */ | 4 /* TNodeType.Container */);
14027
- const { componentOffset } = parentTNode;
14028
- if (componentOffset > -1) {
13593
+ if (isComponentHost(parentTNode)) {
14029
13594
  ngDevMode && assertTNodeForLView(parentTNode, lView);
14030
- const { encapsulation } = tView.data[parentTNode.directiveStart + componentOffset];
13595
+ const { encapsulation } = tView.data[parentTNode.directiveStart + parentTNode.componentOffset];
14031
13596
  // We've got a parent which is an element in the current view. We just need to verify if the
14032
13597
  // parent element is not a component. Component's content nodes are not inserted immediately
14033
13598
  // because they will be projected, and so doing insert at this point would be wasteful.
@@ -14218,7 +13783,7 @@ function applyNodes(renderer, action, tNode, lView, parentRElement, beforeNode,
14218
13783
  tNode.flags |= 2 /* TNodeFlags.isProjected */;
14219
13784
  }
14220
13785
  }
14221
- if ((tNode.flags & 32 /* TNodeFlags.isDetached */) !== 32 /* TNodeFlags.isDetached */) {
13786
+ if (!isDetachedByI18n(tNode)) {
14222
13787
  if (tNodeType & 8 /* TNodeType.ElementContainer */) {
14223
13788
  applyNodes(renderer, action, tNode.child, lView, parentRElement, beforeNode, false);
14224
13789
  applyToElementOrContainer(action, renderer, parentRElement, rawSlotValue, beforeNode);
@@ -17780,6 +17345,492 @@ function computeStaticStyling(tNode, attrs, writeToHost) {
17780
17345
  writeToHost ? (tNode.classes = classes) : (tNode.classesWithoutHost = classes);
17781
17346
  }
17782
17347
 
17348
+ function ɵɵdirectiveInject(token, flags = InjectFlags.Default) {
17349
+ const lView = getLView();
17350
+ // Fall back to inject() if view hasn't been created. This situation can happen in tests
17351
+ // if inject utilities are used before bootstrapping.
17352
+ if (lView === null) {
17353
+ // Verify that we will not get into infinite loop.
17354
+ ngDevMode && assertInjectImplementationNotEqual(ɵɵdirectiveInject);
17355
+ return ɵɵinject(token, flags);
17356
+ }
17357
+ const tNode = getCurrentTNode();
17358
+ const value = getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags);
17359
+ ngDevMode && emitInjectEvent(token, value, flags);
17360
+ return value;
17361
+ }
17362
+ /**
17363
+ * Throws an error indicating that a factory function could not be generated by the compiler for a
17364
+ * particular class.
17365
+ *
17366
+ * This instruction allows the actual error message to be optimized away when ngDevMode is turned
17367
+ * off, saving bytes of generated code while still providing a good experience in dev mode.
17368
+ *
17369
+ * The name of the class is not mentioned here, but will be in the generated factory function name
17370
+ * and thus in the stack trace.
17371
+ *
17372
+ * @codeGenApi
17373
+ */
17374
+ function ɵɵinvalidFactory() {
17375
+ const msg = ngDevMode
17376
+ ? `This constructor was not compatible with Dependency Injection.`
17377
+ : 'invalid';
17378
+ throw new Error(msg);
17379
+ }
17380
+
17381
+ /**
17382
+ * When elements are created dynamically after a view blueprint is created (e.g. through
17383
+ * i18nApply()), we need to adjust the blueprint for future template passes.
17384
+ *
17385
+ * @param tView `TView` associated with `LView`
17386
+ * @param lView The `LView` containing the blueprint to adjust
17387
+ * @param numSlotsToAlloc The number of slots to alloc in the LView, should be >0
17388
+ * @param initialValue Initial value to store in blueprint
17389
+ */
17390
+ function allocExpando(tView, lView, numSlotsToAlloc, initialValue) {
17391
+ if (numSlotsToAlloc === 0)
17392
+ return -1;
17393
+ if (ngDevMode) {
17394
+ assertFirstCreatePass(tView);
17395
+ assertSame(tView, lView[TVIEW], '`LView` must be associated with `TView`!');
17396
+ assertEqual(tView.data.length, lView.length, 'Expecting LView to be same size as TView');
17397
+ assertEqual(tView.data.length, tView.blueprint.length, 'Expecting Blueprint to be same size as TView');
17398
+ assertFirstUpdatePass(tView);
17399
+ }
17400
+ const allocIdx = lView.length;
17401
+ for (let i = 0; i < numSlotsToAlloc; i++) {
17402
+ lView.push(initialValue);
17403
+ tView.blueprint.push(initialValue);
17404
+ tView.data.push(null);
17405
+ }
17406
+ return allocIdx;
17407
+ }
17408
+
17409
+ /**
17410
+ * Resolve the matched directives on a node.
17411
+ */
17412
+ function resolveDirectives(tView, lView, tNode, localRefs, directiveMatcher) {
17413
+ // Please make sure to have explicit type for `exportsMap`. Inferred type triggers bug in
17414
+ // tsickle.
17415
+ ngDevMode && assertFirstCreatePass(tView);
17416
+ const exportsMap = localRefs === null ? null : { '': -1 };
17417
+ const matchedDirectiveDefs = directiveMatcher(tView, tNode);
17418
+ if (matchedDirectiveDefs !== null) {
17419
+ const [directiveDefs, hostDirectiveDefs] = resolveHostDirectives(tView, tNode, matchedDirectiveDefs);
17420
+ initializeDirectives(tView, lView, tNode, directiveDefs, exportsMap, hostDirectiveDefs);
17421
+ }
17422
+ if (exportsMap !== null && localRefs !== null) {
17423
+ cacheMatchingLocalNames(tNode, localRefs, exportsMap);
17424
+ }
17425
+ }
17426
+ /** Caches local names and their matching directive indices for query and template lookups. */
17427
+ function cacheMatchingLocalNames(tNode, localRefs, exportsMap) {
17428
+ const localNames = (tNode.localNames = []);
17429
+ // Local names must be stored in tNode in the same order that localRefs are defined
17430
+ // in the template to ensure the data is loaded in the same slots as their refs
17431
+ // in the template (for template queries).
17432
+ for (let i = 0; i < localRefs.length; i += 2) {
17433
+ const index = exportsMap[localRefs[i + 1]];
17434
+ if (index == null)
17435
+ throw new RuntimeError(-301 /* RuntimeErrorCode.EXPORT_NOT_FOUND */, ngDevMode && `Export of name '${localRefs[i + 1]}' not found!`);
17436
+ localNames.push(localRefs[i], index);
17437
+ }
17438
+ }
17439
+ function resolveHostDirectives(tView, tNode, matches) {
17440
+ const allDirectiveDefs = [];
17441
+ let hostDirectiveDefs = null;
17442
+ for (const def of matches) {
17443
+ if (def.findHostDirectiveDefs !== null) {
17444
+ // TODO(pk): probably could return matches instead of taking in an array to fill in?
17445
+ hostDirectiveDefs ??= new Map();
17446
+ // Components are inserted at the front of the matches array so that their lifecycle
17447
+ // hooks run before any directive lifecycle hooks. This appears to be for ViewEngine
17448
+ // compatibility. This logic doesn't make sense with host directives, because it
17449
+ // would allow the host directives to undo any overrides the host may have made.
17450
+ // To handle this case, the host directives of components are inserted at the beginning
17451
+ // of the array, followed by the component. As such, the insertion order is as follows:
17452
+ // 1. Host directives belonging to the selector-matched component.
17453
+ // 2. Selector-matched component.
17454
+ // 3. Host directives belonging to selector-matched directives.
17455
+ // 4. Selector-matched directives.
17456
+ def.findHostDirectiveDefs(def, allDirectiveDefs, hostDirectiveDefs);
17457
+ }
17458
+ if (isComponentDef(def)) {
17459
+ allDirectiveDefs.push(def);
17460
+ markAsComponentHost(tView, tNode, allDirectiveDefs.length - 1);
17461
+ }
17462
+ }
17463
+ if (isComponentHost(tNode)) {
17464
+ allDirectiveDefs.push(...matches.slice(1));
17465
+ }
17466
+ else {
17467
+ allDirectiveDefs.push(...matches);
17468
+ }
17469
+ if (ngDevMode) {
17470
+ assertNoDuplicateDirectives(allDirectiveDefs);
17471
+ }
17472
+ return [allDirectiveDefs, hostDirectiveDefs];
17473
+ }
17474
+ /**
17475
+ * Marks a given TNode as a component's host. This consists of:
17476
+ * - setting the component offset on the TNode.
17477
+ * - storing index of component's host element so it will be queued for view refresh during CD.
17478
+ */
17479
+ function markAsComponentHost(tView, hostTNode, componentOffset) {
17480
+ ngDevMode && assertFirstCreatePass(tView);
17481
+ ngDevMode && assertGreaterThan(componentOffset, -1, 'componentOffset must be great than -1');
17482
+ hostTNode.componentOffset = componentOffset;
17483
+ (tView.components ??= []).push(hostTNode.index);
17484
+ }
17485
+ /** Initializes the data structures necessary for a list of directives to be instantiated. */
17486
+ function initializeDirectives(tView, lView, tNode, directives, exportsMap, hostDirectiveDefs) {
17487
+ ngDevMode && assertFirstCreatePass(tView);
17488
+ // Publishes the directive types to DI so they can be injected. Needs to
17489
+ // happen in a separate pass before the TNode flags have been initialized.
17490
+ for (let i = 0; i < directives.length; i++) {
17491
+ diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, lView), tView, directives[i].type);
17492
+ }
17493
+ initTNodeFlags(tNode, tView.data.length, directives.length);
17494
+ // When the same token is provided by several directives on the same node, some rules apply in
17495
+ // the viewEngine:
17496
+ // - viewProviders have priority over providers
17497
+ // - the last directive in NgModule.declarations has priority over the previous one
17498
+ // So to match these rules, the order in which providers are added in the arrays is very
17499
+ // important.
17500
+ for (let i = 0; i < directives.length; i++) {
17501
+ const def = directives[i];
17502
+ if (def.providersResolver)
17503
+ def.providersResolver(def);
17504
+ }
17505
+ let preOrderHooksFound = false;
17506
+ let preOrderCheckHooksFound = false;
17507
+ let directiveIdx = allocExpando(tView, lView, directives.length, null);
17508
+ ngDevMode &&
17509
+ assertSame(directiveIdx, tNode.directiveStart, 'TNode.directiveStart should point to just allocated space');
17510
+ for (let i = 0; i < directives.length; i++) {
17511
+ const def = directives[i];
17512
+ // Merge the attrs in the order of matches. This assumes that the first directive is the
17513
+ // component itself, so that the component has the least priority.
17514
+ tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, def.hostAttrs);
17515
+ configureViewWithDirective(tView, tNode, lView, directiveIdx, def);
17516
+ saveNameToExportMap(directiveIdx, def, exportsMap);
17517
+ if (def.contentQueries !== null)
17518
+ tNode.flags |= 4 /* TNodeFlags.hasContentQuery */;
17519
+ if (def.hostBindings !== null || def.hostAttrs !== null || def.hostVars !== 0)
17520
+ tNode.flags |= 64 /* TNodeFlags.hasHostBindings */;
17521
+ const lifeCycleHooks = def.type.prototype;
17522
+ // Only push a node index into the preOrderHooks array if this is the first
17523
+ // pre-order hook found on this node.
17524
+ if (!preOrderHooksFound &&
17525
+ (lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngOnInit || lifeCycleHooks.ngDoCheck)) {
17526
+ // We will push the actual hook function into this array later during dir instantiation.
17527
+ // We cannot do it now because we must ensure hooks are registered in the same
17528
+ // order that directives are created (i.e. injection order).
17529
+ (tView.preOrderHooks ??= []).push(tNode.index);
17530
+ preOrderHooksFound = true;
17531
+ }
17532
+ if (!preOrderCheckHooksFound && (lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngDoCheck)) {
17533
+ (tView.preOrderCheckHooks ??= []).push(tNode.index);
17534
+ preOrderCheckHooksFound = true;
17535
+ }
17536
+ directiveIdx++;
17537
+ }
17538
+ initializeInputAndOutputAliases(tView, tNode, hostDirectiveDefs);
17539
+ }
17540
+ /**
17541
+ * Initializes data structures required to work with directive inputs and outputs.
17542
+ * Initialization is done for all directives matched on a given TNode.
17543
+ */
17544
+ function initializeInputAndOutputAliases(tView, tNode, hostDirectiveDefinitionMap) {
17545
+ ngDevMode && assertFirstCreatePass(tView);
17546
+ const start = tNode.directiveStart;
17547
+ const end = tNode.directiveEnd;
17548
+ const tViewData = tView.data;
17549
+ const tNodeAttrs = tNode.attrs;
17550
+ const inputsFromAttrs = [];
17551
+ let inputsStore = null;
17552
+ let outputsStore = null;
17553
+ for (let directiveIndex = start; directiveIndex < end; directiveIndex++) {
17554
+ const directiveDef = tViewData[directiveIndex];
17555
+ const aliasData = hostDirectiveDefinitionMap
17556
+ ? hostDirectiveDefinitionMap.get(directiveDef)
17557
+ : null;
17558
+ const aliasedInputs = aliasData ? aliasData.inputs : null;
17559
+ const aliasedOutputs = aliasData ? aliasData.outputs : null;
17560
+ inputsStore = captureNodeBindings(0 /* CaptureNodeBindingMode.Inputs */, directiveDef.inputs, directiveIndex, inputsStore, aliasedInputs);
17561
+ outputsStore = captureNodeBindings(1 /* CaptureNodeBindingMode.Outputs */, directiveDef.outputs, directiveIndex, outputsStore, aliasedOutputs);
17562
+ // Do not use unbound attributes as inputs to structural directives, since structural
17563
+ // directive inputs can only be set using microsyntax (e.g. `<div *dir="exp">`).
17564
+ const initialInputs = inputsStore !== null && tNodeAttrs !== null && !isInlineTemplate(tNode)
17565
+ ? generateInitialInputs(inputsStore, directiveIndex, tNodeAttrs)
17566
+ : null;
17567
+ inputsFromAttrs.push(initialInputs);
17568
+ }
17569
+ if (inputsStore !== null) {
17570
+ if (inputsStore.hasOwnProperty('class')) {
17571
+ tNode.flags |= 8 /* TNodeFlags.hasClassInput */;
17572
+ }
17573
+ if (inputsStore.hasOwnProperty('style')) {
17574
+ tNode.flags |= 16 /* TNodeFlags.hasStyleInput */;
17575
+ }
17576
+ }
17577
+ tNode.initialInputs = inputsFromAttrs;
17578
+ tNode.inputs = inputsStore;
17579
+ tNode.outputs = outputsStore;
17580
+ }
17581
+ function captureNodeBindings(mode, aliasMap, directiveIndex, bindingsResult, hostDirectiveAliasMap) {
17582
+ for (let publicName in aliasMap) {
17583
+ if (!aliasMap.hasOwnProperty(publicName)) {
17584
+ continue;
17585
+ }
17586
+ const value = aliasMap[publicName];
17587
+ if (value === undefined) {
17588
+ continue;
17589
+ }
17590
+ bindingsResult ??= {};
17591
+ let internalName;
17592
+ let inputFlags = InputFlags.None;
17593
+ // For inputs, the value might be an array capturing additional
17594
+ // input flags.
17595
+ if (Array.isArray(value)) {
17596
+ internalName = value[0];
17597
+ inputFlags = value[1];
17598
+ }
17599
+ else {
17600
+ internalName = value;
17601
+ }
17602
+ // If there are no host directive mappings, we want to remap using the alias map from the
17603
+ // definition itself. If there is an alias map, it has two functions:
17604
+ // 1. It serves as an allowlist of bindings that are exposed by the host directives. Only the
17605
+ // ones inside the host directive map will be exposed on the host.
17606
+ // 2. The public name of the property is aliased using the host directive alias map, rather
17607
+ // than the alias map from the definition.
17608
+ let finalPublicName = publicName;
17609
+ if (hostDirectiveAliasMap !== null) {
17610
+ // If there is no mapping, it's not part of the allowlist and this input/output
17611
+ // is not captured and should be ignored.
17612
+ if (!hostDirectiveAliasMap.hasOwnProperty(publicName)) {
17613
+ continue;
17614
+ }
17615
+ finalPublicName = hostDirectiveAliasMap[publicName];
17616
+ }
17617
+ if (mode === 0 /* CaptureNodeBindingMode.Inputs */) {
17618
+ addPropertyBinding(bindingsResult, directiveIndex, finalPublicName, internalName, inputFlags);
17619
+ }
17620
+ else {
17621
+ addPropertyBinding(bindingsResult, directiveIndex, finalPublicName, internalName);
17622
+ }
17623
+ }
17624
+ return bindingsResult;
17625
+ }
17626
+ function addPropertyBinding(bindings, directiveIndex, publicName, internalName, inputFlags) {
17627
+ let values;
17628
+ if (bindings.hasOwnProperty(publicName)) {
17629
+ (values = bindings[publicName]).push(directiveIndex, internalName);
17630
+ }
17631
+ else {
17632
+ values = bindings[publicName] = [directiveIndex, internalName];
17633
+ }
17634
+ if (inputFlags !== undefined) {
17635
+ values.push(inputFlags);
17636
+ }
17637
+ }
17638
+ /**
17639
+ * Generates initialInputData for a node and stores it in the template's static storage
17640
+ * so subsequent template invocations don't have to recalculate it.
17641
+ *
17642
+ * initialInputData is an array containing values that need to be set as input properties
17643
+ * for directives on this node, but only once on creation. We need this array to support
17644
+ * the case where you set an @Input property of a directive using attribute-like syntax.
17645
+ * e.g. if you have a `name` @Input, you can set it once like this:
17646
+ *
17647
+ * <my-component name="Bess"></my-component>
17648
+ *
17649
+ * @param inputs Input alias map that was generated from the directive def inputs.
17650
+ * @param directiveIndex Index of the directive that is currently being processed.
17651
+ * @param attrs Static attrs on this node.
17652
+ */
17653
+ function generateInitialInputs(inputs, directiveIndex, attrs) {
17654
+ let inputsToStore = null;
17655
+ let i = 0;
17656
+ while (i < attrs.length) {
17657
+ const attrName = attrs[i];
17658
+ if (attrName === 0 /* AttributeMarker.NamespaceURI */) {
17659
+ // We do not allow inputs on namespaced attributes.
17660
+ i += 4;
17661
+ continue;
17662
+ }
17663
+ else if (attrName === 5 /* AttributeMarker.ProjectAs */) {
17664
+ // Skip over the `ngProjectAs` value.
17665
+ i += 2;
17666
+ continue;
17667
+ }
17668
+ // If we hit any other attribute markers, we're done anyway. None of those are valid inputs.
17669
+ if (typeof attrName === 'number')
17670
+ break;
17671
+ if (inputs.hasOwnProperty(attrName)) {
17672
+ if (inputsToStore === null)
17673
+ inputsToStore = [];
17674
+ // Find the input's public name from the input store. Note that we can be found easier
17675
+ // through the directive def, but we want to do it using the inputs store so that it can
17676
+ // account for host directive aliases.
17677
+ const inputConfig = inputs[attrName];
17678
+ for (let j = 0; j < inputConfig.length; j += 3) {
17679
+ if (inputConfig[j] === directiveIndex) {
17680
+ inputsToStore.push(attrName, inputConfig[j + 1], inputConfig[j + 2], attrs[i + 1]);
17681
+ // A directive can't have multiple inputs with the same name so we can break here.
17682
+ break;
17683
+ }
17684
+ }
17685
+ }
17686
+ i += 2;
17687
+ }
17688
+ return inputsToStore;
17689
+ }
17690
+ /**
17691
+ * Setup directive for instantiation.
17692
+ *
17693
+ * We need to create a `NodeInjectorFactory` which is then inserted in both the `Blueprint` as well
17694
+ * as `LView`. `TView` gets the `DirectiveDef`.
17695
+ *
17696
+ * @param tView `TView`
17697
+ * @param tNode `TNode`
17698
+ * @param lView `LView`
17699
+ * @param directiveIndex Index where the directive will be stored in the Expando.
17700
+ * @param def `DirectiveDef`
17701
+ */
17702
+ function configureViewWithDirective(tView, tNode, lView, directiveIndex, def) {
17703
+ ngDevMode &&
17704
+ assertGreaterThanOrEqual(directiveIndex, HEADER_OFFSET, 'Must be in Expando section');
17705
+ tView.data[directiveIndex] = def;
17706
+ const directiveFactory = def.factory || (def.factory = getFactoryDef(def.type, true));
17707
+ // Even though `directiveFactory` will already be using `ɵɵdirectiveInject` in its generated code,
17708
+ // we also want to support `inject()` directly from the directive constructor context so we set
17709
+ // `ɵɵdirectiveInject` as the inject implementation here too.
17710
+ const nodeInjectorFactory = new NodeInjectorFactory(directiveFactory, isComponentDef(def), ɵɵdirectiveInject);
17711
+ tView.blueprint[directiveIndex] = nodeInjectorFactory;
17712
+ lView[directiveIndex] = nodeInjectorFactory;
17713
+ registerHostBindingOpCodes(tView, tNode, directiveIndex, allocExpando(tView, lView, def.hostVars, NO_CHANGE), def);
17714
+ }
17715
+ /**
17716
+ * Add `hostBindings` to the `TView.hostBindingOpCodes`.
17717
+ *
17718
+ * @param tView `TView` to which the `hostBindings` should be added.
17719
+ * @param tNode `TNode` the element which contains the directive
17720
+ * @param directiveIdx Directive index in view.
17721
+ * @param directiveVarsIdx Where will the directive's vars be stored
17722
+ * @param def `ComponentDef`/`DirectiveDef`, which contains the `hostVars`/`hostBindings` to add.
17723
+ */
17724
+ function registerHostBindingOpCodes(tView, tNode, directiveIdx, directiveVarsIdx, def) {
17725
+ ngDevMode && assertFirstCreatePass(tView);
17726
+ const hostBindings = def.hostBindings;
17727
+ if (hostBindings) {
17728
+ let hostBindingOpCodes = tView.hostBindingOpCodes;
17729
+ if (hostBindingOpCodes === null) {
17730
+ hostBindingOpCodes = tView.hostBindingOpCodes = [];
17731
+ }
17732
+ const elementIndx = ~tNode.index;
17733
+ if (lastSelectedElementIdx(hostBindingOpCodes) != elementIndx) {
17734
+ // Conditionally add select element so that we are more efficient in execution.
17735
+ // NOTE: this is strictly not necessary and it trades code size for runtime perf.
17736
+ // (We could just always add it.)
17737
+ hostBindingOpCodes.push(elementIndx);
17738
+ }
17739
+ hostBindingOpCodes.push(directiveIdx, directiveVarsIdx, hostBindings);
17740
+ }
17741
+ }
17742
+ /**
17743
+ * Returns the last selected element index in the `HostBindingOpCodes`
17744
+ *
17745
+ * For perf reasons we don't need to update the selected element index in `HostBindingOpCodes` only
17746
+ * if it changes. This method returns the last index (or '0' if not found.)
17747
+ *
17748
+ * Selected element index are only the ones which are negative.
17749
+ */
17750
+ function lastSelectedElementIdx(hostBindingOpCodes) {
17751
+ let i = hostBindingOpCodes.length;
17752
+ while (i > 0) {
17753
+ const value = hostBindingOpCodes[--i];
17754
+ if (typeof value === 'number' && value < 0) {
17755
+ return value;
17756
+ }
17757
+ }
17758
+ return 0;
17759
+ }
17760
+ /**
17761
+ * Builds up an export map as directives are created, so local refs can be quickly mapped
17762
+ * to their directive instances.
17763
+ */
17764
+ function saveNameToExportMap(directiveIdx, def, exportsMap) {
17765
+ if (exportsMap) {
17766
+ if (def.exportAs) {
17767
+ for (let i = 0; i < def.exportAs.length; i++) {
17768
+ exportsMap[def.exportAs[i]] = directiveIdx;
17769
+ }
17770
+ }
17771
+ if (isComponentDef(def))
17772
+ exportsMap[''] = directiveIdx;
17773
+ }
17774
+ }
17775
+ /**
17776
+ * Initializes the flags on the current node, setting all indices to the initial index,
17777
+ * the directive count to 0, and adding the isComponent flag.
17778
+ * @param index the initial index
17779
+ */
17780
+ function initTNodeFlags(tNode, index, numberOfDirectives) {
17781
+ ngDevMode &&
17782
+ assertNotEqual(numberOfDirectives, tNode.directiveEnd - tNode.directiveStart, 'Reached the max number of directives');
17783
+ tNode.flags |= 1 /* TNodeFlags.isDirectiveHost */;
17784
+ // When the first directive is created on a node, save the index
17785
+ tNode.directiveStart = index;
17786
+ tNode.directiveEnd = index + numberOfDirectives;
17787
+ tNode.providerIndexes = index;
17788
+ }
17789
+ function assertNoDuplicateDirectives(directives) {
17790
+ // The array needs at least two elements in order to have duplicates.
17791
+ if (directives.length < 2) {
17792
+ return;
17793
+ }
17794
+ const seenDirectives = new Set();
17795
+ for (const current of directives) {
17796
+ if (seenDirectives.has(current)) {
17797
+ throw new RuntimeError(309 /* RuntimeErrorCode.DUPLICATE_DIRECTIVE */, `Directive ${current.type.name} matches multiple times on the same element. ` +
17798
+ `Directives can only match an element once.`);
17799
+ }
17800
+ seenDirectives.add(current);
17801
+ }
17802
+ }
17803
+
17804
+ function elementStartFirstCreatePass(index, tView, lView, name, directiveMatcher, bindingsEnabled, attrsIndex, localRefsIndex) {
17805
+ ngDevMode && assertFirstCreatePass(tView);
17806
+ ngDevMode && ngDevMode.firstCreatePass++;
17807
+ const tViewConsts = tView.consts;
17808
+ const attrs = getConstant(tViewConsts, attrsIndex);
17809
+ const tNode = getOrCreateTNode(tView, index, 2 /* TNodeType.Element */, name, attrs);
17810
+ if (bindingsEnabled) {
17811
+ resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex), directiveMatcher);
17812
+ }
17813
+ // Merge the template attrs last so that they have the highest priority.
17814
+ tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, tNode.attrs);
17815
+ if (tNode.attrs !== null) {
17816
+ computeStaticStyling(tNode, tNode.attrs, false);
17817
+ }
17818
+ if (tNode.mergedAttrs !== null) {
17819
+ computeStaticStyling(tNode, tNode.mergedAttrs, true);
17820
+ }
17821
+ if (tView.queries !== null) {
17822
+ tView.queries.elementStart(tView, tNode);
17823
+ }
17824
+ return tNode;
17825
+ }
17826
+ function elementEndFirstCreatePass(tView, tNode) {
17827
+ ngDevMode && assertFirstCreatePass(tView);
17828
+ registerPostOrderHooks(tView, tNode);
17829
+ if (isContentQueryHost(tNode)) {
17830
+ tView.queries.elementEnd(tNode);
17831
+ }
17832
+ }
17833
+
17783
17834
  class ComponentFactoryResolver extends ComponentFactoryResolver$1 {
17784
17835
  ngModule;
17785
17836
  /**
@@ -17824,18 +17875,51 @@ function toRefArray(map, isInputMap) {
17824
17875
  }
17825
17876
  return array;
17826
17877
  }
17827
- function getNamespace(elementName) {
17828
- const name = elementName.toLowerCase();
17829
- return name === 'svg' ? SVG_NAMESPACE : name === 'math' ? MATH_ML_NAMESPACE : null;
17878
+ function verifyNotAnOrphanComponent(componentDef) {
17879
+ // TODO(pk): create assert that verifies ngDevMode
17880
+ if ((typeof ngJitMode === 'undefined' || ngJitMode) &&
17881
+ componentDef.debugInfo?.forbidOrphanRendering) {
17882
+ if (depsTracker.isOrphanComponent(componentDef.type)) {
17883
+ throw new RuntimeError(981 /* RuntimeErrorCode.RUNTIME_DEPS_ORPHAN_COMPONENT */, `Orphan component found! Trying to render the component ${debugStringifyTypeForError(componentDef.type)} without first loading the NgModule that declares it. It is recommended to make this component standalone in order to avoid this error. If this is not possible now, import the component's NgModule in the appropriate NgModule, or the standalone component in which you are trying to render this component. If this is a lazy import, load the NgModule lazily as well and use its module injector.`);
17884
+ }
17885
+ }
17886
+ }
17887
+ function createRootViewInjector(componentDef, environmentInjector, injector) {
17888
+ let realEnvironmentInjector = environmentInjector instanceof EnvironmentInjector
17889
+ ? environmentInjector
17890
+ : environmentInjector?.injector;
17891
+ if (realEnvironmentInjector && componentDef.getStandaloneInjector !== null) {
17892
+ realEnvironmentInjector =
17893
+ componentDef.getStandaloneInjector(realEnvironmentInjector) || realEnvironmentInjector;
17894
+ }
17895
+ const rootViewInjector = realEnvironmentInjector
17896
+ ? new ChainedInjector(injector, realEnvironmentInjector)
17897
+ : injector;
17898
+ return rootViewInjector;
17899
+ }
17900
+ function createRootLViewEnvironment(rootLViewInjector) {
17901
+ const rendererFactory = rootLViewInjector.get(RendererFactory2, null);
17902
+ if (rendererFactory === null) {
17903
+ throw new RuntimeError(407 /* RuntimeErrorCode.RENDERER_NOT_FOUND */, ngDevMode &&
17904
+ 'Angular was not able to inject a renderer (RendererFactory2). ' +
17905
+ 'Likely this is due to a broken DI hierarchy. ' +
17906
+ 'Make sure that any injector used to create this component has a correct parent.');
17907
+ }
17908
+ const sanitizer = rootLViewInjector.get(Sanitizer, null);
17909
+ const changeDetectionScheduler = rootLViewInjector.get(ChangeDetectionScheduler, null);
17910
+ return {
17911
+ rendererFactory,
17912
+ sanitizer,
17913
+ changeDetectionScheduler,
17914
+ };
17830
17915
  }
17831
- // TODO(pk): change the extractAttrsAndClassesFromSelector so it returns TAttributes already?
17832
- function getRootTAttributesFromSelector(selector) {
17833
- const { attrs, classes } = extractAttrsAndClassesFromSelector(selector);
17834
- const tAtts = attrs;
17835
- if (classes.length) {
17836
- tAtts.push(1 /* AttributeMarker.Classes */, ...classes);
17837
- }
17838
- return tAtts;
17916
+ function createHostElement(componentDef, render) {
17917
+ // Determine a tag name used for creating host elements when this component is created
17918
+ // dynamically. Default to 'div' if this component did not specify any tag name in its
17919
+ // selector.
17920
+ const tagName = (componentDef.selectors[0][0] || 'div').toLowerCase();
17921
+ const namespace = tagName === 'svg' ? SVG_NAMESPACE : tagName === 'math' ? MATH_ML_NAMESPACE : null;
17922
+ return createElementNode(render, tagName, namespace);
17839
17923
  }
17840
17924
  /**
17841
17925
  * ComponentFactory interface implementation.
@@ -17873,119 +17957,56 @@ class ComponentFactory extends ComponentFactory$1 {
17873
17957
  this.ngModule = ngModule;
17874
17958
  this.componentType = componentDef.type;
17875
17959
  this.selector = stringifyCSSSelectorList(componentDef.selectors);
17876
- this.ngContentSelectors = componentDef.ngContentSelectors
17877
- ? componentDef.ngContentSelectors
17878
- : [];
17960
+ this.ngContentSelectors = componentDef.ngContentSelectors ?? [];
17879
17961
  this.isBoundToModule = !!ngModule;
17880
17962
  }
17881
17963
  create(injector, projectableNodes, rootSelectorOrNode, environmentInjector) {
17882
17964
  profiler(22 /* ProfilerEvent.DynamicComponentStart */);
17883
17965
  const prevConsumer = setActiveConsumer$1(null);
17884
17966
  try {
17885
- // Check if the component is orphan
17886
- if (ngDevMode &&
17887
- (typeof ngJitMode === 'undefined' || ngJitMode) &&
17888
- this.componentDef.debugInfo?.forbidOrphanRendering) {
17889
- if (depsTracker.isOrphanComponent(this.componentType)) {
17890
- throw new RuntimeError(981 /* RuntimeErrorCode.RUNTIME_DEPS_ORPHAN_COMPONENT */, `Orphan component found! Trying to render the component ${debugStringifyTypeForError(this.componentType)} without first loading the NgModule that declares it. It is recommended to make this component standalone in order to avoid this error. If this is not possible now, import the component's NgModule in the appropriate NgModule, or the standalone component in which you are trying to render this component. If this is a lazy import, load the NgModule lazily as well and use its module injector.`);
17891
- }
17892
- }
17893
- environmentInjector = environmentInjector || this.ngModule;
17894
- let realEnvironmentInjector = environmentInjector instanceof EnvironmentInjector
17895
- ? environmentInjector
17896
- : environmentInjector?.injector;
17897
- if (realEnvironmentInjector && this.componentDef.getStandaloneInjector !== null) {
17898
- realEnvironmentInjector =
17899
- this.componentDef.getStandaloneInjector(realEnvironmentInjector) ||
17900
- realEnvironmentInjector;
17901
- }
17902
- const rootViewInjector = realEnvironmentInjector
17903
- ? new ChainedInjector(injector, realEnvironmentInjector)
17904
- : injector;
17905
- const rendererFactory = rootViewInjector.get(RendererFactory2, null);
17906
- if (rendererFactory === null) {
17907
- throw new RuntimeError(407 /* RuntimeErrorCode.RENDERER_NOT_FOUND */, ngDevMode &&
17908
- 'Angular was not able to inject a renderer (RendererFactory2). ' +
17909
- 'Likely this is due to a broken DI hierarchy. ' +
17910
- 'Make sure that any injector used to create this component has a correct parent.');
17911
- }
17912
- const sanitizer = rootViewInjector.get(Sanitizer, null);
17913
- const changeDetectionScheduler = rootViewInjector.get(ChangeDetectionScheduler, null);
17914
- const environment = {
17915
- rendererFactory,
17916
- sanitizer,
17917
- changeDetectionScheduler,
17918
- };
17919
- const hostRenderer = rendererFactory.createRenderer(null, this.componentDef);
17920
- // Determine a tag name used for creating host elements when this component is created
17921
- // dynamically. Default to 'div' if this component did not specify any tag name in its
17922
- // selector.
17923
- const elementName = this.componentDef.selectors[0][0] || 'div';
17924
- const hostRNode = rootSelectorOrNode
17925
- ? locateHostElement(hostRenderer, rootSelectorOrNode, this.componentDef.encapsulation, rootViewInjector)
17926
- : createElementNode(hostRenderer, elementName, getNamespace(elementName));
17927
- let rootFlags = 512 /* LViewFlags.IsRoot */;
17928
- if (this.componentDef.signals) {
17929
- rootFlags |= 4096 /* LViewFlags.SignalView */;
17930
- }
17931
- else if (!this.componentDef.onPush) {
17932
- rootFlags |= 16 /* LViewFlags.CheckAlways */;
17933
- }
17934
- let hydrationInfo = null;
17935
- if (hostRNode !== null) {
17936
- hydrationInfo = retrieveHydrationInfo(hostRNode, rootViewInjector, true /* isRootView */);
17937
- }
17967
+ const cmpDef = this.componentDef;
17968
+ ngDevMode && verifyNotAnOrphanComponent(cmpDef);
17969
+ const tAttributes = rootSelectorOrNode
17970
+ ? ['ng-version', '19.2.0-next.2']
17971
+ : // Extract attributes and classes from the first selector only to match VE behavior.
17972
+ extractAttrsAndClassesFromSelector(this.componentDef.selectors[0]);
17938
17973
  // Create the root view. Uses empty TView and ContentTemplate.
17939
- const rootTView = createTView(0 /* TViewType.Root */, null, null, 1, 0, null, null, null, null, null, null);
17940
- const rootLView = createLView(null, rootTView, null, rootFlags, null, null, environment, hostRenderer, rootViewInjector, null, hydrationInfo);
17941
- rootLView[HEADER_OFFSET] = hostRNode;
17974
+ const rootTView = createTView(0 /* TViewType.Root */, null, null, 1, 0, null, null, null, null, [tAttributes], null);
17975
+ const rootViewInjector = createRootViewInjector(cmpDef, environmentInjector || this.ngModule, injector);
17976
+ const environment = createRootLViewEnvironment(rootViewInjector);
17977
+ const hostRenderer = environment.rendererFactory.createRenderer(null, cmpDef);
17978
+ const hostElement = rootSelectorOrNode
17979
+ ? locateHostElement(hostRenderer, rootSelectorOrNode, cmpDef.encapsulation, rootViewInjector)
17980
+ : createHostElement(cmpDef, hostRenderer);
17981
+ const rootLView = createLView(null, rootTView, null, 512 /* LViewFlags.IsRoot */ | getInitialLViewFlagsFromDef(cmpDef), null, null, environment, hostRenderer, rootViewInjector, null, retrieveHydrationInfo(hostElement, rootViewInjector, true /* isRootView */));
17982
+ rootLView[HEADER_OFFSET] = hostElement;
17942
17983
  // rootView is the parent when bootstrapping
17943
17984
  // TODO(misko): it looks like we are entering view here but we don't really need to as
17944
17985
  // `renderView` does that. However as the code is written it is needed because
17945
17986
  // `createRootComponentView` and `createRootComponent` both read global state. Fixing those
17946
17987
  // issues would allow us to drop this.
17947
17988
  enterView(rootLView);
17948
- let component;
17949
17989
  let componentView = null;
17950
17990
  try {
17951
- const rootComponentDef = this.componentDef;
17952
- let rootDirectives;
17953
- let hostDirectiveDefs = null;
17954
- if (rootComponentDef.findHostDirectiveDefs) {
17955
- rootDirectives = [];
17956
- hostDirectiveDefs = new Map();
17957
- rootComponentDef.findHostDirectiveDefs(rootComponentDef, rootDirectives, hostDirectiveDefs);
17958
- rootDirectives.push(rootComponentDef);
17959
- ngDevMode && assertNoDuplicateDirectives(rootDirectives);
17960
- }
17961
- else {
17962
- rootDirectives = [rootComponentDef];
17963
- }
17964
- // If host dom element is created (instead of being provided as part of the dynamic component creation), also apply attributes and classes extracted from component selector.
17965
- const tAttributes = rootSelectorOrNode
17966
- ? ['ng-version', '19.2.0-next.0']
17967
- : // Extract attributes and classes from the first selector only to match VE behavior.
17968
- getRootTAttributesFromSelector(this.componentDef.selectors[0]);
17969
- // TODO: this logic is shared with the element instruction first create pass
17970
- const hostTNode = getOrCreateTNode(rootTView, HEADER_OFFSET, 2 /* TNodeType.Element */, '#host', tAttributes);
17971
- for (const def of rootDirectives) {
17972
- hostTNode.mergedAttrs = mergeHostAttrs(hostTNode.mergedAttrs, def.hostAttrs);
17973
- }
17974
- hostTNode.mergedAttrs = mergeHostAttrs(hostTNode.mergedAttrs, tAttributes);
17975
- computeStaticStyling(hostTNode, hostTNode.mergedAttrs, true);
17991
+ const hostTNode = elementStartFirstCreatePass(HEADER_OFFSET, rootTView, rootLView, '#host', () => [this.componentDef], true, 0);
17992
+ // ---- element instruction
17976
17993
  // TODO(crisbeto): in practice `hostRNode` should always be defined, but there are some
17977
17994
  // tests where the renderer is mocked out and `undefined` is returned. We should update the
17978
17995
  // tests so that this check can be removed.
17979
- if (hostRNode) {
17980
- setupStaticAttributes(hostRenderer, hostRNode, hostTNode);
17996
+ if (hostElement) {
17997
+ setupStaticAttributes(hostRenderer, hostElement, hostTNode);
17998
+ attachPatchData(hostElement, rootLView);
17981
17999
  }
17982
- componentView = createRootComponentView(hostTNode, hostRNode, rootComponentDef, rootDirectives, rootLView, environment);
18000
+ // TODO(pk): this logic is similar to the instruction code where a node can have directives
18001
+ createDirectivesInstances(rootTView, rootLView, hostTNode);
18002
+ executeContentQueries(rootTView, hostTNode, rootLView);
18003
+ elementEndFirstCreatePass(rootTView, hostTNode);
17983
18004
  if (projectableNodes !== undefined) {
17984
18005
  projectNodes(hostTNode, this.ngContentSelectors, projectableNodes);
17985
18006
  }
17986
- // TODO: should LifecycleHooksFeature and other host features be generated by the compiler
17987
- // and executed here? Angular 5 reference: https://stackblitz.com/edit/lifecycle-hooks-vcref
17988
- component = createRootComponent(componentView, rootComponentDef, rootDirectives, hostDirectiveDefs, rootLView, [LifecycleHooksFeature]);
18007
+ componentView = getComponentLViewByIndex(hostTNode.index, rootLView);
18008
+ // TODO(pk): why do we need this logic?
18009
+ rootLView[CONTEXT] = componentView[CONTEXT];
17989
18010
  renderView(rootTView, rootLView, null);
17990
18011
  }
17991
18012
  catch (e) {
@@ -18001,8 +18022,7 @@ class ComponentFactory extends ComponentFactory$1 {
18001
18022
  profiler(23 /* ProfilerEvent.DynamicComponentEnd */);
18002
18023
  leaveView();
18003
18024
  }
18004
- const hostTNode = getTNode(rootTView, HEADER_OFFSET);
18005
- return new ComponentRef(this.componentType, component, createElementRef(hostTNode, rootLView), rootLView, hostTNode);
18025
+ return new ComponentRef(this.componentType, rootLView);
18006
18026
  }
18007
18027
  finally {
18008
18028
  setActiveConsumer$1(prevConsumer);
@@ -18018,20 +18038,20 @@ class ComponentFactory extends ComponentFactory$1 {
18018
18038
  *
18019
18039
  */
18020
18040
  class ComponentRef extends ComponentRef$1 {
18021
- location;
18022
18041
  _rootLView;
18023
- _tNode;
18024
18042
  instance;
18025
18043
  hostView;
18026
18044
  changeDetectorRef;
18027
18045
  componentType;
18046
+ location;
18028
18047
  previousInputValues = null;
18029
- constructor(componentType, instance, location, _rootLView, _tNode) {
18048
+ _tNode;
18049
+ constructor(componentType, _rootLView) {
18030
18050
  super();
18031
- this.location = location;
18032
18051
  this._rootLView = _rootLView;
18033
- this._tNode = _tNode;
18034
- this.instance = instance;
18052
+ this._tNode = getTNode(_rootLView[TVIEW], HEADER_OFFSET);
18053
+ this.location = createElementRef(this._tNode, _rootLView);
18054
+ this.instance = getComponentLViewByIndex(this._tNode.index, _rootLView)[CONTEXT];
18035
18055
  this.hostView = this.changeDetectorRef = new ViewRef$1(_rootLView, undefined /* _cdRefInjectingView */, false /* notifyErrorHandler */);
18036
18056
  this.componentType = componentType;
18037
18057
  }
@@ -18071,70 +18091,6 @@ class ComponentRef extends ComponentRef$1 {
18071
18091
  this.hostView.onDestroy(callback);
18072
18092
  }
18073
18093
  }
18074
- /**
18075
- * Creates the root component view and the root component node.
18076
- *
18077
- * @param hostRNode Render host element.
18078
- * @param rootComponentDef ComponentDef
18079
- * @param rootView The parent view where the host node is stored
18080
- * @param rendererFactory Factory to be used for creating child renderers.
18081
- * @param hostRenderer The current renderer
18082
- * @param sanitizer The sanitizer, if provided
18083
- *
18084
- * @returns Component view created
18085
- */
18086
- function createRootComponentView(tNode, hostRNode, rootComponentDef, rootDirectives, rootView, environment) {
18087
- const tView = rootView[TVIEW];
18088
- // Hydration info is on the host element and needs to be retrieved
18089
- // and passed to the component LView.
18090
- let hydrationInfo = null;
18091
- if (hostRNode !== null) {
18092
- hydrationInfo = retrieveHydrationInfo(hostRNode, rootView[INJECTOR]);
18093
- }
18094
- const viewRenderer = environment.rendererFactory.createRenderer(hostRNode, rootComponentDef);
18095
- const componentView = createLView(rootView, getOrCreateComponentTView(rootComponentDef), null, getInitialLViewFlagsFromDef(rootComponentDef), rootView[tNode.index], tNode, environment, viewRenderer, null, null, hydrationInfo);
18096
- if (tView.firstCreatePass) {
18097
- markAsComponentHost(tView, tNode, rootDirectives.length - 1);
18098
- }
18099
- addToEndOfViewTree(rootView, componentView);
18100
- // Store component view at node index, with node as the HOST
18101
- return (rootView[tNode.index] = componentView);
18102
- }
18103
- /**
18104
- * Creates a root component and sets it up with features and host bindings.Shared by
18105
- * renderComponent() and ViewContainerRef.createComponent().
18106
- */
18107
- function createRootComponent(componentView, rootComponentDef, rootDirectives, hostDirectiveDefs, rootLView, hostFeatures) {
18108
- const rootTNode = getCurrentTNode();
18109
- ngDevMode && assertDefined(rootTNode, 'tNode should have been already created');
18110
- const tView = rootLView[TVIEW];
18111
- const native = getNativeByTNode(rootTNode, rootLView);
18112
- initializeDirectives(tView, rootLView, rootTNode, rootDirectives, null, hostDirectiveDefs);
18113
- for (let i = 0; i < rootDirectives.length; i++) {
18114
- const directiveIndex = rootTNode.directiveStart + i;
18115
- const directiveInstance = getNodeInjectable(rootLView, tView, directiveIndex, rootTNode);
18116
- attachPatchData(directiveInstance, rootLView);
18117
- }
18118
- invokeDirectivesHostBindings(tView, rootLView, rootTNode);
18119
- if (native) {
18120
- attachPatchData(native, rootLView);
18121
- }
18122
- // We're guaranteed for the `componentOffset` to be positive here
18123
- // since a root component always matches a component def.
18124
- ngDevMode &&
18125
- assertGreaterThan(rootTNode.componentOffset, -1, 'componentOffset must be great than -1');
18126
- const component = getNodeInjectable(rootLView, tView, rootTNode.directiveStart + rootTNode.componentOffset, rootTNode);
18127
- componentView[CONTEXT] = rootLView[CONTEXT] = component;
18128
- if (hostFeatures !== null) {
18129
- for (const feature of hostFeatures) {
18130
- feature(component, rootComponentDef);
18131
- }
18132
- }
18133
- // We want to generate an empty QueryList for root content queries for backwards
18134
- // compatibility with ViewEngine.
18135
- executeContentQueries(tView, rootTNode, rootLView);
18136
- return component;
18137
- }
18138
18094
  /** Projects the `projectableNodes` that were specified when creating a root component. */
18139
18095
  function projectNodes(tNode, ngContentSelectors, projectableNodes) {
18140
18096
  const projection = (tNode.projection = []);
@@ -18148,24 +18104,6 @@ function projectNodes(tNode, ngContentSelectors, projectableNodes) {
18148
18104
  projection.push(nodesforSlot != null && nodesforSlot.length ? Array.from(nodesforSlot) : null);
18149
18105
  }
18150
18106
  }
18151
- /**
18152
- * Used to enable lifecycle hooks on the root component.
18153
- *
18154
- * Include this feature when calling `renderComponent` if the root component
18155
- * you are rendering has lifecycle hooks defined. Otherwise, the hooks won't
18156
- * be called properly.
18157
- *
18158
- * Example:
18159
- *
18160
- * ```ts
18161
- * renderComponent(AppComponent, {hostFeatures: [LifecycleHooksFeature]});
18162
- * ```
18163
- */
18164
- function LifecycleHooksFeature() {
18165
- const tNode = getCurrentTNode();
18166
- ngDevMode && assertDefined(tNode, 'TNode is required');
18167
- registerPostOrderHooks(getLView()[TVIEW], tNode);
18168
- }
18169
18107
 
18170
18108
  /**
18171
18109
  * Represents a container where one or more views can be attached to a component.
@@ -20675,22 +20613,17 @@ function bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4) {
20675
20613
  return bindingUpdated2(lView, bindingIndex + 2, exp3, exp4) || different;
20676
20614
  }
20677
20615
 
20678
- /**
20679
- * Checks whether a TNode is considered detached, i.e. not present in the
20680
- * translated i18n template. We should not attempt hydration for such nodes
20681
- * and instead, use a regular "creation mode".
20682
- */
20683
- function isDetachedByI18n(tNode) {
20684
- return (tNode.flags & 32 /* TNodeFlags.isDetached */) === 32 /* TNodeFlags.isDetached */;
20685
- }
20686
-
20687
20616
  function templateFirstCreatePass(index, tView, lView, templateFn, decls, vars, tagName, attrs, localRefsIndex) {
20688
20617
  ngDevMode && assertFirstCreatePass(tView);
20689
20618
  ngDevMode && ngDevMode.firstCreatePass++;
20690
20619
  const tViewConsts = tView.consts;
20691
20620
  // TODO(pk): refactor getOrCreateTNode to have the "create" only version
20692
20621
  const tNode = getOrCreateTNode(tView, index, 4 /* TNodeType.Container */, tagName || null, attrs || null);
20693
- resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex));
20622
+ if (getBindingsEnabled()) {
20623
+ resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex), findDirectiveDefMatches);
20624
+ }
20625
+ // Merge the template attrs last so that they have the highest priority.
20626
+ tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, tNode.attrs);
20694
20627
  registerPostOrderHooks(tView, tNode);
20695
20628
  const embeddedTView = (tNode.tView = createTView(2 /* TViewType.Embedded */, tNode, templateFn, decls, vars, tView.directiveRegistry, tView.pipeRegistry, null, tView.schemas, tViewConsts, null /* ssrId */));
20696
20629
  if (tView.queries !== null) {
@@ -20733,7 +20666,7 @@ function declareTemplate(declarationLView, declarationTView, index, templateFn,
20733
20666
  // In client-only mode, this function is a noop.
20734
20667
  populateDehydratedViewsInLContainer(lContainer, tNode, declarationLView);
20735
20668
  if (isDirectiveHost(tNode)) {
20736
- createDirectivesInstances(declarationTView, declarationLView, tNode);
20669
+ createDirectivesInstancesInInstruction(declarationTView, declarationLView, tNode);
20737
20670
  }
20738
20671
  if (localRefsIndex != null) {
20739
20672
  saveResolvedLocalsInData(declarationLView, tNode, localRefExtractor);
@@ -22993,6 +22926,77 @@ function setTestabilityGetter(getter) {
22993
22926
  }
22994
22927
  let _testabilityGetter;
22995
22928
 
22929
+ /**
22930
+ * A scheduler which manages the execution of effects.
22931
+ */
22932
+ class EffectScheduler {
22933
+ /** @nocollapse */
22934
+ static ɵprov = /** @pureOrBreakMyCode */ /* @__PURE__ */ ɵɵdefineInjectable({
22935
+ token: EffectScheduler,
22936
+ providedIn: 'root',
22937
+ factory: () => new ZoneAwareEffectScheduler(),
22938
+ });
22939
+ }
22940
+ /**
22941
+ * A wrapper around `ZoneAwareQueueingScheduler` that schedules flushing via the microtask queue
22942
+ * when.
22943
+ */
22944
+ class ZoneAwareEffectScheduler {
22945
+ queuedEffectCount = 0;
22946
+ queues = new Map();
22947
+ schedule(handle) {
22948
+ this.enqueue(handle);
22949
+ }
22950
+ remove(handle) {
22951
+ const zone = handle.zone;
22952
+ const queue = this.queues.get(zone);
22953
+ if (!queue.has(handle)) {
22954
+ return;
22955
+ }
22956
+ queue.delete(handle);
22957
+ this.queuedEffectCount--;
22958
+ }
22959
+ enqueue(handle) {
22960
+ const zone = handle.zone;
22961
+ if (!this.queues.has(zone)) {
22962
+ this.queues.set(zone, new Set());
22963
+ }
22964
+ const queue = this.queues.get(zone);
22965
+ if (queue.has(handle)) {
22966
+ return;
22967
+ }
22968
+ this.queuedEffectCount++;
22969
+ queue.add(handle);
22970
+ }
22971
+ /**
22972
+ * Run all scheduled effects.
22973
+ *
22974
+ * Execution order of effects within the same zone is guaranteed to be FIFO, but there is no
22975
+ * ordering guarantee between effects scheduled in different zones.
22976
+ */
22977
+ flush() {
22978
+ while (this.queuedEffectCount > 0) {
22979
+ for (const [zone, queue] of this.queues) {
22980
+ // `zone` here must be defined.
22981
+ if (zone === null) {
22982
+ this.flushQueue(queue);
22983
+ }
22984
+ else {
22985
+ zone.run(() => this.flushQueue(queue));
22986
+ }
22987
+ }
22988
+ }
22989
+ }
22990
+ flushQueue(queue) {
22991
+ for (const handle of queue) {
22992
+ queue.delete(handle);
22993
+ this.queuedEffectCount--;
22994
+ // TODO: what happens if this throws an error?
22995
+ handle.run();
22996
+ }
22997
+ }
22998
+ }
22999
+
22996
23000
  /**
22997
23001
  * Determine if the argument is shaped like a Promise
22998
23002
  */
@@ -23252,77 +23256,6 @@ class ApplicationInitStatus {
23252
23256
  args: [{ providedIn: 'root' }]
23253
23257
  }], () => [], null); })();
23254
23258
 
23255
- /**
23256
- * A scheduler which manages the execution of effects.
23257
- */
23258
- class EffectScheduler {
23259
- /** @nocollapse */
23260
- static ɵprov = /** @pureOrBreakMyCode */ /* @__PURE__ */ ɵɵdefineInjectable({
23261
- token: EffectScheduler,
23262
- providedIn: 'root',
23263
- factory: () => new ZoneAwareEffectScheduler(),
23264
- });
23265
- }
23266
- /**
23267
- * A wrapper around `ZoneAwareQueueingScheduler` that schedules flushing via the microtask queue
23268
- * when.
23269
- */
23270
- class ZoneAwareEffectScheduler {
23271
- queuedEffectCount = 0;
23272
- queues = new Map();
23273
- schedule(handle) {
23274
- this.enqueue(handle);
23275
- }
23276
- remove(handle) {
23277
- const zone = handle.zone;
23278
- const queue = this.queues.get(zone);
23279
- if (!queue.has(handle)) {
23280
- return;
23281
- }
23282
- queue.delete(handle);
23283
- this.queuedEffectCount--;
23284
- }
23285
- enqueue(handle) {
23286
- const zone = handle.zone;
23287
- if (!this.queues.has(zone)) {
23288
- this.queues.set(zone, new Set());
23289
- }
23290
- const queue = this.queues.get(zone);
23291
- if (queue.has(handle)) {
23292
- return;
23293
- }
23294
- this.queuedEffectCount++;
23295
- queue.add(handle);
23296
- }
23297
- /**
23298
- * Run all scheduled effects.
23299
- *
23300
- * Execution order of effects within the same zone is guaranteed to be FIFO, but there is no
23301
- * ordering guarantee between effects scheduled in different zones.
23302
- */
23303
- flush() {
23304
- while (this.queuedEffectCount > 0) {
23305
- for (const [zone, queue] of this.queues) {
23306
- // `zone` here must be defined.
23307
- if (zone === null) {
23308
- this.flushQueue(queue);
23309
- }
23310
- else {
23311
- zone.run(() => this.flushQueue(queue));
23312
- }
23313
- }
23314
- }
23315
- }
23316
- flushQueue(queue) {
23317
- for (const handle of queue) {
23318
- queue.delete(handle);
23319
- this.queuedEffectCount--;
23320
- // TODO: what happens if this throws an error?
23321
- handle.run();
23322
- }
23323
- }
23324
- }
23325
-
23326
23259
  /**
23327
23260
  * A DI token that provides a set of callbacks to
23328
23261
  * be called for every component that is bootstrapped.
@@ -23364,24 +23297,6 @@ class NgProbeToken {
23364
23297
  }
23365
23298
  /** Maximum number of times ApplicationRef will refresh all attached views in a single tick. */
23366
23299
  const MAXIMUM_REFRESH_RERUNS = 10;
23367
- function _callAndReportToErrorHandler(errorHandler, ngZone, callback) {
23368
- try {
23369
- const result = callback();
23370
- if (isPromise(result)) {
23371
- return result.catch((e) => {
23372
- ngZone.runOutsideAngular(() => errorHandler.handleError(e));
23373
- // rethrow as the exception handler might not do it
23374
- throw e;
23375
- });
23376
- }
23377
- return result;
23378
- }
23379
- catch (e) {
23380
- ngZone.runOutsideAngular(() => errorHandler.handleError(e));
23381
- // rethrow as the exception handler might not do it
23382
- throw e;
23383
- }
23384
- }
23385
23300
  function optionsReducer(dst, objs) {
23386
23301
  if (Array.isArray(objs)) {
23387
23302
  return objs.reduce(optionsReducer, dst);
@@ -23671,18 +23586,19 @@ class ApplicationRef {
23671
23586
  this._tick();
23672
23587
  }
23673
23588
  /** @internal */
23674
- _tick = () => {
23589
+ _tick() {
23675
23590
  profiler(12 /* ProfilerEvent.ChangeDetectionStart */);
23676
23591
  if (this.tracingSnapshot !== null) {
23677
- const snapshot = this.tracingSnapshot;
23678
- this.tracingSnapshot = null;
23679
- // Ensure we always run `_tick()` in the context of the most recent snapshot,
23592
+ // Ensure we always run `tickImpl()` in the context of the most recent snapshot,
23680
23593
  // if one exists. Snapshots may be reference counted by the implementation so
23681
23594
  // we want to ensure that if we request a snapshot that we use it.
23682
- snapshot.run(TracingAction.CHANGE_DETECTION, this._tick);
23683
- snapshot.dispose();
23684
- return;
23595
+ this.tracingSnapshot.run(TracingAction.CHANGE_DETECTION, this.tickImpl);
23685
23596
  }
23597
+ else {
23598
+ this.tickImpl();
23599
+ }
23600
+ }
23601
+ tickImpl = () => {
23686
23602
  (typeof ngDevMode === 'undefined' || ngDevMode) && warnIfDestroyed(this._destroyed);
23687
23603
  if (this._runningTick) {
23688
23604
  throw new RuntimeError(101 /* RuntimeErrorCode.RECURSIVE_APPLICATION_REF_TICK */, ngDevMode && 'ApplicationRef.tick is called recursively');
@@ -23703,6 +23619,8 @@ class ApplicationRef {
23703
23619
  }
23704
23620
  finally {
23705
23621
  this._runningTick = false;
23622
+ this.tracingSnapshot?.dispose();
23623
+ this.tracingSnapshot = null;
23706
23624
  setActiveConsumer$1(prevConsumer);
23707
23625
  this.afterTick.next();
23708
23626
  profiler(13 /* ProfilerEvent.ChangeDetectionEnd */);
@@ -28074,24 +27992,6 @@ function getExistingTNode(tView, index) {
28074
27992
  return tNode;
28075
27993
  }
28076
27994
 
28077
- function elementStartFirstCreatePass(index, tView, lView, name, attrsIndex, localRefsIndex) {
28078
- ngDevMode && assertFirstCreatePass(tView);
28079
- ngDevMode && ngDevMode.firstCreatePass++;
28080
- const tViewConsts = tView.consts;
28081
- const attrs = getConstant(tViewConsts, attrsIndex);
28082
- const tNode = getOrCreateTNode(tView, index, 2 /* TNodeType.Element */, name, attrs);
28083
- resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex));
28084
- if (tNode.attrs !== null) {
28085
- computeStaticStyling(tNode, tNode.attrs, false);
28086
- }
28087
- if (tNode.mergedAttrs !== null) {
28088
- computeStaticStyling(tNode, tNode.mergedAttrs, true);
28089
- }
28090
- if (tView.queries !== null) {
28091
- tView.queries.elementStart(tView, tNode);
28092
- }
28093
- return tNode;
28094
- }
28095
27995
  /**
28096
27996
  * Create DOM element. The instruction must later be followed by `elementEnd()` call.
28097
27997
  *
@@ -28116,7 +28016,7 @@ function ɵɵelementStart(index, name, attrsIndex, localRefsIndex) {
28116
28016
  ngDevMode && assertIndexInRange(lView, adjustedIndex);
28117
28017
  const renderer = lView[RENDERER];
28118
28018
  const tNode = tView.firstCreatePass
28119
- ? elementStartFirstCreatePass(adjustedIndex, tView, lView, name, attrsIndex, localRefsIndex)
28019
+ ? elementStartFirstCreatePass(adjustedIndex, tView, lView, name, findDirectiveDefMatches, getBindingsEnabled(), attrsIndex, localRefsIndex)
28120
28020
  : tView.data[adjustedIndex];
28121
28021
  const native = _locateOrCreateElementNode(tView, lView, tNode, renderer, name, index);
28122
28022
  lView[adjustedIndex] = native;
@@ -28139,7 +28039,7 @@ function ɵɵelementStart(index, name, attrsIndex, localRefsIndex) {
28139
28039
  }
28140
28040
  increaseElementDepthCount();
28141
28041
  if (hasDirectives) {
28142
- createDirectivesInstances(tView, lView, tNode);
28042
+ createDirectivesInstancesInInstruction(tView, lView, tNode);
28143
28043
  executeContentQueries(tView, tNode, lView);
28144
28044
  }
28145
28045
  if (localRefsIndex !== null) {
@@ -28172,10 +28072,7 @@ function ɵɵelementEnd() {
28172
28072
  decreaseElementDepthCount();
28173
28073
  const tView = getTView();
28174
28074
  if (tView.firstCreatePass) {
28175
- registerPostOrderHooks(tView, currentTNode);
28176
- if (isContentQueryHost(currentTNode)) {
28177
- tView.queries.elementEnd(currentTNode);
28178
- }
28075
+ elementEndFirstCreatePass(tView, tNode);
28179
28076
  }
28180
28077
  if (tNode.classesWithoutHost != null && hasClassInput(tNode)) {
28181
28078
  setDirectiveInputsWhichShadowsStyling(tView, tNode, getLView(), tNode.classesWithoutHost, true);
@@ -28203,7 +28100,7 @@ function ɵɵelement(index, name, attrsIndex, localRefsIndex) {
28203
28100
  }
28204
28101
  let _locateOrCreateElementNode = (tView, lView, tNode, renderer, name, index) => {
28205
28102
  lastNodeWasCreated(true);
28206
- return createElementNode(renderer, name, getNamespace$1());
28103
+ return createElementNode(renderer, name, getNamespace());
28207
28104
  };
28208
28105
  /**
28209
28106
  * Enables hydration code path (to lookup existing elements in DOM)
@@ -28218,7 +28115,7 @@ function locateOrCreateElementNodeImpl(tView, lView, tNode, renderer, name, inde
28218
28115
  lastNodeWasCreated(isNodeCreationMode);
28219
28116
  // Regular creation mode.
28220
28117
  if (isNodeCreationMode) {
28221
- return createElementNode(renderer, name, getNamespace$1());
28118
+ return createElementNode(renderer, name, getNamespace());
28222
28119
  }
28223
28120
  // Hydration mode, looking up an existing element in DOM.
28224
28121
  const native = locateNextRNode(hydrationInfo, tView, lView, tNode);
@@ -28271,7 +28168,11 @@ function elementContainerStartFirstCreatePass(index, tView, lView, attrsIndex, l
28271
28168
  computeStaticStyling(tNode, attrs, true);
28272
28169
  }
28273
28170
  const localRefs = getConstant(tViewConsts, localRefsIndex);
28274
- resolveDirectives(tView, lView, tNode, localRefs);
28171
+ if (getBindingsEnabled()) {
28172
+ resolveDirectives(tView, lView, tNode, localRefs, findDirectiveDefMatches);
28173
+ }
28174
+ // Merge the template attrs last so that they have the highest priority.
28175
+ tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, tNode.attrs);
28275
28176
  if (tView.queries !== null) {
28276
28177
  tView.queries.elementStart(tView, tNode);
28277
28178
  }
@@ -28310,7 +28211,7 @@ function ɵɵelementContainerStart(index, attrsIndex, localRefsIndex) {
28310
28211
  }
28311
28212
  attachPatchData(comment, lView);
28312
28213
  if (isDirectiveHost(tNode)) {
28313
- createDirectivesInstances(tView, lView, tNode);
28214
+ createDirectivesInstancesInInstruction(tView, lView, tNode);
28314
28215
  executeContentQueries(tView, tNode, lView);
28315
28216
  }
28316
28217
  if (localRefsIndex != null) {
@@ -30490,7 +30391,7 @@ function wrapListener(tNode, lView, context, listenerFn) {
30490
30391
  }
30491
30392
  // In order to be backwards compatible with View Engine, events on component host nodes
30492
30393
  // must also mark the component view itself dirty (i.e. the view that it owns).
30493
- const startView = tNode.componentOffset > -1 ? getComponentLViewByIndex(tNode.index, lView) : lView;
30394
+ const startView = isComponentHost(tNode) ? getComponentLViewByIndex(tNode.index, lView) : lView;
30494
30395
  markViewDirty(startView, 5 /* NotificationSource.Listener */);
30495
30396
  let result = executeListenerWithErrorHandling(lView, context, listenerFn, e);
30496
30397
  // A just-invoked listener function might have coalesced listeners so we need to check for
@@ -30654,8 +30555,7 @@ function ɵɵprojection(nodeIndex, selectorIndex = 0, attrs, fallbackTemplateFn,
30654
30555
  if (isEmpty && fallbackIndex !== null) {
30655
30556
  insertFallbackContent(lView, tView, fallbackIndex);
30656
30557
  }
30657
- else if (isNodeCreationMode &&
30658
- (tProjectionNode.flags & 32 /* TNodeFlags.isDetached */) !== 32 /* TNodeFlags.isDetached */) {
30558
+ else if (isNodeCreationMode && !isDetachedByI18n(tProjectionNode)) {
30659
30559
  // re-distribution of projectable nodes is stored on a component's view level
30660
30560
  applyProjection(tView, lView, tProjectionNode);
30661
30561
  }
@@ -33456,7 +33356,7 @@ function ɵɵreplaceMetadata(type, applyMetadata, namespaces, locals) {
33456
33356
  for (const root of trackedViews) {
33457
33357
  // Note: we have the additional check, because `IsRoot` can also indicate
33458
33358
  // a component created through something like `createComponent`.
33459
- if (root[FLAGS] & 512 /* LViewFlags.IsRoot */ && root[PARENT] === null) {
33359
+ if (isRootView(root) && root[PARENT] === null) {
33460
33360
  recreateMatchingLViews(newDef, oldDef, root);
33461
33361
  }
33462
33362
  }
@@ -33483,6 +33383,10 @@ function mergeWithExistingDefinition(currentDef, newDef) {
33483
33383
  // Preserve the old `setInput` function, because it has some state.
33484
33384
  // This is fine, because the component instance is preserved as well.
33485
33385
  setInput: clone.setInput,
33386
+ // Externally this is redundant since we redeclare the definition using the original type.
33387
+ // Internally we may receive a definition with an alternate, but identical, type so we have
33388
+ // to ensure that the original one is preserved.
33389
+ type: clone.type,
33486
33390
  });
33487
33391
  ngDevMode && assertEqual(replacement, currentDef, 'Expected definition to be merged in place');
33488
33392
  return { newDef: replacement, oldDef: clone };
@@ -35021,7 +34925,7 @@ class Version {
35021
34925
  /**
35022
34926
  * @publicApi
35023
34927
  */
35024
- const VERSION = new Version('19.2.0-next.0');
34928
+ const VERSION = new Version('19.2.0-next.2');
35025
34929
 
35026
34930
  /**
35027
34931
  * Combination of NgModuleFactory and ComponentFactories.
@@ -36170,6 +36074,24 @@ function moduleDoBootstrap(moduleRef, allPlatformModules) {
36170
36074
  }
36171
36075
  allPlatformModules.push(moduleRef);
36172
36076
  }
36077
+ function _callAndReportToErrorHandler(errorHandler, ngZone, callback) {
36078
+ try {
36079
+ const result = callback();
36080
+ if (isPromise(result)) {
36081
+ return result.catch((e) => {
36082
+ ngZone.runOutsideAngular(() => errorHandler.handleError(e));
36083
+ // rethrow as the exception handler might not do it
36084
+ throw e;
36085
+ });
36086
+ }
36087
+ return result;
36088
+ }
36089
+ catch (e) {
36090
+ ngZone.runOutsideAngular(() => errorHandler.handleError(e));
36091
+ // rethrow as the exception handler might not do it
36092
+ throw e;
36093
+ }
36094
+ }
36173
36095
 
36174
36096
  /**
36175
36097
  * The Angular platform is the entry point for Angular on a web page.
@@ -38772,7 +38694,7 @@ function createComputed(computation) {
38772
38694
  producerUpdateValueVersion(node);
38773
38695
  // Record that someone looked at this signal.
38774
38696
  producerAccessed(node);
38775
- if (node.value === ERRORED$1) {
38697
+ if (node.value === ERRORED) {
38776
38698
  throw node.error;
38777
38699
  }
38778
38700
  return node.value;
@@ -38784,26 +38706,26 @@ function createComputed(computation) {
38784
38706
  * A dedicated symbol used before a computed value has been calculated for the first time.
38785
38707
  * Explicitly typed as `any` so we can use it as signal's value.
38786
38708
  */
38787
- const UNSET$1 = /* @__PURE__ */ Symbol('UNSET');
38709
+ const UNSET = /* @__PURE__ */ Symbol('UNSET');
38788
38710
  /**
38789
38711
  * A dedicated symbol used in place of a computed signal value to indicate that a given computation
38790
38712
  * is in progress. Used to detect cycles in computation chains.
38791
38713
  * Explicitly typed as `any` so we can use it as signal's value.
38792
38714
  */
38793
- const COMPUTING$1 = /* @__PURE__ */ Symbol('COMPUTING');
38715
+ const COMPUTING = /* @__PURE__ */ Symbol('COMPUTING');
38794
38716
  /**
38795
38717
  * A dedicated symbol used in place of a computed signal value to indicate that a given computation
38796
38718
  * failed. The thrown error is cached until the computation gets dirty again.
38797
38719
  * Explicitly typed as `any` so we can use it as signal's value.
38798
38720
  */
38799
- const ERRORED$1 = /* @__PURE__ */ Symbol('ERRORED');
38721
+ const ERRORED = /* @__PURE__ */ Symbol('ERRORED');
38800
38722
  // Note: Using an IIFE here to ensure that the spread assignment is not considered
38801
38723
  // a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.
38802
38724
  // TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.
38803
38725
  const COMPUTED_NODE = /* @__PURE__ */ (() => {
38804
38726
  return {
38805
38727
  ...REACTIVE_NODE,
38806
- value: UNSET$1,
38728
+ value: UNSET,
38807
38729
  dirty: true,
38808
38730
  error: null,
38809
38731
  equal: defaultEquals,
@@ -38811,15 +38733,15 @@ const COMPUTED_NODE = /* @__PURE__ */ (() => {
38811
38733
  producerMustRecompute(node) {
38812
38734
  // Force a recomputation if there's no current value, or if the current value is in the
38813
38735
  // process of being calculated (which should throw an error).
38814
- return node.value === UNSET$1 || node.value === COMPUTING$1;
38736
+ return node.value === UNSET || node.value === COMPUTING;
38815
38737
  },
38816
38738
  producerRecomputeValue(node) {
38817
- if (node.value === COMPUTING$1) {
38739
+ if (node.value === COMPUTING) {
38818
38740
  // Our computation somehow led to a cyclic read of itself.
38819
38741
  throw new Error('Detected cycle in computations.');
38820
38742
  }
38821
38743
  const oldValue = node.value;
38822
- node.value = COMPUTING$1;
38744
+ node.value = COMPUTING;
38823
38745
  const prevConsumer = consumerBeforeComputation(node);
38824
38746
  let newValue;
38825
38747
  let wasEqual = false;
@@ -38829,13 +38751,13 @@ const COMPUTED_NODE = /* @__PURE__ */ (() => {
38829
38751
  // to track any reactive reads inside `equal`.
38830
38752
  setActiveConsumer(null);
38831
38753
  wasEqual =
38832
- oldValue !== UNSET$1 &&
38833
- oldValue !== ERRORED$1 &&
38834
- newValue !== ERRORED$1 &&
38754
+ oldValue !== UNSET &&
38755
+ oldValue !== ERRORED &&
38756
+ newValue !== ERRORED &&
38835
38757
  node.equal(oldValue, newValue);
38836
38758
  }
38837
38759
  catch (err) {
38838
- newValue = ERRORED$1;
38760
+ newValue = ERRORED;
38839
38761
  node.error = err;
38840
38762
  }
38841
38763
  finally {
@@ -38929,8 +38851,8 @@ function signalValueChanged(node) {
38929
38851
  postSignalSetFn?.();
38930
38852
  }
38931
38853
 
38932
- function createLinkedSignal$1(sourceFn, computationFn, equalityFn) {
38933
- const node = Object.create(LINKED_SIGNAL_NODE$1);
38854
+ function createLinkedSignal(sourceFn, computationFn, equalityFn) {
38855
+ const node = Object.create(LINKED_SIGNAL_NODE);
38934
38856
  node.source = sourceFn;
38935
38857
  node.computation = computationFn;
38936
38858
  if (equalityFn != undefined) {
@@ -38941,7 +38863,7 @@ function createLinkedSignal$1(sourceFn, computationFn, equalityFn) {
38941
38863
  producerUpdateValueVersion(node);
38942
38864
  // Record that someone looked at this signal.
38943
38865
  producerAccessed(node);
38944
- if (node.value === ERRORED$1) {
38866
+ if (node.value === ERRORED) {
38945
38867
  throw node.error;
38946
38868
  }
38947
38869
  return node.value;
@@ -38963,30 +38885,30 @@ function linkedSignalUpdateFn(node, updater) {
38963
38885
  // Note: Using an IIFE here to ensure that the spread assignment is not considered
38964
38886
  // a side-effect, ending up preserving `LINKED_SIGNAL_NODE` and `REACTIVE_NODE`.
38965
38887
  // TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.
38966
- const LINKED_SIGNAL_NODE$1 = /* @__PURE__ */ (() => {
38888
+ const LINKED_SIGNAL_NODE = /* @__PURE__ */ (() => {
38967
38889
  return {
38968
38890
  ...REACTIVE_NODE,
38969
- value: UNSET$1,
38891
+ value: UNSET,
38970
38892
  dirty: true,
38971
38893
  error: null,
38972
38894
  equal: defaultEquals,
38973
38895
  producerMustRecompute(node) {
38974
38896
  // Force a recomputation if there's no current value, or if the current value is in the
38975
38897
  // process of being calculated (which should throw an error).
38976
- return node.value === UNSET$1 || node.value === COMPUTING$1;
38898
+ return node.value === UNSET || node.value === COMPUTING;
38977
38899
  },
38978
38900
  producerRecomputeValue(node) {
38979
- if (node.value === COMPUTING$1) {
38901
+ if (node.value === COMPUTING) {
38980
38902
  // Our computation somehow led to a cyclic read of itself.
38981
38903
  throw new Error('Detected cycle in computations.');
38982
38904
  }
38983
38905
  const oldValue = node.value;
38984
- node.value = COMPUTING$1;
38906
+ node.value = COMPUTING;
38985
38907
  const prevConsumer = consumerBeforeComputation(node);
38986
38908
  let newValue;
38987
38909
  try {
38988
38910
  const newSourceValue = node.source();
38989
- const prev = oldValue === UNSET$1 || oldValue === ERRORED$1
38911
+ const prev = oldValue === UNSET || oldValue === ERRORED
38990
38912
  ? undefined
38991
38913
  : {
38992
38914
  source: node.sourceValue,
@@ -38996,13 +38918,13 @@ const LINKED_SIGNAL_NODE$1 = /* @__PURE__ */ (() => {
38996
38918
  node.sourceValue = newSourceValue;
38997
38919
  }
38998
38920
  catch (err) {
38999
- newValue = ERRORED$1;
38921
+ newValue = ERRORED;
39000
38922
  node.error = err;
39001
38923
  }
39002
38924
  finally {
39003
38925
  consumerAfterComputation(node, prevConsumer);
39004
38926
  }
39005
- if (oldValue !== UNSET$1 && newValue !== ERRORED$1 && node.equal(oldValue, newValue)) {
38927
+ if (oldValue !== UNSET && newValue !== ERRORED && node.equal(oldValue, newValue)) {
39006
38928
  // No change to `valueVersion` - old and new values are
39007
38929
  // semantically equivalent.
39008
38930
  node.value = oldValue;
@@ -40102,12 +40024,12 @@ function printHydrationStats(injector) {
40102
40024
  /**
40103
40025
  * Returns a Promise that is resolved when an application becomes stable.
40104
40026
  */
40105
- function whenStableWithTimeout(appRef, injector) {
40027
+ function whenStableWithTimeout(appRef) {
40106
40028
  const whenStablePromise = appRef.whenStable();
40107
40029
  if (typeof ngDevMode !== 'undefined' && ngDevMode) {
40108
40030
  const timeoutTime = APPLICATION_IS_STABLE_TIMEOUT;
40109
- const console = injector.get(Console);
40110
- const ngZone = injector.get(NgZone);
40031
+ const console = appRef.injector.get(Console);
40032
+ const ngZone = appRef.injector.get(NgZone);
40111
40033
  // The following call should not and does not prevent the app to become stable
40112
40034
  // We cannot use RxJS timer here because the app would remain unstable.
40113
40035
  // This also avoids an extra change detection cycle.
@@ -40205,7 +40127,6 @@ function withDomHydration() {
40205
40127
  useFactory: () => {
40206
40128
  if (inject(IS_HYDRATION_DOM_REUSE_ENABLED)) {
40207
40129
  const appRef = inject(ApplicationRef);
40208
- const injector = inject(Injector);
40209
40130
  return () => {
40210
40131
  // Wait until an app becomes stable and cleanup all views that
40211
40132
  // were not claimed during the application bootstrap process.
@@ -40214,11 +40135,20 @@ function withDomHydration() {
40214
40135
  //
40215
40136
  // Note: the cleanup task *MUST* be scheduled within the Angular zone in Zone apps
40216
40137
  // to ensure that change detection is properly run afterward.
40217
- whenStableWithTimeout(appRef, injector).then(() => {
40138
+ whenStableWithTimeout(appRef).then(() => {
40139
+ // Note: we have to check whether the application is destroyed before
40140
+ // performing other operations with the `injector`.
40141
+ // The application may be destroyed **before** it becomes stable, so when
40142
+ // the `whenStableWithTimeout` resolves, the injector might already be in
40143
+ // a destroyed state. Thus, calling `injector.get` would throw an error
40144
+ // indicating that the injector has already been destroyed.
40145
+ if (appRef.destroyed) {
40146
+ return;
40147
+ }
40218
40148
  cleanupDehydratedViews(appRef);
40219
40149
  if (typeof ngDevMode !== 'undefined' && ngDevMode) {
40220
- countBlocksSkippedByHydration(injector);
40221
- printHydrationStats(injector);
40150
+ countBlocksSkippedByHydration(appRef.injector);
40151
+ printHydrationStats(appRef.injector);
40222
40152
  }
40223
40153
  });
40224
40154
  };
@@ -40620,123 +40550,28 @@ function computed(computation, options) {
40620
40550
  }
40621
40551
 
40622
40552
  const identityFn = (v) => v;
40623
- /**
40624
- * Create a linked signal which represents state that is (re)set from a linked reactive expression.
40625
- */
40626
- function createLinkedSignal(node) {
40627
- const linkedSignalGetter = () => {
40628
- // Check if the value needs updating before returning it.
40629
- producerUpdateValueVersion$1(node);
40630
- // Record that someone looked at this signal.
40631
- producerAccessed$1(node);
40632
- if (node.value === ERRORED) {
40633
- throw node.error;
40634
- }
40635
- return node.value;
40636
- };
40637
- const getter = linkedSignalGetter;
40638
- getter[SIGNAL$1] = node;
40639
- if (ngDevMode) {
40640
- getter.toString = () => `[LinkedSignal: ${getter()}]`;
40641
- }
40642
- getter.set = (newValue) => {
40643
- producerUpdateValueVersion$1(node);
40644
- signalSetFn$1(node, newValue);
40645
- producerMarkClean$1(node);
40646
- };
40647
- getter.update = (updateFn) => {
40648
- producerUpdateValueVersion$1(node);
40649
- signalUpdateFn$1(node, updateFn);
40650
- producerMarkClean$1(node);
40651
- };
40652
- getter.asReadonly = signalAsReadonlyFn.bind(getter);
40653
- return getter;
40654
- }
40655
40553
  function linkedSignal(optionsOrComputation, options) {
40656
40554
  performanceMarkFeature('NgSignals');
40657
- const isShorthand = typeof optionsOrComputation === 'function';
40658
- const node = Object.create(LINKED_SIGNAL_NODE);
40659
- node.source = isShorthand ? optionsOrComputation : optionsOrComputation.source;
40660
- if (!isShorthand) {
40661
- node.computation = optionsOrComputation.computation;
40555
+ if (typeof optionsOrComputation === 'function') {
40556
+ const getter = createLinkedSignal$1(optionsOrComputation, (identityFn), options?.equal);
40557
+ return upgradeLinkedSignalGetter(getter);
40662
40558
  }
40663
- const equal = isShorthand ? options?.equal : optionsOrComputation.equal;
40664
- if (equal) {
40665
- node.equal = equal;
40559
+ else {
40560
+ const getter = createLinkedSignal$1(optionsOrComputation.source, optionsOrComputation.computation, optionsOrComputation.equal);
40561
+ return upgradeLinkedSignalGetter(getter);
40666
40562
  }
40667
- return createLinkedSignal(node);
40668
40563
  }
40669
- /**
40670
- * A dedicated symbol used before a state value has been set / calculated for the first time.
40671
- * Explicitly typed as `any` so we can use it as signal's value.
40672
- */
40673
- const UNSET = /* @__PURE__ */ Symbol('UNSET');
40674
- /**
40675
- * A dedicated symbol used in place of a linked signal value to indicate that a given computation
40676
- * is in progress. Used to detect cycles in computation chains.
40677
- * Explicitly typed as `any` so we can use it as signal's value.
40678
- */
40679
- const COMPUTING = /* @__PURE__ */ Symbol('COMPUTING');
40680
- /**
40681
- * A dedicated symbol used in place of a linked signal value to indicate that a given computation
40682
- * failed. The thrown error is cached until the computation gets dirty again or the state is set.
40683
- * Explicitly typed as `any` so we can use it as signal's value.
40684
- */
40685
- const ERRORED = /* @__PURE__ */ Symbol('ERRORED');
40686
- // Note: Using an IIFE here to ensure that the spread assignment is not considered
40687
- // a side-effect, ending up preserving `LINKED_SIGNAL_NODE` and `REACTIVE_NODE`.
40688
- // TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.
40689
- const LINKED_SIGNAL_NODE = /* @__PURE__ */ (() => {
40690
- return {
40691
- ...REACTIVE_NODE$1,
40692
- value: UNSET,
40693
- dirty: true,
40694
- error: null,
40695
- equal: defaultEquals$1,
40696
- computation: identityFn,
40697
- producerMustRecompute(node) {
40698
- // Force a recomputation if there's no current value, or if the current value is in the
40699
- // process of being calculated (which should throw an error).
40700
- return node.value === UNSET || node.value === COMPUTING;
40701
- },
40702
- producerRecomputeValue(node) {
40703
- if (node.value === COMPUTING) {
40704
- // Our computation somehow led to a cyclic read of itself.
40705
- throw new Error('Detected cycle in computations.');
40706
- }
40707
- const oldValue = node.value;
40708
- node.value = COMPUTING;
40709
- const prevConsumer = consumerBeforeComputation$1(node);
40710
- let newValue;
40711
- try {
40712
- const newSourceValue = node.source();
40713
- const prev = oldValue === UNSET || oldValue === ERRORED
40714
- ? undefined
40715
- : {
40716
- source: node.sourceValue,
40717
- value: oldValue,
40718
- };
40719
- newValue = node.computation(newSourceValue, prev);
40720
- node.sourceValue = newSourceValue;
40721
- }
40722
- catch (err) {
40723
- newValue = ERRORED;
40724
- node.error = err;
40725
- }
40726
- finally {
40727
- consumerAfterComputation$1(node, prevConsumer);
40728
- }
40729
- if (oldValue !== UNSET && newValue !== ERRORED && node.equal(oldValue, newValue)) {
40730
- // No change to `valueVersion` - old and new values are
40731
- // semantically equivalent.
40732
- node.value = oldValue;
40733
- return;
40734
- }
40735
- node.value = newValue;
40736
- node.version++;
40737
- },
40738
- };
40739
- })();
40564
+ function upgradeLinkedSignalGetter(getter) {
40565
+ if (ngDevMode) {
40566
+ getter.toString = () => `[LinkedSignal: ${getter()}]`;
40567
+ }
40568
+ const node = getter[SIGNAL$1];
40569
+ const upgradedGetter = getter;
40570
+ upgradedGetter.set = (newValue) => linkedSignalSetFn$1(node, newValue);
40571
+ upgradedGetter.update = (updateFn) => linkedSignalUpdateFn$1(node, updateFn);
40572
+ upgradedGetter.asReadonly = signalAsReadonlyFn.bind(getter);
40573
+ return upgradedGetter;
40574
+ }
40740
40575
 
40741
40576
  /**
40742
40577
  * Execute an arbitrary function in a non-reactive (non-tracking) context. The executed function
@@ -41281,20 +41116,10 @@ var ResourceStatus;
41281
41116
  ResourceStatus[ResourceStatus["Local"] = 5] = "Local";
41282
41117
  })(ResourceStatus || (ResourceStatus = {}));
41283
41118
 
41284
- /**
41285
- * Constructs a `Resource` that projects a reactive request to an asynchronous operation defined by
41286
- * a loader function, which exposes the result of the loading operation via signals.
41287
- *
41288
- * Note that `resource` is intended for _read_ operations, not operations which perform mutations.
41289
- * `resource` will cancel in-progress loads via the `AbortSignal` when destroyed or when a new
41290
- * request object becomes available, which could prematurely abort mutations.
41291
- *
41292
- * @experimental
41293
- */
41294
41119
  function resource(options) {
41295
41120
  options?.injector || assertInInjectionContext(resource);
41296
41121
  const request = (options.request ?? (() => null));
41297
- return new ResourceImpl(request, getLoader(options), undefined, options.equal ? wrapEqualityFn(options.equal) : undefined, options.injector ?? inject(Injector));
41122
+ return new ResourceImpl(request, getLoader(options), options.defaultValue, options.equal ? wrapEqualityFn(options.equal) : undefined, options.injector ?? inject(Injector));
41298
41123
  }
41299
41124
  /**
41300
41125
  * Base class which implements `.value` as a `WritableSignal` by delegating `.set` and `.update`.
@@ -41325,16 +41150,16 @@ class ResourceImpl extends BaseWritableResource {
41325
41150
  loaderFn;
41326
41151
  defaultValue;
41327
41152
  equal;
41153
+ pendingTasks;
41328
41154
  /**
41329
41155
  * The current state of the resource. Status, value, and error are derived from this.
41330
41156
  */
41331
41157
  state;
41332
41158
  /**
41333
- * Signal of both the request value `R` and a writable `reload` signal that's linked/associated
41334
- * to the given request. Changing the value of the `reload` signal causes the resource to reload.
41159
+ * Combines the current request with a reload counter which allows the resource to be reloaded on
41160
+ * imperative command.
41335
41161
  */
41336
- extendedRequest;
41337
- pendingTasks;
41162
+ extRequest;
41338
41163
  effectRef;
41339
41164
  pendingController;
41340
41165
  resolvePendingTask = undefined;
@@ -41344,56 +41169,55 @@ class ResourceImpl extends BaseWritableResource {
41344
41169
  // Feed a computed signal for the value to `BaseWritableResource`, which will upgrade it to a
41345
41170
  // `WritableSignal` that delegates to `ResourceImpl.set`.
41346
41171
  computed(() => {
41347
- const stream = this.state()?.stream?.();
41348
- return stream && isResolved(stream) ? stream.value : this.defaultValue;
41172
+ const streamValue = this.state().stream?.();
41173
+ return streamValue && isResolved(streamValue) ? streamValue.value : this.defaultValue;
41349
41174
  }, { equal }));
41350
41175
  this.loaderFn = loaderFn;
41351
41176
  this.defaultValue = defaultValue;
41352
41177
  this.equal = equal;
41353
- this.pendingTasks = injector.get(PendingTasks);
41354
41178
  // Extend `request()` to include a writable reload signal.
41355
- this.extendedRequest = computed(() => ({
41356
- request: request(),
41357
- reload: signal(0),
41358
- }));
41179
+ this.extRequest = linkedSignal({
41180
+ source: request,
41181
+ computation: (request) => ({ request, reload: 0 }),
41182
+ });
41359
41183
  // The main resource state is managed in a `linkedSignal`, which allows the resource to change
41360
41184
  // state instantaneously when the request signal changes.
41361
41185
  this.state = linkedSignal({
41362
- // We use the request (as well as its reload signal) to derive the initial status of the
41363
- // resource (Idle, Loading, or Reloading) in response to request changes. From this initial
41364
- // status, the resource's effect will then trigger the loader and update to a Resolved or
41365
- // Error state as appropriate.
41366
- source: () => {
41367
- const { request, reload } = this.extendedRequest();
41368
- if (request === undefined || this.destroyed) {
41369
- return ResourceStatus.Idle;
41186
+ // Whenever the request changes,
41187
+ source: this.extRequest,
41188
+ // Compute the state of the resource given a change in status.
41189
+ computation: (extRequest, previous) => {
41190
+ const status = extRequest.request === undefined ? ResourceStatus.Idle : ResourceStatus.Loading;
41191
+ if (!previous) {
41192
+ return {
41193
+ extRequest,
41194
+ status,
41195
+ previousStatus: ResourceStatus.Idle,
41196
+ stream: undefined,
41197
+ };
41198
+ }
41199
+ else {
41200
+ return {
41201
+ extRequest,
41202
+ status,
41203
+ previousStatus: projectStatusOfState(previous.value),
41204
+ // If the request hasn't changed, keep the previous stream.
41205
+ stream: previous.value.extRequest.request === extRequest.request
41206
+ ? previous.value.stream
41207
+ : undefined,
41208
+ };
41370
41209
  }
41371
- return reload() === 0 ? ResourceStatus.Loading : ResourceStatus.Reloading;
41372
41210
  },
41373
- // Compute the state of the resource given a change in status.
41374
- computation: (status, previous) => ({
41375
- status,
41376
- // When the state of the resource changes due to the request, remember the previous status
41377
- // for the loader to consider.
41378
- previousStatus: computeStatusOfState(previous?.value),
41379
- // In `Reloading` state, we keep the previous value if there is one, since the identity of
41380
- // the request hasn't changed. Otherwise, we switch back to the default value.
41381
- stream: previous && status === ResourceStatus.Reloading ? previous.value.stream : undefined,
41382
- }),
41383
41211
  });
41384
41212
  this.effectRef = effect(this.loadEffect.bind(this), {
41385
41213
  injector,
41386
41214
  manualCleanup: true,
41387
41215
  });
41216
+ this.pendingTasks = injector.get(PendingTasks);
41388
41217
  // Cancel any pending request when the resource itself is destroyed.
41389
41218
  injector.get(DestroyRef).onDestroy(() => this.destroy());
41390
41219
  }
41391
- status = computed(() => {
41392
- if (this.state().status !== ResourceStatus.Resolved) {
41393
- return this.state().status;
41394
- }
41395
- return isResolved(this.state().stream()) ? ResourceStatus.Resolved : ResourceStatus.Error;
41396
- });
41220
+ status = computed(() => projectStatusOfState(this.state()));
41397
41221
  error = computed(() => {
41398
41222
  const stream = this.state().stream?.();
41399
41223
  return stream && !isResolved(stream) ? stream.error : undefined;
@@ -41406,11 +41230,14 @@ class ResourceImpl extends BaseWritableResource {
41406
41230
  return;
41407
41231
  }
41408
41232
  const current = untracked(this.value);
41409
- if (this.equal ? this.equal(current, value) : current === value) {
41233
+ const state = untracked(this.state);
41234
+ if (state.status === ResourceStatus.Local &&
41235
+ (this.equal ? this.equal(current, value) : current === value)) {
41410
41236
  return;
41411
41237
  }
41412
41238
  // Enter Local state with the user-defined value.
41413
41239
  this.state.set({
41240
+ extRequest: state.extRequest,
41414
41241
  status: ResourceStatus.Local,
41415
41242
  previousStatus: ResourceStatus.Local,
41416
41243
  stream: signal({ value }),
@@ -41421,14 +41248,12 @@ class ResourceImpl extends BaseWritableResource {
41421
41248
  }
41422
41249
  reload() {
41423
41250
  // We don't want to restart in-progress loads.
41424
- const status = untracked(this.status);
41425
- if (status === ResourceStatus.Idle ||
41426
- status === ResourceStatus.Loading ||
41427
- status === ResourceStatus.Reloading) {
41251
+ const { status } = untracked(this.state);
41252
+ if (status === ResourceStatus.Idle || status === ResourceStatus.Loading) {
41428
41253
  return false;
41429
41254
  }
41430
- // Increment the reload signal to trigger the `state` linked signal to switch us to `Reload`
41431
- untracked(this.extendedRequest).reload.update((v) => v + 1);
41255
+ // Increment the request reload to trigger the `state` linked signal to switch us to `Reload`
41256
+ this.extRequest.update(({ request, reload }) => ({ request, reload: reload + 1 }));
41432
41257
  return true;
41433
41258
  }
41434
41259
  destroy() {
@@ -41437,28 +41262,23 @@ class ResourceImpl extends BaseWritableResource {
41437
41262
  this.abortInProgressLoad();
41438
41263
  // Destroyed resources enter Idle state.
41439
41264
  this.state.set({
41265
+ extRequest: { request: undefined, reload: 0 },
41440
41266
  status: ResourceStatus.Idle,
41441
41267
  previousStatus: ResourceStatus.Idle,
41442
41268
  stream: undefined,
41443
41269
  });
41444
41270
  }
41445
41271
  async loadEffect() {
41272
+ const extRequest = this.extRequest();
41446
41273
  // Capture the previous status before any state transitions. Note that this is `untracked` since
41447
41274
  // we do not want the effect to depend on the state of the resource, only on the request.
41448
- const { status: previousStatus } = untracked(this.state);
41449
- const { request, reload: reloadCounter } = this.extendedRequest();
41450
- // Subscribe side-effectfully to `reloadCounter`, although we don't actually care about its
41451
- // value. This is used to rerun the effect when `reload()` is triggered.
41452
- reloadCounter();
41453
- if (request === undefined) {
41275
+ const { status: currentStatus, previousStatus } = untracked(this.state);
41276
+ if (extRequest.request === undefined) {
41454
41277
  // Nothing to load (and we should already be in a non-loading state).
41455
41278
  return;
41456
41279
  }
41457
- else if (previousStatus !== ResourceStatus.Loading &&
41458
- previousStatus !== ResourceStatus.Reloading) {
41459
- // We might've transitioned into a loading state, but has since been overwritten (likely via
41460
- // `.set`).
41461
- // In this case, the resource has nothing to do.
41280
+ else if (currentStatus !== ResourceStatus.Loading) {
41281
+ // We're not in a loading or reloading state, so this loading request is stale.
41462
41282
  return;
41463
41283
  }
41464
41284
  // Cancel any previous loading attempts.
@@ -41479,27 +41299,33 @@ class ResourceImpl extends BaseWritableResource {
41479
41299
  // The actual loading is run through `untracked` - only the request side of `resource` is
41480
41300
  // reactive. This avoids any confusion with signals tracking or not tracking depending on
41481
41301
  // which side of the `await` they are.
41482
- const stream = await untracked(() => this.loaderFn({
41483
- request: request,
41484
- abortSignal,
41485
- previous: {
41486
- status: previousStatus,
41487
- },
41488
- }));
41489
- if (abortSignal.aborted) {
41302
+ const stream = await untracked(() => {
41303
+ return this.loaderFn({
41304
+ request: extRequest.request,
41305
+ abortSignal,
41306
+ previous: {
41307
+ status: previousStatus,
41308
+ },
41309
+ });
41310
+ });
41311
+ // If this request has been aborted, or the current request no longer
41312
+ // matches this load, then we should ignore this resolution.
41313
+ if (abortSignal.aborted || untracked(this.extRequest) !== extRequest) {
41490
41314
  return;
41491
41315
  }
41492
41316
  this.state.set({
41317
+ extRequest,
41493
41318
  status: ResourceStatus.Resolved,
41494
41319
  previousStatus: ResourceStatus.Resolved,
41495
41320
  stream,
41496
41321
  });
41497
41322
  }
41498
41323
  catch (err) {
41499
- if (abortSignal.aborted) {
41324
+ if (abortSignal.aborted || untracked(this.extRequest) !== extRequest) {
41500
41325
  return;
41501
41326
  }
41502
41327
  this.state.set({
41328
+ extRequest,
41503
41329
  status: ResourceStatus.Resolved,
41504
41330
  previousStatus: ResourceStatus.Error,
41505
41331
  stream: signal({ error: err }),
@@ -41541,10 +41367,13 @@ function getLoader(options) {
41541
41367
  function isStreamingResourceOptions(options) {
41542
41368
  return !!options.stream;
41543
41369
  }
41544
- function computeStatusOfState(state) {
41545
- switch (state?.status) {
41546
- case undefined:
41547
- return ResourceStatus.Idle;
41370
+ /**
41371
+ * Project from a state with `ResourceInternalStatus` to the user-facing `ResourceStatus`
41372
+ */
41373
+ function projectStatusOfState(state) {
41374
+ switch (state.status) {
41375
+ case ResourceStatus.Loading:
41376
+ return state.extRequest.reload === 0 ? ResourceStatus.Loading : ResourceStatus.Reloading;
41548
41377
  case ResourceStatus.Resolved:
41549
41378
  return isResolved(untracked(state.stream)) ? ResourceStatus.Resolved : ResourceStatus.Error;
41550
41379
  default:
@@ -41801,5 +41630,5 @@ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
41801
41630
  * Generated bundle index. Do not edit.
41802
41631
  */
41803
41632
 
41804
- export { ANIMATION_MODULE_TYPE, APP_BOOTSTRAP_LISTENER, APP_ID, APP_INITIALIZER, AfterRenderPhase, ApplicationInitStatus, ApplicationModule, ApplicationRef, Attribute, COMPILER_OPTIONS, CSP_NONCE, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, ChangeDetectorRef, Compiler, CompilerFactory, Component, ComponentFactory$1 as ComponentFactory, ComponentFactoryResolver$1 as ComponentFactoryResolver, ComponentRef$1 as ComponentRef, ContentChild, ContentChildren, DEFAULT_CURRENCY_CODE, DebugElement, DebugEventListener, DebugNode, DefaultIterableDiffer, DestroyRef, Directive, ENVIRONMENT_INITIALIZER, ElementRef, EmbeddedViewRef, EnvironmentInjector, ErrorHandler, EventEmitter, HOST_TAG_NAME, Host, HostAttributeToken, HostBinding, HostListener, INJECTOR$1 as INJECTOR, Inject, InjectFlags, Injectable, InjectionToken, Injector, Input, IterableDiffers, KeyValueDiffers, LOCALE_ID, MissingTranslationStrategy, ModuleWithComponentFactories, NO_ERRORS_SCHEMA, NgModule, NgModuleFactory$1 as NgModuleFactory, NgModuleRef$1 as NgModuleRef, NgProbeToken, NgZone, Optional, Output, OutputEmitterRef, PACKAGE_ROOT_URL, PLATFORM_ID, PLATFORM_INITIALIZER, PendingTasks, Pipe, PlatformRef, Query, QueryList, REQUEST, REQUEST_CONTEXT, RESPONSE_INIT, Renderer2, RendererFactory2, RendererStyleFlags2, ResourceStatus, Sanitizer, SecurityContext, Self, SimpleChange, SkipSelf, TRANSLATIONS, TRANSLATIONS_FORMAT, TemplateRef, Testability, TestabilityRegistry, TransferState, Type, VERSION, Version, ViewChild, ViewChildren, ViewContainerRef, ViewEncapsulation, ViewRef, afterNextRender, afterRender, afterRenderEffect, asNativeElements, assertInInjectionContext, assertNotInReactiveContext, assertPlatform, booleanAttribute, computed, contentChild, contentChildren, createComponent, createEnvironmentInjector, createNgModule, createNgModuleRef, createPlatform, createPlatformFactory, defineInjectable, destroyPlatform, effect, enableProdMode, forwardRef, getDebugNode, getModuleFactory, getNgModuleById, getPlatform, importProvidersFrom, inject, input, isDevMode, isSignal, isStandalone, linkedSignal, makeEnvironmentProviders, makeStateKey, mergeApplicationConfig, model, numberAttribute, output, platformCore, provideAppInitializer, provideEnvironmentInitializer, provideExperimentalCheckNoChangesForDebug, provideExperimentalZonelessChangeDetection, providePlatformInitializer, provideZoneChangeDetection, reflectComponentType, resolveForwardRef, resource, runInInjectionContext, setTestabilityGetter, signal, untracked, viewChild, viewChildren, ALLOW_MULTIPLE_PLATFORMS as ɵALLOW_MULTIPLE_PLATFORMS, AfterRenderManager as ɵAfterRenderManager, CONTAINER_HEADER_OFFSET as ɵCONTAINER_HEADER_OFFSET, ChangeDetectionScheduler as ɵChangeDetectionScheduler, ChangeDetectionSchedulerImpl as ɵChangeDetectionSchedulerImpl, ComponentFactory$1 as ɵComponentFactory, Console as ɵConsole, DEFAULT_LOCALE_ID as ɵDEFAULT_LOCALE_ID, DEFER_BLOCK_CONFIG as ɵDEFER_BLOCK_CONFIG, DEFER_BLOCK_DEPENDENCY_INTERCEPTOR as ɵDEFER_BLOCK_DEPENDENCY_INTERCEPTOR, DeferBlockBehavior as ɵDeferBlockBehavior, DeferBlockState as ɵDeferBlockState, ENABLE_ROOT_COMPONENT_BOOTSTRAP as ɵENABLE_ROOT_COMPONENT_BOOTSTRAP, EffectScheduler as ɵEffectScheduler, IMAGE_CONFIG as ɵIMAGE_CONFIG, IMAGE_CONFIG_DEFAULTS as ɵIMAGE_CONFIG_DEFAULTS, INJECTOR_SCOPE as ɵINJECTOR_SCOPE, ɵINPUT_SIGNAL_BRAND_WRITE_TYPE, INTERNAL_APPLICATION_ERROR_HANDLER as ɵINTERNAL_APPLICATION_ERROR_HANDLER, IS_HYDRATION_DOM_REUSE_ENABLED as ɵIS_HYDRATION_DOM_REUSE_ENABLED, IS_INCREMENTAL_HYDRATION_ENABLED as ɵIS_INCREMENTAL_HYDRATION_ENABLED, JSACTION_EVENT_CONTRACT as ɵJSACTION_EVENT_CONTRACT, LContext as ɵLContext, LifecycleHooksFeature as ɵLifecycleHooksFeature, LocaleDataIndex as ɵLocaleDataIndex, MicrotaskEffectScheduler as ɵMicrotaskEffectScheduler, NG_COMP_DEF as ɵNG_COMP_DEF, NG_DIR_DEF as ɵNG_DIR_DEF, NG_ELEMENT_ID as ɵNG_ELEMENT_ID, NG_INJ_DEF as ɵNG_INJ_DEF, NG_MOD_DEF as ɵNG_MOD_DEF, NG_PIPE_DEF as ɵNG_PIPE_DEF, NG_PROV_DEF as ɵNG_PROV_DEF, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR as ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, NO_CHANGE as ɵNO_CHANGE, NgModuleFactory as ɵNgModuleFactory, NoopNgZone as ɵNoopNgZone, PERFORMANCE_MARK_PREFIX as ɵPERFORMANCE_MARK_PREFIX, PROVIDED_NG_ZONE as ɵPROVIDED_NG_ZONE, PendingTasksInternal as ɵPendingTasksInternal, ReflectionCapabilities as ɵReflectionCapabilities, ComponentFactory as ɵRender3ComponentFactory, ComponentRef as ɵRender3ComponentRef, NgModuleRef as ɵRender3NgModuleRef, RuntimeError as ɵRuntimeError, SSR_CONTENT_INTEGRITY_MARKER as ɵSSR_CONTENT_INTEGRITY_MARKER, TESTABILITY as ɵTESTABILITY, TESTABILITY_GETTER as ɵTESTABILITY_GETTER, TracingAction as ɵTracingAction, TracingService as ɵTracingService, USE_RUNTIME_DEPS_TRACKER_FOR_JIT as ɵUSE_RUNTIME_DEPS_TRACKER_FOR_JIT, ViewRef$1 as ɵViewRef, XSS_SECURITY_URL as ɵXSS_SECURITY_URL, ZONELESS_ENABLED as ɵZONELESS_ENABLED, _sanitizeHtml as ɵ_sanitizeHtml, _sanitizeUrl as ɵ_sanitizeUrl, allowSanitizationBypassAndThrow as ɵallowSanitizationBypassAndThrow, annotateForHydration as ɵannotateForHydration, bypassSanitizationTrustHtml as ɵbypassSanitizationTrustHtml, bypassSanitizationTrustResourceUrl as ɵbypassSanitizationTrustResourceUrl, bypassSanitizationTrustScript as ɵbypassSanitizationTrustScript, bypassSanitizationTrustStyle as ɵbypassSanitizationTrustStyle, bypassSanitizationTrustUrl as ɵbypassSanitizationTrustUrl, clearResolutionOfComponentResourcesQueue as ɵclearResolutionOfComponentResourcesQueue, compileComponent as ɵcompileComponent, compileDirective as ɵcompileDirective, compileNgModule as ɵcompileNgModule, compileNgModuleDefs as ɵcompileNgModuleDefs, compileNgModuleFactory as ɵcompileNgModuleFactory, compilePipe as ɵcompilePipe, convertToBitFlags as ɵconvertToBitFlags, createInjector as ɵcreateInjector, defaultIterableDiffers as ɵdefaultIterableDiffers, defaultKeyValueDiffers as ɵdefaultKeyValueDiffers, depsTracker as ɵdepsTracker, detectChangesInViewIfRequired as ɵdetectChangesInViewIfRequired, devModeEqual as ɵdevModeEqual, disableProfiling as ɵdisableProfiling, enableProfiling as ɵenableProfiling, findLocaleData as ɵfindLocaleData, flushModuleScopingQueueAsMuchAsPossible as ɵflushModuleScopingQueueAsMuchAsPossible, formatRuntimeError as ɵformatRuntimeError, generateStandaloneInDeclarationsError as ɵgenerateStandaloneInDeclarationsError, getAsyncClassMetadataFn as ɵgetAsyncClassMetadataFn, getClosestComponentName as ɵgetClosestComponentName, getDebugNode as ɵgetDebugNode, getDeferBlocks$1 as ɵgetDeferBlocks, getDirectives as ɵgetDirectives, getHostElement as ɵgetHostElement, getInjectableDef as ɵgetInjectableDef, getLContext as ɵgetLContext, getLocaleCurrencyCode as ɵgetLocaleCurrencyCode, getLocalePluralCase as ɵgetLocalePluralCase, getOutputDestroyRef as ɵgetOutputDestroyRef, getSanitizationBypassType as ɵgetSanitizationBypassType, ɵgetUnknownElementStrictMode, ɵgetUnknownPropertyStrictMode, _global as ɵglobal, injectChangeDetectorRef as ɵinjectChangeDetectorRef, internalCreateApplication as ɵinternalCreateApplication, internalProvideZoneChangeDetection as ɵinternalProvideZoneChangeDetection, isBoundToModule as ɵisBoundToModule, isComponentDefPendingResolution as ɵisComponentDefPendingResolution, isEnvironmentProviders as ɵisEnvironmentProviders, isInjectable as ɵisInjectable, isNgModule as ɵisNgModule, isPromise as ɵisPromise, isSubscribable as ɵisSubscribable, microtaskEffect as ɵmicrotaskEffect, noSideEffects as ɵnoSideEffects, patchComponentDefWithScope as ɵpatchComponentDefWithScope, performanceMarkFeature as ɵperformanceMarkFeature, publishExternalGlobalUtil as ɵpublishExternalGlobalUtil, readHydrationInfo as ɵreadHydrationInfo, registerLocaleData as ɵregisterLocaleData, renderDeferBlockState as ɵrenderDeferBlockState, resetCompiledComponents as ɵresetCompiledComponents, resetJitOptions as ɵresetJitOptions, resolveComponentResources as ɵresolveComponentResources, restoreComponentResolutionQueue as ɵrestoreComponentResolutionQueue, setAllowDuplicateNgModuleIdsForTest as ɵsetAllowDuplicateNgModuleIdsForTest, setAlternateWeakRefImpl as ɵsetAlternateWeakRefImpl, ɵsetClassDebugInfo, setClassMetadata as ɵsetClassMetadata, setClassMetadataAsync as ɵsetClassMetadataAsync, setCurrentInjector as ɵsetCurrentInjector, setDocument as ɵsetDocument, setInjectorProfilerContext as ɵsetInjectorProfilerContext, setLocaleId as ɵsetLocaleId, ɵsetUnknownElementStrictMode, ɵsetUnknownPropertyStrictMode, startMeasuring as ɵstartMeasuring, stopMeasuring as ɵstopMeasuring, store as ɵstore, stringify as ɵstringify, transitiveScopesFor as ɵtransitiveScopesFor, triggerResourceLoading as ɵtriggerResourceLoading, truncateMiddle as ɵtruncateMiddle, unregisterAllLocaleData as ɵunregisterLocaleData, unwrapSafeValue as ɵunwrapSafeValue, ɵunwrapWritableSignal, withDomHydration as ɵwithDomHydration, withEventReplay as ɵwithEventReplay, withI18nSupport as ɵwithI18nSupport, withIncrementalHydration as ɵwithIncrementalHydration, ɵɵCopyDefinitionFeature, ɵɵExternalStylesFeature, FactoryTarget as ɵɵFactoryTarget, ɵɵHostDirectivesFeature, ɵɵInheritDefinitionFeature, ɵɵInputTransformsFeature, ɵɵNgOnChangesFeature, ɵɵProvidersFeature, ɵɵadvance, ɵɵattachSourceLocations, ɵɵattribute, ɵɵattributeInterpolate1, ɵɵattributeInterpolate2, ɵɵattributeInterpolate3, ɵɵattributeInterpolate4, ɵɵattributeInterpolate5, ɵɵattributeInterpolate6, ɵɵattributeInterpolate7, ɵɵattributeInterpolate8, ɵɵattributeInterpolateV, ɵɵclassMap, ɵɵclassMapInterpolate1, ɵɵclassMapInterpolate2, ɵɵclassMapInterpolate3, ɵɵclassMapInterpolate4, ɵɵclassMapInterpolate5, ɵɵclassMapInterpolate6, ɵɵclassMapInterpolate7, ɵɵclassMapInterpolate8, ɵɵclassMapInterpolateV, ɵɵclassProp, ɵɵcomponentInstance, ɵɵconditional, ɵɵcontentQuery, ɵɵcontentQuerySignal, ɵɵdeclareLet, ɵɵdefer, ɵɵdeferEnableTimerScheduling, ɵɵdeferHydrateNever, ɵɵdeferHydrateOnHover, ɵɵdeferHydrateOnIdle, ɵɵdeferHydrateOnImmediate, ɵɵdeferHydrateOnInteraction, ɵɵdeferHydrateOnTimer, ɵɵdeferHydrateOnViewport, ɵɵdeferHydrateWhen, ɵɵdeferOnHover, ɵɵdeferOnIdle, ɵɵdeferOnImmediate, ɵɵdeferOnInteraction, ɵɵdeferOnTimer, ɵɵdeferOnViewport, ɵɵdeferPrefetchOnHover, ɵɵdeferPrefetchOnIdle, ɵɵdeferPrefetchOnImmediate, ɵɵdeferPrefetchOnInteraction, ɵɵdeferPrefetchOnTimer, ɵɵdeferPrefetchOnViewport, ɵɵdeferPrefetchWhen, ɵɵdeferWhen, ɵɵdefineComponent, ɵɵdefineDirective, ɵɵdefineInjectable, ɵɵdefineInjector, ɵɵdefineNgModule, ɵɵdefinePipe, ɵɵdirectiveInject, ɵɵdisableBindings, ɵɵelement, ɵɵelementContainer, ɵɵelementContainerEnd, ɵɵelementContainerStart, ɵɵelementEnd, ɵɵelementStart, ɵɵenableBindings, ɵɵgetComponentDepsFactory, ɵɵgetCurrentView, ɵɵgetInheritedFactory, ɵɵhostProperty, ɵɵi18n, ɵɵi18nApply, ɵɵi18nAttributes, ɵɵi18nEnd, ɵɵi18nExp, ɵɵi18nPostprocess, ɵɵi18nStart, ɵɵinject, ɵɵinjectAttribute, ɵɵinvalidFactory, ɵɵinvalidFactoryDep, ɵɵlistener, ɵɵloadQuery, ɵɵnamespaceHTML, ɵɵnamespaceMathML, ɵɵnamespaceSVG, ɵɵnextContext, ɵɵngDeclareClassMetadata, ɵɵngDeclareClassMetadataAsync, ɵɵngDeclareComponent, ɵɵngDeclareDirective, ɵɵngDeclareFactory, ɵɵngDeclareInjectable, ɵɵngDeclareInjector, ɵɵngDeclareNgModule, ɵɵngDeclarePipe, ɵɵpipe, ɵɵpipeBind1, ɵɵpipeBind2, ɵɵpipeBind3, ɵɵpipeBind4, ɵɵpipeBindV, ɵɵprojection, ɵɵprojectionDef, ɵɵproperty, ɵɵpropertyInterpolate, ɵɵpropertyInterpolate1, ɵɵpropertyInterpolate2, ɵɵpropertyInterpolate3, ɵɵpropertyInterpolate4, ɵɵpropertyInterpolate5, ɵɵpropertyInterpolate6, ɵɵpropertyInterpolate7, ɵɵpropertyInterpolate8, ɵɵpropertyInterpolateV, ɵɵpureFunction0, ɵɵpureFunction1, ɵɵpureFunction2, ɵɵpureFunction3, ɵɵpureFunction4, ɵɵpureFunction5, ɵɵpureFunction6, ɵɵpureFunction7, ɵɵpureFunction8, ɵɵpureFunctionV, ɵɵqueryAdvance, ɵɵqueryRefresh, ɵɵreadContextLet, ɵɵreference, registerNgModuleType as ɵɵregisterNgModuleType, ɵɵrepeater, ɵɵrepeaterCreate, ɵɵrepeaterTrackByIdentity, ɵɵrepeaterTrackByIndex, ɵɵreplaceMetadata, ɵɵresetView, ɵɵresolveBody, ɵɵresolveDocument, ɵɵresolveWindow, ɵɵrestoreView, ɵɵsanitizeHtml, ɵɵsanitizeResourceUrl, ɵɵsanitizeScript, ɵɵsanitizeStyle, ɵɵsanitizeUrl, ɵɵsanitizeUrlOrResourceUrl, ɵɵsetComponentScope, ɵɵsetNgModuleScope, ɵɵstoreLet, ɵɵstyleMap, ɵɵstyleMapInterpolate1, ɵɵstyleMapInterpolate2, ɵɵstyleMapInterpolate3, ɵɵstyleMapInterpolate4, ɵɵstyleMapInterpolate5, ɵɵstyleMapInterpolate6, ɵɵstyleMapInterpolate7, ɵɵstyleMapInterpolate8, ɵɵstyleMapInterpolateV, ɵɵstyleProp, ɵɵstylePropInterpolate1, ɵɵstylePropInterpolate2, ɵɵstylePropInterpolate3, ɵɵstylePropInterpolate4, ɵɵstylePropInterpolate5, ɵɵstylePropInterpolate6, ɵɵstylePropInterpolate7, ɵɵstylePropInterpolate8, ɵɵstylePropInterpolateV, ɵɵsyntheticHostListener, ɵɵsyntheticHostProperty, ɵɵtemplate, ɵɵtemplateRefExtractor, ɵɵtext, ɵɵtextInterpolate, ɵɵtextInterpolate1, ɵɵtextInterpolate2, ɵɵtextInterpolate3, ɵɵtextInterpolate4, ɵɵtextInterpolate5, ɵɵtextInterpolate6, ɵɵtextInterpolate7, ɵɵtextInterpolate8, ɵɵtextInterpolateV, ɵɵtrustConstantHtml, ɵɵtrustConstantResourceUrl, ɵɵtwoWayBindingSet, ɵɵtwoWayListener, ɵɵtwoWayProperty, ɵɵvalidateIframeAttribute, ɵɵviewQuery, ɵɵviewQuerySignal };
41633
+ export { ANIMATION_MODULE_TYPE, APP_BOOTSTRAP_LISTENER, APP_ID, APP_INITIALIZER, AfterRenderPhase, ApplicationInitStatus, ApplicationModule, ApplicationRef, Attribute, COMPILER_OPTIONS, CSP_NONCE, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, ChangeDetectorRef, Compiler, CompilerFactory, Component, ComponentFactory$1 as ComponentFactory, ComponentFactoryResolver$1 as ComponentFactoryResolver, ComponentRef$1 as ComponentRef, ContentChild, ContentChildren, DEFAULT_CURRENCY_CODE, DebugElement, DebugEventListener, DebugNode, DefaultIterableDiffer, DestroyRef, Directive, ENVIRONMENT_INITIALIZER, ElementRef, EmbeddedViewRef, EnvironmentInjector, ErrorHandler, EventEmitter, HOST_TAG_NAME, Host, HostAttributeToken, HostBinding, HostListener, INJECTOR$1 as INJECTOR, Inject, InjectFlags, Injectable, InjectionToken, Injector, Input, IterableDiffers, KeyValueDiffers, LOCALE_ID, MissingTranslationStrategy, ModuleWithComponentFactories, NO_ERRORS_SCHEMA, NgModule, NgModuleFactory$1 as NgModuleFactory, NgModuleRef$1 as NgModuleRef, NgProbeToken, NgZone, Optional, Output, OutputEmitterRef, PACKAGE_ROOT_URL, PLATFORM_ID, PLATFORM_INITIALIZER, PendingTasks, Pipe, PlatformRef, Query, QueryList, REQUEST, REQUEST_CONTEXT, RESPONSE_INIT, Renderer2, RendererFactory2, RendererStyleFlags2, ResourceStatus, Sanitizer, SecurityContext, Self, SimpleChange, SkipSelf, TRANSLATIONS, TRANSLATIONS_FORMAT, TemplateRef, Testability, TestabilityRegistry, TransferState, Type, VERSION, Version, ViewChild, ViewChildren, ViewContainerRef, ViewEncapsulation, ViewRef, afterNextRender, afterRender, afterRenderEffect, asNativeElements, assertInInjectionContext, assertNotInReactiveContext, assertPlatform, booleanAttribute, computed, contentChild, contentChildren, createComponent, createEnvironmentInjector, createNgModule, createNgModuleRef, createPlatform, createPlatformFactory, defineInjectable, destroyPlatform, effect, enableProdMode, forwardRef, getDebugNode, getModuleFactory, getNgModuleById, getPlatform, importProvidersFrom, inject, input, isDevMode, isSignal, isStandalone, linkedSignal, makeEnvironmentProviders, makeStateKey, mergeApplicationConfig, model, numberAttribute, output, platformCore, provideAppInitializer, provideEnvironmentInitializer, provideExperimentalCheckNoChangesForDebug, provideExperimentalZonelessChangeDetection, providePlatformInitializer, provideZoneChangeDetection, reflectComponentType, resolveForwardRef, resource, runInInjectionContext, setTestabilityGetter, signal, untracked, viewChild, viewChildren, ALLOW_MULTIPLE_PLATFORMS as ɵALLOW_MULTIPLE_PLATFORMS, AfterRenderManager as ɵAfterRenderManager, CONTAINER_HEADER_OFFSET as ɵCONTAINER_HEADER_OFFSET, ChangeDetectionScheduler as ɵChangeDetectionScheduler, ChangeDetectionSchedulerImpl as ɵChangeDetectionSchedulerImpl, ComponentFactory$1 as ɵComponentFactory, Console as ɵConsole, DEFAULT_LOCALE_ID as ɵDEFAULT_LOCALE_ID, DEFER_BLOCK_CONFIG as ɵDEFER_BLOCK_CONFIG, DEFER_BLOCK_DEPENDENCY_INTERCEPTOR as ɵDEFER_BLOCK_DEPENDENCY_INTERCEPTOR, DeferBlockBehavior as ɵDeferBlockBehavior, DeferBlockState as ɵDeferBlockState, ENABLE_ROOT_COMPONENT_BOOTSTRAP as ɵENABLE_ROOT_COMPONENT_BOOTSTRAP, EffectScheduler as ɵEffectScheduler, IMAGE_CONFIG as ɵIMAGE_CONFIG, IMAGE_CONFIG_DEFAULTS as ɵIMAGE_CONFIG_DEFAULTS, INJECTOR_SCOPE as ɵINJECTOR_SCOPE, ɵINPUT_SIGNAL_BRAND_WRITE_TYPE, INTERNAL_APPLICATION_ERROR_HANDLER as ɵINTERNAL_APPLICATION_ERROR_HANDLER, IS_HYDRATION_DOM_REUSE_ENABLED as ɵIS_HYDRATION_DOM_REUSE_ENABLED, IS_INCREMENTAL_HYDRATION_ENABLED as ɵIS_INCREMENTAL_HYDRATION_ENABLED, JSACTION_EVENT_CONTRACT as ɵJSACTION_EVENT_CONTRACT, LContext as ɵLContext, LocaleDataIndex as ɵLocaleDataIndex, MicrotaskEffectScheduler as ɵMicrotaskEffectScheduler, NG_COMP_DEF as ɵNG_COMP_DEF, NG_DIR_DEF as ɵNG_DIR_DEF, NG_ELEMENT_ID as ɵNG_ELEMENT_ID, NG_INJ_DEF as ɵNG_INJ_DEF, NG_MOD_DEF as ɵNG_MOD_DEF, NG_PIPE_DEF as ɵNG_PIPE_DEF, NG_PROV_DEF as ɵNG_PROV_DEF, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR as ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, NO_CHANGE as ɵNO_CHANGE, NgModuleFactory as ɵNgModuleFactory, NoopNgZone as ɵNoopNgZone, PERFORMANCE_MARK_PREFIX as ɵPERFORMANCE_MARK_PREFIX, PROVIDED_NG_ZONE as ɵPROVIDED_NG_ZONE, PendingTasksInternal as ɵPendingTasksInternal, ReflectionCapabilities as ɵReflectionCapabilities, ComponentFactory as ɵRender3ComponentFactory, ComponentRef as ɵRender3ComponentRef, NgModuleRef as ɵRender3NgModuleRef, RuntimeError as ɵRuntimeError, SSR_CONTENT_INTEGRITY_MARKER as ɵSSR_CONTENT_INTEGRITY_MARKER, TESTABILITY as ɵTESTABILITY, TESTABILITY_GETTER as ɵTESTABILITY_GETTER, TracingAction as ɵTracingAction, TracingService as ɵTracingService, USE_RUNTIME_DEPS_TRACKER_FOR_JIT as ɵUSE_RUNTIME_DEPS_TRACKER_FOR_JIT, ViewRef$1 as ɵViewRef, XSS_SECURITY_URL as ɵXSS_SECURITY_URL, ZONELESS_ENABLED as ɵZONELESS_ENABLED, _sanitizeHtml as ɵ_sanitizeHtml, _sanitizeUrl as ɵ_sanitizeUrl, allowSanitizationBypassAndThrow as ɵallowSanitizationBypassAndThrow, annotateForHydration as ɵannotateForHydration, bypassSanitizationTrustHtml as ɵbypassSanitizationTrustHtml, bypassSanitizationTrustResourceUrl as ɵbypassSanitizationTrustResourceUrl, bypassSanitizationTrustScript as ɵbypassSanitizationTrustScript, bypassSanitizationTrustStyle as ɵbypassSanitizationTrustStyle, bypassSanitizationTrustUrl as ɵbypassSanitizationTrustUrl, clearResolutionOfComponentResourcesQueue as ɵclearResolutionOfComponentResourcesQueue, compileComponent as ɵcompileComponent, compileDirective as ɵcompileDirective, compileNgModule as ɵcompileNgModule, compileNgModuleDefs as ɵcompileNgModuleDefs, compileNgModuleFactory as ɵcompileNgModuleFactory, compilePipe as ɵcompilePipe, convertToBitFlags as ɵconvertToBitFlags, createInjector as ɵcreateInjector, defaultIterableDiffers as ɵdefaultIterableDiffers, defaultKeyValueDiffers as ɵdefaultKeyValueDiffers, depsTracker as ɵdepsTracker, detectChangesInViewIfRequired as ɵdetectChangesInViewIfRequired, devModeEqual as ɵdevModeEqual, disableProfiling as ɵdisableProfiling, enableProfiling as ɵenableProfiling, findLocaleData as ɵfindLocaleData, flushModuleScopingQueueAsMuchAsPossible as ɵflushModuleScopingQueueAsMuchAsPossible, formatRuntimeError as ɵformatRuntimeError, generateStandaloneInDeclarationsError as ɵgenerateStandaloneInDeclarationsError, getAsyncClassMetadataFn as ɵgetAsyncClassMetadataFn, getClosestComponentName as ɵgetClosestComponentName, getDebugNode as ɵgetDebugNode, getDeferBlocks$1 as ɵgetDeferBlocks, getDirectives as ɵgetDirectives, getHostElement as ɵgetHostElement, getInjectableDef as ɵgetInjectableDef, getLContext as ɵgetLContext, getLocaleCurrencyCode as ɵgetLocaleCurrencyCode, getLocalePluralCase as ɵgetLocalePluralCase, getOutputDestroyRef as ɵgetOutputDestroyRef, getSanitizationBypassType as ɵgetSanitizationBypassType, ɵgetUnknownElementStrictMode, ɵgetUnknownPropertyStrictMode, _global as ɵglobal, injectChangeDetectorRef as ɵinjectChangeDetectorRef, internalCreateApplication as ɵinternalCreateApplication, internalProvideZoneChangeDetection as ɵinternalProvideZoneChangeDetection, isBoundToModule as ɵisBoundToModule, isComponentDefPendingResolution as ɵisComponentDefPendingResolution, isEnvironmentProviders as ɵisEnvironmentProviders, isInjectable as ɵisInjectable, isNgModule as ɵisNgModule, isPromise as ɵisPromise, isSubscribable as ɵisSubscribable, microtaskEffect as ɵmicrotaskEffect, noSideEffects as ɵnoSideEffects, patchComponentDefWithScope as ɵpatchComponentDefWithScope, performanceMarkFeature as ɵperformanceMarkFeature, publishExternalGlobalUtil as ɵpublishExternalGlobalUtil, readHydrationInfo as ɵreadHydrationInfo, registerLocaleData as ɵregisterLocaleData, renderDeferBlockState as ɵrenderDeferBlockState, resetCompiledComponents as ɵresetCompiledComponents, resetJitOptions as ɵresetJitOptions, resolveComponentResources as ɵresolveComponentResources, restoreComponentResolutionQueue as ɵrestoreComponentResolutionQueue, setAllowDuplicateNgModuleIdsForTest as ɵsetAllowDuplicateNgModuleIdsForTest, setAlternateWeakRefImpl as ɵsetAlternateWeakRefImpl, ɵsetClassDebugInfo, setClassMetadata as ɵsetClassMetadata, setClassMetadataAsync as ɵsetClassMetadataAsync, setCurrentInjector as ɵsetCurrentInjector, setDocument as ɵsetDocument, setInjectorProfilerContext as ɵsetInjectorProfilerContext, setLocaleId as ɵsetLocaleId, ɵsetUnknownElementStrictMode, ɵsetUnknownPropertyStrictMode, startMeasuring as ɵstartMeasuring, stopMeasuring as ɵstopMeasuring, store as ɵstore, stringify as ɵstringify, transitiveScopesFor as ɵtransitiveScopesFor, triggerResourceLoading as ɵtriggerResourceLoading, truncateMiddle as ɵtruncateMiddle, unregisterAllLocaleData as ɵunregisterLocaleData, unwrapSafeValue as ɵunwrapSafeValue, ɵunwrapWritableSignal, withDomHydration as ɵwithDomHydration, withEventReplay as ɵwithEventReplay, withI18nSupport as ɵwithI18nSupport, withIncrementalHydration as ɵwithIncrementalHydration, ɵɵCopyDefinitionFeature, ɵɵExternalStylesFeature, FactoryTarget as ɵɵFactoryTarget, ɵɵHostDirectivesFeature, ɵɵInheritDefinitionFeature, ɵɵInputTransformsFeature, ɵɵNgOnChangesFeature, ɵɵProvidersFeature, ɵɵadvance, ɵɵattachSourceLocations, ɵɵattribute, ɵɵattributeInterpolate1, ɵɵattributeInterpolate2, ɵɵattributeInterpolate3, ɵɵattributeInterpolate4, ɵɵattributeInterpolate5, ɵɵattributeInterpolate6, ɵɵattributeInterpolate7, ɵɵattributeInterpolate8, ɵɵattributeInterpolateV, ɵɵclassMap, ɵɵclassMapInterpolate1, ɵɵclassMapInterpolate2, ɵɵclassMapInterpolate3, ɵɵclassMapInterpolate4, ɵɵclassMapInterpolate5, ɵɵclassMapInterpolate6, ɵɵclassMapInterpolate7, ɵɵclassMapInterpolate8, ɵɵclassMapInterpolateV, ɵɵclassProp, ɵɵcomponentInstance, ɵɵconditional, ɵɵcontentQuery, ɵɵcontentQuerySignal, ɵɵdeclareLet, ɵɵdefer, ɵɵdeferEnableTimerScheduling, ɵɵdeferHydrateNever, ɵɵdeferHydrateOnHover, ɵɵdeferHydrateOnIdle, ɵɵdeferHydrateOnImmediate, ɵɵdeferHydrateOnInteraction, ɵɵdeferHydrateOnTimer, ɵɵdeferHydrateOnViewport, ɵɵdeferHydrateWhen, ɵɵdeferOnHover, ɵɵdeferOnIdle, ɵɵdeferOnImmediate, ɵɵdeferOnInteraction, ɵɵdeferOnTimer, ɵɵdeferOnViewport, ɵɵdeferPrefetchOnHover, ɵɵdeferPrefetchOnIdle, ɵɵdeferPrefetchOnImmediate, ɵɵdeferPrefetchOnInteraction, ɵɵdeferPrefetchOnTimer, ɵɵdeferPrefetchOnViewport, ɵɵdeferPrefetchWhen, ɵɵdeferWhen, ɵɵdefineComponent, ɵɵdefineDirective, ɵɵdefineInjectable, ɵɵdefineInjector, ɵɵdefineNgModule, ɵɵdefinePipe, ɵɵdirectiveInject, ɵɵdisableBindings, ɵɵelement, ɵɵelementContainer, ɵɵelementContainerEnd, ɵɵelementContainerStart, ɵɵelementEnd, ɵɵelementStart, ɵɵenableBindings, ɵɵgetComponentDepsFactory, ɵɵgetCurrentView, ɵɵgetInheritedFactory, ɵɵhostProperty, ɵɵi18n, ɵɵi18nApply, ɵɵi18nAttributes, ɵɵi18nEnd, ɵɵi18nExp, ɵɵi18nPostprocess, ɵɵi18nStart, ɵɵinject, ɵɵinjectAttribute, ɵɵinvalidFactory, ɵɵinvalidFactoryDep, ɵɵlistener, ɵɵloadQuery, ɵɵnamespaceHTML, ɵɵnamespaceMathML, ɵɵnamespaceSVG, ɵɵnextContext, ɵɵngDeclareClassMetadata, ɵɵngDeclareClassMetadataAsync, ɵɵngDeclareComponent, ɵɵngDeclareDirective, ɵɵngDeclareFactory, ɵɵngDeclareInjectable, ɵɵngDeclareInjector, ɵɵngDeclareNgModule, ɵɵngDeclarePipe, ɵɵpipe, ɵɵpipeBind1, ɵɵpipeBind2, ɵɵpipeBind3, ɵɵpipeBind4, ɵɵpipeBindV, ɵɵprojection, ɵɵprojectionDef, ɵɵproperty, ɵɵpropertyInterpolate, ɵɵpropertyInterpolate1, ɵɵpropertyInterpolate2, ɵɵpropertyInterpolate3, ɵɵpropertyInterpolate4, ɵɵpropertyInterpolate5, ɵɵpropertyInterpolate6, ɵɵpropertyInterpolate7, ɵɵpropertyInterpolate8, ɵɵpropertyInterpolateV, ɵɵpureFunction0, ɵɵpureFunction1, ɵɵpureFunction2, ɵɵpureFunction3, ɵɵpureFunction4, ɵɵpureFunction5, ɵɵpureFunction6, ɵɵpureFunction7, ɵɵpureFunction8, ɵɵpureFunctionV, ɵɵqueryAdvance, ɵɵqueryRefresh, ɵɵreadContextLet, ɵɵreference, registerNgModuleType as ɵɵregisterNgModuleType, ɵɵrepeater, ɵɵrepeaterCreate, ɵɵrepeaterTrackByIdentity, ɵɵrepeaterTrackByIndex, ɵɵreplaceMetadata, ɵɵresetView, ɵɵresolveBody, ɵɵresolveDocument, ɵɵresolveWindow, ɵɵrestoreView, ɵɵsanitizeHtml, ɵɵsanitizeResourceUrl, ɵɵsanitizeScript, ɵɵsanitizeStyle, ɵɵsanitizeUrl, ɵɵsanitizeUrlOrResourceUrl, ɵɵsetComponentScope, ɵɵsetNgModuleScope, ɵɵstoreLet, ɵɵstyleMap, ɵɵstyleMapInterpolate1, ɵɵstyleMapInterpolate2, ɵɵstyleMapInterpolate3, ɵɵstyleMapInterpolate4, ɵɵstyleMapInterpolate5, ɵɵstyleMapInterpolate6, ɵɵstyleMapInterpolate7, ɵɵstyleMapInterpolate8, ɵɵstyleMapInterpolateV, ɵɵstyleProp, ɵɵstylePropInterpolate1, ɵɵstylePropInterpolate2, ɵɵstylePropInterpolate3, ɵɵstylePropInterpolate4, ɵɵstylePropInterpolate5, ɵɵstylePropInterpolate6, ɵɵstylePropInterpolate7, ɵɵstylePropInterpolate8, ɵɵstylePropInterpolateV, ɵɵsyntheticHostListener, ɵɵsyntheticHostProperty, ɵɵtemplate, ɵɵtemplateRefExtractor, ɵɵtext, ɵɵtextInterpolate, ɵɵtextInterpolate1, ɵɵtextInterpolate2, ɵɵtextInterpolate3, ɵɵtextInterpolate4, ɵɵtextInterpolate5, ɵɵtextInterpolate6, ɵɵtextInterpolate7, ɵɵtextInterpolate8, ɵɵtextInterpolateV, ɵɵtrustConstantHtml, ɵɵtrustConstantResourceUrl, ɵɵtwoWayBindingSet, ɵɵtwoWayListener, ɵɵtwoWayProperty, ɵɵvalidateIframeAttribute, ɵɵviewQuery, ɵɵviewQuerySignal };
41805
41634
  //# sourceMappingURL=core.mjs.map