poe-code 14.0.82 → 14.0.83

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 (34) hide show
  1. package/dist/index.js +543 -156
  2. package/dist/index.js.map +4 -4
  3. package/dist/metafile.json +1 -1
  4. package/package.json +1 -1
  5. package/packages/safe-js/dist/chunks/{chunk-7LGBDF56.js → chunk-37V6Q4K3.js} +2 -2
  6. package/packages/safe-js/dist/chunks/{chunk-V6LQP64H.js → chunk-PT7PBLVT.js} +457 -91
  7. package/packages/safe-js/dist/chunks/chunk-PT7PBLVT.js.map +7 -0
  8. package/packages/safe-js/dist/cli.js +2 -2
  9. package/packages/safe-js/dist/core.js +1 -1
  10. package/packages/safe-js/dist/index.js +2 -2
  11. package/packages/safe-js/dist/interp/float32-prototypes.d.ts +3 -0
  12. package/packages/safe-js/dist/interp/float32-prototypes.js +1 -0
  13. package/packages/safe-js/dist/interp/float32.d.ts +1 -0
  14. package/packages/safe-js/dist/interp/float32.js +12 -4
  15. package/packages/safe-js/dist/interp/globals/float32array.d.ts +3 -2
  16. package/packages/safe-js/dist/interp/globals/float32array.js +371 -65
  17. package/packages/safe-js/dist/interp/globals/object-array.js +3 -3
  18. package/packages/safe-js/dist/interp/globals.d.ts +1 -0
  19. package/packages/safe-js/dist/interp/globals.js +4 -2
  20. package/packages/safe-js/dist/interp/instanceof.js +1 -1
  21. package/packages/safe-js/dist/interp/interpreter.js +2 -4
  22. package/packages/safe-js/dist/interp/iteration.js +15 -6
  23. package/packages/safe-js/dist/interp/object-model.js +16 -1
  24. package/packages/safe-js/dist/interp/values.js +12 -4
  25. package/packages/safe-js/dist/parse/parser.js +8 -3
  26. package/packages/safe-js/dist/parse/tokenizer.js +45 -3
  27. package/packages/safe-js/dist/snapshot/float32array.d.ts +3 -0
  28. package/packages/safe-js/dist/snapshot/float32array.js +20 -1
  29. package/packages/safe-js/dist/snapshot/restore.js +17 -2
  30. package/packages/safe-js/dist/snapshot/serialize.d.ts +2 -1
  31. package/packages/safe-js/dist/snapshot/serialize.js +10 -9
  32. package/packages/safe-js/dist/snapshot/validation.js +10 -0
  33. package/packages/safe-js/dist/chunks/chunk-V6LQP64H.js.map +0 -7
  34. /package/packages/safe-js/dist/chunks/{chunk-7LGBDF56.js.map → chunk-37V6Q4K3.js.map} +0 -0
@@ -1175,7 +1175,7 @@ var Lexer = class {
1175
1175
  lastClosedControlParenthesis = false;
1176
1176
  continue;
1177
1177
  }
1178
- if (char === "/" && this.peekChar(1) !== "=" && shouldRejectRegexLiteral(tokens[tokens.length - 1], lastClosedControlParenthesis)) {
1178
+ if (char === "/" && this.peekChar(1) !== "=" && shouldRejectRegexLiteral(tokens[tokens.length - 1], lastClosedControlParenthesis, tokens)) {
1179
1179
  if (!this.options.allowRegexLiterals) {
1180
1180
  this.syntaxError("Regular expression literals are not supported", this.position());
1181
1181
  }
@@ -1444,7 +1444,7 @@ var Lexer = class {
1444
1444
  }
1445
1445
  }
1446
1446
  readSlashOrPunctuator(start) {
1447
- if (this.currentChar() === "/" && this.peekChar(1) !== "=" && shouldRejectRegexLiteral(this.lastSignificantToken(), this.lastClosedControlParenthesis)) {
1447
+ if (this.currentChar() === "/" && this.peekChar(1) !== "=" && shouldRejectRegexLiteral(this.lastSignificantToken(), this.lastClosedControlParenthesis, this.tokens)) {
1448
1448
  if (!this.options.allowRegexLiterals) {
1449
1449
  this.syntaxError("Regular expression literals are not supported", start);
1450
1450
  }
@@ -1728,7 +1728,7 @@ function matchPunctuator(source, index) {
1728
1728
  (punctuator) => source.startsWith(punctuator, index) && (punctuator !== "?." || !isDecimalDigit(source[index + 2] ?? ""))
1729
1729
  );
1730
1730
  }
1731
- function shouldRejectRegexLiteral(previousToken, lastClosedControlParenthesis) {
1731
+ function shouldRejectRegexLiteral(previousToken, lastClosedControlParenthesis, tokens) {
1732
1732
  if (previousToken === void 0) {
1733
1733
  return true;
1734
1734
  }
@@ -1736,6 +1736,7 @@ function shouldRejectRegexLiteral(previousToken, lastClosedControlParenthesis) {
1736
1736
  return false;
1737
1737
  }
1738
1738
  if (previousToken.type === "keyword") {
1739
+ if (previousToken.value === "of") return endsWithForOfSeparator(tokens);
1739
1740
  return !EXPRESSION_ENDING_KEYWORDS.has(previousToken.value);
1740
1741
  }
1741
1742
  if (previousToken.value === ")") {
@@ -1743,6 +1744,35 @@ function shouldRejectRegexLiteral(previousToken, lastClosedControlParenthesis) {
1743
1744
  }
1744
1745
  return !isExpressionEndingPunctuator(previousToken.value);
1745
1746
  }
1747
+ function endsWithForOfSeparator(tokens) {
1748
+ let depth = 0;
1749
+ let start = -1;
1750
+ for (let index = tokens.length - 2; index >= 0; index--) {
1751
+ const token = tokens[index];
1752
+ if (token.type !== "punctuator") continue;
1753
+ if ([")", "]", "}"].includes(token.value)) depth++;
1754
+ else if (["(", "[", "{"].includes(token.value)) {
1755
+ if (depth > 0) {
1756
+ depth--;
1757
+ continue;
1758
+ }
1759
+ if (token.value === "(" && (tokens[index - 1]?.value === "for" || tokens[index - 1]?.value === "await" && tokens[index - 2]?.value === "for")) start = index + 1;
1760
+ break;
1761
+ } else if (depth === 0 && token.value === ";") break;
1762
+ }
1763
+ if (start < 0) return false;
1764
+ depth = 0;
1765
+ for (let index = start; index < tokens.length; index++) {
1766
+ const token = tokens[index];
1767
+ if (token.type === "punctuator") {
1768
+ if (["(", "[", "{"].includes(token.value)) depth++;
1769
+ else if ([")", "]", "}"].includes(token.value)) depth--;
1770
+ }
1771
+ if (depth === 0 && token.type === "keyword" && token.value === "of" && index !== start && tokens[index - 1]?.value !== "." && tokens[index - 1]?.value !== "?." && !(index === start + 1 && ["const", "let", "var"].includes(tokens[start].value)))
1772
+ return index === tokens.length - 1;
1773
+ }
1774
+ return false;
1775
+ }
1746
1776
  function updateGroupingState(groupingStack, previousToken, punctuator) {
1747
1777
  if (punctuator === "(") {
1748
1778
  groupingStack.push({
@@ -5532,6 +5562,7 @@ var Parser = class {
5532
5562
  return void 0;
5533
5563
  }
5534
5564
  findTopLevelForIterationOperator(startIndex) {
5565
+ let operator;
5535
5566
  let depth = 0;
5536
5567
  let previousToken;
5537
5568
  for (let index = startIndex; index < this.tokens.length; index += 1) {
@@ -5541,15 +5572,15 @@ var Parser = class {
5541
5572
  depth += 1;
5542
5573
  } else if (token.value === ")" || token.value === "]" || token.value === "}") {
5543
5574
  if (depth === 0 && token.value === ")") {
5544
- return void 0;
5575
+ return operator;
5545
5576
  }
5546
5577
  depth -= 1;
5547
5578
  } else if (depth === 0 && token.value === ";") {
5548
5579
  return void 0;
5549
5580
  }
5550
5581
  }
5551
- if (depth === 0 && token.type === "keyword" && (token.value === "of" || token.value === "in") && previousToken?.value !== "." && previousToken?.value !== "?.") {
5552
- return token;
5582
+ if (depth === 0 && token.type === "keyword" && (token.value === "of" || token.value === "in") && index !== startIndex && !(token.value === "of" && index === startIndex + 1 && ["const", "let", "var"].includes(previousToken?.value ?? "")) && previousToken?.value !== "." && previousToken?.value !== "?.") {
5583
+ operator ??= token;
5553
5584
  }
5554
5585
  previousToken = token;
5555
5586
  }
@@ -6542,7 +6573,7 @@ function isLiteralPropertyKey(token) {
6542
6573
  return token.type === "numeric" || token.type === "string";
6543
6574
  }
6544
6575
  function isIdentifierLikeToken(token) {
6545
- return token.type === "identifier" || token.type === "keyword" && token.value === "async";
6576
+ return token.type === "identifier" || token.type === "keyword" && (token.value === "async" || token.value === "of");
6546
6577
  }
6547
6578
  function isNewToken(token) {
6548
6579
  return token.value === "new";
@@ -6835,13 +6866,20 @@ function float32Storage(value) {
6835
6866
  byteLength: Reflect.apply(bufferLength, buffer, [])
6836
6867
  };
6837
6868
  }
6869
+ function float32Properties(value) {
6870
+ const properties = [];
6871
+ for (const key of Reflect.ownKeys(value)) {
6872
+ if (typeof key === "string" && isFloat32Index(key)) continue;
6873
+ properties.push([key, Object.getOwnPropertyDescriptor(value, key)]);
6874
+ }
6875
+ return properties;
6876
+ }
6838
6877
  function float32DataProperties(value) {
6839
6878
  if (Object.getOwnPropertySymbols(value).length > 0)
6840
6879
  throw new TypeError("Float32Array symbol properties are not supported.");
6841
6880
  const properties = [];
6842
- for (const key of Object.getOwnPropertyNames(value)) {
6843
- if (isFloat32Index(key)) continue;
6844
- const descriptor = Object.getOwnPropertyDescriptor(value, key);
6881
+ for (const [key, descriptor] of float32Properties(value)) {
6882
+ if (typeof key !== "string") throw new TypeError("Float32Array symbol properties are not supported.");
6845
6883
  if (!("value" in descriptor))
6846
6884
  throw new TypeError(`Float32Array accessor property '${key}' is not supported.`);
6847
6885
  properties.push([key, descriptor]);
@@ -7865,6 +7903,9 @@ function namedKeys(state) {
7865
7903
  // packages/safe-js/src/interp/error-prototypes.ts
7866
7904
  var errorPrototypes = /* @__PURE__ */ new WeakMap();
7867
7905
 
7906
+ // packages/safe-js/src/interp/float32-prototypes.ts
7907
+ var float32Prototypes = /* @__PURE__ */ new WeakMap();
7908
+
7868
7909
  // packages/safe-js/src/interp/object-model.ts
7869
7910
  var guestClosures = /* @__PURE__ */ new WeakSet();
7870
7911
  var functionProperties = /* @__PURE__ */ new WeakMap();
@@ -8090,11 +8131,13 @@ function releaseObjectPrototype(budget) {
8090
8131
  functionPrototypes.delete(budget);
8091
8132
  generatorPrototypes.delete(budget);
8092
8133
  errorPrototypes.delete(budget);
8134
+ float32Prototypes.delete(budget);
8093
8135
  initialRegexDescriptors.delete(budget);
8094
8136
  intrinsicPrototypes.delete(budget);
8095
8137
  }
8096
8138
  function getSandboxPrototype(value, budget) {
8097
8139
  if (prototypes.has(value)) return prototypes.get(value) ?? null;
8140
+ if (isFloat32Array(value)) return budget === void 0 ? null : float32Prototypes.get(budget) ?? null;
8098
8141
  const errorType = sandboxErrorTypes.get(value);
8099
8142
  if (budget !== void 0 && errorType !== void 0) {
8100
8143
  const prototype = errorPrototypes.get(budget)?.get(errorType);
@@ -8127,6 +8170,8 @@ function getSandboxPropertyDescriptor(value, key, budget) {
8127
8170
  let current = value;
8128
8171
  let depth = 0;
8129
8172
  while (typeof current === "object" && current !== null && (Array.isArray(current) || isSandboxGenerator(current) || isSandboxDate(current) || isSandboxPromise(current) || isSandboxRegex(current) || isSandboxMap(current) || isSandboxSet(current) || isPrototypeRecord(current))) {
8173
+ if (isFloat32Array(current) && typeof key !== "symbol" && isFloat32Index(String(key)))
8174
+ return Object.getOwnPropertyDescriptor(current, key);
8130
8175
  const properties = isSandboxGenerator(current) ? getGeneratorProperties(current) : isSandboxPromise(current) ? getPromiseProperties(current) : isGuestClosure(current) ? key === "prototype" && current.construct !== void 0 && current.boundTarget === void 0 ? materializeFunctionProperties(current) : getGuestFunctionProperties(current) : isSandboxRegex(current) ? getRegexProperties(current) : isSandboxMap(current) || isSandboxSet(current) ? getCollectionProperties(current) : current;
8131
8176
  if (properties === void 0 && isGuestClosure(current) && (key === "name" || key === "length"))
8132
8177
  return {
@@ -8149,6 +8194,8 @@ function getSandboxDataProperty(value, key, budget) {
8149
8194
  let current = value;
8150
8195
  let depth = 0;
8151
8196
  while (typeof current === "object" && current !== null) {
8197
+ if (isFloat32Array(current) && typeof key !== "symbol" && isFloat32Index(String(key)))
8198
+ return Object.getOwnPropertyDescriptor(current, key)?.value;
8152
8199
  if (isGuestHostObject(current)) return typeof key === "symbol" ? void 0 : getHostObjectMember(current, String(key));
8153
8200
  if (isSandboxRegex(current)) return Object.getOwnPropertyDescriptor(getRegexProperties(current), key)?.value;
8154
8201
  if (isSandboxPromise(current)) return Object.getOwnPropertyDescriptor(getPromiseProperties(current), key)?.value;
@@ -8200,6 +8247,7 @@ function setSandboxPrototype(value, prototype, budget) {
8200
8247
  prototypes.set(value, prototype);
8201
8248
  }
8202
8249
  function isPrototypeRecord(value) {
8250
+ if (isFloat32Array(value)) return true;
8203
8251
  if (isGuestClosure(value)) return true;
8204
8252
  if (isGuestHostObject(value)) return false;
8205
8253
  if (isSandboxClosure(value) || isSandboxGenerator(value) || isSandboxMap(value) || isSandboxPromise(value) || isSandboxRegex(value) || isSandboxSet(value))
@@ -8219,7 +8267,7 @@ function hasGuestObjectState(value) {
8219
8267
  if (isLiveCapability(value)) return true;
8220
8268
  if (functionProperties.has(value) || prototypes.has(value) && !hasNullObjectPrototype(value)) return true;
8221
8269
  if (isSandboxBox(value) || isSandboxDate(value)) return false;
8222
- return descriptorObjects.has(value) && Object.values(Object.getOwnPropertyDescriptors(value)).some(
8270
+ return descriptorObjects.has(value) && (isFloat32Array(value) ? float32Properties(value).map(([, descriptor]) => descriptor) : Object.values(Object.getOwnPropertyDescriptors(value))).some(
8223
8271
  (descriptor) => !descriptor.enumerable || !descriptor.configurable || !descriptor.writable
8224
8272
  );
8225
8273
  }
@@ -9503,6 +9551,8 @@ async function acquireSandboxIterator(value, budget, context, asyncProtocol = fa
9503
9551
  const iterator = await invokeBuiltinClosure(factory, [], budget, context, value);
9504
9552
  if (typeof iterator !== "object" && typeof iterator !== "function" || iterator === null)
9505
9553
  throw new TypeError("Iterator must be an object.");
9554
+ if (!asyncProtocol && isSandboxGenerator(iterator) && !iterator.async && !hasExplicitSandboxPrototype(iterator) && getSandboxPropertyDescriptor(iterator, "next", budget) === void 0)
9555
+ return getSandboxIterator(iterator, budget, context);
9506
9556
  const next = await context.getProperty(iterator, "next");
9507
9557
  return guestIterator(iterator, next, asyncProtocol, budget, context, signal);
9508
9558
  }
@@ -9535,7 +9585,7 @@ async function readIteratorResult(iterator, result, property) {
9535
9585
  }
9536
9586
  function getSandboxAsyncIterator(value, budget, context, signal) {
9537
9587
  if (isSandboxGenerator(value) && value.async) {
9538
- return hasExplicitSandboxPrototype(value) ? context?.getProperty === void 0 ? generatorProtocolAdapter(value, budget, context, true, signal) : void 0 : { ...generatorObjectIterator(value, budget, context), asyncProtocol: true };
9588
+ return hasExplicitSandboxPrototype(value) ? context?.getProperty === void 0 ? guestProtocolAdapter(value, budget, context, true, signal) : void 0 : { ...generatorObjectIterator(value, budget, context), asyncProtocol: true };
9539
9589
  }
9540
9590
  if (value !== null && (typeof value === "object" || typeof value === "function") && !isGuestHostObject(value)) {
9541
9591
  const method = value[Symbol.asyncIterator];
@@ -9682,11 +9732,15 @@ function getSandboxIterator(value, budget, context) {
9682
9732
  }
9683
9733
  if (isGuestHostObject(value)) return getHostObjectIterator(value);
9684
9734
  if (isFloat32Array(value)) {
9735
+ if (hasExplicitSandboxPrototype(value) || budget !== void 0 && float32Prototypes.has(budget)) {
9736
+ if (getSandboxPropertyDescriptor(value, Symbol.iterator, budget) === void 0) return void 0;
9737
+ return guestProtocolAdapter(value, budget ?? new Budget(), context, false);
9738
+ }
9685
9739
  return syncIterator(Float32Array.prototype.values.call(value));
9686
9740
  }
9687
9741
  if (isSandboxGenerator(value)) {
9688
9742
  if (value.async) return void 0;
9689
- if (hasExplicitSandboxPrototype(value)) return context?.getProperty === void 0 ? generatorProtocolAdapter(value, budget ?? new Budget(), context, false) : void 0;
9743
+ if (hasExplicitSandboxPrototype(value)) return context?.getProperty === void 0 ? guestProtocolAdapter(value, budget ?? new Budget(), context, false) : void 0;
9690
9744
  return generatorObjectIterator(value, budget, context);
9691
9745
  }
9692
9746
  if (typeof value === "string") {
@@ -9764,7 +9818,7 @@ function collectionIterator(collection, value) {
9764
9818
  return adapter;
9765
9819
  }
9766
9820
  var asyncGeneratorRequests = /* @__PURE__ */ new WeakMap();
9767
- function generatorProtocolAdapter(value, budget, context, asyncProtocol, signal) {
9821
+ function guestProtocolAdapter(value, budget, context, asyncProtocol, signal) {
9768
9822
  const bridge = {
9769
9823
  ...context,
9770
9824
  stack: context?.stack ?? [],
@@ -9778,7 +9832,7 @@ function generatorProtocolAdapter(value, budget, context, asyncProtocol, signal)
9778
9832
  let resolved;
9779
9833
  let pending;
9780
9834
  const initialize = () => pending ??= acquireSandboxIterator(value, budget, bridge, asyncProtocol, signal).then((iterator) => {
9781
- if (iterator === void 0) throw new TypeError("Generator does not provide an iterator protocol.");
9835
+ if (iterator === void 0) throw new TypeError("Value does not provide an iterator protocol.");
9782
9836
  return resolved = iterator;
9783
9837
  });
9784
9838
  return {
@@ -13649,8 +13703,8 @@ async function definePropertiesFromObject(target, descriptors2, budget, context)
13649
13703
  }
13650
13704
  function defineDataProperty(target, key, descriptor, budget) {
13651
13705
  budget.visitNode();
13652
- if (isFloat32Array(target))
13653
- throw new TypeError("Typed array property descriptors are not supported.");
13706
+ if (isFloat32Array(target) && typeof key !== "symbol" && isFloat32Index(String(key)) && "value" in descriptor)
13707
+ descriptor = { ...descriptor, value: float32Number(descriptor.value) };
13654
13708
  const properties = objectProperties(target, true);
13655
13709
  if (Array.isArray(properties)) {
13656
13710
  if (key === "length" && "value" in descriptor)
@@ -14485,8 +14539,9 @@ async function callSetMethod(target, methodName, args, options, stack = []) {
14485
14539
 
14486
14540
  // packages/safe-js/src/interp/globals/float32array.ts
14487
14541
  var constructors = /* @__PURE__ */ new WeakSet();
14488
- function createFloat32ArrayGlobal(budget) {
14542
+ function createFloat32ArrayGlobal(budget, nativePrototype = false) {
14489
14543
  const constructor = createSandboxClosure({
14544
+ guest: nativePrototype,
14490
14545
  sandbox: true,
14491
14546
  name: "Float32Array",
14492
14547
  length: 3,
@@ -14494,32 +14549,307 @@ function createFloat32ArrayGlobal(budget) {
14494
14549
  call: () => {
14495
14550
  throw new TypeError("Constructor Float32Array requires 'new'.");
14496
14551
  },
14497
- construct: ([source]) => {
14498
- if (Array.isArray(source) || isFloat32Array(source)) {
14499
- const length2 = isFloat32Array(source) ? float32Storage(source).length : source.length;
14500
- checkFloat32Allocation(length2, budget);
14501
- if (isFloat32Array(source)) return new Float32Array(source);
14502
- const result = new Float32Array(length2);
14503
- for (let index = 0; index < length2; index += 1) {
14504
- budget.visitNode();
14505
- const descriptor = Object.getOwnPropertyDescriptor(source, index);
14506
- if (descriptor !== void 0 && !("value" in descriptor))
14507
- throw new TypeError("Float32Array input accessors are not supported.");
14508
- result[index] = float32Number(descriptor?.value);
14552
+ construct: (args, context) => {
14553
+ if (!nativePrototype) return allocateFloat32Array(args[0], budget);
14554
+ return (async () => {
14555
+ const newTarget = context?.newTarget ?? constructor;
14556
+ const candidate = context?.getProperty === void 0 ? getSandboxDataProperty(newTarget, "prototype", budget) : await context.getProperty(newTarget, "prototype");
14557
+ const prototype = candidate !== null && typeof candidate === "object" ? candidate : float32Prototypes.get(budget);
14558
+ const release = retainValues(budget, () => [prototype, ...args]);
14559
+ try {
14560
+ const result = args[0] !== null && typeof args[0] === "object" && !isFloat32Array(args[0]) ? await allocateFloat32Input(args[0], budget, context) : allocateFloat32Array(args[0], budget);
14561
+ setSandboxPrototype(result, prototype, budget);
14562
+ return result;
14563
+ } finally {
14564
+ release();
14509
14565
  }
14510
- return result;
14511
- }
14512
- const number = float32Number(source);
14513
- const length = Number.isNaN(number) ? 0 : Math.trunc(number);
14514
- if (length < 0 || !Number.isSafeInteger(length))
14515
- throw new RangeError("Invalid typed array length.");
14516
- checkFloat32Allocation(length, budget);
14517
- return new Float32Array(length);
14566
+ })();
14518
14567
  }
14519
14568
  });
14520
14569
  constructors.add(constructor);
14521
14570
  return constructor;
14522
14571
  }
14572
+ async function allocateFloat32Input(source, budget, context) {
14573
+ const callerContext = context;
14574
+ const bridge = {
14575
+ ...callerContext,
14576
+ stack: callerContext?.stack ?? [],
14577
+ thisValue: void 0,
14578
+ getProperty: callerContext?.getProperty ?? ((value, key) => {
14579
+ const descriptor = getSandboxPropertyDescriptor(value, key, budget);
14580
+ return descriptor === void 0 ? getSandboxDataProperty(value, key, budget) : readPropertyDescriptor(descriptor, value, bridge);
14581
+ }),
14582
+ invokeClosure: callerContext?.invokeClosure ?? ((callee, values2, receiver, construct) => invokeBuiltinClosure(callee, values2, budget, callerContext, receiver, construct))
14583
+ };
14584
+ const values = [];
14585
+ let iterator;
14586
+ let current;
14587
+ let result;
14588
+ const release = retainValues(budget, () => [source, values, iterator?.retainedValue, current, result]);
14589
+ const checkData = createDataCheckpoint(budget, bridge);
14590
+ try {
14591
+ iterator = await acquireSandboxIterator(source, budget, bridge);
14592
+ let length;
14593
+ if (iterator !== void 0) {
14594
+ while (true) {
14595
+ budget.visitNode();
14596
+ const next = await iterator.next();
14597
+ if (typeof next !== "object" || next === null) throw new TypeError("Iterator result must be an object.");
14598
+ if ((await readIteratorResult(iterator, next, "done")).value) break;
14599
+ current = (await readIteratorResult(iterator, next, "value")).value;
14600
+ budget.allocateArrayLength(values.length + 1);
14601
+ values.push(current);
14602
+ checkData(values, 1 + (budget.limits.dataSize === void 0 ? 0 : measureSandboxData([current])));
14603
+ }
14604
+ length = values.length;
14605
+ } else {
14606
+ current = await bridge.getProperty(source, "length");
14607
+ const number = await sandboxNumber(current, budget, bridge);
14608
+ length = Number.isNaN(number) || number <= 0 ? 0 : Math.min(Math.trunc(number), Number.MAX_SAFE_INTEGER);
14609
+ }
14610
+ checkFloat32Allocation(length, budget);
14611
+ result = new Float32Array(length);
14612
+ checkData(result, 0, true);
14613
+ for (let index = 0; index < length; index++) {
14614
+ budget.visitNode();
14615
+ current = iterator === void 0 ? await bridge.getProperty(source, String(index)) : values[index];
14616
+ result[index] = await sandboxNumber(current, budget, bridge);
14617
+ }
14618
+ return result;
14619
+ } finally {
14620
+ release();
14621
+ }
14622
+ }
14623
+ function allocateFloat32Array(source, budget) {
14624
+ if (Array.isArray(source) || isFloat32Array(source)) {
14625
+ const length2 = isFloat32Array(source) ? float32Storage(source).length : source.length;
14626
+ checkFloat32Allocation(length2, budget);
14627
+ if (isFloat32Array(source)) return new Float32Array(source);
14628
+ const result = new Float32Array(length2);
14629
+ for (let index = 0; index < length2; index += 1) {
14630
+ budget.visitNode();
14631
+ const descriptor = Object.getOwnPropertyDescriptor(source, index);
14632
+ if (descriptor !== void 0 && !("value" in descriptor))
14633
+ throw new TypeError("Float32Array input accessors are not supported.");
14634
+ result[index] = float32Number(descriptor?.value);
14635
+ }
14636
+ return result;
14637
+ }
14638
+ const number = float32Number(source);
14639
+ const length = Number.isNaN(number) ? 0 : Math.trunc(number);
14640
+ if (length < 0 || !Number.isSafeInteger(length))
14641
+ throw new RangeError("Invalid typed array length.");
14642
+ checkFloat32Allocation(length, budget);
14643
+ return new Float32Array(length);
14644
+ }
14645
+ function createFloat32ArrayPrototypes(budget, constructor) {
14646
+ const prototype = /* @__PURE__ */ Object.create(null);
14647
+ const shared = /* @__PURE__ */ Object.create(null);
14648
+ const abstractCall = () => {
14649
+ throw new TypeError("Abstract TypedArray constructor cannot be called.");
14650
+ };
14651
+ const typedArray = createSandboxClosure({
14652
+ guest: true,
14653
+ sandbox: true,
14654
+ name: "TypedArray",
14655
+ length: 0,
14656
+ call: abstractCall,
14657
+ construct: abstractCall
14658
+ });
14659
+ Object.defineProperty(materializeFunctionProperties(typedArray), "prototype", { value: shared, writable: false });
14660
+ Object.defineProperty(materializeFunctionProperties(typedArray), "from", {
14661
+ writable: true,
14662
+ configurable: true,
14663
+ value: createSandboxClosure({
14664
+ guest: true,
14665
+ sandbox: true,
14666
+ name: "from",
14667
+ length: 1,
14668
+ call: async (args, context) => {
14669
+ const target = context?.thisValue;
14670
+ const [source, mapper, receiver] = args;
14671
+ if (!isSandboxClosure(target) || target.construct === void 0)
14672
+ throw new TypeError("TypedArray.from requires a constructor receiver.");
14673
+ if (mapper !== void 0 && !isSandboxClosure(mapper))
14674
+ throw new TypeError("TypedArray.from mapper must be callable.");
14675
+ if (source === null || source === void 0)
14676
+ throw new TypeError("TypedArray.from requires a non-null source.");
14677
+ const callerContext = context;
14678
+ context = {
14679
+ ...callerContext,
14680
+ stack: callerContext?.stack ?? [],
14681
+ thisValue: target,
14682
+ getProperty: callerContext?.getProperty ?? ((value, key) => {
14683
+ const descriptor = getSandboxPropertyDescriptor(value, key, budget);
14684
+ return descriptor === void 0 ? getSandboxDataProperty(value, key, budget) : readPropertyDescriptor(descriptor, value, context);
14685
+ }),
14686
+ invokeClosure: callerContext?.invokeClosure ?? ((callee, values2, thisValue, construct) => invokeBuiltinClosure(callee, values2, budget, callerContext, thisValue, construct))
14687
+ };
14688
+ let result;
14689
+ let current;
14690
+ let iterator;
14691
+ const values = [];
14692
+ const release = retainValues(budget, () => [target, result, current, iterator?.retainedValue, values, ...args]);
14693
+ const checkData = createDataCheckpoint(budget, context);
14694
+ const read = (key) => context?.getProperty === void 0 ? getSandboxDataProperty(source, key, budget) : context.getProperty(source, key);
14695
+ try {
14696
+ iterator = await acquireSandboxIterator(source, budget, context);
14697
+ let length;
14698
+ if (iterator !== void 0) {
14699
+ while (true) {
14700
+ budget.visitNode();
14701
+ const next = await iterator.next();
14702
+ if (typeof next !== "object" || next === null) throw new TypeError("Iterator result must be an object.");
14703
+ if ((await readIteratorResult(iterator, next, "done")).value) break;
14704
+ current = (await readIteratorResult(iterator, next, "value")).value;
14705
+ budget.allocateArrayLength(values.length + 1);
14706
+ values.push(current);
14707
+ checkData(values, 1 + (budget.limits.dataSize === void 0 ? 0 : measureSandboxData([current])));
14708
+ }
14709
+ length = values.length;
14710
+ } else {
14711
+ const number = await sandboxNumber(await read("length"), budget, context);
14712
+ length = Number.isNaN(number) || number <= 0 ? 0 : Math.min(Math.trunc(number), Number.MAX_SAFE_INTEGER);
14713
+ }
14714
+ result = await invokeBuiltinClosure(target, [length], budget, context, void 0, true);
14715
+ if (!isFloat32Array(result) || float32Storage(result).length < length)
14716
+ throw new TypeError("TypedArray.from constructor must return sufficient typed storage.");
14717
+ checkData(result, 0, true);
14718
+ for (let index = 0; index < length; index++) {
14719
+ budget.visitNode();
14720
+ current = iterator === void 0 ? await read(String(index)) : values[index];
14721
+ if (mapper !== void 0)
14722
+ current = await invokeBuiltinClosure(mapper, [current, index], budget, context, receiver);
14723
+ result[index] = await sandboxNumber(current, budget, context);
14724
+ }
14725
+ return result;
14726
+ } finally {
14727
+ release();
14728
+ }
14729
+ }
14730
+ })
14731
+ });
14732
+ Object.defineProperty(materializeFunctionProperties(typedArray), "of", {
14733
+ writable: true,
14734
+ configurable: true,
14735
+ value: createSandboxClosure({
14736
+ guest: true,
14737
+ sandbox: true,
14738
+ name: "of",
14739
+ length: 0,
14740
+ call: async (args, context) => {
14741
+ const target = context?.thisValue;
14742
+ if (!isSandboxClosure(target) || target.construct === void 0)
14743
+ throw new TypeError("TypedArray.of requires a constructor receiver.");
14744
+ let result;
14745
+ const release = retainValues(budget, () => [target, result, ...args]);
14746
+ try {
14747
+ result = await invokeBuiltinClosure(target, [args.length], budget, context, void 0, true);
14748
+ if (!isFloat32Array(result) || float32Storage(result).length < args.length)
14749
+ throw new TypeError("TypedArray.of constructor must return sufficient typed storage.");
14750
+ for (let index = 0; index < args.length; index++) {
14751
+ budget.visitNode();
14752
+ result[index] = await sandboxNumber(args[index], budget, context);
14753
+ }
14754
+ return result;
14755
+ } finally {
14756
+ release();
14757
+ }
14758
+ }
14759
+ })
14760
+ });
14761
+ Object.defineProperties(materializeFunctionProperties(constructor), {
14762
+ prototype: { value: prototype, writable: false },
14763
+ BYTES_PER_ELEMENT: { value: 4, writable: false, enumerable: false, configurable: false }
14764
+ });
14765
+ Object.defineProperties(prototype, {
14766
+ constructor: { value: constructor, writable: true, configurable: true },
14767
+ BYTES_PER_ELEMENT: { value: 4 }
14768
+ });
14769
+ Object.defineProperty(shared, "constructor", { value: typedArray, writable: true, configurable: true });
14770
+ setSandboxPrototype(constructor, typedArray);
14771
+ setSandboxPrototype(prototype, shared);
14772
+ setSandboxPrototype(shared, getSandboxPrototype(/* @__PURE__ */ Object.create(null), budget));
14773
+ const getters = [];
14774
+ for (const key of ["length", "byteLength", "byteOffset"]) {
14775
+ const getter = createSandboxClosure({
14776
+ guest: true,
14777
+ sandbox: true,
14778
+ name: `get ${key}`,
14779
+ length: 0,
14780
+ call: (_args, context) => {
14781
+ if (!isFloat32Array(context?.thisValue)) throw new TypeError(`TypedArray ${key} requires a typed array receiver.`);
14782
+ const storage = float32Storage(context.thisValue);
14783
+ return key === "byteLength" ? storage.length * 4 : storage[key];
14784
+ }
14785
+ });
14786
+ getters.push(getter);
14787
+ Object.defineProperty(shared, key, { get: accessorAdapter(getter, "get"), configurable: true });
14788
+ }
14789
+ for (const key of ["set", "slice", "subarray"])
14790
+ Object.defineProperty(shared, key, { value: getFloat32Member(new Float32Array(0), key, budget), writable: true, configurable: true });
14791
+ const arrayPrototype = resolveIntrinsicIdentity(budget, '["Array","prototype"]');
14792
+ Object.defineProperty(shared, "toString", { value: getSandboxDataProperty(arrayPrototype, "toString", budget), writable: true, configurable: true });
14793
+ Object.defineProperty(shared, "join", {
14794
+ writable: true,
14795
+ configurable: true,
14796
+ value: createSandboxClosure({
14797
+ guest: true,
14798
+ sandbox: true,
14799
+ name: "join",
14800
+ length: 1,
14801
+ call: async (args, context) => {
14802
+ if (!isFloat32Array(context?.thisValue)) throw new TypeError("TypedArray join requires a typed array receiver.");
14803
+ const receiver = context.thisValue;
14804
+ const length = float32Storage(receiver).length;
14805
+ let separator = ",";
14806
+ let text = "";
14807
+ const release = retainValues(budget, () => [receiver, separator, text, ...args]);
14808
+ try {
14809
+ if (args[0] !== void 0) separator = await sandboxString(args[0], budget, context);
14810
+ for (let index = 0; index < length; index++) {
14811
+ budget.visitNode();
14812
+ text = budget.allocateString(text + (index === 0 ? "" : separator) + String(receiver[index]));
14813
+ }
14814
+ return text;
14815
+ } finally {
14816
+ release();
14817
+ }
14818
+ }
14819
+ })
14820
+ });
14821
+ const tagGetter = createSandboxClosure({
14822
+ guest: true,
14823
+ sandbox: true,
14824
+ name: "get [Symbol.toStringTag]",
14825
+ length: 0,
14826
+ call: (_args, context) => isFloat32Array(context?.thisValue) ? "Float32Array" : void 0
14827
+ });
14828
+ getters.push(tagGetter);
14829
+ Object.defineProperty(shared, Symbol.toStringTag, { get: accessorAdapter(tagGetter, "get"), configurable: true });
14830
+ for (const key of ["values", "keys", "entries"]) {
14831
+ const method = getSandboxDataProperty(arrayPrototype, key, budget);
14832
+ const closure = createSandboxClosure({
14833
+ guest: true,
14834
+ sandbox: true,
14835
+ name: key,
14836
+ length: 0,
14837
+ call: (args, context) => {
14838
+ if (!isFloat32Array(context?.thisValue)) throw new TypeError(`TypedArray ${key} requires a typed array receiver.`);
14839
+ return invokeBuiltinClosure(method, args, budget, context, context.thisValue);
14840
+ }
14841
+ });
14842
+ Object.defineProperty(shared, key, { value: closure, writable: true, configurable: true });
14843
+ if (key === "values") Object.defineProperty(shared, Symbol.iterator, { value: closure, writable: true, configurable: true });
14844
+ }
14845
+ float32Prototypes.set(budget, prototype);
14846
+ registerBuiltinIdentities(budget, { Float32Array: constructor, "%TypedArray%": typedArray });
14847
+ registerIntrinsicFunction(budget, constructor);
14848
+ registerIntrinsicFunction(budget, typedArray);
14849
+ registerIntrinsicObject(budget, prototype);
14850
+ registerIntrinsicObject(budget, shared);
14851
+ for (const getter of getters) registerIntrinsicFunction(budget, getter);
14852
+ }
14523
14853
  function isFloat32ArrayConstructor(value) {
14524
14854
  return typeof value === "object" && value !== null && constructors.has(value);
14525
14855
  }
@@ -14530,6 +14860,7 @@ function getFloat32Member(value, property, budget) {
14530
14860
  if (!("value" in descriptor)) throw new TypeError("Float32Array accessors are not supported.");
14531
14861
  return descriptor.value;
14532
14862
  }
14863
+ if (float32Prototypes.has(budget)) return void 0;
14533
14864
  const storage = float32Storage(value);
14534
14865
  if (key === "length") return storage.length;
14535
14866
  if (key === "byteLength") return storage.length * 4;
@@ -14537,6 +14868,7 @@ function getFloat32Member(value, property, budget) {
14537
14868
  if (key === "BYTES_PER_ELEMENT") return 4;
14538
14869
  if (!["set", "slice", "subarray"].includes(key)) return void 0;
14539
14870
  return createSandboxClosure({
14871
+ guest: true,
14540
14872
  sandbox: true,
14541
14873
  name: key,
14542
14874
  length: key === "set" ? 1 : 2,
@@ -14545,65 +14877,88 @@ function getFloat32Member(value, property, budget) {
14545
14877
  if (!isFloat32Array(receiver))
14546
14878
  throw new TypeError(`Float32Array#${key} requires a Float32Array receiver.`);
14547
14879
  const storage2 = float32Storage(receiver);
14880
+ const bridge = {
14881
+ ...context,
14882
+ stack: context?.stack ?? [],
14883
+ thisValue: receiver,
14884
+ getProperty: context?.getProperty ?? ((value2, property2) => {
14885
+ const descriptor2 = getSandboxPropertyDescriptor(value2, property2, budget);
14886
+ return descriptor2 === void 0 ? getSandboxDataProperty(value2, property2, budget) : readPropertyDescriptor(descriptor2, value2, bridge);
14887
+ }),
14888
+ invokeClosure: context?.invokeClosure ?? ((callee, values, thisValue, construct) => invokeBuiltinClosure(callee, values, budget, context, thisValue, construct))
14889
+ };
14548
14890
  if (key === "set") {
14549
- const [source, offsetValue = 0] = args;
14550
- if (!Array.isArray(source) && !isFloat32Array(source))
14551
- throw new TypeError("Float32Array#set requires an array or Float32Array.");
14552
- const number = float32Number(offsetValue);
14553
- const offset = Number.isNaN(number) ? 0 : Math.trunc(number);
14554
- const length2 = isFloat32Array(source) ? float32Storage(source).length : source.length;
14555
- if (offset < 0 || !Number.isSafeInteger(offset) || offset + length2 > storage2.length)
14556
- throw new RangeError("Float32Array#set source is out of bounds.");
14557
- if (isFloat32Array(source)) {
14558
- Float32Array.prototype.set.call(receiver, source, offset);
14559
- return void 0;
14560
- }
14561
- checkFloat32Allocation(length2, budget);
14562
- const copied = new Float32Array(length2);
14563
- for (let index = 0; index < length2; index += 1) {
14564
- budget.visitNode();
14565
- const entry = Object.getOwnPropertyDescriptor(source, index);
14566
- if (entry !== void 0 && !("value" in entry))
14567
- throw new TypeError("Float32Array input accessors are not supported.");
14568
- copied[index] = float32Number(entry?.value);
14569
- }
14570
- Float32Array.prototype.set.call(receiver, copied, offset);
14571
- return void 0;
14891
+ return (async () => {
14892
+ const [source, offsetValue = 0] = args;
14893
+ let current;
14894
+ let sourceObject;
14895
+ const release = retainValues(budget, () => [receiver, sourceObject, current, ...args]);
14896
+ try {
14897
+ const number = await sandboxNumber(offsetValue, budget, bridge);
14898
+ const offset = Number.isNaN(number) ? 0 : Math.trunc(number);
14899
+ if (offset < 0) throw new RangeError("Float32Array#set offset is out of bounds.");
14900
+ if (source === null || source === void 0) throw new TypeError("Float32Array#set requires a non-null source.");
14901
+ let length;
14902
+ if (isFloat32Array(source)) length = float32Storage(source).length;
14903
+ else {
14904
+ sourceObject = typeof source === "object" ? source : createSandboxBox(source);
14905
+ current = await bridge.getProperty(sourceObject, "length");
14906
+ const size = await sandboxNumber(current, budget, bridge);
14907
+ length = Number.isNaN(size) || size <= 0 ? 0 : Math.min(Math.trunc(size), Number.MAX_SAFE_INTEGER);
14908
+ }
14909
+ if (offset + length > storage2.length) throw new RangeError("Float32Array#set source is out of bounds.");
14910
+ if (isFloat32Array(source)) Float32Array.prototype.set.call(receiver, source, offset);
14911
+ else for (let index = 0; index < length; index++) {
14912
+ budget.visitNode();
14913
+ current = await bridge.getProperty(sourceObject, String(index));
14914
+ receiver[offset + index] = await sandboxNumber(current, budget, bridge);
14915
+ }
14916
+ return void 0;
14917
+ } finally {
14918
+ release();
14919
+ }
14920
+ })();
14572
14921
  }
14573
- const start = relativeIndex(args[0], storage2.length, 0);
14574
- const end = relativeIndex(args[1], storage2.length, storage2.length);
14575
- const length = Math.max(end - start, 0);
14576
- if (key === "subarray")
14577
- return new Float32Array(storage2.buffer, storage2.byteOffset + start * 4, length);
14578
- checkFloat32Allocation(length, budget);
14579
- const result = new Float32Array(length);
14580
- new Uint8Array(result.buffer).set(
14581
- new Uint8Array(storage2.buffer, storage2.byteOffset + start * 4, length * 4)
14582
- );
14583
- return result;
14922
+ return (async () => {
14923
+ const release = retainValues(budget, () => [receiver, ...args]);
14924
+ try {
14925
+ const start = relativeIndex(await sandboxNumber(args[0], budget, bridge), storage2.length);
14926
+ const end = args[1] === void 0 ? storage2.length : relativeIndex(await sandboxNumber(args[1], budget, bridge), storage2.length);
14927
+ const length = Math.max(end - start, 0);
14928
+ if (key === "subarray")
14929
+ return new Float32Array(storage2.buffer, storage2.byteOffset + start * 4, length);
14930
+ checkFloat32Allocation(length, budget);
14931
+ const result = new Float32Array(length);
14932
+ new Uint8Array(result.buffer).set(
14933
+ new Uint8Array(storage2.buffer, storage2.byteOffset + start * 4, length * 4)
14934
+ );
14935
+ return result;
14936
+ } finally {
14937
+ release();
14938
+ }
14939
+ })();
14584
14940
  }
14585
14941
  });
14586
14942
  }
14587
- function setFloat32Member(value, property, entry) {
14588
- const key = String(property);
14589
- if (isFloat32Index(key)) {
14943
+ function setFloat32Member(value, property, entry, budget) {
14944
+ const key = typeof property === "symbol" ? property : String(property);
14945
+ if (typeof key !== "symbol" && isFloat32Index(key)) {
14590
14946
  Reflect.set(value, key, float32Number(entry));
14591
14947
  return;
14592
14948
  }
14593
14949
  const descriptor = Object.getOwnPropertyDescriptor(value, key);
14594
- if (descriptor === void 0 && ["length", "byteLength", "byteOffset", "buffer", "BYTES_PER_ELEMENT"].includes(key))
14595
- throw new TypeError(`Cannot assign to read only property '${key}'.`);
14596
- if (descriptor !== void 0 && (!("value" in descriptor) || !descriptor.writable))
14597
- throw new TypeError(`Cannot assign to read only property '${key}'.`);
14950
+ const inherited = descriptor ?? (budget === void 0 ? void 0 : getSandboxPropertyDescriptor(value, key, budget));
14951
+ if (descriptor === void 0 && typeof key === "string" && (budget === void 0 || !float32Prototypes.has(budget)) && ["length", "byteLength", "byteOffset", "buffer", "BYTES_PER_ELEMENT"].includes(key))
14952
+ throw new TypeError(`Cannot assign to read only property '${String(key)}'.`);
14953
+ if (inherited !== void 0 && (!("value" in inherited) || !inherited.writable))
14954
+ throw new TypeError(`Cannot assign to read only property '${String(key)}'.`);
14598
14955
  Object.defineProperty(
14599
14956
  value,
14600
14957
  key,
14601
14958
  descriptor === void 0 ? { value: entry, configurable: true, enumerable: true, writable: true } : { value: entry }
14602
14959
  );
14603
14960
  }
14604
- function relativeIndex(value, length, fallback) {
14605
- if (value === void 0) return fallback;
14606
- const numeric = float32Number(value);
14961
+ function relativeIndex(numeric, length) {
14607
14962
  const integer2 = Number.isNaN(numeric) ? 0 : Math.trunc(numeric);
14608
14963
  return integer2 < 0 ? Math.max(length + integer2, 0) : Math.min(integer2, length);
14609
14964
  }
@@ -14766,7 +15121,7 @@ async function ordinaryHasInstance(value, constructor, budget, context) {
14766
15121
  budget.visitNode();
14767
15122
  return evaluateInstanceof(value, constructor.boundTarget, budget, context);
14768
15123
  }
14769
- if (isFloat32ArrayConstructor(constructor)) return isFloat32Array(value);
15124
+ if (isFloat32ArrayConstructor(constructor) && !isGuestClosure(constructor)) return isFloat32Array(value);
14770
15125
  if ((!isGuestClosure(constructor) || value !== null && typeof value === "object" && !hasExplicitSandboxPrototype(value)) && isSandboxErrorConstructorInstance2(value, constructor)) return true;
14771
15126
  if (!isGuestClosure(constructor) || typeof value !== "object" || value === null) return false;
14772
15127
  const prototype = await readInstanceProperty(constructor, "prototype", budget, context);
@@ -17406,7 +17761,7 @@ async function evaluateMemberCallExpression(node, context) {
17406
17761
  if (isFloat32Array(member.object)) {
17407
17762
  return evaluateResolvedCallExpression(
17408
17763
  node,
17409
- getFloat32Member(member.object, member.property, context.budget),
17764
+ await getPropertyValue(member.object, member.property, context),
17410
17765
  context,
17411
17766
  member.object
17412
17767
  );
@@ -17943,8 +18298,7 @@ function setSandboxProperty(target, property, value, budget, checkInherited = tr
17943
18298
  if (isSandboxGenerator(target)) target = getGeneratorProperties(target);
17944
18299
  if (isSandboxMap(target) || isSandboxSet(target)) target = getCollectionProperties(target);
17945
18300
  if (isFloat32Array(target)) {
17946
- if (typeof property === "symbol") throw new TypeError("Typed array symbol properties are not yet supported.");
17947
- setFloat32Member(target, property, value);
18301
+ setFloat32Member(target, property, value, budget);
17948
18302
  return;
17949
18303
  }
17950
18304
  if (isSandboxRegex(target)) {
@@ -24518,7 +24872,7 @@ function createBuiltinBindings(options) {
24518
24872
  const bindings = {
24519
24873
  ...createConsoleJsonGlobals(options),
24520
24874
  ...createCollectionGlobals(options),
24521
- Float32Array: createFloat32ArrayGlobal(options.budget),
24875
+ Float32Array: createFloat32ArrayGlobal(options.budget, options.float32Prototypes !== false),
24522
24876
  Date: createDateGlobal(options),
24523
24877
  Symbol: createSymbolGlobal(options.budget),
24524
24878
  BigInt: createBigIntGlobal(options.budget),
@@ -24531,6 +24885,7 @@ function createBuiltinBindings(options) {
24531
24885
  ...createRegexGlobals(options)
24532
24886
  };
24533
24887
  createFunctionPrototype(options.budget, options.functionHasInstance);
24888
+ if (options.float32Prototypes !== false) createFloat32ArrayPrototypes(options.budget, bindings.Float32Array);
24534
24889
  if (options.errorPrototypes !== false) createErrorPrototypes(options.budget, bindings);
24535
24890
  createGeneratorPrototypes(options.budget);
24536
24891
  registerBuiltinIdentities(options.budget, bindings);
@@ -25263,6 +25618,10 @@ function validateDumpHeap(root, state) {
25263
25618
  if (entry.kind === "float32array") {
25264
25619
  validateFloat32Storage(entry);
25265
25620
  requireRecord(entry.entries, `${path}.entries`);
25621
+ if (Object.hasOwn(entry, "state")) {
25622
+ if (Object.keys(entry.entries).length !== 0) fail("invalidValue", path, "ambiguous Float32Array property state");
25623
+ validateGuestHeapNode({ kind: "guest-object", state: entry.state }, heap, state.limits.maxEntries);
25624
+ }
25266
25625
  continue;
25267
25626
  }
25268
25627
  if (entry.kind === "arguments") {
@@ -25491,6 +25850,10 @@ function validateHeapValue(value, path, state, heap) {
25491
25850
  if (record4.kind === "float32array") {
25492
25851
  validateFloat32Storage(record4);
25493
25852
  requireRecord(record4.entries, `${path}.entries`);
25853
+ if (Object.hasOwn(record4, "state")) {
25854
+ if (Object.keys(record4.entries).length !== 0) fail("invalidValue", path, "ambiguous Float32Array property state");
25855
+ validateGuestHeapNode({ kind: "guest-object", state: record4.state }, heap, state.limits.maxEntries);
25856
+ }
25494
25857
  }
25495
25858
  if (record4.kind === "map") {
25496
25859
  const entries = requireArray(record4.entries, `${path}.entries`, state);
@@ -26485,9 +26848,12 @@ function measureSandboxData(values, options = {}) {
26485
26848
  seen.add(storage.buffer);
26486
26849
  usage += storage.byteLength;
26487
26850
  }
26488
- for (const [key, descriptor] of float32DataProperties(value)) {
26489
- usage += key.length + 1;
26490
- visit(descriptor.value, depth + 1);
26851
+ for (const [key, descriptor] of float32Properties(value)) {
26852
+ usage += 1;
26853
+ if (typeof key === "string") usage += key.length;
26854
+ else visit(key, depth + 1);
26855
+ if ("value" in descriptor) visit(descriptor.value, depth + 1);
26856
+ else for (const closure of retainedAccessorClosures(descriptor)) visit(closure, depth + 1);
26491
26857
  }
26492
26858
  return;
26493
26859
  }
@@ -41448,4 +41814,4 @@ export {
41448
41814
  FileSnapshotBackend,
41449
41815
  run
41450
41816
  };
41451
- //# sourceMappingURL=chunk-V6LQP64H.js.map
41817
+ //# sourceMappingURL=chunk-PT7PBLVT.js.map