@poe-platform/safe-js 0.1.354 → 0.1.355

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.
@@ -14647,16 +14647,21 @@ function createFloat32ArrayGlobal(budget, nativePrototype = false) {
14647
14647
  const offset = Number.isNaN(number) ? 0 : Math.trunc(number);
14648
14648
  if (!Number.isSafeInteger(offset) || offset < 0 || offset % 4 !== 0)
14649
14649
  throw new RangeError("Invalid Float32Array buffer offset.");
14650
- const bytes = arrayBufferLength(buffer);
14651
14650
  let length;
14652
- if (args[2] === void 0) {
14651
+ if (args[2] !== void 0) {
14652
+ const size = await sandboxNumber(args[2], budget, context);
14653
+ length = Number.isNaN(size) ? 0 : Math.trunc(size);
14654
+ if (!Number.isSafeInteger(length) || length < 0)
14655
+ throw new RangeError("Invalid Float32Array view length.");
14656
+ }
14657
+ if (arrayBufferDetached(buffer)) throw new TypeError("Cannot construct Float32Array from a detached ArrayBuffer.");
14658
+ const bytes = arrayBufferLength(buffer);
14659
+ if (length === void 0) {
14653
14660
  if (arrayBufferOptions(buffer) === void 0 && bytes % 4 !== 0 || offset > bytes)
14654
14661
  throw new RangeError("Invalid Float32Array buffer length.");
14655
14662
  length = Math.floor((bytes - offset) / 4);
14656
14663
  } else {
14657
- const size = await sandboxNumber(args[2], budget, context);
14658
- length = Number.isNaN(size) ? 0 : Math.trunc(size);
14659
- if (!Number.isSafeInteger(length) || length < 0 || offset + length * 4 > arrayBufferLength(buffer))
14664
+ if (offset + length * 4 > bytes)
14660
14665
  throw new RangeError("Invalid Float32Array view length.");
14661
14666
  }
14662
14667
  budget.allocateArrayLength(length);
@@ -42755,4 +42760,4 @@ export {
42755
42760
  FileSnapshotBackend,
42756
42761
  run
42757
42762
  };
42758
- //# sourceMappingURL=chunk-CJ7PNS2V.js.map
42763
+ //# sourceMappingURL=chunk-3OJO2L46.js.map