@angular/compiler-cli 21.2.0 → 22.0.0-next.0

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 (44) hide show
  1. package/bundles/{chunk-IG22BDVK.js → chunk-5KB2MYHH.js} +875 -1172
  2. package/bundles/{chunk-IO4PSCVA.js → chunk-DZUTWYAK.js} +1 -1
  3. package/bundles/chunk-FLWAEX6T.js +1 -1
  4. package/bundles/{chunk-J2UUYQZ3.js → chunk-GZL3HSYM.js} +2 -2
  5. package/bundles/{chunk-G6DAEDUS.js → chunk-TYSFQCFS.js} +2 -2
  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 +3 -3
  14. package/src/ngtsc/core/src/compiler.d.ts +1 -1
  15. package/src/ngtsc/diagnostics/src/docs.d.ts +1 -1
  16. package/src/ngtsc/diagnostics/src/error_code.d.ts +4 -0
  17. package/src/ngtsc/typecheck/src/comments.d.ts +0 -7
  18. package/src/ngtsc/typecheck/src/environment.d.ts +7 -6
  19. package/src/ngtsc/typecheck/src/expression.d.ts +3 -15
  20. package/src/ngtsc/typecheck/src/host_bindings.d.ts +1 -1
  21. package/src/ngtsc/typecheck/src/ops/base.d.ts +3 -3
  22. package/src/ngtsc/typecheck/src/ops/bindings.d.ts +8 -3
  23. package/src/ngtsc/typecheck/src/ops/codegen.d.ts +74 -0
  24. package/src/ngtsc/typecheck/src/ops/context.d.ts +1 -2
  25. package/src/ngtsc/typecheck/src/ops/directive_constructor.d.ts +3 -3
  26. package/src/ngtsc/typecheck/src/ops/directive_type.d.ts +4 -4
  27. package/src/ngtsc/typecheck/src/ops/element.d.ts +2 -2
  28. package/src/ngtsc/typecheck/src/ops/events.d.ts +2 -2
  29. package/src/ngtsc/typecheck/src/ops/expression.d.ts +5 -5
  30. package/src/ngtsc/typecheck/src/ops/for_block.d.ts +2 -2
  31. package/src/ngtsc/typecheck/src/ops/host.d.ts +2 -2
  32. package/src/ngtsc/typecheck/src/ops/inputs.d.ts +2 -2
  33. package/src/ngtsc/typecheck/src/ops/let.d.ts +2 -2
  34. package/src/ngtsc/typecheck/src/ops/references.d.ts +3 -3
  35. package/src/ngtsc/typecheck/src/ops/schema.d.ts +2 -2
  36. package/src/ngtsc/typecheck/src/ops/scope.d.ts +9 -9
  37. package/src/ngtsc/typecheck/src/ops/selectorless.d.ts +2 -2
  38. package/src/ngtsc/typecheck/src/ops/template.d.ts +2 -2
  39. package/src/ngtsc/typecheck/src/ops/variables.d.ts +6 -6
  40. package/src/ngtsc/typecheck/src/reference_emit_environment.d.ts +2 -5
  41. package/src/ngtsc/typecheck/src/ts_util.d.ts +0 -37
  42. package/src/ngtsc/typecheck/src/type_check_block.d.ts +1 -1
  43. package/src/ngtsc/typecheck/src/type_check_file.d.ts +3 -2
  44. package/src/ngtsc/typecheck/src/type_constructor.d.ts +3 -2
@@ -34,6 +34,7 @@ var ErrorCode;
34
34
  ErrorCode2[ErrorCode2["INITIALIZER_API_DECORATOR_METADATA_COLLISION"] = 1051] = "INITIALIZER_API_DECORATOR_METADATA_COLLISION";
35
35
  ErrorCode2[ErrorCode2["INITIALIZER_API_NO_REQUIRED_FUNCTION"] = 1052] = "INITIALIZER_API_NO_REQUIRED_FUNCTION";
36
36
  ErrorCode2[ErrorCode2["INITIALIZER_API_DISALLOWED_MEMBER_VISIBILITY"] = 1053] = "INITIALIZER_API_DISALLOWED_MEMBER_VISIBILITY";
37
+ ErrorCode2[ErrorCode2["DUPLICATE_BINDING_NAME"] = 1054] = "DUPLICATE_BINDING_NAME";
37
38
  ErrorCode2[ErrorCode2["INCORRECTLY_DECLARED_ON_STATIC_MEMBER"] = 1100] = "INCORRECTLY_DECLARED_ON_STATIC_MEMBER";
38
39
  ErrorCode2[ErrorCode2["COMPONENT_MISSING_TEMPLATE"] = 2001] = "COMPONENT_MISSING_TEMPLATE";
39
40
  ErrorCode2[ErrorCode2["PIPE_MISSING_NAME"] = 2002] = "PIPE_MISSING_NAME";
@@ -229,7 +230,7 @@ var COMPILER_ERRORS_WITH_GUIDES = /* @__PURE__ */ new Set([
229
230
  import { VERSION } from "@angular/compiler";
230
231
  var DOC_PAGE_BASE_URL = (() => {
231
232
  const full = VERSION.full;
232
- const isPreRelease = full.includes("-next") || full.includes("-rc") || full === "21.2.0";
233
+ const isPreRelease = full.includes("-next") || full.includes("-rc") || full === "22.0.0-next.0";
233
234
  const prefix = isPreRelease ? "next" : `v${VERSION.major}`;
234
235
  return `https://${prefix}.angular.dev`;
235
236
  })();
@@ -8786,12 +8787,19 @@ function tryParseInputFieldMapping(clazz, member, evaluator, reflector, importTr
8786
8787
  }
8787
8788
  function parseInputFields(clazz, members, evaluator, reflector, importTracker, refEmitter, isCore, compilationMode, inputsFromClassDecorator, classDecorator, emitDeclarationOnly) {
8788
8789
  const inputs = {};
8790
+ const bindings = /* @__PURE__ */ new Map();
8789
8791
  for (const member of members) {
8790
8792
  const classPropertyName = member.name;
8791
8793
  const inputMapping = tryParseInputFieldMapping(clazz, member, evaluator, reflector, importTracker, isCore, refEmitter, compilationMode, emitDeclarationOnly);
8792
8794
  if (inputMapping === null) {
8793
8795
  continue;
8794
8796
  }
8797
+ const bindingPropertyName = inputMapping.bindingPropertyName;
8798
+ if (bindings.has(bindingPropertyName)) {
8799
+ const firstMember = bindings.get(bindingPropertyName);
8800
+ throw new FatalDiagnosticError(ErrorCode.DUPLICATE_BINDING_NAME, member.node ?? clazz, `Input '${bindingPropertyName}' is bound to both '${firstMember.name}' and '${member.name}'.`, [makeRelatedInformation(firstMember.node ?? clazz, `The first binding is declared here.`)]);
8801
+ }
8802
+ bindings.set(bindingPropertyName, member);
8795
8803
  if (member.isStatic) {
8796
8804
  throw new FatalDiagnosticError(ErrorCode.INCORRECTLY_DECLARED_ON_STATIC_MEMBER, member.node ?? clazz, `Input "${member.name}" is incorrectly declared as static member of "${clazz.name.text}".`);
8797
8805
  }
@@ -8953,6 +8961,7 @@ function parseOutputsArray(directive, evaluator) {
8953
8961
  }
8954
8962
  function parseOutputFields(clazz, classDecorator, members, isCore, reflector, importTracker, evaluator, outputsFromMeta) {
8955
8963
  const outputs = {};
8964
+ const bindings = /* @__PURE__ */ new Map();
8956
8965
  for (const member of members) {
8957
8966
  const decoratorOutput = tryParseDecoratorOutput(member, evaluator, isCore);
8958
8967
  const initializerOutput = tryParseInitializerBasedOutput(member, reflector, importTracker);
@@ -8977,6 +8986,11 @@ function parseOutputFields(clazz, classDecorator, members, isCore, reflector, im
8977
8986
  } else {
8978
8987
  continue;
8979
8988
  }
8989
+ if (bindings.has(bindingPropertyName)) {
8990
+ const firstMember = bindings.get(bindingPropertyName);
8991
+ throw new FatalDiagnosticError(ErrorCode.DUPLICATE_BINDING_NAME, member.node ?? clazz, `Output '${bindingPropertyName}' is bound to both '${firstMember.name}' and '${member.name}'.`, [makeRelatedInformation(firstMember.node ?? clazz, `The first binding is declared here.`)]);
8992
+ }
8993
+ bindings.set(bindingPropertyName, member);
8980
8994
  if ((initializerOutput !== null || modelMapping !== null) && outputsFromMeta.hasOwnProperty(member.name)) {
8981
8995
  throw new FatalDiagnosticError(ErrorCode.INITIALIZER_API_DECORATOR_METADATA_COLLISION, member.node ?? clazz, `Output "${member.name}" is unexpectedly declared in @${classDecorator.name} as well.`);
8982
8996
  }
@@ -9836,7 +9850,7 @@ function _extractTemplateStyleUrls(template) {
9836
9850
 
9837
9851
  // packages/compiler-cli/src/ngtsc/annotations/component/src/handler.js
9838
9852
  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";
9839
- import ts94 from "typescript";
9853
+ import ts79 from "typescript";
9840
9854
 
9841
9855
  // packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/api.js
9842
9856
  import ts43 from "typescript";
@@ -10954,8 +10968,8 @@ var TypeCheckScopeRegistry = class {
10954
10968
  };
10955
10969
 
10956
10970
  // packages/compiler-cli/src/ngtsc/annotations/directive/src/handler.js
10957
- import { compileClassMetadata, compileDeclareClassMetadata, compileDeclareDirectiveFromMetadata, compileDirectiveFromMetadata, FactoryTarget, makeBindingParser as makeBindingParser2, R3TargetBinder, WrappedNodeExpr as WrappedNodeExpr9 } from "@angular/compiler";
10958
- import ts87 from "typescript";
10971
+ import { compileClassMetadata, compileDeclareClassMetadata, compileDeclareDirectiveFromMetadata, compileDirectiveFromMetadata, FactoryTarget, makeBindingParser as makeBindingParser2, R3TargetBinder, WrappedNodeExpr as WrappedNodeExpr8 } from "@angular/compiler";
10972
+ import ts72 from "typescript";
10959
10973
 
10960
10974
  // packages/compiler-cli/src/ngtsc/annotations/directive/src/symbol.js
10961
10975
  var DirectiveSymbol = class _DirectiveSymbol extends SemanticSymbol {
@@ -11044,7 +11058,7 @@ function isBaseClassEqual(current, previous) {
11044
11058
  }
11045
11059
 
11046
11060
  // packages/compiler-cli/src/ngtsc/typecheck/src/checker.js
11047
- import { CssSelector as CssSelector4, DomElementSchemaRegistry as DomElementSchemaRegistry2, ExternalExpr as ExternalExpr8, WrappedNodeExpr as WrappedNodeExpr8 } from "@angular/compiler";
11061
+ import { CssSelector as CssSelector4, DomElementSchemaRegistry as DomElementSchemaRegistry2, ExternalExpr as ExternalExpr8, WrappedNodeExpr as WrappedNodeExpr7 } from "@angular/compiler";
11048
11062
 
11049
11063
  // packages/compiler-cli/src/ngtsc/typecheck/src/ts_util.js
11050
11064
  import ts48 from "typescript";
@@ -11078,25 +11092,7 @@ var ExpressionIdentifier;
11078
11092
  ExpressionIdentifier2["EVENT_PARAMETER"] = "EP";
11079
11093
  ExpressionIdentifier2["VARIABLE_AS_EXPRESSION"] = "VAE";
11080
11094
  })(ExpressionIdentifier || (ExpressionIdentifier = {}));
11081
- function addExpressionIdentifier(node, identifier) {
11082
- ts47.addSyntheticTrailingComment(
11083
- node,
11084
- ts47.SyntaxKind.MultiLineCommentTrivia,
11085
- `${CommentTriviaType.EXPRESSION_TYPE_IDENTIFIER}:${identifier}`,
11086
- /* hasTrailingNewLine */
11087
- false
11088
- );
11089
- }
11090
11095
  var IGNORE_FOR_DIAGNOSTICS_MARKER = `${CommentTriviaType.DIAGNOSTIC}:ignore`;
11091
- function markIgnoreDiagnostics(node) {
11092
- ts47.addSyntheticTrailingComment(
11093
- node,
11094
- ts47.SyntaxKind.MultiLineCommentTrivia,
11095
- IGNORE_FOR_DIAGNOSTICS_MARKER,
11096
- /* hasTrailingNewLine */
11097
- false
11098
- );
11099
- }
11100
11096
  function hasIgnoreForDiagnosticsMarker(node, sourceFile) {
11101
11097
  return ts47.forEachTrailingCommentRange(sourceFile.text, node.getEnd(), (pos, end, kind) => {
11102
11098
  if (kind !== ts47.SyntaxKind.MultiLineCommentTrivia) {
@@ -11182,119 +11178,9 @@ function hasExpressionIdentifier(sourceFile, node, identifier) {
11182
11178
  }
11183
11179
 
11184
11180
  // packages/compiler-cli/src/ngtsc/typecheck/src/ts_util.js
11185
- var SAFE_TO_CAST_WITHOUT_PARENS = null;
11186
- function tsCastToAny(expr) {
11187
- if (SAFE_TO_CAST_WITHOUT_PARENS === null) {
11188
- SAFE_TO_CAST_WITHOUT_PARENS = /* @__PURE__ */ new Set([
11189
- // Expressions which are already parenthesized can be cast without further wrapping.
11190
- ts48.SyntaxKind.ParenthesizedExpression,
11191
- // Expressions which form a single lexical unit leave no room for precedence issues with the cast.
11192
- ts48.SyntaxKind.Identifier,
11193
- ts48.SyntaxKind.CallExpression,
11194
- ts48.SyntaxKind.NonNullExpression,
11195
- ts48.SyntaxKind.ElementAccessExpression,
11196
- ts48.SyntaxKind.PropertyAccessExpression,
11197
- ts48.SyntaxKind.ArrayLiteralExpression,
11198
- ts48.SyntaxKind.ObjectLiteralExpression,
11199
- // The same goes for various literals.
11200
- ts48.SyntaxKind.StringLiteral,
11201
- ts48.SyntaxKind.NumericLiteral,
11202
- ts48.SyntaxKind.TrueKeyword,
11203
- ts48.SyntaxKind.FalseKeyword,
11204
- ts48.SyntaxKind.NullKeyword,
11205
- ts48.SyntaxKind.UndefinedKeyword
11206
- ]);
11207
- }
11208
- if (!SAFE_TO_CAST_WITHOUT_PARENS.has(expr.kind)) {
11209
- expr = ts48.factory.createParenthesizedExpression(expr);
11210
- }
11211
- return ts48.factory.createParenthesizedExpression(ts48.factory.createAsExpression(expr, ts48.factory.createKeywordTypeNode(ts48.SyntaxKind.AnyKeyword)));
11212
- }
11213
- function tsCreateElement(...tagNames) {
11214
- const createElement = ts48.factory.createPropertyAccessExpression(
11215
- /* expression */
11216
- ts48.factory.createIdentifier("document"),
11217
- "createElement"
11218
- );
11219
- let arg;
11220
- if (tagNames.length === 1) {
11221
- arg = ts48.factory.createStringLiteral(tagNames[0]);
11222
- } else {
11223
- const assertedNullExpression = ts48.factory.createNonNullExpression(ts48.factory.createNull());
11224
- const type = ts48.factory.createUnionTypeNode(tagNames.map((tag) => ts48.factory.createLiteralTypeNode(ts48.factory.createStringLiteral(tag))));
11225
- arg = ts48.factory.createAsExpression(assertedNullExpression, type);
11226
- }
11227
- return ts48.factory.createCallExpression(
11228
- /* expression */
11229
- createElement,
11230
- /* typeArguments */
11231
- void 0,
11232
- /* argumentsArray */
11233
- [arg]
11234
- );
11235
- }
11236
- function tsDeclareVariable(id, type) {
11237
- addExpressionIdentifier(type, ExpressionIdentifier.VARIABLE_AS_EXPRESSION);
11238
- const initializer = ts48.factory.createAsExpression(ts48.factory.createNonNullExpression(ts48.factory.createNull()), type);
11239
- const decl = ts48.factory.createVariableDeclaration(
11240
- /* name */
11241
- id,
11242
- /* exclamationToken */
11243
- void 0,
11244
- /* type */
11245
- void 0,
11246
- /* initializer */
11247
- initializer
11248
- );
11249
- return ts48.factory.createVariableStatement(
11250
- /* modifiers */
11251
- void 0,
11252
- /* declarationList */
11253
- [decl]
11254
- );
11255
- }
11256
- function tsCreateTypeQueryForCoercedInput(typeName, coercedInputName) {
11257
- return ts48.factory.createTypeQueryNode(ts48.factory.createQualifiedName(typeName, `ngAcceptInputType_${coercedInputName}`));
11258
- }
11259
- function tsCreateVariable(id, initializer, flags = null) {
11260
- const decl = ts48.factory.createVariableDeclaration(
11261
- /* name */
11262
- id,
11263
- /* exclamationToken */
11264
- void 0,
11265
- /* type */
11266
- void 0,
11267
- /* initializer */
11268
- initializer
11269
- );
11270
- return ts48.factory.createVariableStatement(
11271
- /* modifiers */
11272
- void 0,
11273
- /* declarationList */
11274
- flags === null ? [decl] : ts48.factory.createVariableDeclarationList([decl], flags)
11275
- );
11276
- }
11277
- function tsCallMethod(receiver, methodName, args = []) {
11278
- const methodAccess = ts48.factory.createPropertyAccessExpression(receiver, methodName);
11279
- return ts48.factory.createCallExpression(
11280
- /* expression */
11281
- methodAccess,
11282
- /* typeArguments */
11283
- void 0,
11284
- /* argumentsArray */
11285
- args
11286
- );
11287
- }
11288
11181
  function isAccessExpression(node) {
11289
11182
  return ts48.isPropertyAccessExpression(node) || ts48.isElementAccessExpression(node);
11290
11183
  }
11291
- function tsNumericExpression2(value) {
11292
- if (value < 0) {
11293
- const operand = ts48.factory.createNumericLiteral(Math.abs(value));
11294
- return ts48.factory.createPrefixUnaryExpression(ts48.SyntaxKind.MinusToken, operand);
11295
- }
11296
- return ts48.factory.createNumericLiteral(value);
11297
- }
11298
11184
  function isDirectiveDeclaration(node) {
11299
11185
  const sourceFile = node.getSourceFile();
11300
11186
  return (ts48.isTypeNode(node) || ts48.isIdentifier(node)) && ts48.isVariableDeclaration(node.parent) && hasExpressionIdentifier(sourceFile, node, ExpressionIdentifier.DIRECTIVE);
@@ -11316,7 +11202,7 @@ function isSymbolAliasOf(firstSymbol, lastSymbol, typeChecker) {
11316
11202
  }
11317
11203
 
11318
11204
  // packages/compiler-cli/src/ngtsc/typecheck/src/checker.js
11319
- import ts86 from "typescript";
11205
+ import ts71 from "typescript";
11320
11206
 
11321
11207
  // packages/compiler-cli/src/ngtsc/program_driver/src/api.js
11322
11208
  var NgOriginalFile = Symbol("NgOriginalFile");
@@ -12908,7 +12794,7 @@ var MagicString = class _MagicString {
12908
12794
  };
12909
12795
 
12910
12796
  // packages/compiler-cli/src/ngtsc/typecheck/src/context.js
12911
- import ts84 from "typescript";
12797
+ import ts68 from "typescript";
12912
12798
 
12913
12799
  // packages/compiler-cli/src/ngtsc/typecheck/src/dom.js
12914
12800
  import { DomElementSchemaRegistry } from "@angular/compiler";
@@ -12977,10 +12863,112 @@ var RegistryDomSchemaChecker = class {
12977
12863
  };
12978
12864
 
12979
12865
  // packages/compiler-cli/src/ngtsc/typecheck/src/environment.js
12980
- import ts57 from "typescript";
12866
+ import ts59 from "typescript";
12981
12867
 
12982
12868
  // packages/compiler-cli/src/ngtsc/typecheck/src/reference_emit_environment.js
12983
12869
  import { ExpressionType, ExternalExpr as ExternalExpr7, TypeModifier } from "@angular/compiler";
12870
+ import ts54 from "typescript";
12871
+
12872
+ // packages/compiler-cli/src/ngtsc/typecheck/src/ops/codegen.js
12873
+ import { AbsoluteSourceSpan as AbsoluteSourceSpan2 } from "@angular/compiler";
12874
+ import ts53 from "typescript";
12875
+ var TcbExpr = class {
12876
+ source;
12877
+ /** Text for the content containing the expression's location information. */
12878
+ spanComment = null;
12879
+ /** Text for the content containing the expression's identifier. */
12880
+ identifierComment = null;
12881
+ /**
12882
+ * Text of the comment instructing the type checker to
12883
+ * ignore diagnostics coming from this expression.
12884
+ */
12885
+ ignoreComment = null;
12886
+ constructor(source) {
12887
+ this.source = source;
12888
+ }
12889
+ /**
12890
+ * Converts the node's current state to a string.
12891
+ * @param ignoreComments Whether the comments associated with the expression should be skipped.
12892
+ */
12893
+ print(ignoreComments = false) {
12894
+ if (ignoreComments) {
12895
+ return this.source;
12896
+ }
12897
+ return this.source + this.formatComment(this.identifierComment) + this.formatComment(this.ignoreComment) + this.formatComment(this.spanComment);
12898
+ }
12899
+ /**
12900
+ * Adds a synthetic comment to the expression that represents the parse span of the provided node.
12901
+ * This comment can later be retrieved as trivia of a node to recover original source locations.
12902
+ * @param span Span from the parser containing the location information.
12903
+ */
12904
+ addParseSpanInfo(span) {
12905
+ let start;
12906
+ let end;
12907
+ if (span instanceof AbsoluteSourceSpan2) {
12908
+ start = span.start;
12909
+ end = span.end;
12910
+ } else {
12911
+ start = span.start.offset;
12912
+ end = span.end.offset;
12913
+ }
12914
+ this.spanComment = `${start},${end}`;
12915
+ return this;
12916
+ }
12917
+ /** Marks the expression to be ignored for diagnostics. */
12918
+ markIgnoreDiagnostics() {
12919
+ this.ignoreComment = `${CommentTriviaType.DIAGNOSTIC}:ignore`;
12920
+ return this;
12921
+ }
12922
+ /**
12923
+ * Wraps the expression in parenthesis such that inserted
12924
+ * span comments become attached to the proper node.
12925
+ */
12926
+ wrapForTypeChecker() {
12927
+ this.source = `(${this.print()})`;
12928
+ this.spanComment = this.identifierComment = this.ignoreComment = null;
12929
+ return this;
12930
+ }
12931
+ /**
12932
+ * Tags the expression with an identifier.
12933
+ * @param identifier Identifier to apply to the expression.
12934
+ */
12935
+ addExpressionIdentifier(identifier) {
12936
+ this.identifierComment = `${CommentTriviaType.EXPRESSION_TYPE_IDENTIFIER}:${identifier}`;
12937
+ return this;
12938
+ }
12939
+ /**
12940
+ * `toString` implementation meant to catch errors like accidentally
12941
+ * writing `foo ${expr} bar` instead of `foo ${expr.print()} bar`.
12942
+ */
12943
+ toString() {
12944
+ throw new Error("Assertion error: TcbExpr should not be converted to a string through concatenation. Use the `print` method instead.");
12945
+ }
12946
+ /** Format a comment string as a TypeScript comment. */
12947
+ formatComment(content) {
12948
+ return content === null || content.length === 0 ? "" : ` /*${content}*/`;
12949
+ }
12950
+ };
12951
+ function declareVariable(identifier, type) {
12952
+ type.addExpressionIdentifier(ExpressionIdentifier.VARIABLE_AS_EXPRESSION);
12953
+ return new TcbExpr(`var ${identifier.print()} = null! as ${type.print()}`);
12954
+ }
12955
+ function getStatementsBlock(expressions, singleLine = false) {
12956
+ let result = "";
12957
+ for (const expr of expressions) {
12958
+ result += `${expr.print()};${singleLine ? " " : "\n"}`;
12959
+ }
12960
+ return result;
12961
+ }
12962
+ function quoteAndEscape(value) {
12963
+ return JSON.stringify(value);
12964
+ }
12965
+ var tempPrinter = null;
12966
+ function tempPrint(node, sourceFile) {
12967
+ tempPrinter ??= ts53.createPrinter();
12968
+ return tempPrinter.printNode(ts53.EmitHint.Unspecified, node, sourceFile);
12969
+ }
12970
+
12971
+ // packages/compiler-cli/src/ngtsc/typecheck/src/reference_emit_environment.js
12984
12972
  var ReferenceEmitEnvironment = class {
12985
12973
  importManager;
12986
12974
  refEmitter;
@@ -13006,13 +12994,18 @@ var ReferenceEmitEnvironment = class {
13006
12994
  assertSuccessfulReferenceEmit(ngExpr, this.contextFile, "symbol");
13007
12995
  return translateType(new ExpressionType(ngExpr.expression), this.contextFile, this.reflector, this.refEmitter, this.importManager);
13008
12996
  }
13009
- /**
13010
- * Generate a `ts.Expression` that refers to the external symbol. This
13011
- * may result in new imports being generated.
13012
- */
13013
12997
  referenceExternalSymbol(moduleName, name) {
13014
- const external = new ExternalExpr7({ moduleName, name });
13015
- return translateExpression(this.contextFile, external, this.importManager);
12998
+ const importResult = this.importManager.addImport({
12999
+ exportModuleSpecifier: moduleName,
13000
+ exportSymbolName: name,
13001
+ requestedFile: this.contextFile
13002
+ });
13003
+ if (ts54.isIdentifier(importResult)) {
13004
+ return new TcbExpr(importResult.text);
13005
+ } else if (ts54.isIdentifier(importResult.expression)) {
13006
+ return new TcbExpr(`${importResult.expression.text}.${importResult.name.text}`);
13007
+ }
13008
+ throw new Error("Unexpected value returned by import manager");
13016
13009
  }
13017
13010
  /**
13018
13011
  * Generate a `ts.TypeNode` that references a given type from the provided module.
@@ -13035,15 +13028,15 @@ var ReferenceEmitEnvironment = class {
13035
13028
  };
13036
13029
 
13037
13030
  // packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.js
13038
- import { ExpressionType as ExpressionType2, R3Identifiers as R3Identifiers3, WrappedNodeExpr as WrappedNodeExpr7 } from "@angular/compiler";
13039
- import ts56 from "typescript";
13031
+ import { R3Identifiers as R3Identifiers3 } from "@angular/compiler";
13032
+ import ts58 from "typescript";
13040
13033
 
13041
13034
  // packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.js
13042
13035
  import { R3Identifiers as R3Identifiers2 } from "@angular/compiler";
13043
- import ts55 from "typescript";
13036
+ import ts57 from "typescript";
13044
13037
 
13045
13038
  // packages/compiler-cli/src/ngtsc/typecheck/src/type_parameter_emitter.js
13046
- import ts53 from "typescript";
13039
+ import ts55 from "typescript";
13047
13040
  var TypeParameterEmitter = class {
13048
13041
  typeParameters;
13049
13042
  reflector;
@@ -13090,11 +13083,11 @@ var TypeParameterEmitter = class {
13090
13083
  return this.typeParameters.map((typeParam) => {
13091
13084
  const constraint = typeParam.constraint !== void 0 ? emitter.emitType(typeParam.constraint) : void 0;
13092
13085
  const defaultType = typeParam.default !== void 0 ? emitter.emitType(typeParam.default) : void 0;
13093
- return ts53.factory.updateTypeParameterDeclaration(typeParam, typeParam.modifiers, typeParam.name, constraint, defaultType);
13086
+ return ts55.factory.updateTypeParameterDeclaration(typeParam, typeParam.modifiers, typeParam.name, constraint, defaultType);
13094
13087
  });
13095
13088
  }
13096
13089
  resolveTypeReference(type) {
13097
- const target = ts53.isIdentifier(type.typeName) ? type.typeName : type.typeName.right;
13090
+ const target = ts55.isIdentifier(type.typeName) ? type.typeName : type.typeName.right;
13098
13091
  const declaration = this.reflector.getDeclarationOfIdentifier(target);
13099
13092
  if (declaration === null || declaration.node === null) {
13100
13093
  return null;
@@ -13120,8 +13113,8 @@ var TypeParameterEmitter = class {
13120
13113
  if (typeNode === null) {
13121
13114
  return null;
13122
13115
  }
13123
- if (!ts53.isTypeReferenceNode(typeNode)) {
13124
- throw new Error(`Expected TypeReferenceNode for emitted reference, got ${ts53.SyntaxKind[typeNode.kind]}.`);
13116
+ if (!ts55.isTypeReferenceNode(typeNode)) {
13117
+ throw new Error(`Expected TypeReferenceNode for emitted reference, got ${ts55.SyntaxKind[typeNode.kind]}.`);
13125
13118
  }
13126
13119
  return typeNode;
13127
13120
  }
@@ -13131,8 +13124,8 @@ var TypeParameterEmitter = class {
13131
13124
  };
13132
13125
 
13133
13126
  // packages/compiler-cli/src/ngtsc/typecheck/src/host_bindings.js
13134
- import { BindingType, CssSelector as CssSelector2, makeBindingParser, TmplAstBoundAttribute, TmplAstBoundEvent, TmplAstHostElement, AbsoluteSourceSpan as AbsoluteSourceSpan2, ParseSpan, PropertyRead as PropertyRead2, ParsedEventType, Call, ThisReceiver as ThisReceiver2, KeyedRead, LiteralPrimitive, RecursiveAstVisitor, ASTWithName, SafeCall, ImplicitReceiver as ImplicitReceiver2 } from "@angular/compiler";
13135
- import ts54 from "typescript";
13127
+ import { BindingType, CssSelector as CssSelector2, makeBindingParser, TmplAstBoundAttribute, TmplAstBoundEvent, TmplAstHostElement, AbsoluteSourceSpan as AbsoluteSourceSpan3, ParseSpan, PropertyRead as PropertyRead2, ParsedEventType, Call, ThisReceiver as ThisReceiver2, KeyedRead, LiteralPrimitive, RecursiveAstVisitor, ASTWithName, SafeCall, ImplicitReceiver as ImplicitReceiver2 } from "@angular/compiler";
13128
+ import ts56 from "typescript";
13136
13129
  var GUARD_COMMENT_TEXT = "hostBindingsBlockGuard";
13137
13130
  function createHostElement(type, selector, sourceNode, literal4, bindingDecorators, listenerDecorators) {
13138
13131
  const bindings = [];
@@ -13140,7 +13133,7 @@ function createHostElement(type, selector, sourceNode, literal4, bindingDecorato
13140
13133
  let parser = null;
13141
13134
  if (literal4 !== null) {
13142
13135
  for (const prop of literal4.properties) {
13143
- if (ts54.isPropertyAssignment(prop) && ts54.isStringLiteralLike(prop.initializer) && isStaticName(prop.name)) {
13136
+ if (ts56.isPropertyAssignment(prop) && ts56.isStringLiteralLike(prop.initializer) && isStaticName(prop.name)) {
13144
13137
  parser ??= makeBindingParser();
13145
13138
  createNodeFromHostLiteralProperty(prop, parser, bindings, listeners);
13146
13139
  }
@@ -13171,19 +13164,18 @@ function createHostElement(type, selector, sourceNode, literal4, bindingDecorato
13171
13164
  return new TmplAstHostElement(tagNames, bindings, listeners, createSourceSpan(sourceNode.name));
13172
13165
  }
13173
13166
  function createHostBindingsBlockGuard() {
13174
- const trueExpr = ts54.addSyntheticTrailingComment(ts54.factory.createTrue(), ts54.SyntaxKind.MultiLineCommentTrivia, GUARD_COMMENT_TEXT);
13175
- return ts54.factory.createParenthesizedExpression(trueExpr);
13167
+ return `(true /*${GUARD_COMMENT_TEXT}*/)`;
13176
13168
  }
13177
13169
  function isHostBindingsBlockGuard(node) {
13178
- if (!ts54.isIfStatement(node)) {
13170
+ if (!ts56.isIfStatement(node)) {
13179
13171
  return false;
13180
13172
  }
13181
13173
  const expr = node.expression;
13182
- if (!ts54.isParenthesizedExpression(expr) || expr.expression.kind !== ts54.SyntaxKind.TrueKeyword) {
13174
+ if (!ts56.isParenthesizedExpression(expr) || expr.expression.kind !== ts56.SyntaxKind.TrueKeyword) {
13183
13175
  return false;
13184
13176
  }
13185
13177
  const text = expr.getSourceFile().text;
13186
- return ts54.forEachTrailingCommentRange(text, expr.expression.getEnd(), (pos, end, kind) => kind === ts54.SyntaxKind.MultiLineCommentTrivia && text.substring(pos + 2, end - 2) === GUARD_COMMENT_TEXT) || false;
13178
+ return ts56.forEachTrailingCommentRange(text, expr.expression.getEnd(), (pos, end, kind) => kind === ts56.SyntaxKind.MultiLineCommentTrivia && text.substring(pos + 2, end - 2) === GUARD_COMMENT_TEXT) || false;
13187
13179
  }
13188
13180
  function createNodeFromHostLiteralProperty(property, parser, bindings, listeners) {
13189
13181
  const { name, initializer } = property;
@@ -13207,19 +13199,19 @@ function createNodeFromHostLiteralProperty(property, parser, bindings, listeners
13207
13199
  }
13208
13200
  }
13209
13201
  function createNodeFromBindingDecorator(decorator, bindings) {
13210
- if (!ts54.isCallExpression(decorator.expression)) {
13202
+ if (!ts56.isCallExpression(decorator.expression)) {
13211
13203
  return;
13212
13204
  }
13213
13205
  const args = decorator.expression.arguments;
13214
13206
  const property = decorator.parent;
13215
13207
  let nameNode = null;
13216
13208
  let propertyName = null;
13217
- if (property && ts54.isPropertyDeclaration(property) && isStaticName(property.name)) {
13209
+ if (property && ts56.isPropertyDeclaration(property) && isStaticName(property.name)) {
13218
13210
  propertyName = property.name;
13219
13211
  }
13220
13212
  if (args.length === 0) {
13221
13213
  nameNode = propertyName;
13222
- } else if (ts54.isStringLiteralLike(args[0])) {
13214
+ } else if (ts56.isStringLiteralLike(args[0])) {
13223
13215
  nameNode = args[0];
13224
13216
  } else {
13225
13217
  return;
@@ -13229,36 +13221,36 @@ function createNodeFromBindingDecorator(decorator, bindings) {
13229
13221
  }
13230
13222
  const span = new ParseSpan(-1, -1);
13231
13223
  const propertyStart = property.getStart();
13232
- const receiver = new ThisReceiver2(span, new AbsoluteSourceSpan2(propertyStart, propertyStart));
13233
- const nameSpan = new AbsoluteSourceSpan2(propertyName.getStart(), propertyName.getEnd());
13234
- const read = ts54.isIdentifier(propertyName) ? new PropertyRead2(span, nameSpan, nameSpan, receiver, propertyName.text) : new KeyedRead(span, nameSpan, receiver, new LiteralPrimitive(span, nameSpan, propertyName.text));
13224
+ const receiver = new ThisReceiver2(span, new AbsoluteSourceSpan3(propertyStart, propertyStart));
13225
+ const nameSpan = new AbsoluteSourceSpan3(propertyName.getStart(), propertyName.getEnd());
13226
+ const read = ts56.isIdentifier(propertyName) ? new PropertyRead2(span, nameSpan, nameSpan, receiver, propertyName.text) : new KeyedRead(span, nameSpan, receiver, new LiteralPrimitive(span, nameSpan, propertyName.text));
13235
13227
  const { attrName, type } = inferBoundAttribute(nameNode.text);
13236
13228
  bindings.push(new TmplAstBoundAttribute(attrName, type, 0, read, null, createSourceSpan(decorator), createStaticExpressionSpan(nameNode), createSourceSpan(decorator), void 0));
13237
13229
  }
13238
13230
  function createNodeFromListenerDecorator(decorator, parser, listeners) {
13239
- if (!ts54.isCallExpression(decorator.expression) || decorator.expression.arguments.length === 0) {
13231
+ if (!ts56.isCallExpression(decorator.expression) || decorator.expression.arguments.length === 0) {
13240
13232
  return;
13241
13233
  }
13242
13234
  const args = decorator.expression.arguments;
13243
13235
  const method = decorator.parent;
13244
- if (!method || !ts54.isMethodDeclaration(method) || !isStaticName(method.name) || !ts54.isStringLiteralLike(args[0])) {
13236
+ if (!method || !ts56.isMethodDeclaration(method) || !isStaticName(method.name) || !ts56.isStringLiteralLike(args[0])) {
13245
13237
  return;
13246
13238
  }
13247
13239
  const span = new ParseSpan(-1, -1);
13248
13240
  const argNodes = [];
13249
13241
  const methodStart = method.getStart();
13250
- const methodReceiver = new ThisReceiver2(span, new AbsoluteSourceSpan2(methodStart, methodStart));
13251
- const nameSpan = new AbsoluteSourceSpan2(method.name.getStart(), method.name.getEnd());
13252
- const receiver = ts54.isIdentifier(method.name) ? new PropertyRead2(span, nameSpan, nameSpan, methodReceiver, method.name.text) : new KeyedRead(span, nameSpan, methodReceiver, new LiteralPrimitive(span, nameSpan, method.name.text));
13253
- if (args.length > 1 && ts54.isArrayLiteralExpression(args[1])) {
13242
+ const methodReceiver = new ThisReceiver2(span, new AbsoluteSourceSpan3(methodStart, methodStart));
13243
+ const nameSpan = new AbsoluteSourceSpan3(method.name.getStart(), method.name.getEnd());
13244
+ const receiver = ts56.isIdentifier(method.name) ? new PropertyRead2(span, nameSpan, nameSpan, methodReceiver, method.name.text) : new KeyedRead(span, nameSpan, methodReceiver, new LiteralPrimitive(span, nameSpan, method.name.text));
13245
+ if (args.length > 1 && ts56.isArrayLiteralExpression(args[1])) {
13254
13246
  for (const expr of args[1].elements) {
13255
- if (ts54.isStringLiteralLike(expr)) {
13247
+ if (ts56.isStringLiteralLike(expr)) {
13256
13248
  const span2 = createStaticExpressionSpan(expr);
13257
13249
  const ast = parser.parseBinding(expr.text, true, span2, span2.start.offset);
13258
13250
  fixupSpans(ast, expr);
13259
13251
  argNodes.push(ast);
13260
13252
  } else {
13261
- const expressionSpan = new AbsoluteSourceSpan2(expr.getStart(), expr.getEnd());
13253
+ const expressionSpan = new AbsoluteSourceSpan3(expr.getStart(), expr.getEnd());
13262
13254
  const anyRead = new PropertyRead2(span, expressionSpan, expressionSpan, new ImplicitReceiver2(span, expressionSpan), "$any");
13263
13255
  const anyCall = new Call(span, expressionSpan, anyRead, [new LiteralPrimitive(span, expressionSpan, 0)], expressionSpan);
13264
13256
  argNodes.push(anyCall);
@@ -13316,11 +13308,11 @@ function inferBoundAttribute(name) {
13316
13308
  return { attrName, type };
13317
13309
  }
13318
13310
  function isStaticName(node) {
13319
- return ts54.isIdentifier(node) || ts54.isStringLiteralLike(node);
13311
+ return ts56.isIdentifier(node) || ts56.isStringLiteralLike(node);
13320
13312
  }
13321
13313
  function createStaticExpressionSpan(node) {
13322
13314
  const span = createSourceSpan(node);
13323
- if (ts54.isStringLiteralLike(node)) {
13315
+ if (ts56.isStringLiteralLike(node)) {
13324
13316
  span.fullStart = span.fullStart.moveBy(1);
13325
13317
  span.start = span.start.moveBy(1);
13326
13318
  span.end = span.end.moveBy(-1);
@@ -13331,7 +13323,7 @@ function fixupSpans(ast, initializer) {
13331
13323
  const escapeIndex = initializer.getText().indexOf("\\", 1);
13332
13324
  if (escapeIndex > -1) {
13333
13325
  const newSpan = new ParseSpan(0, initializer.getWidth());
13334
- const newSourceSpan = new AbsoluteSourceSpan2(initializer.getStart(), initializer.getEnd());
13326
+ const newSourceSpan = new AbsoluteSourceSpan3(initializer.getStart(), initializer.getEnd());
13335
13327
  ast.visit(new ReplaceSpanVisitor(escapeIndex, newSpan, newSourceSpan));
13336
13328
  }
13337
13329
  }
@@ -13410,7 +13402,7 @@ function getSourceMapping(shimSf, position, resolver, isDiagnosticRequest) {
13410
13402
  }
13411
13403
  function isInHostBindingTcb(node) {
13412
13404
  let current = node;
13413
- while (current && !ts55.isFunctionDeclaration(current)) {
13405
+ while (current && !ts57.isFunctionDeclaration(current)) {
13414
13406
  if (isHostBindingsBlockGuard(current)) {
13415
13407
  return true;
13416
13408
  }
@@ -13420,14 +13412,14 @@ function isInHostBindingTcb(node) {
13420
13412
  }
13421
13413
  function findTypeCheckBlock(file, id, isDiagnosticRequest) {
13422
13414
  for (const stmt of file.statements) {
13423
- if (ts55.isFunctionDeclaration(stmt) && getTypeCheckId2(stmt, file, isDiagnosticRequest) === id) {
13415
+ if (ts57.isFunctionDeclaration(stmt) && getTypeCheckId2(stmt, file, isDiagnosticRequest) === id) {
13424
13416
  return stmt;
13425
13417
  }
13426
13418
  }
13427
- return findNodeInFile(file, (node) => ts55.isFunctionDeclaration(node) && getTypeCheckId2(node, file, isDiagnosticRequest) === id);
13419
+ return findNodeInFile(file, (node) => ts57.isFunctionDeclaration(node) && getTypeCheckId2(node, file, isDiagnosticRequest) === id);
13428
13420
  }
13429
13421
  function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
13430
- while (node !== void 0 && !ts55.isFunctionDeclaration(node)) {
13422
+ while (node !== void 0 && !ts57.isFunctionDeclaration(node)) {
13431
13423
  if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticsRequest) {
13432
13424
  return null;
13433
13425
  }
@@ -13444,7 +13436,7 @@ function findSourceLocation(node, sourceFile, isDiagnosticsRequest) {
13444
13436
  return null;
13445
13437
  }
13446
13438
  function getTypeCheckId2(node, sourceFile, isDiagnosticRequest) {
13447
- while (!ts55.isFunctionDeclaration(node)) {
13439
+ while (!ts57.isFunctionDeclaration(node)) {
13448
13440
  if (hasIgnoreForDiagnosticsMarker(node, sourceFile) && isDiagnosticRequest) {
13449
13441
  return null;
13450
13442
  }
@@ -13454,8 +13446,8 @@ function getTypeCheckId2(node, sourceFile, isDiagnosticRequest) {
13454
13446
  }
13455
13447
  }
13456
13448
  const start = node.getFullStart();
13457
- return ts55.forEachLeadingCommentRange(sourceFile.text, start, (pos, end, kind) => {
13458
- if (kind !== ts55.SyntaxKind.MultiLineCommentTrivia) {
13449
+ return ts57.forEachLeadingCommentRange(sourceFile.text, start, (pos, end, kind) => {
13450
+ if (kind !== ts57.SyntaxKind.MultiLineCommentTrivia) {
13459
13451
  return null;
13460
13452
  }
13461
13453
  const commentText = sourceFile.text.substring(pos + 2, end - 2);
@@ -13480,167 +13472,92 @@ function findNodeInFile(file, predicate) {
13480
13472
  if (predicate(node)) {
13481
13473
  return node;
13482
13474
  }
13483
- return ts55.forEachChild(node, visit2) ?? null;
13475
+ return ts57.forEachChild(node, visit2) ?? null;
13484
13476
  };
13485
- return ts55.forEachChild(file, visit2) ?? null;
13477
+ return ts57.forEachChild(file, visit2) ?? null;
13486
13478
  }
13487
13479
 
13488
13480
  // packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.js
13489
13481
  function generateTypeCtorDeclarationFn(env, meta, nodeTypeRef, typeParams) {
13490
- const rawTypeArgs = typeParams !== void 0 ? generateGenericArgs(typeParams) : void 0;
13491
- const rawType = ts56.factory.createTypeReferenceNode(nodeTypeRef, rawTypeArgs);
13492
- const initParam = constructTypeCtorParameter(env, meta, rawType);
13482
+ const typeArgs = generateGenericArgs(typeParams);
13483
+ const typeRef = ts58.isIdentifier(nodeTypeRef) ? nodeTypeRef.text : tempPrint(nodeTypeRef, nodeTypeRef.getSourceFile());
13484
+ const typeRefWithGenerics = `${typeRef}${typeArgs}`;
13485
+ const initParam = constructTypeCtorParameter(env, meta, nodeTypeRef.getSourceFile(), typeRef, typeRefWithGenerics);
13493
13486
  const typeParameters = typeParametersWithDefaultTypes(typeParams);
13487
+ let source;
13494
13488
  if (meta.body) {
13495
- const fnType = ts56.factory.createFunctionTypeNode(
13496
- /* typeParameters */
13497
- typeParameters,
13498
- /* parameters */
13499
- [initParam],
13500
- /* type */
13501
- rawType
13502
- );
13503
- const decl = ts56.factory.createVariableDeclaration(
13504
- /* name */
13505
- meta.fnName,
13506
- /* exclamationToken */
13507
- void 0,
13508
- /* type */
13509
- fnType,
13510
- /* body */
13511
- ts56.factory.createNonNullExpression(ts56.factory.createNull())
13512
- );
13513
- const declList = ts56.factory.createVariableDeclarationList([decl], ts56.NodeFlags.Const);
13514
- return ts56.factory.createVariableStatement(
13515
- /* modifiers */
13516
- void 0,
13517
- /* declarationList */
13518
- declList
13519
- );
13489
+ const fnType = `${typeParameters}(${initParam}) => ${typeRefWithGenerics}`;
13490
+ source = `const ${meta.fnName}: ${fnType} = null!`;
13520
13491
  } else {
13521
- return ts56.factory.createFunctionDeclaration(
13522
- /* modifiers */
13523
- [ts56.factory.createModifier(ts56.SyntaxKind.DeclareKeyword)],
13524
- /* asteriskToken */
13525
- void 0,
13526
- /* name */
13527
- meta.fnName,
13528
- /* typeParameters */
13529
- typeParameters,
13530
- /* parameters */
13531
- [initParam],
13532
- /* type */
13533
- rawType,
13534
- /* body */
13535
- void 0
13536
- );
13492
+ source = `declare function ${meta.fnName}${typeParameters}(${initParam}): ${typeRefWithGenerics}`;
13537
13493
  }
13494
+ return new TcbExpr(source);
13538
13495
  }
13539
13496
  function generateInlineTypeCtor(env, node, meta) {
13540
- const rawTypeArgs = node.typeParameters !== void 0 ? generateGenericArgs(node.typeParameters) : void 0;
13541
- const rawType = ts56.factory.createTypeReferenceNode(node.name, rawTypeArgs);
13542
- const initParam = constructTypeCtorParameter(env, meta, rawType);
13543
- let body = void 0;
13544
- if (meta.body) {
13545
- body = ts56.factory.createBlock([
13546
- ts56.factory.createReturnStatement(ts56.factory.createNonNullExpression(ts56.factory.createNull()))
13547
- ]);
13548
- }
13549
- return ts56.factory.createMethodDeclaration(
13550
- /* modifiers */
13551
- [ts56.factory.createModifier(ts56.SyntaxKind.StaticKeyword)],
13552
- /* asteriskToken */
13553
- void 0,
13554
- /* name */
13555
- meta.fnName,
13556
- /* questionToken */
13557
- void 0,
13558
- /* typeParameters */
13559
- typeParametersWithDefaultTypes(node.typeParameters),
13560
- /* parameters */
13561
- [initParam],
13562
- /* type */
13563
- rawType,
13564
- /* body */
13565
- body
13566
- );
13567
- }
13568
- function constructTypeCtorParameter(env, meta, rawType) {
13497
+ const typeRef = node.name.text;
13498
+ const typeRefWithGenerics = `${typeRef}${generateGenericArgs(node.typeParameters)}`;
13499
+ const initParam = constructTypeCtorParameter(env, meta, node.getSourceFile(), typeRef, typeRefWithGenerics);
13500
+ const body = `{ return null!; }`;
13501
+ const typeParams = typeParametersWithDefaultTypes(node.typeParameters);
13502
+ return `static ${meta.fnName}${typeParams}(${initParam}): ${typeRefWithGenerics} ${body}`;
13503
+ }
13504
+ function constructTypeCtorParameter(env, meta, sourceFile, typeRef, typeRefWithGenerics) {
13569
13505
  let initType = null;
13570
13506
  const plainKeys = [];
13571
13507
  const coercedKeys = [];
13572
13508
  const signalInputKeys = [];
13573
13509
  for (const { classPropertyName, transform, isSignal } of meta.fields.inputs) {
13574
13510
  if (isSignal) {
13575
- signalInputKeys.push(ts56.factory.createLiteralTypeNode(ts56.factory.createStringLiteral(classPropertyName)));
13511
+ signalInputKeys.push(quoteAndEscape(classPropertyName));
13576
13512
  } else if (!meta.coercedInputFields.has(classPropertyName)) {
13577
- plainKeys.push(ts56.factory.createLiteralTypeNode(ts56.factory.createStringLiteral(classPropertyName)));
13513
+ plainKeys.push(quoteAndEscape(classPropertyName));
13578
13514
  } else {
13579
- const coercionType = transform != null ? transform.type.node : tsCreateTypeQueryForCoercedInput(rawType.typeName, classPropertyName);
13580
- coercedKeys.push(ts56.factory.createPropertySignature(
13581
- /* modifiers */
13582
- void 0,
13583
- /* name */
13584
- classPropertyName,
13585
- /* questionToken */
13586
- void 0,
13587
- /* type */
13588
- coercionType
13589
- ));
13515
+ const coercionType = transform != null ? tempPrint(transform.type.node, sourceFile) : `typeof ${typeRef}.ngAcceptInputType_${classPropertyName}`;
13516
+ coercedKeys.push(`${classPropertyName}: ${coercionType}`);
13590
13517
  }
13591
13518
  }
13592
13519
  if (plainKeys.length > 0) {
13593
- const keyTypeUnion = ts56.factory.createUnionTypeNode(plainKeys);
13594
- initType = ts56.factory.createTypeReferenceNode("Pick", [rawType, keyTypeUnion]);
13520
+ initType = `Pick<${typeRefWithGenerics}, ${plainKeys.join(" | ")}>`;
13595
13521
  }
13596
13522
  if (coercedKeys.length > 0) {
13597
- const coercedLiteral = ts56.factory.createTypeLiteralNode(coercedKeys);
13598
- initType = initType !== null ? ts56.factory.createIntersectionTypeNode([initType, coercedLiteral]) : coercedLiteral;
13523
+ let coercedLiteral = "{\n";
13524
+ for (const key of coercedKeys) {
13525
+ coercedLiteral += `${key};
13526
+ `;
13527
+ }
13528
+ coercedLiteral += "}";
13529
+ initType = initType !== null ? `${initType} & ${coercedLiteral}` : coercedLiteral;
13599
13530
  }
13600
13531
  if (signalInputKeys.length > 0) {
13601
- const keyTypeUnion = ts56.factory.createUnionTypeNode(signalInputKeys);
13602
- const unwrapDirectiveSignalInputsExpr = env.referenceExternalType(R3Identifiers3.UnwrapDirectiveSignalInputs.moduleName, R3Identifiers3.UnwrapDirectiveSignalInputs.name, [
13603
- // TODO:
13604
- new ExpressionType2(new WrappedNodeExpr7(rawType)),
13605
- new ExpressionType2(new WrappedNodeExpr7(keyTypeUnion))
13606
- ]);
13607
- initType = initType !== null ? ts56.factory.createIntersectionTypeNode([initType, unwrapDirectiveSignalInputsExpr]) : unwrapDirectiveSignalInputsExpr;
13532
+ const keyTypeUnion = signalInputKeys.join(" | ");
13533
+ const unwrapRef = env.referenceExternalSymbol(R3Identifiers3.UnwrapDirectiveSignalInputs.moduleName, R3Identifiers3.UnwrapDirectiveSignalInputs.name);
13534
+ const unwrapExpr = `${unwrapRef.print()}<${typeRefWithGenerics}, ${keyTypeUnion}>`;
13535
+ initType = initType !== null ? `${initType} & ${unwrapExpr}` : unwrapExpr;
13608
13536
  }
13609
13537
  if (initType === null) {
13610
- initType = ts56.factory.createTypeLiteralNode([]);
13538
+ initType = "{}";
13611
13539
  }
13612
- return ts56.factory.createParameterDeclaration(
13613
- /* modifiers */
13614
- void 0,
13615
- /* dotDotDotToken */
13616
- void 0,
13617
- /* name */
13618
- "init",
13619
- /* questionToken */
13620
- void 0,
13621
- /* type */
13622
- initType,
13623
- /* initializer */
13624
- void 0
13625
- );
13540
+ return `init: ${initType}`;
13626
13541
  }
13627
- function generateGenericArgs(params) {
13628
- return params.map((param) => ts56.factory.createTypeReferenceNode(param.name, void 0));
13542
+ function generateGenericArgs(typeParameters) {
13543
+ if (typeParameters === void 0 || typeParameters.length === 0) {
13544
+ return "";
13545
+ }
13546
+ return `<${typeParameters.map((param) => param.name.text).join(", ")}>`;
13629
13547
  }
13630
13548
  function requiresInlineTypeCtor(node, host, env) {
13631
13549
  return !checkIfGenericTypeBoundsCanBeEmitted(node, host, env);
13632
13550
  }
13633
13551
  function typeParametersWithDefaultTypes(params) {
13634
- if (params === void 0) {
13635
- return void 0;
13552
+ if (params === void 0 || params.length === 0) {
13553
+ return "";
13636
13554
  }
13637
- return params.map((param) => {
13638
- if (param.default === void 0) {
13639
- return ts56.factory.updateTypeParameterDeclaration(param, param.modifiers, param.name, param.constraint, ts56.factory.createKeywordTypeNode(ts56.SyntaxKind.AnyKeyword));
13640
- } else {
13641
- return param;
13642
- }
13555
+ const paramStrings = params.map((param) => {
13556
+ const constraint = param.constraint ? ` extends ${tempPrint(param.constraint, param.getSourceFile())}` : "";
13557
+ const defaultValue = ` = ${param.default ? tempPrint(param.default, param.getSourceFile()) : "any"}`;
13558
+ return `${param.name.text}${constraint}${defaultValue}`;
13643
13559
  });
13560
+ return `<${paramStrings.join(", ")}>`;
13644
13561
  }
13645
13562
 
13646
13563
  // packages/compiler-cli/src/ngtsc/typecheck/src/environment.js
@@ -13668,17 +13585,17 @@ var Environment = class extends ReferenceEmitEnvironment {
13668
13585
  const dirRef = dir.ref;
13669
13586
  const node = dirRef.node;
13670
13587
  if (this.typeCtors.has(node)) {
13671
- return this.typeCtors.get(node);
13588
+ return new TcbExpr(this.typeCtors.get(node));
13672
13589
  }
13673
13590
  if (requiresInlineTypeCtor(node, this.reflector, this)) {
13674
13591
  const ref = this.reference(dirRef);
13675
- const typeCtorExpr = ts57.factory.createPropertyAccessExpression(ref, "ngTypeCtor");
13592
+ const typeCtorExpr = `${ref.print()}.ngTypeCtor`;
13676
13593
  this.typeCtors.set(node, typeCtorExpr);
13677
- return typeCtorExpr;
13594
+ return new TcbExpr(typeCtorExpr);
13678
13595
  } else {
13679
13596
  const fnName = `_ctor${this.nextIds.typeCtor++}`;
13680
13597
  const nodeTypeRef = this.referenceType(dirRef);
13681
- if (!ts57.isTypeReferenceNode(nodeTypeRef)) {
13598
+ if (!ts59.isTypeReferenceNode(nodeTypeRef)) {
13682
13599
  throw new Error(`Expected TypeReferenceNode from reference to ${dirRef.debugName}`);
13683
13600
  }
13684
13601
  const meta = {
@@ -13694,9 +13611,8 @@ var Environment = class extends ReferenceEmitEnvironment {
13694
13611
  const typeParams = this.emitTypeParameters(node);
13695
13612
  const typeCtor = generateTypeCtorDeclarationFn(this, meta, nodeTypeRef.typeName, typeParams);
13696
13613
  this.typeCtorStatements.push(typeCtor);
13697
- const fnId = ts57.factory.createIdentifier(fnName);
13698
- this.typeCtors.set(node, fnId);
13699
- return fnId;
13614
+ this.typeCtors.set(node, fnName);
13615
+ return new TcbExpr(fnName);
13700
13616
  }
13701
13617
  }
13702
13618
  /*
@@ -13704,13 +13620,13 @@ var Environment = class extends ReferenceEmitEnvironment {
13704
13620
  */
13705
13621
  pipeInst(ref) {
13706
13622
  if (this.pipeInsts.has(ref.node)) {
13707
- return this.pipeInsts.get(ref.node);
13623
+ return new TcbExpr(this.pipeInsts.get(ref.node));
13708
13624
  }
13709
13625
  const pipeType = this.referenceType(ref);
13710
- const pipeInstId = ts57.factory.createIdentifier(`_pipe${this.nextIds.pipeInst++}`);
13711
- this.pipeInstStatements.push(tsDeclareVariable(pipeInstId, pipeType));
13626
+ const pipeInstId = `_pipe${this.nextIds.pipeInst++}`;
13712
13627
  this.pipeInsts.set(ref.node, pipeInstId);
13713
- return pipeInstId;
13628
+ this.pipeInstStatements.push(declareVariable(new TcbExpr(pipeInstId), new TcbExpr(tempPrint(pipeType, this.contextFile))));
13629
+ return new TcbExpr(pipeInstId);
13714
13630
  }
13715
13631
  /**
13716
13632
  * Generate a `ts.Expression` that references the given node.
@@ -13720,7 +13636,8 @@ var Environment = class extends ReferenceEmitEnvironment {
13720
13636
  reference(ref) {
13721
13637
  const ngExpr = this.refEmitter.emit(ref, this.contextFile, ImportFlags.NoAliasing);
13722
13638
  assertSuccessfulReferenceEmit(ngExpr, this.contextFile, "class");
13723
- return translateExpression(this.contextFile, ngExpr.expression, this.importManager);
13639
+ const tsExpression = translateExpression(this.contextFile, ngExpr.expression, this.importManager);
13640
+ return new TcbExpr(tempPrint(tsExpression, this.contextFile));
13724
13641
  }
13725
13642
  emitTypeParameters(declaration) {
13726
13643
  const emitter = new TypeParameterEmitter(declaration.typeParameters, this.reflector);
@@ -13732,8 +13649,8 @@ var Environment = class extends ReferenceEmitEnvironment {
13732
13649
  };
13733
13650
 
13734
13651
  // packages/compiler-cli/src/ngtsc/typecheck/src/oob.js
13735
- import { AbsoluteSourceSpan as AbsoluteSourceSpan3, BindingType as BindingType2, ParseSourceSpan as ParseSourceSpan2, TmplAstBoundAttribute as TmplAstBoundAttribute2, TmplAstBoundEvent as TmplAstBoundEvent2, TmplAstComponent, TmplAstDirective, TmplAstElement } from "@angular/compiler";
13736
- import ts58 from "typescript";
13652
+ import { AbsoluteSourceSpan as AbsoluteSourceSpan4, BindingType as BindingType2, ParseSourceSpan as ParseSourceSpan2, TmplAstBoundAttribute as TmplAstBoundAttribute2, TmplAstBoundEvent as TmplAstBoundEvent2, TmplAstComponent, TmplAstDirective, TmplAstElement } from "@angular/compiler";
13653
+ import ts60 from "typescript";
13737
13654
  var OutOfBandDiagnosticRecorderImpl = class {
13738
13655
  resolver;
13739
13656
  _diagnostics = [];
@@ -13768,7 +13685,7 @@ var OutOfBandDiagnosticRecorderImpl = class {
13768
13685
  const mapping = this.resolver.getTemplateSourceMapping(id);
13769
13686
  const value = ref.value.trim();
13770
13687
  const errorMsg = `No directive found with exportAs '${value}'.`;
13771
- this._diagnostics.push(makeTemplateDiagnostic(id, mapping, ref.valueSpan || ref.sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REFERENCE_TARGET), errorMsg));
13688
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, ref.valueSpan || ref.sourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REFERENCE_TARGET), errorMsg));
13772
13689
  }
13773
13690
  missingPipe(id, ast, isStandalone) {
13774
13691
  if (this.recordedPipes.has(ast)) {
@@ -13791,7 +13708,7 @@ To fix this, import the "${suggestedClassName}" class from "${suggestedImport}"
13791
13708
  To fix this, import the "${suggestedClassName}" class from "${suggestedImport}" and add it to the "imports" array of the module declaring the component.`;
13792
13709
  }
13793
13710
  }
13794
- this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_PIPE), errorMsg));
13711
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_PIPE), errorMsg));
13795
13712
  this.recordedPipes.add(ast);
13796
13713
  }
13797
13714
  deferredPipeUsedEagerly(id, ast) {
@@ -13804,24 +13721,24 @@ To fix this, import the "${suggestedClassName}" class from "${suggestedImport}"
13804
13721
  if (sourceSpan === null) {
13805
13722
  throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${ast.name}'.`);
13806
13723
  }
13807
- this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFERRED_PIPE_USED_EAGERLY), errorMsg));
13724
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFERRED_PIPE_USED_EAGERLY), errorMsg));
13808
13725
  this.recordedPipes.add(ast);
13809
13726
  }
13810
13727
  deferredComponentUsedEagerly(id, element) {
13811
13728
  const mapping = this.resolver.getTemplateSourceMapping(id);
13812
13729
  const errorMsg = `Element '${element.name}' contains a component or a directive that was imported via \`@Component.deferredImports\`, but the element itself is located outside of a \`@defer\` block in a template. To fix this, either use the '${element.name}' element inside of a \`@defer\` block or import referenced component/directive dependency using the \`@Component.imports\` field.`;
13813
13730
  const { start, end } = element.startSourceSpan;
13814
- const absoluteSourceSpan = new AbsoluteSourceSpan3(start.offset, end.offset);
13731
+ const absoluteSourceSpan = new AbsoluteSourceSpan4(start.offset, end.offset);
13815
13732
  const sourceSpan = this.resolver.toTemplateParseSourceSpan(id, absoluteSourceSpan);
13816
13733
  if (sourceSpan === null) {
13817
13734
  throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${element.name}'.`);
13818
13735
  }
13819
- this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFERRED_DIRECTIVE_USED_EAGERLY), errorMsg));
13736
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, sourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFERRED_DIRECTIVE_USED_EAGERLY), errorMsg));
13820
13737
  }
13821
13738
  duplicateTemplateVar(id, variable, firstDecl) {
13822
13739
  const mapping = this.resolver.getTemplateSourceMapping(id);
13823
13740
  const errorMsg = `Cannot redeclare variable '${variable.name}' as it was previously declared elsewhere for the same template.`;
13824
- this._diagnostics.push(makeTemplateDiagnostic(id, mapping, variable.sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DUPLICATE_VARIABLE_DECLARATION), errorMsg, [
13741
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, variable.sourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DUPLICATE_VARIABLE_DECLARATION), errorMsg, [
13825
13742
  {
13826
13743
  text: `The variable '${firstDecl.name}' was first declared here.`,
13827
13744
  start: firstDecl.sourceSpan.start.offset,
@@ -13862,7 +13779,7 @@ To fix this, import the "${suggestedClassName}" class from "${suggestedImport}"
13862
13779
  const message = `This structural directive supports advanced type inference, but the current compiler configuration prevents its usage. The variable ${varIdentification} will have type 'any' as a result.
13863
13780
 
13864
13781
  Consider enabling the 'strictTemplates' option in your tsconfig.json for better type inference within this template.`;
13865
- this._diagnostics.push(makeTemplateDiagnostic(id, mapping, diagnosticVar.keySpan, ts58.DiagnosticCategory.Suggestion, ngErrorCode(ErrorCode.SUGGEST_SUBOPTIMAL_TYPE_INFERENCE), message));
13782
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, diagnosticVar.keySpan, ts60.DiagnosticCategory.Suggestion, ngErrorCode(ErrorCode.SUGGEST_SUBOPTIMAL_TYPE_INFERENCE), message));
13866
13783
  }
13867
13784
  splitTwoWayBinding(id, input, output, inputConsumer, outputConsumer) {
13868
13785
  const mapping = this.resolver.getTemplateSourceMapping(id);
@@ -13896,7 +13813,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
13896
13813
  sourceFile: outputConsumer.name.getSourceFile()
13897
13814
  });
13898
13815
  }
13899
- this._diagnostics.push(makeTemplateDiagnostic(id, mapping, input.keySpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SPLIT_TWO_WAY_BINDING), errorMsg, relatedMessages));
13816
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, input.keySpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SPLIT_TWO_WAY_BINDING), errorMsg, relatedMessages));
13900
13817
  }
13901
13818
  missingRequiredInputs(id, element, directiveName, isComponent, inputAliases) {
13902
13819
  const message = `Required input${inputAliases.length === 1 ? "" : "s"} ${inputAliases.map((n2) => `'${n2}'`).join(", ")} from ${isComponent ? "component" : "directive"} ${directiveName} must be specified.`;
@@ -13916,7 +13833,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
13916
13833
  const end = element.startSourceSpan.end.moveBy(start.offset + name.length - element.startSourceSpan.end.offset);
13917
13834
  span = new ParseSourceSpan2(start, end);
13918
13835
  }
13919
- this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), span, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REQUIRED_INPUTS), message));
13836
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), span, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REQUIRED_INPUTS), message));
13920
13837
  }
13921
13838
  illegalForLoopTrackAccess(id, block, access) {
13922
13839
  const sourceSpan = this.resolver.toTemplateParseSourceSpan(id, access.sourceSpan);
@@ -13925,7 +13842,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
13925
13842
  }
13926
13843
  const messageVars = [block.item, ...block.contextVariables.filter((v) => v.value === "$index")].map((v) => `'${v.name}'`).join(", ");
13927
13844
  const message = `Cannot access '${access.name}' inside of a track expression. Only ${messageVars} and properties on the containing component are available to this expression.`;
13928
- this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.ILLEGAL_FOR_LOOP_TRACK_ACCESS), message));
13845
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), sourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.ILLEGAL_FOR_LOOP_TRACK_ACCESS), message));
13929
13846
  }
13930
13847
  inaccessibleDeferredTriggerElement(id, trigger) {
13931
13848
  let message;
@@ -13936,7 +13853,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
13936
13853
  Check that an element with #${trigger.reference} exists in the same template and it's accessible from the @defer block.
13937
13854
  Deferred blocks can only access triggers in same view, a parent embedded view or the root view of the @placeholder block.`;
13938
13855
  }
13939
- this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), trigger.sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.INACCESSIBLE_DEFERRED_TRIGGER_ELEMENT), message));
13856
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), trigger.sourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.INACCESSIBLE_DEFERRED_TRIGGER_ELEMENT), message));
13940
13857
  }
13941
13858
  controlFlowPreventingContentProjection(id, category, projectionNode, componentName, slotSelector, controlFlowNode, preservesWhitespaces) {
13942
13859
  const blockName = controlFlowNode.nameSpan.toString().trim();
@@ -13958,43 +13875,43 @@ Deferred blocks can only access triggers in same view, a parent embedded view or
13958
13875
  if (sourceSpan === null) {
13959
13876
  throw new Error(`Assertion failure: no SourceLocation found for property write.`);
13960
13877
  }
13961
- this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.ILLEGAL_LET_WRITE), `Cannot assign to @let declaration '${target.name}'.`));
13878
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), sourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.ILLEGAL_LET_WRITE), `Cannot assign to @let declaration '${target.name}'.`));
13962
13879
  }
13963
13880
  letUsedBeforeDefinition(id, node, target) {
13964
13881
  const sourceSpan = this.resolver.toTemplateParseSourceSpan(id, node.sourceSpan);
13965
13882
  if (sourceSpan === null) {
13966
13883
  throw new Error(`Assertion failure: no SourceLocation found for property read.`);
13967
13884
  }
13968
- this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.LET_USED_BEFORE_DEFINITION), `Cannot read @let declaration '${target.name}' before it has been defined.`));
13885
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), sourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.LET_USED_BEFORE_DEFINITION), `Cannot read @let declaration '${target.name}' before it has been defined.`));
13969
13886
  }
13970
13887
  conflictingDeclaration(id, decl) {
13971
13888
  const mapping = this.resolver.getTemplateSourceMapping(id);
13972
13889
  const errorMsg = `Cannot declare @let called '${decl.name}' as there is another symbol in the template with the same name.`;
13973
- this._diagnostics.push(makeTemplateDiagnostic(id, mapping, decl.sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.CONFLICTING_LET_DECLARATION), errorMsg));
13890
+ this._diagnostics.push(makeTemplateDiagnostic(id, mapping, decl.sourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.CONFLICTING_LET_DECLARATION), errorMsg));
13974
13891
  }
13975
13892
  missingNamedTemplateDependency(id, node) {
13976
13893
  this._diagnostics.push(makeTemplateDiagnostic(
13977
13894
  id,
13978
13895
  this.resolver.getTemplateSourceMapping(id),
13979
13896
  node.startSourceSpan,
13980
- ts58.DiagnosticCategory.Error,
13897
+ ts60.DiagnosticCategory.Error,
13981
13898
  ngErrorCode(ErrorCode.MISSING_NAMED_TEMPLATE_DEPENDENCY),
13982
13899
  // Wording is meant to mimic the wording TS uses in their diagnostic for missing symbols.
13983
13900
  `Cannot find name "${node instanceof TmplAstDirective ? node.name : node.componentName}". Selectorless references are only supported to classes or non-type import statements.`
13984
13901
  ));
13985
13902
  }
13986
13903
  incorrectTemplateDependencyType(id, node) {
13987
- this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), node.startSourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.INCORRECT_NAMED_TEMPLATE_DEPENDENCY_TYPE), `Incorrect reference type. Type must be a standalone ${node instanceof TmplAstComponent ? "@Component" : "@Directive"}.`));
13904
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), node.startSourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.INCORRECT_NAMED_TEMPLATE_DEPENDENCY_TYPE), `Incorrect reference type. Type must be a standalone ${node instanceof TmplAstComponent ? "@Component" : "@Directive"}.`));
13988
13905
  }
13989
13906
  unclaimedDirectiveBinding(id, directive, node) {
13990
13907
  const errorMsg = `Directive ${directive.name} does not have an ${node instanceof TmplAstBoundEvent2 ? "output" : "input"} named "${node.name}". Bindings to directives must target existing inputs or outputs.`;
13991
- this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), node.keySpan || node.sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.UNCLAIMED_DIRECTIVE_BINDING), errorMsg));
13908
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), node.keySpan || node.sourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.UNCLAIMED_DIRECTIVE_BINDING), errorMsg));
13992
13909
  }
13993
13910
  deferImplicitTriggerMissingPlaceholder(id, trigger) {
13994
- this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), trigger.sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFER_IMPLICIT_TRIGGER_MISSING_PLACEHOLDER), "Trigger with no target can only be placed on an @defer that has a @placeholder block"));
13911
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), trigger.sourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFER_IMPLICIT_TRIGGER_MISSING_PLACEHOLDER), "Trigger with no target can only be placed on an @defer that has a @placeholder block"));
13995
13912
  }
13996
13913
  deferImplicitTriggerInvalidPlaceholder(id, trigger) {
13997
- this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), trigger.sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFER_IMPLICIT_TRIGGER_INVALID_PLACEHOLDER), "Trigger with no target can only be placed on an @defer that has a @placeholder block with exactly one root element node"));
13914
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), trigger.sourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFER_IMPLICIT_TRIGGER_INVALID_PLACEHOLDER), "Trigger with no target can only be placed on an @defer that has a @placeholder block with exactly one root element node"));
13998
13915
  }
13999
13916
  formFieldUnsupportedBinding(id, node) {
14000
13917
  let message;
@@ -14011,7 +13928,7 @@ Deferred blocks can only access triggers in same view, a parent embedded view or
14011
13928
  } else {
14012
13929
  message = `Setting the '${node.name}' attribute is not allowed on nodes using the '[formField]' directive`;
14013
13930
  }
14014
- this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), node.sourceSpan, ts58.DiagnosticCategory.Error, ngErrorCode(ErrorCode.FORM_FIELD_UNSUPPORTED_BINDING), message));
13931
+ this._diagnostics.push(makeTemplateDiagnostic(id, this.resolver.getTemplateSourceMapping(id), node.sourceSpan, ts60.DiagnosticCategory.Error, ngErrorCode(ErrorCode.FORM_FIELD_UNSUPPORTED_BINDING), message));
14015
13932
  }
14016
13933
  };
14017
13934
  function makeInlineDiagnostic(id, code, node, messageText, relatedInformation) {
@@ -14023,7 +13940,7 @@ function makeInlineDiagnostic(id, code, node, messageText, relatedInformation) {
14023
13940
  }
14024
13941
 
14025
13942
  // packages/compiler-cli/src/ngtsc/typecheck/src/shim.js
14026
- import ts59 from "typescript";
13943
+ import ts61 from "typescript";
14027
13944
  var TypeCheckShimGenerator = class {
14028
13945
  extensionPrefix = "ngtypecheck";
14029
13946
  shouldEmit = false;
@@ -14031,7 +13948,7 @@ var TypeCheckShimGenerator = class {
14031
13948
  if (priorShimSf !== null) {
14032
13949
  return priorShimSf;
14033
13950
  }
14034
- return ts59.createSourceFile(genFilePath, "export const USED_FOR_NG_TYPE_CHECKING = true;", ts59.ScriptTarget.Latest, true, ts59.ScriptKind.TS);
13951
+ return ts61.createSourceFile(genFilePath, "export const USED_FOR_NG_TYPE_CHECKING = true;", ts61.ScriptTarget.Latest, true, ts61.ScriptKind.TS);
14035
13952
  }
14036
13953
  static shimFor(fileName) {
14037
13954
  return absoluteFrom(fileName.replace(/\.tsx?$/, ".ngtypecheck.ts"));
@@ -14039,71 +13956,9 @@ var TypeCheckShimGenerator = class {
14039
13956
  };
14040
13957
 
14041
13958
  // packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.js
14042
- import ts82 from "typescript";
14043
-
14044
- // packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.js
14045
- import { AbsoluteSourceSpan as AbsoluteSourceSpan4 } from "@angular/compiler";
14046
- import ts60 from "typescript";
14047
- function wrapForDiagnostics(expr) {
14048
- return ts60.factory.createParenthesizedExpression(expr);
14049
- }
14050
- function wrapForTypeChecker(expr) {
14051
- return ts60.factory.createParenthesizedExpression(expr);
14052
- }
14053
- function addParseSpanInfo(node, span) {
14054
- let commentText;
14055
- if (span instanceof AbsoluteSourceSpan4) {
14056
- commentText = `${span.start},${span.end}`;
14057
- } else {
14058
- commentText = `${span.start.offset},${span.end.offset}`;
14059
- }
14060
- ts60.addSyntheticTrailingComment(
14061
- node,
14062
- ts60.SyntaxKind.MultiLineCommentTrivia,
14063
- commentText,
14064
- /* hasTrailingNewLine */
14065
- false
14066
- );
14067
- }
14068
- function addTypeCheckId(tcb, id) {
14069
- ts60.addSyntheticLeadingComment(tcb, ts60.SyntaxKind.MultiLineCommentTrivia, id, true);
14070
- }
14071
- function shouldReportDiagnostic(diagnostic) {
14072
- const { code } = diagnostic;
14073
- if (code === 6133) {
14074
- return false;
14075
- } else if (code === 6199) {
14076
- return false;
14077
- } else if (code === 2695) {
14078
- return false;
14079
- } else if (code === 7006) {
14080
- return false;
14081
- }
14082
- return true;
14083
- }
14084
- function translateDiagnostic(diagnostic, resolver) {
14085
- if (diagnostic.file === void 0 || diagnostic.start === void 0) {
14086
- return null;
14087
- }
14088
- const fullMapping = getSourceMapping(
14089
- diagnostic.file,
14090
- diagnostic.start,
14091
- resolver,
14092
- /*isDiagnosticsRequest*/
14093
- true
14094
- );
14095
- if (fullMapping === null) {
14096
- return null;
14097
- }
14098
- const { sourceLocation, sourceMapping: templateSourceMapping, span } = fullMapping;
14099
- return makeTemplateDiagnostic(sourceLocation.id, templateSourceMapping, span, diagnostic.category, diagnostic.code, diagnostic.messageText, void 0, diagnostic.reportsDeprecated !== void 0 ? {
14100
- reportsDeprecated: diagnostic.reportsDeprecated,
14101
- relatedMessages: diagnostic.relatedInformation
14102
- } : void 0);
14103
- }
13959
+ import ts66 from "typescript";
14104
13960
 
14105
13961
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/context.js
14106
- import ts61 from "typescript";
14107
13962
  var TcbGenericContextBehavior;
14108
13963
  (function(TcbGenericContextBehavior2) {
14109
13964
  TcbGenericContextBehavior2[TcbGenericContextBehavior2["UseEmitter"] = 0] = "UseEmitter";
@@ -14139,7 +13994,7 @@ var Context2 = class {
14139
13994
  * might change depending on the type of data being stored.
14140
13995
  */
14141
13996
  allocateId() {
14142
- return ts61.factory.createIdentifier(`_t${this.nextId++}`);
13997
+ return `_t${this.nextId++}`;
14143
13998
  }
14144
13999
  getPipeByName(name) {
14145
14000
  if (this.pipes === null || !this.pipes.has(name)) {
@@ -14151,10 +14006,8 @@ var Context2 = class {
14151
14006
 
14152
14007
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/scope.js
14153
14008
  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";
14154
- import ts81 from "typescript";
14155
14009
 
14156
14010
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/base.js
14157
- import ts62 from "typescript";
14158
14011
  var TcbOp = class {
14159
14012
  /**
14160
14013
  * Replacement value or operation used while this `TcbOp` is executing (i.e. to resolve circular
@@ -14165,70 +14018,25 @@ var TcbOp = class {
14165
14018
  * circular references.
14166
14019
  */
14167
14020
  circularFallback() {
14168
- return ts62.factory.createNonNullExpression(ts62.factory.createNull());
14021
+ return new TcbExpr("null!");
14169
14022
  }
14170
14023
  };
14171
14024
 
14172
14025
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/template.js
14173
14026
  import { TmplAstBoundAttribute as TmplAstBoundAttribute3, TmplAstTemplate } from "@angular/compiler";
14174
- import ts65 from "typescript";
14175
14027
 
14176
14028
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/expression.js
14177
14029
  import { Binary, BindingPipe, Call as Call3, ImplicitReceiver as ImplicitReceiver4, PropertyRead as PropertyRead4, R3Identifiers as R3Identifiers4, SafeCall as SafeCall2, SafePropertyRead as SafePropertyRead3, ThisReceiver as ThisReceiver4, TmplAstLetDeclaration as TmplAstLetDeclaration2 } from "@angular/compiler";
14178
- import ts64 from "typescript";
14179
14030
 
14180
14031
  // packages/compiler-cli/src/ngtsc/typecheck/src/expression.js
14181
14032
  import { ASTWithSource, Call as Call2, ImplicitReceiver as ImplicitReceiver3, PropertyRead as PropertyRead3, SafeKeyedRead, SafePropertyRead as SafePropertyRead2, ThisReceiver as ThisReceiver3 } from "@angular/compiler";
14182
- import ts63 from "typescript";
14183
- function getAnyExpression() {
14184
- return ts63.factory.createAsExpression(ts63.factory.createNumericLiteral("0"), ts63.factory.createKeywordTypeNode(ts63.SyntaxKind.AnyKeyword));
14185
- }
14186
- function astToTypescript(ast, maybeResolve, config) {
14187
- const translator = new AstTranslator(maybeResolve, config);
14033
+ function astToTcbExpr(ast, maybeResolve, config) {
14034
+ const translator = new TcbExprTranslator(maybeResolve, config);
14188
14035
  return translator.translate(ast);
14189
14036
  }
14190
- var AstTranslator = class {
14037
+ var TcbExprTranslator = class {
14191
14038
  maybeResolve;
14192
14039
  config;
14193
- UNDEFINED = ts63.factory.createIdentifier("undefined");
14194
- UNARY_OPS = /* @__PURE__ */ new Map([
14195
- ["+", ts63.SyntaxKind.PlusToken],
14196
- ["-", ts63.SyntaxKind.MinusToken]
14197
- ]);
14198
- BINARY_OPS = /* @__PURE__ */ new Map([
14199
- ["+", ts63.SyntaxKind.PlusToken],
14200
- ["-", ts63.SyntaxKind.MinusToken],
14201
- ["<", ts63.SyntaxKind.LessThanToken],
14202
- [">", ts63.SyntaxKind.GreaterThanToken],
14203
- ["<=", ts63.SyntaxKind.LessThanEqualsToken],
14204
- [">=", ts63.SyntaxKind.GreaterThanEqualsToken],
14205
- ["=", ts63.SyntaxKind.EqualsToken],
14206
- ["==", ts63.SyntaxKind.EqualsEqualsToken],
14207
- ["===", ts63.SyntaxKind.EqualsEqualsEqualsToken],
14208
- ["*", ts63.SyntaxKind.AsteriskToken],
14209
- ["**", ts63.SyntaxKind.AsteriskAsteriskToken],
14210
- ["/", ts63.SyntaxKind.SlashToken],
14211
- ["%", ts63.SyntaxKind.PercentToken],
14212
- ["!=", ts63.SyntaxKind.ExclamationEqualsToken],
14213
- ["!==", ts63.SyntaxKind.ExclamationEqualsEqualsToken],
14214
- ["||", ts63.SyntaxKind.BarBarToken],
14215
- ["&&", ts63.SyntaxKind.AmpersandAmpersandToken],
14216
- ["&", ts63.SyntaxKind.AmpersandToken],
14217
- ["|", ts63.SyntaxKind.BarToken],
14218
- ["??", ts63.SyntaxKind.QuestionQuestionToken],
14219
- ["=", ts63.SyntaxKind.EqualsToken],
14220
- ["+=", ts63.SyntaxKind.PlusEqualsToken],
14221
- ["-=", ts63.SyntaxKind.MinusEqualsToken],
14222
- ["*=", ts63.SyntaxKind.AsteriskEqualsToken],
14223
- ["/=", ts63.SyntaxKind.SlashEqualsToken],
14224
- ["%=", ts63.SyntaxKind.PercentEqualsToken],
14225
- ["**=", ts63.SyntaxKind.AsteriskAsteriskEqualsToken],
14226
- ["&&=", ts63.SyntaxKind.AmpersandAmpersandEqualsToken],
14227
- ["||=", ts63.SyntaxKind.BarBarEqualsToken],
14228
- ["??=", ts63.SyntaxKind.QuestionQuestionEqualsToken],
14229
- ["in", ts63.SyntaxKind.InKeyword],
14230
- ["instanceof", ts63.SyntaxKind.InstanceOfKeyword]
14231
- ]);
14232
14040
  constructor(maybeResolve, config) {
14233
14041
  this.maybeResolve = maybeResolve;
14234
14042
  this.config = config;
@@ -14245,37 +14053,31 @@ var AstTranslator = class {
14245
14053
  }
14246
14054
  visitUnary(ast) {
14247
14055
  const expr = this.translate(ast.expr);
14248
- const op = this.UNARY_OPS.get(ast.operator);
14249
- if (op === void 0) {
14250
- throw new Error(`Unsupported Unary.operator: ${ast.operator}`);
14251
- }
14252
- const node = wrapForDiagnostics(ts63.factory.createPrefixUnaryExpression(op, expr));
14253
- addParseSpanInfo(node, ast.sourceSpan);
14254
- return node;
14056
+ const node = new TcbExpr(`${ast.operator}${expr.print()}`);
14057
+ return node.wrapForTypeChecker().addParseSpanInfo(ast.sourceSpan);
14255
14058
  }
14256
14059
  visitBinary(ast) {
14257
- const lhs = wrapForDiagnostics(this.translate(ast.left));
14258
- const rhs = wrapForDiagnostics(this.translate(ast.right));
14259
- const op = this.BINARY_OPS.get(ast.operation);
14260
- if (op === void 0) {
14261
- throw new Error(`Unsupported Binary.operation: ${ast.operation}`);
14262
- }
14263
- const node = ts63.factory.createBinaryExpression(lhs, op, rhs);
14264
- addParseSpanInfo(node, ast.sourceSpan);
14060
+ const lhs = this.translate(ast.left);
14061
+ const rhs = this.translate(ast.right);
14062
+ lhs.wrapForTypeChecker();
14063
+ rhs.wrapForTypeChecker();
14064
+ const expression = `${lhs.print()} ${ast.operation} ${rhs.print()}`;
14065
+ const node = new TcbExpr(ast.operation === "??" || ast.operation === "**" ? `(${expression})` : expression);
14066
+ node.addParseSpanInfo(ast.sourceSpan);
14265
14067
  return node;
14266
14068
  }
14267
14069
  visitChain(ast) {
14268
- const elements = ast.expressions.map((expr) => this.translate(expr));
14269
- const node = wrapForDiagnostics(ts63.factory.createCommaListExpression(elements));
14270
- addParseSpanInfo(node, ast.sourceSpan);
14070
+ const elements = ast.expressions.map((expr) => this.translate(expr).print());
14071
+ const node = new TcbExpr(elements.join(", "));
14072
+ node.wrapForTypeChecker();
14073
+ node.addParseSpanInfo(ast.sourceSpan);
14271
14074
  return node;
14272
14075
  }
14273
14076
  visitConditional(ast) {
14274
14077
  const condExpr = this.translate(ast.condition);
14275
14078
  const trueExpr = this.translate(ast.trueExp);
14276
- const falseExpr = wrapForTypeChecker(this.translate(ast.falseExp));
14277
- const node = ts63.factory.createParenthesizedExpression(ts63.factory.createConditionalExpression(condExpr, void 0, trueExpr, void 0, falseExpr));
14278
- addParseSpanInfo(node, ast.sourceSpan);
14079
+ const falseExpr = this.translate(ast.falseExp).wrapForTypeChecker();
14080
+ const node = new TcbExpr(`(${condExpr.print()} ? ${trueExpr.print()} : ${falseExpr.print()})`).addParseSpanInfo(ast.sourceSpan);
14279
14081
  return node;
14280
14082
  }
14281
14083
  visitImplicitReceiver(ast) {
@@ -14285,141 +14087,136 @@ var AstTranslator = class {
14285
14087
  throw new Error("Method not implemented.");
14286
14088
  }
14287
14089
  visitRegularExpressionLiteral(ast, context) {
14288
- return wrapForTypeChecker(ts63.factory.createRegularExpressionLiteral(`/${ast.body}/${ast.flags ?? ""}`));
14090
+ const node = new TcbExpr(`/${ast.body}/${ast.flags ?? ""}`);
14091
+ node.wrapForTypeChecker();
14092
+ return node;
14289
14093
  }
14290
14094
  visitInterpolation(ast) {
14291
- return ast.expressions.reduce((lhs, ast2) => ts63.factory.createBinaryExpression(lhs, ts63.SyntaxKind.PlusToken, wrapForTypeChecker(this.translate(ast2))), ts63.factory.createStringLiteral(""));
14095
+ const exprs = ast.expressions.map((e) => {
14096
+ const node = this.translate(e);
14097
+ node.wrapForTypeChecker();
14098
+ return node.print();
14099
+ });
14100
+ return new TcbExpr(`"" + ${exprs.join(" + ")}`);
14292
14101
  }
14293
14102
  visitKeyedRead(ast) {
14294
- const receiver = wrapForDiagnostics(this.translate(ast.receiver));
14103
+ const receiver = this.translate(ast.receiver).wrapForTypeChecker();
14295
14104
  const key = this.translate(ast.key);
14296
- const node = ts63.factory.createElementAccessExpression(receiver, key);
14297
- addParseSpanInfo(node, ast.sourceSpan);
14298
- return node;
14105
+ return new TcbExpr(`${receiver.print()}[${key.print()}]`).addParseSpanInfo(ast.sourceSpan);
14299
14106
  }
14300
14107
  visitLiteralArray(ast) {
14301
14108
  const elements = ast.expressions.map((expr) => this.translate(expr));
14302
- const literal4 = ts63.factory.createArrayLiteralExpression(elements);
14303
- const node = this.config.strictLiteralTypes ? literal4 : tsCastToAny(literal4);
14304
- addParseSpanInfo(node, ast.sourceSpan);
14305
- return node;
14109
+ let literal4 = `[${elements.map((el) => el.print()).join(", ")}]`;
14110
+ if (!this.config.strictLiteralTypes) {
14111
+ literal4 = `(${literal4} as any)`;
14112
+ }
14113
+ return new TcbExpr(literal4).addParseSpanInfo(ast.sourceSpan);
14306
14114
  }
14307
14115
  visitLiteralMap(ast) {
14308
14116
  const properties = ast.keys.map((key, idx) => {
14309
14117
  const value = this.translate(ast.values[idx]);
14310
14118
  if (key.kind === "property") {
14311
- const keyNode = ts63.factory.createStringLiteral(key.key);
14312
- addParseSpanInfo(keyNode, key.sourceSpan);
14313
- return ts63.factory.createPropertyAssignment(keyNode, value);
14119
+ const keyNode = new TcbExpr(quoteAndEscape(key.key));
14120
+ keyNode.addParseSpanInfo(key.sourceSpan);
14121
+ return `${keyNode.print()}: ${value.print()}`;
14314
14122
  } else {
14315
- return ts63.factory.createSpreadAssignment(value);
14123
+ return `...${value.print()}`;
14316
14124
  }
14317
14125
  });
14318
- const literal4 = ts63.factory.createObjectLiteralExpression(properties, true);
14319
- const node = this.config.strictLiteralTypes ? literal4 : tsCastToAny(literal4);
14320
- addParseSpanInfo(node, ast.sourceSpan);
14321
- return node;
14126
+ let literal4 = `{ ${properties.join(", ")} }`;
14127
+ if (!this.config.strictLiteralTypes) {
14128
+ literal4 = `${literal4} as any`;
14129
+ }
14130
+ const expression = new TcbExpr(literal4).addParseSpanInfo(ast.sourceSpan);
14131
+ expression.wrapForTypeChecker();
14132
+ return expression;
14322
14133
  }
14323
14134
  visitLiteralPrimitive(ast) {
14324
14135
  let node;
14325
14136
  if (ast.value === void 0) {
14326
- node = ts63.factory.createIdentifier("undefined");
14137
+ node = new TcbExpr("undefined");
14327
14138
  } else if (ast.value === null) {
14328
- node = ts63.factory.createNull();
14139
+ node = new TcbExpr("null");
14329
14140
  } else if (typeof ast.value === "string") {
14330
- node = ts63.factory.createStringLiteral(ast.value);
14141
+ node = new TcbExpr(quoteAndEscape(ast.value));
14331
14142
  } else if (typeof ast.value === "number") {
14332
- node = tsNumericExpression2(ast.value);
14143
+ if (Number.isNaN(ast.value)) {
14144
+ node = new TcbExpr("NaN");
14145
+ } else if (!Number.isFinite(ast.value)) {
14146
+ node = new TcbExpr(ast.value > 0 ? "Infinity" : "-Infinity");
14147
+ } else {
14148
+ node = new TcbExpr(ast.value.toString());
14149
+ }
14333
14150
  } else if (typeof ast.value === "boolean") {
14334
- node = ast.value ? ts63.factory.createTrue() : ts63.factory.createFalse();
14151
+ node = new TcbExpr(ast.value + "");
14335
14152
  } else {
14336
14153
  throw Error(`Unsupported AST value of type ${typeof ast.value}`);
14337
14154
  }
14338
- addParseSpanInfo(node, ast.sourceSpan);
14155
+ node.addParseSpanInfo(ast.sourceSpan);
14339
14156
  return node;
14340
14157
  }
14341
14158
  visitNonNullAssert(ast) {
14342
- const expr = wrapForDiagnostics(this.translate(ast.expression));
14343
- const node = ts63.factory.createNonNullExpression(expr);
14344
- addParseSpanInfo(node, ast.sourceSpan);
14345
- return node;
14159
+ const expr = this.translate(ast.expression).wrapForTypeChecker();
14160
+ return new TcbExpr(`${expr.print()}!`).addParseSpanInfo(ast.sourceSpan);
14346
14161
  }
14347
14162
  visitPipe(ast) {
14348
14163
  throw new Error("Method not implemented.");
14349
14164
  }
14350
14165
  visitPrefixNot(ast) {
14351
- const expression = wrapForDiagnostics(this.translate(ast.expression));
14352
- const node = ts63.factory.createLogicalNot(expression);
14353
- addParseSpanInfo(node, ast.sourceSpan);
14354
- return node;
14166
+ const expression = this.translate(ast.expression).wrapForTypeChecker();
14167
+ return new TcbExpr(`!${expression.print()}`).addParseSpanInfo(ast.sourceSpan);
14355
14168
  }
14356
14169
  visitTypeofExpression(ast) {
14357
- const expression = wrapForDiagnostics(this.translate(ast.expression));
14358
- const node = ts63.factory.createTypeOfExpression(expression);
14359
- addParseSpanInfo(node, ast.sourceSpan);
14360
- return node;
14170
+ const expression = this.translate(ast.expression).wrapForTypeChecker();
14171
+ return new TcbExpr(`typeof ${expression.print()}`).addParseSpanInfo(ast.sourceSpan);
14361
14172
  }
14362
14173
  visitVoidExpression(ast) {
14363
- const expression = wrapForDiagnostics(this.translate(ast.expression));
14364
- const node = ts63.factory.createVoidExpression(expression);
14365
- addParseSpanInfo(node, ast.sourceSpan);
14366
- return node;
14174
+ const expression = this.translate(ast.expression).wrapForTypeChecker();
14175
+ return new TcbExpr(`void ${expression.print()}`).addParseSpanInfo(ast.sourceSpan);
14367
14176
  }
14368
14177
  visitPropertyRead(ast) {
14369
- const receiver = wrapForDiagnostics(this.translate(ast.receiver));
14370
- const name = ts63.factory.createPropertyAccessExpression(receiver, ast.name);
14371
- addParseSpanInfo(name, ast.nameSpan);
14372
- const node = wrapForDiagnostics(name);
14373
- addParseSpanInfo(node, ast.sourceSpan);
14374
- return node;
14178
+ const receiver = this.translate(ast.receiver).wrapForTypeChecker();
14179
+ return new TcbExpr(`${receiver.print()}.${ast.name}`).addParseSpanInfo(ast.nameSpan).wrapForTypeChecker().addParseSpanInfo(ast.sourceSpan);
14375
14180
  }
14376
14181
  visitSafePropertyRead(ast) {
14377
14182
  let node;
14378
- const receiver = wrapForDiagnostics(this.translate(ast.receiver));
14183
+ const receiver = this.translate(ast.receiver).wrapForTypeChecker();
14184
+ const name = new TcbExpr(ast.name).addParseSpanInfo(ast.nameSpan);
14379
14185
  if (this.config.strictSafeNavigationTypes) {
14380
- const expr = ts63.factory.createPropertyAccessExpression(ts63.factory.createNonNullExpression(receiver), ast.name);
14381
- addParseSpanInfo(expr, ast.nameSpan);
14382
- node = ts63.factory.createParenthesizedExpression(ts63.factory.createConditionalExpression(getAnyExpression(), void 0, expr, void 0, this.UNDEFINED));
14186
+ node = new TcbExpr(`(0 as any ? ${receiver.print()}!.${name.print()} : undefined)`);
14383
14187
  } else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
14384
- node = ts63.factory.createPropertyAccessExpression(tsCastToAny(receiver), ast.name);
14188
+ node = new TcbExpr(`(${receiver.print()} as any).${name.print()}`);
14385
14189
  } else {
14386
- const expr = ts63.factory.createPropertyAccessExpression(ts63.factory.createNonNullExpression(receiver), ast.name);
14387
- addParseSpanInfo(expr, ast.nameSpan);
14388
- node = tsCastToAny(expr);
14190
+ node = new TcbExpr(`(${receiver.print()}!.${name.print()} as any)`);
14389
14191
  }
14390
- addParseSpanInfo(node, ast.sourceSpan);
14391
- return node;
14192
+ return node.addParseSpanInfo(ast.sourceSpan);
14392
14193
  }
14393
14194
  visitSafeKeyedRead(ast) {
14394
- const receiver = wrapForDiagnostics(this.translate(ast.receiver));
14195
+ const receiver = this.translate(ast.receiver).wrapForTypeChecker();
14395
14196
  const key = this.translate(ast.key);
14396
14197
  let node;
14397
14198
  if (this.config.strictSafeNavigationTypes) {
14398
- const expr = ts63.factory.createElementAccessExpression(ts63.factory.createNonNullExpression(receiver), key);
14399
- addParseSpanInfo(expr, ast.sourceSpan);
14400
- node = ts63.factory.createParenthesizedExpression(ts63.factory.createConditionalExpression(getAnyExpression(), void 0, expr, void 0, this.UNDEFINED));
14199
+ const elementAccess = new TcbExpr(`${receiver.print()}![${key.print()}]`).addParseSpanInfo(ast.sourceSpan);
14200
+ node = new TcbExpr(`(0 as any ? ${elementAccess.print()} : undefined)`);
14401
14201
  } else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
14402
- node = ts63.factory.createElementAccessExpression(tsCastToAny(receiver), key);
14202
+ node = new TcbExpr(`(${receiver.print()} as any)[${key.print()}]`);
14403
14203
  } else {
14404
- const expr = ts63.factory.createElementAccessExpression(ts63.factory.createNonNullExpression(receiver), key);
14405
- addParseSpanInfo(expr, ast.sourceSpan);
14406
- node = tsCastToAny(expr);
14204
+ const elementAccess = new TcbExpr(`${receiver.print()}![${key.print()}]`).addParseSpanInfo(ast.sourceSpan);
14205
+ node = new TcbExpr(`(${elementAccess.print()} as any)`);
14407
14206
  }
14408
- addParseSpanInfo(node, ast.sourceSpan);
14409
- return node;
14207
+ return node.addParseSpanInfo(ast.sourceSpan);
14410
14208
  }
14411
14209
  visitCall(ast) {
14412
14210
  const args = ast.args.map((expr2) => this.translate(expr2));
14413
- let expr;
14414
14211
  const receiver = ast.receiver;
14212
+ let expr;
14415
14213
  if (receiver instanceof PropertyRead3) {
14416
14214
  const resolved = this.maybeResolve(receiver);
14417
14215
  if (resolved !== null) {
14418
14216
  expr = resolved;
14419
14217
  } else {
14420
- const propertyReceiver = wrapForDiagnostics(this.translate(receiver.receiver));
14421
- expr = ts63.factory.createPropertyAccessExpression(propertyReceiver, receiver.name);
14422
- addParseSpanInfo(expr, receiver.nameSpan);
14218
+ const propertyReceiver = this.translate(receiver.receiver).wrapForTypeChecker();
14219
+ expr = new TcbExpr(`${propertyReceiver.print()}.${receiver.name}`).addParseSpanInfo(receiver.nameSpan);
14423
14220
  }
14424
14221
  } else {
14425
14222
  expr = this.translate(receiver);
@@ -14428,87 +14225,84 @@ var AstTranslator = class {
14428
14225
  if (ast.receiver instanceof SafePropertyRead2 || ast.receiver instanceof SafeKeyedRead) {
14429
14226
  node = this.convertToSafeCall(ast, expr, args);
14430
14227
  } else {
14431
- node = ts63.factory.createCallExpression(expr, void 0, args);
14228
+ node = new TcbExpr(`${expr.print()}(${args.map((arg) => arg.print()).join(", ")})`);
14432
14229
  }
14433
- addParseSpanInfo(node, ast.sourceSpan);
14434
- return node;
14230
+ return node.addParseSpanInfo(ast.sourceSpan);
14435
14231
  }
14436
14232
  visitSafeCall(ast) {
14437
14233
  const args = ast.args.map((expr2) => this.translate(expr2));
14438
- const expr = wrapForDiagnostics(this.translate(ast.receiver));
14439
- const node = this.convertToSafeCall(ast, expr, args);
14440
- addParseSpanInfo(node, ast.sourceSpan);
14441
- return node;
14234
+ const expr = this.translate(ast.receiver).wrapForTypeChecker();
14235
+ return this.convertToSafeCall(ast, expr, args).addParseSpanInfo(ast.sourceSpan);
14442
14236
  }
14443
14237
  visitTemplateLiteral(ast) {
14444
14238
  const length = ast.elements.length;
14445
14239
  const head = ast.elements[0];
14446
14240
  let result;
14447
14241
  if (length === 1) {
14448
- result = ts63.factory.createNoSubstitutionTemplateLiteral(head.text);
14242
+ result = `\`${head.text}\``;
14449
14243
  } else {
14450
- const spans = [];
14244
+ let parts = [`\`${head.text}`];
14451
14245
  const tailIndex = length - 1;
14452
14246
  for (let i = 1; i < tailIndex; i++) {
14453
- const middle = ts63.factory.createTemplateMiddle(ast.elements[i].text);
14454
- spans.push(ts63.factory.createTemplateSpan(this.translate(ast.expressions[i - 1]), middle));
14247
+ const expr = this.translate(ast.expressions[i - 1]);
14248
+ parts.push(`\${${expr.print()}}${ast.elements[i].text}`);
14455
14249
  }
14456
14250
  const resolvedExpression = this.translate(ast.expressions[tailIndex - 1]);
14457
- const templateTail = ts63.factory.createTemplateTail(ast.elements[tailIndex].text);
14458
- spans.push(ts63.factory.createTemplateSpan(resolvedExpression, templateTail));
14459
- result = ts63.factory.createTemplateExpression(ts63.factory.createTemplateHead(head.text), spans);
14251
+ parts.push(`\${${resolvedExpression.print()}}${ast.elements[tailIndex].text}\``);
14252
+ result = parts.join("");
14460
14253
  }
14461
- return result;
14254
+ return new TcbExpr(result);
14462
14255
  }
14463
- visitTemplateLiteralElement(ast, context) {
14256
+ visitTemplateLiteralElement() {
14464
14257
  throw new Error("Method not implemented");
14465
14258
  }
14466
14259
  visitTaggedTemplateLiteral(ast) {
14467
- return ts63.factory.createTaggedTemplateExpression(this.translate(ast.tag), void 0, this.visitTemplateLiteral(ast.template));
14260
+ const tag = this.translate(ast.tag);
14261
+ const template = this.visitTemplateLiteral(ast.template);
14262
+ return new TcbExpr(`${tag.print()}${template.print()}`);
14468
14263
  }
14469
14264
  visitParenthesizedExpression(ast) {
14470
- return ts63.factory.createParenthesizedExpression(this.translate(ast.expression));
14265
+ const expr = this.translate(ast.expression);
14266
+ return new TcbExpr(`(${expr.print()})`);
14471
14267
  }
14472
14268
  visitSpreadElement(ast) {
14473
- const expression = wrapForDiagnostics(this.translate(ast.expression));
14474
- const node = ts63.factory.createSpreadElement(expression);
14475
- addParseSpanInfo(node, ast.sourceSpan);
14269
+ const expression = this.translate(ast.expression);
14270
+ expression.wrapForTypeChecker();
14271
+ const node = new TcbExpr(`...${expression.print()}`);
14272
+ node.addParseSpanInfo(ast.sourceSpan);
14476
14273
  return node;
14477
14274
  }
14478
- visitEmptyExpr(ast, context) {
14479
- const node = ts63.factory.createIdentifier("undefined");
14480
- addParseSpanInfo(node, ast.sourceSpan);
14275
+ visitEmptyExpr(ast) {
14276
+ const node = new TcbExpr("undefined");
14277
+ node.addParseSpanInfo(ast.sourceSpan);
14481
14278
  return node;
14482
14279
  }
14483
14280
  visitArrowFunction(ast) {
14484
- const params = ast.parameters.map((param) => {
14485
- const paramNode = ts63.factory.createParameterDeclaration(void 0, void 0, param.name);
14486
- markIgnoreDiagnostics(paramNode);
14487
- return paramNode;
14488
- });
14489
- const body = astToTypescript(ast.body, (innerAst) => {
14281
+ const params = ast.parameters.map((param) => new TcbExpr(param.name).markIgnoreDiagnostics().print()).join(", ");
14282
+ const body = astToTcbExpr(ast.body, (innerAst) => {
14490
14283
  if (!(innerAst instanceof PropertyRead3) || innerAst.receiver instanceof ThisReceiver3 || !(innerAst.receiver instanceof ImplicitReceiver3)) {
14491
14284
  return this.maybeResolve(innerAst);
14492
14285
  }
14493
14286
  const correspondingParam = ast.parameters.find((arg) => arg.name === innerAst.name);
14494
14287
  if (correspondingParam) {
14495
- const node = ts63.factory.createIdentifier(innerAst.name);
14496
- addParseSpanInfo(node, innerAst.sourceSpan);
14288
+ const node = new TcbExpr(innerAst.name);
14289
+ node.addParseSpanInfo(innerAst.sourceSpan);
14497
14290
  return node;
14498
14291
  }
14499
14292
  return this.maybeResolve(innerAst);
14500
14293
  }, this.config);
14501
- return ts63.factory.createArrowFunction(void 0, void 0, params, void 0, void 0, body);
14294
+ return new TcbExpr(`${ast.parameters.length === 1 ? params : `(${params})`} => ${body.print()}`);
14502
14295
  }
14503
- convertToSafeCall(ast, expr, args) {
14296
+ convertToSafeCall(ast, exprNode, argNodes) {
14297
+ const expr = exprNode.print();
14298
+ const args = argNodes.map((node) => node.print()).join(", ");
14504
14299
  if (this.config.strictSafeNavigationTypes) {
14505
- const call = ts63.factory.createCallExpression(ts63.factory.createNonNullExpression(expr), void 0, args);
14506
- return ts63.factory.createParenthesizedExpression(ts63.factory.createConditionalExpression(getAnyExpression(), void 0, call, void 0, this.UNDEFINED));
14300
+ return new TcbExpr(`(0 as any ? ${expr}!(${args}) : undefined)`);
14507
14301
  }
14508
14302
  if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
14509
- return ts63.factory.createCallExpression(tsCastToAny(expr), void 0, args);
14303
+ return new TcbExpr(`(${expr} as any)(${args})`);
14510
14304
  }
14511
- return tsCastToAny(ts63.factory.createCallExpression(ts63.factory.createNonNullExpression(expr), void 0, args));
14305
+ return new TcbExpr(`(${expr}!(${args}) as any)`);
14512
14306
  }
14513
14307
  };
14514
14308
  var VeSafeLhsInferenceBugDetector = class _VeSafeLhsInferenceBugDetector {
@@ -14610,7 +14404,7 @@ function tcbExpression(ast, tcb, scope) {
14610
14404
  }
14611
14405
  function unwrapWritableSignal(expression, tcb) {
14612
14406
  const unwrapRef = tcb.env.referenceExternalSymbol(R3Identifiers4.unwrapWritableSignal.moduleName, R3Identifiers4.unwrapWritableSignal.name);
14613
- return ts64.factory.createCallExpression(unwrapRef, void 0, [expression]);
14407
+ return new TcbExpr(`${unwrapRef.print()}(${expression.print()})`);
14614
14408
  }
14615
14409
  var TcbExpressionOp = class extends TcbOp {
14616
14410
  tcb;
@@ -14627,7 +14421,7 @@ var TcbExpressionOp = class extends TcbOp {
14627
14421
  }
14628
14422
  execute() {
14629
14423
  const expr = tcbExpression(this.expression, this.tcb, this.scope);
14630
- this.scope.addStatement(ts64.factory.createExpressionStatement(expr));
14424
+ this.scope.addStatement(expr);
14631
14425
  return null;
14632
14426
  }
14633
14427
  };
@@ -14646,7 +14440,7 @@ var TcbConditionOp = class extends TcbOp {
14646
14440
  }
14647
14441
  execute() {
14648
14442
  const expr = tcbExpression(this.expression, this.tcb, this.scope);
14649
- this.scope.addStatement(ts64.factory.createIfStatement(expr, ts64.factory.createBlock([])));
14443
+ this.scope.addStatement(new TcbExpr(`if (${expr.print()}) {}`));
14650
14444
  return null;
14651
14445
  }
14652
14446
  };
@@ -14658,7 +14452,7 @@ var TcbExpressionTranslator = class {
14658
14452
  this.scope = scope;
14659
14453
  }
14660
14454
  translate(ast) {
14661
- return astToTypescript(ast, (ast2) => this.resolve(ast2), this.tcb.env.config);
14455
+ return astToTcbExpr(ast, (ast2) => this.resolve(ast2), this.tcb.env.config);
14662
14456
  }
14663
14457
  /**
14664
14458
  * Resolve an `AST` expression within the given scope.
@@ -14673,7 +14467,7 @@ var TcbExpressionTranslator = class {
14673
14467
  if (target instanceof TmplAstLetDeclaration2 && !this.isValidLetDeclarationAccess(target, ast)) {
14674
14468
  this.tcb.oobRecorder.letUsedBeforeDefinition(this.tcb.id, ast, target);
14675
14469
  if (targetExpression !== null) {
14676
- return ts64.factory.createAsExpression(targetExpression, ts64.factory.createKeywordTypeNode(ts64.SyntaxKind.AnyKeyword));
14470
+ return new TcbExpr(`${targetExpression.print()} as any`);
14677
14471
  }
14678
14472
  }
14679
14473
  return targetExpression;
@@ -14685,62 +14479,51 @@ var TcbExpressionTranslator = class {
14685
14479
  }
14686
14480
  const targetExpression = this.getTargetNodeExpression(target, read);
14687
14481
  const expr = this.translate(ast.right);
14688
- const result = ts64.factory.createParenthesizedExpression(ts64.factory.createBinaryExpression(targetExpression, ts64.SyntaxKind.EqualsToken, expr));
14689
- addParseSpanInfo(result, read.sourceSpan);
14482
+ const result = new TcbExpr(`(${targetExpression.print()} = ${expr.print()})`);
14483
+ result.addParseSpanInfo(read.sourceSpan);
14690
14484
  if (target instanceof TmplAstLetDeclaration2) {
14691
- markIgnoreDiagnostics(result);
14485
+ result.markIgnoreDiagnostics();
14692
14486
  this.tcb.oobRecorder.illegalWriteToLetDeclaration(this.tcb.id, read, target);
14693
14487
  }
14694
14488
  return result;
14695
14489
  } else if (ast instanceof ImplicitReceiver4 || ast instanceof ThisReceiver4) {
14696
- return ts64.factory.createThis();
14490
+ return new TcbExpr("this");
14697
14491
  } else if (ast instanceof BindingPipe) {
14698
14492
  const expr = this.translate(ast.exp);
14699
14493
  const pipeMeta = this.tcb.getPipeByName(ast.name);
14700
14494
  let pipe;
14701
14495
  if (pipeMeta === null) {
14702
14496
  this.tcb.oobRecorder.missingPipe(this.tcb.id, ast, this.tcb.hostIsStandalone);
14703
- pipe = getAnyExpression();
14497
+ pipe = new TcbExpr("(0 as any)");
14704
14498
  } else if (pipeMeta.isExplicitlyDeferred && this.tcb.boundTarget.getEagerlyUsedPipes().includes(ast.name)) {
14705
14499
  this.tcb.oobRecorder.deferredPipeUsedEagerly(this.tcb.id, ast);
14706
- pipe = getAnyExpression();
14500
+ pipe = new TcbExpr("(0 as any)");
14707
14501
  } else {
14708
14502
  pipe = this.tcb.env.pipeInst(pipeMeta.ref);
14709
14503
  }
14710
- const args = ast.args.map((arg) => this.translate(arg));
14711
- let methodAccess = ts64.factory.createPropertyAccessExpression(pipe, "transform");
14712
- addParseSpanInfo(methodAccess, ast.nameSpan);
14504
+ const args = ast.args.map((arg) => this.translate(arg).print());
14505
+ let methodAccess = new TcbExpr(`${pipe.print()}.transform`).addParseSpanInfo(ast.nameSpan);
14713
14506
  if (!this.tcb.env.config.checkTypeOfPipes) {
14714
- methodAccess = ts64.factory.createAsExpression(methodAccess, ts64.factory.createKeywordTypeNode(ts64.SyntaxKind.AnyKeyword));
14507
+ methodAccess = new TcbExpr(`(${methodAccess.print()} as any)`);
14715
14508
  }
14716
- const result = ts64.factory.createCallExpression(
14717
- /* expression */
14718
- methodAccess,
14719
- /* typeArguments */
14720
- void 0,
14721
- /* argumentsArray */
14722
- [expr, ...args]
14723
- );
14724
- addParseSpanInfo(result, ast.sourceSpan);
14725
- return result;
14509
+ const result = new TcbExpr(`${methodAccess.print()}(${[expr.print(), ...args].join(", ")})`);
14510
+ return result.addParseSpanInfo(ast.sourceSpan);
14726
14511
  } else if ((ast instanceof Call3 || ast instanceof SafeCall2) && (ast.receiver instanceof PropertyRead4 || ast.receiver instanceof SafePropertyRead3)) {
14727
14512
  if (ast.receiver.receiver instanceof ImplicitReceiver4 && ast.receiver.name === "$any" && ast.args.length === 1) {
14728
14513
  const expr = this.translate(ast.args[0]);
14729
- const exprAsAny = ts64.factory.createAsExpression(expr, ts64.factory.createKeywordTypeNode(ts64.SyntaxKind.AnyKeyword));
14730
- const result = ts64.factory.createParenthesizedExpression(exprAsAny);
14731
- addParseSpanInfo(result, ast.sourceSpan);
14514
+ const result = new TcbExpr(`(${expr.print()} as any)`);
14515
+ result.addParseSpanInfo(ast.sourceSpan);
14732
14516
  return result;
14733
14517
  }
14734
14518
  const target = this.tcb.boundTarget.getExpressionTarget(ast);
14735
14519
  if (target === null) {
14736
14520
  return null;
14737
14521
  }
14738
- const receiver = this.getTargetNodeExpression(target, ast);
14739
- const method = wrapForDiagnostics(receiver);
14740
- addParseSpanInfo(method, ast.receiver.nameSpan);
14741
- const args = ast.args.map((arg) => this.translate(arg));
14742
- const node = ts64.factory.createCallExpression(method, void 0, args);
14743
- addParseSpanInfo(node, ast.sourceSpan);
14522
+ const method = this.getTargetNodeExpression(target, ast);
14523
+ method.addParseSpanInfo(ast.receiver.nameSpan).wrapForTypeChecker();
14524
+ const args = ast.args.map((arg) => this.translate(arg).print());
14525
+ const node = new TcbExpr(`${method.print()}(${args.join(", ")})`);
14526
+ node.addParseSpanInfo(ast.sourceSpan);
14744
14527
  return node;
14745
14528
  } else {
14746
14529
  return null;
@@ -14748,7 +14531,7 @@ var TcbExpressionTranslator = class {
14748
14531
  }
14749
14532
  getTargetNodeExpression(targetNode, expressionNode) {
14750
14533
  const expr = this.scope.resolve(targetNode);
14751
- addParseSpanInfo(expr, expressionNode.sourceSpan);
14534
+ expr.addParseSpanInfo(expressionNode.sourceSpan);
14752
14535
  return expr;
14753
14536
  }
14754
14537
  isValidLetDeclarationAccess(target, ast) {
@@ -14771,9 +14554,8 @@ var TcbTemplateContextOp = class extends TcbOp {
14771
14554
  // The declaration of the context variable is only needed when the context is actually referenced.
14772
14555
  optional = true;
14773
14556
  execute() {
14774
- const ctx = this.tcb.allocateId();
14775
- const type = ts65.factory.createKeywordTypeNode(ts65.SyntaxKind.AnyKeyword);
14776
- this.scope.addStatement(tsDeclareVariable(ctx, type));
14557
+ const ctx = new TcbExpr(this.tcb.allocateId());
14558
+ this.scope.addStatement(declareVariable(ctx, new TcbExpr("any")));
14777
14559
  return ctx;
14778
14560
  }
14779
14561
  };
@@ -14798,23 +14580,19 @@ var TcbTemplateBodyOp = class extends TcbOp {
14798
14580
  this.addDirectiveGuards(directiveGuards, directive, this.tcb.boundTarget.getDirectivesOfNode(directive));
14799
14581
  }
14800
14582
  if (directiveGuards.length > 0) {
14801
- guard = directiveGuards.reduce((expr, dirGuard) => ts65.factory.createBinaryExpression(expr, ts65.SyntaxKind.AmpersandAmpersandToken, dirGuard), directiveGuards.pop());
14583
+ guard = directiveGuards.reduce((expr, dirGuard) => new TcbExpr(`${expr.print()} && ${dirGuard.print()}`), directiveGuards.pop());
14802
14584
  }
14803
14585
  const tmplScope = this.scope.createChildScope(this.scope, this.template, this.template.children, guard);
14804
14586
  const statements = tmplScope.render();
14805
14587
  if (statements.length === 0) {
14806
14588
  return null;
14807
14589
  }
14808
- let tmplBlock = ts65.factory.createBlock(statements);
14590
+ let tmplBlock = `{
14591
+ ${getStatementsBlock(statements)}}`;
14809
14592
  if (guard !== null) {
14810
- tmplBlock = ts65.factory.createIfStatement(
14811
- /* expression */
14812
- guard,
14813
- /* thenStatement */
14814
- tmplBlock
14815
- );
14593
+ tmplBlock = `if (${guard.print()}) ${tmplBlock}`;
14816
14594
  }
14817
- this.scope.addStatement(tmplBlock);
14595
+ this.scope.addStatement(new TcbExpr(tmplBlock));
14818
14596
  return null;
14819
14597
  }
14820
14598
  addDirectiveGuards(guards, hostNode, directives) {
@@ -14831,15 +14609,12 @@ var TcbTemplateBodyOp = class extends TcbOp {
14831
14609
  }) : void 0);
14832
14610
  if (boundInput !== void 0) {
14833
14611
  const expr = tcbExpression(boundInput.value, this.tcb, this.scope);
14834
- markIgnoreDiagnostics(expr);
14612
+ expr.markIgnoreDiagnostics();
14835
14613
  if (guard.type === "binding") {
14836
14614
  guards.push(expr);
14837
14615
  } else {
14838
- const guardInvoke = tsCallMethod(dirId, `ngTemplateGuard_${guard.inputName}`, [
14839
- dirInstId,
14840
- expr
14841
- ]);
14842
- addParseSpanInfo(guardInvoke, boundInput.value.sourceSpan);
14616
+ const guardInvoke = new TcbExpr(`${dirId.print()}.ngTemplateGuard_${guard.inputName}(${dirInstId.print()}, ${expr.print()})`);
14617
+ guardInvoke.addParseSpanInfo(boundInput.value.sourceSpan);
14843
14618
  guards.push(guardInvoke);
14844
14619
  }
14845
14620
  }
@@ -14847,9 +14622,9 @@ var TcbTemplateBodyOp = class extends TcbOp {
14847
14622
  if (dir.hasNgTemplateContextGuard) {
14848
14623
  if (this.tcb.env.config.applyTemplateContextGuards) {
14849
14624
  const ctx = this.scope.resolve(hostNode);
14850
- const guardInvoke = tsCallMethod(dirId, "ngTemplateContextGuard", [dirInstId, ctx]);
14851
- markIgnoreDiagnostics(guardInvoke);
14852
- addParseSpanInfo(guardInvoke, hostNode.sourceSpan);
14625
+ const guardInvoke = new TcbExpr(`${dirId.print()}.ngTemplateContextGuard(${dirInstId.print()}, ${ctx.print()})`);
14626
+ guardInvoke.markIgnoreDiagnostics();
14627
+ guardInvoke.addParseSpanInfo(hostNode.sourceSpan);
14853
14628
  guards.push(guardInvoke);
14854
14629
  } else if (isTemplate && hostNode.variables.length > 0 && this.tcb.env.config.suggestionsForSuboptimalTypeInference) {
14855
14630
  this.tcb.oobRecorder.suboptimalTypeInference(this.tcb.id, hostNode.variables);
@@ -14875,15 +14650,18 @@ var TcbElementOp = class extends TcbOp {
14875
14650
  }
14876
14651
  execute() {
14877
14652
  const id = this.tcb.allocateId();
14878
- const initializer = tsCreateElement(this.element.name);
14879
- addParseSpanInfo(initializer, this.element.startSourceSpan || this.element.sourceSpan);
14880
- this.scope.addStatement(tsCreateVariable(id, initializer));
14881
- return id;
14653
+ const idNode = new TcbExpr(id);
14654
+ idNode.addParseSpanInfo(this.element.startSourceSpan || this.element.sourceSpan);
14655
+ const initializer = new TcbExpr(`document.createElement("${this.element.name}")`);
14656
+ initializer.addParseSpanInfo(this.element.startSourceSpan || this.element.sourceSpan);
14657
+ const stmt = new TcbExpr(`var ${idNode.print()} = ${initializer.print()}`);
14658
+ stmt.addParseSpanInfo(this.element.startSourceSpan || this.element.sourceSpan);
14659
+ this.scope.addStatement(stmt);
14660
+ return idNode;
14882
14661
  }
14883
14662
  };
14884
14663
 
14885
14664
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/variables.js
14886
- import ts66 from "typescript";
14887
14665
  var TcbBlockImplicitVariableOp = class extends TcbOp {
14888
14666
  tcb;
14889
14667
  scope;
@@ -14898,10 +14676,10 @@ var TcbBlockImplicitVariableOp = class extends TcbOp {
14898
14676
  }
14899
14677
  optional = true;
14900
14678
  execute() {
14901
- const id = this.tcb.allocateId();
14902
- addParseSpanInfo(id, this.variable.keySpan);
14903
- const variable = tsDeclareVariable(id, this.type);
14904
- addParseSpanInfo(variable.declarationList.declarations[0], this.variable.sourceSpan);
14679
+ const id = new TcbExpr(this.tcb.allocateId());
14680
+ id.addParseSpanInfo(this.variable.keySpan);
14681
+ const variable = declareVariable(id, this.type);
14682
+ variable.addParseSpanInfo(this.variable.sourceSpan);
14905
14683
  this.scope.addStatement(variable);
14906
14684
  return id;
14907
14685
  }
@@ -14923,22 +14701,15 @@ var TcbTemplateVariableOp = class extends TcbOp {
14923
14701
  }
14924
14702
  execute() {
14925
14703
  const ctx = this.scope.resolve(this.template);
14926
- const id = this.tcb.allocateId();
14927
- const initializer = ts66.factory.createPropertyAccessExpression(
14928
- /* expression */
14929
- ctx,
14930
- /* name */
14931
- this.variable.value || "$implicit"
14932
- );
14933
- addParseSpanInfo(id, this.variable.keySpan);
14934
- let variable;
14704
+ const id = new TcbExpr(this.tcb.allocateId());
14705
+ const initializer = new TcbExpr(`${ctx.print()}.${this.variable.value || "$implicit"}`);
14706
+ id.addParseSpanInfo(this.variable.keySpan);
14935
14707
  if (this.variable.valueSpan !== void 0) {
14936
- addParseSpanInfo(initializer, this.variable.valueSpan);
14937
- variable = tsCreateVariable(id, wrapForTypeChecker(initializer));
14708
+ initializer.addParseSpanInfo(this.variable.valueSpan).wrapForTypeChecker();
14938
14709
  } else {
14939
- variable = tsCreateVariable(id, initializer);
14940
14710
  }
14941
- addParseSpanInfo(variable.declarationList.declarations[0], this.variable.sourceSpan);
14711
+ const variable = new TcbExpr(`var ${id.print()} = ${initializer.print()}`);
14712
+ variable.addParseSpanInfo(this.variable.sourceSpan);
14942
14713
  this.scope.addStatement(variable);
14943
14714
  return id;
14944
14715
  }
@@ -14959,17 +14730,17 @@ var TcbBlockVariableOp = class extends TcbOp {
14959
14730
  return false;
14960
14731
  }
14961
14732
  execute() {
14962
- const id = this.tcb.allocateId();
14963
- addParseSpanInfo(id, this.variable.keySpan);
14964
- const variable = tsCreateVariable(id, wrapForTypeChecker(this.initializer));
14965
- addParseSpanInfo(variable.declarationList.declarations[0], this.variable.sourceSpan);
14733
+ const id = new TcbExpr(this.tcb.allocateId());
14734
+ id.addParseSpanInfo(this.variable.keySpan);
14735
+ this.initializer.wrapForTypeChecker();
14736
+ const variable = new TcbExpr(`var ${id.print()} = ${this.initializer.print()}`);
14737
+ variable.addParseSpanInfo(this.variable.sourceSpan);
14966
14738
  this.scope.addStatement(variable);
14967
14739
  return id;
14968
14740
  }
14969
14741
  };
14970
14742
 
14971
14743
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/completions.js
14972
- import ts67 from "typescript";
14973
14744
  var TcbComponentContextCompletionOp = class extends TcbOp {
14974
14745
  scope;
14975
14746
  constructor(scope) {
@@ -14978,18 +14749,16 @@ var TcbComponentContextCompletionOp = class extends TcbOp {
14978
14749
  }
14979
14750
  optional = false;
14980
14751
  execute() {
14981
- const ctx = ts67.factory.createThis();
14982
- const ctxDot = ts67.factory.createPropertyAccessExpression(ctx, "");
14983
- markIgnoreDiagnostics(ctxDot);
14984
- addExpressionIdentifier(ctxDot, ExpressionIdentifier.COMPONENT_COMPLETION);
14985
- this.scope.addStatement(ts67.factory.createExpressionStatement(ctxDot));
14752
+ const ctx = new TcbExpr("this.");
14753
+ ctx.markIgnoreDiagnostics();
14754
+ ctx.addExpressionIdentifier(ExpressionIdentifier.COMPONENT_COMPLETION);
14755
+ this.scope.addStatement(ctx);
14986
14756
  return null;
14987
14757
  }
14988
14758
  };
14989
14759
 
14990
14760
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/references.js
14991
- import { DYNAMIC_TYPE, TmplAstElement as TmplAstElement2, TmplAstTemplate as TmplAstTemplate2 } from "@angular/compiler";
14992
- import ts68 from "typescript";
14761
+ import { TmplAstElement as TmplAstElement2, TmplAstTemplate as TmplAstTemplate2 } from "@angular/compiler";
14993
14762
  var TcbReferenceOp = class extends TcbOp {
14994
14763
  tcb;
14995
14764
  scope;
@@ -15008,18 +14777,17 @@ var TcbReferenceOp = class extends TcbOp {
15008
14777
  // so it can map a reference variable in the template directly to a node in the TCB.
15009
14778
  optional = true;
15010
14779
  execute() {
15011
- const id = this.tcb.allocateId();
14780
+ const id = new TcbExpr(this.tcb.allocateId());
15012
14781
  let initializer = this.target instanceof TmplAstTemplate2 || this.target instanceof TmplAstElement2 ? this.scope.resolve(this.target) : this.scope.resolve(this.host, this.target);
15013
14782
  if (this.target instanceof TmplAstElement2 && !this.tcb.env.config.checkTypeOfDomReferences || !this.tcb.env.config.checkTypeOfNonDomReferences) {
15014
- initializer = ts68.factory.createAsExpression(initializer, ts68.factory.createKeywordTypeNode(ts68.SyntaxKind.AnyKeyword));
14783
+ initializer = new TcbExpr(`${initializer.print()} as any`);
15015
14784
  } else if (this.target instanceof TmplAstTemplate2) {
15016
- initializer = ts68.factory.createAsExpression(initializer, ts68.factory.createKeywordTypeNode(ts68.SyntaxKind.AnyKeyword));
15017
- initializer = ts68.factory.createAsExpression(initializer, this.tcb.env.referenceExternalType("@angular/core", "TemplateRef", [DYNAMIC_TYPE]));
15018
- initializer = ts68.factory.createParenthesizedExpression(initializer);
14785
+ const templateRef = this.tcb.env.referenceExternalSymbol("@angular/core", "TemplateRef");
14786
+ initializer = new TcbExpr(`(${initializer.print()} as any as ${templateRef.print()}<any>)`);
15019
14787
  }
15020
- addParseSpanInfo(initializer, this.node.sourceSpan);
15021
- addParseSpanInfo(id, this.node.keySpan);
15022
- this.scope.addStatement(tsCreateVariable(id, initializer));
14788
+ initializer.addParseSpanInfo(this.node.sourceSpan);
14789
+ id.addParseSpanInfo(this.node.keySpan);
14790
+ this.scope.addStatement(new TcbExpr(`var ${id.print()} = ${initializer.print()}`));
15023
14791
  return id;
15024
14792
  }
15025
14793
  };
@@ -15034,14 +14802,13 @@ var TcbInvalidReferenceOp = class extends TcbOp {
15034
14802
  // The declaration of a missing reference is only needed when the reference is resolved.
15035
14803
  optional = true;
15036
14804
  execute() {
15037
- const id = this.tcb.allocateId();
15038
- this.scope.addStatement(tsCreateVariable(id, getAnyExpression()));
14805
+ const id = new TcbExpr(this.tcb.allocateId());
14806
+ this.scope.addStatement(new TcbExpr(`var ${id.print()} = any`));
15039
14807
  return id;
15040
14808
  }
15041
14809
  };
15042
14810
 
15043
14811
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/if_block.js
15044
- import ts69 from "typescript";
15045
14812
  var TcbIfOp = class extends TcbOp {
15046
14813
  tcb;
15047
14814
  scope;
@@ -15068,17 +14835,21 @@ var TcbIfOp = class extends TcbOp {
15068
14835
  }
15069
14836
  if (branch.expression === null) {
15070
14837
  const branchScope = this.getBranchScope(this.scope, branch, index);
15071
- return ts69.factory.createBlock(branchScope.render());
14838
+ return new TcbExpr(`{
14839
+ ${getStatementsBlock(branchScope.render())}}`);
15072
14840
  }
15073
14841
  const outerScope = this.scope.createChildScope(this.scope, branch, [], null);
15074
14842
  outerScope.render().forEach((stmt) => this.scope.addStatement(stmt));
15075
14843
  this.expressionScopes.set(branch, outerScope);
15076
14844
  let expression = tcbExpression(branch.expression, this.tcb, this.scope);
15077
14845
  if (branch.expressionAlias !== null) {
15078
- expression = ts69.factory.createBinaryExpression(ts69.factory.createParenthesizedExpression(expression), ts69.SyntaxKind.AmpersandAmpersandToken, outerScope.resolve(branch.expressionAlias));
14846
+ expression = new TcbExpr(`(${expression.print()}) && ${outerScope.resolve(branch.expressionAlias).print()}`);
15079
14847
  }
15080
14848
  const bodyScope = this.getBranchScope(outerScope, branch, index);
15081
- return ts69.factory.createIfStatement(expression, ts69.factory.createBlock(bodyScope.render()), this.generateBranch(index + 1));
14849
+ const ifStatement = `if (${expression.print()}) {
14850
+ ${getStatementsBlock(bodyScope.render())}}`;
14851
+ const elseBranch = this.generateBranch(index + 1);
14852
+ return new TcbExpr(ifStatement + (elseBranch ? " else " + elseBranch.print() : ""));
15082
14853
  }
15083
14854
  getBranchScope(parentScope, branch, index) {
15084
14855
  const checkBody = this.tcb.env.config.checkControlFlowBodies;
@@ -15098,18 +14869,17 @@ var TcbIfOp = class extends TcbOp {
15098
14869
  let expression;
15099
14870
  expression = tcbExpression(branch.expression, this.tcb, expressionScope);
15100
14871
  if (branch.expressionAlias !== null) {
15101
- expression = ts69.factory.createBinaryExpression(ts69.factory.createParenthesizedExpression(expression), ts69.SyntaxKind.AmpersandAmpersandToken, expressionScope.resolve(branch.expressionAlias));
14872
+ expression = new TcbExpr(`(${expression.print()}) && ${expressionScope.resolve(branch.expressionAlias).print()}`);
15102
14873
  }
15103
- markIgnoreDiagnostics(expression);
15104
- const comparisonExpression = i === index ? expression : ts69.factory.createPrefixUnaryExpression(ts69.SyntaxKind.ExclamationToken, ts69.factory.createParenthesizedExpression(expression));
15105
- guard = guard === null ? comparisonExpression : ts69.factory.createBinaryExpression(guard, ts69.SyntaxKind.AmpersandAmpersandToken, comparisonExpression);
14874
+ expression.markIgnoreDiagnostics();
14875
+ const comparisonExpression = i === index ? expression : new TcbExpr(`!(${expression.print()})`);
14876
+ guard = guard === null ? comparisonExpression : new TcbExpr(`(${guard.print()}) && (${comparisonExpression.print()})`);
15106
14877
  }
15107
14878
  return guard;
15108
14879
  }
15109
14880
  };
15110
14881
 
15111
14882
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/switch_block.js
15112
- import ts70 from "typescript";
15113
14883
  var TcbSwitchOp = class extends TcbOp {
15114
14884
  tcb;
15115
14885
  scope;
@@ -15128,21 +14898,23 @@ var TcbSwitchOp = class extends TcbOp {
15128
14898
  const clauses = this.block.groups.flatMap((current) => {
15129
14899
  const checkBody = this.tcb.env.config.checkControlFlowBodies;
15130
14900
  const clauseScope = this.scope.createChildScope(this.scope, null, checkBody ? current.children : [], checkBody ? this.generateGuard(current, switchExpression) : null);
15131
- const statements = [...clauseScope.render(), ts70.factory.createBreakStatement()];
14901
+ const statements = [...clauseScope.render(), new TcbExpr("break")];
15132
14902
  return current.cases.map((switchCase, index) => {
15133
- const statementsForCase = index === current.cases.length - 1 ? statements : [];
15134
- return switchCase.expression === null ? ts70.factory.createDefaultClause(statementsForCase) : ts70.factory.createCaseClause(tcbExpression(switchCase.expression, this.tcb, this.scope), statementsForCase);
14903
+ const statementsStr = getStatementsBlock(
14904
+ index === current.cases.length - 1 ? statements : [],
14905
+ true
14906
+ /* singleLine */
14907
+ );
14908
+ const source = switchCase.expression === null ? `default: ${statementsStr}` : `case ${tcbExpression(switchCase.expression, this.tcb, this.scope).print()}: ${statementsStr}`;
14909
+ return new TcbExpr(source);
15135
14910
  });
15136
14911
  });
15137
14912
  if (this.block.exhaustiveCheck) {
15138
14913
  const switchValue = tcbExpression(this.block.expression, this.tcb, this.scope);
15139
- clauses.push(ts70.factory.createDefaultClause([
15140
- ts70.factory.createVariableStatement(void 0, ts70.factory.createVariableDeclarationList([
15141
- ts70.factory.createVariableDeclaration(ts70.factory.createUniqueName("tcbExhaustive"), void 0, ts70.factory.createKeywordTypeNode(ts70.SyntaxKind.NeverKeyword), switchValue)
15142
- ], ts70.NodeFlags.Const))
15143
- ]));
14914
+ const exhaustiveId = this.tcb.allocateId();
14915
+ clauses.push(new TcbExpr(`default: const tcbExhaustive${exhaustiveId}: never = ${switchValue.print()};`));
15144
14916
  }
15145
- this.scope.addStatement(ts70.factory.createSwitchStatement(switchExpression, ts70.factory.createCaseBlock(clauses)));
14917
+ this.scope.addStatement(new TcbExpr(`switch (${switchExpression.print()}) { ${clauses.map((c) => c.print()).join("\n")} }`));
15146
14918
  return null;
15147
14919
  }
15148
14920
  generateGuard(group, switchValue) {
@@ -15152,12 +14924,12 @@ var TcbSwitchOp = class extends TcbOp {
15152
14924
  for (const switchCase of group.cases) {
15153
14925
  if (switchCase.expression !== null) {
15154
14926
  const expression = tcbExpression(switchCase.expression, this.tcb, this.scope);
15155
- markIgnoreDiagnostics(expression);
15156
- const comparison = ts70.factory.createBinaryExpression(switchValue, ts70.SyntaxKind.EqualsEqualsEqualsToken, expression);
14927
+ expression.markIgnoreDiagnostics();
14928
+ const comparison = new TcbExpr(`${switchValue.print()} === ${expression.print()}`);
15157
14929
  if (guard2 === null) {
15158
14930
  guard2 = comparison;
15159
14931
  } else {
15160
- guard2 = ts70.factory.createBinaryExpression(guard2, ts70.SyntaxKind.BarBarToken, comparison);
14932
+ guard2 = new TcbExpr(`(${guard2.print()}) || (${comparison.print()})`);
15161
14933
  }
15162
14934
  }
15163
14935
  }
@@ -15173,12 +14945,12 @@ var TcbSwitchOp = class extends TcbOp {
15173
14945
  continue;
15174
14946
  }
15175
14947
  const expression = tcbExpression(switchCase.expression, this.tcb, this.scope);
15176
- markIgnoreDiagnostics(expression);
15177
- const comparison = ts70.factory.createBinaryExpression(switchValue, ts70.SyntaxKind.ExclamationEqualsEqualsToken, expression);
14948
+ expression.markIgnoreDiagnostics();
14949
+ const comparison = new TcbExpr(`${switchValue.print()} !== ${expression.print()}`);
15178
14950
  if (guard === null) {
15179
14951
  guard = comparison;
15180
14952
  } else {
15181
- guard = ts70.factory.createBinaryExpression(guard, ts70.SyntaxKind.AmpersandAmpersandToken, comparison);
14953
+ guard = new TcbExpr(`(${guard.print()}) && (${comparison.print()})`);
15182
14954
  }
15183
14955
  }
15184
14956
  }
@@ -15188,7 +14960,6 @@ var TcbSwitchOp = class extends TcbOp {
15188
14960
 
15189
14961
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/for_block.js
15190
14962
  import { ImplicitReceiver as ImplicitReceiver5, PropertyRead as PropertyRead5, ThisReceiver as ThisReceiver5, TmplAstVariable } from "@angular/compiler";
15191
- import ts71 from "typescript";
15192
14963
  var TcbForOfOp = class extends TcbOp {
15193
14964
  tcb;
15194
14965
  scope;
@@ -15205,19 +14976,14 @@ var TcbForOfOp = class extends TcbOp {
15205
14976
  execute() {
15206
14977
  const loopScope = this.scope.createChildScope(this.scope, this.block, this.tcb.env.config.checkControlFlowBodies ? this.block.children : [], null);
15207
14978
  const initializerId = loopScope.resolve(this.block.item);
15208
- if (!ts71.isIdentifier(initializerId)) {
15209
- throw new Error(`Could not resolve for loop variable ${this.block.item.name} to an identifier`);
15210
- }
15211
- const initializer = ts71.factory.createVariableDeclarationList([ts71.factory.createVariableDeclaration(initializerId)], ts71.NodeFlags.Const);
15212
- addParseSpanInfo(initializer, this.block.item.keySpan);
15213
- const expression = ts71.factory.createNonNullExpression(tcbExpression(this.block.expression, this.tcb, this.scope));
14979
+ const initializer = new TcbExpr(`const ${initializerId.print()}`);
14980
+ initializer.addParseSpanInfo(this.block.item.keySpan);
14981
+ const expression = new TcbExpr(`${tcbExpression(this.block.expression, this.tcb, this.scope).print()}!`);
15214
14982
  const trackTranslator = new TcbForLoopTrackTranslator(this.tcb, loopScope, this.block);
15215
14983
  const trackExpression = trackTranslator.translate(this.block.trackBy);
15216
- const statements = [
15217
- ...loopScope.render(),
15218
- ts71.factory.createExpressionStatement(trackExpression)
15219
- ];
15220
- this.scope.addStatement(ts71.factory.createForOfStatement(void 0, initializer, expression, ts71.factory.createBlock(statements)));
14984
+ const block = getStatementsBlock([...loopScope.render(), trackExpression]);
14985
+ this.scope.addStatement(new TcbExpr(`for (${initializer.print()} of ${expression.print()}) {
14986
+ ${block} }`));
15221
14987
  return null;
15222
14988
  }
15223
14989
  };
@@ -15246,7 +15012,6 @@ var TcbForLoopTrackTranslator = class extends TcbExpressionTranslator {
15246
15012
  };
15247
15013
 
15248
15014
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/let.js
15249
- import ts72 from "typescript";
15250
15015
  var TcbLetDeclarationOp = class extends TcbOp {
15251
15016
  tcb;
15252
15017
  scope;
@@ -15263,11 +15028,10 @@ var TcbLetDeclarationOp = class extends TcbOp {
15263
15028
  */
15264
15029
  optional = false;
15265
15030
  execute() {
15266
- const id = this.tcb.allocateId();
15267
- addParseSpanInfo(id, this.node.nameSpan);
15268
- const value = tcbExpression(this.node.value, this.tcb, this.scope);
15269
- const varStatement = tsCreateVariable(id, wrapForTypeChecker(value), ts72.NodeFlags.Const);
15270
- addParseSpanInfo(varStatement.declarationList.declarations[0], this.node.sourceSpan);
15031
+ const id = new TcbExpr(this.tcb.allocateId()).addParseSpanInfo(this.node.nameSpan);
15032
+ const value = tcbExpression(this.node.value, this.tcb, this.scope).wrapForTypeChecker();
15033
+ const varStatement = new TcbExpr(`const ${id.print()} = ${value.print()}`);
15034
+ varStatement.addParseSpanInfo(this.node.sourceSpan);
15271
15035
  this.scope.addStatement(varStatement);
15272
15036
  return id;
15273
15037
  }
@@ -15275,11 +15039,11 @@ var TcbLetDeclarationOp = class extends TcbOp {
15275
15039
 
15276
15040
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/inputs.js
15277
15041
  import { BindingType as BindingType5, R3Identifiers as R3Identifiers5, TransplantedType } from "@angular/compiler";
15278
- import ts75 from "typescript";
15042
+ import ts63 from "typescript";
15279
15043
 
15280
15044
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/signal_forms.js
15281
15045
  import { BindingType as BindingType3, Call as Call4, PropertyRead as PropertyRead6, SafeCall as SafeCall3, TmplAstElement as TmplAstElement3, TmplAstHostElement as TmplAstHostElement2 } from "@angular/compiler";
15282
- import ts73 from "typescript";
15046
+ import ts62 from "typescript";
15283
15047
  var formControlInputFields = [
15284
15048
  // Should be kept in sync with the `FormUiControl` bindings,
15285
15049
  // defined in `packages/forms/signals/src/api/control.ts`.
@@ -15343,58 +15107,43 @@ var TcbNativeFieldOp = class extends TcbOp {
15343
15107
  return null;
15344
15108
  }
15345
15109
  checkUnsupportedFieldBindings(this.node, this.unsupportedBindingFields, this.tcb);
15346
- const expectedType = this.getExpectedTypeFromDomNode(this.node);
15110
+ const expectedType = new TcbExpr(this.getExpectedTypeFromDomNode(this.node));
15347
15111
  const value = extractFieldValue(fieldBinding.value, this.tcb, this.scope);
15348
- const id = this.tcb.allocateId();
15349
- const assignment = ts73.factory.createBinaryExpression(id, ts73.SyntaxKind.EqualsToken, value);
15350
- addParseSpanInfo(assignment, fieldBinding.valueSpan ?? fieldBinding.sourceSpan);
15351
- this.scope.addStatement(tsDeclareVariable(id, expectedType));
15352
- this.scope.addStatement(ts73.factory.createExpressionStatement(assignment));
15112
+ const id = new TcbExpr(this.tcb.allocateId());
15113
+ const assignment = new TcbExpr(`${id.print()} = ${value.print()}`);
15114
+ assignment.addParseSpanInfo(fieldBinding.valueSpan ?? fieldBinding.sourceSpan);
15115
+ this.scope.addStatement(declareVariable(id, expectedType));
15116
+ this.scope.addStatement(assignment);
15353
15117
  return null;
15354
15118
  }
15355
15119
  getExpectedTypeFromDomNode(node) {
15356
15120
  if (node.name === "textarea" || node.name === "select") {
15357
- return ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.StringKeyword);
15121
+ return "string";
15358
15122
  }
15359
15123
  if (node.name !== "input") {
15360
15124
  return this.getUnsupportedType();
15361
15125
  }
15362
15126
  switch (this.inputType) {
15363
15127
  case "checkbox":
15364
- return ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.BooleanKeyword);
15128
+ return "boolean";
15365
15129
  case "number":
15366
15130
  case "range":
15367
15131
  case "datetime-local":
15368
- return ts73.factory.createUnionTypeNode([
15369
- ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.StringKeyword),
15370
- ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.NumberKeyword),
15371
- ts73.factory.createLiteralTypeNode(ts73.factory.createNull())
15372
- ]);
15132
+ return "string | number | null";
15373
15133
  case "date":
15374
15134
  case "month":
15375
15135
  case "time":
15376
15136
  case "week":
15377
- return ts73.factory.createUnionTypeNode([
15378
- ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.StringKeyword),
15379
- ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.NumberKeyword),
15380
- ts73.factory.createTypeReferenceNode("Date"),
15381
- ts73.factory.createLiteralTypeNode(ts73.factory.createNull())
15382
- ]);
15137
+ return "string | number | Date | null";
15383
15138
  }
15384
15139
  const hasDynamicType = this.inputType === null && this.node.inputs.some((input) => (input.type === BindingType3.Property || input.type === BindingType3.Attribute) && input.name === "type");
15385
15140
  if (hasDynamicType) {
15386
- return ts73.factory.createUnionTypeNode([
15387
- ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.StringKeyword),
15388
- ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.NumberKeyword),
15389
- ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.BooleanKeyword),
15390
- ts73.factory.createTypeReferenceNode("Date"),
15391
- ts73.factory.createLiteralTypeNode(ts73.factory.createNull())
15392
- ]);
15141
+ return "string | number | boolean | Date | null";
15393
15142
  }
15394
- return ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.StringKeyword);
15143
+ return "string";
15395
15144
  }
15396
15145
  getUnsupportedType() {
15397
- return ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.NeverKeyword);
15146
+ return "never";
15398
15147
  }
15399
15148
  };
15400
15149
  var TcbNativeRadioButtonFieldOp = class extends TcbNativeFieldOp {
@@ -15408,12 +15157,12 @@ var TcbNativeRadioButtonFieldOp = class extends TcbNativeFieldOp {
15408
15157
  return attr.type === BindingType3.Property && attr.name === "value";
15409
15158
  });
15410
15159
  if (valueBinding !== void 0) {
15411
- const id = this.tcb.allocateId();
15160
+ const id = new TcbExpr(this.tcb.allocateId());
15412
15161
  const value = tcbExpression(valueBinding.value, this.tcb, this.scope);
15413
- const assignment = ts73.factory.createBinaryExpression(id, ts73.SyntaxKind.EqualsToken, value);
15414
- addParseSpanInfo(assignment, valueBinding.sourceSpan);
15415
- this.scope.addStatement(tsDeclareVariable(id, ts73.factory.createKeywordTypeNode(ts73.SyntaxKind.StringKeyword)));
15416
- this.scope.addStatement(ts73.factory.createExpressionStatement(assignment));
15162
+ const assignment = new TcbExpr(`${id.print()} = ${value.print()}`);
15163
+ assignment.addParseSpanInfo(valueBinding.sourceSpan);
15164
+ this.scope.addStatement(declareVariable(id, new TcbExpr("string")));
15165
+ this.scope.addStatement(assignment);
15417
15166
  }
15418
15167
  return null;
15419
15168
  }
@@ -15452,7 +15201,7 @@ function isFieldDirective(meta) {
15452
15201
  if (meta.ref.bestGuessOwningModule?.specifier === "@angular/forms/signals") {
15453
15202
  return true;
15454
15203
  }
15455
- 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 === "\u0275NgFieldDirective");
15204
+ 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 === "\u0275NgFieldDirective");
15456
15205
  }
15457
15206
  function getSyntheticFieldBoundInput(dir, inputName, fieldPropertyName, fieldBinding, customFieldType) {
15458
15207
  const inputs = dir.inputs.getByBindingPropertyName(inputName);
@@ -15524,9 +15273,9 @@ function checkUnsupportedFieldBindings(node, unsupportedBindingFields, tcb) {
15524
15273
  }
15525
15274
  }
15526
15275
  function extractFieldValue(expression, tcb, scope) {
15527
- const innerCall = ts73.factory.createCallExpression(tcbExpression(expression, tcb, scope), void 0, void 0);
15528
- markIgnoreDiagnostics(innerCall);
15529
- return ts73.factory.createCallExpression(ts73.factory.createPropertyAccessExpression(innerCall, "value"), void 0, void 0);
15276
+ const innerCall = new TcbExpr(tcbExpression(expression, tcb, scope).print() + "()");
15277
+ innerCall.markIgnoreDiagnostics();
15278
+ return new TcbExpr(`${innerCall.print()}.value()`);
15530
15279
  }
15531
15280
  function hasModelInput(name, meta) {
15532
15281
  return meta.inputs.hasBindingPropertyName(name) && meta.outputs.hasBindingPropertyName(name + "Change");
@@ -15545,8 +15294,7 @@ function isFormControl(allDirectiveMatches) {
15545
15294
  }
15546
15295
 
15547
15296
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/bindings.js
15548
- import { BindingType as BindingType4, TmplAstBoundAttribute as TmplAstBoundAttribute4, TmplAstElement as TmplAstElement4, TmplAstTemplate as TmplAstTemplate3 } from "@angular/compiler";
15549
- import ts74 from "typescript";
15297
+ import { BindingType as BindingType4, LiteralArray, LiteralMap, TmplAstBoundAttribute as TmplAstBoundAttribute4, TmplAstElement as TmplAstElement4, TmplAstTemplate as TmplAstTemplate3 } from "@angular/compiler";
15550
15298
  function getBoundAttributes(directive, node) {
15551
15299
  const boundInputs = [];
15552
15300
  const processAttribute = (attr) => {
@@ -15602,14 +15350,14 @@ function checkSplitTwoWayBinding(inputName, output, inputs, tcb) {
15602
15350
  }
15603
15351
  return false;
15604
15352
  }
15605
- function widenBinding(expr, tcb) {
15353
+ function widenBinding(expr, tcb, originalValue) {
15606
15354
  if (!tcb.env.config.checkTypeOfInputBindings) {
15607
- return tsCastToAny(expr);
15355
+ return new TcbExpr(`((${expr.print()}) as any)`);
15608
15356
  } else if (!tcb.env.config.strictNullInputBindings) {
15609
- if (ts74.isObjectLiteralExpression(expr) || ts74.isArrayLiteralExpression(expr)) {
15357
+ if (originalValue instanceof LiteralMap || originalValue instanceof LiteralArray) {
15610
15358
  return expr;
15611
15359
  } else {
15612
- return ts74.factory.createNonNullExpression(expr);
15360
+ return new TcbExpr(`(${expr.print()})!`);
15613
15361
  }
15614
15362
  } else {
15615
15363
  return expr;
@@ -15619,7 +15367,7 @@ function widenBinding(expr, tcb) {
15619
15367
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/inputs.js
15620
15368
  function translateInput(value, tcb, scope) {
15621
15369
  if (typeof value === "string") {
15622
- return ts75.factory.createStringLiteral(value);
15370
+ return new TcbExpr(quoteAndEscape(value));
15623
15371
  } else {
15624
15372
  return tcbExpression(value, tcb, scope);
15625
15373
  }
@@ -15657,8 +15405,8 @@ var TcbDirectiveInputsOp = class extends TcbOp {
15657
15405
  }
15658
15406
  }
15659
15407
  for (const attr of boundAttrs) {
15660
- const expr = widenBinding(translateInput(attr.value, this.tcb, this.scope), this.tcb);
15661
- let assignment = wrapForDiagnostics(expr);
15408
+ let assignment = widenBinding(translateInput(attr.value, this.tcb, this.scope), this.tcb, attr.value);
15409
+ assignment.wrapForTypeChecker();
15662
15410
  for (const { fieldName, required, transformType, isSignal, isTwoWayBinding } of attr.inputs) {
15663
15411
  let target;
15664
15412
  if (required) {
@@ -15667,16 +15415,18 @@ var TcbDirectiveInputsOp = class extends TcbOp {
15667
15415
  if (this.dir.coercedInputFields.has(fieldName)) {
15668
15416
  let type;
15669
15417
  if (transformType !== null) {
15670
- type = this.tcb.env.referenceTransplantedType(new TransplantedType(transformType));
15418
+ const tsType = this.tcb.env.referenceTransplantedType(new TransplantedType(transformType));
15419
+ type = new TcbExpr(tempPrint(tsType, transformType.node.getSourceFile()));
15671
15420
  } else {
15672
15421
  const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
15673
- if (!ts75.isTypeReferenceNode(dirTypeRef)) {
15422
+ if (!ts63.isTypeReferenceNode(dirTypeRef)) {
15674
15423
  throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
15675
15424
  }
15676
- type = tsCreateTypeQueryForCoercedInput(dirTypeRef.typeName, fieldName);
15425
+ const typeName = ts63.isIdentifier(dirTypeRef.typeName) ? dirTypeRef.typeName.text : tempPrint(dirTypeRef.typeName, dirTypeRef.typeName.getSourceFile());
15426
+ type = new TcbExpr(`typeof ${typeName}.ngAcceptInputType_${fieldName}`);
15677
15427
  }
15678
- const id = this.tcb.allocateId();
15679
- this.scope.addStatement(tsDeclareVariable(id, type));
15428
+ const id = new TcbExpr(this.tcb.allocateId());
15429
+ this.scope.addStatement(declareVariable(id, type));
15680
15430
  target = id;
15681
15431
  } else if (this.dir.undeclaredInputFields.has(fieldName)) {
15682
15432
  continue;
@@ -15684,41 +15434,38 @@ var TcbDirectiveInputsOp = class extends TcbOp {
15684
15434
  if (dirId === null) {
15685
15435
  dirId = this.scope.resolve(this.node, this.dir);
15686
15436
  }
15687
- const id = this.tcb.allocateId();
15437
+ const id = new TcbExpr(this.tcb.allocateId());
15688
15438
  const dirTypeRef = this.tcb.env.referenceType(this.dir.ref);
15689
- if (!ts75.isTypeReferenceNode(dirTypeRef)) {
15439
+ if (!ts63.isTypeReferenceNode(dirTypeRef)) {
15690
15440
  throw new Error(`Expected TypeReferenceNode from reference to ${this.dir.ref.debugName}`);
15691
15441
  }
15692
- const type = ts75.factory.createIndexedAccessTypeNode(ts75.factory.createTypeQueryNode(dirId), ts75.factory.createLiteralTypeNode(ts75.factory.createStringLiteral(fieldName)));
15693
- const temp = tsDeclareVariable(id, type);
15442
+ const type = new TcbExpr(`(typeof ${dirId.print()})[${quoteAndEscape(fieldName)}]`);
15443
+ const temp = declareVariable(id, type);
15694
15444
  this.scope.addStatement(temp);
15695
15445
  target = id;
15696
15446
  } else {
15697
15447
  if (dirId === null) {
15698
15448
  dirId = this.scope.resolve(this.node, this.dir);
15699
15449
  }
15700
- target = this.dir.stringLiteralInputFields.has(fieldName) ? ts75.factory.createElementAccessExpression(dirId, ts75.factory.createStringLiteral(fieldName)) : ts75.factory.createPropertyAccessExpression(dirId, ts75.factory.createIdentifier(fieldName));
15450
+ target = this.dir.stringLiteralInputFields.has(fieldName) ? new TcbExpr(`${dirId.print()}[${quoteAndEscape(fieldName)}]`) : new TcbExpr(`${dirId.print()}.${fieldName}`);
15701
15451
  }
15702
15452
  if (isSignal) {
15703
15453
  const inputSignalBrandWriteSymbol = this.tcb.env.referenceExternalSymbol(R3Identifiers5.InputSignalBrandWriteType.moduleName, R3Identifiers5.InputSignalBrandWriteType.name);
15704
- if (!ts75.isIdentifier(inputSignalBrandWriteSymbol) && !ts75.isPropertyAccessExpression(inputSignalBrandWriteSymbol)) {
15705
- throw new Error(`Expected identifier or property access for reference to ${R3Identifiers5.InputSignalBrandWriteType.name}`);
15706
- }
15707
- target = ts75.factory.createElementAccessExpression(target, inputSignalBrandWriteSymbol);
15454
+ target = new TcbExpr(`${target.print()}[${inputSignalBrandWriteSymbol.print()}]`);
15708
15455
  }
15709
15456
  if (attr.keySpan !== null) {
15710
- addParseSpanInfo(target, attr.keySpan);
15457
+ target.addParseSpanInfo(attr.keySpan);
15711
15458
  }
15712
15459
  if (isTwoWayBinding && this.tcb.env.config.allowSignalsInTwoWayBindings) {
15713
15460
  assignment = unwrapWritableSignal(assignment, this.tcb);
15714
15461
  }
15715
- assignment = ts75.factory.createBinaryExpression(target, ts75.SyntaxKind.EqualsToken, assignment);
15462
+ assignment = new TcbExpr(`${target.print()} = ${assignment.print()}`);
15716
15463
  }
15717
- addParseSpanInfo(assignment, attr.sourceSpan);
15464
+ assignment.addParseSpanInfo(attr.sourceSpan);
15718
15465
  if (!this.tcb.env.config.checkTypeOfAttributes && typeof attr.value === "string") {
15719
- markIgnoreDiagnostics(assignment);
15466
+ assignment.markIgnoreDiagnostics();
15720
15467
  }
15721
- this.scope.addStatement(ts75.factory.createExpressionStatement(assignment));
15468
+ this.scope.addStatement(assignment);
15722
15469
  }
15723
15470
  this.checkRequiredInputs(seenRequiredInputs);
15724
15471
  return null;
@@ -15759,22 +15506,20 @@ var TcbUnclaimedInputsOp = class extends TcbOp {
15759
15506
  if (isPropertyBinding && this.claimedInputs?.has(binding.name)) {
15760
15507
  continue;
15761
15508
  }
15762
- const expr = widenBinding(tcbExpression(binding.value, this.tcb, this.scope), this.tcb);
15509
+ const expr = widenBinding(tcbExpression(binding.value, this.tcb, this.scope), this.tcb, binding.value);
15763
15510
  if (this.tcb.env.config.checkTypeOfDomBindings && isPropertyBinding) {
15764
15511
  if (binding.name !== "style" && binding.name !== "class") {
15765
15512
  if (elId === null) {
15766
15513
  elId = this.scope.resolve(this.target);
15767
15514
  }
15768
15515
  const propertyName = REGISTRY.getMappedPropName(binding.name);
15769
- const prop = ts75.factory.createElementAccessExpression(elId, ts75.factory.createStringLiteral(propertyName));
15770
- const stmt = ts75.factory.createBinaryExpression(prop, ts75.SyntaxKind.EqualsToken, wrapForDiagnostics(expr));
15771
- addParseSpanInfo(stmt, binding.sourceSpan);
15772
- this.scope.addStatement(ts75.factory.createExpressionStatement(stmt));
15516
+ const stmt = new TcbExpr(`${elId.print()}[${quoteAndEscape(propertyName)}] = ${expr.wrapForTypeChecker().print()}`).addParseSpanInfo(binding.sourceSpan);
15517
+ this.scope.addStatement(stmt);
15773
15518
  } else {
15774
- this.scope.addStatement(ts75.factory.createExpressionStatement(expr));
15519
+ this.scope.addStatement(expr);
15775
15520
  }
15776
15521
  } else {
15777
- this.scope.addStatement(ts75.factory.createExpressionStatement(expr));
15522
+ this.scope.addStatement(expr);
15778
15523
  }
15779
15524
  }
15780
15525
  return null;
@@ -15801,10 +15546,10 @@ var TcbComponentNodeOp = class extends TcbOp {
15801
15546
  }
15802
15547
  execute() {
15803
15548
  const id = this.tcb.allocateId();
15804
- const initializer = tsCreateElement(getComponentTagName(this.component));
15805
- addParseSpanInfo(initializer, this.component.startSourceSpan || this.component.sourceSpan);
15806
- this.scope.addStatement(tsCreateVariable(id, initializer));
15807
- return id;
15549
+ const initializer = new TcbExpr(`document.createElement("${getComponentTagName(this.component)}")`);
15550
+ initializer.addParseSpanInfo(this.component.startSourceSpan || this.component.sourceSpan);
15551
+ this.scope.addStatement(new TcbExpr(`var ${id} = ${initializer.print()}`));
15552
+ return new TcbExpr(id);
15808
15553
  }
15809
15554
  };
15810
15555
 
@@ -15854,7 +15599,6 @@ var TcbDomSchemaCheckerOp = class extends TcbOp {
15854
15599
 
15855
15600
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/events.js
15856
15601
  import { ImplicitReceiver as ImplicitReceiver6, ParsedEventType as ParsedEventType2, PropertyRead as PropertyRead7, TmplAstElement as TmplAstElement6 } from "@angular/compiler";
15857
- import ts76 from "typescript";
15858
15602
  var EVENT_PARAMETER = "$event";
15859
15603
  function tcbEventHandlerExpression(ast, tcb, scope) {
15860
15604
  const translator = new TcbEventHandlerTranslator(tcb, scope);
@@ -15894,8 +15638,8 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
15894
15638
  if (dirId === null) {
15895
15639
  dirId = this.scope.resolve(this.node, this.dir);
15896
15640
  }
15897
- const outputField = ts76.factory.createElementAccessExpression(dirId, ts76.factory.createStringLiteral(field));
15898
- addParseSpanInfo(outputField, output.keySpan);
15641
+ const outputField = new TcbExpr(`${dirId.print()}[${quoteAndEscape(field)}]`);
15642
+ outputField.addParseSpanInfo(output.keySpan);
15899
15643
  if (this.tcb.env.config.checkTypeOfOutputEvents) {
15900
15644
  const handler = tcbCreateEventHandler(
15901
15645
  output,
@@ -15904,19 +15648,11 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
15904
15648
  0
15905
15649
  /* EventParamType.Infer */
15906
15650
  );
15907
- const subscribeFn = ts76.factory.createPropertyAccessExpression(outputField, "subscribe");
15908
- const call = ts76.factory.createCallExpression(
15909
- subscribeFn,
15910
- /* typeArguments */
15911
- void 0,
15912
- [
15913
- handler
15914
- ]
15915
- );
15916
- addParseSpanInfo(call, output.sourceSpan);
15917
- this.scope.addStatement(ts76.factory.createExpressionStatement(call));
15651
+ const call = new TcbExpr(`${outputField.print()}.subscribe(${handler.print()})`);
15652
+ call.addParseSpanInfo(output.sourceSpan);
15653
+ this.scope.addStatement(call);
15918
15654
  } else {
15919
- this.scope.addStatement(ts76.factory.createExpressionStatement(outputField));
15655
+ this.scope.addStatement(outputField);
15920
15656
  const handler = tcbCreateEventHandler(
15921
15657
  output,
15922
15658
  this.tcb,
@@ -15924,7 +15660,7 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
15924
15660
  1
15925
15661
  /* EventParamType.Any */
15926
15662
  );
15927
- this.scope.addStatement(ts76.factory.createExpressionStatement(handler));
15663
+ this.scope.addStatement(handler);
15928
15664
  }
15929
15665
  }
15930
15666
  return null;
@@ -15962,41 +15698,32 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
15962
15698
  }
15963
15699
  }
15964
15700
  if (output.type === ParsedEventType2.LegacyAnimation) {
15965
- const eventType = this.tcb.env.config.checkTypeOfAnimationEvents ? this.tcb.env.referenceExternalType("@angular/animations", "AnimationEvent") : 1;
15701
+ const eventType = this.tcb.env.config.checkTypeOfAnimationEvents ? this.tcb.env.referenceExternalSymbol("@angular/animations", "AnimationEvent").print() : 1;
15966
15702
  const handler = tcbCreateEventHandler(output, this.tcb, this.scope, eventType);
15967
- this.scope.addStatement(ts76.factory.createExpressionStatement(handler));
15703
+ this.scope.addStatement(handler);
15968
15704
  } else if (output.type === ParsedEventType2.Animation) {
15969
- const eventType = this.tcb.env.referenceExternalType("@angular/core", "AnimationCallbackEvent");
15970
- const handler = tcbCreateEventHandler(output, this.tcb, this.scope, eventType);
15971
- this.scope.addStatement(ts76.factory.createExpressionStatement(handler));
15705
+ const eventType = this.tcb.env.referenceExternalSymbol("@angular/core", "AnimationCallbackEvent");
15706
+ const handler = tcbCreateEventHandler(output, this.tcb, this.scope, eventType.print());
15707
+ this.scope.addStatement(handler);
15972
15708
  } else if (this.tcb.env.config.checkTypeOfDomEvents) {
15973
15709
  let target;
15974
15710
  let domEventAssertion;
15975
15711
  if (output.target === "window" || output.target === "document") {
15976
- target = ts76.factory.createIdentifier(output.target);
15712
+ target = new TcbExpr(output.target);
15977
15713
  } else if (elId === null) {
15978
15714
  target = elId = this.scope.resolve(this.target);
15979
15715
  } else {
15980
15716
  target = elId;
15981
15717
  }
15982
- if (this.target instanceof TmplAstElement6 && this.target.isVoid && ts76.isIdentifier(target) && this.tcb.env.config.allowDomEventAssertion) {
15983
- domEventAssertion = ts76.factory.createCallExpression(this.tcb.env.referenceExternalSymbol("@angular/core", "\u0275assertType"), [ts76.factory.createTypeQueryNode(target)], [
15984
- ts76.factory.createPropertyAccessExpression(ts76.factory.createIdentifier(EVENT_PARAMETER), "target")
15985
- ]);
15718
+ if (this.target instanceof TmplAstElement6 && this.target.isVoid && this.tcb.env.config.allowDomEventAssertion) {
15719
+ const assertUtil = this.tcb.env.referenceExternalSymbol("@angular/core", "\u0275assertType");
15720
+ domEventAssertion = new TcbExpr(`${assertUtil.print()}<typeof ${target.print()}>(${EVENT_PARAMETER}.target)`);
15986
15721
  }
15987
- const propertyAccess = ts76.factory.createPropertyAccessExpression(target, "addEventListener");
15988
- addParseSpanInfo(propertyAccess, output.keySpan);
15722
+ const propertyAccess = new TcbExpr(`${target.print()}.addEventListener`).addParseSpanInfo(output.keySpan);
15989
15723
  const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0, domEventAssertion);
15990
- const call = ts76.factory.createCallExpression(
15991
- /* expression */
15992
- propertyAccess,
15993
- /* typeArguments */
15994
- void 0,
15995
- /* arguments */
15996
- [ts76.factory.createStringLiteral(output.name), handler]
15997
- );
15998
- addParseSpanInfo(call, output.sourceSpan);
15999
- this.scope.addStatement(ts76.factory.createExpressionStatement(call));
15724
+ const call = new TcbExpr(`${propertyAccess.print()}(${quoteAndEscape(output.name)}, ${handler.print()})`);
15725
+ call.addParseSpanInfo(output.sourceSpan);
15726
+ this.scope.addStatement(call);
16000
15727
  } else {
16001
15728
  const handler = tcbCreateEventHandler(
16002
15729
  output,
@@ -16005,7 +15732,7 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
16005
15732
  1
16006
15733
  /* EventParamType.Any */
16007
15734
  );
16008
- this.scope.addStatement(ts76.factory.createExpressionStatement(handler));
15735
+ this.scope.addStatement(handler);
16009
15736
  }
16010
15737
  }
16011
15738
  return null;
@@ -16014,9 +15741,7 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
16014
15741
  var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
16015
15742
  resolve(ast) {
16016
15743
  if (ast instanceof PropertyRead7 && ast.receiver instanceof ImplicitReceiver6 && ast.name === EVENT_PARAMETER) {
16017
- const event = ts76.factory.createIdentifier(EVENT_PARAMETER);
16018
- addParseSpanInfo(event, ast.nameSpan);
16019
- return event;
15744
+ return new TcbExpr(EVENT_PARAMETER).addParseSpanInfo(ast.nameSpan);
16020
15745
  }
16021
15746
  return super.resolve(ast);
16022
15747
  }
@@ -16028,60 +15753,37 @@ function tcbCreateEventHandler(event, tcb, scope, eventType, assertionExpression
16028
15753
  const handler = tcbEventHandlerExpression(event.handler, tcb, scope);
16029
15754
  const statements = [];
16030
15755
  if (assertionExpression !== void 0) {
16031
- statements.push(ts76.factory.createExpressionStatement(assertionExpression));
15756
+ statements.push(assertionExpression);
16032
15757
  }
16033
15758
  if (event.type === ParsedEventType2.TwoWay && tcb.env.config.checkTwoWayBoundEvents) {
16034
15759
  const target = tcb.allocateId();
16035
- const assignment = ts76.factory.createBinaryExpression(target, ts76.SyntaxKind.EqualsToken, ts76.factory.createIdentifier(EVENT_PARAMETER));
16036
- statements.push(tsCreateVariable(target, tcb.env.config.allowSignalsInTwoWayBindings ? unwrapWritableSignal(handler, tcb) : handler), ts76.factory.createExpressionStatement(assignment));
15760
+ const initializer = tcb.env.config.allowSignalsInTwoWayBindings ? unwrapWritableSignal(handler, tcb) : handler;
15761
+ statements.push(new TcbExpr(`var ${target} = ${initializer.print()}`), new TcbExpr(`${target} = ${EVENT_PARAMETER}`));
16037
15762
  } else {
16038
- statements.push(ts76.factory.createExpressionStatement(handler));
15763
+ statements.push(handler);
16039
15764
  }
16040
15765
  let eventParamType;
16041
15766
  if (eventType === 0) {
16042
15767
  eventParamType = void 0;
16043
15768
  } else if (eventType === 1) {
16044
- eventParamType = ts76.factory.createKeywordTypeNode(ts76.SyntaxKind.AnyKeyword);
15769
+ eventParamType = "any";
16045
15770
  } else {
16046
15771
  eventParamType = eventType;
16047
15772
  }
16048
15773
  const guards = scope.guards();
16049
- let body = ts76.factory.createBlock(statements);
15774
+ let body = `{
15775
+ ${getStatementsBlock(statements)} }`;
16050
15776
  if (guards !== null) {
16051
- body = ts76.factory.createBlock([ts76.factory.createIfStatement(guards, body)]);
15777
+ body = `{ if (${guards.print()}) ${body} }`;
16052
15778
  }
16053
- const eventParam = ts76.factory.createParameterDeclaration(
16054
- /* modifiers */
16055
- void 0,
16056
- /* dotDotDotToken */
16057
- void 0,
16058
- /* name */
16059
- EVENT_PARAMETER,
16060
- /* questionToken */
16061
- void 0,
16062
- /* type */
16063
- eventParamType
16064
- );
16065
- addExpressionIdentifier(eventParam, ExpressionIdentifier.EVENT_PARAMETER);
16066
- return ts76.factory.createArrowFunction(
16067
- /* modifiers */
16068
- void 0,
16069
- /* typeParameters */
16070
- void 0,
16071
- /* parameters */
16072
- [eventParam],
16073
- /* type */
16074
- ts76.factory.createKeywordTypeNode(ts76.SyntaxKind.AnyKeyword),
16075
- /* equalsGreaterThanToken */
16076
- void 0,
16077
- /* body */
16078
- body
16079
- );
15779
+ const eventParam = new TcbExpr(`${EVENT_PARAMETER}${eventParamType === void 0 ? "" : ": " + eventParamType}`);
15780
+ eventParam.addExpressionIdentifier(ExpressionIdentifier.EVENT_PARAMETER);
15781
+ return new TcbExpr(`(${eventParam.print()}): any => ${body}`);
16080
15782
  }
16081
15783
 
16082
15784
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/directive_type.js
16083
15785
  import { TmplAstHostElement as TmplAstHostElement3 } from "@angular/compiler";
16084
- import ts77 from "typescript";
15786
+ import ts64 from "typescript";
16085
15787
  var TcbDirectiveTypeOpBase = class extends TcbOp {
16086
15788
  tcb;
16087
15789
  scope;
@@ -16103,23 +15805,21 @@ var TcbDirectiveTypeOpBase = class extends TcbOp {
16103
15805
  let type;
16104
15806
  let span;
16105
15807
  if (this.dir.isGeneric === false || dirRef.node.typeParameters === void 0) {
16106
- type = rawType;
15808
+ type = new TcbExpr(tempPrint(rawType, dirRef.node.getSourceFile()));
16107
15809
  } else {
16108
- if (!ts77.isTypeReferenceNode(rawType)) {
15810
+ if (!ts64.isTypeReferenceNode(rawType)) {
16109
15811
  throw new Error(`Expected TypeReferenceNode when referencing the type for ${this.dir.ref.debugName}`);
16110
15812
  }
16111
- const typeArguments = dirRef.node.typeParameters.map(() => ts77.factory.createKeywordTypeNode(ts77.SyntaxKind.AnyKeyword));
16112
- type = ts77.factory.createTypeReferenceNode(rawType.typeName, typeArguments);
15813
+ const typeArguments = dirRef.node.typeParameters.map(() => ts64.factory.createKeywordTypeNode(ts64.SyntaxKind.AnyKeyword));
15814
+ type = new TcbExpr(tempPrint(ts64.factory.createTypeReferenceNode(rawType.typeName, typeArguments), dirRef.node.getSourceFile()));
16113
15815
  }
16114
15816
  if (this.node instanceof TmplAstHostElement3) {
16115
15817
  span = this.node.sourceSpan;
16116
15818
  } else {
16117
15819
  span = this.node.startSourceSpan || this.node.sourceSpan;
16118
15820
  }
16119
- const id = this.tcb.allocateId();
16120
- addExpressionIdentifier(id, ExpressionIdentifier.DIRECTIVE);
16121
- addParseSpanInfo(id, span);
16122
- this.scope.addStatement(tsDeclareVariable(id, type));
15821
+ const id = new TcbExpr(this.tcb.allocateId()).addExpressionIdentifier(ExpressionIdentifier.DIRECTIVE).addParseSpanInfo(span);
15822
+ this.scope.addStatement(declareVariable(id, type));
16123
15823
  return id;
16124
15824
  }
16125
15825
  };
@@ -16148,7 +15848,6 @@ var TcbGenericDirectiveTypeWithAnyParamsOp = class extends TcbDirectiveTypeOpBas
16148
15848
 
16149
15849
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/directive_constructor.js
16150
15850
  import { TmplAstHostElement as TmplAstHostElement4 } from "@angular/compiler";
16151
- import ts78 from "typescript";
16152
15851
  var TcbDirectiveCtorOp = class extends TcbOp {
16153
15852
  tcb;
16154
15853
  scope;
@@ -16168,7 +15867,7 @@ var TcbDirectiveCtorOp = class extends TcbOp {
16168
15867
  }
16169
15868
  execute() {
16170
15869
  const genericInputs = /* @__PURE__ */ new Map();
16171
- const id = this.tcb.allocateId();
15870
+ const id = new TcbExpr(this.tcb.allocateId());
16172
15871
  let boundAttrs;
16173
15872
  let span;
16174
15873
  if (this.node instanceof TmplAstHostElement4) {
@@ -16184,8 +15883,7 @@ var TcbDirectiveCtorOp = class extends TcbOp {
16184
15883
  }
16185
15884
  }
16186
15885
  }
16187
- addExpressionIdentifier(id, ExpressionIdentifier.DIRECTIVE);
16188
- addParseSpanInfo(id, span);
15886
+ id.addExpressionIdentifier(ExpressionIdentifier.DIRECTIVE).addParseSpanInfo(span);
16189
15887
  for (const attr of boundAttrs) {
16190
15888
  if (!this.tcb.env.config.checkTypeOfAttributes && typeof attr.value === "string") {
16191
15889
  continue;
@@ -16199,6 +15897,7 @@ var TcbDirectiveCtorOp = class extends TcbOp {
16199
15897
  type: "binding",
16200
15898
  field: fieldName,
16201
15899
  expression,
15900
+ originalExpression: attr.value,
16202
15901
  sourceSpan: attr.sourceSpan,
16203
15902
  isTwoWayBinding
16204
15903
  });
@@ -16210,8 +15909,8 @@ var TcbDirectiveCtorOp = class extends TcbOp {
16210
15909
  }
16211
15910
  }
16212
15911
  const typeCtor = tcbCallTypeCtor(this.dir, this.tcb, Array.from(genericInputs.values()));
16213
- markIgnoreDiagnostics(typeCtor);
16214
- this.scope.addStatement(tsCreateVariable(id, typeCtor));
15912
+ typeCtor.markIgnoreDiagnostics();
15913
+ this.scope.addStatement(new TcbExpr(`var ${id.print()} = ${typeCtor.print()}`));
16215
15914
  return id;
16216
15915
  }
16217
15916
  circularFallback() {
@@ -16234,45 +15933,37 @@ var TcbDirectiveCtorCircularFallbackOp = class extends TcbOp {
16234
15933
  execute() {
16235
15934
  const id = this.tcb.allocateId();
16236
15935
  const typeCtor = this.tcb.env.typeCtorFor(this.dir);
16237
- const circularPlaceholder = ts78.factory.createCallExpression(
16238
- typeCtor,
16239
- /* typeArguments */
16240
- void 0,
16241
- [ts78.factory.createNonNullExpression(ts78.factory.createNull())]
16242
- );
16243
- this.scope.addStatement(tsCreateVariable(id, circularPlaceholder));
16244
- return id;
15936
+ this.scope.addStatement(new TcbExpr(`var ${id} = ${typeCtor.print()}(null!)`));
15937
+ return new TcbExpr(id);
16245
15938
  }
16246
15939
  };
16247
15940
  function tcbCallTypeCtor(dir, tcb, inputs) {
16248
15941
  const typeCtor = tcb.env.typeCtorFor(dir);
16249
- const members = inputs.map((input) => {
16250
- const propertyName = ts78.factory.createStringLiteral(input.field);
15942
+ let literal4 = "{ ";
15943
+ for (let i = 0; i < inputs.length; i++) {
15944
+ const input = inputs[i];
15945
+ const propertyName = quoteAndEscape(input.field);
15946
+ const isLast = i === inputs.length - 1;
16251
15947
  if (input.type === "binding") {
16252
- let expr = widenBinding(input.expression, tcb);
15948
+ let expr = widenBinding(input.expression, tcb, input.originalExpression);
16253
15949
  if (input.isTwoWayBinding && tcb.env.config.allowSignalsInTwoWayBindings) {
16254
15950
  expr = unwrapWritableSignal(expr, tcb);
16255
15951
  }
16256
- const assignment = ts78.factory.createPropertyAssignment(propertyName, wrapForDiagnostics(expr));
16257
- addParseSpanInfo(assignment, input.sourceSpan);
16258
- return assignment;
15952
+ const assignment = new TcbExpr(`${propertyName}: ${expr.wrapForTypeChecker().print()}`);
15953
+ assignment.addParseSpanInfo(input.sourceSpan);
15954
+ literal4 += assignment.print();
16259
15955
  } else {
16260
- return ts78.factory.createPropertyAssignment(propertyName, getAnyExpression());
15956
+ literal4 += `${propertyName}: 0 as any`;
16261
15957
  }
16262
- });
16263
- return ts78.factory.createCallExpression(
16264
- /* expression */
16265
- typeCtor,
16266
- /* typeArguments */
16267
- void 0,
16268
- /* argumentsArray */
16269
- [ts78.factory.createObjectLiteralExpression(members)]
16270
- );
15958
+ literal4 += `${isLast ? "" : ","} `;
15959
+ }
15960
+ literal4 += "}";
15961
+ return new TcbExpr(`${typeCtor.print()}(${literal4})`);
16271
15962
  }
16272
15963
 
16273
15964
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/content_projection.js
16274
15965
  import { createCssSelectorFromNode, CssSelector as CssSelector3, SelectorMatcher as SelectorMatcher2, TmplAstElement as TmplAstElement7, TmplAstForLoopBlock, TmplAstIfBlock, TmplAstSwitchBlock, TmplAstTemplate as TmplAstTemplate4, TmplAstText } from "@angular/compiler";
16275
- import ts79 from "typescript";
15966
+ import ts65 from "typescript";
16276
15967
  var TcbControlFlowContentProjectionOp = class extends TcbOp {
16277
15968
  tcb;
16278
15969
  element;
@@ -16285,7 +15976,7 @@ var TcbControlFlowContentProjectionOp = class extends TcbOp {
16285
15976
  this.element = element;
16286
15977
  this.ngContentSelectors = ngContentSelectors;
16287
15978
  this.componentName = componentName;
16288
- this.category = tcb.env.config.controlFlowPreventingContentProjection === "error" ? ts79.DiagnosticCategory.Error : ts79.DiagnosticCategory.Warning;
15979
+ this.category = tcb.env.config.controlFlowPreventingContentProjection === "error" ? ts65.DiagnosticCategory.Error : ts65.DiagnosticCategory.Warning;
16289
15980
  }
16290
15981
  optional = false;
16291
15982
  execute() {
@@ -16353,7 +16044,6 @@ var TcbControlFlowContentProjectionOp = class extends TcbOp {
16353
16044
  };
16354
16045
 
16355
16046
  // packages/compiler-cli/src/ngtsc/typecheck/src/ops/intersection_observer.js
16356
- import ts80 from "typescript";
16357
16047
  var TcbIntersectionObserverOp = class extends TcbOp {
16358
16048
  tcb;
16359
16049
  scope;
@@ -16367,9 +16057,7 @@ var TcbIntersectionObserverOp = class extends TcbOp {
16367
16057
  optional = false;
16368
16058
  execute() {
16369
16059
  const options = tcbExpression(this.options, this.tcb, this.scope);
16370
- const callback = ts80.factory.createNonNullExpression(ts80.factory.createNull());
16371
- const expression = ts80.factory.createNewExpression(ts80.factory.createIdentifier("IntersectionObserver"), void 0, [callback, options]);
16372
- this.scope.addStatement(ts80.factory.createExpressionStatement(expression));
16060
+ this.scope.addStatement(new TcbExpr(`new IntersectionObserver(null!, ${options.print()})`));
16373
16061
  return null;
16374
16062
  }
16375
16063
  };
@@ -16388,10 +16076,16 @@ var TcbHostElementOp = class extends TcbOp {
16388
16076
  }
16389
16077
  execute() {
16390
16078
  const id = this.tcb.allocateId();
16391
- const initializer = tsCreateElement(...this.element.tagNames);
16392
- addParseSpanInfo(initializer, this.element.sourceSpan);
16393
- this.scope.addStatement(tsCreateVariable(id, initializer));
16394
- return id;
16079
+ let tagNames;
16080
+ if (this.element.tagNames.length === 1) {
16081
+ tagNames = `"${this.element.tagNames[0]}"`;
16082
+ } else {
16083
+ tagNames = `null! as ${this.element.tagNames.map((t) => `"${t}"`).join(" | ")}`;
16084
+ }
16085
+ const initializer = new TcbExpr(`document.createElement(${tagNames})`);
16086
+ initializer.addParseSpanInfo(this.element.sourceSpan);
16087
+ this.scope.addStatement(new TcbExpr(`var ${id} = ${initializer.print()}`));
16088
+ return new TcbExpr(id);
16395
16089
  }
16396
16090
  };
16397
16091
 
@@ -16403,7 +16097,7 @@ var Scope = class _Scope {
16403
16097
  /**
16404
16098
  * A queue of operations which need to be performed to generate the TCB code for this scope.
16405
16099
  *
16406
- * This array can contain either a `TcbOp` which has yet to be executed, or a `ts.Expression|null`
16100
+ * This array can contain either a `TcbOp` which has yet to be executed, or a `TcbExpr|null`
16407
16101
  * representing the memoized result of executing the operation. As operations are executed, their
16408
16102
  * results are written into the `opQueue`, overwriting the original operation.
16409
16103
  *
@@ -16463,12 +16157,12 @@ var Scope = class _Scope {
16463
16157
  */
16464
16158
  static getForLoopContextVariableTypes() {
16465
16159
  return /* @__PURE__ */ new Map([
16466
- ["$first", ts81.SyntaxKind.BooleanKeyword],
16467
- ["$last", ts81.SyntaxKind.BooleanKeyword],
16468
- ["$even", ts81.SyntaxKind.BooleanKeyword],
16469
- ["$odd", ts81.SyntaxKind.BooleanKeyword],
16470
- ["$index", ts81.SyntaxKind.NumberKeyword],
16471
- ["$count", ts81.SyntaxKind.NumberKeyword]
16160
+ ["$first", "boolean"],
16161
+ ["$last", "boolean"],
16162
+ ["$even", "boolean"],
16163
+ ["$odd", "boolean"],
16164
+ ["$index", "number"],
16165
+ ["$count", "number"]
16472
16166
  ]);
16473
16167
  }
16474
16168
  constructor(tcb, parent = null, guard = null) {
@@ -16509,15 +16203,15 @@ var Scope = class _Scope {
16509
16203
  _Scope.registerVariable(scope, expressionAlias, new TcbBlockVariableOp(tcb, scope, tcbExpression(expression, tcb, scope), expressionAlias));
16510
16204
  }
16511
16205
  } else if (scopedNode instanceof TmplAstForLoopBlock2) {
16512
- const loopInitializer = tcb.allocateId();
16513
- addParseSpanInfo(loopInitializer, scopedNode.item.sourceSpan);
16206
+ const loopInitializer = new TcbExpr(tcb.allocateId());
16207
+ loopInitializer.addParseSpanInfo(scopedNode.item.sourceSpan);
16514
16208
  scope.varMap.set(scopedNode.item, loopInitializer);
16515
16209
  const forLoopContextVariableTypes = _Scope.getForLoopContextVariableTypes();
16516
16210
  for (const variable of scopedNode.contextVariables) {
16517
16211
  if (!forLoopContextVariableTypes.has(variable.value)) {
16518
16212
  throw new Error(`Unrecognized for loop context variable ${variable.name}`);
16519
16213
  }
16520
- const type = ts81.factory.createKeywordTypeNode(forLoopContextVariableTypes.get(variable.value));
16214
+ const type = new TcbExpr(forLoopContextVariableTypes.get(variable.value));
16521
16215
  _Scope.registerVariable(scope, variable, new TcbBlockImplicitVariableOp(tcb, scope, type, variable));
16522
16216
  }
16523
16217
  } else if (scopedNode instanceof TmplAstHostElement5) {
@@ -16563,17 +16257,7 @@ var Scope = class _Scope {
16563
16257
  resolve(node, directive) {
16564
16258
  const res = this.resolveLocal(node, directive);
16565
16259
  if (res !== null) {
16566
- let clone;
16567
- if (ts81.isIdentifier(res)) {
16568
- clone = ts81.factory.createIdentifier(res.text);
16569
- } else if (ts81.isNonNullExpression(res)) {
16570
- clone = ts81.factory.createNonNullExpression(res.expression);
16571
- } else {
16572
- throw new Error(`Could not resolve ${node} to an Identifier or a NonNullExpression`);
16573
- }
16574
- ts81.setOriginalNode(clone, res);
16575
- clone.parent = clone.parent;
16576
- return ts81.setSyntheticTrailingComments(clone, []);
16260
+ return res;
16577
16261
  } else if (this.parent !== null) {
16578
16262
  return this.parent.resolve(node, directive);
16579
16263
  } else {
@@ -16608,9 +16292,10 @@ var Scope = class _Scope {
16608
16292
  if (this.guard === null) {
16609
16293
  return parentGuards;
16610
16294
  } else if (parentGuards === null) {
16611
- return this.guard;
16295
+ return typeof this.guard === "string" ? new TcbExpr(this.guard) : this.guard;
16612
16296
  } else {
16613
- return ts81.factory.createBinaryExpression(parentGuards, ts81.SyntaxKind.AmpersandAmpersandToken, this.guard);
16297
+ const guard = typeof this.guard === "string" ? this.guard : this.guard.print();
16298
+ return new TcbExpr(`(${parentGuards.print()}) && (${guard})`);
16614
16299
  }
16615
16300
  }
16616
16301
  /** Returns whether a template symbol is defined locally within the current scope. */
@@ -16644,7 +16329,10 @@ var Scope = class _Scope {
16644
16329
  return this.resolveOp(this.letDeclOpMap.get(ref.name).opIndex);
16645
16330
  } else if (ref instanceof TmplAstVariable2 && this.varMap.has(ref)) {
16646
16331
  const opIndexOrNode = this.varMap.get(ref);
16647
- return typeof opIndexOrNode === "number" ? this.resolveOp(opIndexOrNode) : opIndexOrNode;
16332
+ return typeof opIndexOrNode === "number" ? this.resolveOp(opIndexOrNode) : new TcbExpr(opIndexOrNode.print(
16333
+ true
16334
+ /* ignoreComments */
16335
+ ));
16648
16336
  } else if (ref instanceof TmplAstTemplate5 && directive === void 0 && this.templateCtxOpMap.has(ref)) {
16649
16337
  return this.resolveOp(this.templateCtxOpMap.get(ref));
16650
16338
  } else if ((ref instanceof TmplAstElement8 || ref instanceof TmplAstTemplate5 || ref instanceof TmplAstComponent3 || ref instanceof TmplAstDirective2 || ref instanceof TmplAstHostElement5) && directive !== void 0 && this.directiveOpMap.has(ref)) {
@@ -16661,7 +16349,7 @@ var Scope = class _Scope {
16661
16349
  }
16662
16350
  }
16663
16351
  /**
16664
- * Like `executeOp`, but assert that the operation actually returned `ts.Expression`.
16352
+ * Like `executeOp`, but assert that the operation actually returned `TcbExpr`.
16665
16353
  */
16666
16354
  resolveOp(opIndex) {
16667
16355
  const res = this.executeOp(
@@ -16684,13 +16372,22 @@ var Scope = class _Scope {
16684
16372
  executeOp(opIndex, skipOptional) {
16685
16373
  const op = this.opQueue[opIndex];
16686
16374
  if (!(op instanceof TcbOp)) {
16687
- return op;
16375
+ return op === null ? null : new TcbExpr(op.print(
16376
+ true
16377
+ /* ignoreComments */
16378
+ ));
16688
16379
  }
16689
16380
  if (skipOptional && op.optional) {
16690
16381
  return null;
16691
16382
  }
16692
16383
  this.opQueue[opIndex] = op.circularFallback();
16693
- const res = op.execute();
16384
+ let res = op.execute();
16385
+ if (res !== null) {
16386
+ res = new TcbExpr(res.print(
16387
+ true
16388
+ /* ignoreComments */
16389
+ ));
16390
+ }
16694
16391
  this.opQueue[opIndex] = res;
16695
16392
  return res;
16696
16393
  }
@@ -17070,7 +16767,7 @@ var Scope = class _Scope {
17070
16767
  function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
17071
16768
  const tcb = new Context2(env, domSchemaChecker, oobRecorder, meta.id, meta.boundTarget, meta.pipes, meta.schemas, meta.isStandalone, meta.preserveWhitespaces);
17072
16769
  const ctxRawType = env.referenceType(ref);
17073
- if (!ts82.isTypeReferenceNode(ctxRawType)) {
16770
+ if (!ts66.isTypeReferenceNode(ctxRawType)) {
17074
16771
  throw new Error(`Expected TypeReferenceNode when referencing the ctx param for ${ref.debugName}`);
17075
16772
  }
17076
16773
  let typeParameters = void 0;
@@ -17081,19 +16778,23 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
17081
16778
  }
17082
16779
  switch (genericContextBehavior) {
17083
16780
  case TcbGenericContextBehavior.UseEmitter:
17084
- typeParameters = new TypeParameterEmitter(ref.node.typeParameters, env.reflector).emit((typeRef) => env.referenceType(typeRef));
17085
- typeArguments = typeParameters.map((param) => ts82.factory.createTypeReferenceNode(param.name));
16781
+ typeParameters = new TypeParameterEmitter(ref.node.typeParameters, env.reflector).emit((typeRef2) => env.referenceType(typeRef2));
16782
+ typeArguments = typeParameters.map((param) => ts66.factory.createTypeReferenceNode(param.name));
17086
16783
  break;
17087
16784
  case TcbGenericContextBehavior.CopyClassNodes:
17088
16785
  typeParameters = [...ref.node.typeParameters];
17089
- typeArguments = typeParameters.map((param) => ts82.factory.createTypeReferenceNode(param.name));
16786
+ typeArguments = typeParameters.map((param) => ts66.factory.createTypeReferenceNode(param.name));
17090
16787
  break;
17091
16788
  case TcbGenericContextBehavior.FallbackToAny:
17092
- typeArguments = ref.node.typeParameters.map(() => ts82.factory.createKeywordTypeNode(ts82.SyntaxKind.AnyKeyword));
16789
+ typeArguments = ref.node.typeParameters.map(() => ts66.factory.createKeywordTypeNode(ts66.SyntaxKind.AnyKeyword));
17093
16790
  break;
17094
16791
  }
17095
16792
  }
17096
- const paramList = [tcbThisParam(ctxRawType.typeName, typeArguments)];
16793
+ const sourceFile = env.contextFile;
16794
+ const typeParamsStr = typeParameters === void 0 || typeParameters.length === 0 ? "" : `<${typeParameters.map((p) => tempPrint(p, sourceFile)).join(", ")}>`;
16795
+ const typeArgsStr = typeArguments === void 0 || typeArguments.length === 0 ? "" : `<${typeArguments.map((p) => tempPrint(p, sourceFile)).join(", ")}>`;
16796
+ const typeRef = ts66.isIdentifier(ctxRawType.typeName) ? ctxRawType.typeName.text : tempPrint(ctxRawType.typeName, sourceFile);
16797
+ const thisParamStr = `this: ${typeRef}${typeArgsStr}`;
17097
16798
  const statements = [];
17098
16799
  if (tcb.boundTarget.target.template !== void 0) {
17099
16800
  const templateScope = Scope.forNodes(
@@ -17104,56 +16805,29 @@ function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecor
17104
16805
  /* guard */
17105
16806
  null
17106
16807
  );
17107
- statements.push(renderBlockStatements(env, templateScope, ts82.factory.createTrue()));
16808
+ statements.push(renderBlockStatements(env, templateScope, "true"));
17108
16809
  }
17109
16810
  if (tcb.boundTarget.target.host !== void 0) {
17110
16811
  const hostScope = Scope.forNodes(tcb, null, tcb.boundTarget.target.host.node, null, null);
17111
16812
  statements.push(renderBlockStatements(env, hostScope, createHostBindingsBlockGuard()));
17112
16813
  }
17113
- const body = ts82.factory.createBlock(statements);
17114
- const fnDecl = ts82.factory.createFunctionDeclaration(
17115
- /* modifiers */
17116
- void 0,
17117
- /* asteriskToken */
17118
- void 0,
17119
- /* name */
17120
- name,
17121
- /* typeParameters */
17122
- env.config.useContextGenericType ? typeParameters : void 0,
17123
- /* parameters */
17124
- paramList,
17125
- /* type */
17126
- void 0,
17127
- /* body */
17128
- body
17129
- );
17130
- addTypeCheckId(fnDecl, meta.id);
17131
- return fnDecl;
16814
+ const bodyStr = `{
16815
+ ${statements.join("\n")}
16816
+ }`;
16817
+ const funcDeclStr = `function ${name.text}${typeParamsStr}(${thisParamStr}) ${bodyStr}`;
16818
+ return `/*${meta.id}*/
16819
+ ${funcDeclStr}`;
17132
16820
  }
17133
16821
  function renderBlockStatements(env, scope, wrapperExpression) {
17134
16822
  const scopeStatements = scope.render();
17135
- const innerBody = ts82.factory.createBlock([...env.getPreludeStatements(), ...scopeStatements]);
17136
- return ts82.factory.createIfStatement(wrapperExpression, innerBody);
17137
- }
17138
- function tcbThisParam(name, typeArguments) {
17139
- return ts82.factory.createParameterDeclaration(
17140
- /* modifiers */
17141
- void 0,
17142
- /* dotDotDotToken */
17143
- void 0,
17144
- /* name */
17145
- "this",
17146
- /* questionToken */
17147
- void 0,
17148
- /* type */
17149
- ts82.factory.createTypeReferenceNode(name, typeArguments),
17150
- /* initializer */
17151
- void 0
17152
- );
16823
+ const statements = getStatementsBlock([...env.getPreludeStatements(), ...scopeStatements]);
16824
+ return `if (${wrapperExpression}) {
16825
+ ${statements}
16826
+ }`;
17153
16827
  }
17154
16828
 
17155
16829
  // packages/compiler-cli/src/ngtsc/typecheck/src/type_check_file.js
17156
- import ts83 from "typescript";
16830
+ import ts67 from "typescript";
17157
16831
  var TypeCheckFile = class extends Environment {
17158
16832
  fileName;
17159
16833
  nextTcbId = 1;
@@ -17165,36 +16839,32 @@ var TypeCheckFile = class extends Environment {
17165
16839
  // Type check block code affects code completion and fix suggestions.
17166
16840
  // We want to encourage single quotes for now, like we always did.
17167
16841
  shouldUseSingleQuotes: () => true
17168
- }), refEmitter, reflector, ts83.createSourceFile(compilerHost.getCanonicalFileName(fileName), "", ts83.ScriptTarget.Latest, true));
16842
+ }), refEmitter, reflector, ts67.createSourceFile(compilerHost.getCanonicalFileName(fileName), "", ts67.ScriptTarget.Latest, true));
17169
16843
  this.fileName = fileName;
17170
16844
  }
17171
16845
  addTypeCheckBlock(ref, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
17172
- const fnId = ts83.factory.createIdentifier(`_tcb${this.nextTcbId++}`);
16846
+ const fnId = ts67.factory.createIdentifier(`_tcb${this.nextTcbId++}`);
17173
16847
  const fn = generateTypeCheckBlock(this, ref, fnId, meta, domSchemaChecker, oobRecorder, genericContextBehavior);
17174
16848
  this.tcbStatements.push(fn);
17175
16849
  }
17176
- render(removeComments) {
16850
+ render() {
17177
16851
  ensureTypeCheckFilePreparationImports(this);
17178
16852
  const importChanges = this.importManager.finalize();
17179
16853
  if (importChanges.updatedImports.size > 0) {
17180
16854
  throw new Error("AssertionError: Expected no imports to be updated for a new type check file.");
17181
16855
  }
17182
- const printer = ts83.createPrinter({ removeComments });
16856
+ const printer = ts67.createPrinter();
17183
16857
  let source = "";
17184
16858
  const newImports = importChanges.newImports.get(this.contextFile.fileName);
17185
16859
  if (newImports !== void 0) {
17186
- source += newImports.map((i) => printer.printNode(ts83.EmitHint.Unspecified, i, this.contextFile)).join("\n");
16860
+ source += newImports.map((i) => printer.printNode(ts67.EmitHint.Unspecified, i, this.contextFile)).join("\n");
17187
16861
  }
17188
16862
  source += "\n";
17189
- for (const stmt of this.pipeInstStatements) {
17190
- source += printer.printNode(ts83.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
17191
- }
17192
- for (const stmt of this.typeCtorStatements) {
17193
- source += printer.printNode(ts83.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
17194
- }
16863
+ source += getStatementsBlock(this.pipeInstStatements);
16864
+ source += getStatementsBlock(this.typeCtorStatements);
17195
16865
  source += "\n";
17196
16866
  for (const stmt of this.tcbStatements) {
17197
- source += printer.printNode(ts83.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
16867
+ source += stmt + "\n";
17198
16868
  }
17199
16869
  source += "\nexport const IS_A_MODULE = true;\n";
17200
16870
  return source;
@@ -17360,7 +17030,7 @@ var TypeCheckContextImpl = class {
17360
17030
  if (!this.opMap.has(sf)) {
17361
17031
  return null;
17362
17032
  }
17363
- const printer = ts84.createPrinter({ omitTrailingSemicolon: true });
17033
+ const printer = ts68.createPrinter({ omitTrailingSemicolon: true });
17364
17034
  const importManager = new ImportManager({
17365
17035
  // This minimizes noticeable changes with older versions of `ImportManager`.
17366
17036
  forceGenerateNamespacesForNewImports: true,
@@ -17371,7 +17041,7 @@ var TypeCheckContextImpl = class {
17371
17041
  const updates = this.opMap.get(sf).map((op) => {
17372
17042
  return {
17373
17043
  pos: op.splitPoint,
17374
- text: op.execute(importManager, sf, this.refEmitter, printer)
17044
+ text: op.execute(importManager, sf, this.refEmitter)
17375
17045
  };
17376
17046
  });
17377
17047
  const { newImports, updatedImports } = importManager.finalize();
@@ -17379,7 +17049,7 @@ var TypeCheckContextImpl = class {
17379
17049
  newImports.get(sf.fileName).forEach((newImport) => {
17380
17050
  updates.push({
17381
17051
  pos: 0,
17382
- text: printer.printNode(ts84.EmitHint.Unspecified, newImport, sf)
17052
+ text: printer.printNode(ts68.EmitHint.Unspecified, newImport, sf)
17383
17053
  });
17384
17054
  });
17385
17055
  }
@@ -17390,7 +17060,7 @@ var TypeCheckContextImpl = class {
17390
17060
  updates.push({
17391
17061
  pos: oldBindings.getStart(),
17392
17062
  deletePos: oldBindings.getEnd(),
17393
- text: printer.printNode(ts84.EmitHint.Unspecified, newBindings, sf)
17063
+ text: printer.printNode(ts68.EmitHint.Unspecified, newBindings, sf)
17394
17064
  });
17395
17065
  }
17396
17066
  const result = new MagicString(sf.text, { filename: sf.fileName });
@@ -17424,10 +17094,7 @@ var TypeCheckContextImpl = class {
17424
17094
  path: pendingShimData.file.fileName,
17425
17095
  data: pendingShimData.data
17426
17096
  });
17427
- const sfText = pendingShimData.file.render(
17428
- false
17429
- /* removeComments */
17430
- );
17097
+ const sfText = pendingShimData.file.render();
17431
17098
  updates.set(pendingShimData.file.fileName, {
17432
17099
  newText: sfText,
17433
17100
  // Shim files do not have an associated original file.
@@ -17478,7 +17145,7 @@ function getTemplateDiagnostics(parseErrors, templateId, sourceMapping) {
17478
17145
  if (span.start.offset === span.end.offset) {
17479
17146
  span.end.offset++;
17480
17147
  }
17481
- return makeTemplateDiagnostic(templateId, sourceMapping, span, ts84.DiagnosticCategory.Error, ngErrorCode(ErrorCode.TEMPLATE_PARSE_ERROR), error.msg);
17148
+ return makeTemplateDiagnostic(templateId, sourceMapping, span, ts68.DiagnosticCategory.Error, ngErrorCode(ErrorCode.TEMPLATE_PARSE_ERROR), error.msg);
17482
17149
  });
17483
17150
  }
17484
17151
  var InlineTcbOp = class {
@@ -17502,11 +17169,11 @@ var InlineTcbOp = class {
17502
17169
  get splitPoint() {
17503
17170
  return this.ref.node.end + 1;
17504
17171
  }
17505
- execute(im, sf, refEmitter, printer) {
17172
+ execute(im, sf, refEmitter) {
17506
17173
  const env = new Environment(this.config, im, refEmitter, this.reflector, sf);
17507
- const fnName = ts84.factory.createIdentifier(`_tcb_${this.ref.node.pos}`);
17174
+ const fnName = ts68.factory.createIdentifier(`_tcb_${this.ref.node.pos}`);
17508
17175
  const fn = generateTypeCheckBlock(env, this.ref, fnName, this.meta, this.domSchemaChecker, this.oobRecorder, TcbGenericContextBehavior.CopyClassNodes);
17509
- return printer.printNode(ts84.EmitHint.Unspecified, fn, sf);
17176
+ return fn;
17510
17177
  }
17511
17178
  };
17512
17179
  var TypeCtorOp = class {
@@ -17524,13 +17191,49 @@ var TypeCtorOp = class {
17524
17191
  get splitPoint() {
17525
17192
  return this.ref.node.end - 1;
17526
17193
  }
17527
- execute(im, sf, refEmitter, printer) {
17194
+ execute(im, sf, refEmitter) {
17528
17195
  const emitEnv = new ReferenceEmitEnvironment(im, refEmitter, this.reflector, sf);
17529
- const tcb = generateInlineTypeCtor(emitEnv, this.ref.node, this.meta);
17530
- return printer.printNode(ts84.EmitHint.Unspecified, tcb, sf);
17196
+ return generateInlineTypeCtor(emitEnv, this.ref.node, this.meta);
17531
17197
  }
17532
17198
  };
17533
17199
 
17200
+ // packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.js
17201
+ import { AbsoluteSourceSpan as AbsoluteSourceSpan5 } from "@angular/compiler";
17202
+ import ts69 from "typescript";
17203
+ function shouldReportDiagnostic(diagnostic) {
17204
+ const { code } = diagnostic;
17205
+ if (code === 6133) {
17206
+ return false;
17207
+ } else if (code === 6199) {
17208
+ return false;
17209
+ } else if (code === 2695) {
17210
+ return false;
17211
+ } else if (code === 7006) {
17212
+ return false;
17213
+ }
17214
+ return true;
17215
+ }
17216
+ function translateDiagnostic(diagnostic, resolver) {
17217
+ if (diagnostic.file === void 0 || diagnostic.start === void 0) {
17218
+ return null;
17219
+ }
17220
+ const fullMapping = getSourceMapping(
17221
+ diagnostic.file,
17222
+ diagnostic.start,
17223
+ resolver,
17224
+ /*isDiagnosticsRequest*/
17225
+ true
17226
+ );
17227
+ if (fullMapping === null) {
17228
+ return null;
17229
+ }
17230
+ const { sourceLocation, sourceMapping: templateSourceMapping, span } = fullMapping;
17231
+ return makeTemplateDiagnostic(sourceLocation.id, templateSourceMapping, span, diagnostic.category, diagnostic.code, diagnostic.messageText, void 0, diagnostic.reportsDeprecated !== void 0 ? {
17232
+ reportsDeprecated: diagnostic.reportsDeprecated,
17233
+ relatedMessages: diagnostic.relatedInformation
17234
+ } : void 0);
17235
+ }
17236
+
17534
17237
  // packages/compiler-cli/src/ngtsc/typecheck/src/source.js
17535
17238
  import { ParseLocation as ParseLocation2, ParseSourceSpan as ParseSourceSpan3 } from "@angular/compiler";
17536
17239
 
@@ -17649,7 +17352,7 @@ var DirectiveSourceManager = class {
17649
17352
 
17650
17353
  // packages/compiler-cli/src/ngtsc/typecheck/src/template_symbol_builder.js
17651
17354
  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";
17652
- import ts85 from "typescript";
17355
+ import ts70 from "typescript";
17653
17356
  var SymbolBuilder = class {
17654
17357
  tcbPath;
17655
17358
  tcbIsShim;
@@ -17706,7 +17409,7 @@ var SymbolBuilder = class {
17706
17409
  const elementSourceSpan = element.startSourceSpan ?? element.sourceSpan;
17707
17410
  const node = findFirstMatchingNode(this.typeCheckBlock, {
17708
17411
  withSpan: elementSourceSpan,
17709
- filter: ts85.isVariableDeclaration
17412
+ filter: ts70.isVariableDeclaration
17710
17413
  });
17711
17414
  if (node === null) {
17712
17415
  return null;
@@ -17763,7 +17466,7 @@ var SymbolBuilder = class {
17763
17466
  const seenDirectives = /* @__PURE__ */ new Set();
17764
17467
  for (const node of nodes) {
17765
17468
  const symbol = this.getSymbolOfTsNode(node.parent);
17766
- if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts85.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
17469
+ if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts70.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
17767
17470
  continue;
17768
17471
  }
17769
17472
  const declaration = symbol.tsSymbol.valueDeclaration;
@@ -17798,7 +17501,7 @@ var SymbolBuilder = class {
17798
17501
  throw new Error("Impossible state: typecheck code path in local compilation mode.");
17799
17502
  }
17800
17503
  const node = current.directive.node;
17801
- if (!ts85.isClassDeclaration(node) || seenDirectives.has(node)) {
17504
+ if (!ts70.isClassDeclaration(node) || seenDirectives.has(node)) {
17802
17505
  continue;
17803
17506
  }
17804
17507
  const symbol = this.getSymbolOfTsNode(node);
@@ -17888,10 +17591,10 @@ var SymbolBuilder = class {
17888
17591
  if (!isAccessExpression(n2)) {
17889
17592
  return false;
17890
17593
  }
17891
- if (ts85.isPropertyAccessExpression(n2)) {
17594
+ if (ts70.isPropertyAccessExpression(n2)) {
17892
17595
  return n2.name.getText() === expectedAccess;
17893
17596
  } else {
17894
- return ts85.isStringLiteral(n2.argumentExpression) && n2.argumentExpression.text === expectedAccess;
17597
+ return ts70.isStringLiteral(n2.argumentExpression) && n2.argumentExpression.text === expectedAccess;
17895
17598
  }
17896
17599
  }
17897
17600
  const outputFieldAccesses = findAllMatchingNodes(this.typeCheckBlock, {
@@ -17901,7 +17604,7 @@ var SymbolBuilder = class {
17901
17604
  const bindings = [];
17902
17605
  for (const outputFieldAccess of outputFieldAccesses) {
17903
17606
  if (consumer instanceof TmplAstTemplate6 || consumer instanceof TmplAstElement9) {
17904
- if (!ts85.isPropertyAccessExpression(outputFieldAccess)) {
17607
+ if (!ts70.isPropertyAccessExpression(outputFieldAccess)) {
17905
17608
  continue;
17906
17609
  }
17907
17610
  const addEventListener = outputFieldAccess.name;
@@ -17924,7 +17627,7 @@ var SymbolBuilder = class {
17924
17627
  }
17925
17628
  });
17926
17629
  } else {
17927
- if (!ts85.isElementAccessExpression(outputFieldAccess)) {
17630
+ if (!ts70.isElementAccessExpression(outputFieldAccess)) {
17928
17631
  continue;
17929
17632
  }
17930
17633
  const tsSymbol = this.getTypeChecker().getSymbolAtLocation(outputFieldAccess.argumentExpression);
@@ -17977,7 +17680,7 @@ var SymbolBuilder = class {
17977
17680
  let fieldAccessExpr;
17978
17681
  let symbolInfo = null;
17979
17682
  if (signalInputAssignment !== null) {
17980
- if (ts85.isIdentifier(signalInputAssignment.fieldExpr)) {
17683
+ if (ts70.isIdentifier(signalInputAssignment.fieldExpr)) {
17981
17684
  continue;
17982
17685
  }
17983
17686
  const fieldSymbol = this.getSymbolOfTsNode(signalInputAssignment.fieldExpr);
@@ -18017,7 +17720,7 @@ var SymbolBuilder = class {
18017
17720
  return null;
18018
17721
  }
18019
17722
  const [declaration] = tsSymbol.declarations;
18020
- if (!ts85.isVariableDeclaration(declaration) || !hasExpressionIdentifier(
17723
+ if (!ts70.isVariableDeclaration(declaration) || !hasExpressionIdentifier(
18021
17724
  // The expression identifier could be on the type (for regular directives) or the name
18022
17725
  // (for generic directives and the ctor op).
18023
17726
  declaration.getSourceFile(),
@@ -18027,7 +17730,7 @@ var SymbolBuilder = class {
18027
17730
  return null;
18028
17731
  }
18029
17732
  const symbol = this.getSymbolOfTsNode(declaration);
18030
- if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts85.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
17733
+ if (symbol === null || !isSymbolWithValueDeclaration(symbol.tsSymbol) || !ts70.isClassDeclaration(symbol.tsSymbol.valueDeclaration)) {
18031
17734
  return null;
18032
17735
  }
18033
17736
  const ref = new Reference(symbol.tsSymbol.valueDeclaration);
@@ -18051,13 +17754,13 @@ var SymbolBuilder = class {
18051
17754
  getSymbolOfVariable(variable) {
18052
17755
  const node = findFirstMatchingNode(this.typeCheckBlock, {
18053
17756
  withSpan: variable.sourceSpan,
18054
- filter: ts85.isVariableDeclaration
17757
+ filter: ts70.isVariableDeclaration
18055
17758
  });
18056
17759
  if (node === null) {
18057
17760
  return null;
18058
17761
  }
18059
17762
  let nodeValueSymbol = null;
18060
- if (ts85.isForOfStatement(node.parent.parent)) {
17763
+ if (ts70.isForOfStatement(node.parent.parent)) {
18061
17764
  nodeValueSymbol = this.getSymbolOfTsNode(node);
18062
17765
  } else if (node.initializer !== void 0) {
18063
17766
  nodeValueSymbol = this.getSymbolOfTsNode(node.initializer);
@@ -18082,12 +17785,12 @@ var SymbolBuilder = class {
18082
17785
  const target = this.typeCheckData.boundTarget.getReferenceTarget(ref);
18083
17786
  let node = findFirstMatchingNode(this.typeCheckBlock, {
18084
17787
  withSpan: ref.sourceSpan,
18085
- filter: ts85.isVariableDeclaration
17788
+ filter: ts70.isVariableDeclaration
18086
17789
  });
18087
17790
  if (node === null || target === null || node.initializer === void 0) {
18088
17791
  return null;
18089
17792
  }
18090
- const originalDeclaration = ts85.isParenthesizedExpression(node.initializer) && ts85.isAsExpression(node.initializer.expression) ? this.getTypeChecker().getSymbolAtLocation(node.name) : this.getTypeChecker().getSymbolAtLocation(node.initializer);
17793
+ const originalDeclaration = ts70.isParenthesizedExpression(node.initializer) && ts70.isAsExpression(node.initializer.expression) ? this.getTypeChecker().getSymbolAtLocation(node.name) : this.getTypeChecker().getSymbolAtLocation(node.initializer);
18091
17794
  if (originalDeclaration === void 0 || originalDeclaration.valueDeclaration === void 0) {
18092
17795
  return null;
18093
17796
  }
@@ -18111,7 +17814,7 @@ var SymbolBuilder = class {
18111
17814
  referenceVarLocation: referenceVarTcbLocation
18112
17815
  };
18113
17816
  } else {
18114
- if (!ts85.isClassDeclaration(target.directive.ref.node)) {
17817
+ if (!ts70.isClassDeclaration(target.directive.ref.node)) {
18115
17818
  return null;
18116
17819
  }
18117
17820
  return {
@@ -18128,7 +17831,7 @@ var SymbolBuilder = class {
18128
17831
  getSymbolOfLetDeclaration(decl) {
18129
17832
  const node = findFirstMatchingNode(this.typeCheckBlock, {
18130
17833
  withSpan: decl.sourceSpan,
18131
- filter: ts85.isVariableDeclaration
17834
+ filter: ts70.isVariableDeclaration
18132
17835
  });
18133
17836
  if (node === null) {
18134
17837
  return null;
@@ -18153,7 +17856,7 @@ var SymbolBuilder = class {
18153
17856
  getSymbolOfPipe(expression) {
18154
17857
  const methodAccess = findFirstMatchingNode(this.typeCheckBlock, {
18155
17858
  withSpan: expression.nameSpan,
18156
- filter: ts85.isPropertyAccessExpression
17859
+ filter: ts70.isPropertyAccessExpression
18157
17860
  });
18158
17861
  if (methodAccess === null) {
18159
17862
  return null;
@@ -18198,7 +17901,7 @@ var SymbolBuilder = class {
18198
17901
  if (expression instanceof PropertyRead8) {
18199
17902
  node = findFirstMatchingNode(this.typeCheckBlock, {
18200
17903
  withSpan,
18201
- filter: ts85.isPropertyAccessExpression
17904
+ filter: ts70.isPropertyAccessExpression
18202
17905
  });
18203
17906
  }
18204
17907
  if (node === null) {
@@ -18207,10 +17910,10 @@ var SymbolBuilder = class {
18207
17910
  if (node === null) {
18208
17911
  return null;
18209
17912
  }
18210
- while (ts85.isParenthesizedExpression(node)) {
17913
+ while (ts70.isParenthesizedExpression(node)) {
18211
17914
  node = node.expression;
18212
17915
  }
18213
- if (expression instanceof SafePropertyRead4 && ts85.isConditionalExpression(node)) {
17916
+ if (expression instanceof SafePropertyRead4 && ts70.isConditionalExpression(node)) {
18214
17917
  const whenTrueSymbol = this.getSymbolOfTsNode(node.whenTrue);
18215
17918
  if (whenTrueSymbol === null) {
18216
17919
  return null;
@@ -18228,13 +17931,13 @@ var SymbolBuilder = class {
18228
17931
  }
18229
17932
  }
18230
17933
  getSymbolOfTsNode(node) {
18231
- while (ts85.isParenthesizedExpression(node)) {
17934
+ while (ts70.isParenthesizedExpression(node)) {
18232
17935
  node = node.expression;
18233
17936
  }
18234
17937
  let tsSymbol;
18235
- if (ts85.isPropertyAccessExpression(node)) {
17938
+ if (ts70.isPropertyAccessExpression(node)) {
18236
17939
  tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.name);
18237
- } else if (ts85.isCallExpression(node)) {
17940
+ } else if (ts70.isCallExpression(node)) {
18238
17941
  tsSymbol = this.getTypeChecker().getSymbolAtLocation(node.expression);
18239
17942
  } else {
18240
17943
  tsSymbol = this.getTypeChecker().getSymbolAtLocation(node);
@@ -18255,13 +17958,13 @@ var SymbolBuilder = class {
18255
17958
  };
18256
17959
  }
18257
17960
  getTcbPositionForNode(node) {
18258
- if (ts85.isTypeReferenceNode(node)) {
17961
+ if (ts70.isTypeReferenceNode(node)) {
18259
17962
  return this.getTcbPositionForNode(node.typeName);
18260
- } else if (ts85.isQualifiedName(node)) {
17963
+ } else if (ts70.isQualifiedName(node)) {
18261
17964
  return node.right.getStart();
18262
- } else if (ts85.isPropertyAccessExpression(node)) {
17965
+ } else if (ts70.isPropertyAccessExpression(node)) {
18263
17966
  return node.name.getStart();
18264
- } else if (ts85.isElementAccessExpression(node)) {
17967
+ } else if (ts70.isElementAccessExpression(node)) {
18265
17968
  return node.argumentExpression.getStart();
18266
17969
  } else {
18267
17970
  return node.getStart();
@@ -18275,13 +17978,13 @@ function sourceSpanEqual(a, b) {
18275
17978
  return a.start.offset === b.start.offset && a.end.offset === b.end.offset;
18276
17979
  }
18277
17980
  function unwrapSignalInputWriteTAccessor(expr) {
18278
- if (!ts85.isElementAccessExpression(expr) || !ts85.isPropertyAccessExpression(expr.argumentExpression)) {
17981
+ if (!ts70.isElementAccessExpression(expr) || !ts70.isPropertyAccessExpression(expr.argumentExpression)) {
18279
17982
  return null;
18280
17983
  }
18281
- if (!ts85.isIdentifier(expr.argumentExpression.name) || expr.argumentExpression.name.text !== R3Identifiers6.InputSignalBrandWriteType.name) {
17984
+ if (!ts70.isIdentifier(expr.argumentExpression.name) || expr.argumentExpression.name.text !== R3Identifiers6.InputSignalBrandWriteType.name) {
18282
17985
  return null;
18283
17986
  }
18284
- if (!ts85.isPropertyAccessExpression(expr.expression) && !ts85.isElementAccessExpression(expr.expression) && !ts85.isIdentifier(expr.expression)) {
17987
+ if (!ts70.isPropertyAccessExpression(expr.expression) && !ts70.isElementAccessExpression(expr.expression) && !ts70.isIdentifier(expr.expression)) {
18285
17988
  throw new Error("Unexpected expression for signal input write type.");
18286
17989
  }
18287
17990
  return {
@@ -18298,10 +18001,10 @@ function findMatchingDirective(originalSourceFile, directiveDeclarationInTypeChe
18298
18001
  function collectClassesWithName(sourceFile, className) {
18299
18002
  const classes = [];
18300
18003
  function visit2(node) {
18301
- if (ts85.isClassDeclaration(node) && node.name?.text === className) {
18004
+ if (ts70.isClassDeclaration(node) && node.name?.text === className) {
18302
18005
  classes.push(node);
18303
18006
  }
18304
- ts85.forEachChild(node, visit2);
18007
+ ts70.forEachChild(node, visit2);
18305
18008
  }
18306
18009
  sourceFile.forEachChild(visit2);
18307
18010
  return classes;
@@ -19101,7 +18804,7 @@ var TemplateTypeCheckerImpl = class {
19101
18804
  return null;
19102
18805
  }
19103
18806
  const emitted = emittedRef.expression;
19104
- if (emitted instanceof WrappedNodeExpr8) {
18807
+ if (emitted instanceof WrappedNodeExpr7) {
19105
18808
  if (refTo.node === inContext) {
19106
18809
  return null;
19107
18810
  }
@@ -19330,11 +19033,11 @@ function getClassDeclFromSymbol(symbol, checker) {
19330
19033
  if (decl === void 0) {
19331
19034
  return null;
19332
19035
  }
19333
- if (ts86.isExportAssignment(decl)) {
19036
+ if (ts71.isExportAssignment(decl)) {
19334
19037
  const symbol2 = checker.getTypeAtLocation(decl.expression).getSymbol();
19335
19038
  return getClassDeclFromSymbol(symbol2, checker);
19336
19039
  }
19337
- if (ts86.isExportSpecifier(decl)) {
19040
+ if (ts71.isExportSpecifier(decl)) {
19338
19041
  const symbol2 = checker.getTypeAtLocation(decl).getSymbol();
19339
19042
  return getClassDeclFromSymbol(symbol2, checker);
19340
19043
  }
@@ -19367,7 +19070,7 @@ function getTheElementTagDeprecatedSuggestionDiagnostics(shimPath, program, file
19367
19070
  const nodeType = typeChecker.getTypeAtLocation(diagNode);
19368
19071
  const nodeSymbolDeclarations = nodeType.getSymbol()?.declarations;
19369
19072
  const decl = nodeSymbolDeclarations !== void 0 && nodeSymbolDeclarations.length > 0 ? nodeSymbolDeclarations[0] : void 0;
19370
- if (decl === void 0 || !ts86.isClassDeclaration(decl)) {
19073
+ if (decl === void 0 || !ts71.isClassDeclaration(decl)) {
19371
19074
  continue;
19372
19075
  }
19373
19076
  const directiveForDiagnostic = templateTypeChecker.getDirectiveMetadata(decl);
@@ -19387,7 +19090,7 @@ function getTheElementTagDeprecatedSuggestionDiagnostics(shimPath, program, file
19387
19090
  if (decl === void 0) {
19388
19091
  continue;
19389
19092
  }
19390
- if (!ts86.isClassDeclaration(decl)) {
19093
+ if (!ts71.isClassDeclaration(decl)) {
19391
19094
  continue;
19392
19095
  }
19393
19096
  const diagnostic = nodeToDiag.get(decl);
@@ -19666,7 +19369,7 @@ var DirectiveDecoratorHandler = class {
19666
19369
  if (!this.typeCheckHostBindings) {
19667
19370
  return;
19668
19371
  }
19669
- if (!ts87.isClassDeclaration(node) || meta.isPoisoned && !this.usePoisonedData) {
19372
+ if (!ts72.isClassDeclaration(node) || meta.isPoisoned && !this.usePoisonedData) {
19670
19373
  return;
19671
19374
  }
19672
19375
  const ref = new Reference(node);
@@ -19693,7 +19396,7 @@ var DirectiveDecoratorHandler = class {
19693
19396
  symbol.baseClass = this.semanticDepGraphUpdater.getSymbol(analysis.baseClass.node);
19694
19397
  }
19695
19398
  const diagnostics = [];
19696
- if (analysis.providersRequiringFactory !== null && analysis.meta.providers instanceof WrappedNodeExpr9) {
19399
+ if (analysis.providersRequiringFactory !== null && analysis.meta.providers instanceof WrappedNodeExpr8) {
19697
19400
  const providerDiagnostics = getProviderDiagnostics(analysis.providersRequiringFactory, analysis.meta.providers.node, this.injectableRegistry);
19698
19401
  diagnostics.push(...providerDiagnostics);
19699
19402
  }
@@ -19775,17 +19478,17 @@ var DirectiveDecoratorHandler = class {
19775
19478
  };
19776
19479
 
19777
19480
  // packages/compiler-cli/src/ngtsc/annotations/ng_module/src/handler.js
19778
- 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";
19779
- import ts89 from "typescript";
19481
+ 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 WrappedNodeExpr9 } from "@angular/compiler";
19482
+ import ts74 from "typescript";
19780
19483
 
19781
19484
  // packages/compiler-cli/src/ngtsc/annotations/ng_module/src/module_with_providers.js
19782
- import ts88 from "typescript";
19485
+ import ts73 from "typescript";
19783
19486
  function createModuleWithProvidersResolver(reflector, isCore) {
19784
19487
  function _reflectModuleFromTypeParam(type, node) {
19785
- if (!ts88.isTypeReferenceNode(type)) {
19488
+ if (!ts73.isTypeReferenceNode(type)) {
19786
19489
  return null;
19787
19490
  }
19788
- const typeName = type && (ts88.isIdentifier(type.typeName) && type.typeName || ts88.isQualifiedName(type.typeName) && type.typeName.right) || null;
19491
+ const typeName = type && (ts73.isIdentifier(type.typeName) && type.typeName || ts73.isQualifiedName(type.typeName) && type.typeName.right) || null;
19789
19492
  if (typeName === null) {
19790
19493
  return null;
19791
19494
  }
@@ -19797,7 +19500,7 @@ function createModuleWithProvidersResolver(reflector, isCore) {
19797
19500
  return null;
19798
19501
  }
19799
19502
  if (type.typeArguments === void 0 || type.typeArguments.length !== 1) {
19800
- const parent = ts88.isMethodDeclaration(node) && ts88.isClassDeclaration(node.parent) ? node.parent : null;
19503
+ const parent = ts73.isMethodDeclaration(node) && ts73.isClassDeclaration(node.parent) ? node.parent : null;
19801
19504
  const symbolName = (parent && parent.name ? parent.name.getText() + "." : "") + (node.name ? node.name.getText() : "anonymous");
19802
19505
  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.`);
19803
19506
  }
@@ -19805,15 +19508,15 @@ function createModuleWithProvidersResolver(reflector, isCore) {
19805
19508
  return typeNodeToValueExpr(arg);
19806
19509
  }
19807
19510
  function _reflectModuleFromLiteralType(type) {
19808
- if (!ts88.isIntersectionTypeNode(type)) {
19511
+ if (!ts73.isIntersectionTypeNode(type)) {
19809
19512
  return null;
19810
19513
  }
19811
19514
  for (const t of type.types) {
19812
- if (ts88.isTypeLiteralNode(t)) {
19515
+ if (ts73.isTypeLiteralNode(t)) {
19813
19516
  for (const m of t.members) {
19814
- const ngModuleType = ts88.isPropertySignature(m) && ts88.isIdentifier(m.name) && m.name.text === "ngModule" && m.type || null;
19517
+ const ngModuleType = ts73.isPropertySignature(m) && ts73.isIdentifier(m.name) && m.name.text === "ngModule" && m.type || null;
19815
19518
  let ngModuleExpression = null;
19816
- if (ngModuleType !== null && ts88.isTypeQueryNode(ngModuleType)) {
19519
+ if (ngModuleType !== null && ts73.isTypeQueryNode(ngModuleType)) {
19817
19520
  ngModuleExpression = entityNameToValue(ngModuleType.exprName);
19818
19521
  } else if (ngModuleType !== null) {
19819
19522
  ngModuleExpression = typeNodeToValueExpr(ngModuleType);
@@ -19991,8 +19694,8 @@ var NgModuleDecoratorHandler = class {
19991
19694
  if (decorator.args === null || decorator.args.length > 1) {
19992
19695
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, `Incorrect number of arguments to @NgModule decorator`);
19993
19696
  }
19994
- const meta = decorator.args.length === 1 ? unwrapExpression(decorator.args[0]) : ts89.factory.createObjectLiteralExpression([]);
19995
- if (!ts89.isObjectLiteralExpression(meta)) {
19697
+ const meta = decorator.args.length === 1 ? unwrapExpression(decorator.args[0]) : ts74.factory.createObjectLiteralExpression([]);
19698
+ if (!ts74.isObjectLiteralExpression(meta)) {
19996
19699
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, "@NgModule argument must be an object literal");
19997
19700
  }
19998
19701
  const ngModule = reflectObjectLiteral(meta);
@@ -20076,10 +19779,10 @@ var NgModuleDecoratorHandler = class {
20076
19779
  if (ngModule.has("id")) {
20077
19780
  const idExpr = ngModule.get("id");
20078
19781
  if (!isModuleIdExpression(idExpr)) {
20079
- id = new WrappedNodeExpr10(idExpr);
19782
+ id = new WrappedNodeExpr9(idExpr);
20080
19783
  } else {
20081
19784
  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.`);
20082
- diag.category = ts89.DiagnosticCategory.Warning;
19785
+ diag.category = ts74.DiagnosticCategory.Warning;
20083
19786
  diagnostics.push(diag);
20084
19787
  }
20085
19788
  }
@@ -20105,10 +19808,10 @@ var NgModuleDecoratorHandler = class {
20105
19808
  ngModuleMetadata = {
20106
19809
  kind: R3NgModuleMetadataKind.Local,
20107
19810
  type,
20108
- bootstrapExpression: rawBootstrap ? new WrappedNodeExpr10(rawBootstrap) : null,
20109
- declarationsExpression: rawDeclarations ? new WrappedNodeExpr10(rawDeclarations) : null,
20110
- exportsExpression: rawExports ? new WrappedNodeExpr10(rawExports) : null,
20111
- importsExpression: rawImports ? new WrappedNodeExpr10(rawImports) : null,
19811
+ bootstrapExpression: rawBootstrap ? new WrappedNodeExpr9(rawBootstrap) : null,
19812
+ declarationsExpression: rawDeclarations ? new WrappedNodeExpr9(rawDeclarations) : null,
19813
+ exportsExpression: rawExports ? new WrappedNodeExpr9(rawExports) : null,
19814
+ importsExpression: rawImports ? new WrappedNodeExpr9(rawImports) : null,
20112
19815
  id,
20113
19816
  // Use `ɵɵsetNgModuleScope` to patch selector scopes onto the generated definition in a
20114
19817
  // tree-shakeable way.
@@ -20139,16 +19842,16 @@ var NgModuleDecoratorHandler = class {
20139
19842
  }
20140
19843
  const rawProviders = ngModule.has("providers") ? ngModule.get("providers") : null;
20141
19844
  let wrappedProviders = null;
20142
- if (rawProviders !== null && (!ts89.isArrayLiteralExpression(rawProviders) || rawProviders.elements.length > 0)) {
20143
- wrappedProviders = new WrappedNodeExpr10(this.annotateForClosureCompiler ? wrapFunctionExpressionsInParens(rawProviders) : rawProviders);
19845
+ if (rawProviders !== null && (!ts74.isArrayLiteralExpression(rawProviders) || rawProviders.elements.length > 0)) {
19846
+ wrappedProviders = new WrappedNodeExpr9(this.annotateForClosureCompiler ? wrapFunctionExpressionsInParens(rawProviders) : rawProviders);
20144
19847
  }
20145
19848
  const topLevelImports = [];
20146
19849
  if (!allowUnresolvedReferences && ngModule.has("imports")) {
20147
19850
  const rawImports2 = unwrapExpression(ngModule.get("imports"));
20148
19851
  let topLevelExpressions = [];
20149
- if (ts89.isArrayLiteralExpression(rawImports2)) {
19852
+ if (ts74.isArrayLiteralExpression(rawImports2)) {
20150
19853
  for (const element of rawImports2.elements) {
20151
- if (ts89.isSpreadElement(element)) {
19854
+ if (ts74.isSpreadElement(element)) {
20152
19855
  topLevelExpressions.push(element.expression);
20153
19856
  continue;
20154
19857
  }
@@ -20188,12 +19891,12 @@ var NgModuleDecoratorHandler = class {
20188
19891
  if (exp === null) {
20189
19892
  continue;
20190
19893
  }
20191
- if (ts89.isArrayLiteralExpression(exp)) {
19894
+ if (ts74.isArrayLiteralExpression(exp)) {
20192
19895
  if (exp.elements) {
20193
- injectorMetadata.imports.push(...exp.elements.map((n2) => new WrappedNodeExpr10(n2)));
19896
+ injectorMetadata.imports.push(...exp.elements.map((n2) => new WrappedNodeExpr9(n2)));
20194
19897
  }
20195
19898
  } else {
20196
- injectorMetadata.imports.push(new WrappedNodeExpr10(exp));
19899
+ injectorMetadata.imports.push(new WrappedNodeExpr9(exp));
20197
19900
  }
20198
19901
  }
20199
19902
  }
@@ -20270,7 +19973,7 @@ var NgModuleDecoratorHandler = class {
20270
19973
  };
20271
19974
  for (const topLevelImport of analysis.imports) {
20272
19975
  if (topLevelImport.hasModuleWithProviders) {
20273
- data.injectorImports.push(new WrappedNodeExpr10(topLevelImport.expression));
19976
+ data.injectorImports.push(new WrappedNodeExpr9(topLevelImport.expression));
20274
19977
  continue;
20275
19978
  }
20276
19979
  const refsToEmit = [];
@@ -20304,7 +20007,7 @@ var NgModuleDecoratorHandler = class {
20304
20007
  refsToEmit.push(ref);
20305
20008
  }
20306
20009
  if (refsToEmit.length === topLevelImport.resolvedReferences.length) {
20307
- data.injectorImports.push(new WrappedNodeExpr10(topLevelImport.expression));
20010
+ data.injectorImports.push(new WrappedNodeExpr9(topLevelImport.expression));
20308
20011
  } else {
20309
20012
  const context = node.getSourceFile();
20310
20013
  for (const ref of refsToEmit) {
@@ -20519,7 +20222,7 @@ function isNgModule(node, compilation) {
20519
20222
  return !compilation.dependencies.some((dep) => dep.ref.node === node);
20520
20223
  }
20521
20224
  function isModuleIdExpression(expr) {
20522
- return ts89.isPropertyAccessExpression(expr) && ts89.isIdentifier(expr.expression) && expr.expression.text === "module" && expr.name.text === "id";
20225
+ return ts74.isPropertyAccessExpression(expr) && ts74.isIdentifier(expr.expression) && expr.expression.text === "module" && expr.name.text === "id";
20523
20226
  }
20524
20227
  function makeStandaloneBootstrapDiagnostic(ngModuleClass, bootstrappedClassRef, rawBootstrapExpr) {
20525
20228
  const componentClassName = bootstrappedClassRef.node.name.text;
@@ -20592,7 +20295,7 @@ var ComponentSymbol = class _ComponentSymbol extends DirectiveSymbol {
20592
20295
  };
20593
20296
 
20594
20297
  // packages/compiler-cli/src/ngtsc/annotations/component/src/util.js
20595
- import ts90 from "typescript";
20298
+ import ts75 from "typescript";
20596
20299
  function collectLegacyAnimationNames(value, legacyAnimationTriggerNames) {
20597
20300
  if (value instanceof Map) {
20598
20301
  const name = value.get("name");
@@ -20639,7 +20342,7 @@ function validateAndFlattenComponentImports(imports, expr, isDeferred) {
20639
20342
  for (let i = 0; i < imports.length; i++) {
20640
20343
  const ref = imports[i];
20641
20344
  let refExpr = expr;
20642
- if (ts90.isArrayLiteralExpression(expr) && expr.elements.length === imports.length && !expr.elements.some(ts90.isSpreadAssignment)) {
20345
+ if (ts75.isArrayLiteralExpression(expr) && expr.elements.length === imports.length && !expr.elements.some(ts75.isSpreadAssignment)) {
20643
20346
  refExpr = expr.elements[i];
20644
20347
  }
20645
20348
  if (Array.isArray(ref)) {
@@ -20701,11 +20404,11 @@ import { outputAst as o4 } from "@angular/compiler";
20701
20404
 
20702
20405
  // packages/compiler-cli/src/ngtsc/hmr/src/extract_dependencies.js
20703
20406
  import { outputAst as o3 } from "@angular/compiler";
20704
- import ts91 from "typescript";
20407
+ import ts76 from "typescript";
20705
20408
  function extractHmrDependencies(node, definition, factory, deferBlockMetadata, classMetadata, debugInfo, reflection, evaluator) {
20706
- const name = ts91.isClassDeclaration(node) && node.name ? node.name.text : null;
20409
+ const name = ts76.isClassDeclaration(node) && node.name ? node.name.text : null;
20707
20410
  const visitor = new PotentialTopLevelReadsVisitor();
20708
- const sourceFile = ts91.getOriginalNode(node).getSourceFile();
20411
+ const sourceFile = ts76.getOriginalNode(node).getSourceFile();
20709
20412
  definition.expression.visitExpression(visitor, null);
20710
20413
  definition.statements.forEach((statement) => statement.visitStatement(visitor, null));
20711
20414
  factory.initializer?.visitExpression(visitor, null);
@@ -20766,21 +20469,21 @@ function getRuntimeRepresentation(node, reflection, evaluator) {
20766
20469
  function getTopLevelDeclarationNames(sourceFile) {
20767
20470
  const results = /* @__PURE__ */ new Set();
20768
20471
  for (const node of sourceFile.statements) {
20769
- if (ts91.isClassDeclaration(node) || ts91.isFunctionDeclaration(node) || ts91.isEnumDeclaration(node)) {
20472
+ if (ts76.isClassDeclaration(node) || ts76.isFunctionDeclaration(node) || ts76.isEnumDeclaration(node)) {
20770
20473
  if (node.name) {
20771
20474
  results.add(node.name.text);
20772
20475
  }
20773
20476
  continue;
20774
20477
  }
20775
- if (ts91.isVariableStatement(node)) {
20478
+ if (ts76.isVariableStatement(node)) {
20776
20479
  for (const decl of node.declarationList.declarations) {
20777
20480
  trackBindingName(decl.name, results);
20778
20481
  }
20779
20482
  continue;
20780
20483
  }
20781
- if (ts91.isImportDeclaration(node) && node.importClause) {
20484
+ if (ts76.isImportDeclaration(node) && node.importClause) {
20782
20485
  const importClause = node.importClause;
20783
- if (importClause.phaseModifier === ts91.SyntaxKind.TypeKeyword) {
20486
+ if (importClause.phaseModifier === ts76.SyntaxKind.TypeKeyword) {
20784
20487
  continue;
20785
20488
  }
20786
20489
  if (importClause.name) {
@@ -20788,7 +20491,7 @@ function getTopLevelDeclarationNames(sourceFile) {
20788
20491
  }
20789
20492
  if (importClause.namedBindings) {
20790
20493
  const namedBindings = importClause.namedBindings;
20791
- if (ts91.isNamespaceImport(namedBindings)) {
20494
+ if (ts76.isNamespaceImport(namedBindings)) {
20792
20495
  results.add(namedBindings.name.text);
20793
20496
  } else {
20794
20497
  namedBindings.elements.forEach((el) => {
@@ -20804,11 +20507,11 @@ function getTopLevelDeclarationNames(sourceFile) {
20804
20507
  return results;
20805
20508
  }
20806
20509
  function trackBindingName(node, results) {
20807
- if (ts91.isIdentifier(node)) {
20510
+ if (ts76.isIdentifier(node)) {
20808
20511
  results.add(node.text);
20809
20512
  } else {
20810
20513
  for (const el of node.elements) {
20811
- if (!ts91.isOmittedExpression(el)) {
20514
+ if (!ts76.isOmittedExpression(el)) {
20812
20515
  trackBindingName(el.name, results);
20813
20516
  }
20814
20517
  }
@@ -20838,10 +20541,10 @@ var PotentialTopLevelReadsVisitor = class extends o3.RecursiveAstVisitor {
20838
20541
  * @param node Node from which to start the traversal.
20839
20542
  */
20840
20543
  addAllTopLevelIdentifiers = (node) => {
20841
- if (ts91.isIdentifier(node) && this.isTopLevelIdentifierReference(node)) {
20544
+ if (ts76.isIdentifier(node) && this.isTopLevelIdentifierReference(node)) {
20842
20545
  this.allReads.add(node);
20843
20546
  } else {
20844
- ts91.forEachChild(node, this.addAllTopLevelIdentifiers);
20547
+ ts76.forEachChild(node, this.addAllTopLevelIdentifiers);
20845
20548
  }
20846
20549
  };
20847
20550
  /**
@@ -20856,52 +20559,52 @@ var PotentialTopLevelReadsVisitor = class extends o3.RecursiveAstVisitor {
20856
20559
  if (!parent) {
20857
20560
  return false;
20858
20561
  }
20859
- if (ts91.isParenthesizedExpression(parent) && parent.expression === node) {
20860
- while (parent && ts91.isParenthesizedExpression(parent)) {
20562
+ if (ts76.isParenthesizedExpression(parent) && parent.expression === node) {
20563
+ while (parent && ts76.isParenthesizedExpression(parent)) {
20861
20564
  node = parent;
20862
20565
  parent = parent.parent;
20863
20566
  }
20864
20567
  }
20865
- if (ts91.isSourceFile(parent)) {
20568
+ if (ts76.isSourceFile(parent)) {
20866
20569
  return true;
20867
20570
  }
20868
- if (ts91.isCallExpression(parent)) {
20571
+ if (ts76.isCallExpression(parent)) {
20869
20572
  return parent.expression === node || parent.arguments.includes(node);
20870
20573
  }
20871
- 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)) {
20574
+ if (ts76.isExpressionStatement(parent) || ts76.isPropertyAccessExpression(parent) || ts76.isComputedPropertyName(parent) || ts76.isTemplateSpan(parent) || ts76.isSpreadAssignment(parent) || ts76.isSpreadElement(parent) || ts76.isAwaitExpression(parent) || ts76.isNonNullExpression(parent) || ts76.isIfStatement(parent) || ts76.isDoStatement(parent) || ts76.isWhileStatement(parent) || ts76.isSwitchStatement(parent) || ts76.isCaseClause(parent) || ts76.isThrowStatement(parent) || ts76.isNewExpression(parent) || ts76.isExpressionWithTypeArguments(parent)) {
20872
20575
  return parent.expression === node;
20873
20576
  }
20874
- if (ts91.isArrayLiteralExpression(parent)) {
20577
+ if (ts76.isArrayLiteralExpression(parent)) {
20875
20578
  return parent.elements.includes(node);
20876
20579
  }
20877
- if (ts91.isPropertyAssignment(parent) || ts91.isParameter(parent) || ts91.isBindingElement(parent) || ts91.isPropertyDeclaration(parent) || ts91.isEnumMember(parent)) {
20580
+ if (ts76.isPropertyAssignment(parent) || ts76.isParameter(parent) || ts76.isBindingElement(parent) || ts76.isPropertyDeclaration(parent) || ts76.isEnumMember(parent)) {
20878
20581
  return parent.initializer === node;
20879
20582
  }
20880
- if (ts91.isVariableDeclaration(parent)) {
20583
+ if (ts76.isVariableDeclaration(parent)) {
20881
20584
  return parent.name === node || parent.initializer === node;
20882
20585
  }
20883
- if (ts91.isClassDeclaration(parent) || ts91.isFunctionDeclaration(parent) || ts91.isShorthandPropertyAssignment(parent)) {
20586
+ if (ts76.isClassDeclaration(parent) || ts76.isFunctionDeclaration(parent) || ts76.isShorthandPropertyAssignment(parent)) {
20884
20587
  return parent.name === node;
20885
20588
  }
20886
- if (ts91.isElementAccessExpression(parent)) {
20589
+ if (ts76.isElementAccessExpression(parent)) {
20887
20590
  return parent.expression === node || parent.argumentExpression === node;
20888
20591
  }
20889
- if (ts91.isBinaryExpression(parent)) {
20592
+ if (ts76.isBinaryExpression(parent)) {
20890
20593
  return parent.left === node || parent.right === node;
20891
20594
  }
20892
- if (ts91.isForInStatement(parent) || ts91.isForOfStatement(parent)) {
20595
+ if (ts76.isForInStatement(parent) || ts76.isForOfStatement(parent)) {
20893
20596
  return parent.expression === node || parent.initializer === node;
20894
20597
  }
20895
- if (ts91.isForStatement(parent)) {
20598
+ if (ts76.isForStatement(parent)) {
20896
20599
  return parent.condition === node || parent.initializer === node || parent.incrementor === node;
20897
20600
  }
20898
- if (ts91.isArrowFunction(parent)) {
20601
+ if (ts76.isArrowFunction(parent)) {
20899
20602
  return parent.body === node;
20900
20603
  }
20901
- if (ts91.isImportSpecifier(parent) || ts91.isExportSpecifier(parent)) {
20604
+ if (ts76.isImportSpecifier(parent) || ts76.isExportSpecifier(parent)) {
20902
20605
  return (parent.propertyName || parent.name) === node;
20903
20606
  }
20904
- if (ts91.isConditionalExpression(parent)) {
20607
+ if (ts76.isConditionalExpression(parent)) {
20905
20608
  return parent.condition === node || parent.whenFalse === node || parent.whenTrue === node;
20906
20609
  }
20907
20610
  return false;
@@ -20913,20 +20616,20 @@ var PotentialTopLevelReadsVisitor = class extends o3.RecursiveAstVisitor {
20913
20616
  };
20914
20617
  function isConstEnumReference(node, reflection) {
20915
20618
  const parent = node.parent;
20916
- if (!parent || !ts91.isPropertyAccessExpression(parent) || parent.expression !== node || !ts91.isIdentifier(parent.name)) {
20619
+ if (!parent || !ts76.isPropertyAccessExpression(parent) || parent.expression !== node || !ts76.isIdentifier(parent.name)) {
20917
20620
  return false;
20918
20621
  }
20919
20622
  const declaration = reflection.getDeclarationOfIdentifier(node);
20920
- return declaration !== null && ts91.isEnumDeclaration(declaration.node) && !!declaration.node.modifiers?.some((m) => m.kind === ts91.SyntaxKind.ConstKeyword);
20623
+ return declaration !== null && ts76.isEnumDeclaration(declaration.node) && !!declaration.node.modifiers?.some((m) => m.kind === ts76.SyntaxKind.ConstKeyword);
20921
20624
  }
20922
20625
 
20923
20626
  // packages/compiler-cli/src/ngtsc/hmr/src/metadata.js
20924
- import ts92 from "typescript";
20627
+ import ts77 from "typescript";
20925
20628
  function extractHmrMetatadata(clazz, reflection, evaluator, compilerHost, rootDirs, definition, factory, deferBlockMetadata, classMetadata, debugInfo) {
20926
20629
  if (!reflection.isClass(clazz)) {
20927
20630
  return null;
20928
20631
  }
20929
- const sourceFile = ts92.getOriginalNode(clazz).getSourceFile();
20632
+ const sourceFile = ts77.getOriginalNode(clazz).getSourceFile();
20930
20633
  const filePath = getProjectRelativePath(sourceFile.fileName, rootDirs, compilerHost) || compilerHost.getCanonicalFileName(sourceFile.fileName);
20931
20634
  const dependencies = extractHmrDependencies(clazz, definition, factory, deferBlockMetadata, classMetadata, debugInfo, reflection, evaluator);
20932
20635
  if (dependencies === null) {
@@ -20944,7 +20647,7 @@ function extractHmrMetatadata(clazz, reflection, evaluator, compilerHost, rootDi
20944
20647
 
20945
20648
  // packages/compiler-cli/src/ngtsc/hmr/src/update_declaration.js
20946
20649
  import { compileHmrUpdateCallback } from "@angular/compiler";
20947
- import ts93 from "typescript";
20650
+ import ts78 from "typescript";
20948
20651
  function getHmrUpdateDeclaration(compilationResults, constantStatements, meta, declaration) {
20949
20652
  const namespaceSpecifiers = meta.namespaceDependencies.reduce((result, current) => {
20950
20653
  result.set(current.moduleName, current.assignedName);
@@ -20956,11 +20659,11 @@ function getHmrUpdateDeclaration(compilationResults, constantStatements, meta, d
20956
20659
  rewriter: importRewriter
20957
20660
  });
20958
20661
  const callback = compileHmrUpdateCallback(compilationResults, constantStatements, meta);
20959
- const sourceFile = ts93.getOriginalNode(declaration).getSourceFile();
20662
+ const sourceFile = ts78.getOriginalNode(declaration).getSourceFile();
20960
20663
  const node = translateStatement(sourceFile, callback, importManager);
20961
- return ts93.factory.updateFunctionDeclaration(node, [
20962
- ts93.factory.createToken(ts93.SyntaxKind.ExportKeyword),
20963
- ts93.factory.createToken(ts93.SyntaxKind.DefaultKeyword)
20664
+ return ts78.factory.updateFunctionDeclaration(node, [
20665
+ ts78.factory.createToken(ts78.SyntaxKind.ExportKeyword),
20666
+ ts78.factory.createToken(ts78.SyntaxKind.DefaultKeyword)
20964
20667
  ], node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body);
20965
20668
  }
20966
20669
  var HmrModuleImportRewriter = class {
@@ -21407,7 +21110,7 @@ var ComponentDecoratorHandler = class {
21407
21110
  path: absoluteFrom(template.declaration.resolvedTemplateUrl),
21408
21111
  node: template.sourceMapping.node
21409
21112
  };
21410
- const relativeTemplatePath = getProjectRelativePath(templateResource.path ?? ts94.getOriginalNode(node).getSourceFile().fileName, this.rootDirs, this.compilerHost);
21113
+ const relativeTemplatePath = getProjectRelativePath(templateResource.path ?? ts79.getOriginalNode(node).getSourceFile().fileName, this.rootDirs, this.compilerHost);
21411
21114
  let selectorlessEnabled = false;
21412
21115
  let localReferencedSymbols = null;
21413
21116
  if (this.enableSelectorless) {
@@ -21441,7 +21144,7 @@ var ComponentDecoratorHandler = class {
21441
21144
  externalStyles.push(resourceUrl);
21442
21145
  continue;
21443
21146
  }
21444
- if (styleUrl.source === 2 && ts94.isStringLiteralLike(styleUrl.expression)) {
21147
+ if (styleUrl.source === 2 && ts79.isStringLiteralLike(styleUrl.expression)) {
21445
21148
  styleResources.add({
21446
21149
  path: absoluteFrom(resourceUrl),
21447
21150
  node: styleUrl.expression
@@ -21649,7 +21352,7 @@ var ComponentDecoratorHandler = class {
21649
21352
  return null;
21650
21353
  }
21651
21354
  typeCheck(ctx, node, meta) {
21652
- if (!ts94.isClassDeclaration(node) || meta.isPoisoned && !this.usePoisonedData) {
21355
+ if (!ts79.isClassDeclaration(node) || meta.isPoisoned && !this.usePoisonedData) {
21653
21356
  return;
21654
21357
  }
21655
21358
  const ref = new Reference(node);
@@ -22180,12 +21883,12 @@ var ComponentDecoratorHandler = class {
22180
21883
  */
22181
21884
  collectExplicitlyDeferredSymbols(rawDeferredImports) {
22182
21885
  const deferredTypes = /* @__PURE__ */ new Map();
22183
- if (!ts94.isArrayLiteralExpression(rawDeferredImports)) {
21886
+ if (!ts79.isArrayLiteralExpression(rawDeferredImports)) {
22184
21887
  return deferredTypes;
22185
21888
  }
22186
21889
  for (const element of rawDeferredImports.elements) {
22187
21890
  const node = tryUnwrapForwardRef(element, this.reflector) || element;
22188
- if (!ts94.isIdentifier(node)) {
21891
+ if (!ts79.isIdentifier(node)) {
22189
21892
  continue;
22190
21893
  }
22191
21894
  const imp = this.reflector.getImportOfIdentifier(node);
@@ -22253,12 +21956,12 @@ var ComponentDecoratorHandler = class {
22253
21956
  }
22254
21957
  }
22255
21958
  if (analysisData.meta.isStandalone) {
22256
- if (analysisData.rawImports !== null && ts94.isArrayLiteralExpression(analysisData.rawImports)) {
21959
+ if (analysisData.rawImports !== null && ts79.isArrayLiteralExpression(analysisData.rawImports)) {
22257
21960
  for (const element of analysisData.rawImports.elements) {
22258
21961
  this.registerDeferrableCandidate(componentClassDecl, element, false, allDeferredDecls, eagerlyUsedDecls, resolutionData);
22259
21962
  }
22260
21963
  }
22261
- if (analysisData.rawDeferredImports !== null && ts94.isArrayLiteralExpression(analysisData.rawDeferredImports)) {
21964
+ if (analysisData.rawDeferredImports !== null && ts79.isArrayLiteralExpression(analysisData.rawDeferredImports)) {
22262
21965
  for (const element of analysisData.rawDeferredImports.elements) {
22263
21966
  this.registerDeferrableCandidate(componentClassDecl, element, false, allDeferredDecls, eagerlyUsedDecls, resolutionData);
22264
21967
  }
@@ -22277,7 +21980,7 @@ var ComponentDecoratorHandler = class {
22277
21980
  */
22278
21981
  registerDeferrableCandidate(componentClassDecl, element, isDeferredImport, allDeferredDecls, eagerlyUsedDecls, resolutionData) {
22279
21982
  const node = tryUnwrapForwardRef(element, this.reflector) || element;
22280
- if (!ts94.isIdentifier(node)) {
21983
+ if (!ts79.isIdentifier(node)) {
22281
21984
  return;
22282
21985
  }
22283
21986
  const imp = this.reflector.getImportOfIdentifier(node);
@@ -22411,8 +22114,8 @@ function isDefaultImport(node) {
22411
22114
  }
22412
22115
 
22413
22116
  // packages/compiler-cli/src/ngtsc/annotations/src/injectable.js
22414
- import { compileClassMetadata as compileClassMetadata3, compileDeclareClassMetadata as compileDeclareClassMetadata3, compileDeclareInjectableFromMetadata, compileInjectable, createMayBeForwardRefExpression as createMayBeForwardRefExpression3, FactoryTarget as FactoryTarget4, LiteralExpr as LiteralExpr3, WrappedNodeExpr as WrappedNodeExpr11 } from "@angular/compiler";
22415
- import ts95 from "typescript";
22117
+ import { compileClassMetadata as compileClassMetadata3, compileDeclareClassMetadata as compileDeclareClassMetadata3, compileDeclareInjectableFromMetadata, compileInjectable, createMayBeForwardRefExpression as createMayBeForwardRefExpression3, FactoryTarget as FactoryTarget4, LiteralExpr as LiteralExpr3, WrappedNodeExpr as WrappedNodeExpr10 } from "@angular/compiler";
22118
+ import ts80 from "typescript";
22416
22119
  var InjectableDecoratorHandler = class {
22417
22120
  reflector;
22418
22121
  evaluator;
@@ -22547,7 +22250,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
22547
22250
  };
22548
22251
  } else if (decorator.args.length === 1) {
22549
22252
  const metaNode = decorator.args[0];
22550
- if (!ts95.isObjectLiteralExpression(metaNode)) {
22253
+ if (!ts80.isObjectLiteralExpression(metaNode)) {
22551
22254
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, metaNode, `@Injectable argument must be an object literal`);
22552
22255
  }
22553
22256
  const meta = reflectObjectLiteral(metaNode);
@@ -22559,7 +22262,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
22559
22262
  let deps = void 0;
22560
22263
  if ((meta.has("useClass") || meta.has("useFactory")) && meta.has("deps")) {
22561
22264
  const depsExpr = meta.get("deps");
22562
- if (!ts95.isArrayLiteralExpression(depsExpr)) {
22265
+ if (!ts80.isArrayLiteralExpression(depsExpr)) {
22563
22266
  throw new FatalDiagnosticError(ErrorCode.VALUE_NOT_LITERAL, depsExpr, `@Injectable deps metadata must be an inline array`);
22564
22267
  }
22565
22268
  deps = depsExpr.elements.map((dep) => getDep(dep, reflector));
@@ -22573,7 +22276,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
22573
22276
  result.useClass = getProviderExpression(meta.get("useClass"), reflector);
22574
22277
  result.deps = deps;
22575
22278
  } else if (meta.has("useFactory")) {
22576
- result.useFactory = new WrappedNodeExpr11(meta.get("useFactory"));
22279
+ result.useFactory = new WrappedNodeExpr10(meta.get("useFactory"));
22577
22280
  result.deps = deps;
22578
22281
  }
22579
22282
  return result;
@@ -22584,7 +22287,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
22584
22287
  function getProviderExpression(expression, reflector) {
22585
22288
  const forwardRefValue = tryUnwrapForwardRef(expression, reflector);
22586
22289
  return createMayBeForwardRefExpression3(
22587
- new WrappedNodeExpr11(forwardRefValue ?? expression),
22290
+ new WrappedNodeExpr10(forwardRefValue ?? expression),
22588
22291
  forwardRefValue !== null ? 2 : 0
22589
22292
  /* ForwardRefHandling.None */
22590
22293
  );
@@ -22616,7 +22319,7 @@ function requiresValidCtor(meta) {
22616
22319
  }
22617
22320
  function getDep(dep, reflector) {
22618
22321
  const meta = {
22619
- token: new WrappedNodeExpr11(dep),
22322
+ token: new WrappedNodeExpr10(dep),
22620
22323
  attributeNameType: null,
22621
22324
  host: false,
22622
22325
  optional: false,
@@ -22631,7 +22334,7 @@ function getDep(dep, reflector) {
22631
22334
  switch (source.name) {
22632
22335
  case "Inject":
22633
22336
  if (token !== void 0) {
22634
- meta.token = new WrappedNodeExpr11(token);
22337
+ meta.token = new WrappedNodeExpr10(token);
22635
22338
  }
22636
22339
  break;
22637
22340
  case "Optional":
@@ -22648,17 +22351,17 @@ function getDep(dep, reflector) {
22648
22351
  }
22649
22352
  return true;
22650
22353
  }
22651
- if (ts95.isArrayLiteralExpression(dep)) {
22354
+ if (ts80.isArrayLiteralExpression(dep)) {
22652
22355
  dep.elements.forEach((el) => {
22653
22356
  let isDecorator = false;
22654
- if (ts95.isIdentifier(el)) {
22357
+ if (ts80.isIdentifier(el)) {
22655
22358
  isDecorator = maybeUpdateDecorator(el, reflector);
22656
- } else if (ts95.isNewExpression(el) && ts95.isIdentifier(el.expression)) {
22359
+ } else if (ts80.isNewExpression(el) && ts80.isIdentifier(el.expression)) {
22657
22360
  const token = el.arguments && el.arguments.length > 0 && el.arguments[0] || void 0;
22658
22361
  isDecorator = maybeUpdateDecorator(el.expression, reflector, token);
22659
22362
  }
22660
22363
  if (!isDecorator) {
22661
- meta.token = new WrappedNodeExpr11(el);
22364
+ meta.token = new WrappedNodeExpr10(el);
22662
22365
  }
22663
22366
  });
22664
22367
  }
@@ -22667,7 +22370,7 @@ function getDep(dep, reflector) {
22667
22370
 
22668
22371
  // packages/compiler-cli/src/ngtsc/annotations/src/pipe.js
22669
22372
  import { compileClassMetadata as compileClassMetadata4, compileDeclareClassMetadata as compileDeclareClassMetadata4, compileDeclarePipeFromMetadata, compilePipeFromMetadata, FactoryTarget as FactoryTarget5 } from "@angular/compiler";
22670
- import ts96 from "typescript";
22373
+ import ts81 from "typescript";
22671
22374
  var PipeSymbol = class _PipeSymbol extends SemanticSymbol {
22672
22375
  name;
22673
22376
  constructor(decl, name) {
@@ -22737,13 +22440,13 @@ var PipeDecoratorHandler = class {
22737
22440
  }
22738
22441
  const meta = decorator.args.length === 0 || // TODO(crisbeto): temporary for testing until we've changed
22739
22442
  // the pipe public API not to require a name.
22740
- ts96.isNonNullExpression(decorator.args[0]) && decorator.args[0].expression.kind === ts96.SyntaxKind.NullKeyword ? null : unwrapExpression(decorator.args[0]);
22443
+ ts81.isNonNullExpression(decorator.args[0]) && decorator.args[0].expression.kind === ts81.SyntaxKind.NullKeyword ? null : unwrapExpression(decorator.args[0]);
22741
22444
  let pipeName = null;
22742
22445
  let pipeNameExpr = null;
22743
22446
  let pure = true;
22744
22447
  let isStandalone = this.implicitStandaloneValue;
22745
22448
  if (meta !== null) {
22746
- if (!ts96.isObjectLiteralExpression(meta)) {
22449
+ if (!ts81.isObjectLiteralExpression(meta)) {
22747
22450
  throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, "@Pipe must have a literal argument");
22748
22451
  }
22749
22452
  const pipe = reflectObjectLiteral(meta);
@@ -22869,12 +22572,12 @@ var PipeDecoratorHandler = class {
22869
22572
  };
22870
22573
 
22871
22574
  // packages/compiler-cli/src/ngtsc/transform/jit/src/initializer_api_transforms/transform.js
22872
- import ts99 from "typescript";
22575
+ import ts84 from "typescript";
22873
22576
 
22874
22577
  // packages/compiler-cli/src/ngtsc/transform/jit/src/initializer_api_transforms/transform_api.js
22875
- import ts97 from "typescript";
22578
+ import ts82 from "typescript";
22876
22579
  function createSyntheticAngularCoreDecoratorAccess(factory, importManager, ngClassDecorator, sourceFile, decoratorName) {
22877
- const classDecoratorIdentifier = ts97.isIdentifier(ngClassDecorator.identifier) ? ngClassDecorator.identifier : ngClassDecorator.identifier.expression;
22580
+ const classDecoratorIdentifier = ts82.isIdentifier(ngClassDecorator.identifier) ? ngClassDecorator.identifier : ngClassDecorator.identifier.expression;
22878
22581
  return factory.createPropertyAccessExpression(
22879
22582
  importManager.addImport({
22880
22583
  exportModuleSpecifier: "@angular/core",
@@ -22884,11 +22587,11 @@ function createSyntheticAngularCoreDecoratorAccess(factory, importManager, ngCla
22884
22587
  // The synthetic identifier may be checked later by the downlevel decorators
22885
22588
  // transform to resolve to an Angular import using `getSymbolAtLocation`. We trick
22886
22589
  // the transform to think it's not synthetic and comes from Angular core.
22887
- ts97.setOriginalNode(factory.createIdentifier(decoratorName), classDecoratorIdentifier)
22590
+ ts82.setOriginalNode(factory.createIdentifier(decoratorName), classDecoratorIdentifier)
22888
22591
  );
22889
22592
  }
22890
22593
  function castAsAny(factory, expr) {
22891
- return factory.createAsExpression(expr, factory.createKeywordTypeNode(ts97.SyntaxKind.AnyKeyword));
22594
+ return factory.createAsExpression(expr, factory.createKeywordTypeNode(ts82.SyntaxKind.AnyKeyword));
22892
22595
  }
22893
22596
 
22894
22597
  // packages/compiler-cli/src/ngtsc/transform/jit/src/initializer_api_transforms/input_function.js
@@ -22919,7 +22622,7 @@ var signalInputsTransform = (member, sourceFile, host, factory, importTracker, i
22919
22622
  };
22920
22623
 
22921
22624
  // packages/compiler-cli/src/ngtsc/transform/jit/src/initializer_api_transforms/model_function.js
22922
- import ts98 from "typescript";
22625
+ import ts83 from "typescript";
22923
22626
  var signalModelTransform = (member, sourceFile, host, factory, importTracker, importManager, classDecorator, isCore) => {
22924
22627
  if (host.getDecoratorsOfDeclaration(member.node)?.some((d) => {
22925
22628
  return isAngularDecorator2(d, "Input", isCore) || isAngularDecorator2(d, "Output", isCore);
@@ -22940,7 +22643,7 @@ var signalModelTransform = (member, sourceFile, host, factory, importTracker, im
22940
22643
  // Config is cast to `any` because `isSignal` will be private, and in case this
22941
22644
  // transform is used directly as a pre-compilation step, the decorator should
22942
22645
  // not fail. It is already validated now due to us parsing the input metadata.
22943
- factory.createAsExpression(inputConfig, factory.createKeywordTypeNode(ts98.SyntaxKind.AnyKeyword)),
22646
+ factory.createAsExpression(inputConfig, factory.createKeywordTypeNode(ts83.SyntaxKind.AnyKeyword)),
22944
22647
  classDecorator,
22945
22648
  factory,
22946
22649
  sourceFile,
@@ -23015,21 +22718,21 @@ function getInitializerApiJitTransform(host, importTracker, isCore, shouldTransf
23015
22718
  return (ctx) => {
23016
22719
  return (sourceFile) => {
23017
22720
  const importManager = new ImportManager();
23018
- sourceFile = ts99.visitNode(sourceFile, createTransformVisitor(ctx, host, importManager, importTracker, isCore, shouldTransformClass), ts99.isSourceFile);
22721
+ sourceFile = ts84.visitNode(sourceFile, createTransformVisitor(ctx, host, importManager, importTracker, isCore, shouldTransformClass), ts84.isSourceFile);
23019
22722
  return importManager.transformTsFile(ctx, sourceFile);
23020
22723
  };
23021
22724
  };
23022
22725
  }
23023
22726
  function createTransformVisitor(ctx, host, importManager, importTracker, isCore, shouldTransformClass) {
23024
22727
  const visitor = (node) => {
23025
- if (ts99.isClassDeclaration(node) && node.name !== void 0) {
23026
- const originalNode = ts99.getOriginalNode(node, ts99.isClassDeclaration);
22728
+ if (ts84.isClassDeclaration(node) && node.name !== void 0) {
22729
+ const originalNode = ts84.getOriginalNode(node, ts84.isClassDeclaration);
23027
22730
  const angularDecorator = host.getDecoratorsOfDeclaration(originalNode)?.find((d) => decoratorsWithInputs.some((name) => isAngularDecorator2(d, name, isCore)));
23028
22731
  if (angularDecorator !== void 0 && (shouldTransformClass === void 0 || shouldTransformClass(node))) {
23029
22732
  let hasChanged = false;
23030
22733
  const sourceFile = originalNode.getSourceFile();
23031
22734
  const members = node.members.map((memberNode) => {
23032
- if (!ts99.isPropertyDeclaration(memberNode)) {
22735
+ if (!ts84.isPropertyDeclaration(memberNode)) {
23033
22736
  return memberNode;
23034
22737
  }
23035
22738
  const member = reflectClassMember(memberNode);
@@ -23050,7 +22753,7 @@ function createTransformVisitor(ctx, host, importManager, importTracker, isCore,
23050
22753
  }
23051
22754
  }
23052
22755
  }
23053
- return ts99.visitEachChild(node, visitor, ctx);
22756
+ return ts84.visitEachChild(node, visitor, ctx);
23054
22757
  };
23055
22758
  return visitor;
23056
22759
  }