@angular/core 17.0.0-next.7 → 17.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) 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 +8 -2
  12. package/esm2022/src/application_tokens.mjs +16 -1
  13. package/esm2022/src/core_private_export.mjs +7 -6
  14. package/esm2022/src/core_reactivity_export_internal.mjs +6 -2
  15. package/esm2022/src/core_render3_private_export.mjs +3 -3
  16. package/esm2022/src/debug/debug_node.mjs +5 -9
  17. package/esm2022/src/defer/cleanup.mjs +70 -0
  18. package/esm2022/src/defer/discovery.mjs +47 -0
  19. package/esm2022/src/defer/dom_triggers.mjs +256 -0
  20. package/esm2022/src/defer/idle_scheduler.mjs +109 -0
  21. package/esm2022/src/defer/instructions.mjs +641 -0
  22. package/esm2022/src/defer/interfaces.mjs +79 -0
  23. package/esm2022/src/defer/timer_scheduler.mjs +192 -0
  24. package/esm2022/src/defer/utils.mjs +134 -0
  25. package/esm2022/src/errors.mjs +1 -1
  26. package/esm2022/src/hydration/api.mjs +1 -2
  27. package/esm2022/src/hydration/utils.mjs +2 -2
  28. package/esm2022/src/image_performance_warning.mjs +154 -0
  29. package/esm2022/src/linker/compiler.mjs +1 -1
  30. package/esm2022/src/metadata/directives.mjs +1 -1
  31. package/esm2022/src/render/api.mjs +1 -1
  32. package/esm2022/src/render3/after_render_hooks.mjs +35 -1
  33. package/esm2022/src/render3/assert.mjs +16 -1
  34. package/esm2022/src/render3/component_ref.mjs +12 -3
  35. package/esm2022/src/render3/debug/framework_injector_profiler.mjs +33 -4
  36. package/esm2022/src/render3/debug/injector_profiler.mjs +1 -1
  37. package/esm2022/src/render3/debug/set_debug_info.mjs +20 -0
  38. package/esm2022/src/render3/definition.mjs +2 -1
  39. package/esm2022/src/render3/deps_tracker/api.mjs +1 -1
  40. package/esm2022/src/render3/deps_tracker/deps_tracker.mjs +13 -2
  41. package/esm2022/src/render3/features/host_directives_feature.mjs +3 -8
  42. package/esm2022/src/render3/hooks.mjs +5 -5
  43. package/esm2022/src/render3/index.mjs +4 -2
  44. package/esm2022/src/render3/instructions/all.mjs +2 -2
  45. package/esm2022/src/render3/instructions/change_detection.mjs +31 -14
  46. package/esm2022/src/render3/instructions/control_flow.mjs +42 -23
  47. package/esm2022/src/render3/instructions/shared.mjs +5 -4
  48. package/esm2022/src/render3/interfaces/container.mjs +5 -7
  49. package/esm2022/src/render3/interfaces/definition.mjs +2 -4
  50. package/esm2022/src/render3/interfaces/i18n.mjs +1 -4
  51. package/esm2022/src/render3/interfaces/injector.mjs +1 -4
  52. package/esm2022/src/render3/interfaces/node.mjs +1 -4
  53. package/esm2022/src/render3/interfaces/projection.mjs +2 -4
  54. package/esm2022/src/render3/interfaces/query.mjs +2 -4
  55. package/esm2022/src/render3/interfaces/renderer.mjs +2 -4
  56. package/esm2022/src/render3/interfaces/renderer_dom.mjs +2 -4
  57. package/esm2022/src/render3/interfaces/view.mjs +5 -7
  58. package/esm2022/src/render3/jit/environment.mjs +3 -1
  59. package/esm2022/src/render3/list_reconciliation.mjs +58 -34
  60. package/esm2022/src/render3/node_manipulation.mjs +4 -6
  61. package/esm2022/src/render3/reactive_lview_consumer.mjs +3 -8
  62. package/esm2022/src/render3/reactivity/api.mjs +15 -0
  63. package/esm2022/src/render3/reactivity/asserts.mjs +26 -0
  64. package/esm2022/src/render3/reactivity/computed.mjs +19 -0
  65. package/esm2022/src/render3/reactivity/effect.mjs +7 -6
  66. package/esm2022/src/render3/reactivity/signal.mjs +32 -0
  67. package/esm2022/src/render3/reactivity/untracked.mjs +24 -0
  68. package/esm2022/src/render3/util/injector_discovery_utils.mjs +43 -14
  69. package/esm2022/src/render3/util/stringify_utils.mjs +28 -1
  70. package/esm2022/src/render3/util/view_utils.mjs +41 -25
  71. package/esm2022/src/render3/view_ref.mjs +3 -2
  72. package/esm2022/src/util/stringify.mjs +16 -1
  73. package/esm2022/src/version.mjs +1 -1
  74. package/esm2022/testing/src/logger.mjs +3 -3
  75. package/fesm2022/core.mjs +2881 -2270
  76. package/fesm2022/core.mjs.map +1 -1
  77. package/fesm2022/primitives/signals.mjs +539 -0
  78. package/fesm2022/primitives/signals.mjs.map +1 -0
  79. package/fesm2022/rxjs-interop.mjs +45 -14
  80. package/fesm2022/rxjs-interop.mjs.map +1 -1
  81. package/fesm2022/testing.mjs +1 -1
  82. package/index.d.ts +204 -168
  83. package/package.json +7 -1
  84. package/primitives/signals/index.d.ts +281 -0
  85. package/rxjs-interop/index.d.ts +15 -101
  86. package/schematics/collection.json +12 -2
  87. package/schematics/migrations/block-template-entities/bundle.js +551 -197
  88. package/schematics/migrations/block-template-entities/bundle.js.map +4 -4
  89. package/schematics/migrations/compiler-options/bundle.js +582 -0
  90. package/schematics/migrations/compiler-options/bundle.js.map +7 -0
  91. package/schematics/migrations/transfer-state/bundle.js +592 -0
  92. package/schematics/migrations/transfer-state/bundle.js.map +7 -0
  93. package/schematics/migrations.json +10 -0
  94. package/schematics/ng-generate/control-flow-migration/bundle.js +24309 -0
  95. package/schematics/ng-generate/control-flow-migration/bundle.js.map +7 -0
  96. package/schematics/ng-generate/control-flow-migration/schema.json +7 -0
  97. package/schematics/ng-generate/standalone-migration/bundle.js +1496 -924
  98. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  99. package/testing/index.d.ts +1 -1
  100. package/esm2022/src/render3/instructions/defer.mjs +0 -1091
  101. package/esm2022/src/render3/instructions/defer_events.mjs +0 -164
  102. package/esm2022/src/render3/interfaces/defer.mjs +0 -72
  103. package/esm2022/src/signals/index.mjs +0 -16
  104. package/esm2022/src/signals/src/api.mjs +0 -39
  105. package/esm2022/src/signals/src/computed.mjs +0 -95
  106. package/esm2022/src/signals/src/errors.mjs +0 -18
  107. package/esm2022/src/signals/src/graph.mjs +0 -280
  108. package/esm2022/src/signals/src/signal.mjs +0 -92
  109. package/esm2022/src/signals/src/untracked.mjs +0 -26
  110. package/esm2022/src/signals/src/watch.mjs +0 -81
  111. package/esm2022/src/signals/src/weak_ref.mjs +0 -11
@@ -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
  })();
@@ -3673,12 +3679,13 @@ var DeferredBlockError = class {
3673
3679
  }
3674
3680
  };
3675
3681
  var DeferredBlock = class {
3676
- constructor(children, triggers, prefetchTriggers, placeholder, loading, error2, sourceSpan, startSourceSpan, endSourceSpan) {
3682
+ constructor(children, triggers, prefetchTriggers, placeholder, loading, error2, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan) {
3677
3683
  this.children = children;
3678
3684
  this.placeholder = placeholder;
3679
3685
  this.loading = loading;
3680
3686
  this.error = error2;
3681
3687
  this.sourceSpan = sourceSpan;
3688
+ this.mainBlockSpan = mainBlockSpan;
3682
3689
  this.startSourceSpan = startSourceSpan;
3683
3690
  this.endSourceSpan = endSourceSpan;
3684
3691
  this.triggers = triggers;
@@ -3693,20 +3700,18 @@ var DeferredBlock = class {
3693
3700
  this.visitTriggers(this.definedTriggers, this.triggers, visitor);
3694
3701
  this.visitTriggers(this.definedPrefetchTriggers, this.prefetchTriggers, visitor);
3695
3702
  visitAll(visitor, this.children);
3696
- this.placeholder && visitor.visitDeferredBlockPlaceholder(this.placeholder);
3697
- this.loading && visitor.visitDeferredBlockLoading(this.loading);
3698
- this.error && visitor.visitDeferredBlockError(this.error);
3703
+ const remainingBlocks = [this.placeholder, this.loading, this.error].filter((x) => x !== null);
3704
+ visitAll(visitor, remainingBlocks);
3699
3705
  }
3700
3706
  visitTriggers(keys, triggers, visitor) {
3701
- for (const key of keys) {
3702
- visitor.visitDeferredTrigger(triggers[key]);
3703
- }
3707
+ visitAll(visitor, keys.map((k) => triggers[k]));
3704
3708
  }
3705
3709
  };
3706
3710
  var SwitchBlock = class {
3707
- constructor(expression, cases, sourceSpan, startSourceSpan, endSourceSpan) {
3711
+ constructor(expression, cases, unknownBlocks, sourceSpan, startSourceSpan, endSourceSpan) {
3708
3712
  this.expression = expression;
3709
3713
  this.cases = cases;
3714
+ this.unknownBlocks = unknownBlocks;
3710
3715
  this.sourceSpan = sourceSpan;
3711
3716
  this.startSourceSpan = startSourceSpan;
3712
3717
  this.endSourceSpan = endSourceSpan;
@@ -3716,18 +3721,19 @@ var SwitchBlock = class {
3716
3721
  }
3717
3722
  };
3718
3723
  var SwitchBlockCase = class {
3719
- constructor(expression, children, sourceSpan, startSourceSpan) {
3724
+ constructor(expression, children, sourceSpan, startSourceSpan, endSourceSpan) {
3720
3725
  this.expression = expression;
3721
3726
  this.children = children;
3722
3727
  this.sourceSpan = sourceSpan;
3723
3728
  this.startSourceSpan = startSourceSpan;
3729
+ this.endSourceSpan = endSourceSpan;
3724
3730
  }
3725
3731
  visit(visitor) {
3726
3732
  return visitor.visitSwitchBlockCase(this);
3727
3733
  }
3728
3734
  };
3729
3735
  var ForLoopBlock = class {
3730
- constructor(item, expression, trackBy, contextVariables, children, empty, sourceSpan, startSourceSpan, endSourceSpan) {
3736
+ constructor(item, expression, trackBy, contextVariables, children, empty, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan) {
3731
3737
  this.item = item;
3732
3738
  this.expression = expression;
3733
3739
  this.trackBy = trackBy;
@@ -3735,6 +3741,7 @@ var ForLoopBlock = class {
3735
3741
  this.children = children;
3736
3742
  this.empty = empty;
3737
3743
  this.sourceSpan = sourceSpan;
3744
+ this.mainBlockSpan = mainBlockSpan;
3738
3745
  this.startSourceSpan = startSourceSpan;
3739
3746
  this.endSourceSpan = endSourceSpan;
3740
3747
  }
@@ -3743,10 +3750,11 @@ var ForLoopBlock = class {
3743
3750
  }
3744
3751
  };
3745
3752
  var ForLoopBlockEmpty = class {
3746
- constructor(children, sourceSpan, startSourceSpan) {
3753
+ constructor(children, sourceSpan, startSourceSpan, endSourceSpan) {
3747
3754
  this.children = children;
3748
3755
  this.sourceSpan = sourceSpan;
3749
3756
  this.startSourceSpan = startSourceSpan;
3757
+ this.endSourceSpan = endSourceSpan;
3750
3758
  }
3751
3759
  visit(visitor) {
3752
3760
  return visitor.visitForLoopBlockEmpty(this);
@@ -3764,17 +3772,27 @@ var IfBlock = class {
3764
3772
  }
3765
3773
  };
3766
3774
  var IfBlockBranch = class {
3767
- constructor(expression, children, expressionAlias, sourceSpan, startSourceSpan) {
3775
+ constructor(expression, children, expressionAlias, sourceSpan, startSourceSpan, endSourceSpan) {
3768
3776
  this.expression = expression;
3769
3777
  this.children = children;
3770
3778
  this.expressionAlias = expressionAlias;
3771
3779
  this.sourceSpan = sourceSpan;
3772
3780
  this.startSourceSpan = startSourceSpan;
3781
+ this.endSourceSpan = endSourceSpan;
3773
3782
  }
3774
3783
  visit(visitor) {
3775
3784
  return visitor.visitIfBlockBranch(this);
3776
3785
  }
3777
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
+ };
3778
3796
  var Template = class {
3779
3797
  constructor(tagName, attributes, inputs, outputs, templateAttrs, children, references, variables, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
3780
3798
  this.tagName = tagName;
@@ -6724,7 +6742,7 @@ var ShadowCss = class {
6724
6742
  while ((res = sep.exec(selector)) !== null) {
6725
6743
  const separator = res[1];
6726
6744
  const part2 = selector.slice(startIndex, res.index).trim();
6727
- if (part2.match(_placeholderRe) && ((_a2 = selector[res.index + 1]) == null ? void 0 : _a2.match(/[a-fA-F\d]/))) {
6745
+ if (part2.match(/__esc-ph-(\d+)__/) && ((_a2 = selector[res.index + 1]) == null ? void 0 : _a2.match(/[a-fA-F\d]/))) {
6728
6746
  continue;
6729
6747
  }
6730
6748
  shouldScope = shouldScope || part2.indexOf(_polyfillHostNoCombinator) > -1;
@@ -6746,7 +6764,12 @@ var SafeSelector = class {
6746
6764
  this.placeholders = [];
6747
6765
  this.index = 0;
6748
6766
  selector = this._escapeRegexMatches(selector, /(\[[^\]]*\])/g);
6749
- selector = this._escapeRegexMatches(selector, /(\\.)/g);
6767
+ selector = selector.replace(/(\\.)/g, (_, keep) => {
6768
+ const replaceBy = `__esc-ph-${this.index}__`;
6769
+ this.placeholders.push(keep);
6770
+ this.index++;
6771
+ return replaceBy;
6772
+ });
6750
6773
  this._content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, (_, pseudo, exp) => {
6751
6774
  const replaceBy = `__ph-${this.index}__`;
6752
6775
  this.placeholders.push(exp);
@@ -6755,7 +6778,7 @@ var SafeSelector = class {
6755
6778
  });
6756
6779
  }
6757
6780
  restore(content) {
6758
- return content.replace(_placeholderRe, (_ph, index) => this.placeholders[+index]);
6781
+ return content.replace(/__(?:ph|esc-ph)-(\d+)__/g, (_ph, index) => this.placeholders[+index]);
6759
6782
  }
6760
6783
  content() {
6761
6784
  return this._content;
@@ -6796,7 +6819,6 @@ var _commentRe = /\/\*[\s\S]*?\*\//g;
6796
6819
  var _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=/g;
6797
6820
  var COMMENT_PLACEHOLDER = "%COMMENT%";
6798
6821
  var _commentWithHashPlaceHolderRe = new RegExp(COMMENT_PLACEHOLDER, "g");
6799
- var _placeholderRe = /__ph-(\d+)__/g;
6800
6822
  var BLOCK_PLACEHOLDER = "%BLOCK%";
6801
6823
  var _ruleRe = new RegExp(`(\\s*(?:${COMMENT_PLACEHOLDER}\\s*)*)([^;\\{\\}]+?)(\\s*)((?:{%BLOCK%}?\\s*;?)|(?:\\s*;))`, "g");
6802
6824
  var CONTENT_PAIRS = /* @__PURE__ */ new Map([["{", "}"]]);
@@ -6986,6 +7008,8 @@ var OpKind;
6986
7008
  OpKind2[OpKind2["I18nEnd"] = 36] = "I18nEnd";
6987
7009
  OpKind2[OpKind2["I18nExpression"] = 37] = "I18nExpression";
6988
7010
  OpKind2[OpKind2["I18nApply"] = 38] = "I18nApply";
7011
+ OpKind2[OpKind2["Icu"] = 39] = "Icu";
7012
+ OpKind2[OpKind2["IcuUpdate"] = 40] = "IcuUpdate";
6989
7013
  })(OpKind || (OpKind = {}));
6990
7014
  var ExpressionKind;
6991
7015
  (function(ExpressionKind2) {
@@ -7048,6 +7072,11 @@ var BindingKind;
7048
7072
  BindingKind2[BindingKind2["I18n"] = 5] = "I18n";
7049
7073
  BindingKind2[BindingKind2["Animation"] = 6] = "Animation";
7050
7074
  })(BindingKind || (BindingKind = {}));
7075
+ var I18nParamResolutionTime;
7076
+ (function(I18nParamResolutionTime2) {
7077
+ I18nParamResolutionTime2[I18nParamResolutionTime2["Creation"] = 0] = "Creation";
7078
+ I18nParamResolutionTime2[I18nParamResolutionTime2["Postproccessing"] = 1] = "Postproccessing";
7079
+ })(I18nParamResolutionTime || (I18nParamResolutionTime = {}));
7051
7080
 
7052
7081
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/traits.mjs
7053
7082
  var ConsumesSlot = Symbol("ConsumesSlot");
@@ -7228,12 +7257,14 @@ function createConditionalOp(target, test, conditions, sourceSpan) {
7228
7257
  contextValue: null
7229
7258
  }, NEW_OP), TRAIT_USES_SLOT_INDEX), TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS);
7230
7259
  }
7231
- function createI18nExpressionOp(target, expression, i18nPlaceholder, sourceSpan) {
7260
+ function createI18nExpressionOp(owner, expression, i18nPlaceholder, resolutionTime, sourceSpan) {
7232
7261
  return __spreadValues(__spreadValues(__spreadValues({
7233
7262
  kind: OpKind.I18nExpression,
7234
- target,
7263
+ owner,
7264
+ target: owner,
7235
7265
  expression,
7236
7266
  i18nPlaceholder,
7267
+ resolutionTime,
7237
7268
  sourceSpan
7238
7269
  }, NEW_OP), TRAIT_CONSUMES_VARS), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
7239
7270
  }
@@ -7244,6 +7275,13 @@ function createI18nApplyOp(target, sourceSpan) {
7244
7275
  sourceSpan
7245
7276
  }, NEW_OP), TRAIT_USES_SLOT_INDEX);
7246
7277
  }
7278
+ function createIcuUpdateOp(xref, sourceSpan) {
7279
+ return __spreadValues({
7280
+ kind: OpKind.IcuUpdate,
7281
+ xref,
7282
+ sourceSpan
7283
+ }, NEW_OP);
7284
+ }
7247
7285
 
7248
7286
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/expression.mjs
7249
7287
  var _a;
@@ -7952,6 +7990,8 @@ function transformExpressionsInOp(op, transform2, flags) {
7952
7990
  case OpKind.Advance:
7953
7991
  case OpKind.Namespace:
7954
7992
  case OpKind.I18nApply:
7993
+ case OpKind.Icu:
7994
+ case OpKind.IcuUpdate:
7955
7995
  break;
7956
7996
  default:
7957
7997
  throw new Error(`AssertionError: transformExpressionsInOp doesn't handle ${OpKind[op.kind]}`);
@@ -8249,7 +8289,7 @@ function createElementStartOp(tag, xref, namespace, i18nPlaceholder, sourceSpan)
8249
8289
  sourceSpan
8250
8290
  }, TRAIT_CONSUMES_SLOT), NEW_OP);
8251
8291
  }
8252
- function createTemplateOp(xref, tag, namespace, generatedInBlock, i18n2, sourceSpan) {
8292
+ function createTemplateOp(xref, tag, namespace, generatedInBlock, i18nPlaceholder, sourceSpan) {
8253
8293
  return __spreadValues(__spreadValues({
8254
8294
  kind: OpKind.Template,
8255
8295
  xref,
@@ -8261,6 +8301,7 @@ function createTemplateOp(xref, tag, namespace, generatedInBlock, i18n2, sourceS
8261
8301
  localRefs: [],
8262
8302
  nonBindable: false,
8263
8303
  namespace,
8304
+ i18nPlaceholder,
8264
8305
  sourceSpan
8265
8306
  }, TRAIT_CONSUMES_SLOT), NEW_OP);
8266
8307
  }
@@ -8388,13 +8429,17 @@ function createExtractedMessageOp(owner, expression, statements) {
8388
8429
  statements
8389
8430
  }, NEW_OP);
8390
8431
  }
8391
- function createI18nStartOp(xref, message) {
8432
+ function createI18nStartOp(xref, message, root) {
8392
8433
  return __spreadValues(__spreadValues({
8393
8434
  kind: OpKind.I18nStart,
8394
8435
  xref,
8436
+ root: root != null ? root : xref,
8395
8437
  message,
8396
8438
  params: /* @__PURE__ */ new Map(),
8397
- messageIndex: null
8439
+ postprocessingParams: /* @__PURE__ */ new Map(),
8440
+ messageIndex: null,
8441
+ subTemplateIndex: null,
8442
+ needsPostprocessing: false
8398
8443
  }, NEW_OP), TRAIT_CONSUMES_SLOT);
8399
8444
  }
8400
8445
  function createI18nEndOp(xref) {
@@ -8403,6 +8448,14 @@ function createI18nEndOp(xref) {
8403
8448
  xref
8404
8449
  }, NEW_OP);
8405
8450
  }
8451
+ function createIcuOp(xref, message, sourceSpan) {
8452
+ return __spreadValues({
8453
+ kind: OpKind.Icu,
8454
+ xref,
8455
+ message,
8456
+ sourceSpan
8457
+ }, NEW_OP);
8458
+ }
8406
8459
  function literalOrArrayLiteral(value) {
8407
8460
  if (Array.isArray(value)) {
8408
8461
  return literalArr(value.map(literalOrArrayLiteral));
@@ -8652,7 +8705,7 @@ function phaseApplyI18nExpressions(job) {
8652
8705
  for (const unit of job.units) {
8653
8706
  for (const op of unit.update) {
8654
8707
  if (op.kind === OpKind.I18nExpression && needsApplication(op)) {
8655
- OpList.insertAfter(createI18nApplyOp(op.target, null), op);
8708
+ OpList.insertAfter(createI18nApplyOp(op.owner, null), op);
8656
8709
  }
8657
8710
  }
8658
8711
  }
@@ -8662,12 +8715,33 @@ function needsApplication(op) {
8662
8715
  if (((_a2 = op.next) == null ? void 0 : _a2.kind) !== OpKind.I18nExpression) {
8663
8716
  return true;
8664
8717
  }
8665
- if (op.next.target !== op.target) {
8718
+ if (op.next.owner !== op.owner) {
8666
8719
  return true;
8667
8720
  }
8668
8721
  return false;
8669
8722
  }
8670
8723
 
8724
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/assign_i18n_slot_dependencies.mjs
8725
+ function phaseAssignI18nSlotDependencies(job) {
8726
+ const i18nLastSlotConsumers = /* @__PURE__ */ new Map();
8727
+ let lastSlotConsumer = null;
8728
+ for (const unit of job.units) {
8729
+ for (const op of unit.create) {
8730
+ if (op.kind === OpKind.I18nEnd) {
8731
+ i18nLastSlotConsumers.set(op.xref, lastSlotConsumer);
8732
+ }
8733
+ if (hasConsumesSlotTrait(op)) {
8734
+ lastSlotConsumer = op.xref;
8735
+ }
8736
+ }
8737
+ for (const op of unit.update) {
8738
+ if (op.kind === OpKind.I18nExpression) {
8739
+ op.target = i18nLastSlotConsumers.get(op.owner);
8740
+ }
8741
+ }
8742
+ }
8743
+ }
8744
+
8671
8745
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/util/elements.mjs
8672
8746
  function getElementsByXrefId(unit) {
8673
8747
  const elements = /* @__PURE__ */ new Map();
@@ -9283,24 +9357,12 @@ function ternaryTransform(e) {
9283
9357
  function phaseGenerateAdvance(job) {
9284
9358
  for (const unit of job.units) {
9285
9359
  const slotMap = /* @__PURE__ */ new Map();
9286
- let lastSlotOp = null;
9287
9360
  for (const op of unit.create) {
9288
- if (op.kind === OpKind.I18nEnd) {
9289
- if (lastSlotOp === null) {
9290
- throw Error("Expected to have encountered an op prior to i18nEnd that consumes a slot");
9291
- }
9292
- let lastSlot = lastSlotOp.slot;
9293
- if (lastSlotOp.kind === OpKind.I18nStart && job.compatibility) {
9294
- lastSlot++;
9295
- }
9296
- slotMap.set(op.xref, lastSlot);
9297
- }
9298
9361
  if (!hasConsumesSlotTrait(op)) {
9299
9362
  continue;
9300
9363
  } else if (op.slot === null) {
9301
9364
  throw new Error(`AssertionError: expected slots to have been allocated before generating advance() calls`);
9302
9365
  }
9303
- lastSlotOp = op;
9304
9366
  slotMap.set(op.xref, op.slot);
9305
9367
  }
9306
9368
  let slotContext = 0;
@@ -9387,7 +9449,6 @@ function getScopeForView(view, parent) {
9387
9449
  }
9388
9450
  for (const op of view.create) {
9389
9451
  switch (op.kind) {
9390
- case OpKind.Element:
9391
9452
  case OpKind.ElementStart:
9392
9453
  case OpKind.Template:
9393
9454
  if (!Array.isArray(op.localRefs)) {
@@ -9521,8 +9582,8 @@ function phaseI18nConstCollection(job) {
9521
9582
  }
9522
9583
  for (const unit of job.units) {
9523
9584
  for (const op of unit.create) {
9524
- if ((op.kind === OpKind.I18nStart || op.kind === OpKind.I18n) && messageConstIndices[op.xref] !== void 0) {
9525
- op.messageIndex = messageConstIndices[op.xref];
9585
+ if (op.kind === OpKind.I18nStart) {
9586
+ op.messageIndex = messageConstIndices[op.root];
9526
9587
  }
9527
9588
  }
9528
9589
  }
@@ -11364,7 +11425,7 @@ function getHtmlTagDefinition(tagName) {
11364
11425
  var _a2, _b2;
11365
11426
  if (!TAG_DEFINITIONS) {
11366
11427
  DEFAULT_TAG_DEFINITION = new HtmlTagDefinition({ canSelfClose: true });
11367
- TAG_DEFINITIONS = {
11428
+ TAG_DEFINITIONS = Object.assign(/* @__PURE__ */ Object.create(null), {
11368
11429
  "base": new HtmlTagDefinition({ isVoid: true }),
11369
11430
  "meta": new HtmlTagDefinition({ isVoid: true }),
11370
11431
  "area": new HtmlTagDefinition({ isVoid: true }),
@@ -11439,9 +11500,9 @@ function getHtmlTagDefinition(tagName) {
11439
11500
  contentType: { default: TagContentType.ESCAPABLE_RAW_TEXT, svg: TagContentType.PARSABLE_DATA }
11440
11501
  }),
11441
11502
  "textarea": new HtmlTagDefinition({ contentType: TagContentType.ESCAPABLE_RAW_TEXT, ignoreFirstLf: true })
11442
- };
11503
+ });
11443
11504
  new DomElementSchemaRegistry().allKnownElementNames().forEach((knownTagName) => {
11444
- if (!TAG_DEFINITIONS.hasOwnProperty(knownTagName) && getNsPrefix(knownTagName) === null) {
11505
+ if (!TAG_DEFINITIONS[knownTagName] && getNsPrefix(knownTagName) === null) {
11445
11506
  TAG_DEFINITIONS[knownTagName] = new HtmlTagDefinition({ canSelfClose: false });
11446
11507
  }
11447
11508
  });
@@ -13943,7 +14004,7 @@ var _Tokenizer = class {
13943
14004
  this.handleError(e);
13944
14005
  }
13945
14006
  }
13946
- this._beginToken(28);
14007
+ this._beginToken(29);
13947
14008
  this._endToken([]);
13948
14009
  }
13949
14010
  _getBlockName() {
@@ -13963,17 +14024,24 @@ var _Tokenizer = class {
13963
14024
  }
13964
14025
  _consumeBlockStart(start) {
13965
14026
  this._beginToken(24, start);
13966
- this._endToken([this._getBlockName()]);
14027
+ const startToken = this._endToken([this._getBlockName()]);
13967
14028
  if (this._cursor.peek() === $LPAREN) {
13968
14029
  this._cursor.advance();
13969
14030
  this._consumeBlockParameters();
13970
14031
  this._attemptCharCodeUntilFn(isNotWhitespace);
13971
- this._requireCharCode($RPAREN);
13972
- this._attemptCharCodeUntilFn(isNotWhitespace);
14032
+ if (this._attemptCharCode($RPAREN)) {
14033
+ this._attemptCharCodeUntilFn(isNotWhitespace);
14034
+ } else {
14035
+ startToken.type = 28;
14036
+ return;
14037
+ }
14038
+ }
14039
+ if (this._attemptCharCode($LBRACE)) {
14040
+ this._beginToken(25);
14041
+ this._endToken([]);
14042
+ } else {
14043
+ startToken.type = 28;
13973
14044
  }
13974
- this._beginToken(25);
13975
- this._requireCharCode($LBRACE);
13976
- this._endToken([]);
13977
14045
  }
13978
14046
  _consumeBlockEnd(start) {
13979
14047
  this._beginToken(26, start);
@@ -14805,7 +14873,7 @@ var _TreeBuilder = class {
14805
14873
  this._advance();
14806
14874
  }
14807
14875
  build() {
14808
- while (this._peek.type !== 28) {
14876
+ while (this._peek.type !== 29) {
14809
14877
  if (this._peek.type === 0 || this._peek.type === 4) {
14810
14878
  this._consumeStartTag(this._advance());
14811
14879
  } else if (this._peek.type === 3) {
@@ -14827,6 +14895,9 @@ var _TreeBuilder = class {
14827
14895
  } else if (this._peek.type === 26) {
14828
14896
  this._closeVoidElement();
14829
14897
  this._consumeBlockClose(this._advance());
14898
+ } else if (this._peek.type === 28) {
14899
+ this._closeVoidElement();
14900
+ this._consumeIncompleteBlock(this._advance());
14830
14901
  } else {
14831
14902
  this._advance();
14832
14903
  }
@@ -14891,7 +14962,7 @@ var _TreeBuilder = class {
14891
14962
  if (!exp)
14892
14963
  return null;
14893
14964
  const end = this._advance();
14894
- exp.push({ type: 28, parts: [], sourceSpan: end.sourceSpan });
14965
+ exp.push({ type: 29, parts: [], sourceSpan: end.sourceSpan });
14895
14966
  const expansionCaseParser = new _TreeBuilder(exp, this.getTagDefinition);
14896
14967
  expansionCaseParser.build();
14897
14968
  if (expansionCaseParser.errors.length > 0) {
@@ -14927,7 +14998,7 @@ var _TreeBuilder = class {
14927
14998
  return null;
14928
14999
  }
14929
15000
  }
14930
- if (this._peek.type === 28) {
15001
+ if (this._peek.type === 29) {
14931
15002
  this.errors.push(TreeError.create(null, start.sourceSpan, `Invalid ICU message. Missing '}'.`));
14932
15003
  return null;
14933
15004
  }
@@ -15079,15 +15150,26 @@ var _TreeBuilder = class {
15079
15150
  const startSpan = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);
15080
15151
  const block = new Block(token.parts[0], parameters, [], span, startSpan);
15081
15152
  this._pushContainer(block, false);
15082
- return block;
15083
15153
  }
15084
15154
  _consumeBlockClose(token) {
15085
- const previousContainer = this._getContainer();
15086
15155
  if (!this._popContainer(null, Block, token.sourceSpan)) {
15087
- 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.`;
15088
- this.errors.push(TreeError.create(null, token.sourceSpan, `Unexpected closing block. ${context}`));
15156
+ 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 "}" HTML entity instead.`));
15089
15157
  }
15090
15158
  }
15159
+ _consumeIncompleteBlock(token) {
15160
+ const parameters = [];
15161
+ while (this._peek.type === 27) {
15162
+ const paramToken = this._advance();
15163
+ parameters.push(new BlockParameter(paramToken.parts[0], paramToken.sourceSpan));
15164
+ }
15165
+ const end = this._peek.sourceSpan.fullStart;
15166
+ const span = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);
15167
+ const startSpan = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);
15168
+ const block = new Block(token.parts[0], parameters, [], span, startSpan);
15169
+ this._pushContainer(block, false);
15170
+ this._popContainer(null, Block, null);
15171
+ 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 "@" HTML entity instead.`));
15172
+ }
15091
15173
  _getContainer() {
15092
15174
  return this._containerStack.length > 0 ? this._containerStack[this._containerStack.length - 1] : null;
15093
15175
  }
@@ -15446,12 +15528,22 @@ function phaseI18nMessageExtraction(job) {
15446
15528
  const fileBasedI18nSuffix = job.relativeContextFilePath.replace(/[^A-Za-z0-9]/g, "_").toUpperCase() + "_";
15447
15529
  for (const unit of job.units) {
15448
15530
  for (const op of unit.create) {
15449
- if (op.kind === OpKind.I18nStart || op.kind === OpKind.I18n) {
15450
- const params = new Map([...op.params.entries()].sort());
15451
- const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX2));
15452
- const closureVar = i18nGenerateClosureVar(job.pool, op.message.id, fileBasedI18nSuffix, job.i18nUseExternalIds);
15453
- const statements = getTranslationDeclStmts(op.message, mainVar, closureVar, params, void 0);
15454
- unit.create.push(createExtractedMessageOp(op.xref, mainVar, statements));
15531
+ if (op.kind === OpKind.I18nStart) {
15532
+ if (op.xref === op.root) {
15533
+ const params = new Map([...op.params.entries()].sort());
15534
+ const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX2));
15535
+ const closureVar = i18nGenerateClosureVar(job.pool, op.message.id, fileBasedI18nSuffix, job.i18nUseExternalIds);
15536
+ let transformFn = void 0;
15537
+ if (op.needsPostprocessing) {
15538
+ const extraTransformFnParams = [];
15539
+ if (op.postprocessingParams.size > 0) {
15540
+ extraTransformFnParams.push(literalMap([...op.postprocessingParams.entries()].map(([key, value]) => ({ key, value, quoted: true }))));
15541
+ }
15542
+ transformFn = (expr) => importExpr(Identifiers.i18nPostprocess).callFn([expr, ...extraTransformFnParams]);
15543
+ }
15544
+ const statements = getTranslationDeclStmts(op.message, mainVar, closureVar, params, transformFn);
15545
+ unit.create.push(createExtractedMessageOp(op.xref, mainVar, statements));
15546
+ }
15455
15547
  }
15456
15548
  }
15457
15549
  }
@@ -15517,7 +15609,7 @@ function phaseI18nTextExtraction(job) {
15517
15609
  for (let i = 0; i < op.interpolation.expressions.length; i++) {
15518
15610
  const expr = op.interpolation.expressions[i];
15519
15611
  const placeholder = op.i18nPlaceholders[i];
15520
- ops.push(createI18nExpressionOp(i18nBlockId, expr, placeholder, (_a2 = expr.sourceSpan) != null ? _a2 : op.sourceSpan));
15612
+ ops.push(createI18nExpressionOp(i18nBlockId, expr, placeholder.name, I18nParamResolutionTime.Creation, (_a2 = expr.sourceSpan) != null ? _a2 : op.sourceSpan));
15521
15613
  }
15522
15614
  if (ops.length > 0) {
15523
15615
  }
@@ -15528,13 +15620,52 @@ function phaseI18nTextExtraction(job) {
15528
15620
  }
15529
15621
  }
15530
15622
 
15623
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/icu_extraction.mjs
15624
+ function phaseIcuExtraction(job) {
15625
+ for (const unit of job.units) {
15626
+ const icus = /* @__PURE__ */ new Map();
15627
+ let currentI18nId = null;
15628
+ for (const op of unit.create) {
15629
+ switch (op.kind) {
15630
+ case OpKind.I18nStart:
15631
+ currentI18nId = op.xref;
15632
+ break;
15633
+ case OpKind.I18nEnd:
15634
+ currentI18nId = null;
15635
+ break;
15636
+ case OpKind.Icu:
15637
+ if (currentI18nId === null) {
15638
+ throw Error("Unexpected ICU outside of an i18n block.");
15639
+ }
15640
+ icus.set(op.xref, { message: op.message, i18nBlockId: currentI18nId });
15641
+ OpList.remove(op);
15642
+ break;
15643
+ }
15644
+ }
15645
+ for (const op of unit.update) {
15646
+ switch (op.kind) {
15647
+ case OpKind.IcuUpdate:
15648
+ const { message, i18nBlockId } = icus.get(op.xref);
15649
+ const icuNode = message.nodes.find((n) => n instanceof Icu2);
15650
+ if (icuNode === void 0) {
15651
+ throw Error("Could not find ICU in i18n AST");
15652
+ }
15653
+ if (icuNode.expressionPlaceholder === void 0) {
15654
+ throw Error("ICU is missing an i18n placeholder");
15655
+ }
15656
+ OpList.replace(op, createI18nExpressionOp(i18nBlockId, new LexicalReadExpr(icuNode.expression), icuNode.expressionPlaceholder, I18nParamResolutionTime.Postproccessing, null));
15657
+ break;
15658
+ }
15659
+ }
15660
+ }
15661
+ }
15662
+
15531
15663
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/local_refs.mjs
15532
15664
  function phaseLocalRefs(job) {
15533
15665
  for (const unit of job.units) {
15534
15666
  for (const op of unit.create) {
15535
15667
  switch (op.kind) {
15536
15668
  case OpKind.ElementStart:
15537
- case OpKind.Element:
15538
15669
  case OpKind.Template:
15539
15670
  if (!Array.isArray(op.localRefs)) {
15540
15671
  throw new Error(`AssertionError: expected localRefs to be an array still`);
@@ -15564,7 +15695,7 @@ function phaseNamespace(job) {
15564
15695
  for (const unit of job.units) {
15565
15696
  let activeNamespace = Namespace.HTML;
15566
15697
  for (const op of unit.create) {
15567
- if (op.kind !== OpKind.Element && op.kind !== OpKind.ElementStart) {
15698
+ if (op.kind !== OpKind.ElementStart) {
15568
15699
  continue;
15569
15700
  }
15570
15701
  if (op.namespace !== activeNamespace) {
@@ -15683,7 +15814,8 @@ function addNamesToView(unit, baseName, state, compatibility) {
15683
15814
  if (op.slot === null) {
15684
15815
  throw new Error(`Expected slot to be assigned`);
15685
15816
  }
15686
- addNamesToView(childView, `${baseName}_${prefixWithNamespace(op.tag, op.namespace)}_${op.slot}`, state, compatibility);
15817
+ const tagToken = op.tag === null ? "" : "_" + prefixWithNamespace(op.tag, op.namespace);
15818
+ addNamesToView(childView, `${baseName}${tagToken}_${op.slot}`, state, compatibility);
15687
15819
  break;
15688
15820
  case OpKind.StyleProp:
15689
15821
  op.name = normalizeStylePropName(op.name);
@@ -15789,10 +15921,6 @@ function phaseNgContainer(job) {
15789
15921
  for (const unit of job.units) {
15790
15922
  const updatedElementXrefs = /* @__PURE__ */ new Set();
15791
15923
  for (const op of unit.create) {
15792
- if (op.kind === OpKind.Element && op.tag === CONTAINER_TAG) {
15793
- op.kind = OpKind.Container;
15794
- updatedElementXrefs.add(op.xref);
15795
- }
15796
15924
  if (op.kind === OpKind.ElementStart && op.tag === CONTAINER_TAG) {
15797
15925
  op.kind = OpKind.ContainerStart;
15798
15926
  updatedElementXrefs.add(op.xref);
@@ -16027,6 +16155,43 @@ function phasePipeVariadic(job) {
16027
16155
  }
16028
16156
  }
16029
16157
 
16158
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/propagate_i18n_blocks.mjs
16159
+ function phasePropagateI18nBlocks(job) {
16160
+ propagateI18nBlocksToTemplates(job.root, 0);
16161
+ }
16162
+ function propagateI18nBlocksToTemplates(unit, subTemplateIndex) {
16163
+ let i18nBlock = null;
16164
+ for (const op of unit.create) {
16165
+ switch (op.kind) {
16166
+ case OpKind.I18nStart:
16167
+ op.subTemplateIndex = subTemplateIndex === 0 ? null : subTemplateIndex;
16168
+ i18nBlock = op;
16169
+ break;
16170
+ case OpKind.I18nEnd:
16171
+ i18nBlock = null;
16172
+ break;
16173
+ case OpKind.Template:
16174
+ const templateView = unit.job.views.get(op.xref);
16175
+ if (op.i18nPlaceholder !== void 0) {
16176
+ if (i18nBlock === null) {
16177
+ throw Error("Expected template with i18n placeholder to be in an i18n block.");
16178
+ }
16179
+ subTemplateIndex++;
16180
+ wrapTemplateWithI18n(templateView, i18nBlock);
16181
+ }
16182
+ propagateI18nBlocksToTemplates(templateView, subTemplateIndex);
16183
+ }
16184
+ }
16185
+ }
16186
+ function wrapTemplateWithI18n(unit, parentI18n) {
16187
+ var _a2;
16188
+ if (((_a2 = unit.create.head.next) == null ? void 0 : _a2.kind) !== OpKind.I18nStart) {
16189
+ const id = unit.job.allocateXrefId();
16190
+ OpList.insertAfter(createI18nStartOp(id, parentI18n.message, parentI18n.root), unit.create.head);
16191
+ OpList.insertBefore(createI18nEndOp(id), unit.create.tail);
16192
+ }
16193
+ }
16194
+
16030
16195
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pure_function_extraction.mjs
16031
16196
  function phasePureFunctionExtraction(job) {
16032
16197
  for (const view of job.units) {
@@ -16152,7 +16317,7 @@ function elementContainerEnd() {
16152
16317
  }
16153
16318
  function template(slot, templateFnRef, decls, vars, tag, constIndex, sourceSpan) {
16154
16319
  const args = [literal(slot), templateFnRef, literal(decls), literal(vars)];
16155
- if (tag !== null) {
16320
+ if (tag !== null || constIndex !== null) {
16156
16321
  args.push(literal(tag));
16157
16322
  if (constIndex !== null) {
16158
16323
  args.push(literal(constIndex));
@@ -16258,11 +16423,19 @@ function projection(slot, projectionSlotIndex, attributes) {
16258
16423
  }
16259
16424
  return call(Identifiers.projection, args, null);
16260
16425
  }
16261
- function i18nStart(slot, constIndex) {
16262
- return call(Identifiers.i18nStart, [literal(slot), literal(constIndex)], null);
16426
+ function i18nStart(slot, constIndex, subTemplateIndex) {
16427
+ const args = [literal(slot), literal(constIndex)];
16428
+ if (subTemplateIndex !== null) {
16429
+ args.push(literal(subTemplateIndex));
16430
+ }
16431
+ return call(Identifiers.i18nStart, args, null);
16263
16432
  }
16264
- function i18n(slot, constIndex) {
16265
- return call(Identifiers.i18n, [literal(slot), literal(constIndex)], null);
16433
+ function i18n(slot, constIndex, subTemplateIndex) {
16434
+ const args = [literal(slot), literal(constIndex)];
16435
+ if (subTemplateIndex) {
16436
+ args.push(literal(subTemplateIndex));
16437
+ }
16438
+ return call(Identifiers.i18n, args, null);
16266
16439
  }
16267
16440
  function i18nEnd() {
16268
16441
  return call(Identifiers.i18nEnd, [], null);
@@ -16605,13 +16778,13 @@ function reifyCreateOperations(unit, ops) {
16605
16778
  OpList.replace(op, elementContainerEnd());
16606
16779
  break;
16607
16780
  case OpKind.I18nStart:
16608
- OpList.replace(op, i18nStart(op.slot, op.messageIndex));
16781
+ OpList.replace(op, i18nStart(op.slot, op.messageIndex, op.subTemplateIndex));
16609
16782
  break;
16610
16783
  case OpKind.I18nEnd:
16611
16784
  OpList.replace(op, i18nEnd());
16612
16785
  break;
16613
16786
  case OpKind.I18n:
16614
- OpList.replace(op, i18n(op.slot, op.messageIndex));
16787
+ OpList.replace(op, i18n(op.slot, op.messageIndex, op.subTemplateIndex));
16615
16788
  break;
16616
16789
  case OpKind.Template:
16617
16790
  if (!(unit instanceof ViewCompilationUnit)) {
@@ -16917,45 +17090,149 @@ function resolveDollarEvent(unit, ops) {
16917
17090
 
16918
17091
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_placeholders.mjs
16919
17092
  var ESCAPE = "\uFFFD";
17093
+ var ELEMENT_MARKER = "#";
17094
+ var TEMPLATE_MARKER = "*";
17095
+ var TAG_CLOSE_MARKER = "/";
17096
+ var CONTEXT_MARKER = ":";
17097
+ var LIST_START_MARKER = "[";
17098
+ var LIST_END_MARKER = "]";
17099
+ var LIST_DELIMITER = "|";
17100
+ var I18nParamValueFlags;
17101
+ (function(I18nParamValueFlags2) {
17102
+ I18nParamValueFlags2[I18nParamValueFlags2["None"] = 0] = "None";
17103
+ I18nParamValueFlags2[I18nParamValueFlags2["ElementTag"] = 1] = "ElementTag";
17104
+ I18nParamValueFlags2[I18nParamValueFlags2["TemplateTag"] = 2] = "TemplateTag";
17105
+ I18nParamValueFlags2[I18nParamValueFlags2["OpenTag"] = 4] = "OpenTag";
17106
+ I18nParamValueFlags2[I18nParamValueFlags2["CloseTag"] = 8] = "CloseTag";
17107
+ })(I18nParamValueFlags || (I18nParamValueFlags = {}));
17108
+ var I18nPlaceholderParams = class {
17109
+ constructor() {
17110
+ this.values = /* @__PURE__ */ new Map();
17111
+ }
17112
+ addValue(placeholder, value, subTemplateIndex, resolutionTime, flags) {
17113
+ var _a2;
17114
+ const placeholderValues = (_a2 = this.values.get(placeholder)) != null ? _a2 : [];
17115
+ placeholderValues.push({ value, subTemplateIndex, resolutionTime, flags });
17116
+ this.values.set(placeholder, placeholderValues);
17117
+ }
17118
+ saveToOp(op) {
17119
+ for (const [placeholder, placeholderValues] of this.values) {
17120
+ const creationValues = placeholderValues.filter(({ resolutionTime }) => resolutionTime === I18nParamResolutionTime.Creation);
17121
+ if (creationValues.length > 1) {
17122
+ op.needsPostprocessing = true;
17123
+ }
17124
+ const serializedCreationValues = this.serializeValues(creationValues);
17125
+ if (serializedCreationValues !== null) {
17126
+ op.params.set(placeholder, literal(serializedCreationValues));
17127
+ }
17128
+ const serializedPostprocessingValues = this.serializeValues(placeholderValues.filter(({ resolutionTime }) => resolutionTime === I18nParamResolutionTime.Postproccessing));
17129
+ if (serializedPostprocessingValues !== null) {
17130
+ op.needsPostprocessing = true;
17131
+ op.postprocessingParams.set(placeholder, literal(serializedPostprocessingValues));
17132
+ }
17133
+ }
17134
+ }
17135
+ merge(other) {
17136
+ for (const [placeholder, otherValues] of other.values) {
17137
+ const currentValues = this.values.get(placeholder) || [];
17138
+ const flags = otherValues[0].flags;
17139
+ if (flags & I18nParamValueFlags.CloseTag && !(flags & I18nParamValueFlags.OpenTag)) {
17140
+ this.values.set(placeholder, [...otherValues, ...currentValues]);
17141
+ } else {
17142
+ this.values.set(placeholder, [...currentValues, ...otherValues]);
17143
+ }
17144
+ }
17145
+ }
17146
+ serializeValues(values) {
17147
+ if (values.length === 0) {
17148
+ return null;
17149
+ }
17150
+ const serializedValues = values.map((value) => this.serializeValue(value));
17151
+ return serializedValues.length === 1 ? serializedValues[0] : `${LIST_START_MARKER}${serializedValues.join(LIST_DELIMITER)}${LIST_END_MARKER}`;
17152
+ }
17153
+ serializeValue(value) {
17154
+ let tagMarker = "";
17155
+ let closeMarker = "";
17156
+ if (value.flags & I18nParamValueFlags.ElementTag) {
17157
+ tagMarker = ELEMENT_MARKER;
17158
+ } else if (value.flags & I18nParamValueFlags.TemplateTag) {
17159
+ tagMarker = TEMPLATE_MARKER;
17160
+ }
17161
+ if (tagMarker !== "") {
17162
+ closeMarker = value.flags & I18nParamValueFlags.CloseTag ? TAG_CLOSE_MARKER : "";
17163
+ }
17164
+ const context = value.subTemplateIndex === null ? "" : `${CONTEXT_MARKER}${value.subTemplateIndex}`;
17165
+ if (value.flags & I18nParamValueFlags.OpenTag && value.flags & I18nParamValueFlags.CloseTag) {
17166
+ return `${ESCAPE}${tagMarker}${value.value}${context}${ESCAPE}${ESCAPE}${closeMarker}${tagMarker}${value.value}${context}${ESCAPE}`;
17167
+ }
17168
+ return `${ESCAPE}${closeMarker}${tagMarker}${value.value}${context}${ESCAPE}`;
17169
+ }
17170
+ };
16920
17171
  function phaseResolveI18nPlaceholders(job) {
17172
+ const params = /* @__PURE__ */ new Map();
17173
+ const i18nOps = /* @__PURE__ */ new Map();
17174
+ resolvePlaceholders(job, params, i18nOps);
17175
+ propagatePlaceholders(params, i18nOps);
17176
+ for (const [xref, i18nOpParams] of params) {
17177
+ i18nOpParams.saveToOp(i18nOps.get(xref));
17178
+ }
17179
+ for (const op of i18nOps.values()) {
17180
+ if (op.xref === op.root) {
17181
+ for (const placeholder in op.message.placeholders) {
17182
+ if (!op.params.has(placeholder) && !op.postprocessingParams.has(placeholder)) {
17183
+ throw Error(`Failed to resolve i18n placeholder: ${placeholder}`);
17184
+ }
17185
+ }
17186
+ }
17187
+ }
17188
+ }
17189
+ function resolvePlaceholders(job, params, i18nOps) {
16921
17190
  for (const unit of job.units) {
16922
- const i18nOps = /* @__PURE__ */ new Map();
16923
- let startTagSlots = /* @__PURE__ */ new Map();
16924
- let closeTagSlots = /* @__PURE__ */ new Map();
17191
+ const elements = /* @__PURE__ */ new Map();
16925
17192
  let currentI18nOp = null;
16926
17193
  for (const op of unit.create) {
16927
17194
  switch (op.kind) {
16928
17195
  case OpKind.I18nStart:
16929
- case OpKind.I18n:
16930
17196
  i18nOps.set(op.xref, op);
16931
17197
  currentI18nOp = op.kind === OpKind.I18nStart ? op : null;
16932
- startTagSlots = /* @__PURE__ */ new Map();
16933
- closeTagSlots = /* @__PURE__ */ new Map();
16934
17198
  break;
16935
17199
  case OpKind.I18nEnd:
16936
- if (currentI18nOp === null) {
16937
- throw Error("Missing corresponding i18n start op for i18n end op");
16938
- }
16939
- for (const [placeholder, slots] of startTagSlots) {
16940
- currentI18nOp.params.set(placeholder, serializeSlots(slots, true));
16941
- }
16942
- for (const [placeholder, slots] of closeTagSlots) {
16943
- currentI18nOp.params.set(placeholder, serializeSlots(slots, false));
16944
- }
16945
17200
  currentI18nOp = null;
16946
17201
  break;
16947
- case OpKind.Element:
16948
17202
  case OpKind.ElementStart:
16949
- if (op.i18nPlaceholder != void 0) {
17203
+ if (op.i18nPlaceholder !== void 0) {
16950
17204
  if (currentI18nOp === null) {
16951
17205
  throw Error("i18n tag placeholder should only occur inside an i18n block");
16952
17206
  }
16953
- if (!op.slot) {
16954
- throw Error("Slots should be allocated before i18n placeholder resolution");
16955
- }
17207
+ elements.set(op.xref, op);
16956
17208
  const { startName, closeName } = op.i18nPlaceholder;
16957
- addTagSlot(startTagSlots, startName, op.slot);
16958
- addTagSlot(closeTagSlots, closeName, op.slot);
17209
+ let flags = I18nParamValueFlags.ElementTag | I18nParamValueFlags.OpenTag;
17210
+ if (closeName === "") {
17211
+ flags |= I18nParamValueFlags.CloseTag;
17212
+ }
17213
+ addParam(params, currentI18nOp, startName, op.slot, currentI18nOp.subTemplateIndex, I18nParamResolutionTime.Creation, flags);
17214
+ }
17215
+ break;
17216
+ case OpKind.ElementEnd:
17217
+ const startOp = elements.get(op.xref);
17218
+ if (startOp && startOp.i18nPlaceholder !== void 0) {
17219
+ if (currentI18nOp === null) {
17220
+ throw Error("i18n tag placeholder should only occur inside an i18n block");
17221
+ }
17222
+ const { closeName } = startOp.i18nPlaceholder;
17223
+ if (closeName !== "") {
17224
+ addParam(params, currentI18nOp, closeName, startOp.slot, currentI18nOp.subTemplateIndex, I18nParamResolutionTime.Creation, I18nParamValueFlags.ElementTag | I18nParamValueFlags.CloseTag);
17225
+ }
17226
+ }
17227
+ break;
17228
+ case OpKind.Template:
17229
+ if (op.i18nPlaceholder !== void 0) {
17230
+ if (currentI18nOp === null) {
17231
+ throw Error("i18n tag placeholder should only occur inside an i18n block");
17232
+ }
17233
+ const subTemplateIndex = getSubTemplateIndexForTemplateTag(job, currentI18nOp, op);
17234
+ addParam(params, currentI18nOp, op.i18nPlaceholder.startName, op.slot, subTemplateIndex, I18nParamResolutionTime.Creation, I18nParamValueFlags.TemplateTag);
17235
+ addParam(params, currentI18nOp, op.i18nPlaceholder.closeName, op.slot, subTemplateIndex, I18nParamResolutionTime.Creation, I18nParamValueFlags.TemplateTag | I18nParamValueFlags.CloseTag);
16959
17236
  }
16960
17237
  break;
16961
17238
  }
@@ -16963,35 +17240,38 @@ function phaseResolveI18nPlaceholders(job) {
16963
17240
  const i18nBlockPlaceholderIndices = /* @__PURE__ */ new Map();
16964
17241
  for (const op of unit.update) {
16965
17242
  if (op.kind === OpKind.I18nExpression) {
16966
- const i18nOp = i18nOps.get(op.target);
16967
- let index = i18nBlockPlaceholderIndices.get(op.target) || 0;
17243
+ const i18nOp = i18nOps.get(op.owner);
17244
+ let index = i18nBlockPlaceholderIndices.get(op.owner) || 0;
16968
17245
  if (!i18nOp) {
16969
17246
  throw Error("Cannot find corresponding i18nStart for i18nExpr");
16970
17247
  }
16971
- i18nOp.params.set(op.i18nPlaceholder.name, literal(`${ESCAPE}${index++}${ESCAPE}`));
16972
- i18nBlockPlaceholderIndices.set(op.target, index);
16973
- }
16974
- }
16975
- for (const op of i18nOps.values()) {
16976
- for (const placeholder in op.message.placeholders) {
16977
- if (!op.params.has(placeholder)) {
16978
- throw Error(`Failed to resolve i18n placeholder: ${placeholder}`);
16979
- }
17248
+ addParam(params, i18nOp, op.i18nPlaceholder, index++, i18nOp.subTemplateIndex, op.resolutionTime);
17249
+ i18nBlockPlaceholderIndices.set(op.owner, index);
16980
17250
  }
16981
17251
  }
16982
17252
  }
16983
17253
  }
16984
- function addTagSlot(tagSlots, placeholder, slot) {
16985
- const slots = tagSlots.get(placeholder) || [];
16986
- slots.push(slot);
16987
- tagSlots.set(placeholder, slots);
17254
+ function addParam(params, i18nOp, placeholder, value, subTemplateIndex, resolutionTime, flags = I18nParamValueFlags.None) {
17255
+ const i18nOpParams = params.get(i18nOp.xref) || new I18nPlaceholderParams();
17256
+ i18nOpParams.addValue(placeholder, value, subTemplateIndex, resolutionTime, flags);
17257
+ params.set(i18nOp.xref, i18nOpParams);
16988
17258
  }
16989
- function serializeSlots(slots, start) {
16990
- const slotStrings = slots.map((slot) => `${ESCAPE}${start ? "" : "/"}#${slot}${ESCAPE}`);
16991
- if (slotStrings.length === 1) {
16992
- return literal(slotStrings[0]);
17259
+ function getSubTemplateIndexForTemplateTag(job, i18nOp, op) {
17260
+ for (const childOp of job.views.get(op.xref).create) {
17261
+ if (childOp.kind === OpKind.I18nStart) {
17262
+ return childOp.subTemplateIndex;
17263
+ }
17264
+ }
17265
+ return i18nOp.subTemplateIndex;
17266
+ }
17267
+ function propagatePlaceholders(params, i18nOps) {
17268
+ for (const [xref, opParams] of params) {
17269
+ const op = i18nOps.get(xref);
17270
+ if (op.xref !== op.root) {
17271
+ const rootParams = params.get(op.root) || new I18nPlaceholderParams();
17272
+ rootParams.merge(opParams);
17273
+ }
16993
17274
  }
16994
- return literal(`[${slotStrings.join("|")}]`);
16995
17275
  }
16996
17276
 
16997
17277
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_names.mjs
@@ -17090,7 +17370,8 @@ function phaseResolveSanitizers(job) {
17090
17370
  }
17091
17371
  }
17092
17372
  function isIframeElement(op) {
17093
- return (op.kind === OpKind.Element || op.kind === OpKind.ElementStart) && op.tag.toLowerCase() === "iframe";
17373
+ var _a2;
17374
+ return op.kind === OpKind.ElementStart && ((_a2 = op.tag) == null ? void 0 : _a2.toLowerCase()) === "iframe";
17094
17375
  }
17095
17376
 
17096
17377
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/save_restore_view.mjs
@@ -17482,6 +17763,30 @@ function allowConservativeInlining(decl, target) {
17482
17763
  }
17483
17764
  }
17484
17765
 
17766
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/wrap_icus.mjs
17767
+ function phaseWrapIcus(job) {
17768
+ for (const unit of job.units) {
17769
+ let currentI18nOp = null;
17770
+ for (const op of unit.create) {
17771
+ switch (op.kind) {
17772
+ case OpKind.I18nStart:
17773
+ currentI18nOp = op;
17774
+ break;
17775
+ case OpKind.I18nEnd:
17776
+ currentI18nOp = null;
17777
+ break;
17778
+ case OpKind.Icu:
17779
+ if (currentI18nOp === null) {
17780
+ const id = job.allocateXrefId();
17781
+ OpList.insertBefore(createI18nStartOp(id, op.message), op);
17782
+ OpList.insertAfter(createI18nEndOp(id), op);
17783
+ }
17784
+ break;
17785
+ }
17786
+ }
17787
+ }
17788
+ }
17789
+
17485
17790
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/emit.mjs
17486
17791
  var phases = [
17487
17792
  { kind: CompilationJobKind.Tmpl, fn: phaseRemoveContentSelectors },
@@ -17489,12 +17794,15 @@ var phases = [
17489
17794
  { kind: CompilationJobKind.Tmpl, fn: phaseNamespace },
17490
17795
  { kind: CompilationJobKind.Both, fn: phaseStyleBindingSpecialization },
17491
17796
  { kind: CompilationJobKind.Both, fn: phaseBindingSpecialization },
17797
+ { kind: CompilationJobKind.Tmpl, fn: phasePropagateI18nBlocks },
17798
+ { kind: CompilationJobKind.Tmpl, fn: phaseWrapIcus },
17492
17799
  { kind: CompilationJobKind.Both, fn: phaseAttributeExtraction },
17493
17800
  { kind: CompilationJobKind.Both, fn: phaseParseExtractedStyles },
17494
17801
  { kind: CompilationJobKind.Tmpl, fn: phaseRemoveEmptyBindings },
17495
17802
  { kind: CompilationJobKind.Tmpl, fn: phaseConditionals },
17496
17803
  { kind: CompilationJobKind.Tmpl, fn: phasePipeCreation },
17497
17804
  { kind: CompilationJobKind.Tmpl, fn: phaseI18nTextExtraction },
17805
+ { kind: CompilationJobKind.Tmpl, fn: phaseIcuExtraction },
17498
17806
  { kind: CompilationJobKind.Tmpl, fn: phaseApplyI18nExpressions },
17499
17807
  { kind: CompilationJobKind.Tmpl, fn: phasePipeVariadic },
17500
17808
  { kind: CompilationJobKind.Both, fn: phasePureLiteralStructures },
@@ -17516,6 +17824,7 @@ var phases = [
17516
17824
  { kind: CompilationJobKind.Tmpl, fn: phaseI18nConstCollection },
17517
17825
  { kind: CompilationJobKind.Tmpl, fn: phaseConstTraitCollection },
17518
17826
  { kind: CompilationJobKind.Both, fn: phaseConstCollection },
17827
+ { kind: CompilationJobKind.Tmpl, fn: phaseAssignI18nSlotDependencies },
17519
17828
  { kind: CompilationJobKind.Both, fn: phaseVarCounting },
17520
17829
  { kind: CompilationJobKind.Tmpl, fn: phaseGenerateAdvance },
17521
17830
  { kind: CompilationJobKind.Both, fn: phaseVariableOptimization },
@@ -17708,6 +18017,8 @@ function ingestNodes(unit, template2) {
17708
18017
  ingestSwitchBlock(unit, node);
17709
18018
  } else if (node instanceof DeferredBlock) {
17710
18019
  ingestDeferBlock(unit, node);
18020
+ } else if (node instanceof Icu) {
18021
+ ingestIcu(unit, node);
17711
18022
  } else {
17712
18023
  throw new Error(`Unsupported template node: ${node.constructor.name}`);
17713
18024
  }
@@ -17737,7 +18048,7 @@ function ingestElement(unit, element2) {
17737
18048
  }
17738
18049
  }
17739
18050
  function ingestTemplate(unit, tmpl) {
17740
- if (tmpl.i18n !== void 0 && !(tmpl.i18n instanceof Message)) {
18051
+ if (tmpl.i18n !== void 0 && !(tmpl.i18n instanceof Message || tmpl.i18n instanceof TagPlaceholder)) {
17741
18052
  throw Error(`Unhandled i18n metadata type for template: ${tmpl.i18n.constructor.name}`);
17742
18053
  }
17743
18054
  const childView = unit.job.allocateView(unit.xref);
@@ -17746,7 +18057,8 @@ function ingestTemplate(unit, tmpl) {
17746
18057
  if (tmpl.tagName) {
17747
18058
  [namespacePrefix, tagNameWithoutNamespace] = splitNsName(tmpl.tagName);
17748
18059
  }
17749
- const tplOp = createTemplateOp(childView.xref, tagNameWithoutNamespace != null ? tagNameWithoutNamespace : "ng-template", namespaceForKey(namespacePrefix), false, void 0, tmpl.startSourceSpan);
18060
+ const i18nPlaceholder = tmpl.i18n instanceof TagPlaceholder ? tmpl.i18n : void 0;
18061
+ const tplOp = createTemplateOp(childView.xref, tagNameWithoutNamespace, namespaceForKey(namespacePrefix), false, i18nPlaceholder, tmpl.startSourceSpan);
17750
18062
  unit.create.push(tplOp);
17751
18063
  ingestBindings(unit, tplOp, tmpl);
17752
18064
  ingestReferences(tplOp, tmpl);
@@ -17754,7 +18066,7 @@ function ingestTemplate(unit, tmpl) {
17754
18066
  for (const { name, value } of tmpl.variables) {
17755
18067
  childView.contextVariables.set(name, value);
17756
18068
  }
17757
- if (tmpl.i18n instanceof Message) {
18069
+ if (isPlainTemplate(tmpl) && tmpl.i18n instanceof Message) {
17758
18070
  const id = unit.job.allocateXrefId();
17759
18071
  OpList.insertAfter(createI18nStartOp(id, tmpl.i18n), childView.create.head);
17760
18072
  OpList.insertBefore(createI18nEndOp(id), childView.create.tail);
@@ -17771,6 +18083,7 @@ function ingestText(unit, text2) {
17771
18083
  unit.create.push(createTextOp(unit.job.allocateXrefId(), text2.value, text2.sourceSpan));
17772
18084
  }
17773
18085
  function ingestBoundText(unit, text2) {
18086
+ var _a2;
17774
18087
  let value = text2.value;
17775
18088
  if (value instanceof ASTWithSource) {
17776
18089
  value = value.ast;
@@ -17779,7 +18092,7 @@ function ingestBoundText(unit, text2) {
17779
18092
  throw new Error(`AssertionError: expected Interpolation for BoundText node, got ${value.constructor.name}`);
17780
18093
  }
17781
18094
  if (text2.i18n !== void 0 && !(text2.i18n instanceof Container)) {
17782
- throw Error(`Unhandled i18n metadata type for text interpolation: ${text2.i18n.constructor.name}`);
18095
+ throw Error(`Unhandled i18n metadata type for text interpolation: ${(_a2 = text2.i18n) == null ? void 0 : _a2.constructor.name}`);
17783
18096
  }
17784
18097
  const i18nPlaceholders = text2.i18n instanceof Container ? text2.i18n.children.filter((node) => node instanceof Placeholder) : [];
17785
18098
  const textXref = unit.job.allocateXrefId();
@@ -17863,6 +18176,16 @@ function ingestDeferBlock(unit, deferBlock) {
17863
18176
  const deferOnOp = createDeferOnOp(unit.job.allocateXrefId(), null);
17864
18177
  unit.create.push(deferOnOp);
17865
18178
  }
18179
+ function ingestIcu(unit, icu) {
18180
+ var _a2;
18181
+ if (icu.i18n instanceof Message) {
18182
+ const xref = unit.job.allocateXrefId();
18183
+ unit.create.push(createIcuOp(xref, icu.i18n, null));
18184
+ unit.update.push(createIcuUpdateOp(xref, null));
18185
+ } else {
18186
+ throw Error(`Unhandled i18n metadata type for ICU: ${(_a2 = icu.i18n) == null ? void 0 : _a2.constructor.name}`);
18187
+ }
18188
+ }
17866
18189
  function convertAst(ast, job, baseSourceSpan) {
17867
18190
  if (ast instanceof ASTWithSource) {
17868
18191
  return convertAst(ast.ast, job, baseSourceSpan);
@@ -17925,13 +18248,15 @@ function convertAst(ast, job, baseSourceSpan) {
17925
18248
  throw new Error(`Unhandled expression type: ${ast.constructor.name}`);
17926
18249
  }
17927
18250
  }
17928
- function ingestBindings(unit, op, element2) {
18251
+ function isPlainTemplate(tmpl) {
17929
18252
  var _a2;
18253
+ return splitNsName((_a2 = tmpl.tagName) != null ? _a2 : "")[1] === "ng-template";
18254
+ }
18255
+ function ingestBindings(unit, op, element2) {
17930
18256
  let flags = BindingFlags.None;
17931
- const isPlainTemplate = element2 instanceof Template && splitNsName((_a2 = element2.tagName) != null ? _a2 : "")[1] === "ng-template";
17932
18257
  if (element2 instanceof Template) {
17933
18258
  flags |= BindingFlags.OnNgTemplateElement;
17934
- if (isPlainTemplate) {
18259
+ if (element2 instanceof Template && isPlainTemplate(element2)) {
17935
18260
  flags |= BindingFlags.BindingTargetsTemplate;
17936
18261
  }
17937
18262
  const templateAttrFlags = flags | BindingFlags.BindingTargetsTemplate | BindingFlags.IsStructuralTemplateAttribute;
@@ -17956,7 +18281,7 @@ function ingestBindings(unit, op, element2) {
17956
18281
  throw Error("Animation listener should have a phase");
17957
18282
  }
17958
18283
  }
17959
- if (element2 instanceof Template && !isPlainTemplate) {
18284
+ if (element2 instanceof Template && !isPlainTemplate(element2)) {
17960
18285
  unit.create.push(createExtractedAttributeOp(op.xref, BindingKind.Property, output.name, null));
17961
18286
  continue;
17962
18287
  }
@@ -18855,10 +19180,10 @@ function normalizeNgContentSelect(selectAttr) {
18855
19180
 
18856
19181
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/r3_control_flow.mjs
18857
19182
  var FOR_LOOP_EXPRESSION_PATTERN = /^\s*([0-9A-Za-z_$]*)\s+of\s+(.*)/;
18858
- var FOR_LOOP_TRACK_PATTERN = /^track\s+(.*)/;
19183
+ var FOR_LOOP_TRACK_PATTERN = /^track\s+([\S\s]*)/;
18859
19184
  var CONDITIONAL_ALIAS_PATTERN = /^as\s+(.*)/;
18860
19185
  var ELSE_IF_PATTERN = /^else[^\S\r\n]+if/;
18861
- var FOR_LOOP_LET_PATTERN = /^let\s+(.*)/;
19186
+ var FOR_LOOP_LET_PATTERN = /^let\s+([\S\s]*)/;
18862
19187
  var ALLOWED_FOR_LOOP_LET_VARIABLES = /* @__PURE__ */ new Set(["$index", "$first", "$last", "$even", "$odd", "$count"]);
18863
19188
  function isConnectedForLoopBlock(name) {
18864
19189
  return name === "empty";
@@ -18869,30 +19194,36 @@ function isConnectedIfLoopBlock(name) {
18869
19194
  function createIfBlock(ast, connectedBlocks, visitor, bindingParser) {
18870
19195
  const errors = validateIfConnectedBlocks(connectedBlocks);
18871
19196
  const branches = [];
18872
- if (errors.length > 0) {
18873
- return { node: null, errors };
18874
- }
18875
19197
  const mainBlockParams = parseConditionalBlockParameters(ast, errors, bindingParser);
18876
19198
  if (mainBlockParams !== null) {
18877
- branches.push(new IfBlockBranch(mainBlockParams.expression, visitAll2(visitor, ast.children, ast.children), mainBlockParams.expressionAlias, ast.sourceSpan, ast.startSourceSpan));
19199
+ branches.push(new IfBlockBranch(mainBlockParams.expression, visitAll2(visitor, ast.children, ast.children), mainBlockParams.expressionAlias, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan));
18878
19200
  }
18879
19201
  for (const block of connectedBlocks) {
18880
- const children = visitAll2(visitor, block.children, block.children);
18881
19202
  if (ELSE_IF_PATTERN.test(block.name)) {
18882
19203
  const params = parseConditionalBlockParameters(block, errors, bindingParser);
18883
19204
  if (params !== null) {
18884
- branches.push(new IfBlockBranch(params.expression, children, params.expressionAlias, block.sourceSpan, block.startSourceSpan));
19205
+ const children = visitAll2(visitor, block.children, block.children);
19206
+ branches.push(new IfBlockBranch(params.expression, children, params.expressionAlias, block.sourceSpan, block.startSourceSpan, block.endSourceSpan));
18885
19207
  }
18886
19208
  } else if (block.name === "else") {
18887
- branches.push(new IfBlockBranch(null, children, null, block.sourceSpan, block.startSourceSpan));
19209
+ const children = visitAll2(visitor, block.children, block.children);
19210
+ branches.push(new IfBlockBranch(null, children, null, block.sourceSpan, block.startSourceSpan, block.endSourceSpan));
18888
19211
  }
18889
19212
  }
19213
+ const ifBlockStartSourceSpan = branches.length > 0 ? branches[0].startSourceSpan : ast.startSourceSpan;
19214
+ const ifBlockEndSourceSpan = branches.length > 0 ? branches[branches.length - 1].endSourceSpan : ast.endSourceSpan;
19215
+ let wholeSourceSpan = ast.sourceSpan;
19216
+ const lastBranch = branches[branches.length - 1];
19217
+ if (lastBranch !== void 0) {
19218
+ wholeSourceSpan = new ParseSourceSpan(ifBlockStartSourceSpan.start, lastBranch.sourceSpan.end);
19219
+ }
18890
19220
  return {
18891
- node: new IfBlock(branches, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan),
19221
+ node: new IfBlock(branches, wholeSourceSpan, ast.startSourceSpan, ifBlockEndSourceSpan),
18892
19222
  errors
18893
19223
  };
18894
19224
  }
18895
19225
  function createForLoop(ast, connectedBlocks, visitor, bindingParser) {
19226
+ var _a2, _b2;
18896
19227
  const errors = [];
18897
19228
  const params = parseForLoopParameters(ast, errors, bindingParser);
18898
19229
  let node = null;
@@ -18904,7 +19235,7 @@ function createForLoop(ast, connectedBlocks, visitor, bindingParser) {
18904
19235
  } else if (block.parameters.length > 0) {
18905
19236
  errors.push(new ParseError(block.sourceSpan, "@empty block cannot have parameters"));
18906
19237
  } else {
18907
- empty = new ForLoopBlockEmpty(visitAll2(visitor, block.children, block.children), block.sourceSpan, block.startSourceSpan);
19238
+ empty = new ForLoopBlockEmpty(visitAll2(visitor, block.children, block.children), block.sourceSpan, block.startSourceSpan, block.endSourceSpan);
18908
19239
  }
18909
19240
  } else {
18910
19241
  errors.push(new ParseError(block.sourceSpan, `Unrecognized @for loop block "${block.name}"`));
@@ -18914,25 +19245,29 @@ function createForLoop(ast, connectedBlocks, visitor, bindingParser) {
18914
19245
  if (params.trackBy === null) {
18915
19246
  errors.push(new ParseError(ast.sourceSpan, '@for loop must have a "track" expression'));
18916
19247
  } else {
18917
- node = new ForLoopBlock(params.itemName, params.expression, params.trackBy, params.context, visitAll2(visitor, ast.children, ast.children), empty, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
19248
+ const endSpan = (_a2 = empty == null ? void 0 : empty.endSourceSpan) != null ? _a2 : ast.endSourceSpan;
19249
+ const sourceSpan = new ParseSourceSpan(ast.sourceSpan.start, (_b2 = endSpan == null ? void 0 : endSpan.end) != null ? _b2 : ast.sourceSpan.end);
19250
+ node = new ForLoopBlock(params.itemName, params.expression, params.trackBy, params.context, visitAll2(visitor, ast.children, ast.children), empty, sourceSpan, ast.sourceSpan, ast.startSourceSpan, endSpan);
18918
19251
  }
18919
19252
  }
18920
19253
  return { node, errors };
18921
19254
  }
18922
19255
  function createSwitchBlock(ast, visitor, bindingParser) {
18923
19256
  const errors = validateSwitchBlock(ast);
18924
- if (errors.length > 0) {
18925
- return { node: null, errors };
18926
- }
18927
- const primaryExpression = parseBlockParameterToBinding(ast.parameters[0], bindingParser);
19257
+ const primaryExpression = ast.parameters.length > 0 ? parseBlockParameterToBinding(ast.parameters[0], bindingParser) : bindingParser.parseBinding("", false, ast.sourceSpan, 0);
18928
19258
  const cases = [];
19259
+ const unknownBlocks = [];
18929
19260
  let defaultCase = null;
18930
19261
  for (const node of ast.children) {
18931
19262
  if (!(node instanceof Block)) {
18932
19263
  continue;
18933
19264
  }
19265
+ if ((node.name !== "case" || node.parameters.length === 0) && node.name !== "default") {
19266
+ unknownBlocks.push(new UnknownBlock(node.name, node.sourceSpan));
19267
+ continue;
19268
+ }
18934
19269
  const expression = node.name === "case" ? parseBlockParameterToBinding(node.parameters[0], bindingParser) : null;
18935
- const ast2 = new SwitchBlockCase(expression, visitAll2(visitor, node.children, node.children), node.sourceSpan, node.startSourceSpan);
19270
+ const ast2 = new SwitchBlockCase(expression, visitAll2(visitor, node.children, node.children), node.sourceSpan, node.startSourceSpan, node.endSourceSpan);
18936
19271
  if (expression === null) {
18937
19272
  defaultCase = ast2;
18938
19273
  } else {
@@ -18943,7 +19278,7 @@ function createSwitchBlock(ast, visitor, bindingParser) {
18943
19278
  cases.push(defaultCase);
18944
19279
  }
18945
19280
  return {
18946
- node: new SwitchBlock(primaryExpression, cases, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan),
19281
+ node: new SwitchBlock(primaryExpression, cases, unknownBlocks, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan),
18947
19282
  errors
18948
19283
  };
18949
19284
  }
@@ -18985,7 +19320,8 @@ function parseForLoopParameters(block, errors, bindingParser) {
18985
19320
  }
18986
19321
  for (const variableName of ALLOWED_FOR_LOOP_LET_VARIABLES) {
18987
19322
  if (!result.context.hasOwnProperty(variableName)) {
18988
- result.context[variableName] = new Variable(variableName, variableName, block.startSourceSpan, block.startSourceSpan);
19323
+ const emptySpanAfterForBlockStart = new ParseSourceSpan(block.startSourceSpan.end, block.startSourceSpan.end);
19324
+ result.context[variableName] = new Variable(variableName, variableName, emptySpanAfterForBlockStart, emptySpanAfterForBlockStart);
18989
19325
  }
18990
19326
  }
18991
19327
  return result;
@@ -19393,7 +19729,15 @@ function createDeferredBlock(ast, connectedBlocks, visitor, bindingParser) {
19393
19729
  const errors = [];
19394
19730
  const { placeholder, loading, error: error2 } = parseConnectedBlocks(connectedBlocks, errors, visitor);
19395
19731
  const { triggers, prefetchTriggers } = parsePrimaryTriggers(ast.parameters, bindingParser, errors, placeholder);
19396
- const node = new DeferredBlock(visitAll2(visitor, ast.children, ast.children), triggers, prefetchTriggers, placeholder, loading, error2, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
19732
+ let lastEndSourceSpan = ast.endSourceSpan;
19733
+ let endOfLastSourceSpan = ast.sourceSpan.end;
19734
+ if (connectedBlocks.length > 0) {
19735
+ const lastConnectedBlock = connectedBlocks[connectedBlocks.length - 1];
19736
+ lastEndSourceSpan = lastConnectedBlock.endSourceSpan;
19737
+ endOfLastSourceSpan = lastConnectedBlock.sourceSpan.end;
19738
+ }
19739
+ const mainDeferredSourceSpan = new ParseSourceSpan(ast.sourceSpan.start, endOfLastSourceSpan);
19740
+ const node = new DeferredBlock(visitAll2(visitor, ast.children, ast.children), triggers, prefetchTriggers, placeholder, loading, error2, mainDeferredSourceSpan, ast.sourceSpan, ast.startSourceSpan, lastEndSourceSpan);
19397
19741
  return { node, errors };
19398
19742
  }
19399
19743
  function parseConnectedBlocks(connectedBlocks, errors, visitor) {
@@ -19723,7 +20067,10 @@ var HtmlAstToIvyAst = class {
19723
20067
  } else {
19724
20068
  errorMessage = `Unrecognized block @${block.name}.`;
19725
20069
  }
19726
- result = { node: null, errors: [new ParseError(block.sourceSpan, errorMessage)] };
20070
+ result = {
20071
+ node: new UnknownBlock(block.name, block.sourceSpan),
20072
+ errors: [new ParseError(block.sourceSpan, errorMessage)]
20073
+ };
19727
20074
  break;
19728
20075
  }
19729
20076
  this.errors.push(...result.errors);
@@ -19934,9 +20281,6 @@ function textContents(node) {
19934
20281
  }
19935
20282
  }
19936
20283
 
19937
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/block_syntax_switch.mjs
19938
- var BLOCK_SYNTAX_ENABLED_DEFAULT = true;
19939
-
19940
20284
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/i18n/context.mjs
19941
20285
  var TagType;
19942
20286
  (function(TagType2) {
@@ -20184,6 +20528,7 @@ var TemplateDefinitionBuilder = class {
20184
20528
  this.visitIfBlockBranch = invalid;
20185
20529
  this.visitSwitchBlockCase = invalid;
20186
20530
  this.visitForLoopBlockEmpty = invalid;
20531
+ this.visitUnknownBlock = invalid;
20187
20532
  this._bindingScope = parentBindingScope.nestedScope(level);
20188
20533
  this.fileBasedI18nSuffix = relativeContextFilePath.replace(/[^A-Za-z0-9]/g, "_") + "_";
20189
20534
  this._valueConverter = new ValueConverter(constantPool, () => this.allocateDataSlot(), (numSlots) => this.allocatePureFunctionSlots(numSlots), (name, localName, slot, value) => {
@@ -20724,13 +21069,10 @@ var TemplateDefinitionBuilder = class {
20724
21069
  visitIfBlock(block) {
20725
21070
  this.allocateBindingSlots(null);
20726
21071
  const branchData = block.branches.map(({ expression, expressionAlias, children, sourceSpan }) => {
20727
- const processedExpression = expression === null ? null : expression.visit(this._valueConverter);
20728
21072
  const variables = expressionAlias !== null ? [new Variable(expressionAlias.name, DIRECT_CONTEXT_REFERENCE, expressionAlias.sourceSpan, expressionAlias.keySpan)] : void 0;
20729
- return {
20730
- index: this.createEmbeddedTemplateFn(null, children, "_Conditional", sourceSpan, variables),
20731
- expression: processedExpression,
20732
- alias: expressionAlias
20733
- };
21073
+ const index = this.createEmbeddedTemplateFn(null, children, "_Conditional", sourceSpan, variables);
21074
+ const processedExpression = expression === null ? null : expression.visit(this._valueConverter);
21075
+ return { index, expression: processedExpression, alias: expressionAlias };
20734
21076
  });
20735
21077
  const containerIndex = branchData[0].index;
20736
21078
  const paramsCallback = () => {
@@ -20761,15 +21103,14 @@ var TemplateDefinitionBuilder = class {
20761
21103
  this.updateInstructionWithAdvance(containerIndex, block.branches[0].sourceSpan, Identifiers.conditional, paramsCallback);
20762
21104
  }
20763
21105
  visitSwitchBlock(block) {
20764
- const blockExpression = block.expression.visit(this._valueConverter);
20765
- this.allocateBindingSlots(null);
20766
21106
  const caseData = block.cases.map((currentCase) => {
20767
- return {
20768
- index: this.createEmbeddedTemplateFn(null, currentCase.children, "_Case", currentCase.sourceSpan),
20769
- expression: currentCase.expression === null ? null : currentCase.expression.visit(this._valueConverter)
20770
- };
21107
+ const index = this.createEmbeddedTemplateFn(null, currentCase.children, "_Case", currentCase.sourceSpan);
21108
+ const expression = currentCase.expression === null ? null : currentCase.expression.visit(this._valueConverter);
21109
+ return { index, expression };
20771
21110
  });
20772
21111
  const containerIndex = caseData[0].index;
21112
+ const blockExpression = block.expression.visit(this._valueConverter);
21113
+ this.allocateBindingSlots(null);
20773
21114
  this.updateInstructionWithAdvance(containerIndex, block.sourceSpan, Identifiers.conditional, () => {
20774
21115
  const generateCases = (caseIndex) => {
20775
21116
  if (caseIndex > caseData.length - 1) {
@@ -20807,11 +21148,12 @@ var TemplateDefinitionBuilder = class {
20807
21148
  literal(placeholderIndex),
20808
21149
  literal(errorIndex),
20809
21150
  (loadingConsts == null ? void 0 : loadingConsts.length) ? this.addToConsts(literalArr(loadingConsts)) : TYPED_NULL_EXPR,
20810
- placeholderConsts ? this.addToConsts(placeholderConsts) : TYPED_NULL_EXPR
21151
+ placeholderConsts ? this.addToConsts(placeholderConsts) : TYPED_NULL_EXPR,
21152
+ (loadingConsts == null ? void 0 : loadingConsts.length) || placeholderConsts ? importExpr(Identifiers.deferEnableTimerScheduling) : TYPED_NULL_EXPR
20811
21153
  ]));
21154
+ this.allocateDataSlot();
20812
21155
  this.createDeferTriggerInstructions(deferredIndex, triggers, metadata, false);
20813
21156
  this.createDeferTriggerInstructions(deferredIndex, prefetchTriggers, metadata, true);
20814
- this.allocateDataSlot();
20815
21157
  }
20816
21158
  createDeferredDepsFunction(name, metadata) {
20817
21159
  if (metadata.deps.length === 0) {
@@ -20881,10 +21223,12 @@ var TemplateDefinitionBuilder = class {
20881
21223
  visitForLoopBlock(block) {
20882
21224
  const blockIndex = this.allocateDataSlot();
20883
21225
  const primaryData = this.prepareEmbeddedTemplateFn(block.children, "_For", [block.item, block.contextVariables.$index, block.contextVariables.$count]);
20884
- const emptyData = block.empty === null ? null : this.prepareEmbeddedTemplateFn(block.empty.children, "_ForEmpty");
20885
21226
  const { expression: trackByExpression, usesComponentInstance: trackByUsesComponentInstance } = this.createTrackByFunction(block);
20886
- const value = block.expression.visit(this._valueConverter);
20887
- this.allocateBindingSlots(value);
21227
+ let emptyData = null;
21228
+ if (block.empty !== null) {
21229
+ emptyData = this.prepareEmbeddedTemplateFn(block.empty.children, "_ForEmpty");
21230
+ this.allocateBindingSlots(null);
21231
+ }
20888
21232
  this.registerComputedLoopVariables(block, primaryData.scope);
20889
21233
  this.creationInstruction(block.sourceSpan, Identifiers.repeaterCreate, () => {
20890
21234
  const params = [
@@ -20901,6 +21245,7 @@ var TemplateDefinitionBuilder = class {
20901
21245
  }
20902
21246
  return params;
20903
21247
  });
21248
+ const value = block.expression.visit(this._valueConverter);
20904
21249
  this.updateInstruction(block.sourceSpan, Identifiers.repeater, () => [literal(blockIndex), this.convertPropertyBinding(value)]);
20905
21250
  }
20906
21251
  registerComputedLoopVariables(block, bindingScope) {
@@ -21567,7 +21912,7 @@ function parseTemplate(template2, templateUrl, options = {}) {
21567
21912
  leadingTriviaChars: LEADING_TRIVIA_CHARS
21568
21913
  }, options), {
21569
21914
  tokenizeExpansionForms: true,
21570
- tokenizeBlocks: (_a2 = options.enableBlockSyntax) != null ? _a2 : BLOCK_SYNTAX_ENABLED_DEFAULT
21915
+ tokenizeBlocks: (_a2 = options.enableBlockSyntax) != null ? _a2 : true
21571
21916
  }));
21572
21917
  if (!options.alwaysAttemptHtmlToR3AstConversion && parseResult.errors && parseResult.errors.length > 0) {
21573
21918
  const parsedTemplate2 = {
@@ -22420,6 +22765,8 @@ var Scope = class {
22420
22765
  }
22421
22766
  visitDeferredTrigger(trigger) {
22422
22767
  }
22768
+ visitUnknownBlock(block) {
22769
+ }
22423
22770
  maybeDeclare(thing) {
22424
22771
  if (!this.namedEntities.has(thing.name)) {
22425
22772
  this.namedEntities.set(thing.name, thing);
@@ -22578,6 +22925,8 @@ var DirectiveBinder = class {
22578
22925
  }
22579
22926
  visitDeferredTrigger(trigger) {
22580
22927
  }
22928
+ visitUnknownBlock(block) {
22929
+ }
22581
22930
  };
22582
22931
  var TemplateBinder = class extends RecursiveAstVisitor {
22583
22932
  constructor(bindings, symbols, usedPipes, eagerPipes, deferBlocks, nestingLevel, scope, rootNode, level) {
@@ -22665,6 +23014,10 @@ var TemplateBinder = class extends RecursiveAstVisitor {
22665
23014
  }
22666
23015
  visitTextAttribute(attribute2) {
22667
23016
  }
23017
+ visitUnknownBlock(block) {
23018
+ }
23019
+ visitDeferredTrigger() {
23020
+ }
22668
23021
  visitIcu(icu) {
22669
23022
  Object.keys(icu.vars).forEach((key) => icu.vars[key].visit(this));
22670
23023
  Object.keys(icu.placeholders).forEach((key) => icu.placeholders[key].visit(this));
@@ -22676,17 +23029,15 @@ var TemplateBinder = class extends RecursiveAstVisitor {
22676
23029
  event.handler.visit(this);
22677
23030
  }
22678
23031
  visitDeferredBlock(deferred) {
23032
+ var _a2, _b2;
22679
23033
  this.deferBlocks.add(deferred);
22680
23034
  this.ingestScopedNode(deferred);
23035
+ (_a2 = deferred.triggers.when) == null ? void 0 : _a2.value.visit(this);
23036
+ (_b2 = deferred.prefetchTriggers.when) == null ? void 0 : _b2.value.visit(this);
22681
23037
  deferred.placeholder && this.visitNode(deferred.placeholder);
22682
23038
  deferred.loading && this.visitNode(deferred.loading);
22683
23039
  deferred.error && this.visitNode(deferred.error);
22684
23040
  }
22685
- visitDeferredTrigger(trigger) {
22686
- if (trigger instanceof BoundDeferredTrigger) {
22687
- trigger.value.visit(this);
22688
- }
22689
- }
22690
23041
  visitDeferredBlockPlaceholder(block) {
22691
23042
  this.ingestScopedNode(block);
22692
23043
  }
@@ -23446,7 +23797,7 @@ function publishFacade(global) {
23446
23797
  }
23447
23798
 
23448
23799
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/version.mjs
23449
- var VERSION2 = new Version("17.0.0-next.7");
23800
+ var VERSION2 = new Version("17.0.0-rc.0");
23450
23801
 
23451
23802
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
23452
23803
  var _VisitorMode;
@@ -23497,6 +23848,7 @@ var REPLACEMENTS2 = {
23497
23848
  "@": "&#64;",
23498
23849
  "}": "&#125;"
23499
23850
  };
23851
+ var CONTROL_FLOW_CHARS_PATTERN = /@|}/;
23500
23852
  var AnalyzedFile = class {
23501
23853
  constructor() {
23502
23854
  __publicField(this, "ranges", []);
@@ -23546,30 +23898,36 @@ function analyze(sourceFile, analyzedFiles) {
23546
23898
  }
23547
23899
  }
23548
23900
  function migrateTemplate(template2) {
23901
+ if (!CONTROL_FLOW_CHARS_PATTERN.test(template2)) {
23902
+ return null;
23903
+ }
23904
+ let rootNodes = null;
23549
23905
  try {
23550
23906
  const parsed = new HtmlParser().parse(template2, "", {
23551
23907
  tokenizeExpansionForms: true,
23552
23908
  tokenizeBlocks: false
23553
23909
  });
23554
- if (parsed.errors && parsed.errors.length > 0) {
23555
- return null;
23556
- }
23557
- let result = template2;
23558
- const visitor = new TextRangeCollector();
23559
- visitAll2(visitor, parsed.rootNodes);
23560
- const sortedRanges = visitor.textRanges.sort(([aStart], [bStart]) => bStart - aStart);
23561
- for (const [start, end] of sortedRanges) {
23562
- const text2 = result.slice(start, end);
23563
- let replaced = "";
23564
- for (const char of text2) {
23565
- replaced += REPLACEMENTS2[char] || char;
23566
- }
23567
- result = result.slice(0, start) + replaced + result.slice(end);
23910
+ if (parsed.errors.length === 0) {
23911
+ rootNodes = parsed.rootNodes;
23568
23912
  }
23569
- return result;
23570
23913
  } catch (e) {
23914
+ }
23915
+ if (rootNodes === null) {
23571
23916
  return null;
23572
23917
  }
23918
+ let result = template2;
23919
+ const visitor = new TextRangeCollector();
23920
+ visitAll2(visitor, rootNodes);
23921
+ const sortedRanges = visitor.textRanges.sort(([aStart], [bStart]) => bStart - aStart);
23922
+ for (const [start, end] of sortedRanges) {
23923
+ const text2 = result.slice(start, end);
23924
+ let replaced = "";
23925
+ for (const char of text2) {
23926
+ replaced += REPLACEMENTS2[char] || char;
23927
+ }
23928
+ result = result.slice(0, start) + replaced + result.slice(end);
23929
+ }
23930
+ return result;
23573
23931
  }
23574
23932
  var TextRangeCollector = class extends RecursiveVisitor {
23575
23933
  constructor() {
@@ -23610,6 +23968,9 @@ function runBlockTemplateEntitiesMigration(tree, tsconfigPath, basePath) {
23610
23968
  for (const [path2, file] of analysis) {
23611
23969
  const ranges = file.getSortedRanges();
23612
23970
  const relativePath = (0, import_path3.relative)(basePath, path2);
23971
+ if (!tree.exists(relativePath)) {
23972
+ continue;
23973
+ }
23613
23974
  const content = tree.readText(relativePath);
23614
23975
  const update = tree.beginUpdate(relativePath);
23615
23976
  for (const [start, end] of ranges) {
@@ -23626,13 +23987,6 @@ function runBlockTemplateEntitiesMigration(tree, tsconfigPath, basePath) {
23626
23987
  }
23627
23988
  // Annotate the CommonJS export names for ESM import in node:
23628
23989
  0 && (module.exports = {});
23629
- /*!
23630
- * @license
23631
- * Copyright Google LLC All Rights Reserved.
23632
- *
23633
- * Use of this source code is governed by an MIT-style license that can be
23634
- * found in the LICENSE file at https://angular.io/license
23635
- */
23636
23990
  /**
23637
23991
  * @license
23638
23992
  * Copyright Google LLC All Rights Reserved.