@angular/core
Version:
Angular - the core framework
1,065 lines (1,042 loc) • 132 kB
JavaScript
/**
* @license Angular v22.0.0
* (c) 2010-2026 Google LLC. https://angular.dev/
* License: MIT
*/
import { RuntimeError, InjectionToken, getCurrentTNode, assertInInjectionContext, inject, promiseWithResolvers, Injector, signalAsReadonlyFn, ɵɵinject as __inject, ɵɵdefineInjector as __defineInjector, ENVIRONMENT_INITIALIZER, APP_ID, unwrapRNode, CLEANUP, makeEnvironmentProviders, formatRuntimeError, TransferState, DOCUMENT, ChangeDetectionScheduler, NgZone, DOC_PAGE_BASE_URL, DEBUG_TASK_TRACKER, stringify, ɵɵdefineInjectable as __defineInjectable, isComponentHost, getComponentLViewByIndex, DECLARATION_COMPONENT_VIEW, registerSpecialProvider, getLView, provideEnvironmentInitializer, ErrorHandler, ZONELESS_ENABLED, SCHEDULE_IN_ROOT_ZONE_DEFAULT, SCHEDULE_IN_ROOT_ZONE, INTERNAL_APPLICATION_ERROR_HANDLER, PendingTasksInternal, assertNgModuleType, IMAGE_CONFIG, ERROR_DETAILS_PAGE_BASE_URL, PROVIDED_ZONELESS, errorHandlerEnvironmentInitializer, validAppIdInitializer, TVIEW, getLViewParent, R3Injector, NullInjector, INJECTOR, T_HOST, PLATFORM_INITIALIZER, runInInjectionContext, INJECTOR_SCOPE, isLContainer, hasI18n, RENDERER, unwrapLView, HOST, getComponentDef, assertTNode, isProjectionTNode, PARENT, CONTEXT, HEADER_OFFSET, isRootView, CONTAINER_HEADER_OFFSET, assertNotInReactiveContext, ViewContext, DestroyRef, setInjectorProfilerContext, emitAfterRenderEffectPhaseCreatedEvent, getNullInjector, isSignal, effect, _global } from './_pending_tasks-chunk.mjs';
export { ANIMATION_MODULE_TYPE, CSP_NONCE, EnvironmentInjector, EventEmitter, INJECTOR$1 as INJECTOR, PLATFORM_ID, PendingTasks, VERSION, Version, forwardRef, importProvidersFrom, isStandalone, isWritableSignal, makeStateKey, provideBrowserGlobalErrorListeners, resolveForwardRef, signal, EffectScheduler as ɵEffectScheduler, IMAGE_CONFIG_DEFAULTS as ɵIMAGE_CONFIG_DEFAULTS, 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, NoopNgZone as ɵNoopNgZone, XSS_SECURITY_URL as ɵXSS_SECURITY_URL, convertToBitFlags as ɵconvertToBitFlags, createInjector as ɵcreateInjector, getInjectableDef as ɵgetInjectableDef, isEnvironmentProviders as ɵisEnvironmentProviders, isInjectable as ɵisInjectable, store as ɵstore, truncateMiddle as ɵtruncateMiddle, ɵunwrapWritableSignal, ɵɵdisableBindings, ɵɵenableBindings, ɵɵinvalidFactoryDep, ɵɵnamespaceHTML, ɵɵnamespaceMathML, ɵɵnamespaceSVG, ɵɵresetView, ɵɵrestoreView } from './_pending_tasks-chunk.mjs';
import { ɵɵinjectAttribute as __injectAttribute, IDLE_SERVICE, createMultiResultQuerySignalFn, createSingleResultRequiredQuerySignalFn, createSingleResultOptionalQuerySignalFn, makePropDecorator, ɵɵdefineNgModule as __defineNgModule, ApplicationRef, setClassMetadata, NgModule, IS_EVENT_REPLAY_ENABLED, setStashFn, APP_BOOTSTRAP_LISTENER, JSACTION_EVENT_CONTRACT, JSACTION_BLOCK_ELEMENT_MAP, removeListeners, isIncrementalHydrationEnabled, performanceMarkFeature, EVENT_REPLAY_ENABLED_DEFAULT, sharedStashFunction, sharedMapFunction, DEFER_BLOCK_SSR_ID_ATTRIBUTE, invokeListeners, EVENT_REPLAY_QUEUE, triggerHydrationFromBlockName, enableStashEventListenerImpl, IS_HYDRATION_DOM_REUSE_ENABLED, IS_I18N_HYDRATION_ENABLED, IS_INCREMENTAL_HYDRATION_ENABLED, createDehydratedBlockRegistry, DEHYDRATED_BLOCK_REGISTRY, NGH_DATA_KEY, verifySsrContentsIntegrity, enableRetrieveHydrationInfoImpl, enableLocateOrCreateElementNodeImpl, enableLocateOrCreateTextNodeImpl, enableLocateOrCreateContainerRefImpl, enableFindMatchingDehydratedViewImpl, enableLocateOrCreateElementContainerNodeImpl, enableLocateOrCreateContainerAnchorImpl, enableApplyRootElementTransformImpl, setIsI18nHydrationSupportEnabled, Console, PRESERVE_HOST_CONTENT, cleanupDehydratedViews, countBlocksSkippedByHydration, runIncrementalHydrationBootstrap, enableLocateOrCreateI18nNodeImpl, enablePrepareI18nBlockForHydrationImpl, enableClaimDehydratedIcuCaseImpl, provideAppInitializer, isListLikeIterable, iterateListLike, isJsObject, ViewRef as ViewRef$1, checkNoChangesInternal, ChangeDetectionSchedulerImpl, UseExhaustiveCheckNoChanges, ɵɵdefineService as __defineService, Service, NgModuleFactory, COMPILER_OPTIONS, setJitOptions, isComponentResourceResolutionQueueEmpty, getCompilerFacade, resolveComponentResources, getDocument, remove, isPromise, ApplicationInitStatus, LOCALE_ID, DEFAULT_LOCALE_ID, setLocaleId, createNgModuleRefWithProviders, optionsReducer, Injectable, provideZonelessChangeDetectionInternal, getInjectorMetadata, getInjectorProviders, getNodeInjectorTNode, getLContext, walkLViewDirectives, NodeInjector, ChainedInjector, getInjector, getSignalGraph, publishDefaultGlobalUtils, publishSignalConfiguration, profiler, assertStandaloneComponentType, EnvironmentNgModuleRefAdapter, ProfilerEvent, isI18nHydrationEnabled, NGH_DEFER_BLOCKS_KEY, getLNodeForHydration, NGH_ATTR_NAME, SKIP_HYDRATION_ATTR_NAME, isI18nHydrationSupportEnabled, ViewEncapsulation as ViewEncapsulation$1, getOrComputeI18nChildren, trySerializeI18nBlock, I18N_DATA, isTNodeShape, isDetachedByI18n, TEMPLATES, isDisconnectedNode, isInSkipHydrationBlock, unsupportedProjectionOfDomNodes, CONTAINERS, isLetDeclaration, ELEMENT_CONTAINERS, processTextNodeBeforeSerialization, setJSActionAttributes, DISCONNECTED_NODES, NODES, calcPathForNode, NUM_ROOT_NODES, TEMPLATE_ID, isDeferBlock, getLDeferBlockDetails, getTDeferBlockDetails, collectNativeNodesInLContainer, validateNodeExists, validateMatchingNode, DEFER_BLOCK_ID, DEFER_BLOCK_STATE, DEFER_BLOCK_STATE$1, MULTIPLIER, collectNativeNodes, convertHydrateTriggersToJsAction, DEFER_HYDRATE_TRIGGERS, DEFER_PARENT_BLOCK_ID, NOOP_AFTER_RENDER_REF, AfterRenderManager, TracingService, AfterRenderImpl, AfterRenderSequence, AFTER_RENDER_PHASES, setClassMetadataAsync, angularCoreEnv, getRegisteredNgModuleType, assertComponentDef, ComponentFactory } from './_debug_node-chunk.mjs';
export { APP_INITIALIZER, Attribute, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, Compiler, CompilerFactory, Component, ComponentRef, DEFAULT_CURRENCY_CODE, DebugElement, DebugEventListener, DebugNode, Directive, ElementRef, Host, HostBinding, HostListener, Inject, Input, MAX_ANIMATION_TIMEOUT, MissingTranslationStrategy, NO_ERRORS_SCHEMA, NgModuleFactory$1 as NgModuleFactory, NgModuleRef$1 as NgModuleRef, Optional, Output, Pipe, QueryList, Renderer2, RendererFactory2, RendererStyleFlags2, Sanitizer, SecurityContext, Self, SimpleChange, SkipSelf, TRANSLATIONS, TRANSLATIONS_FORMAT, TemplateRef, Testability, TestabilityRegistry, Type, ViewContainerRef, afterEveryRender, afterNextRender, asNativeElements, createEnvironmentInjector, createNgModule, enableProfiling, getDebugNode, inputBinding, outputBinding, provideIdleServiceWith, provideNgReflectAttributes, provideZonelessChangeDetection, setTestabilityGetter, twoWayBinding, ANIMATIONS_DISABLED as ɵANIMATIONS_DISABLED, AcxChangeDetectionStrategy as ɵAcxChangeDetectionStrategy, AcxViewEncapsulation as ɵAcxViewEncapsulation, ControlFlowBlockType as ɵControlFlowBlockType, DEFER_BLOCK_CONFIG as ɵDEFER_BLOCK_CONFIG, DEFER_BLOCK_DEPENDENCY_INTERCEPTOR as ɵDEFER_BLOCK_DEPENDENCY_INTERCEPTOR, DeferBlockBehavior as ɵDeferBlockBehavior, DeferBlockState as ɵDeferBlockState, HydrationStatus as ɵHydrationStatus, IS_ENABLED_BLOCKING_INITIAL_NAVIGATION as ɵIS_ENABLED_BLOCKING_INITIAL_NAVIGATION, LContext as ɵLContext, LocaleDataIndex as ɵLocaleDataIndex, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR as ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, NO_CHANGE as ɵNO_CHANGE, ReflectionCapabilities as ɵReflectionCapabilities, ComponentRef$1 as ɵRender3ComponentRef, NgModuleRef as ɵRender3NgModuleRef, SHARED_STYLES_HOST as ɵSHARED_STYLES_HOST, SSR_CONTENT_INTEGRITY_MARKER as ɵSSR_CONTENT_INTEGRITY_MARKER, TESTABILITY as ɵTESTABILITY, TESTABILITY_GETTER as ɵTESTABILITY_GETTER, TimerScheduler as ɵTimerScheduler, TracingAction as ɵTracingAction, USE_PENDING_TASKS as ɵUSE_PENDING_TASKS, _sanitizeHtml as ɵ_sanitizeHtml, _sanitizeUrl as ɵ_sanitizeUrl, allLeavingAnimations as ɵallLeavingAnimations, allowSanitizationBypassAndThrow as ɵallowSanitizationBypassAndThrow, 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, compilePipe as ɵcompilePipe, depsTracker as ɵdepsTracker, devModeEqual as ɵdevModeEqual, findLocaleData as ɵfindLocaleData, flushModuleScopingQueueAsMuchAsPossible as ɵflushModuleScopingQueueAsMuchAsPossible, generateStandaloneInDeclarationsError as ɵgenerateStandaloneInDeclarationsError, getAsyncClassMetadataFn as ɵgetAsyncClassMetadataFn, getClosestComponentName as ɵgetClosestComponentName, getDeferBlocks as ɵgetDeferBlocks, getDirectives as ɵgetDirectives, getHostElement as ɵgetHostElement, getLocaleCurrencyCode as ɵgetLocaleCurrencyCode, getLocalePluralCase as ɵgetLocalePluralCase, getSanitizationBypassType as ɵgetSanitizationBypassType, getTransferState as ɵgetTransferState, ɵgetUnknownElementStrictMode, ɵgetUnknownPropertyStrictMode, inferTagNameFromDefinition as ɵinferTagNameFromDefinition, isComponentDefPendingResolution as ɵisComponentDefPendingResolution, isNgModule as ɵisNgModule, isSubscribable as ɵisSubscribable, isViewDirty as ɵisViewDirty, markForRefresh as ɵmarkForRefresh, noSideEffects as ɵnoSideEffects, patchComponentDefWithScope as ɵpatchComponentDefWithScope, publishNonCoreGlobalUtil as ɵpublishNonCoreGlobalUtil, readHydrationInfo as ɵreadHydrationInfo, registerLocaleData as ɵregisterLocaleData, renderDeferBlockState as ɵrenderDeferBlockState, resetCompiledComponents as ɵresetCompiledComponents, resetIncrementalHydrationEnabledWarnedForTests as ɵresetIncrementalHydrationEnabledWarnedForTests, resetJitOptions as ɵresetJitOptions, restoreComponentResolutionQueue as ɵrestoreComponentResolutionQueue, setAllowDuplicateNgModuleIdsForTest as ɵsetAllowDuplicateNgModuleIdsForTest, ɵsetClassDebugInfo, setDocument as ɵsetDocument, ɵsetUnknownElementStrictMode, ɵsetUnknownPropertyStrictMode, transitiveScopesFor as ɵtransitiveScopesFor, triggerResourceLoading as ɵtriggerResourceLoading, unregisterAllLocaleData as ɵunregisterLocaleData, unwrapSafeValue as ɵunwrapSafeValue, ɵɵControlFeature, ɵɵExternalStylesFeature, ɵɵHostDirectivesFeature, ɵɵInheritDefinitionFeature, ɵɵNgOnChangesFeature, ɵɵProvidersFeature, ɵɵadvance, ɵɵanimateEnter, ɵɵanimateEnterListener, ɵɵanimateLeave, ɵɵanimateLeaveListener, ɵɵariaProperty, ɵɵarrowFunction, ɵɵattachSourceLocations, ɵɵattribute, ɵɵclassMap, ɵɵclassProp, ɵɵcomponentInstance, ɵɵconditional, ɵɵconditionalBranchCreate, ɵɵconditionalCreate, ɵɵcontentQuery, ɵɵcontentQuerySignal, ɵɵcontrol, ɵɵcontrolCreate, ɵɵ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, ɵɵdefinePipe, ɵɵdirectiveInject, ɵɵdomElement, ɵɵdomElementContainer, ɵɵdomElementContainerEnd, ɵɵdomElementContainerStart, ɵɵdomElementEnd, ɵɵdomElementStart, ɵɵdomListener, ɵɵdomProperty, ɵɵdomTemplate, ɵɵelement, ɵɵelementContainer, ɵɵelementContainerEnd, ɵɵelementContainerStart, ɵɵelementEnd, ɵɵelementStart, ɵɵenableIncrementalHydrationRuntime, ɵɵgetComponentDepsFactory, ɵɵgetCurrentView, ɵɵgetInheritedFactory, ɵɵgetReplaceMetadataURL, ɵɵi18n, ɵɵi18nApply, ɵɵi18nAttributes, ɵɵi18nEnd, ɵɵi18nExp, ɵɵi18nPostprocess, ɵɵi18nStart, ɵɵinterpolate, ɵɵinterpolate1, ɵɵinterpolate2, ɵɵinterpolate3, ɵɵinterpolate4, ɵɵinterpolate5, ɵɵinterpolate6, ɵɵinterpolate7, ɵɵinterpolate8, ɵɵinterpolateV, ɵɵinvalidFactory, ɵɵlistener, ɵɵloadQuery, ɵɵnextContext, ɵɵpipe, ɵɵpipeBind1, ɵɵpipeBind2, ɵɵpipeBind3, ɵɵpipeBind4, ɵɵpipeBindV, ɵɵprojection, ɵɵprojectionDef, ɵɵproperty, ɵɵpureFunction0, ɵɵpureFunction1, ɵɵpureFunction2, ɵɵpureFunction3, ɵɵpureFunction4, ɵɵpureFunction5, ɵɵpureFunction6, ɵɵpureFunction7, ɵɵpureFunction8, ɵɵpureFunctionV, ɵɵqueryAdvance, ɵɵqueryRefresh, ɵɵreadContextLet, ɵɵreference, registerNgModuleType as ɵɵregisterNgModuleType, ɵɵrepeater, ɵɵrepeaterCreate, ɵɵrepeaterTrackByIdentity, ɵɵrepeaterTrackByIndex, ɵɵreplaceMetadata, ɵɵresolveBody, ɵɵresolveDocument, ɵɵresolveWindow, ɵɵsanitizeHtml, ɵɵsanitizeResourceUrl, ɵɵsanitizeScript, ɵɵsanitizeStyle, ɵɵsanitizeUrl, ɵɵsanitizeUrlOrResourceUrl, ɵɵsetComponentScope, ɵɵsetNgModuleScope, ɵɵstoreLet, ɵɵstyleMap, ɵɵstyleProp, ɵɵsyntheticHostListener, ɵɵsyntheticHostProperty, ɵɵtemplate, ɵɵtemplateRefExtractor, ɵɵtext, ɵɵtextInterpolate, ɵɵtextInterpolate1, ɵɵtextInterpolate2, ɵɵtextInterpolate3, ɵɵtextInterpolate4, ɵɵtextInterpolate5, ɵɵtextInterpolate6, ɵɵtextInterpolate7, ɵɵtextInterpolate8, ɵɵtextInterpolateV, ɵɵtrustConstantHtml, ɵɵtrustConstantResourceUrl, ɵɵtwoWayBindingSet, ɵɵtwoWayListener, ɵɵtwoWayProperty, ɵɵvalidateAttribute, ɵɵviewQuery, ɵɵviewQuerySignal } from './_debug_node-chunk.mjs';
import { OutputEmitterRef, computed, ResourceValueError, linkedSignal, isInParamsFunction, invalidResourceCreationInParams, setInParamsFunction, rethrowFatalErrors, untracked } from './_resource-chunk.mjs';
export { ResourceDependencyError, ResourceParamsStatus, resource, CACHE_ACTIVE as ɵCACHE_ACTIVE, ResourceImpl as ɵResourceImpl, chain as ɵchain, encapsulateResourceError as ɵencapsulateResourceError, getOutputDestroyRef as ɵgetOutputDestroyRef } from './_resource-chunk.mjs';
import { Subscription } from 'rxjs';
import { SIGNAL_NODE, signalSetFn, SIGNAL, producerAccessed, consumerDestroy, consumerPollProducersForChange, consumerBeforeComputation, consumerAfterComputation } from './_effect-chunk.mjs';
import { clearAppScopedEarlyEventContract, EventContract, EventContractContainer, EventDispatcher, registerDispatcher, getAppScopedQueuedEventInfos, EventPhase, isEarlyEventType, isCaptureEventType } from './primitives-event-dispatch.mjs';
export { setAlternateWeakRefImpl as ɵsetAlternateWeakRefImpl } from './_weak_ref-chunk.mjs';
export { setCurrentInjector as ɵsetCurrentInjector } from './_not_found-chunk.mjs';
import '@angular/core/primitives/signals';
import '@angular/core/primitives/di';
import 'rxjs/operators';
import './_attribute-chunk.mjs';
import './_untracked-chunk.mjs';
const REQUIRED_UNSET_VALUE = /* @__PURE__ */Symbol('InputSignalNode#UNSET');
const INPUT_SIGNAL_NODE = /* @__PURE__ */(() => {
return {
...SIGNAL_NODE,
transformFn: undefined,
applyValueToInputSignal(node, value) {
signalSetFn(node, value);
}
};
})();
const ɵINPUT_SIGNAL_BRAND_WRITE_TYPE = /* @__PURE__ */Symbol();
function createInputSignal(initialValue, options) {
const node = Object.create(INPUT_SIGNAL_NODE);
node.value = initialValue;
node.transformFn = options?.transform;
function inputValueFn() {
producerAccessed(node);
if (node.value === REQUIRED_UNSET_VALUE) {
let message = null;
if (ngDevMode) {
const name = options?.debugName ?? options?.alias;
message = `Input${name ? ` "${name}"` : ''} is required but no value is available yet.`;
}
throw new RuntimeError(-950, message);
}
return node.value;
}
inputValueFn[SIGNAL] = node;
if (ngDevMode) {
inputValueFn.toString = () => `[Input Signal: ${inputValueFn()}]`;
node.debugName = options?.debugName;
}
return inputValueFn;
}
var Framework;
(function (Framework) {
Framework["Angular"] = "angular";
Framework["ACX"] = "acx";
Framework["Wiz"] = "wiz";
})(Framework || (Framework = {}));
class HostAttributeToken {
attributeName;
constructor(attributeName) {
this.attributeName = attributeName;
}
__NG_ELEMENT_ID__ = () => __injectAttribute(this.attributeName);
toString() {
return `HostAttributeToken ${this.attributeName}`;
}
}
const HOST_TAG_NAME = /* @__PURE__ */(() => {
const HOST_TAG_NAME_TOKEN = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'HOST_TAG_NAME' : '');
HOST_TAG_NAME_TOKEN.__NG_ELEMENT_ID__ = flags => {
const tNode = getCurrentTNode();
if (tNode === null) {
throw new RuntimeError(-204, ngDevMode && 'HOST_TAG_NAME can only be injected in directives and components ' + 'during construction time (in a class constructor or as a class field initializer)');
}
if (tNode.type & 2) {
return tNode.value;
}
if (flags & 8) {
return null;
}
throw new RuntimeError(-204, ngDevMode && `HOST_TAG_NAME was used on ${getDevModeNodeName(tNode)} which doesn't have an underlying element in the DOM. ` + `This is invalid, and so the dependency should be marked as optional.`);
};
return HOST_TAG_NAME_TOKEN;
})();
function getDevModeNodeName(tNode) {
if (tNode.type & 8) {
return 'an <ng-container>';
} else if (tNode.type & 4) {
return 'an <ng-template>';
} else if (tNode.type & 128) {
return 'an @let declaration';
} else {
return 'a node';
}
}
function maybeUnwrapDefaultExport(input) {
return isWrappedDefaultExport(input) ? input['default'] : input;
}
function isWrappedDefaultExport(value) {
return value && typeof value === 'object' && 'default' in value;
}
function injectAsync(loader, options) {
if (ngDevMode) {
assertInInjectionContext(injectAsync);
}
const injector = inject(Injector);
let loadedPromise = null;
const load = () => {
if (!loadedPromise) {
loadedPromise = loader();
}
return loadedPromise;
};
if (options?.prefetch) {
options.prefetch().then(() => load());
}
return () => load().then(loadedToken => injector.get(maybeUnwrapDefaultExport(loadedToken)));
}
function onIdle(options) {
if (ngDevMode) {
assertInInjectionContext(injectAsync);
}
const idleService = inject(IDLE_SERVICE);
const {
promise,
resolve
} = promiseWithResolvers();
idleService.requestOnIdle(() => resolve(), options);
return promise;
}
var FactoryTarget;
(function (FactoryTarget) {
FactoryTarget[FactoryTarget["Directive"] = 0] = "Directive";
FactoryTarget[FactoryTarget["Component"] = 1] = "Component";
FactoryTarget[FactoryTarget["Injectable"] = 2] = "Injectable";
FactoryTarget[FactoryTarget["Pipe"] = 3] = "Pipe";
FactoryTarget[FactoryTarget["NgModule"] = 4] = "NgModule";
FactoryTarget[FactoryTarget["Service"] = 5] = "Service";
})(FactoryTarget || (FactoryTarget = {}));
var R3TemplateDependencyKind;
(function (R3TemplateDependencyKind) {
R3TemplateDependencyKind[R3TemplateDependencyKind["Directive"] = 0] = "Directive";
R3TemplateDependencyKind[R3TemplateDependencyKind["Pipe"] = 1] = "Pipe";
R3TemplateDependencyKind[R3TemplateDependencyKind["NgModule"] = 2] = "NgModule";
})(R3TemplateDependencyKind || (R3TemplateDependencyKind = {}));
var ViewEncapsulation;
(function (ViewEncapsulation) {
ViewEncapsulation[ViewEncapsulation["Emulated"] = 0] = "Emulated";
ViewEncapsulation[ViewEncapsulation["None"] = 2] = "None";
ViewEncapsulation[ViewEncapsulation["ShadowDom"] = 3] = "ShadowDom";
ViewEncapsulation[ViewEncapsulation["ExperimentalIsolatedShadowDom"] = 4] = "ExperimentalIsolatedShadowDom";
})(ViewEncapsulation || (ViewEncapsulation = {}));
function output(opts) {
ngDevMode && assertInInjectionContext(output);
return new OutputEmitterRef();
}
function inputFunction(initialValue, opts) {
ngDevMode && assertInInjectionContext(input);
return createInputSignal(initialValue, opts);
}
function inputRequiredFunction(opts) {
ngDevMode && assertInInjectionContext(input);
return createInputSignal(REQUIRED_UNSET_VALUE, opts);
}
const input = (() => {
inputFunction.required = inputRequiredFunction;
return inputFunction;
})();
function createModelSignal(initialValue, opts) {
const node = Object.create(INPUT_SIGNAL_NODE);
const emitterRef = new OutputEmitterRef();
node.value = initialValue;
function getter() {
producerAccessed(node);
assertModelSet(node.value);
return node.value;
}
getter[SIGNAL] = node;
getter.asReadonly = signalAsReadonlyFn.bind(getter);
getter.set = newValue => {
if (!node.equal(node.value, newValue)) {
signalSetFn(node, newValue);
emitterRef.emit(newValue);
}
};
getter.update = updateFn => {
assertModelSet(node.value);
getter.set(updateFn(node.value));
};
getter.subscribe = emitterRef.subscribe.bind(emitterRef);
getter.destroyRef = emitterRef.destroyRef;
if (ngDevMode) {
getter.toString = () => `[Model Signal: ${getter()}]`;
node.debugName = opts?.debugName;
}
return getter;
}
function assertModelSet(value) {
if (value === REQUIRED_UNSET_VALUE) {
throw new RuntimeError(952, ngDevMode && 'Model is required but no value is available yet.');
}
}
function modelFunction(initialValue, opts) {
ngDevMode && assertInInjectionContext(model);
return createModelSignal(initialValue, opts);
}
function modelRequiredFunction(opts) {
ngDevMode && assertInInjectionContext(model);
return createModelSignal(REQUIRED_UNSET_VALUE, opts);
}
const model = (() => {
modelFunction.required = modelRequiredFunction;
return modelFunction;
})();
function viewChildFn(locator, opts) {
ngDevMode && assertInInjectionContext(viewChild);
return createSingleResultOptionalQuerySignalFn(opts);
}
function viewChildRequiredFn(locator, opts) {
ngDevMode && assertInInjectionContext(viewChild);
return createSingleResultRequiredQuerySignalFn(opts);
}
const viewChild = (() => {
viewChildFn.required = viewChildRequiredFn;
return viewChildFn;
})();
function viewChildren(locator, opts) {
ngDevMode && assertInInjectionContext(viewChildren);
return createMultiResultQuerySignalFn(opts);
}
function contentChildFn(locator, opts) {
ngDevMode && assertInInjectionContext(contentChild);
return createSingleResultOptionalQuerySignalFn(opts);
}
function contentChildRequiredFn(locator, opts) {
ngDevMode && assertInInjectionContext(contentChildren);
return createSingleResultRequiredQuerySignalFn(opts);
}
const contentChild = (() => {
contentChildFn.required = contentChildRequiredFn;
return contentChildFn;
})();
function contentChildren(locator, opts) {
return createMultiResultQuerySignalFn(opts);
}
function mergeApplicationConfig(...configs) {
return configs.reduce((prev, curr) => {
return Object.assign(prev, curr, {
providers: [...prev.providers, ...curr.providers]
});
}, {
providers: []
});
}
const emitDistinctChangesOnlyDefaultValue = true;
class Query {}
const ContentChildren = makePropDecorator('ContentChildren', (selector, opts = {}) => ({
selector,
first: false,
isViewQuery: false,
descendants: false,
emitDistinctChangesOnly: emitDistinctChangesOnlyDefaultValue,
...opts
}), Query);
const ContentChild = makePropDecorator('ContentChild', (selector, opts = {}) => ({
selector,
first: true,
isViewQuery: false,
descendants: true,
...opts
}), Query);
const ViewChildren = makePropDecorator('ViewChildren', (selector, opts = {}) => ({
selector,
first: false,
isViewQuery: true,
descendants: true,
emitDistinctChangesOnly: emitDistinctChangesOnlyDefaultValue,
...opts
}), Query);
const ViewChild = makePropDecorator('ViewChild', (selector, opts) => ({
selector,
first: true,
isViewQuery: true,
descendants: true,
...opts
}), Query);
class ApplicationModule {
constructor(appRef) {}
static ɵfac = function ApplicationModule_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || ApplicationModule)(__inject(ApplicationRef));
};
static ɵmod = /*@__PURE__*/__defineNgModule({
type: ApplicationModule
});
static ɵinj = /*@__PURE__*/__defineInjector({});
}
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ApplicationModule, [{
type: NgModule
}], () => [{
type: ApplicationRef
}], null);
})();
const REQUEST = new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'REQUEST' : '', {
providedIn: 'platform',
factory: () => null
});
const RESPONSE_INIT = new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'RESPONSE_INIT' : '', {
providedIn: 'platform',
factory: () => null
});
const REQUEST_CONTEXT = new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'REQUEST_CONTEXT' : '', {
providedIn: 'platform',
factory: () => null
});
const appsWithEventReplay = new WeakSet();
const EAGER_CONTENT_LISTENERS_KEY = '';
function shouldEnableEventReplay(injector) {
return injector.get(IS_EVENT_REPLAY_ENABLED, EVENT_REPLAY_ENABLED_DEFAULT);
}
function withEventReplay() {
const providers = [{
provide: IS_EVENT_REPLAY_ENABLED,
useFactory: () => {
let isEnabled = true;
if (typeof ngServerMode === 'undefined' || !ngServerMode) {
const appId = inject(APP_ID);
isEnabled = !!window._ejsas?.[appId];
}
if (isEnabled) {
performanceMarkFeature('NgEventReplay');
}
return isEnabled;
}
}];
if (typeof ngServerMode === 'undefined' || !ngServerMode) {
providers.push({
provide: ENVIRONMENT_INITIALIZER,
useValue: () => {
const appRef = inject(ApplicationRef);
const {
injector
} = appRef;
if (!appsWithEventReplay.has(appRef)) {
const jsActionMap = inject(JSACTION_BLOCK_ELEMENT_MAP);
if (shouldEnableEventReplay(injector)) {
enableStashEventListenerImpl();
const appId = injector.get(APP_ID);
const clearStashFn = setStashFn(appId, (rEl, eventName, listenerFn) => {
if (rEl.nodeType !== Node.ELEMENT_NODE) return;
sharedStashFunction(rEl, eventName, listenerFn);
sharedMapFunction(rEl, jsActionMap);
});
appRef.onDestroy(clearStashFn);
}
}
},
multi: true
}, {
provide: APP_BOOTSTRAP_LISTENER,
useFactory: () => {
const appRef = inject(ApplicationRef);
const {
injector
} = appRef;
return () => {
if (!shouldEnableEventReplay(injector) || appsWithEventReplay.has(appRef)) {
return;
}
appsWithEventReplay.add(appRef);
const appId = injector.get(APP_ID);
appRef.onDestroy(() => {
appsWithEventReplay.delete(appRef);
if (typeof ngServerMode !== 'undefined' && !ngServerMode) {
clearAppScopedEarlyEventContract(appId);
}
});
appRef.whenStable().then(() => {
if (appRef.destroyed) {
return;
}
const eventContractDetails = injector.get(JSACTION_EVENT_CONTRACT);
initEventReplay(eventContractDetails, injector);
const jsActionMap = injector.get(JSACTION_BLOCK_ELEMENT_MAP);
jsActionMap.get(EAGER_CONTENT_LISTENERS_KEY)?.forEach(removeListeners);
jsActionMap.delete(EAGER_CONTENT_LISTENERS_KEY);
const eventContract = eventContractDetails.instance;
if (isIncrementalHydrationEnabled(injector)) {
appRef.onDestroy(() => eventContract.cleanUp());
} else {
eventContract.cleanUp();
}
});
};
},
multi: true
});
}
return providers;
}
const initEventReplay = (eventDelegation, injector) => {
const appId = injector.get(APP_ID);
const earlyJsactionData = window._ejsas[appId];
const eventContract = eventDelegation.instance = new EventContract(new EventContractContainer(earlyJsactionData.c));
for (const et of earlyJsactionData.et) {
eventContract.addEvent(et);
}
for (const et of earlyJsactionData.etc) {
eventContract.addEvent(et);
}
const eventInfos = getAppScopedQueuedEventInfos(appId);
eventContract.replayEarlyEventInfos(eventInfos);
clearAppScopedEarlyEventContract(appId);
const dispatcher = new EventDispatcher(event => {
invokeRegisteredReplayListeners(injector, event, event.currentTarget);
});
registerDispatcher(eventContract, dispatcher);
};
function collectDomEventsInfo(tView, lView, eventTypesToReplay) {
const domEventsInfo = new Map();
const lCleanup = lView[CLEANUP];
const tCleanup = tView.cleanup;
if (!tCleanup || !lCleanup) {
return domEventsInfo;
}
for (let i = 0; i < tCleanup.length;) {
const firstParam = tCleanup[i++];
const secondParam = tCleanup[i++];
if (typeof firstParam !== 'string') {
continue;
}
const eventType = firstParam;
if (!isEarlyEventType(eventType)) {
continue;
}
if (isCaptureEventType(eventType)) {
eventTypesToReplay.capture.add(eventType);
} else {
eventTypesToReplay.regular.add(eventType);
}
const listenerElement = unwrapRNode(lView[secondParam]);
i++;
const useCaptureOrIndx = tCleanup[i++];
const isDomEvent = typeof useCaptureOrIndx === 'boolean' || useCaptureOrIndx >= 0;
if (!isDomEvent) {
continue;
}
if (!domEventsInfo.has(listenerElement)) {
domEventsInfo.set(listenerElement, [eventType]);
} else {
domEventsInfo.get(listenerElement).push(eventType);
}
}
return domEventsInfo;
}
function invokeRegisteredReplayListeners(injector, event, currentTarget) {
const blockName = (currentTarget && currentTarget.getAttribute(DEFER_BLOCK_SSR_ID_ATTRIBUTE)) ?? '';
if (/d\d+/.test(blockName)) {
hydrateAndInvokeBlockListeners(blockName, injector, event, currentTarget);
} else if (event.eventPhase === EventPhase.REPLAY) {
invokeListeners(event, currentTarget);
}
}
function hydrateAndInvokeBlockListeners(blockName, injector, event, currentTarget) {
const queue = injector.get(EVENT_REPLAY_QUEUE);
queue.push({
event,
currentTarget
});
triggerHydrationFromBlockName(injector, blockName, createReplayQueuedBlockEventsFn(queue));
}
function createReplayQueuedBlockEventsFn(queue) {
return hydratedBlocks => {
const hydrated = new Set(hydratedBlocks);
const newQueue = [];
for (let {
event,
currentTarget
} of queue) {
const blockName = currentTarget.getAttribute(DEFER_BLOCK_SSR_ID_ATTRIBUTE);
if (hydrated.has(blockName)) {
invokeListeners(event, currentTarget);
} else {
newQueue.push({
event,
currentTarget
});
}
}
queue.length = 0;
queue.push(...newQueue);
};
}
let isHydrationSupportEnabled = false;
let isI18nHydrationRuntimeSupportEnabled = false;
const APPLICATION_IS_STABLE_TIMEOUT = 10_000;
function enableHydrationRuntimeSupport() {
if (!isHydrationSupportEnabled) {
isHydrationSupportEnabled = true;
enableRetrieveHydrationInfoImpl();
enableLocateOrCreateElementNodeImpl();
enableLocateOrCreateTextNodeImpl();
enableLocateOrCreateElementContainerNodeImpl();
enableLocateOrCreateContainerAnchorImpl();
enableLocateOrCreateContainerRefImpl();
enableFindMatchingDehydratedViewImpl();
enableApplyRootElementTransformImpl();
}
}
function enableI18nHydrationRuntimeSupport() {
if (!isI18nHydrationRuntimeSupportEnabled) {
isI18nHydrationRuntimeSupportEnabled = true;
enableLocateOrCreateI18nNodeImpl();
enablePrepareI18nBlockForHydrationImpl();
enableClaimDehydratedIcuCaseImpl();
}
}
function printHydrationStats(injector) {
const console = injector.get(Console);
const message = `Angular hydrated ${ngDevMode.hydratedComponents} component(s) ` + `and ${ngDevMode.hydratedNodes} node(s), ` + `${ngDevMode.componentsSkippedHydration} component(s) were skipped. ` + (isIncrementalHydrationEnabled(injector) ? `${ngDevMode.deferBlocksWithIncrementalHydration} defer block(s) were configured to use incremental hydration. ` : '') + `Learn more at ${DOC_PAGE_BASE_URL}/guide/hydration.`;
console.log(message);
}
function whenStableWithTimeout(appRef) {
const whenStablePromise = appRef.whenStable();
if (typeof ngDevMode !== 'undefined' && ngDevMode) {
const timeoutTime = APPLICATION_IS_STABLE_TIMEOUT;
const console = appRef.injector.get(Console);
const ngZone = appRef.injector.get(NgZone);
const timeoutId = ngZone.runOutsideAngular(() => {
return setTimeout(() => logWarningOnStableTimedout(timeoutTime, console), timeoutTime);
});
whenStablePromise.finally(() => clearTimeout(timeoutId));
}
return whenStablePromise;
}
const CLIENT_RENDER_MODE_FLAG = 'ngcm';
function isClientRenderModeEnabled(doc) {
return (typeof ngServerMode === 'undefined' || !ngServerMode) && doc.body.hasAttribute(CLIENT_RENDER_MODE_FLAG);
}
function withDomHydration() {
const providers = [{
provide: IS_HYDRATION_DOM_REUSE_ENABLED,
useFactory: () => {
let isEnabled = true;
if (typeof ngServerMode === 'undefined' || !ngServerMode) {
const transferState = inject(TransferState, {
optional: true
});
isEnabled = !!transferState?.get(NGH_DATA_KEY, null);
}
if (isEnabled) {
performanceMarkFeature('NgHydration');
}
return isEnabled;
}
}, {
provide: ENVIRONMENT_INITIALIZER,
useValue: () => {
setIsI18nHydrationSupportEnabled(false);
if (typeof ngServerMode !== 'undefined' && ngServerMode) {
return;
}
const doc = inject(DOCUMENT);
if (inject(IS_HYDRATION_DOM_REUSE_ENABLED)) {
verifySsrContentsIntegrity(doc);
enableHydrationRuntimeSupport();
} else if (typeof ngDevMode !== 'undefined' && ngDevMode && !isClientRenderModeEnabled(doc)) {
const console = inject(Console);
const message = formatRuntimeError(-505, 'Angular hydration was requested on the client, but there was no ' + 'serialized information present in the server response, ' + 'thus hydration was not enabled. ' + 'Make sure the `provideClientHydration()` is included into the list ' + 'of providers in the server part of the application configuration.');
console.warn(message);
}
},
multi: true
}];
if (typeof ngServerMode === 'undefined' || !ngServerMode) {
providers.push({
provide: PRESERVE_HOST_CONTENT,
useFactory: () => {
return inject(IS_HYDRATION_DOM_REUSE_ENABLED);
}
}, {
provide: APP_BOOTSTRAP_LISTENER,
useFactory: () => {
const scheduler = inject(ChangeDetectionScheduler);
if (inject(IS_HYDRATION_DOM_REUSE_ENABLED)) {
const appRef = inject(ApplicationRef);
return () => {
whenStableWithTimeout(appRef).then(() => {
if (appRef.destroyed) {
return;
}
cleanupDehydratedViews(appRef);
if (typeof ngDevMode !== 'undefined' && ngDevMode) {
countBlocksSkippedByHydration(appRef.injector);
printHydrationStats(appRef.injector);
}
scheduler.notify(7);
});
};
}
return () => {};
},
multi: true
});
}
return makeEnvironmentProviders(providers);
}
function withI18nSupport() {
return [{
provide: IS_I18N_HYDRATION_ENABLED,
useFactory: () => inject(IS_HYDRATION_DOM_REUSE_ENABLED)
}, {
provide: ENVIRONMENT_INITIALIZER,
useValue: () => {
if (inject(IS_HYDRATION_DOM_REUSE_ENABLED)) {
enableI18nHydrationRuntimeSupport();
setIsI18nHydrationSupportEnabled(true);
performanceMarkFeature('NgI18nHydration');
}
},
multi: true
}];
}
function withIncrementalHydration() {
const providers = [withEventReplay(), {
provide: IS_INCREMENTAL_HYDRATION_ENABLED,
useValue: true
}, {
provide: DEHYDRATED_BLOCK_REGISTRY,
useFactory: createDehydratedBlockRegistry
}];
if (typeof ngServerMode === 'undefined' || !ngServerMode) {
providers.push({
provide: APP_BOOTSTRAP_LISTENER,
useFactory: () => {
const injector = inject(Injector);
const doc = inject(DOCUMENT);
return () => {
runIncrementalHydrationBootstrap(injector, doc);
};
},
multi: true
});
}
return providers;
}
function logWarningOnStableTimedout(time, console) {
const message = `Angular hydration expected the ApplicationRef.isStable() to emit \`true\`, but it ` + `didn't happen within ${time}ms. Angular hydration logic depends on the application becoming stable ` + `as a signal to complete hydration process.`;
console.warn(formatRuntimeError(-506, message));
}
const STABILITY_WARNING_THRESHOLD = APPLICATION_IS_STABLE_TIMEOUT - 1_000;
class DebugTaskTrackerImpl {
openTasks = new Map();
add(taskId) {
this.openTasks.set(taskId, new Error('Task stack tracking error'));
}
remove(taskId) {
this.openTasks.delete(taskId);
}
}
function provideStabilityDebugging() {
const taskTracker = new DebugTaskTrackerImpl();
const {
openTasks
} = taskTracker;
return makeEnvironmentProviders([{
provide: DEBUG_TASK_TRACKER,
useValue: taskTracker
}, provideAppInitializer(() => {
if (typeof ngDevMode === 'undefined' || !ngDevMode) {
console.warn('Stability debugging utility was provided in production mode. ' + 'This will cause debug code to be included in production bundles. ' + 'If this is intentional because you are debugging stability issues in a production environment, you can ignore this warning.');
}
const ngZone = inject(NgZone);
const applicationRef = inject(ApplicationRef);
let _taskTrackingZone = null;
if (typeof Zone !== 'undefined') {
ngZone.run(() => {
_taskTrackingZone = Zone.current.get('TaskTrackingZone');
});
}
ngZone.runOutsideAngular(() => {
const timeoutId = setTimeout(() => {
console.debug(`---- Application did not stabilize within ${STABILITY_WARNING_THRESHOLD / 1000} seconds ----`);
if (typeof Zone !== 'undefined' && !_taskTrackingZone) {
console.info('Zone.js is present but no TaskTrackingZone found. To enable better debugging of tasks in the Angular Zone, ' + 'import "zone.js/plugins/task-tracking" in your application.');
}
if (_taskTrackingZone?.macroTasks?.length) {
console.group('Macrotasks keeping Angular Zone unstable:');
for (const t of _taskTrackingZone?.macroTasks ?? []) {
console.debug(t.creationLocation.stack);
}
console.groupEnd();
}
console.group('PendingTasks keeping application unstable:');
for (const error of openTasks.values()) {
console.debug(error.stack);
}
console.groupEnd();
}, STABILITY_WARNING_THRESHOLD);
applicationRef.whenStable().then(() => {
clearTimeout(timeoutId);
});
});
})]);
}
class DefaultIterableDifferFactory {
supports(obj) {
return isListLikeIterable(obj);
}
create(trackByFn) {
return new DefaultIterableDiffer(trackByFn);
}
}
const trackByIdentity = (index, item) => item;
class DefaultIterableDiffer {
length = 0;
collection;
_linkedRecords = null;
_unlinkedRecords = null;
_previousItHead = null;
_itHead = null;
_itTail = null;
_additionsHead = null;
_additionsTail = null;
_movesHead = null;
_movesTail = null;
_removalsHead = null;
_removalsTail = null;
_identityChangesHead = null;
_identityChangesTail = null;
_trackByFn;
constructor(trackByFn) {
this._trackByFn = trackByFn || trackByIdentity;
}
forEachItem(fn) {
let record;
for (record = this._itHead; record !== null; record = record._next) {
fn(record);
}
}
forEachOperation(fn) {
let nextIt = this._itHead;
let nextRemove = this._removalsHead;
let addRemoveOffset = 0;
let moveOffsets = null;
while (nextIt || nextRemove) {
const record = !nextRemove || nextIt && nextIt.currentIndex < getPreviousIndex(nextRemove, addRemoveOffset, moveOffsets) ? nextIt : nextRemove;
const adjPreviousIndex = getPreviousIndex(record, addRemoveOffset, moveOffsets);
const currentIndex = record.currentIndex;
if (record === nextRemove) {
addRemoveOffset--;
nextRemove = nextRemove._nextRemoved;
} else {
nextIt = nextIt._next;
if (record.previousIndex == null) {
addRemoveOffset++;
} else {
if (!moveOffsets) moveOffsets = [];
const localMovePreviousIndex = adjPreviousIndex - addRemoveOffset;
const localCurrentIndex = currentIndex - addRemoveOffset;
if (localMovePreviousIndex != localCurrentIndex) {
for (let i = 0; i < localMovePreviousIndex; i++) {
const offset = i < moveOffsets.length ? moveOffsets[i] : moveOffsets[i] = 0;
const index = offset + i;
if (localCurrentIndex <= index && index < localMovePreviousIndex) {
moveOffsets[i] = offset + 1;
}
}
const previousIndex = record.previousIndex;
moveOffsets[previousIndex] = localCurrentIndex - localMovePreviousIndex;
}
}
}
if (adjPreviousIndex !== currentIndex) {
fn(record, adjPreviousIndex, currentIndex);
}
}
}
forEachPreviousItem(fn) {
let record;
for (record = this._previousItHead; record !== null; record = record._nextPrevious) {
fn(record);
}
}
forEachAddedItem(fn) {
let record;
for (record = this._additionsHead; record !== null; record = record._nextAdded) {
fn(record);
}
}
forEachMovedItem(fn) {
let record;
for (record = this._movesHead; record !== null; record = record._nextMoved) {
fn(record);
}
}
forEachRemovedItem(fn) {
let record;
for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
fn(record);
}
}
forEachIdentityChange(fn) {
let record;
for (record = this._identityChangesHead; record !== null; record = record._nextIdentityChange) {
fn(record);
}
}
diff(collection) {
if (collection == null) collection = [];
if (!isListLikeIterable(collection)) {
throw new RuntimeError(900, ngDevMode && `Error trying to diff '${stringify(collection)}'. Only arrays and iterables are allowed`);
}
if (this.check(collection)) {
return this;
} else {
return null;
}
}
onDestroy() {}
check(collection) {
this._reset();
let record = this._itHead;
let mayBeDirty = false;
let index;
let item;
let itemTrackBy;
if (Array.isArray(collection)) {
this.length = collection.length;
for (let index = 0; index < this.length; index++) {
item = collection[index];
itemTrackBy = this._trackByFn(index, item);
if (record === null || !Object.is(record.trackById, itemTrackBy)) {
record = this._mismatch(record, item, itemTrackBy, index);
mayBeDirty = true;
} else {
if (mayBeDirty) {
record = this._verifyReinsertion(record, item, itemTrackBy, index);
}
if (!Object.is(record.item, item)) this._addIdentityChange(record, item);
}
record = record._next;
}
} else {
index = 0;
iterateListLike(collection, item => {
itemTrackBy = this._trackByFn(index, item);
if (record === null || !Object.is(record.trackById, itemTrackBy)) {
record = this._mismatch(record, item, itemTrackBy, index);
mayBeDirty = true;
} else {
if (mayBeDirty) {
record = this._verifyReinsertion(record, item, itemTrackBy, index);
}
if (!Object.is(record.item, item)) this._addIdentityChange(record, item);
}
record = record._next;
index++;
});
this.length = index;
}
this._truncate(record);
this.collection = collection;
return this.isDirty;
}
get isDirty() {
return this._additionsHead !== null || this._movesHead !== null || this._removalsHead !== null || this._identityChangesHead !== null;
}
_reset() {
if (this.isDirty) {
let record;
for (record = this._previousItHead = this._itHead; record !== null; record = record._next) {
record._nextPrevious = record._next;
}
for (record = this._additionsHead; record !== null; record = record._nextAdded) {
record.previousIndex = record.currentIndex;
}
this._additionsHead = this._additionsTail = null;
for (record = this._movesHead; record !== null; record = record._nextMoved) {
record.previousIndex = record.currentIndex;
}
this._movesHead = this._movesTail = null;
this._removalsHead = this._removalsTail = null;
this._identityChangesHead = this._identityChangesTail = null;
}
}
_mismatch(record, item, itemTrackBy, index) {
let previousRecord;
if (record === null) {
previousRecord = this._itTail;
} else {
previousRecord = record._prev;
this._remove(record);
}
record = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null);
if (record !== null) {
if (!Object.is(record.item, item)) this._addIdentityChange(record, item);
this._reinsertAfter(record, previousRecord, index);
} else {
record = this._linkedRecords === null ? null : this._linkedRecords.get(itemTrackBy, index);
if (record !== null) {
if (!Object.is(record.item, item)) this._addIdentityChange(record, item);
this._moveAfter(record, previousRecord, index);
} else {
record = this._addAfter(new IterableChangeRecord_(item, itemTrackBy), previousRecord, index);
}
}
return record;
}
_verifyReinsertion(record, item, itemTrackBy, index) {
let reinsertRecord = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null);
if (reinsertRecord !== null) {
record = this._reinsertAfter(reinsertRecord, record._prev, index);
} else if (record.currentIndex != index) {
record.currentIndex = index;
this._addToMoves(record, index);
}
return record;
}
_truncate(record) {
while (record !== null) {
const nextRecord = record._next;
this._addToRemovals(this._unlink(record));
record = nextRecord;
}
if (this._unlinkedRecords !== null) {
this._unlinkedRecords.clear();
}
if (this._additionsTail !== null) {
this._additionsTail._nextAdded = null;
}
if (this._movesTail !== null) {
this._movesTail._nextMoved = null;
}
if (this._itTail !== null) {
this._itTail._next = null;
}
if (this._removalsTail !== null) {
this._removalsTail._nextRemoved = null;
}
if (this._identityChangesTail !== null) {
this._identityChangesTail._nextIdentityChange = null;
}
}
_reinsertAfter(record, prevRecord, index) {
if (this._unlinkedRecords !== null) {
this._unlinkedRecords.remove(record);
}
const prev = record._prevRemoved;
const next = record._nextRemoved;
if (prev === null) {
this._removalsHead = next;
} else {
prev._nextRemoved = next;
}
if (next === null) {
this._removalsTail = prev;
} else {
next._prevRemoved = prev;
}
this._insertAfter(record, prevRecord, index);
this._addToMoves(record, index);
return record;
}
_moveAfter(record, prevRecord, index) {
this._unlink(record);
this._insertAfter(record, prevRecord, index);
this._addToMoves(record, index);
return record;
}
_addAfter(record, prevRecord, index) {
this._insertAfter(record, prevRecord, index);
if (this._additionsTail === null) {
this._additionsTail = this._additionsHead = record;
} else {
this._additionsTail = this._additionsTail._nextAdded = record;
}
return record;
}
_insertAfter(record, prevRecord, index) {
const next = prevRecord === null ? this._itHead : prevRecord._next;
record._next = next;
record._prev = prevRecord;
if (next === null) {
this._itTail = record;
} else {
next._prev = record;
}
if (prevRecord === null) {
this._itHead = record;
} else {
prevRecord._next = record;
}
if (this._linkedRecords === null) {
this._linkedRecords = new _DuplicateMap();
}
this._linkedRecords.put(record);
record.currentIndex = index;
return record;
}
_remove(record) {
return this._addToRemovals(this._unlink(record));
}
_unlink(record) {
if (this._linkedRecords !== null) {
this._linkedRecords.remove(record);
}
const prev = record._prev;
const next = record._next;
if (prev === null) {
this._itHead = next;
} else {
prev._next = next;
}
if (next === null) {
this._itTail = prev;
} else {
next._prev = prev;
}
return record;
}
_addToMoves(record, toIndex) {
if (record.previousIndex === toIndex) {
return record;
}
if (this._movesTail === null) {
this._movesTail = this._movesHead = record;
} else {
this._movesTail = this._movesTail._nextMoved = record;
}
return record;
}
_addToRemovals(record) {
if (this._unlinkedRecords === null) {
this._unlinkedRecords = new _DuplicateMap();
}
this._unlinkedRecords.put(record);
record.curr