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/promaphore/index.js var require_promaphore = __commonJS({ "../../node_modules/promaphore/index.js"(exports, module) { var DONE = Promise.resolve(true); var DESTROYED = Promise.resolve(false); module.exports = class Semaphore { constructor(limit = 1) { this.limit = limit; this.active = 0; this.waiting = []; this.destroyed = false; this._onwait = (resolve) => { this.waiting.push(resolve); }; } wait() { if (this.destroyed === true) return DESTROYED; if (this.active < this.limit && this.waiting.length === 0) { this.active++; return DONE; } return new Promise(this._onwait); } signal() { if (this.destroyed === true) return; this.active--; while (this.active < this.limit && this.waiting.length > 0 && this.destroyed === false) { this.active++; this.waiting.shift()(true); } } async flush() { if (this.destroyed === true) return; this.limit = 1; await this.wait(); this.signal(); } destroy() { this.destroyed = true; this.active = 0; while (this.waiting.length) this.waiting.pop()(false); } }; } }); // ../../node_modules/bare-bundle/lib/errors.js var require_errors = __commonJS({ "../../node_modules/bare-bundle/lib/errors.js"(exports, module) { module.exports = class BundleError extends Error { constructor(msg, fn = BundleError, opts = {}) { const { cause, code = fn.name } = opts; super(`${code}: ${msg}`, { cause }); this.code = code; if (Error.captureStackTrace) { Error.captureStackTrace(this, fn); } } get name() { return "BundleError"; } static INVALID_BUNDLE_HEADER(msg, cause) { return new BundleError(msg, BundleError.INVALID_BUNDLE_HEADER, { cause }); } }; } }); // ../../node_modules/bare-bundle/index.js var require_bare_bundle = __commonJS({ "../../node_modules/bare-bundle/index.js"(exports, module) { var errors = require_errors(); var kind = Symbol.for("bare.bundle.kind"); var MemoryFile = class _MemoryFile { constructor(data, opts = {}) { const { executable = false, mode = executable ? 493 : 420 } = opts; this._data = typeof data === "string" ? Buffer.from(data) : data; this._mode = mode; } size() { return this._data.byteLength; } mode() { return this._mode; } read() { return this._data; } inspect() { return { __proto__: { constructor: _MemoryFile }, data: this._data, mode: this._mode.toString(8) }; } [Symbol.for("bare.inspect")]() { return this.inspect(); } [Symbol.for("nodejs.util.inspect.custom")]() { return this.inspect(); } }; module.exports = exports = class Bundle2 { static get [kind]() { return 0; } static get version() { return 0; } constructor(opts = {}) { const { File = MemoryFile } = opts; this._File = File; this._id = null; this._main = null; this._imports = {}; this._resolutions = {}; this._addons = []; this._assets = []; this._files = /* @__PURE__ */ new Map(); } get [kind]() { return Bundle2[kind]; } get version() { return Bundle2.version; } get id() { return this._id; } set id(value) { if (typeof value !== "string" && value !== null) { throw new TypeError(`ID must be a string or null. Received type ${typeof value} (${value})`); } this._id = value; } get main() { return this._main; } set main(value) { if (typeof value !== "string" && value !== null) { throw new TypeError(`Main must be a string or null. Received type ${typeof value} (${value})`); } this._main = value; } get imports() { return this._imports; } set imports(value) { this._imports = cloneImportsMap(value); } get resolutions() { return this._resolutions; } set resolutions(value) { this._resolutions = cloneResolutionsMap(value); } get addons() { return this._addons; } set addons(value) { this._addons = cloneFilesList(value, "Addons"); } get assets() { return this._assets; } set assets(value) { this._assets = cloneFilesList(value, "Assets"); } get files() { return Object.fromEntries(this._files.entries()); } *[Symbol.iterator]() { for (const [key, file] of this._files) { yield [key, file.read(), file.mode()]; } } empty() { return this._files.size === 0; } keys() { return this._files.keys(); } exists(key) { return this._files.has(key); } size(key) { const file = this._files.get(key) || null; if (file === null) return 0; return file.size(); } mode(key) { const file = this._files.get(key) || null; if (file === null) return 0; return file.mode(); } read(key) { const file = this._files.get(key) || null; if (file === null) return null; return file.read(); } write(key, data, opts = {}) { if (typeof key !== "string") { throw new TypeError(`File path must be a string. Received type ${typeof key} (${key})`); } const { main = false, alias = null, imports = null, addon = false, asset = false } = opts; this._files.set(key, new MemoryFile(data, opts)); if (main) this._main = key; if (alias) this._imports[alias] = key; if (imports) this._resolutions[key] = cloneImportsMap(imports); if (addon) this._addons.push(key); if (asset) this._assets.push(key); return this; } mount(root, opts = {}) { const bundle = new Bundle2(); bundle._File = this._File; bundle._id = this._id; if (this._main) bundle._main = mountSpecifier(this._main, root); bundle._imports = transformImportsMap(this._imports, root, null, opts, mountSpecifier); bundle._resolutions = transformResolutionsMap(this._resolutions, root, opts, mountSpecifier); for (const [key, file] of this._files) { bundle._files.set(mountSpecifier(key, root), file); } bundle._addons = transformFilesList(this._addons, root, mountSpecifier); bundle._assets = transformFilesList(this._assets, root, mountSpecifier); return bundle; } unmount(root, opts = {}) { const bundle = new Bundle2(); bundle._File = this._File; bundle._id = this._id; if (this._main) bundle._main = unmountSpecifier(this._main, root); bundle._imports = transformImportsMap(this._imports, root, null, opts, unmountSpecifier); bundle._resolutions = transformResolutionsMap(this._resolutions, root, opts, unmountSpecifier); for (const [key, file] of this._files) { bundle._files.set(unmountSpecifier(key, root), file); } bundle._addons = transformFilesList(this._addons, root, unmountSpecifier); bundle._assets = transformFilesList(this._assets, root, unmountSpecifier); return bundle; } toBuffer(opts = {}) { const { indent = 0, shared = false } = opts; const header = { version: Bundle2.version, id: this._id, main: this._main, imports: cloneImportsMap(this._imports), resolutions: cloneResolutionsMap(this._resolutions), addons: cloneFilesList(this._addons, "Addons"), assets: cloneFilesList(this._assets, "Assets"), files: {} }; const keys = [...this._files.keys()].sort(); let offset = 0; for (const key of keys) { const length2 = this.size(key); header.files[key] = { offset, length: length2, mode: this.mode(key) }; offset += length2; } const json = Buffer.from(` ${JSON.stringify(header, null, indent)} `); const length = Buffer.from(json.byteLength.toString(10)); const total = length.byteLength + json.byteLength + offset; const storage = shared ? new SharedArrayBuffer(total) : new ArrayBuffer(total); const buffer = Buffer.from(storage); offset = 0; buffer.set(length, offset); offset += length.byteLength; buffer.set(json, offset); offset += json.byteLength; for (const key of keys) { buffer.set(this.read(key), offset); offset += this.size(key); } return buffer; } inspect() { return { __proto__: { constructor: Bundle2 }, version: this.version, id: this.id, main: this.main, imports: this.imports, resolutions: this.resolutions, addons: this.addons, assets: this.assets, files: this.files }; } [Symbol.for("bare.inspect")]() { return this.inspect(); } [Symbol.for("nodejs.util.inspect.custom")]() { return this.inspect(); } }; var Bundle = exports; exports.errors = errors; exports.isBundle = function isBundle(value) { if (value instanceof Bundle) return true; return typeof value === "object" && value !== null && value[kind] === Bundle[kind]; }; exports.from = function from(value) { if (typeof value === "string") return fromString(value); if (Buffer.isBuffer(value)) return fromBuffer(value); return value; }; function fromString(string) { return fromBuffer(Buffer.from(string)); } function fromBuffer(buffer) { if (buffer[0] === 35 && buffer[1] === 33) { let end2 = 2; while (buffer[end2] !== 10) end2++; buffer = buffer.subarray(end2 + 1); } let end = 0; while (isDecimal(buffer[end])) end++; const len = parseInt(buffer.toString("utf8", 0, end), 10); let header; try { header = JSON.parse(buffer.toString("utf8", end, end + len)); } catch (err) { throw errors.INVALID_BUNDLE_HEADER("Invalid bundle header", err); } const bundle = new Bundle(); if (header.id) bundle.id = header.id; if (header.main) bundle.main = header.main; if (header.imports) bundle.imports = header.imports; if (header.resolutions) bundle.resolutions = header.resolutions; if (header.addons) bundle.addons = header.addons; if (header.assets) bundle.assets = header.assets; let offset = end + len; for (const [file, info] of Object.entries(header.files)) { bundle.write(file, buffer.subarray(offset, offset + info.length), { mode: info.mode || 420 }); offset += info.length; } return bundle; } function isDecimal(c) { return c >= 48 && c <= 57; } function compareKeys([a], [b]) { return a > b ? 1 : a < b ? -1 : 0; } function cloneImportsMap(value) { if (typeof value === "object" && value !== null) { const imports = {}; for (const entry of Object.entries(value).sort(compareKeys)) { imports[entry[0]] = cloneImportsMapEntry(entry[1]); } return imports; } throw new TypeError(`Imports map must be an object. Received type ${typeof value} (${value})`); } function cloneImportsMapEntry(value) { if (typeof value === "string") return value; if (typeof value === "object" && value !== null) { const imports = {}; for (const entry of Object.entries(value)) { imports[entry[0]] = cloneImportsMapEntry(entry[1]); } return imports; } throw new TypeError( `Imports map entry must be a string or object. Received type ${typeof value} (${value})` ); } function cloneResolutionsMap(value) { if (typeof value === "object" && value !== null) { const resolutions = {}; for (const entry of Object.entries(value).sort(compareKeys)) { resolutions[entry[0]] = cloneImportsMap(entry[1]); } return resolutions; } throw new TypeError(`Resolutions map must be an object. Received type ${typeof value} (${value})`); } function cloneFilesList(value, name) { if (Array.isArray(value)) { const files = []; for (const entry of value) { if (typeof entry !== "string") { throw new TypeError( `${name} entry must be a string. Received type ${typeof entry} (${entry})` ); } files.push(entry); } return files.sort(); } throw new TypeError(`${name} list must be an array. Received type ${typeof value} (${value})`); } function transformImportsMap(value, root, conditionalRoot, opts, fn) { const { conditions = {} } = opts; const imports = {}; for (const entry of Object.entries(value)) { const condition = entry[0]; imports[condition] = transformImportsMapEntry( entry[1], root, conditionalRoot || conditions[condition], opts, fn ); } return imports; } function transformImportsMapEntry(value, root, conditionalRoot, opts, fn) { const { conditions = {} } = opts; if (typeof value === "string") { return fn(value, conditionalRoot || conditions.default || root); } return transformImportsMap(value, root, conditionalRoot, opts, fn); } function transformResolutionsMap(value, root, opts, fn) { const resolutions = {}; for (const entry of Object.entries(value)) { resolutions[fn(entry[0], root)] = transformImportsMap(entry[1], root, null, opts, fn); } return resolutions; } function transformFilesList(value, root, fn) { const files = []; for (const entry of value) { files.push(fn(entry, root)); } return files; } function mountSpecifier(specifier, root) { if (startsWithWindowsDriveLetter(specifier)) { specifier = "/" + specifier; } if (specifier[0] === "/" || specifier[0] === "\\") { specifier = "." + specifier; } if (specifier.startsWith("./") || specifier.startsWith(".\\")) { return new URL(specifier, root).href; } return specifier; } function unmountSpecifier(specifier, root) { specifier = new URL(specifier); if (typeof root === "string") root = new URL(root); if (specifier.protocol !== root.protocol || specifier.host !== root.host || specifier.port !== root.port) { return specifier.href; } const specifierPath = splitPath(specifier.pathname); const rootPath = splitPath(root.pathname); while (specifierPath.length > 0 && rootPath[0] === specifierPath[0]) { specifierPath.shift(); rootPath.shift(); } rootPath.fill(".."); return "/" + rootPath.concat(specifierPath).join("/"); } function splitPath(path) { const parts = path.split("/"); if (!parts[0]) parts.shift(); if (!parts[parts.length - 1]) parts.pop(); return parts; } function isASCIIUpperAlpha(c) { return c >= 65 && c <= 90; } function isASCIILowerAlpha(c) { return c >= 97 && c <= 122; } function isASCIIAlpha(c) { return isASCIIUpperAlpha(c) || isASCIILowerAlpha(c); } function isWindowsDriveLetter(input) { return input.length >= 2 && isASCIIAlpha(input.charCodeAt(0)) && (input.charCodeAt(1) === 58 || input.charCodeAt(1) === 124); } function startsWithWindowsDriveLetter(input) { return input.length >= 2 && isWindowsDriveLetter(input) && (input.length === 2 || input.charCodeAt(2) === 47 || input.charCodeAt(2) === 92 || input.charCodeAt(2) === 63 || input.charCodeAt(2) === 35); } } }); // ../../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_errors2 = __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_errors2(); 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, precision: 0 }) { 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 (state.range && (c === "x" || c === "X" || c === "*")) { i++; while (input[i] === ".") { let j = i + 1; while (input[j] >= "0" && input[j] <= "9" || input[j] === "x" || input[j] === "X" || input[j] === "*") { j++; } if (j === i + 1) break; i = j; } break; } 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]/"); } state.precision = k; 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_errors2(); 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) continue; if (version.prerelease.length && !allows(set, version)) continue; 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; let caret = false; let tilde = false; 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]; } else if (c === "^") { caret = true; c = input[++i]; } else if (c === "~") { tilde = true; c = input[++i]; if (c === ">") c = input[++i]; } while (c === " ") c = input[++i]; const state2 = { position: i, partial: true, range: true }; const lower = Version.parse(input, state2); const precision = state2.precision; c = input[i = state2.position]; while (c === " ") c = input[++i]; if (c === "-" && input[i + 1] === " " && operator === constants.EQ && !caret && !tilde) { c = input[++i]; while (c === " ") c = input[++i]; state2.position = i; const high = Version.parse(input, state2); c = input[i = state2.position]; set.push(new Comparator(constants.GTE, lower)); if (state2.precision === 3) { set.push(new Comparator(constants.LTE, high)); } else if (state2.precision === 2) { set.push(upper(high.major, high.minor + 1, 0)); } else if (state2.precision === 1) { set.push(upper(high.major + 1, 0, 0)); } while (c === " ") c = input[++i]; } else { if (caret) { for (const comparator of expandCaret(lower, precision)) set.push(comparator); } else if (tilde) { for (const comparator of expandTilde(lower, precision)) set.push(comparator); } else if (operator === constants.EQ) { for (const comparator of expandPartial(lower, precision)) set.push(comparator); } else { set.push(new Comparator(operator, lower)); } } if (c === "|" && input[i + 1] === "|") { c = input[i += 2]; while (c === " ") c = input[++i]; break; } if (c && c !== "<" && c !== ">" && 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); }; function allows(set, version) { for (const comparator of set) { const target = comparator.version; if (target.prerelease.length && target.major === version.major && target.minor === version.minor && target.patch === version.patch) { return true; } } return false; } function upper(major, minor, patch) { return new Comparator(constants.LT, new Version(major, minor, patch, { prerelease: ["0"] })); } function expandPartial(version, precision) { if (precision === 0) return [new Comparator(constants.GTE, new Version(0, 0, 0))]; if (precision === 3) return [new Comparator(constants.EQ, version)]; const set = [new Comparator(constants.GTE, version)]; if (precision === 1) set.push(upper(version.major + 1, 0, 0)); else set.push(upper(version.major, version.minor + 1, 0)); return set; } function expandCaret(version, precision) { if (precision === 0) return [new Comparator(constants.GTE, new Version(0, 0, 0))]; const { major, minor, patch } = version; const set = [new Comparator(constants.GTE, version)]; if (major !== 0) set.push(upper(major + 1, 0, 0)); else if (precision === 1) set.push(upper(1, 0, 0)); else if (minor !== 0) set.push(upper(0, minor + 1, 0)); else if (precision === 2) set.push(upper(0, 1, 0)); else set.push(upper(0, 0, patch + 1)); return set; } function expandTilde(version, precision) { if (precision === 0) return [new Comparator(constants.GTE, new Version(0, 0, 0))]; const { major, minor } = version; const set = [new Comparator(constants.GTE, version)]; if (precision === 1) set.push(upper(major + 1, 0, 0)); else set.push(upper(major, minor + 1, 0)); return set; } } }); // ../../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_errors2(); 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_errors3 = __commonJS({ "../../node_modules/bare-module-resolve/lib/errors.js"(exports, module) { module.exports = class ModuleResolveError extends Error { constructor(msg, fn = ModuleResolveError, code = fn.name) { 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, ModuleResolveError.INVALID_MODULE_SPECIFIER); } static INVALID_PACKAGE_TARGET(msg) { return new ModuleResolveError(msg, ModuleResolveError.INVALID_PACKAGE_TARGET); } static INVALID_PACKAGE_CONFIGURATION(msg) { return new ModuleResolveError(msg, ModuleResolveError.INVALID_PACKAGE_CONFIGURATION); } static PACKAGE_PATH_NOT_EXPORTED(msg) { return new ModuleResolveError(msg, ModuleResolveError.PACKAGE_PATH_NOT_EXPORTED); } static PACKAGE_IMPORT_NOT_DEFINED(msg) { return new ModuleResolveError(msg, ModuleResolveError.PACKAGE_IMPORT_NOT_DEFINED); } static UNSUPPORTED_ENGINE(msg) { return new ModuleResolveError(msg, 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_errors3(); 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; var CYCLIC = 4; exports.constants = { UNRESOLVED, YIELDED, RESOLVED, CYCLIC }; 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; const yielded = (status & YIELDED) !== 0; status = yield* exports.directory(specifier, parentURL, opts); if (yielded) status |= YIELDED; return status; } 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 && (status & CYCLIC) === 0) 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; const yielded = (status & YIELDED) !== 0; status = yield* exports.directory(packageSubpath, packageURL, opts); if (yielded) status |= YIELDED; return status; } } 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); } } let status = yield* exports.file(packageSubpath, packageURL, false, opts); if (status === RESOLVED) return status; const yielded = (status & YIELDED) !== 0; status = yield* exports.directory(packageSubpath, packageURL, opts); if (yielded) status |= YIELDED; return status; } } return UNRESOLVED; }; exports.packageExports = function* (packageURL, subpath, packageExports, opts = {}) { if (typeof packageExports === "object" && packageExports !== null && !Array.isArray(packageExports)) { const keys = Object.keys(packageExports); const relative = keys.filter((key) => key.startsWith(".")).length; if (relative !== 0 && relative !== keys.length) { throw errors.INVALID_PACKAGE_CONFIGURATION( `"exports" in '${packageURL}' cannot contain some keys starting with '.' and some not` ); } } 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 = [], matchedTargets = [] } = opts; opts = { ...opts, matchedConditions, matchedTargets }; 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); } if (matchedTargets.includes(target)) return CYCLIC; matchedTargets.push(target); let status = yield* exports.url(target, packageURL, opts); if (status) { matchedTargets.pop(); return status; } if (target === "." || target === ".." || target[0] === "/" || target.startsWith("./") || target.startsWith("../")) { if (hasOpaquePath(packageURL)) { matchedTargets.pop(); return UNRESOLVED; } const resolved = yield { resolution: new URL(target, packageURL) }; matchedTargets.pop(); return resolved ? RESOLVED : YIELDED; } status = yield* exports.package(target, packageURL, opts); matchedTargets.pop(); return status; } if (Array.isArray(target)) { let status = UNRESOLVED; for (const targetValue of target) { status |= yield* exports.packageTarget(packageURL, targetValue, patternMatch, isImports, opts); if (status === RESOLVED) return status; } return status; } 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(); } return status; } return UNRESOLVED; }; exports.builtinTarget = function* (packageSpecifier, packageVersion, target, opts = {}) { const { builtinProtocol = "builtin:", conditions = [], matchedConditions = [] } = opts; opts = { ...opts, matchedConditions }; 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; } } return UNRESOLVED; } if (Array.isArray(target)) { let status = UNRESOLVED; for (const targetValue of target) { status |= yield* exports.builtinTarget(packageSpecifier, packageVersion, targetValue, opts); if (status === RESOLVED) return status; } return status; } 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(); } 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) { if (hasOpaquePath(parentURL)) return null; 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; } } if (hasOpaquePath(scopeURL)) return null; 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 (hasOpaquePath(parentURL)) 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 = {}) { if (hasOpaquePath(parentURL)) return UNRESOLVED; 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 !== "") { let status = yield* exports.file(info.main, directoryURL, false, opts); if (status === RESOLVED) return status; const yielded = (status & YIELDED) !== 0; status = yield* exports.directory(info.main, directoryURL, opts); if (yielded) status |= YIELDED; return status; } } return yield* exports.file("index", directoryURL, true, opts); }; function hasOpaquePath(url) { return url.pathname[0] !== "/"; } 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-module-lexer/lib/binding/bare.js var require_bare = __commonJS({ "../../node_modules/bare-module-lexer/lib/binding/bare.js"(exports, module) { module.exports = __require.addon("../.."); } }); // ../../node_modules/bare-module-lexer/index.js var require_bare_module_lexer = __commonJS({ "../../node_modules/bare-module-lexer/index.js"(exports, module) { var binding = require_bare(); module.exports = exports = function lex(input, encoding, opts = {}) { if (typeof encoding === "object" && encoding !== null) { opts = encoding; encoding = null; } if (typeof input !== "string" && !ArrayBuffer.isView(input)) { throw new TypeError(`Input must be a string or buffer. Received type ${typeof input}`); } return binding.lex(typeof input === "string" ? Buffer.from(input, encoding) : input); }; exports.constants = { /** * CommonJS `require()`. */ REQUIRE: binding.REQUIRE, /** * ES module `import`. */ IMPORT: binding.IMPORT, /** * ES module `import()` if `IMPORT` is set. */ DYNAMIC: binding.DYNAMIC, /** * CommonJS `require.addon()` if `REQUIRE` is set, or ES module `import.meta.addon()` if `IMPORT` is set. */ ADDON: binding.ADDON, /** * CommonJS `require.asset()` if `REQUIRE` is set, or ES module `import.meta.asset()` if `IMPORT` is set. */ ASSET: binding.ASSET, /** * CommonJS `require.resolve()` or `require.addon.resolve()` if `REQUIRE` and optionally `ADDON` are set, or ES module * `import.meta.resolve()` or `import.meta.addon.resolve()` if `IMPORT` and optionally `ADDON` are set. */ RESOLVE: binding.RESOLVE, /** * Re-export of a CommonJS `require()` if `REQUIRE` is set. */ REEXPORT: binding.REEXPORT }; } }); // ../../node_modules/bare-mime/index.js var require_bare_mime = __commonJS({ "../../node_modules/bare-mime/index.js"(exports, module) { var MIME = class { constructor(type, subtype, parameters = /* @__PURE__ */ new Map()) { this._type = type; this._subtype = subtype; this._parameters = parameters; } // https://mimesniff.spec.whatwg.org/#type get type() { return this._type; } // https://mimesniff.spec.whatwg.org/#subtype get subtype() { return this._subtype; } // https://mimesniff.spec.whatwg.org/#parameters get parameters() { return this._parameters; } }; module.exports = exports = MIME; exports.parse = function parse(input) { input = input.replace(httpWhitespaceLeadingAndTrailing, ""); let position = 0; let type = ""; while (position < input.length && input[position] !== "/") { type += input[position++]; } if (type === "" || !isHTTPTokenCodePoints(type)) return null; if (position >= input.length) return null; position++; let subtype = ""; while (position < input.length && input[position] !== ";") { subtype += input[position++]; } subtype = subtype.replace(httpWhitespaceTrailing, ""); if (subtype === "" || !isHTTPTokenCodePoints(subtype)) return null; const mimeType = new MIME(type.toLowerCase(), subtype.toLowerCase()); while (position < input.length) { position++; while (position < input.length && httpWhitespace.test(input[position])) { position++; } let parameterName = ""; while (position < input.length && input[position] !== ";" && input[position] !== "=") { parameterName += input[position++]; } parameterName = parameterName.toLowerCase(); if (position < input.length && input[position] === ";") continue; if (position >= input.length) break; position++; let parameterValue; if (position < input.length && input[position] === '"') { parameterValue = collectHTTPQuotedString(input, position); position = parameterValue.position; parameterValue = parameterValue.value; while (position < input.length && input[position] !== ";") { position++; } } else { parameterValue = ""; while (position < input.length && input[position] !== ";") { parameterValue += input[position++]; } parameterValue = parameterValue.replace(httpWhitespaceTrailing, ""); if (parameterValue === "") continue; } if (parameterName !== "" && isHTTPTokenCodePoints(parameterName) && isHTTPQuotedStringTokenCodePoints(parameterValue) && !mimeType._parameters.has(parameterName)) { mimeType._parameters.set(parameterName, parameterValue); } } return mimeType; }; var httpWhitespace = /[\t\n\r ]/; var httpWhitespaceLeadingAndTrailing = /^[\t\n\r ]+|[\t\n\r ]+$/g; var httpWhitespaceTrailing = /[\t\n\r ]+$/; var httpTokenCodePoints = /^[!#$%&'*+\-.^_`|~A-Za-z0-9]+$/; var httpQuotedStringTokenCodePoints = /^[\t\x20-\x7e\x80-\xff]*$/; function isHTTPTokenCodePoints(s) { return httpTokenCodePoints.test(s); } function isHTTPQuotedStringTokenCodePoints(s) { return httpQuotedStringTokenCodePoints.test(s); } function collectHTTPQuotedString(input, position) { let value = ""; position++; while (true) { while (position < input.length && input[position] !== '"' && input[position] !== "\\") { value += input[position++]; } if (position >= input.length) break; const quoteOrBackslash = input[position++]; if (quoteOrBackslash === "\\") { if (position >= input.length) { value += "\\"; break; } value += input[position++]; } else { break; } } return { value, position }; } } }); // ../../node_modules/bare-addon-resolve/lib/errors.js var require_errors4 = __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_errors4(); 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); if (hasOpaquePath(parentURL)) return UNRESOLVED; 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 = {}) { if (hasOpaquePath(url)) return; 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 (hasOpaquePath(parentURL)) 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; if (hasOpaquePath(parentURL)) return UNRESOLVED; 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"; } function hasOpaquePath(url) { return url.pathname[0] !== "/"; } } }); // ../../node_modules/bare-module-traverse/lib/resolve/default.js var require_default = __commonJS({ "../../node_modules/bare-module-traverse/lib/resolve/default.js"(exports, module) { var lex = require_bare_module_lexer(); var resolve = require_resolve(); module.exports = function(entry, parentURL, opts) { if (entry.type & lex.constants.ADDON) { return resolve.addon(entry.specifier || ".", parentURL, opts); } return resolve.module(entry.specifier, parentURL, opts); }; } }); // ../../node_modules/bare-module-traverse/lib/runtime/bare.js var require_bare2 = __commonJS({ "../../node_modules/bare-module-traverse/lib/runtime/bare.js"(exports) { exports.host = Bare.Addon.host; } }); // ../../node_modules/bare-module-traverse/lib/runtime.js var require_runtime = __commonJS({ "../../node_modules/bare-module-traverse/lib/runtime.js"(exports, module) { module.exports = require_bare2(); } }); // ../../node_modules/bare-module-traverse/lib/resolve/bare.js var require_bare3 = __commonJS({ "../../node_modules/bare-module-traverse/lib/resolve/bare.js"(exports, module) { var lex = require_bare_module_lexer(); var resolve = require_resolve(); var runtime = require_runtime(); module.exports = function(entry, parentURL, opts = {}) { const { linked = false, host = runtime.host, hosts = [host] } = opts; let extensions; let conditions = hosts.map((host2) => ["bare", "node", ...host2.split("-")]); if (entry.type & lex.constants.ADDON) { extensions = linked ? [] : [".bare", ".node"]; conditions = conditions.map((conditions2) => ["addon", ...conditions2]); return resolve.addon(entry.specifier || ".", parentURL, { ...opts, extensions, conditions, hosts, linked }); } if (entry.type & lex.constants.ASSET) { conditions = conditions.map((conditions2) => ["asset", ...conditions2]); } else { extensions = [".js", ".cjs", ".mjs", ".ts", ".cts", ".mts", ".json", ".bare", ".node"]; if (entry.type & lex.constants.REQUIRE) { conditions = conditions.map((conditions2) => ["require", ...conditions2]); } else if (entry.type & lex.constants.IMPORT) { conditions = conditions.map((conditions2) => ["import", ...conditions2]); } } return resolve.module(entry.specifier, parentURL, { ...opts, extensions, conditions }); }; } }); // ../../node_modules/bare-module-traverse/lib/resolve/node.js var require_node = __commonJS({ "../../node_modules/bare-module-traverse/lib/resolve/node.js"(exports, module) { var lex = require_bare_module_lexer(); var resolve = require_resolve(); var runtime = require_runtime(); module.exports = function(entry, parentURL, opts = {}) { const { host = runtime.host, hosts = [host] } = opts; let extensions; let conditions = hosts.map((host2) => ["node", ...host2.split("-")]); if (entry.type & lex.constants.ADDON) { extensions = [".node"]; conditions = conditions.map((conditions2) => ["addon", ...conditions2]); return resolve.addon(entry.specifier || ".", parentURL, { ...opts, extensions, conditions, hosts }); } if (entry.type & lex.constants.ASSET) { conditions = conditions.map((conditions2) => ["asset", ...conditions2]); } else if (entry.type & lex.constants.REQUIRE) { extensions = [".js", ".json", ".node"]; conditions = conditions.map((conditions2) => ["require", ...conditions2]); } else if (entry.type & lex.constants.IMPORT) { conditions = conditions.map((conditions2) => ["import", ...conditions2]); } return resolve.module(entry.specifier, parentURL, { ...opts, extensions, conditions }); }; } }); // ../../node_modules/bare-module-traverse/lib/resolve.js var require_resolve = __commonJS({ "../../node_modules/bare-module-traverse/lib/resolve.js"(exports) { exports.module = require_bare_module_resolve().module; exports.addon = require_bare_addon_resolve().addon; exports.default = require_default(); exports.bare = require_bare3(); exports.node = require_node(); } }); // ../../node_modules/bare-module-traverse/lib/errors.js var require_errors5 = __commonJS({ "../../node_modules/bare-module-traverse/lib/errors.js"(exports, module) { module.exports = class ModuleTraverseError extends Error { constructor(msg, fn = ModuleTraverseError, code = fn.name) { super(`${code}: ${msg}`); this.code = code; if (Error.captureStackTrace) Error.captureStackTrace(this, fn); } get name() { return "ModuleTraverseError"; } static MODULE_NOT_FOUND(msg, specifier, referrer = null, candidates = []) { const err = new ModuleTraverseError(msg, ModuleTraverseError.MODULE_NOT_FOUND); err.specifier = specifier; err.referrer = referrer; err.candidates = candidates; return err; } static ADDON_NOT_FOUND(msg, specifier, referrer = null, candidates = []) { const err = new ModuleTraverseError(msg, ModuleTraverseError.ADDON_NOT_FOUND); err.specifier = specifier; err.referrer = referrer; err.candidates = candidates; return err; } static ASSET_NOT_FOUND(msg, specifier, referrer = null, candidates = []) { const err = new ModuleTraverseError(msg, ModuleTraverseError.ASSET_NOT_FOUND); err.specifier = specifier; err.referrer = referrer; err.candidates = candidates; return err; } static INVALID_IMPORTS_MAP(msg) { return new ModuleTraverseError(msg, ModuleTraverseError.INVALID_IMPORTS_MAP); } static TYPE_INCOMPATIBLE(msg) { return new ModuleTraverseError(msg, ModuleTraverseError.TYPE_INCOMPATIBLE); } static UNKNOWN_DATA_URL_CHARSET(msg, charset) { const err = new ModuleTraverseError(msg, ModuleTraverseError.UNKNOWN_DATA_URL_CHARSET); err.charset = charset; return err; } }; } }); // ../../node_modules/bare-module-traverse/index.js var require_bare_module_traverse = __commonJS({ "../../node_modules/bare-module-traverse/index.js"(exports, module) { var { lookupPackageScope, conditionMatches } = require_bare_module_resolve(); var lex = require_bare_module_lexer(); var MIME = require_bare_mime(); var resolve = require_resolve(); var errors = require_errors5(); var constants = { SCRIPT: 1, MODULE: 2, JSON: 3, BUNDLE: 4, ADDON: 5, BINARY: 6, TEXT: 7 }; function defaultResolveModule(url) { return url; } function defaultProbeModule() { return void 0; } module.exports = exports = function traverse(entry, opts, readModule, listPrefix, probeModule, resolveModule) { if (typeof opts === "function") { resolveModule = probeModule; probeModule = listPrefix; listPrefix = readModule; readModule = opts; opts = {}; } if (typeof resolveModule !== "function") resolveModule = defaultResolveModule; if (typeof probeModule !== "function") probeModule = defaultProbeModule; return { *[Symbol.iterator]() { const artifacts = { addons: [], assets: [] }; const visited = opts.visited || /* @__PURE__ */ new Set(); const queue = [exports.module(entry, null, {}, artifacts, visited, opts)]; const deferred = []; function* drive(generator) { let next = generator.next(); while (next.done !== true) { const value = next.value; if (value.module) { next = generator.next(readModule(value.module)); } else if (value.probe) { next = generator.next(probeModule(value.probe)); } else if (value.resolution) { next = generator.next(resolveModule(value.resolution)); } else if (value.prefix) { const result = []; if (typeof listPrefix === "function") { for (const url of listPrefix(value.prefix)) { result.push(url); } } else { if (readModule(value.prefix) !== null) { result.push(value.prefix); } } next = generator.next(result); } else if (value.links) { for (const link of value.links) yield* drive(link); next = generator.next(); } else if (value.children) { if (value.deferred) deferred.push(value.children); else queue.push(value.children); next = generator.next(); } else { yield value.dependency; next = generator.next(); } } } while (queue.length > 0 || deferred.length > 0) { yield* drive(queue.length > 0 ? queue.pop() : deferred.shift()); } return artifacts; }, async *[Symbol.asyncIterator]() { const artifacts = { addons: [], assets: [] }; const visited = opts.visited || /* @__PURE__ */ new Set(); const queue = [exports.module(entry, null, {}, artifacts, visited, opts)]; const deferred = []; async function* drive(generator) { let next = generator.next(); while (next.done !== true) { const value = next.value; if (value.module) { next = generator.next(await readModule(value.module)); } else if (value.probe) { next = generator.next(await probeModule(value.probe)); } else if (value.resolution) { next = generator.next(await resolveModule(value.resolution)); } else if (value.prefix) { const result = []; if (typeof listPrefix === "function") { for await (const url of listPrefix(value.prefix)) { result.push(url); } } else { if (await readModule(value.prefix) !== null) { result.push(value.prefix); } } next = generator.next(result); } else if (value.links) { for (const link of value.links) yield* drive(link); next = generator.next(); } else if (value.children) { if (value.deferred) deferred.push(value.children); else queue.push(value.children); next = generator.next(); } else { yield value.dependency; next = generator.next(); } } } while (queue.length > 0 || deferred.length > 0) { yield* drive(queue.length > 0 ? queue.pop() : deferred.shift()); } return artifacts; } }; }; exports.constants = constants; exports.resolve = resolve; exports.alias = function alias(url, opts = {}) { const { aliases = null } = opts; if (aliases === null) return url; const match = url.pathname.match(/\.[a-z]+$/); if (match === null) return url; const [extension] = match; if (extension in aliases === false) return url; url = new URL(url); url.pathname = url.pathname.slice(0, -extension.length) + aliases[extension]; return url; }; exports.module = function* (url, source, attributes, artifacts, visited, opts = {}) { const { resolutions = null, asset = false, probed } = opts; if (visited.has(url.href)) return false; visited.add(url.href); if (probed !== void 0) opts = { ...opts, probed: void 0 }; attributes = attributes || {}; const artifact = asset === true || moduleType(url, attributes, null, opts) === constants.ADDON; if (source === null) { if (url.protocol === "data:") { source = decodeDataURL(url); } else { const exists = probed !== void 0 ? probed : artifact ? yield { probe: url } : void 0; if (exists === false) { throw errors.MODULE_NOT_FOUND(`Cannot find module '${url.href}'`, url.href); } source = yield { module: url, artifact }; if (exists !== true && source === null) { throw errors.MODULE_NOT_FOUND(`Cannot find module '${url.href}'`, url.href); } } } if (resolutions) { if (yield* exports.preresolved(url, source, resolutions, artifacts, visited, opts)) { return true; } } const imports = {}; let info = null; if (url.protocol !== "data:") { for (const packageURL of lookupPackageScope(url, opts)) { const source2 = yield { module: packageURL, artifact: false }; if (source2 !== null) { info = JSON.parse(source2); imports["#package"] = packageURL.href; yield { children: exports.package(packageURL, source2, artifacts, visited, opts), deferred: false }; break; } } } if (typeof attributes.imports === "string") { const url2 = new URL(attributes.imports); const source2 = yield { module: url2, artifact: false }; if (source2 !== null) { opts = { ...opts, imports: mixinImports(opts.imports, JSON.parse(source2), url2) }; } } const type = moduleType(url, attributes, info, opts); const lexer = { imports: [], exports: [] }; if (asset === false) { if (type === constants.SCRIPT || type === constants.MODULE) { yield* exports.imports(url, source, imports, artifacts, lexer, visited, { ...opts, referrerType: type }); } else if (type === constants.ADDON) { yield* exports.addons(url, artifacts, visited, opts); } } yield { dependency: { url: exports.alias(url, opts), source, type, imports: compressImportsMap(imports), lexer } }; return true; }; exports.package = function* (url, source, artifacts, visited, opts = {}) { if (visited.has(url.href)) return false; visited.add(url.href); if (source === null) { source = yield { module: url, artifact: false }; if (source === null) return false; } const info = JSON.parse(source); if (info) { yield { dependency: { url, source, type: constants.JSON, imports: {}, lexer: { imports: [], exports: [] } } }; if (info.assets) { yield { children: exports.assets(info.assets, url, artifacts, visited, opts), deferred: false }; } return true; } return false; }; exports.preresolved = function* (url, source, resolutions, artifacts, visited, opts = {}) { const { builtinProtocol = "builtin:", linkedProtocol = "linked:", deferredProtocol = "deferred:" } = opts; const imports = resolutions[url.href]; if (typeof imports !== "object" || imports === null) return false; const type = moduleType(url, {}, null, opts); for (const [specifier, entry] of Object.entries(imports)) { const stack = [{ entry, asset: false }]; while (stack.length > 0) { const { entry: entry2, asset } = stack.pop(); if (typeof entry2 === "string") { const url2 = new URL(entry2); if (specifier === "#package") { yield { children: exports.package(url2, null, artifacts, visited, opts), deferred: false }; } else if (asset) { addURL(artifacts.assets, url2); yield { children: exports.module(url2, null, {}, artifacts, visited, { ...opts, asset: true, referrerType: type }), deferred: true }; } else if (url2.protocol !== builtinProtocol && url2.protocol !== linkedProtocol && url2.protocol !== deferredProtocol) { yield { children: exports.module(url2, null, {}, artifacts, visited, { ...opts, referrerType: type }), deferred: false }; } } else { for (const [condition, child] of Object.entries(entry2)) { stack.push({ entry: child, asset: asset || condition === "asset" }); } } } } const lexer = { imports: [], exports: [] }; if (type === constants.SCRIPT || type === constants.MODULE) { lexer.exports = lex(source).exports; } yield { dependency: { url: exports.alias(url, opts), source, type, imports: compressImportsMap(imports), lexer } }; return true; }; exports.imports = function* (parentURL, source, imports, artifacts, lexer, visited, opts = {}) { const lexed = lex(source); lexer.exports = lexed.exports; const links = []; for (const entry of lexed.imports) { let specifier = entry.specifier; let condition = "default"; if (entry.type & lex.constants.ADDON) { specifier = specifier || "."; condition = "addon"; } else if (entry.type & lex.constants.ASSET) { condition = "asset"; } else if (entry.type & lex.constants.REQUIRE) { condition = "require"; } else if (entry.type & lex.constants.IMPORT) { condition = "import"; } lexer.imports.push(entry); links.push( exports.link(entry, specifier, condition, parentURL, imports, artifacts, visited, opts) ); } yield { links }; }; exports.link = function* (entry, specifier, condition, parentURL, imports, artifacts, visited, opts = {}) { if (entry.attributes.imports) { const specifier2 = entry.attributes.imports; yield* resolveImport( { type: 0, specifier: specifier2, names: [], attributes: {}, position: [0, 0, 0] }, specifier2, "default", parentURL, imports, artifacts, visited, opts ); } yield* resolveImport(entry, specifier, condition, parentURL, imports, artifacts, visited, opts); }; function* resolveImport(entry, specifier, condition, parentURL, imports, artifacts, visited, opts) { const { resolve: resolve2 = exports.resolve.default, builtinProtocol = "builtin:", linkedProtocol = "linked:", deferredProtocol = "deferred:" } = opts; const matchedConditions = []; opts = { ...opts, matchedConditions }; matchedConditions.push(condition); const resolver = resolve2(entry, parentURL, opts); const candidates = []; let next = resolver.next(); let resolutions = 0; while (next.done !== true) { const value = next.value; if (value.package) { next = resolver.next(JSON.parse(yield { module: value.package, artifact: false })); } else { const url = value.resolution; candidates.push(url); let resolved = false; let resolution = url; if (url.protocol === builtinProtocol || url.protocol === linkedProtocol || url.protocol === deferredProtocol) { addResolution(imports, specifier, matchedConditions, url); resolved = true; } else if (condition === "asset") { const prefix = url; for (const url2 of yield { prefix }) { const resolution2 = yield* postresolve(url2); yield { children: exports.module(resolution2, null, {}, artifacts, visited, { ...opts, asset: true }), deferred: true }; addURL(artifacts.assets, resolution2); resolved = true; } if (resolved) addResolution(imports, specifier, matchedConditions, url); } else if (condition === "addon" || moduleType(url, entry.attributes, null, opts) === constants.ADDON) { let exists = yield { probe: url }; let source = null; if (exists === void 0) { source = yield { module: url, artifact: false }; exists = source !== null; } if (exists) { resolution = yield* postresolve(url); addResolution(imports, specifier, matchedConditions, exports.alias(resolution, opts)); yield { children: exports.module(resolution, source, {}, artifacts, visited, { ...opts, probed: true }), deferred: false }; resolved = true; } } else { let source; if (url.protocol === "data:") { source = decodeDataURL(url); } else { source = yield { module: url, artifact: false }; } if (source !== null) { resolution = yield* postresolve(url); addResolution(imports, specifier, matchedConditions, exports.alias(resolution, opts)); let attributes = entry.attributes; if (attributes.imports) { attributes = { ...attributes, imports: imports[attributes.imports].default }; } yield { children: exports.module(resolution, source, attributes, artifacts, visited, opts), deferred: false }; resolved = true; } } if (resolved) { if (condition === "addon") addURL(artifacts.addons, resolution); resolutions++; } next = resolver.next(resolved); } } matchedConditions.pop(); if (resolutions === 0) { let message = `Cannot find ${condition === "addon" || condition === "asset" ? condition : "module"} '${specifier}' imported from '${parentURL.href}'`; if (candidates.length > 0) { message += "\nCandidates:"; message += "\n" + candidates.map((url) => "- " + url.href).join("\n"); } switch (condition) { case "addon": throw errors.ADDON_NOT_FOUND(message, specifier, parentURL, candidates); case "asset": throw errors.ASSET_NOT_FOUND(message, specifier, parentURL, candidates); default: throw errors.MODULE_NOT_FOUND(message, specifier, parentURL, candidates); } } } var ADDON_EXTENSION = /\.(bare|node)$/; exports.addons = function* (parentURL, artifacts, visited, opts = {}) { let yielded = false; if (ADDON_EXTENSION.test(parentURL.pathname)) { const prefix = new URL(parentURL); prefix.pathname = prefix.pathname.replace(ADDON_EXTENSION, "") + "/"; for (const url of yield { prefix }) { const resolution = yield* postresolve(url); yield { children: exports.module(resolution, null, {}, artifacts, visited, opts), deferred: false }; addURL(artifacts.addons, resolution); yielded = true; } } return yielded; }; exports.assets = function* (patterns, parentURL, artifacts, visited, opts = {}) { const matches = yield* exports.patternMatches(patterns, parentURL, [], opts); let yielded = false; for (const url of matches) { const resolution = yield* postresolve(url); addURL(artifacts.assets, resolution); yield { children: exports.module(resolution, null, {}, artifacts, visited, { ...opts, asset: true }), deferred: true }; yielded = true; } return yielded; }; exports.patternMatches = function* patternMatches(pattern, parentURL, matches, opts = {}) { const { conditions = [], matchedConditions = [] } = opts; if (typeof pattern === "string") { let patternNegate = false; let patternBase; let patternTrailer; if (pattern[0] === "!") { pattern = pattern.substring(1); patternNegate = true; } const patternIndex = pattern.indexOf("*"); if (patternIndex === -1) { patternBase = pattern; patternTrailer = ""; } else { patternBase = pattern.substring(0, patternIndex); patternTrailer = pattern.substring(patternIndex + 1); } const prefix = new URL(patternBase, parentURL); for (const url of yield { prefix }) { if (patternIndex === -1) { if (patternNegate) removeURL(matches, url); else addURL(matches, url); } else if (patternTrailer === "" || url.href.endsWith(patternTrailer)) { if (patternNegate) removeURL(matches, url); else addURL(matches, url); } } } else if (Array.isArray(pattern)) { for (const patternValue of pattern) { yield* patternMatches(patternValue, parentURL, matches, opts); } } else if (typeof pattern === "object" && pattern !== null) { let yielded = false; for (const [condition, patternValue, subset] of conditionMatches(pattern, conditions, opts)) { matchedConditions.push(condition); if (yield* patternMatches(patternValue, parentURL, matches, { ...opts, conditions: subset })) { yielded = true; } matchedConditions.pop(); } if (yielded) return true; } return matches; }; function* postresolve(url) { return (yield { resolution: url }) || url; } function moduleType(url, attributes, info, opts = {}) { const { defaultType = constants.SCRIPT, aliases = null } = opts; if (url.protocol === "data:") { return dataURLModuleType(url, attributes, opts); } if (typeof attributes.type === "string") { return typeForAttribute(attributes.type); } const match = url.pathname.match(/\.[a-z]+$/); if (match === null) return defaultType; let [extension] = match; if (aliases !== null && extension in aliases) extension = aliases[extension]; switch (extension) { case ".js": case ".ts": return defaultType === constants.MODULE || info !== null && info.type === "module" ? constants.MODULE : constants.SCRIPT; case ".cjs": case ".cts": return constants.SCRIPT; case ".mjs": case ".mts": return constants.MODULE; case ".json": return constants.JSON; case ".bundle": return constants.BUNDLE; case ".bare": case ".node": return constants.ADDON; case ".bin": return constants.BINARY; case ".txt": return constants.TEXT; } return defaultType; } function typeForAttribute(type) { switch (type) { case "script": return constants.SCRIPT; case "module": return constants.MODULE; case "json": return constants.JSON; case "bundle": return constants.BUNDLE; case "addon": return constants.ADDON; case "binary": return constants.BINARY; case "text": return constants.TEXT; } return 0; } function dataURLModuleType(url, attributes, opts = {}) { const { defaultType = constants.SCRIPT, referrerType } = opts; const { mime } = parseDataURL(url); const asserted = typeof attributes.type === "string" ? typeForAttribute(attributes.type) : null; if (mime === null || mime.subtype === "javascript") { if (asserted === constants.SCRIPT || asserted === constants.MODULE) return asserted; if (asserted !== null) { throw errors.TYPE_INCOMPATIBLE(`Module '${url.href}' is not of type '${attributes.type}'`); } if (referrerType) return referrerType; return defaultType === constants.MODULE ? constants.MODULE : constants.SCRIPT; } let type; if (mime.subtype === "json") { type = constants.JSON; } else if (mime.type === "text") { type = constants.TEXT; } else if (mime.subtype === "octet-stream") { type = constants.BINARY; } else { throw errors.TYPE_INCOMPATIBLE( `Media type '${mime.type}/${mime.subtype}' of '${url.href}' is not supported` ); } if (asserted !== null && asserted !== type) { throw errors.TYPE_INCOMPATIBLE(`Module '${url.href}' is not of type '${attributes.type}'`); } return type; } function parseDataURL(url) { const { pathname } = url; const comma = pathname.indexOf(","); const meta = comma === -1 ? pathname : pathname.slice(0, comma); const data = comma === -1 ? "" : pathname.slice(comma + 1); const base64 = /;base64$/i.test(meta); return { mime: MIME.parse(meta), base64, data }; } function decodeDataURL(url) { const { mime, base64, data } = parseDataURL(url); const charset = mime === null ? void 0 : mime.parameters.get("charset"); if (charset !== void 0 && !/^utf-?8$/i.test(charset)) { throw errors.UNKNOWN_DATA_URL_CHARSET( `Unsupported charset '${charset}' in data URL '${url.href}'`, charset ); } if (base64) return Buffer.from(data, "base64"); return decodeURIComponent(data); } function addURL(collection, url) { if (Array.isArray(collection)) { let lo = 0; let hi = collection.length - 1; while (lo <= hi) { const mid = lo + (hi - lo >> 1); const found = collection[mid]; if (found.href === url.href) return; if (found.href < url.href) { lo = mid + 1; } else { hi = mid - 1; } } collection.splice(lo, 0, url); } else { collection.add(url.href); } } function removeURL(array, url) { let lo = 0; let hi = array.length - 1; while (lo <= hi) { const mid = lo + (hi - lo >> 1); const found = array[mid]; if (found.href === url.href) break; if (found.href < url.href) { lo = mid + 1; } else { hi = mid - 1; } } if (array[lo].href === url.href) array.splice(lo, 1); } function addResolution(imports, specifier, conditions, url) { imports[specifier] = imports[specifier] || {}; let current = imports[specifier]; for (let i = 0, n = conditions.length - 1; i < n; i++) { const key = conditions[i]; if (key in current === false) { current[key] = {}; } else if (typeof current[key] !== "object") { current[key] = { default: current[key] }; } current = current[key]; } const last = conditions[conditions.length - 1]; current[last] = url.href; if ("default" in current) { const value = current.default; delete current.default; current.default = value; } } function compressImportsMap(imports) { const entries = []; for (const entry of Object.entries(imports)) { entry[1] = compressImportsMapEntry(entry[1]); entries.push(entry); } return Object.fromEntries(entries); } function compressImportsMapEntry(resolved) { if (typeof resolved === "string") return resolved; let entries = []; let primary = null; for (const entry of Object.entries(resolved)) { entry[1] = compressImportsMapEntry(entry[1]); entries.push(entry); if (entry[0] === "default") primary = entry[1]; } if (entries.length === 0) return resolved; const [, first] = entries[0]; if (entries.every(([, resolved2]) => resolved2 === first)) return first; entries = entries.filter( ([condition, resolved2]) => condition === "default" || resolved2 !== primary ); if (entries.length === 1) return entries[0][1]; return Object.fromEntries(entries); } function mixinImports(target, imports, url) { if (typeof imports === "object" && imports !== null && "imports" in imports) { imports = imports.imports; } if (typeof imports !== "object" || imports === null) { throw errors.INVALID_IMPORTS_MAP(`Imports map at '${url.href}' is not valid`); } return { ...target, ...imports }; } } }); // ../../node_modules/bare-pack/lib/preset/android.js var require_android = __commonJS({ "../../node_modules/bare-pack/lib/preset/android.js"(exports, module) { module.exports = { linked: true, hosts: ["android-arm", "android-arm64", "android-ia32", "android-x64"] }; } }); // ../../node_modules/bare-pack/lib/preset/darwin.js var require_darwin = __commonJS({ "../../node_modules/bare-pack/lib/preset/darwin.js"(exports, module) { module.exports = { hosts: ["darwin-arm64", "darwin-x64"] }; } }); // ../../node_modules/bare-pack/lib/preset/desktop.js var require_desktop = __commonJS({ "../../node_modules/bare-pack/lib/preset/desktop.js"(exports, module) { module.exports = { hosts: ["darwin-arm64", "darwin-x64", "linux-arm64", "linux-x64", "win32-arm64", "win32-x64"] }; } }); // ../../node_modules/bare-pack/lib/preset/ios.js var require_ios = __commonJS({ "../../node_modules/bare-pack/lib/preset/ios.js"(exports, module) { module.exports = { linked: true, hosts: ["ios-arm64", "ios-arm64-simulator", "ios-x64-simulator"] }; } }); // ../../node_modules/bare-pack/lib/preset/linux.js var require_linux = __commonJS({ "../../node_modules/bare-pack/lib/preset/linux.js"(exports, module) { module.exports = { hosts: ["linux-arm64", "linux-x64"] }; } }); // ../../node_modules/bare-pack/lib/preset/mobile.js var require_mobile = __commonJS({ "../../node_modules/bare-pack/lib/preset/mobile.js"(exports, module) { module.exports = { linked: true, hosts: [ "android-arm", "android-arm64", "android-ia32", "android-x64", "ios-arm64", "ios-arm64-simulator", "ios-x64-simulator" ] }; } }); // ../../node_modules/bare-pack/lib/preset/win32.js var require_win32 = __commonJS({ "../../node_modules/bare-pack/lib/preset/win32.js"(exports, module) { module.exports = { hosts: ["win32-arm64", "win32-x64"] }; } }); // ../../node_modules/bare-pack/lib/preset.js var require_preset = __commonJS({ "../../node_modules/bare-pack/lib/preset.js"(exports) { exports.android = require_android(); 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-pack/index.js var require_bare_pack = __commonJS({ "../../node_modules/bare-pack/index.js"(exports, module) { var Semaphore = require_promaphore(); var Bundle = require_bare_bundle(); var traverse = require_bare_module_traverse(); var preset = require_preset(); module.exports = async function pack(entry, opts, readModule, listPrefix, writeFile) { if (typeof opts === "function") { writeFile = listPrefix; listPrefix = readModule; readModule = opts; opts = {}; } if (!listPrefix) listPrefix = defaultListPrefix(readModule); if (!writeFile) writeFile = defaultWriteFile; opts = withPreset(opts); let { concurrency = 0, base = null, offload = false, builtinProtocol = "builtin:", linkedProtocol = "linked:", deferredProtocol = "deferred:" } = opts; if (base !== null) base = new URL(base); const offloadAddons = offload === true || offload && offload.addons === true; const offloadAssets = offload === true || offload && offload.assets === true; const semaphore = concurrency > 0 ? new Semaphore(concurrency) : null; let bundle = new Bundle(); const addons = /* @__PURE__ */ new Set(); const assets = /* @__PURE__ */ new Set(); const dependencies = []; const deferred = []; await collect( traverse.module(entry, await readModule(entry), null, { addons, assets }, /* @__PURE__ */ new Set(), opts) ); while (deferred.length > 0) { await Promise.all(deferred.splice(0).map(collect)); } const rewrites = /* @__PURE__ */ new Map(); await Promise.all(dependencies.map(process)); const main = traverse.alias(entry, opts); for (const { url, source, imports } of dependencies) { if (shouldOffload(url.href)) continue; bundle.write(url.href, source, { main: url.href === main.href, imports }); } bundle.addons = [...addons].filter((href) => !shouldOffload(href)).sort(); bundle.assets = [...assets].filter((href) => !shouldOffload(href)).sort(); if (base !== null) bundle = bundle.unmount(base); if (rewrites.size > 0) { const resolutions = {}; for (const [key, value] of Object.entries(bundle.resolutions)) { resolutions[key] = rewriteImportsMap(value, rewrites); } bundle.resolutions = resolutions; } return bundle; function shouldOffload(href) { if (href.startsWith(builtinProtocol)) return false; if (href.startsWith(linkedProtocol)) return false; if (href.startsWith(deferredProtocol)) return false; return offloadAddons && addons.has(href) || offloadAssets && assets.has(href); } function postUnmountPath(url) { if (base === null || url.protocol !== base.protocol || url.host !== base.host || url.port !== base.port) { return url.href; } let basePath = base.pathname; if (!basePath.endsWith("/")) basePath += "/"; if (!url.pathname.startsWith(basePath)) return url.href; return "/" + url.pathname.slice(basePath.length); } async function process({ url, source }) { if (!shouldOffload(url.href)) return; if (semaphore !== null) await semaphore.wait(); const target = await writeFile(url, source); let key = postUnmountPath(url); let value = null; if (target) value = String(target); else if (base !== null) value = "/.." + key; if (value !== null) { rewrites.set(key, value); for (; ; ) { key = key.substring(0, key.lastIndexOf("/")); if (isTerminator(key)) break; value = value.substring(0, value.lastIndexOf("/")); if (isTerminator(value)) break; rewrites.set(key, value); } } if (semaphore !== null) semaphore.signal(); } async function collect(generator) { if (semaphore !== null) await semaphore.wait(); const queue = []; let next = generator.next(); while (next.done !== true) { const value = next.value; if (value.module) { next = generator.next(await readModule(value.module)); } else if (value.probe) { next = generator.next(); } else if (value.resolution) { next = generator.next(value.resolution); } else if (value.prefix) { const result = []; for await (const url of listPrefix(value.prefix)) { result.push(url); } next = generator.next(result); } else if (value.links) { if (semaphore !== null) semaphore.signal(); await Promise.all(value.links.map(collect)); if (semaphore !== null) await semaphore.wait(); next = generator.next(); } else if (value.children) { if (value.deferred) deferred.push(value.children); else queue.push(value.children); next = generator.next(); } else { dependencies.push(value.dependency); next = generator.next(); } } if (semaphore !== null) semaphore.signal(); await Promise.all(queue.map(collect)); } }; function withPreset(opts = {}) { if (opts.preset) { if (opts.preset in preset === false) { throw new Error(`Unknown preset '${opts.preset}'`); } opts = Object.assign({}, opts, preset[opts.preset]); } return opts; } function defaultListPrefix(readModule) { return async function* listPrefix(prefix) { if (await readModule(prefix) !== null) { yield prefix; } }; } function defaultWriteFile() { return null; } function isTerminator(input) { return input === "" || input.endsWith("/") || input.endsWith(":"); } function rewriteImportsMap(imports, rewrites) { if (rewrites.size === 0 || typeof imports !== "object" || imports === null) return null; return transformImportsMap(imports, (value) => rewrites.get(value) || value); } function transformImportsMap(value, fn) { const imports = {}; for (const entry of Object.entries(value)) { const condition = entry[0]; imports[condition] = transformImportsMapEntry(entry[1], fn); } return imports; } function transformImportsMapEntry(value, fn) { if (typeof value === "string") return fn(value); return transformImportsMap(value, fn); } } }); // ../../bare-lib-entry-barePack.js var bare_lib_entry_barePack_exports = {}; __export(bare_lib_entry_barePack_exports, { default: () => bare_lib_entry_barePack_default }); var import_bare_pack = __toESM(require_bare_pack()); var bare_lib_entry_barePack_default = import_bare_pack.default; return __toCommonJS(bare_lib_entry_barePack_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]["barePack"]=v;})();