@poe-platform/safe-js 0.1.313 → 0.1.314

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.
@@ -14877,19 +14877,19 @@ function getFloat32Member(value, property, budget) {
14877
14877
  if (!isFloat32Array(receiver))
14878
14878
  throw new TypeError(`Float32Array#${key} requires a Float32Array receiver.`);
14879
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
+ };
14880
14890
  if (key === "set") {
14881
14891
  return (async () => {
14882
14892
  const [source, offsetValue = 0] = args;
14883
- const bridge = {
14884
- ...context,
14885
- stack: context?.stack ?? [],
14886
- thisValue: receiver,
14887
- getProperty: context?.getProperty ?? ((value2, property2) => {
14888
- const descriptor2 = getSandboxPropertyDescriptor(value2, property2, budget);
14889
- return descriptor2 === void 0 ? getSandboxDataProperty(value2, property2, budget) : readPropertyDescriptor(descriptor2, value2, bridge);
14890
- }),
14891
- invokeClosure: context?.invokeClosure ?? ((callee, values, thisValue, construct) => invokeBuiltinClosure(callee, values, budget, context, thisValue, construct))
14892
- };
14893
14893
  let current;
14894
14894
  let sourceObject;
14895
14895
  const release = retainValues(budget, () => [receiver, sourceObject, current, ...args]);
@@ -14898,17 +14898,17 @@ function getFloat32Member(value, property, budget) {
14898
14898
  const offset = Number.isNaN(number) ? 0 : Math.trunc(number);
14899
14899
  if (offset < 0) throw new RangeError("Float32Array#set offset is out of bounds.");
14900
14900
  if (source === null || source === void 0) throw new TypeError("Float32Array#set requires a non-null source.");
14901
- let length2;
14902
- if (isFloat32Array(source)) length2 = float32Storage(source).length;
14901
+ let length;
14902
+ if (isFloat32Array(source)) length = float32Storage(source).length;
14903
14903
  else {
14904
14904
  sourceObject = typeof source === "object" ? source : createSandboxBox(source);
14905
14905
  current = await bridge.getProperty(sourceObject, "length");
14906
14906
  const size = await sandboxNumber(current, budget, bridge);
14907
- length2 = Number.isNaN(size) || size <= 0 ? 0 : Math.min(Math.trunc(size), Number.MAX_SAFE_INTEGER);
14907
+ length = Number.isNaN(size) || size <= 0 ? 0 : Math.min(Math.trunc(size), Number.MAX_SAFE_INTEGER);
14908
14908
  }
14909
- if (offset + length2 > storage2.length) throw new RangeError("Float32Array#set source is out of bounds.");
14909
+ if (offset + length > storage2.length) throw new RangeError("Float32Array#set source is out of bounds.");
14910
14910
  if (isFloat32Array(source)) Float32Array.prototype.set.call(receiver, source, offset);
14911
- else for (let index = 0; index < length2; index++) {
14911
+ else for (let index = 0; index < length; index++) {
14912
14912
  budget.visitNode();
14913
14913
  current = await bridge.getProperty(sourceObject, String(index));
14914
14914
  receiver[offset + index] = await sandboxNumber(current, budget, bridge);
@@ -14919,17 +14919,24 @@ function getFloat32Member(value, property, budget) {
14919
14919
  }
14920
14920
  })();
14921
14921
  }
14922
- const start = relativeIndex(args[0], storage2.length, 0);
14923
- const end = relativeIndex(args[1], storage2.length, storage2.length);
14924
- const length = Math.max(end - start, 0);
14925
- if (key === "subarray")
14926
- return new Float32Array(storage2.buffer, storage2.byteOffset + start * 4, length);
14927
- checkFloat32Allocation(length, budget);
14928
- const result = new Float32Array(length);
14929
- new Uint8Array(result.buffer).set(
14930
- new Uint8Array(storage2.buffer, storage2.byteOffset + start * 4, length * 4)
14931
- );
14932
- 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
+ })();
14933
14940
  }
14934
14941
  });
14935
14942
  }
@@ -14951,9 +14958,7 @@ function setFloat32Member(value, property, entry, budget) {
14951
14958
  descriptor === void 0 ? { value: entry, configurable: true, enumerable: true, writable: true } : { value: entry }
14952
14959
  );
14953
14960
  }
14954
- function relativeIndex(value, length, fallback) {
14955
- if (value === void 0) return fallback;
14956
- const numeric = float32Number(value);
14961
+ function relativeIndex(numeric, length) {
14957
14962
  const integer2 = Number.isNaN(numeric) ? 0 : Math.trunc(numeric);
14958
14963
  return integer2 < 0 ? Math.max(length + integer2, 0) : Math.min(integer2, length);
14959
14964
  }
@@ -41809,4 +41814,4 @@ export {
41809
41814
  FileSnapshotBackend,
41810
41815
  run
41811
41816
  };
41812
- //# sourceMappingURL=chunk-HUG5DIKM.js.map
41817
+ //# sourceMappingURL=chunk-PT7PBLVT.js.map