@angular/core 17.0.0-next.6 → 17.0.0-next.8

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 (93) hide show
  1. package/esm2022/primitives/signals/index.mjs +15 -0
  2. package/esm2022/primitives/signals/src/computed.mjs +92 -0
  3. package/esm2022/primitives/signals/src/equality.mjs +14 -0
  4. package/esm2022/primitives/signals/src/errors.mjs +18 -0
  5. package/esm2022/primitives/signals/src/graph.mjs +291 -0
  6. package/esm2022/primitives/signals/src/signal.mjs +78 -0
  7. package/esm2022/primitives/signals/src/watch.mjs +82 -0
  8. package/esm2022/primitives/signals/src/weak_ref.mjs +11 -0
  9. package/esm2022/rxjs-interop/src/to_signal.mjs +45 -14
  10. package/esm2022/src/application_init.mjs +50 -2
  11. package/esm2022/src/application_ref.mjs +7 -2
  12. package/esm2022/src/application_tokens.mjs +16 -1
  13. package/esm2022/src/core_private_export.mjs +4 -4
  14. package/esm2022/src/core_reactivity_export_internal.mjs +6 -2
  15. package/esm2022/src/core_render3_private_export.mjs +2 -2
  16. package/esm2022/src/errors.mjs +1 -1
  17. package/esm2022/src/image_performance_warning.mjs +154 -0
  18. package/esm2022/src/linker/compiler.mjs +1 -1
  19. package/esm2022/src/metadata/directives.mjs +1 -1
  20. package/esm2022/src/render3/after_render_hooks.mjs +5 -1
  21. package/esm2022/src/render3/assert.mjs +16 -1
  22. package/esm2022/src/render3/component_ref.mjs +12 -3
  23. package/esm2022/src/render3/debug/framework_injector_profiler.mjs +33 -4
  24. package/esm2022/src/render3/debug/injector_profiler.mjs +1 -1
  25. package/esm2022/src/render3/debug/set_debug_info.mjs +20 -0
  26. package/esm2022/src/render3/definition.mjs +2 -1
  27. package/esm2022/src/render3/deps_tracker/api.mjs +1 -1
  28. package/esm2022/src/render3/deps_tracker/deps_tracker.mjs +13 -2
  29. package/esm2022/src/render3/features/host_directives_feature.mjs +3 -8
  30. package/esm2022/src/render3/hooks.mjs +5 -5
  31. package/esm2022/src/render3/index.mjs +3 -2
  32. package/esm2022/src/render3/instructions/change_detection.mjs +31 -14
  33. package/esm2022/src/render3/instructions/control_flow.mjs +75 -63
  34. package/esm2022/src/render3/instructions/defer.mjs +410 -60
  35. package/esm2022/src/render3/instructions/defer_events.mjs +28 -8
  36. package/esm2022/src/render3/instructions/shared.mjs +5 -4
  37. package/esm2022/src/render3/interfaces/container.mjs +5 -4
  38. package/esm2022/src/render3/interfaces/defer.mjs +13 -6
  39. package/esm2022/src/render3/interfaces/definition.mjs +1 -1
  40. package/esm2022/src/render3/interfaces/view.mjs +5 -4
  41. package/esm2022/src/render3/jit/environment.mjs +3 -1
  42. package/esm2022/src/render3/list_reconciliation.mjs +257 -0
  43. package/esm2022/src/render3/node_manipulation.mjs +4 -6
  44. package/esm2022/src/render3/pipe.mjs +4 -4
  45. package/esm2022/src/render3/reactive_lview_consumer.mjs +2 -2
  46. package/esm2022/src/render3/reactivity/api.mjs +15 -0
  47. package/esm2022/src/render3/reactivity/asserts.mjs +26 -0
  48. package/esm2022/src/render3/reactivity/computed.mjs +19 -0
  49. package/esm2022/src/render3/reactivity/effect.mjs +7 -6
  50. package/esm2022/src/render3/reactivity/signal.mjs +32 -0
  51. package/esm2022/src/render3/reactivity/untracked.mjs +24 -0
  52. package/esm2022/src/render3/util/global_utils.mjs +3 -2
  53. package/esm2022/src/render3/util/injector_discovery_utils.mjs +70 -9
  54. package/esm2022/src/render3/util/stringify_utils.mjs +28 -1
  55. package/esm2022/src/render3/util/view_utils.mjs +41 -25
  56. package/esm2022/src/render3/view_ref.mjs +13 -2
  57. package/esm2022/src/util/stringify.mjs +16 -1
  58. package/esm2022/src/version.mjs +1 -1
  59. package/esm2022/testing/src/logger.mjs +3 -3
  60. package/fesm2022/core.mjs +15104 -14010
  61. package/fesm2022/core.mjs.map +1 -1
  62. package/fesm2022/primitives/signals.mjs +539 -0
  63. package/fesm2022/primitives/signals.mjs.map +1 -0
  64. package/fesm2022/rxjs-interop.mjs +45 -14
  65. package/fesm2022/rxjs-interop.mjs.map +1 -1
  66. package/fesm2022/testing.mjs +1 -1
  67. package/index.d.ts +171 -167
  68. package/package.json +7 -1
  69. package/primitives/signals/index.d.ts +281 -0
  70. package/rxjs-interop/index.d.ts +15 -101
  71. package/schematics/collection.json +12 -2
  72. package/schematics/migrations/block-template-entities/bundle.js +1192 -610
  73. package/schematics/migrations/block-template-entities/bundle.js.map +4 -4
  74. package/schematics/migrations/compiler-options/bundle.js +582 -0
  75. package/schematics/migrations/compiler-options/bundle.js.map +7 -0
  76. package/schematics/migrations/transfer-state/bundle.js +592 -0
  77. package/schematics/migrations/transfer-state/bundle.js.map +7 -0
  78. package/schematics/migrations.json +10 -0
  79. package/schematics/ng-generate/control-flow-migration/bundle.js +24097 -0
  80. package/schematics/ng-generate/control-flow-migration/bundle.js.map +7 -0
  81. package/schematics/ng-generate/control-flow-migration/schema.json +7 -0
  82. package/schematics/ng-generate/standalone-migration/bundle.js +2470 -1627
  83. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  84. package/testing/index.d.ts +1 -1
  85. package/esm2022/src/signals/index.mjs +0 -16
  86. package/esm2022/src/signals/src/api.mjs +0 -39
  87. package/esm2022/src/signals/src/computed.mjs +0 -95
  88. package/esm2022/src/signals/src/errors.mjs +0 -18
  89. package/esm2022/src/signals/src/graph.mjs +0 -280
  90. package/esm2022/src/signals/src/signal.mjs +0 -92
  91. package/esm2022/src/signals/src/untracked.mjs +0 -26
  92. package/esm2022/src/signals/src/watch.mjs +0 -81
  93. package/esm2022/src/signals/src/weak_ref.mjs +0 -11
@@ -63,7 +63,7 @@ var __async = (__this, __arguments, generator) => {
63
63
  });
64
64
  };
65
65
 
66
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/migrations/block-template-entities/index.mjs
66
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/migrations/block-template-entities/index.mjs
67
67
  var block_template_entities_exports = {};
68
68
  __export(block_template_entities_exports, {
69
69
  default: () => block_template_entities_default
@@ -72,7 +72,7 @@ module.exports = __toCommonJS(block_template_entities_exports);
72
72
  var import_schematics = require("@angular-devkit/schematics");
73
73
  var import_path3 = require("path");
74
74
 
75
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/utils/project_tsconfig_paths.mjs
75
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/project_tsconfig_paths.mjs
76
76
  var import_core = require("@angular-devkit/core");
77
77
  function getProjectTsConfigPaths(tree) {
78
78
  return __async(this, null, function* () {
@@ -85,7 +85,7 @@ function getProjectTsConfigPaths(tree) {
85
85
  continue;
86
86
  }
87
87
  for (const [, options] of allTargetOptions(target)) {
88
- const tsConfig = options.tsConfig;
88
+ const tsConfig = options["tsConfig"];
89
89
  if (typeof tsConfig !== "string" || !tree.exists(tsConfig)) {
90
90
  continue;
91
91
  }
@@ -152,11 +152,11 @@ function getWorkspace(tree) {
152
152
  });
153
153
  }
154
154
 
155
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs
155
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs
156
156
  var import_path = require("path");
157
157
  var import_typescript2 = __toESM(require("typescript"), 1);
158
158
 
159
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/utils/typescript/parse_tsconfig.mjs
159
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/typescript/parse_tsconfig.mjs
160
160
  var path = __toESM(require("path"), 1);
161
161
  var import_typescript = __toESM(require("typescript"), 1);
162
162
  function parseTsconfigFile(tsconfigPath, basePath) {
@@ -173,7 +173,7 @@ function parseTsconfigFile(tsconfigPath, basePath) {
173
173
  return import_typescript.default.parseJsonConfigFileContent(config, parseConfigHost, basePath, {});
174
174
  }
175
175
 
176
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs
176
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs
177
177
  function createMigrationProgram(tree, tsconfigPath, basePath, fakeFileRead, additionalFiles) {
178
178
  const { rootNames, options, host } = createProgramOptions(tree, tsconfigPath, basePath, fakeFileRead, additionalFiles);
179
179
  return import_typescript2.default.createProgram(rootNames, options, host);
@@ -206,7 +206,7 @@ function canMigrateFile(basePath, sourceFile, program) {
206
206
  return !(0, import_path.relative)(basePath, sourceFile.fileName).startsWith("..");
207
207
  }
208
208
 
209
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/selector.mjs
209
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/selector.mjs
210
210
  var _SELECTOR_REGEXP = new RegExp(
211
211
  `(\\:not\\()|(([\\.\\#]?)[-\\w]+)|(?:\\[([-.\\w*\\\\$]+)(?:=(["']?)([^\\]"']*)\\5)?\\])|(\\))|(\\s*,\\s*)`,
212
212
  "g"
@@ -514,7 +514,7 @@ var SelectorContext = class {
514
514
  }
515
515
  };
516
516
 
517
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/core.mjs
517
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/core.mjs
518
518
  var ViewEncapsulation;
519
519
  (function(ViewEncapsulation2) {
520
520
  ViewEncapsulation2[ViewEncapsulation2["Emulated"] = 0] = "Emulated";
@@ -576,7 +576,7 @@ function parseSelectorToR3Selector(selector) {
576
576
  return selector ? CssSelector.parse(selector).map(parserSelectorToR3Selector) : [];
577
577
  }
578
578
 
579
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/i18n/digest.mjs
579
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/digest.mjs
580
580
  var textEncoder;
581
581
  function computeDigest(message) {
582
582
  return sha1(serializeNodes(message.nodes).join("") + `[${message.meaning}]`);
@@ -813,7 +813,7 @@ function wordAt(bytes, index, endian) {
813
813
  return word;
814
814
  }
815
815
 
816
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/output/output_ast.mjs
816
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/output/output_ast.mjs
817
817
  var TypeModifier;
818
818
  (function(TypeModifier2) {
819
819
  TypeModifier2[TypeModifier2["None"] = 0] = "None";
@@ -1768,7 +1768,7 @@ function serializeTags(tags) {
1768
1768
  return out;
1769
1769
  }
1770
1770
 
1771
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/constant_pool.mjs
1771
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/constant_pool.mjs
1772
1772
  var CONSTANT_PREFIX = "_c";
1773
1773
  var UNKNOWN_VALUE_KEY = variable("<unknown>");
1774
1774
  var KEY_CONTEXT = {};
@@ -1951,7 +1951,7 @@ function isLongStringLiteral(expr) {
1951
1951
  return expr instanceof LiteralExpr && typeof expr.value === "string" && expr.value.length >= POOL_INCLUSION_LENGTH_THRESHOLD_FOR_STRINGS;
1952
1952
  }
1953
1953
 
1954
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_identifiers.mjs
1954
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/r3_identifiers.mjs
1955
1955
  var CORE = "@angular/core";
1956
1956
  var _Identifiers = class {
1957
1957
  };
@@ -2181,6 +2181,9 @@ var Identifiers = _Identifiers;
2181
2181
  (() => {
2182
2182
  _Identifiers.deferPrefetchOnViewport = { name: "\u0275\u0275deferPrefetchOnViewport", moduleName: CORE };
2183
2183
  })();
2184
+ (() => {
2185
+ _Identifiers.deferEnableTimerScheduling = { name: "\u0275\u0275deferEnableTimerScheduling", moduleName: CORE };
2186
+ })();
2184
2187
  (() => {
2185
2188
  _Identifiers.conditional = { name: "\u0275\u0275conditional", moduleName: CORE };
2186
2189
  })();
@@ -2508,6 +2511,9 @@ var Identifiers = _Identifiers;
2508
2511
  (() => {
2509
2512
  _Identifiers.setClassMetadataAsync = { name: "\u0275setClassMetadataAsync", moduleName: CORE };
2510
2513
  })();
2514
+ (() => {
2515
+ _Identifiers.setClassDebugInfo = { name: "\u0275setClassDebugInfo", moduleName: CORE };
2516
+ })();
2511
2517
  (() => {
2512
2518
  _Identifiers.queryRefresh = { name: "\u0275\u0275queryRefresh", moduleName: CORE };
2513
2519
  })();
@@ -2578,7 +2584,7 @@ var Identifiers = _Identifiers;
2578
2584
  _Identifiers.validateIframeAttribute = { name: "\u0275\u0275validateIframeAttribute", moduleName: CORE };
2579
2585
  })();
2580
2586
 
2581
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/util.mjs
2587
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/util.mjs
2582
2588
  var DASH_CASE_REGEXP = /-+([a-z0-9])/g;
2583
2589
  function dashCaseToCamelCase(input) {
2584
2590
  return input.replace(DASH_CASE_REGEXP, (...m) => m[1].toUpperCase());
@@ -2666,7 +2672,7 @@ function partitionArray(arr, conditionFn) {
2666
2672
  return [truthy, falsy];
2667
2673
  }
2668
2674
 
2669
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/output/source_map.mjs
2675
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/output/source_map.mjs
2670
2676
  var VERSION = 3;
2671
2677
  var JS_B64_PREFIX = "# sourceMappingURL=data:application/json;base64,";
2672
2678
  var SourceMapGenerator = class {
@@ -2795,7 +2801,7 @@ function toBase64Digit(value) {
2795
2801
  return B64_DIGITS[value];
2796
2802
  }
2797
2803
 
2798
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/output/abstract_emitter.mjs
2804
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/output/abstract_emitter.mjs
2799
2805
  var _SINGLE_QUOTE_ESCAPE_STRING_RE = /'|\\|\n|\r|\$/g;
2800
2806
  var _LEGAL_IDENTIFIER_RE = /^[$A-Z_][0-9A-Z_$]*$/i;
2801
2807
  var _INDENT_WITH = " ";
@@ -3024,7 +3030,14 @@ var AbstractEmitterVisitor = class {
3024
3030
  return null;
3025
3031
  }
3026
3032
  visitInvokeFunctionExpr(expr, ctx) {
3033
+ const shouldParenthesize = expr.fn instanceof ArrowFunctionExpr;
3034
+ if (shouldParenthesize) {
3035
+ ctx.print(expr.fn, "(");
3036
+ }
3027
3037
  expr.fn.visitExpression(this, ctx);
3038
+ if (shouldParenthesize) {
3039
+ ctx.print(expr.fn, ")");
3040
+ }
3028
3041
  ctx.print(expr, `(`);
3029
3042
  this.visitAllExpressions(expr.args, ctx, ",");
3030
3043
  ctx.print(expr, `)`);
@@ -3273,7 +3286,7 @@ function _createIndent(count) {
3273
3286
  return res;
3274
3287
  }
3275
3288
 
3276
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/util.mjs
3289
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/util.mjs
3277
3290
  function typeWithParameters(type, numParams) {
3278
3291
  if (numParams === 0) {
3279
3292
  return expressionType(type);
@@ -3320,7 +3333,7 @@ function wrapReference(value) {
3320
3333
  }
3321
3334
  function refsToArray(refs, shouldForwardDeclare) {
3322
3335
  const values = literalArr(refs.map((ref) => ref.value));
3323
- return shouldForwardDeclare ? fn([], [new ReturnStatement(values)]) : values;
3336
+ return shouldForwardDeclare ? arrowFn([], values) : values;
3324
3337
  }
3325
3338
  function createMayBeForwardRefExpression(expression, forwardRef) {
3326
3339
  return { expression, forwardRef };
@@ -3335,10 +3348,10 @@ function convertFromMaybeForwardRefExpression({ expression, forwardRef }) {
3335
3348
  }
3336
3349
  }
3337
3350
  function generateForwardRef(expr) {
3338
- return importExpr(Identifiers.forwardRef).callFn([fn([], [new ReturnStatement(expr)])]);
3351
+ return importExpr(Identifiers.forwardRef).callFn([arrowFn([], expr)]);
3339
3352
  }
3340
3353
 
3341
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_factory.mjs
3354
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/r3_factory.mjs
3342
3355
  var R3FactoryDelegateType;
3343
3356
  (function(R3FactoryDelegateType2) {
3344
3357
  R3FactoryDelegateType2[R3FactoryDelegateType2["Class"] = 0] = "Class";
@@ -3394,7 +3407,7 @@ function compileFactoryFunction(meta) {
3394
3407
  }
3395
3408
  let factoryFn = fn([new FnParam("t", DYNAMIC_TYPE)], body, INFERRED_TYPE, void 0, `${meta.name}_Factory`);
3396
3409
  if (baseFactoryVar !== null) {
3397
- factoryFn = fn([], [
3410
+ factoryFn = arrowFn([], [
3398
3411
  new DeclareVarStmt(baseFactoryVar.name),
3399
3412
  new ReturnStatement(factoryFn)
3400
3413
  ]).callFn([], void 0, true);
@@ -3483,7 +3496,7 @@ function getInjectFn(target) {
3483
3496
  }
3484
3497
  }
3485
3498
 
3486
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_ast.mjs
3499
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/r3_ast.mjs
3487
3500
  var Comment = class {
3488
3501
  constructor(value, sourceSpan) {
3489
3502
  this.value = value;
@@ -3666,12 +3679,13 @@ var DeferredBlockError = class {
3666
3679
  }
3667
3680
  };
3668
3681
  var DeferredBlock = class {
3669
- constructor(children, triggers, prefetchTriggers, placeholder, loading, error2, sourceSpan, startSourceSpan, endSourceSpan) {
3682
+ constructor(children, triggers, prefetchTriggers, placeholder, loading, error2, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan) {
3670
3683
  this.children = children;
3671
3684
  this.placeholder = placeholder;
3672
3685
  this.loading = loading;
3673
3686
  this.error = error2;
3674
3687
  this.sourceSpan = sourceSpan;
3688
+ this.mainBlockSpan = mainBlockSpan;
3675
3689
  this.startSourceSpan = startSourceSpan;
3676
3690
  this.endSourceSpan = endSourceSpan;
3677
3691
  this.triggers = triggers;
@@ -3686,20 +3700,18 @@ var DeferredBlock = class {
3686
3700
  this.visitTriggers(this.definedTriggers, this.triggers, visitor);
3687
3701
  this.visitTriggers(this.definedPrefetchTriggers, this.prefetchTriggers, visitor);
3688
3702
  visitAll(visitor, this.children);
3689
- this.placeholder && visitor.visitDeferredBlockPlaceholder(this.placeholder);
3690
- this.loading && visitor.visitDeferredBlockLoading(this.loading);
3691
- this.error && visitor.visitDeferredBlockError(this.error);
3703
+ const remainingBlocks = [this.placeholder, this.loading, this.error].filter((x) => x !== null);
3704
+ visitAll(visitor, remainingBlocks);
3692
3705
  }
3693
3706
  visitTriggers(keys, triggers, visitor) {
3694
- for (const key of keys) {
3695
- visitor.visitDeferredTrigger(triggers[key]);
3696
- }
3707
+ visitAll(visitor, keys.map((k) => triggers[k]));
3697
3708
  }
3698
3709
  };
3699
3710
  var SwitchBlock = class {
3700
- constructor(expression, cases, sourceSpan, startSourceSpan, endSourceSpan) {
3711
+ constructor(expression, cases, unknownBlocks, sourceSpan, startSourceSpan, endSourceSpan) {
3701
3712
  this.expression = expression;
3702
3713
  this.cases = cases;
3714
+ this.unknownBlocks = unknownBlocks;
3703
3715
  this.sourceSpan = sourceSpan;
3704
3716
  this.startSourceSpan = startSourceSpan;
3705
3717
  this.endSourceSpan = endSourceSpan;
@@ -3709,18 +3721,19 @@ var SwitchBlock = class {
3709
3721
  }
3710
3722
  };
3711
3723
  var SwitchBlockCase = class {
3712
- constructor(expression, children, sourceSpan, startSourceSpan) {
3724
+ constructor(expression, children, sourceSpan, startSourceSpan, endSourceSpan) {
3713
3725
  this.expression = expression;
3714
3726
  this.children = children;
3715
3727
  this.sourceSpan = sourceSpan;
3716
3728
  this.startSourceSpan = startSourceSpan;
3729
+ this.endSourceSpan = endSourceSpan;
3717
3730
  }
3718
3731
  visit(visitor) {
3719
3732
  return visitor.visitSwitchBlockCase(this);
3720
3733
  }
3721
3734
  };
3722
3735
  var ForLoopBlock = class {
3723
- constructor(item, expression, trackBy, contextVariables, children, empty, sourceSpan, startSourceSpan, endSourceSpan) {
3736
+ constructor(item, expression, trackBy, contextVariables, children, empty, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan) {
3724
3737
  this.item = item;
3725
3738
  this.expression = expression;
3726
3739
  this.trackBy = trackBy;
@@ -3728,6 +3741,7 @@ var ForLoopBlock = class {
3728
3741
  this.children = children;
3729
3742
  this.empty = empty;
3730
3743
  this.sourceSpan = sourceSpan;
3744
+ this.mainBlockSpan = mainBlockSpan;
3731
3745
  this.startSourceSpan = startSourceSpan;
3732
3746
  this.endSourceSpan = endSourceSpan;
3733
3747
  }
@@ -3736,10 +3750,11 @@ var ForLoopBlock = class {
3736
3750
  }
3737
3751
  };
3738
3752
  var ForLoopBlockEmpty = class {
3739
- constructor(children, sourceSpan, startSourceSpan) {
3753
+ constructor(children, sourceSpan, startSourceSpan, endSourceSpan) {
3740
3754
  this.children = children;
3741
3755
  this.sourceSpan = sourceSpan;
3742
3756
  this.startSourceSpan = startSourceSpan;
3757
+ this.endSourceSpan = endSourceSpan;
3743
3758
  }
3744
3759
  visit(visitor) {
3745
3760
  return visitor.visitForLoopBlockEmpty(this);
@@ -3757,17 +3772,27 @@ var IfBlock = class {
3757
3772
  }
3758
3773
  };
3759
3774
  var IfBlockBranch = class {
3760
- constructor(expression, children, expressionAlias, sourceSpan, startSourceSpan) {
3775
+ constructor(expression, children, expressionAlias, sourceSpan, startSourceSpan, endSourceSpan) {
3761
3776
  this.expression = expression;
3762
3777
  this.children = children;
3763
3778
  this.expressionAlias = expressionAlias;
3764
3779
  this.sourceSpan = sourceSpan;
3765
3780
  this.startSourceSpan = startSourceSpan;
3781
+ this.endSourceSpan = endSourceSpan;
3766
3782
  }
3767
3783
  visit(visitor) {
3768
3784
  return visitor.visitIfBlockBranch(this);
3769
3785
  }
3770
3786
  };
3787
+ var UnknownBlock = class {
3788
+ constructor(name, sourceSpan) {
3789
+ this.name = name;
3790
+ this.sourceSpan = sourceSpan;
3791
+ }
3792
+ visit(visitor) {
3793
+ return visitor.visitUnknownBlock(this);
3794
+ }
3795
+ };
3771
3796
  var Template = class {
3772
3797
  constructor(tagName, attributes, inputs, outputs, templateAttrs, children, references, variables, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
3773
3798
  this.tagName = tagName;
@@ -3851,7 +3876,7 @@ function visitAll(visitor, nodes) {
3851
3876
  return result;
3852
3877
  }
3853
3878
 
3854
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/i18n/i18n_ast.mjs
3879
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/i18n_ast.mjs
3855
3880
  var Message = class {
3856
3881
  constructor(nodes, placeholders, placeholderToMessage, meaning, description, customId) {
3857
3882
  this.nodes = nodes;
@@ -3970,7 +3995,7 @@ var LocalizeMessageStringVisitor = class {
3970
3995
  }
3971
3996
  };
3972
3997
 
3973
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/i18n/serializers/xml_helper.mjs
3998
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/serializers/xml_helper.mjs
3974
3999
  var _Visitor = class {
3975
4000
  visitTag(tag) {
3976
4001
  const strAttrs = this._serializeAttributes(tag.attrs);
@@ -3998,12 +4023,12 @@ ${doctype.dtd}
3998
4023
  };
3999
4024
  var _visitor = new _Visitor();
4000
4025
 
4001
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/i18n/serializers/xmb.mjs
4026
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/serializers/xmb.mjs
4002
4027
  function toPublicName(internalName) {
4003
4028
  return internalName.toUpperCase().replace(/[^A-Z0-9_]/g, "_");
4004
4029
  }
4005
4030
 
4006
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/i18n/util.mjs
4031
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/view/i18n/util.mjs
4007
4032
  var CLOSURE_TRANSLATION_VAR_PREFIX = "MSG_";
4008
4033
  var TRANSLATION_VAR_PREFIX = "i18n_";
4009
4034
  var I18N_ATTR = "i18n";
@@ -4105,7 +4130,7 @@ function declareI18nVariable(variable2) {
4105
4130
  return new DeclareVarStmt(variable2.name, void 0, INFERRED_TYPE, void 0, variable2.sourceSpan);
4106
4131
  }
4107
4132
 
4108
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/util.mjs
4133
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/view/util.mjs
4109
4134
  var UNSAFE_OBJECT_KEY_NAME_REGEXP = /[-.]/;
4110
4135
  var TEMPORARY_NAME = "_t";
4111
4136
  var CONTEXT_NAME = "ctx";
@@ -4260,7 +4285,12 @@ var DefinitionMap = class {
4260
4285
  }
4261
4286
  set(key, value) {
4262
4287
  if (value) {
4263
- this.values.push({ key, value, quoted: false });
4288
+ const existing = this.values.find((value2) => value2.key === key);
4289
+ if (existing) {
4290
+ existing.value = value;
4291
+ } else {
4292
+ this.values.push({ key, value, quoted: false });
4293
+ }
4264
4294
  }
4265
4295
  }
4266
4296
  toLiteralMap() {
@@ -4323,7 +4353,7 @@ function getInstructionStatements(instructions) {
4323
4353
  return statements;
4324
4354
  }
4325
4355
 
4326
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/injectable_compiler_2.mjs
4356
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/injectable_compiler_2.mjs
4327
4357
  function compileInjectable(meta, resolveForwardRefs) {
4328
4358
  let result = null;
4329
4359
  const factoryMeta = {
@@ -4361,10 +4391,7 @@ function compileInjectable(meta, resolveForwardRefs) {
4361
4391
  delegateType: R3FactoryDelegateType.Function
4362
4392
  }));
4363
4393
  } else {
4364
- result = {
4365
- statements: [],
4366
- expression: fn([], [new ReturnStatement(meta.useFactory.callFn([]))])
4367
- };
4394
+ result = { statements: [], expression: arrowFn([], meta.useFactory.callFn([])) };
4368
4395
  }
4369
4396
  } else if (meta.useValue !== void 0) {
4370
4397
  result = compileFactoryFunction(__spreadProps(__spreadValues({}, factoryMeta), {
@@ -4408,10 +4435,10 @@ function delegateToFactory(type, useType, unwrapForwardRefs) {
4408
4435
  return createFactoryFunction(unwrappedType);
4409
4436
  }
4410
4437
  function createFactoryFunction(type) {
4411
- return fn([new FnParam("t", DYNAMIC_TYPE)], [new ReturnStatement(type.prop("\u0275fac").callFn([variable("t")]))]);
4438
+ return arrowFn([new FnParam("t", DYNAMIC_TYPE)], type.prop("\u0275fac").callFn([variable("t")]));
4412
4439
  }
4413
4440
 
4414
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/assertions.mjs
4441
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/assertions.mjs
4415
4442
  var UNUSABLE_INTERPOLATION_REGEXPS = [
4416
4443
  /^\s*$/,
4417
4444
  /[<>]/,
@@ -4433,7 +4460,7 @@ function assertInterpolationSymbols(identifier, value) {
4433
4460
  }
4434
4461
  }
4435
4462
 
4436
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/interpolation_config.mjs
4463
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/ml_parser/interpolation_config.mjs
4437
4464
  var InterpolationConfig = class {
4438
4465
  static fromArray(markers) {
4439
4466
  if (!markers) {
@@ -4449,7 +4476,7 @@ var InterpolationConfig = class {
4449
4476
  };
4450
4477
  var DEFAULT_INTERPOLATION_CONFIG = new InterpolationConfig("{{", "}}");
4451
4478
 
4452
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/chars.mjs
4479
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/chars.mjs
4453
4480
  var $EOF = 0;
4454
4481
  var $BSPACE = 8;
4455
4482
  var $TAB = 9;
@@ -4531,7 +4558,7 @@ function isQuote(code) {
4531
4558
  return code === $SQ || code === $DQ || code === $BT;
4532
4559
  }
4533
4560
 
4534
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/parse_util.mjs
4561
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/parse_util.mjs
4535
4562
  var ParseLocation = class {
4536
4563
  constructor(file, offset, line, col) {
4537
4564
  this.file = file;
@@ -4678,7 +4705,7 @@ function sanitizeIdentifier(name) {
4678
4705
  return name.replace(/\W/g, "_");
4679
4706
  }
4680
4707
 
4681
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/output/abstract_js_emitter.mjs
4708
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/output/abstract_js_emitter.mjs
4682
4709
  var makeTemplateObjectPolyfill = '(this&&this.__makeTemplateObject||function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e})';
4683
4710
  var AbstractJsEmitterVisitor = class extends AbstractEmitterVisitor {
4684
4711
  constructor() {
@@ -4771,7 +4798,7 @@ var AbstractJsEmitterVisitor = class extends AbstractEmitterVisitor {
4771
4798
  }
4772
4799
  };
4773
4800
 
4774
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/output/output_jit_trusted_types.mjs
4801
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/output/output_jit_trusted_types.mjs
4775
4802
  var policy;
4776
4803
  function getPolicy() {
4777
4804
  if (policy === void 0) {
@@ -4809,7 +4836,7 @@ function newTrustedFunctionForJIT(...args) {
4809
4836
  return fn2.bind(_global);
4810
4837
  }
4811
4838
 
4812
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/output/output_jit.mjs
4839
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/output/output_jit.mjs
4813
4840
  var JitEvaluator = class {
4814
4841
  evaluateStatements(sourceUrl, statements, refResolver, createSourceMaps) {
4815
4842
  const converter = new JitEmitterVisitor(refResolver);
@@ -4900,7 +4927,7 @@ function isUseStrictStatement(statement) {
4900
4927
  return statement.isEquivalent(literal("use strict").toStmt());
4901
4928
  }
4902
4929
 
4903
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_injector_compiler.mjs
4930
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/r3_injector_compiler.mjs
4904
4931
  function compileInjector(meta) {
4905
4932
  const definitionMap = new DefinitionMap();
4906
4933
  if (meta.providers !== null) {
@@ -4917,7 +4944,7 @@ function createInjectorType(meta) {
4917
4944
  return new ExpressionType(importExpr(Identifiers.InjectorDeclaration, [new ExpressionType(meta.type.type)]));
4918
4945
  }
4919
4946
 
4920
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_jit.mjs
4947
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/r3_jit.mjs
4921
4948
  var R3JitReflector = class {
4922
4949
  constructor(context) {
4923
4950
  this.context = context;
@@ -4933,7 +4960,7 @@ var R3JitReflector = class {
4933
4960
  }
4934
4961
  };
4935
4962
 
4936
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_module_compiler.mjs
4963
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/r3_module_compiler.mjs
4937
4964
  var R3SelectorScopeMode;
4938
4965
  (function(R3SelectorScopeMode2) {
4939
4966
  R3SelectorScopeMode2[R3SelectorScopeMode2["Inline"] = 0] = "Inline";
@@ -5074,7 +5101,7 @@ function tupleOfTypes(types) {
5074
5101
  return types.length > 0 ? expressionType(literalArr(typeofTypes)) : NONE_TYPE;
5075
5102
  }
5076
5103
 
5077
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_pipe_compiler.mjs
5104
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/r3_pipe_compiler.mjs
5078
5105
  function compilePipeFromMetadata(metadata) {
5079
5106
  const definitionMapValues = [];
5080
5107
  definitionMapValues.push({ key: "name", value: literal(metadata.pipeName), quoted: false });
@@ -5095,7 +5122,7 @@ function createPipeType(metadata) {
5095
5122
  ]));
5096
5123
  }
5097
5124
 
5098
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/api.mjs
5125
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/view/api.mjs
5099
5126
  var R3TemplateDependencyKind;
5100
5127
  (function(R3TemplateDependencyKind2) {
5101
5128
  R3TemplateDependencyKind2[R3TemplateDependencyKind2["Directive"] = 0] = "Directive";
@@ -5103,7 +5130,7 @@ var R3TemplateDependencyKind;
5103
5130
  R3TemplateDependencyKind2[R3TemplateDependencyKind2["NgModule"] = 2] = "NgModule";
5104
5131
  })(R3TemplateDependencyKind || (R3TemplateDependencyKind = {}));
5105
5132
 
5106
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/expression_parser/ast.mjs
5133
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/expression_parser/ast.mjs
5107
5134
  var ParserError = class {
5108
5135
  constructor(message, input, errLocation, ctxLocation) {
5109
5136
  this.input = input;
@@ -5769,7 +5796,7 @@ var BoundElementProperty = class {
5769
5796
  }
5770
5797
  };
5771
5798
 
5772
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/compiler_util/expression_converter.mjs
5799
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/compiler_util/expression_converter.mjs
5773
5800
  var _EventHandlerVars = class {
5774
5801
  };
5775
5802
  var EventHandlerVars = _EventHandlerVars;
@@ -6410,7 +6437,7 @@ var BuiltinFunctionCall = class extends Call {
6410
6437
  }
6411
6438
  };
6412
6439
 
6413
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/schema/dom_security_schema.mjs
6440
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/schema/dom_security_schema.mjs
6414
6441
  var _SECURITY_SCHEMA;
6415
6442
  function SECURITY_SCHEMA() {
6416
6443
  if (!_SECURITY_SCHEMA) {
@@ -6468,7 +6495,7 @@ function isIframeSecuritySensitiveAttr(attrName) {
6468
6495
  return IFRAME_SECURITY_SENSITIVE_ATTRS.has(attrName.toLowerCase());
6469
6496
  }
6470
6497
 
6471
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/shadow_css.mjs
6498
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/shadow_css.mjs
6472
6499
  var animationKeywords = /* @__PURE__ */ new Set([
6473
6500
  "inherit",
6474
6501
  "initial",
@@ -6935,7 +6962,7 @@ function repeatGroups(groups, multiples) {
6935
6962
  }
6936
6963
  }
6937
6964
 
6938
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/enums.mjs
6965
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/enums.mjs
6939
6966
  var OpKind;
6940
6967
  (function(OpKind2) {
6941
6968
  OpKind2[OpKind2["ListEnd"] = 0] = "ListEnd";
@@ -6964,14 +6991,19 @@ var OpKind;
6964
6991
  OpKind2[OpKind2["Pipe"] = 23] = "Pipe";
6965
6992
  OpKind2[OpKind2["Attribute"] = 24] = "Attribute";
6966
6993
  OpKind2[OpKind2["ExtractedAttribute"] = 25] = "ExtractedAttribute";
6967
- OpKind2[OpKind2["ExtractedMessage"] = 26] = "ExtractedMessage";
6968
- OpKind2[OpKind2["HostProperty"] = 27] = "HostProperty";
6969
- OpKind2[OpKind2["Namespace"] = 28] = "Namespace";
6970
- OpKind2[OpKind2["ProjectionDef"] = 29] = "ProjectionDef";
6971
- OpKind2[OpKind2["Projection"] = 30] = "Projection";
6972
- OpKind2[OpKind2["I18nStart"] = 31] = "I18nStart";
6973
- OpKind2[OpKind2["I18n"] = 32] = "I18n";
6974
- OpKind2[OpKind2["I18nEnd"] = 33] = "I18nEnd";
6994
+ OpKind2[OpKind2["Defer"] = 26] = "Defer";
6995
+ OpKind2[OpKind2["DeferSecondaryBlock"] = 27] = "DeferSecondaryBlock";
6996
+ OpKind2[OpKind2["DeferOn"] = 28] = "DeferOn";
6997
+ OpKind2[OpKind2["ExtractedMessage"] = 29] = "ExtractedMessage";
6998
+ OpKind2[OpKind2["HostProperty"] = 30] = "HostProperty";
6999
+ OpKind2[OpKind2["Namespace"] = 31] = "Namespace";
7000
+ OpKind2[OpKind2["ProjectionDef"] = 32] = "ProjectionDef";
7001
+ OpKind2[OpKind2["Projection"] = 33] = "Projection";
7002
+ OpKind2[OpKind2["I18nStart"] = 34] = "I18nStart";
7003
+ OpKind2[OpKind2["I18n"] = 35] = "I18n";
7004
+ OpKind2[OpKind2["I18nEnd"] = 36] = "I18nEnd";
7005
+ OpKind2[OpKind2["I18nExpression"] = 37] = "I18nExpression";
7006
+ OpKind2[OpKind2["I18nApply"] = 38] = "I18nApply";
6975
7007
  })(OpKind || (OpKind = {}));
6976
7008
  var ExpressionKind;
6977
7009
  (function(ExpressionKind2) {
@@ -6996,6 +7028,7 @@ var ExpressionKind;
6996
7028
  ExpressionKind2[ExpressionKind2["ReadTemporaryExpr"] = 18] = "ReadTemporaryExpr";
6997
7029
  ExpressionKind2[ExpressionKind2["SanitizerExpr"] = 19] = "SanitizerExpr";
6998
7030
  ExpressionKind2[ExpressionKind2["SlotLiteralExpr"] = 20] = "SlotLiteralExpr";
7031
+ ExpressionKind2[ExpressionKind2["ConditionalCase"] = 21] = "ConditionalCase";
6999
7032
  })(ExpressionKind || (ExpressionKind = {}));
7000
7033
  var SemanticVariableKind;
7001
7034
  (function(SemanticVariableKind2) {
@@ -7017,6 +7050,12 @@ var SanitizerFn;
7017
7050
  SanitizerFn2[SanitizerFn2["ResourceUrl"] = 4] = "ResourceUrl";
7018
7051
  SanitizerFn2[SanitizerFn2["IframeAttribute"] = 5] = "IframeAttribute";
7019
7052
  })(SanitizerFn || (SanitizerFn = {}));
7053
+ var DeferSecondaryKind;
7054
+ (function(DeferSecondaryKind2) {
7055
+ DeferSecondaryKind2[DeferSecondaryKind2["Loading"] = 0] = "Loading";
7056
+ DeferSecondaryKind2[DeferSecondaryKind2["Placeholder"] = 1] = "Placeholder";
7057
+ DeferSecondaryKind2[DeferSecondaryKind2["Error"] = 2] = "Error";
7058
+ })(DeferSecondaryKind || (DeferSecondaryKind = {}));
7020
7059
  var BindingKind;
7021
7060
  (function(BindingKind2) {
7022
7061
  BindingKind2[BindingKind2["Attribute"] = 0] = "Attribute";
@@ -7028,12 +7067,13 @@ var BindingKind;
7028
7067
  BindingKind2[BindingKind2["Animation"] = 6] = "Animation";
7029
7068
  })(BindingKind || (BindingKind = {}));
7030
7069
 
7031
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/traits.mjs
7070
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/traits.mjs
7032
7071
  var ConsumesSlot = Symbol("ConsumesSlot");
7033
7072
  var DependsOnSlotContext = Symbol("DependsOnSlotContext");
7034
7073
  var UsesSlotIndex = Symbol("UsesSlotIndex");
7035
7074
  var ConsumesVarsTrait = Symbol("ConsumesVars");
7036
7075
  var UsesVarOffset = Symbol("UsesVarOffset");
7076
+ var HasConst = Symbol("HasConst");
7037
7077
  var TRAIT_CONSUMES_SLOT = {
7038
7078
  [ConsumesSlot]: true,
7039
7079
  slot: null,
@@ -7041,7 +7081,7 @@ var TRAIT_CONSUMES_SLOT = {
7041
7081
  };
7042
7082
  var TRAIT_USES_SLOT_INDEX = {
7043
7083
  [UsesSlotIndex]: true,
7044
- slot: null
7084
+ targetSlot: null
7045
7085
  };
7046
7086
  var TRAIT_DEPENDS_ON_SLOT_CONTEXT = {
7047
7087
  [DependsOnSlotContext]: true
@@ -7053,6 +7093,10 @@ var TRAIT_USES_VAR_OFFSET = {
7053
7093
  [UsesVarOffset]: true,
7054
7094
  varOffset: null
7055
7095
  };
7096
+ var TRAIT_HAS_CONST = {
7097
+ [HasConst]: true,
7098
+ constIndex: null
7099
+ };
7056
7100
  function hasConsumesSlotTrait(op) {
7057
7101
  return op[ConsumesSlot] === true;
7058
7102
  }
@@ -7068,8 +7112,11 @@ function hasUsesVarOffsetTrait(expr) {
7068
7112
  function hasUsesSlotIndexTrait(value) {
7069
7113
  return value[UsesSlotIndex] === true;
7070
7114
  }
7115
+ function hasConstTrait(value) {
7116
+ return value[HasConst] === true;
7117
+ }
7071
7118
 
7072
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/shared.mjs
7119
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/shared.mjs
7073
7120
  function createStatementOp(statement) {
7074
7121
  return __spreadValues({
7075
7122
  kind: OpKind.Statement,
@@ -7090,12 +7137,13 @@ var NEW_OP = {
7090
7137
  next: null
7091
7138
  };
7092
7139
 
7093
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/update.mjs
7094
- function createInterpolateTextOp(xref, interpolation, sourceSpan) {
7140
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/update.mjs
7141
+ function createInterpolateTextOp(xref, interpolation, i18nPlaceholders, sourceSpan) {
7095
7142
  return __spreadValues(__spreadValues(__spreadValues({
7096
7143
  kind: OpKind.InterpolateText,
7097
7144
  target: xref,
7098
7145
  interpolation,
7146
+ i18nPlaceholders,
7099
7147
  sourceSpan
7100
7148
  }, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
7101
7149
  }
@@ -7187,18 +7235,36 @@ function createAdvanceOp(delta, sourceSpan) {
7187
7235
  sourceSpan
7188
7236
  }, NEW_OP);
7189
7237
  }
7190
- function createConditionalOp(target, test, sourceSpan) {
7191
- return __spreadValues(__spreadValues(__spreadValues({
7238
+ function createConditionalOp(target, test, conditions, sourceSpan) {
7239
+ return __spreadValues(__spreadValues(__spreadValues(__spreadValues({
7192
7240
  kind: OpKind.Conditional,
7193
7241
  target,
7194
7242
  test,
7195
- conditions: [],
7243
+ conditions,
7196
7244
  processed: null,
7245
+ sourceSpan,
7246
+ contextValue: null
7247
+ }, NEW_OP), TRAIT_USES_SLOT_INDEX), TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS);
7248
+ }
7249
+ function createI18nExpressionOp(owner, expression, i18nPlaceholder, sourceSpan) {
7250
+ return __spreadValues(__spreadValues(__spreadValues({
7251
+ kind: OpKind.I18nExpression,
7252
+ owner,
7253
+ target: owner,
7254
+ expression,
7255
+ i18nPlaceholder,
7256
+ sourceSpan
7257
+ }, NEW_OP), TRAIT_CONSUMES_VARS), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
7258
+ }
7259
+ function createI18nApplyOp(target, sourceSpan) {
7260
+ return __spreadValues(__spreadValues({
7261
+ kind: OpKind.I18nApply,
7262
+ target,
7197
7263
  sourceSpan
7198
- }, NEW_OP), TRAIT_USES_SLOT_INDEX), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
7264
+ }, NEW_OP), TRAIT_USES_SLOT_INDEX);
7199
7265
  }
7200
7266
 
7201
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/expression.mjs
7267
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/expression.mjs
7202
7268
  var _a;
7203
7269
  var _b;
7204
7270
  var _c;
@@ -7244,7 +7310,7 @@ var _ReferenceExpr = class extends ExpressionBase {
7244
7310
  this.offset = offset;
7245
7311
  this.kind = ExpressionKind.Reference;
7246
7312
  this[_a] = true;
7247
- this.slot = null;
7313
+ this.targetSlot = null;
7248
7314
  }
7249
7315
  visitExpression() {
7250
7316
  }
@@ -7258,7 +7324,7 @@ var _ReferenceExpr = class extends ExpressionBase {
7258
7324
  }
7259
7325
  clone() {
7260
7326
  const expr = new _ReferenceExpr(this.target, this.offset);
7261
- expr.slot = this.slot;
7327
+ expr.targetSlot = this.targetSlot;
7262
7328
  return expr;
7263
7329
  }
7264
7330
  };
@@ -7484,7 +7550,7 @@ var _PipeBindingExpr = class extends ExpressionBase {
7484
7550
  this[_d] = true;
7485
7551
  this[_e] = true;
7486
7552
  this[_f] = true;
7487
- this.slot = null;
7553
+ this.targetSlot = null;
7488
7554
  this.varOffset = null;
7489
7555
  }
7490
7556
  visitExpression(visitor, context) {
@@ -7505,7 +7571,7 @@ var _PipeBindingExpr = class extends ExpressionBase {
7505
7571
  }
7506
7572
  clone() {
7507
7573
  const r = new _PipeBindingExpr(this.target, this.name, this.args.map((a) => a.clone()));
7508
- r.slot = this.slot;
7574
+ r.targetSlot = this.targetSlot;
7509
7575
  r.varOffset = this.varOffset;
7510
7576
  return r;
7511
7577
  }
@@ -7525,7 +7591,7 @@ var _PipeBindingVariadicExpr = class extends ExpressionBase {
7525
7591
  this[_g] = true;
7526
7592
  this[_h] = true;
7527
7593
  this[_j] = true;
7528
- this.slot = null;
7594
+ this.targetSlot = null;
7529
7595
  this.varOffset = null;
7530
7596
  }
7531
7597
  visitExpression(visitor, context) {
@@ -7542,7 +7608,7 @@ var _PipeBindingVariadicExpr = class extends ExpressionBase {
7542
7608
  }
7543
7609
  clone() {
7544
7610
  const r = new _PipeBindingVariadicExpr(this.target, this.name, this.args.clone(), this.numArgs);
7545
- r.slot = this.slot;
7611
+ r.targetSlot = this.targetSlot;
7546
7612
  r.varOffset = this.varOffset;
7547
7613
  return r;
7548
7614
  }
@@ -7750,18 +7816,20 @@ var _SlotLiteralExpr = class extends ExpressionBase {
7750
7816
  this.target = target;
7751
7817
  this.kind = ExpressionKind.SlotLiteralExpr;
7752
7818
  this[_k] = true;
7753
- this.slot = null;
7819
+ this.targetSlot = null;
7754
7820
  }
7755
7821
  visitExpression(visitor, context) {
7756
7822
  }
7757
7823
  isEquivalent(e) {
7758
- return e instanceof _SlotLiteralExpr && e.target === this.target && e.slot === this.slot;
7824
+ return e instanceof _SlotLiteralExpr && e.target === this.target && e.targetSlot === this.targetSlot;
7759
7825
  }
7760
7826
  isConstant() {
7761
7827
  return true;
7762
7828
  }
7763
7829
  clone() {
7764
- return new _SlotLiteralExpr(this.target);
7830
+ const copy = new _SlotLiteralExpr(this.target);
7831
+ copy.targetSlot = this.targetSlot;
7832
+ return copy;
7765
7833
  }
7766
7834
  transformInternalExpressions() {
7767
7835
  }
@@ -7770,6 +7838,34 @@ var SlotLiteralExpr = _SlotLiteralExpr;
7770
7838
  (() => {
7771
7839
  _k = UsesSlotIndex;
7772
7840
  })();
7841
+ var ConditionalCaseExpr = class extends ExpressionBase {
7842
+ constructor(expr, target, alias = null) {
7843
+ super();
7844
+ this.expr = expr;
7845
+ this.target = target;
7846
+ this.alias = alias;
7847
+ this.kind = ExpressionKind.ConditionalCase;
7848
+ }
7849
+ visitExpression(visitor, context) {
7850
+ if (this.expr !== null) {
7851
+ this.expr.visitExpression(visitor, context);
7852
+ }
7853
+ }
7854
+ isEquivalent(e) {
7855
+ return e instanceof ConditionalCaseExpr && e.expr === this.expr;
7856
+ }
7857
+ isConstant() {
7858
+ return true;
7859
+ }
7860
+ clone() {
7861
+ return new ConditionalCaseExpr(this.expr, this.target);
7862
+ }
7863
+ transformInternalExpressions(transform2, flags) {
7864
+ if (this.expr !== null) {
7865
+ this.expr = transformExpressionsInExpression(this.expr, transform2, flags);
7866
+ }
7867
+ }
7868
+ };
7773
7869
  function visitExpressionsInOp(op, visitor) {
7774
7870
  transformExpressionsInOp(op, (expr, flags) => {
7775
7871
  visitor(expr, flags);
@@ -7809,6 +7905,9 @@ function transformExpressionsInOp(op, transform2, flags) {
7809
7905
  }
7810
7906
  op.sanitizer = op.sanitizer && transformExpressionsInExpression(op.sanitizer, transform2, flags);
7811
7907
  break;
7908
+ case OpKind.I18nExpression:
7909
+ op.expression = transformExpressionsInExpression(op.expression, transform2, flags);
7910
+ break;
7812
7911
  case OpKind.InterpolateText:
7813
7912
  transformExpressionsInInterpolation(op.interpolation, transform2, flags);
7814
7913
  break;
@@ -7820,14 +7919,17 @@ function transformExpressionsInOp(op, transform2, flags) {
7820
7919
  break;
7821
7920
  case OpKind.Conditional:
7822
7921
  for (const condition of op.conditions) {
7823
- if (condition[1] === null) {
7922
+ if (condition.expr === null) {
7824
7923
  continue;
7825
7924
  }
7826
- condition[1] = transformExpressionsInExpression(condition[1], transform2, flags);
7925
+ condition.expr = transformExpressionsInExpression(condition.expr, transform2, flags);
7827
7926
  }
7828
7927
  if (op.processed !== null) {
7829
7928
  op.processed = transformExpressionsInExpression(op.processed, transform2, flags);
7830
7929
  }
7930
+ if (op.contextValue !== null) {
7931
+ op.contextValue = transformExpressionsInExpression(op.contextValue, transform2, flags);
7932
+ }
7831
7933
  break;
7832
7934
  case OpKind.Listener:
7833
7935
  for (const innerOp of op.handlerOps) {
@@ -7843,17 +7945,20 @@ function transformExpressionsInOp(op, transform2, flags) {
7843
7945
  transformExpressionsInStatement(statement, transform2, flags);
7844
7946
  }
7845
7947
  break;
7948
+ case OpKind.I18n:
7846
7949
  case OpKind.I18nStart:
7847
- for (const placeholder in op.tagNameParams) {
7848
- op.tagNameParams[placeholder] = transformExpressionsInExpression(op.tagNameParams[placeholder], transform2, flags);
7950
+ for (const [placeholder, expression] of op.params) {
7951
+ op.params.set(placeholder, transformExpressionsInExpression(expression, transform2, flags));
7849
7952
  }
7850
7953
  break;
7954
+ case OpKind.Defer:
7955
+ case OpKind.DeferSecondaryBlock:
7956
+ case OpKind.DeferOn:
7851
7957
  case OpKind.Projection:
7852
7958
  case OpKind.ProjectionDef:
7853
7959
  case OpKind.Element:
7854
7960
  case OpKind.ElementStart:
7855
7961
  case OpKind.ElementEnd:
7856
- case OpKind.I18n:
7857
7962
  case OpKind.I18nEnd:
7858
7963
  case OpKind.Container:
7859
7964
  case OpKind.ContainerStart:
@@ -7865,6 +7970,7 @@ function transformExpressionsInOp(op, transform2, flags) {
7865
7970
  case OpKind.Pipe:
7866
7971
  case OpKind.Advance:
7867
7972
  case OpKind.Namespace:
7973
+ case OpKind.I18nApply:
7868
7974
  break;
7869
7975
  default:
7870
7976
  throw new Error(`AssertionError: transformExpressionsInOp doesn't handle ${OpKind[op.kind]}`);
@@ -7946,7 +8052,7 @@ function isStringLiteral(expr) {
7946
8052
  return expr instanceof LiteralExpr && typeof expr.value === "string";
7947
8053
  }
7948
8054
 
7949
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/operations.mjs
8055
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/operations.mjs
7950
8056
  var _OpList = class {
7951
8057
  constructor() {
7952
8058
  this.debugListId = _OpList.nextListId++;
@@ -8065,7 +8171,7 @@ var _OpList = class {
8065
8171
  const last = prev;
8066
8172
  if (oldPrev !== null) {
8067
8173
  oldPrev.next = first;
8068
- first.prev = oldOp.prev;
8174
+ first.prev = oldPrev;
8069
8175
  }
8070
8176
  if (oldNext !== null) {
8071
8177
  oldNext.prev = last;
@@ -8137,7 +8243,7 @@ var OpList = _OpList;
8137
8243
  _OpList.nextListId = 0;
8138
8244
  })();
8139
8245
 
8140
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/create.mjs
8246
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/create.mjs
8141
8247
  var elementContainerOpKinds = /* @__PURE__ */ new Set([
8142
8248
  OpKind.Element,
8143
8249
  OpKind.ElementStart,
@@ -8149,7 +8255,7 @@ var elementContainerOpKinds = /* @__PURE__ */ new Set([
8149
8255
  function isElementOrContainerOp(op) {
8150
8256
  return elementContainerOpKinds.has(op.kind);
8151
8257
  }
8152
- function createElementStartOp(tag, xref, namespace, i18n2, sourceSpan) {
8258
+ function createElementStartOp(tag, xref, namespace, i18nPlaceholder, sourceSpan) {
8153
8259
  return __spreadValues(__spreadValues({
8154
8260
  kind: OpKind.ElementStart,
8155
8261
  xref,
@@ -8158,23 +8264,23 @@ function createElementStartOp(tag, xref, namespace, i18n2, sourceSpan) {
8158
8264
  localRefs: [],
8159
8265
  nonBindable: false,
8160
8266
  namespace,
8161
- i18n: i18n2,
8267
+ i18nPlaceholder,
8162
8268
  sourceSpan
8163
8269
  }, TRAIT_CONSUMES_SLOT), NEW_OP);
8164
8270
  }
8165
- function createTemplateOp(xref, tag, namespace, controlFlow, i18n2, sourceSpan) {
8271
+ function createTemplateOp(xref, tag, namespace, generatedInBlock, i18nPlaceholder, sourceSpan) {
8166
8272
  return __spreadValues(__spreadValues({
8167
8273
  kind: OpKind.Template,
8168
8274
  xref,
8169
8275
  attributes: null,
8170
8276
  tag,
8171
- controlFlow,
8277
+ block: generatedInBlock,
8172
8278
  decls: null,
8173
8279
  vars: null,
8174
8280
  localRefs: [],
8175
8281
  nonBindable: false,
8176
8282
  namespace,
8177
- i18n: i18n2,
8283
+ i18nPlaceholder,
8178
8284
  sourceSpan
8179
8285
  }, TRAIT_CONSUMES_SLOT), NEW_OP);
8180
8286
  }
@@ -8246,7 +8352,7 @@ function createProjectionDefOp(def) {
8246
8352
  }, NEW_OP);
8247
8353
  }
8248
8354
  function createProjectionOp(xref, selector) {
8249
- return __spreadValues(__spreadValues(__spreadValues({
8355
+ return __spreadValues(__spreadValues({
8250
8356
  kind: OpKind.Projection,
8251
8357
  xref,
8252
8358
  selector,
@@ -8254,9 +8360,8 @@ function createProjectionOp(xref, selector) {
8254
8360
  attributes: null,
8255
8361
  localRefs: [],
8256
8362
  nonBindable: false,
8257
- i18n: void 0,
8258
8363
  sourceSpan: null
8259
- }, NEW_OP), TRAIT_CONSUMES_SLOT), TRAIT_USES_SLOT_INDEX);
8364
+ }, NEW_OP), TRAIT_CONSUMES_SLOT);
8260
8365
  }
8261
8366
  function createExtractedAttributeOp(target, bindingKind, name, expression) {
8262
8367
  return __spreadValues({
@@ -8267,6 +8372,34 @@ function createExtractedAttributeOp(target, bindingKind, name, expression) {
8267
8372
  expression
8268
8373
  }, NEW_OP);
8269
8374
  }
8375
+ function createDeferOp(xref, main, sourceSpan) {
8376
+ return __spreadValues(__spreadValues(__spreadValues({
8377
+ kind: OpKind.Defer,
8378
+ xref,
8379
+ target: main,
8380
+ loading: null,
8381
+ placeholder: null,
8382
+ error: null,
8383
+ sourceSpan
8384
+ }, NEW_OP), TRAIT_CONSUMES_SLOT), TRAIT_USES_SLOT_INDEX);
8385
+ }
8386
+ function createDeferSecondaryOp(deferOp, secondaryView, secondaryBlockKind) {
8387
+ return __spreadValues(__spreadValues(__spreadValues({
8388
+ kind: OpKind.DeferSecondaryBlock,
8389
+ deferOp,
8390
+ target: secondaryView,
8391
+ secondaryBlockKind,
8392
+ constValue: null,
8393
+ makeExpression: literalOrArrayLiteral
8394
+ }, NEW_OP), TRAIT_USES_SLOT_INDEX), TRAIT_HAS_CONST);
8395
+ }
8396
+ function createDeferOnOp(xref, sourceSpan) {
8397
+ return __spreadValues(__spreadValues({
8398
+ kind: OpKind.DeferOn,
8399
+ xref,
8400
+ sourceSpan
8401
+ }, NEW_OP), TRAIT_CONSUMES_SLOT);
8402
+ }
8270
8403
  function createExtractedMessageOp(owner, expression, statements) {
8271
8404
  return __spreadValues({
8272
8405
  kind: OpKind.ExtractedMessage,
@@ -8275,13 +8408,15 @@ function createExtractedMessageOp(owner, expression, statements) {
8275
8408
  statements
8276
8409
  }, NEW_OP);
8277
8410
  }
8278
- function createI18nStartOp(xref, i18n2) {
8411
+ function createI18nStartOp(xref, message, root) {
8279
8412
  return __spreadValues(__spreadValues({
8280
8413
  kind: OpKind.I18nStart,
8281
8414
  xref,
8282
- i18n: i18n2,
8283
- tagNameParams: {},
8284
- messageIndex: null
8415
+ root: root != null ? root : xref,
8416
+ message,
8417
+ params: /* @__PURE__ */ new Map(),
8418
+ messageIndex: null,
8419
+ subTemplateIndex: null
8285
8420
  }, NEW_OP), TRAIT_CONSUMES_SLOT);
8286
8421
  }
8287
8422
  function createI18nEndOp(xref) {
@@ -8290,8 +8425,14 @@ function createI18nEndOp(xref) {
8290
8425
  xref
8291
8426
  }, NEW_OP);
8292
8427
  }
8428
+ function literalOrArrayLiteral(value) {
8429
+ if (Array.isArray(value)) {
8430
+ return literalArr(value.map(literalOrArrayLiteral));
8431
+ }
8432
+ return literal(value, INFERRED_TYPE);
8433
+ }
8293
8434
 
8294
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/host.mjs
8435
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/host.mjs
8295
8436
  function createHostPropertyOp(name, expression, isAnimationTrigger, sourceSpan) {
8296
8437
  return __spreadValues(__spreadValues({
8297
8438
  kind: OpKind.HostProperty,
@@ -8302,7 +8443,10 @@ function createHostPropertyOp(name, expression, isAnimationTrigger, sourceSpan)
8302
8443
  }, TRAIT_CONSUMES_VARS), NEW_OP);
8303
8444
  }
8304
8445
 
8305
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/compilation.mjs
8446
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/variable.mjs
8447
+ var CTX_REF = "CTX_REF_MARKER";
8448
+
8449
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/compilation.mjs
8306
8450
  var CompilationJobKind;
8307
8451
  (function(CompilationJobKind2) {
8308
8452
  CompilationJobKind2[CompilationJobKind2["Tmpl"] = 0] = "Tmpl";
@@ -8407,7 +8551,7 @@ var HostBindingCompilationUnit = class extends CompilationUnit {
8407
8551
  }
8408
8552
  };
8409
8553
 
8410
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/var_counting.mjs
8554
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/var_counting.mjs
8411
8555
  function phaseVarCounting(job) {
8412
8556
  for (const unit of job.units) {
8413
8557
  let varCount = 0;
@@ -8415,6 +8559,8 @@ function phaseVarCounting(job) {
8415
8559
  if (hasConsumesVarsTrait(op)) {
8416
8560
  varCount += varsUsedByOp(op);
8417
8561
  }
8562
+ }
8563
+ for (const op of unit.ops()) {
8418
8564
  visitExpressionsInOp(op, (expr) => {
8419
8565
  if (!isIrExpression(expr)) {
8420
8566
  return;
@@ -8463,6 +8609,9 @@ function varsUsedByOp(op) {
8463
8609
  return slots;
8464
8610
  case OpKind.InterpolateText:
8465
8611
  return op.interpolation.expressions.length;
8612
+ case OpKind.I18nExpression:
8613
+ case OpKind.Conditional:
8614
+ return 1;
8466
8615
  default:
8467
8616
  throw new Error(`Unhandled op: ${OpKind[op.kind]}`);
8468
8617
  }
@@ -8480,7 +8629,7 @@ function varsUsedByIrExpression(expr) {
8480
8629
  }
8481
8630
  }
8482
8631
 
8483
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/align_pipe_variadic_var_offset.mjs
8632
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/align_pipe_variadic_var_offset.mjs
8484
8633
  function phaseAlignPipeVariadicVarOffset(job) {
8485
8634
  for (const unit of job.units) {
8486
8635
  for (const op of unit.update) {
@@ -8502,7 +8651,7 @@ function phaseAlignPipeVariadicVarOffset(job) {
8502
8651
  }
8503
8652
  }
8504
8653
 
8505
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/any_cast.mjs
8654
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/any_cast.mjs
8506
8655
  function phaseFindAnyCasts(job) {
8507
8656
  for (const unit of job.units) {
8508
8657
  for (const op of unit.ops()) {
@@ -8520,7 +8669,49 @@ function removeAnys(e) {
8520
8669
  return e;
8521
8670
  }
8522
8671
 
8523
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/util/elements.mjs
8672
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/apply_i18n_expressions.mjs
8673
+ function phaseApplyI18nExpressions(job) {
8674
+ for (const unit of job.units) {
8675
+ for (const op of unit.update) {
8676
+ if (op.kind === OpKind.I18nExpression && needsApplication(op)) {
8677
+ OpList.insertAfter(createI18nApplyOp(op.owner, null), op);
8678
+ }
8679
+ }
8680
+ }
8681
+ }
8682
+ function needsApplication(op) {
8683
+ var _a2;
8684
+ if (((_a2 = op.next) == null ? void 0 : _a2.kind) !== OpKind.I18nExpression) {
8685
+ return true;
8686
+ }
8687
+ if (op.next.owner !== op.owner) {
8688
+ return true;
8689
+ }
8690
+ return false;
8691
+ }
8692
+
8693
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/assign_i18n_slot_dependencies.mjs
8694
+ function phaseAssignI18nSlotDependencies(job) {
8695
+ const i18nLastSlotConsumers = /* @__PURE__ */ new Map();
8696
+ let lastSlotConsumer = null;
8697
+ for (const unit of job.units) {
8698
+ for (const op of unit.create) {
8699
+ if (op.kind === OpKind.I18nEnd) {
8700
+ i18nLastSlotConsumers.set(op.xref, lastSlotConsumer);
8701
+ }
8702
+ if (hasConsumesSlotTrait(op)) {
8703
+ lastSlotConsumer = op.xref;
8704
+ }
8705
+ }
8706
+ for (const op of unit.update) {
8707
+ if (op.kind === OpKind.I18nExpression) {
8708
+ op.target = i18nLastSlotConsumers.get(op.owner);
8709
+ }
8710
+ }
8711
+ }
8712
+ }
8713
+
8714
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/util/elements.mjs
8524
8715
  function getElementsByXrefId(unit) {
8525
8716
  const elements = /* @__PURE__ */ new Map();
8526
8717
  for (const op of unit.create) {
@@ -8532,7 +8723,7 @@ function getElementsByXrefId(unit) {
8532
8723
  return elements;
8533
8724
  }
8534
8725
 
8535
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/attribute_extraction.mjs
8726
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/attribute_extraction.mjs
8536
8727
  function phaseAttributeExtraction(job) {
8537
8728
  for (const unit of job.units) {
8538
8729
  const elements = getElementsByXrefId(unit);
@@ -8599,7 +8790,7 @@ function extractAttributeOp(unit, op, elements) {
8599
8790
  }
8600
8791
  }
8601
8792
 
8602
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/binding_specialization.mjs
8793
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/binding_specialization.mjs
8603
8794
  function lookupElement2(elements, xref) {
8604
8795
  const el = elements.get(xref);
8605
8796
  if (el === void 0) {
@@ -8649,16 +8840,22 @@ function phaseBindingSpecialization(job) {
8649
8840
  }
8650
8841
  }
8651
8842
 
8652
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/chaining.mjs
8843
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/chaining.mjs
8653
8844
  var CHAINABLE = /* @__PURE__ */ new Set([
8654
- Identifiers.elementStart,
8655
- Identifiers.elementEnd,
8845
+ Identifiers.attribute,
8846
+ Identifiers.classProp,
8656
8847
  Identifiers.element,
8657
- Identifiers.property,
8848
+ Identifiers.elementContainer,
8849
+ Identifiers.elementContainerEnd,
8850
+ Identifiers.elementContainerStart,
8851
+ Identifiers.elementEnd,
8852
+ Identifiers.elementStart,
8658
8853
  Identifiers.hostProperty,
8659
- Identifiers.syntheticHostProperty,
8854
+ Identifiers.i18nExp,
8855
+ Identifiers.listener,
8856
+ Identifiers.listener,
8857
+ Identifiers.property,
8660
8858
  Identifiers.styleProp,
8661
- Identifiers.attribute,
8662
8859
  Identifiers.stylePropInterpolate1,
8663
8860
  Identifiers.stylePropInterpolate2,
8664
8861
  Identifiers.stylePropInterpolate3,
@@ -8668,13 +8865,8 @@ var CHAINABLE = /* @__PURE__ */ new Set([
8668
8865
  Identifiers.stylePropInterpolate7,
8669
8866
  Identifiers.stylePropInterpolate8,
8670
8867
  Identifiers.stylePropInterpolateV,
8671
- Identifiers.classProp,
8672
- Identifiers.listener,
8673
- Identifiers.elementContainerStart,
8674
- Identifiers.elementContainerEnd,
8675
- Identifiers.elementContainer,
8676
- Identifiers.listener,
8677
8868
  Identifiers.syntheticHostListener,
8869
+ Identifiers.syntheticHostProperty,
8678
8870
  Identifiers.templateCreate
8679
8871
  ]);
8680
8872
  function phaseChaining(job) {
@@ -8714,7 +8906,7 @@ function chainOperationsInList(opList) {
8714
8906
  }
8715
8907
  }
8716
8908
 
8717
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/conditionals.mjs
8909
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/conditionals.mjs
8718
8910
  function phaseConditionals(job) {
8719
8911
  for (const unit of job.units) {
8720
8912
  for (const op of unit.ops()) {
@@ -8722,26 +8914,35 @@ function phaseConditionals(job) {
8722
8914
  continue;
8723
8915
  }
8724
8916
  let test;
8725
- const defaultCase = op.conditions.findIndex(([xref, cond]) => cond === null);
8917
+ const defaultCase = op.conditions.findIndex((cond) => cond.expr === null);
8726
8918
  if (defaultCase >= 0) {
8727
- const [xref, cond] = op.conditions.splice(defaultCase, 1)[0];
8919
+ const xref = op.conditions.splice(defaultCase, 1)[0].target;
8728
8920
  test = new SlotLiteralExpr(xref);
8729
8921
  } else {
8730
8922
  test = literal(-1);
8731
8923
  }
8732
- let tmp = new AssignTemporaryExpr(op.test, job.allocateXrefId());
8924
+ let tmp = op.test == null ? null : new AssignTemporaryExpr(op.test, job.allocateXrefId());
8733
8925
  for (let i = op.conditions.length - 1; i >= 0; i--) {
8734
- const useTmp = i === 0 ? tmp : new ReadTemporaryExpr(tmp.xref);
8735
- const [xref, check] = op.conditions[i];
8736
- const comparison = new BinaryOperatorExpr(BinaryOperator.Identical, useTmp, check);
8737
- test = new ConditionalExpr(comparison, new SlotLiteralExpr(xref), test);
8926
+ let conditionalCase = op.conditions[i];
8927
+ if (conditionalCase.expr === null) {
8928
+ continue;
8929
+ }
8930
+ if (tmp !== null) {
8931
+ const useTmp = i === 0 ? tmp : new ReadTemporaryExpr(tmp.xref);
8932
+ conditionalCase.expr = new BinaryOperatorExpr(BinaryOperator.Identical, useTmp, conditionalCase.expr);
8933
+ } else if (conditionalCase.alias !== null) {
8934
+ const caseExpressionTemporaryXref = job.allocateXrefId();
8935
+ conditionalCase.expr = new AssignTemporaryExpr(conditionalCase.expr, caseExpressionTemporaryXref);
8936
+ op.contextValue = new ReadTemporaryExpr(caseExpressionTemporaryXref);
8937
+ }
8938
+ test = new ConditionalExpr(conditionalCase.expr, new SlotLiteralExpr(conditionalCase.target), test);
8738
8939
  }
8739
8940
  op.processed = test;
8740
8941
  }
8741
8942
  }
8742
8943
  }
8743
8944
 
8744
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/tags.mjs
8945
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/ml_parser/tags.mjs
8745
8946
  var TagContentType;
8746
8947
  (function(TagContentType2) {
8747
8948
  TagContentType2[TagContentType2["RAW_TEXT"] = 0] = "RAW_TEXT";
@@ -8774,7 +8975,7 @@ function mergeNsAndName(prefix, localName) {
8774
8975
  return prefix ? `:${prefix}:${localName}` : localName;
8775
8976
  }
8776
8977
 
8777
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/conversion.mjs
8978
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/conversion.mjs
8778
8979
  var BINARY_OPERATORS = /* @__PURE__ */ new Map([
8779
8980
  ["&&", BinaryOperator.And],
8780
8981
  [">", BinaryOperator.Bigger],
@@ -8794,15 +8995,16 @@ var BINARY_OPERATORS = /* @__PURE__ */ new Map([
8794
8995
  ["||", BinaryOperator.Or],
8795
8996
  ["+", BinaryOperator.Plus]
8796
8997
  ]);
8797
- var NAMESPACES = /* @__PURE__ */ new Map([["svg", Namespace.SVG], ["math", Namespace.Math]]);
8798
8998
  function namespaceForKey(namespacePrefixKey) {
8799
8999
  var _a2;
9000
+ const NAMESPACES = /* @__PURE__ */ new Map([["svg", Namespace.SVG], ["math", Namespace.Math]]);
8800
9001
  if (namespacePrefixKey === null) {
8801
9002
  return Namespace.HTML;
8802
9003
  }
8803
9004
  return (_a2 = NAMESPACES.get(namespacePrefixKey)) != null ? _a2 : Namespace.HTML;
8804
9005
  }
8805
9006
  function keyForNamespace(namespace) {
9007
+ const NAMESPACES = /* @__PURE__ */ new Map([["svg", Namespace.SVG], ["math", Namespace.Math]]);
8806
9008
  for (const [k, n] of NAMESPACES.entries()) {
8807
9009
  if (n === namespace) {
8808
9010
  return k;
@@ -8816,14 +9018,14 @@ function prefixWithNamespace(strippedTag, namespace) {
8816
9018
  }
8817
9019
  return `:${keyForNamespace(namespace)}:${strippedTag}`;
8818
9020
  }
8819
- function literalOrArrayLiteral(value) {
9021
+ function literalOrArrayLiteral2(value) {
8820
9022
  if (Array.isArray(value)) {
8821
- return literalArr(value.map(literalOrArrayLiteral));
9023
+ return literalArr(value.map(literalOrArrayLiteral2));
8822
9024
  }
8823
9025
  return literal(value, INFERRED_TYPE);
8824
9026
  }
8825
9027
 
8826
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/const_collection.mjs
9028
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/const_collection.mjs
8827
9029
  function phaseConstCollection(job) {
8828
9030
  const allElementAttributes = /* @__PURE__ */ new Map();
8829
9031
  for (const unit of job.units) {
@@ -8937,7 +9139,7 @@ function serializeAttributes({ attributes, bindings, classes, i18n: i18n2, proje
8937
9139
  const attrArray = [...attributes];
8938
9140
  if (projectAs !== null) {
8939
9141
  const parsedR3Selector = parseSelectorToR3Selector(projectAs)[0];
8940
- attrArray.push(literal(5), literalOrArrayLiteral(parsedR3Selector));
9142
+ attrArray.push(literal(5), literalOrArrayLiteral2(parsedR3Selector));
8941
9143
  }
8942
9144
  if (classes.length > 0) {
8943
9145
  attrArray.push(literal(1), ...classes);
@@ -8957,12 +9159,13 @@ function serializeAttributes({ attributes, bindings, classes, i18n: i18n2, proje
8957
9159
  return literalArr(attrArray);
8958
9160
  }
8959
9161
 
8960
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/empty_elements.mjs
9162
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/empty_elements.mjs
8961
9163
  var REPLACEMENTS = /* @__PURE__ */ new Map([
8962
9164
  [OpKind.ElementEnd, [OpKind.ElementStart, OpKind.Element]],
8963
9165
  [OpKind.ContainerEnd, [OpKind.ContainerStart, OpKind.Container]],
8964
9166
  [OpKind.I18nEnd, [OpKind.I18nStart, OpKind.I18n]]
8965
9167
  ]);
9168
+ var IGNORED_OP_KINDS = /* @__PURE__ */ new Set([OpKind.Pipe]);
8966
9169
  function phaseEmptyElements(job) {
8967
9170
  for (const unit of job.units) {
8968
9171
  for (const op of unit.create) {
@@ -8971,15 +9174,19 @@ function phaseEmptyElements(job) {
8971
9174
  continue;
8972
9175
  }
8973
9176
  const [startKind, mergedKind] = opReplacements;
8974
- if (op.prev !== null && op.prev.kind === startKind) {
8975
- op.prev.kind = mergedKind;
9177
+ let prevOp = op.prev;
9178
+ while (prevOp !== null && IGNORED_OP_KINDS.has(prevOp.kind)) {
9179
+ prevOp = prevOp.prev;
9180
+ }
9181
+ if (prevOp !== null && prevOp.kind === startKind) {
9182
+ prevOp.kind = mergedKind;
8976
9183
  OpList.remove(op);
8977
9184
  }
8978
9185
  }
8979
9186
  }
8980
9187
  }
8981
9188
 
8982
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/expand_safe_reads.mjs
9189
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/expand_safe_reads.mjs
8983
9190
  function phaseExpandSafeReads(job) {
8984
9191
  for (const unit of job.units) {
8985
9192
  for (const op of unit.ops()) {
@@ -9115,7 +9322,7 @@ function ternaryTransform(e) {
9115
9322
  return new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.Equals, e.guard, NULL_EXPR), NULL_EXPR, e.expr);
9116
9323
  }
9117
9324
 
9118
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/generate_advance.mjs
9325
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/generate_advance.mjs
9119
9326
  function phaseGenerateAdvance(job) {
9120
9327
  for (const unit of job.units) {
9121
9328
  const slotMap = /* @__PURE__ */ new Map();
@@ -9147,33 +9354,31 @@ function phaseGenerateAdvance(job) {
9147
9354
  }
9148
9355
  }
9149
9356
 
9150
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/generate_i18n_blocks.mjs
9151
- function phaseGenerateI18nBlocks(job) {
9357
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/generate_projection_def.mjs
9358
+ function phaseGenerateProjectionDef(job) {
9359
+ const share = job.compatibility === CompatibilityMode.TemplateDefinitionBuilder;
9360
+ const selectors = [];
9361
+ let projectionSlotIndex = 0;
9152
9362
  for (const unit of job.units) {
9153
- const elements = getElementsByXrefId(unit);
9154
9363
  for (const op of unit.create) {
9155
- switch (op.kind) {
9156
- case OpKind.ElementEnd:
9157
- const start = elements.get(op.xref);
9158
- if (start.i18n instanceof Message) {
9159
- const id = job.allocateXrefId();
9160
- OpList.insertAfter(createI18nStartOp(id, start.i18n), start);
9161
- OpList.insertBefore(createI18nEndOp(id), op);
9162
- }
9163
- break;
9164
- case OpKind.Template:
9165
- if (op.i18n !== void 0) {
9166
- const id = job.allocateXrefId();
9167
- OpList.insertBefore(createI18nStartOp(id, op.i18n), op);
9168
- OpList.insertAfter(createI18nEndOp(id), op);
9169
- }
9170
- break;
9364
+ if (op.kind === OpKind.Projection) {
9365
+ selectors.push(op.selector);
9366
+ op.projectionSlotIndex = projectionSlotIndex++;
9171
9367
  }
9172
9368
  }
9173
9369
  }
9370
+ if (selectors.length > 0) {
9371
+ let defExpr = null;
9372
+ if (selectors.length > 1 || selectors[0] !== "*") {
9373
+ const def = selectors.map((s) => s === "*" ? s : parseSelectorToR3Selector(s));
9374
+ defExpr = job.pool.getConstLiteral(literalOrArrayLiteral2(def), share);
9375
+ }
9376
+ job.contentSelectors = job.pool.getConstLiteral(literalOrArrayLiteral2(selectors), share);
9377
+ job.root.create.prepend([createProjectionDefOp(defExpr)]);
9378
+ }
9174
9379
  }
9175
9380
 
9176
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/generate_variables.mjs
9381
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/generate_variables.mjs
9177
9382
  function phaseGenerateVariables(job) {
9178
9383
  recursivelyProcessView(job.root, null);
9179
9384
  }
@@ -9242,7 +9447,9 @@ function generateVariablesInScopeForView(view, scope) {
9242
9447
  newOps.push(createVariableOp(view.job.allocateXrefId(), scope.viewContextVariable, new NextContextExpr()));
9243
9448
  }
9244
9449
  for (const [name, value] of view.job.views.get(scope.view).contextVariables) {
9245
- newOps.push(createVariableOp(view.job.allocateXrefId(), scope.contextVariables.get(name), new ReadPropExpr(new ContextExpr(scope.view), value)));
9450
+ const context = new ContextExpr(scope.view);
9451
+ const variable2 = value === CTX_REF ? context : new ReadPropExpr(context, value);
9452
+ newOps.push(createVariableOp(view.job.allocateXrefId(), scope.contextVariables.get(name), variable2));
9246
9453
  }
9247
9454
  for (const ref of scope.references) {
9248
9455
  newOps.push(createVariableOp(view.job.allocateXrefId(), ref.variable, new ReferenceExpr(ref.targetId, ref.offset)));
@@ -9253,16 +9460,41 @@ function generateVariablesInScopeForView(view, scope) {
9253
9460
  return newOps;
9254
9461
  }
9255
9462
 
9256
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/host_style_property_parsing.mjs
9463
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/has_const_trait_collection.mjs
9464
+ function phaseConstTraitCollection(job) {
9465
+ const collectGlobalConsts = (e) => {
9466
+ if (e instanceof ExpressionBase && hasConstTrait(e)) {
9467
+ const ea = e;
9468
+ if (ea.constValue !== null) {
9469
+ ea.constIndex = job.addConst(ea.constValue);
9470
+ }
9471
+ }
9472
+ return e;
9473
+ };
9474
+ for (const unit of job.units) {
9475
+ for (const op of unit.ops()) {
9476
+ if (hasConstTrait(op) && op.constValue !== null) {
9477
+ op.constIndex = job.addConst(op.makeExpression(op.constValue));
9478
+ }
9479
+ transformExpressionsInOp(op, collectGlobalConsts, VisitorContextFlag.None);
9480
+ }
9481
+ }
9482
+ }
9483
+
9484
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/host_style_property_parsing.mjs
9257
9485
  var STYLE_DOT = "style.";
9258
9486
  var CLASS_DOT = "class.";
9259
9487
  var STYLE_BANG = "style!";
9260
9488
  var CLASS_BANG = "class!";
9489
+ var BANG_IMPORTANT = "!important";
9261
9490
  function phaseHostStylePropertyParsing(job) {
9262
9491
  for (const op of job.root.update) {
9263
9492
  if (op.kind !== OpKind.Binding) {
9264
9493
  continue;
9265
9494
  }
9495
+ if (op.name.endsWith(BANG_IMPORTANT)) {
9496
+ op.name = op.name.substring(0, op.name.length - BANG_IMPORTANT.length);
9497
+ }
9266
9498
  if (op.name.startsWith(STYLE_DOT)) {
9267
9499
  op.bindingKind = BindingKind.StyleProperty;
9268
9500
  op.name = op.name.substring(STYLE_DOT.length);
@@ -9307,7 +9539,27 @@ function parseProperty(name) {
9307
9539
  return { property: property2, suffix };
9308
9540
  }
9309
9541
 
9310
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/output/map_util.mjs
9542
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_const_collection.mjs
9543
+ function phaseI18nConstCollection(job) {
9544
+ const messageConstIndices = {};
9545
+ for (const unit of job.units) {
9546
+ for (const op of unit.create) {
9547
+ if (op.kind === OpKind.ExtractedMessage) {
9548
+ messageConstIndices[op.owner] = job.addConst(op.expression, op.statements);
9549
+ OpList.remove(op);
9550
+ }
9551
+ }
9552
+ }
9553
+ for (const unit of job.units) {
9554
+ for (const op of unit.create) {
9555
+ if (op.kind === OpKind.I18nStart || op.kind === OpKind.I18n) {
9556
+ op.messageIndex = messageConstIndices[op.root];
9557
+ }
9558
+ }
9559
+ }
9560
+ }
9561
+
9562
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/output/map_util.mjs
9311
9563
  function mapLiteral(obj, quoted = false) {
9312
9564
  return literalMap(Object.keys(obj).map((key) => ({
9313
9565
  key,
@@ -9316,7 +9568,7 @@ function mapLiteral(obj, quoted = false) {
9316
9568
  })));
9317
9569
  }
9318
9570
 
9319
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/i18n/icu_serializer.mjs
9571
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/view/i18n/icu_serializer.mjs
9320
9572
  var IcuSerializerVisitor = class {
9321
9573
  visitText(text2) {
9322
9574
  return text2.value;
@@ -9347,7 +9599,7 @@ function serializeIcuNode(icu) {
9347
9599
  return icu.visit(serializer);
9348
9600
  }
9349
9601
 
9350
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/expression_parser/lexer.mjs
9602
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/expression_parser/lexer.mjs
9351
9603
  var TokenType;
9352
9604
  (function(TokenType2) {
9353
9605
  TokenType2[TokenType2["Character"] = 0] = "Character";
@@ -9708,7 +9960,7 @@ function parseIntAutoRadix(text2) {
9708
9960
  return result;
9709
9961
  }
9710
9962
 
9711
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/expression_parser/parser.mjs
9963
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/expression_parser/parser.mjs
9712
9964
  var SplitInterpolation = class {
9713
9965
  constructor(strings, expressions, offsets) {
9714
9966
  this.strings = strings;
@@ -10602,7 +10854,7 @@ function getIndexMapForOriginalTemplate(interpolatedTokens) {
10602
10854
  return offsetMap;
10603
10855
  }
10604
10856
 
10605
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/ast.mjs
10857
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/ml_parser/ast.mjs
10606
10858
  var NodeWithI18n = class {
10607
10859
  constructor(sourceSpan, i18n2) {
10608
10860
  this.sourceSpan = sourceSpan;
@@ -10753,11 +11005,11 @@ var RecursiveVisitor = class {
10753
11005
  }
10754
11006
  };
10755
11007
 
10756
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/schema/element_schema_registry.mjs
11008
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/schema/element_schema_registry.mjs
10757
11009
  var ElementSchemaRegistry = class {
10758
11010
  };
10759
11011
 
10760
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/schema/dom_element_schema_registry.mjs
11012
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/schema/dom_element_schema_registry.mjs
10761
11013
  var BOOLEAN = "boolean";
10762
11014
  var NUMBER = "number";
10763
11015
  var STRING = "string";
@@ -11110,7 +11362,7 @@ function _isPixelDimensionStyle(prop) {
11110
11362
  }
11111
11363
  }
11112
11364
 
11113
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/html_tags.mjs
11365
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/ml_parser/html_tags.mjs
11114
11366
  var HtmlTagDefinition = class {
11115
11367
  constructor({ closedByChildren, implicitNamespacePrefix, contentType = TagContentType.PARSABLE_DATA, closedByParent = false, isVoid = false, ignoreFirstLf = false, preventNamespaceInheritance = false, canSelfClose = false } = {}) {
11116
11368
  this.closedByChildren = {};
@@ -11228,7 +11480,7 @@ function getHtmlTagDefinition(tagName) {
11228
11480
  return (_b2 = (_a2 = TAG_DEFINITIONS[tagName]) != null ? _a2 : TAG_DEFINITIONS[tagName.toLowerCase()]) != null ? _b2 : DEFAULT_TAG_DEFINITION;
11229
11481
  }
11230
11482
 
11231
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/i18n/serializers/placeholder.mjs
11483
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/serializers/placeholder.mjs
11232
11484
  var TAG_TO_PLACEHOLDER_NAMES = {
11233
11485
  "A": "LINK",
11234
11486
  "B": "BOLD_TEXT",
@@ -11322,7 +11574,7 @@ var PlaceholderRegistry = class {
11322
11574
  }
11323
11575
  };
11324
11576
 
11325
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/i18n/i18n_parser.mjs
11577
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/i18n_parser.mjs
11326
11578
  var _expParser = new Parser(new Lexer());
11327
11579
  function createI18nMessageFactory(interpolationConfig) {
11328
11580
  const visitor = new _I18nVisitor(_expParser, interpolationConfig);
@@ -11484,14 +11736,14 @@ function extractPlaceholderName(input) {
11484
11736
  return input.split(_CUSTOM_PH_EXP)[2];
11485
11737
  }
11486
11738
 
11487
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/i18n/parse_util.mjs
11739
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/parse_util.mjs
11488
11740
  var I18nError = class extends ParseError {
11489
11741
  constructor(span, msg) {
11490
11742
  super(span, msg);
11491
11743
  }
11492
11744
  };
11493
11745
 
11494
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/entities.mjs
11746
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/ml_parser/entities.mjs
11495
11747
  var NAMED_ENTITIES = {
11496
11748
  "AElig": "\xC6",
11497
11749
  "AMP": "&",
@@ -13622,7 +13874,7 @@ var NAMED_ENTITIES = {
13622
13874
  var NGSP_UNICODE = "\uE500";
13623
13875
  NAMED_ENTITIES["ngsp"] = NGSP_UNICODE;
13624
13876
 
13625
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/lexer.mjs
13877
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/ml_parser/lexer.mjs
13626
13878
  var TokenError = class extends ParseError {
13627
13879
  constructor(errorMsg, tokenType, span) {
13628
13880
  super(span, errorMsg);
@@ -13664,6 +13916,7 @@ var _ControlFlowError = class {
13664
13916
  };
13665
13917
  var _Tokenizer = class {
13666
13918
  constructor(_file, _getTagDefinition, options) {
13919
+ var _a2;
13667
13920
  this._getTagDefinition = _getTagDefinition;
13668
13921
  this._currentTokenStart = null;
13669
13922
  this._currentTokenType = null;
@@ -13679,7 +13932,7 @@ var _Tokenizer = class {
13679
13932
  this._cursor = options.escapedString ? new EscapedCharacterCursor(_file, range) : new PlainCharacterCursor(_file, range);
13680
13933
  this._preserveLineEndings = options.preserveLineEndings || false;
13681
13934
  this._i18nNormalizeLineEndingsInICUs = options.i18nNormalizeLineEndingsInICUs || false;
13682
- this._tokenizeBlocks = options.tokenizeBlocks || false;
13935
+ this._tokenizeBlocks = (_a2 = options.tokenizeBlocks) != null ? _a2 : true;
13683
13936
  try {
13684
13937
  this._cursor.init();
13685
13938
  } catch (e) {
@@ -13721,7 +13974,7 @@ var _Tokenizer = class {
13721
13974
  this.handleError(e);
13722
13975
  }
13723
13976
  }
13724
- this._beginToken(28);
13977
+ this._beginToken(29);
13725
13978
  this._endToken([]);
13726
13979
  }
13727
13980
  _getBlockName() {
@@ -13741,17 +13994,24 @@ var _Tokenizer = class {
13741
13994
  }
13742
13995
  _consumeBlockStart(start) {
13743
13996
  this._beginToken(24, start);
13744
- this._endToken([this._getBlockName()]);
13997
+ const startToken = this._endToken([this._getBlockName()]);
13745
13998
  if (this._cursor.peek() === $LPAREN) {
13746
13999
  this._cursor.advance();
13747
14000
  this._consumeBlockParameters();
13748
14001
  this._attemptCharCodeUntilFn(isNotWhitespace);
13749
- this._requireCharCode($RPAREN);
13750
- this._attemptCharCodeUntilFn(isNotWhitespace);
14002
+ if (this._attemptCharCode($RPAREN)) {
14003
+ this._attemptCharCodeUntilFn(isNotWhitespace);
14004
+ } else {
14005
+ startToken.type = 28;
14006
+ return;
14007
+ }
14008
+ }
14009
+ if (this._attemptCharCode($LBRACE)) {
14010
+ this._beginToken(25);
14011
+ this._endToken([]);
14012
+ } else {
14013
+ startToken.type = 28;
13751
14014
  }
13752
- this._beginToken(25);
13753
- this._requireCharCode($LBRACE);
13754
- this._endToken([]);
13755
14015
  }
13756
14016
  _consumeBlockEnd(start) {
13757
14017
  this._beginToken(26, start);
@@ -14545,7 +14805,7 @@ var CursorError = class {
14545
14805
  }
14546
14806
  };
14547
14807
 
14548
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/parser.mjs
14808
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/ml_parser/parser.mjs
14549
14809
  var TreeError = class extends ParseError {
14550
14810
  static create(elementName, span, msg) {
14551
14811
  return new TreeError(elementName, span, msg);
@@ -14583,7 +14843,7 @@ var _TreeBuilder = class {
14583
14843
  this._advance();
14584
14844
  }
14585
14845
  build() {
14586
- while (this._peek.type !== 28) {
14846
+ while (this._peek.type !== 29) {
14587
14847
  if (this._peek.type === 0 || this._peek.type === 4) {
14588
14848
  this._consumeStartTag(this._advance());
14589
14849
  } else if (this._peek.type === 3) {
@@ -14605,6 +14865,9 @@ var _TreeBuilder = class {
14605
14865
  } else if (this._peek.type === 26) {
14606
14866
  this._closeVoidElement();
14607
14867
  this._consumeBlockClose(this._advance());
14868
+ } else if (this._peek.type === 28) {
14869
+ this._closeVoidElement();
14870
+ this._consumeIncompleteBlock(this._advance());
14608
14871
  } else {
14609
14872
  this._advance();
14610
14873
  }
@@ -14669,7 +14932,7 @@ var _TreeBuilder = class {
14669
14932
  if (!exp)
14670
14933
  return null;
14671
14934
  const end = this._advance();
14672
- exp.push({ type: 28, parts: [], sourceSpan: end.sourceSpan });
14935
+ exp.push({ type: 29, parts: [], sourceSpan: end.sourceSpan });
14673
14936
  const expansionCaseParser = new _TreeBuilder(exp, this.getTagDefinition);
14674
14937
  expansionCaseParser.build();
14675
14938
  if (expansionCaseParser.errors.length > 0) {
@@ -14705,7 +14968,7 @@ var _TreeBuilder = class {
14705
14968
  return null;
14706
14969
  }
14707
14970
  }
14708
- if (this._peek.type === 28) {
14971
+ if (this._peek.type === 29) {
14709
14972
  this.errors.push(TreeError.create(null, start.sourceSpan, `Invalid ICU message. Missing '}'.`));
14710
14973
  return null;
14711
14974
  }
@@ -14857,14 +15120,25 @@ var _TreeBuilder = class {
14857
15120
  const startSpan = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);
14858
15121
  const block = new Block(token.parts[0], parameters, [], span, startSpan);
14859
15122
  this._pushContainer(block, false);
14860
- return block;
14861
15123
  }
14862
15124
  _consumeBlockClose(token) {
14863
- const previousContainer = this._getContainer();
14864
15125
  if (!this._popContainer(null, Block, token.sourceSpan)) {
14865
- const context = previousContainer instanceof Element2 ? `There is an unclosed "${previousContainer.name}" HTML tag that may have to be closed first.` : `The block may have been closed earlier.`;
14866
- this.errors.push(TreeError.create(null, token.sourceSpan, `Unexpected closing block. ${context}`));
15126
+ this.errors.push(TreeError.create(null, token.sourceSpan, `Unexpected closing block. The block may have been closed earlier. If you meant to write the } character, you should use the "&#125;" HTML entity instead.`));
15127
+ }
15128
+ }
15129
+ _consumeIncompleteBlock(token) {
15130
+ const parameters = [];
15131
+ while (this._peek.type === 27) {
15132
+ const paramToken = this._advance();
15133
+ parameters.push(new BlockParameter(paramToken.parts[0], paramToken.sourceSpan));
14867
15134
  }
15135
+ const end = this._peek.sourceSpan.fullStart;
15136
+ const span = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);
15137
+ const startSpan = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);
15138
+ const block = new Block(token.parts[0], parameters, [], span, startSpan);
15139
+ this._pushContainer(block, false);
15140
+ this._popContainer(null, Block, null);
15141
+ this.errors.push(TreeError.create(token.parts[0], span, `Incomplete block "${token.parts[0]}". If you meant to write the @ character, you should use the "&#64;" HTML entity instead.`));
14868
15142
  }
14869
15143
  _getContainer() {
14870
15144
  return this._containerStack.length > 0 ? this._containerStack[this._containerStack.length - 1] : null;
@@ -14915,7 +15189,7 @@ function decodeEntity(match, entity) {
14915
15189
  return match;
14916
15190
  }
14917
15191
 
14918
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/schema/trusted_types_sinks.mjs
15192
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/schema/trusted_types_sinks.mjs
14919
15193
  var TRUSTED_TYPES_SINKS = /* @__PURE__ */ new Set([
14920
15194
  "iframe|srcdoc",
14921
15195
  "*|innerhtml",
@@ -14930,7 +15204,7 @@ function isTrustedTypesSink(tagName, propName) {
14930
15204
  return TRUSTED_TYPES_SINKS.has(tagName + "|" + propName) || TRUSTED_TYPES_SINKS.has("*|" + propName);
14931
15205
  }
14932
15206
 
14933
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/i18n/meta.mjs
15207
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/view/i18n/meta.mjs
14934
15208
  var setI18nRefs = (htmlNode, i18nNode) => {
14935
15209
  if (htmlNode instanceof NodeWithI18n) {
14936
15210
  if (i18nNode instanceof IcuPlaceholder && htmlNode.i18n instanceof Message) {
@@ -15086,7 +15360,7 @@ function i18nMetaToJSDoc(meta) {
15086
15360
  return jsDocComment(tags);
15087
15361
  }
15088
15362
 
15089
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/i18n/get_msg_utils.mjs
15363
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/view/i18n/get_msg_utils.mjs
15090
15364
  var GOOG_GET_MSG = "goog.getMsg";
15091
15365
  function createGoogleGetMsgStatements(variable2, message, closureVar, placeholderValues) {
15092
15366
  const messageString = serializeI18nMessageForGetMsg(message);
@@ -15134,7 +15408,7 @@ function serializeI18nMessageForGetMsg(message) {
15134
15408
  return message.nodes.map((node) => node.visit(serializerVisitor2, null)).join("");
15135
15409
  }
15136
15410
 
15137
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/i18n/localize_utils.mjs
15411
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/view/i18n/localize_utils.mjs
15138
15412
  function createLocalizeStatements(variable2, message, params) {
15139
15413
  const { messageParts, placeHolders } = serializeI18nMessageForLocalize(message);
15140
15414
  const sourceSpan = getSourceSpan(message);
@@ -15217,27 +15491,30 @@ function createEmptyMessagePart(location) {
15217
15491
  return new LiteralPiece("", new ParseSourceSpan(location, location));
15218
15492
  }
15219
15493
 
15220
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_message_extraction.mjs
15494
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_message_extraction.mjs
15221
15495
  var NG_I18N_CLOSURE_MODE = "ngI18nClosureMode";
15222
15496
  var TRANSLATION_VAR_PREFIX2 = "i18n_";
15223
15497
  function phaseI18nMessageExtraction(job) {
15224
15498
  const fileBasedI18nSuffix = job.relativeContextFilePath.replace(/[^A-Za-z0-9]/g, "_").toUpperCase() + "_";
15225
15499
  for (const unit of job.units) {
15226
15500
  for (const op of unit.create) {
15227
- if (op.kind === OpKind.I18nStart && op.i18n instanceof Message) {
15228
- const params = Object.fromEntries(Object.entries(op.tagNameParams).sort());
15229
- const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX2));
15230
- const closureVar = i18nGenerateClosureVar(job.pool, op.i18n.id, fileBasedI18nSuffix, job.i18nUseExternalIds);
15231
- const statements = getTranslationDeclStmts(op.i18n, mainVar, closureVar, params, void 0);
15232
- unit.create.push(createExtractedMessageOp(op.xref, mainVar, statements));
15501
+ if (op.kind === OpKind.I18nStart || op.kind === OpKind.I18n) {
15502
+ if (op.xref === op.root) {
15503
+ const params = new Map([...op.params.entries()].sort());
15504
+ const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX2));
15505
+ const closureVar = i18nGenerateClosureVar(job.pool, op.message.id, fileBasedI18nSuffix, job.i18nUseExternalIds);
15506
+ const statements = getTranslationDeclStmts(op.message, mainVar, closureVar, params, void 0);
15507
+ unit.create.push(createExtractedMessageOp(op.xref, mainVar, statements));
15508
+ }
15233
15509
  }
15234
15510
  }
15235
15511
  }
15236
15512
  }
15237
- function getTranslationDeclStmts(message, variable2, closureVar, params = {}, transformFn) {
15513
+ function getTranslationDeclStmts(message, variable2, closureVar, params, transformFn) {
15514
+ const paramsObject = Object.fromEntries(params);
15238
15515
  const statements = [
15239
15516
  declareI18nVariable(variable2),
15240
- ifStmt(createClosureModeGuard(), createGoogleGetMsgStatements(variable2, message, closureVar, params), createLocalizeStatements(variable2, message, formatI18nPlaceholderNamesInMap(params, false)))
15517
+ ifStmt(createClosureModeGuard(), createGoogleGetMsgStatements(variable2, message, closureVar, paramsObject), createLocalizeStatements(variable2, message, formatI18nPlaceholderNamesInMap(paramsObject, false)))
15241
15518
  ];
15242
15519
  if (transformFn) {
15243
15520
  statements.push(new ExpressionStatement(variable2.set(transformFn(variable2))));
@@ -15261,29 +15538,51 @@ function i18nGenerateClosureVar(pool, messageId, fileBasedI18nSuffix, useExterna
15261
15538
  return variable(name);
15262
15539
  }
15263
15540
 
15264
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_text_extraction.mjs
15541
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_text_extraction.mjs
15265
15542
  function phaseI18nTextExtraction(job) {
15543
+ var _a2;
15266
15544
  for (const unit of job.units) {
15267
- let inI18nBlock = false;
15545
+ let currentI18nId = null;
15546
+ const textNodes = /* @__PURE__ */ new Map();
15268
15547
  for (const op of unit.create) {
15269
15548
  switch (op.kind) {
15270
15549
  case OpKind.I18nStart:
15271
- inI18nBlock = true;
15550
+ currentI18nId = op.xref;
15272
15551
  break;
15273
15552
  case OpKind.I18nEnd:
15274
- inI18nBlock = false;
15553
+ currentI18nId = null;
15275
15554
  break;
15276
15555
  case OpKind.Text:
15277
- if (inI18nBlock) {
15556
+ if (currentI18nId !== null) {
15557
+ textNodes.set(op.xref, currentI18nId);
15278
15558
  OpList.remove(op);
15279
15559
  }
15280
15560
  break;
15281
15561
  }
15282
15562
  }
15563
+ for (const op of unit.update) {
15564
+ switch (op.kind) {
15565
+ case OpKind.InterpolateText:
15566
+ if (!textNodes.has(op.target)) {
15567
+ continue;
15568
+ }
15569
+ const i18nBlockId = textNodes.get(op.target);
15570
+ const ops = [];
15571
+ for (let i = 0; i < op.interpolation.expressions.length; i++) {
15572
+ const expr = op.interpolation.expressions[i];
15573
+ const placeholder = op.i18nPlaceholders[i];
15574
+ ops.push(createI18nExpressionOp(i18nBlockId, expr, placeholder, (_a2 = expr.sourceSpan) != null ? _a2 : op.sourceSpan));
15575
+ }
15576
+ if (ops.length > 0) {
15577
+ }
15578
+ OpList.replaceWithMany(op, ops);
15579
+ break;
15580
+ }
15581
+ }
15283
15582
  }
15284
15583
  }
15285
15584
 
15286
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/local_refs.mjs
15585
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/local_refs.mjs
15287
15586
  function phaseLocalRefs(job) {
15288
15587
  for (const unit of job.units) {
15289
15588
  for (const op of unit.create) {
@@ -15314,7 +15613,7 @@ function serializeLocalRefs(refs) {
15314
15613
  return literalArr(constRefs);
15315
15614
  }
15316
15615
 
15317
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/namespace.mjs
15616
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/namespace.mjs
15318
15617
  function phaseNamespace(job) {
15319
15618
  for (const unit of job.units) {
15320
15619
  let activeNamespace = Namespace.HTML;
@@ -15330,7 +15629,7 @@ function phaseNamespace(job) {
15330
15629
  }
15331
15630
  }
15332
15631
 
15333
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/style_parser.mjs
15632
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/view/style_parser.mjs
15334
15633
  function parse(value) {
15335
15634
  const styles = [];
15336
15635
  let i = 0;
@@ -15391,7 +15690,7 @@ function hyphenate2(value) {
15391
15690
  }).toLowerCase();
15392
15691
  }
15393
15692
 
15394
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/naming.mjs
15693
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/naming.mjs
15395
15694
  function phaseNaming(cpl) {
15396
15695
  addNamesToView(cpl.root, cpl.componentName, { index: 0 }, cpl.compatibility === CompatibilityMode.TemplateDefinitionBuilder);
15397
15696
  }
@@ -15412,7 +15711,7 @@ function addNamesToView(unit, baseName, state, compatibility) {
15412
15711
  if (op.handlerFnName !== null) {
15413
15712
  break;
15414
15713
  }
15415
- if (!op.hostListener && op.slot === null) {
15714
+ if (!op.hostListener && op.targetSlot === null) {
15416
15715
  throw new Error(`Expected a slot to be assigned`);
15417
15716
  }
15418
15717
  let animation = "";
@@ -15423,7 +15722,7 @@ function addNamesToView(unit, baseName, state, compatibility) {
15423
15722
  if (op.hostListener) {
15424
15723
  op.handlerFnName = `${baseName}_${animation}${op.name}_HostBindingHandler`;
15425
15724
  } else {
15426
- op.handlerFnName = `${unit.fnName}_${op.tag.replace("-", "_")}_${animation}${op.name}_${op.slot}_listener`;
15725
+ op.handlerFnName = `${unit.fnName}_${op.tag.replace("-", "_")}_${animation}${op.name}_${op.targetSlot}_listener`;
15427
15726
  }
15428
15727
  op.handlerFnName = sanitizeIdentifier(op.handlerFnName);
15429
15728
  break;
@@ -15492,7 +15791,7 @@ function stripImportant(name) {
15492
15791
  return name;
15493
15792
  }
15494
15793
 
15495
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/next_context_merging.mjs
15794
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/next_context_merging.mjs
15496
15795
  function phaseMergeNextContext(job) {
15497
15796
  for (const unit of job.units) {
15498
15797
  for (const op of unit.create) {
@@ -15538,12 +15837,16 @@ function mergeNextContextsInOps(ops) {
15538
15837
  }
15539
15838
  }
15540
15839
 
15541
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/ng_container.mjs
15840
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/ng_container.mjs
15542
15841
  var CONTAINER_TAG = "ng-container";
15543
15842
  function phaseNgContainer(job) {
15544
15843
  for (const unit of job.units) {
15545
15844
  const updatedElementXrefs = /* @__PURE__ */ new Set();
15546
15845
  for (const op of unit.create) {
15846
+ if (op.kind === OpKind.Element && op.tag === CONTAINER_TAG) {
15847
+ op.kind = OpKind.Container;
15848
+ updatedElementXrefs.add(op.xref);
15849
+ }
15547
15850
  if (op.kind === OpKind.ElementStart && op.tag === CONTAINER_TAG) {
15548
15851
  op.kind = OpKind.ContainerStart;
15549
15852
  updatedElementXrefs.add(op.xref);
@@ -15555,32 +15858,7 @@ function phaseNgContainer(job) {
15555
15858
  }
15556
15859
  }
15557
15860
 
15558
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/no_listeners_on_templates.mjs
15559
- function phaseNoListenersOnTemplates(job) {
15560
- for (const unit of job.units) {
15561
- let inTemplate = false;
15562
- for (const op of unit.create) {
15563
- switch (op.kind) {
15564
- case OpKind.Template:
15565
- inTemplate = true;
15566
- break;
15567
- case OpKind.ElementStart:
15568
- case OpKind.Element:
15569
- case OpKind.ContainerStart:
15570
- case OpKind.Container:
15571
- inTemplate = false;
15572
- break;
15573
- case OpKind.Listener:
15574
- if (inTemplate) {
15575
- OpList.remove(op);
15576
- }
15577
- break;
15578
- }
15579
- }
15580
- }
15581
- }
15582
-
15583
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/nonbindable.mjs
15861
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/nonbindable.mjs
15584
15862
  function lookupElement3(elements, xref) {
15585
15863
  const el = elements.get(xref);
15586
15864
  if (el === void 0) {
@@ -15610,7 +15888,7 @@ function phaseNonbindable(job) {
15610
15888
  }
15611
15889
  }
15612
15890
 
15613
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/nullish_coalescing.mjs
15891
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/nullish_coalescing.mjs
15614
15892
  function phaseNullishCoalescing(job) {
15615
15893
  for (const unit of job.units) {
15616
15894
  for (const op of unit.ops()) {
@@ -15626,30 +15904,124 @@ function phaseNullishCoalescing(job) {
15626
15904
  }
15627
15905
  }
15628
15906
 
15629
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/parse_extracted_styles.mjs
15630
- function phaseParseExtractedStyles(cpl) {
15631
- for (const unit of cpl.units) {
15632
- for (const op of unit.create) {
15633
- if (op.kind === OpKind.ExtractedAttribute && op.bindingKind === BindingKind.Attribute && isStringLiteral(op.expression)) {
15634
- if (op.name === "style") {
15635
- const parsedStyles = parse(op.expression.value);
15636
- for (let i = 0; i < parsedStyles.length - 1; i += 2) {
15637
- OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.StyleProperty, parsedStyles[i], literal(parsedStyles[i + 1])), op);
15638
- }
15639
- OpList.remove(op);
15640
- } else if (op.name === "class") {
15641
- const parsedClasses = op.expression.value.trim().split(/\s+/g);
15642
- for (const parsedClass of parsedClasses) {
15643
- OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.ClassName, parsedClass, null), op);
15644
- }
15645
- OpList.remove(op);
15646
- }
15647
- }
15907
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/ordering.mjs
15908
+ function kindTest(kind) {
15909
+ return (op) => op.kind === kind;
15910
+ }
15911
+ var CREATE_ORDERING = [
15912
+ { test: (op) => op.kind === OpKind.Listener && op.hostListener && op.isAnimationListener },
15913
+ { test: (op) => op.kind === OpKind.Listener && !(op.hostListener && op.isAnimationListener) }
15914
+ ];
15915
+ var UPDATE_ORDERING = [
15916
+ { test: (op) => op.kind === OpKind.HostProperty && op.expression instanceof Interpolation2 },
15917
+ { test: (op) => op.kind === OpKind.HostProperty && !(op.expression instanceof Interpolation2) },
15918
+ { test: kindTest(OpKind.StyleMap), transform: keepLast },
15919
+ { test: kindTest(OpKind.ClassMap), transform: keepLast },
15920
+ { test: kindTest(OpKind.StyleProp) },
15921
+ { test: kindTest(OpKind.ClassProp) },
15922
+ { test: (op) => op.kind === OpKind.Property && op.expression instanceof Interpolation2 },
15923
+ { test: (op) => op.kind === OpKind.Property && !(op.expression instanceof Interpolation2) },
15924
+ { test: kindTest(OpKind.Attribute) }
15925
+ ];
15926
+ var handledOpKinds = /* @__PURE__ */ new Set([
15927
+ OpKind.Listener,
15928
+ OpKind.StyleMap,
15929
+ OpKind.ClassMap,
15930
+ OpKind.StyleProp,
15931
+ OpKind.ClassProp,
15932
+ OpKind.Property,
15933
+ OpKind.HostProperty,
15934
+ OpKind.Attribute
15935
+ ]);
15936
+ function phaseOrdering(job) {
15937
+ for (const unit of job.units) {
15938
+ let opsToOrder = [];
15939
+ for (const op of unit.create) {
15940
+ if (handledOpKinds.has(op.kind)) {
15941
+ opsToOrder.push(op);
15942
+ OpList.remove(op);
15943
+ } else {
15944
+ OpList.insertBefore(reorder(opsToOrder, CREATE_ORDERING), op);
15945
+ opsToOrder = [];
15946
+ }
15947
+ }
15948
+ unit.create.push(reorder(opsToOrder, CREATE_ORDERING));
15949
+ opsToOrder = [];
15950
+ for (const op of unit.update) {
15951
+ if (handledOpKinds.has(op.kind)) {
15952
+ opsToOrder.push(op);
15953
+ OpList.remove(op);
15954
+ } else {
15955
+ OpList.insertBefore(reorder(opsToOrder, UPDATE_ORDERING), op);
15956
+ opsToOrder = [];
15957
+ }
15958
+ }
15959
+ unit.update.push(reorder(opsToOrder, UPDATE_ORDERING));
15960
+ }
15961
+ }
15962
+ function reorder(ops, ordering) {
15963
+ const groups = Array.from(ordering, () => new Array());
15964
+ for (const op of ops) {
15965
+ const groupIndex = ordering.findIndex((o) => o.test(op));
15966
+ groups[groupIndex].push(op);
15967
+ }
15968
+ return groups.flatMap((group, i) => {
15969
+ const transform2 = ordering[i].transform;
15970
+ return transform2 ? transform2(group) : group;
15971
+ });
15972
+ }
15973
+ function keepLast(ops) {
15974
+ return ops.slice(ops.length - 1);
15975
+ }
15976
+
15977
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/parse_extracted_styles.mjs
15978
+ function phaseParseExtractedStyles(cpl) {
15979
+ for (const unit of cpl.units) {
15980
+ for (const op of unit.create) {
15981
+ if (op.kind === OpKind.ExtractedAttribute && op.bindingKind === BindingKind.Attribute && isStringLiteral(op.expression)) {
15982
+ if (op.name === "style") {
15983
+ const parsedStyles = parse(op.expression.value);
15984
+ for (let i = 0; i < parsedStyles.length - 1; i += 2) {
15985
+ OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.StyleProperty, parsedStyles[i], literal(parsedStyles[i + 1])), op);
15986
+ }
15987
+ OpList.remove(op);
15988
+ } else if (op.name === "class") {
15989
+ const parsedClasses = op.expression.value.trim().split(/\s+/g);
15990
+ for (const parsedClass of parsedClasses) {
15991
+ OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.ClassName, parsedClass, null), op);
15992
+ }
15993
+ OpList.remove(op);
15994
+ }
15995
+ }
15996
+ }
15997
+ }
15998
+ }
15999
+
16000
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/phase_remove_content_selectors.mjs
16001
+ function phaseRemoveContentSelectors(job) {
16002
+ for (const unit of job.units) {
16003
+ const elements = getElementsByXrefId(unit);
16004
+ for (const op of unit.update) {
16005
+ switch (op.kind) {
16006
+ case OpKind.Binding:
16007
+ const target = lookupElement4(elements, op.target);
16008
+ if (op.name.toLowerCase() === "select" && target.kind === OpKind.Projection) {
16009
+ OpList.remove(op);
16010
+ }
16011
+ continue;
16012
+ }
15648
16013
  }
15649
16014
  }
15650
16015
  }
16016
+ function lookupElement4(elements, xref) {
16017
+ const el = elements.get(xref);
16018
+ if (el === void 0) {
16019
+ throw new Error("All attributes should have an element-like target.");
16020
+ }
16021
+ return el;
16022
+ }
15651
16023
 
15652
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pipe_creation.mjs
16024
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pipe_creation.mjs
15653
16025
  function phasePipeCreation(job) {
15654
16026
  for (const unit of job.units) {
15655
16027
  processPipeBindingsInView(unit);
@@ -15692,7 +16064,7 @@ function addPipeToCreationBlock(unit, afterTargetXref, binding) {
15692
16064
  throw new Error(`AssertionError: unable to find insertion point for pipe ${binding.name}`);
15693
16065
  }
15694
16066
 
15695
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pipe_variadic.mjs
16067
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pipe_variadic.mjs
15696
16068
  function phasePipeVariadic(job) {
15697
16069
  for (const unit of job.units) {
15698
16070
  for (const op of unit.update) {
@@ -15709,77 +16081,73 @@ function phasePipeVariadic(job) {
15709
16081
  }
15710
16082
  }
15711
16083
 
15712
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/ordering.mjs
15713
- function kindTest(kind) {
15714
- return (op) => op.kind === kind;
16084
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/propagate_i18n_blocks.mjs
16085
+ function phasePropagateI18nBlocks(job) {
16086
+ propagateI18nBlocksToTemplates(job.root, 0);
15715
16087
  }
15716
- var CREATE_ORDERING = [
15717
- { test: (op) => op.kind === OpKind.Listener && op.hostListener && op.isAnimationListener },
15718
- { test: (op) => op.kind === OpKind.Listener && !(op.hostListener && op.isAnimationListener) }
15719
- ];
15720
- var UPDATE_ORDERING = [
15721
- { test: (op) => op.kind === OpKind.HostProperty && op.expression instanceof Interpolation2 },
15722
- { test: (op) => op.kind === OpKind.HostProperty && !(op.expression instanceof Interpolation2) },
15723
- { test: kindTest(OpKind.StyleMap), transform: keepLast },
15724
- { test: kindTest(OpKind.ClassMap), transform: keepLast },
15725
- { test: kindTest(OpKind.StyleProp) },
15726
- { test: kindTest(OpKind.ClassProp) },
15727
- { test: (op) => op.kind === OpKind.Property && op.expression instanceof Interpolation2 },
15728
- { test: (op) => op.kind === OpKind.Property && !(op.expression instanceof Interpolation2) },
15729
- { test: kindTest(OpKind.Attribute) }
15730
- ];
15731
- var handledOpKinds = /* @__PURE__ */ new Set([
15732
- OpKind.Listener,
15733
- OpKind.StyleMap,
15734
- OpKind.ClassMap,
15735
- OpKind.StyleProp,
15736
- OpKind.ClassProp,
15737
- OpKind.Property,
15738
- OpKind.HostProperty,
15739
- OpKind.Attribute
15740
- ]);
15741
- function phaseOrdering(job) {
16088
+ function propagateI18nBlocksToTemplates(unit, subTemplateIndex) {
16089
+ let i18nBlock = null;
16090
+ for (const op of unit.create) {
16091
+ switch (op.kind) {
16092
+ case OpKind.I18nStart:
16093
+ op.subTemplateIndex = subTemplateIndex === 0 ? null : subTemplateIndex;
16094
+ i18nBlock = op;
16095
+ break;
16096
+ case OpKind.I18nEnd:
16097
+ i18nBlock = null;
16098
+ break;
16099
+ case OpKind.Template:
16100
+ const templateView = unit.job.views.get(op.xref);
16101
+ if (op.i18nPlaceholder !== void 0) {
16102
+ if (i18nBlock === null) {
16103
+ throw Error("Expected template with i18n placeholder to be in an i18n block.");
16104
+ }
16105
+ subTemplateIndex++;
16106
+ wrapTemplateWithI18n(templateView, i18nBlock);
16107
+ }
16108
+ propagateI18nBlocksToTemplates(templateView, subTemplateIndex);
16109
+ }
16110
+ }
16111
+ }
16112
+ function wrapTemplateWithI18n(unit, parentI18n) {
16113
+ var _a2;
16114
+ if (((_a2 = unit.create.head.next) == null ? void 0 : _a2.kind) !== OpKind.I18nStart) {
16115
+ const id = unit.job.allocateXrefId();
16116
+ OpList.insertAfter(createI18nStartOp(id, parentI18n.message, parentI18n.root), unit.create.head);
16117
+ OpList.insertBefore(createI18nEndOp(id), unit.create.tail);
16118
+ }
16119
+ }
16120
+
16121
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/propagate_i18n_placeholders.mjs
16122
+ function phasePropagateI18nPlaceholders(job) {
16123
+ const i18nOps = /* @__PURE__ */ new Map();
15742
16124
  for (const unit of job.units) {
15743
- let opsToOrder = [];
15744
16125
  for (const op of unit.create) {
15745
- if (handledOpKinds.has(op.kind)) {
15746
- opsToOrder.push(op);
15747
- OpList.remove(op);
15748
- } else {
15749
- OpList.insertBefore(reorder(opsToOrder, CREATE_ORDERING), op);
15750
- opsToOrder = [];
16126
+ if (op.kind === OpKind.I18nStart) {
16127
+ i18nOps.set(op.xref, op);
15751
16128
  }
15752
16129
  }
15753
- unit.create.push(reorder(opsToOrder, CREATE_ORDERING));
15754
- opsToOrder = [];
15755
- for (const op of unit.update) {
15756
- if (handledOpKinds.has(op.kind)) {
15757
- opsToOrder.push(op);
15758
- OpList.remove(op);
15759
- } else {
15760
- OpList.insertBefore(reorder(opsToOrder, UPDATE_ORDERING), op);
15761
- opsToOrder = [];
16130
+ }
16131
+ for (const op of i18nOps.values()) {
16132
+ if (op.xref !== op.root) {
16133
+ const rootOp = i18nOps.get(op.root);
16134
+ for (const [placeholder, value] of op.params) {
16135
+ rootOp.params.set(placeholder, value);
15762
16136
  }
15763
16137
  }
15764
- unit.update.push(reorder(opsToOrder, UPDATE_ORDERING));
15765
16138
  }
15766
- }
15767
- function reorder(ops, ordering) {
15768
- const groups = Array.from(ordering, () => new Array());
15769
- for (const op of ops) {
15770
- const groupIndex = ordering.findIndex((o) => o.test(op));
15771
- groups[groupIndex].push(op);
16139
+ for (const op of i18nOps.values()) {
16140
+ if (op.xref === op.root) {
16141
+ for (const placeholder in op.message.placeholders) {
16142
+ if (!op.params.has(placeholder)) {
16143
+ throw Error(`Failed to resolve i18n placeholder: ${placeholder}`);
16144
+ }
16145
+ }
16146
+ }
15772
16147
  }
15773
- return groups.flatMap((group, i) => {
15774
- const transform2 = ordering[i].transform;
15775
- return transform2 ? transform2(group) : group;
15776
- });
15777
- }
15778
- function keepLast(ops) {
15779
- return ops.slice(ops.length - 1);
15780
16148
  }
15781
16149
 
15782
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pure_function_extraction.mjs
16150
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pure_function_extraction.mjs
15783
16151
  function phasePureFunctionExtraction(job) {
15784
16152
  for (const view of job.units) {
15785
16153
  for (const op of view.ops()) {
@@ -15809,19 +16177,19 @@ var PureFunctionConstant = class extends GenericKeyFn {
15809
16177
  toSharedConstantDeclaration(declName, keyExpr) {
15810
16178
  const fnParams = [];
15811
16179
  for (let idx = 0; idx < this.numArgs; idx++) {
15812
- fnParams.push(new FnParam("_p" + idx));
16180
+ fnParams.push(new FnParam("a" + idx));
15813
16181
  }
15814
16182
  const returnExpr = transformExpressionsInExpression(keyExpr, (expr) => {
15815
16183
  if (!(expr instanceof PureFunctionParameterExpr)) {
15816
16184
  return expr;
15817
16185
  }
15818
- return variable("_p" + expr.index);
16186
+ return variable("a" + expr.index);
15819
16187
  }, VisitorContextFlag.None);
15820
- return new DeclareFunctionStmt(declName, fnParams, [new ReturnStatement(returnExpr)]);
16188
+ return new DeclareVarStmt(declName, new ArrowFunctionExpr(fnParams, returnExpr), void 0, StmtModifier.Final);
15821
16189
  }
15822
16190
  };
15823
16191
 
15824
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pure_literal_structures.mjs
16192
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pure_literal_structures.mjs
15825
16193
  function phasePureLiteralStructures(job) {
15826
16194
  for (const view of job.units) {
15827
16195
  for (const op of view.update) {
@@ -15868,7 +16236,7 @@ function transformLiteralMap(expr) {
15868
16236
  return new PureFunctionExpr(literalMap(derivedEntries), nonConstantArgs);
15869
16237
  }
15870
16238
 
15871
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/instruction.mjs
16239
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/instruction.mjs
15872
16240
  function element(slot, tag, constIndex, localRefIndex, sourceSpan) {
15873
16241
  return elementOrContainerBase(Identifiers.element, slot, tag, constIndex, localRefIndex, sourceSpan);
15874
16242
  }
@@ -15978,6 +16346,25 @@ function text(slot, initialValue, sourceSpan) {
15978
16346
  }
15979
16347
  return call(Identifiers.text, args, sourceSpan);
15980
16348
  }
16349
+ function defer(selfSlot, primarySlot, dependencyResolverFn, loadingSlot, placeholderSlot, errorSlot, loadingConfigIndex, placeholderConfigIndex, sourceSpan) {
16350
+ const args = [
16351
+ literal(selfSlot),
16352
+ literal(primarySlot),
16353
+ literal(dependencyResolverFn),
16354
+ literal(loadingSlot),
16355
+ literal(placeholderSlot),
16356
+ literal(errorSlot),
16357
+ literal(loadingConfigIndex),
16358
+ literal(placeholderConfigIndex)
16359
+ ];
16360
+ while (args[args.length - 1].value === null) {
16361
+ args.pop();
16362
+ }
16363
+ return call(Identifiers.defer, args, sourceSpan);
16364
+ }
16365
+ function deferOn(sourceSpan) {
16366
+ return call(Identifiers.deferOnIdle, [], sourceSpan);
16367
+ }
15981
16368
  function projectionDef(def) {
15982
16369
  return call(Identifiers.projectionDef, def ? [def] : [], null);
15983
16370
  }
@@ -15991,11 +16378,19 @@ function projection(slot, projectionSlotIndex, attributes) {
15991
16378
  }
15992
16379
  return call(Identifiers.projection, args, null);
15993
16380
  }
15994
- function i18nStart(slot, constIndex) {
15995
- return call(Identifiers.i18nStart, [literal(slot), literal(constIndex)], null);
16381
+ function i18nStart(slot, constIndex, subTemplateIndex) {
16382
+ const args = [literal(slot), literal(constIndex)];
16383
+ if (subTemplateIndex !== null) {
16384
+ args.push(literal(subTemplateIndex));
16385
+ }
16386
+ return call(Identifiers.i18nStart, args, null);
15996
16387
  }
15997
- function i18n(slot) {
15998
- return call(Identifiers.i18n, [literal(slot)], null);
16388
+ function i18n(slot, constIndex, subTemplateIndex) {
16389
+ const args = [literal(slot), literal(constIndex)];
16390
+ if (subTemplateIndex) {
16391
+ args.push(literal(subTemplateIndex));
16392
+ }
16393
+ return call(Identifiers.i18n, args, null);
15999
16394
  }
16000
16395
  function i18nEnd() {
16001
16396
  return call(Identifiers.i18nEnd, [], null);
@@ -16070,6 +16465,12 @@ function textInterpolate(strings, expressions, sourceSpan) {
16070
16465
  }
16071
16466
  return callVariadicInstruction(TEXT_INTERPOLATE_CONFIG, [], interpolationArgs, [], sourceSpan);
16072
16467
  }
16468
+ function i18nExp(expr, sourceSpan) {
16469
+ return call(Identifiers.i18nExp, [expr], sourceSpan);
16470
+ }
16471
+ function i18nApply(slot, sourceSpan) {
16472
+ return call(Identifiers.i18nApply, [literal(slot)], sourceSpan);
16473
+ }
16073
16474
  function propertyInterpolate(name, strings, expressions, sanitizer, sourceSpan) {
16074
16475
  const interpolationArgs = collateInterpolationArgs(strings, expressions);
16075
16476
  const extraArgs = [];
@@ -16134,8 +16535,12 @@ function call(instruction, args, sourceSpan) {
16134
16535
  const expr = importExpr(instruction).callFn(args, sourceSpan);
16135
16536
  return createStatementOp(new ExpressionStatement(expr, sourceSpan));
16136
16537
  }
16137
- function conditional(slot, condition) {
16138
- return call(Identifiers.conditional, [literal(slot), condition], null);
16538
+ function conditional(slot, condition, contextValue, sourceSpan) {
16539
+ const args = [literal(slot), condition];
16540
+ if (contextValue !== null) {
16541
+ args.push(contextValue);
16542
+ }
16543
+ return call(Identifiers.conditional, args, sourceSpan);
16139
16544
  }
16140
16545
  var TEXT_INTERPOLATE_CONFIG = {
16141
16546
  constant: [
@@ -16286,7 +16691,7 @@ function callVariadicInstruction(config, baseArgs, interpolationArgs, extraArgs,
16286
16691
  return createStatementOp(callVariadicInstructionExpr(config, baseArgs, interpolationArgs, extraArgs, sourceSpan).toStmt());
16287
16692
  }
16288
16693
 
16289
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/reify.mjs
16694
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/reify.mjs
16290
16695
  var sanitizerIdentifierMap = /* @__PURE__ */ new Map([
16291
16696
  [SanitizerFn.Html, Identifiers.sanitizeHtml],
16292
16697
  [SanitizerFn.IframeAttribute, Identifiers.validateIframeAttribute],
@@ -16302,6 +16707,7 @@ function phaseReify(cpl) {
16302
16707
  }
16303
16708
  }
16304
16709
  function reifyCreateOperations(unit, ops) {
16710
+ var _a2, _b2, _c2, _d2;
16305
16711
  for (const op of ops) {
16306
16712
  transformExpressionsInOp(op, reifyIrExpression, VisitorContextFlag.None);
16307
16713
  switch (op.kind) {
@@ -16327,20 +16733,20 @@ function reifyCreateOperations(unit, ops) {
16327
16733
  OpList.replace(op, elementContainerEnd());
16328
16734
  break;
16329
16735
  case OpKind.I18nStart:
16330
- OpList.replace(op, i18nStart(op.slot, op.messageIndex));
16736
+ OpList.replace(op, i18nStart(op.slot, op.messageIndex, op.subTemplateIndex));
16331
16737
  break;
16332
16738
  case OpKind.I18nEnd:
16333
16739
  OpList.replace(op, i18nEnd());
16334
16740
  break;
16335
16741
  case OpKind.I18n:
16336
- OpList.replace(op, i18n(op.slot));
16742
+ OpList.replace(op, i18n(op.slot, op.messageIndex, op.subTemplateIndex));
16337
16743
  break;
16338
16744
  case OpKind.Template:
16339
16745
  if (!(unit instanceof ViewCompilationUnit)) {
16340
16746
  throw new Error(`AssertionError: must be compiling a component`);
16341
16747
  }
16342
16748
  const childView = unit.job.views.get(op.xref);
16343
- OpList.replace(op, template(op.slot, variable(childView.fnName), childView.decls, childView.vars, op.controlFlow ? null : op.tag, op.attributes, op.sourceSpan));
16749
+ OpList.replace(op, template(op.slot, variable(childView.fnName), childView.decls, childView.vars, op.block ? null : op.tag, op.attributes, op.sourceSpan));
16344
16750
  break;
16345
16751
  case OpKind.DisableBindings:
16346
16752
  OpList.replace(op, disableBindings());
@@ -16375,6 +16781,15 @@ function reifyCreateOperations(unit, ops) {
16375
16781
  break;
16376
16782
  }
16377
16783
  break;
16784
+ case OpKind.Defer:
16785
+ OpList.replace(op, defer(op.slot, op.targetSlot, null, op.loading && op.loading.targetSlot, op.placeholder && op.placeholder.targetSlot, op.error && op.error.targetSlot, (_b2 = (_a2 = op.loading) == null ? void 0 : _a2.constIndex) != null ? _b2 : null, (_d2 = (_c2 = op.placeholder) == null ? void 0 : _c2.constIndex) != null ? _d2 : null, op.sourceSpan));
16786
+ break;
16787
+ case OpKind.DeferSecondaryBlock:
16788
+ OpList.remove(op);
16789
+ break;
16790
+ case OpKind.DeferOn:
16791
+ OpList.replace(op, deferOn(op.sourceSpan));
16792
+ break;
16378
16793
  case OpKind.ProjectionDef:
16379
16794
  OpList.replace(op, projectionDef(op.def));
16380
16795
  break;
@@ -16429,6 +16844,12 @@ function reifyUpdateOperations(_unit, ops) {
16429
16844
  OpList.replace(op, classMap(op.expression, op.sourceSpan));
16430
16845
  }
16431
16846
  break;
16847
+ case OpKind.I18nExpression:
16848
+ OpList.replace(op, i18nExp(op.expression, op.sourceSpan));
16849
+ break;
16850
+ case OpKind.I18nApply:
16851
+ OpList.replace(op, i18nApply(op.targetSlot, op.sourceSpan));
16852
+ break;
16432
16853
  case OpKind.InterpolateText:
16433
16854
  OpList.replace(op, textInterpolate(op.interpolation.strings, op.interpolation.expressions, op.sourceSpan));
16434
16855
  break;
@@ -16460,10 +16881,10 @@ function reifyUpdateOperations(_unit, ops) {
16460
16881
  if (op.processed === null) {
16461
16882
  throw new Error(`Conditional test was not set.`);
16462
16883
  }
16463
- if (op.slot === null) {
16884
+ if (op.targetSlot === null) {
16464
16885
  throw new Error(`Conditional slot was not set.`);
16465
16886
  }
16466
- OpList.replace(op, conditional(op.slot, op.processed));
16887
+ OpList.replace(op, conditional(op.targetSlot, op.processed, op.contextValue, op.sourceSpan));
16467
16888
  break;
16468
16889
  case OpKind.Statement:
16469
16890
  break;
@@ -16480,7 +16901,7 @@ function reifyIrExpression(expr) {
16480
16901
  case ExpressionKind.NextContext:
16481
16902
  return nextContext(expr.steps);
16482
16903
  case ExpressionKind.Reference:
16483
- return reference(expr.slot + 1 + expr.offset);
16904
+ return reference(expr.targetSlot + 1 + expr.offset);
16484
16905
  case ExpressionKind.LexicalRead:
16485
16906
  throw new Error(`AssertionError: unresolved LexicalRead of ${expr.name}`);
16486
16907
  case ExpressionKind.RestoreView:
@@ -16515,13 +16936,13 @@ function reifyIrExpression(expr) {
16515
16936
  case ExpressionKind.PureFunctionParameterExpr:
16516
16937
  throw new Error(`AssertionError: expected PureFunctionParameterExpr to have been extracted`);
16517
16938
  case ExpressionKind.PipeBinding:
16518
- return pipeBind(expr.slot, expr.varOffset, expr.args);
16939
+ return pipeBind(expr.targetSlot, expr.varOffset, expr.args);
16519
16940
  case ExpressionKind.PipeBindingVariadic:
16520
- return pipeBindV(expr.slot, expr.varOffset, expr.args);
16941
+ return pipeBindV(expr.targetSlot, expr.varOffset, expr.args);
16521
16942
  case ExpressionKind.SanitizerExpr:
16522
16943
  return importExpr(sanitizerIdentifierMap.get(expr.fn));
16523
16944
  case ExpressionKind.SlotLiteralExpr:
16524
- return literal(expr.slot);
16945
+ return literal(expr.targetSlot);
16525
16946
  default:
16526
16947
  throw new Error(`AssertionError: Unsupported reification of ir.Expression kind: ${ExpressionKind[expr.kind]}`);
16527
16948
  }
@@ -16542,7 +16963,7 @@ function reifyListenerHandler(unit, name, handlerOps, consumesDollarEvent) {
16542
16963
  return fn(params, handlerStmts, void 0, void 0, name);
16543
16964
  }
16544
16965
 
16545
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/remove_empty_bindings.mjs
16966
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/remove_empty_bindings.mjs
16546
16967
  function phaseRemoveEmptyBindings(job) {
16547
16968
  for (const unit of job.units) {
16548
16969
  for (const op of unit.update) {
@@ -16563,7 +16984,7 @@ function phaseRemoveEmptyBindings(job) {
16563
16984
  }
16564
16985
  }
16565
16986
 
16566
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_contexts.mjs
16987
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_contexts.mjs
16567
16988
  function phaseResolveContexts(cpl) {
16568
16989
  for (const unit of cpl.units) {
16569
16990
  processLexicalScope(unit, unit.create);
@@ -16601,7 +17022,7 @@ function processLexicalScope(view, ops) {
16601
17022
  }
16602
17023
  }
16603
17024
 
16604
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_dollar_event.mjs
17025
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_dollar_event.mjs
16605
17026
  function phaseResolveDollarEvent(job) {
16606
17027
  for (const unit of job.units) {
16607
17028
  resolveDollarEvent(unit, unit.create);
@@ -16622,45 +17043,122 @@ function resolveDollarEvent(unit, ops) {
16622
17043
  }
16623
17044
  }
16624
17045
 
16625
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_placeholders.mjs
17046
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_placeholders.mjs
16626
17047
  var ESCAPE = "\uFFFD";
17048
+ var ELEMENT_MARKER = "#";
17049
+ var TEMPLATE_MARKER = "*";
17050
+ var TAG_CLOSE_MARKER = "/";
17051
+ var CONTEXT_MARKER = ":";
17052
+ var LIST_START_MARKER = "[";
17053
+ var LIST_END_MARKER = "]";
17054
+ var LIST_DELIMITER = "|";
17055
+ var I18nParamValueFlags;
17056
+ (function(I18nParamValueFlags2) {
17057
+ I18nParamValueFlags2[I18nParamValueFlags2["None"] = 0] = "None";
17058
+ I18nParamValueFlags2[I18nParamValueFlags2["ElementTag"] = 1] = "ElementTag";
17059
+ I18nParamValueFlags2[I18nParamValueFlags2["TemplateTag"] = 2] = "TemplateTag";
17060
+ I18nParamValueFlags2[I18nParamValueFlags2["CloseTag"] = 4] = "CloseTag";
17061
+ })(I18nParamValueFlags || (I18nParamValueFlags = {}));
17062
+ var I18nPlaceholderParams = class {
17063
+ constructor() {
17064
+ this.values = /* @__PURE__ */ new Map();
17065
+ }
17066
+ addValue(placeholder, value, subTemplateIndex, flags) {
17067
+ var _a2;
17068
+ const placeholderValues = (_a2 = this.values.get(placeholder)) != null ? _a2 : [];
17069
+ placeholderValues.push({ value, subTemplateIndex, flags });
17070
+ this.values.set(placeholder, placeholderValues);
17071
+ }
17072
+ saveToOp(op) {
17073
+ for (const [placeholder, placeholderValues] of this.values) {
17074
+ op.params.set(placeholder, literal(this.serializeValues(placeholderValues)));
17075
+ }
17076
+ }
17077
+ serializeValues(values) {
17078
+ const serializedValues = values.map((value) => this.serializeValue(value));
17079
+ return serializedValues.length === 1 ? serializedValues[0] : `${LIST_START_MARKER}${serializedValues.join(LIST_DELIMITER)}${LIST_END_MARKER}`;
17080
+ }
17081
+ serializeValue(value) {
17082
+ let tagMarker = "";
17083
+ let closeMarker = "";
17084
+ if (value.flags & I18nParamValueFlags.ElementTag) {
17085
+ tagMarker = ELEMENT_MARKER;
17086
+ } else if (value.flags & I18nParamValueFlags.TemplateTag) {
17087
+ tagMarker = TEMPLATE_MARKER;
17088
+ }
17089
+ if (tagMarker !== "") {
17090
+ closeMarker = value.flags & I18nParamValueFlags.CloseTag ? TAG_CLOSE_MARKER : "";
17091
+ }
17092
+ const context = value.subTemplateIndex === null ? "" : `${CONTEXT_MARKER}${value.subTemplateIndex}`;
17093
+ return `${ESCAPE}${closeMarker}${tagMarker}${value.value}${context}${ESCAPE}`;
17094
+ }
17095
+ };
16627
17096
  function phaseResolveI18nPlaceholders(job) {
16628
17097
  for (const unit of job.units) {
16629
- let i18nOp = null;
16630
- let startTags = [];
16631
- let closeTags = [];
17098
+ const i18nOps = /* @__PURE__ */ new Map();
17099
+ const params = /* @__PURE__ */ new Map();
17100
+ let currentI18nOp = null;
16632
17101
  for (const op of unit.create) {
16633
- if (op.kind === OpKind.I18nStart && op.i18n instanceof Message) {
16634
- i18nOp = op;
16635
- } else if (op.kind === OpKind.I18nEnd) {
16636
- i18nOp = null;
16637
- } else if ((op.kind === OpKind.Element || op.kind === OpKind.ElementStart) && op.i18n instanceof TagPlaceholder) {
16638
- if (i18nOp === null) {
16639
- throw Error("i18n tag placeholder should only occur inside an i18n block");
17102
+ switch (op.kind) {
17103
+ case OpKind.I18nStart:
17104
+ case OpKind.I18n:
17105
+ i18nOps.set(op.xref, op);
17106
+ currentI18nOp = op.kind === OpKind.I18nStart ? op : null;
17107
+ break;
17108
+ case OpKind.I18nEnd:
17109
+ currentI18nOp = null;
17110
+ break;
17111
+ case OpKind.Element:
17112
+ case OpKind.ElementStart:
17113
+ case OpKind.Template:
17114
+ if (op.i18nPlaceholder !== void 0) {
17115
+ if (currentI18nOp === null) {
17116
+ throw Error("i18n tag placeholder should only occur inside an i18n block");
17117
+ }
17118
+ const { startName, closeName } = op.i18nPlaceholder;
17119
+ const subTemplateIndex = getSubTemplateIndexForTag(job, currentI18nOp, op);
17120
+ const flags = op.kind === OpKind.Template ? I18nParamValueFlags.TemplateTag : I18nParamValueFlags.ElementTag;
17121
+ addParam(params, currentI18nOp, startName, op.slot, subTemplateIndex, flags);
17122
+ addParam(params, currentI18nOp, closeName, op.slot, subTemplateIndex, flags | I18nParamValueFlags.CloseTag);
17123
+ }
17124
+ break;
17125
+ }
17126
+ }
17127
+ const i18nBlockPlaceholderIndices = /* @__PURE__ */ new Map();
17128
+ for (const op of unit.update) {
17129
+ if (op.kind === OpKind.I18nExpression) {
17130
+ const i18nOp = i18nOps.get(op.owner);
17131
+ let index = i18nBlockPlaceholderIndices.get(op.owner) || 0;
17132
+ if (!i18nOp) {
17133
+ throw Error("Cannot find corresponding i18nStart for i18nExpr");
16640
17134
  }
16641
- startTags.push({
16642
- i18nOp,
16643
- placeholder: op.i18n.startName,
16644
- value: literal(`${ESCAPE}#${op.slot}${ESCAPE}`)
16645
- });
16646
- closeTags.push({
16647
- i18nOp,
16648
- placeholder: op.i18n.closeName,
16649
- value: literal(`${ESCAPE}/#${op.slot}${ESCAPE}`)
16650
- });
17135
+ addParam(params, i18nOp, op.i18nPlaceholder.name, index++, i18nOp.subTemplateIndex);
17136
+ i18nBlockPlaceholderIndices.set(op.owner, index);
16651
17137
  }
16652
17138
  }
16653
- for (const { i18nOp: i18nOp2, placeholder, value } of startTags) {
16654
- i18nOp2.tagNameParams[placeholder] = value;
17139
+ for (const [xref, i18nOpParams] of params) {
17140
+ i18nOpParams.saveToOp(i18nOps.get(xref));
16655
17141
  }
16656
- for (let i = closeTags.length - 1; i >= 0; i--) {
16657
- const { i18nOp: i18nOp2, placeholder, value } = closeTags[i];
16658
- i18nOp2.tagNameParams[placeholder] = value;
17142
+ }
17143
+ }
17144
+ function addParam(params, i18nOp, placeholder, value, subTemplateIndex, flags = I18nParamValueFlags.None) {
17145
+ var _a2;
17146
+ const i18nOpParams = (_a2 = params.get(i18nOp.xref)) != null ? _a2 : new I18nPlaceholderParams();
17147
+ i18nOpParams.addValue(placeholder, value, subTemplateIndex, flags);
17148
+ params.set(i18nOp.xref, i18nOpParams);
17149
+ }
17150
+ function getSubTemplateIndexForTag(job, i18nOp, op) {
17151
+ if (op.kind === OpKind.Template) {
17152
+ for (const childOp of job.views.get(op.xref).create) {
17153
+ if (childOp.kind === OpKind.I18nStart) {
17154
+ return childOp.subTemplateIndex;
17155
+ }
16659
17156
  }
16660
17157
  }
17158
+ return i18nOp.subTemplateIndex;
16661
17159
  }
16662
17160
 
16663
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_names.mjs
17161
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_names.mjs
16664
17162
  function phaseResolveNames(cpl) {
16665
17163
  for (const unit of cpl.units) {
16666
17164
  processLexicalScope2(unit, unit.create, null);
@@ -16723,7 +17221,7 @@ function processLexicalScope2(unit, ops, savedView) {
16723
17221
  }
16724
17222
  }
16725
17223
 
16726
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_sanitizers.mjs
17224
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_sanitizers.mjs
16727
17225
  var sanitizers = /* @__PURE__ */ new Map([
16728
17226
  [SecurityContext.HTML, SanitizerFn.Html],
16729
17227
  [SecurityContext.SCRIPT, SanitizerFn.Script],
@@ -16759,7 +17257,7 @@ function isIframeElement(op) {
16759
17257
  return (op.kind === OpKind.Element || op.kind === OpKind.ElementStart) && op.tag.toLowerCase() === "iframe";
16760
17258
  }
16761
17259
 
16762
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/save_restore_view.mjs
17260
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/save_restore_view.mjs
16763
17261
  function phaseSaveRestoreView(job) {
16764
17262
  for (const view of job.views.values()) {
16765
17263
  view.create.prepend([
@@ -16804,7 +17302,7 @@ function addSaveRestoreViewOperationToListener(unit, op) {
16804
17302
  }
16805
17303
  }
16806
17304
 
16807
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/slot_allocation.mjs
17305
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/slot_allocation.mjs
16808
17306
  function phaseSlotAllocation(job) {
16809
17307
  const slotMap = /* @__PURE__ */ new Map();
16810
17308
  for (const unit of job.units) {
@@ -16825,29 +17323,29 @@ function phaseSlotAllocation(job) {
16825
17323
  const childView = job.views.get(op.xref);
16826
17324
  op.decls = childView.decls;
16827
17325
  }
16828
- if (hasUsesSlotIndexTrait(op) && op.slot === null) {
17326
+ if (hasUsesSlotIndexTrait(op) && op.targetSlot === null) {
16829
17327
  if (!slotMap.has(op.target)) {
16830
17328
  throw new Error(`AssertionError: no slot allocated for ${OpKind[op.kind]} target ${op.target}`);
16831
17329
  }
16832
- op.slot = slotMap.get(op.target);
17330
+ op.targetSlot = slotMap.get(op.target);
16833
17331
  }
16834
17332
  visitExpressionsInOp(op, (expr) => {
16835
17333
  if (!isIrExpression(expr)) {
16836
17334
  return;
16837
17335
  }
16838
- if (!hasUsesSlotIndexTrait(expr) || expr.slot !== null) {
17336
+ if (!hasUsesSlotIndexTrait(expr) || expr.targetSlot !== null) {
16839
17337
  return;
16840
17338
  }
16841
17339
  if (!slotMap.has(expr.target)) {
16842
17340
  throw new Error(`AssertionError: no slot allocated for ${expr.constructor.name} target ${expr.target}`);
16843
17341
  }
16844
- expr.slot = slotMap.get(expr.target);
17342
+ expr.targetSlot = slotMap.get(expr.target);
16845
17343
  });
16846
17344
  }
16847
17345
  }
16848
17346
  }
16849
17347
 
16850
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/style_binding_specialization.mjs
17348
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/style_binding_specialization.mjs
16851
17349
  function phaseStyleBindingSpecialization(cpl) {
16852
17350
  for (const unit of cpl.units) {
16853
17351
  for (const op of unit.update) {
@@ -16877,42 +17375,55 @@ function phaseStyleBindingSpecialization(cpl) {
16877
17375
  }
16878
17376
  }
16879
17377
 
16880
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/temporary_variables.mjs
17378
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/temporary_variables.mjs
16881
17379
  function phaseTemporaryVariables(cpl) {
16882
17380
  for (const unit of cpl.units) {
16883
- let opCount = 0;
16884
- let generatedStatements = [];
16885
- for (const op of unit.ops()) {
16886
- const finalReads = /* @__PURE__ */ new Map();
16887
- visitExpressionsInOp(op, (expr) => {
16888
- if (expr instanceof ReadTemporaryExpr) {
16889
- finalReads.set(expr.xref, expr);
17381
+ unit.create.prepend(generateTemporaries(unit.create));
17382
+ unit.update.prepend(generateTemporaries(unit.update));
17383
+ }
17384
+ }
17385
+ function generateTemporaries(ops) {
17386
+ let opCount = 0;
17387
+ let generatedStatements = [];
17388
+ for (const op of ops) {
17389
+ const finalReads = /* @__PURE__ */ new Map();
17390
+ visitExpressionsInOp(op, (expr, flag) => {
17391
+ if (flag & VisitorContextFlag.InChildOperation) {
17392
+ return;
17393
+ }
17394
+ if (expr instanceof ReadTemporaryExpr) {
17395
+ finalReads.set(expr.xref, expr);
17396
+ }
17397
+ });
17398
+ let count = 0;
17399
+ const assigned = /* @__PURE__ */ new Set();
17400
+ const released = /* @__PURE__ */ new Set();
17401
+ const defs = /* @__PURE__ */ new Map();
17402
+ visitExpressionsInOp(op, (expr, flag) => {
17403
+ if (flag & VisitorContextFlag.InChildOperation) {
17404
+ return;
17405
+ }
17406
+ if (expr instanceof AssignTemporaryExpr) {
17407
+ if (!assigned.has(expr.xref)) {
17408
+ assigned.add(expr.xref);
17409
+ defs.set(expr.xref, `tmp_${opCount}_${count++}`);
16890
17410
  }
16891
- });
16892
- let count = 0;
16893
- const assigned = /* @__PURE__ */ new Set();
16894
- const released = /* @__PURE__ */ new Set();
16895
- const defs = /* @__PURE__ */ new Map();
16896
- visitExpressionsInOp(op, (expr) => {
16897
- if (expr instanceof AssignTemporaryExpr) {
16898
- if (!assigned.has(expr.xref)) {
16899
- assigned.add(expr.xref);
16900
- defs.set(expr.xref, `tmp_${opCount}_${count++}`);
16901
- }
16902
- assignName(defs, expr);
16903
- } else if (expr instanceof ReadTemporaryExpr) {
16904
- if (finalReads.get(expr.xref) === expr) {
16905
- released.add(expr.xref);
16906
- count--;
16907
- }
16908
- assignName(defs, expr);
17411
+ assignName(defs, expr);
17412
+ } else if (expr instanceof ReadTemporaryExpr) {
17413
+ if (finalReads.get(expr.xref) === expr) {
17414
+ released.add(expr.xref);
17415
+ count--;
16909
17416
  }
16910
- });
16911
- generatedStatements.push(...Array.from(new Set(defs.values())).map((name) => createStatementOp(new DeclareVarStmt(name))));
16912
- opCount++;
17417
+ assignName(defs, expr);
17418
+ }
17419
+ });
17420
+ generatedStatements.push(...Array.from(new Set(defs.values())).map((name) => createStatementOp(new DeclareVarStmt(name))));
17421
+ opCount++;
17422
+ if (op.kind === OpKind.Listener) {
17423
+ op.handlerOps.prepend(generateTemporaries(op.handlerOps));
16913
17424
  }
16914
- unit.update.prepend(generatedStatements);
16915
17425
  }
17426
+ return generatedStatements;
16916
17427
  }
16917
17428
  function assignName(names, expr) {
16918
17429
  const name = names.get(expr.xref);
@@ -16922,7 +17433,7 @@ function assignName(names, expr) {
16922
17433
  expr.name = name;
16923
17434
  }
16924
17435
 
16925
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/variable_optimization.mjs
17436
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/variable_optimization.mjs
16926
17437
  function phaseVariableOptimization(job) {
16927
17438
  for (const unit of job.units) {
16928
17439
  optimizeVariablesInOpList(unit.create, job.compatibility);
@@ -17124,6 +17635,9 @@ function tryInlineVariableInitializer(id, initializer, target, declFences) {
17124
17635
  function allowConservativeInlining(decl, target) {
17125
17636
  switch (decl.variable.kind) {
17126
17637
  case SemanticVariableKind.Identifier:
17638
+ if (decl.initializer instanceof ReadVarExpr && decl.initializer.name === "ctx") {
17639
+ return true;
17640
+ }
17127
17641
  return false;
17128
17642
  case SemanticVariableKind.Context:
17129
17643
  return target.kind === OpKind.Variable;
@@ -17132,89 +17646,21 @@ function allowConservativeInlining(decl, target) {
17132
17646
  }
17133
17647
  }
17134
17648
 
17135
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/generate_projection_def.mjs
17136
- function phaseGenerateProjectionDef(job) {
17137
- const share = job.compatibility === CompatibilityMode.TemplateDefinitionBuilder;
17138
- const selectors = [];
17139
- let projectionSlotIndex = 0;
17140
- for (const unit of job.units) {
17141
- for (const op of unit.create) {
17142
- if (op.kind === OpKind.Projection) {
17143
- selectors.push(op.selector);
17144
- op.projectionSlotIndex = projectionSlotIndex++;
17145
- }
17146
- }
17147
- }
17148
- if (selectors.length > 0) {
17149
- let defExpr = null;
17150
- if (selectors.length > 1 || selectors[0] !== "*") {
17151
- const def = selectors.map((s) => s === "*" ? s : parseSelectorToR3Selector(s));
17152
- defExpr = job.pool.getConstLiteral(literalOrArrayLiteral(def), share);
17153
- }
17154
- job.contentSelectors = job.pool.getConstLiteral(literalOrArrayLiteral(selectors), share);
17155
- job.root.create.prepend([createProjectionDefOp(defExpr)]);
17156
- }
17157
- }
17158
-
17159
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_const_collection.mjs
17160
- function phaseI18nConstCollection(job) {
17161
- const messageConstIndices = {};
17162
- for (const unit of job.units) {
17163
- for (const op of unit.create) {
17164
- if (op.kind === OpKind.ExtractedMessage) {
17165
- messageConstIndices[op.owner] = job.addConst(op.expression, op.statements);
17166
- OpList.remove(op);
17167
- }
17168
- }
17169
- }
17170
- for (const unit of job.units) {
17171
- for (const op of unit.create) {
17172
- if (op.kind === OpKind.I18nStart && messageConstIndices[op.xref] !== void 0) {
17173
- op.messageIndex = messageConstIndices[op.xref];
17174
- }
17175
- }
17176
- }
17177
- }
17178
-
17179
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/phase_remove_content_selectors.mjs
17180
- function phaseRemoveContentSelectors(job) {
17181
- for (const unit of job.units) {
17182
- const elements = getElementsByXrefId(unit);
17183
- for (const op of unit.update) {
17184
- switch (op.kind) {
17185
- case OpKind.Binding:
17186
- const target = lookupElement4(elements, op.target);
17187
- if (op.name.toLowerCase() === "select" && target.kind === OpKind.Projection) {
17188
- OpList.remove(op);
17189
- }
17190
- continue;
17191
- }
17192
- }
17193
- }
17194
- }
17195
- function lookupElement4(elements, xref) {
17196
- const el = elements.get(xref);
17197
- if (el === void 0) {
17198
- throw new Error("All attributes should have an element-like target.");
17199
- }
17200
- return el;
17201
- }
17202
-
17203
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/emit.mjs
17649
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/emit.mjs
17204
17650
  var phases = [
17205
17651
  { kind: CompilationJobKind.Tmpl, fn: phaseRemoveContentSelectors },
17206
- { kind: CompilationJobKind.Tmpl, fn: phaseGenerateI18nBlocks },
17207
- { kind: CompilationJobKind.Tmpl, fn: phaseI18nTextExtraction },
17208
17652
  { kind: CompilationJobKind.Host, fn: phaseHostStylePropertyParsing },
17209
17653
  { kind: CompilationJobKind.Tmpl, fn: phaseNamespace },
17210
17654
  { kind: CompilationJobKind.Both, fn: phaseStyleBindingSpecialization },
17211
17655
  { kind: CompilationJobKind.Both, fn: phaseBindingSpecialization },
17656
+ { kind: CompilationJobKind.Tmpl, fn: phasePropagateI18nBlocks },
17212
17657
  { kind: CompilationJobKind.Both, fn: phaseAttributeExtraction },
17213
17658
  { kind: CompilationJobKind.Both, fn: phaseParseExtractedStyles },
17214
17659
  { kind: CompilationJobKind.Tmpl, fn: phaseRemoveEmptyBindings },
17215
17660
  { kind: CompilationJobKind.Tmpl, fn: phaseConditionals },
17216
- { kind: CompilationJobKind.Tmpl, fn: phaseNoListenersOnTemplates },
17217
17661
  { kind: CompilationJobKind.Tmpl, fn: phasePipeCreation },
17662
+ { kind: CompilationJobKind.Tmpl, fn: phaseI18nTextExtraction },
17663
+ { kind: CompilationJobKind.Tmpl, fn: phaseApplyI18nExpressions },
17218
17664
  { kind: CompilationJobKind.Tmpl, fn: phasePipeVariadic },
17219
17665
  { kind: CompilationJobKind.Both, fn: phasePureLiteralStructures },
17220
17666
  { kind: CompilationJobKind.Tmpl, fn: phaseGenerateProjectionDef },
@@ -17231,9 +17677,12 @@ var phases = [
17231
17677
  { kind: CompilationJobKind.Both, fn: phaseTemporaryVariables },
17232
17678
  { kind: CompilationJobKind.Tmpl, fn: phaseSlotAllocation },
17233
17679
  { kind: CompilationJobKind.Tmpl, fn: phaseResolveI18nPlaceholders },
17680
+ { kind: CompilationJobKind.Tmpl, fn: phasePropagateI18nPlaceholders },
17234
17681
  { kind: CompilationJobKind.Tmpl, fn: phaseI18nMessageExtraction },
17235
17682
  { kind: CompilationJobKind.Tmpl, fn: phaseI18nConstCollection },
17683
+ { kind: CompilationJobKind.Tmpl, fn: phaseConstTraitCollection },
17236
17684
  { kind: CompilationJobKind.Both, fn: phaseConstCollection },
17685
+ { kind: CompilationJobKind.Tmpl, fn: phaseAssignI18nSlotDependencies },
17237
17686
  { kind: CompilationJobKind.Both, fn: phaseVarCounting },
17238
17687
  { kind: CompilationJobKind.Tmpl, fn: phaseGenerateAdvance },
17239
17688
  { kind: CompilationJobKind.Both, fn: phaseVariableOptimization },
@@ -17350,7 +17799,7 @@ function emitHostBindingFunction(job) {
17350
17799
  );
17351
17800
  }
17352
17801
 
17353
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/src/ingest.mjs
17802
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/ingest.mjs
17354
17803
  var compatibilityMode = CompatibilityMode.TemplateDefinitionBuilder;
17355
17804
  function ingestComponent(componentName, template2, constantPool, relativeContextFilePath, i18nUseExternalIds) {
17356
17805
  const cpl = new ComponentCompilationJob(componentName, constantPool, compatibilityMode, relativeContextFilePath, i18nUseExternalIds);
@@ -17420,35 +17869,52 @@ function ingestNodes(unit, template2) {
17420
17869
  ingestText(unit, node);
17421
17870
  } else if (node instanceof BoundText) {
17422
17871
  ingestBoundText(unit, node);
17872
+ } else if (node instanceof IfBlock) {
17873
+ ingestIfBlock(unit, node);
17423
17874
  } else if (node instanceof SwitchBlock) {
17424
17875
  ingestSwitchBlock(unit, node);
17876
+ } else if (node instanceof DeferredBlock) {
17877
+ ingestDeferBlock(unit, node);
17425
17878
  } else {
17426
17879
  throw new Error(`Unsupported template node: ${node.constructor.name}`);
17427
17880
  }
17428
17881
  }
17429
17882
  }
17430
17883
  function ingestElement(unit, element2) {
17884
+ if (element2.i18n !== void 0 && !(element2.i18n instanceof Message || element2.i18n instanceof TagPlaceholder)) {
17885
+ throw Error(`Unhandled i18n metadata type for element: ${element2.i18n.constructor.name}`);
17886
+ }
17431
17887
  const staticAttributes = {};
17432
17888
  for (const attr of element2.attributes) {
17433
17889
  staticAttributes[attr.name] = attr.value;
17434
17890
  }
17435
17891
  const id = unit.job.allocateXrefId();
17436
17892
  const [namespaceKey, elementName] = splitNsName(element2.name);
17437
- const startOp = createElementStartOp(elementName, id, namespaceForKey(namespaceKey), element2.i18n, element2.startSourceSpan);
17893
+ const startOp = createElementStartOp(elementName, id, namespaceForKey(namespaceKey), element2.i18n instanceof TagPlaceholder ? element2.i18n : void 0, element2.startSourceSpan);
17438
17894
  unit.create.push(startOp);
17439
17895
  ingestBindings(unit, startOp, element2);
17440
17896
  ingestReferences(startOp, element2);
17441
17897
  ingestNodes(unit, element2.children);
17442
- unit.create.push(createElementEndOp(id, element2.endSourceSpan));
17898
+ const endOp = createElementEndOp(id, element2.endSourceSpan);
17899
+ unit.create.push(endOp);
17900
+ if (element2.i18n instanceof Message) {
17901
+ const i18nBlockId = unit.job.allocateXrefId();
17902
+ OpList.insertAfter(createI18nStartOp(i18nBlockId, element2.i18n), startOp);
17903
+ OpList.insertBefore(createI18nEndOp(i18nBlockId), endOp);
17904
+ }
17443
17905
  }
17444
17906
  function ingestTemplate(unit, tmpl) {
17907
+ if (tmpl.i18n !== void 0 && !(tmpl.i18n instanceof Message || tmpl.i18n instanceof TagPlaceholder)) {
17908
+ throw Error(`Unhandled i18n metadata type for template: ${tmpl.i18n.constructor.name}`);
17909
+ }
17445
17910
  const childView = unit.job.allocateView(unit.xref);
17446
17911
  let tagNameWithoutNamespace = tmpl.tagName;
17447
17912
  let namespacePrefix = "";
17448
17913
  if (tmpl.tagName) {
17449
17914
  [namespacePrefix, tagNameWithoutNamespace] = splitNsName(tmpl.tagName);
17450
17915
  }
17451
- const tplOp = createTemplateOp(childView.xref, tagNameWithoutNamespace != null ? tagNameWithoutNamespace : "ng-template", namespaceForKey(namespacePrefix), false, tmpl.i18n, tmpl.startSourceSpan);
17916
+ const i18nPlaceholder = tmpl.i18n instanceof TagPlaceholder ? tmpl.i18n : void 0;
17917
+ const tplOp = createTemplateOp(childView.xref, tagNameWithoutNamespace != null ? tagNameWithoutNamespace : "ng-template", namespaceForKey(namespacePrefix), false, i18nPlaceholder, tmpl.startSourceSpan);
17452
17918
  unit.create.push(tplOp);
17453
17919
  ingestBindings(unit, tplOp, tmpl);
17454
17920
  ingestReferences(tplOp, tmpl);
@@ -17456,11 +17922,16 @@ function ingestTemplate(unit, tmpl) {
17456
17922
  for (const { name, value } of tmpl.variables) {
17457
17923
  childView.contextVariables.set(name, value);
17458
17924
  }
17925
+ if (tmpl.i18n instanceof Message) {
17926
+ const id = unit.job.allocateXrefId();
17927
+ OpList.insertAfter(createI18nStartOp(id, tmpl.i18n), childView.create.head);
17928
+ OpList.insertBefore(createI18nEndOp(id), childView.create.tail);
17929
+ }
17459
17930
  }
17460
17931
  function ingestContent(unit, content) {
17461
17932
  const op = createProjectionOp(unit.job.allocateXrefId(), content.selector);
17462
17933
  for (const attr of content.attributes) {
17463
- ingestBinding(unit, op.xref, attr.name, literal(attr.value), 1, null, SecurityContext.NONE, attr.sourceSpan, true, false);
17934
+ ingestBinding(unit, op.xref, attr.name, literal(attr.value), 1, null, SecurityContext.NONE, attr.sourceSpan, BindingFlags.TextValue);
17464
17935
  }
17465
17936
  unit.create.push(op);
17466
17937
  }
@@ -17468,6 +17939,7 @@ function ingestText(unit, text2) {
17468
17939
  unit.create.push(createTextOp(unit.job.allocateXrefId(), text2.value, text2.sourceSpan));
17469
17940
  }
17470
17941
  function ingestBoundText(unit, text2) {
17942
+ var _a2;
17471
17943
  let value = text2.value;
17472
17944
  if (value instanceof ASTWithSource) {
17473
17945
  value = value.ast;
@@ -17475,27 +17947,91 @@ function ingestBoundText(unit, text2) {
17475
17947
  if (!(value instanceof Interpolation)) {
17476
17948
  throw new Error(`AssertionError: expected Interpolation for BoundText node, got ${value.constructor.name}`);
17477
17949
  }
17950
+ if (text2.i18n !== void 0 && !(text2.i18n instanceof Container)) {
17951
+ throw Error(`Unhandled i18n metadata type for text interpolation: ${(_a2 = text2.i18n) == null ? void 0 : _a2.constructor.name}`);
17952
+ }
17953
+ const i18nPlaceholders = text2.i18n instanceof Container ? text2.i18n.children.filter((node) => node instanceof Placeholder) : [];
17478
17954
  const textXref = unit.job.allocateXrefId();
17479
17955
  unit.create.push(createTextOp(textXref, "", text2.sourceSpan));
17480
17956
  const baseSourceSpan = unit.job.compatibility ? null : text2.sourceSpan;
17481
- unit.update.push(createInterpolateTextOp(textXref, new Interpolation2(value.strings, value.expressions.map((expr) => convertAst(expr, unit.job, baseSourceSpan))), text2.sourceSpan));
17957
+ unit.update.push(createInterpolateTextOp(textXref, new Interpolation2(value.strings, value.expressions.map((expr) => convertAst(expr, unit.job, baseSourceSpan))), i18nPlaceholders, text2.sourceSpan));
17958
+ }
17959
+ function ingestIfBlock(unit, ifBlock) {
17960
+ let firstXref = null;
17961
+ let conditions = [];
17962
+ for (const ifCase of ifBlock.branches) {
17963
+ const cView = unit.job.allocateView(unit.xref);
17964
+ if (ifCase.expressionAlias !== null) {
17965
+ cView.contextVariables.set(ifCase.expressionAlias.name, CTX_REF);
17966
+ }
17967
+ if (firstXref === null) {
17968
+ firstXref = cView.xref;
17969
+ }
17970
+ unit.create.push(createTemplateOp(cView.xref, "Conditional", Namespace.HTML, true, void 0, ifCase.sourceSpan));
17971
+ const caseExpr = ifCase.expression ? convertAst(ifCase.expression, unit.job, null) : null;
17972
+ const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, cView.xref, ifCase.expressionAlias);
17973
+ conditions.push(conditionalCaseExpr);
17974
+ ingestNodes(cView, ifCase.children);
17975
+ }
17976
+ const conditional2 = createConditionalOp(firstXref, null, conditions, ifBlock.sourceSpan);
17977
+ unit.update.push(conditional2);
17482
17978
  }
17483
17979
  function ingestSwitchBlock(unit, switchBlock) {
17484
17980
  let firstXref = null;
17485
17981
  let conditions = [];
17486
17982
  for (const switchCase of switchBlock.cases) {
17487
17983
  const cView = unit.job.allocateView(unit.xref);
17488
- if (!firstXref)
17984
+ if (firstXref === null) {
17489
17985
  firstXref = cView.xref;
17490
- unit.create.push(createTemplateOp(cView.xref, "Case", Namespace.HTML, true, void 0, null));
17986
+ }
17987
+ unit.create.push(createTemplateOp(cView.xref, "Case", Namespace.HTML, true, void 0, switchCase.sourceSpan));
17491
17988
  const caseExpr = switchCase.expression ? convertAst(switchCase.expression, unit.job, switchBlock.startSourceSpan) : null;
17492
- conditions.push([cView.xref, caseExpr]);
17989
+ const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, cView.xref);
17990
+ conditions.push(conditionalCaseExpr);
17493
17991
  ingestNodes(cView, switchCase.children);
17494
17992
  }
17495
- const conditional2 = createConditionalOp(firstXref, convertAst(switchBlock.expression, unit.job, switchBlock.startSourceSpan), null);
17496
- conditional2.conditions = conditions;
17993
+ const conditional2 = createConditionalOp(firstXref, convertAst(switchBlock.expression, unit.job, null), conditions, switchBlock.sourceSpan);
17497
17994
  unit.update.push(conditional2);
17498
17995
  }
17996
+ function ingestDeferView(unit, suffix, children, sourceSpan) {
17997
+ if (children === void 0) {
17998
+ return null;
17999
+ }
18000
+ const secondaryView = unit.job.allocateView(unit.xref);
18001
+ ingestNodes(secondaryView, children);
18002
+ const templateOp = createTemplateOp(secondaryView.xref, `Defer${suffix}`, Namespace.HTML, true, void 0, sourceSpan);
18003
+ unit.create.push(templateOp);
18004
+ return templateOp;
18005
+ }
18006
+ function ingestDeferBlock(unit, deferBlock) {
18007
+ var _a2, _b2, _c2, _d2, _e2, _f2;
18008
+ const main = ingestDeferView(unit, "", deferBlock.children, deferBlock.sourceSpan);
18009
+ const loading = ingestDeferView(unit, "Loading", (_a2 = deferBlock.loading) == null ? void 0 : _a2.children, (_b2 = deferBlock.loading) == null ? void 0 : _b2.sourceSpan);
18010
+ const placeholder = ingestDeferView(unit, "Placeholder", (_c2 = deferBlock.placeholder) == null ? void 0 : _c2.children, (_d2 = deferBlock.placeholder) == null ? void 0 : _d2.sourceSpan);
18011
+ const error2 = ingestDeferView(unit, "Error", (_e2 = deferBlock.error) == null ? void 0 : _e2.children, (_f2 = deferBlock.error) == null ? void 0 : _f2.sourceSpan);
18012
+ const deferOp = createDeferOp(unit.job.allocateXrefId(), main.xref, deferBlock.sourceSpan);
18013
+ unit.create.push(deferOp);
18014
+ if (loading && deferBlock.loading) {
18015
+ deferOp.loading = createDeferSecondaryOp(deferOp.xref, loading.xref, DeferSecondaryKind.Loading);
18016
+ if (deferBlock.loading.afterTime !== null || deferBlock.loading.minimumTime !== null) {
18017
+ deferOp.loading.constValue = [deferBlock.loading.minimumTime, deferBlock.loading.afterTime];
18018
+ }
18019
+ unit.create.push(deferOp.loading);
18020
+ }
18021
+ if (placeholder && deferBlock.placeholder) {
18022
+ deferOp.placeholder = createDeferSecondaryOp(deferOp.xref, placeholder.xref, DeferSecondaryKind.Placeholder);
18023
+ if (deferBlock.placeholder.minimumTime !== null) {
18024
+ deferOp.placeholder.constValue = [deferBlock.placeholder.minimumTime];
18025
+ }
18026
+ unit.create.push(deferOp.placeholder);
18027
+ }
18028
+ if (error2 && deferBlock.error) {
18029
+ deferOp.error = createDeferSecondaryOp(deferOp.xref, error2.xref, DeferSecondaryKind.Error);
18030
+ unit.create.push(deferOp.error);
18031
+ }
18032
+ const deferOnOp = createDeferOnOp(unit.job.allocateXrefId(), null);
18033
+ unit.create.push(deferOnOp);
18034
+ }
17499
18035
  function convertAst(ast, job, baseSourceSpan) {
17500
18036
  if (ast instanceof ASTWithSource) {
17501
18037
  return convertAst(ast.ast, job, baseSourceSpan);
@@ -17559,20 +18095,28 @@ function convertAst(ast, job, baseSourceSpan) {
17559
18095
  }
17560
18096
  }
17561
18097
  function ingestBindings(unit, op, element2) {
18098
+ var _a2;
18099
+ let flags = BindingFlags.None;
18100
+ const isPlainTemplate = element2 instanceof Template && splitNsName((_a2 = element2.tagName) != null ? _a2 : "")[1] === "ng-template";
17562
18101
  if (element2 instanceof Template) {
18102
+ flags |= BindingFlags.OnNgTemplateElement;
18103
+ if (isPlainTemplate) {
18104
+ flags |= BindingFlags.BindingTargetsTemplate;
18105
+ }
18106
+ const templateAttrFlags = flags | BindingFlags.BindingTargetsTemplate | BindingFlags.IsStructuralTemplateAttribute;
17563
18107
  for (const attr of element2.templateAttrs) {
17564
18108
  if (attr instanceof TextAttribute) {
17565
- ingestBinding(unit, op.xref, attr.name, literal(attr.value), 1, null, SecurityContext.NONE, attr.sourceSpan, true, true);
18109
+ ingestBinding(unit, op.xref, attr.name, literal(attr.value), 1, null, SecurityContext.NONE, attr.sourceSpan, templateAttrFlags | BindingFlags.TextValue);
17566
18110
  } else {
17567
- ingestBinding(unit, op.xref, attr.name, attr.value, attr.type, attr.unit, attr.securityContext, attr.sourceSpan, false, true);
18111
+ ingestBinding(unit, op.xref, attr.name, attr.value, attr.type, attr.unit, attr.securityContext, attr.sourceSpan, templateAttrFlags);
17568
18112
  }
17569
18113
  }
17570
18114
  }
17571
18115
  for (const attr of element2.attributes) {
17572
- ingestBinding(unit, op.xref, attr.name, literal(attr.value), 1, null, SecurityContext.NONE, attr.sourceSpan, true, false);
18116
+ ingestBinding(unit, op.xref, attr.name, literal(attr.value), 1, null, SecurityContext.NONE, attr.sourceSpan, flags | BindingFlags.TextValue);
17573
18117
  }
17574
18118
  for (const input of element2.inputs) {
17575
- ingestBinding(unit, op.xref, input.name, input.value, input.type, input.unit, input.securityContext, input.sourceSpan, false, false);
18119
+ ingestBinding(unit, op.xref, input.name, input.value, input.type, input.unit, input.securityContext, input.sourceSpan, flags);
17576
18120
  }
17577
18121
  for (const output of element2.outputs) {
17578
18122
  let listenerOp;
@@ -17581,6 +18125,10 @@ function ingestBindings(unit, op, element2) {
17581
18125
  throw Error("Animation listener should have a phase");
17582
18126
  }
17583
18127
  }
18128
+ if (element2 instanceof Template && !isPlainTemplate) {
18129
+ unit.create.push(createExtractedAttributeOp(op.xref, BindingKind.Property, output.name, null));
18130
+ continue;
18131
+ }
17584
18132
  listenerOp = createListenerOp(op.xref, output.name, op.tag, output.phase, false, output.sourceSpan);
17585
18133
  let handlerExprs;
17586
18134
  let handler = output.handler;
@@ -17612,10 +18160,22 @@ var BINDING_KINDS = /* @__PURE__ */ new Map([
17612
18160
  [3, BindingKind.StyleProperty],
17613
18161
  [4, BindingKind.Animation]
17614
18162
  ]);
17615
- function ingestBinding(view, xref, name, value, type, unit, securityContext, sourceSpan, isTextAttribute, isTemplateBinding) {
18163
+ var BindingFlags;
18164
+ (function(BindingFlags2) {
18165
+ BindingFlags2[BindingFlags2["None"] = 0] = "None";
18166
+ BindingFlags2[BindingFlags2["TextValue"] = 1] = "TextValue";
18167
+ BindingFlags2[BindingFlags2["BindingTargetsTemplate"] = 2] = "BindingTargetsTemplate";
18168
+ BindingFlags2[BindingFlags2["IsStructuralTemplateAttribute"] = 4] = "IsStructuralTemplateAttribute";
18169
+ BindingFlags2[BindingFlags2["OnNgTemplateElement"] = 8] = "OnNgTemplateElement";
18170
+ })(BindingFlags || (BindingFlags = {}));
18171
+ function ingestBinding(view, xref, name, value, type, unit, securityContext, sourceSpan, flags) {
17616
18172
  if (value instanceof ASTWithSource) {
17617
18173
  value = value.ast;
17618
18174
  }
18175
+ if (flags & BindingFlags.OnNgTemplateElement && !(flags & BindingFlags.BindingTargetsTemplate) && type === 0) {
18176
+ view.create.push(createExtractedAttributeOp(xref, BindingKind.Property, name, null));
18177
+ return;
18178
+ }
17619
18179
  let expression;
17620
18180
  if (value instanceof Interpolation) {
17621
18181
  expression = new Interpolation2(value.strings, value.expressions.map((expr) => convertAst(expr, view.job, null)));
@@ -17625,7 +18185,7 @@ function ingestBinding(view, xref, name, value, type, unit, securityContext, sou
17625
18185
  expression = value;
17626
18186
  }
17627
18187
  const kind = BINDING_KINDS.get(type);
17628
- view.update.push(createBindingOp(xref, kind, name, expression, unit, securityContext, isTextAttribute, isTemplateBinding, sourceSpan));
18188
+ view.update.push(createBindingOp(xref, kind, name, expression, unit, securityContext, !!(flags & BindingFlags.TextValue), !!(flags & BindingFlags.IsStructuralTemplateAttribute), sourceSpan));
17629
18189
  }
17630
18190
  function ingestReferences(op, element2) {
17631
18191
  assertIsArray(op.localRefs);
@@ -17651,10 +18211,10 @@ function convertSourceSpan(span, baseSourceSpan) {
17651
18211
  return new ParseSourceSpan(start, end, fullStart);
17652
18212
  }
17653
18213
 
17654
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template/pipeline/switch/index.mjs
18214
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/switch/index.mjs
17655
18215
  var USE_TEMPLATE_PIPELINE = false;
17656
18216
 
17657
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/styling_builder.mjs
18217
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/view/styling_builder.mjs
17658
18218
  var IMPORTANT_FLAG = "!important";
17659
18219
  var MIN_STYLING_BINDING_SLOTS_REQUIRED = 2;
17660
18220
  var StylingBuilder = class {
@@ -17987,7 +18547,7 @@ function isEmptyExpression(ast) {
17987
18547
  return ast instanceof EmptyExpr;
17988
18548
  }
17989
18549
 
17990
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/html_parser.mjs
18550
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/ml_parser/html_parser.mjs
17991
18551
  var HtmlParser = class extends Parser2 {
17992
18552
  constructor() {
17993
18553
  super(getHtmlTagDefinition);
@@ -17997,7 +18557,7 @@ var HtmlParser = class extends Parser2 {
17997
18557
  }
17998
18558
  };
17999
18559
 
18000
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/html_whitespaces.mjs
18560
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/ml_parser/html_whitespaces.mjs
18001
18561
  var PRESERVE_WS_ATTR_NAME = "ngPreserveWhitespaces";
18002
18562
  var SKIP_WS_TRIM_TAGS = /* @__PURE__ */ new Set(["pre", "template", "textarea", "script", "style"]);
18003
18563
  var WS_CHARS = " \f\n\r \v\u1680\u180E\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF";
@@ -18063,7 +18623,7 @@ function visitAllWithSiblings(visitor, nodes) {
18063
18623
  return result;
18064
18624
  }
18065
18625
 
18066
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template_parser/binding_parser.mjs
18626
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template_parser/binding_parser.mjs
18067
18627
  var PROPERTY_PARTS_SEPARATOR = ".";
18068
18628
  var ATTRIBUTE_PREFIX = "attr";
18069
18629
  var CLASS_PREFIX = "class";
@@ -18383,7 +18943,7 @@ function moveParseSourceSpan(sourceSpan, absoluteSpan) {
18383
18943
  return new ParseSourceSpan(sourceSpan.start.moveBy(startDiff), sourceSpan.end.moveBy(endDiff), sourceSpan.fullStart.moveBy(startDiff), sourceSpan.details);
18384
18944
  }
18385
18945
 
18386
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/style_url_resolver.mjs
18946
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/style_url_resolver.mjs
18387
18947
  function isStyleUrlResolvable(url) {
18388
18948
  if (url == null || url.length === 0 || url[0] == "/")
18389
18949
  return false;
@@ -18392,7 +18952,7 @@ function isStyleUrlResolvable(url) {
18392
18952
  }
18393
18953
  var URL_WITH_SCHEMA_REGEXP = /^([^:/?#]+):/;
18394
18954
 
18395
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/template_parser/template_preparser.mjs
18955
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/template_parser/template_preparser.mjs
18396
18956
  var NG_CONTENT_SELECT_ATTR = "select";
18397
18957
  var LINK_ELEMENT = "link";
18398
18958
  var LINK_STYLE_REL_ATTR = "rel";
@@ -18462,12 +19022,12 @@ function normalizeNgContentSelect(selectAttr) {
18462
19022
  return selectAttr;
18463
19023
  }
18464
19024
 
18465
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_control_flow.mjs
19025
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/r3_control_flow.mjs
18466
19026
  var FOR_LOOP_EXPRESSION_PATTERN = /^\s*([0-9A-Za-z_$]*)\s+of\s+(.*)/;
18467
- var FOR_LOOP_TRACK_PATTERN = /^track\s+(.*)/;
19027
+ var FOR_LOOP_TRACK_PATTERN = /^track\s+([\S\s]*)/;
18468
19028
  var CONDITIONAL_ALIAS_PATTERN = /^as\s+(.*)/;
18469
19029
  var ELSE_IF_PATTERN = /^else[^\S\r\n]+if/;
18470
- var FOR_LOOP_LET_PATTERN = /^let\s+(.*)/;
19030
+ var FOR_LOOP_LET_PATTERN = /^let\s+([\S\s]*)/;
18471
19031
  var ALLOWED_FOR_LOOP_LET_VARIABLES = /* @__PURE__ */ new Set(["$index", "$first", "$last", "$even", "$odd", "$count"]);
18472
19032
  function isConnectedForLoopBlock(name) {
18473
19033
  return name === "empty";
@@ -18478,30 +19038,36 @@ function isConnectedIfLoopBlock(name) {
18478
19038
  function createIfBlock(ast, connectedBlocks, visitor, bindingParser) {
18479
19039
  const errors = validateIfConnectedBlocks(connectedBlocks);
18480
19040
  const branches = [];
18481
- if (errors.length > 0) {
18482
- return { node: null, errors };
18483
- }
18484
19041
  const mainBlockParams = parseConditionalBlockParameters(ast, errors, bindingParser);
18485
19042
  if (mainBlockParams !== null) {
18486
- branches.push(new IfBlockBranch(mainBlockParams.expression, visitAll2(visitor, ast.children, ast.children), mainBlockParams.expressionAlias, ast.sourceSpan, ast.startSourceSpan));
19043
+ branches.push(new IfBlockBranch(mainBlockParams.expression, visitAll2(visitor, ast.children, ast.children), mainBlockParams.expressionAlias, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan));
18487
19044
  }
18488
19045
  for (const block of connectedBlocks) {
18489
- const children = visitAll2(visitor, block.children, block.children);
18490
19046
  if (ELSE_IF_PATTERN.test(block.name)) {
18491
19047
  const params = parseConditionalBlockParameters(block, errors, bindingParser);
18492
19048
  if (params !== null) {
18493
- branches.push(new IfBlockBranch(params.expression, children, params.expressionAlias, block.sourceSpan, block.startSourceSpan));
19049
+ const children = visitAll2(visitor, block.children, block.children);
19050
+ branches.push(new IfBlockBranch(params.expression, children, params.expressionAlias, block.sourceSpan, block.startSourceSpan, block.endSourceSpan));
18494
19051
  }
18495
19052
  } else if (block.name === "else") {
18496
- branches.push(new IfBlockBranch(null, children, null, block.sourceSpan, block.startSourceSpan));
19053
+ const children = visitAll2(visitor, block.children, block.children);
19054
+ branches.push(new IfBlockBranch(null, children, null, block.sourceSpan, block.startSourceSpan, block.endSourceSpan));
18497
19055
  }
18498
19056
  }
19057
+ const ifBlockStartSourceSpan = branches.length > 0 ? branches[0].startSourceSpan : ast.startSourceSpan;
19058
+ const ifBlockEndSourceSpan = branches.length > 0 ? branches[branches.length - 1].endSourceSpan : ast.endSourceSpan;
19059
+ let wholeSourceSpan = ast.sourceSpan;
19060
+ const lastBranch = branches[branches.length - 1];
19061
+ if (lastBranch !== void 0) {
19062
+ wholeSourceSpan = new ParseSourceSpan(ifBlockStartSourceSpan.start, lastBranch.sourceSpan.end);
19063
+ }
18499
19064
  return {
18500
- node: new IfBlock(branches, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan),
19065
+ node: new IfBlock(branches, wholeSourceSpan, ast.startSourceSpan, ifBlockEndSourceSpan),
18501
19066
  errors
18502
19067
  };
18503
19068
  }
18504
19069
  function createForLoop(ast, connectedBlocks, visitor, bindingParser) {
19070
+ var _a2, _b2;
18505
19071
  const errors = [];
18506
19072
  const params = parseForLoopParameters(ast, errors, bindingParser);
18507
19073
  let node = null;
@@ -18513,7 +19079,7 @@ function createForLoop(ast, connectedBlocks, visitor, bindingParser) {
18513
19079
  } else if (block.parameters.length > 0) {
18514
19080
  errors.push(new ParseError(block.sourceSpan, "@empty block cannot have parameters"));
18515
19081
  } else {
18516
- empty = new ForLoopBlockEmpty(visitAll2(visitor, block.children, block.children), block.sourceSpan, block.startSourceSpan);
19082
+ empty = new ForLoopBlockEmpty(visitAll2(visitor, block.children, block.children), block.sourceSpan, block.startSourceSpan, block.endSourceSpan);
18517
19083
  }
18518
19084
  } else {
18519
19085
  errors.push(new ParseError(block.sourceSpan, `Unrecognized @for loop block "${block.name}"`));
@@ -18523,25 +19089,29 @@ function createForLoop(ast, connectedBlocks, visitor, bindingParser) {
18523
19089
  if (params.trackBy === null) {
18524
19090
  errors.push(new ParseError(ast.sourceSpan, '@for loop must have a "track" expression'));
18525
19091
  } else {
18526
- node = new ForLoopBlock(params.itemName, params.expression, params.trackBy, params.context, visitAll2(visitor, ast.children, ast.children), empty, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
19092
+ const endSpan = (_a2 = empty == null ? void 0 : empty.endSourceSpan) != null ? _a2 : ast.endSourceSpan;
19093
+ const sourceSpan = new ParseSourceSpan(ast.sourceSpan.start, (_b2 = endSpan == null ? void 0 : endSpan.end) != null ? _b2 : ast.sourceSpan.end);
19094
+ node = new ForLoopBlock(params.itemName, params.expression, params.trackBy, params.context, visitAll2(visitor, ast.children, ast.children), empty, sourceSpan, ast.sourceSpan, ast.startSourceSpan, endSpan);
18527
19095
  }
18528
19096
  }
18529
19097
  return { node, errors };
18530
19098
  }
18531
19099
  function createSwitchBlock(ast, visitor, bindingParser) {
18532
19100
  const errors = validateSwitchBlock(ast);
18533
- if (errors.length > 0) {
18534
- return { node: null, errors };
18535
- }
18536
- const primaryExpression = parseBlockParameterToBinding(ast.parameters[0], bindingParser);
19101
+ const primaryExpression = ast.parameters.length > 0 ? parseBlockParameterToBinding(ast.parameters[0], bindingParser) : bindingParser.parseBinding("", false, ast.sourceSpan, 0);
18537
19102
  const cases = [];
19103
+ const unknownBlocks = [];
18538
19104
  let defaultCase = null;
18539
19105
  for (const node of ast.children) {
18540
19106
  if (!(node instanceof Block)) {
18541
19107
  continue;
18542
19108
  }
19109
+ if ((node.name !== "case" || node.parameters.length === 0) && node.name !== "default") {
19110
+ unknownBlocks.push(new UnknownBlock(node.name, node.sourceSpan));
19111
+ continue;
19112
+ }
18543
19113
  const expression = node.name === "case" ? parseBlockParameterToBinding(node.parameters[0], bindingParser) : null;
18544
- const ast2 = new SwitchBlockCase(expression, visitAll2(visitor, node.children, node.children), node.sourceSpan, node.startSourceSpan);
19114
+ const ast2 = new SwitchBlockCase(expression, visitAll2(visitor, node.children, node.children), node.sourceSpan, node.startSourceSpan, node.endSourceSpan);
18545
19115
  if (expression === null) {
18546
19116
  defaultCase = ast2;
18547
19117
  } else {
@@ -18552,7 +19122,7 @@ function createSwitchBlock(ast, visitor, bindingParser) {
18552
19122
  cases.push(defaultCase);
18553
19123
  }
18554
19124
  return {
18555
- node: new SwitchBlock(primaryExpression, cases, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan),
19125
+ node: new SwitchBlock(primaryExpression, cases, unknownBlocks, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan),
18556
19126
  errors
18557
19127
  };
18558
19128
  }
@@ -18594,7 +19164,8 @@ function parseForLoopParameters(block, errors, bindingParser) {
18594
19164
  }
18595
19165
  for (const variableName of ALLOWED_FOR_LOOP_LET_VARIABLES) {
18596
19166
  if (!result.context.hasOwnProperty(variableName)) {
18597
- result.context[variableName] = new Variable(variableName, variableName, block.startSourceSpan, block.startSourceSpan);
19167
+ const emptySpanAfterForBlockStart = new ParseSourceSpan(block.startSourceSpan.end, block.startSourceSpan.end);
19168
+ result.context[variableName] = new Variable(variableName, variableName, emptySpanAfterForBlockStart, emptySpanAfterForBlockStart);
18598
19169
  }
18599
19170
  }
18600
19171
  return result;
@@ -18740,7 +19311,7 @@ function stripOptionalParentheses(param, errors) {
18740
19311
  return expression.slice(start, end);
18741
19312
  }
18742
19313
 
18743
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_deferred_triggers.mjs
19314
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/r3_deferred_triggers.mjs
18744
19315
  var TIME_PATTERN = /^\d+(ms|s)?$/;
18745
19316
  var SEPARATOR_PATTERN = /^\s$/;
18746
19317
  var COMMA_DELIMITED_SYNTAX = /* @__PURE__ */ new Map([
@@ -18988,7 +19559,7 @@ function parseDeferredTime(value) {
18988
19559
  return parseInt(time) * (units === "s" ? 1e3 : 1);
18989
19560
  }
18990
19561
 
18991
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_deferred_blocks.mjs
19562
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/r3_deferred_blocks.mjs
18992
19563
  var PREFETCH_WHEN_PATTERN = /^prefetch\s+when\s/;
18993
19564
  var PREFETCH_ON_PATTERN = /^prefetch\s+on\s/;
18994
19565
  var MINIMUM_PARAMETER_PATTERN = /^minimum\s/;
@@ -19002,7 +19573,15 @@ function createDeferredBlock(ast, connectedBlocks, visitor, bindingParser) {
19002
19573
  const errors = [];
19003
19574
  const { placeholder, loading, error: error2 } = parseConnectedBlocks(connectedBlocks, errors, visitor);
19004
19575
  const { triggers, prefetchTriggers } = parsePrimaryTriggers(ast.parameters, bindingParser, errors, placeholder);
19005
- const node = new DeferredBlock(visitAll2(visitor, ast.children, ast.children), triggers, prefetchTriggers, placeholder, loading, error2, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
19576
+ let lastEndSourceSpan = ast.endSourceSpan;
19577
+ let endOfLastSourceSpan = ast.sourceSpan.end;
19578
+ if (connectedBlocks.length > 0) {
19579
+ const lastConnectedBlock = connectedBlocks[connectedBlocks.length - 1];
19580
+ lastEndSourceSpan = lastConnectedBlock.endSourceSpan;
19581
+ endOfLastSourceSpan = lastConnectedBlock.sourceSpan.end;
19582
+ }
19583
+ const mainDeferredSourceSpan = new ParseSourceSpan(ast.sourceSpan.start, endOfLastSourceSpan);
19584
+ const node = new DeferredBlock(visitAll2(visitor, ast.children, ast.children), triggers, prefetchTriggers, placeholder, loading, error2, mainDeferredSourceSpan, ast.sourceSpan, ast.startSourceSpan, lastEndSourceSpan);
19006
19585
  return { node, errors };
19007
19586
  }
19008
19587
  function parseConnectedBlocks(connectedBlocks, errors, visitor) {
@@ -19115,7 +19694,7 @@ function parsePrimaryTriggers(params, bindingParser, errors, placeholder) {
19115
19694
  return { triggers, prefetchTriggers };
19116
19695
  }
19117
19696
 
19118
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/r3_template_transform.mjs
19697
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/r3_template_transform.mjs
19119
19698
  var BIND_NAME_REGEXP = /^(?:(bind-)|(let-)|(ref-|#)|(on-)|(bindon-)|(@))(.*)$/;
19120
19699
  var KW_BIND_IDX = 1;
19121
19700
  var KW_LET_IDX = 2;
@@ -19304,23 +19883,6 @@ var HtmlAstToIvyAst = class {
19304
19883
  if (this.processedNodes.has(block)) {
19305
19884
  return null;
19306
19885
  }
19307
- if (!this.options.enabledBlockTypes.has(block.name)) {
19308
- let errorMessage;
19309
- if (isConnectedDeferLoopBlock(block.name)) {
19310
- errorMessage = `@${block.name} block can only be used after an @defer block.`;
19311
- this.processedNodes.add(block);
19312
- } else if (isConnectedForLoopBlock(block.name)) {
19313
- errorMessage = `@${block.name} block can only be used after an @for block.`;
19314
- this.processedNodes.add(block);
19315
- } else if (isConnectedIfLoopBlock(block.name)) {
19316
- errorMessage = `@${block.name} block can only be used after an @if or @else if block.`;
19317
- this.processedNodes.add(block);
19318
- } else {
19319
- errorMessage = `Unrecognized block @${block.name}.`;
19320
- }
19321
- this.reportError(errorMessage, block.sourceSpan);
19322
- return null;
19323
- }
19324
19886
  let result = null;
19325
19887
  switch (block.name) {
19326
19888
  case "defer":
@@ -19336,9 +19898,22 @@ var HtmlAstToIvyAst = class {
19336
19898
  result = createIfBlock(block, this.findConnectedBlocks(index, context, isConnectedIfLoopBlock), this, this.bindingParser);
19337
19899
  break;
19338
19900
  default:
19901
+ let errorMessage;
19902
+ if (isConnectedDeferLoopBlock(block.name)) {
19903
+ errorMessage = `@${block.name} block can only be used after an @defer block.`;
19904
+ this.processedNodes.add(block);
19905
+ } else if (isConnectedForLoopBlock(block.name)) {
19906
+ errorMessage = `@${block.name} block can only be used after an @for block.`;
19907
+ this.processedNodes.add(block);
19908
+ } else if (isConnectedIfLoopBlock(block.name)) {
19909
+ errorMessage = `@${block.name} block can only be used after an @if or @else if block.`;
19910
+ this.processedNodes.add(block);
19911
+ } else {
19912
+ errorMessage = `Unrecognized block @${block.name}.`;
19913
+ }
19339
19914
  result = {
19340
- node: null,
19341
- errors: [new ParseError(block.sourceSpan, `Unrecognized block @${block.name}.`)]
19915
+ node: new UnknownBlock(block.name, block.sourceSpan),
19916
+ errors: [new ParseError(block.sourceSpan, errorMessage)]
19342
19917
  };
19343
19918
  break;
19344
19919
  }
@@ -19550,7 +20125,7 @@ function textContents(node) {
19550
20125
  }
19551
20126
  }
19552
20127
 
19553
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/i18n/context.mjs
20128
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/view/i18n/context.mjs
19554
20129
  var TagType;
19555
20130
  (function(TagType2) {
19556
20131
  TagType2[TagType2["ELEMENT"] = 0] = "ELEMENT";
@@ -19685,7 +20260,7 @@ function serializePlaceholderValue(value) {
19685
20260
  }
19686
20261
  }
19687
20262
 
19688
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/template.mjs
20263
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/view/template.mjs
19689
20264
  var NG_CONTENT_SELECT_ATTR2 = "select";
19690
20265
  var NG_PROJECT_AS_ATTR_NAME = "ngProjectAs";
19691
20266
  var EVENT_BINDING_SCOPE_GLOBALS = /* @__PURE__ */ new Set(["$event"]);
@@ -19797,6 +20372,7 @@ var TemplateDefinitionBuilder = class {
19797
20372
  this.visitIfBlockBranch = invalid;
19798
20373
  this.visitSwitchBlockCase = invalid;
19799
20374
  this.visitForLoopBlockEmpty = invalid;
20375
+ this.visitUnknownBlock = invalid;
19800
20376
  this._bindingScope = parentBindingScope.nestedScope(level);
19801
20377
  this.fileBasedI18nSuffix = relativeContextFilePath.replace(/[^A-Za-z0-9]/g, "_") + "_";
19802
20378
  this._valueConverter = new ValueConverter(constantPool, () => this.allocateDataSlot(), (numSlots) => this.allocatePureFunctionSlots(numSlots), (name, localName, slot, value) => {
@@ -20337,13 +20913,10 @@ var TemplateDefinitionBuilder = class {
20337
20913
  visitIfBlock(block) {
20338
20914
  this.allocateBindingSlots(null);
20339
20915
  const branchData = block.branches.map(({ expression, expressionAlias, children, sourceSpan }) => {
20340
- const processedExpression = expression === null ? null : expression.visit(this._valueConverter);
20341
20916
  const variables = expressionAlias !== null ? [new Variable(expressionAlias.name, DIRECT_CONTEXT_REFERENCE, expressionAlias.sourceSpan, expressionAlias.keySpan)] : void 0;
20342
- return {
20343
- index: this.createEmbeddedTemplateFn(null, children, "_Conditional", sourceSpan, variables),
20344
- expression: processedExpression,
20345
- alias: expressionAlias
20346
- };
20917
+ const index = this.createEmbeddedTemplateFn(null, children, "_Conditional", sourceSpan, variables);
20918
+ const processedExpression = expression === null ? null : expression.visit(this._valueConverter);
20919
+ return { index, expression: processedExpression, alias: expressionAlias };
20347
20920
  });
20348
20921
  const containerIndex = branchData[0].index;
20349
20922
  const paramsCallback = () => {
@@ -20374,15 +20947,14 @@ var TemplateDefinitionBuilder = class {
20374
20947
  this.updateInstructionWithAdvance(containerIndex, block.branches[0].sourceSpan, Identifiers.conditional, paramsCallback);
20375
20948
  }
20376
20949
  visitSwitchBlock(block) {
20377
- const blockExpression = block.expression.visit(this._valueConverter);
20378
- this.allocateBindingSlots(null);
20379
20950
  const caseData = block.cases.map((currentCase) => {
20380
- return {
20381
- index: this.createEmbeddedTemplateFn(null, currentCase.children, "_Case", currentCase.sourceSpan),
20382
- expression: currentCase.expression === null ? null : currentCase.expression.visit(this._valueConverter)
20383
- };
20951
+ const index = this.createEmbeddedTemplateFn(null, currentCase.children, "_Case", currentCase.sourceSpan);
20952
+ const expression = currentCase.expression === null ? null : currentCase.expression.visit(this._valueConverter);
20953
+ return { index, expression };
20384
20954
  });
20385
20955
  const containerIndex = caseData[0].index;
20956
+ const blockExpression = block.expression.visit(this._valueConverter);
20957
+ this.allocateBindingSlots(null);
20386
20958
  this.updateInstructionWithAdvance(containerIndex, block.sourceSpan, Identifiers.conditional, () => {
20387
20959
  const generateCases = (caseIndex) => {
20388
20960
  if (caseIndex > caseData.length - 1) {
@@ -20420,11 +20992,12 @@ var TemplateDefinitionBuilder = class {
20420
20992
  literal(placeholderIndex),
20421
20993
  literal(errorIndex),
20422
20994
  (loadingConsts == null ? void 0 : loadingConsts.length) ? this.addToConsts(literalArr(loadingConsts)) : TYPED_NULL_EXPR,
20423
- placeholderConsts ? this.addToConsts(placeholderConsts) : TYPED_NULL_EXPR
20995
+ placeholderConsts ? this.addToConsts(placeholderConsts) : TYPED_NULL_EXPR,
20996
+ (loadingConsts == null ? void 0 : loadingConsts.length) || placeholderConsts ? importExpr(Identifiers.deferEnableTimerScheduling) : TYPED_NULL_EXPR
20424
20997
  ]));
20998
+ this.allocateDataSlot();
20425
20999
  this.createDeferTriggerInstructions(deferredIndex, triggers, metadata, false);
20426
21000
  this.createDeferTriggerInstructions(deferredIndex, prefetchTriggers, metadata, true);
20427
- this.allocateDataSlot();
20428
21001
  }
20429
21002
  createDeferredDepsFunction(name, metadata) {
20430
21003
  if (metadata.deps.length === 0) {
@@ -20494,10 +21067,12 @@ var TemplateDefinitionBuilder = class {
20494
21067
  visitForLoopBlock(block) {
20495
21068
  const blockIndex = this.allocateDataSlot();
20496
21069
  const primaryData = this.prepareEmbeddedTemplateFn(block.children, "_For", [block.item, block.contextVariables.$index, block.contextVariables.$count]);
20497
- const emptyData = block.empty === null ? null : this.prepareEmbeddedTemplateFn(block.empty.children, "_ForEmpty");
20498
21070
  const { expression: trackByExpression, usesComponentInstance: trackByUsesComponentInstance } = this.createTrackByFunction(block);
20499
- const value = block.expression.visit(this._valueConverter);
20500
- this.allocateBindingSlots(value);
21071
+ let emptyData = null;
21072
+ if (block.empty !== null) {
21073
+ emptyData = this.prepareEmbeddedTemplateFn(block.empty.children, "_ForEmpty");
21074
+ this.allocateBindingSlots(null);
21075
+ }
20501
21076
  this.registerComputedLoopVariables(block, primaryData.scope);
20502
21077
  this.creationInstruction(block.sourceSpan, Identifiers.repeaterCreate, () => {
20503
21078
  const params = [
@@ -20514,6 +21089,7 @@ var TemplateDefinitionBuilder = class {
20514
21089
  }
20515
21090
  return params;
20516
21091
  });
21092
+ const value = block.expression.visit(this._valueConverter);
20517
21093
  this.updateInstruction(block.sourceSpan, Identifiers.repeater, () => [literal(blockIndex), this.convertPropertyBinding(value)]);
20518
21094
  }
20519
21095
  registerComputedLoopVariables(block, bindingScope) {
@@ -21172,6 +21748,7 @@ function getTextInterpolationExpression(interpolation) {
21172
21748
  }
21173
21749
  }
21174
21750
  function parseTemplate(template2, templateUrl, options = {}) {
21751
+ var _a2;
21175
21752
  const { interpolationConfig, preserveWhitespaces, enableI18nLegacyMessageIdFormat } = options;
21176
21753
  const bindingParser = makeBindingParser(interpolationConfig);
21177
21754
  const htmlParser = new HtmlParser();
@@ -21179,7 +21756,7 @@ function parseTemplate(template2, templateUrl, options = {}) {
21179
21756
  leadingTriviaChars: LEADING_TRIVIA_CHARS
21180
21757
  }, options), {
21181
21758
  tokenizeExpansionForms: true,
21182
- tokenizeBlocks: options.enabledBlockTypes != null && options.enabledBlockTypes.size > 0
21759
+ tokenizeBlocks: (_a2 = options.enableBlockSyntax) != null ? _a2 : true
21183
21760
  }));
21184
21761
  if (!options.alwaysAttemptHtmlToR3AstConversion && parseResult.errors && parseResult.errors.length > 0) {
21185
21762
  const parsedTemplate2 = {
@@ -21221,10 +21798,7 @@ function parseTemplate(template2, templateUrl, options = {}) {
21221
21798
  rootNodes = visitAll2(new I18nMetaVisitor(interpolationConfig, false), rootNodes);
21222
21799
  }
21223
21800
  }
21224
- const { nodes, errors, styleUrls, styles, ngContentSelectors, commentNodes } = htmlAstToRender3Ast(rootNodes, bindingParser, {
21225
- collectCommentNodes: !!options.collectCommentNodes,
21226
- enabledBlockTypes: options.enabledBlockTypes || /* @__PURE__ */ new Set()
21227
- });
21801
+ const { nodes, errors, styleUrls, styles, ngContentSelectors, commentNodes } = htmlAstToRender3Ast(rootNodes, bindingParser, { collectCommentNodes: !!options.collectCommentNodes });
21228
21802
  errors.push(...parseResult.errors, ...i18nMetaResult.errors);
21229
21803
  const parsedTemplate = {
21230
21804
  interpolationConfig,
@@ -21316,7 +21890,7 @@ function createClosureModeGuard2() {
21316
21890
  return typeofExpr(variable(NG_I18N_CLOSURE_MODE2)).notIdentical(literal("undefined", STRING_TYPE)).and(variable(NG_I18N_CLOSURE_MODE2));
21317
21891
  }
21318
21892
 
21319
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/compiler.mjs
21893
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/view/compiler.mjs
21320
21894
  var ATTR_REGEX = /attr\.([^\]]+)/;
21321
21895
  var COMPONENT_VARIABLE = "%COMP%";
21322
21896
  var HOST_ATTR = `_nghost-${COMPONENT_VARIABLE}`;
@@ -21423,7 +21997,7 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
21423
21997
  if (constExpressions.length > 0) {
21424
21998
  let constsExpr = literalArr(constExpressions);
21425
21999
  if (prepareStatements.length > 0) {
21426
- constsExpr = fn([], [...prepareStatements, new ReturnStatement(constsExpr)]);
22000
+ constsExpr = arrowFn([], [...prepareStatements, new ReturnStatement(constsExpr)]);
21427
22001
  }
21428
22002
  definitionMap.set("consts", constsExpr);
21429
22003
  }
@@ -21439,7 +22013,10 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
21439
22013
  definitionMap.set("vars", literal(tpl.root.vars));
21440
22014
  if (tpl.consts.length > 0) {
21441
22015
  if (tpl.constsInitializers.length > 0) {
21442
- definitionMap.set("consts", fn([], [...tpl.constsInitializers, new ReturnStatement(literalArr(tpl.consts))]));
22016
+ definitionMap.set("consts", arrowFn([], [
22017
+ ...tpl.constsInitializers,
22018
+ new ReturnStatement(literalArr(tpl.consts))
22019
+ ]));
21443
22020
  } else {
21444
22021
  definitionMap.set("consts", literalArr(tpl.consts));
21445
22022
  }
@@ -21504,10 +22081,10 @@ function compileDeclarationList(list, mode) {
21504
22081
  case 0:
21505
22082
  return list;
21506
22083
  case 1:
21507
- return fn([], [new ReturnStatement(list)]);
22084
+ return arrowFn([], list);
21508
22085
  case 2:
21509
22086
  const resolvedList = list.prop("map").callFn([importExpr(Identifiers.resolveForwardRef)]);
21510
- return fn([], [new ReturnStatement(resolvedList)]);
22087
+ return arrowFn([], resolvedList);
21511
22088
  case 3:
21512
22089
  throw new Error(`Unsupported with an array of pre-resolved dependencies`);
21513
22090
  }
@@ -21915,7 +22492,7 @@ function createHostDirectivesMappingArray(mapping) {
21915
22492
  return elements.length > 0 ? literalArr(elements) : null;
21916
22493
  }
21917
22494
 
21918
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/view/t2_binder.mjs
22495
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/view/t2_binder.mjs
21919
22496
  var R3TargetBinder = class {
21920
22497
  constructor(directiveMatcher) {
21921
22498
  this.directiveMatcher = directiveMatcher;
@@ -22032,6 +22609,8 @@ var Scope = class {
22032
22609
  }
22033
22610
  visitDeferredTrigger(trigger) {
22034
22611
  }
22612
+ visitUnknownBlock(block) {
22613
+ }
22035
22614
  maybeDeclare(thing) {
22036
22615
  if (!this.namedEntities.has(thing.name)) {
22037
22616
  this.namedEntities.set(thing.name, thing);
@@ -22190,6 +22769,8 @@ var DirectiveBinder = class {
22190
22769
  }
22191
22770
  visitDeferredTrigger(trigger) {
22192
22771
  }
22772
+ visitUnknownBlock(block) {
22773
+ }
22193
22774
  };
22194
22775
  var TemplateBinder = class extends RecursiveAstVisitor {
22195
22776
  constructor(bindings, symbols, usedPipes, eagerPipes, deferBlocks, nestingLevel, scope, rootNode, level) {
@@ -22277,6 +22858,10 @@ var TemplateBinder = class extends RecursiveAstVisitor {
22277
22858
  }
22278
22859
  visitTextAttribute(attribute2) {
22279
22860
  }
22861
+ visitUnknownBlock(block) {
22862
+ }
22863
+ visitDeferredTrigger() {
22864
+ }
22280
22865
  visitIcu(icu) {
22281
22866
  Object.keys(icu.vars).forEach((key) => icu.vars[key].visit(this));
22282
22867
  Object.keys(icu.placeholders).forEach((key) => icu.placeholders[key].visit(this));
@@ -22288,17 +22873,15 @@ var TemplateBinder = class extends RecursiveAstVisitor {
22288
22873
  event.handler.visit(this);
22289
22874
  }
22290
22875
  visitDeferredBlock(deferred) {
22876
+ var _a2, _b2;
22291
22877
  this.deferBlocks.add(deferred);
22292
22878
  this.ingestScopedNode(deferred);
22879
+ (_a2 = deferred.triggers.when) == null ? void 0 : _a2.value.visit(this);
22880
+ (_b2 = deferred.prefetchTriggers.when) == null ? void 0 : _b2.value.visit(this);
22293
22881
  deferred.placeholder && this.visitNode(deferred.placeholder);
22294
22882
  deferred.loading && this.visitNode(deferred.loading);
22295
22883
  deferred.error && this.visitNode(deferred.error);
22296
22884
  }
22297
- visitDeferredTrigger(trigger) {
22298
- if (trigger instanceof BoundDeferredTrigger) {
22299
- trigger.value.visit(this);
22300
- }
22301
- }
22302
22885
  visitDeferredBlockPlaceholder(block) {
22303
22886
  this.ingestScopedNode(block);
22304
22887
  }
@@ -22501,12 +23084,11 @@ function extractScopedNodeEntities(rootScope) {
22501
23084
  return templateEntities;
22502
23085
  }
22503
23086
 
22504
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/resource_loader.mjs
23087
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/resource_loader.mjs
22505
23088
  var ResourceLoader = class {
22506
23089
  };
22507
23090
 
22508
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/jit_compiler_facade.mjs
22509
- var enabledBlockTypes;
23091
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/jit_compiler_facade.mjs
22510
23092
  var CompilerFacadeImpl = class {
22511
23093
  constructor(jitEvaluator = new JitEvaluator()) {
22512
23094
  this.jitEvaluator = jitEvaluator;
@@ -22882,7 +23464,7 @@ function convertPipeDeclarationToMetadata(pipe2) {
22882
23464
  }
22883
23465
  function parseJitTemplate(template2, typeName, sourceMapUrl, preserveWhitespaces, interpolation) {
22884
23466
  const interpolationConfig = interpolation ? InterpolationConfig.fromArray(interpolation) : DEFAULT_INTERPOLATION_CONFIG;
22885
- const parsed = parseTemplate(template2, sourceMapUrl, { preserveWhitespaces, interpolationConfig, enabledBlockTypes });
23467
+ const parsed = parseTemplate(template2, sourceMapUrl, { preserveWhitespaces, interpolationConfig });
22886
23468
  if (parsed.errors !== null) {
22887
23469
  const errors = parsed.errors.map((err) => err.toString()).join(", ");
22888
23470
  throw new Error(`Errors during JIT compilation of template for ${typeName}: ${errors}`);
@@ -23058,17 +23640,17 @@ function publishFacade(global) {
23058
23640
  ng.\u0275compilerFacade = new CompilerFacadeImpl();
23059
23641
  }
23060
23642
 
23061
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/version.mjs
23062
- var VERSION2 = new Version("17.0.0-next.6");
23643
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/version.mjs
23644
+ var VERSION2 = new Version("17.0.0-next.8");
23063
23645
 
23064
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
23646
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
23065
23647
  var _VisitorMode;
23066
23648
  (function(_VisitorMode2) {
23067
23649
  _VisitorMode2[_VisitorMode2["Extract"] = 0] = "Extract";
23068
23650
  _VisitorMode2[_VisitorMode2["Merge"] = 1] = "Merge";
23069
23651
  })(_VisitorMode || (_VisitorMode = {}));
23070
23652
 
23071
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/ml_parser/xml_tags.mjs
23653
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/ml_parser/xml_tags.mjs
23072
23654
  var XmlTagDefinition = class {
23073
23655
  constructor() {
23074
23656
  this.closedByParent = false;
@@ -23090,7 +23672,7 @@ var XmlTagDefinition = class {
23090
23672
  };
23091
23673
  var _TAG_DEFINITION = new XmlTagDefinition();
23092
23674
 
23093
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/render3/partial/api.mjs
23675
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/render3/partial/api.mjs
23094
23676
  var FactoryTarget2;
23095
23677
  (function(FactoryTarget3) {
23096
23678
  FactoryTarget3[FactoryTarget3["Directive"] = 0] = "Directive";
@@ -23100,10 +23682,10 @@ var FactoryTarget2;
23100
23682
  FactoryTarget3[FactoryTarget3["NgModule"] = 4] = "NgModule";
23101
23683
  })(FactoryTarget2 || (FactoryTarget2 = {}));
23102
23684
 
23103
- // bazel-out/darwin-fastbuild/bin/packages/compiler/src/compiler.mjs
23685
+ // bazel-out/k8-fastbuild/bin/packages/compiler/src/compiler.mjs
23104
23686
  publishFacade(_global);
23105
23687
 
23106
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/migrations/block-template-entities/util.mjs
23688
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/migrations/block-template-entities/util.mjs
23107
23689
  var import_path2 = require("path");
23108
23690
  var import_typescript3 = __toESM(require("typescript"), 1);
23109
23691
  var REPLACEMENTS2 = {
@@ -23199,7 +23781,7 @@ var TextRangeCollector = class extends RecursiveVisitor {
23199
23781
  }
23200
23782
  };
23201
23783
 
23202
- // bazel-out/darwin-fastbuild/bin/packages/core/schematics/migrations/block-template-entities/index.mjs
23784
+ // bazel-out/k8-fastbuild/bin/packages/core/schematics/migrations/block-template-entities/index.mjs
23203
23785
  function block_template_entities_default() {
23204
23786
  return (tree) => __async(this, null, function* () {
23205
23787
  const { buildPaths, testPaths } = yield getProjectTsConfigPaths(tree);