@angular/core 17.0.7 → 17.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/esm2022/src/application/application_ref.mjs +4 -8
  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/core.mjs +2 -2
  7. package/esm2022/src/core_private_export.mjs +4 -2
  8. package/esm2022/src/event_emitter.mjs +1 -2
  9. package/esm2022/src/pending_tasks.mjs +57 -0
  10. package/esm2022/src/platform/platform_ref.mjs +2 -2
  11. package/esm2022/src/render3/after_render_hooks.mjs +2 -2
  12. package/esm2022/src/render3/component_ref.mjs +13 -9
  13. package/esm2022/src/render3/instructions/mark_view_dirty.mjs +3 -2
  14. package/esm2022/src/render3/instructions/shared.mjs +3 -2
  15. package/esm2022/src/render3/interfaces/view.mjs +1 -1
  16. package/esm2022/src/render3/util/view_utils.mjs +18 -5
  17. package/esm2022/src/render3/view_ref.mjs +2 -1
  18. package/esm2022/src/version.mjs +6 -5
  19. package/esm2022/src/zone/ng_zone.mjs +1 -61
  20. package/esm2022/testing/src/logger.mjs +3 -3
  21. package/fesm2022/core.mjs +172 -136
  22. package/fesm2022/core.mjs.map +1 -1
  23. package/fesm2022/primitives/signals.mjs +1 -1
  24. package/fesm2022/rxjs-interop.mjs +1 -1
  25. package/fesm2022/testing.mjs +1 -1
  26. package/index.d.ts +38 -22
  27. package/package.json +1 -1
  28. package/primitives/signals/index.d.ts +1 -1
  29. package/rxjs-interop/index.d.ts +1 -1
  30. package/schematics/migrations/block-template-entities/bundle.js +268 -229
  31. package/schematics/migrations/block-template-entities/bundle.js.map +4 -4
  32. package/schematics/ng-generate/control-flow-migration/bundle.js +433 -295
  33. package/schematics/ng-generate/control-flow-migration/bundle.js.map +4 -4
  34. package/schematics/ng-generate/standalone-migration/bundle.js +276 -215
  35. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  36. package/testing/index.d.ts +1 -1
  37. package/esm2022/src/change_detection/scheduling.mjs +0 -103
  38. package/esm2022/src/initial_render_pending_tasks.mjs +0 -49
@@ -2369,7 +2369,7 @@ var ConstantPool = class {
2369
2369
  }))));
2370
2370
  }
2371
2371
  }
2372
- getSharedFunctionReference(fn2, prefix) {
2372
+ getSharedFunctionReference(fn2, prefix, useUniqueName = true) {
2373
2373
  var _a2;
2374
2374
  const isArrow = fn2 instanceof ArrowFunctionExpr;
2375
2375
  for (const current of this.statements) {
@@ -2380,7 +2380,7 @@ var ConstantPool = class {
2380
2380
  return variable(current.name);
2381
2381
  }
2382
2382
  }
2383
- const name = this.uniqueName(prefix);
2383
+ const name = useUniqueName ? this.uniqueName(prefix) : prefix;
2384
2384
  this.statements.push(fn2.toDeclStmt(name, StmtModifier.Final));
2385
2385
  return variable(name);
2386
2386
  }
@@ -4004,13 +4004,17 @@ var TagContentType;
4004
4004
  TagContentType2[TagContentType2["ESCAPABLE_RAW_TEXT"] = 1] = "ESCAPABLE_RAW_TEXT";
4005
4005
  TagContentType2[TagContentType2["PARSABLE_DATA"] = 2] = "PARSABLE_DATA";
4006
4006
  })(TagContentType || (TagContentType = {}));
4007
- function splitNsName(elementName) {
4007
+ function splitNsName(elementName, fatal = true) {
4008
4008
  if (elementName[0] != ":") {
4009
4009
  return [null, elementName];
4010
4010
  }
4011
4011
  const colonIndex = elementName.indexOf(":", 1);
4012
4012
  if (colonIndex === -1) {
4013
- throw new Error(`Unsupported format "${elementName}" expecting ":namespace:name"`);
4013
+ if (fatal) {
4014
+ throw new Error(`Unsupported format "${elementName}" expecting ":namespace:name"`);
4015
+ } else {
4016
+ return [null, elementName];
4017
+ }
4014
4018
  }
4015
4019
  return [elementName.slice(1, colonIndex), elementName.slice(colonIndex + 1)];
4016
4020
  }
@@ -7972,8 +7976,9 @@ var OpKind;
7972
7976
  OpKind2[OpKind2["I18nApply"] = 40] = "I18nApply";
7973
7977
  OpKind2[OpKind2["IcuStart"] = 41] = "IcuStart";
7974
7978
  OpKind2[OpKind2["IcuEnd"] = 42] = "IcuEnd";
7975
- OpKind2[OpKind2["I18nContext"] = 43] = "I18nContext";
7976
- OpKind2[OpKind2["I18nAttributes"] = 44] = "I18nAttributes";
7979
+ OpKind2[OpKind2["IcuPlaceholder"] = 43] = "IcuPlaceholder";
7980
+ OpKind2[OpKind2["I18nContext"] = 44] = "I18nContext";
7981
+ OpKind2[OpKind2["I18nAttributes"] = 45] = "I18nAttributes";
7977
7982
  })(OpKind || (OpKind = {}));
7978
7983
  var ExpressionKind;
7979
7984
  (function(ExpressionKind2) {
@@ -8277,15 +8282,15 @@ function createRepeaterOp(repeaterCreate2, targetSlot, collection, sourceSpan) {
8277
8282
  }, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
8278
8283
  }
8279
8284
  function createDeferWhenOp(target, expr, prefetch, sourceSpan) {
8280
- return __spreadValues(__spreadValues({
8285
+ return __spreadValues(__spreadValues(__spreadValues({
8281
8286
  kind: OpKind.DeferWhen,
8282
8287
  target,
8283
8288
  expr,
8284
8289
  prefetch,
8285
8290
  sourceSpan
8286
- }, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
8291
+ }, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS);
8287
8292
  }
8288
- function createI18nExpressionOp(context, target, i18nOwner, handle, expression, i18nPlaceholder, resolutionTime, usage, name, sourceSpan) {
8293
+ function createI18nExpressionOp(context, target, i18nOwner, handle, expression, icuPlaceholder, i18nPlaceholder, resolutionTime, usage, name, sourceSpan) {
8289
8294
  return __spreadValues(__spreadValues(__spreadValues({
8290
8295
  kind: OpKind.I18nExpression,
8291
8296
  context,
@@ -8293,6 +8298,7 @@ function createI18nExpressionOp(context, target, i18nOwner, handle, expression,
8293
8298
  i18nOwner,
8294
8299
  handle,
8295
8300
  expression,
8301
+ icuPlaceholder,
8296
8302
  i18nPlaceholder,
8297
8303
  resolutionTime,
8298
8304
  usage,
@@ -9025,6 +9031,9 @@ function transformExpressionsInOp(op, transform2, flags) {
9025
9031
  if (op.placeholderConfig !== null) {
9026
9032
  op.placeholderConfig = transformExpressionsInExpression(op.placeholderConfig, transform2, flags);
9027
9033
  }
9034
+ if (op.resolverFn !== null) {
9035
+ op.resolverFn = transformExpressionsInExpression(op.resolverFn, transform2, flags);
9036
+ }
9028
9037
  break;
9029
9038
  case OpKind.I18nMessage:
9030
9039
  for (const [placeholder, expr] of op.params) {
@@ -9061,6 +9070,7 @@ function transformExpressionsInOp(op, transform2, flags) {
9061
9070
  case OpKind.Template:
9062
9071
  case OpKind.Text:
9063
9072
  case OpKind.I18nAttributes:
9073
+ case OpKind.IcuPlaceholder:
9064
9074
  break;
9065
9075
  default:
9066
9076
  throw new Error(`AssertionError: transformExpressionsInOp doesn't handle ${OpKind[op.kind]}`);
@@ -9360,7 +9370,7 @@ var elementContainerOpKinds = /* @__PURE__ */ new Set([
9360
9370
  function isElementOrContainerOp(op) {
9361
9371
  return elementContainerOpKinds.has(op.kind);
9362
9372
  }
9363
- function createElementStartOp(tag, xref, namespace, i18nPlaceholder, sourceSpan) {
9373
+ function createElementStartOp(tag, xref, namespace, i18nPlaceholder, startSourceSpan, wholeSourceSpan) {
9364
9374
  return __spreadValues(__spreadValues({
9365
9375
  kind: OpKind.ElementStart,
9366
9376
  xref,
@@ -9371,10 +9381,11 @@ function createElementStartOp(tag, xref, namespace, i18nPlaceholder, sourceSpan)
9371
9381
  nonBindable: false,
9372
9382
  namespace,
9373
9383
  i18nPlaceholder,
9374
- sourceSpan
9384
+ startSourceSpan,
9385
+ wholeSourceSpan
9375
9386
  }, TRAIT_CONSUMES_SLOT), NEW_OP);
9376
9387
  }
9377
- function createTemplateOp(xref, templateKind, tag, functionNameSuffix, namespace, i18nPlaceholder, sourceSpan) {
9388
+ function createTemplateOp(xref, templateKind, tag, functionNameSuffix, namespace, i18nPlaceholder, startSourceSpan, wholeSourceSpan) {
9378
9389
  return __spreadValues(__spreadValues({
9379
9390
  kind: OpKind.Template,
9380
9391
  xref,
@@ -9389,11 +9400,12 @@ function createTemplateOp(xref, templateKind, tag, functionNameSuffix, namespace
9389
9400
  nonBindable: false,
9390
9401
  namespace,
9391
9402
  i18nPlaceholder,
9392
- sourceSpan
9403
+ startSourceSpan,
9404
+ wholeSourceSpan
9393
9405
  }, TRAIT_CONSUMES_SLOT), NEW_OP);
9394
9406
  }
9395
- function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, i18nPlaceholder, emptyI18nPlaceholder, sourceSpan) {
9396
- return __spreadProps(__spreadValues(__spreadValues({
9407
+ function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, i18nPlaceholder, emptyI18nPlaceholder, startSourceSpan, wholeSourceSpan) {
9408
+ return __spreadProps(__spreadValues(__spreadValues(__spreadValues({
9397
9409
  kind: OpKind.RepeaterCreate,
9398
9410
  attributes: null,
9399
9411
  xref: primaryView,
@@ -9412,8 +9424,9 @@ function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, i1
9412
9424
  usesComponentInstance: false,
9413
9425
  i18nPlaceholder,
9414
9426
  emptyI18nPlaceholder,
9415
- sourceSpan
9416
- }, TRAIT_CONSUMES_SLOT), NEW_OP), {
9427
+ startSourceSpan,
9428
+ wholeSourceSpan
9429
+ }, TRAIT_CONSUMES_SLOT), NEW_OP), TRAIT_CONSUMES_VARS), {
9417
9430
  numSlotsUsed: emptyView === null ? 2 : 3
9418
9431
  });
9419
9432
  }
@@ -9436,12 +9449,13 @@ function createEnableBindingsOp(xref) {
9436
9449
  xref
9437
9450
  }, NEW_OP);
9438
9451
  }
9439
- function createTextOp(xref, initialValue, sourceSpan) {
9452
+ function createTextOp(xref, initialValue, icuPlaceholder, sourceSpan) {
9440
9453
  return __spreadValues(__spreadValues({
9441
9454
  kind: OpKind.Text,
9442
9455
  xref,
9443
9456
  handle: new SlotHandle(),
9444
9457
  initialValue,
9458
+ icuPlaceholder,
9445
9459
  sourceSpan
9446
9460
  }, TRAIT_CONSUMES_SLOT), NEW_OP);
9447
9461
  }
@@ -9592,6 +9606,15 @@ function createIcuEndOp(xref) {
9592
9606
  xref
9593
9607
  }, NEW_OP);
9594
9608
  }
9609
+ function createIcuPlaceholderOp(xref, name, strings) {
9610
+ return __spreadValues({
9611
+ kind: OpKind.IcuPlaceholder,
9612
+ xref,
9613
+ name,
9614
+ strings,
9615
+ expressionPlaceholders: []
9616
+ }, NEW_OP);
9617
+ }
9595
9618
  function createI18nContextOp(contextKind, xref, i18nBlock, message, sourceSpan) {
9596
9619
  if (i18nBlock === null && contextKind !== I18nContextKind.Attr) {
9597
9620
  throw new Error("AssertionError: i18nBlock must be provided for non-attribute contexts.");
@@ -9939,15 +9962,9 @@ function extractAttributeOp(unit, op, elements) {
9939
9962
  if (op.expression instanceof Interpolation2) {
9940
9963
  return;
9941
9964
  }
9942
- let extractable = op.expression.isConstant();
9965
+ let extractable = op.isTextAttribute || op.expression.isConstant();
9943
9966
  if (unit.job.compatibility === CompatibilityMode.TemplateDefinitionBuilder) {
9944
- extractable = isStringLiteral(op.expression);
9945
- if (op.name === "style" || op.name === "class") {
9946
- extractable && (extractable = op.isTextAttribute);
9947
- }
9948
- if (unit.job.kind === CompilationJobKind.Host) {
9949
- extractable && (extractable = op.isTextAttribute);
9950
- }
9967
+ extractable && (extractable = op.isTextAttribute);
9951
9968
  }
9952
9969
  if (extractable) {
9953
9970
  const extractedAttributeOp = createExtractedAttributeOp(op.target, op.isStructuralTemplateAttribute ? BindingKind.Template : BindingKind.Attribute, op.name, op.expression, op.i18nContext, op.i18nMessage, op.securityContext);
@@ -10182,7 +10199,7 @@ function collectElementConsts(job) {
10182
10199
  for (const unit of job.units) {
10183
10200
  for (const op of unit.create) {
10184
10201
  if (op.kind === OpKind.ExtractedAttribute) {
10185
- const attributes = allElementAttributes.get(op.target) || new ElementAttributes();
10202
+ const attributes = allElementAttributes.get(op.target) || new ElementAttributes(job.compatibility);
10186
10203
  allElementAttributes.set(op.target, attributes);
10187
10204
  attributes.add(op.bindingKind, op.name, op.expression, op.trustedValueFn);
10188
10205
  OpList.remove(op);
@@ -10217,11 +10234,6 @@ function collectElementConsts(job) {
10217
10234
  }
10218
10235
  var FLYWEIGHT_ARRAY = Object.freeze([]);
10219
10236
  var ElementAttributes = class {
10220
- constructor() {
10221
- this.known = /* @__PURE__ */ new Set();
10222
- this.byKind = /* @__PURE__ */ new Map();
10223
- this.projectAs = null;
10224
- }
10225
10237
  get attributes() {
10226
10238
  var _a2;
10227
10239
  return (_a2 = this.byKind.get(BindingKind.Attribute)) != null ? _a2 : FLYWEIGHT_ARRAY;
@@ -10246,12 +10258,28 @@ var ElementAttributes = class {
10246
10258
  var _a2;
10247
10259
  return (_a2 = this.byKind.get(BindingKind.I18n)) != null ? _a2 : FLYWEIGHT_ARRAY;
10248
10260
  }
10261
+ constructor(compatibility) {
10262
+ this.compatibility = compatibility;
10263
+ this.known = /* @__PURE__ */ new Map();
10264
+ this.byKind = /* @__PURE__ */ new Map();
10265
+ this.projectAs = null;
10266
+ }
10267
+ isKnown(kind, name, value) {
10268
+ var _a2;
10269
+ const nameToValue = (_a2 = this.known.get(kind)) != null ? _a2 : /* @__PURE__ */ new Set();
10270
+ this.known.set(kind, nameToValue);
10271
+ if (nameToValue.has(name)) {
10272
+ return true;
10273
+ }
10274
+ nameToValue.add(name);
10275
+ return false;
10276
+ }
10249
10277
  add(kind, name, value, trustedValueFn) {
10250
10278
  var _a2;
10251
- if (this.known.has(name)) {
10279
+ const allowDuplicates = this.compatibility === CompatibilityMode.TemplateDefinitionBuilder && (kind === BindingKind.Attribute || kind === BindingKind.ClassName || kind === BindingKind.StyleProperty);
10280
+ if (!allowDuplicates && this.isKnown(kind, name, value)) {
10252
10281
  return;
10253
10282
  }
10254
- this.known.add(name);
10255
10283
  if (name === "ngProjectAs") {
10256
10284
  if (value === null || !(value instanceof LiteralExpr) || value.value == null || typeof ((_a2 = value.value) == null ? void 0 : _a2.toString()) !== "string") {
10257
10285
  throw Error("ngProjectAs must have a string literal value");
@@ -10282,7 +10310,7 @@ var ElementAttributes = class {
10282
10310
  }
10283
10311
  };
10284
10312
  function getAttributeNameLiterals(name) {
10285
- const [attributeNamespace, attributeName] = splitNsName(name);
10313
+ const [attributeNamespace, attributeName] = splitNsName(name, false);
10286
10314
  const nameLiteral = literal(attributeName);
10287
10315
  if (attributeNamespace) {
10288
10316
  return [
@@ -10349,7 +10377,7 @@ function convertI18nBindings(job) {
10349
10377
  if (op.expression.i18nPlaceholders.length !== op.expression.expressions.length) {
10350
10378
  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`);
10351
10379
  }
10352
- ops.push(createI18nExpressionOp(op.i18nContext, i18nAttributesForElem.target, i18nAttributesForElem.xref, i18nAttributesForElem.handle, expr, op.expression.i18nPlaceholders[i], I18nParamResolutionTime.Creation, I18nExpressionFor.I18nAttribute, op.name, op.sourceSpan));
10380
+ 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));
10353
10381
  }
10354
10382
  OpList.replaceWithMany(op, ops);
10355
10383
  break;
@@ -10380,7 +10408,11 @@ function createDeferDepsFns(job) {
10380
10408
  if (op.handle.slot === null) {
10381
10409
  throw new Error("AssertionError: slot must be assigned bfore extracting defer deps functions");
10382
10410
  }
10383
- op.resolverFn = job.pool.getSharedFunctionReference(depsFnExpr, `${job.componentName}_Defer_${op.handle.slot}_DepsFn`);
10411
+ op.resolverFn = job.pool.getSharedFunctionReference(
10412
+ depsFnExpr,
10413
+ `${job.componentName}_Defer_${op.handle.slot}_DepsFn`,
10414
+ false
10415
+ );
10384
10416
  }
10385
10417
  }
10386
10418
  }
@@ -10388,62 +10420,99 @@ function createDeferDepsFns(job) {
10388
10420
 
10389
10421
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/create_i18n_contexts.mjs
10390
10422
  function createI18nContexts(job) {
10391
- const rootContexts = /* @__PURE__ */ new Map();
10392
- let currentI18nOp = null;
10393
- let xref;
10394
- const messageToContext = /* @__PURE__ */ new Map();
10423
+ const attrContextByMessage = /* @__PURE__ */ new Map();
10424
+ for (const unit of job.units) {
10425
+ for (const op of unit.ops()) {
10426
+ switch (op.kind) {
10427
+ case OpKind.Binding:
10428
+ case OpKind.Property:
10429
+ case OpKind.Attribute:
10430
+ case OpKind.ExtractedAttribute:
10431
+ if (op.i18nMessage === null) {
10432
+ continue;
10433
+ }
10434
+ if (!attrContextByMessage.has(op.i18nMessage)) {
10435
+ const i18nContext = createI18nContextOp(I18nContextKind.Attr, job.allocateXrefId(), null, op.i18nMessage, null);
10436
+ unit.create.push(i18nContext);
10437
+ attrContextByMessage.set(op.i18nMessage, i18nContext.xref);
10438
+ }
10439
+ op.i18nContext = attrContextByMessage.get(op.i18nMessage);
10440
+ break;
10441
+ }
10442
+ }
10443
+ }
10444
+ const blockContextByI18nBlock = /* @__PURE__ */ new Map();
10395
10445
  for (const unit of job.units) {
10396
10446
  for (const op of unit.create) {
10397
10447
  switch (op.kind) {
10398
10448
  case OpKind.I18nStart:
10399
- currentI18nOp = op;
10400
10449
  if (op.xref === op.root) {
10401
- xref = job.allocateXrefId();
10402
- unit.create.push(createI18nContextOp(I18nContextKind.RootI18n, xref, op.xref, op.message, null));
10403
- op.context = xref;
10404
- rootContexts.set(op.xref, xref);
10450
+ const contextOp = createI18nContextOp(I18nContextKind.RootI18n, job.allocateXrefId(), op.xref, op.message, null);
10451
+ unit.create.push(contextOp);
10452
+ op.context = contextOp.xref;
10453
+ blockContextByI18nBlock.set(op.xref, contextOp);
10405
10454
  }
10406
10455
  break;
10456
+ }
10457
+ }
10458
+ }
10459
+ for (const unit of job.units) {
10460
+ for (const op of unit.create) {
10461
+ if (op.kind === OpKind.I18nStart && op.xref !== op.root) {
10462
+ const rootContext = blockContextByI18nBlock.get(op.root);
10463
+ if (rootContext === void 0) {
10464
+ throw Error("AssertionError: Root i18n block i18n context should have been created.");
10465
+ }
10466
+ op.context = rootContext.xref;
10467
+ blockContextByI18nBlock.set(op.xref, rootContext);
10468
+ }
10469
+ }
10470
+ }
10471
+ let currentI18nOp = null;
10472
+ for (const unit of job.units) {
10473
+ for (const op of unit.create) {
10474
+ switch (op.kind) {
10475
+ case OpKind.I18nStart:
10476
+ currentI18nOp = op;
10477
+ break;
10407
10478
  case OpKind.I18nEnd:
10408
10479
  currentI18nOp = null;
10409
10480
  break;
10410
10481
  case OpKind.IcuStart:
10411
10482
  if (currentI18nOp === null) {
10412
- throw Error("Unexpected ICU outside of an i18n block.");
10483
+ throw Error("AssertionError: Unexpected ICU outside of an i18n block.");
10413
10484
  }
10414
10485
  if (op.message.id !== currentI18nOp.message.id) {
10415
- xref = job.allocateXrefId();
10416
- unit.create.push(createI18nContextOp(I18nContextKind.Icu, xref, currentI18nOp.xref, op.message, null));
10417
- op.context = xref;
10486
+ const contextOp = createI18nContextOp(I18nContextKind.Icu, job.allocateXrefId(), currentI18nOp.xref, op.message, null);
10487
+ unit.create.push(contextOp);
10488
+ op.context = contextOp.xref;
10418
10489
  } else {
10419
10490
  op.context = currentI18nOp.context;
10491
+ blockContextByI18nBlock.get(currentI18nOp.xref).contextKind = I18nContextKind.Icu;
10420
10492
  }
10421
10493
  break;
10422
10494
  }
10423
10495
  }
10424
- for (const op of unit.ops()) {
10425
- switch (op.kind) {
10426
- case OpKind.Binding:
10427
- case OpKind.Property:
10428
- case OpKind.Attribute:
10429
- case OpKind.ExtractedAttribute:
10430
- if (!op.i18nMessage) {
10431
- continue;
10432
- }
10433
- if (!messageToContext.has(op.i18nMessage)) {
10434
- const i18nContext = job.allocateXrefId();
10435
- unit.create.push(createI18nContextOp(I18nContextKind.Attr, i18nContext, null, op.i18nMessage, null));
10436
- messageToContext.set(op.i18nMessage, i18nContext);
10437
- }
10438
- op.i18nContext = messageToContext.get(op.i18nMessage);
10439
- break;
10440
- }
10441
- }
10442
10496
  }
10497
+ }
10498
+
10499
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/deduplicate_text_bindings.mjs
10500
+ function deduplicateTextBindings(job) {
10501
+ const seen = /* @__PURE__ */ new Map();
10443
10502
  for (const unit of job.units) {
10444
- for (const op of unit.create) {
10445
- if (op.kind === OpKind.I18nStart && op.xref !== op.root) {
10446
- op.context = rootContexts.get(op.root);
10503
+ for (const op of unit.update.reversed()) {
10504
+ if (op.kind === OpKind.Binding && op.isTextAttribute) {
10505
+ const seenForElement = seen.get(op.target) || /* @__PURE__ */ new Set();
10506
+ if (seenForElement.has(op.name)) {
10507
+ if (job.compatibility === CompatibilityMode.TemplateDefinitionBuilder) {
10508
+ if (op.name === "style" || op.name === "class") {
10509
+ OpList.remove(op);
10510
+ }
10511
+ } else {
10512
+ }
10513
+ }
10514
+ seenForElement.add(op.name);
10515
+ seen.set(op.target, seenForElement);
10447
10516
  }
10448
10517
  }
10449
10518
  }
@@ -10733,12 +10802,16 @@ var LIST_START_MARKER = "[";
10733
10802
  var LIST_END_MARKER = "]";
10734
10803
  var LIST_DELIMITER = "|";
10735
10804
  function extractI18nMessages(job) {
10736
- const i18nContexts = /* @__PURE__ */ new Map();
10805
+ const i18nMessagesByContext = /* @__PURE__ */ new Map();
10737
10806
  const i18nBlocks = /* @__PURE__ */ new Map();
10807
+ const i18nContexts = /* @__PURE__ */ new Map();
10738
10808
  for (const unit of job.units) {
10739
10809
  for (const op of unit.create) {
10740
10810
  switch (op.kind) {
10741
10811
  case OpKind.I18nContext:
10812
+ const i18nMessageOp = createI18nMessage(job, op);
10813
+ unit.create.push(i18nMessageOp);
10814
+ i18nMessagesByContext.set(op.xref, i18nMessageOp);
10742
10815
  i18nContexts.set(op.xref, op);
10743
10816
  break;
10744
10817
  case OpKind.I18nStart:
@@ -10747,49 +10820,40 @@ function extractI18nMessages(job) {
10747
10820
  }
10748
10821
  }
10749
10822
  }
10750
- for (const unit of job.units) {
10751
- for (const op of unit.create) {
10752
- if (op.kind !== OpKind.I18nContext || op.contextKind !== I18nContextKind.Attr) {
10753
- continue;
10754
- }
10755
- const i18nMessageOp = createI18nMessage(job, op);
10756
- unit.create.push(i18nMessageOp);
10757
- }
10758
- }
10759
- const i18nBlockMessages = /* @__PURE__ */ new Map();
10760
- for (const unit of job.units) {
10761
- for (const op of unit.create) {
10762
- if (op.kind === OpKind.I18nStart && op.xref === op.root) {
10763
- if (!op.context) {
10764
- throw Error("I18n start op should have its context set.");
10765
- }
10766
- const i18nMessageOp = createI18nMessage(job, i18nContexts.get(op.context));
10767
- i18nBlockMessages.set(op.xref, i18nMessageOp);
10768
- unit.create.push(i18nMessageOp);
10769
- }
10770
- }
10771
- }
10823
+ let currentIcu = null;
10772
10824
  for (const unit of job.units) {
10773
10825
  for (const op of unit.create) {
10774
10826
  switch (op.kind) {
10775
10827
  case OpKind.IcuStart:
10776
- if (!op.context) {
10777
- throw Error("ICU op should have its context set.");
10828
+ currentIcu = op;
10829
+ OpList.remove(op);
10830
+ const icuContext = i18nContexts.get(op.context);
10831
+ if (icuContext.contextKind !== I18nContextKind.Icu) {
10832
+ continue;
10778
10833
  }
10779
- const i18nContext = i18nContexts.get(op.context);
10780
- if (i18nContext.contextKind === I18nContextKind.Icu) {
10781
- if (i18nContext.i18nBlock === null) {
10782
- throw Error("ICU context should have its i18n block set.");
10783
- }
10784
- const subMessage = createI18nMessage(job, i18nContext, op.messagePlaceholder);
10785
- unit.create.push(subMessage);
10786
- const rootI18nId = i18nBlocks.get(i18nContext.i18nBlock).root;
10787
- const parentMessage = i18nBlockMessages.get(rootI18nId);
10788
- parentMessage == null ? void 0 : parentMessage.subMessages.push(subMessage.xref);
10834
+ const i18nBlock = i18nBlocks.get(icuContext.i18nBlock);
10835
+ if (i18nBlock.context === icuContext.xref) {
10836
+ continue;
10789
10837
  }
10790
- OpList.remove(op);
10838
+ const rootI18nBlock = i18nBlocks.get(i18nBlock.root);
10839
+ const rootMessage = i18nMessagesByContext.get(rootI18nBlock.context);
10840
+ if (rootMessage === void 0) {
10841
+ throw Error("AssertionError: ICU sub-message should belong to a root message.");
10842
+ }
10843
+ const subMessage = i18nMessagesByContext.get(icuContext.xref);
10844
+ subMessage.messagePlaceholder = op.messagePlaceholder;
10845
+ rootMessage.subMessages.push(subMessage.xref);
10791
10846
  break;
10792
10847
  case OpKind.IcuEnd:
10848
+ currentIcu = null;
10849
+ OpList.remove(op);
10850
+ break;
10851
+ case OpKind.IcuPlaceholder:
10852
+ if (currentIcu === null || currentIcu.context == null) {
10853
+ throw Error("AssertionError: Unexpected ICU placeholder outside of i18n context");
10854
+ }
10855
+ const msg = i18nMessagesByContext.get(currentIcu.context);
10856
+ msg.postprocessingParams.set(op.name, literal(formatIcuPlaceholder(op)));
10793
10857
  OpList.remove(op);
10794
10858
  break;
10795
10859
  }
@@ -10799,14 +10863,16 @@ function extractI18nMessages(job) {
10799
10863
  function createI18nMessage(job, context, messagePlaceholder) {
10800
10864
  let formattedParams = formatParams(context.params);
10801
10865
  const formattedPostprocessingParams = formatParams(context.postprocessingParams);
10802
- let needsPostprocessing = formattedPostprocessingParams.size > 0;
10803
- for (const values of context.params.values()) {
10804
- if (values.length > 1) {
10805
- needsPostprocessing = true;
10806
- }
10807
- }
10866
+ let needsPostprocessing = [...context.params.values()].some((v) => v.length > 1);
10808
10867
  return createI18nMessageOp(job.allocateXrefId(), context.xref, context.i18nBlock, context.message, messagePlaceholder != null ? messagePlaceholder : null, formattedParams, formattedPostprocessingParams, needsPostprocessing);
10809
10868
  }
10869
+ function formatIcuPlaceholder(op) {
10870
+ if (op.strings.length !== op.expressionPlaceholders.length + 1) {
10871
+ throw Error(`AsserionError: Invalid ICU placeholder with ${op.strings.length} strings and ${op.expressionPlaceholders.length} expressions`);
10872
+ }
10873
+ const values = op.expressionPlaceholders.map(formatValue);
10874
+ return op.strings.flatMap((str, i) => [str, values[i] || ""]).join("");
10875
+ }
10810
10876
  function formatParams(params) {
10811
10877
  const formattedParams = /* @__PURE__ */ new Map();
10812
10878
  for (const [placeholder, placeholderValues] of params) {
@@ -11033,7 +11099,7 @@ var CLASS_BANG = "class!";
11033
11099
  var BANG_IMPORTANT = "!important";
11034
11100
  function parseHostStyleProperties(job) {
11035
11101
  for (const op of job.root.update) {
11036
- if (op.kind !== OpKind.Binding) {
11102
+ if (!(op.kind === OpKind.Binding && op.bindingKind === BindingKind.Property)) {
11037
11103
  continue;
11038
11104
  }
11039
11105
  if (op.name.endsWith(BANG_IMPORTANT)) {
@@ -17134,7 +17200,7 @@ function collectMessage(job, fileBasedI18nSuffix, messages, messageOp) {
17134
17200
  const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX2));
17135
17201
  const closureVar = i18nGenerateClosureVar(job.pool, messageOp.message.id, fileBasedI18nSuffix, job.i18nUseExternalIds);
17136
17202
  let transformFn = void 0;
17137
- if (messageOp.needsPostprocessing) {
17203
+ if (messageOp.needsPostprocessing || messageOp.postprocessingParams.size > 0) {
17138
17204
  const postprocessingParams = Object.fromEntries([...messageOp.postprocessingParams.entries()].sort());
17139
17205
  const formattedPostprocessingParams = formatI18nPlaceholderNamesInMap(postprocessingParams, false);
17140
17206
  const extraTransformFnParams = [];
@@ -17153,7 +17219,6 @@ function addSubMessageParams(messageOp, subMessagePlaceholders) {
17153
17219
  } else {
17154
17220
  messageOp.params.set(placeholder, literal(`${ESCAPE2}${I18N_ICU_MAPPING_PREFIX2}${placeholder}${ESCAPE2}`));
17155
17221
  messageOp.postprocessingParams.set(placeholder, literalArr(subMessages));
17156
- messageOp.needsPostprocessing = true;
17157
17222
  }
17158
17223
  }
17159
17224
  }
@@ -17187,12 +17252,13 @@ function i18nGenerateClosureVar(pool, messageId, fileBasedI18nSuffix, useExterna
17187
17252
 
17188
17253
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_text_extraction.mjs
17189
17254
  function convertI18nText(job) {
17190
- var _a2;
17255
+ var _a2, _b2, _c2;
17191
17256
  for (const unit of job.units) {
17192
17257
  let currentI18n = null;
17193
17258
  let currentIcu = null;
17194
17259
  const textNodeI18nBlocks = /* @__PURE__ */ new Map();
17195
17260
  const textNodeIcus = /* @__PURE__ */ new Map();
17261
+ const icuPlaceholderByText = /* @__PURE__ */ new Map();
17196
17262
  for (const op of unit.create) {
17197
17263
  switch (op.kind) {
17198
17264
  case OpKind.I18nStart:
@@ -17217,7 +17283,13 @@ function convertI18nText(job) {
17217
17283
  if (currentI18n !== null) {
17218
17284
  textNodeI18nBlocks.set(op.xref, currentI18n);
17219
17285
  textNodeIcus.set(op.xref, currentIcu);
17220
- OpList.remove(op);
17286
+ if (op.icuPlaceholder !== null) {
17287
+ const icuPlaceholderOp = createIcuPlaceholderOp(job.allocateXrefId(), op.icuPlaceholder, [op.initialValue]);
17288
+ OpList.replace(op, icuPlaceholderOp);
17289
+ icuPlaceholderByText.set(op.xref, icuPlaceholderOp);
17290
+ } else {
17291
+ OpList.remove(op);
17292
+ }
17221
17293
  }
17222
17294
  break;
17223
17295
  }
@@ -17230,14 +17302,18 @@ function convertI18nText(job) {
17230
17302
  }
17231
17303
  const i18nOp = textNodeI18nBlocks.get(op.target);
17232
17304
  const icuOp = textNodeIcus.get(op.target);
17305
+ const icuPlaceholder = icuPlaceholderByText.get(op.target);
17233
17306
  const contextId = icuOp ? icuOp.context : i18nOp.context;
17234
17307
  const resolutionTime = icuOp ? I18nParamResolutionTime.Postproccessing : I18nParamResolutionTime.Creation;
17235
17308
  const ops = [];
17236
17309
  for (let i = 0; i < op.interpolation.expressions.length; i++) {
17237
17310
  const expr = op.interpolation.expressions[i];
17238
- 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));
17311
+ 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));
17239
17312
  }
17240
17313
  OpList.replaceWithMany(op, ops);
17314
+ if (icuPlaceholder !== void 0) {
17315
+ icuPlaceholder.strings = op.interpolation.strings;
17316
+ }
17241
17317
  break;
17242
17318
  }
17243
17319
  }
@@ -17651,9 +17727,21 @@ function keepLast(ops) {
17651
17727
 
17652
17728
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/parse_extracted_styles.mjs
17653
17729
  function parseExtractedStyles(job) {
17730
+ const elements = /* @__PURE__ */ new Map();
17731
+ for (const unit of job.units) {
17732
+ for (const op of unit.create) {
17733
+ if (isElementOrContainerOp(op)) {
17734
+ elements.set(op.xref, op);
17735
+ }
17736
+ }
17737
+ }
17654
17738
  for (const unit of job.units) {
17655
17739
  for (const op of unit.create) {
17656
17740
  if (op.kind === OpKind.ExtractedAttribute && op.bindingKind === BindingKind.Attribute && isStringLiteral(op.expression)) {
17741
+ const target = elements.get(op.target);
17742
+ if (target !== void 0 && target.kind === OpKind.Template && target.templateKind === TemplateKind.Structural) {
17743
+ continue;
17744
+ }
17657
17745
  if (op.name === "style") {
17658
17746
  const parsedStyles = parse(op.expression.value);
17659
17747
  for (let i = 0; i < parsedStyles.length - 1; i += 2) {
@@ -18447,19 +18535,19 @@ function reifyCreateOperations(unit, ops) {
18447
18535
  OpList.replace(op, text(op.handle.slot, op.initialValue, op.sourceSpan));
18448
18536
  break;
18449
18537
  case OpKind.ElementStart:
18450
- OpList.replace(op, elementStart(op.handle.slot, op.tag, op.attributes, op.localRefs, op.sourceSpan));
18538
+ OpList.replace(op, elementStart(op.handle.slot, op.tag, op.attributes, op.localRefs, op.startSourceSpan));
18451
18539
  break;
18452
18540
  case OpKind.Element:
18453
- OpList.replace(op, element(op.handle.slot, op.tag, op.attributes, op.localRefs, op.sourceSpan));
18541
+ OpList.replace(op, element(op.handle.slot, op.tag, op.attributes, op.localRefs, op.wholeSourceSpan));
18454
18542
  break;
18455
18543
  case OpKind.ElementEnd:
18456
18544
  OpList.replace(op, elementEnd(op.sourceSpan));
18457
18545
  break;
18458
18546
  case OpKind.ContainerStart:
18459
- OpList.replace(op, elementContainerStart(op.handle.slot, op.attributes, op.localRefs, op.sourceSpan));
18547
+ OpList.replace(op, elementContainerStart(op.handle.slot, op.attributes, op.localRefs, op.startSourceSpan));
18460
18548
  break;
18461
18549
  case OpKind.Container:
18462
- OpList.replace(op, elementContainer(op.handle.slot, op.attributes, op.localRefs, op.sourceSpan));
18550
+ OpList.replace(op, elementContainer(op.handle.slot, op.attributes, op.localRefs, op.wholeSourceSpan));
18463
18551
  break;
18464
18552
  case OpKind.ContainerEnd:
18465
18553
  OpList.replace(op, elementContainerEnd());
@@ -18487,7 +18575,7 @@ function reifyCreateOperations(unit, ops) {
18487
18575
  throw new Error(`AssertionError: local refs array should have been extracted into a constant`);
18488
18576
  }
18489
18577
  const childView = unit.job.views.get(op.xref);
18490
- OpList.replace(op, template(op.handle.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.attributes, op.localRefs, op.sourceSpan));
18578
+ OpList.replace(op, template(op.handle.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.attributes, op.localRefs, op.startSourceSpan));
18491
18579
  break;
18492
18580
  case OpKind.DisableBindings:
18493
18581
  OpList.replace(op, disableBindings2());
@@ -18502,7 +18590,7 @@ function reifyCreateOperations(unit, ops) {
18502
18590
  const listenerFn = reifyListenerHandler(unit, op.handlerFnName, op.handlerOps, op.consumesDollarEvent);
18503
18591
  const eventTargetResolver = op.eventTarget ? GLOBAL_TARGET_RESOLVERS.get(op.eventTarget) : null;
18504
18592
  if (eventTargetResolver === void 0) {
18505
- throw new Error(`AssertionError: unknown event target ${op.eventTarget}`);
18593
+ throw new Error(`Unexpected global target '${op.eventTarget}' defined for '${op.name}' event. Supported list of global targets: window,document,body.`);
18506
18594
  }
18507
18595
  OpList.replace(op, listener(op.name, listenerFn, eventTargetResolver, op.hostListener && op.isAnimationListener, op.sourceSpan));
18508
18596
  break;
@@ -18589,7 +18677,7 @@ function reifyCreateOperations(unit, ops) {
18589
18677
  emptyDecls = emptyView.decls;
18590
18678
  emptyVars = emptyView.vars;
18591
18679
  }
18592
- 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));
18680
+ 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));
18593
18681
  break;
18594
18682
  case OpKind.Statement:
18595
18683
  break;
@@ -19096,6 +19184,7 @@ function resolveI18nExpressionPlaceholders(job) {
19096
19184
  var _a2;
19097
19185
  const subTemplateIndicies = /* @__PURE__ */ new Map();
19098
19186
  const i18nContexts = /* @__PURE__ */ new Map();
19187
+ const icuPlaceholders = /* @__PURE__ */ new Map();
19099
19188
  for (const unit of job.units) {
19100
19189
  for (const op of unit.create) {
19101
19190
  switch (op.kind) {
@@ -19105,6 +19194,9 @@ function resolveI18nExpressionPlaceholders(job) {
19105
19194
  case OpKind.I18nContext:
19106
19195
  i18nContexts.set(op.xref, op);
19107
19196
  break;
19197
+ case OpKind.IcuPlaceholder:
19198
+ icuPlaceholders.set(op.xref, op);
19199
+ break;
19108
19200
  }
19109
19201
  }
19110
19202
  }
@@ -19113,66 +19205,32 @@ function resolveI18nExpressionPlaceholders(job) {
19113
19205
  for (const unit of job.units) {
19114
19206
  for (const op of unit.update) {
19115
19207
  if (op.kind === OpKind.I18nExpression) {
19116
- const i18nContext = i18nContexts.get(op.context);
19117
19208
  const index = expressionIndices.get(referenceIndex(op)) || 0;
19118
19209
  const subTemplateIndex = (_a2 = subTemplateIndicies.get(op.i18nOwner)) != null ? _a2 : null;
19119
- const params = op.resolutionTime === I18nParamResolutionTime.Creation ? i18nContext.params : i18nContext.postprocessingParams;
19120
- const values = params.get(op.i18nPlaceholder) || [];
19121
- values.push({
19210
+ const value = {
19122
19211
  value: index,
19123
19212
  subTemplateIndex,
19124
19213
  flags: I18nParamValueFlags.ExpressionIndex
19125
- });
19126
- params.set(op.i18nPlaceholder, values);
19214
+ };
19215
+ updatePlaceholder(op, value, i18nContexts, icuPlaceholders);
19127
19216
  expressionIndices.set(referenceIndex(op), index + 1);
19128
19217
  }
19129
19218
  }
19130
19219
  }
19131
19220
  }
19132
-
19133
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_icu_placeholders.mjs
19134
- function resolveI18nIcuPlaceholders(job) {
19135
- for (const unit of job.units) {
19136
- for (const op of unit.create) {
19137
- if (op.kind === OpKind.I18nContext && op.contextKind === I18nContextKind.Icu) {
19138
- for (const node of op.message.nodes) {
19139
- node.visit(new ResolveIcuPlaceholdersVisitor(op.postprocessingParams));
19140
- }
19141
- }
19142
- }
19143
- }
19144
- }
19145
- var ResolveIcuPlaceholdersVisitor = class extends RecurseVisitor {
19146
- constructor(params) {
19147
- super();
19148
- this.params = params;
19149
- }
19150
- visitContainerPlaceholder(placeholder) {
19151
- var _a2, _b2;
19152
- if (placeholder.startName && placeholder.startSourceSpan && !this.params.has(placeholder.startName)) {
19153
- this.params.set(placeholder.startName, [{
19154
- value: (_a2 = placeholder.startSourceSpan) == null ? void 0 : _a2.toString(),
19155
- subTemplateIndex: null,
19156
- flags: I18nParamValueFlags.None
19157
- }]);
19158
- }
19159
- if (placeholder.closeName && placeholder.endSourceSpan && !this.params.has(placeholder.closeName)) {
19160
- this.params.set(placeholder.closeName, [{
19161
- value: (_b2 = placeholder.endSourceSpan) == null ? void 0 : _b2.toString(),
19162
- subTemplateIndex: null,
19163
- flags: I18nParamValueFlags.None
19164
- }]);
19165
- }
19221
+ function updatePlaceholder(op, value, i18nContexts, icuPlaceholders) {
19222
+ if (op.i18nPlaceholder !== null) {
19223
+ const i18nContext = i18nContexts.get(op.context);
19224
+ const params = op.resolutionTime === I18nParamResolutionTime.Creation ? i18nContext.params : i18nContext.postprocessingParams;
19225
+ const values = params.get(op.i18nPlaceholder) || [];
19226
+ values.push(value);
19227
+ params.set(op.i18nPlaceholder, values);
19166
19228
  }
19167
- visitTagPlaceholder(placeholder) {
19168
- super.visitTagPlaceholder(placeholder);
19169
- this.visitContainerPlaceholder(placeholder);
19229
+ if (op.icuPlaceholder !== null) {
19230
+ const icuPlaceholderOp = icuPlaceholders.get(op.icuPlaceholder);
19231
+ icuPlaceholderOp == null ? void 0 : icuPlaceholderOp.expressionPlaceholders.push(value);
19170
19232
  }
19171
- visitBlockPlaceholder(placeholder) {
19172
- super.visitBlockPlaceholder(placeholder);
19173
- this.visitContainerPlaceholder(placeholder);
19174
- }
19175
- };
19233
+ }
19176
19234
 
19177
19235
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_names.mjs
19178
19236
  function resolveNames(job) {
@@ -19642,7 +19700,10 @@ function varsUsedByOp(op) {
19642
19700
  return op.interpolation.expressions.length;
19643
19701
  case OpKind.I18nExpression:
19644
19702
  case OpKind.Conditional:
19703
+ case OpKind.DeferWhen:
19645
19704
  return 1;
19705
+ case OpKind.RepeaterCreate:
19706
+ return op.emptyView ? 1 : 0;
19646
19707
  default:
19647
19708
  throw new Error(`Unhandled op: ${OpKind[op.kind]}`);
19648
19709
  }
@@ -19956,6 +20017,7 @@ var phases = [
19956
20017
  { kind: CompilationJobKind.Tmpl, fn: emitNamespaceChanges },
19957
20018
  { kind: CompilationJobKind.Tmpl, fn: propagateI18nBlocks },
19958
20019
  { kind: CompilationJobKind.Tmpl, fn: wrapI18nIcus },
20020
+ { kind: CompilationJobKind.Both, fn: deduplicateTextBindings },
19959
20021
  { kind: CompilationJobKind.Both, fn: specializeStyleBindings },
19960
20022
  { kind: CompilationJobKind.Both, fn: specializeBindings },
19961
20023
  { kind: CompilationJobKind.Both, fn: extractAttributes },
@@ -19994,7 +20056,6 @@ var phases = [
19994
20056
  { kind: CompilationJobKind.Tmpl, fn: createDeferDepsFns },
19995
20057
  { kind: CompilationJobKind.Tmpl, fn: resolveI18nElementPlaceholders },
19996
20058
  { kind: CompilationJobKind.Tmpl, fn: resolveI18nExpressionPlaceholders },
19997
- { kind: CompilationJobKind.Tmpl, fn: resolveI18nIcuPlaceholders },
19998
20059
  { kind: CompilationJobKind.Tmpl, fn: extractI18nMessages },
19999
20060
  { kind: CompilationJobKind.Tmpl, fn: generateTrackFns },
20000
20061
  { kind: CompilationJobKind.Tmpl, fn: collectI18nConsts },
@@ -20137,7 +20198,7 @@ function ingestHostBinding(input, bindingParser, constantPool) {
20137
20198
  bindingKind = BindingKind.Animation;
20138
20199
  }
20139
20200
  const securityContexts = bindingParser.calcPossibleSecurityContexts(input.componentSelector, property2.name, bindingKind === BindingKind.Attribute).filter((context) => context !== SecurityContext.NONE);
20140
- ingestHostProperty(job, property2, bindingKind, false, securityContexts);
20201
+ ingestHostProperty(job, property2, bindingKind, securityContexts);
20141
20202
  }
20142
20203
  for (const [name, expr] of (_b2 = Object.entries(input.attributes)) != null ? _b2 : []) {
20143
20204
  const securityContexts = bindingParser.calcPossibleSecurityContexts(input.componentSelector, name, true).filter((context) => context !== SecurityContext.NONE);
@@ -20148,7 +20209,7 @@ function ingestHostBinding(input, bindingParser, constantPool) {
20148
20209
  }
20149
20210
  return job;
20150
20211
  }
20151
- function ingestHostProperty(job, property2, bindingKind, isTextAttribute, securityContexts) {
20212
+ function ingestHostProperty(job, property2, bindingKind, securityContexts) {
20152
20213
  let expression;
20153
20214
  const ast = property2.expression.ast;
20154
20215
  if (ast instanceof Interpolation) {
@@ -20156,7 +20217,7 @@ function ingestHostProperty(job, property2, bindingKind, isTextAttribute, securi
20156
20217
  } else {
20157
20218
  expression = convertAst(ast, job, property2.sourceSpan);
20158
20219
  }
20159
- job.root.update.push(createBindingOp(job.root.xref, bindingKind, property2.name, expression, null, securityContexts, isTextAttribute, false, null, null, property2.sourceSpan));
20220
+ job.root.update.push(createBindingOp(job.root.xref, bindingKind, property2.name, expression, null, securityContexts, false, false, null, null, property2.sourceSpan));
20160
20221
  }
20161
20222
  function ingestHostAttribute(job, name, value, securityContexts) {
20162
20223
  const attrBinding = createBindingOp(
@@ -20170,14 +20231,13 @@ function ingestHostAttribute(job, name, value, securityContexts) {
20170
20231
  false,
20171
20232
  null,
20172
20233
  null,
20173
- null
20234
+ value.sourceSpan
20174
20235
  );
20175
20236
  job.root.update.push(attrBinding);
20176
20237
  }
20177
20238
  function ingestHostEvent(job, event) {
20178
20239
  const [phase, target] = event.type === 0 ? [null, event.targetOrPhase] : [event.targetOrPhase, null];
20179
- const eventBinding = createListenerOp(job.root.xref, new SlotHandle(), event.name, null, [], phase, target, true, event.sourceSpan);
20180
- eventBinding.handlerOps.push(createStatementOp(new ReturnStatement(convertAst(event.handler.ast, job, event.sourceSpan), event.handlerSpan)));
20240
+ const eventBinding = createListenerOp(job.root.xref, new SlotHandle(), event.name, null, makeListenerHandlerOps(job.root, event.handler, event.handlerSpan), phase, target, true, event.sourceSpan);
20181
20241
  job.root.create.push(eventBinding);
20182
20242
  }
20183
20243
  function ingestNodes(unit, template2) {
@@ -20189,9 +20249,9 @@ function ingestNodes(unit, template2) {
20189
20249
  } else if (node instanceof Content) {
20190
20250
  ingestContent(unit, node);
20191
20251
  } else if (node instanceof Text) {
20192
- ingestText(unit, node);
20252
+ ingestText(unit, node, null);
20193
20253
  } else if (node instanceof BoundText) {
20194
- ingestBoundText(unit, node);
20254
+ ingestBoundText(unit, node, null);
20195
20255
  } else if (node instanceof IfBlock) {
20196
20256
  ingestIfBlock(unit, node);
20197
20257
  } else if (node instanceof SwitchBlock) {
@@ -20214,7 +20274,7 @@ function ingestElement(unit, element2) {
20214
20274
  }
20215
20275
  const id = unit.job.allocateXrefId();
20216
20276
  const [namespaceKey, elementName] = splitNsName(element2.name);
20217
- const startOp = createElementStartOp(elementName, id, namespaceForKey(namespaceKey), element2.i18n instanceof TagPlaceholder ? element2.i18n : void 0, element2.startSourceSpan);
20277
+ const startOp = createElementStartOp(elementName, id, namespaceForKey(namespaceKey), element2.i18n instanceof TagPlaceholder ? element2.i18n : void 0, element2.startSourceSpan, element2.sourceSpan);
20218
20278
  unit.create.push(startOp);
20219
20279
  ingestElementBindings(unit, startOp, element2);
20220
20280
  ingestReferences(startOp, element2);
@@ -20244,7 +20304,7 @@ function ingestTemplate(unit, tmpl) {
20244
20304
  const namespace = namespaceForKey(namespacePrefix);
20245
20305
  const functionNameSuffix = tagNameWithoutNamespace === null ? "" : prefixWithNamespace(tagNameWithoutNamespace, namespace);
20246
20306
  const templateKind = isPlainTemplate(tmpl) ? TemplateKind.NgTemplate : TemplateKind.Structural;
20247
- const templateOp = createTemplateOp(childView.xref, templateKind, tagNameWithoutNamespace, functionNameSuffix, namespace, i18nPlaceholder, tmpl.startSourceSpan);
20307
+ const templateOp = createTemplateOp(childView.xref, templateKind, tagNameWithoutNamespace, functionNameSuffix, namespace, i18nPlaceholder, tmpl.startSourceSpan, tmpl.sourceSpan);
20248
20308
  unit.create.push(templateOp);
20249
20309
  ingestTemplateBindings(unit, templateOp, tmpl, templateKind);
20250
20310
  ingestReferences(templateOp, tmpl);
@@ -20270,10 +20330,10 @@ function ingestContent(unit, content) {
20270
20330
  }
20271
20331
  unit.create.push(op);
20272
20332
  }
20273
- function ingestText(unit, text2) {
20274
- unit.create.push(createTextOp(unit.job.allocateXrefId(), text2.value, text2.sourceSpan));
20333
+ function ingestText(unit, text2, icuPlaceholder) {
20334
+ unit.create.push(createTextOp(unit.job.allocateXrefId(), text2.value, icuPlaceholder, text2.sourceSpan));
20275
20335
  }
20276
- function ingestBoundText(unit, text2, i18nPlaceholders) {
20336
+ function ingestBoundText(unit, text2, icuPlaceholder) {
20277
20337
  var _a2;
20278
20338
  let value = text2.value;
20279
20339
  if (value instanceof ASTWithSource) {
@@ -20285,14 +20345,12 @@ function ingestBoundText(unit, text2, i18nPlaceholders) {
20285
20345
  if (text2.i18n !== void 0 && !(text2.i18n instanceof Container)) {
20286
20346
  throw Error(`Unhandled i18n metadata type for text interpolation: ${(_a2 = text2.i18n) == null ? void 0 : _a2.constructor.name}`);
20287
20347
  }
20288
- if (i18nPlaceholders === void 0) {
20289
- i18nPlaceholders = text2.i18n instanceof Container ? text2.i18n.children.filter((node) => node instanceof Placeholder).map((placeholder) => placeholder.name) : [];
20290
- }
20348
+ const i18nPlaceholders = text2.i18n instanceof Container ? text2.i18n.children.filter((node) => node instanceof Placeholder).map((placeholder) => placeholder.name) : [];
20291
20349
  if (i18nPlaceholders.length > 0 && i18nPlaceholders.length !== value.expressions.length) {
20292
20350
  throw Error(`Unexpected number of i18n placeholders (${value.expressions.length}) for BoundText with ${value.expressions.length} expressions`);
20293
20351
  }
20294
20352
  const textXref = unit.job.allocateXrefId();
20295
- unit.create.push(createTextOp(textXref, "", text2.sourceSpan));
20353
+ unit.create.push(createTextOp(textXref, "", icuPlaceholder, text2.sourceSpan));
20296
20354
  const baseSourceSpan = unit.job.compatibility ? null : text2.sourceSpan;
20297
20355
  unit.update.push(createInterpolateTextOp(textXref, new Interpolation2(value.strings, value.expressions.map((expr) => convertAst(expr, unit.job, baseSourceSpan)), i18nPlaceholders), text2.sourceSpan));
20298
20356
  }
@@ -20318,7 +20376,7 @@ function ingestIfBlock(unit, ifBlock) {
20318
20376
  }
20319
20377
  ifCaseI18nMeta = ifCase.i18n;
20320
20378
  }
20321
- const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, tagName, "Conditional", Namespace.HTML, ifCaseI18nMeta, ifCase.sourceSpan);
20379
+ const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, tagName, "Conditional", Namespace.HTML, ifCaseI18nMeta, ifCase.startSourceSpan, ifCase.sourceSpan);
20322
20380
  unit.create.push(templateOp);
20323
20381
  if (firstXref === null) {
20324
20382
  firstXref = cView.xref;
@@ -20346,7 +20404,7 @@ function ingestSwitchBlock(unit, switchBlock) {
20346
20404
  }
20347
20405
  switchCaseI18nMeta = switchCase.i18n;
20348
20406
  }
20349
- const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, null, "Case", Namespace.HTML, switchCaseI18nMeta, switchCase.sourceSpan);
20407
+ const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, null, "Case", Namespace.HTML, switchCaseI18nMeta, switchCase.startSourceSpan, switchCase.sourceSpan);
20350
20408
  unit.create.push(templateOp);
20351
20409
  if (firstXref === null) {
20352
20410
  firstXref = cView.xref;
@@ -20369,7 +20427,7 @@ function ingestDeferView(unit, suffix, i18nMeta, children, sourceSpan) {
20369
20427
  }
20370
20428
  const secondaryView = unit.job.allocateView(unit.xref);
20371
20429
  ingestNodes(secondaryView, children);
20372
- const templateOp = createTemplateOp(secondaryView.xref, TemplateKind.Block, null, `Defer${suffix}`, Namespace.HTML, i18nMeta, sourceSpan);
20430
+ const templateOp = createTemplateOp(secondaryView.xref, TemplateKind.Block, null, `Defer${suffix}`, Namespace.HTML, i18nMeta, sourceSpan, sourceSpan);
20373
20431
  unit.create.push(templateOp);
20374
20432
  return templateOp;
20375
20433
  }
@@ -20443,6 +20501,9 @@ function ingestDeferBlock(unit, deferBlock) {
20443
20501
  deferOnOps.push(deferOnOp);
20444
20502
  }
20445
20503
  if (triggers.when !== void 0) {
20504
+ if (triggers.when.value instanceof Interpolation) {
20505
+ throw new Error(`Unexpected interpolation in defer block when trigger`);
20506
+ }
20446
20507
  const deferOnOp = createDeferWhenOp(deferXref, convertAst(triggers.when.value, unit.job, triggers.when.sourceSpan), prefetch, triggers.when.sourceSpan);
20447
20508
  deferWhenOps.push(deferOnOp);
20448
20509
  }
@@ -20462,9 +20523,9 @@ function ingestIcu(unit, icu) {
20462
20523
  unit.create.push(createIcuStartOp(xref, icu.i18n, icuFromI18nMessage(icu.i18n).name, null));
20463
20524
  for (const [placeholder, text2] of Object.entries(__spreadValues(__spreadValues({}, icu.vars), icu.placeholders))) {
20464
20525
  if (text2 instanceof BoundText) {
20465
- ingestBoundText(unit, text2, [placeholder]);
20526
+ ingestBoundText(unit, text2, placeholder);
20466
20527
  } else {
20467
- ingestText(unit, text2);
20528
+ ingestText(unit, text2, placeholder);
20468
20529
  }
20469
20530
  }
20470
20531
  unit.create.push(createIcuEndOp(xref));
@@ -20516,7 +20577,7 @@ function ingestForBlock(unit, forBlock) {
20516
20577
  const i18nPlaceholder = forBlock.i18n;
20517
20578
  const emptyI18nPlaceholder = (_b2 = forBlock.empty) == null ? void 0 : _b2.i18n;
20518
20579
  const tagName = ingestControlFlowInsertionPoint(unit, repeaterView.xref, forBlock);
20519
- const repeaterCreate2 = createRepeaterCreateOp(repeaterView.xref, (_c2 = emptyView == null ? void 0 : emptyView.xref) != null ? _c2 : null, tagName, track, varNames, i18nPlaceholder, emptyI18nPlaceholder, forBlock.sourceSpan);
20580
+ const repeaterCreate2 = createRepeaterCreateOp(repeaterView.xref, (_c2 = emptyView == null ? void 0 : emptyView.xref) != null ? _c2 : null, tagName, track, varNames, i18nPlaceholder, emptyI18nPlaceholder, forBlock.startSourceSpan, forBlock.sourceSpan);
20520
20581
  unit.create.push(repeaterCreate2);
20521
20582
  const expression = convertAst(forBlock.expression, unit.job, convertSourceSpan(forBlock.expression.span, forBlock.sourceSpan));
20522
20583
  const repeater2 = createRepeaterOp(repeaterCreate2.xref, repeaterCreate2.handle, expression, forBlock.sourceSpan);
@@ -20604,13 +20665,13 @@ function convertAst(ast, job, baseSourceSpan) {
20604
20665
  throw new Error(`Unhandled expression type "${ast.constructor.name}" in file "${baseSourceSpan == null ? void 0 : baseSourceSpan.start.file.url}"`);
20605
20666
  }
20606
20667
  }
20607
- function convertAstWithInterpolation(job, value, i18nMeta) {
20668
+ function convertAstWithInterpolation(job, value, i18nMeta, sourceSpan) {
20608
20669
  var _a2, _b2;
20609
20670
  let expression;
20610
20671
  if (value instanceof Interpolation) {
20611
- 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 : {}));
20672
+ 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 : {}));
20612
20673
  } else if (value instanceof AST) {
20613
- expression = convertAst(value, job, null);
20674
+ expression = convertAst(value, job, sourceSpan != null ? sourceSpan : null);
20614
20675
  } else {
20615
20676
  expression = literal(value);
20616
20677
  }
@@ -24288,12 +24349,15 @@ var BindingScope = class {
24288
24349
  }
24289
24350
  };
24290
24351
  var TrackByBindingScope = class extends BindingScope {
24291
- constructor(parentScope, globalAliases) {
24352
+ constructor(parentScope, globalOverrides) {
24292
24353
  super(parentScope.bindingLevel + 1, parentScope);
24293
- this.globalAliases = globalAliases;
24354
+ this.globalOverrides = globalOverrides;
24294
24355
  this.componentAccessCount = 0;
24295
24356
  }
24296
24357
  get(name) {
24358
+ if (this.globalOverrides.hasOwnProperty(name)) {
24359
+ return variable(this.globalOverrides[name]);
24360
+ }
24297
24361
  let current = this.parent;
24298
24362
  while (current) {
24299
24363
  if (current.hasLocal(name)) {
@@ -24301,9 +24365,6 @@ var TrackByBindingScope = class extends BindingScope {
24301
24365
  }
24302
24366
  current = current.parent;
24303
24367
  }
24304
- if (this.globalAliases[name]) {
24305
- return variable(this.globalAliases[name]);
24306
- }
24307
24368
  this.componentAccessCount++;
24308
24369
  return variable("this").prop(name);
24309
24370
  }
@@ -26305,7 +26366,7 @@ function publishFacade(global) {
26305
26366
  }
26306
26367
 
26307
26368
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/version.mjs
26308
- var VERSION2 = new Version("17.0.7");
26369
+ var VERSION2 = new Version("17.0.8");
26309
26370
 
26310
26371
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
26311
26372
  var _I18N_ATTR = "i18n";
@@ -27371,7 +27432,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION = "12.0.0";
27371
27432
  function compileDeclareClassMetadata(metadata) {
27372
27433
  const definitionMap = new DefinitionMap();
27373
27434
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION));
27374
- definitionMap.set("version", literal("17.0.7"));
27435
+ definitionMap.set("version", literal("17.0.8"));
27375
27436
  definitionMap.set("ngImport", importExpr(Identifiers.core));
27376
27437
  definitionMap.set("type", metadata.type);
27377
27438
  definitionMap.set("decorators", metadata.decorators);
@@ -27442,7 +27503,7 @@ function createDirectiveDefinitionMap(meta) {
27442
27503
  const hasTransformFunctions = Object.values(meta.inputs).some((input) => input.transformFunction !== null);
27443
27504
  const minVersion = hasTransformFunctions ? MINIMUM_PARTIAL_LINKER_VERSION2 : "14.0.0";
27444
27505
  definitionMap.set("minVersion", literal(minVersion));
27445
- definitionMap.set("version", literal("17.0.7"));
27506
+ definitionMap.set("version", literal("17.0.8"));
27446
27507
  definitionMap.set("type", meta.type.value);
27447
27508
  if (meta.isStandalone) {
27448
27509
  definitionMap.set("isStandalone", literal(meta.isStandalone));
@@ -27674,7 +27735,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION3 = "12.0.0";
27674
27735
  function compileDeclareFactoryFunction(meta) {
27675
27736
  const definitionMap = new DefinitionMap();
27676
27737
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION3));
27677
- definitionMap.set("version", literal("17.0.7"));
27738
+ definitionMap.set("version", literal("17.0.8"));
27678
27739
  definitionMap.set("ngImport", importExpr(Identifiers.core));
27679
27740
  definitionMap.set("type", meta.type.value);
27680
27741
  definitionMap.set("deps", compileDependencies(meta.deps));
@@ -27697,7 +27758,7 @@ function compileDeclareInjectableFromMetadata(meta) {
27697
27758
  function createInjectableDefinitionMap(meta) {
27698
27759
  const definitionMap = new DefinitionMap();
27699
27760
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION4));
27700
- definitionMap.set("version", literal("17.0.7"));
27761
+ definitionMap.set("version", literal("17.0.8"));
27701
27762
  definitionMap.set("ngImport", importExpr(Identifiers.core));
27702
27763
  definitionMap.set("type", meta.type.value);
27703
27764
  if (meta.providedIn !== void 0) {
@@ -27735,7 +27796,7 @@ function compileDeclareInjectorFromMetadata(meta) {
27735
27796
  function createInjectorDefinitionMap(meta) {
27736
27797
  const definitionMap = new DefinitionMap();
27737
27798
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION5));
27738
- definitionMap.set("version", literal("17.0.7"));
27799
+ definitionMap.set("version", literal("17.0.8"));
27739
27800
  definitionMap.set("ngImport", importExpr(Identifiers.core));
27740
27801
  definitionMap.set("type", meta.type.value);
27741
27802
  definitionMap.set("providers", meta.providers);
@@ -27759,7 +27820,7 @@ function createNgModuleDefinitionMap(meta) {
27759
27820
  throw new Error("Invalid path! Local compilation mode should not get into the partial compilation path");
27760
27821
  }
27761
27822
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION6));
27762
- definitionMap.set("version", literal("17.0.7"));
27823
+ definitionMap.set("version", literal("17.0.8"));
27763
27824
  definitionMap.set("ngImport", importExpr(Identifiers.core));
27764
27825
  definitionMap.set("type", meta.type.value);
27765
27826
  if (meta.bootstrap.length > 0) {
@@ -27794,7 +27855,7 @@ function compileDeclarePipeFromMetadata(meta) {
27794
27855
  function createPipeDefinitionMap(meta) {
27795
27856
  const definitionMap = new DefinitionMap();
27796
27857
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION7));
27797
- definitionMap.set("version", literal("17.0.7"));
27858
+ definitionMap.set("version", literal("17.0.8"));
27798
27859
  definitionMap.set("ngImport", importExpr(Identifiers.core));
27799
27860
  definitionMap.set("type", meta.type.value);
27800
27861
  if (meta.isStandalone) {
@@ -27811,7 +27872,7 @@ function createPipeDefinitionMap(meta) {
27811
27872
  publishFacade(_global);
27812
27873
 
27813
27874
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/version.mjs
27814
- var VERSION3 = new Version("17.0.7");
27875
+ var VERSION3 = new Version("17.0.8");
27815
27876
 
27816
27877
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/api.mjs
27817
27878
  var EmitFlags;