@markw65/monkeyc-optimizer 1.1.80 → 1.1.82

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.
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_3KM4FHVN_exports = {};
30
- __export(chunk_3KM4FHVN_exports, {
29
+ var chunk_TLXMWGYI_exports = {};
30
+ __export(chunk_TLXMWGYI_exports, {
31
31
  EnumTagsConst: () => EnumTagsConst,
32
32
  LastTypeTag: () => LastTypeTag,
33
33
  ObjectLikeTagsConst: () => ObjectLikeTagsConst,
@@ -139,8 +139,8 @@ __export(chunk_3KM4FHVN_exports, {
139
139
  visitorNode: () => visitorNode,
140
140
  xml_util_exports: () => xml_util_exports
141
141
  });
142
- module.exports = __toCommonJS(chunk_3KM4FHVN_exports);
143
- var import_chunk_NHZRKHZO = require("./chunk-NHZRKHZO.cjs");
142
+ module.exports = __toCommonJS(chunk_TLXMWGYI_exports);
143
+ var import_chunk_X7QCZR3F = require("./chunk-X7QCZR3F.cjs");
144
144
  var import_chunk_JDC43A3I = require("./chunk-JDC43A3I.cjs");
145
145
  var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
146
146
  var import_node_assert = __toESM(require("node:assert"));
@@ -5726,6 +5726,12 @@ var init_build_config = (0, import_chunk_ABYVSU2C.__esm)({
5726
5726
  default: "YES",
5727
5727
  scope: "resource"
5728
5728
  },
5729
+ extraReferenceTypeChecks: {
5730
+ type: "boolean",
5731
+ description: "Whether to warn about [unsafe operations on Arrays and Dictionaries](https://github.com/markw65/monkeyc-optimizer/wiki/Extra-Reference-Type-Checks-(prettierMonkeyC.extraReferenceTypeChecks)) that Garmin's compiler allows",
5732
+ default: true,
5733
+ scope: "resource"
5734
+ },
5729
5735
  compilerLookupRules: {
5730
5736
  type: "string",
5731
5737
  description: "Whether to perform lookups as compiler1, compiler2, or based on the currently selected sdk",
@@ -7033,7 +7039,7 @@ function buildReducedGraph(state, root, refsForUpdate, notice) {
7033
7039
  switch (node.type) {
7034
7040
  case "ImportModule":
7035
7041
  case "Using":
7036
- (0, import_chunk_NHZRKHZO.forEach)(
7042
+ (0, import_chunk_X7QCZR3F.forEach)(
7037
7043
  notice(node, node, false, () => []),
7038
7044
  (e) => allEvents.push(e)
7039
7045
  );
@@ -7042,7 +7048,7 @@ function buildReducedGraph(state, root, refsForUpdate, notice) {
7042
7048
  case "ModuleDeclaration":
7043
7049
  if (rootNode !== node)
7044
7050
  return [];
7045
- (0, import_chunk_NHZRKHZO.forEach)(
7051
+ (0, import_chunk_X7QCZR3F.forEach)(
7046
7052
  notice(node, node, false, () => []),
7047
7053
  (e) => {
7048
7054
  addEvent(localState.curBlock, e);
@@ -7367,9 +7373,9 @@ function buildReducedGraph(state, root, refsForUpdate, notice) {
7367
7373
  );
7368
7374
  }
7369
7375
  } else {
7370
- (0, import_chunk_NHZRKHZO.forEach)(events, (e) => e.mayThrow = false);
7376
+ (0, import_chunk_X7QCZR3F.forEach)(events, (e) => e.mayThrow = false);
7371
7377
  }
7372
- (0, import_chunk_NHZRKHZO.forEach)(events, (event) => {
7378
+ (0, import_chunk_X7QCZR3F.forEach)(events, (event) => {
7373
7379
  if (event.mayThrow) {
7374
7380
  for (let i = localState.stack.length; i--; ) {
7375
7381
  const target = localState.stack[i].throw;
@@ -7524,7 +7530,7 @@ var init_control_flow = (0, import_chunk_ABYVSU2C.__esm)({
7524
7530
  "src/control-flow.ts"() {
7525
7531
  "use strict";
7526
7532
  (0, import_chunk_JDC43A3I.init_ast)();
7527
- (0, import_chunk_NHZRKHZO.init_util)();
7533
+ (0, import_chunk_X7QCZR3F.init_util)();
7528
7534
  Terminals = {
7529
7535
  BreakStatement: "break",
7530
7536
  ContinueStatement: "continue",
@@ -7551,12 +7557,12 @@ var init_control_flow = (0, import_chunk_ABYVSU2C.__esm)({
7551
7557
  if (!from.succs) {
7552
7558
  from.succs = [to];
7553
7559
  } else {
7554
- (0, import_chunk_NHZRKHZO.pushUnique)(from.succs, to);
7560
+ (0, import_chunk_X7QCZR3F.pushUnique)(from.succs, to);
7555
7561
  }
7556
7562
  if (!to.preds) {
7557
7563
  to.preds = [from];
7558
7564
  } else {
7559
- (0, import_chunk_NHZRKHZO.pushUnique)(to.preds, from);
7565
+ (0, import_chunk_X7QCZR3F.pushUnique)(to.preds, from);
7560
7566
  }
7561
7567
  }
7562
7568
  newBlock(block) {
@@ -7613,6 +7619,9 @@ var init_control_flow = (0, import_chunk_ABYVSU2C.__esm)({
7613
7619
  }
7614
7620
  });
7615
7621
  function unionInto(to, from) {
7622
+ return unionHelper(to, from, -Infinity);
7623
+ }
7624
+ function unionHelper(to, from, widenDepth) {
7616
7625
  if (to == null || from == null) {
7617
7626
  throw new Error("Null");
7618
7627
  }
@@ -7638,14 +7647,14 @@ function unionInto(to, from) {
7638
7647
  clearValuesUnder(to, from.type);
7639
7648
  return true;
7640
7649
  }
7641
- return mergeMultiple(to, from);
7650
+ return mergeMultiple(to, from, widenDepth);
7642
7651
  }
7643
7652
  if (to.value != null) {
7644
7653
  if (from.value == null) {
7645
7654
  clearValuesUnder(to, from.type);
7646
7655
  return true;
7647
7656
  }
7648
- mergeMultiple(to, from);
7657
+ mergeMultiple(to, from, widenDepth);
7649
7658
  return true;
7650
7659
  }
7651
7660
  if (from.value == null) {
@@ -7658,7 +7667,7 @@ function unionInto(to, from) {
7658
7667
  to.value = tmp.value;
7659
7668
  return true;
7660
7669
  }
7661
- function mergeMultiple(to, from) {
7670
+ function mergeMultiple(to, from, widenDepth) {
7662
7671
  const newTags = to.type | from.type;
7663
7672
  let anyChanged = newTags !== to.type;
7664
7673
  let mask = 0;
@@ -7667,11 +7676,14 @@ function mergeMultiple(to, from) {
7667
7676
  const fromv = getUnionComponent(from, ac.type);
7668
7677
  if (ac.value != null) {
7669
7678
  if (fromv != null) {
7670
- const [value2, changed] = mergeSingle({
7671
- type: ac.type,
7672
- avalue: ac.value,
7673
- bvalue: fromv
7674
- });
7679
+ const [value2, changed] = ac.value === fromv ? [fromv, false] : mergeSingle(
7680
+ {
7681
+ type: ac.type,
7682
+ avalue: ac.value,
7683
+ bvalue: fromv
7684
+ },
7685
+ widenDepth
7686
+ );
7675
7687
  if (changed)
7676
7688
  anyChanged = true;
7677
7689
  if (value2) {
@@ -7708,13 +7720,13 @@ function mergeMultiple(to, from) {
7708
7720
  to.value = result[mask];
7709
7721
  return true;
7710
7722
  }
7711
- function tryUnion(to, from) {
7712
- to = cloneType(to);
7713
- if (unionInto(to, from))
7714
- return to;
7715
- return null;
7716
- }
7717
- function mergeSingle(pair) {
7723
+ function mergeSingle(pair, widenDepth) {
7724
+ function tryUnion(to, from) {
7725
+ to = cloneType(to);
7726
+ if (unionHelper(to, from, widenDepth + 1))
7727
+ return to;
7728
+ return null;
7729
+ }
7718
7730
  switch (pair.type) {
7719
7731
  case 1:
7720
7732
  case 2:
@@ -7727,31 +7739,58 @@ function mergeSingle(pair) {
7727
7739
  case 128:
7728
7740
  case 256:
7729
7741
  case 131072:
7730
- if (pair.avalue === pair.bvalue) {
7731
- return [pair.avalue, false];
7732
- }
7733
7742
  return [null, true];
7734
7743
  case 512: {
7735
- if (Array.isArray(pair.avalue)) {
7736
- const bv = pair.bvalue;
7737
- if (Array.isArray(bv)) {
7738
- if (pair.avalue.length === bv.length) {
7739
- let changed = false;
7740
- const u = pair.avalue.map((a, i) => {
7741
- const merged2 = tryUnion(a, bv[i]);
7742
- if (merged2)
7743
- changed = true;
7744
- return merged2 || a;
7745
- });
7746
- return [u, changed];
7744
+ if (widenDepth > MaxWidenDepth) {
7745
+ return [null, true];
7746
+ }
7747
+ const tupleTypes = /* @__PURE__ */ new Map();
7748
+ const arrayTypes = [];
7749
+ tupleForEach(
7750
+ pair.avalue,
7751
+ (v) => {
7752
+ const t = tupleTypes.get(v.length);
7753
+ if (t) {
7754
+ t.push(v);
7755
+ } else {
7756
+ tupleTypes.set(v.length, [v]);
7757
+ }
7758
+ },
7759
+ (v) => arrayTypes.push(v)
7760
+ );
7761
+ const extraTypes = [];
7762
+ tupleForEach(
7763
+ pair.bvalue,
7764
+ (v) => {
7765
+ const tuples = tupleTypes.get(v.length);
7766
+ if (!tuples?.some(
7767
+ (t) => t.every((at, i) => {
7768
+ const bt = v[i];
7769
+ return subtypeOf(at, bt) && subtypeOf(bt, at);
7770
+ })
7771
+ )) {
7772
+ extraTypes.push(v);
7773
+ }
7774
+ },
7775
+ (v) => {
7776
+ if (!arrayTypes.some((at) => subtypeOf(at, v) && subtypeOf(v, at))) {
7777
+ extraTypes.push(v);
7747
7778
  }
7748
7779
  }
7780
+ );
7781
+ if (extraTypes.length) {
7782
+ if (widenDepth >= 0) {
7783
+ return [null, true];
7784
+ }
7785
+ const allTypes = (pair.avalue instanceof Set ? Array.from(pair.avalue) : [pair.avalue]).concat(extraTypes);
7786
+ return [tupleReduce(allTypes), true];
7749
7787
  }
7750
- const av = reducedType(pair.avalue);
7751
- const merged = tryUnion(av, reducedType(pair.bvalue));
7752
- return [merged || av, merged != null];
7788
+ return [pair.avalue, false];
7753
7789
  }
7754
7790
  case 1024: {
7791
+ if (widenDepth > MaxWidenDepth) {
7792
+ return [null, true];
7793
+ }
7755
7794
  const avalue = pair.avalue;
7756
7795
  const bvalue = pair.bvalue;
7757
7796
  if (!avalue.value) {
@@ -7766,7 +7805,7 @@ function mergeSingle(pair) {
7766
7805
  return;
7767
7806
  }
7768
7807
  av = cloneType(av);
7769
- if (unionInto(av, bv))
7808
+ if (unionHelper(av, bv, widenDepth + 1))
7770
7809
  merged = true;
7771
7810
  result.set(key2, av);
7772
7811
  });
@@ -7842,7 +7881,8 @@ function mergeSingle(pair) {
7842
7881
  let klass = pair.avalue.klass;
7843
7882
  const [obj, objChanged] = mergeObjectValues(
7844
7883
  pair.avalue.obj,
7845
- pair.bvalue.obj
7884
+ pair.bvalue.obj,
7885
+ widenDepth
7846
7886
  );
7847
7887
  const klassChanged = tryUnion(klass, pair.bvalue.klass);
7848
7888
  if (klassChanged || objChanged) {
@@ -7860,7 +7900,7 @@ function mergeSingle(pair) {
7860
7900
  if (toE.enum !== fromE.enum) {
7861
7901
  if (toE.value && fromE.value) {
7862
7902
  const result = cloneType(toE.value);
7863
- unionInto(result, fromE.value);
7903
+ unionHelper(result, fromE.value, widenDepth + 1);
7864
7904
  const e = { value: result };
7865
7905
  return [e, true];
7866
7906
  }
@@ -7884,7 +7924,7 @@ function mergeSingle(pair) {
7884
7924
  unhandledType(pair);
7885
7925
  }
7886
7926
  }
7887
- function mergeObjectValues(to, from) {
7927
+ function mergeObjectValues(to, from, widenDepth) {
7888
7928
  if (!to) {
7889
7929
  return [to, false];
7890
7930
  }
@@ -7901,7 +7941,7 @@ function mergeObjectValues(to, from) {
7901
7941
  return;
7902
7942
  }
7903
7943
  const rep = cloneType(value2);
7904
- if (unionInto(rep, from[key])) {
7944
+ if (unionHelper(rep, from[key], widenDepth + 1)) {
7905
7945
  if (result === to)
7906
7946
  result = { ...result };
7907
7947
  result[key] = rep;
@@ -7916,8 +7956,8 @@ function mergeObjectValues(to, from) {
7916
7956
  function mergeStateDecls(to, from) {
7917
7957
  let changed = false;
7918
7958
  let result = to;
7919
- (0, import_chunk_NHZRKHZO.forEach)(from, (v) => {
7920
- if ((0, import_chunk_NHZRKHZO.some)(to, (t) => t === v)) {
7959
+ (0, import_chunk_X7QCZR3F.forEach)(from, (v) => {
7960
+ if ((0, import_chunk_X7QCZR3F.some)(to, (t) => t === v)) {
7921
7961
  return;
7922
7962
  }
7923
7963
  if (Array.isArray(result)) {
@@ -7991,104 +8031,18 @@ function clearValuesUnder(v, tag, clearTag = false) {
7991
8031
  v.value = newData;
7992
8032
  }
7993
8033
  }
7994
- function widenTypeHelper(t, depth2) {
7995
- let result = null;
7996
- forEachUnionComponent(
7997
- t,
7998
- t.type & (512 | 1024),
7999
- (ac) => {
8000
- if (ac.value == null)
8001
- return;
8002
- switch (ac.type) {
8003
- case 512:
8004
- if (depth2 > 4) {
8005
- if (!result)
8006
- result = cloneType(t);
8007
- clearValuesUnder(result, ac.type);
8008
- } else {
8009
- if (Array.isArray(ac.value)) {
8010
- let newAData = ac.value;
8011
- ac.value.forEach((avalue, index) => {
8012
- const data = widenTypeHelper(avalue, depth2 + 1);
8013
- if (data) {
8014
- if (newAData === ac.value) {
8015
- newAData = newAData.slice();
8016
- }
8017
- newAData[index] = data;
8018
- }
8019
- });
8020
- if (newAData !== ac.value) {
8021
- if (!result)
8022
- result = cloneType(t);
8023
- setUnionComponent(result, ac.type, newAData);
8024
- }
8025
- } else {
8026
- const v = widenTypeHelper(ac.value, depth2 + 1);
8027
- if (v) {
8028
- if (!result)
8029
- result = cloneType(t);
8030
- setUnionComponent(result, ac.type, v);
8031
- }
8032
- }
8033
- }
8034
- return;
8035
- case 1024:
8036
- if (depth2 > 4) {
8037
- if (!result)
8038
- result = cloneType(t);
8039
- clearValuesUnder(result, ac.type);
8040
- } else {
8041
- const ddata = ac.value;
8042
- if (ddata.value) {
8043
- const key = widenTypeHelper(ddata.key, depth2 + 1);
8044
- const data = widenTypeHelper(ddata.value, depth2 + 1);
8045
- if (key || data) {
8046
- if (!result)
8047
- result = cloneType(t);
8048
- const newDData = { ...ddata };
8049
- if (key)
8050
- newDData.key = key;
8051
- if (data)
8052
- newDData.value = data;
8053
- setUnionComponent(result, ac.type, newDData);
8054
- }
8055
- } else {
8056
- let newDData = ddata;
8057
- ddata.forEach((dvalue, dkey) => {
8058
- const data = widenTypeHelper(dvalue, depth2 + 1);
8059
- if (data) {
8060
- if (newDData === ddata) {
8061
- newDData = new Map(newDData);
8062
- }
8063
- newDData.set(dkey, data);
8064
- }
8065
- });
8066
- if (newDData !== ddata) {
8067
- if (!result)
8068
- result = cloneType(t);
8069
- setUnionComponent(result, ac.type, newDData);
8070
- }
8071
- }
8072
- }
8073
- return;
8074
- }
8075
- }
8076
- );
8077
- return result;
8078
- }
8079
- function widenType(t) {
8080
- return widenTypeHelper(t, 0);
8081
- }
8034
+ var MaxWidenDepth;
8082
8035
  var init_union_type = (0, import_chunk_ABYVSU2C.__esm)({
8083
8036
  "src/type-flow/union-type.ts"() {
8084
8037
  "use strict";
8085
8038
  (0, import_chunk_JDC43A3I.init_ast)();
8086
8039
  init_data_flow();
8087
- (0, import_chunk_NHZRKHZO.init_util)();
8040
+ (0, import_chunk_X7QCZR3F.init_util)();
8088
8041
  init_could_be();
8089
8042
  init_intersection_type();
8090
8043
  init_sub_type();
8091
8044
  init_types();
8045
+ MaxWidenDepth = 4;
8092
8046
  }
8093
8047
  });
8094
8048
  function expandTypedef(t) {
@@ -8099,7 +8053,7 @@ function expandTypedef(t) {
8099
8053
  );
8100
8054
  const tExpanded = cloneType(t);
8101
8055
  clearValuesUnder(tExpanded, 262144, true);
8102
- (0, import_chunk_NHZRKHZO.forEach)(decls, (decl) => unionInto(tExpanded, decl.resolvedType));
8056
+ (0, import_chunk_X7QCZR3F.forEach)(decls, (decl) => unionInto(tExpanded, decl.resolvedType));
8103
8057
  return tExpanded;
8104
8058
  }
8105
8059
  function intersectEnum(t, e) {
@@ -8221,35 +8175,49 @@ function intersectionValue(pair) {
8221
8175
  case 128:
8222
8176
  case 131072:
8223
8177
  return pair.avalue === pair.bvalue ? pair.avalue : null;
8224
- case 512: {
8225
- if (Array.isArray(pair.avalue)) {
8226
- const bv = pair.bvalue;
8227
- if (Array.isArray(bv)) {
8228
- if (pair.avalue.length !== bv.length) {
8229
- return null;
8230
- }
8231
- const isect2 = pair.avalue.map((t, i) => intersection(t, bv[i]));
8232
- return isect2.some(
8233
- (t) => t.type === 0
8234
- /* Never */
8235
- ) ? null : isect2;
8178
+ case 512:
8179
+ return tupleMap(
8180
+ pair.avalue,
8181
+ (av) => tupleMap(
8182
+ pair.bvalue,
8183
+ (bv) => {
8184
+ if (av.length !== bv.length)
8185
+ return null;
8186
+ const isect = av.map((t, i) => intersection(t, bv[i]));
8187
+ return isect.some(
8188
+ (t) => t.type === 0
8189
+ /* Never */
8190
+ ) ? null : isect;
8191
+ },
8192
+ (bv) => {
8193
+ const isect = av.map((t) => intersection(bv, t));
8194
+ return isect.some(
8195
+ (t) => t.type === 0
8196
+ /* Never */
8197
+ ) ? null : isect;
8198
+ },
8199
+ (bv) => bv.length === 0 ? null : bv
8200
+ ),
8201
+ (av) => tupleMap(
8202
+ pair.bvalue,
8203
+ (bv) => {
8204
+ const isect = bv.map((t) => intersection(av, t));
8205
+ return isect.some(
8206
+ (t) => t.type === 0
8207
+ /* Never */
8208
+ ) ? null : isect;
8209
+ },
8210
+ (bv) => {
8211
+ const atype = intersection(av, bv);
8212
+ return atype.type === 0 ? null : atype;
8213
+ },
8214
+ (bv) => bv.length === 0 ? null : bv
8215
+ ),
8216
+ (av) => {
8217
+ const result = av.flat(1);
8218
+ return result.length === 0 ? null : tupleReduce(result);
8236
8219
  }
8237
- const isect = pair.avalue.map((t) => intersection(t, bv));
8238
- return isect.some(
8239
- (t) => t.type === 0
8240
- /* Never */
8241
- ) ? null : isect;
8242
- } else if (Array.isArray(pair.bvalue)) {
8243
- const av = pair.avalue;
8244
- const isect = pair.bvalue.map((t) => intersection(av, t));
8245
- return isect.some(
8246
- (t) => t.type === 0
8247
- /* Never */
8248
- ) ? null : isect;
8249
- }
8250
- const atype = intersection(pair.avalue, pair.bvalue);
8251
- return atype.type === 0 ? null : atype;
8252
- }
8220
+ );
8253
8221
  case 1024: {
8254
8222
  if (!pair.avalue.value) {
8255
8223
  if (!pair.bvalue.value) {
@@ -8293,9 +8261,9 @@ function intersectionValue(pair) {
8293
8261
  case 4096:
8294
8262
  case 8192: {
8295
8263
  const common = /* @__PURE__ */ new Set();
8296
- (0, import_chunk_NHZRKHZO.forEach)(
8264
+ (0, import_chunk_X7QCZR3F.forEach)(
8297
8265
  pair.avalue,
8298
- (sna) => (0, import_chunk_NHZRKHZO.some)(pair.bvalue, (snb) => sna === snb) && common.add(sna)
8266
+ (sna) => (0, import_chunk_X7QCZR3F.some)(pair.bvalue, (snb) => sna === snb) && common.add(sna)
8299
8267
  );
8300
8268
  if (!common.size)
8301
8269
  return null;
@@ -8304,9 +8272,9 @@ function intersectionValue(pair) {
8304
8272
  }
8305
8273
  case 16384: {
8306
8274
  const common = /* @__PURE__ */ new Set();
8307
- (0, import_chunk_NHZRKHZO.forEach)(pair.avalue, (sna) => {
8275
+ (0, import_chunk_X7QCZR3F.forEach)(pair.avalue, (sna) => {
8308
8276
  const superA = getSuperClasses(sna);
8309
- (0, import_chunk_NHZRKHZO.forEach)(pair.bvalue, (snb) => {
8277
+ (0, import_chunk_X7QCZR3F.forEach)(pair.bvalue, (snb) => {
8310
8278
  if (sna === snb || superA && superA.has(snb)) {
8311
8279
  common.add(sna);
8312
8280
  }
@@ -8553,7 +8521,7 @@ function restrictExactTypesByEquality(a, b) {
8553
8521
  }
8554
8522
  case 262144:
8555
8523
  return restrictByEquality(
8556
- (0, import_chunk_NHZRKHZO.reduce)(
8524
+ (0, import_chunk_X7QCZR3F.reduce)(
8557
8525
  a.value,
8558
8526
  (cur, decl) => {
8559
8527
  unionInto(cur, decl.resolvedType);
@@ -8620,7 +8588,7 @@ var init_intersection_type = (0, import_chunk_ABYVSU2C.__esm)({
8620
8588
  "use strict";
8621
8589
  init_api();
8622
8590
  init_data_flow();
8623
- (0, import_chunk_NHZRKHZO.init_util)();
8591
+ (0, import_chunk_X7QCZR3F.init_util)();
8624
8592
  init_could_be();
8625
8593
  init_interp();
8626
8594
  init_types();
@@ -8693,19 +8661,34 @@ function subtypeOfValue(pair) {
8693
8661
  case 131072:
8694
8662
  return pair.avalue === pair.bvalue;
8695
8663
  case 512: {
8696
- if (Array.isArray(pair.avalue)) {
8697
- const bv = pair.bvalue;
8698
- if (Array.isArray(bv)) {
8699
- if (pair.avalue.length !== bv.length) {
8700
- return false;
8701
- }
8702
- return pair.avalue.every((t, i) => subtypeOf(t, bv[i]));
8664
+ let result = true;
8665
+ tupleForEach(
8666
+ pair.avalue,
8667
+ (av) => {
8668
+ let some2 = false;
8669
+ tupleForEach(
8670
+ pair.bvalue,
8671
+ (bv) => {
8672
+ some2 = av.length === bv.length && bv.every((b, i) => subtypeOf(av[i], b));
8673
+ return some2 === false;
8674
+ },
8675
+ (bv) => (some2 = av.every((a) => subtypeOf(a, bv))) === false
8676
+ );
8677
+ return result = some2;
8678
+ },
8679
+ (av) => {
8680
+ let some2 = false;
8681
+ tupleForEach(
8682
+ pair.bvalue,
8683
+ () => {
8684
+ return true;
8685
+ },
8686
+ (bv) => (some2 = subtypeOf(av, bv)) === false
8687
+ );
8688
+ return result = some2;
8703
8689
  }
8704
- return pair.avalue.every((t) => subtypeOf(t, bv));
8705
- } else if (Array.isArray(pair.bvalue)) {
8706
- return false;
8707
- }
8708
- return subtypeOf(pair.avalue, pair.bvalue);
8690
+ );
8691
+ return result;
8709
8692
  }
8710
8693
  case 1024: {
8711
8694
  const adict = pair.avalue;
@@ -8734,14 +8717,14 @@ function subtypeOfValue(pair) {
8734
8717
  case 8192: {
8735
8718
  const asd = pair.avalue;
8736
8719
  const bsd = pair.bvalue;
8737
- return (0, import_chunk_NHZRKHZO.every)(asd, (sna) => (0, import_chunk_NHZRKHZO.some)(bsd, (snb) => sna === snb));
8720
+ return (0, import_chunk_X7QCZR3F.every)(asd, (sna) => (0, import_chunk_X7QCZR3F.some)(bsd, (snb) => sna === snb));
8738
8721
  }
8739
8722
  case 16384: {
8740
8723
  const asd = pair.avalue;
8741
8724
  const bsd = pair.bvalue;
8742
- return (0, import_chunk_NHZRKHZO.every)(asd, (sna) => {
8725
+ return (0, import_chunk_X7QCZR3F.every)(asd, (sna) => {
8743
8726
  const superA = getSuperClasses(sna);
8744
- return (0, import_chunk_NHZRKHZO.some)(bsd, (snb) => {
8727
+ return (0, import_chunk_X7QCZR3F.some)(bsd, (snb) => {
8745
8728
  if (sna === snb || superA && superA.has(snb)) {
8746
8729
  return true;
8747
8730
  }
@@ -8777,7 +8760,7 @@ var init_sub_type = (0, import_chunk_ABYVSU2C.__esm)({
8777
8760
  "use strict";
8778
8761
  init_api();
8779
8762
  init_data_flow();
8780
- (0, import_chunk_NHZRKHZO.init_util)();
8763
+ (0, import_chunk_X7QCZR3F.init_util)();
8781
8764
  init_could_be();
8782
8765
  init_intersection_type();
8783
8766
  init_types();
@@ -9198,13 +9181,13 @@ function isTypeStateKey(decl) {
9198
9181
  return Array.isArray(decl) || decl.type !== "MemberDecl" && decl.type !== "Unknown";
9199
9182
  }
9200
9183
  function declIsLocal(decl) {
9201
- return (0, import_chunk_NHZRKHZO.some)(
9184
+ return (0, import_chunk_X7QCZR3F.some)(
9202
9185
  decl,
9203
9186
  (d) => d.type === "BinaryExpression" || d.type === "Identifier" || d.type === "VariableDeclarator" && isLocal(d)
9204
9187
  );
9205
9188
  }
9206
9189
  function declIsNonLocal(decl) {
9207
- return (0, import_chunk_NHZRKHZO.some)(decl, (d) => d.type === "VariableDeclarator" && !isLocal(d));
9190
+ return (0, import_chunk_X7QCZR3F.some)(decl, (d) => d.type === "VariableDeclarator" && !isLocal(d));
9208
9191
  }
9209
9192
  function localDeclName(decl) {
9210
9193
  if (Array.isArray(decl))
@@ -9217,12 +9200,12 @@ function localDeclName(decl) {
9217
9200
  case "VariableDeclarator":
9218
9201
  return variableDeclarationName(decl.node.id);
9219
9202
  }
9220
- throw new import_chunk_NHZRKHZO.AwaitedError(
9203
+ throw new import_chunk_X7QCZR3F.AwaitedError(
9221
9204
  declFullName(decl).then((declStr) => `Invalid local decl: ${declStr}`)
9222
9205
  );
9223
9206
  }
9224
9207
  function tsKey(key) {
9225
- return `${(0, import_chunk_NHZRKHZO.map)(key, (k) => {
9208
+ return `${(0, import_chunk_X7QCZR3F.map)(key, (k) => {
9226
9209
  if (k.type === "Literal") {
9227
9210
  return k.raw;
9228
9211
  } else if (isStateNode(k)) {
@@ -9241,7 +9224,7 @@ function sourceLocation(loc) {
9241
9224
  return loc ? `${loc.source || "??"}:${loc.start.line}:${loc.start.column}` : "??";
9242
9225
  }
9243
9226
  function printBlockHeader(block) {
9244
- (0, import_chunk_NHZRKHZO.log)(
9227
+ (0, import_chunk_X7QCZR3F.log)(
9245
9228
  block.order,
9246
9229
  `(${block.node?.loc?.source || "??"}:${block.node?.loc?.start.line || "??"})`,
9247
9230
  `Preds: ${(block.preds || []).map((block2) => block2.order).join(", ")}`
@@ -9267,10 +9250,10 @@ function describeEvent(event) {
9267
9250
  ).then((desc) => `${event.type}: ${desc}`);
9268
9251
  }
9269
9252
  function printBlockEvents(block, extra) {
9270
- (0, import_chunk_NHZRKHZO.log)("Events:");
9271
- (0, import_chunk_NHZRKHZO.forEach)(
9253
+ (0, import_chunk_X7QCZR3F.log)("Events:");
9254
+ (0, import_chunk_X7QCZR3F.forEach)(
9272
9255
  block.events,
9273
- (event) => (0, import_chunk_NHZRKHZO.log)(
9256
+ (event) => (0, import_chunk_X7QCZR3F.log)(
9274
9257
  describeEvent(event).then(
9275
9258
  (eventStr) => ` ${eventStr} ${extra ? extra(event) : ""}`
9276
9259
  )
@@ -9278,7 +9261,7 @@ function printBlockEvents(block, extra) {
9278
9261
  );
9279
9262
  }
9280
9263
  function printBlockTrailer(block) {
9281
- (0, import_chunk_NHZRKHZO.log)(
9264
+ (0, import_chunk_X7QCZR3F.log)(
9282
9265
  `Succs: ${(block.succs || []).map((block2) => block2.order).join(", ")} ExSucc: ${block.exsucc ? block.exsucc.order : ""}`
9283
9266
  );
9284
9267
  }
@@ -9405,7 +9388,7 @@ var init_type_flow_util = (0, import_chunk_ABYVSU2C.__esm)({
9405
9388
  "use strict";
9406
9389
  init_api();
9407
9390
  init_data_flow();
9408
- (0, import_chunk_NHZRKHZO.init_util)();
9391
+ (0, import_chunk_X7QCZR3F.init_util)();
9409
9392
  init_intersection_type();
9410
9393
  init_sub_type();
9411
9394
  init_types();
@@ -9459,7 +9442,7 @@ function calleeObjectType(istate, callee) {
9459
9442
  }
9460
9443
  function checkCallArgs(istate, node, callees, args) {
9461
9444
  const allDiags = [];
9462
- const resultType = (0, import_chunk_NHZRKHZO.reduce)(
9445
+ const resultType = (0, import_chunk_X7QCZR3F.reduce)(
9463
9446
  callees,
9464
9447
  (result, cur) => {
9465
9448
  const curDiags = [];
@@ -9472,7 +9455,7 @@ function checkCallArgs(istate, node, callees, args) {
9472
9455
  if (object) {
9473
9456
  const info = sysCallInfo(istate.state, cur);
9474
9457
  if (info) {
9475
- const result2 = info(istate.state, cur, object, () => args);
9458
+ const result2 = info(istate, cur, object, () => args);
9476
9459
  if (result2.argTypes)
9477
9460
  argTypes = result2.argTypes;
9478
9461
  if (result2.returnType)
@@ -9481,6 +9464,8 @@ function checkCallArgs(istate, node, callees, args) {
9481
9464
  effects = false;
9482
9465
  if (!result2.argEffects)
9483
9466
  argEffects = false;
9467
+ if (result2.diagnostic)
9468
+ curDiags.push([node, result2.diagnostic]);
9484
9469
  }
9485
9470
  }
9486
9471
  if (cur.info === false) {
@@ -9514,7 +9499,7 @@ function checkCallArgs(istate, node, callees, args) {
9514
9499
  paramType = typeFromTypespec(istate.state, param.right, cur.stack);
9515
9500
  }
9516
9501
  if (checker(arg, paramType)) {
9517
- if (istate.state.config?.covarianceWarnings && effects && argEffects) {
9502
+ if (istate.state.config?.extraReferenceTypeChecks && effects && argEffects && !safeReferenceArg(node.arguments[i])) {
9518
9503
  if (arg.type & 512) {
9519
9504
  const atype = getUnionComponent(
9520
9505
  arg,
@@ -9527,7 +9512,7 @@ function checkCallArgs(istate, node, callees, args) {
9527
9512
  512
9528
9513
  /* Array */
9529
9514
  );
9530
- if (!ptype || Array.isArray(ptype) || Array.isArray(atype) || !subtypeOf(ptype, atype)) {
9515
+ if (!ptype || !checkArrayCovariance(atype, ptype)) {
9531
9516
  curDiags.push([
9532
9517
  node.arguments[i],
9533
9518
  `Argument ${i + 1} to ${cur.fullName}: passing ${display(
@@ -9618,7 +9603,7 @@ function isOverride(cur, funcs) {
9618
9603
  const cls = cur.stack?.[cur.stack.length - 1]?.sn;
9619
9604
  if (cls?.type === "ClassDeclaration" && cls.superClasses) {
9620
9605
  const supers = getSuperClasses(cls);
9621
- if (supers && (0, import_chunk_NHZRKHZO.some)(funcs, (func) => {
9606
+ if (supers && (0, import_chunk_X7QCZR3F.some)(funcs, (func) => {
9622
9607
  if (func === cur)
9623
9608
  return false;
9624
9609
  const fcls = func.stack?.[func.stack.length - 1].sn;
@@ -9709,7 +9694,7 @@ function getSystemCallTable(state) {
9709
9694
  }
9710
9695
  return ret;
9711
9696
  };
9712
- const arrayAdd = (state2, callee, calleeObj, getArgs) => {
9697
+ const arrayAdd = (istate, callee, calleeObj, getArgs) => {
9713
9698
  const ret = {};
9714
9699
  if (calleeObj.type & 512) {
9715
9700
  const adata = getUnionComponent(
@@ -9722,54 +9707,97 @@ function getSystemCallTable(state) {
9722
9707
  const args = getArgs();
9723
9708
  if (args.length === 1) {
9724
9709
  const arg = args[0];
9710
+ let hasTuple = false;
9725
9711
  if (callee.name === "add") {
9726
- if (Array.isArray(adata)) {
9727
- const relaxed = relaxType(arg);
9728
- const newAData = [...adata, relaxed];
9729
- ret.returnType.value = newAData;
9730
- ret.argTypes = [relaxed];
9731
- ret.calleeObj = ret.returnType;
9732
- } else if (!subtypeOf(arg, adata)) {
9733
- const newAData = cloneType(adata);
9734
- unionInto(newAData, arg);
9735
- const newObj = cloneType(calleeObj);
9736
- setUnionComponent(newObj, 512, newAData);
9737
- ret.calleeObj = newObj;
9738
- ret.argTypes = [adata];
9739
- }
9712
+ const relaxed = relaxType(arg);
9713
+ tupleMap(
9714
+ adata,
9715
+ (v) => {
9716
+ hasTuple = true;
9717
+ return [...v, relaxed];
9718
+ },
9719
+ (v) => {
9720
+ if (subtypeOf(arg, v))
9721
+ return v;
9722
+ const newAData = cloneType(v);
9723
+ unionInto(newAData, arg);
9724
+ if (!ret.argTypes) {
9725
+ ret.argTypes = [v];
9726
+ } else {
9727
+ ret.argTypes = [intersection(ret.argTypes[0], v)];
9728
+ }
9729
+ return newAData;
9730
+ },
9731
+ (v) => {
9732
+ const newAData = tupleReduce(v);
9733
+ ret.returnType.value = newAData;
9734
+ const newObj = cloneType(calleeObj);
9735
+ setUnionComponent(newObj, 512, newAData);
9736
+ ret.calleeObj = newObj;
9737
+ if (!ret.argTypes) {
9738
+ ret.argTypes = [relaxed];
9739
+ }
9740
+ }
9741
+ );
9740
9742
  } else {
9741
- if (Array.isArray(adata)) {
9742
- if (arg.type & 512) {
9743
- const argSubtypes = getUnionComponent(
9744
- arg,
9745
- 512
9746
- /* Array */
9747
- );
9748
- if (argSubtypes) {
9749
- if (Array.isArray(argSubtypes)) {
9750
- const newAData2 = [...adata, ...argSubtypes];
9751
- ret.returnType.value = newAData2;
9752
- ret.argTypes = [arg];
9753
- ret.calleeObj = ret.returnType;
9754
- return ret;
9743
+ const argSubtypes = arg.type & 512 ? getUnionComponent(
9744
+ arg,
9745
+ 512
9746
+ /* Array */
9747
+ ) : null;
9748
+ if (argSubtypes) {
9749
+ tupleMap(
9750
+ adata,
9751
+ (v) => {
9752
+ hasTuple = true;
9753
+ return tupleMap(
9754
+ argSubtypes,
9755
+ (a) => [...v, ...a],
9756
+ (a) => {
9757
+ const at = cloneType(reducedType(v));
9758
+ unionInto(at, a);
9759
+ return at;
9760
+ },
9761
+ (a) => a
9762
+ );
9763
+ },
9764
+ (v) => {
9765
+ const addedType = reducedArrayType(argSubtypes);
9766
+ if (subtypeOf(addedType, v))
9767
+ return [v];
9768
+ if (!ret.argTypes) {
9769
+ ret.argTypes = [v];
9770
+ } else {
9771
+ ret.argTypes = [intersection(ret.argTypes[0], v)];
9755
9772
  }
9756
- const newAData = reducedType(adata);
9757
- unionInto(newAData, argSubtypes);
9773
+ v = cloneType(v);
9774
+ unionInto(v, addedType);
9775
+ return [v];
9776
+ },
9777
+ (va) => {
9778
+ const newAData = tupleReduce(va.flat());
9758
9779
  ret.returnType.value = newAData;
9759
- ret.argTypes = [arg];
9760
- ret.calleeObj = ret.returnType;
9761
- return ret;
9780
+ const newObj = cloneType(calleeObj);
9781
+ setUnionComponent(newObj, 512, newAData);
9782
+ ret.calleeObj = newObj;
9783
+ if (!ret.argTypes) {
9784
+ ret.argTypes = [
9785
+ { type: 512, value: argSubtypes }
9786
+ ];
9787
+ }
9762
9788
  }
9763
- }
9764
- ret.returnType.value = reducedType(adata);
9765
- }
9766
- if (!subtypeOf(arg, ret.returnType)) {
9767
- ret.argTypes = [ret.returnType];
9768
- const newObj = cloneType(calleeObj);
9769
- unionInto(newObj, arg);
9770
- ret.calleeObj = newObj;
9789
+ );
9790
+ } else {
9791
+ tupleForEach(
9792
+ adata,
9793
+ () => hasTuple = true,
9794
+ () => false
9795
+ );
9771
9796
  }
9772
9797
  }
9798
+ if (hasTuple && istate.typeChecker && istate.state.config?.extraReferenceTypeChecks !== false) {
9799
+ ret.diagnostic = "Adding to a tuple would change its type";
9800
+ }
9773
9801
  }
9774
9802
  }
9775
9803
  }
@@ -9959,7 +9987,7 @@ function getSystemCallTable(state) {
9959
9987
  ret.argTypes = getArgs();
9960
9988
  return ret;
9961
9989
  };
9962
- const method = (state2, callee, calleeObj, getArgs) => {
9990
+ const method = (istate, callee, calleeObj, getArgs) => {
9963
9991
  const ret = {};
9964
9992
  const args = getArgs();
9965
9993
  if (args.length === 1 && hasValue(args[0]) && args[0].type === 131072) {
@@ -9974,7 +10002,7 @@ function getSystemCallTable(state) {
9974
10002
  computed: false
9975
10003
  };
9976
10004
  const [, trueDecls] = findObjectDeclsByProperty(
9977
- state2,
10005
+ istate.state,
9978
10006
  calleeObj,
9979
10007
  next.property
9980
10008
  );
@@ -9988,7 +10016,7 @@ function getSystemCallTable(state) {
9988
10016
  ret.returnType = callees.reduce(
9989
10017
  (type, callee2) => {
9990
10018
  const result = callee2.node.returnType ? typeFromTypespec(
9991
- state2,
10019
+ istate.state,
9992
10020
  callee2.node.returnType.argument,
9993
10021
  callee2.stack
9994
10022
  ) : {
@@ -9996,7 +10024,7 @@ function getSystemCallTable(state) {
9996
10024
  /* Any */
9997
10025
  };
9998
10026
  const args2 = callee2.node.params.map(
9999
- (param) => param.type === "BinaryExpression" ? typeFromTypespec(state2, param.right, callee2.stack) : {
10027
+ (param) => param.type === "BinaryExpression" ? typeFromTypespec(istate.state, param.right, callee2.stack) : {
10000
10028
  type: 524287
10001
10029
  /* Any */
10002
10030
  }
@@ -10017,7 +10045,7 @@ function getSystemCallTable(state) {
10017
10045
  };
10018
10046
  const nop = () => ({ effectFree: true });
10019
10047
  const mod = () => ({});
10020
- const rounder = (state2, callee, calleeObj, getArgs) => {
10048
+ const rounder = (istate, callee, calleeObj, getArgs) => {
10021
10049
  const results = {};
10022
10050
  const fn = Math[callee.name];
10023
10051
  results.effectFree = true;
@@ -10039,7 +10067,7 @@ function getSystemCallTable(state) {
10039
10067
  };
10040
10068
  return results;
10041
10069
  };
10042
- const mathHelper = (state2, callee, calleeObj, getArgs, helper) => {
10070
+ const mathHelper = (istate, callee, calleeObj, getArgs, helper) => {
10043
10071
  const results = {};
10044
10072
  const fn = helper && typeof helper === "function" ? helper : (0, import_chunk_JDC43A3I.hasProperty)(Math, helper || callee.name) && Math[helper || callee.name];
10045
10073
  if (fn && typeof fn === "function") {
@@ -10186,8 +10214,9 @@ var init_interp_call = (0, import_chunk_ABYVSU2C.__esm)({
10186
10214
  "use strict";
10187
10215
  init_api();
10188
10216
  init_optimizer_types();
10189
- (0, import_chunk_NHZRKHZO.init_util)();
10217
+ (0, import_chunk_X7QCZR3F.init_util)();
10190
10218
  init_interp();
10219
+ init_intersection_type();
10191
10220
  init_sub_type();
10192
10221
  init_type_flow_util();
10193
10222
  init_types();
@@ -10456,23 +10485,27 @@ function deEnumerate(t) {
10456
10485
  }
10457
10486
  return t;
10458
10487
  }
10459
- function arrayTypeAtIndex(arr, elemType) {
10460
- if (Array.isArray(arr)) {
10461
- if (elemType && isExact(elemType) && elemType.type === 8 && elemType.value != null && arr[elemType.value] != null) {
10462
- return arr[elemType.value];
10488
+ function arrayTypeAtIndex(arr, elemType, forStrictAssign, enforceTuples) {
10489
+ const reduce2 = (v) => forStrictAssign ? v.reduce(
10490
+ (t, c) => t ? intersection(t, c) : c,
10491
+ null
10492
+ ) ?? {
10493
+ type: 0
10494
+ /* Never */
10495
+ } : reducedType(v);
10496
+ const key = elemType && isExact(elemType) && elemType.type === 8 ? elemType.value : null;
10497
+ return tupleMap(
10498
+ arr,
10499
+ (v) => key != null ? v[key] ?? null : reduce2(v),
10500
+ (v) => v,
10501
+ (v) => v.length ? reduce2(v) : enforceTuples ? {
10502
+ type: 0
10503
+ /* Never */
10504
+ } : {
10505
+ type: 524287
10506
+ /* Any */
10463
10507
  }
10464
- return arr.reduce(
10465
- (p, v) => {
10466
- unionInto(p, v);
10467
- return p;
10468
- },
10469
- {
10470
- type: 0
10471
- /* Never */
10472
- }
10473
- );
10474
- }
10475
- return arr;
10508
+ );
10476
10509
  }
10477
10510
  function getLhsConstraint(istate, node) {
10478
10511
  if (istate.localLvals?.has(node)) {
@@ -10502,7 +10535,15 @@ function getLhsConstraint(istate, node) {
10502
10535
  /* Array */
10503
10536
  );
10504
10537
  if (arr) {
10505
- result = arrayTypeAtIndex(arr, istate.typeMap.get(node.property));
10538
+ result = arrayTypeAtIndex(
10539
+ arr,
10540
+ istate.typeMap.get(node.property) ?? {
10541
+ type: 8,
10542
+ value: arrayLiteralKeyFromExpr(node.property) ?? void 0
10543
+ },
10544
+ strict,
10545
+ istate.state.config?.extraReferenceTypeChecks !== false
10546
+ );
10506
10547
  }
10507
10548
  }
10508
10549
  const updateResult = (value2) => {
@@ -10957,7 +10998,7 @@ function evaluateNode(istate, node) {
10957
10998
  byteArray = true;
10958
10999
  }
10959
11000
  }
10960
- if (objectType.value && !(objectType.type & (4096 | 16384 | (byteArray ? 0 : 32768)))) {
11001
+ if (objectType.value && !(objectType.type & (16384 | (byteArray ? 0 : 32768)))) {
10961
11002
  let result = null;
10962
11003
  if (objectType.type & 512) {
10963
11004
  const avalue = getUnionComponent(
@@ -10968,7 +11009,7 @@ function evaluateNode(istate, node) {
10968
11009
  type: 524287
10969
11010
  /* Any */
10970
11011
  };
10971
- const atype = arrayTypeAtIndex(avalue, property.value);
11012
+ const atype = arrayTypeAtIndex(avalue, property.value, false, true);
10972
11013
  if (result) {
10973
11014
  unionInto(result = cloneType(result), atype);
10974
11015
  } else {
@@ -10994,6 +11035,42 @@ function evaluateNode(istate, node) {
10994
11035
  result.type |= 1;
10995
11036
  }
10996
11037
  }
11038
+ if (objectType.type & 4096 && couldBe(property.value, {
11039
+ type: 131072
11040
+ /* Symbol */
11041
+ })) {
11042
+ const mvalue = getUnionComponent(
11043
+ objectType,
11044
+ 4096
11045
+ /* Module */
11046
+ );
11047
+ if (!mvalue) {
11048
+ result = {
11049
+ type: 524287
11050
+ /* Any */
11051
+ };
11052
+ push({
11053
+ value: result,
11054
+ embeddedEffects: object.embeddedEffects || property.embeddedEffects,
11055
+ node
11056
+ });
11057
+ break;
11058
+ }
11059
+ if (result)
11060
+ result = cloneType(result);
11061
+ (0, import_chunk_X7QCZR3F.forEach)(mvalue, (m) => {
11062
+ if (m.decls) {
11063
+ Object.values(m.decls).forEach((sn) => {
11064
+ const t = typeFromTypeStateNodes(istate.state, sn, true);
11065
+ if (result) {
11066
+ unionInto(result, t);
11067
+ } else {
11068
+ result = cloneType(t);
11069
+ }
11070
+ });
11071
+ }
11072
+ });
11073
+ }
10997
11074
  if (byteArray) {
10998
11075
  const t = {
10999
11076
  type: 8
@@ -11120,7 +11197,7 @@ function evaluateNode(istate, node) {
11120
11197
  if (isExact(klass.value) && klass.value.type === 16384) {
11121
11198
  obj.value = { klass: klass.value };
11122
11199
  if (istate.checkTypes && klass.value.value) {
11123
- const callees = (0, import_chunk_NHZRKHZO.map)(
11200
+ const callees = (0, import_chunk_X7QCZR3F.map)(
11124
11201
  klass.value.value,
11125
11202
  (klass2) => klass2.decls?.initialize
11126
11203
  ).flat().filter(
@@ -11322,7 +11399,7 @@ function mustBeIdentical(a, b) {
11322
11399
  return false;
11323
11400
  }
11324
11401
  function isByteArrayData(objectData) {
11325
- return objectData.klass.value && (0, import_chunk_NHZRKHZO.every)(
11402
+ return objectData.klass.value && (0, import_chunk_X7QCZR3F.every)(
11326
11403
  objectData.klass.value,
11327
11404
  (klass) => klass.fullName === "$.Toybox.Lang.ByteArray"
11328
11405
  );
@@ -11334,7 +11411,7 @@ var init_interp = (0, import_chunk_ABYVSU2C.__esm)({
11334
11411
  (0, import_chunk_JDC43A3I.init_ast)();
11335
11412
  init_data_flow();
11336
11413
  init_optimizer_types();
11337
- (0, import_chunk_NHZRKHZO.init_util)();
11414
+ (0, import_chunk_X7QCZR3F.init_util)();
11338
11415
  init_could_be();
11339
11416
  init_interp_binary();
11340
11417
  init_interp_call();
@@ -11573,7 +11650,7 @@ function typeFromTypeStateNode(state, sn, classVsObj) {
11573
11650
  );
11574
11651
  if (value2) {
11575
11652
  const a = [];
11576
- (0, import_chunk_NHZRKHZO.forEach)(value2, (v) => {
11653
+ (0, import_chunk_X7QCZR3F.forEach)(value2, (v) => {
11577
11654
  if (v !== sn)
11578
11655
  a.push(v);
11579
11656
  });
@@ -12049,7 +12126,7 @@ function reducedType(elems) {
12049
12126
  if (!Array.isArray(elems)) {
12050
12127
  return elems;
12051
12128
  }
12052
- return elems.reduce(
12129
+ return elems.flat().reduce(
12053
12130
  (p, t) => {
12054
12131
  unionInto(p, t);
12055
12132
  return p;
@@ -12067,7 +12144,7 @@ function mustBeFalse(arg) {
12067
12144
  return arg.type === 1 || arg.type === 2 || (arg.type === 8 || arg.type === 16) && arg.value != null && Number(arg.value) === 0;
12068
12145
  }
12069
12146
  function display(type) {
12070
- const names = (v, fn) => (0, import_chunk_NHZRKHZO.map)(v, fn).sort().filter((s, i, arr) => !i || s !== arr[i - 1]).join(" or ");
12147
+ const names = (v, fn) => (0, import_chunk_X7QCZR3F.map)(v, fn).sort().filter((s, i, arr) => !i || s !== arr[i - 1]).join(" or ");
12071
12148
  const parts = [];
12072
12149
  const displayOne = (tv) => {
12073
12150
  switch (tv.type) {
@@ -12085,7 +12162,12 @@ function display(type) {
12085
12162
  case 256:
12086
12163
  return JSON.stringify(tv.value);
12087
12164
  case 512:
12088
- return Array.isArray(tv.value) ? `[${tv.value.map((t) => display(t)).join(", ")}]` : `Array<${display(tv.value)}>`;
12165
+ return tupleMap(
12166
+ tv.value,
12167
+ (v) => `[${v.map((t) => display(t)).join(", ")}]`,
12168
+ (v) => `Array<${display(v)}>`,
12169
+ (v) => v.join(" or ")
12170
+ );
12089
12171
  case 1024:
12090
12172
  return tv.value.value ? `Dictionary<${display(tv.value.key)}, ${display(tv.value.value)}>` : `{ ${Array.from(tv.value).map(
12091
12173
  ([key, value2]) => `${display(typeFromObjectLiteralKey(key))} as ${display(
@@ -12225,7 +12307,7 @@ function getStateNodeDeclsWithExactFromType(state, object) {
12225
12307
  switch (type.type) {
12226
12308
  case 32768:
12227
12309
  if (type.value.klass.type === 16384 && type.value.klass.value) {
12228
- (0, import_chunk_NHZRKHZO.forEach)(
12310
+ (0, import_chunk_X7QCZR3F.forEach)(
12229
12311
  type.value.klass.value,
12230
12312
  (sn) => decls.push({ sn, exact: false })
12231
12313
  );
@@ -12233,7 +12315,7 @@ function getStateNodeDeclsWithExactFromType(state, object) {
12233
12315
  break;
12234
12316
  case 4096:
12235
12317
  case 16384:
12236
- (0, import_chunk_NHZRKHZO.forEach)(type.value, (sn) => decls.push({ sn, exact: true }));
12318
+ (0, import_chunk_X7QCZR3F.forEach)(type.value, (sn) => decls.push({ sn, exact: true }));
12237
12319
  break;
12238
12320
  }
12239
12321
  }
@@ -12259,6 +12341,79 @@ function getStateNodeDeclsWithExactFromType(state, object) {
12259
12341
  }
12260
12342
  return decls;
12261
12343
  }
12344
+ function tupleForEach(t, tupleFn, arrayFn) {
12345
+ if (t instanceof Set) {
12346
+ for (const v of t) {
12347
+ if ((Array.isArray(v) ? tupleFn(v) : arrayFn(v)) === false) {
12348
+ break;
12349
+ }
12350
+ }
12351
+ } else {
12352
+ if (Array.isArray(t)) {
12353
+ tupleFn(t);
12354
+ } else {
12355
+ arrayFn(t);
12356
+ }
12357
+ }
12358
+ }
12359
+ function tupleMap(t, tupleFn, arrayFn, reduceFn) {
12360
+ const result = t instanceof Set ? Array.from(t).map((v) => Array.isArray(v) ? tupleFn(v) : arrayFn(v)) : [Array.isArray(t) ? tupleFn(t) : arrayFn(t)];
12361
+ return reduceFn(result.filter((v) => v != null));
12362
+ }
12363
+ function tupleReduce(v) {
12364
+ return v.length === 1 ? v[0] : new Set(v);
12365
+ }
12366
+ function reducedArrayType(t) {
12367
+ if (t instanceof Set) {
12368
+ return reducedType(Array.from(t).map((v) => reducedType(v)));
12369
+ }
12370
+ return reducedType(t);
12371
+ }
12372
+ function checkArrayCovariance(arg, param) {
12373
+ let ok = true;
12374
+ tupleForEach(
12375
+ arg,
12376
+ (av) => {
12377
+ tupleForEach(
12378
+ param,
12379
+ (pv) => {
12380
+ if (av.length !== pv.length)
12381
+ return true;
12382
+ if (!av.every((a, i) => subtypeOf(a, pv[i])))
12383
+ return true;
12384
+ if (!av.every((a, i) => subtypeOf(pv[i], a))) {
12385
+ ok = false;
12386
+ }
12387
+ return ok !== false;
12388
+ },
12389
+ () => {
12390
+ ok = false;
12391
+ return false;
12392
+ }
12393
+ );
12394
+ return ok !== false;
12395
+ },
12396
+ (av) => {
12397
+ tupleForEach(
12398
+ param,
12399
+ () => {
12400
+ return ok !== false;
12401
+ },
12402
+ (pv) => {
12403
+ if (subtypeOf(av, pv) && !subtypeOf(pv, av)) {
12404
+ ok = false;
12405
+ }
12406
+ return ok !== false;
12407
+ }
12408
+ );
12409
+ return ok !== false;
12410
+ }
12411
+ );
12412
+ return ok;
12413
+ }
12414
+ function safeReferenceArg(arg) {
12415
+ return arg.type === "ArrayExpression" || arg.type === "ObjectExpression" || arg.type === "NewExpression";
12416
+ }
12262
12417
  var LastTypeTag, SingletonTypeTagsConst, UnionDataTypeTagsConst, ValueTypeTagsConst, ObjectLikeTagsConst, EnumTagsConst, TruthyTypes;
12263
12418
  var init_types = (0, import_chunk_ABYVSU2C.__esm)({
12264
12419
  "src/type-flow/types.ts"() {
@@ -12266,10 +12421,11 @@ var init_types = (0, import_chunk_ABYVSU2C.__esm)({
12266
12421
  init_api();
12267
12422
  (0, import_chunk_JDC43A3I.init_ast)();
12268
12423
  init_data_flow();
12269
- (0, import_chunk_NHZRKHZO.init_util)();
12424
+ (0, import_chunk_X7QCZR3F.init_util)();
12270
12425
  init_interp();
12271
12426
  init_intersection_type();
12272
12427
  init_union_type();
12428
+ init_sub_type();
12273
12429
  LastTypeTag = 262144;
12274
12430
  SingletonTypeTagsConst = 1 | 2 | 4;
12275
12431
  UnionDataTypeTagsConst = 512 | 1024 | 2048 | 4096 | 8192 | 16384 | 32768 | 65536 | 262144;
@@ -12326,7 +12482,7 @@ function couldBeHelper(a, b, shallow) {
12326
12482
  262144
12327
12483
  /* Typedef */
12328
12484
  );
12329
- return typedef && (0, import_chunk_NHZRKHZO.some)(typedef, (td) => {
12485
+ return typedef && (0, import_chunk_X7QCZR3F.some)(typedef, (td) => {
12330
12486
  if (!td.resolvedType) {
12331
12487
  throw new Error(`No resolved type for ${td.fullName} in 'couldBe'`);
12332
12488
  }
@@ -12367,24 +12523,40 @@ function couldBeValue(pair, shallow) {
12367
12523
  case 128:
12368
12524
  case 131072:
12369
12525
  return pair.avalue === pair.bvalue;
12370
- case 512:
12526
+ case 512: {
12371
12527
  if (shallow)
12372
12528
  return true;
12373
- if (Array.isArray(pair.avalue)) {
12374
- const bv = pair.bvalue;
12375
- if (Array.isArray(bv)) {
12376
- if (pair.avalue.length !== bv.length) {
12377
- return false;
12378
- }
12379
- return pair.avalue.every((a, i) => couldBe(a, bv[i]));
12529
+ let result = false;
12530
+ tupleForEach(
12531
+ pair.avalue,
12532
+ (av) => {
12533
+ tupleForEach(
12534
+ pair.bvalue,
12535
+ (bv) => {
12536
+ result = av.length === bv.length && bv.every((b, i) => couldBe(av[i], b));
12537
+ return result === false;
12538
+ },
12539
+ (bv) => {
12540
+ result = av.every((a) => couldBe(a, bv));
12541
+ return result === false;
12542
+ }
12543
+ );
12544
+ return result === false;
12545
+ },
12546
+ (av) => {
12547
+ tupleForEach(
12548
+ pair.bvalue,
12549
+ (bv) => {
12550
+ result = bv.every((b) => couldBe(av, b));
12551
+ return result === false;
12552
+ },
12553
+ (bv) => (result = couldBe(av, bv)) === false
12554
+ );
12555
+ return result === false;
12380
12556
  }
12381
- return pair.avalue.every((a) => couldBe(a, bv));
12382
- }
12383
- if (Array.isArray(pair.bvalue)) {
12384
- const av = pair.avalue;
12385
- return pair.bvalue.every((b) => couldBe(av, b));
12386
- }
12387
- return couldBe(pair.avalue, pair.bvalue);
12557
+ );
12558
+ return result;
12559
+ }
12388
12560
  case 1024: {
12389
12561
  if (shallow)
12390
12562
  return true;
@@ -12398,15 +12570,15 @@ function couldBeValue(pair, shallow) {
12398
12570
  }
12399
12571
  case 4096:
12400
12572
  case 8192: {
12401
- return (0, import_chunk_NHZRKHZO.some)(
12573
+ return (0, import_chunk_X7QCZR3F.some)(
12402
12574
  pair.avalue,
12403
- (sna) => (0, import_chunk_NHZRKHZO.some)(pair.bvalue, (snb) => sna === snb)
12575
+ (sna) => (0, import_chunk_X7QCZR3F.some)(pair.bvalue, (snb) => sna === snb)
12404
12576
  );
12405
12577
  }
12406
12578
  case 16384: {
12407
- return (0, import_chunk_NHZRKHZO.some)(pair.avalue, (sna) => {
12579
+ return (0, import_chunk_X7QCZR3F.some)(pair.avalue, (sna) => {
12408
12580
  const superA = getSuperClasses(sna);
12409
- return (0, import_chunk_NHZRKHZO.some)(pair.bvalue, (snb) => {
12581
+ return (0, import_chunk_X7QCZR3F.some)(pair.bvalue, (snb) => {
12410
12582
  if (sna === snb || superA && superA.has(snb)) {
12411
12583
  return true;
12412
12584
  }
@@ -12439,7 +12611,7 @@ var init_could_be = (0, import_chunk_ABYVSU2C.__esm)({
12439
12611
  "use strict";
12440
12612
  init_api();
12441
12613
  init_data_flow();
12442
- (0, import_chunk_NHZRKHZO.init_util)();
12614
+ (0, import_chunk_X7QCZR3F.init_util)();
12443
12615
  init_types();
12444
12616
  }
12445
12617
  });
@@ -12546,7 +12718,7 @@ function findDeadStores(func, graph, nodeEquivs, findCopyPropCandidates, logThis
12546
12718
  }
12547
12719
  addAnt(curState.partiallyAnticipated, key, node);
12548
12720
  if (logThisRun) {
12549
- (0, import_chunk_NHZRKHZO.log)(
12721
+ (0, import_chunk_X7QCZR3F.log)(
12550
12722
  ` antrefs: ${curState.partiallyAnticipated.get(key) !== false} ${curState.anticipated.get(key) !== false}`
12551
12723
  );
12552
12724
  }
@@ -12569,7 +12741,7 @@ function findDeadStores(func, graph, nodeEquivs, findCopyPropCandidates, logThis
12569
12741
  const curState = cloneState(blockStates[top.order]);
12570
12742
  if (logThisRun) {
12571
12743
  printBlockHeader(top);
12572
- curState.dead.forEach((decl) => (0, import_chunk_NHZRKHZO.log)(` - anticipated: ${tsKey(decl)}`));
12744
+ curState.dead.forEach((decl) => (0, import_chunk_X7QCZR3F.log)(` - anticipated: ${tsKey(decl)}`));
12573
12745
  }
12574
12746
  if (top.events) {
12575
12747
  for (let i = top.events.length; i--; ) {
@@ -12581,12 +12753,12 @@ function findDeadStores(func, graph, nodeEquivs, findCopyPropCandidates, logThis
12581
12753
  case "ref":
12582
12754
  if (isTypeStateKey(event.decl)) {
12583
12755
  if (logThisRun) {
12584
- (0, import_chunk_NHZRKHZO.log)(
12756
+ (0, import_chunk_X7QCZR3F.log)(
12585
12757
  describeEvent(event).then(
12586
12758
  (eventStr) => `${eventStr} (${sourceLocation(event.node.loc)})`
12587
12759
  )
12588
12760
  );
12589
- (0, import_chunk_NHZRKHZO.log)(` kill => ${tsKey(event.decl)}`);
12761
+ (0, import_chunk_X7QCZR3F.log)(` kill => ${tsKey(event.decl)}`);
12590
12762
  }
12591
12763
  copyPropRef(curState, event.decl, event.node);
12592
12764
  curState.dead.delete(event.decl);
@@ -12595,7 +12767,7 @@ function findDeadStores(func, graph, nodeEquivs, findCopyPropCandidates, logThis
12595
12767
  case "def":
12596
12768
  if (isTypeStateKey(event.decl) && (event.node.type !== "VariableDeclarator" || event.node.init)) {
12597
12769
  if (logThisRun) {
12598
- (0, import_chunk_NHZRKHZO.log)(
12770
+ (0, import_chunk_X7QCZR3F.log)(
12599
12771
  describeEvent(event).then(
12600
12772
  (eventStr) => `${eventStr} (${sourceLocation(event.node.loc)})`
12601
12773
  )
@@ -12611,7 +12783,7 @@ function findDeadStores(func, graph, nodeEquivs, findCopyPropCandidates, logThis
12611
12783
  const pant = curState.partiallyAnticipated.get(event.decl);
12612
12784
  if (pant) {
12613
12785
  if (logThisRun) {
12614
- (0, import_chunk_NHZRKHZO.log)(
12786
+ (0, import_chunk_X7QCZR3F.log)(
12615
12787
  ` is copy-prop-candidate ${curState.anticipated?.get(event.decl) === pant}`
12616
12788
  );
12617
12789
  }
@@ -12643,7 +12815,7 @@ function findDeadStores(func, graph, nodeEquivs, findCopyPropCandidates, logThis
12643
12815
  if (assignNode) {
12644
12816
  curState.dead.add(event.decl);
12645
12817
  if (logThisRun) {
12646
- (0, import_chunk_NHZRKHZO.log)(` anticipated => ${tsKey(event.decl)}`);
12818
+ (0, import_chunk_X7QCZR3F.log)(` anticipated => ${tsKey(event.decl)}`);
12647
12819
  }
12648
12820
  } else if (event.node.type === "UpdateExpression") {
12649
12821
  copyPropRef(curState, event.decl, event.node.argument);
@@ -12654,7 +12826,7 @@ function findDeadStores(func, graph, nodeEquivs, findCopyPropCandidates, logThis
12654
12826
  if (isTypeStateKey(event.decl)) {
12655
12827
  curState.dead.add(event.decl);
12656
12828
  if (logThisRun) {
12657
- (0, import_chunk_NHZRKHZO.log)(` anticipated => ${tsKey(event.decl)}`);
12829
+ (0, import_chunk_X7QCZR3F.log)(` anticipated => ${tsKey(event.decl)}`);
12658
12830
  }
12659
12831
  }
12660
12832
  break;
@@ -12717,9 +12889,9 @@ function eliminateDeadStores(state, func, graph, logThisRun) {
12717
12889
  if (!deadStores.size)
12718
12890
  return { changes: false, copyPropStores };
12719
12891
  if (logThisRun) {
12720
- (0, import_chunk_NHZRKHZO.log)("====== Dead Stores =====");
12892
+ (0, import_chunk_X7QCZR3F.log)("====== Dead Stores =====");
12721
12893
  deadStores.forEach(
12722
- (dead) => (dead.type === "AssignmentExpression" || dead.type === "UpdateExpression" || dead.type === "VariableDeclarator") && (0, import_chunk_NHZRKHZO.log)(
12894
+ (dead) => (dead.type === "AssignmentExpression" || dead.type === "UpdateExpression" || dead.type === "VariableDeclarator") && (0, import_chunk_X7QCZR3F.log)(
12723
12895
  formatAstLongLines(dead).then(
12724
12896
  (deadStr) => `${deadStr} (${sourceLocation(dead.loc)})`
12725
12897
  )
@@ -12774,7 +12946,7 @@ var init_dead_store = (0, import_chunk_ABYVSU2C.__esm)({
12774
12946
  init_control_flow();
12775
12947
  init_data_flow();
12776
12948
  init_inliner();
12777
- (0, import_chunk_NHZRKHZO.init_util)();
12949
+ (0, import_chunk_X7QCZR3F.init_util)();
12778
12950
  init_minimize_locals();
12779
12951
  init_type_flow_util();
12780
12952
  }
@@ -13124,14 +13296,9 @@ function mergeTypeState(blockStates, index, from, nodeCopyProp) {
13124
13296
  return;
13125
13297
  }
13126
13298
  }
13127
- let result = cloneType(tov.curType);
13128
- if (!unionInto(result, fromv.curType))
13299
+ const result = cloneType(tov.curType);
13300
+ if (!unionHelper(result, fromv.curType, widen ? 0 : -Infinity))
13129
13301
  return;
13130
- if (widen) {
13131
- const wide = widenType(result);
13132
- if (wide)
13133
- result = wide;
13134
- }
13135
13302
  tov.curType = result;
13136
13303
  changes = true;
13137
13304
  });
@@ -13142,13 +13309,13 @@ function typeStateEntry(value2, key) {
13142
13309
  return `${tsKey(key)} = ${display(value2.curType)}`;
13143
13310
  }
13144
13311
  function printBlockState(block, state, indent = "") {
13145
- (0, import_chunk_NHZRKHZO.log)(indent + "State:");
13312
+ (0, import_chunk_X7QCZR3F.log)(indent + "State:");
13146
13313
  if (!state) {
13147
- (0, import_chunk_NHZRKHZO.log)(indent + "Not visited!");
13314
+ (0, import_chunk_X7QCZR3F.log)(indent + "Not visited!");
13148
13315
  return;
13149
13316
  }
13150
13317
  state.map.forEach((value2, key) => {
13151
- (0, import_chunk_NHZRKHZO.log)(
13318
+ (0, import_chunk_X7QCZR3F.log)(
13152
13319
  `${indent} - ${typeStateEntry(value2, key)}${value2.equivSet ? ` [(${Array.from(value2.equivSet).map(tsKey).join(", ")})]` : ""}`
13153
13320
  );
13154
13321
  });
@@ -13202,11 +13369,11 @@ function updateAffected(blockState, objectType, baseDecl, assignedPath, affected
13202
13369
  /* Array */
13203
13370
  );
13204
13371
  if (atype) {
13205
- if (Array.isArray(atype)) {
13206
- atype.forEach((value2) => unionInto(newType, value2));
13207
- } else {
13208
- unionInto(newType, atype);
13209
- }
13372
+ tupleForEach(
13373
+ atype,
13374
+ (v) => v.forEach((value2) => unionInto(newType, value2)),
13375
+ (v) => unionInto(newType, v)
13376
+ );
13210
13377
  }
13211
13378
  }
13212
13379
  if (type.type & 1024) {
@@ -13334,7 +13501,7 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
13334
13501
  next = t;
13335
13502
  }
13336
13503
  if (cur.type & 512) {
13337
- let avalue = getUnionComponent(
13504
+ const avalue = getUnionComponent(
13338
13505
  cur,
13339
13506
  512
13340
13507
  /* Array */
@@ -13342,29 +13509,41 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
13342
13509
  type: 524287
13343
13510
  /* Any */
13344
13511
  };
13345
- if (Array.isArray(avalue)) {
13346
- const index = arrayLiteralKeyFromExpr(me.property);
13347
- if (index != null && avalue[index] != null) {
13348
- if (!next) {
13349
- assocValue[i].keyStr = index;
13512
+ const index = arrayLiteralKeyFromExpr(me.property);
13513
+ tupleForEach(
13514
+ avalue,
13515
+ (av) => {
13516
+ let possibleValues = av;
13517
+ if (index != null) {
13518
+ if (av[index] != null) {
13519
+ if (!next) {
13520
+ assocValue[i].keyStr = index;
13521
+ }
13522
+ possibleValues = av[index];
13523
+ } else {
13524
+ possibleValues = {
13525
+ type: 0
13526
+ /* Never */
13527
+ };
13528
+ }
13529
+ }
13530
+ if (next || i !== l || !newValue) {
13531
+ const n = next ? cloneType(next) : {
13532
+ type: 0
13533
+ /* Never */
13534
+ };
13535
+ (0, import_chunk_X7QCZR3F.forEach)(possibleValues, (v) => unionInto(n, v));
13536
+ next = n;
13537
+ }
13538
+ },
13539
+ (av) => {
13540
+ if (next) {
13541
+ unionInto(next = cloneType(next), av);
13542
+ } else {
13543
+ next = av;
13350
13544
  }
13351
- avalue = avalue[index];
13352
- }
13353
- if (next || i !== l || !newValue) {
13354
- const n = next ? cloneType(next) : {
13355
- type: 0
13356
- /* Never */
13357
- };
13358
- (0, import_chunk_NHZRKHZO.forEach)(avalue, (v) => unionInto(n, v));
13359
- next = n;
13360
- }
13361
- } else {
13362
- if (next) {
13363
- unionInto(next = cloneType(next), avalue);
13364
- } else {
13365
- next = avalue;
13366
13545
  }
13367
- }
13546
+ );
13368
13547
  }
13369
13548
  let isExact2 = false;
13370
13549
  if (cur.type & 1024) {
@@ -13460,7 +13639,7 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
13460
13639
  }
13461
13640
  if (!isStatic && selfClassDecl) {
13462
13641
  const baseObj = getObjectValue(baseElem.type);
13463
- if (baseObj && baseObj.klass.type === 16384 && (0, import_chunk_NHZRKHZO.some)(
13642
+ if (baseObj && baseObj.klass.type === 16384 && (0, import_chunk_X7QCZR3F.some)(
13464
13643
  baseObj.klass.value,
13465
13644
  (cls) => cls === selfClassDecl || getSuperClasses(cls)?.has(selfClassDecl) || getSuperClasses(selfClassDecl)?.has(cls) || false
13466
13645
  )) {
@@ -13505,7 +13684,7 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
13505
13684
  return [cur, updateAny];
13506
13685
  }
13507
13686
  function typeConstraint(decls, blockState) {
13508
- return (0, import_chunk_NHZRKHZO.reduce)(
13687
+ return (0, import_chunk_X7QCZR3F.reduce)(
13509
13688
  decls,
13510
13689
  (cur, decl) => {
13511
13690
  if (decl.type === "Identifier" || decl.type === "BinaryExpression") {
@@ -13615,9 +13794,9 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
13615
13794
  root,
13616
13795
  dependencies
13617
13796
  };
13618
- const modifiableDecl = (decls, callees) => (0, import_chunk_NHZRKHZO.some)(
13797
+ const modifiableDecl = (decls, callees) => (0, import_chunk_X7QCZR3F.some)(
13619
13798
  decls,
13620
- (decl) => decl.type === "VariableDeclarator" && decl.node.kind === "var" && !isLocal(decl) && (!callees || (0, import_chunk_NHZRKHZO.some)(callees, (callee) => functionMayModify(state, callee, decl)))
13799
+ (decl) => decl.type === "VariableDeclarator" && decl.node.kind === "var" && !isLocal(decl) && (!callees || (0, import_chunk_X7QCZR3F.some)(callees, (callee) => functionMayModify(state, callee, decl)))
13621
13800
  );
13622
13801
  const mergeSuccState = (top, curState) => {
13623
13802
  top.succs?.forEach((succ) => {
@@ -13626,7 +13805,7 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
13626
13805
  }
13627
13806
  if (mergeTypeState(blockStates, succ.order, curState, nodeCopyProp)) {
13628
13807
  if (logThisRun) {
13629
- (0, import_chunk_NHZRKHZO.log)(`re-merge: ${top.order} -> ${succ.order}`);
13808
+ (0, import_chunk_X7QCZR3F.log)(`re-merge: ${top.order} -> ${succ.order}`);
13630
13809
  }
13631
13810
  queue.enqueue(succ);
13632
13811
  }
@@ -13636,14 +13815,14 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
13636
13815
  const calleeObj = getStateType(curState, calleeObjDecl);
13637
13816
  let calleeResult = null;
13638
13817
  let effectFree = true;
13639
- (0, import_chunk_NHZRKHZO.forEach)(callees, (callee) => {
13818
+ (0, import_chunk_X7QCZR3F.forEach)(callees, (callee) => {
13640
13819
  const info = sysCallInfo(istate.state, callee);
13641
13820
  if (!info) {
13642
13821
  effectFree = false;
13643
13822
  return;
13644
13823
  }
13645
13824
  const result = info(
13646
- istate.state,
13825
+ istate,
13647
13826
  callee,
13648
13827
  calleeObj,
13649
13828
  () => node.arguments.map((arg) => evaluateExpr(state, arg, typeMap).value)
@@ -13913,7 +14092,7 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
13913
14092
  });
13914
14093
  } else {
13915
14094
  if (logThisRun) {
13916
- (0, import_chunk_NHZRKHZO.log)(` Flow (true): merge to ${trueSucc.order || -1}`);
14095
+ (0, import_chunk_X7QCZR3F.log)(` Flow (true): merge to ${trueSucc.order || -1}`);
13917
14096
  printBlockState(top, sTrue || curState, " >true ");
13918
14097
  }
13919
14098
  if (mergeTypeState(
@@ -13923,7 +14102,7 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
13923
14102
  nodeCopyProp
13924
14103
  )) {
13925
14104
  if (logThisRun) {
13926
- (0, import_chunk_NHZRKHZO.log)(`re-merge: ${top.order} -> ${trueSucc.order}`);
14105
+ (0, import_chunk_X7QCZR3F.log)(`re-merge: ${top.order} -> ${trueSucc.order}`);
13927
14106
  }
13928
14107
  queue.enqueue(trueSucc);
13929
14108
  }
@@ -13935,7 +14114,7 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
13935
14114
  });
13936
14115
  } else {
13937
14116
  if (logThisRun) {
13938
- (0, import_chunk_NHZRKHZO.log)(` Flow (false): merge to: ${falseSucc.order || -1}`);
14117
+ (0, import_chunk_X7QCZR3F.log)(` Flow (false): merge to: ${falseSucc.order || -1}`);
13939
14118
  printBlockState(top, sFalse || curState, " >false ");
13940
14119
  }
13941
14120
  if (mergeTypeState(
@@ -13945,7 +14124,7 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
13945
14124
  nodeCopyProp
13946
14125
  )) {
13947
14126
  if (logThisRun) {
13948
- (0, import_chunk_NHZRKHZO.log)(`re-merge: ${top.order} -> ${falseSucc.order}`);
14127
+ (0, import_chunk_X7QCZR3F.log)(`re-merge: ${top.order} -> ${falseSucc.order}`);
13949
14128
  }
13950
14129
  queue.enqueue(falseSucc);
13951
14130
  }
@@ -14035,7 +14214,7 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
14035
14214
  }
14036
14215
  }
14037
14216
  if (logThisRun) {
14038
- (0, import_chunk_NHZRKHZO.log)(
14217
+ (0, import_chunk_X7QCZR3F.log)(
14039
14218
  describeEvent(event).then(
14040
14219
  (eventStr) => ` ${eventStr} == ${display(curEntry.curType)}`
14041
14220
  )
@@ -14045,7 +14224,7 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
14045
14224
  }
14046
14225
  case "mod": {
14047
14226
  if (logThisRun) {
14048
- (0, import_chunk_NHZRKHZO.log)(describeEvent(event).then((eventStr) => ` ${eventStr}`));
14227
+ (0, import_chunk_X7QCZR3F.log)(describeEvent(event).then((eventStr) => ` ${eventStr}`));
14049
14228
  }
14050
14229
  modInterference(curState, event, true, (callees, calleeObj) => {
14051
14230
  clearRelatedCopyPropEvents(curState, null, nodeCopyProp);
@@ -14061,7 +14240,7 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
14061
14240
  );
14062
14241
  }
14063
14242
  }
14064
- if (nodeCopyProp.size && event.node.type === "CallExpression" && (0, import_chunk_NHZRKHZO.some)(callees, (callee) => inlineRequested(state, callee))) {
14243
+ if (nodeCopyProp.size && event.node.type === "CallExpression" && (0, import_chunk_X7QCZR3F.some)(callees, (callee) => inlineRequested(state, callee))) {
14065
14244
  event.node.arguments.forEach((arg) => {
14066
14245
  const def = nodeCopyProp.get(arg);
14067
14246
  if (def && nodeCopyProp.get(def) !== false) {
@@ -14073,7 +14252,7 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
14073
14252
  let calleeEffects;
14074
14253
  curState.map.forEach((tsv, decl) => {
14075
14254
  let type = tsv.curType;
14076
- if ((type.value == null || !(type.type & (32768 | 512 | 1024))) && !(0, import_chunk_NHZRKHZO.some)(decl, (d) => d.type === "VariableDeclarator" && !isLocal(d))) {
14255
+ if ((type.value == null || !(type.type & (32768 | 512 | 1024))) && !(0, import_chunk_X7QCZR3F.some)(decl, (d) => d.type === "VariableDeclarator" && !isLocal(d))) {
14077
14256
  return;
14078
14257
  }
14079
14258
  if (modifiableDecl(decl, callees)) {
@@ -14088,7 +14267,7 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
14088
14267
  curState.map.set(decl, {
14089
14268
  curType: typeConstraint(decl, curState)
14090
14269
  });
14091
- } else if (type.type & (32768 | 512 | 1024) && (calleeEffects == null ? calleeEffects = !callees || !(0, import_chunk_NHZRKHZO.every)(callees, (callee) => callee.info === false) : calleeEffects)) {
14270
+ } else if (type.type & (32768 | 512 | 1024) && (calleeEffects == null ? calleeEffects = !callees || !(0, import_chunk_X7QCZR3F.every)(callees, (callee) => callee.info === false) : calleeEffects)) {
14092
14271
  if (type.value != null && type.type & 32768) {
14093
14272
  const odata = getObjectValue(tsv.curType);
14094
14273
  if (odata?.obj) {
@@ -14158,13 +14337,13 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
14158
14337
  );
14159
14338
  if (type.type !== 524287) {
14160
14339
  if (event.node.type === "EnumStringMember" || event.node.type === "VariableDeclarator" && event.node.kind === "const") {
14161
- (0, import_chunk_NHZRKHZO.forEach)(
14340
+ (0, import_chunk_X7QCZR3F.forEach)(
14162
14341
  event.decl,
14163
14342
  (decl) => (decl.type === "VariableDeclarator" ? decl.node === event.node : decl === event.node) && (decl.resolvedType = type)
14164
14343
  );
14165
14344
  }
14166
14345
  }
14167
- (0, import_chunk_NHZRKHZO.some)(event.decl, (decl) => {
14346
+ (0, import_chunk_X7QCZR3F.some)(event.decl, (decl) => {
14168
14347
  if (decl.type !== "VariableDeclarator" || decl.node.kind !== "var" || !isClassVariable(decl)) {
14169
14348
  return false;
14170
14349
  }
@@ -14172,7 +14351,7 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
14172
14351
  if (affected) {
14173
14352
  const objType = typeFromTypeStateNodes(
14174
14353
  istate.state,
14175
- (0, import_chunk_NHZRKHZO.map)(
14354
+ (0, import_chunk_X7QCZR3F.map)(
14176
14355
  event.decl,
14177
14356
  (decl2) => decl2.type === "VariableDeclarator" && decl2.stack[decl2.stack.length - 1].sn
14178
14357
  ).filter(
@@ -14193,7 +14372,7 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
14193
14372
  });
14194
14373
  if (wasComputedDecl) {
14195
14374
  curState.map.forEach((value2, decls) => {
14196
- if ((0, import_chunk_NHZRKHZO.some)(
14375
+ if ((0, import_chunk_X7QCZR3F.some)(
14197
14376
  decls,
14198
14377
  (decl) => decl.type === "VariableDeclarator" && decl.node.kind === "var" && !isLocal(decl)
14199
14378
  )) {
@@ -14239,14 +14418,14 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
14239
14418
  }
14240
14419
  if (!copyPropCandidate.ant || // If the ref isn't anticipated, we can't propagate it
14241
14420
  // in case it has side effects.
14242
- (0, import_chunk_NHZRKHZO.some)(
14421
+ (0, import_chunk_X7QCZR3F.some)(
14243
14422
  event2.calleeDecl,
14244
14423
  (callee) => callee.type === "FunctionDeclaration" && inlineRequested(state, callee)
14245
14424
  )) {
14246
14425
  return false;
14247
14426
  }
14248
14427
  }
14249
- if (!event2.decl || isTypeStateKey(event2.decl) && (0, import_chunk_NHZRKHZO.some)(
14428
+ if (!event2.decl || isTypeStateKey(event2.decl) && (0, import_chunk_X7QCZR3F.some)(
14250
14429
  event2.decl,
14251
14430
  (decl) => decl.type === "VariableDeclarator" && decl.node.kind === "var" || decl.type === "BinaryExpression" || decl.type === "Identifier"
14252
14431
  )) {
@@ -14285,13 +14464,13 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
14285
14464
  }
14286
14465
  }
14287
14466
  if (uninitClassDecls?.size) {
14288
- (0, import_chunk_NHZRKHZO.forEach)(
14467
+ (0, import_chunk_X7QCZR3F.forEach)(
14289
14468
  event.decl,
14290
14469
  (decl) => uninitClassDecls.has(decl) && curState.inited?.add(decl)
14291
14470
  );
14292
14471
  }
14293
14472
  if (logThisRun) {
14294
- (0, import_chunk_NHZRKHZO.log)(
14473
+ (0, import_chunk_X7QCZR3F.log)(
14295
14474
  describeEvent(event).then(
14296
14475
  (eventStr) => ` ${eventStr} := ${display(type)}`
14297
14476
  )
@@ -14309,7 +14488,7 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
14309
14488
  );
14310
14489
  }
14311
14490
  if (logThisRun) {
14312
- (0, import_chunk_NHZRKHZO.log)(
14491
+ (0, import_chunk_X7QCZR3F.log)(
14313
14492
  describeEvent(event).then(
14314
14493
  (eventStr) => ` ${eventStr} : ${!Array.isArray(event.left) && event.left.type === "MemberDecl" ? `${display(
14315
14494
  curState.map.get(event.left.base)?.curType || {
@@ -14369,8 +14548,8 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
14369
14548
  }
14370
14549
  if (!successorsHandled) {
14371
14550
  if (logThisRun) {
14372
- (0, import_chunk_NHZRKHZO.log)(
14373
- ` merge to: ${(0, import_chunk_NHZRKHZO.map)(
14551
+ (0, import_chunk_X7QCZR3F.log)(
14552
+ ` merge to: ${(0, import_chunk_X7QCZR3F.map)(
14374
14553
  top.succs,
14375
14554
  (succ) => succ.order || -1
14376
14555
  ).join(", ")}`
@@ -14395,7 +14574,7 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
14395
14574
  (block) => block.events?.forEach((event) => {
14396
14575
  if (event.type !== "ref")
14397
14576
  return;
14398
- (0, import_chunk_NHZRKHZO.forEach)(event.decl, (decl) => {
14577
+ (0, import_chunk_X7QCZR3F.forEach)(event.decl, (decl) => {
14399
14578
  if (decl.type === "VariableDeclarator" && decl.node.kind === "const" && (!decl.resolvedType || !hasValue(decl.resolvedType))) {
14400
14579
  const root2 = decl.stack.at(-1)?.sn;
14401
14580
  if (!root2 || root2.type !== "ModuleDeclaration" && root2.type !== "ClassDeclaration" && root2.type !== "Program") {
@@ -14435,17 +14614,17 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
14435
14614
  );
14436
14615
  printBlockTrailer(block);
14437
14616
  });
14438
- (0, import_chunk_NHZRKHZO.log)("====== TypeMap =====");
14617
+ (0, import_chunk_X7QCZR3F.log)("====== TypeMap =====");
14439
14618
  typeMap.forEach((value2, key) => {
14440
- (0, import_chunk_NHZRKHZO.log)(
14619
+ (0, import_chunk_X7QCZR3F.log)(
14441
14620
  formatAstLongLines(key).then(
14442
14621
  (keyStr) => `${keyStr} = ${display(value2)} ${key.loc && key.loc.source ? ` (${sourceLocation(key.loc)})` : ""}`
14443
14622
  )
14444
14623
  );
14445
14624
  });
14446
- (0, import_chunk_NHZRKHZO.log)("====== EquivMap =====");
14625
+ (0, import_chunk_X7QCZR3F.log)("====== EquivMap =====");
14447
14626
  nodeEquivs.forEach((value2, key) => {
14448
- (0, import_chunk_NHZRKHZO.log)(
14627
+ (0, import_chunk_X7QCZR3F.log)(
14449
14628
  formatAstLongLines(key).then(
14450
14629
  (keyStr) => `${keyStr} = [${value2.equiv.map(
14451
14630
  (equiv) => tsKey(equiv)
@@ -14453,7 +14632,7 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
14453
14632
  )
14454
14633
  );
14455
14634
  });
14456
- (0, import_chunk_NHZRKHZO.log)("====== Copy Prop =====");
14635
+ (0, import_chunk_X7QCZR3F.log)("====== Copy Prop =====");
14457
14636
  nodeCopyProp.forEach((value2, key) => {
14458
14637
  (0, import_node_assert3.default)(value2 !== false);
14459
14638
  if (key.type === "VariableDeclarator" || key.type === "AssignmentExpression") {
@@ -14463,7 +14642,7 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
14463
14642
  value2.type === "VariableDeclarator" && value2.init || value2.type === "AssignmentExpression"
14464
14643
  );
14465
14644
  const node = value2.type === "VariableDeclarator" ? value2.init : value2.right;
14466
- (0, import_chunk_NHZRKHZO.log)(
14645
+ (0, import_chunk_X7QCZR3F.log)(
14467
14646
  formatAstLongLines(key).then(
14468
14647
  (keyStr) => formatAstLongLines(node).then(
14469
14648
  (nodeStr) => `${keyStr} = [${nodeStr}] ${key.loc && key.loc.source ? ` (${sourceLocation(key.loc)})` : ""}`
@@ -14472,13 +14651,13 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
14472
14651
  );
14473
14652
  });
14474
14653
  if (root.nodes) {
14475
- root.nodes.forEach((stack, node) => (0, import_chunk_NHZRKHZO.log)(formatAstLongLines(node)));
14654
+ root.nodes.forEach((stack, node) => (0, import_chunk_X7QCZR3F.log)(formatAstLongLines(node)));
14476
14655
  } else {
14477
- (0, import_chunk_NHZRKHZO.log)(formatAstLongLines(root.node));
14656
+ (0, import_chunk_X7QCZR3F.log)(formatAstLongLines(root.node));
14478
14657
  }
14479
14658
  if (copyPropStores) {
14480
14659
  copyPropStores.forEach(({ ref, ant }, node) => {
14481
- (0, import_chunk_NHZRKHZO.log)(
14660
+ (0, import_chunk_X7QCZR3F.log)(
14482
14661
  formatAstLongLines(node).then(
14483
14662
  (nodeStr) => `copy-prop-store: ${nodeStr}${ant ? "!" : ""} => ${nodeCopyProp.get(node) !== ref ? "Failed" : "Success"}`
14484
14663
  )
@@ -14492,9 +14671,9 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
14492
14671
  }
14493
14672
  if (logThisRun) {
14494
14673
  if (selfAssignments.size) {
14495
- (0, import_chunk_NHZRKHZO.log)("====== Self Assignments =====");
14674
+ (0, import_chunk_X7QCZR3F.log)("====== Self Assignments =====");
14496
14675
  selfAssignments.forEach(
14497
- (self) => (0, import_chunk_NHZRKHZO.log)(
14676
+ (self) => (0, import_chunk_X7QCZR3F.log)(
14498
14677
  formatAstLongLines(self).then(
14499
14678
  (selfStr) => `${selfStr} (${sourceLocation(self.loc)})`
14500
14679
  )
@@ -14559,7 +14738,7 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
14559
14738
  if (copyNode) {
14560
14739
  if (node.type === "AssignmentExpression") {
14561
14740
  if (logThisRun) {
14562
- (0, import_chunk_NHZRKHZO.log)(
14741
+ (0, import_chunk_X7QCZR3F.log)(
14563
14742
  formatAstLongLines(node).then(
14564
14743
  (nodeStr) => `Killing copy-prop assignment ${nodeStr}`
14565
14744
  )
@@ -14574,7 +14753,7 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
14574
14753
  if (node.type === "VariableDeclarator") {
14575
14754
  (0, import_node_assert3.default)(node.init);
14576
14755
  if (logThisRun) {
14577
- (0, import_chunk_NHZRKHZO.log)(
14756
+ (0, import_chunk_X7QCZR3F.log)(
14578
14757
  formatAstLongLines(node).then(
14579
14758
  (nodeStr) => `Killing copy-prop variable initialization ${nodeStr}`
14580
14759
  )
@@ -14595,7 +14774,7 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
14595
14774
  right: copyNode.right
14596
14775
  };
14597
14776
  if (logThisRun) {
14598
- (0, import_chunk_NHZRKHZO.log)(
14777
+ (0, import_chunk_X7QCZR3F.log)(
14599
14778
  formatAstLongLines(node).then(
14600
14779
  (nodeStr) => formatAstLongLines(replacement2).then(
14601
14780
  (repStr) => `copy-prop ${nodeStr} => ${repStr}`
@@ -14608,7 +14787,7 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
14608
14787
  const init = copyNode.init;
14609
14788
  (0, import_node_assert3.default)(init);
14610
14789
  if (logThisRun) {
14611
- (0, import_chunk_NHZRKHZO.log)(
14790
+ (0, import_chunk_X7QCZR3F.log)(
14612
14791
  formatAstLongLines(node).then(
14613
14792
  (nodeStr) => formatAstLongLines(init).then(
14614
14793
  (initStr) => `copy-prop ${nodeStr} => ${initStr}`
@@ -14622,7 +14801,7 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
14622
14801
  }
14623
14802
  if (selfAssignments.has(node)) {
14624
14803
  if (logThisRun) {
14625
- (0, import_chunk_NHZRKHZO.log)(
14804
+ (0, import_chunk_X7QCZR3F.log)(
14626
14805
  formatAstLongLines(node).then(
14627
14806
  (nodeStr) => `Deleting self assignment: ${nodeStr} (${sourceLocation(
14628
14807
  node.loc
@@ -14666,7 +14845,7 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
14666
14845
  }, curInfo);
14667
14846
  if (rep === curInfo)
14668
14847
  return null;
14669
- const name = (0, import_chunk_NHZRKHZO.reduce)(
14848
+ const name = (0, import_chunk_X7QCZR3F.reduce)(
14670
14849
  rep.decl,
14671
14850
  (cur, decl) => decl.type === "VariableDeclarator" ? decl.name : cur,
14672
14851
  null
@@ -14674,7 +14853,7 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
14674
14853
  if (!name)
14675
14854
  return null;
14676
14855
  if (logThisRun) {
14677
- (0, import_chunk_NHZRKHZO.log)(
14856
+ (0, import_chunk_X7QCZR3F.log)(
14678
14857
  formatAstLongLines(node).then(
14679
14858
  (nodeStr) => `Replacing ${nodeStr} with ${name} at ${sourceLocation(
14680
14859
  node.loc
@@ -14729,24 +14908,39 @@ function updateByAssocPath(path7, property, update) {
14729
14908
  512
14730
14909
  /* Array */
14731
14910
  );
14732
- if (Array.isArray(avalue)) {
14733
- const key = pathElem.keyStr;
14734
- const relaxed = relaxType(property);
14735
- if (typeof key === "number" && key >= 0 && key < avalue.length) {
14736
- avalue = avalue.slice();
14737
- avalue[key] = relaxed;
14738
- } else {
14739
- avalue = avalue.map((v) => {
14740
- v = cloneType(v);
14741
- unionInto(v, relaxed);
14742
- return v;
14743
- });
14744
- }
14745
- } else {
14746
- avalue = valueToStore(avalue);
14911
+ const key = pathElem.keyStr;
14912
+ const relaxed = relaxType(property);
14913
+ if (avalue) {
14914
+ avalue = tupleMap(
14915
+ avalue,
14916
+ (v) => {
14917
+ if (typeof key === "number") {
14918
+ if (key < 0 || key >= v.length) {
14919
+ return null;
14920
+ }
14921
+ v = v.slice();
14922
+ v[key] = relaxed;
14923
+ return v;
14924
+ }
14925
+ return v.map((v2) => {
14926
+ v2 = cloneType(v2);
14927
+ unionInto(v2, relaxed);
14928
+ return v2;
14929
+ });
14930
+ },
14931
+ (v) => valueToStore(v),
14932
+ tupleReduce
14933
+ );
14747
14934
  }
14748
14935
  object = cloneType(object);
14749
- setUnionComponent(object, 512, avalue);
14936
+ setUnionComponent(
14937
+ object,
14938
+ 512,
14939
+ avalue ?? {
14940
+ type: 524287
14941
+ /* Any */
14942
+ }
14943
+ );
14750
14944
  }
14751
14945
  if (object.type & 1024) {
14752
14946
  const dvalue = getUnionComponent(
@@ -14805,7 +14999,7 @@ var init_type_flow = (0, import_chunk_ABYVSU2C.__esm)({
14805
14999
  init_type_flow_util();
14806
15000
  init_types();
14807
15001
  init_union_type();
14808
- (0, import_chunk_NHZRKHZO.init_util)();
15002
+ (0, import_chunk_X7QCZR3F.init_util)();
14809
15003
  logging = true;
14810
15004
  missingNullWorkaround = true;
14811
15005
  }
@@ -14857,9 +15051,9 @@ function minimizeLocals(state, func) {
14857
15051
  if (!didMerge)
14858
15052
  return;
14859
15053
  if (logThisRun) {
14860
- (0, import_chunk_NHZRKHZO.log)(`>>> Merging locals in ${func.fullName}`);
15054
+ (0, import_chunk_X7QCZR3F.log)(`>>> Merging locals in ${func.fullName}`);
14861
15055
  merge.forEach(
14862
- (merged) => merged.length > 1 && (0, import_chunk_NHZRKHZO.log)(` - merging ${merged.map((k) => tsKey(k)).join(" | ")}`)
15056
+ (merged) => merged.length > 1 && (0, import_chunk_X7QCZR3F.log)(` - merging ${merged.map((k) => tsKey(k)).join(" | ")}`)
14863
15057
  );
14864
15058
  }
14865
15059
  const remap = /* @__PURE__ */ new Map();
@@ -15129,7 +15323,7 @@ var init_minimize_locals = (0, import_chunk_ABYVSU2C.__esm)({
15129
15323
  (0, import_chunk_JDC43A3I.init_ast)();
15130
15324
  init_control_flow();
15131
15325
  init_type_flow();
15132
- (0, import_chunk_NHZRKHZO.init_util)();
15326
+ (0, import_chunk_X7QCZR3F.init_util)();
15133
15327
  init_variable_renamer();
15134
15328
  init_type_flow_util();
15135
15329
  }
@@ -15140,12 +15334,12 @@ function logAntState(s, decl) {
15140
15334
  defs2++;
15141
15335
  return defs2;
15142
15336
  }, 0);
15143
- (0, import_chunk_NHZRKHZO.log)(
15337
+ (0, import_chunk_X7QCZR3F.log)(
15144
15338
  declFullName(decl).then(
15145
15339
  (declStr) => ` - ${declStr}: ${candidateCost(s)} bytes, ${s.ant.size - defs} refs, ${defs} defs, ${s.live ? "" : "!"}live, ${s.isIsolated ? "" : "!"}isolated`
15146
15340
  )
15147
15341
  );
15148
- (0, import_chunk_NHZRKHZO.log)(
15342
+ (0, import_chunk_X7QCZR3F.log)(
15149
15343
  ` - members: ${Array.from(s.members).map(([block, live]) => block.order + (live ? "t" : "f")).join(", ")}`
15150
15344
  );
15151
15345
  }
@@ -15162,7 +15356,7 @@ async function sizeBasedPRE(state, func) {
15162
15356
  const candidates = computeAttributes(state, head);
15163
15357
  if (candidates) {
15164
15358
  if (logging2) {
15165
- (0, import_chunk_NHZRKHZO.log)(`Found ${candidates.size} candidates in ${func.fullName}`);
15359
+ (0, import_chunk_X7QCZR3F.log)(`Found ${candidates.size} candidates in ${func.fullName}`);
15166
15360
  logAntDecls(candidates);
15167
15361
  }
15168
15362
  const nodeMap = /* @__PURE__ */ new Map();
@@ -15255,7 +15449,7 @@ function buildPREGraph(state, func) {
15255
15449
  const event = block.events[i];
15256
15450
  switch (event.type) {
15257
15451
  case "ref":
15258
- if ((0, import_chunk_NHZRKHZO.some)(
15452
+ if ((0, import_chunk_X7QCZR3F.some)(
15259
15453
  event.decl,
15260
15454
  (decl) => decl.type === "Literal" || decl.type === "VariableDeclarator" && decl.node.kind === "const"
15261
15455
  )) {
@@ -15273,7 +15467,7 @@ function buildPREGraph(state, func) {
15273
15467
  defs.add(event.decl);
15274
15468
  break;
15275
15469
  case "mod":
15276
- if (event.callees && (0, import_chunk_NHZRKHZO.every)(event.callees, (callee) => callee.info === false)) {
15470
+ if (event.callees && (0, import_chunk_X7QCZR3F.every)(event.callees, (callee) => callee.info === false)) {
15277
15471
  block.events.splice(i, 1);
15278
15472
  break;
15279
15473
  }
@@ -15432,21 +15626,21 @@ function computeAttributes(state, head) {
15432
15626
  });
15433
15627
  if (logging2) {
15434
15628
  order.forEach((block) => {
15435
- (0, import_chunk_NHZRKHZO.log)(
15629
+ (0, import_chunk_X7QCZR3F.log)(
15436
15630
  block.order,
15437
15631
  `(${block.node ? block.node.loc?.start.line : "??"})`,
15438
15632
  `Preds: ${(block.preds || []).map((block2) => block2.order).join(", ")}`
15439
15633
  );
15440
15634
  if (block.events) {
15441
15635
  block.events.forEach(
15442
- (event) => event.type !== "exn" && (0, import_chunk_NHZRKHZO.log)(
15636
+ (event) => event.type !== "exn" && (0, import_chunk_X7QCZR3F.log)(
15443
15637
  Promise.resolve(
15444
15638
  event.decl ? declFullName(event.decl) : event.node ? formatAstLongLines(event.node) : "??"
15445
15639
  ).then((eventDetails) => ` ${event.type}: ${eventDetails}`)
15446
15640
  )
15447
15641
  );
15448
15642
  }
15449
- (0, import_chunk_NHZRKHZO.log)(
15643
+ (0, import_chunk_X7QCZR3F.log)(
15450
15644
  `Succs: ${(block.succs || []).map((block2) => block2.order).join(", ")} ExSucc: ${block.exsucc ? block.exsucc.order : ""}`
15451
15645
  );
15452
15646
  });
@@ -15514,7 +15708,7 @@ function computeAttributes(state, head) {
15514
15708
  }
15515
15709
  case "mod": {
15516
15710
  curState.forEach((candidates, decls) => {
15517
- if ((0, import_chunk_NHZRKHZO.some)(
15711
+ if ((0, import_chunk_X7QCZR3F.some)(
15518
15712
  decls,
15519
15713
  (decl) => decl.type === "VariableDeclarator" && decl.node.kind === "var" && candidates.live && (!event.callees || event.callees.some(
15520
15714
  (callee) => functionMayModify(state, callee, decl)
@@ -15556,7 +15750,7 @@ function computeAttributes(state, head) {
15556
15750
  }
15557
15751
  blockStates[top.order] = curState;
15558
15752
  if (logging2) {
15559
- (0, import_chunk_NHZRKHZO.log)(`Updated block ${top.order}`);
15753
+ (0, import_chunk_X7QCZR3F.log)(`Updated block ${top.order}`);
15560
15754
  logAntDecls(curState);
15561
15755
  }
15562
15756
  if (top.preds) {
@@ -15658,7 +15852,7 @@ function applyReplacements(func, nodeMap, declMap) {
15658
15852
  }
15659
15853
  const name = declMap.get(event.decl);
15660
15854
  if (!name) {
15661
- throw new import_chunk_NHZRKHZO.AwaitedError(
15855
+ throw new import_chunk_X7QCZR3F.AwaitedError(
15662
15856
  formatAstLongLines(node).then(
15663
15857
  (targetStr) => `No replacement found for "${targetStr}"`
15664
15858
  )
@@ -15680,7 +15874,7 @@ function applyReplacements(func, nodeMap, declMap) {
15680
15874
  const target = node.type === "AssignmentExpression" ? node.left : node.argument;
15681
15875
  const name = declMap.get(event.decl);
15682
15876
  if (!name) {
15683
- throw new import_chunk_NHZRKHZO.AwaitedError(
15877
+ throw new import_chunk_X7QCZR3F.AwaitedError(
15684
15878
  formatAstLongLines(target).then(
15685
15879
  (targetStr) => `No replacement found for "${targetStr}"`
15686
15880
  )
@@ -15743,14 +15937,14 @@ function applyReplacements(func, nodeMap, declMap) {
15743
15937
  const decl = event.decl;
15744
15938
  const name = declMap.get(decl);
15745
15939
  if (!name) {
15746
- throw new import_chunk_NHZRKHZO.AwaitedError(
15940
+ throw new import_chunk_X7QCZR3F.AwaitedError(
15747
15941
  declFullName(decl).then(
15748
15942
  (declStr) => `No replacement found for "${declStr}"`
15749
15943
  )
15750
15944
  );
15751
15945
  }
15752
15946
  if (!event.id) {
15753
- throw new import_chunk_NHZRKHZO.AwaitedError(
15947
+ throw new import_chunk_X7QCZR3F.AwaitedError(
15754
15948
  declFullName(decl).then(
15755
15949
  (declStr) => `Missing id for mod event for "${declStr}"`
15756
15950
  )
@@ -15815,7 +16009,7 @@ var init_pre = (0, import_chunk_ABYVSU2C.__esm)({
15815
16009
  init_data_flow();
15816
16010
  init_function_info();
15817
16011
  init_minimize_locals();
15818
- (0, import_chunk_NHZRKHZO.init_util)();
16012
+ (0, import_chunk_X7QCZR3F.init_util)();
15819
16013
  logging2 = false;
15820
16014
  LocalRefCost = 2;
15821
16015
  }
@@ -16187,7 +16381,7 @@ function beforeEvaluate(istate, node) {
16187
16381
  break;
16188
16382
  }
16189
16383
  const id = node.right.argument;
16190
- if ((0, import_chunk_NHZRKHZO.every)(left.value.value, (m) => {
16384
+ if ((0, import_chunk_X7QCZR3F.every)(left.value.value, (m) => {
16191
16385
  if ((0, import_chunk_JDC43A3I.hasProperty)(m.decls, id.name))
16192
16386
  return false;
16193
16387
  return istate.state.lookup({
@@ -16633,7 +16827,7 @@ var init_optimize = (0, import_chunk_ABYVSU2C.__esm)({
16633
16827
  (0, import_chunk_JDC43A3I.init_ast)();
16634
16828
  init_inliner();
16635
16829
  init_type_flow();
16636
- (0, import_chunk_NHZRKHZO.init_util)();
16830
+ (0, import_chunk_X7QCZR3F.init_util)();
16637
16831
  init_interp();
16638
16832
  init_interp_binary();
16639
16833
  init_types();
@@ -17220,11 +17414,11 @@ function markFunctionCalled(state, func) {
17220
17414
  state.calledFunctions[func.id.name] = [func];
17221
17415
  return;
17222
17416
  }
17223
- (0, import_chunk_NHZRKHZO.pushUnique)(state.calledFunctions[func.id.name], func);
17417
+ (0, import_chunk_X7QCZR3F.pushUnique)(state.calledFunctions[func.id.name], func);
17224
17418
  }
17225
17419
  function optimizeMonkeyC(fnMap, resourcesMap, manifestXML, config) {
17226
17420
  return optimizeMonkeyCHelper(fnMap, resourcesMap, manifestXML, config).catch(
17227
- (ex) => Promise.reject(ex instanceof import_chunk_NHZRKHZO.AwaitedError ? ex.resolve() : ex)
17421
+ (ex) => Promise.reject(ex instanceof import_chunk_X7QCZR3F.AwaitedError ? ex.resolve() : ex)
17228
17422
  );
17229
17423
  }
17230
17424
  async function optimizeMonkeyCHelper(fnMap, resourcesMap, manifestXML, config) {
@@ -17992,7 +18186,7 @@ var init_mc_rewrite = (0, import_chunk_ABYVSU2C.__esm)({
17992
18186
  init_sub_type();
17993
18187
  init_types();
17994
18188
  init_unused_exprs();
17995
- (0, import_chunk_NHZRKHZO.init_util)();
18189
+ (0, import_chunk_X7QCZR3F.init_util)();
17996
18190
  init_variable_renamer();
17997
18191
  }
17998
18192
  });
@@ -18442,35 +18636,41 @@ function add_one_resource(state, doc, module2, e, barrelNames) {
18442
18636
  let func;
18443
18637
  const makeVarDecl = (id2, outer) => {
18444
18638
  const loc = id2 && (0, import_chunk_JDC43A3I.adjustLoc)(id2.value.loc);
18639
+ const declarations = [];
18640
+ if (id2) {
18641
+ declarations.push({
18642
+ type: "VariableDeclarator",
18643
+ kind: "var",
18644
+ id: {
18645
+ type: "BinaryExpression",
18646
+ operator: "as",
18647
+ left: (0, import_chunk_JDC43A3I.makeIdentifier)(id2.value.value, loc),
18648
+ right: {
18649
+ type: "TypeSpecList",
18650
+ ts: [
18651
+ {
18652
+ type: "TypeSpecPart",
18653
+ name: (0, import_chunk_JDC43A3I.makeScopedName)(
18654
+ (state?.sdkVersion ?? 0) >= 7e6 ? "Toybox.Lang.ResourceId" : "Toybox.Lang.Symbol"
18655
+ )
18656
+ }
18657
+ ]
18658
+ }
18659
+ }
18660
+ });
18661
+ }
18662
+ if (init) {
18663
+ declarations.push({
18664
+ type: "VariableDeclarator",
18665
+ kind: "var",
18666
+ id: (0, import_chunk_JDC43A3I.makeIdentifier)("*invalid*"),
18667
+ init
18668
+ });
18669
+ }
18445
18670
  return (0, import_chunk_JDC43A3I.wrap)(
18446
18671
  {
18447
18672
  type: "VariableDeclaration",
18448
- declarations: [
18449
- (0, import_chunk_JDC43A3I.wrap)(
18450
- {
18451
- type: "VariableDeclarator",
18452
- kind: "var",
18453
- id: id2 && !init ? {
18454
- type: "BinaryExpression",
18455
- operator: "as",
18456
- left: (0, import_chunk_JDC43A3I.makeIdentifier)(id2.value.value, loc),
18457
- right: {
18458
- type: "TypeSpecList",
18459
- ts: [
18460
- {
18461
- type: "TypeSpecPart",
18462
- name: (0, import_chunk_JDC43A3I.makeScopedName)(
18463
- (state?.sdkVersion ?? 0) >= 7e6 ? "Toybox.Lang.ResourceId" : "Toybox.Lang.Symbol"
18464
- )
18465
- }
18466
- ]
18467
- }
18468
- } : (0, import_chunk_JDC43A3I.makeIdentifier)(id2 ? id2.value.value : "*invalid*", loc),
18469
- init
18470
- },
18471
- outer
18472
- )
18473
- ],
18673
+ declarations: declarations.map((d) => (0, import_chunk_JDC43A3I.wrap)(d, outer)),
18474
18674
  kind: "var"
18475
18675
  },
18476
18676
  outer
@@ -18971,7 +19171,7 @@ async function getApiMapping(state, resourcesMap, manifestXML) {
18971
19171
  throw `Negative constant ${fixup} was not a Literal`;
18972
19172
  }
18973
19173
  if (typeof init.value !== "number") {
18974
- (0, import_chunk_NHZRKHZO.log)(`Negative fixup ${fixup} was not a number!`);
19174
+ (0, import_chunk_X7QCZR3F.log)(`Negative fixup ${fixup} was not a number!`);
18975
19175
  } else if (init.value > 0) {
18976
19176
  init.value = -init.value;
18977
19177
  init.raw = "-" + init.raw;
@@ -19061,11 +19261,11 @@ function sameStateNodeDecl(a, b) {
19061
19261
  function sameLookupDefinition(a, b) {
19062
19262
  return (
19063
19263
  // sameStateNodeDecl(a.parent, b.parent) &&
19064
- (0, import_chunk_NHZRKHZO.sameArrays)(a.results, b.results, (ar, br) => sameStateNodeDecl(ar, br))
19264
+ (0, import_chunk_X7QCZR3F.sameArrays)(a.results, b.results, (ar, br) => sameStateNodeDecl(ar, br))
19065
19265
  );
19066
19266
  }
19067
19267
  function sameLookupResult(a, b) {
19068
- return (0, import_chunk_NHZRKHZO.sameArrays)(a, b, sameLookupDefinition);
19268
+ return (0, import_chunk_X7QCZR3F.sameArrays)(a, b, sameLookupDefinition);
19069
19269
  }
19070
19270
  function declKey(decl) {
19071
19271
  return isStateNode(decl) ? decl.type === "ModuleDeclaration" ? decl.fullName : decl.node : decl;
@@ -19654,7 +19854,7 @@ function stateFuncs() {
19654
19854
  if (!(0, import_chunk_JDC43A3I.hasProperty)(this.index, name)) {
19655
19855
  this.index[name] = [];
19656
19856
  }
19657
- (0, import_chunk_NHZRKHZO.pushUnique)(this.index[name], parent);
19857
+ (0, import_chunk_X7QCZR3F.pushUnique)(this.index[name], parent);
19658
19858
  }
19659
19859
  });
19660
19860
  break;
@@ -19709,7 +19909,7 @@ function stateFuncs() {
19709
19909
  if (!(0, import_chunk_JDC43A3I.hasProperty)(values, name)) {
19710
19910
  values[name] = [];
19711
19911
  }
19712
- if ((0, import_chunk_NHZRKHZO.pushUnique)(values[name], m) && currentEnum) {
19912
+ if ((0, import_chunk_X7QCZR3F.pushUnique)(values[name], m) && currentEnum) {
19713
19913
  if (!this.enumMap)
19714
19914
  this.enumMap = /* @__PURE__ */ new Map();
19715
19915
  this.enumMap.set(m, currentEnum);
@@ -19717,7 +19917,7 @@ function stateFuncs() {
19717
19917
  if (!(0, import_chunk_JDC43A3I.hasProperty)(this.index, name)) {
19718
19918
  this.index[name] = [];
19719
19919
  }
19720
- (0, import_chunk_NHZRKHZO.pushUnique)(this.index[name], parent);
19920
+ (0, import_chunk_X7QCZR3F.pushUnique)(this.index[name], parent);
19721
19921
  });
19722
19922
  break;
19723
19923
  }
@@ -20248,7 +20448,7 @@ var init_api = (0, import_chunk_ABYVSU2C.__esm)({
20248
20448
  init_sdk_util();
20249
20449
  init_type_flow_util();
20250
20450
  init_types();
20251
- (0, import_chunk_NHZRKHZO.init_util)();
20451
+ (0, import_chunk_X7QCZR3F.init_util)();
20252
20452
  init_visitor();
20253
20453
  }
20254
20454
  });
@@ -20332,7 +20532,7 @@ function buildDataFlowGraph(state, root, wantsLiteral, trackInsertionPoints, wan
20332
20532
  return decls;
20333
20533
  }
20334
20534
  if (canon.length !== decls.length || !canon.every((v, i) => v === decls[i])) {
20335
- throw new import_chunk_NHZRKHZO.AwaitedError(
20535
+ throw new import_chunk_X7QCZR3F.AwaitedError(
20336
20536
  declFullName(canon).then(
20337
20537
  (canonStr) => `Canonical representation of ${canonStr} did not match`
20338
20538
  )
@@ -20366,7 +20566,7 @@ function buildDataFlowGraph(state, root, wantsLiteral, trackInsertionPoints, wan
20366
20566
  }
20367
20567
  const decl = lookupDefToDecl(results);
20368
20568
  if (decl && path7.length) {
20369
- if (wantsAllRefs && (0, import_chunk_NHZRKHZO.every)(
20569
+ if (wantsAllRefs && (0, import_chunk_X7QCZR3F.every)(
20370
20570
  decl,
20371
20571
  (d) => d.type === "VariableDeclarator" || d.type === "BinaryExpression" || d.type === "Identifier"
20372
20572
  )) {
@@ -20418,7 +20618,7 @@ function buildDataFlowGraph(state, root, wantsLiteral, trackInsertionPoints, wan
20418
20618
  }
20419
20619
  const v = liveDefs.get(def);
20420
20620
  if (!v || !v.has(node)) {
20421
- throw new import_chunk_NHZRKHZO.AwaitedError(
20621
+ throw new import_chunk_X7QCZR3F.AwaitedError(
20422
20622
  Promise.resolve(def ? declFullName(def) : "null").then(
20423
20623
  (defStr) => `No stmt in liveDef for ${defStr}`
20424
20624
  )
@@ -20490,7 +20690,7 @@ function buildDataFlowGraph(state, root, wantsLiteral, trackInsertionPoints, wan
20490
20690
  const decls = findDecl(node);
20491
20691
  if (!decls)
20492
20692
  break;
20493
- if (trackInsertionPoints && (0, import_chunk_NHZRKHZO.some)(decls, (decl) => {
20693
+ if (trackInsertionPoints && (0, import_chunk_X7QCZR3F.some)(decls, (decl) => {
20494
20694
  if (decl.type === "VariableDeclarator") {
20495
20695
  const defStmts = decl.node.kind === "var" && liveDefs.get(null) || liveDefs.get(decl);
20496
20696
  if (defStmts) {
@@ -20757,8 +20957,8 @@ var init_data_flow = (0, import_chunk_ABYVSU2C.__esm)({
20757
20957
  init_control_flow();
20758
20958
  init_function_info();
20759
20959
  init_type_flow_util();
20760
- (0, import_chunk_NHZRKHZO.init_util)();
20761
- DataflowQueue = class extends import_chunk_NHZRKHZO.GenericQueue {
20960
+ (0, import_chunk_X7QCZR3F.init_util)();
20961
+ DataflowQueue = class extends import_chunk_X7QCZR3F.GenericQueue {
20762
20962
  constructor() {
20763
20963
  super((b, a) => (a.order || 0) - (b.order || 0));
20764
20964
  }
@@ -21553,7 +21753,7 @@ function computeJsrMap(func) {
21553
21753
  }
21554
21754
  function postOrderPropagate(func, preBlock, processBc, postBlock, merge) {
21555
21755
  const order = /* @__PURE__ */ new Map();
21556
- const queue = new import_chunk_NHZRKHZO.GenericQueue(
21756
+ const queue = new import_chunk_X7QCZR3F.GenericQueue(
21557
21757
  (b, a) => order.get(a) - order.get(b)
21558
21758
  );
21559
21759
  postOrderTraverse2(func, (block) => {
@@ -21612,7 +21812,7 @@ function rpoPropagate(func, preBlock, processBc, postBlock, merge) {
21612
21812
  });
21613
21813
  blocks.reverse().forEach((block, i) => order.set(block, i));
21614
21814
  }
21615
- const queue = new import_chunk_NHZRKHZO.GenericQueue(
21815
+ const queue = new import_chunk_X7QCZR3F.GenericQueue(
21616
21816
  (b, a) => order.get(a) - order.get(b)
21617
21817
  );
21618
21818
  queue.enqueue(func.blocks.get(func.offset));
@@ -21666,7 +21866,7 @@ function rpoPropagate(func, preBlock, processBc, postBlock, merge) {
21666
21866
  var init_cflow = (0, import_chunk_ABYVSU2C.__esm)({
21667
21867
  "src/readprg/cflow.ts"() {
21668
21868
  "use strict";
21669
- (0, import_chunk_NHZRKHZO.init_util)();
21869
+ (0, import_chunk_X7QCZR3F.init_util)();
21670
21870
  init_opcodes();
21671
21871
  }
21672
21872
  });
@@ -22129,12 +22329,12 @@ function interpFunc(func, context) {
22129
22329
  const selfStores = /* @__PURE__ */ new Set();
22130
22330
  const liveInState = /* @__PURE__ */ new Map();
22131
22331
  const replacements = /* @__PURE__ */ new Map();
22132
- const interpLogging = (0, import_chunk_NHZRKHZO.wouldLog)("interp", 1);
22332
+ const interpLogging = (0, import_chunk_X7QCZR3F.wouldLog)("interp", 1);
22133
22333
  if (interpLogging) {
22134
- if ((0, import_chunk_NHZRKHZO.wouldLog)("interp", 7)) {
22135
- (0, import_chunk_NHZRKHZO.setBanner)(functionBanner(func, context, "interp"));
22136
- } else if ((0, import_chunk_NHZRKHZO.wouldLog)("interp", 3)) {
22137
- (0, import_chunk_NHZRKHZO.setBanner)(
22334
+ if ((0, import_chunk_X7QCZR3F.wouldLog)("interp", 7)) {
22335
+ (0, import_chunk_X7QCZR3F.setBanner)(functionBanner(func, context, "interp"));
22336
+ } else if ((0, import_chunk_X7QCZR3F.wouldLog)("interp", 3)) {
22337
+ (0, import_chunk_X7QCZR3F.setBanner)(
22138
22338
  () => `+++++++++++++ interp-prepare ${func.name} ++++++++++++++`
22139
22339
  );
22140
22340
  }
@@ -22168,20 +22368,20 @@ function interpFunc(func, context) {
22168
22368
  func,
22169
22369
  (block) => {
22170
22370
  if (interpLogging) {
22171
- (0, import_chunk_NHZRKHZO.logger)(
22371
+ (0, import_chunk_X7QCZR3F.logger)(
22172
22372
  "interp",
22173
22373
  3,
22174
22374
  `${offsetToString(block.offset)}: ${block.bytecodes[0]?.lineNum ? lineInfoToString(block.bytecodes[0]?.lineNum, context) : ""}
22175
22375
  ${interpStateToString(liveInState.get(block.offset))}`
22176
22376
  );
22177
- (0, import_chunk_NHZRKHZO.logger)("interp", 9, () => blockToString(block, context));
22377
+ (0, import_chunk_X7QCZR3F.logger)("interp", 9, () => blockToString(block, context));
22178
22378
  }
22179
22379
  return cloneState2(liveInState.get(block.offset));
22180
22380
  },
22181
22381
  (block, bc, localState) => {
22182
22382
  if (interpLogging) {
22183
- if ((0, import_chunk_NHZRKHZO.wouldLog)("interp", 8)) {
22184
- (0, import_chunk_NHZRKHZO.log)(
22383
+ if ((0, import_chunk_X7QCZR3F.wouldLog)("interp", 8)) {
22384
+ (0, import_chunk_X7QCZR3F.log)(
22185
22385
  `${interpStateToString(localState)}
22186
22386
  ${bytecodeToString(
22187
22387
  bc,
@@ -22346,14 +22546,14 @@ function interpFunc(func, context) {
22346
22546
  if (!mergeInto(localState, succState))
22347
22547
  return false;
22348
22548
  if (interpLogging) {
22349
- (0, import_chunk_NHZRKHZO.logger)("interp", 3, `Re-Merge to ${offsetToString(succBlock.offset)}`);
22549
+ (0, import_chunk_X7QCZR3F.logger)("interp", 3, `Re-Merge to ${offsetToString(succBlock.offset)}`);
22350
22550
  }
22351
22551
  return true;
22352
22552
  }
22353
22553
  );
22354
22554
  if (interpLogging) {
22355
- if ((0, import_chunk_NHZRKHZO.wouldLog)("interp", 5)) {
22356
- (0, import_chunk_NHZRKHZO.setBanner)(
22555
+ if ((0, import_chunk_X7QCZR3F.wouldLog)("interp", 5)) {
22556
+ (0, import_chunk_X7QCZR3F.setBanner)(
22357
22557
  functionBanner(func, context, "interp", (block, footer) => {
22358
22558
  if (footer)
22359
22559
  return "";
@@ -22361,44 +22561,44 @@ function interpFunc(func, context) {
22361
22561
  })
22362
22562
  );
22363
22563
  } else {
22364
- (0, import_chunk_NHZRKHZO.setBanner)(() => `=============== interp ${func.name} ==============`);
22564
+ (0, import_chunk_X7QCZR3F.setBanner)(() => `=============== interp ${func.name} ==============`);
22365
22565
  }
22366
22566
  if (equivSets.size) {
22367
- (0, import_chunk_NHZRKHZO.log)(`====== equivSets =====`);
22567
+ (0, import_chunk_X7QCZR3F.log)(`====== equivSets =====`);
22368
22568
  equivSets.forEach(
22369
- (value2, key) => (0, import_chunk_NHZRKHZO.log)(
22569
+ (value2, key) => (0, import_chunk_X7QCZR3F.log)(
22370
22570
  `L${key.arg} === ${Array.from(value2).sort().join(" ")} ${key.lineNum ? lineInfoToString(key.lineNum, context) : ""}`
22371
22571
  )
22372
22572
  );
22373
22573
  }
22374
22574
  if (selfStores.size) {
22375
- (0, import_chunk_NHZRKHZO.log)(`====== selfStores =====`);
22575
+ (0, import_chunk_X7QCZR3F.log)(`====== selfStores =====`);
22376
22576
  selfStores.forEach(
22377
- (value2) => (0, import_chunk_NHZRKHZO.log)(`${bytecodeToString(value2, symbolTable)}`)
22577
+ (value2) => (0, import_chunk_X7QCZR3F.log)(`${bytecodeToString(value2, symbolTable)}`)
22378
22578
  );
22379
22579
  }
22380
22580
  if (replacements.size) {
22381
- (0, import_chunk_NHZRKHZO.log)(`====== replacements =====`);
22581
+ (0, import_chunk_X7QCZR3F.log)(`====== replacements =====`);
22382
22582
  replacements.forEach(
22383
22583
  (blockRep) => blockRep.forEach(
22384
- (rep, bc) => (0, import_chunk_NHZRKHZO.log)(
22584
+ (rep, bc) => (0, import_chunk_X7QCZR3F.log)(
22385
22585
  `${bytecodeToString(bc, symbolTable)} => ${rep.invert ? "~" : ""}${bytecodeToString(rep, symbolTable)} ${bc.lineNum ? lineInfoToString(bc.lineNum, context) : ""}`
22386
22586
  )
22387
22587
  )
22388
22588
  );
22389
22589
  }
22390
22590
  if (resolvedBranches.size) {
22391
- (0, import_chunk_NHZRKHZO.log)(`====== resolved branches =====`);
22591
+ (0, import_chunk_X7QCZR3F.log)(`====== resolved branches =====`);
22392
22592
  resolvedBranches.forEach(
22393
- (isTaken, block) => (0, import_chunk_NHZRKHZO.log)(
22593
+ (isTaken, block) => (0, import_chunk_X7QCZR3F.log)(
22394
22594
  `block ${offsetToString(block.offset)} is ${isTaken ? "always" : "never"} taken`
22395
22595
  )
22396
22596
  );
22397
22597
  }
22398
22598
  if (branchRedirects.size) {
22399
- (0, import_chunk_NHZRKHZO.log)(`====== redirected branches =====`);
22599
+ (0, import_chunk_X7QCZR3F.log)(`====== redirected branches =====`);
22400
22600
  branchRedirects.forEach(
22401
- ({ to, from }, block) => (0, import_chunk_NHZRKHZO.log)(
22601
+ ({ to, from }, block) => (0, import_chunk_X7QCZR3F.log)(
22402
22602
  `block ${offsetToString(
22403
22603
  block.offset
22404
22604
  )} redirects from ${offsetToString(from)} to ${offsetToString(to)}${safeBranchBlocks.get(from) ? ` popping ${safeBranchBlocks.get(from)}` : ""}`
@@ -22461,7 +22661,7 @@ function interpFunc(func, context) {
22461
22661
  }
22462
22662
  });
22463
22663
  if (interpLogging)
22464
- (0, import_chunk_NHZRKHZO.setBanner)(null);
22664
+ (0, import_chunk_X7QCZR3F.setBanner)(null);
22465
22665
  return {
22466
22666
  liveInState,
22467
22667
  equivSets,
@@ -22511,7 +22711,7 @@ var init_interp2 = (0, import_chunk_ABYVSU2C.__esm)({
22511
22711
  "src/readprg/interp.ts"() {
22512
22712
  "use strict";
22513
22713
  init_interp_binary();
22514
- (0, import_chunk_NHZRKHZO.init_logger)();
22714
+ (0, import_chunk_X7QCZR3F.init_logger)();
22515
22715
  init_interp();
22516
22716
  init_types();
22517
22717
  init_union_type();
@@ -22623,7 +22823,7 @@ function optimizeArrayInit(func, block, index, context, interpState) {
22623
22823
  i = found;
22624
22824
  }
22625
22825
  if (initType && (block.bytecodes[index].op === 20 ? initType.type === 1 : initType.type === 8 && initType.value === 0)) {
22626
- (0, import_chunk_NHZRKHZO.logger)(
22826
+ (0, import_chunk_X7QCZR3F.logger)(
22627
22827
  "array-init",
22628
22828
  1,
22629
22829
  () => `${func.name}: Removing initialization of default initialized ${putvStarts.length} element array init at block ${offsetToString(
@@ -22660,7 +22860,7 @@ function optimizeArrayInit(func, block, index, context, interpState) {
22660
22860
  convertAputv(offset - 1);
22661
22861
  }
22662
22862
  }
22663
- (0, import_chunk_NHZRKHZO.logger)(
22863
+ (0, import_chunk_X7QCZR3F.logger)(
22664
22864
  "array-init",
22665
22865
  1,
22666
22866
  () => `${func.name}: Optimizing unused ${putvStarts.length} element array init at block ${offsetToString(
@@ -22669,8 +22869,8 @@ function optimizeArrayInit(func, block, index, context, interpState) {
22669
22869
  block.bytecodes[index].offset
22670
22870
  )}`
22671
22871
  );
22672
- if ((0, import_chunk_NHZRKHZO.wouldLog)("array-init", 5)) {
22673
- (0, import_chunk_NHZRKHZO.log)(blockToString(block, context));
22872
+ if ((0, import_chunk_X7QCZR3F.wouldLog)("array-init", 5)) {
22873
+ (0, import_chunk_X7QCZR3F.log)(blockToString(block, context));
22674
22874
  }
22675
22875
  return true;
22676
22876
  }
@@ -22710,7 +22910,7 @@ function optimizeArrayInit(func, block, index, context, interpState) {
22710
22910
  if (putvStarts.length < 3)
22711
22911
  return false;
22712
22912
  tryLocal(3);
22713
- (0, import_chunk_NHZRKHZO.logger)(
22913
+ (0, import_chunk_X7QCZR3F.logger)(
22714
22914
  "array-init",
22715
22915
  1,
22716
22916
  () => `${func.name}: Optimizing ${putvStarts.length} element array init with constant initializer ${bytecodeToString(
@@ -22736,7 +22936,7 @@ function optimizeArrayInit(func, block, index, context, interpState) {
22736
22936
  block.bytecodes[index + 1].arg = putvStarts.length;
22737
22937
  }
22738
22938
  }
22739
- (0, import_chunk_NHZRKHZO.logger)(
22939
+ (0, import_chunk_X7QCZR3F.logger)(
22740
22940
  "array-init",
22741
22941
  5,
22742
22942
  () => `index: ${index}, i: ${i}
@@ -22789,7 +22989,7 @@ ${blockToString(block, context)}`
22789
22989
  for (let i2 = putvStarts.length; i2-- > 1; ) {
22790
22990
  block.bytecodes.splice(putvStarts[i2], 2);
22791
22991
  }
22792
- (0, import_chunk_NHZRKHZO.logger)(
22992
+ (0, import_chunk_X7QCZR3F.logger)(
22793
22993
  "array-init",
22794
22994
  1,
22795
22995
  () => `${func.name}: Optimizing ${putvStarts.length} element array init at block ${offsetToString(
@@ -22848,15 +23048,15 @@ var init_array_init = (0, import_chunk_ABYVSU2C.__esm)({
22848
23048
  "src/readprg/array-init.ts"() {
22849
23049
  "use strict";
22850
23050
  init_types();
22851
- (0, import_chunk_NHZRKHZO.init_util)();
23051
+ (0, import_chunk_X7QCZR3F.init_util)();
22852
23052
  init_bytecode();
22853
23053
  init_interp2();
22854
23054
  init_opcodes();
22855
23055
  }
22856
23056
  });
22857
23057
  function localDCE(func, context) {
22858
- if ((0, import_chunk_NHZRKHZO.wouldLog)("dce", 5)) {
22859
- (0, import_chunk_NHZRKHZO.setBanner)(
23058
+ if ((0, import_chunk_X7QCZR3F.wouldLog)("dce", 5)) {
23059
+ (0, import_chunk_X7QCZR3F.setBanner)(
22860
23060
  functionBanner(
22861
23061
  func,
22862
23062
  context,
@@ -22889,7 +23089,7 @@ function localDCE(func, context) {
22889
23089
  };
22890
23090
  func.blocks.forEach((block) => {
22891
23091
  const reportPopv = (i, item, kill) => {
22892
- (0, import_chunk_NHZRKHZO.logger)(
23092
+ (0, import_chunk_X7QCZR3F.logger)(
22893
23093
  "dce",
22894
23094
  2,
22895
23095
  () => `${func.name}: Convert ${i}:${bytecodeToString(
@@ -22904,7 +23104,7 @@ function localDCE(func, context) {
22904
23104
  );
22905
23105
  };
22906
23106
  const reportNop = (item) => {
22907
- (0, import_chunk_NHZRKHZO.logger)(
23107
+ (0, import_chunk_X7QCZR3F.logger)(
22908
23108
  "dce",
22909
23109
  2,
22910
23110
  () => `${func.name}: Kill ${item.deps.map(
@@ -22923,7 +23123,7 @@ function localDCE(func, context) {
22923
23123
  case 19: {
22924
23124
  const liveLocal = dceInfo.locals.has(bytecode.arg);
22925
23125
  if (!liveLocal && (bytecode.arg || context.config.allowForbiddenOpts)) {
22926
- (0, import_chunk_NHZRKHZO.logger)(
23126
+ (0, import_chunk_X7QCZR3F.logger)(
22927
23127
  "dce",
22928
23128
  2,
22929
23129
  () => `${func.name}: Killing store to unused local ${bytecode.arg} at ${offsetToString(block.offset)}:${i}`
@@ -23083,10 +23283,10 @@ function localDCE(func, context) {
23083
23283
  (bc) => bc.op !== 0
23084
23284
  /* nop */
23085
23285
  );
23086
- (0, import_chunk_NHZRKHZO.logger)("dce", 3, functionBanner(func, context, "local-dce-end"));
23286
+ (0, import_chunk_X7QCZR3F.logger)("dce", 3, functionBanner(func, context, "local-dce-end"));
23087
23287
  }
23088
23288
  });
23089
- (0, import_chunk_NHZRKHZO.setBanner)(null);
23289
+ (0, import_chunk_X7QCZR3F.setBanner)(null);
23090
23290
  return anyChanges;
23091
23291
  }
23092
23292
  function computeLiveLocals(func) {
@@ -23137,7 +23337,7 @@ var init_dce = (0, import_chunk_ABYVSU2C.__esm)({
23137
23337
  "src/readprg/dce.ts"() {
23138
23338
  "use strict";
23139
23339
  init_data_flow();
23140
- (0, import_chunk_NHZRKHZO.init_util)();
23340
+ (0, import_chunk_X7QCZR3F.init_util)();
23141
23341
  init_bytecode();
23142
23342
  init_cflow();
23143
23343
  init_opcodes();
@@ -23177,7 +23377,7 @@ function minimizeLocals2(func, equivSets, context) {
23177
23377
  const splitRanges = computeSplitRanges(func, equivSets);
23178
23378
  const locals = mergeSplitRanges(splitRanges);
23179
23379
  const numLocals = Math.max(...Array.from(splitRanges.keys())) + 1;
23180
- (0, import_chunk_NHZRKHZO.logger)("locals", 10, functionBanner(func, context, "Minimize Locals"));
23380
+ (0, import_chunk_X7QCZR3F.logger)("locals", 10, functionBanner(func, context, "Minimize Locals"));
23181
23381
  let argc = func.argc ?? null;
23182
23382
  const colors = /* @__PURE__ */ new Map();
23183
23383
  const merge = [];
@@ -23244,15 +23444,15 @@ function minimizeLocals2(func, equivSets, context) {
23244
23444
  }
23245
23445
  }
23246
23446
  }
23247
- if ((0, import_chunk_NHZRKHZO.wouldLog)("locals", 1)) {
23248
- if (!(0, import_chunk_NHZRKHZO.wouldLog)("locals", 10)) {
23249
- (0, import_chunk_NHZRKHZO.logger)("locals", 5, functionBanner(func, context, "Minimize Locals"));
23447
+ if ((0, import_chunk_X7QCZR3F.wouldLog)("locals", 1)) {
23448
+ if (!(0, import_chunk_X7QCZR3F.wouldLog)("locals", 10)) {
23449
+ (0, import_chunk_X7QCZR3F.logger)("locals", 5, functionBanner(func, context, "Minimize Locals"));
23250
23450
  }
23251
- (0, import_chunk_NHZRKHZO.log)(
23451
+ (0, import_chunk_X7QCZR3F.log)(
23252
23452
  `>>> Merging locals in ${func.name} (in: ${numLocals} => out: ${merge.length})`
23253
23453
  );
23254
23454
  merge.slice().sort((a, b) => (colors.get(a[0]) ?? 0) - (colors.get(b[0]) ?? 0)).forEach(
23255
- (merged) => (0, import_chunk_NHZRKHZO.log)(
23455
+ (merged) => (0, import_chunk_X7QCZR3F.log)(
23256
23456
  ` ${colors.get(merged[0])} - ${merged.map((k) => bytecodeToString(k, context.symbolTable)).join(" | ")}`
23257
23457
  )
23258
23458
  );
@@ -23551,7 +23751,7 @@ function mergeSplitRanges(splitRanges) {
23551
23751
  var init_locals = (0, import_chunk_ABYVSU2C.__esm)({
23552
23752
  "src/readprg/locals.ts"() {
23553
23753
  "use strict";
23554
- (0, import_chunk_NHZRKHZO.init_logger)();
23754
+ (0, import_chunk_X7QCZR3F.init_logger)();
23555
23755
  init_bytecode();
23556
23756
  init_cflow();
23557
23757
  init_opcodes();
@@ -23664,16 +23864,16 @@ function sizeBasedPRE2(func, context) {
23664
23864
  delete bc.arg;
23665
23865
  return bc;
23666
23866
  };
23667
- if ((0, import_chunk_NHZRKHZO.wouldLog)("pre", 1)) {
23668
- if ((0, import_chunk_NHZRKHZO.wouldLog)("pre", 5)) {
23669
- (0, import_chunk_NHZRKHZO.log)(functionBanner(func, context, "PRE")());
23867
+ if ((0, import_chunk_X7QCZR3F.wouldLog)("pre", 1)) {
23868
+ if ((0, import_chunk_X7QCZR3F.wouldLog)("pre", 5)) {
23869
+ (0, import_chunk_X7QCZR3F.log)(functionBanner(func, context, "PRE")());
23670
23870
  } else {
23671
- (0, import_chunk_NHZRKHZO.log)(`================ PRE : ${func.name} ================
23871
+ (0, import_chunk_X7QCZR3F.log)(`================ PRE : ${func.name} ================
23672
23872
  `);
23673
23873
  }
23674
23874
  insertionBlocks.forEach((o, key) => {
23675
23875
  const bcs = canonicalMap.get(key);
23676
- (0, import_chunk_NHZRKHZO.log)(
23876
+ (0, import_chunk_X7QCZR3F.log)(
23677
23877
  `Replacing ${bcs.size} instances of ${bytecodeToString(
23678
23878
  bcs.values().next().value,
23679
23879
  context.symbolTable
@@ -23756,13 +23956,13 @@ function sizeBasedPRE2(func, context) {
23756
23956
  bytecode(1, insertionBlocks.size)
23757
23957
  );
23758
23958
  }
23759
- (0, import_chunk_NHZRKHZO.logger)("pre", 5, functionBanner(func, context, "post-PRE"));
23959
+ (0, import_chunk_X7QCZR3F.logger)("pre", 5, functionBanner(func, context, "post-PRE"));
23760
23960
  return true;
23761
23961
  }
23762
23962
  var init_pre2 = (0, import_chunk_ABYVSU2C.__esm)({
23763
23963
  "src/readprg/pre.ts"() {
23764
23964
  "use strict";
23765
- (0, import_chunk_NHZRKHZO.init_logger)();
23965
+ (0, import_chunk_X7QCZR3F.init_logger)();
23766
23966
  init_bytecode();
23767
23967
  init_cflow();
23768
23968
  init_opcodes();
@@ -23795,9 +23995,9 @@ function blockSharing(func, context) {
23795
23995
  if (!any)
23796
23996
  return false;
23797
23997
  any = false;
23798
- const logging3 = (0, import_chunk_NHZRKHZO.wouldLog)("sharing", 1);
23799
- if (logging3 && (0, import_chunk_NHZRKHZO.wouldLog)("sharing", 10)) {
23800
- (0, import_chunk_NHZRKHZO.setBanner)(functionBanner(func, context, "sharing"));
23998
+ const logging3 = (0, import_chunk_X7QCZR3F.wouldLog)("sharing", 1);
23999
+ if (logging3 && (0, import_chunk_X7QCZR3F.wouldLog)("sharing", 10)) {
24000
+ (0, import_chunk_X7QCZR3F.setBanner)(functionBanner(func, context, "sharing"));
23801
24001
  }
23802
24002
  candidates.forEach((blocks) => {
23803
24003
  while (blocks.size > 1) {
@@ -23933,9 +24133,9 @@ function blockSharing(func, context) {
23933
24133
  block2.offset
23934
24134
  )})` : `block(${offsetToString(block2.offset)})`;
23935
24135
  };
23936
- (0, import_chunk_NHZRKHZO.log)(`Sharing ${showBlock(block)} with ${showBlock(target)}`);
23937
- if ((0, import_chunk_NHZRKHZO.wouldLog)("sharing", 5)) {
23938
- (0, import_chunk_NHZRKHZO.log)(blockToString(target, context));
24136
+ (0, import_chunk_X7QCZR3F.log)(`Sharing ${showBlock(block)} with ${showBlock(target)}`);
24137
+ if ((0, import_chunk_X7QCZR3F.wouldLog)("sharing", 5)) {
24138
+ (0, import_chunk_X7QCZR3F.log)(blockToString(target, context));
23939
24139
  }
23940
24140
  }
23941
24141
  if (target.bytecodes.length > length2) {
@@ -23962,13 +24162,13 @@ function blockSharing(func, context) {
23962
24162
  });
23963
24163
  }
23964
24164
  });
23965
- (0, import_chunk_NHZRKHZO.setBanner)(null);
24165
+ (0, import_chunk_X7QCZR3F.setBanner)(null);
23966
24166
  return any;
23967
24167
  }
23968
24168
  var init_sharing = (0, import_chunk_ABYVSU2C.__esm)({
23969
24169
  "src/readprg/sharing.ts"() {
23970
24170
  "use strict";
23971
- (0, import_chunk_NHZRKHZO.init_util)();
24171
+ (0, import_chunk_X7QCZR3F.init_util)();
23972
24172
  init_bytecode();
23973
24173
  init_opcodes();
23974
24174
  }
@@ -24032,7 +24232,7 @@ function doArrayInits(func, liveInState, context) {
24032
24232
  }
24033
24233
  function simpleOpts(func, context) {
24034
24234
  const equalsSym = 8388787;
24035
- const logging3 = (0, import_chunk_NHZRKHZO.wouldLog)("optimize", 5);
24235
+ const logging3 = (0, import_chunk_X7QCZR3F.wouldLog)("optimize", 5);
24036
24236
  return Array.from(func.blocks.values()).reduce((changes, block) => {
24037
24237
  for (let i = block.bytecodes.length; i--; ) {
24038
24238
  const cur = block.bytecodes[i];
@@ -24040,7 +24240,7 @@ function simpleOpts(func, context) {
24040
24240
  block.bytecodes.splice(i, 1);
24041
24241
  changes = true;
24042
24242
  if (logging3) {
24043
- (0, import_chunk_NHZRKHZO.log)(`${func.name}: deleting ${bytecodeToString(cur, null)}`);
24243
+ (0, import_chunk_X7QCZR3F.log)(`${func.name}: deleting ${bytecodeToString(cur, null)}`);
24044
24244
  }
24045
24245
  } else if (cur.op === 74 && context.config.removeArgc && context.config.allowForbiddenOpts) {
24046
24246
  const arg = cur.arg.incsp;
@@ -24049,7 +24249,7 @@ function simpleOpts(func, context) {
24049
24249
  incsp.arg = arg;
24050
24250
  changes = true;
24051
24251
  if (logging3) {
24052
- (0, import_chunk_NHZRKHZO.log)(`${func.name}: argcincsp => incsp`);
24252
+ (0, import_chunk_X7QCZR3F.log)(`${func.name}: argcincsp => incsp`);
24053
24253
  }
24054
24254
  } else if (i && cur.op === 39 && cur.arg === equalsSym) {
24055
24255
  changes = equalSymbolToEq(block, i) || changes;
@@ -24060,7 +24260,7 @@ function simpleOpts(func, context) {
24060
24260
  if (!shift && prev.op === 37) {
24061
24261
  block.bytecodes.splice(i - 1, 2);
24062
24262
  changes = true;
24063
- logging3 && (0, import_chunk_NHZRKHZO.log)(`${func.name}: deleting no-op shift (${shift})`);
24263
+ logging3 && (0, import_chunk_X7QCZR3F.log)(`${func.name}: deleting no-op shift (${shift})`);
24064
24264
  continue;
24065
24265
  }
24066
24266
  if (shift === 1n && prev.op === 37) {
@@ -24070,7 +24270,7 @@ function simpleOpts(func, context) {
24070
24270
  const add = cur;
24071
24271
  add.op = 3;
24072
24272
  delete add.arg;
24073
- logging3 && (0, import_chunk_NHZRKHZO.log)(`${func.name}: converting "ipush 1; shlv" to "dup 0; addv"`);
24273
+ logging3 && (0, import_chunk_X7QCZR3F.log)(`${func.name}: converting "ipush 1; shlv" to "dup 0; addv"`);
24074
24274
  continue;
24075
24275
  }
24076
24276
  if (shift < (prev.op === 49 ? 64n : 31n)) {
@@ -24080,7 +24280,7 @@ function simpleOpts(func, context) {
24080
24280
  } else {
24081
24281
  prev.arg = BigInt.asIntN(64, mul);
24082
24282
  }
24083
- logging3 && (0, import_chunk_NHZRKHZO.log)(
24283
+ logging3 && (0, import_chunk_X7QCZR3F.log)(
24084
24284
  `${func.name}: converting shlv(${shift}) to mulv(${prev.arg})`
24085
24285
  );
24086
24286
  changes = true;
@@ -24094,14 +24294,14 @@ function simpleOpts(func, context) {
24094
24294
  func.blocks.get(block.taken).preds.delete(block.offset);
24095
24295
  delete block.taken;
24096
24296
  changes = true;
24097
- logging3 && (0, import_chunk_NHZRKHZO.log)(`${func.name}: deleting empty finally handler`);
24297
+ logging3 && (0, import_chunk_X7QCZR3F.log)(`${func.name}: deleting empty finally handler`);
24098
24298
  } else if (isCondBranch(cur.op)) {
24099
24299
  const next = func.blocks.get(block.next);
24100
24300
  const taken = func.blocks.get(block.taken);
24101
24301
  if (next.preds.size > 1 && taken.preds.size === 1) {
24102
24302
  const newOp = cur.op === 40 ? 41 : 40;
24103
24303
  if (logging3) {
24104
- (0, import_chunk_NHZRKHZO.log)(
24304
+ (0, import_chunk_X7QCZR3F.log)(
24105
24305
  `${func.name}: converting ${Opcodes[cur.op]} to ${Opcodes[newOp]}`
24106
24306
  );
24107
24307
  }
@@ -24114,7 +24314,7 @@ function simpleOpts(func, context) {
24114
24314
  const isBool = i >= 2 && isBoolOp(block.bytecodes[i - 2].op);
24115
24315
  if (next.next === block.taken && next.taken == null && taken.bytecodes.length === 1 && isCondBranch(taken.bytecodes[0].op) && next.bytecodes.length > 1 && next.bytecodes[next.bytecodes.length - 1].op === (cur.op === 41 ? 7 : 8) && (isBool || next.bytecodes.length > 2 && isBoolOp(next.bytecodes[next.bytecodes.length - 2].op)) && next.preds?.size === 1 && taken.preds?.size === 2) {
24116
24316
  if (logging3) {
24117
- (0, import_chunk_NHZRKHZO.log)(
24317
+ (0, import_chunk_X7QCZR3F.log)(
24118
24318
  `${func.name}: simplifying ${next.bytecodes[next.bytecodes.length - 1].op === 7 ? "'&&'" : "'||'"} at ${offsetToString(block.offset)}:${offsetToString(
24119
24319
  next.offset
24120
24320
  )}:${offsetToString(taken.offset)}:`
@@ -24131,7 +24331,7 @@ function simpleOpts(func, context) {
24131
24331
  changes = true;
24132
24332
  } else if (taken.next === block.next && taken.taken == null && next.bytecodes.length === 1 && isCondBranch(next.bytecodes[0].op) && taken.bytecodes.length > 1 && taken.bytecodes[taken.bytecodes.length - 1].op === (cur.op === 40 ? 7 : 8) && (isBool || taken.bytecodes.length > 2 && isBoolOp(taken.bytecodes[taken.bytecodes.length - 2].op)) && next.preds?.size === 2 && taken.preds?.size === 1) {
24133
24333
  if (logging3) {
24134
- (0, import_chunk_NHZRKHZO.log)(
24334
+ (0, import_chunk_X7QCZR3F.log)(
24135
24335
  `${func.name}: simplifying ${taken.bytecodes[taken.bytecodes.length - 1].op === 7 ? "'&&'" : "'||'"} at ${offsetToString(block.offset)}:${offsetToString(
24136
24336
  taken.offset
24137
24337
  )}:${offsetToString(next.offset)}:`
@@ -24179,7 +24379,7 @@ function equalSymbolToEq(block, equalsIndex) {
24179
24379
  op: 26,
24180
24380
  offset: invokem.offset
24181
24381
  });
24182
- (0, import_chunk_NHZRKHZO.logger)(
24382
+ (0, import_chunk_X7QCZR3F.logger)(
24183
24383
  "optimize",
24184
24384
  1,
24185
24385
  `Replacing <thing>.equals(:symbol) with <thing> eq :symbol at ${offsetToString(
@@ -24239,7 +24439,7 @@ function removeUnreachableCatches(func, context) {
24239
24439
  const next = func.blocks.get(block.next);
24240
24440
  if (block.try === next.try) {
24241
24441
  if (next.preds.size === 1) {
24242
- (0, import_chunk_NHZRKHZO.logger)(
24442
+ (0, import_chunk_X7QCZR3F.logger)(
24243
24443
  "cfg",
24244
24444
  1,
24245
24445
  () => `${func.name}: ${offsetToString(
@@ -24262,7 +24462,7 @@ function removeUnreachableCatches(func, context) {
24262
24462
  delete next.preds;
24263
24463
  removeBlock(func, next.offset);
24264
24464
  } else if (next.next == null && next.bytecodes.length < 3 && next.bytecodes.reduce((size, bc) => size + opcodeSize(bc.op), 0) < 3 && countFallthroughPreds(func, next) > 1) {
24265
- (0, import_chunk_NHZRKHZO.logger)(
24465
+ (0, import_chunk_X7QCZR3F.logger)(
24266
24466
  "cfg",
24267
24467
  1,
24268
24468
  () => `${func.name}: ${offsetToString(
@@ -24287,7 +24487,7 @@ function removeUnreachableCatches(func, context) {
24287
24487
  switch (last.op) {
24288
24488
  case 41:
24289
24489
  case 40:
24290
- (0, import_chunk_NHZRKHZO.logger)(
24490
+ (0, import_chunk_X7QCZR3F.logger)(
24291
24491
  "cfg",
24292
24492
  1,
24293
24493
  () => `${func.name}: killing no-op ${bytecodeToString(
@@ -24310,7 +24510,7 @@ function removeUnreachableCatches(func, context) {
24310
24510
  for (let i = block.try.length; i--; ) {
24311
24511
  const handler = block.try[i].handler;
24312
24512
  if (!func.blocks.get(handler)?.preds?.size) {
24313
- (0, import_chunk_NHZRKHZO.logger)(
24513
+ (0, import_chunk_X7QCZR3F.logger)(
24314
24514
  "cfg",
24315
24515
  1,
24316
24516
  `${func.name}: killing unused try-catch at ${offsetToString(
@@ -24327,8 +24527,8 @@ function removeUnreachableCatches(func, context) {
24327
24527
  });
24328
24528
  }
24329
24529
  function cleanCfg2(func, context) {
24330
- if ((0, import_chunk_NHZRKHZO.wouldLog)("cfg", 10)) {
24331
- (0, import_chunk_NHZRKHZO.setBanner)(functionBanner(func, context, "sharing"));
24530
+ if ((0, import_chunk_X7QCZR3F.wouldLog)("cfg", 10)) {
24531
+ (0, import_chunk_X7QCZR3F.setBanner)(functionBanner(func, context, "sharing"));
24332
24532
  }
24333
24533
  removeNoOpBlocks(func);
24334
24534
  removeUnreachableCatches(func, context);
@@ -24343,12 +24543,12 @@ function cleanCfg2(func, context) {
24343
24543
  (0, import_node_assert12.default)(!block.preds?.size);
24344
24544
  func.blocks.delete(block.offset);
24345
24545
  });
24346
- (0, import_chunk_NHZRKHZO.setBanner)(null);
24546
+ (0, import_chunk_X7QCZR3F.setBanner)(null);
24347
24547
  }
24348
24548
  var init_optimize2 = (0, import_chunk_ABYVSU2C.__esm)({
24349
24549
  "src/readprg/optimize.ts"() {
24350
24550
  "use strict";
24351
- (0, import_chunk_NHZRKHZO.init_util)();
24551
+ (0, import_chunk_X7QCZR3F.init_util)();
24352
24552
  init_array_init();
24353
24553
  init_bytecode();
24354
24554
  init_cflow();
@@ -24963,21 +25163,21 @@ function optimizeBytecode(context) {
24963
25163
  functions.forEach(callback);
24964
25164
  return;
24965
25165
  }
24966
- (0, import_chunk_NHZRKHZO.bumpLogging)(null, 10);
25166
+ (0, import_chunk_X7QCZR3F.bumpLogging)(null, 10);
24967
25167
  functions.forEach((func) => {
24968
25168
  if (loggerFunc.test(func.name ?? "<null>")) {
24969
- (0, import_chunk_NHZRKHZO.bumpLogging)(null, -10);
25169
+ (0, import_chunk_X7QCZR3F.bumpLogging)(null, -10);
24970
25170
  callback(func);
24971
- (0, import_chunk_NHZRKHZO.bumpLogging)(null, 10);
25171
+ (0, import_chunk_X7QCZR3F.bumpLogging)(null, 10);
24972
25172
  return;
24973
25173
  }
24974
25174
  callback(func);
24975
25175
  });
24976
- (0, import_chunk_NHZRKHZO.bumpLogging)(null, -10);
25176
+ (0, import_chunk_X7QCZR3F.bumpLogging)(null, -10);
24977
25177
  };
24978
- if ((0, import_chunk_NHZRKHZO.wouldLog)("list-input", 1)) {
25178
+ if ((0, import_chunk_X7QCZR3F.wouldLog)("list-input", 1)) {
24979
25179
  forEachFunction(
24980
- (func) => (0, import_chunk_NHZRKHZO.wouldLog)("list-input", 1) && printFunction(func, context)
25180
+ (func) => (0, import_chunk_X7QCZR3F.wouldLog)("list-input", 1) && printFunction(func, context)
24981
25181
  );
24982
25182
  }
24983
25183
  forEachFunction((func) => optimizeFunc(func, context));
@@ -24995,7 +25195,7 @@ function optimizeBytecode(context) {
24995
25195
  forEachFunction((func) => {
24996
25196
  if (!func.name)
24997
25197
  return;
24998
- (0, import_chunk_NHZRKHZO.logger)(
25198
+ (0, import_chunk_X7QCZR3F.logger)(
24999
25199
  "bytecode",
25000
25200
  5,
25001
25201
  `${func.name}: ${offset.toString(16)} ${offset - func.offset}`
@@ -25004,7 +25204,7 @@ function optimizeBytecode(context) {
25004
25204
  });
25005
25205
  const { offsetMap } = updateInfo;
25006
25206
  offsetMap.set(code.byteLength, offset);
25007
- (0, import_chunk_NHZRKHZO.logger)(
25207
+ (0, import_chunk_X7QCZR3F.logger)(
25008
25208
  "bytecode",
25009
25209
  1,
25010
25210
  `${context.filepath}: code size: ${context.sections[
@@ -25016,9 +25216,9 @@ function optimizeBytecode(context) {
25016
25216
  ].length - offset}`
25017
25217
  );
25018
25218
  fixSectionSize(-1059145026, context.sections, offset);
25019
- if ((0, import_chunk_NHZRKHZO.wouldLog)("list-output", 1)) {
25219
+ if ((0, import_chunk_X7QCZR3F.wouldLog)("list-output", 1)) {
25020
25220
  forEachFunction(
25021
- (func) => (0, import_chunk_NHZRKHZO.wouldLog)("list-output", 1) && printFunction(func, context)
25221
+ (func) => (0, import_chunk_X7QCZR3F.wouldLog)("list-output", 1) && printFunction(func, context)
25022
25222
  );
25023
25223
  }
25024
25224
  fixupHeader(context, updateInfo);
@@ -25108,7 +25308,7 @@ ${functionToString(
25108
25308
  ---------------- ${func.name} ----------------`;
25109
25309
  }
25110
25310
  function printFunction(func, context) {
25111
- (0, import_chunk_NHZRKHZO.log)(functionToString(func, context));
25311
+ (0, import_chunk_X7QCZR3F.log)(functionToString(func, context));
25112
25312
  }
25113
25313
  function functionToString(func, context, extra) {
25114
25314
  const parts = [];
@@ -25539,7 +25739,7 @@ var init_bytecode = (0, import_chunk_ABYVSU2C.__esm)({
25539
25739
  "use strict";
25540
25740
  (0, import_chunk_JDC43A3I.init_ast)();
25541
25741
  init_sdk_util();
25542
- (0, import_chunk_NHZRKHZO.init_util)();
25742
+ (0, import_chunk_X7QCZR3F.init_util)();
25543
25743
  init_data();
25544
25744
  init_emit();
25545
25745
  init_exceptions();
@@ -25825,10 +26025,10 @@ async function build_project(product, options, lineCallback) {
25825
26025
  ].flat();
25826
26026
  if (!returnCommand) {
25827
26027
  const handlers = [
25828
- lineCallback || ((line) => (0, import_chunk_NHZRKHZO.log)(line)),
26028
+ lineCallback || ((line) => (0, import_chunk_X7QCZR3F.log)(line)),
25829
26029
  (line) => console.error(line)
25830
26030
  ];
25831
- await (0, import_chunk_NHZRKHZO.spawnByLine)(exe, args, handlers, {
26031
+ await (0, import_chunk_X7QCZR3F.spawnByLine)(exe, args, handlers, {
25832
26032
  cwd: workspace
25833
26033
  });
25834
26034
  }
@@ -25838,7 +26038,7 @@ var init_build = (0, import_chunk_ABYVSU2C.__esm)({
25838
26038
  "src/build.ts"() {
25839
26039
  "use strict";
25840
26040
  init_sdk_util();
25841
- (0, import_chunk_NHZRKHZO.init_util)();
26041
+ (0, import_chunk_X7QCZR3F.init_util)();
25842
26042
  }
25843
26043
  });
25844
26044
  var require_ms = (0, import_chunk_ABYVSU2C.__commonJS)({
@@ -27103,7 +27303,7 @@ function peg$parse2(input, options) {
27103
27303
  var peg$r1 = /^[A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376-\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E-\u066F\u0671-\u06D3\u06D5\u06E5-\u06E6\u06EE-\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4-\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F-\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC-\u09DD\u09DF-\u09E1\u09F0-\u09F1\u09FC\u0A05-\u0A0A\u0A0F-\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32-\u0A33\u0A35-\u0A36\u0A38-\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2-\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0-\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F-\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32-\u0B33\u0B35-\u0B39\u0B3D\u0B5C-\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99-\u0B9A\u0B9C\u0B9E-\u0B9F\u0BA3-\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60-\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0-\u0CE1\u0CF1-\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32-\u0E33\u0E40-\u0E46\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\u0EB0\u0EB2-\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065-\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE-\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5-\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7B9\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD-\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5-\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40-\uFB41\uFB43-\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/;
27104
27304
  var peg$r2 = /^[0-9A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376-\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u05D0-\u05EA\u05EF-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u07FD\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D3-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F-\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7-\u09C8\u09CB-\u09CE\u09D7\u09DC-\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u09FE\u0A01-\u0A03\u0A05-\u0A0A\u0A0F-\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32-\u0A33\u0A35-\u0A36\u0A38-\u0A39\u0A3C\u0A3E-\u0A42\u0A47-\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2-\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F-\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32-\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47-\u0B48\u0B4B-\u0B4D\u0B56-\u0B57\u0B5C-\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82-\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99-\u0B9A\u0B9C\u0B9E-\u0B9F\u0BA3-\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55-\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5-\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1-\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82-\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18-\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772-\u1773\u1780-\u17D3\u17D7\u17DC-\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F-\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7B9\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC-\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40-\uFB41\uFB43-\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33-\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/;
27105
27305
  var peg$r3 = /^[\-\u200C-\u200D]/;
27106
- var peg$r4 = /^[*.-\/]/;
27306
+ var peg$r4 = /^[*.-\/:]/;
27107
27307
  var peg$r5 = /^[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376-\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E-\u066F\u0671-\u06D3\u06D5\u06E5-\u06E6\u06EE-\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4-\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F-\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC-\u09DD\u09DF-\u09E1\u09F0-\u09F1\u09FC\u0A05-\u0A0A\u0A0F-\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32-\u0A33\u0A35-\u0A36\u0A38-\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2-\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0-\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F-\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32-\u0B33\u0B35-\u0B39\u0B3D\u0B5C-\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99-\u0B9A\u0B9C\u0B9E-\u0B9F\u0BA3-\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60-\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0-\u0CE1\u0CF1-\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32-\u0E33\u0E40-\u0E46\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\u0EB0\u0EB2-\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065-\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE-\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5-\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7B9\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD-\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5-\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40-\uFB41\uFB43-\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/;
27108
27308
  var peg$r6 = /^[\u0300-\u036F\u0483-\u0487\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962-\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7-\u09C8\u09CB-\u09CD\u09D7\u09E2-\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47-\u0A48\u0A4B-\u0A4D\u0A51\u0A70-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2-\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47-\u0B48\u0B4B-\u0B4D\u0B56-\u0B57\u0B62-\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55-\u0C56\u0C62-\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5-\u0CD6\u0CE2-\u0CE3\u0D00-\u0D03\u0D3B-\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62-\u0D63\u0D82-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2-\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB-\u0EBC\u0EC8-\u0ECD\u0F18-\u0F19\u0F35\u0F37\u0F39\u0F3E-\u0F3F\u0F71-\u0F84\u0F86-\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885-\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABD\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099-\u309A\uA66F\uA674-\uA67D\uA69E-\uA69F\uA6F0-\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880-\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C-\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7-\uAAB8\uAABE-\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5-\uAAF6\uABE3-\uABEA\uABEC-\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/;
27109
27309
  var peg$r7 = /^[\t\v-\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]/;
@@ -27139,7 +27339,7 @@ function peg$parse2(input, options) {
27139
27339
  var peg$e16 = peg$literalExpectation("$", false);
27140
27340
  var peg$e17 = peg$literalExpectation("(", false);
27141
27341
  var peg$e18 = peg$classExpectation(["-", ["\u200C", "\u200D"]], false, false);
27142
- var peg$e19 = peg$classExpectation(["*", [".", "/"]], false, false);
27342
+ var peg$e19 = peg$classExpectation(["*", [".", "/"], ":"], false, false);
27143
27343
  var peg$e20 = peg$classExpectation([["A", "Z"], ["a", "z"], "\xAA", "\xB5", "\xBA", ["\xC0", "\xD6"], ["\xD8", "\xF6"], ["\xF8", "\u02C1"], ["\u02C6", "\u02D1"], ["\u02E0", "\u02E4"], "\u02EC", "\u02EE", ["\u0370", "\u0374"], ["\u0376", "\u0377"], ["\u037A", "\u037D"], "\u037F", "\u0386", ["\u0388", "\u038A"], "\u038C", ["\u038E", "\u03A1"], ["\u03A3", "\u03F5"], ["\u03F7", "\u0481"], ["\u048A", "\u052F"], ["\u0531", "\u0556"], "\u0559", ["\u0560", "\u0588"], ["\u05D0", "\u05EA"], ["\u05EF", "\u05F2"], ["\u0620", "\u064A"], ["\u066E", "\u066F"], ["\u0671", "\u06D3"], "\u06D5", ["\u06E5", "\u06E6"], ["\u06EE", "\u06EF"], ["\u06FA", "\u06FC"], "\u06FF", "\u0710", ["\u0712", "\u072F"], ["\u074D", "\u07A5"], "\u07B1", ["\u07CA", "\u07EA"], ["\u07F4", "\u07F5"], "\u07FA", ["\u0800", "\u0815"], "\u081A", "\u0824", "\u0828", ["\u0840", "\u0858"], ["\u0860", "\u086A"], ["\u08A0", "\u08B4"], ["\u08B6", "\u08BD"], ["\u0904", "\u0939"], "\u093D", "\u0950", ["\u0958", "\u0961"], ["\u0971", "\u0980"], ["\u0985", "\u098C"], ["\u098F", "\u0990"], ["\u0993", "\u09A8"], ["\u09AA", "\u09B0"], "\u09B2", ["\u09B6", "\u09B9"], "\u09BD", "\u09CE", ["\u09DC", "\u09DD"], ["\u09DF", "\u09E1"], ["\u09F0", "\u09F1"], "\u09FC", ["\u0A05", "\u0A0A"], ["\u0A0F", "\u0A10"], ["\u0A13", "\u0A28"], ["\u0A2A", "\u0A30"], ["\u0A32", "\u0A33"], ["\u0A35", "\u0A36"], ["\u0A38", "\u0A39"], ["\u0A59", "\u0A5C"], "\u0A5E", ["\u0A72", "\u0A74"], ["\u0A85", "\u0A8D"], ["\u0A8F", "\u0A91"], ["\u0A93", "\u0AA8"], ["\u0AAA", "\u0AB0"], ["\u0AB2", "\u0AB3"], ["\u0AB5", "\u0AB9"], "\u0ABD", "\u0AD0", ["\u0AE0", "\u0AE1"], "\u0AF9", ["\u0B05", "\u0B0C"], ["\u0B0F", "\u0B10"], ["\u0B13", "\u0B28"], ["\u0B2A", "\u0B30"], ["\u0B32", "\u0B33"], ["\u0B35", "\u0B39"], "\u0B3D", ["\u0B5C", "\u0B5D"], ["\u0B5F", "\u0B61"], "\u0B71", "\u0B83", ["\u0B85", "\u0B8A"], ["\u0B8E", "\u0B90"], ["\u0B92", "\u0B95"], ["\u0B99", "\u0B9A"], "\u0B9C", ["\u0B9E", "\u0B9F"], ["\u0BA3", "\u0BA4"], ["\u0BA8", "\u0BAA"], ["\u0BAE", "\u0BB9"], "\u0BD0", ["\u0C05", "\u0C0C"], ["\u0C0E", "\u0C10"], ["\u0C12", "\u0C28"], ["\u0C2A", "\u0C39"], "\u0C3D", ["\u0C58", "\u0C5A"], ["\u0C60", "\u0C61"], "\u0C80", ["\u0C85", "\u0C8C"], ["\u0C8E", "\u0C90"], ["\u0C92", "\u0CA8"], ["\u0CAA", "\u0CB3"], ["\u0CB5", "\u0CB9"], "\u0CBD", "\u0CDE", ["\u0CE0", "\u0CE1"], ["\u0CF1", "\u0CF2"], ["\u0D05", "\u0D0C"], ["\u0D0E", "\u0D10"], ["\u0D12", "\u0D3A"], "\u0D3D", "\u0D4E", ["\u0D54", "\u0D56"], ["\u0D5F", "\u0D61"], ["\u0D7A", "\u0D7F"], ["\u0D85", "\u0D96"], ["\u0D9A", "\u0DB1"], ["\u0DB3", "\u0DBB"], "\u0DBD", ["\u0DC0", "\u0DC6"], ["\u0E01", "\u0E30"], ["\u0E32", "\u0E33"], ["\u0E40", "\u0E46"], ["\u0E81", "\u0E82"], "\u0E84", ["\u0E87", "\u0E88"], "\u0E8A", "\u0E8D", ["\u0E94", "\u0E97"], ["\u0E99", "\u0E9F"], ["\u0EA1", "\u0EA3"], "\u0EA5", "\u0EA7", ["\u0EAA", "\u0EAB"], ["\u0EAD", "\u0EB0"], ["\u0EB2", "\u0EB3"], "\u0EBD", ["\u0EC0", "\u0EC4"], "\u0EC6", ["\u0EDC", "\u0EDF"], "\u0F00", ["\u0F40", "\u0F47"], ["\u0F49", "\u0F6C"], ["\u0F88", "\u0F8C"], ["\u1000", "\u102A"], "\u103F", ["\u1050", "\u1055"], ["\u105A", "\u105D"], "\u1061", ["\u1065", "\u1066"], ["\u106E", "\u1070"], ["\u1075", "\u1081"], "\u108E", ["\u10A0", "\u10C5"], "\u10C7", "\u10CD", ["\u10D0", "\u10FA"], ["\u10FC", "\u1248"], ["\u124A", "\u124D"], ["\u1250", "\u1256"], "\u1258", ["\u125A", "\u125D"], ["\u1260", "\u1288"], ["\u128A", "\u128D"], ["\u1290", "\u12B0"], ["\u12B2", "\u12B5"], ["\u12B8", "\u12BE"], "\u12C0", ["\u12C2", "\u12C5"], ["\u12C8", "\u12D6"], ["\u12D8", "\u1310"], ["\u1312", "\u1315"], ["\u1318", "\u135A"], ["\u1380", "\u138F"], ["\u13A0", "\u13F5"], ["\u13F8", "\u13FD"], ["\u1401", "\u166C"], ["\u166F", "\u167F"], ["\u1681", "\u169A"], ["\u16A0", "\u16EA"], ["\u16EE", "\u16F8"], ["\u1700", "\u170C"], ["\u170E", "\u1711"], ["\u1720", "\u1731"], ["\u1740", "\u1751"], ["\u1760", "\u176C"], ["\u176E", "\u1770"], ["\u1780", "\u17B3"], "\u17D7", "\u17DC", ["\u1820", "\u1878"], ["\u1880", "\u1884"], ["\u1887", "\u18A8"], "\u18AA", ["\u18B0", "\u18F5"], ["\u1900", "\u191E"], ["\u1950", "\u196D"], ["\u1970", "\u1974"], ["\u1980", "\u19AB"], ["\u19B0", "\u19C9"], ["\u1A00", "\u1A16"], ["\u1A20", "\u1A54"], "\u1AA7", ["\u1B05", "\u1B33"], ["\u1B45", "\u1B4B"], ["\u1B83", "\u1BA0"], ["\u1BAE", "\u1BAF"], ["\u1BBA", "\u1BE5"], ["\u1C00", "\u1C23"], ["\u1C4D", "\u1C4F"], ["\u1C5A", "\u1C7D"], ["\u1C80", "\u1C88"], ["\u1C90", "\u1CBA"], ["\u1CBD", "\u1CBF"], ["\u1CE9", "\u1CEC"], ["\u1CEE", "\u1CF1"], ["\u1CF5", "\u1CF6"], ["\u1D00", "\u1DBF"], ["\u1E00", "\u1F15"], ["\u1F18", "\u1F1D"], ["\u1F20", "\u1F45"], ["\u1F48", "\u1F4D"], ["\u1F50", "\u1F57"], "\u1F59", "\u1F5B", "\u1F5D", ["\u1F5F", "\u1F7D"], ["\u1F80", "\u1FB4"], ["\u1FB6", "\u1FBC"], "\u1FBE", ["\u1FC2", "\u1FC4"], ["\u1FC6", "\u1FCC"], ["\u1FD0", "\u1FD3"], ["\u1FD6", "\u1FDB"], ["\u1FE0", "\u1FEC"], ["\u1FF2", "\u1FF4"], ["\u1FF6", "\u1FFC"], "\u2071", "\u207F", ["\u2090", "\u209C"], "\u2102", "\u2107", ["\u210A", "\u2113"], "\u2115", ["\u2119", "\u211D"], "\u2124", "\u2126", "\u2128", ["\u212A", "\u212D"], ["\u212F", "\u2139"], ["\u213C", "\u213F"], ["\u2145", "\u2149"], "\u214E", ["\u2160", "\u2188"], ["\u2C00", "\u2C2E"], ["\u2C30", "\u2C5E"], ["\u2C60", "\u2CE4"], ["\u2CEB", "\u2CEE"], ["\u2CF2", "\u2CF3"], ["\u2D00", "\u2D25"], "\u2D27", "\u2D2D", ["\u2D30", "\u2D67"], "\u2D6F", ["\u2D80", "\u2D96"], ["\u2DA0", "\u2DA6"], ["\u2DA8", "\u2DAE"], ["\u2DB0", "\u2DB6"], ["\u2DB8", "\u2DBE"], ["\u2DC0", "\u2DC6"], ["\u2DC8", "\u2DCE"], ["\u2DD0", "\u2DD6"], ["\u2DD8", "\u2DDE"], "\u2E2F", ["\u3005", "\u3007"], ["\u3021", "\u3029"], ["\u3031", "\u3035"], ["\u3038", "\u303C"], ["\u3041", "\u3096"], ["\u309D", "\u309F"], ["\u30A1", "\u30FA"], ["\u30FC", "\u30FF"], ["\u3105", "\u312F"], ["\u3131", "\u318E"], ["\u31A0", "\u31BA"], ["\u31F0", "\u31FF"], ["\u3400", "\u4DB5"], ["\u4E00", "\u9FEF"], ["\uA000", "\uA48C"], ["\uA4D0", "\uA4FD"], ["\uA500", "\uA60C"], ["\uA610", "\uA61F"], ["\uA62A", "\uA62B"], ["\uA640", "\uA66E"], ["\uA67F", "\uA69D"], ["\uA6A0", "\uA6EF"], ["\uA717", "\uA71F"], ["\uA722", "\uA788"], ["\uA78B", "\uA7B9"], ["\uA7F7", "\uA801"], ["\uA803", "\uA805"], ["\uA807", "\uA80A"], ["\uA80C", "\uA822"], ["\uA840", "\uA873"], ["\uA882", "\uA8B3"], ["\uA8F2", "\uA8F7"], "\uA8FB", ["\uA8FD", "\uA8FE"], ["\uA90A", "\uA925"], ["\uA930", "\uA946"], ["\uA960", "\uA97C"], ["\uA984", "\uA9B2"], "\uA9CF", ["\uA9E0", "\uA9E4"], ["\uA9E6", "\uA9EF"], ["\uA9FA", "\uA9FE"], ["\uAA00", "\uAA28"], ["\uAA40", "\uAA42"], ["\uAA44", "\uAA4B"], ["\uAA60", "\uAA76"], "\uAA7A", ["\uAA7E", "\uAAAF"], "\uAAB1", ["\uAAB5", "\uAAB6"], ["\uAAB9", "\uAABD"], "\uAAC0", "\uAAC2", ["\uAADB", "\uAADD"], ["\uAAE0", "\uAAEA"], ["\uAAF2", "\uAAF4"], ["\uAB01", "\uAB06"], ["\uAB09", "\uAB0E"], ["\uAB11", "\uAB16"], ["\uAB20", "\uAB26"], ["\uAB28", "\uAB2E"], ["\uAB30", "\uAB5A"], ["\uAB5C", "\uAB65"], ["\uAB70", "\uABE2"], ["\uAC00", "\uD7A3"], ["\uD7B0", "\uD7C6"], ["\uD7CB", "\uD7FB"], ["\uF900", "\uFA6D"], ["\uFA70", "\uFAD9"], ["\uFB00", "\uFB06"], ["\uFB13", "\uFB17"], "\uFB1D", ["\uFB1F", "\uFB28"], ["\uFB2A", "\uFB36"], ["\uFB38", "\uFB3C"], "\uFB3E", ["\uFB40", "\uFB41"], ["\uFB43", "\uFB44"], ["\uFB46", "\uFBB1"], ["\uFBD3", "\uFD3D"], ["\uFD50", "\uFD8F"], ["\uFD92", "\uFDC7"], ["\uFDF0", "\uFDFB"], ["\uFE70", "\uFE74"], ["\uFE76", "\uFEFC"], ["\uFF21", "\uFF3A"], ["\uFF41", "\uFF5A"], ["\uFF66", "\uFFBE"], ["\uFFC2", "\uFFC7"], ["\uFFCA", "\uFFCF"], ["\uFFD2", "\uFFD7"], ["\uFFDA", "\uFFDC"]], false, false);
27144
27344
  var peg$e21 = peg$classExpectation([["\u0300", "\u036F"], ["\u0483", "\u0487"], ["\u0591", "\u05BD"], "\u05BF", ["\u05C1", "\u05C2"], ["\u05C4", "\u05C5"], "\u05C7", ["\u0610", "\u061A"], ["\u064B", "\u065F"], "\u0670", ["\u06D6", "\u06DC"], ["\u06DF", "\u06E4"], ["\u06E7", "\u06E8"], ["\u06EA", "\u06ED"], "\u0711", ["\u0730", "\u074A"], ["\u07A6", "\u07B0"], ["\u07EB", "\u07F3"], "\u07FD", ["\u0816", "\u0819"], ["\u081B", "\u0823"], ["\u0825", "\u0827"], ["\u0829", "\u082D"], ["\u0859", "\u085B"], ["\u08D3", "\u08E1"], ["\u08E3", "\u0903"], ["\u093A", "\u093C"], ["\u093E", "\u094F"], ["\u0951", "\u0957"], ["\u0962", "\u0963"], ["\u0981", "\u0983"], "\u09BC", ["\u09BE", "\u09C4"], ["\u09C7", "\u09C8"], ["\u09CB", "\u09CD"], "\u09D7", ["\u09E2", "\u09E3"], "\u09FE", ["\u0A01", "\u0A03"], "\u0A3C", ["\u0A3E", "\u0A42"], ["\u0A47", "\u0A48"], ["\u0A4B", "\u0A4D"], "\u0A51", ["\u0A70", "\u0A71"], "\u0A75", ["\u0A81", "\u0A83"], "\u0ABC", ["\u0ABE", "\u0AC5"], ["\u0AC7", "\u0AC9"], ["\u0ACB", "\u0ACD"], ["\u0AE2", "\u0AE3"], ["\u0AFA", "\u0AFF"], ["\u0B01", "\u0B03"], "\u0B3C", ["\u0B3E", "\u0B44"], ["\u0B47", "\u0B48"], ["\u0B4B", "\u0B4D"], ["\u0B56", "\u0B57"], ["\u0B62", "\u0B63"], "\u0B82", ["\u0BBE", "\u0BC2"], ["\u0BC6", "\u0BC8"], ["\u0BCA", "\u0BCD"], "\u0BD7", ["\u0C00", "\u0C04"], ["\u0C3E", "\u0C44"], ["\u0C46", "\u0C48"], ["\u0C4A", "\u0C4D"], ["\u0C55", "\u0C56"], ["\u0C62", "\u0C63"], ["\u0C81", "\u0C83"], "\u0CBC", ["\u0CBE", "\u0CC4"], ["\u0CC6", "\u0CC8"], ["\u0CCA", "\u0CCD"], ["\u0CD5", "\u0CD6"], ["\u0CE2", "\u0CE3"], ["\u0D00", "\u0D03"], ["\u0D3B", "\u0D3C"], ["\u0D3E", "\u0D44"], ["\u0D46", "\u0D48"], ["\u0D4A", "\u0D4D"], "\u0D57", ["\u0D62", "\u0D63"], ["\u0D82", "\u0D83"], "\u0DCA", ["\u0DCF", "\u0DD4"], "\u0DD6", ["\u0DD8", "\u0DDF"], ["\u0DF2", "\u0DF3"], "\u0E31", ["\u0E34", "\u0E3A"], ["\u0E47", "\u0E4E"], "\u0EB1", ["\u0EB4", "\u0EB9"], ["\u0EBB", "\u0EBC"], ["\u0EC8", "\u0ECD"], ["\u0F18", "\u0F19"], "\u0F35", "\u0F37", "\u0F39", ["\u0F3E", "\u0F3F"], ["\u0F71", "\u0F84"], ["\u0F86", "\u0F87"], ["\u0F8D", "\u0F97"], ["\u0F99", "\u0FBC"], "\u0FC6", ["\u102B", "\u103E"], ["\u1056", "\u1059"], ["\u105E", "\u1060"], ["\u1062", "\u1064"], ["\u1067", "\u106D"], ["\u1071", "\u1074"], ["\u1082", "\u108D"], "\u108F", ["\u109A", "\u109D"], ["\u135D", "\u135F"], ["\u1712", "\u1714"], ["\u1732", "\u1734"], ["\u1752", "\u1753"], ["\u1772", "\u1773"], ["\u17B4", "\u17D3"], "\u17DD", ["\u180B", "\u180D"], ["\u1885", "\u1886"], "\u18A9", ["\u1920", "\u192B"], ["\u1930", "\u193B"], ["\u1A17", "\u1A1B"], ["\u1A55", "\u1A5E"], ["\u1A60", "\u1A7C"], "\u1A7F", ["\u1AB0", "\u1ABD"], ["\u1B00", "\u1B04"], ["\u1B34", "\u1B44"], ["\u1B6B", "\u1B73"], ["\u1B80", "\u1B82"], ["\u1BA1", "\u1BAD"], ["\u1BE6", "\u1BF3"], ["\u1C24", "\u1C37"], ["\u1CD0", "\u1CD2"], ["\u1CD4", "\u1CE8"], "\u1CED", ["\u1CF2", "\u1CF4"], ["\u1CF7", "\u1CF9"], ["\u1DC0", "\u1DF9"], ["\u1DFB", "\u1DFF"], ["\u20D0", "\u20DC"], "\u20E1", ["\u20E5", "\u20F0"], ["\u2CEF", "\u2CF1"], "\u2D7F", ["\u2DE0", "\u2DFF"], ["\u302A", "\u302F"], ["\u3099", "\u309A"], "\uA66F", ["\uA674", "\uA67D"], ["\uA69E", "\uA69F"], ["\uA6F0", "\uA6F1"], "\uA802", "\uA806", "\uA80B", ["\uA823", "\uA827"], ["\uA880", "\uA881"], ["\uA8B4", "\uA8C5"], ["\uA8E0", "\uA8F1"], "\uA8FF", ["\uA926", "\uA92D"], ["\uA947", "\uA953"], ["\uA980", "\uA983"], ["\uA9B3", "\uA9C0"], "\uA9E5", ["\uAA29", "\uAA36"], "\uAA43", ["\uAA4C", "\uAA4D"], ["\uAA7B", "\uAA7D"], "\uAAB0", ["\uAAB2", "\uAAB4"], ["\uAAB7", "\uAAB8"], ["\uAABE", "\uAABF"], "\uAAC1", ["\uAAEB", "\uAAEF"], ["\uAAF5", "\uAAF6"], ["\uABE3", "\uABEA"], ["\uABEC", "\uABED"], "\uFB1E", ["\uFE00", "\uFE0F"], ["\uFE20", "\uFE2F"]], false, false);
27145
27345
  var peg$e22 = peg$otherExpectation("whitespace");
@@ -28811,7 +29011,7 @@ async function resolve_literals(qualifier, default_source, deviceInfo, cache) {
28811
29011
  );
28812
29012
  if (!(0, import_chunk_JDC43A3I.hasProperty)(cache.resolvedPaths, resolved)) {
28813
29013
  if (/[*?[\]{}]/.test(resolved)) {
28814
- cache.resolvedPaths[resolved] = (0, import_chunk_NHZRKHZO.globSome)(resolved, () => true);
29014
+ cache.resolvedPaths[resolved] = (0, import_chunk_X7QCZR3F.globSome)(resolved, () => true);
28815
29015
  } else {
28816
29016
  cache.resolvedPaths[resolved] = fs5.stat(resolved).then(
28817
29017
  () => true,
@@ -28890,12 +29090,12 @@ async function read_resource_files(targets, cache) {
28890
29090
  if (!(0, import_chunk_JDC43A3I.hasProperty)(resourceGroupPromises, key)) {
28891
29091
  resourceGroupPromises[key] = Promise.all(
28892
29092
  p.qualifier.resourcePath.map(
28893
- (pattern) => (0, import_chunk_NHZRKHZO.globa)(pattern, { mark: true })
29093
+ (pattern) => (0, import_chunk_X7QCZR3F.globa)(pattern, { mark: true })
28894
29094
  )
28895
29095
  ).then(
28896
29096
  (patterns) => Promise.all(
28897
29097
  patterns.flat().map(
28898
- (path7) => path7.endsWith("/") ? (0, import_chunk_NHZRKHZO.globa)(`${path7}**/*.xml`, { mark: true }) : path7
29098
+ (path7) => path7.endsWith("/") ? (0, import_chunk_X7QCZR3F.globa)(`${path7}**/*.xml`, { mark: true }) : path7
28899
29099
  )
28900
29100
  )
28901
29101
  ).then(
@@ -28955,7 +29155,7 @@ async function find_build_instructions_in_resource(file, rez, buildDependencies)
28955
29155
  const sourceExcludes = excludes.map((e) => e.file?.value.value).filter((f) => f != null).map((f) => path2.resolve(dir, f).replace(/\\/g, "/"));
28956
29156
  const filePatterns = excludes.map((e) => e.dir?.value.value).filter((f) => f != null).map((f) => path2.join(dir, f, "**", "*.mc").replace(/\\/g, "/"));
28957
29157
  if (filePatterns.length) {
28958
- const files = (await Promise.all(filePatterns.map((p) => (0, import_chunk_NHZRKHZO.globa)(p)))).flat();
29158
+ const files = (await Promise.all(filePatterns.map((p) => (0, import_chunk_X7QCZR3F.globa)(p)))).flat();
28959
29159
  sourceExcludes.push(...files);
28960
29160
  }
28961
29161
  const excludeAnnotations = excludes.map((e) => e.annotation?.value.value).filter((f) => f != null);
@@ -29132,15 +29332,15 @@ function identify_optimizer_groups(targets, options) {
29132
29332
  function find_barrels(barrelPath, buildDependencies) {
29133
29333
  return (Array.isArray(barrelPath) ? (
29134
29334
  // This is a sublist. The barrel has more than one jungle file.
29135
- Promise.all(barrelPath.map((path7) => (0, import_chunk_NHZRKHZO.globa)(path7, { mark: true }))).then(
29335
+ Promise.all(barrelPath.map((path7) => (0, import_chunk_X7QCZR3F.globa)(path7, { mark: true }))).then(
29136
29336
  (paths) => [
29137
29337
  paths.flat().filter((path7) => path7.endsWith(".jungle")).join(";")
29138
29338
  ]
29139
29339
  )
29140
- ) : (0, import_chunk_NHZRKHZO.globa)(barrelPath, { mark: true }).then(
29340
+ ) : (0, import_chunk_X7QCZR3F.globa)(barrelPath, { mark: true }).then(
29141
29341
  (paths) => Promise.all(
29142
29342
  paths.map(
29143
- (path7) => path7.endsWith("/") ? (0, import_chunk_NHZRKHZO.globa)(`${path7}**/*.barrel`) : path7
29343
+ (path7) => path7.endsWith("/") ? (0, import_chunk_X7QCZR3F.globa)(`${path7}**/*.barrel`) : path7
29144
29344
  )
29145
29345
  )
29146
29346
  ).then(
@@ -29148,7 +29348,7 @@ function find_barrels(barrelPath, buildDependencies) {
29148
29348
  (path7) => path7.endsWith(".jungle") || path7.endsWith(".barrel")
29149
29349
  )
29150
29350
  )).then((paths) => {
29151
- (0, import_chunk_NHZRKHZO.forEach)(
29351
+ (0, import_chunk_X7QCZR3F.forEach)(
29152
29352
  barrelPath,
29153
29353
  (path7) => /[*?[\]{}]/.test(path7) || (buildDependencies[path7] = true)
29154
29354
  );
@@ -29425,7 +29625,7 @@ var init_jungles = (0, import_chunk_ABYVSU2C.__esm)({
29425
29625
  init_api();
29426
29626
  init_manifest();
29427
29627
  init_sdk_util();
29428
- (0, import_chunk_NHZRKHZO.init_util)();
29628
+ (0, import_chunk_X7QCZR3F.init_util)();
29429
29629
  depth = 0;
29430
29630
  }
29431
29631
  });
@@ -29453,7 +29653,7 @@ async function launchSimulator(force = true) {
29453
29653
  await new Promise((r) => setTimeout(r, 200));
29454
29654
  }
29455
29655
  } catch (e) {
29456
- (0, import_chunk_NHZRKHZO.log)(e);
29656
+ (0, import_chunk_X7QCZR3F.log)(e);
29457
29657
  }
29458
29658
  }
29459
29659
  function checkIfSimulatorRunning() {
@@ -29484,10 +29684,10 @@ function simulateProgram(prg, device, test = false, logger2) {
29484
29684
  }
29485
29685
  }
29486
29686
  return getSdkPath().then(
29487
- (sdk) => (0, import_chunk_NHZRKHZO.spawnByLine)(
29687
+ (sdk) => (0, import_chunk_X7QCZR3F.spawnByLine)(
29488
29688
  path3.resolve(sdk, "bin", isWin ? "monkeydo.bat" : "monkeydo"),
29489
29689
  args,
29490
- logger2 || ((line) => (0, import_chunk_NHZRKHZO.log)(line))
29690
+ logger2 || ((line) => (0, import_chunk_X7QCZR3F.log)(line))
29491
29691
  ).then(() => {
29492
29692
  return;
29493
29693
  })
@@ -29497,7 +29697,7 @@ var init_launch = (0, import_chunk_ABYVSU2C.__esm)({
29497
29697
  "src/launch.ts"() {
29498
29698
  "use strict";
29499
29699
  init_sdk_util();
29500
- (0, import_chunk_NHZRKHZO.init_util)();
29700
+ (0, import_chunk_X7QCZR3F.init_util)();
29501
29701
  }
29502
29702
  });
29503
29703
  async function analyze_module_types(state) {
@@ -29518,7 +29718,7 @@ async function analyze_module_types(state) {
29518
29718
  for (const module2 of modulesSet) {
29519
29719
  modulesSet.delete(module2);
29520
29720
  const istate = buildTypeInfo(state, module2, false);
29521
- await (0, import_chunk_NHZRKHZO.log)();
29721
+ await (0, import_chunk_X7QCZR3F.log)();
29522
29722
  if (istate?.typeMap) {
29523
29723
  moduleMap.set(module2, istate);
29524
29724
  istate.dependencies?.forEach((flags, other) => {
@@ -29597,7 +29797,7 @@ var init_module_types = (0, import_chunk_ABYVSU2C.__esm)({
29597
29797
  init_interp();
29598
29798
  init_sub_type();
29599
29799
  init_types();
29600
- (0, import_chunk_NHZRKHZO.init_logger)();
29800
+ (0, import_chunk_X7QCZR3F.init_logger)();
29601
29801
  }
29602
29802
  });
29603
29803
  function relative_path_no_dotdot(relative2) {
@@ -29618,7 +29818,7 @@ async function getCodeWorkspaceSettings(folder) {
29618
29818
  let curDir = folder;
29619
29819
  try {
29620
29820
  while (curDir) {
29621
- const code_workspaces = await (0, import_chunk_NHZRKHZO.globa)(
29821
+ const code_workspaces = await (0, import_chunk_X7QCZR3F.globa)(
29622
29822
  path4.resolve(curDir, "*.code-workspace"),
29623
29823
  { onlyFiles: true }
29624
29824
  );
@@ -29746,7 +29946,7 @@ async function createLocalBarrels(targets, options) {
29746
29946
  optBarrelDir
29747
29947
  };
29748
29948
  return promise2.then(
29749
- () => (0, import_chunk_NHZRKHZO.copyRecursiveAsNeeded)(
29949
+ () => (0, import_chunk_X7QCZR3F.copyRecursiveAsNeeded)(
29750
29950
  rawBarrelDir,
29751
29951
  optBarrelDir,
29752
29952
  (src) => !src.endsWith(".mc")
@@ -30047,7 +30247,7 @@ async function filesFromPaths(workspace, buildDir, inPaths, extension) {
30047
30247
  const filter = buildDir.startsWith(workspace);
30048
30248
  const paths = (await Promise.all(
30049
30249
  inPaths?.map(
30050
- (pattern) => (0, import_chunk_NHZRKHZO.globa)(pattern, { cwd: workspace, mark: true }).then(
30250
+ (pattern) => (0, import_chunk_X7QCZR3F.globa)(pattern, { cwd: workspace, mark: true }).then(
30051
30251
  (paths2) => paths2.map((p) => ({
30052
30252
  path: p,
30053
30253
  filter: filter && /^\*\*[\\/]\*\.mc$/i.test(path4.relative(workspace, pattern))
@@ -30057,7 +30257,7 @@ async function filesFromPaths(workspace, buildDir, inPaths, extension) {
30057
30257
  )).flat();
30058
30258
  const files = await Promise.all(
30059
30259
  paths.map(
30060
- (result) => result.path.endsWith("/") ? (0, import_chunk_NHZRKHZO.globa)(`${result.path}**/*${extension}`, {
30260
+ (result) => result.path.endsWith("/") ? (0, import_chunk_X7QCZR3F.globa)(`${result.path}**/*${extension}`, {
30061
30261
  cwd: workspace,
30062
30262
  mark: true
30063
30263
  }).then(
@@ -30184,7 +30384,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
30184
30384
  })
30185
30385
  );
30186
30386
  }
30187
- const actualOptimizedFiles = (await (0, import_chunk_NHZRKHZO.globa)(path4.join(output, "**", "*.mc"), { mark: true })).filter((file) => !file.endsWith("/")).sort();
30387
+ const actualOptimizedFiles = (await (0, import_chunk_X7QCZR3F.globa)(path4.join(output, "**", "*.mc"), { mark: true })).filter((file) => !file.endsWith("/")).sort();
30188
30388
  const {
30189
30389
  hasTests,
30190
30390
  diagnostics: prevDiagnostics,
@@ -30200,13 +30400,13 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
30200
30400
  const sdk = await getSdkPath();
30201
30401
  const match = sdk.match(/-(\d+\.\d+\.\d+)/);
30202
30402
  if ((match && parseSdkVersion(match[1])) === prevSdkVersion) {
30203
- const source_time = await (0, import_chunk_NHZRKHZO.last_modified)(
30403
+ const source_time = await (0, import_chunk_X7QCZR3F.last_modified)(
30204
30404
  Object.keys(fnMap).concat(dependencyFiles)
30205
30405
  );
30206
- const opt_time = await (0, import_chunk_NHZRKHZO.first_modified)(
30406
+ const opt_time = await (0, import_chunk_X7QCZR3F.first_modified)(
30207
30407
  Object.values(fnMap).map((v) => v.output)
30208
30408
  );
30209
- if (source_time < opt_time && 1731196989092 < opt_time) {
30409
+ if (source_time < opt_time && 1732486572981 < opt_time) {
30210
30410
  return {
30211
30411
  hasTests,
30212
30412
  diagnostics: prevDiagnostics,
@@ -30244,7 +30444,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
30244
30444
  hasTests: hasTests2,
30245
30445
  diagnostics,
30246
30446
  sdkVersion,
30247
- optimizerVersion: "1.1.80",
30447
+ optimizerVersion: "1.1.82",
30248
30448
  ...Object.fromEntries(
30249
30449
  configOptionsToCheck.map((option) => [option, config[option]])
30250
30450
  )
@@ -30258,7 +30458,7 @@ function getProjectAnalysis(targets, analysis, manifestXML, options) {
30258
30458
  return getConfig(options).then(
30259
30459
  (options2) => getProjectAnalysisHelper(targets, analysis, manifestXML, options2)
30260
30460
  ).catch(
30261
- (ex) => Promise.reject(ex instanceof import_chunk_NHZRKHZO.AwaitedError ? ex.resolve() : ex)
30461
+ (ex) => Promise.reject(ex instanceof import_chunk_X7QCZR3F.AwaitedError ? ex.resolve() : ex)
30262
30462
  );
30263
30463
  }
30264
30464
  async function getProjectAnalysisHelper(targets, analysis, manifestXML, options) {
@@ -30383,7 +30583,7 @@ var init_optimizer = (0, import_chunk_ABYVSU2C.__esm)({
30383
30583
  init_sdk_util();
30384
30584
  init_interp();
30385
30585
  init_module_types();
30386
- (0, import_chunk_NHZRKHZO.init_util)();
30586
+ (0, import_chunk_X7QCZR3F.init_util)();
30387
30587
  init_worker_pool();
30388
30588
  init_optimizer_types();
30389
30589
  init_types();
@@ -30410,7 +30610,7 @@ var init_optimizer = (0, import_chunk_ABYVSU2C.__esm)({
30410
30610
  "minimizeModules",
30411
30611
  "extensionVersion",
30412
30612
  "typeCheckLevel",
30413
- "covarianceWarnings",
30613
+ "extraReferenceTypeChecks",
30414
30614
  "iterateOptimizer",
30415
30615
  "extraExcludes"
30416
30616
  ];
@@ -30443,7 +30643,7 @@ async function performTask(task) {
30443
30643
  throw new Error(`Invalid task type ${type}`);
30444
30644
  }
30445
30645
  return Promise.resolve(handler(task.data)).then(
30446
- (result) => import_chunk_NHZRKHZO.logPromise.then(() => result)
30646
+ (result) => import_chunk_X7QCZR3F.logPromise.then(() => result)
30447
30647
  );
30448
30648
  }
30449
30649
  var workerTaskHandlers;
@@ -30453,7 +30653,7 @@ var init_worker_task = (0, import_chunk_ABYVSU2C.__esm)({
30453
30653
  init_optimizer();
30454
30654
  init_readprg();
30455
30655
  init_sdk_util();
30456
- (0, import_chunk_NHZRKHZO.init_logger)();
30656
+ (0, import_chunk_X7QCZR3F.init_logger)();
30457
30657
  workerTaskHandlers = {
30458
30658
  buildOptimizedProject(data) {
30459
30659
  return buildOptimizedProject(data.product, data.options);
@@ -30671,7 +30871,7 @@ async function optimizeProgram(filepath, devKey, output, config) {
30671
30871
  }
30672
30872
  function optimizeProgramBuffer(filepath, view, debugXml, apiDebugXml, key, config) {
30673
30873
  const { sections } = readPrgWithOffsets(view);
30674
- (0, import_chunk_NHZRKHZO.logger)("readprg", 5, sections);
30874
+ (0, import_chunk_X7QCZR3F.logger)("readprg", 5, sections);
30675
30875
  const symbolTable = new SymbolTable();
30676
30876
  if ((0, import_chunk_JDC43A3I.hasProperty)(sections, 1461170197 .toString())) {
30677
30877
  symbolTable.parse(sections[
@@ -30971,7 +31171,7 @@ var init_readprg = (0, import_chunk_ABYVSU2C.__esm)({
30971
31171
  init_signer();
30972
31172
  init_symbols();
30973
31173
  init_sdk_util();
30974
- (0, import_chunk_NHZRKHZO.init_util)();
31174
+ (0, import_chunk_X7QCZR3F.init_util)();
30975
31175
  init_worker_pool();
30976
31176
  }
30977
31177
  });
@@ -30983,7 +31183,7 @@ function getSdkPath() {
30983
31183
  });
30984
31184
  }
30985
31185
  async function getDeviceInfo() {
30986
- const files = await (0, import_chunk_NHZRKHZO.globa)(`${connectiq}/Devices/*/compiler.json`);
31186
+ const files = await (0, import_chunk_X7QCZR3F.globa)(`${connectiq}/Devices/*/compiler.json`);
30987
31187
  if (!files.length) {
30988
31188
  throw new Error(
30989
31189
  `No devices found at '${connectiq}/Devices'. Check your sdk is correctly installed`
@@ -31051,7 +31251,7 @@ async function getFunctionDocumentation() {
31051
31251
  var isWin, appSupport, connectiq;
31052
31252
  var init_sdk_util = (0, import_chunk_ABYVSU2C.__esm)({
31053
31253
  "src/sdk-util.ts"() {
31054
- (0, import_chunk_NHZRKHZO.init_util)();
31254
+ (0, import_chunk_X7QCZR3F.init_util)();
31055
31255
  init_xml_util();
31056
31256
  init_readprg();
31057
31257
  init_bytecode();