@angular/core 17.0.7 → 17.0.9

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 (63) hide show
  1. package/esm2022/src/application/application_ref.mjs +24 -12
  2. package/esm2022/src/application/create_application.mjs +2 -2
  3. package/esm2022/src/change_detection/flags.mjs +16 -0
  4. package/esm2022/src/change_detection/scheduling/ng_zone_scheduling.mjs +164 -0
  5. package/esm2022/src/change_detection/scheduling/zoneless_scheduling.mjs +13 -0
  6. package/esm2022/src/change_detection/scheduling/zoneless_scheduling_impl.mjs +56 -0
  7. package/esm2022/src/core.mjs +2 -2
  8. package/esm2022/src/core_private_export.mjs +5 -2
  9. package/esm2022/src/core_render3_private_export.mjs +1 -2
  10. package/esm2022/src/defer/dom_triggers.mjs +1 -5
  11. package/esm2022/src/di/inject_switch.mjs +2 -3
  12. package/esm2022/src/di/r3_injector.mjs +8 -6
  13. package/esm2022/src/errors.mjs +1 -1
  14. package/esm2022/src/event_emitter.mjs +1 -2
  15. package/esm2022/src/hydration/utils.mjs +2 -2
  16. package/esm2022/src/hydration/views.mjs +2 -2
  17. package/esm2022/src/linker/view_container_ref.mjs +2 -2
  18. package/esm2022/src/pending_tasks.mjs +57 -0
  19. package/esm2022/src/platform/platform_ref.mjs +2 -2
  20. package/esm2022/src/render3/after_render_hooks.mjs +16 -34
  21. package/esm2022/src/render3/collect_native_nodes.mjs +2 -3
  22. package/esm2022/src/render3/component_ref.mjs +13 -9
  23. package/esm2022/src/render3/debug/injector_profiler.mjs +1 -1
  24. package/esm2022/src/render3/errors_di.mjs +4 -3
  25. package/esm2022/src/render3/instructions/advance.mjs +2 -2
  26. package/esm2022/src/render3/instructions/change_detection.mjs +1 -6
  27. package/esm2022/src/render3/instructions/mark_view_dirty.mjs +4 -3
  28. package/esm2022/src/render3/instructions/shared.mjs +4 -3
  29. package/esm2022/src/render3/interfaces/container.mjs +1 -6
  30. package/esm2022/src/render3/interfaces/view.mjs +1 -1
  31. package/esm2022/src/render3/node_manipulation.mjs +8 -8
  32. package/esm2022/src/render3/reactivity/effect.mjs +8 -6
  33. package/esm2022/src/render3/styling/style_binding_list.mjs +4 -4
  34. package/esm2022/src/render3/util/discovery_utils.mjs +3 -3
  35. package/esm2022/src/render3/util/global_utils.mjs +28 -28
  36. package/esm2022/src/render3/util/injector_discovery_utils.mjs +1 -1
  37. package/esm2022/src/render3/util/injector_utils.mjs +6 -5
  38. package/esm2022/src/render3/util/view_traversal_utils.mjs +3 -12
  39. package/esm2022/src/render3/util/view_utils.mjs +36 -19
  40. package/esm2022/src/render3/view_ref.mjs +2 -1
  41. package/esm2022/src/version.mjs +6 -5
  42. package/esm2022/src/zone/ng_zone.mjs +1 -61
  43. package/esm2022/testing/src/component_fixture.mjs +62 -58
  44. package/esm2022/testing/src/logger.mjs +3 -3
  45. package/fesm2022/core.mjs +374 -309
  46. package/fesm2022/core.mjs.map +1 -1
  47. package/fesm2022/primitives/signals.mjs +1 -1
  48. package/fesm2022/rxjs-interop.mjs +1 -1
  49. package/fesm2022/testing.mjs +62 -58
  50. package/fesm2022/testing.mjs.map +1 -1
  51. package/index.d.ts +405 -46
  52. package/package.json +1 -1
  53. package/primitives/signals/index.d.ts +1 -1
  54. package/rxjs-interop/index.d.ts +1 -1
  55. package/schematics/migrations/block-template-entities/bundle.js +332 -330
  56. package/schematics/migrations/block-template-entities/bundle.js.map +4 -4
  57. package/schematics/ng-generate/control-flow-migration/bundle.js +498 -397
  58. package/schematics/ng-generate/control-flow-migration/bundle.js.map +4 -4
  59. package/schematics/ng-generate/standalone-migration/bundle.js +349 -323
  60. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  61. package/testing/index.d.ts +6 -2
  62. package/esm2022/src/change_detection/scheduling.mjs +0 -103
  63. package/esm2022/src/initial_render_pending_tasks.mjs +0 -49
@@ -1874,7 +1874,7 @@ var ConstantPool = class {
1874
1874
  }))));
1875
1875
  }
1876
1876
  }
1877
- getSharedFunctionReference(fn2, prefix) {
1877
+ getSharedFunctionReference(fn2, prefix, useUniqueName = true) {
1878
1878
  var _a2;
1879
1879
  const isArrow = fn2 instanceof ArrowFunctionExpr;
1880
1880
  for (const current of this.statements) {
@@ -1885,7 +1885,7 @@ var ConstantPool = class {
1885
1885
  return variable(current.name);
1886
1886
  }
1887
1887
  }
1888
- const name = this.uniqueName(prefix);
1888
+ const name = useUniqueName ? this.uniqueName(prefix) : prefix;
1889
1889
  this.statements.push(fn2.toDeclStmt(name, StmtModifier.Final));
1890
1890
  return variable(name);
1891
1891
  }
@@ -3506,13 +3506,17 @@ var TagContentType;
3506
3506
  TagContentType2[TagContentType2["ESCAPABLE_RAW_TEXT"] = 1] = "ESCAPABLE_RAW_TEXT";
3507
3507
  TagContentType2[TagContentType2["PARSABLE_DATA"] = 2] = "PARSABLE_DATA";
3508
3508
  })(TagContentType || (TagContentType = {}));
3509
- function splitNsName(elementName) {
3509
+ function splitNsName(elementName, fatal = true) {
3510
3510
  if (elementName[0] != ":") {
3511
3511
  return [null, elementName];
3512
3512
  }
3513
3513
  const colonIndex = elementName.indexOf(":", 1);
3514
3514
  if (colonIndex === -1) {
3515
- throw new Error(`Unsupported format "${elementName}" expecting ":namespace:name"`);
3515
+ if (fatal) {
3516
+ throw new Error(`Unsupported format "${elementName}" expecting ":namespace:name"`);
3517
+ } else {
3518
+ return [null, elementName];
3519
+ }
3516
3520
  }
3517
3521
  return [elementName.slice(1, colonIndex), elementName.slice(colonIndex + 1)];
3518
3522
  }
@@ -4019,28 +4023,6 @@ var BlockPlaceholder = class {
4019
4023
  return visitor.visitBlockPlaceholder(this, context);
4020
4024
  }
4021
4025
  };
4022
- var RecurseVisitor = class {
4023
- visitText(text2, context) {
4024
- }
4025
- visitContainer(container, context) {
4026
- container.children.forEach((child) => child.visit(this));
4027
- }
4028
- visitIcu(icu, context) {
4029
- Object.keys(icu.cases).forEach((k) => {
4030
- icu.cases[k].visit(this);
4031
- });
4032
- }
4033
- visitTagPlaceholder(ph, context) {
4034
- ph.children.forEach((child) => child.visit(this));
4035
- }
4036
- visitPlaceholder(ph, context) {
4037
- }
4038
- visitIcuPlaceholder(ph, context) {
4039
- }
4040
- visitBlockPlaceholder(ph, context) {
4041
- ph.children.forEach((child) => child.visit(this));
4042
- }
4043
- };
4044
4026
  function serializeMessage(messageNodes) {
4045
4027
  const visitor = new LocalizeMessageStringVisitor();
4046
4028
  const str = messageNodes.map((n) => n.visit(visitor)).join("");
@@ -7108,8 +7090,9 @@ var OpKind;
7108
7090
  OpKind2[OpKind2["I18nApply"] = 40] = "I18nApply";
7109
7091
  OpKind2[OpKind2["IcuStart"] = 41] = "IcuStart";
7110
7092
  OpKind2[OpKind2["IcuEnd"] = 42] = "IcuEnd";
7111
- OpKind2[OpKind2["I18nContext"] = 43] = "I18nContext";
7112
- OpKind2[OpKind2["I18nAttributes"] = 44] = "I18nAttributes";
7093
+ OpKind2[OpKind2["IcuPlaceholder"] = 43] = "IcuPlaceholder";
7094
+ OpKind2[OpKind2["I18nContext"] = 44] = "I18nContext";
7095
+ OpKind2[OpKind2["I18nAttributes"] = 45] = "I18nAttributes";
7113
7096
  })(OpKind || (OpKind = {}));
7114
7097
  var ExpressionKind;
7115
7098
  (function(ExpressionKind2) {
@@ -7207,13 +7190,6 @@ var DeferTriggerKind;
7207
7190
  DeferTriggerKind2[DeferTriggerKind2["Interaction"] = 4] = "Interaction";
7208
7191
  DeferTriggerKind2[DeferTriggerKind2["Viewport"] = 5] = "Viewport";
7209
7192
  })(DeferTriggerKind || (DeferTriggerKind = {}));
7210
- var DerivedRepeaterVarIdentity;
7211
- (function(DerivedRepeaterVarIdentity2) {
7212
- DerivedRepeaterVarIdentity2[DerivedRepeaterVarIdentity2["First"] = 0] = "First";
7213
- DerivedRepeaterVarIdentity2[DerivedRepeaterVarIdentity2["Last"] = 1] = "Last";
7214
- DerivedRepeaterVarIdentity2[DerivedRepeaterVarIdentity2["Even"] = 2] = "Even";
7215
- DerivedRepeaterVarIdentity2[DerivedRepeaterVarIdentity2["Odd"] = 3] = "Odd";
7216
- })(DerivedRepeaterVarIdentity || (DerivedRepeaterVarIdentity = {}));
7217
7193
  var I18nContextKind;
7218
7194
  (function(I18nContextKind2) {
7219
7195
  I18nContextKind2[I18nContextKind2["RootI18n"] = 0] = "RootI18n";
@@ -7368,10 +7344,11 @@ function createClassMapOp(xref, expression, sourceSpan) {
7368
7344
  sourceSpan
7369
7345
  }, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
7370
7346
  }
7371
- function createAttributeOp(target, name, expression, securityContext, isTextAttribute, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan) {
7347
+ function createAttributeOp(target, namespace, name, expression, securityContext, isTextAttribute, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan) {
7372
7348
  return __spreadValues(__spreadValues(__spreadValues({
7373
7349
  kind: OpKind.Attribute,
7374
7350
  target,
7351
+ namespace,
7375
7352
  name,
7376
7353
  expression,
7377
7354
  securityContext,
@@ -7413,15 +7390,15 @@ function createRepeaterOp(repeaterCreate2, targetSlot, collection, sourceSpan) {
7413
7390
  }, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
7414
7391
  }
7415
7392
  function createDeferWhenOp(target, expr, prefetch, sourceSpan) {
7416
- return __spreadValues(__spreadValues({
7393
+ return __spreadValues(__spreadValues(__spreadValues({
7417
7394
  kind: OpKind.DeferWhen,
7418
7395
  target,
7419
7396
  expr,
7420
7397
  prefetch,
7421
7398
  sourceSpan
7422
- }, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
7399
+ }, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS);
7423
7400
  }
7424
- function createI18nExpressionOp(context, target, i18nOwner, handle, expression, i18nPlaceholder, resolutionTime, usage, name, sourceSpan) {
7401
+ function createI18nExpressionOp(context, target, i18nOwner, handle, expression, icuPlaceholder, i18nPlaceholder, resolutionTime, usage, name, sourceSpan) {
7425
7402
  return __spreadValues(__spreadValues(__spreadValues({
7426
7403
  kind: OpKind.I18nExpression,
7427
7404
  context,
@@ -7429,6 +7406,7 @@ function createI18nExpressionOp(context, target, i18nOwner, handle, expression,
7429
7406
  i18nOwner,
7430
7407
  handle,
7431
7408
  expression,
7409
+ icuPlaceholder,
7432
7410
  i18nPlaceholder,
7433
7411
  resolutionTime,
7434
7412
  usage,
@@ -8025,27 +8003,6 @@ var ConditionalCaseExpr = class extends ExpressionBase {
8025
8003
  }
8026
8004
  }
8027
8005
  };
8028
- var DerivedRepeaterVarExpr = class extends ExpressionBase {
8029
- constructor(xref, identity) {
8030
- super();
8031
- this.xref = xref;
8032
- this.identity = identity;
8033
- this.kind = ExpressionKind.DerivedRepeaterVar;
8034
- }
8035
- transformInternalExpressions(transform2, flags) {
8036
- }
8037
- visitExpression(visitor, context) {
8038
- }
8039
- isEquivalent(e) {
8040
- return e instanceof DerivedRepeaterVarExpr && e.identity === this.identity && e.xref === this.xref;
8041
- }
8042
- isConstant() {
8043
- return false;
8044
- }
8045
- clone() {
8046
- return new DerivedRepeaterVarExpr(this.xref, this.identity);
8047
- }
8048
- };
8049
8006
  var ConstCollectedExpr = class extends ExpressionBase {
8050
8007
  constructor(expr) {
8051
8008
  super();
@@ -8161,6 +8118,9 @@ function transformExpressionsInOp(op, transform2, flags) {
8161
8118
  if (op.placeholderConfig !== null) {
8162
8119
  op.placeholderConfig = transformExpressionsInExpression(op.placeholderConfig, transform2, flags);
8163
8120
  }
8121
+ if (op.resolverFn !== null) {
8122
+ op.resolverFn = transformExpressionsInExpression(op.resolverFn, transform2, flags);
8123
+ }
8164
8124
  break;
8165
8125
  case OpKind.I18nMessage:
8166
8126
  for (const [placeholder, expr] of op.params) {
@@ -8197,6 +8157,7 @@ function transformExpressionsInOp(op, transform2, flags) {
8197
8157
  case OpKind.Template:
8198
8158
  case OpKind.Text:
8199
8159
  case OpKind.I18nAttributes:
8160
+ case OpKind.IcuPlaceholder:
8200
8161
  break;
8201
8162
  default:
8202
8163
  throw new Error(`AssertionError: transformExpressionsInOp doesn't handle ${OpKind[op.kind]}`);
@@ -8496,7 +8457,7 @@ var elementContainerOpKinds = /* @__PURE__ */ new Set([
8496
8457
  function isElementOrContainerOp(op) {
8497
8458
  return elementContainerOpKinds.has(op.kind);
8498
8459
  }
8499
- function createElementStartOp(tag, xref, namespace, i18nPlaceholder, sourceSpan) {
8460
+ function createElementStartOp(tag, xref, namespace, i18nPlaceholder, startSourceSpan, wholeSourceSpan) {
8500
8461
  return __spreadValues(__spreadValues({
8501
8462
  kind: OpKind.ElementStart,
8502
8463
  xref,
@@ -8507,10 +8468,11 @@ function createElementStartOp(tag, xref, namespace, i18nPlaceholder, sourceSpan)
8507
8468
  nonBindable: false,
8508
8469
  namespace,
8509
8470
  i18nPlaceholder,
8510
- sourceSpan
8471
+ startSourceSpan,
8472
+ wholeSourceSpan
8511
8473
  }, TRAIT_CONSUMES_SLOT), NEW_OP);
8512
8474
  }
8513
- function createTemplateOp(xref, templateKind, tag, functionNameSuffix, namespace, i18nPlaceholder, sourceSpan) {
8475
+ function createTemplateOp(xref, templateKind, tag, functionNameSuffix, namespace, i18nPlaceholder, startSourceSpan, wholeSourceSpan) {
8514
8476
  return __spreadValues(__spreadValues({
8515
8477
  kind: OpKind.Template,
8516
8478
  xref,
@@ -8525,11 +8487,12 @@ function createTemplateOp(xref, templateKind, tag, functionNameSuffix, namespace
8525
8487
  nonBindable: false,
8526
8488
  namespace,
8527
8489
  i18nPlaceholder,
8528
- sourceSpan
8490
+ startSourceSpan,
8491
+ wholeSourceSpan
8529
8492
  }, TRAIT_CONSUMES_SLOT), NEW_OP);
8530
8493
  }
8531
- function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, i18nPlaceholder, emptyI18nPlaceholder, sourceSpan) {
8532
- return __spreadProps(__spreadValues(__spreadValues({
8494
+ function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, i18nPlaceholder, emptyI18nPlaceholder, startSourceSpan, wholeSourceSpan) {
8495
+ return __spreadProps(__spreadValues(__spreadValues(__spreadValues({
8533
8496
  kind: OpKind.RepeaterCreate,
8534
8497
  attributes: null,
8535
8498
  xref: primaryView,
@@ -8548,8 +8511,9 @@ function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, i1
8548
8511
  usesComponentInstance: false,
8549
8512
  i18nPlaceholder,
8550
8513
  emptyI18nPlaceholder,
8551
- sourceSpan
8552
- }, TRAIT_CONSUMES_SLOT), NEW_OP), {
8514
+ startSourceSpan,
8515
+ wholeSourceSpan
8516
+ }, TRAIT_CONSUMES_SLOT), NEW_OP), TRAIT_CONSUMES_VARS), {
8553
8517
  numSlotsUsed: emptyView === null ? 2 : 3
8554
8518
  });
8555
8519
  }
@@ -8572,12 +8536,13 @@ function createEnableBindingsOp(xref) {
8572
8536
  xref
8573
8537
  }, NEW_OP);
8574
8538
  }
8575
- function createTextOp(xref, initialValue, sourceSpan) {
8539
+ function createTextOp(xref, initialValue, icuPlaceholder, sourceSpan) {
8576
8540
  return __spreadValues(__spreadValues({
8577
8541
  kind: OpKind.Text,
8578
8542
  xref,
8579
8543
  handle: new SlotHandle(),
8580
8544
  initialValue,
8545
+ icuPlaceholder,
8581
8546
  sourceSpan
8582
8547
  }, TRAIT_CONSUMES_SLOT), NEW_OP);
8583
8548
  }
@@ -8633,11 +8598,12 @@ function createProjectionOp(xref, selector, i18nPlaceholder, attributes, sourceS
8633
8598
  sourceSpan
8634
8599
  }, NEW_OP), TRAIT_CONSUMES_SLOT);
8635
8600
  }
8636
- function createExtractedAttributeOp(target, bindingKind, name, expression, i18nContext, i18nMessage, securityContext) {
8601
+ function createExtractedAttributeOp(target, bindingKind, namespace, name, expression, i18nContext, i18nMessage, securityContext) {
8637
8602
  return __spreadValues({
8638
8603
  kind: OpKind.ExtractedAttribute,
8639
8604
  target,
8640
8605
  bindingKind,
8606
+ namespace,
8641
8607
  name,
8642
8608
  expression,
8643
8609
  i18nContext,
@@ -8728,6 +8694,15 @@ function createIcuEndOp(xref) {
8728
8694
  xref
8729
8695
  }, NEW_OP);
8730
8696
  }
8697
+ function createIcuPlaceholderOp(xref, name, strings) {
8698
+ return __spreadValues({
8699
+ kind: OpKind.IcuPlaceholder,
8700
+ xref,
8701
+ name,
8702
+ strings,
8703
+ expressionPlaceholders: []
8704
+ }, NEW_OP);
8705
+ }
8731
8706
  function createI18nContextOp(contextKind, xref, i18nBlock, message, sourceSpan) {
8732
8707
  if (i18nBlock === null && contextKind !== I18nContextKind.Attr) {
8733
8708
  throw new Error("AssertionError: i18nBlock must be provided for non-attribute contexts.");
@@ -9018,6 +8993,7 @@ function extractAttributes(job) {
9018
8993
  createExtractedAttributeOp(
9019
8994
  op.target,
9020
8995
  bindingKind,
8996
+ null,
9021
8997
  op.name,
9022
8998
  null,
9023
8999
  null,
@@ -9034,6 +9010,7 @@ function extractAttributes(job) {
9034
9010
  OpList.insertBefore(createExtractedAttributeOp(
9035
9011
  op.target,
9036
9012
  BindingKind.Property,
9013
+ null,
9037
9014
  op.name,
9038
9015
  null,
9039
9016
  null,
@@ -9047,6 +9024,7 @@ function extractAttributes(job) {
9047
9024
  const extractedAttributeOp = createExtractedAttributeOp(
9048
9025
  op.target,
9049
9026
  BindingKind.Property,
9027
+ null,
9050
9028
  op.name,
9051
9029
  null,
9052
9030
  null,
@@ -9075,18 +9053,12 @@ function extractAttributeOp(unit, op, elements) {
9075
9053
  if (op.expression instanceof Interpolation2) {
9076
9054
  return;
9077
9055
  }
9078
- let extractable = op.expression.isConstant();
9056
+ let extractable = op.isTextAttribute || op.expression.isConstant();
9079
9057
  if (unit.job.compatibility === CompatibilityMode.TemplateDefinitionBuilder) {
9080
- extractable = isStringLiteral(op.expression);
9081
- if (op.name === "style" || op.name === "class") {
9082
- extractable && (extractable = op.isTextAttribute);
9083
- }
9084
- if (unit.job.kind === CompilationJobKind.Host) {
9085
- extractable && (extractable = op.isTextAttribute);
9086
- }
9058
+ extractable && (extractable = op.isTextAttribute);
9087
9059
  }
9088
9060
  if (extractable) {
9089
- const extractedAttributeOp = createExtractedAttributeOp(op.target, op.isStructuralTemplateAttribute ? BindingKind.Template : BindingKind.Attribute, op.name, op.expression, op.i18nContext, op.i18nMessage, op.securityContext);
9061
+ const extractedAttributeOp = createExtractedAttributeOp(op.target, op.isStructuralTemplateAttribute ? BindingKind.Template : BindingKind.Attribute, op.namespace, op.name, op.expression, op.i18nContext, op.i18nMessage, op.securityContext);
9090
9062
  if (unit.job.kind === CompilationJobKind.Host) {
9091
9063
  unit.create.push(extractedAttributeOp);
9092
9064
  } else {
@@ -9127,7 +9099,8 @@ function specializeBindings(job) {
9127
9099
  const target = lookupElement2(elements, op.target);
9128
9100
  target.nonBindable = true;
9129
9101
  } else {
9130
- OpList.replace(op, createAttributeOp(op.target, op.name, op.expression, op.securityContext, op.isTextAttribute, op.isStructuralTemplateAttribute, op.templateKind, op.i18nMessage, op.sourceSpan));
9102
+ const [namespace, name] = splitNsName(op.name);
9103
+ OpList.replace(op, createAttributeOp(op.target, namespace, name, op.expression, op.securityContext, op.isTextAttribute, op.isStructuralTemplateAttribute, op.templateKind, op.i18nMessage, op.sourceSpan));
9131
9104
  }
9132
9105
  break;
9133
9106
  case BindingKind.Property:
@@ -9318,9 +9291,9 @@ function collectElementConsts(job) {
9318
9291
  for (const unit of job.units) {
9319
9292
  for (const op of unit.create) {
9320
9293
  if (op.kind === OpKind.ExtractedAttribute) {
9321
- const attributes = allElementAttributes.get(op.target) || new ElementAttributes();
9294
+ const attributes = allElementAttributes.get(op.target) || new ElementAttributes(job.compatibility);
9322
9295
  allElementAttributes.set(op.target, attributes);
9323
- attributes.add(op.bindingKind, op.name, op.expression, op.trustedValueFn);
9296
+ attributes.add(op.bindingKind, op.name, op.expression, op.namespace, op.trustedValueFn);
9324
9297
  OpList.remove(op);
9325
9298
  }
9326
9299
  }
@@ -9353,11 +9326,6 @@ function collectElementConsts(job) {
9353
9326
  }
9354
9327
  var FLYWEIGHT_ARRAY = Object.freeze([]);
9355
9328
  var ElementAttributes = class {
9356
- constructor() {
9357
- this.known = /* @__PURE__ */ new Set();
9358
- this.byKind = /* @__PURE__ */ new Map();
9359
- this.projectAs = null;
9360
- }
9361
9329
  get attributes() {
9362
9330
  var _a2;
9363
9331
  return (_a2 = this.byKind.get(BindingKind.Attribute)) != null ? _a2 : FLYWEIGHT_ARRAY;
@@ -9382,12 +9350,28 @@ var ElementAttributes = class {
9382
9350
  var _a2;
9383
9351
  return (_a2 = this.byKind.get(BindingKind.I18n)) != null ? _a2 : FLYWEIGHT_ARRAY;
9384
9352
  }
9385
- add(kind, name, value, trustedValueFn) {
9353
+ constructor(compatibility) {
9354
+ this.compatibility = compatibility;
9355
+ this.known = /* @__PURE__ */ new Map();
9356
+ this.byKind = /* @__PURE__ */ new Map();
9357
+ this.projectAs = null;
9358
+ }
9359
+ isKnown(kind, name, value) {
9386
9360
  var _a2;
9387
- if (this.known.has(name)) {
9361
+ const nameToValue = (_a2 = this.known.get(kind)) != null ? _a2 : /* @__PURE__ */ new Set();
9362
+ this.known.set(kind, nameToValue);
9363
+ if (nameToValue.has(name)) {
9364
+ return true;
9365
+ }
9366
+ nameToValue.add(name);
9367
+ return false;
9368
+ }
9369
+ add(kind, name, value, namespace, trustedValueFn) {
9370
+ var _a2;
9371
+ const allowDuplicates = this.compatibility === CompatibilityMode.TemplateDefinitionBuilder && (kind === BindingKind.Attribute || kind === BindingKind.ClassName || kind === BindingKind.StyleProperty);
9372
+ if (!allowDuplicates && this.isKnown(kind, name, value)) {
9388
9373
  return;
9389
9374
  }
9390
- this.known.add(name);
9391
9375
  if (name === "ngProjectAs") {
9392
9376
  if (value === null || !(value instanceof LiteralExpr) || value.value == null || typeof ((_a2 = value.value) == null ? void 0 : _a2.toString()) !== "string") {
9393
9377
  throw Error("ngProjectAs must have a string literal value");
@@ -9395,7 +9379,7 @@ var ElementAttributes = class {
9395
9379
  this.projectAs = value.value.toString();
9396
9380
  }
9397
9381
  const array = this.arrayFor(kind);
9398
- array.push(...getAttributeNameLiterals(name));
9382
+ array.push(...getAttributeNameLiterals(namespace, name));
9399
9383
  if (kind === BindingKind.Attribute || kind === BindingKind.StyleProperty) {
9400
9384
  if (value === null) {
9401
9385
  throw Error("Attribute, i18n attribute, & style element attributes must have a value");
@@ -9417,15 +9401,10 @@ var ElementAttributes = class {
9417
9401
  return this.byKind.get(kind);
9418
9402
  }
9419
9403
  };
9420
- function getAttributeNameLiterals(name) {
9421
- const [attributeNamespace, attributeName] = splitNsName(name);
9422
- const nameLiteral = literal(attributeName);
9423
- if (attributeNamespace) {
9424
- return [
9425
- literal(0),
9426
- literal(attributeNamespace),
9427
- nameLiteral
9428
- ];
9404
+ function getAttributeNameLiterals(namespace, name) {
9405
+ const nameLiteral = literal(name);
9406
+ if (namespace) {
9407
+ return [literal(0), literal(namespace), nameLiteral];
9429
9408
  }
9430
9409
  return [nameLiteral];
9431
9410
  }
@@ -9485,7 +9464,7 @@ function convertI18nBindings(job) {
9485
9464
  if (op.expression.i18nPlaceholders.length !== op.expression.expressions.length) {
9486
9465
  throw new Error(`AssertionError: An i18n attribute binding instruction requires the same number of expressions and placeholders, but found ${op.expression.i18nPlaceholders.length} placeholders and ${op.expression.expressions.length} expressions`);
9487
9466
  }
9488
- ops.push(createI18nExpressionOp(op.i18nContext, i18nAttributesForElem.target, i18nAttributesForElem.xref, i18nAttributesForElem.handle, expr, op.expression.i18nPlaceholders[i], I18nParamResolutionTime.Creation, I18nExpressionFor.I18nAttribute, op.name, op.sourceSpan));
9467
+ ops.push(createI18nExpressionOp(op.i18nContext, i18nAttributesForElem.target, i18nAttributesForElem.xref, i18nAttributesForElem.handle, expr, null, op.expression.i18nPlaceholders[i], I18nParamResolutionTime.Creation, I18nExpressionFor.I18nAttribute, op.name, op.sourceSpan));
9489
9468
  }
9490
9469
  OpList.replaceWithMany(op, ops);
9491
9470
  break;
@@ -9516,7 +9495,11 @@ function createDeferDepsFns(job) {
9516
9495
  if (op.handle.slot === null) {
9517
9496
  throw new Error("AssertionError: slot must be assigned bfore extracting defer deps functions");
9518
9497
  }
9519
- op.resolverFn = job.pool.getSharedFunctionReference(depsFnExpr, `${job.componentName}_Defer_${op.handle.slot}_DepsFn`);
9498
+ op.resolverFn = job.pool.getSharedFunctionReference(
9499
+ depsFnExpr,
9500
+ `${job.componentName}_Defer_${op.handle.slot}_DepsFn`,
9501
+ false
9502
+ );
9520
9503
  }
9521
9504
  }
9522
9505
  }
@@ -9524,62 +9507,99 @@ function createDeferDepsFns(job) {
9524
9507
 
9525
9508
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/create_i18n_contexts.mjs
9526
9509
  function createI18nContexts(job) {
9527
- const rootContexts = /* @__PURE__ */ new Map();
9528
- let currentI18nOp = null;
9529
- let xref;
9530
- const messageToContext = /* @__PURE__ */ new Map();
9510
+ const attrContextByMessage = /* @__PURE__ */ new Map();
9511
+ for (const unit of job.units) {
9512
+ for (const op of unit.ops()) {
9513
+ switch (op.kind) {
9514
+ case OpKind.Binding:
9515
+ case OpKind.Property:
9516
+ case OpKind.Attribute:
9517
+ case OpKind.ExtractedAttribute:
9518
+ if (op.i18nMessage === null) {
9519
+ continue;
9520
+ }
9521
+ if (!attrContextByMessage.has(op.i18nMessage)) {
9522
+ const i18nContext = createI18nContextOp(I18nContextKind.Attr, job.allocateXrefId(), null, op.i18nMessage, null);
9523
+ unit.create.push(i18nContext);
9524
+ attrContextByMessage.set(op.i18nMessage, i18nContext.xref);
9525
+ }
9526
+ op.i18nContext = attrContextByMessage.get(op.i18nMessage);
9527
+ break;
9528
+ }
9529
+ }
9530
+ }
9531
+ const blockContextByI18nBlock = /* @__PURE__ */ new Map();
9531
9532
  for (const unit of job.units) {
9532
9533
  for (const op of unit.create) {
9533
9534
  switch (op.kind) {
9534
9535
  case OpKind.I18nStart:
9535
- currentI18nOp = op;
9536
9536
  if (op.xref === op.root) {
9537
- xref = job.allocateXrefId();
9538
- unit.create.push(createI18nContextOp(I18nContextKind.RootI18n, xref, op.xref, op.message, null));
9539
- op.context = xref;
9540
- rootContexts.set(op.xref, xref);
9537
+ const contextOp = createI18nContextOp(I18nContextKind.RootI18n, job.allocateXrefId(), op.xref, op.message, null);
9538
+ unit.create.push(contextOp);
9539
+ op.context = contextOp.xref;
9540
+ blockContextByI18nBlock.set(op.xref, contextOp);
9541
9541
  }
9542
9542
  break;
9543
+ }
9544
+ }
9545
+ }
9546
+ for (const unit of job.units) {
9547
+ for (const op of unit.create) {
9548
+ if (op.kind === OpKind.I18nStart && op.xref !== op.root) {
9549
+ const rootContext = blockContextByI18nBlock.get(op.root);
9550
+ if (rootContext === void 0) {
9551
+ throw Error("AssertionError: Root i18n block i18n context should have been created.");
9552
+ }
9553
+ op.context = rootContext.xref;
9554
+ blockContextByI18nBlock.set(op.xref, rootContext);
9555
+ }
9556
+ }
9557
+ }
9558
+ let currentI18nOp = null;
9559
+ for (const unit of job.units) {
9560
+ for (const op of unit.create) {
9561
+ switch (op.kind) {
9562
+ case OpKind.I18nStart:
9563
+ currentI18nOp = op;
9564
+ break;
9543
9565
  case OpKind.I18nEnd:
9544
9566
  currentI18nOp = null;
9545
9567
  break;
9546
9568
  case OpKind.IcuStart:
9547
9569
  if (currentI18nOp === null) {
9548
- throw Error("Unexpected ICU outside of an i18n block.");
9570
+ throw Error("AssertionError: Unexpected ICU outside of an i18n block.");
9549
9571
  }
9550
9572
  if (op.message.id !== currentI18nOp.message.id) {
9551
- xref = job.allocateXrefId();
9552
- unit.create.push(createI18nContextOp(I18nContextKind.Icu, xref, currentI18nOp.xref, op.message, null));
9553
- op.context = xref;
9573
+ const contextOp = createI18nContextOp(I18nContextKind.Icu, job.allocateXrefId(), currentI18nOp.xref, op.message, null);
9574
+ unit.create.push(contextOp);
9575
+ op.context = contextOp.xref;
9554
9576
  } else {
9555
9577
  op.context = currentI18nOp.context;
9578
+ blockContextByI18nBlock.get(currentI18nOp.xref).contextKind = I18nContextKind.Icu;
9556
9579
  }
9557
9580
  break;
9558
9581
  }
9559
9582
  }
9560
- for (const op of unit.ops()) {
9561
- switch (op.kind) {
9562
- case OpKind.Binding:
9563
- case OpKind.Property:
9564
- case OpKind.Attribute:
9565
- case OpKind.ExtractedAttribute:
9566
- if (!op.i18nMessage) {
9567
- continue;
9568
- }
9569
- if (!messageToContext.has(op.i18nMessage)) {
9570
- const i18nContext = job.allocateXrefId();
9571
- unit.create.push(createI18nContextOp(I18nContextKind.Attr, i18nContext, null, op.i18nMessage, null));
9572
- messageToContext.set(op.i18nMessage, i18nContext);
9573
- }
9574
- op.i18nContext = messageToContext.get(op.i18nMessage);
9575
- break;
9576
- }
9577
- }
9578
9583
  }
9584
+ }
9585
+
9586
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/deduplicate_text_bindings.mjs
9587
+ function deduplicateTextBindings(job) {
9588
+ const seen = /* @__PURE__ */ new Map();
9579
9589
  for (const unit of job.units) {
9580
- for (const op of unit.create) {
9581
- if (op.kind === OpKind.I18nStart && op.xref !== op.root) {
9582
- op.context = rootContexts.get(op.root);
9590
+ for (const op of unit.update.reversed()) {
9591
+ if (op.kind === OpKind.Binding && op.isTextAttribute) {
9592
+ const seenForElement = seen.get(op.target) || /* @__PURE__ */ new Set();
9593
+ if (seenForElement.has(op.name)) {
9594
+ if (job.compatibility === CompatibilityMode.TemplateDefinitionBuilder) {
9595
+ if (op.name === "style" || op.name === "class") {
9596
+ OpList.remove(op);
9597
+ }
9598
+ } else {
9599
+ }
9600
+ }
9601
+ seenForElement.add(op.name);
9602
+ seen.set(op.target, seenForElement);
9583
9603
  }
9584
9604
  }
9585
9605
  }
@@ -9869,12 +9889,16 @@ var LIST_START_MARKER = "[";
9869
9889
  var LIST_END_MARKER = "]";
9870
9890
  var LIST_DELIMITER = "|";
9871
9891
  function extractI18nMessages(job) {
9872
- const i18nContexts = /* @__PURE__ */ new Map();
9892
+ const i18nMessagesByContext = /* @__PURE__ */ new Map();
9873
9893
  const i18nBlocks = /* @__PURE__ */ new Map();
9894
+ const i18nContexts = /* @__PURE__ */ new Map();
9874
9895
  for (const unit of job.units) {
9875
9896
  for (const op of unit.create) {
9876
9897
  switch (op.kind) {
9877
9898
  case OpKind.I18nContext:
9899
+ const i18nMessageOp = createI18nMessage(job, op);
9900
+ unit.create.push(i18nMessageOp);
9901
+ i18nMessagesByContext.set(op.xref, i18nMessageOp);
9878
9902
  i18nContexts.set(op.xref, op);
9879
9903
  break;
9880
9904
  case OpKind.I18nStart:
@@ -9883,49 +9907,40 @@ function extractI18nMessages(job) {
9883
9907
  }
9884
9908
  }
9885
9909
  }
9886
- for (const unit of job.units) {
9887
- for (const op of unit.create) {
9888
- if (op.kind !== OpKind.I18nContext || op.contextKind !== I18nContextKind.Attr) {
9889
- continue;
9890
- }
9891
- const i18nMessageOp = createI18nMessage(job, op);
9892
- unit.create.push(i18nMessageOp);
9893
- }
9894
- }
9895
- const i18nBlockMessages = /* @__PURE__ */ new Map();
9896
- for (const unit of job.units) {
9897
- for (const op of unit.create) {
9898
- if (op.kind === OpKind.I18nStart && op.xref === op.root) {
9899
- if (!op.context) {
9900
- throw Error("I18n start op should have its context set.");
9901
- }
9902
- const i18nMessageOp = createI18nMessage(job, i18nContexts.get(op.context));
9903
- i18nBlockMessages.set(op.xref, i18nMessageOp);
9904
- unit.create.push(i18nMessageOp);
9905
- }
9906
- }
9907
- }
9910
+ let currentIcu = null;
9908
9911
  for (const unit of job.units) {
9909
9912
  for (const op of unit.create) {
9910
9913
  switch (op.kind) {
9911
9914
  case OpKind.IcuStart:
9912
- if (!op.context) {
9913
- throw Error("ICU op should have its context set.");
9915
+ currentIcu = op;
9916
+ OpList.remove(op);
9917
+ const icuContext = i18nContexts.get(op.context);
9918
+ if (icuContext.contextKind !== I18nContextKind.Icu) {
9919
+ continue;
9914
9920
  }
9915
- const i18nContext = i18nContexts.get(op.context);
9916
- if (i18nContext.contextKind === I18nContextKind.Icu) {
9917
- if (i18nContext.i18nBlock === null) {
9918
- throw Error("ICU context should have its i18n block set.");
9919
- }
9920
- const subMessage = createI18nMessage(job, i18nContext, op.messagePlaceholder);
9921
- unit.create.push(subMessage);
9922
- const rootI18nId = i18nBlocks.get(i18nContext.i18nBlock).root;
9923
- const parentMessage = i18nBlockMessages.get(rootI18nId);
9924
- parentMessage == null ? void 0 : parentMessage.subMessages.push(subMessage.xref);
9921
+ const i18nBlock = i18nBlocks.get(icuContext.i18nBlock);
9922
+ if (i18nBlock.context === icuContext.xref) {
9923
+ continue;
9925
9924
  }
9926
- OpList.remove(op);
9925
+ const rootI18nBlock = i18nBlocks.get(i18nBlock.root);
9926
+ const rootMessage = i18nMessagesByContext.get(rootI18nBlock.context);
9927
+ if (rootMessage === void 0) {
9928
+ throw Error("AssertionError: ICU sub-message should belong to a root message.");
9929
+ }
9930
+ const subMessage = i18nMessagesByContext.get(icuContext.xref);
9931
+ subMessage.messagePlaceholder = op.messagePlaceholder;
9932
+ rootMessage.subMessages.push(subMessage.xref);
9927
9933
  break;
9928
9934
  case OpKind.IcuEnd:
9935
+ currentIcu = null;
9936
+ OpList.remove(op);
9937
+ break;
9938
+ case OpKind.IcuPlaceholder:
9939
+ if (currentIcu === null || currentIcu.context == null) {
9940
+ throw Error("AssertionError: Unexpected ICU placeholder outside of i18n context");
9941
+ }
9942
+ const msg = i18nMessagesByContext.get(currentIcu.context);
9943
+ msg.postprocessingParams.set(op.name, literal(formatIcuPlaceholder(op)));
9929
9944
  OpList.remove(op);
9930
9945
  break;
9931
9946
  }
@@ -9935,14 +9950,16 @@ function extractI18nMessages(job) {
9935
9950
  function createI18nMessage(job, context, messagePlaceholder) {
9936
9951
  let formattedParams = formatParams(context.params);
9937
9952
  const formattedPostprocessingParams = formatParams(context.postprocessingParams);
9938
- let needsPostprocessing = formattedPostprocessingParams.size > 0;
9939
- for (const values of context.params.values()) {
9940
- if (values.length > 1) {
9941
- needsPostprocessing = true;
9942
- }
9943
- }
9953
+ let needsPostprocessing = [...context.params.values()].some((v) => v.length > 1);
9944
9954
  return createI18nMessageOp(job.allocateXrefId(), context.xref, context.i18nBlock, context.message, messagePlaceholder != null ? messagePlaceholder : null, formattedParams, formattedPostprocessingParams, needsPostprocessing);
9945
9955
  }
9956
+ function formatIcuPlaceholder(op) {
9957
+ if (op.strings.length !== op.expressionPlaceholders.length + 1) {
9958
+ throw Error(`AsserionError: Invalid ICU placeholder with ${op.strings.length} strings and ${op.expressionPlaceholders.length} expressions`);
9959
+ }
9960
+ const values = op.expressionPlaceholders.map(formatValue);
9961
+ return op.strings.flatMap((str, i) => [str, values[i] || ""]).join("");
9962
+ }
9946
9963
  function formatParams(params) {
9947
9964
  const formattedParams = /* @__PURE__ */ new Map();
9948
9965
  for (const [placeholder, placeholderValues] of params) {
@@ -10169,7 +10186,7 @@ var CLASS_BANG = "class!";
10169
10186
  var BANG_IMPORTANT = "!important";
10170
10187
  function parseHostStyleProperties(job) {
10171
10188
  for (const op of job.root.update) {
10172
- if (op.kind !== OpKind.Binding) {
10189
+ if (!(op.kind === OpKind.Binding && op.bindingKind === BindingKind.Property)) {
10173
10190
  continue;
10174
10191
  }
10175
10192
  if (op.name.endsWith(BANG_IMPORTANT)) {
@@ -10178,7 +10195,7 @@ function parseHostStyleProperties(job) {
10178
10195
  if (op.name.startsWith(STYLE_DOT)) {
10179
10196
  op.bindingKind = BindingKind.StyleProperty;
10180
10197
  op.name = op.name.substring(STYLE_DOT.length);
10181
- if (isCssCustomProperty(op.name)) {
10198
+ if (!isCssCustomProperty(op.name)) {
10182
10199
  op.name = hyphenate(op.name);
10183
10200
  }
10184
10201
  const { property: property2, suffix } = parseProperty(op.name);
@@ -16311,7 +16328,7 @@ function collectMessage(job, fileBasedI18nSuffix, messages, messageOp) {
16311
16328
  const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX2));
16312
16329
  const closureVar = i18nGenerateClosureVar(job.pool, messageOp.message.id, fileBasedI18nSuffix, job.i18nUseExternalIds);
16313
16330
  let transformFn = void 0;
16314
- if (messageOp.needsPostprocessing) {
16331
+ if (messageOp.needsPostprocessing || messageOp.postprocessingParams.size > 0) {
16315
16332
  const postprocessingParams = Object.fromEntries([...messageOp.postprocessingParams.entries()].sort());
16316
16333
  const formattedPostprocessingParams = formatI18nPlaceholderNamesInMap(postprocessingParams, false);
16317
16334
  const extraTransformFnParams = [];
@@ -16330,7 +16347,6 @@ function addSubMessageParams(messageOp, subMessagePlaceholders) {
16330
16347
  } else {
16331
16348
  messageOp.params.set(placeholder, literal(`${ESCAPE2}${I18N_ICU_MAPPING_PREFIX2}${placeholder}${ESCAPE2}`));
16332
16349
  messageOp.postprocessingParams.set(placeholder, literalArr(subMessages));
16333
- messageOp.needsPostprocessing = true;
16334
16350
  }
16335
16351
  }
16336
16352
  }
@@ -16364,12 +16380,13 @@ function i18nGenerateClosureVar(pool, messageId, fileBasedI18nSuffix, useExterna
16364
16380
 
16365
16381
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_text_extraction.mjs
16366
16382
  function convertI18nText(job) {
16367
- var _a2;
16383
+ var _a2, _b2, _c2;
16368
16384
  for (const unit of job.units) {
16369
16385
  let currentI18n = null;
16370
16386
  let currentIcu = null;
16371
16387
  const textNodeI18nBlocks = /* @__PURE__ */ new Map();
16372
16388
  const textNodeIcus = /* @__PURE__ */ new Map();
16389
+ const icuPlaceholderByText = /* @__PURE__ */ new Map();
16373
16390
  for (const op of unit.create) {
16374
16391
  switch (op.kind) {
16375
16392
  case OpKind.I18nStart:
@@ -16394,7 +16411,13 @@ function convertI18nText(job) {
16394
16411
  if (currentI18n !== null) {
16395
16412
  textNodeI18nBlocks.set(op.xref, currentI18n);
16396
16413
  textNodeIcus.set(op.xref, currentIcu);
16397
- OpList.remove(op);
16414
+ if (op.icuPlaceholder !== null) {
16415
+ const icuPlaceholderOp = createIcuPlaceholderOp(job.allocateXrefId(), op.icuPlaceholder, [op.initialValue]);
16416
+ OpList.replace(op, icuPlaceholderOp);
16417
+ icuPlaceholderByText.set(op.xref, icuPlaceholderOp);
16418
+ } else {
16419
+ OpList.remove(op);
16420
+ }
16398
16421
  }
16399
16422
  break;
16400
16423
  }
@@ -16407,14 +16430,18 @@ function convertI18nText(job) {
16407
16430
  }
16408
16431
  const i18nOp = textNodeI18nBlocks.get(op.target);
16409
16432
  const icuOp = textNodeIcus.get(op.target);
16433
+ const icuPlaceholder = icuPlaceholderByText.get(op.target);
16410
16434
  const contextId = icuOp ? icuOp.context : i18nOp.context;
16411
16435
  const resolutionTime = icuOp ? I18nParamResolutionTime.Postproccessing : I18nParamResolutionTime.Creation;
16412
16436
  const ops = [];
16413
16437
  for (let i = 0; i < op.interpolation.expressions.length; i++) {
16414
16438
  const expr = op.interpolation.expressions[i];
16415
- ops.push(createI18nExpressionOp(contextId, i18nOp.xref, i18nOp.xref, i18nOp.handle, expr, op.interpolation.i18nPlaceholders[i], resolutionTime, I18nExpressionFor.I18nText, "", (_a2 = expr.sourceSpan) != null ? _a2 : op.sourceSpan));
16439
+ ops.push(createI18nExpressionOp(contextId, i18nOp.xref, i18nOp.xref, i18nOp.handle, expr, (_a2 = icuPlaceholder == null ? void 0 : icuPlaceholder.xref) != null ? _a2 : null, (_b2 = op.interpolation.i18nPlaceholders[i]) != null ? _b2 : null, resolutionTime, I18nExpressionFor.I18nText, "", (_c2 = expr.sourceSpan) != null ? _c2 : op.sourceSpan));
16416
16440
  }
16417
16441
  OpList.replaceWithMany(op, ops);
16442
+ if (icuPlaceholder !== void 0) {
16443
+ icuPlaceholder.strings = op.interpolation.strings;
16444
+ }
16418
16445
  break;
16419
16446
  }
16420
16447
  }
@@ -16828,19 +16855,31 @@ function keepLast(ops) {
16828
16855
 
16829
16856
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/parse_extracted_styles.mjs
16830
16857
  function parseExtractedStyles(job) {
16858
+ const elements = /* @__PURE__ */ new Map();
16859
+ for (const unit of job.units) {
16860
+ for (const op of unit.create) {
16861
+ if (isElementOrContainerOp(op)) {
16862
+ elements.set(op.xref, op);
16863
+ }
16864
+ }
16865
+ }
16831
16866
  for (const unit of job.units) {
16832
16867
  for (const op of unit.create) {
16833
16868
  if (op.kind === OpKind.ExtractedAttribute && op.bindingKind === BindingKind.Attribute && isStringLiteral(op.expression)) {
16869
+ const target = elements.get(op.target);
16870
+ if (target !== void 0 && target.kind === OpKind.Template && target.templateKind === TemplateKind.Structural) {
16871
+ continue;
16872
+ }
16834
16873
  if (op.name === "style") {
16835
16874
  const parsedStyles = parse(op.expression.value);
16836
16875
  for (let i = 0; i < parsedStyles.length - 1; i += 2) {
16837
- OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.StyleProperty, parsedStyles[i], literal(parsedStyles[i + 1]), null, null, SecurityContext.STYLE), op);
16876
+ OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.StyleProperty, null, parsedStyles[i], literal(parsedStyles[i + 1]), null, null, SecurityContext.STYLE), op);
16838
16877
  }
16839
16878
  OpList.remove(op);
16840
16879
  } else if (op.name === "class") {
16841
16880
  const parsedClasses = op.expression.value.trim().split(/\s+/g);
16842
16881
  for (const parsedClass of parsedClasses) {
16843
- OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.ClassName, parsedClass, null, null, null, SecurityContext.NONE), op);
16882
+ OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.ClassName, null, parsedClass, null, null, null, SecurityContext.NONE), op);
16844
16883
  }
16845
16884
  OpList.remove(op);
16846
16885
  }
@@ -17170,9 +17209,7 @@ function namespaceMath() {
17170
17209
  return call(Identifiers.namespaceMathML, [], null);
17171
17210
  }
17172
17211
  function advance(delta, sourceSpan) {
17173
- return call(Identifiers.advance, [
17174
- literal(delta)
17175
- ], sourceSpan);
17212
+ return call(Identifiers.advance, delta > 1 ? [literal(delta)] : [], sourceSpan);
17176
17213
  }
17177
17214
  function reference(slot) {
17178
17215
  return importExpr(Identifiers.reference).callFn([
@@ -17310,10 +17347,13 @@ function property(name, expression, sanitizer, sourceSpan) {
17310
17347
  }
17311
17348
  return call(Identifiers.property, args, sourceSpan);
17312
17349
  }
17313
- function attribute(name, expression, sanitizer) {
17350
+ function attribute(name, expression, sanitizer, namespace) {
17314
17351
  const args = [literal(name), expression];
17315
- if (sanitizer !== null) {
17316
- args.push(sanitizer);
17352
+ if (sanitizer !== null || namespace !== null) {
17353
+ args.push(sanitizer != null ? sanitizer : literal(null));
17354
+ }
17355
+ if (namespace !== null) {
17356
+ args.push(literal(namespace));
17317
17357
  }
17318
17358
  return call(Identifiers.attribute, args, null);
17319
17359
  }
@@ -17624,19 +17664,19 @@ function reifyCreateOperations(unit, ops) {
17624
17664
  OpList.replace(op, text(op.handle.slot, op.initialValue, op.sourceSpan));
17625
17665
  break;
17626
17666
  case OpKind.ElementStart:
17627
- OpList.replace(op, elementStart(op.handle.slot, op.tag, op.attributes, op.localRefs, op.sourceSpan));
17667
+ OpList.replace(op, elementStart(op.handle.slot, op.tag, op.attributes, op.localRefs, op.startSourceSpan));
17628
17668
  break;
17629
17669
  case OpKind.Element:
17630
- OpList.replace(op, element(op.handle.slot, op.tag, op.attributes, op.localRefs, op.sourceSpan));
17670
+ OpList.replace(op, element(op.handle.slot, op.tag, op.attributes, op.localRefs, op.wholeSourceSpan));
17631
17671
  break;
17632
17672
  case OpKind.ElementEnd:
17633
17673
  OpList.replace(op, elementEnd(op.sourceSpan));
17634
17674
  break;
17635
17675
  case OpKind.ContainerStart:
17636
- OpList.replace(op, elementContainerStart(op.handle.slot, op.attributes, op.localRefs, op.sourceSpan));
17676
+ OpList.replace(op, elementContainerStart(op.handle.slot, op.attributes, op.localRefs, op.startSourceSpan));
17637
17677
  break;
17638
17678
  case OpKind.Container:
17639
- OpList.replace(op, elementContainer(op.handle.slot, op.attributes, op.localRefs, op.sourceSpan));
17679
+ OpList.replace(op, elementContainer(op.handle.slot, op.attributes, op.localRefs, op.wholeSourceSpan));
17640
17680
  break;
17641
17681
  case OpKind.ContainerEnd:
17642
17682
  OpList.replace(op, elementContainerEnd());
@@ -17664,7 +17704,7 @@ function reifyCreateOperations(unit, ops) {
17664
17704
  throw new Error(`AssertionError: local refs array should have been extracted into a constant`);
17665
17705
  }
17666
17706
  const childView = unit.job.views.get(op.xref);
17667
- OpList.replace(op, template(op.handle.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.attributes, op.localRefs, op.sourceSpan));
17707
+ OpList.replace(op, template(op.handle.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.attributes, op.localRefs, op.startSourceSpan));
17668
17708
  break;
17669
17709
  case OpKind.DisableBindings:
17670
17710
  OpList.replace(op, disableBindings2());
@@ -17679,7 +17719,7 @@ function reifyCreateOperations(unit, ops) {
17679
17719
  const listenerFn = reifyListenerHandler(unit, op.handlerFnName, op.handlerOps, op.consumesDollarEvent);
17680
17720
  const eventTargetResolver = op.eventTarget ? GLOBAL_TARGET_RESOLVERS.get(op.eventTarget) : null;
17681
17721
  if (eventTargetResolver === void 0) {
17682
- throw new Error(`AssertionError: unknown event target ${op.eventTarget}`);
17722
+ throw new Error(`Unexpected global target '${op.eventTarget}' defined for '${op.name}' event. Supported list of global targets: window,document,body.`);
17683
17723
  }
17684
17724
  OpList.replace(op, listener(op.name, listenerFn, eventTargetResolver, op.hostListener && op.isAnimationListener, op.sourceSpan));
17685
17725
  break;
@@ -17766,7 +17806,7 @@ function reifyCreateOperations(unit, ops) {
17766
17806
  emptyDecls = emptyView.decls;
17767
17807
  emptyVars = emptyView.vars;
17768
17808
  }
17769
- OpList.replace(op, repeaterCreate(op.handle.slot, repeaterView.fnName, op.decls, op.vars, op.tag, op.attributes, op.trackByFn, op.usesComponentInstance, emptyViewFnName, emptyDecls, emptyVars, op.sourceSpan));
17809
+ OpList.replace(op, repeaterCreate(op.handle.slot, repeaterView.fnName, op.decls, op.vars, op.tag, op.attributes, op.trackByFn, op.usesComponentInstance, emptyViewFnName, emptyDecls, emptyVars, op.wholeSourceSpan));
17770
17810
  break;
17771
17811
  case OpKind.Statement:
17772
17812
  break;
@@ -17826,7 +17866,7 @@ function reifyUpdateOperations(_unit, ops) {
17826
17866
  if (op.expression instanceof Interpolation2) {
17827
17867
  OpList.replace(op, attributeInterpolate(op.name, op.expression.strings, op.expression.expressions, op.sanitizer, op.sourceSpan));
17828
17868
  } else {
17829
- OpList.replace(op, attribute(op.name, op.expression, op.sanitizer));
17869
+ OpList.replace(op, attribute(op.name, op.expression, op.sanitizer, op.namespace));
17830
17870
  }
17831
17871
  break;
17832
17872
  case OpKind.HostProperty:
@@ -17995,38 +18035,6 @@ function removeUnusedI18nAttributesOps(job) {
17995
18035
  }
17996
18036
  }
17997
18037
 
17998
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/repeater_derived_vars.mjs
17999
- function generateRepeaterDerivedVars(job) {
18000
- const repeaters = /* @__PURE__ */ new Map();
18001
- for (const unit of job.units) {
18002
- for (const op of unit.ops()) {
18003
- if (op.kind === OpKind.RepeaterCreate) {
18004
- repeaters.set(op.xref, op);
18005
- }
18006
- }
18007
- }
18008
- for (const unit of job.units) {
18009
- for (const op of unit.ops()) {
18010
- transformExpressionsInOp(op, (expr) => {
18011
- if (!(expr instanceof DerivedRepeaterVarExpr)) {
18012
- return expr;
18013
- }
18014
- const repeaterOp = repeaters.get(expr.xref);
18015
- switch (expr.identity) {
18016
- case DerivedRepeaterVarIdentity.First:
18017
- return new BinaryOperatorExpr(BinaryOperator.Identical, new LexicalReadExpr(repeaterOp.varNames.$index), literal(0));
18018
- case DerivedRepeaterVarIdentity.Last:
18019
- return new BinaryOperatorExpr(BinaryOperator.Identical, new LexicalReadExpr(repeaterOp.varNames.$index), new BinaryOperatorExpr(BinaryOperator.Minus, new LexicalReadExpr(repeaterOp.varNames.$count), literal(1)));
18020
- case DerivedRepeaterVarIdentity.Even:
18021
- return new BinaryOperatorExpr(BinaryOperator.Identical, new BinaryOperatorExpr(BinaryOperator.Modulo, new LexicalReadExpr(repeaterOp.varNames.$index), literal(2)), literal(0));
18022
- case DerivedRepeaterVarIdentity.Odd:
18023
- return new BinaryOperatorExpr(BinaryOperator.NotIdentical, new BinaryOperatorExpr(BinaryOperator.Modulo, new LexicalReadExpr(repeaterOp.varNames.$index), literal(2)), literal(0));
18024
- }
18025
- }, VisitorContextFlag.None);
18026
- }
18027
- }
18028
- }
18029
-
18030
18038
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_contexts.mjs
18031
18039
  function resolveContexts(job) {
18032
18040
  for (const unit of job.units) {
@@ -18273,6 +18281,7 @@ function resolveI18nExpressionPlaceholders(job) {
18273
18281
  var _a2;
18274
18282
  const subTemplateIndicies = /* @__PURE__ */ new Map();
18275
18283
  const i18nContexts = /* @__PURE__ */ new Map();
18284
+ const icuPlaceholders = /* @__PURE__ */ new Map();
18276
18285
  for (const unit of job.units) {
18277
18286
  for (const op of unit.create) {
18278
18287
  switch (op.kind) {
@@ -18282,6 +18291,9 @@ function resolveI18nExpressionPlaceholders(job) {
18282
18291
  case OpKind.I18nContext:
18283
18292
  i18nContexts.set(op.xref, op);
18284
18293
  break;
18294
+ case OpKind.IcuPlaceholder:
18295
+ icuPlaceholders.set(op.xref, op);
18296
+ break;
18285
18297
  }
18286
18298
  }
18287
18299
  }
@@ -18290,66 +18302,32 @@ function resolveI18nExpressionPlaceholders(job) {
18290
18302
  for (const unit of job.units) {
18291
18303
  for (const op of unit.update) {
18292
18304
  if (op.kind === OpKind.I18nExpression) {
18293
- const i18nContext = i18nContexts.get(op.context);
18294
18305
  const index = expressionIndices.get(referenceIndex(op)) || 0;
18295
18306
  const subTemplateIndex = (_a2 = subTemplateIndicies.get(op.i18nOwner)) != null ? _a2 : null;
18296
- const params = op.resolutionTime === I18nParamResolutionTime.Creation ? i18nContext.params : i18nContext.postprocessingParams;
18297
- const values = params.get(op.i18nPlaceholder) || [];
18298
- values.push({
18307
+ const value = {
18299
18308
  value: index,
18300
18309
  subTemplateIndex,
18301
18310
  flags: I18nParamValueFlags.ExpressionIndex
18302
- });
18303
- params.set(op.i18nPlaceholder, values);
18311
+ };
18312
+ updatePlaceholder(op, value, i18nContexts, icuPlaceholders);
18304
18313
  expressionIndices.set(referenceIndex(op), index + 1);
18305
18314
  }
18306
18315
  }
18307
18316
  }
18308
18317
  }
18309
-
18310
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_icu_placeholders.mjs
18311
- function resolveI18nIcuPlaceholders(job) {
18312
- for (const unit of job.units) {
18313
- for (const op of unit.create) {
18314
- if (op.kind === OpKind.I18nContext && op.contextKind === I18nContextKind.Icu) {
18315
- for (const node of op.message.nodes) {
18316
- node.visit(new ResolveIcuPlaceholdersVisitor(op.postprocessingParams));
18317
- }
18318
- }
18319
- }
18320
- }
18321
- }
18322
- var ResolveIcuPlaceholdersVisitor = class extends RecurseVisitor {
18323
- constructor(params) {
18324
- super();
18325
- this.params = params;
18318
+ function updatePlaceholder(op, value, i18nContexts, icuPlaceholders) {
18319
+ if (op.i18nPlaceholder !== null) {
18320
+ const i18nContext = i18nContexts.get(op.context);
18321
+ const params = op.resolutionTime === I18nParamResolutionTime.Creation ? i18nContext.params : i18nContext.postprocessingParams;
18322
+ const values = params.get(op.i18nPlaceholder) || [];
18323
+ values.push(value);
18324
+ params.set(op.i18nPlaceholder, values);
18326
18325
  }
18327
- visitContainerPlaceholder(placeholder) {
18328
- var _a2, _b2;
18329
- if (placeholder.startName && placeholder.startSourceSpan && !this.params.has(placeholder.startName)) {
18330
- this.params.set(placeholder.startName, [{
18331
- value: (_a2 = placeholder.startSourceSpan) == null ? void 0 : _a2.toString(),
18332
- subTemplateIndex: null,
18333
- flags: I18nParamValueFlags.None
18334
- }]);
18335
- }
18336
- if (placeholder.closeName && placeholder.endSourceSpan && !this.params.has(placeholder.closeName)) {
18337
- this.params.set(placeholder.closeName, [{
18338
- value: (_b2 = placeholder.endSourceSpan) == null ? void 0 : _b2.toString(),
18339
- subTemplateIndex: null,
18340
- flags: I18nParamValueFlags.None
18341
- }]);
18342
- }
18326
+ if (op.icuPlaceholder !== null) {
18327
+ const icuPlaceholderOp = icuPlaceholders.get(op.icuPlaceholder);
18328
+ icuPlaceholderOp == null ? void 0 : icuPlaceholderOp.expressionPlaceholders.push(value);
18343
18329
  }
18344
- visitTagPlaceholder(placeholder) {
18345
- super.visitTagPlaceholder(placeholder);
18346
- this.visitContainerPlaceholder(placeholder);
18347
- }
18348
- visitBlockPlaceholder(placeholder) {
18349
- super.visitBlockPlaceholder(placeholder);
18350
- this.visitContainerPlaceholder(placeholder);
18351
- }
18352
- };
18330
+ }
18353
18331
 
18354
18332
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_names.mjs
18355
18333
  function resolveNames(job) {
@@ -18819,7 +18797,10 @@ function varsUsedByOp(op) {
18819
18797
  return op.interpolation.expressions.length;
18820
18798
  case OpKind.I18nExpression:
18821
18799
  case OpKind.Conditional:
18800
+ case OpKind.DeferWhen:
18822
18801
  return 1;
18802
+ case OpKind.RepeaterCreate:
18803
+ return op.emptyView ? 1 : 0;
18823
18804
  default:
18824
18805
  throw new Error(`Unhandled op: ${OpKind[op.kind]}`);
18825
18806
  }
@@ -19133,6 +19114,7 @@ var phases = [
19133
19114
  { kind: CompilationJobKind.Tmpl, fn: emitNamespaceChanges },
19134
19115
  { kind: CompilationJobKind.Tmpl, fn: propagateI18nBlocks },
19135
19116
  { kind: CompilationJobKind.Tmpl, fn: wrapI18nIcus },
19117
+ { kind: CompilationJobKind.Both, fn: deduplicateTextBindings },
19136
19118
  { kind: CompilationJobKind.Both, fn: specializeStyleBindings },
19137
19119
  { kind: CompilationJobKind.Both, fn: specializeBindings },
19138
19120
  { kind: CompilationJobKind.Both, fn: extractAttributes },
@@ -19156,7 +19138,6 @@ var phases = [
19156
19138
  { kind: CompilationJobKind.Tmpl, fn: saveAndRestoreView },
19157
19139
  { kind: CompilationJobKind.Both, fn: deleteAnyCasts },
19158
19140
  { kind: CompilationJobKind.Both, fn: resolveDollarEvent },
19159
- { kind: CompilationJobKind.Tmpl, fn: generateRepeaterDerivedVars },
19160
19141
  { kind: CompilationJobKind.Tmpl, fn: generateTrackVariables },
19161
19142
  { kind: CompilationJobKind.Both, fn: resolveNames },
19162
19143
  { kind: CompilationJobKind.Tmpl, fn: resolveDeferTargetNames },
@@ -19171,7 +19152,6 @@ var phases = [
19171
19152
  { kind: CompilationJobKind.Tmpl, fn: createDeferDepsFns },
19172
19153
  { kind: CompilationJobKind.Tmpl, fn: resolveI18nElementPlaceholders },
19173
19154
  { kind: CompilationJobKind.Tmpl, fn: resolveI18nExpressionPlaceholders },
19174
- { kind: CompilationJobKind.Tmpl, fn: resolveI18nIcuPlaceholders },
19175
19155
  { kind: CompilationJobKind.Tmpl, fn: extractI18nMessages },
19176
19156
  { kind: CompilationJobKind.Tmpl, fn: generateTrackFns },
19177
19157
  { kind: CompilationJobKind.Tmpl, fn: collectI18nConsts },
@@ -19314,7 +19294,7 @@ function ingestHostBinding(input, bindingParser, constantPool) {
19314
19294
  bindingKind = BindingKind.Animation;
19315
19295
  }
19316
19296
  const securityContexts = bindingParser.calcPossibleSecurityContexts(input.componentSelector, property2.name, bindingKind === BindingKind.Attribute).filter((context) => context !== SecurityContext.NONE);
19317
- ingestHostProperty(job, property2, bindingKind, false, securityContexts);
19297
+ ingestHostProperty(job, property2, bindingKind, securityContexts);
19318
19298
  }
19319
19299
  for (const [name, expr] of (_b2 = Object.entries(input.attributes)) != null ? _b2 : []) {
19320
19300
  const securityContexts = bindingParser.calcPossibleSecurityContexts(input.componentSelector, name, true).filter((context) => context !== SecurityContext.NONE);
@@ -19325,7 +19305,7 @@ function ingestHostBinding(input, bindingParser, constantPool) {
19325
19305
  }
19326
19306
  return job;
19327
19307
  }
19328
- function ingestHostProperty(job, property2, bindingKind, isTextAttribute, securityContexts) {
19308
+ function ingestHostProperty(job, property2, bindingKind, securityContexts) {
19329
19309
  let expression;
19330
19310
  const ast = property2.expression.ast;
19331
19311
  if (ast instanceof Interpolation) {
@@ -19333,7 +19313,7 @@ function ingestHostProperty(job, property2, bindingKind, isTextAttribute, securi
19333
19313
  } else {
19334
19314
  expression = convertAst(ast, job, property2.sourceSpan);
19335
19315
  }
19336
- job.root.update.push(createBindingOp(job.root.xref, bindingKind, property2.name, expression, null, securityContexts, isTextAttribute, false, null, null, property2.sourceSpan));
19316
+ job.root.update.push(createBindingOp(job.root.xref, bindingKind, property2.name, expression, null, securityContexts, false, false, null, null, property2.sourceSpan));
19337
19317
  }
19338
19318
  function ingestHostAttribute(job, name, value, securityContexts) {
19339
19319
  const attrBinding = createBindingOp(
@@ -19347,14 +19327,13 @@ function ingestHostAttribute(job, name, value, securityContexts) {
19347
19327
  false,
19348
19328
  null,
19349
19329
  null,
19350
- null
19330
+ value.sourceSpan
19351
19331
  );
19352
19332
  job.root.update.push(attrBinding);
19353
19333
  }
19354
19334
  function ingestHostEvent(job, event) {
19355
19335
  const [phase, target] = event.type === 0 ? [null, event.targetOrPhase] : [event.targetOrPhase, null];
19356
- const eventBinding = createListenerOp(job.root.xref, new SlotHandle(), event.name, null, [], phase, target, true, event.sourceSpan);
19357
- eventBinding.handlerOps.push(createStatementOp(new ReturnStatement(convertAst(event.handler.ast, job, event.sourceSpan), event.handlerSpan)));
19336
+ const eventBinding = createListenerOp(job.root.xref, new SlotHandle(), event.name, null, makeListenerHandlerOps(job.root, event.handler, event.handlerSpan), phase, target, true, event.sourceSpan);
19358
19337
  job.root.create.push(eventBinding);
19359
19338
  }
19360
19339
  function ingestNodes(unit, template2) {
@@ -19366,9 +19345,9 @@ function ingestNodes(unit, template2) {
19366
19345
  } else if (node instanceof Content) {
19367
19346
  ingestContent(unit, node);
19368
19347
  } else if (node instanceof Text) {
19369
- ingestText(unit, node);
19348
+ ingestText(unit, node, null);
19370
19349
  } else if (node instanceof BoundText) {
19371
- ingestBoundText(unit, node);
19350
+ ingestBoundText(unit, node, null);
19372
19351
  } else if (node instanceof IfBlock) {
19373
19352
  ingestIfBlock(unit, node);
19374
19353
  } else if (node instanceof SwitchBlock) {
@@ -19391,7 +19370,7 @@ function ingestElement(unit, element2) {
19391
19370
  }
19392
19371
  const id = unit.job.allocateXrefId();
19393
19372
  const [namespaceKey, elementName] = splitNsName(element2.name);
19394
- const startOp = createElementStartOp(elementName, id, namespaceForKey(namespaceKey), element2.i18n instanceof TagPlaceholder ? element2.i18n : void 0, element2.startSourceSpan);
19373
+ const startOp = createElementStartOp(elementName, id, namespaceForKey(namespaceKey), element2.i18n instanceof TagPlaceholder ? element2.i18n : void 0, element2.startSourceSpan, element2.sourceSpan);
19395
19374
  unit.create.push(startOp);
19396
19375
  ingestElementBindings(unit, startOp, element2);
19397
19376
  ingestReferences(startOp, element2);
@@ -19421,7 +19400,7 @@ function ingestTemplate(unit, tmpl) {
19421
19400
  const namespace = namespaceForKey(namespacePrefix);
19422
19401
  const functionNameSuffix = tagNameWithoutNamespace === null ? "" : prefixWithNamespace(tagNameWithoutNamespace, namespace);
19423
19402
  const templateKind = isPlainTemplate(tmpl) ? TemplateKind.NgTemplate : TemplateKind.Structural;
19424
- const templateOp = createTemplateOp(childView.xref, templateKind, tagNameWithoutNamespace, functionNameSuffix, namespace, i18nPlaceholder, tmpl.startSourceSpan);
19403
+ const templateOp = createTemplateOp(childView.xref, templateKind, tagNameWithoutNamespace, functionNameSuffix, namespace, i18nPlaceholder, tmpl.startSourceSpan, tmpl.sourceSpan);
19425
19404
  unit.create.push(templateOp);
19426
19405
  ingestTemplateBindings(unit, templateOp, tmpl, templateKind);
19427
19406
  ingestReferences(templateOp, tmpl);
@@ -19447,10 +19426,10 @@ function ingestContent(unit, content) {
19447
19426
  }
19448
19427
  unit.create.push(op);
19449
19428
  }
19450
- function ingestText(unit, text2) {
19451
- unit.create.push(createTextOp(unit.job.allocateXrefId(), text2.value, text2.sourceSpan));
19429
+ function ingestText(unit, text2, icuPlaceholder) {
19430
+ unit.create.push(createTextOp(unit.job.allocateXrefId(), text2.value, icuPlaceholder, text2.sourceSpan));
19452
19431
  }
19453
- function ingestBoundText(unit, text2, i18nPlaceholders) {
19432
+ function ingestBoundText(unit, text2, icuPlaceholder) {
19454
19433
  var _a2;
19455
19434
  let value = text2.value;
19456
19435
  if (value instanceof ASTWithSource) {
@@ -19462,14 +19441,12 @@ function ingestBoundText(unit, text2, i18nPlaceholders) {
19462
19441
  if (text2.i18n !== void 0 && !(text2.i18n instanceof Container)) {
19463
19442
  throw Error(`Unhandled i18n metadata type for text interpolation: ${(_a2 = text2.i18n) == null ? void 0 : _a2.constructor.name}`);
19464
19443
  }
19465
- if (i18nPlaceholders === void 0) {
19466
- i18nPlaceholders = text2.i18n instanceof Container ? text2.i18n.children.filter((node) => node instanceof Placeholder).map((placeholder) => placeholder.name) : [];
19467
- }
19444
+ const i18nPlaceholders = text2.i18n instanceof Container ? text2.i18n.children.filter((node) => node instanceof Placeholder).map((placeholder) => placeholder.name) : [];
19468
19445
  if (i18nPlaceholders.length > 0 && i18nPlaceholders.length !== value.expressions.length) {
19469
19446
  throw Error(`Unexpected number of i18n placeholders (${value.expressions.length}) for BoundText with ${value.expressions.length} expressions`);
19470
19447
  }
19471
19448
  const textXref = unit.job.allocateXrefId();
19472
- unit.create.push(createTextOp(textXref, "", text2.sourceSpan));
19449
+ unit.create.push(createTextOp(textXref, "", icuPlaceholder, text2.sourceSpan));
19473
19450
  const baseSourceSpan = unit.job.compatibility ? null : text2.sourceSpan;
19474
19451
  unit.update.push(createInterpolateTextOp(textXref, new Interpolation2(value.strings, value.expressions.map((expr) => convertAst(expr, unit.job, baseSourceSpan)), i18nPlaceholders), text2.sourceSpan));
19475
19452
  }
@@ -19495,7 +19472,7 @@ function ingestIfBlock(unit, ifBlock) {
19495
19472
  }
19496
19473
  ifCaseI18nMeta = ifCase.i18n;
19497
19474
  }
19498
- const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, tagName, "Conditional", Namespace.HTML, ifCaseI18nMeta, ifCase.sourceSpan);
19475
+ const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, tagName, "Conditional", Namespace.HTML, ifCaseI18nMeta, ifCase.startSourceSpan, ifCase.sourceSpan);
19499
19476
  unit.create.push(templateOp);
19500
19477
  if (firstXref === null) {
19501
19478
  firstXref = cView.xref;
@@ -19511,6 +19488,9 @@ function ingestIfBlock(unit, ifBlock) {
19511
19488
  }
19512
19489
  function ingestSwitchBlock(unit, switchBlock) {
19513
19490
  var _a2;
19491
+ if (switchBlock.cases.length === 0) {
19492
+ return;
19493
+ }
19514
19494
  let firstXref = null;
19515
19495
  let firstSlotHandle = null;
19516
19496
  let conditions = [];
@@ -19523,7 +19503,7 @@ function ingestSwitchBlock(unit, switchBlock) {
19523
19503
  }
19524
19504
  switchCaseI18nMeta = switchCase.i18n;
19525
19505
  }
19526
- const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, null, "Case", Namespace.HTML, switchCaseI18nMeta, switchCase.sourceSpan);
19506
+ const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, null, "Case", Namespace.HTML, switchCaseI18nMeta, switchCase.startSourceSpan, switchCase.sourceSpan);
19527
19507
  unit.create.push(templateOp);
19528
19508
  if (firstXref === null) {
19529
19509
  firstXref = cView.xref;
@@ -19546,7 +19526,7 @@ function ingestDeferView(unit, suffix, i18nMeta, children, sourceSpan) {
19546
19526
  }
19547
19527
  const secondaryView = unit.job.allocateView(unit.xref);
19548
19528
  ingestNodes(secondaryView, children);
19549
- const templateOp = createTemplateOp(secondaryView.xref, TemplateKind.Block, null, `Defer${suffix}`, Namespace.HTML, i18nMeta, sourceSpan);
19529
+ const templateOp = createTemplateOp(secondaryView.xref, TemplateKind.Block, null, `Defer${suffix}`, Namespace.HTML, i18nMeta, sourceSpan, sourceSpan);
19550
19530
  unit.create.push(templateOp);
19551
19531
  return templateOp;
19552
19532
  }
@@ -19620,6 +19600,9 @@ function ingestDeferBlock(unit, deferBlock) {
19620
19600
  deferOnOps.push(deferOnOp);
19621
19601
  }
19622
19602
  if (triggers.when !== void 0) {
19603
+ if (triggers.when.value instanceof Interpolation) {
19604
+ throw new Error(`Unexpected interpolation in defer block when trigger`);
19605
+ }
19623
19606
  const deferOnOp = createDeferWhenOp(deferXref, convertAst(triggers.when.value, unit.job, triggers.when.sourceSpan), prefetch, triggers.when.sourceSpan);
19624
19607
  deferWhenOps.push(deferOnOp);
19625
19608
  }
@@ -19639,9 +19622,9 @@ function ingestIcu(unit, icu) {
19639
19622
  unit.create.push(createIcuStartOp(xref, icu.i18n, icuFromI18nMessage(icu.i18n).name, null));
19640
19623
  for (const [placeholder, text2] of Object.entries(__spreadValues(__spreadValues({}, icu.vars), icu.placeholders))) {
19641
19624
  if (text2 instanceof BoundText) {
19642
- ingestBoundText(unit, text2, [placeholder]);
19625
+ ingestBoundText(unit, text2, placeholder);
19643
19626
  } else {
19644
- ingestText(unit, text2);
19627
+ ingestText(unit, text2, placeholder);
19645
19628
  }
19646
19629
  }
19647
19630
  unit.create.push(createIcuEndOp(xref));
@@ -19652,21 +19635,37 @@ function ingestIcu(unit, icu) {
19652
19635
  function ingestForBlock(unit, forBlock) {
19653
19636
  var _a2, _b2, _c2;
19654
19637
  const repeaterView = unit.job.allocateView(unit.xref);
19655
- const createRepeaterAlias = (ident, repeaterVar) => {
19656
- repeaterView.aliases.add({
19657
- kind: SemanticVariableKind.Alias,
19658
- name: null,
19659
- identifier: ident,
19660
- expression: new DerivedRepeaterVarExpr(repeaterView.xref, repeaterVar)
19661
- });
19662
- };
19663
19638
  repeaterView.contextVariables.set(forBlock.item.name, forBlock.item.value);
19664
19639
  repeaterView.contextVariables.set(forBlock.contextVariables.$index.name, forBlock.contextVariables.$index.value);
19665
19640
  repeaterView.contextVariables.set(forBlock.contextVariables.$count.name, forBlock.contextVariables.$count.value);
19666
- createRepeaterAlias(forBlock.contextVariables.$first.name, DerivedRepeaterVarIdentity.First);
19667
- createRepeaterAlias(forBlock.contextVariables.$last.name, DerivedRepeaterVarIdentity.Last);
19668
- createRepeaterAlias(forBlock.contextVariables.$even.name, DerivedRepeaterVarIdentity.Even);
19669
- createRepeaterAlias(forBlock.contextVariables.$odd.name, DerivedRepeaterVarIdentity.Odd);
19641
+ const indexName = `\u0275${forBlock.contextVariables.$index.name}_${repeaterView.xref}`;
19642
+ const countName = `\u0275${forBlock.contextVariables.$count.name}_${repeaterView.xref}`;
19643
+ repeaterView.contextVariables.set(indexName, forBlock.contextVariables.$index.value);
19644
+ repeaterView.contextVariables.set(countName, forBlock.contextVariables.$count.value);
19645
+ repeaterView.aliases.add({
19646
+ kind: SemanticVariableKind.Alias,
19647
+ name: null,
19648
+ identifier: forBlock.contextVariables.$first.name,
19649
+ expression: new LexicalReadExpr(indexName).identical(literal(0))
19650
+ });
19651
+ repeaterView.aliases.add({
19652
+ kind: SemanticVariableKind.Alias,
19653
+ name: null,
19654
+ identifier: forBlock.contextVariables.$last.name,
19655
+ expression: new LexicalReadExpr(indexName).identical(new LexicalReadExpr(countName).minus(literal(1)))
19656
+ });
19657
+ repeaterView.aliases.add({
19658
+ kind: SemanticVariableKind.Alias,
19659
+ name: null,
19660
+ identifier: forBlock.contextVariables.$even.name,
19661
+ expression: new LexicalReadExpr(indexName).modulo(literal(2)).identical(literal(0))
19662
+ });
19663
+ repeaterView.aliases.add({
19664
+ kind: SemanticVariableKind.Alias,
19665
+ name: null,
19666
+ identifier: forBlock.contextVariables.$odd.name,
19667
+ expression: new LexicalReadExpr(indexName).modulo(literal(2)).notIdentical(literal(0))
19668
+ });
19670
19669
  const sourceSpan = convertSourceSpan(forBlock.trackBy.span, forBlock.sourceSpan);
19671
19670
  const track = convertAst(forBlock.trackBy, unit.job, sourceSpan);
19672
19671
  ingestNodes(repeaterView, forBlock.children);
@@ -19693,7 +19692,7 @@ function ingestForBlock(unit, forBlock) {
19693
19692
  const i18nPlaceholder = forBlock.i18n;
19694
19693
  const emptyI18nPlaceholder = (_b2 = forBlock.empty) == null ? void 0 : _b2.i18n;
19695
19694
  const tagName = ingestControlFlowInsertionPoint(unit, repeaterView.xref, forBlock);
19696
- const repeaterCreate2 = createRepeaterCreateOp(repeaterView.xref, (_c2 = emptyView == null ? void 0 : emptyView.xref) != null ? _c2 : null, tagName, track, varNames, i18nPlaceholder, emptyI18nPlaceholder, forBlock.sourceSpan);
19695
+ const repeaterCreate2 = createRepeaterCreateOp(repeaterView.xref, (_c2 = emptyView == null ? void 0 : emptyView.xref) != null ? _c2 : null, tagName, track, varNames, i18nPlaceholder, emptyI18nPlaceholder, forBlock.startSourceSpan, forBlock.sourceSpan);
19697
19696
  unit.create.push(repeaterCreate2);
19698
19697
  const expression = convertAst(forBlock.expression, unit.job, convertSourceSpan(forBlock.expression.span, forBlock.sourceSpan));
19699
19698
  const repeater2 = createRepeaterOp(repeaterCreate2.xref, repeaterCreate2.handle, expression, forBlock.sourceSpan);
@@ -19781,13 +19780,13 @@ function convertAst(ast, job, baseSourceSpan) {
19781
19780
  throw new Error(`Unhandled expression type "${ast.constructor.name}" in file "${baseSourceSpan == null ? void 0 : baseSourceSpan.start.file.url}"`);
19782
19781
  }
19783
19782
  }
19784
- function convertAstWithInterpolation(job, value, i18nMeta) {
19783
+ function convertAstWithInterpolation(job, value, i18nMeta, sourceSpan) {
19785
19784
  var _a2, _b2;
19786
19785
  let expression;
19787
19786
  if (value instanceof Interpolation) {
19788
- expression = new Interpolation2(value.strings, value.expressions.map((e) => convertAst(e, job, null)), Object.keys((_b2 = (_a2 = asMessage(i18nMeta)) == null ? void 0 : _a2.placeholders) != null ? _b2 : {}));
19787
+ expression = new Interpolation2(value.strings, value.expressions.map((e) => convertAst(e, job, sourceSpan != null ? sourceSpan : null)), Object.keys((_b2 = (_a2 = asMessage(i18nMeta)) == null ? void 0 : _a2.placeholders) != null ? _b2 : {}));
19789
19788
  } else if (value instanceof AST) {
19790
- expression = convertAst(value, job, null);
19789
+ expression = convertAst(value, job, sourceSpan != null ? sourceSpan : null);
19791
19790
  } else {
19792
19791
  expression = literal(value);
19793
19792
  }
@@ -19863,7 +19862,7 @@ function ingestTemplateBindings(unit, op, template2, templateKind) {
19863
19862
  }
19864
19863
  if (templateKind === TemplateKind.Structural && output.type !== 1) {
19865
19864
  const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, output.name, false);
19866
- unit.create.push(createExtractedAttributeOp(op.xref, BindingKind.Property, output.name, null, null, null, securityContext));
19865
+ unit.create.push(createExtractedAttributeOp(op.xref, BindingKind.Property, null, output.name, null, null, null, securityContext));
19867
19866
  }
19868
19867
  }
19869
19868
  if (bindings.some((b) => b == null ? void 0 : b.i18nMessage) !== null) {
@@ -19874,7 +19873,7 @@ function createTemplateBinding(view, xref, type, name, value, unit, securityCont
19874
19873
  const isTextBinding = typeof value === "string";
19875
19874
  if (templateKind === TemplateKind.Structural) {
19876
19875
  if (!isStructuralTemplateAttribute && (type === 0 || type === 2 || type === 3)) {
19877
- return createExtractedAttributeOp(xref, BindingKind.Property, name, null, null, i18nMessage, securityContext);
19876
+ return createExtractedAttributeOp(xref, BindingKind.Property, null, name, null, null, i18nMessage, securityContext);
19878
19877
  }
19879
19878
  if (!isTextBinding && (type === 1 || type === 4)) {
19880
19879
  return null;
@@ -22733,6 +22732,9 @@ var TemplateDefinitionBuilder = class {
22733
22732
  this.updateInstructionWithAdvance(containerIndex, block.branches[0].sourceSpan, Identifiers.conditional, paramsCallback);
22734
22733
  }
22735
22734
  visitSwitchBlock(block) {
22735
+ if (block.cases.length === 0) {
22736
+ return;
22737
+ }
22736
22738
  const caseData = block.cases.map((currentCase) => {
22737
22739
  const index = this.createEmbeddedTemplateFn(null, currentCase.children, "_Case", currentCase.sourceSpan, void 0, void 0, void 0, currentCase.i18n);
22738
22740
  const expression = currentCase.expression === null ? null : currentCase.expression.visit(this._valueConverter);
@@ -23055,7 +23057,7 @@ var TemplateDefinitionBuilder = class {
23055
23057
  if (delta < 1) {
23056
23058
  throw new Error("advance instruction can only go forwards");
23057
23059
  }
23058
- this.instructionFn(this._updateCodeFns, span, Identifiers.advance, [literal(delta)]);
23060
+ this.instructionFn(this._updateCodeFns, span, Identifiers.advance, delta > 1 ? [literal(delta)] : []);
23059
23061
  this._currentIndex = nodeIndex;
23060
23062
  }
23061
23063
  }
@@ -23465,12 +23467,15 @@ var BindingScope = class {
23465
23467
  }
23466
23468
  };
23467
23469
  var TrackByBindingScope = class extends BindingScope {
23468
- constructor(parentScope, globalAliases) {
23470
+ constructor(parentScope, globalOverrides) {
23469
23471
  super(parentScope.bindingLevel + 1, parentScope);
23470
- this.globalAliases = globalAliases;
23472
+ this.globalOverrides = globalOverrides;
23471
23473
  this.componentAccessCount = 0;
23472
23474
  }
23473
23475
  get(name) {
23476
+ if (this.globalOverrides.hasOwnProperty(name)) {
23477
+ return variable(this.globalOverrides[name]);
23478
+ }
23474
23479
  let current = this.parent;
23475
23480
  while (current) {
23476
23481
  if (current.hasLocal(name)) {
@@ -23478,9 +23483,6 @@ var TrackByBindingScope = class extends BindingScope {
23478
23483
  }
23479
23484
  current = current.parent;
23480
23485
  }
23481
- if (this.globalAliases[name]) {
23482
- return variable(this.globalAliases[name]);
23483
- }
23484
23486
  this.componentAccessCount++;
23485
23487
  return variable("this").prop(name);
23486
23488
  }
@@ -25482,7 +25484,7 @@ function publishFacade(global) {
25482
25484
  }
25483
25485
 
25484
25486
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/version.mjs
25485
- var VERSION2 = new Version("17.0.7");
25487
+ var VERSION2 = new Version("17.0.9");
25486
25488
 
25487
25489
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
25488
25490
  var _VisitorMode;