var __bare_os_bundle_exports__ = (() => { var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) { if (typeof require !== "undefined") return require.apply(this, arguments); throw Error('Dynamic require of "' + x + '" is not supported'); }); var __commonJS = (cb, mod) => function __require2() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // ../../node_modules/bare-semver/lib/constants.js var require_constants = __commonJS({ "../../node_modules/bare-semver/lib/constants.js"(exports, module) { module.exports = { EQ: 1, LT: 2, LTE: 3, GT: 4, GTE: 5 }; } }); // ../../node_modules/bare-semver/lib/errors.js var require_errors = __commonJS({ "../../node_modules/bare-semver/lib/errors.js"(exports, module) { module.exports = class SemVerError extends Error { constructor(msg, code, fn = SemVerError) { super(`${code}: ${msg}`); this.code = code; if (Error.captureStackTrace) { Error.captureStackTrace(this, fn); } } get name() { return "SemVerError"; } static INVALID_VERSION(msg, fn = SemVerError.INVALID_VERSION) { return new SemVerError(msg, "INVALID_VERSION", fn); } static INVALID_RANGE(msg, fn = SemVerError.INVALID_RANGE) { return new SemVerError(msg, "INVALID_RANGE", fn); } }; } }); // ../../node_modules/bare-semver/lib/version.js var require_version = __commonJS({ "../../node_modules/bare-semver/lib/version.js"(exports, module) { var errors = require_errors(); var Version = class { constructor(major, minor, patch, opts = {}) { const { prerelease = [], build = [] } = opts; this.major = major; this.minor = minor; this.patch = patch; this.prerelease = prerelease; this.build = build; } compare(version) { return exports.compare(this, version); } toString() { let result = `${this.major}.${this.minor}.${this.patch}`; if (this.prerelease.length) { result += "-" + this.prerelease.join("."); } if (this.build.length) { result += "+" + this.build.join("."); } return result; } }; module.exports = exports = Version; exports.parse = function parse(input, state = { position: 0, partial: false, range: false }) { let i = state.position; let c; const unexpected = (expected) => { let msg; if (i >= input.length) { msg = `Unexpected end of input in '${input}'`; } else { msg = `Unexpected token '${input[i]}' in '${input}' at position ${i}`; } if (expected) msg += `, ${expected}`; throw errors.INVALID_VERSION(msg, unexpected); }; const components = [0, 0, 0]; let k = 0; while (k < 3) { c = input[i]; if (k > 0) { if (c === ".") c = input[++i]; else if (state.range) break; else unexpected("expected '.'"); } if (c === "0") { i++; k++; } else if (c >= "1" && c <= "9") { let j = 0; do c = input[i + ++j]; while (c >= "0" && c <= "9"); components[k++] = parseInt(input.substring(i, i + j)); i += j; } else unexpected("expected /[0-9]/"); } const prerelease = []; if (k === 3 && input[i] === "-") { i++; while (true) { c = input[i]; let tag = ""; let j = 0; while (c >= "0" && c <= "9") c = input[i + ++j]; let isNumeric = false; if (j) { tag += input.substring(i, i + j); c = input[i += j]; isNumeric = tag[0] !== "0" || tag.length === 1; } j = 0; while (c >= "0" && c <= "9" || c >= "a" && c <= "z" || c >= "A" && c <= "Z" || c === "-") c = input[i + ++j]; if (j) { tag += input.substring(i, i + j); c = input[i += j]; } else if (!isNumeric) unexpected("expected /[a-zA-Z-]/"); prerelease.push(tag); if (c === ".") c = input[++i]; else break; } } const build = []; if (k === 3 && input[i] === "+") { i++; while (true) { c = input[i]; let tag = ""; let j = 0; while (c >= "0" && c <= "9" || c >= "a" && c <= "z" || c >= "A" && c <= "Z" || c === "-") c = input[i + ++j]; if (j) { tag += input.substring(i, i + j); c = input[i += j]; } else unexpected("expected /[0-9a-zA-Z-]/"); build.push(tag); if (c === ".") c = input[++i]; else break; } } if (i < input.length && state.partial === false) { unexpected("expected end of input"); } state.position = i; return new Version(...components, { prerelease, build }); }; var integer = /^[0-9]+$/; exports.compare = function compare(a, b) { if (a.major > b.major) return 1; if (a.major < b.major) return -1; if (a.minor > b.minor) return 1; if (a.minor < b.minor) return -1; if (a.patch > b.patch) return 1; if (a.patch < b.patch) return -1; if (a.prerelease.length === 0) return b.prerelease.length === 0 ? 0 : 1; if (b.prerelease.length === 0) return -1; let i = 0; do { let x = a.prerelease[i]; let y = b.prerelease[i]; if (x === void 0) return y === void 0 ? 0 : -1; if (y === void 0) return 1; if (x === y) continue; const xInt = integer.test(x); const yInt = integer.test(y); if (xInt && yInt) { x = +x; y = +y; } else { if (xInt) return -1; if (yInt) return 1; } return x > y ? 1 : -1; } while (++i); }; } }); // ../../node_modules/bare-semver/lib/comparator.js var require_comparator = __commonJS({ "../../node_modules/bare-semver/lib/comparator.js"(exports, module) { var constants = require_constants(); var symbols = { [constants.EQ]: "=", [constants.LT]: "<", [constants.LTE]: "<=", [constants.GT]: ">", [constants.GTE]: ">=" }; module.exports = class Comparator { constructor(operator, version) { this.operator = operator; this.version = version; } test(version) { const result = version.compare(this.version); switch (this.operator) { case constants.LT: return result < 0; case constants.LTE: return result <= 0; case constants.GT: return result > 0; case constants.GTE: return result >= 0; default: return result === 0; } } toString() { return symbols[this.operator] + this.version; } }; } }); // ../../node_modules/bare-semver/lib/range.js var require_range = __commonJS({ "../../node_modules/bare-semver/lib/range.js"(exports, module) { var constants = require_constants(); var errors = require_errors(); var Version = require_version(); var Comparator = require_comparator(); var Range = class { constructor(comparators = []) { this.comparators = comparators; } test(version) { for (const set of this.comparators) { let matches = true; for (const comparator of set) { if (comparator.test(version)) continue; matches = false; break; } if (matches) return true; } return false; } toString() { let result = ""; let first = true; for (const set of this.comparators) { if (first) first = false; else result += " || "; result += set.join(" "); } return result; } }; module.exports = exports = Range; exports.parse = function parse(input, state = { position: 0, partial: false }) { let i = state.position; let c; const unexpected = (expected) => { let msg; if (i >= input.length) { msg = `Unexpected end of input in '${input}'`; } else { msg = `Unexpected token '${input[i]}' in '${input}' at position ${i}`; } if (expected) msg += `, ${expected}`; throw errors.INVALID_VERSION(msg, unexpected); }; const comparators = []; while (i < input.length) { const set = []; while (i < input.length) { c = input[i]; let operator = constants.EQ; if (c === "<") { operator = constants.LT; c = input[++i]; if (c === "=") { operator = constants.LTE; c = input[++i]; } } else if (c === ">") { operator = constants.GT; c = input[++i]; if (c === "=") { operator = constants.GTE; c = input[++i]; } } else if (c === "=") { c = input[++i]; } const state2 = { position: i, partial: true, range: true }; set.push(new Comparator(operator, Version.parse(input, state2))); c = input[i = state2.position]; while (c === " ") c = input[++i]; if (c === "|" && input[i + 1] === "|") { c = input[i += 2]; while (c === " ") c = input[++i]; break; } if (c && c !== "<" && c !== ">") unexpected("expected '||', '<', or '>'"); } if (set.length) comparators.push(set); } if (i < input.length && state.partial === false) { unexpected("expected end of input"); } state.position = i; return new Range(comparators); }; } }); // ../../node_modules/bare-semver/index.js var require_bare_semver = __commonJS({ "../../node_modules/bare-semver/index.js"(exports) { exports.constants = require_constants(); exports.errors = require_errors(); var Version = exports.Version = require_version(); var Range = exports.Range = require_range(); exports.Comparator = require_comparator(); exports.satisfies = function satisfies(version, range) { if (typeof version === "string") version = Version.parse(version); if (typeof range === "string") range = Range.parse(range); return range.test(version); }; } }); // ../../node_modules/bare-module-resolve/lib/errors.js var require_errors2 = __commonJS({ "../../node_modules/bare-module-resolve/lib/errors.js"(exports, module) { module.exports = class ModuleResolveError extends Error { constructor(msg, code, fn = ModuleResolveError) { super(`${code}: ${msg}`); this.code = code; if (Error.captureStackTrace) { Error.captureStackTrace(this, fn); } } get name() { return "ModuleResolveError"; } static INVALID_MODULE_SPECIFIER(msg) { return new ModuleResolveError( msg, "INVALID_MODULE_SPECIFIER", ModuleResolveError.INVALID_MODULE_SPECIFIER ); } static INVALID_PACKAGE_TARGET(msg) { return new ModuleResolveError( msg, "INVALID_PACKAGE_TARGET", ModuleResolveError.INVALID_PACKAGE_TARGET ); } static PACKAGE_PATH_NOT_EXPORTED(msg) { return new ModuleResolveError( msg, "PACKAGE_PATH_NOT_EXPORTED", ModuleResolveError.PACKAGE_PATH_NOT_EXPORTED ); } static PACKAGE_IMPORT_NOT_DEFINED(msg) { return new ModuleResolveError( msg, "PACKAGE_IMPORT_NOT_DEFINED", ModuleResolveError.PACKAGE_IMPORT_NOT_DEFINED ); } static UNSUPPORTED_ENGINE(msg) { return new ModuleResolveError(msg, "UNSUPPORTED_ENGINE", ModuleResolveError.UNSUPPORTED_ENGINE); } }; } }); // ../../node_modules/bare-module-resolve/index.js var require_bare_module_resolve = __commonJS({ "../../node_modules/bare-module-resolve/index.js"(exports, module) { var { satisfies } = require_bare_semver(); var errors = require_errors2(); module.exports = exports = function resolve(specifier, parentURL, opts, readPackage) { if (typeof opts === "function") { readPackage = opts; opts = {}; } else if (typeof readPackage !== "function") { readPackage = defaultReadPackage; } return { *[Symbol.iterator]() { const generator = exports.module(specifier, parentURL, opts); let next = generator.next(); while (next.done !== true) { const value = next.value; if (value.package) { next = generator.next(readPackage(value.package)); } else { next = generator.next(yield value.resolution); } } return next.value; }, async *[Symbol.asyncIterator]() { const generator = exports.module(specifier, parentURL, opts); let next = generator.next(); while (next.done !== true) { const value = next.value; if (value.package) { next = generator.next(await readPackage(value.package)); } else { next = generator.next(yield value.resolution); } } return next.value; } }; }; function defaultReadPackage() { return null; } var UNRESOLVED = 0; var YIELDED = 1; var RESOLVED = YIELDED | 2; exports.constants = { UNRESOLVED, YIELDED, RESOLVED }; exports.module = function* (specifier, parentURL, opts = {}) { const { resolutions = null, imports = null } = opts; if (exports.startsWithWindowsDriveLetter(specifier)) { specifier = "/" + specifier; } let status; if (resolutions) { status = yield* exports.preresolved(specifier, resolutions, parentURL, opts); if (status) return status; } status = yield* exports.url(specifier, parentURL, opts); if (status) return status; status = yield* exports.packageImports(specifier, parentURL, opts); if (status) return status; if (specifier === "." || specifier === ".." || specifier[0] === "/" || specifier[0] === "\\" || specifier.startsWith("./") || specifier.startsWith(".\\") || specifier.startsWith("../") || specifier.startsWith("..\\")) { if (imports) { status = yield* exports.packageImportsExports(specifier, imports, parentURL, true, opts); if (status) return status; } status = yield* exports.deferred(specifier, opts); if (status) return status; status = yield* exports.file(specifier, parentURL, false, opts); if (status === RESOLVED) return status; return yield* exports.directory(specifier, parentURL, opts); } return yield* exports.package(specifier, parentURL, opts); }; exports.url = function* (url, parentURL, opts = {}) { const { imports = null, deferredProtocol = "deferred:", resolutions = null } = opts; let resolution; try { resolution = new URL(url); } catch { return UNRESOLVED; } if (imports) { const status = yield* exports.packageImportsExports( resolution.href, imports, parentURL, true, opts ); if (status) return status; } if (resolution.protocol === deferredProtocol) { const specifier = resolution.pathname; if (resolutions) { const imports2 = resolutions[parentURL.href]; if (typeof imports2 === "object" && imports2 !== null) { opts = { ...opts, resolutions: { ...resolutions, [parentURL.href]: { ...imports2, [specifier]: null } } }; } } return yield* exports.module(specifier, parentURL, opts); } if (resolution.protocol === "node:") { const specifier = resolution.pathname; if (specifier === "." || specifier === ".." || specifier[0] === "/" || specifier.startsWith("./") || specifier.startsWith("../")) { throw errors.INVALID_MODULE_SPECIFIER(`Module specifier '${url}' is not a valid package name`); } return yield* exports.package(specifier, parentURL, opts); } const resolved = yield { resolution }; return resolved ? RESOLVED : YIELDED; }; exports.preresolved = function* (specifier, resolutions, parentURL, opts = {}) { const imports = resolutions[parentURL.href]; if (typeof imports === "object" && imports !== null) { return yield* exports.packageImportsExports(specifier, imports, parentURL, true, opts); } return UNRESOLVED; }; exports.deferred = function* (specifier, opts = {}) { const { deferredProtocol = "deferred:", defer = [] } = opts; if (defer.includes(specifier)) { const resolved = yield { resolution: new URL(deferredProtocol + specifier) }; return resolved ? RESOLVED : YIELDED; } return UNRESOLVED; }; exports.package = function* (packageSpecifier, parentURL, opts = {}) { const { builtins = [] } = opts; if (packageSpecifier === "") { throw errors.INVALID_MODULE_SPECIFIER( `Module specifier '${packageSpecifier}' is not a valid package name` ); } let packageName; if (packageSpecifier[0] !== "@") { packageName = packageSpecifier.split("/", 1).join(); } else { if (!packageSpecifier.includes("/")) { throw errors.INVALID_MODULE_SPECIFIER( `Module specifier '${packageSpecifier}' is not a valid package name` ); } packageName = packageSpecifier.split("/", 2).join("/"); } if (packageName[0] === "." || packageName.includes("\\") || packageName.includes("%")) { throw errors.INVALID_MODULE_SPECIFIER( `Module specifier '${packageSpecifier}' is not a valid package name` ); } let status; status = yield* exports.builtinTarget(packageSpecifier, null, builtins, opts); if (status) return status; status = yield* exports.deferred(packageSpecifier, opts); if (status) return status; let packageSubpath = "." + packageSpecifier.substring(packageName.length); status = yield* exports.packageSelf(packageName, packageSubpath, parentURL, opts); if (status) return status; parentURL = new URL(parentURL.href); for (const packageURL of exports.lookupPackageRoot(packageName, parentURL)) { const info = yield { package: packageURL }; if (info) { if (info.engines) exports.validateEngines(packageURL, info.engines, opts); if (info.exports) { return yield* exports.packageExports(packageURL, packageSubpath, info.exports, opts); } if (packageSubpath === ".") { if (typeof info.main === "string" && info.main !== "") { packageSubpath = info.main; } else { return yield* exports.file("index", packageURL, true, opts); } } status = yield* exports.file(packageSubpath, packageURL, false, opts); if (status === RESOLVED) return status; return yield* exports.directory(packageSubpath, packageURL, opts); } } return UNRESOLVED; }; exports.packageSelf = function* (packageName, packageSubpath, parentURL, opts = {}) { for (const packageURL of exports.lookupPackageScope(parentURL, opts)) { const info = yield { package: packageURL }; if (info) { if (info.name !== packageName) return false; if (info.exports) { return yield* exports.packageExports(packageURL, packageSubpath, info.exports, opts); } if (packageSubpath === ".") { if (typeof info.main === "string" && info.main !== "") { packageSubpath = info.main; } else { return yield* exports.file("index", packageURL, true, opts); } } const status = yield* exports.file(packageSubpath, packageURL, false, opts); if (status === RESOLVED) return status; return yield* exports.directory(packageSubpath, packageURL, opts); } } return UNRESOLVED; }; exports.packageExports = function* (packageURL, subpath, packageExports, opts = {}) { if (subpath === ".") { let mainExport; if (typeof packageExports === "string" || Array.isArray(packageExports)) { mainExport = packageExports; } else if (typeof packageExports === "object" && packageExports !== null) { const keys = Object.keys(packageExports); if (keys.some((key) => key.startsWith("."))) { if ("." in packageExports) mainExport = packageExports["."]; } else { mainExport = packageExports; } } if (mainExport) { const status = yield* exports.packageTarget(packageURL, mainExport, null, false, opts); if (status) return status; } } else if (typeof packageExports === "object" && packageExports !== null) { const keys = Object.keys(packageExports); if (keys.every((key) => key.startsWith("."))) { const status = yield* exports.packageImportsExports( subpath, packageExports, packageURL, false, opts ); if (status) return status; } } throw errors.PACKAGE_PATH_NOT_EXPORTED( `Package subpath '${subpath}' is not defined by "exports" in '${packageURL}'` ); }; exports.packageImports = function* (specifier, parentURL, opts = {}) { const { imports = null } = opts; if (specifier === "#" || specifier.startsWith("#/")) { throw errors.INVALID_MODULE_SPECIFIER( `Module specifier '${specifier}' is not a valid internal imports specifier` ); } for (const packageURL of exports.lookupPackageScope(parentURL, opts)) { const info = yield { package: packageURL }; if (info) { if (info.imports) { const status = yield* exports.packageImportsExports( specifier, info.imports, packageURL, true, opts ); if (status) return status; } if (specifier.startsWith("#")) { throw errors.PACKAGE_IMPORT_NOT_DEFINED( `Package import specifier '${specifier}' is not defined by "imports" in '${packageURL}'` ); } break; } } if (imports) { const status = yield* exports.packageImportsExports(specifier, imports, parentURL, true, opts); if (status) return status; } return UNRESOLVED; }; exports.packageImportsExports = function* (matchKey, matchObject, packageURL, isImports, opts = {}) { if (matchKey in matchObject && !matchKey.includes("*")) { const target = matchObject[matchKey]; return yield* exports.packageTarget(packageURL, target, null, isImports, opts); } const expansionKeys = Object.keys(matchObject).filter((key) => key.includes("*")).sort(exports.patternKeyCompare); for (const expansionKey of expansionKeys) { const patternIndex = expansionKey.indexOf("*"); const patternBase = expansionKey.substring(0, patternIndex); if (matchKey.startsWith(patternBase) && matchKey !== patternBase) { const patternTrailer = expansionKey.substring(patternIndex + 1); if (patternTrailer === "" || matchKey.endsWith(patternTrailer) && matchKey.length >= expansionKey.length) { const target = matchObject[expansionKey]; const patternMatch = matchKey.substring( patternBase.length, matchKey.length - patternTrailer.length ); return yield* exports.packageTarget(packageURL, target, patternMatch, isImports, opts); } } } return UNRESOLVED; }; exports.validateEngines = function validateEngines(packageURL, packageEngines, opts = {}) { const { engines = {} } = opts; for (const [engine, range] of Object.entries(packageEngines)) { if (engine in engines) { const version = engines[engine]; if (!satisfies(version, range)) { throw errors.UNSUPPORTED_ENGINE( `Package not compatible with engine '${engine}' ${version}, requires range '${range}' defined by "engines" in '${packageURL}'` ); } } } }; exports.patternKeyCompare = function patternKeyCompare(keyA, keyB) { const patternIndexA = keyA.indexOf("*"); const patternIndexB = keyB.indexOf("*"); const baseLengthA = patternIndexA === -1 ? keyA.length : patternIndexA + 1; const baseLengthB = patternIndexB === -1 ? keyB.length : patternIndexB + 1; if (baseLengthA > baseLengthB) return -1; if (baseLengthB > baseLengthA) return 1; if (patternIndexA === -1) return 1; if (patternIndexB === -1) return -1; if (keyA.length > keyB.length) return -1; if (keyB.length > keyA.length) return 1; return 0; }; exports.packageTarget = function* (packageURL, target, patternMatch, isImports, opts = {}) { const { conditions = [], matchedConditions = [] } = opts; if (typeof target === "string") { if (!target.startsWith("./") && !isImports) { throw errors.INVALID_PACKAGE_TARGET( `Invalid target '${target}' defined by "exports" in '${packageURL}'` ); } if (patternMatch !== null) { target = target.replaceAll("*", patternMatch); } const status = yield* exports.url(target, packageURL, opts); if (status) return status; if (target === "." || target === ".." || target[0] === "/" || target.startsWith("./") || target.startsWith("../")) { const resolved = yield { resolution: new URL(target, packageURL) }; return resolved ? RESOLVED : YIELDED; } return yield* exports.package(target, packageURL, opts); } if (Array.isArray(target)) { for (const targetValue of target) { const status = yield* exports.packageTarget( packageURL, targetValue, patternMatch, isImports, opts ); if (status) return status; } } else if (typeof target === "object" && target !== null) { let status = UNRESOLVED; for (const [condition, targetValue, subset] of exports.conditionMatches( target, conditions, opts )) { matchedConditions.push(condition); status |= yield* exports.packageTarget(packageURL, targetValue, patternMatch, isImports, { ...opts, conditions: subset }); matchedConditions.pop(); } if (status) return status; } return UNRESOLVED; }; exports.builtinTarget = function* (packageSpecifier, packageVersion, target, opts = {}) { const { builtinProtocol = "builtin:", conditions = [], matchedConditions = [] } = opts; if (typeof target === "string") { const targetParts = target.split("@"); let targetName; let targetVersion; if (target[0] !== "@") { targetName = targetParts[0]; targetVersion = targetParts[1] || null; } else { targetName = targetParts.slice(0, 2).join("@"); targetVersion = targetParts[2] || null; } if (packageSpecifier === targetName) { if (packageVersion === null && targetVersion === null) { const resolved = yield { resolution: new URL(builtinProtocol + packageSpecifier) }; return resolved ? RESOLVED : YIELDED; } let version = null; if (packageVersion === null) { version = targetVersion; } else if (targetVersion === null || packageVersion === targetVersion) { version = packageVersion; } if (version !== null) { const resolved = yield { resolution: new URL(builtinProtocol + packageSpecifier + "@" + version) }; return resolved ? RESOLVED : YIELDED; } } } else if (Array.isArray(target)) { for (const targetValue of target) { const status = yield* exports.builtinTarget( packageSpecifier, packageVersion, targetValue, opts ); if (status) return status; } } else if (typeof target === "object" && target !== null) { let status = UNRESOLVED; for (const [condition, targetValue, subset] of exports.conditionMatches( target, conditions, opts )) { matchedConditions.push(condition); status |= yield* exports.builtinTarget(packageSpecifier, packageVersion, targetValue, { ...opts, conditions: subset }); matchedConditions.pop(); } if (status) return status; } return UNRESOLVED; }; exports.conditionMatches = function* conditionMatches(target, conditions, opts = {}) { if (conditions.every((condition) => typeof condition === "string")) { const keys = Object.keys(target); for (const condition of keys) { if (condition === "default" || conditions.includes(condition)) { yield [condition, target[condition], conditions]; return true; } } return false; } let yielded = false; for (const subset of conditions) { if (yield* conditionMatches(target, subset, opts)) { yielded = true; } } return yielded; }; exports.lookupPackageRoot = function* (packageName, parentURL) { parentURL = new URL(parentURL.href); do { const packageURL = new URL("node_modules/" + packageName + "/", parentURL); const info = yield new URL("package.json", packageURL); if (info) return info; parentURL.pathname = parentURL.pathname.substring(0, parentURL.pathname.lastIndexOf("/")); if (parentURL.pathname.length === 3 && exports.isWindowsDriveLetter(parentURL.pathname.substring(1))) { break; } } while (parentURL.pathname !== "" && parentURL.pathname !== "/"); return null; }; exports.lookupPackageScope = function* lookupPackageScope(scopeURL, opts = {}) { const { resolutions = null } = opts; if (resolutions) { for (const { resolution } of exports.preresolved("#package", resolutions, scopeURL, opts)) { if (resolution) return yield resolution; } } scopeURL = new URL(scopeURL.href); do { if (scopeURL.pathname.endsWith("/node_modules")) break; const info = yield new URL("package.json", scopeURL); if (info) return info; scopeURL.pathname = scopeURL.pathname.substring(0, scopeURL.pathname.lastIndexOf("/")); if (scopeURL.pathname.length === 3 && exports.isWindowsDriveLetter(scopeURL.pathname.substring(1))) { break; } } while (scopeURL.pathname !== "" && scopeURL.pathname !== "/"); return null; }; exports.file = function* (filename, parentURL, isIndex, opts = {}) { if (filename === "." || filename === ".." || filename[filename.length - 1] === "/" || filename[filename.length - 1] === "\\") { return UNRESOLVED; } if (parentURL.protocol === "file:" && /%2f|%5c/i.test(filename)) { throw errors.INVALID_MODULE_SPECIFIER(`Module specifier '${filename}' is invalid`); } const { extensions = [] } = opts; let status = UNRESOLVED; if (!isIndex) { if (yield { resolution: new URL(filename, parentURL) }) { return RESOLVED; } status = YIELDED; } for (const ext of extensions) { if (filename.endsWith(ext)) continue; if (yield { resolution: new URL(filename + ext, parentURL) }) { return RESOLVED; } status = YIELDED; } return status; }; exports.directory = function* (dirname, parentURL, opts = {}) { let directoryURL; if (dirname[dirname.length - 1] === "/" || dirname[dirname.length - 1] === "\\") { directoryURL = new URL(dirname, parentURL); } else { directoryURL = new URL(dirname + "/", parentURL); } const info = yield { package: new URL("package.json", directoryURL) }; if (info) { if (info.exports) { return yield* exports.packageExports(directoryURL, ".", info.exports, opts); } if (typeof info.main === "string" && info.main !== "") { const status = yield* exports.file(info.main, directoryURL, false, opts); if (status === RESOLVED) return status; return yield* exports.directory(info.main, directoryURL, opts); } } return yield* exports.file("index", directoryURL, true, opts); }; function isASCIIUpperAlpha(c) { return c >= 65 && c <= 90; } function isASCIILowerAlpha(c) { return c >= 97 && c <= 122; } function isASCIIAlpha(c) { return isASCIIUpperAlpha(c) || isASCIILowerAlpha(c); } exports.isWindowsDriveLetter = function isWindowsDriveLetter(input) { return input.length >= 2 && isASCIIAlpha(input.charCodeAt(0)) && (input.charCodeAt(1) === 58 || input.charCodeAt(1) === 124); }; exports.startsWithWindowsDriveLetter = function startsWithWindowsDriveLetter(input) { return input.length >= 2 && exports.isWindowsDriveLetter(input) && (input.length === 2 || input.charCodeAt(2) === 47 || input.charCodeAt(2) === 92 || input.charCodeAt(2) === 63 || input.charCodeAt(2) === 35); }; } }); // ../../node_modules/bare-link/lib/fs.js var require_fs = __commonJS({ "../../node_modules/bare-link/lib/fs.js"(exports) { var path = __require("path"); var fs = __require("fs"); var os = __require("os"); exports.exists = async function exists(name) { return new Promise((resolve) => { fs.access(name, (err) => { resolve(err === null); }); }); }; exports.rm = async function rm(name) { return new Promise((resolve, reject) => { fs.rm(name, { force: true, recursive: true }, (err) => { err ? reject(err) : resolve(); }); }); }; exports.cp = async function cp(src, dest) { return new Promise((resolve, reject) => { fs.cp(src, dest, { force: true, recursive: true, verbatimSymlinks: true, filter }, (err) => { err ? reject(err) : resolve(); }); }); function filter(src2, dest2) { switch (path.basename(src2)) { case "node_modules": case "build": case "prebuilds": return false; } return true; } }; exports.copyFile = async function copyFile(src, dest) { return new Promise((resolve, reject) => { fs.copyFile(src, dest, (err) => { err ? reject(err) : resolve(); }); }); }; exports.writeFile = async function writeFile(name, data) { return new Promise((resolve, reject) => { fs.writeFile(name, data, (err) => { err ? reject(err) : resolve(); }); }); }; exports.readFile = async function readFile(name) { return new Promise((resolve, reject) => { fs.readFile(name, (err, data) => { err ? reject(err) : resolve(data); }); }); }; exports.symlink = async function symlink(target, path2) { return new Promise((resolve, reject) => { fs.symlink(target, path2, (err) => { err ? reject(err) : resolve(); }); }); }; exports.makeDir = async function makeDir(name) { return new Promise((resolve, reject) => { fs.mkdir(name, { recursive: true }, (err) => { err ? reject(err) : resolve(); }); }); }; exports.openDir = async function openDir(name) { return new Promise((resolve, reject) => { fs.opendir(name, (err, dir) => { err ? reject(err) : resolve(dir); }); }); }; exports.tempDir = async function tempDir() { const name = Math.random().toString(16).slice(2); return new Promise((resolve, reject) => { fs.realpath(os.tmpdir(), (err, dir) => { if (err) return reject(err); dir = path.join(dir, `bare-link-${name}`); fs.mkdir(dir, { recursive: true }, (err2) => { err2 ? reject(err2) : resolve(dir); }); }); }); }; } }); // ../../node_modules/bare-link/lib/dependencies.js var require_dependencies = __commonJS({ "../../node_modules/bare-link/lib/dependencies.js"(exports, module) { var { fileURLToPath, pathToFileURL } = __require("url"); var { lookupPackageRoot } = require_bare_module_resolve(); var fs = require_fs(); module.exports = async function* dependencies(base, pkg) { const dependencies2 = { ...pkg.dependencies, ...pkg.optionalDependencies, ...pkg.peerDependencies, ...pkg.bundleDependencies }; for (const dependency in dependencies2) { for (const packageURL of lookupPackageRoot(dependency, pathToFileURL(base + "/"))) { const pkg2 = await readPackage(packageURL); if (typeof pkg2 !== "object" || pkg2 === null) continue; const name = pkg2.name; if (typeof name !== "string" || name === "") break; const version = pkg2.version; if (typeof version !== "string" || version === "") break; yield { url: new URL(".", packageURL), pkg: pkg2, addon: pkg2.addon === true, name: name.replace(/\//g, "__").replace(/^@/, ""), version }; break; } } }; async function readPackage(url) { try { return JSON.parse(await fs.readFile(fileURLToPath(url))); } catch { return null; } } } }); // ../../node_modules/bare-link/lib/preset/android.js var require_android = __commonJS({ "../../node_modules/bare-link/lib/preset/android.js"(exports, module) { module.exports = { hosts: ["android-arm", "android-arm64", "android-ia32", "android-x64"] }; } }); // ../../node_modules/bare-link/lib/preset/apple.js var require_apple = __commonJS({ "../../node_modules/bare-link/lib/preset/apple.js"(exports, module) { module.exports = { hosts: ["darwin-arm64", "darwin-x64", "ios-arm64", "ios-arm64-simulator", "ios-x64-simulator"] }; } }); // ../../node_modules/bare-link/lib/preset/darwin.js var require_darwin = __commonJS({ "../../node_modules/bare-link/lib/preset/darwin.js"(exports, module) { module.exports = { hosts: ["darwin-arm64", "darwin-x64"] }; } }); // ../../node_modules/bare-link/lib/preset/desktop.js var require_desktop = __commonJS({ "../../node_modules/bare-link/lib/preset/desktop.js"(exports, module) { module.exports = { hosts: ["darwin-arm64", "darwin-x64", "linux-arm64", "linux-x64", "win32-arm64", "win32-x64"] }; } }); // ../../node_modules/bare-link/lib/preset/ios.js var require_ios = __commonJS({ "../../node_modules/bare-link/lib/preset/ios.js"(exports, module) { module.exports = { hosts: ["ios-arm64", "ios-arm64-simulator", "ios-x64-simulator"] }; } }); // ../../node_modules/bare-link/lib/preset/linux.js var require_linux = __commonJS({ "../../node_modules/bare-link/lib/preset/linux.js"(exports, module) { module.exports = { hosts: ["linux-arm64", "linux-x64"] }; } }); // ../../node_modules/bare-link/lib/preset/mobile.js var require_mobile = __commonJS({ "../../node_modules/bare-link/lib/preset/mobile.js"(exports, module) { module.exports = { hosts: [ "android-arm", "android-arm64", "android-ia32", "android-x64", "ios-arm64", "ios-arm64-simulator", "ios-x64-simulator" ] }; } }); // ../../node_modules/bare-link/lib/preset/win32.js var require_win32 = __commonJS({ "../../node_modules/bare-link/lib/preset/win32.js"(exports, module) { module.exports = { hosts: ["win32-arm64", "win32-x64"] }; } }); // ../../node_modules/bare-link/lib/preset.js var require_preset = __commonJS({ "../../node_modules/bare-link/lib/preset.js"(exports) { exports.android = require_android(); exports.apple = require_apple(); exports.darwin = require_darwin(); exports.desktop = require_desktop(); exports.ios = require_ios(); exports.linux = require_linux(); exports.mobile = require_mobile(); exports.win32 = require_win32(); } }); // ../../node_modules/bare-addon-resolve/lib/errors.js var require_errors3 = __commonJS({ "../../node_modules/bare-addon-resolve/lib/errors.js"(exports, module) { module.exports = class AddonResolveError extends Error { constructor(msg, code, fn = AddonResolveError) { super(`${code}: ${msg}`); this.code = code; if (Error.captureStackTrace) { Error.captureStackTrace(this, fn); } } get name() { return "AddonResolveError"; } static INVALID_ADDON_SPECIFIER(msg) { return new AddonResolveError( msg, "INVALID_ADDON_SPECIFIER", AddonResolveError.INVALID_ADDON_SPECIFIER ); } static INVALID_PACKAGE_NAME(msg) { return new AddonResolveError( msg, "INVALID_PACKAGE_NAME", AddonResolveError.INVALID_PACKAGE_NAME ); } }; } }); // ../../node_modules/bare-addon-resolve/index.js var require_bare_addon_resolve = __commonJS({ "../../node_modules/bare-addon-resolve/index.js"(exports, module) { var resolve = require_bare_module_resolve(); var { Version } = require_bare_semver(); var errors = require_errors3(); module.exports = exports = function resolve2(specifier, parentURL, opts, readPackage) { if (typeof opts === "function") { readPackage = opts; opts = {}; } else if (typeof readPackage !== "function") { readPackage = defaultReadPackage; } return { *[Symbol.iterator]() { const generator = exports.addon(specifier, parentURL, opts); let next = generator.next(); while (next.done !== true) { const value = next.value; if (value.package) { next = generator.next(readPackage(value.package)); } else { next = generator.next(yield value.resolution); } } return next.value; }, async *[Symbol.asyncIterator]() { const generator = exports.addon(specifier, parentURL, opts); let next = generator.next(); while (next.done !== true) { const value = next.value; if (value.package) { next = generator.next(await readPackage(value.package)); } else { next = generator.next(yield value.resolution); } } return next.value; } }; }; function defaultReadPackage() { return null; } var { UNRESOLVED, YIELDED, RESOLVED } = resolve.constants; exports.constants = { UNRESOLVED, YIELDED, RESOLVED }; exports.addon = function* (specifier, parentURL, opts = {}) { const { resolutions = null } = opts; if (exports.startsWithWindowsDriveLetter(specifier)) { specifier = "/" + specifier; } let status; if (resolutions) { status = yield* resolve.preresolved(specifier, resolutions, parentURL, opts); if (status) return status; } status = yield* exports.url(specifier, parentURL, opts); if (status) return status; let version = null; const i = specifier.lastIndexOf("@"); if (i > 0) { version = specifier.substring(i + 1); try { Version.parse(version); specifier = specifier.substring(0, i); } catch { version = null; } } if (specifier === "." || specifier === ".." || specifier[0] === "/" || specifier[0] === "\\" || specifier.startsWith("./") || specifier.startsWith(".\\") || specifier.startsWith("../") || specifier.startsWith("..\\")) { status = yield* exports.file(specifier, parentURL, opts); if (status === RESOLVED) return status; return yield* exports.directory(specifier, version, parentURL, opts); } return yield* exports.package(specifier, version, parentURL, opts); }; exports.url = function* (url, parentURL, opts = {}) { let resolution; try { resolution = new URL(url); } catch { return UNRESOLVED; } const resolved = yield { resolution }; return resolved ? RESOLVED : YIELDED; }; exports.package = function* (packageSpecifier, packageVersion, parentURL, opts = {}) { if (packageSpecifier === "") { throw errors.INVALID_ADDON_SPECIFIER( `Addon specifier '${packageSpecifier}' is not a valid package name` ); } let packageName; if (packageSpecifier[0] !== "@") { packageName = packageSpecifier.split("/", 1).join(); } else { if (!packageSpecifier.includes("/")) { throw errors.INVALID_ADDON_SPECIFIER( `Addon specifier '${packageSpecifier}' is not a valid package name` ); } packageName = packageSpecifier.split("/", 2).join("/"); } if (packageName[0] === "." || packageName.includes("\\") || packageName.includes("%")) { throw errors.INVALID_ADDON_SPECIFIER( `Addon specifier '${packageSpecifier}' is not a valid package name` ); } const packageSubpath = "." + packageSpecifier.substring(packageName.length); const status = yield* exports.packageSelf( packageName, packageSubpath, packageVersion, parentURL, opts ); if (status) return status; parentURL = new URL(parentURL.href); do { const packageURL = new URL("node_modules/" + packageName + "/", parentURL); parentURL.pathname = parentURL.pathname.substring(0, parentURL.pathname.lastIndexOf("/")); const info = yield { package: new URL("package.json", packageURL) }; if (info) { return yield* exports.directory(packageSubpath, packageVersion, packageURL, opts); } } while (parentURL.pathname !== "" && parentURL.pathname !== "/"); return UNRESOLVED; }; exports.packageSelf = function* (packageName, packageSubpath, packageVersion, parentURL, opts = {}) { for (const packageURL of resolve.lookupPackageScope(parentURL, opts)) { const info = yield { package: packageURL }; if (info) { if (info.name === packageName) { return yield* exports.directory(packageSubpath, packageVersion, packageURL, opts); } break; } } return UNRESOLVED; }; exports.lookupPrebuildsScope = function* lookupPrebuildsScope(url, opts = {}) { const scopeURL = new URL(url.href); do { yield new URL("prebuilds/", scopeURL); scopeURL.pathname = scopeURL.pathname.substring(0, scopeURL.pathname.lastIndexOf("/")); if (scopeURL.pathname.length === 3 && exports.isWindowsDriveLetter(scopeURL.pathname.substring(1))) { break; } } while (scopeURL.pathname !== "" && scopeURL.pathname !== "/"); }; exports.file = function* (filename, parentURL, opts = {}) { if (filename === "." || filename === ".." || filename[filename.length - 1] === "/" || filename[filename.length - 1] === "\\") { return UNRESOLVED; } if (parentURL.protocol === "file:" && /%2f|%5c/i.test(filename)) { throw errors.INVALID_ADDON_SPECIFIER(`Addon specifier '${filename}' is invalid`); } const { extensions = [] } = opts; let status = UNRESOLVED; for (let ext of extensions) { if (filename.endsWith(ext)) ext = ""; if (yield { resolution: new URL(filename + ext, parentURL) }) { return RESOLVED; } status = YIELDED; } return status; }; exports.directory = function* (dirname, version, parentURL, opts = {}) { const { host = null, // Shorthand for single host resolution hosts = host !== null ? [host] : [], builtins = [], matchedConditions = [] } = opts; let directoryURL; if (dirname[dirname.length - 1] === "/" || dirname[dirname.length - 1] === "\\") { directoryURL = new URL(dirname, parentURL); } else { directoryURL = new URL(dirname + "/", parentURL); } const unversioned = version === null; let name = null; const info = yield { package: new URL("package.json", directoryURL) }; if (info) { if (typeof info.name === "string" && info.name !== "") { if (info.name.includes("__")) { throw errors.INVALID_PACKAGE_NAME(`Package name '${info.name}' is invalid`); } name = info.name.replace(/\//g, "__").replace(/^@/, ""); } else { return UNRESOLVED; } if (typeof info.version === "string" && info.version !== "") { if (version !== null && info.version !== version) return UNRESOLVED; version = info.version; } } else { return UNRESOLVED; } let status; status = yield* resolve.builtinTarget(name, version, builtins, opts); if (status) return status; for (const prebuildsURL of exports.lookupPrebuildsScope(directoryURL, opts)) { status = UNRESOLVED; for (const host2 of hosts) { const conditions = host2.split("-"); const universal = supportsUniversalPrebuilds(host2) ? conditions.with(1, "universal").join("-") : null; matchedConditions.push(...conditions); if (version !== null) { status |= yield* exports.file(host2 + "/" + name + "@" + version, prebuildsURL, opts); if (universal) { status |= yield* exports.file(universal + "/" + name + "@" + version, prebuildsURL, opts); } } if (unversioned) { status |= yield* exports.file(host2 + "/" + name, prebuildsURL, opts); if (universal) { status |= yield* exports.file(universal + "/" + name, prebuildsURL, opts); } } for (const _ of conditions) matchedConditions.pop(); } if (status === RESOLVED) return status; } return yield* exports.linked(name, version, opts); }; exports.linked = function* (name, version = null, opts = {}) { const { linked = true, host = null, // Shorthand for single host resolution hosts = host !== null ? [host] : [], matchedConditions = [] } = opts; if (linked === false || hosts.length === 0) return UNRESOLVED; let status = UNRESOLVED; for (const host2 of hosts) { const [platform = null] = host2.split("-", 1); if (platform === null) continue; matchedConditions.push(platform); status |= yield* platformArtefact(name, version, platform, opts); matchedConditions.pop(); } return status; }; function* platformArtefact(name, version = null, platform, opts = {}) { const { linkedProtocol = "linked:" } = opts; if (platform === "darwin" || platform === "ios") { if (version !== null) { if (yield { resolution: new URL(`${linkedProtocol}${name}.${version}.framework/${name}.${version}`) }) { return RESOLVED; } if (platform === "darwin") { if (yield { resolution: new URL(`${linkedProtocol}lib${name}.${version}.dylib`) }) { return RESOLVED; } } } if (yield { resolution: new URL(`${linkedProtocol}${name}.framework/${name}`) }) { return RESOLVED; } if (platform === "darwin") { if (yield { resolution: new URL(`${linkedProtocol}lib${name}.dylib`) }) { return RESOLVED; } } return YIELDED; } if (platform === "linux" || platform === "android") { if (version !== null) { if (yield { resolution: new URL(`${linkedProtocol}lib${name}.${version}.so`) }) { return RESOLVED; } } if (yield { resolution: new URL(`${linkedProtocol}lib${name}.so`) }) { return RESOLVED; } return YIELDED; } if (platform === "win32") { if (version !== null) { if (yield { resolution: new URL(`${linkedProtocol}${name}-${version}.dll`) }) { return RESOLVED; } } if (yield { resolution: new URL(`${linkedProtocol}${name}.dll`) }) { return RESOLVED; } } return UNRESOLVED; } exports.isWindowsDriveLetter = resolve.isWindowsDriveLetter; exports.startsWithWindowsDriveLetter = resolve.startsWithWindowsDriveLetter; function supportsUniversalPrebuilds(host) { return host === "darwin-arm64" || host === "darwin-x64" || host === "ios-arm64-simulator" || host === "ios-x64-simulator"; } } }); // ../../node_modules/require-addon/lib/node.js var require_node = __commonJS({ "../../node_modules/require-addon/lib/node.js"(exports, module) { if (typeof __require.addon === "function") { module.exports = __require.addon.bind(__require); } else { let readPackage2 = function(packageURL) { try { return __require(url.fileURLToPath(packageURL)); } catch (err) { return null; } }, isAlpine2 = function() { return process.platform === "linux" && fs.existsSync("/etc/alpine-release"); }; readPackage = readPackage2, isAlpine = isAlpine2; const url = __require("url"); const fs = __require("fs"); const resolve = require_bare_addon_resolve(); let host = process.platform + "-" + process.arch; const conditions = ["addon", "node", process.platform, process.arch]; const extensions = [".node"]; if (isAlpine2()) { host += "-musl"; conditions.push("musl"); } module.exports = function addon(specifier, parentURL) { if (typeof parentURL === "string") parentURL = url.pathToFileURL(parentURL); const candidates = []; let cause; for (const resolution of resolve( specifier, parentURL, { host, conditions, extensions }, readPackage2 )) { candidates.push(resolution); switch (resolution.protocol) { case "file:": try { return __require(url.fileURLToPath(resolution)); } catch (err2) { cause = err2; continue; } } } let message = `Cannot find addon '${specifier}' imported from '${parentURL.href}'`; if (candidates.length > 0) { message += "\nCandidates:"; message += "\n" + candidates.map((url2) => "- " + url2.href).join("\n"); } const err = new Error(message, cause ? { cause } : {}); err.code = "ADDON_NOT_FOUND"; err.specifier = specifier; err.referrer = parentURL; err.candidates = candidates; throw err; }; } var readPackage; var isAlpine; } }); // ../../node_modules/bare-lief/lib/binding/node.js var require_node2 = __commonJS({ "../../node_modules/bare-lief/lib/binding/node.js"(exports, module) { __require.addon = require_node(); module.exports = __require.addon("../..", __filename); } }); // ../../node_modules/bare-lief/lib/macho/load-command.js var require_load_command = __commonJS({ "../../node_modules/bare-lief/lib/macho/load-command.js"(exports, module) { var assert = __require("assert"); var binding = require_node2(); module.exports = exports = class MachOLoadCommand { constructor(opts = {}) { const { handle } = opts; this._handle = handle; } get data() { assert(this._handle); return Buffer.from(binding.machOLoadCommandGetData(this._handle).buffer); } set data(value) { assert(this._handle); assert(Buffer.isBuffer(value)); binding.machOLoadCommandSetData(this._handle, value); } [Symbol.for("bare.inspect")]() { return { __proto__: { constructor: MachOLoadCommand }, data: this.data }; } }; exports.TYPE = { ID_DYLIB: binding.MACHO_LOAD_COMMAND_TYPE_ID_DYLIB, RPATH: binding.MACHO_LOAD_COMMAND_TYPE_RPATH }; } }); // ../../node_modules/bare-lief/lib/macho/dylib-command.js var require_dylib_command = __commonJS({ "../../node_modules/bare-lief/lib/macho/dylib-command.js"(exports, module) { var assert = __require("assert"); var binding = require_node2(); var MachOLoadCommand = require_load_command(); module.exports = class MachODylibCommand extends MachOLoadCommand { get name() { assert(this._handle); return binding.machODylibCommandGetName(this._handle); } set name(value) { assert(this._handle); assert.equal(typeof value, "string"); binding.machODylibCommandSetName(this._handle, value); } [Symbol.for("bare.inspect")]() { return { __proto__: { constructor: MachODylibCommand }, data: this.data, name: this.name }; } static id(name, opts = {}) { assert.equal(typeof name, "string"); const { timestamp = 0, currentVersion = 0, compatibilityVersion = 0 } = opts; assert.equal(typeof timestamp, "number"); assert.equal(typeof currentVersion, "number"); assert.equal(typeof compatibilityVersion, "number"); return new MachODylibCommand({ handle: binding.machODylibCommandCreateID( name, timestamp, currentVersion, compatibilityVersion ) }); } }; } }); // ../../node_modules/bare-lief/lib/macho/rpath-command.js var require_rpath_command = __commonJS({ "../../node_modules/bare-lief/lib/macho/rpath-command.js"(exports, module) { var assert = __require("assert"); var binding = require_node2(); var MachOLoadCommand = require_load_command(); module.exports = class MachORPathCommand extends MachOLoadCommand { constructor(path, opts = {}) { if (typeof path === "object" && path !== null) { opts = path; path = null; } const { handle = binding.machORPathCommandCreate(path) } = opts; super({ handle }); } get path() { assert(this._handle); return binding.machORPathCommandGetPath(this._handle); } set path(value) { assert(this._handle); assert.equal(typeof value, "string"); binding.machORPathCommandSetPath(this._handle, value); } [Symbol.for("bare.inspect")]() { return { __proto__: { constructor: MachORPathCommand }, data: this.data, path: this.path }; } }; } }); // ../../node_modules/bare-lief/lib/macho/binary.js var require_binary = __commonJS({ "../../node_modules/bare-lief/lib/macho/binary.js"(exports, module) { var assert = __require("assert"); var binding = require_node2(); var MachODylibCommand = require_dylib_command(); var MachOLoadCommand = require_load_command(); var MachORPathCommand = require_rpath_command(); module.exports = class MachOBinary { constructor(opts = {}) { const { handle } = opts; this._handle = handle; } addSegmentCommand(command) { assert(this._handle); assert(command._handle); binding.machOBinaryAddSegmentCommand(this._handle, command._handle); } getLoadCommand(type) { assert(this._handle); assert.equal(typeof type, "number"); const handle = binding.machOBinaryGetLoadCommand(this, this._handle, type); if (handle === void 0) return null; switch (type) { case MachOLoadCommand.TYPE.ID_DYLIB: return new MachODylibCommand({ handle }); case MachOLoadCommand.TYPE.RPATH: return new MachORPathCommand({ handle }); default: return new MachOLoadCommand({ handle }); } } addLoadCommand(command) { assert(this._handle); assert(command._handle); const handle = binding.machOBinaryAddLoadCommand(this, this._handle, command._handle); if (handle === void 0) return null; return new MachOLoadCommand({ handle }); } hasLoadCommand(type) { assert(this._handle); assert.equal(typeof type, "number"); return binding.machOBinaryHasLoadCommand(this._handle, type); } removeLoadCommand(command) { assert(this._handle); assert(command._handle); return binding.machOBinaryRemoveLoadCommand(this._handle, command._handle); } removeAllLoadCommands(type) { assert(this._handle); assert.equal(typeof type, "number"); return binding.machOBinaryRemoveAllLoadCommands(this._handle, type); } addDylibCommand(command) { assert(this._handle); assert(command._handle); const handle = binding.machOBinaryAddDylibCommand(this, this._handle, command._handle); if (handle === void 0) return null; return new MachODylibCommand({ handle }); } findLibrary(name) { assert(this._handle); assert.equal(typeof name, "string"); const handle = binding.machOBinaryFindLibrary(this, this._handle, name); if (handle === void 0) return null; return new MachODylibCommand({ handle }); } addLibrary(name) { assert(this._handle); assert.equal(typeof name, "string"); binding.machOBinaryAddLibrary(this._handle, name); } [Symbol.for("bare.inspect")]() { return { __proto__: { constructor: MachOBinary } }; } }; } }); // ../../node_modules/bare-lief/lib/macho/fat-binary.js var require_fat_binary = __commonJS({ "../../node_modules/bare-lief/lib/macho/fat-binary.js"(exports, module) { var assert = __require("assert"); var binding = require_node2(); var MachOBinary = require_binary(); module.exports = class MachOFatBinary { constructor(binaries, opts = {}) { if (typeof binaries === "object" && binaries !== null && !Array.isArray(binaries)) { opts = binaries; binaries = null; } const { handle = binding.machOFatBinaryCreate(binaries.map(takeBinaries)) } = opts; this._binaries = []; this._handle = handle; for (let i = 0, n = binding.machOFatBinaryGetSize(this._handle); i < n; i++) { this._binaries.push( new MachOBinary({ handle: binding.machOFatBinaryGetAt(this, this._handle, i) }) ); } } get size() { return this._binaries.length; } at(i) { assert.equal(typeof i, "number"); return this._binaries.at(i); } toDisk(path) { assert(this._handle); assert.equal(typeof path, "string"); binding.machOFatBinaryWrite(this._handle, path); } toBuffer() { assert(this._handle); return Buffer.from(binding.machOFatBinaryGetRaw(this._handle)); } [Symbol.iterator]() { return this._binaries[Symbol.iterator](); } [Symbol.for("bare.inspect")]() { return { __proto__: { constructor: MachOFatBinary }, binaries: this._binaries }; } static parse(input) { assert(Buffer.isBuffer(input)); return new MachOFatBinary({ handle: binding.machOFatBinaryParse(input) }); } static merge(binaries) { assert(Array.isArray(binaries)); return new MachOFatBinary({ handle: binding.machOFatBinaryMerge(binaries.map(takeFatBinaries)) }); } }; function takeBinaries(binary) { assert(binary._handle); const handle = binary._handle; binary._handle = null; return handle; } function takeFatBinaries(binary) { assert(binary._handle); const handle = binary._handle; binary._handle = null; binary._binaries = []; return handle; } } }); // ../../node_modules/bare-lief/lib/macho/section.js var require_section = __commonJS({ "../../node_modules/bare-lief/lib/macho/section.js"(exports, module) { var assert = __require("assert"); var binding = require_node2(); module.exports = class MachOSection { constructor(name, content) { assert.equal(typeof name, "string"); assert(Buffer.isBuffer(content)); this._name = name; this._handle = binding.machOSectionCreate(name, content); } [Symbol.for("bare.inspect")]() { return { __proto__: { constructor: MachOSection }, name: this._name }; } }; } }); // ../../node_modules/bare-lief/lib/macho/segment-command.js var require_segment_command = __commonJS({ "../../node_modules/bare-lief/lib/macho/segment-command.js"(exports, module) { var assert = __require("assert"); var binding = require_node2(); module.exports = exports = class MachOSegmentCommand { constructor(name) { assert.equal(typeof name, "string"); this._name = name; this._handle = binding.machOSegmentCommandCreate(this._name); } get maxProtection() { assert(this._handle); return binding.machOSegmentCommandGetMaxProtection(this._handle); } set maxProtection(value) { assert(this._handle); assert.equal(typeof value, "number"); binding.machOSegmentCommandSetMaxProtection(this._handle, value); } get initialProtection() { assert(this._handle); return binding.machOSegmentCommandGetInitialProtection(this._handle); } set initialProtection(value) { assert(this._handle); assert.equal(typeof value, "number"); binding.machOSegmentCommandSetInitialProtection(this._handle, value); } addSection(section) { assert(this._handle); assert(section._handle); binding.machOSegmentCommandAddSection(this._handle, section._handle); } [Symbol.for("bare.inspect")]() { return { __proto__: { constructor: MachOSegmentCommand }, name: this._name }; } }; exports.VM_PROTECTIONS = { READ: binding.MACHO_SEGMENT_COMMAND_VM_PROTECTIONS_READ, WRITE: binding.MACHO_SEGMENT_COMMAND_VM_PROTECTIONS_WRITE, EXECUTE: binding.MACHO_SEGMENT_COMMAND_VM_PROTECTIONS_EXECUTE }; } }); // ../../node_modules/bare-lief/lib/macho.js var require_macho = __commonJS({ "../../node_modules/bare-lief/lib/macho.js"(exports) { exports.Binary = require_binary(); exports.FatBinary = require_fat_binary(); exports.Section = require_section(); exports.SegmentCommand = require_segment_command(); exports.LoadCommand = require_load_command(); exports.DylibCommand = require_dylib_command(); exports.RPathCommand = require_rpath_command(); } }); // ../../node_modules/bare-lief/lib/elf/dynamic-entry.js var require_dynamic_entry = __commonJS({ "../../node_modules/bare-lief/lib/elf/dynamic-entry.js"(exports, module) { var assert = __require("assert"); var binding = require_node2(); var ELFDynamicEntry = class _ELFDynamicEntry { constructor(opts = {}) { const { handle } = opts; this._handle = handle; } [Symbol.for("bare.inspect")]() { return { __proto__: { constructor: _ELFDynamicEntry } }; } }; module.exports = exports = ELFDynamicEntry; exports.TAG = { NEEDED: binding.ELF_DYNAMIC_ENTRY_TAG_NEEDED, SONAME: binding.ELF_DYNAMIC_ENTRY_TAG_SONAME, RUNPATH: binding.ELF_DYNAMIC_ENTRY_TAG_RUNPATH }; exports.SharedObject = class ELFDynamicSharedObject extends ELFDynamicEntry { constructor(name, opts = {}) { if (typeof name === "object" && name !== null) { opts = name; name = null; } const { handle = binding.elfDynamicSharedObjectCreate(name) } = opts; super({ handle }); } get name() { assert(this._handle); return binding.elfDynamicSharedObjectGetName(this._handle); } set name(value) { assert(this._handle); assert.equal(typeof value, "string"); binding.elfDynamicSharedObjectSetName(this._handle, value); } [Symbol.for("bare.inspect")]() { return { __proto__: { constructor: ELFDynamicSharedObject }, name: this.name }; } }; exports.Library = class ELFDynamicEntryLibrary extends ELFDynamicEntry { constructor(name, opts = {}) { if (typeof name === "object" && name !== null) { opts = name; name = null; } const { handle = binding.elfDynamicEntryLibraryCreate(name) } = opts; super({ handle }); } get name() { assert(this._handle); return binding.elfDynamicEntryLibraryGetName(this._handle); } set name(value) { assert(this._handle); assert.equal(typeof value, "string"); binding.elfDynamicEntryLibrarySetName(this._handle, value); } [Symbol.for("bare.inspect")]() { return { __proto__: { constructor: ELFDynamicEntryLibrary }, name: this.name }; } }; exports.RunPath = class ELFDynamicEntryRunPath extends ELFDynamicEntry { constructor(path, opts = {}) { if (typeof path === "object" && path !== null) { opts = path; path = null; } const { handle = binding.elfDynamicEntryRunPathCreate(path) } = opts; super({ handle }); } get runpath() { assert(this._handle); return binding.elfDynamicEntryRunPathGetRunPath(this._handle); } set runpath(value) { assert(this._handle); assert.equal(typeof value, "string"); binding.elfDynamicEntryRunPathSetRunPath(this._handle, value); } [Symbol.for("bare.inspect")]() { return { __proto__: { constructor: ELFDynamicEntryRunPath }, runpath: this.runpath }; } }; } }); // ../../node_modules/bare-lief/lib/elf/section.js var require_section2 = __commonJS({ "../../node_modules/bare-lief/lib/elf/section.js"(exports, module) { var assert = __require("assert"); var binding = require_node2(); module.exports = exports = class ELFSection { constructor(name, opts = {}) { if (typeof name === "object" && name !== null) { opts = name; name = null; } const { handle = binding.elfSectionCreate(name) } = opts; this._handle = handle; } get type() { assert(this._handle); return binding.elfSectionGetType(this._handle); } set type(value) { assert(this._handle); assert.equal(typeof value, "number"); binding.elfSectionSetType(this._handle, value); } get flags() { assert(this._handle); return binding.elfSectionGetFlags(this._handle); } set flags(value) { assert(this._handle); assert.equal(typeof value, "number"); binding.elfSectionSetFlags(this._handle, value); } get alignment() { assert(this._handle); return binding.elfSectionGetAlignment(this._handle); } set alignment(value) { assert(this._handle); assert.equal(typeof value, "number"); binding.elfSectionSetAlignment(this._handle, value); } get content() { assert(this._handle); return Buffer.from(binding.elfSectionGetContent(this._handle)); } set content(value) { assert(this._handle); assert(Buffer.isBuffer(value)); binding.elfSectionSetContent(this._handle, value); } get size() { assert(this._handle); return binding.elfSectionGetSize(this._handle); } set size(value) { assert(this._handle); assert.equal(typeof value, "number"); binding.elfSectionSetSize(this._handle, value); } get virtualAddress() { assert(this._handle); return binding.elfSectionGetVirtualAddress(this._handle); } set virtualAddress(value) { assert(this._handle); assert.equal(typeof value, "number"); binding.elfSectionSetVirtualAddress(this._handle, value); } [Symbol.for("bare.inspect")]() { return { __proto__: { constructor: ELFSection }, type: this.type, flags: this.flags, alignment: this.alignment, content: this.content, size: this.size, virtualAddress: this.virtualAddress }; } }; exports.FLAGS = { WRITE: binding.ELF_SECTION_FLAGS_WRITE, ALLOC: binding.ELF_SECTION_FLAGS_ALLOC, EXECINSTR: binding.ELF_SECTION_FLAGS_EXECINSTR }; } }); // ../../node_modules/bare-lief/lib/elf/symbol.js var require_symbol = __commonJS({ "../../node_modules/bare-lief/lib/elf/symbol.js"(exports, module) { var assert = __require("assert"); var binding = require_node2(); module.exports = exports = class ELFSymbol { constructor(name, opts = {}) { if (typeof name === "object" && name !== null) { opts = name; name = null; } const { handle = binding.elfSymbolCreate(name) } = opts; this._handle = handle; } get type() { assert(this._handle); return binding.elfSymbolGetType(this._handle); } set type(value) { assert(this._handle); assert.equal(typeof value, "number"); binding.elfSymbolSetType(this._handle, value); } get name() { assert(this._handle); return binding.elfSymbolGetName(this._handle); } set name(value) { assert(this._handle); assert.equal(typeof value, "string"); binding.elfSymbolSetName(this._handle, value); } get value() { assert(this._handle); return binding.elfSymbolGetValue(this._handle); } set value(value) { assert(this._handle); assert.equal(typeof value, "number"); binding.elfSymbolSetValue(this._handle, value); } get binding() { assert(this._handle); return binding.elfSymbolGetBinding(this._handle); } set binding(value) { assert(this._handle); assert.equal(typeof value, "number"); binding.elfSymbolSetBinding(this._handle, value); } get sectionIndex() { assert(this._handle); return binding.elfSymbolGetSectionIndex(this._handle); } set sectionIndex(value) { assert(this._handle); assert.equal(typeof value, "number"); binding.elfSymbolSetSectionIndex(this._handle, value); } [Symbol.for("bare.inspect")]() { return { __proto__: { constructor: ELFSymbol }, name: this.name, value: this.value, binding: this.binding, sectionIndex: this.sectionIndex }; } }; exports.TYPE = { OBJECT: binding.ELF_SYMBOL_TYPE_OBJECT, FUNC: binding.ELF_SYMBOL_TYPE_FUNC, SECTION: binding.ELF_SYMBOL_TYPE_SECTION, FILE: binding.ELF_SYMBOL_TYPE_FILE, COMMON: binding.ELF_SYMBOL_TYPE_COMMON, TLS: binding.ELF_SYMBOL_TYPE_TLS }; exports.BINDING = { LOCAL: binding.ELF_SYMBOL_BINDING_LOCAL, GLOBAL: binding.ELF_SYMBOL_BINDING_GLOBAL, WEAK: binding.ELF_SYMBOL_BINDING_WEAK }; } }); // ../../node_modules/bare-lief/lib/elf/segment.js var require_segment = __commonJS({ "../../node_modules/bare-lief/lib/elf/segment.js"(exports, module) { var assert = __require("assert"); var binding = require_node2(); module.exports = exports = class ELFSegment { constructor(opts = {}) { const { handle = binding.elfSegmentCreate() } = opts; this._handle = handle; } get type() { assert(this._handle); return binding.elfSegmentGetType(this._handle); } set type(value) { assert(this._handle); assert.equal(typeof value, "number"); binding.elfSegmentSetType(this._handle, value); } get flags() { assert(this._handle); return binding.elfSegmentGetFlags(this._handle); } set flags(value) { assert(this._handle); assert.equal(typeof value, "number"); binding.elfSegmentSetFlags(this._handle, value); } get alignment() { assert(this._handle); return binding.elfSegmentGetAlignment(this._handle); } set alignment(value) { assert(this._handle); assert.equal(typeof value, "number"); binding.elfSegmentSetAlignment(this._handle, value); } get content() { assert(this._handle); return Buffer.from(binding.elfSegmentGetContent(this._handle)); } set content(value) { assert(this._handle); assert(Buffer.isBuffer(value)); binding.elfSegmentSetContent(this._handle, value); } get virtualSize() { assert(this._handle); return binding.elfSegmentGetVirtualSize(this._handle); } set virtualSize(value) { assert(this._handle); assert.equal(typeof value, "number"); binding.elfSegmentSetVirtualSize(this._handle, value); } get physicalSize() { assert(this._handle); return binding.elfSegmentGetPhysicalSize(this._handle); } set physicalSize(value) { assert(this._handle); assert.equal(typeof value, "number"); binding.elfSegmentSetPhysicalSize(this._handle, value); } get virtualAddress() { assert(this._handle); return binding.elfSegmentGetVirtualAddress(this._handle); } set virtualAddress(value) { assert(this._handle); assert.equal(typeof value, "number"); binding.elfSegmentSetVirtualAddress(this._handle, value); } get physicalAddress() { assert(this._handle); return binding.elfSegmentGetPhysicalAddress(this._handle); } set physicalAddress(value) { assert(this._handle); assert.equal(typeof value, "number"); binding.elfSegmentSetPhysicalAddress(this._handle, value); } [Symbol.for("bare.inspect")]() { return { __proto__: { constructor: ELFSegment }, type: this.type, flags: this.flags }; } }; exports.TYPE = { LOAD: binding.ELF_SEGMENT_TYPE_LOAD }; exports.FLAGS = { X: binding.ELF_SEGMENT_FLAGS_X, W: binding.ELF_SEGMENT_FLAGS_W, R: binding.ELF_SEGMENT_FLAGS_R }; } }); // ../../node_modules/bare-lief/lib/elf/binary.js var require_binary2 = __commonJS({ "../../node_modules/bare-lief/lib/elf/binary.js"(exports, module) { var assert = __require("assert"); var binding = require_node2(); var ELFDynamicEntry = require_dynamic_entry(); var ELFSection = require_section2(); var ELFSymbol = require_symbol(); var ELFSegment = require_segment(); var { TAG } = ELFDynamicEntry; module.exports = exports = class ELFBinary { constructor(opts = {}) { const { handle = null } = opts; this._handle = handle; } addSegment(segment, base = 0) { assert(this._handle); assert(segment._handle); assert.equal(typeof base, "number"); const handle = binding.elfBinaryAddSegment(this, this._handle, segment._handle, base); if (handle === void 0) return null; return new ELFSegment({ handle }); } addSection(section, loaded = true, position = 0) { assert(this._handle); assert(section._handle); assert.equal(typeof loaded, "boolean"); assert.equal(typeof position, "number"); const handle = binding.elfBinaryAddSection( this, this._handle, section._handle, loaded, position ); if (handle === void 0) return null; return new ELFSection({ handle }); } getSection(name) { assert(this._handle); assert.equal(typeof name, "string"); const handle = binding.elfBinaryGetSection(this, this._handle, name); if (handle === void 0) return null; return new ELFSection({ handle }); } getSectionIndex(name) { assert(this._handle); assert.equal(typeof name, "string"); return binding.elfBinaryGetSectionIndex(this._handle, name); } addSymtabSymbol(symbol) { assert(this._handle); assert(symbol._handle); binding.elfBinaryAddSymtabSymbol(this._handle, symbol._handle); } getSymtabSymbol(name) { assert(this._handle); assert.equal(typeof name, "string"); const handle = binding.elfBinaryGetSymtabSymbol(this, this._handle, name); if (handle === void 0) return null; return new ELFSymbol({ handle }); } addDynamicSymbol(symbol) { assert(this._handle); assert(symbol._handle); binding.elfBinaryAddDynamicSymbol(this._handle, symbol._handle); } getDynamicSymbol(name) { assert(this._handle); assert.equal(typeof name, "string"); const handle = binding.elfBinaryGetDynamicSymbol(this, this._handle, name); if (handle === void 0) return null; return new ELFSymbol({ handle }); } addDynamicEntry(entry) { assert(this._handle); assert(entry._handle); binding.elfBinaryAddDynamicEntry(this._handle, entry._handle); } getDynamicEntry(tag) { assert(this._handle); assert.equal(typeof tag, "number"); const handle = binding.elfBinaryGetDynamicEntry(this, this._handle, tag); if (handle === void 0) return null; switch (tag) { case TAG.SONAME: return new ELFDynamicEntry.SharedObject({ handle }); case TAG.NEEDED: return new ELFDynamicEntry.Library({ handle }); case TAG.RUNPATH: return new ELFDynamicEntry.RunPath({ handle }); default: return new ELFDynamicEntry({ handle }); } } hasDynamicEntry(tag) { assert(this._handle); assert.equal(typeof tag, "number"); return binding.elfBinaryHasDynamicEntry(this._handle, tag); } removeDynamicEntry(entry) { assert(this._handle); assert(entry._handle); binding.elfBinaryRemoveDynamicEntry(this._handle, entry._handle); } removeAllDynamicEntries(tag) { assert(this._handle); assert.equal(typeof tag, "number"); binding.elfBinaryRemoveAllDynamicEntries(this._handle, tag); } addLibrary(name) { assert(this._handle); assert.equal(typeof name, "string"); binding.elfBinaryAddLibrary(this._handle, name); } getLibrary(name) { assert(this._handle); assert.equal(typeof name, "string"); const handle = binding.elfBinaryGetLibrary(this, this._handle, name); if (handle === void 0) return null; return new ELFDynamicEntry.Library({ handle }); } hasLibrary(name) { assert(this._handle); assert.equal(typeof name, "string"); return binding.elfBinaryHasLibrary(this._handle, name); } removeLibrary(name) { assert(this._handle); assert.equal(typeof name, "string"); binding.elfBinaryRemoveLibrary(this._handle, name); } toDisk(path) { assert(this._handle); assert.equal(typeof path, "string"); binding.elfBinaryWrite(this._handle, path); } toBuffer() { assert(this._handle); return Buffer.from(binding.elfBinaryGetRaw(this._handle)); } [Symbol.for("bare.inspect")]() { return { __proto__: { constructor: ELFBinary } }; } static parse(input) { assert(Buffer.isBuffer(input)); return new ELFBinary({ handle: binding.elfBinaryParse(input) }); } }; exports.SEC_INSERT_POS = { AUTO: binding.ELF_BINARY_SEC_INSERT_POS_AUTO, POST_SEGMENT: binding.ELF_BINARY_SEC_INSERT_POS_POST_SEGMENT, POST_SECTION: binding.ELF_BINARY_SEC_INSERT_POS_POST_SECTION }; } }); // ../../node_modules/bare-lief/lib/elf.js var require_elf = __commonJS({ "../../node_modules/bare-lief/lib/elf.js"(exports) { exports.Binary = require_binary2(); exports.DynamicEntry = require_dynamic_entry(); exports.Section = require_section2(); exports.Segment = require_segment(); exports.Symbol = require_symbol(); } }); // ../../node_modules/bare-lief/lib/pe/section.js var require_section3 = __commonJS({ "../../node_modules/bare-lief/lib/pe/section.js"(exports, module) { var assert = __require("assert"); var binding = require_node2(); module.exports = exports = class PESection { constructor(name, opts = {}) { if (typeof name === "object" && name !== null) { opts = name; name = null; } const { handle = binding.peSectionCreate(name) } = opts; this._handle = handle; } get characteristics() { assert(this._handle); return binding.peSectionGetCharacteristics(this._handle); } set characteristics(value) { assert(this._handle); assert.equal(typeof value, "number"); binding.peSectionSetCharacteristics(this._handle, value); } get content() { assert(this._handle); return Buffer.from(binding.peSectionGetContent(this._handle)); } set content(value) { assert(this._handle); assert(Buffer.isBuffer(value)); binding.peSectionSetContent(this._handle, value); } get size() { assert(this._handle); return binding.peSectionGetSize(this._handle); } set size(value) { assert(this._handle); assert.equal(typeof value, "number"); binding.peSectionSetSize(this._handle, value); } [Symbol.for("bare.inspect")]() { return { __proto__: { constructor: PESection }, characteristics: this.characteristics, content: this.content, size: this.size }; } }; exports.CHARACTERISTICS = { CNT_CODE: binding.PE_SECTION_CHARACTERISTICS_CNT_CODE, CNT_INITIALIZED_DATA: binding.PE_SECTION_CHARACTERISTICS_CNT_INITIALIZED_DATA, CNT_UNINITIALIZED_DATA: binding.PE_SECTION_CHARACTERISTICS_CNT_UNINITIALIZED_DATA, MEM_SHARED: binding.PE_SECTION_CHARACTERISTICS_MEM_SHARED, MEM_EXECUTE: binding.PE_SECTION_CHARACTERISTICS_MEM_EXECUTE, MEM_READ: binding.PE_SECTION_CHARACTERISTICS_MEM_READ, MEM_WRITE: binding.PE_SECTION_CHARACTERISTICS_MEM_WRITE }; } }); // ../../node_modules/bare-lief/lib/pe/optional-header.js var require_optional_header = __commonJS({ "../../node_modules/bare-lief/lib/pe/optional-header.js"(exports, module) { var assert = __require("assert"); var binding = require_node2(); module.exports = exports = class PEOptionalHeader { constructor(binary) { assert(binary._handle); this._binary = binary; } get subsystem() { assert(this._binary._handle); return binding.peOptionalHeaderGetSubsystem(this._binary._handle); } set subsystem(value) { assert(this._binary._handle); assert.equal(typeof value, "number"); binding.peOptionalHeaderSetSubsystem(this._binary._handle, value); } [Symbol.for("bare.inspect")]() { return { __proto__: { constructor: PEOptionalHeader }, subsystem: this.subsystem }; } }; exports.SUBSYSTEM = { WINDOWS_GUI: binding.PE_OPTIONAL_HEADER_SUBSYSTEM_WINDOWS_GUI, WINDOWS_CUI: binding.PE_OPTIONAL_HEADER_SUBSYSTEM_WINDOWS_CUI }; } }); // ../../node_modules/bare-lief/lib/pe/binary.js var require_binary3 = __commonJS({ "../../node_modules/bare-lief/lib/pe/binary.js"(exports, module) { var assert = __require("assert"); var binding = require_node2(); var PESection = require_section3(); var PEOptionalHeader = require_optional_header(); module.exports = class PEBinary { constructor(opts = {}) { const { handle = null } = opts; this._handle = handle; this._optionalHeader = new PEOptionalHeader(this); } get optionalHeader() { return this._optionalHeader; } addSection(section) { assert(this._handle); assert(section._handle); const handle = binding.peBinaryAddSection(this, this._handle, section._handle); return new PESection({ handle }); } getSection(name) { assert(this._handle); assert.equal(typeof name, "string"); const handle = binding.peBinaryGetSection(this, this._handle, name); if (handle === void 0) return null; return new PESection({ handle }); } toDisk(path) { assert(this._handle); assert.equal(typeof path, "string"); binding.peBinaryWrite(this._handle, path); } toBuffer() { assert(this._handle); return Buffer.from(binding.peBinaryGetRaw(this._handle)); } [Symbol.for("bare.inspect")]() { return { __proto__: { constructor: PEBinary }, optionalHeader: this.optionalHeader }; } static parse(input) { assert(Buffer.isBuffer(input)); return new PEBinary({ handle: binding.peBinaryParse(input) }); } }; } }); // ../../node_modules/bare-lief/lib/pe.js var require_pe = __commonJS({ "../../node_modules/bare-lief/lib/pe.js"(exports) { exports.Binary = require_binary3(); exports.Section = require_section3(); exports.OptionalHeader = require_optional_header(); } }); // ../../node_modules/bare-lief/index.js var require_bare_lief = __commonJS({ "../../node_modules/bare-lief/index.js"(exports) { exports.MachO = require_macho(); exports.ELF = require_elf(); exports.PE = require_pe(); } }); // ../../node_modules/bare-link/lib/run.js var require_run = __commonJS({ "../../node_modules/bare-link/lib/run.js"(exports, module) { var { spawn } = __require("child_process"); module.exports = async function run(command, args, opts = {}) { const job = spawn(command, args, opts); const err = []; job.stderr.on("data", (data) => err.push(data)); return new Promise((resolve, reject) => { job.on("close", (code) => { if (code === null || code !== 0) { return reject( new Error(`Command '${command} ${args.join(" ")}' failed`, { cause: Buffer.concat(err).toString().trim() }) ); } resolve(); }); }); }; } }); // ../../node_modules/bare-link/lib/platform/apple/sign.js var require_sign = __commonJS({ "../../node_modules/bare-link/lib/platform/apple/sign.js"(exports, module) { var os = __require("os"); var run = require_run(); module.exports = async function sign(resource, opts = {}) { const { sign: sign2 = false, identity = "Apple Development", keychain } = opts; if (sign2) { const args = ["--timestamp", "--force", "--sign", identity]; if (keychain) args.push("--keychain", keychain); args.push(resource); await run("codesign", args); } else if (os.platform() === "darwin") { await run("codesign", ["--timestamp=none", "--force", "--sign", "-", resource]); } }; } }); // ../../node_modules/bare-link/lib/platform/apple/create-framework.js var require_create_framework = __commonJS({ "../../node_modules/bare-link/lib/platform/apple/create-framework.js"(exports, module) { var path = __require("path"); var { MachO } = require_bare_lief(); var fs = require_fs(); var dependencies = require_dependencies(); var sign = require_sign(); module.exports = async function* createFramework(base, pkg, name, version, hosts, out, opts = {}) { const prebuilds = []; for (const host of hosts) { const prebuild = path.resolve(base, "prebuilds", host, `${name}.bare`); if (!await fs.exists(prebuild)) continue; prebuilds.push(prebuild); } if (prebuilds.length === 0) return null; const isMac = hosts.some((host) => host.startsWith("darwin")); const framework = path.resolve(out, `${name}.${version}.framework`); await fs.rm(framework); await fs.makeDir(framework); const main = isMac ? path.join(framework, "Versions/A") : framework; await fs.makeDir(main); const resources = isMac ? path.join(main, "Resources") : main; await fs.makeDir(resources); const frameworks = path.join(main, "Frameworks"); if (isMac) { await fs.symlink("A", path.join(framework, "Versions/Current")); await fs.symlink( `Versions/Current/${name}.${version}`, path.join(framework, `${name}.${version}`) ); } const extra = /* @__PURE__ */ new Map(); for (const prebuild of prebuilds) { try { for await (const file of await fs.openDir(path.resolve(prebuild, "..", name))) { switch (path.extname(file.name)) { case ".dylib": let files = extra.get(file.name); if (files === void 0) { files = []; extra.set(file.name, files); } files.push(path.join(file.parentPath, file.name)); } } } catch (err) { if (err.code !== "ENOENT") throw err; } } if (extra.size > 0) { await fs.makeDir(frameworks); for (const [name2, inputs] of extra) { const binaries2 = []; for (const input of inputs) { binaries2.push(MachO.FatBinary.parse(await fs.readFile(input))); } const fat2 = MachO.FatBinary.merge(binaries2); const dylib = path.join(frameworks, name2); fat2.toDisk(dylib); await sign(dylib, opts); yield dylib; } } const binaries = []; for (const prebuild of prebuilds) { binaries.push(MachO.FatBinary.parse(await fs.readFile(prebuild))); } const fat = MachO.FatBinary.merge(binaries); const replacements = /* @__PURE__ */ new Map(); for await (const { addon, name: name2, version: version2 } of dependencies(base, pkg)) { if (addon) { const major = version2.substring(0, version2.indexOf(".")); replacements.set( `${name2}@${major}.bare`, `@rpath/${name2}.${version2}.framework/${name2}.${version2}` ); } } for (const binary of fat) { const id = binary.getLoadCommand(MachO.LoadCommand.TYPE.ID_DYLIB); if (id) { id.name = `@rpath/${name}.${version}.framework/${name}.${version}`; } else { binary.addDylibCommand( MachO.DylibCommand.id(`@rpath/${name}.${version}.framework/${name}.${version}`) ); } const rpath = binary.getLoadCommand(MachO.LoadCommand.TYPE.RPATH); if (rpath) rpath.path = "@loader_path/Frameworks"; for (const [from, to] of replacements) { const library = binary.findLibrary(from); if (library) library.name = to; else binary.addLibrary(to); } } const executable = path.join(main, `${name}.${version}`); fat.toDisk(executable); await sign(executable, opts); yield executable; const info = path.join(resources, "Info.plist"); await fs.writeFile(info, createPropertyList(isMac, name, version)); yield info; await sign(framework, opts); yield framework; return framework; }; function createPropertyList(isMac, name, version) { const executable = `${name}.${version}`; version = version.match(/^\d+(\.\d+){0,2}/).at(0); return ` CFBundleIdentifier ${toIdentifier(name)}.${version} CFBundleVersion ${version} CFBundleShortVersionString ${version} CFBundleExecutable ${executable} CFBundlePackageType FMWK ${isMac ? "LSMinimumSystemVersion" : "MinimumOSVersion"} ${isMac ? "12.0" : "14.0"} `; } var invalidBundleIdentifierCharacter = /[^A-Za-z0-9.-]/g; function toIdentifier(input) { return input.replace(invalidBundleIdentifierCharacter, "-"); } } }); // ../../node_modules/bare-link/lib/platform/apple/create-xcframework.js var require_create_xcframework = __commonJS({ "../../node_modules/bare-link/lib/platform/apple/create-xcframework.js"(exports, module) { var path = __require("path"); var fs = require_fs(); var sign = require_sign(); module.exports = async function* createXCFramework(name, version, inputs, out, opts = {}) { const xcframework = path.resolve(out, `${name}.${version}.xcframework`); await fs.rm(xcframework); await fs.makeDir(xcframework); const frameworks = []; for (const { hosts, framework } of inputs) { let os; let variant = null; const archs = []; for (const host of hosts) { switch (host) { case "darwin-arm64": os = "macos"; archs.push("arm64"); break; case "darwin-x64": os = "macos"; archs.push("x86_64"); break; case "ios-arm64": os = "ios"; archs.push("arm64"); break; case "ios-arm64-simulator": os = "ios"; variant = "simulator"; archs.push("arm64"); break; case "ios-x64-simulator": os = "ios"; variant = "simulator"; archs.push("x86_64"); break; } } const identifier = `${os}-${archs.join("_")}${variant ? "-" + variant : ""}`; frameworks.push({ os, variant, archs, identifier, binary: os === "macos" ? `${name}.${version}.framework/Versions/A/${name}.${version}` : `${name}.${version}.framework/${name}.${version}` }); await fs.cp(framework, path.join(xcframework, identifier, path.basename(framework))); } const info = path.join(xcframework, "Info.plist"); await fs.writeFile(info, createPropertyList(frameworks)); yield info; await sign(xcframework, opts); yield xcframework; return xcframework; }; function createPropertyList(frameworks) { return ` AvailableLibraries ${frameworks.map( ({ os, variant, archs, identifier, binary }) => ` BinaryPath ${binary} LibraryIdentifier ${identifier} LibraryPath ${path.basename(binary)}.framework SupportedArchitectures ${archs.map( (arch) => ` ${arch}` ).join("\n")} SupportedPlatform ${os}${variant ? ` SupportedPlatformVariant ${variant}` : ""} ` ).join("\n")} CFBundlePackageType XFWK XCFrameworkFormatVersion 1.0 `; } } }); // ../../node_modules/bare-link/lib/platform/apple.js var require_apple2 = __commonJS({ "../../node_modules/bare-link/lib/platform/apple.js"(exports, module) { var fs = require_fs(); var createFramework = require_create_framework(); var createXCFramework = require_create_xcframework(); module.exports = async function* apple(base, pkg, name, version, opts = {}) { const { hosts = [], out = "." } = opts; const archs = /* @__PURE__ */ new Map([ ["macos", []], ["ios", []], ["ios-simulator", []] ]); for (const host of hosts) { let arch; switch (host) { case "darwin-arm64": case "darwin-x64": arch = archs.get("macos"); break; case "ios-arm64": arch = archs.get("ios"); break; case "ios-arm64-simulator": case "ios-x64-simulator": arch = archs.get("ios-simulator"); break; default: throw new Error(`Unknown host '${host}'`); } arch.push(host); } const temp = []; const frameworks = []; try { for (const [os, hosts2] of archs) if (hosts2.length === 0) archs.delete(os); for (const [, hosts2] of archs) { if (archs.size > 1) { const out2 = await fs.tempDir(); temp.push(out2); const framework = yield* createFramework(base, pkg, name, version, hosts2, out2, opts); if (framework) frameworks.push({ hosts: hosts2, framework }); } else { const framework = yield* createFramework(base, pkg, name, version, hosts2, out, opts); return framework ? [framework] : []; } } if (frameworks.length === 0) return []; return [yield* createXCFramework(name, version, frameworks, out, opts)]; } finally { for (const dir of temp) await fs.rm(dir); } }; } }); // ../../node_modules/bare-link/lib/platform/android.js var require_android2 = __commonJS({ "../../node_modules/bare-link/lib/platform/android.js"(exports, module) { var path = __require("path"); var { ELF } = require_bare_lief(); var fs = require_fs(); var dependencies = require_dependencies(); module.exports = async function* android(base, pkg, name, version, opts = {}) { const { hosts = [], out = "." } = opts; const archs = /* @__PURE__ */ new Map(); for (const host of hosts) { let arch; switch (host) { case "android-arm64": arch = "arm64-v8a"; break; case "android-arm": arch = "armeabi-v7a"; break; case "android-ia32": arch = "x86"; break; case "android-x64": arch = "x86_64"; break; default: throw new Error(`Unknown host '${host}'`); } archs.set(arch, host); } const replacements = /* @__PURE__ */ new Map(); for await (const { addon, name: name2, version: version2 } of dependencies(base, pkg)) { if (addon) { const major = version2.substring(0, version2.indexOf(".")); replacements.set(`${name2}@${major}.bare`, `lib${name2}.${version2}.so`); } } const seen = /* @__PURE__ */ new Set(); const result = []; for (const [arch, host] of archs) { const prebuild = path.resolve(base, "prebuilds", host, `${name}.bare`); if (!await fs.exists(prebuild)) continue; const dir = path.resolve(out, arch); await fs.makeDir(dir); try { for await (const file of await fs.openDir(path.resolve(prebuild, "..", name))) { switch (path.extname(file.name)) { case ".so": { const so2 = path.join(dir, file.name); result.push(so2); await fs.copyFile(path.join(file.parentPath, file.name), so2); yield so2; break; } case ".dex": case ".jar": { if (seen.has(file.name)) continue; seen.add(file.name); const java = path.join(dir, "..", `${name}.${file.name}`); result.push(java); await fs.copyFile(path.join(file.parentPath, file.name), java); yield java; break; } } } } catch (err) { if (err.code !== "ENOENT") throw err; } const binary = ELF.Binary.parse(await fs.readFile(prebuild)); const soname = binary.getDynamicEntry(ELF.DynamicEntry.TAG.SONAME); if (soname) { soname.name = `lib${name}.${version}.so`; } else { binary.addDynamicEntry(new ELF.DynamicEntry.SharedObject(`lib${name}.${version}.so`)); } for (const [from, to] of replacements) { const library = binary.getLibrary(from); if (library) library.name = to; else binary.addLibrary(to); } const so = path.join(dir, `lib${name}.${version}.so`); result.push(so); binary.toDisk(so); yield so; } return result; }; } }); // ../../node_modules/bare-link/lib/platform/linux.js var require_linux2 = __commonJS({ "../../node_modules/bare-link/lib/platform/linux.js"(exports, module) { var path = __require("path"); var { ELF } = require_bare_lief(); var fs = require_fs(); var dependencies = require_dependencies(); module.exports = async function* linux(base, pkg, name, version, opts = {}) { const { hosts = [], out = "." } = opts; const archs = /* @__PURE__ */ new Map(); for (const host of hosts) { let arch; switch (host) { case "linux-arm64": arch = "aarch64"; break; case "linux-x64": arch = "x86_64"; break; default: throw new Error(`Unknown host '${host}'`); } archs.set(arch, host); } const replacements = /* @__PURE__ */ new Map(); for await (const { addon, name: name2, version: version2 } of dependencies(base, pkg)) { if (addon) { const major = version2.substring(0, version2.indexOf(".")); replacements.set(`${name2}@${major}.bare`, `lib${name2}.${version2}.so`); } } const result = []; for (const [arch, host] of archs) { const prebuild = path.resolve(base, "prebuilds", host, `${name}.bare`); if (!await fs.exists(prebuild)) continue; const dir = archs.size === 1 ? path.resolve(out, "lib") : path.resolve(out, arch, "lib"); await fs.makeDir(dir); try { for await (const file of await fs.openDir(path.resolve(prebuild, "..", name))) { switch (path.extname(file.name)) { case ".so": { const so2 = path.join(dir, file.name); result.push(so2); await fs.copyFile(path.join(file.parentPath, file.name), so2); yield so2; } } } } catch (err) { if (err.code !== "ENOENT") throw err; } const binary = ELF.Binary.parse(await fs.readFile(prebuild)); const soname = binary.getDynamicEntry(ELF.DynamicEntry.TAG.SONAME); if (soname) { soname.name = `lib${name}.${version}.so`; } else { binary.add(new ELF.DynamicEntry.SharedObject(`lib${name}.${version}.so`)); } const runpath = binary.getDynamicEntry(ELF.DynamicEntry.TAG.RUNPATH); if (runpath) runpath.runpath = "$ORIGIN"; for (const [from, to] of replacements) { const library = binary.getLibrary(from); if (library) library.name = to; else binary.addLibrary(to); } const so = path.join(dir, `lib${name}.${version}.so`); result.push(so); binary.toDisk(so); yield so; } return result; }; } }); // ../../node_modules/bare-link/lib/platform/windows/sign.js var require_sign2 = __commonJS({ "../../node_modules/bare-link/lib/platform/windows/sign.js"(exports, module) { var run = require_run(); module.exports = async function sign(resource, opts = {}) { const { sign: sign2 = false, subjectName, thumbprint } = opts; if (sign2) { const args = ["sign", "/a", "/fd", "SHA256", "/t", "http://timestamp.digicert.com"]; if (subjectName) args.push("/n", subjectName); if (thumbprint) args.push("/sha1", thumbprint); args.push(resource); await run("signtool", args); } }; } }); // ../../node_modules/bare-link/lib/platform/windows.js var require_windows = __commonJS({ "../../node_modules/bare-link/lib/platform/windows.js"(exports, module) { var path = __require("path"); var fs = require_fs(); var sign = require_sign2(); module.exports = async function* windows(base, pkg, name, version, opts = {}) { const { hosts = [], out = "." } = opts; const archs = /* @__PURE__ */ new Map(); for (const host of hosts) { let arch; switch (host) { case "win32-arm64": arch = "arm64"; break; case "win32-x64": arch = "x64"; break; default: throw new Error(`Unknown host '${host}'`); } archs.set(arch, host); } const result = []; for (const [arch, host] of archs) { const prebuild = path.resolve(base, "prebuilds", host, `${name}.bare`); if (!await fs.exists(prebuild)) continue; const dir = archs.size === 1 ? path.resolve(out) : path.resolve(out, arch); await fs.makeDir(dir); try { for await (const file of await fs.openDir(path.resolve(prebuild, "..", name))) { switch (path.extname(file.name)) { case ".dll": { const dll2 = path.join(dir, file.name); result.push(dll2); await fs.copyFile(path.join(file.parentPath, file.name), dll2); await sign(dll2, opts); yield dll2; } } } } catch (err) { if (err.code !== "ENOENT") throw err; } const dll = path.join(dir, `${name}-${version}.dll`); result.push(dll); await fs.copyFile(prebuild, dll); await sign(dll, opts); yield dll; } return result; }; } }); // ../../node_modules/bare-link/index.js var require_bare_link = __commonJS({ "../../node_modules/bare-link/index.js"(exports, module) { var path = __require("path"); var { fileURLToPath } = __require("url"); var dependencies = require_dependencies(); var preset = require_preset(); module.exports = async function* link(base = ".", opts = {}, pkg = null, visited = /* @__PURE__ */ new Set()) { if (typeof base === "object" && base !== null) { opts = base; base = "."; } base = path.resolve(base); if (visited.has(base)) return; visited.add(base); opts = withPreset(opts); const { hosts = [] } = opts; if (pkg === null) { try { pkg = __require(path.join(base, "package.json")); } catch { return; } } for await (const dependency of dependencies(base, pkg)) { yield* link(fileURLToPath(dependency.url), opts, dependency.pkg, visited); } if (pkg.addon === true) { const name = pkg.name.replace(/\//g, "__").replace(/^@/, ""); const version = pkg.version; const groups = /* @__PURE__ */ new Map(); for (const host of hosts) { let platform; switch (host) { case "darwin-arm64": case "darwin-x64": case "ios-arm64": case "ios-arm64-simulator": case "ios-x64-simulator": platform = require_apple2(); break; case "android-arm64": case "android-arm": case "android-ia32": case "android-x64": platform = require_android2(); break; case "linux-arm64": case "linux-x64": platform = require_linux2(); break; case "win32-arm64": case "win32-x64": platform = require_windows(); break; default: throw new Error(`Unknown host '${host}'`); } let group = groups.get(platform); if (group === void 0) { group = []; groups.set(platform, group); } group.push(host); } for (const [platform, hosts2] of groups) { yield* platform(base, pkg, name, version, { ...opts, hosts: hosts2 }); } } }; function withPreset(opts = {}) { if (opts.preset) { if (opts.preset in preset === false) { throw new Error(`Unknown preset '${opts.preset}'`); } Object.assign(opts, preset[opts.preset]); } return opts; } } }); // ../../bare-lib-entry-bareLink.js var bare_lib_entry_bareLink_exports = {}; __export(bare_lib_entry_bareLink_exports, { default: () => bare_lib_entry_bareLink_default }); var import_bare_link = __toESM(require_bare_link()); var bare_lib_entry_bareLink_default = import_bare_link.default; return __toCommonJS(bare_lib_entry_bareLink_exports); })(); ;(function(){var g=globalThis;var s="__bare_os_stdlib__";g[s]=g[s]||{};var e=typeof __bare_os_bundle_exports__!=="undefined"?__bare_os_bundle_exports__:void 0;var v=e!=null&&typeof e==="object"&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;g[s]["bareLink"]=v;})();