import { createRequire } from 'module'; const require = createRequire(import.meta.url);
let [__dirname, __filename] = typeof import.meta.url === 'string'
          ? ((url) => [url.fileURLToPath(new URL('.', import.meta.url)), url.fileURLToPath(import.meta.url)])(require('node:url'))
          : ['', ''];
import "./iterator-helpers-polyfill.js";

import {
  __commonJS,
  __name,
  __require,
  require_transform
} from "./chunk-LY4UAG7A.js";

// lib/approx/proxy.js
var require_proxy = __commonJS({
  "lib/approx/proxy.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.theArgumentsProxy = exports.theProxy = void 0;
    exports.makeBaseProxy = makeBaseProxy;
    exports.isProxy = isProxy;
    exports.stdlibProxy = stdlibProxy;
    exports.makeModuleProxy = makeModuleProxy;
    var handler = {
      get(target, p, receiver) {
        switch (p) {
          case "length":
            if (receiver === exports.theArgumentsProxy)
              return 10;
            else
              return 1;
          case Symbol.toPrimitive:
            return function(hint) {
              switch (hint) {
                case "number":
                  return 0;
                case "string":
                  return "";
                case "default":
                  return "0";
              }
            };
          case Symbol.iterator:
            return function() {
              let index = 0;
              return {
                next: /* @__PURE__ */ __name(() => {
                  if (index++ < 3)
                    return { value: exports.theProxy, done: false };
                  else
                    return { value: void 0, done: true };
                }, "next")
              };
            };
          default:
            const desc = Object.getOwnPropertyDescriptor(target, p);
            if (desc && !desc.configurable && !desc.writable)
              return target[p];
            return exports.theProxy;
        }
      },
      set() {
        return false;
      },
      has() {
        return true;
      },
      apply() {
        return exports.theProxy;
      },
      construct() {
        return exports.theProxy;
      },
      defineProperty() {
        return false;
      },
      deleteProperty() {
        return true;
      },
      getOwnPropertyDescriptor(target, property) {
        if (property === "prototype")
          return Object.getOwnPropertyDescriptor(target, property);
        return {
          configurable: true,
          enumerable: true,
          value: exports.theProxy,
          writable: true
        };
      },
      isExtensible() {
        return true;
      },
      setPrototypeOf() {
        return false;
      }
    };
    exports.theProxy = new Proxy(/* @__PURE__ */ __name(function theProxy() {
    }, "theProxy"), handler);
    exports.theArgumentsProxy = new Proxy([], handler);
    function makeBaseProxy(target) {
      if (!target || !(typeof target === "object" || typeof target === "function"))
        return exports.theProxy;
      return new Proxy(target, {
        get(target2, prop, receiver) {
          if (prop in target2)
            return Reflect.get(target2, prop, receiver);
          else {
            const desc = Object.getOwnPropertyDescriptor(target2, prop);
            if (desc && !desc.configurable && !desc.writable)
              return target2[prop];
            return exports.theProxy;
          }
        },
        has(_target, _prop) {
          return true;
        }
      });
    }
    __name(makeBaseProxy, "makeBaseProxy");
    function isProxy(x) {
      return x === exports.theProxy || x === exports.theArgumentsProxy;
    }
    __name(isProxy, "isProxy");
    function stdlibProxy(obj) {
      return new Proxy(obj, {
        get: /* @__PURE__ */ __name(function(target, prop) {
          const desc = Object.getOwnPropertyDescriptor(target, prop);
          if (desc && !desc.configurable && !desc.writable)
            return target[prop];
          if (typeof desc?.value === "function")
            return exports.theProxy;
          return desc?.value;
        }, "get")
      });
    }
    __name(stdlibProxy, "stdlibProxy");
    function makeModuleProxy(target) {
      return new Proxy(target, {
        get(target2, prop, _receiver) {
          return prop === "constructor" ? exports.theProxy : target2[prop];
        }
      });
    }
    __name(makeModuleProxy, "makeModuleProxy");
  }
});

// lib/approx/sandbox.js
var require_sandbox = __commonJS({
  "lib/approx/sandbox.js"(exports, module) {
    "use strict";
    var __importDefault = exports && exports.__importDefault || function(mod) {
      return mod && mod.__esModule ? mod : { "default": mod };
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.WHITELISTED = void 0;
    exports.patchGlobalBuiltins = patchGlobalBuiltins;
    var module_1 = __importDefault(__require("module"));
    var proxy_1 = require_proxy();
    var transform_1 = require_transform();
    exports.WHITELISTED = /* @__PURE__ */ new Set([
      "events",
      "buffer",
      "assert",
      "assert/strict",
      "constants",
      "crypto",
      "module",
      "string_decoder",
      "util",
      "util/types",
      "path",
      "url",
      "tty",
      "sys"
    ]);
    function patchGlobalBuiltins() {
      const emptyFunction = /* @__PURE__ */ __name(function() {
      }, "emptyFunction");
      const invokeCallbackWithArgs = /* @__PURE__ */ __name(function(cb, ...args) {
        cb(...args);
      }, "invokeCallbackWithArgs");
      const invokeCallbackWithArgs2 = /* @__PURE__ */ __name(function(cb, _c, ...args) {
        cb(...args);
      }, "invokeCallbackWithArgs2");
      const g = globalThis;
      g.clearImmediate = g.clearInterval = g.clearTimeout = g.fetch = emptyFunction;
      g.setImmediate = g.queueMicrotask = invokeCallbackWithArgs;
      g.setInterval = g.setTimeout = invokeCallbackWithArgs2;
      const p = process;
      p.on = p.send = p.chdir = p.exit = p.reallyExit = p.abort = p.dlopen = p.kill = p.openStdin = proxy_1.theProxy;
      p.nextTick = invokeCallbackWithArgs;
      for (const prop of ["stdin", "stdout", "stderr"])
        Object.defineProperty(p, prop, { value: proxy_1.theProxy });
      const c = console;
      c.log = c.clear = c.dir = c.error = c.table = c.timeEnd = c.trace = emptyFunction;
      c._stdout = c._stderr = proxy_1.theProxy;
      Error.captureStackTrace = emptyFunction;
      Atomics.wait = Atomics.waitAsync = proxy_1.theProxy;
      module_1.default.register = function() {
      };
      g.describe = g.it = g.before = g.beforeAll = g.beforeEach = g.after = g.afterAll = g.afterEach = g.test = g.define = emptyFunction;
      g.describe.skip = emptyFunction;
      g.expect = proxy_1.theProxy;
      g.window = g.document = proxy_1.theProxy;
      for (const x of [
        Array,
        ArrayBuffer,
        BigInt,
        Boolean,
        DataView,
        Date,
        AggregateError,
        EvalError,
        RangeError,
        ReferenceError,
        SyntaxError,
        TypeError,
        URIError,
        Intl,
        Int8Array,
        Uint8Array,
        Uint16Array,
        Int16Array,
        Uint32Array,
        Int32Array,
        Float32Array,
        Float64Array,
        Uint8ClampedArray,
        BigUint64Array,
        BigInt64Array,
        FinalizationRegistry,
        JSON,
        Map,
        Math,
        Number,
        Object,
        Promise,
        Proxy,
        Reflect,
        RegExp,
        Set,
        String,
        Symbol,
        WeakMap,
        WeakRef,
        WeakSet
      ]) {
        Object.freeze(x);
        if ("prototype" in x)
          Object.freeze(x.prototype);
      }
      Object.freeze(Function);
      for (const p2 of ["apply", "bind", "call"])
        Object.defineProperty(Function.prototype, p2, { configurable: false, writable: false });
      for (const p2 of ["globalThis", "global", "Infinity", "NaN", "undefined", "eval", "isFinite", "isNaN", "parseFloat", "parseInt", ...transform_1.SPECIALS, "$log"])
        Object.defineProperty(g, p2, { configurable: false, writable: false });
      Object.freeze(module_1.default);
      Object.freeze(module_1.default.prototype);
      Object.freeze(process);
      Object.freeze(Object.getPrototypeOf(module));
    }
    __name(patchGlobalBuiltins, "patchGlobalBuiltins");
  }
});

export {
  require_proxy,
  require_sandbox
};
//# sourceMappingURL=chunk-GSPO4CLX.js.map
