@angular/compiler-cli 21.0.0-rc.2 → 21.0.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/bundles/{chunk-JCBKDAHA.js → chunk-3UWOVJPM.js} +1 -1
  2. package/bundles/{chunk-Y65S2AOA.js → chunk-67N3I5R2.js} +1643 -1525
  3. package/bundles/{chunk-UI6E44E7.js → chunk-EZPRBQ4S.js} +2 -2
  4. package/bundles/{chunk-Z6XYTYZD.js → chunk-IUWOX36C.js} +1 -1
  5. package/bundles/chunk-ZJZNLTWN.js +1 -1
  6. package/bundles/index.js +4 -4
  7. package/bundles/private/migrations.js +2 -2
  8. package/bundles/private/testing.js +1 -1
  9. package/bundles/private/tooling.js +1 -1
  10. package/bundles/src/bin/ng_xi18n.js +4 -4
  11. package/bundles/src/bin/ngc.js +4 -4
  12. package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
  13. package/package.json +2 -2
  14. package/src/ngtsc/typecheck/src/ops/base.d.ts +43 -0
  15. package/src/ngtsc/typecheck/src/ops/bindings.d.ts +64 -0
  16. package/src/ngtsc/typecheck/src/ops/completions.d.ts +22 -0
  17. package/src/ngtsc/typecheck/src/ops/content_projection.d.ts +34 -0
  18. package/src/ngtsc/typecheck/src/ops/context.d.ts +67 -0
  19. package/src/ngtsc/typecheck/src/ops/directive_constructor.d.ts +59 -0
  20. package/src/ngtsc/typecheck/src/ops/directive_type.d.ts +53 -0
  21. package/src/ngtsc/typecheck/src/ops/element.d.ts +26 -0
  22. package/src/ngtsc/typecheck/src/ops/events.d.ts +55 -0
  23. package/src/ngtsc/typecheck/src/ops/expression.d.ts +49 -0
  24. package/src/ngtsc/typecheck/src/ops/for_block.d.ts +32 -0
  25. package/src/ngtsc/typecheck/src/ops/host.d.ts +25 -0
  26. package/src/ngtsc/typecheck/src/ops/if_block.d.ts +28 -0
  27. package/src/ngtsc/typecheck/src/ops/inputs.d.ts +56 -0
  28. package/src/ngtsc/typecheck/src/ops/intersection_observer.d.ts +22 -0
  29. package/src/ngtsc/typecheck/src/ops/let.d.ts +29 -0
  30. package/src/ngtsc/typecheck/src/ops/references.d.ts +57 -0
  31. package/src/ngtsc/typecheck/src/ops/schema.d.ts +31 -0
  32. package/src/ngtsc/typecheck/src/ops/scope.d.ts +187 -0
  33. package/src/ngtsc/typecheck/src/ops/selectorless.d.ts +26 -0
  34. package/src/ngtsc/typecheck/src/ops/signal_forms.d.ts +40 -0
  35. package/src/ngtsc/typecheck/src/ops/switch_block.d.ts +25 -0
  36. package/src/ngtsc/typecheck/src/ops/template.d.ts +40 -0
  37. package/src/ngtsc/typecheck/src/ops/variables.d.ts +56 -0
  38. package/src/ngtsc/typecheck/src/type_check_block.d.ts +2 -274
  39. package/src/ngtsc/typecheck/src/type_check_file.d.ts +1 -1
@@ -9790,7 +9790,7 @@ function _extractTemplateStyleUrls(template) {
9790
9790
 
9791
9791
  // packages/compiler-cli/src/ngtsc/annotations/component/src/handler.js
9792
9792
  import { compileClassDebugInfo, compileHmrInitializer, compileComponentClassMetadata, compileComponentDeclareClassMetadata, compileComponentFromMetadata, compileDeclareComponentFromMetadata, compileDeferResolverFunction, ConstantPool as ConstantPool2, CssSelector as CssSelector5, DomElementSchemaRegistry as DomElementSchemaRegistry3, ExternalExpr as ExternalExpr10, FactoryTarget as FactoryTarget3, makeBindingParser as makeBindingParser3, outputAst as o5, R3TargetBinder as R3TargetBinder2, R3TemplateDependencyKind, SelectorMatcher as SelectorMatcher3, ViewEncapsulation as ViewEncapsulation2, SelectorlessMatcher as SelectorlessMatcher2 } from "@angular/compiler";
9793
- import ts74 from "typescript";
9793
+ import ts94 from "typescript";
9794
9794
 
9795
9795
  // packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/api.js
9796
9796
  import ts43 from "typescript";
@@ -10909,7 +10909,7 @@ var TypeCheckScopeRegistry = class {
10909
10909
 
10910
10910
  // packages/compiler-cli/src/ngtsc/annotations/directive/src/handler.js
10911
10911
  import { compileClassMetadata, compileDeclareClassMetadata, compileDeclareDirectiveFromMetadata, compileDirectiveFromMetadata, FactoryTarget, makeBindingParser as makeBindingParser2, R3TargetBinder, WrappedNodeExpr as WrappedNodeExpr9 } from "@angular/compiler";
10912
- import ts67 from "typescript";
10912
+ import ts87 from "typescript";
10913
10913
 
10914
10914
  // packages/compiler-cli/src/ngtsc/annotations/directive/src/symbol.js
10915
10915
  var DirectiveSymbol = class _DirectiveSymbol extends SemanticSymbol {
@@ -11270,7 +11270,7 @@ function isSymbolAliasOf(firstSymbol, lastSymbol, typeChecker) {
11270
11270
  }
11271
11271
 
11272
11272
  // packages/compiler-cli/src/ngtsc/typecheck/src/checker.js
11273
- import ts66 from "typescript";
11273
+ import ts86 from "typescript";
11274
11274
 
11275
11275
  // packages/compiler-cli/src/ngtsc/program_driver/src/api.js
11276
11276
  var NgOriginalFile = Symbol("NgOriginalFile");
@@ -12862,7 +12862,7 @@ var MagicString = class _MagicString {
12862
12862
  };
12863
12863
 
12864
12864
  // packages/compiler-cli/src/ngtsc/typecheck/src/context.js
12865
- import ts64 from "typescript";
12865
+ import ts84 from "typescript";
12866
12866
 
12867
12867
  // packages/compiler-cli/src/ngtsc/typecheck/src/dom.js
12868
12868
  import { DomElementSchemaRegistry } from "@angular/compiler";
@@ -13993,8 +13993,7 @@ var TypeCheckShimGenerator = class {
13993
13993
  };
13994
13994
 
13995
13995
  // packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.js
13996
- import { BindingPipe, BindingType as BindingType3, Call as Call3, createCssSelectorFromNode, CssSelector as CssSelector3, DYNAMIC_TYPE, ImplicitReceiver as ImplicitReceiver3, ParsedEventType as ParsedEventType2, PropertyRead as PropertyRead4, R3Identifiers as R3Identifiers4, SafeCall as SafeCall2, SafePropertyRead as SafePropertyRead3, SelectorMatcher as SelectorMatcher2, ThisReceiver as ThisReceiver2, TmplAstBoundAttribute as TmplAstBoundAttribute3, TmplAstBoundText, TmplAstContent, TmplAstDeferredBlock, TmplAstElement as TmplAstElement2, TmplAstForLoopBlock, TmplAstIcu, TmplAstIfBlock, TmplAstIfBlockBranch, TmplAstLetDeclaration as TmplAstLetDeclaration2, TmplAstReference as TmplAstReference2, TmplAstSwitchBlock, TmplAstTemplate, TmplAstText, TmplAstTextAttribute as TmplAstTextAttribute2, TmplAstVariable, TmplAstHostElement as TmplAstHostElement2, TransplantedType, TmplAstComponent as TmplAstComponent2, TmplAstDirective as TmplAstDirective2, Binary } from "@angular/compiler";
13997
- import ts62 from "typescript";
13996
+ import ts82 from "typescript";
13998
13997
 
13999
13998
  // packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.js
14000
13999
  import { AbsoluteSourceSpan as AbsoluteSourceSpan4 } from "@angular/compiler";
@@ -14057,11 +14056,86 @@ function translateDiagnostic(diagnostic, resolver) {
14057
14056
  } : void 0);
14058
14057
  }
14059
14058
 
14059
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/context.js
14060
+ import ts61 from "typescript";
14061
+ var TcbGenericContextBehavior;
14062
+ (function(TcbGenericContextBehavior2) {
14063
+ TcbGenericContextBehavior2[TcbGenericContextBehavior2["UseEmitter"] = 0] = "UseEmitter";
14064
+ TcbGenericContextBehavior2[TcbGenericContextBehavior2["CopyClassNodes"] = 1] = "CopyClassNodes";
14065
+ TcbGenericContextBehavior2[TcbGenericContextBehavior2["FallbackToAny"] = 2] = "FallbackToAny";
14066
+ })(TcbGenericContextBehavior || (TcbGenericContextBehavior = {}));
14067
+ var Context2 = class {
14068
+ env;
14069
+ domSchemaChecker;
14070
+ oobRecorder;
14071
+ id;
14072
+ boundTarget;
14073
+ pipes;
14074
+ schemas;
14075
+ hostIsStandalone;
14076
+ hostPreserveWhitespaces;
14077
+ nextId = 1;
14078
+ constructor(env, domSchemaChecker, oobRecorder, id, boundTarget, pipes, schemas, hostIsStandalone, hostPreserveWhitespaces) {
14079
+ this.env = env;
14080
+ this.domSchemaChecker = domSchemaChecker;
14081
+ this.oobRecorder = oobRecorder;
14082
+ this.id = id;
14083
+ this.boundTarget = boundTarget;
14084
+ this.pipes = pipes;
14085
+ this.schemas = schemas;
14086
+ this.hostIsStandalone = hostIsStandalone;
14087
+ this.hostPreserveWhitespaces = hostPreserveWhitespaces;
14088
+ }
14089
+ /**
14090
+ * Allocate a new variable name for use within the `Context`.
14091
+ *
14092
+ * Currently this uses a monotonically increasing counter, but in the future the variable name
14093
+ * might change depending on the type of data being stored.
14094
+ */
14095
+ allocateId() {
14096
+ return ts61.factory.createIdentifier(`_t${this.nextId++}`);
14097
+ }
14098
+ getPipeByName(name) {
14099
+ if (this.pipes === null || !this.pipes.has(name)) {
14100
+ return null;
14101
+ }
14102
+ return this.pipes.get(name);
14103
+ }
14104
+ };
14105
+
14106
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/scope.js
14107
+ import { TmplAstBoundText, TmplAstComponent as TmplAstComponent3, TmplAstContent, TmplAstDeferredBlock, TmplAstDirective as TmplAstDirective2, TmplAstElement as TmplAstElement8, TmplAstForLoopBlock as TmplAstForLoopBlock2, TmplAstHostElement as TmplAstHostElement5, TmplAstIcu, TmplAstIfBlock as TmplAstIfBlock2, TmplAstIfBlockBranch, TmplAstLetDeclaration as TmplAstLetDeclaration3, TmplAstReference as TmplAstReference2, TmplAstSwitchBlock as TmplAstSwitchBlock2, TmplAstTemplate as TmplAstTemplate5, TmplAstText as TmplAstText2, TmplAstVariable as TmplAstVariable2 } from "@angular/compiler";
14108
+ import ts81 from "typescript";
14109
+
14110
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/base.js
14111
+ import ts62 from "typescript";
14112
+ var TcbOp = class {
14113
+ /**
14114
+ * Replacement value or operation used while this `TcbOp` is executing (i.e. to resolve circular
14115
+ * references during its execution).
14116
+ *
14117
+ * This is usually a `null!` expression (which asks TS to infer an appropriate type), but another
14118
+ * `TcbOp` can be returned in cases where additional code generation is necessary to deal with
14119
+ * circular references.
14120
+ */
14121
+ circularFallback() {
14122
+ return ts62.factory.createNonNullExpression(ts62.factory.createNull());
14123
+ }
14124
+ };
14125
+
14126
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/template.js
14127
+ import { TmplAstBoundAttribute as TmplAstBoundAttribute3, TmplAstTemplate } from "@angular/compiler";
14128
+ import ts65 from "typescript";
14129
+
14130
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/expression.js
14131
+ import { Binary, BindingPipe, Call as Call3, ImplicitReceiver as ImplicitReceiver3, PropertyRead as PropertyRead4, R3Identifiers as R3Identifiers4, SafeCall as SafeCall2, SafePropertyRead as SafePropertyRead3, ThisReceiver as ThisReceiver2, TmplAstLetDeclaration as TmplAstLetDeclaration2 } from "@angular/compiler";
14132
+ import ts64 from "typescript";
14133
+
14060
14134
  // packages/compiler-cli/src/ngtsc/typecheck/src/expression.js
14061
14135
  import { ASTWithSource, Call as Call2, EmptyExpr as EmptyExpr2, PropertyRead as PropertyRead3, SafeKeyedRead, SafePropertyRead as SafePropertyRead2 } from "@angular/compiler";
14062
- import ts61 from "typescript";
14136
+ import ts63 from "typescript";
14063
14137
  function getAnyExpression() {
14064
- return ts61.factory.createAsExpression(ts61.factory.createNumericLiteral("0"), ts61.factory.createKeywordTypeNode(ts61.SyntaxKind.AnyKeyword));
14138
+ return ts63.factory.createAsExpression(ts63.factory.createNumericLiteral("0"), ts63.factory.createKeywordTypeNode(ts63.SyntaxKind.AnyKeyword));
14065
14139
  }
14066
14140
  function astToTypescript(ast, maybeResolve, config) {
14067
14141
  const translator = new AstTranslator(maybeResolve, config);
@@ -14070,43 +14144,43 @@ function astToTypescript(ast, maybeResolve, config) {
14070
14144
  var AstTranslator = class {
14071
14145
  maybeResolve;
14072
14146
  config;
14073
- UNDEFINED = ts61.factory.createIdentifier("undefined");
14147
+ UNDEFINED = ts63.factory.createIdentifier("undefined");
14074
14148
  UNARY_OPS = /* @__PURE__ */ new Map([
14075
- ["+", ts61.SyntaxKind.PlusToken],
14076
- ["-", ts61.SyntaxKind.MinusToken]
14149
+ ["+", ts63.SyntaxKind.PlusToken],
14150
+ ["-", ts63.SyntaxKind.MinusToken]
14077
14151
  ]);
14078
14152
  BINARY_OPS = /* @__PURE__ */ new Map([
14079
- ["+", ts61.SyntaxKind.PlusToken],
14080
- ["-", ts61.SyntaxKind.MinusToken],
14081
- ["<", ts61.SyntaxKind.LessThanToken],
14082
- [">", ts61.SyntaxKind.GreaterThanToken],
14083
- ["<=", ts61.SyntaxKind.LessThanEqualsToken],
14084
- [">=", ts61.SyntaxKind.GreaterThanEqualsToken],
14085
- ["=", ts61.SyntaxKind.EqualsToken],
14086
- ["==", ts61.SyntaxKind.EqualsEqualsToken],
14087
- ["===", ts61.SyntaxKind.EqualsEqualsEqualsToken],
14088
- ["*", ts61.SyntaxKind.AsteriskToken],
14089
- ["**", ts61.SyntaxKind.AsteriskAsteriskToken],
14090
- ["/", ts61.SyntaxKind.SlashToken],
14091
- ["%", ts61.SyntaxKind.PercentToken],
14092
- ["!=", ts61.SyntaxKind.ExclamationEqualsToken],
14093
- ["!==", ts61.SyntaxKind.ExclamationEqualsEqualsToken],
14094
- ["||", ts61.SyntaxKind.BarBarToken],
14095
- ["&&", ts61.SyntaxKind.AmpersandAmpersandToken],
14096
- ["&", ts61.SyntaxKind.AmpersandToken],
14097
- ["|", ts61.SyntaxKind.BarToken],
14098
- ["??", ts61.SyntaxKind.QuestionQuestionToken],
14099
- ["in", ts61.SyntaxKind.InKeyword],
14100
- ["=", ts61.SyntaxKind.EqualsToken],
14101
- ["+=", ts61.SyntaxKind.PlusEqualsToken],
14102
- ["-=", ts61.SyntaxKind.MinusEqualsToken],
14103
- ["*=", ts61.SyntaxKind.AsteriskEqualsToken],
14104
- ["/=", ts61.SyntaxKind.SlashEqualsToken],
14105
- ["%=", ts61.SyntaxKind.PercentEqualsToken],
14106
- ["**=", ts61.SyntaxKind.AsteriskAsteriskEqualsToken],
14107
- ["&&=", ts61.SyntaxKind.AmpersandAmpersandEqualsToken],
14108
- ["||=", ts61.SyntaxKind.BarBarEqualsToken],
14109
- ["??=", ts61.SyntaxKind.QuestionQuestionEqualsToken]
14153
+ ["+", ts63.SyntaxKind.PlusToken],
14154
+ ["-", ts63.SyntaxKind.MinusToken],
14155
+ ["<", ts63.SyntaxKind.LessThanToken],
14156
+ [">", ts63.SyntaxKind.GreaterThanToken],
14157
+ ["<=", ts63.SyntaxKind.LessThanEqualsToken],
14158
+ [">=", ts63.SyntaxKind.GreaterThanEqualsToken],
14159
+ ["=", ts63.SyntaxKind.EqualsToken],
14160
+ ["==", ts63.SyntaxKind.EqualsEqualsToken],
14161
+ ["===", ts63.SyntaxKind.EqualsEqualsEqualsToken],
14162
+ ["*", ts63.SyntaxKind.AsteriskToken],
14163
+ ["**", ts63.SyntaxKind.AsteriskAsteriskToken],
14164
+ ["/", ts63.SyntaxKind.SlashToken],
14165
+ ["%", ts63.SyntaxKind.PercentToken],
14166
+ ["!=", ts63.SyntaxKind.ExclamationEqualsToken],
14167
+ ["!==", ts63.SyntaxKind.ExclamationEqualsEqualsToken],
14168
+ ["||", ts63.SyntaxKind.BarBarToken],
14169
+ ["&&", ts63.SyntaxKind.AmpersandAmpersandToken],
14170
+ ["&", ts63.SyntaxKind.AmpersandToken],
14171
+ ["|", ts63.SyntaxKind.BarToken],
14172
+ ["??", ts63.SyntaxKind.QuestionQuestionToken],
14173
+ ["in", ts63.SyntaxKind.InKeyword],
14174
+ ["=", ts63.SyntaxKind.EqualsToken],
14175
+ ["+=", ts63.SyntaxKind.PlusEqualsToken],
14176
+ ["-=", ts63.SyntaxKind.MinusEqualsToken],
14177
+ ["*=", ts63.SyntaxKind.AsteriskEqualsToken],
14178
+ ["/=", ts63.SyntaxKind.SlashEqualsToken],
14179
+ ["%=", ts63.SyntaxKind.PercentEqualsToken],
14180
+ ["**=", ts63.SyntaxKind.AsteriskAsteriskEqualsToken],
14181
+ ["&&=", ts63.SyntaxKind.AmpersandAmpersandEqualsToken],
14182
+ ["||=", ts63.SyntaxKind.BarBarEqualsToken],
14183
+ ["??=", ts63.SyntaxKind.QuestionQuestionEqualsToken]
14110
14184
  ]);
14111
14185
  constructor(maybeResolve, config) {
14112
14186
  this.maybeResolve = maybeResolve;
@@ -14117,7 +14191,7 @@ var AstTranslator = class {
14117
14191
  ast = ast.ast;
14118
14192
  }
14119
14193
  if (ast instanceof EmptyExpr2) {
14120
- const res = ts61.factory.createIdentifier("undefined");
14194
+ const res = ts63.factory.createIdentifier("undefined");
14121
14195
  addParseSpanInfo(res, ast.sourceSpan);
14122
14196
  return res;
14123
14197
  }
@@ -14133,7 +14207,7 @@ var AstTranslator = class {
14133
14207
  if (op === void 0) {
14134
14208
  throw new Error(`Unsupported Unary.operator: ${ast.operator}`);
14135
14209
  }
14136
- const node = wrapForDiagnostics(ts61.factory.createPrefixUnaryExpression(op, expr));
14210
+ const node = wrapForDiagnostics(ts63.factory.createPrefixUnaryExpression(op, expr));
14137
14211
  addParseSpanInfo(node, ast.sourceSpan);
14138
14212
  return node;
14139
14213
  }
@@ -14144,13 +14218,13 @@ var AstTranslator = class {
14144
14218
  if (op === void 0) {
14145
14219
  throw new Error(`Unsupported Binary.operation: ${ast.operation}`);
14146
14220
  }
14147
- const node = ts61.factory.createBinaryExpression(lhs, op, rhs);
14221
+ const node = ts63.factory.createBinaryExpression(lhs, op, rhs);
14148
14222
  addParseSpanInfo(node, ast.sourceSpan);
14149
14223
  return node;
14150
14224
  }
14151
14225
  visitChain(ast) {
14152
14226
  const elements = ast.expressions.map((expr) => this.translate(expr));
14153
- const node = wrapForDiagnostics(ts61.factory.createCommaListExpression(elements));
14227
+ const node = wrapForDiagnostics(ts63.factory.createCommaListExpression(elements));
14154
14228
  addParseSpanInfo(node, ast.sourceSpan);
14155
14229
  return node;
14156
14230
  }
@@ -14158,7 +14232,7 @@ var AstTranslator = class {
14158
14232
  const condExpr = this.translate(ast.condition);
14159
14233
  const trueExpr = this.translate(ast.trueExp);
14160
14234
  const falseExpr = wrapForTypeChecker(this.translate(ast.falseExp));
14161
- const node = ts61.factory.createParenthesizedExpression(ts61.factory.createConditionalExpression(condExpr, void 0, trueExpr, void 0, falseExpr));
14235
+ const node = ts63.factory.createParenthesizedExpression(ts63.factory.createConditionalExpression(condExpr, void 0, trueExpr, void 0, falseExpr));
14162
14236
  addParseSpanInfo(node, ast.sourceSpan);
14163
14237
  return node;
14164
14238
  }
@@ -14169,21 +14243,21 @@ var AstTranslator = class {
14169
14243
  throw new Error("Method not implemented.");
14170
14244
  }
14171
14245
  visitRegularExpressionLiteral(ast, context) {
14172
- return wrapForTypeChecker(ts61.factory.createRegularExpressionLiteral(`/${ast.body}/${ast.flags ?? ""}`));
14246
+ return wrapForTypeChecker(ts63.factory.createRegularExpressionLiteral(`/${ast.body}/${ast.flags ?? ""}`));
14173
14247
  }
14174
14248
  visitInterpolation(ast) {
14175
- return ast.expressions.reduce((lhs, ast2) => ts61.factory.createBinaryExpression(lhs, ts61.SyntaxKind.PlusToken, wrapForTypeChecker(this.translate(ast2))), ts61.factory.createStringLiteral(""));
14249
+ return ast.expressions.reduce((lhs, ast2) => ts63.factory.createBinaryExpression(lhs, ts63.SyntaxKind.PlusToken, wrapForTypeChecker(this.translate(ast2))), ts63.factory.createStringLiteral(""));
14176
14250
  }
14177
14251
  visitKeyedRead(ast) {
14178
14252
  const receiver = wrapForDiagnostics(this.translate(ast.receiver));
14179
14253
  const key = this.translate(ast.key);
14180
- const node = ts61.factory.createElementAccessExpression(receiver, key);
14254
+ const node = ts63.factory.createElementAccessExpression(receiver, key);
14181
14255
  addParseSpanInfo(node, ast.sourceSpan);
14182
14256
  return node;
14183
14257
  }
14184
14258
  visitLiteralArray(ast) {
14185
14259
  const elements = ast.expressions.map((expr) => this.translate(expr));
14186
- const literal4 = ts61.factory.createArrayLiteralExpression(elements);
14260
+ const literal4 = ts63.factory.createArrayLiteralExpression(elements);
14187
14261
  const node = this.config.strictLiteralTypes ? literal4 : tsCastToAny(literal4);
14188
14262
  addParseSpanInfo(node, ast.sourceSpan);
14189
14263
  return node;
@@ -14191,9 +14265,9 @@ var AstTranslator = class {
14191
14265
  visitLiteralMap(ast) {
14192
14266
  const properties = ast.keys.map(({ key }, idx) => {
14193
14267
  const value = this.translate(ast.values[idx]);
14194
- return ts61.factory.createPropertyAssignment(ts61.factory.createStringLiteral(key), value);
14268
+ return ts63.factory.createPropertyAssignment(ts63.factory.createStringLiteral(key), value);
14195
14269
  });
14196
- const literal4 = ts61.factory.createObjectLiteralExpression(properties, true);
14270
+ const literal4 = ts63.factory.createObjectLiteralExpression(properties, true);
14197
14271
  const node = this.config.strictLiteralTypes ? literal4 : tsCastToAny(literal4);
14198
14272
  addParseSpanInfo(node, ast.sourceSpan);
14199
14273
  return node;
@@ -14201,15 +14275,15 @@ var AstTranslator = class {
14201
14275
  visitLiteralPrimitive(ast) {
14202
14276
  let node;
14203
14277
  if (ast.value === void 0) {
14204
- node = ts61.factory.createIdentifier("undefined");
14278
+ node = ts63.factory.createIdentifier("undefined");
14205
14279
  } else if (ast.value === null) {
14206
- node = ts61.factory.createNull();
14280
+ node = ts63.factory.createNull();
14207
14281
  } else if (typeof ast.value === "string") {
14208
- node = ts61.factory.createStringLiteral(ast.value);
14282
+ node = ts63.factory.createStringLiteral(ast.value);
14209
14283
  } else if (typeof ast.value === "number") {
14210
14284
  node = tsNumericExpression2(ast.value);
14211
14285
  } else if (typeof ast.value === "boolean") {
14212
- node = ast.value ? ts61.factory.createTrue() : ts61.factory.createFalse();
14286
+ node = ast.value ? ts63.factory.createTrue() : ts63.factory.createFalse();
14213
14287
  } else {
14214
14288
  throw Error(`Unsupported AST value of type ${typeof ast.value}`);
14215
14289
  }
@@ -14218,7 +14292,7 @@ var AstTranslator = class {
14218
14292
  }
14219
14293
  visitNonNullAssert(ast) {
14220
14294
  const expr = wrapForDiagnostics(this.translate(ast.expression));
14221
- const node = ts61.factory.createNonNullExpression(expr);
14295
+ const node = ts63.factory.createNonNullExpression(expr);
14222
14296
  addParseSpanInfo(node, ast.sourceSpan);
14223
14297
  return node;
14224
14298
  }
@@ -14227,25 +14301,25 @@ var AstTranslator = class {
14227
14301
  }
14228
14302
  visitPrefixNot(ast) {
14229
14303
  const expression = wrapForDiagnostics(this.translate(ast.expression));
14230
- const node = ts61.factory.createLogicalNot(expression);
14304
+ const node = ts63.factory.createLogicalNot(expression);
14231
14305
  addParseSpanInfo(node, ast.sourceSpan);
14232
14306
  return node;
14233
14307
  }
14234
14308
  visitTypeofExpression(ast) {
14235
14309
  const expression = wrapForDiagnostics(this.translate(ast.expression));
14236
- const node = ts61.factory.createTypeOfExpression(expression);
14310
+ const node = ts63.factory.createTypeOfExpression(expression);
14237
14311
  addParseSpanInfo(node, ast.sourceSpan);
14238
14312
  return node;
14239
14313
  }
14240
14314
  visitVoidExpression(ast) {
14241
14315
  const expression = wrapForDiagnostics(this.translate(ast.expression));
14242
- const node = ts61.factory.createVoidExpression(expression);
14316
+ const node = ts63.factory.createVoidExpression(expression);
14243
14317
  addParseSpanInfo(node, ast.sourceSpan);
14244
14318
  return node;
14245
14319
  }
14246
14320
  visitPropertyRead(ast) {
14247
14321
  const receiver = wrapForDiagnostics(this.translate(ast.receiver));
14248
- const name = ts61.factory.createPropertyAccessExpression(receiver, ast.name);
14322
+ const name = ts63.factory.createPropertyAccessExpression(receiver, ast.name);
14249
14323
  addParseSpanInfo(name, ast.nameSpan);
14250
14324
  const node = wrapForDiagnostics(name);
14251
14325
  addParseSpanInfo(node, ast.sourceSpan);
@@ -14255,13 +14329,13 @@ var AstTranslator = class {
14255
14329
  let node;
14256
14330
  const receiver = wrapForDiagnostics(this.translate(ast.receiver));
14257
14331
  if (this.config.strictSafeNavigationTypes) {
14258
- const expr = ts61.factory.createPropertyAccessExpression(ts61.factory.createNonNullExpression(receiver), ast.name);
14332
+ const expr = ts63.factory.createPropertyAccessExpression(ts63.factory.createNonNullExpression(receiver), ast.name);
14259
14333
  addParseSpanInfo(expr, ast.nameSpan);
14260
- node = ts61.factory.createParenthesizedExpression(ts61.factory.createConditionalExpression(getAnyExpression(), void 0, expr, void 0, this.UNDEFINED));
14334
+ node = ts63.factory.createParenthesizedExpression(ts63.factory.createConditionalExpression(getAnyExpression(), void 0, expr, void 0, this.UNDEFINED));
14261
14335
  } else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
14262
- node = ts61.factory.createPropertyAccessExpression(tsCastToAny(receiver), ast.name);
14336
+ node = ts63.factory.createPropertyAccessExpression(tsCastToAny(receiver), ast.name);
14263
14337
  } else {
14264
- const expr = ts61.factory.createPropertyAccessExpression(ts61.factory.createNonNullExpression(receiver), ast.name);
14338
+ const expr = ts63.factory.createPropertyAccessExpression(ts63.factory.createNonNullExpression(receiver), ast.name);
14265
14339
  addParseSpanInfo(expr, ast.nameSpan);
14266
14340
  node = tsCastToAny(expr);
14267
14341
  }
@@ -14273,13 +14347,13 @@ var AstTranslator = class {
14273
14347
  const key = this.translate(ast.key);
14274
14348
  let node;
14275
14349
  if (this.config.strictSafeNavigationTypes) {
14276
- const expr = ts61.factory.createElementAccessExpression(ts61.factory.createNonNullExpression(receiver), key);
14350
+ const expr = ts63.factory.createElementAccessExpression(ts63.factory.createNonNullExpression(receiver), key);
14277
14351
  addParseSpanInfo(expr, ast.sourceSpan);
14278
- node = ts61.factory.createParenthesizedExpression(ts61.factory.createConditionalExpression(getAnyExpression(), void 0, expr, void 0, this.UNDEFINED));
14352
+ node = ts63.factory.createParenthesizedExpression(ts63.factory.createConditionalExpression(getAnyExpression(), void 0, expr, void 0, this.UNDEFINED));
14279
14353
  } else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
14280
- node = ts61.factory.createElementAccessExpression(tsCastToAny(receiver), key);
14354
+ node = ts63.factory.createElementAccessExpression(tsCastToAny(receiver), key);
14281
14355
  } else {
14282
- const expr = ts61.factory.createElementAccessExpression(ts61.factory.createNonNullExpression(receiver), key);
14356
+ const expr = ts63.factory.createElementAccessExpression(ts63.factory.createNonNullExpression(receiver), key);
14283
14357
  addParseSpanInfo(expr, ast.sourceSpan);
14284
14358
  node = tsCastToAny(expr);
14285
14359
  }
@@ -14296,7 +14370,7 @@ var AstTranslator = class {
14296
14370
  expr = resolved;
14297
14371
  } else {
14298
14372
  const propertyReceiver = wrapForDiagnostics(this.translate(receiver.receiver));
14299
- expr = ts61.factory.createPropertyAccessExpression(propertyReceiver, receiver.name);
14373
+ expr = ts63.factory.createPropertyAccessExpression(propertyReceiver, receiver.name);
14300
14374
  addParseSpanInfo(expr, receiver.nameSpan);
14301
14375
  }
14302
14376
  } else {
@@ -14306,7 +14380,7 @@ var AstTranslator = class {
14306
14380
  if (ast.receiver instanceof SafePropertyRead2 || ast.receiver instanceof SafeKeyedRead) {
14307
14381
  node = this.convertToSafeCall(ast, expr, args);
14308
14382
  } else {
14309
- node = ts61.factory.createCallExpression(expr, void 0, args);
14383
+ node = ts63.factory.createCallExpression(expr, void 0, args);
14310
14384
  }
14311
14385
  addParseSpanInfo(node, ast.sourceSpan);
14312
14386
  return node;
@@ -14323,18 +14397,18 @@ var AstTranslator = class {
14323
14397
  const head = ast.elements[0];
14324
14398
  let result;
14325
14399
  if (length === 1) {
14326
- result = ts61.factory.createNoSubstitutionTemplateLiteral(head.text);
14400
+ result = ts63.factory.createNoSubstitutionTemplateLiteral(head.text);
14327
14401
  } else {
14328
14402
  const spans = [];
14329
14403
  const tailIndex = length - 1;
14330
14404
  for (let i = 1; i < tailIndex; i++) {
14331
- const middle = ts61.factory.createTemplateMiddle(ast.elements[i].text);
14332
- spans.push(ts61.factory.createTemplateSpan(this.translate(ast.expressions[i - 1]), middle));
14405
+ const middle = ts63.factory.createTemplateMiddle(ast.elements[i].text);
14406
+ spans.push(ts63.factory.createTemplateSpan(this.translate(ast.expressions[i - 1]), middle));
14333
14407
  }
14334
14408
  const resolvedExpression = this.translate(ast.expressions[tailIndex - 1]);
14335
- const templateTail = ts61.factory.createTemplateTail(ast.elements[tailIndex].text);
14336
- spans.push(ts61.factory.createTemplateSpan(resolvedExpression, templateTail));
14337
- result = ts61.factory.createTemplateExpression(ts61.factory.createTemplateHead(head.text), spans);
14409
+ const templateTail = ts63.factory.createTemplateTail(ast.elements[tailIndex].text);
14410
+ spans.push(ts63.factory.createTemplateSpan(resolvedExpression, templateTail));
14411
+ result = ts63.factory.createTemplateExpression(ts63.factory.createTemplateHead(head.text), spans);
14338
14412
  }
14339
14413
  return result;
14340
14414
  }
@@ -14342,20 +14416,20 @@ var AstTranslator = class {
14342
14416
  throw new Error("Method not implemented");
14343
14417
  }
14344
14418
  visitTaggedTemplateLiteral(ast) {
14345
- return ts61.factory.createTaggedTemplateExpression(this.translate(ast.tag), void 0, this.visitTemplateLiteral(ast.template));
14419
+ return ts63.factory.createTaggedTemplateExpression(this.translate(ast.tag), void 0, this.visitTemplateLiteral(ast.template));
14346
14420
  }
14347
14421
  visitParenthesizedExpression(ast) {
14348
- return ts61.factory.createParenthesizedExpression(this.translate(ast.expression));
14422
+ return ts63.factory.createParenthesizedExpression(this.translate(ast.expression));
14349
14423
  }
14350
14424
  convertToSafeCall(ast, expr, args) {
14351
14425
  if (this.config.strictSafeNavigationTypes) {
14352
- const call = ts61.factory.createCallExpression(ts61.factory.createNonNullExpression(expr), void 0, args);
14353
- return ts61.factory.createParenthesizedExpression(ts61.factory.createConditionalExpression(getAnyExpression(), void 0, call, void 0, this.UNDEFINED));
14426
+ const call = ts63.factory.createCallExpression(ts63.factory.createNonNullExpression(expr), void 0, args);
14427
+ return ts63.factory.createParenthesizedExpression(ts63.factory.createConditionalExpression(getAnyExpression(), void 0, call, void 0, this.UNDEFINED));
14354
14428
  }
14355
14429
  if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
14356
- return ts61.factory.createCallExpression(tsCastToAny(expr), void 0, args);
14430
+ return ts63.factory.createCallExpression(tsCastToAny(expr), void 0, args);
14357
14431
  }
14358
- return tsCastToAny(ts61.factory.createCallExpression(ts61.factory.createNonNullExpression(expr), void 0, args));
14432
+ return tsCastToAny(ts63.factory.createCallExpression(ts63.factory.createNonNullExpression(expr), void 0, args));
14359
14433
  }
14360
14434
  };
14361
14435
  var VeSafeLhsInferenceBugDetector = class _VeSafeLhsInferenceBugDetector {
@@ -14444,207 +14518,174 @@ var VeSafeLhsInferenceBugDetector = class _VeSafeLhsInferenceBugDetector {
14444
14518
  }
14445
14519
  };
14446
14520
 
14447
- // packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.js
14448
- var TcbGenericContextBehavior;
14449
- (function(TcbGenericContextBehavior2) {
14450
- TcbGenericContextBehavior2[TcbGenericContextBehavior2["UseEmitter"] = 0] = "UseEmitter";
14451
- TcbGenericContextBehavior2[TcbGenericContextBehavior2["CopyClassNodes"] = 1] = "CopyClassNodes";
14452
- TcbGenericContextBehavior2[TcbGenericContextBehavior2["FallbackToAny"] = 2] = "FallbackToAny";
14453
- })(TcbGenericContextBehavior || (TcbGenericContextBehavior = {}));
14454
- function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
14455
- const tcb = new Context2(env, domSchemaChecker, oobRecorder, meta.id, meta.boundTarget, meta.pipes, meta.schemas, meta.isStandalone, meta.preserveWhitespaces);
14456
- const ctxRawType = env.referenceType(ref);
14457
- if (!ts62.isTypeReferenceNode(ctxRawType)) {
14458
- throw new Error(`Expected TypeReferenceNode when referencing the ctx param for ${ref.debugName}`);
14459
- }
14460
- let typeParameters = void 0;
14461
- let typeArguments = void 0;
14462
- if (ref.node.typeParameters !== void 0) {
14463
- if (!env.config.useContextGenericType) {
14464
- genericContextBehavior = TcbGenericContextBehavior.FallbackToAny;
14465
- }
14466
- switch (genericContextBehavior) {
14467
- case TcbGenericContextBehavior.UseEmitter:
14468
- typeParameters = new TypeParameterEmitter(ref.node.typeParameters, env.reflector).emit((typeRef) => env.referenceType(typeRef));
14469
- typeArguments = typeParameters.map((param) => ts62.factory.createTypeReferenceNode(param.name));
14470
- break;
14471
- case TcbGenericContextBehavior.CopyClassNodes:
14472
- typeParameters = [...ref.node.typeParameters];
14473
- typeArguments = typeParameters.map((param) => ts62.factory.createTypeReferenceNode(param.name));
14474
- break;
14475
- case TcbGenericContextBehavior.FallbackToAny:
14476
- typeArguments = ref.node.typeParameters.map(() => ts62.factory.createKeywordTypeNode(ts62.SyntaxKind.AnyKeyword));
14477
- break;
14478
- }
14479
- }
14480
- const paramList = [tcbThisParam(ctxRawType.typeName, typeArguments)];
14481
- const statements = [];
14482
- if (tcb.boundTarget.target.template !== void 0) {
14483
- const templateScope = Scope.forNodes(
14484
- tcb,
14485
- null,
14486
- null,
14487
- tcb.boundTarget.target.template,
14488
- /* guard */
14489
- null
14490
- );
14491
- statements.push(renderBlockStatements(env, templateScope, ts62.factory.createTrue()));
14492
- }
14493
- if (tcb.boundTarget.target.host !== void 0) {
14494
- const hostScope = Scope.forNodes(tcb, null, tcb.boundTarget.target.host.node, null, null);
14495
- statements.push(renderBlockStatements(env, hostScope, createHostBindingsBlockGuard()));
14496
- }
14497
- const body = ts62.factory.createBlock(statements);
14498
- const fnDecl = ts62.factory.createFunctionDeclaration(
14499
- /* modifiers */
14500
- void 0,
14501
- /* asteriskToken */
14502
- void 0,
14503
- /* name */
14504
- name,
14505
- /* typeParameters */
14506
- env.config.useContextGenericType ? typeParameters : void 0,
14507
- /* parameters */
14508
- paramList,
14509
- /* type */
14510
- void 0,
14511
- /* body */
14512
- body
14513
- );
14514
- addTypeCheckId(fnDecl, meta.id);
14515
- return fnDecl;
14521
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/expression.js
14522
+ function tcbExpression(ast, tcb, scope) {
14523
+ const translator = new TcbExpressionTranslator(tcb, scope);
14524
+ return translator.translate(ast);
14516
14525
  }
14517
- function renderBlockStatements(env, scope, wrapperExpression) {
14518
- const scopeStatements = scope.render();
14519
- const innerBody = ts62.factory.createBlock([...env.getPreludeStatements(), ...scopeStatements]);
14520
- return ts62.factory.createIfStatement(wrapperExpression, innerBody);
14526
+ function unwrapWritableSignal(expression, tcb) {
14527
+ const unwrapRef = tcb.env.referenceExternalSymbol(R3Identifiers4.unwrapWritableSignal.moduleName, R3Identifiers4.unwrapWritableSignal.name);
14528
+ return ts64.factory.createCallExpression(unwrapRef, void 0, [expression]);
14521
14529
  }
14522
- var TcbOp = class {
14523
- /**
14524
- * Replacement value or operation used while this `TcbOp` is executing (i.e. to resolve circular
14525
- * references during its execution).
14526
- *
14527
- * This is usually a `null!` expression (which asks TS to infer an appropriate type), but another
14528
- * `TcbOp` can be returned in cases where additional code generation is necessary to deal with
14529
- * circular references.
14530
- */
14531
- circularFallback() {
14532
- return ts62.factory.createNonNullExpression(ts62.factory.createNull());
14533
- }
14534
- };
14535
- var TcbElementOp = class extends TcbOp {
14536
- tcb;
14537
- scope;
14538
- element;
14539
- constructor(tcb, scope, element) {
14540
- super();
14541
- this.tcb = tcb;
14542
- this.scope = scope;
14543
- this.element = element;
14544
- }
14545
- get optional() {
14546
- return true;
14547
- }
14548
- execute() {
14549
- const id = this.tcb.allocateId();
14550
- const initializer = tsCreateElement(this.element.name);
14551
- addParseSpanInfo(initializer, this.element.startSourceSpan || this.element.sourceSpan);
14552
- this.scope.addStatement(tsCreateVariable(id, initializer));
14553
- return id;
14554
- }
14555
- };
14556
- var TcbTemplateVariableOp = class extends TcbOp {
14530
+ var TcbExpressionOp = class extends TcbOp {
14557
14531
  tcb;
14558
14532
  scope;
14559
- template;
14560
- variable;
14561
- constructor(tcb, scope, template, variable) {
14533
+ expression;
14534
+ constructor(tcb, scope, expression) {
14562
14535
  super();
14563
14536
  this.tcb = tcb;
14564
14537
  this.scope = scope;
14565
- this.template = template;
14566
- this.variable = variable;
14538
+ this.expression = expression;
14567
14539
  }
14568
14540
  get optional() {
14569
14541
  return false;
14570
14542
  }
14571
14543
  execute() {
14572
- const ctx = this.scope.resolve(this.template);
14573
- const id = this.tcb.allocateId();
14574
- const initializer = ts62.factory.createPropertyAccessExpression(
14575
- /* expression */
14576
- ctx,
14577
- /* name */
14578
- this.variable.value || "$implicit"
14579
- );
14580
- addParseSpanInfo(id, this.variable.keySpan);
14581
- let variable;
14582
- if (this.variable.valueSpan !== void 0) {
14583
- addParseSpanInfo(initializer, this.variable.valueSpan);
14584
- variable = tsCreateVariable(id, wrapForTypeChecker(initializer));
14585
- } else {
14586
- variable = tsCreateVariable(id, initializer);
14587
- }
14588
- addParseSpanInfo(variable.declarationList.declarations[0], this.variable.sourceSpan);
14589
- this.scope.addStatement(variable);
14590
- return id;
14544
+ const expr = tcbExpression(this.expression, this.tcb, this.scope);
14545
+ this.scope.addStatement(ts64.factory.createExpressionStatement(expr));
14546
+ return null;
14591
14547
  }
14592
14548
  };
14593
- var TcbTemplateContextOp = class extends TcbOp {
14549
+ var TcbExpressionTranslator = class {
14594
14550
  tcb;
14595
14551
  scope;
14596
14552
  constructor(tcb, scope) {
14597
- super();
14598
14553
  this.tcb = tcb;
14599
14554
  this.scope = scope;
14600
14555
  }
14601
- // The declaration of the context variable is only needed when the context is actually referenced.
14602
- optional = true;
14603
- execute() {
14604
- const ctx = this.tcb.allocateId();
14605
- const type = ts62.factory.createKeywordTypeNode(ts62.SyntaxKind.AnyKeyword);
14606
- this.scope.addStatement(tsDeclareVariable(ctx, type));
14607
- return ctx;
14608
- }
14609
- };
14610
- var TcbLetDeclarationOp = class extends TcbOp {
14611
- tcb;
14612
- scope;
14613
- node;
14614
- constructor(tcb, scope, node) {
14615
- super();
14616
- this.tcb = tcb;
14617
- this.scope = scope;
14618
- this.node = node;
14556
+ translate(ast) {
14557
+ return astToTypescript(ast, (ast2) => this.resolve(ast2), this.tcb.env.config);
14619
14558
  }
14620
14559
  /**
14621
- * `@let` declarations are mandatory, because their expressions
14622
- * should be checked even if they aren't referenced anywhere.
14560
+ * Resolve an `AST` expression within the given scope.
14561
+ *
14562
+ * Some `AST` expressions refer to top-level concepts (references, variables, the component
14563
+ * context). This method assists in resolving those.
14623
14564
  */
14624
- optional = false;
14625
- execute() {
14626
- const id = this.tcb.allocateId();
14627
- addParseSpanInfo(id, this.node.nameSpan);
14628
- const value = tcbExpression(this.node.value, this.tcb, this.scope);
14629
- const varStatement = tsCreateVariable(id, wrapForTypeChecker(value), ts62.NodeFlags.Const);
14630
- addParseSpanInfo(varStatement.declarationList.declarations[0], this.node.sourceSpan);
14631
- this.scope.addStatement(varStatement);
14632
- return id;
14633
- }
14634
- };
14635
- var TcbTemplateBodyOp = class extends TcbOp {
14636
- tcb;
14637
- scope;
14638
- template;
14639
- constructor(tcb, scope, template) {
14640
- super();
14641
- this.tcb = tcb;
14642
- this.scope = scope;
14643
- this.template = template;
14644
- }
14645
- get optional() {
14646
- return false;
14647
- }
14565
+ resolve(ast) {
14566
+ if (ast instanceof PropertyRead4 && ast.receiver instanceof ImplicitReceiver3 && !(ast.receiver instanceof ThisReceiver2)) {
14567
+ const target = this.tcb.boundTarget.getExpressionTarget(ast);
14568
+ const targetExpression = target === null ? null : this.getTargetNodeExpression(target, ast);
14569
+ if (target instanceof TmplAstLetDeclaration2 && !this.isValidLetDeclarationAccess(target, ast)) {
14570
+ this.tcb.oobRecorder.letUsedBeforeDefinition(this.tcb.id, ast, target);
14571
+ if (targetExpression !== null) {
14572
+ return ts64.factory.createAsExpression(targetExpression, ts64.factory.createKeywordTypeNode(ts64.SyntaxKind.AnyKeyword));
14573
+ }
14574
+ }
14575
+ return targetExpression;
14576
+ } else if (ast instanceof Binary && Binary.isAssignmentOperation(ast.operation) && ast.left instanceof PropertyRead4 && ast.left.receiver instanceof ImplicitReceiver3) {
14577
+ const read = ast.left;
14578
+ const target = this.tcb.boundTarget.getExpressionTarget(read);
14579
+ if (target === null) {
14580
+ return null;
14581
+ }
14582
+ const targetExpression = this.getTargetNodeExpression(target, read);
14583
+ const expr = this.translate(ast.right);
14584
+ const result = ts64.factory.createParenthesizedExpression(ts64.factory.createBinaryExpression(targetExpression, ts64.SyntaxKind.EqualsToken, expr));
14585
+ addParseSpanInfo(result, read.sourceSpan);
14586
+ if (target instanceof TmplAstLetDeclaration2) {
14587
+ markIgnoreDiagnostics(result);
14588
+ this.tcb.oobRecorder.illegalWriteToLetDeclaration(this.tcb.id, read, target);
14589
+ }
14590
+ return result;
14591
+ } else if (ast instanceof ImplicitReceiver3) {
14592
+ return ts64.factory.createThis();
14593
+ } else if (ast instanceof BindingPipe) {
14594
+ const expr = this.translate(ast.exp);
14595
+ const pipeMeta = this.tcb.getPipeByName(ast.name);
14596
+ let pipe;
14597
+ if (pipeMeta === null) {
14598
+ this.tcb.oobRecorder.missingPipe(this.tcb.id, ast, this.tcb.hostIsStandalone);
14599
+ pipe = getAnyExpression();
14600
+ } else if (pipeMeta.isExplicitlyDeferred && this.tcb.boundTarget.getEagerlyUsedPipes().includes(ast.name)) {
14601
+ this.tcb.oobRecorder.deferredPipeUsedEagerly(this.tcb.id, ast);
14602
+ pipe = getAnyExpression();
14603
+ } else {
14604
+ pipe = this.tcb.env.pipeInst(pipeMeta.ref);
14605
+ }
14606
+ const args = ast.args.map((arg) => this.translate(arg));
14607
+ let methodAccess = ts64.factory.createPropertyAccessExpression(pipe, "transform");
14608
+ addParseSpanInfo(methodAccess, ast.nameSpan);
14609
+ if (!this.tcb.env.config.checkTypeOfPipes) {
14610
+ methodAccess = ts64.factory.createAsExpression(methodAccess, ts64.factory.createKeywordTypeNode(ts64.SyntaxKind.AnyKeyword));
14611
+ }
14612
+ const result = ts64.factory.createCallExpression(
14613
+ /* expression */
14614
+ methodAccess,
14615
+ /* typeArguments */
14616
+ void 0,
14617
+ /* argumentsArray */
14618
+ [expr, ...args]
14619
+ );
14620
+ addParseSpanInfo(result, ast.sourceSpan);
14621
+ return result;
14622
+ } else if ((ast instanceof Call3 || ast instanceof SafeCall2) && (ast.receiver instanceof PropertyRead4 || ast.receiver instanceof SafePropertyRead3)) {
14623
+ if (ast.receiver.receiver instanceof ImplicitReceiver3 && !(ast.receiver.receiver instanceof ThisReceiver2) && ast.receiver.name === "$any" && ast.args.length === 1) {
14624
+ const expr = this.translate(ast.args[0]);
14625
+ const exprAsAny = ts64.factory.createAsExpression(expr, ts64.factory.createKeywordTypeNode(ts64.SyntaxKind.AnyKeyword));
14626
+ const result = ts64.factory.createParenthesizedExpression(exprAsAny);
14627
+ addParseSpanInfo(result, ast.sourceSpan);
14628
+ return result;
14629
+ }
14630
+ const target = this.tcb.boundTarget.getExpressionTarget(ast);
14631
+ if (target === null) {
14632
+ return null;
14633
+ }
14634
+ const receiver = this.getTargetNodeExpression(target, ast);
14635
+ const method = wrapForDiagnostics(receiver);
14636
+ addParseSpanInfo(method, ast.receiver.nameSpan);
14637
+ const args = ast.args.map((arg) => this.translate(arg));
14638
+ const node = ts64.factory.createCallExpression(method, void 0, args);
14639
+ addParseSpanInfo(node, ast.sourceSpan);
14640
+ return node;
14641
+ } else {
14642
+ return null;
14643
+ }
14644
+ }
14645
+ getTargetNodeExpression(targetNode, expressionNode) {
14646
+ const expr = this.scope.resolve(targetNode);
14647
+ addParseSpanInfo(expr, expressionNode.sourceSpan);
14648
+ return expr;
14649
+ }
14650
+ isValidLetDeclarationAccess(target, ast) {
14651
+ const targetStart = target.sourceSpan.start.offset;
14652
+ const targetEnd = target.sourceSpan.end.offset;
14653
+ const astStart = ast.sourceSpan.start;
14654
+ return targetStart < astStart && astStart > targetEnd || !this.scope.isLocal(target);
14655
+ }
14656
+ };
14657
+
14658
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/template.js
14659
+ var TcbTemplateContextOp = class extends TcbOp {
14660
+ tcb;
14661
+ scope;
14662
+ constructor(tcb, scope) {
14663
+ super();
14664
+ this.tcb = tcb;
14665
+ this.scope = scope;
14666
+ }
14667
+ // The declaration of the context variable is only needed when the context is actually referenced.
14668
+ optional = true;
14669
+ execute() {
14670
+ const ctx = this.tcb.allocateId();
14671
+ const type = ts65.factory.createKeywordTypeNode(ts65.SyntaxKind.AnyKeyword);
14672
+ this.scope.addStatement(tsDeclareVariable(ctx, type));
14673
+ return ctx;
14674
+ }
14675
+ };
14676
+ var TcbTemplateBodyOp = class extends TcbOp {
14677
+ tcb;
14678
+ scope;
14679
+ template;
14680
+ constructor(tcb, scope, template) {
14681
+ super();
14682
+ this.tcb = tcb;
14683
+ this.scope = scope;
14684
+ this.template = template;
14685
+ }
14686
+ get optional() {
14687
+ return false;
14688
+ }
14648
14689
  execute() {
14649
14690
  let guard = null;
14650
14691
  const directiveGuards = [];
@@ -14653,16 +14694,16 @@ var TcbTemplateBodyOp = class extends TcbOp {
14653
14694
  this.addDirectiveGuards(directiveGuards, directive, this.tcb.boundTarget.getDirectivesOfNode(directive));
14654
14695
  }
14655
14696
  if (directiveGuards.length > 0) {
14656
- guard = directiveGuards.reduce((expr, dirGuard) => ts62.factory.createBinaryExpression(expr, ts62.SyntaxKind.AmpersandAmpersandToken, dirGuard), directiveGuards.pop());
14697
+ guard = directiveGuards.reduce((expr, dirGuard) => ts65.factory.createBinaryExpression(expr, ts65.SyntaxKind.AmpersandAmpersandToken, dirGuard), directiveGuards.pop());
14657
14698
  }
14658
- const tmplScope = Scope.forNodes(this.tcb, this.scope, this.template, this.template.children, guard);
14699
+ const tmplScope = this.scope.createChildScope(this.scope, this.template, this.template.children, guard);
14659
14700
  const statements = tmplScope.render();
14660
14701
  if (statements.length === 0) {
14661
14702
  return null;
14662
14703
  }
14663
- let tmplBlock = ts62.factory.createBlock(statements);
14704
+ let tmplBlock = ts65.factory.createBlock(statements);
14664
14705
  if (guard !== null) {
14665
- tmplBlock = ts62.factory.createIfStatement(
14706
+ tmplBlock = ts65.factory.createIfStatement(
14666
14707
  /* expression */
14667
14708
  guard,
14668
14709
  /* thenStatement */
@@ -14713,243 +14754,138 @@ var TcbTemplateBodyOp = class extends TcbOp {
14713
14754
  }
14714
14755
  }
14715
14756
  };
14716
- var TcbExpressionOp = class extends TcbOp {
14757
+
14758
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/element.js
14759
+ var TcbElementOp = class extends TcbOp {
14717
14760
  tcb;
14718
14761
  scope;
14719
- expression;
14720
- constructor(tcb, scope, expression) {
14762
+ element;
14763
+ constructor(tcb, scope, element) {
14721
14764
  super();
14722
14765
  this.tcb = tcb;
14723
14766
  this.scope = scope;
14724
- this.expression = expression;
14767
+ this.element = element;
14725
14768
  }
14726
14769
  get optional() {
14727
- return false;
14770
+ return true;
14728
14771
  }
14729
14772
  execute() {
14730
- const expr = tcbExpression(this.expression, this.tcb, this.scope);
14731
- this.scope.addStatement(ts62.factory.createExpressionStatement(expr));
14732
- return null;
14773
+ const id = this.tcb.allocateId();
14774
+ const initializer = tsCreateElement(this.element.name);
14775
+ addParseSpanInfo(initializer, this.element.startSourceSpan || this.element.sourceSpan);
14776
+ this.scope.addStatement(tsCreateVariable(id, initializer));
14777
+ return id;
14733
14778
  }
14734
14779
  };
14735
- var TcbDirectiveTypeOpBase = class extends TcbOp {
14780
+
14781
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/variables.js
14782
+ import ts66 from "typescript";
14783
+ var TcbBlockImplicitVariableOp = class extends TcbOp {
14736
14784
  tcb;
14737
14785
  scope;
14738
- node;
14739
- dir;
14740
- constructor(tcb, scope, node, dir) {
14786
+ type;
14787
+ variable;
14788
+ constructor(tcb, scope, type, variable) {
14741
14789
  super();
14742
14790
  this.tcb = tcb;
14743
14791
  this.scope = scope;
14744
- this.node = node;
14745
- this.dir = dir;
14746
- }
14747
- get optional() {
14748
- return true;
14792
+ this.type = type;
14793
+ this.variable = variable;
14749
14794
  }
14795
+ optional = true;
14750
14796
  execute() {
14751
- const dirRef = this.dir.ref;
14752
- const rawType = this.tcb.env.referenceType(this.dir.ref);
14753
- let type;
14754
- let span;
14755
- if (this.dir.isGeneric === false || dirRef.node.typeParameters === void 0) {
14756
- type = rawType;
14757
- } else {
14758
- if (!ts62.isTypeReferenceNode(rawType)) {
14759
- throw new Error(`Expected TypeReferenceNode when referencing the type for ${this.dir.ref.debugName}`);
14760
- }
14761
- const typeArguments = dirRef.node.typeParameters.map(() => ts62.factory.createKeywordTypeNode(ts62.SyntaxKind.AnyKeyword));
14762
- type = ts62.factory.createTypeReferenceNode(rawType.typeName, typeArguments);
14763
- }
14764
- if (this.node instanceof TmplAstHostElement2) {
14765
- span = this.node.sourceSpan;
14766
- } else {
14767
- span = this.node.startSourceSpan || this.node.sourceSpan;
14768
- }
14769
14797
  const id = this.tcb.allocateId();
14770
- addExpressionIdentifier(id, ExpressionIdentifier.DIRECTIVE);
14771
- addParseSpanInfo(id, span);
14772
- this.scope.addStatement(tsDeclareVariable(id, type));
14798
+ addParseSpanInfo(id, this.variable.keySpan);
14799
+ const variable = tsDeclareVariable(id, this.type);
14800
+ addParseSpanInfo(variable.declarationList.declarations[0], this.variable.sourceSpan);
14801
+ this.scope.addStatement(variable);
14773
14802
  return id;
14774
14803
  }
14775
14804
  };
14776
- var TcbNonGenericDirectiveTypeOp = class extends TcbDirectiveTypeOpBase {
14777
- /**
14778
- * Creates a variable declaration for this op's directive of the argument type. Returns the id of
14779
- * the newly created variable.
14780
- */
14781
- execute() {
14782
- const dirRef = this.dir.ref;
14783
- if (this.dir.isGeneric) {
14784
- throw new Error(`Assertion Error: expected ${dirRef.debugName} not to be generic.`);
14785
- }
14786
- return super.execute();
14805
+ var TcbTemplateVariableOp = class extends TcbOp {
14806
+ tcb;
14807
+ scope;
14808
+ template;
14809
+ variable;
14810
+ constructor(tcb, scope, template, variable) {
14811
+ super();
14812
+ this.tcb = tcb;
14813
+ this.scope = scope;
14814
+ this.template = template;
14815
+ this.variable = variable;
14816
+ }
14817
+ get optional() {
14818
+ return false;
14787
14819
  }
14788
- };
14789
- var TcbGenericDirectiveTypeWithAnyParamsOp = class extends TcbDirectiveTypeOpBase {
14790
14820
  execute() {
14791
- const dirRef = this.dir.ref;
14792
- if (dirRef.node.typeParameters === void 0) {
14793
- throw new Error(`Assertion Error: expected typeParameters when creating a declaration for ${dirRef.debugName}`);
14821
+ const ctx = this.scope.resolve(this.template);
14822
+ const id = this.tcb.allocateId();
14823
+ const initializer = ts66.factory.createPropertyAccessExpression(
14824
+ /* expression */
14825
+ ctx,
14826
+ /* name */
14827
+ this.variable.value || "$implicit"
14828
+ );
14829
+ addParseSpanInfo(id, this.variable.keySpan);
14830
+ let variable;
14831
+ if (this.variable.valueSpan !== void 0) {
14832
+ addParseSpanInfo(initializer, this.variable.valueSpan);
14833
+ variable = tsCreateVariable(id, wrapForTypeChecker(initializer));
14834
+ } else {
14835
+ variable = tsCreateVariable(id, initializer);
14794
14836
  }
14795
- return super.execute();
14837
+ addParseSpanInfo(variable.declarationList.declarations[0], this.variable.sourceSpan);
14838
+ this.scope.addStatement(variable);
14839
+ return id;
14796
14840
  }
14797
14841
  };
14798
- var TcbFieldDirectiveTypeBaseOp = class extends TcbOp {
14842
+ var TcbBlockVariableOp = class extends TcbOp {
14799
14843
  tcb;
14800
14844
  scope;
14801
- node;
14802
- dir;
14803
- /** Bindings that aren't supported on signal form fields. */
14804
- unsupportedBindingFields = /* @__PURE__ */ new Set([
14805
- ...formControlInputFields,
14806
- "value",
14807
- "checked",
14808
- "type",
14809
- "maxlength",
14810
- "minlength"
14811
- ]);
14812
- constructor(tcb, scope, node, dir) {
14845
+ initializer;
14846
+ variable;
14847
+ constructor(tcb, scope, initializer, variable) {
14813
14848
  super();
14814
14849
  this.tcb = tcb;
14815
14850
  this.scope = scope;
14816
- this.node = node;
14817
- this.dir = dir;
14851
+ this.initializer = initializer;
14852
+ this.variable = variable;
14818
14853
  }
14819
14854
  get optional() {
14820
- return true;
14855
+ return false;
14821
14856
  }
14822
14857
  execute() {
14823
- const inputs = this.node instanceof TmplAstHostElement2 ? this.node.bindings : this.node.inputs;
14824
- for (const input of inputs) {
14825
- if (input.type === BindingType3.Property && this.unsupportedBindingFields.has(input.name)) {
14826
- this.tcb.oobRecorder.formFieldUnsupportedBinding(this.tcb.id, input);
14827
- } else if (input.type === BindingType3.Attribute && this.unsupportedBindingFields.has(input.name.toLowerCase())) {
14828
- this.tcb.oobRecorder.formFieldUnsupportedBinding(this.tcb.id, input);
14829
- }
14830
- }
14831
- if (!(this.node instanceof TmplAstHostElement2)) {
14832
- for (const attr of this.node.attributes) {
14833
- const name = attr.name.toLowerCase();
14834
- if (name !== "type" && this.unsupportedBindingFields.has(name)) {
14835
- this.tcb.oobRecorder.formFieldUnsupportedBinding(this.tcb.id, attr);
14836
- }
14837
- }
14838
- }
14839
- const refType = this.tcb.env.referenceType(this.dir.ref);
14840
- if (!ts62.isTypeReferenceNode(refType)) {
14841
- throw new Error(`Expected TypeReferenceNode when referencing the type for ${this.dir.ref.debugName}`);
14842
- }
14843
- const span = this.node instanceof TmplAstHostElement2 ? this.node.sourceSpan : this.node.startSourceSpan || this.node.sourceSpan;
14844
- const type = ts62.factory.createTypeReferenceNode(refType.typeName, [this.getExpectedType()]);
14845
14858
  const id = this.tcb.allocateId();
14846
- addExpressionIdentifier(id, ExpressionIdentifier.DIRECTIVE);
14847
- addParseSpanInfo(id, span);
14848
- this.scope.addStatement(tsDeclareVariable(id, type));
14859
+ addParseSpanInfo(id, this.variable.keySpan);
14860
+ const variable = tsCreateVariable(id, wrapForTypeChecker(this.initializer));
14861
+ addParseSpanInfo(variable.declarationList.declarations[0], this.variable.sourceSpan);
14862
+ this.scope.addStatement(variable);
14849
14863
  return id;
14850
14864
  }
14851
14865
  };
14852
- var TcbNativeFieldDirectiveTypeOp = class extends TcbFieldDirectiveTypeBaseOp {
14853
- inputType;
14854
- constructor(tcb, scope, node, dir) {
14855
- super(tcb, scope, node, dir);
14856
- this.inputType = node instanceof TmplAstElement2 && node.name === "input" && node.attributes.find((attr) => attr.name === "type")?.value || null;
14857
- if (this.inputType === "radio") {
14858
- this.unsupportedBindingFields.delete("value");
14859
- }
14860
- }
14861
- getExpectedType() {
14862
- if (this.node instanceof TmplAstElement2) {
14863
- return this.getExpectedTypeFromDomNode(this.node);
14864
- }
14865
- return this.getUnsupportedType();
14866
- }
14867
- getExpectedTypeFromDomNode(node) {
14868
- if (node.name === "textarea" || node.name === "select") {
14869
- return ts62.factory.createKeywordTypeNode(ts62.SyntaxKind.StringKeyword);
14870
- }
14871
- if (node.name !== "input") {
14872
- return this.getUnsupportedType();
14873
- }
14874
- switch (this.inputType) {
14875
- case "checkbox":
14876
- return ts62.factory.createKeywordTypeNode(ts62.SyntaxKind.BooleanKeyword);
14877
- case "number":
14878
- case "range":
14879
- case "datetime-local":
14880
- return ts62.factory.createUnionTypeNode([
14881
- ts62.factory.createKeywordTypeNode(ts62.SyntaxKind.StringKeyword),
14882
- ts62.factory.createKeywordTypeNode(ts62.SyntaxKind.NumberKeyword)
14883
- ]);
14884
- case "date":
14885
- case "month":
14886
- case "time":
14887
- case "week":
14888
- return ts62.factory.createUnionTypeNode([
14889
- ts62.factory.createKeywordTypeNode(ts62.SyntaxKind.StringKeyword),
14890
- ts62.factory.createKeywordTypeNode(ts62.SyntaxKind.NumberKeyword),
14891
- ts62.factory.createTypeReferenceNode("Date"),
14892
- ts62.factory.createLiteralTypeNode(ts62.factory.createNull())
14893
- ]);
14894
- }
14895
- return ts62.factory.createKeywordTypeNode(ts62.SyntaxKind.StringKeyword);
14896
- }
14897
- getUnsupportedType() {
14898
- return ts62.factory.createKeywordTypeNode(ts62.SyntaxKind.UnknownKeyword);
14899
- }
14900
- };
14901
- var TcbCustomFieldDirectiveTypeOp = class extends TcbFieldDirectiveTypeBaseOp {
14902
- customFieldDir;
14903
- constructor(tcb, scope, node, dir, customFieldDir) {
14904
- super(tcb, scope, node, dir);
14905
- this.customFieldDir = customFieldDir;
14866
+
14867
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/completions.js
14868
+ import ts67 from "typescript";
14869
+ var TcbComponentContextCompletionOp = class extends TcbOp {
14870
+ scope;
14871
+ constructor(scope) {
14872
+ super();
14873
+ this.scope = scope;
14906
14874
  }
14875
+ optional = false;
14907
14876
  execute() {
14908
- const refId = super.execute();
14909
- this.appendFormFieldConformanceStatements();
14910
- return refId;
14911
- }
14912
- getExpectedType() {
14913
- const id = R3Identifiers4.ExtractFormControlValue;
14914
- const extractRef = this.tcb.env.referenceExternalType(id.moduleName, id.name);
14915
- if (!ts62.isTypeReferenceNode(extractRef)) {
14916
- throw new Error(`Expected TypeReferenceNode when referencing the type for ${id.name}`);
14917
- }
14918
- return ts62.factory.createTypeReferenceNode(extractRef.typeName, [
14919
- this.getCustomFieldTypeReference()
14920
- ]);
14921
- }
14922
- getCustomFieldTypeReference() {
14923
- const customFieldRef = this.tcb.env.referenceType(this.customFieldDir.meta.ref);
14924
- if (!ts62.isTypeReferenceNode(customFieldRef)) {
14925
- throw new Error(`Expected TypeReferenceNode when referencing the type for ${this.customFieldDir.meta.ref.debugName}`);
14926
- }
14927
- return customFieldRef;
14928
- }
14929
- appendFormFieldConformanceStatements() {
14930
- let span;
14931
- if (this.node instanceof TmplAstHostElement2) {
14932
- span = this.node.sourceSpan;
14933
- } else {
14934
- span = this.node.inputs.find((input) => {
14935
- return input.type === BindingType3.Property && input.name === "field";
14936
- })?.sourceSpan ?? this.node.startSourceSpan;
14937
- }
14938
- const isCheckbox = this.customFieldDir.type === "checkbox";
14939
- const symbolName = isCheckbox ? "FormCheckboxControl" : "FormValueControl";
14940
- const targetTypeRef = this.tcb.env.referenceExternalType("@angular/forms/signals", symbolName);
14941
- if (!ts62.isTypeReferenceNode(targetTypeRef)) {
14942
- throw new Error(`Expected TypeReferenceNode when referencing the type for ${symbolName}`);
14943
- }
14944
- const id = this.tcb.allocateId();
14945
- const targetType = ts62.factory.createTypeReferenceNode(targetTypeRef.typeName, isCheckbox ? void 0 : [ts62.factory.createKeywordTypeNode(ts62.SyntaxKind.AnyKeyword)]);
14946
- this.scope.addStatement(tsDeclareVariable(id, targetType));
14947
- const controlType = ts62.factory.createAsExpression(ts62.factory.createNonNullExpression(ts62.factory.createNull()), this.getCustomFieldTypeReference());
14948
- const assignment = ts62.factory.createBinaryExpression(id, ts62.SyntaxKind.EqualsToken, controlType);
14949
- addParseSpanInfo(assignment, span);
14950
- this.scope.addStatement(ts62.factory.createIfStatement(id, ts62.factory.createExpressionStatement(assignment)));
14877
+ const ctx = ts67.factory.createThis();
14878
+ const ctxDot = ts67.factory.createPropertyAccessExpression(ctx, "");
14879
+ markIgnoreDiagnostics(ctxDot);
14880
+ addExpressionIdentifier(ctxDot, ExpressionIdentifier.COMPONENT_COMPLETION);
14881
+ this.scope.addStatement(ts67.factory.createExpressionStatement(ctxDot));
14882
+ return null;
14951
14883
  }
14952
14884
  };
14885
+
14886
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/references.js
14887
+ import { DYNAMIC_TYPE, TmplAstElement as TmplAstElement2, TmplAstTemplate as TmplAstTemplate2 } from "@angular/compiler";
14888
+ import ts68 from "typescript";
14953
14889
  var TcbReferenceOp = class extends TcbOp {
14954
14890
  tcb;
14955
14891
  scope;
@@ -14969,13 +14905,13 @@ var TcbReferenceOp = class extends TcbOp {
14969
14905
  optional = true;
14970
14906
  execute() {
14971
14907
  const id = this.tcb.allocateId();
14972
- let initializer = this.target instanceof TmplAstTemplate || this.target instanceof TmplAstElement2 ? this.scope.resolve(this.target) : this.scope.resolve(this.host, this.target);
14908
+ let initializer = this.target instanceof TmplAstTemplate2 || this.target instanceof TmplAstElement2 ? this.scope.resolve(this.target) : this.scope.resolve(this.host, this.target);
14973
14909
  if (this.target instanceof TmplAstElement2 && !this.tcb.env.config.checkTypeOfDomReferences || !this.tcb.env.config.checkTypeOfNonDomReferences) {
14974
- initializer = ts62.factory.createAsExpression(initializer, ts62.factory.createKeywordTypeNode(ts62.SyntaxKind.AnyKeyword));
14975
- } else if (this.target instanceof TmplAstTemplate) {
14976
- initializer = ts62.factory.createAsExpression(initializer, ts62.factory.createKeywordTypeNode(ts62.SyntaxKind.AnyKeyword));
14977
- initializer = ts62.factory.createAsExpression(initializer, this.tcb.env.referenceExternalType("@angular/core", "TemplateRef", [DYNAMIC_TYPE]));
14978
- initializer = ts62.factory.createParenthesizedExpression(initializer);
14910
+ initializer = ts68.factory.createAsExpression(initializer, ts68.factory.createKeywordTypeNode(ts68.SyntaxKind.AnyKeyword));
14911
+ } else if (this.target instanceof TmplAstTemplate2) {
14912
+ initializer = ts68.factory.createAsExpression(initializer, ts68.factory.createKeywordTypeNode(ts68.SyntaxKind.AnyKeyword));
14913
+ initializer = ts68.factory.createAsExpression(initializer, this.tcb.env.referenceExternalType("@angular/core", "TemplateRef", [DYNAMIC_TYPE]));
14914
+ initializer = ts68.factory.createParenthesizedExpression(initializer);
14979
14915
  }
14980
14916
  addParseSpanInfo(initializer, this.node.sourceSpan);
14981
14917
  addParseSpanInfo(id, this.node.keySpan);
@@ -14999,332 +14935,667 @@ var TcbInvalidReferenceOp = class extends TcbOp {
14999
14935
  return id;
15000
14936
  }
15001
14937
  };
15002
- var TcbDirectiveCtorOp = class extends TcbOp {
14938
+
14939
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/if_block.js
14940
+ import ts69 from "typescript";
14941
+ var TcbIfOp = class extends TcbOp {
15003
14942
  tcb;
15004
14943
  scope;
15005
- node;
15006
- dir;
15007
- constructor(tcb, scope, node, dir) {
14944
+ block;
14945
+ expressionScopes = /* @__PURE__ */ new Map();
14946
+ constructor(tcb, scope, block) {
15008
14947
  super();
15009
14948
  this.tcb = tcb;
15010
14949
  this.scope = scope;
15011
- this.node = node;
15012
- this.dir = dir;
14950
+ this.block = block;
15013
14951
  }
15014
14952
  get optional() {
15015
- return true;
14953
+ return false;
15016
14954
  }
15017
14955
  execute() {
15018
- const genericInputs = /* @__PURE__ */ new Map();
15019
- const id = this.tcb.allocateId();
15020
- let boundAttrs;
15021
- let span;
15022
- if (this.node instanceof TmplAstHostElement2) {
15023
- boundAttrs = [];
15024
- span = this.node.sourceSpan;
15025
- } else {
15026
- boundAttrs = getBoundAttributes(this.dir, this.node);
15027
- span = this.node.startSourceSpan || this.node.sourceSpan;
14956
+ const root = this.generateBranch(0);
14957
+ root && this.scope.addStatement(root);
14958
+ return null;
14959
+ }
14960
+ generateBranch(index) {
14961
+ const branch = this.block.branches[index];
14962
+ if (!branch) {
14963
+ return void 0;
15028
14964
  }
15029
- addExpressionIdentifier(id, ExpressionIdentifier.DIRECTIVE);
15030
- addParseSpanInfo(id, span);
15031
- for (const attr of boundAttrs) {
15032
- if (!this.tcb.env.config.checkTypeOfAttributes && attr.attribute instanceof TmplAstTextAttribute2) {
14965
+ if (branch.expression === null) {
14966
+ const branchScope = this.getBranchScope(this.scope, branch, index);
14967
+ return ts69.factory.createBlock(branchScope.render());
14968
+ }
14969
+ const outerScope = this.scope.createChildScope(this.scope, branch, [], null);
14970
+ outerScope.render().forEach((stmt) => this.scope.addStatement(stmt));
14971
+ this.expressionScopes.set(branch, outerScope);
14972
+ let expression = tcbExpression(branch.expression, this.tcb, this.scope);
14973
+ if (branch.expressionAlias !== null) {
14974
+ expression = ts69.factory.createBinaryExpression(ts69.factory.createParenthesizedExpression(expression), ts69.SyntaxKind.AmpersandAmpersandToken, outerScope.resolve(branch.expressionAlias));
14975
+ }
14976
+ const bodyScope = this.getBranchScope(outerScope, branch, index);
14977
+ return ts69.factory.createIfStatement(expression, ts69.factory.createBlock(bodyScope.render()), this.generateBranch(index + 1));
14978
+ }
14979
+ getBranchScope(parentScope, branch, index) {
14980
+ const checkBody = this.tcb.env.config.checkControlFlowBodies;
14981
+ return this.scope.createChildScope(parentScope, null, checkBody ? branch.children : [], checkBody ? this.generateBranchGuard(index) : null);
14982
+ }
14983
+ generateBranchGuard(index) {
14984
+ let guard = null;
14985
+ for (let i = 0; i <= index; i++) {
14986
+ const branch = this.block.branches[i];
14987
+ if (branch.expression === null) {
15033
14988
  continue;
15034
14989
  }
15035
- for (const { fieldName, isTwoWayBinding } of attr.inputs) {
15036
- if (genericInputs.has(fieldName)) {
15037
- continue;
15038
- }
15039
- const expression = translateInput(attr.attribute, this.tcb, this.scope);
15040
- genericInputs.set(fieldName, {
15041
- type: "binding",
15042
- field: fieldName,
15043
- expression,
15044
- sourceSpan: attr.attribute.sourceSpan,
15045
- isTwoWayBinding
15046
- });
14990
+ if (!this.expressionScopes.has(branch)) {
14991
+ throw new Error(`Could not determine expression scope of branch at index ${i}`);
15047
14992
  }
15048
- }
15049
- for (const { classPropertyName } of this.dir.inputs) {
15050
- if (!genericInputs.has(classPropertyName)) {
15051
- genericInputs.set(classPropertyName, { type: "unset", field: classPropertyName });
14993
+ const expressionScope = this.expressionScopes.get(branch);
14994
+ let expression;
14995
+ expression = tcbExpression(branch.expression, this.tcb, expressionScope);
14996
+ if (branch.expressionAlias !== null) {
14997
+ expression = ts69.factory.createBinaryExpression(ts69.factory.createParenthesizedExpression(expression), ts69.SyntaxKind.AmpersandAmpersandToken, expressionScope.resolve(branch.expressionAlias));
15052
14998
  }
14999
+ markIgnoreDiagnostics(expression);
15000
+ const comparisonExpression = i === index ? expression : ts69.factory.createPrefixUnaryExpression(ts69.SyntaxKind.ExclamationToken, ts69.factory.createParenthesizedExpression(expression));
15001
+ guard = guard === null ? comparisonExpression : ts69.factory.createBinaryExpression(guard, ts69.SyntaxKind.AmpersandAmpersandToken, comparisonExpression);
15053
15002
  }
15054
- const typeCtor = tcbCallTypeCtor(this.dir, this.tcb, Array.from(genericInputs.values()));
15055
- markIgnoreDiagnostics(typeCtor);
15056
- this.scope.addStatement(tsCreateVariable(id, typeCtor));
15057
- return id;
15058
- }
15059
- circularFallback() {
15060
- return new TcbDirectiveCtorCircularFallbackOp(this.tcb, this.scope, this.dir);
15003
+ return guard;
15061
15004
  }
15062
15005
  };
15063
- var TcbDirectiveInputsOp = class extends TcbOp {
15006
+
15007
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/switch_block.js
15008
+ import ts70 from "typescript";
15009
+ var TcbSwitchOp = class extends TcbOp {
15064
15010
  tcb;
15065
15011
  scope;
15066
- node;
15067
- dir;
15068
- ignoredRequiredInputs;
15069
- constructor(tcb, scope, node, dir, ignoredRequiredInputs) {
15012
+ block;
15013
+ constructor(tcb, scope, block) {
15070
15014
  super();
15071
15015
  this.tcb = tcb;
15072
15016
  this.scope = scope;
15073
- this.node = node;
15074
- this.dir = dir;
15075
- this.ignoredRequiredInputs = ignoredRequiredInputs;
15017
+ this.block = block;
15076
15018
  }
15077
15019
  get optional() {
15078
15020
  return false;
15079
15021
  }
15080
15022
  execute() {
15081
- let dirId = null;
15082
- const boundAttrs = getBoundAttributes(this.dir, this.node);
15083
- const seenRequiredInputs = /* @__PURE__ */ new Set();
15084
- for (const attr of boundAttrs) {
15085
- const expr = widenBinding(translateInput(attr.attribute, this.tcb, this.scope), this.tcb);
15086
- let assignment = wrapForDiagnostics(expr);
15087
- for (const { fieldName, required, transformType, isSignal, isTwoWayBinding } of attr.inputs) {
15088
- let target;
15089
- if (required) {
15090
- seenRequiredInputs.add(fieldName);
15091
- }
15092
- if (this.dir.coercedInputFields.has(fieldName)) {
15093
- let type;
15094
- if (transformType !== null) {
15095
- type = this.tcb.env.referenceTransplantedType(new TransplantedType(transformType));
15096
- } else {
15097
- const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
15098
- if (!ts62.isTypeReferenceNode(dirTypeRef)) {
15099
- throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
15100
- }
15101
- type = tsCreateTypeQueryForCoercedInput(dirTypeRef.typeName, fieldName);
15102
- }
15103
- const id = this.tcb.allocateId();
15104
- this.scope.addStatement(tsDeclareVariable(id, type));
15105
- target = id;
15106
- } else if (this.dir.undeclaredInputFields.has(fieldName)) {
15107
- continue;
15108
- } else if (!this.tcb.env.config.honorAccessModifiersForInputBindings && this.dir.restrictedInputFields.has(fieldName)) {
15109
- if (dirId === null) {
15110
- dirId = this.scope.resolve(this.node, this.dir);
15111
- }
15112
- const id = this.tcb.allocateId();
15113
- const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
15114
- if (!ts62.isTypeReferenceNode(dirTypeRef)) {
15115
- throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
15116
- }
15117
- const type = ts62.factory.createIndexedAccessTypeNode(ts62.factory.createTypeQueryNode(dirId), ts62.factory.createLiteralTypeNode(ts62.factory.createStringLiteral(fieldName)));
15118
- const temp = tsDeclareVariable(id, type);
15119
- this.scope.addStatement(temp);
15120
- target = id;
15121
- } else {
15122
- if (dirId === null) {
15123
- dirId = this.scope.resolve(this.node, this.dir);
15124
- }
15125
- target = this.dir.stringLiteralInputFields.has(fieldName) ? ts62.factory.createElementAccessExpression(dirId, ts62.factory.createStringLiteral(fieldName)) : ts62.factory.createPropertyAccessExpression(dirId, ts62.factory.createIdentifier(fieldName));
15126
- }
15127
- if (isSignal) {
15128
- const inputSignalBrandWriteSymbol = this.tcb.env.referenceExternalSymbol(R3Identifiers4.InputSignalBrandWriteType.moduleName, R3Identifiers4.InputSignalBrandWriteType.name);
15129
- if (!ts62.isIdentifier(inputSignalBrandWriteSymbol) && !ts62.isPropertyAccessExpression(inputSignalBrandWriteSymbol)) {
15130
- throw new Error(`Expected identifier or property access for reference to ${R3Identifiers4.InputSignalBrandWriteType.name}`);
15131
- }
15132
- target = ts62.factory.createElementAccessExpression(target, inputSignalBrandWriteSymbol);
15133
- }
15134
- if (attr.attribute.keySpan !== void 0) {
15135
- addParseSpanInfo(target, attr.attribute.keySpan);
15136
- }
15137
- if (isTwoWayBinding && this.tcb.env.config.allowSignalsInTwoWayBindings) {
15138
- assignment = unwrapWritableSignal(assignment, this.tcb);
15139
- }
15140
- assignment = ts62.factory.createBinaryExpression(target, ts62.SyntaxKind.EqualsToken, assignment);
15141
- }
15142
- addParseSpanInfo(assignment, attr.attribute.sourceSpan);
15143
- if (!this.tcb.env.config.checkTypeOfAttributes && attr.attribute instanceof TmplAstTextAttribute2) {
15144
- markIgnoreDiagnostics(assignment);
15145
- }
15146
- this.scope.addStatement(ts62.factory.createExpressionStatement(assignment));
15147
- }
15148
- this.checkRequiredInputs(seenRequiredInputs);
15023
+ const switchExpression = tcbExpression(this.block.expression, this.tcb, this.scope);
15024
+ const clauses = this.block.cases.map((current) => {
15025
+ const checkBody = this.tcb.env.config.checkControlFlowBodies;
15026
+ const clauseScope = this.scope.createChildScope(this.scope, null, checkBody ? current.children : [], checkBody ? this.generateGuard(current, switchExpression) : null);
15027
+ const statements = [...clauseScope.render(), ts70.factory.createBreakStatement()];
15028
+ return current.expression === null ? ts70.factory.createDefaultClause(statements) : ts70.factory.createCaseClause(tcbExpression(current.expression, this.tcb, clauseScope), statements);
15029
+ });
15030
+ this.scope.addStatement(ts70.factory.createSwitchStatement(switchExpression, ts70.factory.createCaseBlock(clauses)));
15149
15031
  return null;
15150
15032
  }
15151
- checkRequiredInputs(seenRequiredInputs) {
15152
- const missing = [];
15153
- for (const input of this.dir.inputs) {
15154
- if (input.required && !seenRequiredInputs.has(input.classPropertyName) && (this.ignoredRequiredInputs === null || !this.ignoredRequiredInputs.has(input.bindingPropertyName))) {
15155
- missing.push(input.bindingPropertyName);
15156
- }
15033
+ generateGuard(node, switchValue) {
15034
+ if (node.expression !== null) {
15035
+ const expression = tcbExpression(node.expression, this.tcb, this.scope);
15036
+ markIgnoreDiagnostics(expression);
15037
+ return ts70.factory.createBinaryExpression(switchValue, ts70.SyntaxKind.EqualsEqualsEqualsToken, expression);
15157
15038
  }
15158
- if (missing.length > 0) {
15159
- this.tcb.oobRecorder.missingRequiredInputs(this.tcb.id, this.node, this.dir.name, this.dir.isComponent, missing);
15039
+ let guard = null;
15040
+ for (const current of this.block.cases) {
15041
+ if (current.expression === null) {
15042
+ continue;
15043
+ }
15044
+ const expression = tcbExpression(current.expression, this.tcb, this.scope);
15045
+ markIgnoreDiagnostics(expression);
15046
+ const comparison = ts70.factory.createBinaryExpression(switchValue, ts70.SyntaxKind.ExclamationEqualsEqualsToken, expression);
15047
+ if (guard === null) {
15048
+ guard = comparison;
15049
+ } else {
15050
+ guard = ts70.factory.createBinaryExpression(guard, ts70.SyntaxKind.AmpersandAmpersandToken, comparison);
15051
+ }
15160
15052
  }
15053
+ return guard;
15161
15054
  }
15162
15055
  };
15163
- var TcbDirectiveCtorCircularFallbackOp = class extends TcbOp {
15056
+
15057
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/for_block.js
15058
+ import { ImplicitReceiver as ImplicitReceiver4, PropertyRead as PropertyRead5, TmplAstVariable } from "@angular/compiler";
15059
+ import ts71 from "typescript";
15060
+ var TcbForOfOp = class extends TcbOp {
15164
15061
  tcb;
15165
15062
  scope;
15166
- dir;
15167
- constructor(tcb, scope, dir) {
15063
+ block;
15064
+ constructor(tcb, scope, block) {
15168
15065
  super();
15169
15066
  this.tcb = tcb;
15170
15067
  this.scope = scope;
15171
- this.dir = dir;
15068
+ this.block = block;
15172
15069
  }
15173
15070
  get optional() {
15174
15071
  return false;
15175
15072
  }
15176
15073
  execute() {
15177
- const id = this.tcb.allocateId();
15178
- const typeCtor = this.tcb.env.typeCtorFor(this.dir);
15179
- const circularPlaceholder = ts62.factory.createCallExpression(
15180
- typeCtor,
15181
- /* typeArguments */
15182
- void 0,
15183
- [ts62.factory.createNonNullExpression(ts62.factory.createNull())]
15184
- );
15185
- this.scope.addStatement(tsCreateVariable(id, circularPlaceholder));
15186
- return id;
15074
+ const loopScope = this.scope.createChildScope(this.scope, this.block, this.tcb.env.config.checkControlFlowBodies ? this.block.children : [], null);
15075
+ const initializerId = loopScope.resolve(this.block.item);
15076
+ if (!ts71.isIdentifier(initializerId)) {
15077
+ throw new Error(`Could not resolve for loop variable ${this.block.item.name} to an identifier`);
15078
+ }
15079
+ const initializer = ts71.factory.createVariableDeclarationList([ts71.factory.createVariableDeclaration(initializerId)], ts71.NodeFlags.Const);
15080
+ addParseSpanInfo(initializer, this.block.item.keySpan);
15081
+ const expression = ts71.factory.createNonNullExpression(tcbExpression(this.block.expression, this.tcb, this.scope));
15082
+ const trackTranslator = new TcbForLoopTrackTranslator(this.tcb, loopScope, this.block);
15083
+ const trackExpression = trackTranslator.translate(this.block.trackBy);
15084
+ const statements = [
15085
+ ...loopScope.render(),
15086
+ ts71.factory.createExpressionStatement(trackExpression)
15087
+ ];
15088
+ this.scope.addStatement(ts71.factory.createForOfStatement(void 0, initializer, expression, ts71.factory.createBlock(statements)));
15089
+ return null;
15187
15090
  }
15188
15091
  };
15189
- var TcbDomSchemaCheckerOp = class extends TcbOp {
15190
- tcb;
15191
- element;
15192
- checkElement;
15193
- claimedInputs;
15194
- constructor(tcb, element, checkElement, claimedInputs) {
15092
+ var TcbForLoopTrackTranslator = class extends TcbExpressionTranslator {
15093
+ block;
15094
+ allowedVariables;
15095
+ constructor(tcb, scope, block) {
15096
+ super(tcb, scope);
15097
+ this.block = block;
15098
+ this.allowedVariables = /* @__PURE__ */ new Set([block.item]);
15099
+ for (const variable of block.contextVariables) {
15100
+ if (variable.value === "$index") {
15101
+ this.allowedVariables.add(variable);
15102
+ }
15103
+ }
15104
+ }
15105
+ resolve(ast) {
15106
+ if (ast instanceof PropertyRead5 && ast.receiver instanceof ImplicitReceiver4) {
15107
+ const target = this.tcb.boundTarget.getExpressionTarget(ast);
15108
+ if (target !== null && (!(target instanceof TmplAstVariable) || !this.allowedVariables.has(target))) {
15109
+ this.tcb.oobRecorder.illegalForLoopTrackAccess(this.tcb.id, this.block, ast);
15110
+ }
15111
+ }
15112
+ return super.resolve(ast);
15113
+ }
15114
+ };
15115
+
15116
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/let.js
15117
+ import ts72 from "typescript";
15118
+ var TcbLetDeclarationOp = class extends TcbOp {
15119
+ tcb;
15120
+ scope;
15121
+ node;
15122
+ constructor(tcb, scope, node) {
15195
15123
  super();
15196
15124
  this.tcb = tcb;
15197
- this.element = element;
15198
- this.checkElement = checkElement;
15199
- this.claimedInputs = claimedInputs;
15125
+ this.scope = scope;
15126
+ this.node = node;
15127
+ }
15128
+ /**
15129
+ * `@let` declarations are mandatory, because their expressions
15130
+ * should be checked even if they aren't referenced anywhere.
15131
+ */
15132
+ optional = false;
15133
+ execute() {
15134
+ const id = this.tcb.allocateId();
15135
+ addParseSpanInfo(id, this.node.nameSpan);
15136
+ const value = tcbExpression(this.node.value, this.tcb, this.scope);
15137
+ const varStatement = tsCreateVariable(id, wrapForTypeChecker(value), ts72.NodeFlags.Const);
15138
+ addParseSpanInfo(varStatement.declarationList.declarations[0], this.node.sourceSpan);
15139
+ this.scope.addStatement(varStatement);
15140
+ return id;
15200
15141
  }
15142
+ };
15143
+
15144
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/inputs.js
15145
+ import { BindingType as BindingType5, R3Identifiers as R3Identifiers5, TransplantedType } from "@angular/compiler";
15146
+ import ts75 from "typescript";
15147
+
15148
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/signal_forms.js
15149
+ import { BindingType as BindingType3, Call as Call4, PropertyRead as PropertyRead6, SafeCall as SafeCall3, TmplAstElement as TmplAstElement3, TmplAstHostElement as TmplAstHostElement2 } from "@angular/compiler";
15150
+ import ts73 from "typescript";
15151
+ var formControlInputFields = [
15152
+ // Should be kept in sync with the `FormUiControl` bindings,
15153
+ // defined in `packages/forms/signals/src/api/control.ts`.
15154
+ "errors",
15155
+ "invalid",
15156
+ "disabled",
15157
+ "disabledReasons",
15158
+ "name",
15159
+ "readonly",
15160
+ "touched",
15161
+ "max",
15162
+ "maxLength",
15163
+ "min",
15164
+ "minLength",
15165
+ "pattern",
15166
+ "required"
15167
+ ];
15168
+ var customFormControlBannedInputFields = /* @__PURE__ */ new Set([
15169
+ ...formControlInputFields,
15170
+ "value",
15171
+ "checked"
15172
+ ]);
15173
+ var formControlOptionalFields = /* @__PURE__ */ new Set([
15174
+ // Should be kept in sync with the `FormUiControl` bindings,
15175
+ // defined in `packages/forms/signals/src/api/control.ts`.
15176
+ "max",
15177
+ "maxLength",
15178
+ "min",
15179
+ "minLength"
15180
+ ]);
15181
+ var TcbNativeFieldDirectiveTypeOp = class extends TcbOp {
15182
+ tcb;
15183
+ scope;
15184
+ node;
15185
+ /** Bindings that aren't supported on signal form fields. */
15186
+ unsupportedBindingFields = /* @__PURE__ */ new Set([
15187
+ ...formControlInputFields,
15188
+ "value",
15189
+ "checked",
15190
+ "type",
15191
+ "maxlength",
15192
+ "minlength"
15193
+ ]);
15194
+ inputType;
15201
15195
  get optional() {
15202
15196
  return false;
15203
15197
  }
15204
- execute() {
15205
- const element = this.element;
15206
- const isTemplateElement = element instanceof TmplAstElement2 || element instanceof TmplAstComponent2;
15207
- const bindings = isTemplateElement ? element.inputs : element.bindings;
15208
- if (this.checkElement && isTemplateElement) {
15209
- this.tcb.domSchemaChecker.checkElement(this.tcb.id, this.getTagName(element), element.startSourceSpan, this.tcb.schemas, this.tcb.hostIsStandalone);
15198
+ constructor(tcb, scope, node) {
15199
+ super();
15200
+ this.tcb = tcb;
15201
+ this.scope = scope;
15202
+ this.node = node;
15203
+ this.inputType = node.name === "input" && node.attributes.find((attr) => attr.name === "type")?.value || null;
15204
+ if (this.inputType === "radio") {
15205
+ this.unsupportedBindingFields.delete("value");
15210
15206
  }
15211
- for (const binding of bindings) {
15212
- const isPropertyBinding = binding.type === BindingType3.Property || binding.type === BindingType3.TwoWay;
15213
- if (isPropertyBinding && this.claimedInputs?.has(binding.name)) {
15214
- continue;
15215
- }
15216
- if (isPropertyBinding && binding.name !== "style" && binding.name !== "class") {
15217
- const propertyName = REGISTRY.getMappedPropName(binding.name);
15218
- if (isTemplateElement) {
15219
- this.tcb.domSchemaChecker.checkTemplateElementProperty(this.tcb.id, this.getTagName(element), propertyName, binding.sourceSpan, this.tcb.schemas, this.tcb.hostIsStandalone);
15220
- } else {
15221
- this.tcb.domSchemaChecker.checkHostElementProperty(this.tcb.id, element, propertyName, binding.keySpan, this.tcb.schemas);
15222
- }
15223
- }
15207
+ }
15208
+ execute() {
15209
+ const inputs = this.node instanceof TmplAstHostElement2 ? this.node.bindings : this.node.inputs;
15210
+ const fieldBinding = inputs.find((input) => input.type === BindingType3.Property && input.name === "field") ?? null;
15211
+ if (fieldBinding === null) {
15212
+ return null;
15224
15213
  }
15214
+ checkUnsupportedFieldBindings(this.node, this.unsupportedBindingFields, this.tcb);
15215
+ const expectedType = this.node instanceof TmplAstElement3 ? this.getExpectedTypeFromDomNode(this.node) : this.getUnsupportedType();
15216
+ const value = extractFieldValue(fieldBinding.value, this.tcb, this.scope);
15217
+ const id = this.tcb.allocateId();
15218
+ const assignment = ts73.factory.createBinaryExpression(id, ts73.SyntaxKind.EqualsToken, value);
15219
+ addParseSpanInfo(assignment, fieldBinding.valueSpan ?? fieldBinding.sourceSpan);
15220
+ this.scope.addStatement(tsDeclareVariable(id, expectedType));
15221
+ this.scope.addStatement(ts73.factory.createExpressionStatement(assignment));
15225
15222
  return null;
15226
15223
  }
15227
- getTagName(node) {
15228
- return node instanceof TmplAstElement2 ? node.name : getComponentTagName(node);
15224
+ getExpectedTypeFromDomNode(node) {
15225
+ if (node.name === "textarea" || node.name === "select") {
15226
+ return ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.StringKeyword);
15227
+ }
15228
+ if (node.name !== "input") {
15229
+ return this.getUnsupportedType();
15230
+ }
15231
+ switch (this.inputType) {
15232
+ case "checkbox":
15233
+ return ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.BooleanKeyword);
15234
+ case "number":
15235
+ case "range":
15236
+ case "datetime-local":
15237
+ return ts73.factory.createUnionTypeNode([
15238
+ ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.StringKeyword),
15239
+ ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.NumberKeyword)
15240
+ ]);
15241
+ case "date":
15242
+ case "month":
15243
+ case "time":
15244
+ case "week":
15245
+ return ts73.factory.createUnionTypeNode([
15246
+ ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.StringKeyword),
15247
+ ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.NumberKeyword),
15248
+ ts73.factory.createTypeReferenceNode("Date"),
15249
+ ts73.factory.createLiteralTypeNode(ts73.factory.createNull())
15250
+ ]);
15251
+ }
15252
+ return ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.StringKeyword);
15253
+ }
15254
+ getUnsupportedType() {
15255
+ return ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.NeverKeyword);
15229
15256
  }
15230
15257
  };
15231
- var TcbControlFlowContentProjectionOp = class extends TcbOp {
15258
+ function expandBoundAttributesForField(directive, node, customFieldType) {
15259
+ const fieldBinding = node.inputs.find((input) => input.type === BindingType3.Property && input.name === "field");
15260
+ if (!fieldBinding) {
15261
+ return null;
15262
+ }
15263
+ let boundInputs = null;
15264
+ let primaryInput;
15265
+ if (customFieldType === "value") {
15266
+ primaryInput = getSyntheticFieldBoundInput(directive, "value", "value", fieldBinding, customFieldType);
15267
+ } else if (customFieldType === "checkbox") {
15268
+ primaryInput = getSyntheticFieldBoundInput(directive, "checked", "value", fieldBinding, customFieldType);
15269
+ } else {
15270
+ primaryInput = null;
15271
+ }
15272
+ if (primaryInput !== null) {
15273
+ boundInputs ??= [];
15274
+ boundInputs.push(primaryInput);
15275
+ }
15276
+ for (const name of formControlInputFields) {
15277
+ const input = getSyntheticFieldBoundInput(directive, name, name, fieldBinding, customFieldType);
15278
+ if (input !== null) {
15279
+ boundInputs ??= [];
15280
+ boundInputs.push(input);
15281
+ }
15282
+ }
15283
+ return boundInputs;
15284
+ }
15285
+ function isFieldDirective(meta) {
15286
+ if (meta.name !== "Field") {
15287
+ return false;
15288
+ }
15289
+ if (meta.ref.bestGuessOwningModule?.specifier === "@angular/forms/signals") {
15290
+ return true;
15291
+ }
15292
+ return ts73.isClassDeclaration(meta.ref.node) && meta.ref.node.members.some((member) => ts73.isPropertyDeclaration(member) && ts73.isComputedPropertyName(member.name) && ts73.isIdentifier(member.name.expression) && member.name.expression.text === "\u0275CONTROL");
15293
+ }
15294
+ function getSyntheticFieldBoundInput(dir, inputName, fieldPropertyName, fieldBinding, customFieldType) {
15295
+ const inputs = dir.inputs.getByBindingPropertyName(inputName);
15296
+ if (inputs === null || inputs.length === 0) {
15297
+ return null;
15298
+ }
15299
+ const { span, sourceSpan } = fieldBinding.value;
15300
+ const outerCall = new Call4(span, sourceSpan, fieldBinding.value, [], sourceSpan);
15301
+ const read = new PropertyRead6(span, sourceSpan, sourceSpan, outerCall, fieldPropertyName);
15302
+ const isTwoWayBinding = customFieldType === "value" && inputName === "value" || customFieldType === "checkbox" && inputName === "checked";
15303
+ let value;
15304
+ if (isTwoWayBinding) {
15305
+ value = read;
15306
+ } else if (formControlOptionalFields.has(fieldPropertyName)) {
15307
+ value = new SafeCall3(span, sourceSpan, read, [], sourceSpan);
15308
+ } else {
15309
+ value = new Call4(span, sourceSpan, read, [], sourceSpan);
15310
+ }
15311
+ return {
15312
+ value,
15313
+ sourceSpan: fieldBinding.sourceSpan,
15314
+ keySpan: fieldBinding.keySpan ?? null,
15315
+ inputs: inputs.map((input) => ({
15316
+ fieldName: input.classPropertyName,
15317
+ required: input.required,
15318
+ transformType: input.transform?.type || null,
15319
+ isSignal: input.isSignal,
15320
+ isTwoWayBinding
15321
+ }))
15322
+ };
15323
+ }
15324
+ function getCustomFieldDirectiveType(meta) {
15325
+ if (hasModelInput("value", meta)) {
15326
+ return "value";
15327
+ } else if (hasModelInput("checked", meta)) {
15328
+ return "checkbox";
15329
+ }
15330
+ return null;
15331
+ }
15332
+ function checkUnsupportedFieldBindings(node, unsupportedBindingFields, tcb) {
15333
+ const inputs = node instanceof TmplAstHostElement2 ? node.bindings : node.inputs;
15334
+ for (const input of inputs) {
15335
+ if (input.type === BindingType3.Property && unsupportedBindingFields.has(input.name)) {
15336
+ tcb.oobRecorder.formFieldUnsupportedBinding(tcb.id, input);
15337
+ } else if (input.type === BindingType3.Attribute && unsupportedBindingFields.has(input.name.toLowerCase())) {
15338
+ tcb.oobRecorder.formFieldUnsupportedBinding(tcb.id, input);
15339
+ }
15340
+ }
15341
+ if (!(node instanceof TmplAstHostElement2)) {
15342
+ for (const attr of node.attributes) {
15343
+ const name = attr.name.toLowerCase();
15344
+ if (name !== "type" && unsupportedBindingFields.has(name)) {
15345
+ tcb.oobRecorder.formFieldUnsupportedBinding(tcb.id, attr);
15346
+ }
15347
+ }
15348
+ }
15349
+ }
15350
+ function extractFieldValue(expression, tcb, scope) {
15351
+ const innerCall = ts73.factory.createCallExpression(tcbExpression(expression, tcb, scope), void 0, void 0);
15352
+ markIgnoreDiagnostics(innerCall);
15353
+ return ts73.factory.createCallExpression(ts73.factory.createPropertyAccessExpression(innerCall, "value"), void 0, void 0);
15354
+ }
15355
+ function hasModelInput(name, meta) {
15356
+ return !!meta.inputs.getByBindingPropertyName(name)?.some((v) => v.isSignal) && meta.outputs.hasBindingPropertyName(name + "Change");
15357
+ }
15358
+
15359
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/bindings.js
15360
+ import { BindingType as BindingType4, TmplAstBoundAttribute as TmplAstBoundAttribute4, TmplAstElement as TmplAstElement4, TmplAstTemplate as TmplAstTemplate3 } from "@angular/compiler";
15361
+ import ts74 from "typescript";
15362
+ function getBoundAttributes(directive, node) {
15363
+ const boundInputs = [];
15364
+ const processAttribute = (attr) => {
15365
+ if (attr instanceof TmplAstBoundAttribute4 && attr.type !== BindingType4.Property && attr.type !== BindingType4.TwoWay) {
15366
+ return;
15367
+ }
15368
+ const inputs = directive.inputs.getByBindingPropertyName(attr.name);
15369
+ if (inputs !== null) {
15370
+ boundInputs.push({
15371
+ value: attr.value,
15372
+ sourceSpan: attr.sourceSpan,
15373
+ keySpan: attr.keySpan ?? null,
15374
+ inputs: inputs.map((input) => {
15375
+ return {
15376
+ fieldName: input.classPropertyName,
15377
+ required: input.required,
15378
+ transformType: input.transform?.type || null,
15379
+ isSignal: input.isSignal,
15380
+ isTwoWayBinding: attr instanceof TmplAstBoundAttribute4 && attr.type === BindingType4.TwoWay
15381
+ };
15382
+ })
15383
+ });
15384
+ }
15385
+ };
15386
+ if (node instanceof TmplAstTemplate3) {
15387
+ if (node.tagName === "ng-template") {
15388
+ node.inputs.forEach(processAttribute);
15389
+ node.attributes.forEach(processAttribute);
15390
+ }
15391
+ node.templateAttrs.forEach(processAttribute);
15392
+ } else {
15393
+ node.inputs.forEach(processAttribute);
15394
+ node.attributes.forEach(processAttribute);
15395
+ }
15396
+ return boundInputs;
15397
+ }
15398
+ function checkSplitTwoWayBinding(inputName, output, inputs, tcb) {
15399
+ const input = inputs.find((input2) => input2.name === inputName);
15400
+ if (input === void 0 || input.sourceSpan !== output.sourceSpan) {
15401
+ return false;
15402
+ }
15403
+ const inputConsumer = tcb.boundTarget.getConsumerOfBinding(input);
15404
+ const outputConsumer = tcb.boundTarget.getConsumerOfBinding(output);
15405
+ if (outputConsumer === null || inputConsumer.ref === void 0 || outputConsumer instanceof TmplAstTemplate3) {
15406
+ return false;
15407
+ }
15408
+ if (outputConsumer instanceof TmplAstElement4) {
15409
+ tcb.oobRecorder.splitTwoWayBinding(tcb.id, input, output, inputConsumer.ref.node, outputConsumer);
15410
+ return true;
15411
+ } else if (outputConsumer.ref !== inputConsumer.ref) {
15412
+ tcb.oobRecorder.splitTwoWayBinding(tcb.id, input, output, inputConsumer.ref.node, outputConsumer.ref.node);
15413
+ return true;
15414
+ }
15415
+ return false;
15416
+ }
15417
+ function widenBinding(expr, tcb) {
15418
+ if (!tcb.env.config.checkTypeOfInputBindings) {
15419
+ return tsCastToAny(expr);
15420
+ } else if (!tcb.env.config.strictNullInputBindings) {
15421
+ if (ts74.isObjectLiteralExpression(expr) || ts74.isArrayLiteralExpression(expr)) {
15422
+ return expr;
15423
+ } else {
15424
+ return ts74.factory.createNonNullExpression(expr);
15425
+ }
15426
+ } else {
15427
+ return expr;
15428
+ }
15429
+ }
15430
+
15431
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/inputs.js
15432
+ function translateInput(value, tcb, scope) {
15433
+ if (typeof value === "string") {
15434
+ return ts75.factory.createStringLiteral(value);
15435
+ } else {
15436
+ return tcbExpression(value, tcb, scope);
15437
+ }
15438
+ }
15439
+ var TcbDirectiveInputsOp = class extends TcbOp {
15232
15440
  tcb;
15233
- element;
15234
- ngContentSelectors;
15235
- componentName;
15236
- category;
15237
- constructor(tcb, element, ngContentSelectors, componentName) {
15441
+ scope;
15442
+ node;
15443
+ dir;
15444
+ customControlType;
15445
+ constructor(tcb, scope, node, dir, customControlType) {
15238
15446
  super();
15239
15447
  this.tcb = tcb;
15240
- this.element = element;
15241
- this.ngContentSelectors = ngContentSelectors;
15242
- this.componentName = componentName;
15243
- this.category = tcb.env.config.controlFlowPreventingContentProjection === "error" ? ts62.DiagnosticCategory.Error : ts62.DiagnosticCategory.Warning;
15244
- }
15245
- optional = false;
15246
- execute() {
15247
- const controlFlowToCheck = this.findPotentialControlFlowNodes();
15248
- if (controlFlowToCheck.length > 0) {
15249
- const matcher = new SelectorMatcher2();
15250
- for (const selector of this.ngContentSelectors) {
15251
- if (selector !== "*") {
15252
- matcher.addSelectables(CssSelector3.parse(selector), selector);
15253
- }
15254
- }
15255
- for (const root of controlFlowToCheck) {
15256
- for (const child of root.children) {
15257
- if (child instanceof TmplAstElement2 || child instanceof TmplAstTemplate) {
15258
- matcher.match(createCssSelectorFromNode(child), (_, originalSelector) => {
15259
- this.tcb.oobRecorder.controlFlowPreventingContentProjection(this.tcb.id, this.category, child, this.componentName, originalSelector, root, this.tcb.hostPreserveWhitespaces);
15260
- });
15261
- }
15262
- }
15448
+ this.scope = scope;
15449
+ this.node = node;
15450
+ this.dir = dir;
15451
+ this.customControlType = customControlType;
15452
+ }
15453
+ get optional() {
15454
+ return false;
15455
+ }
15456
+ execute() {
15457
+ let dirId = null;
15458
+ const seenRequiredInputs = /* @__PURE__ */ new Set();
15459
+ const boundAttrs = getBoundAttributes(this.dir, this.node);
15460
+ if (this.customControlType !== null) {
15461
+ checkUnsupportedFieldBindings(this.node, customFormControlBannedInputFields, this.tcb);
15462
+ const additionalBindings = expandBoundAttributesForField(this.dir, this.node, this.customControlType);
15463
+ if (additionalBindings !== null) {
15464
+ boundAttrs.push(...additionalBindings);
15263
15465
  }
15264
15466
  }
15265
- return null;
15266
- }
15267
- findPotentialControlFlowNodes() {
15268
- const result = [];
15269
- for (const child of this.element.children) {
15270
- if (child instanceof TmplAstForLoopBlock) {
15271
- if (this.shouldCheck(child)) {
15272
- result.push(child);
15273
- }
15274
- if (child.empty !== null && this.shouldCheck(child.empty)) {
15275
- result.push(child.empty);
15467
+ for (const attr of boundAttrs) {
15468
+ const expr = widenBinding(translateInput(attr.value, this.tcb, this.scope), this.tcb);
15469
+ let assignment = wrapForDiagnostics(expr);
15470
+ for (const { fieldName, required, transformType, isSignal, isTwoWayBinding } of attr.inputs) {
15471
+ let target;
15472
+ if (required) {
15473
+ seenRequiredInputs.add(fieldName);
15276
15474
  }
15277
- } else if (child instanceof TmplAstIfBlock) {
15278
- for (const branch of child.branches) {
15279
- if (this.shouldCheck(branch)) {
15280
- result.push(branch);
15475
+ if (this.dir.coercedInputFields.has(fieldName)) {
15476
+ let type;
15477
+ if (transformType !== null) {
15478
+ type = this.tcb.env.referenceTransplantedType(new TransplantedType(transformType));
15479
+ } else {
15480
+ const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
15481
+ if (!ts75.isTypeReferenceNode(dirTypeRef)) {
15482
+ throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
15483
+ }
15484
+ type = tsCreateTypeQueryForCoercedInput(dirTypeRef.typeName, fieldName);
15485
+ }
15486
+ const id = this.tcb.allocateId();
15487
+ this.scope.addStatement(tsDeclareVariable(id, type));
15488
+ target = id;
15489
+ } else if (this.dir.undeclaredInputFields.has(fieldName)) {
15490
+ continue;
15491
+ } else if (!this.tcb.env.config.honorAccessModifiersForInputBindings && this.dir.restrictedInputFields.has(fieldName)) {
15492
+ if (dirId === null) {
15493
+ dirId = this.scope.resolve(this.node, this.dir);
15494
+ }
15495
+ const id = this.tcb.allocateId();
15496
+ const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
15497
+ if (!ts75.isTypeReferenceNode(dirTypeRef)) {
15498
+ throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
15499
+ }
15500
+ const type = ts75.factory.createIndexedAccessTypeNode(ts75.factory.createTypeQueryNode(dirId), ts75.factory.createLiteralTypeNode(ts75.factory.createStringLiteral(fieldName)));
15501
+ const temp = tsDeclareVariable(id, type);
15502
+ this.scope.addStatement(temp);
15503
+ target = id;
15504
+ } else {
15505
+ if (dirId === null) {
15506
+ dirId = this.scope.resolve(this.node, this.dir);
15281
15507
  }
15508
+ target = this.dir.stringLiteralInputFields.has(fieldName) ? ts75.factory.createElementAccessExpression(dirId, ts75.factory.createStringLiteral(fieldName)) : ts75.factory.createPropertyAccessExpression(dirId, ts75.factory.createIdentifier(fieldName));
15282
15509
  }
15283
- } else if (child instanceof TmplAstSwitchBlock) {
15284
- for (const current of child.cases) {
15285
- if (this.shouldCheck(current)) {
15286
- result.push(current);
15510
+ if (isSignal) {
15511
+ const inputSignalBrandWriteSymbol = this.tcb.env.referenceExternalSymbol(R3Identifiers5.InputSignalBrandWriteType.moduleName, R3Identifiers5.InputSignalBrandWriteType.name);
15512
+ if (!ts75.isIdentifier(inputSignalBrandWriteSymbol) && !ts75.isPropertyAccessExpression(inputSignalBrandWriteSymbol)) {
15513
+ throw new Error(`Expected identifier or property access for reference to ${R3Identifiers5.InputSignalBrandWriteType.name}`);
15287
15514
  }
15515
+ target = ts75.factory.createElementAccessExpression(target, inputSignalBrandWriteSymbol);
15516
+ }
15517
+ if (attr.keySpan !== null) {
15518
+ addParseSpanInfo(target, attr.keySpan);
15519
+ }
15520
+ if (isTwoWayBinding && this.tcb.env.config.allowSignalsInTwoWayBindings) {
15521
+ assignment = unwrapWritableSignal(assignment, this.tcb);
15288
15522
  }
15523
+ assignment = ts75.factory.createBinaryExpression(target, ts75.SyntaxKind.EqualsToken, assignment);
15524
+ }
15525
+ addParseSpanInfo(assignment, attr.sourceSpan);
15526
+ if (!this.tcb.env.config.checkTypeOfAttributes && typeof attr.value === "string") {
15527
+ markIgnoreDiagnostics(assignment);
15289
15528
  }
15529
+ this.scope.addStatement(ts75.factory.createExpressionStatement(assignment));
15290
15530
  }
15291
- return result;
15531
+ this.checkRequiredInputs(seenRequiredInputs);
15532
+ return null;
15292
15533
  }
15293
- shouldCheck(node) {
15294
- if (node.children.length < 2) {
15295
- return false;
15296
- }
15297
- let hasSeenRootNode = false;
15298
- for (const child of node.children) {
15299
- if (!(child instanceof TmplAstText) || this.tcb.hostPreserveWhitespaces || child.value.trim().length > 0) {
15300
- if (hasSeenRootNode) {
15301
- return true;
15302
- }
15303
- hasSeenRootNode = true;
15534
+ checkRequiredInputs(seenRequiredInputs) {
15535
+ const missing = [];
15536
+ for (const input of this.dir.inputs) {
15537
+ if (input.required && !seenRequiredInputs.has(input.classPropertyName)) {
15538
+ missing.push(input.bindingPropertyName);
15304
15539
  }
15305
15540
  }
15306
- return false;
15541
+ if (missing.length > 0) {
15542
+ this.tcb.oobRecorder.missingRequiredInputs(this.tcb.id, this.node, this.dir.name, this.dir.isComponent, missing);
15543
+ }
15307
15544
  }
15308
15545
  };
15309
- var TcbHostElementOp = class extends TcbOp {
15546
+ var TcbUnclaimedInputsOp = class extends TcbOp {
15310
15547
  tcb;
15311
15548
  scope;
15312
- element;
15313
- optional = true;
15314
- constructor(tcb, scope, element) {
15549
+ inputs;
15550
+ target;
15551
+ claimedInputs;
15552
+ constructor(tcb, scope, inputs, target, claimedInputs) {
15315
15553
  super();
15316
15554
  this.tcb = tcb;
15317
15555
  this.scope = scope;
15318
- this.element = element;
15556
+ this.inputs = inputs;
15557
+ this.target = target;
15558
+ this.claimedInputs = claimedInputs;
15559
+ }
15560
+ get optional() {
15561
+ return false;
15319
15562
  }
15320
15563
  execute() {
15321
- const id = this.tcb.allocateId();
15322
- const initializer = tsCreateElement(...this.element.tagNames);
15323
- addParseSpanInfo(initializer, this.element.sourceSpan);
15324
- this.scope.addStatement(tsCreateVariable(id, initializer));
15325
- return id;
15564
+ let elId = null;
15565
+ for (const binding of this.inputs) {
15566
+ const isPropertyBinding = binding.type === BindingType5.Property || binding.type === BindingType5.TwoWay;
15567
+ if (isPropertyBinding && this.claimedInputs?.has(binding.name)) {
15568
+ continue;
15569
+ }
15570
+ const expr = widenBinding(tcbExpression(binding.value, this.tcb, this.scope), this.tcb);
15571
+ if (this.tcb.env.config.checkTypeOfDomBindings && isPropertyBinding) {
15572
+ if (binding.name !== "style" && binding.name !== "class") {
15573
+ if (elId === null) {
15574
+ elId = this.scope.resolve(this.target);
15575
+ }
15576
+ const propertyName = REGISTRY.getMappedPropName(binding.name);
15577
+ const prop = ts75.factory.createElementAccessExpression(elId, ts75.factory.createStringLiteral(propertyName));
15578
+ const stmt = ts75.factory.createBinaryExpression(prop, ts75.SyntaxKind.EqualsToken, wrapForDiagnostics(expr));
15579
+ addParseSpanInfo(stmt, binding.sourceSpan);
15580
+ this.scope.addStatement(ts75.factory.createExpressionStatement(stmt));
15581
+ } else {
15582
+ this.scope.addStatement(ts75.factory.createExpressionStatement(expr));
15583
+ }
15584
+ } else {
15585
+ this.scope.addStatement(ts75.factory.createExpressionStatement(expr));
15586
+ }
15587
+ }
15588
+ return null;
15326
15589
  }
15327
15590
  };
15591
+
15592
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/schema.js
15593
+ import { BindingType as BindingType6, TmplAstComponent as TmplAstComponent2, TmplAstElement as TmplAstElement5 } from "@angular/compiler";
15594
+
15595
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/selectorless.js
15596
+ function getComponentTagName(node) {
15597
+ return node.tagName || "ng-component";
15598
+ }
15328
15599
  var TcbComponentNodeOp = class extends TcbOp {
15329
15600
  tcb;
15330
15601
  scope;
@@ -15344,51 +15615,59 @@ var TcbComponentNodeOp = class extends TcbOp {
15344
15615
  return id;
15345
15616
  }
15346
15617
  };
15347
- var TcbUnclaimedInputsOp = class extends TcbOp {
15618
+
15619
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/schema.js
15620
+ var TcbDomSchemaCheckerOp = class extends TcbOp {
15348
15621
  tcb;
15349
- scope;
15350
- inputs;
15351
- target;
15622
+ element;
15623
+ checkElement;
15352
15624
  claimedInputs;
15353
- constructor(tcb, scope, inputs, target, claimedInputs) {
15625
+ constructor(tcb, element, checkElement, claimedInputs) {
15354
15626
  super();
15355
15627
  this.tcb = tcb;
15356
- this.scope = scope;
15357
- this.inputs = inputs;
15358
- this.target = target;
15628
+ this.element = element;
15629
+ this.checkElement = checkElement;
15359
15630
  this.claimedInputs = claimedInputs;
15360
15631
  }
15361
15632
  get optional() {
15362
15633
  return false;
15363
15634
  }
15364
15635
  execute() {
15365
- let elId = null;
15366
- for (const binding of this.inputs) {
15367
- const isPropertyBinding = binding.type === BindingType3.Property || binding.type === BindingType3.TwoWay;
15636
+ const element = this.element;
15637
+ const isTemplateElement = element instanceof TmplAstElement5 || element instanceof TmplAstComponent2;
15638
+ const bindings = isTemplateElement ? element.inputs : element.bindings;
15639
+ if (this.checkElement && isTemplateElement) {
15640
+ this.tcb.domSchemaChecker.checkElement(this.tcb.id, this.getTagName(element), element.startSourceSpan, this.tcb.schemas, this.tcb.hostIsStandalone);
15641
+ }
15642
+ for (const binding of bindings) {
15643
+ const isPropertyBinding = binding.type === BindingType6.Property || binding.type === BindingType6.TwoWay;
15368
15644
  if (isPropertyBinding && this.claimedInputs?.has(binding.name)) {
15369
15645
  continue;
15370
15646
  }
15371
- const expr = widenBinding(tcbExpression(binding.value, this.tcb, this.scope), this.tcb);
15372
- if (this.tcb.env.config.checkTypeOfDomBindings && isPropertyBinding) {
15373
- if (binding.name !== "style" && binding.name !== "class") {
15374
- if (elId === null) {
15375
- elId = this.scope.resolve(this.target);
15376
- }
15377
- const propertyName = REGISTRY.getMappedPropName(binding.name);
15378
- const prop = ts62.factory.createElementAccessExpression(elId, ts62.factory.createStringLiteral(propertyName));
15379
- const stmt = ts62.factory.createBinaryExpression(prop, ts62.SyntaxKind.EqualsToken, wrapForDiagnostics(expr));
15380
- addParseSpanInfo(stmt, binding.sourceSpan);
15381
- this.scope.addStatement(ts62.factory.createExpressionStatement(stmt));
15647
+ if (isPropertyBinding && binding.name !== "style" && binding.name !== "class") {
15648
+ const propertyName = REGISTRY.getMappedPropName(binding.name);
15649
+ if (isTemplateElement) {
15650
+ this.tcb.domSchemaChecker.checkTemplateElementProperty(this.tcb.id, this.getTagName(element), propertyName, binding.sourceSpan, this.tcb.schemas, this.tcb.hostIsStandalone);
15382
15651
  } else {
15383
- this.scope.addStatement(ts62.factory.createExpressionStatement(expr));
15652
+ this.tcb.domSchemaChecker.checkHostElementProperty(this.tcb.id, element, propertyName, binding.keySpan, this.tcb.schemas);
15384
15653
  }
15385
- } else {
15386
- this.scope.addStatement(ts62.factory.createExpressionStatement(expr));
15387
15654
  }
15388
15655
  }
15389
15656
  return null;
15390
15657
  }
15658
+ getTagName(node) {
15659
+ return node instanceof TmplAstElement5 ? node.name : getComponentTagName(node);
15660
+ }
15391
15661
  };
15662
+
15663
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/events.js
15664
+ import { ImplicitReceiver as ImplicitReceiver5, ParsedEventType as ParsedEventType2, PropertyRead as PropertyRead7, ThisReceiver as ThisReceiver3, TmplAstElement as TmplAstElement6 } from "@angular/compiler";
15665
+ import ts76 from "typescript";
15666
+ var EVENT_PARAMETER = "$event";
15667
+ function tcbEventHandlerExpression(ast, tcb, scope) {
15668
+ const translator = new TcbEventHandlerTranslator(tcb, scope);
15669
+ return translator.translate(ast);
15670
+ }
15392
15671
  var TcbDirectiveOutputsOp = class extends TcbOp {
15393
15672
  tcb;
15394
15673
  scope;
@@ -15423,7 +15702,7 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
15423
15702
  if (dirId === null) {
15424
15703
  dirId = this.scope.resolve(this.node, this.dir);
15425
15704
  }
15426
- const outputField = ts62.factory.createElementAccessExpression(dirId, ts62.factory.createStringLiteral(field));
15705
+ const outputField = ts76.factory.createElementAccessExpression(dirId, ts76.factory.createStringLiteral(field));
15427
15706
  addParseSpanInfo(outputField, output.keySpan);
15428
15707
  if (this.tcb.env.config.checkTypeOfOutputEvents) {
15429
15708
  const handler = tcbCreateEventHandler(
@@ -15433,8 +15712,8 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
15433
15712
  0
15434
15713
  /* EventParamType.Infer */
15435
15714
  );
15436
- const subscribeFn = ts62.factory.createPropertyAccessExpression(outputField, "subscribe");
15437
- const call = ts62.factory.createCallExpression(
15715
+ const subscribeFn = ts76.factory.createPropertyAccessExpression(outputField, "subscribe");
15716
+ const call = ts76.factory.createCallExpression(
15438
15717
  subscribeFn,
15439
15718
  /* typeArguments */
15440
15719
  void 0,
@@ -15443,9 +15722,9 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
15443
15722
  ]
15444
15723
  );
15445
15724
  addParseSpanInfo(call, output.sourceSpan);
15446
- this.scope.addStatement(ts62.factory.createExpressionStatement(call));
15725
+ this.scope.addStatement(ts76.factory.createExpressionStatement(call));
15447
15726
  } else {
15448
- this.scope.addStatement(ts62.factory.createExpressionStatement(outputField));
15727
+ this.scope.addStatement(ts76.factory.createExpressionStatement(outputField));
15449
15728
  const handler = tcbCreateEventHandler(
15450
15729
  output,
15451
15730
  this.tcb,
@@ -15453,7 +15732,7 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
15453
15732
  1
15454
15733
  /* EventParamType.Any */
15455
15734
  );
15456
- this.scope.addStatement(ts62.factory.createExpressionStatement(handler));
15735
+ this.scope.addStatement(ts76.factory.createExpressionStatement(handler));
15457
15736
  }
15458
15737
  }
15459
15738
  return null;
@@ -15493,39 +15772,39 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
15493
15772
  if (output.type === ParsedEventType2.LegacyAnimation) {
15494
15773
  const eventType = this.tcb.env.config.checkTypeOfAnimationEvents ? this.tcb.env.referenceExternalType("@angular/animations", "AnimationEvent") : 1;
15495
15774
  const handler = tcbCreateEventHandler(output, this.tcb, this.scope, eventType);
15496
- this.scope.addStatement(ts62.factory.createExpressionStatement(handler));
15775
+ this.scope.addStatement(ts76.factory.createExpressionStatement(handler));
15497
15776
  } else if (output.type === ParsedEventType2.Animation) {
15498
15777
  const eventType = this.tcb.env.referenceExternalType("@angular/core", "AnimationCallbackEvent");
15499
15778
  const handler = tcbCreateEventHandler(output, this.tcb, this.scope, eventType);
15500
- this.scope.addStatement(ts62.factory.createExpressionStatement(handler));
15779
+ this.scope.addStatement(ts76.factory.createExpressionStatement(handler));
15501
15780
  } else if (this.tcb.env.config.checkTypeOfDomEvents) {
15502
15781
  let target;
15503
15782
  let domEventAssertion;
15504
15783
  if (output.target === "window" || output.target === "document") {
15505
- target = ts62.factory.createIdentifier(output.target);
15784
+ target = ts76.factory.createIdentifier(output.target);
15506
15785
  } else if (elId === null) {
15507
15786
  target = elId = this.scope.resolve(this.target);
15508
15787
  } else {
15509
15788
  target = elId;
15510
15789
  }
15511
- if (this.target instanceof TmplAstElement2 && this.target.isVoid && ts62.isIdentifier(target) && this.tcb.env.config.allowDomEventAssertion) {
15512
- domEventAssertion = ts62.factory.createCallExpression(this.tcb.env.referenceExternalSymbol("@angular/core", "\u0275assertType"), [ts62.factory.createTypeQueryNode(target)], [
15513
- ts62.factory.createPropertyAccessExpression(ts62.factory.createIdentifier(EVENT_PARAMETER), "target")
15790
+ if (this.target instanceof TmplAstElement6 && this.target.isVoid && ts76.isIdentifier(target) && this.tcb.env.config.allowDomEventAssertion) {
15791
+ domEventAssertion = ts76.factory.createCallExpression(this.tcb.env.referenceExternalSymbol("@angular/core", "\u0275assertType"), [ts76.factory.createTypeQueryNode(target)], [
15792
+ ts76.factory.createPropertyAccessExpression(ts76.factory.createIdentifier(EVENT_PARAMETER), "target")
15514
15793
  ]);
15515
15794
  }
15516
- const propertyAccess = ts62.factory.createPropertyAccessExpression(target, "addEventListener");
15795
+ const propertyAccess = ts76.factory.createPropertyAccessExpression(target, "addEventListener");
15517
15796
  addParseSpanInfo(propertyAccess, output.keySpan);
15518
15797
  const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0, domEventAssertion);
15519
- const call = ts62.factory.createCallExpression(
15798
+ const call = ts76.factory.createCallExpression(
15520
15799
  /* expression */
15521
15800
  propertyAccess,
15522
15801
  /* typeArguments */
15523
15802
  void 0,
15524
15803
  /* arguments */
15525
- [ts62.factory.createStringLiteral(output.name), handler]
15804
+ [ts76.factory.createStringLiteral(output.name), handler]
15526
15805
  );
15527
15806
  addParseSpanInfo(call, output.sourceSpan);
15528
- this.scope.addStatement(ts62.factory.createExpressionStatement(call));
15807
+ this.scope.addStatement(ts76.factory.createExpressionStatement(call));
15529
15808
  } else {
15530
15809
  const handler = tcbCreateEventHandler(
15531
15810
  output,
@@ -15534,218 +15813,355 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
15534
15813
  1
15535
15814
  /* EventParamType.Any */
15536
15815
  );
15537
- this.scope.addStatement(ts62.factory.createExpressionStatement(handler));
15816
+ this.scope.addStatement(ts76.factory.createExpressionStatement(handler));
15538
15817
  }
15539
15818
  }
15540
15819
  return null;
15541
15820
  }
15542
15821
  };
15543
- var TcbComponentContextCompletionOp = class extends TcbOp {
15544
- scope;
15545
- constructor(scope) {
15546
- super();
15547
- this.scope = scope;
15822
+ var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
15823
+ resolve(ast) {
15824
+ if (ast instanceof PropertyRead7 && ast.receiver instanceof ImplicitReceiver5 && !(ast.receiver instanceof ThisReceiver3) && ast.name === EVENT_PARAMETER) {
15825
+ const event = ts76.factory.createIdentifier(EVENT_PARAMETER);
15826
+ addParseSpanInfo(event, ast.nameSpan);
15827
+ return event;
15828
+ }
15829
+ return super.resolve(ast);
15548
15830
  }
15549
- optional = false;
15550
- execute() {
15551
- const ctx = ts62.factory.createThis();
15552
- const ctxDot = ts62.factory.createPropertyAccessExpression(ctx, "");
15553
- markIgnoreDiagnostics(ctxDot);
15554
- addExpressionIdentifier(ctxDot, ExpressionIdentifier.COMPONENT_COMPLETION);
15555
- this.scope.addStatement(ts62.factory.createExpressionStatement(ctxDot));
15556
- return null;
15831
+ isValidLetDeclarationAccess() {
15832
+ return true;
15557
15833
  }
15558
15834
  };
15559
- var TcbBlockVariableOp = class extends TcbOp {
15835
+ function tcbCreateEventHandler(event, tcb, scope, eventType, assertionExpression) {
15836
+ const handler = tcbEventHandlerExpression(event.handler, tcb, scope);
15837
+ const statements = [];
15838
+ if (assertionExpression !== void 0) {
15839
+ statements.push(ts76.factory.createExpressionStatement(assertionExpression));
15840
+ }
15841
+ if (event.type === ParsedEventType2.TwoWay && tcb.env.config.checkTwoWayBoundEvents) {
15842
+ const target = tcb.allocateId();
15843
+ const assignment = ts76.factory.createBinaryExpression(target, ts76.SyntaxKind.EqualsToken, ts76.factory.createIdentifier(EVENT_PARAMETER));
15844
+ statements.push(tsCreateVariable(target, tcb.env.config.allowSignalsInTwoWayBindings ? unwrapWritableSignal(handler, tcb) : handler), ts76.factory.createExpressionStatement(assignment));
15845
+ } else {
15846
+ statements.push(ts76.factory.createExpressionStatement(handler));
15847
+ }
15848
+ let eventParamType;
15849
+ if (eventType === 0) {
15850
+ eventParamType = void 0;
15851
+ } else if (eventType === 1) {
15852
+ eventParamType = ts76.factory.createKeywordTypeNode(ts76.SyntaxKind.AnyKeyword);
15853
+ } else {
15854
+ eventParamType = eventType;
15855
+ }
15856
+ const guards = scope.guards();
15857
+ let body = ts76.factory.createBlock(statements);
15858
+ if (guards !== null) {
15859
+ body = ts76.factory.createBlock([ts76.factory.createIfStatement(guards, body)]);
15860
+ }
15861
+ const eventParam = ts76.factory.createParameterDeclaration(
15862
+ /* modifiers */
15863
+ void 0,
15864
+ /* dotDotDotToken */
15865
+ void 0,
15866
+ /* name */
15867
+ EVENT_PARAMETER,
15868
+ /* questionToken */
15869
+ void 0,
15870
+ /* type */
15871
+ eventParamType
15872
+ );
15873
+ addExpressionIdentifier(eventParam, ExpressionIdentifier.EVENT_PARAMETER);
15874
+ return ts76.factory.createArrowFunction(
15875
+ /* modifiers */
15876
+ void 0,
15877
+ /* typeParameters */
15878
+ void 0,
15879
+ /* parameters */
15880
+ [eventParam],
15881
+ /* type */
15882
+ ts76.factory.createKeywordTypeNode(ts76.SyntaxKind.AnyKeyword),
15883
+ /* equalsGreaterThanToken */
15884
+ void 0,
15885
+ /* body */
15886
+ body
15887
+ );
15888
+ }
15889
+
15890
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/directive_type.js
15891
+ import { TmplAstHostElement as TmplAstHostElement3 } from "@angular/compiler";
15892
+ import ts77 from "typescript";
15893
+ var TcbDirectiveTypeOpBase = class extends TcbOp {
15560
15894
  tcb;
15561
15895
  scope;
15562
- initializer;
15563
- variable;
15564
- constructor(tcb, scope, initializer, variable) {
15896
+ node;
15897
+ dir;
15898
+ constructor(tcb, scope, node, dir) {
15565
15899
  super();
15566
15900
  this.tcb = tcb;
15567
15901
  this.scope = scope;
15568
- this.initializer = initializer;
15569
- this.variable = variable;
15902
+ this.node = node;
15903
+ this.dir = dir;
15570
15904
  }
15571
15905
  get optional() {
15572
- return false;
15906
+ return true;
15573
15907
  }
15574
15908
  execute() {
15909
+ const dirRef = this.dir.ref;
15910
+ const rawType = this.tcb.env.referenceType(this.dir.ref);
15911
+ let type;
15912
+ let span;
15913
+ if (this.dir.isGeneric === false || dirRef.node.typeParameters === void 0) {
15914
+ type = rawType;
15915
+ } else {
15916
+ if (!ts77.isTypeReferenceNode(rawType)) {
15917
+ throw new Error(`Expected TypeReferenceNode when referencing the type for ${this.dir.ref.debugName}`);
15918
+ }
15919
+ const typeArguments = dirRef.node.typeParameters.map(() => ts77.factory.createKeywordTypeNode(ts77.SyntaxKind.AnyKeyword));
15920
+ type = ts77.factory.createTypeReferenceNode(rawType.typeName, typeArguments);
15921
+ }
15922
+ if (this.node instanceof TmplAstHostElement3) {
15923
+ span = this.node.sourceSpan;
15924
+ } else {
15925
+ span = this.node.startSourceSpan || this.node.sourceSpan;
15926
+ }
15575
15927
  const id = this.tcb.allocateId();
15576
- addParseSpanInfo(id, this.variable.keySpan);
15577
- const variable = tsCreateVariable(id, wrapForTypeChecker(this.initializer));
15578
- addParseSpanInfo(variable.declarationList.declarations[0], this.variable.sourceSpan);
15579
- this.scope.addStatement(variable);
15928
+ addExpressionIdentifier(id, ExpressionIdentifier.DIRECTIVE);
15929
+ addParseSpanInfo(id, span);
15930
+ this.scope.addStatement(tsDeclareVariable(id, type));
15580
15931
  return id;
15581
15932
  }
15582
15933
  };
15583
- var TcbBlockImplicitVariableOp = class extends TcbOp {
15584
- tcb;
15585
- scope;
15586
- type;
15587
- variable;
15588
- constructor(tcb, scope, type, variable) {
15589
- super();
15590
- this.tcb = tcb;
15591
- this.scope = scope;
15592
- this.type = type;
15593
- this.variable = variable;
15934
+ var TcbNonGenericDirectiveTypeOp = class extends TcbDirectiveTypeOpBase {
15935
+ /**
15936
+ * Creates a variable declaration for this op's directive of the argument type. Returns the id of
15937
+ * the newly created variable.
15938
+ */
15939
+ execute() {
15940
+ const dirRef = this.dir.ref;
15941
+ if (this.dir.isGeneric) {
15942
+ throw new Error(`Assertion Error: expected ${dirRef.debugName} not to be generic.`);
15943
+ }
15944
+ return super.execute();
15594
15945
  }
15595
- optional = true;
15946
+ };
15947
+ var TcbGenericDirectiveTypeWithAnyParamsOp = class extends TcbDirectiveTypeOpBase {
15596
15948
  execute() {
15597
- const id = this.tcb.allocateId();
15598
- addParseSpanInfo(id, this.variable.keySpan);
15599
- const variable = tsDeclareVariable(id, this.type);
15600
- addParseSpanInfo(variable.declarationList.declarations[0], this.variable.sourceSpan);
15601
- this.scope.addStatement(variable);
15602
- return id;
15949
+ const dirRef = this.dir.ref;
15950
+ if (dirRef.node.typeParameters === void 0) {
15951
+ throw new Error(`Assertion Error: expected typeParameters when creating a declaration for ${dirRef.debugName}`);
15952
+ }
15953
+ return super.execute();
15603
15954
  }
15604
15955
  };
15605
- var TcbIfOp = class extends TcbOp {
15956
+
15957
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/directive_constructor.js
15958
+ import { TmplAstHostElement as TmplAstHostElement4 } from "@angular/compiler";
15959
+ import ts78 from "typescript";
15960
+ var TcbDirectiveCtorOp = class extends TcbOp {
15606
15961
  tcb;
15607
15962
  scope;
15608
- block;
15609
- expressionScopes = /* @__PURE__ */ new Map();
15610
- constructor(tcb, scope, block) {
15963
+ node;
15964
+ dir;
15965
+ customControlType;
15966
+ constructor(tcb, scope, node, dir, customControlType) {
15611
15967
  super();
15612
15968
  this.tcb = tcb;
15613
15969
  this.scope = scope;
15614
- this.block = block;
15970
+ this.node = node;
15971
+ this.dir = dir;
15972
+ this.customControlType = customControlType;
15615
15973
  }
15616
15974
  get optional() {
15617
- return false;
15975
+ return true;
15618
15976
  }
15619
15977
  execute() {
15620
- const root = this.generateBranch(0);
15621
- root && this.scope.addStatement(root);
15622
- return null;
15623
- }
15624
- generateBranch(index) {
15625
- const branch = this.block.branches[index];
15626
- if (!branch) {
15627
- return void 0;
15628
- }
15629
- if (branch.expression === null) {
15630
- const branchScope = this.getBranchScope(this.scope, branch, index);
15631
- return ts62.factory.createBlock(branchScope.render());
15632
- }
15633
- const outerScope = Scope.forNodes(this.tcb, this.scope, branch, [], null);
15634
- outerScope.render().forEach((stmt) => this.scope.addStatement(stmt));
15635
- this.expressionScopes.set(branch, outerScope);
15636
- let expression = tcbExpression(branch.expression, this.tcb, this.scope);
15637
- if (branch.expressionAlias !== null) {
15638
- expression = ts62.factory.createBinaryExpression(ts62.factory.createParenthesizedExpression(expression), ts62.SyntaxKind.AmpersandAmpersandToken, outerScope.resolve(branch.expressionAlias));
15978
+ const genericInputs = /* @__PURE__ */ new Map();
15979
+ const id = this.tcb.allocateId();
15980
+ let boundAttrs;
15981
+ let span;
15982
+ if (this.node instanceof TmplAstHostElement4) {
15983
+ boundAttrs = [];
15984
+ span = this.node.sourceSpan;
15985
+ } else {
15986
+ span = this.node.startSourceSpan || this.node.sourceSpan;
15987
+ boundAttrs = getBoundAttributes(this.dir, this.node);
15988
+ if (this.customControlType !== null) {
15989
+ const additionalBindings = expandBoundAttributesForField(this.dir, this.node, this.customControlType);
15990
+ if (additionalBindings !== null) {
15991
+ boundAttrs.push(...additionalBindings);
15992
+ }
15993
+ }
15639
15994
  }
15640
- const bodyScope = this.getBranchScope(outerScope, branch, index);
15641
- return ts62.factory.createIfStatement(expression, ts62.factory.createBlock(bodyScope.render()), this.generateBranch(index + 1));
15642
- }
15643
- getBranchScope(parentScope, branch, index) {
15644
- const checkBody = this.tcb.env.config.checkControlFlowBodies;
15645
- return Scope.forNodes(this.tcb, parentScope, null, checkBody ? branch.children : [], checkBody ? this.generateBranchGuard(index) : null);
15646
- }
15647
- generateBranchGuard(index) {
15648
- let guard = null;
15649
- for (let i = 0; i <= index; i++) {
15650
- const branch = this.block.branches[i];
15651
- if (branch.expression === null) {
15995
+ addExpressionIdentifier(id, ExpressionIdentifier.DIRECTIVE);
15996
+ addParseSpanInfo(id, span);
15997
+ for (const attr of boundAttrs) {
15998
+ if (!this.tcb.env.config.checkTypeOfAttributes && typeof attr.value === "string") {
15652
15999
  continue;
15653
16000
  }
15654
- if (!this.expressionScopes.has(branch)) {
15655
- throw new Error(`Could not determine expression scope of branch at index ${i}`);
16001
+ for (const { fieldName, isTwoWayBinding } of attr.inputs) {
16002
+ if (genericInputs.has(fieldName)) {
16003
+ continue;
16004
+ }
16005
+ const expression = translateInput(attr.value, this.tcb, this.scope);
16006
+ genericInputs.set(fieldName, {
16007
+ type: "binding",
16008
+ field: fieldName,
16009
+ expression,
16010
+ sourceSpan: attr.sourceSpan,
16011
+ isTwoWayBinding
16012
+ });
15656
16013
  }
15657
- const expressionScope = this.expressionScopes.get(branch);
15658
- let expression;
15659
- expression = tcbExpression(branch.expression, this.tcb, expressionScope);
15660
- if (branch.expressionAlias !== null) {
15661
- expression = ts62.factory.createBinaryExpression(ts62.factory.createParenthesizedExpression(expression), ts62.SyntaxKind.AmpersandAmpersandToken, expressionScope.resolve(branch.expressionAlias));
16014
+ }
16015
+ for (const { classPropertyName } of this.dir.inputs) {
16016
+ if (!genericInputs.has(classPropertyName)) {
16017
+ genericInputs.set(classPropertyName, { type: "unset", field: classPropertyName });
15662
16018
  }
15663
- markIgnoreDiagnostics(expression);
15664
- const comparisonExpression = i === index ? expression : ts62.factory.createPrefixUnaryExpression(ts62.SyntaxKind.ExclamationToken, ts62.factory.createParenthesizedExpression(expression));
15665
- guard = guard === null ? comparisonExpression : ts62.factory.createBinaryExpression(guard, ts62.SyntaxKind.AmpersandAmpersandToken, comparisonExpression);
15666
16019
  }
15667
- return guard;
16020
+ const typeCtor = tcbCallTypeCtor(this.dir, this.tcb, Array.from(genericInputs.values()));
16021
+ markIgnoreDiagnostics(typeCtor);
16022
+ this.scope.addStatement(tsCreateVariable(id, typeCtor));
16023
+ return id;
16024
+ }
16025
+ circularFallback() {
16026
+ return new TcbDirectiveCtorCircularFallbackOp(this.tcb, this.scope, this.dir);
15668
16027
  }
15669
16028
  };
15670
- var TcbSwitchOp = class extends TcbOp {
16029
+ var TcbDirectiveCtorCircularFallbackOp = class extends TcbOp {
15671
16030
  tcb;
15672
16031
  scope;
15673
- block;
15674
- constructor(tcb, scope, block) {
16032
+ dir;
16033
+ constructor(tcb, scope, dir) {
15675
16034
  super();
15676
16035
  this.tcb = tcb;
15677
16036
  this.scope = scope;
15678
- this.block = block;
16037
+ this.dir = dir;
15679
16038
  }
15680
16039
  get optional() {
15681
16040
  return false;
15682
16041
  }
15683
16042
  execute() {
15684
- const switchExpression = tcbExpression(this.block.expression, this.tcb, this.scope);
15685
- const clauses = this.block.cases.map((current) => {
15686
- const checkBody = this.tcb.env.config.checkControlFlowBodies;
15687
- const clauseScope = Scope.forNodes(this.tcb, this.scope, null, checkBody ? current.children : [], checkBody ? this.generateGuard(current, switchExpression) : null);
15688
- const statements = [...clauseScope.render(), ts62.factory.createBreakStatement()];
15689
- return current.expression === null ? ts62.factory.createDefaultClause(statements) : ts62.factory.createCaseClause(tcbExpression(current.expression, this.tcb, clauseScope), statements);
15690
- });
15691
- this.scope.addStatement(ts62.factory.createSwitchStatement(switchExpression, ts62.factory.createCaseBlock(clauses)));
15692
- return null;
16043
+ const id = this.tcb.allocateId();
16044
+ const typeCtor = this.tcb.env.typeCtorFor(this.dir);
16045
+ const circularPlaceholder = ts78.factory.createCallExpression(
16046
+ typeCtor,
16047
+ /* typeArguments */
16048
+ void 0,
16049
+ [ts78.factory.createNonNullExpression(ts78.factory.createNull())]
16050
+ );
16051
+ this.scope.addStatement(tsCreateVariable(id, circularPlaceholder));
16052
+ return id;
15693
16053
  }
15694
- generateGuard(node, switchValue) {
15695
- if (node.expression !== null) {
15696
- const expression = tcbExpression(node.expression, this.tcb, this.scope);
15697
- markIgnoreDiagnostics(expression);
15698
- return ts62.factory.createBinaryExpression(switchValue, ts62.SyntaxKind.EqualsEqualsEqualsToken, expression);
16054
+ };
16055
+ function tcbCallTypeCtor(dir, tcb, inputs) {
16056
+ const typeCtor = tcb.env.typeCtorFor(dir);
16057
+ const members = inputs.map((input) => {
16058
+ const propertyName = ts78.factory.createStringLiteral(input.field);
16059
+ if (input.type === "binding") {
16060
+ let expr = widenBinding(input.expression, tcb);
16061
+ if (input.isTwoWayBinding && tcb.env.config.allowSignalsInTwoWayBindings) {
16062
+ expr = unwrapWritableSignal(expr, tcb);
16063
+ }
16064
+ const assignment = ts78.factory.createPropertyAssignment(propertyName, wrapForDiagnostics(expr));
16065
+ addParseSpanInfo(assignment, input.sourceSpan);
16066
+ return assignment;
16067
+ } else {
16068
+ return ts78.factory.createPropertyAssignment(propertyName, getAnyExpression());
15699
16069
  }
15700
- let guard = null;
15701
- for (const current of this.block.cases) {
15702
- if (current.expression === null) {
15703
- continue;
16070
+ });
16071
+ return ts78.factory.createCallExpression(
16072
+ /* expression */
16073
+ typeCtor,
16074
+ /* typeArguments */
16075
+ void 0,
16076
+ /* argumentsArray */
16077
+ [ts78.factory.createObjectLiteralExpression(members)]
16078
+ );
16079
+ }
16080
+
16081
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/content_projection.js
16082
+ import { createCssSelectorFromNode, CssSelector as CssSelector3, SelectorMatcher as SelectorMatcher2, TmplAstElement as TmplAstElement7, TmplAstForLoopBlock, TmplAstIfBlock, TmplAstSwitchBlock, TmplAstTemplate as TmplAstTemplate4, TmplAstText } from "@angular/compiler";
16083
+ import ts79 from "typescript";
16084
+ var TcbControlFlowContentProjectionOp = class extends TcbOp {
16085
+ tcb;
16086
+ element;
16087
+ ngContentSelectors;
16088
+ componentName;
16089
+ category;
16090
+ constructor(tcb, element, ngContentSelectors, componentName) {
16091
+ super();
16092
+ this.tcb = tcb;
16093
+ this.element = element;
16094
+ this.ngContentSelectors = ngContentSelectors;
16095
+ this.componentName = componentName;
16096
+ this.category = tcb.env.config.controlFlowPreventingContentProjection === "error" ? ts79.DiagnosticCategory.Error : ts79.DiagnosticCategory.Warning;
16097
+ }
16098
+ optional = false;
16099
+ execute() {
16100
+ const controlFlowToCheck = this.findPotentialControlFlowNodes();
16101
+ if (controlFlowToCheck.length > 0) {
16102
+ const matcher = new SelectorMatcher2();
16103
+ for (const selector of this.ngContentSelectors) {
16104
+ if (selector !== "*") {
16105
+ matcher.addSelectables(CssSelector3.parse(selector), selector);
16106
+ }
15704
16107
  }
15705
- const expression = tcbExpression(current.expression, this.tcb, this.scope);
15706
- markIgnoreDiagnostics(expression);
15707
- const comparison = ts62.factory.createBinaryExpression(switchValue, ts62.SyntaxKind.ExclamationEqualsEqualsToken, expression);
15708
- if (guard === null) {
15709
- guard = comparison;
15710
- } else {
15711
- guard = ts62.factory.createBinaryExpression(guard, ts62.SyntaxKind.AmpersandAmpersandToken, comparison);
16108
+ for (const root of controlFlowToCheck) {
16109
+ for (const child of root.children) {
16110
+ if (child instanceof TmplAstElement7 || child instanceof TmplAstTemplate4) {
16111
+ matcher.match(createCssSelectorFromNode(child), (_, originalSelector) => {
16112
+ this.tcb.oobRecorder.controlFlowPreventingContentProjection(this.tcb.id, this.category, child, this.componentName, originalSelector, root, this.tcb.hostPreserveWhitespaces);
16113
+ });
16114
+ }
16115
+ }
16116
+ }
16117
+ }
16118
+ return null;
16119
+ }
16120
+ findPotentialControlFlowNodes() {
16121
+ const result = [];
16122
+ for (const child of this.element.children) {
16123
+ if (child instanceof TmplAstForLoopBlock) {
16124
+ if (this.shouldCheck(child)) {
16125
+ result.push(child);
16126
+ }
16127
+ if (child.empty !== null && this.shouldCheck(child.empty)) {
16128
+ result.push(child.empty);
16129
+ }
16130
+ } else if (child instanceof TmplAstIfBlock) {
16131
+ for (const branch of child.branches) {
16132
+ if (this.shouldCheck(branch)) {
16133
+ result.push(branch);
16134
+ }
16135
+ }
16136
+ } else if (child instanceof TmplAstSwitchBlock) {
16137
+ for (const current of child.cases) {
16138
+ if (this.shouldCheck(current)) {
16139
+ result.push(current);
16140
+ }
16141
+ }
15712
16142
  }
15713
16143
  }
15714
- return guard;
15715
- }
15716
- };
15717
- var TcbForOfOp = class extends TcbOp {
15718
- tcb;
15719
- scope;
15720
- block;
15721
- constructor(tcb, scope, block) {
15722
- super();
15723
- this.tcb = tcb;
15724
- this.scope = scope;
15725
- this.block = block;
15726
- }
15727
- get optional() {
15728
- return false;
16144
+ return result;
15729
16145
  }
15730
- execute() {
15731
- const loopScope = Scope.forNodes(this.tcb, this.scope, this.block, this.tcb.env.config.checkControlFlowBodies ? this.block.children : [], null);
15732
- const initializerId = loopScope.resolve(this.block.item);
15733
- if (!ts62.isIdentifier(initializerId)) {
15734
- throw new Error(`Could not resolve for loop variable ${this.block.item.name} to an identifier`);
16146
+ shouldCheck(node) {
16147
+ if (node.children.length < 2) {
16148
+ return false;
15735
16149
  }
15736
- const initializer = ts62.factory.createVariableDeclarationList([ts62.factory.createVariableDeclaration(initializerId)], ts62.NodeFlags.Const);
15737
- addParseSpanInfo(initializer, this.block.item.keySpan);
15738
- const expression = ts62.factory.createNonNullExpression(tcbExpression(this.block.expression, this.tcb, this.scope));
15739
- const trackTranslator = new TcbForLoopTrackTranslator(this.tcb, loopScope, this.block);
15740
- const trackExpression = trackTranslator.translate(this.block.trackBy);
15741
- const statements = [
15742
- ...loopScope.render(),
15743
- ts62.factory.createExpressionStatement(trackExpression)
15744
- ];
15745
- this.scope.addStatement(ts62.factory.createForOfStatement(void 0, initializer, expression, ts62.factory.createBlock(statements)));
15746
- return null;
16150
+ let hasSeenRootNode = false;
16151
+ for (const child of node.children) {
16152
+ if (!(child instanceof TmplAstText) || this.tcb.hostPreserveWhitespaces || child.value.trim().length > 0) {
16153
+ if (hasSeenRootNode) {
16154
+ return true;
16155
+ }
16156
+ hasSeenRootNode = true;
16157
+ }
16158
+ }
16159
+ return false;
15747
16160
  }
15748
16161
  };
16162
+
16163
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/intersection_observer.js
16164
+ import ts80 from "typescript";
15749
16165
  var TcbIntersectionObserverOp = class extends TcbOp {
15750
16166
  tcb;
15751
16167
  scope;
@@ -15759,50 +16175,35 @@ var TcbIntersectionObserverOp = class extends TcbOp {
15759
16175
  optional = false;
15760
16176
  execute() {
15761
16177
  const options = tcbExpression(this.options, this.tcb, this.scope);
15762
- const callback = ts62.factory.createNonNullExpression(ts62.factory.createNull());
15763
- const expression = ts62.factory.createNewExpression(ts62.factory.createIdentifier("IntersectionObserver"), void 0, [callback, options]);
15764
- this.scope.addStatement(ts62.factory.createExpressionStatement(expression));
16178
+ const callback = ts80.factory.createNonNullExpression(ts80.factory.createNull());
16179
+ const expression = ts80.factory.createNewExpression(ts80.factory.createIdentifier("IntersectionObserver"), void 0, [callback, options]);
16180
+ this.scope.addStatement(ts80.factory.createExpressionStatement(expression));
15765
16181
  return null;
15766
16182
  }
15767
16183
  };
15768
- var Context2 = class {
15769
- env;
15770
- domSchemaChecker;
15771
- oobRecorder;
15772
- id;
15773
- boundTarget;
15774
- pipes;
15775
- schemas;
15776
- hostIsStandalone;
15777
- hostPreserveWhitespaces;
15778
- nextId = 1;
15779
- constructor(env, domSchemaChecker, oobRecorder, id, boundTarget, pipes, schemas, hostIsStandalone, hostPreserveWhitespaces) {
15780
- this.env = env;
15781
- this.domSchemaChecker = domSchemaChecker;
15782
- this.oobRecorder = oobRecorder;
15783
- this.id = id;
15784
- this.boundTarget = boundTarget;
15785
- this.pipes = pipes;
15786
- this.schemas = schemas;
15787
- this.hostIsStandalone = hostIsStandalone;
15788
- this.hostPreserveWhitespaces = hostPreserveWhitespaces;
15789
- }
15790
- /**
15791
- * Allocate a new variable name for use within the `Context`.
15792
- *
15793
- * Currently this uses a monotonically increasing counter, but in the future the variable name
15794
- * might change depending on the type of data being stored.
15795
- */
15796
- allocateId() {
15797
- return ts62.factory.createIdentifier(`_t${this.nextId++}`);
16184
+
16185
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/host.js
16186
+ var TcbHostElementOp = class extends TcbOp {
16187
+ tcb;
16188
+ scope;
16189
+ element;
16190
+ optional = true;
16191
+ constructor(tcb, scope, element) {
16192
+ super();
16193
+ this.tcb = tcb;
16194
+ this.scope = scope;
16195
+ this.element = element;
15798
16196
  }
15799
- getPipeByName(name) {
15800
- if (this.pipes === null || !this.pipes.has(name)) {
15801
- return null;
15802
- }
15803
- return this.pipes.get(name);
16197
+ execute() {
16198
+ const id = this.tcb.allocateId();
16199
+ const initializer = tsCreateElement(...this.element.tagNames);
16200
+ addParseSpanInfo(initializer, this.element.sourceSpan);
16201
+ this.scope.addStatement(tsCreateVariable(id, initializer));
16202
+ return id;
15804
16203
  }
15805
16204
  };
16205
+
16206
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/scope.js
15806
16207
  var Scope = class _Scope {
15807
16208
  tcb;
15808
16209
  parent;
@@ -15870,12 +16271,12 @@ var Scope = class _Scope {
15870
16271
  */
15871
16272
  static getForLoopContextVariableTypes() {
15872
16273
  return /* @__PURE__ */ new Map([
15873
- ["$first", ts62.SyntaxKind.BooleanKeyword],
15874
- ["$last", ts62.SyntaxKind.BooleanKeyword],
15875
- ["$even", ts62.SyntaxKind.BooleanKeyword],
15876
- ["$odd", ts62.SyntaxKind.BooleanKeyword],
15877
- ["$index", ts62.SyntaxKind.NumberKeyword],
15878
- ["$count", ts62.SyntaxKind.NumberKeyword]
16274
+ ["$first", ts81.SyntaxKind.BooleanKeyword],
16275
+ ["$last", ts81.SyntaxKind.BooleanKeyword],
16276
+ ["$even", ts81.SyntaxKind.BooleanKeyword],
16277
+ ["$odd", ts81.SyntaxKind.BooleanKeyword],
16278
+ ["$index", ts81.SyntaxKind.NumberKeyword],
16279
+ ["$count", ts81.SyntaxKind.NumberKeyword]
15879
16280
  ]);
15880
16281
  }
15881
16282
  constructor(tcb, parent = null, guard = null) {
@@ -15899,7 +16300,7 @@ var Scope = class _Scope {
15899
16300
  if (parentScope === null && tcb.env.config.enableTemplateTypeChecker) {
15900
16301
  scope.opQueue.push(new TcbComponentContextCompletionOp(scope));
15901
16302
  }
15902
- if (scopedNode instanceof TmplAstTemplate) {
16303
+ if (scopedNode instanceof TmplAstTemplate5) {
15903
16304
  const varMap = /* @__PURE__ */ new Map();
15904
16305
  for (const v of scopedNode.variables) {
15905
16306
  if (!varMap.has(v.name)) {
@@ -15915,7 +16316,7 @@ var Scope = class _Scope {
15915
16316
  if (expression !== null && expressionAlias !== null) {
15916
16317
  _Scope.registerVariable(scope, expressionAlias, new TcbBlockVariableOp(tcb, scope, tcbExpression(expression, tcb, scope), expressionAlias));
15917
16318
  }
15918
- } else if (scopedNode instanceof TmplAstForLoopBlock) {
16319
+ } else if (scopedNode instanceof TmplAstForLoopBlock2) {
15919
16320
  const loopInitializer = tcb.allocateId();
15920
16321
  addParseSpanInfo(loopInitializer, scopedNode.item.sourceSpan);
15921
16322
  scope.varMap.set(scopedNode.item, loopInitializer);
@@ -15924,10 +16325,10 @@ var Scope = class _Scope {
15924
16325
  if (!forLoopContextVariableTypes.has(variable.value)) {
15925
16326
  throw new Error(`Unrecognized for loop context variable ${variable.name}`);
15926
16327
  }
15927
- const type = ts62.factory.createKeywordTypeNode(forLoopContextVariableTypes.get(variable.value));
16328
+ const type = ts81.factory.createKeywordTypeNode(forLoopContextVariableTypes.get(variable.value));
15928
16329
  _Scope.registerVariable(scope, variable, new TcbBlockImplicitVariableOp(tcb, scope, type, variable));
15929
16330
  }
15930
- } else if (scopedNode instanceof TmplAstHostElement2) {
16331
+ } else if (scopedNode instanceof TmplAstHostElement5) {
15931
16332
  scope.appendNode(scopedNode);
15932
16333
  }
15933
16334
  if (children !== null) {
@@ -15971,16 +16372,16 @@ var Scope = class _Scope {
15971
16372
  const res = this.resolveLocal(node, directive);
15972
16373
  if (res !== null) {
15973
16374
  let clone;
15974
- if (ts62.isIdentifier(res)) {
15975
- clone = ts62.factory.createIdentifier(res.text);
15976
- } else if (ts62.isNonNullExpression(res)) {
15977
- clone = ts62.factory.createNonNullExpression(res.expression);
16375
+ if (ts81.isIdentifier(res)) {
16376
+ clone = ts81.factory.createIdentifier(res.text);
16377
+ } else if (ts81.isNonNullExpression(res)) {
16378
+ clone = ts81.factory.createNonNullExpression(res.expression);
15978
16379
  } else {
15979
16380
  throw new Error(`Could not resolve ${node} to an Identifier or a NonNullExpression`);
15980
16381
  }
15981
- ts62.setOriginalNode(clone, res);
16382
+ ts81.setOriginalNode(clone, res);
15982
16383
  clone.parent = clone.parent;
15983
- return ts62.setSyntheticTrailingComments(clone, []);
16384
+ return ts81.setSyntheticTrailingComments(clone, []);
15984
16385
  } else if (this.parent !== null) {
15985
16386
  return this.parent.resolve(node, directive);
15986
16387
  } else {
@@ -16017,37 +16418,51 @@ var Scope = class _Scope {
16017
16418
  } else if (parentGuards === null) {
16018
16419
  return this.guard;
16019
16420
  } else {
16020
- return ts62.factory.createBinaryExpression(parentGuards, ts62.SyntaxKind.AmpersandAmpersandToken, this.guard);
16421
+ return ts81.factory.createBinaryExpression(parentGuards, ts81.SyntaxKind.AmpersandAmpersandToken, this.guard);
16021
16422
  }
16022
16423
  }
16023
16424
  /** Returns whether a template symbol is defined locally within the current scope. */
16024
16425
  isLocal(node) {
16025
- if (node instanceof TmplAstVariable) {
16426
+ if (node instanceof TmplAstVariable2) {
16026
16427
  return this.varMap.has(node);
16027
16428
  }
16028
- if (node instanceof TmplAstLetDeclaration2) {
16429
+ if (node instanceof TmplAstLetDeclaration3) {
16029
16430
  return this.letDeclOpMap.has(node.name);
16030
16431
  }
16031
16432
  return this.referenceOpMap.has(node);
16032
16433
  }
16434
+ /**
16435
+ * Constructs a `Scope` given either a `TmplAstTemplate` or a list of `TmplAstNode`s.
16436
+ * This is identical to `Scope.forNodes` which we can't reference in some ops due to
16437
+ * circular dependencies.
16438
+ *.
16439
+ * @param parentScope the `Scope` of the parent template.
16440
+ * @param scopedNode Node that provides the scope around the child nodes (e.g. a
16441
+ * `TmplAstTemplate` node exposing variables to its children).
16442
+ * @param children Child nodes that should be appended to the TCB.
16443
+ * @param guard an expression that is applied to this scope for type narrowing purposes.
16444
+ */
16445
+ createChildScope(parentScope, scopedNode, children, guard) {
16446
+ return _Scope.forNodes(this.tcb, parentScope, scopedNode, children, guard);
16447
+ }
16033
16448
  resolveLocal(ref, directive) {
16034
16449
  if (ref instanceof TmplAstReference2 && this.referenceOpMap.has(ref)) {
16035
16450
  return this.resolveOp(this.referenceOpMap.get(ref));
16036
- } else if (ref instanceof TmplAstLetDeclaration2 && this.letDeclOpMap.has(ref.name)) {
16451
+ } else if (ref instanceof TmplAstLetDeclaration3 && this.letDeclOpMap.has(ref.name)) {
16037
16452
  return this.resolveOp(this.letDeclOpMap.get(ref.name).opIndex);
16038
- } else if (ref instanceof TmplAstVariable && this.varMap.has(ref)) {
16453
+ } else if (ref instanceof TmplAstVariable2 && this.varMap.has(ref)) {
16039
16454
  const opIndexOrNode = this.varMap.get(ref);
16040
16455
  return typeof opIndexOrNode === "number" ? this.resolveOp(opIndexOrNode) : opIndexOrNode;
16041
- } else if (ref instanceof TmplAstTemplate && directive === void 0 && this.templateCtxOpMap.has(ref)) {
16456
+ } else if (ref instanceof TmplAstTemplate5 && directive === void 0 && this.templateCtxOpMap.has(ref)) {
16042
16457
  return this.resolveOp(this.templateCtxOpMap.get(ref));
16043
- } else if ((ref instanceof TmplAstElement2 || ref instanceof TmplAstTemplate || ref instanceof TmplAstComponent2 || ref instanceof TmplAstDirective2 || ref instanceof TmplAstHostElement2) && directive !== void 0 && this.directiveOpMap.has(ref)) {
16458
+ } else if ((ref instanceof TmplAstElement8 || ref instanceof TmplAstTemplate5 || ref instanceof TmplAstComponent3 || ref instanceof TmplAstDirective2 || ref instanceof TmplAstHostElement5) && directive !== void 0 && this.directiveOpMap.has(ref)) {
16044
16459
  const dirMap = this.directiveOpMap.get(ref);
16045
16460
  return dirMap.has(directive) ? this.resolveOp(dirMap.get(directive)) : null;
16046
- } else if (ref instanceof TmplAstElement2 && this.elementOpMap.has(ref)) {
16461
+ } else if (ref instanceof TmplAstElement8 && this.elementOpMap.has(ref)) {
16047
16462
  return this.resolveOp(this.elementOpMap.get(ref));
16048
- } else if (ref instanceof TmplAstComponent2 && this.componentNodeOpMap.has(ref)) {
16463
+ } else if (ref instanceof TmplAstComponent3 && this.componentNodeOpMap.has(ref)) {
16049
16464
  return this.resolveOp(this.componentNodeOpMap.get(ref));
16050
- } else if (ref instanceof TmplAstHostElement2 && this.hostElementOpMap.has(ref)) {
16465
+ } else if (ref instanceof TmplAstHostElement5 && this.hostElementOpMap.has(ref)) {
16051
16466
  return this.resolveOp(this.hostElementOpMap.get(ref));
16052
16467
  } else {
16053
16468
  return null;
@@ -16088,7 +16503,7 @@ var Scope = class _Scope {
16088
16503
  return res;
16089
16504
  }
16090
16505
  appendNode(node) {
16091
- if (node instanceof TmplAstElement2) {
16506
+ if (node instanceof TmplAstElement8) {
16092
16507
  const opIndex = this.opQueue.push(new TcbElementOp(this.tcb, this, node)) - 1;
16093
16508
  this.elementOpMap.set(node, opIndex);
16094
16509
  if (this.tcb.env.config.controlFlowPreventingContentProjection !== "suppress") {
@@ -16099,7 +16514,7 @@ var Scope = class _Scope {
16099
16514
  this.appendSelectorlessDirectives(node);
16100
16515
  this.appendChildren(node);
16101
16516
  this.checkAndAppendReferencesOfNode(node);
16102
- } else if (node instanceof TmplAstTemplate) {
16517
+ } else if (node instanceof TmplAstTemplate5) {
16103
16518
  this.appendDirectivesAndInputsOfElementLikeNode(node);
16104
16519
  this.appendOutputsOfElementLikeNode(node, node.inputs, node.outputs);
16105
16520
  this.appendSelectorlessDirectives(node);
@@ -16111,15 +16526,15 @@ var Scope = class _Scope {
16111
16526
  this.appendDeepSchemaChecks(node.children);
16112
16527
  }
16113
16528
  this.checkAndAppendReferencesOfNode(node);
16114
- } else if (node instanceof TmplAstComponent2) {
16529
+ } else if (node instanceof TmplAstComponent3) {
16115
16530
  this.appendComponentNode(node);
16116
16531
  } else if (node instanceof TmplAstDeferredBlock) {
16117
16532
  this.appendDeferredBlock(node);
16118
- } else if (node instanceof TmplAstIfBlock) {
16533
+ } else if (node instanceof TmplAstIfBlock2) {
16119
16534
  this.opQueue.push(new TcbIfOp(this.tcb, this, node));
16120
- } else if (node instanceof TmplAstSwitchBlock) {
16535
+ } else if (node instanceof TmplAstSwitchBlock2) {
16121
16536
  this.opQueue.push(new TcbSwitchOp(this.tcb, this, node));
16122
- } else if (node instanceof TmplAstForLoopBlock) {
16537
+ } else if (node instanceof TmplAstForLoopBlock2) {
16123
16538
  this.opQueue.push(new TcbForOfOp(this.tcb, this, node));
16124
16539
  node.empty && this.tcb.env.config.checkControlFlowBodies && this.appendChildren(node.empty);
16125
16540
  } else if (node instanceof TmplAstBoundText) {
@@ -16128,14 +16543,14 @@ var Scope = class _Scope {
16128
16543
  this.appendIcuExpressions(node);
16129
16544
  } else if (node instanceof TmplAstContent) {
16130
16545
  this.appendChildren(node);
16131
- } else if (node instanceof TmplAstLetDeclaration2) {
16546
+ } else if (node instanceof TmplAstLetDeclaration3) {
16132
16547
  const opIndex = this.opQueue.push(new TcbLetDeclarationOp(this.tcb, this, node)) - 1;
16133
16548
  if (this.isLocal(node)) {
16134
16549
  this.tcb.oobRecorder.conflictingDeclaration(this.tcb.id, node);
16135
16550
  } else {
16136
16551
  this.letDeclOpMap.set(node.name, { opIndex, node });
16137
16552
  }
16138
- } else if (node instanceof TmplAstHostElement2) {
16553
+ } else if (node instanceof TmplAstHostElement5) {
16139
16554
  this.appendHostElement(node);
16140
16555
  }
16141
16556
  }
@@ -16151,7 +16566,7 @@ var Scope = class _Scope {
16151
16566
  if (target === null) {
16152
16567
  this.tcb.oobRecorder.missingReferenceTarget(this.tcb.id, ref);
16153
16568
  ctxIndex = this.opQueue.push(new TcbInvalidReferenceOp(this.tcb, this)) - 1;
16154
- } else if (target instanceof TmplAstTemplate || target instanceof TmplAstElement2) {
16569
+ } else if (target instanceof TmplAstTemplate5 || target instanceof TmplAstElement8) {
16155
16570
  ctxIndex = this.opQueue.push(new TcbReferenceOp(this.tcb, this, ref, node, target)) - 1;
16156
16571
  } else {
16157
16572
  ctxIndex = this.opQueue.push(new TcbReferenceOp(this.tcb, this, ref, node, target.directive)) - 1;
@@ -16163,7 +16578,7 @@ var Scope = class _Scope {
16163
16578
  const claimedInputs = /* @__PURE__ */ new Set();
16164
16579
  const directives = this.tcb.boundTarget.getDirectivesOfNode(node);
16165
16580
  if (directives === null || directives.length === 0) {
16166
- if (node instanceof TmplAstElement2) {
16581
+ if (node instanceof TmplAstElement8) {
16167
16582
  this.opQueue.push(new TcbUnclaimedInputsOp(this.tcb, this, node.inputs, node, claimedInputs), new TcbDomSchemaCheckerOp(
16168
16583
  this.tcb,
16169
16584
  node,
@@ -16174,7 +16589,7 @@ var Scope = class _Scope {
16174
16589
  }
16175
16590
  return;
16176
16591
  }
16177
- if (node instanceof TmplAstElement2) {
16592
+ if (node instanceof TmplAstElement8) {
16178
16593
  const isDeferred = this.tcb.boundTarget.isDeferred(node);
16179
16594
  if (!isDeferred && directives.some((dirMeta) => dirMeta.isExplicitlyDeferred)) {
16180
16595
  this.tcb.oobRecorder.deferredComponentUsedEagerly(this.tcb.id, node);
@@ -16185,7 +16600,7 @@ var Scope = class _Scope {
16185
16600
  this.appendDirectiveInputs(dir, node, dirMap, directives);
16186
16601
  }
16187
16602
  this.directiveOpMap.set(node, dirMap);
16188
- if (node instanceof TmplAstElement2) {
16603
+ if (node instanceof TmplAstElement8) {
16189
16604
  for (const dir of directives) {
16190
16605
  for (const propertyName of dir.inputs.propertyNames) {
16191
16606
  claimedInputs.add(propertyName);
@@ -16200,7 +16615,7 @@ var Scope = class _Scope {
16200
16615
  const claimedOutputs = /* @__PURE__ */ new Set();
16201
16616
  const directives = this.tcb.boundTarget.getDirectivesOfNode(node);
16202
16617
  if (directives === null || directives.length === 0) {
16203
- if (node instanceof TmplAstElement2) {
16618
+ if (node instanceof TmplAstElement8) {
16204
16619
  this.opQueue.push(new TcbUnclaimedOutputsOp(this.tcb, this, node, events, bindings, claimedOutputs));
16205
16620
  }
16206
16621
  return;
@@ -16208,7 +16623,7 @@ var Scope = class _Scope {
16208
16623
  for (const dir of directives) {
16209
16624
  this.opQueue.push(new TcbDirectiveOutputsOp(this.tcb, this, node, bindings, events, dir));
16210
16625
  }
16211
- if (node instanceof TmplAstElement2 || node instanceof TmplAstHostElement2) {
16626
+ if (node instanceof TmplAstElement8 || node instanceof TmplAstHostElement5) {
16212
16627
  for (const dir of directives) {
16213
16628
  for (const outputProperty of dir.outputs.propertyNames) {
16214
16629
  claimedOutputs.add(outputProperty);
@@ -16268,39 +16683,21 @@ var Scope = class _Scope {
16268
16683
  }
16269
16684
  }
16270
16685
  appendDirectiveInputs(dir, node, dirMap, allDirectiveMatches) {
16271
- const directiveOp = this.getDirectiveOp(dir, node, allDirectiveMatches);
16686
+ const customFieldType = allDirectiveMatches.some(isFieldDirective) ? getCustomFieldDirectiveType(dir) : null;
16687
+ const directiveOp = this.getDirectiveOp(dir, node, customFieldType);
16272
16688
  const dirIndex = this.opQueue.push(directiveOp) - 1;
16273
16689
  dirMap.set(dir, dirIndex);
16274
- let ignoredRequiredInputs = null;
16275
- if (allDirectiveMatches.some(isFieldDirective)) {
16276
- const customFieldType = getCustomFieldDirectiveType(dir);
16277
- if (customFieldType !== null) {
16278
- ignoredRequiredInputs = new Set(formControlInputFields);
16279
- if (customFieldType === "value") {
16280
- ignoredRequiredInputs.add("value");
16281
- } else if (customFieldType === "checkbox") {
16282
- ignoredRequiredInputs.add("checked");
16283
- }
16284
- }
16690
+ if (isFieldDirective(dir) && node instanceof TmplAstElement8 && (node.name === "input" || node.name === "select" || node.name === "textarea") && !allDirectiveMatches.some(getCustomFieldDirectiveType)) {
16691
+ this.opQueue.push(new TcbNativeFieldDirectiveTypeOp(this.tcb, this, node));
16285
16692
  }
16286
- this.opQueue.push(new TcbDirectiveInputsOp(this.tcb, this, node, dir, ignoredRequiredInputs));
16693
+ this.opQueue.push(new TcbDirectiveInputsOp(this.tcb, this, node, dir, customFieldType));
16287
16694
  }
16288
- getDirectiveOp(dir, node, allDirectiveMatches) {
16695
+ getDirectiveOp(dir, node, customFieldType) {
16289
16696
  const dirRef = dir.ref;
16290
- if (isFieldDirective(dir)) {
16291
- let customControl = null;
16292
- for (const meta of allDirectiveMatches) {
16293
- const type = getCustomFieldDirectiveType(meta);
16294
- if (type !== null) {
16295
- customControl = { type, meta };
16296
- break;
16297
- }
16298
- }
16299
- return customControl === null ? new TcbNativeFieldDirectiveTypeOp(this.tcb, this, node, dir) : new TcbCustomFieldDirectiveTypeOp(this.tcb, this, node, dir, customControl);
16300
- } else if (!dir.isGeneric) {
16697
+ if (!dir.isGeneric) {
16301
16698
  return new TcbNonGenericDirectiveTypeOp(this.tcb, this, node, dir);
16302
16699
  } else if (!requiresInlineTypeCtor(dirRef.node, this.tcb.env.reflector, this.tcb.env) || this.tcb.env.config.useInlineTypeConstructors) {
16303
- return new TcbDirectiveCtorOp(this.tcb, this, node, dir);
16700
+ return new TcbDirectiveCtorOp(this.tcb, this, node, dir, customFieldType);
16304
16701
  }
16305
16702
  return new TcbGenericDirectiveTypeWithAnyParamsOp(this.tcb, this, node, dir);
16306
16703
  }
@@ -16322,10 +16719,10 @@ var Scope = class _Scope {
16322
16719
  }
16323
16720
  appendDeepSchemaChecks(nodes) {
16324
16721
  for (const node of nodes) {
16325
- if (!(node instanceof TmplAstElement2 || node instanceof TmplAstTemplate)) {
16722
+ if (!(node instanceof TmplAstElement8 || node instanceof TmplAstTemplate5)) {
16326
16723
  continue;
16327
16724
  }
16328
- if (node instanceof TmplAstElement2) {
16725
+ if (node instanceof TmplAstElement8) {
16329
16726
  const claimedInputs = /* @__PURE__ */ new Set();
16330
16727
  let directives = this.tcb.boundTarget.getDirectivesOfNode(node);
16331
16728
  for (const dirNode of node.directives) {
@@ -16431,7 +16828,7 @@ var Scope = class _Scope {
16431
16828
  if (directives !== null && directives.length > 0) {
16432
16829
  const directiveOpMap = /* @__PURE__ */ new Map();
16433
16830
  for (const directive of directives) {
16434
- const directiveOp = this.getDirectiveOp(directive, node, directives);
16831
+ const directiveOp = this.getDirectiveOp(directive, node, null);
16435
16832
  directiveOpMap.set(directive, this.opQueue.push(directiveOp) - 1);
16436
16833
  }
16437
16834
  this.directiveOpMap.set(node, directiveOpMap);
@@ -16448,400 +16845,121 @@ var Scope = class _Scope {
16448
16845
  }
16449
16846
  let rootNode = null;
16450
16847
  for (const child of block.placeholder.children) {
16451
- if (!this.tcb.hostPreserveWhitespaces && child instanceof TmplAstText && child.value.trim().length === 0) {
16848
+ if (!this.tcb.hostPreserveWhitespaces && child instanceof TmplAstText2 && child.value.trim().length === 0) {
16452
16849
  continue;
16453
- }
16454
- if (rootNode === null) {
16455
- rootNode = child;
16456
- } else {
16457
- rootNode = null;
16458
- break;
16459
- }
16460
- }
16461
- if (rootNode === null || !(rootNode instanceof TmplAstElement2)) {
16462
- this.tcb.oobRecorder.deferImplicitTriggerInvalidPlaceholder(this.tcb.id, trigger);
16463
- }
16464
- return;
16465
- }
16466
- if (this.tcb.boundTarget.getDeferredTriggerTarget(block, trigger) === null) {
16467
- this.tcb.oobRecorder.inaccessibleDeferredTriggerElement(this.tcb.id, trigger);
16468
- }
16469
- }
16470
- /** Reports a diagnostic if there are any `@let` declarations that conflict with a node. */
16471
- static checkConflictingLet(scope, node) {
16472
- if (scope.letDeclOpMap.has(node.name)) {
16473
- scope.tcb.oobRecorder.conflictingDeclaration(scope.tcb.id, scope.letDeclOpMap.get(node.name).node);
16474
- }
16475
- }
16476
- };
16477
- function tcbThisParam(name, typeArguments) {
16478
- return ts62.factory.createParameterDeclaration(
16479
- /* modifiers */
16480
- void 0,
16481
- /* dotDotDotToken */
16482
- void 0,
16483
- /* name */
16484
- "this",
16485
- /* questionToken */
16486
- void 0,
16487
- /* type */
16488
- ts62.factory.createTypeReferenceNode(name, typeArguments),
16489
- /* initializer */
16490
- void 0
16491
- );
16492
- }
16493
- function tcbExpression(ast, tcb, scope) {
16494
- const translator = new TcbExpressionTranslator(tcb, scope);
16495
- return translator.translate(ast);
16496
- }
16497
- var TcbExpressionTranslator = class {
16498
- tcb;
16499
- scope;
16500
- constructor(tcb, scope) {
16501
- this.tcb = tcb;
16502
- this.scope = scope;
16503
- }
16504
- translate(ast) {
16505
- return astToTypescript(ast, (ast2) => this.resolve(ast2), this.tcb.env.config);
16506
- }
16507
- /**
16508
- * Resolve an `AST` expression within the given scope.
16509
- *
16510
- * Some `AST` expressions refer to top-level concepts (references, variables, the component
16511
- * context). This method assists in resolving those.
16512
- */
16513
- resolve(ast) {
16514
- if (ast instanceof PropertyRead4 && ast.receiver instanceof ImplicitReceiver3 && !(ast.receiver instanceof ThisReceiver2)) {
16515
- const target = this.tcb.boundTarget.getExpressionTarget(ast);
16516
- const targetExpression = target === null ? null : this.getTargetNodeExpression(target, ast);
16517
- if (target instanceof TmplAstLetDeclaration2 && !this.isValidLetDeclarationAccess(target, ast)) {
16518
- this.tcb.oobRecorder.letUsedBeforeDefinition(this.tcb.id, ast, target);
16519
- if (targetExpression !== null) {
16520
- return ts62.factory.createAsExpression(targetExpression, ts62.factory.createKeywordTypeNode(ts62.SyntaxKind.AnyKeyword));
16521
- }
16522
- }
16523
- return targetExpression;
16524
- } else if (ast instanceof Binary && Binary.isAssignmentOperation(ast.operation) && ast.left instanceof PropertyRead4 && ast.left.receiver instanceof ImplicitReceiver3) {
16525
- const read = ast.left;
16526
- const target = this.tcb.boundTarget.getExpressionTarget(read);
16527
- if (target === null) {
16528
- return null;
16529
- }
16530
- const targetExpression = this.getTargetNodeExpression(target, read);
16531
- const expr = this.translate(ast.right);
16532
- const result = ts62.factory.createParenthesizedExpression(ts62.factory.createBinaryExpression(targetExpression, ts62.SyntaxKind.EqualsToken, expr));
16533
- addParseSpanInfo(result, read.sourceSpan);
16534
- if (target instanceof TmplAstLetDeclaration2) {
16535
- markIgnoreDiagnostics(result);
16536
- this.tcb.oobRecorder.illegalWriteToLetDeclaration(this.tcb.id, read, target);
16537
- }
16538
- return result;
16539
- } else if (ast instanceof ImplicitReceiver3) {
16540
- return ts62.factory.createThis();
16541
- } else if (ast instanceof BindingPipe) {
16542
- const expr = this.translate(ast.exp);
16543
- const pipeMeta = this.tcb.getPipeByName(ast.name);
16544
- let pipe;
16545
- if (pipeMeta === null) {
16546
- this.tcb.oobRecorder.missingPipe(this.tcb.id, ast, this.tcb.hostIsStandalone);
16547
- pipe = getAnyExpression();
16548
- } else if (pipeMeta.isExplicitlyDeferred && this.tcb.boundTarget.getEagerlyUsedPipes().includes(ast.name)) {
16549
- this.tcb.oobRecorder.deferredPipeUsedEagerly(this.tcb.id, ast);
16550
- pipe = getAnyExpression();
16551
- } else {
16552
- pipe = this.tcb.env.pipeInst(pipeMeta.ref);
16553
- }
16554
- const args = ast.args.map((arg) => this.translate(arg));
16555
- let methodAccess = ts62.factory.createPropertyAccessExpression(pipe, "transform");
16556
- addParseSpanInfo(methodAccess, ast.nameSpan);
16557
- if (!this.tcb.env.config.checkTypeOfPipes) {
16558
- methodAccess = ts62.factory.createAsExpression(methodAccess, ts62.factory.createKeywordTypeNode(ts62.SyntaxKind.AnyKeyword));
16559
- }
16560
- const result = ts62.factory.createCallExpression(
16561
- /* expression */
16562
- methodAccess,
16563
- /* typeArguments */
16564
- void 0,
16565
- /* argumentsArray */
16566
- [expr, ...args]
16567
- );
16568
- addParseSpanInfo(result, ast.sourceSpan);
16569
- return result;
16570
- } else if ((ast instanceof Call3 || ast instanceof SafeCall2) && (ast.receiver instanceof PropertyRead4 || ast.receiver instanceof SafePropertyRead3)) {
16571
- if (ast.receiver.receiver instanceof ImplicitReceiver3 && !(ast.receiver.receiver instanceof ThisReceiver2) && ast.receiver.name === "$any" && ast.args.length === 1) {
16572
- const expr = this.translate(ast.args[0]);
16573
- const exprAsAny = ts62.factory.createAsExpression(expr, ts62.factory.createKeywordTypeNode(ts62.SyntaxKind.AnyKeyword));
16574
- const result = ts62.factory.createParenthesizedExpression(exprAsAny);
16575
- addParseSpanInfo(result, ast.sourceSpan);
16576
- return result;
16577
- }
16578
- const target = this.tcb.boundTarget.getExpressionTarget(ast);
16579
- if (target === null) {
16580
- return null;
16581
- }
16582
- const receiver = this.getTargetNodeExpression(target, ast);
16583
- const method = wrapForDiagnostics(receiver);
16584
- addParseSpanInfo(method, ast.receiver.nameSpan);
16585
- const args = ast.args.map((arg) => this.translate(arg));
16586
- const node = ts62.factory.createCallExpression(method, void 0, args);
16587
- addParseSpanInfo(node, ast.sourceSpan);
16588
- return node;
16589
- } else {
16590
- return null;
16591
- }
16592
- }
16593
- getTargetNodeExpression(targetNode, expressionNode) {
16594
- const expr = this.scope.resolve(targetNode);
16595
- addParseSpanInfo(expr, expressionNode.sourceSpan);
16596
- return expr;
16597
- }
16598
- isValidLetDeclarationAccess(target, ast) {
16599
- const targetStart = target.sourceSpan.start.offset;
16600
- const targetEnd = target.sourceSpan.end.offset;
16601
- const astStart = ast.sourceSpan.start;
16602
- return targetStart < astStart && astStart > targetEnd || !this.scope.isLocal(target);
16603
- }
16604
- };
16605
- function tcbCallTypeCtor(dir, tcb, inputs) {
16606
- const typeCtor = tcb.env.typeCtorFor(dir);
16607
- const members = inputs.map((input) => {
16608
- const propertyName = ts62.factory.createStringLiteral(input.field);
16609
- if (input.type === "binding") {
16610
- let expr = widenBinding(input.expression, tcb);
16611
- if (input.isTwoWayBinding && tcb.env.config.allowSignalsInTwoWayBindings) {
16612
- expr = unwrapWritableSignal(expr, tcb);
16850
+ }
16851
+ if (rootNode === null) {
16852
+ rootNode = child;
16853
+ } else {
16854
+ rootNode = null;
16855
+ break;
16856
+ }
16857
+ }
16858
+ if (rootNode === null || !(rootNode instanceof TmplAstElement8)) {
16859
+ this.tcb.oobRecorder.deferImplicitTriggerInvalidPlaceholder(this.tcb.id, trigger);
16613
16860
  }
16614
- const assignment = ts62.factory.createPropertyAssignment(propertyName, wrapForDiagnostics(expr));
16615
- addParseSpanInfo(assignment, input.sourceSpan);
16616
- return assignment;
16617
- } else {
16618
- return ts62.factory.createPropertyAssignment(propertyName, getAnyExpression());
16619
- }
16620
- });
16621
- return ts62.factory.createCallExpression(
16622
- /* expression */
16623
- typeCtor,
16624
- /* typeArguments */
16625
- void 0,
16626
- /* argumentsArray */
16627
- [ts62.factory.createObjectLiteralExpression(members)]
16628
- );
16629
- }
16630
- function getBoundAttributes(directive, node) {
16631
- const boundInputs = [];
16632
- const processAttribute = (attr) => {
16633
- if (attr instanceof TmplAstBoundAttribute3 && attr.type !== BindingType3.Property && attr.type !== BindingType3.TwoWay) {
16634
16861
  return;
16635
16862
  }
16636
- const inputs = directive.inputs.getByBindingPropertyName(attr.name);
16637
- if (inputs !== null) {
16638
- boundInputs.push({
16639
- attribute: attr,
16640
- inputs: inputs.map((input) => {
16641
- return {
16642
- fieldName: input.classPropertyName,
16643
- required: input.required,
16644
- transformType: input.transform?.type || null,
16645
- isSignal: input.isSignal,
16646
- isTwoWayBinding: attr instanceof TmplAstBoundAttribute3 && attr.type === BindingType3.TwoWay
16647
- };
16648
- })
16649
- });
16863
+ if (this.tcb.boundTarget.getDeferredTriggerTarget(block, trigger) === null) {
16864
+ this.tcb.oobRecorder.inaccessibleDeferredTriggerElement(this.tcb.id, trigger);
16650
16865
  }
16651
- };
16652
- if (node instanceof TmplAstTemplate) {
16653
- if (node.tagName === "ng-template") {
16654
- node.inputs.forEach(processAttribute);
16655
- node.attributes.forEach(processAttribute);
16866
+ }
16867
+ /** Reports a diagnostic if there are any `@let` declarations that conflict with a node. */
16868
+ static checkConflictingLet(scope, node) {
16869
+ if (scope.letDeclOpMap.has(node.name)) {
16870
+ scope.tcb.oobRecorder.conflictingDeclaration(scope.tcb.id, scope.letDeclOpMap.get(node.name).node);
16656
16871
  }
16657
- node.templateAttrs.forEach(processAttribute);
16658
- } else {
16659
- node.inputs.forEach(processAttribute);
16660
- node.attributes.forEach(processAttribute);
16661
16872
  }
16662
- return boundInputs;
16663
- }
16664
- function translateInput(attr, tcb, scope) {
16665
- if (attr instanceof TmplAstBoundAttribute3) {
16666
- return tcbExpression(attr.value, tcb, scope);
16667
- } else {
16668
- return ts62.factory.createStringLiteral(attr.value);
16873
+ };
16874
+
16875
+ // packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.js
16876
+ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
16877
+ const tcb = new Context2(env, domSchemaChecker, oobRecorder, meta.id, meta.boundTarget, meta.pipes, meta.schemas, meta.isStandalone, meta.preserveWhitespaces);
16878
+ const ctxRawType = env.referenceType(ref);
16879
+ if (!ts82.isTypeReferenceNode(ctxRawType)) {
16880
+ throw new Error(`Expected TypeReferenceNode when referencing the ctx param for ${ref.debugName}`);
16669
16881
  }
16670
- }
16671
- function widenBinding(expr, tcb) {
16672
- if (!tcb.env.config.checkTypeOfInputBindings) {
16673
- return tsCastToAny(expr);
16674
- } else if (!tcb.env.config.strictNullInputBindings) {
16675
- if (ts62.isObjectLiteralExpression(expr) || ts62.isArrayLiteralExpression(expr)) {
16676
- return expr;
16677
- } else {
16678
- return ts62.factory.createNonNullExpression(expr);
16882
+ let typeParameters = void 0;
16883
+ let typeArguments = void 0;
16884
+ if (ref.node.typeParameters !== void 0) {
16885
+ if (!env.config.useContextGenericType) {
16886
+ genericContextBehavior = TcbGenericContextBehavior.FallbackToAny;
16887
+ }
16888
+ switch (genericContextBehavior) {
16889
+ case TcbGenericContextBehavior.UseEmitter:
16890
+ typeParameters = new TypeParameterEmitter(ref.node.typeParameters, env.reflector).emit((typeRef) => env.referenceType(typeRef));
16891
+ typeArguments = typeParameters.map((param) => ts82.factory.createTypeReferenceNode(param.name));
16892
+ break;
16893
+ case TcbGenericContextBehavior.CopyClassNodes:
16894
+ typeParameters = [...ref.node.typeParameters];
16895
+ typeArguments = typeParameters.map((param) => ts82.factory.createTypeReferenceNode(param.name));
16896
+ break;
16897
+ case TcbGenericContextBehavior.FallbackToAny:
16898
+ typeArguments = ref.node.typeParameters.map(() => ts82.factory.createKeywordTypeNode(ts82.SyntaxKind.AnyKeyword));
16899
+ break;
16679
16900
  }
16680
- } else {
16681
- return expr;
16682
16901
  }
16683
- }
16684
- function unwrapWritableSignal(expression, tcb) {
16685
- const unwrapRef = tcb.env.referenceExternalSymbol(R3Identifiers4.unwrapWritableSignal.moduleName, R3Identifiers4.unwrapWritableSignal.name);
16686
- return ts62.factory.createCallExpression(unwrapRef, void 0, [expression]);
16687
- }
16688
- var EVENT_PARAMETER = "$event";
16689
- function tcbCreateEventHandler(event, tcb, scope, eventType, assertionExpression) {
16690
- const handler = tcbEventHandlerExpression(event.handler, tcb, scope);
16902
+ const paramList = [tcbThisParam(ctxRawType.typeName, typeArguments)];
16691
16903
  const statements = [];
16692
- if (assertionExpression !== void 0) {
16693
- statements.push(ts62.factory.createExpressionStatement(assertionExpression));
16694
- }
16695
- if (event.type === ParsedEventType2.TwoWay && tcb.env.config.checkTwoWayBoundEvents) {
16696
- const target = tcb.allocateId();
16697
- const assignment = ts62.factory.createBinaryExpression(target, ts62.SyntaxKind.EqualsToken, ts62.factory.createIdentifier(EVENT_PARAMETER));
16698
- statements.push(tsCreateVariable(target, tcb.env.config.allowSignalsInTwoWayBindings ? unwrapWritableSignal(handler, tcb) : handler), ts62.factory.createExpressionStatement(assignment));
16699
- } else {
16700
- statements.push(ts62.factory.createExpressionStatement(handler));
16701
- }
16702
- let eventParamType;
16703
- if (eventType === 0) {
16704
- eventParamType = void 0;
16705
- } else if (eventType === 1) {
16706
- eventParamType = ts62.factory.createKeywordTypeNode(ts62.SyntaxKind.AnyKeyword);
16707
- } else {
16708
- eventParamType = eventType;
16904
+ if (tcb.boundTarget.target.template !== void 0) {
16905
+ const templateScope = Scope.forNodes(
16906
+ tcb,
16907
+ null,
16908
+ null,
16909
+ tcb.boundTarget.target.template,
16910
+ /* guard */
16911
+ null
16912
+ );
16913
+ statements.push(renderBlockStatements(env, templateScope, ts82.factory.createTrue()));
16709
16914
  }
16710
- const guards = scope.guards();
16711
- let body = ts62.factory.createBlock(statements);
16712
- if (guards !== null) {
16713
- body = ts62.factory.createBlock([ts62.factory.createIfStatement(guards, body)]);
16915
+ if (tcb.boundTarget.target.host !== void 0) {
16916
+ const hostScope = Scope.forNodes(tcb, null, tcb.boundTarget.target.host.node, null, null);
16917
+ statements.push(renderBlockStatements(env, hostScope, createHostBindingsBlockGuard()));
16714
16918
  }
16715
- const eventParam = ts62.factory.createParameterDeclaration(
16919
+ const body = ts82.factory.createBlock(statements);
16920
+ const fnDecl = ts82.factory.createFunctionDeclaration(
16716
16921
  /* modifiers */
16717
16922
  void 0,
16718
- /* dotDotDotToken */
16923
+ /* asteriskToken */
16719
16924
  void 0,
16720
16925
  /* name */
16721
- EVENT_PARAMETER,
16722
- /* questionToken */
16723
- void 0,
16724
- /* type */
16725
- eventParamType
16726
- );
16727
- addExpressionIdentifier(eventParam, ExpressionIdentifier.EVENT_PARAMETER);
16728
- return ts62.factory.createArrowFunction(
16729
- /* modifiers */
16730
- void 0,
16926
+ name,
16731
16927
  /* typeParameters */
16732
- void 0,
16928
+ env.config.useContextGenericType ? typeParameters : void 0,
16733
16929
  /* parameters */
16734
- [eventParam],
16930
+ paramList,
16735
16931
  /* type */
16736
- ts62.factory.createKeywordTypeNode(ts62.SyntaxKind.AnyKeyword),
16737
- /* equalsGreaterThanToken */
16738
16932
  void 0,
16739
16933
  /* body */
16740
16934
  body
16741
16935
  );
16936
+ addTypeCheckId(fnDecl, meta.id);
16937
+ return fnDecl;
16742
16938
  }
16743
- function tcbEventHandlerExpression(ast, tcb, scope) {
16744
- const translator = new TcbEventHandlerTranslator(tcb, scope);
16745
- return translator.translate(ast);
16746
- }
16747
- function checkSplitTwoWayBinding(inputName, output, inputs, tcb) {
16748
- const input = inputs.find((input2) => input2.name === inputName);
16749
- if (input === void 0 || input.sourceSpan !== output.sourceSpan) {
16750
- return false;
16751
- }
16752
- const inputConsumer = tcb.boundTarget.getConsumerOfBinding(input);
16753
- const outputConsumer = tcb.boundTarget.getConsumerOfBinding(output);
16754
- if (outputConsumer === null || inputConsumer.ref === void 0 || outputConsumer instanceof TmplAstTemplate) {
16755
- return false;
16756
- }
16757
- if (outputConsumer instanceof TmplAstElement2) {
16758
- tcb.oobRecorder.splitTwoWayBinding(tcb.id, input, output, inputConsumer.ref.node, outputConsumer);
16759
- return true;
16760
- } else if (outputConsumer.ref !== inputConsumer.ref) {
16761
- tcb.oobRecorder.splitTwoWayBinding(tcb.id, input, output, inputConsumer.ref.node, outputConsumer.ref.node);
16762
- return true;
16763
- }
16764
- return false;
16765
- }
16766
- var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
16767
- resolve(ast) {
16768
- if (ast instanceof PropertyRead4 && ast.receiver instanceof ImplicitReceiver3 && !(ast.receiver instanceof ThisReceiver2) && ast.name === EVENT_PARAMETER) {
16769
- const event = ts62.factory.createIdentifier(EVENT_PARAMETER);
16770
- addParseSpanInfo(event, ast.nameSpan);
16771
- return event;
16772
- }
16773
- return super.resolve(ast);
16774
- }
16775
- isValidLetDeclarationAccess() {
16776
- return true;
16777
- }
16778
- };
16779
- var TcbForLoopTrackTranslator = class extends TcbExpressionTranslator {
16780
- block;
16781
- allowedVariables;
16782
- constructor(tcb, scope, block) {
16783
- super(tcb, scope);
16784
- this.block = block;
16785
- this.allowedVariables = /* @__PURE__ */ new Set([block.item]);
16786
- for (const variable of block.contextVariables) {
16787
- if (variable.value === "$index") {
16788
- this.allowedVariables.add(variable);
16789
- }
16790
- }
16791
- }
16792
- resolve(ast) {
16793
- if (ast instanceof PropertyRead4 && ast.receiver instanceof ImplicitReceiver3) {
16794
- const target = this.tcb.boundTarget.getExpressionTarget(ast);
16795
- if (target !== null && (!(target instanceof TmplAstVariable) || !this.allowedVariables.has(target))) {
16796
- this.tcb.oobRecorder.illegalForLoopTrackAccess(this.tcb.id, this.block, ast);
16797
- }
16798
- }
16799
- return super.resolve(ast);
16800
- }
16801
- };
16802
- function getComponentTagName(node) {
16803
- return node.tagName || "ng-component";
16804
- }
16805
- function isFieldDirective(meta) {
16806
- if (meta.name !== "Field") {
16807
- return false;
16808
- }
16809
- if (meta.ref.bestGuessOwningModule?.specifier === "@angular/forms/signals") {
16810
- return true;
16811
- }
16812
- return ts62.isClassDeclaration(meta.ref.node) && meta.ref.node.members.some((member) => ts62.isPropertyDeclaration(member) && ts62.isComputedPropertyName(member.name) && ts62.isIdentifier(member.name.expression) && member.name.expression.text === "\u0275CONTROL");
16813
- }
16814
- function hasModel(name, meta) {
16815
- return !!meta.inputs.getByBindingPropertyName(name)?.some((v) => v.isSignal) && meta.outputs.hasBindingPropertyName(name + "Change");
16939
+ function renderBlockStatements(env, scope, wrapperExpression) {
16940
+ const scopeStatements = scope.render();
16941
+ const innerBody = ts82.factory.createBlock([...env.getPreludeStatements(), ...scopeStatements]);
16942
+ return ts82.factory.createIfStatement(wrapperExpression, innerBody);
16816
16943
  }
16817
- var formControlInputFields = [
16818
- // Should be kept in sync with the `FormUiControl` bindings,
16819
- // defined in `packages/forms/signals/src/api/control.ts`.
16820
- "errors",
16821
- "invalid",
16822
- "disabled",
16823
- "disabledReasons",
16824
- "name",
16825
- "readonly",
16826
- "touched",
16827
- "max",
16828
- "maxLength",
16829
- "min",
16830
- "minLength",
16831
- "pattern",
16832
- "required"
16833
- ];
16834
- function getCustomFieldDirectiveType(meta) {
16835
- if (hasModel("value", meta)) {
16836
- return "value";
16837
- } else if (hasModel("checked", meta)) {
16838
- return "checkbox";
16839
- }
16840
- return null;
16944
+ function tcbThisParam(name, typeArguments) {
16945
+ return ts82.factory.createParameterDeclaration(
16946
+ /* modifiers */
16947
+ void 0,
16948
+ /* dotDotDotToken */
16949
+ void 0,
16950
+ /* name */
16951
+ "this",
16952
+ /* questionToken */
16953
+ void 0,
16954
+ /* type */
16955
+ ts82.factory.createTypeReferenceNode(name, typeArguments),
16956
+ /* initializer */
16957
+ void 0
16958
+ );
16841
16959
  }
16842
16960
 
16843
16961
  // packages/compiler-cli/src/ngtsc/typecheck/src/type_check_file.js
16844
- import ts63 from "typescript";
16962
+ import ts83 from "typescript";
16845
16963
  var TypeCheckFile = class extends Environment {
16846
16964
  fileName;
16847
16965
  nextTcbId = 1;
@@ -16853,11 +16971,11 @@ var TypeCheckFile = class extends Environment {
16853
16971
  // Type check block code affects code completion and fix suggestions.
16854
16972
  // We want to encourage single quotes for now, like we always did.
16855
16973
  shouldUseSingleQuotes: () => true
16856
- }), refEmitter, reflector, ts63.createSourceFile(compilerHost.getCanonicalFileName(fileName), "", ts63.ScriptTarget.Latest, true));
16974
+ }), refEmitter, reflector, ts83.createSourceFile(compilerHost.getCanonicalFileName(fileName), "", ts83.ScriptTarget.Latest, true));
16857
16975
  this.fileName = fileName;
16858
16976
  }
16859
16977
  addTypeCheckBlock(ref, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
16860
- const fnId = ts63.factory.createIdentifier(`_tcb${this.nextTcbId++}`);
16978
+ const fnId = ts83.factory.createIdentifier(`_tcb${this.nextTcbId++}`);
16861
16979
  const fn = generateTypeCheckBlock(this, ref, fnId, meta, domSchemaChecker, oobRecorder, genericContextBehavior);
16862
16980
  this.tcbStatements.push(fn);
16863
16981
  }
@@ -16867,22 +16985,22 @@ var TypeCheckFile = class extends Environment {
16867
16985
  if (importChanges.updatedImports.size > 0) {
16868
16986
  throw new Error("AssertionError: Expected no imports to be updated for a new type check file.");
16869
16987
  }
16870
- const printer = ts63.createPrinter({ removeComments });
16988
+ const printer = ts83.createPrinter({ removeComments });
16871
16989
  let source = "";
16872
16990
  const newImports = importChanges.newImports.get(this.contextFile.fileName);
16873
16991
  if (newImports !== void 0) {
16874
- source += newImports.map((i) => printer.printNode(ts63.EmitHint.Unspecified, i, this.contextFile)).join("\n");
16992
+ source += newImports.map((i) => printer.printNode(ts83.EmitHint.Unspecified, i, this.contextFile)).join("\n");
16875
16993
  }
16876
16994
  source += "\n";
16877
16995
  for (const stmt of this.pipeInstStatements) {
16878
- source += printer.printNode(ts63.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
16996
+ source += printer.printNode(ts83.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
16879
16997
  }
16880
16998
  for (const stmt of this.typeCtorStatements) {
16881
- source += printer.printNode(ts63.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
16999
+ source += printer.printNode(ts83.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
16882
17000
  }
16883
17001
  source += "\n";
16884
17002
  for (const stmt of this.tcbStatements) {
16885
- source += printer.printNode(ts63.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
17003
+ source += printer.printNode(ts83.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
16886
17004
  }
16887
17005
  source += "\nexport const IS_A_MODULE = true;\n";
16888
17006
  return source;
@@ -17048,7 +17166,7 @@ var TypeCheckContextImpl = class {
17048
17166
  if (!this.opMap.has(sf)) {
17049
17167
  return null;
17050
17168
  }
17051
- const printer = ts64.createPrinter({ omitTrailingSemicolon: true });
17169
+ const printer = ts84.createPrinter({ omitTrailingSemicolon: true });
17052
17170
  const importManager = new ImportManager({
17053
17171
  // This minimizes noticeable changes with older versions of `ImportManager`.
17054
17172
  forceGenerateNamespacesForNewImports: true,
@@ -17067,7 +17185,7 @@ var TypeCheckContextImpl = class {
17067
17185
  newImports.get(sf.fileName).forEach((newImport) => {
17068
17186
  updates.push({
17069
17187
  pos: 0,
17070
- text: printer.printNode(ts64.EmitHint.Unspecified, newImport, sf)
17188
+ text: printer.printNode(ts84.EmitHint.Unspecified, newImport, sf)
17071
17189
  });
17072
17190
  });
17073
17191
  }
@@ -17078,7 +17196,7 @@ var TypeCheckContextImpl = class {
17078
17196
  updates.push({
17079
17197
  pos: oldBindings.getStart(),
17080
17198
  deletePos: oldBindings.getEnd(),
17081
- text: printer.printNode(ts64.EmitHint.Unspecified, newBindings, sf)
17199
+ text: printer.printNode(ts84.EmitHint.Unspecified, newBindings, sf)
17082
17200
  });
17083
17201
  }
17084
17202
  const result = new MagicString(sf.text, { filename: sf.fileName });
@@ -17166,7 +17284,7 @@ function getTemplateDiagnostics(parseErrors, templateId, sourceMapping) {
17166
17284
  if (span.start.offset === span.end.offset) {
17167
17285
  span.end.offset++;
17168
17286
  }
17169
- return makeTemplateDiagnostic(templateId, sourceMapping, span, ts64.DiagnosticCategory.Error, ngErrorCode(ErrorCode.TEMPLATE_PARSE_ERROR), error.msg);
17287
+ return makeTemplateDiagnostic(templateId, sourceMapping, span, ts84.DiagnosticCategory.Error, ngErrorCode(ErrorCode.TEMPLATE_PARSE_ERROR), error.msg);
17170
17288
  });
17171
17289
  }
17172
17290
  var InlineTcbOp = class {
@@ -17192,9 +17310,9 @@ var InlineTcbOp = class {
17192
17310
  }
17193
17311
  execute(im, sf, refEmitter, printer) {
17194
17312
  const env = new Environment(this.config, im, refEmitter, this.reflector, sf);
17195
- const fnName = ts64.factory.createIdentifier(`_tcb_${this.ref.node.pos}`);
17313
+ const fnName = ts84.factory.createIdentifier(`_tcb_${this.ref.node.pos}`);
17196
17314
  const fn = generateTypeCheckBlock(env, this.ref, fnName, this.meta, this.domSchemaChecker, this.oobRecorder, TcbGenericContextBehavior.CopyClassNodes);
17197
- return printer.printNode(ts64.EmitHint.Unspecified, fn, sf);
17315
+ return printer.printNode(ts84.EmitHint.Unspecified, fn, sf);
17198
17316
  }
17199
17317
  };
17200
17318
  var TypeCtorOp = class {
@@ -17215,7 +17333,7 @@ var TypeCtorOp = class {
17215
17333
  execute(im, sf, refEmitter, printer) {
17216
17334
  const emitEnv = new ReferenceEmitEnvironment(im, refEmitter, this.reflector, sf);
17217
17335
  const tcb = generateInlineTypeCtor(emitEnv, this.ref.node, this.meta);
17218
- return printer.printNode(ts64.EmitHint.Unspecified, tcb, sf);
17336
+ return printer.printNode(ts84.EmitHint.Unspecified, tcb, sf);
17219
17337
  }
17220
17338
  };
17221
17339
 
@@ -17336,8 +17454,8 @@ var DirectiveSourceManager = class {
17336
17454
  };
17337
17455
 
17338
17456
  // packages/compiler-cli/src/ngtsc/typecheck/src/template_symbol_builder.js
17339
- import { AST, ASTWithName as ASTWithName2, ASTWithSource as ASTWithSource2, Binary as Binary2, BindingPipe as BindingPipe2, PropertyRead as PropertyRead5, R3Identifiers as R3Identifiers5, SafePropertyRead as SafePropertyRead4, TmplAstBoundAttribute as TmplAstBoundAttribute4, TmplAstBoundEvent as TmplAstBoundEvent3, TmplAstComponent as TmplAstComponent3, TmplAstDirective as TmplAstDirective3, TmplAstElement as TmplAstElement3, TmplAstLetDeclaration as TmplAstLetDeclaration3, TmplAstReference as TmplAstReference3, TmplAstTemplate as TmplAstTemplate2, TmplAstTextAttribute as TmplAstTextAttribute3, TmplAstVariable as TmplAstVariable2 } from "@angular/compiler";
17340
- import ts65 from "typescript";
17457
+ import { AST, ASTWithName as ASTWithName2, ASTWithSource as ASTWithSource2, Binary as Binary2, BindingPipe as BindingPipe2, PropertyRead as PropertyRead8, R3Identifiers as R3Identifiers6, SafePropertyRead as SafePropertyRead4, TmplAstBoundAttribute as TmplAstBoundAttribute5, TmplAstBoundEvent as TmplAstBoundEvent3, TmplAstComponent as TmplAstComponent4, TmplAstDirective as TmplAstDirective3, TmplAstElement as TmplAstElement9, TmplAstLetDeclaration as TmplAstLetDeclaration4, TmplAstReference as TmplAstReference3, TmplAstTemplate as TmplAstTemplate6, TmplAstTextAttribute as TmplAstTextAttribute2, TmplAstVariable as TmplAstVariable3 } from "@angular/compiler";
17458
+ import ts85 from "typescript";
17341
17459
  var SymbolBuilder = class {
17342
17460
  tcbPath;
17343
17461
  tcbIsShim;
@@ -17359,21 +17477,21 @@ var SymbolBuilder = class {
17359
17477
  return this.symbolCache.get(node);
17360
17478
  }
17361
17479
  let symbol = null;
17362
- if (node instanceof TmplAstBoundAttribute4 || node instanceof TmplAstTextAttribute3) {
17480
+ if (node instanceof TmplAstBoundAttribute5 || node instanceof TmplAstTextAttribute2) {
17363
17481
  symbol = this.getSymbolOfInputBinding(node);
17364
17482
  } else if (node instanceof TmplAstBoundEvent3) {
17365
17483
  symbol = this.getSymbolOfBoundEvent(node);
17366
- } else if (node instanceof TmplAstElement3) {
17484
+ } else if (node instanceof TmplAstElement9) {
17367
17485
  symbol = this.getSymbolOfElement(node);
17368
- } else if (node instanceof TmplAstComponent3) {
17486
+ } else if (node instanceof TmplAstComponent4) {
17369
17487
  symbol = this.getSymbolOfSelectorlessComponent(node);
17370
17488
  } else if (node instanceof TmplAstDirective3) {
17371
17489
  symbol = this.getSymbolOfSelectorlessDirective(node);
17372
- } else if (node instanceof TmplAstTemplate2) {
17490
+ } else if (node instanceof TmplAstTemplate6) {
17373
17491
  symbol = this.getSymbolOfAstTemplate(node);
17374
- } else if (node instanceof TmplAstVariable2) {
17492
+ } else if (node instanceof TmplAstVariable3) {
17375
17493
  symbol = this.getSymbolOfVariable(node);
17376
- } else if (node instanceof TmplAstLetDeclaration3) {
17494
+ } else if (node instanceof TmplAstLetDeclaration4) {
17377
17495
  symbol = this.getSymbolOfLetDeclaration(node);
17378
17496
  } else if (node instanceof TmplAstReference3) {
17379
17497
  symbol = this.getSymbolOfReference(node);
@@ -17394,7 +17512,7 @@ var SymbolBuilder = class {
17394
17512
  const elementSourceSpan = element.startSourceSpan ?? element.sourceSpan;
17395
17513
  const node = findFirstMatchingNode(this.typeCheckBlock, {
17396
17514
  withSpan: elementSourceSpan,
17397
- filter: ts65.isVariableDeclaration
17515
+ filter: ts85.isVariableDeclaration
17398
17516
  });
17399
17517
  if (node === null) {
17400
17518
  return null;
@@ -17451,7 +17569,7 @@ var SymbolBuilder = class {
17451
17569
  const seenDirectives = /* @__PURE__ */ new Set();
17452
17570
  for (const node of nodes) {
17453
17571
  const symbol = this.getSymbolOfTsNode(node.parent);
17454
- if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts65.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
17572
+ if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts85.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
17455
17573
  continue;
17456
17574
  }
17457
17575
  const declaration = symbol.tsSymbol.valueDeclaration;
@@ -17486,7 +17604,7 @@ var SymbolBuilder = class {
17486
17604
  throw new Error("Impossible state: typecheck code path in local compilation mode.");
17487
17605
  }
17488
17606
  const node = current.directive.node;
17489
- if (!ts65.isClassDeclaration(node) || seenDirectives.has(node)) {
17607
+ if (!ts85.isClassDeclaration(node) || seenDirectives.has(node)) {
17490
17608
  continue;
17491
17609
  }
17492
17610
  const symbol = this.getSymbolOfTsNode(node);
@@ -17519,8 +17637,8 @@ var SymbolBuilder = class {
17519
17637
  let directives = this.typeCheckData.boundTarget.getDirectivesOfNode(host);
17520
17638
  if (!(host instanceof TmplAstDirective3)) {
17521
17639
  const firstChild = host.children[0];
17522
- if (firstChild instanceof TmplAstElement3) {
17523
- const isMicrosyntaxTemplate = host instanceof TmplAstTemplate2 && sourceSpanEqual(firstChild.sourceSpan, host.sourceSpan);
17640
+ if (firstChild instanceof TmplAstElement9) {
17641
+ const isMicrosyntaxTemplate = host instanceof TmplAstTemplate6 && sourceSpanEqual(firstChild.sourceSpan, host.sourceSpan);
17524
17642
  if (isMicrosyntaxTemplate) {
17525
17643
  const firstChildDirectives = this.typeCheckData.boundTarget.getDirectivesOfNode(firstChild);
17526
17644
  if (firstChildDirectives !== null && directives !== null) {
@@ -17563,7 +17681,7 @@ var SymbolBuilder = class {
17563
17681
  return null;
17564
17682
  }
17565
17683
  let expectedAccess;
17566
- if (consumer instanceof TmplAstTemplate2 || consumer instanceof TmplAstElement3) {
17684
+ if (consumer instanceof TmplAstTemplate6 || consumer instanceof TmplAstElement9) {
17567
17685
  expectedAccess = "addEventListener";
17568
17686
  } else {
17569
17687
  const bindingPropertyNames = consumer.outputs.getByBindingPropertyName(eventBinding.name);
@@ -17576,10 +17694,10 @@ var SymbolBuilder = class {
17576
17694
  if (!isAccessExpression(n2)) {
17577
17695
  return false;
17578
17696
  }
17579
- if (ts65.isPropertyAccessExpression(n2)) {
17697
+ if (ts85.isPropertyAccessExpression(n2)) {
17580
17698
  return n2.name.getText() === expectedAccess;
17581
17699
  } else {
17582
- return ts65.isStringLiteral(n2.argumentExpression) && n2.argumentExpression.text === expectedAccess;
17700
+ return ts85.isStringLiteral(n2.argumentExpression) && n2.argumentExpression.text === expectedAccess;
17583
17701
  }
17584
17702
  }
17585
17703
  const outputFieldAccesses = findAllMatchingNodes(this.typeCheckBlock, {
@@ -17588,8 +17706,8 @@ var SymbolBuilder = class {
17588
17706
  });
17589
17707
  const bindings = [];
17590
17708
  for (const outputFieldAccess of outputFieldAccesses) {
17591
- if (consumer instanceof TmplAstTemplate2 || consumer instanceof TmplAstElement3) {
17592
- if (!ts65.isPropertyAccessExpression(outputFieldAccess)) {
17709
+ if (consumer instanceof TmplAstTemplate6 || consumer instanceof TmplAstElement9) {
17710
+ if (!ts85.isPropertyAccessExpression(outputFieldAccess)) {
17593
17711
  continue;
17594
17712
  }
17595
17713
  const addEventListener = outputFieldAccess.name;
@@ -17612,7 +17730,7 @@ var SymbolBuilder = class {
17612
17730
  }
17613
17731
  });
17614
17732
  } else {
17615
- if (!ts65.isElementAccessExpression(outputFieldAccess)) {
17733
+ if (!ts85.isElementAccessExpression(outputFieldAccess)) {
17616
17734
  continue;
17617
17735
  }
17618
17736
  const tsSymbol = this.getTypeChecker().getSymbolAtLocation(outputFieldAccess.argumentExpression);
@@ -17648,7 +17766,7 @@ var SymbolBuilder = class {
17648
17766
  if (consumer === null) {
17649
17767
  return null;
17650
17768
  }
17651
- if (consumer instanceof TmplAstElement3 || consumer instanceof TmplAstTemplate2) {
17769
+ if (consumer instanceof TmplAstElement9 || consumer instanceof TmplAstTemplate6) {
17652
17770
  const host = this.getSymbol(consumer);
17653
17771
  return host !== null ? { kind: SymbolKind.DomBinding, host } : null;
17654
17772
  }
@@ -17665,7 +17783,7 @@ var SymbolBuilder = class {
17665
17783
  let fieldAccessExpr;
17666
17784
  let symbolInfo = null;
17667
17785
  if (signalInputAssignment !== null) {
17668
- if (ts65.isIdentifier(signalInputAssignment.fieldExpr)) {
17786
+ if (ts85.isIdentifier(signalInputAssignment.fieldExpr)) {
17669
17787
  continue;
17670
17788
  }
17671
17789
  const fieldSymbol = this.getSymbolOfTsNode(signalInputAssignment.fieldExpr);
@@ -17705,7 +17823,7 @@ var SymbolBuilder = class {
17705
17823
  return null;
17706
17824
  }
17707
17825
  const [declaration] = tsSymbol.declarations;
17708
- if (!ts65.isVariableDeclaration(declaration) || !hasExpressionIdentifier(
17826
+ if (!ts85.isVariableDeclaration(declaration) || !hasExpressionIdentifier(
17709
17827
  // The expression identifier could be on the type (for regular directives) or the name
17710
17828
  // (for generic directives and the ctor op).
17711
17829
  declaration.getSourceFile(),
@@ -17715,7 +17833,7 @@ var SymbolBuilder = class {
17715
17833
  return null;
17716
17834
  }
17717
17835
  const symbol = this.getSymbolOfTsNode(declaration);
17718
- if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts65.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
17836
+ if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts85.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
17719
17837
  return null;
17720
17838
  }
17721
17839
  const ref = new Reference(symbol.tsSymbol.valueDeclaration);
@@ -17739,13 +17857,13 @@ var SymbolBuilder = class {
17739
17857
  getSymbolOfVariable(variable) {
17740
17858
  const node = findFirstMatchingNode(this.typeCheckBlock, {
17741
17859
  withSpan: variable.sourceSpan,
17742
- filter: ts65.isVariableDeclaration
17860
+ filter: ts85.isVariableDeclaration
17743
17861
  });
17744
17862
  if (node === null) {
17745
17863
  return null;
17746
17864
  }
17747
17865
  let nodeValueSymbol = null;
17748
- if (ts65.isForOfStatement(node.parent.parent)) {
17866
+ if (ts85.isForOfStatement(node.parent.parent)) {
17749
17867
  nodeValueSymbol = this.getSymbolOfTsNode(node);
17750
17868
  } else if (node.initializer !== void 0) {
17751
17869
  nodeValueSymbol = this.getSymbolOfTsNode(node.initializer);
@@ -17770,12 +17888,12 @@ var SymbolBuilder = class {
17770
17888
  const target = this.typeCheckData.boundTarget.getReferenceTarget(ref);
17771
17889
  let node = findFirstMatchingNode(this.typeCheckBlock, {
17772
17890
  withSpan: ref.sourceSpan,
17773
- filter: ts65.isVariableDeclaration
17891
+ filter: ts85.isVariableDeclaration
17774
17892
  });
17775
17893
  if (node === null || target === null || node.initializer === void 0) {
17776
17894
  return null;
17777
17895
  }
17778
- const originalDeclaration = ts65.isParenthesizedExpression(node.initializer) && ts65.isAsExpression(node.initializer.expression) ? this.getTypeChecker().getSymbolAtLocation(node.name) : this.getTypeChecker().getSymbolAtLocation(node.initializer);
17896
+ const originalDeclaration = ts85.isParenthesizedExpression(node.initializer) && ts85.isAsExpression(node.initializer.expression) ? this.getTypeChecker().getSymbolAtLocation(node.name) : this.getTypeChecker().getSymbolAtLocation(node.initializer);
17779
17897
  if (originalDeclaration === void 0 || originalDeclaration.valueDeclaration === void 0) {
17780
17898
  return null;
17781
17899
  }
@@ -17788,7 +17906,7 @@ var SymbolBuilder = class {
17788
17906
  isShimFile: this.tcbIsShim,
17789
17907
  positionInFile: this.getTcbPositionForNode(node)
17790
17908
  };
17791
- if (target instanceof TmplAstTemplate2 || target instanceof TmplAstElement3) {
17909
+ if (target instanceof TmplAstTemplate6 || target instanceof TmplAstElement9) {
17792
17910
  return {
17793
17911
  kind: SymbolKind.Reference,
17794
17912
  tsSymbol: symbol.tsSymbol,
@@ -17799,7 +17917,7 @@ var SymbolBuilder = class {
17799
17917
  referenceVarLocation: referenceVarTcbLocation
17800
17918
  };
17801
17919
  } else {
17802
- if (!ts65.isClassDeclaration(target.directive.ref.node)) {
17920
+ if (!ts85.isClassDeclaration(target.directive.ref.node)) {
17803
17921
  return null;
17804
17922
  }
17805
17923
  return {
@@ -17816,7 +17934,7 @@ var SymbolBuilder = class {
17816
17934
  getSymbolOfLetDeclaration(decl) {
17817
17935
  const node = findFirstMatchingNode(this.typeCheckBlock, {
17818
17936
  withSpan: decl.sourceSpan,
17819
- filter: ts65.isVariableDeclaration
17937
+ filter: ts85.isVariableDeclaration
17820
17938
  });
17821
17939
  if (node === null) {
17822
17940
  return null;
@@ -17841,7 +17959,7 @@ var SymbolBuilder = class {
17841
17959
  getSymbolOfPipe(expression) {
17842
17960
  const methodAccess = findFirstMatchingNode(this.typeCheckBlock, {
17843
17961
  withSpan: expression.nameSpan,
17844
- filter: ts65.isPropertyAccessExpression
17962
+ filter: ts85.isPropertyAccessExpression
17845
17963
  });
17846
17964
  if (methodAccess === null) {
17847
17965
  return null;
@@ -17877,16 +17995,16 @@ var SymbolBuilder = class {
17877
17995
  return this.getSymbol(expressionTarget);
17878
17996
  }
17879
17997
  let withSpan = expression.sourceSpan;
17880
- if (expression instanceof Binary2 && Binary2.isAssignmentOperation(expression.operation) && expression.left instanceof PropertyRead5) {
17998
+ if (expression instanceof Binary2 && Binary2.isAssignmentOperation(expression.operation) && expression.left instanceof PropertyRead8) {
17881
17999
  withSpan = expression.left.nameSpan;
17882
18000
  } else if (expression instanceof ASTWithName2 && !(expression instanceof SafePropertyRead4)) {
17883
18001
  withSpan = expression.nameSpan;
17884
18002
  }
17885
18003
  let node = null;
17886
- if (expression instanceof PropertyRead5) {
18004
+ if (expression instanceof PropertyRead8) {
17887
18005
  node = findFirstMatchingNode(this.typeCheckBlock, {
17888
18006
  withSpan,
17889
- filter: ts65.isPropertyAccessExpression
18007
+ filter: ts85.isPropertyAccessExpression
17890
18008
  });
17891
18009
  }
17892
18010
  if (node === null) {
@@ -17895,10 +18013,10 @@ var SymbolBuilder = class {
17895
18013
  if (node === null) {
17896
18014
  return null;
17897
18015
  }
17898
- while (ts65.isParenthesizedExpression(node)) {
18016
+ while (ts85.isParenthesizedExpression(node)) {
17899
18017
  node = node.expression;
17900
18018
  }
17901
- if (expression instanceof SafePropertyRead4 && ts65.isConditionalExpression(node)) {
18019
+ if (expression instanceof SafePropertyRead4 && ts85.isConditionalExpression(node)) {
17902
18020
  const whenTrueSymbol = this.getSymbolOfTsNode(node.whenTrue);
17903
18021
  if (whenTrueSymbol === null) {
17904
18022
  return null;
@@ -17916,13 +18034,13 @@ var SymbolBuilder = class {
17916
18034
  }
17917
18035
  }
17918
18036
  getSymbolOfTsNode(node) {
17919
- while (ts65.isParenthesizedExpression(node)) {
18037
+ while (ts85.isParenthesizedExpression(node)) {
17920
18038
  node = node.expression;
17921
18039
  }
17922
18040
  let tsSymbol;
17923
- if (ts65.isPropertyAccessExpression(node)) {
18041
+ if (ts85.isPropertyAccessExpression(node)) {
17924
18042
  tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.name);
17925
- } else if (ts65.isCallExpression(node)) {
18043
+ } else if (ts85.isCallExpression(node)) {
17926
18044
  tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.expression);
17927
18045
  } else {
17928
18046
  tsSymbol = this.getTypeChecker().getSymbolAtLocation(node);
@@ -17943,13 +18061,13 @@ var SymbolBuilder = class {
17943
18061
  };
17944
18062
  }
17945
18063
  getTcbPositionForNode(node) {
17946
- if (ts65.isTypeReferenceNode(node)) {
18064
+ if (ts85.isTypeReferenceNode(node)) {
17947
18065
  return this.getTcbPositionForNode(node.typeName);
17948
- } else if (ts65.isQualifiedName(node)) {
18066
+ } else if (ts85.isQualifiedName(node)) {
17949
18067
  return node.right.getStart();
17950
- } else if (ts65.isPropertyAccessExpression(node)) {
18068
+ } else if (ts85.isPropertyAccessExpression(node)) {
17951
18069
  return node.name.getStart();
17952
- } else if (ts65.isElementAccessExpression(node)) {
18070
+ } else if (ts85.isElementAccessExpression(node)) {
17953
18071
  return node.argumentExpression.getStart();
17954
18072
  } else {
17955
18073
  return node.getStart();
@@ -17963,13 +18081,13 @@ function sourceSpanEqual(a, b) {
17963
18081
  return a.start.offset === b.start.offset && a.end.offset === b.end.offset;
17964
18082
  }
17965
18083
  function unwrapSignalInputWriteTAccessor(expr) {
17966
- if (!ts65.isElementAccessExpression(expr) || !ts65.isPropertyAccessExpression(expr.argumentExpression)) {
18084
+ if (!ts85.isElementAccessExpression(expr) || !ts85.isPropertyAccessExpression(expr.argumentExpression)) {
17967
18085
  return null;
17968
18086
  }
17969
- if (!ts65.isIdentifier(expr.argumentExpression.name) || expr.argumentExpression.name.text !== R3Identifiers5.InputSignalBrandWriteType.name) {
18087
+ if (!ts85.isIdentifier(expr.argumentExpression.name) || expr.argumentExpression.name.text !== R3Identifiers6.InputSignalBrandWriteType.name) {
17970
18088
  return null;
17971
18089
  }
17972
- if (!ts65.isPropertyAccessExpression(expr.expression) && !ts65.isElementAccessExpression(expr.expression) && !ts65.isIdentifier(expr.expression)) {
18090
+ if (!ts85.isPropertyAccessExpression(expr.expression) && !ts85.isElementAccessExpression(expr.expression) && !ts85.isIdentifier(expr.expression)) {
17973
18091
  throw new Error("Unexpected expression for signal input write type.");
17974
18092
  }
17975
18093
  return {
@@ -17986,10 +18104,10 @@ function findMatchingDirective(originalSourceFile, directiveDeclarationInTypeChe
17986
18104
  function collectClassesWithName(sourceFile, className) {
17987
18105
  const classes = [];
17988
18106
  function visit2(node) {
17989
- if (ts65.isClassDeclaration(node) && node.name?.text === className) {
18107
+ if (ts85.isClassDeclaration(node) && node.name?.text === className) {
17990
18108
  classes.push(node);
17991
18109
  }
17992
- ts65.forEachChild(node, visit2);
18110
+ ts85.forEachChild(node, visit2);
17993
18111
  }
17994
18112
  sourceFile.forEachChild(visit2);
17995
18113
  return classes;
@@ -19018,11 +19136,11 @@ function getClassDeclFromSymbol(symbol, checker) {
19018
19136
  if (decl === void 0) {
19019
19137
  return null;
19020
19138
  }
19021
- if (ts66.isExportAssignment(decl)) {
19139
+ if (ts86.isExportAssignment(decl)) {
19022
19140
  const symbol2 = checker.getTypeAtLocation(decl.expression).getSymbol();
19023
19141
  return getClassDeclFromSymbol(symbol2, checker);
19024
19142
  }
19025
- if (ts66.isExportSpecifier(decl)) {
19143
+ if (ts86.isExportSpecifier(decl)) {
19026
19144
  const symbol2 = checker.getTypeAtLocation(decl).getSymbol();
19027
19145
  return getClassDeclFromSymbol(symbol2, checker);
19028
19146
  }
@@ -19055,7 +19173,7 @@ function getTheElementTagDeprecatedSuggestionDiagnostics(shimPath, program, file
19055
19173
  const nodeType = typeChecker.getTypeAtLocation(diagNode);
19056
19174
  const nodeSymbolDeclarations = nodeType.getSymbol()?.declarations;
19057
19175
  const decl = nodeSymbolDeclarations !== void 0 && nodeSymbolDeclarations.length > 0 ? nodeSymbolDeclarations[0] : void 0;
19058
- if (decl === void 0 || !ts66.isClassDeclaration(decl)) {
19176
+ if (decl === void 0 || !ts86.isClassDeclaration(decl)) {
19059
19177
  continue;
19060
19178
  }
19061
19179
  const directiveForDiagnostic = templateTypeChecker.getDirectiveMetadata(decl);
@@ -19075,7 +19193,7 @@ function getTheElementTagDeprecatedSuggestionDiagnostics(shimPath, program, file
19075
19193
  if (decl === void 0) {
19076
19194
  continue;
19077
19195
  }
19078
- if (!ts66.isClassDeclaration(decl)) {
19196
+ if (!ts86.isClassDeclaration(decl)) {
19079
19197
  continue;
19080
19198
  }
19081
19199
  const diagnostic = nodeToDiag.get(decl);
@@ -19354,7 +19472,7 @@ var DirectiveDecoratorHandler = class {
19354
19472
  if (!this.typeCheckHostBindings) {
19355
19473
  return;
19356
19474
  }
19357
- if (!ts67.isClassDeclaration(node) || meta.isPoisoned && !this.usePoisonedData) {
19475
+ if (!ts87.isClassDeclaration(node) || meta.isPoisoned && !this.usePoisonedData) {
19358
19476
  return;
19359
19477
  }
19360
19478
  const ref = new Reference(node);
@@ -19463,17 +19581,17 @@ var DirectiveDecoratorHandler = class {
19463
19581
  };
19464
19582
 
19465
19583
  // packages/compiler-cli/src/ngtsc/annotations/ng_module/src/handler.js
19466
- import { compileClassMetadata as compileClassMetadata2, compileDeclareClassMetadata as compileDeclareClassMetadata2, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileInjector, compileNgModule, ExternalExpr as ExternalExpr9, FactoryTarget as FactoryTarget2, FunctionExpr, InvokeFunctionExpr, LiteralArrayExpr as LiteralArrayExpr3, R3Identifiers as R3Identifiers6, R3NgModuleMetadataKind, R3SelectorScopeMode, ReturnStatement, WrappedNodeExpr as WrappedNodeExpr10 } from "@angular/compiler";
19467
- import ts69 from "typescript";
19584
+ import { compileClassMetadata as compileClassMetadata2, compileDeclareClassMetadata as compileDeclareClassMetadata2, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileInjector, compileNgModule, ExternalExpr as ExternalExpr9, FactoryTarget as FactoryTarget2, FunctionExpr, InvokeFunctionExpr, LiteralArrayExpr as LiteralArrayExpr3, R3Identifiers as R3Identifiers7, R3NgModuleMetadataKind, R3SelectorScopeMode, ReturnStatement, WrappedNodeExpr as WrappedNodeExpr10 } from "@angular/compiler";
19585
+ import ts89 from "typescript";
19468
19586
 
19469
19587
  // packages/compiler-cli/src/ngtsc/annotations/ng_module/src/module_with_providers.js
19470
- import ts68 from "typescript";
19588
+ import ts88 from "typescript";
19471
19589
  function createModuleWithProvidersResolver(reflector, isCore) {
19472
19590
  function _reflectModuleFromTypeParam(type, node) {
19473
- if (!ts68.isTypeReferenceNode(type)) {
19591
+ if (!ts88.isTypeReferenceNode(type)) {
19474
19592
  return null;
19475
19593
  }
19476
- const typeName = type && (ts68.isIdentifier(type.typeName) && type.typeName || ts68.isQualifiedName(type.typeName) && type.typeName.right) || null;
19594
+ const typeName = type && (ts88.isIdentifier(type.typeName) && type.typeName || ts88.isQualifiedName(type.typeName) && type.typeName.right) || null;
19477
19595
  if (typeName === null) {
19478
19596
  return null;
19479
19597
  }
@@ -19485,7 +19603,7 @@ function createModuleWithProvidersResolver(reflector, isCore) {
19485
19603
  return null;
19486
19604
  }
19487
19605
  if (type.typeArguments === void 0 || type.typeArguments.length !== 1) {
19488
- const parent = ts68.isMethodDeclaration(node) && ts68.isClassDeclaration(node.parent) ? node.parent : null;
19606
+ const parent = ts88.isMethodDeclaration(node) && ts88.isClassDeclaration(node.parent) ? node.parent : null;
19489
19607
  const symbolName = (parent && parent.name ? parent.name.getText() + "." : "") + (node.name ? node.name.getText() : "anonymous");
19490
19608
  throw new FatalDiagnosticError(ErrorCode.NGMODULE_MODULE_WITH_PROVIDERS_MISSING_GENERIC, type, `${symbolName} returns a ModuleWithProviders type without a generic type argument. Please add a generic type argument to the ModuleWithProviders type. If this occurrence is in library code you don't control, please contact the library authors.`);
19491
19609
  }
@@ -19493,15 +19611,15 @@ function createModuleWithProvidersResolver(reflector, isCore) {
19493
19611
  return typeNodeToValueExpr(arg);
19494
19612
  }
19495
19613
  function _reflectModuleFromLiteralType(type) {
19496
- if (!ts68.isIntersectionTypeNode(type)) {
19614
+ if (!ts88.isIntersectionTypeNode(type)) {
19497
19615
  return null;
19498
19616
  }
19499
19617
  for (const t of type.types) {
19500
- if (ts68.isTypeLiteralNode(t)) {
19618
+ if (ts88.isTypeLiteralNode(t)) {
19501
19619
  for (const m of t.members) {
19502
- const ngModuleType = ts68.isPropertySignature(m) && ts68.isIdentifier(m.name) && m.name.text === "ngModule" && m.type || null;
19620
+ const ngModuleType = ts88.isPropertySignature(m) && ts88.isIdentifier(m.name) && m.name.text === "ngModule" && m.type || null;
19503
19621
  let ngModuleExpression = null;
19504
- if (ngModuleType !== null && ts68.isTypeQueryNode(ngModuleType)) {
19622
+ if (ngModuleType !== null && ts88.isTypeQueryNode(ngModuleType)) {
19505
19623
  ngModuleExpression = entityNameToValue(ngModuleType.exprName);
19506
19624
  } else if (ngModuleType !== null) {
19507
19625
  ngModuleExpression = typeNodeToValueExpr(ngModuleType);
@@ -19679,8 +19797,8 @@ var NgModuleDecoratorHandler = class {
19679
19797
  if (decorator.args === null || decorator.args.length > 1) {
19680
19798
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, `Incorrect number of arguments to @NgModule decorator`);
19681
19799
  }
19682
- const meta = decorator.args.length === 1 ? unwrapExpression(decorator.args[0]) : ts69.factory.createObjectLiteralExpression([]);
19683
- if (!ts69.isObjectLiteralExpression(meta)) {
19800
+ const meta = decorator.args.length === 1 ? unwrapExpression(decorator.args[0]) : ts89.factory.createObjectLiteralExpression([]);
19801
+ if (!ts89.isObjectLiteralExpression(meta)) {
19684
19802
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, "@NgModule argument must be an object literal");
19685
19803
  }
19686
19804
  const ngModule = reflectObjectLiteral(meta);
@@ -19767,7 +19885,7 @@ var NgModuleDecoratorHandler = class {
19767
19885
  id = new WrappedNodeExpr10(idExpr);
19768
19886
  } else {
19769
19887
  const diag = makeDiagnostic(ErrorCode.WARN_NGMODULE_ID_UNNECESSARY, idExpr, `Using 'module.id' for NgModule.id is a common anti-pattern that is ignored by the Angular compiler.`);
19770
- diag.category = ts69.DiagnosticCategory.Warning;
19888
+ diag.category = ts89.DiagnosticCategory.Warning;
19771
19889
  diagnostics.push(diag);
19772
19890
  }
19773
19891
  }
@@ -19827,16 +19945,16 @@ var NgModuleDecoratorHandler = class {
19827
19945
  }
19828
19946
  const rawProviders = ngModule.has("providers") ? ngModule.get("providers") : null;
19829
19947
  let wrappedProviders = null;
19830
- if (rawProviders !== null && (!ts69.isArrayLiteralExpression(rawProviders) || rawProviders.elements.length > 0)) {
19948
+ if (rawProviders !== null && (!ts89.isArrayLiteralExpression(rawProviders) || rawProviders.elements.length > 0)) {
19831
19949
  wrappedProviders = new WrappedNodeExpr10(this.annotateForClosureCompiler ? wrapFunctionExpressionsInParens(rawProviders) : rawProviders);
19832
19950
  }
19833
19951
  const topLevelImports = [];
19834
19952
  if (!allowUnresolvedReferences && ngModule.has("imports")) {
19835
19953
  const rawImports2 = unwrapExpression(ngModule.get("imports"));
19836
19954
  let topLevelExpressions = [];
19837
- if (ts69.isArrayLiteralExpression(rawImports2)) {
19955
+ if (ts89.isArrayLiteralExpression(rawImports2)) {
19838
19956
  for (const element of rawImports2.elements) {
19839
- if (ts69.isSpreadElement(element)) {
19957
+ if (ts89.isSpreadElement(element)) {
19840
19958
  topLevelExpressions.push(element.expression);
19841
19959
  continue;
19842
19960
  }
@@ -19876,7 +19994,7 @@ var NgModuleDecoratorHandler = class {
19876
19994
  if (exp === null) {
19877
19995
  continue;
19878
19996
  }
19879
- if (ts69.isArrayLiteralExpression(exp)) {
19997
+ if (ts89.isArrayLiteralExpression(exp)) {
19880
19998
  if (exp.elements) {
19881
19999
  injectorMetadata.imports.push(...exp.elements.map((n2) => new WrappedNodeExpr10(n2)));
19882
20000
  }
@@ -20106,7 +20224,7 @@ var NgModuleDecoratorHandler = class {
20106
20224
  const componentType = this.refEmitter.emit(decl, context);
20107
20225
  assertSuccessfulReferenceEmit(componentType, node, "component");
20108
20226
  const declExpr = componentType.expression;
20109
- const setComponentScope = new ExternalExpr9(R3Identifiers6.setComponentScope);
20227
+ const setComponentScope = new ExternalExpr9(R3Identifiers7.setComponentScope);
20110
20228
  const callExpr = new InvokeFunctionExpr(setComponentScope, [
20111
20229
  declExpr,
20112
20230
  directiveExpr,
@@ -20207,7 +20325,7 @@ function isNgModule(node, compilation) {
20207
20325
  return !compilation.dependencies.some((dep) => dep.ref.node === node);
20208
20326
  }
20209
20327
  function isModuleIdExpression(expr) {
20210
- return ts69.isPropertyAccessExpression(expr) && ts69.isIdentifier(expr.expression) && expr.expression.text === "module" && expr.name.text === "id";
20328
+ return ts89.isPropertyAccessExpression(expr) && ts89.isIdentifier(expr.expression) && expr.expression.text === "module" && expr.name.text === "id";
20211
20329
  }
20212
20330
  function makeStandaloneBootstrapDiagnostic(ngModuleClass, bootstrappedClassRef, rawBootstrapExpr) {
20213
20331
  const componentClassName = bootstrappedClassRef.node.name.text;
@@ -20280,7 +20398,7 @@ var ComponentSymbol = class _ComponentSymbol extends DirectiveSymbol {
20280
20398
  };
20281
20399
 
20282
20400
  // packages/compiler-cli/src/ngtsc/annotations/component/src/util.js
20283
- import ts70 from "typescript";
20401
+ import ts90 from "typescript";
20284
20402
  function collectLegacyAnimationNames(value, legacyAnimationTriggerNames) {
20285
20403
  if (value instanceof Map) {
20286
20404
  const name = value.get("name");
@@ -20348,7 +20466,7 @@ function validateAndFlattenComponentImports(imports, expr, isDeferred) {
20348
20466
  if (ref instanceof DynamicValue) {
20349
20467
  diagnosticNode = ref.node;
20350
20468
  diagnosticValue = ref;
20351
- } else if (ts70.isArrayLiteralExpression(expr) && expr.elements.length === imports.length && !expr.elements.some(ts70.isSpreadAssignment) && !imports.some(Array.isArray)) {
20469
+ } else if (ts90.isArrayLiteralExpression(expr) && expr.elements.length === imports.length && !expr.elements.some(ts90.isSpreadAssignment) && !imports.some(Array.isArray)) {
20352
20470
  diagnosticNode = expr.elements[i];
20353
20471
  diagnosticValue = ref;
20354
20472
  } else {
@@ -20375,11 +20493,11 @@ import { outputAst as o4 } from "@angular/compiler";
20375
20493
 
20376
20494
  // packages/compiler-cli/src/ngtsc/hmr/src/extract_dependencies.js
20377
20495
  import { outputAst as o3 } from "@angular/compiler";
20378
- import ts71 from "typescript";
20496
+ import ts91 from "typescript";
20379
20497
  function extractHmrDependencies(node, definition, factory, deferBlockMetadata, classMetadata, debugInfo, reflection, evaluator) {
20380
- const name = ts71.isClassDeclaration(node) && node.name ? node.name.text : null;
20498
+ const name = ts91.isClassDeclaration(node) && node.name ? node.name.text : null;
20381
20499
  const visitor = new PotentialTopLevelReadsVisitor();
20382
- const sourceFile = ts71.getOriginalNode(node).getSourceFile();
20500
+ const sourceFile = ts91.getOriginalNode(node).getSourceFile();
20383
20501
  definition.expression.visitExpression(visitor, null);
20384
20502
  definition.statements.forEach((statement) => statement.visitStatement(visitor, null));
20385
20503
  factory.initializer?.visitExpression(visitor, null);
@@ -20440,19 +20558,19 @@ function getRuntimeRepresentation(node, reflection, evaluator) {
20440
20558
  function getTopLevelDeclarationNames(sourceFile) {
20441
20559
  const results = /* @__PURE__ */ new Set();
20442
20560
  for (const node of sourceFile.statements) {
20443
- if (ts71.isClassDeclaration(node) || ts71.isFunctionDeclaration(node) || ts71.isEnumDeclaration(node)) {
20561
+ if (ts91.isClassDeclaration(node) || ts91.isFunctionDeclaration(node) || ts91.isEnumDeclaration(node)) {
20444
20562
  if (node.name) {
20445
20563
  results.add(node.name.text);
20446
20564
  }
20447
20565
  continue;
20448
20566
  }
20449
- if (ts71.isVariableStatement(node)) {
20567
+ if (ts91.isVariableStatement(node)) {
20450
20568
  for (const decl of node.declarationList.declarations) {
20451
20569
  trackBindingName(decl.name, results);
20452
20570
  }
20453
20571
  continue;
20454
20572
  }
20455
- if (ts71.isImportDeclaration(node) && node.importClause) {
20573
+ if (ts91.isImportDeclaration(node) && node.importClause) {
20456
20574
  const importClause = node.importClause;
20457
20575
  if (importClause.isTypeOnly) {
20458
20576
  continue;
@@ -20462,7 +20580,7 @@ function getTopLevelDeclarationNames(sourceFile) {
20462
20580
  }
20463
20581
  if (importClause.namedBindings) {
20464
20582
  const namedBindings = importClause.namedBindings;
20465
- if (ts71.isNamespaceImport(namedBindings)) {
20583
+ if (ts91.isNamespaceImport(namedBindings)) {
20466
20584
  results.add(namedBindings.name.text);
20467
20585
  } else {
20468
20586
  namedBindings.elements.forEach((el) => {
@@ -20478,11 +20596,11 @@ function getTopLevelDeclarationNames(sourceFile) {
20478
20596
  return results;
20479
20597
  }
20480
20598
  function trackBindingName(node, results) {
20481
- if (ts71.isIdentifier(node)) {
20599
+ if (ts91.isIdentifier(node)) {
20482
20600
  results.add(node.text);
20483
20601
  } else {
20484
20602
  for (const el of node.elements) {
20485
- if (!ts71.isOmittedExpression(el)) {
20603
+ if (!ts91.isOmittedExpression(el)) {
20486
20604
  trackBindingName(el.name, results);
20487
20605
  }
20488
20606
  }
@@ -20512,10 +20630,10 @@ var PotentialTopLevelReadsVisitor = class extends o3.RecursiveAstVisitor {
20512
20630
  * @param node Node from which to start the traversal.
20513
20631
  */
20514
20632
  addAllTopLevelIdentifiers = (node) => {
20515
- if (ts71.isIdentifier(node) && this.isTopLevelIdentifierReference(node)) {
20633
+ if (ts91.isIdentifier(node) && this.isTopLevelIdentifierReference(node)) {
20516
20634
  this.allReads.add(node);
20517
20635
  } else {
20518
- ts71.forEachChild(node, this.addAllTopLevelIdentifiers);
20636
+ ts91.forEachChild(node, this.addAllTopLevelIdentifiers);
20519
20637
  }
20520
20638
  };
20521
20639
  /**
@@ -20530,52 +20648,52 @@ var PotentialTopLevelReadsVisitor = class extends o3.RecursiveAstVisitor {
20530
20648
  if (!parent) {
20531
20649
  return false;
20532
20650
  }
20533
- if (ts71.isParenthesizedExpression(parent) && parent.expression === node) {
20534
- while (parent && ts71.isParenthesizedExpression(parent)) {
20651
+ if (ts91.isParenthesizedExpression(parent) && parent.expression === node) {
20652
+ while (parent && ts91.isParenthesizedExpression(parent)) {
20535
20653
  node = parent;
20536
20654
  parent = parent.parent;
20537
20655
  }
20538
20656
  }
20539
- if (ts71.isSourceFile(parent)) {
20657
+ if (ts91.isSourceFile(parent)) {
20540
20658
  return true;
20541
20659
  }
20542
- if (ts71.isCallExpression(parent)) {
20660
+ if (ts91.isCallExpression(parent)) {
20543
20661
  return parent.expression === node || parent.arguments.includes(node);
20544
20662
  }
20545
- if (ts71.isExpressionStatement(parent) || ts71.isPropertyAccessExpression(parent) || ts71.isComputedPropertyName(parent) || ts71.isTemplateSpan(parent) || ts71.isSpreadAssignment(parent) || ts71.isSpreadElement(parent) || ts71.isAwaitExpression(parent) || ts71.isNonNullExpression(parent) || ts71.isIfStatement(parent) || ts71.isDoStatement(parent) || ts71.isWhileStatement(parent) || ts71.isSwitchStatement(parent) || ts71.isCaseClause(parent) || ts71.isThrowStatement(parent) || ts71.isNewExpression(parent) || ts71.isExpressionWithTypeArguments(parent)) {
20663
+ if (ts91.isExpressionStatement(parent) || ts91.isPropertyAccessExpression(parent) || ts91.isComputedPropertyName(parent) || ts91.isTemplateSpan(parent) || ts91.isSpreadAssignment(parent) || ts91.isSpreadElement(parent) || ts91.isAwaitExpression(parent) || ts91.isNonNullExpression(parent) || ts91.isIfStatement(parent) || ts91.isDoStatement(parent) || ts91.isWhileStatement(parent) || ts91.isSwitchStatement(parent) || ts91.isCaseClause(parent) || ts91.isThrowStatement(parent) || ts91.isNewExpression(parent) || ts91.isExpressionWithTypeArguments(parent)) {
20546
20664
  return parent.expression === node;
20547
20665
  }
20548
- if (ts71.isArrayLiteralExpression(parent)) {
20666
+ if (ts91.isArrayLiteralExpression(parent)) {
20549
20667
  return parent.elements.includes(node);
20550
20668
  }
20551
- if (ts71.isPropertyAssignment(parent) || ts71.isParameter(parent) || ts71.isBindingElement(parent) || ts71.isPropertyDeclaration(parent) || ts71.isEnumMember(parent)) {
20669
+ if (ts91.isPropertyAssignment(parent) || ts91.isParameter(parent) || ts91.isBindingElement(parent) || ts91.isPropertyDeclaration(parent) || ts91.isEnumMember(parent)) {
20552
20670
  return parent.initializer === node;
20553
20671
  }
20554
- if (ts71.isVariableDeclaration(parent)) {
20672
+ if (ts91.isVariableDeclaration(parent)) {
20555
20673
  return parent.name === node || parent.initializer === node;
20556
20674
  }
20557
- if (ts71.isClassDeclaration(parent) || ts71.isFunctionDeclaration(parent) || ts71.isShorthandPropertyAssignment(parent)) {
20675
+ if (ts91.isClassDeclaration(parent) || ts91.isFunctionDeclaration(parent) || ts91.isShorthandPropertyAssignment(parent)) {
20558
20676
  return parent.name === node;
20559
20677
  }
20560
- if (ts71.isElementAccessExpression(parent)) {
20678
+ if (ts91.isElementAccessExpression(parent)) {
20561
20679
  return parent.expression === node || parent.argumentExpression === node;
20562
20680
  }
20563
- if (ts71.isBinaryExpression(parent)) {
20681
+ if (ts91.isBinaryExpression(parent)) {
20564
20682
  return parent.left === node || parent.right === node;
20565
20683
  }
20566
- if (ts71.isForInStatement(parent) || ts71.isForOfStatement(parent)) {
20684
+ if (ts91.isForInStatement(parent) || ts91.isForOfStatement(parent)) {
20567
20685
  return parent.expression === node || parent.initializer === node;
20568
20686
  }
20569
- if (ts71.isForStatement(parent)) {
20687
+ if (ts91.isForStatement(parent)) {
20570
20688
  return parent.condition === node || parent.initializer === node || parent.incrementor === node;
20571
20689
  }
20572
- if (ts71.isArrowFunction(parent)) {
20690
+ if (ts91.isArrowFunction(parent)) {
20573
20691
  return parent.body === node;
20574
20692
  }
20575
- if (ts71.isImportSpecifier(parent) || ts71.isExportSpecifier(parent)) {
20693
+ if (ts91.isImportSpecifier(parent) || ts91.isExportSpecifier(parent)) {
20576
20694
  return (parent.propertyName || parent.name) === node;
20577
20695
  }
20578
- if (ts71.isConditionalExpression(parent)) {
20696
+ if (ts91.isConditionalExpression(parent)) {
20579
20697
  return parent.condition === node || parent.whenFalse === node || parent.whenTrue === node;
20580
20698
  }
20581
20699
  return false;
@@ -20587,20 +20705,20 @@ var PotentialTopLevelReadsVisitor = class extends o3.RecursiveAstVisitor {
20587
20705
  };
20588
20706
  function isConstEnumReference(node, reflection) {
20589
20707
  const parent = node.parent;
20590
- if (!parent || !ts71.isPropertyAccessExpression(parent) || parent.expression !== node || !ts71.isIdentifier(parent.name)) {
20708
+ if (!parent || !ts91.isPropertyAccessExpression(parent) || parent.expression !== node || !ts91.isIdentifier(parent.name)) {
20591
20709
  return false;
20592
20710
  }
20593
20711
  const declaration = reflection.getDeclarationOfIdentifier(node);
20594
- return declaration !== null && ts71.isEnumDeclaration(declaration.node) && !!declaration.node.modifiers?.some((m) => m.kind === ts71.SyntaxKind.ConstKeyword);
20712
+ return declaration !== null && ts91.isEnumDeclaration(declaration.node) && !!declaration.node.modifiers?.some((m) => m.kind === ts91.SyntaxKind.ConstKeyword);
20595
20713
  }
20596
20714
 
20597
20715
  // packages/compiler-cli/src/ngtsc/hmr/src/metadata.js
20598
- import ts72 from "typescript";
20716
+ import ts92 from "typescript";
20599
20717
  function extractHmrMetatadata(clazz, reflection, evaluator, compilerHost, rootDirs, definition, factory, deferBlockMetadata, classMetadata, debugInfo) {
20600
20718
  if (!reflection.isClass(clazz)) {
20601
20719
  return null;
20602
20720
  }
20603
- const sourceFile = ts72.getOriginalNode(clazz).getSourceFile();
20721
+ const sourceFile = ts92.getOriginalNode(clazz).getSourceFile();
20604
20722
  const filePath = getProjectRelativePath(sourceFile.fileName, rootDirs, compilerHost) || compilerHost.getCanonicalFileName(sourceFile.fileName);
20605
20723
  const dependencies = extractHmrDependencies(clazz, definition, factory, deferBlockMetadata, classMetadata, debugInfo, reflection, evaluator);
20606
20724
  if (dependencies === null) {
@@ -20618,7 +20736,7 @@ function extractHmrMetatadata(clazz, reflection, evaluator, compilerHost, rootDi
20618
20736
 
20619
20737
  // packages/compiler-cli/src/ngtsc/hmr/src/update_declaration.js
20620
20738
  import { compileHmrUpdateCallback } from "@angular/compiler";
20621
- import ts73 from "typescript";
20739
+ import ts93 from "typescript";
20622
20740
  function getHmrUpdateDeclaration(compilationResults, constantStatements, meta, declaration) {
20623
20741
  const namespaceSpecifiers = meta.namespaceDependencies.reduce((result, current) => {
20624
20742
  result.set(current.moduleName, current.assignedName);
@@ -20630,11 +20748,11 @@ function getHmrUpdateDeclaration(compilationResults, constantStatements, meta, d
20630
20748
  rewriter: importRewriter
20631
20749
  });
20632
20750
  const callback = compileHmrUpdateCallback(compilationResults, constantStatements, meta);
20633
- const sourceFile = ts73.getOriginalNode(declaration).getSourceFile();
20751
+ const sourceFile = ts93.getOriginalNode(declaration).getSourceFile();
20634
20752
  const node = translateStatement(sourceFile, callback, importManager);
20635
- return ts73.factory.updateFunctionDeclaration(node, [
20636
- ts73.factory.createToken(ts73.SyntaxKind.ExportKeyword),
20637
- ts73.factory.createToken(ts73.SyntaxKind.DefaultKeyword)
20753
+ return ts93.factory.updateFunctionDeclaration(node, [
20754
+ ts93.factory.createToken(ts93.SyntaxKind.ExportKeyword),
20755
+ ts93.factory.createToken(ts93.SyntaxKind.DefaultKeyword)
20638
20756
  ], node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body);
20639
20757
  }
20640
20758
  var HmrModuleImportRewriter = class {
@@ -21081,7 +21199,7 @@ var ComponentDecoratorHandler = class {
21081
21199
  path: absoluteFrom(template.declaration.resolvedTemplateUrl),
21082
21200
  node: template.sourceMapping.node
21083
21201
  };
21084
- const relativeTemplatePath = getProjectRelativePath(templateResource.path ?? ts74.getOriginalNode(node).getSourceFile().fileName, this.rootDirs, this.compilerHost);
21202
+ const relativeTemplatePath = getProjectRelativePath(templateResource.path ?? ts94.getOriginalNode(node).getSourceFile().fileName, this.rootDirs, this.compilerHost);
21085
21203
  let selectorlessEnabled = false;
21086
21204
  let localReferencedSymbols = null;
21087
21205
  if (this.enableSelectorless) {
@@ -21115,7 +21233,7 @@ var ComponentDecoratorHandler = class {
21115
21233
  externalStyles.push(resourceUrl);
21116
21234
  continue;
21117
21235
  }
21118
- if (styleUrl.source === 2 && ts74.isStringLiteralLike(styleUrl.expression)) {
21236
+ if (styleUrl.source === 2 && ts94.isStringLiteralLike(styleUrl.expression)) {
21119
21237
  styleResources.add({
21120
21238
  path: absoluteFrom(resourceUrl),
21121
21239
  node: styleUrl.expression
@@ -21323,7 +21441,7 @@ var ComponentDecoratorHandler = class {
21323
21441
  return null;
21324
21442
  }
21325
21443
  typeCheck(ctx, node, meta) {
21326
- if (!ts74.isClassDeclaration(node) || meta.isPoisoned && !this.usePoisonedData) {
21444
+ if (!ts94.isClassDeclaration(node) || meta.isPoisoned && !this.usePoisonedData) {
21327
21445
  return;
21328
21446
  }
21329
21447
  const ref = new Reference(node);
@@ -21854,12 +21972,12 @@ var ComponentDecoratorHandler = class {
21854
21972
  */
21855
21973
  collectExplicitlyDeferredSymbols(rawDeferredImports) {
21856
21974
  const deferredTypes = /* @__PURE__ */ new Map();
21857
- if (!ts74.isArrayLiteralExpression(rawDeferredImports)) {
21975
+ if (!ts94.isArrayLiteralExpression(rawDeferredImports)) {
21858
21976
  return deferredTypes;
21859
21977
  }
21860
21978
  for (const element of rawDeferredImports.elements) {
21861
21979
  const node = tryUnwrapForwardRef(element, this.reflector) || element;
21862
- if (!ts74.isIdentifier(node)) {
21980
+ if (!ts94.isIdentifier(node)) {
21863
21981
  continue;
21864
21982
  }
21865
21983
  const imp = this.reflector.getImportOfIdentifier(node);
@@ -21927,12 +22045,12 @@ var ComponentDecoratorHandler = class {
21927
22045
  }
21928
22046
  }
21929
22047
  if (analysisData.meta.isStandalone) {
21930
- if (analysisData.rawImports !== null && ts74.isArrayLiteralExpression(analysisData.rawImports)) {
22048
+ if (analysisData.rawImports !== null && ts94.isArrayLiteralExpression(analysisData.rawImports)) {
21931
22049
  for (const element of analysisData.rawImports.elements) {
21932
22050
  this.registerDeferrableCandidate(componentClassDecl, element, false, allDeferredDecls, eagerlyUsedDecls, resolutionData);
21933
22051
  }
21934
22052
  }
21935
- if (analysisData.rawDeferredImports !== null && ts74.isArrayLiteralExpression(analysisData.rawDeferredImports)) {
22053
+ if (analysisData.rawDeferredImports !== null && ts94.isArrayLiteralExpression(analysisData.rawDeferredImports)) {
21936
22054
  for (const element of analysisData.rawDeferredImports.elements) {
21937
22055
  this.registerDeferrableCandidate(componentClassDecl, element, false, allDeferredDecls, eagerlyUsedDecls, resolutionData);
21938
22056
  }
@@ -21951,7 +22069,7 @@ var ComponentDecoratorHandler = class {
21951
22069
  */
21952
22070
  registerDeferrableCandidate(componentClassDecl, element, isDeferredImport, allDeferredDecls, eagerlyUsedDecls, resolutionData) {
21953
22071
  const node = tryUnwrapForwardRef(element, this.reflector) || element;
21954
- if (!ts74.isIdentifier(node)) {
22072
+ if (!ts94.isIdentifier(node)) {
21955
22073
  return;
21956
22074
  }
21957
22075
  const imp = this.reflector.getImportOfIdentifier(node);
@@ -22086,7 +22204,7 @@ function isDefaultImport(node) {
22086
22204
 
22087
22205
  // packages/compiler-cli/src/ngtsc/annotations/src/injectable.js
22088
22206
  import { compileClassMetadata as compileClassMetadata3, compileDeclareClassMetadata as compileDeclareClassMetadata3, compileDeclareInjectableFromMetadata, compileInjectable, createMayBeForwardRefExpression as createMayBeForwardRefExpression3, FactoryTarget as FactoryTarget4, LiteralExpr as LiteralExpr3, WrappedNodeExpr as WrappedNodeExpr11 } from "@angular/compiler";
22089
- import ts75 from "typescript";
22207
+ import ts95 from "typescript";
22090
22208
  var InjectableDecoratorHandler = class {
22091
22209
  reflector;
22092
22210
  evaluator;
@@ -22221,7 +22339,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
22221
22339
  };
22222
22340
  } else if (decorator.args.length === 1) {
22223
22341
  const metaNode = decorator.args[0];
22224
- if (!ts75.isObjectLiteralExpression(metaNode)) {
22342
+ if (!ts95.isObjectLiteralExpression(metaNode)) {
22225
22343
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, metaNode, `@Injectable argument must be an object literal`);
22226
22344
  }
22227
22345
  const meta = reflectObjectLiteral(metaNode);
@@ -22233,7 +22351,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
22233
22351
  let deps = void 0;
22234
22352
  if ((meta.has("useClass") || meta.has("useFactory")) && meta.has("deps")) {
22235
22353
  const depsExpr = meta.get("deps");
22236
- if (!ts75.isArrayLiteralExpression(depsExpr)) {
22354
+ if (!ts95.isArrayLiteralExpression(depsExpr)) {
22237
22355
  throw new FatalDiagnosticError(ErrorCode.VALUE_NOT_LITERAL, depsExpr, `@Injectable deps metadata must be an inline array`);
22238
22356
  }
22239
22357
  deps = depsExpr.elements.map((dep) => getDep(dep, reflector));
@@ -22322,12 +22440,12 @@ function getDep(dep, reflector) {
22322
22440
  }
22323
22441
  return true;
22324
22442
  }
22325
- if (ts75.isArrayLiteralExpression(dep)) {
22443
+ if (ts95.isArrayLiteralExpression(dep)) {
22326
22444
  dep.elements.forEach((el) => {
22327
22445
  let isDecorator = false;
22328
- if (ts75.isIdentifier(el)) {
22446
+ if (ts95.isIdentifier(el)) {
22329
22447
  isDecorator = maybeUpdateDecorator(el, reflector);
22330
- } else if (ts75.isNewExpression(el) && ts75.isIdentifier(el.expression)) {
22448
+ } else if (ts95.isNewExpression(el) && ts95.isIdentifier(el.expression)) {
22331
22449
  const token = el.arguments && el.arguments.length > 0 && el.arguments[0] || void 0;
22332
22450
  isDecorator = maybeUpdateDecorator(el.expression, reflector, token);
22333
22451
  }
@@ -22341,7 +22459,7 @@ function getDep(dep, reflector) {
22341
22459
 
22342
22460
  // packages/compiler-cli/src/ngtsc/annotations/src/pipe.js
22343
22461
  import { compileClassMetadata as compileClassMetadata4, compileDeclareClassMetadata as compileDeclareClassMetadata4, compileDeclarePipeFromMetadata, compilePipeFromMetadata, FactoryTarget as FactoryTarget5 } from "@angular/compiler";
22344
- import ts76 from "typescript";
22462
+ import ts96 from "typescript";
22345
22463
  var PipeSymbol = class _PipeSymbol extends SemanticSymbol {
22346
22464
  name;
22347
22465
  constructor(decl, name) {
@@ -22411,13 +22529,13 @@ var PipeDecoratorHandler = class {
22411
22529
  }
22412
22530
  const meta = decorator.args.length === 0 || // TODO(crisbeto): temporary for testing until we've changed
22413
22531
  // the pipe public API not to require a name.
22414
- ts76.isNonNullExpression(decorator.args[0]) && decorator.args[0].expression.kind === ts76.SyntaxKind.NullKeyword ? null : unwrapExpression(decorator.args[0]);
22532
+ ts96.isNonNullExpression(decorator.args[0]) && decorator.args[0].expression.kind === ts96.SyntaxKind.NullKeyword ? null : unwrapExpression(decorator.args[0]);
22415
22533
  let pipeName = null;
22416
22534
  let pipeNameExpr = null;
22417
22535
  let pure = true;
22418
22536
  let isStandalone = this.implicitStandaloneValue;
22419
22537
  if (meta !== null) {
22420
- if (!ts76.isObjectLiteralExpression(meta)) {
22538
+ if (!ts96.isObjectLiteralExpression(meta)) {
22421
22539
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, "@Pipe must have a literal argument");
22422
22540
  }
22423
22541
  const pipe = reflectObjectLiteral(meta);
@@ -22543,12 +22661,12 @@ var PipeDecoratorHandler = class {
22543
22661
  };
22544
22662
 
22545
22663
  // packages/compiler-cli/src/ngtsc/transform/jit/src/initializer_api_transforms/transform.js
22546
- import ts79 from "typescript";
22664
+ import ts99 from "typescript";
22547
22665
 
22548
22666
  // packages/compiler-cli/src/ngtsc/transform/jit/src/initializer_api_transforms/transform_api.js
22549
- import ts77 from "typescript";
22667
+ import ts97 from "typescript";
22550
22668
  function createSyntheticAngularCoreDecoratorAccess(factory, importManager, ngClassDecorator, sourceFile, decoratorName) {
22551
- const classDecoratorIdentifier = ts77.isIdentifier(ngClassDecorator.identifier) ? ngClassDecorator.identifier : ngClassDecorator.identifier.expression;
22669
+ const classDecoratorIdentifier = ts97.isIdentifier(ngClassDecorator.identifier) ? ngClassDecorator.identifier : ngClassDecorator.identifier.expression;
22552
22670
  return factory.createPropertyAccessExpression(
22553
22671
  importManager.addImport({
22554
22672
  exportModuleSpecifier: "@angular/core",
@@ -22558,11 +22676,11 @@ function createSyntheticAngularCoreDecoratorAccess(factory, importManager, ngCla
22558
22676
  // The synthetic identifier may be checked later by the downlevel decorators
22559
22677
  // transform to resolve to an Angular import using `getSymbolAtLocation`. We trick
22560
22678
  // the transform to think it's not synthetic and comes from Angular core.
22561
- ts77.setOriginalNode(factory.createIdentifier(decoratorName), classDecoratorIdentifier)
22679
+ ts97.setOriginalNode(factory.createIdentifier(decoratorName), classDecoratorIdentifier)
22562
22680
  );
22563
22681
  }
22564
22682
  function castAsAny(factory, expr) {
22565
- return factory.createAsExpression(expr, factory.createKeywordTypeNode(ts77.SyntaxKind.AnyKeyword));
22683
+ return factory.createAsExpression(expr, factory.createKeywordTypeNode(ts97.SyntaxKind.AnyKeyword));
22566
22684
  }
22567
22685
 
22568
22686
  // packages/compiler-cli/src/ngtsc/transform/jit/src/initializer_api_transforms/input_function.js
@@ -22593,7 +22711,7 @@ var signalInputsTransform = (member, sourceFile, host, factory, importTracker, i
22593
22711
  };
22594
22712
 
22595
22713
  // packages/compiler-cli/src/ngtsc/transform/jit/src/initializer_api_transforms/model_function.js
22596
- import ts78 from "typescript";
22714
+ import ts98 from "typescript";
22597
22715
  var signalModelTransform = (member, sourceFile, host, factory, importTracker, importManager, classDecorator, isCore) => {
22598
22716
  if (host.getDecoratorsOfDeclaration(member.node)?.some((d) => {
22599
22717
  return isAngularDecorator2(d, "Input", isCore) || isAngularDecorator2(d, "Output", isCore);
@@ -22614,7 +22732,7 @@ var signalModelTransform = (member, sourceFile, host, factory, importTracker, im
22614
22732
  // Config is cast to `any` because `isSignal` will be private, and in case this
22615
22733
  // transform is used directly as a pre-compilation step, the decorator should
22616
22734
  // not fail. It is already validated now due to us parsing the input metadata.
22617
- factory.createAsExpression(inputConfig, factory.createKeywordTypeNode(ts78.SyntaxKind.AnyKeyword)),
22735
+ factory.createAsExpression(inputConfig, factory.createKeywordTypeNode(ts98.SyntaxKind.AnyKeyword)),
22618
22736
  classDecorator,
22619
22737
  factory,
22620
22738
  sourceFile,
@@ -22689,21 +22807,21 @@ function getInitializerApiJitTransform(host, importTracker, isCore, shouldTransf
22689
22807
  return (ctx) => {
22690
22808
  return (sourceFile) => {
22691
22809
  const importManager = new ImportManager();
22692
- sourceFile = ts79.visitNode(sourceFile, createTransformVisitor(ctx, host, importManager, importTracker, isCore, shouldTransformClass), ts79.isSourceFile);
22810
+ sourceFile = ts99.visitNode(sourceFile, createTransformVisitor(ctx, host, importManager, importTracker, isCore, shouldTransformClass), ts99.isSourceFile);
22693
22811
  return importManager.transformTsFile(ctx, sourceFile);
22694
22812
  };
22695
22813
  };
22696
22814
  }
22697
22815
  function createTransformVisitor(ctx, host, importManager, importTracker, isCore, shouldTransformClass) {
22698
22816
  const visitor = (node) => {
22699
- if (ts79.isClassDeclaration(node) && node.name !== void 0) {
22700
- const originalNode = ts79.getOriginalNode(node, ts79.isClassDeclaration);
22817
+ if (ts99.isClassDeclaration(node) && node.name !== void 0) {
22818
+ const originalNode = ts99.getOriginalNode(node, ts99.isClassDeclaration);
22701
22819
  const angularDecorator = host.getDecoratorsOfDeclaration(originalNode)?.find((d) => decoratorsWithInputs.some((name) => isAngularDecorator2(d, name, isCore)));
22702
22820
  if (angularDecorator !== void 0 && (shouldTransformClass === void 0 || shouldTransformClass(node))) {
22703
22821
  let hasChanged = false;
22704
22822
  const sourceFile = originalNode.getSourceFile();
22705
22823
  const members = node.members.map((memberNode) => {
22706
- if (!ts79.isPropertyDeclaration(memberNode)) {
22824
+ if (!ts99.isPropertyDeclaration(memberNode)) {
22707
22825
  return memberNode;
22708
22826
  }
22709
22827
  const member = reflectClassMember(memberNode);
@@ -22724,7 +22842,7 @@ function createTransformVisitor(ctx, host, importManager, importTracker, isCore,
22724
22842
  }
22725
22843
  }
22726
22844
  }
22727
- return ts79.visitEachChild(node, visitor, ctx);
22845
+ return ts99.visitEachChild(node, visitor, ctx);
22728
22846
  };
22729
22847
  return visitor;
22730
22848
  }