nudojs 1.0.4 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1391 -786
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -61,7 +61,9 @@ function termEquals(a, b) {
61
61
  }
62
62
  function termToString(t) {
63
63
  if (t.op === "lit") {
64
- return typeof t.value === "string" ? JSON.stringify(t.value) : String(t.value);
64
+ if (typeof t.value === "string") return JSON.stringify(t.value);
65
+ if (typeof t.value === "number" && Object.is(t.value, -0)) return "-0";
66
+ return String(t.value);
65
67
  }
66
68
  if (t.op === "var") return t.id;
67
69
  if (t.op === "app" && t.fn === "get" && t.args.length === 2) {
@@ -93,12 +95,22 @@ function simplifyTerm(t) {
93
95
  }
94
96
  if (fn2 === "*" && args.length === 2) {
95
97
  const [a, b] = args;
96
- if (a.op === "lit" && a.value === 1) return b;
97
- if (b.op === "lit" && b.value === 1) return a;
98
+ const one = (t2) => t2.op === "lit" && t2.value === 1;
99
+ const surviveMulOne = (t2) => {
100
+ if (t2.op !== "lit") return t2;
101
+ const v2 = t2.value;
102
+ if (typeof v2 === "number") return t2;
103
+ if (typeof v2 === "boolean") return lit(v2 ? 1 : 0);
104
+ if (v2 === null) return lit(0);
105
+ if (typeof v2 === "string") return lit(Number(v2));
106
+ return lit(NaN);
107
+ };
108
+ if (one(b)) return surviveMulOne(a);
109
+ if (one(a)) return surviveMulOne(b);
98
110
  }
99
111
  if (fn2 === "-" && args.length === 2) {
100
112
  const [a, b] = args;
101
- if (b.op === "lit" && b.value === 0) return a;
113
+ if (b.op === "lit" && Object.is(b.value, 0)) return a;
102
114
  }
103
115
  return app(fn2, args);
104
116
  }
@@ -196,13 +208,10 @@ function negatePred(p) {
196
208
  case "ne":
197
209
  return eq(p.a, p.b);
198
210
  case "lt":
199
- return ge(p.a, p.b);
200
211
  case "le":
201
- return gt(p.a, p.b);
202
212
  case "gt":
203
- return le(p.a, p.b);
204
213
  case "ge":
205
- return lt(p.a, p.b);
214
+ return { op: "not", arg: p };
206
215
  case "and":
207
216
  return or(...p.args.map(negatePred));
208
217
  case "or":
@@ -215,6 +224,13 @@ function negatePred(p) {
215
224
  );
216
225
  }
217
226
  }
227
+ function totalOrderDual(p) {
228
+ if (p.op === "lt") return ge(p.a, p.b);
229
+ if (p.op === "le") return gt(p.a, p.b);
230
+ if (p.op === "gt") return le(p.a, p.b);
231
+ if (p.op === "ge") return lt(p.a, p.b);
232
+ return void 0;
233
+ }
218
234
  function predEquals(a, b) {
219
235
  if (a === b) return true;
220
236
  if (a.op !== b.op) return false;
@@ -351,14 +367,18 @@ function implies(phi2, pred) {
351
367
  if (expanded.op !== "not") {
352
368
  return implies(phi2, expanded);
353
369
  }
370
+ const dual = totalOrderDual(pred.arg);
371
+ if (dual && implies(phi2, dual)) return true;
354
372
  if (phi2.op === "not") {
355
373
  return implies(pred.arg, phi2.arg);
356
374
  }
357
375
  if (phi2.op === "and") {
358
376
  for (const c of phi2.args) {
359
377
  if (c.op === "not" && implies(pred.arg, c.arg)) return true;
378
+ if (dual && predEquals(c, dual)) return true;
360
379
  }
361
380
  }
381
+ if (dual && predEquals(phi2, dual)) return true;
362
382
  if (pred.arg.op === "typeof" && impliesNotTypeof(phi2, pred.arg)) return true;
363
383
  return false;
364
384
  }
@@ -15542,10 +15562,17 @@ function pureFnNameOf(fn2) {
15542
15562
  if (impl?.pureName) return impl.pureName;
15543
15563
  return fn2._memoize;
15544
15564
  }
15545
- function absFunction(params, impl) {
15565
+ function absFunction(params, impl, opts) {
15546
15566
  const a = {
15547
- shape: { k: "fn", params },
15548
- conf: "exact"
15567
+ shape: {
15568
+ k: "fn",
15569
+ params,
15570
+ ...opts?.name ? { name: opts.name } : {},
15571
+ ...opts?.paramTypes ? { paramTypes: opts.paramTypes } : {},
15572
+ ...opts?.returnType ? { returnType: opts.returnType } : {},
15573
+ ...opts?.slots ? { slots: opts.slots } : {}
15574
+ },
15575
+ conf: opts?.conf ?? "exact"
15549
15576
  };
15550
15577
  attachFnImpl(a, { params, ...impl });
15551
15578
  return a;
@@ -15600,7 +15627,8 @@ function shapeStableKey(s, seen) {
15600
15627
  const pts = (s.paramTypes ?? []).map((t) => absStableKey(t, seen)).join(",");
15601
15628
  const ret = s.returnType ? absStableKey(s.returnType, seen) : "?";
15602
15629
  const name = s.name ? `#${s.name}` : "";
15603
- return `fn${name}(${s.params.join(",")}|${pts})=>${ret}`;
15630
+ const slots = s.slots ? `{${Object.keys(s.slots).sort().map((k) => `${k}:${absStableKey(s.slots[k].value, seen)}`).join(",")}}` : "";
15631
+ return `fn${name}(${s.params.join(",")}|${pts})=>${ret}${slots}`;
15604
15632
  }
15605
15633
  case "sum":
15606
15634
  return `sum(${s.members.map((m) => absStableKey(m, seen)).join("|")})`;
@@ -15822,6 +15850,13 @@ function canonicalArrayIndex(v2) {
15822
15850
  }
15823
15851
  return void 0;
15824
15852
  }
15853
+ function propertyKeyOf(a) {
15854
+ if (a === void 0) return void 0;
15855
+ if (a.term?.op !== "lit") return void 0;
15856
+ const v2 = a.term.value;
15857
+ if (typeof v2 === "symbol") return void 0;
15858
+ return String(v2);
15859
+ }
15825
15860
  function objOf(slots, opts) {
15826
15861
  const shape2 = { k: "obj", slots };
15827
15862
  if (opts?.index) shape2.index = opts.index;
@@ -15834,6 +15869,25 @@ function isObj(a) {
15834
15869
  function getSlot(slots, key) {
15835
15870
  return Object.prototype.hasOwnProperty.call(slots, key) ? slots[key] : void 0;
15836
15871
  }
15872
+ function setSlot(slots, key, slot) {
15873
+ Object.defineProperty(slots, key, {
15874
+ value: slot,
15875
+ enumerable: true,
15876
+ writable: true,
15877
+ configurable: true
15878
+ });
15879
+ }
15880
+ function setProtoAbs(o, proto) {
15881
+ const pv = litValue(proto);
15882
+ if (pv === null) return markNullProtoObj(o);
15883
+ if (proto.term?.op === "lit" && (pv === void 0 || typeof pv !== "object")) {
15884
+ return o;
15885
+ }
15886
+ if (isObj(o)) {
15887
+ o.shape.open = true;
15888
+ }
15889
+ return o;
15890
+ }
15837
15891
  function spread(base, over) {
15838
15892
  if (!isObj(base) && !isObj(over)) {
15839
15893
  if (isObj(over)) return { shape: { ...over.shape, open: true }, conf: confJoin(base.conf, over.conf) };
@@ -15852,7 +15906,7 @@ function spread(base, over) {
15852
15906
  const indexSlots = spreadIndexSlots(over);
15853
15907
  if (indexSlots && isObj(base)) {
15854
15908
  const slots2 = { ...base.shape.slots };
15855
- for (const [k, s] of Object.entries(indexSlots)) slots2[k] = s;
15909
+ for (const [k, s] of Object.entries(indexSlots)) setSlot(slots2, k, s);
15856
15910
  const shape3 = { k: "obj", slots: slots2 };
15857
15911
  if (base.shape.open) shape3.open = true;
15858
15912
  return { shape: shape3, conf: confJoin(base.conf, over.conf) };
@@ -15868,7 +15922,7 @@ function spread(base, over) {
15868
15922
  }
15869
15923
  const slots = { ...base.shape.slots };
15870
15924
  for (const [k, s] of Object.entries(over.shape.slots)) {
15871
- slots[k] = s;
15925
+ setSlot(slots, k, s);
15872
15926
  }
15873
15927
  const open = base.shape.open || over.shape.open || false;
15874
15928
  const shape2 = { k: "obj", slots };
@@ -15892,8 +15946,9 @@ function spreadIndexSlots(over) {
15892
15946
  const sv = over.term?.op === "lit" && typeof over.term.value === "string" ? over.term.value : void 0;
15893
15947
  if (sv !== void 0) {
15894
15948
  const slots = {};
15895
- let i = 0;
15896
- for (const ch of sv) slots[String(i++)] = { value: strLit(ch) };
15949
+ for (let i = 0; i < sv.length; i++) {
15950
+ slots[String(i)] = { value: strLit(sv[i]) };
15951
+ }
15897
15952
  return slots;
15898
15953
  }
15899
15954
  return void 0;
@@ -15918,7 +15973,7 @@ function joinObjects(a, b) {
15918
15973
  const optional = sa.optional || sb.optional;
15919
15974
  const jv = joinValues(sa.value, sb.value);
15920
15975
  conf = confJoin(conf, jv.conf);
15921
- slots[k] = { value: jv, optional };
15976
+ setSlot(slots, k, { value: jv, optional });
15922
15977
  }
15923
15978
  return { shape: { k: "obj", slots }, conf };
15924
15979
  }
@@ -16264,10 +16319,10 @@ function tryPromoteDirectCall(env2, calleeName, args, loc) {
16264
16319
  });
16265
16320
  return env2.vars.get(calleeName);
16266
16321
  }
16267
- function tryPromoteHofCallback(env2, cbName, method, argAbses, loc) {
16322
+ function tryPromoteHofCallback(env2, cevalName, method, argAbses, loc) {
16268
16323
  const hc = env2.hofCollect;
16269
- if (!hc || !hc.paramNames.has(cbName)) return void 0;
16270
- const prev = env2.vars.get(cbName);
16324
+ if (!hc || !hc.paramNames.has(cevalName)) return void 0;
16325
+ const prev = env2.vars.get(cevalName);
16271
16326
  if (!prev) return void 0;
16272
16327
  if (prev.shape.k !== "any" && prev.shape.k !== "unknown") return void 0;
16273
16328
  let paramTypes;
@@ -16281,12 +16336,12 @@ function tryPromoteHofCallback(env2, cbName, method, argAbses, loc) {
16281
16336
  paramTypes = argAbses.map(
16282
16337
  (a) => abs({ k: "any" }, alphaOf(a, hc), void 0, "path")
16283
16338
  );
16284
- returnType = abs({ k: "any" }, betaOf(cbName), void 0, "path");
16339
+ returnType = abs({ k: "any" }, betaOf(cevalName), void 0, "path");
16285
16340
  } else {
16286
16341
  paramTypes = argAbses.map(
16287
16342
  (a) => abs({ k: "any" }, alphaOf(a, hc), void 0, "path")
16288
16343
  );
16289
- returnType = abs({ k: "any" }, betaOf(cbName), void 0, "path");
16344
+ returnType = abs({ k: "any" }, betaOf(cevalName), void 0, "path");
16290
16345
  }
16291
16346
  const fnShape = {
16292
16347
  k: "fn",
@@ -16294,14 +16349,14 @@ function tryPromoteHofCallback(env2, cbName, method, argAbses, loc) {
16294
16349
  paramTypes,
16295
16350
  returnType
16296
16351
  };
16297
- promoteParamShape(env2, cbName, fnShape, { loc, recordSite: false });
16352
+ promoteParamShape(env2, cevalName, fnShape, { loc, recordSite: false });
16298
16353
  hc.sites.push({
16299
- param: cbName,
16354
+ param: cevalName,
16300
16355
  argTerms: argAbses.map((a) => a.term ?? { op: "var", id: "_" }),
16301
16356
  result: returnType,
16302
16357
  loc
16303
16358
  });
16304
- return env2.vars.get(cbName);
16359
+ return env2.vars.get(cevalName);
16305
16360
  }
16306
16361
  function snapshotAbs(a) {
16307
16362
  const shape2 = a.shape;
@@ -16332,7 +16387,12 @@ function snapshotAbs(a) {
16332
16387
  const nextSlot = { value: snapshotAbs(slot.value) };
16333
16388
  if (slot.optional) nextSlot.optional = true;
16334
16389
  if (slot.readonly) nextSlot.readonly = true;
16335
- slots[k] = nextSlot;
16390
+ Object.defineProperty(slots, k, {
16391
+ value: nextSlot,
16392
+ enumerable: true,
16393
+ writable: true,
16394
+ configurable: true
16395
+ });
16336
16396
  }
16337
16397
  const next = { k: "obj", slots };
16338
16398
  if (s.index) {
@@ -16578,7 +16638,12 @@ function substShape(s, map, cache2, visiting) {
16578
16638
  const nextSlot = { value: substAbsInner(slot.value, map, cache2, visiting) };
16579
16639
  if (slot.optional) nextSlot.optional = true;
16580
16640
  if (slot.readonly) nextSlot.readonly = true;
16581
- slots[k] = nextSlot;
16641
+ Object.defineProperty(slots, k, {
16642
+ value: nextSlot,
16643
+ enumerable: true,
16644
+ writable: true,
16645
+ configurable: true
16646
+ });
16582
16647
  }
16583
16648
  const next = { k: "obj", slots };
16584
16649
  if (s.index) {
@@ -16938,26 +17003,66 @@ function concatString(a, b) {
16938
17003
  }
16939
17004
  const aParts = coerceToStringParts(a);
16940
17005
  const bParts = coerceToStringParts(b);
16941
- if (!aParts || !bParts) return abs({ k: "unknown" }, void 0, void 0, "partial");
17006
+ if (!aParts || !bParts) {
17007
+ if (isStrPrim2(a) || isStrPrim2(b)) {
17008
+ return abs({ k: "prim", type: "string" }, void 0, void 0, "path");
17009
+ }
17010
+ return abs({ k: "unknown" }, void 0, void 0, "partial");
17011
+ }
16942
17012
  return createTemplateAbs([...aParts, ...bParts]);
16943
17013
  }
16944
17014
  function coerceToStringParts(a) {
16945
17015
  if (isTemplateAbs(a) || isStrPrim2(a)) return templatePartsOf(a);
16946
17016
  if (isStrLit(a)) return [a];
16947
- const lv = litValue(a);
16948
- if (typeof lv === "number" || typeof lv === "boolean") {
16949
- return [abs({ k: "prim", type: "string" }, lit(String(lv)), void 0, "exact")];
17017
+ if (a.term?.op === "lit") {
17018
+ const v2 = a.term.value;
17019
+ if (typeof v2 === "symbol") return void 0;
17020
+ return [abs({ k: "prim", type: "string" }, lit(String(v2)), void 0, "exact")];
16950
17021
  }
16951
17022
  if (a.shape.k === "prim" && a.shape.type === "number") {
16952
17023
  return [a];
16953
17024
  }
17025
+ if (a.shape.k === "tuple" || a.shape.k === "arr") {
17026
+ return [arrayToPrimitiveString(a)];
17027
+ }
17028
+ if (a.shape.k === "obj" && !a.shape.open && !a.shape.index && !isNullProtoObj(a)) {
17029
+ const slots = a.shape.slots;
17030
+ if (!Object.hasOwn(slots, "toString") && !Object.hasOwn(slots, "valueOf")) {
17031
+ return [
17032
+ abs({ k: "prim", type: "string" }, lit("[object Object]"), void 0, "exact")
17033
+ ];
17034
+ }
17035
+ }
16954
17036
  return void 0;
16955
17037
  }
17038
+ function arrayToPrimitiveString(a) {
17039
+ const s = a.shape;
17040
+ const strPrimPart = () => abs({ k: "prim", type: "string" }, void 0, void 0, "path");
17041
+ if (s.k === "arr") return strPrimPart();
17042
+ if (s.k !== "tuple") return strPrimPart();
17043
+ const holes = s.holes ?? [];
17044
+ const parts = [];
17045
+ for (let i = 0; i < s.elements.length; i++) {
17046
+ if (holes.includes(i)) {
17047
+ parts.push("");
17048
+ continue;
17049
+ }
17050
+ const el = s.elements[i];
17051
+ if (el.term?.op !== "lit") return strPrimPart();
17052
+ const v2 = el.term.value;
17053
+ if (typeof v2 === "symbol") return strPrimPart();
17054
+ if (v2 === null || v2 === void 0) parts.push("");
17055
+ else if (typeof v2 === "object") return strPrimPart();
17056
+ else parts.push(String(v2));
17057
+ }
17058
+ return abs({ k: "prim", type: "string" }, lit(parts.join(",")), void 0, "exact");
17059
+ }
16956
17060
  var init_template = __esm({
16957
17061
  "../core/src/algebra/template.ts"() {
16958
17062
  "use strict";
16959
17063
  init_abs();
16960
17064
  init_term();
17065
+ init_objects();
16961
17066
  }
16962
17067
  });
16963
17068
 
@@ -17187,6 +17292,12 @@ function add(a, b, phi2 = pTrue) {
17187
17292
  if (typeof va === "string" || typeof vb === "string") {
17188
17293
  return strLitResult(String(va) + String(vb));
17189
17294
  }
17295
+ if (typeof va === "bigint" && typeof vb !== "bigint" || typeof vb === "bigint" && typeof va !== "bigint") {
17296
+ throw new NudoThrow(errorTypeAbs("TypeError"));
17297
+ }
17298
+ }
17299
+ if (isStrPrim(a) || isStrPrim(b) || isTemplateLike(a) || isTemplateLike(b)) {
17300
+ return concatString(a, b);
17190
17301
  }
17191
17302
  if (coercibleLit(va) && coercibleLit(vb)) {
17192
17303
  return numLit(Number(va) + Number(vb));
@@ -17196,7 +17307,7 @@ function add(a, b, phi2 = pTrue) {
17196
17307
  if (isBigPrim(a) && isBigPrim(b)) {
17197
17308
  return abs({ k: "prim", type: "bigint" }, void 0, void 0, confJoin(a.conf, b.conf));
17198
17309
  }
17199
- if (isStrPrim(a) || isStrPrim(b) || isTemplateLike(a) || isTemplateLike(b)) {
17310
+ if (a.shape.k === "tuple" || a.shape.k === "arr" || b.shape.k === "tuple" || b.shape.k === "arr") {
17200
17311
  return concatString(a, b);
17201
17312
  }
17202
17313
  if (isNumPrim(a) && isNumPrim(b)) {
@@ -17212,8 +17323,12 @@ function add(a, b, phi2 = pTrue) {
17212
17323
  }
17213
17324
  if (isAnyLike(a) || isAnyLike(b)) {
17214
17325
  const term = a.term && b.term ? simplifyTerm(app("+", [a.term, b.term])) : void 0;
17326
+ const bigFace = isBigPrim(a) || isBigPrim(b);
17215
17327
  return abs(
17216
- { k: "sum", members: [num(), str()] },
17328
+ {
17329
+ k: "sum",
17330
+ members: bigFace ? [abs({ k: "prim", type: "bigint" }, void 0, void 0, "exact"), str()] : [num(), str()]
17331
+ },
17217
17332
  term,
17218
17333
  void 0,
17219
17334
  "partial"
@@ -17246,6 +17361,15 @@ function add(a, b, phi2 = pTrue) {
17246
17361
  }
17247
17362
  return abs({ k: "unknown" }, void 0, void 0, "partial");
17248
17363
  }
17364
+ function isKnownNonBigintNumeric(a) {
17365
+ const va = litValue(a);
17366
+ if (typeof va === "number" || typeof va === "boolean" || va === null) return true;
17367
+ if (a.term?.op === "lit" && a.term.value === void 0) return true;
17368
+ return a.shape.k === "prim" && (a.shape.type === "number" || a.shape.type === "boolean");
17369
+ }
17370
+ function isMaybeBigintOperand(a) {
17371
+ return a.shape.k === "any" || a.shape.k === "unknown" || a.shape.k === "obj" || a.shape.k === "fn" || a.shape.k === "brand" || a.shape.k === "sum";
17372
+ }
17249
17373
  function foldBigintBinOp(a, b, op) {
17250
17374
  const va = litValue(a);
17251
17375
  const vb = litValue(b);
@@ -17253,13 +17377,27 @@ function foldBigintBinOp(a, b, op) {
17253
17377
  if (typeof va === "bigint" && typeof vb === "bigint") {
17254
17378
  try {
17255
17379
  return bigintLit(op(va, vb));
17256
- } catch {
17257
- return abs({ k: "unknown" }, void 0, void 0, "partial");
17380
+ } catch (e) {
17381
+ if (e instanceof RangeError) throw new NudoThrow(errorTypeAbs("RangeError"));
17382
+ throw new NudoThrow(errorTypeAbs("TypeError"));
17258
17383
  }
17259
17384
  }
17260
17385
  const other = typeof va === "bigint" ? b : a;
17261
17386
  if (isBigPrim(other)) return void 0;
17262
- return abs({ k: "unknown" }, void 0, void 0, "partial");
17387
+ if (isKnownNonBigintNumeric(other)) {
17388
+ throw new NudoThrow(errorTypeAbs("TypeError"));
17389
+ }
17390
+ if (isStrPrim(other)) {
17391
+ throw new NudoThrow(errorTypeAbs("TypeError"));
17392
+ }
17393
+ if (isMaybeBigintOperand(other)) {
17394
+ recordMayThrow({
17395
+ kind: "TypeError",
17396
+ cause: "mixed bigint \u2297 abstract operand"
17397
+ });
17398
+ return void 0;
17399
+ }
17400
+ throw new NudoThrow(errorTypeAbs("TypeError"));
17263
17401
  }
17264
17402
  function dedupAbsMembers(ms) {
17265
17403
  const seen = /* @__PURE__ */ new Set();
@@ -17282,6 +17420,12 @@ function strLitResult(s) {
17282
17420
  function normalizeNegZero(n) {
17283
17421
  return n === 0 ? 0 : n;
17284
17422
  }
17423
+ function ieeeBound(n, strict, strictZeroOk) {
17424
+ if (!Number.isFinite(n)) return void 0;
17425
+ const z = normalizeNegZero(n);
17426
+ if (z === 0 && strict && !strictZeroOk) return void 0;
17427
+ return z;
17428
+ }
17285
17429
  function isAnyLike(a) {
17286
17430
  if (a.shape.k === "any") return true;
17287
17431
  if (a.shape.k === "unknown") return true;
@@ -17292,8 +17436,9 @@ function coercibleLit(v2) {
17292
17436
  }
17293
17437
  function toNumberResult(a, b, op) {
17294
17438
  const term = a.term && b.term ? app(op, [a.term, b.term]) : void 0;
17439
+ const bigFace = isBigPrim(a) || isBigPrim(b);
17295
17440
  return abs(
17296
- { k: "prim", type: "number" },
17441
+ bigFace ? { k: "prim", type: "bigint" } : { k: "prim", type: "number" },
17297
17442
  term,
17298
17443
  void 0,
17299
17444
  term ? confJoin(confJoin(a.conf, b.conf), "partial") : "partial"
@@ -17304,18 +17449,22 @@ function isNumericLike(a) {
17304
17449
  }
17305
17450
  function addPred(a, b, sumTerm, phi2) {
17306
17451
  const aBounds = numericBounds(a, phi2);
17307
- const bBounds = numericBounds(b, phi2);
17308
- if (!aBounds && !bBounds) return void 0;
17452
+ const evalBounds = numericBounds(b, phi2);
17453
+ if (!aBounds && !evalBounds) return void 0;
17309
17454
  const facts = [];
17310
- if (aBounds?.lo !== void 0 && bBounds?.lo !== void 0) {
17311
- const loSum = aBounds.lo.value + bBounds.lo.value;
17312
- const strict = aBounds.lo.strict || bBounds.lo.strict;
17313
- facts.push(strict ? gt(sumTerm, lit(loSum)) : ge(sumTerm, lit(loSum)));
17455
+ if (aBounds?.lo !== void 0 && evalBounds?.lo !== void 0) {
17456
+ const strict = aBounds.lo.strict || evalBounds.lo.strict;
17457
+ const loSum = ieeeBound(aBounds.lo.value + evalBounds.lo.value, strict, true);
17458
+ if (loSum !== void 0) {
17459
+ facts.push(strict ? gt(sumTerm, lit(loSum)) : ge(sumTerm, lit(loSum)));
17460
+ }
17314
17461
  }
17315
- if (aBounds?.hi !== void 0 && bBounds?.hi !== void 0) {
17316
- const hiSum = aBounds.hi.value + bBounds.hi.value;
17317
- const strict = aBounds.hi.strict || bBounds.hi.strict;
17318
- facts.push(strict ? lt(sumTerm, lit(hiSum)) : le(sumTerm, lit(hiSum)));
17462
+ if (aBounds?.hi !== void 0 && evalBounds?.hi !== void 0) {
17463
+ const strict = aBounds.hi.strict || evalBounds.hi.strict;
17464
+ const hiSum = ieeeBound(aBounds.hi.value + evalBounds.hi.value, strict, true);
17465
+ if (hiSum !== void 0) {
17466
+ facts.push(strict ? lt(sumTerm, lit(hiSum)) : le(sumTerm, lit(hiSum)));
17467
+ }
17319
17468
  }
17320
17469
  if (facts.length === 0) return void 0;
17321
17470
  return and(...facts);
@@ -17329,77 +17478,57 @@ function numericBounds(a, phi2 = pTrue) {
17329
17478
  if (a.term?.op === "var") {
17330
17479
  collectBoundsFromPhi(phi2, a.term.id, result);
17331
17480
  }
17332
- if (a.term?.op === "lit" && typeof a.term.value === "number") {
17481
+ if (a.term?.op === "lit" && typeof a.term.value === "number" && !Number.isNaN(a.term.value)) {
17333
17482
  result.lo = { value: a.term.value, strict: false };
17334
17483
  result.hi = { value: a.term.value, strict: false };
17335
17484
  }
17336
17485
  if (result.lo === void 0 && result.hi === void 0) return void 0;
17337
17486
  return result;
17338
17487
  }
17488
+ function tightenLo2(acc, n, strict) {
17489
+ if (acc.lo === void 0 || n > acc.lo.value || n === acc.lo.value && strict && !acc.lo.strict) {
17490
+ acc.lo = { value: n, strict };
17491
+ }
17492
+ }
17493
+ function tightenHi2(acc, n, strict) {
17494
+ if (acc.hi === void 0 || n < acc.hi.value || n === acc.hi.value && strict && !acc.hi.strict) {
17495
+ acc.hi = { value: n, strict };
17496
+ }
17497
+ }
17498
+ function noteBoundFromRel(p, isTarget, acc) {
17499
+ if (p.op !== "gt" && p.op !== "ge" && p.op !== "lt" && p.op !== "le") return;
17500
+ let op = p.op;
17501
+ let litSide;
17502
+ if (isTarget(p.a) && p.b.op === "lit" && typeof p.b.value === "number") {
17503
+ litSide = p.b;
17504
+ } else if (isTarget(p.b) && p.a.op === "lit" && typeof p.a.value === "number") {
17505
+ op = op === "gt" ? "lt" : op === "lt" ? "gt" : op === "ge" ? "le" : "ge";
17506
+ litSide = p.a;
17507
+ } else {
17508
+ return;
17509
+ }
17510
+ const n = litSide.value;
17511
+ if (op === "gt") tightenLo2(acc, n, true);
17512
+ else if (op === "ge") tightenLo2(acc, n, false);
17513
+ else if (op === "lt") tightenHi2(acc, n, true);
17514
+ else tightenHi2(acc, n, false);
17515
+ }
17339
17516
  function collectBoundsFromPred(pred, term, acc) {
17340
- const match = (t) => termToString(t) === termToString(term);
17517
+ const isTarget = (t) => termToString(t) === termToString(term);
17341
17518
  const apply = (p) => {
17342
17519
  if (p.op === "and") {
17343
17520
  p.args.forEach(apply);
17344
17521
  return;
17345
17522
  }
17346
- if (p.op === "gt" && match(p.a) && p.b.op === "lit" && typeof p.b.value === "number") {
17347
- const n = p.b.value;
17348
- if (acc.lo === void 0 || n > acc.lo.value || n === acc.lo.value && !acc.lo.strict) {
17349
- acc.lo = { value: n, strict: true };
17350
- }
17351
- return;
17352
- }
17353
- if (p.op === "ge" && match(p.a) && p.b.op === "lit" && typeof p.b.value === "number") {
17354
- const n = p.b.value;
17355
- if (acc.lo === void 0 || n > acc.lo.value) {
17356
- acc.lo = { value: n, strict: false };
17357
- }
17358
- return;
17359
- }
17360
- if (p.op === "lt" && match(p.a) && p.b.op === "lit" && typeof p.b.value === "number") {
17361
- const n = p.b.value;
17362
- if (acc.hi === void 0 || n < acc.hi.value || n === acc.hi.value && !acc.hi.strict) {
17363
- acc.hi = { value: n, strict: true };
17364
- }
17365
- return;
17366
- }
17367
- if (p.op === "le" && match(p.a) && p.b.op === "lit" && typeof p.b.value === "number") {
17368
- const n = p.b.value;
17369
- if (acc.hi === void 0 || n < acc.hi.value) {
17370
- acc.hi = { value: n, strict: false };
17371
- }
17372
- }
17523
+ noteBoundFromRel(p, isTarget, acc);
17373
17524
  };
17374
17525
  apply(pred);
17375
17526
  }
17376
17527
  function collectBoundsFromPhi(phi2, id, acc) {
17528
+ const isTarget = (t) => t.op === "var" && t.id === id;
17377
17529
  const conjs = phi2.op === "and" ? phi2.args : [phi2];
17378
17530
  for (const p of conjs) {
17379
- if (p.op === "gt" && p.a.op === "var" && p.a.id === id && p.b.op === "lit" && typeof p.b.value === "number") {
17380
- const n = p.b.value;
17381
- if (acc.lo === void 0 || n > acc.lo.value || n === acc.lo.value && !acc.lo.strict) {
17382
- acc.lo = { value: n, strict: true };
17383
- }
17384
- }
17385
- if (p.op === "ge" && p.a.op === "var" && p.a.id === id && p.b.op === "lit" && typeof p.b.value === "number") {
17386
- const n = p.b.value;
17387
- if (acc.lo === void 0 || n > acc.lo.value) {
17388
- acc.lo = { value: n, strict: false };
17389
- }
17390
- }
17391
- if (p.op === "lt" && p.a.op === "var" && p.a.id === id && p.b.op === "lit" && typeof p.b.value === "number") {
17392
- const n = p.b.value;
17393
- if (acc.hi === void 0 || n < acc.hi.value || n === acc.hi.value && !acc.hi.strict) {
17394
- acc.hi = { value: n, strict: true };
17395
- }
17396
- }
17397
- if (p.op === "le" && p.a.op === "var" && p.a.id === id && p.b.op === "lit" && typeof p.b.value === "number") {
17398
- const n = p.b.value;
17399
- if (acc.hi === void 0 || n < acc.hi.value) {
17400
- acc.hi = { value: n, strict: false };
17401
- }
17402
- }
17531
+ noteBoundFromRel(p, isTarget, acc);
17403
17532
  }
17404
17533
  }
17405
17534
  function sub(a, b, phi2 = pTrue) {
@@ -17422,14 +17551,18 @@ function sub(a, b, phi2 = pTrue) {
17422
17551
  const bb = numericBounds(b, phi2);
17423
17552
  const facts = [];
17424
17553
  if (ab?.lo !== void 0 && bb?.hi !== void 0) {
17425
- const lo = ab.lo.value - bb.hi.value;
17426
17554
  const strict = ab.lo.strict || bb.hi.strict;
17427
- facts.push(strict ? gt(term, lit(lo)) : ge(term, lit(lo)));
17555
+ const lo = ieeeBound(ab.lo.value - bb.hi.value, strict, true);
17556
+ if (lo !== void 0) {
17557
+ facts.push(strict ? gt(term, lit(lo)) : ge(term, lit(lo)));
17558
+ }
17428
17559
  }
17429
17560
  if (ab?.hi !== void 0 && bb?.lo !== void 0) {
17430
- const hi = ab.hi.value - bb.lo.value;
17431
17561
  const strict = ab.hi.strict || bb.lo.strict;
17432
- facts.push(strict ? lt(term, lit(hi)) : le(term, lit(hi)));
17562
+ const hi = ieeeBound(ab.hi.value - bb.lo.value, strict, true);
17563
+ if (hi !== void 0) {
17564
+ facts.push(strict ? lt(term, lit(hi)) : le(term, lit(hi)));
17565
+ }
17433
17566
  }
17434
17567
  const conf = term.op === "lit" ? "exact" : confJoin(confJoin(a.conf, b.conf), facts.length ? "path" : "path");
17435
17568
  return abs({ k: "prim", type: "number" }, term, facts.length ? and(...facts) : void 0, conf);
@@ -17467,25 +17600,26 @@ function mul(a, b, phi2 = pTrue) {
17467
17600
  k = a.term.value;
17468
17601
  base = b;
17469
17602
  }
17470
- if (k !== void 0 && base !== void 0 && k !== 0) {
17603
+ if (k !== void 0 && base !== void 0 && k !== 0 && Number.isFinite(k)) {
17604
+ const strictZeroOk = Math.abs(k) >= 1;
17471
17605
  const ab = numericBounds(base, phi2);
17472
17606
  const facts = [];
17473
17607
  if (ab?.lo !== void 0) {
17474
17608
  if (k > 0) {
17475
- const lo = ab.lo.value * k;
17476
- facts.push(ab.lo.strict ? gt(term, lit(lo)) : ge(term, lit(lo)));
17609
+ const lo = ieeeBound(ab.lo.value * k, ab.lo.strict, strictZeroOk);
17610
+ if (lo !== void 0) facts.push(ab.lo.strict ? gt(term, lit(lo)) : ge(term, lit(lo)));
17477
17611
  } else {
17478
- const hi = ab.lo.value * k;
17479
- facts.push(ab.lo.strict ? lt(term, lit(normalizeNegZero(hi))) : le(term, lit(normalizeNegZero(hi))));
17612
+ const hi = ieeeBound(ab.lo.value * k, ab.lo.strict, strictZeroOk);
17613
+ if (hi !== void 0) facts.push(ab.lo.strict ? lt(term, lit(hi)) : le(term, lit(hi)));
17480
17614
  }
17481
17615
  }
17482
17616
  if (ab?.hi !== void 0) {
17483
17617
  if (k > 0) {
17484
- const hi = ab.hi.value * k;
17485
- facts.push(ab.hi.strict ? lt(term, lit(hi)) : le(term, lit(hi)));
17618
+ const hi = ieeeBound(ab.hi.value * k, ab.hi.strict, strictZeroOk);
17619
+ if (hi !== void 0) facts.push(ab.hi.strict ? lt(term, lit(hi)) : le(term, lit(hi)));
17486
17620
  } else {
17487
- const lo = ab.hi.value * k;
17488
- facts.push(ab.hi.strict ? gt(term, lit(normalizeNegZero(lo))) : ge(term, lit(normalizeNegZero(lo))));
17621
+ const lo = ieeeBound(ab.hi.value * k, ab.hi.strict, strictZeroOk);
17622
+ if (lo !== void 0) facts.push(ab.hi.strict ? gt(term, lit(lo)) : ge(term, lit(lo)));
17489
17623
  }
17490
17624
  }
17491
17625
  return abs(
@@ -17529,19 +17663,24 @@ function div(a, b, phi2 = pTrue) {
17529
17663
  }
17530
17664
  if (isNumericLike(a) && isNumericLike(b) && a.term && b.term) {
17531
17665
  const term = simplifyTerm(app("/", [a.term, b.term]));
17532
- if (b.term.op === "lit" && typeof b.term.value === "number" && b.term.value !== 0) {
17666
+ if (b.term.op === "lit" && typeof b.term.value === "number" && b.term.value !== 0 && Number.isFinite(b.term.value)) {
17533
17667
  const k = b.term.value;
17668
+ const strictZeroOk = Math.abs(k) <= 1;
17534
17669
  const ab = numericBounds(a, phi2);
17535
17670
  const facts = [];
17536
17671
  if (ab?.lo !== void 0) {
17537
- const lo = ab.lo.value / k;
17538
- if (k > 0) facts.push(ab.lo.strict ? gt(term, lit(lo)) : ge(term, lit(lo)));
17539
- else facts.push(ab.lo.strict ? lt(term, lit(lo)) : le(term, lit(lo)));
17672
+ const lo = ieeeBound(ab.lo.value / k, ab.lo.strict, strictZeroOk);
17673
+ if (lo !== void 0) {
17674
+ if (k > 0) facts.push(ab.lo.strict ? gt(term, lit(lo)) : ge(term, lit(lo)));
17675
+ else facts.push(ab.lo.strict ? lt(term, lit(lo)) : le(term, lit(lo)));
17676
+ }
17540
17677
  }
17541
17678
  if (ab?.hi !== void 0) {
17542
- const hi = ab.hi.value / k;
17543
- if (k > 0) facts.push(ab.hi.strict ? lt(term, lit(hi)) : le(term, lit(hi)));
17544
- else facts.push(ab.hi.strict ? gt(term, lit(hi)) : ge(term, lit(hi)));
17679
+ const hi = ieeeBound(ab.hi.value / k, ab.hi.strict, strictZeroOk);
17680
+ if (hi !== void 0) {
17681
+ if (k > 0) facts.push(ab.hi.strict ? lt(term, lit(hi)) : le(term, lit(hi)));
17682
+ else facts.push(ab.hi.strict ? gt(term, lit(hi)) : ge(term, lit(hi)));
17683
+ }
17545
17684
  }
17546
17685
  return abs(
17547
17686
  num().shape,
@@ -17622,8 +17761,9 @@ function cmp(op, a, b, phi2 = pTrue) {
17622
17761
  if (a.term && b.term) {
17623
17762
  const pred = op === "lt" ? lt(a.term, b.term) : op === "le" ? le(a.term, b.term) : op === "gt" ? gt(a.term, b.term) : op === "ge" ? ge(a.term, b.term) : op === "eq" ? { op: "eq", a: a.term, b: b.term } : { op: "ne", a: a.term, b: b.term };
17624
17763
  if (implies(phi2, pred)) return boolLit(true);
17625
- const neg = op === "lt" ? ge(a.term, b.term) : op === "le" ? gt(a.term, b.term) : op === "gt" ? le(a.term, b.term) : op === "ge" ? lt(a.term, b.term) : op === "eq" ? { op: "ne", a: a.term, b: b.term } : { op: "eq", a: a.term, b: b.term };
17626
- if (implies(phi2, neg)) return boolLit(false);
17764
+ if (implies(phi2, negatePred(pred))) return boolLit(false);
17765
+ const dual = totalOrderDual(pred) ?? (op === "eq" ? { op: "ne", a: a.term, b: b.term } : op === "ne" ? { op: "eq", a: a.term, b: b.term } : void 0);
17766
+ if (dual && implies(phi2, dual)) return boolLit(false);
17627
17767
  const decided = decideByBounds(op, a, b, phi2);
17628
17768
  if (decided !== void 0) return boolLit(decided);
17629
17769
  return {
@@ -17687,24 +17827,26 @@ function decideByBounds(op, a, b, phi2) {
17687
17827
  const aHi = aB?.hi;
17688
17828
  const bLo = bB?.lo;
17689
17829
  const bHi = bB?.hi;
17830
+ const tighterHi = (x, y) => x.value < y.value || x.value === y.value && (x.strict || y.strict);
17831
+ const tighterLo = (x, y) => x.value > y.value || x.value === y.value && (x.strict || y.strict);
17690
17832
  if (op === "lt") {
17691
- if (aHi && bLo && aHi.value < bLo.value) return true;
17833
+ if (aHi && bLo && tighterHi(aHi, bLo)) return true;
17692
17834
  if (aLo && bHi && aLo.value >= bHi.value) return false;
17693
17835
  return void 0;
17694
17836
  }
17695
17837
  if (op === "le") {
17696
- if (aHi && bLo && aHi.value < bLo.value) return true;
17697
- if (aLo && bHi && aLo.value > bHi.value) return false;
17838
+ if (aHi && bLo && aHi.value <= bLo.value) return true;
17839
+ if (aLo && bHi && tighterLo(aLo, bHi)) return false;
17698
17840
  return void 0;
17699
17841
  }
17700
17842
  if (op === "gt") {
17701
- if (aLo && bHi && aLo.value > bHi.value) return true;
17843
+ if (aLo && bHi && tighterLo(aLo, bHi)) return true;
17702
17844
  if (aHi && bLo && aHi.value <= bLo.value) return false;
17703
17845
  return void 0;
17704
17846
  }
17705
17847
  if (op === "ge") {
17706
17848
  if (aLo && bHi && aLo.value >= bHi.value) return true;
17707
- if (aHi && bLo && aHi.value < bLo.value) return false;
17849
+ if (aHi && bLo && tighterHi(aHi, bLo)) return false;
17708
17850
  return void 0;
17709
17851
  }
17710
17852
  return void 0;
@@ -17789,6 +17931,13 @@ function extStateOf(o) {
17789
17931
  function getPropFlags(o) {
17790
17932
  return propFlagsTable.get(o);
17791
17933
  }
17934
+ function enumOwnKeys(o, slots) {
17935
+ const flags = getPropFlags(o);
17936
+ return Object.keys(slots).filter((k) => flags?.get(k)?.enumerable !== false);
17937
+ }
17938
+ function isEnumerableView(o, key) {
17939
+ return getPropFlags(o)?.get(key)?.enumerable !== false;
17940
+ }
17792
17941
  function setPropFlags(o, key, f) {
17793
17942
  let m = propFlagsTable.get(o);
17794
17943
  if (!m) {
@@ -18087,7 +18236,7 @@ function assignSourceSlots(src) {
18087
18236
  const slots = {};
18088
18237
  for (const [k, v2] of Object.entries(inner.shape.slots)) {
18089
18238
  if (k === "length") continue;
18090
- slots[k] = v2;
18239
+ setSlot(slots, k, v2);
18091
18240
  }
18092
18241
  if (Object.keys(slots).length > 0 || !inner.shape.open) return slots;
18093
18242
  }
@@ -18172,8 +18321,12 @@ function evalObjectMethod(name, args) {
18172
18321
  );
18173
18322
  }
18174
18323
  if (a0?.term?.op === "lit" && typeof a0.term.value === "string") {
18324
+ const s = a0.term.value;
18175
18325
  return abs(
18176
- { k: "tuple", elements: Array.from(a0.term.value, (c) => strLit(c)) },
18326
+ {
18327
+ k: "tuple",
18328
+ elements: Array.from({ length: s.length }, (_, i) => strLit(s[i]))
18329
+ },
18177
18330
  void 0,
18178
18331
  void 0,
18179
18332
  "exact"
@@ -18203,12 +18356,13 @@ function evalObjectMethod(name, args) {
18203
18356
  return abs({ k: "tuple", elements: entries }, void 0, void 0, "exact");
18204
18357
  }
18205
18358
  if (a0?.term?.op === "lit" && typeof a0.term.value === "string") {
18359
+ const s = a0.term.value;
18206
18360
  return abs(
18207
18361
  {
18208
18362
  k: "tuple",
18209
18363
  elements: Array.from(
18210
- a0.term.value,
18211
- (c, i) => abs({ k: "tuple", elements: [strLit(String(i)), strLit(c)] }, void 0, void 0, "exact")
18364
+ { length: s.length },
18365
+ (_, i) => abs({ k: "tuple", elements: [strLit(String(i)), strLit(s[i])] }, void 0, void 0, "exact")
18212
18366
  )
18213
18367
  },
18214
18368
  void 0,
@@ -18243,6 +18397,21 @@ function evalObjectMethod(name, args) {
18243
18397
  }
18244
18398
  return protoOfRecv(a0);
18245
18399
  }
18400
+ case "setPrototypeOf": {
18401
+ if (!args.length) {
18402
+ throw new NudoThrow(errorTypeAbs("TypeError"));
18403
+ }
18404
+ const t0 = args[0];
18405
+ const p0 = args[1];
18406
+ if (!t0 || !p0) {
18407
+ throw new NudoThrow(errorTypeAbs("TypeError"));
18408
+ }
18409
+ const pv = litValue(p0);
18410
+ if (p0.term?.op === "lit" && (pv === void 0 || pv !== null && typeof pv !== "object")) {
18411
+ throw new NudoThrow(errorTypeAbs("TypeError"));
18412
+ }
18413
+ return setProtoAbs(t0, p0);
18414
+ }
18246
18415
  case "assign": {
18247
18416
  if (!args.length) return unknown;
18248
18417
  const t0 = args[0];
@@ -18259,7 +18428,11 @@ function evalObjectMethod(name, args) {
18259
18428
  if (acc.shape.k === "obj" && src.shape.k === "obj") {
18260
18429
  const base = acc.shape.slots;
18261
18430
  const over = src.shape.slots;
18262
- acc = abs({ k: "obj", slots: { ...base, ...over } }, void 0, void 0, confJoin(acc.conf, src.conf));
18431
+ const filtered = { ...base };
18432
+ for (const k of enumKeys(over, src)) {
18433
+ filtered[k] = over[k];
18434
+ }
18435
+ acc = abs({ k: "obj", slots: filtered }, void 0, void 0, confJoin(acc.conf, src.conf));
18263
18436
  } else if (src.shape.k !== "obj") {
18264
18437
  const srcSlots = assignSourceSlots(src);
18265
18438
  if (srcSlots === void 0) {
@@ -18516,9 +18689,9 @@ function jsonValueToAbs(v2) {
18516
18689
  if (Array.isArray(v2)) {
18517
18690
  return abs({ k: "tuple", elements: v2.map(jsonValueToAbs) }, void 0, void 0, "exact");
18518
18691
  }
18519
- const slots = {};
18692
+ const slots = /* @__PURE__ */ Object.create(null);
18520
18693
  for (const [k, sv] of Object.entries(v2)) {
18521
- slots[k] = { value: jsonValueToAbs(sv) };
18694
+ setSlot(slots, k, { value: jsonValueToAbs(sv) });
18522
18695
  }
18523
18696
  return abs({ k: "obj", slots }, void 0, void 0, "exact");
18524
18697
  }
@@ -18572,9 +18745,7 @@ function evalJsonMethod(name, args) {
18572
18745
  const t = spaceArg.term;
18573
18746
  if (t?.op !== "lit") return str2("partial");
18574
18747
  const sv = t.value;
18575
- if (typeof sv === "number") {
18576
- space = Number.isFinite(sv) ? Math.min(10, Math.max(0, Math.floor(sv))) : 0;
18577
- } else if (typeof sv === "string") {
18748
+ if (typeof sv === "number" || typeof sv === "string") {
18578
18749
  space = sv;
18579
18750
  } else if (sv !== void 0 && sv !== null) {
18580
18751
  return str2("partial");
@@ -18594,6 +18765,7 @@ var init_json = __esm({
18594
18765
  "../core/src/algebra/builtins/json.ts"() {
18595
18766
  "use strict";
18596
18767
  init_abs();
18768
+ init_objects();
18597
18769
  init_hof();
18598
18770
  init_nudo_throw();
18599
18771
  init_may_throw();
@@ -19439,7 +19611,12 @@ function evalArrayStatic(name, args) {
19439
19611
  return boolLit(false);
19440
19612
  }
19441
19613
  case "of":
19442
- return abs({ k: "arr", element: a0 ?? unknown }, void 0, void 0, "path");
19614
+ return abs(
19615
+ { k: "tuple", elements: args.map((a) => asAbs(a) ?? unknown) },
19616
+ void 0,
19617
+ void 0,
19618
+ "exact"
19619
+ );
19443
19620
  case "from": {
19444
19621
  const mapFn = args[1];
19445
19622
  const hasMapFn = mapFn !== void 0 && mapFn !== null;
@@ -20134,6 +20311,37 @@ function evalBuiltinNew(className, args) {
20134
20311
  return evalPromiseCtor(args);
20135
20312
  case "Array":
20136
20313
  return makeArrayCtorAbs(args);
20314
+ case "Number":
20315
+ case "Boolean":
20316
+ return abs(
20317
+ { k: "brand", name: className, shape: objOf({}) },
20318
+ void 0,
20319
+ void 0,
20320
+ "path"
20321
+ );
20322
+ case "String": {
20323
+ const a0 = args[0] ? litValue(args[0]) : void 0;
20324
+ if (typeof a0 === "string") {
20325
+ const slots = {
20326
+ length: { value: numLit(a0.length) }
20327
+ };
20328
+ for (let i = 0; i < a0.length; i++) {
20329
+ slots[String(i)] = { value: strLit(a0[i]) };
20330
+ }
20331
+ return abs(
20332
+ { k: "brand", name: "String", shape: objOf(slots) },
20333
+ void 0,
20334
+ void 0,
20335
+ "exact"
20336
+ );
20337
+ }
20338
+ return abs(
20339
+ { k: "brand", name: "String", shape: objOf({}, { open: true }) },
20340
+ void 0,
20341
+ void 0,
20342
+ "path"
20343
+ );
20344
+ }
20137
20345
  case "Map":
20138
20346
  if (ctorArgDefinitelyInvalid("Map", args[0])) {
20139
20347
  throw new NudoThrow(errorTypeAbs("TypeError"));
@@ -20409,6 +20617,7 @@ function evalObjectProtoMethod(name, thisVal, args) {
20409
20617
  if (!vObjLike && vk !== "sum" && vk !== "any" && vk !== "unknown") return boolLit(false);
20410
20618
  if (vObjLike && isNullProtoObj(v2)) return boolLit(false);
20411
20619
  if (isObjectProtoBrand(thisVal)) {
20620
+ if (isObjectProtoBrand(v2)) return boolLit(false);
20412
20621
  return vObjLike ? boolLit(true) : boolPrimB();
20413
20622
  }
20414
20623
  return boolPrimB();
@@ -20479,27 +20688,50 @@ var init_builtins = __esm({
20479
20688
  function coercibleNumberLit(v2) {
20480
20689
  return typeof v2 === "number" || typeof v2 === "string" || typeof v2 === "boolean" || v2 === null;
20481
20690
  }
20482
- function unknownPartial() {
20483
- return abs({ k: "unknown" }, void 0, void 0, "partial");
20691
+ function isKnownNonBigintNumeric2(a) {
20692
+ const va = litValue(a);
20693
+ if (typeof va === "number" || typeof va === "boolean" || va === null) return true;
20694
+ if (a.term?.op === "lit" && a.term.value === void 0) return true;
20695
+ return a.shape.k === "prim" && (a.shape.type === "number" || a.shape.type === "boolean");
20696
+ }
20697
+ function isMaybeBigintOperand2(a) {
20698
+ return a.shape.k === "any" || a.shape.k === "unknown" || a.shape.k === "obj" || a.shape.k === "fn" || a.shape.k === "brand" || a.shape.k === "sum";
20484
20699
  }
20485
20700
  function foldNumericBinOp(a, b, numOp, bigOp) {
20486
20701
  const va = litValue(a);
20487
20702
  const vb = litValue(b);
20703
+ if (!bigOp && (typeof va === "bigint" || typeof vb === "bigint" || isBigPrim(a) || isBigPrim(b))) {
20704
+ throw new NudoThrow(errorTypeAbs("TypeError"));
20705
+ }
20488
20706
  if (typeof va === "bigint" || typeof vb === "bigint") {
20489
20707
  if (typeof va === "bigint" && typeof vb === "bigint") {
20490
- if (!bigOp) return unknownPartial();
20708
+ const op = bigOp;
20491
20709
  try {
20492
20710
  return abs(
20493
20711
  { k: "prim", type: "bigint" },
20494
- lit(bigOp(va, vb)),
20712
+ lit(op(va, vb)),
20495
20713
  pTrue,
20496
20714
  "exact"
20497
20715
  );
20498
- } catch {
20499
- return unknownPartial();
20716
+ } catch (e) {
20717
+ if (e instanceof RangeError) throw new NudoThrow(errorTypeAbs("RangeError"));
20718
+ throw new NudoThrow(errorTypeAbs("TypeError"));
20500
20719
  }
20501
20720
  }
20502
- return unknownPartial();
20721
+ const other = typeof va === "bigint" ? b : a;
20722
+ if (isBigPrim(other)) return void 0;
20723
+ if (!bigOp) throw new NudoThrow(errorTypeAbs("TypeError"));
20724
+ if (isKnownNonBigintNumeric2(other) || isStrPrim(other)) {
20725
+ throw new NudoThrow(errorTypeAbs("TypeError"));
20726
+ }
20727
+ if (isMaybeBigintOperand2(other)) {
20728
+ recordMayThrow({
20729
+ kind: "TypeError",
20730
+ cause: "mixed bigint \u2297 abstract operand"
20731
+ });
20732
+ return void 0;
20733
+ }
20734
+ throw new NudoThrow(errorTypeAbs("TypeError"));
20503
20735
  }
20504
20736
  if (coercibleNumberLit(va) && coercibleNumberLit(vb)) {
20505
20737
  return abs(
@@ -20514,11 +20746,12 @@ function foldNumericBinOp(a, b, numOp, bigOp) {
20514
20746
  function foldNumericUnOp(a, numOp, bigOp) {
20515
20747
  const v2 = litValue(a);
20516
20748
  if (typeof v2 === "bigint") {
20517
- if (!bigOp) return unknownPartial();
20749
+ if (!bigOp) throw new NudoThrow(errorTypeAbs("TypeError"));
20518
20750
  try {
20519
20751
  return abs({ k: "prim", type: "bigint" }, lit(bigOp(v2)), pTrue, "exact");
20520
- } catch {
20521
- return unknownPartial();
20752
+ } catch (e) {
20753
+ if (e instanceof RangeError) throw new NudoThrow(errorTypeAbs("RangeError"));
20754
+ throw new NudoThrow(errorTypeAbs("TypeError"));
20522
20755
  }
20523
20756
  }
20524
20757
  if (coercibleNumberLit(v2)) {
@@ -20571,10 +20804,65 @@ function ushrAbs(a, b) {
20571
20804
  function powAbs(a, b) {
20572
20805
  return foldNumericBinOp(a, b, (x, y) => x ** y, (x, y) => x ** y) ?? bitwiseResultShape(a, b);
20573
20806
  }
20807
+ function toNumericAbs(a) {
20808
+ const v2 = litValue(a);
20809
+ if (typeof v2 === "bigint") return bigintLit(v2);
20810
+ if (isBigPrim(a)) return a;
20811
+ if (a.term?.op === "lit" && a.term.value === void 0) {
20812
+ return abs({ k: "prim", type: "number" }, lit(NaN), pTrue, "exact");
20813
+ }
20814
+ const n = toNumberAbs(a);
20815
+ if (n.shape.k === "unknown") {
20816
+ return abs({ k: "prim", type: "number" }, void 0, void 0, "partial");
20817
+ }
20818
+ return n;
20819
+ }
20820
+ function updateAddAbs(a) {
20821
+ const n = toNumericAbs(a);
20822
+ const one = n.shape.k === "prim" && n.shape.type === "bigint" ? bigintLit(1n) : numLit(1);
20823
+ if (n.shape.k === "prim" && n.shape.type === "bigint" && !n.term) {
20824
+ return abs({ k: "prim", type: "bigint" }, void 0, void 0, confJoin(n.conf, "exact"));
20825
+ }
20826
+ return addNumeric(n, one);
20827
+ }
20828
+ function updateSubAbs(a) {
20829
+ const n = toNumericAbs(a);
20830
+ const one = n.shape.k === "prim" && n.shape.type === "bigint" ? bigintLit(1n) : numLit(1);
20831
+ if (n.shape.k === "prim" && n.shape.type === "bigint" && !n.term) {
20832
+ return abs({ k: "prim", type: "bigint" }, void 0, void 0, confJoin(n.conf, "exact"));
20833
+ }
20834
+ return subNumeric(n, one);
20835
+ }
20836
+ function addNumeric(a, b) {
20837
+ const va = litValue(a);
20838
+ const vb = litValue(b);
20839
+ if (typeof va === "bigint" && typeof vb === "bigint") return bigintLit(va + vb);
20840
+ if (typeof va === "number" && typeof vb === "number") return numLit(va + vb);
20841
+ const big = a.shape.k === "prim" && a.shape.type === "bigint" || typeof va === "bigint";
20842
+ return abs(
20843
+ { k: "prim", type: big ? "bigint" : "number" },
20844
+ void 0,
20845
+ void 0,
20846
+ confJoin(confJoin(a.conf, b.conf), "path")
20847
+ );
20848
+ }
20849
+ function subNumeric(a, b) {
20850
+ const va = litValue(a);
20851
+ const vb = litValue(b);
20852
+ if (typeof va === "bigint" && typeof vb === "bigint") return bigintLit(va - vb);
20853
+ if (typeof va === "number" && typeof vb === "number") return numLit(va - vb);
20854
+ const big = a.shape.k === "prim" && a.shape.type === "bigint" || typeof va === "bigint";
20855
+ return abs(
20856
+ { k: "prim", type: big ? "bigint" : "number" },
20857
+ void 0,
20858
+ void 0,
20859
+ confJoin(confJoin(a.conf, b.conf), "path")
20860
+ );
20861
+ }
20574
20862
  function toNumberAbs(a) {
20575
20863
  const v2 = litValue(a);
20576
- if (typeof v2 === "bigint") {
20577
- return abs({ k: "unknown" }, void 0, void 0, "partial");
20864
+ if (typeof v2 === "bigint" || isBigPrim(a)) {
20865
+ throw new NudoThrow(errorTypeAbs("TypeError"));
20578
20866
  }
20579
20867
  if (coercibleNumberLit(v2)) {
20580
20868
  return abs({ k: "prim", type: "number" }, lit(Number(v2)), pTrue, "exact");
@@ -20749,8 +21037,8 @@ function strictEqAbs(a, b) {
20749
21037
  if (an !== void 0 && bn !== void 0) return an === bn;
20750
21038
  }
20751
21039
  const aIsAbs = !!(a && typeof a === "object" && "shape" in a);
20752
- const bIsAbs = !!(b && typeof b === "object" && "shape" in b);
20753
- if (!aIsAbs || !bIsAbs) {
21040
+ const evalIsAbs = !!(b && typeof b === "object" && "shape" in b);
21041
+ if (!aIsAbs || !evalIsAbs) {
20754
21042
  return a === b ? true : void 0;
20755
21043
  }
20756
21044
  if (a.term?.op === "lit" && b.term?.op === "lit") {
@@ -20776,8 +21064,8 @@ function strictEqAbs(a, b) {
20776
21064
  const vb = litValue(b);
20777
21065
  if (va !== void 0 && vb !== void 0) return va === vb;
20778
21066
  const aNullish = va === null || a.term?.op === "lit" && a.term.value === void 0;
20779
- const bNullish = vb === null || b.term?.op === "lit" && b.term.value === void 0;
20780
- if (bNullish && definitelyNotNullishShape(a.shape)) return false;
21067
+ const evalNullish = vb === null || b.term?.op === "lit" && b.term.value === void 0;
21068
+ if (evalNullish && definitelyNotNullishShape(a.shape)) return false;
20781
21069
  if (aNullish && definitelyNotNullishShape(b.shape)) return false;
20782
21070
  if (a.term && b.term && a.term.op === "var" && b.term.op === "var" && a.term.id === b.term.id) {
20783
21071
  const k = a.shape.k;
@@ -20838,6 +21126,8 @@ var init_surface = __esm({
20838
21126
  init_symbol_id();
20839
21127
  init_term();
20840
21128
  init_pred();
21129
+ init_nudo_throw();
21130
+ init_may_throw();
20841
21131
  }
20842
21132
  });
20843
21133
 
@@ -20866,6 +21156,18 @@ function isFoldableIndexArg(x) {
20866
21156
  const v2 = x.term.value;
20867
21157
  return v2 === void 0 || typeof v2 === "number" || typeof v2 === "string" || typeof v2 === "boolean" || v2 === null;
20868
21158
  }
21159
+ function toIntegerOrInfinityLit(x) {
21160
+ if (x === void 0) return 0;
21161
+ if (x.term?.op !== "lit") return void 0;
21162
+ const v2 = x.term.value;
21163
+ if (typeof v2 === "symbol" || typeof v2 === "bigint") return void 0;
21164
+ if (v2 === void 0) return 0;
21165
+ const n = Number(v2);
21166
+ if (Number.isNaN(n)) return 0;
21167
+ if (n === Infinity) return Infinity;
21168
+ if (n === -Infinity) return -Infinity;
21169
+ return Math.trunc(n);
21170
+ }
20869
21171
  function toStringArg(x) {
20870
21172
  if (x === void 0) return "undefined";
20871
21173
  if (x.term?.op !== "lit") return void 0;
@@ -20876,6 +21178,14 @@ function toStringArg(x) {
20876
21178
  function isUndefinedArg(x) {
20877
21179
  return x === void 0 || x.term?.op === "lit" && x.term.value === void 0;
20878
21180
  }
21181
+ function toUint32Limit(v2) {
21182
+ if (typeof v2 === "bigint" || typeof v2 === "symbol") return void 0;
21183
+ const n = Number(v2);
21184
+ if (!Number.isFinite(n) || n === 0) return 0;
21185
+ const int = Math.trunc(n);
21186
+ const mod2 = int % 4294967296;
21187
+ return mod2 < 0 ? mod2 + 4294967296 : mod2;
21188
+ }
20879
21189
  function callAbsMethod(recv, name, args) {
20880
21190
  if (!isStrRecv(recv)) return void 0;
20881
21191
  const a0 = args[0] ? litValue(args[0]) : void 0;
@@ -20948,7 +21258,9 @@ function callAbsMethod(recv, name, args) {
20948
21258
  if (name === "slice") {
20949
21259
  return strLit(lit3.slice(a0, a1));
20950
21260
  }
20951
- return strLit(lit3.substring(Number(a0 ?? 0), Number(a1 ?? lit3.length)));
21261
+ const start = toIntegerOrInfinityLit(args[0]) ?? 0;
21262
+ const end = isUndefinedArg(args[1]) ? lit3.length : toIntegerOrInfinityLit(args[1]) ?? 0;
21263
+ return strLit(lit3.substring(start, end));
20952
21264
  }
20953
21265
  return strPrim("path");
20954
21266
  case "charAt": {
@@ -20956,6 +21268,14 @@ function callAbsMethod(recv, name, args) {
20956
21268
  if (!isFoldableIndexArg(args[0])) return strPrim("path");
20957
21269
  return strLit(lit3.charAt(Number(a0 ?? 0)));
20958
21270
  }
21271
+ case "at": {
21272
+ if (lit3 === void 0) return strPrim("path");
21273
+ const iv = toIntegerOrInfinityLit(args[0]);
21274
+ if (iv === void 0) return strPrim("path");
21275
+ const idx = iv < 0 ? lit3.length + iv : iv;
21276
+ if (idx >= 0 && idx < lit3.length) return strLit(lit3[idx]);
21277
+ return undefAbs();
21278
+ }
20959
21279
  case "toString":
20960
21280
  case "valueOf":
20961
21281
  return lit3 !== void 0 ? strLit(lit3) : strPrim("path");
@@ -20994,8 +21314,9 @@ function callAbsMethod(recv, name, args) {
20994
21314
  if (isUndefinedArg(args[0])) {
20995
21315
  const one = abs({ k: "tuple", elements: [strLit(lit3)] }, void 0, void 0, "exact");
20996
21316
  if (lim === void 0) return one;
20997
- const n = Number(lim);
20998
- if (!(n > 0)) return abs({ k: "tuple", elements: [] }, void 0, void 0, "exact");
21317
+ const n = toUint32Limit(lim);
21318
+ if (n === void 0) return strArr("path");
21319
+ if (n === 0) return abs({ k: "tuple", elements: [] }, void 0, void 0, "exact");
20999
21320
  return one;
21000
21321
  }
21001
21322
  const sep5 = toStringArg(args[0]);
@@ -21205,7 +21526,12 @@ function mergeInstanceFields(instance, fields, className) {
21205
21526
  const fieldObj = fields.shape.k === "brand" ? fields.shape.shape : fields;
21206
21527
  if (fieldObj.shape.k === "obj") {
21207
21528
  for (const [k, s] of Object.entries(fieldObj.shape.slots)) {
21208
- slots[k] = s;
21529
+ Object.defineProperty(slots, k, {
21530
+ value: s,
21531
+ enumerable: true,
21532
+ writable: true,
21533
+ configurable: true
21534
+ });
21209
21535
  }
21210
21536
  }
21211
21537
  return abs(
@@ -21364,15 +21690,23 @@ function classFromMethods(name, methods2, superClass, superShape) {
21364
21690
  const slots = {};
21365
21691
  if (superShape?.shape.k === "obj") {
21366
21692
  for (const [k, s] of Object.entries(superShape.shape.slots)) {
21367
- slots[k] = s;
21693
+ Object.defineProperty(slots, k, {
21694
+ value: s,
21695
+ enumerable: true,
21696
+ writable: true,
21697
+ configurable: true
21698
+ });
21368
21699
  }
21369
21700
  }
21370
21701
  for (const m of methods2) {
21371
21702
  methodMap.set(m.name, m);
21372
21703
  if (m.kind !== "constructor") {
21373
- slots[m.name] = {
21374
- value: abs({ k: "fn", params: m.params, name: m.name }, void 0, void 0, "exact")
21375
- };
21704
+ Object.defineProperty(slots, m.name, {
21705
+ value: abs({ k: "fn", params: m.params, name: m.name }, void 0, void 0, "exact"),
21706
+ enumerable: true,
21707
+ writable: true,
21708
+ configurable: true
21709
+ });
21376
21710
  }
21377
21711
  }
21378
21712
  return {
@@ -21452,21 +21786,21 @@ function leqAbs(src, tgt, opts = {}) {
21452
21786
  function leqWithPred(src, tgt, phi2, env2, depth) {
21453
21787
  if (depth > 32) return fail("leq depth exceeded");
21454
21788
  if (src.shape.k === "never") return ok();
21455
- if (tgt.shape.k === "any" || tgt.shape.k === "unknown") return ok();
21456
- if (src.shape.k === "any") return ok();
21457
- const sv = litValue(src);
21458
- const tv = litValue(tgt);
21459
- const sameLit = sv === tv || typeof sv === "number" && typeof tv === "number" && Number.isNaN(sv) && Number.isNaN(tv);
21460
- if (sv !== void 0 && tv !== void 0) {
21789
+ const srcLitTerm = src.term?.op === "lit" ? src.term : void 0;
21790
+ const tgtLitTerm = tgt.term?.op === "lit" ? tgt.term : void 0;
21791
+ if (tgtLitTerm && srcLitTerm) {
21792
+ const sv = srcLitTerm.value;
21793
+ const tv = tgtLitTerm.value;
21794
+ const sameLit = sv === tv || typeof sv === "number" && typeof tv === "number" && Number.isNaN(sv) && Number.isNaN(tv);
21461
21795
  if (sameLit) return ok();
21462
- if (tgt.shape.k === "prim") {
21463
- return fail(`lit ${String(sv)} \u22AD lit ${String(tv)}`);
21464
- }
21465
- } else if (tv !== void 0 && sv === void 0) {
21466
- if (tgt.shape.k === "prim") {
21467
- return fail(`non-lit prim \u22AD lit ${String(tv)}`);
21468
- }
21796
+ return fail(`lit ${String(sv)} \u22AD lit ${String(tv)}`);
21469
21797
  }
21798
+ if (tgtLitTerm && !srcLitTerm) {
21799
+ if (src.shape.k === "any") return ok();
21800
+ return fail(`non-lit \u22AD lit ${String(tgtLitTerm.value)}`);
21801
+ }
21802
+ if (tgt.shape.k === "any" || tgt.shape.k === "unknown") return ok();
21803
+ if (src.shape.k === "any") return ok();
21470
21804
  const shapeR = leqShape(src, tgt, phi2, env2, depth);
21471
21805
  if (!shapeR.ok) return shapeR;
21472
21806
  return leqPred(src, tgt, phi2, depth);
@@ -21691,12 +22025,16 @@ function formatShape(a) {
21691
22025
  case "any":
21692
22026
  return "any";
21693
22027
  case "unknown": {
21694
- if (a.term?.op === "lit" && a.term.value === void 0) return "undefined";
22028
+ if (a.term?.op === "lit") {
22029
+ if (a.term.value === void 0) return "undefined";
22030
+ if (a.term.value === null) return "null";
22031
+ }
21695
22032
  return "unknown";
21696
22033
  }
21697
22034
  case "prim": {
21698
22035
  const lv = litValue(a);
21699
22036
  if (typeof lv === "number" && !Number.isFinite(lv)) return String(lv);
22037
+ if (typeof lv === "number" && Object.is(lv, -0)) return "-0";
21700
22038
  if (typeof lv === "bigint") return `${String(lv)}n`;
21701
22039
  if (lv !== void 0) return JSON.stringify(lv);
21702
22040
  return s.type;
@@ -24250,9 +24588,9 @@ function promoteAsFn(ctx2, name, args, loc) {
24250
24588
  loc
24251
24589
  });
24252
24590
  }
24253
- function promoteCb(ctx2, cbName, method, argTerms, loc) {
24254
- if (!ctx2.params.has(cbName)) return;
24255
- const prev = ctx2.shapes.get(cbName);
24591
+ function promoteCb(ctx2, cevalName, method, argTerms, loc) {
24592
+ if (!ctx2.params.has(cevalName)) return;
24593
+ const prev = ctx2.shapes.get(cevalName);
24256
24594
  if (!prev) return;
24257
24595
  if (prev.shape.k !== "any" && prev.shape.k !== "unknown") return;
24258
24596
  let paramTypes;
@@ -24262,7 +24600,7 @@ function promoteCb(ctx2, cbName, method, argTerms, loc) {
24262
24600
  returnType = abs({ k: "prim", type: "boolean" }, void 0, void 0, "path");
24263
24601
  } else {
24264
24602
  paramTypes = argTerms.map((t) => abs({ k: "any" }, t, void 0, "path"));
24265
- returnType = abs({ k: "any" }, v(`B:${cbName}`), void 0, "path");
24603
+ returnType = abs({ k: "any" }, v(`B:${cevalName}`), void 0, "path");
24266
24604
  }
24267
24605
  const fnShape = {
24268
24606
  k: "fn",
@@ -24270,9 +24608,9 @@ function promoteCb(ctx2, cbName, method, argTerms, loc) {
24270
24608
  paramTypes,
24271
24609
  returnType
24272
24610
  };
24273
- promoteShape(ctx2, cbName, fnShape, loc, false);
24611
+ promoteShape(ctx2, cevalName, fnShape, loc, false);
24274
24612
  ctx2.sites.push({
24275
- param: cbName,
24613
+ param: cevalName,
24276
24614
  argTerms,
24277
24615
  result: returnType,
24278
24616
  loc
@@ -24494,7 +24832,12 @@ function litAbsFromJs(v2, depth = 0) {
24494
24832
  if (proto === Object.prototype || proto === null) {
24495
24833
  const slots = {};
24496
24834
  for (const [k, val] of Object.entries(v2)) {
24497
- slots[k] = { value: litAbsFromJs(val, depth + 1) };
24835
+ Object.defineProperty(slots, k, {
24836
+ value: { value: litAbsFromJs(val, depth + 1) },
24837
+ enumerable: true,
24838
+ writable: true,
24839
+ configurable: true
24840
+ });
24498
24841
  }
24499
24842
  return objOf(slots);
24500
24843
  }
@@ -24747,6 +25090,15 @@ function $pow(a, b) {
24747
25090
  function $toNumber(a) {
24748
25091
  return toNumberAbs(a);
24749
25092
  }
25093
+ function $toNumeric(a) {
25094
+ return toNumericAbs(a);
25095
+ }
25096
+ function $updateAdd(a) {
25097
+ return updateAddAbs(a);
25098
+ }
25099
+ function $updateSub(a) {
25100
+ return updateSubAbs(a);
25101
+ }
24750
25102
  function $neg(a) {
24751
25103
  return negAbs(a);
24752
25104
  }
@@ -25728,18 +26080,15 @@ function emitArrMutatorRebinds(expr, opts, pad) {
25728
26080
  }
25729
26081
  if (node.type === "UpdateExpression" && node.argument) {
25730
26082
  const arg = node.argument;
25731
- const fn2 = node.operator === "++" ? "$add" : "$sub";
25732
- const isPostfix = node.prefix !== true;
25733
- if (arg.type === "Identifier" && arg.name) {
25734
- if (isPostfix) lines.push(`${pad}${arg.name} = ${fn2}(${arg.name}, $lit(1));`);
25735
- } else if (arg.type === "MemberExpression") {
26083
+ const fn2 = node.operator === "++" ? "$updateAdd" : "$updateSub";
26084
+ if (arg.type === "MemberExpression") {
25736
26085
  const path = memberPathOf(
25737
26086
  arg,
25738
26087
  opts
25739
26088
  );
25740
26089
  if (path) {
25741
26090
  const readSrc = readPathSrc(path);
25742
- lines.push(`${pad}${path.rootSrc} = ${setPathSrc(path, `${fn2}(${readSrc}, $lit(1))`)};`);
26091
+ lines.push(`${pad}${path.rootSrc} = ${setPathSrc(path, `${fn2}(${readSrc})`)};`);
25743
26092
  }
25744
26093
  }
25745
26094
  }
@@ -26493,7 +26842,7 @@ ${pad}export default ${name};`;
26493
26842
  const stepPart = (u) => {
26494
26843
  const upd = u;
26495
26844
  if (upd.type === "UpdateExpression" && upd.argument?.type === "Identifier" && upd.argument.name) {
26496
- return `${upd.argument.name} = ${upd.operator === "++" ? "$add" : "$sub"}(${upd.argument.name}, $lit(1))`;
26845
+ return `${upd.argument.name} = ${upd.operator === "++" ? "$updateAdd" : "$updateSub"}(${upd.argument.name})`;
26497
26846
  }
26498
26847
  if (upd.type === "SequenceExpression") {
26499
26848
  return (upd.expressions ?? []).map((e) => stepPart(e)).join(", ");
@@ -27226,6 +27575,128 @@ function transpileShortCircuitExpr(opts, parts) {
27226
27575
  `})()`
27227
27576
  ].join("\n");
27228
27577
  }
27578
+ function isChainLink(n) {
27579
+ return n.type === "MemberExpression" || n.type === "OptionalMemberExpression" || n.type === "CallExpression" || n.type === "OptionalCallExpression";
27580
+ }
27581
+ function linkIsOptional(n) {
27582
+ return n.optional === true;
27583
+ }
27584
+ function chainNeedsShortCircuit(n) {
27585
+ let cur = n;
27586
+ while (isChainLink(cur)) {
27587
+ if (linkIsOptional(cur)) return true;
27588
+ cur = cur.callee ?? cur.object;
27589
+ }
27590
+ return false;
27591
+ }
27592
+ function flattenChain(expr, opts) {
27593
+ const hops = [];
27594
+ let cur = expr;
27595
+ while (isChainLink(cur)) {
27596
+ const optional = linkIsOptional(cur);
27597
+ if (cur.type === "CallExpression" || cur.type === "OptionalCallExpression") {
27598
+ const args = (cur.arguments ?? []).map(
27599
+ (a) => a.type === "SpreadElement" ? "$unknown()" : transpileExpression(a, opts)
27600
+ ).join(", ");
27601
+ const loc = cur.loc;
27602
+ const locArg = loc ? `, [${loc.start.line}, ${loc.start.column}]` : "";
27603
+ const callee = cur.callee;
27604
+ const calleeProp = callee?.property;
27605
+ const methodName = callee && (callee.type === "MemberExpression" || callee.type === "OptionalMemberExpression") ? !callee.computed && calleeProp?.type === "Identifier" ? calleeProp.name : callee.computed && calleeProp?.type === "StringLiteral" ? String(calleeProp.value) : void 0 : void 0;
27606
+ if (callee && methodName !== void 0) {
27607
+ const recvNode = callee.object;
27608
+ hops.unshift({
27609
+ kind: "invoke",
27610
+ method: JSON.stringify(methodName),
27611
+ argsSrc: `[${args}]`,
27612
+ locArg,
27613
+ recvOptional: linkIsOptional(callee),
27614
+ fnOptional: linkIsOptional(cur),
27615
+ recvName: recvNode?.type === "Identifier" && recvNode.name ? recvNode.name : void 0
27616
+ });
27617
+ cur = callee.object;
27618
+ continue;
27619
+ }
27620
+ hops.unshift({ kind: "call", argsSrc: `[${args}]`, optional: linkIsOptional(cur), locArg });
27621
+ cur = cur.callee ?? cur.object;
27622
+ continue;
27623
+ }
27624
+ const optionalM = optional;
27625
+ if (cur.computed) {
27626
+ const key = cur.property;
27627
+ if (key?.type === "StringLiteral") {
27628
+ hops.unshift({ kind: "get", key: JSON.stringify(key.value), optional: optionalM });
27629
+ } else if (key?.type === "NumericLiteral") {
27630
+ hops.unshift({ kind: "idx", keySrc: `$lit(${key.value})`, optional: optionalM });
27631
+ } else if (isExpression(cur.property)) {
27632
+ hops.unshift({
27633
+ kind: "idx",
27634
+ keySrc: transpileExpression(cur.property, opts),
27635
+ optional: optionalM
27636
+ });
27637
+ } else {
27638
+ return void 0;
27639
+ }
27640
+ cur = cur.object;
27641
+ continue;
27642
+ }
27643
+ const prop = cur.property;
27644
+ if (prop?.type !== "Identifier") return void 0;
27645
+ if (prop.name === "length") {
27646
+ hops.unshift({ kind: "len", optional: optionalM });
27647
+ } else {
27648
+ hops.unshift({ kind: "get", key: JSON.stringify(prop.name), optional: optionalM });
27649
+ }
27650
+ cur = cur.object;
27651
+ }
27652
+ if (cur.type === "Super") return void 0;
27653
+ const baseSrc = isExpression(cur) ? transpileExpression(cur, opts) : void 0;
27654
+ if (baseSrc === void 0) return void 0;
27655
+ return { baseSrc, hops };
27656
+ }
27657
+ function emitChainFrom(hops, i, valSrc) {
27658
+ if (i >= hops.length) return valSrc;
27659
+ const hop = hops[i];
27660
+ const rest = (recv) => emitChainFrom(hops, i + 1, recv);
27661
+ switch (hop.kind) {
27662
+ case "get":
27663
+ return hop.optional ? shortCircuitHop(valSrc, `$get($__oc, ${hop.key})`, hops, i) : rest(`$get(${valSrc}, ${hop.key})`);
27664
+ case "idx":
27665
+ return hop.optional ? shortCircuitHop(valSrc, `$idx($__oc, ${hop.keySrc})`, hops, i) : rest(`$idx(${valSrc}, ${hop.keySrc})`);
27666
+ case "len":
27667
+ return hop.optional ? shortCircuitHop(valSrc, `$len($__oc)`, hops, i) : rest(`$len(${valSrc})`);
27668
+ case "call":
27669
+ return hop.optional ? shortCircuitHop(valSrc, `$callNamed("call", $__oc, ${hop.argsSrc}${hop.locArg})`, hops, i) : rest(`$callNamed("call", ${valSrc}, ${hop.argsSrc}${hop.locArg})`);
27670
+ case "invoke": {
27671
+ const invokeOf = (recv, fnCheck) => {
27672
+ let call = `$invoke(${recv}, ${hop.method}, ${hop.argsSrc}${hop.locArg})`;
27673
+ const rawMethod = JSON.parse(hop.method);
27674
+ if (hop.recvName && REGEX_STATEFUL_NAMES.has(rawMethod)) {
27675
+ call = `(() => { const __v = ${call}; ${hop.recvName} = $reStateCall(${hop.recvName}, ${hop.method}, ${hop.argsSrc}); return __v; })()`;
27676
+ }
27677
+ if (!fnCheck) return call;
27678
+ return `(($__fn) => $fork($nullishTest($__fn), () => $lit(undefined), () => ${call}))($get(${recv}, ${hop.method}))`;
27679
+ };
27680
+ if (hop.recvOptional) {
27681
+ return shortCircuitHop(valSrc, invokeOf("$__oc", hop.fnOptional), hops, i);
27682
+ }
27683
+ return rest(invokeOf(valSrc, hop.fnOptional));
27684
+ }
27685
+ }
27686
+ }
27687
+ function shortCircuitHop(valSrc, appliedWithOc, hops, i) {
27688
+ return `(($__oc) => $fork($nullishTest($__oc), () => $lit(undefined), () => ${emitChainFrom(hops, i + 1, appliedWithOc)}))(${valSrc})`;
27689
+ }
27690
+ function tryTranspileOptionalChain(expr, opts) {
27691
+ const t = expr.type;
27692
+ if (t !== "MemberExpression" && t !== "OptionalMemberExpression" && t !== "CallExpression" && t !== "OptionalCallExpression") {
27693
+ return void 0;
27694
+ }
27695
+ if (!chainNeedsShortCircuit(expr)) return void 0;
27696
+ const flat = flattenChain(expr, opts);
27697
+ if (!flat) return void 0;
27698
+ return emitChainFrom(flat.hops, 0, flat.baseSrc);
27699
+ }
27229
27700
  function transpileExpression(expr, opts = {}) {
27230
27701
  const rep = matchReplacement(expr, opts);
27231
27702
  if (rep) return rep;
@@ -27233,6 +27704,8 @@ function transpileExpression(expr, opts = {}) {
27233
27704
  if (anyExpr.type === "ChainExpression" && anyExpr.expression) {
27234
27705
  return transpileExpression(anyExpr.expression, opts);
27235
27706
  }
27707
+ const chainSrc = tryTranspileOptionalChain(expr, opts);
27708
+ if (chainSrc !== void 0) return chainSrc;
27236
27709
  if (anyExpr.type === "Super") {
27237
27710
  return `/* super */`;
27238
27711
  }
@@ -27353,18 +27826,18 @@ function transpileExpression(expr, opts = {}) {
27353
27826
  }
27354
27827
  case "UpdateExpression": {
27355
27828
  const arg = expr.argument;
27356
- const fn2 = expr.operator === "++" ? "$add" : "$sub";
27829
+ const fn2 = expr.operator === "++" ? "$updateAdd" : "$updateSub";
27357
27830
  if (arg.type === "Identifier") {
27358
- if (expr.prefix) return `${arg.name} = ${fn2}(${arg.name}, $lit(1))`;
27359
- return arg.name;
27831
+ if (expr.prefix) return `${arg.name} = ${fn2}(${arg.name})`;
27832
+ return `((__old) => (${arg.name} = ${fn2}(__old), __old))($toNumeric(${arg.name}))`;
27360
27833
  }
27361
27834
  if (arg.type === "MemberExpression") {
27362
27835
  const m = arg;
27363
27836
  const path = memberPathOf(m, opts);
27364
27837
  if (path) {
27365
27838
  const readSrc = readPathSrc(path);
27366
- if (expr.prefix) return `${fn2}(${readSrc}, $lit(1))`;
27367
- return readSrc;
27839
+ if (expr.prefix) return `${fn2}(${readSrc})`;
27840
+ return `$toNumeric(${readSrc})`;
27368
27841
  }
27369
27842
  }
27370
27843
  return `/* update ${expr.operator} */ $lit(undefined)`;
@@ -27398,6 +27871,7 @@ function transpileExpression(expr, opts = {}) {
27398
27871
  let acc = null;
27399
27872
  const props = [];
27400
27873
  const accRegs = [];
27874
+ let protoSet = null;
27401
27875
  const flushProps = () => {
27402
27876
  if (props.length === 0) return;
27403
27877
  const obj2 = `$obj({ ${props.join(", ")} })`;
@@ -27419,6 +27893,7 @@ function transpileExpression(expr, opts = {}) {
27419
27893
  return symbolKeyOf(prop.key);
27420
27894
  })();
27421
27895
  if (mkey === null) continue;
27896
+ const isProtoKey = mkey === '"__proto__"';
27422
27897
  const displayNames = paramDisplayNames(prop.params);
27423
27898
  const bindNames = methodBindNames(prop.params);
27424
27899
  const mHasArgs = fnBodyHasOwnArguments({ body: prop.body });
@@ -27430,7 +27905,12 @@ function transpileExpression(expr, opts = {}) {
27430
27905
  argsBinding: mHasArgs ? "__nudoArgs" : void 0
27431
27906
  };
27432
27907
  if (prop.kind === "get" || prop.kind === "set") {
27433
- props.push(`${mkey}: $lit(undefined)`);
27908
+ const slotSrc = `${mkey}: $lit(undefined)`;
27909
+ if (isProtoKey) {
27910
+ acc = `$setKey(${acc ?? "$obj({})"}, $lit("__proto__"), $lit(undefined))`;
27911
+ } else {
27912
+ props.push(slotSrc);
27913
+ }
27434
27914
  if (prop.kind === "get") {
27435
27915
  const bodySrc2 = `{
27436
27916
  ${emitFnBlockBody(prop.body, 1, methodOpts)}
@@ -27463,7 +27943,11 @@ return __this;
27463
27943
  ${mBodyInner}
27464
27944
  }`;
27465
27945
  const fnValSrc = `$fnVal([${displayNames.map((p) => JSON.stringify(p)).join(", ")}], (${mParams.join(", ")}) => ${bodySrc}, { bindThis: true })`;
27466
- props.push(`${mkey}: ${fnValSrc}`);
27946
+ if (isProtoKey) {
27947
+ acc = `$setKey(${acc ?? "$obj({})"}, $lit("__proto__"), ${fnValSrc})`;
27948
+ } else {
27949
+ props.push(`${mkey}: ${fnValSrc}`);
27950
+ }
27467
27951
  continue;
27468
27952
  }
27469
27953
  if (prop.type !== "ObjectProperty") continue;
@@ -27485,6 +27969,10 @@ ${mBodyInner}
27485
27969
  return k === null ? null : JSON.stringify(k);
27486
27970
  })();
27487
27971
  if (key === null) continue;
27972
+ if (!prop.computed && key === '"__proto__"') {
27973
+ protoSet = transpileExpression(prop.value, opts);
27974
+ continue;
27975
+ }
27488
27976
  if (prop.value.type === "FunctionExpression" && !prop.value.async) {
27489
27977
  const fn2 = prop.value;
27490
27978
  if (!fn2.generator) {
@@ -27525,6 +28013,7 @@ ${mBodyInner}
27525
28013
  for (const r of accRegs) {
27526
28014
  result = `$objAccessor(${result}, ${r.key}, ${r.get ?? "null"}, ${r.set ?? "null"})`;
27527
28015
  }
28016
+ if (protoSet !== null) result = `$setProto(${result}, ${protoSet})`;
27528
28017
  return result;
27529
28018
  }
27530
28019
  case "MemberExpression":
@@ -27875,13 +28364,13 @@ function transpileSource(source, opts = {}) {
27875
28364
  return transpileFile(file, { ...opts, source: opts.source ?? source });
27876
28365
  }
27877
28366
  function runtimeImportOf(runtime) {
27878
- return `import { $add, $sub, $mul, $div, $mod, $bitand, $bitor, $bitxor, $bitnot, $shl, $shr, $ushr, $pow, $toNumber, $in, $instanceof, $instanceofNonIdent, $classExpr, $del, $delRes, $objAccessor, $neg, $typeof, $not, $eq, $ne, $eqLoose, $neLoose, $lt, $le, $gt, $ge, $join, $lit, $fork, $for, $forIter, $obj, $get, $set, $while, $whileSeq, $arr, $arrWithHoles, $arrMutContainer, $idx, $idxSet, $len, $call, $throw, $loopReturn, $loopBreak, $loopContinue, $class, $new, $invoke, $invokeSuper, $super, $async, $copy, $await, $asyncReturn, $orDefault, $callNamed, $optionalGet, $optionalInvoke, $spread, $concat, $forOf, $forInKeys, $catchVal, $switch, $staticInvoke, $setKey, $gen, $yield, $fnVal, $regex, $reStateCall, $rethrowIfNudoReturn, $nullishTest, $tryMark, $assignRecord, $recordBinding, $unknown, $importMeta, $dynamicImport, $tryTakeSince, $tryCurrentMark, $tryPopMark, $tryDigestSoftCatch, $tryReleaseSoftOut, $tryDetachSoftCatch, $tryDiscardSoft, $tryOrphanSoft, $pushLoopExit, $objRest, $arrRest, $arguments, $isForkExit, $rawThis, $isBreakTo } from ${JSON.stringify(runtime)};`;
28367
+ return `import { $add, $sub, $mul, $div, $mod, $bitand, $bitor, $bitxor, $bitnot, $shl, $shr, $ushr, $pow, $toNumber, $toNumeric, $updateAdd, $updateSub, $in, $instanceof, $instanceofNonIdent, $classExpr, $del, $delRes, $objAccessor, $neg, $typeof, $not, $eq, $ne, $eqLoose, $neLoose, $lt, $le, $gt, $ge, $join, $lit, $fork, $for, $forIter, $obj, $get, $set, $setProto, $while, $whileSeq, $arr, $arrWithHoles, $arrMutContainer, $idx, $idxSet, $len, $call, $throw, $loopReturn, $loopBreak, $loopContinue, $class, $new, $invoke, $invokeSuper, $super, $async, $copy, $await, $asyncReturn, $orDefault, $callNamed, $optionalGet, $optionalInvoke, $spread, $concat, $forOf, $forInKeys, $catchVal, $switch, $staticInvoke, $setKey, $gen, $yield, $fnVal, $regex, $reStateCall, $rethrowIfNudoReturn, $nullishTest, $tryMark, $assignRecord, $recordBinding, $unknown, $importMeta, $dynamicImport, $tryTakeSince, $tryCurrentMark, $tryPopMark, $tryDigestSoftCatch, $tryReleaseSoftOut, $tryDetachSoftCatch, $tryDiscardSoft, $tryOrphanSoft, $pushLoopExit, $objRest, $arrRest, $arguments, $isForkExit, $rawThis, $isBreakTo } from ${JSON.stringify(runtime)};`;
27879
28368
  }
27880
28369
  function transpileFile(file, opts = {}) {
27881
28370
  const runtime = opts.runtimeImport ?? "@nudojs/core/exec";
27882
28371
  const lines = [
27883
- `// nudo B-path transpile \u2014 values are Abs; operators are overloaded calls`,
27884
- `import { $add, $sub, $mul, $div, $mod, $bitand, $bitor, $bitxor, $bitnot, $shl, $shr, $ushr, $pow, $toNumber, $in, $instanceof, $instanceofNonIdent, $classExpr, $del, $delRes, $objAccessor, $neg, $typeof, $not, $eq, $ne, $eqLoose, $neLoose, $lt, $le, $gt, $ge, $join, $lit, $fork, $for, $forIter, $obj, $get, $set, $while, $whileSeq, $arr, $arrWithHoles, $arrMutContainer, $idx, $idxSet, $len, $call, $throw, $loopReturn, $loopBreak, $loopContinue, $class, $new, $invoke, $invokeSuper, $super, $async, $copy, $await, $asyncReturn, $orDefault, $callNamed, $optionalGet, $optionalInvoke, $spread, $concat, $forOf, $forInKeys, $catchVal, $switch, $staticInvoke, $setKey, $gen, $yield, $fnVal, $regex, $reStateCall, $rethrowIfNudoReturn, $nullishTest, $tryMark, $assignRecord, $recordBinding, $unknown, $importMeta, $dynamicImport, $tryTakeSince, $tryCurrentMark, $tryPopMark, $tryDigestSoftCatch, $tryReleaseSoftOut, $tryDetachSoftCatch, $tryDiscardSoft, $tryOrphanSoft, $pushLoopExit, $objRest, $arrRest, $arguments, $isForkExit, $rawThis, $isBreakTo } from ${JSON.stringify(runtime)};`,
28372
+ `// nudo evaluator transpile \u2014 values are Abs; operators are overloaded calls`,
28373
+ `import { $add, $sub, $mul, $div, $mod, $bitand, $bitor, $bitxor, $bitnot, $shl, $shr, $ushr, $pow, $toNumber, $toNumeric, $updateAdd, $updateSub, $in, $instanceof, $instanceofNonIdent, $classExpr, $del, $delRes, $objAccessor, $neg, $typeof, $not, $eq, $ne, $eqLoose, $neLoose, $lt, $le, $gt, $ge, $join, $lit, $fork, $for, $forIter, $obj, $get, $set, $setProto, $while, $whileSeq, $arr, $arrWithHoles, $arrMutContainer, $idx, $idxSet, $len, $call, $throw, $loopReturn, $loopBreak, $loopContinue, $class, $new, $invoke, $invokeSuper, $super, $async, $copy, $await, $asyncReturn, $orDefault, $callNamed, $optionalGet, $optionalInvoke, $spread, $concat, $forOf, $forInKeys, $catchVal, $switch, $staticInvoke, $setKey, $gen, $yield, $fnVal, $regex, $reStateCall, $rethrowIfNudoReturn, $nullishTest, $tryMark, $assignRecord, $recordBinding, $unknown, $importMeta, $dynamicImport, $tryTakeSince, $tryCurrentMark, $tryPopMark, $tryDigestSoftCatch, $tryReleaseSoftOut, $tryDetachSoftCatch, $tryDiscardSoft, $tryOrphanSoft, $pushLoopExit, $objRest, $arrRest, $arguments, $isForkExit, $rawThis, $isBreakTo } from ${JSON.stringify(runtime)};`,
27885
28374
  ``
27886
28375
  ];
27887
28376
  for (const stmt of file.program.body) {
@@ -28023,7 +28512,7 @@ function compiledBodyOf(impl) {
28023
28512
  runner = (args) => bodyFn(...args);
28024
28513
  compiledByImpl.set(implKey, runner);
28025
28514
  } catch (e) {
28026
- noteBPathFallback(e);
28515
+ noteEvalFallback(e);
28027
28516
  return void 0;
28028
28517
  }
28029
28518
  return runner;
@@ -28047,11 +28536,11 @@ function getAbsCallBudgetStats() {
28047
28536
  return {
28048
28537
  calls: _absTotalCalls,
28049
28538
  maxCalls: MAX_TOTAL_CALLS,
28050
- forks: _bForkCount,
28051
- maxForks: _bForkBudgetLimit,
28539
+ forks: _evalForkCount,
28540
+ maxForks: _evalForkBudgetLimit,
28052
28541
  callTruncated: _callTruncated,
28053
- forkTruncated: _bForkTruncNoted,
28054
- truncated: _callTruncated || _bForkTruncNoted
28542
+ forkTruncated: _evalForkTruncNoted,
28543
+ truncated: _callTruncated || _evalForkTruncNoted
28055
28544
  };
28056
28545
  }
28057
28546
  function resetAbsCallBudget() {
@@ -28059,7 +28548,7 @@ function resetAbsCallBudget() {
28059
28548
  _absTotalCalls = 0;
28060
28549
  _activeCallKeys = [];
28061
28550
  _callTruncated = false;
28062
- resetBForkBudget();
28551
+ resetEvalForkBudget();
28063
28552
  }
28064
28553
  function stableCallId(obj2) {
28065
28554
  let id = _fnCallIds.get(obj2);
@@ -28111,36 +28600,36 @@ function exitCall() {
28111
28600
  function noteHostEffectBlocked(name) {
28112
28601
  noteAbsTruncation(`${HOST_EFFECT_LABEL_PREFIX}${name}`);
28113
28602
  }
28114
- function noteBForkTruncation() {
28603
+ function noteEvalForkTruncation() {
28115
28604
  noteAbsTruncation(FORK_TRUNCATION_LABEL);
28116
28605
  }
28117
- function setBForkBudgetLimit(n) {
28606
+ function setEvalForkBudgetLimit(n) {
28118
28607
  if (typeof n === "number" && Number.isFinite(n) && n >= 1) {
28119
- _bForkBudgetLimit = Math.floor(n);
28608
+ _evalForkBudgetLimit = Math.floor(n);
28120
28609
  } else {
28121
- _bForkBudgetLimit = MAX_B_TOTAL_FORKS;
28610
+ _evalForkBudgetLimit = MAX_EVAL_TOTAL_FORKS;
28122
28611
  }
28123
- return _bForkBudgetLimit;
28612
+ return _evalForkBudgetLimit;
28124
28613
  }
28125
- function getBForkBudgetLimit() {
28126
- return _bForkBudgetLimit;
28614
+ function getEvalForkBudgetLimit() {
28615
+ return _evalForkBudgetLimit;
28127
28616
  }
28128
- function getBForkCount() {
28129
- return _bForkCount;
28617
+ function getEvalForkCount() {
28618
+ return _evalForkCount;
28130
28619
  }
28131
- function resetBForkBudget() {
28132
- _bForkCount = 0;
28133
- _bForkTruncNoted = false;
28620
+ function resetEvalForkBudget() {
28621
+ _evalForkCount = 0;
28622
+ _evalForkTruncNoted = false;
28134
28623
  }
28135
- function bumpBForkBudget() {
28136
- if (++_bForkCount <= _bForkBudgetLimit) return true;
28137
- if (!_bForkTruncNoted) {
28138
- _bForkTruncNoted = true;
28139
- noteBForkTruncation();
28624
+ function bumpEvalForkBudget() {
28625
+ if (++_evalForkCount <= _evalForkBudgetLimit) return true;
28626
+ if (!_evalForkTruncNoted) {
28627
+ _evalForkTruncNoted = true;
28628
+ noteEvalForkTruncation();
28140
28629
  }
28141
28630
  return false;
28142
28631
  }
28143
- var MAX_CALL_DEPTH, MAX_TOTAL_CALLS, _absCallDepth, _absTotalCalls, _activeCallKeys, _fnCallIds, _fnCallIdSeq, _callTruncated, absTruncCollector, MAX_B_TOTAL_FORKS, _bForkBudgetLimit, _bForkCount, _bForkTruncNoted, FORK_TRUNCATION_LABEL, HOST_EFFECT_LABEL_PREFIX;
28632
+ var MAX_CALL_DEPTH, MAX_TOTAL_CALLS, _absCallDepth, _absTotalCalls, _activeCallKeys, _fnCallIds, _fnCallIdSeq, _callTruncated, absTruncCollector, MAX_EVAL_TOTAL_FORKS, _evalForkBudgetLimit, _evalForkCount, _evalForkTruncNoted, FORK_TRUNCATION_LABEL, HOST_EFFECT_LABEL_PREFIX;
28144
28633
  var init_call_budget = __esm({
28145
28634
  "../core/src/algebra/call-budget.ts"() {
28146
28635
  "use strict";
@@ -28155,10 +28644,10 @@ var init_call_budget = __esm({
28155
28644
  _fnCallIdSeq = 0;
28156
28645
  _callTruncated = false;
28157
28646
  absTruncCollector = null;
28158
- MAX_B_TOTAL_FORKS = 5e3;
28159
- _bForkBudgetLimit = MAX_B_TOTAL_FORKS;
28160
- _bForkCount = 0;
28161
- _bForkTruncNoted = false;
28647
+ MAX_EVAL_TOTAL_FORKS = 5e3;
28648
+ _evalForkBudgetLimit = MAX_EVAL_TOTAL_FORKS;
28649
+ _evalForkCount = 0;
28650
+ _evalForkTruncNoted = false;
28162
28651
  FORK_TRUNCATION_LABEL = "#fork-budget";
28163
28652
  HOST_EFFECT_LABEL_PREFIX = "#host-effect:";
28164
28653
  }
@@ -28275,10 +28764,10 @@ var init_call = __esm({
28275
28764
  });
28276
28765
 
28277
28766
  // ../core/src/algebra/exec/class-registry.ts
28278
- function registerBClass(spec) {
28767
+ function registerEvalClass(spec) {
28279
28768
  classRegistry.set(spec.name, spec);
28280
28769
  }
28281
- function getBClass(name) {
28770
+ function getEvalClass(name) {
28282
28771
  return classRegistry.get(name);
28283
28772
  }
28284
28773
  function clearBClasses() {
@@ -28328,9 +28817,9 @@ function findClassAccessor(startName, key) {
28328
28817
  const seen = /* @__PURE__ */ new Set();
28329
28818
  while (cur && !seen.has(cur)) {
28330
28819
  seen.add(cur);
28331
- const acc = getBClass(cur)?.accessors?.[key];
28820
+ const acc = getEvalClass(cur)?.accessors?.[key];
28332
28821
  if (acc) return acc;
28333
- cur = getBClass(cur)?.superName;
28822
+ cur = getEvalClass(cur)?.superName;
28334
28823
  }
28335
28824
  return void 0;
28336
28825
  }
@@ -28339,9 +28828,9 @@ function findStaticClassAccessor(startName, key) {
28339
28828
  const seen = /* @__PURE__ */ new Set();
28340
28829
  while (cur && !seen.has(cur)) {
28341
28830
  seen.add(cur);
28342
- const acc = getBClass(cur)?.staticAccessors?.[key];
28831
+ const acc = getEvalClass(cur)?.staticAccessors?.[key];
28343
28832
  if (acc) return acc;
28344
- cur = getBClass(cur)?.superName;
28833
+ cur = getEvalClass(cur)?.superName;
28345
28834
  }
28346
28835
  return void 0;
28347
28836
  }
@@ -28352,10 +28841,11 @@ function $in(key, o) {
28352
28841
  if (o.shape.k === "prim" || o.shape.k === "never" || isNullishLitAbs(o)) {
28353
28842
  return unknown;
28354
28843
  }
28355
- const kv = key.term?.op === "lit" ? key.term.value : void 0;
28356
- if (kv === null || kv === void 0) {
28357
- return isNullishLitAbs(key) ? unknown : bool();
28844
+ const keyStr = propertyKeyOf(key);
28845
+ if (keyStr === void 0) {
28846
+ return bool();
28358
28847
  }
28848
+ const kv = keyStr;
28359
28849
  if (o.shape.k === "tuple") {
28360
28850
  if (kv === "length") return boolLit(true);
28361
28851
  const idx = canonicalArrayIndex(kv);
@@ -28366,8 +28856,6 @@ function $in(key, o) {
28366
28856
  return boolLit(false);
28367
28857
  }
28368
28858
  if (o.shape.k === "arr") return bool();
28369
- const keyStr = typeof kv === "number" ? String(kv) : typeof kv === "string" ? kv : void 0;
28370
- if (keyStr === void 0) return bool();
28371
28859
  if (o.shape.k === "obj" || o.shape.k === "brand") {
28372
28860
  const objShape = o.shape.k === "brand" ? o.shape.shape.shape.k === "obj" ? o.shape.shape.shape : void 0 : o.shape;
28373
28861
  if (!objShape) return bool();
@@ -28384,6 +28872,9 @@ function $in(key, o) {
28384
28872
  return boolLit(OBJECT_PROTO_NAMES.has(keyStr));
28385
28873
  }
28386
28874
  if (o.shape.k === "fn") {
28875
+ if (o.shape.slots && getSlot(o.shape.slots, keyStr) && !o.shape.slots[keyStr].optional) {
28876
+ return boolLit(true);
28877
+ }
28387
28878
  return boolLit(OBJECT_PROTO_NAMES.has(keyStr) || FUNCTION_PROTO_NAMES.has(keyStr));
28388
28879
  }
28389
28880
  if (o.shape.k === "eff") {
@@ -28394,8 +28885,8 @@ function $in(key, o) {
28394
28885
  return boolLit(OBJECT_PROTO_NAMES.has(keyStr));
28395
28886
  }
28396
28887
  function brandHasProtoMember(brandName, key) {
28397
- for (const name of bClassChain(brandName)) {
28398
- const spec = getBClass(name);
28888
+ for (const name of evalClassChain(brandName)) {
28889
+ const spec = getEvalClass(name);
28399
28890
  if (spec?.methods?.[key]) return true;
28400
28891
  if (spec?.accessors?.[key]) return true;
28401
28892
  const builtin = BUILTIN_BRAND_METHODS[name];
@@ -28403,12 +28894,12 @@ function brandHasProtoMember(brandName, key) {
28403
28894
  }
28404
28895
  return false;
28405
28896
  }
28406
- function bClassChain(name) {
28897
+ function evalClassChain(name) {
28407
28898
  const out = [name];
28408
28899
  let cur = name;
28409
28900
  let depth = 0;
28410
28901
  while (cur && depth++ < 32) {
28411
- const spec = getBClass(cur);
28902
+ const spec = getEvalClass(cur);
28412
28903
  const parent = spec?.superName ?? BUILTIN_ERROR_SUPER2[cur];
28413
28904
  if (!parent || out.includes(parent)) break;
28414
28905
  out.push(parent);
@@ -28439,7 +28930,7 @@ function $instanceof(left, rightName, rightVal) {
28439
28930
  return boolLit(rightName === "Function" || rightName === "Object");
28440
28931
  }
28441
28932
  return boolLit(
28442
- rightName === "Object" || bClassChain(left.shape.name).includes(rightName)
28933
+ rightName === "Object" || evalClassChain(left.shape.name).includes(rightName)
28443
28934
  );
28444
28935
  case "arr":
28445
28936
  case "tuple":
@@ -28525,7 +29016,7 @@ function $delRes(o, _key) {
28525
29016
  return bool();
28526
29017
  }
28527
29018
  function $del(o, key) {
28528
- const kv = litValue(key);
29019
+ const keyStr = propertyKeyOf(key);
28529
29020
  if (o.shape.k === "sum") {
28530
29021
  return abs(
28531
29022
  { k: "sum", members: o.shape.members.map((m) => $del(m, key)) },
@@ -28544,7 +29035,6 @@ function $del(o, key) {
28544
29035
  if (clsName) markClassValue(next, clsName);
28545
29036
  return next;
28546
29037
  }
28547
- const keyStr = typeof kv === "number" ? String(kv) : typeof kv === "string" ? kv : void 0;
28548
29038
  if (o.shape.k === "obj" && keyStr !== void 0) {
28549
29039
  if (getPropFlags(o)?.get(keyStr)?.configurable === false) throwStrictWrite();
28550
29040
  if (o.shape.open) return o;
@@ -28559,7 +29049,7 @@ function $del(o, key) {
28559
29049
  return o;
28560
29050
  }
28561
29051
  if (o.shape.k === "tuple") {
28562
- const idx = canonicalArrayIndex(kv);
29052
+ const idx = canonicalArrayIndex(keyStr);
28563
29053
  if (idx === void 0 || idx >= o.shape.elements.length) return o;
28564
29054
  o.shape.elements[idx] = $lit(void 0);
28565
29055
  if (!o.shape.holes) o.shape.holes = [];
@@ -28694,7 +29184,9 @@ function toIOI(v2) {
28694
29184
  return Math.trunc(lv);
28695
29185
  }
28696
29186
  if (typeof lv === "string" || typeof lv === "boolean") {
28697
- return Math.trunc(Number(lv));
29187
+ const n = Number(lv);
29188
+ if (Number.isNaN(n)) return 0;
29189
+ return Math.trunc(n);
28698
29190
  }
28699
29191
  return null;
28700
29192
  }
@@ -28722,7 +29214,7 @@ function copyWithinTuple(shape2, vals) {
28722
29214
  if (win) {
28723
29215
  const els = [...shape2.elements];
28724
29216
  const holesSet = new Set(origHoles);
28725
- const backwards = (s ?? 0) < (t ?? 0) && win.s + (win.e - win.s) > win.t;
29217
+ const backwards = win.s < win.t && win.s + (win.e - win.s) > win.t;
28726
29218
  const count = win.e - win.s;
28727
29219
  for (let kk = 0; kk < count; kk++) {
28728
29220
  const k = backwards ? count - 1 - kk : kk;
@@ -28822,7 +29314,7 @@ function $copy(a) {
28822
29314
  if (s.k === "obj") {
28823
29315
  const slots = {};
28824
29316
  for (const [k, v2] of Object.entries(s.slots)) {
28825
- slots[k] = { ...v2, value: $copy(v2.value) };
29317
+ setSlot(slots, k, { ...v2, value: $copy(v2.value) });
28826
29318
  }
28827
29319
  const next = objOf(slots, {
28828
29320
  index: s.index ? { key: $copy(s.index.key), value: $copy(s.index.value) } : void 0,
@@ -28962,7 +29454,8 @@ function $arrMutContainer(arr, method, args) {
28962
29454
  }
28963
29455
  function $idx(a, i) {
28964
29456
  if (a?.shape?.k === "any") return anyMemberResult();
28965
- const iv = litValue(i);
29457
+ const keyStr = propertyKeyOf(i);
29458
+ const iv = keyStr !== void 0 ? keyStr : litValue(i);
28966
29459
  const idx = iv !== void 0 ? canonicalArrayIndex(iv) : void 0;
28967
29460
  if (a.shape.k === "tuple") {
28968
29461
  const els = a.shape.elements;
@@ -28999,18 +29492,11 @@ function $idx(a, i) {
28999
29492
  }
29000
29493
  const sv = litValue(a);
29001
29494
  if (typeof sv === "string") {
29002
- if (typeof iv === "number" && Number.isInteger(iv)) {
29003
- if (iv >= 0 && iv < sv.length) {
29004
- return abs(
29005
- { k: "prim", type: "string" },
29006
- { op: "lit", value: sv[iv] },
29007
- pTrue,
29008
- "exact"
29009
- );
29010
- }
29011
- return undef();
29012
- }
29013
- return unknown;
29495
+ if (i.term?.op !== "lit") return unknown;
29496
+ const idx2 = canonicalArrayIndex(i.term.value);
29497
+ if (idx2 === void 0) return undef();
29498
+ if (idx2 < sv.length) return $lit(sv[idx2]);
29499
+ return undef();
29014
29500
  }
29015
29501
  return unknown;
29016
29502
  }
@@ -29021,20 +29507,26 @@ function widenTupleToArr(els, holes, value) {
29021
29507
  return { k: "arr", element: joined };
29022
29508
  }
29023
29509
  function $idxSet(a, i, value) {
29024
- const iv = litValue(i);
29025
- if (a.shape.k === "tuple" && typeof iv === "number" && Number.isInteger(iv) && iv >= 0) {
29510
+ const pk = propertyKeyOf(i);
29511
+ const raw = i.term?.op === "lit" ? i.term.value : litValue(i);
29512
+ let numIdx;
29513
+ if (typeof raw === "number") numIdx = raw;
29514
+ else if (typeof raw === "bigint") numIdx = Number(raw);
29515
+ else if (pk !== void 0) numIdx = canonicalArrayIndex(pk);
29516
+ const iv = pk !== void 0 ? pk : litValue(i);
29517
+ if (a.shape.k === "tuple" && numIdx !== void 0 && Number.isInteger(numIdx) && numIdx >= 0) {
29026
29518
  const st = extStateOf(a);
29027
29519
  if (st === "frozen") throwStrictWrite();
29028
- if ((st === "sealed" || st === "nonext") && iv >= a.shape.elements.length) {
29520
+ if ((st === "sealed" || st === "nonext") && numIdx >= a.shape.elements.length) {
29029
29521
  throwStrictWrite();
29030
29522
  }
29031
- if (iv >= 4294967295) {
29523
+ if (numIdx >= 4294967295) {
29032
29524
  a.shape = widenTupleToArr(a.shape.elements, a.shape.holes, value);
29033
29525
  a.conf = confJoin(a.conf, "path");
29034
29526
  clearStaleTermPred(a);
29035
29527
  return a;
29036
29528
  }
29037
- if (iv + 1 > TUPLE_MATERIALIZE_CAP) {
29529
+ if (numIdx + 1 > TUPLE_MATERIALIZE_CAP) {
29038
29530
  a.shape = widenTupleToArr(a.shape.elements, a.shape.holes, value);
29039
29531
  a.conf = confJoin(a.conf, "path");
29040
29532
  clearStaleTermPred(a);
@@ -29042,12 +29534,12 @@ function $idxSet(a, i, value) {
29042
29534
  }
29043
29535
  const els = [...a.shape.elements];
29044
29536
  const holes = [...a.shape.holes ?? []];
29045
- while (els.length < iv) {
29537
+ while (els.length < numIdx) {
29046
29538
  holes.push(els.length);
29047
29539
  els.push(undef());
29048
29540
  }
29049
- els[iv] = asAbsVal(value);
29050
- const hi = holes.indexOf(iv);
29541
+ els[numIdx] = asAbsVal(value);
29542
+ const hi = holes.indexOf(numIdx);
29051
29543
  if (hi >= 0) holes.splice(hi, 1);
29052
29544
  a.shape = { k: "tuple", elements: els, holes: holes.length > 0 ? holes : void 0 };
29053
29545
  clearStaleTermPred(a);
@@ -29070,7 +29562,7 @@ function $idxSet(a, i, value) {
29070
29562
  }
29071
29563
  if (sk === "brand") {
29072
29564
  if (iv === void 0) return a;
29073
- if (getBClass(a.shape.name)) return $set(a, String(iv), value);
29565
+ if (getEvalClass(a.shape.name)) return $set(a, String(iv), value);
29074
29566
  return a;
29075
29567
  }
29076
29568
  if (sk === "tuple") {
@@ -29111,6 +29603,9 @@ function $len(a) {
29111
29603
  "exact"
29112
29604
  );
29113
29605
  }
29606
+ if (a.shape.k === "prim" && a.shape.type === "string") {
29607
+ return abs({ k: "prim", type: "number" }, void 0, void 0, "path");
29608
+ }
29114
29609
  if (a.shape.k === "brand" && a.shape.name === "String") {
29115
29610
  const inner = a.shape.shape;
29116
29611
  if (inner.shape.k === "obj") {
@@ -29124,10 +29619,17 @@ function $len(a) {
29124
29619
  return unknown;
29125
29620
  }
29126
29621
  function $obj(slots) {
29127
- const s = {};
29128
- for (const [k, v2] of Object.entries(slots)) s[k] = { value: asAbsVal(v2) };
29622
+ const s = /* @__PURE__ */ Object.create(null);
29623
+ for (const k of Object.keys(slots)) {
29624
+ setSlot(s, k, { value: asAbsVal(slots[k]) });
29625
+ }
29129
29626
  return objOf(s);
29130
29627
  }
29628
+ function $setProto(o, proto) {
29629
+ const next = setProtoAbs(o, proto);
29630
+ if (next !== o) clearStaleTermPred(o);
29631
+ return next;
29632
+ }
29131
29633
  function $spread(a, b) {
29132
29634
  let bb = asAbsVal(b);
29133
29635
  const acc = bb && typeof bb === "object" ? accessorTable.get(bb) : void 0;
@@ -29136,7 +29638,7 @@ function $spread(a, b) {
29136
29638
  const slots = { ...bb.shape.slots };
29137
29639
  for (const [k, fn2] of acc) {
29138
29640
  if (fn2.get) {
29139
- slots[k] = { value: fn2.get(bb) };
29641
+ setSlot(slots, k, { value: fn2.get(bb) });
29140
29642
  changed = true;
29141
29643
  }
29142
29644
  }
@@ -29172,7 +29674,7 @@ function $objRest(o, keys) {
29172
29674
  let openRest = o.shape.open === true;
29173
29675
  for (const [k, s] of Object.entries(o.shape.slots)) {
29174
29676
  if (drop.has(k)) continue;
29175
- slots[k] = s;
29677
+ setSlot(slots, k, s);
29176
29678
  }
29177
29679
  if (o.shape.open) openRest = true;
29178
29680
  const shape2 = { k: "obj", slots };
@@ -29283,7 +29785,7 @@ function $forInKeys(o) {
29283
29785
  return k !== "" && String(n) === k && Number.isInteger(n) && n >= 0 && n < 4294967295;
29284
29786
  };
29285
29787
  if (shape2.k === "obj") {
29286
- const keys = Object.keys(shape2.slots);
29788
+ const keys = enumOwnKeys(o, shape2.slots);
29287
29789
  const intKeys = keys.filter(isArrayIndexKey).sort((a, b) => Number(a) - Number(b));
29288
29790
  const strKeys = keys.filter((k) => !isArrayIndexKey(k));
29289
29791
  return $arr([...intKeys, ...strKeys].map((k) => $lit(k)));
@@ -29428,8 +29930,8 @@ function $get(o, key, opts) {
29428
29930
  const sacc = findStaticClassAccessor(o.shape.name, key);
29429
29931
  if (sacc) return sacc.get ? sacc.get(o) : undef();
29430
29932
  if (findClassAccessor(o.shape.name, key)) return undef();
29431
- for (const n of bClassChain(o.shape.name)) {
29432
- const spec = getBClass(n);
29933
+ for (const n of evalClassChain(o.shape.name)) {
29934
+ const spec = getEvalClass(n);
29433
29935
  if (spec?.staticMethods?.[key]) {
29434
29936
  return absFunction(spec.staticMethodParams?.[key] ?? [], { body: noBody2 });
29435
29937
  }
@@ -29444,8 +29946,8 @@ function $get(o, key, opts) {
29444
29946
  const acc = findClassAccessor(o.shape.name, key);
29445
29947
  if (acc) return acc.get ? acc.get(o) : undef();
29446
29948
  if (findStaticClassAccessor(o.shape.name, key)) return undef();
29447
- for (const n of bClassChain(o.shape.name)) {
29448
- const spec = getBClass(n);
29949
+ for (const n of evalClassChain(o.shape.name)) {
29950
+ const spec = getEvalClass(n);
29449
29951
  if (spec?.methods?.[key]) {
29450
29952
  return absFunction(spec.methodParams?.[key] ?? [], { body: noBody2 });
29451
29953
  }
@@ -29457,6 +29959,13 @@ function $get(o, key, opts) {
29457
29959
  }
29458
29960
  return $get(inner, key, opts);
29459
29961
  }
29962
+ if (o.shape.k === "fn" && o.shape.slots) {
29963
+ const slot = getSlot(o.shape.slots, key);
29964
+ if (slot) {
29965
+ if (slot.optional) return joinAbs(slot.value, undef());
29966
+ return slot.value;
29967
+ }
29968
+ }
29460
29969
  if ((o.shape.k === "tuple" || o.shape.k === "arr") && key === "length") {
29461
29970
  return $len(o);
29462
29971
  }
@@ -29466,6 +29975,16 @@ function $get(o, key, opts) {
29466
29975
  if (idx !== void 0) return idx < els.length ? els[idx] : undef();
29467
29976
  if (!isPossiblyProtoMemberKey(key)) return undef();
29468
29977
  }
29978
+ if (o.shape.k === "prim" && o.shape.type === "string") {
29979
+ const idx = canonicalArrayIndex(key);
29980
+ const sv = litValue(o);
29981
+ if (idx !== void 0) {
29982
+ if (typeof sv === "string") return idx < sv.length ? $lit(sv[idx]) : undef();
29983
+ return abs({ k: "prim", type: "string" }, void 0, void 0, "path");
29984
+ }
29985
+ if (key === "length" && typeof sv === "string") return numLit(sv.length);
29986
+ if (!isPossiblyProtoMemberKey(key) && key !== "length") return undef();
29987
+ }
29469
29988
  if ((o.shape.k === "tuple" || o.shape.k === "arr" || o.shape.k === "prim") && (OBJECT_PROTO_METHOD_NAMES.has(key) || o.shape.k !== "prim" && ARRAY_PROTO_METHOD_NAMES.has(key)) && !(o.shape.k === "prim" && o.shape.type === "string" && key === "toString")) {
29470
29989
  if ((o.shape.k === "tuple" || o.shape.k === "arr") && (key === "toString" || key === "toLocaleString" || key === "join")) {
29471
29990
  return arrayMethodAbs(key === "join" ? "join" : key);
@@ -29571,7 +30090,7 @@ function $set(o, key, value) {
29571
30090
  throwStrictWrite();
29572
30091
  }
29573
30092
  if (getPropFlags(o)?.get(key)?.writable === false) throwStrictWrite();
29574
- inner2.shape.slots[key] = { value: asAbsVal(value) };
30093
+ setSlot(inner2.shape.slots, key, { value: asAbsVal(value) });
29575
30094
  clearStaleTermPred(o);
29576
30095
  return o;
29577
30096
  }
@@ -29666,7 +30185,10 @@ function $set(o, key, value) {
29666
30185
  if (!acc.set) throwStrictWrite();
29667
30186
  return acc.set(o, value);
29668
30187
  }
29669
- shape2.slots[key] = { value: asAbsVal(value) };
30188
+ if (key === "__proto__" && !isNullProtoObj(o)) {
30189
+ return $setProto(o, value);
30190
+ }
30191
+ setSlot(shape2.slots, key, { value: asAbsVal(value) });
29670
30192
  o.conf = confJoin(o.conf, value.conf);
29671
30193
  clearStaleTermPred(o);
29672
30194
  return o;
@@ -29793,8 +30315,8 @@ function runForkArm(arm, exits) {
29793
30315
  }
29794
30316
  function settleForkArms(a, b, exits) {
29795
30317
  const aThrow = a.kind === "throw";
29796
- const bThrow = b.kind === "throw";
29797
- if (aThrow && bThrow) {
30318
+ const evalThrow = b.kind === "throw";
30319
+ if (aThrow && evalThrow) {
29798
30320
  throw new NudoThrow(joinAbs(a.v, b.v));
29799
30321
  }
29800
30322
  const first = aThrow ? b : a;
@@ -29802,7 +30324,7 @@ function settleForkArms(a, b, exits) {
29802
30324
  if (first.kind === "ret" && second.kind === "ret") {
29803
30325
  throw new NudoReturn(joinAbs(first.v, second.v));
29804
30326
  }
29805
- if (aThrow !== bThrow) {
30327
+ if (aThrow !== evalThrow) {
29806
30328
  if (first.kind === "ret") {
29807
30329
  if (!exits) throw new NudoReturn(first.v);
29808
30330
  return undef();
@@ -29841,7 +30363,7 @@ function boundedPhi(p, q) {
29841
30363
  function $fork(test, consequent, alternate) {
29842
30364
  notePromiseExecutorFork();
29843
30365
  const testAbs = asAbsVal(test);
29844
- if (!bumpBForkBudget()) return unknown;
30366
+ if (!bumpEvalForkBudget()) return unknown;
29845
30367
  const truth = litTruth(testAbs);
29846
30368
  const p = currentExecPhi();
29847
30369
  const tCons = testAbs.pred;
@@ -30323,6 +30845,7 @@ __export(runtime_exports, {
30323
30845
  $regex: () => $regex,
30324
30846
  $rethrowIfNudoReturn: () => $rethrowIfNudoReturn,
30325
30847
  $set: () => $set,
30848
+ $setProto: () => $setProto,
30326
30849
  $shl: () => $shl,
30327
30850
  $shr: () => $shr,
30328
30851
  $spread: () => $spread,
@@ -30330,6 +30853,7 @@ __export(runtime_exports, {
30330
30853
  $switch: () => $switch,
30331
30854
  $throw: () => $throw,
30332
30855
  $toNumber: () => $toNumber,
30856
+ $toNumeric: () => $toNumeric,
30333
30857
  $tryCurrentMark: () => $tryCurrentMark,
30334
30858
  $tryDetachSoftCatch: () => $tryDetachSoftCatch,
30335
30859
  $tryDigestSoftCatch: () => $tryDigestSoftCatch,
@@ -30342,6 +30866,8 @@ __export(runtime_exports, {
30342
30866
  $tryTakeSince: () => $tryTakeSince,
30343
30867
  $typeof: () => $typeof,
30344
30868
  $unknown: () => $unknown,
30869
+ $updateAdd: () => $updateAdd,
30870
+ $updateSub: () => $updateSub,
30345
30871
  $ushr: () => $ushr,
30346
30872
  $while: () => $while,
30347
30873
  $whileSeq: () => $whileSeq,
@@ -30390,26 +30916,26 @@ __export(calls_exports, {
30390
30916
  $assignRecord: () => $assignRecord,
30391
30917
  $callNamed: () => $callNamed,
30392
30918
  $recordBinding: () => $recordBinding,
30393
- MAX_B_CALL_DEPTH: () => MAX_B_CALL_DEPTH,
30394
- MAX_B_TOTAL_CALLS: () => MAX_B_TOTAL_CALLS,
30919
+ MAX_EVAL_CALL_DEPTH: () => MAX_EVAL_CALL_DEPTH,
30920
+ MAX_EVAL_TOTAL_CALLS: () => MAX_EVAL_TOTAL_CALLS,
30395
30921
  blockHostSideEffect: () => blockHostSideEffect,
30396
- getBCallCollector: () => getBCallCollector,
30922
+ getEvalCallCollector: () => getEvalCallCollector,
30397
30923
  neverExecHostName: () => neverExecHostName,
30398
- noteBCallRecord: () => noteBCallRecord,
30399
- resetBCallBudget: () => resetBCallBudget,
30400
- setBAssignCollector: () => setBAssignCollector,
30401
- setBBindingSink: () => setBBindingSink,
30402
- setBCallCollector: () => setBCallCollector
30924
+ noteEvalCallRecord: () => noteEvalCallRecord,
30925
+ resetEvalCallBudget: () => resetEvalCallBudget,
30926
+ setEvalAssignCollector: () => setEvalAssignCollector,
30927
+ setEvalBindingSink: () => setEvalBindingSink,
30928
+ setEvalCallCollector: () => setEvalCallCollector
30403
30929
  });
30404
- function setBAssignCollector(collector2) {
30405
- const prev = bAssignCollector;
30406
- bAssignCollector = collector2;
30930
+ function setEvalAssignCollector(collector2) {
30931
+ const prev = evalAssignCollector;
30932
+ evalAssignCollector = collector2;
30407
30933
  return prev;
30408
30934
  }
30409
30935
  function $assignRecord(name, prev, next, line, column, conditional) {
30410
- if (!bAssignCollector) return;
30936
+ if (!evalAssignCollector) return;
30411
30937
  try {
30412
- bAssignCollector({
30938
+ evalAssignCollector({
30413
30939
  name,
30414
30940
  prev,
30415
30941
  next,
@@ -30420,7 +30946,7 @@ function $assignRecord(name, prev, next, line, column, conditional) {
30420
30946
  } catch {
30421
30947
  }
30422
30948
  }
30423
- function setBBindingSink(sink) {
30949
+ function setEvalBindingSink(sink) {
30424
30950
  bindingSink = sink;
30425
30951
  }
30426
30952
  function $recordBinding(name, value) {
@@ -30440,56 +30966,56 @@ function blockHostSideEffect(fn2) {
30440
30966
  noteHostEffectBlocked(hostName);
30441
30967
  return abs({ k: "unknown" }, void 0, void 0, "opaque");
30442
30968
  }
30443
- function noteBCallRecord(r) {
30444
- if (!bCallCollector) return;
30969
+ function noteEvalCallRecord(r) {
30970
+ if (!evalCallCollector) return;
30445
30971
  try {
30446
- bCallCollector(r);
30972
+ evalCallCollector(r);
30447
30973
  } catch {
30448
30974
  }
30449
30975
  }
30450
- function setBCallCollector(collector2) {
30451
- const prev = bCallCollector;
30452
- bCallCollector = collector2;
30976
+ function setEvalCallCollector(collector2) {
30977
+ const prev = evalCallCollector;
30978
+ evalCallCollector = collector2;
30453
30979
  return prev;
30454
30980
  }
30455
- function getBCallCollector() {
30456
- return bCallCollector;
30981
+ function getEvalCallCollector() {
30982
+ return evalCallCollector;
30457
30983
  }
30458
- function bStableId(obj2) {
30459
- let id = bFnCallIds.get(obj2);
30984
+ function evalStableId(obj2) {
30985
+ let id = evalFnCallIds.get(obj2);
30460
30986
  if (id === void 0) {
30461
- id = `#${++bFnCallIdSeq}`;
30462
- bFnCallIds.set(obj2, id);
30987
+ id = `#${++evalFnCallIdSeq}`;
30988
+ evalFnCallIds.set(obj2, id);
30463
30989
  }
30464
30990
  return id;
30465
30991
  }
30466
- function resetBCallBudget() {
30467
- bCallDepth = 0;
30468
- bTotalCalls = 0;
30469
- bActiveCallKeys = [];
30470
- resetBForkBudget();
30992
+ function resetEvalCallBudget() {
30993
+ evalCallDepth = 0;
30994
+ evalTotalCalls = 0;
30995
+ evalActiveCallKeys = [];
30996
+ resetEvalForkBudget();
30471
30997
  }
30472
- function bTruncatedAbs() {
30998
+ function evalTruncatedAbs() {
30473
30999
  return abs({ k: "unknown" }, void 0, void 0, "opaque");
30474
31000
  }
30475
- function bCallBudgetKey(name, fn2, args) {
30476
- const id = fn2 && typeof fn2 === "object" ? bStableId(fn2) : "prim";
31001
+ function evalCallBudgetKey(name, fn2, args) {
31002
+ const id = fn2 && typeof fn2 === "object" ? evalStableId(fn2) : "prim";
30477
31003
  return callBudgetKey(name, id, args);
30478
31004
  }
30479
- function bEnterCall(name, fn2, args) {
30480
- const key = bCallBudgetKey(name, fn2, args);
30481
- if (bActiveCallKeys.includes(key) || bCallDepth >= MAX_B_CALL_DEPTH || bTotalCalls >= MAX_B_TOTAL_CALLS) {
31005
+ function evalEnterCall(name, fn2, args) {
31006
+ const key = evalCallBudgetKey(name, fn2, args);
31007
+ if (evalActiveCallKeys.includes(key) || evalCallDepth >= MAX_EVAL_CALL_DEPTH || evalTotalCalls >= MAX_EVAL_TOTAL_CALLS) {
30482
31008
  noteAbsTruncation(name);
30483
31009
  return { ok: false };
30484
31010
  }
30485
- bActiveCallKeys.push(key);
30486
- bCallDepth++;
30487
- bTotalCalls++;
31011
+ evalActiveCallKeys.push(key);
31012
+ evalCallDepth++;
31013
+ evalTotalCalls++;
30488
31014
  return { ok: true, key };
30489
31015
  }
30490
- function bExitCall() {
30491
- bCallDepth--;
30492
- bActiveCallKeys.pop();
31016
+ function evalExitCall() {
31017
+ evalCallDepth--;
31018
+ evalActiveCallKeys.pop();
30493
31019
  }
30494
31020
  function $callNamed(name, fn2, args, loc, argLocs) {
30495
31021
  const pureName = pureFnNameOf(fn2);
@@ -30520,26 +31046,26 @@ function $callNamed(name, fn2, args, loc, argLocs) {
30520
31046
  } else if (blockedHost !== null) {
30521
31047
  result = blockedHost;
30522
31048
  } else {
30523
- const entered = bEnterCall(name, fn2, args);
31049
+ const entered = evalEnterCall(name, fn2, args);
30524
31050
  if (!entered.ok) {
30525
- result = bTruncatedAbs();
31051
+ result = evalTruncatedAbs();
30526
31052
  } else {
30527
31053
  try {
30528
31054
  result = callAtFunctionBoundary(() => fn2(...args));
30529
31055
  } finally {
30530
- bExitCall();
31056
+ evalExitCall();
30531
31057
  }
30532
31058
  }
30533
31059
  }
30534
31060
  } else if (fn2 && typeof fn2 === "object" && "shape" in fn2) {
30535
- const entered = bEnterCall(name, fn2, args);
31061
+ const entered = evalEnterCall(name, fn2, args);
30536
31062
  if (!entered.ok) {
30537
- result = bTruncatedAbs();
31063
+ result = evalTruncatedAbs();
30538
31064
  } else {
30539
31065
  try {
30540
31066
  result = $call(fn2, args);
30541
31067
  } finally {
30542
- bExitCall();
31068
+ evalExitCall();
30543
31069
  }
30544
31070
  }
30545
31071
  }
@@ -30556,9 +31082,9 @@ function $callNamed(name, fn2, args, loc, argLocs) {
30556
31082
  }
30557
31083
  m.set(pk, result);
30558
31084
  }
30559
- if (bCallCollector) {
31085
+ if (evalCallCollector) {
30560
31086
  try {
30561
- bCallCollector({
31087
+ evalCallCollector({
30562
31088
  fnName: name,
30563
31089
  args: argsSnapshot,
30564
31090
  result: threw ? unknown : result,
@@ -30571,7 +31097,7 @@ function $callNamed(name, fn2, args, loc, argLocs) {
30571
31097
  }
30572
31098
  return result;
30573
31099
  }
30574
- var pureCallMemo, bCallCollector, bAssignCollector, bindingSink, GLOBAL_FNS, NEVER_EXEC_HOST_FN_NAMES, MAX_B_CALL_DEPTH, MAX_B_TOTAL_CALLS, bCallDepth, bTotalCalls, bActiveCallKeys, bFnCallIds, bFnCallIdSeq;
31100
+ var pureCallMemo, evalCallCollector, evalAssignCollector, bindingSink, GLOBAL_FNS, NEVER_EXEC_HOST_FN_NAMES, MAX_EVAL_CALL_DEPTH, MAX_EVAL_TOTAL_CALLS, evalCallDepth, evalTotalCalls, evalActiveCallKeys, evalFnCallIds, evalFnCallIdSeq;
30575
31101
  var init_calls = __esm({
30576
31102
  "../core/src/algebra/exec/calls.ts"() {
30577
31103
  "use strict";
@@ -30583,8 +31109,8 @@ var init_calls = __esm({
30583
31109
  init_call_budget();
30584
31110
  init_member_diag();
30585
31111
  pureCallMemo = /* @__PURE__ */ new WeakMap();
30586
- bCallCollector = null;
30587
- bAssignCollector = null;
31112
+ evalCallCollector = null;
31113
+ evalAssignCollector = null;
30588
31114
  bindingSink = null;
30589
31115
  GLOBAL_FNS = /* @__PURE__ */ new Set([
30590
31116
  "parseInt",
@@ -30611,13 +31137,13 @@ var init_calls = __esm({
30611
31137
  "requestAnimationFrame",
30612
31138
  "requestIdleCallback"
30613
31139
  ];
30614
- MAX_B_CALL_DEPTH = 64;
30615
- MAX_B_TOTAL_CALLS = 2e4;
30616
- bCallDepth = 0;
30617
- bTotalCalls = 0;
30618
- bActiveCallKeys = [];
30619
- bFnCallIds = /* @__PURE__ */ new WeakMap();
30620
- bFnCallIdSeq = 0;
31140
+ MAX_EVAL_CALL_DEPTH = 64;
31141
+ MAX_EVAL_TOTAL_CALLS = 2e4;
31142
+ evalCallDepth = 0;
31143
+ evalTotalCalls = 0;
31144
+ evalActiveCallKeys = [];
31145
+ evalFnCallIds = /* @__PURE__ */ new WeakMap();
31146
+ evalFnCallIdSeq = 0;
30621
31147
  }
30622
31148
  });
30623
31149
 
@@ -30788,10 +31314,10 @@ __export(class_exports, {
30788
31314
  $thisSet: () => $thisSet,
30789
31315
  clearBClasses: () => clearBClasses,
30790
31316
  execRegexBrand: () => execRegexBrand,
30791
- getBClass: () => getBClass,
31317
+ getEvalClass: () => getEvalClass,
30792
31318
  regexExecWithState: () => regexExecWithState,
30793
31319
  regexParts: () => regexParts,
30794
- registerBClass: () => registerBClass,
31320
+ registerEvalClass: () => registerEvalClass,
30795
31321
  stringRegexMethod: () => stringRegexMethod
30796
31322
  });
30797
31323
  function $class(name, spec) {
@@ -30816,12 +31342,12 @@ function $class(name, spec) {
30816
31342
  accessors: spec.accessors,
30817
31343
  staticAccessors: spec.staticAccessors
30818
31344
  };
30819
- registerBClass(full);
31345
+ registerEvalClass(full);
30820
31346
  const slots = {};
30821
31347
  if (spec.statics) {
30822
- for (const [k, v2] of Object.entries(spec.statics)) slots[k] = { value: asAbsVal(v2) };
31348
+ for (const [k, v2] of Object.entries(spec.statics)) setSlot(slots, k, { value: asAbsVal(v2) });
30823
31349
  }
30824
- slots["name"] = { value: strLit(name) };
31350
+ setSlot(slots, "name", { value: strLit(name) });
30825
31351
  const val = abs(
30826
31352
  { k: "brand", name, shape: objOf(slots) },
30827
31353
  void 0,
@@ -30834,7 +31360,7 @@ function $class(name, spec) {
30834
31360
  }
30835
31361
  function specOf(cls) {
30836
31362
  if (classImpl.has(cls)) return classImpl.get(cls);
30837
- if (cls.shape.k === "brand") return getBClass(cls.shape.name);
31363
+ if (cls.shape.k === "brand") return getEvalClass(cls.shape.name);
30838
31364
  return void 0;
30839
31365
  }
30840
31366
  function findMethod(startName, method) {
@@ -30842,7 +31368,7 @@ function findMethod(startName, method) {
30842
31368
  const seen = /* @__PURE__ */ new Set();
30843
31369
  while (cur && !seen.has(cur)) {
30844
31370
  seen.add(cur);
30845
- const spec = getBClass(cur);
31371
+ const spec = getEvalClass(cur);
30846
31372
  if (spec?.methods?.[method]) return spec.methods[method];
30847
31373
  cur = spec?.superName;
30848
31374
  }
@@ -30853,7 +31379,7 @@ function findCtor(startName) {
30853
31379
  const seen = /* @__PURE__ */ new Set();
30854
31380
  while (cur && !seen.has(cur)) {
30855
31381
  seen.add(cur);
30856
- const spec = getBClass(cur);
31382
+ const spec = getEvalClass(cur);
30857
31383
  if (spec?.ctor) return { ctor: spec.ctor, className: cur };
30858
31384
  cur = spec?.superName;
30859
31385
  }
@@ -30863,11 +31389,9 @@ function $new(cls, args) {
30863
31389
  if (cls && typeof cls === "object" && "shape" in cls) {
30864
31390
  const cs = cls.shape;
30865
31391
  const ctorName = cs.k === "brand" ? cs.name : builtinCtorNameOf(cls) ?? (cs.k === "fn" ? cs.name ?? void 0 : void 0);
30866
- if (ctorName && isErrorCtorName(ctorName)) {
30867
- return errorBrandAbs(ctorName, args);
30868
- }
30869
- if (ctorName === "Promise") {
30870
- return evalPromiseCtor(args);
31392
+ if (ctorName) {
31393
+ const built = evalBuiltinNew(ctorName, args);
31394
+ if (built !== void 0) return built;
30871
31395
  }
30872
31396
  }
30873
31397
  if (typeof cls === "function") {
@@ -30948,7 +31472,7 @@ function $new(cls, args) {
30948
31472
  return thisVal;
30949
31473
  }
30950
31474
  function $super(thisVal, childName, args) {
30951
- const child = getBClass(childName);
31475
+ const child = getEvalClass(childName);
30952
31476
  const parentName = child?.superName;
30953
31477
  if (!parentName) return thisVal;
30954
31478
  const found = findCtor(parentName);
@@ -30980,6 +31504,7 @@ function runtimeAssignObject(args) {
30980
31504
  const base = accObj.shape.slots;
30981
31505
  const flags = getPropFlags(accObj);
30982
31506
  for (const [k, s] of Object.entries(srcAbs.shape.slots)) {
31507
+ if (!isEnumerableView(srcAbs, k)) continue;
30983
31508
  if ((st === "sealed" || st === "nonext") && !Object.prototype.hasOwnProperty.call(base, k)) {
30984
31509
  throwStrictAssign();
30985
31510
  }
@@ -31185,7 +31710,7 @@ function $invoke(thisVal, method, args, loc) {
31185
31710
  result = e && typeof e === "object" && "absValue" in e ? e.absValue : unknown;
31186
31711
  throw e;
31187
31712
  } finally {
31188
- noteBCallRecord({
31713
+ noteEvalCallRecord({
31189
31714
  fnName: `${brandName}.${method}`,
31190
31715
  args,
31191
31716
  result,
@@ -31194,7 +31719,7 @@ function $invoke(thisVal, method, args, loc) {
31194
31719
  });
31195
31720
  }
31196
31721
  }
31197
- const spec = getBClass(brandName);
31722
+ const spec = getEvalClass(brandName);
31198
31723
  const sm = spec?.staticMethods?.[method];
31199
31724
  if (sm) {
31200
31725
  let result = unknown;
@@ -31207,7 +31732,7 @@ function $invoke(thisVal, method, args, loc) {
31207
31732
  result = e && typeof e === "object" && "absValue" in e ? e.absValue : unknown;
31208
31733
  throw e;
31209
31734
  } finally {
31210
- noteBCallRecord({
31735
+ noteEvalCallRecord({
31211
31736
  fnName: `${brandName}.${method}`,
31212
31737
  args,
31213
31738
  result,
@@ -31312,7 +31837,7 @@ function $invoke(thisVal, method, args, loc) {
31312
31837
  result = e && typeof e === "object" && "absValue" in e ? e.absValue : unknown;
31313
31838
  throw e;
31314
31839
  } finally {
31315
- noteBCallRecord({
31840
+ noteEvalCallRecord({
31316
31841
  fnName: recordName,
31317
31842
  args,
31318
31843
  result,
@@ -31640,8 +32165,7 @@ function invokeArrMethod(arr, method, args) {
31640
32165
  if (shape2.k === "arr") return joinAbs(shape2.element, undefAbs());
31641
32166
  }
31642
32167
  if (method === "at") {
31643
- const raw = args[0] !== void 0 ? litValue(args[0]) : void 0;
31644
- const iv = typeof raw === "number" && Number.isInteger(raw) ? raw : void 0;
32168
+ const iv = toIntegerOrInfinityLit(args[0]);
31645
32169
  if (shape2.k === "tuple") {
31646
32170
  const els = shape2.elements;
31647
32171
  if (iv === void 0) {
@@ -31657,7 +32181,7 @@ function invokeArrMethod(arr, method, args) {
31657
32181
  return void 0;
31658
32182
  }
31659
32183
  function $invokeSuper(thisVal, childName, method, args) {
31660
- const child = getBClass(childName);
32184
+ const child = getEvalClass(childName);
31661
32185
  const parentName = child?.superName;
31662
32186
  if (!parentName) return unknown;
31663
32187
  const m = findMethod(parentName, method);
@@ -31678,7 +32202,7 @@ function $thisSet(thisVal, key, value) {
31678
32202
  if (thisVal.shape.k === "brand") {
31679
32203
  const inner = thisVal.shape.shape;
31680
32204
  const slots = inner.shape.k === "obj" ? { ...inner.shape.slots } : {};
31681
- slots[key] = { value: asAbsVal(value) };
32205
+ setSlot(slots, key, { value: asAbsVal(value) });
31682
32206
  return abs(
31683
32207
  {
31684
32208
  k: "brand",
@@ -31763,13 +32287,23 @@ function $staticInvoke(cls, method, args) {
31763
32287
  result = e && typeof e === "object" && "absValue" in e ? e.absValue : unknown;
31764
32288
  throw e;
31765
32289
  } finally {
31766
- noteBCallRecord({ fnName: recordName, args, result, threw });
32290
+ noteEvalCallRecord({ fnName: recordName, args, result, threw });
31767
32291
  }
31768
32292
  }
31769
32293
  function $setKey(o, key, value) {
31770
- const k = litValue(key);
32294
+ const pk = propertyKeyOf(key);
32295
+ const k = pk !== void 0 ? pk : litValue(key);
31771
32296
  if (typeof k === "string" || typeof k === "number") {
31772
- return $set(o, String(k), value);
32297
+ const ks = String(k);
32298
+ if (ks === "__proto__" && o.shape.k === "obj") {
32299
+ setSlot(o.shape.slots, ks, {
32300
+ value: asAbsVal(value)
32301
+ });
32302
+ o.conf = confJoin(o.conf, value.conf);
32303
+ clearStaleTermPred(o);
32304
+ return o;
32305
+ }
32306
+ return $set(o, ks, value);
31773
32307
  }
31774
32308
  const val = asAbsVal(value);
31775
32309
  if (o.shape.k === "brand") {
@@ -32079,7 +32613,7 @@ function bindingsOf(run) {
32079
32613
  return runBindings.get(run);
32080
32614
  }
32081
32615
  function runTranspiled(source, opts = {}) {
32082
- resetBCallBudget();
32616
+ resetEvalCallBudget();
32083
32617
  const modules = opts.modules ?? {};
32084
32618
  let js = transpile(source, {
32085
32619
  runtimeImport: "@nudojs/core/exec",
@@ -32172,17 +32706,17 @@ ${js}`;
32172
32706
  const ret = `return { ...__nudoExports, ...${cjsMerge}, ${names2.join(", ")} };`;
32173
32707
  const fn2 = new Function(...argNames, `${js}
32174
32708
  ${ret}`);
32175
- setBBindingSink(bindings);
32709
+ setEvalBindingSink(bindings);
32176
32710
  try {
32177
32711
  const result = fn2(...args);
32178
32712
  runBindings.set(result, bindings);
32179
32713
  return result;
32180
32714
  } finally {
32181
- setBBindingSink(null);
32715
+ setEvalBindingSink(null);
32182
32716
  }
32183
32717
  }
32184
- function setBPathFallbackCollector(collector2) {
32185
- bFallbackCollector = collector2;
32718
+ function setEvalFallbackCollector(collector2) {
32719
+ evalFallbackCollector = collector2;
32186
32720
  }
32187
32721
  function evalExprAbs(expr, bindings = {}) {
32188
32722
  const src = transpileExpression(expr, {});
@@ -32195,15 +32729,15 @@ function evalExprAbs(expr, bindings = {}) {
32195
32729
  const factory = new Function(...names2, cleaned);
32196
32730
  return factory(...Object.values(rtAllBindings()), ...Object.values(bindings));
32197
32731
  }
32198
- function noteBPathFallback(e) {
32199
- if (!bFallbackCollector) return;
32732
+ function noteEvalFallback(e) {
32733
+ if (!evalFallbackCollector) return;
32200
32734
  const f = e instanceof NudoUnsupportedError ? { reason: `unsupported:${e.reason}`, message: e.message, ...e.loc ? { loc: e.loc } : {} } : isNudoThrow(e) ? (
32201
32735
  // NudoThrow:程序自身的抛(如顶层 this 写 / strict 写 TypeError)——
32202
32736
  // 模块装载失败,不是 B 能力边界也不是 B 缺陷(catch 可吸收)
32203
32737
  { reason: "module-throw", message: e instanceof Error ? e.message : String(e) }
32204
32738
  ) : { reason: "internal", message: e instanceof Error ? e.message : String(e) };
32205
32739
  try {
32206
- bFallbackCollector(f);
32740
+ evalFallbackCollector(f);
32207
32741
  } catch {
32208
32742
  }
32209
32743
  }
@@ -32211,7 +32745,7 @@ function tryRunTranspiled(source, opts = {}) {
32211
32745
  try {
32212
32746
  return runTranspiled(source, opts);
32213
32747
  } catch (e) {
32214
- noteBPathFallback(e);
32748
+ noteEvalFallback(e);
32215
32749
  return void 0;
32216
32750
  }
32217
32751
  }
@@ -32221,7 +32755,7 @@ function isAbsVal(v2) {
32221
32755
  function callTranspiledExportFull(exports, name, args, opts) {
32222
32756
  const fn2 = exports[name];
32223
32757
  if (typeof fn2 === "function") {
32224
- resetBCallBudget();
32758
+ resetEvalCallBudget();
32225
32759
  const callArgs = args.map(
32226
32760
  (a) => a && typeof a === "object" && "shape" in a ? $copy(a) : a
32227
32761
  );
@@ -32290,7 +32824,7 @@ function joinControlExits(normal) {
32290
32824
  function callTranspiledExport(exports, name, args) {
32291
32825
  return callTranspiledExportFull(exports, name, args).result;
32292
32826
  }
32293
- var RUNTIME_IMPORT_RE2, runBindings, bFallbackCollector;
32827
+ var RUNTIME_IMPORT_RE2, runBindings, evalFallbackCollector;
32294
32828
  var init_run = __esm({
32295
32829
  "../core/src/algebra/exec/run.ts"() {
32296
32830
  "use strict";
@@ -32310,7 +32844,7 @@ var init_run = __esm({
32310
32844
  init_call();
32311
32845
  RUNTIME_IMPORT_RE2 = /^import\s*\{[^}]+\}\s*from\s*"[^"]+";\s*$/m;
32312
32846
  runBindings = /* @__PURE__ */ new WeakMap();
32313
- bFallbackCollector = null;
32847
+ evalFallbackCollector = null;
32314
32848
  }
32315
32849
  });
32316
32850
 
@@ -32589,13 +33123,13 @@ var init_generalize_key = __esm({
32589
33123
  });
32590
33124
 
32591
33125
  // ../core/src/algebra/generalize.ts
32592
- function bPathRunOf(source, modules, inject) {
33126
+ function evalRunOf(source, modules, inject) {
32593
33127
  const mKey = `${source}|${runTranspiledOptionsMemoKey({ ...inject ?? {}, ...modules ? { modules } : {} })}`;
32594
- if (bRunMemo.size >= 256) {
32595
- const oldest = bRunMemo.keys().next().value;
32596
- if (oldest !== void 0) bRunMemo.delete(oldest);
33128
+ if (evalRunMemo.size >= 256) {
33129
+ const oldest = evalRunMemo.keys().next().value;
33130
+ if (oldest !== void 0) evalRunMemo.delete(oldest);
32597
33131
  }
32598
- let run = bRunMemo.get(mKey);
33132
+ let run = evalRunMemo.get(mKey);
32599
33133
  if (run === void 0) {
32600
33134
  const merged = modules ?? inject?.modules;
32601
33135
  const r = tryRunTranspiled(source, {
@@ -32605,7 +33139,7 @@ function bPathRunOf(source, modules, inject) {
32605
33139
  });
32606
33140
  if (r === void 0) return void 0;
32607
33141
  run = r;
32608
- bRunMemo.set(mKey, run);
33142
+ evalRunMemo.set(mKey, run);
32609
33143
  }
32610
33144
  return run;
32611
33145
  }
@@ -32995,7 +33529,7 @@ function generalizeFromAstUncached(fnName, source, opts = {}) {
32995
33529
  );
32996
33530
  const envGated = envGatedSource && freeIdentifiers(body, boundNames).size > 0;
32997
33531
  const replaceGated = /@nudo:replace\b/.test(source) && !hasReps;
32998
- const bEligible = !unresolvableImports && !mockGated && !envGated && !replaceGated;
33532
+ const evalEligible = !unresolvableImports && !mockGated && !envGated && !replaceGated;
32999
33533
  const run = (args, phi2 = pTrue) => {
33000
33534
  const { key, varOrder } = instantiateMemoKey(args, phi2);
33001
33535
  const hit = instMemo.get(key);
@@ -33003,27 +33537,27 @@ function generalizeFromAstUncached(fnName, source, opts = {}) {
33003
33537
  return alphaRenameResult(hit.result, hit.varOrder, varOrder);
33004
33538
  }
33005
33539
  let result;
33006
- if (bEligible) {
33540
+ if (evalEligible) {
33007
33541
  try {
33008
- const bRun = bPathRunOf(source, opts.modules, opts.inject);
33009
- if (!bRun) {
33542
+ const evalRun = evalRunOf(source, opts.modules, opts.inject);
33543
+ if (!evalRun) {
33010
33544
  } else if (fnName.includes(".")) {
33011
33545
  const [clsName, methodName] = fnName.split(".", 2);
33012
- const clsAbs = bRun[clsName ?? ""];
33546
+ const clsAbs = evalRun[clsName ?? ""];
33013
33547
  if (clsAbs && typeof clsAbs === "object" && "shape" in clsAbs) {
33014
33548
  const nCtor = ctorParamCountOf(fileAst, clsName ?? "");
33015
33549
  const inst = $new(clsAbs, Array.from({ length: nCtor }, () => abs({ k: "any" }, void 0, pTrue, "path")));
33016
33550
  result = withExecPhi(phi2, () => $invoke(inst, methodName ?? "", args));
33017
33551
  }
33018
- } else if (fnName in bRun) {
33019
- const bArgs = args.map((a, i) => {
33552
+ } else if (fnName in evalRun) {
33553
+ const evalArgs = args.map((a, i) => {
33020
33554
  const shape2 = promoteScan.promotedShapes.get(params[i]);
33021
33555
  if (shape2 && (a.shape.k === "any" || a.shape.k === "unknown")) {
33022
33556
  return { shape: shape2, term: a.term, pred: a.pred, conf: "path" };
33023
33557
  }
33024
33558
  return a;
33025
33559
  });
33026
- result = callTranspiledExportFull(bRun, fnName, bArgs, { phi: phi2 }).result;
33560
+ result = callTranspiledExportFull(evalRun, fnName, evalArgs, { phi: phi2 }).result;
33027
33561
  }
33028
33562
  } catch {
33029
33563
  }
@@ -33187,7 +33721,7 @@ function buildArgsFromAssume(source, fnName, assumeIds) {
33187
33721
  return abs({ k: "any" }, void 0, void 0, "path");
33188
33722
  });
33189
33723
  }
33190
- var bRunMemo, generalizeMemo, memoKeyDeps, memoDepIndex, loadModuleIds, nextLoadModuleId, MAX_GENERALIZE_MEMO, moduleMapIds, moduleMapIdSeq;
33724
+ var evalRunMemo, generalizeMemo, memoKeyDeps, memoDepIndex, loadModuleIds, nextLoadModuleId, MAX_GENERALIZE_MEMO, moduleMapIds, moduleMapIdSeq;
33191
33725
  var init_generalize = __esm({
33192
33726
  "../core/src/algebra/generalize.ts"() {
33193
33727
  "use strict";
@@ -33212,7 +33746,7 @@ var init_generalize = __esm({
33212
33746
  init_class();
33213
33747
  init_generalize_key();
33214
33748
  init_generalize_key();
33215
- bRunMemo = /* @__PURE__ */ new Map();
33749
+ evalRunMemo = /* @__PURE__ */ new Map();
33216
33750
  generalizeMemo = /* @__PURE__ */ new Map();
33217
33751
  memoKeyDeps = /* @__PURE__ */ new Map();
33218
33752
  memoDepIndex = /* @__PURE__ */ new Map();
@@ -34130,17 +34664,17 @@ function scanLiteralCalls(source, knownFns, phi2, opts) {
34130
34664
  const resolve25 = collectCallResolvers(source, knownFns, opts);
34131
34665
  const forwards = collectForwarders(source, knownSet, resolve25, file);
34132
34666
  const varAbs = opts?.varAbs ?? /* @__PURE__ */ new Map();
34133
- const bCallIndex = /* @__PURE__ */ new Map();
34667
+ const evalCallIndex = /* @__PURE__ */ new Map();
34134
34668
  for (const r of opts?.bCalls ?? []) {
34135
34669
  if (!r.callLoc) continue;
34136
34670
  const key = `${r.fnName}\0${r.callLoc.line}`;
34137
- const list = bCallIndex.get(key) ?? [];
34671
+ const list = evalCallIndex.get(key) ?? [];
34138
34672
  list.push(r.args);
34139
- bCallIndex.set(key, list);
34673
+ evalCallIndex.set(key, list);
34140
34674
  }
34141
34675
  const takeBCallArgs = (fnName, line) => {
34142
34676
  if (line === void 0) return void 0;
34143
- const list = bCallIndex.get(`${fnName}\0${line}`);
34677
+ const list = evalCallIndex.get(`${fnName}\0${line}`);
34144
34678
  if (!list || list.length === 0) return void 0;
34145
34679
  return list.shift();
34146
34680
  };
@@ -34733,10 +35267,10 @@ function scanLiteralCalls(source, knownFns, phi2, opts) {
34733
35267
  let absArgs = parsed.absArgs;
34734
35268
  let hasInfo = parsed.hasInfo;
34735
35269
  if (!hasInfo) {
34736
- const bArgs = takeBCallArgs(fnName, loc?.start.line);
34737
- if (bArgs && bArgs.length > 0) {
34738
- absArgs = bArgs;
34739
- hasInfo = bArgs.some(isInformativeArg);
35270
+ const evalArgs = takeBCallArgs(fnName, loc?.start.line);
35271
+ if (evalArgs && evalArgs.length > 0) {
35272
+ absArgs = evalArgs;
35273
+ hasInfo = evalArgs.some(isInformativeArg);
34740
35274
  }
34741
35275
  }
34742
35276
  if (!hasInfo || absArgs.length === 0) return;
@@ -34799,10 +35333,10 @@ function scanLiteralCalls(source, knownFns, phi2, opts) {
34799
35333
  let absArgs = parsedExt.absArgs;
34800
35334
  let hasInfo = parsedExt.hasInfo;
34801
35335
  if (!hasInfo) {
34802
- const bArgs = takeBCallArgs(ext.fnName, loc?.start.line);
34803
- if (bArgs && bArgs.length > 0) {
34804
- absArgs = bArgs;
34805
- hasInfo = bArgs.some(isInformativeArg);
35336
+ const evalArgs = takeBCallArgs(ext.fnName, loc?.start.line);
35337
+ if (evalArgs && evalArgs.length > 0) {
35338
+ absArgs = evalArgs;
35339
+ hasInfo = evalArgs.some(isInformativeArg);
34806
35340
  }
34807
35341
  }
34808
35342
  if (!hasInfo || absArgs.length === 0) return;
@@ -35659,7 +36193,7 @@ function collectEntryMayThrows(source, fnName, g, file, phi2, opts = {}) {
35659
36193
  return runWithMayThrowSession(() => {
35660
36194
  setMayThrowCollector((e) => effects.push(e));
35661
36195
  try {
35662
- const full = bPathThrowsOf(source, fnName, entryArgs, opts, phi2);
36196
+ const full = evalThrowsOf(source, fnName, entryArgs, opts, phi2);
35663
36197
  if (!full) return effects;
35664
36198
  if (full.throws && full.throws.shape.k !== "never") {
35665
36199
  for (const tName of throwAbsToKinds(full.throws)) {
@@ -35678,7 +36212,7 @@ function collectEntryMayThrows(source, fnName, g, file, phi2, opts = {}) {
35678
36212
  return effects;
35679
36213
  });
35680
36214
  }
35681
- function bAnalyzeOpts(opts) {
36215
+ function evalAnalyzeOpts(opts) {
35682
36216
  const inject = opts.inject ?? {};
35683
36217
  const modules = opts.modules ?? inject.modules;
35684
36218
  return {
@@ -35701,18 +36235,18 @@ function invokeAsThrows(fn2, phi2 = pTrue) {
35701
36235
  throw e;
35702
36236
  }
35703
36237
  }
35704
- function bPathThrowsOf(source, fnName, args, opts = {}, phi2 = pTrue) {
36238
+ function evalThrowsOf(source, fnName, args, opts = {}, phi2 = pTrue) {
35705
36239
  const runKey = `${source}|${runTranspiledOptionsMemoKey(opts.inject)}|${runTranspiledOptionsMemoKey(opts.modules ? { modules: opts.modules } : void 0)}`;
35706
- if (bPathRunMemo.size >= MAX_CHECK_MEMO) {
35707
- const oldest = bPathRunMemo.keys().next().value;
35708
- if (oldest !== void 0) bPathRunMemo.delete(oldest);
36240
+ if (evalRunMemo2.size >= MAX_CHECK_MEMO) {
36241
+ const oldest = evalRunMemo2.keys().next().value;
36242
+ if (oldest !== void 0) evalRunMemo2.delete(oldest);
35709
36243
  }
35710
- let exports = bPathRunMemo.get(runKey);
36244
+ let exports = evalRunMemo2.get(runKey);
35711
36245
  if (exports === void 0) {
35712
- const run = tryRunTranspiled(source, bAnalyzeOpts(opts));
36246
+ const run = tryRunTranspiled(source, evalAnalyzeOpts(opts));
35713
36247
  if (run === void 0) return void 0;
35714
36248
  exports = run;
35715
- bPathRunMemo.set(runKey, exports);
36249
+ evalRunMemo2.set(runKey, exports);
35716
36250
  }
35717
36251
  const isAbsVal5 = (v2) => !!v2 && typeof v2 === "object" && "shape" in v2 && "conf" in v2;
35718
36252
  const call = (name, callArgs) => {
@@ -35747,7 +36281,7 @@ function bPathThrowsOf(source, fnName, args, opts = {}, phi2 = pTrue) {
35747
36281
  return void 0;
35748
36282
  }
35749
36283
  }
35750
- var bPathRunMemo;
36284
+ var evalRunMemo2;
35751
36285
  var init_check_may_throw = __esm({
35752
36286
  "../core/src/algebra/check-may-throw.ts"() {
35753
36287
  "use strict";
@@ -35759,7 +36293,7 @@ var init_check_may_throw = __esm({
35759
36293
  init_nudo_throw();
35760
36294
  init_may_throw();
35761
36295
  init_check_memo();
35762
- bPathRunMemo = /* @__PURE__ */ new Map();
36296
+ evalRunMemo2 = /* @__PURE__ */ new Map();
35763
36297
  }
35764
36298
  });
35765
36299
 
@@ -35798,8 +36332,11 @@ function widenForAssign(a) {
35798
36332
  a.conf
35799
36333
  );
35800
36334
  }
35801
- const lv = litValue(a);
35802
- if (lv !== void 0 && a.term?.op === "lit") {
36335
+ if (a.term?.op === "lit") {
36336
+ const lv = a.term.value;
36337
+ if (lv === null || lv === void 0) {
36338
+ return abs({ k: "unknown" }, void 0, void 0, a.conf);
36339
+ }
35803
36340
  if (typeof lv === "number") {
35804
36341
  return abs({ k: "prim", type: "number" }, void 0, void 0, a.conf);
35805
36342
  }
@@ -36482,15 +37019,15 @@ function checkSourceInner(filePath, source, file, phi2, opts, issues, signatures
36482
37019
  const varAbs = /* @__PURE__ */ new Map();
36483
37020
  const callRecords = [];
36484
37021
  const bCalls = [];
36485
- const prevAssign = setBAssignCollector((r) => records.push(r));
36486
- const prevCall = setBCallCollector((r) => bCalls.push(r));
36487
- let bBindings;
36488
- const bAnalyze = bAnalyzeOpts(opts);
37022
+ const prevAssign = setEvalAssignCollector((r) => records.push(r));
37023
+ const prevCall = setEvalCallCollector((r) => bCalls.push(r));
37024
+ let evalBindings;
37025
+ const evalAnalyze = evalAnalyzeOpts(opts);
36489
37026
  try {
36490
- const bRun = tryRunTranspiled(source, bAnalyze);
36491
- bBindings = bRun ? bindingsOf(bRun) : void 0;
36492
- if (bBindings) {
36493
- for (const [k, v2] of bBindings) {
37027
+ const evalRun = tryRunTranspiled(source, evalAnalyze);
37028
+ evalBindings = evalRun ? bindingsOf(evalRun) : void 0;
37029
+ if (evalBindings) {
37030
+ for (const [k, v2] of evalBindings) {
36494
37031
  if (v2 && typeof v2 === "object" && "shape" in v2 && "conf" in v2) {
36495
37032
  varAbs.set(k, v2);
36496
37033
  }
@@ -36506,10 +37043,10 @@ function checkSourceInner(filePath, source, file, phi2, opts, issues, signatures
36506
37043
  }
36507
37044
  } catch {
36508
37045
  } finally {
36509
- setBAssignCollector(prevAssign);
36510
- setBCallCollector(prevCall);
37046
+ setEvalAssignCollector(prevAssign);
37047
+ setEvalCallCollector(prevCall);
36511
37048
  }
36512
- void bBindings;
37049
+ void evalBindings;
36513
37050
  const callIssues = canSkipLiteralCallScan(source, file) ? [] : scanLiteralCalls(source, names2, phi2, {
36514
37051
  loadModule: opts.loadModule,
36515
37052
  // 与 generalize / 返回后置同一 fromFile 口径:ambient 侧车按真实
@@ -36549,7 +37086,7 @@ function checkSourceInner(filePath, source, file, phi2, opts, issues, signatures
36549
37086
  return (fnName, args) => {
36550
37087
  try {
36551
37088
  if (!driftInit) {
36552
- driftRun = tryRunTranspiled(source, bAnalyze);
37089
+ driftRun = tryRunTranspiled(source, evalAnalyze);
36553
37090
  driftInit = true;
36554
37091
  }
36555
37092
  if (!driftRun || !(fnName in driftRun)) return void 0;
@@ -37289,6 +37826,7 @@ __export(src_exports, {
37289
37826
  $thisSet: () => $thisSet,
37290
37827
  $throw: () => $throw,
37291
37828
  $toNumber: () => $toNumber,
37829
+ $toNumeric: () => $toNumeric,
37292
37830
  $tryCurrentMark: () => $tryCurrentMark,
37293
37831
  $tryDetachSoftCatch: () => $tryDetachSoftCatch,
37294
37832
  $tryDigestSoftCatch: () => $tryDigestSoftCatch,
@@ -37301,13 +37839,15 @@ __export(src_exports, {
37301
37839
  $tryTakeSince: () => $tryTakeSince,
37302
37840
  $typeof: () => $typeof,
37303
37841
  $unknown: () => $unknown,
37842
+ $updateAdd: () => $updateAdd,
37843
+ $updateSub: () => $updateSub,
37304
37844
  $ushr: () => $ushr,
37305
37845
  $while: () => $while,
37306
37846
  $whileSeq: () => $whileSeq,
37307
37847
  $yield: () => $yield,
37308
37848
  DEFAULT_MAX_LOOP_ITERS: () => DEFAULT_MAX_LOOP_ITERS,
37309
- MAX_B_CALL_DEPTH: () => MAX_B_CALL_DEPTH,
37310
- MAX_B_TOTAL_CALLS: () => MAX_B_TOTAL_CALLS,
37849
+ MAX_EVAL_CALL_DEPTH: () => MAX_EVAL_CALL_DEPTH,
37850
+ MAX_EVAL_TOTAL_CALLS: () => MAX_EVAL_TOTAL_CALLS,
37311
37851
  NudoLoopSignal: () => NudoLoopSignal,
37312
37852
  NudoReturn: () => NudoReturn,
37313
37853
  NudoSidecarError: () => NudoSidecarError,
@@ -37445,8 +37985,8 @@ __export(src_exports, {
37445
37985
  generalizeFromAst: () => generalizeFromAst,
37446
37986
  generatedExportNames: () => generatedExportNames,
37447
37987
  getAbsProperty: () => getAbsProperty,
37448
- getBCallCollector: () => getBCallCollector,
37449
- getBClass: () => getBClass,
37988
+ getEvalCallCollector: () => getEvalCallCollector,
37989
+ getEvalClass: () => getEvalClass,
37450
37990
  getFnImpl: () => getFnImpl,
37451
37991
  getGeneralizeMemoSize: () => getGeneralizeMemoSize,
37452
37992
  getImplicationOracle: () => getImplicationOracle,
@@ -37539,9 +38079,9 @@ __export(src_exports, {
37539
38079
  never: () => never,
37540
38080
  not: () => not,
37541
38081
  notAbs: () => notAbs,
37542
- noteBCallRecord: () => noteBCallRecord,
37543
- noteBPathFallback: () => noteBPathFallback,
37544
38082
  noteCollectionWrite: () => noteCollectionWrite,
38083
+ noteEvalCallRecord: () => noteEvalCallRecord,
38084
+ noteEvalFallback: () => noteEvalFallback,
37545
38085
  notePromiseExecutorFork: () => notePromiseExecutorFork,
37546
38086
  num: () => num,
37547
38087
  numLit: () => numLit,
@@ -37568,6 +38108,7 @@ __export(src_exports, {
37568
38108
  primToTypeof: () => primToTypeof,
37569
38109
  projectFlatMapResult: () => projectFlatMapResult,
37570
38110
  promoteParamShape: () => promoteParamShape,
38111
+ propertyKeyOf: () => propertyKeyOf,
37571
38112
  protoBrandAbs: () => protoBrandAbs,
37572
38113
  protoOfRecv: () => protoOfRecv,
37573
38114
  ptypeof: () => ptypeof,
@@ -37581,12 +38122,12 @@ __export(src_exports, {
37581
38122
  refineDiagCount: () => refineDiagCount,
37582
38123
  refineToIndexedFull: () => refineToIndexedFull,
37583
38124
  regexBrandAbsFrom: () => regexBrandAbsFrom,
37584
- registerBClass: () => registerBClass,
38125
+ registerEvalClass: () => registerEvalClass,
37585
38126
  relationFingerprint: () => relationFingerprint,
37586
38127
  relationFn: () => relationFn,
37587
38128
  requiredFnArity: () => requiredFnArity,
37588
- resetBCallBudget: () => resetBCallBudget,
37589
38129
  resetCheckSourceMemo: () => resetCheckSourceMemo,
38130
+ resetEvalCallBudget: () => resetEvalCallBudget,
37590
38131
  resetGeneralizeMemo: () => resetGeneralizeMemo,
37591
38132
  resetNudoModuleExecCache: () => resetNudoModuleExecCache,
37592
38133
  resetParseSourceCache: () => resetParseSourceCache,
@@ -37599,13 +38140,13 @@ __export(src_exports, {
37599
38140
  serializeCheckJsonMulti: () => serializeCheckJsonMulti,
37600
38141
  setAddEntry: () => setAddEntry,
37601
38142
  setApplyCallbackHost: () => setApplyCallbackHost,
37602
- setBAssignCollector: () => setBAssignCollector,
37603
- setBBindingSink: () => setBBindingSink,
37604
- setBCallCollector: () => setBCallCollector,
37605
- setBPathFallbackCollector: () => setBPathFallbackCollector,
37606
38143
  setClearEntries: () => setClearEntries,
37607
38144
  setDeleteEntry: () => setDeleteEntry,
37608
38145
  setElementsAbs: () => setElementsAbs,
38146
+ setEvalAssignCollector: () => setEvalAssignCollector,
38147
+ setEvalBindingSink: () => setEvalBindingSink,
38148
+ setEvalCallCollector: () => setEvalCallCollector,
38149
+ setEvalFallbackCollector: () => setEvalFallbackCollector,
37609
38150
  setHasEntry: () => setHasEntry,
37610
38151
  setImplicationOracle: () => setImplicationOracle,
37611
38152
  setInterfaceDiagCollector: () => setInterfaceDiagCollector,
@@ -46355,8 +46896,8 @@ __export(internal_exports, {
46355
46896
  ERROR_FAMILY: () => ERROR_FAMILY,
46356
46897
  FORK_TRUNCATION_LABEL: () => FORK_TRUNCATION_LABEL,
46357
46898
  HOST_EFFECT_LABEL_PREFIX: () => HOST_EFFECT_LABEL_PREFIX,
46358
- MAX_B_TOTAL_FORKS: () => MAX_B_TOTAL_FORKS,
46359
46899
  MAX_CALL_DEPTH: () => MAX_CALL_DEPTH,
46900
+ MAX_EVAL_TOTAL_FORKS: () => MAX_EVAL_TOTAL_FORKS,
46360
46901
  MAX_TOTAL_CALLS: () => MAX_TOTAL_CALLS,
46361
46902
  OBJECT_PROTO_NAMES: () => OBJECT_PROTO_NAMES,
46362
46903
  abortDerivationSession: () => abortDerivationSession,
@@ -46365,7 +46906,7 @@ __export(internal_exports, {
46365
46906
  anyMemberResult: () => anyMemberResult,
46366
46907
  awaitAbs: () => awaitAbs,
46367
46908
  beginDerivationSession: () => beginDerivationSession,
46368
- bumpBForkBudget: () => bumpBForkBudget,
46909
+ bumpEvalForkBudget: () => bumpEvalForkBudget,
46369
46910
  callBudgetKey: () => callBudgetKey,
46370
46911
  canSkipLiteralCallScan: () => canSkipLiteralCallScan,
46371
46912
  checkInjectedDomainEvidence: () => checkInjectedDomainEvidence,
@@ -46400,11 +46941,11 @@ __export(internal_exports, {
46400
46941
  generalizeSourceKeyPart: () => generalizeSourceKeyPart,
46401
46942
  getAbsCallBudgetStats: () => getAbsCallBudgetStats,
46402
46943
  getAbsOrigin: () => getAbsOrigin,
46403
- getBForkBudgetLimit: () => getBForkBudgetLimit,
46404
- getBForkCount: () => getBForkCount,
46405
46944
  getClass: () => getClass,
46406
46945
  getClassChain: () => getClassChain,
46407
46946
  getDerivation: () => getDerivation,
46947
+ getEvalForkBudgetLimit: () => getEvalForkBudgetLimit,
46948
+ getEvalForkCount: () => getEvalForkCount,
46408
46949
  getFnNameAndBodies: () => getFnNameAndBodies,
46409
46950
  getMayThrowCollector: () => getMayThrowCollector,
46410
46951
  hasDerivationSession: () => hasDerivationSession,
@@ -46429,9 +46970,9 @@ __export(internal_exports, {
46429
46970
  normPath: () => normPath,
46430
46971
  noteAbsTruncation: () => noteAbsTruncation,
46431
46972
  noteAnyMemberMayThrow: () => noteAnyMemberMayThrow,
46432
- noteBForkTruncation: () => noteBForkTruncation,
46433
46973
  noteDerivationAdd: () => noteDerivationAdd,
46434
46974
  noteDerivationJoin: () => noteDerivationJoin,
46975
+ noteEvalForkTruncation: () => noteEvalForkTruncation,
46435
46976
  noteHostEffectBlocked: () => noteHostEffectBlocked,
46436
46977
  noteMemberDispatchMiss: () => noteMemberDispatchMiss,
46437
46978
  noteNullishMemberThrows: () => noteNullishMemberThrows,
@@ -46448,7 +46989,7 @@ __export(internal_exports, {
46448
46989
  recordMayThrow: () => recordMayThrow,
46449
46990
  recordMemberDiag: () => recordMemberDiag,
46450
46991
  resetAbsCallBudget: () => resetAbsCallBudget,
46451
- resetBForkBudget: () => resetBForkBudget,
46992
+ resetEvalForkBudget: () => resetEvalForkBudget,
46452
46993
  resetFnFpCache: () => resetFnFpCache,
46453
46994
  resetHashSourceCache: () => resetHashSourceCache,
46454
46995
  resetLeakCounter: () => resetLeakCounter,
@@ -46456,9 +46997,9 @@ __export(internal_exports, {
46456
46997
  runWithEvalMissingSlot: () => runWithEvalMissingSlot,
46457
46998
  runWithMayThrowSession: () => runWithMayThrowSession,
46458
46999
  setAbsTruncationCollector: () => setAbsTruncationCollector,
46459
- setBForkBudgetLimit: () => setBForkBudgetLimit,
46460
47000
  setDerivation: () => setDerivation,
46461
47001
  setDerivationCollector: () => setDerivationCollector,
47002
+ setEvalForkBudgetLimit: () => setEvalForkBudgetLimit,
46462
47003
  setEvalMissingSlotEnabled: () => setEvalMissingSlotEnabled,
46463
47004
  setMayThrowCollector: () => setMayThrowCollector,
46464
47005
  setMemberDiagCollector: () => setMemberDiagCollector,
@@ -46907,12 +47448,17 @@ function errorBrandOf(name) {
46907
47448
  }
46908
47449
  function envFn(paramTypes, returnType, apply, opts) {
46909
47450
  const params = opts?.params ?? paramTypes.map((_, i) => paramTypes.length === 1 && i === 0 ? "x" : `x${i}`);
47451
+ const staticSlots = opts?.slots ? slotsOf(opts.slots) : void 0;
46910
47452
  if (!apply) {
46911
- return relationFn(paramTypes, returnType, {
47453
+ const a2 = relationFn(paramTypes, returnType, {
46912
47454
  params,
46913
47455
  conf: opts?.conf ?? "exact",
46914
47456
  fingerprint: opts?.name ? `${opts.name}|${relationFingerprint(paramTypes, returnType)}` : void 0
46915
47457
  });
47458
+ if (staticSlots) {
47459
+ a2.shape = { ...a2.shape, slots: staticSlots };
47460
+ }
47461
+ return a2;
46916
47462
  }
46917
47463
  const implApply = apply;
46918
47464
  const a = absFunction(params, {
@@ -46931,7 +47477,8 @@ function envFn(paramTypes, returnType, apply, opts) {
46931
47477
  params,
46932
47478
  paramTypes,
46933
47479
  returnType,
46934
- ...opts?.name ? { name: opts.name } : {}
47480
+ ...opts?.name ? { name: opts.name } : {},
47481
+ ...staticSlots ? { slots: staticSlots } : {}
46935
47482
  };
46936
47483
  if (opts?.conf && opts.conf !== "exact") a.conf = opts.conf;
46937
47484
  return a;
@@ -47006,6 +47553,17 @@ function numImpl2Abs(fn2) {
47006
47553
  return a !== void 0 && b !== void 0 ? numLit(fn2(a, b)) : void 0;
47007
47554
  };
47008
47555
  }
47556
+ function numImplVAbs(fn2) {
47557
+ return (args) => {
47558
+ const nums = [];
47559
+ for (const a of args) {
47560
+ const n = absNumLit(a);
47561
+ if (n === void 0) return void 0;
47562
+ nums.push(n);
47563
+ }
47564
+ return numLit(fn2(...nums));
47565
+ };
47566
+ }
47009
47567
  function strToStrImplAbs(fn2) {
47010
47568
  return (args) => {
47011
47569
  const s = absStrLit(args[0]);
@@ -47103,6 +47661,18 @@ function defineEnv() {
47103
47661
  if (a.term?.op === "lit") return boolLit(false);
47104
47662
  return void 0;
47105
47663
  };
47664
+ const numberImplAbs = (args) => {
47665
+ return evalGlobalFn("Number", args);
47666
+ };
47667
+ const arrayImplAbs = (args) => {
47668
+ return makeArrayCtorAbs(args);
47669
+ };
47670
+ const promiseCtorImplAbs = (args) => {
47671
+ return evalPromiseCtor(args);
47672
+ };
47673
+ const dateCtorImplAbs = (args) => {
47674
+ return evalDateCtor(args);
47675
+ };
47106
47676
  const promiseResolveImplAbs = (args) => {
47107
47677
  if (!args[0]) return void 0;
47108
47678
  return promiseOf2(args[0]);
@@ -47124,8 +47694,18 @@ function defineEnv() {
47124
47694
  round: envFn([prim.num()], prim.num(), numImpl1Abs(Math.round)),
47125
47695
  trunc: envFn([prim.num()], prim.num(), numImpl1Abs(Math.trunc)),
47126
47696
  sign: envFn([prim.num()], prim.num(), numImpl1Abs(Math.sign)),
47127
- max: envFn([prim.num(), prim.num()], prim.num(), numImpl2Abs(Math.max)),
47128
- min: envFn([prim.num(), prim.num()], prim.num(), numImpl2Abs(Math.min)),
47697
+ // min/max/hypot 在 JS 里是变参(`Math.min(a, b, c)`)——二元声明会让
47698
+ // 多实参调用落进 arity 不匹配 → unknown
47699
+ max: envFnVariadic(prim.num(), prim.num(), {
47700
+ apply: numImplVAbs(Math.max),
47701
+ restName: "...values",
47702
+ name: "Math.max"
47703
+ }),
47704
+ min: envFnVariadic(prim.num(), prim.num(), {
47705
+ apply: numImplVAbs(Math.min),
47706
+ restName: "...values",
47707
+ name: "Math.min"
47708
+ }),
47129
47709
  pow: envFn([prim.num(), prim.num()], prim.num(), numImpl2Abs(Math.pow)),
47130
47710
  sqrt: envFn([prim.num()], prim.num(), numImpl1Abs(Math.sqrt)),
47131
47711
  cbrt: envFn([prim.num()], prim.num(), numImpl1Abs(Math.cbrt)),
@@ -47141,7 +47721,11 @@ function defineEnv() {
47141
47721
  acos: envFn([prim.num()], prim.num(), numImpl1Abs(Math.acos)),
47142
47722
  atan: envFn([prim.num()], prim.num(), numImpl1Abs(Math.atan)),
47143
47723
  atan2: envFn([prim.num(), prim.num()], prim.num(), numImpl2Abs(Math.atan2)),
47144
- hypot: envFn([prim.num(), prim.num()], prim.num(), numImpl2Abs(Math.hypot)),
47724
+ hypot: envFnVariadic(prim.num(), prim.num(), {
47725
+ apply: numImplVAbs(Math.hypot),
47726
+ restName: "...values",
47727
+ name: "Math.hypot"
47728
+ }),
47145
47729
  clz32: envFn([prim.num()], prim.num(), numImpl1Abs(Math.clz32)),
47146
47730
  imul: envFn([prim.num(), prim.num()], prim.num(), numImpl2Abs(Math.imul)),
47147
47731
  fround: envFn([prim.num()], prim.num(), numImpl1Abs(Math.fround)),
@@ -47154,28 +47738,44 @@ function defineEnv() {
47154
47738
  SQRT2: prim.num(),
47155
47739
  SQRT1_2: prim.num()
47156
47740
  }),
47157
- Number: objAbs({
47158
- isFinite: envFn([prim.unknown], prim.bool(), isFiniteImplAbs),
47159
- isInteger: envFn([prim.unknown], prim.bool(), isIntegerImplAbs),
47160
- isNaN: envFn([prim.unknown], prim.bool(), isNaNImplAbs),
47161
- isSafeInteger: envFn([prim.unknown], prim.bool(), isSafeIntegerImplAbs),
47162
- parseFloat: envFn([prim.str()], prim.num(), parseFloatImplAbs),
47163
- parseInt: envFn([prim.str()], prim.num(), parseIntImplAbs),
47164
- MAX_SAFE_INTEGER: prim.num(),
47165
- MIN_SAFE_INTEGER: prim.num(),
47166
- MAX_VALUE: prim.num(),
47167
- MIN_VALUE: prim.num(),
47168
- POSITIVE_INFINITY: prim.num(),
47169
- NEGATIVE_INFINITY: prim.num(),
47170
- NaN: prim.num(),
47171
- EPSILON: prim.num()
47741
+ // dual-facet:Number/Array 既可调用/构造,又带静态槽。
47742
+ // 此前 objAbs 遮蔽宿主全局后 $call/$new 折 unknown(issue #58)。
47743
+ Number: envFn([prim.unknown], prim.num(), numberImplAbs, {
47744
+ name: "Number",
47745
+ params: ["value"],
47746
+ slots: {
47747
+ isFinite: envFn([prim.unknown], prim.bool(), isFiniteImplAbs),
47748
+ isInteger: envFn([prim.unknown], prim.bool(), isIntegerImplAbs),
47749
+ isNaN: envFn([prim.unknown], prim.bool(), isNaNImplAbs),
47750
+ isSafeInteger: envFn([prim.unknown], prim.bool(), isSafeIntegerImplAbs),
47751
+ parseFloat: envFn([prim.str()], prim.num(), parseFloatImplAbs),
47752
+ parseInt: envFn([prim.str()], prim.num(), parseIntImplAbs),
47753
+ MAX_SAFE_INTEGER: prim.num(),
47754
+ MIN_SAFE_INTEGER: prim.num(),
47755
+ MAX_VALUE: prim.num(),
47756
+ MIN_VALUE: prim.num(),
47757
+ POSITIVE_INFINITY: prim.num(),
47758
+ NEGATIVE_INFINITY: prim.num(),
47759
+ NaN: prim.num(),
47760
+ EPSILON: prim.num()
47761
+ }
47762
+ }),
47763
+ Boolean: envFn([prim.unknown], prim.bool(), booleanImplAbs, {
47764
+ name: "Boolean",
47765
+ params: ["value"]
47172
47766
  }),
47173
- Boolean: envFn([prim.unknown], prim.bool(), booleanImplAbs),
47174
- String: envFn([prim.unknown], prim.str(), stringImplAbs),
47175
- Array: objAbs({
47176
- isArray: envFn([prim.unknown], prim.bool(), isArrayImplAbs),
47177
- from: envFn([prim.unknown], arrOf2(prim.unknown)),
47178
- of: envFn([prim.unknown], arrOf2(prim.unknown))
47767
+ String: envFn([prim.unknown], prim.str(), stringImplAbs, {
47768
+ name: "String",
47769
+ params: ["value"]
47770
+ }),
47771
+ Array: envFn([prim.unknown], arrOf2(prim.unknown), arrayImplAbs, {
47772
+ name: "Array",
47773
+ params: ["items"],
47774
+ slots: {
47775
+ isArray: envFn([prim.unknown], prim.bool(), isArrayImplAbs),
47776
+ from: envFn([prim.unknown], arrOf2(prim.unknown)),
47777
+ of: envFn([prim.unknown], arrOf2(prim.unknown))
47778
+ }
47179
47779
  }),
47180
47780
  console: objAbs(consoleSlots),
47181
47781
  parseInt: envFn([prim.str(), prim.num()], prim.num(), parseIntImplAbs),
@@ -47200,21 +47800,29 @@ function defineEnv() {
47200
47800
  SyntaxError: envFn([prim.str()], errorBrandOf("SyntaxError")),
47201
47801
  ReferenceError: envFn([prim.str()], errorBrandOf("ReferenceError")),
47202
47802
  URIError: envFn([prim.str()], errorBrandOf("URIError")),
47203
- Promise: objAbs({
47204
- resolve: envFn([prim.unknown], promiseOf2(prim.unknown), promiseResolveImplAbs),
47205
- reject: envFn([prim.unknown], promiseOf2(prim.never)),
47206
- all: envFn([arrOf2(promiseOf2(prim.unknown))], promiseOf2(arrOf2(prim.unknown))),
47207
- allSettled: envFn(
47208
- [arrOf2(promiseOf2(prim.unknown))],
47209
- promiseOf2(arrOf2(prim.unknown))
47210
- ),
47211
- race: envFn([arrOf2(promiseOf2(prim.unknown))], promiseOf2(prim.unknown)),
47212
- any: envFn([arrOf2(promiseOf2(prim.unknown))], promiseOf2(prim.unknown))
47803
+ Promise: envFn([prim.unknown], promiseOf2(prim.unknown), promiseCtorImplAbs, {
47804
+ name: "Promise",
47805
+ params: ["executor"],
47806
+ slots: {
47807
+ resolve: envFn([prim.unknown], promiseOf2(prim.unknown), promiseResolveImplAbs),
47808
+ reject: envFn([prim.unknown], promiseOf2(prim.never)),
47809
+ all: envFn([arrOf2(promiseOf2(prim.unknown))], promiseOf2(arrOf2(prim.unknown))),
47810
+ allSettled: envFn(
47811
+ [arrOf2(promiseOf2(prim.unknown))],
47812
+ promiseOf2(arrOf2(prim.unknown))
47813
+ ),
47814
+ race: envFn([arrOf2(promiseOf2(prim.unknown))], promiseOf2(prim.unknown)),
47815
+ any: envFn([arrOf2(promiseOf2(prim.unknown))], promiseOf2(prim.unknown))
47816
+ }
47213
47817
  }),
47214
- Date: objAbs({
47215
- now: envFn([], prim.num()),
47216
- parse: envFn([prim.str()], prim.num()),
47217
- UTC: envFn([prim.num(), prim.num()], prim.num())
47818
+ Date: envFn([], dateAbs(), dateCtorImplAbs, {
47819
+ name: "Date",
47820
+ params: ["value"],
47821
+ slots: {
47822
+ now: envFn([], prim.num()),
47823
+ parse: envFn([prim.str()], prim.num()),
47824
+ UTC: envFn([prim.num(), prim.num()], prim.num())
47825
+ }
47218
47826
  }),
47219
47827
  Symbol: envFn([prim.str()], brandOf2("Symbol")),
47220
47828
  Reflect: objAbs({
@@ -48996,7 +49604,7 @@ function envLimits(env2) {
48996
49604
  return {
48997
49605
  maxFiles: parseLimit(env2.NUDO_CACHE_MAX_FILES, NaN),
48998
49606
  maxFns: parseLimit(env2.NUDO_CACHE_MAX_FNS, NaN),
48999
- maxBRuns: parseLimit(env2.NUDO_CACHE_MAX_BRUNS, NaN)
49607
+ maxEvalRuns: parseLimit(env2.NUDO_CACHE_MAX_EVALRUNS, NaN)
49000
49608
  };
49001
49609
  }
49002
49610
  function pick2(key, env2, fallback) {
@@ -49013,7 +49621,7 @@ function getSessionCacheLimits(env2 = process.env) {
49013
49621
  return {
49014
49622
  maxFiles: pick2("maxFiles", envCache, DEFAULT_SESSION_CACHE_LIMITS.maxFiles),
49015
49623
  maxFns: pick2("maxFns", envCache, DEFAULT_SESSION_CACHE_LIMITS.maxFns),
49016
- maxBRuns: pick2("maxBRuns", envCache, DEFAULT_SESSION_CACHE_LIMITS.maxBRuns)
49624
+ maxEvalRuns: pick2("maxEvalRuns", envCache, DEFAULT_SESSION_CACHE_LIMITS.maxEvalRuns)
49017
49625
  };
49018
49626
  }
49019
49627
  function setSessionCacheLimits(partial2) {
@@ -49035,7 +49643,7 @@ var init_session_cache_limits = __esm({
49035
49643
  DEFAULT_SESSION_CACHE_LIMITS = {
49036
49644
  maxFiles: 64,
49037
49645
  maxFns: 1024,
49038
- maxBRuns: 32
49646
+ maxEvalRuns: 32
49039
49647
  };
49040
49648
  HARD_CAP = 65536;
49041
49649
  explicit = {};
@@ -49092,7 +49700,7 @@ function analysisConfig(config) {
49092
49700
  diagnostics,
49093
49701
  callSiteBudget,
49094
49702
  evalMissingSlot: raw?.evalMissingSlot === "warning" ? "warning" : "off",
49095
- maxForks: parseMaxForks(raw?.maxForks) ?? MAX_B_TOTAL_FORKS
49703
+ maxForks: parseMaxForks(raw?.maxForks) ?? MAX_EVAL_TOTAL_FORKS
49096
49704
  };
49097
49705
  }
49098
49706
  function parseMaxForks(raw) {
@@ -49104,10 +49712,10 @@ function applyBForkBudgetFromConfig(config, env2 = process.env) {
49104
49712
  env2.NUDO_MAX_FORKS === void 0 ? void 0 : Number(env2.NUDO_MAX_FORKS)
49105
49713
  );
49106
49714
  const fromCfg = parseMaxForks(config?.analysis?.maxForks);
49107
- return setBForkBudgetLimit(fromEnv ?? fromCfg ?? MAX_B_TOTAL_FORKS);
49715
+ return setEvalForkBudgetLimit(fromEnv ?? fromCfg ?? MAX_EVAL_TOTAL_FORKS);
49108
49716
  }
49109
49717
  function currentBForkBudgetLimit() {
49110
- return getBForkBudgetLimit();
49718
+ return getEvalForkBudgetLimit();
49111
49719
  }
49112
49720
  function diskCacheRoot(config, projectDir) {
49113
49721
  const raw = config?.cache;
@@ -167195,7 +167803,7 @@ ${lanes.join("\n")}
167195
167803
  return visitEachChild(node, visitor, context);
167196
167804
  }
167197
167805
  }
167198
- function flattenChain(chain) {
167806
+ function flattenChain2(chain) {
167199
167807
  Debug.assertNotNode(chain, isNonNullChain);
167200
167808
  const links = [chain];
167201
167809
  while (!chain.questionDotToken && !isTaggedTemplateExpression2(chain)) {
@@ -167275,7 +167883,7 @@ ${lanes.join("\n")}
167275
167883
  }
167276
167884
  }
167277
167885
  function visitOptionalExpression(node, captureThisArg, isDelete) {
167278
- const { expression: expression2, chain } = flattenChain(node);
167886
+ const { expression: expression2, chain } = flattenChain2(node);
167279
167887
  const left = visitNonOptionalExpression(
167280
167888
  skipPartiallyEmittedExpressions(expression2),
167281
167889
  isCallChain(chain[0]),
@@ -265584,7 +266192,7 @@ function topLevelFnParams(file) {
265584
266192
  }
265585
266193
  return out;
265586
266194
  }
265587
- function bPathExportsToModuleExports(run, file, fingerprintPrefix) {
266195
+ function evalExportsToModuleExports(run, file, fingerprintPrefix) {
265588
266196
  const named = {};
265589
266197
  let def;
265590
266198
  const paramTable = topLevelFnParams(file);
@@ -265597,7 +266205,7 @@ function bPathExportsToModuleExports(run, file, fingerprintPrefix) {
265597
266205
  const params = paramTable.get(k) ?? Array.from({ length: v2.length ?? 0 }, (_, i) => `arg${i}`);
265598
266206
  absVal = absFunction(params, {
265599
266207
  apply: (args) => callTranspiledExportFull(run, k, args).result,
265600
- kind: "bpath-export",
266208
+ kind: "eval-export",
265601
266209
  // 无 body 的桥接 fn 预算键 = fingerprint ?? anon#N——缺省会让所有
265602
266210
  // 桥接导出共享 anon#1,嵌套跨模块调用(a 调 b 调 a')撞
265603
266211
  // _activeCallKeys 递归守卫被误截断为 opaque。按 模块#导出 唯一化。
@@ -265699,9 +266307,9 @@ function evalAbsModuleGraph(entrySource, entryFile, opts = {}) {
265699
266307
  }
265700
266308
  );
265701
266309
  let exports;
265702
- const bRun = tryRunTranspiled(source, { mode: "analyze", modules: modules2 });
265703
- if (bRun) {
265704
- exports = bPathExportsToModuleExports(bRun, parse2(source), `bpath:${absPath}`);
266310
+ const evalRun = tryRunTranspiled(source, { mode: "analyze", modules: modules2 });
266311
+ if (evalRun) {
266312
+ exports = evalExportsToModuleExports(evalRun, parse2(source), `eval:${absPath}`);
265705
266313
  } else {
265706
266314
  exports = { named: {} };
265707
266315
  }
@@ -265789,7 +266397,7 @@ function collectAbsBindingsFromGraph(source, filePath, opts = {}) {
265789
266397
  if (isAbsVal2(v2)) out.set(name, v2);
265790
266398
  }
265791
266399
  }
265792
- const exports = bPathExportsToModuleExports(run, parse2(source), `bpath:bindings:${filePath}`);
266400
+ const exports = evalExportsToModuleExports(run, parse2(source), `eval:bindings:${filePath}`);
265793
266401
  for (const [name, v2] of Object.entries(exports.named)) {
265794
266402
  if (!out.has(name)) out.set(name, v2);
265795
266403
  }
@@ -265949,7 +266557,7 @@ function loadMockModuleExports(fromPath, fromFile, loadModule) {
265949
266557
  error: evaled.error.includes("not found") ? `Mock module not found (from "${fromPath}")` : evaled.error
265950
266558
  };
265951
266559
  }
265952
- const exports = bPathExportsToModuleExports(evaled.run, parse2(evaled.source), `mock-module:${fromPath}`);
266560
+ const exports = evalExportsToModuleExports(evaled.run, parse2(evaled.source), `mock-module:${fromPath}`);
265953
266561
  if (exports.default === void 0 && Object.keys(exports.named).length > 0) {
265954
266562
  const slots = {};
265955
266563
  for (const [k, v2] of Object.entries(exports.named)) slots[k] = { value: v2 };
@@ -266142,7 +266750,7 @@ var init_fn_analysis_cache = __esm({
266142
266750
  }
266143
266751
  });
266144
266752
 
266145
- // ../service/src/bpath-run.ts
266753
+ // ../service/src/eval-run.ts
266146
266754
  function absSeedPart(a) {
266147
266755
  const impl = getFnImpl(a);
266148
266756
  if (impl?.fingerprint) return impl.fingerprint;
@@ -266249,7 +266857,7 @@ function mergeHarvestUnderEnv(harvestModules, envModules, opts) {
266249
266857
  }
266250
266858
  return out;
266251
266859
  }
266252
- function collectBPathReplacements(source) {
266860
+ function collectEvalReplacements(source) {
266253
266861
  const targets = [];
266254
266862
  const values = {};
266255
266863
  const asTargets = [];
@@ -266301,12 +266909,12 @@ function collectBPathReplacements(source) {
266301
266909
  }
266302
266910
  return { targets, values, asTargets, asValues };
266303
266911
  }
266304
- function isBPathCapable(source, envNames = []) {
266912
+ function isEvalCapable(source, envNames = []) {
266305
266913
  void envNames;
266306
266914
  void source;
266307
266915
  return true;
266308
266916
  }
266309
- function bPathDepKey(source, filePath) {
266917
+ function evalDepKey(source, filePath) {
266310
266918
  try {
266311
266919
  const fp = loadModuleDepsFingerprint(source, defaultLoadModule, filePath);
266312
266920
  if (fp.truncated) return null;
@@ -266315,52 +266923,52 @@ function bPathDepKey(source, filePath) {
266315
266923
  return null;
266316
266924
  }
266317
266925
  }
266318
- function clearBPathCache() {
266319
- bRunByFile.clear();
266926
+ function clearEvalCache() {
266927
+ evalRunByFile.clear();
266320
266928
  clearAnalysisFileCache();
266321
266929
  clearFnAnalysisCache();
266322
266930
  }
266323
- function getBPathCacheSize() {
266324
- return bRunByFile.size;
266931
+ function getEvalCacheSize() {
266932
+ return evalRunByFile.size;
266325
266933
  }
266326
- function evictBPathCacheForFiles(files) {
266934
+ function evictEvalCacheForFiles(files) {
266327
266935
  let n = 0;
266328
266936
  for (const f of files) {
266329
- if (bRunByFile.delete(f)) n++;
266937
+ if (evalRunByFile.delete(f)) n++;
266330
266938
  }
266331
266939
  return n;
266332
266940
  }
266333
- function bPathCacheSet(filePath, stableSource, mode, envKey, mockKey, depKey, value) {
266334
- const max = getSessionCacheLimits().maxBRuns;
266941
+ function evalCacheSet(filePath, stableSource, mode, envKey, mockKey, depKey, value) {
266942
+ const max = getSessionCacheLimits().maxEvalRuns;
266335
266943
  if (max <= 0) return;
266336
- while (bRunByFile.size >= max && !bRunByFile.has(filePath)) {
266337
- const oldest = bRunByFile.keys().next().value;
266944
+ while (evalRunByFile.size >= max && !evalRunByFile.has(filePath)) {
266945
+ const oldest = evalRunByFile.keys().next().value;
266338
266946
  if (oldest === void 0) break;
266339
- bRunByFile.delete(oldest);
266947
+ evalRunByFile.delete(oldest);
266340
266948
  }
266341
- bRunByFile.set(filePath, { stableSource, mode, envKey, mockKey, depKey, value });
266949
+ evalRunByFile.set(filePath, { stableSource, mode, envKey, mockKey, depKey, value });
266342
266950
  }
266343
- function trimBPathCache() {
266344
- const max = getSessionCacheLimits().maxBRuns;
266345
- while (bRunByFile.size > max) {
266346
- const oldest = bRunByFile.keys().next().value;
266951
+ function trimEvalCache() {
266952
+ const max = getSessionCacheLimits().maxEvalRuns;
266953
+ while (evalRunByFile.size > max) {
266954
+ const oldest = evalRunByFile.keys().next().value;
266347
266955
  if (oldest === void 0) break;
266348
- bRunByFile.delete(oldest);
266956
+ evalRunByFile.delete(oldest);
266349
266957
  }
266350
266958
  }
266351
- function tryRunBPath(source, filePath, opts = {}) {
266352
- if (!isBPathCapable(source, opts.envNames ?? [])) return void 0;
266959
+ function tryRunEval(source, filePath, opts = {}) {
266960
+ if (!isEvalCapable(source, opts.envNames ?? [])) return void 0;
266353
266961
  const mode = opts.mode ?? "analyze";
266354
266962
  const envKey = (opts.envNames ?? []).join(",");
266355
266963
  const mockKey = mockSeedFingerprint(opts.mocks);
266356
266964
  const stable = stableAnalyzeKeySource(source);
266357
- const depKey = bPathDepKey(source, filePath);
266965
+ const depKey = evalDepKey(source, filePath);
266358
266966
  const canCache = depKey !== null;
266359
266967
  if (canCache) {
266360
- const cached2 = bRunByFile.get(filePath);
266968
+ const cached2 = evalRunByFile.get(filePath);
266361
266969
  if (cached2 && cached2.stableSource === stable && cached2.mode === mode && cached2.envKey === envKey && cached2.mockKey === mockKey && cached2.depKey === depKey) {
266362
- bRunByFile.delete(filePath);
266363
- bRunByFile.set(filePath, cached2);
266970
+ evalRunByFile.delete(filePath);
266971
+ evalRunByFile.set(filePath, cached2);
266364
266972
  return cached2.value ?? void 0;
266365
266973
  }
266366
266974
  }
@@ -266371,14 +266979,14 @@ function tryRunBPath(source, filePath, opts = {}) {
266371
266979
  const topCalls = [];
266372
266980
  const prevMember = setMemberDiagCollector((d) => memberDiags.push(d));
266373
266981
  const prevTrunc = setAbsTruncationCollector((label) => truncated.add(label));
266374
- const prevCall = setBCallCollector((r) => topCalls.push(r));
266982
+ const prevCall = setEvalCallCollector((r) => topCalls.push(r));
266375
266983
  try {
266376
266984
  const { modules: graphMods, issues } = evalAbsModuleGraph(source, filePath);
266377
266985
  const envMods = collectEnvModules(opts.envNames ?? []);
266378
266986
  let modules = mergeHarvestUnderEnv(graphMods, envMods);
266379
266987
  const mm = applyMockModuleDirectivesFromSource(source, modules, { fromFile: filePath });
266380
266988
  modules = mm.modules;
266381
- const { targets, values, asTargets, asValues } = collectBPathReplacements(source);
266989
+ const { targets, values, asTargets, asValues } = collectEvalReplacements(source);
266382
266990
  const envGlobals = {
266383
266991
  ...collectEnvGlobals(opts.envNames ?? []),
266384
266992
  ...opts.mocks ?? {}
@@ -266405,23 +267013,23 @@ function tryRunBPath(source, filePath, opts = {}) {
266405
267013
  } finally {
266406
267014
  setMemberDiagCollector(prevMember);
266407
267015
  setAbsTruncationCollector(prevTrunc);
266408
- setBCallCollector(prevCall);
267016
+ setEvalCallCollector(prevCall);
266409
267017
  }
266410
267018
  } catch {
266411
267019
  out = null;
266412
267020
  }
266413
267021
  if (canCache && depKey !== null) {
266414
- bPathCacheSet(filePath, stable, mode, envKey, mockKey, depKey, out);
267022
+ evalCacheSet(filePath, stable, mode, envKey, mockKey, depKey, out);
266415
267023
  }
266416
267024
  return out ?? void 0;
266417
267025
  }
266418
- function tryBPathCallFull(source, filePath, fnName, args, opts = {}) {
266419
- const run = tryRunBPath(source, filePath, { envNames: opts.envNames, mocks: opts.mocks });
267026
+ function tryEvalCallFull(source, filePath, fnName, args, opts = {}) {
267027
+ const run = tryRunEval(source, filePath, { envNames: opts.envNames, mocks: opts.mocks });
266420
267028
  if (!run) return void 0;
266421
267029
  if (!(fnName in run.exports)) return void 0;
266422
267030
  const collected = [];
266423
267031
  const memberDiags = [];
266424
- const prevCall = opts.collectCalls ? setBCallCollector((r) => collected.push(r)) : void 0;
267032
+ const prevCall = opts.collectCalls ? setEvalCallCollector((r) => collected.push(r)) : void 0;
266425
267033
  const wantMember = opts.collectMemberDiags ?? true;
266426
267034
  const prevMember = wantMember ? setMemberDiagCollector((d) => memberDiags.push(d)) : void 0;
266427
267035
  try {
@@ -266435,12 +267043,12 @@ function tryBPathCallFull(source, filePath, fnName, args, opts = {}) {
266435
267043
  truncatedFns: run.truncatedFns
266436
267044
  };
266437
267045
  } finally {
266438
- if (opts.collectCalls) setBCallCollector(prevCall ?? null);
267046
+ if (opts.collectCalls) setEvalCallCollector(prevCall ?? null);
266439
267047
  if (wantMember) setMemberDiagCollector(prevMember ?? null);
266440
267048
  }
266441
267049
  }
266442
- function tryBPathCall(source, filePath, fnName, args, opts = {}) {
266443
- const full = tryBPathCallFull(source, filePath, fnName, args, opts);
267050
+ function tryEvalCall(source, filePath, fnName, args, opts = {}) {
267051
+ const full = tryEvalCallFull(source, filePath, fnName, args, opts);
266444
267052
  if (!full) return void 0;
266445
267053
  const r = full.result;
266446
267054
  if (!r) return void 0;
@@ -266450,9 +267058,9 @@ function tryBPathCall(source, filePath, fnName, args, opts = {}) {
266450
267058
  if (r.shape.k === "unknown" && !r.term) return void 0;
266451
267059
  return r;
266452
267060
  }
266453
- var envHarvestConflictCollector, bRunByFile;
266454
- var init_bpath_run = __esm({
266455
- "../service/src/bpath-run.ts"() {
267061
+ var envHarvestConflictCollector, evalRunByFile;
267062
+ var init_eval_run = __esm({
267063
+ "../service/src/eval-run.ts"() {
266456
267064
  "use strict";
266457
267065
  init_src();
266458
267066
  init_internal();
@@ -266465,7 +267073,7 @@ var init_bpath_run = __esm({
266465
267073
  init_fn_analysis_cache();
266466
267074
  init_load_module();
266467
267075
  envHarvestConflictCollector = null;
266468
- bRunByFile = /* @__PURE__ */ new Map();
267076
+ evalRunByFile = /* @__PURE__ */ new Map();
266469
267077
  }
266470
267078
  });
266471
267079
 
@@ -266564,7 +267172,7 @@ function tryEvalAbsFull(source, fnName, args, filePath, mocks, assignedName) {
266564
267172
  if (/\brequire\s*\(/.test(source)) return void 0;
266565
267173
  try {
266566
267174
  if (filePath) {
266567
- const viaB = tryBPathCallFull(source, filePath, fnName, args, { mocks }) ?? (assignedName ? tryBPathCallFull(source, filePath, assignedName, args, { mocks }) : void 0);
267175
+ const viaB = tryEvalCallFull(source, filePath, fnName, args, { mocks }) ?? (assignedName ? tryEvalCallFull(source, filePath, assignedName, args, { mocks }) : void 0);
266568
267176
  if (viaB) {
266569
267177
  const r = viaB.result;
266570
267178
  if (r && !(r.shape.k === "unknown" && !r.term)) {
@@ -266685,7 +267293,7 @@ var init_analyzer_abs_eval = __esm({
266685
267293
  init_src();
266686
267294
  init_src2();
266687
267295
  init_call_record();
266688
- init_bpath_run();
267296
+ init_eval_run();
266689
267297
  }
266690
267298
  });
266691
267299
 
@@ -266874,7 +267482,7 @@ function loadFromMockBinding(name, fromPath, fromFile, loadModule) {
266874
267482
  const params = Array.from({ length: fn2.length ?? 0 }, (_, i) => `arg${i}`);
266875
267483
  absVal = absFunction(params, {
266876
267484
  apply: (args) => callTranspiledExportFull(run, name, args).result,
266877
- kind: "bpath-export",
267485
+ kind: "eval-export",
266878
267486
  fingerprint: `from-mock=${fromPath}#${name}`
266879
267487
  });
266880
267488
  } else {
@@ -266963,7 +267571,7 @@ function collectCallRecords(filePath, source) {
266963
267571
  const mocks = mockSeedsForSource(source, {
266964
267572
  fromFile: filePath || void 0
266965
267573
  });
266966
- const run = tryRunBPath(source, filePath, {
267574
+ const run = tryRunEval(source, filePath, {
266967
267575
  mode: "exec",
266968
267576
  lenientGlobals: true,
266969
267577
  ...Object.keys(mocks).length > 0 ? { mocks } : {}
@@ -266996,13 +267604,13 @@ function expandTestCallbacks(calls) {
266996
267604
  const impl = getFnImpl(abs2);
266997
267605
  const params = impl?.params ?? [];
266998
267606
  const collected = [];
266999
- const prev = getBCallCollector();
267000
- setBCallCollector((r) => collected.push(r));
267607
+ const prev = getEvalCallCollector();
267608
+ setEvalCallCollector((r) => collected.push(r));
267001
267609
  try {
267002
267610
  $call(abs2, params.map(() => unknown));
267003
267611
  } catch {
267004
267612
  } finally {
267005
- setBCallCollector(prev);
267613
+ setEvalCallCollector(prev);
267006
267614
  }
267007
267615
  out.push(...collected);
267008
267616
  expanded++;
@@ -267017,12 +267625,12 @@ var init_analyzer_orchestrate_calls = __esm({
267017
267625
  init_src2();
267018
267626
  init_mock_abs();
267019
267627
  init_config();
267020
- init_bpath_run();
267628
+ init_eval_run();
267021
267629
  init_analyzer_abs_eval();
267022
267630
  }
267023
267631
  });
267024
267632
 
267025
- // ../service/src/bpath-diagnostics.ts
267633
+ // ../service/src/eval-diagnostics.ts
267026
267634
  function locOf2(node) {
267027
267635
  if (!node.loc) return null;
267028
267636
  return {
@@ -267194,7 +267802,7 @@ function walkBuiltinUnknown(node, declared, out, seen, known, parentKey) {
267194
267802
  }
267195
267803
  }
267196
267804
  }
267197
- function collectBPathDiagnostics(source, extraKnown) {
267805
+ function collectEvalDiagnostics(source, extraKnown) {
267198
267806
  let file;
267199
267807
  try {
267200
267808
  file = parseSource(source);
@@ -267214,8 +267822,8 @@ function collectBPathDiagnostics(source, extraKnown) {
267214
267822
  return { unreachable, builtinUnknown };
267215
267823
  }
267216
267824
  var KNOWN_GLOBALS;
267217
- var init_bpath_diagnostics = __esm({
267218
- "../service/src/bpath-diagnostics.ts"() {
267825
+ var init_eval_diagnostics = __esm({
267826
+ "../service/src/eval-diagnostics.ts"() {
267219
267827
  "use strict";
267220
267828
  init_src();
267221
267829
  KNOWN_GLOBALS = /* @__PURE__ */ new Set([
@@ -267289,13 +267897,13 @@ function detectEntryVariantsFromPackageJson(pkg) {
267289
267897
  const browser = [];
267290
267898
  const node = [];
267291
267899
  collectExportFaces(p.exports, browser, node);
267292
- const bField = p.browser;
267293
- if (typeof bField === "string") browser.push(bField);
267294
- else if (bField && typeof bField === "object") {
267295
- for (const v2 of Object.values(bField)) {
267900
+ const evalField = p.browser;
267901
+ if (typeof evalField === "string") browser.push(evalField);
267902
+ else if (evalField && typeof evalField === "object") {
267903
+ for (const v2 of Object.values(evalField)) {
267296
267904
  if (typeof v2 === "string") browser.push(v2);
267297
267905
  }
267298
- for (const k of Object.keys(bField)) {
267906
+ for (const k of Object.keys(evalField)) {
267299
267907
  if (k.startsWith(".")) node.push(k);
267300
267908
  }
267301
267909
  }
@@ -267457,13 +268065,13 @@ function analyzeFileUncachedInner(filePath, source, activeCases, externalCallRec
267457
268065
  const callSiteBudget = analysisCfg.callSiteBudget;
267458
268066
  const callRecords = [];
267459
268067
  const globalEnv = createEnvironment();
267460
- const bMemberDiagNames = /* @__PURE__ */ new Set();
267461
- const bMemberDiagSeen = /* @__PURE__ */ new Set();
268068
+ const evalMemberDiagNames = /* @__PURE__ */ new Set();
268069
+ const evalMemberDiagSeen = /* @__PURE__ */ new Set();
267462
268070
  const pushBMemberDiag = (d, fallbackLine) => {
267463
- bMemberDiagNames.add(d.name);
268071
+ evalMemberDiagNames.add(d.name);
267464
268072
  const key = `${d.kind}:${d.name}:${d.receiver}:${d.line ?? fallbackLine}:${d.column ?? 0}:${d.code ?? ""}`;
267465
- if (bMemberDiagSeen.has(key)) return;
267466
- bMemberDiagSeen.add(key);
268073
+ if (evalMemberDiagSeen.has(key)) return;
268074
+ evalMemberDiagSeen.add(key);
267467
268075
  if (d.code === "nudo:missing-slot") {
267468
268076
  diagnostics.push({
267469
268077
  range: {
@@ -267506,15 +268114,15 @@ function analyzeFileUncachedInner(filePath, source, activeCases, externalCallRec
267506
268114
  }
267507
268115
  const selfContained = isSelfContainedSource(source, envNames);
267508
268116
  const canAbsModules = absModulesOk(source, envNames);
267509
- const bCapable = isBPathCapable(source, envNames);
267510
- const bModuleIssueKinds = /* @__PURE__ */ new Set();
267511
- const bTruncatedFns = /* @__PURE__ */ new Set();
267512
- const bBuiltinUnknownNames = /* @__PURE__ */ new Set();
267513
- let bHostedEval = false;
268117
+ const evalCapable = isEvalCapable(source, envNames);
268118
+ const evalModuleIssueKinds = /* @__PURE__ */ new Set();
268119
+ const evalTruncatedFns = /* @__PURE__ */ new Set();
268120
+ const evalBuiltinUnknownNames = /* @__PURE__ */ new Set();
268121
+ let evalHosted = false;
267514
268122
  const pushBModuleIssues = (issues) => {
267515
268123
  if (!issues) return;
267516
268124
  for (const iss of issues) {
267517
- bModuleIssueKinds.add(iss.kind);
268125
+ evalModuleIssueKinds.add(iss.kind);
267518
268126
  const code2 = iss.kind === "cycle" ? "nudo:module-cycle" : iss.kind === "depth" ? "nudo:module-depth" : "nudo:module-missing";
267519
268127
  diagnostics.push({
267520
268128
  range: { start: { line: 1, column: 0 }, end: { line: 1, column: 0 } },
@@ -267541,11 +268149,11 @@ function analyzeFileUncachedInner(filePath, source, activeCases, externalCallRec
267541
268149
  });
267542
268150
  }
267543
268151
  let absCallRecords = [];
267544
- let bTopCallRecords = [];
268152
+ let evalTopCallRecords = [];
267545
268153
  let absGraphModules;
267546
268154
  let absBindsShared;
267547
268155
  let absNodesShared;
267548
- if (bCapable && filePath) {
268156
+ if (evalCapable && filePath) {
267549
268157
  try {
267550
268158
  const g = evalAbsModuleGraph(source, filePath, {
267551
268159
  seedVars: seeds.seedVars,
@@ -267569,46 +268177,46 @@ function analyzeFileUncachedInner(filePath, source, activeCases, externalCallRec
267569
268177
  pushBModuleIssues(g.issues);
267570
268178
  } catch {
267571
268179
  }
267572
- const bRun = tryRunBPath(source, filePath, {
268180
+ const evalRun = tryRunEval(source, filePath, {
267573
268181
  envNames,
267574
268182
  mocks: mockSeedsToAbsMocks(seeds)
267575
268183
  });
267576
- if (bRun) {
267577
- bHostedEval = true;
267578
- if (bRun.memberDiags?.length) {
267579
- for (const d of bRun.memberDiags) {
268184
+ if (evalRun) {
268185
+ evalHosted = true;
268186
+ if (evalRun.memberDiags?.length) {
268187
+ for (const d of evalRun.memberDiags) {
267580
268188
  pushBMemberDiag(d, 1);
267581
268189
  }
267582
268190
  }
267583
- if (bRun.truncatedFns) {
267584
- for (const fn2 of bRun.truncatedFns) bTruncatedFns.add(fn2);
268191
+ if (evalRun.truncatedFns) {
268192
+ for (const fn2 of evalRun.truncatedFns) evalTruncatedFns.add(fn2);
267585
268193
  }
267586
- if (bRun.calls?.length) {
268194
+ if (evalRun.calls?.length) {
267587
268195
  const impMap = buildAbsImportLocalMap(source, filePath);
267588
- for (const c of bRun.calls) {
267589
- bTopCallRecords.push(callRecordFromAbsCall(c, impMap));
268196
+ for (const c of evalRun.calls) {
268197
+ evalTopCallRecords.push(callRecordFromAbsCall(c, impMap));
267590
268198
  }
267591
268199
  }
267592
268200
  }
267593
268201
  }
267594
- if (bHostedEval && bTopCallRecords.length > 0) {
268202
+ if (evalHosted && evalTopCallRecords.length > 0) {
267595
268203
  callRecords.length = 0;
267596
- callRecords.push(...bTopCallRecords);
268204
+ callRecords.push(...evalTopCallRecords);
267597
268205
  } else if ((selfContained || canAbsModules) && absCallRecords.length > 0) {
267598
268206
  callRecords.length = 0;
267599
268207
  callRecords.push(...absCallRecords);
267600
- } else if (bTopCallRecords.length > 0) {
268208
+ } else if (evalTopCallRecords.length > 0) {
267601
268209
  callRecords.length = 0;
267602
- callRecords.push(...bTopCallRecords);
268210
+ callRecords.push(...evalTopCallRecords);
267603
268211
  }
267604
268212
  const unreachableRanges = [];
267605
- if (bCapable) {
267606
- const bKnownGlobals = /* @__PURE__ */ new Set([
268213
+ if (evalCapable) {
268214
+ const evalKnownGlobals = /* @__PURE__ */ new Set([
267607
268215
  ...Object.keys(collectEnvGlobals(envNames)),
267608
268216
  ...Object.keys(mockSeedsToAbsMocks(seeds))
267609
268217
  ]);
267610
- const bDiag = collectBPathDiagnostics(source, bKnownGlobals);
267611
- for (const ur of bDiag.unreachable) {
268218
+ const evalDiag = collectEvalDiagnostics(source, evalKnownGlobals);
268219
+ for (const ur of evalDiag.unreachable) {
267612
268220
  diagnostics.push({
267613
268221
  range: ur.range,
267614
268222
  severity: "info",
@@ -267618,8 +268226,8 @@ function analyzeFileUncachedInner(filePath, source, activeCases, externalCallRec
267618
268226
  suggestions: ["Remove the unreachable code after the return/throw statement"]
267619
268227
  });
267620
268228
  }
267621
- for (const b of bDiag.builtinUnknown) {
267622
- bBuiltinUnknownNames.add(b.name);
268229
+ for (const b of evalDiag.builtinUnknown) {
268230
+ evalBuiltinUnknownNames.add(b.name);
267623
268231
  diagnostics.push({
267624
268232
  range: b.range,
267625
268233
  severity: "warning",
@@ -267643,7 +268251,7 @@ function analyzeFileUncachedInner(filePath, source, activeCases, externalCallRec
267643
268251
  });
267644
268252
  }
267645
268253
  }
267646
- if (!absNodesShared && !bHostedEval && (selfContained || canAbsModules)) {
268254
+ if (!absNodesShared && !evalHosted && (selfContained || canAbsModules)) {
267647
268255
  try {
267648
268256
  const collected = { binds: /* @__PURE__ */ new Map(), nodes: /* @__PURE__ */ new Map() };
267649
268257
  if (!absBindsShared) absBindsShared = collected.binds;
@@ -267652,7 +268260,7 @@ function analyzeFileUncachedInner(filePath, source, activeCases, externalCallRec
267652
268260
  }
267653
268261
  }
267654
268262
  collectBindings(ast, globalEnv, bindings, absBindsShared);
267655
- if (isBPathCapable(source, envNames)) {
268263
+ if (isEvalCapable(source, envNames)) {
267656
268264
  try {
267657
268265
  const absBinds = absBindsShared ?? collectAbsBindingsFromGraph(source, filePath, {
267658
268266
  seedVars: seeds.seedVars,
@@ -267783,36 +268391,36 @@ function analyzeFileUncachedInner(filePath, source, activeCases, externalCallRec
267783
268391
  let caseThrowsAbs;
267784
268392
  let caseThrowLoc;
267785
268393
  let caseUnreachable = [];
267786
- const bCapable2 = isBPathCapable(source, envNames);
267787
- const bPrimary = bCapable2;
267788
- if (bCapable2 && filePath) {
268394
+ const evalCapable2 = isEvalCapable(source, envNames);
268395
+ const evalPrimary = evalCapable2;
268396
+ if (evalCapable2 && filePath) {
267789
268397
  const caseArgsAbs = directive.argsAbs;
267790
- const bFull = tryBPathCallFull(
268398
+ const evalFull = tryEvalCallFull(
267791
268399
  source,
267792
268400
  filePath,
267793
268401
  fn2.name,
267794
268402
  caseArgsAbs,
267795
268403
  { collectCalls: true, envNames, mocks: mockSeedsToAbsMocks(seeds) }
267796
268404
  );
267797
- const res = bFull?.result;
268405
+ const res = evalFull?.result;
267798
268406
  const weakUnknown = !!res && res.shape.k === "unknown" && (!res.term || res.term.op === "lit" && res.term.value === void 0);
267799
- const bOk = !!res && (bHostedEval || !weakUnknown && res.conf !== "opaque");
267800
- if (bOk && bFull && bPrimary) {
267801
- caseAbs = bFull.result;
267802
- caseThrowsAbs = bFull.throws;
267803
- for (const d of bFull.memberDiags ?? []) {
268407
+ const evalOk = !!res && (evalHosted || !weakUnknown && res.conf !== "opaque");
268408
+ if (evalOk && evalFull && evalPrimary) {
268409
+ caseAbs = evalFull.result;
268410
+ caseThrowsAbs = evalFull.throws;
268411
+ for (const d of evalFull.memberDiags ?? []) {
267804
268412
  pushBMemberDiag(d, fnLoc.start.line);
267805
268413
  }
267806
- if (bFull.calls?.length) {
268414
+ if (evalFull.calls?.length) {
267807
268415
  const impMap = buildAbsImportLocalMap(source, filePath);
267808
- for (const c of bFull.calls) {
268416
+ for (const c of evalFull.calls) {
267809
268417
  callRecords.push(callRecordFromAbsCall(c, impMap));
267810
268418
  }
267811
268419
  }
267812
268420
  }
267813
268421
  }
267814
268422
  if (!caseAbs) {
267815
- if (bHostedEval) {
268423
+ if (evalHosted) {
267816
268424
  caseAbs = unknown;
267817
268425
  caseThrowsAbs = neverAbs;
267818
268426
  } else {
@@ -267885,7 +268493,7 @@ function analyzeFileUncachedInner(filePath, source, activeCases, externalCallRec
267885
268493
  code: "nudo:may-throw"
267886
268494
  });
267887
268495
  }
267888
- if (!isBPathCapable(source, envNames)) {
268496
+ if (!isEvalCapable(source, envNames)) {
267889
268497
  for (const ur of caseUnreachable) {
267890
268498
  diagnostics.push({
267891
268499
  range: ur,
@@ -268047,19 +268655,19 @@ function analyzeFileUncachedInner(filePath, source, activeCases, externalCallRec
268047
268655
  )
268048
268656
  );
268049
268657
  let symAbs;
268050
- if (isBPathCapable(source, envNames) && filePath) {
268051
- const bSym = tryBPathCall(
268658
+ if (isEvalCapable(source, envNames) && filePath) {
268659
+ const evalSym = tryEvalCall(
268052
268660
  source,
268053
268661
  filePath,
268054
268662
  candidate.name,
268055
268663
  widenedArgsAbs,
268056
268664
  { envNames, mocks: mockSeedsToAbsMocks(seeds) }
268057
268665
  );
268058
- if (bSym && (bHostedEval || !(bSym.shape.k === "unknown" && !bSym.term))) {
268059
- symAbs = bSym;
268666
+ if (evalSym && (evalHosted || !(evalSym.shape.k === "unknown" && !evalSym.term))) {
268667
+ symAbs = evalSym;
268060
268668
  }
268061
268669
  }
268062
- if (!symAbs && !bHostedEval) {
268670
+ if (!symAbs && !evalHosted) {
268063
268671
  const absTry = tryEvalAbsRaw(
268064
268672
  source,
268065
268673
  candidate.name,
@@ -268098,30 +268706,30 @@ function analyzeFileUncachedInner(filePath, source, activeCases, externalCallRec
268098
268706
  const entryEffects = [];
268099
268707
  setMayThrowCollector((e) => entryEffects.push(e));
268100
268708
  try {
268101
- if (isBPathCapable(source, envNames) && filePath) {
268102
- const bEntryFull = tryBPathCallFull(
268709
+ if (isEvalCapable(source, envNames) && filePath) {
268710
+ const evalEntryFull = tryEvalCallFull(
268103
268711
  source,
268104
268712
  filePath,
268105
268713
  candidate.analysis.name,
268106
268714
  argAbsEntry,
268107
268715
  { envNames, mocks: mockSeedsToAbsMocks(seeds), collectMemberDiags: true }
268108
- ) ?? (candidate.assignedName ? tryBPathCallFull(source, filePath, candidate.assignedName, argAbsEntry, {
268716
+ ) ?? (candidate.assignedName ? tryEvalCallFull(source, filePath, candidate.assignedName, argAbsEntry, {
268109
268717
  envNames,
268110
268718
  mocks: mockSeedsToAbsMocks(seeds)
268111
268719
  }) : void 0);
268112
- if (bEntryFull?.memberDiags?.length) {
268113
- for (const d of bEntryFull.memberDiags) {
268720
+ if (evalEntryFull?.memberDiags?.length) {
268721
+ for (const d of evalEntryFull.memberDiags) {
268114
268722
  pushBMemberDiag(d, candidate.analysis.loc.start.line);
268115
268723
  }
268116
268724
  }
268117
- const bEntry = bEntryFull?.result;
268118
- if (bEntry && (bHostedEval || !(bEntry.shape.k === "unknown" && !bEntry.term))) {
268119
- entryAbs = bEntry;
268120
- if (bEntryFull?.throws) entryThrowsAbs = bEntryFull.throws;
268725
+ const evalEntry = evalEntryFull?.result;
268726
+ if (evalEntry && (evalHosted || !(evalEntry.shape.k === "unknown" && !evalEntry.term))) {
268727
+ entryAbs = evalEntry;
268728
+ if (evalEntryFull?.throws) entryThrowsAbs = evalEntryFull.throws;
268121
268729
  }
268122
268730
  }
268123
268731
  if (!entryAbs) {
268124
- if (bHostedEval) {
268732
+ if (evalHosted) {
268125
268733
  entryAbs = unknown;
268126
268734
  entryThrowsAbs = abs({ k: "never" }, void 0, void 0, "exact");
268127
268735
  } else {
@@ -268192,7 +268800,7 @@ function analyzeFileUncachedInner(filePath, source, activeCases, externalCallRec
268192
268800
  } catch {
268193
268801
  }
268194
268802
  }
268195
- if (!bHostedEval) {
268803
+ if (!evalHosted) {
268196
268804
  buildNodeTypeMap(ast, globalEnv, nodeAbsMap);
268197
268805
  }
268198
268806
  const externalFunctions = synthesizeExternalFunctions(
@@ -268252,8 +268860,8 @@ var init_analyzer_orchestrate_uncached = __esm({
268252
268860
  init_mock_module();
268253
268861
  init_load_module();
268254
268862
  init_abs_modules_graph();
268255
- init_bpath_run();
268256
- init_bpath_diagnostics();
268863
+ init_eval_run();
268864
+ init_eval_diagnostics();
268257
268865
  init_entry_variants();
268258
268866
  init_fn_analysis_cache();
268259
268867
  init_analyzer_ast();
@@ -268725,14 +269333,14 @@ var init_dep_contents = __esm({
268725
269333
  // ../service/src/session-cache.ts
268726
269334
  function evictAnalysisCachesForFiles(files) {
268727
269335
  if (files.length === 0) return;
268728
- evictBPathCacheForFiles(files);
269336
+ evictEvalCacheForFiles(files);
268729
269337
  evictAnalysisFileCacheForFiles(files);
268730
269338
  evictFnAnalysisCacheForFiles(files);
268731
269339
  evictAbsModuleCacheFiles(files);
268732
269340
  clearPathEnvCaches();
268733
269341
  }
268734
269342
  function clearAnalysisSessionCaches() {
268735
- clearBPathCache();
269343
+ clearEvalCache();
268736
269344
  clearAbsModuleCache();
268737
269345
  clearPathEnvCaches();
268738
269346
  resetGeneralizeMemo();
@@ -268744,7 +269352,7 @@ function applySessionCacheConfig(config) {
268744
269352
  const limits = getSessionCacheLimits();
268745
269353
  trimAnalysisFileCache();
268746
269354
  trimFnAnalysisCache();
268747
- trimBPathCache();
269355
+ trimEvalCache();
268748
269356
  return limits;
268749
269357
  }
268750
269358
  function resetAllAnalysisCaches() {
@@ -268756,7 +269364,7 @@ var init_session_cache = __esm({
268756
269364
  "use strict";
268757
269365
  init_src();
268758
269366
  init_abs_modules_graph();
268759
- init_bpath_run();
269367
+ init_eval_run();
268760
269368
  init_analysis_file_cache();
268761
269369
  init_fn_analysis_cache();
268762
269370
  init_env_loader();
@@ -269005,18 +269613,18 @@ __export(src_exports4, {
269005
269613
  clearAbsModuleCache: () => clearAbsModuleCache,
269006
269614
  clearAnalysisFileCache: () => clearAnalysisFileCache,
269007
269615
  clearAnalysisSessionCaches: () => clearAnalysisSessionCaches,
269008
- clearBPathCache: () => clearBPathCache,
269009
269616
  clearEnvPathDeps: () => clearEnvPathDeps,
269617
+ clearEvalCache: () => clearEvalCache,
269010
269618
  clearFnAnalysisCache: () => clearFnAnalysisCache,
269011
269619
  clearPathEnvCaches: () => clearPathEnvCaches,
269012
269620
  collectAbsBindingsFromGraph: () => collectAbsBindingsFromGraph,
269013
- collectBPathDiagnostics: () => collectBPathDiagnostics,
269014
- collectBPathReplacements: () => collectBPathReplacements,
269015
269621
  collectCallRecords: () => collectCallRecords,
269016
269622
  collectDependencySpecs: () => collectDependencySpecs2,
269017
269623
  collectEnvGlobals: () => collectEnvGlobals,
269018
269624
  collectEnvModules: () => collectEnvModules,
269019
269625
  collectEnvNames: () => collectEnvNames,
269626
+ collectEvalDiagnostics: () => collectEvalDiagnostics,
269627
+ collectEvalReplacements: () => collectEvalReplacements,
269020
269628
  collectLoadDepContents: () => collectLoadDepContents,
269021
269629
  collectSkipReturns: () => collectSkipReturns,
269022
269630
  collectStaticImports: () => collectStaticImports,
@@ -269034,7 +269642,7 @@ __export(src_exports4, {
269034
269642
  evictAbsModuleCacheFiles: () => evictAbsModuleCacheFiles,
269035
269643
  evictAnalysisCachesForFiles: () => evictAnalysisCachesForFiles,
269036
269644
  evictAnalysisFileCacheForFiles: () => evictAnalysisFileCacheForFiles,
269037
- evictBPathCacheForFiles: () => evictBPathCacheForFiles,
269645
+ evictEvalCacheForFiles: () => evictEvalCacheForFiles,
269038
269646
  evictFnAnalysisCacheForFiles: () => evictFnAnalysisCacheForFiles,
269039
269647
  extractNudoImportSpecs: () => extractNudoImportSpecs,
269040
269648
  filterDiagnosticsByLevel: () => filterDiagnosticsByLevel,
@@ -269043,17 +269651,17 @@ __export(src_exports4, {
269043
269651
  getAbsModuleCacheSize: () => getAbsModuleCacheSize,
269044
269652
  getAnalysisFileCacheSize: () => getAnalysisFileCacheSize,
269045
269653
  getAnalysisSession: () => getAnalysisSession,
269046
- getBPathCacheSize: () => getBPathCacheSize,
269047
269654
  getEnvHarvestConflictCollector: () => getEnvHarvestConflictCollector,
269048
269655
  getEnvPathDepsSize: () => getEnvPathDepsSize,
269656
+ getEvalCacheSize: () => getEvalCacheSize,
269049
269657
  getFnAnalysisCacheSize: () => getFnAnalysisCacheSize,
269050
269658
  getPathEnvCacheSizes: () => getPathEnvCacheSizes,
269051
269659
  getSessionCacheLimits: () => getSessionCacheLimits,
269052
269660
  ifaceCacheKey: () => ifaceCacheKey,
269053
269661
  injectBindings: () => injectBindings,
269054
269662
  interfaceConfig: () => interfaceConfig,
269055
- isBPathCapable: () => isBPathCapable,
269056
269663
  isEnvTemplatePath: () => isEnvTemplatePath,
269664
+ isEvalCapable: () => isEvalCapable,
269057
269665
  isNudoTargetPath: () => isNudoTargetPath,
269058
269666
  isProjectConfigPath: () => isProjectConfigPath,
269059
269667
  isSidecarPath: () => isSidecarPath,
@@ -269078,11 +269686,11 @@ __export(src_exports4, {
269078
269686
  sourceHasNudoDirectives: () => hasNudoDirectives,
269079
269687
  topoSortDirty: () => topoSortDirty,
269080
269688
  trimAnalysisFileCache: () => trimAnalysisFileCache,
269081
- trimBPathCache: () => trimBPathCache,
269689
+ trimEvalCache: () => trimEvalCache,
269082
269690
  trimFnAnalysisCache: () => trimFnAnalysisCache,
269083
- tryBPathCall: () => tryBPathCall,
269084
- tryBPathCallFull: () => tryBPathCallFull,
269085
- tryRunBPath: () => tryRunBPath,
269691
+ tryEvalCall: () => tryEvalCall,
269692
+ tryEvalCallFull: () => tryEvalCallFull,
269693
+ tryRunEval: () => tryRunEval,
269086
269694
  typeExprToDirective: () => typeExprToDirective
269087
269695
  });
269088
269696
  var init_src4 = __esm({
@@ -269097,8 +269705,8 @@ var init_src4 = __esm({
269097
269705
  init_load_module();
269098
269706
  init_dep_contents();
269099
269707
  init_abs_modules_graph();
269100
- init_bpath_run();
269101
- init_bpath_diagnostics();
269708
+ init_eval_run();
269709
+ init_eval_diagnostics();
269102
269710
  init_mock_abs();
269103
269711
  init_mock_module();
269104
269712
  init_config();
@@ -269310,7 +269918,7 @@ var init_chunk_J2PUE4NV = __esm({
269310
269918
  }
269311
269919
  });
269312
269920
 
269313
- // ../service/dist/chunk-COMUCF3K.js
269921
+ // ../service/dist/chunk-3RCHDTBX.js
269314
269922
  import { readFileSync as readFileSync17, existsSync as existsSync18, statSync as statSync12, mkdirSync as mkdirSync5, writeFileSync as writeFileSync5 } from "fs";
269315
269923
  import { resolve as resolvePath2, join as joinPath2 } from "path";
269316
269924
  import { pathToFileURL as pathToFileURL2 } from "url";
@@ -269487,7 +270095,7 @@ function envLimits2(env2) {
269487
270095
  return {
269488
270096
  maxFiles: parseLimit2(env2.NUDO_CACHE_MAX_FILES, NaN),
269489
270097
  maxFns: parseLimit2(env2.NUDO_CACHE_MAX_FNS, NaN),
269490
- maxBRuns: parseLimit2(env2.NUDO_CACHE_MAX_BRUNS, NaN)
270098
+ maxEvalRuns: parseLimit2(env2.NUDO_CACHE_MAX_EVALRUNS, NaN)
269491
270099
  };
269492
270100
  }
269493
270101
  function pick3(key, env2, fallback) {
@@ -269504,7 +270112,7 @@ function getSessionCacheLimits2(env2 = process.env) {
269504
270112
  return {
269505
270113
  maxFiles: pick3("maxFiles", envCache2, DEFAULT_SESSION_CACHE_LIMITS2.maxFiles),
269506
270114
  maxFns: pick3("maxFns", envCache2, DEFAULT_SESSION_CACHE_LIMITS2.maxFns),
269507
- maxBRuns: pick3("maxBRuns", envCache2, DEFAULT_SESSION_CACHE_LIMITS2.maxBRuns)
270115
+ maxEvalRuns: pick3("maxEvalRuns", envCache2, DEFAULT_SESSION_CACHE_LIMITS2.maxEvalRuns)
269508
270116
  };
269509
270117
  }
269510
270118
  function setSessionCacheFromProject2(partial2) {
@@ -269533,7 +270141,7 @@ function analysisConfig2(config) {
269533
270141
  diagnostics,
269534
270142
  callSiteBudget,
269535
270143
  evalMissingSlot: raw?.evalMissingSlot === "warning" ? "warning" : "off",
269536
- maxForks: parseMaxForks2(raw?.maxForks) ?? MAX_B_TOTAL_FORKS
270144
+ maxForks: parseMaxForks2(raw?.maxForks) ?? MAX_EVAL_TOTAL_FORKS
269537
270145
  };
269538
270146
  }
269539
270147
  function parseMaxForks2(raw) {
@@ -269545,7 +270153,7 @@ function applyBForkBudgetFromConfig2(config, env2 = process.env) {
269545
270153
  env2.NUDO_MAX_FORKS === void 0 ? void 0 : Number(env2.NUDO_MAX_FORKS)
269546
270154
  );
269547
270155
  const fromCfg = parseMaxForks2(config?.analysis?.maxForks);
269548
- return setBForkBudgetLimit(fromEnv ?? fromCfg ?? MAX_B_TOTAL_FORKS);
270156
+ return setEvalForkBudgetLimit(fromEnv ?? fromCfg ?? MAX_EVAL_TOTAL_FORKS);
269549
270157
  }
269550
270158
  function diskCacheRoot2(config, projectDir) {
269551
270159
  const raw = config?.cache;
@@ -269710,8 +270318,8 @@ function resolveNpmJsEntry2(source, fromDir) {
269710
270318
  return tryFile(resolve22(pkgDir, subpath));
269711
270319
  }
269712
270320
  var BUILTIN_ERROR_CLASSES2, BUILTIN_PROTOTYPE_CLASSES2, numA2, strA2, boolA2, unkA2, undefA2, nullA2, OBJECT_PROTOTYPE_METHODS2, BUILTIN_PROTOTYPE_METHOD_APPROXIMATIONS2, BoundedLruMap3, envFactories2, impliedDeps2, PATH_ENV_CACHE_MAX2, PATH_ENV_BY_PATH_MAX2, PATH_ENV_BASE_DIRS_MAX2, pathEnvCache2, pathEnvByPath2, pathEnvBaseDirs2, DEFAULT_SESSION_CACHE_LIMITS2, HARD_CAP2, explicit2, fromProject2, envCache2, DEFAULT_ANALYSIS_EXCLUDE2, DEFAULT_ANALYSIS_MODE2;
269713
- var init_chunk_COMUCF3K = __esm({
269714
- "../service/dist/chunk-COMUCF3K.js"() {
270321
+ var init_chunk_3RCHDTBX = __esm({
270322
+ "../service/dist/chunk-3RCHDTBX.js"() {
269715
270323
  "use strict";
269716
270324
  init_src();
269717
270325
  init_es();
@@ -269972,7 +270580,7 @@ var init_chunk_COMUCF3K = __esm({
269972
270580
  DEFAULT_SESSION_CACHE_LIMITS2 = {
269973
270581
  maxFiles: 64,
269974
270582
  maxFns: 1024,
269975
- maxBRuns: 32
270583
+ maxEvalRuns: 32
269976
270584
  };
269977
270585
  HARD_CAP2 = 65536;
269978
270586
  explicit2 = {};
@@ -269987,7 +270595,7 @@ var init_chunk_COMUCF3K = __esm({
269987
270595
  }
269988
270596
  });
269989
270597
 
269990
- // ../service/dist/chunk-H2LVQGKH.js
270598
+ // ../service/dist/chunk-3IM6NXIF.js
269991
270599
  import { existsSync as existsSync23, statSync as statSync23, readFileSync as readFileSync23 } from "fs";
269992
270600
  import { dirname as dirname23, resolve as resolve23, join as join14 } from "path";
269993
270601
  import { readFileSync as readFileSync33, statSync as statSync32 } from "fs";
@@ -270537,7 +271145,7 @@ function topLevelFnParams2(file) {
270537
271145
  }
270538
271146
  return out;
270539
271147
  }
270540
- function bPathExportsToModuleExports2(run, file, fingerprintPrefix) {
271148
+ function evalExportsToModuleExports2(run, file, fingerprintPrefix) {
270541
271149
  const named = {};
270542
271150
  let def;
270543
271151
  const paramTable = topLevelFnParams2(file);
@@ -270550,7 +271158,7 @@ function bPathExportsToModuleExports2(run, file, fingerprintPrefix) {
270550
271158
  const params = paramTable.get(k) ?? Array.from({ length: v2.length ?? 0 }, (_, i) => `arg${i}`);
270551
271159
  absVal = absFunction(params, {
270552
271160
  apply: (args) => callTranspiledExportFull(run, k, args).result,
270553
- kind: "bpath-export",
271161
+ kind: "eval-export",
270554
271162
  // 无 body 的桥接 fn 预算键 = fingerprint ?? anon#N——缺省会让所有
270555
271163
  // 桥接导出共享 anon#1,嵌套跨模块调用(a 调 b 调 a')撞
270556
271164
  // _activeCallKeys 递归守卫被误截断为 opaque。按 模块#导出 唯一化。
@@ -270652,9 +271260,9 @@ function evalAbsModuleGraph2(entrySource, entryFile, opts = {}) {
270652
271260
  }
270653
271261
  );
270654
271262
  let exports;
270655
- const bRun = tryRunTranspiled(source, { mode: "analyze", modules: modules2 });
270656
- if (bRun) {
270657
- exports = bPathExportsToModuleExports2(bRun, parse2(source), `bpath:${absPath}`);
271263
+ const evalRun = tryRunTranspiled(source, { mode: "analyze", modules: modules2 });
271264
+ if (evalRun) {
271265
+ exports = evalExportsToModuleExports2(evalRun, parse2(source), `eval:${absPath}`);
270658
271266
  } else {
270659
271267
  exports = { named: {} };
270660
271268
  }
@@ -270742,7 +271350,7 @@ function collectAbsBindingsFromGraph2(source, filePath, opts = {}) {
270742
271350
  if (isAbsVal4(v2)) out.set(name, v2);
270743
271351
  }
270744
271352
  }
270745
- const exports = bPathExportsToModuleExports2(run, parse2(source), `bpath:bindings:${filePath}`);
271353
+ const exports = evalExportsToModuleExports2(run, parse2(source), `eval:bindings:${filePath}`);
270746
271354
  for (const [name, v2] of Object.entries(exports.named)) {
270747
271355
  if (!out.has(name)) out.set(name, v2);
270748
271356
  }
@@ -270848,7 +271456,7 @@ function loadMockModuleExports2(fromPath, fromFile, loadModule) {
270848
271456
  error: evaled.error.includes("not found") ? `Mock module not found (from "${fromPath}")` : evaled.error
270849
271457
  };
270850
271458
  }
270851
- const exports = bPathExportsToModuleExports2(evaled.run, parse2(evaled.source), `mock-module:${fromPath}`);
271459
+ const exports = evalExportsToModuleExports2(evaled.run, parse2(evaled.source), `mock-module:${fromPath}`);
270852
271460
  if (exports.default === void 0 && Object.keys(exports.named).length > 0) {
270853
271461
  const slots = {};
270854
271462
  for (const [k, v2] of Object.entries(exports.named)) slots[k] = { value: v2 };
@@ -271067,7 +271675,7 @@ function mergeHarvestUnderEnv2(harvestModules, envModules, opts) {
271067
271675
  }
271068
271676
  return out;
271069
271677
  }
271070
- function collectBPathReplacements2(source) {
271678
+ function collectEvalReplacements2(source) {
271071
271679
  const targets = [];
271072
271680
  const values = {};
271073
271681
  const asTargets = [];
@@ -271119,12 +271727,12 @@ function collectBPathReplacements2(source) {
271119
271727
  }
271120
271728
  return { targets, values, asTargets, asValues };
271121
271729
  }
271122
- function isBPathCapable2(source, envNames = []) {
271730
+ function isEvalCapable2(source, envNames = []) {
271123
271731
  void envNames;
271124
271732
  void source;
271125
271733
  return true;
271126
271734
  }
271127
- function bPathDepKey2(source, filePath) {
271735
+ function evalDepKey2(source, filePath) {
271128
271736
  try {
271129
271737
  const fp = loadModuleDepsFingerprint(source, defaultLoadModule2, filePath);
271130
271738
  if (fp.truncated) return null;
@@ -271133,29 +271741,29 @@ function bPathDepKey2(source, filePath) {
271133
271741
  return null;
271134
271742
  }
271135
271743
  }
271136
- function bPathCacheSet2(filePath, stableSource, mode, envKey, mockKey, depKey, value) {
271137
- const max = getSessionCacheLimits2().maxBRuns;
271744
+ function evalCacheSet2(filePath, stableSource, mode, envKey, mockKey, depKey, value) {
271745
+ const max = getSessionCacheLimits2().maxEvalRuns;
271138
271746
  if (max <= 0) return;
271139
- while (bRunByFile2.size >= max && !bRunByFile2.has(filePath)) {
271140
- const oldest = bRunByFile2.keys().next().value;
271747
+ while (evalRunByFile2.size >= max && !evalRunByFile2.has(filePath)) {
271748
+ const oldest = evalRunByFile2.keys().next().value;
271141
271749
  if (oldest === void 0) break;
271142
- bRunByFile2.delete(oldest);
271750
+ evalRunByFile2.delete(oldest);
271143
271751
  }
271144
- bRunByFile2.set(filePath, { stableSource, mode, envKey, mockKey, depKey, value });
271752
+ evalRunByFile2.set(filePath, { stableSource, mode, envKey, mockKey, depKey, value });
271145
271753
  }
271146
- function tryRunBPath2(source, filePath, opts = {}) {
271147
- if (!isBPathCapable2(source, opts.envNames ?? [])) return void 0;
271754
+ function tryRunEval2(source, filePath, opts = {}) {
271755
+ if (!isEvalCapable2(source, opts.envNames ?? [])) return void 0;
271148
271756
  const mode = opts.mode ?? "analyze";
271149
271757
  const envKey = (opts.envNames ?? []).join(",");
271150
271758
  const mockKey = mockSeedFingerprint2(opts.mocks);
271151
271759
  const stable = stableAnalyzeKeySource(source);
271152
- const depKey = bPathDepKey2(source, filePath);
271760
+ const depKey = evalDepKey2(source, filePath);
271153
271761
  const canCache = depKey !== null;
271154
271762
  if (canCache) {
271155
- const cached2 = bRunByFile2.get(filePath);
271763
+ const cached2 = evalRunByFile2.get(filePath);
271156
271764
  if (cached2 && cached2.stableSource === stable && cached2.mode === mode && cached2.envKey === envKey && cached2.mockKey === mockKey && cached2.depKey === depKey) {
271157
- bRunByFile2.delete(filePath);
271158
- bRunByFile2.set(filePath, cached2);
271765
+ evalRunByFile2.delete(filePath);
271766
+ evalRunByFile2.set(filePath, cached2);
271159
271767
  return cached2.value ?? void 0;
271160
271768
  }
271161
271769
  }
@@ -271166,14 +271774,14 @@ function tryRunBPath2(source, filePath, opts = {}) {
271166
271774
  const topCalls = [];
271167
271775
  const prevMember = setMemberDiagCollector((d) => memberDiags.push(d));
271168
271776
  const prevTrunc = setAbsTruncationCollector((label) => truncated.add(label));
271169
- const prevCall = setBCallCollector((r) => topCalls.push(r));
271777
+ const prevCall = setEvalCallCollector((r) => topCalls.push(r));
271170
271778
  try {
271171
271779
  const { modules: graphMods, issues } = evalAbsModuleGraph2(source, filePath);
271172
271780
  const envMods = collectEnvModules2(opts.envNames ?? []);
271173
271781
  let modules = mergeHarvestUnderEnv2(graphMods, envMods);
271174
271782
  const mm = applyMockModuleDirectivesFromSource2(source, modules, { fromFile: filePath });
271175
271783
  modules = mm.modules;
271176
- const { targets, values, asTargets, asValues } = collectBPathReplacements2(source);
271784
+ const { targets, values, asTargets, asValues } = collectEvalReplacements2(source);
271177
271785
  const envGlobals = {
271178
271786
  ...collectEnvGlobals2(opts.envNames ?? []),
271179
271787
  ...opts.mocks ?? {}
@@ -271200,23 +271808,23 @@ function tryRunBPath2(source, filePath, opts = {}) {
271200
271808
  } finally {
271201
271809
  setMemberDiagCollector(prevMember);
271202
271810
  setAbsTruncationCollector(prevTrunc);
271203
- setBCallCollector(prevCall);
271811
+ setEvalCallCollector(prevCall);
271204
271812
  }
271205
271813
  } catch {
271206
271814
  out = null;
271207
271815
  }
271208
271816
  if (canCache && depKey !== null) {
271209
- bPathCacheSet2(filePath, stable, mode, envKey, mockKey, depKey, out);
271817
+ evalCacheSet2(filePath, stable, mode, envKey, mockKey, depKey, out);
271210
271818
  }
271211
271819
  return out ?? void 0;
271212
271820
  }
271213
- function tryBPathCallFull2(source, filePath, fnName, args, opts = {}) {
271214
- const run = tryRunBPath2(source, filePath, { envNames: opts.envNames, mocks: opts.mocks });
271821
+ function tryEvalCallFull2(source, filePath, fnName, args, opts = {}) {
271822
+ const run = tryRunEval2(source, filePath, { envNames: opts.envNames, mocks: opts.mocks });
271215
271823
  if (!run) return void 0;
271216
271824
  if (!(fnName in run.exports)) return void 0;
271217
271825
  const collected = [];
271218
271826
  const memberDiags = [];
271219
- const prevCall = opts.collectCalls ? setBCallCollector((r) => collected.push(r)) : void 0;
271827
+ const prevCall = opts.collectCalls ? setEvalCallCollector((r) => collected.push(r)) : void 0;
271220
271828
  const wantMember = opts.collectMemberDiags ?? true;
271221
271829
  const prevMember = wantMember ? setMemberDiagCollector((d) => memberDiags.push(d)) : void 0;
271222
271830
  try {
@@ -271230,12 +271838,12 @@ function tryBPathCallFull2(source, filePath, fnName, args, opts = {}) {
271230
271838
  truncatedFns: run.truncatedFns
271231
271839
  };
271232
271840
  } finally {
271233
- if (opts.collectCalls) setBCallCollector(prevCall ?? null);
271841
+ if (opts.collectCalls) setEvalCallCollector(prevCall ?? null);
271234
271842
  if (wantMember) setMemberDiagCollector(prevMember ?? null);
271235
271843
  }
271236
271844
  }
271237
- function tryBPathCall2(source, filePath, fnName, args, opts = {}) {
271238
- const full = tryBPathCallFull2(source, filePath, fnName, args, opts);
271845
+ function tryEvalCall2(source, filePath, fnName, args, opts = {}) {
271846
+ const full = tryEvalCallFull2(source, filePath, fnName, args, opts);
271239
271847
  if (!full) return void 0;
271240
271848
  const r = full.result;
271241
271849
  if (!r) return void 0;
@@ -271429,7 +272037,7 @@ function loadFromMockBinding2(name, fromPath, fromFile, loadModule) {
271429
272037
  const params = Array.from({ length: fn2.length ?? 0 }, (_, i) => `arg${i}`);
271430
272038
  absVal = absFunction(params, {
271431
272039
  apply: (args) => callTranspiledExportFull(run, name, args).result,
271432
- kind: "bpath-export",
272040
+ kind: "eval-export",
271433
272041
  fingerprint: `from-mock=${fromPath}#${name}`
271434
272042
  });
271435
272043
  } else {
@@ -271683,7 +272291,7 @@ function tryEvalAbsFull2(source, fnName, args, filePath, mocks, assignedName) {
271683
272291
  if (/\brequire\s*\(/.test(source)) return void 0;
271684
272292
  try {
271685
272293
  if (filePath) {
271686
- const viaB = tryBPathCallFull2(source, filePath, fnName, args, { mocks }) ?? (assignedName ? tryBPathCallFull2(source, filePath, assignedName, args, { mocks }) : void 0);
272294
+ const viaB = tryEvalCallFull2(source, filePath, fnName, args, { mocks }) ?? (assignedName ? tryEvalCallFull2(source, filePath, assignedName, args, { mocks }) : void 0);
271687
272295
  if (viaB) {
271688
272296
  const r = viaB.result;
271689
272297
  if (r && !(r.shape.k === "unknown" && !r.term)) {
@@ -271978,7 +272586,7 @@ function walkBuiltinUnknown2(node, declared, out, seen, known, parentKey) {
271978
272586
  }
271979
272587
  }
271980
272588
  }
271981
- function collectBPathDiagnostics2(source, extraKnown) {
272589
+ function collectEvalDiagnostics2(source, extraKnown) {
271982
272590
  let file;
271983
272591
  try {
271984
272592
  file = parseSource(source);
@@ -272032,13 +272640,13 @@ function detectEntryVariantsFromPackageJson2(pkg) {
272032
272640
  const browser = [];
272033
272641
  const node = [];
272034
272642
  collectExportFaces2(p.exports, browser, node);
272035
- const bField = p.browser;
272036
- if (typeof bField === "string") browser.push(bField);
272037
- else if (bField && typeof bField === "object") {
272038
- for (const v2 of Object.values(bField)) {
272643
+ const evalField = p.browser;
272644
+ if (typeof evalField === "string") browser.push(evalField);
272645
+ else if (evalField && typeof evalField === "object") {
272646
+ for (const v2 of Object.values(evalField)) {
272039
272647
  if (typeof v2 === "string") browser.push(v2);
272040
272648
  }
272041
- for (const k of Object.keys(bField)) {
272649
+ for (const k of Object.keys(evalField)) {
272042
272650
  if (k.startsWith(".")) node.push(k);
272043
272651
  }
272044
272652
  }
@@ -272305,13 +272913,13 @@ function analyzeFileUncachedInner2(filePath, source, activeCases, externalCallRe
272305
272913
  const callSiteBudget = analysisCfg.callSiteBudget;
272306
272914
  const callRecords = [];
272307
272915
  const globalEnv = createEnvironment();
272308
- const bMemberDiagNames = /* @__PURE__ */ new Set();
272309
- const bMemberDiagSeen = /* @__PURE__ */ new Set();
272916
+ const evalMemberDiagNames = /* @__PURE__ */ new Set();
272917
+ const evalMemberDiagSeen = /* @__PURE__ */ new Set();
272310
272918
  const pushBMemberDiag = (d, fallbackLine) => {
272311
- bMemberDiagNames.add(d.name);
272919
+ evalMemberDiagNames.add(d.name);
272312
272920
  const key = `${d.kind}:${d.name}:${d.receiver}:${d.line ?? fallbackLine}:${d.column ?? 0}:${d.code ?? ""}`;
272313
- if (bMemberDiagSeen.has(key)) return;
272314
- bMemberDiagSeen.add(key);
272921
+ if (evalMemberDiagSeen.has(key)) return;
272922
+ evalMemberDiagSeen.add(key);
272315
272923
  if (d.code === "nudo:missing-slot") {
272316
272924
  diagnostics.push({
272317
272925
  range: {
@@ -272354,15 +272962,15 @@ function analyzeFileUncachedInner2(filePath, source, activeCases, externalCallRe
272354
272962
  }
272355
272963
  const selfContained = isSelfContainedSource2(source, envNames);
272356
272964
  const canAbsModules = absModulesOk2(source, envNames);
272357
- const bCapable = isBPathCapable2(source, envNames);
272358
- const bModuleIssueKinds = /* @__PURE__ */ new Set();
272359
- const bTruncatedFns = /* @__PURE__ */ new Set();
272360
- const bBuiltinUnknownNames = /* @__PURE__ */ new Set();
272361
- let bHostedEval = false;
272965
+ const evalCapable = isEvalCapable2(source, envNames);
272966
+ const evalModuleIssueKinds = /* @__PURE__ */ new Set();
272967
+ const evalTruncatedFns = /* @__PURE__ */ new Set();
272968
+ const evalBuiltinUnknownNames = /* @__PURE__ */ new Set();
272969
+ let evalHosted = false;
272362
272970
  const pushBModuleIssues = (issues) => {
272363
272971
  if (!issues) return;
272364
272972
  for (const iss of issues) {
272365
- bModuleIssueKinds.add(iss.kind);
272973
+ evalModuleIssueKinds.add(iss.kind);
272366
272974
  const code2 = iss.kind === "cycle" ? "nudo:module-cycle" : iss.kind === "depth" ? "nudo:module-depth" : "nudo:module-missing";
272367
272975
  diagnostics.push({
272368
272976
  range: { start: { line: 1, column: 0 }, end: { line: 1, column: 0 } },
@@ -272389,11 +272997,11 @@ function analyzeFileUncachedInner2(filePath, source, activeCases, externalCallRe
272389
272997
  });
272390
272998
  }
272391
272999
  let absCallRecords = [];
272392
- let bTopCallRecords = [];
273000
+ let evalTopCallRecords = [];
272393
273001
  let absGraphModules;
272394
273002
  let absBindsShared;
272395
273003
  let absNodesShared;
272396
- if (bCapable && filePath) {
273004
+ if (evalCapable && filePath) {
272397
273005
  try {
272398
273006
  const g = evalAbsModuleGraph2(source, filePath, {
272399
273007
  seedVars: seeds.seedVars,
@@ -272417,46 +273025,46 @@ function analyzeFileUncachedInner2(filePath, source, activeCases, externalCallRe
272417
273025
  pushBModuleIssues(g.issues);
272418
273026
  } catch {
272419
273027
  }
272420
- const bRun = tryRunBPath2(source, filePath, {
273028
+ const evalRun = tryRunEval2(source, filePath, {
272421
273029
  envNames,
272422
273030
  mocks: mockSeedsToAbsMocks2(seeds)
272423
273031
  });
272424
- if (bRun) {
272425
- bHostedEval = true;
272426
- if (bRun.memberDiags?.length) {
272427
- for (const d of bRun.memberDiags) {
273032
+ if (evalRun) {
273033
+ evalHosted = true;
273034
+ if (evalRun.memberDiags?.length) {
273035
+ for (const d of evalRun.memberDiags) {
272428
273036
  pushBMemberDiag(d, 1);
272429
273037
  }
272430
273038
  }
272431
- if (bRun.truncatedFns) {
272432
- for (const fn2 of bRun.truncatedFns) bTruncatedFns.add(fn2);
273039
+ if (evalRun.truncatedFns) {
273040
+ for (const fn2 of evalRun.truncatedFns) evalTruncatedFns.add(fn2);
272433
273041
  }
272434
- if (bRun.calls?.length) {
273042
+ if (evalRun.calls?.length) {
272435
273043
  const impMap = buildAbsImportLocalMap2(source, filePath);
272436
- for (const c of bRun.calls) {
272437
- bTopCallRecords.push(callRecordFromAbsCall2(c, impMap));
273044
+ for (const c of evalRun.calls) {
273045
+ evalTopCallRecords.push(callRecordFromAbsCall2(c, impMap));
272438
273046
  }
272439
273047
  }
272440
273048
  }
272441
273049
  }
272442
- if (bHostedEval && bTopCallRecords.length > 0) {
273050
+ if (evalHosted && evalTopCallRecords.length > 0) {
272443
273051
  callRecords.length = 0;
272444
- callRecords.push(...bTopCallRecords);
273052
+ callRecords.push(...evalTopCallRecords);
272445
273053
  } else if ((selfContained || canAbsModules) && absCallRecords.length > 0) {
272446
273054
  callRecords.length = 0;
272447
273055
  callRecords.push(...absCallRecords);
272448
- } else if (bTopCallRecords.length > 0) {
273056
+ } else if (evalTopCallRecords.length > 0) {
272449
273057
  callRecords.length = 0;
272450
- callRecords.push(...bTopCallRecords);
273058
+ callRecords.push(...evalTopCallRecords);
272451
273059
  }
272452
273060
  const unreachableRanges = [];
272453
- if (bCapable) {
272454
- const bKnownGlobals = /* @__PURE__ */ new Set([
273061
+ if (evalCapable) {
273062
+ const evalKnownGlobals = /* @__PURE__ */ new Set([
272455
273063
  ...Object.keys(collectEnvGlobals2(envNames)),
272456
273064
  ...Object.keys(mockSeedsToAbsMocks2(seeds))
272457
273065
  ]);
272458
- const bDiag = collectBPathDiagnostics2(source, bKnownGlobals);
272459
- for (const ur of bDiag.unreachable) {
273066
+ const evalDiag = collectEvalDiagnostics2(source, evalKnownGlobals);
273067
+ for (const ur of evalDiag.unreachable) {
272460
273068
  diagnostics.push({
272461
273069
  range: ur.range,
272462
273070
  severity: "info",
@@ -272466,8 +273074,8 @@ function analyzeFileUncachedInner2(filePath, source, activeCases, externalCallRe
272466
273074
  suggestions: ["Remove the unreachable code after the return/throw statement"]
272467
273075
  });
272468
273076
  }
272469
- for (const b of bDiag.builtinUnknown) {
272470
- bBuiltinUnknownNames.add(b.name);
273077
+ for (const b of evalDiag.builtinUnknown) {
273078
+ evalBuiltinUnknownNames.add(b.name);
272471
273079
  diagnostics.push({
272472
273080
  range: b.range,
272473
273081
  severity: "warning",
@@ -272491,7 +273099,7 @@ function analyzeFileUncachedInner2(filePath, source, activeCases, externalCallRe
272491
273099
  });
272492
273100
  }
272493
273101
  }
272494
- if (!absNodesShared && !bHostedEval && (selfContained || canAbsModules)) {
273102
+ if (!absNodesShared && !evalHosted && (selfContained || canAbsModules)) {
272495
273103
  try {
272496
273104
  const collected = { binds: /* @__PURE__ */ new Map(), nodes: /* @__PURE__ */ new Map() };
272497
273105
  if (!absBindsShared) absBindsShared = collected.binds;
@@ -272500,7 +273108,7 @@ function analyzeFileUncachedInner2(filePath, source, activeCases, externalCallRe
272500
273108
  }
272501
273109
  }
272502
273110
  collectBindings2(ast, globalEnv, bindings, absBindsShared);
272503
- if (isBPathCapable2(source, envNames)) {
273111
+ if (isEvalCapable2(source, envNames)) {
272504
273112
  try {
272505
273113
  const absBinds = absBindsShared ?? collectAbsBindingsFromGraph2(source, filePath, {
272506
273114
  seedVars: seeds.seedVars,
@@ -272631,36 +273239,36 @@ function analyzeFileUncachedInner2(filePath, source, activeCases, externalCallRe
272631
273239
  let caseThrowsAbs;
272632
273240
  let caseThrowLoc;
272633
273241
  let caseUnreachable = [];
272634
- const bCapable2 = isBPathCapable2(source, envNames);
272635
- const bPrimary = bCapable2;
272636
- if (bCapable2 && filePath) {
273242
+ const evalCapable2 = isEvalCapable2(source, envNames);
273243
+ const evalPrimary = evalCapable2;
273244
+ if (evalCapable2 && filePath) {
272637
273245
  const caseArgsAbs = directive.argsAbs;
272638
- const bFull = tryBPathCallFull2(
273246
+ const evalFull = tryEvalCallFull2(
272639
273247
  source,
272640
273248
  filePath,
272641
273249
  fn2.name,
272642
273250
  caseArgsAbs,
272643
273251
  { collectCalls: true, envNames, mocks: mockSeedsToAbsMocks2(seeds) }
272644
273252
  );
272645
- const res = bFull?.result;
273253
+ const res = evalFull?.result;
272646
273254
  const weakUnknown = !!res && res.shape.k === "unknown" && (!res.term || res.term.op === "lit" && res.term.value === void 0);
272647
- const bOk = !!res && (bHostedEval || !weakUnknown && res.conf !== "opaque");
272648
- if (bOk && bFull && bPrimary) {
272649
- caseAbs = bFull.result;
272650
- caseThrowsAbs = bFull.throws;
272651
- for (const d of bFull.memberDiags ?? []) {
273255
+ const evalOk = !!res && (evalHosted || !weakUnknown && res.conf !== "opaque");
273256
+ if (evalOk && evalFull && evalPrimary) {
273257
+ caseAbs = evalFull.result;
273258
+ caseThrowsAbs = evalFull.throws;
273259
+ for (const d of evalFull.memberDiags ?? []) {
272652
273260
  pushBMemberDiag(d, fnLoc.start.line);
272653
273261
  }
272654
- if (bFull.calls?.length) {
273262
+ if (evalFull.calls?.length) {
272655
273263
  const impMap = buildAbsImportLocalMap2(source, filePath);
272656
- for (const c of bFull.calls) {
273264
+ for (const c of evalFull.calls) {
272657
273265
  callRecords.push(callRecordFromAbsCall2(c, impMap));
272658
273266
  }
272659
273267
  }
272660
273268
  }
272661
273269
  }
272662
273270
  if (!caseAbs) {
272663
- if (bHostedEval) {
273271
+ if (evalHosted) {
272664
273272
  caseAbs = unknown;
272665
273273
  caseThrowsAbs = neverAbs2;
272666
273274
  } else {
@@ -272733,7 +273341,7 @@ function analyzeFileUncachedInner2(filePath, source, activeCases, externalCallRe
272733
273341
  code: "nudo:may-throw"
272734
273342
  });
272735
273343
  }
272736
- if (!isBPathCapable2(source, envNames)) {
273344
+ if (!isEvalCapable2(source, envNames)) {
272737
273345
  for (const ur of caseUnreachable) {
272738
273346
  diagnostics.push({
272739
273347
  range: ur,
@@ -272895,19 +273503,19 @@ function analyzeFileUncachedInner2(filePath, source, activeCases, externalCallRe
272895
273503
  )
272896
273504
  );
272897
273505
  let symAbs;
272898
- if (isBPathCapable2(source, envNames) && filePath) {
272899
- const bSym = tryBPathCall2(
273506
+ if (isEvalCapable2(source, envNames) && filePath) {
273507
+ const evalSym = tryEvalCall2(
272900
273508
  source,
272901
273509
  filePath,
272902
273510
  candidate.name,
272903
273511
  widenedArgsAbs,
272904
273512
  { envNames, mocks: mockSeedsToAbsMocks2(seeds) }
272905
273513
  );
272906
- if (bSym && (bHostedEval || !(bSym.shape.k === "unknown" && !bSym.term))) {
272907
- symAbs = bSym;
273514
+ if (evalSym && (evalHosted || !(evalSym.shape.k === "unknown" && !evalSym.term))) {
273515
+ symAbs = evalSym;
272908
273516
  }
272909
273517
  }
272910
- if (!symAbs && !bHostedEval) {
273518
+ if (!symAbs && !evalHosted) {
272911
273519
  const absTry = tryEvalAbsRaw2(
272912
273520
  source,
272913
273521
  candidate.name,
@@ -272946,30 +273554,30 @@ function analyzeFileUncachedInner2(filePath, source, activeCases, externalCallRe
272946
273554
  const entryEffects = [];
272947
273555
  setMayThrowCollector((e) => entryEffects.push(e));
272948
273556
  try {
272949
- if (isBPathCapable2(source, envNames) && filePath) {
272950
- const bEntryFull = tryBPathCallFull2(
273557
+ if (isEvalCapable2(source, envNames) && filePath) {
273558
+ const evalEntryFull = tryEvalCallFull2(
272951
273559
  source,
272952
273560
  filePath,
272953
273561
  candidate.analysis.name,
272954
273562
  argAbsEntry,
272955
273563
  { envNames, mocks: mockSeedsToAbsMocks2(seeds), collectMemberDiags: true }
272956
- ) ?? (candidate.assignedName ? tryBPathCallFull2(source, filePath, candidate.assignedName, argAbsEntry, {
273564
+ ) ?? (candidate.assignedName ? tryEvalCallFull2(source, filePath, candidate.assignedName, argAbsEntry, {
272957
273565
  envNames,
272958
273566
  mocks: mockSeedsToAbsMocks2(seeds)
272959
273567
  }) : void 0);
272960
- if (bEntryFull?.memberDiags?.length) {
272961
- for (const d of bEntryFull.memberDiags) {
273568
+ if (evalEntryFull?.memberDiags?.length) {
273569
+ for (const d of evalEntryFull.memberDiags) {
272962
273570
  pushBMemberDiag(d, candidate.analysis.loc.start.line);
272963
273571
  }
272964
273572
  }
272965
- const bEntry = bEntryFull?.result;
272966
- if (bEntry && (bHostedEval || !(bEntry.shape.k === "unknown" && !bEntry.term))) {
272967
- entryAbs = bEntry;
272968
- if (bEntryFull?.throws) entryThrowsAbs = bEntryFull.throws;
273573
+ const evalEntry = evalEntryFull?.result;
273574
+ if (evalEntry && (evalHosted || !(evalEntry.shape.k === "unknown" && !evalEntry.term))) {
273575
+ entryAbs = evalEntry;
273576
+ if (evalEntryFull?.throws) entryThrowsAbs = evalEntryFull.throws;
272969
273577
  }
272970
273578
  }
272971
273579
  if (!entryAbs) {
272972
- if (bHostedEval) {
273580
+ if (evalHosted) {
272973
273581
  entryAbs = unknown;
272974
273582
  entryThrowsAbs = abs({ k: "never" }, void 0, void 0, "exact");
272975
273583
  } else {
@@ -273040,7 +273648,7 @@ function analyzeFileUncachedInner2(filePath, source, activeCases, externalCallRe
273040
273648
  } catch {
273041
273649
  }
273042
273650
  }
273043
- if (!bHostedEval) {
273651
+ if (!evalHosted) {
273044
273652
  buildNodeTypeMap2(ast, globalEnv, nodeAbsMap);
273045
273653
  }
273046
273654
  const externalFunctions = synthesizeExternalFunctions2(
@@ -273131,11 +273739,11 @@ function analyzeFile2(filePath, source, activeCases, externalCallRecords, loadMo
273131
273739
  }
273132
273740
  return cloneAnalysisResult2(result);
273133
273741
  }
273134
- var externalRecordIds2, nextExternalRecordId2, ABS_MODULE_CACHE_MAX2, absModuleCache2, ENV_DEPENDENTS_MAX2, ENV_DEPENDENTS_PER_KEY_MAX2, envDependents2, analysisByFile2, fnAnalysisCache2, envHarvestConflictCollector2, bRunByFile2, neverAbs2, undefAbs4, MAX_RECORD_TYPE_NODES2, KNOWN_GLOBALS2, DEFAULT_CALLSITE_BUDGET3, COLLAPSE_LITERAL_THRESHOLD2;
273135
- var init_chunk_H2LVQGKH = __esm({
273136
- "../service/dist/chunk-H2LVQGKH.js"() {
273742
+ var externalRecordIds2, nextExternalRecordId2, ABS_MODULE_CACHE_MAX2, absModuleCache2, ENV_DEPENDENTS_MAX2, ENV_DEPENDENTS_PER_KEY_MAX2, envDependents2, analysisByFile2, fnAnalysisCache2, envHarvestConflictCollector2, evalRunByFile2, neverAbs2, undefAbs4, MAX_RECORD_TYPE_NODES2, KNOWN_GLOBALS2, DEFAULT_CALLSITE_BUDGET3, COLLAPSE_LITERAL_THRESHOLD2;
273743
+ var init_chunk_3IM6NXIF = __esm({
273744
+ "../service/dist/chunk-3IM6NXIF.js"() {
273137
273745
  "use strict";
273138
- init_chunk_COMUCF3K();
273746
+ init_chunk_3RCHDTBX();
273139
273747
  init_src2();
273140
273748
  init_lib5();
273141
273749
  init_src();
@@ -273173,7 +273781,7 @@ var init_chunk_H2LVQGKH = __esm({
273173
273781
  analysisByFile2 = /* @__PURE__ */ new Map();
273174
273782
  fnAnalysisCache2 = /* @__PURE__ */ new Map();
273175
273783
  envHarvestConflictCollector2 = null;
273176
- bRunByFile2 = /* @__PURE__ */ new Map();
273784
+ evalRunByFile2 = /* @__PURE__ */ new Map();
273177
273785
  neverAbs2 = { shape: { k: "never" }, conf: "exact" };
273178
273786
  undefAbs4 = {
273179
273787
  shape: { k: "unknown" },
@@ -275072,7 +275680,7 @@ function deriveOneRoot(plan, source, file, modules, importLocals, label) {
275072
275680
  }
275073
275681
  const calls = [];
275074
275682
  const bCalls = [];
275075
- const prevCall = setBCallCollector((r) => bCalls.push(r));
275683
+ const prevCall = setEvalCallCollector((r) => bCalls.push(r));
275076
275684
  try {
275077
275685
  {
275078
275686
  const run = runTranspiled(source, { mode: "analyze", modules });
@@ -275099,7 +275707,7 @@ function deriveOneRoot(plan, source, file, modules, importLocals, label) {
275099
275707
  } catch {
275100
275708
  return [];
275101
275709
  } finally {
275102
- setBCallCollector(prevCall);
275710
+ setEvalCallCollector(prevCall);
275103
275711
  }
275104
275712
  const byCallee = /* @__PURE__ */ new Map();
275105
275713
  for (const call of calls) {
@@ -276079,10 +276687,10 @@ function litOf(t) {
276079
276687
  function eqLitValue(p) {
276080
276688
  if (p.op !== "eq") return "unanchored";
276081
276689
  const aLit = litOf(p.a);
276082
- const bLit = litOf(p.b);
276690
+ const evalLit = litOf(p.b);
276083
276691
  if (aLit !== void 0 && (isSelfVar2(p.b) || p.b.op === "app")) return aLit;
276084
- if (bLit !== void 0 && (isSelfVar2(p.a) || p.a.op === "app")) return bLit;
276085
- if (aLit !== void 0 && bLit !== void 0) return aLit === bLit ? aLit : "unanchored";
276692
+ if (evalLit !== void 0 && (isSelfVar2(p.a) || p.a.op === "app")) return evalLit;
276693
+ if (aLit !== void 0 && evalLit !== void 0) return aLit === evalLit ? aLit : "unanchored";
276086
276694
  return "unanchored";
276087
276695
  }
276088
276696
  function isIntModOne(p) {
@@ -276545,9 +277153,6 @@ function checkNode(node, value, path, issues) {
276545
277153
  );
276546
277154
  return;
276547
277155
  }
276548
- case "promise": {
276549
- return;
276550
- }
276551
277156
  default:
276552
277157
  return;
276553
277158
  }
@@ -276690,8 +277295,8 @@ var init_emit2 = __esm({
276690
277295
  "../service/dist/emit/index.js"() {
276691
277296
  "use strict";
276692
277297
  init_chunk_J2PUE4NV();
276693
- init_chunk_H2LVQGKH();
276694
- init_chunk_COMUCF3K();
277298
+ init_chunk_3IM6NXIF();
277299
+ init_chunk_3RCHDTBX();
276695
277300
  init_src();
276696
277301
  init_src();
276697
277302
  init_src2();
@@ -277671,7 +278276,7 @@ async function runAbsView(filePath, opts) {
277671
278276
  process.exitCode = 1;
277672
278277
  return;
277673
278278
  }
277674
- const { defaultLoadModule: loadModule, tryBPathCall: tryBPathCall3 } = await Promise.resolve().then(() => (init_src4(), src_exports4));
278279
+ const { defaultLoadModule: loadModule, tryEvalCall: tryEvalCall3 } = await Promise.resolve().then(() => (init_src4(), src_exports4));
277675
278280
  console.log(`nudo check --abs ${basename5(filePath)}`);
277676
278281
  if (assumeLines.length > 0) {
277677
278282
  console.log(`assume: ${assumeLines.join(", ")}`);
@@ -277689,8 +278294,8 @@ async function runAbsView(filePath, opts) {
277689
278294
  continue;
277690
278295
  }
277691
278296
  const args = algebra.buildArgsFromAssume(source, name, assumeIds);
277692
- const bResult = tryBPathCall3(source, filePath, name, args, { phi: phi2 });
277693
- const result = bResult ?? algebra.unknown;
278297
+ const evalResult = tryEvalCall3(source, filePath, name, args, { phi: phi2 });
278298
+ const result = evalResult ?? algebra.unknown;
277694
278299
  const label = `${name}(${args.map((a) => algebra.formatShape(a)).join(", ")})`;
277695
278300
  console.log(algebra.formatAbsMultiline(result, label));
277696
278301
  console.log("");
@@ -277957,7 +278562,7 @@ async function runCheck(file, opts = {}) {
277957
278562
  let inject;
277958
278563
  try {
277959
278564
  const graph = evalAbsModuleGraph(source, filePath);
277960
- const reps = collectBPathReplacements(source);
278565
+ const reps = collectEvalReplacements(source);
277961
278566
  const { mockDirectivesToAbsSeeds: mockDirectivesToAbsSeeds3, mockSeedsToAbsMocks: mockSeedsToAbsMocks3 } = await Promise.resolve().then(() => (init_src4(), src_exports4));
277962
278567
  const { extractDirectives: extractDirectives2 } = await Promise.resolve().then(() => (init_src2(), src_exports2));
277963
278568
  const { parse: parse3 } = await Promise.resolve().then(() => (init_src2(), src_exports2));