@angular/core 18.0.1 → 18.0.3

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 (43) hide show
  1. package/esm2022/primitives/event-dispatch/index.mjs +2 -1
  2. package/esm2022/primitives/event-dispatch/src/dispatcher.mjs +4 -3
  3. package/esm2022/primitives/event-dispatch/src/event_dispatcher.mjs +4 -6
  4. package/esm2022/primitives/event-dispatch/src/event_type.mjs +2 -2
  5. package/esm2022/primitives/signals/src/graph.mjs +6 -5
  6. package/esm2022/src/change_detection/scheduling/ng_zone_scheduling.mjs +2 -4
  7. package/esm2022/src/core_private_export.mjs +2 -2
  8. package/esm2022/src/event_delegation_utils.mjs +68 -0
  9. package/esm2022/src/event_emitter.mjs +20 -11
  10. package/esm2022/src/hydration/annotate.mjs +18 -7
  11. package/esm2022/src/hydration/api.mjs +2 -2
  12. package/esm2022/src/hydration/event_replay.mjs +46 -69
  13. package/esm2022/src/hydration/tokens.mjs +6 -1
  14. package/esm2022/src/pending_tasks.mjs +15 -20
  15. package/esm2022/src/render3/component_ref.mjs +1 -1
  16. package/esm2022/src/render3/instructions/change_detection.mjs +27 -24
  17. package/esm2022/src/render3/instructions/listener.mjs +5 -5
  18. package/esm2022/src/render3/instructions/shared.mjs +3 -3
  19. package/esm2022/src/render3/reactive_lview_consumer.mjs +56 -3
  20. package/esm2022/src/version.mjs +1 -1
  21. package/esm2022/testing/src/logger.mjs +3 -3
  22. package/fesm2022/core.mjs +409 -302
  23. package/fesm2022/core.mjs.map +1 -1
  24. package/fesm2022/primitives/event-dispatch.mjs +9 -10
  25. package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
  26. package/fesm2022/primitives/signals.mjs +6 -5
  27. package/fesm2022/primitives/signals.mjs.map +1 -1
  28. package/fesm2022/rxjs-interop.mjs +1 -1
  29. package/fesm2022/testing.mjs +1 -1
  30. package/index.d.ts +11 -6
  31. package/package.json +2 -2
  32. package/primitives/event-dispatch/index.d.ts +66 -1
  33. package/primitives/signals/index.d.ts +1 -1
  34. package/rxjs-interop/index.d.ts +1 -1
  35. package/schematics/migrations/http-providers/bundle.js +10 -2
  36. package/schematics/migrations/http-providers/bundle.js.map +2 -2
  37. package/schematics/migrations/invalid-two-way-bindings/bundle.js +177 -8
  38. package/schematics/migrations/invalid-two-way-bindings/bundle.js.map +3 -3
  39. package/schematics/ng-generate/control-flow-migration/bundle.js +192 -16
  40. package/schematics/ng-generate/control-flow-migration/bundle.js.map +3 -3
  41. package/schematics/ng-generate/standalone-migration/bundle.js +408 -706
  42. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  43. package/testing/index.d.ts +1 -1
@@ -357,7 +357,7 @@ var require_semver = __commonJS({
357
357
  do {
358
358
  const a = this.build[i];
359
359
  const b = other.build[i];
360
- debug("prerelease compare", i, a, b);
360
+ debug("build compare", i, a, b);
361
361
  if (a === void 0 && b === void 0) {
362
362
  return 0;
363
363
  } else if (b === void 0) {
@@ -826,653 +826,39 @@ var require_coerce = __commonJS({
826
826
  }
827
827
  });
828
828
 
829
- // node_modules/yallist/iterator.js
830
- var require_iterator = __commonJS({
831
- "node_modules/yallist/iterator.js"(exports, module2) {
832
- "use strict";
833
- module2.exports = function(Yallist) {
834
- Yallist.prototype[Symbol.iterator] = function* () {
835
- for (let walker = this.head; walker; walker = walker.next) {
836
- yield walker.value;
837
- }
838
- };
839
- };
840
- }
841
- });
842
-
843
- // node_modules/yallist/yallist.js
844
- var require_yallist = __commonJS({
845
- "node_modules/yallist/yallist.js"(exports, module2) {
846
- "use strict";
847
- module2.exports = Yallist;
848
- Yallist.Node = Node;
849
- Yallist.create = Yallist;
850
- function Yallist(list) {
851
- var self = this;
852
- if (!(self instanceof Yallist)) {
853
- self = new Yallist();
854
- }
855
- self.tail = null;
856
- self.head = null;
857
- self.length = 0;
858
- if (list && typeof list.forEach === "function") {
859
- list.forEach(function(item) {
860
- self.push(item);
861
- });
862
- } else if (arguments.length > 0) {
863
- for (var i = 0, l = arguments.length; i < l; i++) {
864
- self.push(arguments[i]);
865
- }
866
- }
867
- return self;
868
- }
869
- Yallist.prototype.removeNode = function(node) {
870
- if (node.list !== this) {
871
- throw new Error("removing node which does not belong to this list");
872
- }
873
- var next = node.next;
874
- var prev = node.prev;
875
- if (next) {
876
- next.prev = prev;
877
- }
878
- if (prev) {
879
- prev.next = next;
880
- }
881
- if (node === this.head) {
882
- this.head = next;
883
- }
884
- if (node === this.tail) {
885
- this.tail = prev;
886
- }
887
- node.list.length--;
888
- node.next = null;
889
- node.prev = null;
890
- node.list = null;
891
- return next;
892
- };
893
- Yallist.prototype.unshiftNode = function(node) {
894
- if (node === this.head) {
895
- return;
896
- }
897
- if (node.list) {
898
- node.list.removeNode(node);
899
- }
900
- var head = this.head;
901
- node.list = this;
902
- node.next = head;
903
- if (head) {
904
- head.prev = node;
905
- }
906
- this.head = node;
907
- if (!this.tail) {
908
- this.tail = node;
909
- }
910
- this.length++;
911
- };
912
- Yallist.prototype.pushNode = function(node) {
913
- if (node === this.tail) {
914
- return;
915
- }
916
- if (node.list) {
917
- node.list.removeNode(node);
918
- }
919
- var tail = this.tail;
920
- node.list = this;
921
- node.prev = tail;
922
- if (tail) {
923
- tail.next = node;
924
- }
925
- this.tail = node;
926
- if (!this.head) {
927
- this.head = node;
928
- }
929
- this.length++;
930
- };
931
- Yallist.prototype.push = function() {
932
- for (var i = 0, l = arguments.length; i < l; i++) {
933
- push(this, arguments[i]);
934
- }
935
- return this.length;
936
- };
937
- Yallist.prototype.unshift = function() {
938
- for (var i = 0, l = arguments.length; i < l; i++) {
939
- unshift(this, arguments[i]);
940
- }
941
- return this.length;
942
- };
943
- Yallist.prototype.pop = function() {
944
- if (!this.tail) {
945
- return void 0;
946
- }
947
- var res = this.tail.value;
948
- this.tail = this.tail.prev;
949
- if (this.tail) {
950
- this.tail.next = null;
951
- } else {
952
- this.head = null;
953
- }
954
- this.length--;
955
- return res;
956
- };
957
- Yallist.prototype.shift = function() {
958
- if (!this.head) {
959
- return void 0;
960
- }
961
- var res = this.head.value;
962
- this.head = this.head.next;
963
- if (this.head) {
964
- this.head.prev = null;
965
- } else {
966
- this.tail = null;
967
- }
968
- this.length--;
969
- return res;
970
- };
971
- Yallist.prototype.forEach = function(fn2, thisp) {
972
- thisp = thisp || this;
973
- for (var walker = this.head, i = 0; walker !== null; i++) {
974
- fn2.call(thisp, walker.value, i, this);
975
- walker = walker.next;
976
- }
977
- };
978
- Yallist.prototype.forEachReverse = function(fn2, thisp) {
979
- thisp = thisp || this;
980
- for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
981
- fn2.call(thisp, walker.value, i, this);
982
- walker = walker.prev;
983
- }
984
- };
985
- Yallist.prototype.get = function(n2) {
986
- for (var i = 0, walker = this.head; walker !== null && i < n2; i++) {
987
- walker = walker.next;
988
- }
989
- if (i === n2 && walker !== null) {
990
- return walker.value;
991
- }
992
- };
993
- Yallist.prototype.getReverse = function(n2) {
994
- for (var i = 0, walker = this.tail; walker !== null && i < n2; i++) {
995
- walker = walker.prev;
996
- }
997
- if (i === n2 && walker !== null) {
998
- return walker.value;
999
- }
1000
- };
1001
- Yallist.prototype.map = function(fn2, thisp) {
1002
- thisp = thisp || this;
1003
- var res = new Yallist();
1004
- for (var walker = this.head; walker !== null; ) {
1005
- res.push(fn2.call(thisp, walker.value, this));
1006
- walker = walker.next;
1007
- }
1008
- return res;
1009
- };
1010
- Yallist.prototype.mapReverse = function(fn2, thisp) {
1011
- thisp = thisp || this;
1012
- var res = new Yallist();
1013
- for (var walker = this.tail; walker !== null; ) {
1014
- res.push(fn2.call(thisp, walker.value, this));
1015
- walker = walker.prev;
1016
- }
1017
- return res;
1018
- };
1019
- Yallist.prototype.reduce = function(fn2, initial) {
1020
- var acc;
1021
- var walker = this.head;
1022
- if (arguments.length > 1) {
1023
- acc = initial;
1024
- } else if (this.head) {
1025
- walker = this.head.next;
1026
- acc = this.head.value;
1027
- } else {
1028
- throw new TypeError("Reduce of empty list with no initial value");
1029
- }
1030
- for (var i = 0; walker !== null; i++) {
1031
- acc = fn2(acc, walker.value, i);
1032
- walker = walker.next;
1033
- }
1034
- return acc;
1035
- };
1036
- Yallist.prototype.reduceReverse = function(fn2, initial) {
1037
- var acc;
1038
- var walker = this.tail;
1039
- if (arguments.length > 1) {
1040
- acc = initial;
1041
- } else if (this.tail) {
1042
- walker = this.tail.prev;
1043
- acc = this.tail.value;
1044
- } else {
1045
- throw new TypeError("Reduce of empty list with no initial value");
1046
- }
1047
- for (var i = this.length - 1; walker !== null; i--) {
1048
- acc = fn2(acc, walker.value, i);
1049
- walker = walker.prev;
1050
- }
1051
- return acc;
1052
- };
1053
- Yallist.prototype.toArray = function() {
1054
- var arr = new Array(this.length);
1055
- for (var i = 0, walker = this.head; walker !== null; i++) {
1056
- arr[i] = walker.value;
1057
- walker = walker.next;
1058
- }
1059
- return arr;
1060
- };
1061
- Yallist.prototype.toArrayReverse = function() {
1062
- var arr = new Array(this.length);
1063
- for (var i = 0, walker = this.tail; walker !== null; i++) {
1064
- arr[i] = walker.value;
1065
- walker = walker.prev;
1066
- }
1067
- return arr;
1068
- };
1069
- Yallist.prototype.slice = function(from, to) {
1070
- to = to || this.length;
1071
- if (to < 0) {
1072
- to += this.length;
1073
- }
1074
- from = from || 0;
1075
- if (from < 0) {
1076
- from += this.length;
1077
- }
1078
- var ret = new Yallist();
1079
- if (to < from || to < 0) {
1080
- return ret;
1081
- }
1082
- if (from < 0) {
1083
- from = 0;
1084
- }
1085
- if (to > this.length) {
1086
- to = this.length;
1087
- }
1088
- for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
1089
- walker = walker.next;
1090
- }
1091
- for (; walker !== null && i < to; i++, walker = walker.next) {
1092
- ret.push(walker.value);
1093
- }
1094
- return ret;
1095
- };
1096
- Yallist.prototype.sliceReverse = function(from, to) {
1097
- to = to || this.length;
1098
- if (to < 0) {
1099
- to += this.length;
1100
- }
1101
- from = from || 0;
1102
- if (from < 0) {
1103
- from += this.length;
1104
- }
1105
- var ret = new Yallist();
1106
- if (to < from || to < 0) {
1107
- return ret;
1108
- }
1109
- if (from < 0) {
1110
- from = 0;
1111
- }
1112
- if (to > this.length) {
1113
- to = this.length;
1114
- }
1115
- for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
1116
- walker = walker.prev;
1117
- }
1118
- for (; walker !== null && i > from; i--, walker = walker.prev) {
1119
- ret.push(walker.value);
1120
- }
1121
- return ret;
1122
- };
1123
- Yallist.prototype.splice = function(start, deleteCount, ...nodes) {
1124
- if (start > this.length) {
1125
- start = this.length - 1;
1126
- }
1127
- if (start < 0) {
1128
- start = this.length + start;
1129
- }
1130
- for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
1131
- walker = walker.next;
1132
- }
1133
- var ret = [];
1134
- for (var i = 0; walker && i < deleteCount; i++) {
1135
- ret.push(walker.value);
1136
- walker = this.removeNode(walker);
1137
- }
1138
- if (walker === null) {
1139
- walker = this.tail;
1140
- }
1141
- if (walker !== this.head && walker !== this.tail) {
1142
- walker = walker.prev;
1143
- }
1144
- for (var i = 0; i < nodes.length; i++) {
1145
- walker = insert(this, walker, nodes[i]);
1146
- }
1147
- return ret;
1148
- };
1149
- Yallist.prototype.reverse = function() {
1150
- var head = this.head;
1151
- var tail = this.tail;
1152
- for (var walker = head; walker !== null; walker = walker.prev) {
1153
- var p2 = walker.prev;
1154
- walker.prev = walker.next;
1155
- walker.next = p2;
1156
- }
1157
- this.head = tail;
1158
- this.tail = head;
1159
- return this;
1160
- };
1161
- function insert(self, node, value) {
1162
- var inserted = node === self.head ? new Node(value, null, node, self) : new Node(value, node, node.next, self);
1163
- if (inserted.next === null) {
1164
- self.tail = inserted;
1165
- }
1166
- if (inserted.prev === null) {
1167
- self.head = inserted;
1168
- }
1169
- self.length++;
1170
- return inserted;
1171
- }
1172
- function push(self, item) {
1173
- self.tail = new Node(item, self.tail, null, self);
1174
- if (!self.head) {
1175
- self.head = self.tail;
1176
- }
1177
- self.length++;
1178
- }
1179
- function unshift(self, item) {
1180
- self.head = new Node(item, null, self.head, self);
1181
- if (!self.tail) {
1182
- self.tail = self.head;
1183
- }
1184
- self.length++;
1185
- }
1186
- function Node(value, prev, next, list) {
1187
- if (!(this instanceof Node)) {
1188
- return new Node(value, prev, next, list);
1189
- }
1190
- this.list = list;
1191
- this.value = value;
1192
- if (prev) {
1193
- prev.next = this;
1194
- this.prev = prev;
1195
- } else {
1196
- this.prev = null;
1197
- }
1198
- if (next) {
1199
- next.prev = this;
1200
- this.next = next;
1201
- } else {
1202
- this.next = null;
1203
- }
1204
- }
1205
- try {
1206
- require_iterator()(Yallist);
1207
- } catch (er) {
1208
- }
1209
- }
1210
- });
1211
-
1212
- // node_modules/semver/node_modules/lru-cache/index.js
1213
- var require_lru_cache = __commonJS({
1214
- "node_modules/semver/node_modules/lru-cache/index.js"(exports, module2) {
1215
- "use strict";
1216
- var Yallist = require_yallist();
1217
- var MAX = Symbol("max");
1218
- var LENGTH = Symbol("length");
1219
- var LENGTH_CALCULATOR = Symbol("lengthCalculator");
1220
- var ALLOW_STALE = Symbol("allowStale");
1221
- var MAX_AGE = Symbol("maxAge");
1222
- var DISPOSE = Symbol("dispose");
1223
- var NO_DISPOSE_ON_SET = Symbol("noDisposeOnSet");
1224
- var LRU_LIST = Symbol("lruList");
1225
- var CACHE = Symbol("cache");
1226
- var UPDATE_AGE_ON_GET = Symbol("updateAgeOnGet");
1227
- var naiveLength = () => 1;
829
+ // node_modules/semver/internal/lrucache.js
830
+ var require_lrucache = __commonJS({
831
+ "node_modules/semver/internal/lrucache.js"(exports, module2) {
1228
832
  var LRUCache = class {
1229
- constructor(options) {
1230
- if (typeof options === "number")
1231
- options = { max: options };
1232
- if (!options)
1233
- options = {};
1234
- if (options.max && (typeof options.max !== "number" || options.max < 0))
1235
- throw new TypeError("max must be a non-negative number");
1236
- const max = this[MAX] = options.max || Infinity;
1237
- const lc = options.length || naiveLength;
1238
- this[LENGTH_CALCULATOR] = typeof lc !== "function" ? naiveLength : lc;
1239
- this[ALLOW_STALE] = options.stale || false;
1240
- if (options.maxAge && typeof options.maxAge !== "number")
1241
- throw new TypeError("maxAge must be a number");
1242
- this[MAX_AGE] = options.maxAge || 0;
1243
- this[DISPOSE] = options.dispose;
1244
- this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
1245
- this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
1246
- this.reset();
1247
- }
1248
- set max(mL) {
1249
- if (typeof mL !== "number" || mL < 0)
1250
- throw new TypeError("max must be a non-negative number");
1251
- this[MAX] = mL || Infinity;
1252
- trim(this);
1253
- }
1254
- get max() {
1255
- return this[MAX];
1256
- }
1257
- set allowStale(allowStale) {
1258
- this[ALLOW_STALE] = !!allowStale;
1259
- }
1260
- get allowStale() {
1261
- return this[ALLOW_STALE];
1262
- }
1263
- set maxAge(mA) {
1264
- if (typeof mA !== "number")
1265
- throw new TypeError("maxAge must be a non-negative number");
1266
- this[MAX_AGE] = mA;
1267
- trim(this);
1268
- }
1269
- get maxAge() {
1270
- return this[MAX_AGE];
1271
- }
1272
- set lengthCalculator(lC) {
1273
- if (typeof lC !== "function")
1274
- lC = naiveLength;
1275
- if (lC !== this[LENGTH_CALCULATOR]) {
1276
- this[LENGTH_CALCULATOR] = lC;
1277
- this[LENGTH] = 0;
1278
- this[LRU_LIST].forEach((hit) => {
1279
- hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
1280
- this[LENGTH] += hit.length;
1281
- });
1282
- }
1283
- trim(this);
1284
- }
1285
- get lengthCalculator() {
1286
- return this[LENGTH_CALCULATOR];
1287
- }
1288
- get length() {
1289
- return this[LENGTH];
1290
- }
1291
- get itemCount() {
1292
- return this[LRU_LIST].length;
1293
- }
1294
- rforEach(fn2, thisp) {
1295
- thisp = thisp || this;
1296
- for (let walker = this[LRU_LIST].tail; walker !== null; ) {
1297
- const prev = walker.prev;
1298
- forEachStep(this, fn2, walker, thisp);
1299
- walker = prev;
1300
- }
1301
- }
1302
- forEach(fn2, thisp) {
1303
- thisp = thisp || this;
1304
- for (let walker = this[LRU_LIST].head; walker !== null; ) {
1305
- const next = walker.next;
1306
- forEachStep(this, fn2, walker, thisp);
1307
- walker = next;
1308
- }
1309
- }
1310
- keys() {
1311
- return this[LRU_LIST].toArray().map((k) => k.key);
1312
- }
1313
- values() {
1314
- return this[LRU_LIST].toArray().map((k) => k.value);
1315
- }
1316
- reset() {
1317
- if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) {
1318
- this[LRU_LIST].forEach((hit) => this[DISPOSE](hit.key, hit.value));
1319
- }
1320
- this[CACHE] = /* @__PURE__ */ new Map();
1321
- this[LRU_LIST] = new Yallist();
1322
- this[LENGTH] = 0;
1323
- }
1324
- dump() {
1325
- return this[LRU_LIST].map((hit) => isStale(this, hit) ? false : {
1326
- k: hit.key,
1327
- v: hit.value,
1328
- e: hit.now + (hit.maxAge || 0)
1329
- }).toArray().filter((h) => h);
1330
- }
1331
- dumpLru() {
1332
- return this[LRU_LIST];
1333
- }
1334
- set(key, value, maxAge) {
1335
- maxAge = maxAge || this[MAX_AGE];
1336
- if (maxAge && typeof maxAge !== "number")
1337
- throw new TypeError("maxAge must be a number");
1338
- const now = maxAge ? Date.now() : 0;
1339
- const len = this[LENGTH_CALCULATOR](value, key);
1340
- if (this[CACHE].has(key)) {
1341
- if (len > this[MAX]) {
1342
- del(this, this[CACHE].get(key));
1343
- return false;
1344
- }
1345
- const node = this[CACHE].get(key);
1346
- const item = node.value;
1347
- if (this[DISPOSE]) {
1348
- if (!this[NO_DISPOSE_ON_SET])
1349
- this[DISPOSE](key, item.value);
1350
- }
1351
- item.now = now;
1352
- item.maxAge = maxAge;
1353
- item.value = value;
1354
- this[LENGTH] += len - item.length;
1355
- item.length = len;
1356
- this.get(key);
1357
- trim(this);
1358
- return true;
1359
- }
1360
- const hit = new Entry(key, value, len, now, maxAge);
1361
- if (hit.length > this[MAX]) {
1362
- if (this[DISPOSE])
1363
- this[DISPOSE](key, value);
1364
- return false;
1365
- }
1366
- this[LENGTH] += hit.length;
1367
- this[LRU_LIST].unshift(hit);
1368
- this[CACHE].set(key, this[LRU_LIST].head);
1369
- trim(this);
1370
- return true;
1371
- }
1372
- has(key) {
1373
- if (!this[CACHE].has(key))
1374
- return false;
1375
- const hit = this[CACHE].get(key).value;
1376
- return !isStale(this, hit);
833
+ constructor() {
834
+ this.max = 1e3;
835
+ this.map = /* @__PURE__ */ new Map();
1377
836
  }
1378
837
  get(key) {
1379
- return get(this, key, true);
1380
- }
1381
- peek(key) {
1382
- return get(this, key, false);
1383
- }
1384
- pop() {
1385
- const node = this[LRU_LIST].tail;
1386
- if (!node)
1387
- return null;
1388
- del(this, node);
1389
- return node.value;
1390
- }
1391
- del(key) {
1392
- del(this, this[CACHE].get(key));
1393
- }
1394
- load(arr) {
1395
- this.reset();
1396
- const now = Date.now();
1397
- for (let l = arr.length - 1; l >= 0; l--) {
1398
- const hit = arr[l];
1399
- const expiresAt = hit.e || 0;
1400
- if (expiresAt === 0)
1401
- this.set(hit.k, hit.v);
1402
- else {
1403
- const maxAge = expiresAt - now;
1404
- if (maxAge > 0) {
1405
- this.set(hit.k, hit.v, maxAge);
1406
- }
1407
- }
838
+ const value = this.map.get(key);
839
+ if (value === void 0) {
840
+ return void 0;
841
+ } else {
842
+ this.map.delete(key);
843
+ this.map.set(key, value);
844
+ return value;
1408
845
  }
1409
846
  }
1410
- prune() {
1411
- this[CACHE].forEach((value, key) => get(this, key, false));
847
+ delete(key) {
848
+ return this.map.delete(key);
1412
849
  }
1413
- };
1414
- var get = (self, key, doUse) => {
1415
- const node = self[CACHE].get(key);
1416
- if (node) {
1417
- const hit = node.value;
1418
- if (isStale(self, hit)) {
1419
- del(self, node);
1420
- if (!self[ALLOW_STALE])
1421
- return void 0;
1422
- } else {
1423
- if (doUse) {
1424
- if (self[UPDATE_AGE_ON_GET])
1425
- node.value.now = Date.now();
1426
- self[LRU_LIST].unshiftNode(node);
850
+ set(key, value) {
851
+ const deleted = this.delete(key);
852
+ if (!deleted && value !== void 0) {
853
+ if (this.map.size >= this.max) {
854
+ const firstKey = this.map.keys().next().value;
855
+ this.delete(firstKey);
1427
856
  }
857
+ this.map.set(key, value);
1428
858
  }
1429
- return hit.value;
1430
- }
1431
- };
1432
- var isStale = (self, hit) => {
1433
- if (!hit || !hit.maxAge && !self[MAX_AGE])
1434
- return false;
1435
- const diff = Date.now() - hit.now;
1436
- return hit.maxAge ? diff > hit.maxAge : self[MAX_AGE] && diff > self[MAX_AGE];
1437
- };
1438
- var trim = (self) => {
1439
- if (self[LENGTH] > self[MAX]) {
1440
- for (let walker = self[LRU_LIST].tail; self[LENGTH] > self[MAX] && walker !== null; ) {
1441
- const prev = walker.prev;
1442
- del(self, walker);
1443
- walker = prev;
1444
- }
1445
- }
1446
- };
1447
- var del = (self, node) => {
1448
- if (node) {
1449
- const hit = node.value;
1450
- if (self[DISPOSE])
1451
- self[DISPOSE](hit.key, hit.value);
1452
- self[LENGTH] -= hit.length;
1453
- self[CACHE].delete(hit.key);
1454
- self[LRU_LIST].removeNode(node);
1455
- }
1456
- };
1457
- var Entry = class {
1458
- constructor(key, value, length, now, maxAge) {
1459
- this.key = key;
1460
- this.value = value;
1461
- this.length = length;
1462
- this.now = now;
1463
- this.maxAge = maxAge || 0;
859
+ return this;
1464
860
  }
1465
861
  };
1466
- var forEachStep = (self, fn2, node, thisp) => {
1467
- let hit = node.value;
1468
- if (isStale(self, hit)) {
1469
- del(self, node);
1470
- if (!self[ALLOW_STALE])
1471
- hit = void 0;
1472
- }
1473
- if (hit)
1474
- fn2.call(thisp, hit.value, hit.key, self);
1475
- };
1476
862
  module2.exports = LRUCache;
1477
863
  }
1478
864
  });
@@ -1601,8 +987,8 @@ var require_range = __commonJS({
1601
987
  }
1602
988
  };
1603
989
  module2.exports = Range;
1604
- var LRU = require_lru_cache();
1605
- var cache = new LRU({ max: 1e3 });
990
+ var LRU = require_lrucache();
991
+ var cache = new LRU();
1606
992
  var parseOptions = require_parse_options();
1607
993
  var Comparator = require_comparator();
1608
994
  var debug = require_debug();
@@ -1780,7 +1166,7 @@ var require_range = __commonJS({
1780
1166
  debug("replaceGTE0", comp, options);
1781
1167
  return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
1782
1168
  };
1783
- var hyphenReplace = (incPr) => ($02, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) => {
1169
+ var hyphenReplace = (incPr) => ($02, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
1784
1170
  if (isX(fM)) {
1785
1171
  from = "";
1786
1172
  } else if (isX(fm)) {
@@ -7460,6 +6846,18 @@ var UnknownBlock = class {
7460
6846
  return visitor.visitUnknownBlock(this);
7461
6847
  }
7462
6848
  };
6849
+ var LetDeclaration = class {
6850
+ constructor(name, value, sourceSpan, nameSpan, valueSpan) {
6851
+ this.name = name;
6852
+ this.value = value;
6853
+ this.sourceSpan = sourceSpan;
6854
+ this.nameSpan = nameSpan;
6855
+ this.valueSpan = valueSpan;
6856
+ }
6857
+ visit(visitor) {
6858
+ return visitor.visitLetDeclaration(this);
6859
+ }
6860
+ };
7463
6861
  var Template = class {
7464
6862
  constructor(tagName, attributes, inputs, outputs, templateAttrs, children, references, variables, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
7465
6863
  this.tagName = tagName;
@@ -7600,6 +6998,8 @@ var RecursiveVisitor = class {
7600
6998
  }
7601
6999
  visitUnknownBlock(block) {
7602
7000
  }
7001
+ visitLetDeclaration(decl) {
7002
+ }
7603
7003
  };
7604
7004
  function visitAll(visitor, nodes) {
7605
7005
  const result = [];
@@ -14246,6 +13646,18 @@ var BlockParameter = class {
14246
13646
  return visitor.visitBlockParameter(this, context);
14247
13647
  }
14248
13648
  };
13649
+ var LetDeclaration2 = class {
13650
+ constructor(name, value, sourceSpan, nameSpan, valueSpan) {
13651
+ this.name = name;
13652
+ this.value = value;
13653
+ this.sourceSpan = sourceSpan;
13654
+ this.nameSpan = nameSpan;
13655
+ this.valueSpan = valueSpan;
13656
+ }
13657
+ visit(visitor, context) {
13658
+ return visitor.visitLetDeclaration(this, context);
13659
+ }
13660
+ };
14249
13661
  function visitAll2(visitor, nodes, context = null) {
14250
13662
  const result = [];
14251
13663
  const visit2 = visitor.visit ? (ast) => visitor.visit(ast, context) || ast.visit(visitor, context) : (ast) => ast.visit(visitor, context);
@@ -15074,6 +14486,9 @@ var _I18nVisitor = class {
15074
14486
  visitBlockParameter(_parameter, _context) {
15075
14487
  throw new Error("Unreachable code");
15076
14488
  }
14489
+ visitLetDeclaration(decl, context) {
14490
+ return null;
14491
+ }
15077
14492
  _visitTextWithInterpolation(tokens, sourceSpan, context, previousI18n) {
15078
14493
  const nodes = [];
15079
14494
  let hasInterpolation = false;
@@ -17345,6 +16760,7 @@ var _Tokenizer = class {
17345
16760
  this._preserveLineEndings = options.preserveLineEndings || false;
17346
16761
  this._i18nNormalizeLineEndingsInICUs = options.i18nNormalizeLineEndingsInICUs || false;
17347
16762
  this._tokenizeBlocks = (_a2 = options.tokenizeBlocks) != null ? _a2 : true;
16763
+ this._tokenizeLet = options.tokenizeLet || false;
17348
16764
  try {
17349
16765
  this._cursor.init();
17350
16766
  } catch (e) {
@@ -17375,6 +16791,8 @@ var _Tokenizer = class {
17375
16791
  } else {
17376
16792
  this._consumeTagOpen(start);
17377
16793
  }
16794
+ } else if (this._tokenizeLet && this._cursor.peek() === $AT && !this._inInterpolation && this._attemptStr("@let")) {
16795
+ this._consumeLetDeclaration(start);
17378
16796
  } else if (this._tokenizeBlocks && this._attemptCharCode($AT)) {
17379
16797
  this._consumeBlockStart(start);
17380
16798
  } else if (this._tokenizeBlocks && !this._inInterpolation && !this._isInExpansionCase() && !this._isInExpansionForm() && this._attemptCharCode($RBRACE)) {
@@ -17386,7 +16804,7 @@ var _Tokenizer = class {
17386
16804
  this.handleError(e);
17387
16805
  }
17388
16806
  }
17389
- this._beginToken(29);
16807
+ this._beginToken(33);
17390
16808
  this._endToken([]);
17391
16809
  }
17392
16810
  _getBlockName() {
@@ -17459,6 +16877,67 @@ var _Tokenizer = class {
17459
16877
  this._attemptCharCodeUntilFn(isBlockParameterChar);
17460
16878
  }
17461
16879
  }
16880
+ _consumeLetDeclaration(start) {
16881
+ this._beginToken(29, start);
16882
+ if (isWhitespace(this._cursor.peek())) {
16883
+ this._attemptCharCodeUntilFn(isNotWhitespace);
16884
+ } else {
16885
+ const token = this._endToken([this._cursor.getChars(start)]);
16886
+ token.type = 32;
16887
+ return;
16888
+ }
16889
+ const startToken = this._endToken([this._getLetDeclarationName()]);
16890
+ this._attemptCharCodeUntilFn(isNotWhitespace);
16891
+ if (!this._attemptCharCode($EQ)) {
16892
+ startToken.type = 32;
16893
+ return;
16894
+ }
16895
+ this._attemptCharCodeUntilFn((code) => isNotWhitespace(code) && !isNewLine(code));
16896
+ this._consumeLetDeclarationValue();
16897
+ const endChar = this._cursor.peek();
16898
+ if (endChar === $SEMICOLON) {
16899
+ this._beginToken(31);
16900
+ this._endToken([]);
16901
+ this._cursor.advance();
16902
+ } else {
16903
+ startToken.type = 32;
16904
+ startToken.sourceSpan = this._cursor.getSpan(start);
16905
+ }
16906
+ }
16907
+ _getLetDeclarationName() {
16908
+ const nameCursor = this._cursor.clone();
16909
+ let allowDigit = false;
16910
+ this._attemptCharCodeUntilFn((code) => {
16911
+ if (isAsciiLetter(code) || code === $_ || allowDigit && isDigit(code)) {
16912
+ allowDigit = true;
16913
+ return false;
16914
+ }
16915
+ return true;
16916
+ });
16917
+ return this._cursor.getChars(nameCursor).trim();
16918
+ }
16919
+ _consumeLetDeclarationValue() {
16920
+ const start = this._cursor.clone();
16921
+ this._beginToken(30, start);
16922
+ while (this._cursor.peek() !== $EOF) {
16923
+ const char = this._cursor.peek();
16924
+ if (char === $SEMICOLON) {
16925
+ break;
16926
+ }
16927
+ if (isQuote(char)) {
16928
+ this._cursor.advance();
16929
+ this._attemptCharCodeUntilFn((inner) => {
16930
+ if (inner === $BACKSLASH) {
16931
+ this._cursor.advance();
16932
+ return false;
16933
+ }
16934
+ return inner === char;
16935
+ });
16936
+ }
16937
+ this._cursor.advance();
16938
+ }
16939
+ this._endToken([this._cursor.getChars(start)]);
16940
+ }
17462
16941
  _tokenizeExpansionForm() {
17463
16942
  if (this.isExpansionFormStart()) {
17464
16943
  this._consumeExpansionFormStart();
@@ -18245,7 +17724,7 @@ var _TreeBuilder = class {
18245
17724
  this._advance();
18246
17725
  }
18247
17726
  build() {
18248
- while (this._peek.type !== 29) {
17727
+ while (this._peek.type !== 33) {
18249
17728
  if (this._peek.type === 0 || this._peek.type === 4) {
18250
17729
  this._consumeStartTag(this._advance());
18251
17730
  } else if (this._peek.type === 3) {
@@ -18270,6 +17749,12 @@ var _TreeBuilder = class {
18270
17749
  } else if (this._peek.type === 28) {
18271
17750
  this._closeVoidElement();
18272
17751
  this._consumeIncompleteBlock(this._advance());
17752
+ } else if (this._peek.type === 29) {
17753
+ this._closeVoidElement();
17754
+ this._consumeLet(this._advance());
17755
+ } else if (this._peek.type === 32) {
17756
+ this._closeVoidElement();
17757
+ this._consumeIncompleteLet(this._advance());
18273
17758
  } else {
18274
17759
  this._advance();
18275
17760
  }
@@ -18334,7 +17819,7 @@ var _TreeBuilder = class {
18334
17819
  if (!exp)
18335
17820
  return null;
18336
17821
  const end = this._advance();
18337
- exp.push({ type: 29, parts: [], sourceSpan: end.sourceSpan });
17822
+ exp.push({ type: 33, parts: [], sourceSpan: end.sourceSpan });
18338
17823
  const expansionCaseParser = new _TreeBuilder(exp, this.getTagDefinition);
18339
17824
  expansionCaseParser.build();
18340
17825
  if (expansionCaseParser.errors.length > 0) {
@@ -18370,7 +17855,7 @@ var _TreeBuilder = class {
18370
17855
  return null;
18371
17856
  }
18372
17857
  }
18373
- if (this._peek.type === 29) {
17858
+ if (this._peek.type === 33) {
18374
17859
  this.errors.push(TreeError.create(null, start.sourceSpan, `Invalid ICU message. Missing '}'.`));
18375
17860
  return null;
18376
17861
  }
@@ -18542,6 +18027,44 @@ var _TreeBuilder = class {
18542
18027
  this._popContainer(null, Block, null);
18543
18028
  this.errors.push(TreeError.create(token.parts[0], span, `Incomplete block "${token.parts[0]}". If you meant to write the @ character, you should use the "&#64;" HTML entity instead.`));
18544
18029
  }
18030
+ _consumeLet(startToken) {
18031
+ const name = startToken.parts[0];
18032
+ let valueToken;
18033
+ let endToken;
18034
+ if (this._peek.type !== 30) {
18035
+ this.errors.push(TreeError.create(startToken.parts[0], startToken.sourceSpan, `Invalid @let declaration "${name}". Declaration must have a value.`));
18036
+ return;
18037
+ } else {
18038
+ valueToken = this._advance();
18039
+ }
18040
+ if (this._peek.type !== 31) {
18041
+ this.errors.push(TreeError.create(startToken.parts[0], startToken.sourceSpan, `Unterminated @let declaration "${name}". Declaration must be terminated with a semicolon.`));
18042
+ return;
18043
+ } else {
18044
+ endToken = this._advance();
18045
+ }
18046
+ const end = endToken.sourceSpan.fullStart;
18047
+ const span = new ParseSourceSpan(startToken.sourceSpan.start, end, startToken.sourceSpan.fullStart);
18048
+ const startOffset = startToken.sourceSpan.toString().lastIndexOf(name);
18049
+ const nameStart = startToken.sourceSpan.start.moveBy(startOffset);
18050
+ const nameSpan = new ParseSourceSpan(nameStart, startToken.sourceSpan.end);
18051
+ const node = new LetDeclaration2(name, valueToken.parts[0], span, nameSpan, valueToken.sourceSpan);
18052
+ this._addToParent(node);
18053
+ }
18054
+ _consumeIncompleteLet(token) {
18055
+ var _a2;
18056
+ const name = (_a2 = token.parts[0]) != null ? _a2 : "";
18057
+ const nameString = name ? ` "${name}"` : "";
18058
+ if (name.length > 0) {
18059
+ const startOffset = token.sourceSpan.toString().lastIndexOf(name);
18060
+ const nameStart = token.sourceSpan.start.moveBy(startOffset);
18061
+ const nameSpan = new ParseSourceSpan(nameStart, token.sourceSpan.end);
18062
+ const valueSpan = new ParseSourceSpan(token.sourceSpan.start, token.sourceSpan.start.moveBy(0));
18063
+ const node = new LetDeclaration2(name, "", token.sourceSpan, nameSpan, valueSpan);
18064
+ this._addToParent(node);
18065
+ }
18066
+ this.errors.push(TreeError.create(token.parts[0], token.sourceSpan, `Incomplete @let declaration${nameString}. @let declarations must be written as \`@let <name> = <value>;\``));
18067
+ }
18545
18068
  _getContainer() {
18546
18069
  return this._containerStack.length > 0 ? this._containerStack[this._containerStack.length - 1] : null;
18547
18070
  }
@@ -18714,6 +18237,9 @@ var I18nMetaVisitor = class {
18714
18237
  visitBlockParameter(parameter, context) {
18715
18238
  return parameter;
18716
18239
  }
18240
+ visitLetDeclaration(decl, context) {
18241
+ return decl;
18242
+ }
18717
18243
  _parseMetadata(meta) {
18718
18244
  return typeof meta === "string" ? parseI18nMeta(meta) : meta instanceof Message ? meta : {};
18719
18245
  }
@@ -22164,6 +21690,7 @@ function ingestNodes(unit, template2) {
22164
21690
  ingestIcu(unit, node);
22165
21691
  } else if (node instanceof ForLoopBlock) {
22166
21692
  ingestForBlock(unit, node);
21693
+ } else if (node instanceof LetDeclaration) {
22167
21694
  } else {
22168
21695
  throw new Error(`Unsupported template node: ${node.constructor.name}`);
22169
21696
  }
@@ -22988,6 +22515,9 @@ var WhitespaceVisitor = class {
22988
22515
  visitBlockParameter(parameter, context) {
22989
22516
  return parameter;
22990
22517
  }
22518
+ visitLetDeclaration(decl, context) {
22519
+ return decl;
22520
+ }
22991
22521
  };
22992
22522
  function createWhitespaceProcessedTextToken({ type, parts, sourceSpan }) {
22993
22523
  return { type, parts: [processWhitespace(parts[0])], sourceSpan };
@@ -24337,6 +23867,13 @@ var HtmlAstToIvyAst = class {
24337
23867
  }
24338
23868
  return null;
24339
23869
  }
23870
+ visitLetDeclaration(decl, context) {
23871
+ const value = this.bindingParser.parseBinding(decl.value, false, decl.valueSpan, decl.valueSpan.start.offset);
23872
+ if (value.errors.length === 0 && value.ast instanceof EmptyExpr) {
23873
+ this.reportError("@let declaration value cannot be empty", decl.valueSpan);
23874
+ }
23875
+ return new LetDeclaration(decl.name, value, decl.sourceSpan, decl.nameSpan, decl.valueSpan);
23876
+ }
24340
23877
  visitBlockParameter() {
24341
23878
  return null;
24342
23879
  }
@@ -24603,6 +24140,9 @@ var NonBindableVisitor = class {
24603
24140
  visitBlockParameter(parameter, context) {
24604
24141
  return null;
24605
24142
  }
24143
+ visitLetDeclaration(decl, context) {
24144
+ return new Text(`@let ${decl.name} = ${decl.value};`, decl.sourceSpan);
24145
+ }
24606
24146
  };
24607
24147
  var NON_BINDABLE_VISITOR = new NonBindableVisitor();
24608
24148
  function normalizeAttributeName(attrName) {
@@ -24622,7 +24162,7 @@ function textContents(node) {
24622
24162
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/view/template.mjs
24623
24163
  var LEADING_TRIVIA_CHARS = [" ", "\n", "\r", " "];
24624
24164
  function parseTemplate(template2, templateUrl, options = {}) {
24625
- var _a2;
24165
+ var _a2, _b2;
24626
24166
  const { interpolationConfig, preserveWhitespaces, enableI18nLegacyMessageIdFormat, allowInvalidAssignmentEvents } = options;
24627
24167
  const bindingParser = makeBindingParser(interpolationConfig, allowInvalidAssignmentEvents);
24628
24168
  const htmlParser = new HtmlParser();
@@ -24630,7 +24170,8 @@ function parseTemplate(template2, templateUrl, options = {}) {
24630
24170
  leadingTriviaChars: LEADING_TRIVIA_CHARS
24631
24171
  }, options), {
24632
24172
  tokenizeExpansionForms: true,
24633
- tokenizeBlocks: (_a2 = options.enableBlockSyntax) != null ? _a2 : true
24173
+ tokenizeBlocks: (_a2 = options.enableBlockSyntax) != null ? _a2 : true,
24174
+ tokenizeLet: (_b2 = options.enableLetSyntax) != null ? _b2 : false
24634
24175
  }));
24635
24176
  if (!options.alwaysAttemptHtmlToR3AstConversion && parseResult.errors && parseResult.errors.length > 0) {
24636
24177
  const parsedTemplate2 = {
@@ -25194,6 +24735,9 @@ var Scope2 = class {
25194
24735
  visitContent(content) {
25195
24736
  this.ingestScopedNode(content);
25196
24737
  }
24738
+ visitLetDeclaration(decl) {
24739
+ this.maybeDeclare(decl);
24740
+ }
25197
24741
  visitBoundAttribute(attr) {
25198
24742
  }
25199
24743
  visitBoundEvent(event) {
@@ -25371,6 +24915,8 @@ var DirectiveBinder = class {
25371
24915
  }
25372
24916
  visitUnknownBlock(block) {
25373
24917
  }
24918
+ visitLetDeclaration(decl) {
24919
+ }
25374
24920
  };
25375
24921
  var TemplateBinder = class extends RecursiveAstVisitor2 {
25376
24922
  constructor(bindings, symbols, usedPipes, eagerPipes, deferBlocks, nestingLevel, scope, rootNode, level) {
@@ -25527,6 +25073,12 @@ var TemplateBinder = class extends RecursiveAstVisitor2 {
25527
25073
  visitBoundText(text2) {
25528
25074
  text2.value.visit(this);
25529
25075
  }
25076
+ visitLetDeclaration(decl) {
25077
+ decl.value.visit(this);
25078
+ if (this.rootNode !== null) {
25079
+ this.symbols.set(decl, this.rootNode);
25080
+ }
25081
+ }
25530
25082
  visitPipe(ast, context) {
25531
25083
  this.usedPipes.add(ast.name);
25532
25084
  if (!this.scope.isDeferred) {
@@ -25555,7 +25107,10 @@ var TemplateBinder = class extends RecursiveAstVisitor2 {
25555
25107
  if (!(ast.receiver instanceof ImplicitReceiver)) {
25556
25108
  return;
25557
25109
  }
25558
- let target = this.scope.lookup(name);
25110
+ const target = this.scope.lookup(name);
25111
+ if (target instanceof LetDeclaration && ast.receiver instanceof ThisReceiver) {
25112
+ return;
25113
+ }
25559
25114
  if (target !== null) {
25560
25115
  this.bindings.set(ast, target);
25561
25116
  }
@@ -26292,7 +25847,7 @@ function publishFacade(global) {
26292
25847
  }
26293
25848
 
26294
25849
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/version.mjs
26295
- var VERSION2 = new Version("18.0.1");
25850
+ var VERSION2 = new Version("18.0.3");
26296
25851
 
26297
25852
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
26298
25853
  var _I18N_ATTR = "i18n";
@@ -26469,6 +26024,8 @@ var _Visitor3 = class {
26469
26024
  }
26470
26025
  visitBlockParameter(parameter, context) {
26471
26026
  }
26027
+ visitLetDeclaration(decl, context) {
26028
+ }
26472
26029
  _init(mode, interpolationConfig) {
26473
26030
  this._mode = mode;
26474
26031
  this._inI18nBlock = false;
@@ -26634,7 +26191,7 @@ var XmlParser = class extends Parser2 {
26634
26191
  super(getXmlTagDefinition);
26635
26192
  }
26636
26193
  parse(source, url, options = {}) {
26637
- return super.parse(source, url, __spreadProps(__spreadValues({}, options), { tokenizeBlocks: false }));
26194
+ return super.parse(source, url, __spreadProps(__spreadValues({}, options), { tokenizeBlocks: false, tokenizeLet: false }));
26638
26195
  }
26639
26196
  };
26640
26197
 
@@ -26848,6 +26405,8 @@ var XliffParser = class {
26848
26405
  }
26849
26406
  visitBlockParameter(parameter, context) {
26850
26407
  }
26408
+ visitLetDeclaration(decl, context) {
26409
+ }
26851
26410
  _addError(node, message) {
26852
26411
  this._errors.push(new I18nError(node.sourceSpan, message));
26853
26412
  }
@@ -26901,6 +26460,8 @@ var XmlToI18n = class {
26901
26460
  }
26902
26461
  visitBlockParameter(parameter, context) {
26903
26462
  }
26463
+ visitLetDeclaration(decl, context) {
26464
+ }
26904
26465
  _addError(node, message) {
26905
26466
  this._errors.push(new I18nError(node.sourceSpan, message));
26906
26467
  }
@@ -27155,6 +26716,8 @@ var Xliff2Parser = class {
27155
26716
  }
27156
26717
  visitBlockParameter(parameter, context) {
27157
26718
  }
26719
+ visitLetDeclaration(decl, context) {
26720
+ }
27158
26721
  _addError(node, message) {
27159
26722
  this._errors.push(new I18nError(node.sourceSpan, message));
27160
26723
  }
@@ -27223,6 +26786,8 @@ var XmlToI18n2 = class {
27223
26786
  }
27224
26787
  visitBlockParameter(parameter, context) {
27225
26788
  }
26789
+ visitLetDeclaration(decl, context) {
26790
+ }
27226
26791
  _addError(node, message) {
27227
26792
  this._errors.push(new I18nError(node.sourceSpan, message));
27228
26793
  }
@@ -27386,7 +26951,7 @@ var MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = "18.0.0";
27386
26951
  function compileDeclareClassMetadata(metadata) {
27387
26952
  const definitionMap = new DefinitionMap();
27388
26953
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION));
27389
- definitionMap.set("version", literal("18.0.1"));
26954
+ definitionMap.set("version", literal("18.0.3"));
27390
26955
  definitionMap.set("ngImport", importExpr(Identifiers.core));
27391
26956
  definitionMap.set("type", metadata.type);
27392
26957
  definitionMap.set("decorators", metadata.decorators);
@@ -27405,7 +26970,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
27405
26970
  callbackReturnDefinitionMap.set("ctorParameters", (_a2 = metadata.ctorParameters) != null ? _a2 : literal(null));
27406
26971
  callbackReturnDefinitionMap.set("propDecorators", (_b2 = metadata.propDecorators) != null ? _b2 : literal(null));
27407
26972
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
27408
- definitionMap.set("version", literal("18.0.1"));
26973
+ definitionMap.set("version", literal("18.0.3"));
27409
26974
  definitionMap.set("ngImport", importExpr(Identifiers.core));
27410
26975
  definitionMap.set("type", metadata.type);
27411
26976
  definitionMap.set("resolveDeferredDeps", compileComponentMetadataAsyncResolver(dependencies));
@@ -27473,7 +27038,7 @@ function createDirectiveDefinitionMap(meta) {
27473
27038
  const definitionMap = new DefinitionMap();
27474
27039
  const minVersion = getMinimumVersionForPartialOutput(meta);
27475
27040
  definitionMap.set("minVersion", literal(minVersion));
27476
- definitionMap.set("version", literal("18.0.1"));
27041
+ definitionMap.set("version", literal("18.0.3"));
27477
27042
  definitionMap.set("type", meta.type.value);
27478
27043
  if (meta.isStandalone) {
27479
27044
  definitionMap.set("isStandalone", literal(meta.isStandalone));
@@ -27791,7 +27356,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION2 = "12.0.0";
27791
27356
  function compileDeclareFactoryFunction(meta) {
27792
27357
  const definitionMap = new DefinitionMap();
27793
27358
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION2));
27794
- definitionMap.set("version", literal("18.0.1"));
27359
+ definitionMap.set("version", literal("18.0.3"));
27795
27360
  definitionMap.set("ngImport", importExpr(Identifiers.core));
27796
27361
  definitionMap.set("type", meta.type.value);
27797
27362
  definitionMap.set("deps", compileDependencies(meta.deps));
@@ -27814,7 +27379,7 @@ function compileDeclareInjectableFromMetadata(meta) {
27814
27379
  function createInjectableDefinitionMap(meta) {
27815
27380
  const definitionMap = new DefinitionMap();
27816
27381
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION3));
27817
- definitionMap.set("version", literal("18.0.1"));
27382
+ definitionMap.set("version", literal("18.0.3"));
27818
27383
  definitionMap.set("ngImport", importExpr(Identifiers.core));
27819
27384
  definitionMap.set("type", meta.type.value);
27820
27385
  if (meta.providedIn !== void 0) {
@@ -27852,7 +27417,7 @@ function compileDeclareInjectorFromMetadata(meta) {
27852
27417
  function createInjectorDefinitionMap(meta) {
27853
27418
  const definitionMap = new DefinitionMap();
27854
27419
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION4));
27855
- definitionMap.set("version", literal("18.0.1"));
27420
+ definitionMap.set("version", literal("18.0.3"));
27856
27421
  definitionMap.set("ngImport", importExpr(Identifiers.core));
27857
27422
  definitionMap.set("type", meta.type.value);
27858
27423
  definitionMap.set("providers", meta.providers);
@@ -27876,7 +27441,7 @@ function createNgModuleDefinitionMap(meta) {
27876
27441
  throw new Error("Invalid path! Local compilation mode should not get into the partial compilation path");
27877
27442
  }
27878
27443
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION5));
27879
- definitionMap.set("version", literal("18.0.1"));
27444
+ definitionMap.set("version", literal("18.0.3"));
27880
27445
  definitionMap.set("ngImport", importExpr(Identifiers.core));
27881
27446
  definitionMap.set("type", meta.type.value);
27882
27447
  if (meta.bootstrap.length > 0) {
@@ -27911,7 +27476,7 @@ function compileDeclarePipeFromMetadata(meta) {
27911
27476
  function createPipeDefinitionMap(meta) {
27912
27477
  const definitionMap = new DefinitionMap();
27913
27478
  definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION6));
27914
- definitionMap.set("version", literal("18.0.1"));
27479
+ definitionMap.set("version", literal("18.0.3"));
27915
27480
  definitionMap.set("ngImport", importExpr(Identifiers.core));
27916
27481
  definitionMap.set("type", meta.type.value);
27917
27482
  if (meta.isStandalone) {
@@ -27928,7 +27493,7 @@ function createPipeDefinitionMap(meta) {
27928
27493
  publishFacade(_global);
27929
27494
 
27930
27495
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/version.mjs
27931
- var VERSION3 = new Version("18.0.1");
27496
+ var VERSION3 = new Version("18.0.3");
27932
27497
 
27933
27498
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/emitter.mjs
27934
27499
  var import_typescript5 = __toESM(require("typescript"), 1);
@@ -28004,6 +27569,9 @@ var ErrorCode;
28004
27569
  ErrorCode2[ErrorCode2["DEFERRED_PIPE_USED_EAGERLY"] = 8012] = "DEFERRED_PIPE_USED_EAGERLY";
28005
27570
  ErrorCode2[ErrorCode2["DEFERRED_DIRECTIVE_USED_EAGERLY"] = 8013] = "DEFERRED_DIRECTIVE_USED_EAGERLY";
28006
27571
  ErrorCode2[ErrorCode2["DEFERRED_DEPENDENCY_IMPORTED_EAGERLY"] = 8014] = "DEFERRED_DEPENDENCY_IMPORTED_EAGERLY";
27572
+ ErrorCode2[ErrorCode2["ILLEGAL_LET_WRITE"] = 8015] = "ILLEGAL_LET_WRITE";
27573
+ ErrorCode2[ErrorCode2["LET_USED_BEFORE_DEFINITION"] = 8016] = "LET_USED_BEFORE_DEFINITION";
27574
+ ErrorCode2[ErrorCode2["DUPLICATE_LET_DECLARATION"] = 8017] = "DUPLICATE_LET_DECLARATION";
28007
27575
  ErrorCode2[ErrorCode2["INVALID_BANANA_IN_BOX"] = 8101] = "INVALID_BANANA_IN_BOX";
28008
27576
  ErrorCode2[ErrorCode2["NULLISH_COALESCING_NOT_NULLABLE"] = 8102] = "NULLISH_COALESCING_NOT_NULLABLE";
28009
27577
  ErrorCode2[ErrorCode2["MISSING_CONTROL_FLOW_DIRECTIVE"] = 8103] = "MISSING_CONTROL_FLOW_DIRECTIVE";
@@ -37512,28 +37080,24 @@ function extractTemplate(node, template2, evaluator, depTracker, resourceLoader,
37512
37080
  }
37513
37081
  function parseExtractedTemplate(template2, sourceStr, sourceParseRange, escapedString, sourceMapUrl, options) {
37514
37082
  const i18nNormalizeLineEndingsInICUs = escapedString || options.i18nNormalizeLineEndingsInICUs;
37515
- const parsedTemplate = parseTemplate(sourceStr, sourceMapUrl != null ? sourceMapUrl : "", {
37516
- preserveWhitespaces: template2.preserveWhitespaces,
37083
+ const commonParseOptions = {
37517
37084
  interpolationConfig: template2.interpolationConfig,
37518
37085
  range: sourceParseRange != null ? sourceParseRange : void 0,
37519
- escapedString,
37520
37086
  enableI18nLegacyMessageIdFormat: options.enableI18nLegacyMessageIdFormat,
37521
37087
  i18nNormalizeLineEndingsInICUs,
37522
37088
  alwaysAttemptHtmlToR3AstConversion: options.usePoisonedData,
37523
- enableBlockSyntax: options.enableBlockSyntax
37524
- });
37525
- const { nodes: diagNodes } = parseTemplate(sourceStr, sourceMapUrl != null ? sourceMapUrl : "", {
37089
+ escapedString,
37090
+ enableBlockSyntax: options.enableBlockSyntax,
37091
+ enableLetSyntax: options.enableLetSyntax
37092
+ };
37093
+ const parsedTemplate = parseTemplate(sourceStr, sourceMapUrl != null ? sourceMapUrl : "", __spreadProps(__spreadValues({}, commonParseOptions), {
37094
+ preserveWhitespaces: template2.preserveWhitespaces
37095
+ }));
37096
+ const { nodes: diagNodes } = parseTemplate(sourceStr, sourceMapUrl != null ? sourceMapUrl : "", __spreadProps(__spreadValues({}, commonParseOptions), {
37526
37097
  preserveWhitespaces: true,
37527
37098
  preserveLineEndings: true,
37528
- interpolationConfig: template2.interpolationConfig,
37529
- range: sourceParseRange != null ? sourceParseRange : void 0,
37530
- escapedString,
37531
- enableI18nLegacyMessageIdFormat: options.enableI18nLegacyMessageIdFormat,
37532
- i18nNormalizeLineEndingsInICUs,
37533
- leadingTriviaChars: [],
37534
- alwaysAttemptHtmlToR3AstConversion: options.usePoisonedData,
37535
- enableBlockSyntax: options.enableBlockSyntax
37536
- });
37099
+ leadingTriviaChars: []
37100
+ }));
37537
37101
  return __spreadProps(__spreadValues({}, parsedTemplate), {
37538
37102
  diagNodes,
37539
37103
  file: new ParseSourceFile(sourceStr, sourceMapUrl != null ? sourceMapUrl : "")
@@ -37914,7 +37478,7 @@ var EMPTY_ARRAY2 = [];
37914
37478
  var isUsedDirective = (decl) => decl.kind === R3TemplateDependencyKind.Directive;
37915
37479
  var isUsedPipe = (decl) => decl.kind === R3TemplateDependencyKind.Pipe;
37916
37480
  var ComponentDecoratorHandler = class {
37917
- constructor(reflector, evaluator, metaRegistry, metaReader, scopeReader, dtsScopeReader, scopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, strictCtorDeps, resourceLoader, rootDirs, defaultPreserveWhitespaces, i18nUseExternalIds, enableI18nLegacyMessageIdFormat, usePoisonedData, i18nNormalizeLineEndingsInICUs, moduleResolver, cycleAnalyzer, cycleHandlingStrategy, refEmitter, referencesRegistry, depTracker, injectableRegistry, semanticDepGraphUpdater, annotateForClosureCompiler, perf, hostDirectivesResolver, importTracker, includeClassMetadata, compilationMode, deferredSymbolTracker, forbidOrphanRendering, enableBlockSyntax, localCompilationExtraImportsTracker) {
37481
+ constructor(reflector, evaluator, metaRegistry, metaReader, scopeReader, dtsScopeReader, scopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, strictCtorDeps, resourceLoader, rootDirs, defaultPreserveWhitespaces, i18nUseExternalIds, enableI18nLegacyMessageIdFormat, usePoisonedData, i18nNormalizeLineEndingsInICUs, moduleResolver, cycleAnalyzer, cycleHandlingStrategy, refEmitter, referencesRegistry, depTracker, injectableRegistry, semanticDepGraphUpdater, annotateForClosureCompiler, perf, hostDirectivesResolver, importTracker, includeClassMetadata, compilationMode, deferredSymbolTracker, forbidOrphanRendering, enableBlockSyntax, enableLetSyntax, localCompilationExtraImportsTracker) {
37918
37482
  this.reflector = reflector;
37919
37483
  this.evaluator = evaluator;
37920
37484
  this.metaRegistry = metaRegistry;
@@ -37950,6 +37514,7 @@ var ComponentDecoratorHandler = class {
37950
37514
  this.deferredSymbolTracker = deferredSymbolTracker;
37951
37515
  this.forbidOrphanRendering = forbidOrphanRendering;
37952
37516
  this.enableBlockSyntax = enableBlockSyntax;
37517
+ this.enableLetSyntax = enableLetSyntax;
37953
37518
  this.localCompilationExtraImportsTracker = localCompilationExtraImportsTracker;
37954
37519
  this.literalCache = /* @__PURE__ */ new Map();
37955
37520
  this.elementSchemaRegistry = new DomElementSchemaRegistry();
@@ -37961,7 +37526,8 @@ var ComponentDecoratorHandler = class {
37961
37526
  enableI18nLegacyMessageIdFormat: this.enableI18nLegacyMessageIdFormat,
37962
37527
  i18nNormalizeLineEndingsInICUs: this.i18nNormalizeLineEndingsInICUs,
37963
37528
  usePoisonedData: this.usePoisonedData,
37964
- enableBlockSyntax: this.enableBlockSyntax
37529
+ enableBlockSyntax: this.enableBlockSyntax,
37530
+ enableLetSyntax: this.enableLetSyntax
37965
37531
  };
37966
37532
  }
37967
37533
  detect(node, decorators) {
@@ -38132,7 +37698,8 @@ var ComponentDecoratorHandler = class {
38132
37698
  enableI18nLegacyMessageIdFormat: this.enableI18nLegacyMessageIdFormat,
38133
37699
  i18nNormalizeLineEndingsInICUs: this.i18nNormalizeLineEndingsInICUs,
38134
37700
  usePoisonedData: this.usePoisonedData,
38135
- enableBlockSyntax: this.enableBlockSyntax
37701
+ enableBlockSyntax: this.enableBlockSyntax,
37702
+ enableLetSyntax: this.enableLetSyntax
38136
37703
  }, this.compilationMode);
38137
37704
  }
38138
37705
  const templateResource = template2.declaration.isInline ? { path: null, expression: component.get("template") } : {
@@ -39723,17 +39290,20 @@ var FunctionExtractor = class {
39723
39290
  this.typeChecker = typeChecker;
39724
39291
  }
39725
39292
  extract() {
39293
+ var _a2;
39726
39294
  const signature = this.typeChecker.getSignatureFromDeclaration(this.declaration);
39727
39295
  const returnType = signature ? this.typeChecker.typeToString(this.typeChecker.getReturnTypeOfSignature(signature)) : "unknown";
39296
+ const jsdocsTags = extractJsDocTags(this.declaration);
39728
39297
  return {
39729
39298
  params: extractAllParams(this.declaration.parameters, this.typeChecker),
39730
39299
  name: this.name,
39731
39300
  isNewType: import_typescript75.default.isConstructSignatureDeclaration(this.declaration),
39732
39301
  returnType,
39302
+ returnDescription: (_a2 = jsdocsTags.find((tag) => tag.name === "returns")) == null ? void 0 : _a2.comment,
39733
39303
  entryType: EntryType.Function,
39734
39304
  generics: extractGenerics(this.declaration),
39735
39305
  description: extractJsDocDescription(this.declaration),
39736
- jsdocTags: extractJsDocTags(this.declaration),
39306
+ jsdocTags: jsdocsTags,
39737
39307
  rawComment: extractRawJsDoc(this.declaration)
39738
39308
  };
39739
39309
  }
@@ -41247,6 +40817,7 @@ var IdentifierKind;
41247
40817
  IdentifierKind2[IdentifierKind2["Attribute"] = 4] = "Attribute";
41248
40818
  IdentifierKind2[IdentifierKind2["Reference"] = 5] = "Reference";
41249
40819
  IdentifierKind2[IdentifierKind2["Variable"] = 6] = "Variable";
40820
+ IdentifierKind2[IdentifierKind2["LetDeclaration"] = 7] = "LetDeclaration";
41250
40821
  })(IdentifierKind || (IdentifierKind = {}));
41251
40822
  var AbsoluteSourceSpan2 = class {
41252
40823
  constructor(start, end) {
@@ -41427,6 +40998,13 @@ var TemplateVisitor = class extends RecursiveVisitor {
41427
40998
  (_a2 = block.expressionAlias) == null ? void 0 : _a2.visit(this);
41428
40999
  this.visitAll(block.children);
41429
41000
  }
41001
+ visitLetDeclaration(decl) {
41002
+ const identifier = this.targetToIdentifier(decl);
41003
+ if (identifier !== null) {
41004
+ this.identifiers.add(identifier);
41005
+ }
41006
+ this.visitExpression(decl.value);
41007
+ }
41430
41008
  elementOrTemplateToIdentifier(node) {
41431
41009
  var _a2;
41432
41010
  if (this.elementAndTemplateIdentifierCache.has(node)) {
@@ -41510,12 +41088,18 @@ var TemplateVisitor = class extends RecursiveVisitor {
41510
41088
  kind: IdentifierKind.Reference,
41511
41089
  target
41512
41090
  };
41513
- } else {
41091
+ } else if (node instanceof Variable) {
41514
41092
  identifier = {
41515
41093
  name,
41516
41094
  span,
41517
41095
  kind: IdentifierKind.Variable
41518
41096
  };
41097
+ } else {
41098
+ identifier = {
41099
+ name,
41100
+ span,
41101
+ kind: IdentifierKind.LetDeclaration
41102
+ };
41519
41103
  }
41520
41104
  this.targetIdentifierCache.set(node, identifier);
41521
41105
  return identifier;
@@ -41931,6 +41515,7 @@ var CompletionKind;
41931
41515
  (function(CompletionKind2) {
41932
41516
  CompletionKind2[CompletionKind2["Reference"] = 0] = "Reference";
41933
41517
  CompletionKind2[CompletionKind2["Variable"] = 1] = "Variable";
41518
+ CompletionKind2[CompletionKind2["LetDeclaration"] = 2] = "LetDeclaration";
41934
41519
  })(CompletionKind || (CompletionKind = {}));
41935
41520
 
41936
41521
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/api/scope.mjs
@@ -41959,6 +41544,7 @@ var SymbolKind;
41959
41544
  SymbolKind2[SymbolKind2["Expression"] = 8] = "Expression";
41960
41545
  SymbolKind2[SymbolKind2["DomBinding"] = 9] = "DomBinding";
41961
41546
  SymbolKind2[SymbolKind2["Pipe"] = 10] = "Pipe";
41547
+ SymbolKind2[SymbolKind2["LetDeclaration"] = 11] = "LetDeclaration";
41962
41548
  })(SymbolKind || (SymbolKind = {}));
41963
41549
 
41964
41550
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/diagnostic.mjs
@@ -42367,6 +41953,11 @@ var CompletionEngine = class {
42367
41953
  kind: CompletionKind.Reference,
42368
41954
  node
42369
41955
  });
41956
+ } else if (node instanceof LetDeclaration) {
41957
+ templateContext.set(node.name, {
41958
+ kind: CompletionKind.LetDeclaration,
41959
+ node
41960
+ });
42370
41961
  } else {
42371
41962
  templateContext.set(node.name, {
42372
41963
  kind: CompletionKind.Variable,
@@ -43620,7 +43211,7 @@ function tsDeclareVariable(id, type) {
43620
43211
  function tsCreateTypeQueryForCoercedInput(typeName, coercedInputName) {
43621
43212
  return import_typescript97.default.factory.createTypeQueryNode(import_typescript97.default.factory.createQualifiedName(typeName, `ngAcceptInputType_${coercedInputName}`));
43622
43213
  }
43623
- function tsCreateVariable(id, initializer) {
43214
+ function tsCreateVariable(id, initializer, flags = null) {
43624
43215
  const decl = import_typescript97.default.factory.createVariableDeclaration(
43625
43216
  id,
43626
43217
  void 0,
@@ -43629,7 +43220,7 @@ function tsCreateVariable(id, initializer) {
43629
43220
  );
43630
43221
  return import_typescript97.default.factory.createVariableStatement(
43631
43222
  void 0,
43632
- [decl]
43223
+ flags === null ? [decl] : import_typescript97.default.factory.createVariableDeclarationList([decl], flags)
43633
43224
  );
43634
43225
  }
43635
43226
  function tsCallMethod(receiver, methodName, args = []) {
@@ -44195,6 +43786,25 @@ Deferred blocks can only access triggers in same view, a parent embedded view or
44195
43786
  lines.push("", 'This check can be disabled using the `extendedDiagnostics.checks.controlFlowPreventingContentProjection = "suppress" compiler option.`');
44196
43787
  this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), projectionNode.startSourceSpan, category, ngErrorCode(ErrorCode.CONTROL_FLOW_PREVENTING_CONTENT_PROJECTION), lines.join("\n")));
44197
43788
  }
43789
+ illegalWriteToLetDeclaration(templateId, node, target) {
43790
+ const sourceSpan = this.resolver.toParseSourceSpan(templateId, node.sourceSpan);
43791
+ if (sourceSpan === null) {
43792
+ throw new Error(`Assertion failure: no SourceLocation found for property write.`);
43793
+ }
43794
+ this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), sourceSpan, import_typescript103.default.DiagnosticCategory.Error, ngErrorCode(ErrorCode.ILLEGAL_LET_WRITE), `Cannot assign to @let declaration '${target.name}'.`));
43795
+ }
43796
+ letUsedBeforeDefinition(templateId, node, target) {
43797
+ const sourceSpan = this.resolver.toParseSourceSpan(templateId, node.sourceSpan);
43798
+ if (sourceSpan === null) {
43799
+ throw new Error(`Assertion failure: no SourceLocation found for property read.`);
43800
+ }
43801
+ this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), sourceSpan, import_typescript103.default.DiagnosticCategory.Error, ngErrorCode(ErrorCode.LET_USED_BEFORE_DEFINITION), `Cannot read @let declaration '${target.name}' before it has been defined.`));
43802
+ }
43803
+ duplicateLetDeclaration(templateId, current) {
43804
+ const mapping = this.resolver.getSourceMapping(templateId);
43805
+ const errorMsg = `Cannot declare @let called '${current.name}' as there is another @let declaration with the same name.`;
43806
+ this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, current.sourceSpan, import_typescript103.default.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DUPLICATE_LET_DECLARATION), errorMsg));
43807
+ }
44198
43808
  };
44199
43809
  function makeInlineDiagnostic(templateId, code, node, messageText, relatedInformation) {
44200
43810
  return __spreadProps(__spreadValues({}, makeDiagnostic(code, node, messageText, relatedInformation)), {
@@ -44731,6 +44341,24 @@ var TcbTemplateContextOp = class extends TcbOp {
44731
44341
  return ctx;
44732
44342
  }
44733
44343
  };
44344
+ var TcbLetDeclarationOp = class extends TcbOp {
44345
+ constructor(tcb, scope, node) {
44346
+ super();
44347
+ this.tcb = tcb;
44348
+ this.scope = scope;
44349
+ this.node = node;
44350
+ this.optional = false;
44351
+ }
44352
+ execute() {
44353
+ const id = this.tcb.allocateId();
44354
+ addParseSpanInfo(id, this.node.nameSpan);
44355
+ const value = tcbExpression(this.node.value, this.tcb, this.scope);
44356
+ const varStatement = tsCreateVariable(id, wrapForTypeChecker(value), import_typescript107.default.NodeFlags.Const);
44357
+ addParseSpanInfo(varStatement.declarationList.declarations[0], this.node.sourceSpan);
44358
+ this.scope.addStatement(varStatement);
44359
+ return id;
44360
+ }
44361
+ };
44734
44362
  var TcbTemplateBodyOp = class extends TcbOp {
44735
44363
  constructor(tcb, scope, template2) {
44736
44364
  super();
@@ -45534,6 +45162,7 @@ var _Scope = class {
45534
45162
  this.referenceOpMap = /* @__PURE__ */ new Map();
45535
45163
  this.templateCtxOpMap = /* @__PURE__ */ new Map();
45536
45164
  this.varMap = /* @__PURE__ */ new Map();
45165
+ this.letDeclOpMap = /* @__PURE__ */ new Map();
45537
45166
  this.statements = [];
45538
45167
  }
45539
45168
  static forNodes(tcb, parentScope, scopedNode, children, guard) {
@@ -45571,6 +45200,14 @@ var _Scope = class {
45571
45200
  }
45572
45201
  for (const node of children) {
45573
45202
  scope.appendNode(node);
45203
+ if (node instanceof LetDeclaration) {
45204
+ const opIndex = scope.opQueue.push(new TcbLetDeclarationOp(tcb, scope, node)) - 1;
45205
+ if (scope.letDeclOpMap.has(node.name)) {
45206
+ tcb.oobRecorder.duplicateLetDeclaration(tcb.id, node);
45207
+ } else {
45208
+ scope.letDeclOpMap.set(node.name, opIndex);
45209
+ }
45210
+ }
45574
45211
  }
45575
45212
  return scope;
45576
45213
  }
@@ -45621,9 +45258,20 @@ var _Scope = class {
45621
45258
  return import_typescript107.default.factory.createBinaryExpression(parentGuards, import_typescript107.default.SyntaxKind.AmpersandAmpersandToken, this.guard);
45622
45259
  }
45623
45260
  }
45261
+ isLocal(node) {
45262
+ if (node instanceof Variable) {
45263
+ return this.varMap.has(node);
45264
+ }
45265
+ if (node instanceof LetDeclaration) {
45266
+ return this.letDeclOpMap.has(node.name);
45267
+ }
45268
+ return this.referenceOpMap.has(node);
45269
+ }
45624
45270
  resolveLocal(ref, directive) {
45625
45271
  if (ref instanceof Reference && this.referenceOpMap.has(ref)) {
45626
45272
  return this.resolveOp(this.referenceOpMap.get(ref));
45273
+ } else if (ref instanceof LetDeclaration && this.letDeclOpMap.has(ref.name)) {
45274
+ return this.resolveOp(this.letDeclOpMap.get(ref.name));
45627
45275
  } else if (ref instanceof Variable && this.varMap.has(ref)) {
45628
45276
  const opIndexOrNode = this.varMap.get(ref);
45629
45277
  return typeof opIndexOrNode === "number" ? this.resolveOp(opIndexOrNode) : opIndexOrNode;
@@ -45900,15 +45548,24 @@ var TcbExpressionTranslator = class {
45900
45548
  }
45901
45549
  resolve(ast) {
45902
45550
  if (ast instanceof PropertyRead && ast.receiver instanceof ImplicitReceiver) {
45903
- return this.resolveTarget(ast);
45551
+ const target = this.tcb.boundTarget.getExpressionTarget(ast);
45552
+ if (target instanceof LetDeclaration) {
45553
+ this.validateLetDeclarationAccess(target, ast);
45554
+ }
45555
+ return target === null ? null : this.getTargetNodeExpression(target, ast);
45904
45556
  } else if (ast instanceof PropertyWrite && ast.receiver instanceof ImplicitReceiver) {
45905
- const target = this.resolveTarget(ast);
45557
+ const target = this.tcb.boundTarget.getExpressionTarget(ast);
45906
45558
  if (target === null) {
45907
45559
  return null;
45908
45560
  }
45561
+ const targetExpression = this.getTargetNodeExpression(target, ast);
45909
45562
  const expr = this.translate(ast.value);
45910
- const result = import_typescript107.default.factory.createParenthesizedExpression(import_typescript107.default.factory.createBinaryExpression(target, import_typescript107.default.SyntaxKind.EqualsToken, expr));
45563
+ const result = import_typescript107.default.factory.createParenthesizedExpression(import_typescript107.default.factory.createBinaryExpression(targetExpression, import_typescript107.default.SyntaxKind.EqualsToken, expr));
45911
45564
  addParseSpanInfo(result, ast.sourceSpan);
45565
+ if (target instanceof LetDeclaration) {
45566
+ markIgnoreDiagnostics(result);
45567
+ this.tcb.oobRecorder.illegalWriteToLetDeclaration(this.tcb.id, ast, target);
45568
+ }
45912
45569
  return result;
45913
45570
  } else if (ast instanceof ImplicitReceiver) {
45914
45571
  return import_typescript107.default.factory.createThis();
@@ -45946,10 +45603,11 @@ var TcbExpressionTranslator = class {
45946
45603
  addParseSpanInfo(result, ast.sourceSpan);
45947
45604
  return result;
45948
45605
  }
45949
- const receiver = this.resolveTarget(ast);
45950
- if (receiver === null) {
45606
+ const target = this.tcb.boundTarget.getExpressionTarget(ast);
45607
+ if (target === null) {
45951
45608
  return null;
45952
45609
  }
45610
+ const receiver = this.getTargetNodeExpression(target, ast);
45953
45611
  const method = wrapForDiagnostics(receiver);
45954
45612
  addParseSpanInfo(method, ast.receiver.nameSpan);
45955
45613
  const args = ast.args.map((arg) => this.translate(arg));
@@ -45960,15 +45618,19 @@ var TcbExpressionTranslator = class {
45960
45618
  return null;
45961
45619
  }
45962
45620
  }
45963
- resolveTarget(ast) {
45964
- const binding = this.tcb.boundTarget.getExpressionTarget(ast);
45965
- if (binding === null) {
45966
- return null;
45967
- }
45968
- const expr = this.scope.resolve(binding);
45969
- addParseSpanInfo(expr, ast.sourceSpan);
45621
+ getTargetNodeExpression(targetNode, expressionNode) {
45622
+ const expr = this.scope.resolve(targetNode);
45623
+ addParseSpanInfo(expr, expressionNode.sourceSpan);
45970
45624
  return expr;
45971
45625
  }
45626
+ validateLetDeclarationAccess(target, ast) {
45627
+ const targetStart = target.sourceSpan.start.offset;
45628
+ const targetEnd = target.sourceSpan.end.offset;
45629
+ const astStart = ast.sourceSpan.start;
45630
+ if ((targetStart > astStart || astStart >= targetStart && astStart <= targetEnd) && this.scope.isLocal(target)) {
45631
+ this.tcb.oobRecorder.letUsedBeforeDefinition(this.tcb.id, ast, target);
45632
+ }
45633
+ }
45972
45634
  };
45973
45635
  function tcbCallTypeCtor(dir, tcb, inputs) {
45974
45636
  const typeCtor = tcb.env.typeCtorFor(dir);
@@ -46111,6 +45773,8 @@ var TcbEventHandlerTranslator = class extends TcbExpressionTranslator {
46111
45773
  }
46112
45774
  return super.resolve(ast);
46113
45775
  }
45776
+ validateLetDeclarationAccess() {
45777
+ }
46114
45778
  };
46115
45779
  var TcbForLoopTrackTranslator = class extends TcbExpressionTranslator {
46116
45780
  constructor(tcb, scope, block) {
@@ -46126,7 +45790,7 @@ var TcbForLoopTrackTranslator = class extends TcbExpressionTranslator {
46126
45790
  resolve(ast) {
46127
45791
  if (ast instanceof PropertyRead && ast.receiver instanceof ImplicitReceiver) {
46128
45792
  const target = this.tcb.boundTarget.getExpressionTarget(ast);
46129
- if (target !== null && !this.allowedVariables.has(target)) {
45793
+ if (target !== null && (!(target instanceof Variable) || !this.allowedVariables.has(target))) {
46130
45794
  this.tcb.oobRecorder.illegalForLoopTrackAccess(this.tcb.id, this.block, ast);
46131
45795
  }
46132
45796
  }
@@ -46553,6 +46217,8 @@ var SymbolBuilder = class {
46553
46217
  symbol = this.getSymbolOfAstTemplate(node);
46554
46218
  } else if (node instanceof Variable) {
46555
46219
  symbol = this.getSymbolOfVariable(node);
46220
+ } else if (node instanceof LetDeclaration) {
46221
+ symbol = this.getSymbolOfLetDeclaration(node);
46556
46222
  } else if (node instanceof Reference) {
46557
46223
  symbol = this.getSymbolOfReference(node);
46558
46224
  } else if (node instanceof BindingPipe) {
@@ -46936,6 +46602,31 @@ var SymbolBuilder = class {
46936
46602
  };
46937
46603
  }
46938
46604
  }
46605
+ getSymbolOfLetDeclaration(decl) {
46606
+ const node = findFirstMatchingNode(this.typeCheckBlock, {
46607
+ withSpan: decl.sourceSpan,
46608
+ filter: import_typescript110.default.isVariableDeclaration
46609
+ });
46610
+ if (node === null) {
46611
+ return null;
46612
+ }
46613
+ const nodeValueSymbol = this.getSymbolOfTsNode(node.initializer);
46614
+ if (nodeValueSymbol === null) {
46615
+ return null;
46616
+ }
46617
+ return {
46618
+ tsType: nodeValueSymbol.tsType,
46619
+ tsSymbol: nodeValueSymbol.tsSymbol,
46620
+ initializerLocation: nodeValueSymbol.tcbLocation,
46621
+ kind: SymbolKind.LetDeclaration,
46622
+ declaration: decl,
46623
+ localVarLocation: {
46624
+ tcbPath: this.tcbPath,
46625
+ isShimFile: this.tcbIsShim,
46626
+ positionInFile: this.getTcbPositionForNode(node.name)
46627
+ }
46628
+ };
46629
+ }
46939
46630
  getSymbolOfPipe(expression) {
46940
46631
  const methodAccess = findFirstMatchingNode(this.typeCheckBlock, {
46941
46632
  withSpan: expression.nameSpan,
@@ -47776,7 +47467,7 @@ var SIGNAL_FNS = /* @__PURE__ */ new Set([
47776
47467
  "ModelSignal"
47777
47468
  ]);
47778
47469
  function isSignalReference(symbol) {
47779
- return (symbol.kind === SymbolKind.Expression || symbol.kind === SymbolKind.Variable) && (symbol.tsType.symbol !== void 0 && isSignalSymbol(symbol.tsType.symbol) || symbol.tsType.aliasSymbol !== void 0 && isSignalSymbol(symbol.tsType.aliasSymbol));
47470
+ return (symbol.kind === SymbolKind.Expression || symbol.kind === SymbolKind.Variable || symbol.kind === SymbolKind.LetDeclaration) && (symbol.tsType.symbol !== void 0 && isSignalSymbol(symbol.tsType.symbol) || symbol.tsType.aliasSymbol !== void 0 && isSignalSymbol(symbol.tsType.aliasSymbol));
47780
47471
  }
47781
47472
  function isSignalSymbol(symbol) {
47782
47473
  const declarations = symbol.getDeclarations();
@@ -47903,6 +47594,9 @@ var TemplateVisitor2 = class extends RecursiveAstVisitor2 {
47903
47594
  (_a2 = block.expressionAlias) == null ? void 0 : _a2.visit(this);
47904
47595
  this.visitAllNodes(block.children);
47905
47596
  }
47597
+ visitLetDeclaration(decl) {
47598
+ this.visitAst(decl.value);
47599
+ }
47906
47600
  getDiagnostics(template2) {
47907
47601
  this.diagnostics = [];
47908
47602
  this.visitAllNodes(template2);
@@ -48350,22 +48044,29 @@ var ExpressionsSemanticsVisitor = class extends RecursiveAstVisitor2 {
48350
48044
  return;
48351
48045
  }
48352
48046
  const target = this.templateTypeChecker.getExpressionTarget(ast, this.component);
48353
- if (!(target instanceof Variable)) {
48047
+ const isVariable2 = target instanceof Variable;
48048
+ const isLet = target instanceof LetDeclaration;
48049
+ if (!isVariable2 && !isLet) {
48354
48050
  return;
48355
48051
  }
48356
48052
  const symbol = this.templateTypeChecker.getSymbolOfNode(target, this.component);
48357
48053
  if (symbol !== null && !isSignalReference(symbol)) {
48358
- const errorMessage = `Cannot use a non-signal variable '${target.name}' in a two-way binding expression. Template variables are read-only.`;
48054
+ let errorMessage;
48055
+ if (isVariable2) {
48056
+ errorMessage = `Cannot use a non-signal variable '${target.name}' in a two-way binding expression. Template variables are read-only.`;
48057
+ } else {
48058
+ errorMessage = `Cannot use non-signal @let declaration '${target.name}' in a two-way binding expression. @let declarations are read-only.`;
48059
+ }
48359
48060
  this.diagnostics.push(this.makeIllegalTemplateVarDiagnostic(target, context, errorMessage));
48360
48061
  }
48361
48062
  }
48362
48063
  makeIllegalTemplateVarDiagnostic(target, expressionNode, errorMessage) {
48363
- var _a2, _b2;
48064
+ const span = target instanceof Variable ? target.valueSpan || target.sourceSpan : target.sourceSpan;
48364
48065
  return this.templateTypeChecker.makeTemplateDiagnostic(this.component, expressionNode.handlerSpan, import_typescript117.default.DiagnosticCategory.Error, ngErrorCode(ErrorCode.WRITE_TO_READ_ONLY_VARIABLE), errorMessage, [
48365
48066
  {
48366
- text: `The variable ${target.name} is declared here.`,
48367
- start: ((_a2 = target.valueSpan) == null ? void 0 : _a2.start.offset) || target.sourceSpan.start.offset,
48368
- end: ((_b2 = target.valueSpan) == null ? void 0 : _b2.end.offset) || target.sourceSpan.end.offset,
48067
+ text: `'${target.name}' is declared here.`,
48068
+ start: span.start.offset,
48069
+ end: span.end.offset,
48369
48070
  sourceFile: this.component.getSourceFile()
48370
48071
  }
48371
48072
  ]);
@@ -48547,7 +48248,7 @@ var NgCompiler = class {
48547
48248
  }
48548
48249
  }
48549
48250
  constructor(adapter, options, inputProgram, programDriver, incrementalStrategy, incrementalCompilation, enableTemplateTypeChecker, usePoisonedData, livePerfRecorder) {
48550
- var _a2, _b2, _c2;
48251
+ var _a2, _b2, _c2, _d2;
48551
48252
  this.adapter = adapter;
48552
48253
  this.options = options;
48553
48254
  this.inputProgram = inputProgram;
@@ -48562,7 +48263,8 @@ var NgCompiler = class {
48562
48263
  this.delegatingPerfRecorder = new DelegatingPerfRecorder(this.perfRecorder);
48563
48264
  this.enableTemplateTypeChecker = enableTemplateTypeChecker || ((_a2 = options["_enableTemplateTypeChecker"]) != null ? _a2 : false);
48564
48265
  this.enableBlockSyntax = (_b2 = options["_enableBlockSyntax"]) != null ? _b2 : true;
48565
- this.angularCoreVersion = (_c2 = options["_angularCoreVersion"]) != null ? _c2 : null;
48266
+ this.enableLetSyntax = (_c2 = options["_enableLetSyntax"]) != null ? _c2 : false;
48267
+ this.angularCoreVersion = (_d2 = options["_angularCoreVersion"]) != null ? _d2 : null;
48566
48268
  this.constructionDiagnostics.push(...this.adapter.constructionDiagnostics, ...verifyCompatibleTypeCheckOptions(this.options));
48567
48269
  this.currentProgram = inputProgram;
48568
48270
  this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
@@ -49079,7 +48781,7 @@ var NgCompiler = class {
49079
48781
  throw new Error('JIT mode support ("supportJitMode" option) cannot be disabled when forbidOrphanComponents is set to true');
49080
48782
  }
49081
48783
  const handlers = [
49082
- new ComponentDecoratorHandler(reflector, evaluator, metaRegistry, metaReader, scopeReader, depScopeReader, ngModuleScopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, strictCtorDeps, this.resourceManager, this.adapter.rootDirs, this.options.preserveWhitespaces || false, this.options.i18nUseExternalIds !== false, this.options.enableI18nLegacyMessageIdFormat !== false, this.usePoisonedData, this.options.i18nNormalizeLineEndingsInICUs === true, this.moduleResolver, this.cycleAnalyzer, cycleHandlingStrategy, refEmitter, referencesRegistry, this.incrementalCompilation.depGraph, injectableRegistry, semanticDepGraphUpdater, this.closureCompilerEnabled, this.delegatingPerfRecorder, hostDirectivesResolver, importTracker, supportTestBed, compilationMode, deferredSymbolsTracker, !!this.options.forbidOrphanComponents, this.enableBlockSyntax, localCompilationExtraImportsTracker),
48784
+ new ComponentDecoratorHandler(reflector, evaluator, metaRegistry, metaReader, scopeReader, depScopeReader, ngModuleScopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, strictCtorDeps, this.resourceManager, this.adapter.rootDirs, this.options.preserveWhitespaces || false, this.options.i18nUseExternalIds !== false, this.options.enableI18nLegacyMessageIdFormat !== false, this.usePoisonedData, this.options.i18nNormalizeLineEndingsInICUs === true, this.moduleResolver, this.cycleAnalyzer, cycleHandlingStrategy, refEmitter, referencesRegistry, this.incrementalCompilation.depGraph, injectableRegistry, semanticDepGraphUpdater, this.closureCompilerEnabled, this.delegatingPerfRecorder, hostDirectivesResolver, importTracker, supportTestBed, compilationMode, deferredSymbolsTracker, !!this.options.forbidOrphanComponents, this.enableBlockSyntax, this.enableLetSyntax, localCompilationExtraImportsTracker),
49083
48785
  new DirectiveDecoratorHandler(reflector, evaluator, metaRegistry, ngModuleScopeRegistry, metaReader, injectableRegistry, refEmitter, referencesRegistry, isCore, strictCtorDeps, semanticDepGraphUpdater, this.closureCompilerEnabled, this.delegatingPerfRecorder, importTracker, supportTestBed, compilationMode, !!this.options.generateExtraImportsInLocalMode),
49084
48786
  new PipeDecoratorHandler(reflector, evaluator, metaRegistry, ngModuleScopeRegistry, injectableRegistry, isCore, this.delegatingPerfRecorder, supportTestBed, compilationMode, !!this.options.generateExtraImportsInLocalMode),
49085
48787
  new InjectableDecoratorHandler(reflector, evaluator, isCore, strictCtorDeps, injectableRegistry, this.delegatingPerfRecorder, supportTestBed, compilationMode),
@@ -50870,7 +50572,7 @@ function analyzeTestingModules(testObjects, typeChecker) {
50870
50572
  continue;
50871
50573
  }
50872
50574
  const importsProp = findLiteralProperty(obj, "imports");
50873
- const importElements = importsProp && hasNgModuleMetadataElements(importsProp) ? importsProp.initializer.elements.filter((el) => {
50575
+ const importElements = importsProp && hasNgModuleMetadataElements(importsProp) && import_typescript136.default.isArrayLiteralExpression(importsProp.initializer) ? importsProp.initializer.elements.filter((el) => {
50874
50576
  return !import_typescript136.default.isCallExpression(el) && !isClassReferenceInAngularModule(el, /^BrowserAnimationsModule|NoopAnimationsModule$/, "platform-browser/animations", typeChecker);
50875
50577
  }) : null;
50876
50578
  for (const decl of declarations) {
@@ -50897,7 +50599,7 @@ function analyzeTestingModules(testObjects, typeChecker) {
50897
50599
  function extractDeclarationsFromTestObject(obj, typeChecker) {
50898
50600
  const results = [];
50899
50601
  const declarations = findLiteralProperty(obj, "declarations");
50900
- if (declarations && hasNgModuleMetadataElements(declarations)) {
50602
+ if (declarations && hasNgModuleMetadataElements(declarations) && import_typescript136.default.isArrayLiteralExpression(declarations.initializer)) {
50901
50603
  for (const element2 of declarations.initializer.elements) {
50902
50604
  const declaration = findClassDeclaration(element2, typeChecker);
50903
50605
  if (declaration && declaration.getSourceFile().fileName === obj.getSourceFile().fileName) {