aboutsummaryrefslogtreecommitdiff
path: root/src/js/out/modules_dev/node/wasi.js.map
diff options
context:
space:
mode:
Diffstat (limited to 'src/js/out/modules_dev/node/wasi.js.map')
-rw-r--r--src/js/out/modules_dev/node/wasi.js.map11
1 files changed, 0 insertions, 11 deletions
diff --git a/src/js/out/modules_dev/node/wasi.js.map b/src/js/out/modules_dev/node/wasi.js.map
deleted file mode 100644
index 7344ed1e6..000000000
--- a/src/js/out/modules_dev/node/wasi.js.map
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "version": 3,
- "sources": ["src/js/node/wasi.js", "src/js/node/wasi.js"],
- "sourcesContent": [
- "// Hardcoded module \"node:wasi\"\n// HUGE thanks to:\n// - @williamstein and https://github.com/sagemathinc/cowasm/tree/main/core/wasi-js\n// - @syrusakbary for wasmer-js https://github.com/wasmerio/wasmer-js\n// - Gus Caplan for node-wasi https://github.com/devsnek/node-wasi\n//\n// Eventually we will implement this in native code, but this is just a quick hack to get WASI working.\n\n/** **/\n// constants is injected into the top of this file\nconst nodeFsConstants = constants;\n\nvar __getOwnPropNames = Object.getOwnPropertyNames;\n\nvar __commonJS = (cb, mod) =>\n function __require2() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n };\n\n// node_modules/wasi-js/dist/types.js\nvar require_types = __commonJS({\n \"node_modules/wasi-js/dist/types.js\"(exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n exports.WASIKillError = exports.WASIExitError = exports.WASIError = void 0;\n var WASIError = class extends Error {\n constructor(errno) {\n super();\n this.errno = errno;\n Object.setPrototypeOf(this, WASIError.prototype);\n }\n };\n exports.WASIError = WASIError;\n var WASIExitError = class extends Error {\n constructor(code) {\n super(`WASI Exit error: ${code}`);\n this.code = code;\n Object.setPrototypeOf(this, WASIExitError.prototype);\n }\n };\n exports.WASIExitError = WASIExitError;\n var WASIKillError = class extends Error {\n constructor(signal) {\n super(`WASI Kill signal: ${signal}`);\n this.signal = signal;\n Object.setPrototypeOf(this, WASIKillError.prototype);\n }\n };\n exports.WASIKillError = WASIKillError;\n },\n});\n\n// node_modules/wasi-js/dist/constants.js\nvar require_constants = __commonJS({\n \"node_modules/wasi-js/dist/constants.js\"(exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n exports.WASI_ENOMSG =\n exports.WASI_ENOMEM =\n exports.WASI_ENOLINK =\n exports.WASI_ENOLCK =\n exports.WASI_ENOEXEC =\n exports.WASI_ENOENT =\n exports.WASI_ENODEV =\n exports.WASI_ENOBUFS =\n exports.WASI_ENFILE =\n exports.WASI_ENETUNREACH =\n exports.WASI_ENETRESET =\n exports.WASI_ENETDOWN =\n exports.WASI_ENAMETOOLONG =\n exports.WASI_EMULTIHOP =\n exports.WASI_EMSGSIZE =\n exports.WASI_EMLINK =\n exports.WASI_EMFILE =\n exports.WASI_ELOOP =\n exports.WASI_EISDIR =\n exports.WASI_EISCONN =\n exports.WASI_EIO =\n exports.WASI_EINVAL =\n exports.WASI_EINTR =\n exports.WASI_EINPROGRESS =\n exports.WASI_EILSEQ =\n exports.WASI_EIDRM =\n exports.WASI_EHOSTUNREACH =\n exports.WASI_EFBIG =\n exports.WASI_EFAULT =\n exports.WASI_EEXIST =\n exports.WASI_EDQUOT =\n exports.WASI_EDOM =\n exports.WASI_EDESTADDRREQ =\n exports.WASI_EDEADLK =\n exports.WASI_ECONNRESET =\n exports.WASI_ECONNREFUSED =\n exports.WASI_ECONNABORTED =\n exports.WASI_ECHILD =\n exports.WASI_ECANCELED =\n exports.WASI_EBUSY =\n exports.WASI_EBADMSG =\n exports.WASI_EBADF =\n exports.WASI_EALREADY =\n exports.WASI_EAGAIN =\n exports.WASI_EAFNOSUPPORT =\n exports.WASI_EADDRNOTAVAIL =\n exports.WASI_EADDRINUSE =\n exports.WASI_EACCES =\n exports.WASI_E2BIG =\n exports.WASI_ESUCCESS =\n void 0;\n exports.WASI_SIGVTALRM =\n exports.WASI_SIGUSR2 =\n exports.WASI_SIGUSR1 =\n exports.WASI_SIGURG =\n exports.WASI_SIGTTOU =\n exports.WASI_SIGTTIN =\n exports.WASI_SIGTSTP =\n exports.WASI_SIGTRAP =\n exports.WASI_SIGTERM =\n exports.WASI_SIGSTOP =\n exports.WASI_SIGSEGV =\n exports.WASI_SIGQUIT =\n exports.WASI_SIGPIPE =\n exports.WASI_SIGKILL =\n exports.WASI_SIGINT =\n exports.WASI_SIGILL =\n exports.WASI_SIGHUP =\n exports.WASI_SIGFPE =\n exports.WASI_SIGCONT =\n exports.WASI_SIGCHLD =\n exports.WASI_SIGBUS =\n exports.WASI_SIGALRM =\n exports.WASI_SIGABRT =\n exports.WASI_ENOTCAPABLE =\n exports.WASI_EXDEV =\n exports.WASI_ETXTBSY =\n exports.WASI_ETIMEDOUT =\n exports.WASI_ESTALE =\n exports.WASI_ESRCH =\n exports.WASI_ESPIPE =\n exports.WASI_EROFS =\n exports.WASI_ERANGE =\n exports.WASI_EPROTOTYPE =\n exports.WASI_EPROTONOSUPPORT =\n exports.WASI_EPROTO =\n exports.WASI_EPIPE =\n exports.WASI_EPERM =\n exports.WASI_EOWNERDEAD =\n exports.WASI_EOVERFLOW =\n exports.WASI_ENXIO =\n exports.WASI_ENOTTY =\n exports.WASI_ENOTSUP =\n exports.WASI_ENOTSOCK =\n exports.WASI_ENOTRECOVERABLE =\n exports.WASI_ENOTEMPTY =\n exports.WASI_ENOTDIR =\n exports.WASI_ENOTCONN =\n exports.WASI_ENOSYS =\n exports.WASI_ENOSPC =\n exports.WASI_ENOPROTOOPT =\n void 0;\n exports.RIGHTS_REGULAR_FILE_BASE =\n exports.RIGHTS_CHARACTER_DEVICE_INHERITING =\n exports.RIGHTS_CHARACTER_DEVICE_BASE =\n exports.RIGHTS_BLOCK_DEVICE_INHERITING =\n exports.RIGHTS_BLOCK_DEVICE_BASE =\n exports.RIGHTS_ALL =\n exports.WASI_RIGHT_SOCK_SHUTDOWN =\n exports.WASI_RIGHT_POLL_FD_READWRITE =\n exports.WASI_RIGHT_PATH_UNLINK_FILE =\n exports.WASI_RIGHT_PATH_REMOVE_DIRECTORY =\n exports.WASI_RIGHT_PATH_SYMLINK =\n exports.WASI_RIGHT_FD_FILESTAT_SET_TIMES =\n exports.WASI_RIGHT_FD_FILESTAT_SET_SIZE =\n exports.WASI_RIGHT_FD_FILESTAT_GET =\n exports.WASI_RIGHT_PATH_FILESTAT_SET_TIMES =\n exports.WASI_RIGHT_PATH_FILESTAT_SET_SIZE =\n exports.WASI_RIGHT_PATH_FILESTAT_GET =\n exports.WASI_RIGHT_PATH_RENAME_TARGET =\n exports.WASI_RIGHT_PATH_RENAME_SOURCE =\n exports.WASI_RIGHT_PATH_READLINK =\n exports.WASI_RIGHT_FD_READDIR =\n exports.WASI_RIGHT_PATH_OPEN =\n exports.WASI_RIGHT_PATH_LINK_TARGET =\n exports.WASI_RIGHT_PATH_LINK_SOURCE =\n exports.WASI_RIGHT_PATH_CREATE_FILE =\n exports.WASI_RIGHT_PATH_CREATE_DIRECTORY =\n exports.WASI_RIGHT_FD_ALLOCATE =\n exports.WASI_RIGHT_FD_ADVISE =\n exports.WASI_RIGHT_FD_WRITE =\n exports.WASI_RIGHT_FD_TELL =\n exports.WASI_RIGHT_FD_SYNC =\n exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS =\n exports.WASI_RIGHT_FD_SEEK =\n exports.WASI_RIGHT_FD_READ =\n exports.WASI_RIGHT_FD_DATASYNC =\n exports.WASI_FDFLAG_SYNC =\n exports.WASI_FDFLAG_RSYNC =\n exports.WASI_FDFLAG_NONBLOCK =\n exports.WASI_FDFLAG_DSYNC =\n exports.WASI_FDFLAG_APPEND =\n exports.WASI_FILETYPE_SYMBOLIC_LINK =\n exports.WASI_FILETYPE_SOCKET_STREAM =\n exports.WASI_FILETYPE_SOCKET_DGRAM =\n exports.WASI_FILETYPE_REGULAR_FILE =\n exports.WASI_FILETYPE_DIRECTORY =\n exports.WASI_FILETYPE_CHARACTER_DEVICE =\n exports.WASI_FILETYPE_BLOCK_DEVICE =\n exports.WASI_FILETYPE_UNKNOWN =\n exports.WASI_SIGXFSZ =\n exports.WASI_SIGXCPU =\n void 0;\n exports.SIGNAL_MAP =\n exports.ERROR_MAP =\n exports.WASI_WHENCE_END =\n exports.WASI_WHENCE_CUR =\n exports.WASI_WHENCE_SET =\n exports.WASI_STDERR_FILENO =\n exports.WASI_STDOUT_FILENO =\n exports.WASI_STDIN_FILENO =\n exports.WASI_DIRCOOKIE_START =\n exports.WASI_PREOPENTYPE_DIR =\n exports.WASI_O_TRUNC =\n exports.WASI_O_EXCL =\n exports.WASI_O_DIRECTORY =\n exports.WASI_O_CREAT =\n exports.WASI_FILESTAT_SET_MTIM_NOW =\n exports.WASI_FILESTAT_SET_MTIM =\n exports.WASI_FILESTAT_SET_ATIM_NOW =\n exports.WASI_FILESTAT_SET_ATIM =\n exports.WASI_EVENTTYPE_FD_WRITE =\n exports.WASI_EVENTTYPE_FD_READ =\n exports.WASI_EVENTTYPE_CLOCK =\n exports.WASI_CLOCK_THREAD_CPUTIME_ID =\n exports.WASI_CLOCK_PROCESS_CPUTIME_ID =\n exports.WASI_CLOCK_MONOTONIC =\n exports.WASI_CLOCK_REALTIME =\n exports.RIGHTS_TTY_INHERITING =\n exports.RIGHTS_TTY_BASE =\n exports.RIGHTS_SOCKET_INHERITING =\n exports.RIGHTS_SOCKET_BASE =\n exports.RIGHTS_DIRECTORY_INHERITING =\n exports.RIGHTS_DIRECTORY_BASE =\n exports.RIGHTS_REGULAR_FILE_INHERITING =\n void 0;\n exports.WASI_ESUCCESS = 0;\n exports.WASI_E2BIG = 1;\n exports.WASI_EACCES = 2;\n exports.WASI_EADDRINUSE = 3;\n exports.WASI_EADDRNOTAVAIL = 4;\n exports.WASI_EAFNOSUPPORT = 5;\n exports.WASI_EAGAIN = 6;\n exports.WASI_EALREADY = 7;\n exports.WASI_EBADF = 8;\n exports.WASI_EBADMSG = 9;\n exports.WASI_EBUSY = 10;\n exports.WASI_ECANCELED = 11;\n exports.WASI_ECHILD = 12;\n exports.WASI_ECONNABORTED = 13;\n exports.WASI_ECONNREFUSED = 14;\n exports.WASI_ECONNRESET = 15;\n exports.WASI_EDEADLK = 16;\n exports.WASI_EDESTADDRREQ = 17;\n exports.WASI_EDOM = 18;\n exports.WASI_EDQUOT = 19;\n exports.WASI_EEXIST = 20;\n exports.WASI_EFAULT = 21;\n exports.WASI_EFBIG = 22;\n exports.WASI_EHOSTUNREACH = 23;\n exports.WASI_EIDRM = 24;\n exports.WASI_EILSEQ = 25;\n exports.WASI_EINPROGRESS = 26;\n exports.WASI_EINTR = 27;\n exports.WASI_EINVAL = 28;\n exports.WASI_EIO = 29;\n exports.WASI_EISCONN = 30;\n exports.WASI_EISDIR = 31;\n exports.WASI_ELOOP = 32;\n exports.WASI_EMFILE = 33;\n exports.WASI_EMLINK = 34;\n exports.WASI_EMSGSIZE = 35;\n exports.WASI_EMULTIHOP = 36;\n exports.WASI_ENAMETOOLONG = 37;\n exports.WASI_ENETDOWN = 38;\n exports.WASI_ENETRESET = 39;\n exports.WASI_ENETUNREACH = 40;\n exports.WASI_ENFILE = 41;\n exports.WASI_ENOBUFS = 42;\n exports.WASI_ENODEV = 43;\n exports.WASI_ENOENT = 44;\n exports.WASI_ENOEXEC = 45;\n exports.WASI_ENOLCK = 46;\n exports.WASI_ENOLINK = 47;\n exports.WASI_ENOMEM = 48;\n exports.WASI_ENOMSG = 49;\n exports.WASI_ENOPROTOOPT = 50;\n exports.WASI_ENOSPC = 51;\n exports.WASI_ENOSYS = 52;\n exports.WASI_ENOTCONN = 53;\n exports.WASI_ENOTDIR = 54;\n exports.WASI_ENOTEMPTY = 55;\n exports.WASI_ENOTRECOVERABLE = 56;\n exports.WASI_ENOTSOCK = 57;\n exports.WASI_ENOTSUP = 58;\n exports.WASI_ENOTTY = 59;\n exports.WASI_ENXIO = 60;\n exports.WASI_EOVERFLOW = 61;\n exports.WASI_EOWNERDEAD = 62;\n exports.WASI_EPERM = 63;\n exports.WASI_EPIPE = 64;\n exports.WASI_EPROTO = 65;\n exports.WASI_EPROTONOSUPPORT = 66;\n exports.WASI_EPROTOTYPE = 67;\n exports.WASI_ERANGE = 68;\n exports.WASI_EROFS = 69;\n exports.WASI_ESPIPE = 70;\n exports.WASI_ESRCH = 71;\n exports.WASI_ESTALE = 72;\n exports.WASI_ETIMEDOUT = 73;\n exports.WASI_ETXTBSY = 74;\n exports.WASI_EXDEV = 75;\n exports.WASI_ENOTCAPABLE = 76;\n exports.WASI_SIGABRT = 0;\n exports.WASI_SIGALRM = 1;\n exports.WASI_SIGBUS = 2;\n exports.WASI_SIGCHLD = 3;\n exports.WASI_SIGCONT = 4;\n exports.WASI_SIGFPE = 5;\n exports.WASI_SIGHUP = 6;\n exports.WASI_SIGILL = 7;\n exports.WASI_SIGINT = 8;\n exports.WASI_SIGKILL = 9;\n exports.WASI_SIGPIPE = 10;\n exports.WASI_SIGQUIT = 11;\n exports.WASI_SIGSEGV = 12;\n exports.WASI_SIGSTOP = 13;\n exports.WASI_SIGTERM = 14;\n exports.WASI_SIGTRAP = 15;\n exports.WASI_SIGTSTP = 16;\n exports.WASI_SIGTTIN = 17;\n exports.WASI_SIGTTOU = 18;\n exports.WASI_SIGURG = 19;\n exports.WASI_SIGUSR1 = 20;\n exports.WASI_SIGUSR2 = 21;\n exports.WASI_SIGVTALRM = 22;\n exports.WASI_SIGXCPU = 23;\n exports.WASI_SIGXFSZ = 24;\n exports.WASI_FILETYPE_UNKNOWN = 0;\n exports.WASI_FILETYPE_BLOCK_DEVICE = 1;\n exports.WASI_FILETYPE_CHARACTER_DEVICE = 2;\n exports.WASI_FILETYPE_DIRECTORY = 3;\n exports.WASI_FILETYPE_REGULAR_FILE = 4;\n exports.WASI_FILETYPE_SOCKET_DGRAM = 5;\n exports.WASI_FILETYPE_SOCKET_STREAM = 6;\n exports.WASI_FILETYPE_SYMBOLIC_LINK = 7;\n exports.WASI_FDFLAG_APPEND = 1;\n exports.WASI_FDFLAG_DSYNC = 2;\n exports.WASI_FDFLAG_NONBLOCK = 4;\n exports.WASI_FDFLAG_RSYNC = 8;\n exports.WASI_FDFLAG_SYNC = 16;\n exports.WASI_RIGHT_FD_DATASYNC = BigInt(1);\n exports.WASI_RIGHT_FD_READ = BigInt(2);\n exports.WASI_RIGHT_FD_SEEK = BigInt(4);\n exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS = BigInt(8);\n exports.WASI_RIGHT_FD_SYNC = BigInt(16);\n exports.WASI_RIGHT_FD_TELL = BigInt(32);\n exports.WASI_RIGHT_FD_WRITE = BigInt(64);\n exports.WASI_RIGHT_FD_ADVISE = BigInt(128);\n exports.WASI_RIGHT_FD_ALLOCATE = BigInt(256);\n exports.WASI_RIGHT_PATH_CREATE_DIRECTORY = BigInt(512);\n exports.WASI_RIGHT_PATH_CREATE_FILE = BigInt(1024);\n exports.WASI_RIGHT_PATH_LINK_SOURCE = BigInt(2048);\n exports.WASI_RIGHT_PATH_LINK_TARGET = BigInt(4096);\n exports.WASI_RIGHT_PATH_OPEN = BigInt(8192);\n exports.WASI_RIGHT_FD_READDIR = BigInt(16384);\n exports.WASI_RIGHT_PATH_READLINK = BigInt(32768);\n exports.WASI_RIGHT_PATH_RENAME_SOURCE = BigInt(65536);\n exports.WASI_RIGHT_PATH_RENAME_TARGET = BigInt(131072);\n exports.WASI_RIGHT_PATH_FILESTAT_GET = BigInt(262144);\n exports.WASI_RIGHT_PATH_FILESTAT_SET_SIZE = BigInt(524288);\n exports.WASI_RIGHT_PATH_FILESTAT_SET_TIMES = BigInt(1048576);\n exports.WASI_RIGHT_FD_FILESTAT_GET = BigInt(2097152);\n exports.WASI_RIGHT_FD_FILESTAT_SET_SIZE = BigInt(4194304);\n exports.WASI_RIGHT_FD_FILESTAT_SET_TIMES = BigInt(8388608);\n exports.WASI_RIGHT_PATH_SYMLINK = BigInt(16777216);\n exports.WASI_RIGHT_PATH_REMOVE_DIRECTORY = BigInt(33554432);\n exports.WASI_RIGHT_PATH_UNLINK_FILE = BigInt(67108864);\n exports.WASI_RIGHT_POLL_FD_READWRITE = BigInt(134217728);\n exports.WASI_RIGHT_SOCK_SHUTDOWN = BigInt(268435456);\n exports.RIGHTS_ALL =\n exports.WASI_RIGHT_FD_DATASYNC |\n exports.WASI_RIGHT_FD_READ |\n exports.WASI_RIGHT_FD_SEEK |\n exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS |\n exports.WASI_RIGHT_FD_SYNC |\n exports.WASI_RIGHT_FD_TELL |\n exports.WASI_RIGHT_FD_WRITE |\n exports.WASI_RIGHT_FD_ADVISE |\n exports.WASI_RIGHT_FD_ALLOCATE |\n exports.WASI_RIGHT_PATH_CREATE_DIRECTORY |\n exports.WASI_RIGHT_PATH_CREATE_FILE |\n exports.WASI_RIGHT_PATH_LINK_SOURCE |\n exports.WASI_RIGHT_PATH_LINK_TARGET |\n exports.WASI_RIGHT_PATH_OPEN |\n exports.WASI_RIGHT_FD_READDIR |\n exports.WASI_RIGHT_PATH_READLINK |\n exports.WASI_RIGHT_PATH_RENAME_SOURCE |\n exports.WASI_RIGHT_PATH_RENAME_TARGET |\n exports.WASI_RIGHT_PATH_FILESTAT_GET |\n exports.WASI_RIGHT_PATH_FILESTAT_SET_SIZE |\n exports.WASI_RIGHT_PATH_FILESTAT_SET_TIMES |\n exports.WASI_RIGHT_FD_FILESTAT_GET |\n exports.WASI_RIGHT_FD_FILESTAT_SET_TIMES |\n exports.WASI_RIGHT_FD_FILESTAT_SET_SIZE |\n exports.WASI_RIGHT_PATH_SYMLINK |\n exports.WASI_RIGHT_PATH_UNLINK_FILE |\n exports.WASI_RIGHT_PATH_REMOVE_DIRECTORY |\n exports.WASI_RIGHT_POLL_FD_READWRITE |\n exports.WASI_RIGHT_SOCK_SHUTDOWN;\n exports.RIGHTS_BLOCK_DEVICE_BASE = exports.RIGHTS_ALL;\n exports.RIGHTS_BLOCK_DEVICE_INHERITING = exports.RIGHTS_ALL;\n exports.RIGHTS_CHARACTER_DEVICE_BASE = exports.RIGHTS_ALL;\n exports.RIGHTS_CHARACTER_DEVICE_INHERITING = exports.RIGHTS_ALL;\n exports.RIGHTS_REGULAR_FILE_BASE =\n exports.WASI_RIGHT_FD_DATASYNC |\n exports.WASI_RIGHT_FD_READ |\n exports.WASI_RIGHT_FD_SEEK |\n exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS |\n exports.WASI_RIGHT_FD_SYNC |\n exports.WASI_RIGHT_FD_TELL |\n exports.WASI_RIGHT_FD_WRITE |\n exports.WASI_RIGHT_FD_ADVISE |\n exports.WASI_RIGHT_FD_ALLOCATE |\n exports.WASI_RIGHT_FD_FILESTAT_GET |\n exports.WASI_RIGHT_FD_FILESTAT_SET_SIZE |\n exports.WASI_RIGHT_FD_FILESTAT_SET_TIMES |\n exports.WASI_RIGHT_POLL_FD_READWRITE;\n exports.RIGHTS_REGULAR_FILE_INHERITING = BigInt(0);\n exports.RIGHTS_DIRECTORY_BASE =\n exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS |\n exports.WASI_RIGHT_FD_SYNC |\n exports.WASI_RIGHT_FD_ADVISE |\n exports.WASI_RIGHT_PATH_CREATE_DIRECTORY |\n exports.WASI_RIGHT_PATH_CREATE_FILE |\n exports.WASI_RIGHT_PATH_LINK_SOURCE |\n exports.WASI_RIGHT_PATH_LINK_TARGET |\n exports.WASI_RIGHT_PATH_OPEN |\n exports.WASI_RIGHT_FD_READDIR |\n exports.WASI_RIGHT_PATH_READLINK |\n exports.WASI_RIGHT_PATH_RENAME_SOURCE |\n exports.WASI_RIGHT_PATH_RENAME_TARGET |\n exports.WASI_RIGHT_PATH_FILESTAT_GET |\n exports.WASI_RIGHT_PATH_FILESTAT_SET_SIZE |\n exports.WASI_RIGHT_PATH_FILESTAT_SET_TIMES |\n exports.WASI_RIGHT_FD_FILESTAT_GET |\n exports.WASI_RIGHT_FD_FILESTAT_SET_TIMES |\n exports.WASI_RIGHT_PATH_SYMLINK |\n exports.WASI_RIGHT_PATH_UNLINK_FILE |\n exports.WASI_RIGHT_PATH_REMOVE_DIRECTORY |\n exports.WASI_RIGHT_POLL_FD_READWRITE;\n exports.RIGHTS_DIRECTORY_INHERITING = exports.RIGHTS_DIRECTORY_BASE | exports.RIGHTS_REGULAR_FILE_BASE;\n exports.RIGHTS_SOCKET_BASE =\n exports.WASI_RIGHT_FD_READ |\n exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS |\n exports.WASI_RIGHT_FD_WRITE |\n exports.WASI_RIGHT_FD_FILESTAT_GET |\n exports.WASI_RIGHT_POLL_FD_READWRITE |\n exports.WASI_RIGHT_SOCK_SHUTDOWN;\n exports.RIGHTS_SOCKET_INHERITING = exports.RIGHTS_ALL;\n exports.RIGHTS_TTY_BASE =\n exports.WASI_RIGHT_FD_READ |\n exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS |\n exports.WASI_RIGHT_FD_WRITE |\n exports.WASI_RIGHT_FD_FILESTAT_GET |\n exports.WASI_RIGHT_POLL_FD_READWRITE;\n exports.RIGHTS_TTY_INHERITING = BigInt(0);\n exports.WASI_CLOCK_REALTIME = 0;\n exports.WASI_CLOCK_MONOTONIC = 1;\n exports.WASI_CLOCK_PROCESS_CPUTIME_ID = 2;\n exports.WASI_CLOCK_THREAD_CPUTIME_ID = 3;\n exports.WASI_EVENTTYPE_CLOCK = 0;\n exports.WASI_EVENTTYPE_FD_READ = 1;\n exports.WASI_EVENTTYPE_FD_WRITE = 2;\n exports.WASI_FILESTAT_SET_ATIM = 1 << 0;\n exports.WASI_FILESTAT_SET_ATIM_NOW = 1 << 1;\n exports.WASI_FILESTAT_SET_MTIM = 1 << 2;\n exports.WASI_FILESTAT_SET_MTIM_NOW = 1 << 3;\n exports.WASI_O_CREAT = 1 << 0;\n exports.WASI_O_DIRECTORY = 1 << 1;\n exports.WASI_O_EXCL = 1 << 2;\n exports.WASI_O_TRUNC = 1 << 3;\n exports.WASI_PREOPENTYPE_DIR = 0;\n exports.WASI_DIRCOOKIE_START = 0;\n exports.WASI_STDIN_FILENO = 0;\n exports.WASI_STDOUT_FILENO = 1;\n exports.WASI_STDERR_FILENO = 2;\n exports.WASI_WHENCE_SET = 0;\n exports.WASI_WHENCE_CUR = 1;\n exports.WASI_WHENCE_END = 2;\n exports.ERROR_MAP = {\n E2BIG: exports.WASI_E2BIG,\n EACCES: exports.WASI_EACCES,\n EADDRINUSE: exports.WASI_EADDRINUSE,\n EADDRNOTAVAIL: exports.WASI_EADDRNOTAVAIL,\n EAFNOSUPPORT: exports.WASI_EAFNOSUPPORT,\n EALREADY: exports.WASI_EALREADY,\n EAGAIN: exports.WASI_EAGAIN,\n EBADF: exports.WASI_EBADF,\n EBADMSG: exports.WASI_EBADMSG,\n EBUSY: exports.WASI_EBUSY,\n ECANCELED: exports.WASI_ECANCELED,\n ECHILD: exports.WASI_ECHILD,\n ECONNABORTED: exports.WASI_ECONNABORTED,\n ECONNREFUSED: exports.WASI_ECONNREFUSED,\n ECONNRESET: exports.WASI_ECONNRESET,\n EDEADLOCK: exports.WASI_EDEADLK,\n EDESTADDRREQ: exports.WASI_EDESTADDRREQ,\n EDOM: exports.WASI_EDOM,\n EDQUOT: exports.WASI_EDQUOT,\n EEXIST: exports.WASI_EEXIST,\n EFAULT: exports.WASI_EFAULT,\n EFBIG: exports.WASI_EFBIG,\n EHOSTDOWN: exports.WASI_EHOSTUNREACH,\n EHOSTUNREACH: exports.WASI_EHOSTUNREACH,\n EIDRM: exports.WASI_EIDRM,\n EILSEQ: exports.WASI_EILSEQ,\n EINPROGRESS: exports.WASI_EINPROGRESS,\n EINTR: exports.WASI_EINTR,\n EINVAL: exports.WASI_EINVAL,\n EIO: exports.WASI_EIO,\n EISCONN: exports.WASI_EISCONN,\n EISDIR: exports.WASI_EISDIR,\n ELOOP: exports.WASI_ELOOP,\n EMFILE: exports.WASI_EMFILE,\n EMLINK: exports.WASI_EMLINK,\n EMSGSIZE: exports.WASI_EMSGSIZE,\n EMULTIHOP: exports.WASI_EMULTIHOP,\n ENAMETOOLONG: exports.WASI_ENAMETOOLONG,\n ENETDOWN: exports.WASI_ENETDOWN,\n ENETRESET: exports.WASI_ENETRESET,\n ENETUNREACH: exports.WASI_ENETUNREACH,\n ENFILE: exports.WASI_ENFILE,\n ENOBUFS: exports.WASI_ENOBUFS,\n ENODEV: exports.WASI_ENODEV,\n ENOENT: exports.WASI_ENOENT,\n ENOEXEC: exports.WASI_ENOEXEC,\n ENOLCK: exports.WASI_ENOLCK,\n ENOLINK: exports.WASI_ENOLINK,\n ENOMEM: exports.WASI_ENOMEM,\n ENOMSG: exports.WASI_ENOMSG,\n ENOPROTOOPT: exports.WASI_ENOPROTOOPT,\n ENOSPC: exports.WASI_ENOSPC,\n ENOSYS: exports.WASI_ENOSYS,\n ENOTCONN: exports.WASI_ENOTCONN,\n ENOTDIR: exports.WASI_ENOTDIR,\n ENOTEMPTY: exports.WASI_ENOTEMPTY,\n ENOTRECOVERABLE: exports.WASI_ENOTRECOVERABLE,\n ENOTSOCK: exports.WASI_ENOTSOCK,\n ENOTTY: exports.WASI_ENOTTY,\n ENXIO: exports.WASI_ENXIO,\n EOVERFLOW: exports.WASI_EOVERFLOW,\n EOWNERDEAD: exports.WASI_EOWNERDEAD,\n EPERM: exports.WASI_EPERM,\n EPIPE: exports.WASI_EPIPE,\n EPROTO: exports.WASI_EPROTO,\n EPROTONOSUPPORT: exports.WASI_EPROTONOSUPPORT,\n EPROTOTYPE: exports.WASI_EPROTOTYPE,\n ERANGE: exports.WASI_ERANGE,\n EROFS: exports.WASI_EROFS,\n ESPIPE: exports.WASI_ESPIPE,\n ESRCH: exports.WASI_ESRCH,\n ESTALE: exports.WASI_ESTALE,\n ETIMEDOUT: exports.WASI_ETIMEDOUT,\n ETXTBSY: exports.WASI_ETXTBSY,\n EXDEV: exports.WASI_EXDEV,\n };\n exports.SIGNAL_MAP = {\n [exports.WASI_SIGHUP]: \"SIGHUP\",\n [exports.WASI_SIGINT]: \"SIGINT\",\n [exports.WASI_SIGQUIT]: \"SIGQUIT\",\n [exports.WASI_SIGILL]: \"SIGILL\",\n [exports.WASI_SIGTRAP]: \"SIGTRAP\",\n [exports.WASI_SIGABRT]: \"SIGABRT\",\n [exports.WASI_SIGBUS]: \"SIGBUS\",\n [exports.WASI_SIGFPE]: \"SIGFPE\",\n [exports.WASI_SIGKILL]: \"SIGKILL\",\n [exports.WASI_SIGUSR1]: \"SIGUSR1\",\n [exports.WASI_SIGSEGV]: \"SIGSEGV\",\n [exports.WASI_SIGUSR2]: \"SIGUSR2\",\n [exports.WASI_SIGPIPE]: \"SIGPIPE\",\n [exports.WASI_SIGALRM]: \"SIGALRM\",\n [exports.WASI_SIGTERM]: \"SIGTERM\",\n [exports.WASI_SIGCHLD]: \"SIGCHLD\",\n [exports.WASI_SIGCONT]: \"SIGCONT\",\n [exports.WASI_SIGSTOP]: \"SIGSTOP\",\n [exports.WASI_SIGTSTP]: \"SIGTSTP\",\n [exports.WASI_SIGTTIN]: \"SIGTTIN\",\n [exports.WASI_SIGTTOU]: \"SIGTTOU\",\n [exports.WASI_SIGURG]: \"SIGURG\",\n [exports.WASI_SIGXCPU]: \"SIGXCPU\",\n [exports.WASI_SIGXFSZ]: \"SIGXFSZ\",\n [exports.WASI_SIGVTALRM]: \"SIGVTALRM\",\n };\n },\n});\n\n// node_modules/wasi-js/dist/wasi.js\nvar require_wasi = __commonJS({\n \"node_modules/wasi-js/dist/wasi.js\"(exports) {\n var __importDefault =\n (exports && exports.__importDefault) ||\n function (mod) {\n return mod && mod.__esModule ? mod : { default: mod };\n };\n let fs;\n Object.defineProperty(exports, \"__esModule\", { value: true });\n exports.SOCKET_DEFAULT_RIGHTS = void 0;\n var log = () => {};\n var logOpen = () => {};\n var SC_OPEN_MAX = 32768;\n var types_1 = require_types();\n\n var constants_1 = require_constants();\n var STDIN_DEFAULT_RIGHTS =\n constants_1.WASI_RIGHT_FD_DATASYNC |\n constants_1.WASI_RIGHT_FD_READ |\n constants_1.WASI_RIGHT_FD_SYNC |\n constants_1.WASI_RIGHT_FD_ADVISE |\n constants_1.WASI_RIGHT_FD_FILESTAT_GET |\n constants_1.WASI_RIGHT_POLL_FD_READWRITE;\n var STDOUT_DEFAULT_RIGHTS =\n constants_1.WASI_RIGHT_FD_DATASYNC |\n constants_1.WASI_RIGHT_FD_WRITE |\n constants_1.WASI_RIGHT_FD_SYNC |\n constants_1.WASI_RIGHT_FD_ADVISE |\n constants_1.WASI_RIGHT_FD_FILESTAT_GET |\n constants_1.WASI_RIGHT_POLL_FD_READWRITE;\n var STDERR_DEFAULT_RIGHTS = STDOUT_DEFAULT_RIGHTS;\n exports.SOCKET_DEFAULT_RIGHTS =\n constants_1.WASI_RIGHT_FD_DATASYNC |\n constants_1.WASI_RIGHT_FD_READ |\n constants_1.WASI_RIGHT_FD_WRITE |\n constants_1.WASI_RIGHT_FD_ADVISE |\n constants_1.WASI_RIGHT_FD_FILESTAT_GET |\n constants_1.WASI_RIGHT_POLL_FD_READWRITE |\n constants_1.WASI_RIGHT_FD_FDSTAT_SET_FLAGS;\n var msToNs = ms => {\n const msInt = Math.trunc(ms);\n\n const decimal = BigInt(Math.round((ms - msInt) * 1e6));\n const ns = BigInt(msInt) * BigInt(1e6);\n return ns + decimal;\n };\n var nsToMs = ns => {\n if (typeof ns === \"number\") {\n ns = Math.trunc(ns);\n }\n const nsInt = BigInt(ns);\n return Number(nsInt / BigInt(1e6));\n };\n var wrap =\n f =>\n (...args) => {\n try {\n return f(...args);\n } catch (err) {\n let e = err;\n while (e.prev != null) {\n e = e.prev;\n }\n if (e?.code && typeof e?.code === \"string\") {\n return constants_1.ERROR_MAP[e.code] || constants_1.WASI_EINVAL;\n }\n if (e instanceof types_1.WASIError) {\n return e.errno;\n }\n throw e;\n }\n };\n var stat = (wasi, fd) => {\n const entry = wasi.FD_MAP.get(fd);\n if (!entry) {\n throw new types_1.WASIError(constants_1.WASI_EBADF);\n }\n if (entry.filetype === void 0) {\n const stats = wasi.fstatSync(entry.real);\n const { filetype, rightsBase, rightsInheriting } = translateFileAttributes(wasi, fd, stats);\n entry.filetype = filetype;\n if (!entry.rights) {\n entry.rights = {\n base: rightsBase,\n inheriting: rightsInheriting,\n };\n }\n }\n return entry;\n };\n var translateFileAttributes = (wasi, fd, stats) => {\n switch (true) {\n case stats.isBlockDevice():\n return {\n filetype: constants_1.WASI_FILETYPE_BLOCK_DEVICE,\n rightsBase: constants_1.RIGHTS_BLOCK_DEVICE_BASE,\n rightsInheriting: constants_1.RIGHTS_BLOCK_DEVICE_INHERITING,\n };\n case stats.isCharacterDevice(): {\n const filetype = constants_1.WASI_FILETYPE_CHARACTER_DEVICE;\n if (fd !== void 0 && wasi.bindings.isTTY(fd)) {\n return {\n filetype,\n rightsBase: constants_1.RIGHTS_TTY_BASE,\n rightsInheriting: constants_1.RIGHTS_TTY_INHERITING,\n };\n }\n return {\n filetype,\n rightsBase: constants_1.RIGHTS_CHARACTER_DEVICE_BASE,\n rightsInheriting: constants_1.RIGHTS_CHARACTER_DEVICE_INHERITING,\n };\n }\n case stats.isDirectory():\n return {\n filetype: constants_1.WASI_FILETYPE_DIRECTORY,\n rightsBase: constants_1.RIGHTS_DIRECTORY_BASE,\n rightsInheriting: constants_1.RIGHTS_DIRECTORY_INHERITING,\n };\n case stats.isFIFO():\n return {\n filetype: constants_1.WASI_FILETYPE_SOCKET_STREAM,\n rightsBase: constants_1.RIGHTS_SOCKET_BASE,\n rightsInheriting: constants_1.RIGHTS_SOCKET_INHERITING,\n };\n case stats.isFile():\n return {\n filetype: constants_1.WASI_FILETYPE_REGULAR_FILE,\n rightsBase: constants_1.RIGHTS_REGULAR_FILE_BASE,\n rightsInheriting: constants_1.RIGHTS_REGULAR_FILE_INHERITING,\n };\n case stats.isSocket():\n return {\n filetype: constants_1.WASI_FILETYPE_SOCKET_STREAM,\n rightsBase: constants_1.RIGHTS_SOCKET_BASE,\n rightsInheriting: constants_1.RIGHTS_SOCKET_INHERITING,\n };\n case stats.isSymbolicLink():\n return {\n filetype: constants_1.WASI_FILETYPE_SYMBOLIC_LINK,\n rightsBase: BigInt(0),\n rightsInheriting: BigInt(0),\n };\n default:\n return {\n filetype: constants_1.WASI_FILETYPE_UNKNOWN,\n rightsBase: BigInt(0),\n rightsInheriting: BigInt(0),\n };\n }\n };\n var warnedAboutSleep = false;\n\n var defaultConfig;\n function getDefaults() {\n if (defaultConfig) return defaultConfig;\n\n const defaultBindings = {\n hrtime: () => process.hrtime.bigint(),\n exit: code => {\n process.exit(code);\n },\n kill: signal => {\n process.kill(process.pid, signal);\n },\n randomFillSync: array => crypto.getRandomValues(array),\n isTTY: fd => import.meta.require(\"node:tty\").isatty(fd),\n fs: Bun.fs(),\n path: import.meta.require(\"node:path\"),\n };\n\n return (defaultConfig = {\n args: [],\n env: {},\n preopens: {},\n bindings: defaultBindings,\n sleep: ms => {\n Bun.sleepSync(ms);\n },\n });\n }\n\n var WASI = class WASI {\n constructor(wasiConfig = {}) {\n const defaultConfig = getDefaults();\n this.lastStdin = 0;\n this.sleep = wasiConfig.sleep || defaultConfig.sleep;\n this.getStdin = wasiConfig.getStdin;\n this.sendStdout = wasiConfig.sendStdout;\n this.sendStderr = wasiConfig.sendStderr;\n let preopens = wasiConfig.preopens ?? defaultConfig.preopens;\n this.env = wasiConfig.env ?? defaultConfig.env;\n\n const args = wasiConfig.args ?? defaultConfig.args;\n this.memory = void 0;\n this.view = void 0;\n this.bindings = wasiConfig.bindings || defaultConfig.bindings;\n const bindings = this.bindings;\n fs = bindings.fs;\n this.FD_MAP = /* @__PURE__ */ new Map([\n [\n constants_1.WASI_STDIN_FILENO,\n {\n real: 0,\n filetype: constants_1.WASI_FILETYPE_CHARACTER_DEVICE,\n rights: {\n base: STDIN_DEFAULT_RIGHTS,\n inheriting: BigInt(0),\n },\n path: \"/dev/stdin\",\n },\n ],\n [\n constants_1.WASI_STDOUT_FILENO,\n {\n real: 1,\n filetype: constants_1.WASI_FILETYPE_CHARACTER_DEVICE,\n rights: {\n base: STDOUT_DEFAULT_RIGHTS,\n inheriting: BigInt(0),\n },\n path: \"/dev/stdout\",\n },\n ],\n [\n constants_1.WASI_STDERR_FILENO,\n {\n real: 2,\n filetype: constants_1.WASI_FILETYPE_CHARACTER_DEVICE,\n rights: {\n base: STDERR_DEFAULT_RIGHTS,\n inheriting: BigInt(0),\n },\n path: \"/dev/stderr\",\n },\n ],\n ]);\n const path = bindings.path;\n for (const [k, v] of Object.entries(preopens)) {\n const real = fs.openSync(v, nodeFsConstants.O_RDONLY);\n const newfd = this.getUnusedFileDescriptor();\n this.FD_MAP.set(newfd, {\n real,\n filetype: constants_1.WASI_FILETYPE_DIRECTORY,\n rights: {\n base: constants_1.RIGHTS_DIRECTORY_BASE,\n inheriting: constants_1.RIGHTS_DIRECTORY_INHERITING,\n },\n fakePath: k,\n path: v,\n });\n }\n const getiovs = (iovs, iovsLen) => {\n this.refreshMemory();\n\n const { view, memory } = this;\n const { buffer } = memory;\n const { byteLength } = buffer;\n\n if (iovsLen === 1) {\n const ptr = iovs;\n const buf = view.getUint32(ptr, true);\n let bufLen = view.getUint32(ptr + 4, true);\n\n if (bufLen > byteLength - buf) {\n console.log({\n buf,\n bufLen,\n total_memory: byteLength,\n });\n log(\"getiovs: warning -- truncating buffer to fit in memory\");\n bufLen = Math.min(bufLen, Math.max(0, byteLength - buf));\n }\n try {\n return [new Uint8Array(buffer, buf, bufLen)];\n } catch (err) {\n console.warn(\"WASI.getiovs -- invalid buffer\", err);\n throw new types_1.WASIError(constants_1.WASI_EINVAL);\n }\n }\n\n // Avoid referencing Array because materializing the Array constructor can show up in profiling\n const buffers = [];\n buffers.length = iovsLen;\n\n for (let i = 0, ptr = iovs; i < iovsLen; i++, ptr += 8) {\n const buf = view.getUint32(ptr, true);\n let bufLen = view.getUint32(ptr + 4, true);\n\n if (bufLen > byteLength - buf) {\n console.log({\n buf,\n bufLen,\n total_memory: byteLength,\n });\n log(\"getiovs: warning -- truncating buffer to fit in memory\");\n bufLen = Math.min(bufLen, Math.max(0, byteLength - buf));\n }\n try {\n buffers[i] = new Uint8Array(buffer, buf, bufLen);\n } catch (err) {\n console.warn(\"WASI.getiovs -- invalid buffer\", err);\n throw new types_1.WASIError(constants_1.WASI_EINVAL);\n }\n }\n return buffers;\n };\n const CHECK_FD = (fd, rights) => {\n const stats = stat(this, fd);\n if (rights !== BigInt(0) && (stats.rights.base & rights) === BigInt(0)) {\n throw new types_1.WASIError(constants_1.WASI_EPERM);\n }\n return stats;\n };\n const CPUTIME_START = Bun.nanoseconds();\n const timeOrigin = Math.trunc(performance.timeOrigin * 1e6);\n const now = clockId => {\n switch (clockId) {\n case constants_1.WASI_CLOCK_MONOTONIC:\n return Bun.nanoseconds();\n case constants_1.WASI_CLOCK_REALTIME:\n return Bun.nanoseconds() + timeOrigin;\n case constants_1.WASI_CLOCK_PROCESS_CPUTIME_ID:\n case constants_1.WASI_CLOCK_THREAD_CPUTIME_ID:\n return Bun.nanoseconds() - CPUTIME_START;\n default:\n return null;\n }\n };\n this.wasiImport = {\n args_get: (argv, argvBuf) => {\n this.refreshMemory();\n let coffset = argv;\n let offset = argvBuf;\n args.forEach(a => {\n this.view.setUint32(coffset, offset, true);\n coffset += 4;\n offset += Buffer.from(this.memory.buffer).write(`${a}\\0`, offset);\n });\n return constants_1.WASI_ESUCCESS;\n },\n args_sizes_get: (argc, argvBufSize) => {\n this.refreshMemory();\n this.view.setUint32(argc, args.length, true);\n const size = args.reduce((acc, a) => acc + Buffer.byteLength(a) + 1, 0);\n this.view.setUint32(argvBufSize, size, true);\n return constants_1.WASI_ESUCCESS;\n },\n environ_get: (environ, environBuf) => {\n this.refreshMemory();\n let coffset = environ;\n let offset = environBuf;\n Object.entries(this.env).forEach(([key, value]) => {\n this.view.setUint32(coffset, offset, true);\n coffset += 4;\n offset += Buffer.from(this.memory.buffer).write(`${key}=${value}\\0`, offset);\n });\n return constants_1.WASI_ESUCCESS;\n },\n environ_sizes_get: (environCount, environBufSize) => {\n this.refreshMemory();\n const envProcessed = Object.entries(this.env).map(([key, value]) => `${key}=${value}\\0`);\n const size = envProcessed.reduce((acc, e) => acc + Buffer.byteLength(e), 0);\n this.view.setUint32(environCount, envProcessed.length, true);\n this.view.setUint32(environBufSize, size, true);\n return constants_1.WASI_ESUCCESS;\n },\n clock_res_get: (clockId, resolution) => {\n let res;\n switch (clockId) {\n case constants_1.WASI_CLOCK_MONOTONIC:\n case constants_1.WASI_CLOCK_PROCESS_CPUTIME_ID:\n case constants_1.WASI_CLOCK_THREAD_CPUTIME_ID: {\n res = BigInt(1);\n break;\n }\n case constants_1.WASI_CLOCK_REALTIME: {\n res = BigInt(1e3);\n break;\n }\n }\n if (!res) {\n throw Error(\"invalid clockId\");\n }\n this.view.setBigUint64(resolution, res);\n return constants_1.WASI_ESUCCESS;\n },\n clock_time_get: (clockId, _precision, time) => {\n this.refreshMemory();\n const n = now(clockId);\n if (n === null) {\n return constants_1.WASI_EINVAL;\n }\n this.view.setBigUint64(time, BigInt(n), true);\n return constants_1.WASI_ESUCCESS;\n },\n fd_advise: wrap((fd, _offset, _len, _advice) => {\n CHECK_FD(fd, constants_1.WASI_RIGHT_FD_ADVISE);\n return constants_1.WASI_ENOSYS;\n }),\n fd_allocate: wrap((fd, _offset, _len) => {\n CHECK_FD(fd, constants_1.WASI_RIGHT_FD_ALLOCATE);\n return constants_1.WASI_ENOSYS;\n }),\n fd_close: wrap(fd => {\n const stats = CHECK_FD(fd, BigInt(0));\n fs.closeSync(stats.real);\n this.FD_MAP.delete(fd);\n return constants_1.WASI_ESUCCESS;\n }),\n fd_datasync: wrap(fd => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_DATASYNC);\n fs.fdatasyncSync(stats.real);\n return constants_1.WASI_ESUCCESS;\n }),\n fd_fdstat_get: wrap((fd, bufPtr) => {\n const stats = CHECK_FD(fd, BigInt(0));\n this.refreshMemory();\n if (stats.filetype == null) {\n throw Error(\"stats.filetype must be set\");\n }\n this.view.setUint8(bufPtr, stats.filetype);\n this.view.setUint16(bufPtr + 2, 0, true);\n this.view.setUint16(bufPtr + 4, 0, true);\n this.view.setBigUint64(bufPtr + 8, BigInt(stats.rights.base), true);\n this.view.setBigUint64(bufPtr + 8 + 8, BigInt(stats.rights.inheriting), true);\n return constants_1.WASI_ESUCCESS;\n }),\n fd_fdstat_set_flags: wrap((fd, flags) => {\n CHECK_FD(fd, constants_1.WASI_RIGHT_FD_FDSTAT_SET_FLAGS);\n if (this.wasiImport.sock_fcntlSetFlags(fd, flags) == 0) {\n return constants_1.WASI_ESUCCESS;\n }\n return constants_1.WASI_ENOSYS;\n }),\n fd_fdstat_set_rights: wrap((fd, fsRightsBase, fsRightsInheriting) => {\n const stats = CHECK_FD(fd, BigInt(0));\n const nrb = stats.rights.base | fsRightsBase;\n if (nrb > stats.rights.base) {\n return constants_1.WASI_EPERM;\n }\n const nri = stats.rights.inheriting | fsRightsInheriting;\n if (nri > stats.rights.inheriting) {\n return constants_1.WASI_EPERM;\n }\n stats.rights.base = fsRightsBase;\n stats.rights.inheriting = fsRightsInheriting;\n return constants_1.WASI_ESUCCESS;\n }),\n fd_filestat_get: wrap((fd, bufPtr) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_FILESTAT_GET);\n const rstats = this.fstatSync(stats.real);\n this.refreshMemory();\n this.view.setBigUint64(bufPtr, BigInt(rstats.dev), true);\n bufPtr += 8;\n this.view.setBigUint64(bufPtr, BigInt(rstats.ino), true);\n bufPtr += 8;\n if (stats.filetype == null) {\n throw Error(\"stats.filetype must be set\");\n }\n this.view.setUint8(bufPtr, stats.filetype);\n bufPtr += 8;\n this.view.setBigUint64(bufPtr, BigInt(rstats.nlink), true);\n bufPtr += 8;\n this.view.setBigUint64(bufPtr, BigInt(rstats.size), true);\n bufPtr += 8;\n this.view.setBigUint64(bufPtr, msToNs(rstats.atimeMs), true);\n bufPtr += 8;\n this.view.setBigUint64(bufPtr, msToNs(rstats.mtimeMs), true);\n bufPtr += 8;\n this.view.setBigUint64(bufPtr, msToNs(rstats.ctimeMs), true);\n return constants_1.WASI_ESUCCESS;\n }),\n fd_filestat_set_size: wrap((fd, stSize) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_FILESTAT_SET_SIZE);\n fs.ftruncateSync(stats.real, Number(stSize));\n return constants_1.WASI_ESUCCESS;\n }),\n fd_filestat_set_times: wrap((fd, stAtim, stMtim, fstflags) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_FILESTAT_SET_TIMES);\n const rstats = this.fstatSync(stats.real);\n let atim = rstats.atime;\n let mtim = rstats.mtime;\n const n = nsToMs(now(constants_1.WASI_CLOCK_REALTIME));\n const atimflags = constants_1.WASI_FILESTAT_SET_ATIM | constants_1.WASI_FILESTAT_SET_ATIM_NOW;\n if ((fstflags & atimflags) === atimflags) {\n return constants_1.WASI_EINVAL;\n }\n const mtimflags = constants_1.WASI_FILESTAT_SET_MTIM | constants_1.WASI_FILESTAT_SET_MTIM_NOW;\n if ((fstflags & mtimflags) === mtimflags) {\n return constants_1.WASI_EINVAL;\n }\n if ((fstflags & constants_1.WASI_FILESTAT_SET_ATIM) === constants_1.WASI_FILESTAT_SET_ATIM) {\n atim = nsToMs(stAtim);\n } else if ((fstflags & constants_1.WASI_FILESTAT_SET_ATIM_NOW) === constants_1.WASI_FILESTAT_SET_ATIM_NOW) {\n atim = n;\n }\n if ((fstflags & constants_1.WASI_FILESTAT_SET_MTIM) === constants_1.WASI_FILESTAT_SET_MTIM) {\n mtim = nsToMs(stMtim);\n } else if ((fstflags & constants_1.WASI_FILESTAT_SET_MTIM_NOW) === constants_1.WASI_FILESTAT_SET_MTIM_NOW) {\n mtim = n;\n }\n fs.futimesSync(stats.real, new Date(atim), new Date(mtim));\n return constants_1.WASI_ESUCCESS;\n }),\n fd_prestat_get: wrap((fd, bufPtr) => {\n const stats = CHECK_FD(fd, BigInt(0));\n this.refreshMemory();\n this.view.setUint8(bufPtr, constants_1.WASI_PREOPENTYPE_DIR);\n this.view.setUint32(bufPtr + 4, Buffer.byteLength(stats.fakePath ?? stats.path ?? \"\"), true);\n return constants_1.WASI_ESUCCESS;\n }),\n fd_prestat_dir_name: wrap((fd, pathPtr, pathLen) => {\n const stats = CHECK_FD(fd, BigInt(0));\n this.refreshMemory();\n Buffer.from(this.memory.buffer).write(stats.fakePath ?? stats.path ?? \"\", pathPtr, pathLen, \"utf8\");\n return constants_1.WASI_ESUCCESS;\n }),\n fd_pwrite: wrap((fd, iovs, iovsLen, offset, nwritten) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_WRITE | constants_1.WASI_RIGHT_FD_SEEK);\n let written = 0;\n getiovs(iovs, iovsLen).forEach(iov => {\n let w = 0;\n while (w < iov.byteLength) {\n w += fs.writeSync(stats.real, iov, w, iov.byteLength - w, Number(offset) + written + w);\n }\n written += w;\n });\n this.view.setUint32(nwritten, written, true);\n return constants_1.WASI_ESUCCESS;\n }),\n fd_write: wrap((fd, iovs, iovsLen, nwritten) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_WRITE);\n const IS_STDOUT = fd == constants_1.WASI_STDOUT_FILENO;\n const IS_STDERR = fd == constants_1.WASI_STDERR_FILENO;\n let written = 0;\n getiovs(iovs, iovsLen).forEach(iov => {\n if (iov.byteLength == 0) return;\n if (IS_STDOUT && this.sendStdout != null) {\n this.sendStdout(iov);\n written += iov.byteLength;\n } else if (IS_STDERR && this.sendStderr != null) {\n this.sendStderr(iov);\n written += iov.byteLength;\n } else {\n let w = 0;\n while (w < iov.byteLength) {\n const i = fs.writeSync(\n stats.real,\n iov,\n w,\n iov.byteLength - w,\n stats.offset ? Number(stats.offset) : null,\n );\n if (stats.offset) stats.offset += BigInt(i);\n w += i;\n }\n written += w;\n }\n });\n this.view.setUint32(nwritten, written, true);\n return constants_1.WASI_ESUCCESS;\n }),\n fd_pread: wrap((fd, iovs, iovsLen, offset, nread) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_READ | constants_1.WASI_RIGHT_FD_SEEK);\n let read = 0;\n outer: for (const iov of getiovs(iovs, iovsLen)) {\n let r = 0;\n while (r < iov.byteLength) {\n const length = iov.byteLength - r;\n const rr = fs.readSync(stats.real, iov, r, iov.byteLength - r, Number(offset) + read + r);\n r += rr;\n read += rr;\n if (rr === 0 || rr < length) {\n break outer;\n }\n }\n read += r;\n }\n this.view.setUint32(nread, read, true);\n return constants_1.WASI_ESUCCESS;\n }),\n fd_read: wrap((fd, iovs, iovsLen, nread) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_READ);\n const IS_STDIN = fd == constants_1.WASI_STDIN_FILENO;\n let read = 0;\n outer: for (const iov of getiovs(iovs, iovsLen)) {\n let r = 0;\n while (r < iov.byteLength) {\n let length = iov.byteLength - r;\n let position = IS_STDIN || stats.offset === void 0 ? null : Number(stats.offset);\n let rr = 0;\n if (IS_STDIN) {\n if (this.getStdin != null) {\n if (this.stdinBuffer == null) {\n this.stdinBuffer = this.getStdin();\n }\n if (this.stdinBuffer != null) {\n rr = this.stdinBuffer.copy(iov);\n if (rr == this.stdinBuffer.length) {\n this.stdinBuffer = void 0;\n } else {\n this.stdinBuffer = this.stdinBuffer.slice(rr);\n }\n if (rr > 0) {\n this.lastStdin = new Date().valueOf();\n }\n }\n } else {\n if (this.sleep == null && !warnedAboutSleep) {\n warnedAboutSleep = true;\n console.log(\"(cpu waiting for stdin: please define a way to sleep!) \");\n }\n try {\n rr = fs.readSync(stats.real, iov, r, length, position);\n } catch (_err) {}\n if (rr == 0) {\n this.shortPause();\n } else {\n this.lastStdin = new Date().valueOf();\n }\n }\n } else {\n rr = fs.readSync(stats.real, iov, r, length, position);\n }\n if (stats.filetype == constants_1.WASI_FILETYPE_REGULAR_FILE) {\n stats.offset = (stats.offset ? stats.offset : BigInt(0)) + BigInt(rr);\n }\n r += rr;\n read += rr;\n if (rr === 0 || rr < length) {\n break outer;\n }\n }\n }\n this.view.setUint32(nread, read, true);\n return constants_1.WASI_ESUCCESS;\n }),\n fd_readdir: wrap((fd, bufPtr, bufLen, cookie, bufusedPtr) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_READDIR);\n this.refreshMemory();\n const entries = fs.readdirSync(stats.path, { withFileTypes: true });\n const startPtr = bufPtr;\n for (let i = Number(cookie); i < entries.length; i += 1) {\n const entry = entries[i];\n let nameLength = Buffer.byteLength(entry.name);\n if (bufPtr - startPtr > bufLen) {\n break;\n }\n this.view.setBigUint64(bufPtr, BigInt(i + 1), true);\n bufPtr += 8;\n if (bufPtr - startPtr > bufLen) {\n break;\n }\n const rstats = fs.lstatSync(path.resolve(stats.path, entry.name));\n this.view.setBigUint64(bufPtr, BigInt(rstats.ino), true);\n bufPtr += 8;\n if (bufPtr - startPtr > bufLen) {\n break;\n }\n this.view.setUint32(bufPtr, nameLength, true);\n bufPtr += 4;\n if (bufPtr - startPtr > bufLen) {\n break;\n }\n let filetype;\n switch (true) {\n case rstats.isBlockDevice():\n filetype = constants_1.WASI_FILETYPE_BLOCK_DEVICE;\n break;\n case rstats.isCharacterDevice():\n filetype = constants_1.WASI_FILETYPE_CHARACTER_DEVICE;\n break;\n case rstats.isDirectory():\n filetype = constants_1.WASI_FILETYPE_DIRECTORY;\n break;\n case rstats.isFIFO():\n filetype = constants_1.WASI_FILETYPE_SOCKET_STREAM;\n break;\n case rstats.isFile():\n filetype = constants_1.WASI_FILETYPE_REGULAR_FILE;\n break;\n case rstats.isSocket():\n filetype = constants_1.WASI_FILETYPE_SOCKET_STREAM;\n break;\n case rstats.isSymbolicLink():\n filetype = constants_1.WASI_FILETYPE_SYMBOLIC_LINK;\n break;\n default:\n filetype = constants_1.WASI_FILETYPE_UNKNOWN;\n break;\n }\n this.view.setUint8(bufPtr, filetype);\n bufPtr += 1;\n bufPtr += 3;\n if (bufPtr + nameLength >= startPtr + bufLen) {\n break;\n }\n let memory_buffer = Buffer.from(this.memory.buffer);\n memory_buffer.write(entry.name, bufPtr);\n bufPtr += nameLength;\n }\n const bufused = bufPtr - startPtr;\n this.view.setUint32(bufusedPtr, Math.min(bufused, bufLen), true);\n return constants_1.WASI_ESUCCESS;\n }),\n fd_renumber: wrap((from, to) => {\n CHECK_FD(from, BigInt(0));\n CHECK_FD(to, BigInt(0));\n fs.closeSync(this.FD_MAP.get(from).real);\n this.FD_MAP.set(from, this.FD_MAP.get(to));\n this.FD_MAP.delete(to);\n return constants_1.WASI_ESUCCESS;\n }),\n fd_seek: wrap((fd, offset, whence, newOffsetPtr) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_SEEK);\n this.refreshMemory();\n switch (whence) {\n case constants_1.WASI_WHENCE_CUR:\n stats.offset = (stats.offset ? stats.offset : BigInt(0)) + BigInt(offset);\n break;\n case constants_1.WASI_WHENCE_END:\n const { size } = this.fstatSync(stats.real);\n stats.offset = BigInt(size) + BigInt(offset);\n break;\n case constants_1.WASI_WHENCE_SET:\n stats.offset = BigInt(offset);\n break;\n }\n if (stats.offset == null) {\n throw Error(\"stats.offset must be defined\");\n }\n this.view.setBigUint64(newOffsetPtr, stats.offset, true);\n return constants_1.WASI_ESUCCESS;\n }),\n fd_tell: wrap((fd, offsetPtr) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_TELL);\n this.refreshMemory();\n if (!stats.offset) {\n stats.offset = BigInt(0);\n }\n this.view.setBigUint64(offsetPtr, stats.offset, true);\n return constants_1.WASI_ESUCCESS;\n }),\n fd_sync: wrap(fd => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_SYNC);\n fs.fsyncSync(stats.real);\n return constants_1.WASI_ESUCCESS;\n }),\n path_create_directory: wrap((fd, pathPtr, pathLen) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_CREATE_DIRECTORY);\n if (!stats.path) {\n return constants_1.WASI_EINVAL;\n }\n this.refreshMemory();\n const p = Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n fs.mkdirSync(path.resolve(stats.path, p));\n return constants_1.WASI_ESUCCESS;\n }),\n path_filestat_get: wrap((fd, flags, pathPtr, pathLen, bufPtr) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_FILESTAT_GET);\n if (!stats.path) {\n return constants_1.WASI_EINVAL;\n }\n this.refreshMemory();\n const p = Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n let rstats;\n if (flags) {\n rstats = fs.statSync(path.resolve(stats.path, p));\n } else {\n rstats = fs.lstatSync(path.resolve(stats.path, p));\n }\n this.view.setBigUint64(bufPtr, BigInt(rstats.dev), true);\n bufPtr += 8;\n this.view.setBigUint64(bufPtr, BigInt(rstats.ino), true);\n bufPtr += 8;\n this.view.setUint8(bufPtr, translateFileAttributes(this, void 0, rstats).filetype);\n bufPtr += 8;\n this.view.setBigUint64(bufPtr, BigInt(rstats.nlink), true);\n bufPtr += 8;\n this.view.setBigUint64(bufPtr, BigInt(rstats.size), true);\n bufPtr += 8;\n this.view.setBigUint64(bufPtr, BigInt(rstats.atime.getTime() * 1e6), true);\n bufPtr += 8;\n this.view.setBigUint64(bufPtr, BigInt(rstats.mtime.getTime() * 1e6), true);\n bufPtr += 8;\n this.view.setBigUint64(bufPtr, BigInt(rstats.ctime.getTime() * 1e6), true);\n return constants_1.WASI_ESUCCESS;\n }),\n path_filestat_set_times: wrap((fd, _dirflags, pathPtr, pathLen, stAtim, stMtim, fstflags) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_FILESTAT_SET_TIMES);\n if (!stats.path) {\n return constants_1.WASI_EINVAL;\n }\n this.refreshMemory();\n const rstats = this.fstatSync(stats.real);\n let atim = rstats.atime;\n let mtim = rstats.mtime;\n const n = nsToMs(now(constants_1.WASI_CLOCK_REALTIME));\n const atimflags = constants_1.WASI_FILESTAT_SET_ATIM | constants_1.WASI_FILESTAT_SET_ATIM_NOW;\n if ((fstflags & atimflags) === atimflags) {\n return constants_1.WASI_EINVAL;\n }\n const mtimflags = constants_1.WASI_FILESTAT_SET_MTIM | constants_1.WASI_FILESTAT_SET_MTIM_NOW;\n if ((fstflags & mtimflags) === mtimflags) {\n return constants_1.WASI_EINVAL;\n }\n if ((fstflags & constants_1.WASI_FILESTAT_SET_ATIM) === constants_1.WASI_FILESTAT_SET_ATIM) {\n atim = nsToMs(stAtim);\n } else if ((fstflags & constants_1.WASI_FILESTAT_SET_ATIM_NOW) === constants_1.WASI_FILESTAT_SET_ATIM_NOW) {\n atim = n;\n }\n if ((fstflags & constants_1.WASI_FILESTAT_SET_MTIM) === constants_1.WASI_FILESTAT_SET_MTIM) {\n mtim = nsToMs(stMtim);\n } else if ((fstflags & constants_1.WASI_FILESTAT_SET_MTIM_NOW) === constants_1.WASI_FILESTAT_SET_MTIM_NOW) {\n mtim = n;\n }\n const p = Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n fs.utimesSync(path.resolve(stats.path, p), new Date(atim), new Date(mtim));\n return constants_1.WASI_ESUCCESS;\n }),\n path_link: wrap((oldFd, _oldFlags, oldPath, oldPathLen, newFd, newPath, newPathLen) => {\n const ostats = CHECK_FD(oldFd, constants_1.WASI_RIGHT_PATH_LINK_SOURCE);\n const nstats = CHECK_FD(newFd, constants_1.WASI_RIGHT_PATH_LINK_TARGET);\n if (!ostats.path || !nstats.path) {\n return constants_1.WASI_EINVAL;\n }\n this.refreshMemory();\n const op = Buffer.from(this.memory.buffer, oldPath, oldPathLen).toString();\n const np = Buffer.from(this.memory.buffer, newPath, newPathLen).toString();\n fs.linkSync(path.resolve(ostats.path, op), path.resolve(nstats.path, np));\n return constants_1.WASI_ESUCCESS;\n }),\n path_open: wrap(\n (dirfd, _dirflags, pathPtr, pathLen, oflags, fsRightsBase, fsRightsInheriting, fsFlags, fdPtr) => {\n try {\n const stats = CHECK_FD(dirfd, constants_1.WASI_RIGHT_PATH_OPEN);\n fsRightsBase = BigInt(fsRightsBase);\n fsRightsInheriting = BigInt(fsRightsInheriting);\n const read =\n (fsRightsBase & (constants_1.WASI_RIGHT_FD_READ | constants_1.WASI_RIGHT_FD_READDIR)) !== BigInt(0);\n const write =\n (fsRightsBase &\n (constants_1.WASI_RIGHT_FD_DATASYNC |\n constants_1.WASI_RIGHT_FD_WRITE |\n constants_1.WASI_RIGHT_FD_ALLOCATE |\n constants_1.WASI_RIGHT_FD_FILESTAT_SET_SIZE)) !==\n BigInt(0);\n let noflags;\n if (write && read) {\n noflags = nodeFsConstants.O_RDWR;\n } else if (read) {\n noflags = nodeFsConstants.O_RDONLY;\n } else if (write) {\n noflags = nodeFsConstants.O_WRONLY;\n }\n let neededBase = fsRightsBase | constants_1.WASI_RIGHT_PATH_OPEN;\n let neededInheriting = fsRightsBase | fsRightsInheriting;\n if ((oflags & constants_1.WASI_O_CREAT) !== 0) {\n noflags |= nodeFsConstants.O_CREAT;\n neededBase |= constants_1.WASI_RIGHT_PATH_CREATE_FILE;\n }\n if ((oflags & constants_1.WASI_O_DIRECTORY) !== 0) {\n noflags |= nodeFsConstants.O_DIRECTORY;\n }\n if ((oflags & constants_1.WASI_O_EXCL) !== 0) {\n noflags |= nodeFsConstants.O_EXCL;\n }\n if ((oflags & constants_1.WASI_O_TRUNC) !== 0) {\n noflags |= nodeFsConstants.O_TRUNC;\n neededBase |= constants_1.WASI_RIGHT_PATH_FILESTAT_SET_SIZE;\n }\n if ((fsFlags & constants_1.WASI_FDFLAG_APPEND) !== 0) {\n noflags |= nodeFsConstants.O_APPEND;\n }\n if ((fsFlags & constants_1.WASI_FDFLAG_DSYNC) !== 0) {\n if (nodeFsConstants.O_DSYNC) {\n noflags |= nodeFsConstants.O_DSYNC;\n } else {\n noflags |= nodeFsConstants.O_SYNC;\n }\n neededInheriting |= constants_1.WASI_RIGHT_FD_DATASYNC;\n }\n if ((fsFlags & constants_1.WASI_FDFLAG_NONBLOCK) !== 0) {\n noflags |= nodeFsConstants.O_NONBLOCK;\n }\n if ((fsFlags & constants_1.WASI_FDFLAG_RSYNC) !== 0) {\n if (nodeFsConstants.O_RSYNC) {\n noflags |= nodeFsConstants.O_RSYNC;\n } else {\n noflags |= nodeFsConstants.O_SYNC;\n }\n neededInheriting |= constants_1.WASI_RIGHT_FD_SYNC;\n }\n if ((fsFlags & constants_1.WASI_FDFLAG_SYNC) !== 0) {\n noflags |= nodeFsConstants.O_SYNC;\n neededInheriting |= constants_1.WASI_RIGHT_FD_SYNC;\n }\n if (write && (noflags & (nodeFsConstants.O_APPEND | nodeFsConstants.O_TRUNC)) === 0) {\n neededInheriting |= constants_1.WASI_RIGHT_FD_SEEK;\n }\n this.refreshMemory();\n const p = Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n if (p == \"dev/tty\") {\n this.view.setUint32(fdPtr, constants_1.WASI_STDIN_FILENO, true);\n return constants_1.WASI_ESUCCESS;\n }\n logOpen(\"path_open\", p);\n if (p.startsWith(\"proc/\")) {\n throw new types_1.WASIError(constants_1.WASI_EBADF);\n }\n const fullUnresolved = path.resolve(p);\n let full;\n try {\n full = fs.realpathSync(fullUnresolved);\n } catch (e) {\n if (e?.code === \"ENOENT\") {\n full = fullUnresolved;\n } else {\n throw e;\n }\n }\n let isDirectory;\n if (write) {\n try {\n isDirectory = fs.statSync(full).isDirectory();\n } catch (_err) {}\n }\n let realfd;\n if (!write && isDirectory) {\n realfd = fs.openSync(full, nodeFsConstants.O_RDONLY);\n } else {\n realfd = fs.openSync(full, noflags);\n }\n const newfd = this.getUnusedFileDescriptor();\n this.FD_MAP.set(newfd, {\n real: realfd,\n filetype: void 0,\n rights: {\n base: neededBase,\n inheriting: neededInheriting,\n },\n path: full,\n });\n stat(this, newfd);\n this.view.setUint32(fdPtr, newfd, true);\n } catch (e) {\n console.error(e);\n }\n return constants_1.WASI_ESUCCESS;\n },\n ),\n path_readlink: wrap((fd, pathPtr, pathLen, buf, bufLen, bufused) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_READLINK);\n if (!stats.path) {\n return constants_1.WASI_EINVAL;\n }\n this.refreshMemory();\n const p = Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n const full = path.resolve(stats.path, p);\n const r = fs.readlinkSync(full);\n const used = Buffer.from(this.memory.buffer).write(r, buf, bufLen);\n this.view.setUint32(bufused, used, true);\n return constants_1.WASI_ESUCCESS;\n }),\n path_remove_directory: wrap((fd, pathPtr, pathLen) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_REMOVE_DIRECTORY);\n if (!stats.path) {\n return constants_1.WASI_EINVAL;\n }\n this.refreshMemory();\n const p = Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n fs.rmdirSync(path.resolve(stats.path, p));\n return constants_1.WASI_ESUCCESS;\n }),\n path_rename: wrap((oldFd, oldPath, oldPathLen, newFd, newPath, newPathLen) => {\n const ostats = CHECK_FD(oldFd, constants_1.WASI_RIGHT_PATH_RENAME_SOURCE);\n const nstats = CHECK_FD(newFd, constants_1.WASI_RIGHT_PATH_RENAME_TARGET);\n if (!ostats.path || !nstats.path) {\n return constants_1.WASI_EINVAL;\n }\n this.refreshMemory();\n const op = Buffer.from(this.memory.buffer, oldPath, oldPathLen).toString();\n const np = Buffer.from(this.memory.buffer, newPath, newPathLen).toString();\n fs.renameSync(path.resolve(ostats.path, op), path.resolve(nstats.path, np));\n return constants_1.WASI_ESUCCESS;\n }),\n path_symlink: wrap((oldPath, oldPathLen, fd, newPath, newPathLen) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_SYMLINK);\n if (!stats.path) {\n return constants_1.WASI_EINVAL;\n }\n this.refreshMemory();\n const op = Buffer.from(this.memory.buffer, oldPath, oldPathLen).toString();\n const np = Buffer.from(this.memory.buffer, newPath, newPathLen).toString();\n fs.symlinkSync(op, path.resolve(stats.path, np));\n return constants_1.WASI_ESUCCESS;\n }),\n path_unlink_file: wrap((fd, pathPtr, pathLen) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_UNLINK_FILE);\n if (!stats.path) {\n return constants_1.WASI_EINVAL;\n }\n this.refreshMemory();\n const p = Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n fs.unlinkSync(path.resolve(stats.path, p));\n return constants_1.WASI_ESUCCESS;\n }),\n poll_oneoff: (sin, sout, nsubscriptions, neventsPtr) => {\n let nevents = 0;\n let name = \"\";\n let waitTimeNs = BigInt(0);\n let fd = -1;\n let fd_type = \"read\";\n let fd_timeout_ms = 0;\n const startNs = BigInt(bindings.hrtime());\n this.refreshMemory();\n let last_sin = sin;\n for (let i = 0; i < nsubscriptions; i += 1) {\n const userdata = this.view.getBigUint64(sin, true);\n sin += 8;\n const type = this.view.getUint8(sin);\n sin += 1;\n sin += 7;\n if (log.enabled) {\n if (type == constants_1.WASI_EVENTTYPE_CLOCK) {\n name = \"poll_oneoff (type=WASI_EVENTTYPE_CLOCK): \";\n } else if (type == constants_1.WASI_EVENTTYPE_FD_READ) {\n name = \"poll_oneoff (type=WASI_EVENTTYPE_FD_READ): \";\n } else {\n name = \"poll_oneoff (type=WASI_EVENTTYPE_FD_WRITE): \";\n }\n log(name);\n }\n switch (type) {\n case constants_1.WASI_EVENTTYPE_CLOCK: {\n const clockid = this.view.getUint32(sin, true);\n sin += 4;\n sin += 4;\n const timeout = this.view.getBigUint64(sin, true);\n sin += 8;\n sin += 8;\n const subclockflags = this.view.getUint16(sin, true);\n sin += 2;\n sin += 6;\n const absolute = subclockflags === 1;\n if (log.enabled) {\n log(name, { clockid, timeout, absolute });\n }\n if (!absolute) {\n fd_timeout_ms = timeout / BigInt(1e6);\n }\n let e = constants_1.WASI_ESUCCESS;\n const t = now(clockid);\n if (t == null) {\n e = constants_1.WASI_EINVAL;\n } else {\n const tNS = BigInt(t);\n const end = absolute ? timeout : tNS + timeout;\n const waitNs = end - tNS;\n if (waitNs > waitTimeNs) {\n waitTimeNs = waitNs;\n }\n }\n this.view.setBigUint64(sout, userdata, true);\n sout += 8;\n this.view.setUint16(sout, e, true);\n sout += 2;\n this.view.setUint8(sout, constants_1.WASI_EVENTTYPE_CLOCK);\n sout += 1;\n sout += 5;\n nevents += 1;\n break;\n }\n case constants_1.WASI_EVENTTYPE_FD_READ:\n case constants_1.WASI_EVENTTYPE_FD_WRITE: {\n fd = this.view.getUint32(sin, true);\n fd_type = type == constants_1.WASI_EVENTTYPE_FD_READ ? \"read\" : \"write\";\n sin += 4;\n log(name, \"fd =\", fd);\n sin += 28;\n this.view.setBigUint64(sout, userdata, true);\n sout += 8;\n this.view.setUint16(sout, constants_1.WASI_ENOSYS, true);\n sout += 2;\n this.view.setUint8(sout, type);\n sout += 1;\n sout += 5;\n nevents += 1;\n if (fd == constants_1.WASI_STDIN_FILENO && constants_1.WASI_EVENTTYPE_FD_READ == type) {\n this.shortPause();\n }\n break;\n }\n default:\n return constants_1.WASI_EINVAL;\n }\n if (sin - last_sin != 48) {\n console.warn(\"*** BUG in wasi-js in poll_oneoff \", {\n i,\n sin,\n last_sin,\n diff: sin - last_sin,\n });\n }\n last_sin = sin;\n }\n this.view.setUint32(neventsPtr, nevents, true);\n if (nevents == 2 && fd >= 0) {\n const r = this.wasiImport.sock_pollSocket(fd, fd_type, fd_timeout_ms);\n if (r != constants_1.WASI_ENOSYS) {\n return r;\n }\n }\n if (waitTimeNs > 0) {\n waitTimeNs -= Bun.nanoseconds() - timeOrigin;\n if (waitTimeNs >= 1e6) {\n if (this.sleep == null && !warnedAboutSleep) {\n warnedAboutSleep = true;\n console.log(\"(100% cpu burning waiting for stdin: please define a way to sleep!) \");\n }\n if (this.sleep != null) {\n const ms = nsToMs(waitTimeNs);\n this.sleep(ms);\n } else {\n const end = BigInt(bindings.hrtime()) + waitTimeNs;\n while (BigInt(bindings.hrtime()) < end) {}\n }\n }\n }\n return constants_1.WASI_ESUCCESS;\n },\n proc_exit: rval => {\n bindings.exit(rval);\n return constants_1.WASI_ESUCCESS;\n },\n proc_raise: sig => {\n if (!(sig in constants_1.SIGNAL_MAP)) {\n return constants_1.WASI_EINVAL;\n }\n bindings.kill(constants_1.SIGNAL_MAP[sig]);\n return constants_1.WASI_ESUCCESS;\n },\n random_get: (bufPtr, bufLen) => {\n this.refreshMemory();\n crypto.getRandomValues(this.memory.buffer, bufPtr, bufLen);\n return bufLen;\n },\n sched_yield() {\n return constants_1.WASI_ESUCCESS;\n },\n sock_recv() {\n return constants_1.WASI_ENOSYS;\n },\n sock_send() {\n return constants_1.WASI_ENOSYS;\n },\n sock_shutdown() {\n return constants_1.WASI_ENOSYS;\n },\n sock_fcntlSetFlags(_fd, _flags) {\n return constants_1.WASI_ENOSYS;\n },\n sock_pollSocket(_fd, _eventtype, _timeout_ms) {\n return constants_1.WASI_ENOSYS;\n },\n };\n if (log.enabled) {\n Object.keys(this.wasiImport).forEach(key => {\n const prevImport = this.wasiImport[key];\n this.wasiImport[key] = function (...args2) {\n log(key, args2);\n try {\n let result = prevImport(...args2);\n log(\"result\", result);\n return result;\n } catch (e) {\n log(\"error: \", e);\n throw e;\n }\n };\n });\n }\n }\n getState() {\n return { env: this.env, FD_MAP: this.FD_MAP, bindings: bindings };\n }\n setState(state) {\n this.env = state.env;\n this.FD_MAP = state.FD_MAP;\n bindings = state.bindings;\n }\n fstatSync(real_fd) {\n if (real_fd <= 2) {\n try {\n return fs.fstatSync(real_fd);\n } catch (_) {\n const now = new Date();\n return {\n dev: 0,\n mode: 8592,\n nlink: 1,\n uid: 0,\n gid: 0,\n rdev: 0,\n blksize: 65536,\n ino: 0,\n size: 0,\n blocks: 0,\n atimeMs: now.valueOf(),\n mtimeMs: now.valueOf(),\n ctimeMs: now.valueOf(),\n birthtimeMs: 0,\n atime: new Date(),\n mtime: new Date(),\n ctime: new Date(),\n birthtime: new Date(0),\n };\n }\n }\n return fs.fstatSync(real_fd);\n }\n shortPause() {\n if (this.sleep == null) return;\n const now = new Date().valueOf();\n if (now - this.lastStdin > 2e3) {\n this.sleep(50);\n }\n }\n getUnusedFileDescriptor(start = 3) {\n let fd = start;\n while (this.FD_MAP.has(fd)) {\n fd += 1;\n }\n if (fd > SC_OPEN_MAX) {\n throw Error(\"no available file descriptors\");\n }\n return fd;\n }\n refreshMemory() {\n if (!this.view || this.view.buffer.byteLength === 0) {\n this.view = new DataView(this.memory.buffer);\n }\n }\n setMemory(memory) {\n this.memory = memory;\n }\n start(instance, memory) {\n const exports2 = instance.exports;\n if (exports2 === null || typeof exports2 !== \"object\") {\n throw new Error(`instance.exports must be an Object. Received ${exports2}.`);\n }\n if (memory == null) {\n memory = exports2.memory;\n if (!(memory instanceof WebAssembly.Memory)) {\n throw new Error(`instance.exports.memory must be a WebAssembly.Memory. Recceived ${memory}.`);\n }\n }\n this.setMemory(memory);\n if (exports2._start) {\n exports2._start();\n }\n }\n getImports(module2) {\n let namespace = null;\n const imports = WebAssembly.Module.imports(module2);\n\n for (let imp of imports) {\n if (imp.kind !== \"function\") {\n continue;\n }\n if (!imp.module.startsWith(\"wasi_\")) {\n continue;\n }\n\n namespace = imp.module;\n break;\n }\n\n switch (namespace) {\n case \"wasi_unstable\":\n return {\n wasi_unstable: this.wasiImport,\n };\n case \"wasi_snapshot_preview1\":\n return {\n wasi_snapshot_preview1: this.wasiImport,\n };\n default: {\n throw new Error(\n \"No WASI namespace found. Only wasi_unstable and wasi_snapshot_preview1 are supported.\\n\\nList of imports:\\n\\n\" +\n imports.map(({ name, kind, module }) => `${module}:${name} (${kind})`).join(\"\\n\") +\n \"\\n\",\n );\n }\n }\n }\n initWasiFdInfo() {\n if (this.env[\"WASI_FD_INFO\"] != null) {\n const fdInfo = JSON.parse(this.env[\"WASI_FD_INFO\"]);\n for (const wasi_fd in fdInfo) {\n console.log(wasi_fd);\n const fd = parseInt(wasi_fd);\n if (this.FD_MAP.has(fd)) {\n continue;\n }\n const real = fdInfo[wasi_fd];\n try {\n this.fstatSync(real);\n } catch (_err) {\n console.log(\"discarding \", { wasi_fd, real });\n continue;\n }\n const file = {\n real,\n filetype: constants_1.WASI_FILETYPE_SOCKET_STREAM,\n rights: {\n base: STDIN_DEFAULT_RIGHTS,\n inheriting: BigInt(0),\n },\n };\n this.FD_MAP.set(fd, file);\n }\n console.log(\"after initWasiFdInfo: \", this.FD_MAP);\n console.log(\"fdInfo = \", fdInfo);\n } else {\n console.log(\"no WASI_FD_INFO\");\n }\n }\n };\n exports.default = WASI;\n },\n});\nconst WASIExport = require_wasi();\nconst WASI = WASIExport.default;\nWASIExport[Symbol.for(\"CommonJS\")] = 0;\nexport { WASIExport as WASI };\nexport default WASIExport;\n",
- "// Hardcoded module \"node:wasi\"\n// HUGE thanks to:\n// - @williamstein and https://github.com/sagemathinc/cowasm/tree/main/core/wasi-js\n// - @syrusakbary for wasmer-js https://github.com/wasmerio/wasmer-js\n// - Gus Caplan for node-wasi https://github.com/devsnek/node-wasi\n//\n// Eventually we will implement this in native code, but this is just a quick hack to get WASI working.\n\n/** **/\n// constants is injected into the top of this file\nconst nodeFsConstants = constants;\n\nvar __getOwnPropNames = Object.getOwnPropertyNames;\n\nvar __commonJS = (cb, mod) =>\n function __require2() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n };\n\n// node_modules/wasi-js/dist/types.js\nvar require_types = __commonJS({\n \"node_modules/wasi-js/dist/types.js\"(exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n exports.WASIKillError = exports.WASIExitError = exports.WASIError = void 0;\n var WASIError = class extends Error {\n constructor(errno) {\n super();\n this.errno = errno;\n Object.setPrototypeOf(this, WASIError.prototype);\n }\n };\n exports.WASIError = WASIError;\n var WASIExitError = class extends Error {\n constructor(code) {\n super(`WASI Exit error: ${code}`);\n this.code = code;\n Object.setPrototypeOf(this, WASIExitError.prototype);\n }\n };\n exports.WASIExitError = WASIExitError;\n var WASIKillError = class extends Error {\n constructor(signal) {\n super(`WASI Kill signal: ${signal}`);\n this.signal = signal;\n Object.setPrototypeOf(this, WASIKillError.prototype);\n }\n };\n exports.WASIKillError = WASIKillError;\n },\n});\n\n// node_modules/wasi-js/dist/constants.js\nvar require_constants = __commonJS({\n \"node_modules/wasi-js/dist/constants.js\"(exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n exports.WASI_ENOMSG =\n exports.WASI_ENOMEM =\n exports.WASI_ENOLINK =\n exports.WASI_ENOLCK =\n exports.WASI_ENOEXEC =\n exports.WASI_ENOENT =\n exports.WASI_ENODEV =\n exports.WASI_ENOBUFS =\n exports.WASI_ENFILE =\n exports.WASI_ENETUNREACH =\n exports.WASI_ENETRESET =\n exports.WASI_ENETDOWN =\n exports.WASI_ENAMETOOLONG =\n exports.WASI_EMULTIHOP =\n exports.WASI_EMSGSIZE =\n exports.WASI_EMLINK =\n exports.WASI_EMFILE =\n exports.WASI_ELOOP =\n exports.WASI_EISDIR =\n exports.WASI_EISCONN =\n exports.WASI_EIO =\n exports.WASI_EINVAL =\n exports.WASI_EINTR =\n exports.WASI_EINPROGRESS =\n exports.WASI_EILSEQ =\n exports.WASI_EIDRM =\n exports.WASI_EHOSTUNREACH =\n exports.WASI_EFBIG =\n exports.WASI_EFAULT =\n exports.WASI_EEXIST =\n exports.WASI_EDQUOT =\n exports.WASI_EDOM =\n exports.WASI_EDESTADDRREQ =\n exports.WASI_EDEADLK =\n exports.WASI_ECONNRESET =\n exports.WASI_ECONNREFUSED =\n exports.WASI_ECONNABORTED =\n exports.WASI_ECHILD =\n exports.WASI_ECANCELED =\n exports.WASI_EBUSY =\n exports.WASI_EBADMSG =\n exports.WASI_EBADF =\n exports.WASI_EALREADY =\n exports.WASI_EAGAIN =\n exports.WASI_EAFNOSUPPORT =\n exports.WASI_EADDRNOTAVAIL =\n exports.WASI_EADDRINUSE =\n exports.WASI_EACCES =\n exports.WASI_E2BIG =\n exports.WASI_ESUCCESS =\n void 0;\n exports.WASI_SIGVTALRM =\n exports.WASI_SIGUSR2 =\n exports.WASI_SIGUSR1 =\n exports.WASI_SIGURG =\n exports.WASI_SIGTTOU =\n exports.WASI_SIGTTIN =\n exports.WASI_SIGTSTP =\n exports.WASI_SIGTRAP =\n exports.WASI_SIGTERM =\n exports.WASI_SIGSTOP =\n exports.WASI_SIGSEGV =\n exports.WASI_SIGQUIT =\n exports.WASI_SIGPIPE =\n exports.WASI_SIGKILL =\n exports.WASI_SIGINT =\n exports.WASI_SIGILL =\n exports.WASI_SIGHUP =\n exports.WASI_SIGFPE =\n exports.WASI_SIGCONT =\n exports.WASI_SIGCHLD =\n exports.WASI_SIGBUS =\n exports.WASI_SIGALRM =\n exports.WASI_SIGABRT =\n exports.WASI_ENOTCAPABLE =\n exports.WASI_EXDEV =\n exports.WASI_ETXTBSY =\n exports.WASI_ETIMEDOUT =\n exports.WASI_ESTALE =\n exports.WASI_ESRCH =\n exports.WASI_ESPIPE =\n exports.WASI_EROFS =\n exports.WASI_ERANGE =\n exports.WASI_EPROTOTYPE =\n exports.WASI_EPROTONOSUPPORT =\n exports.WASI_EPROTO =\n exports.WASI_EPIPE =\n exports.WASI_EPERM =\n exports.WASI_EOWNERDEAD =\n exports.WASI_EOVERFLOW =\n exports.WASI_ENXIO =\n exports.WASI_ENOTTY =\n exports.WASI_ENOTSUP =\n exports.WASI_ENOTSOCK =\n exports.WASI_ENOTRECOVERABLE =\n exports.WASI_ENOTEMPTY =\n exports.WASI_ENOTDIR =\n exports.WASI_ENOTCONN =\n exports.WASI_ENOSYS =\n exports.WASI_ENOSPC =\n exports.WASI_ENOPROTOOPT =\n void 0;\n exports.RIGHTS_REGULAR_FILE_BASE =\n exports.RIGHTS_CHARACTER_DEVICE_INHERITING =\n exports.RIGHTS_CHARACTER_DEVICE_BASE =\n exports.RIGHTS_BLOCK_DEVICE_INHERITING =\n exports.RIGHTS_BLOCK_DEVICE_BASE =\n exports.RIGHTS_ALL =\n exports.WASI_RIGHT_SOCK_SHUTDOWN =\n exports.WASI_RIGHT_POLL_FD_READWRITE =\n exports.WASI_RIGHT_PATH_UNLINK_FILE =\n exports.WASI_RIGHT_PATH_REMOVE_DIRECTORY =\n exports.WASI_RIGHT_PATH_SYMLINK =\n exports.WASI_RIGHT_FD_FILESTAT_SET_TIMES =\n exports.WASI_RIGHT_FD_FILESTAT_SET_SIZE =\n exports.WASI_RIGHT_FD_FILESTAT_GET =\n exports.WASI_RIGHT_PATH_FILESTAT_SET_TIMES =\n exports.WASI_RIGHT_PATH_FILESTAT_SET_SIZE =\n exports.WASI_RIGHT_PATH_FILESTAT_GET =\n exports.WASI_RIGHT_PATH_RENAME_TARGET =\n exports.WASI_RIGHT_PATH_RENAME_SOURCE =\n exports.WASI_RIGHT_PATH_READLINK =\n exports.WASI_RIGHT_FD_READDIR =\n exports.WASI_RIGHT_PATH_OPEN =\n exports.WASI_RIGHT_PATH_LINK_TARGET =\n exports.WASI_RIGHT_PATH_LINK_SOURCE =\n exports.WASI_RIGHT_PATH_CREATE_FILE =\n exports.WASI_RIGHT_PATH_CREATE_DIRECTORY =\n exports.WASI_RIGHT_FD_ALLOCATE =\n exports.WASI_RIGHT_FD_ADVISE =\n exports.WASI_RIGHT_FD_WRITE =\n exports.WASI_RIGHT_FD_TELL =\n exports.WASI_RIGHT_FD_SYNC =\n exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS =\n exports.WASI_RIGHT_FD_SEEK =\n exports.WASI_RIGHT_FD_READ =\n exports.WASI_RIGHT_FD_DATASYNC =\n exports.WASI_FDFLAG_SYNC =\n exports.WASI_FDFLAG_RSYNC =\n exports.WASI_FDFLAG_NONBLOCK =\n exports.WASI_FDFLAG_DSYNC =\n exports.WASI_FDFLAG_APPEND =\n exports.WASI_FILETYPE_SYMBOLIC_LINK =\n exports.WASI_FILETYPE_SOCKET_STREAM =\n exports.WASI_FILETYPE_SOCKET_DGRAM =\n exports.WASI_FILETYPE_REGULAR_FILE =\n exports.WASI_FILETYPE_DIRECTORY =\n exports.WASI_FILETYPE_CHARACTER_DEVICE =\n exports.WASI_FILETYPE_BLOCK_DEVICE =\n exports.WASI_FILETYPE_UNKNOWN =\n exports.WASI_SIGXFSZ =\n exports.WASI_SIGXCPU =\n void 0;\n exports.SIGNAL_MAP =\n exports.ERROR_MAP =\n exports.WASI_WHENCE_END =\n exports.WASI_WHENCE_CUR =\n exports.WASI_WHENCE_SET =\n exports.WASI_STDERR_FILENO =\n exports.WASI_STDOUT_FILENO =\n exports.WASI_STDIN_FILENO =\n exports.WASI_DIRCOOKIE_START =\n exports.WASI_PREOPENTYPE_DIR =\n exports.WASI_O_TRUNC =\n exports.WASI_O_EXCL =\n exports.WASI_O_DIRECTORY =\n exports.WASI_O_CREAT =\n exports.WASI_FILESTAT_SET_MTIM_NOW =\n exports.WASI_FILESTAT_SET_MTIM =\n exports.WASI_FILESTAT_SET_ATIM_NOW =\n exports.WASI_FILESTAT_SET_ATIM =\n exports.WASI_EVENTTYPE_FD_WRITE =\n exports.WASI_EVENTTYPE_FD_READ =\n exports.WASI_EVENTTYPE_CLOCK =\n exports.WASI_CLOCK_THREAD_CPUTIME_ID =\n exports.WASI_CLOCK_PROCESS_CPUTIME_ID =\n exports.WASI_CLOCK_MONOTONIC =\n exports.WASI_CLOCK_REALTIME =\n exports.RIGHTS_TTY_INHERITING =\n exports.RIGHTS_TTY_BASE =\n exports.RIGHTS_SOCKET_INHERITING =\n exports.RIGHTS_SOCKET_BASE =\n exports.RIGHTS_DIRECTORY_INHERITING =\n exports.RIGHTS_DIRECTORY_BASE =\n exports.RIGHTS_REGULAR_FILE_INHERITING =\n void 0;\n exports.WASI_ESUCCESS = 0;\n exports.WASI_E2BIG = 1;\n exports.WASI_EACCES = 2;\n exports.WASI_EADDRINUSE = 3;\n exports.WASI_EADDRNOTAVAIL = 4;\n exports.WASI_EAFNOSUPPORT = 5;\n exports.WASI_EAGAIN = 6;\n exports.WASI_EALREADY = 7;\n exports.WASI_EBADF = 8;\n exports.WASI_EBADMSG = 9;\n exports.WASI_EBUSY = 10;\n exports.WASI_ECANCELED = 11;\n exports.WASI_ECHILD = 12;\n exports.WASI_ECONNABORTED = 13;\n exports.WASI_ECONNREFUSED = 14;\n exports.WASI_ECONNRESET = 15;\n exports.WASI_EDEADLK = 16;\n exports.WASI_EDESTADDRREQ = 17;\n exports.WASI_EDOM = 18;\n exports.WASI_EDQUOT = 19;\n exports.WASI_EEXIST = 20;\n exports.WASI_EFAULT = 21;\n exports.WASI_EFBIG = 22;\n exports.WASI_EHOSTUNREACH = 23;\n exports.WASI_EIDRM = 24;\n exports.WASI_EILSEQ = 25;\n exports.WASI_EINPROGRESS = 26;\n exports.WASI_EINTR = 27;\n exports.WASI_EINVAL = 28;\n exports.WASI_EIO = 29;\n exports.WASI_EISCONN = 30;\n exports.WASI_EISDIR = 31;\n exports.WASI_ELOOP = 32;\n exports.WASI_EMFILE = 33;\n exports.WASI_EMLINK = 34;\n exports.WASI_EMSGSIZE = 35;\n exports.WASI_EMULTIHOP = 36;\n exports.WASI_ENAMETOOLONG = 37;\n exports.WASI_ENETDOWN = 38;\n exports.WASI_ENETRESET = 39;\n exports.WASI_ENETUNREACH = 40;\n exports.WASI_ENFILE = 41;\n exports.WASI_ENOBUFS = 42;\n exports.WASI_ENODEV = 43;\n exports.WASI_ENOENT = 44;\n exports.WASI_ENOEXEC = 45;\n exports.WASI_ENOLCK = 46;\n exports.WASI_ENOLINK = 47;\n exports.WASI_ENOMEM = 48;\n exports.WASI_ENOMSG = 49;\n exports.WASI_ENOPROTOOPT = 50;\n exports.WASI_ENOSPC = 51;\n exports.WASI_ENOSYS = 52;\n exports.WASI_ENOTCONN = 53;\n exports.WASI_ENOTDIR = 54;\n exports.WASI_ENOTEMPTY = 55;\n exports.WASI_ENOTRECOVERABLE = 56;\n exports.WASI_ENOTSOCK = 57;\n exports.WASI_ENOTSUP = 58;\n exports.WASI_ENOTTY = 59;\n exports.WASI_ENXIO = 60;\n exports.WASI_EOVERFLOW = 61;\n exports.WASI_EOWNERDEAD = 62;\n exports.WASI_EPERM = 63;\n exports.WASI_EPIPE = 64;\n exports.WASI_EPROTO = 65;\n exports.WASI_EPROTONOSUPPORT = 66;\n exports.WASI_EPROTOTYPE = 67;\n exports.WASI_ERANGE = 68;\n exports.WASI_EROFS = 69;\n exports.WASI_ESPIPE = 70;\n exports.WASI_ESRCH = 71;\n exports.WASI_ESTALE = 72;\n exports.WASI_ETIMEDOUT = 73;\n exports.WASI_ETXTBSY = 74;\n exports.WASI_EXDEV = 75;\n exports.WASI_ENOTCAPABLE = 76;\n exports.WASI_SIGABRT = 0;\n exports.WASI_SIGALRM = 1;\n exports.WASI_SIGBUS = 2;\n exports.WASI_SIGCHLD = 3;\n exports.WASI_SIGCONT = 4;\n exports.WASI_SIGFPE = 5;\n exports.WASI_SIGHUP = 6;\n exports.WASI_SIGILL = 7;\n exports.WASI_SIGINT = 8;\n exports.WASI_SIGKILL = 9;\n exports.WASI_SIGPIPE = 10;\n exports.WASI_SIGQUIT = 11;\n exports.WASI_SIGSEGV = 12;\n exports.WASI_SIGSTOP = 13;\n exports.WASI_SIGTERM = 14;\n exports.WASI_SIGTRAP = 15;\n exports.WASI_SIGTSTP = 16;\n exports.WASI_SIGTTIN = 17;\n exports.WASI_SIGTTOU = 18;\n exports.WASI_SIGURG = 19;\n exports.WASI_SIGUSR1 = 20;\n exports.WASI_SIGUSR2 = 21;\n exports.WASI_SIGVTALRM = 22;\n exports.WASI_SIGXCPU = 23;\n exports.WASI_SIGXFSZ = 24;\n exports.WASI_FILETYPE_UNKNOWN = 0;\n exports.WASI_FILETYPE_BLOCK_DEVICE = 1;\n exports.WASI_FILETYPE_CHARACTER_DEVICE = 2;\n exports.WASI_FILETYPE_DIRECTORY = 3;\n exports.WASI_FILETYPE_REGULAR_FILE = 4;\n exports.WASI_FILETYPE_SOCKET_DGRAM = 5;\n exports.WASI_FILETYPE_SOCKET_STREAM = 6;\n exports.WASI_FILETYPE_SYMBOLIC_LINK = 7;\n exports.WASI_FDFLAG_APPEND = 1;\n exports.WASI_FDFLAG_DSYNC = 2;\n exports.WASI_FDFLAG_NONBLOCK = 4;\n exports.WASI_FDFLAG_RSYNC = 8;\n exports.WASI_FDFLAG_SYNC = 16;\n exports.WASI_RIGHT_FD_DATASYNC = BigInt(1);\n exports.WASI_RIGHT_FD_READ = BigInt(2);\n exports.WASI_RIGHT_FD_SEEK = BigInt(4);\n exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS = BigInt(8);\n exports.WASI_RIGHT_FD_SYNC = BigInt(16);\n exports.WASI_RIGHT_FD_TELL = BigInt(32);\n exports.WASI_RIGHT_FD_WRITE = BigInt(64);\n exports.WASI_RIGHT_FD_ADVISE = BigInt(128);\n exports.WASI_RIGHT_FD_ALLOCATE = BigInt(256);\n exports.WASI_RIGHT_PATH_CREATE_DIRECTORY = BigInt(512);\n exports.WASI_RIGHT_PATH_CREATE_FILE = BigInt(1024);\n exports.WASI_RIGHT_PATH_LINK_SOURCE = BigInt(2048);\n exports.WASI_RIGHT_PATH_LINK_TARGET = BigInt(4096);\n exports.WASI_RIGHT_PATH_OPEN = BigInt(8192);\n exports.WASI_RIGHT_FD_READDIR = BigInt(16384);\n exports.WASI_RIGHT_PATH_READLINK = BigInt(32768);\n exports.WASI_RIGHT_PATH_RENAME_SOURCE = BigInt(65536);\n exports.WASI_RIGHT_PATH_RENAME_TARGET = BigInt(131072);\n exports.WASI_RIGHT_PATH_FILESTAT_GET = BigInt(262144);\n exports.WASI_RIGHT_PATH_FILESTAT_SET_SIZE = BigInt(524288);\n exports.WASI_RIGHT_PATH_FILESTAT_SET_TIMES = BigInt(1048576);\n exports.WASI_RIGHT_FD_FILESTAT_GET = BigInt(2097152);\n exports.WASI_RIGHT_FD_FILESTAT_SET_SIZE = BigInt(4194304);\n exports.WASI_RIGHT_FD_FILESTAT_SET_TIMES = BigInt(8388608);\n exports.WASI_RIGHT_PATH_SYMLINK = BigInt(16777216);\n exports.WASI_RIGHT_PATH_REMOVE_DIRECTORY = BigInt(33554432);\n exports.WASI_RIGHT_PATH_UNLINK_FILE = BigInt(67108864);\n exports.WASI_RIGHT_POLL_FD_READWRITE = BigInt(134217728);\n exports.WASI_RIGHT_SOCK_SHUTDOWN = BigInt(268435456);\n exports.RIGHTS_ALL =\n exports.WASI_RIGHT_FD_DATASYNC |\n exports.WASI_RIGHT_FD_READ |\n exports.WASI_RIGHT_FD_SEEK |\n exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS |\n exports.WASI_RIGHT_FD_SYNC |\n exports.WASI_RIGHT_FD_TELL |\n exports.WASI_RIGHT_FD_WRITE |\n exports.WASI_RIGHT_FD_ADVISE |\n exports.WASI_RIGHT_FD_ALLOCATE |\n exports.WASI_RIGHT_PATH_CREATE_DIRECTORY |\n exports.WASI_RIGHT_PATH_CREATE_FILE |\n exports.WASI_RIGHT_PATH_LINK_SOURCE |\n exports.WASI_RIGHT_PATH_LINK_TARGET |\n exports.WASI_RIGHT_PATH_OPEN |\n exports.WASI_RIGHT_FD_READDIR |\n exports.WASI_RIGHT_PATH_READLINK |\n exports.WASI_RIGHT_PATH_RENAME_SOURCE |\n exports.WASI_RIGHT_PATH_RENAME_TARGET |\n exports.WASI_RIGHT_PATH_FILESTAT_GET |\n exports.WASI_RIGHT_PATH_FILESTAT_SET_SIZE |\n exports.WASI_RIGHT_PATH_FILESTAT_SET_TIMES |\n exports.WASI_RIGHT_FD_FILESTAT_GET |\n exports.WASI_RIGHT_FD_FILESTAT_SET_TIMES |\n exports.WASI_RIGHT_FD_FILESTAT_SET_SIZE |\n exports.WASI_RIGHT_PATH_SYMLINK |\n exports.WASI_RIGHT_PATH_UNLINK_FILE |\n exports.WASI_RIGHT_PATH_REMOVE_DIRECTORY |\n exports.WASI_RIGHT_POLL_FD_READWRITE |\n exports.WASI_RIGHT_SOCK_SHUTDOWN;\n exports.RIGHTS_BLOCK_DEVICE_BASE = exports.RIGHTS_ALL;\n exports.RIGHTS_BLOCK_DEVICE_INHERITING = exports.RIGHTS_ALL;\n exports.RIGHTS_CHARACTER_DEVICE_BASE = exports.RIGHTS_ALL;\n exports.RIGHTS_CHARACTER_DEVICE_INHERITING = exports.RIGHTS_ALL;\n exports.RIGHTS_REGULAR_FILE_BASE =\n exports.WASI_RIGHT_FD_DATASYNC |\n exports.WASI_RIGHT_FD_READ |\n exports.WASI_RIGHT_FD_SEEK |\n exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS |\n exports.WASI_RIGHT_FD_SYNC |\n exports.WASI_RIGHT_FD_TELL |\n exports.WASI_RIGHT_FD_WRITE |\n exports.WASI_RIGHT_FD_ADVISE |\n exports.WASI_RIGHT_FD_ALLOCATE |\n exports.WASI_RIGHT_FD_FILESTAT_GET |\n exports.WASI_RIGHT_FD_FILESTAT_SET_SIZE |\n exports.WASI_RIGHT_FD_FILESTAT_SET_TIMES |\n exports.WASI_RIGHT_POLL_FD_READWRITE;\n exports.RIGHTS_REGULAR_FILE_INHERITING = BigInt(0);\n exports.RIGHTS_DIRECTORY_BASE =\n exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS |\n exports.WASI_RIGHT_FD_SYNC |\n exports.WASI_RIGHT_FD_ADVISE |\n exports.WASI_RIGHT_PATH_CREATE_DIRECTORY |\n exports.WASI_RIGHT_PATH_CREATE_FILE |\n exports.WASI_RIGHT_PATH_LINK_SOURCE |\n exports.WASI_RIGHT_PATH_LINK_TARGET |\n exports.WASI_RIGHT_PATH_OPEN |\n exports.WASI_RIGHT_FD_READDIR |\n exports.WASI_RIGHT_PATH_READLINK |\n exports.WASI_RIGHT_PATH_RENAME_SOURCE |\n exports.WASI_RIGHT_PATH_RENAME_TARGET |\n exports.WASI_RIGHT_PATH_FILESTAT_GET |\n exports.WASI_RIGHT_PATH_FILESTAT_SET_SIZE |\n exports.WASI_RIGHT_PATH_FILESTAT_SET_TIMES |\n exports.WASI_RIGHT_FD_FILESTAT_GET |\n exports.WASI_RIGHT_FD_FILESTAT_SET_TIMES |\n exports.WASI_RIGHT_PATH_SYMLINK |\n exports.WASI_RIGHT_PATH_UNLINK_FILE |\n exports.WASI_RIGHT_PATH_REMOVE_DIRECTORY |\n exports.WASI_RIGHT_POLL_FD_READWRITE;\n exports.RIGHTS_DIRECTORY_INHERITING = exports.RIGHTS_DIRECTORY_BASE | exports.RIGHTS_REGULAR_FILE_BASE;\n exports.RIGHTS_SOCKET_BASE =\n exports.WASI_RIGHT_FD_READ |\n exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS |\n exports.WASI_RIGHT_FD_WRITE |\n exports.WASI_RIGHT_FD_FILESTAT_GET |\n exports.WASI_RIGHT_POLL_FD_READWRITE |\n exports.WASI_RIGHT_SOCK_SHUTDOWN;\n exports.RIGHTS_SOCKET_INHERITING = exports.RIGHTS_ALL;\n exports.RIGHTS_TTY_BASE =\n exports.WASI_RIGHT_FD_READ |\n exports.WASI_RIGHT_FD_FDSTAT_SET_FLAGS |\n exports.WASI_RIGHT_FD_WRITE |\n exports.WASI_RIGHT_FD_FILESTAT_GET |\n exports.WASI_RIGHT_POLL_FD_READWRITE;\n exports.RIGHTS_TTY_INHERITING = BigInt(0);\n exports.WASI_CLOCK_REALTIME = 0;\n exports.WASI_CLOCK_MONOTONIC = 1;\n exports.WASI_CLOCK_PROCESS_CPUTIME_ID = 2;\n exports.WASI_CLOCK_THREAD_CPUTIME_ID = 3;\n exports.WASI_EVENTTYPE_CLOCK = 0;\n exports.WASI_EVENTTYPE_FD_READ = 1;\n exports.WASI_EVENTTYPE_FD_WRITE = 2;\n exports.WASI_FILESTAT_SET_ATIM = 1 << 0;\n exports.WASI_FILESTAT_SET_ATIM_NOW = 1 << 1;\n exports.WASI_FILESTAT_SET_MTIM = 1 << 2;\n exports.WASI_FILESTAT_SET_MTIM_NOW = 1 << 3;\n exports.WASI_O_CREAT = 1 << 0;\n exports.WASI_O_DIRECTORY = 1 << 1;\n exports.WASI_O_EXCL = 1 << 2;\n exports.WASI_O_TRUNC = 1 << 3;\n exports.WASI_PREOPENTYPE_DIR = 0;\n exports.WASI_DIRCOOKIE_START = 0;\n exports.WASI_STDIN_FILENO = 0;\n exports.WASI_STDOUT_FILENO = 1;\n exports.WASI_STDERR_FILENO = 2;\n exports.WASI_WHENCE_SET = 0;\n exports.WASI_WHENCE_CUR = 1;\n exports.WASI_WHENCE_END = 2;\n exports.ERROR_MAP = {\n E2BIG: exports.WASI_E2BIG,\n EACCES: exports.WASI_EACCES,\n EADDRINUSE: exports.WASI_EADDRINUSE,\n EADDRNOTAVAIL: exports.WASI_EADDRNOTAVAIL,\n EAFNOSUPPORT: exports.WASI_EAFNOSUPPORT,\n EALREADY: exports.WASI_EALREADY,\n EAGAIN: exports.WASI_EAGAIN,\n EBADF: exports.WASI_EBADF,\n EBADMSG: exports.WASI_EBADMSG,\n EBUSY: exports.WASI_EBUSY,\n ECANCELED: exports.WASI_ECANCELED,\n ECHILD: exports.WASI_ECHILD,\n ECONNABORTED: exports.WASI_ECONNABORTED,\n ECONNREFUSED: exports.WASI_ECONNREFUSED,\n ECONNRESET: exports.WASI_ECONNRESET,\n EDEADLOCK: exports.WASI_EDEADLK,\n EDESTADDRREQ: exports.WASI_EDESTADDRREQ,\n EDOM: exports.WASI_EDOM,\n EDQUOT: exports.WASI_EDQUOT,\n EEXIST: exports.WASI_EEXIST,\n EFAULT: exports.WASI_EFAULT,\n EFBIG: exports.WASI_EFBIG,\n EHOSTDOWN: exports.WASI_EHOSTUNREACH,\n EHOSTUNREACH: exports.WASI_EHOSTUNREACH,\n EIDRM: exports.WASI_EIDRM,\n EILSEQ: exports.WASI_EILSEQ,\n EINPROGRESS: exports.WASI_EINPROGRESS,\n EINTR: exports.WASI_EINTR,\n EINVAL: exports.WASI_EINVAL,\n EIO: exports.WASI_EIO,\n EISCONN: exports.WASI_EISCONN,\n EISDIR: exports.WASI_EISDIR,\n ELOOP: exports.WASI_ELOOP,\n EMFILE: exports.WASI_EMFILE,\n EMLINK: exports.WASI_EMLINK,\n EMSGSIZE: exports.WASI_EMSGSIZE,\n EMULTIHOP: exports.WASI_EMULTIHOP,\n ENAMETOOLONG: exports.WASI_ENAMETOOLONG,\n ENETDOWN: exports.WASI_ENETDOWN,\n ENETRESET: exports.WASI_ENETRESET,\n ENETUNREACH: exports.WASI_ENETUNREACH,\n ENFILE: exports.WASI_ENFILE,\n ENOBUFS: exports.WASI_ENOBUFS,\n ENODEV: exports.WASI_ENODEV,\n ENOENT: exports.WASI_ENOENT,\n ENOEXEC: exports.WASI_ENOEXEC,\n ENOLCK: exports.WASI_ENOLCK,\n ENOLINK: exports.WASI_ENOLINK,\n ENOMEM: exports.WASI_ENOMEM,\n ENOMSG: exports.WASI_ENOMSG,\n ENOPROTOOPT: exports.WASI_ENOPROTOOPT,\n ENOSPC: exports.WASI_ENOSPC,\n ENOSYS: exports.WASI_ENOSYS,\n ENOTCONN: exports.WASI_ENOTCONN,\n ENOTDIR: exports.WASI_ENOTDIR,\n ENOTEMPTY: exports.WASI_ENOTEMPTY,\n ENOTRECOVERABLE: exports.WASI_ENOTRECOVERABLE,\n ENOTSOCK: exports.WASI_ENOTSOCK,\n ENOTTY: exports.WASI_ENOTTY,\n ENXIO: exports.WASI_ENXIO,\n EOVERFLOW: exports.WASI_EOVERFLOW,\n EOWNERDEAD: exports.WASI_EOWNERDEAD,\n EPERM: exports.WASI_EPERM,\n EPIPE: exports.WASI_EPIPE,\n EPROTO: exports.WASI_EPROTO,\n EPROTONOSUPPORT: exports.WASI_EPROTONOSUPPORT,\n EPROTOTYPE: exports.WASI_EPROTOTYPE,\n ERANGE: exports.WASI_ERANGE,\n EROFS: exports.WASI_EROFS,\n ESPIPE: exports.WASI_ESPIPE,\n ESRCH: exports.WASI_ESRCH,\n ESTALE: exports.WASI_ESTALE,\n ETIMEDOUT: exports.WASI_ETIMEDOUT,\n ETXTBSY: exports.WASI_ETXTBSY,\n EXDEV: exports.WASI_EXDEV,\n };\n exports.SIGNAL_MAP = {\n [exports.WASI_SIGHUP]: \"SIGHUP\",\n [exports.WASI_SIGINT]: \"SIGINT\",\n [exports.WASI_SIGQUIT]: \"SIGQUIT\",\n [exports.WASI_SIGILL]: \"SIGILL\",\n [exports.WASI_SIGTRAP]: \"SIGTRAP\",\n [exports.WASI_SIGABRT]: \"SIGABRT\",\n [exports.WASI_SIGBUS]: \"SIGBUS\",\n [exports.WASI_SIGFPE]: \"SIGFPE\",\n [exports.WASI_SIGKILL]: \"SIGKILL\",\n [exports.WASI_SIGUSR1]: \"SIGUSR1\",\n [exports.WASI_SIGSEGV]: \"SIGSEGV\",\n [exports.WASI_SIGUSR2]: \"SIGUSR2\",\n [exports.WASI_SIGPIPE]: \"SIGPIPE\",\n [exports.WASI_SIGALRM]: \"SIGALRM\",\n [exports.WASI_SIGTERM]: \"SIGTERM\",\n [exports.WASI_SIGCHLD]: \"SIGCHLD\",\n [exports.WASI_SIGCONT]: \"SIGCONT\",\n [exports.WASI_SIGSTOP]: \"SIGSTOP\",\n [exports.WASI_SIGTSTP]: \"SIGTSTP\",\n [exports.WASI_SIGTTIN]: \"SIGTTIN\",\n [exports.WASI_SIGTTOU]: \"SIGTTOU\",\n [exports.WASI_SIGURG]: \"SIGURG\",\n [exports.WASI_SIGXCPU]: \"SIGXCPU\",\n [exports.WASI_SIGXFSZ]: \"SIGXFSZ\",\n [exports.WASI_SIGVTALRM]: \"SIGVTALRM\",\n };\n },\n});\n\n// node_modules/wasi-js/dist/wasi.js\nvar require_wasi = __commonJS({\n \"node_modules/wasi-js/dist/wasi.js\"(exports) {\n var __importDefault =\n (exports && exports.__importDefault) ||\n function (mod) {\n return mod && mod.__esModule ? mod : { default: mod };\n };\n let fs;\n Object.defineProperty(exports, \"__esModule\", { value: true });\n exports.SOCKET_DEFAULT_RIGHTS = void 0;\n var log = () => {};\n var logOpen = () => {};\n var SC_OPEN_MAX = 32768;\n var types_1 = require_types();\n\n var constants_1 = require_constants();\n var STDIN_DEFAULT_RIGHTS =\n constants_1.WASI_RIGHT_FD_DATASYNC |\n constants_1.WASI_RIGHT_FD_READ |\n constants_1.WASI_RIGHT_FD_SYNC |\n constants_1.WASI_RIGHT_FD_ADVISE |\n constants_1.WASI_RIGHT_FD_FILESTAT_GET |\n constants_1.WASI_RIGHT_POLL_FD_READWRITE;\n var STDOUT_DEFAULT_RIGHTS =\n constants_1.WASI_RIGHT_FD_DATASYNC |\n constants_1.WASI_RIGHT_FD_WRITE |\n constants_1.WASI_RIGHT_FD_SYNC |\n constants_1.WASI_RIGHT_FD_ADVISE |\n constants_1.WASI_RIGHT_FD_FILESTAT_GET |\n constants_1.WASI_RIGHT_POLL_FD_READWRITE;\n var STDERR_DEFAULT_RIGHTS = STDOUT_DEFAULT_RIGHTS;\n exports.SOCKET_DEFAULT_RIGHTS =\n constants_1.WASI_RIGHT_FD_DATASYNC |\n constants_1.WASI_RIGHT_FD_READ |\n constants_1.WASI_RIGHT_FD_WRITE |\n constants_1.WASI_RIGHT_FD_ADVISE |\n constants_1.WASI_RIGHT_FD_FILESTAT_GET |\n constants_1.WASI_RIGHT_POLL_FD_READWRITE |\n constants_1.WASI_RIGHT_FD_FDSTAT_SET_FLAGS;\n var msToNs = ms => {\n const msInt = Math.trunc(ms);\n\n const decimal = BigInt(Math.round((ms - msInt) * 1e6));\n const ns = BigInt(msInt) * BigInt(1e6);\n return ns + decimal;\n };\n var nsToMs = ns => {\n if (typeof ns === \"number\") {\n ns = Math.trunc(ns);\n }\n const nsInt = BigInt(ns);\n return Number(nsInt / BigInt(1e6));\n };\n var wrap =\n f =>\n (...args) => {\n try {\n return f(...args);\n } catch (err) {\n let e = err;\n while (e.prev != null) {\n e = e.prev;\n }\n if (e?.code && typeof e?.code === \"string\") {\n return constants_1.ERROR_MAP[e.code] || constants_1.WASI_EINVAL;\n }\n if (e instanceof types_1.WASIError) {\n return e.errno;\n }\n throw e;\n }\n };\n var stat = (wasi, fd) => {\n const entry = wasi.FD_MAP.get(fd);\n if (!entry) {\n throw new types_1.WASIError(constants_1.WASI_EBADF);\n }\n if (entry.filetype === void 0) {\n const stats = wasi.fstatSync(entry.real);\n const { filetype, rightsBase, rightsInheriting } = translateFileAttributes(wasi, fd, stats);\n entry.filetype = filetype;\n if (!entry.rights) {\n entry.rights = {\n base: rightsBase,\n inheriting: rightsInheriting,\n };\n }\n }\n return entry;\n };\n var translateFileAttributes = (wasi, fd, stats) => {\n switch (true) {\n case stats.isBlockDevice():\n return {\n filetype: constants_1.WASI_FILETYPE_BLOCK_DEVICE,\n rightsBase: constants_1.RIGHTS_BLOCK_DEVICE_BASE,\n rightsInheriting: constants_1.RIGHTS_BLOCK_DEVICE_INHERITING,\n };\n case stats.isCharacterDevice(): {\n const filetype = constants_1.WASI_FILETYPE_CHARACTER_DEVICE;\n if (fd !== void 0 && wasi.bindings.isTTY(fd)) {\n return {\n filetype,\n rightsBase: constants_1.RIGHTS_TTY_BASE,\n rightsInheriting: constants_1.RIGHTS_TTY_INHERITING,\n };\n }\n return {\n filetype,\n rightsBase: constants_1.RIGHTS_CHARACTER_DEVICE_BASE,\n rightsInheriting: constants_1.RIGHTS_CHARACTER_DEVICE_INHERITING,\n };\n }\n case stats.isDirectory():\n return {\n filetype: constants_1.WASI_FILETYPE_DIRECTORY,\n rightsBase: constants_1.RIGHTS_DIRECTORY_BASE,\n rightsInheriting: constants_1.RIGHTS_DIRECTORY_INHERITING,\n };\n case stats.isFIFO():\n return {\n filetype: constants_1.WASI_FILETYPE_SOCKET_STREAM,\n rightsBase: constants_1.RIGHTS_SOCKET_BASE,\n rightsInheriting: constants_1.RIGHTS_SOCKET_INHERITING,\n };\n case stats.isFile():\n return {\n filetype: constants_1.WASI_FILETYPE_REGULAR_FILE,\n rightsBase: constants_1.RIGHTS_REGULAR_FILE_BASE,\n rightsInheriting: constants_1.RIGHTS_REGULAR_FILE_INHERITING,\n };\n case stats.isSocket():\n return {\n filetype: constants_1.WASI_FILETYPE_SOCKET_STREAM,\n rightsBase: constants_1.RIGHTS_SOCKET_BASE,\n rightsInheriting: constants_1.RIGHTS_SOCKET_INHERITING,\n };\n case stats.isSymbolicLink():\n return {\n filetype: constants_1.WASI_FILETYPE_SYMBOLIC_LINK,\n rightsBase: BigInt(0),\n rightsInheriting: BigInt(0),\n };\n default:\n return {\n filetype: constants_1.WASI_FILETYPE_UNKNOWN,\n rightsBase: BigInt(0),\n rightsInheriting: BigInt(0),\n };\n }\n };\n var warnedAboutSleep = false;\n\n var defaultConfig;\n function getDefaults() {\n if (defaultConfig) return defaultConfig;\n\n const defaultBindings = {\n hrtime: () => process.hrtime.bigint(),\n exit: code => {\n process.exit(code);\n },\n kill: signal => {\n process.kill(process.pid, signal);\n },\n randomFillSync: array => crypto.getRandomValues(array),\n isTTY: fd => import.meta.require(\"node:tty\").isatty(fd),\n fs: Bun.fs(),\n path: import.meta.require(\"node:path\"),\n };\n\n return (defaultConfig = {\n args: [],\n env: {},\n preopens: {},\n bindings: defaultBindings,\n sleep: ms => {\n Bun.sleepSync(ms);\n },\n });\n }\n\n var WASI = class WASI {\n constructor(wasiConfig = {}) {\n const defaultConfig = getDefaults();\n this.lastStdin = 0;\n this.sleep = wasiConfig.sleep || defaultConfig.sleep;\n this.getStdin = wasiConfig.getStdin;\n this.sendStdout = wasiConfig.sendStdout;\n this.sendStderr = wasiConfig.sendStderr;\n let preopens = wasiConfig.preopens ?? defaultConfig.preopens;\n this.env = wasiConfig.env ?? defaultConfig.env;\n\n const args = wasiConfig.args ?? defaultConfig.args;\n this.memory = void 0;\n this.view = void 0;\n this.bindings = wasiConfig.bindings || defaultConfig.bindings;\n const bindings = this.bindings;\n fs = bindings.fs;\n this.FD_MAP = /* @__PURE__ */ new Map([\n [\n constants_1.WASI_STDIN_FILENO,\n {\n real: 0,\n filetype: constants_1.WASI_FILETYPE_CHARACTER_DEVICE,\n rights: {\n base: STDIN_DEFAULT_RIGHTS,\n inheriting: BigInt(0),\n },\n path: \"/dev/stdin\",\n },\n ],\n [\n constants_1.WASI_STDOUT_FILENO,\n {\n real: 1,\n filetype: constants_1.WASI_FILETYPE_CHARACTER_DEVICE,\n rights: {\n base: STDOUT_DEFAULT_RIGHTS,\n inheriting: BigInt(0),\n },\n path: \"/dev/stdout\",\n },\n ],\n [\n constants_1.WASI_STDERR_FILENO,\n {\n real: 2,\n filetype: constants_1.WASI_FILETYPE_CHARACTER_DEVICE,\n rights: {\n base: STDERR_DEFAULT_RIGHTS,\n inheriting: BigInt(0),\n },\n path: \"/dev/stderr\",\n },\n ],\n ]);\n const path = bindings.path;\n for (const [k, v] of Object.entries(preopens)) {\n const real = fs.openSync(v, nodeFsConstants.O_RDONLY);\n const newfd = this.getUnusedFileDescriptor();\n this.FD_MAP.set(newfd, {\n real,\n filetype: constants_1.WASI_FILETYPE_DIRECTORY,\n rights: {\n base: constants_1.RIGHTS_DIRECTORY_BASE,\n inheriting: constants_1.RIGHTS_DIRECTORY_INHERITING,\n },\n fakePath: k,\n path: v,\n });\n }\n const getiovs = (iovs, iovsLen) => {\n this.refreshMemory();\n\n const { view, memory } = this;\n const { buffer } = memory;\n const { byteLength } = buffer;\n\n if (iovsLen === 1) {\n const ptr = iovs;\n const buf = view.getUint32(ptr, true);\n let bufLen = view.getUint32(ptr + 4, true);\n\n if (bufLen > byteLength - buf) {\n console.log({\n buf,\n bufLen,\n total_memory: byteLength,\n });\n log(\"getiovs: warning -- truncating buffer to fit in memory\");\n bufLen = Math.min(bufLen, Math.max(0, byteLength - buf));\n }\n try {\n return [new Uint8Array(buffer, buf, bufLen)];\n } catch (err) {\n console.warn(\"WASI.getiovs -- invalid buffer\", err);\n throw new types_1.WASIError(constants_1.WASI_EINVAL);\n }\n }\n\n // Avoid referencing Array because materializing the Array constructor can show up in profiling\n const buffers = [];\n buffers.length = iovsLen;\n\n for (let i = 0, ptr = iovs; i < iovsLen; i++, ptr += 8) {\n const buf = view.getUint32(ptr, true);\n let bufLen = view.getUint32(ptr + 4, true);\n\n if (bufLen > byteLength - buf) {\n console.log({\n buf,\n bufLen,\n total_memory: byteLength,\n });\n log(\"getiovs: warning -- truncating buffer to fit in memory\");\n bufLen = Math.min(bufLen, Math.max(0, byteLength - buf));\n }\n try {\n buffers[i] = new Uint8Array(buffer, buf, bufLen);\n } catch (err) {\n console.warn(\"WASI.getiovs -- invalid buffer\", err);\n throw new types_1.WASIError(constants_1.WASI_EINVAL);\n }\n }\n return buffers;\n };\n const CHECK_FD = (fd, rights) => {\n const stats = stat(this, fd);\n if (rights !== BigInt(0) && (stats.rights.base & rights) === BigInt(0)) {\n throw new types_1.WASIError(constants_1.WASI_EPERM);\n }\n return stats;\n };\n const CPUTIME_START = Bun.nanoseconds();\n const timeOrigin = Math.trunc(performance.timeOrigin * 1e6);\n const now = clockId => {\n switch (clockId) {\n case constants_1.WASI_CLOCK_MONOTONIC:\n return Bun.nanoseconds();\n case constants_1.WASI_CLOCK_REALTIME:\n return Bun.nanoseconds() + timeOrigin;\n case constants_1.WASI_CLOCK_PROCESS_CPUTIME_ID:\n case constants_1.WASI_CLOCK_THREAD_CPUTIME_ID:\n return Bun.nanoseconds() - CPUTIME_START;\n default:\n return null;\n }\n };\n this.wasiImport = {\n args_get: (argv, argvBuf) => {\n this.refreshMemory();\n let coffset = argv;\n let offset = argvBuf;\n args.forEach(a => {\n this.view.setUint32(coffset, offset, true);\n coffset += 4;\n offset += Buffer.from(this.memory.buffer).write(`${a}\\0`, offset);\n });\n return constants_1.WASI_ESUCCESS;\n },\n args_sizes_get: (argc, argvBufSize) => {\n this.refreshMemory();\n this.view.setUint32(argc, args.length, true);\n const size = args.reduce((acc, a) => acc + Buffer.byteLength(a) + 1, 0);\n this.view.setUint32(argvBufSize, size, true);\n return constants_1.WASI_ESUCCESS;\n },\n environ_get: (environ, environBuf) => {\n this.refreshMemory();\n let coffset = environ;\n let offset = environBuf;\n Object.entries(this.env).forEach(([key, value]) => {\n this.view.setUint32(coffset, offset, true);\n coffset += 4;\n offset += Buffer.from(this.memory.buffer).write(`${key}=${value}\\0`, offset);\n });\n return constants_1.WASI_ESUCCESS;\n },\n environ_sizes_get: (environCount, environBufSize) => {\n this.refreshMemory();\n const envProcessed = Object.entries(this.env).map(([key, value]) => `${key}=${value}\\0`);\n const size = envProcessed.reduce((acc, e) => acc + Buffer.byteLength(e), 0);\n this.view.setUint32(environCount, envProcessed.length, true);\n this.view.setUint32(environBufSize, size, true);\n return constants_1.WASI_ESUCCESS;\n },\n clock_res_get: (clockId, resolution) => {\n let res;\n switch (clockId) {\n case constants_1.WASI_CLOCK_MONOTONIC:\n case constants_1.WASI_CLOCK_PROCESS_CPUTIME_ID:\n case constants_1.WASI_CLOCK_THREAD_CPUTIME_ID: {\n res = BigInt(1);\n break;\n }\n case constants_1.WASI_CLOCK_REALTIME: {\n res = BigInt(1e3);\n break;\n }\n }\n if (!res) {\n throw Error(\"invalid clockId\");\n }\n this.view.setBigUint64(resolution, res);\n return constants_1.WASI_ESUCCESS;\n },\n clock_time_get: (clockId, _precision, time) => {\n this.refreshMemory();\n const n = now(clockId);\n if (n === null) {\n return constants_1.WASI_EINVAL;\n }\n this.view.setBigUint64(time, BigInt(n), true);\n return constants_1.WASI_ESUCCESS;\n },\n fd_advise: wrap((fd, _offset, _len, _advice) => {\n CHECK_FD(fd, constants_1.WASI_RIGHT_FD_ADVISE);\n return constants_1.WASI_ENOSYS;\n }),\n fd_allocate: wrap((fd, _offset, _len) => {\n CHECK_FD(fd, constants_1.WASI_RIGHT_FD_ALLOCATE);\n return constants_1.WASI_ENOSYS;\n }),\n fd_close: wrap(fd => {\n const stats = CHECK_FD(fd, BigInt(0));\n fs.closeSync(stats.real);\n this.FD_MAP.delete(fd);\n return constants_1.WASI_ESUCCESS;\n }),\n fd_datasync: wrap(fd => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_DATASYNC);\n fs.fdatasyncSync(stats.real);\n return constants_1.WASI_ESUCCESS;\n }),\n fd_fdstat_get: wrap((fd, bufPtr) => {\n const stats = CHECK_FD(fd, BigInt(0));\n this.refreshMemory();\n if (stats.filetype == null) {\n throw Error(\"stats.filetype must be set\");\n }\n this.view.setUint8(bufPtr, stats.filetype);\n this.view.setUint16(bufPtr + 2, 0, true);\n this.view.setUint16(bufPtr + 4, 0, true);\n this.view.setBigUint64(bufPtr + 8, BigInt(stats.rights.base), true);\n this.view.setBigUint64(bufPtr + 8 + 8, BigInt(stats.rights.inheriting), true);\n return constants_1.WASI_ESUCCESS;\n }),\n fd_fdstat_set_flags: wrap((fd, flags) => {\n CHECK_FD(fd, constants_1.WASI_RIGHT_FD_FDSTAT_SET_FLAGS);\n if (this.wasiImport.sock_fcntlSetFlags(fd, flags) == 0) {\n return constants_1.WASI_ESUCCESS;\n }\n return constants_1.WASI_ENOSYS;\n }),\n fd_fdstat_set_rights: wrap((fd, fsRightsBase, fsRightsInheriting) => {\n const stats = CHECK_FD(fd, BigInt(0));\n const nrb = stats.rights.base | fsRightsBase;\n if (nrb > stats.rights.base) {\n return constants_1.WASI_EPERM;\n }\n const nri = stats.rights.inheriting | fsRightsInheriting;\n if (nri > stats.rights.inheriting) {\n return constants_1.WASI_EPERM;\n }\n stats.rights.base = fsRightsBase;\n stats.rights.inheriting = fsRightsInheriting;\n return constants_1.WASI_ESUCCESS;\n }),\n fd_filestat_get: wrap((fd, bufPtr) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_FILESTAT_GET);\n const rstats = this.fstatSync(stats.real);\n this.refreshMemory();\n this.view.setBigUint64(bufPtr, BigInt(rstats.dev), true);\n bufPtr += 8;\n this.view.setBigUint64(bufPtr, BigInt(rstats.ino), true);\n bufPtr += 8;\n if (stats.filetype == null) {\n throw Error(\"stats.filetype must be set\");\n }\n this.view.setUint8(bufPtr, stats.filetype);\n bufPtr += 8;\n this.view.setBigUint64(bufPtr, BigInt(rstats.nlink), true);\n bufPtr += 8;\n this.view.setBigUint64(bufPtr, BigInt(rstats.size), true);\n bufPtr += 8;\n this.view.setBigUint64(bufPtr, msToNs(rstats.atimeMs), true);\n bufPtr += 8;\n this.view.setBigUint64(bufPtr, msToNs(rstats.mtimeMs), true);\n bufPtr += 8;\n this.view.setBigUint64(bufPtr, msToNs(rstats.ctimeMs), true);\n return constants_1.WASI_ESUCCESS;\n }),\n fd_filestat_set_size: wrap((fd, stSize) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_FILESTAT_SET_SIZE);\n fs.ftruncateSync(stats.real, Number(stSize));\n return constants_1.WASI_ESUCCESS;\n }),\n fd_filestat_set_times: wrap((fd, stAtim, stMtim, fstflags) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_FILESTAT_SET_TIMES);\n const rstats = this.fstatSync(stats.real);\n let atim = rstats.atime;\n let mtim = rstats.mtime;\n const n = nsToMs(now(constants_1.WASI_CLOCK_REALTIME));\n const atimflags = constants_1.WASI_FILESTAT_SET_ATIM | constants_1.WASI_FILESTAT_SET_ATIM_NOW;\n if ((fstflags & atimflags) === atimflags) {\n return constants_1.WASI_EINVAL;\n }\n const mtimflags = constants_1.WASI_FILESTAT_SET_MTIM | constants_1.WASI_FILESTAT_SET_MTIM_NOW;\n if ((fstflags & mtimflags) === mtimflags) {\n return constants_1.WASI_EINVAL;\n }\n if ((fstflags & constants_1.WASI_FILESTAT_SET_ATIM) === constants_1.WASI_FILESTAT_SET_ATIM) {\n atim = nsToMs(stAtim);\n } else if ((fstflags & constants_1.WASI_FILESTAT_SET_ATIM_NOW) === constants_1.WASI_FILESTAT_SET_ATIM_NOW) {\n atim = n;\n }\n if ((fstflags & constants_1.WASI_FILESTAT_SET_MTIM) === constants_1.WASI_FILESTAT_SET_MTIM) {\n mtim = nsToMs(stMtim);\n } else if ((fstflags & constants_1.WASI_FILESTAT_SET_MTIM_NOW) === constants_1.WASI_FILESTAT_SET_MTIM_NOW) {\n mtim = n;\n }\n fs.futimesSync(stats.real, new Date(atim), new Date(mtim));\n return constants_1.WASI_ESUCCESS;\n }),\n fd_prestat_get: wrap((fd, bufPtr) => {\n const stats = CHECK_FD(fd, BigInt(0));\n this.refreshMemory();\n this.view.setUint8(bufPtr, constants_1.WASI_PREOPENTYPE_DIR);\n this.view.setUint32(bufPtr + 4, Buffer.byteLength(stats.fakePath ?? stats.path ?? \"\"), true);\n return constants_1.WASI_ESUCCESS;\n }),\n fd_prestat_dir_name: wrap((fd, pathPtr, pathLen) => {\n const stats = CHECK_FD(fd, BigInt(0));\n this.refreshMemory();\n Buffer.from(this.memory.buffer).write(stats.fakePath ?? stats.path ?? \"\", pathPtr, pathLen, \"utf8\");\n return constants_1.WASI_ESUCCESS;\n }),\n fd_pwrite: wrap((fd, iovs, iovsLen, offset, nwritten) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_WRITE | constants_1.WASI_RIGHT_FD_SEEK);\n let written = 0;\n getiovs(iovs, iovsLen).forEach(iov => {\n let w = 0;\n while (w < iov.byteLength) {\n w += fs.writeSync(stats.real, iov, w, iov.byteLength - w, Number(offset) + written + w);\n }\n written += w;\n });\n this.view.setUint32(nwritten, written, true);\n return constants_1.WASI_ESUCCESS;\n }),\n fd_write: wrap((fd, iovs, iovsLen, nwritten) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_WRITE);\n const IS_STDOUT = fd == constants_1.WASI_STDOUT_FILENO;\n const IS_STDERR = fd == constants_1.WASI_STDERR_FILENO;\n let written = 0;\n getiovs(iovs, iovsLen).forEach(iov => {\n if (iov.byteLength == 0) return;\n if (IS_STDOUT && this.sendStdout != null) {\n this.sendStdout(iov);\n written += iov.byteLength;\n } else if (IS_STDERR && this.sendStderr != null) {\n this.sendStderr(iov);\n written += iov.byteLength;\n } else {\n let w = 0;\n while (w < iov.byteLength) {\n const i = fs.writeSync(\n stats.real,\n iov,\n w,\n iov.byteLength - w,\n stats.offset ? Number(stats.offset) : null,\n );\n if (stats.offset) stats.offset += BigInt(i);\n w += i;\n }\n written += w;\n }\n });\n this.view.setUint32(nwritten, written, true);\n return constants_1.WASI_ESUCCESS;\n }),\n fd_pread: wrap((fd, iovs, iovsLen, offset, nread) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_READ | constants_1.WASI_RIGHT_FD_SEEK);\n let read = 0;\n outer: for (const iov of getiovs(iovs, iovsLen)) {\n let r = 0;\n while (r < iov.byteLength) {\n const length = iov.byteLength - r;\n const rr = fs.readSync(stats.real, iov, r, iov.byteLength - r, Number(offset) + read + r);\n r += rr;\n read += rr;\n if (rr === 0 || rr < length) {\n break outer;\n }\n }\n read += r;\n }\n this.view.setUint32(nread, read, true);\n return constants_1.WASI_ESUCCESS;\n }),\n fd_read: wrap((fd, iovs, iovsLen, nread) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_READ);\n const IS_STDIN = fd == constants_1.WASI_STDIN_FILENO;\n let read = 0;\n outer: for (const iov of getiovs(iovs, iovsLen)) {\n let r = 0;\n while (r < iov.byteLength) {\n let length = iov.byteLength - r;\n let position = IS_STDIN || stats.offset === void 0 ? null : Number(stats.offset);\n let rr = 0;\n if (IS_STDIN) {\n if (this.getStdin != null) {\n if (this.stdinBuffer == null) {\n this.stdinBuffer = this.getStdin();\n }\n if (this.stdinBuffer != null) {\n rr = this.stdinBuffer.copy(iov);\n if (rr == this.stdinBuffer.length) {\n this.stdinBuffer = void 0;\n } else {\n this.stdinBuffer = this.stdinBuffer.slice(rr);\n }\n if (rr > 0) {\n this.lastStdin = new Date().valueOf();\n }\n }\n } else {\n if (this.sleep == null && !warnedAboutSleep) {\n warnedAboutSleep = true;\n console.log(\"(cpu waiting for stdin: please define a way to sleep!) \");\n }\n try {\n rr = fs.readSync(stats.real, iov, r, length, position);\n } catch (_err) {}\n if (rr == 0) {\n this.shortPause();\n } else {\n this.lastStdin = new Date().valueOf();\n }\n }\n } else {\n rr = fs.readSync(stats.real, iov, r, length, position);\n }\n if (stats.filetype == constants_1.WASI_FILETYPE_REGULAR_FILE) {\n stats.offset = (stats.offset ? stats.offset : BigInt(0)) + BigInt(rr);\n }\n r += rr;\n read += rr;\n if (rr === 0 || rr < length) {\n break outer;\n }\n }\n }\n this.view.setUint32(nread, read, true);\n return constants_1.WASI_ESUCCESS;\n }),\n fd_readdir: wrap((fd, bufPtr, bufLen, cookie, bufusedPtr) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_READDIR);\n this.refreshMemory();\n const entries = fs.readdirSync(stats.path, { withFileTypes: true });\n const startPtr = bufPtr;\n for (let i = Number(cookie); i < entries.length; i += 1) {\n const entry = entries[i];\n let nameLength = Buffer.byteLength(entry.name);\n if (bufPtr - startPtr > bufLen) {\n break;\n }\n this.view.setBigUint64(bufPtr, BigInt(i + 1), true);\n bufPtr += 8;\n if (bufPtr - startPtr > bufLen) {\n break;\n }\n const rstats = fs.lstatSync(path.resolve(stats.path, entry.name));\n this.view.setBigUint64(bufPtr, BigInt(rstats.ino), true);\n bufPtr += 8;\n if (bufPtr - startPtr > bufLen) {\n break;\n }\n this.view.setUint32(bufPtr, nameLength, true);\n bufPtr += 4;\n if (bufPtr - startPtr > bufLen) {\n break;\n }\n let filetype;\n switch (true) {\n case rstats.isBlockDevice():\n filetype = constants_1.WASI_FILETYPE_BLOCK_DEVICE;\n break;\n case rstats.isCharacterDevice():\n filetype = constants_1.WASI_FILETYPE_CHARACTER_DEVICE;\n break;\n case rstats.isDirectory():\n filetype = constants_1.WASI_FILETYPE_DIRECTORY;\n break;\n case rstats.isFIFO():\n filetype = constants_1.WASI_FILETYPE_SOCKET_STREAM;\n break;\n case rstats.isFile():\n filetype = constants_1.WASI_FILETYPE_REGULAR_FILE;\n break;\n case rstats.isSocket():\n filetype = constants_1.WASI_FILETYPE_SOCKET_STREAM;\n break;\n case rstats.isSymbolicLink():\n filetype = constants_1.WASI_FILETYPE_SYMBOLIC_LINK;\n break;\n default:\n filetype = constants_1.WASI_FILETYPE_UNKNOWN;\n break;\n }\n this.view.setUint8(bufPtr, filetype);\n bufPtr += 1;\n bufPtr += 3;\n if (bufPtr + nameLength >= startPtr + bufLen) {\n break;\n }\n let memory_buffer = Buffer.from(this.memory.buffer);\n memory_buffer.write(entry.name, bufPtr);\n bufPtr += nameLength;\n }\n const bufused = bufPtr - startPtr;\n this.view.setUint32(bufusedPtr, Math.min(bufused, bufLen), true);\n return constants_1.WASI_ESUCCESS;\n }),\n fd_renumber: wrap((from, to) => {\n CHECK_FD(from, BigInt(0));\n CHECK_FD(to, BigInt(0));\n fs.closeSync(this.FD_MAP.get(from).real);\n this.FD_MAP.set(from, this.FD_MAP.get(to));\n this.FD_MAP.delete(to);\n return constants_1.WASI_ESUCCESS;\n }),\n fd_seek: wrap((fd, offset, whence, newOffsetPtr) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_SEEK);\n this.refreshMemory();\n switch (whence) {\n case constants_1.WASI_WHENCE_CUR:\n stats.offset = (stats.offset ? stats.offset : BigInt(0)) + BigInt(offset);\n break;\n case constants_1.WASI_WHENCE_END:\n const { size } = this.fstatSync(stats.real);\n stats.offset = BigInt(size) + BigInt(offset);\n break;\n case constants_1.WASI_WHENCE_SET:\n stats.offset = BigInt(offset);\n break;\n }\n if (stats.offset == null) {\n throw Error(\"stats.offset must be defined\");\n }\n this.view.setBigUint64(newOffsetPtr, stats.offset, true);\n return constants_1.WASI_ESUCCESS;\n }),\n fd_tell: wrap((fd, offsetPtr) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_TELL);\n this.refreshMemory();\n if (!stats.offset) {\n stats.offset = BigInt(0);\n }\n this.view.setBigUint64(offsetPtr, stats.offset, true);\n return constants_1.WASI_ESUCCESS;\n }),\n fd_sync: wrap(fd => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_FD_SYNC);\n fs.fsyncSync(stats.real);\n return constants_1.WASI_ESUCCESS;\n }),\n path_create_directory: wrap((fd, pathPtr, pathLen) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_CREATE_DIRECTORY);\n if (!stats.path) {\n return constants_1.WASI_EINVAL;\n }\n this.refreshMemory();\n const p = Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n fs.mkdirSync(path.resolve(stats.path, p));\n return constants_1.WASI_ESUCCESS;\n }),\n path_filestat_get: wrap((fd, flags, pathPtr, pathLen, bufPtr) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_FILESTAT_GET);\n if (!stats.path) {\n return constants_1.WASI_EINVAL;\n }\n this.refreshMemory();\n const p = Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n let rstats;\n if (flags) {\n rstats = fs.statSync(path.resolve(stats.path, p));\n } else {\n rstats = fs.lstatSync(path.resolve(stats.path, p));\n }\n this.view.setBigUint64(bufPtr, BigInt(rstats.dev), true);\n bufPtr += 8;\n this.view.setBigUint64(bufPtr, BigInt(rstats.ino), true);\n bufPtr += 8;\n this.view.setUint8(bufPtr, translateFileAttributes(this, void 0, rstats).filetype);\n bufPtr += 8;\n this.view.setBigUint64(bufPtr, BigInt(rstats.nlink), true);\n bufPtr += 8;\n this.view.setBigUint64(bufPtr, BigInt(rstats.size), true);\n bufPtr += 8;\n this.view.setBigUint64(bufPtr, BigInt(rstats.atime.getTime() * 1e6), true);\n bufPtr += 8;\n this.view.setBigUint64(bufPtr, BigInt(rstats.mtime.getTime() * 1e6), true);\n bufPtr += 8;\n this.view.setBigUint64(bufPtr, BigInt(rstats.ctime.getTime() * 1e6), true);\n return constants_1.WASI_ESUCCESS;\n }),\n path_filestat_set_times: wrap((fd, _dirflags, pathPtr, pathLen, stAtim, stMtim, fstflags) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_FILESTAT_SET_TIMES);\n if (!stats.path) {\n return constants_1.WASI_EINVAL;\n }\n this.refreshMemory();\n const rstats = this.fstatSync(stats.real);\n let atim = rstats.atime;\n let mtim = rstats.mtime;\n const n = nsToMs(now(constants_1.WASI_CLOCK_REALTIME));\n const atimflags = constants_1.WASI_FILESTAT_SET_ATIM | constants_1.WASI_FILESTAT_SET_ATIM_NOW;\n if ((fstflags & atimflags) === atimflags) {\n return constants_1.WASI_EINVAL;\n }\n const mtimflags = constants_1.WASI_FILESTAT_SET_MTIM | constants_1.WASI_FILESTAT_SET_MTIM_NOW;\n if ((fstflags & mtimflags) === mtimflags) {\n return constants_1.WASI_EINVAL;\n }\n if ((fstflags & constants_1.WASI_FILESTAT_SET_ATIM) === constants_1.WASI_FILESTAT_SET_ATIM) {\n atim = nsToMs(stAtim);\n } else if ((fstflags & constants_1.WASI_FILESTAT_SET_ATIM_NOW) === constants_1.WASI_FILESTAT_SET_ATIM_NOW) {\n atim = n;\n }\n if ((fstflags & constants_1.WASI_FILESTAT_SET_MTIM) === constants_1.WASI_FILESTAT_SET_MTIM) {\n mtim = nsToMs(stMtim);\n } else if ((fstflags & constants_1.WASI_FILESTAT_SET_MTIM_NOW) === constants_1.WASI_FILESTAT_SET_MTIM_NOW) {\n mtim = n;\n }\n const p = Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n fs.utimesSync(path.resolve(stats.path, p), new Date(atim), new Date(mtim));\n return constants_1.WASI_ESUCCESS;\n }),\n path_link: wrap((oldFd, _oldFlags, oldPath, oldPathLen, newFd, newPath, newPathLen) => {\n const ostats = CHECK_FD(oldFd, constants_1.WASI_RIGHT_PATH_LINK_SOURCE);\n const nstats = CHECK_FD(newFd, constants_1.WASI_RIGHT_PATH_LINK_TARGET);\n if (!ostats.path || !nstats.path) {\n return constants_1.WASI_EINVAL;\n }\n this.refreshMemory();\n const op = Buffer.from(this.memory.buffer, oldPath, oldPathLen).toString();\n const np = Buffer.from(this.memory.buffer, newPath, newPathLen).toString();\n fs.linkSync(path.resolve(ostats.path, op), path.resolve(nstats.path, np));\n return constants_1.WASI_ESUCCESS;\n }),\n path_open: wrap(\n (dirfd, _dirflags, pathPtr, pathLen, oflags, fsRightsBase, fsRightsInheriting, fsFlags, fdPtr) => {\n try {\n const stats = CHECK_FD(dirfd, constants_1.WASI_RIGHT_PATH_OPEN);\n fsRightsBase = BigInt(fsRightsBase);\n fsRightsInheriting = BigInt(fsRightsInheriting);\n const read =\n (fsRightsBase & (constants_1.WASI_RIGHT_FD_READ | constants_1.WASI_RIGHT_FD_READDIR)) !== BigInt(0);\n const write =\n (fsRightsBase &\n (constants_1.WASI_RIGHT_FD_DATASYNC |\n constants_1.WASI_RIGHT_FD_WRITE |\n constants_1.WASI_RIGHT_FD_ALLOCATE |\n constants_1.WASI_RIGHT_FD_FILESTAT_SET_SIZE)) !==\n BigInt(0);\n let noflags;\n if (write && read) {\n noflags = nodeFsConstants.O_RDWR;\n } else if (read) {\n noflags = nodeFsConstants.O_RDONLY;\n } else if (write) {\n noflags = nodeFsConstants.O_WRONLY;\n }\n let neededBase = fsRightsBase | constants_1.WASI_RIGHT_PATH_OPEN;\n let neededInheriting = fsRightsBase | fsRightsInheriting;\n if ((oflags & constants_1.WASI_O_CREAT) !== 0) {\n noflags |= nodeFsConstants.O_CREAT;\n neededBase |= constants_1.WASI_RIGHT_PATH_CREATE_FILE;\n }\n if ((oflags & constants_1.WASI_O_DIRECTORY) !== 0) {\n noflags |= nodeFsConstants.O_DIRECTORY;\n }\n if ((oflags & constants_1.WASI_O_EXCL) !== 0) {\n noflags |= nodeFsConstants.O_EXCL;\n }\n if ((oflags & constants_1.WASI_O_TRUNC) !== 0) {\n noflags |= nodeFsConstants.O_TRUNC;\n neededBase |= constants_1.WASI_RIGHT_PATH_FILESTAT_SET_SIZE;\n }\n if ((fsFlags & constants_1.WASI_FDFLAG_APPEND) !== 0) {\n noflags |= nodeFsConstants.O_APPEND;\n }\n if ((fsFlags & constants_1.WASI_FDFLAG_DSYNC) !== 0) {\n if (nodeFsConstants.O_DSYNC) {\n noflags |= nodeFsConstants.O_DSYNC;\n } else {\n noflags |= nodeFsConstants.O_SYNC;\n }\n neededInheriting |= constants_1.WASI_RIGHT_FD_DATASYNC;\n }\n if ((fsFlags & constants_1.WASI_FDFLAG_NONBLOCK) !== 0) {\n noflags |= nodeFsConstants.O_NONBLOCK;\n }\n if ((fsFlags & constants_1.WASI_FDFLAG_RSYNC) !== 0) {\n if (nodeFsConstants.O_RSYNC) {\n noflags |= nodeFsConstants.O_RSYNC;\n } else {\n noflags |= nodeFsConstants.O_SYNC;\n }\n neededInheriting |= constants_1.WASI_RIGHT_FD_SYNC;\n }\n if ((fsFlags & constants_1.WASI_FDFLAG_SYNC) !== 0) {\n noflags |= nodeFsConstants.O_SYNC;\n neededInheriting |= constants_1.WASI_RIGHT_FD_SYNC;\n }\n if (write && (noflags & (nodeFsConstants.O_APPEND | nodeFsConstants.O_TRUNC)) === 0) {\n neededInheriting |= constants_1.WASI_RIGHT_FD_SEEK;\n }\n this.refreshMemory();\n const p = Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n if (p == \"dev/tty\") {\n this.view.setUint32(fdPtr, constants_1.WASI_STDIN_FILENO, true);\n return constants_1.WASI_ESUCCESS;\n }\n logOpen(\"path_open\", p);\n if (p.startsWith(\"proc/\")) {\n throw new types_1.WASIError(constants_1.WASI_EBADF);\n }\n const fullUnresolved = path.resolve(p);\n let full;\n try {\n full = fs.realpathSync(fullUnresolved);\n } catch (e) {\n if (e?.code === \"ENOENT\") {\n full = fullUnresolved;\n } else {\n throw e;\n }\n }\n let isDirectory;\n if (write) {\n try {\n isDirectory = fs.statSync(full).isDirectory();\n } catch (_err) {}\n }\n let realfd;\n if (!write && isDirectory) {\n realfd = fs.openSync(full, nodeFsConstants.O_RDONLY);\n } else {\n realfd = fs.openSync(full, noflags);\n }\n const newfd = this.getUnusedFileDescriptor();\n this.FD_MAP.set(newfd, {\n real: realfd,\n filetype: void 0,\n rights: {\n base: neededBase,\n inheriting: neededInheriting,\n },\n path: full,\n });\n stat(this, newfd);\n this.view.setUint32(fdPtr, newfd, true);\n } catch (e) {\n console.error(e);\n }\n return constants_1.WASI_ESUCCESS;\n },\n ),\n path_readlink: wrap((fd, pathPtr, pathLen, buf, bufLen, bufused) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_READLINK);\n if (!stats.path) {\n return constants_1.WASI_EINVAL;\n }\n this.refreshMemory();\n const p = Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n const full = path.resolve(stats.path, p);\n const r = fs.readlinkSync(full);\n const used = Buffer.from(this.memory.buffer).write(r, buf, bufLen);\n this.view.setUint32(bufused, used, true);\n return constants_1.WASI_ESUCCESS;\n }),\n path_remove_directory: wrap((fd, pathPtr, pathLen) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_REMOVE_DIRECTORY);\n if (!stats.path) {\n return constants_1.WASI_EINVAL;\n }\n this.refreshMemory();\n const p = Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n fs.rmdirSync(path.resolve(stats.path, p));\n return constants_1.WASI_ESUCCESS;\n }),\n path_rename: wrap((oldFd, oldPath, oldPathLen, newFd, newPath, newPathLen) => {\n const ostats = CHECK_FD(oldFd, constants_1.WASI_RIGHT_PATH_RENAME_SOURCE);\n const nstats = CHECK_FD(newFd, constants_1.WASI_RIGHT_PATH_RENAME_TARGET);\n if (!ostats.path || !nstats.path) {\n return constants_1.WASI_EINVAL;\n }\n this.refreshMemory();\n const op = Buffer.from(this.memory.buffer, oldPath, oldPathLen).toString();\n const np = Buffer.from(this.memory.buffer, newPath, newPathLen).toString();\n fs.renameSync(path.resolve(ostats.path, op), path.resolve(nstats.path, np));\n return constants_1.WASI_ESUCCESS;\n }),\n path_symlink: wrap((oldPath, oldPathLen, fd, newPath, newPathLen) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_SYMLINK);\n if (!stats.path) {\n return constants_1.WASI_EINVAL;\n }\n this.refreshMemory();\n const op = Buffer.from(this.memory.buffer, oldPath, oldPathLen).toString();\n const np = Buffer.from(this.memory.buffer, newPath, newPathLen).toString();\n fs.symlinkSync(op, path.resolve(stats.path, np));\n return constants_1.WASI_ESUCCESS;\n }),\n path_unlink_file: wrap((fd, pathPtr, pathLen) => {\n const stats = CHECK_FD(fd, constants_1.WASI_RIGHT_PATH_UNLINK_FILE);\n if (!stats.path) {\n return constants_1.WASI_EINVAL;\n }\n this.refreshMemory();\n const p = Buffer.from(this.memory.buffer, pathPtr, pathLen).toString();\n fs.unlinkSync(path.resolve(stats.path, p));\n return constants_1.WASI_ESUCCESS;\n }),\n poll_oneoff: (sin, sout, nsubscriptions, neventsPtr) => {\n let nevents = 0;\n let name = \"\";\n let waitTimeNs = BigInt(0);\n let fd = -1;\n let fd_type = \"read\";\n let fd_timeout_ms = 0;\n const startNs = BigInt(bindings.hrtime());\n this.refreshMemory();\n let last_sin = sin;\n for (let i = 0; i < nsubscriptions; i += 1) {\n const userdata = this.view.getBigUint64(sin, true);\n sin += 8;\n const type = this.view.getUint8(sin);\n sin += 1;\n sin += 7;\n if (log.enabled) {\n if (type == constants_1.WASI_EVENTTYPE_CLOCK) {\n name = \"poll_oneoff (type=WASI_EVENTTYPE_CLOCK): \";\n } else if (type == constants_1.WASI_EVENTTYPE_FD_READ) {\n name = \"poll_oneoff (type=WASI_EVENTTYPE_FD_READ): \";\n } else {\n name = \"poll_oneoff (type=WASI_EVENTTYPE_FD_WRITE): \";\n }\n log(name);\n }\n switch (type) {\n case constants_1.WASI_EVENTTYPE_CLOCK: {\n const clockid = this.view.getUint32(sin, true);\n sin += 4;\n sin += 4;\n const timeout = this.view.getBigUint64(sin, true);\n sin += 8;\n sin += 8;\n const subclockflags = this.view.getUint16(sin, true);\n sin += 2;\n sin += 6;\n const absolute = subclockflags === 1;\n if (log.enabled) {\n log(name, { clockid, timeout, absolute });\n }\n if (!absolute) {\n fd_timeout_ms = timeout / BigInt(1e6);\n }\n let e = constants_1.WASI_ESUCCESS;\n const t = now(clockid);\n if (t == null) {\n e = constants_1.WASI_EINVAL;\n } else {\n const tNS = BigInt(t);\n const end = absolute ? timeout : tNS + timeout;\n const waitNs = end - tNS;\n if (waitNs > waitTimeNs) {\n waitTimeNs = waitNs;\n }\n }\n this.view.setBigUint64(sout, userdata, true);\n sout += 8;\n this.view.setUint16(sout, e, true);\n sout += 2;\n this.view.setUint8(sout, constants_1.WASI_EVENTTYPE_CLOCK);\n sout += 1;\n sout += 5;\n nevents += 1;\n break;\n }\n case constants_1.WASI_EVENTTYPE_FD_READ:\n case constants_1.WASI_EVENTTYPE_FD_WRITE: {\n fd = this.view.getUint32(sin, true);\n fd_type = type == constants_1.WASI_EVENTTYPE_FD_READ ? \"read\" : \"write\";\n sin += 4;\n log(name, \"fd =\", fd);\n sin += 28;\n this.view.setBigUint64(sout, userdata, true);\n sout += 8;\n this.view.setUint16(sout, constants_1.WASI_ENOSYS, true);\n sout += 2;\n this.view.setUint8(sout, type);\n sout += 1;\n sout += 5;\n nevents += 1;\n if (fd == constants_1.WASI_STDIN_FILENO && constants_1.WASI_EVENTTYPE_FD_READ == type) {\n this.shortPause();\n }\n break;\n }\n default:\n return constants_1.WASI_EINVAL;\n }\n if (sin - last_sin != 48) {\n console.warn(\"*** BUG in wasi-js in poll_oneoff \", {\n i,\n sin,\n last_sin,\n diff: sin - last_sin,\n });\n }\n last_sin = sin;\n }\n this.view.setUint32(neventsPtr, nevents, true);\n if (nevents == 2 && fd >= 0) {\n const r = this.wasiImport.sock_pollSocket(fd, fd_type, fd_timeout_ms);\n if (r != constants_1.WASI_ENOSYS) {\n return r;\n }\n }\n if (waitTimeNs > 0) {\n waitTimeNs -= Bun.nanoseconds() - timeOrigin;\n if (waitTimeNs >= 1e6) {\n if (this.sleep == null && !warnedAboutSleep) {\n warnedAboutSleep = true;\n console.log(\"(100% cpu burning waiting for stdin: please define a way to sleep!) \");\n }\n if (this.sleep != null) {\n const ms = nsToMs(waitTimeNs);\n this.sleep(ms);\n } else {\n const end = BigInt(bindings.hrtime()) + waitTimeNs;\n while (BigInt(bindings.hrtime()) < end) {}\n }\n }\n }\n return constants_1.WASI_ESUCCESS;\n },\n proc_exit: rval => {\n bindings.exit(rval);\n return constants_1.WASI_ESUCCESS;\n },\n proc_raise: sig => {\n if (!(sig in constants_1.SIGNAL_MAP)) {\n return constants_1.WASI_EINVAL;\n }\n bindings.kill(constants_1.SIGNAL_MAP[sig]);\n return constants_1.WASI_ESUCCESS;\n },\n random_get: (bufPtr, bufLen) => {\n this.refreshMemory();\n crypto.getRandomValues(this.memory.buffer, bufPtr, bufLen);\n return bufLen;\n },\n sched_yield() {\n return constants_1.WASI_ESUCCESS;\n },\n sock_recv() {\n return constants_1.WASI_ENOSYS;\n },\n sock_send() {\n return constants_1.WASI_ENOSYS;\n },\n sock_shutdown() {\n return constants_1.WASI_ENOSYS;\n },\n sock_fcntlSetFlags(_fd, _flags) {\n return constants_1.WASI_ENOSYS;\n },\n sock_pollSocket(_fd, _eventtype, _timeout_ms) {\n return constants_1.WASI_ENOSYS;\n },\n };\n if (log.enabled) {\n Object.keys(this.wasiImport).forEach(key => {\n const prevImport = this.wasiImport[key];\n this.wasiImport[key] = function (...args2) {\n log(key, args2);\n try {\n let result = prevImport(...args2);\n log(\"result\", result);\n return result;\n } catch (e) {\n log(\"error: \", e);\n throw e;\n }\n };\n });\n }\n }\n getState() {\n return { env: this.env, FD_MAP: this.FD_MAP, bindings: bindings };\n }\n setState(state) {\n this.env = state.env;\n this.FD_MAP = state.FD_MAP;\n bindings = state.bindings;\n }\n fstatSync(real_fd) {\n if (real_fd <= 2) {\n try {\n return fs.fstatSync(real_fd);\n } catch (_) {\n const now = new Date();\n return {\n dev: 0,\n mode: 8592,\n nlink: 1,\n uid: 0,\n gid: 0,\n rdev: 0,\n blksize: 65536,\n ino: 0,\n size: 0,\n blocks: 0,\n atimeMs: now.valueOf(),\n mtimeMs: now.valueOf(),\n ctimeMs: now.valueOf(),\n birthtimeMs: 0,\n atime: new Date(),\n mtime: new Date(),\n ctime: new Date(),\n birthtime: new Date(0),\n };\n }\n }\n return fs.fstatSync(real_fd);\n }\n shortPause() {\n if (this.sleep == null) return;\n const now = new Date().valueOf();\n if (now - this.lastStdin > 2e3) {\n this.sleep(50);\n }\n }\n getUnusedFileDescriptor(start = 3) {\n let fd = start;\n while (this.FD_MAP.has(fd)) {\n fd += 1;\n }\n if (fd > SC_OPEN_MAX) {\n throw Error(\"no available file descriptors\");\n }\n return fd;\n }\n refreshMemory() {\n if (!this.view || this.view.buffer.byteLength === 0) {\n this.view = new DataView(this.memory.buffer);\n }\n }\n setMemory(memory) {\n this.memory = memory;\n }\n start(instance, memory) {\n const exports2 = instance.exports;\n if (exports2 === null || typeof exports2 !== \"object\") {\n throw new Error(`instance.exports must be an Object. Received ${exports2}.`);\n }\n if (memory == null) {\n memory = exports2.memory;\n if (!(memory instanceof WebAssembly.Memory)) {\n throw new Error(`instance.exports.memory must be a WebAssembly.Memory. Recceived ${memory}.`);\n }\n }\n this.setMemory(memory);\n if (exports2._start) {\n exports2._start();\n }\n }\n getImports(module2) {\n let namespace = null;\n const imports = WebAssembly.Module.imports(module2);\n\n for (let imp of imports) {\n if (imp.kind !== \"function\") {\n continue;\n }\n if (!imp.module.startsWith(\"wasi_\")) {\n continue;\n }\n\n namespace = imp.module;\n break;\n }\n\n switch (namespace) {\n case \"wasi_unstable\":\n return {\n wasi_unstable: this.wasiImport,\n };\n case \"wasi_snapshot_preview1\":\n return {\n wasi_snapshot_preview1: this.wasiImport,\n };\n default: {\n throw new Error(\n \"No WASI namespace found. Only wasi_unstable and wasi_snapshot_preview1 are supported.\\n\\nList of imports:\\n\\n\" +\n imports.map(({ name, kind, module }) => `${module}:${name} (${kind})`).join(\"\\n\") +\n \"\\n\",\n );\n }\n }\n }\n initWasiFdInfo() {\n if (this.env[\"WASI_FD_INFO\"] != null) {\n const fdInfo = JSON.parse(this.env[\"WASI_FD_INFO\"]);\n for (const wasi_fd in fdInfo) {\n console.log(wasi_fd);\n const fd = parseInt(wasi_fd);\n if (this.FD_MAP.has(fd)) {\n continue;\n }\n const real = fdInfo[wasi_fd];\n try {\n this.fstatSync(real);\n } catch (_err) {\n console.log(\"discarding \", { wasi_fd, real });\n continue;\n }\n const file = {\n real,\n filetype: constants_1.WASI_FILETYPE_SOCKET_STREAM,\n rights: {\n base: STDIN_DEFAULT_RIGHTS,\n inheriting: BigInt(0),\n },\n };\n this.FD_MAP.set(fd, file);\n }\n console.log(\"after initWasiFdInfo: \", this.FD_MAP);\n console.log(\"fdInfo = \", fdInfo);\n } else {\n console.log(\"no WASI_FD_INFO\");\n }\n }\n };\n exports.default = WASI;\n },\n});\nconst WASIExport = require_wasi();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