Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@angular/core

Package Overview
Dependencies
Maintainers
2
Versions
1053
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@angular/core - npm Package Compare versions

Comparing version
22.0.0-next.10
to
22.0.0-next.11
+1005
schematics/bundles/index-DcezkXLN.cjs
'use strict';
/**
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/
* License: MIT
*/
'use strict';
var ts = require('typescript');
var compilerCli = require('@angular/compiler-cli');
var migrations = require('@angular/compiler-cli/private/migrations');
require('node:path');
var project_paths = require('./project_paths-D2V-Uh2L.cjs');
var compiler = require('@angular/compiler');
function getMemberName(member) {
if (member.name === undefined) {
return null;
}
if (ts.isIdentifier(member.name) || ts.isStringLiteralLike(member.name)) {
return member.name.text;
}
if (ts.isPrivateIdentifier(member.name)) {
return `#${member.name.text}`;
}
return null;
}
/** Checks whether the given node can be an `@Input()` declaration node. */
function isInputContainerNode(node) {
return (((ts.isAccessor(node) && ts.isClassDeclaration(node.parent)) ||
ts.isPropertyDeclaration(node)) &&
getMemberName(node) !== null);
}
/**
* Detects `query(By.directive(T)).componentInstance` patterns and enhances
* them with information of `T`. This is important because `.componentInstance`
* is currently typed as `any` and may cause runtime test failures after input
* migrations then.
*
* The reference resolution pass leverages information from this pattern
* recognizer.
*/
class DebugElementComponentInstance {
checker;
cache = new WeakMap();
constructor(checker) {
this.checker = checker;
}
detect(node) {
if (this.cache.has(node)) {
return this.cache.get(node);
}
if (!ts.isPropertyAccessExpression(node)) {
return null;
}
// Check for `<>.componentInstance`.
if (!ts.isIdentifier(node.name) || node.name.text !== 'componentInstance') {
return null;
}
// Check for `<>.query(..).<>`.
if (!ts.isCallExpression(node.expression) ||
!ts.isPropertyAccessExpression(node.expression.expression) ||
!ts.isIdentifier(node.expression.expression.name) ||
node.expression.expression.name.text !== 'query') {
return null;
}
const queryCall = node.expression;
if (queryCall.arguments.length !== 1) {
return null;
}
const queryArg = queryCall.arguments[0];
let typeExpr;
if (ts.isCallExpression(queryArg) &&
queryArg.arguments.length === 1 &&
ts.isIdentifier(queryArg.arguments[0])) {
// Detect references, like: `query(By.directive(T))`.
typeExpr = queryArg.arguments[0];
}
else if (ts.isIdentifier(queryArg)) {
// Detect references, like: `harness.query(T)`.
typeExpr = queryArg;
}
else {
return null;
}
const symbol = this.checker.getSymbolAtLocation(typeExpr);
if (symbol?.valueDeclaration === undefined ||
!ts.isClassDeclaration(symbol?.valueDeclaration)) {
// Cache this as we use the expensive type checker.
this.cache.set(node, null);
return null;
}
const type = this.checker.getTypeAtLocation(symbol.valueDeclaration);
this.cache.set(node, type);
return type;
}
}
/**
* Recognizes `Partial<T>` instances in Catalyst tests. Those type queries
* are likely used for typing property initialization values for the given class `T`
* and we have a few scenarios:
*
* 1. The API does not unwrap signal inputs. In which case, the values are likely no
* longer assignable to an `InputSignal`.
* 2. The API does unwrap signal inputs, in which case we need to unwrap the `Partial`
* because the values are raw initial values, like they were before.
*
* We can enable this heuristic when we detect Catalyst as we know it supports unwrapping.
*/
class PartialDirectiveTypeInCatalystTests {
checker;
knownFields;
constructor(checker, knownFields) {
this.checker = checker;
this.knownFields = knownFields;
}
detect(node) {
// Detect `Partial<...>`
if (!ts.isTypeReferenceNode(node) ||
!ts.isIdentifier(node.typeName) ||
node.typeName.text !== 'Partial') {
return null;
}
// Ignore if the source file doesn't reference Catalyst.
if (!node.getSourceFile().text.includes('angular2/testing/catalyst')) {
return null;
}
// Extract T of `Partial<T>`.
const cmpTypeArg = node.typeArguments?.[0];
if (!cmpTypeArg ||
!ts.isTypeReferenceNode(cmpTypeArg) ||
!ts.isIdentifier(cmpTypeArg.typeName)) {
return null;
}
const cmpType = cmpTypeArg.typeName;
const symbol = this.checker.getSymbolAtLocation(cmpType);
// Note: Technically the class might be derived of an input-containing class,
// but this is out of scope for now. We can expand if we see it's a common case.
if (symbol?.valueDeclaration === undefined ||
!ts.isClassDeclaration(symbol.valueDeclaration) ||
!this.knownFields.shouldTrackClassReference(symbol.valueDeclaration)) {
return null;
}
return { referenceNode: node, targetClass: symbol.valueDeclaration };
}
}
/**
* Attempts to look up the given property access chain using
* the type checker.
*
* Notably this is not as safe as using the type checker directly to
* retrieve symbols of a given identifier, but in some cases this is
* a necessary approach to compensate e.g. for a lack of TCB information
* when processing Angular templates.
*
* The path is a list of properties to be accessed sequentially on the
* given type.
*/
function lookupPropertyAccess(checker, type, path, options = {}) {
let symbol = null;
for (const propName of path) {
// Note: We support assuming `NonNullable` for the pathl This is necessary
// in some situations as otherwise the lookups would fail to resolve the target
// symbol just because of e.g. a ternary. This is used in the signal input migration
// for host bindings.
type = options.ignoreNullability ? type.getNonNullableType() : type;
const propSymbol = type.getProperty(propName);
if (propSymbol === undefined) {
return null;
}
symbol = propSymbol;
type = checker.getTypeOfSymbol(propSymbol);
}
if (symbol === null) {
return null;
}
return { symbol, type };
}
/**
* AST visitor that iterates through a template and finds all
* input references.
*
* This resolution is important to be able to migrate references to inputs
* that will be migrated to signal inputs.
*/
class TemplateReferenceVisitor extends compiler.TmplAstRecursiveVisitor {
result = [];
/**
* Whether we are currently descending into HTML AST nodes
* where all bound attributes are considered potentially narrowing.
*
* Keeps track of all referenced inputs in such attribute expressions.
*/
templateAttributeReferencedFields = null;
expressionVisitor;
seenKnownFieldsCount = new Map();
constructor(typeChecker, templateTypeChecker, componentClass, knownFields, fieldNamesToConsiderForReferenceLookup) {
super();
this.expressionVisitor = new TemplateExpressionReferenceVisitor(typeChecker, templateTypeChecker, componentClass, knownFields, fieldNamesToConsiderForReferenceLookup);
}
checkExpressionForReferencedFields(activeNode, expressionNode) {
const referencedFields = this.expressionVisitor.checkTemplateExpression(activeNode, expressionNode);
// Add all references to the overall visitor result.
this.result.push(...referencedFields);
// Count usages of seen input references. We'll use this to make decisions
// based on whether inputs are potentially narrowed or not.
for (const input of referencedFields) {
this.seenKnownFieldsCount.set(input.targetField.key, (this.seenKnownFieldsCount.get(input.targetField.key) ?? 0) + 1);
}
return referencedFields;
}
descendAndCheckForNarrowedSimilarReferences(potentiallyNarrowedInputs, descend) {
const inputs = potentiallyNarrowedInputs.map((i) => ({
ref: i,
key: i.targetField.key,
pastCount: this.seenKnownFieldsCount.get(i.targetField.key) ?? 0,
}));
descend();
for (const input of inputs) {
// Input was referenced inside a narrowable spot, and is used in child nodes.
// This is a sign for the input to be narrowed. Mark it as such.
if ((this.seenKnownFieldsCount.get(input.key) ?? 0) > input.pastCount) {
input.ref.isLikelyNarrowed = true;
}
}
}
visitTemplate(template) {
// Note: We assume all bound expressions for templates may be subject
// to TCB narrowing. This is relevant for now until we support narrowing
// of signal calls in templates.
// TODO: Remove with: https://github.com/angular/angular/pull/55456.
this.templateAttributeReferencedFields = [];
compiler.tmplAstVisitAll(this, template.attributes);
compiler.tmplAstVisitAll(this, template.templateAttrs);
// If we are dealing with a microsyntax template, do not check
// inputs and outputs as those are already passed to the children.
// Template attributes may contain relevant expressions though.
if (template.tagName === 'ng-template') {
compiler.tmplAstVisitAll(this, template.inputs);
compiler.tmplAstVisitAll(this, template.outputs);
}
const referencedInputs = this.templateAttributeReferencedFields;
this.templateAttributeReferencedFields = null;
this.descendAndCheckForNarrowedSimilarReferences(referencedInputs, () => {
compiler.tmplAstVisitAll(this, template.children);
compiler.tmplAstVisitAll(this, template.references);
compiler.tmplAstVisitAll(this, template.variables);
});
}
visitIfBlockBranch(block) {
if (block.expression) {
const referencedFields = this.checkExpressionForReferencedFields(block, block.expression);
this.descendAndCheckForNarrowedSimilarReferences(referencedFields, () => {
super.visitIfBlockBranch(block);
});
}
else {
super.visitIfBlockBranch(block);
}
}
visitForLoopBlock(block) {
this.checkExpressionForReferencedFields(block, block.expression);
this.checkExpressionForReferencedFields(block, block.trackBy);
super.visitForLoopBlock(block);
}
visitSwitchBlock(block) {
const referencedFields = this.checkExpressionForReferencedFields(block, block.expression);
this.descendAndCheckForNarrowedSimilarReferences(referencedFields, () => {
super.visitSwitchBlock(block);
});
}
visitSwitchBlockCase(block) {
if (block.expression) {
const referencedFields = this.checkExpressionForReferencedFields(block, block.expression);
this.descendAndCheckForNarrowedSimilarReferences(referencedFields, () => {
super.visitSwitchBlockCase(block);
});
}
else {
super.visitSwitchBlockCase(block);
}
}
visitDeferredBlock(deferred) {
if (deferred.triggers.when) {
this.checkExpressionForReferencedFields(deferred, deferred.triggers.when.value);
}
if (deferred.prefetchTriggers.when) {
this.checkExpressionForReferencedFields(deferred, deferred.prefetchTriggers.when.value);
}
super.visitDeferredBlock(deferred);
}
visitBoundText(text) {
this.checkExpressionForReferencedFields(text, text.value);
}
visitBoundEvent(attribute) {
this.checkExpressionForReferencedFields(attribute, attribute.handler);
}
visitBoundAttribute(attribute) {
const referencedFields = this.checkExpressionForReferencedFields(attribute, attribute.value);
// Attributes inside templates are potentially "narrowed" and hence we
// keep track of all referenced inputs to see if they actually are.
if (this.templateAttributeReferencedFields !== null) {
this.templateAttributeReferencedFields.push(...referencedFields);
}
}
visitLetDeclaration(decl) {
this.checkExpressionForReferencedFields(decl, decl.value);
}
}
/**
* Expression AST visitor that checks whether a given expression references
* a known `@Input()`.
*
* This resolution is important to be able to migrate references to inputs
* that will be migrated to signal inputs.
*/
class TemplateExpressionReferenceVisitor extends compiler.RecursiveAstVisitor {
typeChecker;
templateTypeChecker;
componentClass;
knownFields;
fieldNamesToConsiderForReferenceLookup;
activeTmplAstNode = null;
detectedInputReferences = [];
isInsideObjectShorthandExpression = false;
insideConditionalExpressionsWithReads = [];
constructor(typeChecker, templateTypeChecker, componentClass, knownFields, fieldNamesToConsiderForReferenceLookup) {
super();
this.typeChecker = typeChecker;
this.templateTypeChecker = templateTypeChecker;
this.componentClass = componentClass;
this.knownFields = knownFields;
this.fieldNamesToConsiderForReferenceLookup = fieldNamesToConsiderForReferenceLookup;
}
/** Checks the given AST expression. */
checkTemplateExpression(activeNode, expressionNode) {
this.detectedInputReferences = [];
this.activeTmplAstNode = activeNode;
expressionNode.visit(this, []);
return this.detectedInputReferences;
}
visit(ast, context) {
super.visit(ast, [...context, ast]);
}
// Keep track when we are inside an object shorthand expression. This is
// necessary as we need to expand the shorthand to invoke a potential new signal.
// E.g. `{bla}` may be transformed to `{bla: bla()}`.
visitLiteralMap(ast, context) {
for (const [idx, key] of ast.keys.entries()) {
this.isInsideObjectShorthandExpression =
key.kind === 'property' && !!key.isShorthandInitialized;
ast.values[idx].visit(this, context);
this.isInsideObjectShorthandExpression = false;
}
}
visitPropertyRead(ast, context) {
this._inspectPropertyAccess(ast, false, context);
super.visitPropertyRead(ast, context);
}
visitSafePropertyRead(ast, context) {
this._inspectPropertyAccess(ast, false, context);
super.visitPropertyRead(ast, context);
}
visitBinary(ast, context) {
if (ast.operation === '=' && ast.left instanceof compiler.PropertyRead) {
this._inspectPropertyAccess(ast.left, true, [...context, ast, ast.left]);
}
else {
super.visitBinary(ast, context);
}
}
visitConditional(ast, context) {
this.visit(ast.condition, context);
this.insideConditionalExpressionsWithReads.push(ast.condition);
this.visit(ast.trueExp, context);
this.visit(ast.falseExp, context);
this.insideConditionalExpressionsWithReads.pop();
}
/**
* Inspects the property access and attempts to resolve whether they access
* a known field. If so, the result is captured.
*/
_inspectPropertyAccess(ast, isAssignment, astPath) {
if (this.fieldNamesToConsiderForReferenceLookup !== null &&
!this.fieldNamesToConsiderForReferenceLookup.has(ast.name)) {
return;
}
const isWrite = !!(isAssignment ||
(this.activeTmplAstNode && isTwoWayBindingNode(this.activeTmplAstNode)));
this._checkAccessViaTemplateTypeCheckBlock(ast, isWrite, astPath) ||
this._checkAccessViaOwningComponentClassType(ast, isWrite, astPath);
}
/**
* Checks whether the node refers to an input using the TCB information.
* Type check block may not exist for e.g. test components, so this can return `null`.
*/
_checkAccessViaTemplateTypeCheckBlock(ast, isWrite, astPath) {
// There might be no template type checker. E.g. if we check host bindings.
if (this.templateTypeChecker === null) {
return false;
}
const symbol = this.templateTypeChecker.getSymbolOfNode(ast, this.componentClass);
if (symbol?.kind !== migrations.SymbolKind.Expression) {
return false;
}
const tsSymbol = this.templateTypeChecker.getTsSymbolOfSymbol(symbol);
if (tsSymbol === null) {
return false;
}
// Dangerous: Type checking symbol retrieval is a totally different `ts.Program`,
// than the one where we analyzed `knownInputs`.
// --> Find the input via its input id.
const targetInput = this.knownFields.attemptRetrieveDescriptorFromSymbol(tsSymbol);
if (targetInput === null) {
return false;
}
this.detectedInputReferences.push({
targetNode: targetInput.node,
targetField: targetInput,
read: ast,
readAstPath: astPath,
context: this.activeTmplAstNode,
isLikelyNarrowed: this._isPartOfNarrowingTernary(ast),
isObjectShorthandExpression: this.isInsideObjectShorthandExpression,
isWrite,
});
return true;
}
/**
* Simple resolution checking whether the given AST refers to a known input.
* This is a fallback for when there is no type checking information (e.g. in host bindings).
*
* It attempts to resolve references by traversing accesses of the "component class" type.
* e.g. `this.bla` is resolved via `CompType#bla` and further.
*/
_checkAccessViaOwningComponentClassType(ast, isWrite, astPath) {
// We might check host bindings, which can never point to template variables or local refs.
const expressionTemplateTarget = this.templateTypeChecker === null
? null
: this.templateTypeChecker.getExpressionTarget(ast, this.componentClass);
// Skip checking if:
// - the reference resolves to a template variable or local ref. No way to resolve without TCB.
// - the owning component does not have a name (should not happen technically).
if (expressionTemplateTarget !== null || this.componentClass.name === undefined) {
return;
}
const property = traverseReceiverAndLookupSymbol(ast, this.componentClass, this.typeChecker);
if (property === null) {
return;
}
const matchingTarget = this.knownFields.attemptRetrieveDescriptorFromSymbol(property);
if (matchingTarget === null) {
return;
}
this.detectedInputReferences.push({
targetNode: matchingTarget.node,
targetField: matchingTarget,
read: ast,
readAstPath: astPath,
context: this.activeTmplAstNode,
isLikelyNarrowed: this._isPartOfNarrowingTernary(ast),
isObjectShorthandExpression: this.isInsideObjectShorthandExpression,
isWrite,
});
}
_isPartOfNarrowingTernary(read) {
// Note: We do not safe check that the reads are fully matching 1:1. This is acceptable
// as worst case we just skip an input from being migrated. This is very unlikely too.
return this.insideConditionalExpressionsWithReads.some((r) => (r instanceof compiler.PropertyRead || r instanceof compiler.SafePropertyRead) && r.name === read.name);
}
}
/**
* Emulates an access to a given field using the TypeScript `ts.Type`
* of the given class. The resolved symbol of the access is returned.
*/
function traverseReceiverAndLookupSymbol(readOrWrite, componentClass, checker) {
const path = [readOrWrite.name];
let node = readOrWrite;
while (node.receiver instanceof compiler.PropertyRead) {
node = node.receiver;
path.unshift(node.name);
}
if (!(node.receiver instanceof compiler.ImplicitReceiver)) {
return null;
}
const classType = checker.getTypeAtLocation(componentClass.name);
return (lookupPropertyAccess(checker, classType, path, {
// Necessary to avoid breaking the resolution if there is
// some narrowing involved. E.g. `myClass ? myClass.input`.
ignoreNullability: true,
})?.symbol ?? null);
}
/** Whether the given node refers to a two-way binding AST node. */
function isTwoWayBindingNode(node) {
return ((node instanceof compiler.TmplAstBoundAttribute && node.type === compiler.BindingType.TwoWay) ||
(node instanceof compiler.TmplAstBoundEvent && node.type === compiler.ParsedEventType.TwoWay));
}
/** Possible types of references to known fields detected. */
exports.ReferenceKind = void 0;
(function (ReferenceKind) {
ReferenceKind[ReferenceKind["InTemplate"] = 0] = "InTemplate";
ReferenceKind[ReferenceKind["InHostBinding"] = 1] = "InHostBinding";
ReferenceKind[ReferenceKind["TsReference"] = 2] = "TsReference";
ReferenceKind[ReferenceKind["TsClassTypeReference"] = 3] = "TsClassTypeReference";
})(exports.ReferenceKind || (exports.ReferenceKind = {}));
/** Whether the given reference is a TypeScript reference. */
function isTsReference(ref) {
return ref.kind === exports.ReferenceKind.TsReference;
}
/** Whether the given reference is a template reference. */
function isTemplateReference(ref) {
return ref.kind === exports.ReferenceKind.InTemplate;
}
/** Whether the given reference is a host binding reference. */
function isHostBindingReference(ref) {
return ref.kind === exports.ReferenceKind.InHostBinding;
}
/**
* Whether the given reference is a TypeScript `ts.Type` reference
* to a class containing known fields.
*/
function isTsClassTypeReference(ref) {
return ref.kind === exports.ReferenceKind.TsClassTypeReference;
}
/**
* Checks host bindings of the given class and tracks all
* references to inputs within bindings.
*/
function identifyHostBindingReferences(node, programInfo, checker, reflector, result, knownFields, fieldNamesToConsiderForReferenceLookup) {
if (node.name === undefined) {
return;
}
const decorators = reflector.getDecoratorsOfDeclaration(node);
if (decorators === null) {
return;
}
const angularDecorators = migrations.getAngularDecorators(decorators, ['Directive', 'Component'],
/* isAngularCore */ false);
if (angularDecorators.length === 0) {
return;
}
// Assume only one Angular decorator per class.
const ngDecorator = angularDecorators[0];
if (ngDecorator.args?.length !== 1) {
return;
}
const metadataNode = migrations.unwrapExpression(ngDecorator.args[0]);
if (!ts.isObjectLiteralExpression(metadataNode)) {
return;
}
const metadata = migrations.reflectObjectLiteral(metadataNode);
if (!metadata.has('host')) {
return;
}
let hostField = migrations.unwrapExpression(metadata.get('host'));
// Special-case in case host bindings are shared via a variable.
// e.g. Material button shares host bindings as a constant in the same target.
if (ts.isIdentifier(hostField)) {
let symbol = checker.getSymbolAtLocation(hostField);
// Plain identifier references can point to alias symbols (e.g. imports).
if (symbol !== undefined && symbol.flags & ts.SymbolFlags.Alias) {
symbol = checker.getAliasedSymbol(symbol);
}
if (symbol !== undefined &&
symbol.valueDeclaration !== undefined &&
ts.isVariableDeclaration(symbol.valueDeclaration)) {
hostField = symbol?.valueDeclaration.initializer;
}
}
if (hostField === undefined || !ts.isObjectLiteralExpression(hostField)) {
return;
}
const hostMap = migrations.reflectObjectLiteral(hostField);
const expressionResult = [];
const expressionVisitor = new TemplateExpressionReferenceVisitor(checker, null, node, knownFields, fieldNamesToConsiderForReferenceLookup);
for (const [rawName, expression] of hostMap.entries()) {
if (!ts.isStringLiteralLike(expression)) {
continue;
}
const isEventBinding = rawName.startsWith('(');
const isPropertyBinding = rawName.startsWith('[');
// Only migrate property or event bindings.
if (!isPropertyBinding && !isEventBinding) {
continue;
}
const parser = compiler.makeBindingParser();
const sourceSpan = new compiler.ParseSourceSpan(
// Fake source span to keep parsing offsets zero-based.
// We then later combine these with the expression TS node offsets.
new compiler.ParseLocation({ content: '', url: '' }, 0, 0, 0), new compiler.ParseLocation({ content: '', url: '' }, 0, 0, 0));
const name = rawName.substring(1, rawName.length - 1);
let parsed = undefined;
if (isEventBinding) {
const result = [];
parser.parseEvent(name.substring(1, name.length - 1), expression.text, false, sourceSpan, sourceSpan, [], result, sourceSpan);
parsed = result[0].handler;
}
else {
const result = [];
parser.parsePropertyBinding(name, expression.text, true,
/* isTwoWayBinding */ false, sourceSpan, 0, sourceSpan, [], result, sourceSpan);
parsed = result[0].expression;
}
if (parsed != null) {
expressionResult.push(...expressionVisitor.checkTemplateExpression(expression, parsed));
}
}
for (const ref of expressionResult) {
result.references.push({
kind: exports.ReferenceKind.InHostBinding,
from: {
read: ref.read,
readAstPath: ref.readAstPath,
isObjectShorthandExpression: ref.isObjectShorthandExpression,
isWrite: ref.isWrite,
file: project_paths.projectFile(ref.context.getSourceFile(), programInfo),
hostPropertyNode: ref.context,
},
target: ref.targetField,
});
}
}
/**
* Attempts to extract the `TemplateDefinition` for the given
* class, if possible.
*
* The definition can then be used with the Angular compiler to
* load/parse the given template.
*/
function attemptExtractTemplateDefinition(node, checker, reflector, resourceLoader) {
const classDecorators = reflector.getDecoratorsOfDeclaration(node);
const evaluator = new migrations.PartialEvaluator(reflector, checker, null);
const ngDecorators = classDecorators !== null
? migrations.getAngularDecorators(classDecorators, ['Component'], /* isAngularCore */ false)
: [];
if (ngDecorators.length === 0 ||
ngDecorators[0].args === null ||
ngDecorators[0].args.length === 0 ||
!ts.isObjectLiteralExpression(ngDecorators[0].args[0])) {
return null;
}
const properties = migrations.reflectObjectLiteral(ngDecorators[0].args[0]);
const templateProp = properties.get('template');
const templateUrlProp = properties.get('templateUrl');
const containingFile = node.getSourceFile().fileName;
// inline template.
if (templateProp !== undefined) {
const templateStr = evaluator.evaluate(templateProp);
if (typeof templateStr === 'string') {
return {
isInline: true,
expression: templateProp,
preserveWhitespaces: false,
resolvedTemplateUrl: containingFile,
templateUrl: containingFile,
};
}
}
try {
// external template.
if (templateUrlProp !== undefined) {
const templateUrl = evaluator.evaluate(templateUrlProp);
if (typeof templateUrl === 'string') {
return {
isInline: false,
preserveWhitespaces: false,
templateUrlExpression: templateUrlProp,
templateUrl,
resolvedTemplateUrl: resourceLoader.resolve(templateUrl, containingFile),
};
}
}
}
catch (e) {
console.error(`Could not parse external template: ${e}`);
}
return null;
}
/**
* Checks whether the given class has an Angular template, and resolves
* all of the references to inputs.
*/
function identifyTemplateReferences(programInfo, node, reflector, checker, evaluator, templateTypeChecker, resourceLoader, options, result, knownFields, fieldNamesToConsiderForReferenceLookup) {
const template = templateTypeChecker.getTemplate(node, compilerCli.OptimizeFor.WholeProgram) ??
// If there is no template registered in the TCB or compiler, the template may
// be skipped due to an explicit `jit: true` setting. We try to detect this case
// and parse the template manually.
extractTemplateWithoutCompilerAnalysis(node, checker, reflector, resourceLoader, evaluator, options);
if (template !== null) {
const visitor = new TemplateReferenceVisitor(checker, templateTypeChecker, node, knownFields, fieldNamesToConsiderForReferenceLookup);
template.forEach((node) => node.visit(visitor));
for (const res of visitor.result) {
const templateFilePath = res.context.sourceSpan.start.file.url;
// Templates without an URL are non-mappable artifacts of e.g.
// string concatenated templates. See the `indirect` template
// source mapping concept in the compiler. We skip such references
// as those cannot be migrated, but print an error for now.
if (templateFilePath === '') {
// TODO: Incorporate a TODO potentially.
console.error(`Found reference to field ${res.targetField.key} that cannot be ` +
`migrated because the template cannot be parsed with source map information ` +
`(in file: ${node.getSourceFile().fileName}).`);
continue;
}
result.references.push({
kind: exports.ReferenceKind.InTemplate,
from: {
read: res.read,
readAstPath: res.readAstPath,
node: res.context,
isObjectShorthandExpression: res.isObjectShorthandExpression,
originatingTsFile: project_paths.projectFile(node.getSourceFile(), programInfo),
templateFile: project_paths.projectFile(compilerCli.absoluteFrom(templateFilePath), programInfo),
isLikelyPartOfNarrowing: res.isLikelyNarrowed,
isWrite: res.isWrite,
},
target: res.targetField,
});
}
}
}
/**
* Attempts to extract a `@Component` template from the given class,
* without relying on the `NgCompiler` program analysis.
*
* This is useful for JIT components using `jit: true` which were not
* processed by the Angular compiler, but may still have templates that
* contain references to inputs that we can resolve via the fallback
* reference resolutions (that does not use the type check block).
*/
function extractTemplateWithoutCompilerAnalysis(node, checker, reflector, resourceLoader, evaluator, options) {
if (node.name === undefined) {
return null;
}
const tmplDef = attemptExtractTemplateDefinition(node, checker, reflector, resourceLoader);
if (tmplDef === null) {
return null;
}
return migrations.extractTemplate(node, tmplDef, evaluator, null, resourceLoader, {
enableBlockSyntax: true,
enableLetSyntax: true,
usePoisonedData: true,
enableI18nLegacyMessageIdFormat: options.enableI18nLegacyMessageIdFormat !== false,
i18nNormalizeLineEndingsInICUs: options.i18nNormalizeLineEndingsInICUs === true,
enableSelectorless: false,
}, migrations.CompilationMode.FULL).nodes;
}
/** Gets the pattern and property name for a given binding element. */
function resolveBindingElement(node) {
const name = node.propertyName ?? node.name;
// If we are discovering a non-analyzable element in the path, abort.
if (!ts.isStringLiteralLike(name) && !ts.isIdentifier(name)) {
return null;
}
return {
pattern: node.parent,
propertyName: name.text,
};
}
/** Gets the declaration node of the given binding element. */
function getBindingElementDeclaration(node) {
while (true) {
if (ts.isBindingElement(node.parent.parent)) {
node = node.parent.parent;
}
else {
return node.parent.parent;
}
}
}
/**
* Expands the given reference to its containing expression, capturing
* the full context.
*
* E.g. `traverseAccess(ref<`bla`>)` may return `this.bla`
* or `traverseAccess(ref<`bla`>)` may return `this.someObj.a.b.c.bla`.
*
* This helper is useful as we will replace the full access with a temporary
* variable for narrowing. Replacing just the identifier is wrong.
*/
function traverseAccess(access) {
if (ts.isPropertyAccessExpression(access.parent) && access.parent.name === access) {
return access.parent;
}
else if (ts.isElementAccessExpression(access.parent) &&
access.parent.argumentExpression === access) {
return access.parent;
}
return access;
}
/**
* Unwraps the parent of the given node, if it's a
* parenthesized expression or `as` expression.
*/
function unwrapParent(node) {
if (ts.isParenthesizedExpression(node.parent)) {
return unwrapParent(node.parent);
}
else if (ts.isAsExpression(node.parent)) {
return unwrapParent(node.parent);
}
return node;
}
/**
* List of binary operators that indicate a write operation.
*
* Useful for figuring out whether an expression assigns to
* something or not.
*/
const writeBinaryOperators = [
ts.SyntaxKind.EqualsToken,
ts.SyntaxKind.BarBarEqualsToken,
ts.SyntaxKind.BarEqualsToken,
ts.SyntaxKind.AmpersandEqualsToken,
ts.SyntaxKind.AmpersandAmpersandEqualsToken,
ts.SyntaxKind.SlashEqualsToken,
ts.SyntaxKind.MinusEqualsToken,
ts.SyntaxKind.PlusEqualsToken,
ts.SyntaxKind.CaretEqualsToken,
ts.SyntaxKind.PercentEqualsToken,
ts.SyntaxKind.AsteriskEqualsToken,
ts.SyntaxKind.ExclamationEqualsToken,
];
/**
* Checks whether given TypeScript reference refers to an Angular input, and captures
* the reference if possible.
*
* @param fieldNamesToConsiderForReferenceLookup List of field names that should be
* respected when expensively looking up references to known fields.
* May be null if all identifiers should be inspected.
*/
function identifyPotentialTypeScriptReference(node, programInfo, checker, knownFields, result, fieldNamesToConsiderForReferenceLookup, advisors) {
// Skip all identifiers that never can point to a migrated field.
// TODO: Capture these assumptions and performance optimizations in the design doc.
if (fieldNamesToConsiderForReferenceLookup !== null &&
!fieldNamesToConsiderForReferenceLookup.has(node.text)) {
return;
}
let target = undefined;
try {
// Resolve binding elements to their declaration symbol.
// Commonly inputs are accessed via object expansion. e.g. `const {input} = this;`.
if (ts.isBindingElement(node.parent)) {
// Skip binding elements that are using spread.
if (node.parent.dotDotDotToken !== undefined) {
return;
}
const bindingInfo = resolveBindingElement(node.parent);
if (bindingInfo === null) {
// The declaration could not be resolved. Skip analyzing this.
return;
}
const bindingType = checker.getTypeAtLocation(bindingInfo.pattern);
const resolved = lookupPropertyAccess(checker, bindingType, [bindingInfo.propertyName]);
target = resolved?.symbol;
}
else {
target = checker.getSymbolAtLocation(node);
}
}
catch (e) {
console.error('Unexpected error while trying to resolve identifier reference:');
console.error(e);
// Gracefully skip analyzing. This can happen when e.g. a reference is named similar
// to an input, but is dependant on `.d.ts` that is not necessarily available (clutz dts).
return;
}
noTargetSymbolCheck: if (target === undefined) {
if (ts.isPropertyAccessExpression(node.parent) && node.parent.name === node) {
const propAccessSymbol = checker.getSymbolAtLocation(node.parent.expression);
if (propAccessSymbol !== undefined &&
propAccessSymbol.valueDeclaration !== undefined &&
ts.isVariableDeclaration(propAccessSymbol.valueDeclaration) &&
propAccessSymbol.valueDeclaration.initializer !== undefined) {
target = advisors.debugElComponentInstanceTracker
.detect(propAccessSymbol.valueDeclaration.initializer)
?.getProperty(node.text);
// We found a target in the fallback path. Break out.
if (target !== undefined) {
break noTargetSymbolCheck;
}
}
}
return;
}
let targetInput = knownFields.attemptRetrieveDescriptorFromSymbol(target);
if (targetInput === null) {
return;
}
const access = unwrapParent(traverseAccess(node));
const accessParent = access.parent;
const isWriteReference = ts.isBinaryExpression(accessParent) &&
accessParent.left === access &&
writeBinaryOperators.includes(accessParent.operatorToken.kind);
// track accesses from source files to known fields.
result.references.push({
kind: exports.ReferenceKind.TsReference,
from: {
node,
file: project_paths.projectFile(node.getSourceFile(), programInfo),
isWrite: isWriteReference,
isPartOfElementBinding: ts.isBindingElement(node.parent),
},
target: targetInput,
});
}
/**
* Phase where we iterate through all source file references and
* detect references to known fields (e.g. commonly inputs).
*
* This is useful, for example in the signal input migration whe
* references need to be migrated to unwrap signals, given that
* their target properties is no longer holding a raw value, but
* instead an `InputSignal`.
*
* This phase detects references in all types of locations:
* - TS source files
* - Angular templates (inline or external)
* - Host binding expressions.
*/
function createFindAllSourceFileReferencesVisitor(programInfo, checker, reflector, resourceLoader, evaluator, templateTypeChecker, knownFields, fieldNamesToConsiderForReferenceLookup, result) {
const debugElComponentInstanceTracker = new DebugElementComponentInstance(checker);
const partialDirectiveCatalystTracker = new PartialDirectiveTypeInCatalystTests(checker, knownFields);
const perfCounters = {
template: 0,
hostBindings: 0,
tsReferences: 0,
tsTypes: 0,
};
// Schematic NodeJS execution may not have `global.performance` defined.
const currentTimeInMs = () => typeof global.performance !== 'undefined' ? global.performance.now() : Date.now();
const visitor = (node) => {
let lastTime = currentTimeInMs();
// Note: If there is no template type checker and resource loader, we aren't processing
// an Angular program, and can skip template detection.
if (ts.isClassDeclaration(node) && templateTypeChecker !== null && resourceLoader !== null) {
identifyTemplateReferences(programInfo, node, reflector, checker, evaluator, templateTypeChecker, resourceLoader, programInfo.userOptions, result, knownFields, fieldNamesToConsiderForReferenceLookup);
perfCounters.template += (currentTimeInMs() - lastTime) / 1000;
lastTime = currentTimeInMs();
identifyHostBindingReferences(node, programInfo, checker, reflector, result, knownFields, fieldNamesToConsiderForReferenceLookup);
perfCounters.hostBindings += (currentTimeInMs() - lastTime) / 1000;
lastTime = currentTimeInMs();
}
lastTime = currentTimeInMs();
// find references, but do not capture input declarations itself.
if (ts.isIdentifier(node) &&
!(isInputContainerNode(node.parent) && node.parent.name === node)) {
identifyPotentialTypeScriptReference(node, programInfo, checker, knownFields, result, fieldNamesToConsiderForReferenceLookup, {
debugElComponentInstanceTracker,
});
}
perfCounters.tsReferences += (currentTimeInMs() - lastTime) / 1000;
lastTime = currentTimeInMs();
// Detect `Partial<T>` references.
// Those are relevant to be tracked as they may be updated in Catalyst to
// unwrap signal inputs. Commonly people use `Partial` in Catalyst to type
// some "component initial values".
const partialDirectiveInCatalyst = partialDirectiveCatalystTracker.detect(node);
if (partialDirectiveInCatalyst !== null) {
result.references.push({
kind: exports.ReferenceKind.TsClassTypeReference,
from: {
file: project_paths.projectFile(partialDirectiveInCatalyst.referenceNode.getSourceFile(), programInfo),
node: partialDirectiveInCatalyst.referenceNode,
},
isPartialReference: true,
isPartOfCatalystFile: true,
target: partialDirectiveInCatalyst.targetClass,
});
}
perfCounters.tsTypes += (currentTimeInMs() - lastTime) / 1000;
};
return {
visitor,
debugPrintMetrics: () => {
console.info('Source file analysis performance', perfCounters);
},
};
}
exports.createFindAllSourceFileReferencesVisitor = createFindAllSourceFileReferencesVisitor;
exports.getBindingElementDeclaration = getBindingElementDeclaration;
exports.getMemberName = getMemberName;
exports.isHostBindingReference = isHostBindingReference;
exports.isInputContainerNode = isInputContainerNode;
exports.isTemplateReference = isTemplateReference;
exports.isTsClassTypeReference = isTsClassTypeReference;
exports.isTsReference = isTsReference;
exports.traverseAccess = traverseAccess;
exports.unwrapParent = unwrapParent;

Sorry, the diff of this file is too big to display

'use strict';
/**
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/
* License: MIT
*/
'use strict';
require('@angular-devkit/core');
require('node:path/posix');
var project_paths = require('./project_paths-D2V-Uh2L.cjs');
var compiler = require('@angular/compiler');
var ts = require('typescript');
var ng_component_template = require('./ng_component_template-DPAF1aEA.cjs');
var ng_decorators = require('./ng_decorators-IVztR9rk.cjs');
require('@angular/compiler-cli');
require('@angular/compiler-cli/private/migrations');
require('node:path');
var property_name = require('./property_name-BCpALNpZ.cjs');
require('@angular-devkit/schematics');
require('./project_tsconfig_paths-DkkMibv-.cjs');
require('./imports-CKV-ITqD.cjs');
import('@angular/compiler');
/**
* This migration wraps optional chaining expressions in Angular templates with a call to the
* `$safeNavigationMigration()` magic function. This function doesn't exist at runtime, but is
* used as a marker for the Angular compiler to transform the expression to keep the legacy
* behavior of returning `null`.
*
* The migration uses a top-down "sink" approach: each expression is visited with a boolean
* `nullSensitive` context that indicates whether the consumer of the expression's value
* distinguishes between `null` and `undefined`. Safe navigation operators (`?.`) wrap themselves
* when their sink is null-sensitive.
*/
class SafeOptionalChainingMigration extends project_paths.TsurgeFunnelMigration {
config;
constructor(config = {}) {
super();
this.config = config;
}
async analyze(info) {
const replacements = [];
// Template Iteration
const templateVisitor = new ng_component_template.NgComponentTemplateVisitor(info.program.getTypeChecker());
for (const sourceFile of info.sourceFiles) {
templateVisitor.visitNode(sourceFile);
}
for (const template of templateVisitor.resolvedTemplates) {
const nodes = compiler.parseTemplate(template.content, template.filePath.toString(), {
preserveWhitespaces: true,
preserveLineEndings: true,
preserveSignificantWhitespace: true,
leadingTriviaChars: [],
}).nodes;
const file = template.inline
? project_paths.projectFile(template.container.getSourceFile(), info)
: project_paths.projectFile(template.filePath, info);
const exprMigrator = new ExpressionMigrator(file, template.start);
const visitor = new TmplVisitor(exprMigrator);
for (const node of nodes) {
if (node.visit) {
node.visit(visitor);
}
}
replacements.push(...exprMigrator.replacements);
}
for (const sourceFile of info.sourceFiles) {
replacements.push(...migrateHostBindingsInSourceFile(sourceFile, info));
}
return project_paths.confirmAsSerializable({ replacements });
}
async combine(unitA, unitB) {
const seen = new Set();
const deduped = [];
for (const r of [...unitA.replacements, ...unitB.replacements]) {
const key = `${r.projectFile.rootRelativePath}:${r.update.data.position}:${r.update.data.end}:${r.update.data.toInsert}`;
if (!seen.has(key)) {
seen.add(key);
deduped.push(r);
}
}
return project_paths.confirmAsSerializable({ replacements: deduped });
}
async globalMeta(data) {
return project_paths.confirmAsSerializable(data);
}
async stats(data) {
return project_paths.confirmAsSerializable({});
}
async migrate(data) {
return { replacements: data.replacements };
}
}
function migrateHostBindingsInSourceFile(sourceFile, info) {
const replacements = [];
const file = project_paths.projectFile(sourceFile, info);
const typeChecker = info.program.getTypeChecker();
const visitNode = (node) => {
if (ts.isClassDeclaration(node)) {
const decorators = ts.getDecorators(node) ?? [];
const ngDecorators = ng_decorators.getAngularDecorators(typeChecker, decorators);
for (const decorator of ngDecorators) {
if (decorator.name !== 'Component' && decorator.name !== 'Directive') {
continue;
}
const metadata = decorator.node.expression.arguments[0];
if (!metadata || !ts.isObjectLiteralExpression(metadata)) {
continue;
}
for (const prop of metadata.properties) {
if (!ts.isPropertyAssignment(prop)) {
continue;
}
const propName = property_name.getPropertyNameText(prop.name);
if (propName !== 'host' || !ts.isObjectLiteralExpression(prop.initializer)) {
continue;
}
for (const hostProp of prop.initializer.properties) {
if (!ts.isPropertyAssignment(hostProp) ||
!ts.isStringLiteralLike(hostProp.initializer)) {
continue;
}
const hostKey = property_name.getPropertyNameText(hostProp.name);
if (hostKey === null || (!hostKey.startsWith('[') && !hostKey.startsWith('('))) {
continue;
}
// Preserve raw text between quotes/backticks so source offsets stay aligned.
const hostExpression = hostProp.initializer.getText().slice(1, -1);
const fakeTemplatePrefix = `<div ${hostKey}="`;
const fakeTemplate = `${fakeTemplatePrefix}${hostExpression}"></div>`;
const parsedNodes = compiler.parseTemplate(fakeTemplate, sourceFile.fileName, {
preserveWhitespaces: true,
}).nodes;
const hostExpressionStart = hostProp.initializer.getStart() + 1;
const exprMigrator = new ExpressionMigrator(file, hostExpressionStart - fakeTemplatePrefix.length);
const visitor = new HostBindingVisitor(exprMigrator);
for (const parsedNode of parsedNodes) {
if (parsedNode.visit) {
parsedNode.visit(visitor);
}
}
replacements.push(...exprMigrator.replacements);
}
}
}
}
ts.forEachChild(node, visitNode);
};
visitNode(sourceFile);
return replacements;
}
/** Returns whether the given attribute is a class, style, or attribute binding. */
function isClassStyleOrAttrBinding(attribute) {
return (attribute.type === compiler.BindingType.Class ||
attribute.type === compiler.BindingType.Style ||
attribute.type === compiler.BindingType.Attribute ||
(attribute.type === compiler.BindingType.Property &&
(attribute.name === 'class' || attribute.name === 'className' || attribute.name === 'style')));
}
class HostBindingVisitor extends compiler.TmplAstRecursiveVisitor {
hostExprMigrator;
constructor(hostExprMigrator) {
super();
this.hostExprMigrator = hostExprMigrator;
}
visitBoundAttribute(attribute) {
if (isClassStyleOrAttrBinding(attribute)) {
// Class/style/attr bindings use truthiness — not null-sensitive by default.
// Safe navs inside function calls or pipes will still be wrapped by the migrator.
attribute.value.visit(this.hostExprMigrator, false);
}
else {
// Regular property bindings are null-sensitive.
attribute.value.visit(this.hostExprMigrator, true);
}
super.visitBoundAttribute(attribute);
}
visitBoundEvent(event) {
if (event.handler && event.handler.visit) {
// Event handlers are not null-sensitive; safe navs inside function calls will
// still be wrapped because function arguments are always null-sensitive.
event.handler.visit(this.hostExprMigrator, false);
}
super.visitBoundEvent(event);
}
}
/**
* Visits template expressions and inserts `$safeNavigationMigration(…)` wrappers around safe
* navigation chains whose result is consumed by a null-sensitive sink.
*
* The `context` parameter at every visit call is a boolean `nullSensitive` flag that answers:
* "does the parent care whether this expression's value is `null` vs. `undefined`?"
*
* Propagation rules:
* - `||`, `&&`, `??`: children are **not** null-sensitive (both normalise null/undefined).
* - `===` / `!==` with a nullish literal on one side: the other operand **is** null-sensitive.
* - All other binary operators: propagate the parent's null-sensitivity.
* - `!` (prefix not): operand is **not** null-sensitive (uses truthiness).
* - Ternary condition: **not** null-sensitive; branches inherit the parent's null-sensitivity.
* - Function call arguments and pipe inputs: **always** null-sensitive.
* - Receivers of property/keyed/call reads: **not** null-sensitive by default.
* For property/keyed/call continuations, when the receiver is a safe node and the parent sink
* is null-sensitive, wrap the full continuation node (e.g. `foo?.bar.baz`, `foo?.save()`) rather
* than the inner safe receiver (`foo?.bar`, `foo?.save`) so runtime behavior is preserved.
* - `NonNullAssert` (`!`): propagates the parent's null-sensitivity (type-only assertion).
*/
class ExpressionMigrator extends compiler.RecursiveAstVisitor {
file;
templateStart;
replacements = [];
constructor(file, templateStart) {
super();
this.file = file;
this.templateStart = templateStart;
}
// ---------------------------------------------------------------------------
// Safe navigation nodes — wrap when the sink is null-sensitive
// ---------------------------------------------------------------------------
visitSafePropertyRead(ast, nullSensitive) {
if (nullSensitive) {
this.addReplacement(ast);
}
// Receiver: not null-sensitive (further access on null/undefined throws either way).
this.visit(ast.receiver, false);
}
visitSafeKeyedRead(ast, nullSensitive) {
if (nullSensitive) {
this.addReplacement(ast);
}
this.visit(ast.receiver, false);
this.visit(ast.key, false);
}
visitSafeCall(ast, nullSensitive) {
if (nullSensitive) {
this.addReplacement(ast);
}
this.visit(ast.receiver, false);
this.visitAll(ast.args, true);
}
hasSafeReceiver(receiver) {
if (receiver instanceof compiler.SafePropertyRead ||
receiver instanceof compiler.SafeKeyedRead ||
receiver instanceof compiler.SafeCall) {
return true;
}
if (receiver instanceof compiler.NonNullAssert) {
return this.hasSafeReceiver(receiver.expression);
}
return false;
}
// ---------------------------------------------------------------------------
// Non-safe access — receiver is never null-sensitive
// ---------------------------------------------------------------------------
visitPropertyRead(ast, nullSensitive) {
if (nullSensitive && this.hasSafeReceiver(ast.receiver)) {
this.addReplacement(ast);
}
this.visit(ast.receiver, false);
}
visitKeyedRead(ast, nullSensitive) {
if (nullSensitive && this.hasSafeReceiver(ast.receiver)) {
this.addReplacement(ast);
}
this.visit(ast.receiver, false);
this.visit(ast.key, false);
}
// ---------------------------------------------------------------------------
// Function calls — arguments are always null-sensitive
// ---------------------------------------------------------------------------
visitCall(ast, nullSensitive) {
if (nullSensitive && this.hasSafeReceiver(ast.receiver)) {
this.addReplacement(ast);
}
this.visit(ast.receiver, false);
this.visitAll(ast.args, true);
}
// ---------------------------------------------------------------------------
// Pipes — input and arguments are always null-sensitive
// ---------------------------------------------------------------------------
visitPipe(ast, _nullSensitive) {
this.visit(ast.exp, true);
this.visitAll(ast.args, true);
}
// ---------------------------------------------------------------------------
// Binary operators
// ---------------------------------------------------------------------------
visitBinary(ast, nullSensitive) {
if (ast.operation === '||' || ast.operation === '&&' || ast.operation === '??') {
// These operators normalise null and undefined (both produce the same result),
// so the operands are not null-sensitive.
this.visit(ast.left, false);
this.visit(ast.right, false);
}
else if (ast.operation === '===' || ast.operation === '!==') {
// A strict comparison with a nullish literal makes the other side null-sensitive
// (null === null is true but undefined === null is false).
const leftIsNullish = isNullishLiteralAST(ast.left);
const rightIsNullish = isNullishLiteralAST(ast.right);
this.visit(ast.left, rightIsNullish);
this.visit(ast.right, leftIsNullish);
}
else {
// All other binary operators (<, >, +, -, …): propagate the parent's null-sensitivity
// because null and undefined can produce different numeric results (null → 0,
// undefined → NaN for arithmetic/comparison).
this.visit(ast.left, nullSensitive);
this.visit(ast.right, nullSensitive);
}
}
// ---------------------------------------------------------------------------
// Unary / logical operators
// ---------------------------------------------------------------------------
visitPrefixNot(ast, _nullSensitive) {
// Logical negation uses truthiness — null and undefined are both falsy.
this.visit(ast.expression, false);
}
// ---------------------------------------------------------------------------
// Ternary
// ---------------------------------------------------------------------------
visitConditional(ast, nullSensitive) {
// The condition is evaluated as a boolean — not null-sensitive.
this.visit(ast.condition, false);
// The result of a branch is consumed by the parent, so it inherits null-sensitivity.
this.visit(ast.trueExp, nullSensitive);
this.visit(ast.falseExp, nullSensitive);
}
// ---------------------------------------------------------------------------
// NonNullAssert — a compile-time type annotation, no runtime effect
// ---------------------------------------------------------------------------
visitNonNullAssert(ast, nullSensitive) {
this.visit(ast.expression, nullSensitive);
}
// ---------------------------------------------------------------------------
// Chain (event handler statements) — never null-sensitive
// ---------------------------------------------------------------------------
visitChain(ast, _nullSensitive) {
this.visitAll(ast.expressions, false);
}
// ---------------------------------------------------------------------------
// Interpolation — coerces to string, so null and undefined produce identical
// output; sub-expressions are therefore never null-sensitive.
// ---------------------------------------------------------------------------
visitInterpolation(ast, _nullSensitive) {
this.visitAll(ast.expressions, false);
}
// ---------------------------------------------------------------------------
// All other nodes (LiteralArray, LiteralMap, Unary, …) use the default
// RecursiveAstVisitor which propagates the current context to every child —
// the correct "inherit parent null-sensitivity" fallback.
// ---------------------------------------------------------------------------
addReplacement(ast) {
const startArg = ast.sourceSpan.start;
const endArg = ast.sourceSpan.end;
this.replacements.push(new project_paths.Replacement(this.file, new project_paths.TextUpdate({
position: this.templateStart + endArg,
end: this.templateStart + endArg,
toInsert: ')',
})), new project_paths.Replacement(this.file, new project_paths.TextUpdate({
position: this.templateStart + startArg,
end: this.templateStart + startArg,
toInsert: '$safeNavigationMigration(',
})));
}
}
// ---------------------------------------------------------------------------
// Helper utilities
// ---------------------------------------------------------------------------
/** Returns true if the AST node is a literal `null` or `undefined`. */
function isNullishLiteralAST(ast) {
const innerAst = ast instanceof compiler.ASTWithSource ? ast.ast : ast;
return (innerAst instanceof compiler.LiteralPrimitive &&
(innerAst.value === null || innerAst.value === undefined));
}
/** Returns true if the AST node is a non-null, non-undefined primitive literal. */
function isNonNullishLiteralAST(ast) {
const innerAst = ast instanceof compiler.ASTWithSource ? ast.ast : ast;
return (innerAst instanceof compiler.LiteralPrimitive && innerAst.value !== null && innerAst.value !== undefined);
}
// ---------------------------------------------------------------------------
// Template visitor
// ---------------------------------------------------------------------------
/**
* Returns true if all *ngSwitchCase bindings in the given nodes (and their children)
* are non-null/non-undefined literal expressions — meaning the switch expression
* doesn't need null-sensitivity migration.
*/
function allNgSwitchCasesAreLiterals(nodes) {
for (const node of nodes) {
for (const input of node.inputs) {
if (input.name === 'ngSwitchCase' && input.value) {
if (!isNonNullishLiteralAST(input.value)) {
return false;
}
}
}
if (node instanceof compiler.TmplAstTemplate) {
for (const attr of node.templateAttrs) {
if (attr instanceof compiler.TmplAstBoundAttribute && attr.name === 'ngSwitchCase' && attr.value) {
if (!isNonNullishLiteralAST(attr.value)) {
return false;
}
}
}
}
const childHosts = node.children.filter((child) => child instanceof compiler.TmplAstElement || child instanceof compiler.TmplAstTemplate);
if (!allNgSwitchCasesAreLiterals(childHosts)) {
return false;
}
}
return true;
}
class TmplVisitor extends compiler.TmplAstRecursiveVisitor {
exprMigrator;
migratableSwitchCases = new WeakSet();
/**
* Stack tracking whether the current ngSwitch context should be migrated.
* False when all *ngSwitchCase expressions are non-null literals.
*/
ngSwitchShouldMigrateStack = [];
constructor(exprMigrator) {
super();
this.exprMigrator = exprMigrator;
}
shouldMigrateCurrentNgSwitchContext() {
return this.ngSwitchShouldMigrateStack[this.ngSwitchShouldMigrateStack.length - 1] ?? true;
}
hasNgSwitchBinding(node) {
return (node.inputs.some((attr) => attr.name === 'ngSwitch') ||
(node instanceof compiler.TmplAstTemplate &&
node.templateAttrs.some((attr) => attr.name === 'ngSwitch')));
}
visitElement(element) {
const hasNgSwitch = this.hasNgSwitchBinding(element);
if (hasNgSwitch) {
const childHosts = element.children.filter((child) => child instanceof compiler.TmplAstElement || child instanceof compiler.TmplAstTemplate);
this.ngSwitchShouldMigrateStack.push(!allNgSwitchCasesAreLiterals(childHosts));
}
super.visitElement(element);
if (hasNgSwitch) {
this.ngSwitchShouldMigrateStack.pop();
}
}
visitBoundAttribute(attribute) {
if (attribute.name === 'ngForOf') {
// ngFor/@for item expressions are not null-sensitive by default.
// Still visit so inner null-sensitive sinks (e.g. pipes/functions) are migrated.
attribute.value.visit(this.exprMigrator, false);
}
else if (attribute.name === 'ngIf') {
// ngIf evaluates as a boolean; null-sensitivity only arises when the expression
// itself contains a strict null comparison (handled inside ExpressionMigrator).
attribute.value.visit(this.exprMigrator, false);
}
else if (attribute.name === 'ngSwitch' || attribute.name === 'ngSwitchCase') {
attribute.value.visit(this.exprMigrator, this.shouldMigrateCurrentNgSwitchContext());
}
else if (isClassStyleOrAttrBinding(attribute)) {
// Class/style/attr bindings use truthiness — not null-sensitive by default.
attribute.value.visit(this.exprMigrator, false);
}
else {
// Regular property bindings are null-sensitive.
attribute.value.visit(this.exprMigrator, true);
}
super.visitBoundAttribute(attribute);
}
visitBoundEvent(event) {
if (event.handler && event.handler.visit) {
// Event handlers are not null-sensitive. Safe navs inside function calls
// (e.g. `compute(user?.save())`) are still migrated because function arguments
// are always null-sensitive in ExpressionMigrator.
event.handler.visit(this.exprMigrator, false);
}
super.visitBoundEvent(event);
}
visitBoundText(text) {
// Interpolation text is not null-sensitive by default; null-sensitivity is
// introduced by pipes, function calls, or strict null comparisons inside
// the expression, all handled by ExpressionMigrator.
text.value.visit(this.exprMigrator, false);
super.visitBoundText(text);
}
visitTemplate(template) {
const hasNgSwitch = this.hasNgSwitchBinding(template);
if (hasNgSwitch) {
const childHosts = template.children.filter((child) => child instanceof compiler.TmplAstElement || child instanceof compiler.TmplAstTemplate);
this.ngSwitchShouldMigrateStack.push(!allNgSwitchCasesAreLiterals(childHosts));
}
for (const attr of template.templateAttrs) {
if (!(attr instanceof compiler.TmplAstBoundAttribute)) {
continue;
}
if (attr.name === 'ngIf') {
attr.value.visit(this.exprMigrator, false);
}
else if (attr.name === 'ngSwitch' || attr.name === 'ngSwitchCase') {
attr.value.visit(this.exprMigrator, this.shouldMigrateCurrentNgSwitchContext());
}
else if (attr.name === 'ngForOf') {
// ngFor microsyntax expressions are not null-sensitive by default.
// Still visit so nested null-sensitive sinks are handled.
attr.value.visit(this.exprMigrator, false);
}
else {
attr.value.visit(this.exprMigrator, true);
}
}
super.visitTemplate(template);
if (hasNgSwitch) {
this.ngSwitchShouldMigrateStack.pop();
}
}
visitIfBlockBranch(block) {
if (block.expression) {
// @if condition: not null-sensitive by default (same logic as ngIf).
block.expression.visit(this.exprMigrator, false);
}
super.visitIfBlockBranch(block);
}
visitForLoopBlock(block) {
block.expression.visit(this.exprMigrator, false);
block.trackBy.visit(this.exprMigrator, false);
super.visitForLoopBlock(block);
}
visitLetDeclaration(decl) {
// @let value is assigned directly — null-sensitive.
decl.value.visit(this.exprMigrator, true);
super.visitLetDeclaration(decl);
}
visitSwitchBlock(block) {
const switchCases = block.groups.flatMap((group) => group.cases);
// Don't migrate if every case expression is a non-null/non-undefined literal
// (e.g. strings, numbers, booleans). In that case null-vs-undefined can never
// match a case, so wrapping the switch expression would be pointless.
const shouldMigrate = !switchCases
.filter((switchCase) => switchCase.expression)
.every((switchCase) => isNonNullishLiteralAST(switchCase.expression));
if (shouldMigrate) {
block.expression.visit(this.exprMigrator, true);
for (const switchCase of switchCases) {
this.migratableSwitchCases.add(switchCase);
}
}
super.visitSwitchBlock(block);
}
visitSwitchBlockCase(block) {
if (this.migratableSwitchCases.has(block) && block.expression) {
block.expression.visit(this.exprMigrator, true);
}
super.visitSwitchBlockCase(block);
}
visitDeferredTrigger(trigger) {
if (trigger instanceof compiler.TmplAstBoundDeferredTrigger) {
// @defer (when …): same logic as @if — not null-sensitive by default.
trigger.value.visit(this.exprMigrator, false);
}
super.visitDeferredTrigger(trigger);
}
}
function migrate() {
return async (tree) => {
await project_paths.runMigrationInDevkit({
tree,
getMigration: () => new SafeOptionalChainingMigration(),
});
};
}
exports.migrate = migrate;
/**
* Primitive JSON value.
*/
export type JsonPrimitive = string | number | boolean | null;
/**
* Object-shaped JSON value.
*/
export interface JsonObject {
[key: string]: JsonValue;
}
/**
* Any valid JSON value.
*/
export type JsonValue = JsonPrimitive | JsonObject | JsonValue[];
/**
* JSON Schema property definition.
*
* @see {@link https://json-schema.org/}
*/
export interface InputSchemaProperty {
/**
* JSON Schema type for this property.
*/
type?: string;
/**
* Human-readable description of the property.
*/
description?: string;
/**
* Additional JSON Schema keywords.
*/
[key: string]: unknown;
}
/**
* JSON Schema definition for tool input parameters.
*
* @see {@link https://json-schema.org/}
*/
export interface InputSchema {
/**
* JSON Schema type for the root value (usually `'object'` for tool args).
*/
type?: string;
/**
* Property definitions for object schemas.
*/
properties?: Record<string, InputSchemaProperty>;
/**
* List of required property names.
*/
required?: readonly string[];
/**
* Additional JSON Schema keywords.
*/
[key: string]: unknown;
}
/**
* Plain text content.
*/
export interface TextContent {
/**
* Discriminator for text content.
*/
type: 'text';
/**
* UTF-8 text value.
*/
text: string;
}
/**
* Base64-encoded image content.
*/
export interface ImageContent {
/**
* Discriminator for image content.
*/
type: 'image';
/**
* Base64 payload.
*/
data: string;
/**
* MIME type for the encoded image.
*/
mimeType: string;
}
/**
* Base64-encoded audio content.
*/
export interface AudioContent {
/**
* Discriminator for audio content.
*/
type: 'audio';
/**
* Base64 payload.
*/
data: string;
/**
* MIME type for the encoded audio.
*/
mimeType: string;
}
/**
* Text resource contents.
*/
export interface TextResourceContents {
/**
* Canonical resource URI.
*/
uri: string;
/**
* Optional MIME type.
*/
mimeType?: string;
/**
* UTF-8 resource payload.
*/
text: string;
}
/**
* Binary resource contents encoded as base64.
*/
export interface BlobResourceContents {
/**
* Canonical resource URI.
*/
uri: string;
/**
* Optional MIME type.
*/
mimeType?: string;
/**
* Base64-encoded binary payload.
*/
blob: string;
}
/**
* Resource contents returned by resource reads.
*/
export type ResourceContents = TextResourceContents | BlobResourceContents;
/**
* Embedded resource content block.
*/
export interface EmbeddedResource {
/**
* Discriminator for embedded resources.
*/
type: 'resource';
/**
* Inlined resource contents.
*/
resource: ResourceContents;
}
/**
* Link to an externally retrievable resource.
*/
export interface ResourceLink {
/**
* Discriminator for resource links.
*/
type: 'resource_link';
/**
* Resource URI.
*/
uri: string;
/**
* Optional display name.
*/
name?: string;
/**
* Optional human-readable description.
*/
description?: string;
/**
* Optional MIME type hint.
*/
mimeType?: string;
}
/**
* Any content block allowed in tool responses.
*/
export type ContentBlock = TextContent | ImageContent | AudioContent | ResourceLink | EmbeddedResource;
/**
* Looser content block shape accepted by many MCP tool implementations.
*
* This keeps tool return typing practical while preserving strict content
* unions via {@link ContentBlock} for consumers that want discriminated checks.
*/
export type LooseContentBlock = Record<string, unknown> & {
type?: string;
};
/**
* The result returned from tool execution.
*
* @see {@link https://spec.modelcontextprotocol.io/specification/server/tools/}
*/
export interface CallToolResult {
/**
* Ordered content blocks to return to the model.
*/
content: Array<ContentBlock | LooseContentBlock>;
/**
* Optional machine-readable payload.
*/
structuredContent?: JsonObject;
/**
* Marks the result as an error response.
*/
isError?: boolean;
}
/**
* Alias for {@link CallToolResult} for API consistency.
*/
export type ToolResponse = CallToolResult;
/**
* Form-based elicitation request parameters.
*/
export interface ElicitationFormParams {
/**
* Elicitation mode. Omit or set to `'form'` for form input.
*/
mode?: 'form';
/**
* User-facing message.
*/
message: string;
/**
* Requested form schema.
*/
requestedSchema: {
/**
* Root schema type.
*/
type: 'object';
/**
* Field definitions.
*/
properties: Record<string, InputSchema>;
/**
* Required field names.
*/
required?: readonly string[];
/**
* Additional schema keywords.
*/
[key: string]: unknown;
};
}
/**
* URL-based elicitation request parameters.
*/
export interface ElicitationUrlParams {
/**
* Elicitation mode.
*/
mode: 'url';
/**
* User-facing message.
*/
message: string;
/**
* Unique elicitation identifier.
*/
elicitationId: string;
/**
* URL to open.
*/
url: string;
}
/**
* Elicitation request parameters.
*/
export type ElicitationParams = ElicitationFormParams | ElicitationUrlParams;
/**
* Result returned by an elicitation request.
*/
export interface ElicitationResult {
/**
* User decision.
*/
action: 'accept' | 'decline' | 'cancel';
/**
* Submitted values when `action` is `'accept'`.
*/
content?: Record<string, string | number | boolean | string[]>;
}
/**
* Registration handle returned by registration methods.
*/
export interface RegistrationHandle {
/**
* Unregisters the associated item.
*/
unregister: () => void;
}
//# sourceMappingURL=common.d.ts.map
import type { JsonPrimitive, JsonValue } from './common.js';
/**
* Primitive JSON Schema `type` values supported by the MVP inference layer.
*/
export type JsonSchemaPrimitiveType = 'string' | 'number' | 'integer' | 'boolean' | 'null';
/**
* JSON Schema `type` values supported by the MVP inference layer.
*/
export type JsonSchemaType = JsonSchemaPrimitiveType | 'object' | 'array';
/**
* JSON Schema multi-type tuple (for example `["string", "null"]`).
*/
export type JsonSchemaTypeArray = readonly [JsonSchemaType, ...JsonSchemaType[]];
/**
* Literal values supported in JSON Schema `enum`/`const`.
*/
export type JsonSchemaEnumValue = JsonPrimitive | JsonValue;
/**
* Extra JSON Schema keywords tolerated by the inference layer.
*
* These keys are intentionally accepted as opaque metadata. Inference only uses
* the core MVP keywords and ignores these fields.
*/
interface SupplementalJsonSchemaKeywords {
$defs?: unknown;
$ref?: unknown;
additionalItems?: unknown;
allOf?: unknown;
anyOf?: unknown;
contains?: unknown;
definitions?: unknown;
dependentRequired?: unknown;
dependentSchemas?: unknown;
format?: unknown;
if?: unknown;
maxContains?: unknown;
minContains?: unknown;
not?: unknown;
oneOf?: unknown;
patternProperties?: unknown;
prefixItems?: unknown;
propertyNames?: unknown;
then?: unknown;
unevaluatedItems?: unknown;
unevaluatedProperties?: unknown;
}
/**
* Non-validation metadata accepted by the MVP inference subset.
*/
interface JsonSchemaMetadata extends SupplementalJsonSchemaKeywords {
default?: JsonValue;
description?: string;
examples?: readonly JsonValue[];
/**
* OpenAPI-compatible nullability marker.
*/
nullable?: boolean;
title?: string;
}
/**
* JSON Schema for `type: "string"`.
*/
export interface JsonSchemaString extends JsonSchemaMetadata {
const?: string;
enum?: readonly string[];
maxLength?: number;
minLength?: number;
pattern?: string;
type: 'string';
}
/**
* JSON Schema for `type: "number"` and `type: "integer"`.
*/
export interface JsonSchemaNumber extends JsonSchemaMetadata {
const?: number;
enum?: readonly number[];
exclusiveMaximum?: number;
exclusiveMinimum?: number;
maximum?: number;
minimum?: number;
multipleOf?: number;
type: 'number' | 'integer';
}
/**
* JSON Schema for `type: "boolean"`.
*/
export interface JsonSchemaBoolean extends JsonSchemaMetadata {
const?: boolean;
enum?: readonly boolean[];
type: 'boolean';
}
/**
* JSON Schema for `type: "null"`.
*/
export interface JsonSchemaNull extends JsonSchemaMetadata {
const?: null;
enum?: readonly null[];
type: 'null';
}
/**
* JSON Schema for `type: "array"`.
*/
export interface JsonSchemaArray extends JsonSchemaMetadata {
items: JsonSchemaForInference;
maxItems?: number;
minItems?: number;
type: 'array';
uniqueItems?: boolean;
}
/**
* JSON Schema for `type: "object"`.
*/
export interface JsonSchemaObject extends JsonSchemaMetadata {
additionalProperties?: boolean | JsonSchemaForInference;
maxProperties?: number;
minProperties?: number;
properties?: Readonly<Record<string, JsonSchemaForInference>>;
required?: readonly string[];
type: 'object';
}
/**
* JSON Schema for multi-type unions via `type: [...]`.
*/
export interface JsonSchemaMultiType extends JsonSchemaMetadata {
additionalProperties?: boolean | JsonSchemaForInference;
const?: JsonSchemaEnumValue;
enum?: readonly JsonSchemaEnumValue[];
items?: JsonSchemaForInference;
properties?: Readonly<Record<string, JsonSchemaForInference>>;
required?: readonly string[];
type: JsonSchemaTypeArray;
}
/**
* JSON Schema subset supported by the MVP type inference layer.
*/
export type JsonSchemaForInference = JsonSchemaArray | JsonSchemaBoolean | JsonSchemaMultiType | JsonSchemaNull | JsonSchemaNumber | JsonSchemaObject | JsonSchemaString;
type Simplify<T> = {
[K in keyof T]: T[K];
} & {};
type EmptyObject = Record<never, never>;
type EnumLiteral<TSchema> = TSchema extends {
enum: infer TEnum extends readonly unknown[];
} ? Extract<TEnum[number], JsonSchemaEnumValue> : never;
type ConstLiteral<TSchema> = TSchema extends {
const: infer TConst;
} ? Extract<TConst, JsonSchemaEnumValue> : never;
type PropertiesOf<TSchema> = TSchema extends {
properties: infer TProperties extends Readonly<Record<string, JsonSchemaForInference>>;
} ? TProperties : EmptyObject;
type RequiredKeysOf<TSchema, TProperties extends Record<string, unknown>> = TSchema extends {
required: readonly (infer TRequired)[];
} ? string extends TRequired ? never : Extract<TRequired, keyof TProperties & string> : never;
type RequiredProps<TProperties extends Record<string, JsonSchemaForInference>, TRequiredKeys extends string> = {
[K in keyof TProperties as K extends TRequiredKeys ? K : never]-?: InferJsonSchema<TProperties[K]>;
};
type OptionalProps<TProperties extends Record<string, JsonSchemaForInference>, TRequiredKeys extends string> = {
[K in keyof TProperties as K extends TRequiredKeys ? never : K]?: InferJsonSchema<TProperties[K]>;
};
type PropertyKeysOf<TSchema> = keyof PropertiesOf<TSchema> & string;
type AdditionalSchemaOf<TSchema> = TSchema extends {
additionalProperties: infer TAdditional;
} ? TAdditional : undefined;
type AdditionalPropsValue<TSchema> = AdditionalSchemaOf<TSchema> extends JsonSchemaForInference ? InferJsonSchema<AdditionalSchemaOf<TSchema>> : unknown;
type AdditionalPropsOf<TSchema> = TSchema extends {
additionalProperties: false;
} ? EmptyObject : AdditionalSchemaOf<TSchema> extends JsonSchemaForInference ? PropertyKeysOf<TSchema> extends never ? Record<string, AdditionalPropsValue<TSchema>> : Record<string, unknown> : Record<string, unknown>;
type InferObject<TSchema> = Simplify<RequiredProps<PropertiesOf<TSchema>, RequiredKeysOf<TSchema, PropertiesOf<TSchema>>> & OptionalProps<PropertiesOf<TSchema>, RequiredKeysOf<TSchema, PropertiesOf<TSchema>>> & AdditionalPropsOf<TSchema>>;
type TypeKeywordOf<TSchema> = TSchema extends {
type?: infer TType;
} ? 'type' extends keyof TSchema ? TType : undefined : undefined;
type TypeOptionsOf<TSchema> = [TypeKeywordOf<TSchema>] extends [undefined] ? 'object' : TypeKeywordOf<TSchema> extends readonly unknown[] ? Extract<TypeKeywordOf<TSchema>[number], JsonSchemaType> : Extract<TypeKeywordOf<TSchema>, JsonSchemaType>;
type InferFromTypeOption<TSchema, TType extends JsonSchemaType> = TType extends 'object' ? InferObject<TSchema> : TType extends 'array' ? TSchema extends {
items: infer TItems;
} ? InferJsonSchema<TItems>[] : unknown[] : TType extends 'string' ? string : TType extends 'number' | 'integer' ? number : TType extends 'boolean' ? boolean : TType extends 'null' ? null : unknown;
type InferFromTypeKeyword<TSchema> = TypeOptionsOf<TSchema> extends never ? unknown : InferFromTypeOption<TSchema, TypeOptionsOf<TSchema>>;
type ApplyNullable<TSchema, TValue> = TSchema extends {
nullable: true;
} ? TValue | null : TValue;
/**
* Infers a TypeScript type from the supported JSON Schema subset.
*
* `const` and `enum` take precedence when present.
*/
export type InferJsonSchema<TSchema> = [ConstLiteral<TSchema>] extends [never] ? [EnumLiteral<TSchema>] extends [never] ? ApplyNullable<TSchema, InferFromTypeKeyword<TSchema>> : ApplyNullable<TSchema, EnumLiteral<TSchema>> : ApplyNullable<TSchema, ConstLiteral<TSchema>>;
type IsWidenedTypeKeyword<TTypeKeyword> = string extends TTypeKeyword ? true : TTypeKeyword extends readonly unknown[] ? string extends TTypeKeyword[number] ? true : false : false;
type IncludesObjectType<TSchema> = TypeOptionsOf<TSchema> extends never ? false : 'object' extends TypeOptionsOf<TSchema> ? true : false;
/**
* Infers tool argument types from a root `InputSchema`.
*
* If the schema is not a literal object schema (for example a widened
* `InputSchema` loaded at runtime), this intentionally falls back to
* `Record<string, unknown>`.
*/
export type InferArgsFromInputSchema<TSchema> = IsWidenedTypeKeyword<TypeKeywordOf<TSchema>> extends true ? Record<string, unknown> : IncludesObjectType<TSchema> extends true ? InferObject<TSchema> : Record<string, unknown>;
export {};
//# sourceMappingURL=json-schema.d.ts.map
/**
* @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.dev/license
*/
export {InferArgsFromInputSchema, JsonSchemaForInference} from './dist/json-schema.js';
MIT License
Copyright (c) 2025 mcp-b contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+1
-1
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -4,0 +4,0 @@ * License: MIT

@@ -1,1 +0,1 @@

{"version":3,"file":"_attribute-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/event-dispatch/src/attribute.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nexport const Attribute = {\n /**\n * The jsaction attribute defines a mapping of a DOM event to a\n * generic event (aka jsaction), to which the actual event handlers\n * that implement the behavior of the application are bound. The\n * value is a semicolon separated list of colon separated pairs of\n * an optional DOM event name and a jsaction name. If the optional\n * DOM event name is omitted, 'click' is assumed. The jsaction names\n * are dot separated pairs of a namespace and a simple jsaction\n * name.\n *\n * See grammar in README.md for expected syntax in the attribute value.\n */\n JSACTION: 'jsaction' as const,\n};\n"],"names":["Attribute","JSACTION"],"mappings":";;;;;;AAQO,MAAMA,SAAS,GAAG;AAavBC,EAAAA,QAAQ,EAAE;;;;;"}
{"version":3,"file":"_attribute-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/event-dispatch/src/attribute.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nexport const Attribute = {\n /**\n * The jsaction attribute defines a mapping of a DOM event to a\n * generic event (aka jsaction), to which the actual event handlers\n * that implement the behavior of the application are bound. The\n * value is a semicolon separated list of colon separated pairs of\n * an optional DOM event name and a jsaction name. If the optional\n * DOM event name is omitted, 'click' is assumed. The jsaction names\n * are dot separated pairs of a namespace and a simple jsaction\n * name.\n *\n * See grammar in README.md for expected syntax in the attribute value.\n */\n JSACTION: 'jsaction' as const,\n};\n"],"names":["Attribute","JSACTION"],"mappings":";;;;;;AAQO,MAAMA,SAAS,GAAG;AAavBC,EAAAA,QAAQ,EAAE;;;;;"}
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -4,0 +4,0 @@ * License: MIT

@@ -1,1 +0,1 @@

{"version":3,"file":"_effect-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/graph.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/equality.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/computed.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/errors.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/signal.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/effect.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n// Required as the signals library is in a separate package, so we need to explicitly ensure the\n// global `ngDevMode` type is defined.\ndeclare const ngDevMode: boolean | undefined;\n\n/**\n * The currently active consumer `ReactiveNode`, if running code in a reactive context.\n *\n * Change this via `setActiveConsumer`.\n */\nlet activeConsumer: ReactiveNode | null = null;\nlet inNotificationPhase = false;\n\nexport type Version = number & {__brand: 'Version'};\n\n/**\n * Global epoch counter. Incremented whenever a source signal is set.\n */\nlet epoch: Version = 1 as Version;\n\nexport type ReactiveHookFn = (node: ReactiveNode) => void;\n\n/**\n * If set, called after a producer `ReactiveNode` is created.\n */\nlet postProducerCreatedFn: ReactiveHookFn | null = null;\n\n/**\n * Symbol used to tell `Signal`s apart from other functions.\n *\n * This can be used to auto-unwrap signals in various cases, or to auto-wrap non-signal values.\n */\nexport const SIGNAL: unique symbol = /* @__PURE__ */ Symbol('SIGNAL');\n\nexport function setActiveConsumer(consumer: ReactiveNode | null): ReactiveNode | null {\n const prev = activeConsumer;\n activeConsumer = consumer;\n return prev;\n}\n\nexport function getActiveConsumer(): ReactiveNode | null {\n return activeConsumer;\n}\n\nexport function isInNotificationPhase(): boolean {\n return inNotificationPhase;\n}\n\nexport interface Reactive {\n [SIGNAL]: ReactiveNode;\n}\n\nexport function isReactive(value: unknown): value is Reactive {\n return (value as Partial<Reactive>)[SIGNAL] !== undefined;\n}\n\nexport const REACTIVE_NODE: ReactiveNode = {\n version: 0 as Version,\n lastCleanEpoch: 0 as Version,\n dirty: false,\n producers: undefined,\n producersTail: undefined,\n consumers: undefined,\n consumersTail: undefined,\n recomputing: false,\n consumerAllowSignalWrites: false,\n consumerIsAlwaysLive: false,\n kind: 'unknown',\n producerMustRecompute: () => false,\n producerRecomputeValue: () => {},\n consumerMarkedDirty: () => {},\n consumerOnSignalRead: () => {},\n};\n\ninterface ReactiveLink {\n producer: ReactiveNode;\n consumer: ReactiveNode;\n lastReadVersion: number;\n prevConsumer: ReactiveLink | undefined;\n nextConsumer: ReactiveLink | undefined;\n nextProducer: ReactiveLink | undefined;\n}\n\nexport type ReactiveNodeKind =\n | 'signal'\n | 'computed'\n | 'effect'\n | 'template'\n | 'linkedSignal'\n | 'afterRenderEffectPhase'\n | 'unknown';\n\n/**\n * A producer and/or consumer which participates in the reactive graph.\n *\n * Producer `ReactiveNode`s which are accessed when a consumer `ReactiveNode` is the\n * `activeConsumer` are tracked as dependencies of that consumer.\n *\n * Certain consumers are also tracked as \"live\" consumers and create edges in the other direction,\n * from producer to consumer. These edges are used to propagate change notifications when a\n * producer's value is updated.\n *\n * A `ReactiveNode` may be both a producer and consumer.\n */\nexport interface ReactiveNode {\n /**\n * Version of the value that this node produces.\n *\n * This is incremented whenever a new value is produced by this node which is not equal to the\n * previous value (by whatever definition of equality is in use).\n */\n version: Version;\n\n /**\n * Epoch at which this node is verified to be clean.\n *\n * This allows skipping of some polling operations in the case where no signals have been set\n * since this node was last read.\n */\n lastCleanEpoch: Version;\n\n /**\n * Whether this node (in its consumer capacity) is dirty.\n *\n * Only live consumers become dirty, when receiving a change notification from a dependency\n * producer.\n */\n dirty: boolean;\n\n /**\n * Whether this node is currently rebuilding its producer list.\n */\n recomputing: boolean;\n\n /**\n * Producers which are dependencies of this consumer.\n */\n producers: ReactiveLink | undefined;\n\n /**\n * Points to the last linked list node in the `producers` linked list.\n *\n * When this node is recomputing, this is used to track the producers that we have accessed so far.\n */\n producersTail: ReactiveLink | undefined;\n\n /**\n * Linked list of consumers of this producer that are \"live\" (they require push notifications).\n *\n * The length of this list is effectively our reference count for this node.\n */\n consumers: ReactiveLink | undefined;\n consumersTail: ReactiveLink | undefined;\n\n /**\n * Whether writes to signals are allowed when this consumer is the `activeConsumer`.\n *\n * This is used to enforce guardrails such as preventing writes to writable signals in the\n * computation function of computed signals, which is supposed to be pure.\n */\n consumerAllowSignalWrites: boolean;\n\n readonly consumerIsAlwaysLive: boolean;\n\n /**\n * Tracks whether producers need to recompute their value independently of the reactive graph (for\n * example, if no initial value has been computed).\n */\n producerMustRecompute(node: unknown): boolean;\n producerRecomputeValue(node: unknown): void;\n consumerMarkedDirty(node: unknown): void;\n\n /**\n * Called when a signal is read within this consumer.\n */\n consumerOnSignalRead(node: unknown): void;\n\n /**\n * A debug name for the reactive node. Used in Angular DevTools to identify the node.\n */\n debugName?: string;\n\n /**\n * Kind of node. Example: 'signal', 'computed', 'input', 'effect'.\n *\n * ReactiveNode has this as 'unknown' by default, but derived node types should override this to\n * make available the kind of signal that particular instance of a ReactiveNode represents.\n *\n * Used in Angular DevTools to identify the kind of signal.\n */\n kind: ReactiveNodeKind;\n}\n\n/**\n * Called by implementations when a producer's signal is read.\n */\nexport function producerAccessed(node: ReactiveNode): void {\n if (inNotificationPhase) {\n throw new Error(\n typeof ngDevMode !== 'undefined' && ngDevMode\n ? `Assertion error: signal read during notification phase`\n : '',\n );\n }\n\n if (activeConsumer === null) {\n // Accessed outside of a reactive context, so nothing to record.\n return;\n }\n\n activeConsumer.consumerOnSignalRead(node);\n\n const prevProducerLink = activeConsumer.producersTail;\n\n // If the last producer we accessed is the same as the current one, we can skip adding a new\n // link\n if (prevProducerLink !== undefined && prevProducerLink.producer === node) {\n return;\n }\n\n let nextProducerLink: ReactiveLink | undefined = undefined;\n const isRecomputing = activeConsumer.recomputing;\n if (isRecomputing) {\n // If we're incrementally rebuilding the producers list, we want to check if the next producer\n // in the list is the same as the one we're trying to add.\n\n // If the previous producer is defined, then the next producer is just the one that follows it.\n // Otherwise, we should check the head of the producers list (the first node that we accessed the last time this consumer was run).\n nextProducerLink =\n prevProducerLink !== undefined ? prevProducerLink.nextProducer : activeConsumer.producers;\n if (nextProducerLink !== undefined && nextProducerLink.producer === node) {\n // If the next producer is the same as the one we're trying to add, we can just update the\n // last read version, update the tail of the producers list of this rerun, and return.\n activeConsumer.producersTail = nextProducerLink;\n nextProducerLink.lastReadVersion = node.version;\n return;\n }\n }\n\n const prevConsumerLink = node.consumersTail;\n\n // If the producer we're accessing already has a link to this consumer, we can skip adding a new\n // link. This can short circuit the creation of a new link in the case where the consumer reads alternating ReeactiveNodes\n if (\n prevConsumerLink !== undefined &&\n prevConsumerLink.consumer === activeConsumer &&\n // However, we have to make sure that the link we've discovered isn't from a node that is incrementally rebuilding its producer list\n (!isRecomputing || isValidLink(prevConsumerLink, activeConsumer))\n ) {\n // If we found an existing link to the consumer we can just return.\n return;\n }\n\n // If we got here, it means that we need to create a new link between the producer and the consumer.\n const isLive = consumerIsLive(activeConsumer);\n const newLink = {\n producer: node,\n consumer: activeConsumer,\n // instead of eagerly destroying the previous link, we delay until we've finished recomputing\n // the producers list, so that we can destroy all of the old links at once.\n nextProducer: nextProducerLink,\n prevConsumer: prevConsumerLink,\n lastReadVersion: node.version,\n nextConsumer: undefined,\n };\n activeConsumer.producersTail = newLink;\n if (prevProducerLink !== undefined) {\n prevProducerLink.nextProducer = newLink;\n } else {\n activeConsumer.producers = newLink;\n }\n\n if (isLive) {\n producerAddLiveConsumer(node, newLink);\n }\n}\n\n/**\n * Increment the global epoch counter.\n *\n * Called by source producers (that is, not computeds) whenever their values change.\n */\nexport function producerIncrementEpoch(): void {\n epoch++;\n}\n\n/**\n * Ensure this producer's `version` is up-to-date.\n */\nexport function producerUpdateValueVersion(node: ReactiveNode): void {\n if (consumerIsLive(node) && !node.dirty) {\n // A live consumer will be marked dirty by producers, so a clean state means that its version\n // is guaranteed to be up-to-date.\n return;\n }\n\n if (!node.dirty && node.lastCleanEpoch === epoch) {\n // Even non-live consumers can skip polling if they previously found themselves to be clean at\n // the current epoch, since their dependencies could not possibly have changed (such a change\n // would've increased the epoch).\n return;\n }\n\n if (!node.producerMustRecompute(node) && !consumerPollProducersForChange(node)) {\n // None of our producers report a change since the last time they were read, so no\n // recomputation of our value is necessary, and we can consider ourselves clean.\n producerMarkClean(node);\n return;\n }\n\n node.producerRecomputeValue(node);\n\n // After recomputing the value, we're no longer dirty.\n producerMarkClean(node);\n}\n\n/**\n * Propagate a dirty notification to live consumers of this producer.\n */\nexport function producerNotifyConsumers(node: ReactiveNode): void {\n if (node.consumers === undefined) {\n return;\n }\n\n // Prevent signal reads when we're updating the graph\n const prev = inNotificationPhase;\n inNotificationPhase = true;\n try {\n for (\n let link: ReactiveLink | undefined = node.consumers;\n link !== undefined;\n link = link.nextConsumer\n ) {\n const consumer = link.consumer;\n if (!consumer.dirty) {\n consumerMarkDirty(consumer);\n }\n }\n } finally {\n inNotificationPhase = prev;\n }\n}\n\n/**\n * Whether this `ReactiveNode` in its producer capacity is currently allowed to initiate updates,\n * based on the current consumer context.\n */\nexport function producerUpdatesAllowed(): boolean {\n return activeConsumer?.consumerAllowSignalWrites !== false;\n}\n\nexport function consumerMarkDirty(node: ReactiveNode): void {\n node.dirty = true;\n producerNotifyConsumers(node);\n node.consumerMarkedDirty?.(node);\n}\n\nexport function producerMarkClean(node: ReactiveNode): void {\n node.dirty = false;\n node.lastCleanEpoch = epoch;\n}\n\n/**\n * Prepare this consumer to run a computation in its reactive context and set\n * it as the active consumer.\n *\n * Must be called by subclasses which represent reactive computations, before those computations\n * begin.\n */\nexport function consumerBeforeComputation(node: ReactiveNode | null): ReactiveNode | null {\n if (node) resetConsumerBeforeComputation(node);\n\n return setActiveConsumer(node);\n}\n\n/**\n * Prepare this consumer to run a computation in its reactive context.\n *\n * We expose this mainly for code where we manually batch effects into a single\n * consumer. In those cases we may wish to \"reopen\" a consumer multiple times\n * in initial render before finalizing it. Most code should just call\n * `consumerBeforeComputation` instead of calling this directly.\n */\nexport function resetConsumerBeforeComputation(node: ReactiveNode): void {\n node.producersTail = undefined;\n node.recomputing = true;\n}\n\n/**\n * Finalize this consumer's state and set previous consumer as the active consumer after a\n * reactive computation has run.\n *\n * Must be called by subclasses which represent reactive computations, after those computations\n * have finished.\n */\nexport function consumerAfterComputation(\n node: ReactiveNode | null,\n prevConsumer: ReactiveNode | null,\n): void {\n setActiveConsumer(prevConsumer);\n\n if (node) finalizeConsumerAfterComputation(node);\n}\n\n/**\n * Finalize this consumer's state after a reactive computation has run.\n *\n * We expose this mainly for code where we manually batch effects into a single\n * consumer. In those cases we may wish to \"reopen\" a consumer multiple times\n * in initial render before finalizing it. Most code should just call\n * `consumerAfterComputation` instead of calling this directly.\n */\nexport function finalizeConsumerAfterComputation(node: ReactiveNode): void {\n node.recomputing = false;\n\n // We've finished incrementally rebuilding the producers list, now if there are any producers\n // that are after producersTail, they are stale and should be removed.\n const producersTail = node.producersTail as ReactiveLink | undefined;\n let toRemove = producersTail !== undefined ? producersTail.nextProducer : node.producers;\n if (toRemove !== undefined) {\n if (consumerIsLive(node)) {\n // For each stale link, we first unlink it from the producers list of consumers\n do {\n toRemove = producerRemoveLiveConsumerLink(toRemove);\n } while (toRemove !== undefined);\n }\n\n // Now, we can truncate the producers list to remove all stale links.\n if (producersTail !== undefined) {\n producersTail.nextProducer = undefined;\n } else {\n node.producers = undefined;\n }\n }\n}\n\n/**\n * Determine whether this consumer has any dependencies which have changed since the last time\n * they were read.\n */\nexport function consumerPollProducersForChange(node: ReactiveNode): boolean {\n // Poll producers for change.\n for (let link = node.producers; link !== undefined; link = link.nextProducer) {\n const producer = link.producer;\n const seenVersion = link.lastReadVersion;\n\n // First check the versions. A mismatch means that the producer's value is known to have\n // changed since the last time we read it.\n if (seenVersion !== producer.version) {\n return true;\n }\n\n // The producer's version is the same as the last time we read it, but it might itself be\n // stale. Force the producer to recompute its version (calculating a new value if necessary).\n producerUpdateValueVersion(producer);\n\n // Now when we do this check, `producer.version` is guaranteed to be up to date, so if the\n // versions still match then it has not changed since the last time we read it.\n if (seenVersion !== producer.version) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Disconnect this consumer from the graph.\n */\nexport function consumerDestroy(node: ReactiveNode): void {\n if (consumerIsLive(node)) {\n // Drop all connections from the graph to this node.\n let link = node.producers;\n while (link !== undefined) {\n link = producerRemoveLiveConsumerLink(link);\n }\n }\n\n // Truncate all the linked lists to drop all connection from this node to the graph.\n node.producers = undefined;\n node.producersTail = undefined;\n node.consumers = undefined;\n node.consumersTail = undefined;\n}\n\n/**\n * Add `consumer` as a live consumer of this node.\n *\n * Note that this operation is potentially transitive. If this node becomes live, then it becomes\n * a live consumer of all of its current producers.\n */\nfunction producerAddLiveConsumer(node: ReactiveNode, link: ReactiveLink): void {\n const consumersTail = node.consumersTail;\n const wasLive = consumerIsLive(node);\n if (consumersTail !== undefined) {\n link.nextConsumer = consumersTail.nextConsumer;\n consumersTail.nextConsumer = link;\n } else {\n link.nextConsumer = undefined;\n node.consumers = link;\n }\n link.prevConsumer = consumersTail;\n node.consumersTail = link;\n if (!wasLive) {\n for (\n let link: ReactiveLink | undefined = node.producers;\n link !== undefined;\n link = link.nextProducer\n ) {\n producerAddLiveConsumer(link.producer, link);\n }\n }\n}\n\nfunction producerRemoveLiveConsumerLink(link: ReactiveLink): ReactiveLink | undefined {\n const producer = link.producer;\n const nextProducer = link.nextProducer;\n const nextConsumer = link.nextConsumer;\n const prevConsumer = link.prevConsumer;\n link.nextConsumer = undefined;\n link.prevConsumer = undefined;\n if (nextConsumer !== undefined) {\n nextConsumer.prevConsumer = prevConsumer;\n } else {\n producer.consumersTail = prevConsumer;\n }\n if (prevConsumer !== undefined) {\n prevConsumer.nextConsumer = nextConsumer;\n } else {\n producer.consumers = nextConsumer;\n if (!consumerIsLive(producer)) {\n let producerLink = producer.producers;\n while (producerLink !== undefined) {\n producerLink = producerRemoveLiveConsumerLink(producerLink);\n }\n }\n }\n return nextProducer;\n}\n\nfunction consumerIsLive(node: ReactiveNode): boolean {\n return node.consumerIsAlwaysLive || node.consumers !== undefined;\n}\n\nexport function runPostProducerCreatedFn(node: ReactiveNode): void {\n postProducerCreatedFn?.(node);\n}\n\nexport function setPostProducerCreatedFn(fn: ReactiveHookFn | null): ReactiveHookFn | null {\n const prev = postProducerCreatedFn;\n postProducerCreatedFn = fn;\n return prev;\n}\n\n// While a ReactiveNode is recomputing, it may not have destroyed previous links\n// This allows us to check if a given link will be destroyed by a reactivenode if it were to finish running immediately without accesing any more producers\nfunction isValidLink(checkLink: ReactiveLink, consumer: ReactiveNode): boolean {\n const producersTail = consumer.producersTail;\n if (producersTail !== undefined) {\n let link = consumer.producers!;\n do {\n if (link === checkLink) {\n return true;\n }\n if (link === producersTail) {\n break;\n }\n link = link.nextProducer!;\n } while (link !== undefined);\n }\n return false;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * A comparison function which can determine if two values are equal.\n */\nexport type ValueEqualityFn<T> = (a: T, b: T) => boolean;\n\n/**\n * The default equality function used for `signal` and `computed`, which uses referential equality.\n */\nexport function defaultEquals<T>(a: T, b: T) {\n return Object.is(a, b);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {defaultEquals, ValueEqualityFn} from './equality';\nimport {\n consumerAfterComputation,\n consumerBeforeComputation,\n producerAccessed,\n producerUpdateValueVersion,\n REACTIVE_NODE,\n ReactiveNode,\n runPostProducerCreatedFn,\n setActiveConsumer,\n SIGNAL,\n} from './graph';\n\n// Required as the signals library is in a separate package, so we need to explicitly ensure the\n// global `ngDevMode` type is defined.\ndeclare const ngDevMode: boolean | undefined;\n\n/**\n * A computation, which derives a value from a declarative reactive expression.\n *\n * `Computed`s are both producers and consumers of reactivity.\n */\nexport interface ComputedNode<T> extends ReactiveNode {\n /**\n * Current value of the computation, or one of the sentinel values above (`UNSET`, `COMPUTING`,\n * `ERROR`).\n */\n value: T;\n\n /**\n * If `value` is `ERRORED`, the error caught from the last computation attempt which will\n * be re-thrown.\n */\n error: unknown;\n\n /**\n * The computation function which will produce a new value.\n */\n computation: () => T;\n\n equal: ValueEqualityFn<T>;\n}\n\nexport type ComputedGetter<T> = (() => T) & {\n [SIGNAL]: ComputedNode<T>;\n};\n\n/**\n * Create a computed signal which derives a reactive value from an expression.\n */\nexport function createComputed<T>(\n computation: () => T,\n equal?: ValueEqualityFn<T>,\n): ComputedGetter<T> {\n const node: ComputedNode<T> = Object.create(COMPUTED_NODE);\n node.computation = computation;\n\n if (equal !== undefined) {\n node.equal = equal;\n }\n\n const computed = () => {\n // Check if the value needs updating before returning it.\n producerUpdateValueVersion(node);\n\n // Record that someone looked at this signal.\n producerAccessed(node);\n\n if (node.value === ERRORED) {\n throw node.error;\n }\n\n return node.value;\n };\n\n (computed as ComputedGetter<T>)[SIGNAL] = node;\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n computed.toString = () =>\n `[Computed${node.debugName ? ' (' + node.debugName + ')' : ''}: ${String(node.value)}]`;\n }\n\n runPostProducerCreatedFn(node);\n\n return computed as unknown as ComputedGetter<T>;\n}\n\n/**\n * A dedicated symbol used before a computed value has been calculated for the first time.\n * Explicitly typed as `any` so we can use it as signal's value.\n */\nexport const UNSET: any = /* @__PURE__ */ Symbol('UNSET');\n\n/**\n * A dedicated symbol used in place of a computed signal value to indicate that a given computation\n * is in progress. Used to detect cycles in computation chains.\n * Explicitly typed as `any` so we can use it as signal's value.\n */\nexport const COMPUTING: any = /* @__PURE__ */ Symbol('COMPUTING');\n\n/**\n * A dedicated symbol used in place of a computed signal value to indicate that a given computation\n * failed. The thrown error is cached until the computation gets dirty again.\n * Explicitly typed as `any` so we can use it as signal's value.\n */\nexport const ERRORED: any = /* @__PURE__ */ Symbol('ERRORED');\n\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.\nconst COMPUTED_NODE: Omit<ComputedNode<unknown>, 'computation'> = /* @__PURE__ */ (() => {\n return {\n ...REACTIVE_NODE,\n value: UNSET,\n dirty: true,\n error: null,\n equal: defaultEquals,\n kind: 'computed',\n\n producerMustRecompute(node: ComputedNode<unknown>): boolean {\n // Force a recomputation if there's no current value, or if the current value is in the\n // process of being calculated (which should throw an error).\n return node.value === UNSET || node.value === COMPUTING;\n },\n\n producerRecomputeValue(node: ComputedNode<unknown>): void {\n if (node.value === COMPUTING) {\n // Our computation somehow led to a cyclic read of itself.\n throw new Error(\n typeof ngDevMode !== 'undefined' && ngDevMode ? 'Detected cycle in computations.' : '',\n );\n }\n\n const oldValue = node.value;\n node.value = COMPUTING;\n\n const prevConsumer = consumerBeforeComputation(node);\n let newValue: unknown;\n let wasEqual = false;\n try {\n newValue = node.computation();\n // We want to mark this node as errored if calling `equal` throws; however, we don't want\n // to track any reactive reads inside `equal`.\n setActiveConsumer(null);\n wasEqual =\n oldValue !== UNSET &&\n oldValue !== ERRORED &&\n newValue !== ERRORED &&\n node.equal(oldValue, newValue);\n } catch (err) {\n newValue = ERRORED;\n node.error = err;\n } finally {\n consumerAfterComputation(node, prevConsumer);\n }\n\n if (wasEqual) {\n // No change to `valueVersion` - old and new values are\n // semantically equivalent.\n node.value = oldValue;\n return;\n }\n\n node.value = newValue;\n node.version++;\n },\n };\n})();\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport type {SignalNode} from './signal';\n\nfunction defaultThrowError(): never {\n throw new Error();\n}\n\nlet throwInvalidWriteToSignalErrorFn: <T>(node: SignalNode<T>) => never = defaultThrowError;\n\nexport function throwInvalidWriteToSignalError<T>(node: SignalNode<T>) {\n throwInvalidWriteToSignalErrorFn(node);\n}\n\nexport function setThrowInvalidWriteToSignalError(fn: <T>(node: SignalNode<T>) => never): void {\n throwInvalidWriteToSignalErrorFn = fn;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {defaultEquals, ValueEqualityFn} from './equality';\nimport {throwInvalidWriteToSignalError} from './errors';\nimport {\n producerAccessed,\n producerIncrementEpoch,\n producerNotifyConsumers,\n producerUpdatesAllowed,\n REACTIVE_NODE,\n ReactiveNode,\n ReactiveHookFn,\n runPostProducerCreatedFn,\n SIGNAL,\n} from './graph';\n\n// Required as the signals library is in a separate package, so we need to explicitly ensure the\n// global `ngDevMode` type is defined.\ndeclare const ngDevMode: boolean | undefined;\n\n/**\n * If set, called after `WritableSignal`s are updated.\n *\n * This hook can be used to achieve various effects, such as running effects synchronously as part\n * of setting a signal.\n */\nlet postSignalSetFn: ReactiveHookFn | null = null;\n\nexport interface SignalNode<T> extends ReactiveNode {\n value: T;\n equal: ValueEqualityFn<T>;\n}\n\nexport type SignalBaseGetter<T> = (() => T) & {readonly [SIGNAL]: unknown};\nexport type SignalSetter<T> = (newValue: T) => void;\nexport type SignalUpdater<T> = (updateFn: (value: T) => T) => void;\n\n// Note: Closure *requires* this to be an `interface` and not a type, which is why the\n// `SignalBaseGetter` type exists to provide the correct shape.\nexport interface SignalGetter<T> extends SignalBaseGetter<T> {\n readonly [SIGNAL]: SignalNode<T>;\n}\n\n/**\n * Creates a `Signal` getter, setter, and updater function.\n */\nexport function createSignal<T>(\n initialValue: T,\n equal?: ValueEqualityFn<T>,\n): [SignalGetter<T>, SignalSetter<T>, SignalUpdater<T>] {\n const node: SignalNode<T> = Object.create(SIGNAL_NODE);\n node.value = initialValue;\n if (equal !== undefined) {\n node.equal = equal;\n }\n const getter = (() => signalGetFn(node)) as SignalGetter<T>;\n (getter as any)[SIGNAL] = node;\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n getter.toString = () =>\n `[Signal${node.debugName ? ' (' + node.debugName + ')' : ''}: ${String(node.value)}]`;\n }\n\n runPostProducerCreatedFn(node);\n const set = (newValue: T) => signalSetFn(node, newValue);\n const update = (updateFn: (value: T) => T) => signalUpdateFn(node, updateFn);\n return [getter, set, update];\n}\n\nexport function setPostSignalSetFn(fn: ReactiveHookFn | null): ReactiveHookFn | null {\n const prev = postSignalSetFn;\n postSignalSetFn = fn;\n return prev;\n}\n\nexport function signalGetFn<T>(node: SignalNode<T>): T {\n producerAccessed(node);\n return node.value;\n}\n\nexport function signalSetFn<T>(node: SignalNode<T>, newValue: T) {\n if (!producerUpdatesAllowed()) {\n throwInvalidWriteToSignalError(node);\n }\n\n if (!node.equal(node.value, newValue)) {\n node.value = newValue;\n signalValueChanged(node);\n }\n}\n\nexport function signalUpdateFn<T>(node: SignalNode<T>, updater: (value: T) => T): void {\n if (!producerUpdatesAllowed()) {\n throwInvalidWriteToSignalError(node);\n }\n\n signalSetFn(node, updater(node.value));\n}\n\nexport function runPostSignalSetFn<T>(node: SignalNode<T>): void {\n postSignalSetFn?.(node);\n}\n\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.\nexport const SIGNAL_NODE: SignalNode<unknown> = /* @__PURE__ */ (() => {\n return {\n ...REACTIVE_NODE,\n equal: defaultEquals,\n value: undefined,\n kind: 'signal',\n };\n})();\n\nfunction signalValueChanged<T>(node: SignalNode<T>): void {\n node.version++;\n producerIncrementEpoch();\n producerNotifyConsumers(node);\n postSignalSetFn?.(node);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n consumerAfterComputation,\n consumerBeforeComputation,\n consumerPollProducersForChange,\n REACTIVE_NODE,\n ReactiveNode,\n} from './graph';\n\n/**\n * An effect can, optionally, register a cleanup function. If registered, the cleanup is executed\n * before the next effect run. The cleanup function makes it possible to \"cancel\" any work that the\n * previous effect run might have started.\n */\nexport type EffectCleanupFn = () => void;\n\n/**\n * A callback passed to the effect function that makes it possible to register cleanup logic.\n */\nexport type EffectCleanupRegisterFn = (cleanupFn: EffectCleanupFn) => void;\n\nexport interface BaseEffectNode extends ReactiveNode {\n fn: () => void;\n destroy(): void;\n cleanup(): void;\n run(): void;\n}\n\nexport const BASE_EFFECT_NODE: Omit<BaseEffectNode, 'fn' | 'destroy' | 'cleanup' | 'run'> =\n /* @__PURE__ */ (() => ({\n ...REACTIVE_NODE,\n consumerIsAlwaysLive: true,\n consumerAllowSignalWrites: true,\n dirty: true,\n kind: 'effect',\n }))();\n\nexport function runEffect(node: BaseEffectNode) {\n node.dirty = false;\n if (node.version > 0 && !consumerPollProducersForChange(node)) {\n return;\n }\n node.version++;\n const prevNode = consumerBeforeComputation(node);\n try {\n node.cleanup();\n node.fn();\n } finally {\n consumerAfterComputation(node, prevNode);\n }\n}\n"],"names":["activeConsumer","inNotificationPhase","epoch","postProducerCreatedFn","SIGNAL","Symbol","setActiveConsumer","consumer","prev","getActiveConsumer","isInNotificationPhase","isReactive","value","undefined","REACTIVE_NODE","version","lastCleanEpoch","dirty","producers","producersTail","consumers","consumersTail","recomputing","consumerAllowSignalWrites","consumerIsAlwaysLive","kind","producerMustRecompute","producerRecomputeValue","consumerMarkedDirty","consumerOnSignalRead","producerAccessed","node","Error","ngDevMode","prevProducerLink","producer","nextProducerLink","isRecomputing","nextProducer","lastReadVersion","prevConsumerLink","isValidLink","isLive","consumerIsLive","newLink","prevConsumer","nextConsumer","producerAddLiveConsumer","producerIncrementEpoch","producerUpdateValueVersion","consumerPollProducersForChange","producerMarkClean","producerNotifyConsumers","link","consumerMarkDirty","producerUpdatesAllowed","consumerBeforeComputation","resetConsumerBeforeComputation","consumerAfterComputation","finalizeConsumerAfterComputation","toRemove","producerRemoveLiveConsumerLink","seenVersion","consumerDestroy","wasLive","producerLink","runPostProducerCreatedFn","setPostProducerCreatedFn","fn","checkLink","defaultEquals","a","b","Object","is","createComputed","computation","equal","create","COMPUTED_NODE","computed","ERRORED","error","toString","debugName","String","UNSET","COMPUTING","oldValue","newValue","wasEqual","err","defaultThrowError","throwInvalidWriteToSignalErrorFn","throwInvalidWriteToSignalError","setThrowInvalidWriteToSignalError","postSignalSetFn","createSignal","initialValue","SIGNAL_NODE","getter","signalGetFn","set","signalSetFn","update","updateFn","signalUpdateFn","setPostSignalSetFn","signalValueChanged","updater","runPostSignalSetFn","BASE_EFFECT_NODE","runEffect","prevNode","cleanup"],"mappings":";;;;;;AAiBA,IAAIA,cAAc,GAAwB,IAAI;AAC9C,IAAIC,mBAAmB,GAAG,KAAK;AAO/B,IAAIC,KAAK,GAAY,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AAC;EAChD,IAAI;IACFA,IAAI,CAACmF,OAAO,EAAE;IACdnF,IAAI,CAACqC,EAAE,EAAE;AACX,EAAA,CAAA,SAAU;AACRV,IAAAA,wBAAwB,CAAC3B,IAAI,EAAEkF,QAAQ,CAAC;AAC1C,EAAA;AACF;;;;"}
{"version":3,"file":"_effect-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/graph.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/equality.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/computed.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/errors.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/signal.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/effect.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n// Required as the signals library is in a separate package, so we need to explicitly ensure the\n// global `ngDevMode` type is defined.\ndeclare const ngDevMode: boolean | undefined;\n\n/**\n * The currently active consumer `ReactiveNode`, if running code in a reactive context.\n *\n * Change this via `setActiveConsumer`.\n */\nlet activeConsumer: ReactiveNode | null = null;\nlet inNotificationPhase = false;\n\nexport type Version = number & {__brand: 'Version'};\n\n/**\n * Global epoch counter. Incremented whenever a source signal is set.\n */\nlet epoch: Version = 1 as Version;\n\nexport type ReactiveHookFn = (node: ReactiveNode) => void;\n\n/**\n * If set, called after a producer `ReactiveNode` is created.\n */\nlet postProducerCreatedFn: ReactiveHookFn | null = null;\n\n/**\n * Symbol used to tell `Signal`s apart from other functions.\n *\n * This can be used to auto-unwrap signals in various cases, or to auto-wrap non-signal values.\n */\nexport const SIGNAL: unique symbol = /* @__PURE__ */ Symbol('SIGNAL');\n\nexport function setActiveConsumer(consumer: ReactiveNode | null): ReactiveNode | null {\n const prev = activeConsumer;\n activeConsumer = consumer;\n return prev;\n}\n\nexport function getActiveConsumer(): ReactiveNode | null {\n return activeConsumer;\n}\n\nexport function isInNotificationPhase(): boolean {\n return inNotificationPhase;\n}\n\nexport interface Reactive {\n [SIGNAL]: ReactiveNode;\n}\n\nexport function isReactive(value: unknown): value is Reactive {\n return (value as Partial<Reactive>)[SIGNAL] !== undefined;\n}\n\nexport const REACTIVE_NODE: ReactiveNode = {\n version: 0 as Version,\n lastCleanEpoch: 0 as Version,\n dirty: false,\n producers: undefined,\n producersTail: undefined,\n consumers: undefined,\n consumersTail: undefined,\n recomputing: false,\n consumerAllowSignalWrites: false,\n consumerIsAlwaysLive: false,\n kind: 'unknown',\n producerMustRecompute: () => false,\n producerRecomputeValue: () => {},\n consumerMarkedDirty: () => {},\n consumerOnSignalRead: () => {},\n};\n\ninterface ReactiveLink {\n producer: ReactiveNode;\n consumer: ReactiveNode;\n lastReadVersion: number;\n prevConsumer: ReactiveLink | undefined;\n nextConsumer: ReactiveLink | undefined;\n nextProducer: ReactiveLink | undefined;\n}\n\nexport type ReactiveNodeKind =\n | 'signal'\n | 'computed'\n | 'effect'\n | 'template'\n | 'linkedSignal'\n | 'afterRenderEffectPhase'\n | 'unknown';\n\n/**\n * A producer and/or consumer which participates in the reactive graph.\n *\n * Producer `ReactiveNode`s which are accessed when a consumer `ReactiveNode` is the\n * `activeConsumer` are tracked as dependencies of that consumer.\n *\n * Certain consumers are also tracked as \"live\" consumers and create edges in the other direction,\n * from producer to consumer. These edges are used to propagate change notifications when a\n * producer's value is updated.\n *\n * A `ReactiveNode` may be both a producer and consumer.\n */\nexport interface ReactiveNode {\n /**\n * Version of the value that this node produces.\n *\n * This is incremented whenever a new value is produced by this node which is not equal to the\n * previous value (by whatever definition of equality is in use).\n */\n version: Version;\n\n /**\n * Epoch at which this node is verified to be clean.\n *\n * This allows skipping of some polling operations in the case where no signals have been set\n * since this node was last read.\n */\n lastCleanEpoch: Version;\n\n /**\n * Whether this node (in its consumer capacity) is dirty.\n *\n * Only live consumers become dirty, when receiving a change notification from a dependency\n * producer.\n */\n dirty: boolean;\n\n /**\n * Whether this node is currently rebuilding its producer list.\n */\n recomputing: boolean;\n\n /**\n * Producers which are dependencies of this consumer.\n */\n producers: ReactiveLink | undefined;\n\n /**\n * Points to the last linked list node in the `producers` linked list.\n *\n * When this node is recomputing, this is used to track the producers that we have accessed so far.\n */\n producersTail: ReactiveLink | undefined;\n\n /**\n * Linked list of consumers of this producer that are \"live\" (they require push notifications).\n *\n * The length of this list is effectively our reference count for this node.\n */\n consumers: ReactiveLink | undefined;\n consumersTail: ReactiveLink | undefined;\n\n /**\n * Whether writes to signals are allowed when this consumer is the `activeConsumer`.\n *\n * This is used to enforce guardrails such as preventing writes to writable signals in the\n * computation function of computed signals, which is supposed to be pure.\n */\n consumerAllowSignalWrites: boolean;\n\n readonly consumerIsAlwaysLive: boolean;\n\n /**\n * Tracks whether producers need to recompute their value independently of the reactive graph (for\n * example, if no initial value has been computed).\n */\n producerMustRecompute(node: unknown): boolean;\n producerRecomputeValue(node: unknown): void;\n consumerMarkedDirty(node: unknown): void;\n\n /**\n * Called when a signal is read within this consumer.\n */\n consumerOnSignalRead(node: unknown): void;\n\n /**\n * A debug name for the reactive node. Used in Angular DevTools to identify the node.\n */\n debugName?: string;\n\n /**\n * Kind of node. Example: 'signal', 'computed', 'input', 'effect'.\n *\n * ReactiveNode has this as 'unknown' by default, but derived node types should override this to\n * make available the kind of signal that particular instance of a ReactiveNode represents.\n *\n * Used in Angular DevTools to identify the kind of signal.\n */\n kind: ReactiveNodeKind;\n}\n\n/**\n * Called by implementations when a producer's signal is read.\n */\nexport function producerAccessed(node: ReactiveNode): void {\n if (inNotificationPhase) {\n throw new Error(\n typeof ngDevMode !== 'undefined' && ngDevMode\n ? `Assertion error: signal read during notification phase`\n : '',\n );\n }\n\n if (activeConsumer === null) {\n // Accessed outside of a reactive context, so nothing to record.\n return;\n }\n\n activeConsumer.consumerOnSignalRead(node);\n\n const prevProducerLink = activeConsumer.producersTail;\n\n // If the last producer we accessed is the same as the current one, we can skip adding a new\n // link\n if (prevProducerLink !== undefined && prevProducerLink.producer === node) {\n return;\n }\n\n let nextProducerLink: ReactiveLink | undefined = undefined;\n const isRecomputing = activeConsumer.recomputing;\n if (isRecomputing) {\n // If we're incrementally rebuilding the producers list, we want to check if the next producer\n // in the list is the same as the one we're trying to add.\n\n // If the previous producer is defined, then the next producer is just the one that follows it.\n // Otherwise, we should check the head of the producers list (the first node that we accessed the last time this consumer was run).\n nextProducerLink =\n prevProducerLink !== undefined ? prevProducerLink.nextProducer : activeConsumer.producers;\n if (nextProducerLink !== undefined && nextProducerLink.producer === node) {\n // If the next producer is the same as the one we're trying to add, we can just update the\n // last read version, update the tail of the producers list of this rerun, and return.\n activeConsumer.producersTail = nextProducerLink;\n nextProducerLink.lastReadVersion = node.version;\n return;\n }\n }\n\n const prevConsumerLink = node.consumersTail;\n\n // If the producer we're accessing already has a link to this consumer, we can skip adding a new\n // link. This can short circuit the creation of a new link in the case where the consumer reads alternating ReeactiveNodes\n if (\n prevConsumerLink !== undefined &&\n prevConsumerLink.consumer === activeConsumer &&\n // However, we have to make sure that the link we've discovered isn't from a node that is incrementally rebuilding its producer list\n (!isRecomputing || isValidLink(prevConsumerLink, activeConsumer))\n ) {\n // If we found an existing link to the consumer we can just return.\n return;\n }\n\n // If we got here, it means that we need to create a new link between the producer and the consumer.\n const isLive = consumerIsLive(activeConsumer);\n const newLink = {\n producer: node,\n consumer: activeConsumer,\n // instead of eagerly destroying the previous link, we delay until we've finished recomputing\n // the producers list, so that we can destroy all of the old links at once.\n nextProducer: nextProducerLink,\n prevConsumer: prevConsumerLink,\n lastReadVersion: node.version,\n nextConsumer: undefined,\n };\n activeConsumer.producersTail = newLink;\n if (prevProducerLink !== undefined) {\n prevProducerLink.nextProducer = newLink;\n } else {\n activeConsumer.producers = newLink;\n }\n\n if (isLive) {\n producerAddLiveConsumer(node, newLink);\n }\n}\n\n/**\n * Increment the global epoch counter.\n *\n * Called by source producers (that is, not computeds) whenever their values change.\n */\nexport function producerIncrementEpoch(): void {\n epoch++;\n}\n\n/**\n * Ensure this producer's `version` is up-to-date.\n */\nexport function producerUpdateValueVersion(node: ReactiveNode): void {\n if (consumerIsLive(node) && !node.dirty) {\n // A live consumer will be marked dirty by producers, so a clean state means that its version\n // is guaranteed to be up-to-date.\n return;\n }\n\n if (!node.dirty && node.lastCleanEpoch === epoch) {\n // Even non-live consumers can skip polling if they previously found themselves to be clean at\n // the current epoch, since their dependencies could not possibly have changed (such a change\n // would've increased the epoch).\n return;\n }\n\n if (!node.producerMustRecompute(node) && !consumerPollProducersForChange(node)) {\n // None of our producers report a change since the last time they were read, so no\n // recomputation of our value is necessary, and we can consider ourselves clean.\n producerMarkClean(node);\n return;\n }\n\n node.producerRecomputeValue(node);\n\n // After recomputing the value, we're no longer dirty.\n producerMarkClean(node);\n}\n\n/**\n * Propagate a dirty notification to live consumers of this producer.\n */\nexport function producerNotifyConsumers(node: ReactiveNode): void {\n if (node.consumers === undefined) {\n return;\n }\n\n // Prevent signal reads when we're updating the graph\n const prev = inNotificationPhase;\n inNotificationPhase = true;\n try {\n for (\n let link: ReactiveLink | undefined = node.consumers;\n link !== undefined;\n link = link.nextConsumer\n ) {\n const consumer = link.consumer;\n if (!consumer.dirty) {\n consumerMarkDirty(consumer);\n }\n }\n } finally {\n inNotificationPhase = prev;\n }\n}\n\n/**\n * Whether this `ReactiveNode` in its producer capacity is currently allowed to initiate updates,\n * based on the current consumer context.\n */\nexport function producerUpdatesAllowed(): boolean {\n return activeConsumer?.consumerAllowSignalWrites !== false;\n}\n\nexport function consumerMarkDirty(node: ReactiveNode): void {\n node.dirty = true;\n producerNotifyConsumers(node);\n node.consumerMarkedDirty?.(node);\n}\n\nexport function producerMarkClean(node: ReactiveNode): void {\n node.dirty = false;\n node.lastCleanEpoch = epoch;\n}\n\n/**\n * Prepare this consumer to run a computation in its reactive context and set\n * it as the active consumer.\n *\n * Must be called by subclasses which represent reactive computations, before those computations\n * begin.\n */\nexport function consumerBeforeComputation(node: ReactiveNode | null): ReactiveNode | null {\n if (node) resetConsumerBeforeComputation(node);\n\n return setActiveConsumer(node);\n}\n\n/**\n * Prepare this consumer to run a computation in its reactive context.\n *\n * We expose this mainly for code where we manually batch effects into a single\n * consumer. In those cases we may wish to \"reopen\" a consumer multiple times\n * in initial render before finalizing it. Most code should just call\n * `consumerBeforeComputation` instead of calling this directly.\n */\nexport function resetConsumerBeforeComputation(node: ReactiveNode): void {\n node.producersTail = undefined;\n node.recomputing = true;\n}\n\n/**\n * Finalize this consumer's state and set previous consumer as the active consumer after a\n * reactive computation has run.\n *\n * Must be called by subclasses which represent reactive computations, after those computations\n * have finished.\n */\nexport function consumerAfterComputation(\n node: ReactiveNode | null,\n prevConsumer: ReactiveNode | null,\n): void {\n setActiveConsumer(prevConsumer);\n\n if (node) finalizeConsumerAfterComputation(node);\n}\n\n/**\n * Finalize this consumer's state after a reactive computation has run.\n *\n * We expose this mainly for code where we manually batch effects into a single\n * consumer. In those cases we may wish to \"reopen\" a consumer multiple times\n * in initial render before finalizing it. Most code should just call\n * `consumerAfterComputation` instead of calling this directly.\n */\nexport function finalizeConsumerAfterComputation(node: ReactiveNode): void {\n node.recomputing = false;\n\n // We've finished incrementally rebuilding the producers list, now if there are any producers\n // that are after producersTail, they are stale and should be removed.\n const producersTail = node.producersTail as ReactiveLink | undefined;\n let toRemove = producersTail !== undefined ? producersTail.nextProducer : node.producers;\n if (toRemove !== undefined) {\n if (consumerIsLive(node)) {\n // For each stale link, we first unlink it from the producers list of consumers\n do {\n toRemove = producerRemoveLiveConsumerLink(toRemove);\n } while (toRemove !== undefined);\n }\n\n // Now, we can truncate the producers list to remove all stale links.\n if (producersTail !== undefined) {\n producersTail.nextProducer = undefined;\n } else {\n node.producers = undefined;\n }\n }\n}\n\n/**\n * Determine whether this consumer has any dependencies which have changed since the last time\n * they were read.\n */\nexport function consumerPollProducersForChange(node: ReactiveNode): boolean {\n // Poll producers for change.\n for (let link = node.producers; link !== undefined; link = link.nextProducer) {\n const producer = link.producer;\n const seenVersion = link.lastReadVersion;\n\n // First check the versions. A mismatch means that the producer's value is known to have\n // changed since the last time we read it.\n if (seenVersion !== producer.version) {\n return true;\n }\n\n // The producer's version is the same as the last time we read it, but it might itself be\n // stale. Force the producer to recompute its version (calculating a new value if necessary).\n producerUpdateValueVersion(producer);\n\n // Now when we do this check, `producer.version` is guaranteed to be up to date, so if the\n // versions still match then it has not changed since the last time we read it.\n if (seenVersion !== producer.version) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Disconnect this consumer from the graph.\n */\nexport function consumerDestroy(node: ReactiveNode): void {\n if (consumerIsLive(node)) {\n // Drop all connections from the graph to this node.\n let link = node.producers;\n while (link !== undefined) {\n link = producerRemoveLiveConsumerLink(link);\n }\n }\n\n // Truncate all the linked lists to drop all connection from this node to the graph.\n node.producers = undefined;\n node.producersTail = undefined;\n node.consumers = undefined;\n node.consumersTail = undefined;\n}\n\n/**\n * Add `consumer` as a live consumer of this node.\n *\n * Note that this operation is potentially transitive. If this node becomes live, then it becomes\n * a live consumer of all of its current producers.\n */\nfunction producerAddLiveConsumer(node: ReactiveNode, link: ReactiveLink): void {\n const consumersTail = node.consumersTail;\n const wasLive = consumerIsLive(node);\n if (consumersTail !== undefined) {\n link.nextConsumer = consumersTail.nextConsumer;\n consumersTail.nextConsumer = link;\n } else {\n link.nextConsumer = undefined;\n node.consumers = link;\n }\n link.prevConsumer = consumersTail;\n node.consumersTail = link;\n if (!wasLive) {\n for (\n let link: ReactiveLink | undefined = node.producers;\n link !== undefined;\n link = link.nextProducer\n ) {\n producerAddLiveConsumer(link.producer, link);\n }\n }\n}\n\nfunction producerRemoveLiveConsumerLink(link: ReactiveLink): ReactiveLink | undefined {\n const producer = link.producer;\n const nextProducer = link.nextProducer;\n const nextConsumer = link.nextConsumer;\n const prevConsumer = link.prevConsumer;\n link.nextConsumer = undefined;\n link.prevConsumer = undefined;\n if (nextConsumer !== undefined) {\n nextConsumer.prevConsumer = prevConsumer;\n } else {\n producer.consumersTail = prevConsumer;\n }\n if (prevConsumer !== undefined) {\n prevConsumer.nextConsumer = nextConsumer;\n } else {\n producer.consumers = nextConsumer;\n if (!consumerIsLive(producer)) {\n let producerLink = producer.producers;\n while (producerLink !== undefined) {\n producerLink = producerRemoveLiveConsumerLink(producerLink);\n }\n }\n }\n return nextProducer;\n}\n\nfunction consumerIsLive(node: ReactiveNode): boolean {\n return node.consumerIsAlwaysLive || node.consumers !== undefined;\n}\n\nexport function runPostProducerCreatedFn(node: ReactiveNode): void {\n postProducerCreatedFn?.(node);\n}\n\nexport function setPostProducerCreatedFn(fn: ReactiveHookFn | null): ReactiveHookFn | null {\n const prev = postProducerCreatedFn;\n postProducerCreatedFn = fn;\n return prev;\n}\n\n// While a ReactiveNode is recomputing, it may not have destroyed previous links\n// This allows us to check if a given link will be destroyed by a reactivenode if it were to finish running immediately without accesing any more producers\nfunction isValidLink(checkLink: ReactiveLink, consumer: ReactiveNode): boolean {\n const producersTail = consumer.producersTail;\n if (producersTail !== undefined) {\n let link = consumer.producers!;\n do {\n if (link === checkLink) {\n return true;\n }\n if (link === producersTail) {\n break;\n }\n link = link.nextProducer!;\n } while (link !== undefined);\n }\n return false;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * A comparison function which can determine if two values are equal.\n */\nexport type ValueEqualityFn<T> = (a: T, b: T) => boolean;\n\n/**\n * The default equality function used for `signal` and `computed`, which uses referential equality.\n */\nexport function defaultEquals<T>(a: T, b: T) {\n return Object.is(a, b);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {defaultEquals, ValueEqualityFn} from './equality';\nimport {\n consumerAfterComputation,\n consumerBeforeComputation,\n producerAccessed,\n producerUpdateValueVersion,\n REACTIVE_NODE,\n ReactiveNode,\n runPostProducerCreatedFn,\n setActiveConsumer,\n SIGNAL,\n} from './graph';\n\n// Required as the signals library is in a separate package, so we need to explicitly ensure the\n// global `ngDevMode` type is defined.\ndeclare const ngDevMode: boolean | undefined;\n\n/**\n * A computation, which derives a value from a declarative reactive expression.\n *\n * `Computed`s are both producers and consumers of reactivity.\n */\nexport interface ComputedNode<T> extends ReactiveNode {\n /**\n * Current value of the computation, or one of the sentinel values above (`UNSET`, `COMPUTING`,\n * `ERROR`).\n */\n value: T;\n\n /**\n * If `value` is `ERRORED`, the error caught from the last computation attempt which will\n * be re-thrown.\n */\n error: unknown;\n\n /**\n * The computation function which will produce a new value.\n */\n computation: () => T;\n\n equal: ValueEqualityFn<T>;\n}\n\nexport type ComputedGetter<T> = (() => T) & {\n [SIGNAL]: ComputedNode<T>;\n};\n\n/**\n * Create a computed signal which derives a reactive value from an expression.\n */\nexport function createComputed<T>(\n computation: () => T,\n equal?: ValueEqualityFn<T>,\n): ComputedGetter<T> {\n const node: ComputedNode<T> = Object.create(COMPUTED_NODE);\n node.computation = computation;\n\n if (equal !== undefined) {\n node.equal = equal;\n }\n\n const computed = () => {\n // Check if the value needs updating before returning it.\n producerUpdateValueVersion(node);\n\n // Record that someone looked at this signal.\n producerAccessed(node);\n\n if (node.value === ERRORED) {\n throw node.error;\n }\n\n return node.value;\n };\n\n (computed as ComputedGetter<T>)[SIGNAL] = node;\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n computed.toString = () =>\n `[Computed${node.debugName ? ' (' + node.debugName + ')' : ''}: ${String(node.value)}]`;\n }\n\n runPostProducerCreatedFn(node);\n\n return computed as unknown as ComputedGetter<T>;\n}\n\n/**\n * A dedicated symbol used before a computed value has been calculated for the first time.\n * Explicitly typed as `any` so we can use it as signal's value.\n */\nexport const UNSET: any = /* @__PURE__ */ Symbol('UNSET');\n\n/**\n * A dedicated symbol used in place of a computed signal value to indicate that a given computation\n * is in progress. Used to detect cycles in computation chains.\n * Explicitly typed as `any` so we can use it as signal's value.\n */\nexport const COMPUTING: any = /* @__PURE__ */ Symbol('COMPUTING');\n\n/**\n * A dedicated symbol used in place of a computed signal value to indicate that a given computation\n * failed. The thrown error is cached until the computation gets dirty again.\n * Explicitly typed as `any` so we can use it as signal's value.\n */\nexport const ERRORED: any = /* @__PURE__ */ Symbol('ERRORED');\n\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.\nconst COMPUTED_NODE: Omit<ComputedNode<unknown>, 'computation'> = /* @__PURE__ */ (() => {\n return {\n ...REACTIVE_NODE,\n value: UNSET,\n dirty: true,\n error: null,\n equal: defaultEquals,\n kind: 'computed',\n\n producerMustRecompute(node: ComputedNode<unknown>): boolean {\n // Force a recomputation if there's no current value, or if the current value is in the\n // process of being calculated (which should throw an error).\n return node.value === UNSET || node.value === COMPUTING;\n },\n\n producerRecomputeValue(node: ComputedNode<unknown>): void {\n if (node.value === COMPUTING) {\n // Our computation somehow led to a cyclic read of itself.\n throw new Error(\n typeof ngDevMode !== 'undefined' && ngDevMode ? 'Detected cycle in computations.' : '',\n );\n }\n\n const oldValue = node.value;\n node.value = COMPUTING;\n\n const prevConsumer = consumerBeforeComputation(node);\n let newValue: unknown;\n let wasEqual = false;\n try {\n newValue = node.computation();\n // We want to mark this node as errored if calling `equal` throws; however, we don't want\n // to track any reactive reads inside `equal`.\n setActiveConsumer(null);\n wasEqual =\n oldValue !== UNSET &&\n oldValue !== ERRORED &&\n newValue !== ERRORED &&\n node.equal(oldValue, newValue);\n } catch (err) {\n newValue = ERRORED;\n node.error = err;\n } finally {\n consumerAfterComputation(node, prevConsumer);\n }\n\n if (wasEqual) {\n // No change to `valueVersion` - old and new values are\n // semantically equivalent.\n node.value = oldValue;\n return;\n }\n\n node.value = newValue;\n node.version++;\n },\n };\n})();\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport type {SignalNode} from './signal';\n\nfunction defaultThrowError(): never {\n throw new Error();\n}\n\nlet throwInvalidWriteToSignalErrorFn: <T>(node: SignalNode<T>) => never = defaultThrowError;\n\nexport function throwInvalidWriteToSignalError<T>(node: SignalNode<T>) {\n throwInvalidWriteToSignalErrorFn(node);\n}\n\nexport function setThrowInvalidWriteToSignalError(fn: <T>(node: SignalNode<T>) => never): void {\n throwInvalidWriteToSignalErrorFn = fn;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {defaultEquals, ValueEqualityFn} from './equality';\nimport {throwInvalidWriteToSignalError} from './errors';\nimport {\n producerAccessed,\n producerIncrementEpoch,\n producerNotifyConsumers,\n producerUpdatesAllowed,\n REACTIVE_NODE,\n ReactiveNode,\n ReactiveHookFn,\n runPostProducerCreatedFn,\n SIGNAL,\n} from './graph';\n\n// Required as the signals library is in a separate package, so we need to explicitly ensure the\n// global `ngDevMode` type is defined.\ndeclare const ngDevMode: boolean | undefined;\n\n/**\n * If set, called after `WritableSignal`s are updated.\n *\n * This hook can be used to achieve various effects, such as running effects synchronously as part\n * of setting a signal.\n */\nlet postSignalSetFn: ReactiveHookFn | null = null;\n\nexport interface SignalNode<T> extends ReactiveNode {\n value: T;\n equal: ValueEqualityFn<T>;\n}\n\nexport type SignalBaseGetter<T> = (() => T) & {readonly [SIGNAL]: unknown};\nexport type SignalSetter<T> = (newValue: T) => void;\nexport type SignalUpdater<T> = (updateFn: (value: T) => T) => void;\n\n// Note: Closure *requires* this to be an `interface` and not a type, which is why the\n// `SignalBaseGetter` type exists to provide the correct shape.\nexport interface SignalGetter<T> extends SignalBaseGetter<T> {\n readonly [SIGNAL]: SignalNode<T>;\n}\n\n/**\n * Creates a `Signal` getter, setter, and updater function.\n */\nexport function createSignal<T>(\n initialValue: T,\n equal?: ValueEqualityFn<T>,\n): [SignalGetter<T>, SignalSetter<T>, SignalUpdater<T>] {\n const node: SignalNode<T> = Object.create(SIGNAL_NODE);\n node.value = initialValue;\n if (equal !== undefined) {\n node.equal = equal;\n }\n const getter = (() => signalGetFn(node)) as SignalGetter<T>;\n (getter as any)[SIGNAL] = node;\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n getter.toString = () =>\n `[Signal${node.debugName ? ' (' + node.debugName + ')' : ''}: ${String(node.value)}]`;\n }\n\n runPostProducerCreatedFn(node);\n const set = (newValue: T) => signalSetFn(node, newValue);\n const update = (updateFn: (value: T) => T) => signalUpdateFn(node, updateFn);\n return [getter, set, update];\n}\n\nexport function setPostSignalSetFn(fn: ReactiveHookFn | null): ReactiveHookFn | null {\n const prev = postSignalSetFn;\n postSignalSetFn = fn;\n return prev;\n}\n\nexport function signalGetFn<T>(node: SignalNode<T>): T {\n producerAccessed(node);\n return node.value;\n}\n\nexport function signalSetFn<T>(node: SignalNode<T>, newValue: T) {\n if (!producerUpdatesAllowed()) {\n throwInvalidWriteToSignalError(node);\n }\n\n if (!node.equal(node.value, newValue)) {\n node.value = newValue;\n signalValueChanged(node);\n }\n}\n\nexport function signalUpdateFn<T>(node: SignalNode<T>, updater: (value: T) => T): void {\n if (!producerUpdatesAllowed()) {\n throwInvalidWriteToSignalError(node);\n }\n\n signalSetFn(node, updater(node.value));\n}\n\nexport function runPostSignalSetFn<T>(node: SignalNode<T>): void {\n postSignalSetFn?.(node);\n}\n\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.\nexport const SIGNAL_NODE: SignalNode<unknown> = /* @__PURE__ */ (() => {\n return {\n ...REACTIVE_NODE,\n equal: defaultEquals,\n value: undefined,\n kind: 'signal',\n };\n})();\n\nfunction signalValueChanged<T>(node: SignalNode<T>): void {\n node.version++;\n producerIncrementEpoch();\n producerNotifyConsumers(node);\n postSignalSetFn?.(node);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n consumerAfterComputation,\n consumerBeforeComputation,\n consumerPollProducersForChange,\n REACTIVE_NODE,\n ReactiveNode,\n} from './graph';\n\n/**\n * An effect can, optionally, register a cleanup function. If registered, the cleanup is executed\n * before the next effect run. The cleanup function makes it possible to \"cancel\" any work that the\n * previous effect run might have started.\n */\nexport type EffectCleanupFn = () => void;\n\n/**\n * A callback passed to the effect function that makes it possible to register cleanup logic.\n */\nexport type EffectCleanupRegisterFn = (cleanupFn: EffectCleanupFn) => void;\n\nexport interface BaseEffectNode extends ReactiveNode {\n fn: () => void;\n destroy(): void;\n cleanup(): void;\n run(): void;\n}\n\nexport const BASE_EFFECT_NODE: Omit<BaseEffectNode, 'fn' | 'destroy' | 'cleanup' | 'run'> =\n /* @__PURE__ */ (() => ({\n ...REACTIVE_NODE,\n consumerIsAlwaysLive: true,\n consumerAllowSignalWrites: true,\n dirty: true,\n kind: 'effect',\n }))();\n\nexport function runEffect(node: BaseEffectNode) {\n node.dirty = false;\n if (node.version > 0 && !consumerPollProducersForChange(node)) {\n return;\n }\n node.version++;\n const prevNode = consumerBeforeComputation(node);\n try {\n node.cleanup();\n node.fn();\n } finally {\n consumerAfterComputation(node, prevNode);\n }\n}\n"],"names":["activeConsumer","inNotificationPhase","epoch","postProducerCreatedFn","SIGNAL","Symbol","setActiveConsumer","consumer","prev","getActiveConsumer","isInNotificationPhase","isReactive","value","undefined","REACTIVE_NODE","version","lastCleanEpoch","dirty","producers","producersTail","consumers","consumersTail","recomputing","consumerAllowSignalWrites","consumerIsAlwaysLive","kind","producerMustRecompute","producerRecomputeValue","consumerMarkedDirty","consumerOnSignalRead","producerAccessed","node","Error","ngDevMode","prevProducerLink","producer","nextProducerLink","isRecomputing","nextProducer","lastReadVersion","prevConsumerLink","isValidLink","isLive","consumerIsLive","newLink","prevConsumer","nextConsumer","producerAddLiveConsumer","producerIncrementEpoch","producerUpdateValueVersion","consumerPollProducersForChange","producerMarkClean","producerNotifyConsumers","link","consumerMarkDirty","producerUpdatesAllowed","consumerBeforeComputation","resetConsumerBeforeComputation","consumerAfterComputation","finalizeConsumerAfterComputation","toRemove","producerRemoveLiveConsumerLink","seenVersion","consumerDestroy","wasLive","producerLink","runPostProducerCreatedFn","setPostProducerCreatedFn","fn","checkLink","defaultEquals","a","b","Object","is","createComputed","computation","equal","create","COMPUTED_NODE","computed","ERRORED","error","toString","debugName","String","UNSET","COMPUTING","oldValue","newValue","wasEqual","err","defaultThrowError","throwInvalidWriteToSignalErrorFn","throwInvalidWriteToSignalError","setThrowInvalidWriteToSignalError","postSignalSetFn","createSignal","initialValue","SIGNAL_NODE","getter","signalGetFn","set","signalSetFn","update","updateFn","signalUpdateFn","setPostSignalSetFn","signalValueChanged","updater","runPostSignalSetFn","BASE_EFFECT_NODE","runEffect","prevNode","cleanup"],"mappings":";;;;;;AAiBA,IAAIA,cAAc,GAAwB,IAAI;AAC9C,IAAIC,mBAAmB,GAAG,KAAK;AAO/B,IAAIC,KAAK,GAAY,CAAY;AAOjC,IAAIC,qBAAqB,GAA0B,IAAI;MAO1CC,MAAM,kBAAkCC,MAAM,CAAC,QAAQ;AAE9D,SAAUC,iBAAiBA,CAACC,QAA6B,EAAA;EAC7D,MAAMC,IAAI,GAAGR,cAAc;AAC3BA,EAAAA,cAAc,GAAGO,QAAQ;AACzB,EAAA,OAAOC,IAAI;AACb;SAEgBC,iBAAiBA,GAAA;AAC/B,EAAA,OAAOT,cAAc;AACvB;SAEgBU,qBAAqBA,GAAA;AACnC,EAAA,OAAOT,mBAAmB;AAC5B;AAMM,SAAUU,UAAUA,CAACC,KAAc,EAAA;AACvC,EAAA,OAAQA,KAA2B,CAACR,MAA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ACL,IAAA,GAAGrF,aAAa;AAChB+D,IAAAA,KAAK,EAAEP,aAAa;AACpB1D,IAAAA,KAAK,EAAEC,SAAS;AAChBY,IAAAA,IAAI,EAAE;GACP;AACH,CAAC;AAED,SAASmF,kBAAkBA,CAAI7E,IAAmB,EAAA;EAChDA,IAAI,CAAChB,OAAO,EAAE;AACdiC,EAAAA,sBAAsB,EAAE;EACxBI,uBAAuB,CAACrB,IAAI,CAAC;EAC7BiE,eAAe,GAAGjE,IAAI,CAAC;AACzB;;ACzFO,MAAMgF,gBAAgB,kBACX,CAAC,OAAO;AACtB,EAAA,GAAGjG,aAAa;AAChBU,EAAAA,oBAAoB,EAAE,IAAI;AAC1BD,EAAAA,yBAAyB,EAAE,IAAI;AAC/BN,EAAAA,KAAK,EAAE,IAAI;AACXQ,EAAAA,IAAI,EAAE;CACP,CAAC;AAEE,SAAUuF,SAASA,CAACjF,IAAoB,EAAA;EAC5CA,IAAI,CAACd,KAAK,GAAG,KAAK;EAClB,IAAIc,IAAI,CAAChB,OAAO,GAAG,CAAC,IAAI,CAACmC,8BAA8B,CAACnB,IAAI,CAAC,EAAE;AAC7D,IAAA;AACF,EAAA;EACAA,IAAI,CAAChB,OAAO,EAAE;AACd,EAAA,MAAMkG,QAAQ,GAAGzD,yBAAyB,CAACzB,IAAI,CAAC;EAChD,IAAI;IACFA,IAAI,CAACmF,OAAO,EAAE;IACdnF,IAAI,CAACqC,EAAE,EAAE;AACX,EAAA,CAAA,SAAU;AACRV,IAAAA,wBAAwB,CAAC3B,IAAI,EAAEkF,QAAQ,CAAC;AAC1C,EAAA;AACF;;;;"}
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -4,0 +4,0 @@ * License: MIT

@@ -1,1 +0,1 @@

{"version":3,"file":"_not_found-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/di/src/injector.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/di/src/not_found.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Constructor, InjectionToken} from './injection_token';\nimport {NotFound} from './not_found';\n\nexport interface Injector {\n retrieve<T>(token: InjectionToken<T>, options?: unknown): T | NotFound;\n}\n\n/**\n * Current injector value used by `inject`.\n * - `undefined`: it is an error to call `inject`\n * - `null`: `inject` can be called but there is no injector (limp-mode).\n * - Injector instance: Use the injector for resolution.\n */\nlet _currentInjector: Injector | undefined | null = undefined;\n\nexport function getCurrentInjector(): Injector | undefined | null {\n return _currentInjector;\n}\n\nexport function setCurrentInjector(\n injector: Injector | null | undefined,\n): Injector | undefined | null {\n const former = _currentInjector;\n _currentInjector = injector;\n return former;\n}\n\nexport function inject<T>(token: InjectionToken<T> | Constructor<T>): T;\nexport function inject<T>(\n token: InjectionToken<T> | Constructor<T>,\n options?: unknown,\n): T | NotFound {\n const currentInjector = getCurrentInjector();\n if (!currentInjector) {\n throw new Error('Current injector is not set.');\n }\n if (!(token as InjectionToken<T>).ɵprov) {\n throw new Error('Token is not an injectable');\n }\n return currentInjector.retrieve(token as InjectionToken<T>, options);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * Value returned if the key-value pair couldn't be found in the context\n * hierarchy.\n */\nexport const NOT_FOUND: unique symbol = Symbol('NotFound');\n\n/**\n * Error thrown when the key-value pair couldn't be found in the context\n * hierarchy. Context can be attached below.\n */\nexport class NotFoundError extends Error {\n override readonly name: string = 'ɵNotFound';\n constructor(message: string) {\n super(message);\n }\n}\n\n/**\n * Type guard for checking if an unknown value is a NotFound.\n */\nexport function isNotFound(e: unknown): e is NotFound {\n return e === NOT_FOUND || (e as NotFoundError)?.name === 'ɵNotFound';\n}\n\n/**\n * Type union of NotFound and NotFoundError.\n */\nexport type NotFound = typeof NOT_FOUND | NotFoundError;\n"],"names":["_currentInjector","undefined","getCurrentInjector","setCurrentInjector","injector","former","inject","token","options","currentInjector","Error","ɵprov","retrieve","NOT_FOUND","Symbol","NotFoundError","name","constructor","message","isNotFound","e"],"mappings":";;;;;;AAqBA,IAAIA,gBAAgB,GAAgCC,SAAS;SAE7CC,kBAAkBA,GAAA;AAChC,EAAA,OAAOF,gBAAgB;AACzB;AAEM,SAAUG,kBAAkBA,CAChCC,QAAqC,EAAA;EAErC,MAAMC,MAAM,GAAGL,gBAAgB;AAC/BA,EAAAA,gBAAgB,GAAGI,QAAQ;AAC3B,EAAA,OAAOC,MAAM;AACf;AAGM,SAAUC,MAAMA,CACpBC,KAAyC,EACzCC,OAAiB,EAAA;AAEjB,EAAA,MAAMC,eAAe,GAAGP,kBAAkB,EAAE;EAC5C,IAAI,CAACO,eAAe,EAAE;AACpB,IAAA,MAAM,IAAIC,KAAK,CAAC,8BAA8B,CAAC;AACjD,EAAA;AACA,EAAA,IAAI,CAAEH,KAA2B,CAACI,KAAK,EAAE;AACvC,IAAA,MAAM,IAAID,KAAK,CAAC,4BAA4B,CAAC;AAC/C,EAAA;AACA,EAAA,OAAOD,eAAe,CAACG,QAAQ,CAACL,KAA0B,EAAEC,OAAO,CAAC;AACtE;;MCpCaK,SAAS,GAAkBC,MAAM,CAAC,UAAU;AAMnD,MAAOC,aAAc,SAAQL,KAAK,CAAA;AACpBM,EAAAA,IAAI,GAAW,WAAW;EAC5CC,WAAAA,CAAYC,OAAe,EAAA;IACzB,KAAK,CAACA,OAAO,CAAC;AAChB,EAAA;AACD;AAKK,SAAUC,UAAUA,CAACC,CAAU,EAAA;EACnC,OAAOA,CAAC,KAAKP,SAAS,IAAKO,CAAmB,EAAEJ,IAAI,KAAK,WAAW;AACtE;;;;"}
{"version":3,"file":"_not_found-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/di/src/injector.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/di/src/not_found.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Constructor, InjectionToken} from './injection_token';\nimport {NotFound} from './not_found';\n\nexport interface Injector {\n retrieve<T>(token: InjectionToken<T>, options?: unknown): T | NotFound;\n}\n\n/**\n * Current injector value used by `inject`.\n * - `undefined`: it is an error to call `inject`\n * - `null`: `inject` can be called but there is no injector (limp-mode).\n * - Injector instance: Use the injector for resolution.\n */\nlet _currentInjector: Injector | undefined | null = undefined;\n\nexport function getCurrentInjector(): Injector | undefined | null {\n return _currentInjector;\n}\n\nexport function setCurrentInjector(\n injector: Injector | null | undefined,\n): Injector | undefined | null {\n const former = _currentInjector;\n _currentInjector = injector;\n return former;\n}\n\nexport function inject<T>(token: InjectionToken<T> | Constructor<T>): T;\nexport function inject<T>(\n token: InjectionToken<T> | Constructor<T>,\n options?: unknown,\n): T | NotFound {\n const currentInjector = getCurrentInjector();\n if (!currentInjector) {\n throw new Error('Current injector is not set.');\n }\n if (!(token as InjectionToken<T>).ɵprov) {\n throw new Error('Token is not an injectable');\n }\n return currentInjector.retrieve(token as InjectionToken<T>, options);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * Value returned if the key-value pair couldn't be found in the context\n * hierarchy.\n */\nexport const NOT_FOUND: unique symbol = Symbol('NotFound');\n\n/**\n * Error thrown when the key-value pair couldn't be found in the context\n * hierarchy. Context can be attached below.\n */\nexport class NotFoundError extends Error {\n override readonly name: string = 'ɵNotFound';\n constructor(message: string) {\n super(message);\n }\n}\n\n/**\n * Type guard for checking if an unknown value is a NotFound.\n */\nexport function isNotFound(e: unknown): e is NotFound {\n return e === NOT_FOUND || (e as NotFoundError)?.name === 'ɵNotFound';\n}\n\n/**\n * Type union of NotFound and NotFoundError.\n */\nexport type NotFound = typeof NOT_FOUND | NotFoundError;\n"],"names":["_currentInjector","undefined","getCurrentInjector","setCurrentInjector","injector","former","inject","token","options","currentInjector","Error","ɵprov","retrieve","NOT_FOUND","Symbol","NotFoundError","name","constructor","message","isNotFound","e"],"mappings":";;;;;;AAqBA,IAAIA,gBAAgB,GAAgCC,SAAS;SAE7CC,kBAAkBA,GAAA;AAChC,EAAA,OAAOF,gBAAgB;AACzB;AAEM,SAAUG,kBAAkBA,CAChCC,QAAqC,EAAA;EAErC,MAAMC,MAAM,GAAGL,gBAAgB;AAC/BA,EAAAA,gBAAgB,GAAGI,QAAQ;AAC3B,EAAA,OAAOC,MAAM;AACf;AAGM,SAAUC,MAAMA,CACpBC,KAAyC,EACzCC,OAAiB,EAAA;AAEjB,EAAA,MAAMC,eAAe,GAAGP,kBAAkB,EAAE;EAC5C,IAAI,CAACO,eAAe,EAAE;AACpB,IAAA,MAAM,IAAIC,KAAK,CAAC,8BAA8B,CAAC;AACjD,EAAA;AACA,EAAA,IAAI,CAAEH,KAA2B,CAACI,KAAK,EAAE;AACvC,IAAA,MAAM,IAAID,KAAK,CAAC,4BAA4B,CAAC;AAC/C,EAAA;AACA,EAAA,OAAOD,eAAe,CAACG,QAAQ,CAACL,KAA0B,EAAEC,OAAO,CAAC;AACtE;;MCpCaK,SAAS,GAAkBC,MAAM,CAAC,UAAU;AAMnD,MAAOC,aAAc,SAAQL,KAAK,CAAA;AACpBM,EAAAA,IAAI,GAAW,WAAW;EAC5CC,WAAAA,CAAYC,OAAe,EAAA;IACzB,KAAK,CAACA,OAAO,CAAC;AAChB,EAAA;AACD;AAKK,SAAUC,UAAUA,CAACC,CAAU,EAAA;EACnC,OAAOA,CAAC,KAAKP,SAAS,IAAKO,CAAmB,EAAEJ,IAAI,KAAK,WAAW;AACtE;;;;"}
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -7,3 +7,3 @@ * License: MIT

import { inject, RuntimeError, formatRuntimeError, ErrorHandler, DestroyRef, signalAsReadonlyFn, assertInInjectionContext, effect, PendingTasks, signal, isSignal, Injector } from './_pending_tasks-chunk.mjs';
import { inject, RuntimeError, formatRuntimeError, ErrorHandler, DestroyRef, InjectionToken, signalAsReadonlyFn, assertInInjectionContext, TransferState, effect, PendingTasks, signal, isSignal, Injector } from './_pending_tasks-chunk.mjs';
import { setActiveConsumer, createComputed, SIGNAL } from './_effect-chunk.mjs';

@@ -65,2 +65,4 @@ import { untracked as untracked$1, createLinkedSignal, linkedSignalSetFn, linkedSignalUpdateFn } from './_untracked-chunk.mjs';

const CACHE_ACTIVE = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'STATE_CACHE_ACTIVE' : '');
function computed(computation, options) {

@@ -128,3 +130,3 @@ const getter = createComputed(computation, options?.equal);

const params = options.params ?? oldNameForParams ?? (() => null);
return new ResourceImpl(params, getLoader(options), options.defaultValue, options.equal ? wrapEqualityFn(options.equal) : undefined, options.debugName, options.injector ?? inject(Injector));
return new ResourceImpl(params, getLoader(options), options.defaultValue, options.equal ? wrapEqualityFn(options.equal) : undefined, options.debugName, options.injector ?? inject(Injector), options.id);
}

@@ -179,2 +181,3 @@ class BaseWritableResource {

debugName;
transferCacheKey;
pendingTasks;

@@ -190,3 +193,4 @@ state;

error;
constructor(request, loaderFn, defaultValue, equal, debugName, injector, getInitialStream) {
transferState;
constructor(request, loaderFn, defaultValue, equal, debugName, injector, transferCacheKey, getInitialStream) {
if (isInParamsFunction()) {

@@ -214,2 +218,11 @@ throw invalidResourceCreationInParams();

this.debugName = debugName;
this.transferCacheKey = transferCacheKey;
const cacheState = injector.get(CACHE_ACTIVE, undefined, {
optional: true
}) ?? {
isActive: false
};
this.transferState = injector.get(TransferState, undefined, {
optional: true
}) ?? undefined;
this.extRequest = linkedSignal(() => {

@@ -259,3 +272,14 @@ try {

if (!previous) {
stream = getInitialStream?.(extRequest.request);
const transferState = this.transferState;
const cacheKey = this.transferCacheKey;
if (cacheState.isActive && cacheKey && transferState && request !== undefined) {
if (transferState.hasKey(cacheKey)) {
stream = signal({
value: transferState.get(cacheKey, defaultValue)
}, ngDevMode ? createDebugNameObject(this.debugName, 'stream') : undefined);
}
}
if (!stream) {
stream = getInitialStream?.(extRequest.request);
}
getInitialStream = undefined;

@@ -382,2 +406,6 @@ status = request === undefined ? 'idle' : stream ? 'resolved' : 'loading';

});
const result = untracked(stream);
if (typeof ngServerMode !== 'undefined' && ngServerMode) {
saveToTransferState(result, this.transferCacheKey, this.transferState);
}
} else {

@@ -394,2 +422,6 @@ const resolvedStream = await stream;

});
const result = resolvedStream ? untracked(resolvedStream) : undefined;
if (typeof ngServerMode !== 'undefined' && ngServerMode) {
saveToTransferState(result, this.transferCacheKey, this.transferState);
}
}

@@ -421,2 +453,7 @@ } catch (err) {

}
function saveToTransferState(result, transferCacheKey, transferState) {
if (transferCacheKey && transferState && result && isResolved(result)) {
transferState.set(transferCacheKey, result.value);
}
}
function wrapEqualityFn(equal) {

@@ -485,15 +522,16 @@ return (a, b) => a === undefined || b === undefined ? a === b : equal(a, b);

}
function chain(resource) {
switch (resource.status()) {
case 'idle':
throw ResourceParamsStatus.IDLE;
case 'error':
throw new ResourceDependencyError(resource);
case 'loading':
case 'reloading':
throw ResourceParamsStatus.LOADING;
}
return resource.value();
}
const paramsContext = {
chain(resource) {
switch (resource.status()) {
case 'idle':
throw ResourceParamsStatus.IDLE;
case 'error':
throw new ResourceDependencyError(resource);
case 'loading':
case 'reloading':
throw ResourceParamsStatus.LOADING;
}
return resource.value();
}
chain
};

@@ -516,3 +554,3 @@ let inParamsFunction = false;

export { OutputEmitterRef, ResourceDependencyError, ResourceImpl, ResourceParamsStatus, ResourceValueError, computed, encapsulateResourceError, getOutputDestroyRef, invalidResourceCreationInParams, isInParamsFunction, linkedSignal, resource, rethrowFatalErrors, setInParamsFunction, untracked };
export { CACHE_ACTIVE, OutputEmitterRef, ResourceDependencyError, ResourceImpl, ResourceParamsStatus, ResourceValueError, chain, computed, encapsulateResourceError, getOutputDestroyRef, invalidResourceCreationInParams, isInParamsFunction, linkedSignal, resource, rethrowFatalErrors, setInParamsFunction, untracked };
//# sourceMappingURL=_resource-chunk.mjs.map

@@ -1,1 +0,1 @@

{"version":3,"file":"_resource-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/authoring/output/output_emitter_ref.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/render3/reactivity/computed.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/render3/reactivity/untracked.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/resource/api.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/render3/reactivity/linked_signal.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/resource/resource.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {setActiveConsumer} from '../../../primitives/signals';\n\nimport {inject} from '../../di/injector_compatibility';\nimport {ErrorHandler} from '../../error_handler';\nimport {formatRuntimeError, RuntimeError, RuntimeErrorCode} from '../../errors';\nimport {DestroyRef} from '../../linker/destroy_ref';\n\nimport {OutputRef, OutputRefSubscription} from './output_ref';\n\n/**\n * An `OutputEmitterRef` is created by the `output()` function and can be\n * used to emit values to consumers of your directive or component.\n *\n * Consumers of your directive/component can bind to the output and\n * subscribe to changes via the bound event syntax. For example:\n *\n * ```html\n * <my-comp (valueChange)=\"processNewValue($event)\" />\n * ```\n *\n * @see [Custom events with outputs](guide/components/outputs)\n *\n * @publicAPI\n */\nexport class OutputEmitterRef<T> implements OutputRef<T> {\n private destroyed = false;\n private listeners: Array<(value: T) => void> | null = null;\n private errorHandler = inject(ErrorHandler, {optional: true});\n\n /** @internal */\n destroyRef: DestroyRef = inject(DestroyRef);\n\n constructor() {\n // Clean-up all listeners and mark as destroyed upon destroy.\n this.destroyRef.onDestroy(() => {\n this.destroyed = true;\n this.listeners = null;\n });\n }\n\n subscribe(callback: (value: T) => void): OutputRefSubscription {\n if (this.destroyed) {\n throw new RuntimeError(\n RuntimeErrorCode.OUTPUT_REF_DESTROYED,\n ngDevMode &&\n 'Unexpected subscription to destroyed `OutputRef`. ' +\n 'The owning directive/component is destroyed.',\n );\n }\n\n (this.listeners ??= []).push(callback);\n\n return {\n unsubscribe: () => {\n const idx = this.listeners?.indexOf(callback);\n if (idx !== undefined && idx !== -1) {\n this.listeners?.splice(idx, 1);\n }\n },\n };\n }\n\n /** Emits a new value to the output. */\n emit(value: T): void {\n if (this.destroyed) {\n console.warn(\n formatRuntimeError(\n RuntimeErrorCode.OUTPUT_REF_DESTROYED,\n ngDevMode &&\n 'Unexpected emit for destroyed `OutputRef`. ' +\n 'The owning directive/component is destroyed.',\n ),\n );\n return;\n }\n\n if (this.listeners === null) {\n return;\n }\n\n const previousConsumer = setActiveConsumer(null);\n try {\n for (const listenerFn of this.listeners) {\n try {\n listenerFn(value);\n } catch (err: unknown) {\n this.errorHandler?.handleError(err);\n }\n }\n } finally {\n setActiveConsumer(previousConsumer);\n }\n }\n}\n\n/** Gets the owning `DestroyRef` for the given output. */\nexport function getOutputDestroyRef(ref: OutputRef<unknown>): DestroyRef | undefined {\n return ref.destroyRef;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {createComputed, SIGNAL} from '../../../primitives/signals';\n\nimport {Signal, ValueEqualityFn} from './api';\n\n/**\n * Options passed to the `computed` creation function.\n */\nexport interface CreateComputedOptions<T> {\n /**\n * A comparison function which defines equality for computed values.\n */\n equal?: ValueEqualityFn<T>;\n\n /**\n * A debug name for the computed signal. Used in Angular DevTools to identify the signal.\n */\n debugName?: string;\n}\n\n/**\n * Create a computed `Signal` which derives a reactive value from an expression.\n * @see [Computed signals](guide/signals#computed-signals)\n */\nexport function computed<T>(computation: () => T, options?: CreateComputedOptions<T>): Signal<T> {\n const getter = createComputed(computation, options?.equal);\n\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n const debugName = options?.debugName;\n getter[SIGNAL].debugName = debugName;\n getter.toString = () => `[Computed${debugName ? ' (' + debugName + ')' : ''}: ${getter()}]`;\n }\n\n return getter;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {untracked as untrackedPrimitive} from '../../../primitives/signals';\n\n/**\n * Execute an arbitrary function in a non-reactive (non-tracking) context. The executed function\n * can, optionally, return a value.\n * @see [Reading without tracking dependencies](guide/signals#reading-without-tracking-dependencies)\n */\nexport function untracked<T>(nonReactiveReadsFn: () => T): T {\n return untrackedPrimitive(nonReactiveReadsFn);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Injector} from '../di/injector';\nimport {Signal, ValueEqualityFn} from '../render3/reactivity/api';\nimport {WritableSignal} from '../render3/reactivity/signal';\n\n/** Error thrown when a `Resource` dependency of another resource errors. */\nexport class ResourceDependencyError extends Error {\n /** The dependency that errored. */\n readonly dependency: Resource<unknown>;\n\n constructor(dependency: Resource<unknown>) {\n super('Dependency error', {cause: dependency.error()});\n this.name = 'ResourceDependencyError';\n this.dependency = dependency;\n }\n}\n\n/**\n * Special status codes that can be thrown from a resource's `params` or `request` function to\n * indicate that the resource should transition to that status.\n */\nexport class ResourceParamsStatus extends Error {\n private readonly _brand: undefined;\n private constructor(msg: string) {\n super(msg);\n }\n\n /** Status code that transitions the resource to `idle` status. */\n static readonly IDLE = new ResourceParamsStatus('IDLE');\n\n /** Status code that transitions the resource to `loading` status. */\n static readonly LOADING = new ResourceParamsStatus('LOADING');\n}\n\n/** Context received by a resource's `params` or `request` function. */\nexport interface ResourceParamsContext {\n /**\n * Chains the current params off of the value of another resource, returning the value\n * of the other resource if it is available, or propagating the status to the current resource by\n * throwing the appropriate status code if the value is not available.\n */\n readonly chain: <T>(resource: Resource<T>) => T;\n}\n\n/**\n * String value capturing the status of a `Resource`.\n *\n * Possible statuses are:\n *\n * `idle` - The resource has no valid request and will not perform any loading. `value()` will be\n * `undefined`.\n *\n * `loading` - The resource is currently loading a new value as a result of a change in its reactive\n * dependencies. `value()` will be `undefined`.\n *\n * `reloading` - The resource is currently reloading a fresh value for the same reactive\n * dependencies. `value()` will continue to return the previously fetched value during the reloading\n * operation.\n *\n * `error` - Loading failed with an error. `value()` will be `undefined`.\n *\n * `resolved` - Loading has completed and the resource has the value returned from the loader.\n *\n * `local` - The resource's value was set locally via `.set()` or `.update()`.\n *\n * @experimental\n */\nexport type ResourceStatus = 'idle' | 'error' | 'loading' | 'reloading' | 'resolved' | 'local';\n\n/**\n * A Resource is an asynchronous dependency (for example, the results of an API call) that is\n * managed and delivered through signals.\n *\n * The usual way of creating a `Resource` is through the `resource` function, but various other APIs\n * may present `Resource` instances to describe their own concepts.\n *\n * @experimental\n */\nexport interface Resource<T> {\n /**\n * The current value of the `Resource`, or throws an error if the resource is in an error state.\n */\n readonly value: Signal<T>;\n\n /**\n * The current status of the `Resource`, which describes what the resource is currently doing and\n * what can be expected of its `value`.\n */\n readonly status: Signal<ResourceStatus>;\n\n /**\n * When in the `error` state, this returns the last known error from the `Resource`.\n */\n readonly error: Signal<Error | undefined>;\n\n /**\n * Whether this resource is loading a new value (or reloading the existing one).\n */\n readonly isLoading: Signal<boolean>;\n\n /**\n * The current state of this resource, represented as a `ResourceSnapshot`.\n */\n readonly snapshot: Signal<ResourceSnapshot<T>>;\n\n /**\n * Whether this resource has a valid current value.\n *\n * This function is reactive.\n */\n hasValue(this: T extends undefined ? this : never): this is Resource<Exclude<T, undefined>>;\n\n hasValue(): boolean;\n}\n\n/**\n * A `Resource` with a mutable value.\n *\n * Overwriting the value of a resource sets it to the 'local' state.\n *\n * @experimental\n */\nexport interface WritableResource<T> extends Resource<T> {\n readonly value: WritableSignal<T>;\n hasValue(\n this: T extends undefined ? this : never,\n ): this is WritableResource<Exclude<T, undefined>>;\n\n hasValue(): boolean;\n\n /**\n * Convenience wrapper for `value.set`.\n */\n set(value: T): void;\n\n /**\n * Convenience wrapper for `value.update`.\n */\n update(updater: (value: T) => T): void;\n asReadonly(): Resource<T>;\n\n /**\n * Instructs the resource to re-load any asynchronous dependency it may have.\n *\n * Note that the resource will not enter its reloading state until the actual backend request is\n * made.\n *\n * @returns true if a reload was initiated, false if a reload was unnecessary or unsupported\n */\n reload(): boolean;\n}\n\n/**\n * A `WritableResource` created through the `resource` function.\n *\n * @experimental\n */\nexport interface ResourceRef<T> extends WritableResource<T> {\n hasValue(this: T extends undefined ? this : never): this is ResourceRef<Exclude<T, undefined>>;\n\n hasValue(): boolean;\n /**\n * Manually destroy the resource, which cancels pending requests and returns it to `idle` state.\n */\n destroy(): void;\n}\n\n/**\n * Parameter to a `ResourceLoader` which gives the request and other options for the current loading\n * operation.\n *\n * @experimental\n */\nexport interface ResourceLoaderParams<R> {\n params: NoInfer<Exclude<R, undefined>>;\n abortSignal: AbortSignal;\n previous: {\n status: ResourceStatus;\n };\n}\n\n/**\n * Loading function for a `Resource`.\n *\n * @experimental\n */\nexport type ResourceLoader<T, R> = (param: ResourceLoaderParams<R>) => PromiseLike<T>;\n\n/**\n * Streaming loader for a `Resource`.\n *\n * @experimental\n */\nexport type ResourceStreamingLoader<T, R> = (\n param: ResourceLoaderParams<R>,\n) => Signal<ResourceStreamItem<T>> | PromiseLike<Signal<ResourceStreamItem<T>>> | undefined;\n\n/**\n * Options to the `resource` function, for creating a resource.\n *\n * @experimental\n */\nexport interface BaseResourceOptions<T, R> {\n /**\n * A reactive function which determines the request to be made. Whenever the request changes, the\n * loader will be triggered to fetch a new value for the resource.\n *\n * If a params function isn't provided, the loader won't rerun unless the resource is reloaded.\n */\n params?: (ctx: ResourceParamsContext) => R;\n\n /**\n * The value which will be returned from the resource when a server value is unavailable, such as\n * when the resource is still loading.\n */\n defaultValue?: NoInfer<T>;\n\n /**\n * Equality function used to compare the return value of the loader.\n */\n equal?: ValueEqualityFn<T>;\n\n /**\n * Overrides the `Injector` used by `resource`.\n */\n injector?: Injector;\n}\n\n/**\n * Options to the `resource` function, for creating a resource.\n *\n * @experimental\n */\nexport interface PromiseResourceOptions<T, R> extends BaseResourceOptions<T, R> {\n /**\n * Loading function which returns a `Promise` of the resource's value for a given request.\n */\n loader: ResourceLoader<T, R>;\n\n /**\n * Cannot specify `stream` and `loader` at the same time.\n */\n stream?: never;\n}\n\n/**\n * Options to the `resource` function, for creating a resource.\n *\n * @experimental\n */\nexport interface StreamingResourceOptions<T, R> extends BaseResourceOptions<T, R> {\n /**\n * Loading function which returns a `Promise` of a signal of the resource's value for a given\n * request, which can change over time as new values are received from a stream.\n */\n stream: ResourceStreamingLoader<T, R>;\n\n /**\n * Cannot specify `stream` and `loader` at the same time.\n */\n loader?: never;\n}\n\n/**\n * @experimental\n */\nexport type ResourceOptions<T, R> = (\n | PromiseResourceOptions<T, R>\n | StreamingResourceOptions<T, R>\n) & {\n /**\n * A debug name for the reactive node. Used in Angular DevTools to identify the node.\n */\n debugName?: string;\n};\n\n/**\n * @experimental\n */\nexport type ResourceStreamItem<T> = {value: T} | {error: Error};\n\n/**\n * An explicit representation of a resource's state.\n *\n * @experimental\n * @see [Resource composition with snapshots](guide/signals/resource#resource-composition-with-snapshots)\n */\nexport type ResourceSnapshot<T> =\n | {readonly status: 'idle'; readonly value: T}\n | {readonly status: 'loading' | 'reloading'; readonly value: T}\n | {readonly status: 'resolved' | 'local'; readonly value: T}\n | {readonly status: 'error'; readonly error: Error};\n\n/**\n * Options for `debounced`.\n *\n * @see [Debouncing signals with `debounced`](guide/signals/debounced)\n */\nexport interface DebouncedOptions<T> {\n /** The `Injector` to use for the debounced resource. */\n injector?: Injector;\n /** The equality function to use for comparing values. */\n equal?: ValueEqualityFn<T>;\n}\n\n/**\n * Represents the wait condition for item debouncing.\n * Can be a number of milliseconds or a function that returns a Promise.\n *\n * @see [Debouncing signals with `debounced`](guide/signals/debounced)\n */\nexport type DebounceTimer<T> =\n | number\n | ((value: T, lastValue: ResourceSnapshot<T>) => Promise<void> | void);\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n ComputationFn,\n createLinkedSignal,\n LinkedSignalGetter,\n LinkedSignalNode,\n linkedSignalSetFn,\n linkedSignalUpdateFn,\n SIGNAL,\n} from '../../../primitives/signals';\nimport {Signal, ValueEqualityFn} from './api';\nimport {signalAsReadonlyFn, WritableSignal} from './signal';\n\nconst identityFn = <T>(v: T) => v;\n\n/**\n * Creates a writable signal whose value is initialized and reset by the linked, reactive computation.\n *\n * @publicApi 20.0\n */\nexport function linkedSignal<D>(\n computation: () => D,\n options?: {equal?: ValueEqualityFn<NoInfer<D>>; debugName?: string},\n): WritableSignal<D>;\n\n/**\n * Creates a writable signal whose value is initialized and reset by the linked, reactive computation.\n * This is an advanced API form where the computation has access to the previous value of the signal and the computation result.\n *\n * Note: The computation is reactive, meaning the linked signal will automatically update whenever any of the signals used within the computation change.\n *\n * @publicApi 20.0\n * @see [Dependent state with linkedSignal](guide/signals/linked-signal)\n */\nexport function linkedSignal<S, D>(options: {\n source: () => S;\n computation: (source: NoInfer<S>, previous?: {source: NoInfer<S>; value: NoInfer<D>}) => D;\n equal?: ValueEqualityFn<NoInfer<D>>;\n debugName?: string;\n}): WritableSignal<D>;\n\nexport function linkedSignal<S, D>(\n optionsOrComputation:\n | {\n source: () => S;\n computation: ComputationFn<S, D>;\n equal?: ValueEqualityFn<D>;\n debugName?: string;\n }\n | (() => D),\n options?: {equal?: ValueEqualityFn<D>; debugName?: string},\n): WritableSignal<D> {\n if (typeof optionsOrComputation === 'function') {\n const getter = createLinkedSignal<D, D>(\n optionsOrComputation,\n identityFn<D>,\n options?.equal,\n ) as LinkedSignalGetter<D, D> & WritableSignal<D>;\n return upgradeLinkedSignalGetter(getter, options?.debugName);\n } else {\n const getter = createLinkedSignal<S, D>(\n optionsOrComputation.source,\n optionsOrComputation.computation,\n optionsOrComputation.equal,\n );\n return upgradeLinkedSignalGetter(getter, optionsOrComputation.debugName);\n }\n}\n\nfunction upgradeLinkedSignalGetter<S, D>(\n getter: LinkedSignalGetter<S, D>,\n debugName?: string,\n): WritableSignal<D> {\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n getter[SIGNAL].debugName = debugName;\n getter.toString = () => `[LinkedSignal${debugName ? ' (' + debugName + ')' : ''}: ${getter()}]`;\n }\n\n const node = getter[SIGNAL] as LinkedSignalNode<S, D>;\n const upgradedGetter = getter as LinkedSignalGetter<S, D> & WritableSignal<D>;\n\n upgradedGetter.set = (newValue: D) => linkedSignalSetFn(node, newValue);\n upgradedGetter.update = (updateFn: (value: D) => D) => linkedSignalUpdateFn(node, updateFn);\n upgradedGetter.asReadonly = signalAsReadonlyFn.bind(getter as any) as () => Signal<D>;\n\n return upgradedGetter;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {isSignal, Signal, ValueEqualityFn} from '../render3/reactivity/api';\nimport {computed} from '../render3/reactivity/computed';\nimport {effect, EffectRef} from '../render3/reactivity/effect';\nimport {signal, signalAsReadonlyFn, WritableSignal} from '../render3/reactivity/signal';\nimport {untracked} from '../render3/reactivity/untracked';\nimport {\n Resource,\n ResourceDependencyError,\n ResourceOptions,\n ResourceParamsStatus,\n ResourceSnapshot,\n ResourceStatus,\n ResourceStreamingLoader,\n ResourceStreamItem,\n StreamingResourceOptions,\n type ResourceParamsContext,\n type ResourceRef,\n type WritableResource,\n} from './api';\n\nimport {assertInInjectionContext} from '../di/contextual';\nimport {Injector} from '../di/injector';\nimport {inject} from '../di/injector_compatibility';\nimport {RuntimeError, RuntimeErrorCode} from '../errors';\nimport {DestroyRef} from '../linker/destroy_ref';\nimport {PendingTasks} from '../pending_tasks';\nimport {linkedSignal} from '../render3/reactivity/linked_signal';\n\n/**\n * Constructs a `Resource` that projects a reactive request to an asynchronous operation defined by\n * a loader function, which exposes the result of the loading operation via signals.\n *\n * Note that `resource` is intended for _read_ operations, not operations which perform mutations.\n * `resource` will cancel in-progress loads via the `AbortSignal` when destroyed or when a new\n * request object becomes available, which could prematurely abort mutations.\n *\n * @see [Async reactivity with resources](guide/signals/resource)\n *\n * @experimental 19.0\n */\nexport function resource<T, R>(\n options: ResourceOptions<T, R> & {defaultValue: NoInfer<T>},\n): ResourceRef<T>;\n\n/**\n * Constructs a `Resource` that projects a reactive request to an asynchronous operation defined by\n * a loader function, which exposes the result of the loading operation via signals.\n *\n * Note that `resource` is intended for _read_ operations, not operations which perform mutations.\n * `resource` will cancel in-progress loads via the `AbortSignal` when destroyed or when a new\n * request object becomes available, which could prematurely abort mutations.\n *\n * @experimental 19.0\n * @see [Async reactivity with resources](guide/signals/resource)\n */\nexport function resource<T, R>(options: ResourceOptions<T, R>): ResourceRef<T | undefined>;\nexport function resource<T, R>(options: ResourceOptions<T, R>): ResourceRef<T | undefined> {\n if (ngDevMode && !options?.injector) {\n assertInInjectionContext(resource);\n }\n\n const oldNameForParams = (\n options as ResourceOptions<T, R> & {request: ResourceOptions<T, R>['params']}\n ).request;\n const params = options.params ?? oldNameForParams ?? (() => null!);\n return new ResourceImpl<T | undefined, R>(\n params,\n getLoader(options),\n options.defaultValue,\n options.equal ? wrapEqualityFn(options.equal) : undefined,\n options.debugName,\n options.injector ?? inject(Injector),\n );\n}\n\ntype ResourceInternalStatus = 'idle' | 'loading' | 'resolved' | 'local';\n\n/**\n * Internal state of a resource.\n */\ninterface ResourceProtoState<T> {\n extRequest: WrappedRequest;\n\n // For simplicity, status is internally tracked as a subset of the public status enum.\n // Reloading and Error statuses are projected from Loading and Resolved based on other state.\n status: ResourceInternalStatus;\n}\n\ninterface ResourceState<T> extends ResourceProtoState<T> {\n previousStatus: ResourceStatus;\n stream: Signal<ResourceStreamItem<T>> | undefined;\n}\n\ntype WrappedRequest = {\n request?: unknown;\n reload: number;\n status?: ResourceInternalStatus;\n error?: Error;\n};\n\n/**\n * Base class which implements `.value` as a `WritableSignal` by delegating `.set` and `.update`.\n */\nabstract class BaseWritableResource<T> implements WritableResource<T> {\n readonly value: WritableSignal<T>;\n abstract readonly status: Signal<ResourceStatus>;\n abstract readonly error: Signal<Error | undefined>;\n\n abstract reload(): boolean;\n\n readonly isLoading: Signal<boolean>;\n\n constructor(value: Signal<T>, debugName: string | undefined) {\n this.value = value as WritableSignal<T>;\n this.value.set = this.set.bind(this);\n this.value.update = this.update.bind(this);\n this.value.asReadonly = signalAsReadonlyFn;\n\n this.isLoading = computed(\n () => this.status() === 'loading' || this.status() === 'reloading',\n ngDevMode ? createDebugNameObject(debugName, 'isLoading') : undefined,\n );\n }\n\n abstract set(value: T): void;\n\n private readonly isError = computed(() => this.status() === 'error');\n\n update(updateFn: (value: T) => T): void {\n this.set(updateFn(untracked(this.value)));\n }\n\n // Use a computed here to avoid triggering reactive consumers if the value changes while staying\n // either defined or undefined.\n private readonly isValueDefined = computed(() => {\n // Check if it's in an error state first to prevent the error from bubbling up.\n if (this.isError()) {\n return false;\n }\n\n return this.value() !== undefined;\n });\n\n private _snapshot: Signal<ResourceSnapshot<T>> | undefined;\n get snapshot(): Signal<ResourceSnapshot<T>> {\n return (this._snapshot ??= computed(() => {\n const status = this.status();\n if (status === 'error') {\n return {status: 'error', error: this.error()!};\n } else {\n return {status, value: this.value()};\n }\n }));\n }\n\n hasValue(): this is ResourceRef<Exclude<T, undefined>> {\n return this.isValueDefined();\n }\n\n asReadonly(): Resource<T> {\n return this;\n }\n}\n\n/**\n * Implementation for `resource()` which uses a `linkedSignal` to manage the resource's state.\n */\nexport class ResourceImpl<T, R> extends BaseWritableResource<T> implements ResourceRef<T> {\n private readonly pendingTasks: PendingTasks;\n\n /**\n * The current state of the resource. Status, value, and error are derived from this.\n */\n private readonly state: WritableSignal<ResourceState<T>>;\n\n /**\n * Combines the current request with a reload counter which allows the resource to be reloaded on\n * imperative command.\n */\n protected readonly extRequest: WritableSignal<WrappedRequest>;\n private readonly effectRef: EffectRef;\n\n private pendingController: AbortController | undefined;\n private resolvePendingTask: (() => void) | undefined = undefined;\n private destroyed = false;\n private unregisterOnDestroy: () => void;\n\n override readonly status: Signal<ResourceStatus>;\n override readonly error: Signal<Error | undefined>;\n\n constructor(\n request: (ctx: ResourceParamsContext) => R,\n private readonly loaderFn: ResourceStreamingLoader<T, R>,\n defaultValue: T,\n private readonly equal: ValueEqualityFn<T> | undefined,\n private readonly debugName: string | undefined,\n injector: Injector,\n getInitialStream?: (request: R) => Signal<ResourceStreamItem<T>> | undefined,\n ) {\n if (isInParamsFunction()) {\n throw invalidResourceCreationInParams();\n }\n\n super(\n // Feed a computed signal for the value to `BaseWritableResource`, which will upgrade it to a\n // `WritableSignal` that delegates to `ResourceImpl.set`.\n computed(\n () => {\n const streamValue = this.state().stream?.();\n\n if (!streamValue) {\n return defaultValue;\n }\n\n // Prevents `hasValue()` from throwing an error when a reload happened in the error state\n if (this.state().status === 'loading' && this.error()) {\n return defaultValue;\n }\n\n if (!isResolved(streamValue)) {\n throw new ResourceValueError(this.error()!);\n }\n\n return streamValue.value;\n },\n {equal, ...(ngDevMode ? createDebugNameObject(debugName, 'value') : undefined)},\n ),\n debugName,\n );\n\n this.extRequest = linkedSignal<WrappedRequest>(\n () => {\n try {\n setInParamsFunction(true);\n return {request: request(paramsContext), reload: 0};\n } catch (error) {\n rethrowFatalErrors(error);\n if (error === ResourceParamsStatus.IDLE) {\n return {status: 'idle', reload: 0};\n } else if (error === ResourceParamsStatus.LOADING) {\n return {status: 'loading', reload: 0};\n }\n return {error: error as Error, reload: 0};\n } finally {\n setInParamsFunction(false);\n }\n },\n ngDevMode ? createDebugNameObject(debugName, 'extRequest') : undefined,\n );\n\n // The main resource state is managed in a `linkedSignal`, which allows the resource to change\n // state instantaneously when the request signal changes.\n this.state = linkedSignal<WrappedRequest, ResourceState<T>>({\n // Whenever the request changes,\n source: this.extRequest,\n // Compute the state of the resource given a change in status.\n computation: (extRequest, previous) => {\n let {request, status, error} = extRequest;\n let stream: Signal<ResourceStreamItem<T>> | undefined;\n\n if (error) {\n status = 'resolved';\n stream = signal(\n {error: encapsulateResourceError(error)},\n ngDevMode ? createDebugNameObject(this.debugName, 'stream') : undefined,\n );\n } else if (!status) {\n if (!previous) {\n stream = getInitialStream?.(extRequest.request as R);\n // Clear getInitialStream so it doesn't hold onto memory\n getInitialStream = undefined;\n status = request === undefined ? 'idle' : stream ? 'resolved' : 'loading';\n } else {\n status = request === undefined ? 'idle' : 'loading';\n if (previous.value.extRequest.request === request) {\n stream = previous.value.stream;\n }\n }\n }\n\n return {\n extRequest,\n status,\n previousStatus: previous ? projectStatusOfState(previous.value) : 'idle',\n stream,\n };\n },\n ...(ngDevMode ? createDebugNameObject(debugName, 'state') : undefined),\n });\n\n this.effectRef = effect(this.loadEffect.bind(this), {\n injector,\n manualCleanup: true,\n ...(ngDevMode ? createDebugNameObject(debugName, 'loadEffect') : undefined),\n });\n\n this.pendingTasks = injector.get(PendingTasks);\n\n // Cancel any pending request when the resource itself is destroyed.\n this.unregisterOnDestroy = injector.get(DestroyRef).onDestroy(() => this.destroy());\n\n this.status = computed(\n () => projectStatusOfState(this.state()),\n ngDevMode ? createDebugNameObject(debugName, 'status') : undefined,\n );\n\n this.error = computed(\n () => {\n const stream = this.state().stream?.();\n return stream && !isResolved(stream) ? stream.error : undefined;\n },\n ngDevMode ? createDebugNameObject(debugName, 'error') : undefined,\n );\n }\n\n /**\n * Called either directly via `WritableResource.set` or via `.value.set()`.\n */\n override set(value: T): void {\n if (this.destroyed) {\n return;\n }\n\n const error = untracked(this.error);\n const state = untracked(this.state);\n\n if (!error) {\n const current = untracked(this.value);\n if (\n state.status === 'local' &&\n (this.equal ? this.equal(current, value) : current === value)\n ) {\n return;\n }\n }\n\n // Enter Local state with the user-defined value.\n this.state.set({\n extRequest: state.extRequest,\n status: 'local',\n previousStatus: 'local',\n stream: signal(\n {value},\n ngDevMode ? createDebugNameObject(this.debugName, 'stream') : undefined,\n ),\n });\n\n // We're departing from whatever state the resource was in previously, so cancel any in-progress\n // loading operations.\n this.abortInProgressLoad();\n }\n\n override reload(): boolean {\n // We don't want to restart in-progress loads.\n const {status} = untracked(this.state);\n if (status === 'idle' || status === 'loading') {\n return false;\n }\n\n // Increment the request reload to trigger the `state` linked signal to switch us to `Reload`\n this.extRequest.update(({request, reload}) => ({request, reload: reload + 1}));\n return true;\n }\n\n destroy(): void {\n this.destroyed = true;\n this.unregisterOnDestroy();\n this.effectRef.destroy();\n this.abortInProgressLoad();\n\n // Destroyed resources enter Idle state.\n this.state.set({\n extRequest: {request: undefined, reload: 0},\n status: 'idle',\n previousStatus: 'idle',\n stream: undefined,\n });\n }\n\n private async loadEffect(): Promise<void> {\n const extRequest = this.extRequest();\n\n // Capture the previous status before any state transitions. Note that this is `untracked` since\n // we do not want the effect to depend on the state of the resource, only on the request.\n const {status: currentStatus, previousStatus} = untracked(this.state);\n\n if (extRequest.request === undefined) {\n // Nothing to load (and we should already be in a non-loading state).\n return;\n } else if (currentStatus !== 'loading') {\n // We're not in a loading or reloading state, so this loading request is stale.\n return;\n }\n\n // Cancel any previous loading attempts.\n this.abortInProgressLoad();\n\n // Capturing _this_ load's pending task in a local variable is important here. We may attempt to\n // resolve it twice:\n //\n // 1. when the loading function promise resolves/rejects\n // 2. when cancelling the loading operation\n //\n // After the loading operation is cancelled, `this.resolvePendingTask` no longer represents this\n // particular task, but this `await` may eventually resolve/reject. Thus, when we cancel in\n // response to (1) below, we need to cancel the locally saved task.\n let resolvePendingTask: (() => void) | undefined = (this.resolvePendingTask =\n this.pendingTasks.add());\n\n const {signal: abortSignal} = (this.pendingController = new AbortController());\n\n try {\n // The actual loading is run through `untracked` - only the request side of `resource` is\n // reactive. This avoids any confusion with signals tracking or not tracking depending on\n // which side of the `await` they are.\n const stream = untracked(() => {\n return this.loaderFn({\n params: extRequest.request as Exclude<R, undefined>,\n abortSignal,\n previous: {\n status: previousStatus,\n },\n });\n });\n\n // If this request has been aborted, or the current request no longer\n // matches this load, then we should ignore this resolution.\n const shouldDiscard = () => abortSignal.aborted || untracked(this.extRequest) !== extRequest;\n\n if (isSignal(stream)) {\n if (shouldDiscard()) {\n return;\n }\n\n this.state.set({\n extRequest,\n status: 'resolved',\n previousStatus: 'resolved',\n stream,\n });\n } else {\n const resolvedStream = await stream;\n if (shouldDiscard()) {\n return;\n }\n\n this.state.set({\n extRequest,\n status: 'resolved',\n previousStatus: 'resolved',\n stream: resolvedStream,\n });\n }\n } catch (err) {\n rethrowFatalErrors(err);\n if (abortSignal.aborted || untracked(this.extRequest) !== extRequest) {\n return;\n }\n\n this.state.set({\n extRequest,\n status: 'resolved',\n previousStatus: 'error',\n stream: signal(\n {error: encapsulateResourceError(err)},\n ngDevMode ? createDebugNameObject(this.debugName, 'stream') : undefined,\n ),\n });\n } finally {\n // Resolve the pending task now that the resource has a value.\n resolvePendingTask?.();\n resolvePendingTask = undefined;\n }\n }\n\n private abortInProgressLoad(): void {\n untracked(() => this.pendingController?.abort());\n this.pendingController = undefined;\n\n // Once the load is aborted, we no longer want to block stability on its resolution.\n this.resolvePendingTask?.();\n this.resolvePendingTask = undefined;\n }\n}\n\n/**\n * Wraps an equality function to handle either value being `undefined`.\n */\nfunction wrapEqualityFn<T>(equal: ValueEqualityFn<T>): ValueEqualityFn<T | undefined> {\n return (a, b) => (a === undefined || b === undefined ? a === b : equal(a, b));\n}\n\nfunction getLoader<T, R>(options: ResourceOptions<T, R>): ResourceStreamingLoader<T, R> {\n if (isStreamingResourceOptions(options)) {\n return options.stream;\n }\n\n return async (params) => {\n try {\n return signal(\n {value: await options.loader(params)},\n ngDevMode ? createDebugNameObject(options.debugName, 'stream') : undefined,\n );\n } catch (err) {\n return signal(\n {error: encapsulateResourceError(err)},\n ngDevMode ? createDebugNameObject(options.debugName, 'stream') : undefined,\n );\n }\n };\n}\n\nfunction isStreamingResourceOptions<T, R>(\n options: ResourceOptions<T, R>,\n): options is StreamingResourceOptions<T, R> {\n return !!(options as StreamingResourceOptions<T, R>).stream;\n}\n\n/**\n * Project from a state with `ResourceInternalStatus` to the user-facing `ResourceStatus`\n */\nfunction projectStatusOfState(state: ResourceState<unknown>): ResourceStatus {\n switch (state.status) {\n case 'loading':\n return state.extRequest.reload === 0 ? 'loading' : 'reloading';\n case 'resolved':\n return isResolved(state.stream!()) ? 'resolved' : 'error';\n default:\n return state.status;\n }\n}\n\nfunction isResolved<T>(state: ResourceStreamItem<T>): state is {value: T} {\n return (state as {error: unknown}).error === undefined;\n}\n\n/**\n * Creates a debug name object for an internal signal.\n */\nfunction createDebugNameObject(\n resourceDebugName: string | undefined,\n internalSignalDebugName: string,\n): {debugName?: string} {\n return {\n debugName: `Resource${resourceDebugName ? '#' + resourceDebugName : ''}.${internalSignalDebugName}`,\n };\n}\n\nexport function encapsulateResourceError(error: unknown): Error {\n if (isErrorLike(error)) {\n return error;\n }\n\n return new ResourceWrappedError(error);\n}\n\nexport function isErrorLike(error: unknown): error is Error {\n return (\n error instanceof Error ||\n (typeof error === 'object' &&\n typeof (error as Error).name === 'string' &&\n typeof (error as Error).message === 'string')\n );\n}\n\nexport class ResourceValueError extends Error {\n constructor(error: Error) {\n super(\n ngDevMode\n ? `Resource is currently in an error state (see Error.cause for details): ${error.message}`\n : error.message,\n {cause: error},\n );\n }\n}\n\nclass ResourceWrappedError extends Error {\n constructor(error: unknown) {\n super(\n ngDevMode\n ? `Resource returned an error that's not an Error instance: ${String(error)}. Check this error's .cause for the actual error.`\n : String(error),\n {cause: error},\n );\n }\n}\n\n/**\n * Chains the value of another resource into the params of the current resource, returning the value\n * of the other resource if it is available, or propagating the status to the current resource if it\n * is not.\n */\nexport const paramsContext: ResourceParamsContext = {\n chain<T>(resource: Resource<T>): T {\n switch (resource.status()) {\n case 'idle':\n throw ResourceParamsStatus.IDLE;\n case 'error':\n throw new ResourceDependencyError(resource);\n case 'loading':\n case 'reloading':\n throw ResourceParamsStatus.LOADING;\n }\n return resource.value();\n },\n};\n\nlet inParamsFunction = false;\n\nexport function isInParamsFunction() {\n return inParamsFunction;\n}\n\nexport function setInParamsFunction(value: boolean) {\n inParamsFunction = value;\n}\n\nexport function invalidResourceCreationInParams(): Error {\n return new RuntimeError(\n RuntimeErrorCode.INVALID_RESOURCE_CREATION_IN_PARAMS,\n ngDevMode && `Cannot create a resource inside the \\`params\\` of another resource`,\n );\n}\n\nexport function rethrowFatalErrors(error: unknown) {\n if (\n error instanceof RuntimeError &&\n error.code === RuntimeErrorCode.INVALID_RESOURCE_CREATION_IN_PARAMS\n ) {\n throw error;\n }\n}\n"],"names":["OutputEmitterRef","destroyed","listeners","errorHandler","inject","ErrorHandler","optional","destroyRef","DestroyRef","constructor","onDestroy","subscribe","callback","RuntimeError","ngDevMode","push","unsubscribe","idx","indexOf","undefined","splice","emit","value","console","warn","formatRuntimeError","previousConsumer","setActiveConsumer","listenerFn","err","handleError","getOutputDestroyRef","ref","computed","computation","options","getter","createComputed","equal","debugName","SIGNAL","toString","untracked","nonReactiveReadsFn","untrackedPrimitive","ResourceDependencyError","Error","dependency","cause","error","name","ResourceParamsStatus","_brand","msg","IDLE","LOADING","identityFn","v","linkedSignal","optionsOrComputation","createLinkedSignal","upgradeLinkedSignalGetter","source","node","upgradedGetter","set","newValue","linkedSignalSetFn","update","updateFn","linkedSignalUpdateFn","asReadonly","signalAsReadonlyFn","bind","resource","injector","assertInInjectionContext","oldNameForParams","request","params","ResourceImpl","getLoader","defaultValue","wrapEqualityFn","Injector","BaseWritableResource","isLoading","status","createDebugNameObject","isError","isValueDefined","_snapshot","snapshot","hasValue","loaderFn","pendingTasks","state","extRequest","effectRef","pendingController","resolvePendingTask","unregisterOnDestroy","getInitialStream","isInParamsFunction","invalidResourceCreationInParams","streamValue","stream","isResolved","ResourceValueError","setInParamsFunction","paramsContext","reload","rethrowFatalErrors","previous","signal","encapsulateResourceError","previousStatus","projectStatusOfState","effect","loadEffect","manualCleanup","get","PendingTasks","destroy","current","abortInProgressLoad","currentStatus","add","abortSignal","AbortController","shouldDiscard","aborted","isSignal","resolvedStream","abort","a","b","isStreamingResourceOptions","loader","resourceDebugName","internalSignalDebugName","isErrorLike","ResourceWrappedError","message","String","chain","inParamsFunction","code"],"mappings":";;;;;;;;;;MAgCaA,gBAAgB,CAAA;AACnBC,EAAAA,SAAS,GAAG,KAAK;AACjBC,EAAAA,SAAS,GAAqC,IAAI;AAClDC,EAAAA,YAAY,GAAGC,MAAM,CAACC,YAAY,EAAE;AAACC,IAAAA,QAAQ,EAAE;AAAI,GAAC,CAAC;AAG7DC,EAAAA,UAAU,GAAeH,MAAM,CAACI,UAAU,CAAC;AAE3CC,EAAAA,WAAAA,GAAA;AAEE,IAAA,IAAI,CAACF,UAAU,CAACG,SAAS,CAAC,MAAK;MAC7B,IAAI,CAACT,SAAS,GAAG,IAAI;MACrB,IAAI,CAACC,SAAS,GAAG,IAAI;AACvB,IAAA,CAAC,CAAC;AACJ,EAAA;EAEAS,SAASA,CAACC,QAA4B,EAAA;IACpC,IAAI,IAAI,CAACX,SAAS,EAAE;MAClB,MAAM,IAAIY,YAAY,CAAA,GAAA,EAEpBC,SAAS,IACP,oDAAoD,GAClD,8CAA8C,CACnD;AACH,IAAA;IAEA,CAAC,IAAI,CAACZ,SAAS,KAAK,EAAE,EAAEa,IAAI,CAACH,QAAQ,CAAC;IAEtC,OAAO;MACLI,WAAW,EAAEA,MAAK;QAChB,MAAMC,GAAG,GAAG,IAAI,CAACf,SAAS,EAAEgB,OAAO,CAACN,QAAQ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AACzB,EAAA;CACD;AAED,IAAI4H,gBAAgB,GAAG,KAAK;SAEZ3C,kBAAkBA,GAAA;AAChC,EAAA,OAAO2C,gBAAgB;AACzB;AAEM,SAAUrC,mBAAmBA,CAACvF,KAAc,EAAA;AAChD4H,EAAAA,gBAAgB,GAAG5H,KAAK;AAC1B;SAEgBkF,+BAA+BA,GAAA;EAC7C,OAAO,IAAI3F,YAAY,CAAA,GAAA,EAErBC,SAAS,IAAI,oEAAoE,CAClF;AACH;AAEM,SAAUkG,kBAAkBA,CAAC/D,KAAc,EAAA;EAC/C,IACEA,KAAK,YAAYpC,YAAY,IAC7BoC,KAAK,CAACkG,IAAI,KAAA,GAAA,EACV;AACA,IAAA,MAAMlG,KAAK;AACb,EAAA;AACF;;;;"}
{"version":3,"file":"_resource-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/authoring/output/output_emitter_ref.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/hydration/cache.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/render3/reactivity/computed.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/render3/reactivity/untracked.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/resource/api.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/render3/reactivity/linked_signal.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/src/resource/resource.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {setActiveConsumer} from '../../../primitives/signals';\n\nimport {inject} from '../../di/injector_compatibility';\nimport {ErrorHandler} from '../../error_handler';\nimport {formatRuntimeError, RuntimeError, RuntimeErrorCode} from '../../errors';\nimport {DestroyRef} from '../../linker/destroy_ref';\n\nimport {OutputRef, OutputRefSubscription} from './output_ref';\n\n/**\n * An `OutputEmitterRef` is created by the `output()` function and can be\n * used to emit values to consumers of your directive or component.\n *\n * Consumers of your directive/component can bind to the output and\n * subscribe to changes via the bound event syntax. For example:\n *\n * ```html\n * <my-comp (valueChange)=\"processNewValue($event)\" />\n * ```\n *\n * @see [Custom events with outputs](guide/components/outputs)\n *\n * @publicAPI\n */\nexport class OutputEmitterRef<T> implements OutputRef<T> {\n private destroyed = false;\n private listeners: Array<(value: T) => void> | null = null;\n private errorHandler = inject(ErrorHandler, {optional: true});\n\n /** @internal */\n destroyRef: DestroyRef = inject(DestroyRef);\n\n constructor() {\n // Clean-up all listeners and mark as destroyed upon destroy.\n this.destroyRef.onDestroy(() => {\n this.destroyed = true;\n this.listeners = null;\n });\n }\n\n subscribe(callback: (value: T) => void): OutputRefSubscription {\n if (this.destroyed) {\n throw new RuntimeError(\n RuntimeErrorCode.OUTPUT_REF_DESTROYED,\n ngDevMode &&\n 'Unexpected subscription to destroyed `OutputRef`. ' +\n 'The owning directive/component is destroyed.',\n );\n }\n\n (this.listeners ??= []).push(callback);\n\n return {\n unsubscribe: () => {\n const idx = this.listeners?.indexOf(callback);\n if (idx !== undefined && idx !== -1) {\n this.listeners?.splice(idx, 1);\n }\n },\n };\n }\n\n /** Emits a new value to the output. */\n emit(value: T): void {\n if (this.destroyed) {\n console.warn(\n formatRuntimeError(\n RuntimeErrorCode.OUTPUT_REF_DESTROYED,\n ngDevMode &&\n 'Unexpected emit for destroyed `OutputRef`. ' +\n 'The owning directive/component is destroyed.',\n ),\n );\n return;\n }\n\n if (this.listeners === null) {\n return;\n }\n\n const previousConsumer = setActiveConsumer(null);\n try {\n for (const listenerFn of this.listeners) {\n try {\n listenerFn(value);\n } catch (err: unknown) {\n this.errorHandler?.handleError(err);\n }\n }\n } finally {\n setActiveConsumer(previousConsumer);\n }\n }\n}\n\n/** Gets the owning `DestroyRef` for the given output. */\nexport function getOutputDestroyRef(ref: OutputRef<unknown>): DestroyRef | undefined {\n return ref.destroyRef;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {InjectionToken} from '../di';\n\n/**\n * Token used to the determine if the transfer cache should be used, for example for resources.\n */\nexport const CACHE_ACTIVE = new InjectionToken<{isActive: boolean}>(\n typeof ngDevMode !== 'undefined' && ngDevMode ? 'STATE_CACHE_ACTIVE' : '',\n);\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {createComputed, SIGNAL} from '../../../primitives/signals';\n\nimport {Signal, ValueEqualityFn} from './api';\n\n/**\n * Options passed to the `computed` creation function.\n */\nexport interface CreateComputedOptions<T> {\n /**\n * A comparison function which defines equality for computed values.\n */\n equal?: ValueEqualityFn<T>;\n\n /**\n * A debug name for the computed signal. Used in Angular DevTools to identify the signal.\n */\n debugName?: string;\n}\n\n/**\n * Create a computed `Signal` which derives a reactive value from an expression.\n * @see [Computed signals](guide/signals#computed-signals)\n */\nexport function computed<T>(computation: () => T, options?: CreateComputedOptions<T>): Signal<T> {\n const getter = createComputed(computation, options?.equal);\n\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n const debugName = options?.debugName;\n getter[SIGNAL].debugName = debugName;\n getter.toString = () => `[Computed${debugName ? ' (' + debugName + ')' : ''}: ${getter()}]`;\n }\n\n return getter;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {untracked as untrackedPrimitive} from '../../../primitives/signals';\n\n/**\n * Execute an arbitrary function in a non-reactive (non-tracking) context. The executed function\n * can, optionally, return a value.\n * @see [Reading without tracking dependencies](guide/signals#reading-without-tracking-dependencies)\n */\nexport function untracked<T>(nonReactiveReadsFn: () => T): T {\n return untrackedPrimitive(nonReactiveReadsFn);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Injector} from '../di/injector';\nimport {Signal, ValueEqualityFn} from '../render3/reactivity/api';\nimport {WritableSignal} from '../render3/reactivity/signal';\n\n/** Error thrown when a `Resource` dependency of another resource errors. */\nexport class ResourceDependencyError extends Error {\n /** The dependency that errored. */\n readonly dependency: Resource<unknown>;\n\n constructor(dependency: Resource<unknown>) {\n super('Dependency error', {cause: dependency.error()});\n this.name = 'ResourceDependencyError';\n this.dependency = dependency;\n }\n}\n\n/**\n * Special status codes that can be thrown from a resource's `params` or `request` function to\n * indicate that the resource should transition to that status.\n */\nexport class ResourceParamsStatus extends Error {\n private readonly _brand: undefined;\n private constructor(msg: string) {\n super(msg);\n }\n\n /** Status code that transitions the resource to `idle` status. */\n static readonly IDLE = new ResourceParamsStatus('IDLE');\n\n /** Status code that transitions the resource to `loading` status. */\n static readonly LOADING = new ResourceParamsStatus('LOADING');\n}\n\n/** Context received by a resource's `params` or `request` function. */\nexport interface ResourceParamsContext {\n /**\n * Chains the current params off of the value of another resource, returning the value\n * of the other resource if it is available, or propagating the status to the current resource by\n * throwing the appropriate status code if the value is not available.\n */\n readonly chain: <T>(resource: Resource<T>) => T;\n}\n\n/**\n * String value capturing the status of a `Resource`.\n *\n * Possible statuses are:\n *\n * `idle` - The resource has no valid request and will not perform any loading. `value()` will be\n * `undefined`.\n *\n * `loading` - The resource is currently loading a new value as a result of a change in its reactive\n * dependencies. `value()` will be `undefined`.\n *\n * `reloading` - The resource is currently reloading a fresh value for the same reactive\n * dependencies. `value()` will continue to return the previously fetched value during the reloading\n * operation.\n *\n * `error` - Loading failed with an error. `value()` will be `undefined`.\n *\n * `resolved` - Loading has completed and the resource has the value returned from the loader.\n *\n * `local` - The resource's value was set locally via `.set()` or `.update()`.\n *\n * @publicApi 22.0\n */\nexport type ResourceStatus = 'idle' | 'error' | 'loading' | 'reloading' | 'resolved' | 'local';\n\n/**\n * A Resource is an asynchronous dependency (for example, the results of an API call) that is\n * managed and delivered through signals.\n *\n * The usual way of creating a `Resource` is through the `resource` function, but various other APIs\n * may present `Resource` instances to describe their own concepts.\n *\n * @publicApi 22.0\n */\nexport interface Resource<T> {\n /**\n * The current value of the `Resource`, or throws an error if the resource is in an error state.\n */\n readonly value: Signal<T>;\n\n /**\n * The current status of the `Resource`, which describes what the resource is currently doing and\n * what can be expected of its `value`.\n */\n readonly status: Signal<ResourceStatus>;\n\n /**\n * When in the `error` state, this returns the last known error from the `Resource`.\n */\n readonly error: Signal<Error | undefined>;\n\n /**\n * Whether this resource is loading a new value (or reloading the existing one).\n */\n readonly isLoading: Signal<boolean>;\n\n /**\n * The current state of this resource, represented as a `ResourceSnapshot`.\n */\n readonly snapshot: Signal<ResourceSnapshot<T>>;\n\n /**\n * Whether this resource has a valid current value.\n *\n * This function is reactive.\n */\n hasValue(this: T extends undefined ? this : never): this is Resource<Exclude<T, undefined>>;\n\n hasValue(): boolean;\n}\n\n/**\n * A `Resource` with a mutable value.\n *\n * Overwriting the value of a resource sets it to the 'local' state.\n *\n * @publicApi 22.0\n */\nexport interface WritableResource<T> extends Resource<T> {\n readonly value: WritableSignal<T>;\n hasValue(\n this: T extends undefined ? this : never,\n ): this is WritableResource<Exclude<T, undefined>>;\n\n hasValue(): boolean;\n\n /**\n * Convenience wrapper for `value.set`.\n */\n set(value: T): void;\n\n /**\n * Convenience wrapper for `value.update`.\n */\n update(updater: (value: T) => T): void;\n asReadonly(): Resource<T>;\n\n /**\n * Instructs the resource to re-load any asynchronous dependency it may have.\n *\n * Note that the resource will not enter its reloading state until the actual backend request is\n * made.\n *\n * @returns true if a reload was initiated, false if a reload was unnecessary or unsupported\n */\n reload(): boolean;\n}\n\n/**\n * A `WritableResource` created through the `resource` function.\n *\n * @publicApi 22.0\n */\nexport interface ResourceRef<T> extends WritableResource<T> {\n hasValue(this: T extends undefined ? this : never): this is ResourceRef<Exclude<T, undefined>>;\n\n hasValue(): boolean;\n /**\n * Manually destroy the resource, which cancels pending requests and returns it to `idle` state.\n */\n destroy(): void;\n}\n\n/**\n * Parameter to a `ResourceLoader` which gives the request and other options for the current loading\n * operation.\n *\n * @publicApi 22.0\n */\nexport interface ResourceLoaderParams<R> {\n params: NoInfer<Exclude<R, undefined>>;\n abortSignal: AbortSignal;\n previous: {\n status: ResourceStatus;\n };\n}\n\n/**\n * Loading function for a `Resource`.\n *\n * @publicApi 22.0\n */\nexport type ResourceLoader<T, R> = (param: ResourceLoaderParams<R>) => PromiseLike<T>;\n\n/**\n * Streaming loader for a `Resource`.\n *\n * @publicApi 22.0\n */\nexport type ResourceStreamingLoader<T, R> = (\n param: ResourceLoaderParams<R>,\n) => Signal<ResourceStreamItem<T>> | PromiseLike<Signal<ResourceStreamItem<T>>> | undefined;\n\n/**\n * Options to the `resource` function, for creating a resource.\n *\n * @publicApi 22.0\n */\nexport interface BaseResourceOptions<T, R> {\n /**\n * A reactive function which determines the request to be made. Whenever the request changes, the\n * loader will be triggered to fetch a new value for the resource.\n *\n * If a params function isn't provided, the loader won't rerun unless the resource is reloaded.\n */\n params?: (ctx: ResourceParamsContext) => R;\n\n /**\n * The value which will be returned from the resource when a server value is unavailable, such as\n * when the resource is still loading.\n */\n defaultValue?: NoInfer<T>;\n\n /**\n * Equality function used to compare the return value of the loader.\n */\n equal?: ValueEqualityFn<T>;\n\n /**\n * Overrides the `Injector` used by `resource`.\n */\n injector?: Injector;\n\n /**\n * Identifier used to cache the resource data in the `TransferState` during server-side rendering and to retrieve it on the client side.\n * This value value needs to be identical for both the client and server.\n */\n id?: string;\n}\n\n/**\n * Options to the `resource` function, for creating a resource.\n *\n * @publicApi 22.0\n */\nexport interface PromiseResourceOptions<T, R> extends BaseResourceOptions<T, R> {\n /**\n * Loading function which returns a `Promise` of the resource's value for a given request.\n */\n loader: ResourceLoader<T, R>;\n\n /**\n * Cannot specify `stream` and `loader` at the same time.\n */\n stream?: never;\n}\n\n/**\n * Options to the `resource` function, for creating a resource.\n *\n * @publicApi 22.0\n */\nexport interface StreamingResourceOptions<T, R> extends BaseResourceOptions<T, R> {\n /**\n * Loading function which returns a `Promise` of a signal of the resource's value for a given\n * request, which can change over time as new values are received from a stream.\n */\n stream: ResourceStreamingLoader<T, R>;\n\n /**\n * Cannot specify `stream` and `loader` at the same time.\n */\n loader?: never;\n}\n\n/**\n * @publicApi 22.0\n */\nexport type ResourceOptions<T, R> = (\n | PromiseResourceOptions<T, R>\n | StreamingResourceOptions<T, R>\n) & {\n /**\n * A debug name for the reactive node. Used in Angular DevTools to identify the node.\n */\n debugName?: string;\n};\n\n/**\n * @publicApi 22.0\n */\nexport type ResourceStreamItem<T> = {value: T} | {error: Error};\n\n/**\n * An explicit representation of a resource's state.\n *\n * @publicApi 22.0\n * @see [Resource composition with snapshots](guide/signals/resource#resource-composition-with-snapshots)\n */\nexport type ResourceSnapshot<T> =\n | {readonly status: 'idle'; readonly value: T}\n | {readonly status: 'loading' | 'reloading'; readonly value: T}\n | {readonly status: 'resolved' | 'local'; readonly value: T}\n | {readonly status: 'error'; readonly error: Error};\n\n/**\n * Options for `debounced`.\n *\n * @see [Debouncing signals with `debounced`](guide/signals/debounced)\n *\n * @experimental 22.0\n */\nexport interface DebouncedOptions<T> {\n /** The `Injector` to use for the debounced resource. */\n injector?: Injector;\n /** The equality function to use for comparing values. */\n equal?: ValueEqualityFn<T>;\n}\n\n/**\n * Represents the wait condition for item debouncing.\n * Can be a number of milliseconds or a function that returns a Promise.\n *\n * @see [Debouncing signals with `debounced`](guide/signals/debounced)\n *\n * @experimental 22.0\n */\nexport type DebounceTimer<T> =\n | number\n | ((value: T, lastValue: ResourceSnapshot<T>) => Promise<void> | void);\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n ComputationFn,\n createLinkedSignal,\n LinkedSignalGetter,\n LinkedSignalNode,\n linkedSignalSetFn,\n linkedSignalUpdateFn,\n SIGNAL,\n} from '../../../primitives/signals';\nimport {Signal, ValueEqualityFn} from './api';\nimport {signalAsReadonlyFn, WritableSignal} from './signal';\n\nconst identityFn = <T>(v: T) => v;\n\n/**\n * Creates a writable signal whose value is initialized and reset by the linked, reactive computation.\n *\n * @publicApi 20.0\n */\nexport function linkedSignal<D>(\n computation: () => D,\n options?: {equal?: ValueEqualityFn<NoInfer<D>>; debugName?: string},\n): WritableSignal<D>;\n\n/**\n * Creates a writable signal whose value is initialized and reset by the linked, reactive computation.\n * This is an advanced API form where the computation has access to the previous value of the signal and the computation result.\n *\n * Note: The computation is reactive, meaning the linked signal will automatically update whenever any of the signals used within the computation change.\n *\n * @publicApi 20.0\n * @see [Dependent state with linkedSignal](guide/signals/linked-signal)\n */\nexport function linkedSignal<S, D>(options: {\n source: () => S;\n computation: (source: NoInfer<S>, previous?: {source: NoInfer<S>; value: NoInfer<D>}) => D;\n equal?: ValueEqualityFn<NoInfer<D>>;\n debugName?: string;\n}): WritableSignal<D>;\n\nexport function linkedSignal<S, D>(\n optionsOrComputation:\n | {\n source: () => S;\n computation: ComputationFn<S, D>;\n equal?: ValueEqualityFn<D>;\n debugName?: string;\n }\n | (() => D),\n options?: {equal?: ValueEqualityFn<D>; debugName?: string},\n): WritableSignal<D> {\n if (typeof optionsOrComputation === 'function') {\n const getter = createLinkedSignal<D, D>(\n optionsOrComputation,\n identityFn<D>,\n options?.equal,\n ) as LinkedSignalGetter<D, D> & WritableSignal<D>;\n return upgradeLinkedSignalGetter(getter, options?.debugName);\n } else {\n const getter = createLinkedSignal<S, D>(\n optionsOrComputation.source,\n optionsOrComputation.computation,\n optionsOrComputation.equal,\n );\n return upgradeLinkedSignalGetter(getter, optionsOrComputation.debugName);\n }\n}\n\nfunction upgradeLinkedSignalGetter<S, D>(\n getter: LinkedSignalGetter<S, D>,\n debugName?: string,\n): WritableSignal<D> {\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n getter[SIGNAL].debugName = debugName;\n getter.toString = () => `[LinkedSignal${debugName ? ' (' + debugName + ')' : ''}: ${getter()}]`;\n }\n\n const node = getter[SIGNAL] as LinkedSignalNode<S, D>;\n const upgradedGetter = getter as LinkedSignalGetter<S, D> & WritableSignal<D>;\n\n upgradedGetter.set = (newValue: D) => linkedSignalSetFn(node, newValue);\n upgradedGetter.update = (updateFn: (value: D) => D) => linkedSignalUpdateFn(node, updateFn);\n upgradedGetter.asReadonly = signalAsReadonlyFn.bind(getter as any) as () => Signal<D>;\n\n return upgradedGetter;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {isSignal, Signal, ValueEqualityFn} from '../render3/reactivity/api';\nimport {computed} from '../render3/reactivity/computed';\nimport {effect, EffectRef} from '../render3/reactivity/effect';\nimport {signal, signalAsReadonlyFn, WritableSignal} from '../render3/reactivity/signal';\nimport {untracked} from '../render3/reactivity/untracked';\nimport {\n Resource,\n ResourceDependencyError,\n ResourceOptions,\n ResourceParamsStatus,\n ResourceSnapshot,\n ResourceStatus,\n ResourceStreamingLoader,\n ResourceStreamItem,\n StreamingResourceOptions,\n type ResourceParamsContext,\n type ResourceRef,\n type WritableResource,\n} from './api';\n\nimport {assertInInjectionContext} from '../di/contextual';\nimport {Injector} from '../di/injector';\nimport {inject} from '../di/injector_compatibility';\nimport {RuntimeError, RuntimeErrorCode} from '../errors';\nimport {CACHE_ACTIVE} from '../hydration/cache';\nimport {DestroyRef} from '../linker/destroy_ref';\nimport {PendingTasks} from '../pending_tasks';\nimport {linkedSignal} from '../render3/reactivity/linked_signal';\nimport {StateKey, TransferState} from '../transfer_state';\n\n/**\n * Constructs a `Resource` that projects a reactive request to an asynchronous operation defined by\n * a loader function, which exposes the result of the loading operation via signals.\n *\n * Note that `resource` is intended for _read_ operations, not operations which perform mutations.\n * `resource` will cancel in-progress loads via the `AbortSignal` when destroyed or when a new\n * request object becomes available, which could prematurely abort mutations.\n *\n * @see [Async reactivity with resources](guide/signals/resource)\n *\n * @experimental 19.0\n */\nexport function resource<T, R>(\n options: ResourceOptions<T, R> & {defaultValue: NoInfer<T>},\n): ResourceRef<T>;\n\n/**\n * Constructs a `Resource` that projects a reactive request to an asynchronous operation defined by\n * a loader function, which exposes the result of the loading operation via signals.\n *\n * Note that `resource` is intended for _read_ operations, not operations which perform mutations.\n * `resource` will cancel in-progress loads via the `AbortSignal` when destroyed or when a new\n * request object becomes available, which could prematurely abort mutations.\n *\n * @experimental 19.0\n * @see [Async reactivity with resources](guide/signals/resource)\n */\nexport function resource<T, R>(options: ResourceOptions<T, R>): ResourceRef<T | undefined>;\nexport function resource<T, R>(options: ResourceOptions<T, R>): ResourceRef<T | undefined> {\n if (ngDevMode && !options?.injector) {\n assertInInjectionContext(resource);\n }\n\n const oldNameForParams = (\n options as ResourceOptions<T, R> & {request: ResourceOptions<T, R>['params']}\n ).request;\n const params = options.params ?? oldNameForParams ?? (() => null!);\n return new ResourceImpl<T | undefined, R>(\n params,\n getLoader(options),\n options.defaultValue,\n options.equal ? wrapEqualityFn(options.equal) : undefined,\n options.debugName,\n options.injector ?? inject(Injector),\n options.id as StateKey<T>,\n );\n}\n\ntype ResourceInternalStatus = 'idle' | 'loading' | 'resolved' | 'local';\n\n/**\n * Internal state of a resource.\n */\ninterface ResourceProtoState<T> {\n extRequest: WrappedRequest;\n\n // For simplicity, status is internally tracked as a subset of the public status enum.\n // Reloading and Error statuses are projected from Loading and Resolved based on other state.\n status: ResourceInternalStatus;\n}\n\ninterface ResourceState<T> extends ResourceProtoState<T> {\n previousStatus: ResourceStatus;\n stream: Signal<ResourceStreamItem<T>> | undefined;\n}\n\ntype WrappedRequest = {\n request?: unknown;\n reload: number;\n status?: ResourceInternalStatus;\n error?: Error;\n};\n\n/**\n * Base class which implements `.value` as a `WritableSignal` by delegating `.set` and `.update`.\n */\nabstract class BaseWritableResource<T> implements WritableResource<T> {\n readonly value: WritableSignal<T>;\n abstract readonly status: Signal<ResourceStatus>;\n abstract readonly error: Signal<Error | undefined>;\n\n abstract reload(): boolean;\n\n readonly isLoading: Signal<boolean>;\n\n constructor(value: Signal<T>, debugName: string | undefined) {\n this.value = value as WritableSignal<T>;\n this.value.set = this.set.bind(this);\n this.value.update = this.update.bind(this);\n this.value.asReadonly = signalAsReadonlyFn;\n\n this.isLoading = computed(\n () => this.status() === 'loading' || this.status() === 'reloading',\n ngDevMode ? createDebugNameObject(debugName, 'isLoading') : undefined,\n );\n }\n\n abstract set(value: T): void;\n\n private readonly isError = computed(() => this.status() === 'error');\n\n update(updateFn: (value: T) => T): void {\n this.set(updateFn(untracked(this.value)));\n }\n\n // Use a computed here to avoid triggering reactive consumers if the value changes while staying\n // either defined or undefined.\n private readonly isValueDefined = computed(() => {\n // Check if it's in an error state first to prevent the error from bubbling up.\n if (this.isError()) {\n return false;\n }\n\n return this.value() !== undefined;\n });\n\n private _snapshot: Signal<ResourceSnapshot<T>> | undefined;\n get snapshot(): Signal<ResourceSnapshot<T>> {\n return (this._snapshot ??= computed(() => {\n const status = this.status();\n if (status === 'error') {\n return {status: 'error', error: this.error()!};\n } else {\n return {status, value: this.value()};\n }\n }));\n }\n\n hasValue(): this is ResourceRef<Exclude<T, undefined>> {\n return this.isValueDefined();\n }\n\n asReadonly(): Resource<T> {\n return this;\n }\n}\n\n/**\n * Implementation for `resource()` which uses a `linkedSignal` to manage the resource's state.\n */\nexport class ResourceImpl<T, R> extends BaseWritableResource<T> implements ResourceRef<T> {\n private readonly pendingTasks: PendingTasks;\n\n /**\n * The current state of the resource. Status, value, and error are derived from this.\n */\n private readonly state: WritableSignal<ResourceState<T>>;\n\n /**\n * Combines the current request with a reload counter which allows the resource to be reloaded on\n * imperative command.\n */\n protected readonly extRequest: WritableSignal<WrappedRequest>;\n private readonly effectRef: EffectRef;\n\n private pendingController: AbortController | undefined;\n private resolvePendingTask: (() => void) | undefined = undefined;\n private destroyed = false;\n private unregisterOnDestroy: () => void;\n\n override readonly status: Signal<ResourceStatus>;\n override readonly error: Signal<Error | undefined>;\n private readonly transferState: TransferState | undefined;\n\n constructor(\n request: (ctx: ResourceParamsContext) => R,\n private readonly loaderFn: ResourceStreamingLoader<T, R>,\n defaultValue: T,\n private readonly equal: ValueEqualityFn<T> | undefined,\n private readonly debugName: string | undefined,\n injector: Injector,\n private transferCacheKey: StateKey<T> | undefined,\n getInitialStream?: (request: R) => Signal<ResourceStreamItem<T>> | undefined,\n ) {\n if (isInParamsFunction()) {\n throw invalidResourceCreationInParams();\n }\n\n super(\n // Feed a computed signal for the value to `BaseWritableResource`, which will upgrade it to a\n // `WritableSignal` that delegates to `ResourceImpl.set`.\n computed(\n () => {\n const streamValue = this.state().stream?.();\n\n if (!streamValue) {\n return defaultValue;\n }\n\n // Prevents `hasValue()` from throwing an error when a reload happened in the error state\n if (this.state().status === 'loading' && this.error()) {\n return defaultValue;\n }\n\n if (!isResolved(streamValue)) {\n throw new ResourceValueError(this.error()!);\n }\n\n return streamValue.value;\n },\n {equal, ...(ngDevMode ? createDebugNameObject(debugName, 'value') : undefined)},\n ),\n debugName,\n );\n\n const cacheState = injector.get(CACHE_ACTIVE, undefined, {optional: true}) ?? {isActive: false};\n\n this.transferState = injector.get(TransferState, undefined, {optional: true}) ?? undefined;\n\n this.extRequest = linkedSignal<WrappedRequest>(\n () => {\n try {\n setInParamsFunction(true);\n return {request: request(paramsContext), reload: 0};\n } catch (error) {\n rethrowFatalErrors(error);\n if (error === ResourceParamsStatus.IDLE) {\n return {status: 'idle', reload: 0};\n } else if (error === ResourceParamsStatus.LOADING) {\n return {status: 'loading', reload: 0};\n }\n return {error: error as Error, reload: 0};\n } finally {\n setInParamsFunction(false);\n }\n },\n ngDevMode ? createDebugNameObject(debugName, 'extRequest') : undefined,\n );\n\n // The main resource state is managed in a `linkedSignal`, which allows the resource to change\n // state instantaneously when the request signal changes.\n this.state = linkedSignal<WrappedRequest, ResourceState<T>>({\n // Whenever the request changes,\n source: this.extRequest,\n // Compute the state of the resource given a change in status.\n computation: (extRequest, previous) => {\n let {request, status, error} = extRequest;\n let stream: Signal<ResourceStreamItem<T>> | undefined;\n\n if (error) {\n status = 'resolved';\n stream = signal(\n {error: encapsulateResourceError(error)},\n ngDevMode ? createDebugNameObject(this.debugName, 'stream') : undefined,\n );\n } else if (!status) {\n if (!previous) {\n const transferState = this.transferState;\n const cacheKey = this.transferCacheKey;\n if (cacheState.isActive && cacheKey && transferState && request !== undefined) {\n const key = this.transferCacheKey;\n if (transferState.hasKey(cacheKey)) {\n stream = signal(\n {value: transferState.get(cacheKey, defaultValue)},\n ngDevMode ? createDebugNameObject(this.debugName, 'stream') : undefined,\n );\n }\n }\n\n if (!stream) {\n stream = getInitialStream?.(extRequest.request as R);\n }\n // Clear getInitialStream so it doesn't hold onto memory\n getInitialStream = undefined;\n status = request === undefined ? 'idle' : stream ? 'resolved' : 'loading';\n } else {\n status = request === undefined ? 'idle' : 'loading';\n if (previous.value.extRequest.request === request) {\n stream = previous.value.stream;\n }\n }\n }\n\n return {\n extRequest,\n status,\n previousStatus: previous ? projectStatusOfState(previous.value) : 'idle',\n stream,\n };\n },\n ...(ngDevMode ? createDebugNameObject(debugName, 'state') : undefined),\n });\n\n this.effectRef = effect(this.loadEffect.bind(this), {\n injector,\n manualCleanup: true,\n ...(ngDevMode ? createDebugNameObject(debugName, 'loadEffect') : undefined),\n });\n\n this.pendingTasks = injector.get(PendingTasks);\n\n // Cancel any pending request when the resource itself is destroyed.\n this.unregisterOnDestroy = injector.get(DestroyRef).onDestroy(() => this.destroy());\n\n this.status = computed(\n () => projectStatusOfState(this.state()),\n ngDevMode ? createDebugNameObject(debugName, 'status') : undefined,\n );\n\n this.error = computed(\n () => {\n const stream = this.state().stream?.();\n return stream && !isResolved(stream) ? stream.error : undefined;\n },\n ngDevMode ? createDebugNameObject(debugName, 'error') : undefined,\n );\n }\n\n /**\n * Called either directly via `WritableResource.set` or via `.value.set()`.\n */\n override set(value: T): void {\n if (this.destroyed) {\n return;\n }\n\n const error = untracked(this.error);\n const state = untracked(this.state);\n\n if (!error) {\n const current = untracked(this.value);\n if (\n state.status === 'local' &&\n (this.equal ? this.equal(current, value) : current === value)\n ) {\n return;\n }\n }\n\n // Enter Local state with the user-defined value.\n this.state.set({\n extRequest: state.extRequest,\n status: 'local',\n previousStatus: 'local',\n stream: signal(\n {value},\n ngDevMode ? createDebugNameObject(this.debugName, 'stream') : undefined,\n ),\n });\n\n // We're departing from whatever state the resource was in previously, so cancel any in-progress\n // loading operations.\n this.abortInProgressLoad();\n }\n\n override reload(): boolean {\n // We don't want to restart in-progress loads.\n const {status} = untracked(this.state);\n if (status === 'idle' || status === 'loading') {\n return false;\n }\n\n // Increment the request reload to trigger the `state` linked signal to switch us to `Reload`\n this.extRequest.update(({request, reload}) => ({request, reload: reload + 1}));\n return true;\n }\n\n destroy(): void {\n this.destroyed = true;\n this.unregisterOnDestroy();\n this.effectRef.destroy();\n this.abortInProgressLoad();\n\n // Destroyed resources enter Idle state.\n this.state.set({\n extRequest: {request: undefined, reload: 0},\n status: 'idle',\n previousStatus: 'idle',\n stream: undefined,\n });\n }\n\n private async loadEffect(): Promise<void> {\n const extRequest = this.extRequest();\n\n // Capture the previous status before any state transitions. Note that this is `untracked` since\n // we do not want the effect to depend on the state of the resource, only on the request.\n const {status: currentStatus, previousStatus} = untracked(this.state);\n\n if (extRequest.request === undefined) {\n // Nothing to load (and we should already be in a non-loading state).\n return;\n } else if (currentStatus !== 'loading') {\n // We're not in a loading or reloading state, so this loading request is stale.\n return;\n }\n\n // Cancel any previous loading attempts.\n this.abortInProgressLoad();\n\n // Capturing _this_ load's pending task in a local variable is important here. We may attempt to\n // resolve it twice:\n //\n // 1. when the loading function promise resolves/rejects\n // 2. when cancelling the loading operation\n //\n // After the loading operation is cancelled, `this.resolvePendingTask` no longer represents this\n // particular task, but this `await` may eventually resolve/reject. Thus, when we cancel in\n // response to (1) below, we need to cancel the locally saved task.\n let resolvePendingTask: (() => void) | undefined = (this.resolvePendingTask =\n this.pendingTasks.add());\n\n const {signal: abortSignal} = (this.pendingController = new AbortController());\n\n try {\n // The actual loading is run through `untracked` - only the request side of `resource` is\n // reactive. This avoids any confusion with signals tracking or not tracking depending on\n // which side of the `await` they are.\n const stream = untracked(() => {\n return this.loaderFn({\n params: extRequest.request as Exclude<R, undefined>,\n abortSignal,\n previous: {\n status: previousStatus,\n },\n });\n });\n\n // If this request has been aborted, or the current request no longer\n // matches this load, then we should ignore this resolution.\n const shouldDiscard = () => abortSignal.aborted || untracked(this.extRequest) !== extRequest;\n\n if (isSignal(stream)) {\n if (shouldDiscard()) {\n return;\n }\n\n this.state.set({\n extRequest,\n status: 'resolved',\n previousStatus: 'resolved',\n stream,\n });\n\n const result = untracked(stream);\n if (typeof ngServerMode !== 'undefined' && ngServerMode) {\n saveToTransferState(result, this.transferCacheKey, this.transferState);\n }\n } else {\n const resolvedStream = await stream;\n if (shouldDiscard()) {\n return;\n }\n\n this.state.set({\n extRequest,\n status: 'resolved',\n previousStatus: 'resolved',\n stream: resolvedStream,\n });\n\n // Use a local variable for the result so TypeScript can narrow `resolvedStream` correctly.\n const result = resolvedStream ? untracked(resolvedStream) : undefined;\n if (typeof ngServerMode !== 'undefined' && ngServerMode) {\n saveToTransferState(result, this.transferCacheKey, this.transferState);\n }\n }\n } catch (err) {\n rethrowFatalErrors(err);\n if (abortSignal.aborted || untracked(this.extRequest) !== extRequest) {\n return;\n }\n\n this.state.set({\n extRequest,\n status: 'resolved',\n previousStatus: 'error',\n stream: signal(\n {error: encapsulateResourceError(err)},\n ngDevMode ? createDebugNameObject(this.debugName, 'stream') : undefined,\n ),\n });\n } finally {\n // Resolve the pending task now that the resource has a value.\n resolvePendingTask?.();\n resolvePendingTask = undefined;\n }\n }\n\n private abortInProgressLoad(): void {\n untracked(() => this.pendingController?.abort());\n this.pendingController = undefined;\n\n // Once the load is aborted, we no longer want to block stability on its resolution.\n this.resolvePendingTask?.();\n this.resolvePendingTask = undefined;\n }\n}\n\nfunction saveToTransferState<R, T>(\n result: ResourceStreamItem<T> | undefined,\n transferCacheKey: StateKey<T> | undefined,\n transferState: TransferState | undefined,\n): void {\n if (transferCacheKey && transferState && result && isResolved(result)) {\n transferState.set(transferCacheKey, result.value);\n }\n}\n\n/**\n * Wraps an equality function to handle either value being `undefined`.\n */\nfunction wrapEqualityFn<T>(equal: ValueEqualityFn<T>): ValueEqualityFn<T | undefined> {\n return (a, b) => (a === undefined || b === undefined ? a === b : equal(a, b));\n}\n\nfunction getLoader<T, R>(options: ResourceOptions<T, R>): ResourceStreamingLoader<T, R> {\n if (isStreamingResourceOptions(options)) {\n return options.stream;\n }\n\n return async (params) => {\n try {\n return signal(\n {value: await options.loader(params)},\n ngDevMode ? createDebugNameObject(options.debugName, 'stream') : undefined,\n );\n } catch (err) {\n return signal(\n {error: encapsulateResourceError(err)},\n ngDevMode ? createDebugNameObject(options.debugName, 'stream') : undefined,\n );\n }\n };\n}\n\nfunction isStreamingResourceOptions<T, R>(\n options: ResourceOptions<T, R>,\n): options is StreamingResourceOptions<T, R> {\n return !!(options as StreamingResourceOptions<T, R>).stream;\n}\n\n/**\n * Project from a state with `ResourceInternalStatus` to the user-facing `ResourceStatus`\n */\nfunction projectStatusOfState(state: ResourceState<unknown>): ResourceStatus {\n switch (state.status) {\n case 'loading':\n return state.extRequest.reload === 0 ? 'loading' : 'reloading';\n case 'resolved':\n return isResolved(state.stream!()) ? 'resolved' : 'error';\n default:\n return state.status;\n }\n}\n\nfunction isResolved<T>(state: ResourceStreamItem<T>): state is {value: T} {\n return (state as {error: unknown}).error === undefined;\n}\n\n/**\n * Creates a debug name object for an internal signal.\n */\nfunction createDebugNameObject(\n resourceDebugName: string | undefined,\n internalSignalDebugName: string,\n): {debugName?: string} {\n return {\n debugName: `Resource${resourceDebugName ? '#' + resourceDebugName : ''}.${internalSignalDebugName}`,\n };\n}\n\nexport function encapsulateResourceError(error: unknown): Error {\n if (isErrorLike(error)) {\n return error;\n }\n\n return new ResourceWrappedError(error);\n}\n\nexport function isErrorLike(error: unknown): error is Error {\n return (\n error instanceof Error ||\n (typeof error === 'object' &&\n typeof (error as Error).name === 'string' &&\n typeof (error as Error).message === 'string')\n );\n}\n\nexport class ResourceValueError extends Error {\n constructor(error: Error) {\n super(\n ngDevMode\n ? `Resource is currently in an error state (see Error.cause for details): ${error.message}`\n : error.message,\n {cause: error},\n );\n }\n}\n\nclass ResourceWrappedError extends Error {\n constructor(error: unknown) {\n super(\n ngDevMode\n ? `Resource returned an error that's not an Error instance: ${String(error)}. Check this error's .cause for the actual error.`\n : String(error),\n {cause: error},\n );\n }\n}\n\n/**\n * Chains the value of another resource into the params of the current resource, returning the value\n * of the other resource if it is available, or propagating the status to the current resource if it\n * is not.\n */\nexport function chain<T>(resource: Resource<T>): T {\n switch (resource.status()) {\n case 'idle':\n throw ResourceParamsStatus.IDLE;\n case 'error':\n throw new ResourceDependencyError(resource);\n case 'loading':\n case 'reloading':\n throw ResourceParamsStatus.LOADING;\n }\n return resource.value();\n}\n\nexport const paramsContext: ResourceParamsContext = {\n chain,\n};\n\nlet inParamsFunction = false;\n\nexport function isInParamsFunction() {\n return inParamsFunction;\n}\n\nexport function setInParamsFunction(value: boolean) {\n inParamsFunction = value;\n}\n\nexport function invalidResourceCreationInParams(): Error {\n return new RuntimeError(\n RuntimeErrorCode.INVALID_RESOURCE_CREATION_IN_PARAMS,\n ngDevMode && `Cannot create a resource inside the \\`params\\` of another resource`,\n );\n}\n\nexport function rethrowFatalErrors(error: unknown) {\n if (\n error instanceof RuntimeError &&\n error.code === RuntimeErrorCode.INVALID_RESOURCE_CREATION_IN_PARAMS\n ) {\n throw error;\n }\n}\n"],"names":["OutputEmitterRef","destroyed","listeners","errorHandler","inject","ErrorHandler","optional","destroyRef","DestroyRef","constructor","onDestroy","subscribe","callback","RuntimeError","ngDevMode","push","unsubscribe","idx","indexOf","undefined","splice","emit","value","console","warn","formatRuntimeError","previousConsumer","setActiveConsumer","listenerFn","err","handleError","getOutputDestroyRef","ref","CACHE_ACTIVE","InjectionToken","computed","computation","options","getter","createComputed","equal","debugName","SIGNAL","toString","untracked","nonReactiveReadsFn","untrackedPrimitive","ResourceDependencyError","Error","dependency","cause","error","name","ResourceParamsStatus","_brand","msg","IDLE","LOADING","identityFn","v","linkedSignal","optionsOrComputation","createLinkedSignal","upgradeLinkedSignalGetter","source","node","upgradedGetter","set","newValue","linkedSignalSetFn","update","updateFn","linkedSignalUpdateFn","asReadonly","signalAsReadonlyFn","bind","resource","injector","assertInInjectionContext","oldNameForParams","request","params","ResourceImpl","getLoader","defaultValue","wrapEqualityFn","Injector","id","BaseWritableResource","isLoading","status","createDebugNameObject","isError","isValueDefined","_snapshot","snapshot","hasValue","loaderFn","transferCacheKey","pendingTasks","state","extRequest","effectRef","pendingController","resolvePendingTask","unregisterOnDestroy","transferState","getInitialStream","isInParamsFunction","invalidResourceCreationInParams","streamValue","stream","isResolved","ResourceValueError","cacheState","get","isActive","TransferState","setInParamsFunction","paramsContext","reload","rethrowFatalErrors","previous","signal","encapsulateResourceError","cacheKey","hasKey","previousStatus","projectStatusOfState","effect","loadEffect","manualCleanup","PendingTasks","destroy","current","abortInProgressLoad","currentStatus","add","abortSignal","AbortController","shouldDiscard","aborted","isSignal","result","ngServerMode","saveToTransferState","resolvedStream","abort","a","b","isStreamingResourceOptions","loader","resourceDebugName","internalSignalDebugName","isErrorLike","ResourceWrappedError","message","String","chain","inParamsFunction","code"],"mappings":";;;;;;;;;;MAgCaA,gBAAgB,CAAA;AACnBC,EAAAA,SAAS,GAAG,KAAK;AACjBC,EAAAA,SAAS,GAAqC,IAAI;AAClDC,EAAAA,YAAY,GAAGC,MAAM,CAACC,YAAY,EAAE;AAACC,IAAAA,QAAQ,EAAE;AAAI,GAAC,CAAC;AAG7DC,EAAAA,UAAU,GAAeH,MAAM,CAACI,UAAU,CAAC;AAE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,SAAUzC,mBAAmBA,CAAChG,KAAc,EAAA;AAChDyI,EAAAA,gBAAgB,GAAGzI,KAAK;AAC1B;SAEgBuF,+BAA+BA,GAAA;EAC7C,OAAO,IAAIhG,YAAY,CAAA,GAAA,EAErBC,SAAS,IAAI,oEAAoE,CAClF;AACH;AAEM,SAAU2G,kBAAkBA,CAACtE,KAAc,EAAA;EAC/C,IACEA,KAAK,YAAYtC,YAAY,IAC7BsC,KAAK,CAAC6G,IAAI,KAAA,GAAA,EACV;AACA,IAAA,MAAM7G,KAAK;AACb,EAAA;AACF;;;;"}
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -4,0 +4,0 @@ * License: MIT

@@ -1,1 +0,1 @@

{"version":3,"file":"_untracked-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/linked_signal.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/untracked.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {COMPUTING, ERRORED, UNSET} from './computed';\nimport {defaultEquals, ValueEqualityFn} from './equality';\nimport {\n consumerAfterComputation,\n consumerBeforeComputation,\n producerAccessed,\n producerMarkClean,\n producerUpdateValueVersion,\n REACTIVE_NODE,\n ReactiveNode,\n runPostProducerCreatedFn,\n setActiveConsumer,\n SIGNAL,\n} from './graph';\nimport {signalSetFn, signalUpdateFn} from './signal';\n\n// Required as the signals library is in a separate package, so we need to explicitly ensure the\n// global `ngDevMode` type is defined.\ndeclare const ngDevMode: boolean | undefined;\n\nexport type ComputationFn<S, D> = (source: S, previous?: PreviousValue<S, D>) => D;\nexport type PreviousValue<S, D> = {source: S; value: D};\n\nexport interface LinkedSignalNode<S, D> extends ReactiveNode {\n /**\n * Value of the source signal that was used to derive the computed value.\n */\n sourceValue: S;\n\n /**\n * Current state value, or one of the sentinel values (`UNSET`, `COMPUTING`,\n * `ERROR`).\n */\n value: D;\n\n /**\n * If `value` is `ERRORED`, the error caught from the last computation attempt which will\n * be re-thrown.\n */\n error: unknown;\n\n /**\n * The source function represents reactive dependency based on which the linked state is reset.\n */\n source: () => S;\n\n /**\n * The computation function which will produce a new value based on the source and, optionally - previous values.\n */\n computation: ComputationFn<S, D>;\n\n equal: ValueEqualityFn<D>;\n}\n\nexport type LinkedSignalGetter<S, D> = (() => D) & {\n [SIGNAL]: LinkedSignalNode<S, D>;\n};\n\nexport function createLinkedSignal<S, D>(\n sourceFn: () => S,\n computationFn: ComputationFn<S, D>,\n equalityFn?: ValueEqualityFn<D>,\n): LinkedSignalGetter<S, D> {\n const node: LinkedSignalNode<S, D> = Object.create(LINKED_SIGNAL_NODE);\n\n node.source = sourceFn;\n node.computation = computationFn;\n if (equalityFn != undefined) {\n node.equal = equalityFn;\n }\n\n const linkedSignalGetter = () => {\n // Check if the value needs updating before returning it.\n producerUpdateValueVersion(node);\n\n // Record that someone looked at this signal.\n producerAccessed(node);\n\n if (node.value === ERRORED) {\n throw node.error;\n }\n\n return node.value;\n };\n\n const getter = linkedSignalGetter as LinkedSignalGetter<S, D>;\n getter[SIGNAL] = node;\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n getter.toString = () =>\n `[LinkedSignal${node.debugName ? ' (' + node.debugName + ')' : ''}: ${String(node.value)}]`;\n }\n\n runPostProducerCreatedFn(node);\n\n return getter;\n}\n\nexport function linkedSignalSetFn<S, D>(node: LinkedSignalNode<S, D>, newValue: D) {\n producerUpdateValueVersion(node);\n signalSetFn(node, newValue);\n producerMarkClean(node);\n}\n\nexport function linkedSignalUpdateFn<S, D>(\n node: LinkedSignalNode<S, D>,\n updater: (value: D) => D,\n): void {\n producerUpdateValueVersion(node);\n // update() on a linked signal can't work if the current state is ERRORED, as there's no value.\n if (node.value === ERRORED) {\n throw node.error;\n }\n signalUpdateFn(node, updater);\n producerMarkClean(node);\n}\n\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `LINKED_SIGNAL_NODE` and `REACTIVE_NODE`.\nexport const LINKED_SIGNAL_NODE: Omit<\n LinkedSignalNode<unknown, unknown>,\n 'computation' | 'source' | 'sourceValue'\n> = /* @__PURE__ */ (() => {\n return {\n ...REACTIVE_NODE,\n value: UNSET,\n dirty: true,\n error: null,\n equal: defaultEquals,\n kind: 'linkedSignal',\n\n producerMustRecompute(node: LinkedSignalNode<unknown, unknown>): boolean {\n // Force a recomputation if there's no current value, or if the current value is in the\n // process of being calculated (which should throw an error).\n return node.value === UNSET || node.value === COMPUTING;\n },\n\n producerRecomputeValue(node: LinkedSignalNode<unknown, unknown>): void {\n if (node.value === COMPUTING) {\n // Our computation somehow led to a cyclic read of itself.\n throw new Error(\n typeof ngDevMode !== 'undefined' && ngDevMode ? 'Detected cycle in computations.' : '',\n );\n }\n\n const oldValue = node.value;\n node.value = COMPUTING;\n\n const prevConsumer = consumerBeforeComputation(node);\n let newValue: unknown;\n let wasEqual = false;\n try {\n const newSourceValue = node.source();\n const oldValueValid = oldValue !== UNSET && oldValue !== ERRORED;\n const prev = oldValueValid\n ? {\n source: node.sourceValue,\n value: oldValue,\n }\n : undefined;\n newValue = node.computation(newSourceValue, prev);\n node.sourceValue = newSourceValue;\n // We want to mark this node as errored if calling `equal` throws; however, we don't want\n // to track any reactive reads inside `equal`.\n setActiveConsumer(null);\n wasEqual = oldValueValid && newValue !== ERRORED && node.equal(oldValue, newValue);\n } catch (err) {\n newValue = ERRORED;\n node.error = err;\n } finally {\n consumerAfterComputation(node, prevConsumer);\n }\n\n if (wasEqual) {\n // No change to `valueVersion` - old and new values are\n // semantically equivalent.\n node.value = oldValue;\n return;\n }\n\n node.value = newValue;\n node.version++;\n },\n };\n})();\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {setActiveConsumer} from './graph';\n\n/**\n * Execute an arbitrary function in a non-reactive (non-tracking) context. The executed function\n * can, optionally, return a value.\n */\nexport function untracked<T>(nonReactiveReadsFn: () => T): T {\n const prevConsumer = setActiveConsumer(null);\n // We are not trying to catch any particular errors here, just making sure that the consumers\n // stack is restored in case of errors.\n try {\n return nonReactiveReadsFn();\n } finally {\n setActiveConsumer(prevConsumer);\n }\n}\n"],"names":["createLinkedSignal","sourceFn","computationFn","equalityFn","node","Object","create","LINKED_SIGNAL_NODE","source","computation","undefined","equal","linkedSignalGetter","producerUpdateValueVersion","producerAccessed","value","ERRORED","error","getter","SIGNAL","ngDevMode","toString","debugName","String","runPostProducerCreatedFn","linkedSignalSetFn","newValue","signalSetFn","producerMarkClean","linkedSignalUpdateFn","updater","signalUpdateFn","REACTIVE_NODE","UNSET","dirty","defaultEquals","kind","producerMustRecompute","COMPUTING","producerRecomputeValue","Error","oldValue","prevConsumer","consumerBeforeComputation","wasEqual","newSourceValue","oldValueValid","prev","sourceValue","setActiveConsumer","err","consumerAfterComputation","version","untracked","nonReactiveReadsFn"],"mappings":";;;;;;;;SAkEgBA,kBAAkBA,CAChCC,QAAiB,EACjBC,aAAkC,EAClCC,UAA+B,EAAA;AAE/B,EAAA,MAAMC,IAAI,GAA2BC,MAAM,CAACC,MAAM,CAACC,kBAAkB,CAAC;EAEtEH,IAAI,CAACI,MAAM,GAAGP,QAAQ;EACtBG,IAAI,CAACK,WAAW,GAAGP,aAAa;EAChC,IAAIC,UAAU,IAAIO,SAAS,EAAE;IAC3BN,IAAI,CAACO,KAAK,GAAGR,UAAU;AACzB,EAAA;EAEA,MAAMS,kBAAkB,GAAGA,MAAK;IAE9BC,0BAA0B,CAACT,IAAI,CAAC;IAGhCU,gBAAgB,CAACV,IAAI,CAAC;AAEtB,IAAA,IAAIA,IAAI,CAACW,KAAK,KAAKC,OAAO,EAAE;MAC1B,MAAMZ,IAAI,CAACa,KAAK;A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AK,GAAGiC,GAAG;AAClB,MAAA,CAAA,SAAU;AACRC,QAAAA,wBAAwB,CAAC/C,IAAI,EAAEsC,YAAY,CAAC;AAC9C,MAAA;AAEA,MAAA,IAAIE,QAAQ,EAAE;QAGZxC,IAAI,CAACW,KAAK,GAAG0B,QAAQ;AACrB,QAAA;AACF,MAAA;MAEArC,IAAI,CAACW,KAAK,GAAGW,QAAQ;MACrBtB,IAAI,CAACgD,OAAO,EAAE;AAChB,IAAA;GACD;AACH,CAAC,GAAG;;ACjLE,SAAUC,SAASA,CAAIC,kBAA2B,EAAA;AACtD,EAAA,MAAMZ,YAAY,GAAGO,iBAAiB,CAAC,IAAI,CAAC;EAG5C,IAAI;IACF,OAAOK,kBAAkB,EAAE;AAC7B,EAAA,CAAA,SAAU;IACRL,iBAAiB,CAACP,YAAY,CAAC;AACjC,EAAA;AACF;;;;"}
{"version":3,"file":"_untracked-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/linked_signal.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/untracked.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {COMPUTING, ERRORED, UNSET} from './computed';\nimport {defaultEquals, ValueEqualityFn} from './equality';\nimport {\n consumerAfterComputation,\n consumerBeforeComputation,\n producerAccessed,\n producerMarkClean,\n producerUpdateValueVersion,\n REACTIVE_NODE,\n ReactiveNode,\n runPostProducerCreatedFn,\n setActiveConsumer,\n SIGNAL,\n} from './graph';\nimport {signalSetFn, signalUpdateFn} from './signal';\n\n// Required as the signals library is in a separate package, so we need to explicitly ensure the\n// global `ngDevMode` type is defined.\ndeclare const ngDevMode: boolean | undefined;\n\nexport type ComputationFn<S, D> = (source: S, previous?: PreviousValue<S, D>) => D;\nexport type PreviousValue<S, D> = {source: S; value: D};\n\nexport interface LinkedSignalNode<S, D> extends ReactiveNode {\n /**\n * Value of the source signal that was used to derive the computed value.\n */\n sourceValue: S;\n\n /**\n * Current state value, or one of the sentinel values (`UNSET`, `COMPUTING`,\n * `ERROR`).\n */\n value: D;\n\n /**\n * If `value` is `ERRORED`, the error caught from the last computation attempt which will\n * be re-thrown.\n */\n error: unknown;\n\n /**\n * The source function represents reactive dependency based on which the linked state is reset.\n */\n source: () => S;\n\n /**\n * The computation function which will produce a new value based on the source and, optionally - previous values.\n */\n computation: ComputationFn<S, D>;\n\n equal: ValueEqualityFn<D>;\n}\n\nexport type LinkedSignalGetter<S, D> = (() => D) & {\n [SIGNAL]: LinkedSignalNode<S, D>;\n};\n\nexport function createLinkedSignal<S, D>(\n sourceFn: () => S,\n computationFn: ComputationFn<S, D>,\n equalityFn?: ValueEqualityFn<D>,\n): LinkedSignalGetter<S, D> {\n const node: LinkedSignalNode<S, D> = Object.create(LINKED_SIGNAL_NODE);\n\n node.source = sourceFn;\n node.computation = computationFn;\n if (equalityFn != undefined) {\n node.equal = equalityFn;\n }\n\n const linkedSignalGetter = () => {\n // Check if the value needs updating before returning it.\n producerUpdateValueVersion(node);\n\n // Record that someone looked at this signal.\n producerAccessed(node);\n\n if (node.value === ERRORED) {\n throw node.error;\n }\n\n return node.value;\n };\n\n const getter = linkedSignalGetter as LinkedSignalGetter<S, D>;\n getter[SIGNAL] = node;\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n getter.toString = () =>\n `[LinkedSignal${node.debugName ? ' (' + node.debugName + ')' : ''}: ${String(node.value)}]`;\n }\n\n runPostProducerCreatedFn(node);\n\n return getter;\n}\n\nexport function linkedSignalSetFn<S, D>(node: LinkedSignalNode<S, D>, newValue: D) {\n producerUpdateValueVersion(node);\n signalSetFn(node, newValue);\n producerMarkClean(node);\n}\n\nexport function linkedSignalUpdateFn<S, D>(\n node: LinkedSignalNode<S, D>,\n updater: (value: D) => D,\n): void {\n producerUpdateValueVersion(node);\n // update() on a linked signal can't work if the current state is ERRORED, as there's no value.\n if (node.value === ERRORED) {\n throw node.error;\n }\n signalUpdateFn(node, updater);\n producerMarkClean(node);\n}\n\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `LINKED_SIGNAL_NODE` and `REACTIVE_NODE`.\nexport const LINKED_SIGNAL_NODE: Omit<\n LinkedSignalNode<unknown, unknown>,\n 'computation' | 'source' | 'sourceValue'\n> = /* @__PURE__ */ (() => {\n return {\n ...REACTIVE_NODE,\n value: UNSET,\n dirty: true,\n error: null,\n equal: defaultEquals,\n kind: 'linkedSignal',\n\n producerMustRecompute(node: LinkedSignalNode<unknown, unknown>): boolean {\n // Force a recomputation if there's no current value, or if the current value is in the\n // process of being calculated (which should throw an error).\n return node.value === UNSET || node.value === COMPUTING;\n },\n\n producerRecomputeValue(node: LinkedSignalNode<unknown, unknown>): void {\n if (node.value === COMPUTING) {\n // Our computation somehow led to a cyclic read of itself.\n throw new Error(\n typeof ngDevMode !== 'undefined' && ngDevMode ? 'Detected cycle in computations.' : '',\n );\n }\n\n const oldValue = node.value;\n node.value = COMPUTING;\n\n const prevConsumer = consumerBeforeComputation(node);\n let newValue: unknown;\n let wasEqual = false;\n try {\n const newSourceValue = node.source();\n const oldValueValid = oldValue !== UNSET && oldValue !== ERRORED;\n const prev = oldValueValid\n ? {\n source: node.sourceValue,\n value: oldValue,\n }\n : undefined;\n newValue = node.computation(newSourceValue, prev);\n node.sourceValue = newSourceValue;\n // We want to mark this node as errored if calling `equal` throws; however, we don't want\n // to track any reactive reads inside `equal`.\n setActiveConsumer(null);\n wasEqual = oldValueValid && newValue !== ERRORED && node.equal(oldValue, newValue);\n } catch (err) {\n newValue = ERRORED;\n node.error = err;\n } finally {\n consumerAfterComputation(node, prevConsumer);\n }\n\n if (wasEqual) {\n // No change to `valueVersion` - old and new values are\n // semantically equivalent.\n node.value = oldValue;\n return;\n }\n\n node.value = newValue;\n node.version++;\n },\n };\n})();\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {setActiveConsumer} from './graph';\n\n/**\n * Execute an arbitrary function in a non-reactive (non-tracking) context. The executed function\n * can, optionally, return a value.\n */\nexport function untracked<T>(nonReactiveReadsFn: () => T): T {\n const prevConsumer = setActiveConsumer(null);\n // We are not trying to catch any particular errors here, just making sure that the consumers\n // stack is restored in case of errors.\n try {\n return nonReactiveReadsFn();\n } finally {\n setActiveConsumer(prevConsumer);\n }\n}\n"],"names":["createLinkedSignal","sourceFn","computationFn","equalityFn","node","Object","create","LINKED_SIGNAL_NODE","source","computation","undefined","equal","linkedSignalGetter","producerUpdateValueVersion","producerAccessed","value","ERRORED","error","getter","SIGNAL","ngDevMode","toString","debugName","String","runPostProducerCreatedFn","linkedSignalSetFn","newValue","signalSetFn","producerMarkClean","linkedSignalUpdateFn","updater","signalUpdateFn","REACTIVE_NODE","UNSET","dirty","defaultEquals","kind","producerMustRecompute","COMPUTING","producerRecomputeValue","Error","oldValue","prevConsumer","consumerBeforeComputation","wasEqual","newSourceValue","oldValueValid","prev","sourceValue","setActiveConsumer","err","consumerAfterComputation","version","untracked","nonReactiveReadsFn"],"mappings":";;;;;;;;SAkEgBA,kBAAkBA,CAChCC,QAAiB,EACjBC,aAAkC,EAClCC,UAA+B,EAAA;AAE/B,EAAA,MAAMC,IAAI,GAA2BC,MAAM,CAACC,MAAM,CAACC,kBAAkB,CAAC;EAEtEH,IAAI,CAACI,MAAM,GAAGP,QAAQ;EACtBG,IAAI,CAACK,WAAW,GAAGP,aAAa;EAChC,IAAIC,UAAU,IAAIO,SAAS,EAAE;IAC3BN,IAAI,CAACO,KAAK,GAAGR,UAAU;AACzB,EAAA;EAEA,MAAMS,kBAAkB,GAAGA,MAAK;IAE9BC,0BAA0B,CAACT,IAAI,CAAC;IAGhCU,gBAAgB,CAACV,IAAI,CAAC;AAEtB,IAAA,IAAIA,I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,GAAG,EAAE;AACZxB,QAAAA,QAAQ,GAAGV,OAAO;QAClBZ,IAAI,CAACa,KAAK,GAAGiC,GAAG;AAClB,MAAA,CAAA,SAAU;AACRC,QAAAA,wBAAwB,CAAC/C,IAAI,EAAEsC,YAAY,CAAC;AAC9C,MAAA;AAEA,MAAA,IAAIE,QAAQ,EAAE;QAGZxC,IAAI,CAACW,KAAK,GAAG0B,QAAQ;AACrB,QAAA;AACF,MAAA;MAEArC,IAAI,CAACW,KAAK,GAAGW,QAAQ;MACrBtB,IAAI,CAACgD,OAAO,EAAE;AAChB,IAAA;GACD;AACH,CAAC,GAAG;;ACjLE,SAAUC,SAASA,CAAIC,kBAA2B,EAAA;AACtD,EAAA,MAAMZ,YAAY,GAAGO,iBAAiB,CAAC,IAAI,CAAC;EAG5C,IAAI;IACF,OAAOK,kBAAkB,EAAE;AAC7B,EAAA,CAAA,SAAU;IACRL,iBAAiB,CAACP,YAAY,CAAC;AACjC,EAAA;AACF;;;;"}
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -4,0 +4,0 @@ * License: MIT

@@ -1,1 +0,1 @@

{"version":3,"file":"_weak_ref-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/weak_ref.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nexport function setAlternateWeakRefImpl(impl: unknown) {\n // TODO: remove this function\n}\n"],"names":["setAlternateWeakRefImpl","impl"],"mappings":";;;;;;AAQM,SAAUA,uBAAuBA,CAACC,IAAa,EAAA,CAErD;;;;"}
{"version":3,"file":"_weak_ref-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/weak_ref.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nexport function setAlternateWeakRefImpl(impl: unknown) {\n // TODO: remove this function\n}\n"],"names":["setAlternateWeakRefImpl","impl"],"mappings":";;;;;;AAQM,SAAUA,uBAAuBA,CAACC,IAAa,EAAA,CAErD;;;;"}
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -4,0 +4,0 @@ * License: MIT

@@ -1,1 +0,1 @@

{"version":3,"file":"primitives-di.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/di/src/injection_token.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Type} from './type';\n/**\n * Information about how a type or `InjectionToken` interfaces with the DI\n * system. This describes:\n *\n * 1. *How* the type is provided\n * The declaration must specify only one of the following:\n * - A `value` which is a predefined instance of the type.\n * - A `factory` which defines how to create the given type `T`, possibly\n * requesting injection of other types if necessary.\n * - Neither, in which case the type is expected to already be present in the\n * injector hierarchy. This is used for internal use cases.\n *\n * 2. *Where* the type is stored (if it is stored)\n * - The `providedIn` parameter specifies which injector the type belongs to.\n * - The `token` is used as the key to store the type in the injector.\n */\nexport interface ɵɵInjectableDeclaration<T> {\n /**\n * Specifies that the given type belongs to a particular `Injector`,\n * `NgModule`, or a special scope (e.g. `'root'`).\n *\n * `any` is deprecated and will be removed soon.\n *\n * A value of `null` indicates that the injectable does not belong to any\n * scope, and won't be stored in any injector. For declarations with a\n * factory, this will create a new instance of the type each time it is\n * requested.\n */\n providedIn: Type<any> | 'root' | 'platform' | 'any' | null;\n\n /**\n * The token to which this definition belongs.\n *\n * Note that this may not be the same as the type that the `factory` will create.\n */\n token: unknown;\n\n /**\n * Factory method to execute to create an instance of the injectable.\n */\n factory?: (t?: Type<any>) => T;\n\n /**\n * In a case of no explicit injector, a location where the instance of the injectable is stored.\n */\n value?: T;\n}\n\n/**\n * A `Type` which has a `ɵprov: ɵɵInjectableDeclaration` static field.\n *\n * `InjectableType`s contain their own Dependency Injection metadata and are usable in an\n * `InjectorDef`-based `StaticInjector`.\n *\n * @publicApi\n */\nexport interface InjectionToken<T> {\n ɵprov: ɵɵInjectableDeclaration<T>;\n}\n\nexport function defineInjectable<T>(opts: {\n token: unknown;\n providedIn?: Type<any> | 'root' | 'platform' | 'any' | 'environment' | null;\n factory: () => T;\n}): ɵɵInjectableDeclaration<T> {\n return {\n token: opts.token,\n providedIn: (opts.providedIn as any) || null,\n factory: opts.factory,\n value: undefined,\n } as ɵɵInjectableDeclaration<T>;\n}\n\nexport type Constructor<T> = Function & {prototype: T};\n\nexport function registerInjectable<T>(\n ctor: unknown,\n declaration: ɵɵInjectableDeclaration<T>,\n): InjectionToken<T> {\n (ctor as unknown as InjectionToken<T>).ɵprov = declaration;\n return ctor as Constructor<T> & InjectionToken<T>;\n}\n"],"names":["defineInjectable","opts","token","providedIn","factory","value","undefined","registerInjectable","ctor","declaration","ɵprov"],"mappings":";;;;;;;;AAqEM,SAAUA,gBAAgBA,CAAIC,IAInC,EAAA;EACC,OAAO;IACLC,KAAK,EAAED,IAAI,CAACC,KAAK;AACjBC,IAAAA,UAAU,EAAGF,IAAI,CAACE,UAAkB,IAAI,IAAI;IAC5CC,OAAO,EAAEH,IAAI,CAACG,OAAO;AACrBC,IAAAA,KAAK,EAAEC;GACsB;AACjC;AAIM,SAAUC,kBAAkBA,CAChCC,IAAa,EACbC,WAAuC,EAAA;EAEtCD,IAAqC,CAACE,KAAK,GAAGD,WAAW;AAC1D,EAAA,OAAOD,IAA0C;AACnD;;;;"}
{"version":3,"file":"primitives-di.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/di/src/injection_token.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Type} from './type';\n/**\n * Information about how a type or `InjectionToken` interfaces with the DI\n * system. This describes:\n *\n * 1. *How* the type is provided\n * The declaration must specify only one of the following:\n * - A `value` which is a predefined instance of the type.\n * - A `factory` which defines how to create the given type `T`, possibly\n * requesting injection of other types if necessary.\n * - Neither, in which case the type is expected to already be present in the\n * injector hierarchy. This is used for internal use cases.\n *\n * 2. *Where* the type is stored (if it is stored)\n * - The `providedIn` parameter specifies which injector the type belongs to.\n * - The `token` is used as the key to store the type in the injector.\n */\nexport interface ɵɵInjectableDeclaration<T> {\n /**\n * Specifies that the given type belongs to a particular `Injector`,\n * `NgModule`, or a special scope (e.g. `'root'`).\n *\n * `any` is deprecated and will be removed soon.\n *\n * A value of `null` indicates that the injectable does not belong to any\n * scope, and won't be stored in any injector. For declarations with a\n * factory, this will create a new instance of the type each time it is\n * requested.\n */\n providedIn: Type<any> | 'root' | 'platform' | 'any' | null;\n\n /**\n * The token to which this definition belongs.\n *\n * Note that this may not be the same as the type that the `factory` will create.\n */\n token: unknown;\n\n /**\n * Factory method to execute to create an instance of the injectable.\n */\n factory?: (t?: Type<any>) => T;\n\n /**\n * In a case of no explicit injector, a location where the instance of the injectable is stored.\n */\n value?: T;\n}\n\n/**\n * A `Type` which has a `ɵprov: ɵɵInjectableDeclaration` static field.\n *\n * `InjectableType`s contain their own Dependency Injection metadata and are usable in an\n * `InjectorDef`-based `StaticInjector`.\n *\n * @publicApi\n */\nexport interface InjectionToken<T> {\n ɵprov: ɵɵInjectableDeclaration<T>;\n}\n\nexport function defineInjectable<T>(opts: {\n token: unknown;\n providedIn?: Type<any> | 'root' | 'platform' | 'any' | 'environment' | null;\n factory: () => T;\n}): ɵɵInjectableDeclaration<T> {\n return {\n token: opts.token,\n providedIn: (opts.providedIn as any) || null,\n factory: opts.factory,\n value: undefined,\n } as ɵɵInjectableDeclaration<T>;\n}\n\nexport type Constructor<T> = Function & {prototype: T};\n\nexport function registerInjectable<T>(\n ctor: unknown,\n declaration: ɵɵInjectableDeclaration<T>,\n): InjectionToken<T> {\n (ctor as unknown as InjectionToken<T>).ɵprov = declaration;\n return ctor as Constructor<T> & InjectionToken<T>;\n}\n"],"names":["defineInjectable","opts","token","providedIn","factory","value","undefined","registerInjectable","ctor","declaration","ɵprov"],"mappings":";;;;;;;;AAqEM,SAAUA,gBAAgBA,CAAIC,IAInC,EAAA;EACC,OAAO;IACLC,KAAK,EAAED,IAAI,CAACC,KAAK;AACjBC,IAAAA,UAAU,EAAGF,IAAI,CAACE,UAAkB,IAAI,IAAI;IAC5CC,OAAO,EAAEH,IAAI,CAACG,OAAO;AACrBC,IAAAA,KAAK,EAAEC;GACsB;AACjC;AAIM,SAAUC,kBAAkBA,CAChCC,IAAa,EACbC,WAAuC,EAAA;EAEtCD,IAAqC,CAACE,KAAK,GAAGD,WAAW;AAC1D,EAAA,OAAOD,IAA0C;AACnD;;;;"}
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -4,0 +4,0 @@ * License: MIT

/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -4,0 +4,0 @@ * License: MIT

@@ -1,1 +0,1 @@

{"version":3,"file":"primitives-signals.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/formatter.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/watch.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {SIGNAL} from './graph';\n\n// Only a subset of HTML tags are allowed in the custom formatter JsonML format.\n// See https://firefox-source-docs.mozilla.org/devtools-user/custom_formatters/index.html#html-template-format\ntype AllowedTags = 'span' | 'div' | 'ol' | 'ul' | 'li' | 'table' | 'tr' | 'td';\n\ntype JsonMLText = string;\ntype JsonMLAttrs = Record<string, string>;\ntype JsonMLElement =\n | [tagName: AllowedTags, ...children: (JsonMLNode | JsonMLChild)[]]\n | [tagName: AllowedTags, attrs: JsonMLAttrs, ...children: (JsonMLNode | JsonMLChild)[]];\ntype JsonMLNode = JsonMLText | JsonMLElement;\ntype JsonMLChild = ['object', {object: unknown; config?: unknown}];\ntype JsonML = JsonMLNode;\n\ntype FormatterConfig = unknown & {ngSkipFormatting?: boolean};\n\ndeclare global {\n // We need to use `var` here to be able to declare a global variable.\n // `let` and `const` will be locally scoped to the file.\n // tslint:disable-next-line:no-unused-variable\n var devtoolsFormatters: any[];\n}\n\n/**\n * A custom formatter which renders signals in an easy-to-read format.\n *\n * @see https://firefox-source-docs.mozilla.org/devtools-user/custom_formatters/index.html\n */\n\nconst formatter = {\n /**\n * If the function returns `null`, the formatter is not used for this reference\n */\n header: (sig: any, config: FormatterConfig): JsonML | null => {\n if (!isSignal(sig) || config?.ngSkipFormatting) return null;\n\n let value: unknown;\n try {\n value = sig();\n } catch (e: any) {\n // In case the signal throws, we don't want to break the formatting.\n return ['span', `Signal(⚠️ Error)${e.message ? `: ${e.message}` : ''}`];\n }\n\n const kind = 'computation' in (sig[SIGNAL] as any) ? 'Computed' : 'Signal';\n\n const isPrimitive = value === null || (!Array.isArray(value) && typeof value !== 'object');\n\n return [\n 'span',\n {},\n ['span', {}, `${kind}(`],\n (() => {\n if (isSignal(value)) {\n // Recursively call formatter. Could return an `object` to call the formatter through DevTools,\n // but then recursive signals will render multiple expando arrows which is an awkward UX.\n return formatter.header(value, config)!;\n } else if (isPrimitive && value !== undefined && typeof value !== 'function') {\n // Use built-in rendering for primitives which applies standard syntax highlighting / theming.\n // Can't do this for `undefined` however, as the browser thinks we forgot to provide an object.\n // Also don't want to do this for functions which render nested expando arrows.\n return ['object', {object: value}];\n } else {\n return prettifyPreview(value as Record<string | number | symbol, unknown>);\n }\n })(),\n ['span', {}, `)`],\n ];\n },\n\n hasBody: (sig: any, config: FormatterConfig) => {\n if (!isSignal(sig)) return false;\n\n try {\n sig();\n } catch {\n return false;\n }\n return !config?.ngSkipFormatting;\n },\n\n body: (sig: any, config: any): JsonML => {\n // We can use sys colors to fit the current DevTools theme.\n // Those are unfortunately only available on Chromium-based browsers.\n // On Firefow we fall back to the default color\n const color = 'var(--sys-color-primary)';\n\n return [\n 'div',\n {style: `background: #FFFFFF10; padding-left: 4px; padding-top: 2px; padding-bottom: 2px;`},\n ['div', {style: `color: ${color}`}, 'Signal value: '],\n ['div', {style: `padding-left: .5rem;`}, ['object', {object: sig(), config}]],\n ['div', {style: `color: ${color}`}, 'Signal function: '],\n [\n 'div',\n {style: `padding-left: .5rem;`},\n ['object', {object: sig, config: {...config, ngSkipFormatting: true}}],\n ],\n ];\n },\n};\n\nfunction prettifyPreview(\n value: Record<string | number | symbol, unknown> | Array<unknown> | undefined,\n): string | JsonMLChild {\n if (value === null) return 'null';\n if (Array.isArray(value)) return `Array(${value.length})`;\n if (value instanceof Element) return `<${value.tagName.toLowerCase()}>`;\n if (value instanceof URL) return `URL`;\n\n switch (typeof value) {\n case 'undefined': {\n return 'undefined';\n }\n case 'function': {\n if ('prototype' in value) {\n // This is what Chrome renders, can't use `object` though because it creates a nested expando arrow.\n return 'class';\n } else {\n return '() => {…}';\n }\n }\n case 'object': {\n if (value.constructor.name === 'Object') {\n return '{…}';\n } else {\n return `${value.constructor.name} {}`;\n }\n }\n default: {\n return ['object', {object: value, config: {ngSkipFormatting: true}}];\n }\n }\n}\n\nfunction isSignal(value: any): boolean {\n return value[SIGNAL] !== undefined;\n}\n\n/**\n * Installs the custom formatter into custom formatting on Signals in the devtools.\n *\n * Supported by both Chrome and Firefox.\n *\n * @see https://firefox-source-docs.mozilla.org/devtools-user/custom_formatters/index.html\n */\nexport function installDevToolsSignalFormatter() {\n globalThis.devtoolsFormatters ??= [];\n if (!globalThis.devtoolsFormatters.some((f: any) => f === formatter)) {\n globalThis.devtoolsFormatters.push(formatter);\n }\n}\n\n// This fixes the RollupError: Exported variable \"global\" is not defined.\nexport {};\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n consumerAfterComputation,\n consumerBeforeComputation,\n consumerDestroy,\n consumerMarkDirty,\n consumerPollProducersForChange,\n isInNotificationPhase,\n REACTIVE_NODE,\n ReactiveNode,\n SIGNAL,\n} from './graph';\n\n// Required as the signals library is in a separate package, so we need to explicitly ensure the\n// global `ngDevMode` type is defined.\ndeclare const ngDevMode: boolean | undefined;\n\n/**\n * A cleanup function that can be optionally registered from the watch logic. If registered, the\n * cleanup logic runs before the next watch execution.\n */\nexport type WatchCleanupFn = () => void;\n\n/**\n * A callback passed to the watch function that makes it possible to register cleanup logic.\n */\nexport type WatchCleanupRegisterFn = (cleanupFn: WatchCleanupFn) => void;\n\nexport interface Watch {\n notify(): void;\n\n /**\n * Execute the reactive expression in the context of this `Watch` consumer.\n *\n * Should be called by the user scheduling algorithm when the provided\n * `schedule` hook is called by `Watch`.\n */\n run(): void;\n\n cleanup(): void;\n\n /**\n * Destroy the watcher:\n * - disconnect it from the reactive graph;\n * - mark it as destroyed so subsequent run and notify operations are noop.\n */\n destroy(): void;\n\n [SIGNAL]: WatchNode;\n}\nexport interface WatchNode extends ReactiveNode {\n fn: ((onCleanup: WatchCleanupRegisterFn) => void) | null;\n schedule: ((watch: Watch) => void) | null;\n cleanupFn: WatchCleanupFn;\n ref: Watch;\n}\n\nexport function createWatch(\n fn: (onCleanup: WatchCleanupRegisterFn) => void,\n schedule: (watch: Watch) => void,\n allowSignalWrites: boolean,\n): Watch {\n const node: WatchNode = Object.create(WATCH_NODE);\n if (allowSignalWrites) {\n node.consumerAllowSignalWrites = true;\n }\n\n node.fn = fn;\n node.schedule = schedule;\n\n const registerOnCleanup = (cleanupFn: WatchCleanupFn) => {\n node.cleanupFn = cleanupFn;\n };\n\n function isWatchNodeDestroyed(node: WatchNode) {\n return node.fn === null && node.schedule === null;\n }\n\n function destroyWatchNode(node: WatchNode) {\n if (!isWatchNodeDestroyed(node)) {\n consumerDestroy(node); // disconnect watcher from the reactive graph\n node.cleanupFn();\n\n // nullify references to the integration functions to mark node as destroyed\n node.fn = null;\n node.schedule = null;\n node.cleanupFn = NOOP_CLEANUP_FN;\n }\n }\n\n const run = () => {\n if (node.fn === null) {\n // trying to run a destroyed watch is noop\n return;\n }\n\n if (isInNotificationPhase()) {\n throw new Error(\n typeof ngDevMode !== 'undefined' && ngDevMode\n ? 'Schedulers cannot synchronously execute watches while scheduling.'\n : '',\n );\n }\n\n node.dirty = false;\n if (node.version > 0 && !consumerPollProducersForChange(node)) {\n return;\n }\n node.version++;\n\n const prevConsumer = consumerBeforeComputation(node);\n try {\n node.cleanupFn();\n node.cleanupFn = NOOP_CLEANUP_FN;\n node.fn(registerOnCleanup);\n } finally {\n consumerAfterComputation(node, prevConsumer);\n }\n };\n\n node.ref = {\n notify: () => consumerMarkDirty(node),\n run,\n cleanup: () => node.cleanupFn(),\n destroy: () => destroyWatchNode(node),\n [SIGNAL]: node,\n };\n\n return node.ref;\n}\n\nconst NOOP_CLEANUP_FN: WatchCleanupFn = () => {};\n\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.\nconst WATCH_NODE: Omit<WatchNode, 'fn' | 'schedule' | 'ref'> = /* @__PURE__ */ (() => {\n return {\n ...REACTIVE_NODE,\n consumerIsAlwaysLive: true,\n consumerAllowSignalWrites: false,\n consumerMarkedDirty: (node: WatchNode) => {\n if (node.schedule !== null) {\n node.schedule(node.ref);\n }\n },\n cleanupFn: NOOP_CLEANUP_FN,\n };\n})();\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {installDevToolsSignalFormatter} from './src/formatter';\n\nexport {ComputedNode, createComputed} from './src/computed';\nexport {\n ComputationFn,\n LinkedSignalNode,\n LinkedSignalGetter,\n PreviousValue,\n createLinkedSignal,\n linkedSignalSetFn,\n linkedSignalUpdateFn,\n} from './src/linked_signal';\nexport {ValueEqualityFn, defaultEquals} from './src/equality';\nexport {setThrowInvalidWriteToSignalError} from './src/errors';\nexport {\n REACTIVE_NODE,\n Reactive,\n ReactiveHookFn,\n ReactiveNode,\n ReactiveNodeKind,\n SIGNAL,\n consumerAfterComputation,\n consumerBeforeComputation,\n consumerDestroy,\n consumerMarkDirty,\n consumerPollProducersForChange,\n finalizeConsumerAfterComputation,\n getActiveConsumer,\n isInNotificationPhase,\n isReactive,\n producerAccessed,\n producerIncrementEpoch,\n producerMarkClean,\n producerNotifyConsumers,\n producerUpdateValueVersion,\n producerUpdatesAllowed,\n resetConsumerBeforeComputation,\n runPostProducerCreatedFn,\n setActiveConsumer,\n setPostProducerCreatedFn,\n Version,\n} from './src/graph';\nexport {\n SIGNAL_NODE,\n SignalGetter,\n SignalNode,\n createSignal,\n runPostSignalSetFn,\n setPostSignalSetFn,\n signalGetFn,\n signalSetFn,\n signalUpdateFn,\n} from './src/signal';\nexport {Watch, WatchCleanupFn, WatchCleanupRegisterFn, createWatch} from './src/watch';\nexport {setAlternateWeakRefImpl} from './src/weak_ref';\nexport {untracked} from './src/untracked';\nexport {runEffect, BASE_EFFECT_NODE, BaseEffectNode} from './src/effect';\nexport {installDevToolsSignalFormatter} from './src/formatter';\n\n// Required as the signals library is in a separate package, so we need to explicitly ensure the\n// global `ngDevMode` type is defined.\ndeclare const ngDevMode: boolean | undefined;\n\n// We're using a top-level access to enable signal formatting whenever the signals package is loaded.\n// ngDevMode might not have been init correctly yet, checking for `undefined` ensures that in case\n// it is not defined yet, we still install the formatter.\nif (typeof ngDevMode === 'undefined' || ngDevMode) {\n // tslint:disable-next-line: no-toplevel-property-access\n installDevToolsSignalFormatter();\n}\n"],"names":["formatter","header","sig","config","isSignal","ngSkipFormatting","value","e","message","kind","SIGNAL","isPrimitive","Array","isArray","undefined","object","prettifyPreview","hasBody","body","color","style","length","Element","tagName","toLowerCase","URL","constructor","name","installDevToolsSignalFormatter","globalThis","devtoolsFormatters","some","f","push","createWatch","fn","schedule","allowSignalWrites","node","Object","create","WATCH_NODE","consumerAllowSignalWrites","registerOnCleanup","cleanupFn","isWatchNodeDestroyed","destroyWatchNode","consumerDestroy","NOOP_CLEANUP_FN","run","isInNotificationPhase","Error","ngDevMode","dirty","version","consumerPollProducersForChange","prevConsumer","consumerBeforeComputation","consumerAfterComputation","ref","notify","consumerMarkDirty","cleanup","destroy","REACTIVE_NODE","consumerIsAlwaysLive","consumerMarkedDirty"],"mappings":";;;;;;;;;;;AAsCA,MAAMA,SAAS,GAAG;AAIhBC,EAAAA,MAAM,EAAEA,CAACC,GAAQ,EAAEC,MAAuB,KAAmB;IAC3D,IAAI,CAACC,QAAQ,CAACF,GAAG,CAAC,IAAIC,MAAM,EAAEE,gBAAgB,EAAE,OAAO,IAAI;AAE3D,IAAA,IAAIC,KAAc;IAClB,IAAI;MACFA,KAAK,GAAGJ,GAAG,EAAE;IACf,CAAA,CAAE,OAAOK,CAAM,EAAE;AAEf,MAAA,OAAO,CAAC,MAAM,EAAE,CAAA,gBAAA,EAAmBA,CAAC,CAACC,OAAO,GAAG,CAAA,EAAA,EAAKD,CAAC,CAACC,OAAO,CAAA,CAAE,GAAG,EAAE,EAAE,CAAC;AACzE,IAAA;IAEA,MAAMC,IAAI,GAAG,aAAa,IAAKP,GAAG,CAACQ,MAAM,CAAS,GAAG,UAAU,GAAG,QAAQ;AAE1E,IAAA,MAAMC,WAAW,GAAGL,KAAK,KAAK,IAAI,IAAK,CAACM,KAAK,CAACC,OAAO,CAACP,KAAK,CAAC,IAAI,OAAOA,KAAK,KAAK,QAAS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I,CAAC;AACrC,IAAA,CAAC5B,MAAM,GAAG4B;GACX;EAED,OAAOA,IAAI,CAACqB,GAAG;AACjB;AAEA,MAAMX,eAAe,GAAmBA,MAAK,CAAE,CAAC;AAIhD,MAAMP,UAAU,kBAA+D,CAAC,MAAK;EACnF,OAAO;AACL,IAAA,GAAGuB,aAAa;AAChBC,IAAAA,oBAAoB,EAAE,IAAI;AAC1BvB,IAAAA,yBAAyB,EAAE,KAAK;IAChCwB,mBAAmB,EAAG5B,IAAe,IAAI;AACvC,MAAA,IAAIA,IAAI,CAACF,QAAQ,KAAK,IAAI,EAAE;AAC1BE,QAAAA,IAAI,CAACF,QAAQ,CAACE,IAAI,CAACqB,GAAG,CAAC;AACzB,MAAA;IACF,CAAC;AACDf,IAAAA,SAAS,EAAEI;GACZ;AACH,CAAC,GAAG;;AChFJ,IAAI,OAAOI,SAAS,KAAK,WAAW,IAAIA,SAAS,EAAE;AAEjDxB,EAAAA,8BAA8B,EAAE;AAClC;;;;"}
{"version":3,"file":"primitives-signals.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/formatter.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/src/watch.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/primitives/signals/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {SIGNAL} from './graph';\n\n// Only a subset of HTML tags are allowed in the custom formatter JsonML format.\n// See https://firefox-source-docs.mozilla.org/devtools-user/custom_formatters/index.html#html-template-format\ntype AllowedTags = 'span' | 'div' | 'ol' | 'ul' | 'li' | 'table' | 'tr' | 'td';\n\ntype JsonMLText = string;\ntype JsonMLAttrs = Record<string, string>;\ntype JsonMLElement =\n | [tagName: AllowedTags, ...children: (JsonMLNode | JsonMLChild)[]]\n | [tagName: AllowedTags, attrs: JsonMLAttrs, ...children: (JsonMLNode | JsonMLChild)[]];\ntype JsonMLNode = JsonMLText | JsonMLElement;\ntype JsonMLChild = ['object', {object: unknown; config?: unknown}];\ntype JsonML = JsonMLNode;\n\ntype FormatterConfig = unknown & {ngSkipFormatting?: boolean};\n\ndeclare global {\n // We need to use `var` here to be able to declare a global variable.\n // `let` and `const` will be locally scoped to the file.\n // tslint:disable-next-line:no-unused-variable\n var devtoolsFormatters: any[];\n}\n\n/**\n * A custom formatter which renders signals in an easy-to-read format.\n *\n * @see https://firefox-source-docs.mozilla.org/devtools-user/custom_formatters/index.html\n */\n\nconst formatter = {\n /**\n * If the function returns `null`, the formatter is not used for this reference\n */\n header: (sig: any, config: FormatterConfig): JsonML | null => {\n if (!isSignal(sig) || config?.ngSkipFormatting) return null;\n\n let value: unknown;\n try {\n value = sig();\n } catch (e: any) {\n // In case the signal throws, we don't want to break the formatting.\n return ['span', `Signal(⚠️ Error)${e.message ? `: ${e.message}` : ''}`];\n }\n\n const kind = 'computation' in (sig[SIGNAL] as any) ? 'Computed' : 'Signal';\n\n const isPrimitive = value === null || (!Array.isArray(value) && typeof value !== 'object');\n\n return [\n 'span',\n {},\n ['span', {}, `${kind}(`],\n (() => {\n if (isSignal(value)) {\n // Recursively call formatter. Could return an `object` to call the formatter through DevTools,\n // but then recursive signals will render multiple expando arrows which is an awkward UX.\n return formatter.header(value, config)!;\n } else if (isPrimitive && value !== undefined && typeof value !== 'function') {\n // Use built-in rendering for primitives which applies standard syntax highlighting / theming.\n // Can't do this for `undefined` however, as the browser thinks we forgot to provide an object.\n // Also don't want to do this for functions which render nested expando arrows.\n return ['object', {object: value}];\n } else {\n return prettifyPreview(value as Record<string | number | symbol, unknown>);\n }\n })(),\n ['span', {}, `)`],\n ];\n },\n\n hasBody: (sig: any, config: FormatterConfig) => {\n if (!isSignal(sig)) return false;\n\n try {\n sig();\n } catch {\n return false;\n }\n return !config?.ngSkipFormatting;\n },\n\n body: (sig: any, config: any): JsonML => {\n // We can use sys colors to fit the current DevTools theme.\n // Those are unfortunately only available on Chromium-based browsers.\n // On Firefow we fall back to the default color\n const color = 'var(--sys-color-primary)';\n\n return [\n 'div',\n {style: `background: #FFFFFF10; padding-left: 4px; padding-top: 2px; padding-bottom: 2px;`},\n ['div', {style: `color: ${color}`}, 'Signal value: '],\n ['div', {style: `padding-left: .5rem;`}, ['object', {object: sig(), config}]],\n ['div', {style: `color: ${color}`}, 'Signal function: '],\n [\n 'div',\n {style: `padding-left: .5rem;`},\n ['object', {object: sig, config: {...config, ngSkipFormatting: true}}],\n ],\n ];\n },\n};\n\nfunction prettifyPreview(\n value: Record<string | number | symbol, unknown> | Array<unknown> | undefined,\n): string | JsonMLChild {\n if (value === null) return 'null';\n if (Array.isArray(value)) return `Array(${value.length})`;\n if (value instanceof Element) return `<${value.tagName.toLowerCase()}>`;\n if (value instanceof URL) return `URL`;\n\n switch (typeof value) {\n case 'undefined': {\n return 'undefined';\n }\n case 'function': {\n if ('prototype' in value) {\n // This is what Chrome renders, can't use `object` though because it creates a nested expando arrow.\n return 'class';\n } else {\n return '() => {…}';\n }\n }\n case 'object': {\n if (value.constructor.name === 'Object') {\n return '{…}';\n } else {\n return `${value.constructor.name} {}`;\n }\n }\n default: {\n return ['object', {object: value, config: {ngSkipFormatting: true}}];\n }\n }\n}\n\nfunction isSignal(value: any): boolean {\n return value[SIGNAL] !== undefined;\n}\n\n/**\n * Installs the custom formatter into custom formatting on Signals in the devtools.\n *\n * Supported by both Chrome and Firefox.\n *\n * @see https://firefox-source-docs.mozilla.org/devtools-user/custom_formatters/index.html\n */\nexport function installDevToolsSignalFormatter() {\n globalThis.devtoolsFormatters ??= [];\n if (!globalThis.devtoolsFormatters.some((f: any) => f === formatter)) {\n globalThis.devtoolsFormatters.push(formatter);\n }\n}\n\n// This fixes the RollupError: Exported variable \"global\" is not defined.\nexport {};\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n consumerAfterComputation,\n consumerBeforeComputation,\n consumerDestroy,\n consumerMarkDirty,\n consumerPollProducersForChange,\n isInNotificationPhase,\n REACTIVE_NODE,\n ReactiveNode,\n SIGNAL,\n} from './graph';\n\n// Required as the signals library is in a separate package, so we need to explicitly ensure the\n// global `ngDevMode` type is defined.\ndeclare const ngDevMode: boolean | undefined;\n\n/**\n * A cleanup function that can be optionally registered from the watch logic. If registered, the\n * cleanup logic runs before the next watch execution.\n */\nexport type WatchCleanupFn = () => void;\n\n/**\n * A callback passed to the watch function that makes it possible to register cleanup logic.\n */\nexport type WatchCleanupRegisterFn = (cleanupFn: WatchCleanupFn) => void;\n\nexport interface Watch {\n notify(): void;\n\n /**\n * Execute the reactive expression in the context of this `Watch` consumer.\n *\n * Should be called by the user scheduling algorithm when the provided\n * `schedule` hook is called by `Watch`.\n */\n run(): void;\n\n cleanup(): void;\n\n /**\n * Destroy the watcher:\n * - disconnect it from the reactive graph;\n * - mark it as destroyed so subsequent run and notify operations are noop.\n */\n destroy(): void;\n\n [SIGNAL]: WatchNode;\n}\nexport interface WatchNode extends ReactiveNode {\n fn: ((onCleanup: WatchCleanupRegisterFn) => void) | null;\n schedule: ((watch: Watch) => void) | null;\n cleanupFn: WatchCleanupFn;\n ref: Watch;\n}\n\nexport function createWatch(\n fn: (onCleanup: WatchCleanupRegisterFn) => void,\n schedule: (watch: Watch) => void,\n allowSignalWrites: boolean,\n): Watch {\n const node: WatchNode = Object.create(WATCH_NODE);\n if (allowSignalWrites) {\n node.consumerAllowSignalWrites = true;\n }\n\n node.fn = fn;\n node.schedule = schedule;\n\n const registerOnCleanup = (cleanupFn: WatchCleanupFn) => {\n node.cleanupFn = cleanupFn;\n };\n\n function isWatchNodeDestroyed(node: WatchNode) {\n return node.fn === null && node.schedule === null;\n }\n\n function destroyWatchNode(node: WatchNode) {\n if (!isWatchNodeDestroyed(node)) {\n consumerDestroy(node); // disconnect watcher from the reactive graph\n node.cleanupFn();\n\n // nullify references to the integration functions to mark node as destroyed\n node.fn = null;\n node.schedule = null;\n node.cleanupFn = NOOP_CLEANUP_FN;\n }\n }\n\n const run = () => {\n if (node.fn === null) {\n // trying to run a destroyed watch is noop\n return;\n }\n\n if (isInNotificationPhase()) {\n throw new Error(\n typeof ngDevMode !== 'undefined' && ngDevMode\n ? 'Schedulers cannot synchronously execute watches while scheduling.'\n : '',\n );\n }\n\n node.dirty = false;\n if (node.version > 0 && !consumerPollProducersForChange(node)) {\n return;\n }\n node.version++;\n\n const prevConsumer = consumerBeforeComputation(node);\n try {\n node.cleanupFn();\n node.cleanupFn = NOOP_CLEANUP_FN;\n node.fn(registerOnCleanup);\n } finally {\n consumerAfterComputation(node, prevConsumer);\n }\n };\n\n node.ref = {\n notify: () => consumerMarkDirty(node),\n run,\n cleanup: () => node.cleanupFn(),\n destroy: () => destroyWatchNode(node),\n [SIGNAL]: node,\n };\n\n return node.ref;\n}\n\nconst NOOP_CLEANUP_FN: WatchCleanupFn = () => {};\n\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.\nconst WATCH_NODE: Omit<WatchNode, 'fn' | 'schedule' | 'ref'> = /* @__PURE__ */ (() => {\n return {\n ...REACTIVE_NODE,\n consumerIsAlwaysLive: true,\n consumerAllowSignalWrites: false,\n consumerMarkedDirty: (node: WatchNode) => {\n if (node.schedule !== null) {\n node.schedule(node.ref);\n }\n },\n cleanupFn: NOOP_CLEANUP_FN,\n };\n})();\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {installDevToolsSignalFormatter} from './src/formatter';\n\nexport {ComputedNode, createComputed} from './src/computed';\nexport {\n ComputationFn,\n LinkedSignalNode,\n LinkedSignalGetter,\n PreviousValue,\n createLinkedSignal,\n linkedSignalSetFn,\n linkedSignalUpdateFn,\n} from './src/linked_signal';\nexport {ValueEqualityFn, defaultEquals} from './src/equality';\nexport {setThrowInvalidWriteToSignalError} from './src/errors';\nexport {\n REACTIVE_NODE,\n Reactive,\n ReactiveHookFn,\n ReactiveNode,\n ReactiveNodeKind,\n SIGNAL,\n consumerAfterComputation,\n consumerBeforeComputation,\n consumerDestroy,\n consumerMarkDirty,\n consumerPollProducersForChange,\n finalizeConsumerAfterComputation,\n getActiveConsumer,\n isInNotificationPhase,\n isReactive,\n producerAccessed,\n producerIncrementEpoch,\n producerMarkClean,\n producerNotifyConsumers,\n producerUpdateValueVersion,\n producerUpdatesAllowed,\n resetConsumerBeforeComputation,\n runPostProducerCreatedFn,\n setActiveConsumer,\n setPostProducerCreatedFn,\n Version,\n} from './src/graph';\nexport {\n SIGNAL_NODE,\n SignalGetter,\n SignalNode,\n createSignal,\n runPostSignalSetFn,\n setPostSignalSetFn,\n signalGetFn,\n signalSetFn,\n signalUpdateFn,\n} from './src/signal';\nexport {Watch, WatchCleanupFn, WatchCleanupRegisterFn, createWatch} from './src/watch';\nexport {setAlternateWeakRefImpl} from './src/weak_ref';\nexport {untracked} from './src/untracked';\nexport {runEffect, BASE_EFFECT_NODE, BaseEffectNode} from './src/effect';\nexport {installDevToolsSignalFormatter} from './src/formatter';\n\n// Required as the signals library is in a separate package, so we need to explicitly ensure the\n// global `ngDevMode` type is defined.\ndeclare const ngDevMode: boolean | undefined;\n\n// We're using a top-level access to enable signal formatting whenever the signals package is loaded.\n// ngDevMode might not have been init correctly yet, checking for `undefined` ensures that in case\n// it is not defined yet, we still install the formatter.\nif (typeof ngDevMode === 'undefined' || ngDevMode) {\n // tslint:disable-next-line: no-toplevel-property-access\n installDevToolsSignalFormatter();\n}\n"],"names":["formatter","header","sig","config","isSignal","ngSkipFormatting","value","e","message","kind","SIGNAL","isPrimitive","Array","isArray","undefined","object","prettifyPreview","hasBody","body","color","style","length","Element","tagName","toLowerCase","URL","constructor","name","installDevToolsSignalFormatter","globalThis","devtoolsFormatters","some","f","push","createWatch","fn","schedule","allowSignalWrites","node","Object","create","WATCH_NODE","consumerAllowSignalWrites","registerOnCleanup","cleanupFn","isWatchNodeDestroyed","destroyWatchNode","consumerDestroy","NOOP_CLEANUP_FN","run","isInNotificationPhase","Error","ngDevMode","dirty","version","consumerPollProducersForChange","prevConsumer","consumerBeforeComputation","consumerAfterComputation","ref","notify","consumerMarkDirty","cleanup","destroy","REACTIVE_NODE","consumerIsAlwaysLive","consumerMarkedDirty"],"mappings":";;;;;;;;;;;AAsCA,MAAMA,SAAS,GAAG;AAIhBC,EAAAA,MAAM,EAAEA,CAACC,GAAQ,EAAEC,MAAuB,KAAmB;IAC3D,IAAI,CAACC,QAAQ,CAACF,GAAG,CAAC,IAAIC,MAAM,EAAEE,gBAAgB,EAAE,OAAO,IAAI;AAE3D,IAAA,IAAIC,KAAc;IAClB,IAAI;MACFA,KAAK,GAAGJ,GAAG,EAAE;IACf,CAAA,CAAE,OAAOK,CAAM,EAAE;AAEf,MAAA,OAAO,CAAC,MAAM,EAAE,CAAA,gBAAA,EAAmBA,CAAC,CAACC,OAAO,GAAG,CAAA,EAAA,EAAKD,CAAC,CAACC,OAAO,CAAA,CAAE,GAAG,EAAE,EAAE,CAAC;AACzE,IAAA;IAEA,MAAMC,IAAI,GAAG,aAAa,IAAKP,GAAG,CAACQ,MAAM,CAAS,GAAG,UAAU,GAAG,QAAQ;AAE1E,IAAA,MAAMC,WAAW,GAAGL,KAAK,KAAK,IAAI,IAAK,CAACM,KAAK,CAACC,OAAO,CAACP,KAAK,CAAC,IAAI,OAAOA,KAAK,KAAK,QAAS;AAE1F,IAAA,OAAO,CACL,MAAM,EACN,EAAE,EACF,CAAC,MAAM,EAAE,EAAE,EAAE,CAAA,EAAGG,IAAI,GAAG,CAAC,EACxB,CAAC,MAAK;AACJ,MAAA,IAAIL,QAAQ,CAACE,KAAK,CAAC,EAAE;AAGnB,QAAA,OAAON,SAAS,CAACC,MAAM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BC,IAAAA,oBAAoB,EAAE,IAAI;AAC1BvB,IAAAA,yBAAyB,EAAE,KAAK;IAChCwB,mBAAmB,EAAG5B,IAAe,IAAI;AACvC,MAAA,IAAIA,IAAI,CAACF,QAAQ,KAAK,IAAI,EAAE;AAC1BE,QAAAA,IAAI,CAACF,QAAQ,CAACE,IAAI,CAACqB,GAAG,CAAC;AACzB,MAAA;IACF,CAAC;AACDf,IAAAA,SAAS,EAAEI;GACZ;AACH,CAAC,GAAG;;AChFJ,IAAI,OAAOI,SAAS,KAAK,WAAW,IAAIA,SAAS,EAAE;AAEjDxB,EAAAA,8BAA8B,EAAE;AAClC;;;;"}
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -4,0 +4,0 @@ * License: MIT

@@ -1,1 +0,1 @@

{"version":3,"file":"rxjs-interop.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/rxjs-interop/src/take_until_destroyed.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/rxjs-interop/src/output_from_observable.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/rxjs-interop/src/output_to_observable.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/rxjs-interop/src/to_observable.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/rxjs-interop/src/to_signal.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/rxjs-interop/src/pending_until_event.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/core/rxjs-interop/src/rx_resource.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {assertInInjectionContext, DestroyRef, inject} from '../../src/core';\nimport {MonoTypeOperatorFunction, Observable} from 'rxjs';\nimport {takeUntil} from 'rxjs/operators';\n\n/**\n * Operator which completes the Observable when the calling context (component, directive, service,\n * etc) is destroyed.\n *\n * @param destroyRef optionally, the `DestroyRef` representing the current context. This can be\n * passed explicitly to use `takeUntilDestroyed` outside of an [injection\n * context](guide/di/dependency-injection-context). Otherwise, the current `DestroyRef` is injected.\n *\n * @see [Unsubscribing with takeUntilDestroyed](ecosystem/rxjs-interop/take-until-destroyed)\n *\n * @publicApi 19.0\n */\nexport function takeUntilDestroyed<T>(destroyRef?: DestroyRef): MonoTypeOperatorFunction<T> {\n if (!destroyRef) {\n ngDevMode && assertInInjectionContext(takeUntilDestroyed);\n destroyRef = inject(DestroyRef);\n }\n\n const destroyed$ = new Observable<void>((subscriber) => {\n if (destroyRef.destroyed) {\n subscriber.next();\n return;\n }\n const unregisterFn = destroyRef.onDestroy(subscriber.next.bind(subscriber));\n return unregisterFn;\n });\n\n return <T>(source: Observable<T>) => {\n return source.pipe(takeUntil(destroyed$));\n };\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n assertInInjectionContext,\n DestroyRef,\n inject,\n OutputOptions,\n OutputRef,\n OutputRefSubscription,\n ɵRuntimeError,\n ɵRuntimeErrorCode,\n} from '../../src/core';\nimport {Observable} from 'rxjs';\n\nimport {takeUntilDestroyed} from './take_until_destroyed';\n\n/**\n * Implementation of `OutputRef` that emits values from\n * an RxJS observable source.\n *\n * @internal\n */\nclass OutputFromObservableRef<T> implements OutputRef<T> {\n private destroyed = false;\n\n destroyRef = inject(DestroyRef);\n\n constructor(private source: Observable<T>) {\n this.destroyRef.onDestroy(() => {\n this.destroyed = true;\n });\n }\n\n subscribe(callbackFn: (value: T) => void): OutputRefSubscription {\n if (this.destroyed) {\n throw new ɵRuntimeError(\n ɵRuntimeErrorCode.OUTPUT_REF_DESTROYED,\n ngDevMode &&\n 'Unexpected subscription to destroyed `OutputRef`. ' +\n 'The owning directive/component is destroyed.',\n );\n }\n\n // Stop yielding more values when the directive/component is already destroyed.\n const subscription = this.source.pipe(takeUntilDestroyed(this.destroyRef)).subscribe({\n next: (value) => callbackFn(value),\n });\n\n return {\n unsubscribe: () => subscription.unsubscribe(),\n };\n }\n}\n\n/**\n * Declares an Angular output that is using an RxJS observable as a source\n * for events dispatched to parent subscribers.\n *\n * The behavior for an observable as source is defined as followed:\n * 1. New values are forwarded to the Angular output (next notifications).\n * 2. Errors notifications are not handled by Angular. You need to handle these manually.\n * For example by using `catchError`.\n * 3. Completion notifications stop the output from emitting new values.\n *\n * @usageNotes\n * Initialize an output in your directive by declaring a\n * class field and initializing it with the `outputFromObservable()` function.\n *\n * ```ts\n * @Directive({..})\n * export class MyDir {\n * nameChange$ = <some-observable>;\n * nameChange = outputFromObservable(this.nameChange$);\n * }\n * ```\n * @see [RxJS interop with component and directive outputs](ecosystem/rxjs-interop/output-interop)\n *\n * @publicApi 19.0\n */\nexport function outputFromObservable<T>(\n observable: Observable<T>,\n opts?: OutputOptions,\n): OutputRef<T> {\n ngDevMode && assertInInjectionContext(outputFromObservable);\n return new OutputFromObservableRef<T>(observable);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {OutputRef, ɵgetOutputDestroyRef} from '../../src/core';\nimport {Observable} from 'rxjs';\n\n/**\n * Converts an Angular output declared via `output()` or `outputFromObservable()`\n * to an observable.\n * It creates an observable that represents the stream of \"events firing\" in an output.\n *\n * You can subscribe to the output via `Observable.subscribe` then.\n *\n * @see [RxJS interop with component and directive outputs](ecosystem/rxjs-interop/output-interop)\n *\n * @publicApi 19.0\n */\nexport function outputToObservable<T>(ref: OutputRef<T>): Observable<T> {\n const destroyRef = ɵgetOutputDestroyRef(ref);\n\n return new Observable<T>((observer) => {\n // Complete the observable upon directive/component destroy.\n // Note: May be `undefined` if an `EventEmitter` is declared outside\n // of an injection context.\n const unregisterOnDestroy = destroyRef?.onDestroy(() => observer.complete());\n\n const subscription = ref.subscribe((v) => observer.next(v));\n return () => {\n subscription.unsubscribe();\n unregisterOnDestroy?.();\n };\n });\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n assertInInjectionContext,\n DestroyRef,\n effect,\n inject,\n Injector,\n Signal,\n untracked,\n} from '../../src/core';\nimport {Observable, ReplaySubject} from 'rxjs';\n\n/**\n * Options for `toObservable`.\n *\n * @publicApi 20.0\n */\nexport interface ToObservableOptions {\n /**\n * The `Injector` to use when creating the underlying `effect` which watches the signal.\n *\n * If this isn't specified, the current [injection context](guide/di/dependency-injection-context)\n * will be used.\n */\n injector?: Injector;\n}\n\n/**\n * Exposes the value of an Angular `Signal` as an RxJS `Observable`.\n * As it reflects a state, the observable will always emit the latest value upon subscription.\n *\n * The signal's value will be propagated into the `Observable`'s subscribers using an `effect`.\n *\n * `toObservable` must be called in an injection context unless an injector is provided via options.\n *\n * @see [RxJS interop with Angular signals](ecosystem/rxjs-interop)\n * @see [Create an RxJS Observable from a signal with toObservable](ecosystem/rxjs-interop#create-an-rxjs-observable-from-a-signal-with-toobservable)\n *\n * @publicApi 20.0\n */\nexport function toObservable<T>(source: Signal<T>, options?: ToObservableOptions): Observable<T> {\n if (ngDevMode && !options?.injector) {\n assertInInjectionContext(toObservable);\n }\n const injector = options?.injector ?? inject(Injector);\n const subject = new ReplaySubject<T>(1);\n\n const watcher = effect(\n () => {\n let value: T;\n try {\n value = source();\n } catch (err) {\n untracked(() => subject.error(err));\n return;\n }\n untracked(() => subject.next(value));\n },\n {injector, manualCleanup: true},\n );\n\n injector.get(DestroyRef).onDestroy(() => {\n watcher.destroy();\n subject.complete();\n });\n\n return subject.asObservable();\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n assertInInjectionContext,\n assertNotInReactiveContext,\n computed,\n DestroyRef,\n inject,\n Injector,\n signal,\n Signal,\n WritableSignal,\n ɵRuntimeError,\n ɵRuntimeErrorCode,\n} from '../../src/core';\nimport {ValueEqualityFn} from '../../primitives/signals';\nimport {Observable, Subscribable} from 'rxjs';\n\n/**\n * Options for `toSignal`.\n *\n * @publicApi 20.0\n */\nexport interface ToSignalOptions<T> {\n /**\n * Initial value for the signal produced by `toSignal`.\n *\n * This will be the value of the signal until the observable emits its first value.\n */\n initialValue?: unknown;\n\n /**\n * Whether to require that the observable emits synchronously when `toSignal` subscribes.\n *\n * If this is `true`, `toSignal` will assert that the observable produces a value immediately upon\n * subscription. Setting this option removes the need to either deal with `undefined` in the\n * signal type or provide an `initialValue`, at the cost of a runtime error if this requirement is\n * not met.\n */\n requireSync?: boolean;\n\n /**\n * `Injector` which will provide the `DestroyRef` used to clean up the Observable subscription.\n *\n * If this is not provided, a `DestroyRef` will be retrieved from the current [injection\n * context](guide/di/dependency-injection-context), unless manual cleanup is requested.\n */\n injector?: Injector;\n\n /**\n * Whether the subscription should be automatically cleaned up (via `DestroyRef`) when\n * `toSignal`'s creation context is destroyed.\n *\n * If manual cleanup is enabled, then `DestroyRef` is not used, and the subscription will persist\n * until the `Observable` itself completes.\n */\n manualCleanup?: boolean;\n\n /**\n * A comparison function which defines equality for values emitted by the observable.\n *\n * Equality comparisons are executed against the initial value if one is provided.\n */\n equal?: ValueEqualityFn<T>;\n\n /**\n * A debug name for the signal. Used in Angular DevTools to identify the signal.\n */\n debugName?: string;\n}\n\n// Base case: no options -> `undefined` in the result type.\nexport function toSignal<T>(source: Observable<T> | Subscribable<T>): Signal<T | undefined>;\n// Options with `undefined` initial value and no `requiredSync` -> `undefined`.\nexport function toSignal<T>(\n source: Observable<T> | Subscribable<T>,\n options: NoInfer<ToSignalOptions<T | undefined>> & {\n initialValue?: undefined;\n requireSync?: false;\n },\n): Signal<T | undefined>;\n// Options with `null` initial value -> `null`.\nexport function toSignal<T>(\n source: Observable<T> | Subscribable<T>,\n options: NoInfer<ToSignalOptions<T | null>> & {initialValue?: null; requireSync?: false},\n): Signal<T | null>;\n// Options with `undefined` initial value and `requiredSync` -> strict result type.\nexport function toSignal<T>(\n source: Observable<T> | Subscribable<T>,\n options: NoInfer<ToSignalOptions<T>> & {initialValue?: undefined; requireSync: true},\n): Signal<T>;\n// Options with a more specific initial value type.\nexport function toSignal<T, const U extends T>(\n source: Observable<T> | Subscribable<T>,\n options: NoInfer<ToSignalOptions<T | U>> & {initialValue: U; requireSync?: false},\n): Signal<T | U>;\n\n/**\n * Get the current value of an `Observable` as a reactive `Signal`.\n *\n * `toSignal` returns a `Signal` which provides synchronous reactive access to values produced\n * by the given `Observable`, by subscribing to that `Observable`. The returned `Signal` will always\n * have the most recent value emitted by the subscription, and will throw an error if the\n * `Observable` errors.\n *\n * With `requireSync` set to `true`, `toSignal` will assert that the `Observable` produces a value\n * immediately upon subscription. No `initialValue` is needed in this case, and the returned signal\n * does not include an `undefined` type.\n *\n * By default, the subscription will be automatically cleaned up when the current [injection\n * context](guide/di/dependency-injection-context) is destroyed. For example, when `toSignal` is\n * called during the construction of a component, the subscription will be cleaned up when the\n * component is destroyed. If an injection context is not available, an explicit `Injector` can be\n * passed instead.\n *\n * If the subscription should persist until the `Observable` itself completes, the `manualCleanup`\n * option can be specified instead, which disables the automatic subscription teardown. No injection\n * context is needed in this configuration as well.\n *\n * @see [RxJS interop with Angular signals](ecosystem/rxjs-interop)\n */\nexport function toSignal<T, U = undefined>(\n source: Observable<T> | Subscribable<T>,\n options?: ToSignalOptions<T | U> & {initialValue?: U},\n): Signal<T | U> {\n typeof ngDevMode !== 'undefined' &&\n ngDevMode &&\n assertNotInReactiveContext(\n toSignal,\n 'Invoking `toSignal` causes new subscriptions every time. ' +\n 'Consider moving `toSignal` outside of the reactive context and read the signal value where needed.',\n );\n\n const requiresCleanup = !options?.manualCleanup;\n\n if (ngDevMode && requiresCleanup && !options?.injector) {\n assertInInjectionContext(toSignal);\n }\n\n const cleanupRef = requiresCleanup\n ? (options?.injector?.get(DestroyRef) ?? inject(DestroyRef))\n : null;\n\n const equal = makeToSignalEqual(options?.equal);\n\n // Note: T is the Observable value type, and U is the initial value type. They don't have to be\n // the same - the returned signal gives values of type `T`.\n let state: WritableSignal<State<T | U>>;\n if (options?.requireSync) {\n // Initially the signal is in a `NoValue` state.\n state = signal(\n {kind: StateKind.NoValue},\n {equal, ...(ngDevMode ? createDebugNameObject(options?.debugName, 'state') : undefined)},\n );\n } else {\n // If an initial value was passed, use it. Otherwise, use `undefined` as the initial value.\n state = signal<State<T | U>>(\n {kind: StateKind.Value, value: options?.initialValue as U},\n {equal, ...(ngDevMode ? createDebugNameObject(options?.debugName, 'state') : undefined)},\n );\n }\n\n let destroyUnregisterFn: (() => void) | undefined;\n\n // Note: This code cannot run inside a reactive context (see assertion above). If we'd support\n // this, we would subscribe to the observable outside of the current reactive context, avoiding\n // that side-effect signal reads/writes are attribute to the current consumer. The current\n // consumer only needs to be notified when the `state` signal changes through the observable\n // subscription. Additional context (related to async pipe):\n // https://github.com/angular/angular/pull/50522.\n const sub = source.subscribe({\n next: (value) => state.set({kind: StateKind.Value, value}),\n error: (error) => {\n state.set({kind: StateKind.Error, error});\n destroyUnregisterFn?.();\n },\n complete: () => {\n destroyUnregisterFn?.();\n },\n // Completion of the Observable is meaningless to the signal. Signals don't have a concept of\n // \"complete\".\n });\n\n if (options?.requireSync && state().kind === StateKind.NoValue) {\n throw new ɵRuntimeError(\n ɵRuntimeErrorCode.REQUIRE_SYNC_WITHOUT_SYNC_EMIT,\n (typeof ngDevMode === 'undefined' || ngDevMode) &&\n '`toSignal()` called with `requireSync` but `Observable` did not emit synchronously.',\n );\n }\n\n // Unsubscribe when the current context is destroyed, if requested.\n destroyUnregisterFn = cleanupRef?.onDestroy(sub.unsubscribe.bind(sub));\n\n // The actual returned signal is a `computed` of the `State` signal, which maps the various states\n // to either values or errors.\n return computed(\n () => {\n const current = state();\n switch (current.kind) {\n case StateKind.Value:\n return current.value;\n case StateKind.Error:\n throw current.error;\n case StateKind.NoValue:\n // This shouldn't really happen because the error is thrown on creation.\n throw new ɵRuntimeError(\n ɵRuntimeErrorCode.REQUIRE_SYNC_WITHOUT_SYNC_EMIT,\n (typeof ngDevMode === 'undefined' || ngDevMode) &&\n '`toSignal()` called with `requireSync` but `Observable` did not emit synchronously.',\n );\n }\n },\n {\n equal: options?.equal,\n ...(ngDevMode ? createDebugNameObject(options?.debugName, 'source') : undefined),\n },\n );\n}\n\nfunction makeToSignalEqual<T>(\n userEquality: ValueEqualityFn<T> = Object.is,\n): ValueEqualityFn<State<T>> {\n return (a, b) =>\n a.kind === StateKind.Value && b.kind === StateKind.Value && userEquality(a.value, b.value);\n}\n\n/**\n * Creates a debug name object for an internal toSignal signal.\n */\nfunction createDebugNameObject(\n toSignalDebugName: string | undefined,\n internalSignalDebugName: string,\n): {debugName?: string} {\n return {\n debugName: `toSignal${toSignalDebugName ? '#' + toSignalDebugName : ''}.${internalSignalDebugName}`,\n };\n}\n\nconst enum StateKind {\n NoValue,\n Value,\n Error,\n}\n\ninterface NoValueState {\n kind: StateKind.NoValue;\n}\n\ninterface ValueState<T> {\n kind: StateKind.Value;\n value: T;\n}\n\ninterface ErrorState {\n kind: StateKind.Error;\n error: unknown;\n}\n\ntype State<T> = NoValueState | ValueState<T> | ErrorState;\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {assertInInjectionContext, PendingTasks, inject, Injector} from '../../src/core';\nimport {MonoTypeOperatorFunction, Observable} from 'rxjs';\n\n/**\n * Operator which makes the application unstable until the observable emits, completes, errors, or is unsubscribed.\n *\n * Use this operator in observables whose subscriptions are important for rendering and should be included in SSR serialization.\n *\n * @param injector The `Injector` to use during creation. If this is not provided, the current injection context will be used instead (via `inject`).\n *\n * @developerPreview 20.0\n */\nexport function pendingUntilEvent<T>(injector?: Injector): MonoTypeOperatorFunction<T> {\n if (injector === undefined) {\n ngDevMode && assertInInjectionContext(pendingUntilEvent);\n injector = inject(Injector);\n }\n const taskService = injector.get(PendingTasks);\n\n return (sourceObservable) => {\n return new Observable<T>((originalSubscriber) => {\n // create a new task on subscription\n const removeTask = taskService.add();\n\n let cleanedUp = false;\n function cleanupTask() {\n if (cleanedUp) {\n return;\n }\n\n removeTask();\n cleanedUp = true;\n }\n\n const innerSubscription = sourceObservable.subscribe({\n next: (v) => {\n originalSubscriber.next(v);\n cleanupTask();\n },\n complete: () => {\n originalSubscriber.complete();\n cleanupTask();\n },\n error: (e) => {\n originalSubscriber.error(e);\n cleanupTask();\n },\n });\n innerSubscription.add(() => {\n originalSubscriber.unsubscribe();\n cleanupTask();\n });\n return innerSubscription;\n });\n };\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Observable, Subscription} from 'rxjs';\nimport {\n assertInInjectionContext,\n BaseResourceOptions,\n resource,\n ResourceLoaderParams,\n ResourceRef,\n ResourceStreamItem,\n Signal,\n signal,\n ɵRuntimeError,\n ɵRuntimeErrorCode,\n} from '../../src/core';\nimport {encapsulateResourceError} from '../../src/resource/resource';\n\n/**\n * Like `ResourceOptions` but uses an RxJS-based `loader`.\n *\n * @experimental\n */\nexport interface RxResourceOptions<T, R> extends BaseResourceOptions<T, R> {\n stream: (params: ResourceLoaderParams<R>) => Observable<T>;\n}\n\n/**\n * Like `resource` but uses an RxJS based `loader` which maps the request to an `Observable` of the\n * resource's value.\n *\n * @see [Using rxResource for async data](ecosystem/rxjs-interop#using-rxresource-for-async-data)\n *\n * @experimental\n */\nexport function rxResource<T, R>(\n opts: RxResourceOptions<T, R> & {defaultValue: NoInfer<T>},\n): ResourceRef<T>;\n\n/**\n * Like `resource` but uses an RxJS based `loader` which maps the request to an `Observable` of the\n * resource's value.\n *\n * @experimental\n */\nexport function rxResource<T, R>(opts: RxResourceOptions<T, R>): ResourceRef<T | undefined>;\nexport function rxResource<T, R>(opts: RxResourceOptions<T, R>): ResourceRef<T | undefined> {\n if (ngDevMode && !opts?.injector) {\n assertInInjectionContext(rxResource);\n }\n return resource<T, R>({\n ...opts,\n loader: undefined,\n stream: (params) => {\n let sub: Subscription | undefined;\n\n // Track the abort listener so it can be removed if the Observable completes (as a memory\n // optimization).\n const onAbort = () => sub?.unsubscribe();\n params.abortSignal.addEventListener('abort', onAbort);\n\n // Start off stream as undefined.\n const stream = signal<ResourceStreamItem<T>>({value: undefined as T});\n let resolve: ((value: Signal<ResourceStreamItem<T>>) => void) | undefined;\n const promise = new Promise<Signal<ResourceStreamItem<T>>>((r) => (resolve = r));\n\n function send(value: ResourceStreamItem<T>): void {\n stream.set(value);\n resolve?.(stream);\n resolve = undefined;\n }\n\n const streamFn = opts.stream;\n if (streamFn === undefined) {\n throw new ɵRuntimeError(\n ɵRuntimeErrorCode.MUST_PROVIDE_STREAM_OPTION,\n ngDevMode && `Must provide \\`stream\\` option.`,\n );\n }\n\n sub = streamFn(params).subscribe({\n next: (value) => send({value}),\n error: (error: unknown) => {\n send({error: encapsulateResourceError(error)});\n params.abortSignal.removeEventListener('abort', onAbort);\n },\n complete: () => {\n if (resolve) {\n send({\n error: new ɵRuntimeError(\n ɵRuntimeErrorCode.RESOURCE_COMPLETED_BEFORE_PRODUCING_VALUE,\n ngDevMode && 'Resource completed before producing a value',\n ),\n });\n }\n params.abortSignal.removeEventListener('abort', onAbort);\n },\n });\n\n if (resolve === undefined) {\n return stream;\n }\n\n return promise;\n },\n });\n}\n"],"names":["takeUntilDestroyed","destroyRef","ngDevMode","assertInInjectionContext","inject","DestroyRef","destroyed$","Observable","subscriber","destroyed","next","unregisterFn","onDestroy","bind","source","pipe","takeUntil","OutputFromObservableRef","constructor","subscribe","callbackFn","ɵRuntimeError","subscription","value","unsubscribe","outputFromObservable","observable","opts","outputToObservable","ref","ɵgetOutputDestroyRef","observer","unregisterOnDestroy","complete","v","toObservable","options","injector","Injector","subject","ReplaySubject","watcher","effect","err","untracked","error","manualCleanup","get","destroy","asObservable","toSignal","assertNotInReactiveContext","requiresCleanup","cleanupRef","equal","makeToSignalEqual","state","requireSync","signal","kind","createDebugNameObject","debugName","undefined","initialValue","destroyUnregisterFn","sub","set","computed","current","userEquality","Object","is","a","b","toSignalDebugName","internalSignalDebugName","pendingUntilEvent","taskService","PendingTasks","sourceObservable","originalSubscriber","removeTask","add","cleanedUp","cleanupTask","innerSubscription","e","rxResource","resource","loader","stream","params","onAbort","abortSignal","addEventListener","resolve","promise","Promise","r","send","streamFn","encapsulateResourceError","removeEventListener"],"mappings":";;;;;;;;;;;;;;;;AAwBM,SAAUA,kBAAkBA,CAAIC,UAAuB,EAAA;EAC3D,IAAI,CAACA,UAAU,EAAE;AACfC,IAAAA,SAAS,IAAIC,wBAAwB,CAACH,kBAAkB,CAAC;AACzDC,IAAAA,UAAU,GAAGG,MAAM,CAACC,UAAU,CAAC;AACjC,EAAA;AAEA,EAAA,MAAMC,UAAU,GAAG,IAAIC,UAAU,CAAQC,UAAU,IAAI;IACrD,IAAIP,UAAU,CAACQ,SAAS,EAAE;MACxBD,UAAU,CAACE,IAAI,EAAE;AACjB,MAAA;AACF,IAAA;AACA,IAAA,MAAMC,YAAY,GAAGV,UAAU,CAACW,SAAS,CAACJ,UAAU,CAACE,IAAI,CAACG,IAAI,CAACL,UAAU,CAAC,CAAC;AAC3E,IAAA,OAAOG,YAAY;AACrB,EAAA,CAAC,CAAC;AAEF,EAAA,OAAWG,MAAqB,IAAI;IAClC,OAAOA,MAAM,CAACC,IAAI,CAACC,SAAS,CAACV,UAAU,CAAC,CAAC;EAC3C,CAAC;AACH;;ACdA,MAAMW,uBAAuB,CAAA;EAKPH,MAAA;AAJZL,EAAAA,SAAS,GAAG,KAAK;AAEzBR,EAAAA,UAAU,GAAGG,MAAM,CAACC,UAAU,C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MAAM,IAAIzC,YAAa,CAAA,GAAA,EAErBnB,SAAS,IAAI,iCAAiC,CAC/C;AACH,MAAA;AAEA+D,MAAAA,GAAG,GAAGmC,QAAQ,CAACT,MAAM,CAAC,CAACxE,SAAS,CAAC;AAC/BT,QAAAA,IAAI,EAAGa,KAAK,IAAK4E,IAAI,CAAC;AAAC5E,UAAAA;AAAK,SAAC,CAAC;QAC9BsB,KAAK,EAAGA,KAAc,IAAI;AACxBsD,UAAAA,IAAI,CAAC;YAACtD,KAAK,EAAEwD,wBAAwB,CAACxD,KAAK;AAAC,WAAC,CAAC;UAC9C8C,MAAM,CAACE,WAAW,CAACS,mBAAmB,CAAC,OAAO,EAAEV,OAAO,CAAC;QAC1D,CAAC;QACD3D,QAAQ,EAAEA,MAAK;AACb,UAAA,IAAI8D,OAAO,EAAE;AACXI,YAAAA,IAAI,CAAC;cACHtD,KAAK,EAAE,IAAIxB,YAAa,MAEtBnB,SAAS,IAAI,6CAA6C;AAE7D,aAAA,CAAC;AACJ,UAAA;UACAyF,MAAM,CAACE,WAAW,CAACS,mBAAmB,CAAC,OAAO,EAAEV,OAAO,CAAC;AAC1D,QAAA;AACD,OAAA,CAAC;MAEF,IAAIG,OAAO,KAAKjC,SAAS,EAAE;AACzB,QAAA,OAAO4B,MAAM;AACf,MAAA;AAEA,MAAA,OAAOM,OAAO;AAChB,IAAA;AACD,GAAA,CAAC;AACJ;;;;"}
{"version":3,"file":"rxjs-interop.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/rxjs-interop/src/take_until_destroyed.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/rxjs-interop/src/output_from_observable.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/rxjs-interop/src/output_to_observable.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/rxjs-interop/src/to_observable.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/rxjs-interop/src/to_signal.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/rxjs-interop/src/pending_until_event.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/core/rxjs-interop/src/rx_resource.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {assertInInjectionContext, DestroyRef, inject} from '../../src/core';\nimport {MonoTypeOperatorFunction, Observable} from 'rxjs';\nimport {takeUntil} from 'rxjs/operators';\n\n/**\n * Operator which completes the Observable when the calling context (component, directive, service,\n * etc) is destroyed.\n *\n * @param destroyRef optionally, the `DestroyRef` representing the current context. This can be\n * passed explicitly to use `takeUntilDestroyed` outside of an [injection\n * context](guide/di/dependency-injection-context). Otherwise, the current `DestroyRef` is injected.\n *\n * @see [Unsubscribing with takeUntilDestroyed](ecosystem/rxjs-interop/take-until-destroyed)\n *\n * @publicApi 19.0\n */\nexport function takeUntilDestroyed<T>(destroyRef?: DestroyRef): MonoTypeOperatorFunction<T> {\n if (!destroyRef) {\n ngDevMode && assertInInjectionContext(takeUntilDestroyed);\n destroyRef = inject(DestroyRef);\n }\n\n const destroyed$ = new Observable<void>((subscriber) => {\n if (destroyRef.destroyed) {\n subscriber.next();\n return;\n }\n const unregisterFn = destroyRef.onDestroy(subscriber.next.bind(subscriber));\n return unregisterFn;\n });\n\n return <T>(source: Observable<T>) => {\n return source.pipe(takeUntil(destroyed$));\n };\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n assertInInjectionContext,\n DestroyRef,\n inject,\n OutputOptions,\n OutputRef,\n OutputRefSubscription,\n ɵRuntimeError,\n ɵRuntimeErrorCode,\n} from '../../src/core';\nimport {Observable} from 'rxjs';\n\nimport {takeUntilDestroyed} from './take_until_destroyed';\n\n/**\n * Implementation of `OutputRef` that emits values from\n * an RxJS observable source.\n *\n * @internal\n */\nclass OutputFromObservableRef<T> implements OutputRef<T> {\n private destroyed = false;\n\n destroyRef = inject(DestroyRef);\n\n constructor(private source: Observable<T>) {\n this.destroyRef.onDestroy(() => {\n this.destroyed = true;\n });\n }\n\n subscribe(callbackFn: (value: T) => void): OutputRefSubscription {\n if (this.destroyed) {\n throw new ɵRuntimeError(\n ɵRuntimeErrorCode.OUTPUT_REF_DESTROYED,\n ngDevMode &&\n 'Unexpected subscription to destroyed `OutputRef`. ' +\n 'The owning directive/component is destroyed.',\n );\n }\n\n // Stop yielding more values when the directive/component is already destroyed.\n const subscription = this.source.pipe(takeUntilDestroyed(this.destroyRef)).subscribe({\n next: (value) => callbackFn(value),\n });\n\n return {\n unsubscribe: () => subscription.unsubscribe(),\n };\n }\n}\n\n/**\n * Declares an Angular output that is using an RxJS observable as a source\n * for events dispatched to parent subscribers.\n *\n * The behavior for an observable as source is defined as followed:\n * 1. New values are forwarded to the Angular output (next notifications).\n * 2. Errors notifications are not handled by Angular. You need to handle these manually.\n * For example by using `catchError`.\n * 3. Completion notifications stop the output from emitting new values.\n *\n * @usageNotes\n * Initialize an output in your directive by declaring a\n * class field and initializing it with the `outputFromObservable()` function.\n *\n * ```ts\n * @Directive({..})\n * export class MyDir {\n * nameChange$ = <some-observable>;\n * nameChange = outputFromObservable(this.nameChange$);\n * }\n * ```\n * @see [RxJS interop with component and directive outputs](ecosystem/rxjs-interop/output-interop)\n *\n * @publicApi 19.0\n */\nexport function outputFromObservable<T>(\n observable: Observable<T>,\n opts?: OutputOptions,\n): OutputRef<T> {\n ngDevMode && assertInInjectionContext(outputFromObservable);\n return new OutputFromObservableRef<T>(observable);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {OutputRef, ɵgetOutputDestroyRef} from '../../src/core';\nimport {Observable} from 'rxjs';\n\n/**\n * Converts an Angular output declared via `output()` or `outputFromObservable()`\n * to an observable.\n * It creates an observable that represents the stream of \"events firing\" in an output.\n *\n * You can subscribe to the output via `Observable.subscribe` then.\n *\n * @see [RxJS interop with component and directive outputs](ecosystem/rxjs-interop/output-interop)\n *\n * @publicApi 19.0\n */\nexport function outputToObservable<T>(ref: OutputRef<T>): Observable<T> {\n const destroyRef = ɵgetOutputDestroyRef(ref);\n\n return new Observable<T>((observer) => {\n // Complete the observable upon directive/component destroy.\n // Note: May be `undefined` if an `EventEmitter` is declared outside\n // of an injection context.\n const unregisterOnDestroy = destroyRef?.onDestroy(() => observer.complete());\n\n const subscription = ref.subscribe((v) => observer.next(v));\n return () => {\n subscription.unsubscribe();\n unregisterOnDestroy?.();\n };\n });\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n assertInInjectionContext,\n DestroyRef,\n effect,\n inject,\n Injector,\n Signal,\n untracked,\n} from '../../src/core';\nimport {Observable, ReplaySubject} from 'rxjs';\n\n/**\n * Options for `toObservable`.\n *\n * @publicApi 20.0\n */\nexport interface ToObservableOptions {\n /**\n * The `Injector` to use when creating the underlying `effect` which watches the signal.\n *\n * If this isn't specified, the current [injection context](guide/di/dependency-injection-context)\n * will be used.\n */\n injector?: Injector;\n}\n\n/**\n * Exposes the value of an Angular `Signal` as an RxJS `Observable`.\n * As it reflects a state, the observable will always emit the latest value upon subscription.\n *\n * The signal's value will be propagated into the `Observable`'s subscribers using an `effect`.\n *\n * `toObservable` must be called in an injection context unless an injector is provided via options.\n *\n * @see [RxJS interop with Angular signals](ecosystem/rxjs-interop)\n * @see [Create an RxJS Observable from a signal with toObservable](ecosystem/rxjs-interop#create-an-rxjs-observable-from-a-signal-with-toobservable)\n *\n * @publicApi 20.0\n */\nexport function toObservable<T>(source: Signal<T>, options?: ToObservableOptions): Observable<T> {\n if (ngDevMode && !options?.injector) {\n assertInInjectionContext(toObservable);\n }\n const injector = options?.injector ?? inject(Injector);\n const subject = new ReplaySubject<T>(1);\n\n const watcher = effect(\n () => {\n let value: T;\n try {\n value = source();\n } catch (err) {\n untracked(() => subject.error(err));\n return;\n }\n untracked(() => subject.next(value));\n },\n {injector, manualCleanup: true},\n );\n\n injector.get(DestroyRef).onDestroy(() => {\n watcher.destroy();\n subject.complete();\n });\n\n return subject.asObservable();\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n assertInInjectionContext,\n assertNotInReactiveContext,\n computed,\n DestroyRef,\n inject,\n Injector,\n signal,\n Signal,\n WritableSignal,\n ɵRuntimeError,\n ɵRuntimeErrorCode,\n} from '../../src/core';\nimport {ValueEqualityFn} from '../../primitives/signals';\nimport {Observable, Subscribable} from 'rxjs';\n\n/**\n * Options for `toSignal`.\n *\n * @publicApi 20.0\n */\nexport interface ToSignalOptions<T> {\n /**\n * Initial value for the signal produced by `toSignal`.\n *\n * This will be the value of the signal until the observable emits its first value.\n */\n initialValue?: unknown;\n\n /**\n * Whether to require that the observable emits synchronously when `toSignal` subscribes.\n *\n * If this is `true`, `toSignal` will assert that the observable produces a value immediately upon\n * subscription. Setting this option removes the need to either deal with `undefined` in the\n * signal type or provide an `initialValue`, at the cost of a runtime error if this requirement is\n * not met.\n */\n requireSync?: boolean;\n\n /**\n * `Injector` which will provide the `DestroyRef` used to clean up the Observable subscription.\n *\n * If this is not provided, a `DestroyRef` will be retrieved from the current [injection\n * context](guide/di/dependency-injection-context), unless manual cleanup is requested.\n */\n injector?: Injector;\n\n /**\n * Whether the subscription should be automatically cleaned up (via `DestroyRef`) when\n * `toSignal`'s creation context is destroyed.\n *\n * If manual cleanup is enabled, then `DestroyRef` is not used, and the subscription will persist\n * until the `Observable` itself completes.\n */\n manualCleanup?: boolean;\n\n /**\n * A comparison function which defines equality for values emitted by the observable.\n *\n * Equality comparisons are executed against the initial value if one is provided.\n */\n equal?: ValueEqualityFn<T>;\n\n /**\n * A debug name for the signal. Used in Angular DevTools to identify the signal.\n */\n debugName?: string;\n}\n\n// Base case: no options -> `undefined` in the result type.\nexport function toSignal<T>(source: Observable<T> | Subscribable<T>): Signal<T | undefined>;\n// Options with `undefined` initial value and no `requiredSync` -> `undefined`.\nexport function toSignal<T>(\n source: Observable<T> | Subscribable<T>,\n options: NoInfer<ToSignalOptions<T | undefined>> & {\n initialValue?: undefined;\n requireSync?: false;\n },\n): Signal<T | undefined>;\n// Options with `null` initial value -> `null`.\nexport function toSignal<T>(\n source: Observable<T> | Subscribable<T>,\n options: NoInfer<ToSignalOptions<T | null>> & {initialValue?: null; requireSync?: false},\n): Signal<T | null>;\n// Options with `undefined` initial value and `requiredSync` -> strict result type.\nexport function toSignal<T>(\n source: Observable<T> | Subscribable<T>,\n options: NoInfer<ToSignalOptions<T>> & {initialValue?: undefined; requireSync: true},\n): Signal<T>;\n// Options with a more specific initial value type.\nexport function toSignal<T, const U extends T>(\n source: Observable<T> | Subscribable<T>,\n options: NoInfer<ToSignalOptions<T | U>> & {initialValue: U; requireSync?: false},\n): Signal<T | U>;\n\n/**\n * Get the current value of an `Observable` as a reactive `Signal`.\n *\n * `toSignal` returns a `Signal` which provides synchronous reactive access to values produced\n * by the given `Observable`, by subscribing to that `Observable`. The returned `Signal` will always\n * have the most recent value emitted by the subscription, and will throw an error if the\n * `Observable` errors.\n *\n * With `requireSync` set to `true`, `toSignal` will assert that the `Observable` produces a value\n * immediately upon subscription. No `initialValue` is needed in this case, and the returned signal\n * does not include an `undefined` type.\n *\n * By default, the subscription will be automatically cleaned up when the current [injection\n * context](guide/di/dependency-injection-context) is destroyed. For example, when `toSignal` is\n * called during the construction of a component, the subscription will be cleaned up when the\n * component is destroyed. If an injection context is not available, an explicit `Injector` can be\n * passed instead.\n *\n * If the subscription should persist until the `Observable` itself completes, the `manualCleanup`\n * option can be specified instead, which disables the automatic subscription teardown. No injection\n * context is needed in this configuration as well.\n *\n * @see [RxJS interop with Angular signals](ecosystem/rxjs-interop)\n */\nexport function toSignal<T, U = undefined>(\n source: Observable<T> | Subscribable<T>,\n options?: ToSignalOptions<T | U> & {initialValue?: U},\n): Signal<T | U> {\n typeof ngDevMode !== 'undefined' &&\n ngDevMode &&\n assertNotInReactiveContext(\n toSignal,\n 'Invoking `toSignal` causes new subscriptions every time. ' +\n 'Consider moving `toSignal` outside of the reactive context and read the signal value where needed.',\n );\n\n const requiresCleanup = !options?.manualCleanup;\n\n if (ngDevMode && requiresCleanup && !options?.injector) {\n assertInInjectionContext(toSignal);\n }\n\n const cleanupRef = requiresCleanup\n ? (options?.injector?.get(DestroyRef) ?? inject(DestroyRef))\n : null;\n\n const equal = makeToSignalEqual(options?.equal);\n\n // Note: T is the Observable value type, and U is the initial value type. They don't have to be\n // the same - the returned signal gives values of type `T`.\n let state: WritableSignal<State<T | U>>;\n if (options?.requireSync) {\n // Initially the signal is in a `NoValue` state.\n state = signal(\n {kind: StateKind.NoValue},\n {equal, ...(ngDevMode ? createDebugNameObject(options?.debugName, 'state') : undefined)},\n );\n } else {\n // If an initial value was passed, use it. Otherwise, use `undefined` as the initial value.\n state = signal<State<T | U>>(\n {kind: StateKind.Value, value: options?.initialValue as U},\n {equal, ...(ngDevMode ? createDebugNameObject(options?.debugName, 'state') : undefined)},\n );\n }\n\n let destroyUnregisterFn: (() => void) | undefined;\n\n // Note: This code cannot run inside a reactive context (see assertion above). If we'd support\n // this, we would subscribe to the observable outside of the current reactive context, avoiding\n // that side-effect signal reads/writes are attribute to the current consumer. The current\n // consumer only needs to be notified when the `state` signal changes through the observable\n // subscription. Additional context (related to async pipe):\n // https://github.com/angular/angular/pull/50522.\n const sub = source.subscribe({\n next: (value) => state.set({kind: StateKind.Value, value}),\n error: (error) => {\n state.set({kind: StateKind.Error, error});\n destroyUnregisterFn?.();\n },\n complete: () => {\n destroyUnregisterFn?.();\n },\n // Completion of the Observable is meaningless to the signal. Signals don't have a concept of\n // \"complete\".\n });\n\n if (options?.requireSync && state().kind === StateKind.NoValue) {\n throw new ɵRuntimeError(\n ɵRuntimeErrorCode.REQUIRE_SYNC_WITHOUT_SYNC_EMIT,\n (typeof ngDevMode === 'undefined' || ngDevMode) &&\n '`toSignal()` called with `requireSync` but `Observable` did not emit synchronously.',\n );\n }\n\n // Unsubscribe when the current context is destroyed, if requested.\n destroyUnregisterFn = cleanupRef?.onDestroy(sub.unsubscribe.bind(sub));\n\n // The actual returned signal is a `computed` of the `State` signal, which maps the various states\n // to either values or errors.\n return computed(\n () => {\n const current = state();\n switch (current.kind) {\n case StateKind.Value:\n return current.value;\n case StateKind.Error:\n throw current.error;\n case StateKind.NoValue:\n // This shouldn't really happen because the error is thrown on creation.\n throw new ɵRuntimeError(\n ɵRuntimeErrorCode.REQUIRE_SYNC_WITHOUT_SYNC_EMIT,\n (typeof ngDevMode === 'undefined' || ngDevMode) &&\n '`toSignal()` called with `requireSync` but `Observable` did not emit synchronously.',\n );\n }\n },\n {\n equal: options?.equal,\n ...(ngDevMode ? createDebugNameObject(options?.debugName, 'source') : undefined),\n },\n );\n}\n\nfunction makeToSignalEqual<T>(\n userEquality: ValueEqualityFn<T> = Object.is,\n): ValueEqualityFn<State<T>> {\n return (a, b) =>\n a.kind === StateKind.Value && b.kind === StateKind.Value && userEquality(a.value, b.value);\n}\n\n/**\n * Creates a debug name object for an internal toSignal signal.\n */\nfunction createDebugNameObject(\n toSignalDebugName: string | undefined,\n internalSignalDebugName: string,\n): {debugName?: string} {\n return {\n debugName: `toSignal${toSignalDebugName ? '#' + toSignalDebugName : ''}.${internalSignalDebugName}`,\n };\n}\n\nconst enum StateKind {\n NoValue,\n Value,\n Error,\n}\n\ninterface NoValueState {\n kind: StateKind.NoValue;\n}\n\ninterface ValueState<T> {\n kind: StateKind.Value;\n value: T;\n}\n\ninterface ErrorState {\n kind: StateKind.Error;\n error: unknown;\n}\n\ntype State<T> = NoValueState | ValueState<T> | ErrorState;\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {assertInInjectionContext, PendingTasks, inject, Injector} from '../../src/core';\nimport {MonoTypeOperatorFunction, Observable} from 'rxjs';\n\n/**\n * Operator which makes the application unstable until the observable emits, completes, errors, or is unsubscribed.\n *\n * Use this operator in observables whose subscriptions are important for rendering and should be included in SSR serialization.\n *\n * @param injector The `Injector` to use during creation. If this is not provided, the current injection context will be used instead (via `inject`).\n *\n * @developerPreview 20.0\n */\nexport function pendingUntilEvent<T>(injector?: Injector): MonoTypeOperatorFunction<T> {\n if (injector === undefined) {\n ngDevMode && assertInInjectionContext(pendingUntilEvent);\n injector = inject(Injector);\n }\n const taskService = injector.get(PendingTasks);\n\n return (sourceObservable) => {\n return new Observable<T>((originalSubscriber) => {\n // create a new task on subscription\n const removeTask = taskService.add();\n\n let cleanedUp = false;\n function cleanupTask() {\n if (cleanedUp) {\n return;\n }\n\n removeTask();\n cleanedUp = true;\n }\n\n const innerSubscription = sourceObservable.subscribe({\n next: (v) => {\n originalSubscriber.next(v);\n cleanupTask();\n },\n complete: () => {\n originalSubscriber.complete();\n cleanupTask();\n },\n error: (e) => {\n originalSubscriber.error(e);\n cleanupTask();\n },\n });\n innerSubscription.add(() => {\n originalSubscriber.unsubscribe();\n cleanupTask();\n });\n return innerSubscription;\n });\n };\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Observable, Subscription} from 'rxjs';\nimport {\n assertInInjectionContext,\n BaseResourceOptions,\n resource,\n ResourceLoaderParams,\n ResourceRef,\n ResourceStreamItem,\n Signal,\n signal,\n ɵRuntimeError,\n ɵRuntimeErrorCode,\n} from '../../src/core';\nimport {encapsulateResourceError} from '../../src/resource/resource';\n\n/**\n * Like `ResourceOptions` but uses an RxJS-based `loader`.\n *\n * @publicApi 22.0\n */\nexport interface RxResourceOptions<T, R> extends BaseResourceOptions<T, R> {\n stream: (params: ResourceLoaderParams<R>) => Observable<T>;\n}\n\n/**\n * Like `resource` but uses an RxJS based `loader` which maps the request to an `Observable` of the\n * resource's value.\n *\n * @see [Using rxResource for async data](ecosystem/rxjs-interop#using-rxresource-for-async-data)\n *\n * @publicApi 22.0\n */\nexport function rxResource<T, R>(\n opts: RxResourceOptions<T, R> & {defaultValue: NoInfer<T>},\n): ResourceRef<T>;\n\n/**\n * Like `resource` but uses an RxJS based `loader` which maps the request to an `Observable` of the\n * resource's value.\n *\n * @publicApi 22.0\n */\nexport function rxResource<T, R>(opts: RxResourceOptions<T, R>): ResourceRef<T | undefined>;\nexport function rxResource<T, R>(opts: RxResourceOptions<T, R>): ResourceRef<T | undefined> {\n if (ngDevMode && !opts?.injector) {\n assertInInjectionContext(rxResource);\n }\n return resource<T, R>({\n ...opts,\n loader: undefined,\n stream: (params) => {\n let sub: Subscription | undefined;\n\n // Track the abort listener so it can be removed if the Observable completes (as a memory\n // optimization).\n const onAbort = () => sub?.unsubscribe();\n params.abortSignal.addEventListener('abort', onAbort);\n\n // Start off stream as undefined.\n const stream = signal<ResourceStreamItem<T>>({value: undefined as T});\n let resolve: ((value: Signal<ResourceStreamItem<T>>) => void) | undefined;\n const promise = new Promise<Signal<ResourceStreamItem<T>>>((r) => (resolve = r));\n\n function send(value: ResourceStreamItem<T>): void {\n stream.set(value);\n resolve?.(stream);\n resolve = undefined;\n }\n\n const streamFn = opts.stream;\n if (streamFn === undefined) {\n throw new ɵRuntimeError(\n ɵRuntimeErrorCode.MUST_PROVIDE_STREAM_OPTION,\n ngDevMode && `Must provide \\`stream\\` option.`,\n );\n }\n\n sub = streamFn(params).subscribe({\n next: (value) => send({value}),\n error: (error: unknown) => {\n send({error: encapsulateResourceError(error)});\n params.abortSignal.removeEventListener('abort', onAbort);\n },\n complete: () => {\n if (resolve) {\n send({\n error: new ɵRuntimeError(\n ɵRuntimeErrorCode.RESOURCE_COMPLETED_BEFORE_PRODUCING_VALUE,\n ngDevMode && 'Resource completed before producing a value',\n ),\n });\n }\n params.abortSignal.removeEventListener('abort', onAbort);\n },\n });\n\n if (resolve === undefined) {\n return stream;\n }\n\n return promise;\n },\n });\n}\n"],"names":["takeUntilDestroyed","destroyRef","ngDevMode","assertInInjectionContext","inject","DestroyRef","destroyed$","Observable","subscriber","destroyed","next","unregisterFn","onDestroy","bind","source","pipe","takeUntil","OutputFromObservableRef","constructor","subscribe","callbackFn","ɵRuntimeError","subscription","value","unsubscribe","outputFromObservable","observable","opts","outputToObservable","ref","ɵgetOutputDestroyRef","observer","unregisterOnDestroy","complete","v","toObservable","options","injector","Injector","subject","ReplaySubject","watcher","effect","err","untracked","error","manualCleanup","get","destroy","asObservable","toSignal","assertNotInReactiveContext","requiresCleanup","cleanupRef","equal","makeToSignalEqual","state","requireSync","signal","kind","createDebugNameObject","debugName","undefined","initialValue","destroyUnregisterFn","sub","set","computed","current","userEquality","Object","is","a","b","toSignalDebugName","internalSignalDebugName","pendingUntilEvent","taskService","PendingTasks","sourceObservable","originalSubscriber","removeTask","add","cleanedUp","cleanupTask","innerSubscription","e","rxResource","resource","loader","stream","params","onAbort","abortSignal","addEventListener","resolve","promise","Promise","r","send","streamFn","encapsulateResourceError","removeEventListener"],"mappings":";;;;;;;;;;;;;;;;AAwBM,SAAUA,kBAAkBA,CAAIC,UAAuB,EAAA;EAC3D,IAAI,CAACA,UAAU,EAAE;AACfC,IAAAA,SAAS,IAAIC,wBAAwB,CAACH,kBAAkB,CAAC;AACzDC,IAAAA,UAAU,GAAGG,MAAM,CAACC,UAAU,CAAC;AACjC,EAAA;AAEA,EAAA,MAAMC,UAAU,GAAG,IAAIC,UAAU,CAAQC,UAAU,IAAI;IACrD,IAAIP,UAAU,CAACQ,SAAS,EAAE;MACxBD,UAAU,CAACE,IAAI,EAAE;AACjB,MAAA;A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A,OAAOM,OAAO;AAChB,IAAA;AACD,GAAA,CAAC;AACJ;;;;"}
{
"name": "@angular/core",
"version": "22.0.0-next.10",
"version": "22.0.0-next.11",
"description": "Angular - the core framework",

@@ -8,3 +8,3 @@ "author": "angular",

"engines": {
"node": "^22.22.0 || >=24.13.1"
"node": "^22.22.0 || ^24.13.1 || >=26.0.0"
},

@@ -49,4 +49,8 @@ "exports": {

},
"devDependencies": {
"@mcp-b/webmcp-polyfill": "^2.2.0",
"@mcp-b/webmcp-types": "^2.2.0"
},
"peerDependencies": {
"@angular/compiler": "22.0.0-next.10",
"@angular/compiler": "22.0.0-next.11",
"rxjs": "^6.5.3 || ^7.4.0",

@@ -53,0 +57,0 @@ "zone.js": "~0.15.0 || ~0.16.0"

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -5,0 +5,0 @@ * License: MIT

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -5,0 +5,0 @@ * License: MIT

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -5,0 +5,0 @@ * License: MIT

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -5,0 +5,0 @@ * License: MIT

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -5,0 +5,0 @@ * License: MIT

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -5,0 +5,0 @@ * License: MIT

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -5,0 +5,0 @@ * License: MIT

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -5,0 +5,0 @@ * License: MIT

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -33,11 +33,14 @@ * License: MIT

let hasIncremental = false;
let hasNoIncremental = false;
for (const arg of node.arguments) {
if (ts.isCallExpression(arg) &&
ts.isIdentifier(arg.expression) &&
arg.expression.text === 'withIncrementalHydration') {
hasIncremental = true;
break;
if (ts.isCallExpression(arg) && ts.isIdentifier(arg.expression)) {
if (arg.expression.text === 'withIncrementalHydration') {
hasIncremental = true;
}
else if (arg.expression.text === 'withNoIncrementalHydration') {
hasNoIncremental = true;
}
}
}
if (!hasIncremental) {
if (!hasIncremental && !hasNoIncremental) {
// Add withNoIncrementalHydration()

@@ -44,0 +47,0 @@ const withNoIncrementalExpr = importManager.addImport({

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -5,0 +5,0 @@ * License: MIT

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -5,0 +5,0 @@ * License: MIT

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -5,0 +5,0 @@ * License: MIT

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -5,0 +5,0 @@ * License: MIT

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -5,0 +5,0 @@ * License: MIT

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -5,0 +5,0 @@ * License: MIT

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -5,0 +5,0 @@ * License: MIT

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -5,0 +5,0 @@ * License: MIT

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -16,3 +16,3 @@ * License: MIT

var apply_import_manager = require('./apply_import_manager-CxA_YYgB.cjs');
var index = require('./index-DADA7AvC.cjs');
var index = require('./index-DcezkXLN.cjs');
require('@angular-devkit/core');

@@ -19,0 +19,0 @@ require('node:path/posix');

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -5,0 +5,0 @@ * License: MIT

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -5,0 +5,0 @@ * License: MIT

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -5,0 +5,0 @@ * License: MIT

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -5,0 +5,0 @@ * License: MIT

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -5,0 +5,0 @@ * License: MIT

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -5,0 +5,0 @@ * License: MIT

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -5,0 +5,0 @@ * License: MIT

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -15,5 +15,5 @@ * License: MIT

var apply_import_manager = require('./apply_import_manager-CxA_YYgB.cjs');
var migrate_ts_type_references = require('./migrate_ts_type_references-CdaIOlGY.cjs');
var migrate_ts_type_references = require('./migrate_ts_type_references-xRTTASnu.cjs');
var assert = require('assert');
var index = require('./index-DADA7AvC.cjs');
var index = require('./index-DcezkXLN.cjs');
var compiler = require('@angular/compiler');

@@ -20,0 +20,0 @@ require('@angular-devkit/core');

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -22,5 +22,5 @@ * License: MIT

require('./apply_import_manager-CxA_YYgB.cjs');
require('./migrate_ts_type_references-CdaIOlGY.cjs');
require('./migrate_ts_type_references-xRTTASnu.cjs');
require('assert');
require('./index-DADA7AvC.cjs');
require('./index-DcezkXLN.cjs');
require('@angular/compiler');

@@ -27,0 +27,0 @@ require('./leading_space-BTPRV0wu.cjs');

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -5,0 +5,0 @@ * License: MIT

'use strict';
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -5,0 +5,0 @@ * License: MIT

@@ -37,4 +37,9 @@ {

"factory": "./bundles/model-output.cjs#migrate"
},
"safe-optional-chaining": {
"version": "22.0.0",
"description": "Wraps optional chaining expressions in $safeNavigationMigration().",
"factory": "./bundles/safe-optional-chaining.cjs#migrate"
}
}
}
/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -141,3 +141,3 @@ * License: MIT

*
* @experimental
* @publicApi 22.0
*/

@@ -152,3 +152,3 @@ type ResourceStatus = 'idle' | 'error' | 'loading' | 'reloading' | 'resolved' | 'local';

*
* @experimental
* @publicApi 22.0
*/

@@ -190,3 +190,3 @@ interface Resource<T> {

*
* @experimental
* @publicApi 22.0
*/

@@ -219,3 +219,3 @@ interface WritableResource<T> extends Resource<T> {

*
* @experimental
* @publicApi 22.0
*/

@@ -234,3 +234,3 @@ interface ResourceRef<T> extends WritableResource<T> {

*
* @experimental
* @publicApi 22.0
*/

@@ -247,3 +247,3 @@ interface ResourceLoaderParams<R> {

*
* @experimental
* @publicApi 22.0
*/

@@ -254,3 +254,3 @@ type ResourceLoader<T, R> = (param: ResourceLoaderParams<R>) => PromiseLike<T>;

*
* @experimental
* @publicApi 22.0
*/

@@ -261,3 +261,3 @@ type ResourceStreamingLoader<T, R> = (param: ResourceLoaderParams<R>) => Signal<ResourceStreamItem<T>> | PromiseLike<Signal<ResourceStreamItem<T>>> | undefined;

*
* @experimental
* @publicApi 22.0
*/

@@ -285,2 +285,7 @@ interface BaseResourceOptions<T, R> {

injector?: Injector;
/**
* Identifier used to cache the resource data in the `TransferState` during server-side rendering and to retrieve it on the client side.
* This value value needs to be identical for both the client and server.
*/
id?: string;
}

@@ -290,3 +295,3 @@ /**

*
* @experimental
* @publicApi 22.0
*/

@@ -306,3 +311,3 @@ interface PromiseResourceOptions<T, R> extends BaseResourceOptions<T, R> {

*
* @experimental
* @publicApi 22.0
*/

@@ -321,3 +326,3 @@ interface StreamingResourceOptions<T, R> extends BaseResourceOptions<T, R> {

/**
* @experimental
* @publicApi 22.0
*/

@@ -331,3 +336,3 @@ type ResourceOptions<T, R> = (PromiseResourceOptions<T, R> | StreamingResourceOptions<T, R>) & {

/**
* @experimental
* @publicApi 22.0
*/

@@ -342,3 +347,3 @@ type ResourceStreamItem<T> = {

*
* @experimental
* @publicApi 22.0
* @see [Resource composition with snapshots](guide/signals/resource#resource-composition-with-snapshots)

@@ -363,2 +368,4 @@ */

* @see [Debouncing signals with `debounced`](guide/signals/debounced)
*
* @experimental 22.0
*/

@@ -376,2 +383,4 @@ interface DebouncedOptions<T> {

* @see [Debouncing signals with `debounced`](guide/signals/debounced)
*
* @experimental 22.0
*/

@@ -378,0 +387,0 @@ type DebounceTimer<T> = number | ((value: T, lastValue: ResourceSnapshot<T>) => Promise<void> | void);

/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -4,0 +4,0 @@ * License: MIT

/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -4,0 +4,0 @@ * License: MIT

/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -4,0 +4,0 @@ * License: MIT

/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -4,0 +4,0 @@ * License: MIT

/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -4,0 +4,0 @@ * License: MIT

/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -4,0 +4,0 @@ * License: MIT

/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -4,0 +4,0 @@ * License: MIT

/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -4,0 +4,0 @@ * License: MIT

/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -176,3 +176,3 @@ * License: MIT

*
* @experimental
* @publicApi 22.0
*/

@@ -188,3 +188,3 @@ interface RxResourceOptions<T, R> extends BaseResourceOptions<T, R> {

*
* @experimental
* @publicApi 22.0
*/

@@ -198,3 +198,3 @@ declare function rxResource<T, R>(opts: RxResourceOptions<T, R> & {

*
* @experimental
* @publicApi 22.0
*/

@@ -201,0 +201,0 @@ declare function rxResource<T, R>(opts: RxResourceOptions<T, R>): ResourceRef<T | undefined>;

/**
* @license Angular v22.0.0-next.10
* @license Angular v22.0.0-next.11
* (c) 2010-2026 Google LLC. https://angular.dev/

@@ -4,0 +4,0 @@ * License: MIT

'use strict';
/**
* @license Angular v22.0.0-next.10
* (c) 2010-2026 Google LLC. https://angular.dev/
* License: MIT
*/
'use strict';
var ts = require('typescript');
var compilerCli = require('@angular/compiler-cli');
var migrations = require('@angular/compiler-cli/private/migrations');
require('node:path');
var project_paths = require('./project_paths-D2V-Uh2L.cjs');
var compiler = require('@angular/compiler');
function getMemberName(member) {
if (member.name === undefined) {
return null;
}
if (ts.isIdentifier(member.name) || ts.isStringLiteralLike(member.name)) {
return member.name.text;
}
if (ts.isPrivateIdentifier(member.name)) {
return `#${member.name.text}`;
}
return null;
}
/** Checks whether the given node can be an `@Input()` declaration node. */
function isInputContainerNode(node) {
return (((ts.isAccessor(node) && ts.isClassDeclaration(node.parent)) ||
ts.isPropertyDeclaration(node)) &&
getMemberName(node) !== null);
}
/**
* Detects `query(By.directive(T)).componentInstance` patterns and enhances
* them with information of `T`. This is important because `.componentInstance`
* is currently typed as `any` and may cause runtime test failures after input
* migrations then.
*
* The reference resolution pass leverages information from this pattern
* recognizer.
*/
class DebugElementComponentInstance {
checker;
cache = new WeakMap();
constructor(checker) {
this.checker = checker;
}
detect(node) {
if (this.cache.has(node)) {
return this.cache.get(node);
}
if (!ts.isPropertyAccessExpression(node)) {
return null;
}
// Check for `<>.componentInstance`.
if (!ts.isIdentifier(node.name) || node.name.text !== 'componentInstance') {
return null;
}
// Check for `<>.query(..).<>`.
if (!ts.isCallExpression(node.expression) ||
!ts.isPropertyAccessExpression(node.expression.expression) ||
!ts.isIdentifier(node.expression.expression.name) ||
node.expression.expression.name.text !== 'query') {
return null;
}
const queryCall = node.expression;
if (queryCall.arguments.length !== 1) {
return null;
}
const queryArg = queryCall.arguments[0];
let typeExpr;
if (ts.isCallExpression(queryArg) &&
queryArg.arguments.length === 1 &&
ts.isIdentifier(queryArg.arguments[0])) {
// Detect references, like: `query(By.directive(T))`.
typeExpr = queryArg.arguments[0];
}
else if (ts.isIdentifier(queryArg)) {
// Detect references, like: `harness.query(T)`.
typeExpr = queryArg;
}
else {
return null;
}
const symbol = this.checker.getSymbolAtLocation(typeExpr);
if (symbol?.valueDeclaration === undefined ||
!ts.isClassDeclaration(symbol?.valueDeclaration)) {
// Cache this as we use the expensive type checker.
this.cache.set(node, null);
return null;
}
const type = this.checker.getTypeAtLocation(symbol.valueDeclaration);
this.cache.set(node, type);
return type;
}
}
/**
* Recognizes `Partial<T>` instances in Catalyst tests. Those type queries
* are likely used for typing property initialization values for the given class `T`
* and we have a few scenarios:
*
* 1. The API does not unwrap signal inputs. In which case, the values are likely no
* longer assignable to an `InputSignal`.
* 2. The API does unwrap signal inputs, in which case we need to unwrap the `Partial`
* because the values are raw initial values, like they were before.
*
* We can enable this heuristic when we detect Catalyst as we know it supports unwrapping.
*/
class PartialDirectiveTypeInCatalystTests {
checker;
knownFields;
constructor(checker, knownFields) {
this.checker = checker;
this.knownFields = knownFields;
}
detect(node) {
// Detect `Partial<...>`
if (!ts.isTypeReferenceNode(node) ||
!ts.isIdentifier(node.typeName) ||
node.typeName.text !== 'Partial') {
return null;
}
// Ignore if the source file doesn't reference Catalyst.
if (!node.getSourceFile().text.includes('angular2/testing/catalyst')) {
return null;
}
// Extract T of `Partial<T>`.
const cmpTypeArg = node.typeArguments?.[0];
if (!cmpTypeArg ||
!ts.isTypeReferenceNode(cmpTypeArg) ||
!ts.isIdentifier(cmpTypeArg.typeName)) {
return null;
}
const cmpType = cmpTypeArg.typeName;
const symbol = this.checker.getSymbolAtLocation(cmpType);
// Note: Technically the class might be derived of an input-containing class,
// but this is out of scope for now. We can expand if we see it's a common case.
if (symbol?.valueDeclaration === undefined ||
!ts.isClassDeclaration(symbol.valueDeclaration) ||
!this.knownFields.shouldTrackClassReference(symbol.valueDeclaration)) {
return null;
}
return { referenceNode: node, targetClass: symbol.valueDeclaration };
}
}
/**
* Attempts to look up the given property access chain using
* the type checker.
*
* Notably this is not as safe as using the type checker directly to
* retrieve symbols of a given identifier, but in some cases this is
* a necessary approach to compensate e.g. for a lack of TCB information
* when processing Angular templates.
*
* The path is a list of properties to be accessed sequentially on the
* given type.
*/
function lookupPropertyAccess(checker, type, path, options = {}) {
let symbol = null;
for (const propName of path) {
// Note: We support assuming `NonNullable` for the pathl This is necessary
// in some situations as otherwise the lookups would fail to resolve the target
// symbol just because of e.g. a ternary. This is used in the signal input migration
// for host bindings.
type = options.ignoreNullability ? type.getNonNullableType() : type;
const propSymbol = type.getProperty(propName);
if (propSymbol === undefined) {
return null;
}
symbol = propSymbol;
type = checker.getTypeOfSymbol(propSymbol);
}
if (symbol === null) {
return null;
}
return { symbol, type };
}
/**
* AST visitor that iterates through a template and finds all
* input references.
*
* This resolution is important to be able to migrate references to inputs
* that will be migrated to signal inputs.
*/
class TemplateReferenceVisitor extends compiler.TmplAstRecursiveVisitor {
result = [];
/**
* Whether we are currently descending into HTML AST nodes
* where all bound attributes are considered potentially narrowing.
*
* Keeps track of all referenced inputs in such attribute expressions.
*/
templateAttributeReferencedFields = null;
expressionVisitor;
seenKnownFieldsCount = new Map();
constructor(typeChecker, templateTypeChecker, componentClass, knownFields, fieldNamesToConsiderForReferenceLookup) {
super();
this.expressionVisitor = new TemplateExpressionReferenceVisitor(typeChecker, templateTypeChecker, componentClass, knownFields, fieldNamesToConsiderForReferenceLookup);
}
checkExpressionForReferencedFields(activeNode, expressionNode) {
const referencedFields = this.expressionVisitor.checkTemplateExpression(activeNode, expressionNode);
// Add all references to the overall visitor result.
this.result.push(...referencedFields);
// Count usages of seen input references. We'll use this to make decisions
// based on whether inputs are potentially narrowed or not.
for (const input of referencedFields) {
this.seenKnownFieldsCount.set(input.targetField.key, (this.seenKnownFieldsCount.get(input.targetField.key) ?? 0) + 1);
}
return referencedFields;
}
descendAndCheckForNarrowedSimilarReferences(potentiallyNarrowedInputs, descend) {
const inputs = potentiallyNarrowedInputs.map((i) => ({
ref: i,
key: i.targetField.key,
pastCount: this.seenKnownFieldsCount.get(i.targetField.key) ?? 0,
}));
descend();
for (const input of inputs) {
// Input was referenced inside a narrowable spot, and is used in child nodes.
// This is a sign for the input to be narrowed. Mark it as such.
if ((this.seenKnownFieldsCount.get(input.key) ?? 0) > input.pastCount) {
input.ref.isLikelyNarrowed = true;
}
}
}
visitTemplate(template) {
// Note: We assume all bound expressions for templates may be subject
// to TCB narrowing. This is relevant for now until we support narrowing
// of signal calls in templates.
// TODO: Remove with: https://github.com/angular/angular/pull/55456.
this.templateAttributeReferencedFields = [];
compiler.tmplAstVisitAll(this, template.attributes);
compiler.tmplAstVisitAll(this, template.templateAttrs);
// If we are dealing with a microsyntax template, do not check
// inputs and outputs as those are already passed to the children.
// Template attributes may contain relevant expressions though.
if (template.tagName === 'ng-template') {
compiler.tmplAstVisitAll(this, template.inputs);
compiler.tmplAstVisitAll(this, template.outputs);
}
const referencedInputs = this.templateAttributeReferencedFields;
this.templateAttributeReferencedFields = null;
this.descendAndCheckForNarrowedSimilarReferences(referencedInputs, () => {
compiler.tmplAstVisitAll(this, template.children);
compiler.tmplAstVisitAll(this, template.references);
compiler.tmplAstVisitAll(this, template.variables);
});
}
visitIfBlockBranch(block) {
if (block.expression) {
const referencedFields = this.checkExpressionForReferencedFields(block, block.expression);
this.descendAndCheckForNarrowedSimilarReferences(referencedFields, () => {
super.visitIfBlockBranch(block);
});
}
else {
super.visitIfBlockBranch(block);
}
}
visitForLoopBlock(block) {
this.checkExpressionForReferencedFields(block, block.expression);
this.checkExpressionForReferencedFields(block, block.trackBy);
super.visitForLoopBlock(block);
}
visitSwitchBlock(block) {
const referencedFields = this.checkExpressionForReferencedFields(block, block.expression);
this.descendAndCheckForNarrowedSimilarReferences(referencedFields, () => {
super.visitSwitchBlock(block);
});
}
visitSwitchBlockCase(block) {
if (block.expression) {
const referencedFields = this.checkExpressionForReferencedFields(block, block.expression);
this.descendAndCheckForNarrowedSimilarReferences(referencedFields, () => {
super.visitSwitchBlockCase(block);
});
}
else {
super.visitSwitchBlockCase(block);
}
}
visitDeferredBlock(deferred) {
if (deferred.triggers.when) {
this.checkExpressionForReferencedFields(deferred, deferred.triggers.when.value);
}
if (deferred.prefetchTriggers.when) {
this.checkExpressionForReferencedFields(deferred, deferred.prefetchTriggers.when.value);
}
super.visitDeferredBlock(deferred);
}
visitBoundText(text) {
this.checkExpressionForReferencedFields(text, text.value);
}
visitBoundEvent(attribute) {
this.checkExpressionForReferencedFields(attribute, attribute.handler);
}
visitBoundAttribute(attribute) {
const referencedFields = this.checkExpressionForReferencedFields(attribute, attribute.value);
// Attributes inside templates are potentially "narrowed" and hence we
// keep track of all referenced inputs to see if they actually are.
if (this.templateAttributeReferencedFields !== null) {
this.templateAttributeReferencedFields.push(...referencedFields);
}
}
}
/**
* Expression AST visitor that checks whether a given expression references
* a known `@Input()`.
*
* This resolution is important to be able to migrate references to inputs
* that will be migrated to signal inputs.
*/
class TemplateExpressionReferenceVisitor extends compiler.RecursiveAstVisitor {
typeChecker;
templateTypeChecker;
componentClass;
knownFields;
fieldNamesToConsiderForReferenceLookup;
activeTmplAstNode = null;
detectedInputReferences = [];
isInsideObjectShorthandExpression = false;
insideConditionalExpressionsWithReads = [];
constructor(typeChecker, templateTypeChecker, componentClass, knownFields, fieldNamesToConsiderForReferenceLookup) {
super();
this.typeChecker = typeChecker;
this.templateTypeChecker = templateTypeChecker;
this.componentClass = componentClass;
this.knownFields = knownFields;
this.fieldNamesToConsiderForReferenceLookup = fieldNamesToConsiderForReferenceLookup;
}
/** Checks the given AST expression. */
checkTemplateExpression(activeNode, expressionNode) {
this.detectedInputReferences = [];
this.activeTmplAstNode = activeNode;
expressionNode.visit(this, []);
return this.detectedInputReferences;
}
visit(ast, context) {
super.visit(ast, [...context, ast]);
}
// Keep track when we are inside an object shorthand expression. This is
// necessary as we need to expand the shorthand to invoke a potential new signal.
// E.g. `{bla}` may be transformed to `{bla: bla()}`.
visitLiteralMap(ast, context) {
for (const [idx, key] of ast.keys.entries()) {
this.isInsideObjectShorthandExpression =
key.kind === 'property' && !!key.isShorthandInitialized;
ast.values[idx].visit(this, context);
this.isInsideObjectShorthandExpression = false;
}
}
visitPropertyRead(ast, context) {
this._inspectPropertyAccess(ast, false, context);
super.visitPropertyRead(ast, context);
}
visitSafePropertyRead(ast, context) {
this._inspectPropertyAccess(ast, false, context);
super.visitPropertyRead(ast, context);
}
visitBinary(ast, context) {
if (ast.operation === '=' && ast.left instanceof compiler.PropertyRead) {
this._inspectPropertyAccess(ast.left, true, [...context, ast, ast.left]);
}
else {
super.visitBinary(ast, context);
}
}
visitConditional(ast, context) {
this.visit(ast.condition, context);
this.insideConditionalExpressionsWithReads.push(ast.condition);
this.visit(ast.trueExp, context);
this.visit(ast.falseExp, context);
this.insideConditionalExpressionsWithReads.pop();
}
/**
* Inspects the property access and attempts to resolve whether they access
* a known field. If so, the result is captured.
*/
_inspectPropertyAccess(ast, isAssignment, astPath) {
if (this.fieldNamesToConsiderForReferenceLookup !== null &&
!this.fieldNamesToConsiderForReferenceLookup.has(ast.name)) {
return;
}
const isWrite = !!(isAssignment ||
(this.activeTmplAstNode && isTwoWayBindingNode(this.activeTmplAstNode)));
this._checkAccessViaTemplateTypeCheckBlock(ast, isWrite, astPath) ||
this._checkAccessViaOwningComponentClassType(ast, isWrite, astPath);
}
/**
* Checks whether the node refers to an input using the TCB information.
* Type check block may not exist for e.g. test components, so this can return `null`.
*/
_checkAccessViaTemplateTypeCheckBlock(ast, isWrite, astPath) {
// There might be no template type checker. E.g. if we check host bindings.
if (this.templateTypeChecker === null) {
return false;
}
const symbol = this.templateTypeChecker.getSymbolOfNode(ast, this.componentClass);
if (symbol?.kind !== migrations.SymbolKind.Expression) {
return false;
}
const tsSymbol = this.templateTypeChecker.getTsSymbolOfSymbol(symbol);
if (tsSymbol === null) {
return false;
}
// Dangerous: Type checking symbol retrieval is a totally different `ts.Program`,
// than the one where we analyzed `knownInputs`.
// --> Find the input via its input id.
const targetInput = this.knownFields.attemptRetrieveDescriptorFromSymbol(tsSymbol);
if (targetInput === null) {
return false;
}
this.detectedInputReferences.push({
targetNode: targetInput.node,
targetField: targetInput,
read: ast,
readAstPath: astPath,
context: this.activeTmplAstNode,
isLikelyNarrowed: this._isPartOfNarrowingTernary(ast),
isObjectShorthandExpression: this.isInsideObjectShorthandExpression,
isWrite,
});
return true;
}
/**
* Simple resolution checking whether the given AST refers to a known input.
* This is a fallback for when there is no type checking information (e.g. in host bindings).
*
* It attempts to resolve references by traversing accesses of the "component class" type.
* e.g. `this.bla` is resolved via `CompType#bla` and further.
*/
_checkAccessViaOwningComponentClassType(ast, isWrite, astPath) {
// We might check host bindings, which can never point to template variables or local refs.
const expressionTemplateTarget = this.templateTypeChecker === null
? null
: this.templateTypeChecker.getExpressionTarget(ast, this.componentClass);
// Skip checking if:
// - the reference resolves to a template variable or local ref. No way to resolve without TCB.
// - the owning component does not have a name (should not happen technically).
if (expressionTemplateTarget !== null || this.componentClass.name === undefined) {
return;
}
const property = traverseReceiverAndLookupSymbol(ast, this.componentClass, this.typeChecker);
if (property === null) {
return;
}
const matchingTarget = this.knownFields.attemptRetrieveDescriptorFromSymbol(property);
if (matchingTarget === null) {
return;
}
this.detectedInputReferences.push({
targetNode: matchingTarget.node,
targetField: matchingTarget,
read: ast,
readAstPath: astPath,
context: this.activeTmplAstNode,
isLikelyNarrowed: this._isPartOfNarrowingTernary(ast),
isObjectShorthandExpression: this.isInsideObjectShorthandExpression,
isWrite,
});
}
_isPartOfNarrowingTernary(read) {
// Note: We do not safe check that the reads are fully matching 1:1. This is acceptable
// as worst case we just skip an input from being migrated. This is very unlikely too.
return this.insideConditionalExpressionsWithReads.some((r) => (r instanceof compiler.PropertyRead || r instanceof compiler.SafePropertyRead) && r.name === read.name);
}
}
/**
* Emulates an access to a given field using the TypeScript `ts.Type`
* of the given class. The resolved symbol of the access is returned.
*/
function traverseReceiverAndLookupSymbol(readOrWrite, componentClass, checker) {
const path = [readOrWrite.name];
let node = readOrWrite;
while (node.receiver instanceof compiler.PropertyRead) {
node = node.receiver;
path.unshift(node.name);
}
if (!(node.receiver instanceof compiler.ImplicitReceiver)) {
return null;
}
const classType = checker.getTypeAtLocation(componentClass.name);
return (lookupPropertyAccess(checker, classType, path, {
// Necessary to avoid breaking the resolution if there is
// some narrowing involved. E.g. `myClass ? myClass.input`.
ignoreNullability: true,
})?.symbol ?? null);
}
/** Whether the given node refers to a two-way binding AST node. */
function isTwoWayBindingNode(node) {
return ((node instanceof compiler.TmplAstBoundAttribute && node.type === compiler.BindingType.TwoWay) ||
(node instanceof compiler.TmplAstBoundEvent && node.type === compiler.ParsedEventType.TwoWay));
}
/** Possible types of references to known fields detected. */
exports.ReferenceKind = void 0;
(function (ReferenceKind) {
ReferenceKind[ReferenceKind["InTemplate"] = 0] = "InTemplate";
ReferenceKind[ReferenceKind["InHostBinding"] = 1] = "InHostBinding";
ReferenceKind[ReferenceKind["TsReference"] = 2] = "TsReference";
ReferenceKind[ReferenceKind["TsClassTypeReference"] = 3] = "TsClassTypeReference";
})(exports.ReferenceKind || (exports.ReferenceKind = {}));
/** Whether the given reference is a TypeScript reference. */
function isTsReference(ref) {
return ref.kind === exports.ReferenceKind.TsReference;
}
/** Whether the given reference is a template reference. */
function isTemplateReference(ref) {
return ref.kind === exports.ReferenceKind.InTemplate;
}
/** Whether the given reference is a host binding reference. */
function isHostBindingReference(ref) {
return ref.kind === exports.ReferenceKind.InHostBinding;
}
/**
* Whether the given reference is a TypeScript `ts.Type` reference
* to a class containing known fields.
*/
function isTsClassTypeReference(ref) {
return ref.kind === exports.ReferenceKind.TsClassTypeReference;
}
/**
* Checks host bindings of the given class and tracks all
* references to inputs within bindings.
*/
function identifyHostBindingReferences(node, programInfo, checker, reflector, result, knownFields, fieldNamesToConsiderForReferenceLookup) {
if (node.name === undefined) {
return;
}
const decorators = reflector.getDecoratorsOfDeclaration(node);
if (decorators === null) {
return;
}
const angularDecorators = migrations.getAngularDecorators(decorators, ['Directive', 'Component'],
/* isAngularCore */ false);
if (angularDecorators.length === 0) {
return;
}
// Assume only one Angular decorator per class.
const ngDecorator = angularDecorators[0];
if (ngDecorator.args?.length !== 1) {
return;
}
const metadataNode = migrations.unwrapExpression(ngDecorator.args[0]);
if (!ts.isObjectLiteralExpression(metadataNode)) {
return;
}
const metadata = migrations.reflectObjectLiteral(metadataNode);
if (!metadata.has('host')) {
return;
}
let hostField = migrations.unwrapExpression(metadata.get('host'));
// Special-case in case host bindings are shared via a variable.
// e.g. Material button shares host bindings as a constant in the same target.
if (ts.isIdentifier(hostField)) {
let symbol = checker.getSymbolAtLocation(hostField);
// Plain identifier references can point to alias symbols (e.g. imports).
if (symbol !== undefined && symbol.flags & ts.SymbolFlags.Alias) {
symbol = checker.getAliasedSymbol(symbol);
}
if (symbol !== undefined &&
symbol.valueDeclaration !== undefined &&
ts.isVariableDeclaration(symbol.valueDeclaration)) {
hostField = symbol?.valueDeclaration.initializer;
}
}
if (hostField === undefined || !ts.isObjectLiteralExpression(hostField)) {
return;
}
const hostMap = migrations.reflectObjectLiteral(hostField);
const expressionResult = [];
const expressionVisitor = new TemplateExpressionReferenceVisitor(checker, null, node, knownFields, fieldNamesToConsiderForReferenceLookup);
for (const [rawName, expression] of hostMap.entries()) {
if (!ts.isStringLiteralLike(expression)) {
continue;
}
const isEventBinding = rawName.startsWith('(');
const isPropertyBinding = rawName.startsWith('[');
// Only migrate property or event bindings.
if (!isPropertyBinding && !isEventBinding) {
continue;
}
const parser = compiler.makeBindingParser();
const sourceSpan = new compiler.ParseSourceSpan(
// Fake source span to keep parsing offsets zero-based.
// We then later combine these with the expression TS node offsets.
new compiler.ParseLocation({ content: '', url: '' }, 0, 0, 0), new compiler.ParseLocation({ content: '', url: '' }, 0, 0, 0));
const name = rawName.substring(1, rawName.length - 1);
let parsed = undefined;
if (isEventBinding) {
const result = [];
parser.parseEvent(name.substring(1, name.length - 1), expression.text, false, sourceSpan, sourceSpan, [], result, sourceSpan);
parsed = result[0].handler;
}
else {
const result = [];
parser.parsePropertyBinding(name, expression.text, true,
/* isTwoWayBinding */ false, sourceSpan, 0, sourceSpan, [], result, sourceSpan);
parsed = result[0].expression;
}
if (parsed != null) {
expressionResult.push(...expressionVisitor.checkTemplateExpression(expression, parsed));
}
}
for (const ref of expressionResult) {
result.references.push({
kind: exports.ReferenceKind.InHostBinding,
from: {
read: ref.read,
readAstPath: ref.readAstPath,
isObjectShorthandExpression: ref.isObjectShorthandExpression,
isWrite: ref.isWrite,
file: project_paths.projectFile(ref.context.getSourceFile(), programInfo),
hostPropertyNode: ref.context,
},
target: ref.targetField,
});
}
}
/**
* Attempts to extract the `TemplateDefinition` for the given
* class, if possible.
*
* The definition can then be used with the Angular compiler to
* load/parse the given template.
*/
function attemptExtractTemplateDefinition(node, checker, reflector, resourceLoader) {
const classDecorators = reflector.getDecoratorsOfDeclaration(node);
const evaluator = new migrations.PartialEvaluator(reflector, checker, null);
const ngDecorators = classDecorators !== null
? migrations.getAngularDecorators(classDecorators, ['Component'], /* isAngularCore */ false)
: [];
if (ngDecorators.length === 0 ||
ngDecorators[0].args === null ||
ngDecorators[0].args.length === 0 ||
!ts.isObjectLiteralExpression(ngDecorators[0].args[0])) {
return null;
}
const properties = migrations.reflectObjectLiteral(ngDecorators[0].args[0]);
const templateProp = properties.get('template');
const templateUrlProp = properties.get('templateUrl');
const containingFile = node.getSourceFile().fileName;
// inline template.
if (templateProp !== undefined) {
const templateStr = evaluator.evaluate(templateProp);
if (typeof templateStr === 'string') {
return {
isInline: true,
expression: templateProp,
preserveWhitespaces: false,
resolvedTemplateUrl: containingFile,
templateUrl: containingFile,
};
}
}
try {
// external template.
if (templateUrlProp !== undefined) {
const templateUrl = evaluator.evaluate(templateUrlProp);
if (typeof templateUrl === 'string') {
return {
isInline: false,
preserveWhitespaces: false,
templateUrlExpression: templateUrlProp,
templateUrl,
resolvedTemplateUrl: resourceLoader.resolve(templateUrl, containingFile),
};
}
}
}
catch (e) {
console.error(`Could not parse external template: ${e}`);
}
return null;
}
/**
* Checks whether the given class has an Angular template, and resolves
* all of the references to inputs.
*/
function identifyTemplateReferences(programInfo, node, reflector, checker, evaluator, templateTypeChecker, resourceLoader, options, result, knownFields, fieldNamesToConsiderForReferenceLookup) {
const template = templateTypeChecker.getTemplate(node, compilerCli.OptimizeFor.WholeProgram) ??
// If there is no template registered in the TCB or compiler, the template may
// be skipped due to an explicit `jit: true` setting. We try to detect this case
// and parse the template manually.
extractTemplateWithoutCompilerAnalysis(node, checker, reflector, resourceLoader, evaluator, options);
if (template !== null) {
const visitor = new TemplateReferenceVisitor(checker, templateTypeChecker, node, knownFields, fieldNamesToConsiderForReferenceLookup);
template.forEach((node) => node.visit(visitor));
for (const res of visitor.result) {
const templateFilePath = res.context.sourceSpan.start.file.url;
// Templates without an URL are non-mappable artifacts of e.g.
// string concatenated templates. See the `indirect` template
// source mapping concept in the compiler. We skip such references
// as those cannot be migrated, but print an error for now.
if (templateFilePath === '') {
// TODO: Incorporate a TODO potentially.
console.error(`Found reference to field ${res.targetField.key} that cannot be ` +
`migrated because the template cannot be parsed with source map information ` +
`(in file: ${node.getSourceFile().fileName}).`);
continue;
}
result.references.push({
kind: exports.ReferenceKind.InTemplate,
from: {
read: res.read,
readAstPath: res.readAstPath,
node: res.context,
isObjectShorthandExpression: res.isObjectShorthandExpression,
originatingTsFile: project_paths.projectFile(node.getSourceFile(), programInfo),
templateFile: project_paths.projectFile(compilerCli.absoluteFrom(templateFilePath), programInfo),
isLikelyPartOfNarrowing: res.isLikelyNarrowed,
isWrite: res.isWrite,
},
target: res.targetField,
});
}
}
}
/**
* Attempts to extract a `@Component` template from the given class,
* without relying on the `NgCompiler` program analysis.
*
* This is useful for JIT components using `jit: true` which were not
* processed by the Angular compiler, but may still have templates that
* contain references to inputs that we can resolve via the fallback
* reference resolutions (that does not use the type check block).
*/
function extractTemplateWithoutCompilerAnalysis(node, checker, reflector, resourceLoader, evaluator, options) {
if (node.name === undefined) {
return null;
}
const tmplDef = attemptExtractTemplateDefinition(node, checker, reflector, resourceLoader);
if (tmplDef === null) {
return null;
}
return migrations.extractTemplate(node, tmplDef, evaluator, null, resourceLoader, {
enableBlockSyntax: true,
enableLetSyntax: true,
usePoisonedData: true,
enableI18nLegacyMessageIdFormat: options.enableI18nLegacyMessageIdFormat !== false,
i18nNormalizeLineEndingsInICUs: options.i18nNormalizeLineEndingsInICUs === true,
enableSelectorless: false,
}, migrations.CompilationMode.FULL).nodes;
}
/** Gets the pattern and property name for a given binding element. */
function resolveBindingElement(node) {
const name = node.propertyName ?? node.name;
// If we are discovering a non-analyzable element in the path, abort.
if (!ts.isStringLiteralLike(name) && !ts.isIdentifier(name)) {
return null;
}
return {
pattern: node.parent,
propertyName: name.text,
};
}
/** Gets the declaration node of the given binding element. */
function getBindingElementDeclaration(node) {
while (true) {
if (ts.isBindingElement(node.parent.parent)) {
node = node.parent.parent;
}
else {
return node.parent.parent;
}
}
}
/**
* Expands the given reference to its containing expression, capturing
* the full context.
*
* E.g. `traverseAccess(ref<`bla`>)` may return `this.bla`
* or `traverseAccess(ref<`bla`>)` may return `this.someObj.a.b.c.bla`.
*
* This helper is useful as we will replace the full access with a temporary
* variable for narrowing. Replacing just the identifier is wrong.
*/
function traverseAccess(access) {
if (ts.isPropertyAccessExpression(access.parent) && access.parent.name === access) {
return access.parent;
}
else if (ts.isElementAccessExpression(access.parent) &&
access.parent.argumentExpression === access) {
return access.parent;
}
return access;
}
/**
* Unwraps the parent of the given node, if it's a
* parenthesized expression or `as` expression.
*/
function unwrapParent(node) {
if (ts.isParenthesizedExpression(node.parent)) {
return unwrapParent(node.parent);
}
else if (ts.isAsExpression(node.parent)) {
return unwrapParent(node.parent);
}
return node;
}
/**
* List of binary operators that indicate a write operation.
*
* Useful for figuring out whether an expression assigns to
* something or not.
*/
const writeBinaryOperators = [
ts.SyntaxKind.EqualsToken,
ts.SyntaxKind.BarBarEqualsToken,
ts.SyntaxKind.BarEqualsToken,
ts.SyntaxKind.AmpersandEqualsToken,
ts.SyntaxKind.AmpersandAmpersandEqualsToken,
ts.SyntaxKind.SlashEqualsToken,
ts.SyntaxKind.MinusEqualsToken,
ts.SyntaxKind.PlusEqualsToken,
ts.SyntaxKind.CaretEqualsToken,
ts.SyntaxKind.PercentEqualsToken,
ts.SyntaxKind.AsteriskEqualsToken,
ts.SyntaxKind.ExclamationEqualsToken,
];
/**
* Checks whether given TypeScript reference refers to an Angular input, and captures
* the reference if possible.
*
* @param fieldNamesToConsiderForReferenceLookup List of field names that should be
* respected when expensively looking up references to known fields.
* May be null if all identifiers should be inspected.
*/
function identifyPotentialTypeScriptReference(node, programInfo, checker, knownFields, result, fieldNamesToConsiderForReferenceLookup, advisors) {
// Skip all identifiers that never can point to a migrated field.
// TODO: Capture these assumptions and performance optimizations in the design doc.
if (fieldNamesToConsiderForReferenceLookup !== null &&
!fieldNamesToConsiderForReferenceLookup.has(node.text)) {
return;
}
let target = undefined;
try {
// Resolve binding elements to their declaration symbol.
// Commonly inputs are accessed via object expansion. e.g. `const {input} = this;`.
if (ts.isBindingElement(node.parent)) {
// Skip binding elements that are using spread.
if (node.parent.dotDotDotToken !== undefined) {
return;
}
const bindingInfo = resolveBindingElement(node.parent);
if (bindingInfo === null) {
// The declaration could not be resolved. Skip analyzing this.
return;
}
const bindingType = checker.getTypeAtLocation(bindingInfo.pattern);
const resolved = lookupPropertyAccess(checker, bindingType, [bindingInfo.propertyName]);
target = resolved?.symbol;
}
else {
target = checker.getSymbolAtLocation(node);
}
}
catch (e) {
console.error('Unexpected error while trying to resolve identifier reference:');
console.error(e);
// Gracefully skip analyzing. This can happen when e.g. a reference is named similar
// to an input, but is dependant on `.d.ts` that is not necessarily available (clutz dts).
return;
}
noTargetSymbolCheck: if (target === undefined) {
if (ts.isPropertyAccessExpression(node.parent) && node.parent.name === node) {
const propAccessSymbol = checker.getSymbolAtLocation(node.parent.expression);
if (propAccessSymbol !== undefined &&
propAccessSymbol.valueDeclaration !== undefined &&
ts.isVariableDeclaration(propAccessSymbol.valueDeclaration) &&
propAccessSymbol.valueDeclaration.initializer !== undefined) {
target = advisors.debugElComponentInstanceTracker
.detect(propAccessSymbol.valueDeclaration.initializer)
?.getProperty(node.text);
// We found a target in the fallback path. Break out.
if (target !== undefined) {
break noTargetSymbolCheck;
}
}
}
return;
}
let targetInput = knownFields.attemptRetrieveDescriptorFromSymbol(target);
if (targetInput === null) {
return;
}
const access = unwrapParent(traverseAccess(node));
const accessParent = access.parent;
const isWriteReference = ts.isBinaryExpression(accessParent) &&
accessParent.left === access &&
writeBinaryOperators.includes(accessParent.operatorToken.kind);
// track accesses from source files to known fields.
result.references.push({
kind: exports.ReferenceKind.TsReference,
from: {
node,
file: project_paths.projectFile(node.getSourceFile(), programInfo),
isWrite: isWriteReference,
isPartOfElementBinding: ts.isBindingElement(node.parent),
},
target: targetInput,
});
}
/**
* Phase where we iterate through all source file references and
* detect references to known fields (e.g. commonly inputs).
*
* This is useful, for example in the signal input migration whe
* references need to be migrated to unwrap signals, given that
* their target properties is no longer holding a raw value, but
* instead an `InputSignal`.
*
* This phase detects references in all types of locations:
* - TS source files
* - Angular templates (inline or external)
* - Host binding expressions.
*/
function createFindAllSourceFileReferencesVisitor(programInfo, checker, reflector, resourceLoader, evaluator, templateTypeChecker, knownFields, fieldNamesToConsiderForReferenceLookup, result) {
const debugElComponentInstanceTracker = new DebugElementComponentInstance(checker);
const partialDirectiveCatalystTracker = new PartialDirectiveTypeInCatalystTests(checker, knownFields);
const perfCounters = {
template: 0,
hostBindings: 0,
tsReferences: 0,
tsTypes: 0,
};
// Schematic NodeJS execution may not have `global.performance` defined.
const currentTimeInMs = () => typeof global.performance !== 'undefined' ? global.performance.now() : Date.now();
const visitor = (node) => {
let lastTime = currentTimeInMs();
// Note: If there is no template type checker and resource loader, we aren't processing
// an Angular program, and can skip template detection.
if (ts.isClassDeclaration(node) && templateTypeChecker !== null && resourceLoader !== null) {
identifyTemplateReferences(programInfo, node, reflector, checker, evaluator, templateTypeChecker, resourceLoader, programInfo.userOptions, result, knownFields, fieldNamesToConsiderForReferenceLookup);
perfCounters.template += (currentTimeInMs() - lastTime) / 1000;
lastTime = currentTimeInMs();
identifyHostBindingReferences(node, programInfo, checker, reflector, result, knownFields, fieldNamesToConsiderForReferenceLookup);
perfCounters.hostBindings += (currentTimeInMs() - lastTime) / 1000;
lastTime = currentTimeInMs();
}
lastTime = currentTimeInMs();
// find references, but do not capture input declarations itself.
if (ts.isIdentifier(node) &&
!(isInputContainerNode(node.parent) && node.parent.name === node)) {
identifyPotentialTypeScriptReference(node, programInfo, checker, knownFields, result, fieldNamesToConsiderForReferenceLookup, {
debugElComponentInstanceTracker,
});
}
perfCounters.tsReferences += (currentTimeInMs() - lastTime) / 1000;
lastTime = currentTimeInMs();
// Detect `Partial<T>` references.
// Those are relevant to be tracked as they may be updated in Catalyst to
// unwrap signal inputs. Commonly people use `Partial` in Catalyst to type
// some "component initial values".
const partialDirectiveInCatalyst = partialDirectiveCatalystTracker.detect(node);
if (partialDirectiveInCatalyst !== null) {
result.references.push({
kind: exports.ReferenceKind.TsClassTypeReference,
from: {
file: project_paths.projectFile(partialDirectiveInCatalyst.referenceNode.getSourceFile(), programInfo),
node: partialDirectiveInCatalyst.referenceNode,
},
isPartialReference: true,
isPartOfCatalystFile: true,
target: partialDirectiveInCatalyst.targetClass,
});
}
perfCounters.tsTypes += (currentTimeInMs() - lastTime) / 1000;
};
return {
visitor,
debugPrintMetrics: () => {
console.info('Source file analysis performance', perfCounters);
},
};
}
exports.createFindAllSourceFileReferencesVisitor = createFindAllSourceFileReferencesVisitor;
exports.getBindingElementDeclaration = getBindingElementDeclaration;
exports.getMemberName = getMemberName;
exports.isHostBindingReference = isHostBindingReference;
exports.isInputContainerNode = isInputContainerNode;
exports.isTemplateReference = isTemplateReference;
exports.isTsClassTypeReference = isTsClassTypeReference;
exports.isTsReference = isTsReference;
exports.traverseAccess = traverseAccess;
exports.unwrapParent = unwrapParent;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display