@angular/core 17.0.0-rc.0 → 17.0.0-rc.2

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 (66) hide show
  1. package/esm2022/primitives/signals/index.mjs +2 -2
  2. package/esm2022/primitives/signals/src/graph.mjs +22 -1
  3. package/esm2022/primitives/signals/src/signal.mjs +7 -3
  4. package/esm2022/rxjs-interop/src/to_signal.mjs +9 -2
  5. package/esm2022/src/application_init.mjs +3 -2
  6. package/esm2022/src/application_ref.mjs +3 -3
  7. package/esm2022/src/application_tokens.mjs +1 -11
  8. package/esm2022/src/change_detection/change_detector_ref.mjs +1 -1
  9. package/esm2022/src/core.mjs +2 -2
  10. package/esm2022/src/core_private_export.mjs +2 -2
  11. package/esm2022/src/defer/cleanup.mjs +23 -53
  12. package/esm2022/src/defer/dom_triggers.mjs +15 -15
  13. package/esm2022/src/defer/idle_scheduler.mjs +20 -17
  14. package/esm2022/src/defer/instructions.mjs +99 -65
  15. package/esm2022/src/defer/interfaces.mjs +3 -1
  16. package/esm2022/src/defer/timer_scheduler.mjs +43 -34
  17. package/esm2022/src/defer/utils.mjs +2 -14
  18. package/esm2022/src/di/r3_injector.mjs +6 -1
  19. package/esm2022/src/errors.mjs +1 -1
  20. package/esm2022/src/hydration/api.mjs +2 -3
  21. package/esm2022/src/hydration/skip_hydration.mjs +7 -7
  22. package/esm2022/src/image_performance_warning.mjs +9 -3
  23. package/esm2022/src/linker/view_container_ref.mjs +4 -6
  24. package/esm2022/src/metadata/directives.mjs +1 -1
  25. package/esm2022/src/metadata/do_bootstrap.mjs +9 -0
  26. package/esm2022/src/metadata.mjs +1 -1
  27. package/esm2022/src/render3/after_render_hooks.mjs +25 -21
  28. package/esm2022/src/render3/assert.mjs +2 -2
  29. package/esm2022/src/render3/debug/injector_profiler.mjs +26 -8
  30. package/esm2022/src/render3/features/standalone_feature.mjs +5 -1
  31. package/esm2022/src/render3/instructions/change_detection.mjs +90 -9
  32. package/esm2022/src/render3/instructions/change_detection_flags.mjs +12 -0
  33. package/esm2022/src/render3/instructions/control_flow.mjs +65 -45
  34. package/esm2022/src/render3/instructions/shared.mjs +22 -42
  35. package/esm2022/src/render3/interfaces/view.mjs +2 -2
  36. package/esm2022/src/render3/node_manipulation.mjs +2 -3
  37. package/esm2022/src/render3/reactive_lview_consumer.mjs +20 -33
  38. package/esm2022/src/render3/reactivity/effect.mjs +22 -6
  39. package/esm2022/src/render3/reactivity/signal.mjs +1 -1
  40. package/esm2022/src/render3/util/injector_discovery_utils.mjs +54 -23
  41. package/esm2022/src/render3/util/view_utils.mjs +1 -4
  42. package/esm2022/src/version.mjs +1 -1
  43. package/esm2022/testing/src/component_fixture.mjs +4 -1
  44. package/esm2022/testing/src/defer.mjs +6 -3
  45. package/esm2022/testing/src/logger.mjs +3 -3
  46. package/fesm2022/core.mjs +17945 -17785
  47. package/fesm2022/core.mjs.map +1 -1
  48. package/fesm2022/primitives/signals.mjs +28 -3
  49. package/fesm2022/primitives/signals.mjs.map +1 -1
  50. package/fesm2022/rxjs-interop.mjs +9 -2
  51. package/fesm2022/rxjs-interop.mjs.map +1 -1
  52. package/fesm2022/testing.mjs +9 -3
  53. package/fesm2022/testing.mjs.map +1 -1
  54. package/index.d.ts +28 -22
  55. package/package.json +2 -2
  56. package/primitives/signals/index.d.ts +14 -1
  57. package/rxjs-interop/index.d.ts +10 -1
  58. package/schematics/migrations/block-template-entities/bundle.js +1671 -918
  59. package/schematics/migrations/block-template-entities/bundle.js.map +4 -4
  60. package/schematics/ng-generate/control-flow-migration/bundle.js +1927 -1105
  61. package/schematics/ng-generate/control-flow-migration/bundle.js.map +4 -4
  62. package/schematics/ng-generate/control-flow-migration/schema.json +9 -2
  63. package/schematics/ng-generate/standalone-migration/bundle.js +2932 -2065
  64. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  65. package/testing/index.d.ts +1 -1
  66. package/esm2022/src/metadata/do_boostrap.mjs +0 -9
@@ -3601,16 +3601,19 @@ var Element = class {
3601
3601
  }
3602
3602
  };
3603
3603
  var DeferredTrigger = class {
3604
- constructor(sourceSpan) {
3604
+ constructor(nameSpan, sourceSpan, prefetchSpan, whenOrOnSourceSpan) {
3605
+ this.nameSpan = nameSpan;
3605
3606
  this.sourceSpan = sourceSpan;
3607
+ this.prefetchSpan = prefetchSpan;
3608
+ this.whenOrOnSourceSpan = whenOrOnSourceSpan;
3606
3609
  }
3607
3610
  visit(visitor) {
3608
3611
  return visitor.visitDeferredTrigger(this);
3609
3612
  }
3610
3613
  };
3611
3614
  var BoundDeferredTrigger = class extends DeferredTrigger {
3612
- constructor(value, sourceSpan) {
3613
- super(sourceSpan);
3615
+ constructor(value, sourceSpan, prefetchSpan, whenSourceSpan) {
3616
+ super(null, sourceSpan, prefetchSpan, whenSourceSpan);
3614
3617
  this.value = value;
3615
3618
  }
3616
3619
  };
@@ -3619,75 +3622,75 @@ var IdleDeferredTrigger = class extends DeferredTrigger {
3619
3622
  var ImmediateDeferredTrigger = class extends DeferredTrigger {
3620
3623
  };
3621
3624
  var HoverDeferredTrigger = class extends DeferredTrigger {
3622
- constructor(reference2, sourceSpan) {
3623
- super(sourceSpan);
3625
+ constructor(reference2, nameSpan, sourceSpan, prefetchSpan, onSourceSpan) {
3626
+ super(nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
3624
3627
  this.reference = reference2;
3625
3628
  }
3626
3629
  };
3627
3630
  var TimerDeferredTrigger = class extends DeferredTrigger {
3628
- constructor(delay, sourceSpan) {
3629
- super(sourceSpan);
3631
+ constructor(delay, nameSpan, sourceSpan, prefetchSpan, onSourceSpan) {
3632
+ super(nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
3630
3633
  this.delay = delay;
3631
3634
  }
3632
3635
  };
3633
3636
  var InteractionDeferredTrigger = class extends DeferredTrigger {
3634
- constructor(reference2, sourceSpan) {
3635
- super(sourceSpan);
3637
+ constructor(reference2, nameSpan, sourceSpan, prefetchSpan, onSourceSpan) {
3638
+ super(nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
3636
3639
  this.reference = reference2;
3637
3640
  }
3638
3641
  };
3639
3642
  var ViewportDeferredTrigger = class extends DeferredTrigger {
3640
- constructor(reference2, sourceSpan) {
3641
- super(sourceSpan);
3643
+ constructor(reference2, nameSpan, sourceSpan, prefetchSpan, onSourceSpan) {
3644
+ super(nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
3642
3645
  this.reference = reference2;
3643
3646
  }
3644
3647
  };
3645
- var DeferredBlockPlaceholder = class {
3646
- constructor(children, minimumTime, sourceSpan, startSourceSpan, endSourceSpan) {
3647
- this.children = children;
3648
- this.minimumTime = minimumTime;
3648
+ var BlockNode = class {
3649
+ constructor(nameSpan, sourceSpan, startSourceSpan, endSourceSpan) {
3650
+ this.nameSpan = nameSpan;
3649
3651
  this.sourceSpan = sourceSpan;
3650
3652
  this.startSourceSpan = startSourceSpan;
3651
3653
  this.endSourceSpan = endSourceSpan;
3652
3654
  }
3655
+ };
3656
+ var DeferredBlockPlaceholder = class extends BlockNode {
3657
+ constructor(children, minimumTime, nameSpan, sourceSpan, startSourceSpan, endSourceSpan) {
3658
+ super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
3659
+ this.children = children;
3660
+ this.minimumTime = minimumTime;
3661
+ }
3653
3662
  visit(visitor) {
3654
3663
  return visitor.visitDeferredBlockPlaceholder(this);
3655
3664
  }
3656
3665
  };
3657
- var DeferredBlockLoading = class {
3658
- constructor(children, afterTime, minimumTime, sourceSpan, startSourceSpan, endSourceSpan) {
3666
+ var DeferredBlockLoading = class extends BlockNode {
3667
+ constructor(children, afterTime, minimumTime, nameSpan, sourceSpan, startSourceSpan, endSourceSpan) {
3668
+ super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
3659
3669
  this.children = children;
3660
3670
  this.afterTime = afterTime;
3661
3671
  this.minimumTime = minimumTime;
3662
- this.sourceSpan = sourceSpan;
3663
- this.startSourceSpan = startSourceSpan;
3664
- this.endSourceSpan = endSourceSpan;
3665
3672
  }
3666
3673
  visit(visitor) {
3667
3674
  return visitor.visitDeferredBlockLoading(this);
3668
3675
  }
3669
3676
  };
3670
- var DeferredBlockError = class {
3671
- constructor(children, sourceSpan, startSourceSpan, endSourceSpan) {
3677
+ var DeferredBlockError = class extends BlockNode {
3678
+ constructor(children, nameSpan, sourceSpan, startSourceSpan, endSourceSpan) {
3679
+ super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
3672
3680
  this.children = children;
3673
- this.sourceSpan = sourceSpan;
3674
- this.startSourceSpan = startSourceSpan;
3675
- this.endSourceSpan = endSourceSpan;
3676
3681
  }
3677
3682
  visit(visitor) {
3678
3683
  return visitor.visitDeferredBlockError(this);
3679
3684
  }
3680
3685
  };
3681
- var DeferredBlock = class {
3682
- constructor(children, triggers, prefetchTriggers, placeholder, loading, error2, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan) {
3686
+ var DeferredBlock = class extends BlockNode {
3687
+ constructor(children, triggers, prefetchTriggers, placeholder, loading, error2, nameSpan, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan) {
3688
+ super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
3683
3689
  this.children = children;
3684
3690
  this.placeholder = placeholder;
3685
3691
  this.loading = loading;
3686
3692
  this.error = error2;
3687
- this.sourceSpan = sourceSpan;
3688
3693
  this.mainBlockSpan = mainBlockSpan;
3689
- this.startSourceSpan = startSourceSpan;
3690
- this.endSourceSpan = endSourceSpan;
3691
3694
  this.triggers = triggers;
3692
3695
  this.prefetchTriggers = prefetchTriggers;
3693
3696
  this.definedTriggers = Object.keys(triggers);
@@ -3707,87 +3710,77 @@ var DeferredBlock = class {
3707
3710
  visitAll(visitor, keys.map((k) => triggers[k]));
3708
3711
  }
3709
3712
  };
3710
- var SwitchBlock = class {
3711
- constructor(expression, cases, unknownBlocks, sourceSpan, startSourceSpan, endSourceSpan) {
3713
+ var SwitchBlock = class extends BlockNode {
3714
+ constructor(expression, cases, unknownBlocks, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
3715
+ super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
3712
3716
  this.expression = expression;
3713
3717
  this.cases = cases;
3714
3718
  this.unknownBlocks = unknownBlocks;
3715
- this.sourceSpan = sourceSpan;
3716
- this.startSourceSpan = startSourceSpan;
3717
- this.endSourceSpan = endSourceSpan;
3718
3719
  }
3719
3720
  visit(visitor) {
3720
3721
  return visitor.visitSwitchBlock(this);
3721
3722
  }
3722
3723
  };
3723
- var SwitchBlockCase = class {
3724
- constructor(expression, children, sourceSpan, startSourceSpan, endSourceSpan) {
3724
+ var SwitchBlockCase = class extends BlockNode {
3725
+ constructor(expression, children, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
3726
+ super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
3725
3727
  this.expression = expression;
3726
3728
  this.children = children;
3727
- this.sourceSpan = sourceSpan;
3728
- this.startSourceSpan = startSourceSpan;
3729
- this.endSourceSpan = endSourceSpan;
3730
3729
  }
3731
3730
  visit(visitor) {
3732
3731
  return visitor.visitSwitchBlockCase(this);
3733
3732
  }
3734
3733
  };
3735
- var ForLoopBlock = class {
3736
- constructor(item, expression, trackBy, contextVariables, children, empty, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan) {
3734
+ var ForLoopBlock = class extends BlockNode {
3735
+ constructor(item, expression, trackBy, trackKeywordSpan, contextVariables, children, empty, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan, nameSpan) {
3736
+ super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
3737
3737
  this.item = item;
3738
3738
  this.expression = expression;
3739
3739
  this.trackBy = trackBy;
3740
+ this.trackKeywordSpan = trackKeywordSpan;
3740
3741
  this.contextVariables = contextVariables;
3741
3742
  this.children = children;
3742
3743
  this.empty = empty;
3743
- this.sourceSpan = sourceSpan;
3744
3744
  this.mainBlockSpan = mainBlockSpan;
3745
- this.startSourceSpan = startSourceSpan;
3746
- this.endSourceSpan = endSourceSpan;
3747
3745
  }
3748
3746
  visit(visitor) {
3749
3747
  return visitor.visitForLoopBlock(this);
3750
3748
  }
3751
3749
  };
3752
- var ForLoopBlockEmpty = class {
3753
- constructor(children, sourceSpan, startSourceSpan, endSourceSpan) {
3750
+ var ForLoopBlockEmpty = class extends BlockNode {
3751
+ constructor(children, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
3752
+ super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
3754
3753
  this.children = children;
3755
- this.sourceSpan = sourceSpan;
3756
- this.startSourceSpan = startSourceSpan;
3757
- this.endSourceSpan = endSourceSpan;
3758
3754
  }
3759
3755
  visit(visitor) {
3760
3756
  return visitor.visitForLoopBlockEmpty(this);
3761
3757
  }
3762
3758
  };
3763
- var IfBlock = class {
3764
- constructor(branches, sourceSpan, startSourceSpan, endSourceSpan) {
3759
+ var IfBlock = class extends BlockNode {
3760
+ constructor(branches, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
3761
+ super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
3765
3762
  this.branches = branches;
3766
- this.sourceSpan = sourceSpan;
3767
- this.startSourceSpan = startSourceSpan;
3768
- this.endSourceSpan = endSourceSpan;
3769
3763
  }
3770
3764
  visit(visitor) {
3771
3765
  return visitor.visitIfBlock(this);
3772
3766
  }
3773
3767
  };
3774
- var IfBlockBranch = class {
3775
- constructor(expression, children, expressionAlias, sourceSpan, startSourceSpan, endSourceSpan) {
3768
+ var IfBlockBranch = class extends BlockNode {
3769
+ constructor(expression, children, expressionAlias, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
3770
+ super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
3776
3771
  this.expression = expression;
3777
3772
  this.children = children;
3778
3773
  this.expressionAlias = expressionAlias;
3779
- this.sourceSpan = sourceSpan;
3780
- this.startSourceSpan = startSourceSpan;
3781
- this.endSourceSpan = endSourceSpan;
3782
3774
  }
3783
3775
  visit(visitor) {
3784
3776
  return visitor.visitIfBlockBranch(this);
3785
3777
  }
3786
3778
  };
3787
3779
  var UnknownBlock = class {
3788
- constructor(name, sourceSpan) {
3780
+ constructor(name, sourceSpan, nameSpan) {
3789
3781
  this.name = name;
3790
3782
  this.sourceSpan = sourceSpan;
3783
+ this.nameSpan = nameSpan;
3791
3784
  }
3792
3785
  visit(visitor) {
3793
3786
  return visitor.visitUnknownBlock(this);
@@ -6996,51 +6989,61 @@ var OpKind;
6996
6989
  OpKind2[OpKind2["Attribute"] = 24] = "Attribute";
6997
6990
  OpKind2[OpKind2["ExtractedAttribute"] = 25] = "ExtractedAttribute";
6998
6991
  OpKind2[OpKind2["Defer"] = 26] = "Defer";
6999
- OpKind2[OpKind2["DeferSecondaryBlock"] = 27] = "DeferSecondaryBlock";
7000
- OpKind2[OpKind2["DeferOn"] = 28] = "DeferOn";
7001
- OpKind2[OpKind2["ExtractedMessage"] = 29] = "ExtractedMessage";
7002
- OpKind2[OpKind2["HostProperty"] = 30] = "HostProperty";
7003
- OpKind2[OpKind2["Namespace"] = 31] = "Namespace";
7004
- OpKind2[OpKind2["ProjectionDef"] = 32] = "ProjectionDef";
7005
- OpKind2[OpKind2["Projection"] = 33] = "Projection";
7006
- OpKind2[OpKind2["I18nStart"] = 34] = "I18nStart";
7007
- OpKind2[OpKind2["I18n"] = 35] = "I18n";
7008
- OpKind2[OpKind2["I18nEnd"] = 36] = "I18nEnd";
7009
- OpKind2[OpKind2["I18nExpression"] = 37] = "I18nExpression";
7010
- OpKind2[OpKind2["I18nApply"] = 38] = "I18nApply";
7011
- OpKind2[OpKind2["Icu"] = 39] = "Icu";
7012
- OpKind2[OpKind2["IcuUpdate"] = 40] = "IcuUpdate";
6992
+ OpKind2[OpKind2["DeferOn"] = 27] = "DeferOn";
6993
+ OpKind2[OpKind2["ExtractedMessage"] = 28] = "ExtractedMessage";
6994
+ OpKind2[OpKind2["HostProperty"] = 29] = "HostProperty";
6995
+ OpKind2[OpKind2["Namespace"] = 30] = "Namespace";
6996
+ OpKind2[OpKind2["ProjectionDef"] = 31] = "ProjectionDef";
6997
+ OpKind2[OpKind2["Projection"] = 32] = "Projection";
6998
+ OpKind2[OpKind2["RepeaterCreate"] = 33] = "RepeaterCreate";
6999
+ OpKind2[OpKind2["Repeater"] = 34] = "Repeater";
7000
+ OpKind2[OpKind2["I18nStart"] = 35] = "I18nStart";
7001
+ OpKind2[OpKind2["I18n"] = 36] = "I18n";
7002
+ OpKind2[OpKind2["I18nEnd"] = 37] = "I18nEnd";
7003
+ OpKind2[OpKind2["I18nExpression"] = 38] = "I18nExpression";
7004
+ OpKind2[OpKind2["I18nApply"] = 39] = "I18nApply";
7005
+ OpKind2[OpKind2["Icu"] = 40] = "Icu";
7006
+ OpKind2[OpKind2["IcuUpdate"] = 41] = "IcuUpdate";
7013
7007
  })(OpKind || (OpKind = {}));
7014
7008
  var ExpressionKind;
7015
7009
  (function(ExpressionKind2) {
7016
7010
  ExpressionKind2[ExpressionKind2["LexicalRead"] = 0] = "LexicalRead";
7017
7011
  ExpressionKind2[ExpressionKind2["Context"] = 1] = "Context";
7018
- ExpressionKind2[ExpressionKind2["ReadVariable"] = 2] = "ReadVariable";
7019
- ExpressionKind2[ExpressionKind2["NextContext"] = 3] = "NextContext";
7020
- ExpressionKind2[ExpressionKind2["Reference"] = 4] = "Reference";
7021
- ExpressionKind2[ExpressionKind2["GetCurrentView"] = 5] = "GetCurrentView";
7022
- ExpressionKind2[ExpressionKind2["RestoreView"] = 6] = "RestoreView";
7023
- ExpressionKind2[ExpressionKind2["ResetView"] = 7] = "ResetView";
7024
- ExpressionKind2[ExpressionKind2["PureFunctionExpr"] = 8] = "PureFunctionExpr";
7025
- ExpressionKind2[ExpressionKind2["PureFunctionParameterExpr"] = 9] = "PureFunctionParameterExpr";
7026
- ExpressionKind2[ExpressionKind2["PipeBinding"] = 10] = "PipeBinding";
7027
- ExpressionKind2[ExpressionKind2["PipeBindingVariadic"] = 11] = "PipeBindingVariadic";
7028
- ExpressionKind2[ExpressionKind2["SafePropertyRead"] = 12] = "SafePropertyRead";
7029
- ExpressionKind2[ExpressionKind2["SafeKeyedRead"] = 13] = "SafeKeyedRead";
7030
- ExpressionKind2[ExpressionKind2["SafeInvokeFunction"] = 14] = "SafeInvokeFunction";
7031
- ExpressionKind2[ExpressionKind2["SafeTernaryExpr"] = 15] = "SafeTernaryExpr";
7032
- ExpressionKind2[ExpressionKind2["EmptyExpr"] = 16] = "EmptyExpr";
7033
- ExpressionKind2[ExpressionKind2["AssignTemporaryExpr"] = 17] = "AssignTemporaryExpr";
7034
- ExpressionKind2[ExpressionKind2["ReadTemporaryExpr"] = 18] = "ReadTemporaryExpr";
7035
- ExpressionKind2[ExpressionKind2["SanitizerExpr"] = 19] = "SanitizerExpr";
7036
- ExpressionKind2[ExpressionKind2["SlotLiteralExpr"] = 20] = "SlotLiteralExpr";
7037
- ExpressionKind2[ExpressionKind2["ConditionalCase"] = 21] = "ConditionalCase";
7012
+ ExpressionKind2[ExpressionKind2["TrackContext"] = 2] = "TrackContext";
7013
+ ExpressionKind2[ExpressionKind2["ReadVariable"] = 3] = "ReadVariable";
7014
+ ExpressionKind2[ExpressionKind2["NextContext"] = 4] = "NextContext";
7015
+ ExpressionKind2[ExpressionKind2["Reference"] = 5] = "Reference";
7016
+ ExpressionKind2[ExpressionKind2["GetCurrentView"] = 6] = "GetCurrentView";
7017
+ ExpressionKind2[ExpressionKind2["RestoreView"] = 7] = "RestoreView";
7018
+ ExpressionKind2[ExpressionKind2["ResetView"] = 8] = "ResetView";
7019
+ ExpressionKind2[ExpressionKind2["PureFunctionExpr"] = 9] = "PureFunctionExpr";
7020
+ ExpressionKind2[ExpressionKind2["PureFunctionParameterExpr"] = 10] = "PureFunctionParameterExpr";
7021
+ ExpressionKind2[ExpressionKind2["PipeBinding"] = 11] = "PipeBinding";
7022
+ ExpressionKind2[ExpressionKind2["PipeBindingVariadic"] = 12] = "PipeBindingVariadic";
7023
+ ExpressionKind2[ExpressionKind2["SafePropertyRead"] = 13] = "SafePropertyRead";
7024
+ ExpressionKind2[ExpressionKind2["SafeKeyedRead"] = 14] = "SafeKeyedRead";
7025
+ ExpressionKind2[ExpressionKind2["SafeInvokeFunction"] = 15] = "SafeInvokeFunction";
7026
+ ExpressionKind2[ExpressionKind2["SafeTernaryExpr"] = 16] = "SafeTernaryExpr";
7027
+ ExpressionKind2[ExpressionKind2["EmptyExpr"] = 17] = "EmptyExpr";
7028
+ ExpressionKind2[ExpressionKind2["AssignTemporaryExpr"] = 18] = "AssignTemporaryExpr";
7029
+ ExpressionKind2[ExpressionKind2["ReadTemporaryExpr"] = 19] = "ReadTemporaryExpr";
7030
+ ExpressionKind2[ExpressionKind2["SanitizerExpr"] = 20] = "SanitizerExpr";
7031
+ ExpressionKind2[ExpressionKind2["SlotLiteralExpr"] = 21] = "SlotLiteralExpr";
7032
+ ExpressionKind2[ExpressionKind2["ConditionalCase"] = 22] = "ConditionalCase";
7033
+ ExpressionKind2[ExpressionKind2["DerivedRepeaterVar"] = 23] = "DerivedRepeaterVar";
7034
+ ExpressionKind2[ExpressionKind2["ConstCollected"] = 24] = "ConstCollected";
7038
7035
  })(ExpressionKind || (ExpressionKind = {}));
7036
+ var VariableFlags;
7037
+ (function(VariableFlags2) {
7038
+ VariableFlags2[VariableFlags2["None"] = 0] = "None";
7039
+ VariableFlags2[VariableFlags2["AlwaysInline"] = 1] = "AlwaysInline";
7040
+ })(VariableFlags || (VariableFlags = {}));
7039
7041
  var SemanticVariableKind;
7040
7042
  (function(SemanticVariableKind2) {
7041
7043
  SemanticVariableKind2[SemanticVariableKind2["Context"] = 0] = "Context";
7042
7044
  SemanticVariableKind2[SemanticVariableKind2["Identifier"] = 1] = "Identifier";
7043
7045
  SemanticVariableKind2[SemanticVariableKind2["SavedView"] = 2] = "SavedView";
7046
+ SemanticVariableKind2[SemanticVariableKind2["Alias"] = 3] = "Alias";
7044
7047
  })(SemanticVariableKind || (SemanticVariableKind = {}));
7045
7048
  var CompatibilityMode;
7046
7049
  (function(CompatibilityMode2) {
@@ -7077,23 +7080,46 @@ var I18nParamResolutionTime;
7077
7080
  I18nParamResolutionTime2[I18nParamResolutionTime2["Creation"] = 0] = "Creation";
7078
7081
  I18nParamResolutionTime2[I18nParamResolutionTime2["Postproccessing"] = 1] = "Postproccessing";
7079
7082
  })(I18nParamResolutionTime || (I18nParamResolutionTime = {}));
7083
+ var I18nParamValueFlags;
7084
+ (function(I18nParamValueFlags2) {
7085
+ I18nParamValueFlags2[I18nParamValueFlags2["None"] = 0] = "None";
7086
+ I18nParamValueFlags2[I18nParamValueFlags2["ElementTag"] = 1] = "ElementTag";
7087
+ I18nParamValueFlags2[I18nParamValueFlags2["TemplateTag"] = 2] = "TemplateTag";
7088
+ I18nParamValueFlags2[I18nParamValueFlags2["OpenTag"] = 4] = "OpenTag";
7089
+ I18nParamValueFlags2[I18nParamValueFlags2["CloseTag"] = 8] = "CloseTag";
7090
+ })(I18nParamValueFlags || (I18nParamValueFlags = {}));
7091
+ var Namespace;
7092
+ (function(Namespace2) {
7093
+ Namespace2[Namespace2["HTML"] = 0] = "HTML";
7094
+ Namespace2[Namespace2["SVG"] = 1] = "SVG";
7095
+ Namespace2[Namespace2["Math"] = 2] = "Math";
7096
+ })(Namespace || (Namespace = {}));
7097
+ var DeferTriggerKind;
7098
+ (function(DeferTriggerKind2) {
7099
+ DeferTriggerKind2[DeferTriggerKind2["Idle"] = 0] = "Idle";
7100
+ DeferTriggerKind2[DeferTriggerKind2["Immediate"] = 1] = "Immediate";
7101
+ DeferTriggerKind2[DeferTriggerKind2["Timer"] = 2] = "Timer";
7102
+ DeferTriggerKind2[DeferTriggerKind2["Hover"] = 3] = "Hover";
7103
+ DeferTriggerKind2[DeferTriggerKind2["Interaction"] = 4] = "Interaction";
7104
+ DeferTriggerKind2[DeferTriggerKind2["Viewport"] = 5] = "Viewport";
7105
+ })(DeferTriggerKind || (DeferTriggerKind = {}));
7106
+ var DerivedRepeaterVarIdentity;
7107
+ (function(DerivedRepeaterVarIdentity2) {
7108
+ DerivedRepeaterVarIdentity2[DerivedRepeaterVarIdentity2["First"] = 0] = "First";
7109
+ DerivedRepeaterVarIdentity2[DerivedRepeaterVarIdentity2["Last"] = 1] = "Last";
7110
+ DerivedRepeaterVarIdentity2[DerivedRepeaterVarIdentity2["Even"] = 2] = "Even";
7111
+ DerivedRepeaterVarIdentity2[DerivedRepeaterVarIdentity2["Odd"] = 3] = "Odd";
7112
+ })(DerivedRepeaterVarIdentity || (DerivedRepeaterVarIdentity = {}));
7080
7113
 
7081
7114
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/traits.mjs
7082
7115
  var ConsumesSlot = Symbol("ConsumesSlot");
7083
7116
  var DependsOnSlotContext = Symbol("DependsOnSlotContext");
7084
- var UsesSlotIndex = Symbol("UsesSlotIndex");
7085
7117
  var ConsumesVarsTrait = Symbol("ConsumesVars");
7086
7118
  var UsesVarOffset = Symbol("UsesVarOffset");
7087
- var HasConst = Symbol("HasConst");
7088
7119
  var TRAIT_CONSUMES_SLOT = {
7089
7120
  [ConsumesSlot]: true,
7090
- slot: null,
7091
7121
  numSlotsUsed: 1
7092
7122
  };
7093
- var TRAIT_USES_SLOT_INDEX = {
7094
- [UsesSlotIndex]: true,
7095
- targetSlot: null
7096
- };
7097
7123
  var TRAIT_DEPENDS_ON_SLOT_CONTEXT = {
7098
7124
  [DependsOnSlotContext]: true
7099
7125
  };
@@ -7104,10 +7130,6 @@ var TRAIT_USES_VAR_OFFSET = {
7104
7130
  [UsesVarOffset]: true,
7105
7131
  varOffset: null
7106
7132
  };
7107
- var TRAIT_HAS_CONST = {
7108
- [HasConst]: true,
7109
- constIndex: null
7110
- };
7111
7133
  function hasConsumesSlotTrait(op) {
7112
7134
  return op[ConsumesSlot] === true;
7113
7135
  }
@@ -7120,12 +7142,6 @@ function hasConsumesVarsTrait(value) {
7120
7142
  function hasUsesVarOffsetTrait(expr) {
7121
7143
  return expr[UsesVarOffset] === true;
7122
7144
  }
7123
- function hasUsesSlotIndexTrait(value) {
7124
- return value[UsesSlotIndex] === true;
7125
- }
7126
- function hasConstTrait(value) {
7127
- return value[HasConst] === true;
7128
- }
7129
7145
 
7130
7146
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/shared.mjs
7131
7147
  function createStatementOp(statement) {
@@ -7134,12 +7150,13 @@ function createStatementOp(statement) {
7134
7150
  statement
7135
7151
  }, NEW_OP);
7136
7152
  }
7137
- function createVariableOp(xref, variable2, initializer) {
7153
+ function createVariableOp(xref, variable2, initializer, flags) {
7138
7154
  return __spreadValues({
7139
7155
  kind: OpKind.Variable,
7140
7156
  xref,
7141
7157
  variable: variable2,
7142
- initializer
7158
+ initializer,
7159
+ flags
7143
7160
  }, NEW_OP);
7144
7161
  }
7145
7162
  var NEW_OP = {
@@ -7246,21 +7263,32 @@ function createAdvanceOp(delta, sourceSpan) {
7246
7263
  sourceSpan
7247
7264
  }, NEW_OP);
7248
7265
  }
7249
- function createConditionalOp(target, test, conditions, sourceSpan) {
7250
- return __spreadValues(__spreadValues(__spreadValues(__spreadValues({
7266
+ function createConditionalOp(target, targetSlot, test, conditions, sourceSpan) {
7267
+ return __spreadValues(__spreadValues(__spreadValues({
7251
7268
  kind: OpKind.Conditional,
7252
7269
  target,
7270
+ targetSlot,
7253
7271
  test,
7254
7272
  conditions,
7255
7273
  processed: null,
7256
7274
  sourceSpan,
7257
7275
  contextValue: null
7258
- }, NEW_OP), TRAIT_USES_SLOT_INDEX), TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS);
7276
+ }, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS);
7277
+ }
7278
+ function createRepeaterOp(repeaterCreate2, targetSlot, collection, sourceSpan) {
7279
+ return __spreadValues({
7280
+ kind: OpKind.Repeater,
7281
+ target: repeaterCreate2,
7282
+ targetSlot,
7283
+ collection,
7284
+ sourceSpan
7285
+ }, NEW_OP);
7259
7286
  }
7260
- function createI18nExpressionOp(owner, expression, i18nPlaceholder, resolutionTime, sourceSpan) {
7287
+ function createI18nExpressionOp(owner, ownerSlot, expression, i18nPlaceholder, resolutionTime, sourceSpan) {
7261
7288
  return __spreadValues(__spreadValues(__spreadValues({
7262
7289
  kind: OpKind.I18nExpression,
7263
7290
  owner,
7291
+ ownerSlot,
7264
7292
  target: owner,
7265
7293
  expression,
7266
7294
  i18nPlaceholder,
@@ -7268,12 +7296,13 @@ function createI18nExpressionOp(owner, expression, i18nPlaceholder, resolutionTi
7268
7296
  sourceSpan
7269
7297
  }, NEW_OP), TRAIT_CONSUMES_VARS), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
7270
7298
  }
7271
- function createI18nApplyOp(target, sourceSpan) {
7272
- return __spreadValues(__spreadValues({
7299
+ function createI18nApplyOp(target, targetSlot, sourceSpan) {
7300
+ return __spreadValues({
7273
7301
  kind: OpKind.I18nApply,
7274
7302
  target,
7303
+ targetSlot,
7275
7304
  sourceSpan
7276
- }, NEW_OP), TRAIT_USES_SLOT_INDEX);
7305
+ }, NEW_OP);
7277
7306
  }
7278
7307
  function createIcuUpdateOp(xref, sourceSpan) {
7279
7308
  return __spreadValues({
@@ -7290,10 +7319,6 @@ var _c;
7290
7319
  var _d;
7291
7320
  var _e;
7292
7321
  var _f;
7293
- var _g;
7294
- var _h;
7295
- var _j;
7296
- var _k;
7297
7322
  function isIrExpression(expr) {
7298
7323
  return expr instanceof ExpressionBase;
7299
7324
  }
@@ -7310,8 +7335,8 @@ var LexicalReadExpr = class extends ExpressionBase {
7310
7335
  }
7311
7336
  visitExpression(visitor, context) {
7312
7337
  }
7313
- isEquivalent() {
7314
- return false;
7338
+ isEquivalent(other) {
7339
+ return this.name === other.name;
7315
7340
  }
7316
7341
  isConstant() {
7317
7342
  return false;
@@ -7322,19 +7347,18 @@ var LexicalReadExpr = class extends ExpressionBase {
7322
7347
  return new LexicalReadExpr(this.name);
7323
7348
  }
7324
7349
  };
7325
- var _ReferenceExpr = class extends ExpressionBase {
7326
- constructor(target, offset) {
7350
+ var ReferenceExpr = class extends ExpressionBase {
7351
+ constructor(target, targetSlot, offset) {
7327
7352
  super();
7328
7353
  this.target = target;
7354
+ this.targetSlot = targetSlot;
7329
7355
  this.offset = offset;
7330
7356
  this.kind = ExpressionKind.Reference;
7331
- this[_a] = true;
7332
- this.targetSlot = null;
7333
7357
  }
7334
7358
  visitExpression() {
7335
7359
  }
7336
7360
  isEquivalent(e) {
7337
- return e instanceof _ReferenceExpr && e.target === this.target;
7361
+ return e instanceof ReferenceExpr && e.target === this.target;
7338
7362
  }
7339
7363
  isConstant() {
7340
7364
  return false;
@@ -7342,15 +7366,9 @@ var _ReferenceExpr = class extends ExpressionBase {
7342
7366
  transformInternalExpressions() {
7343
7367
  }
7344
7368
  clone() {
7345
- const expr = new _ReferenceExpr(this.target, this.offset);
7346
- expr.targetSlot = this.targetSlot;
7347
- return expr;
7369
+ return new ReferenceExpr(this.target, this.targetSlot, this.offset);
7348
7370
  }
7349
7371
  };
7350
- var ReferenceExpr = _ReferenceExpr;
7351
- (() => {
7352
- _a = UsesSlotIndex;
7353
- })();
7354
7372
  var ContextExpr = class extends ExpressionBase {
7355
7373
  constructor(view) {
7356
7374
  super();
@@ -7371,6 +7389,26 @@ var ContextExpr = class extends ExpressionBase {
7371
7389
  return new ContextExpr(this.view);
7372
7390
  }
7373
7391
  };
7392
+ var TrackContextExpr = class extends ExpressionBase {
7393
+ constructor(view) {
7394
+ super();
7395
+ this.view = view;
7396
+ this.kind = ExpressionKind.TrackContext;
7397
+ }
7398
+ visitExpression() {
7399
+ }
7400
+ isEquivalent(e) {
7401
+ return e instanceof TrackContextExpr && e.view === this.view;
7402
+ }
7403
+ isConstant() {
7404
+ return false;
7405
+ }
7406
+ transformInternalExpressions() {
7407
+ }
7408
+ clone() {
7409
+ return new TrackContextExpr(this.view);
7410
+ }
7411
+ };
7374
7412
  var NextContextExpr = class extends ExpressionBase {
7375
7413
  constructor() {
7376
7414
  super();
@@ -7494,8 +7532,8 @@ var _PureFunctionExpr = class extends ExpressionBase {
7494
7532
  constructor(expression, args) {
7495
7533
  super();
7496
7534
  this.kind = ExpressionKind.PureFunctionExpr;
7535
+ this[_a] = true;
7497
7536
  this[_b] = true;
7498
- this[_c] = true;
7499
7537
  this.varOffset = null;
7500
7538
  this.fn = null;
7501
7539
  this.body = expression;
@@ -7537,7 +7575,7 @@ var _PureFunctionExpr = class extends ExpressionBase {
7537
7575
  };
7538
7576
  var PureFunctionExpr = _PureFunctionExpr;
7539
7577
  (() => {
7540
- _b = ConsumesVarsTrait, _c = UsesVarOffset;
7578
+ _a = ConsumesVarsTrait, _b = UsesVarOffset;
7541
7579
  })();
7542
7580
  var PureFunctionParameterExpr = class extends ExpressionBase {
7543
7581
  constructor(index) {
@@ -7560,16 +7598,15 @@ var PureFunctionParameterExpr = class extends ExpressionBase {
7560
7598
  }
7561
7599
  };
7562
7600
  var _PipeBindingExpr = class extends ExpressionBase {
7563
- constructor(target, name, args) {
7601
+ constructor(target, targetSlot, name, args) {
7564
7602
  super();
7565
7603
  this.target = target;
7604
+ this.targetSlot = targetSlot;
7566
7605
  this.name = name;
7567
7606
  this.args = args;
7568
7607
  this.kind = ExpressionKind.PipeBinding;
7608
+ this[_c] = true;
7569
7609
  this[_d] = true;
7570
- this[_e] = true;
7571
- this[_f] = true;
7572
- this.targetSlot = null;
7573
7610
  this.varOffset = null;
7574
7611
  }
7575
7612
  visitExpression(visitor, context) {
@@ -7589,28 +7626,26 @@ var _PipeBindingExpr = class extends ExpressionBase {
7589
7626
  }
7590
7627
  }
7591
7628
  clone() {
7592
- const r = new _PipeBindingExpr(this.target, this.name, this.args.map((a) => a.clone()));
7593
- r.targetSlot = this.targetSlot;
7629
+ const r = new _PipeBindingExpr(this.target, this.targetSlot, this.name, this.args.map((a) => a.clone()));
7594
7630
  r.varOffset = this.varOffset;
7595
7631
  return r;
7596
7632
  }
7597
7633
  };
7598
7634
  var PipeBindingExpr = _PipeBindingExpr;
7599
7635
  (() => {
7600
- _d = UsesSlotIndex, _e = ConsumesVarsTrait, _f = UsesVarOffset;
7636
+ _c = ConsumesVarsTrait, _d = UsesVarOffset;
7601
7637
  })();
7602
7638
  var _PipeBindingVariadicExpr = class extends ExpressionBase {
7603
- constructor(target, name, args, numArgs) {
7639
+ constructor(target, targetSlot, name, args, numArgs) {
7604
7640
  super();
7605
7641
  this.target = target;
7642
+ this.targetSlot = targetSlot;
7606
7643
  this.name = name;
7607
7644
  this.args = args;
7608
7645
  this.numArgs = numArgs;
7609
7646
  this.kind = ExpressionKind.PipeBindingVariadic;
7610
- this[_g] = true;
7611
- this[_h] = true;
7612
- this[_j] = true;
7613
- this.targetSlot = null;
7647
+ this[_e] = true;
7648
+ this[_f] = true;
7614
7649
  this.varOffset = null;
7615
7650
  }
7616
7651
  visitExpression(visitor, context) {
@@ -7626,15 +7661,14 @@ var _PipeBindingVariadicExpr = class extends ExpressionBase {
7626
7661
  this.args = transformExpressionsInExpression(this.args, transform2, flags);
7627
7662
  }
7628
7663
  clone() {
7629
- const r = new _PipeBindingVariadicExpr(this.target, this.name, this.args.clone(), this.numArgs);
7630
- r.targetSlot = this.targetSlot;
7664
+ const r = new _PipeBindingVariadicExpr(this.target, this.targetSlot, this.name, this.args.clone(), this.numArgs);
7631
7665
  r.varOffset = this.varOffset;
7632
7666
  return r;
7633
7667
  }
7634
7668
  };
7635
7669
  var PipeBindingVariadicExpr = _PipeBindingVariadicExpr;
7636
7670
  (() => {
7637
- _g = UsesSlotIndex, _h = ConsumesVarsTrait, _j = UsesVarOffset;
7671
+ _e = ConsumesVarsTrait, _f = UsesVarOffset;
7638
7672
  })();
7639
7673
  var SafePropertyReadExpr = class extends ExpressionBase {
7640
7674
  constructor(receiver, name) {
@@ -7829,39 +7863,32 @@ var SanitizerExpr = class extends ExpressionBase {
7829
7863
  transformInternalExpressions() {
7830
7864
  }
7831
7865
  };
7832
- var _SlotLiteralExpr = class extends ExpressionBase {
7833
- constructor(target) {
7866
+ var SlotLiteralExpr = class extends ExpressionBase {
7867
+ constructor(slot) {
7834
7868
  super();
7835
- this.target = target;
7869
+ this.slot = slot;
7836
7870
  this.kind = ExpressionKind.SlotLiteralExpr;
7837
- this[_k] = true;
7838
- this.targetSlot = null;
7839
7871
  }
7840
7872
  visitExpression(visitor, context) {
7841
7873
  }
7842
7874
  isEquivalent(e) {
7843
- return e instanceof _SlotLiteralExpr && e.target === this.target && e.targetSlot === this.targetSlot;
7875
+ return e instanceof SlotLiteralExpr && e.slot === this.slot;
7844
7876
  }
7845
7877
  isConstant() {
7846
7878
  return true;
7847
7879
  }
7848
7880
  clone() {
7849
- const copy = new _SlotLiteralExpr(this.target);
7850
- copy.targetSlot = this.targetSlot;
7851
- return copy;
7881
+ return new SlotLiteralExpr(this.slot);
7852
7882
  }
7853
7883
  transformInternalExpressions() {
7854
7884
  }
7855
7885
  };
7856
- var SlotLiteralExpr = _SlotLiteralExpr;
7857
- (() => {
7858
- _k = UsesSlotIndex;
7859
- })();
7860
7886
  var ConditionalCaseExpr = class extends ExpressionBase {
7861
- constructor(expr, target, alias = null) {
7887
+ constructor(expr, target, targetSlot, alias = null) {
7862
7888
  super();
7863
7889
  this.expr = expr;
7864
7890
  this.target = target;
7891
+ this.targetSlot = targetSlot;
7865
7892
  this.alias = alias;
7866
7893
  this.kind = ExpressionKind.ConditionalCase;
7867
7894
  }
@@ -7877,7 +7904,7 @@ var ConditionalCaseExpr = class extends ExpressionBase {
7877
7904
  return true;
7878
7905
  }
7879
7906
  clone() {
7880
- return new ConditionalCaseExpr(this.expr, this.target);
7907
+ return new ConditionalCaseExpr(this.expr, this.target, this.targetSlot);
7881
7908
  }
7882
7909
  transformInternalExpressions(transform2, flags) {
7883
7910
  if (this.expr !== null) {
@@ -7885,6 +7912,52 @@ var ConditionalCaseExpr = class extends ExpressionBase {
7885
7912
  }
7886
7913
  }
7887
7914
  };
7915
+ var DerivedRepeaterVarExpr = class extends ExpressionBase {
7916
+ constructor(xref, identity) {
7917
+ super();
7918
+ this.xref = xref;
7919
+ this.identity = identity;
7920
+ this.kind = ExpressionKind.DerivedRepeaterVar;
7921
+ }
7922
+ transformInternalExpressions(transform2, flags) {
7923
+ }
7924
+ visitExpression(visitor, context) {
7925
+ }
7926
+ isEquivalent(e) {
7927
+ return e instanceof DerivedRepeaterVarExpr && e.identity === this.identity && e.xref === this.xref;
7928
+ }
7929
+ isConstant() {
7930
+ return false;
7931
+ }
7932
+ clone() {
7933
+ return new DerivedRepeaterVarExpr(this.xref, this.identity);
7934
+ }
7935
+ };
7936
+ var ConstCollectedExpr = class extends ExpressionBase {
7937
+ constructor(expr) {
7938
+ super();
7939
+ this.expr = expr;
7940
+ this.kind = ExpressionKind.ConstCollected;
7941
+ }
7942
+ transformInternalExpressions(transform2, flags) {
7943
+ this.expr = transform2(this.expr, flags);
7944
+ }
7945
+ visitExpression(visitor, context) {
7946
+ this.expr.visitExpression(visitor, context);
7947
+ }
7948
+ isEquivalent(e) {
7949
+ if (!(e instanceof ConstCollectedExpr)) {
7950
+ return false;
7951
+ }
7952
+ return this.expr.isEquivalent(e.expr);
7953
+ }
7954
+ isConstant() {
7955
+ return this.expr.isConstant();
7956
+ }
7957
+ clone() {
7958
+ return new ConstCollectedExpr(this.expr);
7959
+ }
7960
+ };
7888
7961
  function visitExpressionsInOp(op, visitor) {
7889
7962
  transformExpressionsInOp(op, (expr, flags) => {
7890
7963
  visitor(expr, flags);
@@ -7958,40 +8031,46 @@ function transformExpressionsInOp(op, transform2, flags) {
7958
8031
  case OpKind.ExtractedAttribute:
7959
8032
  op.expression = op.expression && transformExpressionsInExpression(op.expression, transform2, flags);
7960
8033
  break;
7961
- case OpKind.ExtractedMessage:
7962
- op.expression = transformExpressionsInExpression(op.expression, transform2, flags);
7963
- for (const statement of op.statements) {
7964
- transformExpressionsInStatement(statement, transform2, flags);
8034
+ case OpKind.RepeaterCreate:
8035
+ op.track = transformExpressionsInExpression(op.track, transform2, flags);
8036
+ if (op.trackByFn !== null) {
8037
+ op.trackByFn = transformExpressionsInExpression(op.trackByFn, transform2, flags);
7965
8038
  }
7966
8039
  break;
7967
- case OpKind.I18n:
7968
- case OpKind.I18nStart:
7969
- for (const [placeholder, expression] of op.params) {
7970
- op.params.set(placeholder, transformExpressionsInExpression(expression, transform2, flags));
7971
- }
8040
+ case OpKind.Repeater:
8041
+ op.collection = transformExpressionsInExpression(op.collection, transform2, flags);
7972
8042
  break;
7973
8043
  case OpKind.Defer:
7974
- case OpKind.DeferSecondaryBlock:
7975
- case OpKind.DeferOn:
7976
- case OpKind.Projection:
7977
- case OpKind.ProjectionDef:
7978
- case OpKind.Element:
7979
- case OpKind.ElementStart:
7980
- case OpKind.ElementEnd:
7981
- case OpKind.I18nEnd:
8044
+ if (op.loadingConfig !== null) {
8045
+ op.loadingConfig = transformExpressionsInExpression(op.loadingConfig, transform2, flags);
8046
+ }
8047
+ if (op.placeholderConfig !== null) {
8048
+ op.placeholderConfig = transformExpressionsInExpression(op.placeholderConfig, transform2, flags);
8049
+ }
8050
+ break;
8051
+ case OpKind.Advance:
7982
8052
  case OpKind.Container:
7983
- case OpKind.ContainerStart:
7984
8053
  case OpKind.ContainerEnd:
7985
- case OpKind.Template:
8054
+ case OpKind.ContainerStart:
8055
+ case OpKind.DeferOn:
7986
8056
  case OpKind.DisableBindings:
8057
+ case OpKind.Element:
8058
+ case OpKind.ElementEnd:
8059
+ case OpKind.ElementStart:
7987
8060
  case OpKind.EnableBindings:
7988
- case OpKind.Text:
7989
- case OpKind.Pipe:
7990
- case OpKind.Advance:
7991
- case OpKind.Namespace:
8061
+ case OpKind.ExtractedMessage:
8062
+ case OpKind.I18n:
7992
8063
  case OpKind.I18nApply:
8064
+ case OpKind.I18nEnd:
8065
+ case OpKind.I18nStart:
7993
8066
  case OpKind.Icu:
7994
8067
  case OpKind.IcuUpdate:
8068
+ case OpKind.Namespace:
8069
+ case OpKind.Pipe:
8070
+ case OpKind.Projection:
8071
+ case OpKind.ProjectionDef:
8072
+ case OpKind.Template:
8073
+ case OpKind.Text:
7995
8074
  break;
7996
8075
  default:
7997
8076
  throw new Error(`AssertionError: transformExpressionsInOp doesn't handle ${OpKind[op.kind]}`);
@@ -8264,6 +8343,13 @@ var OpList = _OpList;
8264
8343
  _OpList.nextListId = 0;
8265
8344
  })();
8266
8345
 
8346
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/handle.mjs
8347
+ var SlotHandle = class {
8348
+ constructor() {
8349
+ this.slot = null;
8350
+ }
8351
+ };
8352
+
8267
8353
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/create.mjs
8268
8354
  var elementContainerOpKinds = /* @__PURE__ */ new Set([
8269
8355
  OpKind.Element,
@@ -8271,7 +8357,7 @@ var elementContainerOpKinds = /* @__PURE__ */ new Set([
8271
8357
  OpKind.Container,
8272
8358
  OpKind.ContainerStart,
8273
8359
  OpKind.Template,
8274
- OpKind.Projection
8360
+ OpKind.RepeaterCreate
8275
8361
  ]);
8276
8362
  function isElementOrContainerOp(op) {
8277
8363
  return elementContainerOpKinds.has(op.kind);
@@ -8281,6 +8367,7 @@ function createElementStartOp(tag, xref, namespace, i18nPlaceholder, sourceSpan)
8281
8367
  kind: OpKind.ElementStart,
8282
8368
  xref,
8283
8369
  tag,
8370
+ handle: new SlotHandle(),
8284
8371
  attributes: null,
8285
8372
  localRefs: [],
8286
8373
  nonBindable: false,
@@ -8289,13 +8376,14 @@ function createElementStartOp(tag, xref, namespace, i18nPlaceholder, sourceSpan)
8289
8376
  sourceSpan
8290
8377
  }, TRAIT_CONSUMES_SLOT), NEW_OP);
8291
8378
  }
8292
- function createTemplateOp(xref, tag, namespace, generatedInBlock, i18nPlaceholder, sourceSpan) {
8379
+ function createTemplateOp(xref, tag, functionNameSuffix, namespace, i18nPlaceholder, sourceSpan) {
8293
8380
  return __spreadValues(__spreadValues({
8294
8381
  kind: OpKind.Template,
8295
8382
  xref,
8296
8383
  attributes: null,
8297
8384
  tag,
8298
- block: generatedInBlock,
8385
+ handle: new SlotHandle(),
8386
+ functionNameSuffix,
8299
8387
  decls: null,
8300
8388
  vars: null,
8301
8389
  localRefs: [],
@@ -8305,6 +8393,29 @@ function createTemplateOp(xref, tag, namespace, generatedInBlock, i18nPlaceholde
8305
8393
  sourceSpan
8306
8394
  }, TRAIT_CONSUMES_SLOT), NEW_OP);
8307
8395
  }
8396
+ function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, sourceSpan) {
8397
+ return __spreadProps(__spreadValues(__spreadValues({
8398
+ kind: OpKind.RepeaterCreate,
8399
+ attributes: null,
8400
+ xref: primaryView,
8401
+ handle: new SlotHandle(),
8402
+ emptyView,
8403
+ track,
8404
+ trackByFn: null,
8405
+ tag,
8406
+ functionNameSuffix: "For",
8407
+ namespace: Namespace.HTML,
8408
+ nonBindable: false,
8409
+ localRefs: [],
8410
+ decls: null,
8411
+ vars: null,
8412
+ varNames,
8413
+ usesComponentInstance: false,
8414
+ sourceSpan
8415
+ }, TRAIT_CONSUMES_SLOT), NEW_OP), {
8416
+ numSlotsUsed: emptyView === null ? 2 : 3
8417
+ });
8418
+ }
8308
8419
  function createElementEndOp(xref, sourceSpan) {
8309
8420
  return __spreadValues({
8310
8421
  kind: OpKind.ElementEnd,
@@ -8328,14 +8439,16 @@ function createTextOp(xref, initialValue, sourceSpan) {
8328
8439
  return __spreadValues(__spreadValues({
8329
8440
  kind: OpKind.Text,
8330
8441
  xref,
8442
+ handle: new SlotHandle(),
8331
8443
  initialValue,
8332
8444
  sourceSpan
8333
8445
  }, TRAIT_CONSUMES_SLOT), NEW_OP);
8334
8446
  }
8335
- function createListenerOp(target, name, tag, animationPhase, hostListener, sourceSpan) {
8336
- return __spreadValues(__spreadValues({
8447
+ function createListenerOp(target, targetSlot, name, tag, animationPhase, hostListener, sourceSpan) {
8448
+ return __spreadValues({
8337
8449
  kind: OpKind.Listener,
8338
8450
  target,
8451
+ targetSlot,
8339
8452
  tag,
8340
8453
  hostListener,
8341
8454
  name,
@@ -8345,21 +8458,16 @@ function createListenerOp(target, name, tag, animationPhase, hostListener, sourc
8345
8458
  isAnimationListener: animationPhase !== null,
8346
8459
  animationPhase,
8347
8460
  sourceSpan
8348
- }, NEW_OP), TRAIT_USES_SLOT_INDEX);
8461
+ }, NEW_OP);
8349
8462
  }
8350
- function createPipeOp(xref, name) {
8463
+ function createPipeOp(xref, slot, name) {
8351
8464
  return __spreadValues(__spreadValues({
8352
8465
  kind: OpKind.Pipe,
8353
8466
  xref,
8467
+ handle: slot,
8354
8468
  name
8355
8469
  }, NEW_OP), TRAIT_CONSUMES_SLOT);
8356
8470
  }
8357
- var Namespace;
8358
- (function(Namespace2) {
8359
- Namespace2[Namespace2["HTML"] = 0] = "HTML";
8360
- Namespace2[Namespace2["SVG"] = 1] = "SVG";
8361
- Namespace2[Namespace2["Math"] = 2] = "Math";
8362
- })(Namespace || (Namespace = {}));
8363
8471
  function createNamespaceOp(namespace) {
8364
8472
  return __spreadValues({
8365
8473
  kind: OpKind.Namespace,
@@ -8372,16 +8480,16 @@ function createProjectionDefOp(def) {
8372
8480
  def
8373
8481
  }, NEW_OP);
8374
8482
  }
8375
- function createProjectionOp(xref, selector) {
8483
+ function createProjectionOp(xref, selector, sourceSpan) {
8376
8484
  return __spreadValues(__spreadValues({
8377
8485
  kind: OpKind.Projection,
8378
8486
  xref,
8487
+ handle: new SlotHandle(),
8379
8488
  selector,
8380
8489
  projectionSlotIndex: 0,
8381
- attributes: null,
8490
+ attributes: [],
8382
8491
  localRefs: [],
8383
- nonBindable: false,
8384
- sourceSpan: null
8492
+ sourceSpan
8385
8493
  }, NEW_OP), TRAIT_CONSUMES_SLOT);
8386
8494
  }
8387
8495
  function createExtractedAttributeOp(target, bindingKind, name, expression) {
@@ -8393,53 +8501,60 @@ function createExtractedAttributeOp(target, bindingKind, name, expression) {
8393
8501
  expression
8394
8502
  }, NEW_OP);
8395
8503
  }
8396
- function createDeferOp(xref, main, sourceSpan) {
8397
- return __spreadValues(__spreadValues(__spreadValues({
8504
+ function createDeferOp(xref, main, mainSlot, sourceSpan) {
8505
+ return __spreadProps(__spreadValues(__spreadValues({
8398
8506
  kind: OpKind.Defer,
8399
8507
  xref,
8400
- target: main,
8401
- loading: null,
8402
- placeholder: null,
8403
- error: null,
8508
+ handle: new SlotHandle(),
8509
+ mainView: main,
8510
+ mainSlot,
8511
+ loadingView: null,
8512
+ loadingSlot: null,
8513
+ loadingConfig: null,
8514
+ loadingMinimumTime: null,
8515
+ loadingAfterTime: null,
8516
+ placeholderView: null,
8517
+ placeholderSlot: null,
8518
+ placeholderConfig: null,
8519
+ placeholderMinimumTime: null,
8520
+ errorView: null,
8521
+ errorSlot: null,
8404
8522
  sourceSpan
8405
- }, NEW_OP), TRAIT_CONSUMES_SLOT), TRAIT_USES_SLOT_INDEX);
8523
+ }, NEW_OP), TRAIT_CONSUMES_SLOT), {
8524
+ numSlotsUsed: 2
8525
+ });
8406
8526
  }
8407
- function createDeferSecondaryOp(deferOp, secondaryView, secondaryBlockKind) {
8408
- return __spreadValues(__spreadValues(__spreadValues({
8409
- kind: OpKind.DeferSecondaryBlock,
8410
- deferOp,
8411
- target: secondaryView,
8412
- secondaryBlockKind,
8413
- constValue: null,
8414
- makeExpression: literalOrArrayLiteral
8415
- }, NEW_OP), TRAIT_USES_SLOT_INDEX), TRAIT_HAS_CONST);
8416
- }
8417
- function createDeferOnOp(xref, sourceSpan) {
8418
- return __spreadValues(__spreadValues({
8527
+ function createDeferOnOp(defer2, trigger, prefetch, sourceSpan) {
8528
+ return __spreadValues({
8419
8529
  kind: OpKind.DeferOn,
8420
- xref,
8530
+ defer: defer2,
8531
+ trigger,
8532
+ prefetch,
8421
8533
  sourceSpan
8422
- }, NEW_OP), TRAIT_CONSUMES_SLOT);
8534
+ }, NEW_OP);
8423
8535
  }
8424
- function createExtractedMessageOp(owner, expression, statements) {
8536
+ function createExtractedMessageOp(owner, message, isRoot) {
8425
8537
  return __spreadValues({
8426
8538
  kind: OpKind.ExtractedMessage,
8427
8539
  owner,
8428
- expression,
8429
- statements
8540
+ message,
8541
+ isRoot,
8542
+ params: /* @__PURE__ */ new Map(),
8543
+ postprocessingParams: /* @__PURE__ */ new Map(),
8544
+ needsPostprocessing: false,
8545
+ formattedParams: null,
8546
+ formattedPostprocessingParams: null
8430
8547
  }, NEW_OP);
8431
8548
  }
8432
8549
  function createI18nStartOp(xref, message, root) {
8433
8550
  return __spreadValues(__spreadValues({
8434
8551
  kind: OpKind.I18nStart,
8435
8552
  xref,
8553
+ handle: new SlotHandle(),
8436
8554
  root: root != null ? root : xref,
8437
8555
  message,
8438
- params: /* @__PURE__ */ new Map(),
8439
- postprocessingParams: /* @__PURE__ */ new Map(),
8440
8556
  messageIndex: null,
8441
- subTemplateIndex: null,
8442
- needsPostprocessing: false
8557
+ subTemplateIndex: null
8443
8558
  }, NEW_OP), TRAIT_CONSUMES_SLOT);
8444
8559
  }
8445
8560
  function createI18nEndOp(xref) {
@@ -8456,12 +8571,6 @@ function createIcuOp(xref, message, sourceSpan) {
8456
8571
  sourceSpan
8457
8572
  }, NEW_OP);
8458
8573
  }
8459
- function literalOrArrayLiteral(value) {
8460
- if (Array.isArray(value)) {
8461
- return literalArr(value.map(literalOrArrayLiteral));
8462
- }
8463
- return literal(value, INFERRED_TYPE);
8464
- }
8465
8574
 
8466
8575
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/host.mjs
8467
8576
  function createHostPropertyOp(name, expression, isAnimationTrigger, sourceSpan) {
@@ -8560,6 +8669,7 @@ var ViewCompilationUnit = class extends CompilationUnit {
8560
8669
  this.job = job;
8561
8670
  this.parent = parent;
8562
8671
  this.contextVariables = /* @__PURE__ */ new Map();
8672
+ this.aliases = /* @__PURE__ */ new Set();
8563
8673
  this.decls = null;
8564
8674
  }
8565
8675
  };
@@ -8582,108 +8692,8 @@ var HostBindingCompilationUnit = class extends CompilationUnit {
8582
8692
  }
8583
8693
  };
8584
8694
 
8585
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/var_counting.mjs
8586
- function phaseVarCounting(job) {
8587
- for (const unit of job.units) {
8588
- let varCount = 0;
8589
- for (const op of unit.ops()) {
8590
- if (hasConsumesVarsTrait(op)) {
8591
- varCount += varsUsedByOp(op);
8592
- }
8593
- }
8594
- for (const op of unit.ops()) {
8595
- visitExpressionsInOp(op, (expr) => {
8596
- if (!isIrExpression(expr)) {
8597
- return;
8598
- }
8599
- if (hasUsesVarOffsetTrait(expr)) {
8600
- expr.varOffset = varCount;
8601
- }
8602
- if (hasConsumesVarsTrait(expr)) {
8603
- varCount += varsUsedByIrExpression(expr);
8604
- }
8605
- });
8606
- }
8607
- unit.vars = varCount;
8608
- }
8609
- if (job instanceof ComponentCompilationJob) {
8610
- for (const unit of job.units) {
8611
- for (const op of unit.create) {
8612
- if (op.kind !== OpKind.Template) {
8613
- continue;
8614
- }
8615
- const childView = job.views.get(op.xref);
8616
- op.vars = childView.vars;
8617
- }
8618
- }
8619
- }
8620
- }
8621
- function varsUsedByOp(op) {
8622
- let slots;
8623
- switch (op.kind) {
8624
- case OpKind.Property:
8625
- case OpKind.HostProperty:
8626
- case OpKind.Attribute:
8627
- slots = 1;
8628
- if (op.expression instanceof Interpolation2) {
8629
- slots += op.expression.expressions.length;
8630
- }
8631
- return slots;
8632
- case OpKind.StyleProp:
8633
- case OpKind.ClassProp:
8634
- case OpKind.StyleMap:
8635
- case OpKind.ClassMap:
8636
- slots = 2;
8637
- if (op.expression instanceof Interpolation2) {
8638
- slots += op.expression.expressions.length;
8639
- }
8640
- return slots;
8641
- case OpKind.InterpolateText:
8642
- return op.interpolation.expressions.length;
8643
- case OpKind.I18nExpression:
8644
- case OpKind.Conditional:
8645
- return 1;
8646
- default:
8647
- throw new Error(`Unhandled op: ${OpKind[op.kind]}`);
8648
- }
8649
- }
8650
- function varsUsedByIrExpression(expr) {
8651
- switch (expr.kind) {
8652
- case ExpressionKind.PureFunctionExpr:
8653
- return 1 + expr.args.length;
8654
- case ExpressionKind.PipeBinding:
8655
- return 1 + expr.args.length;
8656
- case ExpressionKind.PipeBindingVariadic:
8657
- return 1 + expr.numArgs;
8658
- default:
8659
- throw new Error(`AssertionError: unhandled ConsumesVarsTrait expression ${expr.constructor.name}`);
8660
- }
8661
- }
8662
-
8663
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/align_pipe_variadic_var_offset.mjs
8664
- function phaseAlignPipeVariadicVarOffset(job) {
8665
- for (const unit of job.units) {
8666
- for (const op of unit.update) {
8667
- visitExpressionsInOp(op, (expr) => {
8668
- if (!(expr instanceof PipeBindingVariadicExpr)) {
8669
- return expr;
8670
- }
8671
- if (!(expr.args instanceof PureFunctionExpr)) {
8672
- return expr;
8673
- }
8674
- if (expr.varOffset === null || expr.args.varOffset === null) {
8675
- throw new Error(`Must run after variable counting`);
8676
- }
8677
- expr.varOffset = expr.args.varOffset;
8678
- expr.args.varOffset = expr.varOffset + varsUsedByIrExpression(expr);
8679
- return void 0;
8680
- });
8681
- }
8682
- }
8683
- }
8684
-
8685
8695
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/any_cast.mjs
8686
- function phaseFindAnyCasts(job) {
8696
+ function deleteAnyCasts(job) {
8687
8697
  for (const unit of job.units) {
8688
8698
  for (const op of unit.ops()) {
8689
8699
  transformExpressionsInOp(op, removeAnys, VisitorContextFlag.None);
@@ -8701,11 +8711,11 @@ function removeAnys(e) {
8701
8711
  }
8702
8712
 
8703
8713
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/apply_i18n_expressions.mjs
8704
- function phaseApplyI18nExpressions(job) {
8714
+ function applyI18nExpressions(job) {
8705
8715
  for (const unit of job.units) {
8706
8716
  for (const op of unit.update) {
8707
8717
  if (op.kind === OpKind.I18nExpression && needsApplication(op)) {
8708
- OpList.insertAfter(createI18nApplyOp(op.owner, null), op);
8718
+ OpList.insertAfter(createI18nApplyOp(op.owner, op.ownerSlot, null), op);
8709
8719
  }
8710
8720
  }
8711
8721
  }
@@ -8722,7 +8732,7 @@ function needsApplication(op) {
8722
8732
  }
8723
8733
 
8724
8734
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/assign_i18n_slot_dependencies.mjs
8725
- function phaseAssignI18nSlotDependencies(job) {
8735
+ function assignI18nSlotDependencies(job) {
8726
8736
  const i18nLastSlotConsumers = /* @__PURE__ */ new Map();
8727
8737
  let lastSlotConsumer = null;
8728
8738
  for (const unit of job.units) {
@@ -8743,21 +8753,21 @@ function phaseAssignI18nSlotDependencies(job) {
8743
8753
  }
8744
8754
 
8745
8755
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/util/elements.mjs
8746
- function getElementsByXrefId(unit) {
8747
- const elements = /* @__PURE__ */ new Map();
8756
+ function createOpXrefMap(unit) {
8757
+ const map = /* @__PURE__ */ new Map();
8748
8758
  for (const op of unit.create) {
8749
- if (!isElementOrContainerOp(op)) {
8759
+ if (!hasConsumesSlotTrait(op)) {
8750
8760
  continue;
8751
8761
  }
8752
- elements.set(op.xref, op);
8762
+ map.set(op.xref, op);
8753
8763
  }
8754
- return elements;
8764
+ return map;
8755
8765
  }
8756
8766
 
8757
8767
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/attribute_extraction.mjs
8758
- function phaseAttributeExtraction(job) {
8768
+ function extractAttributes(job) {
8759
8769
  for (const unit of job.units) {
8760
- const elements = getElementsByXrefId(unit);
8770
+ const elements = createOpXrefMap(unit);
8761
8771
  for (const op of unit.ops()) {
8762
8772
  switch (op.kind) {
8763
8773
  case OpKind.Attribute:
@@ -8829,7 +8839,7 @@ function lookupElement2(elements, xref) {
8829
8839
  }
8830
8840
  return el;
8831
8841
  }
8832
- function phaseBindingSpecialization(job) {
8842
+ function specializeBindings(job) {
8833
8843
  const elements = /* @__PURE__ */ new Map();
8834
8844
  for (const unit of job.units) {
8835
8845
  for (const op of unit.create) {
@@ -8900,35 +8910,35 @@ var CHAINABLE = /* @__PURE__ */ new Set([
8900
8910
  Identifiers.syntheticHostProperty,
8901
8911
  Identifiers.templateCreate
8902
8912
  ]);
8903
- function phaseChaining(job) {
8913
+ function chain(job) {
8904
8914
  for (const unit of job.units) {
8905
8915
  chainOperationsInList(unit.create);
8906
8916
  chainOperationsInList(unit.update);
8907
8917
  }
8908
8918
  }
8909
8919
  function chainOperationsInList(opList) {
8910
- let chain = null;
8920
+ let chain2 = null;
8911
8921
  for (const op of opList) {
8912
8922
  if (op.kind !== OpKind.Statement || !(op.statement instanceof ExpressionStatement)) {
8913
- chain = null;
8923
+ chain2 = null;
8914
8924
  continue;
8915
8925
  }
8916
8926
  if (!(op.statement.expr instanceof InvokeFunctionExpr) || !(op.statement.expr.fn instanceof ExternalExpr)) {
8917
- chain = null;
8927
+ chain2 = null;
8918
8928
  continue;
8919
8929
  }
8920
8930
  const instruction = op.statement.expr.fn.value;
8921
8931
  if (!CHAINABLE.has(instruction)) {
8922
- chain = null;
8932
+ chain2 = null;
8923
8933
  continue;
8924
8934
  }
8925
- if (chain !== null && chain.instruction === instruction) {
8926
- const expression = chain.expression.callFn(op.statement.expr.args, op.statement.expr.sourceSpan, op.statement.expr.pure);
8927
- chain.expression = expression;
8928
- chain.op.statement = expression.toStmt();
8935
+ if (chain2 !== null && chain2.instruction === instruction) {
8936
+ const expression = chain2.expression.callFn(op.statement.expr.args, op.statement.expr.sourceSpan, op.statement.expr.pure);
8937
+ chain2.expression = expression;
8938
+ chain2.op.statement = expression.toStmt();
8929
8939
  OpList.remove(op);
8930
8940
  } else {
8931
- chain = {
8941
+ chain2 = {
8932
8942
  op,
8933
8943
  instruction,
8934
8944
  expression: op.statement.expr
@@ -8937,8 +8947,20 @@ function chainOperationsInList(opList) {
8937
8947
  }
8938
8948
  }
8939
8949
 
8950
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/collapse_singleton_interpolations.mjs
8951
+ function collapseSingletonInterpolations(job) {
8952
+ for (const unit of job.units) {
8953
+ for (const op of unit.update) {
8954
+ const eligibleOpKind = op.kind === OpKind.Attribute;
8955
+ if (eligibleOpKind && op.expression instanceof Interpolation2 && op.expression.strings.length === 2 && op.expression.strings.every((s) => s === "")) {
8956
+ op.expression = op.expression.expressions[0];
8957
+ }
8958
+ }
8959
+ }
8960
+ }
8961
+
8940
8962
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/conditionals.mjs
8941
- function phaseConditionals(job) {
8963
+ function generateConditionalExpressions(job) {
8942
8964
  for (const unit of job.units) {
8943
8965
  for (const op of unit.ops()) {
8944
8966
  if (op.kind !== OpKind.Conditional) {
@@ -8947,8 +8969,8 @@ function phaseConditionals(job) {
8947
8969
  let test;
8948
8970
  const defaultCase = op.conditions.findIndex((cond) => cond.expr === null);
8949
8971
  if (defaultCase >= 0) {
8950
- const xref = op.conditions.splice(defaultCase, 1)[0].target;
8951
- test = new SlotLiteralExpr(xref);
8972
+ const slot = op.conditions.splice(defaultCase, 1)[0].targetSlot;
8973
+ test = new SlotLiteralExpr(slot);
8952
8974
  } else {
8953
8975
  test = literal(-1);
8954
8976
  }
@@ -8966,9 +8988,10 @@ function phaseConditionals(job) {
8966
8988
  conditionalCase.expr = new AssignTemporaryExpr(conditionalCase.expr, caseExpressionTemporaryXref);
8967
8989
  op.contextValue = new ReadTemporaryExpr(caseExpressionTemporaryXref);
8968
8990
  }
8969
- test = new ConditionalExpr(conditionalCase.expr, new SlotLiteralExpr(conditionalCase.target), test);
8991
+ test = new ConditionalExpr(conditionalCase.expr, new SlotLiteralExpr(conditionalCase.targetSlot), test);
8970
8992
  }
8971
8993
  op.processed = test;
8994
+ op.conditions = [];
8972
8995
  }
8973
8996
  }
8974
8997
  }
@@ -9049,15 +9072,15 @@ function prefixWithNamespace(strippedTag, namespace) {
9049
9072
  }
9050
9073
  return `:${keyForNamespace(namespace)}:${strippedTag}`;
9051
9074
  }
9052
- function literalOrArrayLiteral2(value) {
9075
+ function literalOrArrayLiteral(value) {
9053
9076
  if (Array.isArray(value)) {
9054
- return literalArr(value.map(literalOrArrayLiteral2));
9077
+ return literalArr(value.map(literalOrArrayLiteral));
9055
9078
  }
9056
- return literal(value, INFERRED_TYPE);
9079
+ return literal(value);
9057
9080
  }
9058
9081
 
9059
9082
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/const_collection.mjs
9060
- function phaseConstCollection(job) {
9083
+ function collectElementConsts(job) {
9061
9084
  const allElementAttributes = /* @__PURE__ */ new Map();
9062
9085
  for (const unit of job.units) {
9063
9086
  for (const op of unit.create) {
@@ -9170,7 +9193,7 @@ function serializeAttributes({ attributes, bindings, classes, i18n: i18n2, proje
9170
9193
  const attrArray = [...attributes];
9171
9194
  if (projectAs !== null) {
9172
9195
  const parsedR3Selector = parseSelectorToR3Selector(projectAs)[0];
9173
- attrArray.push(literal(5), literalOrArrayLiteral2(parsedR3Selector));
9196
+ attrArray.push(literal(5), literalOrArrayLiteral(parsedR3Selector));
9174
9197
  }
9175
9198
  if (classes.length > 0) {
9176
9199
  attrArray.push(literal(1), ...classes);
@@ -9190,6 +9213,101 @@ function serializeAttributes({ attributes, bindings, classes, i18n: i18n2, proje
9190
9213
  return literalArr(attrArray);
9191
9214
  }
9192
9215
 
9216
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/defer_configs.mjs
9217
+ function configureDeferInstructions(job) {
9218
+ for (const unit of job.units) {
9219
+ for (const op of unit.create) {
9220
+ if (op.kind !== OpKind.Defer) {
9221
+ continue;
9222
+ }
9223
+ if (op.placeholderMinimumTime !== null) {
9224
+ op.placeholderConfig = new ConstCollectedExpr(literalOrArrayLiteral([op.placeholderMinimumTime]));
9225
+ }
9226
+ if (op.loadingMinimumTime !== null || op.loadingAfterTime !== null) {
9227
+ op.loadingConfig = new ConstCollectedExpr(literalOrArrayLiteral([op.loadingMinimumTime, op.loadingAfterTime]));
9228
+ }
9229
+ }
9230
+ }
9231
+ }
9232
+
9233
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/defer_resolve_targets.mjs
9234
+ function resolveDeferTargetNames(job) {
9235
+ const scopes = /* @__PURE__ */ new Map();
9236
+ function getScopeForView2(view) {
9237
+ if (scopes.has(view.xref)) {
9238
+ return scopes.get(view.xref);
9239
+ }
9240
+ const scope = new Scope();
9241
+ for (const op of view.create) {
9242
+ if (!isElementOrContainerOp(op) || op.localRefs === null) {
9243
+ continue;
9244
+ }
9245
+ if (!Array.isArray(op.localRefs)) {
9246
+ throw new Error("LocalRefs were already processed, but were needed to resolve defer targets.");
9247
+ }
9248
+ for (const ref of op.localRefs) {
9249
+ if (ref.target !== "") {
9250
+ continue;
9251
+ }
9252
+ scope.targets.set(ref.name, { xref: op.xref, slot: op.handle });
9253
+ }
9254
+ }
9255
+ scopes.set(view.xref, scope);
9256
+ return scope;
9257
+ }
9258
+ function resolveTrigger(deferOwnerView, op, placeholderView) {
9259
+ switch (op.trigger.kind) {
9260
+ case DeferTriggerKind.Idle:
9261
+ case DeferTriggerKind.Immediate:
9262
+ case DeferTriggerKind.Timer:
9263
+ return;
9264
+ case DeferTriggerKind.Hover:
9265
+ case DeferTriggerKind.Interaction:
9266
+ case DeferTriggerKind.Viewport:
9267
+ if (op.trigger.targetName === null) {
9268
+ return;
9269
+ }
9270
+ let view = placeholderView !== null ? job.views.get(placeholderView) : deferOwnerView;
9271
+ let step = placeholderView !== null ? -1 : 0;
9272
+ while (view !== null) {
9273
+ const scope = getScopeForView2(view);
9274
+ if (scope.targets.has(op.trigger.targetName)) {
9275
+ const { xref, slot } = scope.targets.get(op.trigger.targetName);
9276
+ op.trigger.targetXref = xref;
9277
+ op.trigger.targetView = view.xref;
9278
+ op.trigger.targetSlotViewSteps = step;
9279
+ op.trigger.targetSlot = slot;
9280
+ return;
9281
+ }
9282
+ view = view.parent !== null ? job.views.get(view.parent) : null;
9283
+ step++;
9284
+ }
9285
+ break;
9286
+ default:
9287
+ throw new Error(`Trigger kind ${op.trigger.kind} not handled`);
9288
+ }
9289
+ }
9290
+ for (const unit of job.units) {
9291
+ const defers = /* @__PURE__ */ new Map();
9292
+ for (const op of unit.create) {
9293
+ switch (op.kind) {
9294
+ case OpKind.Defer:
9295
+ defers.set(op.xref, op);
9296
+ break;
9297
+ case OpKind.DeferOn:
9298
+ const deferOp = defers.get(op.defer);
9299
+ resolveTrigger(unit, op, deferOp.placeholderView);
9300
+ break;
9301
+ }
9302
+ }
9303
+ }
9304
+ }
9305
+ var Scope = class {
9306
+ constructor() {
9307
+ this.targets = /* @__PURE__ */ new Map();
9308
+ }
9309
+ };
9310
+
9193
9311
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/empty_elements.mjs
9194
9312
  var REPLACEMENTS = /* @__PURE__ */ new Map([
9195
9313
  [OpKind.ElementEnd, [OpKind.ElementStart, OpKind.Element]],
@@ -9197,7 +9315,7 @@ var REPLACEMENTS = /* @__PURE__ */ new Map([
9197
9315
  [OpKind.I18nEnd, [OpKind.I18nStart, OpKind.I18n]]
9198
9316
  ]);
9199
9317
  var IGNORED_OP_KINDS = /* @__PURE__ */ new Set([OpKind.Pipe]);
9200
- function phaseEmptyElements(job) {
9318
+ function collapseEmptyInstructions(job) {
9201
9319
  for (const unit of job.units) {
9202
9320
  for (const op of unit.create) {
9203
9321
  const opReplacements = REPLACEMENTS.get(op.kind);
@@ -9218,7 +9336,7 @@ function phaseEmptyElements(job) {
9218
9336
  }
9219
9337
 
9220
9338
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/expand_safe_reads.mjs
9221
- function phaseExpandSafeReads(job) {
9339
+ function expandSafeReads(job) {
9222
9340
  for (const unit of job.units) {
9223
9341
  for (const op of unit.ops()) {
9224
9342
  transformExpressionsInOp(op, (e) => safeTransform(e, { job }), VisitorContextFlag.None);
@@ -9340,30 +9458,92 @@ function safeTransform(e, ctx) {
9340
9458
  if (e instanceof SafePropertyReadExpr) {
9341
9459
  return safeTernaryWithTemporary(e.receiver, (r) => r.prop(e.name), ctx);
9342
9460
  }
9343
- if (e instanceof SafeKeyedReadExpr) {
9344
- return safeTernaryWithTemporary(e.receiver, (r) => r.key(e.index), ctx);
9461
+ if (e instanceof SafeKeyedReadExpr) {
9462
+ return safeTernaryWithTemporary(e.receiver, (r) => r.key(e.index), ctx);
9463
+ }
9464
+ }
9465
+ return e;
9466
+ }
9467
+ function ternaryTransform(e) {
9468
+ if (!(e instanceof SafeTernaryExpr)) {
9469
+ return e;
9470
+ }
9471
+ return new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.Equals, e.guard, NULL_EXPR), NULL_EXPR, e.expr);
9472
+ }
9473
+
9474
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/format_i18n_params.mjs
9475
+ var ESCAPE = "\uFFFD";
9476
+ var ELEMENT_MARKER = "#";
9477
+ var TEMPLATE_MARKER = "*";
9478
+ var TAG_CLOSE_MARKER = "/";
9479
+ var CONTEXT_MARKER = ":";
9480
+ var LIST_START_MARKER = "[";
9481
+ var LIST_END_MARKER = "]";
9482
+ var LIST_DELIMITER = "|";
9483
+ function formatI18nParams(job) {
9484
+ for (const unit of job.units) {
9485
+ for (const op of unit.create) {
9486
+ if (op.kind === OpKind.ExtractedMessage) {
9487
+ if (op.isRoot) {
9488
+ op.formattedParams = formatParams(op.params);
9489
+ op.formattedPostprocessingParams = formatParams(op.postprocessingParams);
9490
+ op.needsPostprocessing = op.postprocessingParams.size > 0;
9491
+ for (const [param, values] of op.params) {
9492
+ if (values.length > 1) {
9493
+ op.needsPostprocessing = true;
9494
+ }
9495
+ }
9496
+ }
9497
+ }
9498
+ }
9499
+ }
9500
+ }
9501
+ function formatParams(params) {
9502
+ const result = /* @__PURE__ */ new Map();
9503
+ for (const [placeholder, placeholderValues] of [...params].sort()) {
9504
+ const serializedValues = formatParamValues(placeholderValues);
9505
+ if (serializedValues !== null) {
9506
+ result.set(placeholder, literal(formatParamValues(placeholderValues)));
9345
9507
  }
9346
9508
  }
9347
- return e;
9509
+ return result;
9348
9510
  }
9349
- function ternaryTransform(e) {
9350
- if (!(e instanceof SafeTernaryExpr)) {
9351
- return e;
9511
+ function formatParamValues(values) {
9512
+ if (values.length === 0) {
9513
+ return null;
9352
9514
  }
9353
- return new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.Equals, e.guard, NULL_EXPR), NULL_EXPR, e.expr);
9515
+ const serializedValues = values.map((value) => formatValue(value));
9516
+ return serializedValues.length === 1 ? serializedValues[0] : `${LIST_START_MARKER}${serializedValues.join(LIST_DELIMITER)}${LIST_END_MARKER}`;
9517
+ }
9518
+ function formatValue(value) {
9519
+ let tagMarker = "";
9520
+ let closeMarker = "";
9521
+ if (value.flags & I18nParamValueFlags.ElementTag) {
9522
+ tagMarker = ELEMENT_MARKER;
9523
+ } else if (value.flags & I18nParamValueFlags.TemplateTag) {
9524
+ tagMarker = TEMPLATE_MARKER;
9525
+ }
9526
+ if (tagMarker !== "") {
9527
+ closeMarker = value.flags & I18nParamValueFlags.CloseTag ? TAG_CLOSE_MARKER : "";
9528
+ }
9529
+ const context = value.subTemplateIndex === null ? "" : `${CONTEXT_MARKER}${value.subTemplateIndex}`;
9530
+ if (value.flags & I18nParamValueFlags.OpenTag && value.flags & I18nParamValueFlags.CloseTag) {
9531
+ return `${ESCAPE}${tagMarker}${value.value}${context}${ESCAPE}${ESCAPE}${closeMarker}${tagMarker}${value.value}${context}${ESCAPE}`;
9532
+ }
9533
+ return `${ESCAPE}${closeMarker}${tagMarker}${value.value}${context}${ESCAPE}`;
9354
9534
  }
9355
9535
 
9356
9536
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/generate_advance.mjs
9357
- function phaseGenerateAdvance(job) {
9537
+ function generateAdvance(job) {
9358
9538
  for (const unit of job.units) {
9359
9539
  const slotMap = /* @__PURE__ */ new Map();
9360
9540
  for (const op of unit.create) {
9361
9541
  if (!hasConsumesSlotTrait(op)) {
9362
9542
  continue;
9363
- } else if (op.slot === null) {
9543
+ } else if (op.handle.slot === null) {
9364
9544
  throw new Error(`AssertionError: expected slots to have been allocated before generating advance() calls`);
9365
9545
  }
9366
- slotMap.set(op.xref, op.slot);
9546
+ slotMap.set(op.xref, op.handle.slot);
9367
9547
  }
9368
9548
  let slotContext = 0;
9369
9549
  for (const op of unit.update) {
@@ -9386,7 +9566,7 @@ function phaseGenerateAdvance(job) {
9386
9566
  }
9387
9567
 
9388
9568
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/generate_projection_def.mjs
9389
- function phaseGenerateProjectionDef(job) {
9569
+ function generateProjectionDefs(job) {
9390
9570
  const share = job.compatibility === CompatibilityMode.TemplateDefinitionBuilder;
9391
9571
  const selectors = [];
9392
9572
  let projectionSlotIndex = 0;
@@ -9402,15 +9582,15 @@ function phaseGenerateProjectionDef(job) {
9402
9582
  let defExpr = null;
9403
9583
  if (selectors.length > 1 || selectors[0] !== "*") {
9404
9584
  const def = selectors.map((s) => s === "*" ? s : parseSelectorToR3Selector(s));
9405
- defExpr = job.pool.getConstLiteral(literalOrArrayLiteral2(def), share);
9585
+ defExpr = job.pool.getConstLiteral(literalOrArrayLiteral(def), share);
9406
9586
  }
9407
- job.contentSelectors = job.pool.getConstLiteral(literalOrArrayLiteral2(selectors), share);
9587
+ job.contentSelectors = job.pool.getConstLiteral(literalOrArrayLiteral(selectors), share);
9408
9588
  job.root.create.prepend([createProjectionDefOp(defExpr)]);
9409
9589
  }
9410
9590
  }
9411
9591
 
9412
9592
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/generate_variables.mjs
9413
- function phaseGenerateVariables(job) {
9593
+ function generateVariables(job) {
9414
9594
  recursivelyProcessView(job.root, null);
9415
9595
  }
9416
9596
  function recursivelyProcessView(view, parentScope) {
@@ -9418,6 +9598,7 @@ function recursivelyProcessView(view, parentScope) {
9418
9598
  for (const op of view.create) {
9419
9599
  switch (op.kind) {
9420
9600
  case OpKind.Template:
9601
+ case OpKind.RepeaterCreate:
9421
9602
  recursivelyProcessView(view.job.views.get(op.xref), scope);
9422
9603
  break;
9423
9604
  case OpKind.Listener:
@@ -9437,6 +9618,7 @@ function getScopeForView(view, parent) {
9437
9618
  view: view.xref
9438
9619
  },
9439
9620
  contextVariables: /* @__PURE__ */ new Map(),
9621
+ aliases: view.aliases,
9440
9622
  references: [],
9441
9623
  parent
9442
9624
  };
@@ -9458,6 +9640,7 @@ function getScopeForView(view, parent) {
9458
9640
  scope.references.push({
9459
9641
  name: op.localRefs[offset].name,
9460
9642
  targetId: op.xref,
9643
+ targetSlot: op.handle,
9461
9644
  offset,
9462
9645
  variable: {
9463
9646
  kind: SemanticVariableKind.Identifier,
@@ -9474,15 +9657,19 @@ function getScopeForView(view, parent) {
9474
9657
  function generateVariablesInScopeForView(view, scope) {
9475
9658
  const newOps = [];
9476
9659
  if (scope.view !== view.xref) {
9477
- newOps.push(createVariableOp(view.job.allocateXrefId(), scope.viewContextVariable, new NextContextExpr()));
9660
+ newOps.push(createVariableOp(view.job.allocateXrefId(), scope.viewContextVariable, new NextContextExpr(), VariableFlags.None));
9478
9661
  }
9479
- for (const [name, value] of view.job.views.get(scope.view).contextVariables) {
9662
+ const scopeView = view.job.views.get(scope.view);
9663
+ for (const [name, value] of scopeView.contextVariables) {
9480
9664
  const context = new ContextExpr(scope.view);
9481
9665
  const variable2 = value === CTX_REF ? context : new ReadPropExpr(context, value);
9482
- newOps.push(createVariableOp(view.job.allocateXrefId(), scope.contextVariables.get(name), variable2));
9666
+ newOps.push(createVariableOp(view.job.allocateXrefId(), scope.contextVariables.get(name), variable2, VariableFlags.None));
9667
+ }
9668
+ for (const alias of scopeView.aliases) {
9669
+ newOps.push(createVariableOp(view.job.allocateXrefId(), alias, alias.expression.clone(), VariableFlags.AlwaysInline));
9483
9670
  }
9484
9671
  for (const ref of scope.references) {
9485
- newOps.push(createVariableOp(view.job.allocateXrefId(), ref.variable, new ReferenceExpr(ref.targetId, ref.offset)));
9672
+ newOps.push(createVariableOp(view.job.allocateXrefId(), ref.variable, new ReferenceExpr(ref.targetId, ref.targetSlot, ref.offset), VariableFlags.None));
9486
9673
  }
9487
9674
  if (scope.parent !== null) {
9488
9675
  newOps.push(...generateVariablesInScopeForView(view, scope.parent));
@@ -9490,23 +9677,16 @@ function generateVariablesInScopeForView(view, scope) {
9490
9677
  return newOps;
9491
9678
  }
9492
9679
 
9493
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/has_const_trait_collection.mjs
9494
- function phaseConstTraitCollection(job) {
9495
- const collectGlobalConsts = (e) => {
9496
- if (e instanceof ExpressionBase && hasConstTrait(e)) {
9497
- const ea = e;
9498
- if (ea.constValue !== null) {
9499
- ea.constIndex = job.addConst(ea.constValue);
9500
- }
9501
- }
9502
- return e;
9503
- };
9680
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/has_const_expression_collection.mjs
9681
+ function collectConstExpressions(job) {
9504
9682
  for (const unit of job.units) {
9505
9683
  for (const op of unit.ops()) {
9506
- if (hasConstTrait(op) && op.constValue !== null) {
9507
- op.constIndex = job.addConst(op.makeExpression(op.constValue));
9508
- }
9509
- transformExpressionsInOp(op, collectGlobalConsts, VisitorContextFlag.None);
9684
+ transformExpressionsInOp(op, (expr) => {
9685
+ if (!(expr instanceof ConstCollectedExpr)) {
9686
+ return expr;
9687
+ }
9688
+ return literal(job.addConst(expr.expr));
9689
+ }, VisitorContextFlag.None);
9510
9690
  }
9511
9691
  }
9512
9692
  }
@@ -9517,7 +9697,7 @@ var CLASS_DOT = "class.";
9517
9697
  var STYLE_BANG = "style!";
9518
9698
  var CLASS_BANG = "class!";
9519
9699
  var BANG_IMPORTANT = "!important";
9520
- function phaseHostStylePropertyParsing(job) {
9700
+ function parseHostStyleProperties(job) {
9521
9701
  for (const op of job.root.update) {
9522
9702
  if (op.kind !== OpKind.Binding) {
9523
9703
  continue;
@@ -9569,26 +9749,6 @@ function parseProperty(name) {
9569
9749
  return { property: property2, suffix };
9570
9750
  }
9571
9751
 
9572
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_const_collection.mjs
9573
- function phaseI18nConstCollection(job) {
9574
- const messageConstIndices = {};
9575
- for (const unit of job.units) {
9576
- for (const op of unit.create) {
9577
- if (op.kind === OpKind.ExtractedMessage) {
9578
- messageConstIndices[op.owner] = job.addConst(op.expression, op.statements);
9579
- OpList.remove(op);
9580
- }
9581
- }
9582
- }
9583
- for (const unit of job.units) {
9584
- for (const op of unit.create) {
9585
- if (op.kind === OpKind.I18nStart) {
9586
- op.messageIndex = messageConstIndices[op.root];
9587
- }
9588
- }
9589
- }
9590
- }
9591
-
9592
9752
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/output/map_util.mjs
9593
9753
  function mapLiteral(obj, quoted = false) {
9594
9754
  return literalMap(Object.keys(obj).map((key) => ({
@@ -10961,11 +11121,12 @@ var Comment2 = class {
10961
11121
  }
10962
11122
  };
10963
11123
  var Block = class {
10964
- constructor(name, parameters, children, sourceSpan, startSourceSpan, endSourceSpan = null) {
11124
+ constructor(name, parameters, children, sourceSpan, nameSpan, startSourceSpan, endSourceSpan = null) {
10965
11125
  this.name = name;
10966
11126
  this.parameters = parameters;
10967
11127
  this.children = children;
10968
11128
  this.sourceSpan = sourceSpan;
11129
+ this.nameSpan = nameSpan;
10969
11130
  this.startSourceSpan = startSourceSpan;
10970
11131
  this.endSourceSpan = endSourceSpan;
10971
11132
  }
@@ -14538,7 +14699,7 @@ var _Tokenizer = class {
14538
14699
  return true;
14539
14700
  }
14540
14701
  }
14541
- if (this._tokenizeBlocks && !this._inInterpolation && !this._isInExpansion() && (this._isBlockStart() || this._cursor.peek() === $RBRACE)) {
14702
+ if (this._tokenizeBlocks && !this._inInterpolation && !this._isInExpansion() && (this._cursor.peek() === $AT || this._cursor.peek() === $RBRACE)) {
14542
14703
  return true;
14543
14704
  }
14544
14705
  return false;
@@ -14554,16 +14715,6 @@ var _Tokenizer = class {
14554
14715
  }
14555
14716
  return false;
14556
14717
  }
14557
- _isBlockStart() {
14558
- if (this._tokenizeBlocks && this._cursor.peek() === $AT) {
14559
- const tmp = this._cursor.clone();
14560
- tmp.advance();
14561
- if (isBlockNameChar(tmp.peek())) {
14562
- return true;
14563
- }
14564
- }
14565
- return false;
14566
- }
14567
14718
  _readUntil(char) {
14568
14719
  const start = this._cursor.clone();
14569
14720
  this._attemptUntilChar(char);
@@ -15148,7 +15299,7 @@ var _TreeBuilder = class {
15148
15299
  const end = this._peek.sourceSpan.fullStart;
15149
15300
  const span = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);
15150
15301
  const startSpan = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);
15151
- const block = new Block(token.parts[0], parameters, [], span, startSpan);
15302
+ const block = new Block(token.parts[0], parameters, [], span, token.sourceSpan, startSpan);
15152
15303
  this._pushContainer(block, false);
15153
15304
  }
15154
15305
  _consumeBlockClose(token) {
@@ -15165,7 +15316,7 @@ var _TreeBuilder = class {
15165
15316
  const end = this._peek.sourceSpan.fullStart;
15166
15317
  const span = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);
15167
15318
  const startSpan = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);
15168
- const block = new Block(token.parts[0], parameters, [], span, startSpan);
15319
+ const block = new Block(token.parts[0], parameters, [], span, token.sourceSpan, startSpan);
15169
15320
  this._pushContainer(block, false);
15170
15321
  this._popContainer(null, Block, null);
15171
15322
  this.errors.push(TreeError.create(token.parts[0], span, `Incomplete block "${token.parts[0]}". If you meant to write the @ character, you should use the "@" HTML entity instead.`));
@@ -15521,29 +15672,38 @@ function createEmptyMessagePart(location) {
15521
15672
  return new LiteralPiece("", new ParseSourceSpan(location, location));
15522
15673
  }
15523
15674
 
15524
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_message_extraction.mjs
15675
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_const_collection.mjs
15525
15676
  var NG_I18N_CLOSURE_MODE = "ngI18nClosureMode";
15526
15677
  var TRANSLATION_VAR_PREFIX2 = "i18n_";
15527
- function phaseI18nMessageExtraction(job) {
15678
+ function collectI18nConsts(job) {
15528
15679
  const fileBasedI18nSuffix = job.relativeContextFilePath.replace(/[^A-Za-z0-9]/g, "_").toUpperCase() + "_";
15680
+ const messageConstIndices = /* @__PURE__ */ new Map();
15529
15681
  for (const unit of job.units) {
15530
15682
  for (const op of unit.create) {
15531
- if (op.kind === OpKind.I18nStart) {
15532
- if (op.xref === op.root) {
15533
- const params = new Map([...op.params.entries()].sort());
15683
+ if (op.kind === OpKind.ExtractedMessage) {
15684
+ if (op.isRoot) {
15685
+ assertAllParamsResolved(op);
15534
15686
  const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX2));
15535
15687
  const closureVar = i18nGenerateClosureVar(job.pool, op.message.id, fileBasedI18nSuffix, job.i18nUseExternalIds);
15536
15688
  let transformFn = void 0;
15537
15689
  if (op.needsPostprocessing) {
15538
15690
  const extraTransformFnParams = [];
15539
- if (op.postprocessingParams.size > 0) {
15540
- extraTransformFnParams.push(literalMap([...op.postprocessingParams.entries()].map(([key, value]) => ({ key, value, quoted: true }))));
15691
+ if (op.formattedPostprocessingParams.size > 0) {
15692
+ extraTransformFnParams.push(literalMap([...op.formattedPostprocessingParams].map(([key, value]) => ({ key, value, quoted: true }))));
15541
15693
  }
15542
15694
  transformFn = (expr) => importExpr(Identifiers.i18nPostprocess).callFn([expr, ...extraTransformFnParams]);
15543
15695
  }
15544
- const statements = getTranslationDeclStmts(op.message, mainVar, closureVar, params, transformFn);
15545
- unit.create.push(createExtractedMessageOp(op.xref, mainVar, statements));
15696
+ const statements = getTranslationDeclStmts(op.message, mainVar, closureVar, op.formattedParams, transformFn);
15697
+ messageConstIndices.set(op.owner, job.addConst(mainVar, statements));
15546
15698
  }
15699
+ OpList.remove(op);
15700
+ }
15701
+ }
15702
+ }
15703
+ for (const unit of job.units) {
15704
+ for (const op of unit.create) {
15705
+ if (op.kind === OpKind.I18nStart) {
15706
+ op.messageIndex = messageConstIndices.get(op.root);
15547
15707
  }
15548
15708
  }
15549
15709
  }
@@ -15575,24 +15735,53 @@ function i18nGenerateClosureVar(pool, messageId, fileBasedI18nSuffix, useExterna
15575
15735
  }
15576
15736
  return variable(name);
15577
15737
  }
15738
+ function assertAllParamsResolved(op) {
15739
+ if (op.formattedParams === null || op.formattedPostprocessingParams === null) {
15740
+ throw Error("Params should have been formatted.");
15741
+ }
15742
+ for (const placeholder in op.message.placeholders) {
15743
+ if (!op.formattedParams.has(placeholder) && !op.formattedPostprocessingParams.has(placeholder)) {
15744
+ throw Error(`Failed to resolve i18n placeholder: ${placeholder}`);
15745
+ }
15746
+ }
15747
+ for (const placeholder in op.message.placeholderToMessage) {
15748
+ if (!op.formattedParams.has(placeholder) && !op.formattedPostprocessingParams.has(placeholder)) {
15749
+ throw Error(`Failed to resolve i18n message placeholder: ${placeholder}`);
15750
+ }
15751
+ }
15752
+ }
15753
+
15754
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_message_extraction.mjs
15755
+ function extractI18nMessages(job) {
15756
+ for (const unit of job.units) {
15757
+ for (const op of unit.create) {
15758
+ if (op.kind === OpKind.I18nStart) {
15759
+ unit.create.push(createExtractedMessageOp(op.xref, op.message, op.xref === op.root));
15760
+ }
15761
+ }
15762
+ }
15763
+ }
15578
15764
 
15579
15765
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_text_extraction.mjs
15580
- function phaseI18nTextExtraction(job) {
15766
+ function extractI18nText(job) {
15581
15767
  var _a2;
15582
15768
  for (const unit of job.units) {
15583
15769
  let currentI18nId = null;
15770
+ let currentI18nSlot = null;
15584
15771
  const textNodes = /* @__PURE__ */ new Map();
15585
15772
  for (const op of unit.create) {
15586
15773
  switch (op.kind) {
15587
15774
  case OpKind.I18nStart:
15588
15775
  currentI18nId = op.xref;
15776
+ currentI18nSlot = op.handle;
15589
15777
  break;
15590
15778
  case OpKind.I18nEnd:
15591
15779
  currentI18nId = null;
15780
+ currentI18nSlot = null;
15592
15781
  break;
15593
15782
  case OpKind.Text:
15594
- if (currentI18nId !== null) {
15595
- textNodes.set(op.xref, currentI18nId);
15783
+ if (currentI18nId !== null && currentI18nSlot !== null) {
15784
+ textNodes.set(op.xref, { xref: currentI18nId, slot: currentI18nSlot });
15596
15785
  OpList.remove(op);
15597
15786
  }
15598
15787
  break;
@@ -15604,12 +15793,12 @@ function phaseI18nTextExtraction(job) {
15604
15793
  if (!textNodes.has(op.target)) {
15605
15794
  continue;
15606
15795
  }
15607
- const i18nBlockId = textNodes.get(op.target);
15796
+ const i18nBlock = textNodes.get(op.target);
15608
15797
  const ops = [];
15609
15798
  for (let i = 0; i < op.interpolation.expressions.length; i++) {
15610
15799
  const expr = op.interpolation.expressions[i];
15611
15800
  const placeholder = op.i18nPlaceholders[i];
15612
- ops.push(createI18nExpressionOp(i18nBlockId, expr, placeholder.name, I18nParamResolutionTime.Creation, (_a2 = expr.sourceSpan) != null ? _a2 : op.sourceSpan));
15801
+ ops.push(createI18nExpressionOp(i18nBlock.xref, i18nBlock.slot, expr, placeholder.name, I18nParamResolutionTime.Creation, (_a2 = expr.sourceSpan) != null ? _a2 : op.sourceSpan));
15613
15802
  }
15614
15803
  if (ops.length > 0) {
15615
15804
  }
@@ -15621,23 +15810,26 @@ function phaseI18nTextExtraction(job) {
15621
15810
  }
15622
15811
 
15623
15812
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/icu_extraction.mjs
15624
- function phaseIcuExtraction(job) {
15813
+ function extractI18nICUs(job) {
15625
15814
  for (const unit of job.units) {
15626
15815
  const icus = /* @__PURE__ */ new Map();
15627
15816
  let currentI18nId = null;
15817
+ let currentI18nSlot = null;
15628
15818
  for (const op of unit.create) {
15629
15819
  switch (op.kind) {
15630
15820
  case OpKind.I18nStart:
15631
15821
  currentI18nId = op.xref;
15822
+ currentI18nSlot = op.handle;
15632
15823
  break;
15633
15824
  case OpKind.I18nEnd:
15634
15825
  currentI18nId = null;
15826
+ currentI18nSlot = null;
15635
15827
  break;
15636
15828
  case OpKind.Icu:
15637
15829
  if (currentI18nId === null) {
15638
15830
  throw Error("Unexpected ICU outside of an i18n block.");
15639
15831
  }
15640
- icus.set(op.xref, { message: op.message, i18nBlockId: currentI18nId });
15832
+ icus.set(op.xref, { message: op.message, i18nBlockId: currentI18nId, i18nBlockSlot: currentI18nSlot });
15641
15833
  OpList.remove(op);
15642
15834
  break;
15643
15835
  }
@@ -15645,7 +15837,7 @@ function phaseIcuExtraction(job) {
15645
15837
  for (const op of unit.update) {
15646
15838
  switch (op.kind) {
15647
15839
  case OpKind.IcuUpdate:
15648
- const { message, i18nBlockId } = icus.get(op.xref);
15840
+ const { message, i18nBlockId, i18nBlockSlot } = icus.get(op.xref);
15649
15841
  const icuNode = message.nodes.find((n) => n instanceof Icu2);
15650
15842
  if (icuNode === void 0) {
15651
15843
  throw Error("Could not find ICU in i18n AST");
@@ -15653,7 +15845,7 @@ function phaseIcuExtraction(job) {
15653
15845
  if (icuNode.expressionPlaceholder === void 0) {
15654
15846
  throw Error("ICU is missing an i18n placeholder");
15655
15847
  }
15656
- OpList.replace(op, createI18nExpressionOp(i18nBlockId, new LexicalReadExpr(icuNode.expression), icuNode.expressionPlaceholder, I18nParamResolutionTime.Postproccessing, null));
15848
+ OpList.replace(op, createI18nExpressionOp(i18nBlockId, i18nBlockSlot, new LexicalReadExpr(icuNode.expression), icuNode.expressionPlaceholder, I18nParamResolutionTime.Postproccessing, null));
15657
15849
  break;
15658
15850
  }
15659
15851
  }
@@ -15661,7 +15853,7 @@ function phaseIcuExtraction(job) {
15661
15853
  }
15662
15854
 
15663
15855
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/local_refs.mjs
15664
- function phaseLocalRefs(job) {
15856
+ function liftLocalRefs(job) {
15665
15857
  for (const unit of job.units) {
15666
15858
  for (const op of unit.create) {
15667
15859
  switch (op.kind) {
@@ -15691,7 +15883,7 @@ function serializeLocalRefs(refs) {
15691
15883
  }
15692
15884
 
15693
15885
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/namespace.mjs
15694
- function phaseNamespace(job) {
15886
+ function emitNamespaceChanges(job) {
15695
15887
  for (const unit of job.units) {
15696
15888
  let activeNamespace = Namespace.HTML;
15697
15889
  for (const op of unit.create) {
@@ -15768,8 +15960,8 @@ function hyphenate2(value) {
15768
15960
  }
15769
15961
 
15770
15962
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/naming.mjs
15771
- function phaseNaming(cpl) {
15772
- addNamesToView(cpl.root, cpl.componentName, { index: 0 }, cpl.compatibility === CompatibilityMode.TemplateDefinitionBuilder);
15963
+ function nameFunctionsAndVariables(job) {
15964
+ addNamesToView(job.root, job.componentName, { index: 0 }, job.compatibility === CompatibilityMode.TemplateDefinitionBuilder);
15773
15965
  }
15774
15966
  function addNamesToView(unit, baseName, state, compatibility) {
15775
15967
  if (unit.fnName === null) {
@@ -15788,7 +15980,7 @@ function addNamesToView(unit, baseName, state, compatibility) {
15788
15980
  if (op.handlerFnName !== null) {
15789
15981
  break;
15790
15982
  }
15791
- if (!op.hostListener && op.targetSlot === null) {
15983
+ if (!op.hostListener && op.targetSlot.slot === null) {
15792
15984
  throw new Error(`Expected a slot to be assigned`);
15793
15985
  }
15794
15986
  let animation = "";
@@ -15799,23 +15991,36 @@ function addNamesToView(unit, baseName, state, compatibility) {
15799
15991
  if (op.hostListener) {
15800
15992
  op.handlerFnName = `${baseName}_${animation}${op.name}_HostBindingHandler`;
15801
15993
  } else {
15802
- op.handlerFnName = `${unit.fnName}_${op.tag.replace("-", "_")}_${animation}${op.name}_${op.targetSlot}_listener`;
15994
+ op.handlerFnName = `${unit.fnName}_${op.tag.replace("-", "_")}_${animation}${op.name}_${op.targetSlot.slot}_listener`;
15803
15995
  }
15804
15996
  op.handlerFnName = sanitizeIdentifier(op.handlerFnName);
15805
15997
  break;
15806
15998
  case OpKind.Variable:
15807
15999
  varNames.set(op.xref, getVariableName(op.variable, state));
15808
16000
  break;
16001
+ case OpKind.RepeaterCreate:
16002
+ if (!(unit instanceof ViewCompilationUnit)) {
16003
+ throw new Error(`AssertionError: must be compiling a component`);
16004
+ }
16005
+ if (op.handle.slot === null) {
16006
+ throw new Error(`Expected slot to be assigned`);
16007
+ }
16008
+ if (op.emptyView !== null) {
16009
+ const emptyView = unit.job.views.get(op.emptyView);
16010
+ addNamesToView(emptyView, `${baseName}_${`${op.functionNameSuffix}Empty`}_${op.handle.slot + 2}`, state, compatibility);
16011
+ }
16012
+ addNamesToView(unit.job.views.get(op.xref), `${baseName}_${op.functionNameSuffix}_${op.handle.slot + 1}`, state, compatibility);
16013
+ break;
15809
16014
  case OpKind.Template:
15810
16015
  if (!(unit instanceof ViewCompilationUnit)) {
15811
16016
  throw new Error(`AssertionError: must be compiling a component`);
15812
16017
  }
15813
16018
  const childView = unit.job.views.get(op.xref);
15814
- if (op.slot === null) {
16019
+ if (op.handle.slot === null) {
15815
16020
  throw new Error(`Expected slot to be assigned`);
15816
16021
  }
15817
- const tagToken = op.tag === null ? "" : "_" + prefixWithNamespace(op.tag, op.namespace);
15818
- addNamesToView(childView, `${baseName}${tagToken}_${op.slot}`, state, compatibility);
16022
+ const suffix = op.functionNameSuffix.length === 0 ? "" : `_${op.functionNameSuffix}`;
16023
+ addNamesToView(childView, `${baseName}${suffix}_${op.handle.slot}`, state, compatibility);
15819
16024
  break;
15820
16025
  case OpKind.StyleProp:
15821
16026
  op.name = normalizeStylePropName(op.name);
@@ -15849,10 +16054,10 @@ function getVariableName(variable2, state) {
15849
16054
  variable2.name = `ctx_r${state.index++}`;
15850
16055
  break;
15851
16056
  case SemanticVariableKind.Identifier:
15852
- variable2.name = `${variable2.identifier}_${state.index++}`;
16057
+ variable2.name = `${variable2.identifier}_r${++state.index}`;
15853
16058
  break;
15854
16059
  default:
15855
- variable2.name = `_r${state.index++}`;
16060
+ variable2.name = `_r${++state.index}`;
15856
16061
  break;
15857
16062
  }
15858
16063
  }
@@ -15870,7 +16075,7 @@ function stripImportant(name) {
15870
16075
  }
15871
16076
 
15872
16077
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/next_context_merging.mjs
15873
- function phaseMergeNextContext(job) {
16078
+ function mergeNextContextExpressions(job) {
15874
16079
  for (const unit of job.units) {
15875
16080
  for (const op of unit.create) {
15876
16081
  if (op.kind === OpKind.Listener) {
@@ -15917,7 +16122,7 @@ function mergeNextContextsInOps(ops) {
15917
16122
 
15918
16123
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/ng_container.mjs
15919
16124
  var CONTAINER_TAG = "ng-container";
15920
- function phaseNgContainer(job) {
16125
+ function generateNgContainerOps(job) {
15921
16126
  for (const unit of job.units) {
15922
16127
  const updatedElementXrefs = /* @__PURE__ */ new Set();
15923
16128
  for (const op of unit.create) {
@@ -15940,7 +16145,7 @@ function lookupElement3(elements, xref) {
15940
16145
  }
15941
16146
  return el;
15942
16147
  }
15943
- function phaseNonbindable(job) {
16148
+ function disableBindings(job) {
15944
16149
  const elements = /* @__PURE__ */ new Map();
15945
16150
  for (const view of job.units) {
15946
16151
  for (const op of view.create) {
@@ -15963,7 +16168,7 @@ function phaseNonbindable(job) {
15963
16168
  }
15964
16169
 
15965
16170
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/nullish_coalescing.mjs
15966
- function phaseNullishCoalescing(job) {
16171
+ function generateNullishCoalesceExpressions(job) {
15967
16172
  for (const unit of job.units) {
15968
16173
  for (const op of unit.ops()) {
15969
16174
  transformExpressionsInOp(op, (expr) => {
@@ -15982,20 +16187,26 @@ function phaseNullishCoalescing(job) {
15982
16187
  function kindTest(kind) {
15983
16188
  return (op) => op.kind === kind;
15984
16189
  }
16190
+ function kindWithInterpolationTest(kind, interpolation) {
16191
+ return (op) => {
16192
+ return op.kind === kind && interpolation === op.expression instanceof Interpolation2;
16193
+ };
16194
+ }
15985
16195
  var CREATE_ORDERING = [
15986
16196
  { test: (op) => op.kind === OpKind.Listener && op.hostListener && op.isAnimationListener },
15987
16197
  { test: (op) => op.kind === OpKind.Listener && !(op.hostListener && op.isAnimationListener) }
15988
16198
  ];
15989
16199
  var UPDATE_ORDERING = [
15990
- { test: (op) => op.kind === OpKind.HostProperty && op.expression instanceof Interpolation2 },
15991
- { test: (op) => op.kind === OpKind.HostProperty && !(op.expression instanceof Interpolation2) },
16200
+ { test: kindWithInterpolationTest(OpKind.HostProperty, true) },
16201
+ { test: kindWithInterpolationTest(OpKind.HostProperty, false) },
15992
16202
  { test: kindTest(OpKind.StyleMap), transform: keepLast },
15993
16203
  { test: kindTest(OpKind.ClassMap), transform: keepLast },
15994
16204
  { test: kindTest(OpKind.StyleProp) },
15995
16205
  { test: kindTest(OpKind.ClassProp) },
15996
- { test: (op) => op.kind === OpKind.Property && op.expression instanceof Interpolation2 },
15997
- { test: (op) => op.kind === OpKind.Property && !(op.expression instanceof Interpolation2) },
15998
- { test: kindTest(OpKind.Attribute) }
16206
+ { test: kindWithInterpolationTest(OpKind.Property, true) },
16207
+ { test: kindWithInterpolationTest(OpKind.Attribute, true) },
16208
+ { test: kindWithInterpolationTest(OpKind.Property, false) },
16209
+ { test: kindWithInterpolationTest(OpKind.Attribute, false) }
15999
16210
  ];
16000
16211
  var handledOpKinds = /* @__PURE__ */ new Set([
16001
16212
  OpKind.Listener,
@@ -16007,31 +16218,29 @@ var handledOpKinds = /* @__PURE__ */ new Set([
16007
16218
  OpKind.HostProperty,
16008
16219
  OpKind.Attribute
16009
16220
  ]);
16010
- function phaseOrdering(job) {
16221
+ function orderOps(job) {
16011
16222
  for (const unit of job.units) {
16012
- let opsToOrder = [];
16013
- for (const op of unit.create) {
16014
- if (handledOpKinds.has(op.kind)) {
16015
- opsToOrder.push(op);
16016
- OpList.remove(op);
16017
- } else {
16018
- OpList.insertBefore(reorder(opsToOrder, CREATE_ORDERING), op);
16019
- opsToOrder = [];
16020
- }
16021
- }
16022
- unit.create.push(reorder(opsToOrder, CREATE_ORDERING));
16023
- opsToOrder = [];
16024
- for (const op of unit.update) {
16025
- if (handledOpKinds.has(op.kind)) {
16026
- opsToOrder.push(op);
16027
- OpList.remove(op);
16028
- } else {
16029
- OpList.insertBefore(reorder(opsToOrder, UPDATE_ORDERING), op);
16030
- opsToOrder = [];
16031
- }
16223
+ orderWithin(unit.create, CREATE_ORDERING);
16224
+ orderWithin(unit.update, UPDATE_ORDERING);
16225
+ }
16226
+ }
16227
+ function orderWithin(opList, ordering) {
16228
+ let opsToOrder = [];
16229
+ let firstTargetInGroup = null;
16230
+ for (const op of opList) {
16231
+ const currentTarget = hasDependsOnSlotContextTrait(op) ? op.target : null;
16232
+ if (!handledOpKinds.has(op.kind) || currentTarget !== firstTargetInGroup && (firstTargetInGroup !== null && currentTarget !== null)) {
16233
+ OpList.insertBefore(reorder(opsToOrder, ordering), op);
16234
+ opsToOrder = [];
16235
+ firstTargetInGroup = null;
16236
+ }
16237
+ if (handledOpKinds.has(op.kind)) {
16238
+ opsToOrder.push(op);
16239
+ OpList.remove(op);
16240
+ firstTargetInGroup = currentTarget != null ? currentTarget : firstTargetInGroup;
16032
16241
  }
16033
- unit.update.push(reorder(opsToOrder, UPDATE_ORDERING));
16034
16242
  }
16243
+ opList.push(reorder(opsToOrder, ordering));
16035
16244
  }
16036
16245
  function reorder(ops, ordering) {
16037
16246
  const groups = Array.from(ordering, () => new Array());
@@ -16049,8 +16258,8 @@ function keepLast(ops) {
16049
16258
  }
16050
16259
 
16051
16260
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/parse_extracted_styles.mjs
16052
- function phaseParseExtractedStyles(cpl) {
16053
- for (const unit of cpl.units) {
16261
+ function parseExtractedStyles(job) {
16262
+ for (const unit of job.units) {
16054
16263
  for (const op of unit.create) {
16055
16264
  if (op.kind === OpKind.ExtractedAttribute && op.bindingKind === BindingKind.Attribute && isStringLiteral(op.expression)) {
16056
16265
  if (op.name === "style") {
@@ -16072,31 +16281,31 @@ function phaseParseExtractedStyles(cpl) {
16072
16281
  }
16073
16282
 
16074
16283
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/phase_remove_content_selectors.mjs
16075
- function phaseRemoveContentSelectors(job) {
16284
+ function removeContentSelectors(job) {
16076
16285
  for (const unit of job.units) {
16077
- const elements = getElementsByXrefId(unit);
16286
+ const elements = createOpXrefMap(unit);
16078
16287
  for (const op of unit.update) {
16079
16288
  switch (op.kind) {
16080
16289
  case OpKind.Binding:
16081
- const target = lookupElement4(elements, op.target);
16290
+ const target = lookupInXrefMap(elements, op.target);
16082
16291
  if (op.name.toLowerCase() === "select" && target.kind === OpKind.Projection) {
16083
16292
  OpList.remove(op);
16084
16293
  }
16085
- continue;
16294
+ break;
16086
16295
  }
16087
16296
  }
16088
16297
  }
16089
16298
  }
16090
- function lookupElement4(elements, xref) {
16091
- const el = elements.get(xref);
16299
+ function lookupInXrefMap(map, xref) {
16300
+ const el = map.get(xref);
16092
16301
  if (el === void 0) {
16093
- throw new Error("All attributes should have an element-like target.");
16302
+ throw new Error("All attributes should have an slottable target.");
16094
16303
  }
16095
16304
  return el;
16096
16305
  }
16097
16306
 
16098
16307
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pipe_creation.mjs
16099
- function phasePipeCreation(job) {
16308
+ function createPipes(job) {
16100
16309
  for (const unit of job.units) {
16101
16310
  processPipeBindingsInView(unit);
16102
16311
  }
@@ -16113,10 +16322,15 @@ function processPipeBindingsInView(unit) {
16113
16322
  if (flags & VisitorContextFlag.InChildOperation) {
16114
16323
  throw new Error(`AssertionError: pipe bindings should not appear in child expressions`);
16115
16324
  }
16116
- if (!hasDependsOnSlotContextTrait(updateOp)) {
16117
- throw new Error(`AssertionError: pipe binding associated with non-slot operation ${OpKind[updateOp.kind]}`);
16325
+ if (unit.job.compatibility) {
16326
+ const slotHandle = updateOp.target;
16327
+ if (slotHandle == void 0) {
16328
+ throw new Error(`AssertionError: expected slot handle to be assigned for pipe creation`);
16329
+ }
16330
+ addPipeToCreationBlock(unit, updateOp.target, expr);
16331
+ } else {
16332
+ unit.create.push(createPipeOp(expr.target, expr.targetSlot, expr.name));
16118
16333
  }
16119
- addPipeToCreationBlock(unit, updateOp.target, expr);
16120
16334
  });
16121
16335
  }
16122
16336
  }
@@ -16131,7 +16345,7 @@ function addPipeToCreationBlock(unit, afterTargetXref, binding) {
16131
16345
  while (op.next.kind === OpKind.Pipe) {
16132
16346
  op = op.next;
16133
16347
  }
16134
- const pipe2 = createPipeOp(binding.target, binding.name);
16348
+ const pipe2 = createPipeOp(binding.target, binding.targetSlot, binding.name);
16135
16349
  OpList.insertBefore(pipe2, op.next);
16136
16350
  return;
16137
16351
  }
@@ -16139,7 +16353,7 @@ function addPipeToCreationBlock(unit, afterTargetXref, binding) {
16139
16353
  }
16140
16354
 
16141
16355
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pipe_variadic.mjs
16142
- function phasePipeVariadic(job) {
16356
+ function createVariadicPipes(job) {
16143
16357
  for (const unit of job.units) {
16144
16358
  for (const op of unit.update) {
16145
16359
  transformExpressionsInOp(op, (expr) => {
@@ -16149,14 +16363,14 @@ function phasePipeVariadic(job) {
16149
16363
  if (expr.args.length <= 4) {
16150
16364
  return expr;
16151
16365
  }
16152
- return new PipeBindingVariadicExpr(expr.target, expr.name, literalArr(expr.args), expr.args.length);
16366
+ return new PipeBindingVariadicExpr(expr.target, expr.targetSlot, expr.name, literalArr(expr.args), expr.args.length);
16153
16367
  }, VisitorContextFlag.None);
16154
16368
  }
16155
16369
  }
16156
16370
  }
16157
16371
 
16158
16372
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/propagate_i18n_blocks.mjs
16159
- function phasePropagateI18nBlocks(job) {
16373
+ function propagateI18nBlocks(job) {
16160
16374
  propagateI18nBlocksToTemplates(job.root, 0);
16161
16375
  }
16162
16376
  function propagateI18nBlocksToTemplates(unit, subTemplateIndex) {
@@ -16192,8 +16406,51 @@ function wrapTemplateWithI18n(unit, parentI18n) {
16192
16406
  }
16193
16407
  }
16194
16408
 
16409
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/propagate_i18n_placeholders.mjs
16410
+ function propogateI18nPlaceholders(job) {
16411
+ const i18nOps = /* @__PURE__ */ new Map();
16412
+ const extractedMessageOps = /* @__PURE__ */ new Map();
16413
+ for (const unit of job.units) {
16414
+ for (const op of unit.create) {
16415
+ switch (op.kind) {
16416
+ case OpKind.I18nStart:
16417
+ i18nOps.set(op.xref, op);
16418
+ break;
16419
+ case OpKind.ExtractedMessage:
16420
+ extractedMessageOps.set(op.owner, op);
16421
+ break;
16422
+ }
16423
+ }
16424
+ }
16425
+ for (const [xref, childExtractedMessageOp] of extractedMessageOps) {
16426
+ if (!childExtractedMessageOp.isRoot) {
16427
+ const i18nOp = i18nOps.get(xref);
16428
+ if (i18nOp === void 0) {
16429
+ throw Error("Could not find owner i18n block for extracted message.");
16430
+ }
16431
+ const rootExtractedMessageOp = extractedMessageOps.get(i18nOp.root);
16432
+ if (rootExtractedMessageOp === void 0) {
16433
+ throw Error("Could not find extracted message op for root i18n block.");
16434
+ }
16435
+ mergeParams(rootExtractedMessageOp.params, childExtractedMessageOp.params);
16436
+ mergeParams(rootExtractedMessageOp.postprocessingParams, childExtractedMessageOp.postprocessingParams);
16437
+ }
16438
+ }
16439
+ }
16440
+ function mergeParams(to, from) {
16441
+ for (const [placeholder, fromValues] of from) {
16442
+ const toValues = to.get(placeholder) || [];
16443
+ const flags = fromValues[0].flags;
16444
+ if (flags & I18nParamValueFlags.CloseTag && !(flags & I18nParamValueFlags.OpenTag)) {
16445
+ to.set(placeholder, [...fromValues, ...toValues]);
16446
+ } else {
16447
+ to.set(placeholder, [...toValues, ...fromValues]);
16448
+ }
16449
+ }
16450
+ }
16451
+
16195
16452
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pure_function_extraction.mjs
16196
- function phasePureFunctionExtraction(job) {
16453
+ function extractPureFunctions(job) {
16197
16454
  for (const view of job.units) {
16198
16455
  for (const op of view.ops()) {
16199
16456
  visitExpressionsInOp(op, (expr) => {
@@ -16235,9 +16492,9 @@ var PureFunctionConstant = class extends GenericKeyFn {
16235
16492
  };
16236
16493
 
16237
16494
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pure_literal_structures.mjs
16238
- function phasePureLiteralStructures(job) {
16239
- for (const view of job.units) {
16240
- for (const op of view.update) {
16495
+ function generatePureLiteralStructures(job) {
16496
+ for (const unit of job.units) {
16497
+ for (const op of unit.update) {
16241
16498
  transformExpressionsInOp(op, (expr, flags) => {
16242
16499
  if (flags & VisitorContextFlag.InChildOperation) {
16243
16500
  return expr;
@@ -16325,7 +16582,7 @@ function template(slot, templateFnRef, decls, vars, tag, constIndex, sourceSpan)
16325
16582
  }
16326
16583
  return call(Identifiers.templateCreate, args, sourceSpan);
16327
16584
  }
16328
- function disableBindings() {
16585
+ function disableBindings2() {
16329
16586
  return call(Identifiers.disableBindings, [], null);
16330
16587
  }
16331
16588
  function enableBindings() {
@@ -16391,7 +16648,7 @@ function text(slot, initialValue, sourceSpan) {
16391
16648
  }
16392
16649
  return call(Identifiers.text, args, sourceSpan);
16393
16650
  }
16394
- function defer(selfSlot, primarySlot, dependencyResolverFn, loadingSlot, placeholderSlot, errorSlot, loadingConfigIndex, placeholderConfigIndex, sourceSpan) {
16651
+ function defer(selfSlot, primarySlot, dependencyResolverFn, loadingSlot, placeholderSlot, errorSlot, loadingConfig, placeholderConfig, enableTimerScheduling, sourceSpan) {
16395
16652
  const args = [
16396
16653
  literal(selfSlot),
16397
16654
  literal(primarySlot),
@@ -16399,29 +16656,53 @@ function defer(selfSlot, primarySlot, dependencyResolverFn, loadingSlot, placeho
16399
16656
  literal(loadingSlot),
16400
16657
  literal(placeholderSlot),
16401
16658
  literal(errorSlot),
16402
- literal(loadingConfigIndex),
16403
- literal(placeholderConfigIndex)
16659
+ loadingConfig != null ? loadingConfig : literal(null),
16660
+ placeholderConfig != null ? placeholderConfig : literal(null),
16661
+ enableTimerScheduling ? importExpr(Identifiers.deferEnableTimerScheduling) : literal(null)
16404
16662
  ];
16405
- while (args[args.length - 1].value === null) {
16663
+ let expr;
16664
+ while ((expr = args[args.length - 1]) !== null && expr instanceof LiteralExpr && expr.value === null) {
16406
16665
  args.pop();
16407
16666
  }
16408
16667
  return call(Identifiers.defer, args, sourceSpan);
16409
16668
  }
16410
- function deferOn(sourceSpan) {
16411
- return call(Identifiers.deferOnIdle, [], sourceSpan);
16669
+ var deferTriggerToR3TriggerInstructionsMap = /* @__PURE__ */ new Map([
16670
+ [DeferTriggerKind.Idle, [Identifiers.deferOnIdle, Identifiers.deferPrefetchOnIdle]],
16671
+ [
16672
+ DeferTriggerKind.Immediate,
16673
+ [Identifiers.deferOnImmediate, Identifiers.deferPrefetchOnImmediate]
16674
+ ],
16675
+ [DeferTriggerKind.Timer, [Identifiers.deferOnTimer, Identifiers.deferPrefetchOnTimer]],
16676
+ [DeferTriggerKind.Hover, [Identifiers.deferOnHover, Identifiers.deferPrefetchOnHover]],
16677
+ [
16678
+ DeferTriggerKind.Interaction,
16679
+ [Identifiers.deferOnInteraction, Identifiers.deferPrefetchOnInteraction]
16680
+ ],
16681
+ [
16682
+ DeferTriggerKind.Viewport,
16683
+ [Identifiers.deferOnViewport, Identifiers.deferPrefetchOnViewport]
16684
+ ]
16685
+ ]);
16686
+ function deferOn(trigger, args, prefetch, sourceSpan) {
16687
+ const instructions = deferTriggerToR3TriggerInstructionsMap.get(trigger);
16688
+ if (instructions === void 0) {
16689
+ throw new Error(`Unable to determine instruction for trigger ${trigger}`);
16690
+ }
16691
+ const instructionToCall = prefetch ? instructions[1] : instructions[0];
16692
+ return call(instructionToCall, args.map((a) => literal(a)), sourceSpan);
16412
16693
  }
16413
16694
  function projectionDef(def) {
16414
16695
  return call(Identifiers.projectionDef, def ? [def] : [], null);
16415
16696
  }
16416
- function projection(slot, projectionSlotIndex, attributes) {
16697
+ function projection(slot, projectionSlotIndex, attributes, sourceSpan) {
16417
16698
  const args = [literal(slot)];
16418
- if (projectionSlotIndex !== 0 || attributes !== null) {
16699
+ if (projectionSlotIndex !== 0 || attributes.length > 0) {
16419
16700
  args.push(literal(projectionSlotIndex));
16420
- if (attributes != null) {
16421
- args.push(literal(attributes));
16701
+ if (attributes.length > 0) {
16702
+ args.push(literalArr(attributes.map((attr) => literal(attr))));
16422
16703
  }
16423
16704
  }
16424
- return call(Identifiers.projection, args, null);
16705
+ return call(Identifiers.projection, args, sourceSpan);
16425
16706
  }
16426
16707
  function i18nStart(slot, constIndex, subTemplateIndex) {
16427
16708
  const args = [literal(slot), literal(constIndex)];
@@ -16430,6 +16711,27 @@ function i18nStart(slot, constIndex, subTemplateIndex) {
16430
16711
  }
16431
16712
  return call(Identifiers.i18nStart, args, null);
16432
16713
  }
16714
+ function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByFn, trackByUsesComponentInstance, emptyViewFnName, emptyDecls, emptyVars, sourceSpan) {
16715
+ const args = [
16716
+ literal(slot),
16717
+ variable(viewFnName),
16718
+ literal(decls),
16719
+ literal(vars),
16720
+ literal(tag),
16721
+ literal(constIndex),
16722
+ trackByFn
16723
+ ];
16724
+ if (trackByUsesComponentInstance || emptyViewFnName !== null) {
16725
+ args.push(literal(trackByUsesComponentInstance));
16726
+ if (emptyViewFnName !== null) {
16727
+ args.push(variable(emptyViewFnName), literal(emptyDecls), literal(emptyVars));
16728
+ }
16729
+ }
16730
+ return call(Identifiers.repeaterCreate, args, sourceSpan);
16731
+ }
16732
+ function repeater(metadataSlot, collection, sourceSpan) {
16733
+ return call(Identifiers.repeater, [literal(metadataSlot), collection], sourceSpan);
16734
+ }
16433
16735
  function i18n(slot, constIndex, subTemplateIndex) {
16434
16736
  const args = [literal(slot), literal(constIndex)];
16435
16737
  if (subTemplateIndex) {
@@ -16745,62 +17047,62 @@ var sanitizerIdentifierMap = /* @__PURE__ */ new Map([
16745
17047
  [SanitizerFn.Style, Identifiers.sanitizeStyle],
16746
17048
  [SanitizerFn.Url, Identifiers.sanitizeUrl]
16747
17049
  ]);
16748
- function phaseReify(cpl) {
16749
- for (const unit of cpl.units) {
17050
+ function reify(job) {
17051
+ for (const unit of job.units) {
16750
17052
  reifyCreateOperations(unit, unit.create);
16751
17053
  reifyUpdateOperations(unit, unit.update);
16752
17054
  }
16753
17055
  }
16754
17056
  function reifyCreateOperations(unit, ops) {
16755
- var _a2, _b2, _c2, _d2;
17057
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g;
16756
17058
  for (const op of ops) {
16757
17059
  transformExpressionsInOp(op, reifyIrExpression, VisitorContextFlag.None);
16758
17060
  switch (op.kind) {
16759
17061
  case OpKind.Text:
16760
- OpList.replace(op, text(op.slot, op.initialValue, op.sourceSpan));
17062
+ OpList.replace(op, text(op.handle.slot, op.initialValue, op.sourceSpan));
16761
17063
  break;
16762
17064
  case OpKind.ElementStart:
16763
- OpList.replace(op, elementStart(op.slot, op.tag, op.attributes, op.localRefs, op.sourceSpan));
17065
+ OpList.replace(op, elementStart(op.handle.slot, op.tag, op.attributes, op.localRefs, op.sourceSpan));
16764
17066
  break;
16765
17067
  case OpKind.Element:
16766
- OpList.replace(op, element(op.slot, op.tag, op.attributes, op.localRefs, op.sourceSpan));
17068
+ OpList.replace(op, element(op.handle.slot, op.tag, op.attributes, op.localRefs, op.sourceSpan));
16767
17069
  break;
16768
17070
  case OpKind.ElementEnd:
16769
17071
  OpList.replace(op, elementEnd(op.sourceSpan));
16770
17072
  break;
16771
17073
  case OpKind.ContainerStart:
16772
- OpList.replace(op, elementContainerStart(op.slot, op.attributes, op.localRefs, op.sourceSpan));
17074
+ OpList.replace(op, elementContainerStart(op.handle.slot, op.attributes, op.localRefs, op.sourceSpan));
16773
17075
  break;
16774
17076
  case OpKind.Container:
16775
- OpList.replace(op, elementContainer(op.slot, op.attributes, op.localRefs, op.sourceSpan));
17077
+ OpList.replace(op, elementContainer(op.handle.slot, op.attributes, op.localRefs, op.sourceSpan));
16776
17078
  break;
16777
17079
  case OpKind.ContainerEnd:
16778
17080
  OpList.replace(op, elementContainerEnd());
16779
17081
  break;
16780
17082
  case OpKind.I18nStart:
16781
- OpList.replace(op, i18nStart(op.slot, op.messageIndex, op.subTemplateIndex));
17083
+ OpList.replace(op, i18nStart(op.handle.slot, op.messageIndex, op.subTemplateIndex));
16782
17084
  break;
16783
17085
  case OpKind.I18nEnd:
16784
17086
  OpList.replace(op, i18nEnd());
16785
17087
  break;
16786
17088
  case OpKind.I18n:
16787
- OpList.replace(op, i18n(op.slot, op.messageIndex, op.subTemplateIndex));
17089
+ OpList.replace(op, i18n(op.handle.slot, op.messageIndex, op.subTemplateIndex));
16788
17090
  break;
16789
17091
  case OpKind.Template:
16790
17092
  if (!(unit instanceof ViewCompilationUnit)) {
16791
17093
  throw new Error(`AssertionError: must be compiling a component`);
16792
17094
  }
16793
17095
  const childView = unit.job.views.get(op.xref);
16794
- OpList.replace(op, template(op.slot, variable(childView.fnName), childView.decls, childView.vars, op.block ? null : op.tag, op.attributes, op.sourceSpan));
17096
+ OpList.replace(op, template(op.handle.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.attributes, op.sourceSpan));
16795
17097
  break;
16796
17098
  case OpKind.DisableBindings:
16797
- OpList.replace(op, disableBindings());
17099
+ OpList.replace(op, disableBindings2());
16798
17100
  break;
16799
17101
  case OpKind.EnableBindings:
16800
17102
  OpList.replace(op, enableBindings());
16801
17103
  break;
16802
17104
  case OpKind.Pipe:
16803
- OpList.replace(op, pipe(op.slot, op.name));
17105
+ OpList.replace(op, pipe(op.handle.slot, op.name));
16804
17106
  break;
16805
17107
  case OpKind.Listener:
16806
17108
  const listenerFn = reifyListenerHandler(unit, op.handlerFnName, op.handlerOps, op.consumesDollarEvent);
@@ -16827,22 +17129,70 @@ function reifyCreateOperations(unit, ops) {
16827
17129
  }
16828
17130
  break;
16829
17131
  case OpKind.Defer:
16830
- OpList.replace(op, defer(op.slot, op.targetSlot, null, op.loading && op.loading.targetSlot, op.placeholder && op.placeholder.targetSlot, op.error && op.error.targetSlot, (_b2 = (_a2 = op.loading) == null ? void 0 : _a2.constIndex) != null ? _b2 : null, (_d2 = (_c2 = op.placeholder) == null ? void 0 : _c2.constIndex) != null ? _d2 : null, op.sourceSpan));
16831
- break;
16832
- case OpKind.DeferSecondaryBlock:
16833
- OpList.remove(op);
17132
+ const timerScheduling = !!op.loadingMinimumTime || !!op.loadingAfterTime || !!op.placeholderMinimumTime;
17133
+ OpList.replace(op, defer(op.handle.slot, op.mainSlot.slot, null, (_b2 = (_a2 = op.loadingSlot) == null ? void 0 : _a2.slot) != null ? _b2 : null, (_d2 = (_c2 = op.placeholderSlot) == null ? void 0 : _c2.slot) != null ? _d2 : null, (_f2 = (_e2 = op.errorSlot) == null ? void 0 : _e2.slot) != null ? _f2 : null, op.loadingConfig, op.placeholderConfig, timerScheduling, op.sourceSpan));
16834
17134
  break;
16835
17135
  case OpKind.DeferOn:
16836
- OpList.replace(op, deferOn(op.sourceSpan));
17136
+ let args = [];
17137
+ switch (op.trigger.kind) {
17138
+ case DeferTriggerKind.Idle:
17139
+ case DeferTriggerKind.Immediate:
17140
+ break;
17141
+ case DeferTriggerKind.Timer:
17142
+ args = [op.trigger.delay];
17143
+ break;
17144
+ case DeferTriggerKind.Interaction:
17145
+ case DeferTriggerKind.Hover:
17146
+ case DeferTriggerKind.Viewport:
17147
+ if (((_g = op.trigger.targetSlot) == null ? void 0 : _g.slot) == null || op.trigger.targetSlotViewSteps === null) {
17148
+ throw new Error(`Slot or view steps not set in trigger reification for trigger kind ${op.trigger.kind}`);
17149
+ }
17150
+ args = [op.trigger.targetSlot.slot];
17151
+ if (op.trigger.targetSlotViewSteps !== 0) {
17152
+ args.push(op.trigger.targetSlotViewSteps);
17153
+ }
17154
+ break;
17155
+ default:
17156
+ throw new Error(`AssertionError: Unsupported reification of defer trigger kind ${op.trigger.kind}`);
17157
+ }
17158
+ OpList.replace(op, deferOn(op.trigger.kind, args, op.prefetch, op.sourceSpan));
16837
17159
  break;
16838
17160
  case OpKind.ProjectionDef:
16839
17161
  OpList.replace(op, projectionDef(op.def));
16840
17162
  break;
16841
17163
  case OpKind.Projection:
16842
- if (op.slot === null) {
17164
+ if (op.handle.slot === null) {
16843
17165
  throw new Error("No slot was assigned for project instruction");
16844
17166
  }
16845
- OpList.replace(op, projection(op.slot, op.projectionSlotIndex, op.attributes));
17167
+ OpList.replace(op, projection(op.handle.slot, op.projectionSlotIndex, op.attributes, op.sourceSpan));
17168
+ break;
17169
+ case OpKind.RepeaterCreate:
17170
+ if (op.handle.slot === null) {
17171
+ throw new Error("No slot was assigned for repeater instruction");
17172
+ }
17173
+ if (!(unit instanceof ViewCompilationUnit)) {
17174
+ throw new Error(`AssertionError: must be compiling a component`);
17175
+ }
17176
+ const repeaterView = unit.job.views.get(op.xref);
17177
+ if (repeaterView.fnName === null) {
17178
+ throw new Error(`AssertionError: expected repeater primary view to have been named`);
17179
+ }
17180
+ let emptyViewFnName = null;
17181
+ let emptyDecls = null;
17182
+ let emptyVars = null;
17183
+ if (op.emptyView !== null) {
17184
+ const emptyView = unit.job.views.get(op.emptyView);
17185
+ if (emptyView === void 0) {
17186
+ throw new Error("AssertionError: repeater had empty view xref, but empty view was not found");
17187
+ }
17188
+ if (emptyView.fnName === null || emptyView.decls === null || emptyView.vars === null) {
17189
+ throw new Error(`AssertionError: expected repeater empty view to have been named and counted`);
17190
+ }
17191
+ emptyViewFnName = emptyView.fnName;
17192
+ emptyDecls = emptyView.decls;
17193
+ emptyVars = emptyView.vars;
17194
+ }
17195
+ 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));
16846
17196
  break;
16847
17197
  case OpKind.Statement:
16848
17198
  break;
@@ -16893,7 +17243,7 @@ function reifyUpdateOperations(_unit, ops) {
16893
17243
  OpList.replace(op, i18nExp(op.expression, op.sourceSpan));
16894
17244
  break;
16895
17245
  case OpKind.I18nApply:
16896
- OpList.replace(op, i18nApply(op.targetSlot, op.sourceSpan));
17246
+ OpList.replace(op, i18nApply(op.targetSlot.slot, op.sourceSpan));
16897
17247
  break;
16898
17248
  case OpKind.InterpolateText:
16899
17249
  OpList.replace(op, textInterpolate(op.interpolation.strings, op.interpolation.expressions, op.sourceSpan));
@@ -16926,10 +17276,13 @@ function reifyUpdateOperations(_unit, ops) {
16926
17276
  if (op.processed === null) {
16927
17277
  throw new Error(`Conditional test was not set.`);
16928
17278
  }
16929
- if (op.targetSlot === null) {
17279
+ if (op.targetSlot.slot === null) {
16930
17280
  throw new Error(`Conditional slot was not set.`);
16931
17281
  }
16932
- OpList.replace(op, conditional(op.targetSlot, op.processed, op.contextValue, op.sourceSpan));
17282
+ OpList.replace(op, conditional(op.targetSlot.slot, op.processed, op.contextValue, op.sourceSpan));
17283
+ break;
17284
+ case OpKind.Repeater:
17285
+ OpList.replace(op, repeater(op.targetSlot.slot, op.collection, op.sourceSpan));
16933
17286
  break;
16934
17287
  case OpKind.Statement:
16935
17288
  break;
@@ -16946,7 +17299,7 @@ function reifyIrExpression(expr) {
16946
17299
  case ExpressionKind.NextContext:
16947
17300
  return nextContext(expr.steps);
16948
17301
  case ExpressionKind.Reference:
16949
- return reference(expr.targetSlot + 1 + expr.offset);
17302
+ return reference(expr.targetSlot.slot + 1 + expr.offset);
16950
17303
  case ExpressionKind.LexicalRead:
16951
17304
  throw new Error(`AssertionError: unresolved LexicalRead of ${expr.name}`);
16952
17305
  case ExpressionKind.RestoreView:
@@ -16981,13 +17334,13 @@ function reifyIrExpression(expr) {
16981
17334
  case ExpressionKind.PureFunctionParameterExpr:
16982
17335
  throw new Error(`AssertionError: expected PureFunctionParameterExpr to have been extracted`);
16983
17336
  case ExpressionKind.PipeBinding:
16984
- return pipeBind(expr.targetSlot, expr.varOffset, expr.args);
17337
+ return pipeBind(expr.targetSlot.slot, expr.varOffset, expr.args);
16985
17338
  case ExpressionKind.PipeBindingVariadic:
16986
- return pipeBindV(expr.targetSlot, expr.varOffset, expr.args);
17339
+ return pipeBindV(expr.targetSlot.slot, expr.varOffset, expr.args);
16987
17340
  case ExpressionKind.SanitizerExpr:
16988
17341
  return importExpr(sanitizerIdentifierMap.get(expr.fn));
16989
17342
  case ExpressionKind.SlotLiteralExpr:
16990
- return literal(expr.targetSlot);
17343
+ return literal(expr.slot.slot);
16991
17344
  default:
16992
17345
  throw new Error(`AssertionError: Unsupported reification of ir.Expression kind: ${ExpressionKind[expr.kind]}`);
16993
17346
  }
@@ -17009,7 +17362,7 @@ function reifyListenerHandler(unit, name, handlerOps, consumesDollarEvent) {
17009
17362
  }
17010
17363
 
17011
17364
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/remove_empty_bindings.mjs
17012
- function phaseRemoveEmptyBindings(job) {
17365
+ function removeEmptyBindings(job) {
17013
17366
  for (const unit of job.units) {
17014
17367
  for (const op of unit.update) {
17015
17368
  switch (op.kind) {
@@ -17029,9 +17382,41 @@ function phaseRemoveEmptyBindings(job) {
17029
17382
  }
17030
17383
  }
17031
17384
 
17385
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/repeater_derived_vars.mjs
17386
+ function generateRepeaterDerivedVars(job) {
17387
+ const repeaters = /* @__PURE__ */ new Map();
17388
+ for (const unit of job.units) {
17389
+ for (const op of unit.ops()) {
17390
+ if (op.kind === OpKind.RepeaterCreate) {
17391
+ repeaters.set(op.xref, op);
17392
+ }
17393
+ }
17394
+ }
17395
+ for (const unit of job.units) {
17396
+ for (const op of unit.ops()) {
17397
+ transformExpressionsInOp(op, (expr) => {
17398
+ if (!(expr instanceof DerivedRepeaterVarExpr)) {
17399
+ return expr;
17400
+ }
17401
+ const repeaterOp = repeaters.get(expr.xref);
17402
+ switch (expr.identity) {
17403
+ case DerivedRepeaterVarIdentity.First:
17404
+ return new BinaryOperatorExpr(BinaryOperator.Identical, new LexicalReadExpr(repeaterOp.varNames.$index), literal(0));
17405
+ case DerivedRepeaterVarIdentity.Last:
17406
+ return new BinaryOperatorExpr(BinaryOperator.Identical, new LexicalReadExpr(repeaterOp.varNames.$index), new BinaryOperatorExpr(BinaryOperator.Minus, new LexicalReadExpr(repeaterOp.varNames.$count), literal(1)));
17407
+ case DerivedRepeaterVarIdentity.Even:
17408
+ return new BinaryOperatorExpr(BinaryOperator.Identical, new BinaryOperatorExpr(BinaryOperator.Modulo, new LexicalReadExpr(repeaterOp.varNames.$index), literal(2)), literal(0));
17409
+ case DerivedRepeaterVarIdentity.Odd:
17410
+ return new BinaryOperatorExpr(BinaryOperator.NotIdentical, new BinaryOperatorExpr(BinaryOperator.Modulo, new LexicalReadExpr(repeaterOp.varNames.$index), literal(2)), literal(0));
17411
+ }
17412
+ }, VisitorContextFlag.None);
17413
+ }
17414
+ }
17415
+ }
17416
+
17032
17417
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_contexts.mjs
17033
- function phaseResolveContexts(cpl) {
17034
- for (const unit of cpl.units) {
17418
+ function resolveContexts(job) {
17419
+ for (const unit of job.units) {
17035
17420
  processLexicalScope(unit, unit.create);
17036
17421
  processLexicalScope(unit, unit.update);
17037
17422
  }
@@ -17053,6 +17438,9 @@ function processLexicalScope(view, ops) {
17053
17438
  break;
17054
17439
  }
17055
17440
  }
17441
+ if (view === view.job.root) {
17442
+ scope.set(view.xref, variable("ctx"));
17443
+ }
17056
17444
  for (const op of ops) {
17057
17445
  transformExpressionsInOp(op, (expr) => {
17058
17446
  if (expr instanceof ContextExpr) {
@@ -17068,13 +17456,13 @@ function processLexicalScope(view, ops) {
17068
17456
  }
17069
17457
 
17070
17458
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_dollar_event.mjs
17071
- function phaseResolveDollarEvent(job) {
17459
+ function resolveDollarEvent(job) {
17072
17460
  for (const unit of job.units) {
17073
- resolveDollarEvent(unit, unit.create);
17074
- resolveDollarEvent(unit, unit.update);
17461
+ transformDollarEvent(unit, unit.create);
17462
+ transformDollarEvent(unit, unit.update);
17075
17463
  }
17076
17464
  }
17077
- function resolveDollarEvent(unit, ops) {
17465
+ function transformDollarEvent(unit, ops) {
17078
17466
  for (const op of ops) {
17079
17467
  if (op.kind === OpKind.Listener) {
17080
17468
  transformExpressionsInOp(op, (expr) => {
@@ -17088,195 +17476,135 @@ function resolveDollarEvent(unit, ops) {
17088
17476
  }
17089
17477
  }
17090
17478
 
17091
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_placeholders.mjs
17092
- var ESCAPE = "\uFFFD";
17093
- var ELEMENT_MARKER = "#";
17094
- var TEMPLATE_MARKER = "*";
17095
- var TAG_CLOSE_MARKER = "/";
17096
- var CONTEXT_MARKER = ":";
17097
- var LIST_START_MARKER = "[";
17098
- var LIST_END_MARKER = "]";
17099
- var LIST_DELIMITER = "|";
17100
- var I18nParamValueFlags;
17101
- (function(I18nParamValueFlags2) {
17102
- I18nParamValueFlags2[I18nParamValueFlags2["None"] = 0] = "None";
17103
- I18nParamValueFlags2[I18nParamValueFlags2["ElementTag"] = 1] = "ElementTag";
17104
- I18nParamValueFlags2[I18nParamValueFlags2["TemplateTag"] = 2] = "TemplateTag";
17105
- I18nParamValueFlags2[I18nParamValueFlags2["OpenTag"] = 4] = "OpenTag";
17106
- I18nParamValueFlags2[I18nParamValueFlags2["CloseTag"] = 8] = "CloseTag";
17107
- })(I18nParamValueFlags || (I18nParamValueFlags = {}));
17108
- var I18nPlaceholderParams = class {
17109
- constructor() {
17110
- this.values = /* @__PURE__ */ new Map();
17111
- }
17112
- addValue(placeholder, value, subTemplateIndex, resolutionTime, flags) {
17113
- var _a2;
17114
- const placeholderValues = (_a2 = this.values.get(placeholder)) != null ? _a2 : [];
17115
- placeholderValues.push({ value, subTemplateIndex, resolutionTime, flags });
17116
- this.values.set(placeholder, placeholderValues);
17117
- }
17118
- saveToOp(op) {
17119
- for (const [placeholder, placeholderValues] of this.values) {
17120
- const creationValues = placeholderValues.filter(({ resolutionTime }) => resolutionTime === I18nParamResolutionTime.Creation);
17121
- if (creationValues.length > 1) {
17122
- op.needsPostprocessing = true;
17123
- }
17124
- const serializedCreationValues = this.serializeValues(creationValues);
17125
- if (serializedCreationValues !== null) {
17126
- op.params.set(placeholder, literal(serializedCreationValues));
17127
- }
17128
- const serializedPostprocessingValues = this.serializeValues(placeholderValues.filter(({ resolutionTime }) => resolutionTime === I18nParamResolutionTime.Postproccessing));
17129
- if (serializedPostprocessingValues !== null) {
17130
- op.needsPostprocessing = true;
17131
- op.postprocessingParams.set(placeholder, literal(serializedPostprocessingValues));
17132
- }
17133
- }
17134
- }
17135
- merge(other) {
17136
- for (const [placeholder, otherValues] of other.values) {
17137
- const currentValues = this.values.get(placeholder) || [];
17138
- const flags = otherValues[0].flags;
17139
- if (flags & I18nParamValueFlags.CloseTag && !(flags & I18nParamValueFlags.OpenTag)) {
17140
- this.values.set(placeholder, [...otherValues, ...currentValues]);
17141
- } else {
17142
- this.values.set(placeholder, [...currentValues, ...otherValues]);
17143
- }
17144
- }
17145
- }
17146
- serializeValues(values) {
17147
- if (values.length === 0) {
17148
- return null;
17149
- }
17150
- const serializedValues = values.map((value) => this.serializeValue(value));
17151
- return serializedValues.length === 1 ? serializedValues[0] : `${LIST_START_MARKER}${serializedValues.join(LIST_DELIMITER)}${LIST_END_MARKER}`;
17152
- }
17153
- serializeValue(value) {
17154
- let tagMarker = "";
17155
- let closeMarker = "";
17156
- if (value.flags & I18nParamValueFlags.ElementTag) {
17157
- tagMarker = ELEMENT_MARKER;
17158
- } else if (value.flags & I18nParamValueFlags.TemplateTag) {
17159
- tagMarker = TEMPLATE_MARKER;
17160
- }
17161
- if (tagMarker !== "") {
17162
- closeMarker = value.flags & I18nParamValueFlags.CloseTag ? TAG_CLOSE_MARKER : "";
17163
- }
17164
- const context = value.subTemplateIndex === null ? "" : `${CONTEXT_MARKER}${value.subTemplateIndex}`;
17165
- if (value.flags & I18nParamValueFlags.OpenTag && value.flags & I18nParamValueFlags.CloseTag) {
17166
- return `${ESCAPE}${tagMarker}${value.value}${context}${ESCAPE}${ESCAPE}${closeMarker}${tagMarker}${value.value}${context}${ESCAPE}`;
17167
- }
17168
- return `${ESCAPE}${closeMarker}${tagMarker}${value.value}${context}${ESCAPE}`;
17169
- }
17170
- };
17171
- function phaseResolveI18nPlaceholders(job) {
17172
- const params = /* @__PURE__ */ new Map();
17173
- const i18nOps = /* @__PURE__ */ new Map();
17174
- resolvePlaceholders(job, params, i18nOps);
17175
- propagatePlaceholders(params, i18nOps);
17176
- for (const [xref, i18nOpParams] of params) {
17177
- i18nOpParams.saveToOp(i18nOps.get(xref));
17178
- }
17179
- for (const op of i18nOps.values()) {
17180
- if (op.xref === op.root) {
17181
- for (const placeholder in op.message.placeholders) {
17182
- if (!op.params.has(placeholder) && !op.postprocessingParams.has(placeholder)) {
17183
- throw Error(`Failed to resolve i18n placeholder: ${placeholder}`);
17184
- }
17479
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_element_placeholders.mjs
17480
+ function resolveI18nElementPlaceholders(job) {
17481
+ const extractedMessageOps = /* @__PURE__ */ new Map();
17482
+ const elements = /* @__PURE__ */ new Map();
17483
+ for (const unit of job.units) {
17484
+ for (const op of unit.create) {
17485
+ switch (op.kind) {
17486
+ case OpKind.ExtractedMessage:
17487
+ extractedMessageOps.set(op.owner, op);
17488
+ break;
17489
+ case OpKind.ElementStart:
17490
+ elements.set(op.xref, op);
17491
+ break;
17185
17492
  }
17186
17493
  }
17187
17494
  }
17188
- }
17189
- function resolvePlaceholders(job, params, i18nOps) {
17190
17495
  for (const unit of job.units) {
17191
- const elements = /* @__PURE__ */ new Map();
17192
- let currentI18nOp = null;
17496
+ let currentOps = null;
17193
17497
  for (const op of unit.create) {
17194
17498
  switch (op.kind) {
17195
17499
  case OpKind.I18nStart:
17196
- i18nOps.set(op.xref, op);
17197
- currentI18nOp = op.kind === OpKind.I18nStart ? op : null;
17500
+ if (!extractedMessageOps.has(op.xref)) {
17501
+ throw Error("Could not find extracted message for i18n op");
17502
+ }
17503
+ currentOps = { i18n: op, extractedMessage: extractedMessageOps.get(op.xref) };
17198
17504
  break;
17199
17505
  case OpKind.I18nEnd:
17200
- currentI18nOp = null;
17506
+ currentOps = null;
17201
17507
  break;
17202
17508
  case OpKind.ElementStart:
17203
17509
  if (op.i18nPlaceholder !== void 0) {
17204
- if (currentI18nOp === null) {
17510
+ if (currentOps === null) {
17205
17511
  throw Error("i18n tag placeholder should only occur inside an i18n block");
17206
17512
  }
17207
- elements.set(op.xref, op);
17208
17513
  const { startName, closeName } = op.i18nPlaceholder;
17209
17514
  let flags = I18nParamValueFlags.ElementTag | I18nParamValueFlags.OpenTag;
17210
17515
  if (closeName === "") {
17211
17516
  flags |= I18nParamValueFlags.CloseTag;
17212
17517
  }
17213
- addParam(params, currentI18nOp, startName, op.slot, currentI18nOp.subTemplateIndex, I18nParamResolutionTime.Creation, flags);
17518
+ addParam(currentOps.extractedMessage.params, startName, op.handle.slot, currentOps.i18n.subTemplateIndex, flags);
17214
17519
  }
17215
17520
  break;
17216
17521
  case OpKind.ElementEnd:
17217
17522
  const startOp = elements.get(op.xref);
17218
17523
  if (startOp && startOp.i18nPlaceholder !== void 0) {
17219
- if (currentI18nOp === null) {
17524
+ if (currentOps === null) {
17220
17525
  throw Error("i18n tag placeholder should only occur inside an i18n block");
17221
17526
  }
17222
17527
  const { closeName } = startOp.i18nPlaceholder;
17223
17528
  if (closeName !== "") {
17224
- addParam(params, currentI18nOp, closeName, startOp.slot, currentI18nOp.subTemplateIndex, I18nParamResolutionTime.Creation, I18nParamValueFlags.ElementTag | I18nParamValueFlags.CloseTag);
17529
+ addParam(currentOps.extractedMessage.params, closeName, startOp.handle.slot, currentOps.i18n.subTemplateIndex, I18nParamValueFlags.ElementTag | I18nParamValueFlags.CloseTag);
17225
17530
  }
17226
17531
  }
17227
17532
  break;
17228
17533
  case OpKind.Template:
17229
17534
  if (op.i18nPlaceholder !== void 0) {
17230
- if (currentI18nOp === null) {
17535
+ if (currentOps === null) {
17231
17536
  throw Error("i18n tag placeholder should only occur inside an i18n block");
17232
17537
  }
17233
- const subTemplateIndex = getSubTemplateIndexForTemplateTag(job, currentI18nOp, op);
17234
- addParam(params, currentI18nOp, op.i18nPlaceholder.startName, op.slot, subTemplateIndex, I18nParamResolutionTime.Creation, I18nParamValueFlags.TemplateTag);
17235
- addParam(params, currentI18nOp, op.i18nPlaceholder.closeName, op.slot, subTemplateIndex, I18nParamResolutionTime.Creation, I18nParamValueFlags.TemplateTag | I18nParamValueFlags.CloseTag);
17538
+ const subTemplateIndex = getSubTemplateIndexForTemplateTag(job, currentOps.i18n, op);
17539
+ addParam(currentOps.extractedMessage.params, op.i18nPlaceholder.startName, op.handle.slot, subTemplateIndex, I18nParamValueFlags.TemplateTag);
17540
+ addParam(currentOps.extractedMessage.params, op.i18nPlaceholder.closeName, op.handle.slot, subTemplateIndex, I18nParamValueFlags.TemplateTag | I18nParamValueFlags.CloseTag);
17236
17541
  }
17237
17542
  break;
17238
17543
  }
17239
17544
  }
17240
- const i18nBlockPlaceholderIndices = /* @__PURE__ */ new Map();
17545
+ }
17546
+ }
17547
+ function getSubTemplateIndexForTemplateTag(job, i18nOp, op) {
17548
+ for (const childOp of job.views.get(op.xref).create) {
17549
+ if (childOp.kind === OpKind.I18nStart) {
17550
+ return childOp.subTemplateIndex;
17551
+ }
17552
+ }
17553
+ return i18nOp.subTemplateIndex;
17554
+ }
17555
+ function addParam(params, placeholder, value, subTemplateIndex, flags = I18nParamValueFlags.None) {
17556
+ var _a2;
17557
+ const values = (_a2 = params.get(placeholder)) != null ? _a2 : [];
17558
+ values.push({ value, subTemplateIndex, flags });
17559
+ params.set(placeholder, values);
17560
+ }
17561
+
17562
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_expression_placeholders.mjs
17563
+ function resolveI18nExpressionPlaceholders(job) {
17564
+ const i18nOps = /* @__PURE__ */ new Map();
17565
+ const extractedMessageOps = /* @__PURE__ */ new Map();
17566
+ for (const unit of job.units) {
17567
+ for (const op of unit.create) {
17568
+ switch (op.kind) {
17569
+ case OpKind.I18nStart:
17570
+ i18nOps.set(op.xref, op);
17571
+ break;
17572
+ case OpKind.ExtractedMessage:
17573
+ extractedMessageOps.set(op.owner, op);
17574
+ break;
17575
+ }
17576
+ }
17577
+ }
17578
+ const expressionIndices = /* @__PURE__ */ new Map();
17579
+ for (const unit of job.units) {
17241
17580
  for (const op of unit.update) {
17242
17581
  if (op.kind === OpKind.I18nExpression) {
17243
17582
  const i18nOp = i18nOps.get(op.owner);
17244
- let index = i18nBlockPlaceholderIndices.get(op.owner) || 0;
17583
+ let index = expressionIndices.get(op.owner) || 0;
17245
17584
  if (!i18nOp) {
17246
- throw Error("Cannot find corresponding i18nStart for i18nExpr");
17585
+ throw Error("Cannot find corresponding i18n block for i18nExpr");
17586
+ }
17587
+ const extractedMessageOp = extractedMessageOps.get(i18nOp.xref);
17588
+ if (!extractedMessageOp) {
17589
+ throw Error("Cannot find extracted message for i18n block");
17247
17590
  }
17248
- addParam(params, i18nOp, op.i18nPlaceholder, index++, i18nOp.subTemplateIndex, op.resolutionTime);
17249
- i18nBlockPlaceholderIndices.set(op.owner, index);
17591
+ const params = op.resolutionTime === I18nParamResolutionTime.Creation ? extractedMessageOp.params : extractedMessageOp.postprocessingParams;
17592
+ const values = params.get(op.i18nPlaceholder) || [];
17593
+ values.push({
17594
+ value: index,
17595
+ subTemplateIndex: i18nOp.subTemplateIndex,
17596
+ flags: I18nParamValueFlags.None
17597
+ });
17598
+ params.set(op.i18nPlaceholder, values);
17599
+ expressionIndices.set(op.owner, index + 1);
17250
17600
  }
17251
17601
  }
17252
17602
  }
17253
17603
  }
17254
- function addParam(params, i18nOp, placeholder, value, subTemplateIndex, resolutionTime, flags = I18nParamValueFlags.None) {
17255
- const i18nOpParams = params.get(i18nOp.xref) || new I18nPlaceholderParams();
17256
- i18nOpParams.addValue(placeholder, value, subTemplateIndex, resolutionTime, flags);
17257
- params.set(i18nOp.xref, i18nOpParams);
17258
- }
17259
- function getSubTemplateIndexForTemplateTag(job, i18nOp, op) {
17260
- for (const childOp of job.views.get(op.xref).create) {
17261
- if (childOp.kind === OpKind.I18nStart) {
17262
- return childOp.subTemplateIndex;
17263
- }
17264
- }
17265
- return i18nOp.subTemplateIndex;
17266
- }
17267
- function propagatePlaceholders(params, i18nOps) {
17268
- for (const [xref, opParams] of params) {
17269
- const op = i18nOps.get(xref);
17270
- if (op.xref !== op.root) {
17271
- const rootParams = params.get(op.root) || new I18nPlaceholderParams();
17272
- rootParams.merge(opParams);
17273
- }
17274
- }
17275
- }
17276
17604
 
17277
17605
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_names.mjs
17278
- function phaseResolveNames(cpl) {
17279
- for (const unit of cpl.units) {
17606
+ function resolveNames(job) {
17607
+ for (const unit of job.units) {
17280
17608
  processLexicalScope2(unit, unit.create, null);
17281
17609
  processLexicalScope2(unit, unit.update, null);
17282
17610
  }
@@ -17288,6 +17616,7 @@ function processLexicalScope2(unit, ops, savedView) {
17288
17616
  case OpKind.Variable:
17289
17617
  switch (op.variable.kind) {
17290
17618
  case SemanticVariableKind.Identifier:
17619
+ case SemanticVariableKind.Alias:
17291
17620
  if (scope.has(op.variable.identifier)) {
17292
17621
  continue;
17293
17622
  }
@@ -17345,9 +17674,9 @@ var sanitizers = /* @__PURE__ */ new Map([
17345
17674
  [SecurityContext.URL, SanitizerFn.Url],
17346
17675
  [SecurityContext.RESOURCE_URL, SanitizerFn.ResourceUrl]
17347
17676
  ]);
17348
- function phaseResolveSanitizers(job) {
17677
+ function resolveSanitizers(job) {
17349
17678
  for (const unit of job.units) {
17350
- const elements = getElementsByXrefId(unit);
17679
+ const elements = createOpXrefMap(unit);
17351
17680
  let sanitizerFn;
17352
17681
  for (const op of unit.update) {
17353
17682
  switch (op.kind) {
@@ -17357,7 +17686,7 @@ function phaseResolveSanitizers(job) {
17357
17686
  op.sanitizer = sanitizerFn ? new SanitizerExpr(sanitizerFn) : null;
17358
17687
  if (op.sanitizer === null) {
17359
17688
  const ownerOp = elements.get(op.target);
17360
- if (ownerOp === void 0) {
17689
+ if (ownerOp === void 0 || !isElementOrContainerOp(ownerOp)) {
17361
17690
  throw Error("Property should have an element-like owner");
17362
17691
  }
17363
17692
  if (isIframeElement(ownerOp) && isIframeSecuritySensitiveAttr(op.name)) {
@@ -17375,20 +17704,20 @@ function isIframeElement(op) {
17375
17704
  }
17376
17705
 
17377
17706
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/save_restore_view.mjs
17378
- function phaseSaveRestoreView(job) {
17379
- for (const view of job.views.values()) {
17380
- view.create.prepend([
17381
- createVariableOp(view.job.allocateXrefId(), {
17707
+ function saveAndRestoreView(job) {
17708
+ for (const unit of job.units) {
17709
+ unit.create.prepend([
17710
+ createVariableOp(unit.job.allocateXrefId(), {
17382
17711
  kind: SemanticVariableKind.SavedView,
17383
17712
  name: null,
17384
- view: view.xref
17385
- }, new GetCurrentViewExpr())
17713
+ view: unit.xref
17714
+ }, new GetCurrentViewExpr(), VariableFlags.None)
17386
17715
  ]);
17387
- for (const op of view.create) {
17716
+ for (const op of unit.create) {
17388
17717
  if (op.kind !== OpKind.Listener) {
17389
17718
  continue;
17390
17719
  }
17391
- let needsRestoreView = view !== job.root;
17720
+ let needsRestoreView = unit !== job.root;
17392
17721
  if (!needsRestoreView) {
17393
17722
  for (const handlerOp of op.handlerOps) {
17394
17723
  visitExpressionsInOp(handlerOp, (expr) => {
@@ -17399,7 +17728,7 @@ function phaseSaveRestoreView(job) {
17399
17728
  }
17400
17729
  }
17401
17730
  if (needsRestoreView) {
17402
- addSaveRestoreViewOperationToListener(view, op);
17731
+ addSaveRestoreViewOperationToListener(unit, op);
17403
17732
  }
17404
17733
  }
17405
17734
  }
@@ -17410,7 +17739,7 @@ function addSaveRestoreViewOperationToListener(unit, op) {
17410
17739
  kind: SemanticVariableKind.Context,
17411
17740
  name: null,
17412
17741
  view: unit.xref
17413
- }, new RestoreViewExpr(unit.xref))
17742
+ }, new RestoreViewExpr(unit.xref), VariableFlags.None)
17414
17743
  ]);
17415
17744
  for (const handlerOp of op.handlerOps) {
17416
17745
  if (handlerOp.kind === OpKind.Statement && handlerOp.statement instanceof ReturnStatement) {
@@ -17420,7 +17749,7 @@ function addSaveRestoreViewOperationToListener(unit, op) {
17420
17749
  }
17421
17750
 
17422
17751
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/slot_allocation.mjs
17423
- function phaseSlotAllocation(job) {
17752
+ function allocateSlots(job) {
17424
17753
  const slotMap = /* @__PURE__ */ new Map();
17425
17754
  for (const unit of job.units) {
17426
17755
  let slotCount = 0;
@@ -17428,43 +17757,25 @@ function phaseSlotAllocation(job) {
17428
17757
  if (!hasConsumesSlotTrait(op)) {
17429
17758
  continue;
17430
17759
  }
17431
- op.slot = slotCount;
17432
- slotMap.set(op.xref, op.slot);
17760
+ op.handle.slot = slotCount;
17761
+ slotMap.set(op.xref, op.handle.slot);
17433
17762
  slotCount += op.numSlotsUsed;
17434
17763
  }
17435
17764
  unit.decls = slotCount;
17436
17765
  }
17437
17766
  for (const unit of job.units) {
17438
17767
  for (const op of unit.ops()) {
17439
- if (op.kind === OpKind.Template) {
17768
+ if (op.kind === OpKind.Template || op.kind === OpKind.RepeaterCreate) {
17440
17769
  const childView = job.views.get(op.xref);
17441
17770
  op.decls = childView.decls;
17442
17771
  }
17443
- if (hasUsesSlotIndexTrait(op) && op.targetSlot === null) {
17444
- if (!slotMap.has(op.target)) {
17445
- throw new Error(`AssertionError: no slot allocated for ${OpKind[op.kind]} target ${op.target}`);
17446
- }
17447
- op.targetSlot = slotMap.get(op.target);
17448
- }
17449
- visitExpressionsInOp(op, (expr) => {
17450
- if (!isIrExpression(expr)) {
17451
- return;
17452
- }
17453
- if (!hasUsesSlotIndexTrait(expr) || expr.targetSlot !== null) {
17454
- return;
17455
- }
17456
- if (!slotMap.has(expr.target)) {
17457
- throw new Error(`AssertionError: no slot allocated for ${expr.constructor.name} target ${expr.target}`);
17458
- }
17459
- expr.targetSlot = slotMap.get(expr.target);
17460
- });
17461
17772
  }
17462
17773
  }
17463
17774
  }
17464
17775
 
17465
17776
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/style_binding_specialization.mjs
17466
- function phaseStyleBindingSpecialization(cpl) {
17467
- for (const unit of cpl.units) {
17777
+ function specializeStyleBindings(job) {
17778
+ for (const unit of job.units) {
17468
17779
  for (const op of unit.update) {
17469
17780
  if (op.kind !== OpKind.Binding) {
17470
17781
  continue;
@@ -17493,8 +17804,8 @@ function phaseStyleBindingSpecialization(cpl) {
17493
17804
  }
17494
17805
 
17495
17806
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/temporary_variables.mjs
17496
- function phaseTemporaryVariables(cpl) {
17497
- for (const unit of cpl.units) {
17807
+ function generateTemporaryVariables(job) {
17808
+ for (const unit of job.units) {
17498
17809
  unit.create.prepend(generateTemporaries(unit.create));
17499
17810
  unit.update.prepend(generateTemporaries(unit.update));
17500
17811
  }
@@ -17550,9 +17861,219 @@ function assignName(names, expr) {
17550
17861
  expr.name = name;
17551
17862
  }
17552
17863
 
17864
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/track_fn_generation.mjs
17865
+ function generateTrackFns(job) {
17866
+ for (const unit of job.units) {
17867
+ for (const op of unit.create) {
17868
+ if (op.kind !== OpKind.RepeaterCreate) {
17869
+ continue;
17870
+ }
17871
+ if (op.trackByFn !== null) {
17872
+ continue;
17873
+ }
17874
+ let usesComponentContext = false;
17875
+ op.track = transformExpressionsInExpression(op.track, (expr) => {
17876
+ if (expr instanceof TrackContextExpr) {
17877
+ usesComponentContext = true;
17878
+ return variable("this");
17879
+ }
17880
+ return expr;
17881
+ }, VisitorContextFlag.None);
17882
+ let fn2;
17883
+ const fnParams = [new FnParam("$index"), new FnParam("$item")];
17884
+ if (usesComponentContext) {
17885
+ fn2 = new FunctionExpr(fnParams, [new ReturnStatement(op.track)]);
17886
+ } else {
17887
+ fn2 = arrowFn(fnParams, op.track);
17888
+ }
17889
+ op.trackByFn = job.pool.getSharedFunctionReference(fn2, "_forTrack");
17890
+ }
17891
+ }
17892
+ }
17893
+
17894
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/track_fn_optimization.mjs
17895
+ function optimizeTrackFns(job) {
17896
+ for (const unit of job.units) {
17897
+ for (const op of unit.create) {
17898
+ if (op.kind !== OpKind.RepeaterCreate) {
17899
+ continue;
17900
+ }
17901
+ if (op.track instanceof ReadVarExpr && op.track.name === "$index") {
17902
+ op.trackByFn = importExpr(Identifiers.repeaterTrackByIndex);
17903
+ } else if (op.track instanceof ReadVarExpr && op.track.name === "$item") {
17904
+ op.trackByFn = importExpr(Identifiers.repeaterTrackByIdentity);
17905
+ } else if (isTrackByFunctionCall(job.root.xref, op.track)) {
17906
+ if (op.track.receiver.receiver.view === unit.xref) {
17907
+ op.trackByFn = op.track.receiver;
17908
+ } else {
17909
+ op.trackByFn = importExpr(Identifiers.componentInstance).callFn([]).prop(op.track.receiver.name);
17910
+ op.track = op.trackByFn;
17911
+ }
17912
+ } else {
17913
+ op.track = transformExpressionsInExpression(op.track, (expr) => {
17914
+ if (expr instanceof ContextExpr) {
17915
+ op.usesComponentInstance = true;
17916
+ return new TrackContextExpr(expr.view);
17917
+ }
17918
+ return expr;
17919
+ }, VisitorContextFlag.None);
17920
+ }
17921
+ }
17922
+ }
17923
+ }
17924
+ function isTrackByFunctionCall(rootView, expr) {
17925
+ if (!(expr instanceof InvokeFunctionExpr) || expr.args.length !== 2) {
17926
+ return false;
17927
+ }
17928
+ if (!(expr.receiver instanceof ReadPropExpr && expr.receiver.receiver instanceof ContextExpr) || expr.receiver.receiver.view !== rootView) {
17929
+ return false;
17930
+ }
17931
+ const [arg0, arg1] = expr.args;
17932
+ if (!(arg0 instanceof ReadVarExpr) || arg0.name !== "$index") {
17933
+ return false;
17934
+ }
17935
+ if (!(arg1 instanceof ReadVarExpr) || arg1.name !== "$item") {
17936
+ return false;
17937
+ }
17938
+ return true;
17939
+ }
17940
+
17941
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/track_variables.mjs
17942
+ function generateTrackVariables(job) {
17943
+ for (const unit of job.units) {
17944
+ for (const op of unit.create) {
17945
+ if (op.kind !== OpKind.RepeaterCreate) {
17946
+ continue;
17947
+ }
17948
+ op.track = transformExpressionsInExpression(op.track, (expr) => {
17949
+ if (expr instanceof LexicalReadExpr) {
17950
+ if (expr.name === op.varNames.$index) {
17951
+ return variable("$index");
17952
+ } else if (expr.name === op.varNames.$implicit) {
17953
+ return variable("$item");
17954
+ }
17955
+ }
17956
+ return expr;
17957
+ }, VisitorContextFlag.None);
17958
+ }
17959
+ }
17960
+ }
17961
+
17962
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/var_counting.mjs
17963
+ function countVariables(job) {
17964
+ for (const unit of job.units) {
17965
+ let varCount = 0;
17966
+ for (const op of unit.ops()) {
17967
+ if (hasConsumesVarsTrait(op)) {
17968
+ varCount += varsUsedByOp(op);
17969
+ }
17970
+ }
17971
+ for (const op of unit.ops()) {
17972
+ visitExpressionsInOp(op, (expr) => {
17973
+ if (!isIrExpression(expr)) {
17974
+ return;
17975
+ }
17976
+ if (job.compatibility === CompatibilityMode.TemplateDefinitionBuilder && expr instanceof PureFunctionExpr) {
17977
+ return;
17978
+ }
17979
+ if (hasUsesVarOffsetTrait(expr)) {
17980
+ expr.varOffset = varCount;
17981
+ }
17982
+ if (hasConsumesVarsTrait(expr)) {
17983
+ varCount += varsUsedByIrExpression(expr);
17984
+ }
17985
+ });
17986
+ }
17987
+ if (job.compatibility === CompatibilityMode.TemplateDefinitionBuilder) {
17988
+ for (const op of unit.ops()) {
17989
+ visitExpressionsInOp(op, (expr) => {
17990
+ if (!isIrExpression(expr) || !(expr instanceof PureFunctionExpr)) {
17991
+ return;
17992
+ }
17993
+ if (hasUsesVarOffsetTrait(expr)) {
17994
+ expr.varOffset = varCount;
17995
+ }
17996
+ if (hasConsumesVarsTrait(expr)) {
17997
+ varCount += varsUsedByIrExpression(expr);
17998
+ }
17999
+ });
18000
+ }
18001
+ }
18002
+ unit.vars = varCount;
18003
+ }
18004
+ if (job instanceof ComponentCompilationJob) {
18005
+ for (const unit of job.units) {
18006
+ for (const op of unit.create) {
18007
+ if (op.kind !== OpKind.Template && op.kind !== OpKind.RepeaterCreate) {
18008
+ continue;
18009
+ }
18010
+ const childView = job.views.get(op.xref);
18011
+ op.vars = childView.vars;
18012
+ }
18013
+ }
18014
+ }
18015
+ }
18016
+ function varsUsedByOp(op) {
18017
+ let slots;
18018
+ switch (op.kind) {
18019
+ case OpKind.Property:
18020
+ case OpKind.HostProperty:
18021
+ case OpKind.Attribute:
18022
+ slots = 1;
18023
+ if (op.expression instanceof Interpolation2 && !isSingletonInterpolation(op.expression)) {
18024
+ slots += op.expression.expressions.length;
18025
+ }
18026
+ return slots;
18027
+ case OpKind.StyleProp:
18028
+ case OpKind.ClassProp:
18029
+ case OpKind.StyleMap:
18030
+ case OpKind.ClassMap:
18031
+ slots = 2;
18032
+ if (op.expression instanceof Interpolation2) {
18033
+ slots += op.expression.expressions.length;
18034
+ }
18035
+ return slots;
18036
+ case OpKind.InterpolateText:
18037
+ return op.interpolation.expressions.length;
18038
+ case OpKind.I18nExpression:
18039
+ case OpKind.Conditional:
18040
+ return 1;
18041
+ default:
18042
+ throw new Error(`Unhandled op: ${OpKind[op.kind]}`);
18043
+ }
18044
+ }
18045
+ function varsUsedByIrExpression(expr) {
18046
+ switch (expr.kind) {
18047
+ case ExpressionKind.PureFunctionExpr:
18048
+ return 1 + expr.args.length;
18049
+ case ExpressionKind.PipeBinding:
18050
+ return 1 + expr.args.length;
18051
+ case ExpressionKind.PipeBindingVariadic:
18052
+ return 1 + expr.numArgs;
18053
+ default:
18054
+ throw new Error(`AssertionError: unhandled ConsumesVarsTrait expression ${expr.constructor.name}`);
18055
+ }
18056
+ }
18057
+ function isSingletonInterpolation(expr) {
18058
+ if (expr.expressions.length !== 1 || expr.strings.length !== 2) {
18059
+ return false;
18060
+ }
18061
+ if (expr.strings[0] !== "" || expr.strings[1] !== "") {
18062
+ return false;
18063
+ }
18064
+ return true;
18065
+ }
18066
+
17553
18067
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/variable_optimization.mjs
17554
- function phaseVariableOptimization(job) {
18068
+ function optimizeVariables(job) {
17555
18069
  for (const unit of job.units) {
18070
+ inlineAlwaysInlineVariables(unit.create);
18071
+ inlineAlwaysInlineVariables(unit.update);
18072
+ for (const op of unit.create) {
18073
+ if (op.kind === OpKind.Listener) {
18074
+ inlineAlwaysInlineVariables(op.handlerOps);
18075
+ }
18076
+ }
17556
18077
  optimizeVariablesInOpList(unit.create, job.compatibility);
17557
18078
  optimizeVariablesInOpList(unit.update, job.compatibility);
17558
18079
  for (const op of unit.create) {
@@ -17566,9 +18087,32 @@ var Fence;
17566
18087
  (function(Fence2) {
17567
18088
  Fence2[Fence2["None"] = 0] = "None";
17568
18089
  Fence2[Fence2["ViewContextRead"] = 1] = "ViewContextRead";
17569
- Fence2[Fence2["ViewContextWrite"] = 3] = "ViewContextWrite";
18090
+ Fence2[Fence2["ViewContextWrite"] = 2] = "ViewContextWrite";
17570
18091
  Fence2[Fence2["SideEffectful"] = 4] = "SideEffectful";
17571
18092
  })(Fence || (Fence = {}));
18093
+ function inlineAlwaysInlineVariables(ops) {
18094
+ const vars = /* @__PURE__ */ new Map();
18095
+ for (const op of ops) {
18096
+ if (op.kind === OpKind.Variable && op.flags & VariableFlags.AlwaysInline) {
18097
+ visitExpressionsInOp(op, (expr) => {
18098
+ if (isIrExpression(expr) && fencesForIrExpression(expr) !== Fence.None) {
18099
+ throw new Error(`AssertionError: A context-sensitive variable was marked AlwaysInline`);
18100
+ }
18101
+ });
18102
+ vars.set(op.xref, op);
18103
+ }
18104
+ transformExpressionsInOp(op, (expr) => {
18105
+ if (expr instanceof ReadVariableExpr && vars.has(expr.xref)) {
18106
+ const varOp = vars.get(expr.xref);
18107
+ return varOp.initializer.clone();
18108
+ }
18109
+ return expr;
18110
+ }, VisitorContextFlag.None);
18111
+ }
18112
+ for (const op of vars.values()) {
18113
+ OpList.remove(op);
18114
+ }
18115
+ }
17572
18116
  function optimizeVariablesInOpList(ops, compatibility) {
17573
18117
  const varDecls = /* @__PURE__ */ new Map();
17574
18118
  const varUsages = /* @__PURE__ */ new Map();
@@ -17608,7 +18152,10 @@ function optimizeVariablesInOpList(ops, compatibility) {
17608
18152
  }
17609
18153
  const toInline = [];
17610
18154
  for (const [id, count] of varUsages) {
17611
- if (count !== 1) {
18155
+ const decl = varDecls.get(id);
18156
+ const varInfo = opMap.get(decl);
18157
+ const isAlwaysInline = !!(decl.flags & VariableFlags.AlwaysInline);
18158
+ if (count !== 1 || isAlwaysInline) {
17612
18159
  continue;
17613
18160
  }
17614
18161
  if (varRemoteUsages.has(id)) {
@@ -17620,6 +18167,10 @@ function optimizeVariablesInOpList(ops, compatibility) {
17620
18167
  while (candidate = toInline.pop()) {
17621
18168
  const decl = varDecls.get(candidate);
17622
18169
  const varInfo = opMap.get(decl);
18170
+ const isAlwaysInline = !!(decl.flags & VariableFlags.AlwaysInline);
18171
+ if (isAlwaysInline) {
18172
+ throw new Error(`AssertionError: Found an 'AlwaysInline' variable after the always inlining pass.`);
18173
+ }
17623
18174
  for (let targetOp = decl.next; targetOp.kind !== OpKind.ListEnd; targetOp = targetOp.next) {
17624
18175
  const opInfo = opMap.get(targetOp);
17625
18176
  if (opInfo.variablesUsed.has(candidate)) {
@@ -17648,9 +18199,9 @@ function optimizeVariablesInOpList(ops, compatibility) {
17648
18199
  function fencesForIrExpression(expr) {
17649
18200
  switch (expr.kind) {
17650
18201
  case ExpressionKind.NextContext:
17651
- return Fence.ViewContextWrite;
18202
+ return Fence.ViewContextRead | Fence.ViewContextWrite;
17652
18203
  case ExpressionKind.RestoreView:
17653
- return Fence.ViewContextWrite | Fence.SideEffectful;
18204
+ return Fence.ViewContextRead | Fence.ViewContextWrite | Fence.SideEffectful;
17654
18205
  case ExpressionKind.Reference:
17655
18206
  return Fence.ViewContextRead;
17656
18207
  default:
@@ -17764,7 +18315,7 @@ function allowConservativeInlining(decl, target) {
17764
18315
  }
17765
18316
 
17766
18317
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/wrap_icus.mjs
17767
- function phaseWrapIcus(job) {
18318
+ function wrapI18nIcus(job) {
17768
18319
  for (const unit of job.units) {
17769
18320
  let currentI18nOp = null;
17770
18321
  for (const op of unit.create) {
@@ -17789,55 +18340,64 @@ function phaseWrapIcus(job) {
17789
18340
 
17790
18341
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/emit.mjs
17791
18342
  var phases = [
17792
- { kind: CompilationJobKind.Tmpl, fn: phaseRemoveContentSelectors },
17793
- { kind: CompilationJobKind.Host, fn: phaseHostStylePropertyParsing },
17794
- { kind: CompilationJobKind.Tmpl, fn: phaseNamespace },
17795
- { kind: CompilationJobKind.Both, fn: phaseStyleBindingSpecialization },
17796
- { kind: CompilationJobKind.Both, fn: phaseBindingSpecialization },
17797
- { kind: CompilationJobKind.Tmpl, fn: phasePropagateI18nBlocks },
17798
- { kind: CompilationJobKind.Tmpl, fn: phaseWrapIcus },
17799
- { kind: CompilationJobKind.Both, fn: phaseAttributeExtraction },
17800
- { kind: CompilationJobKind.Both, fn: phaseParseExtractedStyles },
17801
- { kind: CompilationJobKind.Tmpl, fn: phaseRemoveEmptyBindings },
17802
- { kind: CompilationJobKind.Tmpl, fn: phaseConditionals },
17803
- { kind: CompilationJobKind.Tmpl, fn: phasePipeCreation },
17804
- { kind: CompilationJobKind.Tmpl, fn: phaseI18nTextExtraction },
17805
- { kind: CompilationJobKind.Tmpl, fn: phaseIcuExtraction },
17806
- { kind: CompilationJobKind.Tmpl, fn: phaseApplyI18nExpressions },
17807
- { kind: CompilationJobKind.Tmpl, fn: phasePipeVariadic },
17808
- { kind: CompilationJobKind.Both, fn: phasePureLiteralStructures },
17809
- { kind: CompilationJobKind.Tmpl, fn: phaseGenerateProjectionDef },
17810
- { kind: CompilationJobKind.Tmpl, fn: phaseGenerateVariables },
17811
- { kind: CompilationJobKind.Tmpl, fn: phaseSaveRestoreView },
17812
- { kind: CompilationJobKind.Tmpl, fn: phaseFindAnyCasts },
17813
- { kind: CompilationJobKind.Both, fn: phaseResolveDollarEvent },
17814
- { kind: CompilationJobKind.Both, fn: phaseResolveNames },
17815
- { kind: CompilationJobKind.Both, fn: phaseResolveContexts },
17816
- { kind: CompilationJobKind.Tmpl, fn: phaseResolveSanitizers },
17817
- { kind: CompilationJobKind.Tmpl, fn: phaseLocalRefs },
17818
- { kind: CompilationJobKind.Both, fn: phaseNullishCoalescing },
17819
- { kind: CompilationJobKind.Both, fn: phaseExpandSafeReads },
17820
- { kind: CompilationJobKind.Both, fn: phaseTemporaryVariables },
17821
- { kind: CompilationJobKind.Tmpl, fn: phaseSlotAllocation },
17822
- { kind: CompilationJobKind.Tmpl, fn: phaseResolveI18nPlaceholders },
17823
- { kind: CompilationJobKind.Tmpl, fn: phaseI18nMessageExtraction },
17824
- { kind: CompilationJobKind.Tmpl, fn: phaseI18nConstCollection },
17825
- { kind: CompilationJobKind.Tmpl, fn: phaseConstTraitCollection },
17826
- { kind: CompilationJobKind.Both, fn: phaseConstCollection },
17827
- { kind: CompilationJobKind.Tmpl, fn: phaseAssignI18nSlotDependencies },
17828
- { kind: CompilationJobKind.Both, fn: phaseVarCounting },
17829
- { kind: CompilationJobKind.Tmpl, fn: phaseGenerateAdvance },
17830
- { kind: CompilationJobKind.Both, fn: phaseVariableOptimization },
17831
- { kind: CompilationJobKind.Both, fn: phaseNaming },
17832
- { kind: CompilationJobKind.Tmpl, fn: phaseMergeNextContext },
17833
- { kind: CompilationJobKind.Tmpl, fn: phaseNgContainer },
17834
- { kind: CompilationJobKind.Tmpl, fn: phaseEmptyElements },
17835
- { kind: CompilationJobKind.Tmpl, fn: phaseNonbindable },
17836
- { kind: CompilationJobKind.Both, fn: phasePureFunctionExtraction },
17837
- { kind: CompilationJobKind.Tmpl, fn: phaseAlignPipeVariadicVarOffset },
17838
- { kind: CompilationJobKind.Both, fn: phaseOrdering },
17839
- { kind: CompilationJobKind.Both, fn: phaseReify },
17840
- { kind: CompilationJobKind.Both, fn: phaseChaining }
18343
+ { kind: CompilationJobKind.Tmpl, fn: removeContentSelectors },
18344
+ { kind: CompilationJobKind.Host, fn: parseHostStyleProperties },
18345
+ { kind: CompilationJobKind.Tmpl, fn: emitNamespaceChanges },
18346
+ { kind: CompilationJobKind.Both, fn: specializeStyleBindings },
18347
+ { kind: CompilationJobKind.Both, fn: specializeBindings },
18348
+ { kind: CompilationJobKind.Tmpl, fn: propagateI18nBlocks },
18349
+ { kind: CompilationJobKind.Tmpl, fn: wrapI18nIcus },
18350
+ { kind: CompilationJobKind.Both, fn: extractAttributes },
18351
+ { kind: CompilationJobKind.Both, fn: parseExtractedStyles },
18352
+ { kind: CompilationJobKind.Tmpl, fn: removeEmptyBindings },
18353
+ { kind: CompilationJobKind.Both, fn: collapseSingletonInterpolations },
18354
+ { kind: CompilationJobKind.Both, fn: orderOps },
18355
+ { kind: CompilationJobKind.Tmpl, fn: generateConditionalExpressions },
18356
+ { kind: CompilationJobKind.Tmpl, fn: createPipes },
18357
+ { kind: CompilationJobKind.Tmpl, fn: configureDeferInstructions },
18358
+ { kind: CompilationJobKind.Tmpl, fn: extractI18nText },
18359
+ { kind: CompilationJobKind.Tmpl, fn: extractI18nICUs },
18360
+ { kind: CompilationJobKind.Tmpl, fn: applyI18nExpressions },
18361
+ { kind: CompilationJobKind.Tmpl, fn: createVariadicPipes },
18362
+ { kind: CompilationJobKind.Both, fn: generatePureLiteralStructures },
18363
+ { kind: CompilationJobKind.Tmpl, fn: generateProjectionDefs },
18364
+ { kind: CompilationJobKind.Tmpl, fn: generateVariables },
18365
+ { kind: CompilationJobKind.Tmpl, fn: saveAndRestoreView },
18366
+ { kind: CompilationJobKind.Tmpl, fn: deleteAnyCasts },
18367
+ { kind: CompilationJobKind.Both, fn: resolveDollarEvent },
18368
+ { kind: CompilationJobKind.Tmpl, fn: generateRepeaterDerivedVars },
18369
+ { kind: CompilationJobKind.Tmpl, fn: generateTrackVariables },
18370
+ { kind: CompilationJobKind.Both, fn: resolveNames },
18371
+ { kind: CompilationJobKind.Tmpl, fn: resolveDeferTargetNames },
18372
+ { kind: CompilationJobKind.Tmpl, fn: optimizeTrackFns },
18373
+ { kind: CompilationJobKind.Both, fn: resolveContexts },
18374
+ { kind: CompilationJobKind.Tmpl, fn: resolveSanitizers },
18375
+ { kind: CompilationJobKind.Tmpl, fn: liftLocalRefs },
18376
+ { kind: CompilationJobKind.Both, fn: generateNullishCoalesceExpressions },
18377
+ { kind: CompilationJobKind.Both, fn: expandSafeReads },
18378
+ { kind: CompilationJobKind.Both, fn: generateTemporaryVariables },
18379
+ { kind: CompilationJobKind.Tmpl, fn: allocateSlots },
18380
+ { kind: CompilationJobKind.Tmpl, fn: extractI18nMessages },
18381
+ { kind: CompilationJobKind.Tmpl, fn: resolveI18nElementPlaceholders },
18382
+ { kind: CompilationJobKind.Tmpl, fn: resolveI18nExpressionPlaceholders },
18383
+ { kind: CompilationJobKind.Tmpl, fn: propogateI18nPlaceholders },
18384
+ { kind: CompilationJobKind.Tmpl, fn: formatI18nParams },
18385
+ { kind: CompilationJobKind.Tmpl, fn: generateTrackFns },
18386
+ { kind: CompilationJobKind.Tmpl, fn: collectI18nConsts },
18387
+ { kind: CompilationJobKind.Tmpl, fn: collectConstExpressions },
18388
+ { kind: CompilationJobKind.Both, fn: collectElementConsts },
18389
+ { kind: CompilationJobKind.Tmpl, fn: assignI18nSlotDependencies },
18390
+ { kind: CompilationJobKind.Both, fn: countVariables },
18391
+ { kind: CompilationJobKind.Tmpl, fn: generateAdvance },
18392
+ { kind: CompilationJobKind.Both, fn: optimizeVariables },
18393
+ { kind: CompilationJobKind.Both, fn: nameFunctionsAndVariables },
18394
+ { kind: CompilationJobKind.Tmpl, fn: mergeNextContextExpressions },
18395
+ { kind: CompilationJobKind.Tmpl, fn: generateNgContainerOps },
18396
+ { kind: CompilationJobKind.Tmpl, fn: collapseEmptyInstructions },
18397
+ { kind: CompilationJobKind.Tmpl, fn: disableBindings },
18398
+ { kind: CompilationJobKind.Both, fn: extractPureFunctions },
18399
+ { kind: CompilationJobKind.Both, fn: reify },
18400
+ { kind: CompilationJobKind.Both, fn: chain }
17841
18401
  ];
17842
18402
  function transform(job, kind) {
17843
18403
  for (const phase of phases) {
@@ -17944,9 +18504,9 @@ function emitHostBindingFunction(job) {
17944
18504
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/ingest.mjs
17945
18505
  var compatibilityMode = CompatibilityMode.TemplateDefinitionBuilder;
17946
18506
  function ingestComponent(componentName, template2, constantPool, relativeContextFilePath, i18nUseExternalIds) {
17947
- const cpl = new ComponentCompilationJob(componentName, constantPool, compatibilityMode, relativeContextFilePath, i18nUseExternalIds);
17948
- ingestNodes(cpl.root, template2);
17949
- return cpl;
18507
+ const job = new ComponentCompilationJob(componentName, constantPool, compatibilityMode, relativeContextFilePath, i18nUseExternalIds);
18508
+ ingestNodes(job.root, template2);
18509
+ return job;
17950
18510
  }
17951
18511
  function ingestHostBinding(input, bindingParser, constantPool) {
17952
18512
  var _a2, _b2, _c2;
@@ -17995,7 +18555,7 @@ function ingestHostAttribute(job, name, value) {
17995
18555
  job.root.update.push(attrBinding);
17996
18556
  }
17997
18557
  function ingestHostEvent(job, event) {
17998
- const eventBinding = createListenerOp(job.root.xref, event.name, null, event.targetOrPhase, true, event.sourceSpan);
18558
+ const eventBinding = createListenerOp(job.root.xref, new SlotHandle(), event.name, null, event.targetOrPhase, true, event.sourceSpan);
17999
18559
  eventBinding.handlerOps.push(createStatementOp(new ReturnStatement(convertAst(event.handler.ast, job, event.sourceSpan), event.handlerSpan)));
18000
18560
  job.root.create.push(eventBinding);
18001
18561
  }
@@ -18019,6 +18579,8 @@ function ingestNodes(unit, template2) {
18019
18579
  ingestDeferBlock(unit, node);
18020
18580
  } else if (node instanceof Icu) {
18021
18581
  ingestIcu(unit, node);
18582
+ } else if (node instanceof ForLoopBlock) {
18583
+ ingestForBlock(unit, node);
18022
18584
  } else {
18023
18585
  throw new Error(`Unsupported template node: ${node.constructor.name}`);
18024
18586
  }
@@ -18028,10 +18590,6 @@ function ingestElement(unit, element2) {
18028
18590
  if (element2.i18n !== void 0 && !(element2.i18n instanceof Message || element2.i18n instanceof TagPlaceholder)) {
18029
18591
  throw Error(`Unhandled i18n metadata type for element: ${element2.i18n.constructor.name}`);
18030
18592
  }
18031
- const staticAttributes = {};
18032
- for (const attr of element2.attributes) {
18033
- staticAttributes[attr.name] = attr.value;
18034
- }
18035
18593
  const id = unit.job.allocateXrefId();
18036
18594
  const [namespaceKey, elementName] = splitNsName(element2.name);
18037
18595
  const startOp = createElementStartOp(elementName, id, namespaceForKey(namespaceKey), element2.i18n instanceof TagPlaceholder ? element2.i18n : void 0, element2.startSourceSpan);
@@ -18058,13 +18616,15 @@ function ingestTemplate(unit, tmpl) {
18058
18616
  [namespacePrefix, tagNameWithoutNamespace] = splitNsName(tmpl.tagName);
18059
18617
  }
18060
18618
  const i18nPlaceholder = tmpl.i18n instanceof TagPlaceholder ? tmpl.i18n : void 0;
18061
- const tplOp = createTemplateOp(childView.xref, tagNameWithoutNamespace, namespaceForKey(namespacePrefix), false, i18nPlaceholder, tmpl.startSourceSpan);
18619
+ const namespace = namespaceForKey(namespacePrefix);
18620
+ const functionNameSuffix = tagNameWithoutNamespace === null ? "" : prefixWithNamespace(tagNameWithoutNamespace, namespace);
18621
+ const tplOp = createTemplateOp(childView.xref, tagNameWithoutNamespace, functionNameSuffix, namespace, i18nPlaceholder, tmpl.startSourceSpan);
18062
18622
  unit.create.push(tplOp);
18063
18623
  ingestBindings(unit, tplOp, tmpl);
18064
18624
  ingestReferences(tplOp, tmpl);
18065
18625
  ingestNodes(childView, tmpl.children);
18066
18626
  for (const { name, value } of tmpl.variables) {
18067
- childView.contextVariables.set(name, value);
18627
+ childView.contextVariables.set(name, value !== "" ? value : "$implicit");
18068
18628
  }
18069
18629
  if (isPlainTemplate(tmpl) && tmpl.i18n instanceof Message) {
18070
18630
  const id = unit.job.allocateXrefId();
@@ -18073,7 +18633,7 @@ function ingestTemplate(unit, tmpl) {
18073
18633
  }
18074
18634
  }
18075
18635
  function ingestContent(unit, content) {
18076
- const op = createProjectionOp(unit.job.allocateXrefId(), content.selector);
18636
+ const op = createProjectionOp(unit.job.allocateXrefId(), content.selector, content.sourceSpan);
18077
18637
  for (const attr of content.attributes) {
18078
18638
  ingestBinding(unit, op.xref, attr.name, literal(attr.value), 1, null, SecurityContext.NONE, attr.sourceSpan, BindingFlags.TextValue);
18079
18639
  }
@@ -18102,39 +18662,50 @@ function ingestBoundText(unit, text2) {
18102
18662
  }
18103
18663
  function ingestIfBlock(unit, ifBlock) {
18104
18664
  let firstXref = null;
18665
+ let firstSlotHandle = null;
18105
18666
  let conditions = [];
18106
- for (const ifCase of ifBlock.branches) {
18667
+ for (let i = 0; i < ifBlock.branches.length; i++) {
18668
+ const ifCase = ifBlock.branches[i];
18107
18669
  const cView = unit.job.allocateView(unit.xref);
18670
+ let tagName = null;
18671
+ if (i === 0) {
18672
+ tagName = ingestControlFlowInsertionPoint(unit, cView.xref, ifCase);
18673
+ }
18108
18674
  if (ifCase.expressionAlias !== null) {
18109
18675
  cView.contextVariables.set(ifCase.expressionAlias.name, CTX_REF);
18110
18676
  }
18677
+ const tmplOp = createTemplateOp(cView.xref, tagName, "Conditional", Namespace.HTML, void 0, ifCase.sourceSpan);
18678
+ unit.create.push(tmplOp);
18111
18679
  if (firstXref === null) {
18112
18680
  firstXref = cView.xref;
18681
+ firstSlotHandle = tmplOp.handle;
18113
18682
  }
18114
- unit.create.push(createTemplateOp(cView.xref, "Conditional", Namespace.HTML, true, void 0, ifCase.sourceSpan));
18115
18683
  const caseExpr = ifCase.expression ? convertAst(ifCase.expression, unit.job, null) : null;
18116
- const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, cView.xref, ifCase.expressionAlias);
18684
+ const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, tmplOp.xref, tmplOp.handle, ifCase.expressionAlias);
18117
18685
  conditions.push(conditionalCaseExpr);
18118
18686
  ingestNodes(cView, ifCase.children);
18119
18687
  }
18120
- const conditional2 = createConditionalOp(firstXref, null, conditions, ifBlock.sourceSpan);
18688
+ const conditional2 = createConditionalOp(firstXref, firstSlotHandle, null, conditions, ifBlock.sourceSpan);
18121
18689
  unit.update.push(conditional2);
18122
18690
  }
18123
18691
  function ingestSwitchBlock(unit, switchBlock) {
18124
18692
  let firstXref = null;
18693
+ let firstSlotHandle = null;
18125
18694
  let conditions = [];
18126
18695
  for (const switchCase of switchBlock.cases) {
18127
18696
  const cView = unit.job.allocateView(unit.xref);
18697
+ const tmplOp = createTemplateOp(cView.xref, null, "Case", Namespace.HTML, void 0, switchCase.sourceSpan);
18698
+ unit.create.push(tmplOp);
18128
18699
  if (firstXref === null) {
18129
18700
  firstXref = cView.xref;
18701
+ firstSlotHandle = tmplOp.handle;
18130
18702
  }
18131
- unit.create.push(createTemplateOp(cView.xref, "Case", Namespace.HTML, true, void 0, switchCase.sourceSpan));
18132
18703
  const caseExpr = switchCase.expression ? convertAst(switchCase.expression, unit.job, switchBlock.startSourceSpan) : null;
18133
- const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, cView.xref);
18704
+ const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, tmplOp.xref, tmplOp.handle);
18134
18705
  conditions.push(conditionalCaseExpr);
18135
18706
  ingestNodes(cView, switchCase.children);
18136
18707
  }
18137
- const conditional2 = createConditionalOp(firstXref, convertAst(switchBlock.expression, unit.job, null), conditions, switchBlock.sourceSpan);
18708
+ const conditional2 = createConditionalOp(firstXref, firstSlotHandle, convertAst(switchBlock.expression, unit.job, null), conditions, switchBlock.sourceSpan);
18138
18709
  unit.update.push(conditional2);
18139
18710
  }
18140
18711
  function ingestDeferView(unit, suffix, children, sourceSpan) {
@@ -18143,38 +18714,80 @@ function ingestDeferView(unit, suffix, children, sourceSpan) {
18143
18714
  }
18144
18715
  const secondaryView = unit.job.allocateView(unit.xref);
18145
18716
  ingestNodes(secondaryView, children);
18146
- const templateOp = createTemplateOp(secondaryView.xref, `Defer${suffix}`, Namespace.HTML, true, void 0, sourceSpan);
18717
+ const templateOp = createTemplateOp(secondaryView.xref, null, `Defer${suffix}`, Namespace.HTML, void 0, sourceSpan);
18147
18718
  unit.create.push(templateOp);
18148
18719
  return templateOp;
18149
18720
  }
18150
18721
  function ingestDeferBlock(unit, deferBlock) {
18151
- var _a2, _b2, _c2, _d2, _e2, _f2;
18722
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
18152
18723
  const main = ingestDeferView(unit, "", deferBlock.children, deferBlock.sourceSpan);
18153
18724
  const loading = ingestDeferView(unit, "Loading", (_a2 = deferBlock.loading) == null ? void 0 : _a2.children, (_b2 = deferBlock.loading) == null ? void 0 : _b2.sourceSpan);
18154
18725
  const placeholder = ingestDeferView(unit, "Placeholder", (_c2 = deferBlock.placeholder) == null ? void 0 : _c2.children, (_d2 = deferBlock.placeholder) == null ? void 0 : _d2.sourceSpan);
18155
18726
  const error2 = ingestDeferView(unit, "Error", (_e2 = deferBlock.error) == null ? void 0 : _e2.children, (_f2 = deferBlock.error) == null ? void 0 : _f2.sourceSpan);
18156
- const deferOp = createDeferOp(unit.job.allocateXrefId(), main.xref, deferBlock.sourceSpan);
18727
+ const deferXref = unit.job.allocateXrefId();
18728
+ const deferOp = createDeferOp(deferXref, main.xref, main.handle, deferBlock.sourceSpan);
18729
+ deferOp.placeholderView = (_g = placeholder == null ? void 0 : placeholder.xref) != null ? _g : null;
18730
+ deferOp.placeholderSlot = (_h = placeholder == null ? void 0 : placeholder.handle) != null ? _h : null;
18731
+ deferOp.loadingSlot = (_i = loading == null ? void 0 : loading.handle) != null ? _i : null;
18732
+ deferOp.errorSlot = (_j = error2 == null ? void 0 : error2.handle) != null ? _j : null;
18733
+ deferOp.placeholderMinimumTime = (_l = (_k = deferBlock.placeholder) == null ? void 0 : _k.minimumTime) != null ? _l : null;
18734
+ deferOp.loadingMinimumTime = (_n = (_m = deferBlock.loading) == null ? void 0 : _m.minimumTime) != null ? _n : null;
18735
+ deferOp.loadingAfterTime = (_p = (_o = deferBlock.loading) == null ? void 0 : _o.afterTime) != null ? _p : null;
18157
18736
  unit.create.push(deferOp);
18158
- if (loading && deferBlock.loading) {
18159
- deferOp.loading = createDeferSecondaryOp(deferOp.xref, loading.xref, DeferSecondaryKind.Loading);
18160
- if (deferBlock.loading.afterTime !== null || deferBlock.loading.minimumTime !== null) {
18161
- deferOp.loading.constValue = [deferBlock.loading.minimumTime, deferBlock.loading.afterTime];
18162
- }
18163
- unit.create.push(deferOp.loading);
18164
- }
18165
- if (placeholder && deferBlock.placeholder) {
18166
- deferOp.placeholder = createDeferSecondaryOp(deferOp.xref, placeholder.xref, DeferSecondaryKind.Placeholder);
18167
- if (deferBlock.placeholder.minimumTime !== null) {
18168
- deferOp.placeholder.constValue = [deferBlock.placeholder.minimumTime];
18169
- }
18170
- unit.create.push(deferOp.placeholder);
18171
- }
18172
- if (error2 && deferBlock.error) {
18173
- deferOp.error = createDeferSecondaryOp(deferOp.xref, error2.xref, DeferSecondaryKind.Error);
18174
- unit.create.push(deferOp.error);
18175
- }
18176
- const deferOnOp = createDeferOnOp(unit.job.allocateXrefId(), null);
18177
- unit.create.push(deferOnOp);
18737
+ let prefetch = false;
18738
+ let deferOnOps = [];
18739
+ for (const triggers of [deferBlock.triggers, deferBlock.prefetchTriggers]) {
18740
+ if (triggers.idle !== void 0) {
18741
+ const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Idle }, prefetch, null);
18742
+ deferOnOps.push(deferOnOp);
18743
+ }
18744
+ if (triggers.immediate !== void 0) {
18745
+ const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Immediate }, prefetch, null);
18746
+ deferOnOps.push(deferOnOp);
18747
+ }
18748
+ if (triggers.timer !== void 0) {
18749
+ const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Timer, delay: triggers.timer.delay }, prefetch, null);
18750
+ deferOnOps.push(deferOnOp);
18751
+ }
18752
+ if (triggers.hover !== void 0) {
18753
+ const deferOnOp = createDeferOnOp(deferXref, {
18754
+ kind: DeferTriggerKind.Hover,
18755
+ targetName: triggers.hover.reference,
18756
+ targetXref: null,
18757
+ targetSlot: null,
18758
+ targetView: null,
18759
+ targetSlotViewSteps: null
18760
+ }, prefetch, null);
18761
+ deferOnOps.push(deferOnOp);
18762
+ }
18763
+ if (triggers.interaction !== void 0) {
18764
+ const deferOnOp = createDeferOnOp(deferXref, {
18765
+ kind: DeferTriggerKind.Interaction,
18766
+ targetName: triggers.interaction.reference,
18767
+ targetXref: null,
18768
+ targetSlot: null,
18769
+ targetView: null,
18770
+ targetSlotViewSteps: null
18771
+ }, prefetch, null);
18772
+ deferOnOps.push(deferOnOp);
18773
+ }
18774
+ if (triggers.viewport !== void 0) {
18775
+ const deferOnOp = createDeferOnOp(deferXref, {
18776
+ kind: DeferTriggerKind.Viewport,
18777
+ targetName: triggers.viewport.reference,
18778
+ targetXref: null,
18779
+ targetSlot: null,
18780
+ targetView: null,
18781
+ targetSlotViewSteps: null
18782
+ }, prefetch, null);
18783
+ deferOnOps.push(deferOnOp);
18784
+ }
18785
+ if (deferOnOps.length === 0) {
18786
+ deferOnOps.push(createDeferOnOp(deferXref, { kind: DeferTriggerKind.Idle }, false, null));
18787
+ }
18788
+ prefetch = true;
18789
+ }
18790
+ unit.create.push(deferOnOps);
18178
18791
  }
18179
18792
  function ingestIcu(unit, icu) {
18180
18793
  var _a2;
@@ -18186,6 +18799,48 @@ function ingestIcu(unit, icu) {
18186
18799
  throw Error(`Unhandled i18n metadata type for ICU: ${(_a2 = icu.i18n) == null ? void 0 : _a2.constructor.name}`);
18187
18800
  }
18188
18801
  }
18802
+ function ingestForBlock(unit, forBlock) {
18803
+ var _a2;
18804
+ const repeaterView = unit.job.allocateView(unit.xref);
18805
+ const createRepeaterAlias = (ident, repeaterVar) => {
18806
+ repeaterView.aliases.add({
18807
+ kind: SemanticVariableKind.Alias,
18808
+ name: null,
18809
+ identifier: ident,
18810
+ expression: new DerivedRepeaterVarExpr(repeaterView.xref, repeaterVar)
18811
+ });
18812
+ };
18813
+ repeaterView.contextVariables.set(forBlock.item.name, forBlock.item.value);
18814
+ repeaterView.contextVariables.set(forBlock.contextVariables.$index.name, forBlock.contextVariables.$index.value);
18815
+ repeaterView.contextVariables.set(forBlock.contextVariables.$count.name, forBlock.contextVariables.$count.value);
18816
+ createRepeaterAlias(forBlock.contextVariables.$first.name, DerivedRepeaterVarIdentity.First);
18817
+ createRepeaterAlias(forBlock.contextVariables.$last.name, DerivedRepeaterVarIdentity.Last);
18818
+ createRepeaterAlias(forBlock.contextVariables.$even.name, DerivedRepeaterVarIdentity.Even);
18819
+ createRepeaterAlias(forBlock.contextVariables.$odd.name, DerivedRepeaterVarIdentity.Odd);
18820
+ const sourceSpan = convertSourceSpan(forBlock.trackBy.span, forBlock.sourceSpan);
18821
+ const track = convertAst(forBlock.trackBy, unit.job, sourceSpan);
18822
+ ingestNodes(repeaterView, forBlock.children);
18823
+ let emptyView = null;
18824
+ if (forBlock.empty !== null) {
18825
+ emptyView = unit.job.allocateView(unit.xref);
18826
+ ingestNodes(emptyView, forBlock.empty.children);
18827
+ }
18828
+ const varNames = {
18829
+ $index: forBlock.contextVariables.$index.name,
18830
+ $count: forBlock.contextVariables.$count.name,
18831
+ $first: forBlock.contextVariables.$first.name,
18832
+ $last: forBlock.contextVariables.$last.name,
18833
+ $even: forBlock.contextVariables.$even.name,
18834
+ $odd: forBlock.contextVariables.$odd.name,
18835
+ $implicit: forBlock.item.name
18836
+ };
18837
+ const tagName = ingestControlFlowInsertionPoint(unit, repeaterView.xref, forBlock);
18838
+ const repeaterCreate2 = createRepeaterCreateOp(repeaterView.xref, (_a2 = emptyView == null ? void 0 : emptyView.xref) != null ? _a2 : null, tagName, track, varNames, forBlock.sourceSpan);
18839
+ unit.create.push(repeaterCreate2);
18840
+ const expression = convertAst(forBlock.expression, unit.job, convertSourceSpan(forBlock.expression.span, forBlock.sourceSpan));
18841
+ const repeater2 = createRepeaterOp(repeaterCreate2.xref, repeaterCreate2.handle, expression, forBlock.sourceSpan);
18842
+ unit.update.push(repeater2);
18843
+ }
18189
18844
  function convertAst(ast, job, baseSourceSpan) {
18190
18845
  if (ast instanceof ASTWithSource) {
18191
18846
  return convertAst(ast.ast, job, baseSourceSpan);
@@ -18232,7 +18887,7 @@ function convertAst(ast, job, baseSourceSpan) {
18232
18887
  } else if (ast instanceof NonNullAssert) {
18233
18888
  return convertAst(ast.expression, job, baseSourceSpan);
18234
18889
  } else if (ast instanceof BindingPipe) {
18235
- return new PipeBindingExpr(job.allocateXrefId(), ast.name, [
18890
+ return new PipeBindingExpr(job.allocateXrefId(), new SlotHandle(), ast.name, [
18236
18891
  convertAst(ast.exp, job, baseSourceSpan),
18237
18892
  ...ast.args.map((arg) => convertAst(arg, job, baseSourceSpan))
18238
18893
  ]);
@@ -18285,7 +18940,7 @@ function ingestBindings(unit, op, element2) {
18285
18940
  unit.create.push(createExtractedAttributeOp(op.xref, BindingKind.Property, output.name, null));
18286
18941
  continue;
18287
18942
  }
18288
- listenerOp = createListenerOp(op.xref, output.name, op.tag, output.phase, false, output.sourceSpan);
18943
+ listenerOp = createListenerOp(op.xref, op.handle, output.name, op.tag, output.phase, false, output.sourceSpan);
18289
18944
  let handlerExprs;
18290
18945
  let handler = output.handler;
18291
18946
  if (handler instanceof ASTWithSource) {
@@ -18366,6 +19021,27 @@ function convertSourceSpan(span, baseSourceSpan) {
18366
19021
  const fullStart = baseSourceSpan.fullStart.moveBy(span.start);
18367
19022
  return new ParseSourceSpan(start, end, fullStart);
18368
19023
  }
19024
+ function ingestControlFlowInsertionPoint(unit, xref, node) {
19025
+ let root = null;
19026
+ for (const child of node.children) {
19027
+ if (child instanceof Comment) {
19028
+ continue;
19029
+ }
19030
+ if (root !== null) {
19031
+ return null;
19032
+ }
19033
+ if (child instanceof Element || child instanceof Template && child.tagName !== null) {
19034
+ root = child;
19035
+ }
19036
+ }
19037
+ if (root !== null) {
19038
+ for (const attr of root.attributes) {
19039
+ ingestBinding(unit, xref, attr.name, literal(attr.value), 1, null, SecurityContext.NONE, attr.sourceSpan, BindingFlags.TextValue);
19040
+ }
19041
+ return root instanceof Element ? root.name : root.tagName;
19042
+ }
19043
+ return null;
19044
+ }
18369
19045
 
18370
19046
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/switch/index.mjs
18371
19047
  var USE_TEMPLATE_PIPELINE = false;
@@ -18755,7 +19431,7 @@ var WhitespaceVisitor = class {
18755
19431
  return expansionCase;
18756
19432
  }
18757
19433
  visitBlock(block, context) {
18758
- return new Block(block.name, block.parameters, visitAllWithSiblings(this, block.children), block.sourceSpan, block.startSourceSpan, block.endSourceSpan);
19434
+ return new Block(block.name, block.parameters, visitAllWithSiblings(this, block.children), block.sourceSpan, block.nameSpan, block.startSourceSpan, block.endSourceSpan);
18759
19435
  }
18760
19436
  visitBlockParameter(parameter, context) {
18761
19437
  return parameter;
@@ -19179,7 +19855,7 @@ function normalizeNgContentSelect(selectAttr) {
19179
19855
  }
19180
19856
 
19181
19857
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/r3_control_flow.mjs
19182
- var FOR_LOOP_EXPRESSION_PATTERN = /^\s*([0-9A-Za-z_$]*)\s+of\s+(.*)/;
19858
+ var FOR_LOOP_EXPRESSION_PATTERN = /^\s*([0-9A-Za-z_$]*)\s+of\s+([\S\s]*)/;
19183
19859
  var FOR_LOOP_TRACK_PATTERN = /^track\s+([\S\s]*)/;
19184
19860
  var CONDITIONAL_ALIAS_PATTERN = /^as\s+(.*)/;
19185
19861
  var ELSE_IF_PATTERN = /^else[^\S\r\n]+if/;
@@ -19196,18 +19872,18 @@ function createIfBlock(ast, connectedBlocks, visitor, bindingParser) {
19196
19872
  const branches = [];
19197
19873
  const mainBlockParams = parseConditionalBlockParameters(ast, errors, bindingParser);
19198
19874
  if (mainBlockParams !== null) {
19199
- branches.push(new IfBlockBranch(mainBlockParams.expression, visitAll2(visitor, ast.children, ast.children), mainBlockParams.expressionAlias, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan));
19875
+ branches.push(new IfBlockBranch(mainBlockParams.expression, visitAll2(visitor, ast.children, ast.children), mainBlockParams.expressionAlias, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.nameSpan));
19200
19876
  }
19201
19877
  for (const block of connectedBlocks) {
19202
19878
  if (ELSE_IF_PATTERN.test(block.name)) {
19203
19879
  const params = parseConditionalBlockParameters(block, errors, bindingParser);
19204
19880
  if (params !== null) {
19205
19881
  const children = visitAll2(visitor, block.children, block.children);
19206
- branches.push(new IfBlockBranch(params.expression, children, params.expressionAlias, block.sourceSpan, block.startSourceSpan, block.endSourceSpan));
19882
+ branches.push(new IfBlockBranch(params.expression, children, params.expressionAlias, block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan));
19207
19883
  }
19208
19884
  } else if (block.name === "else") {
19209
19885
  const children = visitAll2(visitor, block.children, block.children);
19210
- branches.push(new IfBlockBranch(null, children, null, block.sourceSpan, block.startSourceSpan, block.endSourceSpan));
19886
+ branches.push(new IfBlockBranch(null, children, null, block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan));
19211
19887
  }
19212
19888
  }
19213
19889
  const ifBlockStartSourceSpan = branches.length > 0 ? branches[0].startSourceSpan : ast.startSourceSpan;
@@ -19218,7 +19894,7 @@ function createIfBlock(ast, connectedBlocks, visitor, bindingParser) {
19218
19894
  wholeSourceSpan = new ParseSourceSpan(ifBlockStartSourceSpan.start, lastBranch.sourceSpan.end);
19219
19895
  }
19220
19896
  return {
19221
- node: new IfBlock(branches, wholeSourceSpan, ast.startSourceSpan, ifBlockEndSourceSpan),
19897
+ node: new IfBlock(branches, wholeSourceSpan, ast.startSourceSpan, ifBlockEndSourceSpan, ast.nameSpan),
19222
19898
  errors
19223
19899
  };
19224
19900
  }
@@ -19235,7 +19911,7 @@ function createForLoop(ast, connectedBlocks, visitor, bindingParser) {
19235
19911
  } else if (block.parameters.length > 0) {
19236
19912
  errors.push(new ParseError(block.sourceSpan, "@empty block cannot have parameters"));
19237
19913
  } else {
19238
- empty = new ForLoopBlockEmpty(visitAll2(visitor, block.children, block.children), block.sourceSpan, block.startSourceSpan, block.endSourceSpan);
19914
+ empty = new ForLoopBlockEmpty(visitAll2(visitor, block.children, block.children), block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan);
19239
19915
  }
19240
19916
  } else {
19241
19917
  errors.push(new ParseError(block.sourceSpan, `Unrecognized @for loop block "${block.name}"`));
@@ -19247,7 +19923,7 @@ function createForLoop(ast, connectedBlocks, visitor, bindingParser) {
19247
19923
  } else {
19248
19924
  const endSpan = (_a2 = empty == null ? void 0 : empty.endSourceSpan) != null ? _a2 : ast.endSourceSpan;
19249
19925
  const sourceSpan = new ParseSourceSpan(ast.sourceSpan.start, (_b2 = endSpan == null ? void 0 : endSpan.end) != null ? _b2 : ast.sourceSpan.end);
19250
- node = new ForLoopBlock(params.itemName, params.expression, params.trackBy, params.context, visitAll2(visitor, ast.children, ast.children), empty, sourceSpan, ast.sourceSpan, ast.startSourceSpan, endSpan);
19926
+ node = new ForLoopBlock(params.itemName, params.expression, params.trackBy.expression, params.trackBy.keywordSpan, params.context, visitAll2(visitor, ast.children, ast.children), empty, sourceSpan, ast.sourceSpan, ast.startSourceSpan, endSpan, ast.nameSpan);
19251
19927
  }
19252
19928
  }
19253
19929
  return { node, errors };
@@ -19263,11 +19939,11 @@ function createSwitchBlock(ast, visitor, bindingParser) {
19263
19939
  continue;
19264
19940
  }
19265
19941
  if ((node.name !== "case" || node.parameters.length === 0) && node.name !== "default") {
19266
- unknownBlocks.push(new UnknownBlock(node.name, node.sourceSpan));
19942
+ unknownBlocks.push(new UnknownBlock(node.name, node.sourceSpan, node.nameSpan));
19267
19943
  continue;
19268
19944
  }
19269
19945
  const expression = node.name === "case" ? parseBlockParameterToBinding(node.parameters[0], bindingParser) : null;
19270
- const ast2 = new SwitchBlockCase(expression, visitAll2(visitor, node.children, node.children), node.sourceSpan, node.startSourceSpan, node.endSourceSpan);
19946
+ const ast2 = new SwitchBlockCase(expression, visitAll2(visitor, node.children, node.children), node.sourceSpan, node.startSourceSpan, node.endSourceSpan, node.nameSpan);
19271
19947
  if (expression === null) {
19272
19948
  defaultCase = ast2;
19273
19949
  } else {
@@ -19278,7 +19954,7 @@ function createSwitchBlock(ast, visitor, bindingParser) {
19278
19954
  cases.push(defaultCase);
19279
19955
  }
19280
19956
  return {
19281
- node: new SwitchBlock(primaryExpression, cases, unknownBlocks, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan),
19957
+ node: new SwitchBlock(primaryExpression, cases, unknownBlocks, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.nameSpan),
19282
19958
  errors
19283
19959
  };
19284
19960
  }
@@ -19312,7 +19988,9 @@ function parseForLoopParameters(block, errors, bindingParser) {
19312
19988
  if (result.trackBy !== null) {
19313
19989
  errors.push(new ParseError(param.sourceSpan, '@for loop can only have one "track" expression'));
19314
19990
  } else {
19315
- result.trackBy = parseBlockParameterToBinding(param, bindingParser, trackMatch[1]);
19991
+ const expression = parseBlockParameterToBinding(param, bindingParser, trackMatch[1]);
19992
+ const keywordSpan = new ParseSourceSpan(param.sourceSpan.start, param.sourceSpan.start.moveBy("track".length));
19993
+ result.trackBy = { expression, keywordSpan };
19316
19994
  }
19317
19995
  continue;
19318
19996
  }
@@ -19371,7 +20049,7 @@ function validateSwitchBlock(ast) {
19371
20049
  return errors;
19372
20050
  }
19373
20051
  for (const node of ast.children) {
19374
- if (node instanceof Text4 && node.value.trim().length === 0) {
20052
+ if (node instanceof Comment2 || node instanceof Text4 && node.value.trim().length === 0) {
19375
20053
  continue;
19376
20054
  }
19377
20055
  if (!(node instanceof Block) || node.name !== "case" && node.name !== "default") {
@@ -19468,7 +20146,7 @@ function stripOptionalParentheses(param, errors) {
19468
20146
  }
19469
20147
 
19470
20148
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/r3_deferred_triggers.mjs
19471
- var TIME_PATTERN = /^\d+(ms|s)?$/;
20149
+ var TIME_PATTERN = /^\d+\.?\d*(ms|s)?$/;
19472
20150
  var SEPARATOR_PATTERN = /^\s$/;
19473
20151
  var COMMA_DELIMITED_SYNTAX = /* @__PURE__ */ new Map([
19474
20152
  [$LBRACE, $RBRACE],
@@ -19486,32 +20164,44 @@ var OnTriggerType;
19486
20164
  })(OnTriggerType || (OnTriggerType = {}));
19487
20165
  function parseWhenTrigger({ expression, sourceSpan }, bindingParser, triggers, errors) {
19488
20166
  const whenIndex = expression.indexOf("when");
20167
+ const whenSourceSpan = new ParseSourceSpan(sourceSpan.start.moveBy(whenIndex), sourceSpan.start.moveBy(whenIndex + "when".length));
20168
+ const prefetchSpan = getPrefetchSpan(expression, sourceSpan);
19489
20169
  if (whenIndex === -1) {
19490
20170
  errors.push(new ParseError(sourceSpan, `Could not find "when" keyword in expression`));
19491
20171
  } else {
19492
20172
  const start = getTriggerParametersStart(expression, whenIndex + 1);
19493
20173
  const parsed = bindingParser.parseBinding(expression.slice(start), false, sourceSpan, sourceSpan.start.offset + start);
19494
- trackTrigger("when", triggers, errors, new BoundDeferredTrigger(parsed, sourceSpan));
20174
+ trackTrigger("when", triggers, errors, new BoundDeferredTrigger(parsed, sourceSpan, prefetchSpan, whenSourceSpan));
19495
20175
  }
19496
20176
  }
19497
20177
  function parseOnTrigger({ expression, sourceSpan }, triggers, errors, placeholder) {
19498
20178
  const onIndex = expression.indexOf("on");
20179
+ const onSourceSpan = new ParseSourceSpan(sourceSpan.start.moveBy(onIndex), sourceSpan.start.moveBy(onIndex + "on".length));
20180
+ const prefetchSpan = getPrefetchSpan(expression, sourceSpan);
19499
20181
  if (onIndex === -1) {
19500
20182
  errors.push(new ParseError(sourceSpan, `Could not find "on" keyword in expression`));
19501
20183
  } else {
19502
20184
  const start = getTriggerParametersStart(expression, onIndex + 1);
19503
- const parser = new OnTriggerParser(expression, start, sourceSpan, triggers, errors, placeholder);
20185
+ const parser = new OnTriggerParser(expression, start, sourceSpan, triggers, errors, placeholder, prefetchSpan, onSourceSpan);
19504
20186
  parser.parse();
19505
20187
  }
19506
20188
  }
20189
+ function getPrefetchSpan(expression, sourceSpan) {
20190
+ if (!expression.startsWith("prefetch")) {
20191
+ return null;
20192
+ }
20193
+ return new ParseSourceSpan(sourceSpan.start, sourceSpan.start.moveBy("prefetch".length));
20194
+ }
19507
20195
  var OnTriggerParser = class {
19508
- constructor(expression, start, span, triggers, errors, placeholder) {
20196
+ constructor(expression, start, span, triggers, errors, placeholder, prefetchSpan, onSourceSpan) {
19509
20197
  this.expression = expression;
19510
20198
  this.start = start;
19511
20199
  this.span = span;
19512
20200
  this.triggers = triggers;
19513
20201
  this.errors = errors;
19514
20202
  this.placeholder = placeholder;
20203
+ this.prefetchSpan = prefetchSpan;
20204
+ this.onSourceSpan = onSourceSpan;
19515
20205
  this.index = 0;
19516
20206
  this.tokens = new Lexer().tokenize(expression.slice(start));
19517
20207
  }
@@ -19553,28 +20243,32 @@ var OnTriggerParser = class {
19553
20243
  return this.tokens[Math.min(this.index, this.tokens.length - 1)];
19554
20244
  }
19555
20245
  consumeTrigger(identifier, parameters) {
19556
- const startSpan = this.span.start.moveBy(this.start + identifier.index - this.tokens[0].index);
19557
- const endSpan = startSpan.moveBy(this.token().end - identifier.index);
19558
- const sourceSpan = new ParseSourceSpan(startSpan, endSpan);
20246
+ const triggerNameStartSpan = this.span.start.moveBy(this.start + identifier.index - this.tokens[0].index);
20247
+ const nameSpan = new ParseSourceSpan(triggerNameStartSpan, triggerNameStartSpan.moveBy(identifier.strValue.length));
20248
+ const endSpan = triggerNameStartSpan.moveBy(this.token().end - identifier.index);
20249
+ const isFirstTrigger = identifier.index === 0;
20250
+ const onSourceSpan = isFirstTrigger ? this.onSourceSpan : null;
20251
+ const prefetchSourceSpan = isFirstTrigger ? this.prefetchSpan : null;
20252
+ const sourceSpan = new ParseSourceSpan(isFirstTrigger ? this.span.start : triggerNameStartSpan, endSpan);
19559
20253
  try {
19560
20254
  switch (identifier.toString()) {
19561
20255
  case OnTriggerType.IDLE:
19562
- this.trackTrigger("idle", createIdleTrigger(parameters, sourceSpan));
20256
+ this.trackTrigger("idle", createIdleTrigger(parameters, nameSpan, sourceSpan, prefetchSourceSpan, onSourceSpan));
19563
20257
  break;
19564
20258
  case OnTriggerType.TIMER:
19565
- this.trackTrigger("timer", createTimerTrigger(parameters, sourceSpan));
20259
+ this.trackTrigger("timer", createTimerTrigger(parameters, nameSpan, sourceSpan, this.prefetchSpan, this.onSourceSpan));
19566
20260
  break;
19567
20261
  case OnTriggerType.INTERACTION:
19568
- this.trackTrigger("interaction", createInteractionTrigger(parameters, sourceSpan, this.placeholder));
20262
+ this.trackTrigger("interaction", createInteractionTrigger(parameters, nameSpan, sourceSpan, this.prefetchSpan, this.onSourceSpan, this.placeholder));
19569
20263
  break;
19570
20264
  case OnTriggerType.IMMEDIATE:
19571
- this.trackTrigger("immediate", createImmediateTrigger(parameters, sourceSpan));
20265
+ this.trackTrigger("immediate", createImmediateTrigger(parameters, nameSpan, sourceSpan, this.prefetchSpan, this.onSourceSpan));
19572
20266
  break;
19573
20267
  case OnTriggerType.HOVER:
19574
- this.trackTrigger("hover", createHoverTrigger(parameters, sourceSpan, this.placeholder));
20268
+ this.trackTrigger("hover", createHoverTrigger(parameters, nameSpan, sourceSpan, this.prefetchSpan, this.onSourceSpan, this.placeholder));
19575
20269
  break;
19576
20270
  case OnTriggerType.VIEWPORT:
19577
- this.trackTrigger("viewport", createViewportTrigger(parameters, sourceSpan, this.placeholder));
20271
+ this.trackTrigger("viewport", createViewportTrigger(parameters, nameSpan, sourceSpan, this.prefetchSpan, this.onSourceSpan, this.placeholder));
19578
20272
  break;
19579
20273
  default:
19580
20274
  throw new Error(`Unrecognized trigger type "${identifier}"`);
@@ -19645,13 +20339,13 @@ function trackTrigger(name, allTriggers, errors, trigger) {
19645
20339
  allTriggers[name] = trigger;
19646
20340
  }
19647
20341
  }
19648
- function createIdleTrigger(parameters, sourceSpan) {
20342
+ function createIdleTrigger(parameters, nameSpan, sourceSpan, prefetchSpan, onSourceSpan) {
19649
20343
  if (parameters.length > 0) {
19650
20344
  throw new Error(`"${OnTriggerType.IDLE}" trigger cannot have parameters`);
19651
20345
  }
19652
- return new IdleDeferredTrigger(sourceSpan);
20346
+ return new IdleDeferredTrigger(nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
19653
20347
  }
19654
- function createTimerTrigger(parameters, sourceSpan) {
20348
+ function createTimerTrigger(parameters, nameSpan, sourceSpan, prefetchSpan, onSourceSpan) {
19655
20349
  if (parameters.length !== 1) {
19656
20350
  throw new Error(`"${OnTriggerType.TIMER}" trigger must have exactly one parameter`);
19657
20351
  }
@@ -19659,28 +20353,28 @@ function createTimerTrigger(parameters, sourceSpan) {
19659
20353
  if (delay === null) {
19660
20354
  throw new Error(`Could not parse time value of trigger "${OnTriggerType.TIMER}"`);
19661
20355
  }
19662
- return new TimerDeferredTrigger(delay, sourceSpan);
20356
+ return new TimerDeferredTrigger(delay, nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
19663
20357
  }
19664
- function createImmediateTrigger(parameters, sourceSpan) {
20358
+ function createImmediateTrigger(parameters, nameSpan, sourceSpan, prefetchSpan, onSourceSpan) {
19665
20359
  if (parameters.length > 0) {
19666
20360
  throw new Error(`"${OnTriggerType.IMMEDIATE}" trigger cannot have parameters`);
19667
20361
  }
19668
- return new ImmediateDeferredTrigger(sourceSpan);
20362
+ return new ImmediateDeferredTrigger(nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
19669
20363
  }
19670
- function createHoverTrigger(parameters, sourceSpan, placeholder) {
20364
+ function createHoverTrigger(parameters, nameSpan, sourceSpan, prefetchSpan, onSourceSpan, placeholder) {
19671
20365
  var _a2;
19672
20366
  validateReferenceBasedTrigger(OnTriggerType.HOVER, parameters, placeholder);
19673
- return new HoverDeferredTrigger((_a2 = parameters[0]) != null ? _a2 : null, sourceSpan);
20367
+ return new HoverDeferredTrigger((_a2 = parameters[0]) != null ? _a2 : null, nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
19674
20368
  }
19675
- function createInteractionTrigger(parameters, sourceSpan, placeholder) {
20369
+ function createInteractionTrigger(parameters, nameSpan, sourceSpan, prefetchSpan, onSourceSpan, placeholder) {
19676
20370
  var _a2;
19677
20371
  validateReferenceBasedTrigger(OnTriggerType.INTERACTION, parameters, placeholder);
19678
- return new InteractionDeferredTrigger((_a2 = parameters[0]) != null ? _a2 : null, sourceSpan);
20372
+ return new InteractionDeferredTrigger((_a2 = parameters[0]) != null ? _a2 : null, nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
19679
20373
  }
19680
- function createViewportTrigger(parameters, sourceSpan, placeholder) {
20374
+ function createViewportTrigger(parameters, nameSpan, sourceSpan, prefetchSpan, onSourceSpan, placeholder) {
19681
20375
  var _a2;
19682
20376
  validateReferenceBasedTrigger(OnTriggerType.VIEWPORT, parameters, placeholder);
19683
- return new ViewportDeferredTrigger((_a2 = parameters[0]) != null ? _a2 : null, sourceSpan);
20377
+ return new ViewportDeferredTrigger((_a2 = parameters[0]) != null ? _a2 : null, nameSpan, sourceSpan, prefetchSpan, onSourceSpan);
19684
20378
  }
19685
20379
  function validateReferenceBasedTrigger(type, parameters, placeholder) {
19686
20380
  if (parameters.length > 1) {
@@ -19712,7 +20406,7 @@ function parseDeferredTime(value) {
19712
20406
  return null;
19713
20407
  }
19714
20408
  const [time, units] = match;
19715
- return parseInt(time) * (units === "s" ? 1e3 : 1);
20409
+ return parseFloat(time) * (units === "s" ? 1e3 : 1);
19716
20410
  }
19717
20411
 
19718
20412
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/r3_deferred_blocks.mjs
@@ -19736,8 +20430,8 @@ function createDeferredBlock(ast, connectedBlocks, visitor, bindingParser) {
19736
20430
  lastEndSourceSpan = lastConnectedBlock.endSourceSpan;
19737
20431
  endOfLastSourceSpan = lastConnectedBlock.sourceSpan.end;
19738
20432
  }
19739
- const mainDeferredSourceSpan = new ParseSourceSpan(ast.sourceSpan.start, endOfLastSourceSpan);
19740
- const node = new DeferredBlock(visitAll2(visitor, ast.children, ast.children), triggers, prefetchTriggers, placeholder, loading, error2, mainDeferredSourceSpan, ast.sourceSpan, ast.startSourceSpan, lastEndSourceSpan);
20433
+ const sourceSpanWithConnectedBlocks = new ParseSourceSpan(ast.sourceSpan.start, endOfLastSourceSpan);
20434
+ const node = new DeferredBlock(visitAll2(visitor, ast.children, ast.children), triggers, prefetchTriggers, placeholder, loading, error2, ast.nameSpan, sourceSpanWithConnectedBlocks, ast.sourceSpan, ast.startSourceSpan, lastEndSourceSpan);
19741
20435
  return { node, errors };
19742
20436
  }
19743
20437
  function parseConnectedBlocks(connectedBlocks, errors, visitor) {
@@ -19795,7 +20489,7 @@ function parsePlaceholderBlock(ast, visitor) {
19795
20489
  throw new Error(`Unrecognized parameter in @placeholder block: "${param.expression}"`);
19796
20490
  }
19797
20491
  }
19798
- return new DeferredBlockPlaceholder(visitAll2(visitor, ast.children, ast.children), minimumTime, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
20492
+ return new DeferredBlockPlaceholder(visitAll2(visitor, ast.children, ast.children), minimumTime, ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
19799
20493
  }
19800
20494
  function parseLoadingBlock(ast, visitor) {
19801
20495
  let afterTime = null;
@@ -19823,13 +20517,13 @@ function parseLoadingBlock(ast, visitor) {
19823
20517
  throw new Error(`Unrecognized parameter in @loading block: "${param.expression}"`);
19824
20518
  }
19825
20519
  }
19826
- return new DeferredBlockLoading(visitAll2(visitor, ast.children, ast.children), afterTime, minimumTime, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
20520
+ return new DeferredBlockLoading(visitAll2(visitor, ast.children, ast.children), afterTime, minimumTime, ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
19827
20521
  }
19828
20522
  function parseErrorBlock(ast, visitor) {
19829
20523
  if (ast.parameters.length > 0) {
19830
20524
  throw new Error(`@error block cannot have parameters`);
19831
20525
  }
19832
- return new DeferredBlockError(visitAll2(visitor, ast.children, ast.children), ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
20526
+ return new DeferredBlockError(visitAll2(visitor, ast.children, ast.children), ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
19833
20527
  }
19834
20528
  function parsePrimaryTriggers(params, bindingParser, errors, placeholder) {
19835
20529
  const triggers = {};
@@ -20068,7 +20762,7 @@ var HtmlAstToIvyAst = class {
20068
20762
  errorMessage = `Unrecognized block @${block.name}.`;
20069
20763
  }
20070
20764
  result = {
20071
- node: new UnknownBlock(block.name, block.sourceSpan),
20765
+ node: new UnknownBlock(block.name, block.sourceSpan, block.nameSpan),
20072
20766
  errors: [new ParseError(block.sourceSpan, errorMessage)]
20073
20767
  };
20074
20768
  break;
@@ -20420,6 +21114,7 @@ function serializePlaceholderValue(value) {
20420
21114
  var NG_CONTENT_SELECT_ATTR2 = "select";
20421
21115
  var NG_PROJECT_AS_ATTR_NAME = "ngProjectAs";
20422
21116
  var EVENT_BINDING_SCOPE_GLOBALS = /* @__PURE__ */ new Set(["$event"]);
21117
+ var NG_TEMPLATE_TAG_NAME = "ng-template";
20423
21118
  var GLOBAL_TARGET_RESOLVERS = /* @__PURE__ */ new Map([["window", Identifiers.resolveWindow], ["document", Identifiers.resolveDocument], ["body", Identifiers.resolveBody]]);
20424
21119
  var LEADING_TRIVIA_CHARS = [" ", "\n", "\r", " "];
20425
21120
  function renderFlagCheckIfStmt(flags, statements) {
@@ -20998,7 +21693,6 @@ var TemplateDefinitionBuilder = class {
20998
21693
  var _a2;
20999
21694
  const tagNameWithoutNamespace = template2.tagName ? splitNsName(template2.tagName)[1] : template2.tagName;
21000
21695
  const contextNameSuffix = template2.tagName ? "_" + sanitizeIdentifier(template2.tagName) : "";
21001
- const NG_TEMPLATE_TAG_NAME = "ng-template";
21002
21696
  const attrsExprs = this.getAttributeExpressions(NG_TEMPLATE_TAG_NAME, template2.attributes, template2.inputs, template2.outputs, void 0, template2.templateAttrs);
21003
21697
  const templateIndex = this.createEmbeddedTemplateFn(tagNameWithoutNamespace, template2.children, contextNameSuffix, template2.sourceSpan, template2.variables, attrsExprs, template2.references, template2.i18n);
21004
21698
  this.templatePropertyBindings(templateIndex, template2.templateAttrs);
@@ -21068,11 +21762,19 @@ var TemplateDefinitionBuilder = class {
21068
21762
  }
21069
21763
  visitIfBlock(block) {
21070
21764
  this.allocateBindingSlots(null);
21071
- const branchData = block.branches.map(({ expression, expressionAlias, children, sourceSpan }) => {
21765
+ const branchData = block.branches.map((branch, branchIndex) => {
21766
+ const { expression, expressionAlias, children, sourceSpan } = branch;
21072
21767
  const variables = expressionAlias !== null ? [new Variable(expressionAlias.name, DIRECT_CONTEXT_REFERENCE, expressionAlias.sourceSpan, expressionAlias.keySpan)] : void 0;
21073
- const index = this.createEmbeddedTemplateFn(null, children, "_Conditional", sourceSpan, variables);
21768
+ let tagName = null;
21769
+ let attrsExprs;
21770
+ if (branchIndex === 0) {
21771
+ const inferredData = this.inferProjectionDataFromInsertionPoint(branch);
21772
+ tagName = inferredData.tagName;
21773
+ attrsExprs = inferredData.attrsExprs;
21774
+ }
21775
+ const templateIndex = this.createEmbeddedTemplateFn(tagName, children, "_Conditional", sourceSpan, variables, attrsExprs);
21074
21776
  const processedExpression = expression === null ? null : expression.visit(this._valueConverter);
21075
- return { index, expression: processedExpression, alias: expressionAlias };
21777
+ return { index: templateIndex, expression: processedExpression, alias: expressionAlias };
21076
21778
  });
21077
21779
  const containerIndex = branchData[0].index;
21078
21780
  const paramsCallback = () => {
@@ -21217,11 +21919,34 @@ var TemplateDefinitionBuilder = class {
21217
21919
  return params;
21218
21920
  });
21219
21921
  }
21922
+ inferProjectionDataFromInsertionPoint(node) {
21923
+ let root = null;
21924
+ let tagName = null;
21925
+ let attrsExprs;
21926
+ for (const child of node.children) {
21927
+ if (child instanceof Comment) {
21928
+ continue;
21929
+ }
21930
+ if (root !== null) {
21931
+ root = null;
21932
+ break;
21933
+ }
21934
+ if (child instanceof Element || child instanceof Template && child.tagName !== null) {
21935
+ root = child;
21936
+ }
21937
+ }
21938
+ if (root !== null) {
21939
+ tagName = root instanceof Element ? root.name : root.tagName;
21940
+ attrsExprs = this.getAttributeExpressions(NG_TEMPLATE_TAG_NAME, root.attributes, root.inputs, []);
21941
+ }
21942
+ return { tagName, attrsExprs };
21943
+ }
21220
21944
  allocateDataSlot() {
21221
21945
  return this._dataIndex++;
21222
21946
  }
21223
21947
  visitForLoopBlock(block) {
21224
21948
  const blockIndex = this.allocateDataSlot();
21949
+ const { tagName, attrsExprs } = this.inferProjectionDataFromInsertionPoint(block);
21225
21950
  const primaryData = this.prepareEmbeddedTemplateFn(block.children, "_For", [block.item, block.contextVariables.$index, block.contextVariables.$count]);
21226
21951
  const { expression: trackByExpression, usesComponentInstance: trackByUsesComponentInstance } = this.createTrackByFunction(block);
21227
21952
  let emptyData = null;
@@ -21236,6 +21961,8 @@ var TemplateDefinitionBuilder = class {
21236
21961
  variable(primaryData.name),
21237
21962
  literal(primaryData.getConstCount()),
21238
21963
  literal(primaryData.getVarCount()),
21964
+ literal(tagName),
21965
+ this.addAttrsToConsts(attrsExprs || null),
21239
21966
  trackByExpression
21240
21967
  ];
21241
21968
  if (emptyData !== null) {
@@ -21602,9 +22329,9 @@ function pureFunctionCallInfo(args) {
21602
22329
  function generateNextContextExpr(relativeLevelDiff) {
21603
22330
  return importExpr(Identifiers.nextContext).callFn(relativeLevelDiff > 1 ? [literal(relativeLevelDiff)] : []);
21604
22331
  }
21605
- function getLiteralFactory(constantPool, literal2, allocateSlots) {
22332
+ function getLiteralFactory(constantPool, literal2, allocateSlots2) {
21606
22333
  const { literalFactory, literalFactoryArguments } = constantPool.getLiteralFactory(literal2);
21607
- const startSlot = allocateSlots(1 + literalFactoryArguments.length);
22334
+ const startSlot = allocateSlots2(1 + literalFactoryArguments.length);
21608
22335
  const { identifier, isVarLength } = pureFunctionCallInfo(literalFactoryArguments);
21609
22336
  const args = [literal(startSlot), literalFactory];
21610
22337
  if (isVarLength) {
@@ -22657,14 +23384,14 @@ var R3TargetBinder = class {
22657
23384
  if (!target.template) {
22658
23385
  throw new Error("Binding without a template not yet supported");
22659
23386
  }
22660
- const scope = Scope.apply(target.template);
23387
+ const scope = Scope2.apply(target.template);
22661
23388
  const scopedNodeEntities = extractScopedNodeEntities(scope);
22662
23389
  const { directives, eagerDirectives, bindings, references } = DirectiveBinder.apply(target.template, this.directiveMatcher);
22663
23390
  const { expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks } = TemplateBinder.applyWithScope(target.template, scope);
22664
23391
  return new R3BoundTarget(target, directives, eagerDirectives, bindings, references, expressions, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, deferBlocks);
22665
23392
  }
22666
23393
  };
22667
- var Scope = class {
23394
+ var Scope2 = class {
22668
23395
  constructor(parentScope, rootNode) {
22669
23396
  this.parentScope = parentScope;
22670
23397
  this.rootNode = rootNode;
@@ -22673,10 +23400,10 @@ var Scope = class {
22673
23400
  this.isDeferred = parentScope !== null && parentScope.isDeferred ? true : rootNode instanceof DeferredBlock;
22674
23401
  }
22675
23402
  static newRootScope() {
22676
- return new Scope(null, null);
23403
+ return new Scope2(null, null);
22677
23404
  }
22678
23405
  static apply(template2) {
22679
- const scope = Scope.newRootScope();
23406
+ const scope = Scope2.newRootScope();
22680
23407
  scope.ingest(template2);
22681
23408
  return scope;
22682
23409
  }
@@ -22789,7 +23516,7 @@ var Scope = class {
22789
23516
  return res;
22790
23517
  }
22791
23518
  ingestScopedNode(node) {
22792
- const scope = new Scope(this, node);
23519
+ const scope = new Scope2(this, node);
22793
23520
  scope.ingest(node);
22794
23521
  this.childScopes.set(node, scope);
22795
23522
  }
@@ -23171,8 +23898,21 @@ var R3BoundTarget = class {
23171
23898
  }
23172
23899
  const name = trigger.reference;
23173
23900
  if (name === null) {
23174
- const children = block.placeholder ? block.placeholder.children : null;
23175
- return children !== null && children.length === 1 && children[0] instanceof Element ? children[0] : null;
23901
+ let trigger2 = null;
23902
+ if (block.placeholder !== null) {
23903
+ for (const child of block.placeholder.children) {
23904
+ if (child instanceof Comment) {
23905
+ continue;
23906
+ }
23907
+ if (trigger2 !== null) {
23908
+ return null;
23909
+ }
23910
+ if (child instanceof Element) {
23911
+ trigger2 = child;
23912
+ }
23913
+ }
23914
+ }
23915
+ return trigger2;
23176
23916
  }
23177
23917
  const outsideRef = this.findEntityInScope(block, name);
23178
23918
  if (outsideRef instanceof Reference && this.getDefinitionNodeOfSymbol(outsideRef) !== block) {
@@ -23484,7 +24224,7 @@ function convertDirectiveFacadeToMetadata(facade) {
23484
24224
  });
23485
24225
  }
23486
24226
  function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
23487
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i;
24227
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i;
23488
24228
  return {
23489
24229
  name: declaration.type.name,
23490
24230
  type: wrapReference(declaration.type),
@@ -23498,11 +24238,11 @@ function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
23498
24238
  providers: declaration.providers !== void 0 ? new WrappedNodeExpr(declaration.providers) : null,
23499
24239
  exportAs: (_e2 = declaration.exportAs) != null ? _e2 : null,
23500
24240
  usesInheritance: (_f2 = declaration.usesInheritance) != null ? _f2 : false,
23501
- lifecycle: { usesOnChanges: (_g2 = declaration.usesOnChanges) != null ? _g2 : false },
24241
+ lifecycle: { usesOnChanges: (_g = declaration.usesOnChanges) != null ? _g : false },
23502
24242
  deps: null,
23503
24243
  typeArgumentCount: 0,
23504
24244
  fullInheritance: false,
23505
- isStandalone: (_h2 = declaration.isStandalone) != null ? _h2 : false,
24245
+ isStandalone: (_h = declaration.isStandalone) != null ? _h : false,
23506
24246
  isSignal: (_i = declaration.isSignal) != null ? _i : false,
23507
24247
  hostDirectives: convertHostDirectivesToMetadata(declaration)
23508
24248
  };
@@ -23797,7 +24537,7 @@ function publishFacade(global) {
23797
24537
  }
23798
24538
 
23799
24539
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/version.mjs
23800
- var VERSION2 = new Version("17.0.0-rc.0");
24540
+ var VERSION2 = new Version("17.0.0-rc.2");
23801
24541
 
23802
24542
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
23803
24543
  var _VisitorMode;
@@ -23869,17 +24609,14 @@ var AnalyzedFile = class {
23869
24609
  }
23870
24610
  };
23871
24611
  function analyze(sourceFile, analyzedFiles) {
23872
- var _a2;
23873
- for (const node of sourceFile.statements) {
23874
- if (!import_typescript3.default.isClassDeclaration(node)) {
23875
- continue;
23876
- }
24612
+ forEachClass(sourceFile, (node) => {
24613
+ var _a2;
23877
24614
  const decorator = (_a2 = import_typescript3.default.getDecorators(node)) == null ? void 0 : _a2.find((dec) => {
23878
24615
  return import_typescript3.default.isCallExpression(dec.expression) && import_typescript3.default.isIdentifier(dec.expression.expression) && dec.expression.expression.text === "Component";
23879
24616
  });
23880
24617
  const metadata = decorator && decorator.expression.arguments.length > 0 && import_typescript3.default.isObjectLiteralExpression(decorator.expression.arguments[0]) ? decorator.expression.arguments[0] : null;
23881
24618
  if (!metadata) {
23882
- continue;
24619
+ return;
23883
24620
  }
23884
24621
  for (const prop of metadata.properties) {
23885
24622
  if (!import_typescript3.default.isPropertyAssignment(prop) || !import_typescript3.default.isStringLiteralLike(prop.initializer) || !import_typescript3.default.isIdentifier(prop.name) && !import_typescript3.default.isStringLiteralLike(prop.name)) {
@@ -23895,7 +24632,7 @@ function analyze(sourceFile, analyzedFiles) {
23895
24632
  break;
23896
24633
  }
23897
24634
  }
23898
- }
24635
+ });
23899
24636
  }
23900
24637
  function migrateTemplate(template2) {
23901
24638
  if (!CONTROL_FLOW_CHARS_PATTERN.test(template2)) {
@@ -23943,6 +24680,14 @@ var TextRangeCollector = class extends RecursiveVisitor {
23943
24680
  super.visitText(text2, null);
23944
24681
  }
23945
24682
  };
24683
+ function forEachClass(sourceFile, callback) {
24684
+ sourceFile.forEachChild(function walk(node) {
24685
+ if (import_typescript3.default.isClassDeclaration(node)) {
24686
+ callback(node);
24687
+ }
24688
+ node.forEachChild(walk);
24689
+ });
24690
+ }
23946
24691
 
23947
24692
  // bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/migrations/block-template-entities/index.mjs
23948
24693
  function block_template_entities_default() {
@@ -23987,6 +24732,14 @@ function runBlockTemplateEntitiesMigration(tree, tsconfigPath, basePath) {
23987
24732
  }
23988
24733
  // Annotate the CommonJS export names for ESM import in node:
23989
24734
  0 && (module.exports = {});
24735
+ /**
24736
+ *
24737
+ * @license
24738
+ * Copyright Google LLC All Rights Reserved.
24739
+ *
24740
+ * Use of this source code is governed by an MIT-style license that can be
24741
+ * found in the LICENSE file at https://angular.io/license
24742
+ */
23990
24743
  /**
23991
24744
  * @license
23992
24745
  * Copyright Google LLC All Rights Reserved.