@poe-platform/safe-js 0.1.312 → 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,42 +14877,66 @@ 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
- const [source, offsetValue = 0] = args;
14882
- if (!Array.isArray(source) && !isFloat32Array(source))
14883
- throw new TypeError("Float32Array#set requires an array or Float32Array.");
14884
- const number = float32Number(offsetValue);
14885
- const offset = Number.isNaN(number) ? 0 : Math.trunc(number);
14886
- const length2 = isFloat32Array(source) ? float32Storage(source).length : source.length;
14887
- if (offset < 0 || !Number.isSafeInteger(offset) || offset + length2 > storage2.length)
14888
- throw new RangeError("Float32Array#set source is out of bounds.");
14889
- if (isFloat32Array(source)) {
14890
- Float32Array.prototype.set.call(receiver, source, offset);
14891
- return void 0;
14892
- }
14893
- checkFloat32Allocation(length2, budget);
14894
- const copied = new Float32Array(length2);
14895
- for (let index = 0; index < length2; index += 1) {
14896
- budget.visitNode();
14897
- const entry = Object.getOwnPropertyDescriptor(source, index);
14898
- if (entry !== void 0 && !("value" in entry))
14899
- throw new TypeError("Float32Array input accessors are not supported.");
14900
- copied[index] = float32Number(entry?.value);
14901
- }
14902
- Float32Array.prototype.set.call(receiver, copied, offset);
14903
- 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
+ })();
14904
14921
  }
14905
- const start = relativeIndex(args[0], storage2.length, 0);
14906
- const end = relativeIndex(args[1], storage2.length, storage2.length);
14907
- const length = Math.max(end - start, 0);
14908
- if (key === "subarray")
14909
- return new Float32Array(storage2.buffer, storage2.byteOffset + start * 4, length);
14910
- checkFloat32Allocation(length, budget);
14911
- const result = new Float32Array(length);
14912
- new Uint8Array(result.buffer).set(
14913
- new Uint8Array(storage2.buffer, storage2.byteOffset + start * 4, length * 4)
14914
- );
14915
- 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
+ })();
14916
14940
  }
14917
14941
  });
14918
14942
  }
@@ -14934,9 +14958,7 @@ function setFloat32Member(value, property, entry, budget) {
14934
14958
  descriptor === void 0 ? { value: entry, configurable: true, enumerable: true, writable: true } : { value: entry }
14935
14959
  );
14936
14960
  }
14937
- function relativeIndex(value, length, fallback) {
14938
- if (value === void 0) return fallback;
14939
- const numeric = float32Number(value);
14961
+ function relativeIndex(numeric, length) {
14940
14962
  const integer2 = Number.isNaN(numeric) ? 0 : Math.trunc(numeric);
14941
14963
  return integer2 < 0 ? Math.max(length + integer2, 0) : Math.min(integer2, length);
14942
14964
  }
@@ -41792,4 +41814,4 @@ export {
41792
41814
  FileSnapshotBackend,
41793
41815
  run
41794
41816
  };
41795
- //# sourceMappingURL=chunk-UKPTA2FY.js.map
41817
+ //# sourceMappingURL=chunk-PT7PBLVT.js.map