|
- import {
- BehaviorSubject,
- Subject,
- Subscription,
- __async,
- __spreadProps,
- __spreadValues,
- first,
- map
- } from "./chunk-SXIXOCJ4.js";
-
- // node_modules/@angular/core/fesm2022/primitives/signals.mjs
- function defaultEquals(a, b) {
- return Object.is(a, b);
- }
- var activeConsumer = null;
- var inNotificationPhase = false;
- var epoch = 1;
- var SIGNAL = Symbol("SIGNAL");
- function setActiveConsumer(consumer) {
- const prev = activeConsumer;
- activeConsumer = consumer;
- return prev;
- }
- function getActiveConsumer() {
- return activeConsumer;
- }
- function isInNotificationPhase() {
- return inNotificationPhase;
- }
- var REACTIVE_NODE = {
- version: 0,
- lastCleanEpoch: 0,
- dirty: false,
- producerNode: void 0,
- producerLastReadVersion: void 0,
- producerIndexOfThis: void 0,
- nextProducerIndex: 0,
- liveConsumerNode: void 0,
- liveConsumerIndexOfThis: void 0,
- consumerAllowSignalWrites: false,
- consumerIsAlwaysLive: false,
- producerMustRecompute: () => false,
- producerRecomputeValue: () => {
- },
- consumerMarkedDirty: () => {
- },
- consumerOnSignalRead: () => {
- }
- };
- function producerAccessed(node) {
- if (inNotificationPhase) {
- throw new Error(typeof ngDevMode !== "undefined" && ngDevMode ? `Assertion error: signal read during notification phase` : "");
- }
- if (activeConsumer === null) {
- return;
- }
- activeConsumer.consumerOnSignalRead(node);
- const idx = activeConsumer.nextProducerIndex++;
- assertConsumerNode(activeConsumer);
- if (idx < activeConsumer.producerNode.length && activeConsumer.producerNode[idx] !== node) {
- if (consumerIsLive(activeConsumer)) {
- const staleProducer = activeConsumer.producerNode[idx];
- producerRemoveLiveConsumerAtIndex(staleProducer, activeConsumer.producerIndexOfThis[idx]);
- }
- }
- if (activeConsumer.producerNode[idx] !== node) {
- activeConsumer.producerNode[idx] = node;
- activeConsumer.producerIndexOfThis[idx] = consumerIsLive(activeConsumer) ? producerAddLiveConsumer(node, activeConsumer, idx) : 0;
- }
- activeConsumer.producerLastReadVersion[idx] = node.version;
- }
- function producerIncrementEpoch() {
- epoch++;
- }
- function producerUpdateValueVersion(node) {
- if (consumerIsLive(node) && !node.dirty) {
- return;
- }
- if (!node.dirty && node.lastCleanEpoch === epoch) {
- return;
- }
- if (!node.producerMustRecompute(node) && !consumerPollProducersForChange(node)) {
- node.dirty = false;
- node.lastCleanEpoch = epoch;
- return;
- }
- node.producerRecomputeValue(node);
- node.dirty = false;
- node.lastCleanEpoch = epoch;
- }
- function producerNotifyConsumers(node) {
- if (node.liveConsumerNode === void 0) {
- return;
- }
- const prev = inNotificationPhase;
- inNotificationPhase = true;
- try {
- for (const consumer of node.liveConsumerNode) {
- if (!consumer.dirty) {
- consumerMarkDirty(consumer);
- }
- }
- } finally {
- inNotificationPhase = prev;
- }
- }
- function producerUpdatesAllowed() {
- return activeConsumer?.consumerAllowSignalWrites !== false;
- }
- function consumerMarkDirty(node) {
- node.dirty = true;
- producerNotifyConsumers(node);
- node.consumerMarkedDirty?.(node);
- }
- function consumerBeforeComputation(node) {
- node && (node.nextProducerIndex = 0);
- return setActiveConsumer(node);
- }
- function consumerAfterComputation(node, prevConsumer) {
- setActiveConsumer(prevConsumer);
- if (!node || node.producerNode === void 0 || node.producerIndexOfThis === void 0 || node.producerLastReadVersion === void 0) {
- return;
- }
- if (consumerIsLive(node)) {
- for (let i = node.nextProducerIndex; i < node.producerNode.length; i++) {
- producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]);
- }
- }
- while (node.producerNode.length > node.nextProducerIndex) {
- node.producerNode.pop();
- node.producerLastReadVersion.pop();
- node.producerIndexOfThis.pop();
- }
- }
- function consumerPollProducersForChange(node) {
- assertConsumerNode(node);
- for (let i = 0; i < node.producerNode.length; i++) {
- const producer = node.producerNode[i];
- const seenVersion = node.producerLastReadVersion[i];
- if (seenVersion !== producer.version) {
- return true;
- }
- producerUpdateValueVersion(producer);
- if (seenVersion !== producer.version) {
- return true;
- }
- }
- return false;
- }
- function consumerDestroy(node) {
- assertConsumerNode(node);
- if (consumerIsLive(node)) {
- for (let i = 0; i < node.producerNode.length; i++) {
- producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]);
- }
- }
- node.producerNode.length = node.producerLastReadVersion.length = node.producerIndexOfThis.length = 0;
- if (node.liveConsumerNode) {
- node.liveConsumerNode.length = node.liveConsumerIndexOfThis.length = 0;
- }
- }
- function producerAddLiveConsumer(node, consumer, indexOfThis) {
- assertProducerNode(node);
- assertConsumerNode(node);
- if (node.liveConsumerNode.length === 0) {
- for (let i = 0; i < node.producerNode.length; i++) {
- node.producerIndexOfThis[i] = producerAddLiveConsumer(node.producerNode[i], node, i);
- }
- }
- node.liveConsumerIndexOfThis.push(indexOfThis);
- return node.liveConsumerNode.push(consumer) - 1;
- }
- function producerRemoveLiveConsumerAtIndex(node, idx) {
- assertProducerNode(node);
- assertConsumerNode(node);
- if (typeof ngDevMode !== "undefined" && ngDevMode && idx >= node.liveConsumerNode.length) {
- throw new Error(`Assertion error: active consumer index ${idx} is out of bounds of ${node.liveConsumerNode.length} consumers)`);
- }
- if (node.liveConsumerNode.length === 1) {
- for (let i = 0; i < node.producerNode.length; i++) {
- producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]);
- }
- }
- const lastIdx = node.liveConsumerNode.length - 1;
- node.liveConsumerNode[idx] = node.liveConsumerNode[lastIdx];
- node.liveConsumerIndexOfThis[idx] = node.liveConsumerIndexOfThis[lastIdx];
- node.liveConsumerNode.length--;
- node.liveConsumerIndexOfThis.length--;
- if (idx < node.liveConsumerNode.length) {
- const idxProducer = node.liveConsumerIndexOfThis[idx];
- const consumer = node.liveConsumerNode[idx];
- assertConsumerNode(consumer);
- consumer.producerIndexOfThis[idxProducer] = idx;
- }
- }
- function consumerIsLive(node) {
- return node.consumerIsAlwaysLive || (node?.liveConsumerNode?.length ?? 0) > 0;
- }
- function assertConsumerNode(node) {
- node.producerNode ??= [];
- node.producerIndexOfThis ??= [];
- node.producerLastReadVersion ??= [];
- }
- function assertProducerNode(node) {
- node.liveConsumerNode ??= [];
- node.liveConsumerIndexOfThis ??= [];
- }
- function createComputed(computation) {
- const node = Object.create(COMPUTED_NODE);
- node.computation = computation;
- const computed2 = () => {
- producerUpdateValueVersion(node);
- producerAccessed(node);
- if (node.value === ERRORED) {
- throw node.error;
- }
- return node.value;
- };
- computed2[SIGNAL] = node;
- return computed2;
- }
- var UNSET = Symbol("UNSET");
- var COMPUTING = Symbol("COMPUTING");
- var ERRORED = Symbol("ERRORED");
- var COMPUTED_NODE = (() => {
- return __spreadProps(__spreadValues({}, REACTIVE_NODE), {
- value: UNSET,
- dirty: true,
- error: null,
- equal: defaultEquals,
- producerMustRecompute(node) {
- return node.value === UNSET || node.value === COMPUTING;
- },
- producerRecomputeValue(node) {
- if (node.value === COMPUTING) {
- throw new Error("Detected cycle in computations.");
- }
- const oldValue = node.value;
- node.value = COMPUTING;
- const prevConsumer = consumerBeforeComputation(node);
- let newValue;
- try {
- newValue = node.computation();
- } catch (err) {
- newValue = ERRORED;
- node.error = err;
- } finally {
- consumerAfterComputation(node, prevConsumer);
- }
- if (oldValue !== UNSET && oldValue !== ERRORED && newValue !== ERRORED && node.equal(oldValue, newValue)) {
- node.value = oldValue;
- return;
- }
- node.value = newValue;
- node.version++;
- }
- });
- })();
- function defaultThrowError() {
- throw new Error();
- }
- var throwInvalidWriteToSignalErrorFn = defaultThrowError;
- function throwInvalidWriteToSignalError() {
- throwInvalidWriteToSignalErrorFn();
- }
- function setThrowInvalidWriteToSignalError(fn) {
- throwInvalidWriteToSignalErrorFn = fn;
- }
- var postSignalSetFn = null;
- function createSignal(initialValue) {
- const node = Object.create(SIGNAL_NODE);
- node.value = initialValue;
- const getter = () => {
- producerAccessed(node);
- return node.value;
- };
- getter[SIGNAL] = node;
- return getter;
- }
- function signalSetFn(node, newValue) {
- if (!producerUpdatesAllowed()) {
- throwInvalidWriteToSignalError();
- }
- if (!node.equal(node.value, newValue)) {
- node.value = newValue;
- signalValueChanged(node);
- }
- }
- function signalUpdateFn(node, updater) {
- if (!producerUpdatesAllowed()) {
- throwInvalidWriteToSignalError();
- }
- signalSetFn(node, updater(node.value));
- }
- var SIGNAL_NODE = (() => {
- return __spreadProps(__spreadValues({}, REACTIVE_NODE), {
- equal: defaultEquals,
- value: void 0
- });
- })();
- function signalValueChanged(node) {
- node.version++;
- producerIncrementEpoch();
- producerNotifyConsumers(node);
- postSignalSetFn?.();
- }
- function createWatch(fn, schedule, allowSignalWrites) {
- const node = Object.create(WATCH_NODE);
- if (allowSignalWrites) {
- node.consumerAllowSignalWrites = true;
- }
- node.fn = fn;
- node.schedule = schedule;
- const registerOnCleanup = (cleanupFn) => {
- node.cleanupFn = cleanupFn;
- };
- function isWatchNodeDestroyed(node2) {
- return node2.fn === null && node2.schedule === null;
- }
- function destroyWatchNode(node2) {
- if (!isWatchNodeDestroyed(node2)) {
- consumerDestroy(node2);
- node2.cleanupFn();
- node2.fn = null;
- node2.schedule = null;
- node2.cleanupFn = NOOP_CLEANUP_FN;
- }
- }
- const run = () => {
- if (node.fn === null) {
- return;
- }
- if (isInNotificationPhase()) {
- throw new Error(`Schedulers cannot synchronously execute watches while scheduling.`);
- }
- node.dirty = false;
- if (node.hasRun && !consumerPollProducersForChange(node)) {
- return;
- }
- node.hasRun = true;
- const prevConsumer = consumerBeforeComputation(node);
- try {
- node.cleanupFn();
- node.cleanupFn = NOOP_CLEANUP_FN;
- node.fn(registerOnCleanup);
- } finally {
- consumerAfterComputation(node, prevConsumer);
- }
- };
- node.ref = {
- notify: () => consumerMarkDirty(node),
- run,
- cleanup: () => node.cleanupFn(),
- destroy: () => destroyWatchNode(node),
- [SIGNAL]: node
- };
- return node.ref;
- }
- var NOOP_CLEANUP_FN = () => {
- };
- var WATCH_NODE = (() => {
- return __spreadProps(__spreadValues({}, REACTIVE_NODE), {
- consumerIsAlwaysLive: true,
- consumerAllowSignalWrites: false,
- consumerMarkedDirty: (node) => {
- if (node.schedule !== null) {
- node.schedule(node.ref);
- }
- },
- hasRun: false,
- cleanupFn: NOOP_CLEANUP_FN
- });
- })();
-
- // node_modules/@angular/core/fesm2022/core.mjs
- var ERROR_DETAILS_PAGE_BASE_URL = "https://angular.io/errors";
- var XSS_SECURITY_URL = "https://g.co/ng/security#xss";
- var RuntimeError = class extends Error {
- constructor(code, message) {
- super(formatRuntimeError(code, message));
- this.code = code;
- }
- };
- function formatRuntimeError(code, message) {
- const fullCode = `NG0${Math.abs(code)}`;
- let errorMessage = `${fullCode}${message ? ": " + message : ""}`;
- if (ngDevMode && code < 0) {
- const addPeriodSeparator = !errorMessage.match(/[.,;!?\n]$/);
- const separator = addPeriodSeparator ? "." : "";
- errorMessage = `${errorMessage}${separator} Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/${fullCode}`;
- }
- return errorMessage;
- }
- var REQUIRED_UNSET_VALUE = Symbol("InputSignalNode#UNSET");
- var INPUT_SIGNAL_NODE = (() => {
- return __spreadProps(__spreadValues({}, SIGNAL_NODE), {
- transformFn: void 0,
- applyValueToInputSignal(node, value) {
- signalSetFn(node, value);
- }
- });
- })();
- var ɵINPUT_SIGNAL_BRAND_READ_TYPE = Symbol();
- var ɵINPUT_SIGNAL_BRAND_WRITE_TYPE = Symbol();
- function createInputSignal(initialValue, options) {
- const node = Object.create(INPUT_SIGNAL_NODE);
- node.value = initialValue;
- node.transformFn = options?.transform;
- function inputValueFn() {
- producerAccessed(node);
- if (node.value === REQUIRED_UNSET_VALUE) {
- throw new RuntimeError(-950, ngDevMode && "Input is required but no value is available yet.");
- }
- return node.value;
- }
- inputValueFn[SIGNAL] = node;
- if (ngDevMode) {
- inputValueFn.toString = () => `[Input Signal: ${inputValueFn()}]`;
- }
- return inputValueFn;
- }
- var EventEmitter_ = class extends Subject {
- constructor(isAsync = false) {
- super();
- this.__isAsync = isAsync;
- }
- emit(value) {
- super.next(value);
- }
- subscribe(observerOrNext, error, complete) {
- let nextFn = observerOrNext;
- let errorFn = error || (() => null);
- let completeFn = complete;
- if (observerOrNext && typeof observerOrNext === "object") {
- const observer = observerOrNext;
- nextFn = observer.next?.bind(observer);
- errorFn = observer.error?.bind(observer);
- completeFn = observer.complete?.bind(observer);
- }
- if (this.__isAsync) {
- errorFn = _wrapInTimeout(errorFn);
- if (nextFn) {
- nextFn = _wrapInTimeout(nextFn);
- }
- if (completeFn) {
- completeFn = _wrapInTimeout(completeFn);
- }
- }
- const sink = super.subscribe({ next: nextFn, error: errorFn, complete: completeFn });
- if (observerOrNext instanceof Subscription) {
- observerOrNext.add(sink);
- }
- return sink;
- }
- };
- function _wrapInTimeout(fn) {
- return (value) => {
- setTimeout(fn, void 0, value);
- };
- }
- var EventEmitter = EventEmitter_;
- function output(opts) {
- return new EventEmitter();
- }
- function inputFunction(initialValue, opts) {
- return createInputSignal(initialValue, opts);
- }
- function inputRequiredFunction(opts) {
- return createInputSignal(REQUIRED_UNSET_VALUE, opts);
- }
- var input = (() => {
- inputFunction.required = inputRequiredFunction;
- return inputFunction;
- })();
- var InjectFlags;
- (function(InjectFlags2) {
- InjectFlags2[InjectFlags2["Default"] = 0] = "Default";
- InjectFlags2[InjectFlags2["Host"] = 1] = "Host";
- InjectFlags2[InjectFlags2["Self"] = 2] = "Self";
- InjectFlags2[InjectFlags2["SkipSelf"] = 4] = "SkipSelf";
- InjectFlags2[InjectFlags2["Optional"] = 8] = "Optional";
- })(InjectFlags || (InjectFlags = {}));
- function stringify(token) {
- if (typeof token === "string") {
- return token;
- }
- if (Array.isArray(token)) {
- return "[" + token.map(stringify).join(", ") + "]";
- }
- if (token == null) {
- return "" + token;
- }
- if (token.overriddenName) {
- return `${token.overriddenName}`;
- }
- if (token.name) {
- return `${token.name}`;
- }
- const res = token.toString();
- if (res == null) {
- return "" + res;
- }
- const newLineIndex = res.indexOf("\n");
- return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
- }
- function concatStringsWithSpace(before, after) {
- return before == null || before === "" ? after === null ? "" : after : after == null || after === "" ? before : before + " " + after;
- }
- function truncateMiddle(str, maxLength = 100) {
- if (!str || maxLength < 1 || str.length <= maxLength)
- return str;
- if (maxLength == 1)
- return str.substring(0, 1) + "...";
- const halfLimit = Math.round(maxLength / 2);
- return str.substring(0, halfLimit) + "..." + str.substring(str.length - halfLimit);
- }
- function assertNumber(actual, msg) {
- if (!(typeof actual === "number")) {
- throwError(msg, typeof actual, "number", "===");
- }
- }
- function assertNumberInRange(actual, minInclusive, maxInclusive) {
- assertNumber(actual, "Expected a number");
- assertLessThanOrEqual(actual, maxInclusive, "Expected number to be less than or equal to");
- assertGreaterThanOrEqual(actual, minInclusive, "Expected number to be greater than or equal to");
- }
- function assertString(actual, msg) {
- if (!(typeof actual === "string")) {
- throwError(msg, actual === null ? "null" : typeof actual, "string", "===");
- }
- }
- function assertFunction(actual, msg) {
- if (!(typeof actual === "function")) {
- throwError(msg, actual === null ? "null" : typeof actual, "function", "===");
- }
- }
- function assertEqual(actual, expected, msg) {
- if (!(actual == expected)) {
- throwError(msg, actual, expected, "==");
- }
- }
- function assertNotEqual(actual, expected, msg) {
- if (!(actual != expected)) {
- throwError(msg, actual, expected, "!=");
- }
- }
- function assertSame(actual, expected, msg) {
- if (!(actual === expected)) {
- throwError(msg, actual, expected, "===");
- }
- }
- function assertNotSame(actual, expected, msg) {
- if (!(actual !== expected)) {
- throwError(msg, actual, expected, "!==");
- }
- }
- function assertLessThan(actual, expected, msg) {
- if (!(actual < expected)) {
- throwError(msg, actual, expected, "<");
- }
- }
- function assertLessThanOrEqual(actual, expected, msg) {
- if (!(actual <= expected)) {
- throwError(msg, actual, expected, "<=");
- }
- }
- function assertGreaterThan(actual, expected, msg) {
- if (!(actual > expected)) {
- throwError(msg, actual, expected, ">");
- }
- }
- function assertGreaterThanOrEqual(actual, expected, msg) {
- if (!(actual >= expected)) {
- throwError(msg, actual, expected, ">=");
- }
- }
- function assertDefined(actual, msg) {
- if (actual == null) {
- throwError(msg, actual, null, "!=");
- }
- }
- function throwError(msg, actual, expected, comparison) {
- throw new Error(`ASSERTION ERROR: ${msg}` + (comparison == null ? "" : ` [Expected=> ${expected} ${comparison} ${actual} <=Actual]`));
- }
- function assertDomNode(node) {
- if (!(node instanceof Node)) {
- throwError(`The provided value must be an instance of a DOM Node but got ${stringify(node)}`);
- }
- }
- function assertElement(node) {
- if (!(node instanceof Element)) {
- throwError(`The provided value must be an element but got ${stringify(node)}`);
- }
- }
- function assertIndexInRange(arr, index) {
- assertDefined(arr, "Array must be defined.");
- const maxLen = arr.length;
- if (index < 0 || index >= maxLen) {
- throwError(`Index expected to be less than ${maxLen} but got ${index}`);
- }
- }
- function assertOneOf(value, ...validValues) {
- if (validValues.indexOf(value) !== -1)
- return true;
- throwError(`Expected value to be one of ${JSON.stringify(validValues)} but was ${JSON.stringify(value)}.`);
- }
- var ChangeDetectionStrategy;
- (function(ChangeDetectionStrategy2) {
- ChangeDetectionStrategy2[ChangeDetectionStrategy2["OnPush"] = 0] = "OnPush";
- ChangeDetectionStrategy2[ChangeDetectionStrategy2["Default"] = 1] = "Default";
- })(ChangeDetectionStrategy || (ChangeDetectionStrategy = {}));
- var ViewEncapsulation$1;
- (function(ViewEncapsulation2) {
- ViewEncapsulation2[ViewEncapsulation2["Emulated"] = 0] = "Emulated";
- ViewEncapsulation2[ViewEncapsulation2["None"] = 2] = "None";
- ViewEncapsulation2[ViewEncapsulation2["ShadowDom"] = 3] = "ShadowDom";
- })(ViewEncapsulation$1 || (ViewEncapsulation$1 = {}));
- function noSideEffects(fn) {
- return { toString: fn }.toString();
- }
- var _global = globalThis;
- function ngDevModeResetPerfCounters() {
- const locationString = typeof location !== "undefined" ? location.toString() : "";
- const newCounters = {
- namedConstructors: locationString.indexOf("ngDevMode=namedConstructors") != -1,
- firstCreatePass: 0,
- tNode: 0,
- tView: 0,
- rendererCreateTextNode: 0,
- rendererSetText: 0,
- rendererCreateElement: 0,
- rendererAddEventListener: 0,
- rendererSetAttribute: 0,
- rendererRemoveAttribute: 0,
- rendererSetProperty: 0,
- rendererSetClassName: 0,
- rendererAddClass: 0,
- rendererRemoveClass: 0,
- rendererSetStyle: 0,
- rendererRemoveStyle: 0,
- rendererDestroy: 0,
- rendererDestroyNode: 0,
- rendererMoveNode: 0,
- rendererRemoveNode: 0,
- rendererAppendChild: 0,
- rendererInsertBefore: 0,
- rendererCreateComment: 0,
- hydratedNodes: 0,
- hydratedComponents: 0,
- dehydratedViewsRemoved: 0,
- dehydratedViewsCleanupRuns: 0,
- componentsSkippedHydration: 0
- };
- const allowNgDevModeTrue = locationString.indexOf("ngDevMode=false") === -1;
- if (!allowNgDevModeTrue) {
- _global["ngDevMode"] = false;
- } else {
- if (typeof _global["ngDevMode"] !== "object") {
- _global["ngDevMode"] = {};
- }
- Object.assign(_global["ngDevMode"], newCounters);
- }
- return newCounters;
- }
- function initNgDevMode() {
- if (typeof ngDevMode === "undefined" || ngDevMode) {
- if (typeof ngDevMode !== "object" || Object.keys(ngDevMode).length === 0) {
- ngDevModeResetPerfCounters();
- }
- return typeof ngDevMode !== "undefined" && !!ngDevMode;
- }
- return false;
- }
- var EMPTY_OBJ = {};
- var EMPTY_ARRAY = [];
- if ((typeof ngDevMode === "undefined" || ngDevMode) && initNgDevMode()) {
- Object.freeze(EMPTY_OBJ);
- Object.freeze(EMPTY_ARRAY);
- }
- function getClosureSafeProperty(objWithPropertyToExtract) {
- for (let key in objWithPropertyToExtract) {
- if (objWithPropertyToExtract[key] === getClosureSafeProperty) {
- return key;
- }
- }
- throw Error("Could not find renamed property on target object.");
- }
- function fillProperties(target, source) {
- for (const key in source) {
- if (source.hasOwnProperty(key) && !target.hasOwnProperty(key)) {
- target[key] = source[key];
- }
- }
- }
- var NG_COMP_DEF = getClosureSafeProperty({ ɵcmp: getClosureSafeProperty });
- var NG_DIR_DEF = getClosureSafeProperty({ ɵdir: getClosureSafeProperty });
- var NG_PIPE_DEF = getClosureSafeProperty({ ɵpipe: getClosureSafeProperty });
- var NG_MOD_DEF = getClosureSafeProperty({ ɵmod: getClosureSafeProperty });
- var NG_FACTORY_DEF = getClosureSafeProperty({ ɵfac: getClosureSafeProperty });
- var NG_ELEMENT_ID = getClosureSafeProperty({ __NG_ELEMENT_ID__: getClosureSafeProperty });
- var NG_ENV_ID = getClosureSafeProperty({ __NG_ENV_ID__: getClosureSafeProperty });
- var InputFlags;
- (function(InputFlags2) {
- InputFlags2[InputFlags2["None"] = 0] = "None";
- InputFlags2[InputFlags2["SignalBased"] = 1] = "SignalBased";
- InputFlags2[InputFlags2["HasDecoratorInputTransform"] = 2] = "HasDecoratorInputTransform";
- })(InputFlags || (InputFlags = {}));
- 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;
- }
- }
- 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++];
- ngDevMode && ngDevMode.rendererSetAttribute++;
- renderer.setAttribute(native, attrName, attrVal, namespaceURI);
- } else {
- const attrName = value;
- const attrVal = attrs[++i];
- ngDevMode && ngDevMode.rendererSetAttribute++;
- 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 (key2 === null) {
- if (value !== null) {
- dst[i + 1] = value;
- }
- return;
- } else if (key2 === dst[i + 1]) {
- dst[i + 2] = value;
- return;
- }
- }
- i++;
- if (key2 !== null)
- i++;
- if (value !== null)
- i++;
- }
- if (markerInsertPosition !== -1) {
- dst.splice(markerInsertPosition, 0, marker);
- i = markerInsertPosition + 1;
- }
- dst.splice(i++, 0, key1);
- if (key2 !== null) {
- dst.splice(i++, 0, key2);
- }
- if (value !== null) {
- dst.splice(i++, 0, value);
- }
- }
- var NG_TEMPLATE_SELECTOR = "ng-template";
- function isCssClassMatching(attrs, cssClassToMatch, isProjectionMode) {
- ngDevMode && assertEqual(cssClassToMatch, cssClassToMatch.toLowerCase(), "Class name expected to be lowercase.");
- let i = 0;
- let isImplicitAttrsSection = true;
- while (i < attrs.length) {
- let item = attrs[i++];
- if (typeof item === "string" && isImplicitAttrsSection) {
- const value = attrs[i++];
- if (isProjectionMode && item === "class") {
- if (classIndexOf(value.toLowerCase(), cssClassToMatch, 0) !== -1) {
- return true;
- }
- }
- } else if (item === 1) {
- while (i < attrs.length && typeof (item = attrs[i++]) == "string") {
- if (item.toLowerCase() === cssClassToMatch)
- return true;
- }
- return false;
- } else if (typeof item === "number") {
- isImplicitAttrsSection = false;
- }
- }
- 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 = getNameOnlyMarkerIndex(nodeAttrs);
- 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 {
- const selectorAttrValue = mode & 8 ? current : selector[++i];
- if (mode & 8 && tNode.attrs !== null) {
- if (!isCssClassMatching(tNode.attrs, selectorAttrValue, isProjectionMode)) {
- if (isPositive(mode))
- return false;
- skipToNextSelector = true;
- }
- continue;
- }
- const attrName = mode & 8 ? "class" : current;
- const attrIndexInNode = findAttrIndexInNode(attrName, 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();
- }
- const compareAgainstClassName = mode & 8 ? nodeAttrValue : null;
- if (compareAgainstClassName && classIndexOf(compareAgainstClassName, selectorAttrValue, 0) !== -1 || 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++;
- }
- return { attrs, classes };
- }
- function ɵɵdefineComponent(componentDefinition) {
- return noSideEffects(() => {
- (typeof ngDevMode === "undefined" || ngDevMode) && initNgDevMode();
- const baseDef = getNgDirectiveDef(componentDefinition);
- const def = __spreadProps(__spreadValues({}, baseDef), {
- decls: componentDefinition.decls,
- vars: componentDefinition.vars,
- template: componentDefinition.template,
- consts: componentDefinition.consts || null,
- ngContentSelectors: componentDefinition.ngContentSelectors,
- onPush: componentDefinition.changeDetection === ChangeDetectionStrategy.OnPush,
- directiveDefs: null,
- // assigned in noSideEffects
- pipeDefs: null,
- // assigned in noSideEffects
- dependencies: baseDef.standalone && componentDefinition.dependencies || null,
- getStandaloneInjector: null,
- signals: componentDefinition.signals ?? false,
- data: componentDefinition.data || {},
- encapsulation: componentDefinition.encapsulation || ViewEncapsulation$1.Emulated,
- styles: componentDefinition.styles || EMPTY_ARRAY,
- _: null,
- schemas: componentDefinition.schemas || null,
- tView: null,
- id: ""
- });
- initFeatures(def);
- const dependencies = componentDefinition.dependencies;
- def.directiveDefs = extractDefListOrFactory(
- dependencies,
- /* pipeDef */
- false
- );
- def.pipeDefs = extractDefListOrFactory(
- dependencies,
- /* pipeDef */
- true
- );
- def.id = getComponentId(def);
- return def;
- });
- }
- function extractDirectiveDef(type) {
- return getComponentDef(type) || getDirectiveDef(type);
- }
- function nonNull(value) {
- return value !== null;
- }
- function ɵɵdefineNgModule(def) {
- return noSideEffects(() => {
- const res = {
- type: def.type,
- bootstrap: def.bootstrap || EMPTY_ARRAY,
- declarations: def.declarations || EMPTY_ARRAY,
- imports: def.imports || EMPTY_ARRAY,
- exports: def.exports || EMPTY_ARRAY,
- transitiveCompileScopes: null,
- schemas: def.schemas || null,
- id: def.id || null
- };
- return res;
- });
- }
- function parseAndConvertBindingsForDefinition(obj, declaredInputs) {
- if (obj == null)
- return EMPTY_OBJ;
- const newLookup = {};
- for (const minifiedKey in obj) {
- if (obj.hasOwnProperty(minifiedKey)) {
- const value = obj[minifiedKey];
- let publicName;
- let declaredName;
- let inputFlags = InputFlags.None;
- if (Array.isArray(value)) {
- inputFlags = value[0];
- publicName = value[1];
- declaredName = value[2] ?? publicName;
- } else {
- publicName = value;
- declaredName = value;
- }
- if (declaredInputs) {
- newLookup[publicName] = inputFlags !== InputFlags.None ? [minifiedKey, inputFlags] : minifiedKey;
- declaredInputs[publicName] = declaredName;
- } else {
- newLookup[publicName] = minifiedKey;
- }
- }
- }
- return newLookup;
- }
- function ɵɵdefineDirective(directiveDefinition) {
- return noSideEffects(() => {
- const def = getNgDirectiveDef(directiveDefinition);
- initFeatures(def);
- return def;
- });
- }
- function ɵɵdefinePipe(pipeDef) {
- return {
- type: pipeDef.type,
- name: pipeDef.name,
- factory: null,
- pure: pipeDef.pure !== false,
- standalone: pipeDef.standalone === true,
- onDestroy: pipeDef.type.prototype.ngOnDestroy || null
- };
- }
- function getComponentDef(type) {
- return type[NG_COMP_DEF] || null;
- }
- function getDirectiveDef(type) {
- return type[NG_DIR_DEF] || null;
- }
- function getPipeDef$1(type) {
- return type[NG_PIPE_DEF] || null;
- }
- function isStandalone(type) {
- const def = getComponentDef(type) || getDirectiveDef(type) || getPipeDef$1(type);
- return def !== null ? def.standalone : false;
- }
- function getNgModuleDef(type, throwNotFound) {
- const ngModuleDef = type[NG_MOD_DEF] || null;
- if (!ngModuleDef && throwNotFound === true) {
- throw new Error(`Type ${stringify(type)} does not have 'ɵmod' property.`);
- }
- return ngModuleDef;
- }
- function getNgDirectiveDef(directiveDefinition) {
- const declaredInputs = {};
- return {
- type: directiveDefinition.type,
- providersResolver: null,
- factory: null,
- hostBindings: directiveDefinition.hostBindings || null,
- hostVars: directiveDefinition.hostVars || 0,
- hostAttrs: directiveDefinition.hostAttrs || null,
- contentQueries: directiveDefinition.contentQueries || null,
- declaredInputs,
- inputTransforms: null,
- inputConfig: directiveDefinition.inputs || EMPTY_OBJ,
- exportAs: directiveDefinition.exportAs || null,
- standalone: directiveDefinition.standalone === true,
- signals: directiveDefinition.signals === true,
- selectors: directiveDefinition.selectors || EMPTY_ARRAY,
- viewQuery: directiveDefinition.viewQuery || null,
- features: directiveDefinition.features || null,
- setInput: null,
- findHostDirectiveDefs: null,
- hostDirectives: null,
- inputs: parseAndConvertBindingsForDefinition(directiveDefinition.inputs, declaredInputs),
- outputs: parseAndConvertBindingsForDefinition(directiveDefinition.outputs),
- debugInfo: null
- };
- }
- function initFeatures(definition) {
- definition.features?.forEach((fn) => fn(definition));
- }
- function extractDefListOrFactory(dependencies, pipeDef) {
- if (!dependencies) {
- return null;
- }
- const defExtractor = pipeDef ? getPipeDef$1 : extractDirectiveDef;
- return () => (typeof dependencies === "function" ? dependencies() : dependencies).map((dep) => defExtractor(dep)).filter(nonNull);
- }
- var GENERATED_COMP_IDS = /* @__PURE__ */ new Map();
- function getComponentId(componentDef) {
- let hash = 0;
- const hashSelectors = [
- componentDef.selectors,
- componentDef.ngContentSelectors,
- componentDef.hostVars,
- componentDef.hostAttrs,
- componentDef.consts,
- componentDef.vars,
- componentDef.decls,
- componentDef.encapsulation,
- componentDef.standalone,
- componentDef.signals,
- componentDef.exportAs,
- JSON.stringify(componentDef.inputs),
- JSON.stringify(componentDef.outputs),
- // We cannot use 'componentDef.type.name' as the name of the symbol will change and will not
- // match in the server and browser bundles.
- Object.getOwnPropertyNames(componentDef.type.prototype),
- !!componentDef.contentQueries,
- !!componentDef.viewQuery
- ].join("|");
- for (const char of hashSelectors) {
- hash = Math.imul(31, hash) + char.charCodeAt(0) << 0;
- }
- hash += 2147483647 + 1;
- const compId = "c" + hash;
- if (typeof ngDevMode === "undefined" || ngDevMode) {
- if (GENERATED_COMP_IDS.has(compId)) {
- const previousCompDefType = GENERATED_COMP_IDS.get(compId);
- if (previousCompDefType !== componentDef.type) {
- console.warn(formatRuntimeError(-912, `Component ID generation collision detected. Components '${previousCompDefType.name}' and '${componentDef.type.name}' with selector '${stringifyCSSSelectorList(componentDef.selectors)}' generated the same component ID. To fix this, you can change the selector of one of those components or add an extra host attribute to force a different ID.`));
- }
- } else {
- GENERATED_COMP_IDS.set(compId, componentDef.type);
- }
- }
- return compId;
- }
- var HOST = 0;
- var TVIEW = 1;
- var FLAGS = 2;
- var PARENT = 3;
- var NEXT = 4;
- var T_HOST = 5;
- var HYDRATION = 6;
- var CLEANUP = 7;
- var CONTEXT = 8;
- var INJECTOR$1 = 9;
- var ENVIRONMENT = 10;
- var RENDERER = 11;
- var CHILD_HEAD = 12;
- var CHILD_TAIL = 13;
- var DECLARATION_VIEW = 14;
- var DECLARATION_COMPONENT_VIEW = 15;
- var DECLARATION_LCONTAINER = 16;
- var PREORDER_HOOK_FLAGS = 17;
- var QUERIES = 18;
- var ID = 19;
- var EMBEDDED_VIEW_INJECTOR = 20;
- var ON_DESTROY_HOOKS = 21;
- var EFFECTS_TO_SCHEDULE = 22;
- var REACTIVE_TEMPLATE_CONSUMER = 23;
- var HEADER_OFFSET = 25;
- var TYPE = 1;
- var DEHYDRATED_VIEWS = 6;
- var NATIVE = 7;
- var VIEW_REFS = 8;
- var MOVED_VIEWS = 9;
- var CONTAINER_HEADER_OFFSET = 10;
- var LContainerFlags;
- (function(LContainerFlags2) {
- LContainerFlags2[LContainerFlags2["None"] = 0] = "None";
- LContainerFlags2[LContainerFlags2["HasTransplantedViews"] = 2] = "HasTransplantedViews";
- })(LContainerFlags || (LContainerFlags = {}));
- function isLView(value) {
- return Array.isArray(value) && typeof value[TYPE] === "object";
- }
- function isLContainer(value) {
- return Array.isArray(value) && value[TYPE] === true;
- }
- function isContentQueryHost(tNode) {
- return (tNode.flags & 4) !== 0;
- }
- function isComponentHost(tNode) {
- return tNode.componentOffset > -1;
- }
- function isDirectiveHost(tNode) {
- return (tNode.flags & 1) === 1;
- }
- function isComponentDef(def) {
- return !!def.template;
- }
- function isRootView(target) {
- return (target[FLAGS] & 512) !== 0;
- }
- function isProjectionTNode(tNode) {
- return (tNode.type & 16) === 16;
- }
- function hasI18n(lView) {
- return (lView[FLAGS] & 32) === 32;
- }
- function isDestroyed(lView) {
- return (lView[FLAGS] & 256) === 256;
- }
- function assertTNodeForLView(tNode, lView) {
- assertTNodeForTView(tNode, lView[TVIEW]);
- }
- function assertTNodeForTView(tNode, tView) {
- assertTNode(tNode);
- const tData = tView.data;
- for (let i = HEADER_OFFSET; i < tData.length; i++) {
- if (tData[i] === tNode) {
- return;
- }
- }
- throwError("This TNode does not belong to this TView.");
- }
- function assertTNode(tNode) {
- assertDefined(tNode, "TNode must be defined");
- if (!(tNode && typeof tNode === "object" && tNode.hasOwnProperty("directiveStylingLast"))) {
- throwError("Not of type TNode, got: " + tNode);
- }
- }
- function assertTIcu(tIcu) {
- assertDefined(tIcu, "Expected TIcu to be defined");
- if (!(typeof tIcu.currentCaseLViewIndex === "number")) {
- throwError("Object is not of TIcu type.");
- }
- }
- function assertComponentType(actual, msg = "Type passed in is not ComponentType, it does not have 'ɵcmp' property.") {
- if (!getComponentDef(actual)) {
- throwError(msg);
- }
- }
- function assertNgModuleType(actual, msg = "Type passed in is not NgModuleType, it does not have 'ɵmod' property.") {
- if (!getNgModuleDef(actual)) {
- throwError(msg);
- }
- }
- function assertHasParent(tNode) {
- assertDefined(tNode, "currentTNode should exist!");
- assertDefined(tNode.parent, "currentTNode should have a parent");
- }
- function assertLContainer(value) {
- assertDefined(value, "LContainer must be defined");
- assertEqual(isLContainer(value), true, "Expecting LContainer");
- }
- function assertLViewOrUndefined(value) {
- value && assertEqual(isLView(value), true, "Expecting LView or undefined or null");
- }
- function assertLView(value) {
- assertDefined(value, "LView must be defined");
- assertEqual(isLView(value), true, "Expecting LView");
- }
- function assertFirstCreatePass(tView, errMessage) {
- assertEqual(tView.firstCreatePass, true, errMessage || "Should only be called in first create pass.");
- }
- function assertFirstUpdatePass(tView, errMessage) {
- assertEqual(tView.firstUpdatePass, true, errMessage || "Should only be called in first update pass.");
- }
- function assertDirectiveDef(obj) {
- if (obj.type === void 0 || obj.selectors == void 0 || obj.inputs === void 0) {
- throwError(`Expected a DirectiveDef/ComponentDef and this object does not seem to have the expected shape.`);
- }
- }
- function assertIndexInDeclRange(tView, index) {
- assertBetween(HEADER_OFFSET, tView.bindingStartIndex, index);
- }
- function assertIndexInExpandoRange(lView, index) {
- const tView = lView[1];
- assertBetween(tView.expandoStartIndex, lView.length, index);
- }
- function assertBetween(lower, upper, index) {
- if (!(lower <= index && index < upper)) {
- throwError(`Index out of range (expecting ${lower} <= ${index} < ${upper})`);
- }
- }
- function assertProjectionSlots(lView, errMessage) {
- assertDefined(lView[DECLARATION_COMPONENT_VIEW], "Component views should exist.");
- assertDefined(lView[DECLARATION_COMPONENT_VIEW][T_HOST].projection, errMessage || "Components with projection nodes (<ng-content>) must have projection slots defined.");
- }
- function assertParentView(lView, errMessage) {
- assertDefined(lView, errMessage || "Component views should always have a parent view (component's host view)");
- }
- 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 assertNodeInjector(lView, injectorIndex) {
- assertIndexInExpandoRange(lView, injectorIndex);
- assertIndexInExpandoRange(
- lView,
- injectorIndex + 8
- /* NodeInjectorOffset.PARENT */
- );
- assertNumber(lView[injectorIndex + 0], "injectorIndex should point to a bloom filter");
- assertNumber(lView[injectorIndex + 1], "injectorIndex should point to a bloom filter");
- assertNumber(lView[injectorIndex + 2], "injectorIndex should point to a bloom filter");
- assertNumber(lView[injectorIndex + 3], "injectorIndex should point to a bloom filter");
- assertNumber(lView[injectorIndex + 4], "injectorIndex should point to a bloom filter");
- assertNumber(lView[injectorIndex + 5], "injectorIndex should point to a bloom filter");
- assertNumber(lView[injectorIndex + 6], "injectorIndex should point to a bloom filter");
- assertNumber(lView[injectorIndex + 7], "injectorIndex should point to a bloom filter");
- assertNumber(lView[
- injectorIndex + 8
- /* NodeInjectorOffset.PARENT */
- ], "injectorIndex should point to parent injector");
- }
- var SVG_NAMESPACE = "svg";
- var MATH_ML_NAMESPACE = "math";
- var _ensureDirtyViewsAreAlwaysReachable = false;
- function getEnsureDirtyViewsAreAlwaysReachable() {
- return _ensureDirtyViewsAreAlwaysReachable;
- }
- function setEnsureDirtyViewsAreAlwaysReachable(v) {
- _ensureDirtyViewsAreAlwaysReachable = v;
- }
- function unwrapRNode(value) {
- while (Array.isArray(value)) {
- value = value[HOST];
- }
- return value;
- }
- function unwrapLView(value) {
- while (Array.isArray(value)) {
- if (typeof value[TYPE] === "object")
- return value;
- value = value[HOST];
- }
- return null;
- }
- function getNativeByIndex(index, lView) {
- ngDevMode && assertIndexInRange(lView, index);
- ngDevMode && assertGreaterThanOrEqual(index, HEADER_OFFSET, "Expected to be past HEADER_OFFSET");
- return unwrapRNode(lView[index]);
- }
- function getNativeByTNode(tNode, lView) {
- ngDevMode && assertTNodeForLView(tNode, lView);
- ngDevMode && assertIndexInRange(lView, tNode.index);
- const node = unwrapRNode(lView[tNode.index]);
- return node;
- }
- function getNativeByTNodeOrNull(tNode, lView) {
- const index = tNode === null ? -1 : tNode.index;
- if (index !== -1) {
- ngDevMode && assertTNodeForLView(tNode, lView);
- const node = unwrapRNode(lView[index]);
- return node;
- }
- return null;
- }
- function getTNode(tView, index) {
- ngDevMode && assertGreaterThan(index, -1, "wrong index for TNode");
- ngDevMode && assertLessThan(index, tView.data.length, "wrong index for TNode");
- const tNode = tView.data[index];
- ngDevMode && tNode !== null && assertTNode(tNode);
- return tNode;
- }
- function load(view, index) {
- ngDevMode && assertIndexInRange(view, index);
- return view[index];
- }
- function getComponentLViewByIndex(nodeIndex, hostView) {
- ngDevMode && assertIndexInRange(hostView, nodeIndex);
- const slotValue = hostView[nodeIndex];
- const lView = isLView(slotValue) ? slotValue : slotValue[HOST];
- return lView;
- }
- function isCreationMode(view) {
- return (view[FLAGS] & 4) === 4;
- }
- function viewAttachedToChangeDetector(view) {
- return (view[FLAGS] & 128) === 128;
- }
- function viewAttachedToContainer(view) {
- return isLContainer(view[PARENT]);
- }
- function getConstant(consts, index) {
- if (index === null || index === void 0)
- return null;
- ngDevMode && assertIndexInRange(consts, index);
- return consts[index];
- }
- function resetPreOrderHookFlags(lView) {
- lView[PREORDER_HOOK_FLAGS] = 0;
- }
- function markViewForRefresh(lView) {
- if (lView[FLAGS] & 1024) {
- return;
- }
- lView[FLAGS] |= 1024;
- if (viewAttachedToChangeDetector(lView)) {
- markAncestorsForTraversal(lView);
- }
- }
- function walkUpViews(nestingLevel, currentView) {
- while (nestingLevel > 0) {
- ngDevMode && assertDefined(currentView[DECLARATION_VIEW], "Declaration view should be defined if nesting level is greater than 0.");
- currentView = currentView[DECLARATION_VIEW];
- nestingLevel--;
- }
- return currentView;
- }
- function requiresRefreshOrTraversal(lView) {
- return !!(lView[FLAGS] & (1024 | 8192) || lView[REACTIVE_TEMPLATE_CONSUMER]?.dirty);
- }
- function updateAncestorTraversalFlagsOnAttach(lView) {
- if (requiresRefreshOrTraversal(lView)) {
- markAncestorsForTraversal(lView);
- } else if (lView[FLAGS] & 64) {
- if (getEnsureDirtyViewsAreAlwaysReachable()) {
- lView[FLAGS] |= 1024;
- markAncestorsForTraversal(lView);
- } else {
- lView[ENVIRONMENT].changeDetectionScheduler?.notify();
- }
- }
- }
- function markAncestorsForTraversal(lView) {
- lView[ENVIRONMENT].changeDetectionScheduler?.notify();
- let parent = getLViewParent(lView);
- while (parent !== null) {
- if (parent[FLAGS] & 8192) {
- break;
- }
- parent[FLAGS] |= 8192;
- if (!viewAttachedToChangeDetector(parent)) {
- break;
- }
- parent = getLViewParent(parent);
- }
- }
- function storeLViewOnDestroy(lView, onDestroyCallback) {
- if ((lView[FLAGS] & 256) === 256) {
- throw new RuntimeError(911, ngDevMode && "View has already been destroyed.");
- }
- if (lView[ON_DESTROY_HOOKS] === null) {
- lView[ON_DESTROY_HOOKS] = [];
- }
- lView[ON_DESTROY_HOOKS].push(onDestroyCallback);
- }
- function removeLViewOnDestroy(lView, onDestroyCallback) {
- if (lView[ON_DESTROY_HOOKS] === null)
- return;
- const destroyCBIdx = lView[ON_DESTROY_HOOKS].indexOf(onDestroyCallback);
- if (destroyCBIdx !== -1) {
- lView[ON_DESTROY_HOOKS].splice(destroyCBIdx, 1);
- }
- }
- function getLViewParent(lView) {
- ngDevMode && assertLView(lView);
- const parent = lView[PARENT];
- return isLContainer(parent) ? parent[PARENT] : parent;
- }
- var instructionState = {
- lFrame: createLFrame(null),
- bindingsEnabled: true,
- skipHydrationRootTNode: null
- };
- var _isInCheckNoChangesMode = false;
- function getElementDepthCount() {
- return instructionState.lFrame.elementDepthCount;
- }
- function increaseElementDepthCount() {
- instructionState.lFrame.elementDepthCount++;
- }
- function decreaseElementDepthCount() {
- instructionState.lFrame.elementDepthCount--;
- }
- function getBindingsEnabled() {
- return instructionState.bindingsEnabled;
- }
- function isInSkipHydrationBlock$1() {
- return instructionState.skipHydrationRootTNode !== null;
- }
- function isSkipHydrationRootTNode(tNode) {
- return instructionState.skipHydrationRootTNode === tNode;
- }
- function ɵɵenableBindings() {
- instructionState.bindingsEnabled = true;
- }
- function enterSkipHydrationBlock(tNode) {
- instructionState.skipHydrationRootTNode = tNode;
- }
- function ɵɵdisableBindings() {
- instructionState.bindingsEnabled = false;
- }
- function leaveSkipHydrationBlock() {
- instructionState.skipHydrationRootTNode = null;
- }
- function getLView() {
- return instructionState.lFrame.lView;
- }
- function getTView() {
- return instructionState.lFrame.tView;
- }
- function ɵɵrestoreView(viewToRestore) {
- instructionState.lFrame.contextLView = viewToRestore;
- return viewToRestore[CONTEXT];
- }
- function ɵɵresetView(value) {
- instructionState.lFrame.contextLView = null;
- return value;
- }
- function getCurrentTNode() {
- let currentTNode = getCurrentTNodePlaceholderOk();
- while (currentTNode !== null && currentTNode.type === 64) {
- currentTNode = currentTNode.parent;
- }
- return currentTNode;
- }
- function getCurrentTNodePlaceholderOk() {
- return instructionState.lFrame.currentTNode;
- }
- function getCurrentParentTNode() {
- const lFrame = instructionState.lFrame;
- const currentTNode = lFrame.currentTNode;
- return lFrame.isParent ? currentTNode : currentTNode.parent;
- }
- function setCurrentTNode(tNode, isParent) {
- ngDevMode && tNode && assertTNodeForTView(tNode, instructionState.lFrame.tView);
- const lFrame = instructionState.lFrame;
- lFrame.currentTNode = tNode;
- lFrame.isParent = isParent;
- }
- function isCurrentTNodeParent() {
- return instructionState.lFrame.isParent;
- }
- function setCurrentTNodeAsNotParent() {
- instructionState.lFrame.isParent = false;
- }
- function getContextLView() {
- const contextLView = instructionState.lFrame.contextLView;
- ngDevMode && assertDefined(contextLView, "contextLView must be defined.");
- return contextLView;
- }
- function isInCheckNoChangesMode() {
- !ngDevMode && throwError("Must never be called in production mode");
- return _isInCheckNoChangesMode;
- }
- function setIsInCheckNoChangesMode(mode) {
- !ngDevMode && throwError("Must never be called in production mode");
- _isInCheckNoChangesMode = mode;
- }
- function getBindingRoot() {
- const lFrame = instructionState.lFrame;
- let index = lFrame.bindingRootIndex;
- if (index === -1) {
- index = lFrame.bindingRootIndex = lFrame.tView.bindingStartIndex;
- }
- return index;
- }
- function getBindingIndex() {
- return instructionState.lFrame.bindingIndex;
- }
- function setBindingIndex(value) {
- return instructionState.lFrame.bindingIndex = value;
- }
- function nextBindingIndex() {
- return instructionState.lFrame.bindingIndex++;
- }
- function incrementBindingIndex(count2) {
- const lFrame = instructionState.lFrame;
- const index = lFrame.bindingIndex;
- lFrame.bindingIndex = lFrame.bindingIndex + count2;
- return index;
- }
- function isInI18nBlock() {
- return instructionState.lFrame.inI18n;
- }
- function setInI18nBlock(isInI18nBlock2) {
- instructionState.lFrame.inI18n = isInI18nBlock2;
- }
- function setBindingRootForHostBindings(bindingRootIndex, currentDirectiveIndex) {
- const lFrame = instructionState.lFrame;
- lFrame.bindingIndex = lFrame.bindingRootIndex = bindingRootIndex;
- setCurrentDirectiveIndex(currentDirectiveIndex);
- }
- function getCurrentDirectiveIndex() {
- return instructionState.lFrame.currentDirectiveIndex;
- }
- function setCurrentDirectiveIndex(currentDirectiveIndex) {
- instructionState.lFrame.currentDirectiveIndex = currentDirectiveIndex;
- }
- function getCurrentDirectiveDef(tData) {
- const currentDirectiveIndex = instructionState.lFrame.currentDirectiveIndex;
- return currentDirectiveIndex === -1 ? null : tData[currentDirectiveIndex];
- }
- function getCurrentQueryIndex() {
- return instructionState.lFrame.currentQueryIndex;
- }
- function setCurrentQueryIndex(value) {
- instructionState.lFrame.currentQueryIndex = value;
- }
- function getDeclarationTNode(lView) {
- const tView = lView[TVIEW];
- if (tView.type === 2) {
- ngDevMode && assertDefined(tView.declTNode, "Embedded TNodes should have declaration parents.");
- return tView.declTNode;
- }
- if (tView.type === 1) {
- return lView[T_HOST];
- }
- return null;
- }
- function enterDI(lView, tNode, flags) {
- ngDevMode && assertLViewOrUndefined(lView);
- if (flags & InjectFlags.SkipSelf) {
- ngDevMode && assertTNodeForTView(tNode, lView[TVIEW]);
- let parentTNode = tNode;
- let parentLView = lView;
- while (true) {
- ngDevMode && assertDefined(parentTNode, "Parent TNode should be defined");
- parentTNode = parentTNode.parent;
- if (parentTNode === null && !(flags & InjectFlags.Host)) {
- parentTNode = getDeclarationTNode(parentLView);
- if (parentTNode === null)
- break;
- ngDevMode && assertDefined(parentLView, "Parent LView should be defined");
- parentLView = parentLView[DECLARATION_VIEW];
- if (parentTNode.type & (2 | 8)) {
- break;
- }
- } else {
- break;
- }
- }
- if (parentTNode === null) {
- return false;
- } else {
- tNode = parentTNode;
- lView = parentLView;
- }
- }
- ngDevMode && assertTNodeForLView(tNode, lView);
- const lFrame = instructionState.lFrame = allocLFrame();
- lFrame.currentTNode = tNode;
- lFrame.lView = lView;
- return true;
- }
- function enterView(newView) {
- ngDevMode && assertNotEqual(newView[0], newView[1], "????");
- ngDevMode && assertLViewOrUndefined(newView);
- const newLFrame = allocLFrame();
- if (ngDevMode) {
- assertEqual(newLFrame.isParent, true, "Expected clean LFrame");
- assertEqual(newLFrame.lView, null, "Expected clean LFrame");
- assertEqual(newLFrame.tView, null, "Expected clean LFrame");
- assertEqual(newLFrame.selectedIndex, -1, "Expected clean LFrame");
- assertEqual(newLFrame.elementDepthCount, 0, "Expected clean LFrame");
- assertEqual(newLFrame.currentDirectiveIndex, -1, "Expected clean LFrame");
- assertEqual(newLFrame.currentNamespace, null, "Expected clean LFrame");
- assertEqual(newLFrame.bindingRootIndex, -1, "Expected clean LFrame");
- assertEqual(newLFrame.currentQueryIndex, 0, "Expected clean LFrame");
- }
- const tView = newView[TVIEW];
- instructionState.lFrame = newLFrame;
- ngDevMode && tView.firstChild && assertTNodeForTView(tView.firstChild, tView);
- newLFrame.currentTNode = tView.firstChild;
- newLFrame.lView = newView;
- newLFrame.tView = tView;
- newLFrame.contextLView = newView;
- newLFrame.bindingIndex = tView.bindingStartIndex;
- newLFrame.inI18n = false;
- }
- function allocLFrame() {
- const currentLFrame = instructionState.lFrame;
- const childLFrame = currentLFrame === null ? null : currentLFrame.child;
- const newLFrame = childLFrame === null ? createLFrame(currentLFrame) : childLFrame;
- return newLFrame;
- }
- function createLFrame(parent) {
- const lFrame = {
- currentTNode: null,
- isParent: true,
- lView: null,
- tView: null,
- selectedIndex: -1,
- contextLView: null,
- elementDepthCount: 0,
- currentNamespace: null,
- currentDirectiveIndex: -1,
- bindingRootIndex: -1,
- bindingIndex: -1,
- currentQueryIndex: 0,
- parent,
- child: null,
- inI18n: false
- };
- parent !== null && (parent.child = lFrame);
- return lFrame;
- }
- function leaveViewLight() {
- const oldLFrame = instructionState.lFrame;
- instructionState.lFrame = oldLFrame.parent;
- oldLFrame.currentTNode = null;
- oldLFrame.lView = null;
- return oldLFrame;
- }
- var leaveDI = leaveViewLight;
- function leaveView() {
- const oldLFrame = leaveViewLight();
- oldLFrame.isParent = true;
- oldLFrame.tView = null;
- oldLFrame.selectedIndex = -1;
- oldLFrame.contextLView = null;
- oldLFrame.elementDepthCount = 0;
- oldLFrame.currentDirectiveIndex = -1;
- oldLFrame.currentNamespace = null;
- oldLFrame.bindingRootIndex = -1;
- oldLFrame.bindingIndex = -1;
- oldLFrame.currentQueryIndex = 0;
- }
- function nextContextImpl(level) {
- const contextLView = instructionState.lFrame.contextLView = walkUpViews(level, instructionState.lFrame.contextLView);
- return contextLView[CONTEXT];
- }
- function getSelectedIndex() {
- return instructionState.lFrame.selectedIndex;
- }
- function setSelectedIndex(index) {
- ngDevMode && index !== -1 && assertGreaterThanOrEqual(index, HEADER_OFFSET, "Index must be past HEADER_OFFSET (or -1).");
- ngDevMode && assertLessThan(index, instructionState.lFrame.lView.length, "Can't set index passed end of LView");
- instructionState.lFrame.selectedIndex = index;
- }
- function getSelectedTNode() {
- const lFrame = instructionState.lFrame;
- return getTNode(lFrame.tView, lFrame.selectedIndex);
- }
- function ɵɵnamespaceSVG() {
- instructionState.lFrame.currentNamespace = SVG_NAMESPACE;
- }
- function ɵɵnamespaceMathML() {
- instructionState.lFrame.currentNamespace = MATH_ML_NAMESPACE;
- }
- function ɵɵnamespaceHTML() {
- namespaceHTMLInternal();
- }
- function namespaceHTMLInternal() {
- instructionState.lFrame.currentNamespace = null;
- }
- function getNamespace$1() {
- return instructionState.lFrame.currentNamespace;
- }
- var _wasLastNodeCreated = true;
- function wasLastNodeCreated() {
- return _wasLastNodeCreated;
- }
- function lastNodeWasCreated(flag) {
- _wasLastNodeCreated = flag;
- }
- function injectElementRef() {
- return createElementRef(getCurrentTNode(), getLView());
- }
- function createElementRef(tNode, lView) {
- return new ElementRef(getNativeByTNode(tNode, lView));
- }
- var _ElementRef = class _ElementRef {
- constructor(nativeElement) {
- this.nativeElement = nativeElement;
- }
- };
- _ElementRef.__NG_ELEMENT_ID__ = injectElementRef;
- var ElementRef = _ElementRef;
- function unwrapElementRef(value) {
- return value instanceof ElementRef ? value.nativeElement : value;
- }
- function arrayEquals(a, b, identityAccessor) {
- if (a.length !== b.length)
- return false;
- for (let i = 0; i < a.length; i++) {
- let valueA = a[i];
- let valueB = b[i];
- if (identityAccessor) {
- valueA = identityAccessor(valueA);
- valueB = identityAccessor(valueB);
- }
- if (valueB !== valueA) {
- return false;
- }
- }
- return true;
- }
- function flatten(list) {
- return list.flat(Number.POSITIVE_INFINITY);
- }
- function deepForEach(input2, fn) {
- input2.forEach((value) => Array.isArray(value) ? deepForEach(value, fn) : fn(value));
- }
- function addToArray(arr, index, value) {
- if (index >= arr.length) {
- arr.push(value);
- } else {
- arr.splice(index, 0, value);
- }
- }
- function removeFromArray(arr, index) {
- if (index >= arr.length - 1) {
- return arr.pop();
- } else {
- return arr.splice(index, 1)[0];
- }
- }
- function newArray(size, value) {
- const list = [];
- for (let i = 0; i < size; i++) {
- list.push(value);
- }
- return list;
- }
- function arraySplice(array, index, count2) {
- const length = array.length - count2;
- while (index < length) {
- array[index] = array[index + count2];
- index++;
- }
- while (count2--) {
- array.pop();
- }
- }
- function arrayInsert2(array, index, value1, value2) {
- ngDevMode && assertLessThanOrEqual(index, array.length, "Can't insert past array end.");
- let end = array.length;
- if (end == index) {
- array.push(value1, value2);
- } else if (end === 1) {
- array.push(value2, array[0]);
- array[0] = value1;
- } else {
- end--;
- array.push(array[end - 1], array[end]);
- while (end > index) {
- const previousEnd = end - 2;
- array[end] = array[previousEnd];
- end--;
- }
- array[index] = value1;
- array[index + 1] = value2;
- }
- }
- function keyValueArraySet(keyValueArray, key, value) {
- let index = keyValueArrayIndexOf(keyValueArray, key);
- if (index >= 0) {
- keyValueArray[index | 1] = value;
- } else {
- index = ~index;
- arrayInsert2(keyValueArray, index, key, value);
- }
- return index;
- }
- function keyValueArrayGet(keyValueArray, key) {
- const index = keyValueArrayIndexOf(keyValueArray, key);
- if (index >= 0) {
- return keyValueArray[index | 1];
- }
- return void 0;
- }
- function keyValueArrayIndexOf(keyValueArray, key) {
- return _arrayIndexOfSorted(keyValueArray, key, 1);
- }
- function _arrayIndexOfSorted(array, value, shift) {
- ngDevMode && assertEqual(Array.isArray(array), true, "Expecting an array");
- let start = 0;
- let end = array.length >> shift;
- while (end !== start) {
- const middle = start + (end - start >> 1);
- const current = array[middle << shift];
- if (value === current) {
- return middle << shift;
- } else if (current > value) {
- end = middle;
- } else {
- start = middle + 1;
- }
- }
- return ~(end << shift);
- }
- function symbolIterator() {
- return this._results[Symbol.iterator]();
- }
- var _QueryList = class _QueryList {
- /**
- * Returns `Observable` of `QueryList` notifying the subscriber of changes.
- */
- get changes() {
- return this._changes ??= new EventEmitter();
- }
- /**
- * @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;
- this.dirty = true;
- this._onDirty = void 0;
- this._results = [];
- this._changesDetected = false;
- this._changes = void 0;
- this.length = 0;
- this.first = void 0;
- this.last = void 0;
- const proto = _QueryList.prototype;
- if (!proto[Symbol.iterator])
- proto[Symbol.iterator] = symbolIterator;
- }
- /**
- * 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.emit(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;
- var QueryList = _QueryList;
- 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 isInSkipHydrationBlock(tNode) {
- if (hasInSkipHydrationBlockFlag(tNode)) {
- return true;
- }
- let currentTNode = tNode.parent;
- while (currentTNode) {
- if (hasInSkipHydrationBlockFlag(tNode) || hasSkipHydrationAttrOnTNode(currentTNode)) {
- return true;
- }
- currentTNode = currentTNode.parent;
- }
- return false;
- }
- 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.`);
- }
- function ɵɵdefineInjectable(opts) {
- return {
- token: opts.token,
- providedIn: opts.providedIn || null,
- factory: opts.factory,
- value: void 0
- };
- }
- var defineInjectable = ɵɵdefineInjectable;
- function ɵɵdefineInjector(options) {
- return { providers: options.providers || [], imports: options.imports || [] };
- }
- function getInjectableDef(type) {
- return getOwnDefinition(type, NG_PROV_DEF) || getOwnDefinition(type, NG_INJECTABLE_DEF);
- }
- function isInjectable(type) {
- return getInjectableDef(type) !== null;
- }
- function getOwnDefinition(type, field) {
- return type.hasOwnProperty(field) ? type[field] : null;
- }
- function getInheritedInjectableDef(type) {
- const def = type && (type[NG_PROV_DEF] || type[NG_INJECTABLE_DEF]);
- if (def) {
- ngDevMode && console.warn(`DEPRECATED: DI is instantiating a token "${type.name}" that inherits its @Injectable decorator but does not provide one itself.
- This will become an error in a future version of Angular. Please add @Injectable() to the "${type.name}" class.`);
- return def;
- } else {
- return null;
- }
- }
- function getInjectorDef(type) {
- return type && (type.hasOwnProperty(NG_INJ_DEF) || type.hasOwnProperty(NG_INJECTOR_DEF)) ? type[NG_INJ_DEF] : null;
- }
- var NG_PROV_DEF = getClosureSafeProperty({ ɵprov: getClosureSafeProperty });
- var NG_INJ_DEF = getClosureSafeProperty({ ɵinj: getClosureSafeProperty });
- var NG_INJECTABLE_DEF = getClosureSafeProperty({ ngInjectableDef: getClosureSafeProperty });
- var NG_INJECTOR_DEF = getClosureSafeProperty({ ngInjectorDef: getClosureSafeProperty });
- var InjectionToken = class {
- /**
- * @param _desc Description for the token,
- * used only for debugging purposes,
- * it should but does not need to be unique
- * @param options Options for the token's usage, as described above
- */
- constructor(_desc, options) {
- this._desc = _desc;
- this.ngMetadataName = "InjectionToken";
- this.ɵprov = void 0;
- if (typeof options == "number") {
- (typeof ngDevMode === "undefined" || ngDevMode) && assertLessThan(options, 0, "Only negative numbers are supported here");
- this.__NG_ELEMENT_ID__ = options;
- } else if (options !== void 0) {
- this.ɵprov = ɵɵdefineInjectable({
- token: this,
- providedIn: options.providedIn || "root",
- factory: options.factory
- });
- }
- }
- /**
- * @internal
- */
- get multi() {
- return this;
- }
- toString() {
- return `InjectionToken ${this._desc}`;
- }
- };
- 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 });
- var __forward_ref__ = getClosureSafeProperty({ __forward_ref__: getClosureSafeProperty });
- function forwardRef(forwardRefFn) {
- forwardRefFn.__forward_ref__ = forwardRef;
- forwardRefFn.toString = function() {
- return stringify(this());
- };
- return forwardRefFn;
- }
- function resolveForwardRef(type) {
- return isForwardRef(type) ? type() : type;
- }
- function isForwardRef(fn) {
- return typeof fn === "function" && fn.hasOwnProperty(__forward_ref__) && fn.__forward_ref__ === forwardRef;
- }
- var _injectorProfilerContext;
- function getInjectorProfilerContext() {
- !ngDevMode && throwError("getInjectorProfilerContext should never be called in production mode");
- return _injectorProfilerContext;
- }
- function setInjectorProfilerContext(context) {
- !ngDevMode && throwError("setInjectorProfilerContext should never be called in production mode");
- const previous = _injectorProfilerContext;
- _injectorProfilerContext = context;
- return previous;
- }
- var injectorProfilerCallback = null;
- var setInjectorProfiler = (injectorProfiler2) => {
- !ngDevMode && throwError("setInjectorProfiler should never be called in production mode");
- injectorProfilerCallback = injectorProfiler2;
- };
- function injectorProfiler(event) {
- !ngDevMode && throwError("Injector profiler should never be called in production mode");
- if (injectorProfilerCallback != null) {
- injectorProfilerCallback(event);
- }
- }
- function emitProviderConfiguredEvent(eventProvider, isViewProvider = false) {
- !ngDevMode && throwError("Injector profiler should never be called in production mode");
- let token;
- if (typeof eventProvider === "function") {
- token = eventProvider;
- } else if (eventProvider instanceof InjectionToken) {
- token = eventProvider;
- } else {
- token = resolveForwardRef(eventProvider.provide);
- }
- let provider = eventProvider;
- if (eventProvider instanceof InjectionToken) {
- provider = eventProvider.ɵprov || eventProvider;
- }
- injectorProfiler({
- type: 2,
- context: getInjectorProfilerContext(),
- providerRecord: { token, provider, isViewProvider }
- });
- }
- function emitInstanceCreatedByInjectorEvent(instance) {
- !ngDevMode && throwError("Injector profiler should never be called in production mode");
- injectorProfiler({
- type: 1,
- context: getInjectorProfilerContext(),
- instance: { value: instance }
- });
- }
- function emitInjectEvent(token, value, flags) {
- !ngDevMode && throwError("Injector profiler should never be called in production mode");
- injectorProfiler({
- type: 0,
- context: getInjectorProfilerContext(),
- service: { token, value, flags }
- });
- }
- function runInInjectorProfilerContext(injector, token, callback) {
- !ngDevMode && throwError("runInInjectorProfilerContext should never be called in production mode");
- const prevInjectContext = setInjectorProfilerContext({ injector, token });
- try {
- callback();
- } finally {
- setInjectorProfilerContext(prevInjectContext);
- }
- }
- function isEnvironmentProviders(value) {
- return value && !!value.ɵproviders;
- }
- function renderStringify(value) {
- if (typeof value === "string")
- return value;
- if (value == null)
- return "";
- return String(value);
- }
- function stringifyForError(value) {
- if (typeof value === "function")
- return value.name || value.toString();
- if (typeof value === "object" && value != null && typeof value.type === "function") {
- return value.type.name || value.type.toString();
- }
- return renderStringify(value);
- }
- function debugStringifyTypeForError(type) {
- let componentDef = type[NG_COMP_DEF] || null;
- if (componentDef !== null && componentDef.debugInfo) {
- return stringifyTypeFromDebugInfo(componentDef.debugInfo);
- }
- return stringifyForError(type);
- }
- function stringifyTypeFromDebugInfo(debugInfo) {
- if (!debugInfo.filePath || !debugInfo.lineNumber) {
- return debugInfo.className;
- } else {
- return `${debugInfo.className} (at ${debugInfo.filePath}:${debugInfo.lineNumber})`;
- }
- }
- function throwCyclicDependencyError(token, path) {
- const depPath = path ? `. Dependency path: ${path.join(" > ")} > ${token}` : "";
- throw new RuntimeError(-200, ngDevMode ? `Circular dependency in DI detected for ${token}${depPath}` : token);
- }
- function throwMixedMultiProviderError() {
- throw new Error(`Cannot mix multi providers and regular providers`);
- }
- function throwInvalidProviderError(ngModuleType, providers, provider) {
- if (ngModuleType && providers) {
- const providerDetail = providers.map((v) => v == provider ? "?" + provider + "?" : "...");
- throw new Error(`Invalid provider for the NgModule '${stringify(ngModuleType)}' - only instances of Provider and Type are allowed, got: [${providerDetail.join(", ")}]`);
- } else if (isEnvironmentProviders(provider)) {
- if (provider.ɵfromNgModule) {
- throw new RuntimeError(207, `Invalid providers from 'importProvidersFrom' present in a non-environment injector. 'importProvidersFrom' can't be used for component providers.`);
- } else {
- throw new RuntimeError(207, `Invalid providers present in a non-environment injector. 'EnvironmentProviders' can't be used for component providers.`);
- }
- } else {
- throw new Error("Invalid provider");
- }
- }
- function throwProviderNotFoundError(token, injectorName) {
- const errorMessage = ngDevMode && `No provider for ${stringifyForError(token)} found${injectorName ? ` in ${injectorName}` : ""}`;
- throw new RuntimeError(-201, errorMessage);
- }
- var _injectImplementation;
- function getInjectImplementation() {
- return _injectImplementation;
- }
- function setInjectImplementation(impl) {
- const previous = _injectImplementation;
- _injectImplementation = impl;
- return previous;
- }
- function injectRootLimpMode(token, notFoundValue, flags) {
- const injectableDef = getInjectableDef(token);
- if (injectableDef && injectableDef.providedIn == "root") {
- return injectableDef.value === void 0 ? injectableDef.value = injectableDef.factory() : injectableDef.value;
- }
- if (flags & InjectFlags.Optional)
- return null;
- if (notFoundValue !== void 0)
- return notFoundValue;
- throwProviderNotFoundError(token, "Injector");
- }
- function assertInjectImplementationNotEqual(fn) {
- ngDevMode && assertNotEqual(_injectImplementation, fn, "Calling ɵɵinject would cause infinite recursion");
- }
- var _THROW_IF_NOT_FOUND = {};
- var THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
- var DI_DECORATOR_FLAG = "__NG_DI_FLAG__";
- var NG_TEMP_TOKEN_PATH = "ngTempTokenPath";
- var NG_TOKEN_PATH = "ngTokenPath";
- var NEW_LINE = /\n/gm;
- var NO_NEW_LINE = "ɵ";
- var SOURCE = "__source";
- var _currentInjector = void 0;
- function getCurrentInjector() {
- return _currentInjector;
- }
- function setCurrentInjector(injector) {
- const former = _currentInjector;
- _currentInjector = injector;
- return former;
- }
- function injectInjectorOnly(token, flags = InjectFlags.Default) {
- if (_currentInjector === void 0) {
- throw new RuntimeError(-203, ngDevMode && `inject() must be called from an injection context such as a constructor, a factory function, a field initializer, or a function used with \`runInInjectionContext\`.`);
- } else if (_currentInjector === null) {
- return injectRootLimpMode(token, void 0, flags);
- } else {
- const value = _currentInjector.get(token, flags & InjectFlags.Optional ? null : void 0, flags);
- ngDevMode && emitInjectEvent(token, value, flags);
- return value;
- }
- }
- function ɵɵinject(token, flags = InjectFlags.Default) {
- return (getInjectImplementation() || injectInjectorOnly)(resolveForwardRef(token), flags);
- }
- function ɵɵinvalidFactoryDep(index) {
- throw new RuntimeError(202, ngDevMode && `This constructor is not compatible with Angular Dependency Injection because its dependency at index ${index} of the parameter list is invalid.
- This can happen if the dependency type is a primitive like a string or if an ancestor of this class is missing an Angular decorator.
-
- Please check that 1) the type for the parameter at index ${index} is correct and 2) the correct Angular decorators are defined for this class and its ancestors.`);
- }
- function inject(token, flags = InjectFlags.Default) {
- return ɵɵinject(token, convertToBitFlags(flags));
- }
- function convertToBitFlags(flags) {
- if (typeof flags === "undefined" || typeof flags === "number") {
- return flags;
- }
- return 0 | // comment to force a line break in the formatter
- (flags.optional && 8) | (flags.host && 1) | (flags.self && 2) | (flags.skipSelf && 4);
- }
- function injectArgs(types) {
- const args = [];
- for (let i = 0; i < types.length; i++) {
- const arg = resolveForwardRef(types[i]);
- if (Array.isArray(arg)) {
- if (arg.length === 0) {
- throw new RuntimeError(900, ngDevMode && "Arguments array must have arguments.");
- }
- let type = void 0;
- let flags = InjectFlags.Default;
- for (let j = 0; j < arg.length; j++) {
- const meta = arg[j];
- const flag = getInjectFlag(meta);
- if (typeof flag === "number") {
- if (flag === -1) {
- type = meta.token;
- } else {
- flags |= flag;
- }
- } else {
- type = meta;
- }
- }
- args.push(ɵɵinject(type, flags));
- } else {
- args.push(ɵɵinject(arg));
- }
- }
- return args;
- }
- function attachInjectFlag(decorator, flag) {
- decorator[DI_DECORATOR_FLAG] = flag;
- decorator.prototype[DI_DECORATOR_FLAG] = flag;
- return decorator;
- }
- function getInjectFlag(token) {
- return token[DI_DECORATOR_FLAG];
- }
- function catchInjectorError(e, token, injectorErrorName, source) {
- const tokenPath = e[NG_TEMP_TOKEN_PATH];
- if (token[SOURCE]) {
- tokenPath.unshift(token[SOURCE]);
- }
- e.message = formatError("\n" + e.message, tokenPath, injectorErrorName, source);
- e[NG_TOKEN_PATH] = tokenPath;
- e[NG_TEMP_TOKEN_PATH] = null;
- throw e;
- }
- function formatError(text, obj, injectorErrorName, source = null) {
- text = text && text.charAt(0) === "\n" && text.charAt(1) == NO_NEW_LINE ? text.slice(2) : text;
- let context = stringify(obj);
- if (Array.isArray(obj)) {
- context = obj.map(stringify).join(" -> ");
- } else if (typeof obj === "object") {
- let parts = [];
- for (let key in obj) {
- if (obj.hasOwnProperty(key)) {
- let value = obj[key];
- parts.push(key + ":" + (typeof value === "string" ? JSON.stringify(value) : stringify(value)));
- }
- }
- context = `{${parts.join(", ")}}`;
- }
- return `${injectorErrorName}${source ? "(" + source + ")" : ""}[${context}]: ${text.replace(NEW_LINE, "\n ")}`;
- }
- function makeStateKey(key) {
- return key;
- }
- function initTransferState() {
- const transferState = new TransferState();
- if (inject(PLATFORM_ID) === "browser") {
- transferState.store = retrieveTransferredState(getDocument(), inject(APP_ID));
- }
- return transferState;
- }
- var _TransferState = class _TransferState {
- constructor() {
- this.store = {};
- this.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(/</g, "\\u003C");
- }
- };
- _TransferState.ɵprov = /** @pureOrBreakMyCode */
- ɵɵdefineInjectable({
- token: _TransferState,
- providedIn: "root",
- factory: initTransferState
- });
- var TransferState = _TransferState;
- function retrieveTransferredState(doc, appId) {
- const script = doc.getElementById(appId + "-state");
- if (script?.textContent) {
- try {
- return JSON.parse(script.textContent);
- } catch (e) {
- console.warn("Exception while restoring TransferState for app " + appId, e);
- }
- }
- return {};
- }
- var REFERENCE_NODE_HOST = "h";
- var REFERENCE_NODE_BODY = "b";
- var NodeNavigationStep;
- (function(NodeNavigationStep2) {
- NodeNavigationStep2["FirstChild"] = "f";
- NodeNavigationStep2["NextSibling"] = "n";
- })(NodeNavigationStep || (NodeNavigationStep = {}));
- var ELEMENT_CONTAINERS = "e";
- var TEMPLATES = "t";
- var CONTAINERS = "c";
- var MULTIPLIER = "x";
- var NUM_ROOT_NODES = "r";
- var TEMPLATE_ID = "i";
- var NODES = "n";
- var DISCONNECTED_NODES = "d";
- var TRANSFER_STATE_TOKEN_ID = "__nghData__";
- var NGH_DATA_KEY = makeStateKey(TRANSFER_STATE_TOKEN_ID);
- 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 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 && readHydrationInfo(node)?.status !== HydrationStatus.Hydrated) {
- 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 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 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 isDisconnectedNode$1(hydrationInfo, index) {
- if (typeof hydrationInfo.disconnectedNodes === "undefined") {
- const nodeIds = hydrationInfo.data[DISCONNECTED_NODES];
- hydrationInfo.disconnectedNodes = nodeIds ? new Set(nodeIds) : null;
- }
- return !!hydrationInfo.disconnectedNodes?.has(index);
- }
- 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);
- if (additionalProcessing)
- additionalProcessing(cls);
- 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;
- }
- }
- if (parentClass) {
- ParamDecoratorFactory.prototype = Object.create(parentClass.prototype);
- }
- 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);
- if (additionalProcessing)
- additionalProcessing(target, name2, ...args);
- }
- 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.
- // tslint:disable-next-line: no-toplevel-property-access
- 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 getFactoryDef(type, throwNotFound) {
- const hasFactoryDef = type.hasOwnProperty(NG_FACTORY_DEF);
- if (!hasFactoryDef && throwNotFound === true && ngDevMode) {
- throw new Error(`Type ${stringify(type)} does not have 'ɵfac' property.`);
- }
- return hasFactoryDef ? type[NG_FACTORY_DEF] : null;
- }
- var ENVIRONMENT_INITIALIZER = new InjectionToken(ngDevMode ? "ENVIRONMENT_INITIALIZER" : "");
- var INJECTOR = new InjectionToken(
- ngDevMode ? "INJECTOR" : "",
- // Disable tslint because this is const enum which gets inlined not top level prop access.
- // tslint:disable-next-line: no-toplevel-property-access
- -1
- /* InjectorMarkers.Injector */
- );
- var INJECTOR_DEF_TYPES = new InjectionToken(ngDevMode ? "INJECTOR_DEF_TYPES" : "");
- var NullInjector = class {
- get(token, notFoundValue = THROW_IF_NOT_FOUND) {
- if (notFoundValue === THROW_IF_NOT_FOUND) {
- const error = new Error(`NullInjectorError: No provider for ${stringify(token)}!`);
- error.name = "NullInjectorError";
- throw error;
- }
- return notFoundValue;
- }
- };
- function makeEnvironmentProviders(providers) {
- return {
- ɵproviders: providers
- };
- }
- function importProvidersFrom(...sources) {
- return {
- ɵproviders: internalImportProvidersFrom(true, sources),
- ɵfromNgModule: true
- };
- }
- function internalImportProvidersFrom(checkForStandaloneCmp, ...sources) {
- const providersOut = [];
- const dedup = /* @__PURE__ */ new Set();
- let injectorTypesWithProviders;
- const collectProviders = (provider) => {
- providersOut.push(provider);
- };
- deepForEach(sources, (source) => {
- if ((typeof ngDevMode === "undefined" || ngDevMode) && checkForStandaloneCmp) {
- const cmpDef = getComponentDef(source);
- if (cmpDef?.standalone) {
- throw new RuntimeError(800, `Importing providers supports NgModule or ModuleWithProviders but got a standalone component "${stringifyForError(source)}"`);
- }
- }
- const internalSource = source;
- if (walkProviderTree(internalSource, collectProviders, [], dedup)) {
- injectorTypesWithProviders ||= [];
- injectorTypesWithProviders.push(internalSource);
- }
- });
- if (injectorTypesWithProviders !== void 0) {
- processInjectorTypesWithProviders(injectorTypesWithProviders, collectProviders);
- }
- return providersOut;
- }
- function processInjectorTypesWithProviders(typesWithProviders, visitor) {
- for (let i = 0; i < typesWithProviders.length; i++) {
- const { ngModule, providers } = typesWithProviders[i];
- deepForEachProvider(providers, (provider) => {
- ngDevMode && validateProvider(provider, providers || EMPTY_ARRAY, ngModule);
- visitor(provider, ngModule);
- });
- }
- }
- function walkProviderTree(container, visitor, parents, dedup) {
- container = resolveForwardRef(container);
- if (!container)
- return false;
- let defType = null;
- let injDef = getInjectorDef(container);
- const cmpDef = !injDef && getComponentDef(container);
- if (!injDef && !cmpDef) {
- const ngModule = container.ngModule;
- injDef = getInjectorDef(ngModule);
- if (injDef) {
- defType = ngModule;
- } else {
- return false;
- }
- } else if (cmpDef && !cmpDef.standalone) {
- return false;
- } else {
- defType = container;
- }
- if (ngDevMode && parents.indexOf(defType) !== -1) {
- const defName = stringify(defType);
- const path = parents.map(stringify);
- throwCyclicDependencyError(defName, path);
- }
- const isDuplicate = dedup.has(defType);
- if (cmpDef) {
- if (isDuplicate) {
- return false;
- }
- dedup.add(defType);
- if (cmpDef.dependencies) {
- const deps = typeof cmpDef.dependencies === "function" ? cmpDef.dependencies() : cmpDef.dependencies;
- for (const dep of deps) {
- walkProviderTree(dep, visitor, parents, dedup);
- }
- }
- } else if (injDef) {
- if (injDef.imports != null && !isDuplicate) {
- ngDevMode && parents.push(defType);
- dedup.add(defType);
- let importTypesWithProviders;
- try {
- deepForEach(injDef.imports, (imported) => {
- if (walkProviderTree(imported, visitor, parents, dedup)) {
- importTypesWithProviders ||= [];
- importTypesWithProviders.push(imported);
- }
- });
- } finally {
- ngDevMode && parents.pop();
- }
- if (importTypesWithProviders !== void 0) {
- processInjectorTypesWithProviders(importTypesWithProviders, visitor);
- }
- }
- if (!isDuplicate) {
- const factory = getFactoryDef(defType) || (() => new defType());
- visitor({ provide: defType, useFactory: factory, deps: EMPTY_ARRAY }, defType);
- visitor({ provide: INJECTOR_DEF_TYPES, useValue: defType, multi: true }, defType);
- visitor({ provide: ENVIRONMENT_INITIALIZER, useValue: () => ɵɵinject(defType), multi: true }, defType);
- }
- const defProviders = injDef.providers;
- if (defProviders != null && !isDuplicate) {
- const injectorType = container;
- deepForEachProvider(defProviders, (provider) => {
- ngDevMode && validateProvider(provider, defProviders, injectorType);
- visitor(provider, injectorType);
- });
- }
- } else {
- return false;
- }
- return defType !== container && container.providers !== void 0;
- }
- function validateProvider(provider, providers, containerType) {
- if (isTypeProvider(provider) || isValueProvider(provider) || isFactoryProvider(provider) || isExistingProvider(provider)) {
- return;
- }
- const classRef = resolveForwardRef(provider && (provider.useClass || provider.provide));
- if (!classRef) {
- throwInvalidProviderError(containerType, providers, provider);
- }
- }
- function deepForEachProvider(providers, fn) {
- for (let provider of providers) {
- if (isEnvironmentProviders(provider)) {
- provider = provider.ɵproviders;
- }
- if (Array.isArray(provider)) {
- deepForEachProvider(provider, fn);
- } else {
- fn(provider);
- }
- }
- }
- var USE_VALUE$1 = getClosureSafeProperty({ provide: String, useValue: getClosureSafeProperty });
- function isValueProvider(value) {
- return value !== null && typeof value == "object" && USE_VALUE$1 in value;
- }
- function isExistingProvider(value) {
- return !!(value && value.useExisting);
- }
- function isFactoryProvider(value) {
- return !!(value && value.useFactory);
- }
- function isTypeProvider(value) {
- return typeof value === "function";
- }
- function isClassProvider(value) {
- return !!value.useClass;
- }
- var INJECTOR_SCOPE = new InjectionToken(ngDevMode ? "Set Injector scope." : "");
- var NOT_YET = {};
- var CIRCULAR = {};
- var NULL_INJECTOR = void 0;
- function getNullInjector() {
- if (NULL_INJECTOR === void 0) {
- NULL_INJECTOR = new NullInjector();
- }
- return NULL_INJECTOR;
- }
- var EnvironmentInjector = class {
- };
- var R3Injector = class extends EnvironmentInjector {
- /**
- * Flag indicating that this injector was previously destroyed.
- */
- get destroyed() {
- return this._destroyed;
- }
- constructor(providers, parent, source, scopes) {
- super();
- this.parent = parent;
- this.source = source;
- this.scopes = scopes;
- this.records = /* @__PURE__ */ new Map();
- this._ngOnDestroyHooks = /* @__PURE__ */ new Set();
- this._onDestroyHooks = [];
- this._destroyed = false;
- forEachSingleProvider(providers, (provider) => this.processProvider(provider));
- this.records.set(INJECTOR, makeRecord(void 0, this));
- if (scopes.has("environment")) {
- this.records.set(EnvironmentInjector, makeRecord(void 0, this));
- }
- const record = this.records.get(INJECTOR_SCOPE);
- if (record != null && typeof record.value === "string") {
- this.scopes.add(record.value);
- }
- this.injectorDefTypes = new Set(this.get(INJECTOR_DEF_TYPES, EMPTY_ARRAY, InjectFlags.Self));
- }
- /**
- * Destroy the injector and release references to every instance or provider associated with it.
- *
- * Also calls the `OnDestroy` lifecycle hooks of every instance that was created for which a
- * hook was found.
- */
- destroy() {
- this.assertNotDestroyed();
- this._destroyed = true;
- try {
- for (const service of this._ngOnDestroyHooks) {
- service.ngOnDestroy();
- }
- const onDestroyHooks = this._onDestroyHooks;
- this._onDestroyHooks = [];
- for (const hook of onDestroyHooks) {
- hook();
- }
- } finally {
- this.records.clear();
- this._ngOnDestroyHooks.clear();
- this.injectorDefTypes.clear();
- }
- }
- onDestroy(callback) {
- this.assertNotDestroyed();
- this._onDestroyHooks.push(callback);
- return () => this.removeOnDestroy(callback);
- }
- runInContext(fn) {
- this.assertNotDestroyed();
- const previousInjector = setCurrentInjector(this);
- const previousInjectImplementation = setInjectImplementation(void 0);
- let prevInjectContext;
- if (ngDevMode) {
- prevInjectContext = setInjectorProfilerContext({ injector: this, token: null });
- }
- try {
- return fn();
- } finally {
- setCurrentInjector(previousInjector);
- setInjectImplementation(previousInjectImplementation);
- ngDevMode && setInjectorProfilerContext(prevInjectContext);
- }
- }
- get(token, notFoundValue = THROW_IF_NOT_FOUND, flags = InjectFlags.Default) {
- this.assertNotDestroyed();
- if (token.hasOwnProperty(NG_ENV_ID)) {
- return token[NG_ENV_ID](this);
- }
- flags = convertToBitFlags(flags);
- let prevInjectContext;
- if (ngDevMode) {
- prevInjectContext = setInjectorProfilerContext({ injector: this, token });
- }
- const previousInjector = setCurrentInjector(this);
- const previousInjectImplementation = setInjectImplementation(void 0);
- try {
- if (!(flags & InjectFlags.SkipSelf)) {
- let record = this.records.get(token);
- if (record === void 0) {
- const def = couldBeInjectableType(token) && getInjectableDef(token);
- if (def && this.injectableDefInScope(def)) {
- if (ngDevMode) {
- runInInjectorProfilerContext(this, token, () => {
- emitProviderConfiguredEvent(token);
- });
- }
- record = makeRecord(injectableDefOrInjectorDefFactory(token), NOT_YET);
- } else {
- record = null;
- }
- this.records.set(token, record);
- }
- if (record != null) {
- return this.hydrate(token, record);
- }
- }
- const nextInjector = !(flags & InjectFlags.Self) ? this.parent : getNullInjector();
- notFoundValue = flags & InjectFlags.Optional && notFoundValue === THROW_IF_NOT_FOUND ? null : notFoundValue;
- return nextInjector.get(token, notFoundValue);
- } catch (e) {
- if (e.name === "NullInjectorError") {
- const path = e[NG_TEMP_TOKEN_PATH] = e[NG_TEMP_TOKEN_PATH] || [];
- path.unshift(stringify(token));
- if (previousInjector) {
- throw e;
- } else {
- return catchInjectorError(e, token, "R3InjectorError", this.source);
- }
- } else {
- throw e;
- }
- } finally {
- setInjectImplementation(previousInjectImplementation);
- setCurrentInjector(previousInjector);
- ngDevMode && setInjectorProfilerContext(prevInjectContext);
- }
- }
- /** @internal */
- resolveInjectorInitializers() {
- const previousInjector = setCurrentInjector(this);
- const previousInjectImplementation = setInjectImplementation(void 0);
- let prevInjectContext;
- if (ngDevMode) {
- prevInjectContext = setInjectorProfilerContext({ injector: this, token: null });
- }
- try {
- const initializers = this.get(ENVIRONMENT_INITIALIZER, EMPTY_ARRAY, InjectFlags.Self);
- if (ngDevMode && !Array.isArray(initializers)) {
- throw new RuntimeError(-209, `Unexpected type of the \`ENVIRONMENT_INITIALIZER\` token value (expected an array, but got ${typeof initializers}). Please check that the \`ENVIRONMENT_INITIALIZER\` token is configured as a \`multi: true\` provider.`);
- }
- for (const initializer of initializers) {
- initializer();
- }
- } finally {
- setCurrentInjector(previousInjector);
- setInjectImplementation(previousInjectImplementation);
- ngDevMode && setInjectorProfilerContext(prevInjectContext);
- }
- }
- toString() {
- const tokens = [];
- const records = this.records;
- for (const token of records.keys()) {
- tokens.push(stringify(token));
- }
- return `R3Injector[${tokens.join(", ")}]`;
- }
- assertNotDestroyed() {
- if (this._destroyed) {
- throw new RuntimeError(205, ngDevMode && "Injector has already been destroyed.");
- }
- }
- /**
- * Process a `SingleProvider` and add it.
- */
- processProvider(provider) {
- provider = resolveForwardRef(provider);
- let token = isTypeProvider(provider) ? provider : resolveForwardRef(provider && provider.provide);
- const record = providerToRecord(provider);
- if (ngDevMode) {
- runInInjectorProfilerContext(this, token, () => {
- if (isValueProvider(provider)) {
- emitInstanceCreatedByInjectorEvent(provider.useValue);
- }
- emitProviderConfiguredEvent(provider);
- });
- }
- if (!isTypeProvider(provider) && provider.multi === true) {
- let multiRecord = this.records.get(token);
- if (multiRecord) {
- if (ngDevMode && multiRecord.multi === void 0) {
- throwMixedMultiProviderError();
- }
- } else {
- multiRecord = makeRecord(void 0, NOT_YET, true);
- multiRecord.factory = () => injectArgs(multiRecord.multi);
- this.records.set(token, multiRecord);
- }
- token = provider;
- multiRecord.multi.push(provider);
- } else {
- if (ngDevMode) {
- const existing = this.records.get(token);
- if (existing && existing.multi !== void 0) {
- throwMixedMultiProviderError();
- }
- }
- }
- this.records.set(token, record);
- }
- hydrate(token, record) {
- if (ngDevMode && record.value === CIRCULAR) {
- throwCyclicDependencyError(stringify(token));
- } else if (record.value === NOT_YET) {
- record.value = CIRCULAR;
- if (ngDevMode) {
- runInInjectorProfilerContext(this, token, () => {
- record.value = record.factory();
- emitInstanceCreatedByInjectorEvent(record.value);
- });
- } else {
- record.value = record.factory();
- }
- }
- if (typeof record.value === "object" && record.value && hasOnDestroy(record.value)) {
- this._ngOnDestroyHooks.add(record.value);
- }
- return record.value;
- }
- injectableDefInScope(def) {
- if (!def.providedIn) {
- return false;
- }
- const providedIn = resolveForwardRef(def.providedIn);
- if (typeof providedIn === "string") {
- return providedIn === "any" || this.scopes.has(providedIn);
- } else {
- return this.injectorDefTypes.has(providedIn);
- }
- }
- removeOnDestroy(callback) {
- const destroyCBIdx = this._onDestroyHooks.indexOf(callback);
- if (destroyCBIdx !== -1) {
- this._onDestroyHooks.splice(destroyCBIdx, 1);
- }
- }
- };
- function injectableDefOrInjectorDefFactory(token) {
- const injectableDef = getInjectableDef(token);
- const factory = injectableDef !== null ? injectableDef.factory : getFactoryDef(token);
- if (factory !== null) {
- return factory;
- }
- if (token instanceof InjectionToken) {
- throw new RuntimeError(204, ngDevMode && `Token ${stringify(token)} is missing a ɵprov definition.`);
- }
- if (token instanceof Function) {
- return getUndecoratedInjectableFactory(token);
- }
- throw new RuntimeError(204, ngDevMode && "unreachable");
- }
- function getUndecoratedInjectableFactory(token) {
- const paramLength = token.length;
- if (paramLength > 0) {
- throw new RuntimeError(204, ngDevMode && `Can't resolve all parameters for ${stringify(token)}: (${newArray(paramLength, "?").join(", ")}).`);
- }
- const inheritedInjectableDef = getInheritedInjectableDef(token);
- if (inheritedInjectableDef !== null) {
- return () => inheritedInjectableDef.factory(token);
- } else {
- return () => new token();
- }
- }
- function providerToRecord(provider) {
- if (isValueProvider(provider)) {
- return makeRecord(void 0, provider.useValue);
- } else {
- const factory = providerToFactory(provider);
- return makeRecord(factory, NOT_YET);
- }
- }
- function providerToFactory(provider, ngModuleType, providers) {
- let factory = void 0;
- if (ngDevMode && isEnvironmentProviders(provider)) {
- throwInvalidProviderError(void 0, providers, provider);
- }
- if (isTypeProvider(provider)) {
- const unwrappedProvider = resolveForwardRef(provider);
- return getFactoryDef(unwrappedProvider) || injectableDefOrInjectorDefFactory(unwrappedProvider);
- } else {
- if (isValueProvider(provider)) {
- factory = () => resolveForwardRef(provider.useValue);
- } else if (isFactoryProvider(provider)) {
- factory = () => provider.useFactory(...injectArgs(provider.deps || []));
- } else if (isExistingProvider(provider)) {
- factory = () => ɵɵinject(resolveForwardRef(provider.useExisting));
- } else {
- const classRef = resolveForwardRef(provider && (provider.useClass || provider.provide));
- if (ngDevMode && !classRef) {
- throwInvalidProviderError(ngModuleType, providers, provider);
- }
- if (hasDeps(provider)) {
- factory = () => new classRef(...injectArgs(provider.deps));
- } else {
- return getFactoryDef(classRef) || injectableDefOrInjectorDefFactory(classRef);
- }
- }
- }
- return factory;
- }
- function makeRecord(factory, value, multi = false) {
- return {
- factory,
- value,
- multi: multi ? [] : void 0
- };
- }
- function hasDeps(value) {
- return !!value.deps;
- }
- function hasOnDestroy(value) {
- return value !== null && typeof value === "object" && typeof value.ngOnDestroy === "function";
- }
- function couldBeInjectableType(value) {
- return typeof value === "function" || typeof value === "object" && value instanceof InjectionToken;
- }
- function forEachSingleProvider(providers, fn) {
- for (const provider of providers) {
- if (Array.isArray(provider)) {
- forEachSingleProvider(provider, fn);
- } else if (provider && isEnvironmentProviders(provider)) {
- forEachSingleProvider(provider.ɵproviders, fn);
- } else {
- fn(provider);
- }
- }
- }
- function runInInjectionContext(injector, fn) {
- if (injector instanceof R3Injector) {
- injector.assertNotDestroyed();
- }
- let prevInjectorProfilerContext;
- if (ngDevMode) {
- prevInjectorProfilerContext = setInjectorProfilerContext({ injector, token: null });
- }
- const prevInjector = setCurrentInjector(injector);
- const previousInjectImplementation = setInjectImplementation(void 0);
- try {
- return fn();
- } finally {
- setCurrentInjector(prevInjector);
- ngDevMode && setInjectorProfilerContext(prevInjectorProfilerContext);
- setInjectImplementation(previousInjectImplementation);
- }
- }
- function assertInInjectionContext(debugFn) {
- if (!getInjectImplementation() && !getCurrentInjector()) {
- throw new RuntimeError(-203, ngDevMode && debugFn.name + "() can only be used within an injection context such as a constructor, a factory function, a field initializer, or a function used with `runInInjectionContext`");
- }
- }
- var FactoryTarget;
- (function(FactoryTarget2) {
- FactoryTarget2[FactoryTarget2["Directive"] = 0] = "Directive";
- FactoryTarget2[FactoryTarget2["Component"] = 1] = "Component";
- FactoryTarget2[FactoryTarget2["Injectable"] = 2] = "Injectable";
- FactoryTarget2[FactoryTarget2["Pipe"] = 3] = "Pipe";
- FactoryTarget2[FactoryTarget2["NgModule"] = 4] = "NgModule";
- })(FactoryTarget || (FactoryTarget = {}));
- var R3TemplateDependencyKind;
- (function(R3TemplateDependencyKind2) {
- R3TemplateDependencyKind2[R3TemplateDependencyKind2["Directive"] = 0] = "Directive";
- R3TemplateDependencyKind2[R3TemplateDependencyKind2["Pipe"] = 1] = "Pipe";
- R3TemplateDependencyKind2[R3TemplateDependencyKind2["NgModule"] = 2] = "NgModule";
- })(R3TemplateDependencyKind || (R3TemplateDependencyKind = {}));
- var ViewEncapsulation;
- (function(ViewEncapsulation2) {
- ViewEncapsulation2[ViewEncapsulation2["Emulated"] = 0] = "Emulated";
- ViewEncapsulation2[ViewEncapsulation2["None"] = 2] = "None";
- ViewEncapsulation2[ViewEncapsulation2["ShadowDom"] = 3] = "ShadowDom";
- })(ViewEncapsulation || (ViewEncapsulation = {}));
- 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 {
- 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 {
- 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;
- }
- }
- function ɵɵNgOnChangesFeature() {
- return NgOnChangesFeatureImpl;
- }
- function NgOnChangesFeatureImpl(definition) {
- if (definition.type.prototype.ngOnChanges) {
- definition.setInput = ngOnChangesSetInput;
- }
- return rememberChangeHistoryAndInvokeOnChangesHook;
- }
- ɵɵNgOnChangesFeature.ngInherit = true;
- 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 profilerCallback = null;
- var setProfiler = (profiler2) => {
- profilerCallback = profiler2;
- };
- var profiler = function(event, instance, hookOrListener) {
- if (profilerCallback != null) {
- profilerCallback(event, instance, hookOrListener);
- }
- };
- 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 max2 = arr.length - 1;
- let lastNodeIndexFound = 0;
- for (let i = startIndex; i < max2; 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 {
- constructor(factory, isViewProvider, injectImplementation) {
- this.factory = factory;
- this.resolving = false;
- ngDevMode && assertDefined(factory, "Factory not specified");
- ngDevMode && assertEqual(typeof factory, "function", "Expected factory function.");
- this.canSeeViewProviders = isViewProvider;
- this.injectImpl = injectImplementation;
- }
- };
- function isFactory(obj) {
- return obj instanceof NodeInjectorFactory;
- }
- 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");
- 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 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)) {
- throwError(`Expected TNodeType to have only a single type selected, but got ${toTNodeTypeAsString(type)}.`);
- }
- }
- 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(location2, startView) {
- let viewOffset = getParentInjectorViewOffset(location2);
- 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 & InjectFlags.Optional || notFoundValue !== void 0) {
- return notFoundValue;
- } else {
- throwProviderNotFoundError(token, "NodeInjector");
- }
- }
- function lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue) {
- if (flags & InjectFlags.Optional && notFoundValue === void 0) {
- notFoundValue = null;
- }
- if ((flags & (InjectFlags.Self | InjectFlags.Host)) === 0) {
- const moduleInjector = lView[INJECTOR$1];
- const previousInjectImplementation = setInjectImplementation(void 0);
- try {
- if (moduleInjector) {
- return moduleInjector.get(token, notFoundValue, flags & InjectFlags.Optional);
- } else {
- return injectRootLimpMode(token, notFoundValue, flags & InjectFlags.Optional);
- }
- } finally {
- setInjectImplementation(previousInjectImplementation);
- }
- }
- return notFoundValueOrThrow(notFoundValue, token, flags);
- }
- function getOrCreateInjectable(tNode, lView, token, flags = InjectFlags.Default, 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 & InjectFlags.Self)) {
- 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 & InjectFlags.Host ? notFoundValueOrThrow(notFoundValue, token, flags) : lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue);
- }
- try {
- let value;
- if (ngDevMode) {
- runInInjectorProfilerContext(new NodeInjector(getCurrentTNode(), getLView()), token, () => {
- value = bloomHash(flags);
- if (value != null) {
- emitInstanceCreatedByInjectorEvent(value);
- }
- });
- } else {
- value = bloomHash(flags);
- }
- if (value == null && !(flags & InjectFlags.Optional)) {
- 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 & InjectFlags.Host ? lView[DECLARATION_COMPONENT_VIEW][T_HOST] : null;
- if (injectorIndex === -1 || flags & InjectFlags.SkipSelf) {
- 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 & InjectFlags.Host && hostTElementNode === tNode;
- const injectableIdx = locateDirectiveOrProvider(tNode, currentTView, token, canAccessViewProviders, isHostSpecialCase);
- if (injectableIdx !== null) {
- return getNodeInjectable(lView, currentTView, injectableIdx, tNode);
- } 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;
- }
- function getNodeInjectable(lView, tView, index, tNode) {
- let value = lView[index];
- const tData = tView.data;
- if (isFactory(value)) {
- const factory = value;
- if (factory.resolving) {
- throwCyclicDependencyError(stringifyForError(tData[index]));
- }
- const previousIncludeViewProviders = setIncludeViewProviders(factory.canSeeViewProviders);
- factory.resolving = true;
- let prevInjectContext;
- if (ngDevMode) {
- const token = tData[index].type || tData[index];
- const injector = new NodeInjector(tNode, lView);
- prevInjectContext = setInjectorProfilerContext({ injector, token });
- }
- const previousInjectImplementation = factory.injectImpl ? setInjectImplementation(factory.injectImpl) : null;
- const success = enterDI(lView, tNode, InjectFlags.Default);
- ngDevMode && assertEqual(success, true, "Because flags do not contain `SkipSelf' we expect this to always succeed.");
- try {
- value = lView[index] = factory.factory(void 0, 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();
- }
- }
- 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 & InjectFlags.Self) && !(flags & InjectFlags.Host && isFirstHostTNode);
- }
- function getNodeInjectorLView(nodeInjector) {
- return nodeInjector._lView;
- }
- function getNodeInjectorTNode(nodeInjector) {
- return nodeInjector._tNode;
- }
- var NodeInjector = class {
- 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 && !(currentLView[FLAGS] & 512)) {
- ngDevMode && assertTNodeForLView(currentTNode, currentLView);
- const nodeInjectorValue = lookupTokenUsingNodeInjector(currentTNode, currentLView, token, flags | InjectFlags.Self, 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 Attribute = 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 Attribute) {
- 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 createInjector(defType, parent = null, additionalProviders = null, name) {
- const injector = createInjectorWithoutInjectorInstances(defType, parent, additionalProviders, name);
- injector.resolveInjectorInitializers();
- return injector;
- }
- function createInjectorWithoutInjectorInstances(defType, parent = null, additionalProviders = null, name, scopes = /* @__PURE__ */ new Set()) {
- const providers = [
- additionalProviders || EMPTY_ARRAY,
- importProvidersFrom(defType)
- ];
- name = name || (typeof defType === "object" ? void 0 : stringify(defType));
- return new R3Injector(providers, parent || getNullInjector(), name || null, scopes);
- }
- var _Injector = class _Injector {
- static create(options, parent) {
- if (Array.isArray(options)) {
- return createInjector({ name: "" }, parent, options, "");
- } else {
- const name = options.name ?? "";
- return createInjector({ name }, options.parent, options.providers, name);
- }
- }
- };
- _Injector.THROW_IF_NOT_FOUND = THROW_IF_NOT_FOUND;
- _Injector.NULL = new NullInjector();
- _Injector.ɵprov = ɵɵdefineInjectable({
- token: _Injector,
- providedIn: "any",
- factory: () => ɵɵinject(INJECTOR)
- });
- _Injector.__NG_ELEMENT_ID__ = -1;
- var Injector = _Injector;
- var ERROR_ORIGINAL_ERROR = "ngOriginalError";
- function getOriginalError(error) {
- return error[ERROR_ORIGINAL_ERROR];
- }
- var ErrorHandler = class {
- constructor() {
- this._console = console;
- }
- handleError(error) {
- const originalError = this._findOriginalError(error);
- this._console.error("ERROR", error);
- if (originalError) {
- this._console.error("ORIGINAL ERROR", originalError);
- }
- }
- /** @internal */
- _findOriginalError(error) {
- let e = error && getOriginalError(error);
- while (e && getOriginalError(e)) {
- e = getOriginalError(e);
- }
- return e || null;
- }
- };
- var INTERNAL_APPLICATION_ERROR_HANDLER = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "internal error handler" : "", {
- providedIn: "root",
- factory: () => {
- const userErrorHandler = inject(ErrorHandler);
- return userErrorHandler.handleError.bind(void 0);
- }
- });
- var IS_HYDRATION_DOM_REUSE_ENABLED = new InjectionToken(typeof ngDevMode === "undefined" || !!ngDevMode ? "IS_HYDRATION_DOM_REUSE_ENABLED" : "");
- var PRESERVE_HOST_CONTENT_DEFAULT = false;
- var PRESERVE_HOST_CONTENT = new InjectionToken(typeof ngDevMode === "undefined" || !!ngDevMode ? "PRESERVE_HOST_CONTENT" : "", {
- providedIn: "root",
- factory: () => PRESERVE_HOST_CONTENT_DEFAULT
- });
- 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 {
- 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 {
- constructor(inertDocumentHelper) {
- this.inertDocumentHelper = inertDocumentHelper;
- }
- getInertBodyElement(html) {
- html = "<body><remove></remove>" + html;
- try {
- const body = new window.DOMParser().parseFromString(trustedHTMLFromString(html), "text/html").body;
- if (body === null) {
- return this.inertDocumentHelper.getInertBodyElement(html);
- }
- body.removeChild(body.firstChild);
- return body;
- } catch {
- return null;
- }
- }
- };
- var InertDocumentHelper = class {
- 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 merge2(...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 = merge2(OPTIONAL_END_TAG_INLINE_ELEMENTS, OPTIONAL_END_TAG_BLOCK_ELEMENTS);
- var BLOCK_ELEMENTS = merge2(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 = merge2(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 = merge2(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 = merge2(URI_ATTRS, HTML_ATTRS, ARIA_ATTRS);
- var SKIP_TRAVERSING_CONTENT_IF_INVALID_ELEMENTS = tagSet("script,style,template");
- var SanitizingHtmlSerializer = class {
- constructor() {
- this.sanitizedSomething = false;
- this.buf = [];
- }
- sanitizeChildren(el) {
- let current = el.firstChild;
- let traverseContent = true;
- 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) {
- current = current.firstChild;
- continue;
- }
- while (current) {
- if (current.nodeType === Node.ELEMENT_NODE) {
- this.endElement(current);
- }
- let next = this.checkClobberedElement(current, current.nextSibling);
- if (next) {
- current = next;
- break;
- }
- current = this.checkClobberedElement(current, current.parentNode);
- }
- }
- 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 = element.nodeName.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 = current.nodeName.toLowerCase();
- if (VALID_ELEMENTS.hasOwnProperty(tagName) && !VOID_ELEMENTS.hasOwnProperty(tagName)) {
- this.buf.push("</");
- this.buf.push(tagName);
- this.buf.push(">");
- }
- }
- chars(chars) {
- this.buf.push(encodeEntities(chars));
- }
- checkClobberedElement(node, nextNode) {
- if (nextNode && (node.compareDocumentPosition(nextNode) & Node.DOCUMENT_POSITION_CONTAINED_BY) === Node.DOCUMENT_POSITION_CONTAINED_BY) {
- throw new Error(`Failed to sanitize html because the element is clobbered: ${node.outerHTML}`);
- }
- return nextNode;
- }
- };
- 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, "<").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.removeChild(parent.firstChild);
- }
- }
- }
- }
- 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 = /(<|>)/g;
- var COMMENT_DELIMITER_ESCAPED = "$1";
- function escapeCommentText(value) {
- return value.replace(COMMENT_DISALLOWED, (text) => text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED));
- }
- 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 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]);
- }
- var LContext = class {
- /** 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];
- const { directiveStart, componentOffset } = tNode;
- return componentOffset > -1 ? lView[directiveStart + 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;
- }
- 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(element, lView, tagName, schemas, hasDirectives) {
- if (schemas === null)
- return;
- if (!hasDirectives && 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 && element instanceof HTMLUnknownElement || typeof customElements !== "undefined" && tagName.indexOf("-") > -1 && !customElements.get(tagName)
- );
- if (isUnknown && !matchingSchemas(schemas, tagName)) {
- const isHostStandalone = isHostComponentStandalone(lView);
- const templateLocation = getTemplateLocationDetails(lView);
- const schemas2 = `'${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 ${schemas2} of this component to suppress this message.`;
- } else {
- message += `2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas2} 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;
- }
- }
- function isPlatformBrowser(injector) {
- return (injector ?? inject(Injector)).get(PLATFORM_ID) === "browser";
- }
- 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, first2, second) {
- throw new RuntimeError(-300, `Multiple components match node with tagname ${tNode.value}: ${stringifyForError(first2)} 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 };
- }
- 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) {
- ngDevMode && ngDevMode.rendererDestroyNode++;
- renderer.destroyNode(rNode);
- }
- if (lContainer != null) {
- applyContainer(renderer, action, lContainer, parent, beforeNode);
- }
- }
- }
- function createTextNode(renderer, value) {
- ngDevMode && ngDevMode.rendererCreateTextNode++;
- ngDevMode && ngDevMode.rendererSetText++;
- return renderer.createText(value);
- }
- function updateTextNode(renderer, rNode, value) {
- ngDevMode && ngDevMode.rendererSetText++;
- renderer.setValue(rNode, value);
- }
- function createCommentNode(renderer, value) {
- ngDevMode && ngDevMode.rendererCreateComment++;
- return renderer.createComment(escapeCommentText(value));
- }
- function createElementNode(renderer, name, namespace) {
- ngDevMode && ngDevMode.rendererCreateElement++;
- return renderer.createElement(name, namespace);
- }
- 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) {
- 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 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 insertedLContainer = lView[PARENT];
- ngDevMode && assertLContainer(insertedLContainer);
- const insertedComponentLView = insertedLContainer[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] |= LContainerFlags.HasTransplantedViews;
- }
- if (movedViews === null) {
- declarationContainer[MOVED_VIEWS] = [lView];
- } else {
- movedViews.push(lView);
- }
- }
- 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);
- ngDevMode && assertLContainer(lView[PARENT]);
- movedViews.splice(declarationViewIndex, 1);
- }
- 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 destroyLView(tView, lView) {
- if (!(lView[FLAGS] & 256)) {
- const renderer = lView[RENDERER];
- if (renderer.destroyNode) {
- applyView(tView, lView, renderer, 3, null, null);
- }
- destroyViewTree(lView);
- }
- }
- function cleanUpView(tView, lView) {
- if (!(lView[FLAGS] & 256)) {
- 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) {
- ngDevMode && ngDevMode.rendererDestroy++;
- 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);
- }
- }
- function processCleanups(tView, lView) {
- 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();
- }
- }
- }
- function executeOnDestroys(tView, lView) {
- 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)) {
- tNode = parentTNode;
- parentTNode = tNode.parent;
- }
- if (parentTNode === null) {
- return lView[HOST];
- } else {
- ngDevMode && assertTNodeType(
- parentTNode,
- 3 | 4
- /* TNodeType.Container */
- );
- const { componentOffset } = parentTNode;
- if (componentOffset > -1) {
- ngDevMode && assertTNodeForLView(parentTNode, lView);
- const { encapsulation } = tView.data[parentTNode.directiveStart + componentOffset];
- if (encapsulation === ViewEncapsulation$1.None || encapsulation === ViewEncapsulation$1.Emulated) {
- return null;
- }
- }
- return getNativeByTNode(parentTNode, lView);
- }
- }
- function nativeInsertBefore(renderer, parent, child, beforeNode, isMove) {
- ngDevMode && ngDevMode.rendererInsertBefore++;
- renderer.insertBefore(parent, child, beforeNode, isMove);
- }
- function nativeAppendChild(renderer, parent, child) {
- ngDevMode && ngDevMode.rendererAppendChild++;
- 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 nativeRemoveChild(renderer, parent, child, isHostElement) {
- renderer.removeChild(parent, child, isHostElement);
- }
- function nativeParentNode(renderer, node) {
- return renderer.parentNode(node);
- }
- function nativeNextSibling(renderer, node) {
- return renderer.nextSibling(node);
- }
- 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
- /* TNodeType.Projection */
- );
- 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 & 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 nativeRemoveNode(renderer, rNode, isHostElement) {
- ngDevMode && ngDevMode.rendererRemoveNode++;
- const nativeParent = nativeParentNode(renderer, rNode);
- if (nativeParent) {
- nativeRemoveChild(renderer, nativeParent, rNode, isHostElement);
- }
- }
- function clearElementContents(rElement) {
- rElement.textContent = "";
- }
- function applyNodes(renderer, action, tNode, lView, parentRElement, beforeNode, isProjection) {
- while (tNode != null) {
- ngDevMode && assertTNodeForLView(tNode, lView);
- 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 ((tNode.flags & 32) !== 32) {
- 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) {
- ngDevMode && ngDevMode.rendererRemoveClass++;
- renderer.removeClass(rNode, prop);
- } else {
- ngDevMode && ngDevMode.rendererAddClass++;
- renderer.addClass(rNode, prop);
- }
- } else {
- let flags = prop.indexOf("-") === -1 ? void 0 : RendererStyleFlags2.DashCase;
- if (value == null) {
- ngDevMode && ngDevMode.rendererRemoveStyle++;
- 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;
- }
- ngDevMode && ngDevMode.rendererSetStyle++;
- renderer.setStyle(rNode, prop, value, flags);
- }
- }
- }
- function writeDirectStyle(renderer, element, newValue) {
- ngDevMode && assertString(newValue, "'newValue' should be a string");
- renderer.setAttribute(element, "style", newValue);
- ngDevMode && ngDevMode.rendererSetStyle++;
- }
- 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);
- }
- ngDevMode && ngDevMode.rendererSetClassName++;
- }
- 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);
- }
- }
- var NO_CHANGE = typeof ngDevMode === "undefined" || ngDevMode ? { __brand__: "NO_CHANGE" } : {};
- 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);
- }
- function ɵɵdirectiveInject(token, flags = InjectFlags.Default) {
- 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 writeToDirectiveInput(def, instance, publicName, privateName, flags, value) {
- const prevConsumer = setActiveConsumer(null);
- try {
- 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);
- }
- if ((flags & InputFlags.HasDecoratorInputTransform) !== 0) {
- value = def.inputTransforms[privateName].call(instance, value);
- }
- if (def.setInput !== null) {
- def.setInput(instance, inputSignalNode, value, publicName, privateName);
- } else {
- applyValueToInputField(instance, inputSignalNode, privateName, value);
- }
- } finally {
- setActiveConsumer(prevConsumer);
- }
- }
- 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];
- hostBindingFn(2, context);
- }
- }
- } finally {
- setSelectedIndex(-1);
- }
- }
- 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;
- 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$1] = injector || parentLView && parentLView[INJECTOR$1] || 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 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);
- 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;
- }
- }
- }
- return tNode;
- }
- 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 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(rf, context);
- } finally {
- setSelectedIndex(prevSelectedIndex);
- const postHookType = isUpdatePhase ? 3 : 1;
- profiler(postHookType, context);
- }
- }
- 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);
- }
- }
- }
- function createDirectivesInstances(tView, lView, tNode) {
- if (!getBindingsEnabled())
- return;
- instantiateAllDirectives(tView, lView, tNode, getNativeByTNode(tNode, lView));
- 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 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 createTView(type, declTNode, templateFn, decls, vars, directives, pipes, viewQuery, schemas, constsOrFactory, ssrId) {
- ngDevMode && ngDevMode.tView++;
- 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 locateHostElement(renderer, elementOrSelector, encapsulation, injector) {
- const preserveHostContent = injector.get(PRESERVE_HOST_CONTENT, PRESERVE_HOST_CONTENT_DEFAULT);
- const preserveContent = preserveHostContent || encapsulation === ViewEncapsulation$1.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 storeCleanupWithContext(tView, lView, context, cleanupFn) {
- const lCleanup = getOrCreateLViewCleanup(lView);
- ngDevMode && assertDefined(context, "Cleanup context is mandatory when registering framework-level destroy hooks");
- lCleanup.push(context);
- if (tView.firstCreatePass) {
- getOrCreateTViewCleanup(tView).push(cleanupFn, lCleanup.length - 1);
- } else {
- if (ngDevMode) {
- Object.freeze(getOrCreateTViewCleanup(tView));
- }
- }
- }
- 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 && ngDevMode.tNode++;
- ngDevMode && tParent && assertTNodeForTView(tParent, tView);
- let injectorIndex = tParent ? tParent.injectorIndex : -1;
- let flags = 0;
- if (isInSkipHydrationBlock$1()) {
- 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: void 0,
- inputs: null,
- outputs: 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 captureNodeBindings(mode, aliasMap, directiveIndex, bindingsResult, hostDirectiveAliasMap) {
- for (let publicName in aliasMap) {
- if (!aliasMap.hasOwnProperty(publicName)) {
- continue;
- }
- const value = aliasMap[publicName];
- if (value === void 0) {
- continue;
- }
- bindingsResult ??= {};
- let internalName;
- let inputFlags = InputFlags.None;
- if (Array.isArray(value)) {
- internalName = value[0];
- inputFlags = value[1];
- } else {
- internalName = value;
- }
- let finalPublicName = publicName;
- if (hostDirectiveAliasMap !== null) {
- if (!hostDirectiveAliasMap.hasOwnProperty(publicName)) {
- continue;
- }
- finalPublicName = hostDirectiveAliasMap[publicName];
- }
- if (mode === 0) {
- addPropertyBinding(bindingsResult, directiveIndex, finalPublicName, internalName, inputFlags);
- } else {
- addPropertyBinding(bindingsResult, directiveIndex, finalPublicName, internalName);
- }
- }
- return bindingsResult;
- }
- function addPropertyBinding(bindings, directiveIndex, publicName, internalName, inputFlags) {
- let values;
- if (bindings.hasOwnProperty(publicName)) {
- (values = bindings[publicName]).push(directiveIndex, internalName);
- } else {
- values = bindings[publicName] = [directiveIndex, internalName];
- }
- if (inputFlags !== void 0) {
- values.push(inputFlags);
- }
- }
- function initializeInputAndOutputAliases(tView, tNode, hostDirectiveDefinitionMap) {
- ngDevMode && assertFirstCreatePass(tView);
- const start = tNode.directiveStart;
- const end = tNode.directiveEnd;
- const tViewData = tView.data;
- const tNodeAttrs = tNode.attrs;
- const inputsFromAttrs = [];
- let inputsStore = null;
- let outputsStore = null;
- for (let directiveIndex = start; directiveIndex < end; directiveIndex++) {
- const directiveDef = tViewData[directiveIndex];
- const aliasData = hostDirectiveDefinitionMap ? hostDirectiveDefinitionMap.get(directiveDef) : null;
- const aliasedInputs = aliasData ? aliasData.inputs : null;
- const aliasedOutputs = aliasData ? aliasData.outputs : null;
- inputsStore = captureNodeBindings(0, directiveDef.inputs, directiveIndex, inputsStore, aliasedInputs);
- outputsStore = captureNodeBindings(1, directiveDef.outputs, directiveIndex, outputsStore, aliasedOutputs);
- const initialInputs = inputsStore !== null && tNodeAttrs !== null && !isInlineTemplate(tNode) ? generateInitialInputs(inputsStore, directiveIndex, tNodeAttrs) : null;
- inputsFromAttrs.push(initialInputs);
- }
- if (inputsStore !== null) {
- if (inputsStore.hasOwnProperty("class")) {
- tNode.flags |= 8;
- }
- if (inputsStore.hasOwnProperty("style")) {
- tNode.flags |= 16;
- }
- }
- tNode.initialInputs = inputsFromAttrs;
- tNode.inputs = inputsStore;
- tNode.outputs = outputsStore;
- }
- 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 elementPropertyInternal(tView, tNode, lView, propName, value, renderer, sanitizer, nativeOnly) {
- ngDevMode && assertNotSame(value, NO_CHANGE, "Incoming value should never be NO_CHANGE.");
- const element = getNativeByTNode(tNode, lView);
- let inputData = tNode.inputs;
- let dataValue;
- if (!nativeOnly && inputData != null && (dataValue = inputData[propName])) {
- setInputsForProperty(tView, lView, dataValue, propName, value);
- if (isComponentHost(tNode))
- markDirtyIfOnPush(lView, tNode.index);
- if (ngDevMode) {
- setNgReflectProperties(lView, element, tNode.type, dataValue, value);
- }
- } else if (tNode.type & 3) {
- propName = mapPropName(propName);
- if (ngDevMode) {
- validateAgainstEventProperties(propName);
- if (!isPropertyValid(element, propName, tNode.value, tView.schemas)) {
- handleUnknownPropertyError(propName, tNode.value, tNode.type, lView);
- }
- ngDevMode.rendererSetProperty++;
- }
- value = sanitizer != null ? sanitizer(value, tNode.value || "", propName) : value;
- renderer.setProperty(element, propName, value);
- } else if (tNode.type & 12) {
- if (ngDevMode && !matchingSchemas(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, element, type, attrName, value) {
- const renderer = lView[RENDERER];
- attrName = normalizeDebugBindingName(attrName);
- const debugValue = normalizeDebugBindingValue(value);
- if (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, element, type, dataValue, value) {
- if (type & (3 | 4)) {
- for (let i = 0; i < dataValue.length; i += 3) {
- setNgReflectProperty(lView, element, type, dataValue[i + 1], value);
- }
- }
- }
- function resolveDirectives(tView, lView, tNode, localRefs) {
- ngDevMode && assertFirstCreatePass(tView);
- if (getBindingsEnabled()) {
- const exportsMap = localRefs === null ? null : { "": -1 };
- const matchResult = findDirectiveDefMatches(tView, tNode);
- let directiveDefs;
- let hostDirectiveDefs;
- if (matchResult === null) {
- directiveDefs = hostDirectiveDefs = null;
- } else {
- [directiveDefs, hostDirectiveDefs] = matchResult;
- }
- if (directiveDefs !== null) {
- initializeDirectives(tView, lView, tNode, directiveDefs, exportsMap, hostDirectiveDefs);
- }
- if (exportsMap)
- cacheMatchingLocalNames(tNode, localRefs, exportsMap);
- }
- tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, tNode.attrs);
- }
- function initializeDirectives(tView, lView, tNode, directives, exportsMap, hostDirectiveDefs) {
- ngDevMode && assertFirstCreatePass(tView);
- for (let i = 0; i < directives.length; i++) {
- diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, lView), tView, directives[i].type);
- }
- initTNodeFlags(tNode, tView.data.length, directives.length);
- for (let i = 0; i < directives.length; i++) {
- const def = directives[i];
- if (def.providersResolver)
- def.providersResolver(def);
- }
- let preOrderHooksFound = false;
- let preOrderCheckHooksFound = false;
- let directiveIdx = allocExpando(tView, lView, directives.length, null);
- ngDevMode && assertSame(directiveIdx, tNode.directiveStart, "TNode.directiveStart should point to just allocated space");
- for (let i = 0; i < directives.length; i++) {
- const def = directives[i];
- tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, def.hostAttrs);
- configureViewWithDirective(tView, tNode, lView, directiveIdx, def);
- saveNameToExportMap(directiveIdx, def, exportsMap);
- 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 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 instantiateAllDirectives(tView, lView, tNode, native) {
- const start = tNode.directiveStart;
- const end = tNode.directiveEnd;
- if (isComponentHost(tNode)) {
- ngDevMode && assertTNodeType(
- tNode,
- 3
- /* TNodeType.AnyRNode */
- );
- addComponentLogic(lView, tNode, tView.data[start + tNode.componentOffset]);
- }
- if (!tView.firstCreatePass) {
- getOrCreateNodeInjectorForNode(tNode, lView);
- }
- attachPatchData(native, 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;
- let hostDirectiveDefs = null;
- if (registry) {
- for (let i = 0; i < registry.length; i++) {
- const def = registry[i];
- if (isNodeMatchingSelectorList(
- tNode,
- def.selectors,
- /* isProjectionMode */
- false
- )) {
- matches || (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 (isComponentHost(tNode)) {
- throwMultipleComponentError(tNode, matches.find(isComponentDef).type, def.type);
- }
- }
- if (def.findHostDirectiveDefs !== null) {
- const hostDirectiveMatches = [];
- hostDirectiveDefs = hostDirectiveDefs || /* @__PURE__ */ new Map();
- def.findHostDirectiveDefs(def, hostDirectiveMatches, hostDirectiveDefs);
- matches.unshift(...hostDirectiveMatches, def);
- const componentOffset = hostDirectiveMatches.length;
- markAsComponentHost(tView, tNode, componentOffset);
- } else {
- matches.unshift(def);
- markAsComponentHost(tView, tNode, 0);
- }
- } else {
- hostDirectiveDefs = hostDirectiveDefs || /* @__PURE__ */ new Map();
- def.findHostDirectiveDefs?.(def, matches, hostDirectiveDefs);
- matches.push(def);
- }
- }
- }
- }
- ngDevMode && matches !== null && assertNoDuplicateDirectives(matches);
- return matches === null ? null : [matches, hostDirectiveDefs];
- }
- 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 cacheMatchingLocalNames(tNode, localRefs, exportsMap) {
- if (localRefs) {
- 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 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 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);
- tView.blueprint[directiveIndex] = nodeInjectorFactory;
- lView[directiveIndex] = nodeInjectorFactory;
- registerHostBindingOpCodes(tView, tNode, directiveIndex, allocExpando(tView, lView, def.hostVars, NO_CHANGE), def);
- }
- function addComponentLogic(lView, hostTNode, def) {
- const native = getNativeByTNode(hostTNode, lView);
- const tView = getOrCreateComponentTView(def);
- const rendererFactory = lView[ENVIRONMENT].rendererFactory;
- let lViewFlags = 16;
- if (def.signals) {
- lViewFlags = 4096;
- } else if (def.onPush) {
- lViewFlags = 64;
- }
- const componentView = addToViewTree(lView, createLView(lView, tView, null, lViewFlags, native, hostTNode, null, rendererFactory.createRenderer(native, def), null, null, null));
- lView[hostTNode.index] = componentView;
- }
- 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) {
- ngDevMode && ngDevMode.rendererRemoveAttribute++;
- renderer.removeAttribute(element, name, namespace);
- } else {
- ngDevMode && ngDevMode.rendererSetAttribute++;
- 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; ) {
- const publicName = initialInputs[i++];
- const privateName = initialInputs[i++];
- const flags = initialInputs[i++];
- const value = initialInputs[i++];
- writeToDirectiveInput(def, instance, publicName, privateName, flags, value);
- if (ngDevMode) {
- const nativeElement = getNativeByTNode(tNode, lView);
- setNgReflectProperty(lView, nativeElement, tNode.type, privateName, value);
- }
- }
- }
- }
- function generateInitialInputs(inputs, directiveIndex, attrs) {
- 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;
- }
- if (typeof attrName === "number")
- break;
- if (inputs.hasOwnProperty(attrName)) {
- if (inputsToStore === null)
- inputsToStore = [];
- const inputConfig = inputs[attrName];
- for (let j = 0; j < inputConfig.length; j += 3) {
- if (inputConfig[j] === directiveIndex) {
- inputsToStore.push(attrName, inputConfig[j + 1], inputConfig[j + 2], attrs[i + 1]);
- break;
- }
- }
- }
- i += 2;
- }
- return inputsToStore;
- }
- 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 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 addToViewTree(lView, lViewOrLContainer) {
- if (lView[CHILD_HEAD]) {
- lView[CHILD_TAIL][NEXT] = lViewOrLContainer;
- } else {
- lView[CHILD_HEAD] = lViewOrLContainer;
- }
- lView[CHILD_TAIL] = lViewOrLContainer;
- return lViewOrLContainer;
- }
- 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 storePropertyBindingMetadata(tData, tNode, propertyName, bindingIndex, ...interpolationParts) {
- if (tData[bindingIndex] === null) {
- if (tNode.inputs == null || !tNode.inputs[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 getOrCreateLViewCleanup(view) {
- return view[CLEANUP] || (view[CLEANUP] = []);
- }
- function getOrCreateTViewCleanup(tView) {
- return tView.cleanup || (tView.cleanup = []);
- }
- function loadComponentRenderer(currentDef, tNode, lView) {
- if (currentDef === null || isComponentDef(currentDef)) {
- lView = unwrapLView(lView[tNode.index]);
- }
- return lView[RENDERER];
- }
- function handleError(lView, error) {
- const injector = lView[INJECTOR$1];
- const errorHandler = injector ? injector.get(ErrorHandler, null) : null;
- errorHandler && errorHandler.handleError(error);
- }
- function setInputsForProperty(tView, lView, inputs, publicName, value) {
- for (let i = 0; i < inputs.length; ) {
- const index = inputs[i++];
- const privateName = inputs[i++];
- const flags = inputs[i++];
- const instance = lView[index];
- ngDevMode && assertIndexInRange(lView, index);
- const def = tView.data[index];
- writeToDirectiveInput(def, instance, publicName, privateName, flags, value);
- }
- }
- function textBindingInternal(lView, index, value) {
- ngDevMode && assertString(value, "Value should be a string");
- ngDevMode && assertNotSame(value, NO_CHANGE, "value should not be NO_CHANGE");
- ngDevMode && assertIndexInRange(lView, index);
- const element = getNativeByIndex(index, lView);
- ngDevMode && assertDefined(element, "native element should exist");
- updateTextNode(lView[RENDERER], element, value);
- }
- 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$1]);
- }
- renderView(componentTView, componentView, 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");
- 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 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, null, options?.injector ?? 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;
- }
- 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 shouldAddViewToDom(tNode, dehydratedView) {
- return !dehydratedView || dehydratedView.firstChild === null || hasInSkipHydrationBlockFlag(tNode);
- }
- 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 = nativeParentNode(renderer, 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 collectNativeNodes(tView, lView, tNode, result, isProjection = false) {
- while (tNode !== null) {
- 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]);
- }
- }
- 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,
- consumerMarkedDirty: (node) => {
- markAncestorsForTraversal(node.lView);
- },
- consumerOnSignalRead() {
- this.lView[REACTIVE_TEMPLATE_CONSUMER] = this;
- }
- });
- function getRootView(componentOrLView) {
- ngDevMode && assertDefined(componentOrLView, "component");
- let lView = isLView(componentOrLView) ? componentOrLView : readPatchedLView(componentOrLView);
- while (lView && !(lView[FLAGS] & 512)) {
- 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;
- }
- var MAXIMUM_REFRESH_RERUNS = 100;
- function detectChangesInternal(lView, notifyErrorHandler = true, mode = 0) {
- const environment = lView[ENVIRONMENT];
- const rendererFactory = environment.rendererFactory;
- const checkNoChangesMode = !!ngDevMode && isInCheckNoChangesMode();
- if (!checkNoChangesMode) {
- rendererFactory.begin?.();
- }
- try {
- detectChangesInViewWhileDirty(lView, mode);
- } catch (error) {
- if (notifyErrorHandler) {
- handleError(lView, error);
- }
- throw error;
- } finally {
- if (!checkNoChangesMode) {
- rendererFactory.end?.();
- environment.inlineEffectRunner?.flush();
- }
- }
- }
- function detectChangesInViewWhileDirty(lView, mode) {
- detectChangesInView(lView, mode);
- let retries = 0;
- while (requiresRefreshOrTraversal(lView)) {
- if (retries === MAXIMUM_REFRESH_RERUNS) {
- 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 */
- );
- }
- }
- function checkNoChangesInternal(lView, notifyErrorHandler = true) {
- setIsInCheckNoChangesMode(true);
- try {
- detectChangesInternal(lView, notifyErrorHandler);
- } finally {
- setIsInCheckNoChangesMode(false);
- }
- }
- function refreshView(tView, lView, templateFn, context) {
- ngDevMode && assertEqual(isCreationMode(lView), false, "Should be run in update mode");
- const flags = lView[FLAGS];
- if ((flags & 256) === 256)
- return;
- const isInCheckNoChangesPass = ngDevMode && isInCheckNoChangesMode();
- !isInCheckNoChangesPass && lView[ENVIRONMENT].inlineEffectRunner?.flush();
- enterView(lView);
- let prevConsumer = null;
- let currentConsumer = null;
- if (!isInCheckNoChangesPass && viewShouldHaveReactiveConsumer(tView)) {
- currentConsumer = getOrBorrowReactiveLViewConsumer(lView);
- prevConsumer = consumerBeforeComputation(currentConsumer);
- }
- 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 */
- );
- }
- }
- markTransplantedViewsForRefresh(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) {
- lView[FLAGS] &= ~(64 | 8);
- }
- } catch (e) {
- markAncestorsForTraversal(lView);
- throw e;
- } finally {
- if (currentConsumer !== null) {
- consumerAfterComputation(currentConsumer, prevConsumer);
- maybeReturnReactiveLViewConsumer(currentConsumer);
- }
- leaveView();
- }
- }
- function viewShouldHaveReactiveConsumer(tView) {
- return tView.type !== 2;
- }
- 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] & LContainerFlags.HasTransplantedViews))
- 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];
- const insertionLContainer = movedLView[PARENT];
- ngDevMode && assertLContainer(insertionLContainer);
- markViewForRefresh(movedLView);
- }
- }
- }
- function detectChangesInComponent(hostLView, componentHostIdx, mode) {
- ngDevMode && assertEqual(isCreationMode(hostLView), false, "Should be run in update mode");
- const componentView = getComponentLViewByIndex(componentHostIdx, hostLView);
- detectChangesInViewIfAttached(componentView, mode);
- }
- 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));
- if (consumer) {
- consumer.dirty = false;
- }
- lView[FLAGS] &= ~(8192 | 1024);
- if (shouldRefreshView) {
- refreshView(tView, lView, tView.template, lView[CONTEXT]);
- } else if (flags & 8192) {
- detectChangesInEmbeddedViews(
- lView,
- 1
- /* ChangeDetectionMode.Targeted */
- );
- const components = tView.components;
- if (components !== null) {
- detectChangesInChildComponents(
- lView,
- components,
- 1
- /* ChangeDetectionMode.Targeted */
- );
- }
- }
- }
- function detectChangesInChildComponents(hostLView, components, mode) {
- for (let i = 0; i < components.length; i++) {
- detectChangesInComponent(hostLView, components[i], mode);
- }
- }
- function markViewDirty(lView) {
- lView[ENVIRONMENT].changeDetectionScheduler?.notify();
- while (lView) {
- lView[FLAGS] |= 64;
- const parent = getLViewParent(lView);
- if (isRootView(lView) && !parent) {
- return lView;
- }
- lView = parent;
- }
- return null;
- }
- var ViewRef$1 = class {
- get rootNodes() {
- const lView = this._lView;
- const tView = lView[TVIEW];
- return collectNativeNodes(tView, lView, tView.firstChild, []);
- }
- constructor(_lView, _cdRefInjectingView, notifyErrorHandler = true) {
- this._lView = _lView;
- this._cdRefInjectingView = _cdRefInjectingView;
- this.notifyErrorHandler = notifyErrorHandler;
- this._appRef = null;
- this._attachedToViewContainer = false;
- }
- 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 (this._lView[FLAGS] & 256) === 256;
- }
- 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).
- *
- * <!-- TODO: Add a link to a chapter on OnPush components -->
- *
- * @usageNotes
- * ### Example
- *
- * ```typescript
- * @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);
- }
- /**
- * 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.
- *
- * <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
- * <!-- TODO: Add a live demo once ref.detectChanges is merged into master -->
- *
- * @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.
- *
- * ```typescript
- * 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: `
- * <li *ngFor="let d of dataProvider.data">Data {{d}}</li>
- * `,
- * })
- * class GiantList {
- * constructor(private ref: ChangeDetectorRef, private dataProvider: DataProvider) {
- * ref.detach();
- * setInterval(() => {
- * this.ref.detectChanges();
- * }, 5000);
- * }
- * }
- *
- * @Component({
- * selector: 'app',
- * providers: [DataProvider],
- * template: `
- * <giant-list><giant-list>
- * `,
- * })
- * 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.
- *
- * <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
- *
- * @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.
- *
- * ```typescript
- * 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: <input type="checkbox" [(ngModel)]="live">
- * <live-data [live]="live"><live-data>
- * `,
- * })
- * 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.
- *
- * <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
- * <!-- TODO: Add a live demo once ref.detectChanges is merged into master -->
- *
- * @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, this.notifyErrorHandler);
- }
- /**
- * 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) {
- checkNoChangesInternal(this._lView, this.notifyErrorHandler);
- }
- }
- 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;
- 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;
- updateAncestorTraversalFlagsOnAttach(this._lView);
- }
- };
- var _TemplateRef = class _TemplateRef {
- };
- _TemplateRef.__NG_ELEMENT_ID__ = injectTemplateRef;
- var TemplateRef = _TemplateRef;
- var ViewEngineTemplateRef = TemplateRef;
- var R3TemplateRef = class TemplateRef2 extends ViewEngineTemplateRef {
- constructor(_declarationLView, _declarationTContainer, elementRef) {
- super();
- 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;
- }
- createEmbeddedView(context, injector) {
- return this.createEmbeddedViewImpl(context, injector);
- }
- /**
- * @internal
- */
- createEmbeddedViewImpl(context, injector, dehydratedView) {
- const embeddedLView = createAndRenderEmbeddedLView(this._declarationLView, this._declarationTContainer, context, { injector, dehydratedView });
- return new ViewRef$1(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 R3TemplateRef(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";
- default:
- return "<unknown>";
- }
- }
- 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 = "";
- if (!node) {
- header += `the node was not found.
-
- `;
- markRNodeAsHavingHydrationMismatch(unwrapRNode(lView[HOST]), 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(node, 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}</${tag}>`;
- case 8:
- return "<!-- ng-container -->";
- case 4:
- return "<!-- container -->";
- 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}</${tag}>`;
- case Node.TEXT_NODE:
- const content = node.textContent ? shorten(node.textContent) : "";
- return `#text${content ? `(${content})` : ""}`;
- case Node.COMMENT_NODE:
- return `<!-- ${shorten(node.textContent ?? "")} -->`;
- 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 + `<!-- container --> ${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 removeDehydratedViews(lContainer) {
- const views = lContainer[DEHYDRATED_VIEWS] ?? [];
- const parentLView = lContainer[PARENT];
- const renderer = parentLView[RENDERER];
- for (const view of views) {
- removeDehydratedView(view, renderer);
- ngDevMode && ngDevMode.dehydratedViewsRemoved++;
- }
- lContainer[DEHYDRATED_VIEWS] = EMPTY_ARRAY;
- }
- 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);
- for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
- cleanupLView(lContainer[i]);
- }
- }
- function cleanupLView(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 {
- const componentLView = lNode[HOST];
- cleanupLView(componentLView);
- cleanupLContainer(lNode);
- }
- ngDevMode && ngDevMode.dehydratedViewsCleanupRuns++;
- }
- }
- }
- 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, count2] of rest.matchAll(/(f|n)(\d*)/g)) {
- const repeat2 = parseInt(count2, 10) || 1;
- steps.push(step, repeat2);
- }
- 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) && !!lView[tNode.index] && !unwrapRNode(lView[tNode.index])?.isConnected;
- }
- function locateNextRNode(hydrationInfo, tView, lView, tNode) {
- let native = null;
- const noOffsetIndex = getNoOffsetIndex(tNode);
- 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(skip2, from) {
- let currentNode = from;
- for (let i = 0; i < skip2; 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 repeat2 = instructions[i + 1];
- for (let r = 0; r < repeat2; r++) {
- container.push(step === NodeNavigationStep.FirstChild ? "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 repeat2 = instructions[i + 1];
- for (let r = 0; r < repeat2; r++) {
- if (ngDevMode && !node) {
- throw nodeNotFoundAtPathError(from, stringifyNavigationInstructions(instructions));
- }
- switch (step) {
- case NodeNavigationStep.FirstChild:
- node = node.firstChild;
- break;
- case NodeNavigationStep.NextSibling:
- 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.
- NodeNavigationStep.FirstChild,
- // 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(NodeNavigationStep.NextSibling);
- }
- 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) {
- let parentTNode = tNode.parent;
- let parentIndex;
- let parentRNode;
- let referenceNodeName;
- while (parentTNode !== null && isDisconnectedNode(parentTNode, lView)) {
- 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) {
- 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 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;
- function findMatchingDehydratedViewImpl(lContainer, template) {
- const views = lContainer[DEHYDRATED_VIEWS];
- if (!template || views === null || views.length === 0) {
- return null;
- }
- const view = views[0];
- if (view.data[TEMPLATE_ID] === template) {
- return views.shift();
- } else {
- removeDehydratedViews(lContainer);
- return null;
- }
- }
- function enableFindMatchingDehydratedViewImpl() {
- _findMatchingDehydratedViewImpl = findMatchingDehydratedViewImpl;
- }
- function findMatchingDehydratedView(lContainer, template) {
- return _findMatchingDehydratedViewImpl(lContainer, template);
- }
- var ChangeDetectionScheduler = class {
- };
- var ComponentRef$1 = class {
- };
- var ComponentFactory$1 = class {
- };
- function noComponentFactoryError(component) {
- const error = Error(`No component factory found for ${stringify(component)}.`);
- error[ERROR_COMPONENT] = component;
- return error;
- }
- var ERROR_COMPONENT = "ngComponent";
- var _NullComponentFactoryResolver = class {
- resolveComponentFactory(component) {
- throw noComponentFactoryError(component);
- }
- };
- var _ComponentFactoryResolver$1 = class _ComponentFactoryResolver$1 {
- };
- _ComponentFactoryResolver$1.NULL = new _NullComponentFactoryResolver();
- var ComponentFactoryResolver$1 = _ComponentFactoryResolver$1;
- var RendererFactory2 = class {
- };
- var _Renderer2 = class _Renderer2 {
- constructor() {
- this.destroyNode = null;
- }
- };
- _Renderer2.__NG_ELEMENT_ID__ = () => injectRenderer2();
- var Renderer2 = _Renderer2;
- function injectRenderer2() {
- const lView = getLView();
- const tNode = getCurrentTNode();
- const nodeAtIndex = getComponentLViewByIndex(tNode.index, lView);
- return (isLView(nodeAtIndex) ? nodeAtIndex : lView)[RENDERER];
- }
- var _Sanitizer = class _Sanitizer {
- };
- _Sanitizer.ɵprov = ɵɵdefineInjectable({
- token: _Sanitizer,
- providedIn: "root",
- factory: () => null
- });
- var Sanitizer = _Sanitizer;
- var NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {};
- function isSignal(value) {
- return typeof value === "function" && value[SIGNAL] !== void 0;
- }
- function computed(computation, options) {
- const getter = createComputed(computation);
- if (options?.equal) {
- getter[SIGNAL].equal = options.equal;
- }
- if (ngDevMode) {
- getter.toString = () => `[Computed: ${getter()}]`;
- }
- return getter;
- }
- var WRITABLE_SIGNAL = Symbol("WRITABLE_SIGNAL");
- function ɵunwrapWritableSignal(value) {
- return null;
- }
- function signal(initialValue, options) {
- const signalFn = createSignal(initialValue);
- const node = signalFn[SIGNAL];
- if (options?.equal) {
- node.equal = options.equal;
- }
- signalFn.set = (newValue) => signalSetFn(node, newValue);
- signalFn.update = (updateFn) => signalUpdateFn(node, updateFn);
- signalFn.asReadonly = signalAsReadonlyFn.bind(signalFn);
- if (ngDevMode) {
- signalFn.toString = () => `[Signal: ${signalFn()}]`;
- }
- return signalFn;
- }
- function signalAsReadonlyFn() {
- const node = this[SIGNAL];
- if (node.readonlyFn === void 0) {
- const readonlyFn = () => this();
- readonlyFn[SIGNAL] = node;
- node.readonlyFn = readonlyFn;
- }
- return node.readonlyFn;
- }
- function isWritableSignal(value) {
- return isSignal(value) && typeof value.set === "function";
- }
- function untracked(nonReactiveReadsFn) {
- const prevConsumer = setActiveConsumer(null);
- try {
- return nonReactiveReadsFn();
- } finally {
- setActiveConsumer(prevConsumer);
- }
- }
- 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");
- }
- var DefaultIterableDifferFactory = class {
- constructor() {
- }
- supports(obj) {
- return isListLikeIterable(obj);
- }
- create(trackByFn) {
- return new DefaultIterableDiffer(trackByFn);
- }
- };
- var trackByIdentity = (index, item) => item;
- var DefaultIterableDiffer = class {
- constructor(trackByFn) {
- this.length = 0;
- this._linkedRecords = null;
- this._unlinkedRecords = null;
- this._previousItHead = null;
- this._itHead = null;
- this._itTail = null;
- this._additionsHead = null;
- this._additionsTail = null;
- this._movesHead = null;
- this._movesTail = null;
- this._removalsHead = null;
- this._removalsTail = null;
- this._identityChangesHead = null;
- this._identityChangesTail = null;
- this._trackByFn = trackByFn || trackByIdentity;
- }
- forEachItem(fn) {
- let record;
- for (record = this._itHead; record !== null; record = record._next) {
- fn(record);
- }
- }
- forEachOperation(fn) {
- let nextIt = this._itHead;
- let nextRemove = this._removalsHead;
- let addRemoveOffset = 0;
- let moveOffsets = null;
- while (nextIt || nextRemove) {
- const record = !nextRemove || nextIt && nextIt.currentIndex < getPreviousIndex(nextRemove, addRemoveOffset, moveOffsets) ? nextIt : nextRemove;
- const adjPreviousIndex = getPreviousIndex(record, addRemoveOffset, moveOffsets);
- const currentIndex = record.currentIndex;
- if (record === nextRemove) {
- addRemoveOffset--;
- nextRemove = nextRemove._nextRemoved;
- } else {
- nextIt = nextIt._next;
- if (record.previousIndex == null) {
- addRemoveOffset++;
- } else {
- if (!moveOffsets)
- moveOffsets = [];
- const localMovePreviousIndex = adjPreviousIndex - addRemoveOffset;
- const localCurrentIndex = currentIndex - addRemoveOffset;
- if (localMovePreviousIndex != localCurrentIndex) {
- for (let i = 0; i < localMovePreviousIndex; i++) {
- const offset = i < moveOffsets.length ? moveOffsets[i] : moveOffsets[i] = 0;
- const index = offset + i;
- if (localCurrentIndex <= index && index < localMovePreviousIndex) {
- moveOffsets[i] = offset + 1;
- }
- }
- const previousIndex = record.previousIndex;
- moveOffsets[previousIndex] = localCurrentIndex - localMovePreviousIndex;
- }
- }
- }
- if (adjPreviousIndex !== currentIndex) {
- fn(record, adjPreviousIndex, currentIndex);
- }
- }
- }
- forEachPreviousItem(fn) {
- let record;
- for (record = this._previousItHead; record !== null; record = record._nextPrevious) {
- fn(record);
- }
- }
- forEachAddedItem(fn) {
- let record;
- for (record = this._additionsHead; record !== null; record = record._nextAdded) {
- fn(record);
- }
- }
- forEachMovedItem(fn) {
- let record;
- for (record = this._movesHead; record !== null; record = record._nextMoved) {
- fn(record);
- }
- }
- forEachRemovedItem(fn) {
- let record;
- for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
- fn(record);
- }
- }
- forEachIdentityChange(fn) {
- let record;
- for (record = this._identityChangesHead; record !== null; record = record._nextIdentityChange) {
- fn(record);
- }
- }
- diff(collection) {
- if (collection == null)
- collection = [];
- if (!isListLikeIterable(collection)) {
- throw new RuntimeError(900, ngDevMode && `Error trying to diff '${stringify(collection)}'. Only arrays and iterables are allowed`);
- }
- if (this.check(collection)) {
- return this;
- } else {
- return null;
- }
- }
- onDestroy() {
- }
- check(collection) {
- this._reset();
- let record = this._itHead;
- let mayBeDirty = false;
- let index;
- let item;
- let itemTrackBy;
- if (Array.isArray(collection)) {
- this.length = collection.length;
- for (let index2 = 0; index2 < this.length; index2++) {
- item = collection[index2];
- itemTrackBy = this._trackByFn(index2, item);
- if (record === null || !Object.is(record.trackById, itemTrackBy)) {
- record = this._mismatch(record, item, itemTrackBy, index2);
- mayBeDirty = true;
- } else {
- if (mayBeDirty) {
- record = this._verifyReinsertion(record, item, itemTrackBy, index2);
- }
- if (!Object.is(record.item, item))
- this._addIdentityChange(record, item);
- }
- record = record._next;
- }
- } else {
- index = 0;
- iterateListLike(collection, (item2) => {
- itemTrackBy = this._trackByFn(index, item2);
- if (record === null || !Object.is(record.trackById, itemTrackBy)) {
- record = this._mismatch(record, item2, itemTrackBy, index);
- mayBeDirty = true;
- } else {
- if (mayBeDirty) {
- record = this._verifyReinsertion(record, item2, itemTrackBy, index);
- }
- if (!Object.is(record.item, item2))
- this._addIdentityChange(record, item2);
- }
- record = record._next;
- index++;
- });
- this.length = index;
- }
- this._truncate(record);
- this.collection = collection;
- return this.isDirty;
- }
- /* CollectionChanges is considered dirty if it has any additions, moves, removals, or identity
- * changes.
- */
- get isDirty() {
- return this._additionsHead !== null || this._movesHead !== null || this._removalsHead !== null || this._identityChangesHead !== null;
- }
- /**
- * Reset the state of the change objects to show no changes. This means set previousKey to
- * currentKey, and clear all of the queues (additions, moves, removals).
- * Set the previousIndexes of moved and added items to their currentIndexes
- * Reset the list of additions, moves and removals
- *
- * @internal
- */
- _reset() {
- if (this.isDirty) {
- let record;
- for (record = this._previousItHead = this._itHead; record !== null; record = record._next) {
- record._nextPrevious = record._next;
- }
- for (record = this._additionsHead; record !== null; record = record._nextAdded) {
- record.previousIndex = record.currentIndex;
- }
- this._additionsHead = this._additionsTail = null;
- for (record = this._movesHead; record !== null; record = record._nextMoved) {
- record.previousIndex = record.currentIndex;
- }
- this._movesHead = this._movesTail = null;
- this._removalsHead = this._removalsTail = null;
- this._identityChangesHead = this._identityChangesTail = null;
- }
- }
- /**
- * This is the core function which handles differences between collections.
- *
- * - `record` is the record which we saw at this position last time. If null then it is a new
- * item.
- * - `item` is the current item in the collection
- * - `index` is the position of the item in the collection
- *
- * @internal
- */
- _mismatch(record, item, itemTrackBy, index) {
- let previousRecord;
- if (record === null) {
- previousRecord = this._itTail;
- } else {
- previousRecord = record._prev;
- this._remove(record);
- }
- record = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null);
- if (record !== null) {
- if (!Object.is(record.item, item))
- this._addIdentityChange(record, item);
- this._reinsertAfter(record, previousRecord, index);
- } else {
- record = this._linkedRecords === null ? null : this._linkedRecords.get(itemTrackBy, index);
- if (record !== null) {
- if (!Object.is(record.item, item))
- this._addIdentityChange(record, item);
- this._moveAfter(record, previousRecord, index);
- } else {
- record = this._addAfter(new IterableChangeRecord_(item, itemTrackBy), previousRecord, index);
- }
- }
- return record;
- }
- /**
- * This check is only needed if an array contains duplicates. (Short circuit of nothing dirty)
- *
- * Use case: `[a, a]` => `[b, a, a]`
- *
- * If we did not have this check then the insertion of `b` would:
- * 1) evict first `a`
- * 2) insert `b` at `0` index.
- * 3) leave `a` at index `1` as is. <-- this is wrong!
- * 3) reinsert `a` at index 2. <-- this is wrong!
- *
- * The correct behavior is:
- * 1) evict first `a`
- * 2) insert `b` at `0` index.
- * 3) reinsert `a` at index 1.
- * 3) move `a` at from `1` to `2`.
- *
- *
- * Double check that we have not evicted a duplicate item. We need to check if the item type may
- * have already been removed:
- * The insertion of b will evict the first 'a'. If we don't reinsert it now it will be reinserted
- * at the end. Which will show up as the two 'a's switching position. This is incorrect, since a
- * better way to think of it is as insert of 'b' rather then switch 'a' with 'b' and then add 'a'
- * at the end.
- *
- * @internal
- */
- _verifyReinsertion(record, item, itemTrackBy, index) {
- let reinsertRecord = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null);
- if (reinsertRecord !== null) {
- record = this._reinsertAfter(reinsertRecord, record._prev, index);
- } else if (record.currentIndex != index) {
- record.currentIndex = index;
- this._addToMoves(record, index);
- }
- return record;
- }
- /**
- * Get rid of any excess {@link IterableChangeRecord_}s from the previous collection
- *
- * - `record` The first excess {@link IterableChangeRecord_}.
- *
- * @internal
- */
- _truncate(record) {
- while (record !== null) {
- const nextRecord = record._next;
- this._addToRemovals(this._unlink(record));
- record = nextRecord;
- }
- if (this._unlinkedRecords !== null) {
- this._unlinkedRecords.clear();
- }
- if (this._additionsTail !== null) {
- this._additionsTail._nextAdded = null;
- }
- if (this._movesTail !== null) {
- this._movesTail._nextMoved = null;
- }
- if (this._itTail !== null) {
- this._itTail._next = null;
- }
- if (this._removalsTail !== null) {
- this._removalsTail._nextRemoved = null;
- }
- if (this._identityChangesTail !== null) {
- this._identityChangesTail._nextIdentityChange = null;
- }
- }
- /** @internal */
- _reinsertAfter(record, prevRecord, index) {
- if (this._unlinkedRecords !== null) {
- this._unlinkedRecords.remove(record);
- }
- const prev = record._prevRemoved;
- const next = record._nextRemoved;
- if (prev === null) {
- this._removalsHead = next;
- } else {
- prev._nextRemoved = next;
- }
- if (next === null) {
- this._removalsTail = prev;
- } else {
- next._prevRemoved = prev;
- }
- this._insertAfter(record, prevRecord, index);
- this._addToMoves(record, index);
- return record;
- }
- /** @internal */
- _moveAfter(record, prevRecord, index) {
- this._unlink(record);
- this._insertAfter(record, prevRecord, index);
- this._addToMoves(record, index);
- return record;
- }
- /** @internal */
- _addAfter(record, prevRecord, index) {
- this._insertAfter(record, prevRecord, index);
- if (this._additionsTail === null) {
- this._additionsTail = this._additionsHead = record;
- } else {
- this._additionsTail = this._additionsTail._nextAdded = record;
- }
- return record;
- }
- /** @internal */
- _insertAfter(record, prevRecord, index) {
- const next = prevRecord === null ? this._itHead : prevRecord._next;
- record._next = next;
- record._prev = prevRecord;
- if (next === null) {
- this._itTail = record;
- } else {
- next._prev = record;
- }
- if (prevRecord === null) {
- this._itHead = record;
- } else {
- prevRecord._next = record;
- }
- if (this._linkedRecords === null) {
- this._linkedRecords = new _DuplicateMap();
- }
- this._linkedRecords.put(record);
- record.currentIndex = index;
- return record;
- }
- /** @internal */
- _remove(record) {
- return this._addToRemovals(this._unlink(record));
- }
- /** @internal */
- _unlink(record) {
- if (this._linkedRecords !== null) {
- this._linkedRecords.remove(record);
- }
- const prev = record._prev;
- const next = record._next;
- if (prev === null) {
- this._itHead = next;
- } else {
- prev._next = next;
- }
- if (next === null) {
- this._itTail = prev;
- } else {
- next._prev = prev;
- }
- return record;
- }
- /** @internal */
- _addToMoves(record, toIndex) {
- if (record.previousIndex === toIndex) {
- return record;
- }
- if (this._movesTail === null) {
- this._movesTail = this._movesHead = record;
- } else {
- this._movesTail = this._movesTail._nextMoved = record;
- }
- return record;
- }
- _addToRemovals(record) {
- if (this._unlinkedRecords === null) {
- this._unlinkedRecords = new _DuplicateMap();
- }
- this._unlinkedRecords.put(record);
- record.currentIndex = null;
- record._nextRemoved = null;
- if (this._removalsTail === null) {
- this._removalsTail = this._removalsHead = record;
- record._prevRemoved = null;
- } else {
- record._prevRemoved = this._removalsTail;
- this._removalsTail = this._removalsTail._nextRemoved = record;
- }
- return record;
- }
- /** @internal */
- _addIdentityChange(record, item) {
- record.item = item;
- if (this._identityChangesTail === null) {
- this._identityChangesTail = this._identityChangesHead = record;
- } else {
- this._identityChangesTail = this._identityChangesTail._nextIdentityChange = record;
- }
- return record;
- }
- };
- var IterableChangeRecord_ = class {
- constructor(item, trackById) {
- this.item = item;
- this.trackById = trackById;
- this.currentIndex = null;
- this.previousIndex = null;
- this._nextPrevious = null;
- this._prev = null;
- this._next = null;
- this._prevDup = null;
- this._nextDup = null;
- this._prevRemoved = null;
- this._nextRemoved = null;
- this._nextAdded = null;
- this._nextMoved = null;
- this._nextIdentityChange = null;
- }
- };
- var _DuplicateItemRecordList = class {
- constructor() {
- this._head = null;
- this._tail = null;
- }
- /**
- * Append the record to the list of duplicates.
- *
- * Note: by design all records in the list of duplicates hold the same value in record.item.
- */
- add(record) {
- if (this._head === null) {
- this._head = this._tail = record;
- record._nextDup = null;
- record._prevDup = null;
- } else {
- this._tail._nextDup = record;
- record._prevDup = this._tail;
- record._nextDup = null;
- this._tail = record;
- }
- }
- // Returns a IterableChangeRecord_ having IterableChangeRecord_.trackById == trackById and
- // IterableChangeRecord_.currentIndex >= atOrAfterIndex
- get(trackById, atOrAfterIndex) {
- let record;
- for (record = this._head; record !== null; record = record._nextDup) {
- if ((atOrAfterIndex === null || atOrAfterIndex <= record.currentIndex) && Object.is(record.trackById, trackById)) {
- return record;
- }
- }
- return null;
- }
- /**
- * Remove one {@link IterableChangeRecord_} from the list of duplicates.
- *
- * Returns whether the list of duplicates is empty.
- */
- remove(record) {
- const prev = record._prevDup;
- const next = record._nextDup;
- if (prev === null) {
- this._head = next;
- } else {
- prev._nextDup = next;
- }
- if (next === null) {
- this._tail = prev;
- } else {
- next._prevDup = prev;
- }
- return this._head === null;
- }
- };
- var _DuplicateMap = class {
- constructor() {
- this.map = /* @__PURE__ */ new Map();
- }
- put(record) {
- const key = record.trackById;
- let duplicates = this.map.get(key);
- if (!duplicates) {
- duplicates = new _DuplicateItemRecordList();
- this.map.set(key, duplicates);
- }
- duplicates.add(record);
- }
- /**
- * Retrieve the `value` using key. Because the IterableChangeRecord_ value may be one which we
- * have already iterated over, we use the `atOrAfterIndex` to pretend it is not there.
- *
- * Use case: `[a, b, c, a, a]` if we are at index `3` which is the second `a` then asking if we
- * have any more `a`s needs to return the second `a`.
- */
- get(trackById, atOrAfterIndex) {
- const key = trackById;
- const recordList = this.map.get(key);
- return recordList ? recordList.get(trackById, atOrAfterIndex) : null;
- }
- /**
- * Removes a {@link IterableChangeRecord_} from the list of duplicates.
- *
- * The list of duplicates also is removed from the map if it gets empty.
- */
- remove(record) {
- const key = record.trackById;
- const recordList = this.map.get(key);
- if (recordList.remove(record)) {
- this.map.delete(key);
- }
- return record;
- }
- get isEmpty() {
- return this.map.size === 0;
- }
- clear() {
- this.map.clear();
- }
- };
- function getPreviousIndex(item, addRemoveOffset, moveOffsets) {
- const previousIndex = item.previousIndex;
- if (previousIndex === null)
- return previousIndex;
- let moveOffset = 0;
- if (moveOffsets && previousIndex < moveOffsets.length) {
- moveOffset = moveOffsets[previousIndex];
- }
- return previousIndex + addRemoveOffset + moveOffset;
- }
- var DefaultKeyValueDifferFactory = class {
- constructor() {
- }
- supports(obj) {
- return obj instanceof Map || isJsObject(obj);
- }
- create() {
- return new DefaultKeyValueDiffer();
- }
- };
- var DefaultKeyValueDiffer = class {
- constructor() {
- this._records = /* @__PURE__ */ new Map();
- this._mapHead = null;
- this._appendAfter = null;
- this._previousMapHead = null;
- this._changesHead = null;
- this._changesTail = null;
- this._additionsHead = null;
- this._additionsTail = null;
- this._removalsHead = null;
- this._removalsTail = null;
- }
- get isDirty() {
- return this._additionsHead !== null || this._changesHead !== null || this._removalsHead !== null;
- }
- forEachItem(fn) {
- let record;
- for (record = this._mapHead; record !== null; record = record._next) {
- fn(record);
- }
- }
- forEachPreviousItem(fn) {
- let record;
- for (record = this._previousMapHead; record !== null; record = record._nextPrevious) {
- fn(record);
- }
- }
- forEachChangedItem(fn) {
- let record;
- for (record = this._changesHead; record !== null; record = record._nextChanged) {
- fn(record);
- }
- }
- forEachAddedItem(fn) {
- let record;
- for (record = this._additionsHead; record !== null; record = record._nextAdded) {
- fn(record);
- }
- }
- forEachRemovedItem(fn) {
- let record;
- for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
- fn(record);
- }
- }
- diff(map2) {
- if (!map2) {
- map2 = /* @__PURE__ */ new Map();
- } else if (!(map2 instanceof Map || isJsObject(map2))) {
- throw new RuntimeError(900, ngDevMode && `Error trying to diff '${stringify(map2)}'. Only maps and objects are allowed`);
- }
- return this.check(map2) ? this : null;
- }
- onDestroy() {
- }
- /**
- * Check the current state of the map vs the previous.
- * The algorithm is optimised for when the keys do no change.
- */
- check(map2) {
- this._reset();
- let insertBefore = this._mapHead;
- this._appendAfter = null;
- this._forEach(map2, (value, key) => {
- if (insertBefore && insertBefore.key === key) {
- this._maybeAddToChanges(insertBefore, value);
- this._appendAfter = insertBefore;
- insertBefore = insertBefore._next;
- } else {
- const record = this._getOrCreateRecordForKey(key, value);
- insertBefore = this._insertBeforeOrAppend(insertBefore, record);
- }
- });
- if (insertBefore) {
- if (insertBefore._prev) {
- insertBefore._prev._next = null;
- }
- this._removalsHead = insertBefore;
- for (let record = insertBefore; record !== null; record = record._nextRemoved) {
- if (record === this._mapHead) {
- this._mapHead = null;
- }
- this._records.delete(record.key);
- record._nextRemoved = record._next;
- record.previousValue = record.currentValue;
- record.currentValue = null;
- record._prev = null;
- record._next = null;
- }
- }
- if (this._changesTail)
- this._changesTail._nextChanged = null;
- if (this._additionsTail)
- this._additionsTail._nextAdded = null;
- return this.isDirty;
- }
- /**
- * Inserts a record before `before` or append at the end of the list when `before` is null.
- *
- * Notes:
- * - This method appends at `this._appendAfter`,
- * - This method updates `this._appendAfter`,
- * - The return value is the new value for the insertion pointer.
- */
- _insertBeforeOrAppend(before, record) {
- if (before) {
- const prev = before._prev;
- record._next = before;
- record._prev = prev;
- before._prev = record;
- if (prev) {
- prev._next = record;
- }
- if (before === this._mapHead) {
- this._mapHead = record;
- }
- this._appendAfter = before;
- return before;
- }
- if (this._appendAfter) {
- this._appendAfter._next = record;
- record._prev = this._appendAfter;
- } else {
- this._mapHead = record;
- }
- this._appendAfter = record;
- return null;
- }
- _getOrCreateRecordForKey(key, value) {
- if (this._records.has(key)) {
- const record2 = this._records.get(key);
- this._maybeAddToChanges(record2, value);
- const prev = record2._prev;
- const next = record2._next;
- if (prev) {
- prev._next = next;
- }
- if (next) {
- next._prev = prev;
- }
- record2._next = null;
- record2._prev = null;
- return record2;
- }
- const record = new KeyValueChangeRecord_(key);
- this._records.set(key, record);
- record.currentValue = value;
- this._addToAdditions(record);
- return record;
- }
- /** @internal */
- _reset() {
- if (this.isDirty) {
- let record;
- this._previousMapHead = this._mapHead;
- for (record = this._previousMapHead; record !== null; record = record._next) {
- record._nextPrevious = record._next;
- }
- for (record = this._changesHead; record !== null; record = record._nextChanged) {
- record.previousValue = record.currentValue;
- }
- for (record = this._additionsHead; record != null; record = record._nextAdded) {
- record.previousValue = record.currentValue;
- }
- this._changesHead = this._changesTail = null;
- this._additionsHead = this._additionsTail = null;
- this._removalsHead = null;
- }
- }
- // Add the record or a given key to the list of changes only when the value has actually changed
- _maybeAddToChanges(record, newValue) {
- if (!Object.is(newValue, record.currentValue)) {
- record.previousValue = record.currentValue;
- record.currentValue = newValue;
- this._addToChanges(record);
- }
- }
- _addToAdditions(record) {
- if (this._additionsHead === null) {
- this._additionsHead = this._additionsTail = record;
- } else {
- this._additionsTail._nextAdded = record;
- this._additionsTail = record;
- }
- }
- _addToChanges(record) {
- if (this._changesHead === null) {
- this._changesHead = this._changesTail = record;
- } else {
- this._changesTail._nextChanged = record;
- this._changesTail = record;
- }
- }
- /** @internal */
- _forEach(obj, fn) {
- if (obj instanceof Map) {
- obj.forEach(fn);
- } else {
- Object.keys(obj).forEach((k) => fn(obj[k], k));
- }
- }
- };
- var KeyValueChangeRecord_ = class {
- constructor(key) {
- this.key = key;
- this.previousValue = null;
- this.currentValue = null;
- this._nextPrevious = null;
- this._next = null;
- this._prev = null;
- this._nextAdded = null;
- this._nextRemoved = null;
- this._nextChanged = null;
- }
- };
- function defaultIterableDiffersFactory() {
- return new IterableDiffers([new DefaultIterableDifferFactory()]);
- }
- var _IterableDiffers = class _IterableDiffers {
- constructor(factories) {
- this.factories = factories;
- }
- static create(factories, parent) {
- if (parent != null) {
- const copied = parent.factories.slice();
- factories = factories.concat(copied);
- }
- return new _IterableDiffers(factories);
- }
- /**
- * Takes an array of {@link IterableDifferFactory} and returns a provider used to extend the
- * inherited {@link IterableDiffers} instance with the provided factories and return a new
- * {@link IterableDiffers} instance.
- *
- * @usageNotes
- * ### Example
- *
- * The following example shows how to extend an existing list of factories,
- * which will only be applied to the injector for this component and its children.
- * This step is all that's required to make a new {@link IterableDiffer} available.
- *
- * ```
- * @Component({
- * viewProviders: [
- * IterableDiffers.extend([new ImmutableListDiffer()])
- * ]
- * })
- * ```
- */
- static extend(factories) {
- return {
- provide: _IterableDiffers,
- useFactory: (parent) => {
- return _IterableDiffers.create(factories, parent || defaultIterableDiffersFactory());
- },
- // Dependency technically isn't optional, but we can provide a better error message this way.
- deps: [[_IterableDiffers, new SkipSelf(), new Optional()]]
- };
- }
- find(iterable) {
- const factory = this.factories.find((f) => f.supports(iterable));
- if (factory != null) {
- return factory;
- } else {
- throw new RuntimeError(901, ngDevMode && `Cannot find a differ supporting object '${iterable}' of type '${getTypeNameForDebugging(iterable)}'`);
- }
- }
- };
- _IterableDiffers.ɵprov = ɵɵdefineInjectable({ token: _IterableDiffers, providedIn: "root", factory: defaultIterableDiffersFactory });
- var IterableDiffers = _IterableDiffers;
- function getTypeNameForDebugging(type) {
- return type["name"] || typeof type;
- }
- function defaultKeyValueDiffersFactory() {
- return new KeyValueDiffers([new DefaultKeyValueDifferFactory()]);
- }
- var _KeyValueDiffers = class _KeyValueDiffers {
- constructor(factories) {
- this.factories = factories;
- }
- static create(factories, parent) {
- if (parent) {
- const copied = parent.factories.slice();
- factories = factories.concat(copied);
- }
- return new _KeyValueDiffers(factories);
- }
- /**
- * Takes an array of {@link KeyValueDifferFactory} and returns a provider used to extend the
- * inherited {@link KeyValueDiffers} instance with the provided factories and return a new
- * {@link KeyValueDiffers} instance.
- *
- * @usageNotes
- * ### Example
- *
- * The following example shows how to extend an existing list of factories,
- * which will only be applied to the injector for this component and its children.
- * This step is all that's required to make a new {@link KeyValueDiffer} available.
- *
- * ```
- * @Component({
- * viewProviders: [
- * KeyValueDiffers.extend([new ImmutableMapDiffer()])
- * ]
- * })
- * ```
- */
- static extend(factories) {
- return {
- provide: _KeyValueDiffers,
- useFactory: (parent) => {
- return _KeyValueDiffers.create(factories, parent || defaultKeyValueDiffersFactory());
- },
- // Dependency technically isn't optional, but we can provide a better error message this way.
- deps: [[_KeyValueDiffers, new SkipSelf(), new Optional()]]
- };
- }
- find(kv) {
- const factory = this.factories.find((f) => f.supports(kv));
- if (factory) {
- return factory;
- }
- throw new RuntimeError(901, ngDevMode && `Cannot find a differ supporting object '${kv}'`);
- }
- };
- _KeyValueDiffers.ɵprov = ɵɵdefineInjectable({ token: _KeyValueDiffers, providedIn: "root", factory: defaultKeyValueDiffersFactory });
- var KeyValueDiffers = _KeyValueDiffers;
- 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);
- }
- }
- }
- var _ChangeDetectorRef = class _ChangeDetectorRef {
- };
- _ChangeDetectorRef.__NG_ELEMENT_ID__ = injectChangeDetectorRef;
- var ChangeDetectorRef = _ChangeDetectorRef;
- function injectChangeDetectorRef(flags) {
- return createViewRef(
- getCurrentTNode(),
- getLView(),
- (flags & 16) === 16
- /* InternalInjectFlags.ForPipe */
- );
- }
- function createViewRef(tNode, lView, isPipe2) {
- if (isComponentHost(tNode) && !isPipe2) {
- const componentView = getComponentLViewByIndex(tNode.index, lView);
- return new ViewRef$1(componentView, componentView);
- } else if (tNode.type & (3 | 12 | 32)) {
- const hostComponentView = lView[DECLARATION_COMPONENT_VIEW];
- return new ViewRef$1(hostComponentView, lView);
- }
- return null;
- }
- var keyValDiff = [new DefaultKeyValueDifferFactory()];
- var iterableDiff = [new DefaultIterableDifferFactory()];
- var defaultIterableDiffers = new IterableDiffers(iterableDiff);
- var defaultKeyValueDiffers = new KeyValueDiffers(keyValDiff);
- var _DestroyRef = class _DestroyRef {
- };
- _DestroyRef.__NG_ELEMENT_ID__ = injectDestroyRef;
- _DestroyRef.__NG_ENV_ID__ = (injector) => injector;
- var DestroyRef = _DestroyRef;
- var NodeInjectorDestroyRef = class extends DestroyRef {
- constructor(_lView) {
- super();
- this._lView = _lView;
- }
- onDestroy(callback) {
- storeLViewOnDestroy(this._lView, callback);
- return () => removeLViewOnDestroy(this._lView, callback);
- }
- };
- function injectDestroyRef() {
- return new NodeInjectorDestroyRef(getLView());
- }
- function assertNotInReactiveContext(debugFn, extraContext) {
- if (getActiveConsumer() !== null) {
- throw new RuntimeError(-602, ngDevMode && `${debugFn.name}() cannot be called from within a reactive context.${extraContext ? ` ${extraContext}` : ""}`);
- }
- }
- var APP_EFFECT_SCHEDULER = new InjectionToken("", {
- providedIn: "root",
- factory: () => inject(EffectScheduler)
- });
- var _EffectScheduler = class _EffectScheduler {
- };
- _EffectScheduler.ɵprov = ɵɵdefineInjectable({
- token: _EffectScheduler,
- providedIn: "root",
- factory: () => new ZoneAwareEffectScheduler()
- });
- var EffectScheduler = _EffectScheduler;
- var ZoneAwareEffectScheduler = class {
- constructor() {
- this.hasQueuedFlush = false;
- this.queuedEffectCount = 0;
- this.queues = /* @__PURE__ */ new Map();
- }
- scheduleEffect(handle) {
- this.enqueue(handle);
- if (!this.hasQueuedFlush) {
- queueMicrotask(() => this.flush());
- this.hasQueuedFlush = false;
- }
- }
- enqueue(handle) {
- const zone = handle.creationZone;
- if (!this.queues.has(zone)) {
- this.queues.set(zone, /* @__PURE__ */ new Set());
- }
- const queue = this.queues.get(zone);
- if (queue.has(handle)) {
- return;
- }
- this.queuedEffectCount++;
- queue.add(handle);
- }
- /**
- * Run all scheduled effects.
- *
- * Execution order of effects within the same zone is guaranteed to be FIFO, but there is no
- * ordering guarantee between effects scheduled in different zones.
- */
- flush() {
- while (this.queuedEffectCount > 0) {
- for (const [zone, queue] of this.queues) {
- if (zone === null) {
- this.flushQueue(queue);
- } else {
- zone.run(() => this.flushQueue(queue));
- }
- }
- }
- }
- flushQueue(queue) {
- for (const handle of queue) {
- queue.delete(handle);
- this.queuedEffectCount--;
- handle.run();
- }
- }
- };
- var EffectHandle = class {
- constructor(scheduler, effectFn, creationZone, destroyRef, injector, allowSignalWrites) {
- this.scheduler = scheduler;
- this.effectFn = effectFn;
- this.creationZone = creationZone;
- this.injector = injector;
- this.watcher = createWatch((onCleanup) => this.runEffect(onCleanup), () => this.schedule(), allowSignalWrites);
- this.unregisterOnDestroy = destroyRef?.onDestroy(() => this.destroy());
- }
- runEffect(onCleanup) {
- try {
- this.effectFn(onCleanup);
- } catch (err) {
- const errorHandler = this.injector.get(ErrorHandler, null, { optional: true });
- errorHandler?.handleError(err);
- }
- }
- run() {
- this.watcher.run();
- }
- schedule() {
- this.scheduler.scheduleEffect(this);
- }
- destroy() {
- this.watcher.destroy();
- this.unregisterOnDestroy?.();
- }
- };
- function effect(effectFn, options) {
- ngDevMode && assertNotInReactiveContext(effect, "Call `effect` outside of a reactive context. For example, schedule the effect inside the component constructor.");
- !options?.injector && assertInInjectionContext(effect);
- const injector = options?.injector ?? inject(Injector);
- const destroyRef = options?.manualCleanup !== true ? injector.get(DestroyRef) : null;
- const handle = new EffectHandle(injector.get(APP_EFFECT_SCHEDULER), effectFn, typeof Zone === "undefined" ? null : Zone.current, destroyRef, injector, options?.allowSignalWrites ?? false);
- const cdr = injector.get(ChangeDetectorRef, null, { optional: true });
- if (!cdr || !(cdr._lView[FLAGS] & 8)) {
- handle.watcher.notify();
- } else {
- (cdr._lView[EFFECTS_TO_SCHEDULE] ??= []).push(handle.watcher.notify);
- }
- return handle;
- }
- var markedFeatures = /* @__PURE__ */ new Set();
- function performanceMarkFeature(feature) {
- if (markedFeatures.has(feature)) {
- return;
- }
- markedFeatures.add(feature);
- performance?.mark?.("mark_feature_usage", { detail: { feature } });
- }
- function noop(...args) {
- }
- function getNativeRequestAnimationFrame() {
- const isBrowser = typeof _global["requestAnimationFrame"] === "function";
- let nativeRequestAnimationFrame = _global[isBrowser ? "requestAnimationFrame" : "setTimeout"];
- let nativeCancelAnimationFrame = _global[isBrowser ? "cancelAnimationFrame" : "clearTimeout"];
- if (typeof Zone !== "undefined" && nativeRequestAnimationFrame && nativeCancelAnimationFrame) {
- const unpatchedRequestAnimationFrame = nativeRequestAnimationFrame[Zone.__symbol__("OriginalDelegate")];
- if (unpatchedRequestAnimationFrame) {
- nativeRequestAnimationFrame = unpatchedRequestAnimationFrame;
- }
- const unpatchedCancelAnimationFrame = nativeCancelAnimationFrame[Zone.__symbol__("OriginalDelegate")];
- if (unpatchedCancelAnimationFrame) {
- nativeCancelAnimationFrame = unpatchedCancelAnimationFrame;
- }
- }
- return { nativeRequestAnimationFrame, nativeCancelAnimationFrame };
- }
- var AsyncStackTaggingZoneSpec = class {
- constructor(namePrefix, consoleAsyncStackTaggingImpl = console) {
- this.name = "asyncStackTagging for " + namePrefix;
- this.createTask = consoleAsyncStackTaggingImpl?.createTask ?? (() => null);
- }
- onScheduleTask(delegate, _current, target, task) {
- task.consoleTask = this.createTask(`Zone - ${task.source || task.type}`);
- return delegate.scheduleTask(target, task);
- }
- onInvokeTask(delegate, _currentZone, targetZone, task, applyThis, applyArgs) {
- let ret;
- if (task.consoleTask) {
- ret = task.consoleTask.run(() => delegate.invokeTask(targetZone, task, applyThis, applyArgs));
- } else {
- ret = delegate.invokeTask(targetZone, task, applyThis, applyArgs);
- }
- return ret;
- }
- };
- var NgZone = class _NgZone {
- constructor({ enableLongStackTrace = false, shouldCoalesceEventChangeDetection = false, shouldCoalesceRunChangeDetection = false }) {
- this.hasPendingMacrotasks = false;
- this.hasPendingMicrotasks = false;
- this.isStable = true;
- this.onUnstable = new EventEmitter(false);
- this.onMicrotaskEmpty = new EventEmitter(false);
- this.onStable = new EventEmitter(false);
- this.onError = new EventEmitter(false);
- if (typeof Zone == "undefined") {
- throw new RuntimeError(908, ngDevMode && `In this configuration Angular requires Zone.js`);
- }
- Zone.assertZonePatched();
- const self = this;
- self._nesting = 0;
- self._outer = self._inner = Zone.current;
- if (ngDevMode) {
- self._inner = self._inner.fork(new AsyncStackTaggingZoneSpec("Angular"));
- }
- if (Zone["TaskTrackingZoneSpec"]) {
- self._inner = self._inner.fork(new Zone["TaskTrackingZoneSpec"]());
- }
- if (enableLongStackTrace && Zone["longStackTraceZoneSpec"]) {
- self._inner = self._inner.fork(Zone["longStackTraceZoneSpec"]);
- }
- self.shouldCoalesceEventChangeDetection = !shouldCoalesceRunChangeDetection && shouldCoalesceEventChangeDetection;
- self.shouldCoalesceRunChangeDetection = shouldCoalesceRunChangeDetection;
- self.lastRequestAnimationFrameId = -1;
- self.nativeRequestAnimationFrame = getNativeRequestAnimationFrame().nativeRequestAnimationFrame;
- forkInnerZoneWithAngularBehavior(self);
- }
- /**
- This method checks whether the method call happens within an Angular Zone instance.
- */
- static isInAngularZone() {
- return typeof Zone !== "undefined" && Zone.current.get("isAngularZone") === true;
- }
- /**
- Assures that the method is called within the Angular Zone, otherwise throws an error.
- */
- static assertInAngularZone() {
- if (!_NgZone.isInAngularZone()) {
- throw new RuntimeError(909, ngDevMode && "Expected to be in Angular Zone, but it is not!");
- }
- }
- /**
- Assures that the method is called outside of the Angular Zone, otherwise throws an error.
- */
- static assertNotInAngularZone() {
- if (_NgZone.isInAngularZone()) {
- throw new RuntimeError(909, ngDevMode && "Expected to not be in Angular Zone, but it is!");
- }
- }
- /**
- * Executes the `fn` function synchronously within the Angular zone and returns value returned by
- * the function.
- *
- * Running functions via `run` allows you to reenter Angular zone from a task that was executed
- * outside of the Angular zone (typically started via {@link #runOutsideAngular}).
- *
- * Any future tasks or microtasks scheduled from within this function will continue executing from
- * within the Angular zone.
- *
- * If a synchronous error happens it will be rethrown and not reported via `onError`.
- */
- run(fn, applyThis, applyArgs) {
- return this._inner.run(fn, applyThis, applyArgs);
- }
- /**
- * Executes the `fn` function synchronously within the Angular zone as a task and returns value
- * returned by the function.
- *
- * Running functions via `run` allows you to reenter Angular zone from a task that was executed
- * outside of the Angular zone (typically started via {@link #runOutsideAngular}).
- *
- * Any future tasks or microtasks scheduled from within this function will continue executing from
- * within the Angular zone.
- *
- * If a synchronous error happens it will be rethrown and not reported via `onError`.
- */
- runTask(fn, applyThis, applyArgs, name) {
- const zone = this._inner;
- const task = zone.scheduleEventTask("NgZoneEvent: " + name, fn, EMPTY_PAYLOAD, noop, noop);
- try {
- return zone.runTask(task, applyThis, applyArgs);
- } finally {
- zone.cancelTask(task);
- }
- }
- /**
- * Same as `run`, except that synchronous errors are caught and forwarded via `onError` and not
- * rethrown.
- */
- runGuarded(fn, applyThis, applyArgs) {
- return this._inner.runGuarded(fn, applyThis, applyArgs);
- }
- /**
- * Executes the `fn` function synchronously in Angular's parent zone and returns value returned by
- * the function.
- *
- * Running functions via {@link #runOutsideAngular} allows you to escape Angular's zone and do
- * work that
- * doesn't trigger Angular change-detection or is subject to Angular's error handling.
- *
- * Any future tasks or microtasks scheduled from within this function will continue executing from
- * outside of the Angular zone.
- *
- * Use {@link #run} to reenter the Angular zone and do work that updates the application model.
- */
- runOutsideAngular(fn) {
- return this._outer.run(fn);
- }
- };
- var EMPTY_PAYLOAD = {};
- function checkStable(zone) {
- if (zone._nesting == 0 && !zone.hasPendingMicrotasks && !zone.isStable) {
- try {
- zone._nesting++;
- zone.onMicrotaskEmpty.emit(null);
- } finally {
- zone._nesting--;
- if (!zone.hasPendingMicrotasks) {
- try {
- zone.runOutsideAngular(() => zone.onStable.emit(null));
- } finally {
- zone.isStable = true;
- }
- }
- }
- }
- }
- function delayChangeDetectionForEvents(zone) {
- if (zone.isCheckStableRunning || zone.lastRequestAnimationFrameId !== -1) {
- return;
- }
- zone.lastRequestAnimationFrameId = zone.nativeRequestAnimationFrame.call(_global, () => {
- if (!zone.fakeTopEventTask) {
- zone.fakeTopEventTask = Zone.root.scheduleEventTask("fakeTopEventTask", () => {
- zone.lastRequestAnimationFrameId = -1;
- updateMicroTaskStatus(zone);
- zone.isCheckStableRunning = true;
- checkStable(zone);
- zone.isCheckStableRunning = false;
- }, void 0, () => {
- }, () => {
- });
- }
- zone.fakeTopEventTask.invoke();
- });
- updateMicroTaskStatus(zone);
- }
- function forkInnerZoneWithAngularBehavior(zone) {
- const delayChangeDetectionForEventsDelegate = () => {
- delayChangeDetectionForEvents(zone);
- };
- zone._inner = zone._inner.fork({
- name: "angular",
- properties: { "isAngularZone": true },
- onInvokeTask: (delegate, current, target, task, applyThis, applyArgs) => {
- if (shouldBeIgnoredByZone(applyArgs)) {
- return delegate.invokeTask(target, task, applyThis, applyArgs);
- }
- try {
- onEnter(zone);
- return delegate.invokeTask(target, task, applyThis, applyArgs);
- } finally {
- if (zone.shouldCoalesceEventChangeDetection && task.type === "eventTask" || zone.shouldCoalesceRunChangeDetection) {
- delayChangeDetectionForEventsDelegate();
- }
- onLeave(zone);
- }
- },
- onInvoke: (delegate, current, target, callback, applyThis, applyArgs, source) => {
- try {
- onEnter(zone);
- return delegate.invoke(target, callback, applyThis, applyArgs, source);
- } finally {
- if (zone.shouldCoalesceRunChangeDetection) {
- delayChangeDetectionForEventsDelegate();
- }
- onLeave(zone);
- }
- },
- onHasTask: (delegate, current, target, hasTaskState) => {
- delegate.hasTask(target, hasTaskState);
- if (current === target) {
- if (hasTaskState.change == "microTask") {
- zone._hasPendingMicrotasks = hasTaskState.microTask;
- updateMicroTaskStatus(zone);
- checkStable(zone);
- } else if (hasTaskState.change == "macroTask") {
- zone.hasPendingMacrotasks = hasTaskState.macroTask;
- }
- }
- },
- onHandleError: (delegate, current, target, error) => {
- delegate.handleError(target, error);
- zone.runOutsideAngular(() => zone.onError.emit(error));
- return false;
- }
- });
- }
- function updateMicroTaskStatus(zone) {
- if (zone._hasPendingMicrotasks || (zone.shouldCoalesceEventChangeDetection || zone.shouldCoalesceRunChangeDetection) && zone.lastRequestAnimationFrameId !== -1) {
- zone.hasPendingMicrotasks = true;
- } else {
- zone.hasPendingMicrotasks = false;
- }
- }
- function onEnter(zone) {
- zone._nesting++;
- if (zone.isStable) {
- zone.isStable = false;
- zone.onUnstable.emit(null);
- }
- }
- function onLeave(zone) {
- zone._nesting--;
- checkStable(zone);
- }
- var NoopNgZone = class {
- constructor() {
- this.hasPendingMicrotasks = false;
- this.hasPendingMacrotasks = false;
- this.isStable = true;
- this.onUnstable = new EventEmitter();
- this.onMicrotaskEmpty = new EventEmitter();
- this.onStable = new EventEmitter();
- this.onError = new EventEmitter();
- }
- run(fn, applyThis, applyArgs) {
- return fn.apply(applyThis, applyArgs);
- }
- runGuarded(fn, applyThis, applyArgs) {
- return fn.apply(applyThis, applyArgs);
- }
- runOutsideAngular(fn) {
- return fn();
- }
- runTask(fn, applyThis, applyArgs, name) {
- return fn.apply(applyThis, applyArgs);
- }
- };
- function shouldBeIgnoredByZone(applyArgs) {
- if (!Array.isArray(applyArgs)) {
- return false;
- }
- if (applyArgs.length !== 1) {
- return false;
- }
- return applyArgs[0].data?.["__ignore_ng_zone__"] === true;
- }
- function getNgZone(ngZoneToUse = "zone.js", options) {
- if (ngZoneToUse === "noop") {
- return new NoopNgZone();
- }
- if (ngZoneToUse === "zone.js") {
- return new NgZone(options);
- }
- return ngZoneToUse;
- }
- var AfterRenderPhase;
- (function(AfterRenderPhase2) {
- AfterRenderPhase2[AfterRenderPhase2["EarlyRead"] = 0] = "EarlyRead";
- AfterRenderPhase2[AfterRenderPhase2["Write"] = 1] = "Write";
- AfterRenderPhase2[AfterRenderPhase2["MixedReadWrite"] = 2] = "MixedReadWrite";
- AfterRenderPhase2[AfterRenderPhase2["Read"] = 3] = "Read";
- })(AfterRenderPhase || (AfterRenderPhase = {}));
- var NOOP_AFTER_RENDER_REF = {
- destroy() {
- }
- };
- function internalAfterNextRender(callback, options) {
- const injector = options?.injector ?? inject(Injector);
- if (!isPlatformBrowser(injector))
- return;
- const afterRenderEventManager = injector.get(AfterRenderEventManager);
- afterRenderEventManager.internalCallbacks.push(callback);
- }
- function afterRender(callback, options) {
- ngDevMode && assertNotInReactiveContext(afterRender, "Call `afterRender` outside of a reactive context. For example, schedule the render callback inside the component constructor`.");
- !options && assertInInjectionContext(afterRender);
- const injector = options?.injector ?? inject(Injector);
- if (!isPlatformBrowser(injector)) {
- return NOOP_AFTER_RENDER_REF;
- }
- performanceMarkFeature("NgAfterRender");
- const afterRenderEventManager = injector.get(AfterRenderEventManager);
- const callbackHandler = afterRenderEventManager.handler ??= new AfterRenderCallbackHandlerImpl();
- const phase = options?.phase ?? AfterRenderPhase.MixedReadWrite;
- const destroy = () => {
- callbackHandler.unregister(instance);
- unregisterFn();
- };
- const unregisterFn = injector.get(DestroyRef).onDestroy(destroy);
- const instance = new AfterRenderCallback(injector, phase, callback);
- callbackHandler.register(instance);
- return { destroy };
- }
- function afterNextRender(callback, options) {
- !options && assertInInjectionContext(afterNextRender);
- const injector = options?.injector ?? inject(Injector);
- if (!isPlatformBrowser(injector)) {
- return NOOP_AFTER_RENDER_REF;
- }
- performanceMarkFeature("NgAfterNextRender");
- const afterRenderEventManager = injector.get(AfterRenderEventManager);
- const callbackHandler = afterRenderEventManager.handler ??= new AfterRenderCallbackHandlerImpl();
- const phase = options?.phase ?? AfterRenderPhase.MixedReadWrite;
- const destroy = () => {
- callbackHandler.unregister(instance);
- unregisterFn();
- };
- const unregisterFn = injector.get(DestroyRef).onDestroy(destroy);
- const instance = new AfterRenderCallback(injector, phase, () => {
- destroy();
- callback();
- });
- callbackHandler.register(instance);
- return { destroy };
- }
- var AfterRenderCallback = class {
- constructor(injector, phase, callbackFn) {
- this.phase = phase;
- this.callbackFn = callbackFn;
- this.zone = injector.get(NgZone);
- this.errorHandler = injector.get(ErrorHandler, null, { optional: true });
- }
- invoke() {
- try {
- this.zone.runOutsideAngular(this.callbackFn);
- } catch (err) {
- this.errorHandler?.handleError(err);
- }
- }
- };
- var AfterRenderCallbackHandlerImpl = class {
- constructor() {
- this.executingCallbacks = false;
- this.buckets = {
- // Note: the order of these keys controls the order the phases are run.
- [AfterRenderPhase.EarlyRead]: /* @__PURE__ */ new Set(),
- [AfterRenderPhase.Write]: /* @__PURE__ */ new Set(),
- [AfterRenderPhase.MixedReadWrite]: /* @__PURE__ */ new Set(),
- [AfterRenderPhase.Read]: /* @__PURE__ */ new Set()
- };
- this.deferredCallbacks = /* @__PURE__ */ new Set();
- }
- register(callback) {
- const target = this.executingCallbacks ? this.deferredCallbacks : this.buckets[callback.phase];
- target.add(callback);
- }
- unregister(callback) {
- this.buckets[callback.phase].delete(callback);
- this.deferredCallbacks.delete(callback);
- }
- execute() {
- this.executingCallbacks = true;
- for (const bucket of Object.values(this.buckets)) {
- for (const callback of bucket) {
- callback.invoke();
- }
- }
- this.executingCallbacks = false;
- for (const callback of this.deferredCallbacks) {
- this.buckets[callback.phase].add(callback);
- }
- this.deferredCallbacks.clear();
- }
- destroy() {
- for (const bucket of Object.values(this.buckets)) {
- bucket.clear();
- }
- this.deferredCallbacks.clear();
- }
- };
- var _AfterRenderEventManager = class _AfterRenderEventManager {
- constructor() {
- this.handler = null;
- this.internalCallbacks = [];
- }
- /**
- * Executes callbacks. Returns `true` if any callbacks executed.
- */
- execute() {
- const callbacks = [...this.internalCallbacks];
- this.internalCallbacks.length = 0;
- for (const callback of callbacks) {
- callback();
- }
- this.handler?.execute();
- }
- ngOnDestroy() {
- this.handler?.destroy();
- this.handler = null;
- this.internalCallbacks.length = 0;
- }
- };
- _AfterRenderEventManager.ɵprov = ɵɵdefineInjectable({
- token: _AfterRenderEventManager,
- providedIn: "root",
- factory: () => new _AfterRenderEventManager()
- });
- var AfterRenderEventManager = _AfterRenderEventManager;
- function isModuleWithProviders(value) {
- return value.ngModule !== void 0;
- }
- function isNgModule(value) {
- return !!getNgModuleDef(value);
- }
- function isPipe(value) {
- return !!getPipeDef$1(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$1(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$1(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 USE_RUNTIME_DEPS_TRACKER_FOR_JIT = true;
- var DepsTracker = class {
- constructor() {
- this.ownerNgModule = /* @__PURE__ */ new Map();
- this.ngModulesWithSomeUnresolvedDecls = /* @__PURE__ */ new Set();
- this.ngModulesScopeCache = /* @__PURE__ */ new Map();
- this.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 = getNgModuleDef(type, true);
- 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(1e3, "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();
- 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;
- }
- var ComponentFactoryResolver = class extends ComponentFactoryResolver$1 {
- /**
- * @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 ComponentFactory(componentDef, this.ngModule);
- }
- };
- function toRefArray(map2) {
- const array = [];
- for (const publicName in map2) {
- if (!map2.hasOwnProperty(publicName)) {
- continue;
- }
- const value = map2[publicName];
- if (value === void 0) {
- continue;
- }
- array.push({
- propName: Array.isArray(value) ? value[0] : value,
- templateName: publicName
- });
- }
- return array;
- }
- function getNamespace(elementName) {
- const name = elementName.toLowerCase();
- return name === "svg" ? SVG_NAMESPACE : name === "math" ? MATH_ML_NAMESPACE : null;
- }
- var ChainedInjector = class {
- constructor(injector, parentInjector) {
- this.injector = injector;
- this.parentInjector = parentInjector;
- }
- get(token, notFoundValue, flags) {
- flags = convertToBitFlags(flags);
- const value = this.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, flags);
- if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR || notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
- return value;
- }
- return this.parentInjector.get(token, notFoundValue, flags);
- }
- };
- var ComponentFactory = class extends ComponentFactory$1 {
- get inputs() {
- const componentDef = this.componentDef;
- const inputTransforms = componentDef.inputTransforms;
- const refArray = toRefArray(componentDef.inputs);
- if (inputTransforms !== null) {
- for (const input2 of refArray) {
- if (inputTransforms.hasOwnProperty(input2.propName)) {
- input2.transform = inputTransforms[input2.propName];
- }
- }
- }
- return refArray;
- }
- get outputs() {
- return toRefArray(this.componentDef.outputs);
- }
- /**
- * @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 ? componentDef.ngContentSelectors : [];
- this.isBoundToModule = !!ngModule;
- }
- create(injector, projectableNodes, rootSelectorOrNode, environmentInjector) {
- if (ngDevMode && (typeof ngJitMode === "undefined" || ngJitMode) && this.componentDef.debugInfo?.forbidOrphanRendering) {
- if (depsTracker.isOrphanComponent(this.componentType)) {
- throw new RuntimeError(1001, `Orphan component found! Trying to render the component ${debugStringifyTypeForError(this.componentType)} without first loading the NgModule that declares it. It is recommended to make this component standalone in order to avoid this error. If this is not possible now, import the component's NgModule in the appropriate NgModule, or the standalone component in which you are trying to render this component. If this is a lazy import, load the NgModule lazily as well and use its module injector.`);
- }
- }
- environmentInjector = environmentInjector || this.ngModule;
- let realEnvironmentInjector = environmentInjector instanceof EnvironmentInjector ? environmentInjector : environmentInjector?.injector;
- if (realEnvironmentInjector && this.componentDef.getStandaloneInjector !== null) {
- realEnvironmentInjector = this.componentDef.getStandaloneInjector(realEnvironmentInjector) || realEnvironmentInjector;
- }
- const rootViewInjector = realEnvironmentInjector ? new ChainedInjector(injector, realEnvironmentInjector) : injector;
- const rendererFactory = rootViewInjector.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 = rootViewInjector.get(Sanitizer, null);
- const afterRenderEventManager = rootViewInjector.get(AfterRenderEventManager, null);
- const changeDetectionScheduler = rootViewInjector.get(ChangeDetectionScheduler, null);
- const environment = {
- rendererFactory,
- sanitizer,
- // We don't use inline effects (yet).
- inlineEffectRunner: null,
- afterRenderEventManager,
- changeDetectionScheduler
- };
- const hostRenderer = rendererFactory.createRenderer(null, this.componentDef);
- const elementName = this.componentDef.selectors[0][0] || "div";
- const hostRNode = rootSelectorOrNode ? locateHostElement(hostRenderer, rootSelectorOrNode, this.componentDef.encapsulation, rootViewInjector) : createElementNode(hostRenderer, elementName, getNamespace(elementName));
- let rootFlags = 512;
- if (this.componentDef.signals) {
- rootFlags |= 4096;
- } else if (!this.componentDef.onPush) {
- rootFlags |= 16;
- }
- let hydrationInfo = null;
- if (hostRNode !== null) {
- hydrationInfo = retrieveHydrationInfo(
- hostRNode,
- rootViewInjector,
- true
- /* isRootView */
- );
- }
- const rootTView = createTView(0, null, null, 1, 0, null, null, null, null, null, null);
- const rootLView = createLView(null, rootTView, null, rootFlags, null, null, environment, hostRenderer, rootViewInjector, null, hydrationInfo);
- enterView(rootLView);
- let component;
- let tElementNode;
- try {
- const rootComponentDef = this.componentDef;
- let rootDirectives;
- let hostDirectiveDefs = null;
- if (rootComponentDef.findHostDirectiveDefs) {
- rootDirectives = [];
- hostDirectiveDefs = /* @__PURE__ */ new Map();
- rootComponentDef.findHostDirectiveDefs(rootComponentDef, rootDirectives, hostDirectiveDefs);
- rootDirectives.push(rootComponentDef);
- ngDevMode && assertNoDuplicateDirectives(rootDirectives);
- } else {
- rootDirectives = [rootComponentDef];
- }
- const hostTNode = createRootComponentTNode(rootLView, hostRNode);
- const componentView = createRootComponentView(hostTNode, hostRNode, rootComponentDef, rootDirectives, rootLView, environment, hostRenderer);
- tElementNode = getTNode(rootTView, HEADER_OFFSET);
- if (hostRNode) {
- setRootNodeAttributes(hostRenderer, rootComponentDef, hostRNode, rootSelectorOrNode);
- }
- if (projectableNodes !== void 0) {
- projectNodes(tElementNode, this.ngContentSelectors, projectableNodes);
- }
- component = createRootComponent(componentView, rootComponentDef, rootDirectives, hostDirectiveDefs, rootLView, [LifecycleHooksFeature]);
- renderView(rootTView, rootLView, null);
- } finally {
- leaveView();
- }
- return new ComponentRef(this.componentType, component, createElementRef(tElementNode, rootLView), rootLView, tElementNode);
- }
- };
- var ComponentRef = class extends ComponentRef$1 {
- constructor(componentType, instance, location2, _rootLView, _tNode) {
- super();
- this.location = location2;
- this._rootLView = _rootLView;
- this._tNode = _tNode;
- this.previousInputValues = null;
- this.instance = instance;
- this.hostView = this.changeDetectorRef = new ViewRef$1(
- _rootLView,
- void 0,
- /* _cdRefInjectingView */
- false
- );
- this.componentType = componentType;
- }
- setInput(name, value) {
- const inputData = this._tNode.inputs;
- let dataValue;
- if (inputData !== null && (dataValue = inputData[name])) {
- this.previousInputValues ??= /* @__PURE__ */ new Map();
- if (this.previousInputValues.has(name) && Object.is(this.previousInputValues.get(name), value)) {
- return;
- }
- const lView = this._rootLView;
- setInputsForProperty(lView[TVIEW], lView, dataValue, name, value);
- this.previousInputValues.set(name, value);
- const childComponentLView = getComponentLViewByIndex(this._tNode.index, lView);
- markViewDirty(childComponentLView);
- } else {
- if (ngDevMode) {
- 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 annotated with @Input() or a mapped @Input('${name}') exists.`;
- reportUnknownPropertyError(message);
- }
- }
- }
- get injector() {
- return new NodeInjector(this._tNode, this._rootLView);
- }
- destroy() {
- this.hostView.destroy();
- }
- onDestroy(callback) {
- this.hostView.onDestroy(callback);
- }
- };
- function createRootComponentTNode(lView, rNode) {
- const tView = lView[TVIEW];
- const index = HEADER_OFFSET;
- ngDevMode && assertIndexInRange(lView, index);
- lView[index] = rNode;
- return getOrCreateTNode(tView, index, 2, "#host", null);
- }
- function createRootComponentView(tNode, hostRNode, rootComponentDef, rootDirectives, rootView, environment, hostRenderer) {
- const tView = rootView[TVIEW];
- applyRootComponentStyling(rootDirectives, tNode, hostRNode, hostRenderer);
- let hydrationInfo = null;
- if (hostRNode !== null) {
- hydrationInfo = retrieveHydrationInfo(hostRNode, rootView[INJECTOR$1]);
- }
- const viewRenderer = environment.rendererFactory.createRenderer(hostRNode, rootComponentDef);
- let lViewFlags = 16;
- if (rootComponentDef.signals) {
- lViewFlags = 4096;
- } else if (rootComponentDef.onPush) {
- lViewFlags = 64;
- }
- const componentView = createLView(rootView, getOrCreateComponentTView(rootComponentDef), null, lViewFlags, rootView[tNode.index], tNode, environment, viewRenderer, null, null, hydrationInfo);
- if (tView.firstCreatePass) {
- markAsComponentHost(tView, tNode, rootDirectives.length - 1);
- }
- addToViewTree(rootView, componentView);
- return rootView[tNode.index] = componentView;
- }
- function applyRootComponentStyling(rootDirectives, tNode, rNode, hostRenderer) {
- for (const def of rootDirectives) {
- tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, def.hostAttrs);
- }
- if (tNode.mergedAttrs !== null) {
- computeStaticStyling(tNode, tNode.mergedAttrs, true);
- if (rNode !== null) {
- setupStaticAttributes(hostRenderer, rNode, tNode);
- }
- }
- }
- function createRootComponent(componentView, rootComponentDef, rootDirectives, hostDirectiveDefs, rootLView, hostFeatures) {
- const rootTNode = getCurrentTNode();
- ngDevMode && assertDefined(rootTNode, "tNode should have been already created");
- const tView = rootLView[TVIEW];
- const native = getNativeByTNode(rootTNode, rootLView);
- initializeDirectives(tView, rootLView, rootTNode, rootDirectives, null, hostDirectiveDefs);
- for (let i = 0; i < rootDirectives.length; i++) {
- const directiveIndex = rootTNode.directiveStart + i;
- const directiveInstance = getNodeInjectable(rootLView, tView, directiveIndex, rootTNode);
- attachPatchData(directiveInstance, rootLView);
- }
- invokeDirectivesHostBindings(tView, rootLView, rootTNode);
- if (native) {
- attachPatchData(native, rootLView);
- }
- ngDevMode && assertGreaterThan(rootTNode.componentOffset, -1, "componentOffset must be great than -1");
- const component = getNodeInjectable(rootLView, tView, rootTNode.directiveStart + rootTNode.componentOffset, rootTNode);
- componentView[CONTEXT] = rootLView[CONTEXT] = component;
- if (hostFeatures !== null) {
- for (const feature of hostFeatures) {
- feature(component, rootComponentDef);
- }
- }
- executeContentQueries(tView, rootTNode, rootLView);
- return component;
- }
- function setRootNodeAttributes(hostRenderer, componentDef, hostRNode, rootSelectorOrNode) {
- if (rootSelectorOrNode) {
- setUpAttributes(hostRenderer, hostRNode, ["ng-version", "17.2.2"]);
- } else {
- const { attrs, classes } = extractAttrsAndClassesFromSelector(componentDef.selectors[0]);
- if (attrs) {
- setUpAttributes(hostRenderer, hostRNode, attrs);
- }
- if (classes && classes.length > 0) {
- writeDirectClass(hostRenderer, hostRNode, classes.join(" "));
- }
- }
- }
- 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 ? Array.from(nodesforSlot) : null);
- }
- }
- function LifecycleHooksFeature() {
- const tNode = getCurrentTNode();
- ngDevMode && assertDefined(tNode, "TNode is required");
- registerPostOrderHooks(getLView()[TVIEW], tNode);
- }
- var _ViewContainerRef = class _ViewContainerRef {
- };
- _ViewContainerRef.__NG_ELEMENT_ID__ = injectViewContainerRef;
- var ViewContainerRef = _ViewContainerRef;
- function injectViewContainerRef() {
- const previousTNode = getCurrentTNode();
- return createContainerRef(previousTNode, getLView());
- }
- var VE_ViewContainerRef = ViewContainerRef;
- var R3ViewContainerRef = class ViewContainerRef2 extends VE_ViewContainerRef {
- 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) {
- 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;
- }
- const componentFactory = isComponentFactory ? componentFactoryOrType : new ComponentFactory(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);
- 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$1(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;
- addToViewTree(hostLView, lContainer);
- }
- _locateOrCreateAnchorNode(lContainer, hostLView, hostTNode, slotValue);
- return new R3ViewContainerRef(lContainer, hostTNode, hostLView);
- }
- function insertAnchorNode(hostLView, hostTNode) {
- const renderer = hostLView[RENDERER];
- ngDevMode && ngDevMode.rendererCreateComment++;
- const commentNode = renderer.createComment(ngDevMode ? "container" : "");
- const hostNative = getNativeByTNode(hostTNode, hostLView);
- const parentOfHostNative = nativeParentNode(renderer, hostNative);
- nativeInsertBefore(renderer, parentOfHostNative, commentNode, nativeNextSibling(renderer, 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 || isInSkipHydrationBlock(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_ {
- constructor(queryList) {
- this.queryList = queryList;
- this.matches = null;
- }
- clone() {
- return new _LQuery_(this.queryList);
- }
- setDirty() {
- this.queryList.setDirty();
- }
- };
- var LQueries_ = class _LQueries_ {
- 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 {
- 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_ {
- 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_ {
- constructor(metadata, nodeIndex = -1) {
- this.metadata = metadata;
- this.matches = null;
- this.indexInDeclarationView = -1;
- this.crossesNgTemplate = false;
- this._appliesToNextNode = true;
- 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) {
- 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]`;
- }
- return signalFn;
- }
- function createSingleResultOptionalQuerySignalFn() {
- return createQuerySignalFn(
- /* firstOnly */
- true,
- /* required */
- false
- );
- }
- function createSingleResultRequiredQuerySignalFn() {
- return createQuerySignalFn(
- /* firstOnly */
- true,
- /* required */
- true
- );
- }
- function createMultiResultQuerySignalFn() {
- return createQuerySignalFn(
- /* firstOnly */
- false,
- /* required */
- false
- );
- }
- 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 viewChildFn(locator, opts) {
- return createSingleResultOptionalQuerySignalFn();
- }
- function viewChildRequiredFn(locator, opts) {
- return createSingleResultRequiredQuerySignalFn();
- }
- var viewChild = (() => {
- viewChildFn.required = viewChildRequiredFn;
- return viewChildFn;
- })();
- function viewChildren(locator, opts) {
- return createMultiResultQuerySignalFn();
- }
- function contentChildFn(locator, opts) {
- return createSingleResultOptionalQuerySignalFn();
- }
- function contentChildRequiredFn(locator, opts) {
- return createSingleResultRequiredQuerySignalFn();
- }
- var contentChild = (() => {
- contentChildFn.required = contentChildRequiredFn;
- return contentChildFn;
- })();
- function contentChildren(locator, opts) {
- return createMultiResultQuerySignalFn();
- }
- function createModelSignal(initialValue) {
- const subscriptions = [];
- const node = Object.create(INPUT_SIGNAL_NODE);
- node.value = initialValue;
- function getter() {
- producerAccessed(node);
- assertModelSet(node.value);
- return node.value;
- }
- function notifySubscribers(value) {
- for (let i = 0; i < subscriptions.length; i++) {
- subscriptions[i](value);
- }
- }
- getter[SIGNAL] = node;
- getter.asReadonly = () => getter();
- getter.set = (newValue) => {
- if (!node.equal(node.value, newValue)) {
- signalSetFn(node, newValue);
- notifySubscribers(newValue);
- }
- };
- getter.update = (updateFn) => {
- assertModelSet(node.value);
- getter.set(updateFn(node.value));
- };
- getter.subscribe = (callback) => {
- subscriptions.push(callback);
- return () => {
- const index = subscriptions.indexOf(callback);
- if (index > -1) {
- subscriptions.splice(index, 1);
- }
- };
- };
- if (ngDevMode) {
- getter.toString = () => `[Model Signal: ${getter()}]`;
- }
- return getter;
- }
- function assertModelSet(value) {
- if (value === REQUIRED_UNSET_VALUE) {
- throw new RuntimeError(-952, ngDevMode && "Model is required but no value is available yet.");
- }
- }
- function modelFunction(initialValue) {
- return createModelSignal(initialValue);
- }
- function modelRequiredFunction() {
- return createModelSignal(REQUIRED_UNSET_VALUE);
- }
- var model = (() => {
- modelFunction.required = modelRequiredFunction;
- return modelFunction;
- })();
- var emitDistinctChangesOnlyDefaultValue = true;
- var Query = class {
- };
- var ContentChildren = makePropDecorator("ContentChildren", (selector, opts = {}) => __spreadValues({
- selector,
- first: false,
- isViewQuery: false,
- descendants: false,
- emitDistinctChangesOnly: emitDistinctChangesOnlyDefaultValue
- }, opts), Query);
- var ContentChild = makePropDecorator("ContentChild", (selector, opts = {}) => __spreadValues({ selector, first: true, isViewQuery: false, descendants: true }, opts), Query);
- var ViewChildren = makePropDecorator("ViewChildren", (selector, opts = {}) => __spreadValues({
- selector,
- first: false,
- isViewQuery: true,
- descendants: true,
- emitDistinctChangesOnly: emitDistinctChangesOnlyDefaultValue
- }, opts), Query);
- var ViewChild = makePropDecorator("ViewChild", (selector, opts) => __spreadValues({ selector, first: true, isViewQuery: true, descendants: true }, opts), Query);
- 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(unwrapResponse));
- }
- 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(response) {
- return typeof response == "string" ? response : 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 <iframe>${getTemplateLocationDetails(lView)}. For security reasons, the \`${attrName}\` can be set on an <iframe> as a static attribute only.
- To fix this, switch the \`${attrName}\` binding to a static attribute in a template or in host bindings section.`;
- throw new RuntimeError(-910, errorMessage);
- }
- return attrValue;
- }
- function getSuperType(type) {
- return Object.getPrototypeOf(type.prototype).constructor;
- }
- function ɵɵInheritDefinitionFeature(definition) {
- let superType = getSuperType(definition.type);
- let shouldInheritFields = true;
- const inheritanceChain = [definition];
- while (superType) {
- let superDef = void 0;
- if (isComponentDef(definition)) {
- superDef = superType.ɵcmp || superType.ɵdir;
- } else {
- if (superType.ɵcmp) {
- throw new RuntimeError(903, ngDevMode && `Directives cannot inherit Components. Directive ${stringifyForError(definition.type)} is attempting to extend component ${stringifyForError(superType)}`);
- }
- superDef = superType.ɵdir;
- }
- if (superDef) {
- if (shouldInheritFields) {
- inheritanceChain.push(superDef);
- const writeableDef = definition;
- writeableDef.inputs = maybeUnwrapEmpty(definition.inputs);
- writeableDef.inputTransforms = maybeUnwrapEmpty(definition.inputTransforms);
- writeableDef.declaredInputs = maybeUnwrapEmpty(definition.declaredInputs);
- writeableDef.outputs = maybeUnwrapEmpty(definition.outputs);
- const superHostBindings = superDef.hostBindings;
- superHostBindings && inheritHostBindings(definition, superHostBindings);
- const superViewQuery = superDef.viewQuery;
- const superContentQueries = superDef.contentQueries;
- superViewQuery && inheritViewQuery(definition, superViewQuery);
- superContentQueries && inheritContentQueries(definition, superContentQueries);
- mergeInputsWithTransforms(definition, superDef);
- fillProperties(definition.outputs, superDef.outputs);
- if (isComponentDef(superDef) && superDef.data.animation) {
- const defData = definition.data;
- defData.animation = (defData.animation || []).concat(superDef.data.animation);
- }
- }
- const features = superDef.features;
- if (features) {
- for (let i = 0; i < features.length; i++) {
- const feature = features[i];
- if (feature && feature.ngInherit) {
- feature(definition);
- }
- if (feature === ɵɵInheritDefinitionFeature) {
- shouldInheritFields = false;
- }
- }
- }
- }
- superType = Object.getPrototypeOf(superType);
- }
- mergeHostAttrsAcrossInheritance(inheritanceChain);
- }
- function mergeInputsWithTransforms(target, source) {
- for (const key in source.inputs) {
- if (!source.inputs.hasOwnProperty(key)) {
- continue;
- }
- if (target.inputs.hasOwnProperty(key)) {
- continue;
- }
- const value = source.inputs[key];
- if (value === void 0) {
- continue;
- }
- target.inputs[key] = value;
- target.declaredInputs[key] = source.declaredInputs[key];
- if (source.inputTransforms !== null) {
- const minifiedName = Array.isArray(value) ? value[0] : value;
- if (!source.inputTransforms.hasOwnProperty(minifiedName)) {
- continue;
- }
- target.inputTransforms ??= {};
- target.inputTransforms[minifiedName] = source.inputTransforms[minifiedName];
- }
- }
- }
- function mergeHostAttrsAcrossInheritance(inheritanceChain) {
- let hostVars = 0;
- let hostAttrs = null;
- for (let i = inheritanceChain.length - 1; i >= 0; i--) {
- const def = inheritanceChain[i];
- def.hostVars = hostVars += def.hostVars;
- def.hostAttrs = mergeHostAttrs(def.hostAttrs, hostAttrs = mergeHostAttrs(hostAttrs, def.hostAttrs));
- }
- }
- function maybeUnwrapEmpty(value) {
- if (value === EMPTY_OBJ) {
- return {};
- } else if (value === EMPTY_ARRAY) {
- return [];
- } else {
- return value;
- }
- }
- function inheritViewQuery(definition, superViewQuery) {
- const prevViewQuery = definition.viewQuery;
- if (prevViewQuery) {
- definition.viewQuery = (rf, ctx) => {
- superViewQuery(rf, ctx);
- prevViewQuery(rf, ctx);
- };
- } else {
- definition.viewQuery = superViewQuery;
- }
- }
- function inheritContentQueries(definition, superContentQueries) {
- const prevContentQueries = definition.contentQueries;
- if (prevContentQueries) {
- definition.contentQueries = (rf, ctx, directiveIndex) => {
- superContentQueries(rf, ctx, directiveIndex);
- prevContentQueries(rf, ctx, directiveIndex);
- };
- } else {
- definition.contentQueries = superContentQueries;
- }
- }
- function inheritHostBindings(definition, superHostBindings) {
- const prevHostBindings = definition.hostBindings;
- if (prevHostBindings) {
- definition.hostBindings = (rf, ctx) => {
- superHostBindings(rf, ctx);
- prevHostBindings(rf, ctx);
- };
- } else {
- definition.hostBindings = superHostBindings;
- }
- }
- var COPY_DIRECTIVE_FIELDS = [
- // The child class should use the providers of its parent.
- "providersResolver"
- // Not listed here are any fields which are handled by the `ɵɵInheritDefinitionFeature`, such
- // as inputs, outputs, and host binding functions.
- ];
- var COPY_COMPONENT_FIELDS = [
- // The child class should use the template function of its parent, including all template
- // semantics.
- "template",
- "decls",
- "consts",
- "vars",
- "onPush",
- "ngContentSelectors",
- // The child class should use the CSS styles of its parent, including all styling semantics.
- "styles",
- "encapsulation",
- // The child class should be checked by the runtime in the same way as its parent.
- "schemas"
- ];
- function ɵɵCopyDefinitionFeature(definition) {
- let superType = getSuperType(definition.type);
- let superDef = void 0;
- if (isComponentDef(definition)) {
- superDef = superType.ɵcmp;
- } else {
- superDef = superType.ɵdir;
- }
- const defAny = definition;
- for (const field of COPY_DIRECTIVE_FIELDS) {
- defAny[field] = superDef[field];
- }
- if (isComponentDef(superDef)) {
- for (const field of COPY_COMPONENT_FIELDS) {
- defAny[field] = superDef[field];
- }
- }
- }
- function ɵɵHostDirectivesFeature(rawHostDirectives) {
- const feature = (definition) => {
- const resolved = (Array.isArray(rawHostDirectives) ? rawHostDirectives : rawHostDirectives()).map((dir) => {
- return typeof dir === "function" ? { directive: resolveForwardRef(dir), inputs: EMPTY_OBJ, outputs: EMPTY_OBJ } : {
- directive: resolveForwardRef(dir.directive),
- inputs: bindingArrayToMap(dir.inputs),
- outputs: bindingArrayToMap(dir.outputs)
- };
- });
- if (definition.hostDirectives === null) {
- definition.findHostDirectiveDefs = findHostDirectiveDefs;
- definition.hostDirectives = resolved;
- } else {
- definition.hostDirectives.unshift(...resolved);
- }
- };
- feature.ngInherit = true;
- return feature;
- }
- function findHostDirectiveDefs(currentDef, matchedDefs, hostDirectiveDefs) {
- if (currentDef.hostDirectives !== null) {
- for (const hostDirectiveConfig of currentDef.hostDirectives) {
- const hostDirectiveDef = getDirectiveDef(hostDirectiveConfig.directive);
- if (typeof ngDevMode === "undefined" || ngDevMode) {
- validateHostDirective(hostDirectiveConfig, hostDirectiveDef);
- }
- patchDeclaredInputs(hostDirectiveDef.declaredInputs, hostDirectiveConfig.inputs);
- findHostDirectiveDefs(hostDirectiveDef, matchedDefs, hostDirectiveDefs);
- hostDirectiveDefs.set(hostDirectiveDef, hostDirectiveConfig);
- matchedDefs.push(hostDirectiveDef);
- }
- }
- }
- function bindingArrayToMap(bindings) {
- if (bindings === void 0 || bindings.length === 0) {
- return EMPTY_OBJ;
- }
- const result = {};
- for (let i = 0; i < bindings.length; i += 2) {
- result[bindings[i]] = bindings[i + 1];
- }
- return result;
- }
- function patchDeclaredInputs(declaredInputs, exposedInputs) {
- for (const publicName in exposedInputs) {
- if (exposedInputs.hasOwnProperty(publicName)) {
- const remappedPublicName = exposedInputs[publicName];
- const privateName = declaredInputs[publicName];
- if ((typeof ngDevMode === "undefined" || ngDevMode) && declaredInputs.hasOwnProperty(remappedPublicName)) {
- assertEqual(declaredInputs[remappedPublicName], declaredInputs[publicName], `Conflicting host directive input alias ${publicName}.`);
- }
- declaredInputs[remappedPublicName] = privateName;
- }
- }
- }
- function validateHostDirective(hostDirectiveConfig, directiveDef) {
- const type = hostDirectiveConfig.directive;
- if (directiveDef === null) {
- if (getComponentDef(type) !== null) {
- throw new RuntimeError(310, `Host directive ${type.name} cannot be a component.`);
- }
- throw new RuntimeError(307, `Could not resolve metadata for host directive ${type.name}. Make sure that the ${type.name} class is annotated with an @Directive decorator.`);
- }
- if (!directiveDef.standalone) {
- throw new RuntimeError(308, `Host directive ${directiveDef.type.name} must be standalone.`);
- }
- validateMappings("input", directiveDef, hostDirectiveConfig.inputs);
- validateMappings("output", directiveDef, hostDirectiveConfig.outputs);
- }
- function validateMappings(bindingType, def, hostDirectiveBindings) {
- const className = def.type.name;
- const bindings = bindingType === "input" ? def.inputs : def.outputs;
- for (const publicName in hostDirectiveBindings) {
- if (hostDirectiveBindings.hasOwnProperty(publicName)) {
- if (!bindings.hasOwnProperty(publicName)) {
- throw new RuntimeError(311, `Directive ${className} does not have an ${bindingType} with a public name of ${publicName}.`);
- }
- const remappedPublicName = hostDirectiveBindings[publicName];
- if (bindings.hasOwnProperty(remappedPublicName) && remappedPublicName !== publicName) {
- throw new RuntimeError(312, `Cannot alias ${bindingType} ${publicName} of host directive ${className} to ${remappedPublicName}, because it already has a different ${bindingType} with the same public name.`);
- }
- }
- }
- }
- function ɵɵInputTransformsFeature(definition) {
- const inputs = definition.inputConfig;
- const inputTransforms = {};
- for (const minifiedKey in inputs) {
- if (inputs.hasOwnProperty(minifiedKey)) {
- const value = inputs[minifiedKey];
- if (Array.isArray(value) && value[3]) {
- inputTransforms[minifiedKey] = value[3];
- }
- }
- }
- definition.inputTransforms = inputTransforms;
- }
- var ASYNC_COMPONENT_METADATA_FN = "__ngAsyncComponentMetadataFn__";
- function getAsyncClassMetadataFn(type) {
- const componentClass = type;
- return componentClass[ASYNC_COMPONENT_METADATA_FN] ?? null;
- }
- function setClassMetadataAsync(type, dependencyLoaderFn, metadataSetterFn) {
- const componentClass = type;
- componentClass[ASYNC_COMPONENT_METADATA_FN] = () => Promise.all(dependencyLoaderFn()).then((dependencies) => {
- metadataSetterFn(...dependencies);
- componentClass[ASYNC_COMPONENT_METADATA_FN] = null;
- return dependencies;
- });
- return componentClass[ASYNC_COMPONENT_METADATA_FN];
- }
- function setClassMetadata(type, decorators, ctorParameters, propDecorators) {
- return noSideEffects(() => {
- const clazz = type;
- if (decorators !== null) {
- if (clazz.hasOwnProperty("decorators") && clazz.decorators !== void 0) {
- clazz.decorators.push(...decorators);
- } else {
- clazz.decorators = decorators;
- }
- }
- if (ctorParameters !== null) {
- clazz.ctorParameters = ctorParameters;
- }
- if (propDecorators !== null) {
- if (clazz.hasOwnProperty("propDecorators") && clazz.propDecorators !== void 0) {
- clazz.propDecorators = __spreadValues(__spreadValues({}, clazz.propDecorators), propDecorators);
- } else {
- clazz.propDecorators = propDecorators;
- }
- }
- });
- }
- var NgModuleRef$1 = class {
- };
- var NgModuleFactory$1 = class {
- };
- function createNgModule(ngModule, parentInjector) {
- return new NgModuleRef(ngModule, parentInjector ?? null, []);
- }
- var createNgModuleRef = createNgModule;
- var NgModuleRef = class extends NgModuleRef$1 {
- constructor(ngModuleType, _parent, additionalProviders) {
- super();
- this._parent = _parent;
- this._bootstrapComponents = [];
- this.destroyCbs = [];
- this.componentFactoryResolver = new ComponentFactoryResolver(this);
- const ngModuleDef = getNgModuleDef(ngModuleType);
- ngDevMode && assertDefined(ngModuleDef, `NgModule '${stringify(ngModuleType)}' is not a subtype of 'NgModuleType'.`);
- this._bootstrapComponents = maybeUnwrapFn(ngModuleDef.bootstrap);
- this._r3Injector = createInjectorWithoutInjectorInstances(ngModuleType, _parent, [
- { provide: NgModuleRef$1, useValue: this },
- {
- provide: ComponentFactoryResolver$1,
- useValue: this.componentFactoryResolver
- },
- ...additionalProviders
- ], stringify(ngModuleType), /* @__PURE__ */ new Set(["environment"]));
- this._r3Injector.resolveInjectorInitializers();
- this.instance = this._r3Injector.get(ngModuleType);
- }
- get injector() {
- return this._r3Injector;
- }
- destroy() {
- ngDevMode && assertDefined(this.destroyCbs, "NgModule already destroyed");
- const injector = this._r3Injector;
- !injector.destroyed && injector.destroy();
- this.destroyCbs.forEach((fn) => fn());
- this.destroyCbs = null;
- }
- onDestroy(callback) {
- ngDevMode && assertDefined(this.destroyCbs, "NgModule already destroyed");
- this.destroyCbs.push(callback);
- }
- };
- var NgModuleFactory = class extends NgModuleFactory$1 {
- constructor(moduleType) {
- super();
- this.moduleType = moduleType;
- }
- create(parentInjector) {
- return new NgModuleRef(this.moduleType, parentInjector, []);
- }
- };
- function createNgModuleRefWithProviders(moduleType, parentInjector, additionalProviders) {
- return new NgModuleRef(moduleType, parentInjector, additionalProviders);
- }
- var EnvironmentNgModuleRefAdapter = class extends NgModuleRef$1 {
- constructor(config) {
- super();
- this.componentFactoryResolver = new ComponentFactoryResolver(this);
- this.instance = null;
- const injector = new R3Injector([
- ...config.providers,
- { provide: NgModuleRef$1, useValue: this },
- { provide: ComponentFactoryResolver$1, useValue: this.componentFactoryResolver }
- ], config.parent || getNullInjector(), config.debugName, /* @__PURE__ */ new Set(["environment"]));
- this.injector = injector;
- if (config.runEnvironmentInitializers) {
- injector.resolveInjectorInitializers();
- }
- }
- destroy() {
- this.injector.destroy();
- }
- onDestroy(callback) {
- this.injector.onDestroy(callback);
- }
- };
- function createEnvironmentInjector(providers, parent, debugName = null) {
- const adapter = new EnvironmentNgModuleRefAdapter({ providers, parent, debugName, runEnvironmentInitializers: true });
- return adapter.injector;
- }
- var _PendingTasks = class _PendingTasks {
- constructor() {
- this.taskId = 0;
- this.pendingTasks = /* @__PURE__ */ new Set();
- this.hasPendingTasks = new BehaviorSubject(false);
- }
- get _hasPendingTasks() {
- return this.hasPendingTasks.value;
- }
- add() {
- if (!this._hasPendingTasks) {
- this.hasPendingTasks.next(true);
- }
- const taskId = this.taskId++;
- this.pendingTasks.add(taskId);
- return taskId;
- }
- remove(taskId) {
- this.pendingTasks.delete(taskId);
- if (this.pendingTasks.size === 0 && this._hasPendingTasks) {
- this.hasPendingTasks.next(false);
- }
- }
- ngOnDestroy() {
- this.pendingTasks.clear();
- if (this._hasPendingTasks) {
- this.hasPendingTasks.next(false);
- }
- }
- };
- _PendingTasks.ɵfac = function PendingTasks_Factory(t) {
- return new (t || _PendingTasks)();
- };
- _PendingTasks.ɵprov = ɵɵdefineInjectable({ token: _PendingTasks, factory: _PendingTasks.ɵfac, providedIn: "root" });
- var PendingTasks = _PendingTasks;
- (() => {
- (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PendingTasks, [{
- type: Injectable,
- args: [{ providedIn: "root" }]
- }], null, null);
- })();
- 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 && assertNotSame(value, NO_CHANGE, "Incoming value should never be NO_CHANGE.");
- ngDevMode && assertLessThan(bindingIndex, lView.length, `Slot should have been initialized to NO_CHANGE`);
- 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 templateFirstCreatePass(index, tView, lView, templateFn, decls, vars, tagName, attrsIndex, localRefsIndex) {
- ngDevMode && assertFirstCreatePass(tView);
- ngDevMode && ngDevMode.firstCreatePass++;
- const tViewConsts = tView.consts;
- const tNode = getOrCreateTNode(tView, index, 4, tagName || null, getConstant(tViewConsts, attrsIndex));
- resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex));
- registerPostOrderHooks(tView, tNode);
- const embeddedTView = tNode.tView = createTView(
- 2,
- tNode,
- templateFn,
- decls,
- vars,
- tView.directiveRegistry,
- tView.pipeRegistry,
- null,
- tView.schemas,
- tViewConsts,
- null
- /* ssrId */
- );
- if (tView.queries !== null) {
- tView.queries.template(tView, tNode);
- embeddedTView.queries = tView.queries.embeddedTView(tNode);
- }
- return tNode;
- }
- function ɵɵtemplate(index, templateFn, decls, vars, tagName, attrsIndex, localRefsIndex, localRefExtractor) {
- const lView = getLView();
- const tView = getTView();
- const adjustedIndex = index + HEADER_OFFSET;
- const tNode = tView.firstCreatePass ? templateFirstCreatePass(adjustedIndex, tView, lView, templateFn, decls, vars, tagName, attrsIndex, localRefsIndex) : tView.data[adjustedIndex];
- setCurrentTNode(tNode, false);
- const comment = _locateOrCreateContainerAnchor(tView, lView, tNode, index);
- if (wasLastNodeCreated()) {
- appendChild(tView, lView, comment, tNode);
- }
- attachPatchData(comment, lView);
- const lContainer = createLContainer(comment, lView, comment, tNode);
- lView[adjustedIndex] = lContainer;
- addToViewTree(lView, lContainer);
- populateDehydratedViewsInLContainer(lContainer, tNode, lView);
- if (isDirectiveHost(tNode)) {
- createDirectivesInstances(tView, lView, tNode);
- }
- if (localRefsIndex != null) {
- saveResolvedLocalsInData(lView, tNode, localRefExtractor);
- }
- return ɵɵtemplate;
- }
- var _locateOrCreateContainerAnchor = createContainerAnchorImpl;
- function createContainerAnchorImpl(tView, lView, tNode, index) {
- lastNodeWasCreated(true);
- return lView[RENDERER].createComment(ngDevMode ? "container" : "");
- }
- function locateOrCreateContainerAnchorImpl(tView, lView, tNode, index) {
- const hydrationInfo = lView[HYDRATION];
- const isNodeCreationMode = !hydrationInfo || isInSkipHydrationBlock$1() || isDisconnectedNode$1(hydrationInfo, index);
- lastNodeWasCreated(isNodeCreationMode);
- if (isNodeCreationMode) {
- return createContainerAnchorImpl(tView, lView, tNode, index);
- }
- const ssrId = hydrationInfo.data[TEMPLATES]?.[index] ?? null;
- if (ssrId !== null && tNode.tView !== null) {
- if (tNode.tView.ssrId === null) {
- tNode.tView.ssrId = ssrId;
- } else {
- ngDevMode && assertEqual(tNode.tView.ssrId, ssrId, "Unexpected value of the `ssrId` for this TView");
- }
- }
- const currentRNode = locateNextRNode(hydrationInfo, tView, lView, tNode);
- ngDevMode && validateNodeExists(currentRNode, lView, tNode);
- setSegmentHead(hydrationInfo, index, currentRNode);
- const viewContainerSize = calcSerializedContainerSize(hydrationInfo, index);
- const comment = siblingAfter(viewContainerSize, currentRNode);
- if (ngDevMode) {
- validateMatchingNode(comment, Node.COMMENT_NODE, null, lView, tNode);
- markRNodeAsClaimedByHydration(comment);
- }
- return comment;
- }
- function enableLocateOrCreateContainerAnchorImpl() {
- _locateOrCreateContainerAnchor = locateOrCreateContainerAnchorImpl;
- }
- var DeferDependenciesLoadingState;
- (function(DeferDependenciesLoadingState2) {
- DeferDependenciesLoadingState2[DeferDependenciesLoadingState2["NOT_STARTED"] = 0] = "NOT_STARTED";
- DeferDependenciesLoadingState2[DeferDependenciesLoadingState2["IN_PROGRESS"] = 1] = "IN_PROGRESS";
- DeferDependenciesLoadingState2[DeferDependenciesLoadingState2["COMPLETE"] = 2] = "COMPLETE";
- DeferDependenciesLoadingState2[DeferDependenciesLoadingState2["FAILED"] = 3] = "FAILED";
- })(DeferDependenciesLoadingState || (DeferDependenciesLoadingState = {}));
- var MINIMUM_SLOT = 0;
- var LOADING_AFTER_SLOT = 1;
- var DeferBlockState;
- (function(DeferBlockState2) {
- DeferBlockState2[DeferBlockState2["Placeholder"] = 0] = "Placeholder";
- DeferBlockState2[DeferBlockState2["Loading"] = 1] = "Loading";
- DeferBlockState2[DeferBlockState2["Complete"] = 2] = "Complete";
- DeferBlockState2[DeferBlockState2["Error"] = 3] = "Error";
- })(DeferBlockState || (DeferBlockState = {}));
- var DeferBlockInternalState;
- (function(DeferBlockInternalState2) {
- DeferBlockInternalState2[DeferBlockInternalState2["Initial"] = -1] = "Initial";
- })(DeferBlockInternalState || (DeferBlockInternalState = {}));
- var NEXT_DEFER_BLOCK_STATE = 0;
- var DEFER_BLOCK_STATE = 1;
- var STATE_IS_FROZEN_UNTIL = 2;
- var LOADING_AFTER_CLEANUP_FN = 3;
- var TRIGGER_CLEANUP_FNS = 4;
- var PREFETCH_TRIGGER_CLEANUP_FNS = 5;
- var DeferBlockBehavior;
- (function(DeferBlockBehavior2) {
- DeferBlockBehavior2[DeferBlockBehavior2["Manual"] = 0] = "Manual";
- DeferBlockBehavior2[DeferBlockBehavior2["Playthrough"] = 1] = "Playthrough";
- })(DeferBlockBehavior || (DeferBlockBehavior = {}));
- function storeTriggerCleanupFn(type, lDetails, cleanupFn) {
- const key = type === 1 ? PREFETCH_TRIGGER_CLEANUP_FNS : TRIGGER_CLEANUP_FNS;
- if (lDetails[key] === null) {
- lDetails[key] = [];
- }
- lDetails[key].push(cleanupFn);
- }
- function invokeTriggerCleanupFns(type, lDetails) {
- const key = type === 1 ? PREFETCH_TRIGGER_CLEANUP_FNS : TRIGGER_CLEANUP_FNS;
- const cleanupFns = lDetails[key];
- if (cleanupFns !== null) {
- for (const cleanupFn of cleanupFns) {
- cleanupFn();
- }
- lDetails[key] = null;
- }
- }
- function invokeAllTriggerCleanupFns(lDetails) {
- invokeTriggerCleanupFns(1, lDetails);
- invokeTriggerCleanupFns(0, lDetails);
- }
- function getDeferBlockDataIndex(deferBlockIndex) {
- return deferBlockIndex + 1;
- }
- function getLDeferBlockDetails(lView, tNode) {
- const tView = lView[TVIEW];
- const slotIndex = getDeferBlockDataIndex(tNode.index);
- ngDevMode && assertIndexInDeclRange(tView, slotIndex);
- return lView[slotIndex];
- }
- function setLDeferBlockDetails(lView, deferBlockIndex, lDetails) {
- const tView = lView[TVIEW];
- const slotIndex = getDeferBlockDataIndex(deferBlockIndex);
- ngDevMode && assertIndexInDeclRange(tView, slotIndex);
- lView[slotIndex] = lDetails;
- }
- function getTDeferBlockDetails(tView, tNode) {
- const slotIndex = getDeferBlockDataIndex(tNode.index);
- ngDevMode && assertIndexInDeclRange(tView, slotIndex);
- return tView.data[slotIndex];
- }
- function setTDeferBlockDetails(tView, deferBlockIndex, deferBlockConfig) {
- const slotIndex = getDeferBlockDataIndex(deferBlockIndex);
- ngDevMode && assertIndexInDeclRange(tView, slotIndex);
- tView.data[slotIndex] = deferBlockConfig;
- }
- function getTemplateIndexForState(newState, hostLView, tNode) {
- const tView = hostLView[TVIEW];
- const tDetails = getTDeferBlockDetails(tView, tNode);
- switch (newState) {
- case DeferBlockState.Complete:
- return tDetails.primaryTmplIndex;
- case DeferBlockState.Loading:
- return tDetails.loadingTmplIndex;
- case DeferBlockState.Error:
- return tDetails.errorTmplIndex;
- case DeferBlockState.Placeholder:
- return tDetails.placeholderTmplIndex;
- default:
- ngDevMode && throwError(`Unexpected defer block state: ${newState}`);
- return null;
- }
- }
- function getMinimumDurationForState(tDetails, currentState) {
- if (currentState === DeferBlockState.Placeholder) {
- return tDetails.placeholderBlockConfig?.[MINIMUM_SLOT] ?? null;
- } else if (currentState === DeferBlockState.Loading) {
- return tDetails.loadingBlockConfig?.[MINIMUM_SLOT] ?? null;
- }
- return null;
- }
- function getLoadingBlockAfter(tDetails) {
- return tDetails.loadingBlockConfig?.[LOADING_AFTER_SLOT] ?? null;
- }
- function addDepsToRegistry(currentDeps, newDeps) {
- if (!currentDeps || currentDeps.length === 0) {
- return newDeps;
- }
- const currentDepSet = new Set(currentDeps);
- for (const dep of newDeps) {
- currentDepSet.add(dep);
- }
- return currentDeps.length === currentDepSet.size ? currentDeps : Array.from(currentDepSet);
- }
- function getPrimaryBlockTNode(tView, tDetails) {
- const adjustedIndex = tDetails.primaryTmplIndex + HEADER_OFFSET;
- return getTNode(tView, adjustedIndex);
- }
- function assertDeferredDependenciesLoaded(tDetails) {
- assertEqual(tDetails.loadingState, DeferDependenciesLoadingState.COMPLETE, "Expecting all deferred dependencies to be loaded.");
- }
- function isTDeferBlockDetails(value) {
- return value !== null && typeof value === "object" && typeof value.primaryTmplIndex === "number";
- }
- 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", "focusin"];
- var intersectionObserver = null;
- var observedViewportElements = 0;
- var DeferEventEntry = class {
- constructor() {
- this.callbacks = /* @__PURE__ */ new Set();
- this.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 onViewport(trigger, callback, injector) {
- const ngZone = injector.get(NgZone);
- let entry = viewportTriggers.get(trigger);
- intersectionObserver = intersectionObserver || ngZone.runOutsideAngular(() => {
- return new IntersectionObserver((entries) => {
- for (const current of entries) {
- if (current.isIntersecting && viewportTriggers.has(current.target)) {
- ngZone.run(viewportTriggers.get(current.target).listener);
- }
- }
- });
- });
- if (!entry) {
- entry = new DeferEventEntry();
- ngZone.runOutsideAngular(() => 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;
- }
- };
- }
- function getTriggerLView(deferredHostLView, deferredTNode, walkUpTimes) {
- if (walkUpTimes == null) {
- return deferredHostLView;
- }
- if (walkUpTimes >= 0) {
- return walkUpViews(walkUpTimes, deferredHostLView);
- }
- const deferredContainer = deferredHostLView[deferredTNode.index];
- ngDevMode && assertLContainer(deferredContainer);
- const triggerLView = deferredContainer[CONTAINER_HEADER_OFFSET] ?? null;
- if (ngDevMode && triggerLView !== null) {
- const lDetails = getLDeferBlockDetails(deferredHostLView, deferredTNode);
- const renderedState = lDetails[DEFER_BLOCK_STATE];
- assertEqual(renderedState, DeferBlockState.Placeholder, "Expected a placeholder to be rendered in this defer block.");
- assertLView(triggerLView);
- }
- return triggerLView;
- }
- function getTriggerElement(triggerLView, triggerIndex) {
- const element = getNativeByIndex(HEADER_OFFSET + triggerIndex, triggerLView);
- ngDevMode && assertElement(element);
- return element;
- }
- function registerDomTrigger(initialLView, tNode, triggerIndex, walkUpTimes, registerFn, callback, type) {
- const injector = initialLView[INJECTOR$1];
- function pollDomTrigger() {
- if (isDestroyed(initialLView)) {
- return;
- }
- const lDetails = getLDeferBlockDetails(initialLView, tNode);
- const renderedState = lDetails[DEFER_BLOCK_STATE];
- if (renderedState !== DeferBlockInternalState.Initial && renderedState !== DeferBlockState.Placeholder) {
- return;
- }
- const triggerLView = getTriggerLView(initialLView, tNode, walkUpTimes);
- if (!triggerLView) {
- internalAfterNextRender(pollDomTrigger, { injector });
- return;
- }
- if (isDestroyed(triggerLView)) {
- return;
- }
- const element = getTriggerElement(triggerLView, triggerIndex);
- const cleanup = registerFn(element, () => {
- if (initialLView !== triggerLView) {
- removeLViewOnDestroy(triggerLView, cleanup);
- }
- callback();
- }, injector);
- if (initialLView !== triggerLView) {
- storeLViewOnDestroy(triggerLView, cleanup);
- }
- storeTriggerCleanupFn(type, lDetails, cleanup);
- }
- internalAfterNextRender(pollDomTrigger, { injector });
- }
- function onIdle(callback, lView) {
- const injector = lView[INJECTOR$1];
- const scheduler = injector.get(IdleScheduler);
- const cleanupFn = () => scheduler.remove(callback);
- scheduler.add(callback);
- return cleanupFn;
- }
- var _requestIdleCallback = () => typeof requestIdleCallback !== "undefined" ? requestIdleCallback : setTimeout;
- var _cancelIdleCallback = () => typeof requestIdleCallback !== "undefined" ? cancelIdleCallback : clearTimeout;
- var _IdleScheduler = class _IdleScheduler {
- constructor() {
- this.executingCallbacks = false;
- this.idleId = null;
- this.current = /* @__PURE__ */ new Set();
- this.deferred = /* @__PURE__ */ new Set();
- this.ngZone = inject(NgZone);
- this.requestIdleCallbackFn = _requestIdleCallback().bind(globalThis);
- this.cancelIdleCallbackFn = _cancelIdleCallback().bind(globalThis);
- }
- add(callback) {
- const target = this.executingCallbacks ? this.deferred : this.current;
- target.add(callback);
- if (this.idleId === null) {
- this.scheduleIdleCallback();
- }
- }
- remove(callback) {
- const { current, deferred } = this;
- current.delete(callback);
- deferred.delete(callback);
- if (current.size === 0 && deferred.size === 0) {
- this.cancelIdleCallback();
- }
- }
- scheduleIdleCallback() {
- const callback = () => {
- this.cancelIdleCallback();
- this.executingCallbacks = true;
- for (const callback2 of this.current) {
- callback2();
- }
- this.current.clear();
- this.executingCallbacks = false;
- if (this.deferred.size > 0) {
- for (const callback2 of this.deferred) {
- this.current.add(callback2);
- }
- this.deferred.clear();
- this.scheduleIdleCallback();
- }
- };
- this.idleId = this.requestIdleCallbackFn(() => this.ngZone.run(callback));
- }
- cancelIdleCallback() {
- if (this.idleId !== null) {
- this.cancelIdleCallbackFn(this.idleId);
- this.idleId = null;
- }
- }
- ngOnDestroy() {
- this.cancelIdleCallback();
- this.current.clear();
- this.deferred.clear();
- }
- };
- _IdleScheduler.ɵprov = ɵɵdefineInjectable({
- token: _IdleScheduler,
- providedIn: "root",
- factory: () => new _IdleScheduler()
- });
- var IdleScheduler = _IdleScheduler;
- function onTimer(delay2) {
- return (callback, lView) => scheduleTimerTrigger(delay2, callback, lView);
- }
- function scheduleTimerTrigger(delay2, callback, lView) {
- const injector = lView[INJECTOR$1];
- const scheduler = injector.get(TimerScheduler);
- const cleanupFn = () => scheduler.remove(callback);
- scheduler.add(delay2, callback);
- return cleanupFn;
- }
- var _TimerScheduler = class _TimerScheduler {
- constructor() {
- this.executingCallbacks = false;
- this.timeoutId = null;
- this.invokeTimerAt = null;
- this.current = [];
- this.deferred = [];
- }
- add(delay2, callback) {
- const target = this.executingCallbacks ? this.deferred : this.current;
- this.addToQueue(target, Date.now() + delay2, callback);
- this.scheduleTimer();
- }
- remove(callback) {
- const { current, deferred } = this;
- const callbackIndex = this.removeFromQueue(current, callback);
- if (callbackIndex === -1) {
- this.removeFromQueue(deferred, callback);
- }
- if (current.length === 0 && deferred.length === 0) {
- this.clearTimeout();
- }
- }
- addToQueue(target, invokeAt, callback) {
- let insertAtIndex = target.length;
- for (let i = 0; i < target.length; i += 2) {
- const invokeQueuedCallbackAt = target[i];
- if (invokeQueuedCallbackAt > invokeAt) {
- insertAtIndex = i;
- break;
- }
- }
- arrayInsert2(target, insertAtIndex, invokeAt, callback);
- }
- removeFromQueue(target, callback) {
- let index = -1;
- for (let i = 0; i < target.length; i += 2) {
- const queuedCallback = target[i + 1];
- if (queuedCallback === callback) {
- index = i;
- break;
- }
- }
- if (index > -1) {
- arraySplice(target, index, 2);
- }
- return index;
- }
- scheduleTimer() {
- const callback = () => {
- this.clearTimeout();
- this.executingCallbacks = true;
- const current = [...this.current];
- const now = Date.now();
- for (let i = 0; i < current.length; i += 2) {
- const invokeAt = current[i];
- const callback2 = current[i + 1];
- if (invokeAt <= now) {
- callback2();
- } else {
- break;
- }
- }
- let lastCallbackIndex = -1;
- for (let i = 0; i < this.current.length; i += 2) {
- const invokeAt = this.current[i];
- if (invokeAt <= now) {
- lastCallbackIndex = i + 1;
- } else {
- break;
- }
- }
- if (lastCallbackIndex >= 0) {
- arraySplice(this.current, 0, lastCallbackIndex + 1);
- }
- this.executingCallbacks = false;
- if (this.deferred.length > 0) {
- for (let i = 0; i < this.deferred.length; i += 2) {
- const invokeAt = this.deferred[i];
- const callback2 = this.deferred[i + 1];
- this.addToQueue(this.current, invokeAt, callback2);
- }
- this.deferred.length = 0;
- }
- this.scheduleTimer();
- };
- const FRAME_DURATION_MS = 16;
- if (this.current.length > 0) {
- const now = Date.now();
- const invokeAt = this.current[0];
- if (this.timeoutId === null || // Reschedule a timer in case a queue contains an item with
- // an earlier timestamp and the delta is more than an average
- // frame duration.
- this.invokeTimerAt && this.invokeTimerAt - invokeAt > FRAME_DURATION_MS) {
- this.clearTimeout();
- const timeout2 = Math.max(invokeAt - now, FRAME_DURATION_MS);
- this.invokeTimerAt = invokeAt;
- this.timeoutId = setTimeout(callback, timeout2);
- }
- }
- }
- clearTimeout() {
- if (this.timeoutId !== null) {
- clearTimeout(this.timeoutId);
- this.timeoutId = null;
- }
- }
- ngOnDestroy() {
- this.clearTimeout();
- this.current.length = 0;
- this.deferred.length = 0;
- }
- };
- _TimerScheduler.ɵprov = ɵɵdefineInjectable({
- token: _TimerScheduler,
- providedIn: "root",
- factory: () => new _TimerScheduler()
- });
- var TimerScheduler = _TimerScheduler;
- var DEFER_BLOCK_DEPENDENCY_INTERCEPTOR = new InjectionToken("DEFER_BLOCK_DEPENDENCY_INTERCEPTOR");
- var DEFER_BLOCK_CONFIG = new InjectionToken(ngDevMode ? "DEFER_BLOCK_CONFIG" : "");
- function shouldTriggerDeferBlock(injector) {
- const config = injector.get(DEFER_BLOCK_CONFIG, null, { optional: true });
- if (config?.behavior === DeferBlockBehavior.Manual) {
- return false;
- }
- return isPlatformBrowser(injector);
- }
- var applyDeferBlockStateWithSchedulingImpl = null;
- function ɵɵdeferEnableTimerScheduling(tView, tDetails, placeholderConfigIndex, loadingConfigIndex) {
- const tViewConsts = tView.consts;
- if (placeholderConfigIndex != null) {
- tDetails.placeholderBlockConfig = getConstant(tViewConsts, placeholderConfigIndex);
- }
- if (loadingConfigIndex != null) {
- tDetails.loadingBlockConfig = getConstant(tViewConsts, loadingConfigIndex);
- }
- if (applyDeferBlockStateWithSchedulingImpl === null) {
- applyDeferBlockStateWithSchedulingImpl = applyDeferBlockStateWithScheduling;
- }
- }
- function ɵɵdefer(index, primaryTmplIndex, dependencyResolverFn, loadingTmplIndex, placeholderTmplIndex, errorTmplIndex, loadingConfigIndex, placeholderConfigIndex, enableTimerScheduling) {
- const lView = getLView();
- const tView = getTView();
- const adjustedIndex = index + HEADER_OFFSET;
- ɵɵtemplate(index, null, 0, 0);
- if (tView.firstCreatePass) {
- performanceMarkFeature("NgDefer");
- const tDetails = {
- primaryTmplIndex,
- loadingTmplIndex: loadingTmplIndex ?? null,
- placeholderTmplIndex: placeholderTmplIndex ?? null,
- errorTmplIndex: errorTmplIndex ?? null,
- placeholderBlockConfig: null,
- loadingBlockConfig: null,
- dependencyResolverFn: dependencyResolverFn ?? null,
- loadingState: DeferDependenciesLoadingState.NOT_STARTED,
- loadingPromise: null
- };
- enableTimerScheduling?.(tView, tDetails, placeholderConfigIndex, loadingConfigIndex);
- setTDeferBlockDetails(tView, adjustedIndex, tDetails);
- }
- const tNode = getCurrentTNode();
- const lContainer = lView[adjustedIndex];
- populateDehydratedViewsInLContainer(lContainer, tNode, lView);
- const lDetails = [
- null,
- // NEXT_DEFER_BLOCK_STATE
- DeferBlockInternalState.Initial,
- // DEFER_BLOCK_STATE
- null,
- // STATE_IS_FROZEN_UNTIL
- null,
- // LOADING_AFTER_CLEANUP_FN
- null,
- // TRIGGER_CLEANUP_FNS
- null
- // PREFETCH_TRIGGER_CLEANUP_FNS
- ];
- setLDeferBlockDetails(lView, adjustedIndex, lDetails);
- const cleanupTriggersFn = () => invokeAllTriggerCleanupFns(lDetails);
- storeTriggerCleanupFn(0, lDetails, () => removeLViewOnDestroy(lView, cleanupTriggersFn));
- storeLViewOnDestroy(lView, cleanupTriggersFn);
- }
- function ɵɵdeferWhen(rawValue) {
- const lView = getLView();
- const bindingIndex = nextBindingIndex();
- if (bindingUpdated(lView, bindingIndex, rawValue)) {
- const prevConsumer = setActiveConsumer(null);
- try {
- const value = Boolean(rawValue);
- const tNode = getSelectedTNode();
- const lDetails = getLDeferBlockDetails(lView, tNode);
- const renderedState = lDetails[DEFER_BLOCK_STATE];
- if (value === false && renderedState === DeferBlockInternalState.Initial) {
- renderPlaceholder(lView, tNode);
- } else if (value === true && (renderedState === DeferBlockInternalState.Initial || renderedState === DeferBlockState.Placeholder)) {
- triggerDeferBlock(lView, tNode);
- }
- } finally {
- setActiveConsumer(prevConsumer);
- }
- }
- }
- function ɵɵdeferPrefetchWhen(rawValue) {
- const lView = getLView();
- const bindingIndex = nextBindingIndex();
- if (bindingUpdated(lView, bindingIndex, rawValue)) {
- const prevConsumer = setActiveConsumer(null);
- try {
- const value = Boolean(rawValue);
- const tView = lView[TVIEW];
- const tNode = getSelectedTNode();
- const tDetails = getTDeferBlockDetails(tView, tNode);
- if (value === true && tDetails.loadingState === DeferDependenciesLoadingState.NOT_STARTED) {
- triggerPrefetching(tDetails, lView, tNode);
- }
- } finally {
- setActiveConsumer(prevConsumer);
- }
- }
- }
- function ɵɵdeferOnIdle() {
- scheduleDelayedTrigger(onIdle);
- }
- function ɵɵdeferPrefetchOnIdle() {
- scheduleDelayedPrefetching(onIdle);
- }
- function ɵɵdeferOnImmediate() {
- const lView = getLView();
- const tNode = getCurrentTNode();
- const tView = lView[TVIEW];
- const injector = lView[INJECTOR$1];
- const tDetails = getTDeferBlockDetails(tView, tNode);
- if (!shouldTriggerDeferBlock(injector) || tDetails.loadingTmplIndex === null) {
- renderPlaceholder(lView, tNode);
- }
- triggerDeferBlock(lView, tNode);
- }
- function ɵɵdeferPrefetchOnImmediate() {
- const lView = getLView();
- const tNode = getCurrentTNode();
- const tView = lView[TVIEW];
- const tDetails = getTDeferBlockDetails(tView, tNode);
- if (tDetails.loadingState === DeferDependenciesLoadingState.NOT_STARTED) {
- triggerResourceLoading(tDetails, lView, tNode);
- }
- }
- function ɵɵdeferOnTimer(delay2) {
- scheduleDelayedTrigger(onTimer(delay2));
- }
- function ɵɵdeferPrefetchOnTimer(delay2) {
- scheduleDelayedPrefetching(onTimer(delay2));
- }
- function ɵɵdeferOnHover(triggerIndex, walkUpTimes) {
- const lView = getLView();
- const tNode = getCurrentTNode();
- renderPlaceholder(lView, tNode);
- registerDomTrigger(
- lView,
- tNode,
- triggerIndex,
- walkUpTimes,
- onHover,
- () => triggerDeferBlock(lView, tNode),
- 0
- /* TriggerType.Regular */
- );
- }
- function ɵɵdeferPrefetchOnHover(triggerIndex, walkUpTimes) {
- const lView = getLView();
- const tNode = getCurrentTNode();
- const tView = lView[TVIEW];
- const tDetails = getTDeferBlockDetails(tView, tNode);
- if (tDetails.loadingState === DeferDependenciesLoadingState.NOT_STARTED) {
- registerDomTrigger(
- lView,
- tNode,
- triggerIndex,
- walkUpTimes,
- onHover,
- () => triggerPrefetching(tDetails, lView, tNode),
- 1
- /* TriggerType.Prefetch */
- );
- }
- }
- function ɵɵdeferOnInteraction(triggerIndex, walkUpTimes) {
- const lView = getLView();
- const tNode = getCurrentTNode();
- renderPlaceholder(lView, tNode);
- registerDomTrigger(
- lView,
- tNode,
- triggerIndex,
- walkUpTimes,
- onInteraction,
- () => triggerDeferBlock(lView, tNode),
- 0
- /* TriggerType.Regular */
- );
- }
- function ɵɵdeferPrefetchOnInteraction(triggerIndex, walkUpTimes) {
- const lView = getLView();
- const tNode = getCurrentTNode();
- const tView = lView[TVIEW];
- const tDetails = getTDeferBlockDetails(tView, tNode);
- if (tDetails.loadingState === DeferDependenciesLoadingState.NOT_STARTED) {
- registerDomTrigger(
- lView,
- tNode,
- triggerIndex,
- walkUpTimes,
- onInteraction,
- () => triggerPrefetching(tDetails, lView, tNode),
- 1
- /* TriggerType.Prefetch */
- );
- }
- }
- function ɵɵdeferOnViewport(triggerIndex, walkUpTimes) {
- const lView = getLView();
- const tNode = getCurrentTNode();
- renderPlaceholder(lView, tNode);
- registerDomTrigger(
- lView,
- tNode,
- triggerIndex,
- walkUpTimes,
- onViewport,
- () => triggerDeferBlock(lView, tNode),
- 0
- /* TriggerType.Regular */
- );
- }
- function ɵɵdeferPrefetchOnViewport(triggerIndex, walkUpTimes) {
- const lView = getLView();
- const tNode = getCurrentTNode();
- const tView = lView[TVIEW];
- const tDetails = getTDeferBlockDetails(tView, tNode);
- if (tDetails.loadingState === DeferDependenciesLoadingState.NOT_STARTED) {
- registerDomTrigger(
- lView,
- tNode,
- triggerIndex,
- walkUpTimes,
- onViewport,
- () => triggerPrefetching(tDetails, lView, tNode),
- 1
- /* TriggerType.Prefetch */
- );
- }
- }
- function scheduleDelayedTrigger(scheduleFn) {
- const lView = getLView();
- const tNode = getCurrentTNode();
- renderPlaceholder(lView, tNode);
- const cleanupFn = scheduleFn(() => triggerDeferBlock(lView, tNode), lView);
- const lDetails = getLDeferBlockDetails(lView, tNode);
- storeTriggerCleanupFn(0, lDetails, cleanupFn);
- }
- function scheduleDelayedPrefetching(scheduleFn) {
- const lView = getLView();
- const tNode = getCurrentTNode();
- const tView = lView[TVIEW];
- const tDetails = getTDeferBlockDetails(tView, tNode);
- if (tDetails.loadingState === DeferDependenciesLoadingState.NOT_STARTED) {
- const lDetails = getLDeferBlockDetails(lView, tNode);
- const prefetch = () => triggerPrefetching(tDetails, lView, tNode);
- const cleanupFn = scheduleFn(prefetch, lView);
- storeTriggerCleanupFn(1, lDetails, cleanupFn);
- }
- }
- function renderDeferBlockState(newState, tNode, lContainer, skipTimerScheduling = false) {
- const hostLView = lContainer[PARENT];
- const hostTView = hostLView[TVIEW];
- if (isDestroyed(hostLView))
- return;
- ngDevMode && assertTNodeForLView(tNode, hostLView);
- const lDetails = getLDeferBlockDetails(hostLView, tNode);
- ngDevMode && assertDefined(lDetails, "Expected a defer block state defined");
- const currentState = lDetails[DEFER_BLOCK_STATE];
- if (isValidStateChange(currentState, newState) && isValidStateChange(lDetails[NEXT_DEFER_BLOCK_STATE] ?? -1, newState)) {
- const tDetails = getTDeferBlockDetails(hostTView, tNode);
- const needsScheduling = !skipTimerScheduling && (getLoadingBlockAfter(tDetails) !== null || getMinimumDurationForState(tDetails, DeferBlockState.Loading) !== null || getMinimumDurationForState(tDetails, DeferBlockState.Placeholder));
- if (ngDevMode && needsScheduling) {
- assertDefined(applyDeferBlockStateWithSchedulingImpl, "Expected scheduling function to be defined");
- }
- const applyStateFn = needsScheduling ? applyDeferBlockStateWithSchedulingImpl : applyDeferBlockState;
- try {
- applyStateFn(newState, lDetails, lContainer, tNode, hostLView);
- } catch (error) {
- handleError(hostLView, error);
- }
- }
- }
- function applyDeferBlockState(newState, lDetails, lContainer, tNode, hostLView) {
- const stateTmplIndex = getTemplateIndexForState(newState, hostLView, tNode);
- if (stateTmplIndex !== null) {
- lDetails[DEFER_BLOCK_STATE] = newState;
- const hostTView = hostLView[TVIEW];
- const adjustedIndex = stateTmplIndex + HEADER_OFFSET;
- const activeBlockTNode = getTNode(hostTView, adjustedIndex);
- const viewIndex = 0;
- removeLViewFromLContainer(lContainer, viewIndex);
- const dehydratedView = findMatchingDehydratedView(lContainer, activeBlockTNode.tView.ssrId);
- const embeddedLView = createAndRenderEmbeddedLView(hostLView, activeBlockTNode, null, { dehydratedView });
- addLViewToLContainer(lContainer, embeddedLView, viewIndex, shouldAddViewToDom(activeBlockTNode, dehydratedView));
- markViewDirty(embeddedLView);
- }
- }
- function applyDeferBlockStateWithScheduling(newState, lDetails, lContainer, tNode, hostLView) {
- const now = Date.now();
- const hostTView = hostLView[TVIEW];
- const tDetails = getTDeferBlockDetails(hostTView, tNode);
- if (lDetails[STATE_IS_FROZEN_UNTIL] === null || lDetails[STATE_IS_FROZEN_UNTIL] <= now) {
- lDetails[STATE_IS_FROZEN_UNTIL] = null;
- const loadingAfter = getLoadingBlockAfter(tDetails);
- const inLoadingAfterPhase = lDetails[LOADING_AFTER_CLEANUP_FN] !== null;
- if (newState === DeferBlockState.Loading && loadingAfter !== null && !inLoadingAfterPhase) {
- lDetails[NEXT_DEFER_BLOCK_STATE] = newState;
- const cleanupFn = scheduleDeferBlockUpdate(loadingAfter, lDetails, tNode, lContainer, hostLView);
- lDetails[LOADING_AFTER_CLEANUP_FN] = cleanupFn;
- } else {
- if (newState > DeferBlockState.Loading && inLoadingAfterPhase) {
- lDetails[LOADING_AFTER_CLEANUP_FN]();
- lDetails[LOADING_AFTER_CLEANUP_FN] = null;
- lDetails[NEXT_DEFER_BLOCK_STATE] = null;
- }
- applyDeferBlockState(newState, lDetails, lContainer, tNode, hostLView);
- const duration = getMinimumDurationForState(tDetails, newState);
- if (duration !== null) {
- lDetails[STATE_IS_FROZEN_UNTIL] = now + duration;
- scheduleDeferBlockUpdate(duration, lDetails, tNode, lContainer, hostLView);
- }
- }
- } else {
- lDetails[NEXT_DEFER_BLOCK_STATE] = newState;
- }
- }
- function scheduleDeferBlockUpdate(timeout2, lDetails, tNode, lContainer, hostLView) {
- const callback = () => {
- const nextState = lDetails[NEXT_DEFER_BLOCK_STATE];
- lDetails[STATE_IS_FROZEN_UNTIL] = null;
- lDetails[NEXT_DEFER_BLOCK_STATE] = null;
- if (nextState !== null) {
- renderDeferBlockState(nextState, tNode, lContainer);
- }
- };
- return scheduleTimerTrigger(timeout2, callback, hostLView);
- }
- function isValidStateChange(currentState, newState) {
- return currentState < newState;
- }
- function triggerPrefetching(tDetails, lView, tNode) {
- if (lView[INJECTOR$1] && shouldTriggerDeferBlock(lView[INJECTOR$1])) {
- triggerResourceLoading(tDetails, lView, tNode);
- }
- }
- function triggerResourceLoading(tDetails, lView, tNode) {
- const injector = lView[INJECTOR$1];
- const tView = lView[TVIEW];
- if (tDetails.loadingState !== DeferDependenciesLoadingState.NOT_STARTED) {
- return;
- }
- const lDetails = getLDeferBlockDetails(lView, tNode);
- const primaryBlockTNode = getPrimaryBlockTNode(tView, tDetails);
- tDetails.loadingState = DeferDependenciesLoadingState.IN_PROGRESS;
- invokeTriggerCleanupFns(1, lDetails);
- let dependenciesFn = tDetails.dependencyResolverFn;
- if (ngDevMode) {
- const deferDependencyInterceptor = injector.get(DEFER_BLOCK_DEPENDENCY_INTERCEPTOR, null, { optional: true });
- if (deferDependencyInterceptor) {
- dependenciesFn = deferDependencyInterceptor.intercept(dependenciesFn);
- }
- }
- const pendingTasks = injector.get(PendingTasks);
- const taskId = pendingTasks.add();
- if (!dependenciesFn) {
- tDetails.loadingPromise = Promise.resolve().then(() => {
- tDetails.loadingPromise = null;
- tDetails.loadingState = DeferDependenciesLoadingState.COMPLETE;
- pendingTasks.remove(taskId);
- });
- return;
- }
- tDetails.loadingPromise = Promise.allSettled(dependenciesFn()).then((results) => {
- let failed = false;
- const directiveDefs = [];
- const pipeDefs = [];
- for (const result of results) {
- if (result.status === "fulfilled") {
- const dependency = result.value;
- const directiveDef = getComponentDef(dependency) || getDirectiveDef(dependency);
- if (directiveDef) {
- directiveDefs.push(directiveDef);
- } else {
- const pipeDef = getPipeDef$1(dependency);
- if (pipeDef) {
- pipeDefs.push(pipeDef);
- }
- }
- } else {
- failed = true;
- break;
- }
- }
- tDetails.loadingPromise = null;
- pendingTasks.remove(taskId);
- if (failed) {
- tDetails.loadingState = DeferDependenciesLoadingState.FAILED;
- if (tDetails.errorTmplIndex === null) {
- const templateLocation = getTemplateLocationDetails(lView);
- const error = new RuntimeError(750, ngDevMode && `Loading dependencies for \`@defer\` block failed, but no \`@error\` block was configured${templateLocation}. Consider using the \`@error\` block to render an error state.`);
- handleError(lView, error);
- }
- } else {
- tDetails.loadingState = DeferDependenciesLoadingState.COMPLETE;
- const primaryBlockTView = primaryBlockTNode.tView;
- if (directiveDefs.length > 0) {
- primaryBlockTView.directiveRegistry = addDepsToRegistry(primaryBlockTView.directiveRegistry, directiveDefs);
- }
- if (pipeDefs.length > 0) {
- primaryBlockTView.pipeRegistry = addDepsToRegistry(primaryBlockTView.pipeRegistry, pipeDefs);
- }
- }
- });
- }
- function renderPlaceholder(lView, tNode) {
- const lContainer = lView[tNode.index];
- ngDevMode && assertLContainer(lContainer);
- renderDeferBlockState(DeferBlockState.Placeholder, tNode, lContainer);
- }
- function renderDeferStateAfterResourceLoading(tDetails, tNode, lContainer) {
- ngDevMode && assertDefined(tDetails.loadingPromise, "Expected loading Promise to exist on this defer block");
- tDetails.loadingPromise.then(() => {
- if (tDetails.loadingState === DeferDependenciesLoadingState.COMPLETE) {
- ngDevMode && assertDeferredDependenciesLoaded(tDetails);
- renderDeferBlockState(DeferBlockState.Complete, tNode, lContainer);
- } else if (tDetails.loadingState === DeferDependenciesLoadingState.FAILED) {
- renderDeferBlockState(DeferBlockState.Error, tNode, lContainer);
- }
- });
- }
- function triggerDeferBlock(lView, tNode) {
- const tView = lView[TVIEW];
- const lContainer = lView[tNode.index];
- const injector = lView[INJECTOR$1];
- ngDevMode && assertLContainer(lContainer);
- if (!shouldTriggerDeferBlock(injector))
- return;
- const lDetails = getLDeferBlockDetails(lView, tNode);
- const tDetails = getTDeferBlockDetails(tView, tNode);
- invokeAllTriggerCleanupFns(lDetails);
- switch (tDetails.loadingState) {
- case DeferDependenciesLoadingState.NOT_STARTED:
- renderDeferBlockState(DeferBlockState.Loading, tNode, lContainer);
- triggerResourceLoading(tDetails, lView, tNode);
- if (tDetails.loadingState === DeferDependenciesLoadingState.IN_PROGRESS) {
- renderDeferStateAfterResourceLoading(tDetails, tNode, lContainer);
- }
- break;
- case DeferDependenciesLoadingState.IN_PROGRESS:
- renderDeferBlockState(DeferBlockState.Loading, tNode, lContainer);
- renderDeferStateAfterResourceLoading(tDetails, tNode, lContainer);
- break;
- case DeferDependenciesLoadingState.COMPLETE:
- ngDevMode && assertDeferredDependenciesLoaded(tDetails);
- renderDeferBlockState(DeferBlockState.Complete, tNode, lContainer);
- break;
- case DeferDependenciesLoadingState.FAILED:
- renderDeferBlockState(DeferBlockState.Error, tNode, lContainer);
- break;
- default:
- if (ngDevMode) {
- throwError("Unknown defer block state");
- }
- }
- }
- function ɵɵattribute(name, value, sanitizer, namespace) {
- const lView = getLView();
- const bindingIndex = nextBindingIndex();
- if (bindingUpdated(lView, bindingIndex, value)) {
- const tView = getTView();
- const tNode = getSelectedTNode();
- elementAttributeInternal(tNode, lView, name, value, sanitizer, namespace);
- ngDevMode && storePropertyBindingMetadata(tView.data, tNode, "attr." + name, bindingIndex);
- }
- return ɵɵattribute;
- }
- function interpolationV(lView, values) {
- ngDevMode && assertLessThan(2, values.length, "should have at least 3 values");
- ngDevMode && assertEqual(values.length % 2, 1, "should have an odd number of values");
- let isBindingUpdated = false;
- let bindingIndex = getBindingIndex();
- for (let i = 1; i < values.length; i += 2) {
- isBindingUpdated = bindingUpdated(lView, bindingIndex++, values[i]) || isBindingUpdated;
- }
- setBindingIndex(bindingIndex);
- if (!isBindingUpdated) {
- return NO_CHANGE;
- }
- let content = values[0];
- for (let i = 1; i < values.length; i += 2) {
- content += renderStringify(values[i]) + values[i + 1];
- }
- return content;
- }
- function interpolation1(lView, prefix, v0, suffix) {
- const different = bindingUpdated(lView, nextBindingIndex(), v0);
- return different ? prefix + renderStringify(v0) + suffix : NO_CHANGE;
- }
- function interpolation2(lView, prefix, v0, i0, v1, suffix) {
- const bindingIndex = getBindingIndex();
- const different = bindingUpdated2(lView, bindingIndex, v0, v1);
- incrementBindingIndex(2);
- return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + suffix : NO_CHANGE;
- }
- function interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix) {
- const bindingIndex = getBindingIndex();
- const different = bindingUpdated3(lView, bindingIndex, v0, v1, v2);
- incrementBindingIndex(3);
- return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + suffix : NO_CHANGE;
- }
- function interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix) {
- const bindingIndex = getBindingIndex();
- const different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
- incrementBindingIndex(4);
- return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 + renderStringify(v3) + suffix : NO_CHANGE;
- }
- function interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix) {
- const bindingIndex = getBindingIndex();
- let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
- different = bindingUpdated(lView, bindingIndex + 4, v4) || different;
- incrementBindingIndex(5);
- return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + suffix : NO_CHANGE;
- }
- function interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix) {
- const bindingIndex = getBindingIndex();
- let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
- different = bindingUpdated2(lView, bindingIndex + 4, v4, v5) || different;
- incrementBindingIndex(6);
- return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 + renderStringify(v5) + suffix : NO_CHANGE;
- }
- function interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) {
- const bindingIndex = getBindingIndex();
- let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
- different = bindingUpdated3(lView, bindingIndex + 4, v4, v5, v6) || different;
- incrementBindingIndex(7);
- return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 + renderStringify(v5) + i5 + renderStringify(v6) + suffix : NO_CHANGE;
- }
- function interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) {
- const bindingIndex = getBindingIndex();
- let different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3);
- different = bindingUpdated4(lView, bindingIndex + 4, v4, v5, v6, v7) || different;
- incrementBindingIndex(8);
- return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 + renderStringify(v5) + i5 + renderStringify(v6) + i6 + renderStringify(v7) + suffix : NO_CHANGE;
- }
- function ɵɵattributeInterpolate1(attrName, prefix, v0, suffix, sanitizer, namespace) {
- const lView = getLView();
- const interpolatedValue = interpolation1(lView, prefix, v0, suffix);
- if (interpolatedValue !== NO_CHANGE) {
- const tNode = getSelectedTNode();
- elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
- ngDevMode && storePropertyBindingMetadata(getTView().data, tNode, "attr." + attrName, getBindingIndex() - 1, prefix, suffix);
- }
- return ɵɵattributeInterpolate1;
- }
- function ɵɵattributeInterpolate2(attrName, prefix, v0, i0, v1, suffix, sanitizer, namespace) {
- const lView = getLView();
- const interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix);
- if (interpolatedValue !== NO_CHANGE) {
- const tNode = getSelectedTNode();
- elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
- ngDevMode && storePropertyBindingMetadata(getTView().data, tNode, "attr." + attrName, getBindingIndex() - 2, prefix, i0, suffix);
- }
- return ɵɵattributeInterpolate2;
- }
- function ɵɵattributeInterpolate3(attrName, prefix, v0, i0, v1, i1, v2, suffix, sanitizer, namespace) {
- const lView = getLView();
- const interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
- if (interpolatedValue !== NO_CHANGE) {
- const tNode = getSelectedTNode();
- elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
- ngDevMode && storePropertyBindingMetadata(getTView().data, tNode, "attr." + attrName, getBindingIndex() - 3, prefix, i0, i1, suffix);
- }
- return ɵɵattributeInterpolate3;
- }
- function ɵɵattributeInterpolate4(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, suffix, sanitizer, namespace) {
- const lView = getLView();
- const interpolatedValue = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix);
- if (interpolatedValue !== NO_CHANGE) {
- const tNode = getSelectedTNode();
- elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
- ngDevMode && storePropertyBindingMetadata(getTView().data, tNode, "attr." + attrName, getBindingIndex() - 4, prefix, i0, i1, i2, suffix);
- }
- return ɵɵattributeInterpolate4;
- }
- function ɵɵattributeInterpolate5(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix, sanitizer, namespace) {
- const lView = getLView();
- const interpolatedValue = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix);
- if (interpolatedValue !== NO_CHANGE) {
- const tNode = getSelectedTNode();
- elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
- ngDevMode && storePropertyBindingMetadata(getTView().data, tNode, "attr." + attrName, getBindingIndex() - 5, prefix, i0, i1, i2, i3, suffix);
- }
- return ɵɵattributeInterpolate5;
- }
- function ɵɵattributeInterpolate6(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix, sanitizer, namespace) {
- const lView = getLView();
- const interpolatedValue = interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix);
- if (interpolatedValue !== NO_CHANGE) {
- const tNode = getSelectedTNode();
- elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
- ngDevMode && storePropertyBindingMetadata(getTView().data, tNode, "attr." + attrName, getBindingIndex() - 6, prefix, i0, i1, i2, i3, i4, suffix);
- }
- return ɵɵattributeInterpolate6;
- }
- function ɵɵattributeInterpolate7(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix, sanitizer, namespace) {
- const lView = getLView();
- const interpolatedValue = interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix);
- if (interpolatedValue !== NO_CHANGE) {
- const tNode = getSelectedTNode();
- elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
- ngDevMode && storePropertyBindingMetadata(getTView().data, tNode, "attr." + attrName, getBindingIndex() - 7, prefix, i0, i1, i2, i3, i4, i5, suffix);
- }
- return ɵɵattributeInterpolate7;
- }
- function ɵɵattributeInterpolate8(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix, sanitizer, namespace) {
- const lView = getLView();
- const interpolatedValue = interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix);
- if (interpolatedValue !== NO_CHANGE) {
- const tNode = getSelectedTNode();
- elementAttributeInternal(tNode, lView, attrName, interpolatedValue, sanitizer, namespace);
- ngDevMode && storePropertyBindingMetadata(getTView().data, tNode, "attr." + attrName, getBindingIndex() - 8, prefix, i0, i1, i2, i3, i4, i5, i6, suffix);
- }
- return ɵɵattributeInterpolate8;
- }
- function ɵɵattributeInterpolateV(attrName, values, sanitizer, namespace) {
- const lView = getLView();
- const interpolated = interpolationV(lView, values);
- if (interpolated !== NO_CHANGE) {
- const tNode = getSelectedTNode();
- elementAttributeInternal(tNode, lView, attrName, interpolated, sanitizer, namespace);
- if (ngDevMode) {
- const interpolationInBetween = [values[0]];
- for (let i = 2; i < values.length; i += 2) {
- interpolationInBetween.push(values[i]);
- }
- storePropertyBindingMetadata(getTView().data, tNode, "attr." + attrName, getBindingIndex() - interpolationInBetween.length + 1, ...interpolationInBetween);
- }
- }
- return ɵɵattributeInterpolateV;
- }
- function toTStylingRange(prev, next) {
- ngDevMode && assertNumberInRange(
- prev,
- 0,
- 32767
- /* StylingRange.UNSIGNED_MASK */
- );
- ngDevMode && assertNumberInRange(
- next,
- 0,
- 32767
- /* StylingRange.UNSIGNED_MASK */
- );
- return prev << 17 | next << 2;
- }
- function getTStylingRangePrev(tStylingRange) {
- ngDevMode && assertNumber(tStylingRange, "expected number");
- return tStylingRange >> 17 & 32767;
- }
- function getTStylingRangePrevDuplicate(tStylingRange) {
- ngDevMode && assertNumber(tStylingRange, "expected number");
- return (tStylingRange & 2) == 2;
- }
- function setTStylingRangePrev(tStylingRange, previous) {
- ngDevMode && assertNumber(tStylingRange, "expected number");
- ngDevMode && assertNumberInRange(
- previous,
- 0,
- 32767
- /* StylingRange.UNSIGNED_MASK */
- );
- return tStylingRange & ~4294836224 | previous << 17;
- }
- function setTStylingRangePrevDuplicate(tStylingRange) {
- ngDevMode && assertNumber(tStylingRange, "expected number");
- return tStylingRange | 2;
- }
- function getTStylingRangeNext(tStylingRange) {
- ngDevMode && assertNumber(tStylingRange, "expected number");
- return (tStylingRange & 131068) >> 2;
- }
- function setTStylingRangeNext(tStylingRange, next) {
- ngDevMode && assertNumber(tStylingRange, "expected number");
- ngDevMode && assertNumberInRange(
- next,
- 0,
- 32767
- /* StylingRange.UNSIGNED_MASK */
- );
- return tStylingRange & ~131068 | //
- next << 2;
- }
- function getTStylingRangeNextDuplicate(tStylingRange) {
- ngDevMode && assertNumber(tStylingRange, "expected number");
- return (tStylingRange & 1) === 1;
- }
- function setTStylingRangeNextDuplicate(tStylingRange) {
- ngDevMode && assertNumber(tStylingRange, "expected number");
- return tStylingRange | 1;
- }
- function insertTStylingBinding(tData, tNode, tStylingKeyWithStatic, index, isHostBinding, isClassBinding) {
- ngDevMode && assertFirstUpdatePass(getTView());
- let tBindings = isClassBinding ? tNode.classBindings : tNode.styleBindings;
- let tmplHead = getTStylingRangePrev(tBindings);
- let tmplTail = getTStylingRangeNext(tBindings);
- tData[index] = tStylingKeyWithStatic;
- let isKeyDuplicateOfStatic = false;
- let tStylingKey;
- if (Array.isArray(tStylingKeyWithStatic)) {
- const staticKeyValueArray = tStylingKeyWithStatic;
- tStylingKey = staticKeyValueArray[1];
- if (tStylingKey === null || keyValueArrayIndexOf(staticKeyValueArray, tStylingKey) > 0) {
- isKeyDuplicateOfStatic = true;
- }
- } else {
- tStylingKey = tStylingKeyWithStatic;
- }
- if (isHostBinding) {
- const hasTemplateBindings = tmplTail !== 0;
- if (hasTemplateBindings) {
- const previousNode = getTStylingRangePrev(tData[tmplHead + 1]);
- tData[index + 1] = toTStylingRange(previousNode, tmplHead);
- if (previousNode !== 0) {
- tData[previousNode + 1] = setTStylingRangeNext(tData[previousNode + 1], index);
- }
- tData[tmplHead + 1] = setTStylingRangePrev(tData[tmplHead + 1], index);
- } else {
- tData[index + 1] = toTStylingRange(tmplHead, 0);
- if (tmplHead !== 0) {
- tData[tmplHead + 1] = setTStylingRangeNext(tData[tmplHead + 1], index);
- }
- tmplHead = index;
- }
- } else {
- tData[index + 1] = toTStylingRange(tmplTail, 0);
- ngDevMode && assertEqual(tmplHead !== 0 && tmplTail === 0, false, "Adding template bindings after hostBindings is not allowed.");
- if (tmplHead === 0) {
- tmplHead = index;
- } else {
- tData[tmplTail + 1] = setTStylingRangeNext(tData[tmplTail + 1], index);
- }
- tmplTail = index;
- }
- if (isKeyDuplicateOfStatic) {
- tData[index + 1] = setTStylingRangePrevDuplicate(tData[index + 1]);
- }
- markDuplicates(tData, tStylingKey, index, true);
- markDuplicates(tData, tStylingKey, index, false);
- markDuplicateOfResidualStyling(tNode, tStylingKey, tData, index, isClassBinding);
- tBindings = toTStylingRange(tmplHead, tmplTail);
- if (isClassBinding) {
- tNode.classBindings = tBindings;
- } else {
- tNode.styleBindings = tBindings;
- }
- }
- function markDuplicateOfResidualStyling(tNode, tStylingKey, tData, index, isClassBinding) {
- const residual = isClassBinding ? tNode.residualClasses : tNode.residualStyles;
- if (residual != null && typeof tStylingKey == "string" && keyValueArrayIndexOf(residual, tStylingKey) >= 0) {
- tData[index + 1] = setTStylingRangeNextDuplicate(tData[index + 1]);
- }
- }
- function markDuplicates(tData, tStylingKey, index, isPrevDir) {
- const tStylingAtIndex = tData[index + 1];
- const isMap = tStylingKey === null;
- let cursor = isPrevDir ? getTStylingRangePrev(tStylingAtIndex) : getTStylingRangeNext(tStylingAtIndex);
- let foundDuplicate = false;
- while (cursor !== 0 && (foundDuplicate === false || isMap)) {
- ngDevMode && assertIndexInRange(tData, cursor);
- const tStylingValueAtCursor = tData[cursor];
- const tStyleRangeAtCursor = tData[cursor + 1];
- if (isStylingMatch(tStylingValueAtCursor, tStylingKey)) {
- foundDuplicate = true;
- tData[cursor + 1] = isPrevDir ? setTStylingRangeNextDuplicate(tStyleRangeAtCursor) : setTStylingRangePrevDuplicate(tStyleRangeAtCursor);
- }
- cursor = isPrevDir ? getTStylingRangePrev(tStyleRangeAtCursor) : getTStylingRangeNext(tStyleRangeAtCursor);
- }
- if (foundDuplicate) {
- tData[index + 1] = isPrevDir ? setTStylingRangePrevDuplicate(tStylingAtIndex) : setTStylingRangeNextDuplicate(tStylingAtIndex);
- }
- }
- function isStylingMatch(tStylingKeyCursor, tStylingKey) {
- ngDevMode && assertNotEqual(Array.isArray(tStylingKey), true, "Expected that 'tStylingKey' has been unwrapped");
- if (tStylingKeyCursor === null || // If the cursor is `null` it means that we have map at that
- // location so we must assume that we have a match.
- tStylingKey == null || // If `tStylingKey` is `null` then it is a map therefor assume that it
- // contains a match.
- (Array.isArray(tStylingKeyCursor) ? tStylingKeyCursor[1] : tStylingKeyCursor) === tStylingKey) {
- return true;
- } else if (Array.isArray(tStylingKeyCursor) && typeof tStylingKey === "string") {
- return keyValueArrayIndexOf(tStylingKeyCursor, tStylingKey) >= 0;
- }
- return false;
- }
- var parserState = {
- textEnd: 0,
- key: 0,
- keyEnd: 0,
- value: 0,
- valueEnd: 0
- };
- function getLastParsedKey(text) {
- return text.substring(parserState.key, parserState.keyEnd);
- }
- function getLastParsedValue(text) {
- return text.substring(parserState.value, parserState.valueEnd);
- }
- function parseClassName(text) {
- resetParserState(text);
- return parseClassNameNext(text, consumeWhitespace(text, 0, parserState.textEnd));
- }
- function parseClassNameNext(text, index) {
- const end = parserState.textEnd;
- if (end === index) {
- return -1;
- }
- index = parserState.keyEnd = consumeClassToken(text, parserState.key = index, end);
- return consumeWhitespace(text, index, end);
- }
- function parseStyle(text) {
- resetParserState(text);
- return parseStyleNext(text, consumeWhitespace(text, 0, parserState.textEnd));
- }
- function parseStyleNext(text, startIndex) {
- const end = parserState.textEnd;
- let index = parserState.key = consumeWhitespace(text, startIndex, end);
- if (end === index) {
- return -1;
- }
- index = parserState.keyEnd = consumeStyleKey(text, index, end);
- index = consumeSeparator(
- text,
- index,
- end,
- 58
- /* CharCode.COLON */
- );
- index = parserState.value = consumeWhitespace(text, index, end);
- index = parserState.valueEnd = consumeStyleValue(text, index, end);
- return consumeSeparator(
- text,
- index,
- end,
- 59
- /* CharCode.SEMI_COLON */
- );
- }
- function resetParserState(text) {
- parserState.key = 0;
- parserState.keyEnd = 0;
- parserState.value = 0;
- parserState.valueEnd = 0;
- parserState.textEnd = text.length;
- }
- function consumeWhitespace(text, startIndex, endIndex) {
- while (startIndex < endIndex && text.charCodeAt(startIndex) <= 32) {
- startIndex++;
- }
- return startIndex;
- }
- function consumeClassToken(text, startIndex, endIndex) {
- while (startIndex < endIndex && text.charCodeAt(startIndex) > 32) {
- startIndex++;
- }
- return startIndex;
- }
- function consumeStyleKey(text, startIndex, endIndex) {
- let ch;
- while (startIndex < endIndex && ((ch = text.charCodeAt(startIndex)) === 45 || ch === 95 || (ch & -33) >= 65 && (ch & -33) <= 90 || ch >= 48 && ch <= 57)) {
- startIndex++;
- }
- return startIndex;
- }
- function consumeSeparator(text, startIndex, endIndex, separator) {
- startIndex = consumeWhitespace(text, startIndex, endIndex);
- if (startIndex < endIndex) {
- if (ngDevMode && text.charCodeAt(startIndex) !== separator) {
- malformedStyleError(text, String.fromCharCode(separator), startIndex);
- }
- startIndex++;
- }
- return startIndex;
- }
- function consumeStyleValue(text, startIndex, endIndex) {
- let ch1 = -1;
- let ch2 = -1;
- let ch3 = -1;
- let i = startIndex;
- let lastChIndex = i;
- while (i < endIndex) {
- const ch = text.charCodeAt(i++);
- if (ch === 59) {
- return lastChIndex;
- } else if (ch === 34 || ch === 39) {
- lastChIndex = i = consumeQuotedText(text, ch, i, endIndex);
- } else if (startIndex === i - 4 && // We have seen only 4 characters so far "URL(" (Ignore "foo_URL()")
- ch3 === 85 && ch2 === 82 && ch1 === 76 && ch === 40) {
- lastChIndex = i = consumeQuotedText(text, 41, i, endIndex);
- } else if (ch > 32) {
- lastChIndex = i;
- }
- ch3 = ch2;
- ch2 = ch1;
- ch1 = ch & -33;
- }
- return lastChIndex;
- }
- function consumeQuotedText(text, quoteCharCode, startIndex, endIndex) {
- let ch1 = -1;
- let index = startIndex;
- while (index < endIndex) {
- const ch = text.charCodeAt(index++);
- if (ch == quoteCharCode && ch1 !== 92) {
- return index;
- }
- if (ch == 92 && ch1 === 92) {
- ch1 = 0;
- } else {
- ch1 = ch;
- }
- }
- throw ngDevMode ? malformedStyleError(text, String.fromCharCode(quoteCharCode), endIndex) : new Error();
- }
- function malformedStyleError(text, expecting, index) {
- ngDevMode && assertEqual(typeof text === "string", true, "String expected here");
- throw throwError(`Malformed style at location ${index} in string '` + text.substring(0, index) + "[>>" + text.substring(index, index + 1) + "<<]" + text.slice(index + 1) + `'. Expecting '${expecting}'.`);
- }
- function ɵɵproperty(propName, value, sanitizer) {
- const lView = getLView();
- const bindingIndex = nextBindingIndex();
- if (bindingUpdated(lView, bindingIndex, value)) {
- const tView = getTView();
- const tNode = getSelectedTNode();
- elementPropertyInternal(tView, tNode, lView, propName, value, lView[RENDERER], sanitizer, false);
- ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, bindingIndex);
- }
- return ɵɵproperty;
- }
- function setDirectiveInputsWhichShadowsStyling(tView, tNode, lView, value, isClassBased) {
- const inputs = tNode.inputs;
- const property = isClassBased ? "class" : "style";
- setInputsForProperty(tView, lView, inputs[property], property, value);
- }
- function ɵɵstyleProp(prop, value, suffix) {
- checkStylingProperty(prop, value, suffix, false);
- return ɵɵstyleProp;
- }
- function ɵɵclassProp(className, value) {
- checkStylingProperty(className, value, null, true);
- return ɵɵclassProp;
- }
- function ɵɵstyleMap(styles) {
- checkStylingMap(styleKeyValueArraySet, styleStringParser, styles, false);
- }
- function styleStringParser(keyValueArray, text) {
- for (let i = parseStyle(text); i >= 0; i = parseStyleNext(text, i)) {
- styleKeyValueArraySet(keyValueArray, getLastParsedKey(text), getLastParsedValue(text));
- }
- }
- function ɵɵclassMap(classes) {
- checkStylingMap(classKeyValueArraySet, classStringParser, classes, true);
- }
- function classStringParser(keyValueArray, text) {
- for (let i = parseClassName(text); i >= 0; i = parseClassNameNext(text, i)) {
- keyValueArraySet(keyValueArray, getLastParsedKey(text), true);
- }
- }
- function checkStylingProperty(prop, value, suffix, isClassBased) {
- const lView = getLView();
- const tView = getTView();
- const bindingIndex = incrementBindingIndex(2);
- if (tView.firstUpdatePass) {
- stylingFirstUpdatePass(tView, prop, bindingIndex, isClassBased);
- }
- if (value !== NO_CHANGE && bindingUpdated(lView, bindingIndex, value)) {
- const tNode = tView.data[getSelectedIndex()];
- updateStyling(tView, tNode, lView, lView[RENDERER], prop, lView[bindingIndex + 1] = normalizeSuffix(value, suffix), isClassBased, bindingIndex);
- }
- }
- function checkStylingMap(keyValueArraySet2, stringParser, value, isClassBased) {
- const tView = getTView();
- const bindingIndex = incrementBindingIndex(2);
- if (tView.firstUpdatePass) {
- stylingFirstUpdatePass(tView, null, bindingIndex, isClassBased);
- }
- const lView = getLView();
- if (value !== NO_CHANGE && bindingUpdated(lView, bindingIndex, value)) {
- const tNode = tView.data[getSelectedIndex()];
- if (hasStylingInputShadow(tNode, isClassBased) && !isInHostBindings(tView, bindingIndex)) {
- if (ngDevMode) {
- const tStylingKey = tView.data[bindingIndex];
- assertEqual(Array.isArray(tStylingKey) ? tStylingKey[1] : tStylingKey, false, "Styling linked list shadow input should be marked as 'false'");
- }
- let staticPrefix = isClassBased ? tNode.classesWithoutHost : tNode.stylesWithoutHost;
- ngDevMode && isClassBased === false && staticPrefix !== null && assertEqual(staticPrefix.endsWith(";"), true, "Expecting static portion to end with ';'");
- if (staticPrefix !== null) {
- value = concatStringsWithSpace(staticPrefix, value ? value : "");
- }
- setDirectiveInputsWhichShadowsStyling(tView, tNode, lView, value, isClassBased);
- } else {
- updateStylingMap(tView, tNode, lView, lView[RENDERER], lView[bindingIndex + 1], lView[bindingIndex + 1] = toStylingKeyValueArray(keyValueArraySet2, stringParser, value), isClassBased, bindingIndex);
- }
- }
- }
- function isInHostBindings(tView, bindingIndex) {
- return bindingIndex >= tView.expandoStartIndex;
- }
- function stylingFirstUpdatePass(tView, tStylingKey, bindingIndex, isClassBased) {
- ngDevMode && assertFirstUpdatePass(tView);
- const tData = tView.data;
- if (tData[bindingIndex + 1] === null) {
- const tNode = tData[getSelectedIndex()];
- ngDevMode && assertDefined(tNode, "TNode expected");
- const isHostBindings = isInHostBindings(tView, bindingIndex);
- if (hasStylingInputShadow(tNode, isClassBased) && tStylingKey === null && !isHostBindings) {
- tStylingKey = false;
- }
- tStylingKey = wrapInStaticStylingKey(tData, tNode, tStylingKey, isClassBased);
- insertTStylingBinding(tData, tNode, tStylingKey, bindingIndex, isHostBindings, isClassBased);
- }
- }
- function wrapInStaticStylingKey(tData, tNode, stylingKey, isClassBased) {
- const hostDirectiveDef = getCurrentDirectiveDef(tData);
- let residual = isClassBased ? tNode.residualClasses : tNode.residualStyles;
- if (hostDirectiveDef === null) {
- const isFirstStylingInstructionInTemplate = (isClassBased ? tNode.classBindings : tNode.styleBindings) === 0;
- if (isFirstStylingInstructionInTemplate) {
- stylingKey = collectStylingFromDirectives(null, tData, tNode, stylingKey, isClassBased);
- stylingKey = collectStylingFromTAttrs(stylingKey, tNode.attrs, isClassBased);
- residual = null;
- }
- } else {
- const directiveStylingLast = tNode.directiveStylingLast;
- const isFirstStylingInstructionInHostBinding = directiveStylingLast === -1 || tData[directiveStylingLast] !== hostDirectiveDef;
- if (isFirstStylingInstructionInHostBinding) {
- stylingKey = collectStylingFromDirectives(hostDirectiveDef, tData, tNode, stylingKey, isClassBased);
- if (residual === null) {
- let templateStylingKey = getTemplateHeadTStylingKey(tData, tNode, isClassBased);
- if (templateStylingKey !== void 0 && Array.isArray(templateStylingKey)) {
- templateStylingKey = collectStylingFromDirectives(null, tData, tNode, templateStylingKey[1], isClassBased);
- templateStylingKey = collectStylingFromTAttrs(templateStylingKey, tNode.attrs, isClassBased);
- setTemplateHeadTStylingKey(tData, tNode, isClassBased, templateStylingKey);
- }
- } else {
- residual = collectResidual(tData, tNode, isClassBased);
- }
- }
- }
- if (residual !== void 0) {
- isClassBased ? tNode.residualClasses = residual : tNode.residualStyles = residual;
- }
- return stylingKey;
- }
- function getTemplateHeadTStylingKey(tData, tNode, isClassBased) {
- const bindings = isClassBased ? tNode.classBindings : tNode.styleBindings;
- if (getTStylingRangeNext(bindings) === 0) {
- return void 0;
- }
- return tData[getTStylingRangePrev(bindings)];
- }
- function setTemplateHeadTStylingKey(tData, tNode, isClassBased, tStylingKey) {
- const bindings = isClassBased ? tNode.classBindings : tNode.styleBindings;
- ngDevMode && assertNotEqual(getTStylingRangeNext(bindings), 0, "Expecting to have at least one template styling binding.");
- tData[getTStylingRangePrev(bindings)] = tStylingKey;
- }
- function collectResidual(tData, tNode, isClassBased) {
- let residual = void 0;
- const directiveEnd = tNode.directiveEnd;
- ngDevMode && assertNotEqual(tNode.directiveStylingLast, -1, "By the time this function gets called at least one hostBindings-node styling instruction must have executed.");
- for (let i = 1 + tNode.directiveStylingLast; i < directiveEnd; i++) {
- const attrs = tData[i].hostAttrs;
- residual = collectStylingFromTAttrs(residual, attrs, isClassBased);
- }
- return collectStylingFromTAttrs(residual, tNode.attrs, isClassBased);
- }
- function collectStylingFromDirectives(hostDirectiveDef, tData, tNode, stylingKey, isClassBased) {
- let currentDirective = null;
- const directiveEnd = tNode.directiveEnd;
- let directiveStylingLast = tNode.directiveStylingLast;
- if (directiveStylingLast === -1) {
- directiveStylingLast = tNode.directiveStart;
- } else {
- directiveStylingLast++;
- }
- while (directiveStylingLast < directiveEnd) {
- currentDirective = tData[directiveStylingLast];
- ngDevMode && assertDefined(currentDirective, "expected to be defined");
- stylingKey = collectStylingFromTAttrs(stylingKey, currentDirective.hostAttrs, isClassBased);
- if (currentDirective === hostDirectiveDef)
- break;
- directiveStylingLast++;
- }
- if (hostDirectiveDef !== null) {
- tNode.directiveStylingLast = directiveStylingLast;
- }
- return stylingKey;
- }
- function collectStylingFromTAttrs(stylingKey, attrs, isClassBased) {
- const desiredMarker = isClassBased ? 1 : 2;
- let currentMarker = -1;
- if (attrs !== null) {
- for (let i = 0; i < attrs.length; i++) {
- const item = attrs[i];
- if (typeof item === "number") {
- currentMarker = item;
- } else {
- if (currentMarker === desiredMarker) {
- if (!Array.isArray(stylingKey)) {
- stylingKey = stylingKey === void 0 ? [] : ["", stylingKey];
- }
- keyValueArraySet(stylingKey, item, isClassBased ? true : attrs[++i]);
- }
- }
- }
- }
- return stylingKey === void 0 ? null : stylingKey;
- }
- function toStylingKeyValueArray(keyValueArraySet2, stringParser, value) {
- if (value == null || value === "")
- return EMPTY_ARRAY;
- const styleKeyValueArray = [];
- const unwrappedValue = unwrapSafeValue(value);
- if (Array.isArray(unwrappedValue)) {
- for (let i = 0; i < unwrappedValue.length; i++) {
- keyValueArraySet2(styleKeyValueArray, unwrappedValue[i], true);
- }
- } else if (typeof unwrappedValue === "object") {
- for (const key in unwrappedValue) {
- if (unwrappedValue.hasOwnProperty(key)) {
- keyValueArraySet2(styleKeyValueArray, key, unwrappedValue[key]);
- }
- }
- } else if (typeof unwrappedValue === "string") {
- stringParser(styleKeyValueArray, unwrappedValue);
- } else {
- ngDevMode && throwError("Unsupported styling type " + typeof unwrappedValue + ": " + unwrappedValue);
- }
- return styleKeyValueArray;
- }
- function styleKeyValueArraySet(keyValueArray, key, value) {
- keyValueArraySet(keyValueArray, key, unwrapSafeValue(value));
- }
- function classKeyValueArraySet(keyValueArray, key, value) {
- const stringKey = String(key);
- if (stringKey !== "" && !stringKey.includes(" ")) {
- keyValueArraySet(keyValueArray, stringKey, value);
- }
- }
- function updateStylingMap(tView, tNode, lView, renderer, oldKeyValueArray, newKeyValueArray, isClassBased, bindingIndex) {
- if (oldKeyValueArray === NO_CHANGE) {
- oldKeyValueArray = EMPTY_ARRAY;
- }
- let oldIndex = 0;
- let newIndex = 0;
- let oldKey = 0 < oldKeyValueArray.length ? oldKeyValueArray[0] : null;
- let newKey = 0 < newKeyValueArray.length ? newKeyValueArray[0] : null;
- while (oldKey !== null || newKey !== null) {
- ngDevMode && assertLessThan(oldIndex, 999, "Are we stuck in infinite loop?");
- ngDevMode && assertLessThan(newIndex, 999, "Are we stuck in infinite loop?");
- const oldValue = oldIndex < oldKeyValueArray.length ? oldKeyValueArray[oldIndex + 1] : void 0;
- const newValue = newIndex < newKeyValueArray.length ? newKeyValueArray[newIndex + 1] : void 0;
- let setKey = null;
- let setValue = void 0;
- if (oldKey === newKey) {
- oldIndex += 2;
- newIndex += 2;
- if (oldValue !== newValue) {
- setKey = newKey;
- setValue = newValue;
- }
- } else if (newKey === null || oldKey !== null && oldKey < newKey) {
- oldIndex += 2;
- setKey = oldKey;
- } else {
- ngDevMode && assertDefined(newKey, "Expecting to have a valid key");
- newIndex += 2;
- setKey = newKey;
- setValue = newValue;
- }
- if (setKey !== null) {
- updateStyling(tView, tNode, lView, renderer, setKey, setValue, isClassBased, bindingIndex);
- }
- oldKey = oldIndex < oldKeyValueArray.length ? oldKeyValueArray[oldIndex] : null;
- newKey = newIndex < newKeyValueArray.length ? newKeyValueArray[newIndex] : null;
- }
- }
- function updateStyling(tView, tNode, lView, renderer, prop, value, isClassBased, bindingIndex) {
- if (!(tNode.type & 3)) {
- return;
- }
- const tData = tView.data;
- const tRange = tData[bindingIndex + 1];
- const higherPriorityValue = getTStylingRangeNextDuplicate(tRange) ? findStylingValue(tData, tNode, lView, prop, getTStylingRangeNext(tRange), isClassBased) : void 0;
- if (!isStylingValuePresent(higherPriorityValue)) {
- if (!isStylingValuePresent(value)) {
- if (getTStylingRangePrevDuplicate(tRange)) {
- value = findStylingValue(tData, null, lView, prop, bindingIndex, isClassBased);
- }
- }
- const rNode = getNativeByIndex(getSelectedIndex(), lView);
- applyStyling(renderer, isClassBased, rNode, prop, value);
- }
- }
- function findStylingValue(tData, tNode, lView, prop, index, isClassBased) {
- const isPrevDirection = tNode === null;
- let value = void 0;
- while (index > 0) {
- const rawKey = tData[index];
- const containsStatics = Array.isArray(rawKey);
- const key = containsStatics ? rawKey[1] : rawKey;
- const isStylingMap = key === null;
- let valueAtLViewIndex = lView[index + 1];
- if (valueAtLViewIndex === NO_CHANGE) {
- valueAtLViewIndex = isStylingMap ? EMPTY_ARRAY : void 0;
- }
- let currentValue = isStylingMap ? keyValueArrayGet(valueAtLViewIndex, prop) : key === prop ? valueAtLViewIndex : void 0;
- if (containsStatics && !isStylingValuePresent(currentValue)) {
- currentValue = keyValueArrayGet(rawKey, prop);
- }
- if (isStylingValuePresent(currentValue)) {
- value = currentValue;
- if (isPrevDirection) {
- return value;
- }
- }
- const tRange = tData[index + 1];
- index = isPrevDirection ? getTStylingRangePrev(tRange) : getTStylingRangeNext(tRange);
- }
- if (tNode !== null) {
- let residual = isClassBased ? tNode.residualClasses : tNode.residualStyles;
- if (residual != null) {
- value = keyValueArrayGet(residual, prop);
- }
- }
- return value;
- }
- function isStylingValuePresent(value) {
- return value !== void 0;
- }
- function normalizeSuffix(value, suffix) {
- if (value == null || value === "") {
- } else if (typeof suffix === "string") {
- value = value + suffix;
- } else if (typeof value === "object") {
- value = stringify(unwrapSafeValue(value));
- }
- return value;
- }
- function hasStylingInputShadow(tNode, isClassBased) {
- return (tNode.flags & (isClassBased ? 8 : 16)) !== 0;
- }
- function ɵɵclassMapInterpolate1(prefix, v0, suffix) {
- const lView = getLView();
- const interpolatedValue = interpolation1(lView, prefix, v0, suffix);
- checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
- }
- function ɵɵclassMapInterpolate2(prefix, v0, i0, v1, suffix) {
- const lView = getLView();
- const interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix);
- checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
- }
- function ɵɵclassMapInterpolate3(prefix, v0, i0, v1, i1, v2, suffix) {
- const lView = getLView();
- const interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
- checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
- }
- function ɵɵclassMapInterpolate4(prefix, v0, i0, v1, i1, v2, i2, v3, suffix) {
- const lView = getLView();
- const interpolatedValue = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix);
- checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
- }
- function ɵɵclassMapInterpolate5(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix) {
- const lView = getLView();
- const interpolatedValue = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix);
- checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
- }
- function ɵɵclassMapInterpolate6(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix) {
- const lView = getLView();
- const interpolatedValue = interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix);
- checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
- }
- function ɵɵclassMapInterpolate7(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) {
- const lView = getLView();
- const interpolatedValue = interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix);
- checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
- }
- function ɵɵclassMapInterpolate8(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) {
- const lView = getLView();
- const interpolatedValue = interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix);
- checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
- }
- function ɵɵclassMapInterpolateV(values) {
- const lView = getLView();
- const interpolatedValue = interpolationV(lView, values);
- checkStylingMap(keyValueArraySet, classStringParser, interpolatedValue, true);
- }
- function ɵɵcomponentInstance() {
- const instance = getLView()[DECLARATION_COMPONENT_VIEW][CONTEXT];
- ngDevMode && assertDefined(instance, "Expected component instance to be defined");
- return instance;
- }
- var LiveCollection = class {
- destroy(item) {
- }
- updateValue(index, value) {
- }
- // operations below could be implemented on top of the operations defined so far, but having
- // them explicitly allow clear expression of intent and potentially more performant
- // implementations
- swap(index1, index2) {
- const startIdx = Math.min(index1, index2);
- const endIdx = Math.max(index1, index2);
- const endItem = this.detach(endIdx);
- if (endIdx - startIdx > 1) {
- const startItem = this.detach(startIdx);
- this.attach(startIdx, endItem);
- this.attach(endIdx, startItem);
- } else {
- this.attach(startIdx, endItem);
- }
- }
- move(prevIndex, newIdx) {
- this.attach(newIdx, this.detach(prevIndex));
- }
- };
- function valuesMatching(liveIdx, liveValue, newIdx, newValue, trackBy) {
- if (liveIdx === newIdx && Object.is(liveValue, newValue)) {
- return 1;
- } else if (Object.is(trackBy(liveIdx, liveValue), trackBy(newIdx, newValue))) {
- return -1;
- }
- return 0;
- }
- function reconcile(liveCollection, newCollection, trackByFn) {
- let detachedItems = void 0;
- let liveKeysInTheFuture = void 0;
- let liveStartIdx = 0;
- let liveEndIdx = liveCollection.length - 1;
- if (Array.isArray(newCollection)) {
- let newEndIdx = newCollection.length - 1;
- while (liveStartIdx <= liveEndIdx && liveStartIdx <= newEndIdx) {
- const liveStartValue = liveCollection.at(liveStartIdx);
- const newStartValue = newCollection[liveStartIdx];
- const isStartMatching = valuesMatching(liveStartIdx, liveStartValue, liveStartIdx, newStartValue, trackByFn);
- if (isStartMatching !== 0) {
- if (isStartMatching < 0) {
- liveCollection.updateValue(liveStartIdx, newStartValue);
- }
- liveStartIdx++;
- continue;
- }
- const liveEndValue = liveCollection.at(liveEndIdx);
- const newEndValue = newCollection[newEndIdx];
- const isEndMatching = valuesMatching(liveEndIdx, liveEndValue, newEndIdx, newEndValue, trackByFn);
- if (isEndMatching !== 0) {
- if (isEndMatching < 0) {
- liveCollection.updateValue(liveEndIdx, newEndValue);
- }
- liveEndIdx--;
- newEndIdx--;
- continue;
- }
- const liveStartKey = trackByFn(liveStartIdx, liveStartValue);
- const liveEndKey = trackByFn(liveEndIdx, liveEndValue);
- const newStartKey = trackByFn(liveStartIdx, newStartValue);
- if (Object.is(newStartKey, liveEndKey)) {
- const newEndKey = trackByFn(newEndIdx, newEndValue);
- if (Object.is(newEndKey, liveStartKey)) {
- liveCollection.swap(liveStartIdx, liveEndIdx);
- liveCollection.updateValue(liveEndIdx, newEndValue);
- newEndIdx--;
- liveEndIdx--;
- } else {
- liveCollection.move(liveEndIdx, liveStartIdx);
- }
- liveCollection.updateValue(liveStartIdx, newStartValue);
- liveStartIdx++;
- continue;
- }
- detachedItems ??= new UniqueValueMultiKeyMap();
- liveKeysInTheFuture ??= initLiveItemsInTheFuture(liveCollection, liveStartIdx, liveEndIdx, trackByFn);
- if (attachPreviouslyDetached(liveCollection, detachedItems, liveStartIdx, newStartKey)) {
- liveCollection.updateValue(liveStartIdx, newStartValue);
- liveStartIdx++;
- liveEndIdx++;
- } else if (!liveKeysInTheFuture.has(newStartKey)) {
- const newItem = liveCollection.create(liveStartIdx, newCollection[liveStartIdx]);
- liveCollection.attach(liveStartIdx, newItem);
- liveStartIdx++;
- liveEndIdx++;
- } else {
- detachedItems.set(liveStartKey, liveCollection.detach(liveStartIdx));
- liveEndIdx--;
- }
- }
- while (liveStartIdx <= newEndIdx) {
- createOrAttach(liveCollection, detachedItems, trackByFn, liveStartIdx, newCollection[liveStartIdx]);
- liveStartIdx++;
- }
- } else if (newCollection != null) {
- const newCollectionIterator = newCollection[Symbol.iterator]();
- let newIterationResult = newCollectionIterator.next();
- while (!newIterationResult.done && liveStartIdx <= liveEndIdx) {
- const liveValue = liveCollection.at(liveStartIdx);
- const newValue = newIterationResult.value;
- const isStartMatching = valuesMatching(liveStartIdx, liveValue, liveStartIdx, newValue, trackByFn);
- if (isStartMatching !== 0) {
- if (isStartMatching < 0) {
- liveCollection.updateValue(liveStartIdx, newValue);
- }
- liveStartIdx++;
- newIterationResult = newCollectionIterator.next();
- } else {
- detachedItems ??= new UniqueValueMultiKeyMap();
- liveKeysInTheFuture ??= initLiveItemsInTheFuture(liveCollection, liveStartIdx, liveEndIdx, trackByFn);
- const newKey = trackByFn(liveStartIdx, newValue);
- if (attachPreviouslyDetached(liveCollection, detachedItems, liveStartIdx, newKey)) {
- liveCollection.updateValue(liveStartIdx, newValue);
- liveStartIdx++;
- liveEndIdx++;
- newIterationResult = newCollectionIterator.next();
- } else if (!liveKeysInTheFuture.has(newKey)) {
- liveCollection.attach(liveStartIdx, liveCollection.create(liveStartIdx, newValue));
- liveStartIdx++;
- liveEndIdx++;
- newIterationResult = newCollectionIterator.next();
- } else {
- const liveKey = trackByFn(liveStartIdx, liveValue);
- detachedItems.set(liveKey, liveCollection.detach(liveStartIdx));
- liveEndIdx--;
- }
- }
- }
- while (!newIterationResult.done) {
- createOrAttach(liveCollection, detachedItems, trackByFn, liveCollection.length, newIterationResult.value);
- newIterationResult = newCollectionIterator.next();
- }
- }
- while (liveStartIdx <= liveEndIdx) {
- liveCollection.destroy(liveCollection.detach(liveEndIdx--));
- }
- detachedItems?.forEach((item) => {
- liveCollection.destroy(item);
- });
- }
- function attachPreviouslyDetached(prevCollection, detachedItems, index, key) {
- if (detachedItems !== void 0 && detachedItems.has(key)) {
- prevCollection.attach(index, detachedItems.get(key));
- detachedItems.delete(key);
- return true;
- }
- return false;
- }
- function createOrAttach(liveCollection, detachedItems, trackByFn, index, value) {
- if (!attachPreviouslyDetached(liveCollection, detachedItems, index, trackByFn(index, value))) {
- const newItem = liveCollection.create(index, value);
- liveCollection.attach(index, newItem);
- } else {
- liveCollection.updateValue(index, value);
- }
- }
- function initLiveItemsInTheFuture(liveCollection, start, end, trackByFn) {
- const keys = /* @__PURE__ */ new Set();
- for (let i = start; i <= end; i++) {
- keys.add(trackByFn(i, liveCollection.at(i)));
- }
- return keys;
- }
- var UniqueValueMultiKeyMap = class {
- constructor() {
- this.kvMap = /* @__PURE__ */ new Map();
- this._vMap = void 0;
- }
- has(key) {
- return this.kvMap.has(key);
- }
- delete(key) {
- if (!this.has(key))
- return false;
- const value = this.kvMap.get(key);
- if (this._vMap !== void 0 && this._vMap.has(value)) {
- this.kvMap.set(key, this._vMap.get(value));
- this._vMap.delete(value);
- } else {
- this.kvMap.delete(key);
- }
- return true;
- }
- get(key) {
- return this.kvMap.get(key);
- }
- set(key, value) {
- if (this.kvMap.has(key)) {
- let prevValue = this.kvMap.get(key);
- ngDevMode && assertNotSame(prevValue, value, `Detected a duplicated value ${value} for the key ${key}`);
- if (this._vMap === void 0) {
- this._vMap = /* @__PURE__ */ new Map();
- }
- const vMap = this._vMap;
- while (vMap.has(prevValue)) {
- prevValue = vMap.get(prevValue);
- }
- vMap.set(prevValue, value);
- } else {
- this.kvMap.set(key, value);
- }
- }
- forEach(cb) {
- for (let [key, value] of this.kvMap) {
- cb(value, key);
- if (this._vMap !== void 0) {
- const vMap = this._vMap;
- while (vMap.has(value)) {
- value = vMap.get(value);
- cb(value, key);
- }
- }
- }
- }
- };
- function ɵɵconditional(containerIndex, matchingTemplateIndex, value) {
- performanceMarkFeature("NgControlFlow");
- const hostLView = getLView();
- const bindingIndex = nextBindingIndex();
- const lContainer = getLContainer(hostLView, HEADER_OFFSET + containerIndex);
- const viewInContainerIdx = 0;
- if (bindingUpdated(hostLView, bindingIndex, matchingTemplateIndex)) {
- const prevConsumer = setActiveConsumer(null);
- try {
- removeLViewFromLContainer(lContainer, viewInContainerIdx);
- if (matchingTemplateIndex !== -1) {
- const templateTNode = getExistingTNode(hostLView[TVIEW], HEADER_OFFSET + matchingTemplateIndex);
- const dehydratedView = findMatchingDehydratedView(lContainer, templateTNode.tView.ssrId);
- const embeddedLView = createAndRenderEmbeddedLView(hostLView, templateTNode, value, { dehydratedView });
- addLViewToLContainer(lContainer, embeddedLView, viewInContainerIdx, shouldAddViewToDom(templateTNode, dehydratedView));
- }
- } finally {
- setActiveConsumer(prevConsumer);
- }
- } else {
- const lView = getLViewFromLContainer(lContainer, viewInContainerIdx);
- if (lView !== void 0) {
- lView[CONTEXT] = value;
- }
- }
- }
- var RepeaterContext = class {
- constructor(lContainer, $implicit, $index) {
- this.lContainer = lContainer;
- this.$implicit = $implicit;
- this.$index = $index;
- }
- get $count() {
- return this.lContainer.length - CONTAINER_HEADER_OFFSET;
- }
- };
- function ɵɵrepeaterTrackByIndex(index) {
- return index;
- }
- function ɵɵrepeaterTrackByIdentity(_, value) {
- return value;
- }
- var RepeaterMetadata = class {
- constructor(hasEmptyBlock, trackByFn, liveCollection) {
- this.hasEmptyBlock = hasEmptyBlock;
- this.trackByFn = trackByFn;
- this.liveCollection = liveCollection;
- }
- };
- function ɵɵrepeaterCreate(index, templateFn, decls, vars, tagName, attrsIndex, trackByFn, trackByUsesComponentInstance, emptyTemplateFn, emptyDecls, emptyVars, emptyTagName, emptyAttrsIndex) {
- performanceMarkFeature("NgControlFlow");
- const hasEmptyBlock = emptyTemplateFn !== void 0;
- const hostLView = getLView();
- const boundTrackBy = trackByUsesComponentInstance ? (
- // We only want to bind when necessary, because it produces a
- // new function. For pure functions it's not necessary.
- trackByFn.bind(hostLView[DECLARATION_COMPONENT_VIEW][CONTEXT])
- ) : trackByFn;
- const metadata = new RepeaterMetadata(hasEmptyBlock, boundTrackBy);
- hostLView[HEADER_OFFSET + index] = metadata;
- ɵɵtemplate(index + 1, templateFn, decls, vars, tagName, attrsIndex);
- if (hasEmptyBlock) {
- ngDevMode && assertDefined(emptyDecls, "Missing number of declarations for the empty repeater block.");
- ngDevMode && assertDefined(emptyVars, "Missing number of bindings for the empty repeater block.");
- ɵɵtemplate(index + 2, emptyTemplateFn, emptyDecls, emptyVars, emptyTagName, emptyAttrsIndex);
- }
- }
- var LiveCollectionLContainerImpl = class extends LiveCollection {
- constructor(lContainer, hostLView, templateTNode) {
- super();
- this.lContainer = lContainer;
- this.hostLView = hostLView;
- this.templateTNode = templateTNode;
- this.needsIndexUpdate = false;
- }
- get length() {
- return this.lContainer.length - CONTAINER_HEADER_OFFSET;
- }
- at(index) {
- return this.getLView(index)[CONTEXT].$implicit;
- }
- attach(index, lView) {
- const dehydratedView = lView[HYDRATION];
- this.needsIndexUpdate ||= index !== this.length;
- addLViewToLContainer(this.lContainer, lView, index, shouldAddViewToDom(this.templateTNode, dehydratedView));
- }
- detach(index) {
- this.needsIndexUpdate ||= index !== this.length - 1;
- return detachExistingView(this.lContainer, index);
- }
- create(index, value) {
- const dehydratedView = findMatchingDehydratedView(this.lContainer, this.templateTNode.tView.ssrId);
- const embeddedLView = createAndRenderEmbeddedLView(this.hostLView, this.templateTNode, new RepeaterContext(this.lContainer, value, index), { dehydratedView });
- return embeddedLView;
- }
- destroy(lView) {
- destroyLView(lView[TVIEW], lView);
- }
- updateValue(index, value) {
- this.getLView(index)[CONTEXT].$implicit = value;
- }
- reset() {
- this.needsIndexUpdate = false;
- }
- updateIndexes() {
- if (this.needsIndexUpdate) {
- for (let i = 0; i < this.length; i++) {
- this.getLView(i)[CONTEXT].$index = i;
- }
- }
- }
- getLView(index) {
- return getExistingLViewFromLContainer(this.lContainer, index);
- }
- };
- function ɵɵrepeater(collection) {
- const prevConsumer = setActiveConsumer(null);
- const metadataSlotIdx = getSelectedIndex();
- try {
- const hostLView = getLView();
- const hostTView = hostLView[TVIEW];
- const metadata = hostLView[metadataSlotIdx];
- if (metadata.liveCollection === void 0) {
- const containerIndex = metadataSlotIdx + 1;
- const lContainer = getLContainer(hostLView, containerIndex);
- const itemTemplateTNode = getExistingTNode(hostTView, containerIndex);
- metadata.liveCollection = new LiveCollectionLContainerImpl(lContainer, hostLView, itemTemplateTNode);
- } else {
- metadata.liveCollection.reset();
- }
- const liveCollection = metadata.liveCollection;
- reconcile(liveCollection, collection, metadata.trackByFn);
- liveCollection.updateIndexes();
- if (metadata.hasEmptyBlock) {
- const bindingIndex = nextBindingIndex();
- const isCollectionEmpty = liveCollection.length === 0;
- if (bindingUpdated(hostLView, bindingIndex, isCollectionEmpty)) {
- const emptyTemplateIndex = metadataSlotIdx + 2;
- const lContainerForEmpty = getLContainer(hostLView, emptyTemplateIndex);
- if (isCollectionEmpty) {
- const emptyTemplateTNode = getExistingTNode(hostTView, emptyTemplateIndex);
- const dehydratedView = findMatchingDehydratedView(lContainerForEmpty, emptyTemplateTNode.tView.ssrId);
- const embeddedLView = createAndRenderEmbeddedLView(hostLView, emptyTemplateTNode, void 0, { dehydratedView });
- addLViewToLContainer(lContainerForEmpty, embeddedLView, 0, shouldAddViewToDom(emptyTemplateTNode, dehydratedView));
- } else {
- removeLViewFromLContainer(lContainerForEmpty, 0);
- }
- }
- }
- } finally {
- setActiveConsumer(prevConsumer);
- }
- }
- function getLContainer(lView, index) {
- const lContainer = lView[index];
- ngDevMode && assertLContainer(lContainer);
- return lContainer;
- }
- function detachExistingView(lContainer, index) {
- const existingLView = detachView(lContainer, index);
- ngDevMode && assertLView(existingLView);
- return existingLView;
- }
- function getExistingLViewFromLContainer(lContainer, index) {
- const existingLView = getLViewFromLContainer(lContainer, index);
- ngDevMode && assertLView(existingLView);
- return existingLView;
- }
- function getExistingTNode(tView, index) {
- const tNode = getTNode(tView, index);
- ngDevMode && assertTNode(tNode);
- return tNode;
- }
- function elementStartFirstCreatePass(index, tView, lView, name, attrsIndex, localRefsIndex) {
- ngDevMode && assertFirstCreatePass(tView);
- ngDevMode && ngDevMode.firstCreatePass++;
- const tViewConsts = tView.consts;
- const attrs = getConstant(tViewConsts, attrsIndex);
- const tNode = getOrCreateTNode(tView, index, 2, name, attrs);
- resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex));
- 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 ɵɵelementStart(index, name, attrsIndex, localRefsIndex) {
- const lView = getLView();
- const tView = getTView();
- const adjustedIndex = HEADER_OFFSET + index;
- ngDevMode && assertEqual(getBindingIndex(), tView.bindingStartIndex, "elements should be created before any bindings");
- ngDevMode && assertIndexInRange(lView, adjustedIndex);
- const renderer = lView[RENDERER];
- const tNode = tView.firstCreatePass ? elementStartFirstCreatePass(adjustedIndex, tView, lView, name, attrsIndex, localRefsIndex) : tView.data[adjustedIndex];
- const native = _locateOrCreateElementNode(tView, lView, tNode, renderer, name, index);
- lView[adjustedIndex] = native;
- const hasDirectives = isDirectiveHost(tNode);
- if (ngDevMode && tView.firstCreatePass) {
- validateElementIsKnown(native, lView, tNode.value, tView.schemas, hasDirectives);
- }
- setCurrentTNode(tNode, true);
- setupStaticAttributes(renderer, native, tNode);
- if ((tNode.flags & 32) !== 32 && wasLastNodeCreated()) {
- appendChild(tView, lView, native, tNode);
- }
- if (getElementDepthCount() === 0) {
- attachPatchData(native, lView);
- }
- increaseElementDepthCount();
- if (hasDirectives) {
- createDirectivesInstances(tView, lView, tNode);
- executeContentQueries(tView, tNode, lView);
- }
- if (localRefsIndex !== null) {
- saveResolvedLocalsInData(lView, tNode);
- }
- return ɵɵelementStart;
- }
- function ɵɵelementEnd() {
- let currentTNode = getCurrentTNode();
- ngDevMode && assertDefined(currentTNode, "No parent node to close.");
- if (isCurrentTNodeParent()) {
- setCurrentTNodeAsNotParent();
- } else {
- ngDevMode && assertHasParent(getCurrentTNode());
- currentTNode = currentTNode.parent;
- setCurrentTNode(currentTNode, false);
- }
- const tNode = currentTNode;
- ngDevMode && assertTNodeType(
- tNode,
- 3
- /* TNodeType.AnyRNode */
- );
- if (isSkipHydrationRootTNode(tNode)) {
- leaveSkipHydrationBlock();
- }
- decreaseElementDepthCount();
- const tView = getTView();
- if (tView.firstCreatePass) {
- registerPostOrderHooks(tView, currentTNode);
- if (isContentQueryHost(currentTNode)) {
- tView.queries.elementEnd(currentTNode);
- }
- }
- if (tNode.classesWithoutHost != null && hasClassInput(tNode)) {
- setDirectiveInputsWhichShadowsStyling(tView, tNode, getLView(), tNode.classesWithoutHost, true);
- }
- if (tNode.stylesWithoutHost != null && hasStyleInput(tNode)) {
- setDirectiveInputsWhichShadowsStyling(tView, tNode, getLView(), tNode.stylesWithoutHost, false);
- }
- return ɵɵelementEnd;
- }
- function ɵɵelement(index, name, attrsIndex, localRefsIndex) {
- ɵɵelementStart(index, name, attrsIndex, localRefsIndex);
- ɵɵelementEnd();
- return ɵɵelement;
- }
- var _locateOrCreateElementNode = (tView, lView, tNode, renderer, name, index) => {
- lastNodeWasCreated(true);
- return createElementNode(renderer, name, getNamespace$1());
- };
- function locateOrCreateElementNodeImpl(tView, lView, tNode, renderer, name, index) {
- const hydrationInfo = lView[HYDRATION];
- const isNodeCreationMode = !hydrationInfo || isInSkipHydrationBlock$1() || isDisconnectedNode$1(hydrationInfo, index);
- lastNodeWasCreated(isNodeCreationMode);
- if (isNodeCreationMode) {
- return createElementNode(renderer, name, getNamespace$1());
- }
- const native = locateNextRNode(hydrationInfo, tView, lView, tNode);
- ngDevMode && validateMatchingNode(native, Node.ELEMENT_NODE, name, lView, tNode);
- ngDevMode && markRNodeAsClaimedByHydration(native);
- if (getSerializedContainerViews(hydrationInfo, index)) {
- ngDevMode && validateNodeExists(native.nextSibling, lView, tNode);
- setSegmentHead(hydrationInfo, index, native.nextSibling);
- }
- if (hydrationInfo && (hasSkipHydrationAttrOnTNode(tNode) || hasSkipHydrationAttrOnRElement(native))) {
- if (isComponentHost(tNode)) {
- enterSkipHydrationBlock(tNode);
- clearElementContents(native);
- ngDevMode && markRNodeAsSkippedByHydration(native);
- } else if (ngDevMode) {
- throw invalidSkipHydrationHost(native);
- }
- }
- return native;
- }
- function enableLocateOrCreateElementNodeImpl() {
- _locateOrCreateElementNode = locateOrCreateElementNodeImpl;
- }
- function elementContainerStartFirstCreatePass(index, tView, lView, attrsIndex, localRefsIndex) {
- ngDevMode && ngDevMode.firstCreatePass++;
- const tViewConsts = tView.consts;
- const attrs = getConstant(tViewConsts, attrsIndex);
- const tNode = getOrCreateTNode(tView, index, 8, "ng-container", attrs);
- if (attrs !== null) {
- computeStaticStyling(tNode, attrs, true);
- }
- const localRefs = getConstant(tViewConsts, localRefsIndex);
- resolveDirectives(tView, lView, tNode, localRefs);
- if (tView.queries !== null) {
- tView.queries.elementStart(tView, tNode);
- }
- return tNode;
- }
- function ɵɵelementContainerStart(index, attrsIndex, localRefsIndex) {
- const lView = getLView();
- const tView = getTView();
- const adjustedIndex = index + HEADER_OFFSET;
- ngDevMode && assertIndexInRange(lView, adjustedIndex);
- ngDevMode && assertEqual(getBindingIndex(), tView.bindingStartIndex, "element containers should be created before any bindings");
- const tNode = tView.firstCreatePass ? elementContainerStartFirstCreatePass(adjustedIndex, tView, lView, attrsIndex, localRefsIndex) : tView.data[adjustedIndex];
- setCurrentTNode(tNode, true);
- const comment = _locateOrCreateElementContainerNode(tView, lView, tNode, index);
- lView[adjustedIndex] = comment;
- if (wasLastNodeCreated()) {
- appendChild(tView, lView, comment, tNode);
- }
- attachPatchData(comment, lView);
- if (isDirectiveHost(tNode)) {
- createDirectivesInstances(tView, lView, tNode);
- executeContentQueries(tView, tNode, lView);
- }
- if (localRefsIndex != null) {
- saveResolvedLocalsInData(lView, tNode);
- }
- return ɵɵelementContainerStart;
- }
- function ɵɵelementContainerEnd() {
- let currentTNode = getCurrentTNode();
- const tView = getTView();
- if (isCurrentTNodeParent()) {
- setCurrentTNodeAsNotParent();
- } else {
- ngDevMode && assertHasParent(currentTNode);
- currentTNode = currentTNode.parent;
- setCurrentTNode(currentTNode, false);
- }
- ngDevMode && assertTNodeType(
- currentTNode,
- 8
- /* TNodeType.ElementContainer */
- );
- if (tView.firstCreatePass) {
- registerPostOrderHooks(tView, currentTNode);
- if (isContentQueryHost(currentTNode)) {
- tView.queries.elementEnd(currentTNode);
- }
- }
- return ɵɵelementContainerEnd;
- }
- function ɵɵelementContainer(index, attrsIndex, localRefsIndex) {
- ɵɵelementContainerStart(index, attrsIndex, localRefsIndex);
- ɵɵelementContainerEnd();
- return ɵɵelementContainer;
- }
- var _locateOrCreateElementContainerNode = (tView, lView, tNode, index) => {
- lastNodeWasCreated(true);
- return createCommentNode(lView[RENDERER], ngDevMode ? "ng-container" : "");
- };
- function locateOrCreateElementContainerNode(tView, lView, tNode, index) {
- let comment;
- const hydrationInfo = lView[HYDRATION];
- const isNodeCreationMode = !hydrationInfo || isInSkipHydrationBlock$1();
- lastNodeWasCreated(isNodeCreationMode);
- if (isNodeCreationMode) {
- return createCommentNode(lView[RENDERER], ngDevMode ? "ng-container" : "");
- }
- const currentRNode = locateNextRNode(hydrationInfo, tView, lView, tNode);
- ngDevMode && validateNodeExists(currentRNode, lView, tNode);
- const ngContainerSize = getNgContainerSize(hydrationInfo, index);
- ngDevMode && assertNumber(ngContainerSize, "Unexpected state: hydrating an <ng-container>, but no hydration info is available.");
- setSegmentHead(hydrationInfo, index, currentRNode);
- comment = siblingAfter(ngContainerSize, currentRNode);
- if (ngDevMode) {
- validateMatchingNode(comment, Node.COMMENT_NODE, null, lView, tNode);
- markRNodeAsClaimedByHydration(comment);
- }
- return comment;
- }
- function enableLocateOrCreateElementContainerNodeImpl() {
- _locateOrCreateElementContainerNode = locateOrCreateElementContainerNode;
- }
- function ɵɵgetCurrentView() {
- return getLView();
- }
- function ɵɵhostProperty(propName, value, sanitizer) {
- const lView = getLView();
- const bindingIndex = nextBindingIndex();
- if (bindingUpdated(lView, bindingIndex, value)) {
- const tView = getTView();
- const tNode = getSelectedTNode();
- elementPropertyInternal(tView, tNode, lView, propName, value, lView[RENDERER], sanitizer, true);
- ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, bindingIndex);
- }
- return ɵɵhostProperty;
- }
- function ɵɵsyntheticHostProperty(propName, value, sanitizer) {
- const lView = getLView();
- const bindingIndex = nextBindingIndex();
- if (bindingUpdated(lView, bindingIndex, value)) {
- const tView = getTView();
- const tNode = getSelectedTNode();
- const currentDef = getCurrentDirectiveDef(tView.data);
- const renderer = loadComponentRenderer(currentDef, tNode, lView);
- elementPropertyInternal(tView, tNode, lView, propName, value, renderer, sanitizer, true);
- ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, bindingIndex);
- }
- return ɵɵsyntheticHostProperty;
- }
- if (typeof ngI18nClosureMode === "undefined") {
- (function() {
- _global["ngI18nClosureMode"] = // TODO(FW-1250): validate that this actually, you know, works.
- // tslint:disable-next-line:no-toplevel-property-access
- typeof goog !== "undefined" && typeof goog.getMsg === "function";
- })();
- }
- var u = void 0;
- function plural(val) {
- const n = val, i = Math.floor(Math.abs(val)), v = val.toString().replace(/^[^.]*\.?/, "").length;
- if (i === 1 && v === 0)
- return 1;
- return 5;
- }
- var localeEn = ["en", [["a", "p"], ["AM", "PM"], u], [["AM", "PM"], u, u], [["S", "M", "T", "W", "T", "F", "S"], ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]], u, [["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]], u, [["B", "A"], ["BC", "AD"], ["Before Christ", "Anno Domini"]], 0, [6, 0], ["M/d/yy", "MMM d, y", "MMMM d, y", "EEEE, MMMM d, y"], ["h:mm a", "h:mm:ss a", "h:mm:ss a z", "h:mm:ss a zzzz"], ["{1}, {0}", u, "{1} 'at' {0}", u], [".", ",", ";", "%", "+", "-", "E", "×", "‰", "∞", "NaN", ":"], ["#,##0.###", "#,##0%", "¤#,##0.00", "#E0"], "USD", "$", "US Dollar", {}, "ltr", plural];
- var LOCALE_DATA = {};
- function registerLocaleData(data, localeId, extraData) {
- if (typeof localeId !== "string") {
- extraData = localeId;
- localeId = data[LocaleDataIndex.LocaleId];
- }
- localeId = localeId.toLowerCase().replace(/_/g, "-");
- LOCALE_DATA[localeId] = data;
- if (extraData) {
- LOCALE_DATA[localeId][LocaleDataIndex.ExtraData] = extraData;
- }
- }
- function findLocaleData(locale) {
- const normalizedLocale = normalizeLocale(locale);
- let match = getLocaleData(normalizedLocale);
- if (match) {
- return match;
- }
- const parentLocale = normalizedLocale.split("-")[0];
- match = getLocaleData(parentLocale);
- if (match) {
- return match;
- }
- if (parentLocale === "en") {
- return localeEn;
- }
- throw new RuntimeError(701, ngDevMode && `Missing locale data for the locale "${locale}".`);
- }
- function getLocaleCurrencyCode(locale) {
- const data = findLocaleData(locale);
- return data[LocaleDataIndex.CurrencyCode] || null;
- }
- function getLocalePluralCase(locale) {
- const data = findLocaleData(locale);
- return data[LocaleDataIndex.PluralCase];
- }
- function getLocaleData(normalizedLocale) {
- if (!(normalizedLocale in LOCALE_DATA)) {
- LOCALE_DATA[normalizedLocale] = _global.ng && _global.ng.common && _global.ng.common.locales && _global.ng.common.locales[normalizedLocale];
- }
- return LOCALE_DATA[normalizedLocale];
- }
- function unregisterAllLocaleData() {
- LOCALE_DATA = {};
- }
- var LocaleDataIndex;
- (function(LocaleDataIndex2) {
- LocaleDataIndex2[LocaleDataIndex2["LocaleId"] = 0] = "LocaleId";
- LocaleDataIndex2[LocaleDataIndex2["DayPeriodsFormat"] = 1] = "DayPeriodsFormat";
- LocaleDataIndex2[LocaleDataIndex2["DayPeriodsStandalone"] = 2] = "DayPeriodsStandalone";
- LocaleDataIndex2[LocaleDataIndex2["DaysFormat"] = 3] = "DaysFormat";
- LocaleDataIndex2[LocaleDataIndex2["DaysStandalone"] = 4] = "DaysStandalone";
- LocaleDataIndex2[LocaleDataIndex2["MonthsFormat"] = 5] = "MonthsFormat";
- LocaleDataIndex2[LocaleDataIndex2["MonthsStandalone"] = 6] = "MonthsStandalone";
- LocaleDataIndex2[LocaleDataIndex2["Eras"] = 7] = "Eras";
- LocaleDataIndex2[LocaleDataIndex2["FirstDayOfWeek"] = 8] = "FirstDayOfWeek";
- LocaleDataIndex2[LocaleDataIndex2["WeekendRange"] = 9] = "WeekendRange";
- LocaleDataIndex2[LocaleDataIndex2["DateFormat"] = 10] = "DateFormat";
- LocaleDataIndex2[LocaleDataIndex2["TimeFormat"] = 11] = "TimeFormat";
- LocaleDataIndex2[LocaleDataIndex2["DateTimeFormat"] = 12] = "DateTimeFormat";
- LocaleDataIndex2[LocaleDataIndex2["NumberSymbols"] = 13] = "NumberSymbols";
- LocaleDataIndex2[LocaleDataIndex2["NumberFormats"] = 14] = "NumberFormats";
- LocaleDataIndex2[LocaleDataIndex2["CurrencyCode"] = 15] = "CurrencyCode";
- LocaleDataIndex2[LocaleDataIndex2["CurrencySymbol"] = 16] = "CurrencySymbol";
- LocaleDataIndex2[LocaleDataIndex2["CurrencyName"] = 17] = "CurrencyName";
- LocaleDataIndex2[LocaleDataIndex2["Currencies"] = 18] = "Currencies";
- LocaleDataIndex2[LocaleDataIndex2["Directionality"] = 19] = "Directionality";
- LocaleDataIndex2[LocaleDataIndex2["PluralCase"] = 20] = "PluralCase";
- LocaleDataIndex2[LocaleDataIndex2["ExtraData"] = 21] = "ExtraData";
- })(LocaleDataIndex || (LocaleDataIndex = {}));
- function normalizeLocale(locale) {
- return locale.toLowerCase().replace(/_/g, "-");
- }
- var pluralMapping = ["zero", "one", "two", "few", "many"];
- function getPluralCase(value, locale) {
- const plural2 = getLocalePluralCase(locale)(parseInt(value, 10));
- const result = pluralMapping[plural2];
- return result !== void 0 ? result : "other";
- }
- var DEFAULT_LOCALE_ID = "en-US";
- var USD_CURRENCY_CODE = "USD";
- var ELEMENT_MARKER = {
- marker: "element"
- };
- var ICU_MARKER = {
- marker: "ICU"
- };
- var I18nCreateOpCode;
- (function(I18nCreateOpCode2) {
- I18nCreateOpCode2[I18nCreateOpCode2["SHIFT"] = 2] = "SHIFT";
- I18nCreateOpCode2[I18nCreateOpCode2["APPEND_EAGERLY"] = 1] = "APPEND_EAGERLY";
- I18nCreateOpCode2[I18nCreateOpCode2["COMMENT"] = 2] = "COMMENT";
- })(I18nCreateOpCode || (I18nCreateOpCode = {}));
- var LOCALE_ID$1 = DEFAULT_LOCALE_ID;
- function setLocaleId(localeId) {
- ngDevMode && assertDefined(localeId, `Expected localeId to be defined`);
- if (typeof localeId === "string") {
- LOCALE_ID$1 = localeId.toLowerCase().replace(/_/g, "-");
- }
- }
- function getLocaleId() {
- return LOCALE_ID$1;
- }
- 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 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;
- }
- var changeMask = 0;
- var changeMaskCounter = 0;
- function setMaskBit(hasChange) {
- if (hasChange) {
- changeMask = changeMask | 1 << Math.min(changeMaskCounter, 31);
- }
- changeMaskCounter++;
- }
- function applyI18n(tView, lView, index) {
- if (changeMaskCounter > 0) {
- ngDevMode && assertDefined(tView, `tView should be defined`);
- const tI18n = tView.data[index];
- const updateOpCodes = Array.isArray(tI18n) ? tI18n : tI18n.update;
- const bindingsStartIndex = getBindingIndex() - changeMaskCounter - 1;
- applyUpdateOpCodes(tView, lView, updateOpCodes, bindingsStartIndex, changeMask);
- }
- changeMask = 0;
- changeMaskCounter = 0;
- }
- function applyCreateOpCodes(lView, createOpCodes, parentRNode, insertInFrontOf) {
- const renderer = lView[RENDERER];
- for (let i = 0; i < createOpCodes.length; i++) {
- const opCode = createOpCodes[i++];
- const text = createOpCodes[i];
- const isComment = (opCode & I18nCreateOpCode.COMMENT) === I18nCreateOpCode.COMMENT;
- const appendNow = (opCode & I18nCreateOpCode.APPEND_EAGERLY) === I18nCreateOpCode.APPEND_EAGERLY;
- const index = opCode >>> I18nCreateOpCode.SHIFT;
- let rNode = lView[index];
- if (rNode === null) {
- rNode = lView[index] = isComment ? renderer.createComment(text) : createTextNode(renderer, text);
- }
- if (appendNow && parentRNode !== null) {
- nativeInsertBefore(renderer, parentRNode, rNode, insertInFrontOf, false);
- }
- }
- }
- function applyMutableOpCodes(tView, mutableOpCodes, lView, anchorRNode) {
- ngDevMode && assertDomNode(anchorRNode);
- const renderer = lView[RENDERER];
- let rootIdx = null;
- let rootRNode;
- for (let i = 0; i < mutableOpCodes.length; i++) {
- const opCode = mutableOpCodes[i];
- if (typeof opCode == "string") {
- const textNodeIndex = mutableOpCodes[++i];
- if (lView[textNodeIndex] === null) {
- ngDevMode && ngDevMode.rendererCreateTextNode++;
- ngDevMode && assertIndexInRange(lView, textNodeIndex);
- lView[textNodeIndex] = createTextNode(renderer, opCode);
- }
- } else if (typeof opCode == "number") {
- switch (opCode & 1) {
- case 0:
- const parentIdx = getParentFromIcuCreateOpCode(opCode);
- if (rootIdx === null) {
- rootIdx = parentIdx;
- rootRNode = nativeParentNode(renderer, anchorRNode);
- }
- let insertInFrontOf;
- let parentRNode;
- if (parentIdx === rootIdx) {
- insertInFrontOf = anchorRNode;
- parentRNode = rootRNode;
- } else {
- insertInFrontOf = null;
- parentRNode = unwrapRNode(lView[parentIdx]);
- }
- if (parentRNode !== null) {
- ngDevMode && assertDomNode(parentRNode);
- const refIdx = getRefFromIcuCreateOpCode(opCode);
- ngDevMode && assertGreaterThan(refIdx, HEADER_OFFSET, "Missing ref");
- const child = lView[refIdx];
- ngDevMode && assertDomNode(child);
- nativeInsertBefore(renderer, parentRNode, child, insertInFrontOf, false);
- const tIcu = getTIcu(tView, refIdx);
- if (tIcu !== null && typeof tIcu === "object") {
- ngDevMode && assertTIcu(tIcu);
- const caseIndex = getCurrentICUCaseIndex(tIcu, lView);
- if (caseIndex !== null) {
- applyMutableOpCodes(tView, tIcu.create[caseIndex], lView, lView[tIcu.anchorIdx]);
- }
- }
- }
- break;
- case 1:
- const elementNodeIndex = opCode >>> 1;
- const attrName = mutableOpCodes[++i];
- const attrValue = mutableOpCodes[++i];
- setElementAttribute(renderer, getNativeByIndex(elementNodeIndex, lView), null, null, attrName, attrValue, null);
- break;
- default:
- if (ngDevMode) {
- throw new RuntimeError(700, `Unable to determine the type of mutate operation for "${opCode}"`);
- }
- }
- } else {
- switch (opCode) {
- case ICU_MARKER:
- const commentValue = mutableOpCodes[++i];
- const commentNodeIndex = mutableOpCodes[++i];
- if (lView[commentNodeIndex] === null) {
- ngDevMode && assertEqual(typeof commentValue, "string", `Expected "${commentValue}" to be a comment node value`);
- ngDevMode && ngDevMode.rendererCreateComment++;
- ngDevMode && assertIndexInExpandoRange(lView, commentNodeIndex);
- const commentRNode = lView[commentNodeIndex] = createCommentNode(renderer, commentValue);
- attachPatchData(commentRNode, lView);
- }
- break;
- case ELEMENT_MARKER:
- const tagName = mutableOpCodes[++i];
- const elementNodeIndex = mutableOpCodes[++i];
- if (lView[elementNodeIndex] === null) {
- ngDevMode && assertEqual(typeof tagName, "string", `Expected "${tagName}" to be an element node tag name`);
- ngDevMode && ngDevMode.rendererCreateElement++;
- ngDevMode && assertIndexInExpandoRange(lView, elementNodeIndex);
- const elementRNode = lView[elementNodeIndex] = createElementNode(renderer, tagName, null);
- attachPatchData(elementRNode, lView);
- }
- break;
- default:
- ngDevMode && throwError(`Unable to determine the type of mutate operation for "${opCode}"`);
- }
- }
- }
- }
- function applyUpdateOpCodes(tView, lView, updateOpCodes, bindingsStartIndex, changeMask2) {
- for (let i = 0; i < updateOpCodes.length; i++) {
- const checkBit = updateOpCodes[i];
- const skipCodes = updateOpCodes[++i];
- if (checkBit & changeMask2) {
- let value = "";
- for (let j = i + 1; j <= i + skipCodes; j++) {
- const opCode = updateOpCodes[j];
- if (typeof opCode == "string") {
- value += opCode;
- } else if (typeof opCode == "number") {
- if (opCode < 0) {
- value += renderStringify(lView[bindingsStartIndex - opCode]);
- } else {
- const nodeIndex = opCode >>> 2;
- switch (opCode & 3) {
- case 1:
- const propName = updateOpCodes[++j];
- const sanitizeFn = updateOpCodes[++j];
- const tNodeOrTagName = tView.data[nodeIndex];
- ngDevMode && assertDefined(tNodeOrTagName, "Experting TNode or string");
- if (typeof tNodeOrTagName === "string") {
- setElementAttribute(lView[RENDERER], lView[nodeIndex], null, tNodeOrTagName, propName, value, sanitizeFn);
- } else {
- elementPropertyInternal(tView, tNodeOrTagName, lView, propName, value, lView[RENDERER], sanitizeFn, false);
- }
- break;
- case 0:
- const rText = lView[nodeIndex];
- rText !== null && updateTextNode(lView[RENDERER], rText, value);
- break;
- case 2:
- applyIcuSwitchCase(tView, getTIcu(tView, nodeIndex), lView, value);
- break;
- case 3:
- applyIcuUpdateCase(tView, getTIcu(tView, nodeIndex), bindingsStartIndex, lView);
- break;
- }
- }
- }
- }
- } else {
- const opCode = updateOpCodes[i + 1];
- if (opCode > 0 && (opCode & 3) === 3) {
- const nodeIndex = opCode >>> 2;
- const tIcu = getTIcu(tView, nodeIndex);
- const currentIndex = lView[tIcu.currentCaseLViewIndex];
- if (currentIndex < 0) {
- applyIcuUpdateCase(tView, tIcu, bindingsStartIndex, lView);
- }
- }
- }
- i += skipCodes;
- }
- }
- function applyIcuUpdateCase(tView, tIcu, bindingsStartIndex, lView) {
- ngDevMode && assertIndexInRange(lView, tIcu.currentCaseLViewIndex);
- let activeCaseIndex = lView[tIcu.currentCaseLViewIndex];
- if (activeCaseIndex !== null) {
- let mask = changeMask;
- if (activeCaseIndex < 0) {
- activeCaseIndex = lView[tIcu.currentCaseLViewIndex] = ~activeCaseIndex;
- mask = -1;
- }
- applyUpdateOpCodes(tView, lView, tIcu.update[activeCaseIndex], bindingsStartIndex, mask);
- }
- }
- function applyIcuSwitchCase(tView, tIcu, lView, value) {
- const caseIndex = getCaseIndex(tIcu, value);
- let activeCaseIndex = getCurrentICUCaseIndex(tIcu, lView);
- if (activeCaseIndex !== caseIndex) {
- applyIcuSwitchCaseRemove(tView, tIcu, lView);
- lView[tIcu.currentCaseLViewIndex] = caseIndex === null ? null : ~caseIndex;
- if (caseIndex !== null) {
- const anchorRNode = lView[tIcu.anchorIdx];
- if (anchorRNode) {
- ngDevMode && assertDomNode(anchorRNode);
- applyMutableOpCodes(tView, tIcu.create[caseIndex], lView, anchorRNode);
- }
- }
- }
- }
- function applyIcuSwitchCaseRemove(tView, tIcu, lView) {
- let activeCaseIndex = getCurrentICUCaseIndex(tIcu, lView);
- if (activeCaseIndex !== null) {
- const removeCodes = tIcu.remove[activeCaseIndex];
- for (let i = 0; i < removeCodes.length; i++) {
- const nodeOrIcuIndex = removeCodes[i];
- if (nodeOrIcuIndex > 0) {
- const rNode = getNativeByIndex(nodeOrIcuIndex, lView);
- rNode !== null && nativeRemoveNode(lView[RENDERER], rNode);
- } else {
- applyIcuSwitchCaseRemove(tView, getTIcu(tView, ~nodeOrIcuIndex), lView);
- }
- }
- }
- }
- function getCaseIndex(icuExpression, bindingValue) {
- let index = icuExpression.cases.indexOf(bindingValue);
- if (index === -1) {
- switch (icuExpression.type) {
- case 1: {
- const resolvedCase = getPluralCase(bindingValue, getLocaleId());
- index = icuExpression.cases.indexOf(resolvedCase);
- if (index === -1 && resolvedCase !== "other") {
- index = icuExpression.cases.indexOf("other");
- }
- break;
- }
- case 0: {
- index = icuExpression.cases.indexOf("other");
- break;
- }
- }
- }
- return index === -1 ? null : index;
- }
- function loadIcuContainerVisitor() {
- const _stack = [];
- let _index = -1;
- let _lView;
- let _removes;
- function icuContainerIteratorStart(tIcuContainerNode, lView) {
- _lView = lView;
- while (_stack.length)
- _stack.pop();
- ngDevMode && assertTNodeForLView(tIcuContainerNode, lView);
- enterIcu(tIcuContainerNode.value, lView);
- return icuContainerIteratorNext;
- }
- function enterIcu(tIcu, lView) {
- _index = 0;
- const currentCase = getCurrentICUCaseIndex(tIcu, lView);
- if (currentCase !== null) {
- ngDevMode && assertNumberInRange(currentCase, 0, tIcu.cases.length - 1);
- _removes = tIcu.remove[currentCase];
- } else {
- _removes = EMPTY_ARRAY;
- }
- }
- function icuContainerIteratorNext() {
- if (_index < _removes.length) {
- const removeOpCode = _removes[_index++];
- ngDevMode && assertNumber(removeOpCode, "Expecting OpCode number");
- if (removeOpCode > 0) {
- const rNode = _lView[removeOpCode];
- ngDevMode && assertDomNode(rNode);
- return rNode;
- } else {
- _stack.push(_index, _removes);
- const tIcuIndex = ~removeOpCode;
- const tIcu = _lView[TVIEW].data[tIcuIndex];
- ngDevMode && assertTIcu(tIcu);
- enterIcu(tIcu, _lView);
- return icuContainerIteratorNext();
- }
- } else {
- if (_stack.length === 0) {
- return null;
- } else {
- _removes = _stack.pop();
- _index = _stack.pop();
- return icuContainerIteratorNext();
- }
- }
- }
- return icuContainerIteratorStart;
- }
- function i18nCreateOpCodesToString(opcodes) {
- const createOpCodes = opcodes || (Array.isArray(this) ? this : []);
- let lines = [];
- for (let i = 0; i < createOpCodes.length; i++) {
- const opCode = createOpCodes[i++];
- const text = createOpCodes[i];
- const isComment = (opCode & I18nCreateOpCode.COMMENT) === I18nCreateOpCode.COMMENT;
- const appendNow = (opCode & I18nCreateOpCode.APPEND_EAGERLY) === I18nCreateOpCode.APPEND_EAGERLY;
- const index = opCode >>> I18nCreateOpCode.SHIFT;
- lines.push(`lView[${index}] = document.${isComment ? "createComment" : "createText"}(${JSON.stringify(text)});`);
- if (appendNow) {
- lines.push(`parent.appendChild(lView[${index}]);`);
- }
- }
- return lines;
- }
- function i18nUpdateOpCodesToString(opcodes) {
- const parser = new OpCodeParser(opcodes || (Array.isArray(this) ? this : []));
- let lines = [];
- function consumeOpCode(value) {
- const ref = value >>> 2;
- const opCode = value & 3;
- switch (opCode) {
- case 0:
- return `(lView[${ref}] as Text).textContent = $$$`;
- case 1:
- const attrName = parser.consumeString();
- const sanitizationFn = parser.consumeFunction();
- const value2 = sanitizationFn ? `(${sanitizationFn})($$$)` : "$$$";
- return `(lView[${ref}] as Element).setAttribute('${attrName}', ${value2})`;
- case 2:
- return `icuSwitchCase(${ref}, $$$)`;
- case 3:
- return `icuUpdateCase(${ref})`;
- }
- throw new Error("unexpected OpCode");
- }
- while (parser.hasMore()) {
- let mask = parser.consumeNumber();
- let size = parser.consumeNumber();
- const end = parser.i + size;
- const statements = [];
- let statement = "";
- while (parser.i < end) {
- let value = parser.consumeNumberOrString();
- if (typeof value === "string") {
- statement += value;
- } else if (value < 0) {
- statement += "${lView[i" + value + "]}";
- } else {
- const opCodeText = consumeOpCode(value);
- statements.push(opCodeText.replace("$$$", "`" + statement + "`") + ";");
- statement = "";
- }
- }
- lines.push(`if (mask & 0b${mask.toString(2)}) { ${statements.join(" ")} }`);
- }
- return lines;
- }
- function icuCreateOpCodesToString(opcodes) {
- const parser = new OpCodeParser(opcodes || (Array.isArray(this) ? this : []));
- let lines = [];
- function consumeOpCode(opCode) {
- const parent = getParentFromIcuCreateOpCode(opCode);
- const ref = getRefFromIcuCreateOpCode(opCode);
- switch (getInstructionFromIcuCreateOpCode(opCode)) {
- case 0:
- return `(lView[${parent}] as Element).appendChild(lView[${lastRef}])`;
- case 1:
- return `(lView[${ref}] as Element).setAttribute("${parser.consumeString()}", "${parser.consumeString()}")`;
- }
- throw new Error("Unexpected OpCode: " + getInstructionFromIcuCreateOpCode(opCode));
- }
- let lastRef = -1;
- while (parser.hasMore()) {
- let value = parser.consumeNumberStringOrMarker();
- if (value === ICU_MARKER) {
- const text = parser.consumeString();
- lastRef = parser.consumeNumber();
- lines.push(`lView[${lastRef}] = document.createComment("${text}")`);
- } else if (value === ELEMENT_MARKER) {
- const text = parser.consumeString();
- lastRef = parser.consumeNumber();
- lines.push(`lView[${lastRef}] = document.createElement("${text}")`);
- } else if (typeof value === "string") {
- lastRef = parser.consumeNumber();
- lines.push(`lView[${lastRef}] = document.createTextNode("${value}")`);
- } else if (typeof value === "number") {
- const line = consumeOpCode(value);
- line && lines.push(line);
- } else {
- throw new Error("Unexpected value");
- }
- }
- return lines;
- }
- function i18nRemoveOpCodesToString(opcodes) {
- const removeCodes = opcodes || (Array.isArray(this) ? this : []);
- let lines = [];
- for (let i = 0; i < removeCodes.length; i++) {
- const nodeOrIcuIndex = removeCodes[i];
- if (nodeOrIcuIndex > 0) {
- lines.push(`remove(lView[${nodeOrIcuIndex}])`);
- } else {
- lines.push(`removeNestedICU(${~nodeOrIcuIndex})`);
- }
- }
- return lines;
- }
- var OpCodeParser = class {
- constructor(codes) {
- this.i = 0;
- this.codes = codes;
- }
- hasMore() {
- return this.i < this.codes.length;
- }
- consumeNumber() {
- let value = this.codes[this.i++];
- assertNumber(value, "expecting number in OpCode");
- return value;
- }
- consumeString() {
- let value = this.codes[this.i++];
- assertString(value, "expecting string in OpCode");
- return value;
- }
- consumeFunction() {
- let value = this.codes[this.i++];
- if (value === null || typeof value === "function") {
- return value;
- }
- throw new Error("expecting function in OpCode");
- }
- consumeNumberOrString() {
- let value = this.codes[this.i++];
- if (typeof value === "string") {
- return value;
- }
- assertNumber(value, "expecting number or string in OpCode");
- return value;
- }
- consumeNumberStringOrMarker() {
- let value = this.codes[this.i++];
- if (typeof value === "string" || typeof value === "number" || value == ICU_MARKER || value == ELEMENT_MARKER) {
- return value;
- }
- assertNumber(value, "expecting number, string, ICU_MARKER or ELEMENT_MARKER in OpCode");
- return value;
- }
- };
- var BINDING_REGEXP = /�(\d+):?\d*�/gi;
- var ICU_REGEXP = /({\s*�\d+:?\d*�\s*,\s*\S{6}\s*,[\s\S]*})/gi;
- var NESTED_ICU = /�(\d+)�/;
- var ICU_BLOCK_REGEXP = /^\s*(�\d+:?\d*�)\s*,\s*(select|plural)\s*,/;
- var MARKER = `�`;
- var SUBTEMPLATE_REGEXP = /�\/?\*(\d+:\d+)�/gi;
- var PH_REGEXP = /�(\/?[#*]\d+):?\d*�/gi;
- var NGSP_UNICODE_REGEXP = /\uE500/g;
- function replaceNgsp(value) {
- return value.replace(NGSP_UNICODE_REGEXP, " ");
- }
- function attachDebugGetter(obj, debugGetter) {
- if (ngDevMode) {
- Object.defineProperty(obj, "debug", { get: debugGetter, enumerable: false });
- } else {
- throw new Error("This method should be guarded with `ngDevMode` so that it can be tree shaken in production!");
- }
- }
- function i18nStartFirstCreatePass(tView, parentTNodeIndex, lView, index, message, subTemplateIndex) {
- const rootTNode = getCurrentParentTNode();
- const createOpCodes = [];
- const updateOpCodes = [];
- const existingTNodeStack = [[]];
- if (ngDevMode) {
- attachDebugGetter(createOpCodes, i18nCreateOpCodesToString);
- attachDebugGetter(updateOpCodes, i18nUpdateOpCodesToString);
- }
- message = getTranslationForTemplate(message, subTemplateIndex);
- const msgParts = replaceNgsp(message).split(PH_REGEXP);
- for (let i = 0; i < msgParts.length; i++) {
- let value = msgParts[i];
- if ((i & 1) === 0) {
- const parts = i18nParseTextIntoPartsAndICU(value);
- for (let j = 0; j < parts.length; j++) {
- let part = parts[j];
- if ((j & 1) === 0) {
- const text = part;
- ngDevMode && assertString(text, "Parsed ICU part should be string");
- if (text !== "") {
- i18nStartFirstCreatePassProcessTextNode(tView, rootTNode, existingTNodeStack[0], createOpCodes, updateOpCodes, lView, text);
- }
- } else {
- const icuExpression = part;
- if (typeof icuExpression !== "object") {
- throw new Error(`Unable to parse ICU expression in "${message}" message.`);
- }
- const icuContainerTNode = createTNodeAndAddOpCode(tView, rootTNode, existingTNodeStack[0], lView, createOpCodes, ngDevMode ? `ICU ${index}:${icuExpression.mainBinding}` : "", true);
- const icuNodeIndex = icuContainerTNode.index;
- ngDevMode && assertGreaterThanOrEqual(icuNodeIndex, HEADER_OFFSET, "Index must be in absolute LView offset");
- icuStart(tView, lView, updateOpCodes, parentTNodeIndex, icuExpression, icuNodeIndex);
- }
- }
- } else {
- const isClosing = value.charCodeAt(0) === 47;
- const type = value.charCodeAt(isClosing ? 1 : 0);
- ngDevMode && assertOneOf(
- type,
- 42,
- 35
- /* CharCode.HASH */
- );
- const index2 = HEADER_OFFSET + Number.parseInt(value.substring(isClosing ? 2 : 1));
- if (isClosing) {
- existingTNodeStack.shift();
- setCurrentTNode(getCurrentParentTNode(), false);
- } else {
- const tNode = createTNodePlaceholder(tView, existingTNodeStack[0], index2);
- existingTNodeStack.unshift([]);
- setCurrentTNode(tNode, true);
- }
- }
- }
- tView.data[index] = {
- create: createOpCodes,
- update: updateOpCodes
- };
- }
- function createTNodeAndAddOpCode(tView, rootTNode, existingTNodes, lView, createOpCodes, text, isICU) {
- const i18nNodeIdx = allocExpando(tView, lView, 1, null);
- let opCode = i18nNodeIdx << I18nCreateOpCode.SHIFT;
- let parentTNode = getCurrentParentTNode();
- if (rootTNode === parentTNode) {
- parentTNode = null;
- }
- if (parentTNode === null) {
- opCode |= I18nCreateOpCode.APPEND_EAGERLY;
- }
- if (isICU) {
- opCode |= I18nCreateOpCode.COMMENT;
- ensureIcuContainerVisitorLoaded(loadIcuContainerVisitor);
- }
- createOpCodes.push(opCode, text === null ? "" : text);
- const tNode = createTNodeAtIndex(tView, i18nNodeIdx, isICU ? 32 : 1, text === null ? ngDevMode ? "{{?}}" : "" : text, null);
- addTNodeAndUpdateInsertBeforeIndex(existingTNodes, tNode);
- const tNodeIdx = tNode.index;
- setCurrentTNode(
- tNode,
- false
- /* Text nodes are self closing */
- );
- if (parentTNode !== null && rootTNode !== parentTNode) {
- setTNodeInsertBeforeIndex(parentTNode, tNodeIdx);
- }
- return tNode;
- }
- function i18nStartFirstCreatePassProcessTextNode(tView, rootTNode, existingTNodes, createOpCodes, updateOpCodes, lView, text) {
- const hasBinding = text.match(BINDING_REGEXP);
- const tNode = createTNodeAndAddOpCode(tView, rootTNode, existingTNodes, lView, createOpCodes, hasBinding ? null : text, false);
- if (hasBinding) {
- generateBindingUpdateOpCodes(updateOpCodes, text, tNode.index, null, 0, null);
- }
- }
- function i18nAttributesFirstPass(tView, index, values) {
- const previousElement = getCurrentTNode();
- const previousElementIndex = previousElement.index;
- const updateOpCodes = [];
- if (ngDevMode) {
- attachDebugGetter(updateOpCodes, i18nUpdateOpCodesToString);
- }
- if (tView.firstCreatePass && tView.data[index] === null) {
- for (let i = 0; i < values.length; i += 2) {
- const attrName = values[i];
- const message = values[i + 1];
- if (message !== "") {
- if (ICU_REGEXP.test(message)) {
- throw new Error(`ICU expressions are not supported in attributes. Message: "${message}".`);
- }
- generateBindingUpdateOpCodes(updateOpCodes, message, previousElementIndex, attrName, countBindings(updateOpCodes), null);
- }
- }
- tView.data[index] = updateOpCodes;
- }
- }
- function generateBindingUpdateOpCodes(updateOpCodes, str, destinationNode, attrName, bindingStart, sanitizeFn) {
- ngDevMode && assertGreaterThanOrEqual(destinationNode, HEADER_OFFSET, "Index must be in absolute LView offset");
- const maskIndex = updateOpCodes.length;
- const sizeIndex = maskIndex + 1;
- updateOpCodes.push(null, null);
- const startIndex = maskIndex + 2;
- if (ngDevMode) {
- attachDebugGetter(updateOpCodes, i18nUpdateOpCodesToString);
- }
- const textParts = str.split(BINDING_REGEXP);
- let mask = 0;
- for (let j = 0; j < textParts.length; j++) {
- const textValue = textParts[j];
- if (j & 1) {
- const bindingIndex = bindingStart + parseInt(textValue, 10);
- updateOpCodes.push(-1 - bindingIndex);
- mask = mask | toMaskBit(bindingIndex);
- } else if (textValue !== "") {
- updateOpCodes.push(textValue);
- }
- }
- updateOpCodes.push(destinationNode << 2 | (attrName ? 1 : 0));
- if (attrName) {
- updateOpCodes.push(attrName, sanitizeFn);
- }
- updateOpCodes[maskIndex] = mask;
- updateOpCodes[sizeIndex] = updateOpCodes.length - startIndex;
- return mask;
- }
- function countBindings(opCodes) {
- let count2 = 0;
- for (let i = 0; i < opCodes.length; i++) {
- const opCode = opCodes[i];
- if (typeof opCode === "number" && opCode < 0) {
- count2++;
- }
- }
- return count2;
- }
- function toMaskBit(bindingIndex) {
- return 1 << Math.min(bindingIndex, 31);
- }
- function isRootTemplateMessage(subTemplateIndex) {
- return subTemplateIndex === -1;
- }
- function removeInnerTemplateTranslation(message) {
- let match;
- let res = "";
- let index = 0;
- let inTemplate = false;
- let tagMatched;
- while ((match = SUBTEMPLATE_REGEXP.exec(message)) !== null) {
- if (!inTemplate) {
- res += message.substring(index, match.index + match[0].length);
- tagMatched = match[1];
- inTemplate = true;
- } else {
- if (match[0] === `${MARKER}/*${tagMatched}${MARKER}`) {
- index = match.index;
- inTemplate = false;
- }
- }
- }
- ngDevMode && assertEqual(inTemplate, false, `Tag mismatch: unable to find the end of the sub-template in the translation "${message}"`);
- res += message.slice(index);
- return res;
- }
- function getTranslationForTemplate(message, subTemplateIndex) {
- if (isRootTemplateMessage(subTemplateIndex)) {
- return removeInnerTemplateTranslation(message);
- } else {
- const start = message.indexOf(`:${subTemplateIndex}${MARKER}`) + 2 + subTemplateIndex.toString().length;
- const end = message.search(new RegExp(`${MARKER}\\/\\*\\d+:${subTemplateIndex}${MARKER}`));
- return removeInnerTemplateTranslation(message.substring(start, end));
- }
- }
- function icuStart(tView, lView, updateOpCodes, parentIdx, icuExpression, anchorIdx) {
- ngDevMode && assertDefined(icuExpression, "ICU expression must be defined");
- let bindingMask = 0;
- const tIcu = {
- type: icuExpression.type,
- currentCaseLViewIndex: allocExpando(tView, lView, 1, null),
- anchorIdx,
- cases: [],
- create: [],
- remove: [],
- update: []
- };
- addUpdateIcuSwitch(updateOpCodes, icuExpression, anchorIdx);
- setTIcu(tView, anchorIdx, tIcu);
- const values = icuExpression.values;
- for (let i = 0; i < values.length; i++) {
- const valueArr = values[i];
- const nestedIcus = [];
- for (let j = 0; j < valueArr.length; j++) {
- const value = valueArr[j];
- if (typeof value !== "string") {
- const icuIndex = nestedIcus.push(value) - 1;
- valueArr[j] = `<!--�${icuIndex}�-->`;
- }
- }
- bindingMask = parseIcuCase(tView, tIcu, lView, updateOpCodes, parentIdx, icuExpression.cases[i], valueArr.join(""), nestedIcus) | bindingMask;
- }
- if (bindingMask) {
- addUpdateIcuUpdate(updateOpCodes, bindingMask, anchorIdx);
- }
- }
- function parseICUBlock(pattern) {
- const cases = [];
- const values = [];
- let icuType = 1;
- let mainBinding = 0;
- pattern = pattern.replace(ICU_BLOCK_REGEXP, function(str, binding, type) {
- if (type === "select") {
- icuType = 0;
- } else {
- icuType = 1;
- }
- mainBinding = parseInt(binding.slice(1), 10);
- return "";
- });
- const parts = i18nParseTextIntoPartsAndICU(pattern);
- for (let pos = 0; pos < parts.length; ) {
- let key = parts[pos++].trim();
- if (icuType === 1) {
- key = key.replace(/\s*(?:=)?(\w+)\s*/, "$1");
- }
- if (key.length) {
- cases.push(key);
- }
- const blocks = i18nParseTextIntoPartsAndICU(parts[pos++]);
- if (cases.length > values.length) {
- values.push(blocks);
- }
- }
- return { type: icuType, mainBinding, cases, values };
- }
- function i18nParseTextIntoPartsAndICU(pattern) {
- if (!pattern) {
- return [];
- }
- let prevPos = 0;
- const braceStack = [];
- const results = [];
- const braces = /[{}]/g;
- braces.lastIndex = 0;
- let match;
- while (match = braces.exec(pattern)) {
- const pos = match.index;
- if (match[0] == "}") {
- braceStack.pop();
- if (braceStack.length == 0) {
- const block = pattern.substring(prevPos, pos);
- if (ICU_BLOCK_REGEXP.test(block)) {
- results.push(parseICUBlock(block));
- } else {
- results.push(block);
- }
- prevPos = pos + 1;
- }
- } else {
- if (braceStack.length == 0) {
- const substring2 = pattern.substring(prevPos, pos);
- results.push(substring2);
- prevPos = pos + 1;
- }
- braceStack.push("{");
- }
- }
- const substring = pattern.substring(prevPos);
- results.push(substring);
- return results;
- }
- function parseIcuCase(tView, tIcu, lView, updateOpCodes, parentIdx, caseName, unsafeCaseHtml, nestedIcus) {
- const create = [];
- const remove2 = [];
- const update = [];
- if (ngDevMode) {
- attachDebugGetter(create, icuCreateOpCodesToString);
- attachDebugGetter(remove2, i18nRemoveOpCodesToString);
- attachDebugGetter(update, i18nUpdateOpCodesToString);
- }
- tIcu.cases.push(caseName);
- tIcu.create.push(create);
- tIcu.remove.push(remove2);
- tIcu.update.push(update);
- const inertBodyHelper2 = getInertBodyHelper(getDocument());
- const inertBodyElement = inertBodyHelper2.getInertBodyElement(unsafeCaseHtml);
- ngDevMode && assertDefined(inertBodyElement, "Unable to generate inert body element");
- const inertRootNode = getTemplateContent(inertBodyElement) || inertBodyElement;
- if (inertRootNode) {
- return walkIcuTree(tView, tIcu, lView, updateOpCodes, create, remove2, update, inertRootNode, parentIdx, nestedIcus, 0);
- } else {
- return 0;
- }
- }
- function walkIcuTree(tView, tIcu, lView, sharedUpdateOpCodes, create, remove2, update, parentNode, parentIdx, nestedIcus, depth) {
- let bindingMask = 0;
- let currentNode = parentNode.firstChild;
- while (currentNode) {
- const newIndex = allocExpando(tView, lView, 1, null);
- switch (currentNode.nodeType) {
- case Node.ELEMENT_NODE:
- const element = currentNode;
- const tagName = element.tagName.toLowerCase();
- if (VALID_ELEMENTS.hasOwnProperty(tagName)) {
- addCreateNodeAndAppend(create, ELEMENT_MARKER, tagName, parentIdx, newIndex);
- tView.data[newIndex] = tagName;
- const elAttrs = element.attributes;
- for (let i = 0; i < elAttrs.length; i++) {
- const attr = elAttrs.item(i);
- const lowerAttrName = attr.name.toLowerCase();
- const hasBinding2 = !!attr.value.match(BINDING_REGEXP);
- if (hasBinding2) {
- if (VALID_ATTRS.hasOwnProperty(lowerAttrName)) {
- if (URI_ATTRS[lowerAttrName]) {
- generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, 0, _sanitizeUrl);
- } else {
- generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, 0, null);
- }
- } else {
- ngDevMode && console.warn(`WARNING: ignoring unsafe attribute value ${lowerAttrName} on element ${tagName} (see ${XSS_SECURITY_URL})`);
- }
- } else {
- addCreateAttribute(create, newIndex, attr);
- }
- }
- bindingMask = walkIcuTree(tView, tIcu, lView, sharedUpdateOpCodes, create, remove2, update, currentNode, newIndex, nestedIcus, depth + 1) | bindingMask;
- addRemoveNode(remove2, newIndex, depth);
- }
- break;
- case Node.TEXT_NODE:
- const value = currentNode.textContent || "";
- const hasBinding = value.match(BINDING_REGEXP);
- addCreateNodeAndAppend(create, null, hasBinding ? "" : value, parentIdx, newIndex);
- addRemoveNode(remove2, newIndex, depth);
- if (hasBinding) {
- bindingMask = generateBindingUpdateOpCodes(update, value, newIndex, null, 0, null) | bindingMask;
- }
- break;
- case Node.COMMENT_NODE:
- const isNestedIcu = NESTED_ICU.exec(currentNode.textContent || "");
- if (isNestedIcu) {
- const nestedIcuIndex = parseInt(isNestedIcu[1], 10);
- const icuExpression = nestedIcus[nestedIcuIndex];
- addCreateNodeAndAppend(create, ICU_MARKER, ngDevMode ? `nested ICU ${nestedIcuIndex}` : "", parentIdx, newIndex);
- icuStart(tView, lView, sharedUpdateOpCodes, parentIdx, icuExpression, newIndex);
- addRemoveNestedIcu(remove2, newIndex, depth);
- }
- break;
- }
- currentNode = currentNode.nextSibling;
- }
- return bindingMask;
- }
- function addRemoveNode(remove2, index, depth) {
- if (depth === 0) {
- remove2.push(index);
- }
- }
- function addRemoveNestedIcu(remove2, index, depth) {
- if (depth === 0) {
- remove2.push(~index);
- remove2.push(index);
- }
- }
- function addUpdateIcuSwitch(update, icuExpression, index) {
- update.push(
- toMaskBit(icuExpression.mainBinding),
- 2,
- -1 - icuExpression.mainBinding,
- index << 2 | 2
- /* I18nUpdateOpCode.IcuSwitch */
- );
- }
- function addUpdateIcuUpdate(update, bindingMask, index) {
- update.push(
- bindingMask,
- 1,
- index << 2 | 3
- /* I18nUpdateOpCode.IcuUpdate */
- );
- }
- function addCreateNodeAndAppend(create, marker, text, appendToParentIdx, createAtIdx) {
- if (marker !== null) {
- create.push(marker);
- }
- create.push(text, createAtIdx, icuCreateOpCode(0, appendToParentIdx, createAtIdx));
- }
- function addCreateAttribute(create, newIndex, attr) {
- create.push(newIndex << 1 | 1, attr.name, attr.value);
- }
- var ROOT_TEMPLATE_ID = 0;
- var PP_MULTI_VALUE_PLACEHOLDERS_REGEXP = /\[(�.+?�?)\]/;
- var PP_PLACEHOLDERS_REGEXP = /\[(�.+?�?)\]|(�\/?\*\d+:\d+�)/g;
- var PP_ICU_VARS_REGEXP = /({\s*)(VAR_(PLURAL|SELECT)(_\d+)?)(\s*,)/g;
- var PP_ICU_PLACEHOLDERS_REGEXP = /{([A-Z0-9_]+)}/g;
- var PP_ICUS_REGEXP = /�I18N_EXP_(ICU(_\d+)?)�/g;
- var PP_CLOSE_TEMPLATE_REGEXP = /\/\*/;
- var PP_TEMPLATE_ID_REGEXP = /\d+\:(\d+)/;
- function i18nPostprocess(message, replacements = {}) {
- let result = message;
- if (PP_MULTI_VALUE_PLACEHOLDERS_REGEXP.test(message)) {
- const matches = {};
- const templateIdsStack = [ROOT_TEMPLATE_ID];
- result = result.replace(PP_PLACEHOLDERS_REGEXP, (m, phs, tmpl) => {
- const content = phs || tmpl;
- const placeholders = matches[content] || [];
- if (!placeholders.length) {
- content.split("|").forEach((placeholder2) => {
- const match = placeholder2.match(PP_TEMPLATE_ID_REGEXP);
- const templateId2 = match ? parseInt(match[1], 10) : ROOT_TEMPLATE_ID;
- const isCloseTemplateTag2 = PP_CLOSE_TEMPLATE_REGEXP.test(placeholder2);
- placeholders.push([templateId2, isCloseTemplateTag2, placeholder2]);
- });
- matches[content] = placeholders;
- }
- if (!placeholders.length) {
- throw new Error(`i18n postprocess: unmatched placeholder - ${content}`);
- }
- const currentTemplateId = templateIdsStack[templateIdsStack.length - 1];
- let idx = 0;
- for (let i = 0; i < placeholders.length; i++) {
- if (placeholders[i][0] === currentTemplateId) {
- idx = i;
- break;
- }
- }
- const [templateId, isCloseTemplateTag, placeholder] = placeholders[idx];
- if (isCloseTemplateTag) {
- templateIdsStack.pop();
- } else if (currentTemplateId !== templateId) {
- templateIdsStack.push(templateId);
- }
- placeholders.splice(idx, 1);
- return placeholder;
- });
- }
- if (!Object.keys(replacements).length) {
- return result;
- }
- result = result.replace(PP_ICU_VARS_REGEXP, (match, start, key, _type, _idx, end) => {
- return replacements.hasOwnProperty(key) ? `${start}${replacements[key]}${end}` : match;
- });
- result = result.replace(PP_ICU_PLACEHOLDERS_REGEXP, (match, key) => {
- return replacements.hasOwnProperty(key) ? replacements[key] : match;
- });
- result = result.replace(PP_ICUS_REGEXP, (match, key) => {
- if (replacements.hasOwnProperty(key)) {
- const list = replacements[key];
- if (!list.length) {
- throw new Error(`i18n postprocess: unmatched ICU - ${match} with key: ${key}`);
- }
- return list.shift();
- }
- return match;
- });
- return result;
- }
- function ɵɵi18nStart(index, messageIndex, subTemplateIndex = -1) {
- const tView = getTView();
- const lView = getLView();
- const adjustedIndex = HEADER_OFFSET + index;
- ngDevMode && assertDefined(tView, `tView should be defined`);
- const message = getConstant(tView.consts, messageIndex);
- const parentTNode = getCurrentParentTNode();
- if (tView.firstCreatePass) {
- i18nStartFirstCreatePass(tView, parentTNode === null ? 0 : parentTNode.index, lView, adjustedIndex, message, subTemplateIndex);
- }
- if (tView.type === 2) {
- const componentLView = lView[DECLARATION_COMPONENT_VIEW];
- componentLView[FLAGS] |= 32;
- } else {
- lView[FLAGS] |= 32;
- }
- const tI18n = tView.data[adjustedIndex];
- const sameViewParentTNode = parentTNode === lView[T_HOST] ? null : parentTNode;
- const parentRNode = getClosestRElement(tView, sameViewParentTNode, lView);
- const insertInFrontOf = parentTNode && parentTNode.type & 8 ? lView[parentTNode.index] : null;
- applyCreateOpCodes(lView, tI18n.create, parentRNode, insertInFrontOf);
- setInI18nBlock(true);
- }
- function ɵɵi18nEnd() {
- setInI18nBlock(false);
- }
- function ɵɵi18n(index, messageIndex, subTemplateIndex) {
- ɵɵi18nStart(index, messageIndex, subTemplateIndex);
- ɵɵi18nEnd();
- }
- function ɵɵi18nAttributes(index, attrsIndex) {
- const tView = getTView();
- ngDevMode && assertDefined(tView, `tView should be defined`);
- const attrs = getConstant(tView.consts, attrsIndex);
- i18nAttributesFirstPass(tView, index + HEADER_OFFSET, attrs);
- }
- function ɵɵi18nExp(value) {
- const lView = getLView();
- setMaskBit(bindingUpdated(lView, nextBindingIndex(), value));
- return ɵɵi18nExp;
- }
- function ɵɵi18nApply(index) {
- applyI18n(getTView(), getLView(), index + HEADER_OFFSET);
- }
- function ɵɵi18nPostprocess(message, replacements = {}) {
- return i18nPostprocess(message, replacements);
- }
- function ɵɵlistener(eventName, listenerFn, useCapture, eventTargetResolver) {
- const lView = getLView();
- const tView = getTView();
- const tNode = getCurrentTNode();
- listenerInternal(tView, lView, lView[RENDERER], tNode, eventName, listenerFn, eventTargetResolver);
- return ɵɵlistener;
- }
- function ɵɵsyntheticHostListener(eventName, listenerFn) {
- const tNode = getCurrentTNode();
- const lView = getLView();
- const tView = getTView();
- const currentDef = getCurrentDirectiveDef(tView.data);
- const renderer = loadComponentRenderer(currentDef, tNode, lView);
- listenerInternal(tView, lView, renderer, tNode, eventName, listenerFn);
- return ɵɵsyntheticHostListener;
- }
- function findExistingListener(tView, lView, eventName, tNodeIdx) {
- 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] === tNodeIdx) {
- const lCleanup = lView[CLEANUP];
- const listenerIdxInLCleanup = tCleanup[i + 2];
- return lCleanup.length > listenerIdxInLCleanup ? lCleanup[listenerIdxInLCleanup] : null;
- }
- if (typeof cleanupEventName === "string") {
- i += 2;
- }
- }
- }
- return null;
- }
- function listenerInternal(tView, lView, renderer, tNode, eventName, listenerFn, eventTargetResolver) {
- const isTNodeDirectiveHost = isDirectiveHost(tNode);
- const firstCreatePass = tView.firstCreatePass;
- const tCleanup = firstCreatePass && getOrCreateTViewCleanup(tView);
- const context = lView[CONTEXT];
- const lCleanup = getOrCreateLViewCleanup(lView);
- ngDevMode && assertTNodeType(
- tNode,
- 3 | 12
- /* TNodeType.AnyContainer */
- );
- let processOutputs = true;
- if (tNode.type & 3 || eventTargetResolver) {
- const native = getNativeByTNode(tNode, lView);
- const target = eventTargetResolver ? eventTargetResolver(native) : native;
- const lCleanupIndex = lCleanup.length;
- const idxOrTargetGetter = eventTargetResolver ? (_lView) => eventTargetResolver(unwrapRNode(_lView[tNode.index])) : tNode.index;
- let existingListener = null;
- if (!eventTargetResolver && isTNodeDirectiveHost) {
- existingListener = findExistingListener(tView, lView, eventName, tNode.index);
- }
- if (existingListener !== null) {
- const lastListenerFn = existingListener.__ngLastListenerFn__ || existingListener;
- lastListenerFn.__ngNextListenerFn__ = listenerFn;
- existingListener.__ngLastListenerFn__ = listenerFn;
- processOutputs = false;
- } else {
- listenerFn = wrapListener(
- tNode,
- lView,
- context,
- listenerFn,
- false
- /** preventDefault */
- );
- const cleanupFn = renderer.listen(target, eventName, listenerFn);
- ngDevMode && ngDevMode.rendererAddEventListener++;
- lCleanup.push(listenerFn, cleanupFn);
- tCleanup && tCleanup.push(eventName, idxOrTargetGetter, lCleanupIndex, lCleanupIndex + 1);
- }
- } else {
- listenerFn = wrapListener(
- tNode,
- lView,
- context,
- listenerFn,
- false
- /** preventDefault */
- );
- }
- const outputs = tNode.outputs;
- let props;
- if (processOutputs && outputs !== null && (props = outputs[eventName])) {
- const propsLength = props.length;
- if (propsLength) {
- for (let i = 0; i < propsLength; i += 2) {
- const index = props[i];
- ngDevMode && assertIndexInRange(lView, index);
- const minifiedName = props[i + 1];
- const directiveInstance = lView[index];
- const output2 = directiveInstance[minifiedName];
- if (ngDevMode && !isOutputSubscribable(output2)) {
- throw new Error(`@Output ${minifiedName} not initialized in '${directiveInstance.constructor.name}'.`);
- }
- const subscriptionOrCallback = output2.subscribe(listenerFn);
- const idx = lCleanup.length;
- lCleanup.push(listenerFn, subscriptionOrCallback);
- if (tCleanup) {
- const cleanupIdx = typeof subscriptionOrCallback === "function" ? idx + 1 : -(idx + 1);
- tCleanup.push(eventName, tNode.index, idx, cleanupIdx);
- }
- }
- }
- }
- }
- function executeListenerWithErrorHandling(lView, context, listenerFn, e) {
- try {
- profiler(6, context, listenerFn);
- return listenerFn(e) !== false;
- } catch (error) {
- handleError(lView, error);
- return false;
- } finally {
- profiler(7, context, listenerFn);
- }
- }
- function wrapListener(tNode, lView, context, listenerFn, wrapWithPreventDefault) {
- return function wrapListenerIn_markDirtyAndPreventDefault(e) {
- if (e === Function) {
- return listenerFn;
- }
- const startView = tNode.componentOffset > -1 ? getComponentLViewByIndex(tNode.index, lView) : lView;
- markViewDirty(startView);
- let result = executeListenerWithErrorHandling(lView, context, listenerFn, e);
- let nextListenerFn = wrapListenerIn_markDirtyAndPreventDefault.__ngNextListenerFn__;
- while (nextListenerFn) {
- result = executeListenerWithErrorHandling(lView, context, nextListenerFn, e) && result;
- nextListenerFn = nextListenerFn.__ngNextListenerFn__;
- }
- if (wrapWithPreventDefault && result === false) {
- e.preventDefault();
- }
- return result;
- };
- }
- function isOutputSubscribable(value) {
- return value != null && typeof value.subscribe === "function";
- }
- function ɵɵnextContext(level = 1) {
- return nextContextImpl(level);
- }
- function matchingProjectionSlotIndex(tNode, projectionSlots) {
- let wildcardNgContentIndex = null;
- const ngProjectAsAttrVal = getProjectAsAttrValue(tNode);
- for (let i = 0; i < projectionSlots.length; i++) {
- const slotValue = projectionSlots[i];
- if (slotValue === "*") {
- wildcardNgContentIndex = i;
- continue;
- }
- if (ngProjectAsAttrVal === null ? isNodeMatchingSelectorList(
- tNode,
- slotValue,
- /* isProjectionMode */
- true
- ) : isSelectorInSelectorList(ngProjectAsAttrVal, slotValue)) {
- return i;
- }
- }
- return wildcardNgContentIndex;
- }
- function ɵɵprojectionDef(projectionSlots) {
- const componentNode = getLView()[DECLARATION_COMPONENT_VIEW][T_HOST];
- if (!componentNode.projection) {
- const numProjectionSlots = projectionSlots ? projectionSlots.length : 1;
- const projectionHeads = componentNode.projection = newArray(numProjectionSlots, null);
- const tails = projectionHeads.slice();
- let componentChild = componentNode.child;
- while (componentChild !== null) {
- const slotIndex = projectionSlots ? matchingProjectionSlotIndex(componentChild, projectionSlots) : 0;
- if (slotIndex !== null) {
- if (tails[slotIndex]) {
- tails[slotIndex].projectionNext = componentChild;
- } else {
- projectionHeads[slotIndex] = componentChild;
- }
- tails[slotIndex] = componentChild;
- }
- componentChild = componentChild.next;
- }
- }
- }
- function ɵɵprojection(nodeIndex, selectorIndex = 0, attrs) {
- const lView = getLView();
- const tView = getTView();
- const tProjectionNode = getOrCreateTNode(tView, HEADER_OFFSET + nodeIndex, 16, null, attrs || null);
- if (tProjectionNode.projection === null)
- tProjectionNode.projection = selectorIndex;
- setCurrentTNodeAsNotParent();
- const hydrationInfo = lView[HYDRATION];
- const isNodeCreationMode = !hydrationInfo || isInSkipHydrationBlock$1();
- if (isNodeCreationMode && (tProjectionNode.flags & 32) !== 32) {
- applyProjection(tView, lView, tProjectionNode);
- }
- }
- function ɵɵpropertyInterpolate(propName, v0, sanitizer) {
- ɵɵpropertyInterpolate1(propName, "", v0, "", sanitizer);
- return ɵɵpropertyInterpolate;
- }
- function ɵɵpropertyInterpolate1(propName, prefix, v0, suffix, sanitizer) {
- const lView = getLView();
- const interpolatedValue = interpolation1(lView, prefix, v0, suffix);
- if (interpolatedValue !== NO_CHANGE) {
- const tView = getTView();
- const tNode = getSelectedTNode();
- elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
- ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 1, prefix, suffix);
- }
- return ɵɵpropertyInterpolate1;
- }
- function ɵɵpropertyInterpolate2(propName, prefix, v0, i0, v1, suffix, sanitizer) {
- const lView = getLView();
- const interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix);
- if (interpolatedValue !== NO_CHANGE) {
- const tView = getTView();
- const tNode = getSelectedTNode();
- elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
- ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 2, prefix, i0, suffix);
- }
- return ɵɵpropertyInterpolate2;
- }
- function ɵɵpropertyInterpolate3(propName, prefix, v0, i0, v1, i1, v2, suffix, sanitizer) {
- const lView = getLView();
- const interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
- if (interpolatedValue !== NO_CHANGE) {
- const tView = getTView();
- const tNode = getSelectedTNode();
- elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
- ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 3, prefix, i0, i1, suffix);
- }
- return ɵɵpropertyInterpolate3;
- }
- function ɵɵpropertyInterpolate4(propName, prefix, v0, i0, v1, i1, v2, i2, v3, suffix, sanitizer) {
- const lView = getLView();
- const interpolatedValue = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix);
- if (interpolatedValue !== NO_CHANGE) {
- const tView = getTView();
- const tNode = getSelectedTNode();
- elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
- ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 4, prefix, i0, i1, i2, suffix);
- }
- return ɵɵpropertyInterpolate4;
- }
- function ɵɵpropertyInterpolate5(propName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix, sanitizer) {
- const lView = getLView();
- const interpolatedValue = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix);
- if (interpolatedValue !== NO_CHANGE) {
- const tView = getTView();
- const tNode = getSelectedTNode();
- elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
- ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 5, prefix, i0, i1, i2, i3, suffix);
- }
- return ɵɵpropertyInterpolate5;
- }
- function ɵɵpropertyInterpolate6(propName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix, sanitizer) {
- const lView = getLView();
- const interpolatedValue = interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix);
- if (interpolatedValue !== NO_CHANGE) {
- const tView = getTView();
- const tNode = getSelectedTNode();
- elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
- ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 6, prefix, i0, i1, i2, i3, i4, suffix);
- }
- return ɵɵpropertyInterpolate6;
- }
- function ɵɵpropertyInterpolate7(propName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix, sanitizer) {
- const lView = getLView();
- const interpolatedValue = interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix);
- if (interpolatedValue !== NO_CHANGE) {
- const tView = getTView();
- const tNode = getSelectedTNode();
- elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
- ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 7, prefix, i0, i1, i2, i3, i4, i5, suffix);
- }
- return ɵɵpropertyInterpolate7;
- }
- function ɵɵpropertyInterpolate8(propName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix, sanitizer) {
- const lView = getLView();
- const interpolatedValue = interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix);
- if (interpolatedValue !== NO_CHANGE) {
- const tView = getTView();
- const tNode = getSelectedTNode();
- elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
- ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - 8, prefix, i0, i1, i2, i3, i4, i5, i6, suffix);
- }
- return ɵɵpropertyInterpolate8;
- }
- function ɵɵpropertyInterpolateV(propName, values, sanitizer) {
- const lView = getLView();
- const interpolatedValue = interpolationV(lView, values);
- if (interpolatedValue !== NO_CHANGE) {
- const tView = getTView();
- const tNode = getSelectedTNode();
- elementPropertyInternal(tView, tNode, lView, propName, interpolatedValue, lView[RENDERER], sanitizer, false);
- if (ngDevMode) {
- const interpolationInBetween = [values[0]];
- for (let i = 2; i < values.length; i += 2) {
- interpolationInBetween.push(values[i]);
- }
- storePropertyBindingMetadata(tView.data, tNode, propName, getBindingIndex() - interpolationInBetween.length + 1, ...interpolationInBetween);
- }
- }
- return ɵɵpropertyInterpolateV;
- }
- function ɵɵcontentQuery(directiveIndex, predicate, flags, read) {
- createContentQuery(directiveIndex, predicate, flags, read);
- }
- function ɵɵviewQuery(predicate, flags, read) {
- createViewQuery(predicate, flags, read);
- }
- function ɵɵqueryRefresh(queryList) {
- const lView = getLView();
- const tView = getTView();
- const queryIndex = getCurrentQueryIndex();
- setCurrentQueryIndex(queryIndex + 1);
- const tQuery = getTQuery(tView, queryIndex);
- if (queryList.dirty && isCreationMode(lView) === ((tQuery.metadata.flags & 2) === 2)) {
- if (tQuery.matches === null) {
- queryList.reset([]);
- } else {
- const result = getQueryResults(lView, queryIndex);
- queryList.reset(result, unwrapElementRef);
- queryList.notifyOnChanges();
- }
- return true;
- }
- return false;
- }
- function ɵɵloadQuery() {
- return loadQueryInternal(getLView(), getCurrentQueryIndex());
- }
- function ɵɵcontentQuerySignal(directiveIndex, target, predicate, flags, read) {
- bindQueryToSignal(target, createContentQuery(directiveIndex, predicate, flags, read));
- }
- function ɵɵviewQuerySignal(target, predicate, flags, read) {
- bindQueryToSignal(target, createViewQuery(predicate, flags, read));
- }
- function ɵɵqueryAdvance(indexOffset = 1) {
- setCurrentQueryIndex(getCurrentQueryIndex() + indexOffset);
- }
- function store(tView, lView, index, value) {
- if (index >= tView.data.length) {
- tView.data[index] = null;
- tView.blueprint[index] = null;
- }
- lView[index] = value;
- }
- function ɵɵreference(index) {
- const contextLView = getContextLView();
- return load(contextLView, HEADER_OFFSET + index);
- }
- function ɵɵstyleMapInterpolate1(prefix, v0, suffix) {
- const lView = getLView();
- const interpolatedValue = interpolation1(lView, prefix, v0, suffix);
- ɵɵstyleMap(interpolatedValue);
- }
- function ɵɵstyleMapInterpolate2(prefix, v0, i0, v1, suffix) {
- const lView = getLView();
- const interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix);
- ɵɵstyleMap(interpolatedValue);
- }
- function ɵɵstyleMapInterpolate3(prefix, v0, i0, v1, i1, v2, suffix) {
- const lView = getLView();
- const interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
- ɵɵstyleMap(interpolatedValue);
- }
- function ɵɵstyleMapInterpolate4(prefix, v0, i0, v1, i1, v2, i2, v3, suffix) {
- const lView = getLView();
- const interpolatedValue = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix);
- ɵɵstyleMap(interpolatedValue);
- }
- function ɵɵstyleMapInterpolate5(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix) {
- const lView = getLView();
- const interpolatedValue = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix);
- ɵɵstyleMap(interpolatedValue);
- }
- function ɵɵstyleMapInterpolate6(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix) {
- const lView = getLView();
- const interpolatedValue = interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix);
- ɵɵstyleMap(interpolatedValue);
- }
- function ɵɵstyleMapInterpolate7(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) {
- const lView = getLView();
- const interpolatedValue = interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix);
- ɵɵstyleMap(interpolatedValue);
- }
- function ɵɵstyleMapInterpolate8(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) {
- const lView = getLView();
- const interpolatedValue = interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix);
- ɵɵstyleMap(interpolatedValue);
- }
- function ɵɵstyleMapInterpolateV(values) {
- const lView = getLView();
- const interpolatedValue = interpolationV(lView, values);
- ɵɵstyleMap(interpolatedValue);
- }
- function ɵɵstylePropInterpolate1(prop, prefix, v0, suffix, valueSuffix) {
- const lView = getLView();
- const interpolatedValue = interpolation1(lView, prefix, v0, suffix);
- checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
- return ɵɵstylePropInterpolate1;
- }
- function ɵɵstylePropInterpolate2(prop, prefix, v0, i0, v1, suffix, valueSuffix) {
- const lView = getLView();
- const interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix);
- checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
- return ɵɵstylePropInterpolate2;
- }
- function ɵɵstylePropInterpolate3(prop, prefix, v0, i0, v1, i1, v2, suffix, valueSuffix) {
- const lView = getLView();
- const interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
- checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
- return ɵɵstylePropInterpolate3;
- }
- function ɵɵstylePropInterpolate4(prop, prefix, v0, i0, v1, i1, v2, i2, v3, suffix, valueSuffix) {
- const lView = getLView();
- const interpolatedValue = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix);
- checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
- return ɵɵstylePropInterpolate4;
- }
- function ɵɵstylePropInterpolate5(prop, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix, valueSuffix) {
- const lView = getLView();
- const interpolatedValue = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix);
- checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
- return ɵɵstylePropInterpolate5;
- }
- function ɵɵstylePropInterpolate6(prop, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix, valueSuffix) {
- const lView = getLView();
- const interpolatedValue = interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix);
- checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
- return ɵɵstylePropInterpolate6;
- }
- function ɵɵstylePropInterpolate7(prop, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix, valueSuffix) {
- const lView = getLView();
- const interpolatedValue = interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix);
- checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
- return ɵɵstylePropInterpolate7;
- }
- function ɵɵstylePropInterpolate8(prop, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix, valueSuffix) {
- const lView = getLView();
- const interpolatedValue = interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix);
- checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
- return ɵɵstylePropInterpolate8;
- }
- function ɵɵstylePropInterpolateV(prop, values, valueSuffix) {
- const lView = getLView();
- const interpolatedValue = interpolationV(lView, values);
- checkStylingProperty(prop, interpolatedValue, valueSuffix, false);
- return ɵɵstylePropInterpolateV;
- }
- function ɵɵtext(index, value = "") {
- const lView = getLView();
- const tView = getTView();
- const adjustedIndex = index + HEADER_OFFSET;
- ngDevMode && assertEqual(getBindingIndex(), tView.bindingStartIndex, "text nodes should be created before any bindings");
- ngDevMode && assertIndexInRange(lView, adjustedIndex);
- const tNode = tView.firstCreatePass ? getOrCreateTNode(tView, adjustedIndex, 1, value, null) : tView.data[adjustedIndex];
- const textNative = _locateOrCreateTextNode(tView, lView, tNode, value, index);
- lView[adjustedIndex] = textNative;
- if (wasLastNodeCreated()) {
- appendChild(tView, lView, textNative, tNode);
- }
- setCurrentTNode(tNode, false);
- }
- var _locateOrCreateTextNode = (tView, lView, tNode, value, index) => {
- lastNodeWasCreated(true);
- return createTextNode(lView[RENDERER], value);
- };
- function locateOrCreateTextNodeImpl(tView, lView, tNode, value, index) {
- const hydrationInfo = lView[HYDRATION];
- const isNodeCreationMode = !hydrationInfo || isInSkipHydrationBlock$1() || isDisconnectedNode$1(hydrationInfo, index);
- lastNodeWasCreated(isNodeCreationMode);
- if (isNodeCreationMode) {
- return createTextNode(lView[RENDERER], value);
- }
- const textNative = locateNextRNode(hydrationInfo, tView, lView, tNode);
- ngDevMode && validateMatchingNode(textNative, Node.TEXT_NODE, null, lView, tNode);
- ngDevMode && markRNodeAsClaimedByHydration(textNative);
- return textNative;
- }
- function enableLocateOrCreateTextNodeImpl() {
- _locateOrCreateTextNode = locateOrCreateTextNodeImpl;
- }
- function ɵɵtextInterpolate(v0) {
- ɵɵtextInterpolate1("", v0, "");
- return ɵɵtextInterpolate;
- }
- function ɵɵtextInterpolate1(prefix, v0, suffix) {
- const lView = getLView();
- const interpolated = interpolation1(lView, prefix, v0, suffix);
- if (interpolated !== NO_CHANGE) {
- textBindingInternal(lView, getSelectedIndex(), interpolated);
- }
- return ɵɵtextInterpolate1;
- }
- function ɵɵtextInterpolate2(prefix, v0, i0, v1, suffix) {
- const lView = getLView();
- const interpolated = interpolation2(lView, prefix, v0, i0, v1, suffix);
- if (interpolated !== NO_CHANGE) {
- textBindingInternal(lView, getSelectedIndex(), interpolated);
- }
- return ɵɵtextInterpolate2;
- }
- function ɵɵtextInterpolate3(prefix, v0, i0, v1, i1, v2, suffix) {
- const lView = getLView();
- const interpolated = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix);
- if (interpolated !== NO_CHANGE) {
- textBindingInternal(lView, getSelectedIndex(), interpolated);
- }
- return ɵɵtextInterpolate3;
- }
- function ɵɵtextInterpolate4(prefix, v0, i0, v1, i1, v2, i2, v3, suffix) {
- const lView = getLView();
- const interpolated = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix);
- if (interpolated !== NO_CHANGE) {
- textBindingInternal(lView, getSelectedIndex(), interpolated);
- }
- return ɵɵtextInterpolate4;
- }
- function ɵɵtextInterpolate5(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix) {
- const lView = getLView();
- const interpolated = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix);
- if (interpolated !== NO_CHANGE) {
- textBindingInternal(lView, getSelectedIndex(), interpolated);
- }
- return ɵɵtextInterpolate5;
- }
- function ɵɵtextInterpolate6(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix) {
- const lView = getLView();
- const interpolated = interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix);
- if (interpolated !== NO_CHANGE) {
- textBindingInternal(lView, getSelectedIndex(), interpolated);
- }
- return ɵɵtextInterpolate6;
- }
- function ɵɵtextInterpolate7(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) {
- const lView = getLView();
- const interpolated = interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix);
- if (interpolated !== NO_CHANGE) {
- textBindingInternal(lView, getSelectedIndex(), interpolated);
- }
- return ɵɵtextInterpolate7;
- }
- function ɵɵtextInterpolate8(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) {
- const lView = getLView();
- const interpolated = interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix);
- if (interpolated !== NO_CHANGE) {
- textBindingInternal(lView, getSelectedIndex(), interpolated);
- }
- return ɵɵtextInterpolate8;
- }
- function ɵɵtextInterpolateV(values) {
- const lView = getLView();
- const interpolated = interpolationV(lView, values);
- if (interpolated !== NO_CHANGE) {
- textBindingInternal(lView, getSelectedIndex(), interpolated);
- }
- return ɵɵtextInterpolateV;
- }
- function ɵɵtwoWayProperty(propName, value, sanitizer) {
- if (isWritableSignal(value)) {
- value = value();
- }
- const lView = getLView();
- const bindingIndex = nextBindingIndex();
- if (bindingUpdated(lView, bindingIndex, value)) {
- const tView = getTView();
- const tNode = getSelectedTNode();
- elementPropertyInternal(tView, tNode, lView, propName, value, lView[RENDERER], sanitizer, false);
- ngDevMode && storePropertyBindingMetadata(tView.data, tNode, propName, bindingIndex);
- }
- return ɵɵtwoWayProperty;
- }
- function ɵɵtwoWayBindingSet(target, value) {
- const canWrite = isWritableSignal(target);
- canWrite && target.set(value);
- return canWrite;
- }
- function ɵɵtwoWayListener(eventName, listenerFn) {
- const lView = getLView();
- const tView = getTView();
- const tNode = getCurrentTNode();
- listenerInternal(tView, lView, lView[RENDERER], tNode, eventName, listenerFn);
- return ɵɵtwoWayListener;
- }
- function providersResolver(def, providers, viewProviders) {
- const tView = getTView();
- if (tView.firstCreatePass) {
- const isComponent2 = isComponentDef(def);
- resolveProvider(viewProviders, tView.data, tView.blueprint, isComponent2, true);
- resolveProvider(providers, tView.data, tView.blueprint, isComponent2, false);
- }
- }
- function resolveProvider(provider, tInjectables, lInjectablesBlueprint, isComponent2, isViewProvider) {
- provider = resolveForwardRef(provider);
- if (Array.isArray(provider)) {
- for (let i = 0; i < provider.length; i++) {
- resolveProvider(provider[i], tInjectables, lInjectablesBlueprint, isComponent2, isViewProvider);
- }
- } else {
- const tView = getTView();
- const lView = getLView();
- const tNode = getCurrentTNode();
- let token = isTypeProvider(provider) ? provider : resolveForwardRef(provider.provide);
- const providerFactory = providerToFactory(provider);
- if (ngDevMode) {
- const injector = new NodeInjector(tNode, lView);
- runInInjectorProfilerContext(injector, token, () => {
- emitProviderConfiguredEvent(provider, isViewProvider);
- });
- }
- const beginIndex = tNode.providerIndexes & 1048575;
- const endIndex = tNode.directiveStart;
- const cptViewProvidersCount = tNode.providerIndexes >> 20;
- if (isTypeProvider(provider) || !provider.multi) {
- const factory = new NodeInjectorFactory(providerFactory, isViewProvider, ɵɵdirectiveInject);
- const existingFactoryIndex = indexOf(token, tInjectables, isViewProvider ? beginIndex : beginIndex + cptViewProvidersCount, endIndex);
- if (existingFactoryIndex === -1) {
- diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, lView), tView, token);
- registerDestroyHooksIfSupported(tView, provider, tInjectables.length);
- tInjectables.push(token);
- tNode.directiveStart++;
- tNode.directiveEnd++;
- if (isViewProvider) {
- tNode.providerIndexes += 1048576;
- }
- lInjectablesBlueprint.push(factory);
- lView.push(factory);
- } else {
- lInjectablesBlueprint[existingFactoryIndex] = factory;
- lView[existingFactoryIndex] = factory;
- }
- } else {
- const existingProvidersFactoryIndex = indexOf(token, tInjectables, beginIndex + cptViewProvidersCount, endIndex);
- const existingViewProvidersFactoryIndex = indexOf(token, tInjectables, beginIndex, beginIndex + cptViewProvidersCount);
- const doesProvidersFactoryExist = existingProvidersFactoryIndex >= 0 && lInjectablesBlueprint[existingProvidersFactoryIndex];
- const doesViewProvidersFactoryExist = existingViewProvidersFactoryIndex >= 0 && lInjectablesBlueprint[existingViewProvidersFactoryIndex];
- if (isViewProvider && !doesViewProvidersFactoryExist || !isViewProvider && !doesProvidersFactoryExist) {
- diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, lView), tView, token);
- const factory = multiFactory(isViewProvider ? multiViewProvidersFactoryResolver : multiProvidersFactoryResolver, lInjectablesBlueprint.length, isViewProvider, isComponent2, providerFactory);
- if (!isViewProvider && doesViewProvidersFactoryExist) {
- lInjectablesBlueprint[existingViewProvidersFactoryIndex].providerFactory = factory;
- }
- registerDestroyHooksIfSupported(tView, provider, tInjectables.length, 0);
- tInjectables.push(token);
- tNode.directiveStart++;
- tNode.directiveEnd++;
- if (isViewProvider) {
- tNode.providerIndexes += 1048576;
- }
- lInjectablesBlueprint.push(factory);
- lView.push(factory);
- } else {
- const indexInFactory = multiFactoryAdd(lInjectablesBlueprint[isViewProvider ? existingViewProvidersFactoryIndex : existingProvidersFactoryIndex], providerFactory, !isViewProvider && isComponent2);
- registerDestroyHooksIfSupported(tView, provider, existingProvidersFactoryIndex > -1 ? existingProvidersFactoryIndex : existingViewProvidersFactoryIndex, indexInFactory);
- }
- if (!isViewProvider && isComponent2 && doesViewProvidersFactoryExist) {
- lInjectablesBlueprint[existingViewProvidersFactoryIndex].componentProviders++;
- }
- }
- }
- }
- function registerDestroyHooksIfSupported(tView, provider, contextIndex, indexInFactory) {
- const providerIsTypeProvider = isTypeProvider(provider);
- const providerIsClassProvider = isClassProvider(provider);
- if (providerIsTypeProvider || providerIsClassProvider) {
- const classToken = providerIsClassProvider ? resolveForwardRef(provider.useClass) : provider;
- const prototype = classToken.prototype;
- const ngOnDestroy = prototype.ngOnDestroy;
- if (ngOnDestroy) {
- const hooks = tView.destroyHooks || (tView.destroyHooks = []);
- if (!providerIsTypeProvider && provider.multi) {
- ngDevMode && assertDefined(indexInFactory, "indexInFactory when registering multi factory destroy hook");
- const existingCallbacksIndex = hooks.indexOf(contextIndex);
- if (existingCallbacksIndex === -1) {
- hooks.push(contextIndex, [indexInFactory, ngOnDestroy]);
- } else {
- hooks[existingCallbacksIndex + 1].push(indexInFactory, ngOnDestroy);
- }
- } else {
- hooks.push(contextIndex, ngOnDestroy);
- }
- }
- }
- }
- function multiFactoryAdd(multiFactory2, factory, isComponentProvider) {
- if (isComponentProvider) {
- multiFactory2.componentProviders++;
- }
- return multiFactory2.multi.push(factory) - 1;
- }
- function indexOf(item, arr, begin, end) {
- for (let i = begin; i < end; i++) {
- if (arr[i] === item)
- return i;
- }
- return -1;
- }
- function multiProvidersFactoryResolver(_, tData, lData, tNode) {
- return multiResolve(this.multi, []);
- }
- function multiViewProvidersFactoryResolver(_, tData, lView, tNode) {
- const factories = this.multi;
- let result;
- if (this.providerFactory) {
- const componentCount = this.providerFactory.componentProviders;
- const multiProviders = getNodeInjectable(lView, lView[TVIEW], this.providerFactory.index, tNode);
- result = multiProviders.slice(0, componentCount);
- multiResolve(factories, result);
- for (let i = componentCount; i < multiProviders.length; i++) {
- result.push(multiProviders[i]);
- }
- } else {
- result = [];
- multiResolve(factories, result);
- }
- return result;
- }
- function multiResolve(factories, result) {
- for (let i = 0; i < factories.length; i++) {
- const factory = factories[i];
- result.push(factory());
- }
- return result;
- }
- function multiFactory(factoryFn, index, isViewProvider, isComponent2, f) {
- const factory = new NodeInjectorFactory(factoryFn, isViewProvider, ɵɵdirectiveInject);
- factory.multi = [];
- factory.index = index;
- factory.componentProviders = 0;
- multiFactoryAdd(factory, f, isComponent2 && !isViewProvider);
- return factory;
- }
- function ɵɵProvidersFeature(providers, viewProviders = []) {
- return (definition) => {
- definition.providersResolver = (def, processProvidersFn) => {
- return providersResolver(
- def,
- //
- processProvidersFn ? processProvidersFn(providers) : providers,
- //
- viewProviders
- );
- };
- };
- }
- var _StandaloneService = class _StandaloneService {
- constructor(_injector) {
- this._injector = _injector;
- this.cachedInjectors = /* @__PURE__ */ new Map();
- }
- getOrCreateStandaloneInjector(componentDef) {
- if (!componentDef.standalone) {
- return null;
- }
- if (!this.cachedInjectors.has(componentDef)) {
- const providers = internalImportProvidersFrom(false, componentDef.type);
- const standaloneInjector = providers.length > 0 ? createEnvironmentInjector([providers], this._injector, `Standalone[${componentDef.type.name}]`) : null;
- this.cachedInjectors.set(componentDef, standaloneInjector);
- }
- return this.cachedInjectors.get(componentDef);
- }
- ngOnDestroy() {
- try {
- for (const injector of this.cachedInjectors.values()) {
- if (injector !== null) {
- injector.destroy();
- }
- }
- } finally {
- this.cachedInjectors.clear();
- }
- }
- };
- _StandaloneService.ɵprov = ɵɵdefineInjectable({
- token: _StandaloneService,
- providedIn: "environment",
- factory: () => new _StandaloneService(ɵɵinject(EnvironmentInjector))
- });
- var StandaloneService = _StandaloneService;
- function ɵɵStandaloneFeature(definition) {
- performanceMarkFeature("NgStandalone");
- definition.getStandaloneInjector = (parentInjector) => {
- return parentInjector.get(StandaloneService).getOrCreateStandaloneInjector(definition);
- };
- }
- function ɵɵsetComponentScope(type, directives, pipes) {
- const def = type.ɵcmp;
- def.directiveDefs = extractDefListOrFactory(
- directives,
- /* pipeDef */
- false
- );
- def.pipeDefs = extractDefListOrFactory(
- pipes,
- /* pipeDef */
- true
- );
- }
- function ɵɵsetNgModuleScope(type, scope) {
- return noSideEffects(() => {
- const ngModuleDef = getNgModuleDef(type, true);
- ngModuleDef.declarations = convertToTypeArray(scope.declarations || EMPTY_ARRAY);
- ngModuleDef.imports = convertToTypeArray(scope.imports || EMPTY_ARRAY);
- ngModuleDef.exports = convertToTypeArray(scope.exports || EMPTY_ARRAY);
- if (scope.bootstrap) {
- ngModuleDef.bootstrap = convertToTypeArray(scope.bootstrap);
- }
- depsTracker.registerNgModule(type, scope);
- });
- }
- function convertToTypeArray(values) {
- if (typeof values === "function") {
- return values;
- }
- const flattenValues = flatten(values);
- if (flattenValues.some(isForwardRef)) {
- return () => flattenValues.map(resolveForwardRef).map(maybeUnwrapModuleWithProviders);
- } else {
- return flattenValues.map(maybeUnwrapModuleWithProviders);
- }
- }
- function maybeUnwrapModuleWithProviders(value) {
- return isModuleWithProviders(value) ? value.ngModule : value;
- }
- 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 lView[FLAGS] & 512 ? 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];
- }
- 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.findHostDirectiveDefs !== 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)) {
- continue;
- }
- const value = inputs[key];
- if (value === void 0) {
- continue;
- }
- let minifiedName;
- if (Array.isArray(value)) {
- minifiedName = value[0];
- } else {
- minifiedName = value;
- }
- res[key] = minifiedName;
- }
- return res;
- }
- function ɵɵpureFunction0(slotOffset, pureFn, thisArg) {
- const bindingIndex = getBindingRoot() + slotOffset;
- const lView = getLView();
- return lView[bindingIndex] === NO_CHANGE ? updateBinding(lView, bindingIndex, thisArg ? pureFn.call(thisArg) : pureFn()) : getBinding(lView, bindingIndex);
- }
- function ɵɵpureFunction1(slotOffset, pureFn, exp, thisArg) {
- return pureFunction1Internal(getLView(), getBindingRoot(), slotOffset, pureFn, exp, thisArg);
- }
- function ɵɵpureFunction2(slotOffset, pureFn, exp1, exp2, thisArg) {
- return pureFunction2Internal(getLView(), getBindingRoot(), slotOffset, pureFn, exp1, exp2, thisArg);
- }
- function ɵɵpureFunction3(slotOffset, pureFn, exp1, exp2, exp3, thisArg) {
- return pureFunction3Internal(getLView(), getBindingRoot(), slotOffset, pureFn, exp1, exp2, exp3, thisArg);
- }
- function ɵɵpureFunction4(slotOffset, pureFn, exp1, exp2, exp3, exp4, thisArg) {
- return pureFunction4Internal(getLView(), getBindingRoot(), slotOffset, pureFn, exp1, exp2, exp3, exp4, thisArg);
- }
- function ɵɵpureFunction5(slotOffset, pureFn, exp1, exp2, exp3, exp4, exp5, thisArg) {
- const bindingIndex = getBindingRoot() + slotOffset;
- const lView = getLView();
- const different = bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4);
- return bindingUpdated(lView, bindingIndex + 4, exp5) || different ? updateBinding(lView, bindingIndex + 5, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4, exp5) : pureFn(exp1, exp2, exp3, exp4, exp5)) : getBinding(lView, bindingIndex + 5);
- }
- function ɵɵpureFunction6(slotOffset, pureFn, exp1, exp2, exp3, exp4, exp5, exp6, thisArg) {
- const bindingIndex = getBindingRoot() + slotOffset;
- const lView = getLView();
- const different = bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4);
- return bindingUpdated2(lView, bindingIndex + 4, exp5, exp6) || different ? updateBinding(lView, bindingIndex + 6, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4, exp5, exp6) : pureFn(exp1, exp2, exp3, exp4, exp5, exp6)) : getBinding(lView, bindingIndex + 6);
- }
- function ɵɵpureFunction7(slotOffset, pureFn, exp1, exp2, exp3, exp4, exp5, exp6, exp7, thisArg) {
- const bindingIndex = getBindingRoot() + slotOffset;
- const lView = getLView();
- let different = bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4);
- return bindingUpdated3(lView, bindingIndex + 4, exp5, exp6, exp7) || different ? updateBinding(lView, bindingIndex + 7, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4, exp5, exp6, exp7) : pureFn(exp1, exp2, exp3, exp4, exp5, exp6, exp7)) : getBinding(lView, bindingIndex + 7);
- }
- function ɵɵpureFunction8(slotOffset, pureFn, exp1, exp2, exp3, exp4, exp5, exp6, exp7, exp8, thisArg) {
- const bindingIndex = getBindingRoot() + slotOffset;
- const lView = getLView();
- const different = bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4);
- return bindingUpdated4(lView, bindingIndex + 4, exp5, exp6, exp7, exp8) || different ? updateBinding(lView, bindingIndex + 8, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4, exp5, exp6, exp7, exp8) : pureFn(exp1, exp2, exp3, exp4, exp5, exp6, exp7, exp8)) : getBinding(lView, bindingIndex + 8);
- }
- function ɵɵpureFunctionV(slotOffset, pureFn, exps, thisArg) {
- return pureFunctionVInternal(getLView(), getBindingRoot(), slotOffset, pureFn, exps, thisArg);
- }
- function getPureFunctionReturnValue(lView, returnValueIndex) {
- ngDevMode && assertIndexInRange(lView, returnValueIndex);
- const lastReturnValue = lView[returnValueIndex];
- return lastReturnValue === NO_CHANGE ? void 0 : lastReturnValue;
- }
- function pureFunction1Internal(lView, bindingRoot, slotOffset, pureFn, exp, thisArg) {
- const bindingIndex = bindingRoot + slotOffset;
- return bindingUpdated(lView, bindingIndex, exp) ? updateBinding(lView, bindingIndex + 1, thisArg ? pureFn.call(thisArg, exp) : pureFn(exp)) : getPureFunctionReturnValue(lView, bindingIndex + 1);
- }
- function pureFunction2Internal(lView, bindingRoot, slotOffset, pureFn, exp1, exp2, thisArg) {
- const bindingIndex = bindingRoot + slotOffset;
- return bindingUpdated2(lView, bindingIndex, exp1, exp2) ? updateBinding(lView, bindingIndex + 2, thisArg ? pureFn.call(thisArg, exp1, exp2) : pureFn(exp1, exp2)) : getPureFunctionReturnValue(lView, bindingIndex + 2);
- }
- function pureFunction3Internal(lView, bindingRoot, slotOffset, pureFn, exp1, exp2, exp3, thisArg) {
- const bindingIndex = bindingRoot + slotOffset;
- return bindingUpdated3(lView, bindingIndex, exp1, exp2, exp3) ? updateBinding(lView, bindingIndex + 3, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3) : pureFn(exp1, exp2, exp3)) : getPureFunctionReturnValue(lView, bindingIndex + 3);
- }
- function pureFunction4Internal(lView, bindingRoot, slotOffset, pureFn, exp1, exp2, exp3, exp4, thisArg) {
- const bindingIndex = bindingRoot + slotOffset;
- return bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4) ? updateBinding(lView, bindingIndex + 4, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4) : pureFn(exp1, exp2, exp3, exp4)) : getPureFunctionReturnValue(lView, bindingIndex + 4);
- }
- function pureFunctionVInternal(lView, bindingRoot, slotOffset, pureFn, exps, thisArg) {
- let bindingIndex = bindingRoot + slotOffset;
- let different = false;
- for (let i = 0; i < exps.length; i++) {
- bindingUpdated(lView, bindingIndex++, exps[i]) && (different = true);
- }
- return different ? updateBinding(lView, bindingIndex, pureFn.apply(thisArg, exps)) : getPureFunctionReturnValue(lView, bindingIndex);
- }
- function ɵɵpipe(index, pipeName) {
- const tView = getTView();
- let pipeDef;
- const adjustedIndex = index + HEADER_OFFSET;
- if (tView.firstCreatePass) {
- pipeDef = getPipeDef(pipeName, tView.pipeRegistry);
- tView.data[adjustedIndex] = pipeDef;
- if (pipeDef.onDestroy) {
- (tView.destroyHooks ??= []).push(adjustedIndex, pipeDef.onDestroy);
- }
- } else {
- pipeDef = tView.data[adjustedIndex];
- }
- const pipeFactory = pipeDef.factory || (pipeDef.factory = getFactoryDef(pipeDef.type, true));
- let previousInjectorProfilerContext;
- if (ngDevMode) {
- previousInjectorProfilerContext = setInjectorProfilerContext({
- injector: new NodeInjector(getCurrentTNode(), getLView()),
- token: pipeDef.type
- });
- }
- const previousInjectImplementation = setInjectImplementation(ɵɵdirectiveInject);
- try {
- const previousIncludeViewProviders = setIncludeViewProviders(false);
- const pipeInstance = pipeFactory();
- setIncludeViewProviders(previousIncludeViewProviders);
- store(tView, getLView(), adjustedIndex, pipeInstance);
- return pipeInstance;
- } finally {
- setInjectImplementation(previousInjectImplementation);
- ngDevMode && setInjectorProfilerContext(previousInjectorProfilerContext);
- }
- }
- function getPipeDef(name, registry) {
- if (registry) {
- if (ngDevMode) {
- const pipes = registry.filter((pipe) => pipe.name === name);
- if (pipes.length > 1) {
- console.warn(formatRuntimeError(313, getMultipleMatchingPipesMessage(name)));
- }
- }
- for (let i = registry.length - 1; i >= 0; i--) {
- const pipeDef = registry[i];
- if (name === pipeDef.name) {
- return pipeDef;
- }
- }
- }
- if (ngDevMode) {
- throw new RuntimeError(-302, getPipeNotFoundErrorMessage(name));
- }
- return;
- }
- function getMultipleMatchingPipesMessage(name) {
- const lView = getLView();
- const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
- const context = declarationLView[CONTEXT];
- const hostIsStandalone = isHostComponentStandalone(lView);
- const componentInfoMessage = context ? ` in the '${context.constructor.name}' component` : "";
- const verifyMessage = `check ${hostIsStandalone ? "'@Component.imports' of this component" : "the imports of this module"}`;
- const errorMessage = `Multiple pipes match the name \`${name}\`${componentInfoMessage}. ${verifyMessage}`;
- return errorMessage;
- }
- function getPipeNotFoundErrorMessage(name) {
- const lView = getLView();
- const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
- const context = declarationLView[CONTEXT];
- const hostIsStandalone = isHostComponentStandalone(lView);
- const componentInfoMessage = context ? ` in the '${context.constructor.name}' component` : "";
- const verifyMessage = `Verify that it is ${hostIsStandalone ? "included in the '@Component.imports' of this component" : "declared or imported in this module"}`;
- const errorMessage = `The pipe '${name}' could not be found${componentInfoMessage}. ${verifyMessage}`;
- return errorMessage;
- }
- function ɵɵpipeBind1(index, offset, v1) {
- const adjustedIndex = index + HEADER_OFFSET;
- const lView = getLView();
- const pipeInstance = load(lView, adjustedIndex);
- return isPure(lView, adjustedIndex) ? pureFunction1Internal(lView, getBindingRoot(), offset, pipeInstance.transform, v1, pipeInstance) : pipeInstance.transform(v1);
- }
- function ɵɵpipeBind2(index, slotOffset, v1, v2) {
- const adjustedIndex = index + HEADER_OFFSET;
- const lView = getLView();
- const pipeInstance = load(lView, adjustedIndex);
- return isPure(lView, adjustedIndex) ? pureFunction2Internal(lView, getBindingRoot(), slotOffset, pipeInstance.transform, v1, v2, pipeInstance) : pipeInstance.transform(v1, v2);
- }
- function ɵɵpipeBind3(index, slotOffset, v1, v2, v3) {
- const adjustedIndex = index + HEADER_OFFSET;
- const lView = getLView();
- const pipeInstance = load(lView, adjustedIndex);
- return isPure(lView, adjustedIndex) ? pureFunction3Internal(lView, getBindingRoot(), slotOffset, pipeInstance.transform, v1, v2, v3, pipeInstance) : pipeInstance.transform(v1, v2, v3);
- }
- function ɵɵpipeBind4(index, slotOffset, v1, v2, v3, v4) {
- const adjustedIndex = index + HEADER_OFFSET;
- const lView = getLView();
- const pipeInstance = load(lView, adjustedIndex);
- return isPure(lView, adjustedIndex) ? pureFunction4Internal(lView, getBindingRoot(), slotOffset, pipeInstance.transform, v1, v2, v3, v4, pipeInstance) : pipeInstance.transform(v1, v2, v3, v4);
- }
- function ɵɵpipeBindV(index, slotOffset, values) {
- const adjustedIndex = index + HEADER_OFFSET;
- const lView = getLView();
- const pipeInstance = load(lView, adjustedIndex);
- return isPure(lView, adjustedIndex) ? pureFunctionVInternal(lView, getBindingRoot(), slotOffset, pipeInstance.transform, values, pipeInstance) : pipeInstance.transform.apply(pipeInstance, values);
- }
- function isPure(lView, index) {
- return lView[TVIEW].data[index].pure;
- }
- function ɵɵtemplateRefExtractor(tNode, lView) {
- return createTemplateRef(tNode, lView);
- }
- function ɵɵgetComponentDepsFactory(type, rawImports) {
- return () => {
- try {
- return depsTracker.getComponentDependencies(type, rawImports).dependencies;
- } catch (e) {
- console.error(`Computing dependencies in local compilation mode for the component "${type.name}" failed with the exception:`, e);
- throw e;
- }
- };
- }
- function ɵsetClassDebugInfo(type, debugInfo) {
- const def = getComponentDef(type);
- if (def !== null) {
- def.debugInfo = debugInfo;
- }
- }
- var angularCoreEnv = /* @__PURE__ */ (() => ({
- "ɵɵattribute": ɵɵattribute,
- "ɵɵattributeInterpolate1": ɵɵattributeInterpolate1,
- "ɵɵattributeInterpolate2": ɵɵattributeInterpolate2,
- "ɵɵattributeInterpolate3": ɵɵattributeInterpolate3,
- "ɵɵattributeInterpolate4": ɵɵattributeInterpolate4,
- "ɵɵattributeInterpolate5": ɵɵattributeInterpolate5,
- "ɵɵattributeInterpolate6": ɵɵattributeInterpolate6,
- "ɵɵattributeInterpolate7": ɵɵattributeInterpolate7,
- "ɵɵattributeInterpolate8": ɵɵattributeInterpolate8,
- "ɵɵattributeInterpolateV": ɵɵattributeInterpolateV,
- "ɵɵdefineComponent": ɵɵdefineComponent,
- "ɵɵdefineDirective": ɵɵdefineDirective,
- "ɵɵdefineInjectable": ɵɵdefineInjectable,
- "ɵɵdefineInjector": ɵɵdefineInjector,
- "ɵɵdefineNgModule": ɵɵdefineNgModule,
- "ɵɵdefinePipe": ɵɵdefinePipe,
- "ɵɵdirectiveInject": ɵɵdirectiveInject,
- "ɵɵgetInheritedFactory": ɵɵgetInheritedFactory,
- "ɵɵinject": ɵɵinject,
- "ɵɵinjectAttribute": ɵɵinjectAttribute,
- "ɵɵinvalidFactory": ɵɵinvalidFactory,
- "ɵɵinvalidFactoryDep": ɵɵinvalidFactoryDep,
- "ɵɵtemplateRefExtractor": ɵɵtemplateRefExtractor,
- "ɵɵresetView": ɵɵresetView,
- "ɵɵHostDirectivesFeature": ɵɵHostDirectivesFeature,
- "ɵɵNgOnChangesFeature": ɵɵNgOnChangesFeature,
- "ɵɵProvidersFeature": ɵɵProvidersFeature,
- "ɵɵCopyDefinitionFeature": ɵɵCopyDefinitionFeature,
- "ɵɵInheritDefinitionFeature": ɵɵInheritDefinitionFeature,
- "ɵɵInputTransformsFeature": ɵɵInputTransformsFeature,
- "ɵɵStandaloneFeature": ɵɵStandaloneFeature,
- "ɵɵnextContext": ɵɵnextContext,
- "ɵɵnamespaceHTML": ɵɵnamespaceHTML,
- "ɵɵnamespaceMathML": ɵɵnamespaceMathML,
- "ɵɵnamespaceSVG": ɵɵnamespaceSVG,
- "ɵɵenableBindings": ɵɵenableBindings,
- "ɵɵdisableBindings": ɵɵdisableBindings,
- "ɵɵelementStart": ɵɵelementStart,
- "ɵɵelementEnd": ɵɵelementEnd,
- "ɵɵelement": ɵɵelement,
- "ɵɵelementContainerStart": ɵɵelementContainerStart,
- "ɵɵelementContainerEnd": ɵɵelementContainerEnd,
- "ɵɵelementContainer": ɵɵelementContainer,
- "ɵɵpureFunction0": ɵɵpureFunction0,
- "ɵɵpureFunction1": ɵɵpureFunction1,
- "ɵɵpureFunction2": ɵɵpureFunction2,
- "ɵɵpureFunction3": ɵɵpureFunction3,
- "ɵɵpureFunction4": ɵɵpureFunction4,
- "ɵɵpureFunction5": ɵɵpureFunction5,
- "ɵɵpureFunction6": ɵɵpureFunction6,
- "ɵɵpureFunction7": ɵɵpureFunction7,
- "ɵɵpureFunction8": ɵɵpureFunction8,
- "ɵɵpureFunctionV": ɵɵpureFunctionV,
- "ɵɵgetCurrentView": ɵɵgetCurrentView,
- "ɵɵrestoreView": ɵɵrestoreView,
- "ɵɵlistener": ɵɵlistener,
- "ɵɵprojection": ɵɵprojection,
- "ɵɵsyntheticHostProperty": ɵɵsyntheticHostProperty,
- "ɵɵsyntheticHostListener": ɵɵsyntheticHostListener,
- "ɵɵpipeBind1": ɵɵpipeBind1,
- "ɵɵpipeBind2": ɵɵpipeBind2,
- "ɵɵpipeBind3": ɵɵpipeBind3,
- "ɵɵpipeBind4": ɵɵpipeBind4,
- "ɵɵpipeBindV": ɵɵpipeBindV,
- "ɵɵprojectionDef": ɵɵprojectionDef,
- "ɵɵhostProperty": ɵɵhostProperty,
- "ɵɵproperty": ɵɵproperty,
- "ɵɵpropertyInterpolate": ɵɵpropertyInterpolate,
- "ɵɵpropertyInterpolate1": ɵɵpropertyInterpolate1,
- "ɵɵpropertyInterpolate2": ɵɵpropertyInterpolate2,
- "ɵɵpropertyInterpolate3": ɵɵpropertyInterpolate3,
- "ɵɵpropertyInterpolate4": ɵɵpropertyInterpolate4,
- "ɵɵpropertyInterpolate5": ɵɵpropertyInterpolate5,
- "ɵɵpropertyInterpolate6": ɵɵpropertyInterpolate6,
- "ɵɵpropertyInterpolate7": ɵɵpropertyInterpolate7,
- "ɵɵpropertyInterpolate8": ɵɵpropertyInterpolate8,
- "ɵɵpropertyInterpolateV": ɵɵpropertyInterpolateV,
- "ɵɵpipe": ɵɵpipe,
- "ɵɵqueryRefresh": ɵɵqueryRefresh,
- "ɵɵqueryAdvance": ɵɵqueryAdvance,
- "ɵɵviewQuery": ɵɵviewQuery,
- "ɵɵviewQuerySignal": ɵɵviewQuerySignal,
- "ɵɵloadQuery": ɵɵloadQuery,
- "ɵɵcontentQuery": ɵɵcontentQuery,
- "ɵɵcontentQuerySignal": ɵɵcontentQuerySignal,
- "ɵɵreference": ɵɵreference,
- "ɵɵclassMap": ɵɵclassMap,
- "ɵɵclassMapInterpolate1": ɵɵclassMapInterpolate1,
- "ɵɵclassMapInterpolate2": ɵɵclassMapInterpolate2,
- "ɵɵclassMapInterpolate3": ɵɵclassMapInterpolate3,
- "ɵɵclassMapInterpolate4": ɵɵclassMapInterpolate4,
- "ɵɵclassMapInterpolate5": ɵɵclassMapInterpolate5,
- "ɵɵclassMapInterpolate6": ɵɵclassMapInterpolate6,
- "ɵɵclassMapInterpolate7": ɵɵclassMapInterpolate7,
- "ɵɵclassMapInterpolate8": ɵɵclassMapInterpolate8,
- "ɵɵclassMapInterpolateV": ɵɵclassMapInterpolateV,
- "ɵɵstyleMap": ɵɵstyleMap,
- "ɵɵstyleMapInterpolate1": ɵɵstyleMapInterpolate1,
- "ɵɵstyleMapInterpolate2": ɵɵstyleMapInterpolate2,
- "ɵɵstyleMapInterpolate3": ɵɵstyleMapInterpolate3,
- "ɵɵstyleMapInterpolate4": ɵɵstyleMapInterpolate4,
- "ɵɵstyleMapInterpolate5": ɵɵstyleMapInterpolate5,
- "ɵɵstyleMapInterpolate6": ɵɵstyleMapInterpolate6,
- "ɵɵstyleMapInterpolate7": ɵɵstyleMapInterpolate7,
- "ɵɵstyleMapInterpolate8": ɵɵstyleMapInterpolate8,
- "ɵɵstyleMapInterpolateV": ɵɵstyleMapInterpolateV,
- "ɵɵstyleProp": ɵɵstyleProp,
- "ɵɵstylePropInterpolate1": ɵɵstylePropInterpolate1,
- "ɵɵstylePropInterpolate2": ɵɵstylePropInterpolate2,
- "ɵɵstylePropInterpolate3": ɵɵstylePropInterpolate3,
- "ɵɵstylePropInterpolate4": ɵɵstylePropInterpolate4,
- "ɵɵstylePropInterpolate5": ɵɵstylePropInterpolate5,
- "ɵɵstylePropInterpolate6": ɵɵstylePropInterpolate6,
- "ɵɵstylePropInterpolate7": ɵɵstylePropInterpolate7,
- "ɵɵstylePropInterpolate8": ɵɵstylePropInterpolate8,
- "ɵɵstylePropInterpolateV": ɵɵstylePropInterpolateV,
- "ɵɵclassProp": ɵɵclassProp,
- "ɵɵadvance": ɵɵadvance,
- "ɵɵtemplate": ɵɵtemplate,
- "ɵɵconditional": ɵɵconditional,
- "ɵɵdefer": ɵɵdefer,
- "ɵɵdeferWhen": ɵɵdeferWhen,
- "ɵɵdeferOnIdle": ɵɵdeferOnIdle,
- "ɵɵdeferOnImmediate": ɵɵdeferOnImmediate,
- "ɵɵdeferOnTimer": ɵɵdeferOnTimer,
- "ɵɵdeferOnHover": ɵɵdeferOnHover,
- "ɵɵdeferOnInteraction": ɵɵdeferOnInteraction,
- "ɵɵdeferOnViewport": ɵɵdeferOnViewport,
- "ɵɵdeferPrefetchWhen": ɵɵdeferPrefetchWhen,
- "ɵɵdeferPrefetchOnIdle": ɵɵdeferPrefetchOnIdle,
- "ɵɵdeferPrefetchOnImmediate": ɵɵdeferPrefetchOnImmediate,
- "ɵɵdeferPrefetchOnTimer": ɵɵdeferPrefetchOnTimer,
- "ɵɵdeferPrefetchOnHover": ɵɵdeferPrefetchOnHover,
- "ɵɵdeferPrefetchOnInteraction": ɵɵdeferPrefetchOnInteraction,
- "ɵɵdeferPrefetchOnViewport": ɵɵdeferPrefetchOnViewport,
- "ɵɵdeferEnableTimerScheduling": ɵɵdeferEnableTimerScheduling,
- "ɵɵrepeater": ɵɵrepeater,
- "ɵɵrepeaterCreate": ɵɵrepeaterCreate,
- "ɵɵrepeaterTrackByIndex": ɵɵrepeaterTrackByIndex,
- "ɵɵrepeaterTrackByIdentity": ɵɵrepeaterTrackByIdentity,
- "ɵɵcomponentInstance": ɵɵcomponentInstance,
- "ɵɵtext": ɵɵtext,
- "ɵɵtextInterpolate": ɵɵtextInterpolate,
- "ɵɵtextInterpolate1": ɵɵtextInterpolate1,
- "ɵɵtextInterpolate2": ɵɵtextInterpolate2,
- "ɵɵtextInterpolate3": ɵɵtextInterpolate3,
- "ɵɵtextInterpolate4": ɵɵtextInterpolate4,
- "ɵɵtextInterpolate5": ɵɵtextInterpolate5,
- "ɵɵtextInterpolate6": ɵɵtextInterpolate6,
- "ɵɵtextInterpolate7": ɵɵtextInterpolate7,
- "ɵɵtextInterpolate8": ɵɵtextInterpolate8,
- "ɵɵtextInterpolateV": ɵɵtextInterpolateV,
- "ɵɵi18n": ɵɵi18n,
- "ɵɵi18nAttributes": ɵɵi18nAttributes,
- "ɵɵi18nExp": ɵɵi18nExp,
- "ɵɵi18nStart": ɵɵi18nStart,
- "ɵɵi18nEnd": ɵɵi18nEnd,
- "ɵɵi18nApply": ɵɵi18nApply,
- "ɵɵi18nPostprocess": ɵɵi18nPostprocess,
- "ɵɵresolveWindow": ɵɵresolveWindow,
- "ɵɵresolveDocument": ɵɵresolveDocument,
- "ɵɵresolveBody": ɵɵresolveBody,
- "ɵɵsetComponentScope": ɵɵsetComponentScope,
- "ɵɵsetNgModuleScope": ɵɵsetNgModuleScope,
- "ɵɵregisterNgModuleType": registerNgModuleType,
- "ɵɵgetComponentDepsFactory": ɵɵgetComponentDepsFactory,
- "ɵsetClassDebugInfo": ɵsetClassDebugInfo,
- "ɵɵsanitizeHtml": ɵɵsanitizeHtml,
- "ɵɵsanitizeStyle": ɵɵsanitizeStyle,
- "ɵɵsanitizeResourceUrl": ɵɵsanitizeResourceUrl,
- "ɵɵsanitizeScript": ɵɵsanitizeScript,
- "ɵɵsanitizeUrl": ɵɵsanitizeUrl,
- "ɵɵsanitizeUrlOrResourceUrl": ɵɵsanitizeUrlOrResourceUrl,
- "ɵɵtrustConstantHtml": ɵɵtrustConstantHtml,
- "ɵɵtrustConstantResourceUrl": ɵɵtrustConstantResourceUrl,
- "ɵɵvalidateIframeAttribute": ɵɵvalidateIframeAttribute,
- "forwardRef": forwardRef,
- "resolveForwardRef": resolveForwardRef,
- "ɵɵtwoWayProperty": ɵɵtwoWayProperty,
- "ɵɵtwoWayBindingSet": ɵɵtwoWayBindingSet,
- "ɵɵtwoWayListener": ɵɵtwoWayListener,
- "ɵɵInputFlags": InputFlags
- }))();
- var jitOptions = null;
- function setJitOptions(options) {
- if (jitOptions !== null) {
- if (options.defaultEncapsulation !== jitOptions.defaultEncapsulation) {
- ngDevMode && console.error("Provided value for `defaultEncapsulation` can not be changed once it has been set.");
- return;
- }
- if (options.preserveWhitespaces !== jitOptions.preserveWhitespaces) {
- ngDevMode && console.error("Provided value for `preserveWhitespaces` can not be changed once it has been set.");
- return;
- }
- }
- jitOptions = options;
- }
- function getJitOptions() {
- return jitOptions;
- }
- function resetJitOptions() {
- jitOptions = null;
- }
- function patchModuleCompilation() {
- }
- var moduleQueue = [];
- function enqueueModuleForDelayedScoping(moduleType, ngModule) {
- moduleQueue.push({ moduleType, ngModule });
- }
- var flushingModuleQueue = false;
- function flushModuleScopingQueueAsMuchAsPossible() {
- if (!flushingModuleQueue) {
- flushingModuleQueue = true;
- try {
- for (let i = moduleQueue.length - 1; i >= 0; i--) {
- const { moduleType, ngModule } = moduleQueue[i];
- if (ngModule.declarations && ngModule.declarations.every(isResolvedDeclaration)) {
- moduleQueue.splice(i, 1);
- setScopeOnDeclaredComponents(moduleType, ngModule);
- }
- }
- } finally {
- flushingModuleQueue = false;
- }
- }
- }
- function isResolvedDeclaration(declaration) {
- if (Array.isArray(declaration)) {
- return declaration.every(isResolvedDeclaration);
- }
- return !!resolveForwardRef(declaration);
- }
- function compileNgModule(moduleType, ngModule = {}) {
- patchModuleCompilation();
- compileNgModuleDefs(moduleType, ngModule);
- if (ngModule.id !== void 0) {
- registerNgModuleType(moduleType, ngModule.id);
- }
- enqueueModuleForDelayedScoping(moduleType, ngModule);
- }
- function compileNgModuleDefs(moduleType, ngModule, allowDuplicateDeclarationsInRoot = false) {
- ngDevMode && assertDefined(moduleType, "Required value moduleType");
- ngDevMode && assertDefined(ngModule, "Required value ngModule");
- const declarations = flatten(ngModule.declarations || EMPTY_ARRAY);
- let ngModuleDef = null;
- Object.defineProperty(moduleType, NG_MOD_DEF, {
- configurable: true,
- get: () => {
- if (ngModuleDef === null) {
- if (ngDevMode && ngModule.imports && ngModule.imports.indexOf(moduleType) > -1) {
- throw new Error(`'${stringifyForError(moduleType)}' module can't import itself`);
- }
- const compiler = getCompilerFacade({ usage: 0, kind: "NgModule", type: moduleType });
- ngModuleDef = compiler.compileNgModule(angularCoreEnv, `ng:///${moduleType.name}/ɵmod.js`, {
- type: moduleType,
- bootstrap: flatten(ngModule.bootstrap || EMPTY_ARRAY).map(resolveForwardRef),
- declarations: declarations.map(resolveForwardRef),
- imports: flatten(ngModule.imports || EMPTY_ARRAY).map(resolveForwardRef).map(expandModuleWithProviders),
- exports: flatten(ngModule.exports || EMPTY_ARRAY).map(resolveForwardRef).map(expandModuleWithProviders),
- schemas: ngModule.schemas ? flatten(ngModule.schemas) : null,
- id: ngModule.id || null
- });
- if (!ngModuleDef.schemas) {
- ngModuleDef.schemas = [];
- }
- }
- return ngModuleDef;
- }
- });
- let ngFactoryDef = null;
- Object.defineProperty(moduleType, NG_FACTORY_DEF, {
- get: () => {
- if (ngFactoryDef === null) {
- const compiler = getCompilerFacade({ usage: 0, kind: "NgModule", type: moduleType });
- ngFactoryDef = compiler.compileFactory(angularCoreEnv, `ng:///${moduleType.name}/ɵfac.js`, {
- name: moduleType.name,
- type: moduleType,
- deps: reflectDependencies(moduleType),
- target: compiler.FactoryTarget.NgModule,
- typeArgumentCount: 0
- });
- }
- return ngFactoryDef;
- },
- // Make the property configurable in dev mode to allow overriding in tests
- configurable: !!ngDevMode
- });
- let ngInjectorDef = null;
- Object.defineProperty(moduleType, NG_INJ_DEF, {
- get: () => {
- if (ngInjectorDef === null) {
- ngDevMode && verifySemanticsOfNgModuleDef(moduleType, allowDuplicateDeclarationsInRoot);
- const meta = {
- name: moduleType.name,
- type: moduleType,
- providers: ngModule.providers || EMPTY_ARRAY,
- imports: [
- (ngModule.imports || EMPTY_ARRAY).map(resolveForwardRef),
- (ngModule.exports || EMPTY_ARRAY).map(resolveForwardRef)
- ]
- };
- const compiler = getCompilerFacade({ usage: 0, kind: "NgModule", type: moduleType });
- ngInjectorDef = compiler.compileInjector(angularCoreEnv, `ng:///${moduleType.name}/ɵinj.js`, meta);
- }
- return ngInjectorDef;
- },
- // Make the property configurable in dev mode to allow overriding in tests
- configurable: !!ngDevMode
- });
- }
- function generateStandaloneInDeclarationsError(type, location2) {
- const prefix = `Unexpected "${stringifyForError(type)}" found in the "declarations" array of the`;
- const suffix = `"${stringifyForError(type)}" is marked as standalone and can't be declared in any NgModule - did you intend to import it instead (by adding it to the "imports" array)?`;
- return `${prefix} ${location2}, ${suffix}`;
- }
- function verifySemanticsOfNgModuleDef(moduleType, allowDuplicateDeclarationsInRoot, importingModule) {
- if (verifiedNgModule.get(moduleType))
- return;
- if (isStandalone(moduleType))
- return;
- verifiedNgModule.set(moduleType, true);
- moduleType = resolveForwardRef(moduleType);
- let ngModuleDef;
- if (importingModule) {
- ngModuleDef = getNgModuleDef(moduleType);
- if (!ngModuleDef) {
- throw new Error(`Unexpected value '${moduleType.name}' imported by the module '${importingModule.name}'. Please add an @NgModule annotation.`);
- }
- } else {
- ngModuleDef = getNgModuleDef(moduleType, true);
- }
- const errors = [];
- const declarations = maybeUnwrapFn(ngModuleDef.declarations);
- const imports = maybeUnwrapFn(ngModuleDef.imports);
- flatten(imports).map(unwrapModuleWithProvidersImports).forEach((modOrStandaloneCmpt) => {
- verifySemanticsOfNgModuleImport(modOrStandaloneCmpt, moduleType);
- verifySemanticsOfNgModuleDef(modOrStandaloneCmpt, false, moduleType);
- });
- const exports = maybeUnwrapFn(ngModuleDef.exports);
- declarations.forEach(verifyDeclarationsHaveDefinitions);
- declarations.forEach(verifyDirectivesHaveSelector);
- declarations.forEach((declarationType) => verifyNotStandalone(declarationType, moduleType));
- const combinedDeclarations = [
- ...declarations.map(resolveForwardRef),
- ...flatten(imports.map(computeCombinedExports)).map(resolveForwardRef)
- ];
- exports.forEach(verifyExportsAreDeclaredOrReExported);
- declarations.forEach((decl) => verifyDeclarationIsUnique(decl, allowDuplicateDeclarationsInRoot));
- const ngModule = getAnnotation(moduleType, "NgModule");
- if (ngModule) {
- ngModule.imports && flatten(ngModule.imports).map(unwrapModuleWithProvidersImports).forEach((mod) => {
- verifySemanticsOfNgModuleImport(mod, moduleType);
- verifySemanticsOfNgModuleDef(mod, false, moduleType);
- });
- ngModule.bootstrap && deepForEach(ngModule.bootstrap, verifyCorrectBootstrapType);
- ngModule.bootstrap && deepForEach(ngModule.bootstrap, verifyComponentIsPartOfNgModule);
- }
- if (errors.length) {
- throw new Error(errors.join("\n"));
- }
- function verifyDeclarationsHaveDefinitions(type) {
- type = resolveForwardRef(type);
- const def = getComponentDef(type) || getDirectiveDef(type) || getPipeDef$1(type);
- if (!def) {
- errors.push(`Unexpected value '${stringifyForError(type)}' declared by the module '${stringifyForError(moduleType)}'. Please add a @Pipe/@Directive/@Component annotation.`);
- }
- }
- function verifyDirectivesHaveSelector(type) {
- type = resolveForwardRef(type);
- const def = getDirectiveDef(type);
- if (!getComponentDef(type) && def && def.selectors.length == 0) {
- errors.push(`Directive ${stringifyForError(type)} has no selector, please add it!`);
- }
- }
- function verifyNotStandalone(type, moduleType2) {
- type = resolveForwardRef(type);
- const def = getComponentDef(type) || getDirectiveDef(type) || getPipeDef$1(type);
- if (def?.standalone) {
- const location2 = `"${stringifyForError(moduleType2)}" NgModule`;
- errors.push(generateStandaloneInDeclarationsError(type, location2));
- }
- }
- function verifyExportsAreDeclaredOrReExported(type) {
- type = resolveForwardRef(type);
- const kind = getComponentDef(type) && "component" || getDirectiveDef(type) && "directive" || getPipeDef$1(type) && "pipe";
- if (kind) {
- if (combinedDeclarations.lastIndexOf(type) === -1) {
- errors.push(`Can't export ${kind} ${stringifyForError(type)} from ${stringifyForError(moduleType)} as it was neither declared nor imported!`);
- }
- }
- }
- function verifyDeclarationIsUnique(type, suppressErrors) {
- type = resolveForwardRef(type);
- const existingModule = ownerNgModule.get(type);
- if (existingModule && existingModule !== moduleType) {
- if (!suppressErrors) {
- const modules2 = [existingModule, moduleType].map(stringifyForError).sort();
- errors.push(`Type ${stringifyForError(type)} is part of the declarations of 2 modules: ${modules2[0]} and ${modules2[1]}! Please consider moving ${stringifyForError(type)} to a higher module that imports ${modules2[0]} and ${modules2[1]}. You can also create a new NgModule that exports and includes ${stringifyForError(type)} then import that NgModule in ${modules2[0]} and ${modules2[1]}.`);
- }
- } else {
- ownerNgModule.set(type, moduleType);
- }
- }
- function verifyComponentIsPartOfNgModule(type) {
- type = resolveForwardRef(type);
- const existingModule = ownerNgModule.get(type);
- if (!existingModule && !isStandalone(type)) {
- errors.push(`Component ${stringifyForError(type)} is not part of any NgModule or the module has not been imported into your module.`);
- }
- }
- function verifyCorrectBootstrapType(type) {
- type = resolveForwardRef(type);
- if (!getComponentDef(type)) {
- errors.push(`${stringifyForError(type)} cannot be used as an entry component.`);
- }
- if (isStandalone(type)) {
- errors.push(`The \`${stringifyForError(type)}\` class is a standalone component, which can not be used in the \`@NgModule.bootstrap\` array. Use the \`bootstrapApplication\` function for bootstrap instead.`);
- }
- }
- function verifySemanticsOfNgModuleImport(type, importingModule2) {
- type = resolveForwardRef(type);
- const directiveDef = getComponentDef(type) || getDirectiveDef(type);
- if (directiveDef !== null && !directiveDef.standalone) {
- throw new Error(`Unexpected directive '${type.name}' imported by the module '${importingModule2.name}'. Please add an @NgModule annotation.`);
- }
- const pipeDef = getPipeDef$1(type);
- if (pipeDef !== null && !pipeDef.standalone) {
- throw new Error(`Unexpected pipe '${type.name}' imported by the module '${importingModule2.name}'. Please add an @NgModule annotation.`);
- }
- }
- }
- function unwrapModuleWithProvidersImports(typeOrWithProviders) {
- typeOrWithProviders = resolveForwardRef(typeOrWithProviders);
- return typeOrWithProviders.ngModule || typeOrWithProviders;
- }
- function getAnnotation(type, name) {
- let annotation = null;
- collect(type.__annotations__);
- collect(type.decorators);
- return annotation;
- function collect(annotations) {
- if (annotations) {
- annotations.forEach(readAnnotation);
- }
- }
- function readAnnotation(decorator) {
- if (!annotation) {
- const proto = Object.getPrototypeOf(decorator);
- if (proto.ngMetadataName == name) {
- annotation = decorator;
- } else if (decorator.type) {
- const proto2 = Object.getPrototypeOf(decorator.type);
- if (proto2.ngMetadataName == name) {
- annotation = decorator.args[0];
- }
- }
- }
- }
- }
- var ownerNgModule = /* @__PURE__ */ new WeakMap();
- var verifiedNgModule = /* @__PURE__ */ new WeakMap();
- function resetCompiledComponents() {
- ownerNgModule = /* @__PURE__ */ new WeakMap();
- verifiedNgModule = /* @__PURE__ */ new WeakMap();
- moduleQueue.length = 0;
- GENERATED_COMP_IDS.clear();
- }
- function computeCombinedExports(type) {
- type = resolveForwardRef(type);
- const ngModuleDef = getNgModuleDef(type);
- if (ngModuleDef === null) {
- return [type];
- }
- return flatten(maybeUnwrapFn(ngModuleDef.exports).map((type2) => {
- const ngModuleDef2 = getNgModuleDef(type2);
- if (ngModuleDef2) {
- verifySemanticsOfNgModuleDef(type2, false);
- return computeCombinedExports(type2);
- } else {
- return type2;
- }
- }));
- }
- function setScopeOnDeclaredComponents(moduleType, ngModule) {
- const declarations = flatten(ngModule.declarations || EMPTY_ARRAY);
- const transitiveScopes = transitiveScopesFor(moduleType);
- declarations.forEach((declaration) => {
- declaration = resolveForwardRef(declaration);
- if (declaration.hasOwnProperty(NG_COMP_DEF)) {
- const component = declaration;
- const componentDef = getComponentDef(component);
- patchComponentDefWithScope(componentDef, transitiveScopes);
- } else if (!declaration.hasOwnProperty(NG_DIR_DEF) && !declaration.hasOwnProperty(NG_PIPE_DEF)) {
- declaration.ngSelectorScope = moduleType;
- }
- });
- }
- function patchComponentDefWithScope(componentDef, transitiveScopes) {
- componentDef.directiveDefs = () => Array.from(transitiveScopes.compilation.directives).map((dir) => dir.hasOwnProperty(NG_COMP_DEF) ? getComponentDef(dir) : getDirectiveDef(dir)).filter((def) => !!def);
- componentDef.pipeDefs = () => Array.from(transitiveScopes.compilation.pipes).map((pipe) => getPipeDef$1(pipe));
- componentDef.schemas = transitiveScopes.schemas;
- componentDef.tView = null;
- }
- function transitiveScopesFor(type) {
- if (isNgModule(type)) {
- if (USE_RUNTIME_DEPS_TRACKER_FOR_JIT) {
- const scope = depsTracker.getNgModuleScope(type);
- const def = getNgModuleDef(type, true);
- return __spreadValues({
- schemas: def.schemas || null
- }, scope);
- } else {
- return transitiveScopesForNgModule(type);
- }
- } else if (isStandalone(type)) {
- const directiveDef = getComponentDef(type) || getDirectiveDef(type);
- if (directiveDef !== null) {
- return {
- schemas: null,
- compilation: {
- directives: /* @__PURE__ */ new Set(),
- pipes: /* @__PURE__ */ new Set()
- },
- exported: {
- directives: /* @__PURE__ */ new Set([type]),
- pipes: /* @__PURE__ */ new Set()
- }
- };
- }
- const pipeDef = getPipeDef$1(type);
- if (pipeDef !== null) {
- return {
- schemas: null,
- compilation: {
- directives: /* @__PURE__ */ new Set(),
- pipes: /* @__PURE__ */ new Set()
- },
- exported: {
- directives: /* @__PURE__ */ new Set(),
- pipes: /* @__PURE__ */ new Set([type])
- }
- };
- }
- }
- throw new Error(`${type.name} does not have a module def (ɵmod property)`);
- }
- function transitiveScopesForNgModule(moduleType) {
- const def = getNgModuleDef(moduleType, true);
- if (def.transitiveCompileScopes !== null) {
- return def.transitiveCompileScopes;
- }
- const scopes = {
- schemas: def.schemas || null,
- compilation: {
- directives: /* @__PURE__ */ new Set(),
- pipes: /* @__PURE__ */ new Set()
- },
- exported: {
- directives: /* @__PURE__ */ new Set(),
- pipes: /* @__PURE__ */ new Set()
- }
- };
- maybeUnwrapFn(def.imports).forEach((imported) => {
- const importedScope = transitiveScopesFor(imported);
- importedScope.exported.directives.forEach((entry) => scopes.compilation.directives.add(entry));
- importedScope.exported.pipes.forEach((entry) => scopes.compilation.pipes.add(entry));
- });
- maybeUnwrapFn(def.declarations).forEach((declared) => {
- const declaredWithDefs = declared;
- if (getPipeDef$1(declaredWithDefs)) {
- scopes.compilation.pipes.add(declared);
- } else {
- scopes.compilation.directives.add(declared);
- }
- });
- maybeUnwrapFn(def.exports).forEach((exported) => {
- const exportedType = exported;
- if (isNgModule(exportedType)) {
- const exportedScope = transitiveScopesFor(exportedType);
- exportedScope.exported.directives.forEach((entry) => {
- scopes.compilation.directives.add(entry);
- scopes.exported.directives.add(entry);
- });
- exportedScope.exported.pipes.forEach((entry) => {
- scopes.compilation.pipes.add(entry);
- scopes.exported.pipes.add(entry);
- });
- } else if (getPipeDef$1(exportedType)) {
- scopes.exported.pipes.add(exportedType);
- } else {
- scopes.exported.directives.add(exportedType);
- }
- });
- def.transitiveCompileScopes = scopes;
- return scopes;
- }
- function expandModuleWithProviders(value) {
- if (isModuleWithProviders(value)) {
- return value.ngModule;
- }
- return value;
- }
- var compilationDepth = 0;
- function compileComponent(type, metadata) {
- (typeof ngDevMode === "undefined" || ngDevMode) && initNgDevMode();
- let ngComponentDef = null;
- maybeQueueResolutionOfComponentResources(type, metadata);
- addDirectiveFactoryDef(type, metadata);
- Object.defineProperty(type, NG_COMP_DEF, {
- get: () => {
- if (ngComponentDef === null) {
- const compiler = getCompilerFacade({ usage: 0, kind: "component", type });
- if (componentNeedsResolution(metadata)) {
- const error = [`Component '${type.name}' is not resolved:`];
- if (metadata.templateUrl) {
- error.push(` - templateUrl: ${metadata.templateUrl}`);
- }
- if (metadata.styleUrls && metadata.styleUrls.length) {
- error.push(` - styleUrls: ${JSON.stringify(metadata.styleUrls)}`);
- }
- if (metadata.styleUrl) {
- error.push(` - styleUrl: ${metadata.styleUrl}`);
- }
- error.push(`Did you run and wait for 'resolveComponentResources()'?`);
- throw new Error(error.join("\n"));
- }
- const options = getJitOptions();
- let preserveWhitespaces = metadata.preserveWhitespaces;
- if (preserveWhitespaces === void 0) {
- if (options !== null && options.preserveWhitespaces !== void 0) {
- preserveWhitespaces = options.preserveWhitespaces;
- } else {
- preserveWhitespaces = false;
- }
- }
- let encapsulation = metadata.encapsulation;
- if (encapsulation === void 0) {
- if (options !== null && options.defaultEncapsulation !== void 0) {
- encapsulation = options.defaultEncapsulation;
- } else {
- encapsulation = ViewEncapsulation$1.Emulated;
- }
- }
- const templateUrl = metadata.templateUrl || `ng:///${type.name}/template.html`;
- const meta = __spreadProps(__spreadValues({}, directiveMetadata(type, metadata)), {
- typeSourceSpan: compiler.createParseSourceSpan("Component", type.name, templateUrl),
- template: metadata.template || "",
- preserveWhitespaces,
- styles: typeof metadata.styles === "string" ? [metadata.styles] : metadata.styles || EMPTY_ARRAY,
- animations: metadata.animations,
- // JIT components are always compiled against an empty set of `declarations`. Instead, the
- // `directiveDefs` and `pipeDefs` are updated at a later point:
- // * for NgModule-based components, they're set when the NgModule which declares the
- // component resolves in the module scoping queue
- // * for standalone components, they're set just below, after `compileComponent`.
- declarations: [],
- changeDetection: metadata.changeDetection,
- encapsulation,
- interpolation: metadata.interpolation,
- viewProviders: metadata.viewProviders || null
- });
- compilationDepth++;
- try {
- if (meta.usesInheritance) {
- addDirectiveDefToUndecoratedParents(type);
- }
- ngComponentDef = compiler.compileComponent(angularCoreEnv, templateUrl, meta);
- if (metadata.standalone) {
- const imports = flatten(metadata.imports || EMPTY_ARRAY);
- const { directiveDefs, pipeDefs } = getStandaloneDefFunctions(type, imports);
- ngComponentDef.directiveDefs = directiveDefs;
- ngComponentDef.pipeDefs = pipeDefs;
- ngComponentDef.dependencies = () => imports.map(resolveForwardRef);
- }
- } finally {
- compilationDepth--;
- }
- if (compilationDepth === 0) {
- flushModuleScopingQueueAsMuchAsPossible();
- }
- if (hasSelectorScope(type)) {
- const scopes = transitiveScopesFor(type.ngSelectorScope);
- patchComponentDefWithScope(ngComponentDef, scopes);
- }
- if (metadata.schemas) {
- if (metadata.standalone) {
- ngComponentDef.schemas = metadata.schemas;
- } else {
- throw new Error(`The 'schemas' was specified for the ${stringifyForError(type)} but is only valid on a component that is standalone.`);
- }
- } else if (metadata.standalone) {
- ngComponentDef.schemas = [];
- }
- }
- return ngComponentDef;
- },
- // Make the property configurable in dev mode to allow overriding in tests
- configurable: !!ngDevMode
- });
- }
- function getStandaloneDefFunctions(type, imports) {
- let cachedDirectiveDefs = null;
- let cachedPipeDefs = null;
- const directiveDefs = () => {
- if (!USE_RUNTIME_DEPS_TRACKER_FOR_JIT) {
- if (cachedDirectiveDefs === null) {
- cachedDirectiveDefs = [getComponentDef(type)];
- const seen = /* @__PURE__ */ new Set([type]);
- for (const rawDep of imports) {
- ngDevMode && verifyStandaloneImport(rawDep, type);
- const dep = resolveForwardRef(rawDep);
- if (seen.has(dep)) {
- continue;
- }
- seen.add(dep);
- if (!!getNgModuleDef(dep)) {
- const scope = transitiveScopesFor(dep);
- for (const dir of scope.exported.directives) {
- const def = getComponentDef(dir) || getDirectiveDef(dir);
- if (def && !seen.has(dir)) {
- seen.add(dir);
- cachedDirectiveDefs.push(def);
- }
- }
- } else {
- const def = getComponentDef(dep) || getDirectiveDef(dep);
- if (def) {
- cachedDirectiveDefs.push(def);
- }
- }
- }
- }
- return cachedDirectiveDefs;
- } else {
- if (ngDevMode) {
- for (const rawDep of imports) {
- verifyStandaloneImport(rawDep, type);
- }
- }
- if (!isComponent(type)) {
- return [];
- }
- const scope = depsTracker.getStandaloneComponentScope(type, imports);
- return [...scope.compilation.directives].map((p) => getComponentDef(p) || getDirectiveDef(p)).filter((d) => d !== null);
- }
- };
- const pipeDefs = () => {
- if (!USE_RUNTIME_DEPS_TRACKER_FOR_JIT) {
- if (cachedPipeDefs === null) {
- cachedPipeDefs = [];
- const seen = /* @__PURE__ */ new Set();
- for (const rawDep of imports) {
- const dep = resolveForwardRef(rawDep);
- if (seen.has(dep)) {
- continue;
- }
- seen.add(dep);
- if (!!getNgModuleDef(dep)) {
- const scope = transitiveScopesFor(dep);
- for (const pipe of scope.exported.pipes) {
- const def = getPipeDef$1(pipe);
- if (def && !seen.has(pipe)) {
- seen.add(pipe);
- cachedPipeDefs.push(def);
- }
- }
- } else {
- const def = getPipeDef$1(dep);
- if (def) {
- cachedPipeDefs.push(def);
- }
- }
- }
- }
- return cachedPipeDefs;
- } else {
- if (ngDevMode) {
- for (const rawDep of imports) {
- verifyStandaloneImport(rawDep, type);
- }
- }
- if (!isComponent(type)) {
- return [];
- }
- const scope = depsTracker.getStandaloneComponentScope(type, imports);
- return [...scope.compilation.pipes].map((p) => getPipeDef$1(p)).filter((d) => d !== null);
- }
- };
- return {
- directiveDefs,
- pipeDefs
- };
- }
- function hasSelectorScope(component) {
- return component.ngSelectorScope !== void 0;
- }
- function compileDirective(type, directive) {
- let ngDirectiveDef = null;
- addDirectiveFactoryDef(type, directive || {});
- Object.defineProperty(type, NG_DIR_DEF, {
- get: () => {
- if (ngDirectiveDef === null) {
- const meta = getDirectiveMetadata(type, directive || {});
- const compiler = getCompilerFacade({ usage: 0, kind: "directive", type });
- ngDirectiveDef = compiler.compileDirective(angularCoreEnv, meta.sourceMapUrl, meta.metadata);
- }
- return ngDirectiveDef;
- },
- // Make the property configurable in dev mode to allow overriding in tests
- configurable: !!ngDevMode
- });
- }
- function getDirectiveMetadata(type, metadata) {
- const name = type && type.name;
- const sourceMapUrl = `ng:///${name}/ɵdir.js`;
- const compiler = getCompilerFacade({ usage: 0, kind: "directive", type });
- const facade = directiveMetadata(type, metadata);
- facade.typeSourceSpan = compiler.createParseSourceSpan("Directive", name, sourceMapUrl);
- if (facade.usesInheritance) {
- addDirectiveDefToUndecoratedParents(type);
- }
- return { metadata: facade, sourceMapUrl };
- }
- function addDirectiveFactoryDef(type, metadata) {
- let ngFactoryDef = null;
- Object.defineProperty(type, NG_FACTORY_DEF, {
- get: () => {
- if (ngFactoryDef === null) {
- const meta = getDirectiveMetadata(type, metadata);
- const compiler = getCompilerFacade({ usage: 0, kind: "directive", type });
- ngFactoryDef = compiler.compileFactory(angularCoreEnv, `ng:///${type.name}/ɵfac.js`, {
- name: meta.metadata.name,
- type: meta.metadata.type,
- typeArgumentCount: 0,
- deps: reflectDependencies(type),
- target: compiler.FactoryTarget.Directive
- });
- }
- return ngFactoryDef;
- },
- // Make the property configurable in dev mode to allow overriding in tests
- configurable: !!ngDevMode
- });
- }
- function extendsDirectlyFromObject(type) {
- return Object.getPrototypeOf(type.prototype) === Object.prototype;
- }
- function directiveMetadata(type, metadata) {
- const reflect = getReflect();
- const propMetadata = reflect.ownPropMetadata(type);
- return {
- name: type.name,
- type,
- selector: metadata.selector !== void 0 ? metadata.selector : null,
- host: metadata.host || EMPTY_OBJ,
- propMetadata,
- inputs: metadata.inputs || EMPTY_ARRAY,
- outputs: metadata.outputs || EMPTY_ARRAY,
- queries: extractQueriesMetadata(type, propMetadata, isContentQuery),
- lifecycle: { usesOnChanges: reflect.hasLifecycleHook(type, "ngOnChanges") },
- typeSourceSpan: null,
- usesInheritance: !extendsDirectlyFromObject(type),
- exportAs: extractExportAs(metadata.exportAs),
- providers: metadata.providers || null,
- viewQueries: extractQueriesMetadata(type, propMetadata, isViewQuery),
- isStandalone: !!metadata.standalone,
- isSignal: !!metadata.signals,
- hostDirectives: metadata.hostDirectives?.map((directive) => typeof directive === "function" ? { directive } : directive) || null
- };
- }
- function addDirectiveDefToUndecoratedParents(type) {
- const objPrototype = Object.prototype;
- let parent = Object.getPrototypeOf(type.prototype).constructor;
- while (parent && parent !== objPrototype) {
- if (!getDirectiveDef(parent) && !getComponentDef(parent) && shouldAddAbstractDirective(parent)) {
- compileDirective(parent, null);
- }
- parent = Object.getPrototypeOf(parent);
- }
- }
- function convertToR3QueryPredicate(selector) {
- return typeof selector === "string" ? splitByComma(selector) : resolveForwardRef(selector);
- }
- function convertToR3QueryMetadata(propertyName, ann) {
- return {
- propertyName,
- predicate: convertToR3QueryPredicate(ann.selector),
- descendants: ann.descendants,
- first: ann.first,
- read: ann.read ? ann.read : null,
- static: !!ann.static,
- emitDistinctChangesOnly: !!ann.emitDistinctChangesOnly,
- isSignal: !!ann.isSignal
- };
- }
- function extractQueriesMetadata(type, propMetadata, isQueryAnn) {
- const queriesMeta = [];
- for (const field in propMetadata) {
- if (propMetadata.hasOwnProperty(field)) {
- const annotations = propMetadata[field];
- annotations.forEach((ann) => {
- if (isQueryAnn(ann)) {
- if (!ann.selector) {
- throw new Error(`Can't construct a query for the property "${field}" of "${stringifyForError(type)}" since the query selector wasn't defined.`);
- }
- if (annotations.some(isInputAnnotation)) {
- throw new Error(`Cannot combine @Input decorators with query decorators`);
- }
- queriesMeta.push(convertToR3QueryMetadata(field, ann));
- }
- });
- }
- }
- return queriesMeta;
- }
- function extractExportAs(exportAs) {
- return exportAs === void 0 ? null : splitByComma(exportAs);
- }
- function isContentQuery(value) {
- const name = value.ngMetadataName;
- return name === "ContentChild" || name === "ContentChildren";
- }
- function isViewQuery(value) {
- const name = value.ngMetadataName;
- return name === "ViewChild" || name === "ViewChildren";
- }
- function isInputAnnotation(value) {
- return value.ngMetadataName === "Input";
- }
- function splitByComma(value) {
- return value.split(",").map((piece) => piece.trim());
- }
- var LIFECYCLE_HOOKS = [
- "ngOnChanges",
- "ngOnInit",
- "ngOnDestroy",
- "ngDoCheck",
- "ngAfterViewInit",
- "ngAfterViewChecked",
- "ngAfterContentInit",
- "ngAfterContentChecked"
- ];
- function shouldAddAbstractDirective(type) {
- const reflect = getReflect();
- if (LIFECYCLE_HOOKS.some((hookName) => reflect.hasLifecycleHook(type, hookName))) {
- return true;
- }
- const propMetadata = reflect.propMetadata(type);
- for (const field in propMetadata) {
- const annotations = propMetadata[field];
- for (let i = 0; i < annotations.length; i++) {
- const current = annotations[i];
- const metadataName = current.ngMetadataName;
- if (isInputAnnotation(current) || isContentQuery(current) || isViewQuery(current) || metadataName === "Output" || metadataName === "HostBinding" || metadataName === "HostListener") {
- return true;
- }
- }
- }
- return false;
- }
- function compilePipe(type, meta) {
- let ngPipeDef = null;
- let ngFactoryDef = null;
- Object.defineProperty(type, NG_FACTORY_DEF, {
- get: () => {
- if (ngFactoryDef === null) {
- const metadata = getPipeMetadata(type, meta);
- const compiler = getCompilerFacade({ usage: 0, kind: "pipe", type: metadata.type });
- ngFactoryDef = compiler.compileFactory(angularCoreEnv, `ng:///${metadata.name}/ɵfac.js`, {
- name: metadata.name,
- type: metadata.type,
- typeArgumentCount: 0,
- deps: reflectDependencies(type),
- target: compiler.FactoryTarget.Pipe
- });
- }
- return ngFactoryDef;
- },
- // Make the property configurable in dev mode to allow overriding in tests
- configurable: !!ngDevMode
- });
- Object.defineProperty(type, NG_PIPE_DEF, {
- get: () => {
- if (ngPipeDef === null) {
- const metadata = getPipeMetadata(type, meta);
- const compiler = getCompilerFacade({ usage: 0, kind: "pipe", type: metadata.type });
- ngPipeDef = compiler.compilePipe(angularCoreEnv, `ng:///${metadata.name}/ɵpipe.js`, metadata);
- }
- return ngPipeDef;
- },
- // Make the property configurable in dev mode to allow overriding in tests
- configurable: !!ngDevMode
- });
- }
- function getPipeMetadata(type, meta) {
- return {
- type,
- name: type.name,
- pipeName: meta.name,
- pure: meta.pure !== void 0 ? meta.pure : true,
- isStandalone: !!meta.standalone
- };
- }
- var Directive = makeDecorator("Directive", (dir = {}) => dir, void 0, void 0, (type, meta) => compileDirective(type, meta));
- var Component = makeDecorator("Component", (c = {}) => __spreadValues({ changeDetection: ChangeDetectionStrategy.Default }, c), Directive, void 0, (type, meta) => compileComponent(type, meta));
- var Pipe = makeDecorator("Pipe", (p) => __spreadValues({ pure: true }, p), void 0, void 0, (type, meta) => compilePipe(type, meta));
- var Input = makePropDecorator("Input", (arg) => {
- if (!arg) {
- return {};
- }
- return typeof arg === "string" ? { alias: arg } : arg;
- });
- var Output = makePropDecorator("Output", (alias) => ({ alias }));
- var HostBinding = makePropDecorator("HostBinding", (hostPropertyName) => ({ hostPropertyName }));
- var HostListener = makePropDecorator("HostListener", (eventName, args) => ({ eventName, args }));
- var NgModule = makeDecorator(
- "NgModule",
- (ngModule) => ngModule,
- void 0,
- void 0,
- /**
- * Decorator that marks the following class as an NgModule, and supplies
- * configuration metadata for it.
- *
- * * The `declarations` option configures the compiler
- * with information about what belongs to the NgModule.
- * * The `providers` options configures the NgModule's injector to provide
- * dependencies the NgModule members.
- * * The `imports` and `exports` options bring in members from other modules, and make
- * this module's members available to others.
- */
- (type, meta) => compileNgModule(type, meta)
- );
- var Version = class {
- constructor(full) {
- this.full = full;
- const parts = full.split(".");
- this.major = parts[0];
- this.minor = parts[1];
- this.patch = parts.slice(2).join(".");
- }
- };
- var VERSION = new Version("17.2.2");
- var _Console = class _Console {
- log(message) {
- console.log(message);
- }
- // Note: for reporting errors use `DOM.logError()` as it is platform specific
- warn(message) {
- console.warn(message);
- }
- };
- _Console.ɵfac = function Console_Factory(t) {
- return new (t || _Console)();
- };
- _Console.ɵprov = ɵɵdefineInjectable({ token: _Console, factory: _Console.ɵfac, providedIn: "platform" });
- var Console = _Console;
- (() => {
- (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Console, [{
- type: Injectable,
- args: [{ providedIn: "platform" }]
- }], null, null);
- })();
- var DIDebugData = class {
- constructor() {
- this.resolverToTokenToDependencies = /* @__PURE__ */ new WeakMap();
- this.resolverToProviders = /* @__PURE__ */ new WeakMap();
- this.standaloneInjectorToComponent = /* @__PURE__ */ new WeakMap();
- }
- reset() {
- this.resolverToTokenToDependencies = /* @__PURE__ */ new WeakMap();
- this.resolverToProviders = /* @__PURE__ */ new WeakMap();
- this.standaloneInjectorToComponent = /* @__PURE__ */ new WeakMap();
- }
- };
- var frameworkDIDebugData = new DIDebugData();
- function getFrameworkDIDebugData() {
- return frameworkDIDebugData;
- }
- function setupFrameworkInjectorProfiler() {
- frameworkDIDebugData.reset();
- setInjectorProfiler((injectorProfilerEvent) => handleInjectorProfilerEvent(injectorProfilerEvent));
- }
- function handleInjectorProfilerEvent(injectorProfilerEvent) {
- const { context, type } = injectorProfilerEvent;
- if (type === 0) {
- handleInjectEvent(context, injectorProfilerEvent.service);
- } else if (type === 1) {
- handleInstanceCreatedByInjectorEvent(context, injectorProfilerEvent.instance);
- } else if (type === 2) {
- handleProviderConfiguredEvent(context, injectorProfilerEvent.providerRecord);
- }
- }
- function handleInjectEvent(context, data) {
- const diResolver = getDIResolver(context.injector);
- if (diResolver === null) {
- throwError("An Inject event must be run within an injection context.");
- }
- const diResolverToInstantiatedToken = frameworkDIDebugData.resolverToTokenToDependencies;
- if (!diResolverToInstantiatedToken.has(diResolver)) {
- diResolverToInstantiatedToken.set(diResolver, /* @__PURE__ */ new WeakMap());
- }
- if (!canBeHeldWeakly(context.token)) {
- return;
- }
- const instantiatedTokenToDependencies = diResolverToInstantiatedToken.get(diResolver);
- if (!instantiatedTokenToDependencies.has(context.token)) {
- instantiatedTokenToDependencies.set(context.token, []);
- }
- const { token, value, flags } = data;
- assertDefined(context.token, "Injector profiler context token is undefined.");
- const dependencies = instantiatedTokenToDependencies.get(context.token);
- assertDefined(dependencies, "Could not resolve dependencies for token.");
- if (context.injector instanceof NodeInjector) {
- dependencies.push({ token, value, flags, injectedIn: getNodeInjectorContext(context.injector) });
- } else {
- dependencies.push({ token, value, flags });
- }
- }
- function getNodeInjectorContext(injector) {
- if (!(injector instanceof NodeInjector)) {
- throwError("getNodeInjectorContext must be called with a NodeInjector");
- }
- const lView = getNodeInjectorLView(injector);
- const tNode = getNodeInjectorTNode(injector);
- if (tNode === null) {
- return;
- }
- assertTNodeForLView(tNode, lView);
- return { lView, tNode };
- }
- function handleInstanceCreatedByInjectorEvent(context, data) {
- const { value } = data;
- if (getDIResolver(context.injector) === null) {
- throwError("An InjectorCreatedInstance event must be run within an injection context.");
- }
- let standaloneComponent = void 0;
- if (typeof value === "object") {
- standaloneComponent = value?.constructor;
- }
- if (standaloneComponent === void 0 || !isStandaloneComponent(standaloneComponent)) {
- return;
- }
- const environmentInjector = context.injector.get(EnvironmentInjector, null, { optional: true });
- if (environmentInjector === null) {
- return;
- }
- const { standaloneInjectorToComponent } = frameworkDIDebugData;
- if (standaloneInjectorToComponent.has(environmentInjector)) {
- return;
- }
- standaloneInjectorToComponent.set(environmentInjector, standaloneComponent);
- }
- function isStandaloneComponent(value) {
- const def = getComponentDef(value);
- return !!def?.standalone;
- }
- function handleProviderConfiguredEvent(context, data) {
- const { resolverToProviders } = frameworkDIDebugData;
- let diResolver;
- if (context?.injector instanceof NodeInjector) {
- diResolver = getNodeInjectorTNode(context.injector);
- } else {
- diResolver = context.injector;
- }
- if (diResolver === null) {
- throwError("A ProviderConfigured event must be run within an injection context.");
- }
- if (!resolverToProviders.has(diResolver)) {
- resolverToProviders.set(diResolver, []);
- }
- resolverToProviders.get(diResolver).push(data);
- }
- function getDIResolver(injector) {
- let diResolver = null;
- if (injector === void 0) {
- return diResolver;
- }
- if (injector instanceof NodeInjector) {
- diResolver = getNodeInjectorLView(injector);
- } else {
- diResolver = injector;
- }
- return diResolver;
- }
- function canBeHeldWeakly(value) {
- return value !== null && (typeof value === "object" || typeof value === "function" || typeof value === "symbol");
- }
- function applyChanges(component) {
- ngDevMode && assertDefined(component, "component");
- markViewDirty(getComponentViewByInstance(component));
- getRootComponents(component).forEach((rootComponent) => detectChanges(rootComponent));
- }
- function detectChanges(component) {
- const view = getComponentViewByInstance(component);
- view[FLAGS] |= 1024;
- detectChangesInternal(view);
- }
- function getDependenciesFromInjectable(injector, token) {
- const instance = injector.get(token, null, { self: true, optional: true });
- if (instance === null) {
- throw new Error(`Unable to determine instance of ${token} in given injector`);
- }
- const unformattedDependencies = getDependenciesForTokenInInjector(token, injector);
- const resolutionPath = getInjectorResolutionPath(injector);
- const dependencies = unformattedDependencies.map((dep) => {
- const formattedDependency = {
- value: dep.value
- };
- const flags = dep.flags;
- formattedDependency.flags = {
- optional: (8 & flags) === 8,
- host: (1 & flags) === 1,
- self: (2 & flags) === 2,
- skipSelf: (4 & flags) === 4
- };
- for (let i = 0; i < resolutionPath.length; i++) {
- const injectorToCheck = resolutionPath[i];
- if (i === 0 && formattedDependency.flags.skipSelf) {
- continue;
- }
- if (formattedDependency.flags.host && injectorToCheck instanceof EnvironmentInjector) {
- break;
- }
- const instance2 = injectorToCheck.get(dep.token, null, { self: true, optional: true });
- if (instance2 !== null) {
- if (formattedDependency.flags.host) {
- const firstInjector = resolutionPath[0];
- const lookupFromFirstInjector = firstInjector.get(dep.token, null, __spreadProps(__spreadValues({}, formattedDependency.flags), { optional: true }));
- if (lookupFromFirstInjector !== null) {
- formattedDependency.providedIn = injectorToCheck;
- }
- break;
- }
- formattedDependency.providedIn = injectorToCheck;
- break;
- }
- if (i === 0 && formattedDependency.flags.self) {
- break;
- }
- }
- if (dep.token)
- formattedDependency.token = dep.token;
- return formattedDependency;
- });
- return { instance, dependencies };
- }
- function getDependenciesForTokenInInjector(token, injector) {
- const { resolverToTokenToDependencies } = getFrameworkDIDebugData();
- if (!(injector instanceof NodeInjector)) {
- return resolverToTokenToDependencies.get(injector)?.get?.(token) ?? [];
- }
- const lView = getNodeInjectorLView(injector);
- const tokenDependencyMap = resolverToTokenToDependencies.get(lView);
- const dependencies = tokenDependencyMap?.get(token) ?? [];
- return dependencies.filter((dependency) => {
- const dependencyNode = dependency.injectedIn?.tNode;
- if (dependencyNode === void 0) {
- return false;
- }
- const instanceNode = getNodeInjectorTNode(injector);
- assertTNode(dependencyNode);
- assertTNode(instanceNode);
- return dependencyNode === instanceNode;
- });
- }
- function getProviderImportsContainer(injector) {
- const { standaloneInjectorToComponent } = getFrameworkDIDebugData();
- if (standaloneInjectorToComponent.has(injector)) {
- return standaloneInjectorToComponent.get(injector);
- }
- const defTypeRef = injector.get(NgModuleRef$1, null, { self: true, optional: true });
- if (defTypeRef === null) {
- return null;
- }
- if (defTypeRef.instance === null) {
- return null;
- }
- return defTypeRef.instance.constructor;
- }
- function getNodeInjectorProviders(injector) {
- const diResolver = getNodeInjectorTNode(injector);
- const { resolverToProviders } = getFrameworkDIDebugData();
- return resolverToProviders.get(diResolver) ?? [];
- }
- function getProviderImportPaths(providerImportsContainer) {
- const providerToPath = /* @__PURE__ */ new Map();
- const visitedContainers = /* @__PURE__ */ new Set();
- const visitor = walkProviderTreeToDiscoverImportPaths(providerToPath, visitedContainers);
- walkProviderTree(providerImportsContainer, visitor, [], /* @__PURE__ */ new Set());
- return providerToPath;
- }
- function walkProviderTreeToDiscoverImportPaths(providerToPath, visitedContainers) {
- return (provider, container) => {
- if (!providerToPath.has(provider)) {
- providerToPath.set(provider, [container]);
- }
- if (!visitedContainers.has(container)) {
- for (const prov of providerToPath.keys()) {
- const existingImportPath = providerToPath.get(prov);
- let containerDef = getInjectorDef(container);
- if (!containerDef) {
- const ngModule = container.ngModule;
- containerDef = getInjectorDef(ngModule);
- }
- if (!containerDef) {
- return;
- }
- const lastContainerAddedToPath = existingImportPath[0];
- let isNextStepInPath = false;
- deepForEach(containerDef.imports, (moduleImport) => {
- if (isNextStepInPath) {
- return;
- }
- isNextStepInPath = moduleImport.ngModule === lastContainerAddedToPath || moduleImport === lastContainerAddedToPath;
- if (isNextStepInPath) {
- providerToPath.get(prov)?.unshift(container);
- }
- });
- }
- }
- visitedContainers.add(container);
- };
- }
- function getEnvironmentInjectorProviders(injector) {
- const providerRecordsWithoutImportPaths = getFrameworkDIDebugData().resolverToProviders.get(injector) ?? [];
- if (isPlatformInjector(injector)) {
- return providerRecordsWithoutImportPaths;
- }
- const providerImportsContainer = getProviderImportsContainer(injector);
- if (providerImportsContainer === null) {
- return providerRecordsWithoutImportPaths;
- }
- const providerToPath = getProviderImportPaths(providerImportsContainer);
- const providerRecords = [];
- for (const providerRecord of providerRecordsWithoutImportPaths) {
- const provider = providerRecord.provider;
- const token = provider.provide;
- if (token === ENVIRONMENT_INITIALIZER || token === INJECTOR_DEF_TYPES) {
- continue;
- }
- let importPath = providerToPath.get(provider) ?? [];
- const def = getComponentDef(providerImportsContainer);
- const isStandaloneComponent2 = !!def?.standalone;
- if (isStandaloneComponent2) {
- importPath = [providerImportsContainer, ...importPath];
- }
- providerRecords.push(__spreadProps(__spreadValues({}, providerRecord), { importPath }));
- }
- return providerRecords;
- }
- function isPlatformInjector(injector) {
- return injector instanceof R3Injector && injector.scopes.has("platform");
- }
- function getInjectorProviders(injector) {
- if (injector instanceof NodeInjector) {
- return getNodeInjectorProviders(injector);
- } else if (injector instanceof EnvironmentInjector) {
- return getEnvironmentInjectorProviders(injector);
- }
- throwError("getInjectorProviders only supports NodeInjector and EnvironmentInjector");
- }
- function getInjectorMetadata(injector) {
- if (injector instanceof NodeInjector) {
- const lView = getNodeInjectorLView(injector);
- const tNode = getNodeInjectorTNode(injector);
- assertTNodeForLView(tNode, lView);
- return { type: "element", source: getNativeByTNode(tNode, lView) };
- }
- if (injector instanceof R3Injector) {
- return { type: "environment", source: injector.source ?? null };
- }
- if (injector instanceof NullInjector) {
- return { type: "null", source: null };
- }
- return null;
- }
- function getInjectorResolutionPath(injector) {
- const resolutionPath = [injector];
- getInjectorResolutionPathHelper(injector, resolutionPath);
- return resolutionPath;
- }
- function getInjectorResolutionPathHelper(injector, resolutionPath) {
- const parent = getInjectorParent(injector);
- if (parent === null) {
- if (injector instanceof NodeInjector) {
- const firstInjector = resolutionPath[0];
- if (firstInjector instanceof NodeInjector) {
- const moduleInjector = getModuleInjectorOfNodeInjector(firstInjector);
- if (moduleInjector === null) {
- throwError("NodeInjector must have some connection to the module injector tree");
- }
- resolutionPath.push(moduleInjector);
- getInjectorResolutionPathHelper(moduleInjector, resolutionPath);
- }
- return resolutionPath;
- }
- } else {
- resolutionPath.push(parent);
- getInjectorResolutionPathHelper(parent, resolutionPath);
- }
- return resolutionPath;
- }
- function getInjectorParent(injector) {
- if (injector instanceof R3Injector) {
- return injector.parent;
- }
- let tNode;
- let lView;
- if (injector instanceof NodeInjector) {
- tNode = getNodeInjectorTNode(injector);
- lView = getNodeInjectorLView(injector);
- } else if (injector instanceof NullInjector) {
- return null;
- } else {
- throwError("getInjectorParent only support injectors of type R3Injector, NodeInjector, NullInjector");
- }
- const parentLocation = getParentInjectorLocation(tNode, lView);
- if (hasParentInjector(parentLocation)) {
- const parentInjectorIndex = getParentInjectorIndex(parentLocation);
- const parentLView = getParentInjectorView(parentLocation, lView);
- const parentTView = parentLView[TVIEW];
- const parentTNode = parentTView.data[
- parentInjectorIndex + 8
- /* NodeInjectorOffset.TNODE */
- ];
- return new NodeInjector(parentTNode, parentLView);
- } else {
- const chainedInjector = lView[INJECTOR$1];
- const injectorParent = chainedInjector.injector?.parent;
- if (injectorParent instanceof NodeInjector) {
- return injectorParent;
- }
- }
- return null;
- }
- function getModuleInjectorOfNodeInjector(injector) {
- let lView;
- if (injector instanceof NodeInjector) {
- lView = getNodeInjectorLView(injector);
- } else {
- throwError("getModuleInjectorOfNodeInjector must be called with a NodeInjector");
- }
- const chainedInjector = lView[INJECTOR$1];
- const moduleInjector = chainedInjector.parentInjector;
- if (!moduleInjector) {
- throwError("NodeInjector must have some connection to the module injector tree");
- }
- return moduleInjector;
- }
- var GLOBAL_PUBLISH_EXPANDO_KEY = "ng";
- var globalUtilsFunctions = {
- /**
- * Warning: functions that start with `ɵ` are considered *INTERNAL* and should not be relied upon
- * in application's code. The contract of those functions might be changed in any release and/or a
- * function can be removed completely.
- */
- "ɵgetDependenciesFromInjectable": getDependenciesFromInjectable,
- "ɵgetInjectorProviders": getInjectorProviders,
- "ɵgetInjectorResolutionPath": getInjectorResolutionPath,
- "ɵgetInjectorMetadata": getInjectorMetadata,
- "ɵsetProfiler": setProfiler,
- "getDirectiveMetadata": getDirectiveMetadata$1,
- "getComponent": getComponent,
- "getContext": getContext,
- "getListeners": getListeners,
- "getOwningComponent": getOwningComponent,
- "getHostElement": getHostElement,
- "getInjector": getInjector,
- "getRootComponents": getRootComponents,
- "getDirectives": getDirectives,
- "applyChanges": applyChanges,
- "isSignal": isSignal
- };
- var _published = false;
- function publishDefaultGlobalUtils$1() {
- if (!_published) {
- _published = true;
- setupFrameworkInjectorProfiler();
- for (const [methodName, method] of Object.entries(globalUtilsFunctions)) {
- publishGlobalUtil(methodName, method);
- }
- }
- }
- function publishGlobalUtil(name, fn) {
- if (typeof COMPILED === "undefined" || !COMPILED) {
- const w = _global;
- ngDevMode && assertDefined(fn, "function not defined");
- w[GLOBAL_PUBLISH_EXPANDO_KEY] ??= {};
- w[GLOBAL_PUBLISH_EXPANDO_KEY][name] = fn;
- }
- }
- var TESTABILITY = new InjectionToken("");
- var TESTABILITY_GETTER = new InjectionToken("");
- var _Testability = class _Testability {
- constructor(_ngZone, registry, testabilityGetter) {
- this._ngZone = _ngZone;
- this.registry = registry;
- this._pendingCount = 0;
- this._isZoneStable = true;
- this._callbacks = [];
- this.taskTrackingZone = null;
- if (!_testabilityGetter) {
- setTestabilityGetter(testabilityGetter);
- testabilityGetter.addToWindow(registry);
- }
- this._watchAngularEvents();
- _ngZone.run(() => {
- this.taskTrackingZone = typeof Zone == "undefined" ? null : Zone.current.get("TaskTrackingZone");
- });
- }
- _watchAngularEvents() {
- this._ngZone.onUnstable.subscribe({
- next: () => {
- this._isZoneStable = false;
- }
- });
- this._ngZone.runOutsideAngular(() => {
- this._ngZone.onStable.subscribe({
- next: () => {
- NgZone.assertNotInAngularZone();
- queueMicrotask(() => {
- this._isZoneStable = true;
- this._runCallbacksIfReady();
- });
- }
- });
- });
- }
- /**
- * Increases the number of pending request
- * @deprecated pending requests are now tracked with zones.
- */
- increasePendingRequestCount() {
- this._pendingCount += 1;
- return this._pendingCount;
- }
- /**
- * Decreases the number of pending request
- * @deprecated pending requests are now tracked with zones
- */
- decreasePendingRequestCount() {
- this._pendingCount -= 1;
- if (this._pendingCount < 0) {
- throw new Error("pending async requests below zero");
- }
- this._runCallbacksIfReady();
- return this._pendingCount;
- }
- /**
- * Whether an associated application is stable
- */
- isStable() {
- return this._isZoneStable && this._pendingCount === 0 && !this._ngZone.hasPendingMacrotasks;
- }
- _runCallbacksIfReady() {
- if (this.isStable()) {
- queueMicrotask(() => {
- while (this._callbacks.length !== 0) {
- let cb = this._callbacks.pop();
- clearTimeout(cb.timeoutId);
- cb.doneCb();
- }
- });
- } else {
- let pending = this.getPendingTasks();
- this._callbacks = this._callbacks.filter((cb) => {
- if (cb.updateCb && cb.updateCb(pending)) {
- clearTimeout(cb.timeoutId);
- return false;
- }
- return true;
- });
- }
- }
- getPendingTasks() {
- if (!this.taskTrackingZone) {
- return [];
- }
- return this.taskTrackingZone.macroTasks.map((t) => {
- return {
- source: t.source,
- // From TaskTrackingZone:
- // https://github.com/angular/zone.js/blob/master/lib/zone-spec/task-tracking.ts#L40
- creationLocation: t.creationLocation,
- data: t.data
- };
- });
- }
- addCallback(cb, timeout2, updateCb) {
- let timeoutId = -1;
- if (timeout2 && timeout2 > 0) {
- timeoutId = setTimeout(() => {
- this._callbacks = this._callbacks.filter((cb2) => cb2.timeoutId !== timeoutId);
- cb();
- }, timeout2);
- }
- this._callbacks.push({ doneCb: cb, timeoutId, updateCb });
- }
- /**
- * Wait for the application to be stable with a timeout. If the timeout is reached before that
- * happens, the callback receives a list of the macro tasks that were pending, otherwise null.
- *
- * @param doneCb The callback to invoke when Angular is stable or the timeout expires
- * whichever comes first.
- * @param timeout Optional. The maximum time to wait for Angular to become stable. If not
- * specified, whenStable() will wait forever.
- * @param updateCb Optional. If specified, this callback will be invoked whenever the set of
- * pending macrotasks changes. If this callback returns true doneCb will not be invoked
- * and no further updates will be issued.
- */
- whenStable(doneCb, timeout2, updateCb) {
- if (updateCb && !this.taskTrackingZone) {
- throw new Error('Task tracking zone is required when passing an update callback to whenStable(). Is "zone.js/plugins/task-tracking" loaded?');
- }
- this.addCallback(doneCb, timeout2, updateCb);
- this._runCallbacksIfReady();
- }
- /**
- * Get the number of pending requests
- * @deprecated pending requests are now tracked with zones
- */
- getPendingRequestCount() {
- return this._pendingCount;
- }
- /**
- * Registers an application with a testability hook so that it can be tracked.
- * @param token token of application, root element
- *
- * @internal
- */
- registerApplication(token) {
- this.registry.registerApplication(token, this);
- }
- /**
- * Unregisters an application.
- * @param token token of application, root element
- *
- * @internal
- */
- unregisterApplication(token) {
- this.registry.unregisterApplication(token);
- }
- /**
- * Find providers by name
- * @param using The root element to search from
- * @param provider The name of binding variable
- * @param exactMatch Whether using exactMatch
- */
- findProviders(using, provider, exactMatch) {
- return [];
- }
- };
- _Testability.ɵfac = function Testability_Factory(t) {
- return new (t || _Testability)(ɵɵinject(NgZone), ɵɵinject(TestabilityRegistry), ɵɵinject(TESTABILITY_GETTER));
- };
- _Testability.ɵprov = ɵɵdefineInjectable({ token: _Testability, factory: _Testability.ɵfac });
- var Testability = _Testability;
- (() => {
- (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Testability, [{
- type: Injectable
- }], () => [{ type: NgZone }, { type: TestabilityRegistry }, { type: void 0, decorators: [{
- type: Inject,
- args: [TESTABILITY_GETTER]
- }] }], null);
- })();
- var _TestabilityRegistry = class _TestabilityRegistry {
- constructor() {
- this._applications = /* @__PURE__ */ new Map();
- }
- /**
- * Registers an application with a testability hook so that it can be tracked
- * @param token token of application, root element
- * @param testability Testability hook
- */
- registerApplication(token, testability) {
- this._applications.set(token, testability);
- }
- /**
- * Unregisters an application.
- * @param token token of application, root element
- */
- unregisterApplication(token) {
- this._applications.delete(token);
- }
- /**
- * Unregisters all applications
- */
- unregisterAllApplications() {
- this._applications.clear();
- }
- /**
- * Get a testability hook associated with the application
- * @param elem root element
- */
- getTestability(elem) {
- return this._applications.get(elem) || null;
- }
- /**
- * Get all registered testabilities
- */
- getAllTestabilities() {
- return Array.from(this._applications.values());
- }
- /**
- * Get all registered applications(root elements)
- */
- getAllRootElements() {
- return Array.from(this._applications.keys());
- }
- /**
- * Find testability of a node in the Tree
- * @param elem node
- * @param findInAncestors whether finding testability in ancestors if testability was not found in
- * current node
- */
- findTestabilityInTree(elem, findInAncestors = true) {
- return _testabilityGetter?.findTestabilityInTree(this, elem, findInAncestors) ?? null;
- }
- };
- _TestabilityRegistry.ɵfac = function TestabilityRegistry_Factory(t) {
- return new (t || _TestabilityRegistry)();
- };
- _TestabilityRegistry.ɵprov = ɵɵdefineInjectable({ token: _TestabilityRegistry, factory: _TestabilityRegistry.ɵfac, providedIn: "platform" });
- var TestabilityRegistry = _TestabilityRegistry;
- (() => {
- (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(TestabilityRegistry, [{
- type: Injectable,
- args: [{ providedIn: "platform" }]
- }], null, null);
- })();
- function setTestabilityGetter(getter) {
- _testabilityGetter = getter;
- }
- var _testabilityGetter;
- function isPromise(obj) {
- return !!obj && typeof obj.then === "function";
- }
- function isSubscribable(obj) {
- return !!obj && typeof obj.subscribe === "function";
- }
- var APP_INITIALIZER = new InjectionToken(ngDevMode ? "Application Initializer" : "");
- var _ApplicationInitStatus = class _ApplicationInitStatus {
- constructor() {
- this.initialized = false;
- this.done = false;
- this.donePromise = new Promise((res, rej) => {
- this.resolve = res;
- this.reject = rej;
- });
- this.appInits = inject(APP_INITIALIZER, { optional: true }) ?? [];
- if ((typeof ngDevMode === "undefined" || ngDevMode) && !Array.isArray(this.appInits)) {
- throw new RuntimeError(-209, `Unexpected type of the \`APP_INITIALIZER\` token value (expected an array, but got ${typeof this.appInits}). Please check that the \`APP_INITIALIZER\` token is configured as a \`multi: true\` provider.`);
- }
- }
- /** @internal */
- runInitializers() {
- if (this.initialized) {
- return;
- }
- const asyncInitPromises = [];
- for (const appInits of this.appInits) {
- const initResult = appInits();
- if (isPromise(initResult)) {
- asyncInitPromises.push(initResult);
- } else if (isSubscribable(initResult)) {
- const observableAsPromise = new Promise((resolve, reject) => {
- initResult.subscribe({ complete: resolve, error: reject });
- });
- asyncInitPromises.push(observableAsPromise);
- }
- }
- const complete = () => {
- this.done = true;
- this.resolve();
- };
- Promise.all(asyncInitPromises).then(() => {
- complete();
- }).catch((e) => {
- this.reject(e);
- });
- if (asyncInitPromises.length === 0) {
- complete();
- }
- this.initialized = true;
- }
- };
- _ApplicationInitStatus.ɵfac = function ApplicationInitStatus_Factory(t) {
- return new (t || _ApplicationInitStatus)();
- };
- _ApplicationInitStatus.ɵprov = ɵɵdefineInjectable({ token: _ApplicationInitStatus, factory: _ApplicationInitStatus.ɵfac, providedIn: "root" });
- var ApplicationInitStatus = _ApplicationInitStatus;
- (() => {
- (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ApplicationInitStatus, [{
- type: Injectable,
- args: [{ providedIn: "root" }]
- }], () => [], null);
- })();
- var APP_BOOTSTRAP_LISTENER = new InjectionToken(ngDevMode ? "appBootstrapListener" : "");
- function publishDefaultGlobalUtils() {
- ngDevMode && publishDefaultGlobalUtils$1();
- }
- function publishSignalConfiguration() {
- setThrowInvalidWriteToSignalError(() => {
- throw new RuntimeError(600, ngDevMode && "Writing to signals is not allowed in a `computed` or an `effect` by default. Use `allowSignalWrites` in the `CreateEffectOptions` to enable this inside effects.");
- });
- }
- function isBoundToModule(cf) {
- return cf.isBoundToModule;
- }
- var NgProbeToken = class {
- constructor(name, token) {
- this.name = name;
- this.token = token;
- }
- };
- function _callAndReportToErrorHandler(errorHandler, ngZone, callback) {
- try {
- const result = callback();
- if (isPromise(result)) {
- return result.catch((e) => {
- ngZone.runOutsideAngular(() => errorHandler.handleError(e));
- throw e;
- });
- }
- return result;
- } catch (e) {
- ngZone.runOutsideAngular(() => errorHandler.handleError(e));
- throw e;
- }
- }
- function optionsReducer(dst, objs) {
- if (Array.isArray(objs)) {
- return objs.reduce(optionsReducer, dst);
- }
- return __spreadValues(__spreadValues({}, dst), objs);
- }
- var _ApplicationRef = class _ApplicationRef {
- constructor() {
- this._bootstrapListeners = [];
- this._runningTick = false;
- this._destroyed = false;
- this._destroyListeners = [];
- this._views = [];
- this.internalErrorHandler = inject(INTERNAL_APPLICATION_ERROR_HANDLER);
- this.afterRenderEffectManager = inject(AfterRenderEventManager);
- this.componentTypes = [];
- this.components = [];
- this.isStable = inject(PendingTasks).hasPendingTasks.pipe(map((pending) => !pending));
- this._injector = inject(EnvironmentInjector);
- }
- /**
- * Indicates whether this instance was destroyed.
- */
- get destroyed() {
- return this._destroyed;
- }
- /**
- * The `EnvironmentInjector` used to create this application.
- */
- get injector() {
- return this._injector;
- }
- /**
- * Bootstrap a component onto the element identified by its selector or, optionally, to a
- * specified element.
- *
- * @usageNotes
- * ### Bootstrap process
- *
- * When bootstrapping a component, Angular mounts it onto a target DOM element
- * and kicks off automatic change detection. The target DOM element can be
- * provided using the `rootSelectorOrNode` argument.
- *
- * If the target DOM element is not provided, Angular tries to find one on a page
- * using the `selector` of the component that is being bootstrapped
- * (first matched element is used).
- *
- * ### Example
- *
- * Generally, we define the component to bootstrap in the `bootstrap` array of `NgModule`,
- * but it requires us to know the component while writing the application code.
- *
- * Imagine a situation where we have to wait for an API call to decide about the component to
- * bootstrap. We can use the `ngDoBootstrap` hook of the `NgModule` and call this method to
- * dynamically bootstrap a component.
- *
- * {@example core/ts/platform/platform.ts region='componentSelector'}
- *
- * Optionally, a component can be mounted onto a DOM element that does not match the
- * selector of the bootstrapped component.
- *
- * In the following example, we are providing a CSS selector to match the target element.
- *
- * {@example core/ts/platform/platform.ts region='cssSelector'}
- *
- * While in this example, we are providing reference to a DOM node.
- *
- * {@example core/ts/platform/platform.ts region='domNode'}
- */
- bootstrap(componentOrFactory, rootSelectorOrNode) {
- (typeof ngDevMode === "undefined" || ngDevMode) && this.warnIfDestroyed();
- const isComponentFactory = componentOrFactory instanceof ComponentFactory$1;
- const initStatus = this._injector.get(ApplicationInitStatus);
- if (!initStatus.done) {
- const standalone = !isComponentFactory && isStandalone(componentOrFactory);
- const errorMessage = (typeof ngDevMode === "undefined" || ngDevMode) && "Cannot bootstrap as there are still asynchronous initializers running." + (standalone ? "" : " Bootstrap components in the `ngDoBootstrap` method of the root module.");
- throw new RuntimeError(405, errorMessage);
- }
- let componentFactory;
- if (isComponentFactory) {
- componentFactory = componentOrFactory;
- } else {
- const resolver = this._injector.get(ComponentFactoryResolver$1);
- componentFactory = resolver.resolveComponentFactory(componentOrFactory);
- }
- this.componentTypes.push(componentFactory.componentType);
- const ngModule = isBoundToModule(componentFactory) ? void 0 : this._injector.get(NgModuleRef$1);
- const selectorOrNode = rootSelectorOrNode || componentFactory.selector;
- const compRef = componentFactory.create(Injector.NULL, [], selectorOrNode, ngModule);
- const nativeElement = compRef.location.nativeElement;
- const testability = compRef.injector.get(TESTABILITY, null);
- testability?.registerApplication(nativeElement);
- compRef.onDestroy(() => {
- this.detachView(compRef.hostView);
- remove(this.components, compRef);
- testability?.unregisterApplication(nativeElement);
- });
- this._loadComponent(compRef);
- if (typeof ngDevMode === "undefined" || ngDevMode) {
- const _console = this._injector.get(Console);
- _console.log(`Angular is running in development mode.`);
- }
- return compRef;
- }
- /**
- * Invoke this method to explicitly process change detection and its side-effects.
- *
- * In development mode, `tick()` also performs a second change detection cycle to ensure that no
- * further changes are detected. If additional changes are picked up during this second cycle,
- * bindings in the app have side-effects that cannot be resolved in a single change detection
- * pass.
- * In this case, Angular throws an error, since an Angular application can only have one change
- * detection pass during which all change detection must complete.
- */
- tick() {
- (typeof ngDevMode === "undefined" || ngDevMode) && this.warnIfDestroyed();
- if (this._runningTick) {
- throw new RuntimeError(101, ngDevMode && "ApplicationRef.tick is called recursively");
- }
- try {
- this._runningTick = true;
- this.detectChangesInAttachedViews();
- if (typeof ngDevMode === "undefined" || ngDevMode) {
- for (let view of this._views) {
- view.checkNoChanges();
- }
- }
- } catch (e) {
- this.internalErrorHandler(e);
- } finally {
- this._runningTick = false;
- }
- }
- detectChangesInAttachedViews() {
- let runs = 0;
- do {
- if (runs === MAXIMUM_REFRESH_RERUNS) {
- throw new RuntimeError(103, ngDevMode && "Changes in afterRender or afterNextRender hooks caused infinite change detection while refresh views.");
- }
- const isFirstPass = runs === 0;
- for (let { _lView, notifyErrorHandler } of this._views) {
- if (!isFirstPass && !shouldRecheckView(_lView)) {
- continue;
- }
- this.detectChangesInView(_lView, notifyErrorHandler, isFirstPass);
- }
- this.afterRenderEffectManager.execute();
- runs++;
- } while (this._views.some(({ _lView }) => shouldRecheckView(_lView)));
- }
- detectChangesInView(lView, notifyErrorHandler, isFirstPass) {
- let mode;
- if (isFirstPass) {
- mode = 0;
- lView[FLAGS] |= 1024;
- } else if (lView[FLAGS] & 64) {
- mode = 0;
- } else {
- mode = 1;
- }
- detectChangesInternal(lView, notifyErrorHandler, mode);
- }
- /**
- * Attaches a view so that it will be dirty checked.
- * The view will be automatically detached when it is destroyed.
- * This will throw if the view is already attached to a ViewContainer.
- */
- attachView(viewRef) {
- (typeof ngDevMode === "undefined" || ngDevMode) && this.warnIfDestroyed();
- const view = viewRef;
- this._views.push(view);
- view.attachToAppRef(this);
- }
- /**
- * Detaches a view from dirty checking again.
- */
- detachView(viewRef) {
- (typeof ngDevMode === "undefined" || ngDevMode) && this.warnIfDestroyed();
- const view = viewRef;
- remove(this._views, view);
- view.detachFromAppRef();
- }
- _loadComponent(componentRef) {
- this.attachView(componentRef.hostView);
- this.tick();
- this.components.push(componentRef);
- const listeners = this._injector.get(APP_BOOTSTRAP_LISTENER, []);
- if (ngDevMode && !Array.isArray(listeners)) {
- throw new RuntimeError(-209, `Unexpected type of the \`APP_BOOTSTRAP_LISTENER\` token value (expected an array, but got ${typeof listeners}). Please check that the \`APP_BOOTSTRAP_LISTENER\` token is configured as a \`multi: true\` provider.`);
- }
- [...this._bootstrapListeners, ...listeners].forEach((listener) => listener(componentRef));
- }
- /** @internal */
- ngOnDestroy() {
- if (this._destroyed)
- return;
- try {
- this._destroyListeners.forEach((listener) => listener());
- this._views.slice().forEach((view) => view.destroy());
- } finally {
- this._destroyed = true;
- this._views = [];
- this._bootstrapListeners = [];
- this._destroyListeners = [];
- }
- }
- /**
- * Registers a listener to be called when an instance is destroyed.
- *
- * @param callback A callback function to add as a listener.
- * @returns A function which unregisters a listener.
- */
- onDestroy(callback) {
- (typeof ngDevMode === "undefined" || ngDevMode) && this.warnIfDestroyed();
- this._destroyListeners.push(callback);
- return () => remove(this._destroyListeners, callback);
- }
- /**
- * Destroys an Angular application represented by this `ApplicationRef`. Calling this function
- * will destroy the associated environment injectors as well as all the bootstrapped components
- * with their views.
- */
- destroy() {
- if (this._destroyed) {
- throw new RuntimeError(406, ngDevMode && "This instance of the `ApplicationRef` has already been destroyed.");
- }
- const injector = this._injector;
- if (injector.destroy && !injector.destroyed) {
- injector.destroy();
- }
- }
- /**
- * Returns the number of attached views.
- */
- get viewCount() {
- return this._views.length;
- }
- warnIfDestroyed() {
- if ((typeof ngDevMode === "undefined" || ngDevMode) && this._destroyed) {
- console.warn(formatRuntimeError(406, "This instance of the `ApplicationRef` has already been destroyed."));
- }
- }
- };
- _ApplicationRef.ɵfac = function ApplicationRef_Factory(t) {
- return new (t || _ApplicationRef)();
- };
- _ApplicationRef.ɵprov = ɵɵdefineInjectable({ token: _ApplicationRef, factory: _ApplicationRef.ɵfac, providedIn: "root" });
- var ApplicationRef = _ApplicationRef;
- (() => {
- (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ApplicationRef, [{
- type: Injectable,
- args: [{ providedIn: "root" }]
- }], null, null);
- })();
- function remove(list, el) {
- const index = list.indexOf(el);
- if (index > -1) {
- list.splice(index, 1);
- }
- }
- var whenStableStore;
- function whenStable(applicationRef) {
- whenStableStore ??= /* @__PURE__ */ new WeakMap();
- const cachedWhenStable = whenStableStore.get(applicationRef);
- if (cachedWhenStable) {
- return cachedWhenStable;
- }
- const whenStablePromise = applicationRef.isStable.pipe(first((isStable) => isStable)).toPromise().then(() => void 0);
- whenStableStore.set(applicationRef, whenStablePromise);
- applicationRef.onDestroy(() => whenStableStore?.delete(applicationRef));
- return whenStablePromise;
- }
- function shouldRecheckView(view) {
- return requiresRefreshOrTraversal(view);
- }
- var ModuleWithComponentFactories = class {
- constructor(ngModuleFactory, componentFactories) {
- this.ngModuleFactory = ngModuleFactory;
- this.componentFactories = componentFactories;
- }
- };
- var _Compiler = class _Compiler {
- /**
- * Compiles the given NgModule and all of its components. All templates of the components
- * have to be inlined.
- */
- compileModuleSync(moduleType) {
- return new NgModuleFactory(moduleType);
- }
- /**
- * Compiles the given NgModule and all of its components
- */
- compileModuleAsync(moduleType) {
- return Promise.resolve(this.compileModuleSync(moduleType));
- }
- /**
- * Same as {@link #compileModuleSync} but also creates ComponentFactories for all components.
- */
- compileModuleAndAllComponentsSync(moduleType) {
- const ngModuleFactory = this.compileModuleSync(moduleType);
- const moduleDef = getNgModuleDef(moduleType);
- const componentFactories = maybeUnwrapFn(moduleDef.declarations).reduce((factories, declaration) => {
- const componentDef = getComponentDef(declaration);
- componentDef && factories.push(new ComponentFactory(componentDef));
- return factories;
- }, []);
- return new ModuleWithComponentFactories(ngModuleFactory, componentFactories);
- }
- /**
- * Same as {@link #compileModuleAsync} but also creates ComponentFactories for all components.
- */
- compileModuleAndAllComponentsAsync(moduleType) {
- return Promise.resolve(this.compileModuleAndAllComponentsSync(moduleType));
- }
- /**
- * Clears all caches.
- */
- clearCache() {
- }
- /**
- * Clears the cache for the given component/ngModule.
- */
- clearCacheFor(type) {
- }
- /**
- * Returns the id for a given NgModule, if one is defined and known to the compiler.
- */
- getModuleId(moduleType) {
- return void 0;
- }
- };
- _Compiler.ɵfac = function Compiler_Factory(t) {
- return new (t || _Compiler)();
- };
- _Compiler.ɵprov = ɵɵdefineInjectable({ token: _Compiler, factory: _Compiler.ɵfac, providedIn: "root" });
- var Compiler = _Compiler;
- (() => {
- (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Compiler, [{
- type: Injectable,
- args: [{ providedIn: "root" }]
- }], null, null);
- })();
- var COMPILER_OPTIONS = new InjectionToken(ngDevMode ? "compilerOptions" : "");
- var CompilerFactory = class {
- };
- function compileNgModuleFactory(injector, options, moduleType) {
- ngDevMode && assertNgModuleType(moduleType);
- const moduleFactory = new NgModuleFactory(moduleType);
- if (typeof ngJitMode !== "undefined" && !ngJitMode) {
- return Promise.resolve(moduleFactory);
- }
- const compilerOptions = injector.get(COMPILER_OPTIONS, []).concat(options);
- setJitOptions({
- defaultEncapsulation: _lastDefined(compilerOptions.map((opts) => opts.defaultEncapsulation)),
- preserveWhitespaces: _lastDefined(compilerOptions.map((opts) => opts.preserveWhitespaces))
- });
- if (isComponentResourceResolutionQueueEmpty()) {
- return Promise.resolve(moduleFactory);
- }
- const compilerProviders = compilerOptions.flatMap((option) => option.providers ?? []);
- if (compilerProviders.length === 0) {
- return Promise.resolve(moduleFactory);
- }
- const compiler = getCompilerFacade({
- usage: 0,
- kind: "NgModule",
- type: moduleType
- });
- const compilerInjector = Injector.create({ providers: compilerProviders });
- const resourceLoader = compilerInjector.get(compiler.ResourceLoader);
- return resolveComponentResources((url) => Promise.resolve(resourceLoader.get(url))).then(() => moduleFactory);
- }
- function _lastDefined(args) {
- for (let i = args.length - 1; i >= 0; i--) {
- if (args[i] !== void 0) {
- return args[i];
- }
- }
- return void 0;
- }
- var _NgZoneChangeDetectionScheduler = class _NgZoneChangeDetectionScheduler {
- constructor() {
- this.zone = inject(NgZone);
- this.applicationRef = inject(ApplicationRef);
- }
- initialize() {
- if (this._onMicrotaskEmptySubscription) {
- return;
- }
- this._onMicrotaskEmptySubscription = this.zone.onMicrotaskEmpty.subscribe({
- next: () => {
- this.zone.run(() => {
- this.applicationRef.tick();
- });
- }
- });
- }
- ngOnDestroy() {
- this._onMicrotaskEmptySubscription?.unsubscribe();
- }
- };
- _NgZoneChangeDetectionScheduler.ɵfac = function NgZoneChangeDetectionScheduler_Factory(t) {
- return new (t || _NgZoneChangeDetectionScheduler)();
- };
- _NgZoneChangeDetectionScheduler.ɵprov = ɵɵdefineInjectable({ token: _NgZoneChangeDetectionScheduler, factory: _NgZoneChangeDetectionScheduler.ɵfac, providedIn: "root" });
- var NgZoneChangeDetectionScheduler = _NgZoneChangeDetectionScheduler;
- (() => {
- (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgZoneChangeDetectionScheduler, [{
- type: Injectable,
- args: [{ providedIn: "root" }]
- }], null, null);
- })();
- var PROVIDED_NG_ZONE = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "provideZoneChangeDetection token" : "");
- function internalProvideZoneChangeDetection(ngZoneFactory) {
- return [
- { provide: NgZone, useFactory: ngZoneFactory },
- {
- provide: ENVIRONMENT_INITIALIZER,
- multi: true,
- useFactory: () => {
- const ngZoneChangeDetectionScheduler = inject(NgZoneChangeDetectionScheduler, { optional: true });
- if ((typeof ngDevMode === "undefined" || ngDevMode) && ngZoneChangeDetectionScheduler === null) {
- throw new RuntimeError(402, `A required Injectable was not found in the dependency injection tree. If you are bootstrapping an NgModule, make sure that the \`BrowserModule\` is imported.`);
- }
- return () => ngZoneChangeDetectionScheduler.initialize();
- }
- },
- {
- provide: ENVIRONMENT_INITIALIZER,
- multi: true,
- useFactory: () => {
- const service = inject(ZoneStablePendingTask);
- return () => {
- service.initialize();
- };
- }
- },
- { provide: INTERNAL_APPLICATION_ERROR_HANDLER, useFactory: ngZoneApplicationErrorHandlerFactory }
- ];
- }
- function ngZoneApplicationErrorHandlerFactory() {
- const zone = inject(NgZone);
- const userErrorHandler = inject(ErrorHandler);
- return (e) => zone.runOutsideAngular(() => userErrorHandler.handleError(e));
- }
- function provideZoneChangeDetection(options) {
- const zoneProviders = internalProvideZoneChangeDetection(() => new NgZone(getNgZoneOptions(options)));
- return makeEnvironmentProviders([
- typeof ngDevMode === "undefined" || ngDevMode ? { provide: PROVIDED_NG_ZONE, useValue: true } : [],
- zoneProviders
- ]);
- }
- function getNgZoneOptions(options) {
- return {
- enableLongStackTrace: typeof ngDevMode === "undefined" ? false : !!ngDevMode,
- shouldCoalesceEventChangeDetection: options?.eventCoalescing ?? false,
- shouldCoalesceRunChangeDetection: options?.runCoalescing ?? false
- };
- }
- var _ZoneStablePendingTask = class _ZoneStablePendingTask {
- constructor() {
- this.subscription = new Subscription();
- this.initialized = false;
- this.zone = inject(NgZone);
- this.pendingTasks = inject(PendingTasks);
- }
- initialize() {
- if (this.initialized) {
- return;
- }
- this.initialized = true;
- let task = null;
- if (!this.zone.isStable && !this.zone.hasPendingMacrotasks && !this.zone.hasPendingMicrotasks) {
- task = this.pendingTasks.add();
- }
- this.zone.runOutsideAngular(() => {
- this.subscription.add(this.zone.onStable.subscribe(() => {
- NgZone.assertNotInAngularZone();
- queueMicrotask(() => {
- if (task !== null && !this.zone.hasPendingMacrotasks && !this.zone.hasPendingMicrotasks) {
- this.pendingTasks.remove(task);
- task = null;
- }
- });
- }));
- });
- this.subscription.add(this.zone.onUnstable.subscribe(() => {
- NgZone.assertInAngularZone();
- task ??= this.pendingTasks.add();
- }));
- }
- ngOnDestroy() {
- this.subscription.unsubscribe();
- }
- };
- _ZoneStablePendingTask.ɵfac = function ZoneStablePendingTask_Factory(t) {
- return new (t || _ZoneStablePendingTask)();
- };
- _ZoneStablePendingTask.ɵprov = ɵɵdefineInjectable({ token: _ZoneStablePendingTask, factory: _ZoneStablePendingTask.ɵfac, providedIn: "root" });
- var ZoneStablePendingTask = _ZoneStablePendingTask;
- (() => {
- (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ZoneStablePendingTask, [{
- type: Injectable,
- args: [{ providedIn: "root" }]
- }], null, null);
- })();
- function getGlobalLocale() {
- if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode && typeof goog !== "undefined" && goog.LOCALE !== "en") {
- return goog.LOCALE;
- } else {
- return typeof $localize !== "undefined" && $localize.locale || DEFAULT_LOCALE_ID;
- }
- }
- var LOCALE_ID = new InjectionToken(ngDevMode ? "LocaleId" : "", {
- providedIn: "root",
- factory: () => inject(LOCALE_ID, InjectFlags.Optional | InjectFlags.SkipSelf) || getGlobalLocale()
- });
- var DEFAULT_CURRENCY_CODE = new InjectionToken(ngDevMode ? "DefaultCurrencyCode" : "", {
- providedIn: "root",
- factory: () => USD_CURRENCY_CODE
- });
- var TRANSLATIONS = new InjectionToken(ngDevMode ? "Translations" : "");
- var TRANSLATIONS_FORMAT = new InjectionToken(ngDevMode ? "TranslationsFormat" : "");
- var MissingTranslationStrategy;
- (function(MissingTranslationStrategy2) {
- MissingTranslationStrategy2[MissingTranslationStrategy2["Error"] = 0] = "Error";
- MissingTranslationStrategy2[MissingTranslationStrategy2["Warning"] = 1] = "Warning";
- MissingTranslationStrategy2[MissingTranslationStrategy2["Ignore"] = 2] = "Ignore";
- })(MissingTranslationStrategy || (MissingTranslationStrategy = {}));
- var PLATFORM_DESTROY_LISTENERS = new InjectionToken(ngDevMode ? "PlatformDestroyListeners" : "");
- var _PlatformRef = class _PlatformRef {
- /** @internal */
- constructor(_injector) {
- this._injector = _injector;
- this._modules = [];
- this._destroyListeners = [];
- this._destroyed = false;
- }
- /**
- * Creates an instance of an `@NgModule` for the given platform.
- *
- * @deprecated Passing NgModule factories as the `PlatformRef.bootstrapModuleFactory` function
- * argument is deprecated. Use the `PlatformRef.bootstrapModule` API instead.
- */
- bootstrapModuleFactory(moduleFactory, options) {
- const ngZone = getNgZone(options?.ngZone, getNgZoneOptions({
- eventCoalescing: options?.ngZoneEventCoalescing,
- runCoalescing: options?.ngZoneRunCoalescing
- }));
- return ngZone.run(() => {
- const moduleRef = createNgModuleRefWithProviders(moduleFactory.moduleType, this.injector, internalProvideZoneChangeDetection(() => ngZone));
- if ((typeof ngDevMode === "undefined" || ngDevMode) && moduleRef.injector.get(PROVIDED_NG_ZONE, null) !== null) {
- throw new RuntimeError(207, "`bootstrapModule` does not support `provideZoneChangeDetection`. Use `BootstrapOptions` instead.");
- }
- const exceptionHandler = moduleRef.injector.get(ErrorHandler, null);
- if ((typeof ngDevMode === "undefined" || ngDevMode) && exceptionHandler === null) {
- throw new RuntimeError(402, "No ErrorHandler. Is platform module (BrowserModule) included?");
- }
- ngZone.runOutsideAngular(() => {
- const subscription = ngZone.onError.subscribe({
- next: (error) => {
- exceptionHandler.handleError(error);
- }
- });
- moduleRef.onDestroy(() => {
- remove(this._modules, moduleRef);
- subscription.unsubscribe();
- });
- });
- return _callAndReportToErrorHandler(exceptionHandler, ngZone, () => {
- const initStatus = moduleRef.injector.get(ApplicationInitStatus);
- initStatus.runInitializers();
- return initStatus.donePromise.then(() => {
- const localeId = moduleRef.injector.get(LOCALE_ID, DEFAULT_LOCALE_ID);
- setLocaleId(localeId || DEFAULT_LOCALE_ID);
- this._moduleDoBootstrap(moduleRef);
- return moduleRef;
- });
- });
- });
- }
- /**
- * Creates an instance of an `@NgModule` for a given platform.
- *
- * @usageNotes
- * ### Simple Example
- *
- * ```typescript
- * @NgModule({
- * imports: [BrowserModule]
- * })
- * class MyModule {}
- *
- * let moduleRef = platformBrowser().bootstrapModule(MyModule);
- * ```
- *
- */
- bootstrapModule(moduleType, compilerOptions = []) {
- const options = optionsReducer({}, compilerOptions);
- return compileNgModuleFactory(this.injector, options, moduleType).then((moduleFactory) => this.bootstrapModuleFactory(moduleFactory, options));
- }
- _moduleDoBootstrap(moduleRef) {
- const appRef = moduleRef.injector.get(ApplicationRef);
- if (moduleRef._bootstrapComponents.length > 0) {
- moduleRef._bootstrapComponents.forEach((f) => appRef.bootstrap(f));
- } else if (moduleRef.instance.ngDoBootstrap) {
- moduleRef.instance.ngDoBootstrap(appRef);
- } else {
- throw new RuntimeError(-403, ngDevMode && `The module ${stringify(moduleRef.instance.constructor)} was bootstrapped, but it does not declare "@NgModule.bootstrap" components nor a "ngDoBootstrap" method. Please define one of these.`);
- }
- this._modules.push(moduleRef);
- }
- /**
- * Registers a listener to be called when the platform is destroyed.
- */
- onDestroy(callback) {
- this._destroyListeners.push(callback);
- }
- /**
- * Retrieves the platform {@link Injector}, which is the parent injector for
- * every Angular application on the page and provides singleton providers.
- */
- get injector() {
- return this._injector;
- }
- /**
- * Destroys the current Angular platform and all Angular applications on the page.
- * Destroys all modules and listeners registered with the platform.
- */
- destroy() {
- if (this._destroyed) {
- throw new RuntimeError(404, ngDevMode && "The platform has already been destroyed!");
- }
- this._modules.slice().forEach((module) => module.destroy());
- this._destroyListeners.forEach((listener) => listener());
- const destroyListeners = this._injector.get(PLATFORM_DESTROY_LISTENERS, null);
- if (destroyListeners) {
- destroyListeners.forEach((listener) => listener());
- destroyListeners.clear();
- }
- this._destroyed = true;
- }
- /**
- * Indicates whether this instance was destroyed.
- */
- get destroyed() {
- return this._destroyed;
- }
- };
- _PlatformRef.ɵfac = function PlatformRef_Factory(t) {
- return new (t || _PlatformRef)(ɵɵinject(Injector));
- };
- _PlatformRef.ɵprov = ɵɵdefineInjectable({ token: _PlatformRef, factory: _PlatformRef.ɵfac, providedIn: "platform" });
- var PlatformRef = _PlatformRef;
- (() => {
- (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PlatformRef, [{
- type: Injectable,
- args: [{ providedIn: "platform" }]
- }], () => [{ type: Injector }], null);
- })();
- var _platformInjector = null;
- var ALLOW_MULTIPLE_PLATFORMS = new InjectionToken(ngDevMode ? "AllowMultipleToken" : "");
- function createPlatform(injector) {
- if (_platformInjector && !_platformInjector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
- throw new RuntimeError(400, ngDevMode && "There can be only one platform. Destroy the previous one to create a new one.");
- }
- publishDefaultGlobalUtils();
- publishSignalConfiguration();
- _platformInjector = injector;
- const platform = injector.get(PlatformRef);
- runPlatformInitializers(injector);
- return platform;
- }
- function createPlatformFactory(parentPlatformFactory, name, providers = []) {
- const desc = `Platform: ${name}`;
- const marker = new InjectionToken(desc);
- return (extraProviders = []) => {
- let platform = getPlatform();
- if (!platform || platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
- const platformProviders = [...providers, ...extraProviders, { provide: marker, useValue: true }];
- if (parentPlatformFactory) {
- parentPlatformFactory(platformProviders);
- } else {
- createPlatform(createPlatformInjector(platformProviders, desc));
- }
- }
- return assertPlatform(marker);
- };
- }
- function createPlatformInjector(providers = [], name) {
- return Injector.create({
- name,
- providers: [
- { provide: INJECTOR_SCOPE, useValue: "platform" },
- { provide: PLATFORM_DESTROY_LISTENERS, useValue: /* @__PURE__ */ new Set([() => _platformInjector = null]) },
- ...providers
- ]
- });
- }
- function assertPlatform(requiredToken) {
- const platform = getPlatform();
- if (!platform) {
- throw new RuntimeError(401, ngDevMode && "No platform exists!");
- }
- if ((typeof ngDevMode === "undefined" || ngDevMode) && !platform.injector.get(requiredToken, null)) {
- throw new RuntimeError(400, "A platform with a different configuration has been created. Please destroy it first.");
- }
- return platform;
- }
- function getPlatform() {
- return _platformInjector?.get(PlatformRef) ?? null;
- }
- function destroyPlatform() {
- getPlatform()?.destroy();
- }
- function createOrReusePlatformInjector(providers = []) {
- if (_platformInjector)
- return _platformInjector;
- publishDefaultGlobalUtils();
- const injector = createPlatformInjector(providers);
- _platformInjector = injector;
- publishSignalConfiguration();
- runPlatformInitializers(injector);
- return injector;
- }
- function runPlatformInitializers(injector) {
- const inits = injector.get(PLATFORM_INITIALIZER, null);
- inits?.forEach((init) => init());
- }
- function isDevMode() {
- return typeof ngDevMode === "undefined" || !!ngDevMode;
- }
- function enableProdMode() {
- if (typeof ngDevMode === "undefined" || ngDevMode) {
- _global["ngDevMode"] = false;
- }
- }
- function getModuleFactory(id) {
- const type = getRegisteredNgModuleType(id);
- if (!type)
- throw noModuleError(id);
- return new NgModuleFactory(type);
- }
- function getNgModuleById(id) {
- const type = getRegisteredNgModuleType(id);
- if (!type)
- throw noModuleError(id);
- return type;
- }
- function noModuleError(id) {
- return new Error(`No module with ID ${id} loaded`);
- }
- var ViewRef = class extends ChangeDetectorRef {
- };
- var EmbeddedViewRef = class extends ViewRef {
- };
- var DebugEventListener = class {
- constructor(name, callback) {
- this.name = name;
- this.callback = callback;
- }
- };
- function asNativeElements(debugEls) {
- return debugEls.map((el) => el.nativeElement);
- }
- var DebugNode = class {
- constructor(nativeNode) {
- this.nativeNode = nativeNode;
- }
- /**
- * The `DebugElement` parent. Will be `null` if this is the root element.
- */
- get parent() {
- const parent = this.nativeNode.parentNode;
- return parent ? new DebugElement(parent) : null;
- }
- /**
- * The host dependency injector. For example, the root element's component instance injector.
- */
- get injector() {
- return getInjector(this.nativeNode);
- }
- /**
- * The element's own component instance, if it has one.
- */
- get componentInstance() {
- const nativeElement = this.nativeNode;
- return nativeElement && (getComponent(nativeElement) || getOwningComponent(nativeElement));
- }
- /**
- * An object that provides parent context for this element. Often an ancestor component instance
- * that governs this element.
- *
- * When an element is repeated within *ngFor, the context is an `NgForOf` whose `$implicit`
- * property is the value of the row instance value. For example, the `hero` in `*ngFor="let hero
- * of heroes"`.
- */
- get context() {
- return getComponent(this.nativeNode) || getContext(this.nativeNode);
- }
- /**
- * The callbacks attached to the component's @Output properties and/or the element's event
- * properties.
- */
- get listeners() {
- return getListeners(this.nativeNode).filter((listener) => listener.type === "dom");
- }
- /**
- * Dictionary of objects associated with template local variables (e.g. #foo), keyed by the local
- * variable name.
- */
- get references() {
- return getLocalRefs(this.nativeNode);
- }
- /**
- * This component's injector lookup tokens. Includes the component itself plus the tokens that the
- * component lists in its providers metadata.
- */
- get providerTokens() {
- return getInjectionTokens(this.nativeNode);
- }
- };
- var DebugElement = class extends DebugNode {
- constructor(nativeNode) {
- ngDevMode && assertDomNode(nativeNode);
- super(nativeNode);
- }
- /**
- * The underlying DOM element at the root of the component.
- */
- get nativeElement() {
- return this.nativeNode.nodeType == Node.ELEMENT_NODE ? this.nativeNode : null;
- }
- /**
- * The element tag name, if it is an element.
- */
- get name() {
- const context = getLContext(this.nativeNode);
- const lView = context ? context.lView : null;
- if (lView !== null) {
- const tData = lView[TVIEW].data;
- const tNode = tData[context.nodeIndex];
- return tNode.value;
- } else {
- return this.nativeNode.nodeName;
- }
- }
- /**
- * Gets a map of property names to property values for an element.
- *
- * This map includes:
- * - Regular property bindings (e.g. `[id]="id"`)
- * - Host property bindings (e.g. `host: { '[id]': "id" }`)
- * - Interpolated property bindings (e.g. `id="{{ value }}")
- *
- * It does not include:
- * - input property bindings (e.g. `[myCustomInput]="value"`)
- * - attribute bindings (e.g. `[attr.role]="menu"`)
- */
- get properties() {
- const context = getLContext(this.nativeNode);
- const lView = context ? context.lView : null;
- if (lView === null) {
- return {};
- }
- const tData = lView[TVIEW].data;
- const tNode = tData[context.nodeIndex];
- const properties = {};
- copyDomProperties(this.nativeElement, properties);
- collectPropertyBindings(properties, tNode, lView, tData);
- return properties;
- }
- /**
- * A map of attribute names to attribute values for an element.
- */
- // TODO: replace null by undefined in the return type
- get attributes() {
- const attributes = {};
- const element = this.nativeElement;
- if (!element) {
- return attributes;
- }
- const context = getLContext(element);
- const lView = context ? context.lView : null;
- if (lView === null) {
- return {};
- }
- const tNodeAttrs = lView[TVIEW].data[context.nodeIndex].attrs;
- const lowercaseTNodeAttrs = [];
- if (tNodeAttrs) {
- let i = 0;
- while (i < tNodeAttrs.length) {
- const attrName = tNodeAttrs[i];
- if (typeof attrName !== "string")
- break;
- const attrValue = tNodeAttrs[i + 1];
- attributes[attrName] = attrValue;
- lowercaseTNodeAttrs.push(attrName.toLowerCase());
- i += 2;
- }
- }
- for (const attr of element.attributes) {
- if (!lowercaseTNodeAttrs.includes(attr.name)) {
- attributes[attr.name] = attr.value;
- }
- }
- return attributes;
- }
- /**
- * The inline styles of the DOM element.
- */
- // TODO: replace null by undefined in the return type
- get styles() {
- const element = this.nativeElement;
- return element?.style ?? {};
- }
- /**
- * A map containing the class names on the element as keys.
- *
- * This map is derived from the `className` property of the DOM element.
- *
- * Note: The values of this object will always be `true`. The class key will not appear in the KV
- * object if it does not exist on the element.
- *
- * @see [Element.className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className)
- */
- get classes() {
- const result = {};
- const element = this.nativeElement;
- const className = element.className;
- const classes = typeof className !== "string" ? className.baseVal.split(" ") : className.split(" ");
- classes.forEach((value) => result[value] = true);
- return result;
- }
- /**
- * The `childNodes` of the DOM element as a `DebugNode` array.
- *
- * @see [Node.childNodes](https://developer.mozilla.org/en-US/docs/Web/API/Node/childNodes)
- */
- get childNodes() {
- const childNodes = this.nativeNode.childNodes;
- const children = [];
- for (let i = 0; i < childNodes.length; i++) {
- const element = childNodes[i];
- children.push(getDebugNode(element));
- }
- return children;
- }
- /**
- * The immediate `DebugElement` children. Walk the tree by descending through `children`.
- */
- get children() {
- const nativeElement = this.nativeElement;
- if (!nativeElement)
- return [];
- const childNodes = nativeElement.children;
- const children = [];
- for (let i = 0; i < childNodes.length; i++) {
- const element = childNodes[i];
- children.push(getDebugNode(element));
- }
- return children;
- }
- /**
- * @returns the first `DebugElement` that matches the predicate at any depth in the subtree.
- */
- query(predicate) {
- const results = this.queryAll(predicate);
- return results[0] || null;
- }
- /**
- * @returns All `DebugElement` matches for the predicate at any depth in the subtree.
- */
- queryAll(predicate) {
- const matches = [];
- _queryAll(this, predicate, matches, true);
- return matches;
- }
- /**
- * @returns All `DebugNode` matches for the predicate at any depth in the subtree.
- */
- queryAllNodes(predicate) {
- const matches = [];
- _queryAll(this, predicate, matches, false);
- return matches;
- }
- /**
- * Triggers the event by its name if there is a corresponding listener in the element's
- * `listeners` collection.
- *
- * If the event lacks a listener or there's some other problem, consider
- * calling `nativeElement.dispatchEvent(eventObject)`.
- *
- * @param eventName The name of the event to trigger
- * @param eventObj The _event object_ expected by the handler
- *
- * @see [Testing components scenarios](guide/testing-components-scenarios#trigger-event-handler)
- */
- triggerEventHandler(eventName, eventObj) {
- const node = this.nativeNode;
- const invokedListeners = [];
- this.listeners.forEach((listener) => {
- if (listener.name === eventName) {
- const callback = listener.callback;
- callback.call(node, eventObj);
- invokedListeners.push(callback);
- }
- });
- if (typeof node.eventListeners === "function") {
- node.eventListeners(eventName).forEach((listener) => {
- if (listener.toString().indexOf("__ngUnwrap__") !== -1) {
- const unwrappedListener = listener("__ngUnwrap__");
- return invokedListeners.indexOf(unwrappedListener) === -1 && unwrappedListener.call(node, eventObj);
- }
- });
- }
- }
- };
- function copyDomProperties(element, properties) {
- if (element) {
- let obj = Object.getPrototypeOf(element);
- const NodePrototype = Node.prototype;
- while (obj !== null && obj !== NodePrototype) {
- const descriptors = Object.getOwnPropertyDescriptors(obj);
- for (let key in descriptors) {
- if (!key.startsWith("__") && !key.startsWith("on")) {
- const value = element[key];
- if (isPrimitiveValue(value)) {
- properties[key] = value;
- }
- }
- }
- obj = Object.getPrototypeOf(obj);
- }
- }
- }
- function isPrimitiveValue(value) {
- return typeof value === "string" || typeof value === "boolean" || typeof value === "number" || value === null;
- }
- function _queryAll(parentElement, predicate, matches, elementsOnly) {
- const context = getLContext(parentElement.nativeNode);
- const lView = context ? context.lView : null;
- if (lView !== null) {
- const parentTNode = lView[TVIEW].data[context.nodeIndex];
- _queryNodeChildren(parentTNode, lView, predicate, matches, elementsOnly, parentElement.nativeNode);
- } else {
- _queryNativeNodeDescendants(parentElement.nativeNode, predicate, matches, elementsOnly);
- }
- }
- function _queryNodeChildren(tNode, lView, predicate, matches, elementsOnly, rootNativeNode) {
- ngDevMode && assertTNodeForLView(tNode, lView);
- const nativeNode = getNativeByTNodeOrNull(tNode, lView);
- if (tNode.type & (3 | 8)) {
- _addQueryMatch(nativeNode, predicate, matches, elementsOnly, rootNativeNode);
- if (isComponentHost(tNode)) {
- const componentView = getComponentLViewByIndex(tNode.index, lView);
- if (componentView && componentView[TVIEW].firstChild) {
- _queryNodeChildren(componentView[TVIEW].firstChild, componentView, predicate, matches, elementsOnly, rootNativeNode);
- }
- } else {
- if (tNode.child) {
- _queryNodeChildren(tNode.child, lView, predicate, matches, elementsOnly, rootNativeNode);
- }
- nativeNode && _queryNativeNodeDescendants(nativeNode, predicate, matches, elementsOnly);
- }
- const nodeOrContainer = lView[tNode.index];
- if (isLContainer(nodeOrContainer)) {
- _queryNodeChildrenInContainer(nodeOrContainer, predicate, matches, elementsOnly, rootNativeNode);
- }
- } else if (tNode.type & 4) {
- const lContainer = lView[tNode.index];
- _addQueryMatch(lContainer[NATIVE], predicate, matches, elementsOnly, rootNativeNode);
- _queryNodeChildrenInContainer(lContainer, predicate, matches, elementsOnly, rootNativeNode);
- } else if (tNode.type & 16) {
- const componentView = lView[DECLARATION_COMPONENT_VIEW];
- const componentHost = componentView[T_HOST];
- const head = componentHost.projection[tNode.projection];
- if (Array.isArray(head)) {
- for (let nativeNode2 of head) {
- _addQueryMatch(nativeNode2, predicate, matches, elementsOnly, rootNativeNode);
- }
- } else if (head) {
- const nextLView = componentView[PARENT];
- const nextTNode = nextLView[TVIEW].data[head.index];
- _queryNodeChildren(nextTNode, nextLView, predicate, matches, elementsOnly, rootNativeNode);
- }
- } else if (tNode.child) {
- _queryNodeChildren(tNode.child, lView, predicate, matches, elementsOnly, rootNativeNode);
- }
- if (rootNativeNode !== nativeNode) {
- const nextTNode = tNode.flags & 2 ? tNode.projectionNext : tNode.next;
- if (nextTNode) {
- _queryNodeChildren(nextTNode, lView, predicate, matches, elementsOnly, rootNativeNode);
- }
- }
- }
- function _queryNodeChildrenInContainer(lContainer, predicate, matches, elementsOnly, rootNativeNode) {
- for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
- const childView = lContainer[i];
- const firstChild = childView[TVIEW].firstChild;
- if (firstChild) {
- _queryNodeChildren(firstChild, childView, predicate, matches, elementsOnly, rootNativeNode);
- }
- }
- }
- function _addQueryMatch(nativeNode, predicate, matches, elementsOnly, rootNativeNode) {
- if (rootNativeNode !== nativeNode) {
- const debugNode = getDebugNode(nativeNode);
- if (!debugNode) {
- return;
- }
- if (elementsOnly && debugNode instanceof DebugElement && predicate(debugNode) && matches.indexOf(debugNode) === -1) {
- matches.push(debugNode);
- } else if (!elementsOnly && predicate(debugNode) && matches.indexOf(debugNode) === -1) {
- matches.push(debugNode);
- }
- }
- }
- function _queryNativeNodeDescendants(parentNode, predicate, matches, elementsOnly) {
- const nodes = parentNode.childNodes;
- const length = nodes.length;
- for (let i = 0; i < length; i++) {
- const node = nodes[i];
- const debugNode = getDebugNode(node);
- if (debugNode) {
- if (elementsOnly && debugNode instanceof DebugElement && predicate(debugNode) && matches.indexOf(debugNode) === -1) {
- matches.push(debugNode);
- } else if (!elementsOnly && predicate(debugNode) && matches.indexOf(debugNode) === -1) {
- matches.push(debugNode);
- }
- _queryNativeNodeDescendants(node, predicate, matches, elementsOnly);
- }
- }
- }
- function collectPropertyBindings(properties, tNode, lView, tData) {
- let bindingIndexes = tNode.propertyBindings;
- if (bindingIndexes !== null) {
- for (let i = 0; i < bindingIndexes.length; i++) {
- const bindingIndex = bindingIndexes[i];
- const propMetadata = tData[bindingIndex];
- const metadataParts = propMetadata.split(INTERPOLATION_DELIMITER);
- const propertyName = metadataParts[0];
- if (metadataParts.length > 1) {
- let value = metadataParts[1];
- for (let j = 1; j < metadataParts.length - 1; j++) {
- value += renderStringify(lView[bindingIndex + j - 1]) + metadataParts[j + 1];
- }
- properties[propertyName] = value;
- } else {
- properties[propertyName] = lView[bindingIndex];
- }
- }
- }
- }
- var NG_DEBUG_PROPERTY = "__ng_debug__";
- function getDebugNode(nativeNode) {
- if (nativeNode instanceof Node) {
- if (!nativeNode.hasOwnProperty(NG_DEBUG_PROPERTY)) {
- nativeNode[NG_DEBUG_PROPERTY] = nativeNode.nodeType == Node.ELEMENT_NODE ? new DebugElement(nativeNode) : new DebugNode(nativeNode);
- }
- return nativeNode[NG_DEBUG_PROPERTY];
- }
- return null;
- }
- var platformCore = createPlatformFactory(null, "core", []);
- var _ApplicationModule = class _ApplicationModule {
- // Inject ApplicationRef to make it eager...
- constructor(appRef) {
- }
- };
- _ApplicationModule.ɵfac = function ApplicationModule_Factory(t) {
- return new (t || _ApplicationModule)(ɵɵinject(ApplicationRef));
- };
- _ApplicationModule.ɵmod = ɵɵdefineNgModule({ type: _ApplicationModule });
- _ApplicationModule.ɵinj = ɵɵdefineInjector({});
- var ApplicationModule = _ApplicationModule;
- (() => {
- (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ApplicationModule, [{
- type: NgModule
- }], () => [{ type: ApplicationRef }], null);
- })();
- function defaultEquals2(a, b) {
- return Object.is(a, b);
- }
- var activeConsumer2 = null;
- var SIGNAL2 = Symbol("SIGNAL");
- function setActiveConsumer2(consumer) {
- const prev = activeConsumer2;
- activeConsumer2 = consumer;
- return prev;
- }
- var REACTIVE_NODE2 = {
- version: 0,
- lastCleanEpoch: 0,
- dirty: false,
- producerNode: void 0,
- producerLastReadVersion: void 0,
- producerIndexOfThis: void 0,
- nextProducerIndex: 0,
- liveConsumerNode: void 0,
- liveConsumerIndexOfThis: void 0,
- consumerAllowSignalWrites: false,
- consumerIsAlwaysLive: false,
- producerMustRecompute: () => false,
- producerRecomputeValue: () => {
- },
- consumerMarkedDirty: () => {
- },
- consumerOnSignalRead: () => {
- }
- };
- function consumerBeforeComputation2(node) {
- node && (node.nextProducerIndex = 0);
- return setActiveConsumer2(node);
- }
- function consumerAfterComputation2(node, prevConsumer) {
- setActiveConsumer2(prevConsumer);
- if (!node || node.producerNode === void 0 || node.producerIndexOfThis === void 0 || node.producerLastReadVersion === void 0) {
- return;
- }
- if (consumerIsLive2(node)) {
- for (let i = node.nextProducerIndex; i < node.producerNode.length; i++) {
- producerRemoveLiveConsumerAtIndex2(node.producerNode[i], node.producerIndexOfThis[i]);
- }
- }
- while (node.producerNode.length > node.nextProducerIndex) {
- node.producerNode.pop();
- node.producerLastReadVersion.pop();
- node.producerIndexOfThis.pop();
- }
- }
- function producerRemoveLiveConsumerAtIndex2(node, idx) {
- assertProducerNode2(node);
- assertConsumerNode2(node);
- if (typeof ngDevMode !== "undefined" && ngDevMode && idx >= node.liveConsumerNode.length) {
- throw new Error(`Assertion error: active consumer index ${idx} is out of bounds of ${node.liveConsumerNode.length} consumers)`);
- }
- if (node.liveConsumerNode.length === 1) {
- for (let i = 0; i < node.producerNode.length; i++) {
- producerRemoveLiveConsumerAtIndex2(node.producerNode[i], node.producerIndexOfThis[i]);
- }
- }
- const lastIdx = node.liveConsumerNode.length - 1;
- node.liveConsumerNode[idx] = node.liveConsumerNode[lastIdx];
- node.liveConsumerIndexOfThis[idx] = node.liveConsumerIndexOfThis[lastIdx];
- node.liveConsumerNode.length--;
- node.liveConsumerIndexOfThis.length--;
- if (idx < node.liveConsumerNode.length) {
- const idxProducer = node.liveConsumerIndexOfThis[idx];
- const consumer = node.liveConsumerNode[idx];
- assertConsumerNode2(consumer);
- consumer.producerIndexOfThis[idxProducer] = idx;
- }
- }
- function consumerIsLive2(node) {
- return node.consumerIsAlwaysLive || (node?.liveConsumerNode?.length ?? 0) > 0;
- }
- function assertConsumerNode2(node) {
- node.producerNode ??= [];
- node.producerIndexOfThis ??= [];
- node.producerLastReadVersion ??= [];
- }
- function assertProducerNode2(node) {
- node.liveConsumerNode ??= [];
- node.liveConsumerIndexOfThis ??= [];
- }
- var UNSET2 = Symbol("UNSET");
- var COMPUTING2 = Symbol("COMPUTING");
- var ERRORED2 = Symbol("ERRORED");
- var COMPUTED_NODE2 = (() => {
- return __spreadProps(__spreadValues({}, REACTIVE_NODE2), {
- value: UNSET2,
- dirty: true,
- error: null,
- equal: defaultEquals2,
- producerMustRecompute(node) {
- return node.value === UNSET2 || node.value === COMPUTING2;
- },
- producerRecomputeValue(node) {
- if (node.value === COMPUTING2) {
- throw new Error("Detected cycle in computations.");
- }
- const oldValue = node.value;
- node.value = COMPUTING2;
- const prevConsumer = consumerBeforeComputation2(node);
- let newValue;
- try {
- newValue = node.computation();
- } catch (err) {
- newValue = ERRORED2;
- node.error = err;
- } finally {
- consumerAfterComputation2(node, prevConsumer);
- }
- if (oldValue !== UNSET2 && oldValue !== ERRORED2 && newValue !== ERRORED2 && node.equal(oldValue, newValue)) {
- node.value = oldValue;
- return;
- }
- node.value = newValue;
- node.version++;
- }
- });
- })();
- var SIGNAL_NODE2 = (() => {
- return __spreadProps(__spreadValues({}, REACTIVE_NODE2), {
- equal: defaultEquals2,
- value: void 0
- });
- })();
- var NOOP_CLEANUP_FN2 = () => {
- };
- var WATCH_NODE2 = (() => {
- return __spreadProps(__spreadValues({}, REACTIVE_NODE2), {
- consumerIsAlwaysLive: true,
- consumerAllowSignalWrites: false,
- consumerMarkedDirty: (node) => {
- if (node.schedule !== null) {
- node.schedule(node.ref);
- }
- },
- hasRun: false,
- cleanupFn: NOOP_CLEANUP_FN2
- });
- })();
- function setAlternateWeakRefImpl(impl) {
- }
- var SCAN_DELAY = 200;
- var OVERSIZED_IMAGE_TOLERANCE = 1200;
- var _ImagePerformanceWarning = class _ImagePerformanceWarning {
- constructor() {
- this.window = null;
- this.observer = null;
- this.options = inject(IMAGE_CONFIG);
- this.ngZone = inject(NgZone);
- }
- start() {
- if (typeof PerformanceObserver === "undefined" || this.options?.disableImageSizeWarning && this.options?.disableImageLazyLoadWarning) {
- return;
- }
- this.observer = this.initPerformanceObserver();
- const doc = getDocument();
- const win = doc.defaultView;
- if (typeof win !== "undefined") {
- this.window = win;
- const waitToScan = () => {
- setTimeout(this.scanImages.bind(this), SCAN_DELAY);
- };
- this.ngZone.runOutsideAngular(() => {
- if (doc.readyState === "complete") {
- waitToScan();
- } else {
- this.window?.addEventListener("load", waitToScan, { once: true });
- }
- });
- }
- }
- ngOnDestroy() {
- this.observer?.disconnect();
- }
- initPerformanceObserver() {
- if (typeof PerformanceObserver === "undefined") {
- return null;
- }
- const observer = new PerformanceObserver((entryList) => {
- const entries = entryList.getEntries();
- if (entries.length === 0)
- return;
- const lcpElement = entries[entries.length - 1];
- const imgSrc = lcpElement.element?.src ?? "";
- if (imgSrc.startsWith("data:") || imgSrc.startsWith("blob:"))
- return;
- this.lcpImageUrl = imgSrc;
- });
- observer.observe({ type: "largest-contentful-paint", buffered: true });
- return observer;
- }
- scanImages() {
- const images = getDocument().querySelectorAll("img");
- let lcpElementFound, lcpElementLoadedCorrectly = false;
- images.forEach((image) => {
- if (!this.options?.disableImageSizeWarning) {
- for (const image2 of images) {
- if (!image2.getAttribute("ng-img") && this.isOversized(image2)) {
- logOversizedImageWarning(image2.src);
- }
- }
- }
- if (!this.options?.disableImageLazyLoadWarning && this.lcpImageUrl) {
- if (image.src === this.lcpImageUrl) {
- lcpElementFound = true;
- if (image.loading !== "lazy" || image.getAttribute("ng-img")) {
- lcpElementLoadedCorrectly = true;
- }
- }
- }
- });
- if (lcpElementFound && !lcpElementLoadedCorrectly && this.lcpImageUrl && !this.options?.disableImageLazyLoadWarning) {
- logLazyLCPWarning(this.lcpImageUrl);
- }
- }
- isOversized(image) {
- if (!this.window) {
- return false;
- }
- const computedStyle = this.window.getComputedStyle(image);
- let renderedWidth = parseFloat(computedStyle.getPropertyValue("width"));
- let renderedHeight = parseFloat(computedStyle.getPropertyValue("height"));
- const boxSizing = computedStyle.getPropertyValue("box-sizing");
- const objectFit = computedStyle.getPropertyValue("object-fit");
- if (objectFit === `cover`) {
- return false;
- }
- if (boxSizing === "border-box") {
- const paddingTop = computedStyle.getPropertyValue("padding-top");
- const paddingRight = computedStyle.getPropertyValue("padding-right");
- const paddingBottom = computedStyle.getPropertyValue("padding-bottom");
- const paddingLeft = computedStyle.getPropertyValue("padding-left");
- renderedWidth -= parseFloat(paddingRight) + parseFloat(paddingLeft);
- renderedHeight -= parseFloat(paddingTop) + parseFloat(paddingBottom);
- }
- const intrinsicWidth = image.naturalWidth;
- const intrinsicHeight = image.naturalHeight;
- const recommendedWidth = this.window.devicePixelRatio * renderedWidth;
- const recommendedHeight = this.window.devicePixelRatio * renderedHeight;
- const oversizedWidth = intrinsicWidth - recommendedWidth >= OVERSIZED_IMAGE_TOLERANCE;
- const oversizedHeight = intrinsicHeight - recommendedHeight >= OVERSIZED_IMAGE_TOLERANCE;
- return oversizedWidth || oversizedHeight;
- }
- };
- _ImagePerformanceWarning.ɵfac = function ImagePerformanceWarning_Factory(t) {
- return new (t || _ImagePerformanceWarning)();
- };
- _ImagePerformanceWarning.ɵprov = ɵɵdefineInjectable({ token: _ImagePerformanceWarning, factory: _ImagePerformanceWarning.ɵfac, providedIn: "root" });
- var ImagePerformanceWarning = _ImagePerformanceWarning;
- (() => {
- (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ImagePerformanceWarning, [{
- type: Injectable,
- args: [{ providedIn: "root" }]
- }], null, null);
- })();
- function logLazyLCPWarning(src) {
- console.warn(formatRuntimeError(-913, `An image with src ${src} is the Largest Contentful Paint (LCP) element but was given a "loading" value of "lazy", which can negatively impact application loading performance. This warning can be addressed by changing the loading value of the LCP image to "eager", or by using the NgOptimizedImage directive's prioritization utilities. For more information about addressing or disabling this warning, see https://angular.io/errors/NG0913`));
- }
- function logOversizedImageWarning(src) {
- console.warn(formatRuntimeError(-913, `An image with src ${src} has intrinsic file dimensions much larger than its rendered size. This can negatively impact application loading performance. For more information about addressing or disabling this warning, see https://angular.io/errors/NG0913`));
- }
- function internalCreateApplication(config) {
- try {
- const { rootComponent, appProviders, platformProviders } = config;
- if ((typeof ngDevMode === "undefined" || ngDevMode) && rootComponent !== void 0) {
- assertStandaloneComponentType(rootComponent);
- }
- const platformInjector = createOrReusePlatformInjector(platformProviders);
- const allAppProviders = [
- provideZoneChangeDetection(),
- ...appProviders || []
- ];
- const adapter = new EnvironmentNgModuleRefAdapter({
- providers: allAppProviders,
- parent: platformInjector,
- debugName: typeof ngDevMode === "undefined" || ngDevMode ? "Environment Injector" : "",
- // We skip environment initializers because we need to run them inside the NgZone, which
- // happens after we get the NgZone instance from the Injector.
- runEnvironmentInitializers: false
- });
- const envInjector = adapter.injector;
- const ngZone = envInjector.get(NgZone);
- return ngZone.run(() => {
- envInjector.resolveInjectorInitializers();
- const exceptionHandler = envInjector.get(ErrorHandler, null);
- if ((typeof ngDevMode === "undefined" || ngDevMode) && !exceptionHandler) {
- throw new RuntimeError(402, "No `ErrorHandler` found in the Dependency Injection tree.");
- }
- let onErrorSubscription;
- ngZone.runOutsideAngular(() => {
- onErrorSubscription = ngZone.onError.subscribe({
- next: (error) => {
- exceptionHandler.handleError(error);
- }
- });
- });
- const destroyListener = () => envInjector.destroy();
- const onPlatformDestroyListeners = platformInjector.get(PLATFORM_DESTROY_LISTENERS);
- onPlatformDestroyListeners.add(destroyListener);
- envInjector.onDestroy(() => {
- onErrorSubscription.unsubscribe();
- onPlatformDestroyListeners.delete(destroyListener);
- });
- return _callAndReportToErrorHandler(exceptionHandler, ngZone, () => {
- const initStatus = envInjector.get(ApplicationInitStatus);
- initStatus.runInitializers();
- return initStatus.donePromise.then(() => {
- const localeId = envInjector.get(LOCALE_ID, DEFAULT_LOCALE_ID);
- setLocaleId(localeId || DEFAULT_LOCALE_ID);
- const appRef = envInjector.get(ApplicationRef);
- if (rootComponent !== void 0) {
- appRef.bootstrap(rootComponent);
- }
- if (typeof ngDevMode === "undefined" || ngDevMode) {
- const imagePerformanceService = envInjector.get(ImagePerformanceWarning);
- imagePerformanceService.start();
- }
- return appRef;
- });
- });
- });
- } catch (e) {
- return Promise.reject(e);
- }
- }
- var _ChangeDetectionSchedulerImpl = class _ChangeDetectionSchedulerImpl {
- constructor() {
- this.appRef = inject(ApplicationRef);
- this.taskService = inject(PendingTasks);
- this.pendingRenderTaskId = null;
- }
- notify() {
- if (this.pendingRenderTaskId !== null)
- return;
- this.pendingRenderTaskId = this.taskService.add();
- this.raceTimeoutAndRequestAnimationFrame();
- }
- /**
- * Run change detection after the first of setTimeout and requestAnimationFrame resolves.
- *
- * - `requestAnimationFrame` ensures that change detection runs ahead of a browser repaint.
- * This ensures that the create and update passes of a change detection always happen
- * in the same frame.
- * - When the browser is resource-starved, `rAF` can execute _before_ a `setTimeout` because
- * rendering is a very high priority process. This means that `setTimeout` cannot guarantee
- * same-frame create and update pass, when `setTimeout` is used to schedule the update phase.
- * - While `rAF` gives us the desirable same-frame updates, it has two limitations that
- * prevent it from being used alone. First, it does not run in background tabs, which would
- * prevent Angular from initializing an application when opened in a new tab (for example).
- * Second, repeated calls to requestAnimationFrame will execute at the refresh rate of the
- * hardware (~16ms for a 60Hz display). This would cause significant slowdown of tests that
- * are written with several updates and asserts in the form of "update; await stable; assert;".
- * - Both `setTimeout` and `rAF` are able to "coalesce" several events from a single user
- * interaction into a single change detection. Importantly, this reduces view tree traversals when
- * compared to an alternative timing mechanism like `queueMicrotask`, where change detection would
- * then be interleaves between each event.
- *
- * By running change detection after the first of `setTimeout` and `rAF` to execute, we get the
- * best of both worlds.
- */
- raceTimeoutAndRequestAnimationFrame() {
- return __async(this, null, function* () {
- const timeout2 = new Promise((resolve) => setTimeout(resolve));
- const rAF = typeof _global["requestAnimationFrame"] === "function" ? new Promise((resolve) => requestAnimationFrame(() => resolve())) : null;
- yield Promise.race([timeout2, rAF]);
- this.tick();
- });
- }
- tick() {
- try {
- if (!this.appRef.destroyed) {
- this.appRef.tick();
- }
- } finally {
- const taskId = this.pendingRenderTaskId;
- this.pendingRenderTaskId = null;
- this.taskService.remove(taskId);
- }
- }
- };
- _ChangeDetectionSchedulerImpl.ɵfac = function ChangeDetectionSchedulerImpl_Factory(t) {
- return new (t || _ChangeDetectionSchedulerImpl)();
- };
- _ChangeDetectionSchedulerImpl.ɵprov = ɵɵdefineInjectable({ token: _ChangeDetectionSchedulerImpl, factory: _ChangeDetectionSchedulerImpl.ɵfac, providedIn: "root" });
- var ChangeDetectionSchedulerImpl = _ChangeDetectionSchedulerImpl;
- (() => {
- (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ChangeDetectionSchedulerImpl, [{
- type: Injectable,
- args: [{ providedIn: "root" }]
- }], null, null);
- })();
- function provideZonelessChangeDetection() {
- return makeEnvironmentProviders([
- { provide: ChangeDetectionScheduler, useExisting: ChangeDetectionSchedulerImpl },
- { provide: NgZone, useClass: NoopNgZone }
- ]);
- }
- function getDeferBlocks(lView, deferBlocks) {
- const tView = lView[TVIEW];
- for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) {
- if (isLContainer(lView[i])) {
- const lContainer = lView[i];
- const isLast = i === tView.bindingStartIndex - 1;
- if (!isLast) {
- const tNode = tView.data[i];
- const tDetails = getTDeferBlockDetails(tView, tNode);
- if (isTDeferBlockDetails(tDetails)) {
- deferBlocks.push({ lContainer, lView, tNode, tDetails });
- continue;
- }
- }
- for (let i2 = CONTAINER_HEADER_OFFSET; i2 < lContainer.length; i2++) {
- getDeferBlocks(lContainer[i2], deferBlocks);
- }
- } else if (isLView(lView[i])) {
- getDeferBlocks(lView[i], deferBlocks);
- }
- }
- }
- var SerializedViewCollection = class {
- constructor() {
- this.views = [];
- this.indexByContent = /* @__PURE__ */ new Map();
- }
- add(serializedView) {
- const viewAsString = JSON.stringify(serializedView);
- if (!this.indexByContent.has(viewAsString)) {
- const index = this.views.length;
- this.views.push(serializedView);
- this.indexByContent.set(viewAsString, index);
- return index;
- }
- return this.indexByContent.get(viewAsString);
- }
- getAll() {
- return this.views;
- }
- };
- var tViewSsrId = 0;
- function getSsrId(tView) {
- if (!tView.ssrId) {
- tView.ssrId = `t${tViewSsrId++}`;
- }
- return tView.ssrId;
- }
- function calcNumRootNodes(tView, lView, tNode) {
- const rootNodes = [];
- collectNativeNodes(tView, lView, tNode, rootNodes);
- return rootNodes.length;
- }
- function calcNumRootNodesInLContainer(lContainer) {
- const rootNodes = [];
- collectNativeNodesInLContainer(lContainer, rootNodes);
- return rootNodes.length;
- }
- function annotateComponentLViewForHydration(lView, context) {
- const hostElement = lView[HOST];
- if (hostElement && !hostElement.hasAttribute(SKIP_HYDRATION_ATTR_NAME)) {
- return annotateHostElementForHydration(hostElement, lView, context);
- }
- return null;
- }
- function annotateLContainerForHydration(lContainer, context) {
- const componentLView = unwrapLView(lContainer[HOST]);
- const componentLViewNghIndex = annotateComponentLViewForHydration(componentLView, context);
- const hostElement = unwrapRNode(componentLView[HOST]);
- const rootLView = lContainer[PARENT];
- const rootLViewNghIndex = annotateHostElementForHydration(hostElement, rootLView, context);
- const renderer = componentLView[RENDERER];
- const finalIndex = `${componentLViewNghIndex}|${rootLViewNghIndex}`;
- renderer.setAttribute(hostElement, NGH_ATTR_NAME, finalIndex);
- }
- function annotateForHydration(appRef, doc) {
- const serializedViewCollection = new SerializedViewCollection();
- const corruptedTextNodes = /* @__PURE__ */ new Map();
- const viewRefs = appRef._views;
- for (const viewRef of viewRefs) {
- const lNode = getLNodeForHydration(viewRef);
- if (lNode !== null) {
- const context = {
- serializedViewCollection,
- corruptedTextNodes
- };
- if (isLContainer(lNode)) {
- annotateLContainerForHydration(lNode, context);
- } else {
- annotateComponentLViewForHydration(lNode, context);
- }
- insertCorruptedTextNodeMarkers(corruptedTextNodes, doc);
- }
- }
- const serializedViews = serializedViewCollection.getAll();
- const transferState = appRef.injector.get(TransferState);
- transferState.set(NGH_DATA_KEY, serializedViews);
- }
- function serializeLContainer(lContainer, context) {
- const views = [];
- let lastViewAsString = "";
- for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
- let childLView = lContainer[i];
- let template;
- let numRootNodes;
- let serializedView;
- if (isRootView(childLView)) {
- childLView = childLView[HEADER_OFFSET];
- if (isLContainer(childLView)) {
- numRootNodes = calcNumRootNodesInLContainer(childLView) + 1;
- annotateLContainerForHydration(childLView, context);
- const componentLView = unwrapLView(childLView[HOST]);
- serializedView = {
- [TEMPLATE_ID]: componentLView[TVIEW].ssrId,
- [NUM_ROOT_NODES]: numRootNodes
- };
- }
- }
- if (!serializedView) {
- const childTView = childLView[TVIEW];
- if (childTView.type === 1) {
- template = childTView.ssrId;
- numRootNodes = 1;
- } else {
- template = getSsrId(childTView);
- numRootNodes = calcNumRootNodes(childTView, childLView, childTView.firstChild);
- }
- serializedView = __spreadValues({
- [TEMPLATE_ID]: template,
- [NUM_ROOT_NODES]: numRootNodes
- }, serializeLView(lContainer[i], context));
- }
- const currentViewAsString = JSON.stringify(serializedView);
- if (views.length > 0 && currentViewAsString === lastViewAsString) {
- const previousView = views[views.length - 1];
- previousView[MULTIPLIER] ??= 1;
- previousView[MULTIPLIER]++;
- } else {
- lastViewAsString = currentViewAsString;
- views.push(serializedView);
- }
- }
- return views;
- }
- function appendSerializedNodePath(ngh, tNode, lView) {
- const noOffsetIndex = tNode.index - HEADER_OFFSET;
- ngh[NODES] ??= {};
- ngh[NODES][noOffsetIndex] = calcPathForNode(tNode, lView);
- }
- function appendDisconnectedNodeIndex(ngh, tNode) {
- const noOffsetIndex = tNode.index - HEADER_OFFSET;
- ngh[DISCONNECTED_NODES] ??= [];
- if (!ngh[DISCONNECTED_NODES].includes(noOffsetIndex)) {
- ngh[DISCONNECTED_NODES].push(noOffsetIndex);
- }
- }
- function serializeLView(lView, context) {
- const ngh = {};
- const tView = lView[TVIEW];
- for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) {
- const tNode = tView.data[i];
- const noOffsetIndex = i - HEADER_OFFSET;
- if (!isTNodeShape(tNode)) {
- continue;
- }
- if (isDisconnectedNode(tNode, lView) && isContentProjectedNode(tNode)) {
- appendDisconnectedNodeIndex(ngh, tNode);
- continue;
- }
- if (Array.isArray(tNode.projection)) {
- for (const projectionHeadTNode of tNode.projection) {
- if (!projectionHeadTNode)
- continue;
- if (!Array.isArray(projectionHeadTNode)) {
- if (!isProjectionTNode(projectionHeadTNode) && !isInSkipHydrationBlock(projectionHeadTNode)) {
- if (isDisconnectedNode(projectionHeadTNode, lView)) {
- appendDisconnectedNodeIndex(ngh, projectionHeadTNode);
- } else {
- appendSerializedNodePath(ngh, projectionHeadTNode, lView);
- }
- }
- } else {
- throw unsupportedProjectionOfDomNodes(unwrapRNode(lView[i]));
- }
- }
- }
- conditionallyAnnotateNodePath(ngh, tNode, lView);
- if (isLContainer(lView[i])) {
- const embeddedTView = tNode.tView;
- if (embeddedTView !== null) {
- ngh[TEMPLATES] ??= {};
- ngh[TEMPLATES][noOffsetIndex] = getSsrId(embeddedTView);
- }
- const hostNode = lView[i][HOST];
- if (Array.isArray(hostNode)) {
- const targetNode = unwrapRNode(hostNode);
- if (!targetNode.hasAttribute(SKIP_HYDRATION_ATTR_NAME)) {
- annotateHostElementForHydration(targetNode, hostNode, context);
- }
- }
- ngh[CONTAINERS] ??= {};
- ngh[CONTAINERS][noOffsetIndex] = serializeLContainer(lView[i], context);
- } else if (Array.isArray(lView[i])) {
- const targetNode = unwrapRNode(lView[i][HOST]);
- if (!targetNode.hasAttribute(SKIP_HYDRATION_ATTR_NAME)) {
- annotateHostElementForHydration(targetNode, lView[i], context);
- }
- } else {
- if (tNode.type & 8) {
- ngh[ELEMENT_CONTAINERS] ??= {};
- ngh[ELEMENT_CONTAINERS][noOffsetIndex] = calcNumRootNodes(tView, lView, tNode.child);
- } else if (tNode.type & 16) {
- let nextTNode = tNode.next;
- while (nextTNode !== null && nextTNode.type & 16) {
- nextTNode = nextTNode.next;
- }
- if (nextTNode && !isInSkipHydrationBlock(nextTNode)) {
- appendSerializedNodePath(ngh, nextTNode, lView);
- }
- } else {
- if (tNode.type & 1) {
- const rNode = unwrapRNode(lView[i]);
- if (rNode.textContent === "") {
- context.corruptedTextNodes.set(
- rNode,
- "ngetn"
- /* TextNodeMarker.EmptyNode */
- );
- } else if (rNode.nextSibling?.nodeType === Node.TEXT_NODE) {
- context.corruptedTextNodes.set(
- rNode,
- "ngtns"
- /* TextNodeMarker.Separator */
- );
- }
- }
- }
- }
- }
- return ngh;
- }
- function conditionallyAnnotateNodePath(ngh, tNode, lView) {
- if (tNode.projectionNext && tNode.projectionNext !== tNode.next && !isInSkipHydrationBlock(tNode.projectionNext)) {
- appendSerializedNodePath(ngh, tNode.projectionNext, lView);
- }
- if (tNode.prev === null && tNode.parent !== null && isDisconnectedNode(tNode.parent, lView) && !isDisconnectedNode(tNode, lView)) {
- appendSerializedNodePath(ngh, tNode, lView);
- }
- }
- function componentUsesShadowDomEncapsulation(lView) {
- const instance = lView[CONTEXT];
- return instance?.constructor ? getComponentDef(instance.constructor)?.encapsulation === ViewEncapsulation$1.ShadowDom : false;
- }
- function annotateHostElementForHydration(element, lView, context) {
- const renderer = lView[RENDERER];
- if (hasI18n(lView) || componentUsesShadowDomEncapsulation(lView)) {
- renderer.setAttribute(element, SKIP_HYDRATION_ATTR_NAME, "");
- return null;
- } else {
- const ngh = serializeLView(lView, context);
- const index = context.serializedViewCollection.add(ngh);
- renderer.setAttribute(element, NGH_ATTR_NAME, index.toString());
- return index;
- }
- }
- function insertCorruptedTextNodeMarkers(corruptedTextNodes, doc) {
- for (const [textNode, marker] of corruptedTextNodes) {
- textNode.after(doc.createComment(marker));
- }
- }
- function isContentProjectedNode(tNode) {
- let currentTNode = tNode;
- while (currentTNode != null) {
- if (isComponentHost(currentTNode)) {
- return true;
- }
- currentTNode = currentTNode.parent;
- }
- return false;
- }
- var isHydrationSupportEnabled = false;
- var APPLICATION_IS_STABLE_TIMEOUT = 1e4;
- function enableHydrationRuntimeSupport() {
- if (!isHydrationSupportEnabled) {
- isHydrationSupportEnabled = true;
- enableRetrieveHydrationInfoImpl();
- enableLocateOrCreateElementNodeImpl();
- enableLocateOrCreateTextNodeImpl();
- enableLocateOrCreateElementContainerNodeImpl();
- enableLocateOrCreateContainerAnchorImpl();
- enableLocateOrCreateContainerRefImpl();
- enableFindMatchingDehydratedViewImpl();
- enableApplyRootElementTransformImpl();
- }
- }
- function printHydrationStats(injector) {
- const console2 = injector.get(Console);
- const message = `Angular hydrated ${ngDevMode.hydratedComponents} component(s) and ${ngDevMode.hydratedNodes} node(s), ${ngDevMode.componentsSkippedHydration} component(s) were skipped. Learn more at https://angular.io/guide/hydration.`;
- console2.log(message);
- }
- function whenStableWithTimeout(appRef, injector) {
- const whenStablePromise = whenStable(appRef);
- if (typeof ngDevMode !== "undefined" && ngDevMode) {
- const timeoutTime = APPLICATION_IS_STABLE_TIMEOUT;
- const console2 = injector.get(Console);
- const ngZone = injector.get(NgZone);
- const timeoutId = ngZone.runOutsideAngular(() => {
- return setTimeout(() => logWarningOnStableTimedout(timeoutTime, console2), timeoutTime);
- });
- whenStablePromise.finally(() => clearTimeout(timeoutId));
- }
- return whenStablePromise;
- }
- function withDomHydration() {
- return makeEnvironmentProviders([
- {
- provide: IS_HYDRATION_DOM_REUSE_ENABLED,
- useFactory: () => {
- let isEnabled = true;
- if (isPlatformBrowser()) {
- const transferState = inject(TransferState, { optional: true });
- isEnabled = !!transferState?.get(NGH_DATA_KEY, null);
- if (!isEnabled && (typeof ngDevMode !== "undefined" && ngDevMode)) {
- const console2 = inject(Console);
- const message = formatRuntimeError(-505, "Angular hydration was requested on the client, but there was no serialized information present in the server response, thus hydration was not enabled. Make sure the `provideClientHydration()` is included into the list of providers in the server part of the application configuration.");
- console2.warn(message);
- }
- }
- if (isEnabled) {
- performanceMarkFeature("NgHydration");
- }
- return isEnabled;
- }
- },
- {
- provide: ENVIRONMENT_INITIALIZER,
- useValue: () => {
- if (isPlatformBrowser() && inject(IS_HYDRATION_DOM_REUSE_ENABLED)) {
- verifySsrContentsIntegrity();
- enableHydrationRuntimeSupport();
- }
- },
- multi: true
- },
- {
- provide: PRESERVE_HOST_CONTENT,
- useFactory: () => {
- return isPlatformBrowser() && inject(IS_HYDRATION_DOM_REUSE_ENABLED);
- }
- },
- {
- provide: APP_BOOTSTRAP_LISTENER,
- useFactory: () => {
- if (isPlatformBrowser() && inject(IS_HYDRATION_DOM_REUSE_ENABLED)) {
- const appRef = inject(ApplicationRef);
- const injector = inject(Injector);
- return () => {
- whenStableWithTimeout(appRef, injector).then(() => {
- NgZone.assertInAngularZone();
- cleanupDehydratedViews(appRef);
- if (typeof ngDevMode !== "undefined" && ngDevMode) {
- printHydrationStats(injector);
- }
- });
- };
- }
- return () => {
- };
- },
- multi: true
- }
- ]);
- }
- function logWarningOnStableTimedout(time, console2) {
- const message = `Angular hydration expected the ApplicationRef.isStable() to emit \`true\`, but it didn't happen within ${time}ms. Angular hydration logic depends on the application becoming stable as a signal to complete hydration process.`;
- console2.warn(formatRuntimeError(-506, message));
- }
- function verifySsrContentsIntegrity() {
- const doc = getDocument();
- let hydrationMarker;
- for (const node of doc.body.childNodes) {
- if (node.nodeType === Node.COMMENT_NODE && node.textContent?.trim() === SSR_CONTENT_INTEGRITY_MARKER) {
- hydrationMarker = node;
- break;
- }
- }
- if (!hydrationMarker) {
- 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 booleanAttribute(value) {
- return typeof value === "boolean" ? value : value != null && value !== "false";
- }
- function numberAttribute(value, fallbackValue = NaN) {
- const isNumberValue = !isNaN(parseFloat(value)) && !isNaN(Number(value));
- return isNumberValue ? Number(value) : fallbackValue;
- }
- function ɵɵngDeclareDirective(decl) {
- const compiler = getCompilerFacade({ usage: 1, kind: "directive", type: decl.type });
- return compiler.compileDirectiveDeclaration(angularCoreEnv, `ng:///${decl.type.name}/ɵfac.js`, decl);
- }
- function ɵɵngDeclareClassMetadata(decl) {
- setClassMetadata(decl.type, decl.decorators, decl.ctorParameters ?? null, decl.propDecorators ?? null);
- }
- function ɵɵngDeclareComponent(decl) {
- const compiler = getCompilerFacade({ usage: 1, kind: "component", type: decl.type });
- return compiler.compileComponentDeclaration(angularCoreEnv, `ng:///${decl.type.name}/ɵcmp.js`, decl);
- }
- function ɵɵngDeclareFactory(decl) {
- const compiler = getCompilerFacade({
- usage: 1,
- kind: getFactoryKind(decl.target),
- type: decl.type
- });
- return compiler.compileFactoryDeclaration(angularCoreEnv, `ng:///${decl.type.name}/ɵfac.js`, decl);
- }
- function getFactoryKind(target) {
- switch (target) {
- case FactoryTarget.Directive:
- return "directive";
- case FactoryTarget.Component:
- return "component";
- case FactoryTarget.Injectable:
- return "injectable";
- case FactoryTarget.Pipe:
- return "pipe";
- case FactoryTarget.NgModule:
- return "NgModule";
- }
- }
- function ɵɵngDeclareInjectable(decl) {
- const compiler = getCompilerFacade({ usage: 1, kind: "injectable", type: decl.type });
- return compiler.compileInjectableDeclaration(angularCoreEnv, `ng:///${decl.type.name}/ɵprov.js`, decl);
- }
- function ɵɵngDeclareInjector(decl) {
- const compiler = getCompilerFacade({ usage: 1, kind: "NgModule", type: decl.type });
- return compiler.compileInjectorDeclaration(angularCoreEnv, `ng:///${decl.type.name}/ɵinj.js`, decl);
- }
- function ɵɵngDeclareNgModule(decl) {
- const compiler = getCompilerFacade({ usage: 1, kind: "NgModule", type: decl.type });
- return compiler.compileNgModuleDeclaration(angularCoreEnv, `ng:///${decl.type.name}/ɵmod.js`, decl);
- }
- function ɵɵngDeclarePipe(decl) {
- const compiler = getCompilerFacade({ usage: 1, kind: "pipe", type: decl.type });
- return compiler.compilePipeDeclaration(angularCoreEnv, `ng:///${decl.type.name}/ɵpipe.js`, decl);
- }
- function createComponent(component, options) {
- ngDevMode && assertComponentDef(component);
- const componentDef = getComponentDef(component);
- const elementInjector = options.elementInjector || getNullInjector();
- const factory = new ComponentFactory(componentDef);
- return factory.create(elementInjector, options.projectableNodes, options.hostElement, options.environmentInjector);
- }
- function reflectComponentType(component) {
- const componentDef = getComponentDef(component);
- if (!componentDef)
- return null;
- const factory = new ComponentFactory(componentDef);
- return {
- get selector() {
- return factory.selector;
- },
- get type() {
- return factory.componentType;
- },
- get inputs() {
- return factory.inputs;
- },
- get outputs() {
- return factory.outputs;
- },
- get ngContentSelectors() {
- return factory.ngContentSelectors;
- },
- get isStandalone() {
- return componentDef.standalone;
- },
- get isSignal() {
- return componentDef.signals;
- }
- };
- }
- function mergeApplicationConfig(...configs) {
- return configs.reduce((prev, curr) => {
- return Object.assign(prev, curr, { providers: [...prev.providers, ...curr.providers] });
- }, { providers: [] });
- }
- if (typeof ngDevMode !== "undefined" && ngDevMode) {
- _global.$localize ??= function() {
- throw new Error("It looks like your application or one of its dependencies is using i18n.\nAngular 9 introduced a global `$localize()` function that needs to be loaded.\nPlease run `ng add @angular/localize` from the Angular CLI.\n(For non-CLI projects, add `import '@angular/localize/init';` to your `polyfills.ts` file.\nFor server-side rendering applications add the import to your `main.server.ts` file.)");
- };
- }
-
- export {
- XSS_SECURITY_URL,
- RuntimeError,
- formatRuntimeError,
- ɵINPUT_SIGNAL_BRAND_WRITE_TYPE,
- EventEmitter,
- output,
- input,
- InjectFlags,
- stringify,
- truncateMiddle,
- ChangeDetectionStrategy,
- ViewEncapsulation$1,
- noSideEffects,
- _global,
- NG_COMP_DEF,
- NG_DIR_DEF,
- NG_PIPE_DEF,
- NG_MOD_DEF,
- NG_ELEMENT_ID,
- InputFlags,
- ɵɵdefineComponent,
- ɵɵdefineNgModule,
- ɵɵdefineDirective,
- ɵɵdefinePipe,
- isStandalone,
- CONTAINER_HEADER_OFFSET,
- getEnsureDirtyViewsAreAlwaysReachable,
- setEnsureDirtyViewsAreAlwaysReachable,
- ɵɵenableBindings,
- ɵɵdisableBindings,
- ɵɵrestoreView,
- ɵɵresetView,
- ɵɵnamespaceSVG,
- ɵɵnamespaceMathML,
- ɵɵnamespaceHTML,
- ElementRef,
- QueryList,
- setDocument,
- ɵɵdefineInjectable,
- defineInjectable,
- ɵɵdefineInjector,
- getInjectableDef,
- isInjectable,
- NG_PROV_DEF,
- NG_INJ_DEF,
- InjectionToken,
- APP_ID,
- PLATFORM_INITIALIZER,
- PLATFORM_ID,
- PACKAGE_ROOT_URL,
- ANIMATION_MODULE_TYPE,
- CSP_NONCE,
- IMAGE_CONFIG_DEFAULTS,
- IMAGE_CONFIG,
- forwardRef,
- resolveForwardRef,
- setInjectorProfilerContext,
- isEnvironmentProviders,
- setCurrentInjector,
- ɵɵinject,
- ɵɵinvalidFactoryDep,
- inject,
- convertToBitFlags,
- makeStateKey,
- TransferState,
- SSR_CONTENT_INTEGRITY_MARKER,
- readHydrationInfo,
- Inject,
- Optional,
- Self,
- SkipSelf,
- Host,
- ENVIRONMENT_INITIALIZER,
- INJECTOR,
- makeEnvironmentProviders,
- importProvidersFrom,
- INJECTOR_SCOPE,
- EnvironmentInjector,
- runInInjectionContext,
- assertInInjectionContext,
- FactoryTarget,
- Type,
- ReflectionCapabilities,
- SimpleChange,
- ɵɵNgOnChangesFeature,
- ɵɵgetInheritedFactory,
- ɵɵinjectAttribute,
- Attribute,
- Injectable,
- createInjector,
- Injector,
- ErrorHandler,
- IS_HYDRATION_DOM_REUSE_ENABLED,
- unwrapSafeValue,
- allowSanitizationBypassAndThrow,
- getSanitizationBypassType,
- bypassSanitizationTrustHtml,
- bypassSanitizationTrustStyle,
- bypassSanitizationTrustScript,
- bypassSanitizationTrustUrl,
- bypassSanitizationTrustResourceUrl,
- _sanitizeUrl,
- _sanitizeHtml,
- SecurityContext,
- ɵɵsanitizeHtml,
- ɵɵsanitizeStyle,
- ɵɵsanitizeUrl,
- ɵɵsanitizeResourceUrl,
- ɵɵsanitizeScript,
- ɵɵtrustConstantHtml,
- ɵɵtrustConstantResourceUrl,
- ɵɵsanitizeUrlOrResourceUrl,
- LContext,
- getLContext,
- CUSTOM_ELEMENTS_SCHEMA,
- NO_ERRORS_SCHEMA,
- ɵsetUnknownElementStrictMode,
- ɵgetUnknownElementStrictMode,
- ɵsetUnknownPropertyStrictMode,
- ɵgetUnknownPropertyStrictMode,
- ɵɵresolveWindow,
- ɵɵresolveDocument,
- ɵɵresolveBody,
- RendererStyleFlags2,
- NO_CHANGE,
- ɵɵadvance,
- ɵɵdirectiveInject,
- ɵɵinvalidFactory,
- ViewRef$1,
- TemplateRef,
- ChangeDetectionScheduler,
- ComponentRef$1,
- ComponentFactory$1,
- ComponentFactoryResolver$1,
- RendererFactory2,
- Renderer2,
- Sanitizer,
- NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR,
- isSignal,
- computed,
- ɵunwrapWritableSignal,
- signal,
- untracked,
- DefaultIterableDiffer,
- IterableDiffers,
- KeyValueDiffers,
- devModeEqual,
- ChangeDetectorRef,
- injectChangeDetectorRef,
- defaultIterableDiffers,
- defaultKeyValueDiffers,
- DestroyRef,
- assertNotInReactiveContext,
- EffectScheduler,
- effect,
- performanceMarkFeature,
- NgZone,
- NoopNgZone,
- AfterRenderPhase,
- internalAfterNextRender,
- afterRender,
- afterNextRender,
- AfterRenderEventManager,
- isNgModule,
- USE_RUNTIME_DEPS_TRACKER_FOR_JIT,
- depsTracker,
- ComponentFactory,
- ComponentRef,
- LifecycleHooksFeature,
- ViewContainerRef,
- viewChild,
- viewChildren,
- contentChild,
- contentChildren,
- model,
- Query,
- ContentChildren,
- ContentChild,
- ViewChildren,
- ViewChild,
- resolveComponentResources,
- isComponentDefPendingResolution,
- clearResolutionOfComponentResourcesQueue,
- restoreComponentResolutionQueue,
- registerNgModuleType,
- setAllowDuplicateNgModuleIdsForTest,
- ɵɵvalidateIframeAttribute,
- ɵɵInheritDefinitionFeature,
- ɵɵCopyDefinitionFeature,
- ɵɵHostDirectivesFeature,
- ɵɵInputTransformsFeature,
- getAsyncClassMetadataFn,
- setClassMetadataAsync,
- setClassMetadata,
- NgModuleRef$1,
- NgModuleFactory$1,
- createNgModule,
- createNgModuleRef,
- NgModuleRef,
- NgModuleFactory,
- createEnvironmentInjector,
- PendingTasks,
- ɵɵtemplate,
- DeferBlockState,
- DeferBlockBehavior,
- DEFER_BLOCK_DEPENDENCY_INTERCEPTOR,
- DEFER_BLOCK_CONFIG,
- ɵɵdeferEnableTimerScheduling,
- ɵɵdefer,
- ɵɵdeferWhen,
- ɵɵdeferPrefetchWhen,
- ɵɵdeferOnIdle,
- ɵɵdeferPrefetchOnIdle,
- ɵɵdeferOnImmediate,
- ɵɵdeferPrefetchOnImmediate,
- ɵɵdeferOnTimer,
- ɵɵdeferPrefetchOnTimer,
- ɵɵdeferOnHover,
- ɵɵdeferPrefetchOnHover,
- ɵɵdeferOnInteraction,
- ɵɵdeferPrefetchOnInteraction,
- ɵɵdeferOnViewport,
- ɵɵdeferPrefetchOnViewport,
- renderDeferBlockState,
- triggerResourceLoading,
- ɵɵattribute,
- ɵɵattributeInterpolate1,
- ɵɵattributeInterpolate2,
- ɵɵattributeInterpolate3,
- ɵɵattributeInterpolate4,
- ɵɵattributeInterpolate5,
- ɵɵattributeInterpolate6,
- ɵɵattributeInterpolate7,
- ɵɵattributeInterpolate8,
- ɵɵattributeInterpolateV,
- ɵɵproperty,
- ɵɵstyleProp,
- ɵɵclassProp,
- ɵɵstyleMap,
- ɵɵclassMap,
- ɵɵclassMapInterpolate1,
- ɵɵclassMapInterpolate2,
- ɵɵclassMapInterpolate3,
- ɵɵclassMapInterpolate4,
- ɵɵclassMapInterpolate5,
- ɵɵclassMapInterpolate6,
- ɵɵclassMapInterpolate7,
- ɵɵclassMapInterpolate8,
- ɵɵclassMapInterpolateV,
- ɵɵcomponentInstance,
- ɵɵconditional,
- ɵɵrepeaterTrackByIndex,
- ɵɵrepeaterTrackByIdentity,
- ɵɵrepeaterCreate,
- ɵɵrepeater,
- ɵɵelementStart,
- ɵɵelementEnd,
- ɵɵelement,
- ɵɵelementContainerStart,
- ɵɵelementContainerEnd,
- ɵɵelementContainer,
- ɵɵgetCurrentView,
- ɵɵhostProperty,
- ɵɵsyntheticHostProperty,
- registerLocaleData,
- findLocaleData,
- getLocaleCurrencyCode,
- getLocalePluralCase,
- unregisterAllLocaleData,
- LocaleDataIndex,
- DEFAULT_LOCALE_ID,
- setLocaleId,
- ɵɵi18nStart,
- ɵɵi18nEnd,
- ɵɵi18n,
- ɵɵi18nAttributes,
- ɵɵi18nExp,
- ɵɵi18nApply,
- ɵɵi18nPostprocess,
- ɵɵlistener,
- ɵɵsyntheticHostListener,
- ɵɵnextContext,
- ɵɵprojectionDef,
- ɵɵprojection,
- ɵɵpropertyInterpolate,
- ɵɵpropertyInterpolate1,
- ɵɵpropertyInterpolate2,
- ɵɵpropertyInterpolate3,
- ɵɵpropertyInterpolate4,
- ɵɵpropertyInterpolate5,
- ɵɵpropertyInterpolate6,
- ɵɵpropertyInterpolate7,
- ɵɵpropertyInterpolate8,
- ɵɵpropertyInterpolateV,
- ɵɵcontentQuery,
- ɵɵviewQuery,
- ɵɵqueryRefresh,
- ɵɵloadQuery,
- ɵɵcontentQuerySignal,
- ɵɵviewQuerySignal,
- ɵɵqueryAdvance,
- store,
- ɵɵreference,
- ɵɵstyleMapInterpolate1,
- ɵɵstyleMapInterpolate2,
- ɵɵstyleMapInterpolate3,
- ɵɵstyleMapInterpolate4,
- ɵɵstyleMapInterpolate5,
- ɵɵstyleMapInterpolate6,
- ɵɵstyleMapInterpolate7,
- ɵɵstyleMapInterpolate8,
- ɵɵstyleMapInterpolateV,
- ɵɵstylePropInterpolate1,
- ɵɵstylePropInterpolate2,
- ɵɵstylePropInterpolate3,
- ɵɵstylePropInterpolate4,
- ɵɵstylePropInterpolate5,
- ɵɵstylePropInterpolate6,
- ɵɵstylePropInterpolate7,
- ɵɵstylePropInterpolate8,
- ɵɵstylePropInterpolateV,
- ɵɵtext,
- ɵɵtextInterpolate,
- ɵɵtextInterpolate1,
- ɵɵtextInterpolate2,
- ɵɵtextInterpolate3,
- ɵɵtextInterpolate4,
- ɵɵtextInterpolate5,
- ɵɵtextInterpolate6,
- ɵɵtextInterpolate7,
- ɵɵtextInterpolate8,
- ɵɵtextInterpolateV,
- ɵɵtwoWayProperty,
- ɵɵtwoWayBindingSet,
- ɵɵtwoWayListener,
- ɵɵProvidersFeature,
- ɵɵStandaloneFeature,
- ɵɵsetComponentScope,
- ɵɵsetNgModuleScope,
- getDirectives,
- getHostElement,
- ɵɵpureFunction0,
- ɵɵpureFunction1,
- ɵɵpureFunction2,
- ɵɵpureFunction3,
- ɵɵpureFunction4,
- ɵɵpureFunction5,
- ɵɵpureFunction6,
- ɵɵpureFunction7,
- ɵɵpureFunction8,
- ɵɵpureFunctionV,
- ɵɵpipe,
- ɵɵpipeBind1,
- ɵɵpipeBind2,
- ɵɵpipeBind3,
- ɵɵpipeBind4,
- ɵɵpipeBindV,
- ɵɵtemplateRefExtractor,
- ɵɵgetComponentDepsFactory,
- ɵsetClassDebugInfo,
- resetJitOptions,
- flushModuleScopingQueueAsMuchAsPossible,
- compileNgModule,
- compileNgModuleDefs,
- generateStandaloneInDeclarationsError,
- resetCompiledComponents,
- patchComponentDefWithScope,
- transitiveScopesFor,
- compileComponent,
- compileDirective,
- compilePipe,
- Directive,
- Component,
- Pipe,
- Input,
- Output,
- HostBinding,
- HostListener,
- NgModule,
- Version,
- VERSION,
- Console,
- TESTABILITY,
- TESTABILITY_GETTER,
- Testability,
- TestabilityRegistry,
- setTestabilityGetter,
- isPromise,
- isSubscribable,
- APP_INITIALIZER,
- ApplicationInitStatus,
- APP_BOOTSTRAP_LISTENER,
- isBoundToModule,
- NgProbeToken,
- ApplicationRef,
- whenStable,
- ModuleWithComponentFactories,
- Compiler,
- COMPILER_OPTIONS,
- CompilerFactory,
- compileNgModuleFactory,
- provideZoneChangeDetection,
- LOCALE_ID,
- DEFAULT_CURRENCY_CODE,
- TRANSLATIONS,
- TRANSLATIONS_FORMAT,
- MissingTranslationStrategy,
- PlatformRef,
- ALLOW_MULTIPLE_PLATFORMS,
- createPlatform,
- createPlatformFactory,
- assertPlatform,
- getPlatform,
- destroyPlatform,
- isDevMode,
- enableProdMode,
- getModuleFactory,
- getNgModuleById,
- ViewRef,
- EmbeddedViewRef,
- DebugEventListener,
- asNativeElements,
- DebugNode,
- DebugElement,
- getDebugNode,
- platformCore,
- ApplicationModule,
- setAlternateWeakRefImpl,
- internalCreateApplication,
- provideZonelessChangeDetection,
- getDeferBlocks,
- annotateForHydration,
- withDomHydration,
- booleanAttribute,
- numberAttribute,
- ɵɵngDeclareDirective,
- ɵɵngDeclareClassMetadata,
- ɵɵngDeclareComponent,
- ɵɵngDeclareFactory,
- ɵɵngDeclareInjectable,
- ɵɵngDeclareInjector,
- ɵɵngDeclareNgModule,
- ɵɵngDeclarePipe,
- createComponent,
- reflectComponentType,
- mergeApplicationConfig
- };
- /*! Bundled license information:
-
- @angular/core/fesm2022/primitives/signals.mjs:
- (**
- * @license Angular v17.2.2
- * (c) 2010-2022 Google LLC. https://angular.io/
- * License: MIT
- *)
-
- @angular/core/fesm2022/core.mjs:
- (**
- * @license Angular v17.2.2
- * (c) 2010-2022 Google LLC. https://angular.io/
- * License: MIT
- *)
-
- @angular/core/fesm2022/core.mjs:
- (*!
- * @license
- * Copyright Google LLC All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- *)
-
- @angular/core/fesm2022/core.mjs:
- (*!
- * @license
- * Copyright Google LLC All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- *)
- */
- //# sourceMappingURL=chunk-NYIFMCVF.js.map
|