import { AFTER_RENDER_SEQUENCES_TO_ADD, CHILD_HEAD, CHILD_TAIL, CLEANUP, CONTAINER_HEADER_OFFSET, CONTEXT, ChangeDetectionScheduler, CheckNoChangesMode, DECLARATION_COMPONENT_VIEW, DECLARATION_LCONTAINER, DECLARATION_VIEW, DEHYDRATED_VIEWS, DestroyRef, EFFECTS, EFFECTS_TO_SCHEDULE, EMBEDDED_VIEW_INJECTOR, EMPTY_ARRAY, EMPTY_OBJ, ENVIRONMENT, ENVIRONMENT_INITIALIZER, EffectScheduler, EnvironmentInjector, ErrorHandler, FLAGS, HEADER_OFFSET, HOST, HYDRATION, ID, INJECTOR, INJECTOR_DEF_TYPES, INJECTOR_SCOPE, INTERNAL_APPLICATION_ERROR_HANDLER, InjectionToken, Injector, MATH_ML_NAMESPACE, MOVED_VIEWS, NATIVE, NEXT, NG_COMP_DEF, NG_DIR_DEF, NG_ELEMENT_ID, NG_FACTORY_DEF, NG_INJ_DEF, NG_MOD_DEF, NG_PIPE_DEF, NG_PROV_DEF, NullInjector, ON_DESTROY_HOOKS, OutputEmitterRef, PARENT, PREORDER_HOOK_FLAGS, PROVIDED_ZONELESS, PendingTasks, PendingTasksInternal, QUERIES, R3Injector, REACTIVE_NODE, REACTIVE_TEMPLATE_CONSUMER, RENDERER, RuntimeError, SCHEDULE_IN_ROOT_ZONE, SIGNAL, SIGNAL_NODE, SVG_NAMESPACE, TVIEW, T_HOST, VIEW_REFS, ViewContext, XSS_SECURITY_URL, ZONELESS_ENABLED, ZONELESS_SCHEDULER_DISABLED, _global, addToArray, arrayEquals, arrayInsert2, arraySplice, assertComponentType, assertDefined, assertDirectiveDef, assertDomNode, assertElement, assertEqual, assertFirstCreatePass, assertFirstUpdatePass, assertFunction, assertGreaterThan, assertGreaterThanOrEqual, assertHasParent, assertInInjectionContext, assertIndexInDeclRange, assertIndexInExpandoRange, assertIndexInRange, assertInjectImplementationNotEqual, assertLContainer, assertLView, assertLessThan, assertNgModuleType, assertNodeInjector, assertNotDefined, assertNotEqual, assertNotInReactiveContext, assertNotReactive, assertNotSame, assertNumber, assertNumberInRange, assertOneOf, assertParentView, assertProjectionSlots, assertSame, assertString, assertTIcu, assertTNode, assertTNodeCreationIndex, assertTNodeForLView, assertTNodeForTView, attachInjectFlag, concatStringsWithSpace, consumerAfterComputation, consumerBeforeComputation, consumerDestroy, consumerPollProducersForChange, convertToBitFlags, createComputed, createInjectorWithoutInjectorInstances, cyclicDependencyError, cyclicDependencyErrorWithDetails, decreaseElementDepthCount, deepForEach, emitEffectCreatedEvent, emitInjectEvent, emitInjectorToCreateInstanceEvent, emitInstanceCreatedByInjectorEvent, emitProviderConfiguredEvent, enterDI, enterSkipHydrationBlock, enterView, errorHandlerEnvironmentInitializer, fillProperties, flatten, formatRuntimeError, forwardRef, getActiveConsumer, getAnimationElementRemovalRegistry, getBindingIndex, getBindingRoot, getBindingsEnabled, getClosureSafeProperty, getComponentDef, getComponentLViewByIndex, getConstant, getContextLView, getCurrentDirectiveDef, getCurrentDirectiveIndex, getCurrentParentTNode, getCurrentQueryIndex, getCurrentTNode, getCurrentTNodePlaceholderOk, getDirectiveDef, getDirectiveDefOrThrow, getElementDepthCount, getFactoryDef, getInjectorDef, getLView, getLViewParent, getNamespace, getNativeByIndex, getNativeByTNode, getNativeByTNodeOrNull, getNgModuleDef, getNgModuleDefOrThrow, getNullInjector, getOrCreateLViewCleanup, getOrCreateTViewCleanup, getPipeDef, getSelectedIndex, getSelectedTNode, getTNode, getTView, hasI18n, increaseElementDepthCount, incrementBindingIndex, initNgDevMode, inject, injectRootLimpMode, internalImportProvidersFrom, isClassProvider, isComponentDef, isComponentHost, isContentQueryHost, isCreationMode, isCurrentTNodeParent, isDestroyed, isDirectiveHost, isExhaustiveCheckNoChanges, isForwardRef, isInCheckNoChangesMode, isInI18nBlock, isInInjectionContext, isInSkipHydrationBlock, isLContainer, isLView, isProjectionTNode, isRefreshingViews, isRootView, isSignal, isSkipHydrationRootTNode, isStandalone, isTypeProvider, isWritableSignal, keyValueArrayGet, keyValueArrayIndexOf, keyValueArraySet, lastNodeWasCreated, leaveDI, leaveSkipHydrationBlock, leaveView, load, makeEnvironmentProviders, markAncestorsForTraversal, markViewForRefresh, newArray, nextBindingIndex, nextContextImpl, noop, producerAccessed, provideEnvironmentInitializer, providerToFactory, removeFromArray, removeLViewOnDestroy, renderStringify, requiresRefreshOrTraversal, resetPreOrderHookFlags, resolveForwardRef, runInInjectionContext, runInInjectorProfilerContext, setActiveConsumer, setAnimationElementRemovalRegistry, setBindingIndex, setBindingRootForHostBindings, setCurrentDirectiveIndex, setCurrentQueryIndex, setCurrentTNode, setCurrentTNodeAsNotParent, setInI18nBlock, setInjectImplementation, setInjectorProfiler, setInjectorProfilerContext, setIsInCheckNoChangesMode, setIsRefreshingViews, setSelectedIndex, setThrowInvalidWriteToSignalError, signal, signalAsReadonlyFn, signalSetFn, store, storeCleanupWithContext, storeLViewOnDestroy, stringify, stringifyForError, throwError, throwProviderNotFoundError, unwrapLView, unwrapRNode, updateAncestorTraversalFlagsOnAttach, viewAttachedToChangeDetector, viewAttachedToContainer, walkProviderTree, walkUpViews, wasLastNodeCreated, ɵɵdefineInjectable, ɵɵdefineInjector, ɵɵdisableBindings, ɵɵenableBindings, ɵɵinject, ɵɵinvalidFactoryDep, ɵɵnamespaceHTML, ɵɵnamespaceMathML, ɵɵnamespaceSVG, ɵɵresetView, ɵɵrestoreView } from "./chunk-GFLMLXUS.js"; import { Subject, Subscription, map } from "./chunk-MARUHEWW.js"; import { __spreadProps, __spreadValues } from "./chunk-GOMI4DH3.js"; // node_modules/@angular/core/fesm2022/attribute.mjs var Attribute = { /** * The jsaction attribute defines a mapping of a DOM event to a * generic event (aka jsaction), to which the actual event handlers * that implement the behavior of the application are bound. The * value is a semicolon separated list of colon separated pairs of * an optional DOM event name and a jsaction name. If the optional * DOM event name is omitted, 'click' is assumed. The jsaction names * are dot separated pairs of a namespace and a simple jsaction * name. * * See grammar in README.md for expected syntax in the attribute value. */ JSACTION: "jsaction" }; // node_modules/@angular/core/fesm2022/debug_node.mjs function noSideEffects(fn) { return { toString: fn }.toString(); } var ANNOTATIONS = "__annotations__"; var PARAMETERS = "__parameters__"; var PROP_METADATA = "__prop__metadata__"; function makeDecorator(name, props, parentClass, additionalProcessing, typeFn) { return noSideEffects(() => { const metaCtor = makeMetadataCtor(props); function DecoratorFactory(...args) { if (this instanceof DecoratorFactory) { metaCtor.call(this, ...args); return this; } const annotationInstance = new DecoratorFactory(...args); return function TypeDecorator(cls) { if (typeFn) typeFn(cls, ...args); const annotations = cls.hasOwnProperty(ANNOTATIONS) ? cls[ANNOTATIONS] : Object.defineProperty(cls, ANNOTATIONS, { value: [] })[ANNOTATIONS]; annotations.push(annotationInstance); return cls; }; } if (parentClass) { DecoratorFactory.prototype = Object.create(parentClass.prototype); } DecoratorFactory.prototype.ngMetadataName = name; DecoratorFactory.annotationCls = DecoratorFactory; return DecoratorFactory; }); } function makeMetadataCtor(props) { return function ctor(...args) { if (props) { const values = props(...args); for (const propName in values) { this[propName] = values[propName]; } } }; } function makeParamDecorator(name, props, parentClass) { return noSideEffects(() => { const metaCtor = makeMetadataCtor(props); function ParamDecoratorFactory(...args) { if (this instanceof ParamDecoratorFactory) { metaCtor.apply(this, args); return this; } const annotationInstance = new ParamDecoratorFactory(...args); ParamDecorator.annotation = annotationInstance; return ParamDecorator; function ParamDecorator(cls, unusedKey, index) { const parameters = cls.hasOwnProperty(PARAMETERS) ? cls[PARAMETERS] : Object.defineProperty(cls, PARAMETERS, { value: [] })[PARAMETERS]; while (parameters.length <= index) { parameters.push(null); } (parameters[index] = parameters[index] || []).push(annotationInstance); return cls; } } ParamDecoratorFactory.prototype.ngMetadataName = name; ParamDecoratorFactory.annotationCls = ParamDecoratorFactory; return ParamDecoratorFactory; }); } function makePropDecorator(name, props, parentClass, additionalProcessing) { return noSideEffects(() => { const metaCtor = makeMetadataCtor(props); function PropDecoratorFactory(...args) { if (this instanceof PropDecoratorFactory) { metaCtor.apply(this, args); return this; } const decoratorInstance = new PropDecoratorFactory(...args); function PropDecorator(target, name2) { if (target === void 0) { throw new Error("Standard Angular field decorators are not supported in JIT mode."); } const constructor = target.constructor; const meta = constructor.hasOwnProperty(PROP_METADATA) ? constructor[PROP_METADATA] : Object.defineProperty(constructor, PROP_METADATA, { value: {} })[PROP_METADATA]; meta[name2] = meta.hasOwnProperty(name2) && meta[name2] || []; meta[name2].unshift(decoratorInstance); } return PropDecorator; } if (parentClass) { PropDecoratorFactory.prototype = Object.create(parentClass.prototype); } PropDecoratorFactory.prototype.ngMetadataName = name; PropDecoratorFactory.annotationCls = PropDecoratorFactory; return PropDecoratorFactory; }); } var Inject = attachInjectFlag( // Disable tslint because `DecoratorFlags` is a const enum which gets inlined. makeParamDecorator("Inject", (token) => ({ token })), -1 /* DecoratorFlags.Inject */ ); var Optional = ( // Disable tslint because `InternalInjectFlags` is a const enum which gets inlined. // tslint:disable-next-line: no-toplevel-property-access attachInjectFlag( makeParamDecorator("Optional"), 8 /* InternalInjectFlags.Optional */ ) ); var Self = ( // Disable tslint because `InternalInjectFlags` is a const enum which gets inlined. // tslint:disable-next-line: no-toplevel-property-access attachInjectFlag( makeParamDecorator("Self"), 2 /* InternalInjectFlags.Self */ ) ); var SkipSelf = ( // Disable tslint because `InternalInjectFlags` is a const enum which gets inlined. // tslint:disable-next-line: no-toplevel-property-access attachInjectFlag( makeParamDecorator("SkipSelf"), 4 /* InternalInjectFlags.SkipSelf */ ) ); var Host = ( // Disable tslint because `InternalInjectFlags` is a const enum which gets inlined. // tslint:disable-next-line: no-toplevel-property-access attachInjectFlag( makeParamDecorator("Host"), 1 /* InternalInjectFlags.Host */ ) ); function getCompilerFacade(request) { const globalNg = _global["ng"]; if (globalNg && globalNg.ɵcompilerFacade) { return globalNg.ɵcompilerFacade; } if (typeof ngDevMode === "undefined" || ngDevMode) { console.error(`JIT compilation failed for ${request.kind}`, request.type); let message = `The ${request.kind} '${request.type.name}' needs to be compiled using the JIT compiler, but '@angular/compiler' is not available. `; if (request.usage === 1) { message += `The ${request.kind} is part of a library that has been partially compiled. `; message += `However, the Angular Linker has not processed the library such that JIT compilation is used as fallback. `; message += "\n"; message += `Ideally, the library is processed using the Angular Linker to become fully AOT compiled. `; } else { message += `JIT compilation is discouraged for production use-cases! Consider using AOT mode instead. `; } message += `Alternatively, the JIT compiler should be loaded by bootstrapping using '@angular/platform-browser-dynamic' or '@angular/platform-server', `; message += `or manually provide the compiler with 'import "@angular/compiler";' before bootstrapping.`; throw new Error(message); } else { throw new Error("JIT compiler unavailable"); } } var angularCoreDiEnv = { "ɵɵdefineInjectable": ɵɵdefineInjectable, "ɵɵdefineInjector": ɵɵdefineInjector, "ɵɵinject": ɵɵinject, "ɵɵinvalidFactoryDep": ɵɵinvalidFactoryDep, "resolveForwardRef": resolveForwardRef }; var Type = Function; function isType(v) { return typeof v === "function"; } var ES5_DELEGATE_CTOR = /^function\s+\S+\(\)\s*{[\s\S]+\.apply\(this,\s*(arguments|(?:[^()]+\(\[\],)?[^()]+\(arguments\).*)\)/; var ES2015_INHERITED_CLASS = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{/; var ES2015_INHERITED_CLASS_WITH_CTOR = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{[\s\S]*constructor\s*\(/; var ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{[\s\S]*constructor\s*\(\)\s*{[^}]*super\(\.\.\.arguments\)/; function isDelegateCtor(typeStr) { return ES5_DELEGATE_CTOR.test(typeStr) || ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR.test(typeStr) || ES2015_INHERITED_CLASS.test(typeStr) && !ES2015_INHERITED_CLASS_WITH_CTOR.test(typeStr); } var ReflectionCapabilities = class { _reflect; constructor(reflect) { this._reflect = reflect || _global["Reflect"]; } factory(t) { return (...args) => new t(...args); } /** @internal */ _zipTypesAndAnnotations(paramTypes, paramAnnotations) { let result; if (typeof paramTypes === "undefined") { result = newArray(paramAnnotations.length); } else { result = newArray(paramTypes.length); } for (let i = 0; i < result.length; i++) { if (typeof paramTypes === "undefined") { result[i] = []; } else if (paramTypes[i] && paramTypes[i] != Object) { result[i] = [paramTypes[i]]; } else { result[i] = []; } if (paramAnnotations && paramAnnotations[i] != null) { result[i] = result[i].concat(paramAnnotations[i]); } } return result; } _ownParameters(type, parentCtor) { const typeStr = type.toString(); if (isDelegateCtor(typeStr)) { return null; } if (type.parameters && type.parameters !== parentCtor.parameters) { return type.parameters; } const tsickleCtorParams = type.ctorParameters; if (tsickleCtorParams && tsickleCtorParams !== parentCtor.ctorParameters) { const ctorParameters = typeof tsickleCtorParams === "function" ? tsickleCtorParams() : tsickleCtorParams; const paramTypes2 = ctorParameters.map((ctorParam) => ctorParam && ctorParam.type); const paramAnnotations2 = ctorParameters.map((ctorParam) => ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators)); return this._zipTypesAndAnnotations(paramTypes2, paramAnnotations2); } const paramAnnotations = type.hasOwnProperty(PARAMETERS) && type[PARAMETERS]; const paramTypes = this._reflect && this._reflect.getOwnMetadata && this._reflect.getOwnMetadata("design:paramtypes", type); if (paramTypes || paramAnnotations) { return this._zipTypesAndAnnotations(paramTypes, paramAnnotations); } return newArray(type.length); } parameters(type) { if (!isType(type)) { return []; } const parentCtor = getParentCtor(type); let parameters = this._ownParameters(type, parentCtor); if (!parameters && parentCtor !== Object) { parameters = this.parameters(parentCtor); } return parameters || []; } _ownAnnotations(typeOrFunc, parentCtor) { if (typeOrFunc.annotations && typeOrFunc.annotations !== parentCtor.annotations) { let annotations = typeOrFunc.annotations; if (typeof annotations === "function" && annotations.annotations) { annotations = annotations.annotations; } return annotations; } if (typeOrFunc.decorators && typeOrFunc.decorators !== parentCtor.decorators) { return convertTsickleDecoratorIntoMetadata(typeOrFunc.decorators); } if (typeOrFunc.hasOwnProperty(ANNOTATIONS)) { return typeOrFunc[ANNOTATIONS]; } return null; } annotations(typeOrFunc) { if (!isType(typeOrFunc)) { return []; } const parentCtor = getParentCtor(typeOrFunc); const ownAnnotations = this._ownAnnotations(typeOrFunc, parentCtor) || []; const parentAnnotations = parentCtor !== Object ? this.annotations(parentCtor) : []; return parentAnnotations.concat(ownAnnotations); } _ownPropMetadata(typeOrFunc, parentCtor) { if (typeOrFunc.propMetadata && typeOrFunc.propMetadata !== parentCtor.propMetadata) { let propMetadata = typeOrFunc.propMetadata; if (typeof propMetadata === "function" && propMetadata.propMetadata) { propMetadata = propMetadata.propMetadata; } return propMetadata; } if (typeOrFunc.propDecorators && typeOrFunc.propDecorators !== parentCtor.propDecorators) { const propDecorators = typeOrFunc.propDecorators; const propMetadata = {}; Object.keys(propDecorators).forEach((prop) => { propMetadata[prop] = convertTsickleDecoratorIntoMetadata(propDecorators[prop]); }); return propMetadata; } if (typeOrFunc.hasOwnProperty(PROP_METADATA)) { return typeOrFunc[PROP_METADATA]; } return null; } propMetadata(typeOrFunc) { if (!isType(typeOrFunc)) { return {}; } const parentCtor = getParentCtor(typeOrFunc); const propMetadata = {}; if (parentCtor !== Object) { const parentPropMetadata = this.propMetadata(parentCtor); Object.keys(parentPropMetadata).forEach((propName) => { propMetadata[propName] = parentPropMetadata[propName]; }); } const ownPropMetadata = this._ownPropMetadata(typeOrFunc, parentCtor); if (ownPropMetadata) { Object.keys(ownPropMetadata).forEach((propName) => { const decorators = []; if (propMetadata.hasOwnProperty(propName)) { decorators.push(...propMetadata[propName]); } decorators.push(...ownPropMetadata[propName]); propMetadata[propName] = decorators; }); } return propMetadata; } ownPropMetadata(typeOrFunc) { if (!isType(typeOrFunc)) { return {}; } return this._ownPropMetadata(typeOrFunc, getParentCtor(typeOrFunc)) || {}; } hasLifecycleHook(type, lcProperty) { return type instanceof Type && lcProperty in type.prototype; } }; function convertTsickleDecoratorIntoMetadata(decoratorInvocations) { if (!decoratorInvocations) { return []; } return decoratorInvocations.map((decoratorInvocation) => { const decoratorType = decoratorInvocation.type; const annotationCls = decoratorType.annotationCls; const annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : []; return new annotationCls(...annotationArgs); }); } function getParentCtor(ctor) { const parentProto = ctor.prototype ? Object.getPrototypeOf(ctor.prototype) : null; const parentCtor = parentProto ? parentProto.constructor : null; return parentCtor || Object; } var SimpleChange = class { previousValue; currentValue; firstChange; constructor(previousValue, currentValue, firstChange) { this.previousValue = previousValue; this.currentValue = currentValue; this.firstChange = firstChange; } /** * Check whether the new value is the first value assigned. */ isFirstChange() { return this.firstChange; } }; function applyValueToInputField(instance, inputSignalNode, privateName, value) { if (inputSignalNode !== null) { inputSignalNode.applyValueToInputSignal(inputSignalNode, value); } else { instance[privateName] = value; } } var ɵɵNgOnChangesFeature = (() => { const ɵɵNgOnChangesFeatureImpl = () => NgOnChangesFeatureImpl; ɵɵNgOnChangesFeatureImpl.ngInherit = true; return ɵɵNgOnChangesFeatureImpl; })(); function NgOnChangesFeatureImpl(definition) { if (definition.type.prototype.ngOnChanges) { definition.setInput = ngOnChangesSetInput; } return rememberChangeHistoryAndInvokeOnChangesHook; } function rememberChangeHistoryAndInvokeOnChangesHook() { const simpleChangesStore = getSimpleChangesStore(this); const current = simpleChangesStore?.current; if (current) { const previous = simpleChangesStore.previous; if (previous === EMPTY_OBJ) { simpleChangesStore.previous = current; } else { for (let key in current) { previous[key] = current[key]; } } simpleChangesStore.current = null; this.ngOnChanges(current); } } function ngOnChangesSetInput(instance, inputSignalNode, value, publicName, privateName) { const declaredName = this.declaredInputs[publicName]; ngDevMode && assertString(declaredName, "Name of input in ngOnChanges has to be a string"); const simpleChangesStore = getSimpleChangesStore(instance) || setSimpleChangesStore(instance, { previous: EMPTY_OBJ, current: null }); const current = simpleChangesStore.current || (simpleChangesStore.current = {}); const previous = simpleChangesStore.previous; const previousChange = previous[declaredName]; current[declaredName] = new SimpleChange(previousChange && previousChange.currentValue, value, previous === EMPTY_OBJ); applyValueToInputField(instance, inputSignalNode, privateName, value); } var SIMPLE_CHANGES_STORE = "__ngSimpleChanges__"; function getSimpleChangesStore(instance) { return instance[SIMPLE_CHANGES_STORE] || null; } function setSimpleChangesStore(instance, store2) { return instance[SIMPLE_CHANGES_STORE] = store2; } var profilerCallbacks = []; var NOOP_PROFILER_REMOVAL = () => { }; function removeProfiler(profiler2) { const profilerIdx = profilerCallbacks.indexOf(profiler2); if (profilerIdx !== -1) { profilerCallbacks.splice(profilerIdx, 1); } } function setProfiler(profiler2) { if (profiler2 !== null) { if (!profilerCallbacks.includes(profiler2)) { profilerCallbacks.push(profiler2); } return () => removeProfiler(profiler2); } else { profilerCallbacks.length = 0; return NOOP_PROFILER_REMOVAL; } } var profiler = function(event, instance = null, eventFn) { for (let i = 0; i < profilerCallbacks.length; i++) { const profilerCallback = profilerCallbacks[i]; profilerCallback(event, instance, eventFn); } }; function registerPreOrderHooks(directiveIndex, directiveDef, tView) { ngDevMode && assertFirstCreatePass(tView); const { ngOnChanges, ngOnInit, ngDoCheck } = directiveDef.type.prototype; if (ngOnChanges) { const wrappedOnChanges = NgOnChangesFeatureImpl(directiveDef); (tView.preOrderHooks ??= []).push(directiveIndex, wrappedOnChanges); (tView.preOrderCheckHooks ??= []).push(directiveIndex, wrappedOnChanges); } if (ngOnInit) { (tView.preOrderHooks ??= []).push(0 - directiveIndex, ngOnInit); } if (ngDoCheck) { (tView.preOrderHooks ??= []).push(directiveIndex, ngDoCheck); (tView.preOrderCheckHooks ??= []).push(directiveIndex, ngDoCheck); } } function registerPostOrderHooks(tView, tNode) { ngDevMode && assertFirstCreatePass(tView); for (let i = tNode.directiveStart, end = tNode.directiveEnd; i < end; i++) { const directiveDef = tView.data[i]; ngDevMode && assertDefined(directiveDef, "Expecting DirectiveDef"); const lifecycleHooks = directiveDef.type.prototype; const { ngAfterContentInit, ngAfterContentChecked, ngAfterViewInit, ngAfterViewChecked, ngOnDestroy } = lifecycleHooks; if (ngAfterContentInit) { (tView.contentHooks ??= []).push(-i, ngAfterContentInit); } if (ngAfterContentChecked) { (tView.contentHooks ??= []).push(i, ngAfterContentChecked); (tView.contentCheckHooks ??= []).push(i, ngAfterContentChecked); } if (ngAfterViewInit) { (tView.viewHooks ??= []).push(-i, ngAfterViewInit); } if (ngAfterViewChecked) { (tView.viewHooks ??= []).push(i, ngAfterViewChecked); (tView.viewCheckHooks ??= []).push(i, ngAfterViewChecked); } if (ngOnDestroy != null) { (tView.destroyHooks ??= []).push(i, ngOnDestroy); } } } function executeCheckHooks(lView, hooks, nodeIndex) { callHooks(lView, hooks, 3, nodeIndex); } function executeInitAndCheckHooks(lView, hooks, initPhase, nodeIndex) { ngDevMode && assertNotEqual(initPhase, 3, "Init pre-order hooks should not be called more than once"); if ((lView[FLAGS] & 3) === initPhase) { callHooks(lView, hooks, initPhase, nodeIndex); } } function incrementInitPhaseFlags(lView, initPhase) { ngDevMode && assertNotEqual(initPhase, 3, "Init hooks phase should not be incremented after all init hooks have been run."); let flags = lView[FLAGS]; if ((flags & 3) === initPhase) { flags &= 16383; flags += 1; lView[FLAGS] = flags; } } function callHooks(currentView, arr, initPhase, currentNodeIndex) { ngDevMode && assertEqual(isInCheckNoChangesMode(), false, "Hooks should never be run when in check no changes mode."); const startIndex = currentNodeIndex !== void 0 ? currentView[PREORDER_HOOK_FLAGS] & 65535 : 0; const nodeIndexLimit = currentNodeIndex != null ? currentNodeIndex : -1; const max = arr.length - 1; let lastNodeIndexFound = 0; for (let i = startIndex; i < max; i++) { const hook = arr[i + 1]; if (typeof hook === "number") { lastNodeIndexFound = arr[i]; if (currentNodeIndex != null && lastNodeIndexFound >= currentNodeIndex) { break; } } else { const isInitHook = arr[i] < 0; if (isInitHook) { currentView[PREORDER_HOOK_FLAGS] += 65536; } if (lastNodeIndexFound < nodeIndexLimit || nodeIndexLimit == -1) { callHook(currentView, initPhase, arr, i); currentView[PREORDER_HOOK_FLAGS] = (currentView[PREORDER_HOOK_FLAGS] & 4294901760) + i + 2; } i++; } } } function callHookInternal(directive, hook) { profiler(4, directive, hook); const prevConsumer = setActiveConsumer(null); try { hook.call(directive); } finally { setActiveConsumer(prevConsumer); profiler(5, directive, hook); } } function callHook(currentView, initPhase, arr, i) { const isInitHook = arr[i] < 0; const hook = arr[i + 1]; const directiveIndex = isInitHook ? -arr[i] : arr[i]; const directive = currentView[directiveIndex]; if (isInitHook) { const indexWithintInitPhase = currentView[FLAGS] >> 14; if (indexWithintInitPhase < currentView[PREORDER_HOOK_FLAGS] >> 16 && (currentView[FLAGS] & 3) === initPhase) { currentView[FLAGS] += 16384; callHookInternal(directive, hook); } } else { callHookInternal(directive, hook); } } var NO_PARENT_INJECTOR = -1; var NodeInjectorFactory = class { factory; name; /** * The inject implementation to be activated when using the factory. */ injectImpl; /** * Marker set to true during factory invocation to see if we get into recursive loop. * Recursive loop causes an error to be displayed. */ resolving = false; /** * Marks that the token can see other Tokens declared in `viewProviders` on the same node. */ canSeeViewProviders; /** * An array of factories to use in case of `multi` provider. */ multi; /** * Number of `multi`-providers which belong to the component. * * This is needed because when multiple components and directives declare the `multi` provider * they have to be concatenated in the correct order. * * Example: * * If we have a component and directive active an a single element as declared here * ```ts * component: * providers: [ {provide: String, useValue: 'component', multi: true} ], * viewProviders: [ {provide: String, useValue: 'componentView', multi: true} ], * * directive: * providers: [ {provide: String, useValue: 'directive', multi: true} ], * ``` * * Then the expected results are: * * ```ts * providers: ['component', 'directive'] * viewProviders: ['component', 'componentView', 'directive'] * ``` * * The way to think about it is that the `viewProviders` have been inserted after the component * but before the directives, which is why we need to know how many `multi`s have been declared by * the component. */ componentProviders; /** * Current index of the Factory in the `data`. Needed for `viewProviders` and `providers` merging. * See `providerFactory`. */ index; /** * Because the same `multi` provider can be declared in `providers` and `viewProviders` it is * possible for `viewProviders` to shadow the `providers`. For this reason we store the * `provideFactory` of the `providers` so that `providers` can be extended with `viewProviders`. * * Example: * * Given: * ```ts * providers: [ {provide: String, useValue: 'all', multi: true} ], * viewProviders: [ {provide: String, useValue: 'viewOnly', multi: true} ], * ``` * * We have to return `['all']` in case of content injection, but `['all', 'viewOnly']` in case * of view injection. We further have to make sure that the shared instances (in our case * `all`) are the exact same instance in both the content as well as the view injection. (We * have to make sure that we don't double instantiate.) For this reason the `viewProviders` * `Factory` has a pointer to the shadowed `providers` factory so that it can instantiate the * `providers` (`['all']`) and then extend it with `viewProviders` (`['all'] + ['viewOnly'] = * ['all', 'viewOnly']`). */ providerFactory; constructor(factory, isViewProvider, injectImplementation, name) { this.factory = factory; this.name = name; ngDevMode && assertDefined(factory, "Factory not specified"); ngDevMode && assertEqual(typeof factory, "function", "Expected factory function."); this.canSeeViewProviders = isViewProvider; this.injectImpl = injectImplementation; } }; function toTNodeTypeAsString(tNodeType) { let text = ""; tNodeType & 1 && (text += "|Text"); tNodeType & 2 && (text += "|Element"); tNodeType & 4 && (text += "|Container"); tNodeType & 8 && (text += "|ElementContainer"); tNodeType & 16 && (text += "|Projection"); tNodeType & 32 && (text += "|IcuContainer"); tNodeType & 64 && (text += "|Placeholder"); tNodeType & 128 && (text += "|LetDeclaration"); return text.length > 0 ? text.substring(1) : text; } function isTNodeShape(value) { return value != null && typeof value === "object" && (value.insertBeforeIndex === null || typeof value.insertBeforeIndex === "number" || Array.isArray(value.insertBeforeIndex)); } function isLetDeclaration(tNode) { return !!(tNode.type & 128); } function hasClassInput(tNode) { return (tNode.flags & 8) !== 0; } function hasStyleInput(tNode) { return (tNode.flags & 16) !== 0; } function assertTNodeType(tNode, expectedTypes, message) { assertDefined(tNode, "should be called with a TNode"); if ((tNode.type & expectedTypes) === 0) { throwError(message || `Expected [${toTNodeTypeAsString(expectedTypes)}] but got ${toTNodeTypeAsString(tNode.type)}.`); } } function assertPureTNodeType(type) { if (!(type === 2 || type === 1 || type === 4 || type === 8 || type === 32 || type === 16 || type === 64 || type === 128)) { throwError(`Expected TNodeType to have only a single type selected, but got ${toTNodeTypeAsString(type)}.`); } } function setUpAttributes(renderer, native, attrs) { let i = 0; while (i < attrs.length) { const value = attrs[i]; if (typeof value === "number") { if (value !== 0) { break; } i++; const namespaceURI = attrs[i++]; const attrName = attrs[i++]; const attrVal = attrs[i++]; renderer.setAttribute(native, attrName, attrVal, namespaceURI); } else { const attrName = value; const attrVal = attrs[++i]; if (isAnimationProp(attrName)) { renderer.setProperty(native, attrName, attrVal); } else { renderer.setAttribute(native, attrName, attrVal); } i++; } } return i; } function isNameOnlyAttributeMarker(marker) { return marker === 3 || marker === 4 || marker === 6; } function isAnimationProp(name) { return name.charCodeAt(0) === 64; } function mergeHostAttrs(dst, src) { if (src === null || src.length === 0) ; else if (dst === null || dst.length === 0) { dst = src.slice(); } else { let srcMarker = -1; for (let i = 0; i < src.length; i++) { const item = src[i]; if (typeof item === "number") { srcMarker = item; } else { if (srcMarker === 0) ; else if (srcMarker === -1 || srcMarker === 2) { mergeHostAttribute(dst, srcMarker, item, null, src[++i]); } else { mergeHostAttribute(dst, srcMarker, item, null, null); } } } } return dst; } function mergeHostAttribute(dst, marker, key1, key2, value) { let i = 0; let markerInsertPosition = dst.length; if (marker === -1) { markerInsertPosition = -1; } else { while (i < dst.length) { const dstValue = dst[i++]; if (typeof dstValue === "number") { if (dstValue === marker) { markerInsertPosition = -1; break; } else if (dstValue > marker) { markerInsertPosition = i - 1; break; } } } } while (i < dst.length) { const item = dst[i]; if (typeof item === "number") { break; } else if (item === key1) { { if (value !== null) { dst[i + 1] = value; } return; } } i++; if (value !== null) i++; } if (markerInsertPosition !== -1) { dst.splice(markerInsertPosition, 0, marker); i = markerInsertPosition + 1; } dst.splice(i++, 0, key1); if (value !== null) { dst.splice(i++, 0, value); } } function hasParentInjector(parentLocation) { return parentLocation !== NO_PARENT_INJECTOR; } function getParentInjectorIndex(parentLocation) { if (ngDevMode) { assertNumber(parentLocation, "Number expected"); assertNotEqual(parentLocation, -1, "Not a valid state."); const parentInjectorIndex = parentLocation & 32767; assertGreaterThan(parentInjectorIndex, HEADER_OFFSET, "Parent injector must be pointing past HEADER_OFFSET."); } return parentLocation & 32767; } function getParentInjectorViewOffset(parentLocation) { return parentLocation >> 16; } function getParentInjectorView(location, startView) { let viewOffset = getParentInjectorViewOffset(location); let parentView = startView; while (viewOffset > 0) { parentView = parentView[DECLARATION_VIEW]; viewOffset--; } return parentView; } var includeViewProviders = true; function setIncludeViewProviders(v) { const oldValue = includeViewProviders; includeViewProviders = v; return oldValue; } var BLOOM_SIZE = 256; var BLOOM_MASK = BLOOM_SIZE - 1; var BLOOM_BUCKET_BITS = 5; var nextNgElementId = 0; var NOT_FOUND = {}; function bloomAdd(injectorIndex, tView, type) { ngDevMode && assertEqual(tView.firstCreatePass, true, "expected firstCreatePass to be true"); let id; if (typeof type === "string") { id = type.charCodeAt(0) || 0; } else if (type.hasOwnProperty(NG_ELEMENT_ID)) { id = type[NG_ELEMENT_ID]; } if (id == null) { id = type[NG_ELEMENT_ID] = nextNgElementId++; } const bloomHash = id & BLOOM_MASK; const mask = 1 << bloomHash; tView.data[injectorIndex + (bloomHash >> BLOOM_BUCKET_BITS)] |= mask; } function getOrCreateNodeInjectorForNode(tNode, lView) { const existingInjectorIndex = getInjectorIndex(tNode, lView); if (existingInjectorIndex !== -1) { return existingInjectorIndex; } const tView = lView[TVIEW]; if (tView.firstCreatePass) { tNode.injectorIndex = lView.length; insertBloom(tView.data, tNode); insertBloom(lView, null); insertBloom(tView.blueprint, null); } const parentLoc = getParentInjectorLocation(tNode, lView); const injectorIndex = tNode.injectorIndex; if (hasParentInjector(parentLoc)) { const parentIndex = getParentInjectorIndex(parentLoc); const parentLView = getParentInjectorView(parentLoc, lView); const parentData = parentLView[TVIEW].data; for (let i = 0; i < 8; i++) { lView[injectorIndex + i] = parentLView[parentIndex + i] | parentData[parentIndex + i]; } } lView[ injectorIndex + 8 /* NodeInjectorOffset.PARENT */ ] = parentLoc; return injectorIndex; } function insertBloom(arr, footer) { arr.push(0, 0, 0, 0, 0, 0, 0, 0, footer); } function getInjectorIndex(tNode, lView) { if (tNode.injectorIndex === -1 || // If the injector index is the same as its parent's injector index, then the index has been // copied down from the parent node. No injector has been created yet on this node. tNode.parent && tNode.parent.injectorIndex === tNode.injectorIndex || // After the first template pass, the injector index might exist but the parent values // might not have been calculated yet for this instance lView[ tNode.injectorIndex + 8 /* NodeInjectorOffset.PARENT */ ] === null) { return -1; } else { ngDevMode && assertIndexInRange(lView, tNode.injectorIndex); return tNode.injectorIndex; } } function getParentInjectorLocation(tNode, lView) { if (tNode.parent && tNode.parent.injectorIndex !== -1) { return tNode.parent.injectorIndex; } let declarationViewOffset = 0; let parentTNode = null; let lViewCursor = lView; while (lViewCursor !== null) { parentTNode = getTNodeFromLView(lViewCursor); if (parentTNode === null) { return NO_PARENT_INJECTOR; } ngDevMode && parentTNode && assertTNodeForLView(parentTNode, lViewCursor[DECLARATION_VIEW]); declarationViewOffset++; lViewCursor = lViewCursor[DECLARATION_VIEW]; if (parentTNode.injectorIndex !== -1) { return parentTNode.injectorIndex | declarationViewOffset << 16; } } return NO_PARENT_INJECTOR; } function diPublicInInjector(injectorIndex, tView, token) { bloomAdd(injectorIndex, tView, token); } function injectAttributeImpl(tNode, attrNameToInject) { ngDevMode && assertTNodeType( tNode, 12 | 3 /* TNodeType.AnyRNode */ ); ngDevMode && assertDefined(tNode, "expecting tNode"); if (attrNameToInject === "class") { return tNode.classes; } if (attrNameToInject === "style") { return tNode.styles; } const attrs = tNode.attrs; if (attrs) { const attrsLength = attrs.length; let i = 0; while (i < attrsLength) { const value = attrs[i]; if (isNameOnlyAttributeMarker(value)) break; if (value === 0) { i = i + 2; } else if (typeof value === "number") { i++; while (i < attrsLength && typeof attrs[i] === "string") { i++; } } else if (value === attrNameToInject) { return attrs[i + 1]; } else { i = i + 2; } } } return null; } function notFoundValueOrThrow(notFoundValue, token, flags) { if (flags & 8 || notFoundValue !== void 0) { return notFoundValue; } else { throwProviderNotFoundError(token, "NodeInjector"); } } function lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue) { if (flags & 8 && notFoundValue === void 0) { notFoundValue = null; } if ((flags & (2 | 1)) === 0) { const moduleInjector = lView[INJECTOR]; const previousInjectImplementation = setInjectImplementation(void 0); try { if (moduleInjector) { return moduleInjector.get( token, notFoundValue, flags & 8 /* InternalInjectFlags.Optional */ ); } else { return injectRootLimpMode( token, notFoundValue, flags & 8 /* InternalInjectFlags.Optional */ ); } } finally { setInjectImplementation(previousInjectImplementation); } } return notFoundValueOrThrow(notFoundValue, token, flags); } function getOrCreateInjectable(tNode, lView, token, flags = 0, notFoundValue) { if (tNode !== null) { if (lView[FLAGS] & 2048 && // The token must be present on the current node injector when the `Self` // flag is set, so the lookup on embedded view injector(s) can be skipped. !(flags & 2)) { const embeddedInjectorValue = lookupTokenUsingEmbeddedInjector(tNode, lView, token, flags, NOT_FOUND); if (embeddedInjectorValue !== NOT_FOUND) { return embeddedInjectorValue; } } const value = lookupTokenUsingNodeInjector(tNode, lView, token, flags, NOT_FOUND); if (value !== NOT_FOUND) { return value; } } return lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue); } function lookupTokenUsingNodeInjector(tNode, lView, token, flags, notFoundValue) { const bloomHash = bloomHashBitOrFactory(token); if (typeof bloomHash === "function") { if (!enterDI(lView, tNode, flags)) { return flags & 1 ? notFoundValueOrThrow(notFoundValue, token, flags) : lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue); } try { let value; if (ngDevMode) { runInInjectorProfilerContext(new NodeInjector(getCurrentTNode(), getLView()), token, () => { emitInjectorToCreateInstanceEvent(token); value = bloomHash(flags); emitInstanceCreatedByInjectorEvent(value); }); } else { value = bloomHash(flags); } if (value == null && !(flags & 8)) { throwProviderNotFoundError(token); } else { return value; } } finally { leaveDI(); } } else if (typeof bloomHash === "number") { let previousTView = null; let injectorIndex = getInjectorIndex(tNode, lView); let parentLocation = NO_PARENT_INJECTOR; let hostTElementNode = flags & 1 ? lView[DECLARATION_COMPONENT_VIEW][T_HOST] : null; if (injectorIndex === -1 || flags & 4) { parentLocation = injectorIndex === -1 ? getParentInjectorLocation(tNode, lView) : lView[ injectorIndex + 8 /* NodeInjectorOffset.PARENT */ ]; if (parentLocation === NO_PARENT_INJECTOR || !shouldSearchParent(flags, false)) { injectorIndex = -1; } else { previousTView = lView[TVIEW]; injectorIndex = getParentInjectorIndex(parentLocation); lView = getParentInjectorView(parentLocation, lView); } } while (injectorIndex !== -1) { ngDevMode && assertNodeInjector(lView, injectorIndex); const tView = lView[TVIEW]; ngDevMode && assertTNodeForLView(tView.data[ injectorIndex + 8 /* NodeInjectorOffset.TNODE */ ], lView); if (bloomHasToken(bloomHash, injectorIndex, tView.data)) { const instance = searchTokensOnInjector(injectorIndex, lView, token, previousTView, flags, hostTElementNode); if (instance !== NOT_FOUND) { return instance; } } parentLocation = lView[ injectorIndex + 8 /* NodeInjectorOffset.PARENT */ ]; if (parentLocation !== NO_PARENT_INJECTOR && shouldSearchParent(flags, lView[TVIEW].data[ injectorIndex + 8 /* NodeInjectorOffset.TNODE */ ] === hostTElementNode) && bloomHasToken(bloomHash, injectorIndex, lView)) { previousTView = tView; injectorIndex = getParentInjectorIndex(parentLocation); lView = getParentInjectorView(parentLocation, lView); } else { injectorIndex = -1; } } } return notFoundValue; } function searchTokensOnInjector(injectorIndex, lView, token, previousTView, flags, hostTElementNode) { const currentTView = lView[TVIEW]; const tNode = currentTView.data[ injectorIndex + 8 /* NodeInjectorOffset.TNODE */ ]; const canAccessViewProviders = previousTView == null ? ( // 1) This is the first invocation `previousTView == null` which means that we are at the // `TNode` of where injector is starting to look. In such a case the only time we are allowed // to look into the ViewProviders is if: // - we are on a component // - AND the injector set `includeViewProviders` to true (implying that the token can see // ViewProviders because it is the Component or a Service which itself was declared in // ViewProviders) isComponentHost(tNode) && includeViewProviders ) : ( // 2) `previousTView != null` which means that we are now walking across the parent nodes. // In such a case we are only allowed to look into the ViewProviders if: // - We just crossed from child View to Parent View `previousTView != currentTView` // - AND the parent TNode is an Element. // This means that we just came from the Component's View and therefore are allowed to see // into the ViewProviders. previousTView != currentTView && (tNode.type & 3) !== 0 ); const isHostSpecialCase = flags & 1 && hostTElementNode === tNode; const injectableIdx = locateDirectiveOrProvider(tNode, currentTView, token, canAccessViewProviders, isHostSpecialCase); if (injectableIdx !== null) { return getNodeInjectable(lView, currentTView, injectableIdx, tNode, flags); } else { return NOT_FOUND; } } function locateDirectiveOrProvider(tNode, tView, token, canAccessViewProviders, isHostSpecialCase) { const nodeProviderIndexes = tNode.providerIndexes; const tInjectables = tView.data; const injectablesStart = nodeProviderIndexes & 1048575; const directivesStart = tNode.directiveStart; const directiveEnd = tNode.directiveEnd; const cptViewProvidersCount = nodeProviderIndexes >> 20; const startingIndex = canAccessViewProviders ? injectablesStart : injectablesStart + cptViewProvidersCount; const endIndex = isHostSpecialCase ? injectablesStart + cptViewProvidersCount : directiveEnd; for (let i = startingIndex; i < endIndex; i++) { const providerTokenOrDef = tInjectables[i]; if (i < directivesStart && token === providerTokenOrDef || i >= directivesStart && providerTokenOrDef.type === token) { return i; } } if (isHostSpecialCase) { const dirDef = tInjectables[directivesStart]; if (dirDef && isComponentDef(dirDef) && dirDef.type === token) { return directivesStart; } } return null; } var injectionPath = []; function getNodeInjectable(lView, tView, index, tNode, flags) { let value = lView[index]; const tData = tView.data; if (value instanceof NodeInjectorFactory) { const factory = value; ngDevMode && injectionPath.push(factory.name ?? "unknown"); if (factory.resolving) { const token2 = stringifyForError(tData[index]); if (ngDevMode) { throw cyclicDependencyErrorWithDetails(token2, injectionPath); } else { throw cyclicDependencyError(token2); } } const previousIncludeViewProviders = setIncludeViewProviders(factory.canSeeViewProviders); factory.resolving = true; const token = tData[index].type || tData[index]; let prevInjectContext; if (ngDevMode) { const injector = new NodeInjector(tNode, lView); prevInjectContext = setInjectorProfilerContext({ injector, token }); } const previousInjectImplementation = factory.injectImpl ? setInjectImplementation(factory.injectImpl) : null; const success = enterDI( lView, tNode, 0 /* InternalInjectFlags.Default */ ); ngDevMode && assertEqual(success, true, "Because flags do not contain `SkipSelf' we expect this to always succeed."); try { ngDevMode && emitInjectorToCreateInstanceEvent(token); value = lView[index] = factory.factory(void 0, flags, tData, lView, tNode); ngDevMode && emitInstanceCreatedByInjectorEvent(value); if (tView.firstCreatePass && index >= tNode.directiveStart) { ngDevMode && assertDirectiveDef(tData[index]); registerPreOrderHooks(index, tData[index], tView); } } finally { ngDevMode && setInjectorProfilerContext(prevInjectContext); previousInjectImplementation !== null && setInjectImplementation(previousInjectImplementation); setIncludeViewProviders(previousIncludeViewProviders); factory.resolving = false; leaveDI(); ngDevMode && (injectionPath = []); } } return value; } function bloomHashBitOrFactory(token) { ngDevMode && assertDefined(token, "token must be defined"); if (typeof token === "string") { return token.charCodeAt(0) || 0; } const tokenId = ( // First check with `hasOwnProperty` so we don't get an inherited ID. token.hasOwnProperty(NG_ELEMENT_ID) ? token[NG_ELEMENT_ID] : void 0 ); if (typeof tokenId === "number") { if (tokenId >= 0) { return tokenId & BLOOM_MASK; } else { ngDevMode && assertEqual(tokenId, -1, "Expecting to get Special Injector Id"); return createNodeInjector; } } else { return tokenId; } } function bloomHasToken(bloomHash, injectorIndex, injectorView) { const mask = 1 << bloomHash; const value = injectorView[injectorIndex + (bloomHash >> BLOOM_BUCKET_BITS)]; return !!(value & mask); } function shouldSearchParent(flags, isFirstHostTNode) { return !(flags & 2) && !(flags & 1 && isFirstHostTNode); } function getNodeInjectorLView(nodeInjector) { return nodeInjector._lView; } function getNodeInjectorTNode(nodeInjector) { return nodeInjector._tNode; } var NodeInjector = class { _tNode; _lView; constructor(_tNode, _lView) { this._tNode = _tNode; this._lView = _lView; } get(token, notFoundValue, flags) { return getOrCreateInjectable(this._tNode, this._lView, token, convertToBitFlags(flags), notFoundValue); } }; function createNodeInjector() { return new NodeInjector(getCurrentTNode(), getLView()); } function ɵɵgetInheritedFactory(type) { return noSideEffects(() => { const ownConstructor = type.prototype.constructor; const ownFactory = ownConstructor[NG_FACTORY_DEF] || getFactoryOf(ownConstructor); const objectPrototype = Object.prototype; let parent = Object.getPrototypeOf(type.prototype).constructor; while (parent && parent !== objectPrototype) { const factory = parent[NG_FACTORY_DEF] || getFactoryOf(parent); if (factory && factory !== ownFactory) { return factory; } parent = Object.getPrototypeOf(parent); } return (t) => new t(); }); } function getFactoryOf(type) { if (isForwardRef(type)) { return () => { const factory = getFactoryOf(resolveForwardRef(type)); return factory && factory(); }; } return getFactoryDef(type); } function lookupTokenUsingEmbeddedInjector(tNode, lView, token, flags, notFoundValue) { let currentTNode = tNode; let currentLView = lView; while (currentTNode !== null && currentLView !== null && currentLView[FLAGS] & 2048 && !isRootView(currentLView)) { ngDevMode && assertTNodeForLView(currentTNode, currentLView); const nodeInjectorValue = lookupTokenUsingNodeInjector(currentTNode, currentLView, token, flags | 2, NOT_FOUND); if (nodeInjectorValue !== NOT_FOUND) { return nodeInjectorValue; } let parentTNode = currentTNode.parent; if (!parentTNode) { const embeddedViewInjector = currentLView[EMBEDDED_VIEW_INJECTOR]; if (embeddedViewInjector) { const embeddedViewInjectorValue = embeddedViewInjector.get(token, NOT_FOUND, flags); if (embeddedViewInjectorValue !== NOT_FOUND) { return embeddedViewInjectorValue; } } parentTNode = getTNodeFromLView(currentLView); currentLView = currentLView[DECLARATION_VIEW]; } currentTNode = parentTNode; } return notFoundValue; } function getTNodeFromLView(lView) { const tView = lView[TVIEW]; const tViewType = tView.type; if (tViewType === 2) { ngDevMode && assertDefined(tView.declTNode, "Embedded TNodes should have declaration parents."); return tView.declTNode; } else if (tViewType === 1) { return lView[T_HOST]; } return null; } function ɵɵinjectAttribute(attrNameToInject) { return injectAttributeImpl(getCurrentTNode(), attrNameToInject); } var Attribute2 = makeParamDecorator("Attribute", (attributeName) => ({ attributeName, __NG_ELEMENT_ID__: () => ɵɵinjectAttribute(attributeName) })); var _reflect = null; function getReflect() { return _reflect = _reflect || new ReflectionCapabilities(); } function reflectDependencies(type) { return convertDependencies(getReflect().parameters(type)); } function convertDependencies(deps) { return deps.map((dep) => reflectDependency(dep)); } function reflectDependency(dep) { const meta = { token: null, attribute: null, host: false, optional: false, self: false, skipSelf: false }; if (Array.isArray(dep) && dep.length > 0) { for (let j = 0; j < dep.length; j++) { const param = dep[j]; if (param === void 0) { continue; } const proto = Object.getPrototypeOf(param); if (param instanceof Optional || proto.ngMetadataName === "Optional") { meta.optional = true; } else if (param instanceof SkipSelf || proto.ngMetadataName === "SkipSelf") { meta.skipSelf = true; } else if (param instanceof Self || proto.ngMetadataName === "Self") { meta.self = true; } else if (param instanceof Host || proto.ngMetadataName === "Host") { meta.host = true; } else if (param instanceof Inject) { meta.token = param.token; } else if (param instanceof Attribute2) { if (param.attributeName === void 0) { throw new RuntimeError(204, ngDevMode && `Attribute name must be defined.`); } meta.attribute = param.attributeName; } else { meta.token = param; } } } else if (dep === void 0 || Array.isArray(dep) && dep.length === 0) { meta.token = null; } else { meta.token = dep; } return meta; } function compileInjectable(type, meta) { let ngInjectableDef = null; let ngFactoryDef = null; if (!type.hasOwnProperty(NG_PROV_DEF)) { Object.defineProperty(type, NG_PROV_DEF, { get: () => { if (ngInjectableDef === null) { const compiler = getCompilerFacade({ usage: 0, kind: "injectable", type }); ngInjectableDef = compiler.compileInjectable(angularCoreDiEnv, `ng:///${type.name}/ɵprov.js`, getInjectableMetadata(type, meta)); } return ngInjectableDef; } }); } if (!type.hasOwnProperty(NG_FACTORY_DEF)) { Object.defineProperty(type, NG_FACTORY_DEF, { get: () => { if (ngFactoryDef === null) { const compiler = getCompilerFacade({ usage: 0, kind: "injectable", type }); ngFactoryDef = compiler.compileFactory(angularCoreDiEnv, `ng:///${type.name}/ɵfac.js`, { name: type.name, type, typeArgumentCount: 0, // In JIT mode types are not available nor used. deps: reflectDependencies(type), target: compiler.FactoryTarget.Injectable }); } return ngFactoryDef; }, // Leave this configurable so that the factories from directives or pipes can take precedence. configurable: true }); } } var USE_VALUE = getClosureSafeProperty({ provide: String, useValue: getClosureSafeProperty }); function isUseClassProvider(meta) { return meta.useClass !== void 0; } function isUseValueProvider(meta) { return USE_VALUE in meta; } function isUseFactoryProvider(meta) { return meta.useFactory !== void 0; } function isUseExistingProvider(meta) { return meta.useExisting !== void 0; } function getInjectableMetadata(type, srcMeta) { const meta = srcMeta || { providedIn: null }; const compilerMeta = { name: type.name, type, typeArgumentCount: 0, providedIn: meta.providedIn }; if ((isUseClassProvider(meta) || isUseFactoryProvider(meta)) && meta.deps !== void 0) { compilerMeta.deps = convertDependencies(meta.deps); } if (isUseClassProvider(meta)) { compilerMeta.useClass = meta.useClass; } else if (isUseValueProvider(meta)) { compilerMeta.useValue = meta.useValue; } else if (isUseFactoryProvider(meta)) { compilerMeta.useFactory = meta.useFactory; } else if (isUseExistingProvider(meta)) { compilerMeta.useExisting = meta.useExisting; } return compilerMeta; } var Injectable = makeDecorator("Injectable", void 0, void 0, void 0, (type, meta) => compileInjectable(type, meta)); function injectElementRef() { return createElementRef(getCurrentTNode(), getLView()); } function createElementRef(tNode, lView) { return new ElementRef(getNativeByTNode(tNode, lView)); } var ElementRef = class { /** *
*
Use with caution
*

* Use this API as the last resort when direct access to DOM is needed. Use templating and * data-binding provided by Angular instead. If used, it is recommended in combination with * {@link /best-practices/security#direct-use-of-the-dom-apis-and-explicit-sanitization-calls DomSanitizer} * for maxiumum security; *

*
*/ nativeElement; constructor(nativeElement) { this.nativeElement = nativeElement; } /** * @internal * @nocollapse */ static __NG_ELEMENT_ID__ = injectElementRef; }; function unwrapElementRef(value) { return value instanceof ElementRef ? value.nativeElement : value; } function symbolIterator() { return this._results[Symbol.iterator](); } var QueryList = class { _emitDistinctChangesOnly; dirty = true; _onDirty = void 0; _results = []; _changesDetected = false; _changes = void 0; length = 0; first = void 0; last = void 0; /** * Returns `Observable` of `QueryList` notifying the subscriber of changes. */ get changes() { return this._changes ??= new Subject(); } /** * @param emitDistinctChangesOnly Whether `QueryList.changes` should fire only when actual change * has occurred. Or if it should fire when query is recomputed. (recomputing could resolve in * the same result) */ constructor(_emitDistinctChangesOnly = false) { this._emitDistinctChangesOnly = _emitDistinctChangesOnly; } /** * Returns the QueryList entry at `index`. */ get(index) { return this._results[index]; } /** * See * [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) */ map(fn) { return this._results.map(fn); } filter(fn) { return this._results.filter(fn); } /** * See * [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find) */ find(fn) { return this._results.find(fn); } /** * See * [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce) */ reduce(fn, init) { return this._results.reduce(fn, init); } /** * See * [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) */ forEach(fn) { this._results.forEach(fn); } /** * See * [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some) */ some(fn) { return this._results.some(fn); } /** * Returns a copy of the internal results list as an Array. */ toArray() { return this._results.slice(); } toString() { return this._results.toString(); } /** * Updates the stored data of the query list, and resets the `dirty` flag to `false`, so that * on change detection, it will not notify of changes to the queries, unless a new change * occurs. * * @param resultsTree The query results to store * @param identityAccessor Optional function for extracting stable object identity from a value * in the array. This function is executed for each element of the query result list while * comparing current query list with the new one (provided as a first argument of the `reset` * function) to detect if the lists are different. If the function is not provided, elements * are compared as is (without any pre-processing). */ reset(resultsTree, identityAccessor) { this.dirty = false; const newResultFlat = flatten(resultsTree); if (this._changesDetected = !arrayEquals(this._results, newResultFlat, identityAccessor)) { this._results = newResultFlat; this.length = newResultFlat.length; this.last = newResultFlat[this.length - 1]; this.first = newResultFlat[0]; } } /** * Triggers a change event by emitting on the `changes` {@link EventEmitter}. */ notifyOnChanges() { if (this._changes !== void 0 && (this._changesDetected || !this._emitDistinctChangesOnly)) this._changes.next(this); } /** @internal */ onDirty(cb) { this._onDirty = cb; } /** internal */ setDirty() { this.dirty = true; this._onDirty?.(); } /** internal */ destroy() { if (this._changes !== void 0) { this._changes.complete(); this._changes.unsubscribe(); } } [Symbol.iterator] = /* @__PURE__ */ (() => symbolIterator)(); }; var SKIP_HYDRATION_ATTR_NAME = "ngSkipHydration"; var SKIP_HYDRATION_ATTR_NAME_LOWER_CASE = "ngskiphydration"; function hasSkipHydrationAttrOnTNode(tNode) { const attrs = tNode.mergedAttrs; if (attrs === null) return false; for (let i = 0; i < attrs.length; i += 2) { const value = attrs[i]; if (typeof value === "number") return false; if (typeof value === "string" && value.toLowerCase() === SKIP_HYDRATION_ATTR_NAME_LOWER_CASE) { return true; } } return false; } function hasSkipHydrationAttrOnRElement(rNode) { return rNode.hasAttribute(SKIP_HYDRATION_ATTR_NAME); } function hasInSkipHydrationBlockFlag(tNode) { return (tNode.flags & 128) === 128; } function isInSkipHydrationBlock2(tNode) { if (hasInSkipHydrationBlockFlag(tNode)) { return true; } let currentTNode = tNode.parent; while (currentTNode) { if (hasInSkipHydrationBlockFlag(tNode) || hasSkipHydrationAttrOnTNode(currentTNode)) { return true; } currentTNode = currentTNode.parent; } return false; } function isI18nInSkipHydrationBlock(parentTNode) { return hasInSkipHydrationBlockFlag(parentTNode) || hasSkipHydrationAttrOnTNode(parentTNode) || isInSkipHydrationBlock2(parentTNode); } var ChangeDetectionStrategy; (function(ChangeDetectionStrategy2) { ChangeDetectionStrategy2[ChangeDetectionStrategy2["OnPush"] = 0] = "OnPush"; ChangeDetectionStrategy2[ChangeDetectionStrategy2["Default"] = 1] = "Default"; })(ChangeDetectionStrategy || (ChangeDetectionStrategy = {})); var TRACKED_LVIEWS = /* @__PURE__ */ new Map(); var uniqueIdCounter = 0; function getUniqueLViewId() { return uniqueIdCounter++; } function registerLView(lView) { ngDevMode && assertNumber(lView[ID], "LView must have an ID in order to be registered"); TRACKED_LVIEWS.set(lView[ID], lView); } function getLViewById(id) { ngDevMode && assertNumber(id, "ID used for LView lookup must be a number"); return TRACKED_LVIEWS.get(id) || null; } function unregisterLView(lView) { ngDevMode && assertNumber(lView[ID], "Cannot stop tracking an LView that does not have an ID"); TRACKED_LVIEWS.delete(lView[ID]); } function getTrackedLViews() { return TRACKED_LVIEWS; } var LContext = class { lViewId; nodeIndex; native; /** * The instance of the Component node. */ component; /** * The list of active directives that exist on this element. */ directives; /** * The map of local references (local reference name => element or directive instance) that * exist on this element. */ localRefs; /** Component's parent view data. */ get lView() { return getLViewById(this.lViewId); } constructor(lViewId, nodeIndex, native) { this.lViewId = lViewId; this.nodeIndex = nodeIndex; this.native = native; } }; function getLContext(target) { let mpValue = readPatchedData(target); if (mpValue) { if (isLView(mpValue)) { const lView = mpValue; let nodeIndex; let component = void 0; let directives = void 0; if (isComponentInstance(target)) { nodeIndex = findViaComponent(lView, target); if (nodeIndex == -1) { throw new Error("The provided component was not found in the application"); } component = target; } else if (isDirectiveInstance(target)) { nodeIndex = findViaDirective(lView, target); if (nodeIndex == -1) { throw new Error("The provided directive was not found in the application"); } directives = getDirectivesAtNodeIndex(nodeIndex, lView); } else { nodeIndex = findViaNativeElement(lView, target); if (nodeIndex == -1) { return null; } } const native = unwrapRNode(lView[nodeIndex]); const existingCtx = readPatchedData(native); const context = existingCtx && !Array.isArray(existingCtx) ? existingCtx : createLContext(lView, nodeIndex, native); if (component && context.component === void 0) { context.component = component; attachPatchData(context.component, context); } if (directives && context.directives === void 0) { context.directives = directives; for (let i = 0; i < directives.length; i++) { attachPatchData(directives[i], context); } } attachPatchData(context.native, context); mpValue = context; } } else { const rElement = target; ngDevMode && assertDomNode(rElement); let parent = rElement; while (parent = parent.parentNode) { const parentContext = readPatchedData(parent); if (parentContext) { const lView = Array.isArray(parentContext) ? parentContext : parentContext.lView; if (!lView) { return null; } const index = findViaNativeElement(lView, rElement); if (index >= 0) { const native = unwrapRNode(lView[index]); const context = createLContext(lView, index, native); attachPatchData(native, context); mpValue = context; break; } } } } return mpValue || null; } function createLContext(lView, nodeIndex, native) { return new LContext(lView[ID], nodeIndex, native); } function getComponentViewByInstance(componentInstance) { let patchedData = readPatchedData(componentInstance); let lView; if (isLView(patchedData)) { const contextLView = patchedData; const nodeIndex = findViaComponent(contextLView, componentInstance); lView = getComponentLViewByIndex(nodeIndex, contextLView); const context = createLContext(contextLView, nodeIndex, lView[HOST]); context.component = componentInstance; attachPatchData(componentInstance, context); attachPatchData(context.native, context); } else { const context = patchedData; const contextLView = context.lView; ngDevMode && assertLView(contextLView); lView = getComponentLViewByIndex(context.nodeIndex, contextLView); } return lView; } var MONKEY_PATCH_KEY_NAME = "__ngContext__"; function attachPatchData(target, data) { ngDevMode && assertDefined(target, "Target expected"); if (isLView(data)) { target[MONKEY_PATCH_KEY_NAME] = data[ID]; registerLView(data); } else { target[MONKEY_PATCH_KEY_NAME] = data; } } function readPatchedData(target) { ngDevMode && assertDefined(target, "Target expected"); const data = target[MONKEY_PATCH_KEY_NAME]; return typeof data === "number" ? getLViewById(data) : data || null; } function readPatchedLView(target) { const value = readPatchedData(target); if (value) { return isLView(value) ? value : value.lView; } return null; } function isComponentInstance(instance) { return instance && instance.constructor && instance.constructor.ɵcmp; } function isDirectiveInstance(instance) { return instance && instance.constructor && instance.constructor.ɵdir; } function findViaNativeElement(lView, target) { const tView = lView[TVIEW]; for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) { if (unwrapRNode(lView[i]) === target) { return i; } } return -1; } function traverseNextElement(tNode) { if (tNode.child) { return tNode.child; } else if (tNode.next) { return tNode.next; } else { while (tNode.parent && !tNode.parent.next) { tNode = tNode.parent; } return tNode.parent && tNode.parent.next; } } function findViaComponent(lView, componentInstance) { const componentIndices = lView[TVIEW].components; if (componentIndices) { for (let i = 0; i < componentIndices.length; i++) { const elementComponentIndex = componentIndices[i]; const componentView = getComponentLViewByIndex(elementComponentIndex, lView); if (componentView[CONTEXT] === componentInstance) { return elementComponentIndex; } } } else { const rootComponentView = getComponentLViewByIndex(HEADER_OFFSET, lView); const rootComponent = rootComponentView[CONTEXT]; if (rootComponent === componentInstance) { return HEADER_OFFSET; } } return -1; } function findViaDirective(lView, directiveInstance) { let tNode = lView[TVIEW].firstChild; while (tNode) { const directiveIndexStart = tNode.directiveStart; const directiveIndexEnd = tNode.directiveEnd; for (let i = directiveIndexStart; i < directiveIndexEnd; i++) { if (lView[i] === directiveInstance) { return tNode.index; } } tNode = traverseNextElement(tNode); } return -1; } function getDirectivesAtNodeIndex(nodeIndex, lView) { const tNode = lView[TVIEW].data[nodeIndex]; if (tNode.directiveStart === 0) return EMPTY_ARRAY; const results = []; for (let i = tNode.directiveStart; i < tNode.directiveEnd; i++) { const directiveInstance = lView[i]; if (!isComponentInstance(directiveInstance)) { results.push(directiveInstance); } } return results; } function getComponentAtNodeIndex(nodeIndex, lView) { const tNode = lView[TVIEW].data[nodeIndex]; return isComponentHost(tNode) ? lView[tNode.directiveStart + tNode.componentOffset] : null; } function discoverLocalRefs(lView, nodeIndex) { const tNode = lView[TVIEW].data[nodeIndex]; if (tNode && tNode.localNames) { const result = {}; let localIndex = tNode.index + 1; for (let i = 0; i < tNode.localNames.length; i += 2) { result[tNode.localNames[i]] = lView[localIndex]; localIndex++; } return result; } return null; } function getRootView(componentOrLView) { ngDevMode && assertDefined(componentOrLView, "component"); let lView = isLView(componentOrLView) ? componentOrLView : readPatchedLView(componentOrLView); while (lView && !isRootView(lView)) { lView = getLViewParent(lView); } ngDevMode && assertLView(lView); return lView; } function getRootContext(viewOrComponent) { const rootView = getRootView(viewOrComponent); ngDevMode && assertDefined(rootView[CONTEXT], "Root view has no context. Perhaps it is disconnected?"); return rootView[CONTEXT]; } function getFirstLContainer(lView) { return getNearestLContainer(lView[CHILD_HEAD]); } function getNextLContainer(container) { return getNearestLContainer(container[NEXT]); } function getNearestLContainer(viewOrContainer) { while (viewOrContainer !== null && !isLContainer(viewOrContainer)) { viewOrContainer = viewOrContainer[NEXT]; } return viewOrContainer; } function getComponent(element) { ngDevMode && assertDomElement(element); const context = getLContext(element); if (context === null) return null; if (context.component === void 0) { const lView = context.lView; if (lView === null) { return null; } context.component = getComponentAtNodeIndex(context.nodeIndex, lView); } return context.component; } function getContext(element) { assertDomElement(element); const context = getLContext(element); const lView = context ? context.lView : null; return lView === null ? null : lView[CONTEXT]; } function getOwningComponent(elementOrDir) { const context = getLContext(elementOrDir); let lView = context ? context.lView : null; if (lView === null) return null; let parent; while (lView[TVIEW].type === 2 && (parent = getLViewParent(lView))) { lView = parent; } return isRootView(lView) ? null : lView[CONTEXT]; } function getRootComponents(elementOrDir) { const lView = readPatchedLView(elementOrDir); return lView !== null ? [getRootContext(lView)] : []; } function getInjector(elementOrDir) { const context = getLContext(elementOrDir); const lView = context ? context.lView : null; if (lView === null) return Injector.NULL; const tNode = lView[TVIEW].data[context.nodeIndex]; return new NodeInjector(tNode, lView); } function getInjectionTokens(element) { const context = getLContext(element); const lView = context ? context.lView : null; if (lView === null) return []; const tView = lView[TVIEW]; const tNode = tView.data[context.nodeIndex]; const providerTokens = []; const startIndex = tNode.providerIndexes & 1048575; const endIndex = tNode.directiveEnd; for (let i = startIndex; i < endIndex; i++) { let value = tView.data[i]; if (isDirectiveDefHack(value)) { value = value.type; } providerTokens.push(value); } return providerTokens; } function getDirectives(node) { if (node instanceof Text) { return []; } const context = getLContext(node); const lView = context ? context.lView : null; if (lView === null) { return []; } const tView = lView[TVIEW]; const nodeIndex = context.nodeIndex; if (!tView?.data[nodeIndex]) { return []; } if (context.directives === void 0) { context.directives = getDirectivesAtNodeIndex(nodeIndex, lView); } return context.directives === null ? [] : [...context.directives]; } var Framework; (function(Framework2) { Framework2["Angular"] = "angular"; Framework2["ACX"] = "acx"; Framework2["Wiz"] = "wiz"; })(Framework || (Framework = {})); var AcxChangeDetectionStrategy; (function(AcxChangeDetectionStrategy2) { AcxChangeDetectionStrategy2[AcxChangeDetectionStrategy2["Default"] = 0] = "Default"; AcxChangeDetectionStrategy2[AcxChangeDetectionStrategy2["OnPush"] = 1] = "OnPush"; })(AcxChangeDetectionStrategy || (AcxChangeDetectionStrategy = {})); var AcxViewEncapsulation; (function(AcxViewEncapsulation2) { AcxViewEncapsulation2[AcxViewEncapsulation2["Emulated"] = 0] = "Emulated"; AcxViewEncapsulation2[AcxViewEncapsulation2["None"] = 1] = "None"; })(AcxViewEncapsulation || (AcxViewEncapsulation = {})); function getDirectiveMetadata$1(directiveOrComponentInstance) { const { constructor } = directiveOrComponentInstance; if (!constructor) { throw new Error("Unable to find the instance constructor"); } const componentDef = getComponentDef(constructor); if (componentDef) { const inputs = extractInputDebugMetadata(componentDef.inputs); return { inputs, outputs: componentDef.outputs, encapsulation: componentDef.encapsulation, changeDetection: componentDef.onPush ? ChangeDetectionStrategy.OnPush : ChangeDetectionStrategy.Default }; } const directiveDef = getDirectiveDef(constructor); if (directiveDef) { const inputs = extractInputDebugMetadata(directiveDef.inputs); return { inputs, outputs: directiveDef.outputs }; } return null; } function getLocalRefs(target) { const context = getLContext(target); if (context === null) return {}; if (context.localRefs === void 0) { const lView = context.lView; if (lView === null) { return {}; } context.localRefs = discoverLocalRefs(lView, context.nodeIndex); } return context.localRefs || {}; } function getHostElement(componentOrDirective) { return getLContext(componentOrDirective).native; } function getListeners(element) { ngDevMode && assertDomElement(element); const lContext = getLContext(element); const lView = lContext === null ? null : lContext.lView; if (lView === null) return []; const tView = lView[TVIEW]; const lCleanup = lView[CLEANUP]; const tCleanup = tView.cleanup; const listeners = []; if (tCleanup && lCleanup) { for (let i = 0; i < tCleanup.length; ) { const firstParam = tCleanup[i++]; const secondParam = tCleanup[i++]; if (typeof firstParam === "string") { const name = firstParam; const listenerElement = unwrapRNode(lView[secondParam]); const callback = lCleanup[tCleanup[i++]]; const useCaptureOrIndx = tCleanup[i++]; const type = typeof useCaptureOrIndx === "boolean" || useCaptureOrIndx >= 0 ? "dom" : "output"; const useCapture = typeof useCaptureOrIndx === "boolean" ? useCaptureOrIndx : false; if (element == listenerElement) { listeners.push({ element, name, callback, useCapture, type }); } } } } listeners.sort(sortListeners); return listeners; } function sortListeners(a, b) { if (a.name == b.name) return 0; return a.name < b.name ? -1 : 1; } function isDirectiveDefHack(obj) { return obj.type !== void 0 && obj.declaredInputs !== void 0 && obj.resolveHostDirectives !== void 0; } function assertDomElement(value) { if (typeof Element !== "undefined" && !(value instanceof Element)) { throw new Error("Expecting instance of DOM Element"); } } function extractInputDebugMetadata(inputs) { const res = {}; for (const key in inputs) { if (inputs.hasOwnProperty(key)) { const value = inputs[key]; if (value !== void 0) { res[key] = value[0]; } } } return res; } var DOCUMENT = void 0; function setDocument(document2) { DOCUMENT = document2; } function getDocument() { if (DOCUMENT !== void 0) { return DOCUMENT; } else if (typeof document !== "undefined") { return document; } throw new RuntimeError(210, (typeof ngDevMode === "undefined" || ngDevMode) && `The document object is not available in this context. Make sure the DOCUMENT injection token is provided.`); } var APP_ID = new InjectionToken(ngDevMode ? "AppId" : "", { providedIn: "root", factory: () => DEFAULT_APP_ID }); var DEFAULT_APP_ID = "ng"; var PLATFORM_INITIALIZER = new InjectionToken(ngDevMode ? "Platform Initializer" : ""); var PLATFORM_ID = new InjectionToken(ngDevMode ? "Platform ID" : "", { providedIn: "platform", factory: () => "unknown" // set a default platform name, when none set explicitly }); var PACKAGE_ROOT_URL = new InjectionToken(ngDevMode ? "Application Packages Root URL" : ""); var ANIMATION_MODULE_TYPE = new InjectionToken(ngDevMode ? "AnimationModuleType" : ""); var CSP_NONCE = new InjectionToken(ngDevMode ? "CSP nonce" : "", { providedIn: "root", factory: () => { return getDocument().body?.querySelector("[ngCspNonce]")?.getAttribute("ngCspNonce") || null; } }); var IMAGE_CONFIG_DEFAULTS = { breakpoints: [16, 32, 48, 64, 96, 128, 256, 384, 640, 750, 828, 1080, 1200, 1920, 2048, 3840], placeholderResolution: 30, disableImageSizeWarning: false, disableImageLazyLoadWarning: false }; var IMAGE_CONFIG = new InjectionToken(ngDevMode ? "ImageConfig" : "", { providedIn: "root", factory: () => IMAGE_CONFIG_DEFAULTS }); function makeStateKey(key) { return key; } function initTransferState() { const transferState = new TransferState(); if (true) { transferState.store = retrieveTransferredState(getDocument(), inject(APP_ID)); } return transferState; } var TransferState = class _TransferState { /** @nocollapse */ static ɵprov = ( /** @pureOrBreakMyCode */ ɵɵdefineInjectable({ token: _TransferState, providedIn: "root", factory: initTransferState }) ); /** @internal */ store = {}; onSerializeCallbacks = {}; /** * Get the value corresponding to a key. Return `defaultValue` if key is not found. */ get(key, defaultValue) { return this.store[key] !== void 0 ? this.store[key] : defaultValue; } /** * Set the value corresponding to a key. */ set(key, value) { this.store[key] = value; } /** * Remove a key from the store. */ remove(key) { delete this.store[key]; } /** * Test whether a key exists in the store. */ hasKey(key) { return this.store.hasOwnProperty(key); } /** * Indicates whether the state is empty. */ get isEmpty() { return Object.keys(this.store).length === 0; } /** * Register a callback to provide the value for a key when `toJson` is called. */ onSerialize(key, callback) { this.onSerializeCallbacks[key] = callback; } /** * Serialize the current state of the store to JSON. */ toJson() { for (const key in this.onSerializeCallbacks) { if (this.onSerializeCallbacks.hasOwnProperty(key)) { try { this.store[key] = this.onSerializeCallbacks[key](); } catch (e) { console.warn("Exception in onSerialize callback: ", e); } } } return JSON.stringify(this.store).replace(/ PRESERVE_HOST_CONTENT_DEFAULT }); var IS_I18N_HYDRATION_ENABLED = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "IS_I18N_HYDRATION_ENABLED" : ""); var IS_EVENT_REPLAY_ENABLED = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "IS_EVENT_REPLAY_ENABLED" : ""); var EVENT_REPLAY_ENABLED_DEFAULT = false; var IS_INCREMENTAL_HYDRATION_ENABLED = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "IS_INCREMENTAL_HYDRATION_ENABLED" : ""); var JSACTION_BLOCK_ELEMENT_MAP = new InjectionToken(ngDevMode ? "JSACTION_BLOCK_ELEMENT_MAP" : "", { providedIn: "root", factory: () => /* @__PURE__ */ new Map() }); var IS_ENABLED_BLOCKING_INITIAL_NAVIGATION = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "IS_ENABLED_BLOCKING_INITIAL_NAVIGATION" : ""); var eventListenerOptions = { passive: true, capture: true }; var hoverTriggers = /* @__PURE__ */ new WeakMap(); var interactionTriggers = /* @__PURE__ */ new WeakMap(); var viewportTriggers = /* @__PURE__ */ new WeakMap(); var interactionEventNames = ["click", "keydown"]; var hoverEventNames = ["mouseenter", "mouseover", "focusin"]; var intersectionObserver = null; var observedViewportElements = 0; var DeferEventEntry = class { callbacks = /* @__PURE__ */ new Set(); listener = () => { for (const callback of this.callbacks) { callback(); } }; }; function onInteraction(trigger, callback) { let entry = interactionTriggers.get(trigger); if (!entry) { entry = new DeferEventEntry(); interactionTriggers.set(trigger, entry); for (const name of interactionEventNames) { trigger.addEventListener(name, entry.listener, eventListenerOptions); } } entry.callbacks.add(callback); return () => { const { callbacks, listener } = entry; callbacks.delete(callback); if (callbacks.size === 0) { interactionTriggers.delete(trigger); for (const name of interactionEventNames) { trigger.removeEventListener(name, listener, eventListenerOptions); } } }; } function onHover(trigger, callback) { let entry = hoverTriggers.get(trigger); if (!entry) { entry = new DeferEventEntry(); hoverTriggers.set(trigger, entry); for (const name of hoverEventNames) { trigger.addEventListener(name, entry.listener, eventListenerOptions); } } entry.callbacks.add(callback); return () => { const { callbacks, listener } = entry; callbacks.delete(callback); if (callbacks.size === 0) { for (const name of hoverEventNames) { trigger.removeEventListener(name, listener, eventListenerOptions); } hoverTriggers.delete(trigger); } }; } function createIntersectionObserver() { return new IntersectionObserver((entries) => { for (const current of entries) { if (current.isIntersecting && viewportTriggers.has(current.target)) { viewportTriggers.get(current.target).listener(); } } }); } function onViewport(trigger, callback, observerFactoryFn) { let entry = viewportTriggers.get(trigger); intersectionObserver = intersectionObserver || observerFactoryFn(); if (!entry) { entry = new DeferEventEntry(); intersectionObserver.observe(trigger); viewportTriggers.set(trigger, entry); observedViewportElements++; } entry.callbacks.add(callback); return () => { if (!viewportTriggers.has(trigger)) { return; } entry.callbacks.delete(callback); if (entry.callbacks.size === 0) { intersectionObserver?.unobserve(trigger); viewportTriggers.delete(trigger); observedViewportElements--; } if (observedViewportElements === 0) { intersectionObserver?.disconnect(); intersectionObserver = null; } }; } var DEFER_BLOCK_SSR_ID_ATTRIBUTE = "ngb"; function setJSActionAttributes(nativeElement, eventTypes, parentDeferBlockId = null) { if (eventTypes.length === 0 || nativeElement.nodeType !== Node.ELEMENT_NODE) { return; } const existingAttr = nativeElement.getAttribute(Attribute.JSACTION); const parts = eventTypes.reduce((prev, curr) => { return (existingAttr?.indexOf(curr) ?? -1) === -1 ? prev + curr + ":;" : prev; }, ""); nativeElement.setAttribute(Attribute.JSACTION, `${existingAttr ?? ""}${parts}`); const blockName = parentDeferBlockId ?? ""; if (blockName !== "" && parts.length > 0) { nativeElement.setAttribute(DEFER_BLOCK_SSR_ID_ATTRIBUTE, blockName); } } var sharedStashFunction = (rEl, eventType, listenerFn) => { const el = rEl; const eventListenerMap = el.__jsaction_fns ?? /* @__PURE__ */ new Map(); const eventListeners = eventListenerMap.get(eventType) ?? []; eventListeners.push(listenerFn); eventListenerMap.set(eventType, eventListeners); el.__jsaction_fns = eventListenerMap; }; var sharedMapFunction = (rEl, jsActionMap) => { const el = rEl; let blockName = el.getAttribute(DEFER_BLOCK_SSR_ID_ATTRIBUTE) ?? ""; const blockSet = jsActionMap.get(blockName) ?? /* @__PURE__ */ new Set(); if (!blockSet.has(el)) { blockSet.add(el); } jsActionMap.set(blockName, blockSet); }; function removeListenersFromBlocks(blockNames, jsActionMap) { if (blockNames.length > 0) { let blockList = []; for (let blockName of blockNames) { if (jsActionMap.has(blockName)) { blockList = [...blockList, ...jsActionMap.get(blockName)]; } } const replayList = new Set(blockList); replayList.forEach(removeListeners); } } var removeListeners = (el) => { el.removeAttribute(Attribute.JSACTION); el.removeAttribute(DEFER_BLOCK_SSR_ID_ATTRIBUTE); el.__jsaction_fns = void 0; }; var JSACTION_EVENT_CONTRACT = new InjectionToken(ngDevMode ? "EVENT_CONTRACT_DETAILS" : "", { providedIn: "root", factory: () => ({}) }); function invokeListeners(event, currentTarget) { const handlerFns = currentTarget?.__jsaction_fns?.get(event.type); if (!handlerFns || !currentTarget?.isConnected) { return; } for (const handler of handlerFns) { handler(event); } } var stashEventListeners = /* @__PURE__ */ new Map(); function setStashFn(appId, fn) { stashEventListeners.set(appId, fn); return () => stashEventListeners.delete(appId); } var isStashEventListenerImplEnabled = false; var _stashEventListenerImpl = (lView, target, eventName, wrappedListener) => { }; function stashEventListenerImpl(lView, target, eventName, wrappedListener) { _stashEventListenerImpl(lView, target, eventName, wrappedListener); } function enableStashEventListenerImpl() { if (!isStashEventListenerImplEnabled) { _stashEventListenerImpl = (lView, target, eventName, wrappedListener) => { const appId = lView[INJECTOR].get(APP_ID); const stashEventListener = stashEventListeners.get(appId); stashEventListener?.(target, eventName, wrappedListener); }; isStashEventListenerImplEnabled = true; } } var DEHYDRATED_BLOCK_REGISTRY = new InjectionToken(ngDevMode ? "DEHYDRATED_BLOCK_REGISTRY" : ""); var DehydratedBlockRegistry = class _DehydratedBlockRegistry { registry = /* @__PURE__ */ new Map(); cleanupFns = /* @__PURE__ */ new Map(); jsActionMap = inject(JSACTION_BLOCK_ELEMENT_MAP); contract = inject(JSACTION_EVENT_CONTRACT); add(blockId, info) { this.registry.set(blockId, info); if (this.awaitingCallbacks.has(blockId)) { const awaitingCallbacks = this.awaitingCallbacks.get(blockId); for (const cb of awaitingCallbacks) { cb(); } } } get(blockId) { return this.registry.get(blockId) ?? null; } has(blockId) { return this.registry.has(blockId); } cleanup(hydratedBlocks) { removeListenersFromBlocks(hydratedBlocks, this.jsActionMap); for (let blockId of hydratedBlocks) { this.registry.delete(blockId); this.jsActionMap.delete(blockId); this.invokeTriggerCleanupFns(blockId); this.hydrating.delete(blockId); this.awaitingCallbacks.delete(blockId); } if (this.size === 0) { this.contract.instance?.cleanUp(); } } get size() { return this.registry.size; } // we have to leave the lowest block Id in the registry // unless that block has no children addCleanupFn(blockId, fn) { let cleanupFunctions = []; if (this.cleanupFns.has(blockId)) { cleanupFunctions = this.cleanupFns.get(blockId); } cleanupFunctions.push(fn); this.cleanupFns.set(blockId, cleanupFunctions); } invokeTriggerCleanupFns(blockId) { const fns = this.cleanupFns.get(blockId) ?? []; for (let fn of fns) { fn(); } this.cleanupFns.delete(blockId); } // Blocks that are being hydrated. hydrating = /* @__PURE__ */ new Map(); // Blocks that are awaiting a defer instruction finish. awaitingCallbacks = /* @__PURE__ */ new Map(); awaitParentBlock(topmostParentBlock, callback) { const parentBlockAwaitCallbacks = this.awaitingCallbacks.get(topmostParentBlock) ?? []; parentBlockAwaitCallbacks.push(callback); this.awaitingCallbacks.set(topmostParentBlock, parentBlockAwaitCallbacks); } /** @nocollapse */ static ɵprov = ( /** @pureOrBreakMyCode */ ɵɵdefineInjectable({ token: _DehydratedBlockRegistry, providedIn: null, factory: () => new _DehydratedBlockRegistry() }) ); }; function isDetachedByI18n(tNode) { return (tNode.flags & 32) === 32; } var TRANSFER_STATE_TOKEN_ID = "__nghData__"; var NGH_DATA_KEY = makeStateKey(TRANSFER_STATE_TOKEN_ID); var TRANSFER_STATE_DEFER_BLOCKS_INFO = "__nghDeferData__"; var NGH_DEFER_BLOCKS_KEY = makeStateKey(TRANSFER_STATE_DEFER_BLOCKS_INFO); function isInternalHydrationTransferStateKey(key) { return key === TRANSFER_STATE_TOKEN_ID || key === TRANSFER_STATE_DEFER_BLOCKS_INFO; } var NGH_ATTR_NAME = "ngh"; var SSR_CONTENT_INTEGRITY_MARKER = "nghm"; var _retrieveHydrationInfoImpl = () => null; function retrieveHydrationInfoImpl(rNode, injector, isRootView2 = false) { let nghAttrValue = rNode.getAttribute(NGH_ATTR_NAME); if (nghAttrValue == null) return null; const [componentViewNgh, rootViewNgh] = nghAttrValue.split("|"); nghAttrValue = isRootView2 ? rootViewNgh : componentViewNgh; if (!nghAttrValue) return null; const rootNgh = rootViewNgh ? `|${rootViewNgh}` : ""; const remainingNgh = isRootView2 ? componentViewNgh : rootNgh; let data = {}; if (nghAttrValue !== "") { const transferState = injector.get(TransferState, null, { optional: true }); if (transferState !== null) { const nghData = transferState.get(NGH_DATA_KEY, []); data = nghData[Number(nghAttrValue)]; ngDevMode && assertDefined(data, "Unable to retrieve hydration info from the TransferState."); } } const dehydratedView = { data, firstChild: rNode.firstChild ?? null }; if (isRootView2) { dehydratedView.firstChild = rNode; setSegmentHead(dehydratedView, 0, rNode.nextSibling); } if (remainingNgh) { rNode.setAttribute(NGH_ATTR_NAME, remainingNgh); } else { rNode.removeAttribute(NGH_ATTR_NAME); } ngDevMode && markRNodeAsClaimedByHydration( rNode, /* checkIfAlreadyClaimed */ false ); ngDevMode && ngDevMode.hydratedComponents++; return dehydratedView; } function enableRetrieveHydrationInfoImpl() { _retrieveHydrationInfoImpl = retrieveHydrationInfoImpl; } function retrieveHydrationInfo(rNode, injector, isRootView2 = false) { return _retrieveHydrationInfoImpl(rNode, injector, isRootView2); } function getLNodeForHydration(viewRef) { let lView = viewRef._lView; const tView = lView[TVIEW]; if (tView.type === 2) { return null; } if (isRootView(lView)) { lView = lView[HEADER_OFFSET]; } return lView; } function getTextNodeContent(node) { return node.textContent?.replace(/\s/gm, ""); } function processTextNodeMarkersBeforeHydration(node) { const doc = getDocument(); const commentNodesIterator = doc.createNodeIterator(node, NodeFilter.SHOW_COMMENT, { acceptNode(node2) { const content = getTextNodeContent(node2); const isTextNodeMarker = content === "ngetn" || content === "ngtns"; return isTextNodeMarker ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT; } }); let currentNode; const nodes = []; while (currentNode = commentNodesIterator.nextNode()) { nodes.push(currentNode); } for (const node2 of nodes) { if (node2.textContent === "ngetn") { node2.replaceWith(doc.createTextNode("")); } else { node2.remove(); } } } var HydrationStatus; (function(HydrationStatus2) { HydrationStatus2["Hydrated"] = "hydrated"; HydrationStatus2["Skipped"] = "skipped"; HydrationStatus2["Mismatched"] = "mismatched"; })(HydrationStatus || (HydrationStatus = {})); var HYDRATION_INFO_KEY = "__ngDebugHydrationInfo__"; function patchHydrationInfo(node, info) { node[HYDRATION_INFO_KEY] = info; } function readHydrationInfo(node) { return node[HYDRATION_INFO_KEY] ?? null; } function markRNodeAsClaimedByHydration(node, checkIfAlreadyClaimed = true) { if (!ngDevMode) { throw new Error("Calling `markRNodeAsClaimedByHydration` in prod mode is not supported and likely a mistake."); } if (checkIfAlreadyClaimed && isRNodeClaimedForHydration(node)) { throw new Error("Trying to claim a node, which was claimed already."); } patchHydrationInfo(node, { status: HydrationStatus.Hydrated }); ngDevMode.hydratedNodes++; } function markRNodeAsSkippedByHydration(node) { if (!ngDevMode) { throw new Error("Calling `markRNodeAsSkippedByHydration` in prod mode is not supported and likely a mistake."); } patchHydrationInfo(node, { status: HydrationStatus.Skipped }); ngDevMode.componentsSkippedHydration++; } function countBlocksSkippedByHydration(injector) { const transferState = injector.get(TransferState); const nghDeferData = transferState.get(NGH_DEFER_BLOCKS_KEY, {}); if (ngDevMode) { ngDevMode.deferBlocksWithIncrementalHydration = Object.keys(nghDeferData).length; } } function markRNodeAsHavingHydrationMismatch(node, expectedNodeDetails = null, actualNodeDetails = null) { if (!ngDevMode) { throw new Error("Calling `markRNodeAsMismatchedByHydration` in prod mode is not supported and likely a mistake."); } while (node && !getComponent(node)) { node = node?.parentNode; } if (node) { patchHydrationInfo(node, { status: HydrationStatus.Mismatched, expectedNodeDetails, actualNodeDetails }); } } function isRNodeClaimedForHydration(node) { return readHydrationInfo(node)?.status === HydrationStatus.Hydrated; } function setSegmentHead(hydrationInfo, index, node) { hydrationInfo.segmentHeads ??= {}; hydrationInfo.segmentHeads[index] = node; } function getSegmentHead(hydrationInfo, index) { return hydrationInfo.segmentHeads?.[index] ?? null; } function isIncrementalHydrationEnabled(injector) { return injector.get(IS_INCREMENTAL_HYDRATION_ENABLED, false, { optional: true }); } function assertIncrementalHydrationIsConfigured(injector) { if (!isIncrementalHydrationEnabled(injector)) { throw new RuntimeError(508, "Angular has detected that some `@defer` blocks use `hydrate` triggers, but incremental hydration was not enabled. Please ensure that the `withIncrementalHydration()` call is added as an argument for the `provideClientHydration()` function call in your application config."); } } function assertSsrIdDefined(ssrUniqueId) { assertDefined(ssrUniqueId, "Internal error: expecting an SSR id for a defer block that should be hydrated, but the id is not present"); } function getNgContainerSize(hydrationInfo, index) { const data = hydrationInfo.data; let size = data[ELEMENT_CONTAINERS]?.[index] ?? null; if (size === null && data[CONTAINERS]?.[index]) { size = calcSerializedContainerSize(hydrationInfo, index); } return size; } function isSerializedElementContainer(hydrationInfo, index) { return hydrationInfo.data[ELEMENT_CONTAINERS]?.[index] !== void 0; } function getSerializedContainerViews(hydrationInfo, index) { return hydrationInfo.data[CONTAINERS]?.[index] ?? null; } function calcSerializedContainerSize(hydrationInfo, index) { const views = getSerializedContainerViews(hydrationInfo, index) ?? []; let numNodes = 0; for (let view of views) { numNodes += view[NUM_ROOT_NODES] * (view[MULTIPLIER] ?? 1); } return numNodes; } function initDisconnectedNodes(hydrationInfo) { if (typeof hydrationInfo.disconnectedNodes === "undefined") { const nodeIds = hydrationInfo.data[DISCONNECTED_NODES]; hydrationInfo.disconnectedNodes = nodeIds ? new Set(nodeIds) : null; } return hydrationInfo.disconnectedNodes; } function isDisconnectedNode$1(hydrationInfo, index) { if (typeof hydrationInfo.disconnectedNodes === "undefined") { const nodeIds = hydrationInfo.data[DISCONNECTED_NODES]; hydrationInfo.disconnectedNodes = nodeIds ? new Set(nodeIds) : null; } return !!initDisconnectedNodes(hydrationInfo)?.has(index); } function canHydrateNode(lView, tNode) { const hydrationInfo = lView[HYDRATION]; return hydrationInfo !== null && !isInSkipHydrationBlock() && !isDetachedByI18n(tNode) && !isDisconnectedNode$1(hydrationInfo, tNode.index - HEADER_OFFSET); } function processTextNodeBeforeSerialization(context, node) { const el = node; const corruptedTextNodes = context.corruptedTextNodes; if (el.textContent === "") { corruptedTextNodes.set( el, "ngetn" /* TextNodeMarker.EmptyNode */ ); } else if (el.nextSibling?.nodeType === Node.TEXT_NODE) { corruptedTextNodes.set( el, "ngtns" /* TextNodeMarker.Separator */ ); } } function convertHydrateTriggersToJsAction(triggers) { let actionList = []; if (triggers !== null) { if (triggers.has( 4 /* DeferBlockTrigger.Hover */ )) { actionList.push(...hoverEventNames); } if (triggers.has( 3 /* DeferBlockTrigger.Interaction */ )) { actionList.push(...interactionEventNames); } } return actionList; } function getParentBlockHydrationQueue(deferBlockId, injector) { const dehydratedBlockRegistry = injector.get(DEHYDRATED_BLOCK_REGISTRY); const transferState = injector.get(TransferState); const deferBlockParents = transferState.get(NGH_DEFER_BLOCKS_KEY, {}); let isTopMostDeferBlock = false; let currentBlockId = deferBlockId; let parentBlockPromise = null; const hydrationQueue = []; while (!isTopMostDeferBlock && currentBlockId) { ngDevMode && assertEqual(hydrationQueue.indexOf(currentBlockId), -1, "Internal error: defer block hierarchy has a cycle."); isTopMostDeferBlock = dehydratedBlockRegistry.has(currentBlockId); const hydratingParentBlock = dehydratedBlockRegistry.hydrating.get(currentBlockId); if (parentBlockPromise === null && hydratingParentBlock != null) { parentBlockPromise = hydratingParentBlock.promise; break; } hydrationQueue.unshift(currentBlockId); currentBlockId = deferBlockParents[currentBlockId][DEFER_PARENT_BLOCK_ID]; } return { parentBlockPromise, hydrationQueue }; } function gatherDeferBlocksByJSActionAttribute(doc) { const jsactionNodes = doc.body.querySelectorAll("[jsaction]"); const blockMap = /* @__PURE__ */ new Set(); const eventTypes = [hoverEventNames.join(":;"), interactionEventNames.join(":;")].join("|"); for (let node of jsactionNodes) { const attr = node.getAttribute("jsaction"); const blockId = node.getAttribute("ngb"); if (attr?.match(eventTypes) && blockId !== null) { blockMap.add(node); } } return blockMap; } function appendDeferBlocksToJSActionMap(doc, injector) { const blockMap = gatherDeferBlocksByJSActionAttribute(doc); const jsActionMap = injector.get(JSACTION_BLOCK_ELEMENT_MAP); for (let rNode of blockMap) { sharedMapFunction(rNode, jsActionMap); } } var _retrieveDeferBlockDataImpl = () => { return {}; }; function retrieveDeferBlockDataImpl(injector) { const transferState = injector.get(TransferState, null, { optional: true }); if (transferState !== null) { const nghDeferData = transferState.get(NGH_DEFER_BLOCKS_KEY, {}); ngDevMode && assertDefined(nghDeferData, "Unable to retrieve defer block info from the TransferState."); return nghDeferData; } return {}; } function enableRetrieveDeferBlockDataImpl() { _retrieveDeferBlockDataImpl = retrieveDeferBlockDataImpl; } function retrieveDeferBlockData(injector) { return _retrieveDeferBlockDataImpl(injector); } function isTimerTrigger(triggerInfo) { return typeof triggerInfo === "object" && triggerInfo.trigger === 5; } function getHydrateTimerTrigger(blockData) { const trigger = blockData[DEFER_HYDRATE_TRIGGERS]?.find((t) => isTimerTrigger(t)); return trigger?.delay ?? null; } function hasHydrateTrigger(blockData, trigger) { return blockData[DEFER_HYDRATE_TRIGGERS]?.includes(trigger) ?? false; } function createBlockSummary(blockInfo) { return { data: blockInfo, hydrate: { idle: hasHydrateTrigger( blockInfo, 0 /* DeferBlockTrigger.Idle */ ), immediate: hasHydrateTrigger( blockInfo, 1 /* DeferBlockTrigger.Immediate */ ), timer: getHydrateTimerTrigger(blockInfo), viewport: hasHydrateTrigger( blockInfo, 2 /* DeferBlockTrigger.Viewport */ ) } }; } function processBlockData(injector) { const blockData = retrieveDeferBlockData(injector); let blockDetails = /* @__PURE__ */ new Map(); for (let blockId in blockData) { blockDetails.set(blockId, createBlockSummary(blockData[blockId])); } return blockDetails; } function isSsrContentsIntegrity(node) { return !!node && node.nodeType === Node.COMMENT_NODE && node.textContent?.trim() === SSR_CONTENT_INTEGRITY_MARKER; } function skipTextNodes(node) { while (node && node.nodeType === Node.TEXT_NODE) { node = node.previousSibling; } return node; } function verifySsrContentsIntegrity(doc) { for (const node of doc.body.childNodes) { if (isSsrContentsIntegrity(node)) { return; } } const beforeBody = skipTextNodes(doc.body.previousSibling); if (isSsrContentsIntegrity(beforeBody)) { return; } let endOfHead = skipTextNodes(doc.head.lastChild); if (isSsrContentsIntegrity(endOfHead)) { return; } throw new RuntimeError(-507, typeof ngDevMode !== "undefined" && ngDevMode && "Angular hydration logic detected that HTML content of this page was modified after it was produced during server side rendering. Make sure that there are no optimizations that remove comment nodes from HTML enabled on your CDN. Angular hydration relies on HTML produced by the server, including whitespaces and comment nodes."); } function refreshContentQueries(tView, lView) { const contentQueries = tView.contentQueries; if (contentQueries !== null) { const prevConsumer = setActiveConsumer(null); try { for (let i = 0; i < contentQueries.length; i += 2) { const queryStartIdx = contentQueries[i]; const directiveDefIdx = contentQueries[i + 1]; if (directiveDefIdx !== -1) { const directiveDef = tView.data[directiveDefIdx]; ngDevMode && assertDefined(directiveDef, "DirectiveDef not found."); ngDevMode && assertDefined(directiveDef.contentQueries, "contentQueries function should be defined"); setCurrentQueryIndex(queryStartIdx); directiveDef.contentQueries(2, lView[directiveDefIdx], directiveDefIdx); } } } finally { setActiveConsumer(prevConsumer); } } } function executeViewQueryFn(flags, viewQueryFn, component) { ngDevMode && assertDefined(viewQueryFn, "View queries function to execute must be defined."); setCurrentQueryIndex(0); const prevConsumer = setActiveConsumer(null); try { viewQueryFn(flags, component); } finally { setActiveConsumer(prevConsumer); } } function executeContentQueries(tView, tNode, lView) { if (isContentQueryHost(tNode)) { const prevConsumer = setActiveConsumer(null); try { const start = tNode.directiveStart; const end = tNode.directiveEnd; for (let directiveIndex = start; directiveIndex < end; directiveIndex++) { const def = tView.data[directiveIndex]; if (def.contentQueries) { const directiveInstance = lView[directiveIndex]; ngDevMode && assertDefined(directiveIndex, "Incorrect reference to a directive defining a content query"); def.contentQueries(1, directiveInstance, directiveIndex); } } } finally { setActiveConsumer(prevConsumer); } } } var ViewEncapsulation; (function(ViewEncapsulation3) { ViewEncapsulation3[ViewEncapsulation3["Emulated"] = 0] = "Emulated"; ViewEncapsulation3[ViewEncapsulation3["None"] = 2] = "None"; ViewEncapsulation3[ViewEncapsulation3["ShadowDom"] = 3] = "ShadowDom"; })(ViewEncapsulation || (ViewEncapsulation = {})); var policy$1; function getPolicy$1() { if (policy$1 === void 0) { policy$1 = null; if (_global.trustedTypes) { try { policy$1 = _global.trustedTypes.createPolicy("angular", { createHTML: (s) => s, createScript: (s) => s, createScriptURL: (s) => s }); } catch { } } } return policy$1; } function trustedHTMLFromString(html) { return getPolicy$1()?.createHTML(html) || html; } function trustedScriptURLFromString(url) { return getPolicy$1()?.createScriptURL(url) || url; } var policy; function getPolicy() { if (policy === void 0) { policy = null; if (_global.trustedTypes) { try { policy = _global.trustedTypes.createPolicy("angular#unsafe-bypass", { createHTML: (s) => s, createScript: (s) => s, createScriptURL: (s) => s }); } catch { } } } return policy; } function trustedHTMLFromStringBypass(html) { return getPolicy()?.createHTML(html) || html; } function trustedScriptFromStringBypass(script) { return getPolicy()?.createScript(script) || script; } function trustedScriptURLFromStringBypass(url) { return getPolicy()?.createScriptURL(url) || url; } var SafeValueImpl = class { changingThisBreaksApplicationSecurity; constructor(changingThisBreaksApplicationSecurity) { this.changingThisBreaksApplicationSecurity = changingThisBreaksApplicationSecurity; } toString() { return `SafeValue must use [property]=binding: ${this.changingThisBreaksApplicationSecurity} (see ${XSS_SECURITY_URL})`; } }; var SafeHtmlImpl = class extends SafeValueImpl { getTypeName() { return "HTML"; } }; var SafeStyleImpl = class extends SafeValueImpl { getTypeName() { return "Style"; } }; var SafeScriptImpl = class extends SafeValueImpl { getTypeName() { return "Script"; } }; var SafeUrlImpl = class extends SafeValueImpl { getTypeName() { return "URL"; } }; var SafeResourceUrlImpl = class extends SafeValueImpl { getTypeName() { return "ResourceURL"; } }; function unwrapSafeValue(value) { return value instanceof SafeValueImpl ? value.changingThisBreaksApplicationSecurity : value; } function allowSanitizationBypassAndThrow(value, type) { const actualType = getSanitizationBypassType(value); if (actualType != null && actualType !== type) { if (actualType === "ResourceURL" && type === "URL") return true; throw new Error(`Required a safe ${type}, got a ${actualType} (see ${XSS_SECURITY_URL})`); } return actualType === type; } function getSanitizationBypassType(value) { return value instanceof SafeValueImpl && value.getTypeName() || null; } function bypassSanitizationTrustHtml(trustedHtml) { return new SafeHtmlImpl(trustedHtml); } function bypassSanitizationTrustStyle(trustedStyle) { return new SafeStyleImpl(trustedStyle); } function bypassSanitizationTrustScript(trustedScript) { return new SafeScriptImpl(trustedScript); } function bypassSanitizationTrustUrl(trustedUrl) { return new SafeUrlImpl(trustedUrl); } function bypassSanitizationTrustResourceUrl(trustedResourceUrl) { return new SafeResourceUrlImpl(trustedResourceUrl); } function getInertBodyHelper(defaultDoc) { const inertDocumentHelper = new InertDocumentHelper(defaultDoc); return isDOMParserAvailable() ? new DOMParserHelper(inertDocumentHelper) : inertDocumentHelper; } var DOMParserHelper = class { inertDocumentHelper; constructor(inertDocumentHelper) { this.inertDocumentHelper = inertDocumentHelper; } getInertBodyElement(html) { html = "" + html; try { const body = new window.DOMParser().parseFromString(trustedHTMLFromString(html), "text/html").body; if (body === null) { return this.inertDocumentHelper.getInertBodyElement(html); } body.firstChild?.remove(); return body; } catch { return null; } } }; var InertDocumentHelper = class { defaultDoc; inertDocument; constructor(defaultDoc) { this.defaultDoc = defaultDoc; this.inertDocument = this.defaultDoc.implementation.createHTMLDocument("sanitization-inert"); } getInertBodyElement(html) { const templateEl = this.inertDocument.createElement("template"); templateEl.innerHTML = trustedHTMLFromString(html); return templateEl; } }; function isDOMParserAvailable() { try { return !!new window.DOMParser().parseFromString(trustedHTMLFromString(""), "text/html"); } catch { return false; } } var SAFE_URL_PATTERN = /^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:\/?#]*(?:[\/?#]|$))/i; function _sanitizeUrl(url) { url = String(url); if (url.match(SAFE_URL_PATTERN)) return url; if (typeof ngDevMode === "undefined" || ngDevMode) { console.warn(`WARNING: sanitizing unsafe URL value ${url} (see ${XSS_SECURITY_URL})`); } return "unsafe:" + url; } function tagSet(tags) { const res = {}; for (const t of tags.split(",")) res[t] = true; return res; } function merge(...sets) { const res = {}; for (const s of sets) { for (const v in s) { if (s.hasOwnProperty(v)) res[v] = true; } } return res; } var VOID_ELEMENTS = tagSet("area,br,col,hr,img,wbr"); var OPTIONAL_END_TAG_BLOCK_ELEMENTS = tagSet("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"); var OPTIONAL_END_TAG_INLINE_ELEMENTS = tagSet("rp,rt"); var OPTIONAL_END_TAG_ELEMENTS = merge(OPTIONAL_END_TAG_INLINE_ELEMENTS, OPTIONAL_END_TAG_BLOCK_ELEMENTS); var BLOCK_ELEMENTS = merge(OPTIONAL_END_TAG_BLOCK_ELEMENTS, tagSet("address,article,aside,blockquote,caption,center,del,details,dialog,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,main,map,menu,nav,ol,pre,section,summary,table,ul")); var INLINE_ELEMENTS = merge(OPTIONAL_END_TAG_INLINE_ELEMENTS, tagSet("a,abbr,acronym,audio,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,picture,q,ruby,rp,rt,s,samp,small,source,span,strike,strong,sub,sup,time,track,tt,u,var,video")); var VALID_ELEMENTS = merge(VOID_ELEMENTS, BLOCK_ELEMENTS, INLINE_ELEMENTS, OPTIONAL_END_TAG_ELEMENTS); var URI_ATTRS = tagSet("background,cite,href,itemtype,longdesc,poster,src,xlink:href"); var HTML_ATTRS = tagSet("abbr,accesskey,align,alt,autoplay,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,controls,coords,datetime,default,dir,download,face,headers,height,hidden,hreflang,hspace,ismap,itemscope,itemprop,kind,label,lang,language,loop,media,muted,nohref,nowrap,open,preload,rel,rev,role,rows,rowspan,rules,scope,scrolling,shape,size,sizes,span,srclang,srcset,start,summary,tabindex,target,title,translate,type,usemap,valign,value,vspace,width"); var ARIA_ATTRS = tagSet("aria-activedescendant,aria-atomic,aria-autocomplete,aria-busy,aria-checked,aria-colcount,aria-colindex,aria-colspan,aria-controls,aria-current,aria-describedby,aria-details,aria-disabled,aria-dropeffect,aria-errormessage,aria-expanded,aria-flowto,aria-grabbed,aria-haspopup,aria-hidden,aria-invalid,aria-keyshortcuts,aria-label,aria-labelledby,aria-level,aria-live,aria-modal,aria-multiline,aria-multiselectable,aria-orientation,aria-owns,aria-placeholder,aria-posinset,aria-pressed,aria-readonly,aria-relevant,aria-required,aria-roledescription,aria-rowcount,aria-rowindex,aria-rowspan,aria-selected,aria-setsize,aria-sort,aria-valuemax,aria-valuemin,aria-valuenow,aria-valuetext"); var VALID_ATTRS = merge(URI_ATTRS, HTML_ATTRS, ARIA_ATTRS); var SKIP_TRAVERSING_CONTENT_IF_INVALID_ELEMENTS = tagSet("script,style,template"); var SanitizingHtmlSerializer = class { // Explicitly track if something was stripped, to avoid accidentally warning of sanitization just // because characters were re-encoded. sanitizedSomething = false; buf = []; sanitizeChildren(el) { let current = el.firstChild; let traverseContent = true; let parentNodes = []; while (current) { if (current.nodeType === Node.ELEMENT_NODE) { traverseContent = this.startElement(current); } else if (current.nodeType === Node.TEXT_NODE) { this.chars(current.nodeValue); } else { this.sanitizedSomething = true; } if (traverseContent && current.firstChild) { parentNodes.push(current); current = getFirstChild(current); continue; } while (current) { if (current.nodeType === Node.ELEMENT_NODE) { this.endElement(current); } let next = getNextSibling(current); if (next) { current = next; break; } current = parentNodes.pop(); } } return this.buf.join(""); } /** * Sanitizes an opening element tag (if valid) and returns whether the element's contents should * be traversed. Element content must always be traversed (even if the element itself is not * valid/safe), unless the element is one of `SKIP_TRAVERSING_CONTENT_IF_INVALID_ELEMENTS`. * * @param element The element to sanitize. * @return True if the element's contents should be traversed. */ startElement(element) { const tagName = getNodeName(element).toLowerCase(); if (!VALID_ELEMENTS.hasOwnProperty(tagName)) { this.sanitizedSomething = true; return !SKIP_TRAVERSING_CONTENT_IF_INVALID_ELEMENTS.hasOwnProperty(tagName); } this.buf.push("<"); this.buf.push(tagName); const elAttrs = element.attributes; for (let i = 0; i < elAttrs.length; i++) { const elAttr = elAttrs.item(i); const attrName = elAttr.name; const lower = attrName.toLowerCase(); if (!VALID_ATTRS.hasOwnProperty(lower)) { this.sanitizedSomething = true; continue; } let value = elAttr.value; if (URI_ATTRS[lower]) value = _sanitizeUrl(value); this.buf.push(" ", attrName, '="', encodeEntities(value), '"'); } this.buf.push(">"); return true; } endElement(current) { const tagName = getNodeName(current).toLowerCase(); if (VALID_ELEMENTS.hasOwnProperty(tagName) && !VOID_ELEMENTS.hasOwnProperty(tagName)) { this.buf.push(""); } } chars(chars) { this.buf.push(encodeEntities(chars)); } }; function isClobberedElement(parentNode, childNode) { return (parentNode.compareDocumentPosition(childNode) & Node.DOCUMENT_POSITION_CONTAINED_BY) !== Node.DOCUMENT_POSITION_CONTAINED_BY; } function getNextSibling(node) { const nextSibling = node.nextSibling; if (nextSibling && node !== nextSibling.previousSibling) { throw clobberedElementError(nextSibling); } return nextSibling; } function getFirstChild(node) { const firstChild = node.firstChild; if (firstChild && isClobberedElement(node, firstChild)) { throw clobberedElementError(firstChild); } return firstChild; } function getNodeName(node) { const nodeName = node.nodeName; return typeof nodeName === "string" ? nodeName : "FORM"; } function clobberedElementError(node) { return new Error(`Failed to sanitize html because the element is clobbered: ${node.outerHTML}`); } var SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g; var NON_ALPHANUMERIC_REGEXP = /([^\#-~ |!])/g; function encodeEntities(value) { return value.replace(/&/g, "&").replace(SURROGATE_PAIR_REGEXP, function(match) { const hi = match.charCodeAt(0); const low = match.charCodeAt(1); return "&#" + ((hi - 55296) * 1024 + (low - 56320) + 65536) + ";"; }).replace(NON_ALPHANUMERIC_REGEXP, function(match) { return "&#" + match.charCodeAt(0) + ";"; }).replace(//g, ">"); } var inertBodyHelper; function _sanitizeHtml(defaultDoc, unsafeHtmlInput) { let inertBodyElement = null; try { inertBodyHelper = inertBodyHelper || getInertBodyHelper(defaultDoc); let unsafeHtml = unsafeHtmlInput ? String(unsafeHtmlInput) : ""; inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeHtml); let mXSSAttempts = 5; let parsedHtml = unsafeHtml; do { if (mXSSAttempts === 0) { throw new Error("Failed to sanitize html because the input is unstable"); } mXSSAttempts--; unsafeHtml = parsedHtml; parsedHtml = inertBodyElement.innerHTML; inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeHtml); } while (unsafeHtml !== parsedHtml); const sanitizer = new SanitizingHtmlSerializer(); const safeHtml = sanitizer.sanitizeChildren(getTemplateContent(inertBodyElement) || inertBodyElement); if ((typeof ngDevMode === "undefined" || ngDevMode) && sanitizer.sanitizedSomething) { console.warn(`WARNING: sanitizing HTML stripped some content, see ${XSS_SECURITY_URL}`); } return trustedHTMLFromString(safeHtml); } finally { if (inertBodyElement) { const parent = getTemplateContent(inertBodyElement) || inertBodyElement; while (parent.firstChild) { parent.firstChild.remove(); } } } } function getTemplateContent(el) { return "content" in el && isTemplateElement(el) ? el.content : null; } function isTemplateElement(el) { return el.nodeType === Node.ELEMENT_NODE && el.nodeName === "TEMPLATE"; } var SecurityContext; (function(SecurityContext2) { SecurityContext2[SecurityContext2["NONE"] = 0] = "NONE"; SecurityContext2[SecurityContext2["HTML"] = 1] = "HTML"; SecurityContext2[SecurityContext2["STYLE"] = 2] = "STYLE"; SecurityContext2[SecurityContext2["SCRIPT"] = 3] = "SCRIPT"; SecurityContext2[SecurityContext2["URL"] = 4] = "URL"; SecurityContext2[SecurityContext2["RESOURCE_URL"] = 5] = "RESOURCE_URL"; })(SecurityContext || (SecurityContext = {})); function ɵɵsanitizeHtml(unsafeHtml) { const sanitizer = getSanitizer(); if (sanitizer) { return trustedHTMLFromStringBypass(sanitizer.sanitize(SecurityContext.HTML, unsafeHtml) || ""); } if (allowSanitizationBypassAndThrow( unsafeHtml, "HTML" /* BypassType.Html */ )) { return trustedHTMLFromStringBypass(unwrapSafeValue(unsafeHtml)); } return _sanitizeHtml(getDocument(), renderStringify(unsafeHtml)); } function ɵɵsanitizeStyle(unsafeStyle) { const sanitizer = getSanitizer(); if (sanitizer) { return sanitizer.sanitize(SecurityContext.STYLE, unsafeStyle) || ""; } if (allowSanitizationBypassAndThrow( unsafeStyle, "Style" /* BypassType.Style */ )) { return unwrapSafeValue(unsafeStyle); } return renderStringify(unsafeStyle); } function ɵɵsanitizeUrl(unsafeUrl) { const sanitizer = getSanitizer(); if (sanitizer) { return sanitizer.sanitize(SecurityContext.URL, unsafeUrl) || ""; } if (allowSanitizationBypassAndThrow( unsafeUrl, "URL" /* BypassType.Url */ )) { return unwrapSafeValue(unsafeUrl); } return _sanitizeUrl(renderStringify(unsafeUrl)); } function ɵɵsanitizeResourceUrl(unsafeResourceUrl) { const sanitizer = getSanitizer(); if (sanitizer) { return trustedScriptURLFromStringBypass(sanitizer.sanitize(SecurityContext.RESOURCE_URL, unsafeResourceUrl) || ""); } if (allowSanitizationBypassAndThrow( unsafeResourceUrl, "ResourceURL" /* BypassType.ResourceUrl */ )) { return trustedScriptURLFromStringBypass(unwrapSafeValue(unsafeResourceUrl)); } throw new RuntimeError(904, ngDevMode && `unsafe value used in a resource URL context (see ${XSS_SECURITY_URL})`); } function ɵɵsanitizeScript(unsafeScript) { const sanitizer = getSanitizer(); if (sanitizer) { return trustedScriptFromStringBypass(sanitizer.sanitize(SecurityContext.SCRIPT, unsafeScript) || ""); } if (allowSanitizationBypassAndThrow( unsafeScript, "Script" /* BypassType.Script */ )) { return trustedScriptFromStringBypass(unwrapSafeValue(unsafeScript)); } throw new RuntimeError(905, ngDevMode && "unsafe value used in a script context"); } function ɵɵtrustConstantHtml(html) { if (ngDevMode && (!Array.isArray(html) || !Array.isArray(html.raw) || html.length !== 1)) { throw new Error(`Unexpected interpolation in trusted HTML constant: ${html.join("?")}`); } return trustedHTMLFromString(html[0]); } function ɵɵtrustConstantResourceUrl(url) { if (ngDevMode && (!Array.isArray(url) || !Array.isArray(url.raw) || url.length !== 1)) { throw new Error(`Unexpected interpolation in trusted URL constant: ${url.join("?")}`); } return trustedScriptURLFromString(url[0]); } function getUrlSanitizer(tag, prop) { if (prop === "src" && (tag === "embed" || tag === "frame" || tag === "iframe" || tag === "media" || tag === "script") || prop === "href" && (tag === "base" || tag === "link")) { return ɵɵsanitizeResourceUrl; } return ɵɵsanitizeUrl; } function ɵɵsanitizeUrlOrResourceUrl(unsafeUrl, tag, prop) { return getUrlSanitizer(tag, prop)(unsafeUrl); } function validateAgainstEventProperties(name) { if (name.toLowerCase().startsWith("on")) { const errorMessage = `Binding to event property '${name}' is disallowed for security reasons, please use (${name.slice(2)})=... If '${name}' is a directive input, make sure the directive is imported by the current module.`; throw new RuntimeError(306, errorMessage); } } function validateAgainstEventAttributes(name) { if (name.toLowerCase().startsWith("on")) { const errorMessage = `Binding to event attribute '${name}' is disallowed for security reasons, please use (${name.slice(2)})=...`; throw new RuntimeError(306, errorMessage); } } function getSanitizer() { const lView = getLView(); return lView && lView[ENVIRONMENT].sanitizer; } var COMMENT_DISALLOWED = /^>|^->||--!>|)/g; var COMMENT_DELIMITER_ESCAPED = "​$1​"; function escapeCommentText(value) { return value.replace(COMMENT_DISALLOWED, (text) => text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED)); } var NG_REFLECT_ATTRS_FLAG_DEFAULT = false; var NG_REFLECT_ATTRS_FLAG = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "NG_REFLECT_FLAG" : "", { providedIn: "root", factory: () => NG_REFLECT_ATTRS_FLAG_DEFAULT }); function provideNgReflectAttributes() { const providers = typeof ngDevMode === "undefined" || ngDevMode ? [ { provide: NG_REFLECT_ATTRS_FLAG, useValue: true } ] : []; return makeEnvironmentProviders(providers); } function normalizeDebugBindingName(name) { name = camelCaseToDashCase(name.replace(/[$@]/g, "_")); return `ng-reflect-${name}`; } var CAMEL_CASE_REGEXP = /([A-Z])/g; function camelCaseToDashCase(input2) { return input2.replace(CAMEL_CASE_REGEXP, (...m) => "-" + m[1].toLowerCase()); } function normalizeDebugBindingValue(value) { try { return value != null ? value.toString().slice(0, 30) : value; } catch (e) { return "[ERROR] Exception while trying to serialize the value"; } } var CUSTOM_ELEMENTS_SCHEMA = { name: "custom-elements" }; var NO_ERRORS_SCHEMA = { name: "no-errors-schema" }; var shouldThrowErrorOnUnknownElement = false; function ɵsetUnknownElementStrictMode(shouldThrow) { shouldThrowErrorOnUnknownElement = shouldThrow; } function ɵgetUnknownElementStrictMode() { return shouldThrowErrorOnUnknownElement; } var shouldThrowErrorOnUnknownProperty = false; function ɵsetUnknownPropertyStrictMode(shouldThrow) { shouldThrowErrorOnUnknownProperty = shouldThrow; } function ɵgetUnknownPropertyStrictMode() { return shouldThrowErrorOnUnknownProperty; } function validateElementIsKnown(lView, tNode) { const tView = lView[TVIEW]; if (tView.schemas === null) return; const tagName = tNode.value; if (!isDirectiveHost(tNode) && tagName !== null) { const isUnknown = ( // Note that we can't check for `typeof HTMLUnknownElement === 'function'` because // Domino doesn't expose HTMLUnknownElement globally. typeof HTMLUnknownElement !== "undefined" && HTMLUnknownElement && getNativeByTNode(tNode, lView) instanceof HTMLUnknownElement || typeof customElements !== "undefined" && tagName.indexOf("-") > -1 && !customElements.get(tagName) ); if (isUnknown && !matchingSchemas(tView.schemas, tagName)) { const isHostStandalone = isHostComponentStandalone(lView); const templateLocation = getTemplateLocationDetails(lView); const schemas = `'${isHostStandalone ? "@Component" : "@NgModule"}.schemas'`; let message = `'${tagName}' is not a known element${templateLocation}: `; message += `1. If '${tagName}' is an Angular component, then verify that it is ${isHostStandalone ? "included in the '@Component.imports' of this component" : "a part of an @NgModule where this component is declared"}. `; if (tagName && tagName.indexOf("-") > -1) { message += `2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`; } else { message += `2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`; } if (shouldThrowErrorOnUnknownElement) { throw new RuntimeError(304, message); } else { console.error(formatRuntimeError(304, message)); } } } } function isPropertyValid(element, propName, tagName, schemas) { if (schemas === null) return true; if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) { return true; } return typeof Node === "undefined" || Node === null || !(element instanceof Node); } function handleUnknownPropertyError(propName, tagName, nodeType, lView) { if (!tagName && nodeType === 4) { tagName = "ng-template"; } const isHostStandalone = isHostComponentStandalone(lView); const templateLocation = getTemplateLocationDetails(lView); let message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'${templateLocation}.`; const schemas = `'${isHostStandalone ? "@Component" : "@NgModule"}.schemas'`; const importLocation = isHostStandalone ? "included in the '@Component.imports' of this component" : "a part of an @NgModule where this component is declared"; if (KNOWN_CONTROL_FLOW_DIRECTIVES.has(propName)) { const correspondingImport = KNOWN_CONTROL_FLOW_DIRECTIVES.get(propName); message += ` If the '${propName}' is an Angular control flow directive, please make sure that either the '${correspondingImport}' directive or the 'CommonModule' is ${importLocation}.`; } else { message += ` 1. If '${tagName}' is an Angular component and it has the '${propName}' input, then verify that it is ${importLocation}.`; if (tagName && tagName.indexOf("-") > -1) { message += ` 2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`; message += ` 3. To allow any property add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`; } else { message += ` 2. To allow any property add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`; } } reportUnknownPropertyError(message); } function reportUnknownPropertyError(message) { if (shouldThrowErrorOnUnknownProperty) { throw new RuntimeError(303, message); } else { console.error(formatRuntimeError(303, message)); } } function getDeclarationComponentDef(lView) { !ngDevMode && throwError("Must never be called in production mode"); const declarationLView = lView[DECLARATION_COMPONENT_VIEW]; const context = declarationLView[CONTEXT]; if (!context) return null; return context.constructor ? getComponentDef(context.constructor) : null; } function isHostComponentStandalone(lView) { !ngDevMode && throwError("Must never be called in production mode"); const componentDef = getDeclarationComponentDef(lView); return !!componentDef?.standalone; } function getTemplateLocationDetails(lView) { !ngDevMode && throwError("Must never be called in production mode"); const hostComponentDef = getDeclarationComponentDef(lView); const componentClassName = hostComponentDef?.type?.name; return componentClassName ? ` (used in the '${componentClassName}' component template)` : ""; } var KNOWN_CONTROL_FLOW_DIRECTIVES = /* @__PURE__ */ new Map([ ["ngIf", "NgIf"], ["ngFor", "NgFor"], ["ngSwitchCase", "NgSwitchCase"], ["ngSwitchDefault", "NgSwitchDefault"] ]); function matchingSchemas(schemas, tagName) { if (schemas !== null) { for (let i = 0; i < schemas.length; i++) { const schema = schemas[i]; if (schema === NO_ERRORS_SCHEMA || schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf("-") > -1) { return true; } } } return false; } function ɵɵresolveWindow(element) { return element.ownerDocument.defaultView; } function ɵɵresolveDocument(element) { return element.ownerDocument; } function ɵɵresolveBody(element) { return element.ownerDocument.body; } var INTERPOLATION_DELIMITER = `�`; function maybeUnwrapFn(value) { if (value instanceof Function) { return value(); } else { return value; } } var VALUE_STRING_LENGTH_LIMIT = 200; function assertStandaloneComponentType(type) { assertComponentDef(type); const componentDef = getComponentDef(type); if (!componentDef.standalone) { throw new RuntimeError(907, `The ${stringifyForError(type)} component is not marked as standalone, but Angular expects to have a standalone component here. Please make sure the ${stringifyForError(type)} component has the \`standalone: true\` flag in the decorator.`); } } function assertComponentDef(type) { if (!getComponentDef(type)) { throw new RuntimeError(906, `The ${stringifyForError(type)} is not an Angular component, make sure it has the \`@Component\` decorator.`); } } function throwMultipleComponentError(tNode, first, second) { throw new RuntimeError(-300, `Multiple components match node with tagname ${tNode.value}: ${stringifyForError(first)} and ${stringifyForError(second)}`); } function throwErrorIfNoChangesMode(creationMode, oldValue, currValue, propName, lView) { const hostComponentDef = getDeclarationComponentDef(lView); const componentClassName = hostComponentDef?.type?.name; const field = propName ? ` for '${propName}'` : ""; let msg = `ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value${field}: '${formatValue(oldValue)}'. Current value: '${formatValue(currValue)}'.${componentClassName ? ` Expression location: ${componentClassName} component` : ""}`; if (creationMode) { msg += ` It seems like the view has been created after its parent and its children have been dirty checked. Has it been created in a change detection hook?`; } throw new RuntimeError(-100, msg); } function formatValue(value) { let strValue = String(value); try { if (Array.isArray(value) || strValue === "[object Object]") { strValue = JSON.stringify(value); } } catch (error) { } return strValue.length > VALUE_STRING_LENGTH_LIMIT ? strValue.substring(0, VALUE_STRING_LENGTH_LIMIT) + "…" : strValue; } function constructDetailsForInterpolation(lView, rootIndex, expressionIndex, meta, changedValue) { const [propName, prefix, ...chunks] = meta.split(INTERPOLATION_DELIMITER); let oldValue = prefix, newValue = prefix; for (let i = 0; i < chunks.length; i++) { const slotIdx = rootIndex + i; oldValue += `${lView[slotIdx]}${chunks[i]}`; newValue += `${slotIdx === expressionIndex ? changedValue : lView[slotIdx]}${chunks[i]}`; } return { propName, oldValue, newValue }; } function getExpressionChangedErrorDetails(lView, bindingIndex, oldValue, newValue) { const tData = lView[TVIEW].data; const metadata = tData[bindingIndex]; if (typeof metadata === "string") { if (metadata.indexOf(INTERPOLATION_DELIMITER) > -1) { return constructDetailsForInterpolation(lView, bindingIndex, bindingIndex, metadata, newValue); } return { propName: metadata, oldValue, newValue }; } if (metadata === null) { let idx = bindingIndex - 1; while (typeof tData[idx] !== "string" && tData[idx + 1] === null) { idx--; } const meta = tData[idx]; if (typeof meta === "string") { const matches = meta.match(new RegExp(INTERPOLATION_DELIMITER, "g")); if (matches && matches.length - 1 > bindingIndex - idx) { return constructDetailsForInterpolation(lView, idx, bindingIndex, meta, newValue); } } } return { propName: void 0, oldValue, newValue }; } function classIndexOf(className, classToSearch, startingIndex) { ngDevMode && assertNotEqual(classToSearch, "", 'can not look for "" string.'); let end = className.length; while (true) { const foundIndex = className.indexOf(classToSearch, startingIndex); if (foundIndex === -1) return foundIndex; if (foundIndex === 0 || className.charCodeAt(foundIndex - 1) <= 32) { const length = classToSearch.length; if (foundIndex + length === end || className.charCodeAt(foundIndex + length) <= 32) { return foundIndex; } } startingIndex = foundIndex + 1; } } var NG_TEMPLATE_SELECTOR = "ng-template"; function isCssClassMatching(tNode, attrs, cssClassToMatch, isProjectionMode) { ngDevMode && assertEqual(cssClassToMatch, cssClassToMatch.toLowerCase(), "Class name expected to be lowercase."); let i = 0; if (isProjectionMode) { for (; i < attrs.length && typeof attrs[i] === "string"; i += 2) { if (attrs[i] === "class" && classIndexOf(attrs[i + 1].toLowerCase(), cssClassToMatch, 0) !== -1) { return true; } } } else if (isInlineTemplate(tNode)) { return false; } i = attrs.indexOf(1, i); if (i > -1) { let item; while (++i < attrs.length && typeof (item = attrs[i]) === "string") { if (item.toLowerCase() === cssClassToMatch) { return true; } } } return false; } function isInlineTemplate(tNode) { return tNode.type === 4 && tNode.value !== NG_TEMPLATE_SELECTOR; } function hasTagAndTypeMatch(tNode, currentSelector, isProjectionMode) { const tagNameToCompare = tNode.type === 4 && !isProjectionMode ? NG_TEMPLATE_SELECTOR : tNode.value; return currentSelector === tagNameToCompare; } function isNodeMatchingSelector(tNode, selector, isProjectionMode) { ngDevMode && assertDefined(selector[0], "Selector should have a tag name"); let mode = 4; const nodeAttrs = tNode.attrs; const nameOnlyMarkerIdx = nodeAttrs !== null ? getNameOnlyMarkerIndex(nodeAttrs) : 0; let skipToNextSelector = false; for (let i = 0; i < selector.length; i++) { const current = selector[i]; if (typeof current === "number") { if (!skipToNextSelector && !isPositive(mode) && !isPositive(current)) { return false; } if (skipToNextSelector && isPositive(current)) continue; skipToNextSelector = false; mode = current | mode & 1; continue; } if (skipToNextSelector) continue; if (mode & 4) { mode = 2 | mode & 1; if (current !== "" && !hasTagAndTypeMatch(tNode, current, isProjectionMode) || current === "" && selector.length === 1) { if (isPositive(mode)) return false; skipToNextSelector = true; } } else if (mode & 8) { if (nodeAttrs === null || !isCssClassMatching(tNode, nodeAttrs, current, isProjectionMode)) { if (isPositive(mode)) return false; skipToNextSelector = true; } } else { const selectorAttrValue = selector[++i]; const attrIndexInNode = findAttrIndexInNode(current, nodeAttrs, isInlineTemplate(tNode), isProjectionMode); if (attrIndexInNode === -1) { if (isPositive(mode)) return false; skipToNextSelector = true; continue; } if (selectorAttrValue !== "") { let nodeAttrValue; if (attrIndexInNode > nameOnlyMarkerIdx) { nodeAttrValue = ""; } else { ngDevMode && assertNotEqual(nodeAttrs[attrIndexInNode], 0, "We do not match directives on namespaced attributes"); nodeAttrValue = nodeAttrs[attrIndexInNode + 1].toLowerCase(); } if (mode & 2 && selectorAttrValue !== nodeAttrValue) { if (isPositive(mode)) return false; skipToNextSelector = true; } } } } return isPositive(mode) || skipToNextSelector; } function isPositive(mode) { return (mode & 1) === 0; } function findAttrIndexInNode(name, attrs, isInlineTemplate2, isProjectionMode) { if (attrs === null) return -1; let i = 0; if (isProjectionMode || !isInlineTemplate2) { let bindingsMode = false; while (i < attrs.length) { const maybeAttrName = attrs[i]; if (maybeAttrName === name) { return i; } else if (maybeAttrName === 3 || maybeAttrName === 6) { bindingsMode = true; } else if (maybeAttrName === 1 || maybeAttrName === 2) { let value = attrs[++i]; while (typeof value === "string") { value = attrs[++i]; } continue; } else if (maybeAttrName === 4) { break; } else if (maybeAttrName === 0) { i += 4; continue; } i += bindingsMode ? 1 : 2; } return -1; } else { return matchTemplateAttribute(attrs, name); } } function isNodeMatchingSelectorList(tNode, selector, isProjectionMode = false) { for (let i = 0; i < selector.length; i++) { if (isNodeMatchingSelector(tNode, selector[i], isProjectionMode)) { return true; } } return false; } function getProjectAsAttrValue(tNode) { const nodeAttrs = tNode.attrs; if (nodeAttrs != null) { const ngProjectAsAttrIdx = nodeAttrs.indexOf( 5 /* AttributeMarker.ProjectAs */ ); if ((ngProjectAsAttrIdx & 1) === 0) { return nodeAttrs[ngProjectAsAttrIdx + 1]; } } return null; } function getNameOnlyMarkerIndex(nodeAttrs) { for (let i = 0; i < nodeAttrs.length; i++) { const nodeAttr = nodeAttrs[i]; if (isNameOnlyAttributeMarker(nodeAttr)) { return i; } } return nodeAttrs.length; } function matchTemplateAttribute(attrs, name) { let i = attrs.indexOf( 4 /* AttributeMarker.Template */ ); if (i > -1) { i++; while (i < attrs.length) { const attr = attrs[i]; if (typeof attr === "number") return -1; if (attr === name) return i; i++; } } return -1; } function isSelectorInSelectorList(selector, list) { selectorListLoop: for (let i = 0; i < list.length; i++) { const currentSelectorInList = list[i]; if (selector.length !== currentSelectorInList.length) { continue; } for (let j = 0; j < selector.length; j++) { if (selector[j] !== currentSelectorInList[j]) { continue selectorListLoop; } } return true; } return false; } function maybeWrapInNotSelector(isNegativeMode, chunk) { return isNegativeMode ? ":not(" + chunk.trim() + ")" : chunk; } function stringifyCSSSelector(selector) { let result = selector[0]; let i = 1; let mode = 2; let currentChunk = ""; let isNegativeMode = false; while (i < selector.length) { let valueOrMarker = selector[i]; if (typeof valueOrMarker === "string") { if (mode & 2) { const attrValue = selector[++i]; currentChunk += "[" + valueOrMarker + (attrValue.length > 0 ? '="' + attrValue + '"' : "") + "]"; } else if (mode & 8) { currentChunk += "." + valueOrMarker; } else if (mode & 4) { currentChunk += " " + valueOrMarker; } } else { if (currentChunk !== "" && !isPositive(valueOrMarker)) { result += maybeWrapInNotSelector(isNegativeMode, currentChunk); currentChunk = ""; } mode = valueOrMarker; isNegativeMode = isNegativeMode || !isPositive(mode); } i++; } if (currentChunk !== "") { result += maybeWrapInNotSelector(isNegativeMode, currentChunk); } return result; } function stringifyCSSSelectorList(selectorList) { return selectorList.map(stringifyCSSSelector).join(","); } function extractAttrsAndClassesFromSelector(selector) { const attrs = []; const classes = []; let i = 1; let mode = 2; while (i < selector.length) { let valueOrMarker = selector[i]; if (typeof valueOrMarker === "string") { if (mode === 2) { if (valueOrMarker !== "") { attrs.push(valueOrMarker, selector[++i]); } } else if (mode === 8) { classes.push(valueOrMarker); } } else { if (!isPositive(mode)) break; mode = valueOrMarker; } i++; } if (classes.length) { attrs.push(1, ...classes); } return attrs; } var NO_CHANGE = typeof ngDevMode === "undefined" || ngDevMode ? { __brand__: "NO_CHANGE" } : {}; function createTextNode(renderer, value) { return renderer.createText(value); } function updateTextNode(renderer, rNode, value) { renderer.setValue(rNode, value); } function createCommentNode(renderer, value) { return renderer.createComment(escapeCommentText(value)); } function createElementNode(renderer, name, namespace) { return renderer.createElement(name, namespace); } function nativeInsertBefore(renderer, parent, child, beforeNode, isMove) { renderer.insertBefore(parent, child, beforeNode, isMove); } function nativeAppendChild(renderer, parent, child) { ngDevMode && assertDefined(parent, "parent node must be defined"); renderer.appendChild(parent, child); } function nativeAppendOrInsertBefore(renderer, parent, child, beforeNode, isMove) { if (beforeNode !== null) { nativeInsertBefore(renderer, parent, child, beforeNode, isMove); } else { nativeAppendChild(renderer, parent, child); } } function nativeRemoveNode(renderer, rNode, isHostElement) { renderer.removeChild(null, rNode, isHostElement); } function clearElementContents(rElement) { rElement.textContent = ""; } function writeDirectStyle(renderer, element, newValue) { ngDevMode && assertString(newValue, "'newValue' should be a string"); renderer.setAttribute(element, "style", newValue); } function writeDirectClass(renderer, element, newValue) { ngDevMode && assertString(newValue, "'newValue' should be a string"); if (newValue === "") { renderer.removeAttribute(element, "class"); } else { renderer.setAttribute(element, "class", newValue); } } function setupStaticAttributes(renderer, element, tNode) { const { mergedAttrs, classes, styles } = tNode; if (mergedAttrs !== null) { setUpAttributes(renderer, element, mergedAttrs); } if (classes !== null) { writeDirectClass(renderer, element, classes); } if (styles !== null) { writeDirectStyle(renderer, element, styles); } } function createTView(type, declTNode, templateFn, decls, vars, directives, pipes, viewQuery, schemas, constsOrFactory, ssrId) { const bindingStartIndex = HEADER_OFFSET + decls; const initialViewLength = bindingStartIndex + vars; const blueprint = createViewBlueprint(bindingStartIndex, initialViewLength); const consts = typeof constsOrFactory === "function" ? constsOrFactory() : constsOrFactory; const tView = blueprint[TVIEW] = { type, blueprint, template: templateFn, queries: null, viewQuery, declTNode, data: blueprint.slice().fill(null, bindingStartIndex), bindingStartIndex, expandoStartIndex: initialViewLength, hostBindingOpCodes: null, firstCreatePass: true, firstUpdatePass: true, staticViewQueries: false, staticContentQueries: false, preOrderHooks: null, preOrderCheckHooks: null, contentHooks: null, contentCheckHooks: null, viewHooks: null, viewCheckHooks: null, destroyHooks: null, cleanup: null, contentQueries: null, components: null, directiveRegistry: typeof directives === "function" ? directives() : directives, pipeRegistry: typeof pipes === "function" ? pipes() : pipes, firstChild: null, schemas, consts, incompleteFirstPass: false, ssrId }; if (ngDevMode) { Object.seal(tView); } return tView; } function createViewBlueprint(bindingStartIndex, initialViewLength) { const blueprint = []; for (let i = 0; i < initialViewLength; i++) { blueprint.push(i < bindingStartIndex ? null : NO_CHANGE); } return blueprint; } function getOrCreateComponentTView(def) { const tView = def.tView; if (tView === null || tView.incompleteFirstPass) { const declTNode = null; return def.tView = createTView(1, declTNode, def.template, def.decls, def.vars, def.directiveDefs, def.pipeDefs, def.viewQuery, def.schemas, def.consts, def.id); } return tView; } function createLView(parentLView, tView, context, flags, host, tHostNode, environment, renderer, injector, embeddedViewInjector, hydrationInfo) { const lView = tView.blueprint.slice(); lView[HOST] = host; lView[FLAGS] = flags | 4 | 128 | 8 | 64 | 1024; if (embeddedViewInjector !== null || parentLView && parentLView[FLAGS] & 2048) { lView[FLAGS] |= 2048; } resetPreOrderHookFlags(lView); ngDevMode && tView.declTNode && parentLView && assertTNodeForLView(tView.declTNode, parentLView); lView[PARENT] = lView[DECLARATION_VIEW] = parentLView; lView[CONTEXT] = context; lView[ENVIRONMENT] = environment || parentLView && parentLView[ENVIRONMENT]; ngDevMode && assertDefined(lView[ENVIRONMENT], "LViewEnvironment is required"); lView[RENDERER] = renderer || parentLView && parentLView[RENDERER]; ngDevMode && assertDefined(lView[RENDERER], "Renderer is required"); lView[INJECTOR] = injector || parentLView && parentLView[INJECTOR] || null; lView[T_HOST] = tHostNode; lView[ID] = getUniqueLViewId(); lView[HYDRATION] = hydrationInfo; lView[EMBEDDED_VIEW_INJECTOR] = embeddedViewInjector; ngDevMode && assertEqual(tView.type == 2 ? parentLView !== null : true, true, "Embedded views must have parentLView"); lView[DECLARATION_COMPONENT_VIEW] = tView.type == 2 ? parentLView[DECLARATION_COMPONENT_VIEW] : lView; return lView; } function createComponentLView(lView, hostTNode, def) { const native = getNativeByTNode(hostTNode, lView); const tView = getOrCreateComponentTView(def); const rendererFactory = lView[ENVIRONMENT].rendererFactory; const componentView = addToEndOfViewTree(lView, createLView(lView, tView, null, getInitialLViewFlagsFromDef(def), native, hostTNode, null, rendererFactory.createRenderer(native, def), null, null, null)); return lView[hostTNode.index] = componentView; } function getInitialLViewFlagsFromDef(def) { let flags = 16; if (def.signals) { flags = 4096; } else if (def.onPush) { flags = 64; } return flags; } function allocExpando(tView, lView, numSlotsToAlloc, initialValue) { if (numSlotsToAlloc === 0) return -1; if (ngDevMode) { assertFirstCreatePass(tView); assertSame(tView, lView[TVIEW], "`LView` must be associated with `TView`!"); assertEqual(tView.data.length, lView.length, "Expecting LView to be same size as TView"); assertEqual(tView.data.length, tView.blueprint.length, "Expecting Blueprint to be same size as TView"); assertFirstUpdatePass(tView); } const allocIdx = lView.length; for (let i = 0; i < numSlotsToAlloc; i++) { lView.push(initialValue); tView.blueprint.push(initialValue); tView.data.push(null); } return allocIdx; } function addToEndOfViewTree(lView, lViewOrLContainer) { if (lView[CHILD_HEAD]) { lView[CHILD_TAIL][NEXT] = lViewOrLContainer; } else { lView[CHILD_HEAD] = lViewOrLContainer; } lView[CHILD_TAIL] = lViewOrLContainer; return lViewOrLContainer; } function ɵɵadvance(delta = 1) { ngDevMode && assertGreaterThan(delta, 0, "Can only advance forward"); selectIndexInternal(getTView(), getLView(), getSelectedIndex() + delta, !!ngDevMode && isInCheckNoChangesMode()); } function selectIndexInternal(tView, lView, index, checkNoChangesMode) { ngDevMode && assertIndexInDeclRange(lView[TVIEW], index); if (!checkNoChangesMode) { const hooksInitPhaseCompleted = (lView[FLAGS] & 3) === 3; if (hooksInitPhaseCompleted) { const preOrderCheckHooks = tView.preOrderCheckHooks; if (preOrderCheckHooks !== null) { executeCheckHooks(lView, preOrderCheckHooks, index); } } else { const preOrderHooks = tView.preOrderHooks; if (preOrderHooks !== null) { executeInitAndCheckHooks(lView, preOrderHooks, 0, index); } } } setSelectedIndex(index); } var InputFlags; (function(InputFlags2) { InputFlags2[InputFlags2["None"] = 0] = "None"; InputFlags2[InputFlags2["SignalBased"] = 1] = "SignalBased"; InputFlags2[InputFlags2["HasDecoratorInputTransform"] = 2] = "HasDecoratorInputTransform"; })(InputFlags || (InputFlags = {})); function writeToDirectiveInput(def, instance, publicName, value) { const prevConsumer = setActiveConsumer(null); try { if (ngDevMode) { if (!def.inputs.hasOwnProperty(publicName)) { throw new Error(`ASSERTION ERROR: Directive ${def.type.name} does not have an input with a public name of "${publicName}"`); } if (instance instanceof NodeInjectorFactory) { throw new Error(`ASSERTION ERROR: Cannot write input to factory for type ${def.type.name}. Directive has not been created yet.`); } } const [privateName, flags, transform] = def.inputs[publicName]; let inputSignalNode = null; if ((flags & InputFlags.SignalBased) !== 0) { const field = instance[privateName]; inputSignalNode = field[SIGNAL]; } if (inputSignalNode !== null && inputSignalNode.transformFn !== void 0) { value = inputSignalNode.transformFn(value); } else if (transform !== null) { value = transform.call(instance, value); } if (def.setInput !== null) { def.setInput(instance, inputSignalNode, value, publicName, privateName); } else { applyValueToInputField(instance, inputSignalNode, privateName, value); } } finally { setActiveConsumer(prevConsumer); } } var RendererStyleFlags2; (function(RendererStyleFlags22) { RendererStyleFlags22[RendererStyleFlags22["Important"] = 1] = "Important"; RendererStyleFlags22[RendererStyleFlags22["DashCase"] = 2] = "DashCase"; })(RendererStyleFlags2 || (RendererStyleFlags2 = {})); var _icuContainerIterate; function icuContainerIterate(tIcuContainerNode, lView) { return _icuContainerIterate(tIcuContainerNode, lView); } function ensureIcuContainerVisitorLoaded(loader) { if (_icuContainerIterate === void 0) { _icuContainerIterate = loader(); } } function applyToElementOrContainer(action, renderer, parent, lNodeToHandle, beforeNode) { if (lNodeToHandle != null) { let lContainer; let isComponent2 = false; if (isLContainer(lNodeToHandle)) { lContainer = lNodeToHandle; } else if (isLView(lNodeToHandle)) { isComponent2 = true; ngDevMode && assertDefined(lNodeToHandle[HOST], "HOST must be defined for a component LView"); lNodeToHandle = lNodeToHandle[HOST]; } const rNode = unwrapRNode(lNodeToHandle); if (action === 0 && parent !== null) { if (beforeNode == null) { nativeAppendChild(renderer, parent, rNode); } else { nativeInsertBefore(renderer, parent, rNode, beforeNode || null, true); } } else if (action === 1 && parent !== null) { nativeInsertBefore(renderer, parent, rNode, beforeNode || null, true); } else if (action === 2) { nativeRemoveNode(renderer, rNode, isComponent2); } else if (action === 3) { renderer.destroyNode(rNode); } if (lContainer != null) { applyContainer(renderer, action, lContainer, parent, beforeNode); } } } function removeViewFromDOM(tView, lView) { detachViewFromDOM(tView, lView); lView[HOST] = null; lView[T_HOST] = null; } function addViewToDOM(tView, parentTNode, renderer, lView, parentNativeNode, beforeNode) { lView[HOST] = parentNativeNode; lView[T_HOST] = parentTNode; applyView(tView, lView, renderer, 1, parentNativeNode, beforeNode); } function detachViewFromDOM(tView, lView) { lView[ENVIRONMENT].changeDetectionScheduler?.notify( 9 /* NotificationSource.ViewDetachedFromDOM */ ); applyView(tView, lView, lView[RENDERER], 2, null, null); } function destroyViewTree(rootView) { let lViewOrLContainer = rootView[CHILD_HEAD]; if (!lViewOrLContainer) { return cleanUpView(rootView[TVIEW], rootView); } while (lViewOrLContainer) { let next = null; if (isLView(lViewOrLContainer)) { next = lViewOrLContainer[CHILD_HEAD]; } else { ngDevMode && assertLContainer(lViewOrLContainer); const firstView = lViewOrLContainer[CONTAINER_HEADER_OFFSET]; if (firstView) next = firstView; } if (!next) { while (lViewOrLContainer && !lViewOrLContainer[NEXT] && lViewOrLContainer !== rootView) { if (isLView(lViewOrLContainer)) { cleanUpView(lViewOrLContainer[TVIEW], lViewOrLContainer); } lViewOrLContainer = lViewOrLContainer[PARENT]; } if (lViewOrLContainer === null) lViewOrLContainer = rootView; if (isLView(lViewOrLContainer)) { cleanUpView(lViewOrLContainer[TVIEW], lViewOrLContainer); } next = lViewOrLContainer && lViewOrLContainer[NEXT]; } lViewOrLContainer = next; } } function detachMovedView(declarationContainer, lView) { ngDevMode && assertLContainer(declarationContainer); ngDevMode && assertDefined(declarationContainer[MOVED_VIEWS], "A projected view should belong to a non-empty projected views collection"); const movedViews = declarationContainer[MOVED_VIEWS]; const declarationViewIndex = movedViews.indexOf(lView); movedViews.splice(declarationViewIndex, 1); } function destroyLView(tView, lView) { if (isDestroyed(lView)) { return; } const renderer = lView[RENDERER]; if (renderer.destroyNode) { applyView(tView, lView, renderer, 3, null, null); } destroyViewTree(lView); } function cleanUpView(tView, lView) { if (isDestroyed(lView)) { return; } const prevConsumer = setActiveConsumer(null); try { lView[FLAGS] &= ~128; lView[FLAGS] |= 256; lView[REACTIVE_TEMPLATE_CONSUMER] && consumerDestroy(lView[REACTIVE_TEMPLATE_CONSUMER]); executeOnDestroys(tView, lView); processCleanups(tView, lView); if (lView[TVIEW].type === 1) { lView[RENDERER].destroy(); } const declarationContainer = lView[DECLARATION_LCONTAINER]; if (declarationContainer !== null && isLContainer(lView[PARENT])) { if (declarationContainer !== lView[PARENT]) { detachMovedView(declarationContainer, lView); } const lQueries = lView[QUERIES]; if (lQueries !== null) { lQueries.detachView(tView); } } unregisterLView(lView); } finally { setActiveConsumer(prevConsumer); } } function processCleanups(tView, lView) { ngDevMode && assertNotReactive(processCleanups.name); const tCleanup = tView.cleanup; const lCleanup = lView[CLEANUP]; if (tCleanup !== null) { for (let i = 0; i < tCleanup.length - 1; i += 2) { if (typeof tCleanup[i] === "string") { const targetIdx = tCleanup[i + 3]; ngDevMode && assertNumber(targetIdx, "cleanup target must be a number"); if (targetIdx >= 0) { lCleanup[targetIdx](); } else { lCleanup[-targetIdx].unsubscribe(); } i += 2; } else { const context = lCleanup[tCleanup[i + 1]]; tCleanup[i].call(context); } } } if (lCleanup !== null) { lView[CLEANUP] = null; } const destroyHooks = lView[ON_DESTROY_HOOKS]; if (destroyHooks !== null) { lView[ON_DESTROY_HOOKS] = null; for (let i = 0; i < destroyHooks.length; i++) { const destroyHooksFn = destroyHooks[i]; ngDevMode && assertFunction(destroyHooksFn, "Expecting destroy hook to be a function."); destroyHooksFn(); } } const effects = lView[EFFECTS]; if (effects !== null) { lView[EFFECTS] = null; for (const effect2 of effects) { effect2.destroy(); } } } function executeOnDestroys(tView, lView) { ngDevMode && assertNotReactive(executeOnDestroys.name); let destroyHooks; if (tView != null && (destroyHooks = tView.destroyHooks) != null) { for (let i = 0; i < destroyHooks.length; i += 2) { const context = lView[destroyHooks[i]]; if (!(context instanceof NodeInjectorFactory)) { const toCall = destroyHooks[i + 1]; if (Array.isArray(toCall)) { for (let j = 0; j < toCall.length; j += 2) { const callContext = context[toCall[j]]; const hook = toCall[j + 1]; profiler(4, callContext, hook); try { hook.call(callContext); } finally { profiler(5, callContext, hook); } } } else { profiler(4, context, toCall); try { toCall.call(context); } finally { profiler(5, context, toCall); } } } } } } function getParentRElement(tView, tNode, lView) { return getClosestRElement(tView, tNode.parent, lView); } function getClosestRElement(tView, tNode, lView) { let parentTNode = tNode; while (parentTNode !== null && parentTNode.type & (8 | 32 | 128)) { tNode = parentTNode; parentTNode = tNode.parent; } if (parentTNode === null) { return lView[HOST]; } else { ngDevMode && assertTNodeType( parentTNode, 3 | 4 /* TNodeType.Container */ ); if (isComponentHost(parentTNode)) { ngDevMode && assertTNodeForLView(parentTNode, lView); const { encapsulation } = tView.data[parentTNode.directiveStart + parentTNode.componentOffset]; if (encapsulation === ViewEncapsulation.None || encapsulation === ViewEncapsulation.Emulated) { return null; } } return getNativeByTNode(parentTNode, lView); } } function getInsertInFrontOfRNode(parentTNode, currentTNode, lView) { return _getInsertInFrontOfRNodeWithI18n(parentTNode, currentTNode, lView); } function getInsertInFrontOfRNodeWithNoI18n(parentTNode, currentTNode, lView) { if (parentTNode.type & (8 | 32)) { return getNativeByTNode(parentTNode, lView); } return null; } var _getInsertInFrontOfRNodeWithI18n = getInsertInFrontOfRNodeWithNoI18n; var _processI18nInsertBefore; function setI18nHandling(getInsertInFrontOfRNodeWithI18n2, processI18nInsertBefore2) { _getInsertInFrontOfRNodeWithI18n = getInsertInFrontOfRNodeWithI18n2; _processI18nInsertBefore = processI18nInsertBefore2; } function appendChild(tView, lView, childRNode, childTNode) { const parentRNode = getParentRElement(tView, childTNode, lView); const renderer = lView[RENDERER]; const parentTNode = childTNode.parent || lView[T_HOST]; const anchorNode = getInsertInFrontOfRNode(parentTNode, childTNode, lView); if (parentRNode != null) { if (Array.isArray(childRNode)) { for (let i = 0; i < childRNode.length; i++) { nativeAppendOrInsertBefore(renderer, parentRNode, childRNode[i], anchorNode, false); } } else { nativeAppendOrInsertBefore(renderer, parentRNode, childRNode, anchorNode, false); } } _processI18nInsertBefore !== void 0 && _processI18nInsertBefore(renderer, childTNode, lView, childRNode, parentRNode); } function getFirstNativeNode(lView, tNode) { if (tNode !== null) { ngDevMode && assertTNodeType( tNode, 3 | 12 | 32 | 16 | 128 /* TNodeType.LetDeclaration */ ); const tNodeType = tNode.type; if (tNodeType & 3) { return getNativeByTNode(tNode, lView); } else if (tNodeType & 4) { return getBeforeNodeForView(-1, lView[tNode.index]); } else if (tNodeType & 8) { const elIcuContainerChild = tNode.child; if (elIcuContainerChild !== null) { return getFirstNativeNode(lView, elIcuContainerChild); } else { const rNodeOrLContainer = lView[tNode.index]; if (isLContainer(rNodeOrLContainer)) { return getBeforeNodeForView(-1, rNodeOrLContainer); } else { return unwrapRNode(rNodeOrLContainer); } } } else if (tNodeType & 128) { return getFirstNativeNode(lView, tNode.next); } else if (tNodeType & 32) { let nextRNode = icuContainerIterate(tNode, lView); let rNode = nextRNode(); return rNode || unwrapRNode(lView[tNode.index]); } else { const projectionNodes = getProjectionNodes(lView, tNode); if (projectionNodes !== null) { if (Array.isArray(projectionNodes)) { return projectionNodes[0]; } const parentView = getLViewParent(lView[DECLARATION_COMPONENT_VIEW]); ngDevMode && assertParentView(parentView); return getFirstNativeNode(parentView, projectionNodes); } else { return getFirstNativeNode(lView, tNode.next); } } } return null; } function getProjectionNodes(lView, tNode) { if (tNode !== null) { const componentView = lView[DECLARATION_COMPONENT_VIEW]; const componentHost = componentView[T_HOST]; const slotIdx = tNode.projection; ngDevMode && assertProjectionSlots(lView); return componentHost.projection[slotIdx]; } return null; } function getBeforeNodeForView(viewIndexInContainer, lContainer) { const nextViewIndex = CONTAINER_HEADER_OFFSET + viewIndexInContainer + 1; if (nextViewIndex < lContainer.length) { const lView = lContainer[nextViewIndex]; const firstTNodeOfView = lView[TVIEW].firstChild; if (firstTNodeOfView !== null) { return getFirstNativeNode(lView, firstTNodeOfView); } } return lContainer[NATIVE]; } function applyNodes(renderer, action, tNode, lView, parentRElement, beforeNode, isProjection) { while (tNode != null) { ngDevMode && assertTNodeForLView(tNode, lView); if (tNode.type === 128) { tNode = tNode.next; continue; } ngDevMode && assertTNodeType( tNode, 3 | 12 | 16 | 32 /* TNodeType.Icu */ ); const rawSlotValue = lView[tNode.index]; const tNodeType = tNode.type; if (isProjection) { if (action === 0) { rawSlotValue && attachPatchData(unwrapRNode(rawSlotValue), lView); tNode.flags |= 2; } } if (!isDetachedByI18n(tNode)) { if (tNodeType & 8) { applyNodes(renderer, action, tNode.child, lView, parentRElement, beforeNode, false); applyToElementOrContainer(action, renderer, parentRElement, rawSlotValue, beforeNode); } else if (tNodeType & 32) { const nextRNode = icuContainerIterate(tNode, lView); let rNode; while (rNode = nextRNode()) { applyToElementOrContainer(action, renderer, parentRElement, rNode, beforeNode); } applyToElementOrContainer(action, renderer, parentRElement, rawSlotValue, beforeNode); } else if (tNodeType & 16) { applyProjectionRecursive(renderer, action, lView, tNode, parentRElement, beforeNode); } else { ngDevMode && assertTNodeType( tNode, 3 | 4 /* TNodeType.Container */ ); applyToElementOrContainer(action, renderer, parentRElement, rawSlotValue, beforeNode); } } tNode = isProjection ? tNode.projectionNext : tNode.next; } } function applyView(tView, lView, renderer, action, parentRElement, beforeNode) { applyNodes(renderer, action, tView.firstChild, lView, parentRElement, beforeNode, false); } function applyProjection(tView, lView, tProjectionNode) { const renderer = lView[RENDERER]; const parentRNode = getParentRElement(tView, tProjectionNode, lView); const parentTNode = tProjectionNode.parent || lView[T_HOST]; let beforeNode = getInsertInFrontOfRNode(parentTNode, tProjectionNode, lView); applyProjectionRecursive(renderer, 0, lView, tProjectionNode, parentRNode, beforeNode); } function applyProjectionRecursive(renderer, action, lView, tProjectionNode, parentRElement, beforeNode) { const componentLView = lView[DECLARATION_COMPONENT_VIEW]; const componentNode = componentLView[T_HOST]; ngDevMode && assertEqual(typeof tProjectionNode.projection, "number", "expecting projection index"); const nodeToProjectOrRNodes = componentNode.projection[tProjectionNode.projection]; if (Array.isArray(nodeToProjectOrRNodes)) { for (let i = 0; i < nodeToProjectOrRNodes.length; i++) { const rNode = nodeToProjectOrRNodes[i]; applyToElementOrContainer(action, renderer, parentRElement, rNode, beforeNode); } } else { let nodeToProject = nodeToProjectOrRNodes; const projectedComponentLView = componentLView[PARENT]; if (hasInSkipHydrationBlockFlag(tProjectionNode)) { nodeToProject.flags |= 128; } applyNodes(renderer, action, nodeToProject, projectedComponentLView, parentRElement, beforeNode, true); } } function applyContainer(renderer, action, lContainer, parentRElement, beforeNode) { ngDevMode && assertLContainer(lContainer); const anchor = lContainer[NATIVE]; const native = unwrapRNode(lContainer); if (anchor !== native) { applyToElementOrContainer(action, renderer, parentRElement, anchor, beforeNode); } for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) { const lView = lContainer[i]; applyView(lView[TVIEW], lView, renderer, action, parentRElement, anchor); } } function applyStyling(renderer, isClassBased, rNode, prop, value) { if (isClassBased) { if (!value) { renderer.removeClass(rNode, prop); } else { renderer.addClass(rNode, prop); } } else { let flags = prop.indexOf("-") === -1 ? void 0 : RendererStyleFlags2.DashCase; if (value == null) { renderer.removeStyle(rNode, prop, flags); } else { const isImportant = typeof value === "string" ? value.endsWith("!important") : false; if (isImportant) { value = value.slice(0, -10); flags |= RendererStyleFlags2.Important; } renderer.setStyle(rNode, prop, value, flags); } } } function executeTemplate(tView, lView, templateFn, rf, context) { const prevSelectedIndex = getSelectedIndex(); const isUpdatePhase = rf & 2; try { setSelectedIndex(-1); if (isUpdatePhase && lView.length > HEADER_OFFSET) { selectIndexInternal(tView, lView, HEADER_OFFSET, !!ngDevMode && isInCheckNoChangesMode()); } const preHookType = isUpdatePhase ? 2 : 0; profiler(preHookType, context, templateFn); templateFn(rf, context); } finally { setSelectedIndex(prevSelectedIndex); const postHookType = isUpdatePhase ? 3 : 1; profiler(postHookType, context, templateFn); } } function createDirectivesInstances(tView, lView, tNode) { instantiateAllDirectives(tView, lView, tNode); if ((tNode.flags & 64) === 64) { invokeDirectivesHostBindings(tView, lView, tNode); } } function saveResolvedLocalsInData(viewData, tNode, localRefExtractor = getNativeByTNode) { const localNames = tNode.localNames; if (localNames !== null) { let localIndex = tNode.index + 1; for (let i = 0; i < localNames.length; i += 2) { const index = localNames[i + 1]; const value = index === -1 ? localRefExtractor(tNode, viewData) : viewData[index]; viewData[localIndex++] = value; } } } function locateHostElement(renderer, elementOrSelector, encapsulation, injector) { const preserveHostContent = injector.get(PRESERVE_HOST_CONTENT, PRESERVE_HOST_CONTENT_DEFAULT); const preserveContent = preserveHostContent || encapsulation === ViewEncapsulation.ShadowDom; const rootElement = renderer.selectRootElement(elementOrSelector, preserveContent); applyRootElementTransform(rootElement); return rootElement; } function applyRootElementTransform(rootElement) { _applyRootElementTransformImpl(rootElement); } var _applyRootElementTransformImpl = () => null; function applyRootElementTransformImpl(rootElement) { if (hasSkipHydrationAttrOnRElement(rootElement)) { clearElementContents(rootElement); } else { processTextNodeMarkersBeforeHydration(rootElement); } } function enableApplyRootElementTransformImpl() { _applyRootElementTransformImpl = applyRootElementTransformImpl; } function mapPropName(name) { if (name === "class") return "className"; if (name === "for") return "htmlFor"; if (name === "formaction") return "formAction"; if (name === "innerHtml") return "innerHTML"; if (name === "readonly") return "readOnly"; if (name === "tabindex") return "tabIndex"; return name; } function setPropertyAndInputs(tNode, lView, propName, value, renderer, sanitizer) { ngDevMode && assertNotSame(value, NO_CHANGE, "Incoming value should never be NO_CHANGE."); const tView = lView[TVIEW]; const hasSetInput = setAllInputsForProperty(tNode, tView, lView, propName, value); if (hasSetInput) { isComponentHost(tNode) && markDirtyIfOnPush(lView, tNode.index); ngDevMode && setNgReflectProperties(lView, tView, tNode, propName, value); return; } if (tNode.type & 3) { propName = mapPropName(propName); } setDomProperty(tNode, lView, propName, value, renderer, sanitizer); } function setDomProperty(tNode, lView, propName, value, renderer, sanitizer) { if (tNode.type & 3) { const element = getNativeByTNode(tNode, lView); if (ngDevMode) { validateAgainstEventProperties(propName); if (!isPropertyValid(element, propName, tNode.value, lView[TVIEW].schemas)) { handleUnknownPropertyError(propName, tNode.value, tNode.type, lView); } } value = sanitizer != null ? sanitizer(value, tNode.value || "", propName) : value; renderer.setProperty(element, propName, value); } else if (tNode.type & 12) { if (ngDevMode && !matchingSchemas(lView[TVIEW].schemas, tNode.value)) { handleUnknownPropertyError(propName, tNode.value, tNode.type, lView); } } } function markDirtyIfOnPush(lView, viewIndex) { ngDevMode && assertLView(lView); const childComponentLView = getComponentLViewByIndex(viewIndex, lView); if (!(childComponentLView[FLAGS] & 16)) { childComponentLView[FLAGS] |= 64; } } function setNgReflectProperty(lView, tNode, attrName, value) { const environment = lView[ENVIRONMENT]; if (!environment.ngReflect) { return; } const element = getNativeByTNode(tNode, lView); const renderer = lView[RENDERER]; attrName = normalizeDebugBindingName(attrName); const debugValue = normalizeDebugBindingValue(value); if (tNode.type & 3) { if (value == null) { renderer.removeAttribute(element, attrName); } else { renderer.setAttribute(element, attrName, debugValue); } } else { const textContent = escapeCommentText(`bindings=${JSON.stringify({ [attrName]: debugValue }, null, 2)}`); renderer.setValue(element, textContent); } } function setNgReflectProperties(lView, tView, tNode, publicName, value) { const environment = lView[ENVIRONMENT]; if (!environment.ngReflect || !(tNode.type & (3 | 4))) { return; } const inputConfig = tNode.inputs?.[publicName]; const hostInputConfig = tNode.hostDirectiveInputs?.[publicName]; if (hostInputConfig) { for (let i = 0; i < hostInputConfig.length; i += 2) { const index = hostInputConfig[i]; const publicName2 = hostInputConfig[i + 1]; const def = tView.data[index]; setNgReflectProperty(lView, tNode, def.inputs[publicName2][0], value); } } if (inputConfig) { for (const index of inputConfig) { const def = tView.data[index]; setNgReflectProperty(lView, tNode, def.inputs[publicName][0], value); } } } function instantiateAllDirectives(tView, lView, tNode) { const start = tNode.directiveStart; const end = tNode.directiveEnd; if (isComponentHost(tNode)) { ngDevMode && assertTNodeType( tNode, 3 /* TNodeType.AnyRNode */ ); createComponentLView(lView, tNode, tView.data[start + tNode.componentOffset]); } if (!tView.firstCreatePass) { getOrCreateNodeInjectorForNode(tNode, lView); } const initialInputs = tNode.initialInputs; for (let i = start; i < end; i++) { const def = tView.data[i]; const directive = getNodeInjectable(lView, tView, i, tNode); attachPatchData(directive, lView); if (initialInputs !== null) { setInputsFromAttrs(lView, i - start, directive, def, tNode, initialInputs); } if (isComponentDef(def)) { const componentView = getComponentLViewByIndex(tNode.index, lView); componentView[CONTEXT] = getNodeInjectable(lView, tView, i, tNode); } } } function invokeDirectivesHostBindings(tView, lView, tNode) { const start = tNode.directiveStart; const end = tNode.directiveEnd; const elementIndex = tNode.index; const currentDirectiveIndex = getCurrentDirectiveIndex(); try { setSelectedIndex(elementIndex); for (let dirIndex = start; dirIndex < end; dirIndex++) { const def = tView.data[dirIndex]; const directive = lView[dirIndex]; setCurrentDirectiveIndex(dirIndex); if (def.hostBindings !== null || def.hostVars !== 0 || def.hostAttrs !== null) { invokeHostBindingsInCreationMode(def, directive); } } } finally { setSelectedIndex(-1); setCurrentDirectiveIndex(currentDirectiveIndex); } } function invokeHostBindingsInCreationMode(def, directive) { if (def.hostBindings !== null) { def.hostBindings(1, directive); } } function findDirectiveDefMatches(tView, tNode) { ngDevMode && assertFirstCreatePass(tView); ngDevMode && assertTNodeType( tNode, 3 | 12 /* TNodeType.AnyContainer */ ); const registry = tView.directiveRegistry; let matches = null; if (registry) { for (let i = 0; i < registry.length; i++) { const def = registry[i]; if (isNodeMatchingSelectorList( tNode, def.selectors, /* isProjectionMode */ false )) { matches ??= []; if (isComponentDef(def)) { if (ngDevMode) { assertTNodeType(tNode, 2, `"${tNode.value}" tags cannot be used as component hosts. Please use a different tag to activate the ${stringify(def.type)} component.`); if (matches.length && isComponentDef(matches[0])) { throwMultipleComponentError(tNode, matches.find(isComponentDef).type, def.type); } } matches.unshift(def); } else { matches.push(def); } } } } return matches; } function elementAttributeInternal(tNode, lView, name, value, sanitizer, namespace) { if (ngDevMode) { assertNotSame(value, NO_CHANGE, "Incoming value should never be NO_CHANGE."); validateAgainstEventAttributes(name); assertTNodeType(tNode, 2, `Attempted to set attribute \`${name}\` on a container node. Host bindings are not valid on ng-container or ng-template.`); } const element = getNativeByTNode(tNode, lView); setElementAttribute(lView[RENDERER], element, namespace, tNode.value, name, value, sanitizer); } function setElementAttribute(renderer, element, namespace, tagName, name, value, sanitizer) { if (value == null) { renderer.removeAttribute(element, name, namespace); } else { const strValue = sanitizer == null ? renderStringify(value) : sanitizer(value, tagName || "", name); renderer.setAttribute(element, name, strValue, namespace); } } function setInputsFromAttrs(lView, directiveIndex, instance, def, tNode, initialInputData) { const initialInputs = initialInputData[directiveIndex]; if (initialInputs !== null) { for (let i = 0; i < initialInputs.length; i += 2) { const lookupName = initialInputs[i]; const value = initialInputs[i + 1]; writeToDirectiveInput(def, instance, lookupName, value); if (ngDevMode) { setNgReflectProperty(lView, tNode, def.inputs[lookupName][0], value); } } } } function elementLikeStartShared(tNode, lView, index, name, locateOrCreateNativeNode) { const adjustedIndex = HEADER_OFFSET + index; const tView = lView[TVIEW]; const native = locateOrCreateNativeNode(tView, lView, tNode, name, index); lView[adjustedIndex] = native; setCurrentTNode(tNode, true); const isElement = tNode.type === 2; if (isElement) { setupStaticAttributes(lView[RENDERER], native, tNode); if (getElementDepthCount() === 0 || isDirectiveHost(tNode)) { attachPatchData(native, lView); } increaseElementDepthCount(); } else { attachPatchData(native, lView); } if (wasLastNodeCreated() && (!isElement || !isDetachedByI18n(tNode))) { appendChild(tView, lView, native, tNode); } return tNode; } function elementLikeEndShared(tNode) { let currentTNode = tNode; if (isCurrentTNodeParent()) { setCurrentTNodeAsNotParent(); } else { ngDevMode && assertHasParent(getCurrentTNode()); currentTNode = currentTNode.parent; setCurrentTNode(currentTNode, false); } return currentTNode; } function storePropertyBindingMetadata(tData, tNode, propertyName, bindingIndex, ...interpolationParts) { if (tData[bindingIndex] === null) { if (!tNode.inputs?.[propertyName] && !tNode.hostDirectiveInputs?.[propertyName]) { const propBindingIdxs = tNode.propertyBindings || (tNode.propertyBindings = []); propBindingIdxs.push(bindingIndex); let bindingMetadata = propertyName; if (interpolationParts.length > 0) { bindingMetadata += INTERPOLATION_DELIMITER + interpolationParts.join(INTERPOLATION_DELIMITER); } tData[bindingIndex] = bindingMetadata; } } } function loadComponentRenderer(currentDef, tNode, lView) { if (currentDef === null || isComponentDef(currentDef)) { lView = unwrapLView(lView[tNode.index]); } return lView[RENDERER]; } function handleUncaughtError(lView, error) { const injector = lView[INJECTOR]; if (!injector) { return; } let errorHandler; try { errorHandler = injector.get(INTERNAL_APPLICATION_ERROR_HANDLER, null); } catch { errorHandler = null; } errorHandler?.(error); } function setAllInputsForProperty(tNode, tView, lView, publicName, value) { const inputs = tNode.inputs?.[publicName]; const hostDirectiveInputs = tNode.hostDirectiveInputs?.[publicName]; let hasMatch = false; if (hostDirectiveInputs) { for (let i = 0; i < hostDirectiveInputs.length; i += 2) { const index = hostDirectiveInputs[i]; ngDevMode && assertIndexInRange(lView, index); const publicName2 = hostDirectiveInputs[i + 1]; const def = tView.data[index]; writeToDirectiveInput(def, lView[index], publicName2, value); hasMatch = true; } } if (inputs) { for (const index of inputs) { ngDevMode && assertIndexInRange(lView, index); const instance = lView[index]; const def = tView.data[index]; writeToDirectiveInput(def, instance, publicName, value); hasMatch = true; } } return hasMatch; } function setDirectiveInput(tNode, tView, lView, target, publicName, value) { let hostIndex = null; let hostDirectivesStart = null; let hostDirectivesEnd = null; let hasSet = false; if (ngDevMode && !tNode.directiveToIndex?.has(target.type)) { throw new Error(`Node does not have a directive with type ${target.type.name}`); } const data = tNode.directiveToIndex.get(target.type); if (typeof data === "number") { hostIndex = data; } else { [hostIndex, hostDirectivesStart, hostDirectivesEnd] = data; } if (hostDirectivesStart !== null && hostDirectivesEnd !== null && tNode.hostDirectiveInputs?.hasOwnProperty(publicName)) { const hostDirectiveInputs = tNode.hostDirectiveInputs[publicName]; for (let i = 0; i < hostDirectiveInputs.length; i += 2) { const index = hostDirectiveInputs[i]; if (index >= hostDirectivesStart && index <= hostDirectivesEnd) { ngDevMode && assertIndexInRange(lView, index); const def = tView.data[index]; const hostDirectivePublicName = hostDirectiveInputs[i + 1]; writeToDirectiveInput(def, lView[index], hostDirectivePublicName, value); hasSet = true; } else if (index > hostDirectivesEnd) { break; } } } if (hostIndex !== null && target.inputs.hasOwnProperty(publicName)) { ngDevMode && assertIndexInRange(lView, hostIndex); writeToDirectiveInput(target, lView[hostIndex], publicName, value); hasSet = true; } return hasSet; } function renderComponent(hostLView, componentHostIdx) { ngDevMode && assertEqual(isCreationMode(hostLView), true, "Should be run in creation mode"); const componentView = getComponentLViewByIndex(componentHostIdx, hostLView); const componentTView = componentView[TVIEW]; syncViewWithBlueprint(componentTView, componentView); const hostRNode = componentView[HOST]; if (hostRNode !== null && componentView[HYDRATION] === null) { componentView[HYDRATION] = retrieveHydrationInfo(hostRNode, componentView[INJECTOR]); } profiler( 18 /* ProfilerEvent.ComponentStart */ ); renderView(componentTView, componentView, componentView[CONTEXT]); profiler(19, componentView[CONTEXT]); } function syncViewWithBlueprint(tView, lView) { for (let i = lView.length; i < tView.blueprint.length; i++) { lView.push(tView.blueprint[i]); } } function renderView(tView, lView, context) { ngDevMode && assertEqual(isCreationMode(lView), true, "Should be run in creation mode"); ngDevMode && assertNotReactive(renderView.name); enterView(lView); try { const viewQuery = tView.viewQuery; if (viewQuery !== null) { executeViewQueryFn(1, viewQuery, context); } const templateFn = tView.template; if (templateFn !== null) { executeTemplate(tView, lView, templateFn, 1, context); } if (tView.firstCreatePass) { tView.firstCreatePass = false; } lView[QUERIES]?.finishViewCreation(tView); if (tView.staticContentQueries) { refreshContentQueries(tView, lView); } if (tView.staticViewQueries) { executeViewQueryFn(2, tView.viewQuery, context); } const components = tView.components; if (components !== null) { renderChildComponents(lView, components); } } catch (error) { if (tView.firstCreatePass) { tView.incompleteFirstPass = true; tView.firstCreatePass = false; } throw error; } finally { lView[FLAGS] &= ~4; leaveView(); } } function renderChildComponents(hostLView, components) { for (let i = 0; i < components.length; i++) { renderComponent(hostLView, components[i]); } } function createAndRenderEmbeddedLView(declarationLView, templateTNode, context, options) { const prevConsumer = setActiveConsumer(null); try { const embeddedTView = templateTNode.tView; ngDevMode && assertDefined(embeddedTView, "TView must be defined for a template node."); ngDevMode && assertTNodeForLView(templateTNode, declarationLView); const isSignalView = declarationLView[FLAGS] & 4096; const viewFlags = isSignalView ? 4096 : 16; const embeddedLView = createLView(declarationLView, embeddedTView, context, viewFlags, null, templateTNode, null, null, options?.injector ?? null, options?.embeddedViewInjector ?? null, options?.dehydratedView ?? null); const declarationLContainer = declarationLView[templateTNode.index]; ngDevMode && assertLContainer(declarationLContainer); embeddedLView[DECLARATION_LCONTAINER] = declarationLContainer; const declarationViewLQueries = declarationLView[QUERIES]; if (declarationViewLQueries !== null) { embeddedLView[QUERIES] = declarationViewLQueries.createEmbeddedView(embeddedTView); } renderView(embeddedTView, embeddedLView, context); return embeddedLView; } finally { setActiveConsumer(prevConsumer); } } function shouldAddViewToDom(tNode, dehydratedView) { return !dehydratedView || dehydratedView.firstChild === null || hasInSkipHydrationBlockFlag(tNode); } var USE_EXHAUSTIVE_CHECK_NO_CHANGES_DEFAULT = false; var UseExhaustiveCheckNoChanges = new InjectionToken(ngDevMode ? "exhaustive checkNoChanges" : ""); function collectNativeNodes(tView, lView, tNode, result, isProjection = false) { while (tNode !== null) { if (tNode.type === 128) { tNode = isProjection ? tNode.projectionNext : tNode.next; continue; } ngDevMode && assertTNodeType( tNode, 3 | 12 | 16 | 32 /* TNodeType.Icu */ ); const lNode = lView[tNode.index]; if (lNode !== null) { result.push(unwrapRNode(lNode)); } if (isLContainer(lNode)) { collectNativeNodesInLContainer(lNode, result); } const tNodeType = tNode.type; if (tNodeType & 8) { collectNativeNodes(tView, lView, tNode.child, result); } else if (tNodeType & 32) { const nextRNode = icuContainerIterate(tNode, lView); let rNode; while (rNode = nextRNode()) { result.push(rNode); } } else if (tNodeType & 16) { const nodesInSlot = getProjectionNodes(lView, tNode); if (Array.isArray(nodesInSlot)) { result.push(...nodesInSlot); } else { const parentView = getLViewParent(lView[DECLARATION_COMPONENT_VIEW]); ngDevMode && assertParentView(parentView); collectNativeNodes(parentView[TVIEW], parentView, nodesInSlot, result, true); } } tNode = isProjection ? tNode.projectionNext : tNode.next; } return result; } function collectNativeNodesInLContainer(lContainer, result) { for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) { const lViewInAContainer = lContainer[i]; const lViewFirstChildTNode = lViewInAContainer[TVIEW].firstChild; if (lViewFirstChildTNode !== null) { collectNativeNodes(lViewInAContainer[TVIEW], lViewInAContainer, lViewFirstChildTNode, result); } } if (lContainer[NATIVE] !== lContainer[HOST]) { result.push(lContainer[NATIVE]); } } function addAfterRenderSequencesForView(lView) { if (lView[AFTER_RENDER_SEQUENCES_TO_ADD] !== null) { for (const sequence of lView[AFTER_RENDER_SEQUENCES_TO_ADD]) { sequence.impl.addSequence(sequence); } lView[AFTER_RENDER_SEQUENCES_TO_ADD].length = 0; } } var freeConsumers = []; function getOrBorrowReactiveLViewConsumer(lView) { return lView[REACTIVE_TEMPLATE_CONSUMER] ?? borrowReactiveLViewConsumer(lView); } function borrowReactiveLViewConsumer(lView) { const consumer = freeConsumers.pop() ?? Object.create(REACTIVE_LVIEW_CONSUMER_NODE); consumer.lView = lView; return consumer; } function maybeReturnReactiveLViewConsumer(consumer) { if (consumer.lView[REACTIVE_TEMPLATE_CONSUMER] === consumer) { return; } consumer.lView = null; freeConsumers.push(consumer); } var REACTIVE_LVIEW_CONSUMER_NODE = __spreadProps(__spreadValues({}, REACTIVE_NODE), { consumerIsAlwaysLive: true, kind: "template", consumerMarkedDirty: (node) => { markAncestorsForTraversal(node.lView); }, consumerOnSignalRead() { this.lView[REACTIVE_TEMPLATE_CONSUMER] = this; } }); function getOrCreateTemporaryConsumer(lView) { const consumer = lView[REACTIVE_TEMPLATE_CONSUMER] ?? Object.create(TEMPORARY_CONSUMER_NODE); consumer.lView = lView; return consumer; } var TEMPORARY_CONSUMER_NODE = __spreadProps(__spreadValues({}, REACTIVE_NODE), { consumerIsAlwaysLive: true, kind: "template", consumerMarkedDirty: (node) => { let parent = getLViewParent(node.lView); while (parent && !viewShouldHaveReactiveConsumer(parent[TVIEW])) { parent = getLViewParent(parent); } if (!parent) { return; } markViewForRefresh(parent); }, consumerOnSignalRead() { this.lView[REACTIVE_TEMPLATE_CONSUMER] = this; } }); function viewShouldHaveReactiveConsumer(tView) { return tView.type !== 2; } function isReactiveLViewConsumer(node) { return node.kind === "template"; } function runEffectsInView(view) { if (view[EFFECTS] === null) { return; } let tryFlushEffects = true; while (tryFlushEffects) { let foundDirtyEffect = false; for (const effect2 of view[EFFECTS]) { if (!effect2.dirty) { continue; } foundDirtyEffect = true; if (effect2.zone === null || Zone.current === effect2.zone) { effect2.run(); } else { effect2.zone.run(() => effect2.run()); } } tryFlushEffects = foundDirtyEffect && !!(view[FLAGS] & 8192); } } var MAXIMUM_REFRESH_RERUNS$1 = 100; function detectChangesInternal(lView, mode = 0) { const environment = lView[ENVIRONMENT]; const rendererFactory = environment.rendererFactory; const checkNoChangesMode = !!ngDevMode && isInCheckNoChangesMode(); if (!checkNoChangesMode) { rendererFactory.begin?.(); } try { detectChangesInViewWhileDirty(lView, mode); } finally { if (!checkNoChangesMode) { rendererFactory.end?.(); } } } function detectChangesInViewWhileDirty(lView, mode) { const lastIsRefreshingViewsValue = isRefreshingViews(); try { setIsRefreshingViews(true); detectChangesInView(lView, mode); if (ngDevMode && isExhaustiveCheckNoChanges()) { return; } let retries = 0; while (requiresRefreshOrTraversal(lView)) { if (retries === MAXIMUM_REFRESH_RERUNS$1) { throw new RuntimeError(103, ngDevMode && "Infinite change detection while trying to refresh views. There may be components which each cause the other to require a refresh, causing an infinite loop."); } retries++; detectChangesInView( lView, 1 /* ChangeDetectionMode.Targeted */ ); } } finally { setIsRefreshingViews(lastIsRefreshingViewsValue); } } function checkNoChangesInternal(lView, exhaustive) { setIsInCheckNoChangesMode(exhaustive ? CheckNoChangesMode.Exhaustive : CheckNoChangesMode.OnlyDirtyViews); try { detectChangesInternal(lView); } finally { setIsInCheckNoChangesMode(CheckNoChangesMode.Off); } } function refreshView(tView, lView, templateFn, context) { ngDevMode && assertEqual(isCreationMode(lView), false, "Should be run in update mode"); if (isDestroyed(lView)) return; const flags = lView[FLAGS]; const isInCheckNoChangesPass = ngDevMode && isInCheckNoChangesMode(); const isInExhaustiveCheckNoChangesPass = ngDevMode && isExhaustiveCheckNoChanges(); enterView(lView); let returnConsumerToPool = true; let prevConsumer = null; let currentConsumer = null; if (!isInCheckNoChangesPass) { if (viewShouldHaveReactiveConsumer(tView)) { currentConsumer = getOrBorrowReactiveLViewConsumer(lView); prevConsumer = consumerBeforeComputation(currentConsumer); } else if (getActiveConsumer() === null) { returnConsumerToPool = false; currentConsumer = getOrCreateTemporaryConsumer(lView); prevConsumer = consumerBeforeComputation(currentConsumer); } else if (lView[REACTIVE_TEMPLATE_CONSUMER]) { consumerDestroy(lView[REACTIVE_TEMPLATE_CONSUMER]); lView[REACTIVE_TEMPLATE_CONSUMER] = null; } } try { resetPreOrderHookFlags(lView); setBindingIndex(tView.bindingStartIndex); if (templateFn !== null) { executeTemplate(tView, lView, templateFn, 2, context); } const hooksInitPhaseCompleted = (flags & 3) === 3; if (!isInCheckNoChangesPass) { if (hooksInitPhaseCompleted) { const preOrderCheckHooks = tView.preOrderCheckHooks; if (preOrderCheckHooks !== null) { executeCheckHooks(lView, preOrderCheckHooks, null); } } else { const preOrderHooks = tView.preOrderHooks; if (preOrderHooks !== null) { executeInitAndCheckHooks(lView, preOrderHooks, 0, null); } incrementInitPhaseFlags( lView, 0 /* InitPhaseState.OnInitHooksToBeRun */ ); } } if (!isInExhaustiveCheckNoChangesPass) { markTransplantedViewsForRefresh(lView); } runEffectsInView(lView); detectChangesInEmbeddedViews( lView, 0 /* ChangeDetectionMode.Global */ ); if (tView.contentQueries !== null) { refreshContentQueries(tView, lView); } if (!isInCheckNoChangesPass) { if (hooksInitPhaseCompleted) { const contentCheckHooks = tView.contentCheckHooks; if (contentCheckHooks !== null) { executeCheckHooks(lView, contentCheckHooks); } } else { const contentHooks = tView.contentHooks; if (contentHooks !== null) { executeInitAndCheckHooks( lView, contentHooks, 1 /* InitPhaseState.AfterContentInitHooksToBeRun */ ); } incrementInitPhaseFlags( lView, 1 /* InitPhaseState.AfterContentInitHooksToBeRun */ ); } } processHostBindingOpCodes(tView, lView); const components = tView.components; if (components !== null) { detectChangesInChildComponents( lView, components, 0 /* ChangeDetectionMode.Global */ ); } const viewQuery = tView.viewQuery; if (viewQuery !== null) { executeViewQueryFn(2, viewQuery, context); } if (!isInCheckNoChangesPass) { if (hooksInitPhaseCompleted) { const viewCheckHooks = tView.viewCheckHooks; if (viewCheckHooks !== null) { executeCheckHooks(lView, viewCheckHooks); } } else { const viewHooks = tView.viewHooks; if (viewHooks !== null) { executeInitAndCheckHooks( lView, viewHooks, 2 /* InitPhaseState.AfterViewInitHooksToBeRun */ ); } incrementInitPhaseFlags( lView, 2 /* InitPhaseState.AfterViewInitHooksToBeRun */ ); } } if (tView.firstUpdatePass === true) { tView.firstUpdatePass = false; } if (lView[EFFECTS_TO_SCHEDULE]) { for (const notifyEffect of lView[EFFECTS_TO_SCHEDULE]) { notifyEffect(); } lView[EFFECTS_TO_SCHEDULE] = null; } if (!isInCheckNoChangesPass) { addAfterRenderSequencesForView(lView); lView[FLAGS] &= ~(64 | 8); } } catch (e) { if (!isInCheckNoChangesPass) { markAncestorsForTraversal(lView); } throw e; } finally { if (currentConsumer !== null) { consumerAfterComputation(currentConsumer, prevConsumer); if (returnConsumerToPool) { maybeReturnReactiveLViewConsumer(currentConsumer); } } leaveView(); } } function detectChangesInEmbeddedViews(lView, mode) { for (let lContainer = getFirstLContainer(lView); lContainer !== null; lContainer = getNextLContainer(lContainer)) { for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) { const embeddedLView = lContainer[i]; detectChangesInViewIfAttached(embeddedLView, mode); } } } function markTransplantedViewsForRefresh(lView) { for (let lContainer = getFirstLContainer(lView); lContainer !== null; lContainer = getNextLContainer(lContainer)) { if (!(lContainer[FLAGS] & 2)) continue; const movedViews = lContainer[MOVED_VIEWS]; ngDevMode && assertDefined(movedViews, "Transplanted View flags set but missing MOVED_VIEWS"); for (let i = 0; i < movedViews.length; i++) { const movedLView = movedViews[i]; markViewForRefresh(movedLView); } } } function detectChangesInComponent(hostLView, componentHostIdx, mode) { ngDevMode && assertEqual(isCreationMode(hostLView), false, "Should be run in update mode"); profiler( 18 /* ProfilerEvent.ComponentStart */ ); const componentView = getComponentLViewByIndex(componentHostIdx, hostLView); detectChangesInViewIfAttached(componentView, mode); profiler(19, componentView[CONTEXT]); } function detectChangesInViewIfAttached(lView, mode) { if (!viewAttachedToChangeDetector(lView)) { return; } detectChangesInView(lView, mode); } function detectChangesInView(lView, mode) { const isInCheckNoChangesPass = ngDevMode && isInCheckNoChangesMode(); const tView = lView[TVIEW]; const flags = lView[FLAGS]; const consumer = lView[REACTIVE_TEMPLATE_CONSUMER]; let shouldRefreshView = !!(mode === 0 && flags & 16); shouldRefreshView ||= !!(flags & 64 && mode === 0 && !isInCheckNoChangesPass); shouldRefreshView ||= !!(flags & 1024); shouldRefreshView ||= !!(consumer?.dirty && consumerPollProducersForChange(consumer)); shouldRefreshView ||= !!(ngDevMode && isExhaustiveCheckNoChanges()); if (consumer) { consumer.dirty = false; } lView[FLAGS] &= ~(8192 | 1024); if (shouldRefreshView) { refreshView(tView, lView, tView.template, lView[CONTEXT]); } else if (flags & 8192) { const prevConsumer = setActiveConsumer(null); try { if (!isInCheckNoChangesPass) { runEffectsInView(lView); } detectChangesInEmbeddedViews( lView, 1 /* ChangeDetectionMode.Targeted */ ); const components = tView.components; if (components !== null) { detectChangesInChildComponents( lView, components, 1 /* ChangeDetectionMode.Targeted */ ); } if (!isInCheckNoChangesPass) { addAfterRenderSequencesForView(lView); } } finally { setActiveConsumer(prevConsumer); } } } function detectChangesInChildComponents(hostLView, components, mode) { for (let i = 0; i < components.length; i++) { detectChangesInComponent(hostLView, components[i], mode); } } function processHostBindingOpCodes(tView, lView) { const hostBindingOpCodes = tView.hostBindingOpCodes; if (hostBindingOpCodes === null) return; try { for (let i = 0; i < hostBindingOpCodes.length; i++) { const opCode = hostBindingOpCodes[i]; if (opCode < 0) { setSelectedIndex(~opCode); } else { const directiveIdx = opCode; const bindingRootIndx = hostBindingOpCodes[++i]; const hostBindingFn = hostBindingOpCodes[++i]; setBindingRootForHostBindings(bindingRootIndx, directiveIdx); const context = lView[directiveIdx]; profiler(24, context); hostBindingFn(2, context); profiler(25, context); } } } finally { setSelectedIndex(-1); } } function markViewDirty(lView, source) { const dirtyBitsToUse = isRefreshingViews() ? ( // When we are actively refreshing views, we only use the `Dirty` bit to mark a view 64 ) : ( // When we are not actively refreshing a view tree, it is absolutely // valid to update state and mark views dirty. We use the `RefreshView` flag in this // case to allow synchronously rerunning change detection. This applies today to // afterRender hooks as well as animation listeners which execute after detecting // changes in a view when the render factory flushes. 1024 | 64 ); lView[ENVIRONMENT].changeDetectionScheduler?.notify(source); while (lView) { lView[FLAGS] |= dirtyBitsToUse; const parent = getLViewParent(lView); if (isRootView(lView) && !parent) { return lView; } lView = parent; } return null; } function createLContainer(hostNative, currentView, native, tNode) { ngDevMode && assertLView(currentView); const lContainer = [ hostNative, // host native true, // Boolean `true` in this position signifies that this is an `LContainer` 0, // flags currentView, // parent null, // next tNode, // t_host null, // dehydrated views native, // native, null, // view refs null // moved views ]; ngDevMode && assertEqual(lContainer.length, CONTAINER_HEADER_OFFSET, "Should allocate correct number of slots for LContainer header."); return lContainer; } function getLViewFromLContainer(lContainer, index) { const adjustedIndex = CONTAINER_HEADER_OFFSET + index; if (adjustedIndex < lContainer.length) { const lView = lContainer[adjustedIndex]; ngDevMode && assertLView(lView); return lView; } return void 0; } function addLViewToLContainer(lContainer, lView, index, addToDOM = true) { const tView = lView[TVIEW]; insertView(tView, lView, lContainer, index); if (addToDOM) { const beforeNode = getBeforeNodeForView(index, lContainer); const renderer = lView[RENDERER]; const parentRNode = renderer.parentNode(lContainer[NATIVE]); if (parentRNode !== null) { addViewToDOM(tView, lContainer[T_HOST], renderer, lView, parentRNode, beforeNode); } } const hydrationInfo = lView[HYDRATION]; if (hydrationInfo !== null && hydrationInfo.firstChild !== null) { hydrationInfo.firstChild = null; } } function removeLViewFromLContainer(lContainer, index) { const lView = detachView(lContainer, index); if (lView !== void 0) { destroyLView(lView[TVIEW], lView); } return lView; } function detachView(lContainer, removeIndex) { if (lContainer.length <= CONTAINER_HEADER_OFFSET) return; const indexInContainer = CONTAINER_HEADER_OFFSET + removeIndex; const viewToDetach = lContainer[indexInContainer]; if (viewToDetach) { const declarationLContainer = viewToDetach[DECLARATION_LCONTAINER]; if (declarationLContainer !== null && declarationLContainer !== lContainer) { detachMovedView(declarationLContainer, viewToDetach); } if (removeIndex > 0) { lContainer[indexInContainer - 1][NEXT] = viewToDetach[NEXT]; } const removedLView = removeFromArray(lContainer, CONTAINER_HEADER_OFFSET + removeIndex); removeViewFromDOM(viewToDetach[TVIEW], viewToDetach); const lQueries = removedLView[QUERIES]; if (lQueries !== null) { lQueries.detachView(removedLView[TVIEW]); } viewToDetach[PARENT] = null; viewToDetach[NEXT] = null; viewToDetach[FLAGS] &= ~128; } return viewToDetach; } function insertView(tView, lView, lContainer, index) { ngDevMode && assertLView(lView); ngDevMode && assertLContainer(lContainer); const indexInContainer = CONTAINER_HEADER_OFFSET + index; const containerLength = lContainer.length; if (index > 0) { lContainer[indexInContainer - 1][NEXT] = lView; } if (index < containerLength - CONTAINER_HEADER_OFFSET) { lView[NEXT] = lContainer[indexInContainer]; addToArray(lContainer, CONTAINER_HEADER_OFFSET + index, lView); } else { lContainer.push(lView); lView[NEXT] = null; } lView[PARENT] = lContainer; const declarationLContainer = lView[DECLARATION_LCONTAINER]; if (declarationLContainer !== null && lContainer !== declarationLContainer) { trackMovedView(declarationLContainer, lView); } const lQueries = lView[QUERIES]; if (lQueries !== null) { lQueries.insertView(tView); } updateAncestorTraversalFlagsOnAttach(lView); lView[FLAGS] |= 128; } function trackMovedView(declarationContainer, lView) { ngDevMode && assertDefined(lView, "LView required"); ngDevMode && assertLContainer(declarationContainer); const movedViews = declarationContainer[MOVED_VIEWS]; const parent = lView[PARENT]; ngDevMode && assertDefined(parent, "missing parent"); if (isLView(parent)) { declarationContainer[FLAGS] |= 2; } else { const insertedComponentLView = parent[PARENT][DECLARATION_COMPONENT_VIEW]; ngDevMode && assertDefined(insertedComponentLView, "Missing insertedComponentLView"); const declaredComponentLView = lView[DECLARATION_COMPONENT_VIEW]; ngDevMode && assertDefined(declaredComponentLView, "Missing declaredComponentLView"); if (declaredComponentLView !== insertedComponentLView) { declarationContainer[FLAGS] |= 2; } } if (movedViews === null) { declarationContainer[MOVED_VIEWS] = [lView]; } else { movedViews.push(lView); } } var ViewRef = class { _lView; _cdRefInjectingView; _appRef = null; _attachedToViewContainer = false; exhaustive; get rootNodes() { const lView = this._lView; const tView = lView[TVIEW]; return collectNativeNodes(tView, lView, tView.firstChild, []); } constructor(_lView, _cdRefInjectingView) { this._lView = _lView; this._cdRefInjectingView = _cdRefInjectingView; } get context() { return this._lView[CONTEXT]; } /** * @deprecated Replacing the full context object is not supported. Modify the context * directly, or consider using a `Proxy` if you need to replace the full object. * // TODO(devversion): Remove this. */ set context(value) { if (ngDevMode) { console.warn("Angular: Replacing the `context` object of an `EmbeddedViewRef` is deprecated."); } this._lView[CONTEXT] = value; } get destroyed() { return isDestroyed(this._lView); } destroy() { if (this._appRef) { this._appRef.detachView(this); } else if (this._attachedToViewContainer) { const parent = this._lView[PARENT]; if (isLContainer(parent)) { const viewRefs = parent[VIEW_REFS]; const index = viewRefs ? viewRefs.indexOf(this) : -1; if (index > -1) { ngDevMode && assertEqual(index, parent.indexOf(this._lView) - CONTAINER_HEADER_OFFSET, "An attached view should be in the same position within its container as its ViewRef in the VIEW_REFS array."); detachView(parent, index); removeFromArray(viewRefs, index); } } this._attachedToViewContainer = false; } destroyLView(this._lView[TVIEW], this._lView); } onDestroy(callback) { storeLViewOnDestroy(this._lView, callback); } /** * Marks a view and all of its ancestors dirty. * * This can be used to ensure an {@link ChangeDetectionStrategy#OnPush} component is * checked when it needs to be re-rendered but the two normal triggers haven't marked it * dirty (i.e. inputs haven't changed and events haven't fired in the view). * * * * @usageNotes * ### Example * * ```ts * @Component({ * selector: 'app-root', * template: `Number of ticks: {{numberOfTicks}}` * changeDetection: ChangeDetectionStrategy.OnPush, * }) * class AppComponent { * numberOfTicks = 0; * * constructor(private ref: ChangeDetectorRef) { * setInterval(() => { * this.numberOfTicks++; * // the following is required, otherwise the view will not be updated * this.ref.markForCheck(); * }, 1000); * } * } * ``` */ markForCheck() { markViewDirty( this._cdRefInjectingView || this._lView, 4 /* NotificationSource.MarkForCheck */ ); } /** * Detaches the view from the change detection tree. * * Detached views will not be checked during change detection runs until they are * re-attached, even if they are dirty. `detach` can be used in combination with * {@link ChangeDetectorRef#detectChanges} to implement local change * detection checks. * * * * * @usageNotes * ### Example * * The following example defines a component with a large list of readonly data. * Imagine the data changes constantly, many times per second. For performance reasons, * we want to check and update the list every five seconds. We can do that by detaching * the component's change detector and doing a local check every five seconds. * * ```ts * class DataProvider { * // in a real application the returned data will be different every time * get data() { * return [1,2,3,4,5]; * } * } * * @Component({ * selector: 'giant-list', * template: ` * @for(d of dataProvider.data; track $index) { *
  • Data {{d}}
  • * } * `, * }) * class GiantList { * constructor(private ref: ChangeDetectorRef, private dataProvider: DataProvider) { * ref.detach(); * setInterval(() => { * this.ref.detectChanges(); * }, 5000); * } * } * * @Component({ * selector: 'app', * providers: [DataProvider], * template: ` * * `, * }) * class App { * } * ``` */ detach() { this._lView[FLAGS] &= ~128; } /** * Re-attaches a view to the change detection tree. * * This can be used to re-attach views that were previously detached from the tree * using {@link ChangeDetectorRef#detach}. Views are attached to the tree by default. * * * * @usageNotes * ### Example * * The following example creates a component displaying `live` data. The component will detach * its change detector from the main change detector tree when the component's live property * is set to false. * * ```ts * class DataProvider { * data = 1; * * constructor() { * setInterval(() => { * this.data = this.data * 2; * }, 500); * } * } * * @Component({ * selector: 'live-data', * inputs: ['live'], * template: 'Data: {{dataProvider.data}}' * }) * class LiveData { * constructor(private ref: ChangeDetectorRef, private dataProvider: DataProvider) {} * * set live(value) { * if (value) { * this.ref.reattach(); * } else { * this.ref.detach(); * } * } * } * * @Component({ * selector: 'app-root', * providers: [DataProvider], * template: ` * Live Update: * * `, * }) * class AppComponent { * live = true; * } * ``` */ reattach() { updateAncestorTraversalFlagsOnAttach(this._lView); this._lView[FLAGS] |= 128; } /** * Checks the view and its children. * * This can also be used in combination with {@link ChangeDetectorRef#detach} to implement * local change detection checks. * * * * * @usageNotes * ### Example * * The following example defines a component with a large list of readonly data. * Imagine, the data changes constantly, many times per second. For performance reasons, * we want to check and update the list every five seconds. * * We can do that by detaching the component's change detector and doing a local change detection * check every five seconds. * * See {@link ChangeDetectorRef#detach} for more information. */ detectChanges() { this._lView[FLAGS] |= 1024; detectChangesInternal(this._lView); } /** * Checks the change detector and its children, and throws if any changes are detected. * * This is used in development mode to verify that running change detection doesn't * introduce other changes. */ checkNoChanges() { if (!ngDevMode) return; try { this.exhaustive ??= this._lView[INJECTOR].get(UseExhaustiveCheckNoChanges, USE_EXHAUSTIVE_CHECK_NO_CHANGES_DEFAULT); } catch { this.exhaustive = USE_EXHAUSTIVE_CHECK_NO_CHANGES_DEFAULT; } checkNoChangesInternal(this._lView, this.exhaustive); } attachToViewContainerRef() { if (this._appRef) { throw new RuntimeError(902, ngDevMode && "This view is already attached directly to the ApplicationRef!"); } this._attachedToViewContainer = true; } detachFromAppRef() { this._appRef = null; const isRoot = isRootView(this._lView); const declarationContainer = this._lView[DECLARATION_LCONTAINER]; if (declarationContainer !== null && !isRoot) { detachMovedView(declarationContainer, this._lView); } detachViewFromDOM(this._lView[TVIEW], this._lView); } attachToAppRef(appRef) { if (this._attachedToViewContainer) { throw new RuntimeError(902, ngDevMode && "This view is already attached to a ViewContainer!"); } this._appRef = appRef; const isRoot = isRootView(this._lView); const declarationContainer = this._lView[DECLARATION_LCONTAINER]; if (declarationContainer !== null && !isRoot) { trackMovedView(declarationContainer, this._lView); } updateAncestorTraversalFlagsOnAttach(this._lView); } }; function isViewDirty(view) { return requiresRefreshOrTraversal(view._lView) || !!(view._lView[FLAGS] & 64); } function markForRefresh(view) { markViewForRefresh(view._lView); } var TemplateRef = class { _declarationLView; _declarationTContainer; /** * The anchor element in the parent view for this embedded view. * * The data-binding and [injection contexts](guide/di/dependency-injection-context) of embedded * views created from this `TemplateRef` inherit from the contexts of this location. * * Typically new embedded views are attached to the view container of this location, but in * advanced use-cases, the view can be attached to a different container while keeping the * data-binding and injection context from the original location. * */ elementRef; /** * @internal * @nocollapse */ static __NG_ELEMENT_ID__ = injectTemplateRef; /** @internal */ constructor(_declarationLView, _declarationTContainer, elementRef) { this._declarationLView = _declarationLView; this._declarationTContainer = _declarationTContainer; this.elementRef = elementRef; } /** * Returns an `ssrId` associated with a TView, which was used to * create this instance of the `TemplateRef`. * * @internal */ get ssrId() { return this._declarationTContainer.tView?.ssrId || null; } /** * Instantiates an unattached embedded view based on this template. * @param context The data-binding context of the embedded view, as declared * in the `` usage. * @param injector Injector to be used within the embedded view. * @returns The new embedded view object. */ createEmbeddedView(context, injector) { return this.createEmbeddedViewImpl(context, injector); } /** * Implementation of the `createEmbeddedView` function. * * This implementation is internal and allows framework code * to invoke it with extra parameters (e.g. for hydration) without * affecting public API. * * @internal */ createEmbeddedViewImpl(context, injector, dehydratedView) { const embeddedLView = createAndRenderEmbeddedLView(this._declarationLView, this._declarationTContainer, context, { embeddedViewInjector: injector, dehydratedView }); return new ViewRef(embeddedLView); } }; function injectTemplateRef() { return createTemplateRef(getCurrentTNode(), getLView()); } function createTemplateRef(hostTNode, hostLView) { if (hostTNode.type & 4) { ngDevMode && assertDefined(hostTNode.tView, "TView must be allocated"); return new TemplateRef(hostLView, hostTNode, createElementRef(hostTNode, hostLView)); } return null; } var AT_THIS_LOCATION = "<-- AT THIS LOCATION"; function getFriendlyStringFromTNodeType(tNodeType) { switch (tNodeType) { case 4: return "view container"; case 2: return "element"; case 8: return "ng-container"; case 32: return "icu"; case 64: return "i18n"; case 16: return "projection"; case 1: return "text"; case 128: return "@let"; default: return ""; } } function validateMatchingNode(node, nodeType, tagName, lView, tNode, isViewContainerAnchor = false) { if (!node || node.nodeType !== nodeType || node.nodeType === Node.ELEMENT_NODE && node.tagName.toLowerCase() !== tagName?.toLowerCase()) { const expectedNode = shortRNodeDescription(nodeType, tagName, null); let header = `During hydration Angular expected ${expectedNode} but `; const hostComponentDef = getDeclarationComponentDef(lView); const componentClassName = hostComponentDef?.type?.name; const expectedDom = describeExpectedDom(lView, tNode, isViewContainerAnchor); const expected = `Angular expected this DOM: ${expectedDom} `; let actual = ""; const componentHostElement = unwrapRNode(lView[HOST]); if (!node) { header += `the node was not found. `; markRNodeAsHavingHydrationMismatch(componentHostElement, expectedDom); } else { const actualNode = shortRNodeDescription(node.nodeType, node.tagName ?? null, node.textContent ?? null); header += `found ${actualNode}. `; const actualDom = describeDomFromNode(node); actual = `Actual DOM is: ${actualDom} `; markRNodeAsHavingHydrationMismatch(componentHostElement, expectedDom, actualDom); } const footer = getHydrationErrorFooter(componentClassName); const message = header + expected + actual + getHydrationAttributeNote() + footer; throw new RuntimeError(-500, message); } } function validateSiblingNodeExists(node) { validateNodeExists(node); if (!node.nextSibling) { const header = "During hydration Angular expected more sibling nodes to be present.\n\n"; const actual = `Actual DOM is: ${describeDomFromNode(node)} `; const footer = getHydrationErrorFooter(); const message = header + actual + footer; markRNodeAsHavingHydrationMismatch(node, "", actual); throw new RuntimeError(-501, message); } } function validateNodeExists(node, lView = null, tNode = null) { if (!node) { const header = "During hydration, Angular expected an element to be present at this location.\n\n"; let expected = ""; let footer = ""; if (lView !== null && tNode !== null) { expected = describeExpectedDom(lView, tNode, false); footer = getHydrationErrorFooter(); markRNodeAsHavingHydrationMismatch(unwrapRNode(lView[HOST]), expected, ""); } throw new RuntimeError(-502, `${header}${expected} ${footer}`); } } function nodeNotFoundError(lView, tNode) { const header = "During serialization, Angular was unable to find an element in the DOM:\n\n"; const expected = `${describeExpectedDom(lView, tNode, false)} `; const footer = getHydrationErrorFooter(); throw new RuntimeError(-502, header + expected + footer); } function nodeNotFoundAtPathError(host, path) { const header = `During hydration Angular was unable to locate a node using the "${path}" path, starting from the ${describeRNode(host)} node. `; const footer = getHydrationErrorFooter(); markRNodeAsHavingHydrationMismatch(host); throw new RuntimeError(-502, header + footer); } function unsupportedProjectionOfDomNodes(rNode) { const header = "During serialization, Angular detected DOM nodes that were created outside of Angular context and provided as projectable nodes (likely via `ViewContainerRef.createComponent` or `createComponent` APIs). Hydration is not supported for such cases, consider refactoring the code to avoid this pattern or using `ngSkipHydration` on the host element of the component.\n\n"; const actual = `${describeDomFromNode(rNode)} `; const message = header + actual + getHydrationAttributeNote(); return new RuntimeError(-503, message); } function invalidSkipHydrationHost(rNode) { const header = "The `ngSkipHydration` flag is applied on a node that doesn't act as a component host. Hydration can be skipped only on per-component basis.\n\n"; const actual = `${describeDomFromNode(rNode)} `; const footer = "Please move the `ngSkipHydration` attribute to the component host element.\n\n"; const message = header + actual + footer; return new RuntimeError(-504, message); } function stringifyTNodeAttrs(tNode) { const results = []; if (tNode.attrs) { for (let i = 0; i < tNode.attrs.length; ) { const attrName = tNode.attrs[i++]; if (typeof attrName == "number") { break; } const attrValue = tNode.attrs[i++]; results.push(`${attrName}="${shorten(attrValue)}"`); } } return results.join(" "); } var internalAttrs = /* @__PURE__ */ new Set(["ngh", "ng-version", "ng-server-context"]); function stringifyRNodeAttrs(rNode) { const results = []; for (let i = 0; i < rNode.attributes.length; i++) { const attr = rNode.attributes[i]; if (internalAttrs.has(attr.name)) continue; results.push(`${attr.name}="${shorten(attr.value)}"`); } return results.join(" "); } function describeTNode(tNode, innerContent = "…") { switch (tNode.type) { case 1: const content = tNode.value ? `(${tNode.value})` : ""; return `#text${content}`; case 2: const attrs = stringifyTNodeAttrs(tNode); const tag = tNode.value.toLowerCase(); return `<${tag}${attrs ? " " + attrs : ""}>${innerContent}`; case 8: return ""; case 4: return ""; default: const typeAsString = getFriendlyStringFromTNodeType(tNode.type); return `#node(${typeAsString})`; } } function describeRNode(rNode, innerContent = "…") { const node = rNode; switch (node.nodeType) { case Node.ELEMENT_NODE: const tag = node.tagName.toLowerCase(); const attrs = stringifyRNodeAttrs(node); return `<${tag}${attrs ? " " + attrs : ""}>${innerContent}`; case Node.TEXT_NODE: const content = node.textContent ? shorten(node.textContent) : ""; return `#text${content ? `(${content})` : ""}`; case Node.COMMENT_NODE: return ``; default: return `#node(${node.nodeType})`; } } function describeExpectedDom(lView, tNode, isViewContainerAnchor) { const spacer = " "; let content = ""; if (tNode.prev) { content += spacer + "…\n"; content += spacer + describeTNode(tNode.prev) + "\n"; } else if (tNode.type && tNode.type & 12) { content += spacer + "…\n"; } if (isViewContainerAnchor) { content += spacer + describeTNode(tNode) + "\n"; content += spacer + ` ${AT_THIS_LOCATION} `; } else { content += spacer + describeTNode(tNode) + ` ${AT_THIS_LOCATION} `; } content += spacer + "…\n"; const parentRNode = tNode.type ? getParentRElement(lView[TVIEW], tNode, lView) : null; if (parentRNode) { content = describeRNode(parentRNode, "\n" + content); } return content; } function describeDomFromNode(node) { const spacer = " "; let content = ""; const currentNode = node; if (currentNode.previousSibling) { content += spacer + "…\n"; content += spacer + describeRNode(currentNode.previousSibling) + "\n"; } content += spacer + describeRNode(currentNode) + ` ${AT_THIS_LOCATION} `; if (node.nextSibling) { content += spacer + "…\n"; } if (node.parentNode) { content = describeRNode(currentNode.parentNode, "\n" + content); } return content; } function shortRNodeDescription(nodeType, tagName, textContent) { switch (nodeType) { case Node.ELEMENT_NODE: return `<${tagName.toLowerCase()}>`; case Node.TEXT_NODE: const content = textContent ? ` (with the "${shorten(textContent)}" content)` : ""; return `a text node${content}`; case Node.COMMENT_NODE: return "a comment node"; default: return `#node(nodeType=${nodeType})`; } } function getHydrationErrorFooter(componentClassName) { const componentInfo = componentClassName ? `the "${componentClassName}"` : "corresponding"; return `To fix this problem: * check ${componentInfo} component for hydration-related issues * check to see if your template has valid HTML structure * or skip hydration by adding the \`ngSkipHydration\` attribute to its host node in a template `; } function getHydrationAttributeNote() { return "Note: attributes are only displayed to better represent the DOM but have no effect on hydration mismatches.\n\n"; } function stripNewlines(input2) { return input2.replace(/\s+/gm, ""); } function shorten(input2, maxLength = 50) { if (!input2) { return ""; } input2 = stripNewlines(input2); return input2.length > maxLength ? `${input2.substring(0, maxLength - 1)}…` : input2; } function getInsertInFrontOfRNodeWithI18n(parentTNode, currentTNode, lView) { const tNodeInsertBeforeIndex = currentTNode.insertBeforeIndex; const insertBeforeIndex = Array.isArray(tNodeInsertBeforeIndex) ? tNodeInsertBeforeIndex[0] : tNodeInsertBeforeIndex; if (insertBeforeIndex === null) { return getInsertInFrontOfRNodeWithNoI18n(parentTNode, currentTNode, lView); } else { ngDevMode && assertIndexInRange(lView, insertBeforeIndex); return unwrapRNode(lView[insertBeforeIndex]); } } function processI18nInsertBefore(renderer, childTNode, lView, childRNode, parentRElement) { const tNodeInsertBeforeIndex = childTNode.insertBeforeIndex; if (Array.isArray(tNodeInsertBeforeIndex)) { ngDevMode && assertDomNode(childRNode); let i18nParent = childRNode; let anchorRNode = null; if (!(childTNode.type & 3)) { anchorRNode = i18nParent; i18nParent = parentRElement; } if (i18nParent !== null && childTNode.componentOffset === -1) { for (let i = 1; i < tNodeInsertBeforeIndex.length; i++) { const i18nChild = lView[tNodeInsertBeforeIndex[i]]; nativeInsertBefore(renderer, i18nParent, i18nChild, anchorRNode, false); } } } } function getOrCreateTNode(tView, index, type, name, attrs) { ngDevMode && index !== 0 && // 0 are bogus nodes and they are OK. See `createContainerRef` in // `view_engine_compatibility` for additional context. assertGreaterThanOrEqual(index, HEADER_OFFSET, "TNodes can't be in the LView header."); ngDevMode && assertPureTNodeType(type); let tNode = tView.data[index]; if (tNode === null) { tNode = createTNodeAtIndex(tView, index, type, name, attrs); if (isInI18nBlock()) { tNode.flags |= 32; } } else if (tNode.type & 64) { tNode.type = type; tNode.value = name; tNode.attrs = attrs; const parent = getCurrentParentTNode(); tNode.injectorIndex = parent === null ? -1 : parent.injectorIndex; ngDevMode && assertTNodeForTView(tNode, tView); ngDevMode && assertEqual(index, tNode.index, "Expecting same index"); } setCurrentTNode(tNode, true); return tNode; } function createTNodeAtIndex(tView, index, type, name, attrs) { const currentTNode = getCurrentTNodePlaceholderOk(); const isParent = isCurrentTNodeParent(); const parent = isParent ? currentTNode : currentTNode && currentTNode.parent; const tNode = tView.data[index] = createTNode(tView, parent, type, index, name, attrs); linkTNodeInTView(tView, tNode, currentTNode, isParent); return tNode; } function linkTNodeInTView(tView, tNode, currentTNode, isParent) { if (tView.firstChild === null) { tView.firstChild = tNode; } if (currentTNode !== null) { if (isParent) { if (currentTNode.child == null && tNode.parent !== null) { currentTNode.child = tNode; } } else { if (currentTNode.next === null) { currentTNode.next = tNode; tNode.prev = currentTNode; } } } } function createTNode(tView, tParent, type, index, value, attrs) { ngDevMode && index !== 0 && // 0 are bogus nodes and they are OK. See `createContainerRef` in // `view_engine_compatibility` for additional context. assertGreaterThanOrEqual(index, HEADER_OFFSET, "TNodes can't be in the LView header."); ngDevMode && assertNotSame(attrs, void 0, "'undefined' is not valid value for 'attrs'"); ngDevMode && tParent && assertTNodeForTView(tParent, tView); let injectorIndex = tParent ? tParent.injectorIndex : -1; let flags = 0; if (isInSkipHydrationBlock()) { flags |= 128; } const tNode = { type, index, insertBeforeIndex: null, injectorIndex, directiveStart: -1, directiveEnd: -1, directiveStylingLast: -1, componentOffset: -1, propertyBindings: null, flags, providerIndexes: 0, value, attrs, mergedAttrs: null, localNames: null, initialInputs: null, inputs: null, hostDirectiveInputs: null, outputs: null, hostDirectiveOutputs: null, directiveToIndex: null, tView: null, next: null, prev: null, projectionNext: null, child: null, parent: tParent, projection: null, styles: null, stylesWithoutHost: null, residualStyles: void 0, classes: null, classesWithoutHost: null, residualClasses: void 0, classBindings: 0, styleBindings: 0 }; if (ngDevMode) { Object.seal(tNode); } return tNode; } function addTNodeAndUpdateInsertBeforeIndex(previousTNodes, newTNode) { ngDevMode && assertEqual(newTNode.insertBeforeIndex, null, "We expect that insertBeforeIndex is not set"); previousTNodes.push(newTNode); if (previousTNodes.length > 1) { for (let i = previousTNodes.length - 2; i >= 0; i--) { const existingTNode = previousTNodes[i]; if (!isI18nText(existingTNode)) { if (isNewTNodeCreatedBefore(existingTNode, newTNode) && getInsertBeforeIndex(existingTNode) === null) { setInsertBeforeIndex(existingTNode, newTNode.index); } } } } } function isI18nText(tNode) { return !(tNode.type & 64); } function isNewTNodeCreatedBefore(existingTNode, newTNode) { return isI18nText(newTNode) || existingTNode.index > newTNode.index; } function getInsertBeforeIndex(tNode) { const index = tNode.insertBeforeIndex; return Array.isArray(index) ? index[0] : index; } function setInsertBeforeIndex(tNode, value) { const index = tNode.insertBeforeIndex; if (Array.isArray(index)) { index[0] = value; } else { setI18nHandling(getInsertInFrontOfRNodeWithI18n, processI18nInsertBefore); tNode.insertBeforeIndex = value; } } function getTIcu(tView, index) { const value = tView.data[index]; if (value === null || typeof value === "string") return null; if (ngDevMode && !(value.hasOwnProperty("tView") || value.hasOwnProperty("currentCaseLViewIndex"))) { throwError("We expect to get 'null'|'TIcu'|'TIcuContainer', but got: " + value); } const tIcu = value.hasOwnProperty("currentCaseLViewIndex") ? value : value.value; ngDevMode && assertTIcu(tIcu); return tIcu; } function setTIcu(tView, index, tIcu) { const tNode = tView.data[index]; ngDevMode && assertEqual(tNode === null || tNode.hasOwnProperty("tView"), true, "We expect to get 'null'|'TIcuContainer'"); if (tNode === null) { tView.data[index] = tIcu; } else { ngDevMode && assertTNodeType( tNode, 32 /* TNodeType.Icu */ ); tNode.value = tIcu; } } function setTNodeInsertBeforeIndex(tNode, index) { ngDevMode && assertTNode(tNode); let insertBeforeIndex = tNode.insertBeforeIndex; if (insertBeforeIndex === null) { setI18nHandling(getInsertInFrontOfRNodeWithI18n, processI18nInsertBefore); insertBeforeIndex = tNode.insertBeforeIndex = [ null, index ]; } else { assertEqual(Array.isArray(insertBeforeIndex), true, "Expecting array here"); insertBeforeIndex.push(index); } } function createTNodePlaceholder(tView, previousTNodes, index) { const tNode = createTNodeAtIndex(tView, index, 64, null, null); addTNodeAndUpdateInsertBeforeIndex(previousTNodes, tNode); return tNode; } function getCurrentICUCaseIndex(tIcu, lView) { const currentCase = lView[tIcu.currentCaseLViewIndex]; return currentCase === null ? currentCase : currentCase < 0 ? ~currentCase : currentCase; } function getParentFromIcuCreateOpCode(mergedCode) { return mergedCode >>> 17; } function getRefFromIcuCreateOpCode(mergedCode) { return (mergedCode & 131070) >>> 1; } function getInstructionFromIcuCreateOpCode(mergedCode) { return mergedCode & 1; } function icuCreateOpCode(opCode, parentIdx, refIdx) { ngDevMode && assertGreaterThanOrEqual(parentIdx, 0, "Missing parent index"); ngDevMode && assertGreaterThan(refIdx, 0, "Missing ref index"); return opCode | parentIdx << 17 | refIdx << 1; } function isRootTemplateMessage(subTemplateIndex) { return subTemplateIndex === -1; } function enterIcu(state, tIcu, lView) { state.index = 0; const currentCase = getCurrentICUCaseIndex(tIcu, lView); if (currentCase !== null) { ngDevMode && assertNumberInRange(currentCase, 0, tIcu.cases.length - 1); state.removes = tIcu.remove[currentCase]; } else { state.removes = EMPTY_ARRAY; } } function icuContainerIteratorNext(state) { if (state.index < state.removes.length) { const removeOpCode = state.removes[state.index++]; ngDevMode && assertNumber(removeOpCode, "Expecting OpCode number"); if (removeOpCode > 0) { const rNode = state.lView[removeOpCode]; ngDevMode && assertDomNode(rNode); return rNode; } else { state.stack.push(state.index, state.removes); const tIcuIndex = ~removeOpCode; const tIcu = state.lView[TVIEW].data[tIcuIndex]; ngDevMode && assertTIcu(tIcu); enterIcu(state, tIcu, state.lView); return icuContainerIteratorNext(state); } } else { if (state.stack.length === 0) { return null; } else { state.removes = state.stack.pop(); state.index = state.stack.pop(); return icuContainerIteratorNext(state); } } } function loadIcuContainerVisitor() { const _state = { stack: [], index: -1 }; function icuContainerIteratorStart(tIcuContainerNode, lView) { _state.lView = lView; while (_state.stack.length) _state.stack.pop(); ngDevMode && assertTNodeForLView(tIcuContainerNode, lView); enterIcu(_state, tIcuContainerNode.value, lView); return icuContainerIteratorNext.bind(null, _state); } return icuContainerIteratorStart; } function createIcuIterator(tIcu, lView) { const state = { stack: [], index: -1, lView }; ngDevMode && assertTIcu(tIcu); enterIcu(state, tIcu, lView); return icuContainerIteratorNext.bind(null, state); } var REF_EXTRACTOR_REGEXP = new RegExp(`^(\\d+)*(${REFERENCE_NODE_BODY}|${REFERENCE_NODE_HOST})*(.*)`); function compressNodeLocation(referenceNode, path) { const result = [referenceNode]; for (const segment of path) { const lastIdx = result.length - 1; if (lastIdx > 0 && result[lastIdx - 1] === segment) { const value = result[lastIdx] || 1; result[lastIdx] = value + 1; } else { result.push(segment, ""); } } return result.join(""); } function decompressNodeLocation(path) { const matches = path.match(REF_EXTRACTOR_REGEXP); const [_, refNodeId, refNodeName, rest] = matches; const ref = refNodeId ? parseInt(refNodeId, 10) : refNodeName; const steps = []; for (const [_2, step, count] of rest.matchAll(/(f|n)(\d*)/g)) { const repeat = parseInt(count, 10) || 1; steps.push(step, repeat); } return [ref, ...steps]; } function isFirstElementInNgContainer(tNode) { return !tNode.prev && tNode.parent?.type === 8; } function getNoOffsetIndex(tNode) { return tNode.index - HEADER_OFFSET; } function isDisconnectedNode(tNode, lView) { return !(tNode.type & (16 | 128)) && !!lView[tNode.index] && isDisconnectedRNode(unwrapRNode(lView[tNode.index])); } function isDisconnectedRNode(rNode) { return !!rNode && !rNode.isConnected; } function locateI18nRNodeByIndex(hydrationInfo, noOffsetIndex) { const i18nNodes = hydrationInfo.i18nNodes; if (i18nNodes) { return i18nNodes.get(noOffsetIndex); } return void 0; } function tryLocateRNodeByPath(hydrationInfo, lView, noOffsetIndex) { const nodes = hydrationInfo.data[NODES]; const path = nodes?.[noOffsetIndex]; return path ? locateRNodeByPath(path, lView) : null; } function locateNextRNode(hydrationInfo, tView, lView, tNode) { const noOffsetIndex = getNoOffsetIndex(tNode); let native = locateI18nRNodeByIndex(hydrationInfo, noOffsetIndex); if (native === void 0) { const nodes = hydrationInfo.data[NODES]; if (nodes?.[noOffsetIndex]) { native = locateRNodeByPath(nodes[noOffsetIndex], lView); } else if (tView.firstChild === tNode) { native = hydrationInfo.firstChild; } else { const previousTNodeParent = tNode.prev === null; const previousTNode = tNode.prev ?? tNode.parent; ngDevMode && assertDefined(previousTNode, "Unexpected state: current TNode does not have a connection to the previous node or a parent node."); if (isFirstElementInNgContainer(tNode)) { const noOffsetParentIndex = getNoOffsetIndex(tNode.parent); native = getSegmentHead(hydrationInfo, noOffsetParentIndex); } else { let previousRElement = getNativeByTNode(previousTNode, lView); if (previousTNodeParent) { native = previousRElement.firstChild; } else { const noOffsetPrevSiblingIndex = getNoOffsetIndex(previousTNode); const segmentHead = getSegmentHead(hydrationInfo, noOffsetPrevSiblingIndex); if (previousTNode.type === 2 && segmentHead) { const numRootNodesToSkip = calcSerializedContainerSize(hydrationInfo, noOffsetPrevSiblingIndex); const nodesToSkip = numRootNodesToSkip + 1; native = siblingAfter(nodesToSkip, segmentHead); } else { native = previousRElement.nextSibling; } } } } } return native; } function siblingAfter(skip, from) { let currentNode = from; for (let i = 0; i < skip; i++) { ngDevMode && validateSiblingNodeExists(currentNode); currentNode = currentNode.nextSibling; } return currentNode; } function stringifyNavigationInstructions(instructions) { const container = []; for (let i = 0; i < instructions.length; i += 2) { const step = instructions[i]; const repeat = instructions[i + 1]; for (let r = 0; r < repeat; r++) { container.push(step === NODE_NAVIGATION_STEP_FIRST_CHILD ? "firstChild" : "nextSibling"); } } return container.join("."); } function navigateToNode(from, instructions) { let node = from; for (let i = 0; i < instructions.length; i += 2) { const step = instructions[i]; const repeat = instructions[i + 1]; for (let r = 0; r < repeat; r++) { if (ngDevMode && !node) { throw nodeNotFoundAtPathError(from, stringifyNavigationInstructions(instructions)); } switch (step) { case NODE_NAVIGATION_STEP_FIRST_CHILD: node = node.firstChild; break; case NODE_NAVIGATION_STEP_NEXT_SIBLING: node = node.nextSibling; break; } } } if (ngDevMode && !node) { throw nodeNotFoundAtPathError(from, stringifyNavigationInstructions(instructions)); } return node; } function locateRNodeByPath(path, lView) { const [referenceNode, ...navigationInstructions] = decompressNodeLocation(path); let ref; if (referenceNode === REFERENCE_NODE_HOST) { ref = lView[DECLARATION_COMPONENT_VIEW][HOST]; } else if (referenceNode === REFERENCE_NODE_BODY) { ref = ɵɵresolveBody(lView[DECLARATION_COMPONENT_VIEW][HOST]); } else { const parentElementId = Number(referenceNode); ref = unwrapRNode(lView[parentElementId + HEADER_OFFSET]); } return navigateToNode(ref, navigationInstructions); } function navigateBetween(start, finish) { if (start === finish) { return []; } else if (start.parentElement == null || finish.parentElement == null) { return null; } else if (start.parentElement === finish.parentElement) { return navigateBetweenSiblings(start, finish); } else { const parent = finish.parentElement; const parentPath = navigateBetween(start, parent); const childPath = navigateBetween(parent.firstChild, finish); if (!parentPath || !childPath) return null; return [ // First navigate to `finish`'s parent ...parentPath, // Then to its first child. NODE_NAVIGATION_STEP_FIRST_CHILD, // And finally from that node to `finish` (maybe a no-op if we're already there). ...childPath ]; } } function navigateBetweenSiblings(start, finish) { const nav = []; let node = null; for (node = start; node != null && node !== finish; node = node.nextSibling) { nav.push(NODE_NAVIGATION_STEP_NEXT_SIBLING); } return node == null ? null : nav; } function calcPathBetween(from, to, fromNodeName) { const path = navigateBetween(from, to); return path === null ? null : compressNodeLocation(fromNodeName, path); } function calcPathForNode(tNode, lView, excludedParentNodes) { let parentTNode = tNode.parent; let parentIndex; let parentRNode; let referenceNodeName; while (parentTNode !== null && (isDisconnectedNode(parentTNode, lView) || excludedParentNodes?.has(parentTNode.index))) { parentTNode = parentTNode.parent; } if (parentTNode === null || !(parentTNode.type & 3)) { parentIndex = referenceNodeName = REFERENCE_NODE_HOST; parentRNode = lView[DECLARATION_COMPONENT_VIEW][HOST]; } else { parentIndex = parentTNode.index; parentRNode = unwrapRNode(lView[parentIndex]); referenceNodeName = renderStringify(parentIndex - HEADER_OFFSET); } let rNode = unwrapRNode(lView[tNode.index]); if (tNode.type & (12 | 32)) { const firstRNode = getFirstNativeNode(lView, tNode); if (firstRNode) { rNode = firstRNode; } } let path = calcPathBetween(parentRNode, rNode, referenceNodeName); if (path === null && parentRNode !== rNode) { const body = parentRNode.ownerDocument.body; path = calcPathBetween(body, rNode, REFERENCE_NODE_BODY); if (path === null) { throw nodeNotFoundError(lView, tNode); } } return path; } function gatherDeferBlocksCommentNodes(doc, node) { const commentNodesIterator = doc.createNodeIterator(node, NodeFilter.SHOW_COMMENT, { acceptNode }); let currentNode; const nodesByBlockId = /* @__PURE__ */ new Map(); while (currentNode = commentNodesIterator.nextNode()) { const nghPattern = "ngh="; const content = currentNode?.textContent; const nghIdx = content?.indexOf(nghPattern) ?? -1; if (nghIdx > -1) { const nghValue = content.substring(nghIdx + nghPattern.length).trim(); ngDevMode && assertEqual(nghValue.startsWith("d"), true, "Invalid defer block id found in a comment node."); nodesByBlockId.set(nghValue, currentNode); } } return nodesByBlockId; } function acceptNode(node) { return node.textContent?.trimStart().startsWith("ngh=") ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT; } var _isI18nHydrationSupportEnabled = false; var _prepareI18nBlockForHydrationImpl = () => { }; function setIsI18nHydrationSupportEnabled(enabled) { _isI18nHydrationSupportEnabled = enabled; } function isI18nHydrationSupportEnabled() { return _isI18nHydrationSupportEnabled; } function prepareI18nBlockForHydration(lView, index, parentTNode, subTemplateIndex) { _prepareI18nBlockForHydrationImpl(lView, index, parentTNode, subTemplateIndex); } function enablePrepareI18nBlockForHydrationImpl() { _prepareI18nBlockForHydrationImpl = prepareI18nBlockForHydrationImpl; } function isI18nHydrationEnabled(injector) { injector = injector ?? inject(Injector); return injector.get(IS_I18N_HYDRATION_ENABLED, false); } function getOrComputeI18nChildren(tView, context) { let i18nChildren = context.i18nChildren.get(tView); if (i18nChildren === void 0) { i18nChildren = collectI18nChildren(tView); context.i18nChildren.set(tView, i18nChildren); } return i18nChildren; } function collectI18nChildren(tView) { const children = /* @__PURE__ */ new Set(); function collectI18nViews(node) { children.add(node.index); switch (node.kind) { case 1: case 2: { for (const childNode of node.children) { collectI18nViews(childNode); } break; } case 3: { for (const caseNodes of node.cases) { for (const caseNode of caseNodes) { collectI18nViews(caseNode); } } break; } } } for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) { const tI18n = tView.data[i]; if (!tI18n || !tI18n.ast) { continue; } for (const node of tI18n.ast) { collectI18nViews(node); } } return children.size === 0 ? null : children; } function trySerializeI18nBlock(lView, index, context) { if (!context.isI18nHydrationEnabled) { return null; } const tView = lView[TVIEW]; const tI18n = tView.data[index]; if (!tI18n || !tI18n.ast) { return null; } const parentTNode = tView.data[tI18n.parentTNodeIndex]; if (parentTNode && isI18nInSkipHydrationBlock(parentTNode)) { return null; } const serializedI18nBlock = { caseQueue: [], disconnectedNodes: /* @__PURE__ */ new Set(), disjointNodes: /* @__PURE__ */ new Set() }; serializeI18nBlock(lView, serializedI18nBlock, context, tI18n.ast); return serializedI18nBlock.caseQueue.length === 0 && serializedI18nBlock.disconnectedNodes.size === 0 && serializedI18nBlock.disjointNodes.size === 0 ? null : serializedI18nBlock; } function serializeI18nBlock(lView, serializedI18nBlock, context, nodes) { let prevRNode = null; for (const node of nodes) { const nextRNode = serializeI18nNode(lView, serializedI18nBlock, context, node); if (nextRNode) { if (isDisjointNode(prevRNode, nextRNode)) { serializedI18nBlock.disjointNodes.add(node.index - HEADER_OFFSET); } prevRNode = nextRNode; } } return prevRNode; } function isDisjointNode(prevNode, nextNode) { return prevNode && prevNode.nextSibling !== nextNode; } function serializeI18nNode(lView, serializedI18nBlock, context, node) { const maybeRNode = unwrapRNode(lView[node.index]); if (!maybeRNode || isDisconnectedRNode(maybeRNode)) { serializedI18nBlock.disconnectedNodes.add(node.index - HEADER_OFFSET); return null; } const rNode = maybeRNode; switch (node.kind) { case 0: { processTextNodeBeforeSerialization(context, rNode); break; } case 1: case 2: { serializeI18nBlock(lView, serializedI18nBlock, context, node.children); break; } case 3: { const currentCase = lView[node.currentCaseLViewIndex]; if (currentCase != null) { const caseIdx = currentCase < 0 ? ~currentCase : currentCase; serializedI18nBlock.caseQueue.push(caseIdx); serializeI18nBlock(lView, serializedI18nBlock, context, node.cases[caseIdx]); } break; } } return getFirstNativeNodeForI18nNode(lView, node); } function getFirstNativeNodeForI18nNode(lView, node) { const tView = lView[TVIEW]; const maybeTNode = tView.data[node.index]; if (isTNodeShape(maybeTNode)) { return getFirstNativeNode(lView, maybeTNode); } else if (node.kind === 3) { const icuIterator = createIcuIterator(maybeTNode, lView); let rNode = icuIterator(); return rNode ?? unwrapRNode(lView[node.index]); } else { return unwrapRNode(lView[node.index]) ?? null; } } function setCurrentNode(state, node) { state.currentNode = node; } function appendI18nNodeToCollection(context, state, astNode) { const noOffsetIndex = astNode.index - HEADER_OFFSET; const { disconnectedNodes } = context; const currentNode = state.currentNode; if (state.isConnected) { context.i18nNodes.set(noOffsetIndex, currentNode); disconnectedNodes.delete(noOffsetIndex); } else { disconnectedNodes.add(noOffsetIndex); } return currentNode; } function skipSiblingNodes(state, skip) { let currentNode = state.currentNode; for (let i = 0; i < skip; i++) { if (!currentNode) { break; } currentNode = currentNode?.nextSibling ?? null; } return currentNode; } function forkHydrationState(state, nextNode) { return { currentNode: nextNode, isConnected: state.isConnected }; } function prepareI18nBlockForHydrationImpl(lView, index, parentTNode, subTemplateIndex) { const hydrationInfo = lView[HYDRATION]; if (!hydrationInfo) { return; } if (!isI18nHydrationSupportEnabled() || parentTNode && (isI18nInSkipHydrationBlock(parentTNode) || isDisconnectedNode$1(hydrationInfo, parentTNode.index - HEADER_OFFSET))) { return; } const tView = lView[TVIEW]; const tI18n = tView.data[index]; ngDevMode && assertDefined(tI18n, "Expected i18n data to be present in a given TView slot during hydration"); function findHydrationRoot() { if (isRootTemplateMessage(subTemplateIndex)) { ngDevMode && assertDefined(parentTNode, "Expected parent TNode while hydrating i18n root"); const rootNode = locateNextRNode(hydrationInfo, tView, lView, parentTNode); return parentTNode.type & 8 ? rootNode : rootNode.firstChild; } return hydrationInfo?.firstChild; } const currentNode = findHydrationRoot(); ngDevMode && assertDefined(currentNode, "Expected root i18n node during hydration"); const disconnectedNodes = initDisconnectedNodes(hydrationInfo) ?? /* @__PURE__ */ new Set(); const i18nNodes = hydrationInfo.i18nNodes ??= /* @__PURE__ */ new Map(); const caseQueue = hydrationInfo.data[I18N_DATA]?.[index - HEADER_OFFSET] ?? []; const dehydratedIcuData = hydrationInfo.dehydratedIcuData ??= /* @__PURE__ */ new Map(); collectI18nNodesFromDom({ hydrationInfo, lView, i18nNodes, disconnectedNodes, caseQueue, dehydratedIcuData }, { currentNode, isConnected: true }, tI18n.ast); hydrationInfo.disconnectedNodes = disconnectedNodes.size === 0 ? null : disconnectedNodes; } function collectI18nNodesFromDom(context, state, nodeOrNodes) { if (Array.isArray(nodeOrNodes)) { let nextState = state; for (const node of nodeOrNodes) { const targetNode = tryLocateRNodeByPath(context.hydrationInfo, context.lView, node.index - HEADER_OFFSET); if (targetNode) { nextState = forkHydrationState(state, targetNode); } collectI18nNodesFromDom(context, nextState, node); } } else { if (context.disconnectedNodes.has(nodeOrNodes.index - HEADER_OFFSET)) { return; } switch (nodeOrNodes.kind) { case 0: { const currentNode = appendI18nNodeToCollection(context, state, nodeOrNodes); setCurrentNode(state, currentNode?.nextSibling ?? null); break; } case 1: { collectI18nNodesFromDom(context, forkHydrationState(state, state.currentNode?.firstChild ?? null), nodeOrNodes.children); const currentNode = appendI18nNodeToCollection(context, state, nodeOrNodes); setCurrentNode(state, currentNode?.nextSibling ?? null); break; } case 2: { const noOffsetIndex = nodeOrNodes.index - HEADER_OFFSET; const { hydrationInfo } = context; const containerSize = getNgContainerSize(hydrationInfo, noOffsetIndex); switch (nodeOrNodes.type) { case 0: { const currentNode = appendI18nNodeToCollection(context, state, nodeOrNodes); if (isSerializedElementContainer(hydrationInfo, noOffsetIndex)) { collectI18nNodesFromDom(context, state, nodeOrNodes.children); const nextNode = skipSiblingNodes(state, 1); setCurrentNode(state, nextNode); } else { collectI18nNodesFromDom(context, forkHydrationState(state, state.currentNode?.firstChild ?? null), nodeOrNodes.children); setCurrentNode(state, currentNode?.nextSibling ?? null); if (containerSize !== null) { const nextNode = skipSiblingNodes(state, containerSize + 1); setCurrentNode(state, nextNode); } } break; } case 1: { ngDevMode && assertNotEqual(containerSize, null, "Expected a container size while hydrating i18n subtemplate"); appendI18nNodeToCollection(context, state, nodeOrNodes); const nextNode = skipSiblingNodes(state, containerSize + 1); setCurrentNode(state, nextNode); break; } } break; } case 3: { const selectedCase = state.isConnected ? context.caseQueue.shift() : null; const childState = { currentNode: null, isConnected: false }; for (let i = 0; i < nodeOrNodes.cases.length; i++) { collectI18nNodesFromDom(context, i === selectedCase ? state : childState, nodeOrNodes.cases[i]); } if (selectedCase !== null) { context.dehydratedIcuData.set(nodeOrNodes.index, { case: selectedCase, node: nodeOrNodes }); } const currentNode = appendI18nNodeToCollection(context, state, nodeOrNodes); setCurrentNode(state, currentNode?.nextSibling ?? null); break; } } } } var _claimDehydratedIcuCaseImpl = () => { }; function claimDehydratedIcuCase(lView, icuIndex, caseIndex) { _claimDehydratedIcuCaseImpl(lView, icuIndex, caseIndex); } function enableClaimDehydratedIcuCaseImpl() { _claimDehydratedIcuCaseImpl = claimDehydratedIcuCaseImpl; } function claimDehydratedIcuCaseImpl(lView, icuIndex, caseIndex) { const dehydratedIcuDataMap = lView[HYDRATION]?.dehydratedIcuData; if (dehydratedIcuDataMap) { const dehydratedIcuData = dehydratedIcuDataMap.get(icuIndex); if (dehydratedIcuData?.case === caseIndex) { dehydratedIcuDataMap.delete(icuIndex); } } } function cleanupI18nHydrationData(lView) { const hydrationInfo = lView[HYDRATION]; if (hydrationInfo) { const { i18nNodes, dehydratedIcuData: dehydratedIcuDataMap } = hydrationInfo; if (i18nNodes && dehydratedIcuDataMap) { const renderer = lView[RENDERER]; for (const dehydratedIcuData of dehydratedIcuDataMap.values()) { cleanupDehydratedIcuData(renderer, i18nNodes, dehydratedIcuData); } } hydrationInfo.i18nNodes = void 0; hydrationInfo.dehydratedIcuData = void 0; } } function cleanupDehydratedIcuData(renderer, i18nNodes, dehydratedIcuData) { for (const node of dehydratedIcuData.node.cases[dehydratedIcuData.case]) { const rNode = i18nNodes.get(node.index - HEADER_OFFSET); if (rNode) { nativeRemoveNode(renderer, rNode, false); } } } function removeDehydratedViews(lContainer) { const views = lContainer[DEHYDRATED_VIEWS] ?? []; const parentLView = lContainer[PARENT]; const renderer = parentLView[RENDERER]; const retainedViews = []; for (const view of views) { if (view.data[DEFER_BLOCK_ID] !== void 0) { retainedViews.push(view); } else { removeDehydratedView(view, renderer); ngDevMode && ngDevMode.dehydratedViewsRemoved++; } } lContainer[DEHYDRATED_VIEWS] = retainedViews; } function removeDehydratedViewList(deferBlock) { const { lContainer } = deferBlock; const dehydratedViews = lContainer[DEHYDRATED_VIEWS]; if (dehydratedViews === null) return; const parentLView = lContainer[PARENT]; const renderer = parentLView[RENDERER]; for (const view of dehydratedViews) { removeDehydratedView(view, renderer); ngDevMode && ngDevMode.dehydratedViewsRemoved++; } } function removeDehydratedView(dehydratedView, renderer) { let nodesRemoved = 0; let currentRNode = dehydratedView.firstChild; if (currentRNode) { const numNodes = dehydratedView.data[NUM_ROOT_NODES]; while (nodesRemoved < numNodes) { ngDevMode && validateSiblingNodeExists(currentRNode); const nextSibling = currentRNode.nextSibling; nativeRemoveNode(renderer, currentRNode, false); currentRNode = nextSibling; nodesRemoved++; } } } function cleanupLContainer(lContainer) { removeDehydratedViews(lContainer); const hostLView = lContainer[HOST]; if (isLView(hostLView)) { cleanupLView(hostLView); } for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) { cleanupLView(lContainer[i]); } } function cleanupLView(lView) { cleanupI18nHydrationData(lView); const tView = lView[TVIEW]; for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) { if (isLContainer(lView[i])) { const lContainer = lView[i]; cleanupLContainer(lContainer); } else if (isLView(lView[i])) { cleanupLView(lView[i]); } } } function cleanupDehydratedViews(appRef) { const viewRefs = appRef._views; for (const viewRef of viewRefs) { const lNode = getLNodeForHydration(viewRef); if (lNode !== null && lNode[HOST] !== null) { if (isLView(lNode)) { cleanupLView(lNode); } else { cleanupLContainer(lNode); } ngDevMode && ngDevMode.dehydratedViewsCleanupRuns++; } } } function cleanupHydratedDeferBlocks(deferBlock, hydratedBlocks, registry, appRef) { if (deferBlock !== null) { registry.cleanup(hydratedBlocks); cleanupLContainer(deferBlock.lContainer); cleanupDehydratedViews(appRef); } } function locateDehydratedViewsInContainer(currentRNode, serializedViews) { const dehydratedViews = []; for (const serializedView of serializedViews) { for (let i = 0; i < (serializedView[MULTIPLIER] ?? 1); i++) { const view = { data: serializedView, firstChild: null }; if (serializedView[NUM_ROOT_NODES] > 0) { view.firstChild = currentRNode; currentRNode = siblingAfter(serializedView[NUM_ROOT_NODES], currentRNode); } dehydratedViews.push(view); } } return [currentRNode, dehydratedViews]; } var _findMatchingDehydratedViewImpl = () => null; var _findAndReconcileMatchingDehydratedViewsImpl = () => null; function enableFindMatchingDehydratedViewImpl() { _findMatchingDehydratedViewImpl = findMatchingDehydratedViewImpl; _findAndReconcileMatchingDehydratedViewsImpl = findAndReconcileMatchingDehydratedViewsImpl; } function findMatchingDehydratedViewImpl(lContainer, template) { if (hasMatchingDehydratedView(lContainer, template)) { return lContainer[DEHYDRATED_VIEWS].shift(); } else { removeDehydratedViews(lContainer); return null; } } function findMatchingDehydratedView(lContainer, template) { return _findMatchingDehydratedViewImpl(lContainer, template); } function findAndReconcileMatchingDehydratedViewsImpl(lContainer, templateTNode, hostLView) { if (templateTNode.tView.ssrId === null) return null; const dehydratedView = findMatchingDehydratedView(lContainer, templateTNode.tView.ssrId); if (hostLView[TVIEW].firstUpdatePass && dehydratedView === null) { removeStaleDehydratedBranch(hostLView, templateTNode); } return dehydratedView; } function findAndReconcileMatchingDehydratedViews(lContainer, templateTNode, hostLView) { return _findAndReconcileMatchingDehydratedViewsImpl(lContainer, templateTNode, hostLView); } function removeStaleDehydratedBranch(hostLView, tNode) { let currentTNode = tNode; while (currentTNode) { if (cleanupMatchingDehydratedViews(hostLView, currentTNode)) return; if ((currentTNode.flags & 256) === 256) { break; } currentTNode = currentTNode.prev; } currentTNode = tNode.next; while (currentTNode) { if ((currentTNode.flags & 512) !== 512) { break; } if (cleanupMatchingDehydratedViews(hostLView, currentTNode)) return; currentTNode = currentTNode.next; } } function hasMatchingDehydratedView(lContainer, template) { const views = lContainer[DEHYDRATED_VIEWS]; if (!template || views === null || views.length === 0) { return false; } return views[0].data[TEMPLATE_ID] === template; } function cleanupMatchingDehydratedViews(hostLView, currentTNode) { const ssrId = currentTNode.tView?.ssrId; if (ssrId == null) return false; const container = hostLView[currentTNode.index]; if (isLContainer(container) && hasMatchingDehydratedView(container, ssrId)) { removeDehydratedViews(container); return true; } return false; } var ComponentRef$1 = class ComponentRef { }; var ComponentFactory$1 = class ComponentFactory { }; var _NullComponentFactoryResolver = class { resolveComponentFactory(component) { throw new RuntimeError(917, typeof ngDevMode !== "undefined" && ngDevMode && `No component factory found for ${stringify(component)}.`); } }; var ComponentFactoryResolver$1 = class ComponentFactoryResolver { static NULL = new _NullComponentFactoryResolver(); }; var RendererFactory2 = class { }; var Renderer2 = class { /** * If null or undefined, the view engine won't call it. * This is used as a performance optimization for production mode. */ destroyNode = null; /** * @internal * @nocollapse */ static __NG_ELEMENT_ID__ = () => injectRenderer2(); }; function injectRenderer2() { const lView = getLView(); const tNode = getCurrentTNode(); const nodeAtIndex = getComponentLViewByIndex(tNode.index, lView); return (isLView(nodeAtIndex) ? nodeAtIndex : lView)[RENDERER]; } var Sanitizer = class _Sanitizer { /** @nocollapse */ static ɵprov = ( /** @pureOrBreakMyCode */ ɵɵdefineInjectable({ token: _Sanitizer, providedIn: "root", factory: () => null }) ); }; function isModuleWithProviders(value) { return value.ngModule !== void 0; } function isNgModule(value) { return !!getNgModuleDef(value); } function isPipe(value) { return !!getPipeDef(value); } function isDirective(value) { return !!getDirectiveDef(value); } function isComponent(value) { return !!getComponentDef(value); } function getDependencyTypeForError(type) { if (getComponentDef(type)) return "component"; if (getDirectiveDef(type)) return "directive"; if (getPipeDef(type)) return "pipe"; return "type"; } function verifyStandaloneImport(depType, importingType) { if (isForwardRef(depType)) { depType = resolveForwardRef(depType); if (!depType) { throw new Error(`Expected forwardRef function, imported from "${stringifyForError(importingType)}", to return a standalone entity or NgModule but got "${stringifyForError(depType) || depType}".`); } } if (getNgModuleDef(depType) == null) { const def = getComponentDef(depType) || getDirectiveDef(depType) || getPipeDef(depType); if (def != null) { if (!def.standalone) { throw new Error(`The "${stringifyForError(depType)}" ${getDependencyTypeForError(depType)}, imported from "${stringifyForError(importingType)}", is not standalone. Did you forget to add the standalone: true flag?`); } } else { if (isModuleWithProviders(depType)) { throw new Error(`A module with providers was imported from "${stringifyForError(importingType)}". Modules with providers are not supported in standalone components imports.`); } else { throw new Error(`The "${stringifyForError(depType)}" type, imported from "${stringifyForError(importingType)}", must be a standalone component / directive / pipe or an NgModule. Did you forget to add the required @Component / @Directive / @Pipe or @NgModule annotation?`); } } } } var DepsTracker = class { ownerNgModule = /* @__PURE__ */ new Map(); ngModulesWithSomeUnresolvedDecls = /* @__PURE__ */ new Set(); ngModulesScopeCache = /* @__PURE__ */ new Map(); standaloneComponentsScopeCache = /* @__PURE__ */ new Map(); /** * Attempts to resolve ng module's forward ref declarations as much as possible and add them to * the `ownerNgModule` map. This method normally should be called after the initial parsing when * all the forward refs are resolved (e.g., when trying to render a component) */ resolveNgModulesDecls() { if (this.ngModulesWithSomeUnresolvedDecls.size === 0) { return; } for (const moduleType of this.ngModulesWithSomeUnresolvedDecls) { const def = getNgModuleDef(moduleType); if (def?.declarations) { for (const decl of maybeUnwrapFn(def.declarations)) { if (isComponent(decl)) { this.ownerNgModule.set(decl, moduleType); } } } } this.ngModulesWithSomeUnresolvedDecls.clear(); } /** @override */ getComponentDependencies(type, rawImports) { this.resolveNgModulesDecls(); const def = getComponentDef(type); if (def === null) { throw new Error(`Attempting to get component dependencies for a type that is not a component: ${type}`); } if (def.standalone) { const scope = this.getStandaloneComponentScope(type, rawImports); if (scope.compilation.isPoisoned) { return { dependencies: [] }; } return { dependencies: [ ...scope.compilation.directives, ...scope.compilation.pipes, ...scope.compilation.ngModules ] }; } else { if (!this.ownerNgModule.has(type)) { return { dependencies: [] }; } const scope = this.getNgModuleScope(this.ownerNgModule.get(type)); if (scope.compilation.isPoisoned) { return { dependencies: [] }; } return { dependencies: [...scope.compilation.directives, ...scope.compilation.pipes] }; } } /** * @override * This implementation does not make use of param scopeInfo since it assumes the scope info is * already added to the type itself through methods like {@link ɵɵsetNgModuleScope} */ registerNgModule(type, scopeInfo) { if (!isNgModule(type)) { throw new Error(`Attempting to register a Type which is not NgModule as NgModule: ${type}`); } this.ngModulesWithSomeUnresolvedDecls.add(type); } /** @override */ clearScopeCacheFor(type) { this.ngModulesScopeCache.delete(type); this.standaloneComponentsScopeCache.delete(type); } /** @override */ getNgModuleScope(type) { if (this.ngModulesScopeCache.has(type)) { return this.ngModulesScopeCache.get(type); } const scope = this.computeNgModuleScope(type); this.ngModulesScopeCache.set(type, scope); return scope; } /** Compute NgModule scope afresh. */ computeNgModuleScope(type) { const def = getNgModuleDefOrThrow(type); const scope = { exported: { directives: /* @__PURE__ */ new Set(), pipes: /* @__PURE__ */ new Set() }, compilation: { directives: /* @__PURE__ */ new Set(), pipes: /* @__PURE__ */ new Set() } }; for (const imported of maybeUnwrapFn(def.imports)) { if (isNgModule(imported)) { const importedScope = this.getNgModuleScope(imported); addSet(importedScope.exported.directives, scope.compilation.directives); addSet(importedScope.exported.pipes, scope.compilation.pipes); } else if (isStandalone(imported)) { if (isDirective(imported) || isComponent(imported)) { scope.compilation.directives.add(imported); } else if (isPipe(imported)) { scope.compilation.pipes.add(imported); } else { throw new RuntimeError(980, "The standalone imported type is neither a component nor a directive nor a pipe"); } } else { scope.compilation.isPoisoned = true; break; } } if (!scope.compilation.isPoisoned) { for (const decl of maybeUnwrapFn(def.declarations)) { if (isNgModule(decl) || isStandalone(decl)) { scope.compilation.isPoisoned = true; break; } if (isPipe(decl)) { scope.compilation.pipes.add(decl); } else { scope.compilation.directives.add(decl); } } } for (const exported of maybeUnwrapFn(def.exports)) { if (isNgModule(exported)) { const exportedScope = this.getNgModuleScope(exported); addSet(exportedScope.exported.directives, scope.exported.directives); addSet(exportedScope.exported.pipes, scope.exported.pipes); addSet(exportedScope.exported.directives, scope.compilation.directives); addSet(exportedScope.exported.pipes, scope.compilation.pipes); } else if (isPipe(exported)) { scope.exported.pipes.add(exported); } else { scope.exported.directives.add(exported); } } return scope; } /** @override */ getStandaloneComponentScope(type, rawImports) { if (this.standaloneComponentsScopeCache.has(type)) { return this.standaloneComponentsScopeCache.get(type); } const ans = this.computeStandaloneComponentScope(type, rawImports); this.standaloneComponentsScopeCache.set(type, ans); return ans; } computeStandaloneComponentScope(type, rawImports) { const ans = { compilation: { // Standalone components are always able to self-reference. directives: /* @__PURE__ */ new Set([type]), pipes: /* @__PURE__ */ new Set(), ngModules: /* @__PURE__ */ new Set() } }; for (const rawImport of flatten(rawImports ?? [])) { const imported = resolveForwardRef(rawImport); try { verifyStandaloneImport(imported, type); } catch (e) { ans.compilation.isPoisoned = true; return ans; } if (isNgModule(imported)) { ans.compilation.ngModules.add(imported); const importedScope = this.getNgModuleScope(imported); if (importedScope.exported.isPoisoned) { ans.compilation.isPoisoned = true; return ans; } addSet(importedScope.exported.directives, ans.compilation.directives); addSet(importedScope.exported.pipes, ans.compilation.pipes); } else if (isPipe(imported)) { ans.compilation.pipes.add(imported); } else if (isDirective(imported) || isComponent(imported)) { ans.compilation.directives.add(imported); } else { ans.compilation.isPoisoned = true; return ans; } } return ans; } /** @override */ isOrphanComponent(cmp) { const def = getComponentDef(cmp); if (!def || def.standalone) { return false; } this.resolveNgModulesDecls(); return !this.ownerNgModule.has(cmp); } }; function addSet(sourceSet, targetSet) { for (const m of sourceSet) { targetSet.add(m); } } var depsTracker = new DepsTracker(); var NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {}; var ChainedInjector = class { injector; parentInjector; constructor(injector, parentInjector) { this.injector = injector; this.parentInjector = parentInjector; } get(token, notFoundValue, options) { const value = this.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, options); if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR || notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) { return value; } return this.parentInjector.get(token, notFoundValue, options); } }; function computeStaticStyling(tNode, attrs, writeToHost) { ngDevMode && assertFirstCreatePass(getTView(), "Expecting to be called in first template pass only"); let styles = writeToHost ? tNode.styles : null; let classes = writeToHost ? tNode.classes : null; let mode = 0; if (attrs !== null) { for (let i = 0; i < attrs.length; i++) { const value = attrs[i]; if (typeof value === "number") { mode = value; } else if (mode == 1) { classes = concatStringsWithSpace(classes, value); } else if (mode == 2) { const style = value; const styleValue = attrs[++i]; styles = concatStringsWithSpace(styles, style + ": " + styleValue + ";"); } } } writeToHost ? tNode.styles = styles : tNode.stylesWithoutHost = styles; writeToHost ? tNode.classes = classes : tNode.classesWithoutHost = classes; } function ɵɵdirectiveInject(token, flags = 0) { const lView = getLView(); if (lView === null) { ngDevMode && assertInjectImplementationNotEqual(ɵɵdirectiveInject); return ɵɵinject(token, flags); } const tNode = getCurrentTNode(); const value = getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags); ngDevMode && emitInjectEvent(token, value, flags); return value; } function ɵɵinvalidFactory() { const msg = ngDevMode ? `This constructor was not compatible with Dependency Injection.` : "invalid"; throw new Error(msg); } function resolveDirectives(tView, lView, tNode, localRefs, directiveMatcher) { ngDevMode && assertFirstCreatePass(tView); const exportsMap = localRefs === null ? null : { "": -1 }; const matchedDirectiveDefs = directiveMatcher(tView, tNode); if (matchedDirectiveDefs !== null) { let directiveDefs = matchedDirectiveDefs; let hostDirectiveDefs = null; let hostDirectiveRanges = null; for (const def of matchedDirectiveDefs) { if (def.resolveHostDirectives !== null) { [directiveDefs, hostDirectiveDefs, hostDirectiveRanges] = def.resolveHostDirectives(matchedDirectiveDefs); break; } } ngDevMode && assertNoDuplicateDirectives(directiveDefs); initializeDirectives(tView, lView, tNode, directiveDefs, exportsMap, hostDirectiveDefs, hostDirectiveRanges); } if (exportsMap !== null && localRefs !== null) { cacheMatchingLocalNames(tNode, localRefs, exportsMap); } } function cacheMatchingLocalNames(tNode, localRefs, exportsMap) { const localNames = tNode.localNames = []; for (let i = 0; i < localRefs.length; i += 2) { const index = exportsMap[localRefs[i + 1]]; if (index == null) throw new RuntimeError(-301, ngDevMode && `Export of name '${localRefs[i + 1]}' not found!`); localNames.push(localRefs[i], index); } } function markAsComponentHost(tView, hostTNode, componentOffset) { ngDevMode && assertFirstCreatePass(tView); ngDevMode && assertGreaterThan(componentOffset, -1, "componentOffset must be great than -1"); hostTNode.componentOffset = componentOffset; (tView.components ??= []).push(hostTNode.index); } function initializeDirectives(tView, lView, tNode, directives, exportsMap, hostDirectiveDefs, hostDirectiveRanges) { ngDevMode && assertFirstCreatePass(tView); const directivesLength = directives.length; let hasSeenComponent = false; for (let i = 0; i < directivesLength; i++) { const def = directives[i]; if (!hasSeenComponent && isComponentDef(def)) { hasSeenComponent = true; markAsComponentHost(tView, tNode, i); } diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, lView), tView, def.type); } initTNodeFlags(tNode, tView.data.length, directivesLength); for (let i = 0; i < directivesLength; i++) { const def = directives[i]; if (def.providersResolver) def.providersResolver(def); } let preOrderHooksFound = false; let preOrderCheckHooksFound = false; let directiveIdx = allocExpando(tView, lView, directivesLength, null); ngDevMode && assertSame(directiveIdx, tNode.directiveStart, "TNode.directiveStart should point to just allocated space"); if (directivesLength > 0) { tNode.directiveToIndex = /* @__PURE__ */ new Map(); } for (let i = 0; i < directivesLength; i++) { const def = directives[i]; tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, def.hostAttrs); configureViewWithDirective(tView, tNode, lView, directiveIdx, def); saveNameToExportMap(directiveIdx, def, exportsMap); if (hostDirectiveRanges !== null && hostDirectiveRanges.has(def)) { const [start, end] = hostDirectiveRanges.get(def); tNode.directiveToIndex.set(def.type, [ directiveIdx, start + tNode.directiveStart, end + tNode.directiveStart ]); } else if (hostDirectiveDefs === null || !hostDirectiveDefs.has(def)) { tNode.directiveToIndex.set(def.type, directiveIdx); } if (def.contentQueries !== null) tNode.flags |= 4; if (def.hostBindings !== null || def.hostAttrs !== null || def.hostVars !== 0) tNode.flags |= 64; const lifeCycleHooks = def.type.prototype; if (!preOrderHooksFound && (lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngOnInit || lifeCycleHooks.ngDoCheck)) { (tView.preOrderHooks ??= []).push(tNode.index); preOrderHooksFound = true; } if (!preOrderCheckHooksFound && (lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngDoCheck)) { (tView.preOrderCheckHooks ??= []).push(tNode.index); preOrderCheckHooksFound = true; } directiveIdx++; } initializeInputAndOutputAliases(tView, tNode, hostDirectiveDefs); } function initializeInputAndOutputAliases(tView, tNode, hostDirectiveDefs) { ngDevMode && assertFirstCreatePass(tView); for (let index = tNode.directiveStart; index < tNode.directiveEnd; index++) { const directiveDef = tView.data[index]; if (hostDirectiveDefs === null || !hostDirectiveDefs.has(directiveDef)) { setupSelectorMatchedInputsOrOutputs(0, tNode, directiveDef, index); setupSelectorMatchedInputsOrOutputs(1, tNode, directiveDef, index); setupInitialInputs(tNode, index, false); } else { const hostDirectiveDef = hostDirectiveDefs.get(directiveDef); setupHostDirectiveInputsOrOutputs(0, tNode, hostDirectiveDef, index); setupHostDirectiveInputsOrOutputs(1, tNode, hostDirectiveDef, index); setupInitialInputs(tNode, index, true); } } } function setupSelectorMatchedInputsOrOutputs(mode, tNode, def, directiveIndex) { const aliasMap = mode === 0 ? def.inputs : def.outputs; for (const publicName in aliasMap) { if (aliasMap.hasOwnProperty(publicName)) { let bindings; if (mode === 0) { bindings = tNode.inputs ??= {}; } else { bindings = tNode.outputs ??= {}; } bindings[publicName] ??= []; bindings[publicName].push(directiveIndex); setShadowStylingInputFlags(tNode, publicName); } } } function setupHostDirectiveInputsOrOutputs(mode, tNode, config, directiveIndex) { const aliasMap = mode === 0 ? config.inputs : config.outputs; for (const initialName in aliasMap) { if (aliasMap.hasOwnProperty(initialName)) { const publicName = aliasMap[initialName]; let bindings; if (mode === 0) { bindings = tNode.hostDirectiveInputs ??= {}; } else { bindings = tNode.hostDirectiveOutputs ??= {}; } bindings[publicName] ??= []; bindings[publicName].push(directiveIndex, initialName); setShadowStylingInputFlags(tNode, publicName); } } } function setShadowStylingInputFlags(tNode, publicName) { if (publicName === "class") { tNode.flags |= 8; } else if (publicName === "style") { tNode.flags |= 16; } } function setupInitialInputs(tNode, directiveIndex, isHostDirective) { const { attrs, inputs, hostDirectiveInputs } = tNode; if (attrs === null || !isHostDirective && inputs === null || isHostDirective && hostDirectiveInputs === null || // Do not use unbound attributes as inputs to structural directives, since structural // directive inputs can only be set using microsyntax (e.g. `
    `). isInlineTemplate(tNode)) { tNode.initialInputs ??= []; tNode.initialInputs.push(null); return; } let inputsToStore = null; let i = 0; while (i < attrs.length) { const attrName = attrs[i]; if (attrName === 0) { i += 4; continue; } else if (attrName === 5) { i += 2; continue; } else if (typeof attrName === "number") { break; } if (!isHostDirective && inputs.hasOwnProperty(attrName)) { const inputConfig = inputs[attrName]; for (const index of inputConfig) { if (index === directiveIndex) { inputsToStore ??= []; inputsToStore.push(attrName, attrs[i + 1]); break; } } } else if (isHostDirective && hostDirectiveInputs.hasOwnProperty(attrName)) { const config = hostDirectiveInputs[attrName]; for (let j = 0; j < config.length; j += 2) { if (config[j] === directiveIndex) { inputsToStore ??= []; inputsToStore.push(config[j + 1], attrs[i + 1]); break; } } } i += 2; } tNode.initialInputs ??= []; tNode.initialInputs.push(inputsToStore); } function configureViewWithDirective(tView, tNode, lView, directiveIndex, def) { ngDevMode && assertGreaterThanOrEqual(directiveIndex, HEADER_OFFSET, "Must be in Expando section"); tView.data[directiveIndex] = def; const directiveFactory = def.factory || (def.factory = getFactoryDef(def.type, true)); const nodeInjectorFactory = new NodeInjectorFactory(directiveFactory, isComponentDef(def), ɵɵdirectiveInject, ngDevMode ? def.type.name : null); tView.blueprint[directiveIndex] = nodeInjectorFactory; lView[directiveIndex] = nodeInjectorFactory; registerHostBindingOpCodes(tView, tNode, directiveIndex, allocExpando(tView, lView, def.hostVars, NO_CHANGE), def); } function registerHostBindingOpCodes(tView, tNode, directiveIdx, directiveVarsIdx, def) { ngDevMode && assertFirstCreatePass(tView); const hostBindings = def.hostBindings; if (hostBindings) { let hostBindingOpCodes = tView.hostBindingOpCodes; if (hostBindingOpCodes === null) { hostBindingOpCodes = tView.hostBindingOpCodes = []; } const elementIndx = ~tNode.index; if (lastSelectedElementIdx(hostBindingOpCodes) != elementIndx) { hostBindingOpCodes.push(elementIndx); } hostBindingOpCodes.push(directiveIdx, directiveVarsIdx, hostBindings); } } function lastSelectedElementIdx(hostBindingOpCodes) { let i = hostBindingOpCodes.length; while (i > 0) { const value = hostBindingOpCodes[--i]; if (typeof value === "number" && value < 0) { return value; } } return 0; } function saveNameToExportMap(directiveIdx, def, exportsMap) { if (exportsMap) { if (def.exportAs) { for (let i = 0; i < def.exportAs.length; i++) { exportsMap[def.exportAs[i]] = directiveIdx; } } if (isComponentDef(def)) exportsMap[""] = directiveIdx; } } function initTNodeFlags(tNode, index, numberOfDirectives) { ngDevMode && assertNotEqual(numberOfDirectives, tNode.directiveEnd - tNode.directiveStart, "Reached the max number of directives"); tNode.flags |= 1; tNode.directiveStart = index; tNode.directiveEnd = index + numberOfDirectives; tNode.providerIndexes = index; } function assertNoDuplicateDirectives(directives) { if (directives.length < 2) { return; } const seenDirectives = /* @__PURE__ */ new Set(); for (const current of directives) { if (seenDirectives.has(current)) { throw new RuntimeError(309, `Directive ${current.type.name} matches multiple times on the same element. Directives can only match an element once.`); } seenDirectives.add(current); } } function directiveHostFirstCreatePass(index, lView, type, name, directiveMatcher, bindingsEnabled, attrsIndex, localRefsIndex) { const tView = lView[TVIEW]; ngDevMode && assertFirstCreatePass(tView); const tViewConsts = tView.consts; const attrs = getConstant(tViewConsts, attrsIndex); const tNode = getOrCreateTNode(tView, index, type, name, attrs); if (bindingsEnabled) { resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex), directiveMatcher); } tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, tNode.attrs); if (tNode.attrs !== null) { computeStaticStyling(tNode, tNode.attrs, false); } if (tNode.mergedAttrs !== null) { computeStaticStyling(tNode, tNode.mergedAttrs, true); } if (tView.queries !== null) { tView.queries.elementStart(tView, tNode); } return tNode; } function directiveHostEndFirstCreatePass(tView, tNode) { ngDevMode && assertFirstCreatePass(tView); registerPostOrderHooks(tView, tNode); if (isContentQueryHost(tNode)) { tView.queries.elementEnd(tNode); } } function domOnlyFirstCreatePass(index, tView, type, name, attrsIndex, localRefsIndex) { ngDevMode && assertFirstCreatePass(tView); const tViewConsts = tView.consts; const attrs = getConstant(tViewConsts, attrsIndex); const tNode = getOrCreateTNode(tView, index, type, name, attrs); tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, tNode.attrs); if (localRefsIndex != null) { const refs = getConstant(tViewConsts, localRefsIndex); tNode.localNames = []; for (let i = 0; i < refs.length; i += 2) { tNode.localNames.push(refs[i], -1); } } if (tNode.attrs !== null) { computeStaticStyling(tNode, tNode.attrs, false); } if (tNode.mergedAttrs !== null) { computeStaticStyling(tNode, tNode.mergedAttrs, true); } if (tView.queries !== null) { tView.queries.elementStart(tView, tNode); } return tNode; } function isListLikeIterable(obj) { if (!isJsObject(obj)) return false; return Array.isArray(obj) || !(obj instanceof Map) && // JS Map are iterables but return entries as [k, v] Symbol.iterator in obj; } function areIterablesEqual(a, b, comparator) { const iterator1 = a[Symbol.iterator](); const iterator2 = b[Symbol.iterator](); while (true) { const item1 = iterator1.next(); const item2 = iterator2.next(); if (item1.done && item2.done) return true; if (item1.done || item2.done) return false; if (!comparator(item1.value, item2.value)) return false; } } function iterateListLike(obj, fn) { if (Array.isArray(obj)) { for (let i = 0; i < obj.length; i++) { fn(obj[i]); } } else { const iterator = obj[Symbol.iterator](); let item; while (!(item = iterator.next()).done) { fn(item.value); } } } function isJsObject(o) { return o !== null && (typeof o === "function" || typeof o === "object"); } function devModeEqual(a, b) { const isListLikeIterableA = isListLikeIterable(a); const isListLikeIterableB = isListLikeIterable(b); if (isListLikeIterableA && isListLikeIterableB) { return areIterablesEqual(a, b, devModeEqual); } else { const isAObject = a && (typeof a === "object" || typeof a === "function"); const isBObject = b && (typeof b === "object" || typeof b === "function"); if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) { return true; } else { return Object.is(a, b); } } } function updateBinding(lView, bindingIndex, value) { return lView[bindingIndex] = value; } function getBinding(lView, bindingIndex) { ngDevMode && assertIndexInRange(lView, bindingIndex); ngDevMode && assertNotSame(lView[bindingIndex], NO_CHANGE, "Stored value should never be NO_CHANGE."); return lView[bindingIndex]; } function bindingUpdated(lView, bindingIndex, value) { ngDevMode && assertLessThan(bindingIndex, lView.length, `Slot should have been initialized to NO_CHANGE`); if (value === NO_CHANGE) { return false; } const oldValue = lView[bindingIndex]; if (Object.is(oldValue, value)) { return false; } else { if (ngDevMode && isInCheckNoChangesMode()) { const oldValueToCompare = oldValue !== NO_CHANGE ? oldValue : void 0; if (!devModeEqual(oldValueToCompare, value)) { const details = getExpressionChangedErrorDetails(lView, bindingIndex, oldValueToCompare, value); throwErrorIfNoChangesMode(oldValue === NO_CHANGE, details.oldValue, details.newValue, details.propName, lView); } return false; } lView[bindingIndex] = value; return true; } } function bindingUpdated2(lView, bindingIndex, exp1, exp2) { const different = bindingUpdated(lView, bindingIndex, exp1); return bindingUpdated(lView, bindingIndex + 1, exp2) || different; } function bindingUpdated3(lView, bindingIndex, exp1, exp2, exp3) { const different = bindingUpdated2(lView, bindingIndex, exp1, exp2); return bindingUpdated(lView, bindingIndex + 2, exp3) || different; } function bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4) { const different = bindingUpdated2(lView, bindingIndex, exp1, exp2); return bindingUpdated2(lView, bindingIndex + 2, exp3, exp4) || different; } function wrapListener(tNode, lView, listenerFn) { return function wrapListenerIn_markDirtyAndPreventDefault(event) { const startView = isComponentHost(tNode) ? getComponentLViewByIndex(tNode.index, lView) : lView; markViewDirty( startView, 5 /* NotificationSource.Listener */ ); const context = lView[CONTEXT]; let result = executeListenerWithErrorHandling(lView, context, listenerFn, event); let nextListenerFn = wrapListenerIn_markDirtyAndPreventDefault.__ngNextListenerFn__; while (nextListenerFn) { result = executeListenerWithErrorHandling(lView, context, nextListenerFn, event) && result; nextListenerFn = nextListenerFn.__ngNextListenerFn__; } return result; }; } function executeListenerWithErrorHandling(lView, context, listenerFn, e) { const prevConsumer = setActiveConsumer(null); try { profiler(6, context, listenerFn); return listenerFn(e) !== false; } catch (error) { handleUncaughtError(lView, error); return false; } finally { profiler(7, context, listenerFn); setActiveConsumer(prevConsumer); } } function listenToDomEvent(tNode, tView, lView, eventTargetResolver, renderer, eventName, originalListener, wrappedListener) { ngDevMode && assertNotSame(wrappedListener, originalListener, "Expected wrapped and original listeners to be different."); const isTNodeDirectiveHost = isDirectiveHost(tNode); let hasCoalesced = false; let existingListener = null; if (!eventTargetResolver && isTNodeDirectiveHost) { existingListener = findExistingListener(tView, lView, eventName, tNode.index); } if (existingListener !== null) { const lastListenerFn = existingListener.__ngLastListenerFn__ || existingListener; lastListenerFn.__ngNextListenerFn__ = originalListener; existingListener.__ngLastListenerFn__ = originalListener; hasCoalesced = true; } else { const native = getNativeByTNode(tNode, lView); const target = eventTargetResolver ? eventTargetResolver(native) : native; stashEventListenerImpl(lView, target, eventName, wrappedListener); const cleanupFn = renderer.listen(target, eventName, wrappedListener); const idxOrTargetGetter = eventTargetResolver ? (_lView) => eventTargetResolver(unwrapRNode(_lView[tNode.index])) : tNode.index; storeListenerCleanup(idxOrTargetGetter, tView, lView, eventName, wrappedListener, cleanupFn, false); } return hasCoalesced; } function findExistingListener(tView, lView, eventName, tNodeIndex) { const tCleanup = tView.cleanup; if (tCleanup != null) { for (let i = 0; i < tCleanup.length - 1; i += 2) { const cleanupEventName = tCleanup[i]; if (cleanupEventName === eventName && tCleanup[i + 1] === tNodeIndex) { const lCleanup = lView[CLEANUP]; const listenerIdxInLCleanup = tCleanup[i + 2]; return lCleanup && lCleanup.length > listenerIdxInLCleanup ? lCleanup[listenerIdxInLCleanup] : null; } if (typeof cleanupEventName === "string") { i += 2; } } } return null; } function storeListenerCleanup(indexOrTargetGetter, tView, lView, eventName, listenerFn, cleanup, isOutput) { const tCleanup = tView.firstCreatePass ? getOrCreateTViewCleanup(tView) : null; const lCleanup = getOrCreateLViewCleanup(lView); const index = lCleanup.length; lCleanup.push(listenerFn, cleanup); tCleanup && tCleanup.push(eventName, indexOrTargetGetter, index, (index + 1) * (isOutput ? -1 : 1)); } function createOutputListener(tNode, lView, listenerFn, targetDef, eventName) { const wrappedListener = wrapListener(tNode, lView, listenerFn); const hasBound = listenToDirectiveOutput(tNode, lView, targetDef, eventName, wrappedListener); if (!hasBound && ngDevMode) { throw new RuntimeError(316, `${stringifyForError(targetDef.type)} does not have an output with a public name of "${eventName}".`); } } function listenToDirectiveOutput(tNode, lView, target, eventName, listenerFn) { let hostIndex = null; let hostDirectivesStart = null; let hostDirectivesEnd = null; let hasOutput = false; if (ngDevMode && !tNode.directiveToIndex?.has(target.type)) { throw new Error(`Node does not have a directive with type ${target.type.name}`); } const data = tNode.directiveToIndex.get(target.type); if (typeof data === "number") { hostIndex = data; } else { [hostIndex, hostDirectivesStart, hostDirectivesEnd] = data; } if (hostDirectivesStart !== null && hostDirectivesEnd !== null && tNode.hostDirectiveOutputs?.hasOwnProperty(eventName)) { const hostDirectiveOutputs = tNode.hostDirectiveOutputs[eventName]; for (let i = 0; i < hostDirectiveOutputs.length; i += 2) { const index = hostDirectiveOutputs[i]; if (index >= hostDirectivesStart && index <= hostDirectivesEnd) { ngDevMode && assertIndexInRange(lView, index); hasOutput = true; listenToOutput(tNode, lView, index, hostDirectiveOutputs[i + 1], eventName, listenerFn); } else if (index > hostDirectivesEnd) { break; } } } if (target.outputs.hasOwnProperty(eventName)) { ngDevMode && assertIndexInRange(lView, hostIndex); hasOutput = true; listenToOutput(tNode, lView, hostIndex, eventName, eventName, listenerFn); } return hasOutput; } function listenToOutput(tNode, lView, directiveIndex, lookupName, eventName, listenerFn) { ngDevMode && assertIndexInRange(lView, directiveIndex); const instance = lView[directiveIndex]; const tView = lView[TVIEW]; const def = tView.data[directiveIndex]; const propertyName = def.outputs[lookupName]; const output2 = instance[propertyName]; if (ngDevMode && !isOutputSubscribable(output2)) { throw new Error(`@Output ${propertyName} not initialized in '${instance.constructor.name}'.`); } const subscription = output2.subscribe(listenerFn); storeListenerCleanup(tNode.index, tView, lView, eventName, listenerFn, subscription, true); } function isOutputSubscribable(value) { return value != null && typeof value.subscribe === "function"; } var BINDING = Symbol("BINDING"); var INPUT_BINDING_METADATA = { kind: "input", requiredVars: 1 }; var OUTPUT_BINDING_METADATA = { kind: "output", requiredVars: 0 }; function inputBindingUpdate(targetDirectiveIdx, publicName, value) { const lView = getLView(); const bindingIndex = nextBindingIndex(); if (bindingUpdated(lView, bindingIndex, value)) { const tView = lView[TVIEW]; const tNode = getSelectedTNode(); const componentLView = getComponentLViewByIndex(tNode.index, lView); markViewDirty( componentLView, 1 /* NotificationSource.SetInput */ ); const targetDef = tView.directiveRegistry[targetDirectiveIdx]; if (ngDevMode && !targetDef) { throw new RuntimeError(315, `Input binding to property "${publicName}" does not have a target.`); } const hasSet = setDirectiveInput(tNode, tView, lView, targetDef, publicName, value); if (ngDevMode) { if (!hasSet) { throw new RuntimeError(315, `${stringifyForError(targetDef.type)} does not have an input with a public name of "${publicName}".`); } storePropertyBindingMetadata(tView.data, tNode, publicName, bindingIndex); } } } function inputBinding(publicName, value) { const binding = { [BINDING]: INPUT_BINDING_METADATA, update: () => inputBindingUpdate(binding.targetIdx, publicName, value()) }; return binding; } function outputBinding(eventName, listener) { const binding = { [BINDING]: OUTPUT_BINDING_METADATA, create: () => { const lView = getLView(); const tNode = getCurrentTNode(); const tView = lView[TVIEW]; const targetDef = tView.directiveRegistry[binding.targetIdx]; createOutputListener(tNode, lView, listener, targetDef, eventName); } }; return binding; } function twoWayBinding(publicName, value) { const input2 = inputBinding(publicName, value); const output2 = outputBinding(publicName + "Change", (eventValue) => value.set(eventValue)); ngDevMode && assertNotDefined(input2.create, "Unexpected `create` callback in inputBinding"); ngDevMode && assertNotDefined(output2.update, "Unexpected `update` callback in outputBinding"); const binding = { [BINDING]: { kind: "twoWay", requiredVars: input2[BINDING].requiredVars + output2[BINDING].requiredVars }, set targetIdx(idx) { input2.targetIdx = idx; output2.targetIdx = idx; }, create: output2.create, update: input2.update }; return binding; } var ComponentFactoryResolver2 = class extends ComponentFactoryResolver$1 { ngModule; /** * @param ngModule The NgModuleRef to which all resolved factories are bound. */ constructor(ngModule) { super(); this.ngModule = ngModule; } resolveComponentFactory(component) { ngDevMode && assertComponentType(component); const componentDef = getComponentDef(component); return new ComponentFactory2(componentDef, this.ngModule); } }; function toInputRefArray(map2) { return Object.keys(map2).map((name) => { const [propName, flags, transform] = map2[name]; const inputData = { propName, templateName: name, isSignal: (flags & InputFlags.SignalBased) !== 0 }; if (transform) { inputData.transform = transform; } return inputData; }); } function toOutputRefArray(map2) { return Object.keys(map2).map((name) => ({ propName: map2[name], templateName: name })); } function verifyNotAnOrphanComponent(componentDef) { if (false) { if (depsTracker.isOrphanComponent(componentDef.type)) { throw new RuntimeError(981, `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.`); } } } function createRootViewInjector(componentDef, environmentInjector, injector) { let realEnvironmentInjector = environmentInjector instanceof EnvironmentInjector ? environmentInjector : environmentInjector?.injector; if (realEnvironmentInjector && componentDef.getStandaloneInjector !== null) { realEnvironmentInjector = componentDef.getStandaloneInjector(realEnvironmentInjector) || realEnvironmentInjector; } const rootViewInjector = realEnvironmentInjector ? new ChainedInjector(injector, realEnvironmentInjector) : injector; return rootViewInjector; } function createRootLViewEnvironment(rootLViewInjector) { const rendererFactory = rootLViewInjector.get(RendererFactory2, null); if (rendererFactory === null) { throw new RuntimeError(407, ngDevMode && "Angular was not able to inject a renderer (RendererFactory2). Likely this is due to a broken DI hierarchy. Make sure that any injector used to create this component has a correct parent."); } const sanitizer = rootLViewInjector.get(Sanitizer, null); const changeDetectionScheduler = rootLViewInjector.get(ChangeDetectionScheduler, null); let ngReflect = false; if (typeof ngDevMode === "undefined" || ngDevMode) { ngReflect = rootLViewInjector.get(NG_REFLECT_ATTRS_FLAG, NG_REFLECT_ATTRS_FLAG_DEFAULT); } return { rendererFactory, sanitizer, changeDetectionScheduler, ngReflect }; } function createHostElement(componentDef, renderer) { const tagName = inferTagNameFromDefinition(componentDef); const namespace = tagName === "svg" ? SVG_NAMESPACE : tagName === "math" ? MATH_ML_NAMESPACE : null; return createElementNode(renderer, tagName, namespace); } function inferTagNameFromDefinition(componentDef) { return (componentDef.selectors[0][0] || "div").toLowerCase(); } var ComponentFactory2 = class extends ComponentFactory$1 { componentDef; ngModule; selector; componentType; ngContentSelectors; isBoundToModule; cachedInputs = null; cachedOutputs = null; get inputs() { this.cachedInputs ??= toInputRefArray(this.componentDef.inputs); return this.cachedInputs; } get outputs() { this.cachedOutputs ??= toOutputRefArray(this.componentDef.outputs); return this.cachedOutputs; } /** * @param componentDef The component definition. * @param ngModule The NgModuleRef to which the factory is bound. */ constructor(componentDef, ngModule) { super(); this.componentDef = componentDef; this.ngModule = ngModule; this.componentType = componentDef.type; this.selector = stringifyCSSSelectorList(componentDef.selectors); this.ngContentSelectors = componentDef.ngContentSelectors ?? []; this.isBoundToModule = !!ngModule; } create(injector, projectableNodes, rootSelectorOrNode, environmentInjector, directives, componentBindings) { profiler( 22 /* ProfilerEvent.DynamicComponentStart */ ); const prevConsumer = setActiveConsumer(null); try { const cmpDef = this.componentDef; ngDevMode && verifyNotAnOrphanComponent(cmpDef); const rootTView = createRootTView(rootSelectorOrNode, cmpDef, componentBindings, directives); const rootViewInjector = createRootViewInjector(cmpDef, environmentInjector || this.ngModule, injector); const environment = createRootLViewEnvironment(rootViewInjector); const hostRenderer = environment.rendererFactory.createRenderer(null, cmpDef); const hostElement = rootSelectorOrNode ? locateHostElement(hostRenderer, rootSelectorOrNode, cmpDef.encapsulation, rootViewInjector) : createHostElement(cmpDef, hostRenderer); const hasInputBindings = componentBindings?.some(isInputBinding) || directives?.some((d) => typeof d !== "function" && d.bindings.some(isInputBinding)); const rootLView = createLView(null, rootTView, null, 512 | getInitialLViewFlagsFromDef(cmpDef), null, null, environment, hostRenderer, rootViewInjector, null, retrieveHydrationInfo( hostElement, rootViewInjector, true /* isRootView */ )); rootLView[HEADER_OFFSET] = hostElement; enterView(rootLView); let componentView = null; try { const hostTNode = directiveHostFirstCreatePass(HEADER_OFFSET, rootLView, 2, "#host", () => rootTView.directiveRegistry, true, 0); if (hostElement) { setupStaticAttributes(hostRenderer, hostElement, hostTNode); attachPatchData(hostElement, rootLView); } createDirectivesInstances(rootTView, rootLView, hostTNode); executeContentQueries(rootTView, hostTNode, rootLView); directiveHostEndFirstCreatePass(rootTView, hostTNode); if (projectableNodes !== void 0) { projectNodes(hostTNode, this.ngContentSelectors, projectableNodes); } componentView = getComponentLViewByIndex(hostTNode.index, rootLView); rootLView[CONTEXT] = componentView[CONTEXT]; renderView(rootTView, rootLView, null); } catch (e) { if (componentView !== null) { unregisterLView(componentView); } unregisterLView(rootLView); throw e; } finally { profiler( 23 /* ProfilerEvent.DynamicComponentEnd */ ); leaveView(); } return new ComponentRef2(this.componentType, rootLView, !!hasInputBindings); } finally { setActiveConsumer(prevConsumer); } } }; function createRootTView(rootSelectorOrNode, componentDef, componentBindings, directives) { const tAttributes = rootSelectorOrNode ? ["ng-version", "20.2.4"] : ( // Extract attributes and classes from the first selector only to match VE behavior. extractAttrsAndClassesFromSelector(componentDef.selectors[0]) ); let creationBindings = null; let updateBindings = null; let varsToAllocate = 0; if (componentBindings) { for (const binding of componentBindings) { varsToAllocate += binding[BINDING].requiredVars; if (binding.create) { binding.targetIdx = 0; (creationBindings ??= []).push(binding); } if (binding.update) { binding.targetIdx = 0; (updateBindings ??= []).push(binding); } } } if (directives) { for (let i = 0; i < directives.length; i++) { const directive = directives[i]; if (typeof directive !== "function") { for (const binding of directive.bindings) { varsToAllocate += binding[BINDING].requiredVars; const targetDirectiveIdx = i + 1; if (binding.create) { binding.targetIdx = targetDirectiveIdx; (creationBindings ??= []).push(binding); } if (binding.update) { binding.targetIdx = targetDirectiveIdx; (updateBindings ??= []).push(binding); } } } } } const directivesToApply = [componentDef]; if (directives) { for (const directive of directives) { const directiveType = typeof directive === "function" ? directive : directive.type; const directiveDef = ngDevMode ? getDirectiveDefOrThrow(directiveType) : getDirectiveDef(directiveType); if (ngDevMode && !directiveDef.standalone) { throw new RuntimeError(907, `The ${stringifyForError(directiveType)} directive must be standalone in order to be applied to a dynamically-created component.`); } directivesToApply.push(directiveDef); } } const rootTView = createTView(0, null, getRootTViewTemplate(creationBindings, updateBindings), 1, varsToAllocate, directivesToApply, null, null, null, [tAttributes], null); return rootTView; } function getRootTViewTemplate(creationBindings, updateBindings) { if (!creationBindings && !updateBindings) { return null; } return (flags) => { if (flags & 1 && creationBindings) { for (const binding of creationBindings) { binding.create(); } } if (flags & 2 && updateBindings) { for (const binding of updateBindings) { binding.update(); } } }; } function isInputBinding(binding) { const kind = binding[BINDING].kind; return kind === "input" || kind === "twoWay"; } var ComponentRef2 = class extends ComponentRef$1 { _rootLView; _hasInputBindings; instance; hostView; changeDetectorRef; componentType; location; previousInputValues = null; _tNode; constructor(componentType, _rootLView, _hasInputBindings) { super(); this._rootLView = _rootLView; this._hasInputBindings = _hasInputBindings; this._tNode = getTNode(_rootLView[TVIEW], HEADER_OFFSET); this.location = createElementRef(this._tNode, _rootLView); this.instance = getComponentLViewByIndex(this._tNode.index, _rootLView)[CONTEXT]; this.hostView = this.changeDetectorRef = new ViewRef( _rootLView, void 0 /* _cdRefInjectingView */ ); this.componentType = componentType; } setInput(name, value) { if (this._hasInputBindings && ngDevMode) { throw new RuntimeError(317, "Cannot call `setInput` on a component that is using the `inputBinding` or `twoWayBinding` functions."); } const tNode = this._tNode; this.previousInputValues ??= /* @__PURE__ */ new Map(); if (this.previousInputValues.has(name) && Object.is(this.previousInputValues.get(name), value)) { return; } const lView = this._rootLView; const hasSetInput = setAllInputsForProperty(tNode, lView[TVIEW], lView, name, value); this.previousInputValues.set(name, value); const childComponentLView = getComponentLViewByIndex(tNode.index, lView); markViewDirty( childComponentLView, 1 /* NotificationSource.SetInput */ ); if (ngDevMode && !hasSetInput) { const cmpNameForError = stringifyForError(this.componentType); let message = `Can't set value of the '${name}' input on the '${cmpNameForError}' component. `; message += `Make sure that the '${name}' property is declared as an input using the input() or model() function or the @Input() decorator.`; reportUnknownPropertyError(message); } } get injector() { return new NodeInjector(this._tNode, this._rootLView); } destroy() { this.hostView.destroy(); } onDestroy(callback) { this.hostView.onDestroy(callback); } }; function projectNodes(tNode, ngContentSelectors, projectableNodes) { const projection = tNode.projection = []; for (let i = 0; i < ngContentSelectors.length; i++) { const nodesforSlot = projectableNodes[i]; projection.push(nodesforSlot != null && nodesforSlot.length ? Array.from(nodesforSlot) : null); } } var ViewContainerRef = class { /** * @internal * @nocollapse */ static __NG_ELEMENT_ID__ = injectViewContainerRef; }; function injectViewContainerRef() { const previousTNode = getCurrentTNode(); return createContainerRef(previousTNode, getLView()); } var VE_ViewContainerRef = ViewContainerRef; var R3ViewContainerRef = class ViewContainerRef2 extends VE_ViewContainerRef { _lContainer; _hostTNode; _hostLView; constructor(_lContainer, _hostTNode, _hostLView) { super(); this._lContainer = _lContainer; this._hostTNode = _hostTNode; this._hostLView = _hostLView; } get element() { return createElementRef(this._hostTNode, this._hostLView); } get injector() { return new NodeInjector(this._hostTNode, this._hostLView); } /** @deprecated No replacement */ get parentInjector() { const parentLocation = getParentInjectorLocation(this._hostTNode, this._hostLView); if (hasParentInjector(parentLocation)) { const parentView = getParentInjectorView(parentLocation, this._hostLView); const injectorIndex = getParentInjectorIndex(parentLocation); ngDevMode && assertNodeInjector(parentView, injectorIndex); const parentTNode = parentView[TVIEW].data[ injectorIndex + 8 /* NodeInjectorOffset.TNODE */ ]; return new NodeInjector(parentTNode, parentView); } else { return new NodeInjector(null, this._hostLView); } } clear() { while (this.length > 0) { this.remove(this.length - 1); } } get(index) { const viewRefs = getViewRefs(this._lContainer); return viewRefs !== null && viewRefs[index] || null; } get length() { return this._lContainer.length - CONTAINER_HEADER_OFFSET; } createEmbeddedView(templateRef, context, indexOrOptions) { let index; let injector; if (typeof indexOrOptions === "number") { index = indexOrOptions; } else if (indexOrOptions != null) { index = indexOrOptions.index; injector = indexOrOptions.injector; } const dehydratedView = findMatchingDehydratedView(this._lContainer, templateRef.ssrId); const viewRef = templateRef.createEmbeddedViewImpl(context || {}, injector, dehydratedView); this.insertImpl(viewRef, index, shouldAddViewToDom(this._hostTNode, dehydratedView)); return viewRef; } createComponent(componentFactoryOrType, indexOrOptions, injector, projectableNodes, environmentInjector, directives, bindings) { const isComponentFactory = componentFactoryOrType && !isType(componentFactoryOrType); let index; if (isComponentFactory) { if (ngDevMode) { assertEqual(typeof indexOrOptions !== "object", true, "It looks like Component factory was provided as the first argument and an options object as the second argument. This combination of arguments is incompatible. You can either change the first argument to provide Component type or change the second argument to be a number (representing an index at which to insert the new component's host view into this container)"); } index = indexOrOptions; } else { if (ngDevMode) { assertDefined(getComponentDef(componentFactoryOrType), `Provided Component class doesn't contain Component definition. Please check whether provided class has @Component decorator.`); assertEqual(typeof indexOrOptions !== "number", true, "It looks like Component type was provided as the first argument and a number (representing an index at which to insert the new component's host view into this container as the second argument. This combination of arguments is incompatible. Please use an object as the second argument instead."); } const options = indexOrOptions || {}; if (ngDevMode && options.environmentInjector && options.ngModuleRef) { throwError(`Cannot pass both environmentInjector and ngModuleRef options to createComponent().`); } index = options.index; injector = options.injector; projectableNodes = options.projectableNodes; environmentInjector = options.environmentInjector || options.ngModuleRef; directives = options.directives; bindings = options.bindings; } const componentFactory = isComponentFactory ? componentFactoryOrType : new ComponentFactory2(getComponentDef(componentFactoryOrType)); const contextInjector = injector || this.parentInjector; if (!environmentInjector && componentFactory.ngModule == null) { const _injector = isComponentFactory ? contextInjector : this.parentInjector; const result = _injector.get(EnvironmentInjector, null); if (result) { environmentInjector = result; } } const componentDef = getComponentDef(componentFactory.componentType ?? {}); const dehydratedView = findMatchingDehydratedView(this._lContainer, componentDef?.id ?? null); const rNode = dehydratedView?.firstChild ?? null; const componentRef = componentFactory.create(contextInjector, projectableNodes, rNode, environmentInjector, directives, bindings); this.insertImpl(componentRef.hostView, index, shouldAddViewToDom(this._hostTNode, dehydratedView)); return componentRef; } insert(viewRef, index) { return this.insertImpl(viewRef, index, true); } insertImpl(viewRef, index, addToDOM) { const lView = viewRef._lView; if (ngDevMode && viewRef.destroyed) { throw new Error("Cannot insert a destroyed View in a ViewContainer!"); } if (viewAttachedToContainer(lView)) { const prevIdx = this.indexOf(viewRef); if (prevIdx !== -1) { this.detach(prevIdx); } else { const prevLContainer = lView[PARENT]; ngDevMode && assertEqual(isLContainer(prevLContainer), true, "An attached view should have its PARENT point to a container."); const prevVCRef = new R3ViewContainerRef(prevLContainer, prevLContainer[T_HOST], prevLContainer[PARENT]); prevVCRef.detach(prevVCRef.indexOf(viewRef)); } } const adjustedIdx = this._adjustIndex(index); const lContainer = this._lContainer; addLViewToLContainer(lContainer, lView, adjustedIdx, addToDOM); viewRef.attachToViewContainerRef(); addToArray(getOrCreateViewRefs(lContainer), adjustedIdx, viewRef); return viewRef; } move(viewRef, newIndex) { if (ngDevMode && viewRef.destroyed) { throw new Error("Cannot move a destroyed View in a ViewContainer!"); } return this.insert(viewRef, newIndex); } indexOf(viewRef) { const viewRefsArr = getViewRefs(this._lContainer); return viewRefsArr !== null ? viewRefsArr.indexOf(viewRef) : -1; } remove(index) { const adjustedIdx = this._adjustIndex(index, -1); const detachedView = detachView(this._lContainer, adjustedIdx); if (detachedView) { removeFromArray(getOrCreateViewRefs(this._lContainer), adjustedIdx); destroyLView(detachedView[TVIEW], detachedView); } } detach(index) { const adjustedIdx = this._adjustIndex(index, -1); const view = detachView(this._lContainer, adjustedIdx); const wasDetached = view && removeFromArray(getOrCreateViewRefs(this._lContainer), adjustedIdx) != null; return wasDetached ? new ViewRef(view) : null; } _adjustIndex(index, shift = 0) { if (index == null) { return this.length + shift; } if (ngDevMode) { assertGreaterThan(index, -1, `ViewRef index must be positive, got ${index}`); assertLessThan(index, this.length + 1 + shift, "index"); } return index; } }; function getViewRefs(lContainer) { return lContainer[VIEW_REFS]; } function getOrCreateViewRefs(lContainer) { return lContainer[VIEW_REFS] || (lContainer[VIEW_REFS] = []); } function createContainerRef(hostTNode, hostLView) { ngDevMode && assertTNodeType( hostTNode, 12 | 3 /* TNodeType.AnyRNode */ ); let lContainer; const slotValue = hostLView[hostTNode.index]; if (isLContainer(slotValue)) { lContainer = slotValue; } else { lContainer = createLContainer(slotValue, hostLView, null, hostTNode); hostLView[hostTNode.index] = lContainer; addToEndOfViewTree(hostLView, lContainer); } _locateOrCreateAnchorNode(lContainer, hostLView, hostTNode, slotValue); return new R3ViewContainerRef(lContainer, hostTNode, hostLView); } function insertAnchorNode(hostLView, hostTNode) { const renderer = hostLView[RENDERER]; const commentNode = renderer.createComment(ngDevMode ? "container" : ""); const hostNative = getNativeByTNode(hostTNode, hostLView); const parentOfHostNative = renderer.parentNode(hostNative); nativeInsertBefore(renderer, parentOfHostNative, commentNode, renderer.nextSibling(hostNative), false); return commentNode; } var _locateOrCreateAnchorNode = createAnchorNode; var _populateDehydratedViewsInLContainer = () => false; function populateDehydratedViewsInLContainer(lContainer, tNode, hostLView) { return _populateDehydratedViewsInLContainer(lContainer, tNode, hostLView); } function createAnchorNode(lContainer, hostLView, hostTNode, slotValue) { if (lContainer[NATIVE]) return; let commentNode; if (hostTNode.type & 8) { commentNode = unwrapRNode(slotValue); } else { commentNode = insertAnchorNode(hostLView, hostTNode); } lContainer[NATIVE] = commentNode; } function populateDehydratedViewsInLContainerImpl(lContainer, tNode, hostLView) { if (lContainer[NATIVE] && lContainer[DEHYDRATED_VIEWS]) { return true; } const hydrationInfo = hostLView[HYDRATION]; const noOffsetIndex = tNode.index - HEADER_OFFSET; const isNodeCreationMode = !hydrationInfo || isInSkipHydrationBlock2(tNode) || isDisconnectedNode$1(hydrationInfo, noOffsetIndex); if (isNodeCreationMode) { return false; } const currentRNode = getSegmentHead(hydrationInfo, noOffsetIndex); const serializedViews = hydrationInfo.data[CONTAINERS]?.[noOffsetIndex]; ngDevMode && assertDefined(serializedViews, "Unexpected state: no hydration info available for a given TNode, which represents a view container."); const [commentNode, dehydratedViews] = locateDehydratedViewsInContainer(currentRNode, serializedViews); if (ngDevMode) { validateMatchingNode(commentNode, Node.COMMENT_NODE, null, hostLView, tNode, true); markRNodeAsClaimedByHydration(commentNode, false); } lContainer[NATIVE] = commentNode; lContainer[DEHYDRATED_VIEWS] = dehydratedViews; return true; } function locateOrCreateAnchorNode(lContainer, hostLView, hostTNode, slotValue) { if (!_populateDehydratedViewsInLContainer(lContainer, hostTNode, hostLView)) { createAnchorNode(lContainer, hostLView, hostTNode, slotValue); } } function enableLocateOrCreateContainerRefImpl() { _locateOrCreateAnchorNode = locateOrCreateAnchorNode; _populateDehydratedViewsInLContainer = populateDehydratedViewsInLContainerImpl; } var LQuery_ = class _LQuery_ { queryList; matches = null; constructor(queryList) { this.queryList = queryList; } clone() { return new _LQuery_(this.queryList); } setDirty() { this.queryList.setDirty(); } }; var LQueries_ = class _LQueries_ { queries; constructor(queries = []) { this.queries = queries; } createEmbeddedView(tView) { const tQueries = tView.queries; if (tQueries !== null) { const noOfInheritedQueries = tView.contentQueries !== null ? tView.contentQueries[0] : tQueries.length; const viewLQueries = []; for (let i = 0; i < noOfInheritedQueries; i++) { const tQuery = tQueries.getByIndex(i); const parentLQuery = this.queries[tQuery.indexInDeclarationView]; viewLQueries.push(parentLQuery.clone()); } return new _LQueries_(viewLQueries); } return null; } insertView(tView) { this.dirtyQueriesWithMatches(tView); } detachView(tView) { this.dirtyQueriesWithMatches(tView); } finishViewCreation(tView) { this.dirtyQueriesWithMatches(tView); } dirtyQueriesWithMatches(tView) { for (let i = 0; i < this.queries.length; i++) { if (getTQuery(tView, i).matches !== null) { this.queries[i].setDirty(); } } } }; var TQueryMetadata_ = class { flags; read; predicate; constructor(predicate, flags, read = null) { this.flags = flags; this.read = read; if (typeof predicate === "string") { this.predicate = splitQueryMultiSelectors(predicate); } else { this.predicate = predicate; } } }; var TQueries_ = class _TQueries_ { queries; constructor(queries = []) { this.queries = queries; } elementStart(tView, tNode) { ngDevMode && assertFirstCreatePass(tView, "Queries should collect results on the first template pass only"); for (let i = 0; i < this.queries.length; i++) { this.queries[i].elementStart(tView, tNode); } } elementEnd(tNode) { for (let i = 0; i < this.queries.length; i++) { this.queries[i].elementEnd(tNode); } } embeddedTView(tNode) { let queriesForTemplateRef = null; for (let i = 0; i < this.length; i++) { const childQueryIndex = queriesForTemplateRef !== null ? queriesForTemplateRef.length : 0; const tqueryClone = this.getByIndex(i).embeddedTView(tNode, childQueryIndex); if (tqueryClone) { tqueryClone.indexInDeclarationView = i; if (queriesForTemplateRef !== null) { queriesForTemplateRef.push(tqueryClone); } else { queriesForTemplateRef = [tqueryClone]; } } } return queriesForTemplateRef !== null ? new _TQueries_(queriesForTemplateRef) : null; } template(tView, tNode) { ngDevMode && assertFirstCreatePass(tView, "Queries should collect results on the first template pass only"); for (let i = 0; i < this.queries.length; i++) { this.queries[i].template(tView, tNode); } } getByIndex(index) { ngDevMode && assertIndexInRange(this.queries, index); return this.queries[index]; } get length() { return this.queries.length; } track(tquery) { this.queries.push(tquery); } }; var TQuery_ = class _TQuery_ { metadata; matches = null; indexInDeclarationView = -1; crossesNgTemplate = false; /** * A node index on which a query was declared (-1 for view queries and ones inherited from the * declaration template). We use this index (alongside with _appliesToNextNode flag) to know * when to apply content queries to elements in a template. */ _declarationNodeIndex; /** * A flag indicating if a given query still applies to nodes it is crossing. We use this flag * (alongside with _declarationNodeIndex) to know when to stop applying content queries to * elements in a template. */ _appliesToNextNode = true; constructor(metadata, nodeIndex = -1) { this.metadata = metadata; this._declarationNodeIndex = nodeIndex; } elementStart(tView, tNode) { if (this.isApplyingToNode(tNode)) { this.matchTNode(tView, tNode); } } elementEnd(tNode) { if (this._declarationNodeIndex === tNode.index) { this._appliesToNextNode = false; } } template(tView, tNode) { this.elementStart(tView, tNode); } embeddedTView(tNode, childQueryIndex) { if (this.isApplyingToNode(tNode)) { this.crossesNgTemplate = true; this.addMatch(-tNode.index, childQueryIndex); return new _TQuery_(this.metadata); } return null; } isApplyingToNode(tNode) { if (this._appliesToNextNode && (this.metadata.flags & 1) !== 1) { const declarationNodeIdx = this._declarationNodeIndex; let parent = tNode.parent; while (parent !== null && parent.type & 8 && parent.index !== declarationNodeIdx) { parent = parent.parent; } return declarationNodeIdx === (parent !== null ? parent.index : -1); } return this._appliesToNextNode; } matchTNode(tView, tNode) { const predicate = this.metadata.predicate; if (Array.isArray(predicate)) { for (let i = 0; i < predicate.length; i++) { const name = predicate[i]; this.matchTNodeWithReadOption(tView, tNode, getIdxOfMatchingSelector(tNode, name)); this.matchTNodeWithReadOption(tView, tNode, locateDirectiveOrProvider(tNode, tView, name, false, false)); } } else { if (predicate === TemplateRef) { if (tNode.type & 4) { this.matchTNodeWithReadOption(tView, tNode, -1); } } else { this.matchTNodeWithReadOption(tView, tNode, locateDirectiveOrProvider(tNode, tView, predicate, false, false)); } } } matchTNodeWithReadOption(tView, tNode, nodeMatchIdx) { if (nodeMatchIdx !== null) { const read = this.metadata.read; if (read !== null) { if (read === ElementRef || read === ViewContainerRef || read === TemplateRef && tNode.type & 4) { this.addMatch(tNode.index, -2); } else { const directiveOrProviderIdx = locateDirectiveOrProvider(tNode, tView, read, false, false); if (directiveOrProviderIdx !== null) { this.addMatch(tNode.index, directiveOrProviderIdx); } } } else { this.addMatch(tNode.index, nodeMatchIdx); } } } addMatch(tNodeIdx, matchIdx) { if (this.matches === null) { this.matches = [tNodeIdx, matchIdx]; } else { this.matches.push(tNodeIdx, matchIdx); } } }; function getIdxOfMatchingSelector(tNode, selector) { const localNames = tNode.localNames; if (localNames !== null) { for (let i = 0; i < localNames.length; i += 2) { if (localNames[i] === selector) { return localNames[i + 1]; } } } return null; } function createResultByTNodeType(tNode, currentView) { if (tNode.type & (3 | 8)) { return createElementRef(tNode, currentView); } else if (tNode.type & 4) { return createTemplateRef(tNode, currentView); } return null; } function createResultForNode(lView, tNode, matchingIdx, read) { if (matchingIdx === -1) { return createResultByTNodeType(tNode, lView); } else if (matchingIdx === -2) { return createSpecialToken(lView, tNode, read); } else { return getNodeInjectable(lView, lView[TVIEW], matchingIdx, tNode); } } function createSpecialToken(lView, tNode, read) { if (read === ElementRef) { return createElementRef(tNode, lView); } else if (read === TemplateRef) { return createTemplateRef(tNode, lView); } else if (read === ViewContainerRef) { ngDevMode && assertTNodeType( tNode, 3 | 12 /* TNodeType.AnyContainer */ ); return createContainerRef(tNode, lView); } else { ngDevMode && throwError(`Special token to read should be one of ElementRef, TemplateRef or ViewContainerRef but got ${stringify(read)}.`); } } function materializeViewResults(tView, lView, tQuery, queryIndex) { const lQuery = lView[QUERIES].queries[queryIndex]; if (lQuery.matches === null) { const tViewData = tView.data; const tQueryMatches = tQuery.matches; const result = []; for (let i = 0; tQueryMatches !== null && i < tQueryMatches.length; i += 2) { const matchedNodeIdx = tQueryMatches[i]; if (matchedNodeIdx < 0) { result.push(null); } else { ngDevMode && assertIndexInRange(tViewData, matchedNodeIdx); const tNode = tViewData[matchedNodeIdx]; result.push(createResultForNode(lView, tNode, tQueryMatches[i + 1], tQuery.metadata.read)); } } lQuery.matches = result; } return lQuery.matches; } function collectQueryResults(tView, lView, queryIndex, result) { const tQuery = tView.queries.getByIndex(queryIndex); const tQueryMatches = tQuery.matches; if (tQueryMatches !== null) { const lViewResults = materializeViewResults(tView, lView, tQuery, queryIndex); for (let i = 0; i < tQueryMatches.length; i += 2) { const tNodeIdx = tQueryMatches[i]; if (tNodeIdx > 0) { result.push(lViewResults[i / 2]); } else { const childQueryIndex = tQueryMatches[i + 1]; const declarationLContainer = lView[-tNodeIdx]; ngDevMode && assertLContainer(declarationLContainer); for (let i2 = CONTAINER_HEADER_OFFSET; i2 < declarationLContainer.length; i2++) { const embeddedLView = declarationLContainer[i2]; if (embeddedLView[DECLARATION_LCONTAINER] === embeddedLView[PARENT]) { collectQueryResults(embeddedLView[TVIEW], embeddedLView, childQueryIndex, result); } } if (declarationLContainer[MOVED_VIEWS] !== null) { const embeddedLViews = declarationLContainer[MOVED_VIEWS]; for (let i2 = 0; i2 < embeddedLViews.length; i2++) { const embeddedLView = embeddedLViews[i2]; collectQueryResults(embeddedLView[TVIEW], embeddedLView, childQueryIndex, result); } } } } } return result; } function loadQueryInternal(lView, queryIndex) { ngDevMode && assertDefined(lView[QUERIES], "LQueries should be defined when trying to load a query"); ngDevMode && assertIndexInRange(lView[QUERIES].queries, queryIndex); return lView[QUERIES].queries[queryIndex].queryList; } function createLQuery(tView, lView, flags) { const queryList = new QueryList( (flags & 4) === 4 /* QueryFlags.emitDistinctChangesOnly */ ); storeCleanupWithContext(tView, lView, queryList, queryList.destroy); const lQueries = (lView[QUERIES] ??= new LQueries_()).queries; return lQueries.push(new LQuery_(queryList)) - 1; } function createViewQuery(predicate, flags, read) { ngDevMode && assertNumber(flags, "Expecting flags"); const tView = getTView(); if (tView.firstCreatePass) { createTQuery(tView, new TQueryMetadata_(predicate, flags, read), -1); if ((flags & 2) === 2) { tView.staticViewQueries = true; } } return createLQuery(tView, getLView(), flags); } function createContentQuery(directiveIndex, predicate, flags, read) { ngDevMode && assertNumber(flags, "Expecting flags"); const tView = getTView(); if (tView.firstCreatePass) { const tNode = getCurrentTNode(); createTQuery(tView, new TQueryMetadata_(predicate, flags, read), tNode.index); saveContentQueryAndDirectiveIndex(tView, directiveIndex); if ((flags & 2) === 2) { tView.staticContentQueries = true; } } return createLQuery(tView, getLView(), flags); } function splitQueryMultiSelectors(locator) { return locator.split(",").map((s) => s.trim()); } function createTQuery(tView, metadata, nodeIndex) { if (tView.queries === null) tView.queries = new TQueries_(); tView.queries.track(new TQuery_(metadata, nodeIndex)); } function saveContentQueryAndDirectiveIndex(tView, directiveIndex) { const tViewContentQueries = tView.contentQueries || (tView.contentQueries = []); const lastSavedDirectiveIndex = tViewContentQueries.length ? tViewContentQueries[tViewContentQueries.length - 1] : -1; if (directiveIndex !== lastSavedDirectiveIndex) { tViewContentQueries.push(tView.queries.length - 1, directiveIndex); } } function getTQuery(tView, index) { ngDevMode && assertDefined(tView.queries, "TQueries must be defined to retrieve a TQuery"); return tView.queries.getByIndex(index); } function getQueryResults(lView, queryIndex) { const tView = lView[TVIEW]; const tQuery = getTQuery(tView, queryIndex); return tQuery.crossesNgTemplate ? collectQueryResults(tView, lView, queryIndex, []) : materializeViewResults(tView, lView, tQuery, queryIndex); } function createQuerySignalFn(firstOnly, required, opts) { let node; const signalFn = createComputed(() => { node._dirtyCounter(); const value = refreshSignalQuery(node, firstOnly); if (required && value === void 0) { throw new RuntimeError(-951, ngDevMode && "Child query result is required but no value is available."); } return value; }); node = signalFn[SIGNAL]; node._dirtyCounter = signal(0); node._flatValue = void 0; if (ngDevMode) { signalFn.toString = () => `[Query Signal]`; node.debugName = opts?.debugName; } return signalFn; } function createSingleResultOptionalQuerySignalFn(opts) { return createQuerySignalFn( /* firstOnly */ true, /* required */ false, opts ); } function createSingleResultRequiredQuerySignalFn(opts) { return createQuerySignalFn( /* firstOnly */ true, /* required */ true, opts ); } function createMultiResultQuerySignalFn(opts) { return createQuerySignalFn( /* firstOnly */ false, /* required */ false, opts ); } function bindQueryToSignal(target, queryIndex) { const node = target[SIGNAL]; node._lView = getLView(); node._queryIndex = queryIndex; node._queryList = loadQueryInternal(node._lView, queryIndex); node._queryList.onDirty(() => node._dirtyCounter.update((v) => v + 1)); } function refreshSignalQuery(node, firstOnly) { const lView = node._lView; const queryIndex = node._queryIndex; if (lView === void 0 || queryIndex === void 0 || lView[FLAGS] & 4) { return firstOnly ? void 0 : EMPTY_ARRAY; } const queryList = loadQueryInternal(lView, queryIndex); const results = getQueryResults(lView, queryIndex); queryList.reset(results, unwrapElementRef); if (firstOnly) { return queryList.first; } else { const resultChanged = queryList._changesDetected; if (resultChanged || node._flatValue === void 0) { return node._flatValue = queryList.toArray(); } return node._flatValue; } } function resolveComponentResources(resourceResolver) { const componentResolved = []; const urlMap = /* @__PURE__ */ new Map(); function cachedResourceResolve(url) { let promise = urlMap.get(url); if (!promise) { const resp = resourceResolver(url); urlMap.set(url, promise = resp.then((res) => unwrapResponse(url, res))); } return promise; } componentResourceResolutionQueue.forEach((component, type) => { const promises = []; if (component.templateUrl) { promises.push(cachedResourceResolve(component.templateUrl).then((template) => { component.template = template; })); } const styles = typeof component.styles === "string" ? [component.styles] : component.styles || []; component.styles = styles; if (component.styleUrl && component.styleUrls?.length) { throw new Error("@Component cannot define both `styleUrl` and `styleUrls`. Use `styleUrl` if the component has one stylesheet, or `styleUrls` if it has multiple"); } else if (component.styleUrls?.length) { const styleOffset = component.styles.length; const styleUrls = component.styleUrls; component.styleUrls.forEach((styleUrl, index) => { styles.push(""); promises.push(cachedResourceResolve(styleUrl).then((style) => { styles[styleOffset + index] = style; styleUrls.splice(styleUrls.indexOf(styleUrl), 1); if (styleUrls.length == 0) { component.styleUrls = void 0; } })); }); } else if (component.styleUrl) { promises.push(cachedResourceResolve(component.styleUrl).then((style) => { styles.push(style); component.styleUrl = void 0; })); } const fullyResolved = Promise.all(promises).then(() => componentDefResolved(type)); componentResolved.push(fullyResolved); }); clearResolutionOfComponentResourcesQueue(); return Promise.all(componentResolved).then(() => void 0); } var componentResourceResolutionQueue = /* @__PURE__ */ new Map(); var componentDefPendingResolution = /* @__PURE__ */ new Set(); function maybeQueueResolutionOfComponentResources(type, metadata) { if (componentNeedsResolution(metadata)) { componentResourceResolutionQueue.set(type, metadata); componentDefPendingResolution.add(type); } } function isComponentDefPendingResolution(type) { return componentDefPendingResolution.has(type); } function componentNeedsResolution(component) { return !!(component.templateUrl && !component.hasOwnProperty("template") || component.styleUrls && component.styleUrls.length || component.styleUrl); } function clearResolutionOfComponentResourcesQueue() { const old = componentResourceResolutionQueue; componentResourceResolutionQueue = /* @__PURE__ */ new Map(); return old; } function restoreComponentResolutionQueue(queue) { componentDefPendingResolution.clear(); queue.forEach((_, type) => componentDefPendingResolution.add(type)); componentResourceResolutionQueue = queue; } function isComponentResourceResolutionQueueEmpty() { return componentResourceResolutionQueue.size === 0; } function unwrapResponse(url, response) { if (typeof response === "string") { return response; } if (response.status !== void 0 && response.status !== 200) { return Promise.reject(new RuntimeError(918, ngDevMode && `Could not load resource: ${url}. Response status: ${response.status}`)); } return response.text(); } function componentDefResolved(type) { componentDefPendingResolution.delete(type); } var modules = /* @__PURE__ */ new Map(); var checkForDuplicateNgModules = true; function assertSameOrNotExisting(id, type, incoming) { if (type && type !== incoming && checkForDuplicateNgModules) { throw new Error(`Duplicate module registered for ${id} - ${stringify(type)} vs ${stringify(type.name)}`); } } function registerNgModuleType(ngModuleType, id) { const existing = modules.get(id) || null; assertSameOrNotExisting(id, existing, ngModuleType); modules.set(id, ngModuleType); } function getRegisteredNgModuleType(id) { return modules.get(id); } function setAllowDuplicateNgModuleIdsForTest(allowDuplicates) { checkForDuplicateNgModules = !allowDuplicates; } function ɵɵvalidateIframeAttribute(attrValue, tagName, attrName) { const lView = getLView(); const tNode = getSelectedTNode(); const element = getNativeByTNode(tNode, lView); if (tNode.type === 2 && tagName.toLowerCase() === "iframe") { const iframe = element; iframe.src = ""; iframe.srcdoc = trustedHTMLFromString(""); nativeRemoveNode(lView[RENDERER], iframe); const errorMessage = ngDevMode && `Angular has detected that the \`${attrName}\` was applied as a binding to an