First Commit

This commit is contained in:
shadowdao committed 2025-08-28 19:35:28 -07:00
commit 264e65006a
488 files changed
+155661

No files matched your search

+274
View File
@@ -0,0 +1,274 @@
"use strict";
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 __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);
var config_exports = {};
__export(config_exports, {
FullConfigInternal: () => FullConfigInternal,
FullProjectInternal: () => FullProjectInternal,
builtInReporters: () => builtInReporters,
defaultGrep: () => defaultGrep,
defaultReporter: () => defaultReporter,
defaultTimeout: () => defaultTimeout,
getProjectId: () => getProjectId,
takeFirst: () => takeFirst,
toReporters: () => toReporters
});
module.exports = __toCommonJS(config_exports);
var import_fs = __toESM(require("fs"));
var import_os = __toESM(require("os"));
var import_path = __toESM(require("path"));
var import_util = require("../util");
const defaultTimeout = 3e4;
class FullConfigInternal {
constructor(location, userConfig, configCLIOverrides, metadata) {
this.projects = [];
this.cliArgs = [];
this.cliListOnly = false;
this.preOnlyTestFilters = [];
this.postShardTestFilters = [];
this.defineConfigWasUsed = false;
this.globalSetups = [];
this.globalTeardowns = [];
if (configCLIOverrides.projects && userConfig.projects)
throw new Error(`Cannot use --browser option when configuration file defines projects. Specify browserName in the projects instead.`);
const { resolvedConfigFile, configDir } = location;
const packageJsonPath = (0, import_util.getPackageJsonPath)(configDir);
const packageJsonDir = packageJsonPath ? import_path.default.dirname(packageJsonPath) : process.cwd();
this.configDir = configDir;
this.configCLIOverrides = configCLIOverrides;
const privateConfiguration = userConfig["@playwright/test"];
this.plugins = (privateConfiguration?.plugins || []).map((p) => ({ factory: p }));
this.singleTSConfigPath = pathResolve(configDir, userConfig.tsconfig);
this.captureGitInfo = userConfig.captureGitInfo;
this.failOnFlakyTests = takeFirst(configCLIOverrides.failOnFlakyTests, userConfig.failOnFlakyTests, false);
this.globalSetups = (Array.isArray(userConfig.globalSetup) ? userConfig.globalSetup : [userConfig.globalSetup]).map((s) => resolveScript(s, configDir)).filter((script) => script !== void 0);
this.globalTeardowns = (Array.isArray(userConfig.globalTeardown) ? userConfig.globalTeardown : [userConfig.globalTeardown]).map((s) => resolveScript(s, configDir)).filter((script) => script !== void 0);
userConfig.metadata = userConfig.metadata || {};
this.config = {
configFile: resolvedConfigFile,
rootDir: pathResolve(configDir, userConfig.testDir) || configDir,
forbidOnly: takeFirst(configCLIOverrides.forbidOnly, userConfig.forbidOnly, false),
fullyParallel: takeFirst(configCLIOverrides.fullyParallel, userConfig.fullyParallel, false),
globalSetup: this.globalSetups[0] ?? null,
globalTeardown: this.globalTeardowns[0] ?? null,
globalTimeout: takeFirst(configCLIOverrides.debug ? 0 : void 0, configCLIOverrides.globalTimeout, userConfig.globalTimeout, 0),
grep: takeFirst(userConfig.grep, defaultGrep),
grepInvert: takeFirst(userConfig.grepInvert, null),
maxFailures: takeFirst(configCLIOverrides.debug ? 1 : void 0, configCLIOverrides.maxFailures, userConfig.maxFailures, 0),
metadata: metadata ?? userConfig.metadata,
preserveOutput: takeFirst(userConfig.preserveOutput, "always"),
reporter: takeFirst(configCLIOverrides.reporter, resolveReporters(userConfig.reporter, configDir), [[defaultReporter]]),
reportSlowTests: takeFirst(userConfig.reportSlowTests, {
max: 5,
threshold: 3e5
/* 5 minutes */
}),
quiet: takeFirst(configCLIOverrides.quiet, userConfig.quiet, false),
projects: [],
shard: takeFirst(configCLIOverrides.shard, userConfig.shard, null),
updateSnapshots: takeFirst(configCLIOverrides.updateSnapshots, userConfig.updateSnapshots, "missing"),
updateSourceMethod: takeFirst(configCLIOverrides.updateSourceMethod, userConfig.updateSourceMethod, "patch"),
version: require("../../package.json").version,
workers: resolveWorkers(takeFirst(configCLIOverrides.debug ? 1 : void 0, configCLIOverrides.workers, userConfig.workers, "50%")),
webServer: null
};
for (const key in userConfig) {
if (key.startsWith("@"))
this.config[key] = userConfig[key];
}
this.config[configInternalSymbol] = this;
const webServers = takeFirst(userConfig.webServer, null);
if (Array.isArray(webServers)) {
this.config.webServer = null;
this.webServers = webServers;
} else if (webServers) {
this.config.webServer = webServers;
this.webServers = [webServers];
} else {
this.webServers = [];
}
const projectConfigs = configCLIOverrides.projects || userConfig.projects || [userConfig];
this.projects = projectConfigs.map((p) => new FullProjectInternal(configDir, userConfig, this, p, this.configCLIOverrides, packageJsonDir));
resolveProjectDependencies(this.projects);
this._assignUniqueProjectIds(this.projects);
this.config.projects = this.projects.map((p) => p.project);
}
_assignUniqueProjectIds(projects) {
const usedNames = /* @__PURE__ */ new Set();
for (const p of projects) {
const name = p.project.name || "";
for (let i = 0; i < projects.length; ++i) {
const candidate = name + (i ? i : "");
if (usedNames.has(candidate))
continue;
p.id = candidate;
p.project.__projectId = p.id;
usedNames.add(candidate);
break;
}
}
}
}
class FullProjectInternal {
constructor(configDir, config, fullConfig, projectConfig, configCLIOverrides, packageJsonDir) {
this.id = "";
this.deps = [];
this.fullConfig = fullConfig;
const testDir = takeFirst(pathResolve(configDir, projectConfig.testDir), pathResolve(configDir, config.testDir), fullConfig.configDir);
this.snapshotPathTemplate = takeFirst(projectConfig.snapshotPathTemplate, config.snapshotPathTemplate);
this.project = {
grep: takeFirst(projectConfig.grep, config.grep, defaultGrep),
grepInvert: takeFirst(projectConfig.grepInvert, config.grepInvert, null),
outputDir: takeFirst(configCLIOverrides.outputDir, pathResolve(configDir, projectConfig.outputDir), pathResolve(configDir, config.outputDir), import_path.default.join(packageJsonDir, "test-results")),
// Note: we either apply the cli override for repeatEach or not, depending on whether the
// project is top-level vs dependency. See collectProjectsAndTestFiles in loadUtils.
repeatEach: takeFirst(projectConfig.repeatEach, config.repeatEach, 1),
retries: takeFirst(configCLIOverrides.retries, projectConfig.retries, config.retries, 0),
metadata: takeFirst(projectConfig.metadata, config.metadata, {}),
name: takeFirst(projectConfig.name, config.name, ""),
testDir,
snapshotDir: takeFirst(pathResolve(configDir, projectConfig.snapshotDir), pathResolve(configDir, config.snapshotDir), testDir),
testIgnore: takeFirst(projectConfig.testIgnore, config.testIgnore, []),
testMatch: takeFirst(projectConfig.testMatch, config.testMatch, "**/*.@(spec|test).?(c|m)[jt]s?(x)"),
timeout: takeFirst(configCLIOverrides.debug ? 0 : void 0, configCLIOverrides.timeout, projectConfig.timeout, config.timeout, defaultTimeout),
use: (0, import_util.mergeObjects)(config.use, projectConfig.use, configCLIOverrides.use),
dependencies: projectConfig.dependencies || [],
teardown: projectConfig.teardown
};
this.fullyParallel = takeFirst(configCLIOverrides.fullyParallel, projectConfig.fullyParallel, config.fullyParallel, void 0);
this.expect = takeFirst(projectConfig.expect, config.expect, {});
if (this.expect.toHaveScreenshot?.stylePath) {
const stylePaths = Array.isArray(this.expect.toHaveScreenshot.stylePath) ? this.expect.toHaveScreenshot.stylePath : [this.expect.toHaveScreenshot.stylePath];
this.expect.toHaveScreenshot.stylePath = stylePaths.map((stylePath) => import_path.default.resolve(configDir, stylePath));
}
this.respectGitIgnore = takeFirst(projectConfig.respectGitIgnore, config.respectGitIgnore, !projectConfig.testDir && !config.testDir);
this.ignoreSnapshots = takeFirst(configCLIOverrides.ignoreSnapshots, projectConfig.ignoreSnapshots, config.ignoreSnapshots, false);
this.workers = projectConfig.workers ? resolveWorkers(projectConfig.workers) : void 0;
if (configCLIOverrides.debug && this.workers)
this.workers = 1;
}
}
function takeFirst(...args) {
for (const arg of args) {
if (arg !== void 0)
return arg;
}
return void 0;
}
function pathResolve(baseDir, relative) {
if (!relative)
return void 0;
return import_path.default.resolve(baseDir, relative);
}
function resolveReporters(reporters, rootDir) {
return toReporters(reporters)?.map(([id, arg]) => {
if (builtInReporters.includes(id))
return [id, arg];
return [require.resolve(id, { paths: [rootDir] }), arg];
});
}
function resolveWorkers(workers) {
if (typeof workers === "string") {
if (workers.endsWith("%")) {
const cpus = import_os.default.cpus().length;
return Math.max(1, Math.floor(cpus * (parseInt(workers, 10) / 100)));
}
const parsedWorkers = parseInt(workers, 10);
if (isNaN(parsedWorkers))
throw new Error(`Workers ${workers} must be a number or percentage.`);
return parsedWorkers;
}
return workers;
}
function resolveProjectDependencies(projects) {
const teardownSet = /* @__PURE__ */ new Set();
for (const project of projects) {
for (const dependencyName of project.project.dependencies) {
const dependencies = projects.filter((p) => p.project.name === dependencyName);
if (!dependencies.length)
throw new Error(`Project '${project.project.name}' depends on unknown project '${dependencyName}'`);
if (dependencies.length > 1)
throw new Error(`Project dependencies should have unique names, reading ${dependencyName}`);
project.deps.push(...dependencies);
}
if (project.project.teardown) {
const teardowns = projects.filter((p) => p.project.name === project.project.teardown);
if (!teardowns.length)
throw new Error(`Project '${project.project.name}' has unknown teardown project '${project.project.teardown}'`);
if (teardowns.length > 1)
throw new Error(`Project teardowns should have unique names, reading ${project.project.teardown}`);
const teardown = teardowns[0];
project.teardown = teardown;
teardownSet.add(teardown);
}
}
for (const teardown of teardownSet) {
if (teardown.deps.length)
throw new Error(`Teardown project ${teardown.project.name} must not have dependencies`);
}
for (const project of projects) {
for (const dep of project.deps) {
if (teardownSet.has(dep))
throw new Error(`Project ${project.project.name} must not depend on a teardown project ${dep.project.name}`);
}
}
}
function toReporters(reporters) {
if (!reporters)
return;
if (typeof reporters === "string")
return [[reporters]];
return reporters;
}
const builtInReporters = ["list", "line", "dot", "json", "junit", "null", "github", "html", "blob"];
function resolveScript(id, rootDir) {
if (!id)
return void 0;
const localPath = import_path.default.resolve(rootDir, id);
if (import_fs.default.existsSync(localPath))
return localPath;
return require.resolve(id, { paths: [rootDir] });
}
const defaultGrep = /.*/;
const defaultReporter = process.env.CI ? "dot" : "list";
const configInternalSymbol = Symbol("configInternalSymbol");
function getProjectId(project) {
return project.__projectId;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
FullConfigInternal,
FullProjectInternal,
builtInReporters,
defaultGrep,
defaultReporter,
defaultTimeout,
getProjectId,
takeFirst,
toReporters
});
+344
View File
@@ -0,0 +1,344 @@
"use strict";
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 __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);
var configLoader_exports = {};
__export(configLoader_exports, {
defineConfig: () => defineConfig,
deserializeConfig: () => deserializeConfig,
loadConfig: () => loadConfig,
loadConfigFromFile: () => loadConfigFromFile,
loadEmptyConfigForMergeReports: () => loadEmptyConfigForMergeReports,
resolveConfigLocation: () => resolveConfigLocation
});
module.exports = __toCommonJS(configLoader_exports);
var import_fs = __toESM(require("fs"));
var import_path = __toESM(require("path"));
var import_utils = require("playwright-core/lib/utils");
var import_transform = require("../transform/transform");
var import_util = require("../util");
var import_config = require("./config");
var import_esmLoaderHost = require("./esmLoaderHost");
var import_compilationCache = require("../transform/compilationCache");
const kDefineConfigWasUsed = Symbol("defineConfigWasUsed");
const defineConfig = (...configs) => {
let result = configs[0];
for (let i = 1; i < configs.length; ++i) {
const config = configs[i];
const prevProjects = result.projects;
result = {
...result,
...config,
expect: {
...result.expect,
...config.expect
},
use: {
...result.use,
...config.use
},
build: {
...result.build,
...config.build
},
webServer: [
...Array.isArray(result.webServer) ? result.webServer : result.webServer ? [result.webServer] : [],
...Array.isArray(config.webServer) ? config.webServer : config.webServer ? [config.webServer] : []
]
};
if (!result.projects && !config.projects)
continue;
const projectOverrides = /* @__PURE__ */ new Map();
for (const project of config.projects || [])
projectOverrides.set(project.name, project);
const projects = [];
for (const project of prevProjects || []) {
const projectOverride = projectOverrides.get(project.name);
if (projectOverride) {
projects.push({
...project,
...projectOverride,
use: {
...project.use,
...projectOverride.use
}
});
projectOverrides.delete(project.name);
} else {
projects.push(project);
}
}
projects.push(...projectOverrides.values());
result.projects = projects;
}
result[kDefineConfigWasUsed] = true;
return result;
};
async function deserializeConfig(data) {
if (data.compilationCache)
(0, import_compilationCache.addToCompilationCache)(data.compilationCache);
return await loadConfig(data.location, data.configCLIOverrides, void 0, data.metadata ? JSON.parse(data.metadata) : void 0);
}
async function loadUserConfig(location) {
let object = location.resolvedConfigFile ? await (0, import_transform.requireOrImport)(location.resolvedConfigFile) : {};
if (object && typeof object === "object" && "default" in object)
object = object["default"];
return object;
}
async function loadConfig(location, overrides, ignoreProjectDependencies = false, metadata) {
if (!(0, import_esmLoaderHost.registerESMLoader)()) {
if (location.resolvedConfigFile && (0, import_util.fileIsModule)(location.resolvedConfigFile))
throw (0, import_util.errorWithFile)(location.resolvedConfigFile, `Playwright requires Node.js 18.19 or higher to load esm modules. Please update your version of Node.js.`);
}
(0, import_transform.setSingleTSConfig)(overrides?.tsconfig);
await (0, import_esmLoaderHost.configureESMLoader)();
const userConfig = await loadUserConfig(location);
validateConfig(location.resolvedConfigFile || "<default config>", userConfig);
const fullConfig = new import_config.FullConfigInternal(location, userConfig, overrides || {}, metadata);
fullConfig.defineConfigWasUsed = !!userConfig[kDefineConfigWasUsed];
if (ignoreProjectDependencies) {
for (const project of fullConfig.projects) {
project.deps = [];
project.teardown = void 0;
}
}
const babelPlugins = userConfig["@playwright/test"]?.babelPlugins || [];
const external = userConfig.build?.external || [];
(0, import_transform.setTransformConfig)({ babelPlugins, external });
if (!overrides?.tsconfig)
(0, import_transform.setSingleTSConfig)(fullConfig?.singleTSConfigPath);
await (0, import_esmLoaderHost.configureESMLoaderTransformConfig)();
return fullConfig;
}
function validateConfig(file, config) {
if (typeof config !== "object" || !config)
throw (0, import_util.errorWithFile)(file, `Configuration file must export a single object`);
validateProject(file, config, "config");
if ("forbidOnly" in config && config.forbidOnly !== void 0) {
if (typeof config.forbidOnly !== "boolean")
throw (0, import_util.errorWithFile)(file, `config.forbidOnly must be a boolean`);
}
if ("globalSetup" in config && config.globalSetup !== void 0) {
if (Array.isArray(config.globalSetup)) {
config.globalSetup.forEach((item, index) => {
if (typeof item !== "string")
throw (0, import_util.errorWithFile)(file, `config.globalSetup[${index}] must be a string`);
});
} else if (typeof config.globalSetup !== "string") {
throw (0, import_util.errorWithFile)(file, `config.globalSetup must be a string`);
}
}
if ("globalTeardown" in config && config.globalTeardown !== void 0) {
if (Array.isArray(config.globalTeardown)) {
config.globalTeardown.forEach((item, index) => {
if (typeof item !== "string")
throw (0, import_util.errorWithFile)(file, `config.globalTeardown[${index}] must be a string`);
});
} else if (typeof config.globalTeardown !== "string") {
throw (0, import_util.errorWithFile)(file, `config.globalTeardown must be a string`);
}
}
if ("globalTimeout" in config && config.globalTimeout !== void 0) {
if (typeof config.globalTimeout !== "number" || config.globalTimeout < 0)
throw (0, import_util.errorWithFile)(file, `config.globalTimeout must be a non-negative number`);
}
if ("grep" in config && config.grep !== void 0) {
if (Array.isArray(config.grep)) {
config.grep.forEach((item, index) => {
if (!(0, import_utils.isRegExp)(item))
throw (0, import_util.errorWithFile)(file, `config.grep[${index}] must be a RegExp`);
});
} else if (!(0, import_utils.isRegExp)(config.grep)) {
throw (0, import_util.errorWithFile)(file, `config.grep must be a RegExp`);
}
}
if ("grepInvert" in config && config.grepInvert !== void 0) {
if (Array.isArray(config.grepInvert)) {
config.grepInvert.forEach((item, index) => {
if (!(0, import_utils.isRegExp)(item))
throw (0, import_util.errorWithFile)(file, `config.grepInvert[${index}] must be a RegExp`);
});
} else if (!(0, import_utils.isRegExp)(config.grepInvert)) {
throw (0, import_util.errorWithFile)(file, `config.grepInvert must be a RegExp`);
}
}
if ("maxFailures" in config && config.maxFailures !== void 0) {
if (typeof config.maxFailures !== "number" || config.maxFailures < 0)
throw (0, import_util.errorWithFile)(file, `config.maxFailures must be a non-negative number`);
}
if ("preserveOutput" in config && config.preserveOutput !== void 0) {
if (typeof config.preserveOutput !== "string" || !["always", "never", "failures-only"].includes(config.preserveOutput))
throw (0, import_util.errorWithFile)(file, `config.preserveOutput must be one of "always", "never" or "failures-only"`);
}
if ("projects" in config && config.projects !== void 0) {
if (!Array.isArray(config.projects))
throw (0, import_util.errorWithFile)(file, `config.projects must be an array`);
config.projects.forEach((project, index) => {
validateProject(file, project, `config.projects[${index}]`);
});
}
if ("quiet" in config && config.quiet !== void 0) {
if (typeof config.quiet !== "boolean")
throw (0, import_util.errorWithFile)(file, `config.quiet must be a boolean`);
}
if ("reporter" in config && config.reporter !== void 0) {
if (Array.isArray(config.reporter)) {
config.reporter.forEach((item, index) => {
if (!Array.isArray(item) || item.length <= 0 || item.length > 2 || typeof item[0] !== "string")
throw (0, import_util.errorWithFile)(file, `config.reporter[${index}] must be a tuple [name, optionalArgument]`);
});
} else if (typeof config.reporter !== "string") {
throw (0, import_util.errorWithFile)(file, `config.reporter must be a string`);
}
}
if ("reportSlowTests" in config && config.reportSlowTests !== void 0 && config.reportSlowTests !== null) {
if (!config.reportSlowTests || typeof config.reportSlowTests !== "object")
throw (0, import_util.errorWithFile)(file, `config.reportSlowTests must be an object`);
if (!("max" in config.reportSlowTests) || typeof config.reportSlowTests.max !== "number" || config.reportSlowTests.max < 0)
throw (0, import_util.errorWithFile)(file, `config.reportSlowTests.max must be a non-negative number`);
if (!("threshold" in config.reportSlowTests) || typeof config.reportSlowTests.threshold !== "number" || config.reportSlowTests.threshold < 0)
throw (0, import_util.errorWithFile)(file, `config.reportSlowTests.threshold must be a non-negative number`);
}
if ("shard" in config && config.shard !== void 0 && config.shard !== null) {
if (!config.shard || typeof config.shard !== "object")
throw (0, import_util.errorWithFile)(file, `config.shard must be an object`);
if (!("total" in config.shard) || typeof config.shard.total !== "number" || config.shard.total < 1)
throw (0, import_util.errorWithFile)(file, `config.shard.total must be a positive number`);
if (!("current" in config.shard) || typeof config.shard.current !== "number" || config.shard.current < 1 || config.shard.current > config.shard.total)
throw (0, import_util.errorWithFile)(file, `config.shard.current must be a positive number, not greater than config.shard.total`);
}
if ("updateSnapshots" in config && config.updateSnapshots !== void 0) {
if (typeof config.updateSnapshots !== "string" || !["all", "changed", "missing", "none"].includes(config.updateSnapshots))
throw (0, import_util.errorWithFile)(file, `config.updateSnapshots must be one of "all", "changed", "missing" or "none"`);
}
if ("tsconfig" in config && config.tsconfig !== void 0) {
if (typeof config.tsconfig !== "string")
throw (0, import_util.errorWithFile)(file, `config.tsconfig must be a string`);
if (!import_fs.default.existsSync(import_path.default.resolve(file, "..", config.tsconfig)))
throw (0, import_util.errorWithFile)(file, `config.tsconfig does not exist`);
}
}
function validateProject(file, project, title) {
if (typeof project !== "object" || !project)
throw (0, import_util.errorWithFile)(file, `${title} must be an object`);
if ("name" in project && project.name !== void 0) {
if (typeof project.name !== "string")
throw (0, import_util.errorWithFile)(file, `${title}.name must be a string`);
}
if ("outputDir" in project && project.outputDir !== void 0) {
if (typeof project.outputDir !== "string")
throw (0, import_util.errorWithFile)(file, `${title}.outputDir must be a string`);
}
if ("repeatEach" in project && project.repeatEach !== void 0) {
if (typeof project.repeatEach !== "number" || project.repeatEach < 0)
throw (0, import_util.errorWithFile)(file, `${title}.repeatEach must be a non-negative number`);
}
if ("retries" in project && project.retries !== void 0) {
if (typeof project.retries !== "number" || project.retries < 0)
throw (0, import_util.errorWithFile)(file, `${title}.retries must be a non-negative number`);
}
if ("testDir" in project && project.testDir !== void 0) {
if (typeof project.testDir !== "string")
throw (0, import_util.errorWithFile)(file, `${title}.testDir must be a string`);
}
for (const prop of ["testIgnore", "testMatch"]) {
if (prop in project && project[prop] !== void 0) {
const value = project[prop];
if (Array.isArray(value)) {
value.forEach((item, index) => {
if (typeof item !== "string" && !(0, import_utils.isRegExp)(item))
throw (0, import_util.errorWithFile)(file, `${title}.${prop}[${index}] must be a string or a RegExp`);
});
} else if (typeof value !== "string" && !(0, import_utils.isRegExp)(value)) {
throw (0, import_util.errorWithFile)(file, `${title}.${prop} must be a string or a RegExp`);
}
}
}
if ("timeout" in project && project.timeout !== void 0) {
if (typeof project.timeout !== "number" || project.timeout < 0)
throw (0, import_util.errorWithFile)(file, `${title}.timeout must be a non-negative number`);
}
if ("use" in project && project.use !== void 0) {
if (!project.use || typeof project.use !== "object")
throw (0, import_util.errorWithFile)(file, `${title}.use must be an object`);
}
if ("ignoreSnapshots" in project && project.ignoreSnapshots !== void 0) {
if (typeof project.ignoreSnapshots !== "boolean")
throw (0, import_util.errorWithFile)(file, `${title}.ignoreSnapshots must be a boolean`);
}
if ("workers" in project && project.workers !== void 0) {
if (typeof project.workers === "number" && project.workers <= 0)
throw (0, import_util.errorWithFile)(file, `${title}.workers must be a positive number`);
else if (typeof project.workers === "string" && !project.workers.endsWith("%"))
throw (0, import_util.errorWithFile)(file, `${title}.workers must be a number or percentage`);
}
}
function resolveConfigLocation(configFile) {
const configFileOrDirectory = configFile ? import_path.default.resolve(process.cwd(), configFile) : process.cwd();
const resolvedConfigFile = resolveConfigFile(configFileOrDirectory);
return {
resolvedConfigFile,
configDir: resolvedConfigFile ? import_path.default.dirname(resolvedConfigFile) : configFileOrDirectory
};
}
function resolveConfigFile(configFileOrDirectory) {
const resolveConfig = (configFile) => {
if (import_fs.default.existsSync(configFile))
return configFile;
};
const resolveConfigFileFromDirectory = (directory) => {
for (const ext of [".ts", ".js", ".mts", ".mjs", ".cts", ".cjs"]) {
const configFile = resolveConfig(import_path.default.resolve(directory, "playwright.config" + ext));
if (configFile)
return configFile;
}
};
if (!import_fs.default.existsSync(configFileOrDirectory))
throw new Error(`${configFileOrDirectory} does not exist`);
if (import_fs.default.statSync(configFileOrDirectory).isDirectory()) {
const configFile = resolveConfigFileFromDirectory(configFileOrDirectory);
if (configFile)
return configFile;
return void 0;
}
return configFileOrDirectory;
}
async function loadConfigFromFile(configFile, overrides, ignoreDeps) {
return await loadConfig(resolveConfigLocation(configFile), overrides, ignoreDeps);
}
async function loadEmptyConfigForMergeReports() {
return await loadConfig({ configDir: process.cwd() });
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
defineConfig,
deserializeConfig,
loadConfig,
loadConfigFromFile,
loadEmptyConfigForMergeReports,
resolveConfigLocation
});
+102
View File
@@ -0,0 +1,102 @@
"use strict";
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 __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);
var esmLoaderHost_exports = {};
__export(esmLoaderHost_exports, {
configureESMLoader: () => configureESMLoader,
configureESMLoaderTransformConfig: () => configureESMLoaderTransformConfig,
incorporateCompilationCache: () => incorporateCompilationCache,
registerESMLoader: () => registerESMLoader,
startCollectingFileDeps: () => startCollectingFileDeps,
stopCollectingFileDeps: () => stopCollectingFileDeps
});
module.exports = __toCommonJS(esmLoaderHost_exports);
var import_url = __toESM(require("url"));
var import_compilationCache = require("../transform/compilationCache");
var import_portTransport = require("../transform/portTransport");
var import_transform = require("../transform/transform");
let loaderChannel;
function registerESMLoader() {
if (process.env.PW_DISABLE_TS_ESM)
return true;
if (loaderChannel)
return true;
const register = require("node:module").register;
if (!register)
return false;
const { port1, port2 } = new MessageChannel();
register(import_url.default.pathToFileURL(require.resolve("../transform/esmLoader")), {
data: { port: port2 },
transferList: [port2]
});
loaderChannel = createPortTransport(port1);
return true;
}
function createPortTransport(port) {
return new import_portTransport.PortTransport(port, async (method, params) => {
if (method === "pushToCompilationCache")
(0, import_compilationCache.addToCompilationCache)(params.cache);
});
}
async function startCollectingFileDeps() {
if (!loaderChannel)
return;
await loaderChannel.send("startCollectingFileDeps", {});
}
async function stopCollectingFileDeps(file) {
if (!loaderChannel)
return;
await loaderChannel.send("stopCollectingFileDeps", { file });
}
async function incorporateCompilationCache() {
if (!loaderChannel)
return;
const result = await loaderChannel.send("getCompilationCache", {});
(0, import_compilationCache.addToCompilationCache)(result.cache);
}
async function configureESMLoader() {
if (!loaderChannel)
return;
await loaderChannel.send("setSingleTSConfig", { tsconfig: (0, import_transform.singleTSConfig)() });
await loaderChannel.send("addToCompilationCache", { cache: (0, import_compilationCache.serializeCompilationCache)() });
}
async function configureESMLoaderTransformConfig() {
if (!loaderChannel)
return;
await loaderChannel.send("setSingleTSConfig", { tsconfig: (0, import_transform.singleTSConfig)() });
await loaderChannel.send("setTransformConfig", { config: (0, import_transform.transformConfig)() });
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
configureESMLoader,
configureESMLoaderTransformConfig,
incorporateCompilationCache,
registerESMLoader,
startCollectingFileDeps,
stopCollectingFileDeps
});
+49
View File
@@ -0,0 +1,49 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var expectBundle_exports = {};
__export(expectBundle_exports, {
EXPECTED_COLOR: () => EXPECTED_COLOR,
INVERTED_COLOR: () => INVERTED_COLOR,
RECEIVED_COLOR: () => RECEIVED_COLOR,
asymmetricMatchers: () => asymmetricMatchers,
expect: () => expect,
matcherUtils: () => matcherUtils,
mock: () => mock,
printReceived: () => printReceived
});
module.exports = __toCommonJS(expectBundle_exports);
const expect = require("./expectBundleImpl").expect;
const mock = require("./expectBundleImpl").mock;
const asymmetricMatchers = require("./expectBundleImpl").asymmetricMatchers;
const matcherUtils = require("./expectBundleImpl").matcherUtils;
const EXPECTED_COLOR = require("./expectBundleImpl").EXPECTED_COLOR;
const INVERTED_COLOR = require("./expectBundleImpl").INVERTED_COLOR;
const RECEIVED_COLOR = require("./expectBundleImpl").RECEIVED_COLOR;
const printReceived = require("./expectBundleImpl").printReceived;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
EXPECTED_COLOR,
INVERTED_COLOR,
RECEIVED_COLOR,
asymmetricMatchers,
expect,
matcherUtils,
mock,
printReceived
});
+389
View File
@@ -0,0 +1,389 @@
"use strict";var Fh=Object.create;var $n=Object.defineProperty;var jh=Object.getOwnPropertyDescriptor;var Bh=Object.getOwnPropertyNames;var qh=Object.getPrototypeOf,Hh=Object.prototype.hasOwnProperty;var Uh=(e,t,n)=>t in e?$n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var R=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Gh=(e,t)=>{for(var n in t)$n(e,n,{get:t[n],enumerable:!0})},Tu=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Bh(t))!Hh.call(e,s)&&s!==n&&$n(e,s,{get:()=>t[s],enumerable:!(r=jh(t,s))||r.enumerable});return e};var ie=(e,t,n)=>(n=e!=null?Fh(qh(e)):{},Tu(t||!e||!e.__esModule?$n(n,"default",{value:e,enumerable:!0}):n,e)),Wh=e=>Tu($n({},"__esModule",{value:!0}),e);var ae=(e,t,n)=>Uh(e,typeof t!="symbol"?t+"":t,n);var $u=R((av,xu)=>{"use strict";xu.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var oo=R((cv,Nu)=>{var In=$u(),Iu={};for(let e of Object.keys(In))Iu[In[e]]=e;var P={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};Nu.exports=P;for(let e of Object.keys(P)){if(!("channels"in P[e]))throw new Error("missing channels property: "+e);if(!("labels"in P[e]))throw new Error("missing channel labLine truncated
`:`
`)+n,s=r+1,r=e.indexOf(`
`,s)}while(r!==-1);return o+=e.substr(s),o};Yu.exports={stringReplaceAll:sg,stringEncaseCRLFWithFirstIndex:og}});var ta=R((dv,ea)=>{"use strict";var ig=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,Xu=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,ug=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,ag=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,cg=new Map([["n",`
`],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function Zu(e){let t=e[0]==="u",n=e[1]==="{";return t&&!n&&e.length===5||e[0]==="x"&&e.length===3?String.fromCharCode(parseInt(e.slice(1),16)):t&&n?String.fromCodePoint(parseInt(e.slice(2,-1),16)):cg.get(e)||e}function lg(e,t){let n=[],r=t.trim().split(/\s*,\s*/g),s;for(let o of r){let i=Number(o);if(!Number.isNaN(i))n.push(i);else if(s=o.match(ug))n.push(s[2].replace(ag,(u,a,l)=>a?Zu(a):l));else throw new Error(`Invalid Chalk template style argument: ${o} (in style '${e}')`)}return n}function fg(e){Xu.lastIndex=0;let t=[],n;for(;(n=Xu.exec(e))!==null;){let r=n[1];if(n[2]){let s=lg(r,n[2]);t.push([r].concat(s))}else t.push([r])}return t}function Ju(e,t){let n={};for(let s of t)for(let o of s.styles)n[o[0]]=s.inverse?null:o.slice(1);let r=e;for(let[s,o]of Object.entries(n))if(Array.isArray(o)){if(!(s in r))throw new Error(`Unknown Chalk style: ${s}`);r=o.length>0?r[s](...o):r[s]}return r}ea.exports=(e,t)=>{let n=[],r=[],s=[];if(t.replace(ig,(o,i,u,a,l,c)=>{if(i)s.push(Zu(i));else if(a){let f=s.join("");s=[],r.push(n.length===0?f:Ju(e,n)(f)),n.push({inverse:u,styles:fg(a)})}else if(l){if(n.length===0)throw new Error("Found extraneous } in Chalk template literal");r.push(Ju(e,n)(s.join(""))),s=[],n.pop()}else s.push(c)}),r.push(s.join("")),n.length>0){let o=`Chalk template literal is missing ${n.length} closing bracket${n.length===1?"":"s"} (\`}\`)`;throw new Error(o)}return r.join("")}});var zt=R((yv,ua)=>{"use strict";var Nn=Uu(),{stdout:fo,stderr:po}=Ku(),{stringReplaceAll:pg,stringEncaseCRLFWithFirstIndex:hg}=Qu(),{isArray:br}=Array,ra=["ansi","ansi","ansi256","ansi16m"],Vt=Object.create(null),gg=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let n=fo?fo.level:0;e.level=t.level===void 0?n:t.level},ho=class{constructor(t){return sa(t)}},sa=e=>{let t={};return gg(t,e),t.template=(...n)=>ia(t.template,...n),Object.setPrototypeOf(t,Er.prototype),Object.setPrototypeOf(t.template,t),t.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},t.template.Instance=ho,t.template};function Er(e){return sa(e)}for(let[e,t]of Object.entries(Nn))Vt[e]={get(){let n=vr(this,go(t.open,t.close,this._styler),this._isEmpty);return Object.defineProperty(this,e,{value:n}),n}};Vt.visible={get(){let e=vr(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:e}),e}};var oa=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let e of oa)Vt[e]={get(){let{level:t}=this;return function(...n){let r=go(Nn.color[ra[t]][e](...n),Nn.color.close,this._styler);return vr(this,r,this._isEmpty)}}};for(let e of oa){let t="bg"+e[0].toUpperCase()+e.slice(1);Vt[t]={get(){let{level:n}=this;return function(...r){let s=go(Nn.bgColor[ra[n]][e](...r),Nn.bgColor.close,this._styler);return vr(this,s,this._isEmpty)}}}}var mg=Object.defineProperties(()=>{},{...Vt,level:{enumerable:!0,get(){return this._generator.level},set(e){this._generator.level=e}}}),go=(e,t,n)=>{let r,s;return n===void 0?(r=e,s=t):(r=n.openAll+e,s=t+n.closeAll),{open:e,close:t,openAll:r,closeAll:s,parent:n}},vr=(e,t,n)=>{let r=(...s)=>br(s[0])&&br(s[0].raw)?na(r,ia(r,...s)):na(r,s.length===1?""+s[0]:s.join(" "));return Object.setPrototypeOf(r,mg),r._generator=e,r._styler=t,r._isEmpty=n,r},na=(e,t)=>{if(e.level<=0||!t)return e._isEmpty?"":t;let n=e._styler;if(n===void 0)return t;let{openAll:r,closeAll:s}=n;if(t.indexOf("\x1B")!==-1)for(;n!==void 0;)t=pg(t,n.close,n.open),n=n.parent;let o=t.indexOf(`
`);return o!==-1&&(t=hg(t,s,r,o)),r+t+s},lo,ia=(e,...t)=>{let[n]=t;if(!br(n)||!br(n.raw))return t.join(" ");let r=t.slice(1),s=[n.raw[0]];for(let o=1;o<n.length;o++)s.push(String(r[o-1]).replace(/[{}\\]/g,"\\$&"),String(n.raw[o]));return lo===void 0&&(lo=ta()),lo(e,s.join(""))};Object.defineProperties(Er.prototype,Vt);var _r=Er();_r.supportsColor=fo;_r.stderr=Er({level:po?po.level:0});_r.stderr.supportsColor=po;ua.exports=_r});var ot=R(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});Pn.getType=dg;Pn.isPrimitive=void 0;function dg(e){if(e===void 0)return"undefined";if(e===null)return"null";if(Array.isArray(e))return"array";if(typeof e=="boolean")return"boolean";if(typeof e=="function")return"function";if(typeof e=="number")return"number";if(typeof e=="string")return"string";if(typeof e=="bigint")return"bigint";if(typeof e=="object"){if(e!=null){if(e.constructor===RegExp)return"regexp";if(e.constructor===Map)return"map";if(e.constructor===Set)return"set";if(e.constructor===Date)return"date"}return"object"}else if(typeof e=="symbol")return"symbol";throw new Error(`value of unknown type: ${e}`)}var yg=e=>Object(e)!==e;Pn.isPrimitive=yg});var fa=R((Ev,la)=>{"use strict";var aa=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,ca=(e=0)=>(t,n,r)=>`\x1B[${38+e};2;${t};${n};${r}m`;function bg(){let e=new Map,t={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};t.color.gray=t.color.blackBright,t.bgColor.bgGray=t.bgColor.bgBlackBright,t.color.grey=t.color.blackBright,t.bgColor.bgGrey=t.bgColor.bgBlackBright;for(let[n,r]of Object.entries(t)){for(let[s,o]of Object.entries(r))t[s]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},r[s]=t[s],e.set(o[0],o[1]);Object.defineProperty(t,n,{value:r,enumerable:!1})}return Object.defineProperty(t,"codes",{value:e,enumerable:!1}),t.color.close="\x1B[39m",t.bgColor.close="\x1B[49m",t.color.ansi256=aa(),t.color.ansi16m=ca(),t.bgColor.ansi256=aa(10),t.bgColor.ansi16m=ca(10),Object.defineProperties(t,{rgbToAnsi256:{value:(n,r,s)=>n===r&&r===s?n<8?16:n>248?231:Math.round((n-8)/247*24)+232:16+36*Math.round(n/255*5)+6*Math.round(r/255*5)+Math.round(s/255*5),enumerable:!1},hexToRgb:{value:n=>{let r=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(n.toString(16));if(!r)return[0,0,0];let{colorString:s}=r.groups;s.length===3&&(s=s.split("").map(i=>i+i).join(""));let o=Number.parseInt(s,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:n=>t.rgbToAnsi256(...t.hexToRgb(n)),enumerable:!1}}),t}Object.defineProperty(la,"exports",{enumerable:!0,get:bg})});var Ln=R(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.printIteratorEntries=vg;Kt.printIteratorValues=_g;Kt.printListItems=Rg;Kt.printObjectProperties=Og;var Eg=(e,t)=>{let n=Object.keys(e),r=t!==null?n.sort(t):n;return Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(e).forEach(s=>{Object.getOwnPropertyDescriptor(e,s).enumerable&&r.push(s)}),r};function vg(e,t,n,r,s,o,i=": "){let u="",a=0,l=e.next();if(!l.done){u+=t.spacingOuter;let c=n+t.indent;for(;!l.done;){if(u+=c,a++===t.maxWidth){u+="\u2026";break}let f=o(l.value[0],t,c,r,s),p=o(l.value[1],t,c,r,s);u+=f+i+p,l=e.next(),l.done?t.min||(u+=","):u+=`,${t.spacingInner}`}u+=t.spacingOuter+n}return u}function _g(e,t,n,r,s,o){let i="",u=0,a=e.next();if(!a.done){i+=t.spacingOuter;let l=n+t.indent;for(;!a.done;){if(i+=l,u++===t.maxWidth){i+="\u2026";break}i+=o(a.value,t,l,r,s),a=e.next(),a.done?t.min||(i+=","):i+=`,${t.spacingInner}`}i+=t.spacingOuter+n}return i}function Rg(e,t,n,r,s,o){let i="";if(e.length){i+=t.spacingOuter;let u=n+t.indent;for(let a=0;a<e.length;a++){if(i+=u,a===t.maxWidth){i+="\u2026";break}a in e&&(i+=o(e[a],t,u,r,s)),a<e.length-1?i+=`,${t.spacingInner}`:t.min||(i+=",")}i+=t.spacingOuter+n}return i}function Og(e,t,n,r,s,o){let i="",u=Eg(e,t.compareKeys);if(u.length){i+=t.spacingOuter;let a=n+t.indent;for(let l=0;l<u.length;l++){let c=u[l],f=o(c,t,a,r,s),p=o(e[c],t,a,r,s);i+=`${a+f}: ${p}`,l<u.length-1?i+=`,${t.spacingInner}`:t.min||(i+=",")}i+=t.spacingOuter+n}return i}});var ma=R(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.test=it.serialize=it.default=void 0;var pa=Ln(),mo=globalThis["jest-symbol-do-not-touch"]||globalThis.Symbol,Cg=typeof mo=="function"&&mo.for?mo.for("jest.asymmetricMatcher"):1267621,Rr=" ",ha=(e,t,n,r Line truncated
`)!==-1&&(f=n.spacingOuter+u+f+n.spacingOuter+r),f=`{${f}}`),`${n.spacingInner+r+a.prop.open+l+a.prop.close}=${a.value.open}${f}${a.value.close}`}).join("")};Re.printProps=Lg;var kg=(e,t,n,r,s,o)=>e.map(i=>t.spacingOuter+n+(typeof i=="string"?Oa(i,t):o(i,t,n,r,s))).join("");Re.printChildren=kg;var Oa=(e,t)=>{let n=t.colors.content;return n.open+(0,Ra.default)(e)+n.close};Re.printText=Oa;var Dg=(e,t)=>{let n=t.colors.comment;return`${n.open}<!--${(0,Ra.default)(e)}-->${n.close}`};Re.printComment=Dg;var Fg=(e,t,n,r,s)=>{let o=r.colors.tag;return`${o.open}<${e}${t&&o.close+t+r.spacingOuter+s+o.open}${n?`>${o.close}${n}${r.spacingOuter}${s}${o.open}</${e}`:`${t&&!r.min?"":" "}/`}>${o.close}`};Re.printElement=Fg;var jg=(e,t)=>{let n=t.colors.tag;return`${n.open}<${e}${n.close} \u2026${n.open} />${n.close}`};Re.printElementAsLeaf=jg});var Ta=R(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.test=at.serialize=at.default=void 0;var Yt=Or(),Bg=1,Ca=3,Sa=8,wa=11,qg=/^((HTML|SVG)\w*)?Element$/,Hg=e=>{try{return typeof e.hasAttribute=="function"&&e.hasAttribute("is")}catch{return!1}},Ug=e=>{let t=e.constructor.name,{nodeType:n,tagName:r}=e,s=typeof r=="string"&&r.includes("-")||Hg(e);return n===Bg&&(qg.test(t)||s)||n===Ca&&t==="Text"||n===Sa&&t==="Comment"||n===wa&&t==="DocumentFragment"},Aa=e=>{var t;return((t=e==null?void 0:e.constructor)==null?void 0:t.name)&&Ug(e)};at.test=Aa;function Gg(e){return e.nodeType===Ca}function Wg(e){return e.nodeType===Sa}function bo(e){return e.nodeType===wa}var Ma=(e,t,n,r,s,o)=>{if(Gg(e))return(0,Yt.printText)(e.data,t);if(Wg(e))return(0,Yt.printComment)(e.data,t);let i=bo(e)?"DocumentFragment":e.tagName.toLowerCase();return++r>t.maxDepth?(0,Yt.printElementAsLeaf)(i,t):(0,Yt.printElement)(i,(0,Yt.printProps)(bo(e)?[]:Array.from(e.attributes,u=>u.name).sort(),bo(e)?{}:Array.from(e.attributes).reduce((u,a)=>(u[a.name]=a.value,u),{}),t,n+t.indent,r,s,o),(0,Yt.printChildren)(Array.prototype.slice.call(e.childNodes||e.children),t,n+t.indent,r,s,o),t,n)};at.serialize=Ma;var Vg={serialize:Ma,test:Aa},zg=Vg;at.default=zg});var Pa=R(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.test=ct.serialize=ct.default=void 0;var kn=Ln(),Kg="@@__IMMUTABLE_ITERABLE__@@",Yg="@@__IMMUTABLE_LIST__@@",Qg="@@__IMMUTABLE_KEYED__@@",Xg="@@__IMMUTABLE_MAP__@@",xa="@@__IMMUTABLE_ORDERED__@@",Jg="@@__IMMUTABLE_RECORD__@@",Zg="@@__IMMUTABLE_SEQ__@@",em="@@__IMMUTABLE_SET__@@",tm="@@__IMMUTABLE_STACK__@@",Qt=e=>`Immutable.${e}`,Cr=e=>`[${e}]`,Dn=" ",$a="\u2026",nm=(e,t,n,r,s,o,i)=>++r>t.maxDepth?Cr(Qt(i)):`${Qt(i)+Dn}{${(0,kn.printIteratorEntries)(e.entries(),t,n,r,s,o)}}`;function rm(e){let t=0;return{next(){if(t<e._keys.length){let n=e._keys[t++];return{done:!1,value:[n,e.get(n)]}}return{done:!0,value:void 0}}}}var sm=(e,t,n,r,s,o)=>{let i=Qt(e._name||"Record");return++r>t.maxDepth?Cr(i):`${i+Dn}{${(0,kn.printIteratorEntries)(rm(e),t,n,r,s,o)}}`},om=(e,t,n,r,s,o)=>{let i=Qt("Seq");return++r>t.maxDepth?Cr(i):e[Qg]?`${i+Dn}{${e._iter||e._object?(0,kn.printIteratorEntries)(e.entries(),t,n,r,s,o):$a}}`:`${i+Dn}[${e._iter||e._array||e._collection||e._iterable?(0,kn.printIteratorValues)(e.values(),t,n,r,s,o):$a}]`},Eo=(e,t,n,r,s,o,i)=>++r>t.maxDepth?Cr(Qt(i)):`${Qt(i)+Dn}[${(0,kn.printIteratorValues)(e.values(),t,n,r,s,o)}]`,Ia=(e,t,n,r,s,o)=>e[Xg]?nm(e,t,n,r,s,o,e[xa]?"OrderedMap":"Map"):e[Yg]?Eo(e,t,n,r,s,o,"List"):e[em]?Eo(e,t,n,r,s,o,e[xa]?"OrderedSet":"Set"):e[tm]?Eo(e,t,n,r,s,o,"Stack"):e[Zg]?om(e,t,n,r,s,o):sm(e,t,n,r,s,o);ct.serialize=Ia;var Na=e=>e&&(e[Kg]===!0||e[Jg]===!0);ct.test=Na;var im={serialize:Ia,test:Na},um=im;ct.default=um});var ka=R(Y=>{"use strict";var vo=Symbol.for("react.element"),_o=Symbol.for("react.portal"),Sr=Symbol.for("react.fragment"),wr=Symbol.for("react.strict_mode"),Ar=Symbol.for("react.profiler"),Mr=Symbol.for("react.provider"),Tr=Symbol.for("react.context"),am=Symbol.for("react.server_context"),xr=Symbol.for("react.forward_ref"),$r=Symbol.for("react.suspense"),Ir=Symbol.for("react.suspense_list"),Nr=Symbol.for("react.memo"),Pr=Symbol.for("react.lazy"),cm=Symbol.for("react.offscreen"),La;La=Symbol.for("react.module.reference");function Ie(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case vo:switch(e=e.type,e){case Sr:case Ar:case wr:case $r:case Ir:return e;default:switch(e=e&&e.$$typeof,e){case am:case Tr:case xr:case Pr:case Nr:case Mr:return e;default:return t}}case _o:return t}}}Y.ContextConsumer=Tr;Y.ContextProvider=Mr;Y.Element=vo;Y.ForwardRef=xr;Y.Fragment=Sr;Y.Lazy=Pr;Y.Memo=Nr;Y.Portal=_o;Y.Profiler=Ar;Y.StrictMode=wr;Y.Suspense=$r;Y.SuspenseList=Ir;Y.isAsyncMode=function(){return!1};Y.isConcurrentMode=function(){return!1};Y.isContextConsumer=function(e){return Ie(e)===Tr};Y.isContextProvider=function(e){return Ie(e)===Mr};Y.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===vo};Y.isForwardRef=function(e){return Ie(e)===xr};Y.isFragment=function(e){return Ie(e)===Sr};Y.isLazy=function(e){retu Line truncated
${a}`)},{edgeSpacing:n.spacingOuter,min:n.min,spacing:n.spacingInner},n.colors)}catch(u){throw new Dr(u.message,u.stack)}if(typeof i!="string")throw new Error(`pretty-format: Plugin must return type "string" but instead returned "${typeof i}".`);return i}function rc(e,t){for(let n=0;n<e.length;n++)try{if(e[n].test(t))return e[n]}catch(r){throw new Dr(r.message,r.stack)}return null}function pt(e,t,n,r,s,o){let i=rc(t.plugins,e);if(i!==null)return nc(i,e,t,n,r,s);let u=ec(e,t.printFunctionName,t.escapeRegex,t.escapeString);return u!==null?u:tc(e,t,n,r,s,o)}var So={comment:"gray",content:"reset",prop:"yellow",tag:"cyan",value:"green"},sc=Object.keys(So),Pm=e=>e,Ne=Pm({callToJSON:!0,compareKeys:void 0,escapeRegex:!1,escapeString:!0,highlight:!1,indent:2,maxDepth:1/0,maxWidth:1/0,min:!1,plugins:[],printBasicPrototype:!0,printFunctionName:!0,theme:So});et.DEFAULT_OPTIONS=Ne;function Lm(e){if(Object.keys(e).forEach(t=>{if(!Object.prototype.hasOwnProperty.call(Ne,t))throw new Error(`pretty-format: Unknown option "${t}".`)}),e.min&&e.indent!==void 0&&e.indent!==0)throw new Error('pretty-format: Options "min" and "indent" cannot be used together.');if(e.theme!==void 0){if(e.theme===null)throw new Error('pretty-format: Option "theme" must not be null.');if(typeof e.theme!="object")throw new Error(`pretty-format: Option "theme" must be of type "object" but instead received "${typeof e.theme}".`)}}var km=e=>sc.reduce((t,n)=>{let r=e.theme&&e.theme[n]!==void 0?e.theme[n]:So[n],s=r&&bm.default[r];if(s&&typeof s.close=="string"&&typeof s.open=="string")t[n]=s;else throw new Error(`pretty-format: Option "theme" has a key "${n}" whose value "${r}" is undefined in ansi-styles.`);return t},Object.create(null)),Dm=()=>sc.reduce((e,t)=>(e[t]={close:"",open:""},e),Object.create(null)),oc=e=>{var t;return(t=e==null?void 0:e.printFunctionName)!=null?t:Ne.printFunctionName},ic=e=>{var t;return(t=e==null?void 0:e.escapeRegex)!=null?t:Ne.escapeRegex},uc=e=>{var t;return(t=e==null?void 0:e.escapeString)!=null?t:Ne.escapeString},Ja=e=>{var t,n,r,s,o,i,u;return{callToJSON:(t=e==null?void 0:e.callToJSON)!=null?t:Ne.callToJSON,colors:e!=null&&e.highlight?km(e):Dm(),compareKeys:typeof(e==null?void 0:e.compareKeys)=="function"||(e==null?void 0:e.compareKeys)===null?e.compareKeys:Ne.compareKeys,escapeRegex:ic(e),escapeString:uc(e),indent:e!=null&&e.min?"":Fm((n=e==null?void 0:e.indent)!=null?n:Ne.indent),maxDepth:(r=e==null?void 0:e.maxDepth)!=null?r:Ne.maxDepth,maxWidth:(s=e==null?void 0:e.maxWidth)!=null?s:Ne.maxWidth,min:(o=e==null?void 0:e.min)!=null?o:Ne.min,plugins:(i=e==null?void 0:e.plugins)!=null?i:Ne.plugins,printBasicPrototype:(u=e==null?void 0:e.printBasicPrototype)!=null?u:!0,printFunctionName:oc(e),spacingInner:e!=null&&e.min?" ":`
`,spacingOuter:e!=null&&e.min?"":`
`}};function Fm(e){return new Array(e+1).join(" ")}function ac(e,t){if(t&&(Lm(t),t.plugins)){let r=rc(t.plugins,e);if(r!==null)return nc(r,e,Ja(t),"",0,[])}let n=ec(e,oc(t),ic(t),uc(t));return n!==null?n:tc(e,Ja(t),"",0,[])}var jm={AsymmetricMatcher:Em.default,DOMCollection:vm.default,DOMElement:_m.default,Immutable:Rm.default,ReactElement:Om.default,ReactTestComponent:Cm.default};et.plugins=jm;var Bm=ac;et.default=Bm});var Tt=R(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.cleanupSemantic=Pe.Diff=Pe.DIFF_INSERT=Pe.DIFF_EQUAL=Pe.DIFF_DELETE=void 0;var Xt=-1;Pe.DIFF_DELETE=Xt;var Mt=1;Pe.DIFF_INSERT=Mt;var we=0;Pe.DIFF_EQUAL=we;var Ue=class{constructor(t,n){ae(this,0);ae(this,1);this[0]=t,this[1]=n}};Pe.Diff=Ue;var qm=function(e,t){if(!e||!t||e.charAt(0)!=t.charAt(0))return 0;for(var n=0,r=Math.min(e.length,t.length),s=r,o=0;n<s;)e.substring(o,s)==t.substring(o,s)?(n=s,o=n):r=s,s=Math.floor((r-n)/2+n);return s},hc=function(e,t){if(!e||!t||e.charAt(e.length-1)!=t.charAt(t.length-1))return 0;for(var n=0,r=Math.min(e.length,t.length),s=r,o=0;n<s;)e.substring(e.length-s,e.length-o)==t.substring(t.length-s,t.length-o)?(n=s,o=n):r=s,s=Math.floor((r-n)/2+n);return s},cc=function(e,t){var n=e.length,r=t.length;if(n==0||r==0)return 0;n>r?e=e.substring(n-r):n<r&&(t=t.substring(0,n));var s=Math.min(n,r);if(e==t)return s;for(var o=0,i=1;;){var u=e.substring(s-i),a=t.indexOf(u);if(a==-1)return o;i+=a,(a==0||e.substring(s-i)==t.substring(0,i))&&(o=i,i++)}},Hm=function(e){for(var t=!1,n=[],r=0,s=null,o=0,i=0,u=0,a=0,l=0;o<e.length;)e[o][0]==we?(n[r++]=o,i=a,u=l,a=0,l=0,s=e[o][1]):(e[o][0]==Mt?a+=e[o][1].length:l+=e[o][1].length,s&&s.length<=Math.max(i,u)&&s.length<=Math.max(a,l)&&(e.splice(n[r-1],0,new Ue(Xt,s)),e[n[r-1]+1][0]=Mt,r--,r--,o=r>0?n[r-1]:-1,i=0,u=0,a=0,l=0,s=null,t=!0)),o++;for(t&&gc(e),Um(e),o=1;o<e.length;){if(e[o-1][0]==Xt&&e[o][0]==Mt){var c=e[o-1][1],f=e[o][1],p=cc(c,f),m=cc(f,c);p>=m?(p>=c.length/2||p>=f.length/2)&&(e.splice(o,0,new Ue(we,f.substring(0,p))),e[o-1][1]=c.substring(0,c.length-p),e[o+1][1]=f.substring(p),o++):(m>=c.length/2||m>=f.length/2)&&(e.splice(o,0,new Ue(we,c.substring(0,m))),e[o-1][0]=Mt,e[o-1][1]=f.substring(0,f.length-m),e[o+1][0]=Xt,e[o+1][1]=c.substring(m),o++),o++}o++}};Pe.cleanupSemantic=Hm;var Um=function(e){function t(m,h){if(!m||!h)return 6;var d=m.charAt(m.length-1),v=h.charAt(0),O=d.match(lc),A=v.match(lc),w=O&&d.match(fc),M=A&&v.match(fc),T=w&&d.match(pc),B=M&&v.match(pc),G=T&&m.match(Gm),x=B&&h.match(Wm);return G||x?5:T||B?4:O&&!w&&M?3:w||M?2:O||A?1:0}for(var n=1;n<e.length-1;){if(e[n-1][0]==we&&e[n+1][0]==we){var r=e[n-1][1],s=e[n][1],o=e[n+1][1],i=hc(r,s);if(i){var u=s.substring(s.length-i);r=r.substring(0,r.length-i),s=u+s.substring(0,s.length-i),o=u+o}for(var a=r,l=s,c=o,f=t(r,s)+t(s,o);s.charAt(0)===o.charAt(0);){r+=s.charAt(0),s=s.substring(1)+o.charAt(0),o=o.substring(1);var p=t(r,s)+t(s,o);p>=f&&(f=p,a=r,l=s,c=o)}e[n-1][1]!=a&&(a?e[n-1][1]=a:(e.splice(n-1,1),n--),e[n][1]=l,c?e[n+1][1]=c:(e.splice(n+1,1),n--))}n++}},lc=/[^a-zA-Z0-9]/,fc=/\s/,pc=/[\r\n]/,Gm=/\n\r?\n$/,Wm=/^\r?\n\r?\n/,gc=function(e){e.push(new Ue(we,""));for(var t=0,n=0,r=0,s="",o="",i;t<e.length;)switch(e[t][0]){case Mt:r++,o+=e[t][1],t++;break;case Xt:n++,s+=e[t][1],t++;break;case we:n+r>1?(n!==0&&r!==0&&(i=qm(o,s),i!==0&&(t-n-r>0&&e[t-n-r-1][0]==we?e[t-n-r-1][1]+=o.substring(0,i):(e.splice(0,0,new Ue(we,o.substring(0,i))),t++),o=o.substring(i),s=s.substring(i)),i=hc(o,s),i!==0&&(e[t][1]=o.substring(o.length-i)+e[t][1],o=o.substring(0,o.length-i),s=s.substring(0,s.length-i))),t-=n+r,e.splice(t,n+r),s.length&&(e.splice(t,0,new Ue(Xt,s)),t++),o.length&&(e.splice(t,0,new Ue(Mt,o)),t++),t++):t!==0&&e[t-1][0]==we?(e[t-1][1]+=e[t][1],e.splice(t,1)):t++,r=0,n=0,s="",o="";break}e[e.length-1][1]===""&&e.pop();var u=!1;for(t=1;t<e.length-1;)e[t-1][0]==we&&e[t+1][0]==we&&(e[t][1].substring(e[t][1].length-e[t-1][1].length)==e[t-1][1]?(e[t][1]=e[t-1][1]+e[t][1].substring(0,e[t][1].length-e[t-1][1].length),e[t+1][1]=e[t-1][1]+e[t+1][1],e.splice(t-1,1),u=!0):e[t][1].substring(0,e[t+1][1].length)==e[t+1][1]&&(e[t-1][1]+=e[t+1][1],e[t][1]=e[t][1].substring(e[t+1][1].length)+e[t+1][1],e.splice(t+1,1),u=!0)),t++;u&&gc(e)}});var mc=R(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.SIMILAR_MESSAGE=Jt.NO_DIFF_MESSAGE=void 0;var Vm="Compared values have no visual difference.";Jt.NO_DIFF_MESSAGE=Vm;var zm="Compared values serialize to the same structure.\nPrinting internal object structure without calling `toJSON` instead.";Jt.SIMILAR_MESSAGE=zm});var To=R(Mo=>{"use strict";Object.defineProperty(Mo,"__esModule",{value:!0});Mo.default=Xm;var Bn="diff-sequences",be=0,qn=(e,t,n,r,s)=>{let o=0;for(;e<t&&n<r&&s(e,n);)e+=1,n+=1,o+=1;return o},Hn=(e,t,n,r,s)=>{let o=0;for(;e<=t&&n<=r&&s(t,r);)t-=1,r-=1,o+=1;return o},wo=(e,t,n,r,s,o,i)=>{let u=0,a=-e,l=o[u],c=l;o[u]+=qn(l+1,t,r+l-a+1,n,s);let f=e<i?e:i;for(u+=1,a+=2;u<=f;u+=1,a+=2){if(u!==e&&c<o[u])l=o[u];else if(l=c+1,t<=l)retu Line truncated
`)};Zt.joinAlignedDiffsNoExpand=Zm;var ed=(e,t)=>e.map((n,r,s)=>{let o=n[1],i=r===0||r===s.length-1;switch(n[0]){case xt.DIFF_DELETE:return vc(o,i,t);case xt.DIFF_INSERT:return _c(o,i,t);default:return Rc(o,i,t)}}).join(`
`);Zt.joinAlignedDiffsExpand=ed});var Fr=R(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});en.normalizeDiffOptions=en.noColor=void 0;var Un=td(zt());function td(e){return e&&e.__esModule?e:{default:e}}var $o=e=>e;en.noColor=$o;var Cc=5,Sc={aAnnotation:"Expected",aColor:Un.default.green,aIndicator:"-",bAnnotation:"Received",bColor:Un.default.red,bIndicator:"+",changeColor:Un.default.inverse,changeLineTrailingSpaceColor:$o,commonColor:Un.default.dim,commonIndicator:" ",commonLineTrailingSpaceColor:$o,compareKeys:void 0,contextLines:Cc,emptyFirstOrLastLinePlaceholder:"",expand:!0,includeChangeCounts:!1,omitAnnotationLines:!1,patchColor:Un.default.yellow},nd=e=>e&&typeof e=="function"?e:Sc.compareKeys,rd=e=>typeof e=="number"&&Number.isSafeInteger(e)&&e>=0?e:Cc,sd=(e={})=>({...Sc,...e,compareKeys:nd(e.compareKeys),contextLines:rd(e.contextLines)});en.normalizeDiffOptions=sd});var Po=R(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.printDiffLines=Ge.diffLinesUnified2=Ge.diffLinesUnified=Ge.diffLinesRaw=void 0;var od=id(To()),Oe=Tt(),wc=Oc(),Ac=Fr();function id(e){return e&&e.__esModule?e:{default:e}}var tn=e=>e.length===1&&e[0].length===0,ud=e=>{let t=0,n=0;return e.forEach(r=>{switch(r[0]){case Oe.DIFF_DELETE:t+=1;break;case Oe.DIFF_INSERT:n+=1;break}}),{a:t,b:n}},ad=({aAnnotation:e,aColor:t,aIndicator:n,bAnnotation:r,bColor:s,bIndicator:o,includeChangeCounts:i,omitAnnotationLines:u},a)=>{if(u)return"";let l="",c="";if(i){let m=String(a.a),h=String(a.b),d=r.length-e.length,v=" ".repeat(Math.max(0,d)),O=" ".repeat(Math.max(0,-d)),A=h.length-m.length,w=" ".repeat(Math.max(0,A)),M=" ".repeat(Math.max(0,-A));l=`${v} ${n} ${w}${m}`,c=`${O} ${o} ${M}${h}`}let f=`${n} ${e}${l}`,p=`${o} ${r}${c}`;return`${t(f)}
${s(p)}
`},Io=(e,t)=>ad(t,ud(e))+(t.expand?(0,wc.joinAlignedDiffsExpand)(e,t):(0,wc.joinAlignedDiffsNoExpand)(e,t));Ge.printDiffLines=Io;var Mc=(e,t,n)=>Io(No(tn(e)?[]:e,tn(t)?[]:t),(0,Ac.normalizeDiffOptions)(n));Ge.diffLinesUnified=Mc;var cd=(e,t,n,r,s)=>{if(tn(e)&&tn(n)&&(e=[],n=[]),tn(t)&&tn(r)&&(t=[],r=[]),e.length!==n.length||t.length!==r.length)return Mc(e,t,s);let o=No(n,r),i=0,u=0;return o.forEach(a=>{switch(a[0]){case Oe.DIFF_DELETE:a[1]=e[i],i+=1;break;case Oe.DIFF_INSERT:a[1]=t[u],u+=1;break;default:a[1]=t[u],i+=1,u+=1}}),Io(o,(0,Ac.normalizeDiffOptions)(s))};Ge.diffLinesUnified2=cd;var No=(e,t)=>{let n=e.length,r=t.length,s=(l,c)=>e[l]===t[c],o=[],i=0,u=0,a=(l,c,f)=>{for(;i!==c;i+=1)o.push(new Oe.Diff(Oe.DIFF_DELETE,e[i]));for(;u!==f;u+=1)o.push(new Oe.Diff(Oe.DIFF_INSERT,t[u]));for(;l!==0;l-=1,i+=1,u+=1)o.push(new Oe.Diff(Oe.DIFF_EQUAL,t[u]))};for((0,od.default)(n,r,s,a);i!==n;i+=1)o.push(new Oe.Diff(Oe.DIFF_DELETE,e[i]));for(;u!==r;u+=1)o.push(new Oe.Diff(Oe.DIFF_INSERT,t[u]));return o};Ge.diffLinesRaw=No});var Tc=R(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.default=void 0;var ld=fd(To()),We=Tt();function fd(e){return e&&e.__esModule?e:{default:e}}var pd=(e,t)=>{let n=(u,a)=>e[u]===t[a],r=0,s=0,o=[],i=(u,a,l)=>{r!==a&&o.push(new We.Diff(We.DIFF_DELETE,e.slice(r,a))),s!==l&&o.push(new We.Diff(We.DIFF_INSERT,t.slice(s,l))),r=a+u,s=l+u,o.push(new We.Diff(We.DIFF_EQUAL,t.slice(l,s)))};return(0,ld.default)(e.length,t.length,n,i),r!==e.length&&o.push(new We.Diff(We.DIFF_DELETE,e.slice(r))),s!==t.length&&o.push(new We.Diff(We.DIFF_INSERT,t.slice(s))),o},hd=pd;jr.default=hd});var xc=R(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.default=void 0;var Be=Tt(),gd=(e,t,n)=>t.reduce((r,s)=>r+(s[0]===Be.DIFF_EQUAL?s[1]:s[0]===e&&s[1].length!==0?n(s[1]):""),""),Br=class{constructor(t,n){ae(this,"op");ae(this,"line");ae(this,"lines");ae(this,"changeColor");this.op=t,this.line=[],this.lines=[],this.changeColor=n}pushSubstring(t){this.pushDiff(new Be.Diff(this.op,t))}pushLine(){this.lines.push(this.line.length!==1?new Be.Diff(this.op,gd(this.op,this.line,this.changeColor)):this.line[0][0]===this.op?this.line[0]:new Be.Diff(this.op,this.line[0][1])),this.line.length=0}isLineEmpty(){return this.line.length===0}pushDiff(t){this.line.push(t)}align(t){let n=t[1];if(n.includes(`
`)){let r=n.split(`
`),s=r.length-1;r.forEach((o,i)=>{i<s?(this.pushSubstring(o),this.pushLine()):o.length!==0&&this.pushSubstring(o)})}else this.pushDiff(t)}moveLinesTo(t){this.isLineEmpty()||this.pushLine(),t.push(...this.lines),this.lines.length=0}},Lo=class{constructor(t,n){ae(this,"deleteBuffer");ae(this,"insertBuffer");ae(this,"lines");this.deleteBuffer=t,this.insertBuffer=n,this.lines=[]}pushDiffCommonLine(t){this.lines.push(t)}pushDiffChangeLines(t){let n=t[1].length===0;(!n||this.deleteBuffer.isLineEmpty())&&this.deleteBuffer.pushDiff(t),(!n||this.insertBuffer.isLineEmpty())&&this.insertBuffer.pushDiff(t)}flushChangeLines(){this.deleteBuffer.moveLinesTo(this.lines),this.insertBuffer.moveLinesTo(this.lines)}align(t){let n=t[0],r=t[1];if(r.includes(`
`)){let s=r.split(`
`),o=s.length-1;s.forEach((i,u)=>{if(u===0){let a=new Be.Diff(n,i);this.deleteBuffer.isLineEmpty()&&this.insertBuffer.isLineEmpty()?(this.flushChangeLines(),this.pushDiffCommonLine(a)):(this.pushDiffChangeLines(a),this.flushChangeLines())}else u<o?this.pushDiffCommonLine(new Be.Diff(n,i)):i.length!==0&&this.pushDiffChangeLines(new Be.Diff(n,i))})}else this.pushDiffChangeLines(t)}getLines(){return this.flushChangeLines(),this.lines}},md=(e,t)=>{let n=new Br(Be.DIFF_DELETE,t),r=new Br(Be.DIFF_INSERT,t),s=new Lo(n,r);return e.forEach(o=>{switch(o[0]){case Be.DIFF_DELETE:n.align(o);break;case Be.DIFF_INSERT:r.align(o);break;default:s.align(o)}}),s.getLines()},dd=md;qr.default=dd});var Pc=R(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.diffStringsUnified=nn.diffStringsRaw=void 0;var ko=Tt(),$c=Po(),yd=Ic(Tc()),bd=Ic(xc()),Ed=Fr();function Ic(e){return e&&e.__esModule?e:{default:e}}var vd=(e,t)=>{if(t){let n=e.length-1;return e.some((r,s)=>r[0]===ko.DIFF_EQUAL&&(s!==n||r[1]!==`
`))}return e.some(n=>n[0]===ko.DIFF_EQUAL)},_d=(e,t,n)=>{if(e!==t&&e.length!==0&&t.length!==0){let r=e.includes(`
`)||t.includes(`
`),s=Nc(r?`${e}
`:e,r?`${t}
`:t,!0);if(vd(s,r)){let o=(0,Ed.normalizeDiffOptions)(n),i=(0,bd.default)(s,o.changeColor);return(0,$c.printDiffLines)(i,o)}}return(0,$c.diffLinesUnified)(e.split(`
`),t.split(`
`),n)};nn.diffStringsUnified=_d;var Nc=(e,t,n)=>{let r=(0,yd.default)(e,t);return n&&(0,ko.cleanupSemantic)(r),r};nn.diffStringsRaw=Nc});var Uc=R(Le=>{"use strict";Object.defineProperty(Le,"__esModule",{value:!0});Object.defineProperty(Le,"DIFF_DELETE",{enumerable:!0,get:function(){return Hr.DIFF_DELETE}});Object.defineProperty(Le,"DIFF_EQUAL",{enumerable:!0,get:function(){return Hr.DIFF_EQUAL}});Object.defineProperty(Le,"DIFF_INSERT",{enumerable:!0,get:function(){return Hr.DIFF_INSERT}});Object.defineProperty(Le,"Diff",{enumerable:!0,get:function(){return Hr.Diff}});Le.diff=$d;Object.defineProperty(Le,"diffLinesRaw",{enumerable:!0,get:function(){return rn.diffLinesRaw}});Object.defineProperty(Le,"diffLinesUnified",{enumerable:!0,get:function(){return rn.diffLinesUnified}});Object.defineProperty(Le,"diffLinesUnified2",{enumerable:!0,get:function(){return rn.diffLinesUnified2}});Object.defineProperty(Le,"diffStringsRaw",{enumerable:!0,get:function(){return qc.diffStringsRaw}});Object.defineProperty(Le,"diffStringsUnified",{enumerable:!0,get:function(){return qc.diffStringsUnified}});var Lc=Rd(zt()),Do=ot(),$t=jn(),Hr=Tt(),Gn=mc(),rn=Po(),Bc=Fr(),qc=Pc();function Rd(e){return e&&e.__esModule?e:{default:e}}var Od=globalThis["jest-symbol-do-not-touch"]||globalThis.Symbol,Wn=(e,t)=>{let{commonColor:n}=(0,Bc.normalizeDiffOptions)(t);return n(e)},{AsymmetricMatcher:Cd,DOMCollection:Sd,DOMElement:wd,Immutable:Ad,ReactElement:Md,ReactTestComponent:Td}=$t.plugins,Hc=[Td,Md,wd,Sd,Ad,Cd],jo={plugins:Hc},xd={callToJSON:!1,maxDepth:10,plugins:Hc};function $d(e,t,n){if(Object.is(e,t))return Wn(Gn.NO_DIFF_MESSAGE,n);let r=(0,Do.getType)(e),s=r,o=!1;if(r==="object"&&typeof e.asymmetricMatch=="function"){if(e.$$typeof!==Od.for("jest.asymmetricMatcher")||typeof e.getExpectedType!="function")return null;s=e.getExpectedType(),o=s==="string"}if(s!==(0,Do.getType)(t))return` Comparing two different types of values. Expected ${Lc.default.green(s)} but received ${Lc.default.red((0,Do.getType)(t))}.`;if(o)return null;switch(r){case"string":return(0,rn.diffLinesUnified)(e.split(`
`),t.split(`
`),n);case"boolean":case"number":return Id(e,t,n);case"map":return Fo(kc(e),kc(t),n);case"set":return Fo(Dc(e),Dc(t),n);default:return Fo(e,t,n)}}function Id(e,t,n){let r=(0,$t.format)(e,jo),s=(0,$t.format)(t,jo);return r===s?Wn(Gn.NO_DIFF_MESSAGE,n):(0,rn.diffLinesUnified)(r.split(`
`),s.split(`
`),n)}function kc(e){return new Map(Array.from(e.entries()).sort())}function Dc(e){return new Set(Array.from(e.values()).sort())}function Fo(e,t,n){let r,s=!1;try{let i=Fc(jo,n);r=jc(e,t,i,n)}catch{s=!0}let o=Wn(Gn.NO_DIFF_MESSAGE,n);if(r===void 0||r===o){let i=Fc(xd,n);r=jc(e,t,i,n),r!==o&&!s&&(r=`${Wn(Gn.SIMILAR_MESSAGE,n)}
${r}`)}return r}function Fc(e,t){let{compareKeys:n}=(0,Bc.normalizeDiffOptions)(t);return{...e,compareKeys:n}}function jc(e,t,n,r){let s={...n,indent:0},o=(0,$t.format)(e,s),i=(0,$t.format)(t,s);if(o===i)return Wn(Gn.NO_DIFF_MESSAGE,r);{let u=(0,$t.format)(e,n),a=(0,$t.format)(t,n);return(0,rn.diffLinesUnified2)(u.split(`
`),a.split(`
`),o.split(`
`),i.split(`
`),r)}}});var Wc=R(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.default=void 0;var Bo=ot(),Gc=["map","array","object"],qo=class{constructor(t){ae(this,"object");ae(this,"type");if(this.object=t,this.type=(0,Bo.getType)(t),!Gc.includes(this.type))throw new Error(`Type ${this.type} is not support in Replaceable!`)}static isReplaceable(t,n){let r=(0,Bo.getType)(t),s=(0,Bo.getType)(n);return r===s&&Gc.includes(r)}forEach(t){if(this.type==="object"){let n=Object.getOwnPropertyDescriptors(this.object);[...Object.keys(n),...Object.getOwnPropertySymbols(n)].filter(r=>n[r].enumerable).forEach(r=>{t(this.object[r],r,this.object)})}else this.object.forEach(t)}get(t){return this.type==="map"?this.object.get(t):this.object[t]}set(t,n){this.type==="map"?this.object.set(t,n):this.object[t]=n}};Ur.default=qo});var zc=R(Ho=>{"use strict";Object.defineProperty(Ho,"__esModule",{value:!0});Ho.default=Gr;var Nd=jn(),Vc=[Array,Date,Float32Array,Float64Array,Int16Array,Int32Array,Int8Array,Map,Set,RegExp,Uint16Array,Uint32Array,Uint8Array,Uint8ClampedArray];typeof Buffer!="undefined"&&Vc.push(Buffer);var Pd=e=>Vc.includes(e.constructor),Ld=e=>e.constructor===Map;function Gr(e,t=new WeakMap){return typeof e!="object"||e===null?e:t.has(e)?t.get(e):Array.isArray(e)?Dd(e,t):Ld(e)?Fd(e,t):Pd(e)?e:Nd.plugins.DOMElement.test(e)?e.cloneNode(!0):kd(e,t)}function kd(e,t){let n=Object.create(Object.getPrototypeOf(e)),r={},s=e;do r=Object.assign({},Object.getOwnPropertyDescriptors(s),r);while((s=Object.getPrototypeOf(s))&&s!==Object.getPrototypeOf({}));t.set(e,n);let o=[...Object.keys(r),...Object.getOwnPropertySymbols(r)].reduce((i,u)=>{let a=r[u].enumerable;return i[u]={configurable:!0,enumerable:a,value:Gr(e[u],t),writable:!0},i},{});return Object.defineProperties(n,o)}function Dd(e,t){let n=new(Object.getPrototypeOf(e)).constructor(e.length),r=e.length;t.set(e,n);for(let s=0;s<r;s++)n[s]=Gr(e[s],t);return n}function Fd(e,t){let n=new Map;return t.set(e,n),e.forEach((r,s)=>{n.set(s,Gr(r,t))}),n}});var ze=R(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.printReceived=q.printExpected=q.printDiffOrStringify=q.pluralize=q.matcherHint=q.matcherErrorMessage=q.highlightTrailingWhitespace=q.getLabelPrinter=q.ensureNumbers=q.ensureNoExpected=q.ensureExpectedIsNumber=q.ensureExpectedIsNonNegativeInteger=q.ensureActualIsNumber=q.diff=q.SUGGEST_TO_CONTAIN_EQUAL=q.RECEIVED_COLOR=q.INVERTED_COLOR=q.EXPECTED_COLOR=q.DIM_COLOR=q.BOLD_WEIGHT=void 0;q.printWithType=zn;q.replaceMatchedToAsymmetricMatcher=sl;q.stringify=void 0;var Ve=Wo(zt()),gt=Uc(),Vn=ot(),Uo=jn(),Wr=Wo(Wc()),Kc=Wo(zc());function Wo(e){return e&&e.__esModule?e:{default:e}}var{AsymmetricMatcher:jd,DOMCollection:Bd,DOMElement:qd,Immutable:Hd,ReactElement:Ud,ReactTestComponent:Gd}=Uo.plugins,Yc=[Gd,Ud,qd,Bd,Hd,jd],sn=Ve.default.green;q.EXPECTED_COLOR=sn;var zr=Ve.default.red;q.RECEIVED_COLOR=zr;var el=Ve.default.inverse;q.INVERTED_COLOR=el;var Wd=Ve.default.bold;q.BOLD_WEIGHT=Wd;var ht=Ve.default.dim;q.DIM_COLOR=ht;var Qc=/\n/,Vd="\xB7",zd=["zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen"],Kd=Ve.default.dim("Looks like you wanted to test for object/array equality with the stricter `toContain` matcher. You probably need to use `toContainEqual` instead.");q.SUGGEST_TO_CONTAIN_EQUAL=Kd;var It=(e,t=10,n=10)=>{let s;try{s=(0,Uo.format)(e,{maxDepth:t,maxWidth:n,min:!0,plugins:Yc})}catch{s=(0,Uo.format)(e,{callToJSON:!1,maxDepth:t,maxWidth:n,min:!0,plugins:Yc})}return s.length>=1e4&&t>1?It(e,Math.floor(t/2),n):s.length>=1e4&&n>1?It(e,t,Math.floor(n/2)):s};q.stringify=It;var Yd=e=>e.replace(/\s+$/gm,Ve.default.inverse("$&"));q.highlightTrailingWhitespace=Yd;var tl=e=>e.replace(/\s+$/gm,t=>Vd.repeat(t.length)),Vr=e=>zr(tl(It(e)));q.printReceived=Vr;var on=e=>sn(tl(It(e)));q.printExpected=on;function zn(e,t,n){let r=(0,Vn.getType)(t),s=r!=="null"&&r!=="undefined"?`${e} has type: ${r}
`:"",o=`${e} has value: ${n(t)}`;return s+o}var Qd=(e,t,n)=>{if(typeof e!="undefined"){let r=(n?"":"[.not]")+t;throw new Error(Kn(Yn(r,void 0,"",n),"this matcher must not have an expected argument",zn("Expected",e,on)))}};q.ensureNoExpected=Qd;var nl=(e,t,n)=>{if(typeof e!="number"&&typeof e!="bigint"){let r=(n?"":"[.not]")+t;throw new Error(Kn(Yn(r,void 0,void 0,n),`${zr("received")} value must be a number or bigint`,zn("Received",e,Vr)))}};q.ensureActualIsNumber=nl;var rl=(e,t,n)=>{if(typeof e!="number"&&typeof e!="bigint"){let r=(n?"":"[.not]")+t;throw new Error(Kn(Yn(r,void 0,void 0,n),`${sn("expected")} value must be a number or bigint`,zn("Expected",e,on)))}};q.ensureExpectedIsNumber=rl;var Xd=(e,t,n,r)=>{nl(e,n,r),rl(t,n,r)};q.ensureNumbers=Xd;var Jd=(e,t,n)=>{if(typeof e!="number"||!Number.isSafeInteger(e)||e<0){let r=(n?"":"[.not]")+t;throw new Error(Kn(Yn(r,void 0,void 0,n),`${sn("expected")} value must be a non-negative integer`,zn("Expected",e,on)))}};q.ensureExpectedIsNonNegativeInteger=Jd;var Xc=(e,t,n)=>e.reduce((r,s)=>r+(s[0]===gt.DIFF_EQUAL?s[1]:s[0]!==t?"":n?el(s[1]):s[1]),""),Zd=(e,t)=>{let n=(0,Vn.getType)(e),r=(0,Vn.getType)(t);return n!==r?!1:(0,Vn.isPrimitive)(e)?typeof e=="string"&&typeof t=="string"&&e.length!==0&&t.length!==0&&(Qc.test(e)||Qc.test(t)):!(n==="date"||n==="function"||n==="regexp"||e instanceof Error&&t instanceof Error||r==="object"&&typeof t.asymmetricMatch=="function")},Jc=2e4,e1=(e,t,n,r,s)=>{if(typeof e=="string"&&typeof t=="string"&&e.length!==0&&t.length!==0&&e.length<=Jc&&t.length<=Jc&&e!==t){if(e.includes(`
`)||t.includes(`
`))return(0,gt.diffStringsUnified)(e,t,{aAnnotation:n,bAnnotation:r,changeLineTrailingSpaceColor:Ve.default.bgYellow,commonLineTrailingSpaceColor:Ve.default.bgYellow,emptyFirstOrLastLinePlaceholder:"\u21B5",expand:s,includeChangeCounts:!0});let a=(0,gt.diffStringsRaw)(e,t,!0),l=a.some(m=>m[0]===gt.DIFF_EQUAL),c=Go(n,r),f=c(n)+on(Xc(a,gt.DIFF_DELETE,l)),p=c(r)+Vr(Xc(a,gt.DIFF_INSERT,l));return`${f}
${p}`}if(Zd(e,t)){let{replacedExpected:a,replacedReceived:l}=sl(e,t,[],[]),c=(0,gt.diff)(a,l,{aAnnotation:n,bAnnotation:r,expand:s,includeChangeCounts:!0});if(typeof c=="string"&&c.includes(`- ${n}`)&&c.includes(`+ ${r}`))return c}let o=Go(n,r),i=o(n)+on(e),u=o(r)+(It(e)===It(t)?"serializes to the same string":Vr(t));return`${i}
${u}`};q.printDiffOrStringify=e1;var t1=(e,t)=>!(typeof e=="number"&&typeof t=="number"||typeof e=="bigint"&&typeof t=="bigint"||typeof e=="boolean"&&typeof t=="boolean");function sl(e,t,n,r){return ol((0,Kc.default)(e),(0,Kc.default)(t),n,r)}function ol(e,t,n,r){if(!Wr.default.isReplaceable(e,t))return{replacedExpected:e,replacedReceived:t};if(n.includes(e)||r.includes(t))return{replacedExpected:e,replacedReceived:t};n.push(e),r.push(t);let s=new Wr.default(e),o=new Wr.default(t);return s.forEach((i,u)=>{let a=o.get(u);if(Zc(i))i.asymmetricMatch(a)&&o.set(u,i);else if(Zc(a))a.asymmetricMatch(i)&&s.set(u,a);else if(Wr.default.isReplaceable(i,a)){let l=ol(i,a,n,r);s.set(u,l.replacedExpected),o.set(u,l.replacedReceived)}}),{replacedExpected:s.object,replacedReceived:o.object}}function Zc(e){return(0,Vn.getType)(e)==="object"&&typeof e.asymmetricMatch=="function"}var n1=(e,t,n)=>t1(e,t)?(0,gt.diff)(e,t,n):null;q.diff=n1;var r1=(e,t)=>`${zd[t]||t} ${e}${t===1?"":"s"}`;q.pluralize=r1;var Go=(...e)=>{let t=e.reduce((n,r)=>r.length>n?r.length:n,0);return n=>`${n}: ${" ".repeat(t-n.length)}`};q.getLabelPrinter=Go;var Kn=(e,t,n)=>`${e}
${Ve.default.bold("Matcher error")}: ${t}${typeof n=="string"?`
${n}`:""}`;q.matcherErrorMessage=Kn;var Yn=(e,t="received",n="expected",r={})=>{let{comment:s="",expectedColor:o=sn,isDirectExpectCall:i=!1,isNot:u=!1,promise:a="",receivedColor:l=zr,secondArgument:c="",secondArgumentColor:f=sn}=r,p="",m="expect";return!i&&t!==""&&(p+=ht(`${m}(`)+l(t),m=")"),a!==""&&(p+=ht(`${m}.`)+a,m=""),u&&(p+=`${ht(`${m}.`)}not`,m=""),e.includes(".")?m+=e:(p+=ht(`${m}.`)+e,m=""),n===""?m+="()":(p+=ht(`${m}(`)+o(n),c&&(p+=ht(", ")+f(c)),m=")"),s!==""&&(m+=` // ${s}`),m!==""&&(p+=ht(m)),p};q.matcherHint=Yn});var zo=R(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});Xn.equals=void 0;Xn.isA=cl;var al=(e,t,n,r)=>(n=n||[],Vo(e,t,[],[],n,r));Xn.equals=al;function Qn(e){return!!e&&cl("Function",e.asymmetricMatch)}function s1(e,t){let n=Qn(e),r=Qn(t);if(!(n&&r)){if(n)return e.asymmetricMatch(t);if(r)return t.asymmetricMatch(e)}}function Vo(e,t,n,r,s,o){let i=!0,u=s1(e,t);if(u!==void 0)return u;let a={equals:al};for(let d=0;d<s.length;d++){let v=s[d].call(a,e,t,s);if(v!==void 0)return v}if(e instanceof Error&&t instanceof Error)return e.message==t.message;if(Object.is(e,t))return!0;if(e===null||t===null)return e===t;let l=Object.prototype.toString.call(e);if(l!=Object.prototype.toString.call(t))return!1;switch(l){case"[object Boolean]":case"[object String]":case"[object Number]":return typeof e!=typeof t?!1:typeof e!="object"&&typeof t!="object"?Object.is(e,t):Object.is(e.valueOf(),t.valueOf());case"[object Date]":return+e==+t;case"[object RegExp]":return e.source===t.source&&e.flags===t.flags}if(typeof e!="object"||typeof t!="object")return!1;if(ul(e)&&ul(t))return e.isEqualNode(t);let c=n.length;for(;c--;){if(n[c]===e)return r[c]===t;if(r[c]===t)return!1}if(n.push(e),r.push(t),o&&l=="[object Array]"&&e.length!==t.length)return!1;let f=il(e,un),p,m=il(t,un);if(!o){for(let d=0;d!==m.length;++d)p=m[d],(Qn(t[p])||t[p]===void 0)&&!un(e,p)&&f.push(p);for(let d=0;d!==f.length;++d)p=f[d],(Qn(e[p])||e[p]===void 0)&&!un(t,p)&&m.push(p)}let h=f.length;if(m.length!==h)return!1;for(;h--;)if(p=f[h],o?i=un(t,p)&&Vo(e[p],t[p],n,r,s,o):i=(un(t,p)||Qn(e[p])||e[p]===void 0)&&Vo(e[p],t[p],n,r,s,o),!i)return!1;return n.pop(),r.pop(),i}function il(e,t){let n=[];for(let r in e)t(e,r)&&n.push(r);return n.concat(Object.getOwnPropertySymbols(e).filter(r=>Object.getOwnPropertyDescriptor(e,r).enumerable))}function un(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function cl(e,t){return Object.prototype.toString.apply(t)===`[object ${e}]`}function ul(e){return e!==null&&typeof e=="object"&&typeof e.nodeType=="number"&&typeof e.nodeName=="string"&&typeof e.isEqualNode=="function"}});var pl=R(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.isImmutableList=c1;mt.isImmutableOrderedKeyed=l1;mt.isImmutableOrderedSet=f1;mt.isImmutableRecord=p1;mt.isImmutableUnorderedKeyed=u1;mt.isImmutableUnorderedSet=a1;var ll="@@__IMMUTABLE_KEYED__@@",fl="@@__IMMUTABLE_SET__@@",o1="@@__IMMUTABLE_LIST__@@",Kr="@@__IMMUTABLE_ORDERED__@@",i1="@@__IMMUTABLE_RECORD__@@";function an(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function u1(e){return!!(e&&an(e)&&e[ll]&&!e[Kr])}function a1(e){return!!(e&&an(e)&&e[fl]&&!e[Kr])}function c1(e){return!!(e&&an(e)&&e[o1])}function l1(e){return!!(e&&an(e)&&e[ll]&&e[Kr])}function f1(e){return!!(e&&an(e)&&e[fl]&&e[Kr])}function p1(e){return!!(e&&an(e)&&e[i1])}});var vl=R(J=>{"use strict";Object.defineProperty(J,"__esModule",{value:!0});J.arrayBufferEquality=void 0;J.emptyObject=E1;J.typeEquality=J.subsetEquality=J.sparseArrayEquality=J.pathAsArray=J.partition=J.iterableEquality=J.isOneline=J.isError=J.getPath=J.getObjectSubset=J.getObjectKeys=void 0;var h1=ot(),cn=pl(),Ae=zo(),g1=globalThis["jest-symbol-do-not-touch"]||globalThis.Symbol,Qo=(e,t)=>!e||typeof e!="object"||e===Object.prototype?!1:Object.prototype.hasOwnProperty.call(e,t)||Qo(Object.getPrototypeOf(e),t),Yr=e=>[...Object.keys(e),...Object.getOwnPropertySymbols(e)];J.getObjectKeys=Yr;var dl=(e,t)=>{if(Array.isArray(t)||(t=El(t)),t.length){let n=t.length===1,r=t[0],s=e[r];if(!n&&s==null)return{hasEndProp:!1,lastTraversedObject:e,traversedPath:[]};let o=dl(s,t.slice(1));return o.lastTraversedObject===null&&(o.lastTraversedObject=e),o.traversedPath.unshift(r),n&&(o.endPropIsDefined=!(0,h1.isPrimitive)(e)&&r in e,o.hasEndProp=s!==void 0||o.endPropIsDefined,o.hasEndProp||o.traversedPath.shift()),o}return{lastTraversedObject:null,traversedPath:[],value:e}};J.getPath=dl;var Ko=(e,t,n=[],r=new WeakMap)=>{if(Array.isArray(e)){if(Array.isArray(t)&&t.length===e.length)return t.map((s,o)=>Ko(e[o],s,n))}else{if(e instanceof Date)return e;if(Yo(e)&&Yo(t)){if((0,Ae.equals)(e,t,[...n,Qr,Xo]))return t;let s={};if(r.set(e,s),Yr(e).filter(o=>Qo(t,o)).forEach(o=>{s[o]=r.has(e[o])?r.get(e[o]):Ko(e[o],t[o],n,r)}),Yr(s).length>0)return s}}return e};J.getObjectSubset=Ko;var yl=g1.iterator,hl=e=>!!(e!=null&&e[yl]),Qr=(e,t,n=[],r=[],s=[])=>{if(typeof e!="object"||typeof t!="object"||Array.isArray(e)||Array.isArray(Line truncated
GFS4: `),console.error(e)});se[ye]||(Fl=global[ye]||[],Bl(se,Fl),se.close=function(e){function t(n,r){return e.call(se,n,function(s){s||jl(),typeof r=="function"&&r.apply(this,arguments)})}return Object.defineProperty(t,ns,{value:e}),t}(se.close),se.closeSync=function(e){function t(n){e.apply(se,arguments),jl()}return Object.defineProperty(t,ns,{value:e}),t}(se.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Pt(se[ye]),require("assert").equal(se[ye].length,0)}));var Fl;global[ye]||Bl(global,se[ye]);ui.exports=oi(j1(se));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!se.__patched&&(ui.exports=oi(se),se.__patched=!0);function oi(e){D1(e),e.gracefulify=oi,e.createReadStream=T,e.createWriteStream=B;var t=e.readFile;e.readFile=n;function n(C,N,y){return typeof N=="function"&&(y=N,N=null),F(C,N,y);function F(k,W,b,E){return t(k,W,function(j){j&&(j.code==="EMFILE"||j.code==="ENFILE")?fn([F,[k,W,b],j,E||Date.now(),Date.now()]):typeof b=="function"&&b.apply(this,arguments)})}}var r=e.writeFile;e.writeFile=s;function s(C,N,y,F){return typeof y=="function"&&(F=y,y=null),k(C,N,y,F);function k(W,b,E,j,D){return r(W,b,E,function(H){H&&(H.code==="EMFILE"||H.code==="ENFILE")?fn([k,[W,b,E,j],H,D||Date.now(),Date.now()]):typeof j=="function"&&j.apply(this,arguments)})}}var o=e.appendFile;o&&(e.appendFile=i);function i(C,N,y,F){return typeof y=="function"&&(F=y,y=null),k(C,N,y,F);function k(W,b,E,j,D){return o(W,b,E,function(H){H&&(H.code==="EMFILE"||H.code==="ENFILE")?fn([k,[W,b,E,j],H,D||Date.now(),Date.now()]):typeof j=="function"&&j.apply(this,arguments)})}}var u=e.copyFile;u&&(e.copyFile=a);function a(C,N,y,F){return typeof y=="function"&&(F=y,y=0),k(C,N,y,F);function k(W,b,E,j,D){return u(W,b,E,function(H){H&&(H.code==="EMFILE"||H.code==="ENFILE")?fn([k,[W,b,E,j],H,D||Date.now(),Date.now()]):typeof j=="function"&&j.apply(this,arguments)})}}var l=e.readdir;e.readdir=f;var c=/^v[0-5]\./;function f(C,N,y){typeof N=="function"&&(y=N,N=null);var F=c.test(process.version)?function(b,E,j,D){return l(b,k(b,E,j,D))}:function(b,E,j,D){return l(b,E,k(b,E,j,D))};return F(C,N,y);function k(W,b,E,j){return function(D,H){D&&(D.code==="EMFILE"||D.code==="ENFILE")?fn([F,[W,b,E],D,j||Date.now(),Date.now()]):(H&&H.sort&&H.sort(),typeof E=="function"&&E.call(this,D,H))}}}if(process.version.substr(0,4)==="v0.8"){var p=F1(e);O=p.ReadStream,w=p.WriteStream}var m=e.ReadStream;m&&(O.prototype=Object.create(m.prototype),O.prototype.open=A);var h=e.WriteStream;h&&(w.prototype=Object.create(h.prototype),w.prototype.open=M),Object.defineProperty(e,"ReadStream",{get:function(){return O},set:function(C){O=C},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return w},set:function(C){w=C},enumerable:!0,configurable:!0});var d=O;Object.defineProperty(e,"FileReadStream",{get:function(){return d},set:function(C){d=C},enumerable:!0,configurable:!0});var v=w;Object.defineProperty(e,"FileWriteStream",{get:function(){return v},set:function(C){v=C},enumerable:!0,configurable:!0});function O(C,N){return this instanceof O?(m.apply(this,arguments),this):O.apply(Object.create(O.prototype),arguments)}function A(){var C=this;x(C.path,C.flags,C.mode,function(N,y){N?(C.autoClose&&C.destroy(),C.emit("error",N)):(C.fd=y,C.emit("open",y),C.read())})}function w(C,N){return this instanceof w?(h.apply(this,arguments),this):w.apply(Object.create(w.prototype),arguments)}function M(){var C=this;x(C.path,C.flags,C.mode,function(N,y){N?(C.destroy(),C.emit("error",N)):(C.fd=y,C.emit("open",y))})}function T(C,N){return new e.ReadStream(C,N)}function B(C,N){return new e.WriteStream(C,N)}var G=e.open;e.open=x;function x(C,N,y,F){return typeof y=="function"&&(F=y,y=null),k(C,N,y,F);function k(W,b,E,j,D){return G(W,b,E,function(H,Se){H&&(H.code==="EMFILE"||H.code==="ENFILE")?fn([k,[W,b,E,j],H,D||Date.now(),Date.now()]):typeof j=="function"&&j.apply(this,arguments)})}}return e}function fn(e){Pt("ENQUEUE",e[0].name,e[1]),se[ye].push(e),ii()}var ts;function jl(){for(var e=Date.now(),t=0;t<se[ye].length;++t)se[ye][t].length>2&&(se[ye][t][3]=e,se[ye][t][4]=e);ii()}function ii(){if(clearTimeout(ts),ts=void 0,se[ye].length!==0){var e=se[ye].shift(),t=e[0],n=e[1],r=e[2],s=e[3],o=e[4];if(s===void 0)Pt("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-s>=6e4){Pt("TIMEOUT",t.name,n);var i=n.pop();typeof i=="function"&&i.call(null,r)}else{var u=Date.now()-o,a=Math.max(o-s,1),l=Math.min(a*1.2,100);u>=l?(Pt("RETRY",t.name,n),t.apply(null,n.concat([s]))):se[ye].push(e)}ts===void 0&&(ts=setTimeout(ii,0))}}});var Ul=R(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});ai.default=H1;function ql(){let e=q1(Jn());return ql=function(){return e},e}function Hl(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Hl=function(r){return r?n:t})(e)}function q1(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Hl(t);if(n&&n.ha Line truncated
${r.message}`,r}let n=e;for(;n=Object.getPrototypeOf(n);)typeof n.constructor=="function"&&n.constructor.call(t);return t.env=K1(),t.send=()=>!0,Object.defineProperty(t,"domain",{get(){return e.domain}}),t}});var Ql=R(gi=>{"use strict";Object.defineProperty(gi,"__esModule",{value:!0});gi.default=ey;function Lt(){let e=J1(Jn());return Lt=function(){return e},e}var Q1=Kl(zl()),X1=Kl(ss());function Kl(e){return e&&e.__esModule?e:{default:e}}function Yl(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Yl=function(r){return r?n:t})(e)}function J1(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Yl(t);if(n&&n.has(e))return n.get(e);var r={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)){var i=s?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}var Z1=Object.keys(globalThis).filter(e=>e.startsWith("DTRACE"));function ey(e,t){e.process=(0,Q1.default)();let n=e.Symbol;return Object.defineProperties(e,{[n.for("jest-native-promise")]:{enumerable:!1,value:Promise,writable:!1},[n.for("jest-native-now")]:{enumerable:!1,value:e.Date.now.bind(e.Date),writable:!1},[n.for("jest-native-read-file")]:{enumerable:!1,value:Lt().readFileSync.bind(Lt()),writable:!1},[n.for("jest-native-write-file")]:{enumerable:!1,value:Lt().writeFileSync.bind(Lt()),writable:!1},[n.for("jest-native-exists-file")]:{enumerable:!1,value:Lt().existsSync.bind(Lt()),writable:!1},"jest-symbol-do-not-touch":{enumerable:!1,value:n,writable:!1}}),Z1.forEach(r=>{e[r]=function(...s){return globalThis[r].apply(this,s)}}),Object.assign(e,(0,X1.default)(t))}});var di=R(mi=>{"use strict";Object.defineProperty(mi,"__esModule",{value:!0});mi.default=ty;function ty(e){return e&&e.__esModule?e:{default:e}}});var Xl=R(yi=>{"use strict";Object.defineProperty(yi,"__esModule",{value:!0});yi.default=ny;function ny(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}});var Jl=R(bi=>{"use strict";Object.defineProperty(bi,"__esModule",{value:!0});bi.default=ry;function ry(e,t,n){e[t]=n}});var Zl=R(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});Ei.default=sy;function sy(e){switch(typeof e){case"function":if(e.name)return e.name;break;case"number":case"undefined":return`${e}`;case"string":return e}throw new Error(`Invalid first argument, ${e}. It must be a named class, named function, number, or string.`)}});var _i=R(vi=>{"use strict";Object.defineProperty(vi,"__esModule",{value:!0});vi.default=oy;function oy(e){return e.replace(/\\(?![{}()+?.^$])/g,"/")}});var ef=R(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.default=iy;function iy(e){return new RegExp(e,"i")}});var Zn=R((v_,of)=>{"use strict";var uy=require("path"),Ke="\\\\/",tf=`[^${Ke}]`,tt="\\.",ay="\\+",cy="\\?",os="\\/",ly="(?=.)",nf="[^/]",Oi=`(?:${os}|$)`,rf=`(?:^|${os})`,Ci=`${tt}{1,2}${Oi}`,fy=`(?!${tt})`,py=`(?!${rf}${Ci})`,hy=`(?!${tt}{0,1}${Oi})`,gy=`(?!${Ci})`,my=`[^.${os}]`,dy=`${nf}*?`,sf={DOT_LITERAL:tt,PLUS_LITERAL:ay,QMARK_LITERAL:cy,SLASH_LITERAL:os,ONE_CHAR:ly,QMARK:nf,END_ANCHOR:Oi,DOTS_SLASH:Ci,NO_DOT:fy,NO_DOTS:py,NO_DOT_SLASH:hy,NO_DOTS_SLASH:gy,QMARK_NO_DOT:my,STAR:dy,START_ANCHOR:rf},yy={...sf,SLASH_LITERAL:`[${Ke}]`,QMARK:tf,STAR:`${tf}*?`,DOTS_SLASH:`${tt}{1,2}(?:[${Ke}]|$)`,NO_DOT:`(?!${tt})`,NO_DOTS:`(?!(?:^|[${Ke}])${tt}{1,2}(?:[${Ke}]|$))`,NO_DOT_SLASH:`(?!${tt}{0,1}(?:[${Ke}]|$))`,NO_DOTS_SLASH:`(?!${tt}{1,2}(?:[${Ke}]|$))`,QMARK_NO_DOT:`[^.${Ke}]`,START_ANCHOR:`(?:^|[${Ke}])`,END_ANCHOR:`(?:[${Ke}]|$)`},by={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};of.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:by,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHARLine truncated
`],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function Dp(e){return e[0]==="u"&&e.length===5||e[0]==="x"&&e.length===3?String.fromCharCode(parseInt(e.slice(1),16)):oE.get(e)||e}function iE(e,t){let n=[],r=t.trim().split(/\s*,\s*/g),s;for(let o of r)if(!isNaN(o))n.push(Number(o));else if(s=o.match(rE))n.push(s[2].replace(sE,(i,u,a)=>u?Dp(u):a));else throw new Error(`Invalid Chalk template style argument: ${o} (in style '${e}')`);return n}function uE(e){Lp.lastIndex=0;let t=[],n;for(;(n=Lp.exec(e))!==null;){let r=n[1];if(n[2]){let s=iE(r,n[2]);t.push([r].concat(s))}else t.push([r])}return t}function kp(e,t){let n={};for(let s of t)for(let o of s.styles)n[o[0]]=s.inverse?null:o.slice(1);let r=e;for(let s of Object.keys(n))if(Array.isArray(n[s])){if(!(s in r))throw new Error(`Unknown Chalk style: ${s}`);n[s].length>0?r=r[s].apply(r,n[s]):r=r[s]}return r}Fp.exports=(e,t)=>{let n=[],r=[],s=[];if(t.replace(nE,(o,i,u,a,l,c)=>{if(i)s.push(Dp(i));else if(a){let f=s.join("");s=[],r.push(n.length===0?f:kp(e,n)(f)),n.push({inverse:u,styles:uE(a)})}else if(l){if(n.length===0)throw new Error("Found extraneous } in Chalk template literal");r.push(kp(e,n)(s.join(""))),s=[],n.pop()}else s.push(c)}),r.push(s.join("")),n.length>0){let o=`Chalk template literal is missing ${n.length} closing bracket${n.length===1?"":"s"} (\`}\`)`;throw new Error(o)}return r.join("")}});var Gp=R((sR,pr)=>{"use strict";var lu=bp(),ce=xp(),cu=Pp().stdout,aE=jp(),qp=process.platform==="win32"&&!(process.env.TERM||"").toLowerCase().startsWith("xterm"),Hp=["ansi","ansi","ansi256","ansi16m"],Up=new Set(["gray"]),Sn=Object.create(null);function Bp(e,t){t=t||{};let n=cu?cu.level:0;e.level=t.level===void 0?n:t.level,e.enabled="enabled"in t?t.enabled:e.level>0}function fr(e){if(!this||!(this instanceof fr)||this.template){let t={};return Bp(t,e),t.template=function(){let n=[].slice.call(arguments);return fE.apply(null,[t.template].concat(n))},Object.setPrototypeOf(t,fr.prototype),Object.setPrototypeOf(t.template,t),t.template.constructor=fr,t.template}Bp(this,e)}qp&&(ce.blue.open="\x1B[94m");for(let e of Object.keys(ce))ce[e].closeRe=new RegExp(lu(ce[e].close),"g"),Sn[e]={get(){let t=ce[e];return Gs.call(this,this._styles?this._styles.concat(t):[t],this._empty,e)}};Sn.visible={get(){return Gs.call(this,this._styles||[],!0,"visible")}};ce.color.closeRe=new RegExp(lu(ce.color.close),"g");for(let e of Object.keys(ce.color.ansi))Up.has(e)||(Sn[e]={get(){let t=this.level;return function(){let r={open:ce.color[Hp[t]][e].apply(null,arguments),close:ce.color.close,closeRe:ce.color.closeRe};return Gs.call(this,this._styles?this._styles.concat(r):[r],this._empty,e)}}});ce.bgColor.closeRe=new RegExp(lu(ce.bgColor.close),"g");for(let e of Object.keys(ce.bgColor.ansi)){if(Up.has(e))continue;let t="bg"+e[0].toUpperCase()+e.slice(1);Sn[t]={get(){let n=this.level;return function(){let s={open:ce.bgColor[Hp[n]][e].apply(null,arguments),close:ce.bgColor.close,closeRe:ce.bgColor.closeRe};return Gs.call(this,this._styles?this._styles.concat(s):[s],this._empty,e)}}}}var cE=Object.defineProperties(()=>{},Sn);function Gs(e,t,n){let r=function(){return lE.apply(r,arguments)};r._styles=e,r._empty=t;let s=this;return Object.defineProperty(r,"level",{enumerable:!0,get(){return s.level},set(o){s.level=o}}),Object.defineProperty(r,"enabled",{enumerable:!0,get(){return s.enabled},set(o){s.enabled=o}}),r.hasGrey=this.hasGrey||n==="gray"||n==="grey",r.__proto__=cE,r}function lE(){let e=arguments,t=e.length,n=String(arguments[0]);if(t===0)return"";if(t>1)for(let s=1;s<t;s++)n+=" "+e[s];if(!this.enabled||this.level<=0||!n)return this._empty?"":n;let r=ce.dim.open;qp&&this.hasGrey&&(ce.dim.open="");for(let s of this._styles.slice().reverse())n=s.open+n.replace(s.closeRe,s.open)+s.close,n=n.replace(/\r?\n/g,`${s.close}$&${s.open}`);return ce.dim.open=r,n}function fE(e,t){if(!Array.isArray(t))return[].slice.call(arguments,1).join(" ");let n=[].slice.call(arguments,2),r=[t.raw[0]];for(let s=1;s<t.length;s++)r.push(String(n[s-1]).replace(/[{}\\]/g,"\\$&")),r.push(String(t.raw[s]));return aE(e,r.join(""))}Object.defineProperties(fr.prototype,Sn);pr.exports=fr();pr.exports.supportsColor=cu;pr.exports.default=pr.exports});var Jp=R(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.default=EE;hr.shouldHighlight=Xp;var Wp=sp(),Vp=gp(),pu=pE(ou(),!0);function Kp(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(Kp=function(r){return r?n:t})(e)}function pE(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=Kp(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!=="default"&&{}.hasOwnProperty.call(e,o)){var i=s?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}vLine truncated
`):n+=s}return n}function Xp(e){return Yp.isColorSupported||e.forceColor}var fu;function bE(e){if(e){var t;return(t=fu)!=null||(fu=(0,pu.createColors)(!0)),fu}return Yp}function EE(e,t={}){if(e!==""&&Xp(t)){let n=gE(bE(t.forceColor));return yE(n,e)}else return e}{let e,t;hr.getChalk=({forceColor:n})=>{var r;if((r=e)!=null||(e=Gp()),n){var s;return(s=t)!=null||(t=new e.constructor({enabled:!0,level:1})),t}return e}}});var o0=R(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});Ws.codeFrameColumns=s0;Ws.default=SE;var Zp=Jp(),gu=vE(ou(),!0);function r0(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(r0=function(r){return r?n:t})(e)}function vE(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=r0(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!=="default"&&{}.hasOwnProperty.call(e,o)){var i=s?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}var _E=typeof process=="object"&&(process.env.FORCE_COLOR==="0"||process.env.FORCE_COLOR==="false")?(0,gu.createColors)(!1):gu.default,e0=(e,t)=>n=>e(t(n)),hu;function RE(e){if(e){var t;return(t=hu)!=null||(hu=(0,gu.createColors)(!0)),hu}return _E}var t0=!1;function OE(e){return{gutter:e.gray,marker:e0(e.red,e.bold),message:e0(e.red,e.bold)}}var n0=/\r\n|[\n\r\u2028\u2029]/;function CE(e,t,n){let r=Object.assign({column:0,line:-1},e.start),s=Object.assign({},r,e.end),{linesAbove:o=2,linesBelow:i=3}=n||{},u=r.line,a=r.column,l=s.line,c=s.column,f=Math.max(u-(o+1),0),p=Math.min(t.length,l+i);u===-1&&(f=0),l===-1&&(p=t.length);let m=l-u,h={};if(m)for(let d=0;d<=m;d++){let v=d+u;if(!a)h[v]=!0;else if(d===0){let O=t[v-1].length;h[v]=[a,O-a+1]}else if(d===m)h[v]=[0,c];else{let O=t[v-d].length;h[v]=[0,O]}}else a===c?a?h[u]=[a,0]:h[u]=!0:h[u]=[a,c-a];return{start:f,end:p,markerLines:h}}function s0(e,t,n={}){let r=(n.highlightCode||n.forceColor)&&(0,Zp.shouldHighlight)(n),s=RE(n.forceColor),o=OE(s),i=(d,v)=>r?d(v):v,u=e.split(n0),{start:a,end:l,markerLines:c}=CE(t,u,n),f=t.start&&typeof t.start.column=="number",p=String(l).length,h=(r?(0,Zp.default)(e,n):e).split(n0,l).slice(a,l).map((d,v)=>{let O=a+1+v,w=` ${` ${O}`.slice(-p)} |`,M=c[O],T=!c[O+1];if(M){let B="";if(Array.isArray(M)){let G=d.slice(0,Math.max(M[0]-1,0)).replace(/[^\t]/g," "),x=M[1]||1;B=[`
`,i(o.gutter,w.replace(/\d/g," "))," ",G,i(o.marker,"^").repeat(x)].join(""),T&&n.message&&(B+=" "+i(o.message,n.message))}return[i(o.marker,">"),i(o.gutter,w),d.length>0?` ${d}`:"",B].join("")}else return` ${i(o.gutter,w)}${d.length>0?` ${d}`:""}`}).join(`
`);return n.message&&!f&&(h=`${" ".repeat(p+1)}${n.message}
${h}`),r?s.reset(h):h}function SE(e,t,n,r={}){if(!t0){t0=!0;let o="Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";if(process.emitWarning)process.emitWarning(o,"DeprecationWarning");else{let i=new Error(o);i.name="DeprecationWarning",console.warn(new Error(o))}}return n=Math.max(n,0),s0(e,{start:{column:n,line:t}},r)}});var Vs=R(Fe=>{"use strict";Fe.isInteger=e=>typeof e=="number"?Number.isInteger(e):typeof e=="string"&&e.trim()!==""?Number.isInteger(Number(e)):!1;Fe.find=(e,t)=>e.nodes.find(n=>n.type===t);Fe.exceedsLimit=(e,t,n=1,r)=>r===!1||!Fe.isInteger(e)||!Fe.isInteger(t)?!1:(Number(t)-Number(e))/Number(n)>=r;Fe.escapeNode=(e,t=0,n)=>{let r=e.nodes[t];r&&(n&&r.type===n||r.type==="open"||r.type==="close")&&r.escaped!==!0&&(r.value="\\"+r.value,r.escaped=!0)};Fe.encloseBrace=e=>e.type!=="brace"?!1:e.commas>>0+e.ranges>>0===0?(e.invalid=!0,!0):!1;Fe.isInvalidBrace=e=>e.type!=="brace"?!1:e.invalid===!0||e.dollar?!0:e.commas>>0+e.ranges>>0===0||e.open!==!0||e.close!==!0?(e.invalid=!0,!0):!1;Fe.isOpenOrClose=e=>e.type==="open"||e.type==="close"?!0:e.open===!0||e.close===!0;Fe.reduce=e=>e.reduce((t,n)=>(n.type==="text"&&t.push(n.value),n.type==="range"&&(n.type="text"),t),[]);Fe.flatten=(...e)=>{let t=[],n=r=>{for(let s=0;s<r.length;s++){let o=r[s];if(Array.isArray(o)){n(o);continue}o!==void 0&&t.push(o)}return t};return n(e),t}});var zs=R((aR,u0)=>{"use strict";var i0=Vs();u0.exports=(e,t={})=>{let n=(r,s={})=>{let o=t.escapeInvalid&&i0.isInvalidBrace(s),i=r.invalid===!0&&t.escapeInvalid===!0,u="";if(r.value)return(o||i)&&i0.isOpenOrClose(r)?"\\"+r.value:r.value;if(r.value)return r.value;if(r.nodes)for(let a of r.nodes)u+=n(a);return u};return n(e)}});var c0=R((cR,a0)=>{"use strict";a0.exports=function(e){return typeof e=="number"?e-e===0:typeof e=="string"&&e.trim()!==""?Number.isFinite?Number.isFinite(+e):isFinite(+e):!1}});var b0=R((lR,y0)=>{"use strict";var l0=c0(),Ft=(e,t,n)=>{if(l0(e)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(t===void 0||e===t)return String(e);if(l0(t)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let r={relaxZeros:!0,...n};typeof r.strictZeros=="boolean"&&(r.relaxZeros=r.strictZeros===!1);let s=String(r.relaxZeros),o=String(r.shorthand),i=String(r.capture),u=String(r.wrap),a=e+":"+t+"="+s+o+i+u;if(Ft.cache.hasOwnProperty(a))return Ft.cache[a].result;let l=Math.min(e,t),c=Math.max(e,t);if(Math.abs(l-c)===1){let d=e+"|"+t;return r.capture?`(${d})`:r.wrap===!1?d:`(?:${d})`}let f=d0(e)||d0(t),p={min:e,max:t,a:l,b:c},m=[],h=[];if(f&&(p.isPadded=f,p.maxLen=String(p.max).length),l<0){let d=c<0?Math.abs(c):1;h=f0(d,Math.abs(l),p,r),l=p.a=0}return c>=0&&(m=f0(l,c,p,r)),p.negatives=h,p.positives=m,p.result=wE(h,m,r),r.capture===!0?p.result=`(${p.result})`:r.wrap!==!1&&m.length+h.length>1&&(p.result=`(?:${p.result})`),Ft.cache[a]=p,p.result};function wE(e,t,n){let r=mu(e,t,"-",!1,n)||[],s=mu(t,e,"",!1,n)||[],o=mu(e,t,"-?",!0,n)||[];return r.concat(o).concat(s).join("|")}function AE(e,t){let n=1,r=1,s=h0(e,n),o=new Set([t]);for(;e<=s&&s<=t;)o.add(s),n+=1,s=h0(e,n);for(s=g0(t+1,r)-1;e<s&&s<=t;)o.add(s),r+=1,s=g0(t+1,r)-1;return o=[...o],o.sort(xE),o}function ME(e,t,n){if(e===t)return{pattern:e,count:[],digits:0};let r=TE(e,t),s=r.length,o="",i=0;for(let u=0;u<s;u++){let[a,l]=r[u];a===l?o+=a:a!=="0"||l!=="9"?o+=$E(a,l,n):i++}return i&&(o+=n.shorthand===!0?"\\d":"[0-9]"),{pattern:o,count:[i],digits:s}}function f0(e,t,n,r){let s=AE(e,t),o=[],i=e,u;for(let a=0;a<s.length;a++){let l=s[a],c=ME(String(i),String(l),r),f="";if(!n.isPadded&&u&&u.pattern===c.pattern){u.count.length>1&&u.count.pop(),u.count.push(c.count[0]),u.string=u.pattern+m0(u.count),i=l+1;continue}n.isPadded&&(f=IE(l,n,r)),c.string=f+c.pattern+m0(c.count),o.push(c),i=l+1,u=c}return o}function mu(e,t,n,r,s){let o=[];for(let i of e){let{string:u}=i;!r&&!p0(t,"string",u)&&o.push(n+u),r&&p0(t,"string",u)&&o.push(n+u)}return o}function TE(e,t){let n=[];for(let r=0;r<e.length;r++)n.push([e[r],t[r]]);return n}function xE(e,t){return e>t?1:t>e?-1:0}function p0(e,t,n){return e.some(r=>r[t]===n)}function h0(e,t){return Number(String(e).slice(0,-t)+"9".repeat(t))}function g0(e,t){return e-e%Math.pow(10,t)}function m0(e){let[t=0,n=""]=e;return n||t>1?`{${t+(n?","+n:"")}}`:""}function $E(e,t,n){return`[${e}${t-e===1?"":"-"}${t}]`}function d0(e){return/^-?(0+)\d/.test(e)}function IE(e,t,n){if(!t.isPadded)return e;let r=Math.abs(t.maxLen-String(e).length),s=n.relaxZeros!==!1;switch(r){case 0:return"";case 1:return s?"0?":"0";case 2:return s?"0{0,2}":"00";default:return s?`0{0,${r}}`:`0{${r}}`}}Ft.cache={};Ft.clearCache=()=>Ft.cache={};y0.exports=Ft});var bu=R((fR,S0)=>{"use strict";var NE=require("util"),v0=b0(),E0=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),PE=e=>t=>e===!0?Number(t):String(t),du=e=>typeof e=="number"||typeof e=="string"&&e!=="",gr=e=>Number.isInteger(+e),yu=e=>{let t=`${e}`,n=-1;if(t[0]=== Line truncated
`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var F0=R((mR,D0)=>{"use strict";var WE=zs(),{MAX_LENGTH:P0,CHAR_BACKSLASH:Eu,CHAR_BACKTICK:VE,CHAR_COMMA:zE,CHAR_DOT:KE,CHAR_LEFT_PARENTHESES:YE,CHAR_RIGHT_PARENTHESES:QE,CHAR_LEFT_CURLY_BRACE:XE,CHAR_RIGHT_CURLY_BRACE:JE,CHAR_LEFT_SQUARE_BRACKET:L0,CHAR_RIGHT_SQUARE_BRACKET:k0,CHAR_DOUBLE_QUOTE:ZE,CHAR_SINGLE_QUOTE:e2,CHAR_NO_BREAK_SPACE:t2,CHAR_ZERO_WIDTH_NOBREAK_SPACE:n2}=N0(),r2=(e,t={})=>{if(typeof e!="string")throw new TypeError("Expected a string");let n=t||{},r=typeof n.maxLength=="number"?Math.min(P0,n.maxLength):P0;if(e.length>r)throw new SyntaxError(`Input length (${e.length}), exceeds max characters (${r})`);let s={type:"root",input:e,nodes:[]},o=[s],i=s,u=s,a=0,l=e.length,c=0,f=0,p,m=()=>e[c++],h=d=>{if(d.type==="text"&&u.type==="dot"&&(u.type="text"),u&&u.type==="text"&&d.type==="text"){u.value+=d.value;return}return i.nodes.push(d),d.parent=i,d.prev=u,u=d,d};for(h({type:"bos"});c<l;)if(i=o[o.length-1],p=m(),!(p===n2||p===t2)){if(p===Eu){h({type:"text",value:(t.keepEscaping?p:"")+m()});continue}if(p===k0){h({type:"text",value:"\\"+p});continue}if(p===L0){a++;let d;for(;c<l&&(d=m());){if(p+=d,d===L0){a++;continue}if(d===Eu){p+=m();continue}if(d===k0&&(a--,a===0))break}h({type:"text",value:p});continue}if(p===YE){i=h({type:"paren",nodes:[]}),o.push(i),h({type:"text",value:p});continue}if(p===QE){if(i.type!=="paren"){h({type:"text",value:p});continue}i=o.pop(),h({type:"text",value:p}),i=o[o.length-1];continue}if(p===ZE||p===e2||p===VE){let d=p,v;for(t.keepQuotes!==!0&&(p="");c<l&&(v=m());){if(v===Eu){p+=v+m();continue}if(v===d){t.keepQuotes===!0&&(p+=v);break}p+=v}h({type:"text",value:p});continue}if(p===XE){f++;let v={type:"brace",open:!0,close:!1,dollar:u.value&&u.value.slice(-1)==="$"||i.dollar===!0,depth:f,commas:0,ranges:0,nodes:[]};i=h(v),o.push(i),h({type:"open",value:p});continue}if(p===JE){if(i.type!=="brace"){h({type:"text",value:p});continue}let d="close";i=o.pop(),i.close=!0,h({type:d,value:p}),f--,i=o[o.length-1];continue}if(p===zE&&f>0){if(i.ranges>0){i.ranges=0;let d=i.nodes.shift();i.nodes=[d,{type:"text",value:WE(i)}]}h({type:"comma",value:p}),i.commas++;continue}if(p===KE&&f>0&&i.commas===0){let d=i.nodes;if(f===0||d.length===0){h({type:"text",value:p});continue}if(u.type==="dot"){if(i.range=[],u.value+=p,u.type="range",i.nodes.length!==3&&i.nodes.length!==5){i.invalid=!0,i.ranges=0,u.type="text";continue}i.ranges++,i.args=[];continue}if(u.type==="range"){d.pop();let v=d[d.length-1];v.value+=u.value+p,u=v,i.ranges--;continue}h({type:"dot",value:p});continue}h({type:"text",value:p})}do if(i=o.pop(),i.type!=="root"){i.nodes.forEach(O=>{O.nodes||(O.type==="open"&&(O.isOpen=!0),O.type==="close"&&(O.isClose=!0),O.nodes||(O.type="text"),O.invalid=!0)});let d=o[o.length-1],v=d.nodes.indexOf(i);d.nodes.splice(v,1,...i.nodes)}while(o.length>0);return h({type:"eos"}),s};D0.exports=r2});var q0=R((dR,B0)=>{"use strict";var j0=zs(),s2=M0(),o2=$0(),i2=F0(),xe=(e,t={})=>{let n=[];if(Array.isArray(e))for(let r of e){let s=xe.create(r,t);Array.isArray(s)?n.push(...s):n.push(s)}else n=[].concat(xe.create(e,t));return t&&t.expand===!0&&t.nodupes===!0&&(n=[...new Set(n)]),n};xe.parse=(e,t={})=>i2(e,t);xe.stringify=(e,t={})=>j0(typeof e=="string"?xe.parse(e,t):e,t);xe.compile=(e,t={})=>(typeof e=="string"&&(e=xe.parse(e,t)),s2(e,t));xe.expand=(e,t={})=>{typeof e=="string"&&(e=xe.parse(e,t));let n=o2(e,t);return t.noempty===!0&&(n=n.filter(Boolean)),t.nodupes===!0&&(n=[...new Set(n)]),n};xe.create=(e,t={})=>e===""||e.length<3?[e]:t.expand!==!0?xe.compile(e,t):xe.expand(e,t);B0.exports=xe});var z0=R((yR,V0)=>{"use strict";var U0=require("util"),G0=q0(),Xe=Ni(),vu=er(),H0=e=>e===""||e==="./",W0=e=>{let t=e.indexOf("{");return t>-1&&e.indexOf("}",t)>-1},te=(e,t,n)=>{t=[].concat(t),e=[].concat(e);let r=new Set,s=new Set,o=new Set,i=0,u=c=>{o.add(c.output),n&&n.onResult&&n.onResult(c)};for(let c=0;c<t.length;c++){let f=Xe(String(t[c]),{...n,onResult:u},!0),p=f.state.negated||f.state.negatedExtglob;p&&i++;for(let m of e){let h=f(m,!0);(p?!h.isMatch:h.isMatch)&&(p?r.add(h.output):(r.delete(h.output),s.add(h.output)))}}let l=(i===t.length?[...o]:[...s]).filter(c=>!r.has(c));if(n&&l.length===0){if(n.failglob===!0)throw new Error(`No matches found for "${t.join(", ")}"`);if(n.nonull===!0||n.nullglob===!0)return n.unescape?t.map(c=>c.replace(/\\/g,"")):t}return l};te.match=te;te.matcher=(e,t)=>Xe(e,t);te.isMatch=(e,t,n)=>Xe(t,n)(e);te.any=te.isMatch;te.not=(e,t,n={})=>{t=[].concat(t).map(String);let r=new Set,s=[],o=u=>{n.onResult&&n.onResult(u),s.push(u.output)},i=new Set(te(e,t,{...n,onResult:o}));for(let u of s)i.has(u)||r.add(u);return[...r]};te.contains=(e,t,n)=>{if(typeof e!="string")thr Line truncated
`)),!/^\s*at /.test(t[0])&&/^\s*at /.test(t[1])&&(t=t.slice(1));let r=!1,s=null,o=[];return t.forEach(i=>{if(i=i.replace(/\\/g,"/"),this._internals.some(a=>a.test(i)))return;let u=/^\s*at /.test(i);r?i=i.trimEnd().replace(/^(\s+)at /,"$1"):(i=i.trim(),u&&(i=i.slice(3))),i=i.replace(`${this._cwd}/`,""),i&&(u?(s&&(o.push(s),s=null),o.push(i)):(r=!0,s=i))}),o.map(i=>`${n}${i}
`).join("")}captureString(t,n=this.captureString){typeof t=="function"&&(n=t,t=1/0);let{stackTraceLimit:r}=Error;t&&(Error.stackTraceLimit=t);let s={};Error.captureStackTrace(s,n);let{stack:o}=s;return Error.stackTraceLimit=r,this.clean(o)}capture(t,n=this.capture){typeof t=="function"&&(n=t,t=1/0);let{prepareStackTrace:r,stackTraceLimit:s}=Error;Error.prepareStackTrace=(u,a)=>this._wrapCallSite?a.map(this._wrapCallSite):a,t&&(Error.stackTraceLimit=t);let o={};Error.captureStackTrace(o,n);let{stack:i}=o;return Object.assign(Error,{prepareStackTrace:r,stackTraceLimit:s}),i}at(t=this.at){let[n]=this.capture(1,t);if(!n)return{};let r={line:n.getLineNumber(),column:n.getColumnNumber()};J0(r,n.getFileName(),this._cwd),n.isConstructor()&&Object.defineProperty(r,"constructor",{value:!0,configurable:!0}),n.isEval()&&(r.evalOrigin=n.getEvalOrigin()),n.isNative()&&(r.native=!0);let s;try{s=n.getTypeName()}catch{}s&&s!=="Object"&&s!=="[object Object]"&&(r.type=s);let o=n.getFunctionName();o&&(r.function=o);let i=n.getMethodName();return i&&o!==i&&(r.method=i),r}parseLine(t){let n=t&&t.match(f2);if(!n)return null;let r=n[1]==="new",s=n[2],o=n[3],i=n[4],u=Number(n[5]),a=Number(n[6]),l=n[7],c=n[8],f=n[9],p=n[10]==="native",m=n[11]===")",h,d={};if(c&&(d.line=Number(c)),f&&(d.column=Number(f)),m&&l){let v=0;for(let O=l.length-1;O>0;O--)if(l.charAt(O)===")")v++;else if(l.charAt(O)==="("&&l.charAt(O-1)===" "&&(v--,v===-1&&l.charAt(O-1)===" ")){let A=l.slice(0,O-1);l=l.slice(O+1),s+=` (${A}`;break}}if(s){let v=s.match(p2);v&&(s=v[1],h=v[2])}return J0(d,l,this._cwd),r&&Object.defineProperty(d,"constructor",{value:!0,configurable:!0}),o&&(d.evalOrigin=o,d.evalLine=u,d.evalColumn=a,d.evalFile=i&&i.replace(/\\/g,"/")),p&&(d.native=!0),s&&(d.function=s),h&&s!==h&&(d.method=h),d}};function J0(e,t,n){t&&(t=t.replace(/\\/g,"/"),t.startsWith(`${n}/`)&&(t=t.slice(n.length+1)),e.file=t)}function l2(e){if(e.length===0)return[];let t=e.map(n=>a2(n));return new RegExp(`[/\\\\]node_modules[/\\\\](?:${t.join("|")})[/\\\\][^:]+:\\d+:\\d+`)}var f2=new RegExp("^(?:\\s*at )?(?:(new) )?(?:(.*?) \\()?(?:eval at ([^ ]+) \\((.+?):(\\d+):(\\d+)\\), )?(?:(.+?):(\\d+):(\\d+)|(native))(\\)?)$"),p2=/^(.*?) \[as (.*?)\]$/;eh.exports=_u});var Rh=R(de=>{"use strict";Object.defineProperty(de,"__esModule",{value:!0});de.separateMessageFromStack=de.indentAllLines=de.getTopFrame=de.getStackTraceLines=de.formatStackTrace=de.formatResultsErrors=de.formatPath=de.formatExecError=void 0;var Rt=ch(require("path")),h2=require("url"),Qs=require("util"),g2=o0(),Mn=Xs(zt()),m2=ch(Jn()),d2=Xs(z0()),Cu=Xs(Y0()),uh=Xs(th()),nh=jn();function Xs(e){return e&&e.__esModule?e:{default:e}}function ah(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(ah=function(r){return r?n:t})(e)}function ch(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=ah(t);if(n&&n.has(e))return n.get(e);var r={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)){var i=s?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}var lh=globalThis["jest-symbol-do-not-touch"]||globalThis.Symbol,lh=globalThis["jest-symbol-do-not-touch"]||globalThis.Symbol,y2=globalThis[lh.for("jest-native-read-file")]||m2.readFileSync,b2=new uh.default({cwd:"something which does not exist"}),fh=[];try{fh=uh.default.nodeInternals()}catch{}var E2=`${Rt.sep}node_modules${Rt.sep}`,v2=`${Rt.sep}jest${Rt.sep}packages${Rt.sep}`,_2=/^\s+at(?:(?:.jasmine-)|\s+jasmine\.buildExpectationResult)/,R2=/^\s+at.*?jest(-.*?)?(\/|\\)(build|node_modules|packages)(\/|\\)/,O2=/^\s+at <anonymous>.*$/,C2=/^\s+at (new )?Promise \(<anonymous>\).*$/,S2=/^\s+at Generator.next \(<anonymous>\).*$/,w2=/^\s+at next \(native\).*$/,ph=" ",hh=" ",A2=" ",rh=" \u203A ",gh=Mn.default.bold("\u25CF "),Ru=Mn.default.dim,mh=/\s*at.*\(?(:\d*:\d*|native)\)?/,M2="Test suite failed to run",T2=/^(?!$)/gm,An=e=>e.replace(T2,hh);de.indentAllLines=An;var dh=e=>(e||"").trim(),x2=e=>e.match(mh)?dh(e):e,$2=(e,t,n)=>{let r=(0,g2.codeFrameColumns)(e,{start:{column:n,line:t}},{highlightCode:!0});return r=An(r),r=`
${r}
`,r},sh=/^\s*$/;function yh(e){return e.includes("ReferenceError: document is not defined")||e.includes("ReferenceError: window is not defined")||e.includes("ReferenceError: navigator is not defined")?oh(e,"jsdom"):e.includes(".unref is not a function")?oh(e,"node"):e}function oh(e,t){return Mn.default.bold.red(`The error below may be caused by using the wrong test environment, see ${Mn.default.dim.underline("https://jestjs.io/docs/configuration#testenvironment-string")}.
Consider using the "${t}" test environment.
`)+e}var Ou=(e,t,n,r,s,o)=>{(!e||typeof e=="number")&&(e=new Error(`Expected an Error, but "${String(e)}" was thrown`),e.stack="");let i,u,a="",l=[];if(typeof e=="string"||!e)e||(e="EMPTY ERROR"),i="",u=e;else{if(i=e.message,u=typeof e.stack=="string"?e.stack:`thrown: ${(0,nh.format)(e,{maxDepth:3})}`,"cause"in e){let h=`
Cause:
`;if(typeof e.cause=="string"||typeof e.cause=="number")a+=`${h}${e.cause}`;else if(Qs.types.isNativeError(e.cause)||e.cause instanceof Error){let d=Ou(e.cause,t,n,r,s,!0);a+=`${h}${d}`}}if("errors"in e&&Array.isArray(e.errors))for(let h of e.errors)l.push(Ou(h,t,n,r,s,!0))}a!==""&&(a=An(a));let c=wu(u||"");u=c.stack,c.message.includes(dh(i))&&(i=c.message),i=yh(i),i=An(i),u=u&&!n.noStackTrace?`
${Su(u,t,n,r)}`:"",(typeof u!="string"||sh.test(i)&&sh.test(u))&&(i=`thrown: ${(0,nh.format)(e,{maxDepth:3})}`);let f;s||o?f=` ${i.trim()}`:f=`${M2}
${i}`;let p=o?"":`${ph+gh}`,m=l.length>0?An(`
Errors contained in AggregateError:
${l.join(`
`)}`):"";return`${p+f+u+a+m}
`};de.formatExecError=Ou;var I2=(e,t)=>{let n=0;return e.filter(r=>O2.test(r)||C2.test(r)||S2.test(r)||w2.test(r)||fh.some(s=>s.test(r))?!1:mh.test(r)?_2.test(r)?!1:++n===1?!0:!(t.noStackTrace||R2.test(r)):!0)},bh=(e,t,n=null)=>{let r=e.match(/(^\s*at .*?\(?)([^()]+)(:[0-9]+:[0-9]+\)?.*$)/);if(!r)return e;let s=(0,Cu.default)(Rt.relative(t.rootDir,r[2]));return(t.testMatch&&t.testMatch.length&&(0,d2.default)([s],t.testMatch).length>0||s===n)&&(s=Mn.default.reset.cyan(s)),Ru(r[1])+s+Ru(r[3])};de.formatPath=bh;var Eh=(e,t={noCodeFrame:!1,noStackTrace:!1})=>I2(e.split(/\n/),t);de.getStackTraceLines=Eh;var vh=e=>{for(let t of e){if(t.includes(E2)||t.includes(v2))continue;let n=b2.parseLine(t.trim());if(n&&n.file)return n.file.startsWith("file://")&&(n.file=(0,Cu.default)((0,h2.fileURLToPath)(n.file))),n}return null};de.getTopFrame=vh;var Su=(e,t,n,r)=>{let s=Eh(e,n),o="",i=r?(0,Cu.default)(Rt.relative(t.rootDir,r)):null;if(!n.noStackTrace&&!n.noCodeFrame){let a=vh(s);if(a){let{column:l,file:c,line:f}=a;if(f&&c&&Rt.isAbsolute(c)){let p;try{p=y2(c,"utf8"),o=$2(p,f,l)}catch{}}}}let u=s.filter(Boolean).map(a=>A2+bh(x2(a),t,i)).join(`
`);return o?`${o}
${u}`:`
${u}`};de.formatStackTrace=Su;function N2(e){return typeof e!="string"&&"cause"in e&&(typeof e.cause=="string"||Qs.types.isNativeError(e.cause)||e.cause instanceof Error)}function _h(e,t,n,r){let s=typeof e=="string"?e:e.stack||"",{message:o,stack:i}=wu(s);i=n.noStackTrace?"":`${Ru(Su(i,t,n,r))}
`,o=yh(o),o=An(o);let u="";if(N2(e)){let a=_h(e.cause,t,n,r);u=`
${hh}Cause:
${a}`}return`${o}
${i}${u}`}function P2(e,t){return e?Qs.types.isNativeError(e)||e instanceof Error?e:typeof e=="object"&&"error"in e&&(Qs.types.isNativeError(e.error)||e.error instanceof Error)?e.error:t:t}var L2=(e,t,n,r)=>{let s=e.reduce((o,i)=>(i.failureMessages.forEach((u,a)=>{o.push({content:u,failureDetails:i.failureDetails[a],result:i})}),o),[]);return s.length?s.map(({result:o,content:i,failureDetails:u})=>{let a=P2(u,i);return`${`${Mn.default.bold.red(ph+gh+o.ancestorTitles.join(rh)+(o.ancestorTitles.length?rh:"")+o.title)}
`}
${_h(a,t,n,r)}`}).join(`
`):null};de.formatResultsErrors=L2;var k2=/^Error:?\s*$/,ih=e=>e.split(`
`).filter(t=>!k2.test(t)).join(`
`).trimRight(),wu=e=>{if(!e)return{message:"",stack:""};let t=e.match(/^(?:Error: )?([\s\S]*?(?=\n\s*at\s.*:\d*:\d*)|\s*.*)([\s\S]*)$/);if(!t)throw new Error("If you hit this error, the regex above is buggy.");let n=ih(t[1]),r=ih(t[2]);return{message:n,stack:r}};de.separateMessageFromStack=wu});var Lh=R(je=>{"use strict";Object.defineProperty(je,"__esModule",{value:!0});je.spyOn=je.replaceProperty=je.mocked=je.fn=je.ModuleMocker=void 0;function Nh(){let e=as();return Nh=function(){return e},e}var Au="mockConstructor",Ph=/[\s!-/:-@[-`{-~]/,K2=new RegExp(Ph.source,"g"),Y2=new Set(["arguments","await","break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","eval","export","extends","false","finally","for","function","if","implements","import","in","instanceof","interface","let","new","null","package","private","protected","public","return","static","super","switch","this","throw","true","try","typeof","var","void","while","with","yield"]);function Q2(e,t){let n;switch(t){case 1:n=function(r){return e.apply(this,arguments)};break;case 2:n=function(r,s){return e.apply(this,arguments)};break;case 3:n=function(r,s,o){return e.apply(this,arguments)};break;case 4:n=function(r,s,o,i){return e.apply(this,arguments)};break;case 5:n=function(r,s,o,i,u){return e.apply(this,arguments)};break;case 6:n=function(r,s,o,i,u,a){return e.apply(this,arguments)};break;case 7:n=function(r,s,o,i,u,a,l){return e.apply(this,arguments)};break;case 8:n=function(r,s,o,i,u,a,l,c){return e.apply(this,arguments)};break;case 9:n=function(r,s,o,i,u,a,l,c,f){return e.apply(this,arguments)};break;default:n=function(){return e.apply(this,arguments)};break}return n}function Mu(e){return Object.prototype.toString.apply(e).slice(8,-1)}function X2(e){let t=Mu(e);return t==="Function"||t==="AsyncFunction"||t==="GeneratorFunction"||t==="AsyncGeneratorFunction"?"function":Array.isArray(e)?"array":t==="Object"||t==="Module"?"object":t==="Number"||t==="String"||t==="Boolean"||t==="Symbol"?"constant":t==="Map"||t==="WeakMap"||t==="Set"?"collection":t==="RegExp"?"regexp":e===void 0?"undefined":e===null?"null":null}function J2(e,t){if(t==="arguments"||t==="caller"||t==="callee"||t==="name"||t==="length"){let n=Mu(e);return n==="Function"||n==="AsyncFunction"||n==="GeneratorFunction"||n==="AsyncGeneratorFunction"}return t==="source"||t==="global"||t==="ignoreCase"||t==="multiline"?Mu(e)==="RegExp":!1}var no=class{constructor(t){ae(this,"_environmentGlobal");ae(this,"_mockState");ae(this,"_mockConfigRegistry");ae(this,"_spyState");ae(this,"_invocationCallCounter");this._environmentGlobal=t,this._mockState=new WeakMap,this._mockConfigRegistry=new WeakMap,this._spyState=new Set,this._invocationCallCounter=1}_getSlots(t){if(!t)return[];let n=new Set,r=this._environmentGlobal.Object.prototype,s=this._environmentGlobal.Function.prototype,o=this._environmentGlobal.RegExp.prototype,i=Object.prototype,u=Function.prototype,a=RegExp.prototype;for(;t!=null&&t!==r&&t!==s&&t!==o&&t!==i&&t!==u&&t!==a;){let l=Object.getOwnPropertyNames(t);for(let c=0;c<l.length;c++){let f=l[c];if(!J2(t,f)){let p=Object.getOwnPropertyDescriptor(t,f);(p!==void 0&&!p.get||t.__esModule)&&n.add(f)}}t=Object.getPrototypeOf(t)}return Array.from(n)}_ensureMockConfig(t){let n=this._mockConfigRegistry.get(t);return n||(n=this._defaultMockConfig(),this._mockConfigRegistry.set(t,n)),n}_ensureMockState(t){let n=this._mockState.get(t);return n||(n=this._defaultMockState(),this._mockState.set(t,n)),n.calls.length>0&&(n.lastCall=n.calls[n.calls.length-1]),n}_defaultMockConfig(){return{mockImpl:void 0,mockName:"jest.fn()",specificMockImpls:[]}}_defaultMockState(){return{calls:[],contexts:[],instances:[],invocationCallOrder:[],results:[]}}_makeComponent(t,n){if(t.type==="object")return new this._environmentGlobal.Object;if(t.type==="array")return new this._environmentGlobal.Array;if(t.type==="regexp")return new this._environmentGlobal.RegExp("");if(t.type==="constant"||t.type==="collection"||t.type==="null"||t.type==="undefined")return t.value;if(t.type==="function"){let a=function(l,c){let f=this._ensureMockConfig(u),p=f.mockImpl,m=f.specificMockImpls;f.mockImpl=l,f.specificMockImpls=[];let h=c();if((0,Nh().isPromise)(h))return h.then(()=>{f.mockImpl=p,f.specificMockImpls=m});f.mockImpl=p,f.specificMockImpls=m},r=t.members&&t.members.prototype&&t.members.prototype.members||{},s=this._getSlots(r),o=this,i=Q2(function(...l){let c=o._ensureMockState(u),f=o._ensureMockConfig(u);c.instances.push(this),c.contexts.push(this),c.calls.push(l);let p={type:"incomplete",value:void 0};c.results.push(p),c.invocationCallOrder.push(o._invocationCallCounter++);let m,h,d=!1;try{m=(()=>{if(this instanceof u){s.forEach(A=>{if(r[A].type==="function"){let w=this[A];this[A]=o.generateFromMetadata(r[A]),this[A]._protoImpl=w}});let O=f.specificMockImpls.length?f.specificMockImpls.shift():f.mockImpl;return O&&O.apply(this,arguments)}let v=f.specificMockImpls.shift();if(v===void 0&&(v=f.mocLine truncated
Expected ${i} to be called but received ${(0,De.RECEIVED_COLOR)((0,De.pluralize)("assertion call",t||0))}.`,e.push({actual:t.toString(),error:r,expected:n.toString()})}if(s&&t===0){let i=(0,De.EXPECTED_COLOR)("at least one assertion"),u=(0,De.RECEIVED_COLOR)("received none");o.message=`${(0,De.matcherHint)(".hasAssertions","","",{isDirectExpectCall:!0})}
Expected ${i} to be called but ${u}.`,e.push({actual:"none",error:o,expected:"at least one"})}return e},Bf=Cb;var K=ie(ln()),Et=ie(ot()),g=ie(ze());var ge=ie(ze()),Wi=e=>e.replace(/"|\\/g,"\\$&"),mn=(e,t,n)=>(0,ge.RECEIVED_COLOR)(`"${Wi(e.slice(0,t))}${(0,ge.INVERTED_COLOR)(Wi(e.slice(t,t+n)))}${Wi(e.slice(t+n))}"`),As=(e,t)=>t===null?(0,ge.printReceived)(e):mn(e,t.index,t[0].length),Vi=(e,t)=>(0,ge.RECEIVED_COLOR)(`[${e.map((n,r)=>{let s=(0,ge.stringify)(n);return r===t?(0,ge.INVERTED_COLOR)(s):s}).join(", ")}]`),zi=(e,t,n,r)=>{let s=(0,ge.stringify)(e),o=s.includes("e")?t.toExponential(0):0<=n&&n<20?t.toFixed(n+1):(0,ge.stringify)(t);return`Expected precision: ${r?" ":""} ${(0,ge.stringify)(n)}
Expected difference: ${r?"not ":""}< ${(0,ge.EXPECTED_COLOR)(o)}
Received difference: ${r?" ":""} ${(0,ge.RECEIVED_COLOR)(s)}`},Ms=(e,t)=>`${rr(e,t,!1,!0)}
`,Ts=(e,t)=>`${rr(e,t,!0,!0)}
`,xs=(e,t)=>`${rr(e,t,!1,!1)}
`,$s=(e,t,n)=>typeof n.name=="string"&&n.name.length!==0&&typeof t.name=="string"&&t.name.length!==0?`${rr(e,t,!0,!1)} ${Object.getPrototypeOf(t)===n?"extends":"extends \u2026 extends"} ${(0,ge.EXPECTED_COLOR)(n.name)}
`:`${rr(e,t,!1,!1)}
`,rr=(e,t,n,r)=>typeof t.name!="string"?`${e} name is not a string`:t.name.length===0?`${e} name is an empty string`:`${e}: ${n?r?"not ":" ":""}${r?(0,ge.EXPECTED_COLOR)(t.name):(0,ge.RECEIVED_COLOR)(t.name)}`;var Is="Expected",Ns="Received",Sb="Expected value",wb="Received value",sr=e=>e!==!1,qf=[K.iterableEquality,K.typeEquality,K.sparseArrayEquality,K.arrayBufferEquality],Ab={toBe(e,t){let n="toBe",r={comment:"Object.is equality",isNot:this.isNot,promise:this.promise},s=Object.is(e,t);return{actual:e,expected:t,message:s?()=>(0,g.matcherHint)(n,void 0,void 0,r)+`
Expected: not ${(0,g.printExpected)(t)}`:()=>{let i=(0,Et.getType)(t),u=null;return i!=="map"&&i!=="set"&&((0,K.equals)(e,t,[...this.customTesters,...qf],!0)?u="toStrictEqual":(0,K.equals)(e,t,[...this.customTesters,K.iterableEquality])&&(u="toEqual")),(0,g.matcherHint)(n,void 0,void 0,r)+`
`+(u!==null?`${(0,g.DIM_COLOR)(`If it should pass with deep equality, replace "${n}" with "${u}"`)}
`:"")+(0,g.printDiffOrStringify)(t,e,Is,Ns,sr(this.expand))},name:n,pass:s}},toBeCloseTo(e,t,n=2){let r="toBeCloseTo",s=arguments.length===3?"precision":void 0,o=this.isNot,i={isNot:o,promise:this.promise,secondArgument:s,secondArgumentColor:f=>f};if(typeof t!="number")throw new Error((0,g.matcherErrorMessage)((0,g.matcherHint)(r,void 0,void 0,i),`${(0,g.EXPECTED_COLOR)("expected")} value must be a number`,(0,g.printWithType)("Expected",t,g.printExpected)));if(typeof e!="number")throw new Error((0,g.matcherErrorMessage)((0,g.matcherHint)(r,void 0,void 0,i),`${(0,g.RECEIVED_COLOR)("received")} value must be a number`,(0,g.printWithType)("Received",e,g.printReceived)));let u=!1,a=0,l=0;return e===1/0&&t===1/0||e===-1/0&&t===-1/0?u=!0:(a=Math.pow(10,-n)/2,l=Math.abs(t-e),u=l<a),{message:u?()=>(0,g.matcherHint)(r,void 0,void 0,i)+`
Expected: not ${(0,g.printExpected)(t)}
`+(l===0?"":`Received: ${(0,g.printReceived)(e)}
${zi(l,a,n,o)}`):()=>(0,g.matcherHint)(r,void 0,void 0,i)+`
Expected: ${(0,g.printExpected)(t)}
Received: ${(0,g.printReceived)(e)}
`+zi(l,a,n,o),pass:u}},toBeDefined(e,t){let n="toBeDefined",r={isNot:this.isNot,promise:this.promise};return(0,g.ensureNoExpected)(t,n,r),{message:()=>(0,g.matcherHint)(n,void 0,"",r)+`
Received: ${(0,g.printReceived)(e)}`,pass:e!==void 0}},toBeFalsy(e,t){let n="toBeFalsy",r={isNot:this.isNot,promise:this.promise};return(0,g.ensureNoExpected)(t,n,r),{message:()=>(0,g.matcherHint)(n,void 0,"",r)+`
Received: ${(0,g.printReceived)(e)}`,pass:!e}},toBeGreaterThan(e,t){let n="toBeGreaterThan",r=this.isNot,s={isNot:r,promise:this.promise};(0,g.ensureNumbers)(e,t,n,s);let o=e>t;return{message:()=>(0,g.matcherHint)(n,void 0,void 0,s)+`
Expected:${r?" not":""} > ${(0,g.printExpected)(t)}
Received:${r?" ":""} ${(0,g.printReceived)(e)}`,pass:o}},toBeGreaterThanOrEqual(e,t){let n="toBeGreaterThanOrEqual",r=this.isNot,s={isNot:r,promise:this.promise};(0,g.ensureNumbers)(e,t,n,s);let o=e>=t;return{message:()=>(0,g.matcherHint)(n,void 0,void 0,s)+`
Expected:${r?" not":""} >= ${(0,g.printExpected)(t)}
Received:${r?" ":""} ${(0,g.printReceived)(e)}`,pass:o}},toBeInstanceOf(e,t){let n="toBeInstanceOf",r={isNot:this.isNot,promise:this.promise};if(typeof t!="function")throw new Error((0,g.matcherErrorMessage)((0,g.matcherHint)(n,void 0,void 0,r),`${(0,g.EXPECTED_COLOR)("expected")} value must be a function`,(0,g.printWithType)("Expected",t,g.printExpected)));let s=e instanceof t;return{message:s?()=>(0,g.matcherHint)(n,void 0,void 0,r)+`
`+Ts("Expected constructor",t)+(typeof e.constructor=="function"&&e.constructor!==t?$s("Received constructor",e.constructor,t):""):()=>(0,g.matcherHint)(n,void 0,void 0,r)+`
`+Ms("Expected constructor",t)+((0,Et.isPrimitive)(e)||Object.getPrototypeOf(e)===null?`
Received value has no prototype
Received value: ${(0,g.printReceived)(e)}`:typeof e.constructor!="function"?`
Received value: ${(0,g.printReceived)(e)}`:xs("Received constructor",e.constructor)),pass:s}},toBeLessThan(e,t){let n="toBeLessThan",r=this.isNot,s={isNot:r,promise:this.promise};(0,g.ensureNumbers)(e,t,n,s);let o=e<t;return{message:()=>(0,g.matcherHint)(n,void 0,void 0,s)+`
Expected:${r?" not":""} < ${(0,g.printExpected)(t)}
Received:${r?" ":""} ${(0,g.printReceived)(e)}`,pass:o}},toBeLessThanOrEqual(e,t){let n="toBeLessThanOrEqual",r=this.isNot,s={isNot:r,promise:this.promise};(0,g.ensureNumbers)(e,t,n,s);let o=e<=t;return{message:()=>(0,g.matcherHint)(n,void 0,void 0,s)+`
Expected:${r?" not":""} <= ${(0,g.printExpected)(t)}
Received:${r?" ":""} ${(0,g.printReceived)(e)}`,pass:o}},toBeNaN(e,t){let n="toBeNaN",r={isNot:this.isNot,promise:this.promise};(0,g.ensureNoExpected)(t,n,r);let s=Number.isNaN(e);return{message:()=>(0,g.matcherHint)(n,void 0,"",r)+`
Received: ${(0,g.printReceived)(e)}`,pass:s}},toBeNull(e,t){let n="toBeNull",r={isNot:this.isNot,promise:this.promise};return(0,g.ensureNoExpected)(t,n,r),{message:()=>(0,g.matcherHint)(n,void 0,"",r)+`
Received: ${(0,g.printReceived)(e)}`,pass:e===null}},toBeTruthy(e,t){let n="toBeTruthy",r={isNot:this.isNot,promise:this.promise};return(0,g.ensureNoExpected)(t,n,r),{message:()=>(0,g.matcherHint)(n,void 0,"",r)+`
Received: ${(0,g.printReceived)(e)}`,pass:!!e}},toBeUndefined(e,t){let n="toBeUndefined",r={isNot:this.isNot,promise:this.promise};return(0,g.ensureNoExpected)(t,n,r),{message:()=>(0,g.matcherHint)(n,void 0,"",r)+`
Received: ${(0,g.printReceived)(e)}`,pass:e===void 0}},toContain(e,t){let n="toContain",r=this.isNot,s={comment:"indexOf",isNot:r,promise:this.promise};if(e==null)throw new Error((0,g.matcherErrorMessage)((0,g.matcherHint)(n,void 0,void 0,s),`${(0,g.RECEIVED_COLOR)("received")} value must not be null nor undefined`,(0,g.printWithType)("Received",e,g.printReceived)));if(typeof e=="string"){let l=`${(0,g.EXPECTED_COLOR)("expected")} value must be a string if ${(0,g.RECEIVED_COLOR)("received")} value is a string`;if(typeof t!="string")throw new Error((0,g.matcherErrorMessage)((0,g.matcherHint)(n,e,String(t),s),l,(0,g.printWithType)("Expected",t,g.printExpected)+`
`+(0,g.printWithType)("Received",e,g.printReceived)));let c=e.indexOf(String(t));return{message:()=>{let m=`Expected ${typeof t=="string"?"substring":"value"}`,h="Received string",d=(0,g.getLabelPrinter)(m,h);return(0,g.matcherHint)(n,void 0,void 0,s)+`
${d(m)}${r?"not ":""}${(0,g.printExpected)(t)}
${d(h)}${r?" ":""}${r?mn(e,c,String(t).length):(0,g.printReceived)(e)}`},pass:c!==-1}}let o=Array.from(e),i=o.indexOf(t);return{message:()=>{let l="Expected value",c=`Received ${(0,Et.getType)(e)}`,f=(0,g.getLabelPrinter)(l,c);return(0,g.matcherHint)(n,void 0,void 0,s)+`
${f(l)}${r?"not ":""}${(0,g.printExpected)(t)}
${f(c)}${r?" ":""}${r&&Array.isArray(e)?Vi(e,i):(0,g.printReceived)(e)}`+(!r&&o.findIndex(p=>(0,K.equals)(p,t,[...this.customTesters,K.iterableEquality]))!==-1?`
${g.SUGGEST_TO_CONTAIN_EQUAL}`:"")},pass:i!==-1}},toContainEqual(e,t){let n="toContainEqual",r=this.isNot,s={comment:"deep equality",isNot:r,promise:this.promise};if(e==null)throw new Error((0,g.matcherErrorMessage)((0,g.matcherHint)(n,void 0,void 0,s),`${(0,g.RECEIVED_COLOR)("received")} value must not be null nor undefined`,(0,g.printWithType)("Received",e,g.printReceived)));let o=Array.from(e).findIndex(a=>(0,K.equals)(a,t,[...this.customTesters,K.iterableEquality]));return{message:()=>{let a="Expected value",l=`Received ${(0,Et.getType)(e)}`,c=(0,g.getLabelPrinter)(a,l);return(0,g.matcherHint)(n,void 0,void 0,s)+`
${c(a)}${r?"not ":""}${(0,g.printExpected)(t)}
${c(l)}${r?" ":""}${r&&Array.isArray(e)?Vi(e,o):(0,g.printReceived)(e)}`},pass:o!==-1}},toEqual(e,t){let n="toEqual",r={comment:"deep equality",isNot:this.isNot,promise:this.promise},s=(0,K.equals)(e,t,[...this.customTesters,K.iterableEquality]);return{actual:e,expected:t,message:s?()=>(0,g.matcherHint)(n,void 0,void 0,r)+`
Expected: not ${(0,g.printExpected)(t)}
`+((0,g.stringify)(t)!==(0,g.stringify)(e)?`Received: ${(0,g.printReceived)(e)}`:""):()=>(0,g.matcherHint)(n,void 0,void 0,r)+`
`+(0,g.printDiffOrStringify)(t,e,Is,Ns,sr(this.expand)),name:n,pass:s}},toHaveLength(e,t){let n="toHaveLength",r=this.isNot,s={isNot:r,promise:this.promise};if(typeof(e==null?void 0:e.length)!="number")throw new Error((0,g.matcherErrorMessage)((0,g.matcherHint)(n,void 0,void 0,s),`${(0,g.RECEIVED_COLOR)("received")} value must have a length property whose value must be a number`,(0,g.printWithType)("Received",e,g.printReceived)));(0,g.ensureExpectedIsNonNegativeInteger)(t,n,s);let o=e.length===t;return{message:()=>{let u="Expected length",a="Received length",l=`Received ${(0,Et.getType)(e)}`,c=(0,g.getLabelPrinter)(u,a,l);return(0,g.matcherHint)(n,void 0,void 0,s)+`
${c(u)}${r?"not ":""}${(0,g.printExpected)(t)}
`+(r?"":`${c(a)}${(0,g.printReceived)(e.length)}
`)+`${c(l)}${r?" ":""}${(0,g.printReceived)(e)}`},pass:o}},toHaveProperty(e,t,n){let r="toHaveProperty",s="path",o=arguments.length===3,i={isNot:this.isNot,promise:this.promise,secondArgument:o?"value":""};if(e==null)throw new Error((0,g.matcherErrorMessage)((0,g.matcherHint)(r,void 0,s,i),`${(0,g.RECEIVED_COLOR)("received")} value must not be null nor undefined`,(0,g.printWithType)("Received",e,g.printReceived)));let u=(0,Et.getType)(t);if(u!=="string"&&u!=="array")throw new Error((0,g.matcherErrorMessage)((0,g.matcherHint)(r,void 0,s,i),`${(0,g.EXPECTED_COLOR)("expected")} path must be a string or array`,(0,g.printWithType)("Expected",t,g.printExpected)));let a=typeof t=="string"?(0,K.pathAsArray)(t).length:t.length;if(u==="array"&&a===0)throw new Error((0,g.matcherErrorMessage)((0,g.matcherHint)(r,void 0,s,i),`${(0,g.EXPECTED_COLOR)("expected")} path must not be an empty array`,(0,g.printWithType)("Expected",t,g.printExpected)));let l=(0,K.getPath)(e,t),{lastTraversedObject:c,endPropIsDefined:f,hasEndProp:p,value:m}=l,h=l.traversedPath,d=h.length===a,v=d?l.value:c,O=o&&f?(0,K.equals)(m,n,[...this.customTesters,K.iterableEquality]):!!p;return{message:O?()=>(0,g.matcherHint)(r,void 0,s,i)+`
`+(o?`Expected path: ${(0,g.printExpected)(t)}
Expected value: not ${(0,g.printExpected)(n)}${(0,g.stringify)(n)!==(0,g.stringify)(v)?`
Received value: ${(0,g.printReceived)(v)}`:""}`:`Expected path: not ${(0,g.printExpected)(t)}
Received value: ${(0,g.printReceived)(v)}`):()=>(0,g.matcherHint)(r,void 0,s,i)+`
Expected path: ${(0,g.printExpected)(t)}
`+(d?`
${(0,g.printDiffOrStringify)(n,v,Sb,wb,sr(this.expand))}`:`Received path: ${(0,g.printReceived)(u==="array"||h.length===0?h:h.join("."))}
${o?`Expected value: ${(0,g.printExpected)(n)}
`:""}Received value: ${(0,g.printReceived)(v)}`),pass:O}},toMatch(e,t){let n="toMatch",r={isNot:this.isNot,promise:this.promise};if(typeof e!="string")throw new Error((0,g.matcherErrorMessage)((0,g.matcherHint)(n,void 0,void 0,r),`${(0,g.RECEIVED_COLOR)("received")} value must be a string`,(0,g.printWithType)("Received",e,g.printReceived)));if(typeof t!="string"&&!(t&&typeof t.test=="function"))throw new Error((0,g.matcherErrorMessage)((0,g.matcherHint)(n,void 0,void 0,r),`${(0,g.EXPECTED_COLOR)("expected")} value must be a string or regular expression`,(0,g.printWithType)("Expected",t,g.printExpected)));let s=typeof t=="string"?e.includes(t):new RegExp(t).test(e);return{message:s?()=>typeof t=="string"?(0,g.matcherHint)(n,void 0,void 0,r)+`
Expected substring: not ${(0,g.printExpected)(t)}
Received string: ${mn(e,e.indexOf(t),t.length)}`:(0,g.matcherHint)(n,void 0,void 0,r)+`
Expected pattern: not ${(0,g.printExpected)(t)}
Received string: ${As(e,typeof t.exec=="function"?t.exec(e):null)}`:()=>{let i=`Expected ${typeof t=="string"?"substring":"pattern"}`,u="Received string",a=(0,g.getLabelPrinter)(i,u);return(0,g.matcherHint)(n,void 0,void 0,r)+`
${a(i)}${(0,g.printExpected)(t)}
${a(u)}${(0,g.printReceived)(e)}`},pass:s}},toMatchObject(e,t){let n="toMatchObject",r={isNot:this.isNot,promise:this.promise};if(typeof e!="object"||e===null)throw new Error((0,g.matcherErrorMessage)((0,g.matcherHint)(n,void 0,void 0,r),`${(0,g.RECEIVED_COLOR)("received")} value must be a non-null object`,(0,g.printWithType)("Received",e,g.printReceived)));if(typeof t!="object"||t===null)throw new Error((0,g.matcherErrorMessage)((0,g.matcherHint)(n,void 0,void 0,r),`${(0,g.EXPECTED_COLOR)("expected")} value must be a non-null object`,(0,g.printWithType)("Expected",t,g.printExpected)));let s=(0,K.equals)(e,t,[...this.customTesters,K.iterableEquality,K.subsetEquality]);return{message:s?()=>(0,g.matcherHint)(n,void 0,void 0,r)+`
Expected: not ${(0,g.printExpected)(t)}`+((0,g.stringify)(t)!==(0,g.stringify)(e)?`
Received: ${(0,g.printReceived)(e)}`:""):()=>(0,g.matcherHint)(n,void 0,void 0,r)+`
`+(0,g.printDiffOrStringify)(t,(0,K.getObjectSubset)(e,t,this.customTesters),Is,Ns,sr(this.expand)),pass:s}},toStrictEqual(e,t){let n="toStrictEqual",r={comment:"deep equality",isNot:this.isNot,promise:this.promise},s=(0,K.equals)(e,t,[...this.customTesters,...qf],!0);return{actual:e,expected:t,message:s?()=>(0,g.matcherHint)(n,void 0,void 0,r)+`
Expected: not ${(0,g.printExpected)(t)}
`+((0,g.stringify)(t)!==(0,g.stringify)(e)?`Received: ${(0,g.printReceived)(e)}`:""):()=>(0,g.matcherHint)(n,void 0,void 0,r)+`
`+(0,g.printDiffOrStringify)(t,e,Is,Ns,sr(this.expand)),name:n,pass:s}}},Hf=Ab;var Ps=ie(ln()),or=ie(ot()),_=ie(ze());var Yi=e=>e!==!1,dn=3,tp="called with 0 arguments",Ls=e=>e.length===0?tp:e.map(t=>(0,_.printExpected)(t)).join(", "),ir=(e,t)=>e.length===0?tp:e.map((n,r)=>Array.isArray(t)&&r<t.length&&vn(t[r],n)?ks(n):(0,_.printReceived)(n)).join(", "),ks=e=>(0,_.DIM_COLOR)((0,_.stringify)(e)),vn=(e,t)=>(0,Ps.equals)(e,t,[...gn(),Ps.iterableEquality]),vt=(e,t)=>t.length===e.length&&vn(e,t),_t=(e,t)=>t.type==="return"&&vn(e,t.value),yn=e=>e.reduce((t,n)=>n.type==="return"?t+1:t,0),bn=(e,t)=>`
Number of returns: ${(0,_.printReceived)(e)}${t!==e?`
Number of calls: ${(0,_.printReceived)(t)}`:""}`,Qi=e=>{let t=e.indexOf(":"),n=e.slice(t);return(r,s)=>(s?`->${" ".repeat(Math.max(0,t-2-r.length))}`:" ".repeat(Math.max(t-r.length)))+r+n},Xi=(e,t,n,r)=>{if(t.length===0)return"";let s="Received: ";if(n)return`${s+ir(t[0],e)}
`;let o=Qi(s);return`Received
${t.reduce((i,[u,a])=>`${i+o(String(u+1),u===r)+ir(a,e)}
`,"")}`},Ji=(e,t,n,r,s)=>{let o=`Expected: ${Ls(e)}
`;if(t.length===0)return o;let i="Received: ";if(r&&(s===0||s===void 0)){let a=t[0][1];if(Uf(e,a)){let l=[(0,_.EXPECTED_COLOR)("- Expected"),(0,_.RECEIVED_COLOR)("+ Received"),""],c=Math.max(e.length,a.length);for(let f=0;f<c;f+=1){if(f<e.length&&f<a.length){if(vn(e[f],a[f])){l.push(` ${ks(a[f])},`);continue}if(Zi(e[f],a[f])){let p=(0,_.diff)(e[f],a[f],{expand:n});if(typeof p=="string"&&p.includes("- Expected")&&p.includes("+ Received")){l.push(`${p.split(`
`).slice(3).join(`
`)},`);continue}}}f<e.length&&l.push(`${(0,_.EXPECTED_COLOR)(`- ${(0,_.stringify)(e[f])}`)},`),f<a.length&&l.push(`${(0,_.RECEIVED_COLOR)(`+ ${(0,_.stringify)(a[f])}`)},`)}return`${l.join(`
`)}
`}return`${o+i+ir(a,e)}
`}let u=Qi(i);return o+`Received
`+t.reduce((a,[l,c])=>{let f=u(String(l+1),l===s);return`${a+((l===s||s===void 0)&&Uf(e,c)?f.replace(": ",`
`)+Mb(e,c,n):f+ir(c,e))}
`},"")},Ki="Received".replace(/\w/g," "),Mb=(e,t,n)=>t.map((r,s)=>{if(s<e.length){if(vn(e[s],r))return`${Ki} ${ks(r)},`;if(Zi(e[s],r)){let o=(0,_.diff)(e[s],r,{expand:n});if(typeof o=="string"&&o.includes("- Expected")&&o.includes("+ Received"))return`${o.split(`
`).slice(3).map(i=>Ki+i).join(`
`)},`}}return`${Ki+(s<e.length?` ${(0,_.printReceived)(r)}`:(0,_.RECEIVED_COLOR)(`+ ${(0,_.stringify)(r)}`))},`}).join(`
`),Uf=(e,t)=>e.some((n,r)=>r<t.length&&Zi(n,t[r])),Zi=(e,t)=>{let n=(0,or.getType)(e),r=(0,or.getType)(t);return!(n!==r||(0,or.isPrimitive)(e)||n==="date"||n==="function"||n==="regexp"||e instanceof Error&&t instanceof Error||n==="object"&&typeof e.asymmetricMatch=="function"||r==="object"&&typeof t.asymmetricMatch=="function")},Gf=(e,t)=>e.type==="throw"?"function call threw an error":e.type==="incomplete"?"function call has not returned yet":vn(t,e.value)?ks(e.value):(0,_.printReceived)(e.value),En=(e,t,n,r,s)=>{if(n.length===0)return"";if(r&&(s===0||s===void 0))return`${e+Gf(n[0][1],t)}
`;let o=Qi(e);return e.replace(":","").trim()+`
`+n.reduce((i,[u,a])=>`${i+o(String(u+1),u===s)+Gf(a,t)}
`,"")},Wf=e=>function(t,n){let r="",s={isNot:this.isNot,promise:this.promise};(0,_.ensureNoExpected)(n,e,s),ur(t,e,r,s);let o=_n(t),i=o?"spy":t.getMockName(),u=o?t.calls.count():t.mock.calls.length,a=o?t.calls.all().map(f=>f.args):t.mock.calls,l=u>0;return{message:l?()=>(0,_.matcherHint)(e,i,r,s)+`
Expected number of calls: ${(0,_.printExpected)(0)}
Received number of calls: ${(0,_.printReceived)(u)}
`+a.reduce((f,p,m)=>(f.length<dn&&f.push(`${m+1}: ${ir(p)}`),f),[]).join(`
`):()=>(0,_.matcherHint)(e,i,r,s)+`
Expected number of calls: >= ${(0,_.printExpected)(1)}
Received number of calls: ${(0,_.printReceived)(u)}`,pass:l}},Vf=e=>function(t,n){let r="",s={isNot:this.isNot,promise:this.promise};(0,_.ensureNoExpected)(n,e,s),ar(t,e,r,s);let o=t.getMockName(),i=t.mock.results.reduce((l,c)=>c.type==="return"?l+1:l,0),u=i>0;return{message:u?()=>(0,_.matcherHint)(e,o,r,s)+`
Expected number of returns: ${(0,_.printExpected)(0)}
Received number of returns: ${(0,_.printReceived)(i)}
`+t.mock.results.reduce((l,c,f)=>(c.type==="return"&&l.length<dn&&l.push(`${f+1}: ${(0,_.printReceived)(c.value)}`),l),[]).join(`
`)+(t.mock.calls.length!==i?`
Received number of calls: ${(0,_.printReceived)(t.mock.calls.length)}`:""):()=>(0,_.matcherHint)(e,o,r,s)+`
Expected number of returns: >= ${(0,_.printExpected)(1)}
Received number of returns: ${(0,_.printReceived)(i)}`+(t.mock.calls.length!==i?`
Received number of calls: ${(0,_.printReceived)(t.mock.calls.length)}`:""),pass:u}},zf=e=>function(t,n){let r="expected",s={isNot:this.isNot,promise:this.promise};(0,_.ensureExpectedIsNonNegativeInteger)(n,e,s),ur(t,e,r,s);let o=_n(t),i=o?"spy":t.getMockName(),u=o?t.calls.count():t.mock.calls.length,a=u===n;return{message:a?()=>(0,_.matcherHint)(e,i,r,s)+`
Expected number of calls: not ${(0,_.printExpected)(n)}`:()=>(0,_.matcherHint)(e,i,r,s)+`
Expected number of calls: ${(0,_.printExpected)(n)}
Received number of calls: ${(0,_.printReceived)(u)}`,pass:a}},Kf=e=>function(t,n){let r="expected",s={isNot:this.isNot,promise:this.promise};(0,_.ensureExpectedIsNonNegativeInteger)(n,e,s),ar(t,e,r,s);let o=t.getMockName(),i=t.mock.results.reduce((l,c)=>c.type==="return"?l+1:l,0),u=i===n;return{message:u?()=>(0,_.matcherHint)(e,o,r,s)+`
Expected number of returns: not ${(0,_.printExpected)(n)}`+(t.mock.calls.length!==i?`
Received number of calls: ${(0,_.printReceived)(t.mock.calls.length)}`:""):()=>(0,_.matcherHint)(e,o,r,s)+`
Expected number of returns: ${(0,_.printExpected)(n)}
Received number of returns: ${(0,_.printReceived)(i)}`+(t.mock.calls.length!==i?`
Received number of calls: ${(0,_.printReceived)(t.mock.calls.length)}`:""),pass:u}},Yf=e=>function(t,...n){let r="...expected",s={isNot:this.isNot,promise:this.promise};ur(t,e,r,s);let o=_n(t),i=o?"spy":t.getMockName(),u=o?t.calls.all().map(c=>c.args):t.mock.calls,a=u.some(c=>vt(n,c));return{message:a?()=>{let c=[],f=0;for(;f<u.length&&c.length<dn;)vt(n,u[f])&&c.push([f,u[f]]),f+=1;return(0,_.matcherHint)(e,i,r,s)+`
Expected: not ${Ls(n)}
`+(u.length===1&&(0,_.stringify)(u[0])===(0,_.stringify)(n)?"":Xi(n,c,u.length===1))+`
Number of calls: ${(0,_.printReceived)(u.length)}`}:()=>{let c=[],f=0;for(;f<u.length&&c.length<dn;)c.push([f,u[f]]),f+=1;return(0,_.matcherHint)(e,i,r,s)+`
`+Ji(n,c,Yi(this.expand),u.length===1)+`
Number of calls: ${(0,_.printReceived)(u.length)}`},pass:a}},Qf=e=>function(t,n){let r="expected",s={isNot:this.isNot,promise:this.promise};ar(t,e,r,s);let o=t.getMockName(),{calls:i,results:u}=t.mock,a=u.some(c=>_t(n,c));return{message:a?()=>{let c=[],f=0;for(;f<u.length&&c.length<dn;)_t(n,u[f])&&c.push([f,u[f]]),f+=1;return(0,_.matcherHint)(e,o,r,s)+`
Expected: not ${(0,_.printExpected)(n)}
`+(u.length===1&&u[0].type==="return"&&(0,_.stringify)(u[0].value)===(0,_.stringify)(n)?"":En("Received: ",n,c,u.length===1))+bn(yn(u),i.length)}:()=>{let c=[],f=0;for(;f<u.length&&c.length<dn;)c.push([f,u[f]]),f+=1;return(0,_.matcherHint)(e,o,r,s)+`
Expected: ${(0,_.printExpected)(n)}
`+En("Received: ",n,c,u.length===1)+bn(yn(u),i.length)},pass:a}},Xf=e=>function(t,...n){let r="...expected",s={isNot:this.isNot,promise:this.promise};ur(t,e,r,s);let o=_n(t),i=o?"spy":t.getMockName(),u=o?t.calls.all().map(f=>f.args):t.mock.calls,a=u.length-1,l=a>=0&&vt(n,u[a]);return{message:l?()=>{let f=[];return a>0&&f.push([a-1,u[a-1]]),f.push([a,u[a]]),(0,_.matcherHint)(e,i,r,s)+`
Expected: not ${Ls(n)}
`+(u.length===1&&(0,_.stringify)(u[0])===(0,_.stringify)(n)?"":Xi(n,f,u.length===1,a))+`
Number of calls: ${(0,_.printReceived)(u.length)}`}:()=>{let f=[];if(a>=0){if(a>0){let p=a-1;for(;p>=0&&!vt(n,u[p]);)p-=1;p<0&&(p=a-1),f.push([p,u[p]])}f.push([a,u[a]])}return(0,_.matcherHint)(e,i,r,s)+`
`+Ji(n,f,Yi(this.expand),u.length===1,a)+`
Number of calls: ${(0,_.printReceived)(u.length)}`},pass:l}},Jf=e=>function(t,n){let r="expected",s={isNot:this.isNot,promise:this.promise};ar(t,e,r,s);let o=t.getMockName(),{calls:i,results:u}=t.mock,a=u.length-1,l=a>=0&&_t(n,u[a]);return{message:l?()=>{let f=[];return a>0&&f.push([a-1,u[a-1]]),f.push([a,u[a]]),(0,_.matcherHint)(e,o,r,s)+`
Expected: not ${(0,_.printExpected)(n)}
`+(u.length===1&&u[0].type==="return"&&(0,_.stringify)(u[0].value)===(0,_.stringify)(n)?"":En("Received: ",n,f,u.length===1,a))+bn(yn(u),i.length)}:()=>{let f=[];if(a>=0){if(a>0){let p=a-1;for(;p>=0&&!_t(n,u[p]);)p-=1;p<0&&(p=a-1),f.push([p,u[p]])}f.push([a,u[a]])}return(0,_.matcherHint)(e,o,r,s)+`
Expected: ${(0,_.printExpected)(n)}
`+En("Received: ",n,f,u.length===1,a)+bn(yn(u),i.length)},pass:l}},Zf=e=>function(t,n,...r){let s="n",o={expectedColor:m=>m,isNot:this.isNot,promise:this.promise,secondArgument:"...expected"};if(ur(t,e,s,o),!Number.isSafeInteger(n)||n<1)throw new Error((0,_.matcherErrorMessage)((0,_.matcherHint)(e,void 0,s,o),`${s} must be a positive integer`,(0,_.printWithType)(s,n,_.stringify)));let i=_n(t),u=i?"spy":t.getMockName(),a=i?t.calls.all().map(m=>m.args):t.mock.calls,l=a.length,c=n-1,f=c<l&&vt(r,a[c]);return{message:f?()=>{let m=[];return c-1>=0&&m.push([c-1,a[c-1]]),m.push([c,a[c]]),c+1<l&&m.push([c+1,a[c+1]]),(0,_.matcherHint)(e,u,s,o)+`
n: ${n}
Expected: not ${Ls(r)}
`+(a.length===1&&(0,_.stringify)(a[0])===(0,_.stringify)(r)?"":Xi(r,m,a.length===1,c))+`
Number of calls: ${(0,_.printReceived)(a.length)}`}:()=>{let m=[];if(c<l){if(c-1>=0){let h=c-1;for(;h>=0&&!vt(r,a[h]);)h-=1;h<0&&(h=c-1),m.push([h,a[h]])}if(m.push([c,a[c]]),c+1<l){let h=c+1;for(;h<l&&!vt(r,a[h]);)h+=1;h>=l&&(h=c+1),m.push([h,a[h]])}}else if(l>0){let h=l-1;for(;h>=0&&!vt(r,a[h]);)h-=1;h<0&&(h=l-1),m.push([h,a[h]])}return(0,_.matcherHint)(e,u,s,o)+`
n: ${n}
`+Ji(r,m,Yi(this.expand),a.length===1,c)+`
Number of calls: ${(0,_.printReceived)(a.length)}`},pass:f}},ep=e=>function(t,n,r){let s="n",o={expectedColor:m=>m,isNot:this.isNot,promise:this.promise,secondArgument:"expected"};if(ar(t,e,s,o),!Number.isSafeInteger(n)||n<1)throw new Error((0,_.matcherErrorMessage)((0,_.matcherHint)(e,void 0,s,o),`${s} must be a positive integer`,(0,_.printWithType)(s,n,_.stringify)));let i=t.getMockName(),{calls:u,results:a}=t.mock,l=a.length,c=n-1,f=c<l&&_t(r,a[c]);return{message:f?()=>{let m=[];return c-1>=0&&m.push([c-1,a[c-1]]),m.push([c,a[c]]),c+1<l&&m.push([c+1,a[c+1]]),(0,_.matcherHint)(e,i,s,o)+`
n: ${n}
Expected: not ${(0,_.printExpected)(r)}
`+(a.length===1&&a[0].type==="return"&&(0,_.stringify)(a[0].value)===(0,_.stringify)(r)?"":En("Received: ",r,m,a.length===1,c))+bn(yn(a),u.length)}:()=>{let m=[];if(c<l){if(c-1>=0){let h=c-1;for(;h>=0&&!_t(r,a[h]);)h-=1;h<0&&(h=c-1),m.push([h,a[h]])}if(m.push([c,a[c]]),c+1<l){let h=c+1;for(;h<l&&!_t(r,a[h]);)h+=1;h>=l&&(h=c+1),m.push([h,a[h]])}}else if(l>0){let h=l-1;for(;h>=0&&!_t(r,a[h]);)h-=1;h<0&&(h=l-1),m.push([h,a[h]])}return(0,_.matcherHint)(e,i,s,o)+`
n: ${n}
Expected: ${(0,_.printExpected)(r)}
`+En("Received: ",r,m,a.length===1,c)+bn(yn(a),u.length)},pass:f}},Tb={lastCalledWith:Xf("lastCalledWith"),lastReturnedWith:Jf("lastReturnedWith"),nthCalledWith:Zf("nthCalledWith"),nthReturnedWith:ep("nthReturnedWith"),toBeCalled:Wf("toBeCalled"),toBeCalledTimes:zf("toBeCalledTimes"),toBeCalledWith:Yf("toBeCalledWith"),toHaveBeenCalled:Wf("toHaveBeenCalled"),toHaveBeenCalledTimes:zf("toHaveBeenCalledTimes"),toHaveBeenCalledWith:Yf("toHaveBeenCalledWith"),toHaveBeenLastCalledWith:Xf("toHaveBeenLastCalledWith"),toHaveBeenNthCalledWith:Zf("toHaveBeenNthCalledWith"),toHaveLastReturnedWith:Jf("toHaveLastReturnedWith"),toHaveNthReturnedWith:ep("toHaveNthReturnedWith"),toHaveReturned:Vf("toHaveReturned"),toHaveReturnedTimes:Kf("toHaveReturnedTimes"),toHaveReturnedWith:Qf("toHaveReturnedWith"),toReturn:Vf("toReturn"),toReturnTimes:Kf("toReturnTimes"),toReturnWith:Qf("toReturnWith")},np=e=>e!=null&&e._isMockFunction===!0,_n=e=>e!=null&&e.calls!=null&&typeof e.calls.all=="function"&&typeof e.calls.count=="function",ur=(e,t,n,r)=>{if(!np(e)&&!_n(e))throw new Error((0,_.matcherErrorMessage)((0,_.matcherHint)(t,void 0,n,r),`${(0,_.RECEIVED_COLOR)("received")} value must be a mock or spy function`,(0,_.printWithType)("Received",e,_.printReceived)))},ar=(e,t,n,r)=>{if(!np(e))throw new Error((0,_.matcherErrorMessage)((0,_.matcherHint)(t,void 0,n,r),`${(0,_.RECEIVED_COLOR)("received")} value must be a mock function`,(0,_.printWithType)("Received",e,_.printReceived)))},rp=Tb;var Sh=ie(ln()),z=ie(ze()),Zs=ie(Rh());var Tn="Received function did not throw",Oh=e=>{let t=e!=null&&typeof e.message=="string";return t&&typeof e.name=="string"&&typeof e.stack=="string"?{hasMessage:t,isError:!0,message:e.message,value:e}:{hasMessage:t,isError:!1,message:t?e.message:String(e),value:e}},Js=(e,t)=>function(n,r){let s={isNot:this.isNot,promise:this.promise},o=null;if(t&&(0,Sh.isError)(n))o=Oh(n);else if(typeof n!="function"){if(!t){let i=r===void 0?"":"expected";throw new Error((0,z.matcherErrorMessage)((0,z.matcherHint)(e,void 0,i,s),`${(0,z.RECEIVED_COLOR)("received")} value must be a function`,(0,z.printWithType)("Received",n,z.printReceived)))}}else try{n()}catch(i){o=Oh(i)}if(r===void 0)return U2(e,s,o);if(typeof r=="function")return q2(e,s,o,r);if(typeof r=="string")return H2(e,s,o,r);if(r!==null&&typeof r.test=="function")return F2(e,s,o,r);if(r!==null&&typeof r.asymmetricMatch=="function")return j2(e,s,o,r);if(r!==null&&typeof r=="object")return B2(e,s,o,r);throw new Error((0,z.matcherErrorMessage)((0,z.matcherHint)(e,void 0,void 0,s),`${(0,z.EXPECTED_COLOR)("expected")} value must be a string or regular expression or class or error`,(0,z.printWithType)("Expected",r,z.printExpected)))},D2={toThrow:Js("toThrow"),toThrowError:Js("toThrowError")},F2=(e,t,n,r)=>{let s=n!==null&&r.test(n.message);return{message:s?()=>(0,z.matcherHint)(e,void 0,void 0,t)+`
`+nt("Expected pattern: not ",r)+(n!==null&&n.hasMessage?oe("Received message: ",n,"message",r)+He(n):oe("Received value: ",n,"value")):()=>(0,z.matcherHint)(e,void 0,void 0,t)+`
`+nt("Expected pattern: ",r)+(n===null?`
${Tn}`:n.hasMessage?oe("Received message: ",n,"message")+He(n):oe("Received value: ",n,"value")),pass:s}},j2=(e,t,n,r)=>{let s=n!==null&&r.asymmetricMatch(n.value);return{message:s?()=>(0,z.matcherHint)(e,void 0,void 0,t)+`
`+nt("Expected asymmetric matcher: not ",r)+`
`+(n!==null&&n.hasMessage?oe("Received name: ",n,"name")+oe("Received message: ",n,"message")+He(n):oe("Thrown value: ",n,"value")):()=>(0,z.matcherHint)(e,void 0,void 0,t)+`
`+nt("Expected asymmetric matcher: ",r)+`
`+(n===null?Tn:n.hasMessage?oe("Received name: ",n,"name")+oe("Received message: ",n,"message")+He(n):oe("Thrown value: ",n,"value")),pass:s}},B2=(e,t,n,r)=>{let s=Ch(r),o=n!==null?Ch(n.value):null,i=n!==null&&n.message===r.message&&o===s;return{message:i?()=>(0,z.matcherHint)(e,void 0,void 0,t)+`
`+nt(`Expected ${mr(r)}: not `,s)+(n!==null&&n.hasMessage?He(n):oe("Received value: ",n,"value")):()=>(0,z.matcherHint)(e,void 0,void 0,t)+`
`+(n===null?nt(`Expected ${mr(r)}: `,s)+`
`+Tn:n.hasMessage?(0,z.printDiffOrStringify)(s,o,`Expected ${mr(r)}`,`Received ${mr(n.value)}`,!0)+`
`+He(n):nt(`Expected ${mr(r)}: `,s)+oe("Received value: ",n,"value")),pass:i}},q2=(e,t,n,r)=>{let s=n!==null&&n.value instanceof r;return{message:s?()=>(0,z.matcherHint)(e,void 0,void 0,t)+`
`+Ts("Expected constructor",r)+(n!==null&&n.value!=null&&typeof n.value.constructor=="function"&&n.value.constructor!==r?$s("Received constructor",n.value.constructor,r):"")+`
`+(n!==null&&n.hasMessage?oe("Received message: ",n,"message")+He(n):oe("Received value: ",n,"value")):()=>(0,z.matcherHint)(e,void 0,void 0,t)+`
`+Ms("Expected constructor",r)+(n===null?`
${Tn}`:`${n.value!=null&&typeof n.value.constructor=="function"?xs("Received constructor",n.value.constructor):""}
${n.hasMessage?oe("Received message: ",n,"message")+He(n):oe("Received value: ",n,"value")}`),pass:s}},H2=(e,t,n,r)=>{let s=n!==null&&n.message.includes(r);return{message:s?()=>(0,z.matcherHint)(e,void 0,void 0,t)+`
`+nt("Expected substring: not ",r)+(n!==null&&n.hasMessage?oe("Received message: ",n,"message",r)+He(n):oe("Received value: ",n,"value")):()=>(0,z.matcherHint)(e,void 0,void 0,t)+`
`+nt("Expected substring: ",r)+(n===null?`
${Tn}`:n.hasMessage?oe("Received message: ",n,"message")+He(n):oe("Received value: ",n,"value")),pass:s}},U2=(e,t,n)=>{let r=n!==null;return{message:r?()=>(0,z.matcherHint)(e,void 0,"",t)+`
`+(n!==null&&n.hasMessage?oe("Error name: ",n,"name")+oe("Error message: ",n,"message")+He(n):oe("Thrown value: ",n,"value")):()=>(0,z.matcherHint)(e,void 0,"",t)+`
`+Tn,pass:r}},nt=(e,t)=>`${e+(0,z.printExpected)(t)}
`,oe=(e,t,n,r)=>{if(t===null)return"";if(n==="message"){let s=t.message;if(typeof r=="string"){let o=s.indexOf(r);if(o!==-1)return`${e+mn(s,o,r.length)}
`}else if(r instanceof RegExp)return`${e+As(s,typeof r.exec=="function"?r.exec(s):null)}
`;return`${e+(0,z.printReceived)(s)}
`}return n==="name"?t.isError?`${e+(0,z.printReceived)(t.value.name)}
`:"":n==="value"?t.isError?"":`${e+(0,z.printReceived)(t.value)}
`:""},He=e=>e===null||!e.isError?"":(0,Zs.formatStackTrace)((0,Zs.separateMessageFromStack)(e.value.stack).stack,{rootDir:process.cwd(),testMatch:[]},{noStackTrace:!1});function wh(e){return e.cause instanceof Error?`{ message: ${e.message}, cause: ${wh(e.cause)}}`:`{ message: ${e.message} }`}function Ch(e){return e.cause instanceof Error?wh(e):e.message}function mr(e){return e.cause===void 0?"message":"message and cause"}var Ah=D2;var Je=class extends Error{},G2=function(e){return function(t,n){return e.apply(this,[t,n,!0])}},W2=(e,t)=>e==="toThrow"||e==="toThrowError"?Js(e,!0):e==="toThrowErrorMatchingSnapshot"||e==="toThrowErrorMatchingInlineSnapshot"?G2(t):null,le=(e,...t)=>{if(t.length!==0)throw new Error("Expect takes at most one argument.");let n=Lf(),r={not:{},rejects:{not:{}},resolves:{not:{}}},s=new Je;return Object.keys(n).forEach(o=>{let i=n[o],u=W2(o,i)||i;r[o]=eo(i,!1,"",e),r.not[o]=eo(i,!0,"",e),r.resolves[o]=Mh(o,u,!1,e,s),r.resolves.not[o]=Mh(o,u,!0,e,s),r.rejects[o]=Th(o,u,!1,e,s),r.rejects.not[o]=Th(o,u,!0,e,s)}),r},V2=e=>e&&e()||ne.RECEIVED_COLOR("No message was specified for this matcher."),Mh=(e,t,n,r,s)=>(...o)=>{let i={isNot:n,promise:"resolves"};if(!(0,to.isPromise)(r))throw new Je(ne.matcherErrorMessage(ne.matcherHint(e,void 0,"",i),`${ne.RECEIVED_COLOR("received")} value must be a promise`,ne.printWithType("Received",r,ne.printReceived)));let u=new Je;return r.then(a=>eo(t,n,"resolves",a,u).apply(null,o),a=>(s.message=`${ne.matcherHint(e,void 0,"",i)}
Received promise rejected instead of resolved
Rejected to value: ${ne.printReceived(a)}`,Promise.reject(s)))},Th=(e,t,n,r,s)=>(...o)=>{let i={isNot:n,promise:"rejects"},u=typeof r=="function"?r():r;if(!(0,to.isPromise)(u))throw new Je(ne.matcherErrorMessage(ne.matcherHint(e,void 0,"",i),`${ne.RECEIVED_COLOR("received")} value must be a promise or a function returning a promise`,ne.printWithType("Received",r,ne.printReceived)));let a=new Je;return u.then(l=>(s.message=`${ne.matcherHint(e,void 0,"",i)}
Received promise resolved instead of rejected
Resolved to value: ${ne.printReceived(l)}`,Promise.reject(s)),l=>eo(t,n,"rejects",l,a).apply(null,o))},eo=(e,t,n,r,s)=>function o(...i){let u=!0,a={...ne,iterableEquality:xn.iterableEquality,subsetEquality:xn.subsetEquality},l={customTesters:gn(),dontThrow:()=>u=!1,equals:xn.equals,utils:a},c={...Ye(),...l,error:s,isNot:t,promise:n},f=(h,d)=>{if(z2(h),Ye().assertionCalls++,h.pass&&t||!h.pass&&!t){let v=V2(h.message),O;if(s?(O=s,O.message=v):d?(O=d,O.message=v):(O=new Je(v),Error.captureStackTrace&&Error.captureStackTrace(O,o)),O.matcherResult={...h,message:v},u)throw O;Ye().suppressedErrors.push(O)}else Ye().numPassingAsserts++},p=h=>{throw e[cs]===!0&&!(h instanceof Je)&&h.name!=="PrettyFormatPluginError"&&Error.captureStackTrace&&Error.captureStackTrace(h,o),h},m;try{if(m=e[cs]===!0?e.call(c,r,...i):function(){return e.call(c,r,...i)}(),(0,to.isPromise)(m)){let h=new Je;return Error.captureStackTrace&&Error.captureStackTrace(h,o),m.then(d=>f(d,h)).catch(p)}else return f(m)}catch(h){return p(h)}};le.extend=e=>nr(e,!1,le);le.addEqualityTesters=e=>kf(e);le.anything=ds;le.any=ms;le.not={arrayContaining:bs,closeTo:ws,objectContaining:vs,stringContaining:Rs,stringMatching:Cs};le.arrayContaining=ys;le.closeTo=Ss;le.objectContaining=Es;le.stringContaining=_s;le.stringMatching=Os;var z2=e=>{if(typeof e!="object"||typeof e.pass!="boolean"||e.message&&typeof e.message!="string"&&typeof e.message!="function")throw new Error(`Unexpected return from a matcher function.
Matcher functions should return an object in the following format:
{message?: string | function, pass: boolean}
'${ne.stringify(e)}' was returned`)};function xh(e){let t=new Error;Error.captureStackTrace&&Error.captureStackTrace(t,xh),hn({expectedAssertionsNumber:e,expectedAssertionsNumberError:t})}function $h(...e){let t=new Error;Error.captureStackTrace&&Error.captureStackTrace(t,$h),ne.ensureNoExpected(e[0],".hasAssertions"),hn({isExpectingAssertions:!0,isExpectingAssertionsError:t})}nr(Hf,!0,le);nr(rp,!0,le);nr(Ah,!0,le);le.assertions=xh;le.hasAssertions=$h;le.getState=Ye;le.setState=hn;le.extractExpectedAssertionsErrors=Bf;var Ih=le;var Dh=ie(Lh()),Ct=ie(ze()),rv=Ih,sv={any:ms,anything:ds,arrayContaining:ys,arrayNotContaining:bs,closeTo:Ss,notCloseTo:ws,objectContaining:Es,objectNotContaining:vs,stringContaining:_s,stringMatching:Os,stringNotContaining:Rs,stringNotMatching:Cs},ov={stringify:kh.stringify};0&&(module.exports={EXPECTED_COLOR,INVERTED_COLOR,RECEIVED_COLOR,asymmetricMatchers,expect,matcherUtils,mock,printReceived});
/*! Bundled license information:
react-is/cjs/react-is.production.min.js:
(**
* @license React
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
react-is/cjs/react-is.development.js:
(**
* @license React
* react-is.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
is-number/index.js:
(*!
* is-number <https://github.com/jonschlinkert/is-number>
*
* Copyright (c) 2014-present, Jon Schlinkert.
* Released under the MIT License.
*)
to-regex-range/index.js:
(*!
* to-regex-range <https://github.com/micromatch/to-regex-range>
*
* Copyright (c) 2015-present, Jon Schlinkert.
* Released under the MIT License.
*)
fill-range/index.js:
(*!
* fill-range <https://github.com/jonschlinkert/fill-range>
*
* Copyright (c) 2014-present, Jon Schlinkert.
* Licensed under the MIT License.
*)
*/
+302
View File
@@ -0,0 +1,302 @@
"use strict";
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 __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);
var fixtures_exports = {};
__export(fixtures_exports, {
FixturePool: () => FixturePool,
fixtureParameterNames: () => fixtureParameterNames,
formatPotentiallyInternalLocation: () => formatPotentiallyInternalLocation,
inheritFixtureNames: () => inheritFixtureNames
});
module.exports = __toCommonJS(fixtures_exports);
var import_crypto = __toESM(require("crypto"));
var import_util = require("../util");
const kScopeOrder = ["test", "worker"];
function isFixtureTuple(value) {
return Array.isArray(value) && typeof value[1] === "object";
}
function isFixtureOption(value) {
return isFixtureTuple(value) && !!value[1].option;
}
class FixturePool {
constructor(fixturesList, onLoadError, parentPool, disallowWorkerFixtures, optionOverrides) {
this._registrations = new Map(parentPool ? parentPool._registrations : []);
this._onLoadError = onLoadError;
const allOverrides = optionOverrides?.overrides ?? {};
const overrideKeys = new Set(Object.keys(allOverrides));
for (const list of fixturesList) {
this._appendFixtureList(list, !!disallowWorkerFixtures, false);
const selectedOverrides = {};
for (const [key, value] of Object.entries(list.fixtures)) {
if (isFixtureOption(value) && overrideKeys.has(key))
selectedOverrides[key] = [allOverrides[key], value[1]];
}
if (Object.entries(selectedOverrides).length)
this._appendFixtureList({ fixtures: selectedOverrides, location: optionOverrides.location }, !!disallowWorkerFixtures, true);
}
this.digest = this.validate();
}
_appendFixtureList(list, disallowWorkerFixtures, isOptionsOverride) {
const { fixtures, location } = list;
for (const entry of Object.entries(fixtures)) {
const name = entry[0];
let value = entry[1];
let options;
if (isFixtureTuple(value)) {
options = {
auto: value[1].auto ?? false,
scope: value[1].scope || "test",
option: !!value[1].option,
timeout: value[1].timeout,
customTitle: value[1].title,
box: value[1].box
};
value = value[0];
}
let fn = value;
const previous = this._registrations.get(name);
if (previous && options) {
if (previous.scope !== options.scope) {
this._addLoadError(`Fixture "${name}" has already been registered as a { scope: '${previous.scope}' } fixture defined in ${(0, import_util.formatLocation)(previous.location)}.`, location);
continue;
}
if (previous.auto !== options.auto) {
this._addLoadError(`Fixture "${name}" has already been registered as a { auto: '${previous.scope}' } fixture defined in ${(0, import_util.formatLocation)(previous.location)}.`, location);
continue;
}
} else if (previous) {
options = { auto: previous.auto, scope: previous.scope, option: previous.option, timeout: previous.timeout, customTitle: previous.customTitle };
} else if (!options) {
options = { auto: false, scope: "test", option: false, timeout: void 0 };
}
if (!kScopeOrder.includes(options.scope)) {
this._addLoadError(`Fixture "${name}" has unknown { scope: '${options.scope}' }.`, location);
continue;
}
if (options.scope === "worker" && disallowWorkerFixtures) {
this._addLoadError(`Cannot use({ ${name} }) in a describe group, because it forces a new worker.
Make it top-level in the test file or put in the configuration file.`, location);
continue;
}
if (fn === void 0 && options.option && previous) {
let original = previous;
while (!original.optionOverride && original.super)
original = original.super;
fn = original.fn;
}
const deps = fixtureParameterNames(fn, location, (e) => this._onLoadError(e));
const registration = { id: "", name, location, scope: options.scope, fn, auto: options.auto, option: options.option, timeout: options.timeout, customTitle: options.customTitle, box: options.box, deps, super: previous, optionOverride: isOptionsOverride };
registrationId(registration);
this._registrations.set(name, registration);
}
}
validate() {
const markers = /* @__PURE__ */ new Map();
const stack = [];
let hasDependencyErrors = false;
const addDependencyError = (message, location) => {
hasDependencyErrors = true;
this._addLoadError(message, location);
};
const visit = (registration, boxedOnly) => {
markers.set(registration, "visiting");
stack.push(registration);
for (const name of registration.deps) {
const dep = this.resolve(name, registration);
if (!dep) {
if (name === registration.name)
addDependencyError(`Fixture "${registration.name}" references itself, but does not have a base implementation.`, registration.location);
else
addDependencyError(`Fixture "${registration.name}" has unknown parameter "${name}".`, registration.location);
continue;
}
if (kScopeOrder.indexOf(registration.scope) > kScopeOrder.indexOf(dep.scope)) {
addDependencyError(`${registration.scope} fixture "${registration.name}" cannot depend on a ${dep.scope} fixture "${name}" defined in ${formatPotentiallyInternalLocation(dep.location)}.`, registration.location);
continue;
}
if (!markers.has(dep)) {
visit(dep, boxedOnly);
} else if (markers.get(dep) === "visiting") {
const index = stack.indexOf(dep);
const allRegs = stack.slice(index, stack.length);
const filteredRegs = allRegs.filter((r) => !r.box);
const regs = boxedOnly ? filteredRegs : allRegs;
const names2 = regs.map((r) => `"${r.name}"`);
addDependencyError(`Fixtures ${names2.join(" -> ")} -> "${dep.name}" form a dependency cycle: ${regs.map((r) => formatPotentiallyInternalLocation(r.location)).join(" -> ")} -> ${formatPotentiallyInternalLocation(dep.location)}`, dep.location);
continue;
}
}
markers.set(registration, "visited");
stack.pop();
};
const names = Array.from(this._registrations.keys()).sort();
for (const name of names) {
const registration = this._registrations.get(name);
if (!registration.box)
visit(registration, true);
}
if (!hasDependencyErrors) {
for (const name of names) {
const registration = this._registrations.get(name);
if (registration.box)
visit(registration, false);
}
}
const hash = import_crypto.default.createHash("sha1");
for (const name of names) {
const registration = this._registrations.get(name);
if (registration.scope === "worker")
hash.update(registration.id + ";");
}
return hash.digest("hex");
}
validateFunction(fn, prefix, location) {
for (const name of fixtureParameterNames(fn, location, (e) => this._onLoadError(e))) {
const registration = this._registrations.get(name);
if (!registration)
this._addLoadError(`${prefix} has unknown parameter "${name}".`, location);
}
}
resolve(name, forFixture) {
if (name === forFixture?.name)
return forFixture.super;
return this._registrations.get(name);
}
autoFixtures() {
return [...this._registrations.values()].filter((r) => r.auto !== false);
}
_addLoadError(message, location) {
this._onLoadError({ message, location });
}
}
const signatureSymbol = Symbol("signature");
function formatPotentiallyInternalLocation(location) {
const isUserFixture = location && (0, import_util.filterStackFile)(location.file);
return isUserFixture ? (0, import_util.formatLocation)(location) : "<builtin>";
}
function fixtureParameterNames(fn, location, onError) {
if (typeof fn !== "function")
return [];
if (!fn[signatureSymbol])
fn[signatureSymbol] = innerFixtureParameterNames(fn, location, onError);
return fn[signatureSymbol];
}
function inheritFixtureNames(from, to) {
to[signatureSymbol] = from[signatureSymbol];
}
function innerFixtureParameterNames(fn, location, onError) {
const text = filterOutComments(fn.toString());
const match = text.match(/(?:async)?(?:\s+function)?[^(]*\(([^)]*)/);
if (!match)
return [];
const trimmedParams = match[1].trim();
if (!trimmedParams)
return [];
const [firstParam] = splitByComma(trimmedParams);
if (firstParam[0] !== "{" || firstParam[firstParam.length - 1] !== "}") {
onError({ message: "First argument must use the object destructuring pattern: " + firstParam, location });
return [];
}
const props = splitByComma(firstParam.substring(1, firstParam.length - 1)).map((prop) => {
const colon = prop.indexOf(":");
return colon === -1 ? prop.trim() : prop.substring(0, colon).trim();
});
const restProperty = props.find((prop) => prop.startsWith("..."));
if (restProperty) {
onError({ message: `Rest property "${restProperty}" is not supported. List all used fixtures explicitly, separated by comma.`, location });
return [];
}
return props;
}
function filterOutComments(s) {
const result = [];
let commentState = "none";
for (let i = 0; i < s.length; ++i) {
if (commentState === "singleline") {
if (s[i] === "\n")
commentState = "none";
} else if (commentState === "multiline") {
if (s[i - 1] === "*" && s[i] === "/")
commentState = "none";
} else if (commentState === "none") {
if (s[i] === "/" && s[i + 1] === "/") {
commentState = "singleline";
} else if (s[i] === "/" && s[i + 1] === "*") {
commentState = "multiline";
i += 2;
} else {
result.push(s[i]);
}
}
}
return result.join("");
}
function splitByComma(s) {
const result = [];
const stack = [];
let start = 0;
for (let i = 0; i < s.length; i++) {
if (s[i] === "{" || s[i] === "[") {
stack.push(s[i] === "{" ? "}" : "]");
} else if (s[i] === stack[stack.length - 1]) {
stack.pop();
} else if (!stack.length && s[i] === ",") {
const token = s.substring(start, i).trim();
if (token)
result.push(token);
start = i + 1;
}
}
const lastToken = s.substring(start).trim();
if (lastToken)
result.push(lastToken);
return result;
}
const registrationIdMap = /* @__PURE__ */ new Map();
let lastId = 0;
function registrationId(registration) {
if (registration.id)
return registration.id;
const key = registration.name + "@@@" + (registration.super ? registrationId(registration.super) : "");
let map = registrationIdMap.get(key);
if (!map) {
map = /* @__PURE__ */ new Map();
registrationIdMap.set(key, map);
}
if (!map.has(registration.fn))
map.set(registration.fn, String(lastId++));
registration.id = map.get(registration.fn);
return registration.id;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
FixturePool,
fixtureParameterNames,
formatPotentiallyInternalLocation,
inheritFixtureNames
});
+58
View File
@@ -0,0 +1,58 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var globals_exports = {};
__export(globals_exports, {
currentTestInfo: () => currentTestInfo,
currentlyLoadingFileSuite: () => currentlyLoadingFileSuite,
isWorkerProcess: () => isWorkerProcess,
setCurrentTestInfo: () => setCurrentTestInfo,
setCurrentlyLoadingFileSuite: () => setCurrentlyLoadingFileSuite,
setIsWorkerProcess: () => setIsWorkerProcess
});
module.exports = __toCommonJS(globals_exports);
let currentTestInfoValue = null;
function setCurrentTestInfo(testInfo) {
currentTestInfoValue = testInfo;
}
function currentTestInfo() {
return currentTestInfoValue;
}
let currentFileSuite;
function setCurrentlyLoadingFileSuite(suite) {
currentFileSuite = suite;
}
function currentlyLoadingFileSuite() {
return currentFileSuite;
}
let _isWorkerProcess = false;
function setIsWorkerProcess() {
_isWorkerProcess = true;
}
function isWorkerProcess() {
return _isWorkerProcess;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
currentTestInfo,
currentlyLoadingFileSuite,
isWorkerProcess,
setCurrentTestInfo,
setCurrentlyLoadingFileSuite,
setIsWorkerProcess
});
+60
View File
@@ -0,0 +1,60 @@
"use strict";
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 __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);
var ipc_exports = {};
__export(ipc_exports, {
serializeConfig: () => serializeConfig,
stdioChunkToParams: () => stdioChunkToParams
});
module.exports = __toCommonJS(ipc_exports);
var import_util = __toESM(require("util"));
var import_compilationCache = require("../transform/compilationCache");
function serializeConfig(config, passCompilationCache) {
const result = {
location: { configDir: config.configDir, resolvedConfigFile: config.config.configFile },
configCLIOverrides: config.configCLIOverrides,
compilationCache: passCompilationCache ? (0, import_compilationCache.serializeCompilationCache)() : void 0
};
try {
result.metadata = JSON.stringify(config.config.metadata);
} catch (error) {
}
return result;
}
function stdioChunkToParams(chunk) {
if (chunk instanceof Uint8Array)
return { buffer: Buffer.from(chunk).toString("base64") };
if (typeof chunk !== "string")
return { text: import_util.default.inspect(chunk) };
return { text: chunk };
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
serializeConfig,
stdioChunkToParams
});
+85
View File
@@ -0,0 +1,85 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var poolBuilder_exports = {};
__export(poolBuilder_exports, {
PoolBuilder: () => PoolBuilder
});
module.exports = __toCommonJS(poolBuilder_exports);
var import_fixtures = require("./fixtures");
var import_util = require("../util");
class PoolBuilder {
constructor(type, project) {
this._testTypePools = /* @__PURE__ */ new Map();
this._type = type;
this._project = project;
}
static createForLoader() {
return new PoolBuilder("loader");
}
static createForWorker(project) {
return new PoolBuilder("worker", project);
}
buildPools(suite, testErrors) {
suite.forEachTest((test) => {
const pool = this._buildPoolForTest(test, testErrors);
if (this._type === "loader")
test._poolDigest = pool.digest;
if (this._type === "worker")
test._pool = pool;
});
}
_buildPoolForTest(test, testErrors) {
let pool = this._buildTestTypePool(test._testType, testErrors);
const parents = [];
for (let parent = test.parent; parent; parent = parent.parent)
parents.push(parent);
parents.reverse();
for (const parent of parents) {
if (parent._use.length)
pool = new import_fixtures.FixturePool(parent._use, (e) => this._handleLoadError(e, testErrors), pool, parent._type === "describe");
for (const hook of parent._hooks)
pool.validateFunction(hook.fn, hook.type + " hook", hook.location);
for (const modifier of parent._modifiers)
pool.validateFunction(modifier.fn, modifier.type + " modifier", modifier.location);
}
pool.validateFunction(test.fn, "Test", test.location);
return pool;
}
_buildTestTypePool(testType, testErrors) {
if (!this._testTypePools.has(testType)) {
const optionOverrides = {
overrides: this._project?.project?.use ?? {},
location: { file: `project#${this._project?.id}`, line: 1, column: 1 }
};
const pool = new import_fixtures.FixturePool(testType.fixtures, (e) => this._handleLoadError(e, testErrors), void 0, void 0, optionOverrides);
this._testTypePools.set(testType, pool);
}
return this._testTypePools.get(testType);
}
_handleLoadError(e, testErrors) {
if (testErrors)
testErrors.push(e);
else
throw new Error(`${(0, import_util.formatLocation)(e.location)}: ${e.message}`);
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
PoolBuilder
});
+104
View File
@@ -0,0 +1,104 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var process_exports = {};
__export(process_exports, {
ProcessRunner: () => ProcessRunner
});
module.exports = __toCommonJS(process_exports);
var import_utils = require("playwright-core/lib/utils");
var import_util = require("../util");
class ProcessRunner {
async gracefullyClose() {
}
dispatchEvent(method, params) {
const response = { method, params };
sendMessageToParent({ method: "__dispatch__", params: response });
}
}
let gracefullyCloseCalled = false;
let forceExitInitiated = false;
sendMessageToParent({ method: "ready" });
process.on("disconnect", () => gracefullyCloseAndExit(true));
process.on("SIGINT", () => {
});
process.on("SIGTERM", () => {
});
let processRunner;
let processName;
const startingEnv = { ...process.env };
process.on("message", async (message) => {
if (message.method === "__init__") {
const { processParams, runnerParams, runnerScript } = message.params;
void (0, import_utils.startProfiling)();
(0, import_utils.setTimeOrigin)(processParams.timeOrigin);
const { create } = require(runnerScript);
processRunner = create(runnerParams);
processName = processParams.processName;
return;
}
if (message.method === "__stop__") {
const keys = /* @__PURE__ */ new Set([...Object.keys(process.env), ...Object.keys(startingEnv)]);
const producedEnv = [...keys].filter((key) => startingEnv[key] !== process.env[key]).map((key) => [key, process.env[key] ?? null]);
sendMessageToParent({ method: "__env_produced__", params: producedEnv });
await gracefullyCloseAndExit(false);
return;
}
if (message.method === "__dispatch__") {
const { id, method, params } = message.params;
try {
const result = await processRunner[method](params);
const response = { id, result };
sendMessageToParent({ method: "__dispatch__", params: response });
} catch (e) {
const response = { id, error: (0, import_util.serializeError)(e) };
sendMessageToParent({ method: "__dispatch__", params: response });
}
}
});
const kForceExitTimeout = +(process.env.PWTEST_FORCE_EXIT_TIMEOUT || 3e4);
async function gracefullyCloseAndExit(forceExit) {
if (forceExit && !forceExitInitiated) {
forceExitInitiated = true;
setTimeout(() => process.exit(0), kForceExitTimeout);
}
if (!gracefullyCloseCalled) {
gracefullyCloseCalled = true;
await processRunner?.gracefullyClose().catch(() => {
});
if (processName)
await (0, import_utils.stopProfiling)(processName).catch(() => {
});
process.exit(0);
}
}
function sendMessageToParent(message) {
try {
process.send(message);
} catch (e) {
try {
JSON.stringify(message);
} catch {
throw e;
}
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
ProcessRunner
});
+140
View File
@@ -0,0 +1,140 @@
"use strict";
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 __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);
var suiteUtils_exports = {};
__export(suiteUtils_exports, {
applyRepeatEachIndex: () => applyRepeatEachIndex,
bindFileSuiteToProject: () => bindFileSuiteToProject,
filterByFocusedLine: () => filterByFocusedLine,
filterOnly: () => filterOnly,
filterSuite: () => filterSuite,
filterTestsRemoveEmptySuites: () => filterTestsRemoveEmptySuites
});
module.exports = __toCommonJS(suiteUtils_exports);
var import_path = __toESM(require("path"));
var import_utils = require("playwright-core/lib/utils");
var import_util = require("../util");
function filterSuite(suite, suiteFilter, testFilter) {
for (const child of suite.suites) {
if (!suiteFilter(child))
filterSuite(child, suiteFilter, testFilter);
}
const filteredTests = suite.tests.filter(testFilter);
const entries = /* @__PURE__ */ new Set([...suite.suites, ...filteredTests]);
suite._entries = suite._entries.filter((e) => entries.has(e));
}
function filterTestsRemoveEmptySuites(suite, filter) {
const filteredSuites = suite.suites.filter((child) => filterTestsRemoveEmptySuites(child, filter));
const filteredTests = suite.tests.filter(filter);
const entries = /* @__PURE__ */ new Set([...filteredSuites, ...filteredTests]);
suite._entries = suite._entries.filter((e) => entries.has(e));
return !!suite._entries.length;
}
function bindFileSuiteToProject(project, suite) {
const relativeFile = import_path.default.relative(project.project.testDir, suite.location.file);
const fileId = (0, import_utils.calculateSha1)((0, import_utils.toPosixPath)(relativeFile)).slice(0, 20);
const result = suite._deepClone();
result._fileId = fileId;
result.forEachTest((test, suite2) => {
suite2._fileId = fileId;
const [file, ...titles] = test.titlePath();
const testIdExpression = `[project=${project.id}]${(0, import_utils.toPosixPath)(file)}${titles.join("")}`;
const testId = fileId + "-" + (0, import_utils.calculateSha1)(testIdExpression).slice(0, 20);
test.id = testId;
test._projectId = project.id;
let inheritedRetries;
let inheritedTimeout;
for (let parentSuite = suite2; parentSuite; parentSuite = parentSuite.parent) {
if (parentSuite._staticAnnotations.length)
test.annotations.unshift(...parentSuite._staticAnnotations);
if (inheritedRetries === void 0 && parentSuite._retries !== void 0)
inheritedRetries = parentSuite._retries;
if (inheritedTimeout === void 0 && parentSuite._timeout !== void 0)
inheritedTimeout = parentSuite._timeout;
}
test.retries = inheritedRetries ?? project.project.retries;
test.timeout = inheritedTimeout ?? project.project.timeout;
if (test.annotations.some((a) => a.type === "skip" || a.type === "fixme"))
test.expectedStatus = "skipped";
if (test._poolDigest)
test._workerHash = `${project.id}-${test._poolDigest}-0`;
});
return result;
}
function applyRepeatEachIndex(project, fileSuite, repeatEachIndex) {
fileSuite.forEachTest((test, suite) => {
if (repeatEachIndex) {
const [file, ...titles] = test.titlePath();
const testIdExpression = `[project=${project.id}]${(0, import_utils.toPosixPath)(file)}${titles.join("")} (repeat:${repeatEachIndex})`;
const testId = suite._fileId + "-" + (0, import_utils.calculateSha1)(testIdExpression).slice(0, 20);
test.id = testId;
test.repeatEachIndex = repeatEachIndex;
if (test._poolDigest)
test._workerHash = `${project.id}-${test._poolDigest}-${repeatEachIndex}`;
}
});
}
function filterOnly(suite) {
if (!suite._getOnlyItems().length)
return;
const suiteFilter = (suite2) => suite2._only;
const testFilter = (test) => test._only;
return filterSuiteWithOnlySemantics(suite, suiteFilter, testFilter);
}
function filterSuiteWithOnlySemantics(suite, suiteFilter, testFilter) {
const onlySuites = suite.suites.filter((child) => filterSuiteWithOnlySemantics(child, suiteFilter, testFilter) || suiteFilter(child));
const onlyTests = suite.tests.filter(testFilter);
const onlyEntries = /* @__PURE__ */ new Set([...onlySuites, ...onlyTests]);
if (onlyEntries.size) {
suite._entries = suite._entries.filter((e) => onlyEntries.has(e));
return true;
}
return false;
}
function filterByFocusedLine(suite, focusedTestFileLines) {
if (!focusedTestFileLines.length)
return;
const matchers = focusedTestFileLines.map(createFileMatcherFromFilter);
const testFileLineMatches = (testFileName, testLine, testColumn) => matchers.some((m) => m(testFileName, testLine, testColumn));
const suiteFilter = (suite2) => !!suite2.location && testFileLineMatches(suite2.location.file, suite2.location.line, suite2.location.column);
const testFilter = (test) => testFileLineMatches(test.location.file, test.location.line, test.location.column);
return filterSuite(suite, suiteFilter, testFilter);
}
function createFileMatcherFromFilter(filter) {
const fileMatcher = (0, import_util.createFileMatcher)(filter.re || filter.exact || "");
return (testFileName, testLine, testColumn) => fileMatcher(testFileName) && (filter.line === testLine || filter.line === null) && (filter.column === testColumn || filter.column === null);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
applyRepeatEachIndex,
bindFileSuiteToProject,
filterByFocusedLine,
filterOnly,
filterSuite,
filterTestsRemoveEmptySuites
});
+321
View File
@@ -0,0 +1,321 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var test_exports = {};
__export(test_exports, {
Suite: () => Suite,
TestCase: () => TestCase
});
module.exports = __toCommonJS(test_exports);
var import_testType = require("./testType");
var import_teleReceiver = require("../isomorphic/teleReceiver");
class Base {
constructor(title) {
this._only = false;
this._requireFile = "";
this.title = title;
}
}
class Suite extends Base {
constructor(title, type) {
super(title);
this._use = [];
this._entries = [];
this._hooks = [];
// Annotations known statically before running the test, e.g. `test.describe.skip()` or `test.describe({ annotation }, body)`.
this._staticAnnotations = [];
// Explicitly declared tags that are not a part of the title.
this._tags = [];
this._modifiers = [];
this._parallelMode = "none";
this._type = type;
}
get type() {
return this._type;
}
entries() {
return this._entries;
}
get suites() {
return this._entries.filter((entry) => entry instanceof Suite);
}
get tests() {
return this._entries.filter((entry) => entry instanceof TestCase);
}
_addTest(test) {
test.parent = this;
this._entries.push(test);
}
_addSuite(suite) {
suite.parent = this;
this._entries.push(suite);
}
_prependSuite(suite) {
suite.parent = this;
this._entries.unshift(suite);
}
allTests() {
const result = [];
const visit = (suite) => {
for (const entry of suite._entries) {
if (entry instanceof Suite)
visit(entry);
else
result.push(entry);
}
};
visit(this);
return result;
}
_hasTests() {
let result = false;
const visit = (suite) => {
for (const entry of suite._entries) {
if (result)
return;
if (entry instanceof Suite)
visit(entry);
else
result = true;
}
};
visit(this);
return result;
}
titlePath() {
const titlePath = this.parent ? this.parent.titlePath() : [];
if (this.title || this._type !== "describe")
titlePath.push(this.title);
return titlePath;
}
_collectGrepTitlePath(path) {
if (this.parent)
this.parent._collectGrepTitlePath(path);
if (this.title || this._type !== "describe")
path.push(this.title);
path.push(...this._tags);
}
_getOnlyItems() {
const items = [];
if (this._only)
items.push(this);
for (const suite of this.suites)
items.push(...suite._getOnlyItems());
items.push(...this.tests.filter((test) => test._only));
return items;
}
_deepClone() {
const suite = this._clone();
for (const entry of this._entries) {
if (entry instanceof Suite)
suite._addSuite(entry._deepClone());
else
suite._addTest(entry._clone());
}
return suite;
}
_deepSerialize() {
const suite = this._serialize();
suite.entries = [];
for (const entry of this._entries) {
if (entry instanceof Suite)
suite.entries.push(entry._deepSerialize());
else
suite.entries.push(entry._serialize());
}
return suite;
}
static _deepParse(data) {
const suite = Suite._parse(data);
for (const entry of data.entries) {
if (entry.kind === "suite")
suite._addSuite(Suite._deepParse(entry));
else
suite._addTest(TestCase._parse(entry));
}
return suite;
}
forEachTest(visitor) {
for (const entry of this._entries) {
if (entry instanceof Suite)
entry.forEachTest(visitor);
else
visitor(entry, this);
}
}
_serialize() {
return {
kind: "suite",
title: this.title,
type: this._type,
location: this.location,
only: this._only,
requireFile: this._requireFile,
timeout: this._timeout,
retries: this._retries,
staticAnnotations: this._staticAnnotations.slice(),
tags: this._tags.slice(),
modifiers: this._modifiers.slice(),
parallelMode: this._parallelMode,
hooks: this._hooks.map((h) => ({ type: h.type, location: h.location, title: h.title })),
fileId: this._fileId
};
}
static _parse(data) {
const suite = new Suite(data.title, data.type);
suite.location = data.location;
suite._only = data.only;
suite._requireFile = data.requireFile;
suite._timeout = data.timeout;
suite._retries = data.retries;
suite._staticAnnotations = data.staticAnnotations;
suite._tags = data.tags;
suite._modifiers = data.modifiers;
suite._parallelMode = data.parallelMode;
suite._hooks = data.hooks.map((h) => ({ type: h.type, location: h.location, title: h.title, fn: () => {
} }));
suite._fileId = data.fileId;
return suite;
}
_clone() {
const data = this._serialize();
const suite = Suite._parse(data);
suite._use = this._use.slice();
suite._hooks = this._hooks.slice();
suite._fullProject = this._fullProject;
return suite;
}
project() {
return this._fullProject?.project || this.parent?.project();
}
}
class TestCase extends Base {
constructor(title, fn, testType, location) {
super(title);
this.results = [];
this.type = "test";
this.expectedStatus = "passed";
this.timeout = 0;
this.annotations = [];
this.retries = 0;
this.repeatEachIndex = 0;
this.id = "";
this._poolDigest = "";
this._workerHash = "";
this._projectId = "";
// Explicitly declared tags that are not a part of the title.
this._tags = [];
this.fn = fn;
this._testType = testType;
this.location = location;
}
titlePath() {
const titlePath = this.parent ? this.parent.titlePath() : [];
titlePath.push(this.title);
return titlePath;
}
outcome() {
return (0, import_teleReceiver.computeTestCaseOutcome)(this);
}
ok() {
const status = this.outcome();
return status === "expected" || status === "flaky" || status === "skipped";
}
get tags() {
const titleTags = this._grepBaseTitlePath().join(" ").match(/@[\S]+/g) || [];
return [
...titleTags,
...this._tags
];
}
_serialize() {
return {
kind: "test",
id: this.id,
title: this.title,
retries: this.retries,
timeout: this.timeout,
expectedStatus: this.expectedStatus,
location: this.location,
only: this._only,
requireFile: this._requireFile,
poolDigest: this._poolDigest,
workerHash: this._workerHash,
annotations: this.annotations.slice(),
tags: this._tags.slice(),
projectId: this._projectId
};
}
static _parse(data) {
const test = new TestCase(data.title, () => {
}, import_testType.rootTestType, data.location);
test.id = data.id;
test.retries = data.retries;
test.timeout = data.timeout;
test.expectedStatus = data.expectedStatus;
test._only = data.only;
test._requireFile = data.requireFile;
test._poolDigest = data.poolDigest;
test._workerHash = data.workerHash;
test.annotations = data.annotations;
test._tags = data.tags;
test._projectId = data.projectId;
return test;
}
_clone() {
const data = this._serialize();
const test = TestCase._parse(data);
test._testType = this._testType;
test.fn = this.fn;
return test;
}
_appendTestResult() {
const result = {
retry: this.results.length,
parallelIndex: -1,
workerIndex: -1,
duration: 0,
startTime: /* @__PURE__ */ new Date(),
stdout: [],
stderr: [],
attachments: [],
status: "skipped",
steps: [],
errors: [],
annotations: []
};
this.results.push(result);
return result;
}
_grepBaseTitlePath() {
const path = [];
this.parent._collectGrepTitlePath(path);
path.push(this.title);
return path;
}
_grepTitleWithTags() {
const path = this._grepBaseTitlePath();
path.push(...this._tags);
return path.join(" ");
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Suite,
TestCase
});
+100
View File
@@ -0,0 +1,100 @@
"use strict";
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 __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);
var testLoader_exports = {};
__export(testLoader_exports, {
defaultTimeout: () => defaultTimeout,
loadTestFile: () => loadTestFile
});
module.exports = __toCommonJS(testLoader_exports);
var import_path = __toESM(require("path"));
var import_util = __toESM(require("util"));
var esmLoaderHost = __toESM(require("./esmLoaderHost"));
var import_globals = require("./globals");
var import_test = require("./test");
var import_compilationCache = require("../transform/compilationCache");
var import_transform = require("../transform/transform");
var import_util2 = require("../util");
const defaultTimeout = 3e4;
const cachedFileSuites = /* @__PURE__ */ new Map();
async function loadTestFile(file, rootDir, testErrors) {
if (cachedFileSuites.has(file))
return cachedFileSuites.get(file);
const suite = new import_test.Suite(import_path.default.relative(rootDir, file) || import_path.default.basename(file), "file");
suite._requireFile = file;
suite.location = { file, line: 0, column: 0 };
(0, import_globals.setCurrentlyLoadingFileSuite)(suite);
if (!(0, import_globals.isWorkerProcess)()) {
(0, import_compilationCache.startCollectingFileDeps)();
await esmLoaderHost.startCollectingFileDeps();
}
try {
await (0, import_transform.requireOrImport)(file);
cachedFileSuites.set(file, suite);
} catch (e) {
if (!testErrors)
throw e;
testErrors.push(serializeLoadError(file, e));
} finally {
(0, import_globals.setCurrentlyLoadingFileSuite)(void 0);
if (!(0, import_globals.isWorkerProcess)()) {
(0, import_compilationCache.stopCollectingFileDeps)(file);
await esmLoaderHost.stopCollectingFileDeps(file);
}
}
{
const files = /* @__PURE__ */ new Set();
suite.allTests().map((t) => files.add(t.location.file));
if (files.size === 1) {
const mappedFile = files.values().next().value;
if (suite.location.file !== mappedFile) {
if (import_path.default.extname(mappedFile) !== import_path.default.extname(suite.location.file))
suite.location.file = mappedFile;
}
}
}
return suite;
}
function serializeLoadError(file, error) {
if (error instanceof Error) {
const result = (0, import_util2.filterStackTrace)(error);
const loc = error.loc;
result.location = loc ? {
file,
line: loc.line || 0,
column: loc.column || 0
} : void 0;
return result;
}
return { value: import_util.default.inspect(error) };
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
defaultTimeout,
loadTestFile
});
+307
View File
@@ -0,0 +1,307 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var testType_exports = {};
__export(testType_exports, {
TestTypeImpl: () => TestTypeImpl,
mergeTests: () => mergeTests,
rootTestType: () => rootTestType
});
module.exports = __toCommonJS(testType_exports);
var import_playwright_core = require("playwright-core");
var import_utils = require("playwright-core/lib/utils");
var import_globals = require("./globals");
var import_test = require("./test");
var import_expect = require("../matchers/expect");
var import_transform = require("../transform/transform");
const testTypeSymbol = Symbol("testType");
class TestTypeImpl {
constructor(fixtures) {
this.fixtures = fixtures;
const test = (0, import_transform.wrapFunctionWithLocation)(this._createTest.bind(this, "default"));
test[testTypeSymbol] = this;
test.expect = import_expect.expect;
test.only = (0, import_transform.wrapFunctionWithLocation)(this._createTest.bind(this, "only"));
test.describe = (0, import_transform.wrapFunctionWithLocation)(this._describe.bind(this, "default"));
test.describe.only = (0, import_transform.wrapFunctionWithLocation)(this._describe.bind(this, "only"));
test.describe.configure = (0, import_transform.wrapFunctionWithLocation)(this._configure.bind(this));
test.describe.fixme = (0, import_transform.wrapFunctionWithLocation)(this._describe.bind(this, "fixme"));
test.describe.parallel = (0, import_transform.wrapFunctionWithLocation)(this._describe.bind(this, "parallel"));
test.describe.parallel.only = (0, import_transform.wrapFunctionWithLocation)(this._describe.bind(this, "parallel.only"));
test.describe.serial = (0, import_transform.wrapFunctionWithLocation)(this._describe.bind(this, "serial"));
test.describe.serial.only = (0, import_transform.wrapFunctionWithLocation)(this._describe.bind(this, "serial.only"));
test.describe.skip = (0, import_transform.wrapFunctionWithLocation)(this._describe.bind(this, "skip"));
test.beforeEach = (0, import_transform.wrapFunctionWithLocation)(this._hook.bind(this, "beforeEach"));
test.afterEach = (0, import_transform.wrapFunctionWithLocation)(this._hook.bind(this, "afterEach"));
test.beforeAll = (0, import_transform.wrapFunctionWithLocation)(this._hook.bind(this, "beforeAll"));
test.afterAll = (0, import_transform.wrapFunctionWithLocation)(this._hook.bind(this, "afterAll"));
test.skip = (0, import_transform.wrapFunctionWithLocation)(this._modifier.bind(this, "skip"));
test.fixme = (0, import_transform.wrapFunctionWithLocation)(this._modifier.bind(this, "fixme"));
test.fail = (0, import_transform.wrapFunctionWithLocation)(this._modifier.bind(this, "fail"));
test.fail.only = (0, import_transform.wrapFunctionWithLocation)(this._createTest.bind(this, "fail.only"));
test.slow = (0, import_transform.wrapFunctionWithLocation)(this._modifier.bind(this, "slow"));
test.setTimeout = (0, import_transform.wrapFunctionWithLocation)(this._setTimeout.bind(this));
test.step = this._step.bind(this, "pass");
test.step.skip = this._step.bind(this, "skip");
test.use = (0, import_transform.wrapFunctionWithLocation)(this._use.bind(this));
test.extend = (0, import_transform.wrapFunctionWithLocation)(this._extend.bind(this));
test.info = () => {
const result = (0, import_globals.currentTestInfo)();
if (!result)
throw new Error("test.info() can only be called while test is running");
return result;
};
this.test = test;
}
_currentSuite(location, title) {
const suite = (0, import_globals.currentlyLoadingFileSuite)();
if (!suite) {
throw new Error([
`Playwright Test did not expect ${title} to be called here.`,
`Most common reasons include:`,
`- You are calling ${title} in a configuration file.`,
`- You are calling ${title} in a file that is imported by the configuration file.`,
`- You have two different versions of @playwright/test. This usually happens`,
` when one of the dependencies in your package.json depends on @playwright/test.`
].join("\n"));
}
return suite;
}
_createTest(type, location, title, fnOrDetails, fn) {
throwIfRunningInsideJest();
const suite = this._currentSuite(location, "test()");
if (!suite)
return;
let details;
let body;
if (typeof fnOrDetails === "function") {
body = fnOrDetails;
details = {};
} else {
body = fn;
details = fnOrDetails;
}
const validatedDetails = validateTestDetails(details, location);
const test = new import_test.TestCase(title, body, this, location);
test._requireFile = suite._requireFile;
test.annotations.push(...validatedDetails.annotations);
test._tags.push(...validatedDetails.tags);
suite._addTest(test);
if (type === "only" || type === "fail.only")
test._only = true;
if (type === "skip" || type === "fixme" || type === "fail")
test.annotations.push({ type, location });
else if (type === "fail.only")
test.annotations.push({ type: "fail", location });
}
_describe(type, location, titleOrFn, fnOrDetails, fn) {
throwIfRunningInsideJest();
const suite = this._currentSuite(location, "test.describe()");
if (!suite)
return;
let title;
let body;
let details;
if (typeof titleOrFn === "function") {
title = "";
details = {};
body = titleOrFn;
} else if (typeof fnOrDetails === "function") {
title = titleOrFn;
details = {};
body = fnOrDetails;
} else {
title = titleOrFn;
details = fnOrDetails;
body = fn;
}
const validatedDetails = validateTestDetails(details, location);
const child = new import_test.Suite(title, "describe");
child._requireFile = suite._requireFile;
child.location = location;
child._staticAnnotations.push(...validatedDetails.annotations);
child._tags.push(...validatedDetails.tags);
suite._addSuite(child);
if (type === "only" || type === "serial.only" || type === "parallel.only")
child._only = true;
if (type === "serial" || type === "serial.only")
child._parallelMode = "serial";
if (type === "parallel" || type === "parallel.only")
child._parallelMode = "parallel";
if (type === "skip" || type === "fixme")
child._staticAnnotations.push({ type, location });
for (let parent = suite; parent; parent = parent.parent) {
if (parent._parallelMode === "serial" && child._parallelMode === "parallel")
throw new Error("describe.parallel cannot be nested inside describe.serial");
if (parent._parallelMode === "default" && child._parallelMode === "parallel")
throw new Error("describe.parallel cannot be nested inside describe with default mode");
}
(0, import_globals.setCurrentlyLoadingFileSuite)(child);
body();
(0, import_globals.setCurrentlyLoadingFileSuite)(suite);
}
_hook(name, location, title, fn) {
const suite = this._currentSuite(location, `test.${name}()`);
if (!suite)
return;
if (typeof title === "function") {
fn = title;
title = `${name} hook`;
}
suite._hooks.push({ type: name, fn, title, location });
}
_configure(location, options) {
throwIfRunningInsideJest();
const suite = this._currentSuite(location, `test.describe.configure()`);
if (!suite)
return;
if (options.timeout !== void 0)
suite._timeout = options.timeout;
if (options.retries !== void 0)
suite._retries = options.retries;
if (options.mode !== void 0) {
if (suite._parallelMode !== "none")
throw new Error(`"${suite._parallelMode}" mode is already assigned for the enclosing scope.`);
suite._parallelMode = options.mode;
for (let parent = suite.parent; parent; parent = parent.parent) {
if (parent._parallelMode === "serial" && suite._parallelMode === "parallel")
throw new Error("describe with parallel mode cannot be nested inside describe with serial mode");
if (parent._parallelMode === "default" && suite._parallelMode === "parallel")
throw new Error("describe with parallel mode cannot be nested inside describe with default mode");
}
}
}
_modifier(type, location, ...modifierArgs) {
const suite = (0, import_globals.currentlyLoadingFileSuite)();
if (suite) {
if (typeof modifierArgs[0] === "string" && typeof modifierArgs[1] === "function" && (type === "skip" || type === "fixme" || type === "fail")) {
this._createTest(type, location, modifierArgs[0], modifierArgs[1]);
return;
}
if (typeof modifierArgs[0] === "string" && typeof modifierArgs[1] === "object" && typeof modifierArgs[2] === "function" && (type === "skip" || type === "fixme" || type === "fail")) {
this._createTest(type, location, modifierArgs[0], modifierArgs[1], modifierArgs[2]);
return;
}
if (typeof modifierArgs[0] === "function") {
suite._modifiers.push({ type, fn: modifierArgs[0], location, description: modifierArgs[1] });
} else {
if (modifierArgs.length >= 1 && !modifierArgs[0])
return;
const description = modifierArgs[1];
suite._staticAnnotations.push({ type, description, location });
}
return;
}
const testInfo = (0, import_globals.currentTestInfo)();
if (!testInfo)
throw new Error(`test.${type}() can only be called inside test, describe block or fixture`);
if (typeof modifierArgs[0] === "function")
throw new Error(`test.${type}() with a function can only be called inside describe block`);
testInfo._modifier(type, location, modifierArgs);
}
_setTimeout(location, timeout) {
const suite = (0, import_globals.currentlyLoadingFileSuite)();
if (suite) {
suite._timeout = timeout;
return;
}
const testInfo = (0, import_globals.currentTestInfo)();
if (!testInfo)
throw new Error(`test.setTimeout() can only be called from a test`);
testInfo.setTimeout(timeout);
}
_use(location, fixtures) {
const suite = this._currentSuite(location, `test.use()`);
if (!suite)
return;
suite._use.push({ fixtures, location });
}
async _step(expectation, title, body, options = {}) {
const testInfo = (0, import_globals.currentTestInfo)();
if (!testInfo)
throw new Error(`test.step() can only be called from a test`);
const step = testInfo._addStep({ category: "test.step", title, location: options.location, box: options.box });
return await (0, import_utils.currentZone)().with("stepZone", step).run(async () => {
try {
let result = void 0;
result = await (0, import_utils.raceAgainstDeadline)(async () => {
try {
return await step.info._runStepBody(expectation === "skip", body, step.location);
} catch (e) {
if (result?.timedOut)
testInfo._failWithError(e);
throw e;
}
}, options.timeout ? (0, import_utils.monotonicTime)() + options.timeout : 0);
if (result.timedOut)
throw new import_playwright_core.errors.TimeoutError(`Step timeout of ${options.timeout}ms exceeded.`);
step.complete({});
return result.result;
} catch (error) {
step.complete({ error });
throw error;
}
});
}
_extend(location, fixtures) {
if (fixtures[testTypeSymbol])
throw new Error(`test.extend() accepts fixtures object, not a test object.
Did you mean to call mergeTests()?`);
const fixturesWithLocation = { fixtures, location };
return new TestTypeImpl([...this.fixtures, fixturesWithLocation]).test;
}
}
function throwIfRunningInsideJest() {
if (process.env.JEST_WORKER_ID) {
const packageManagerCommand = (0, import_utils.getPackageManagerExecCommand)();
throw new Error(
`Playwright Test needs to be invoked via '${packageManagerCommand} playwright test' and excluded from Jest test runs.
Creating one directory for Playwright tests and one for Jest is the recommended way of doing it.
See https://playwright.dev/docs/intro for more information about Playwright Test.`
);
}
}
function validateTestDetails(details, location) {
const originalAnnotations = Array.isArray(details.annotation) ? details.annotation : details.annotation ? [details.annotation] : [];
const annotations = originalAnnotations.map((annotation) => ({ ...annotation, location }));
const tags = Array.isArray(details.tag) ? details.tag : details.tag ? [details.tag] : [];
for (const tag of tags) {
if (tag[0] !== "@")
throw new Error(`Tag must start with "@" symbol, got "${tag}" instead.`);
}
return { annotations, tags };
}
const rootTestType = new TestTypeImpl([]);
function mergeTests(...tests) {
let result = rootTestType;
for (const t of tests) {
const testTypeImpl = t[testTypeSymbol];
if (!testTypeImpl)
throw new Error(`mergeTests() accepts "test" functions as parameters.
Did you mean to call test.extend() with fixtures instead?`);
const newFixtures = testTypeImpl.fixtures.filter((theirs) => !result.fixtures.find((ours) => ours.fixtures === theirs.fixtures));
result = new TestTypeImpl([...result.fixtures, ...newFixtures]);
}
return result.test;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
TestTypeImpl,
mergeTests,
rootTestType
});
+67
View File
@@ -0,0 +1,67 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var fsWatcher_exports = {};
__export(fsWatcher_exports, {
Watcher: () => Watcher
});
module.exports = __toCommonJS(fsWatcher_exports);
var import_utilsBundle = require("./utilsBundle");
class Watcher {
constructor(onChange) {
this._watchedPaths = [];
this._ignoredFolders = [];
this._collector = [];
this._onChange = onChange;
}
async update(watchedPaths, ignoredFolders, reportPending) {
if (JSON.stringify([this._watchedPaths, this._ignoredFolders]) === JSON.stringify([watchedPaths, ignoredFolders]))
return;
if (reportPending)
this._reportEventsIfAny();
this._watchedPaths = watchedPaths;
this._ignoredFolders = ignoredFolders;
void this._fsWatcher?.close();
this._fsWatcher = void 0;
this._collector.length = 0;
clearTimeout(this._throttleTimer);
this._throttleTimer = void 0;
if (!this._watchedPaths.length)
return;
const ignored = [...this._ignoredFolders, "**/node_modules/**"];
this._fsWatcher = import_utilsBundle.chokidar.watch(watchedPaths, { ignoreInitial: true, ignored }).on("all", async (event, file) => {
if (this._throttleTimer)
clearTimeout(this._throttleTimer);
this._collector.push({ event, file });
this._throttleTimer = setTimeout(() => this._reportEventsIfAny(), 250);
});
await new Promise((resolve, reject) => this._fsWatcher.once("ready", resolve).once("error", reject));
}
async close() {
await this._fsWatcher?.close();
}
_reportEventsIfAny() {
if (this._collector.length)
this._onChange(this._collector.slice());
this._collector.length = 0;
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Watcher
});
+683
View File
@@ -0,0 +1,683 @@
"use strict";
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 __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);
var index_exports = {};
__export(index_exports, {
_baseTest: () => _baseTest,
defineConfig: () => import_configLoader.defineConfig,
expect: () => import_expect.expect,
mergeExpects: () => import_expect2.mergeExpects,
mergeTests: () => import_testType2.mergeTests,
test: () => test
});
module.exports = __toCommonJS(index_exports);
var import_fs = __toESM(require("fs"));
var import_path = __toESM(require("path"));
var playwrightLibrary = __toESM(require("playwright-core"));
var import_utils = require("playwright-core/lib/utils");
var import_globals = require("./common/globals");
var import_testType = require("./common/testType");
var import_expect = require("./matchers/expect");
var import_configLoader = require("./common/configLoader");
var import_testType2 = require("./common/testType");
var import_expect2 = require("./matchers/expect");
const _baseTest = import_testType.rootTestType.test;
(0, import_utils.setBoxedStackPrefixes)([import_path.default.dirname(require.resolve("../package.json"))]);
if (process["__pw_initiator__"]) {
const originalStackTraceLimit = Error.stackTraceLimit;
Error.stackTraceLimit = 200;
try {
throw new Error("Requiring @playwright/test second time, \nFirst:\n" + process["__pw_initiator__"] + "\n\nSecond: ");
} finally {
Error.stackTraceLimit = originalStackTraceLimit;
}
} else {
process["__pw_initiator__"] = new Error().stack;
}
const playwrightFixtures = {
defaultBrowserType: ["chromium", { scope: "worker", option: true, box: true }],
browserName: [({ defaultBrowserType }, use) => use(defaultBrowserType), { scope: "worker", option: true, box: true }],
playwright: [async ({}, use) => {
await use(require("playwright-core"));
}, { scope: "worker", box: true }],
headless: [({ launchOptions }, use) => use(launchOptions.headless ?? true), { scope: "worker", option: true, box: true }],
channel: [({ launchOptions }, use) => use(launchOptions.channel), { scope: "worker", option: true, box: true }],
launchOptions: [{}, { scope: "worker", option: true, box: true }],
connectOptions: [async ({ _optionConnectOptions }, use) => {
await use(connectOptionsFromEnv() || _optionConnectOptions);
}, { scope: "worker", option: true, box: true }],
screenshot: ["off", { scope: "worker", option: true, box: true }],
video: ["off", { scope: "worker", option: true, box: true }],
trace: ["off", { scope: "worker", option: true, box: true }],
_browserOptions: [async ({ playwright, headless, channel, launchOptions }, use) => {
const options = {
handleSIGINT: false,
...launchOptions,
tracesDir: tracing().tracesDir()
};
if (headless !== void 0)
options.headless = headless;
if (channel !== void 0)
options.channel = channel;
playwright._defaultLaunchOptions = options;
await use(options);
playwright._defaultLaunchOptions = void 0;
}, { scope: "worker", auto: true, box: true }],
browser: [async ({ playwright, browserName, _browserOptions, connectOptions }, use, testInfo) => {
if (!["chromium", "firefox", "webkit", "_bidiChromium", "_bidiFirefox"].includes(browserName))
throw new Error(`Unexpected browserName "${browserName}", must be one of "chromium", "firefox" or "webkit"`);
if (connectOptions) {
const browser2 = await playwright[browserName].connect({
...connectOptions,
exposeNetwork: connectOptions.exposeNetwork ?? connectOptions._exposeNetwork,
headers: {
// HTTP headers are ASCII only (not UTF-8).
"x-playwright-launch-options": (0, import_utils.jsonStringifyForceASCII)(_browserOptions),
...connectOptions.headers
}
});
await use(browser2);
await browser2.close({ reason: "Test ended." });
return;
}
const browser = await playwright[browserName].launch();
await use(browser);
await browser.close({ reason: "Test ended." });
}, { scope: "worker", timeout: 0 }],
acceptDownloads: [({ contextOptions }, use) => use(contextOptions.acceptDownloads ?? true), { option: true, box: true }],
bypassCSP: [({ contextOptions }, use) => use(contextOptions.bypassCSP ?? false), { option: true, box: true }],
colorScheme: [({ contextOptions }, use) => use(contextOptions.colorScheme === void 0 ? "light" : contextOptions.colorScheme), { option: true, box: true }],
deviceScaleFactor: [({ contextOptions }, use) => use(contextOptions.deviceScaleFactor), { option: true, box: true }],
extraHTTPHeaders: [({ contextOptions }, use) => use(contextOptions.extraHTTPHeaders), { option: true, box: true }],
geolocation: [({ contextOptions }, use) => use(contextOptions.geolocation), { option: true, box: true }],
hasTouch: [({ contextOptions }, use) => use(contextOptions.hasTouch ?? false), { option: true, box: true }],
httpCredentials: [({ contextOptions }, use) => use(contextOptions.httpCredentials), { option: true, box: true }],
ignoreHTTPSErrors: [({ contextOptions }, use) => use(contextOptions.ignoreHTTPSErrors ?? false), { option: true, box: true }],
isMobile: [({ contextOptions }, use) => use(contextOptions.isMobile ?? false), { option: true, box: true }],
javaScriptEnabled: [({ contextOptions }, use) => use(contextOptions.javaScriptEnabled ?? true), { option: true, box: true }],
locale: [({ contextOptions }, use) => use(contextOptions.locale ?? "en-US"), { option: true, box: true }],
offline: [({ contextOptions }, use) => use(contextOptions.offline ?? false), { option: true, box: true }],
permissions: [({ contextOptions }, use) => use(contextOptions.permissions), { option: true, box: true }],
proxy: [({ contextOptions }, use) => use(contextOptions.proxy), { option: true, box: true }],
storageState: [({ contextOptions }, use) => use(contextOptions.storageState), { option: true, box: true }],
clientCertificates: [({ contextOptions }, use) => use(contextOptions.clientCertificates), { option: true, box: true }],
timezoneId: [({ contextOptions }, use) => use(contextOptions.timezoneId), { option: true, box: true }],
userAgent: [({ contextOptions }, use) => use(contextOptions.userAgent), { option: true, box: true }],
viewport: [({ contextOptions }, use) => use(contextOptions.viewport === void 0 ? { width: 1280, height: 720 } : contextOptions.viewport), { option: true, box: true }],
actionTimeout: [0, { option: true, box: true }],
testIdAttribute: ["data-testid", { option: true, box: true }],
navigationTimeout: [0, { option: true, box: true }],
baseURL: [async ({}, use) => {
await use(process.env.PLAYWRIGHT_TEST_BASE_URL);
}, { option: true, box: true }],
serviceWorkers: [({ contextOptions }, use) => use(contextOptions.serviceWorkers ?? "allow"), { option: true, box: true }],
contextOptions: [{}, { option: true, box: true }],
_combinedContextOptions: [async ({
acceptDownloads,
bypassCSP,
clientCertificates,
colorScheme,
deviceScaleFactor,
extraHTTPHeaders,
hasTouch,
geolocation,
httpCredentials,
ignoreHTTPSErrors,
isMobile,
javaScriptEnabled,
locale,
offline,
permissions,
proxy,
storageState,
viewport,
timezoneId,
userAgent,
baseURL,
contextOptions,
serviceWorkers
}, use) => {
const options = {};
if (acceptDownloads !== void 0)
options.acceptDownloads = acceptDownloads;
if (bypassCSP !== void 0)
options.bypassCSP = bypassCSP;
if (colorScheme !== void 0)
options.colorScheme = colorScheme;
if (deviceScaleFactor !== void 0)
options.deviceScaleFactor = deviceScaleFactor;
if (extraHTTPHeaders !== void 0)
options.extraHTTPHeaders = extraHTTPHeaders;
if (geolocation !== void 0)
options.geolocation = geolocation;
if (hasTouch !== void 0)
options.hasTouch = hasTouch;
if (httpCredentials !== void 0)
options.httpCredentials = httpCredentials;
if (ignoreHTTPSErrors !== void 0)
options.ignoreHTTPSErrors = ignoreHTTPSErrors;
if (isMobile !== void 0)
options.isMobile = isMobile;
if (javaScriptEnabled !== void 0)
options.javaScriptEnabled = javaScriptEnabled;
if (locale !== void 0)
options.locale = locale;
if (offline !== void 0)
options.offline = offline;
if (permissions !== void 0)
options.permissions = permissions;
if (proxy !== void 0)
options.proxy = proxy;
if (storageState !== void 0)
options.storageState = storageState;
if (clientCertificates?.length)
options.clientCertificates = resolveClientCerticates(clientCertificates);
if (timezoneId !== void 0)
options.timezoneId = timezoneId;
if (userAgent !== void 0)
options.userAgent = userAgent;
if (viewport !== void 0)
options.viewport = viewport;
if (baseURL !== void 0)
options.baseURL = baseURL;
if (serviceWorkers !== void 0)
options.serviceWorkers = serviceWorkers;
await use({
...contextOptions,
...options
});
}, { box: true }],
_setupContextOptions: [async ({ playwright, _combinedContextOptions, actionTimeout, navigationTimeout, testIdAttribute }, use, testInfo) => {
if (testIdAttribute)
playwrightLibrary.selectors.setTestIdAttribute(testIdAttribute);
testInfo.snapshotSuffix = process.platform;
if ((0, import_utils.debugMode)() === "inspector")
testInfo._setDebugMode();
playwright._defaultContextOptions = _combinedContextOptions;
playwright._defaultContextTimeout = actionTimeout || 0;
playwright._defaultContextNavigationTimeout = navigationTimeout || 0;
await use();
playwright._defaultContextOptions = void 0;
playwright._defaultContextTimeout = void 0;
playwright._defaultContextNavigationTimeout = void 0;
}, { auto: "all-hooks-included", title: "context configuration", box: true }],
_setupArtifacts: [async ({ playwright, screenshot }, use, testInfo) => {
testInfo.setTimeout(testInfo.project.timeout);
const artifactsRecorder = new ArtifactsRecorder(playwright, tracing().artifactsDir(), screenshot);
await artifactsRecorder.willStartTest(testInfo);
const tracingGroupSteps = [];
const csiListener = {
onApiCallBegin: (data, channel) => {
const testInfo2 = (0, import_globals.currentTestInfo)();
if (!testInfo2 || data.apiName.includes("setTestIdAttribute") || data.apiName === "tracing.groupEnd")
return;
const zone = (0, import_utils.currentZone)().data("stepZone");
if (zone && zone.category === "expect") {
if (zone.apiName)
data.apiName = zone.apiName;
if (zone.title)
data.title = zone.title;
data.stepId = zone.stepId;
return;
}
const step = testInfo2._addStep({
location: data.frames[0],
category: "pw:api",
title: renderTitle(channel.type, channel.method, channel.params, data.title),
apiName: data.apiName,
params: channel.params,
group: (0, import_utils.getActionGroup)({ type: channel.type, method: channel.method })
}, tracingGroupSteps[tracingGroupSteps.length - 1]);
data.userData = step;
data.stepId = step.stepId;
if (data.apiName === "tracing.group")
tracingGroupSteps.push(step);
},
onApiCallRecovery: (data, error, recoveryHandlers) => {
const step = data.userData;
if (step)
recoveryHandlers.push(() => step.recoverFromStepError(error));
},
onApiCallEnd: (data) => {
if (data.apiName === "tracing.group")
return;
if (data.apiName === "tracing.groupEnd") {
const step2 = tracingGroupSteps.pop();
step2?.complete({ error: data.error });
return;
}
const step = data.userData;
step?.complete({ error: data.error });
},
onWillPause: ({ keepTestTimeout }) => {
if (!keepTestTimeout)
(0, import_globals.currentTestInfo)()?._setDebugMode();
},
runAfterCreateBrowserContext: async (context) => {
await artifactsRecorder?.didCreateBrowserContext(context);
const testInfo2 = (0, import_globals.currentTestInfo)();
if (testInfo2)
attachConnectedHeaderIfNeeded(testInfo2, context.browser());
},
runAfterCreateRequestContext: async (context) => {
await artifactsRecorder?.didCreateRequestContext(context);
},
runBeforeCloseBrowserContext: async (context) => {
await artifactsRecorder?.willCloseBrowserContext(context);
},
runBeforeCloseRequestContext: async (context) => {
await artifactsRecorder?.willCloseRequestContext(context);
}
};
const clientInstrumentation = playwright._instrumentation;
clientInstrumentation.addListener(csiListener);
await use();
clientInstrumentation.removeListener(csiListener);
await artifactsRecorder.didFinishTest();
}, { auto: "all-hooks-included", title: "trace recording", box: true, timeout: 0 }],
_contextFactory: [async ({
browser,
video,
_reuseContext,
_combinedContextOptions
/** mitigate dep-via-auto lack of traceability */
}, use, testInfo) => {
const testInfoImpl = testInfo;
const videoMode = normalizeVideoMode(video);
const captureVideo = shouldCaptureVideo(videoMode, testInfo) && !_reuseContext;
const contexts = /* @__PURE__ */ new Map();
let counter = 0;
await use(async (options) => {
const hook = testInfoImpl._currentHookType();
if (hook === "beforeAll" || hook === "afterAll") {
throw new Error([
`"context" and "page" fixtures are not supported in "${hook}" since they are created on a per-test basis.`,
`If you would like to reuse a single page between tests, create context manually with browser.newContext(). See https://aka.ms/playwright/reuse-page for details.`,
`If you would like to configure your page before each test, do that in beforeEach hook instead.`
].join("\n"));
}
const videoOptions = captureVideo ? {
recordVideo: {
dir: tracing().artifactsDir(),
size: typeof video === "string" ? void 0 : video.size
}
} : {};
const context = await browser.newContext({ ...videoOptions, ...options });
if (process.env.PW_CLOCK === "frozen") {
await context._wrapApiCall(async () => {
await context.clock.install({ time: 0 });
await context.clock.pauseAt(1e3);
}, { internal: true });
} else if (process.env.PW_CLOCK === "realtime") {
await context._wrapApiCall(async () => {
await context.clock.install({ time: 0 });
}, { internal: true });
}
let closed = false;
const close = async () => {
if (closed)
return;
closed = true;
const closeReason = testInfo.status === "timedOut" ? "Test timeout of " + testInfo.timeout + "ms exceeded." : "Test ended.";
await context.close({ reason: closeReason });
const testFailed = testInfo.status !== testInfo.expectedStatus;
const preserveVideo = captureVideo && (videoMode === "on" || testFailed && videoMode === "retain-on-failure" || videoMode === "on-first-retry" && testInfo.retry === 1);
if (preserveVideo) {
const { pagesWithVideo: pagesForVideo } = contexts.get(context);
const videos = pagesForVideo.map((p) => p.video()).filter((video2) => !!video2);
await Promise.all(videos.map(async (v) => {
try {
const savedPath = testInfo.outputPath(`video${counter ? "-" + counter : ""}.webm`);
++counter;
await v.saveAs(savedPath);
testInfo.attachments.push({ name: "video", path: savedPath, contentType: "video/webm" });
} catch (e) {
}
}));
}
};
const contextData = { close, pagesWithVideo: [] };
if (captureVideo)
context.on("page", (page) => contextData.pagesWithVideo.push(page));
contexts.set(context, contextData);
return { context, close };
});
await Promise.all([...contexts.values()].map((data) => data.close()));
}, { scope: "test", title: "context", box: true }],
_optionContextReuseMode: ["none", { scope: "worker", option: true, box: true }],
_optionConnectOptions: [void 0, { scope: "worker", option: true, box: true }],
_reuseContext: [async ({ video, _optionContextReuseMode }, use) => {
let mode = _optionContextReuseMode;
if (process.env.PW_TEST_REUSE_CONTEXT)
mode = "when-possible";
const reuse = mode === "when-possible" && normalizeVideoMode(video) === "off";
await use(reuse);
}, { scope: "worker", title: "context", box: true }],
context: async ({ browser, _reuseContext, _contextFactory }, use, testInfo) => {
const browserImpl = browser;
attachConnectedHeaderIfNeeded(testInfo, browserImpl);
if (!_reuseContext) {
const { context: context2, close } = await _contextFactory();
await use(context2);
await close();
return;
}
const context = await browserImpl._wrapApiCall(() => browserImpl._newContextForReuse(), { internal: true });
await use(context);
const closeReason = testInfo.status === "timedOut" ? "Test timeout of " + testInfo.timeout + "ms exceeded." : "Test ended.";
await browserImpl._wrapApiCall(() => browserImpl._disconnectFromReusedContext(closeReason), { internal: true });
},
page: async ({ context, _reuseContext }, use) => {
if (!_reuseContext) {
await use(await context.newPage());
return;
}
let [page] = context.pages();
if (!page)
page = await context.newPage();
await use(page);
},
request: async ({ playwright }, use) => {
const request = await playwright.request.newContext();
await use(request);
const hook = test.info()._currentHookType();
if (hook === "beforeAll") {
await request.dispose({ reason: [
`Fixture { request } from beforeAll cannot be reused in a test.`,
` - Recommended fix: use a separate { request } in the test.`,
` - Alternatively, manually create APIRequestContext in beforeAll and dispose it in afterAll.`,
`See https://playwright.dev/docs/api-testing#sending-api-requests-from-ui-tests for more details.`
].join("\n") });
} else {
await request.dispose();
}
}
};
function normalizeVideoMode(video) {
if (!video)
return "off";
let videoMode = typeof video === "string" ? video : video.mode;
if (videoMode === "retry-with-video")
videoMode = "on-first-retry";
return videoMode;
}
function shouldCaptureVideo(videoMode, testInfo) {
return videoMode === "on" || videoMode === "retain-on-failure" || videoMode === "on-first-retry" && testInfo.retry === 1;
}
function normalizeScreenshotMode(screenshot) {
if (!screenshot)
return "off";
return typeof screenshot === "string" ? screenshot : screenshot.mode;
}
function attachConnectedHeaderIfNeeded(testInfo, browser) {
const connectHeaders = browser?._connection.headers;
if (!connectHeaders)
return;
for (const header of connectHeaders) {
if (header.name !== "x-playwright-attachment")
continue;
const [name, value] = header.value.split("=");
if (!name || !value)
continue;
if (testInfo.attachments.some((attachment) => attachment.name === name))
continue;
testInfo.attachments.push({ name, contentType: "text/plain", body: Buffer.from(value) });
}
}
function resolveFileToConfig(file) {
const config = test.info().config.configFile;
if (!config || !file)
return file;
if (import_path.default.isAbsolute(file))
return file;
return import_path.default.resolve(import_path.default.dirname(config), file);
}
function resolveClientCerticates(clientCertificates) {
for (const cert of clientCertificates) {
cert.certPath = resolveFileToConfig(cert.certPath);
cert.keyPath = resolveFileToConfig(cert.keyPath);
cert.pfxPath = resolveFileToConfig(cert.pfxPath);
}
return clientCertificates;
}
const kTracingStarted = Symbol("kTracingStarted");
function connectOptionsFromEnv() {
const wsEndpoint = process.env.PW_TEST_CONNECT_WS_ENDPOINT;
if (!wsEndpoint)
return void 0;
const headers = process.env.PW_TEST_CONNECT_HEADERS ? JSON.parse(process.env.PW_TEST_CONNECT_HEADERS) : void 0;
return {
wsEndpoint,
headers,
exposeNetwork: process.env.PW_TEST_CONNECT_EXPOSE_NETWORK
};
}
class SnapshotRecorder {
constructor(_artifactsRecorder, _mode, _name, _contentType, _extension, _doSnapshot) {
this._artifactsRecorder = _artifactsRecorder;
this._mode = _mode;
this._name = _name;
this._contentType = _contentType;
this._extension = _extension;
this._doSnapshot = _doSnapshot;
this._ordinal = 0;
this._temporary = [];
}
fixOrdinal() {
this._ordinal = this.testInfo.attachments.filter((a) => a.name === this._name).length;
}
shouldCaptureUponFinish() {
return this._mode === "on" || this._mode === "only-on-failure" && this.testInfo._isFailure() || this._mode === "on-first-failure" && this.testInfo._isFailure() && this.testInfo.retry === 0;
}
async maybeCapture() {
if (!this.shouldCaptureUponFinish())
return;
await Promise.all(this._artifactsRecorder._playwright._allPages().map((page) => this._snapshotPage(page, false)));
}
async persistTemporary() {
if (this.shouldCaptureUponFinish()) {
await Promise.all(this._temporary.map(async (file) => {
try {
const path2 = this._createAttachmentPath();
await import_fs.default.promises.rename(file, path2);
this._attach(path2);
} catch {
}
}));
}
}
async captureTemporary(context) {
if (this._mode === "on" || this._mode === "only-on-failure" || this._mode === "on-first-failure" && this.testInfo.retry === 0)
await Promise.all(context.pages().map((page) => this._snapshotPage(page, true)));
}
_attach(screenshotPath) {
this.testInfo.attachments.push({ name: this._name, path: screenshotPath, contentType: this._contentType });
}
_createAttachmentPath() {
const testFailed = this.testInfo._isFailure();
const index = this._ordinal + 1;
++this._ordinal;
const path2 = this.testInfo.outputPath(`test-${testFailed ? "failed" : "finished"}-${index}${this._extension}`);
return path2;
}
_createTemporaryArtifact(...name) {
const file = import_path.default.join(this._artifactsRecorder._artifactsDir, ...name);
return file;
}
async _snapshotPage(page, temporary) {
if (page[this.testInfo._uniqueSymbol])
return;
page[this.testInfo._uniqueSymbol] = true;
try {
const path2 = temporary ? this._createTemporaryArtifact((0, import_utils.createGuid)() + this._extension) : this._createAttachmentPath();
await this._doSnapshot(page, path2);
if (temporary)
this._temporary.push(path2);
else
this._attach(path2);
} catch {
}
}
get testInfo() {
return this._artifactsRecorder._testInfo;
}
}
class ArtifactsRecorder {
constructor(playwright, artifactsDir, screenshot) {
this._playwright = playwright;
this._artifactsDir = artifactsDir;
const screenshotOptions = typeof screenshot === "string" ? void 0 : screenshot;
this._startedCollectingArtifacts = Symbol("startedCollectingArtifacts");
this._screenshotRecorder = new SnapshotRecorder(this, normalizeScreenshotMode(screenshot), "screenshot", "image/png", ".png", async (page, path2) => {
await page._wrapApiCall(async () => {
await page.screenshot({ ...screenshotOptions, timeout: 5e3, path: path2, caret: "initial" });
}, { internal: true });
});
}
async willStartTest(testInfo) {
this._testInfo = testInfo;
testInfo._onDidFinishTestFunction = () => this.didFinishTestFunction();
this._screenshotRecorder.fixOrdinal();
await Promise.all(this._playwright._allContexts().map((context) => this.didCreateBrowserContext(context)));
const existingApiRequests = Array.from(this._playwright.request._contexts);
await Promise.all(existingApiRequests.map((c) => this.didCreateRequestContext(c)));
}
async didCreateBrowserContext(context) {
await this._startTraceChunkOnContextCreation(context, context.tracing);
}
async willCloseBrowserContext(context) {
await this._stopTracing(context, context.tracing);
await this._screenshotRecorder.captureTemporary(context);
await this._takePageSnapshot(context);
}
async _takePageSnapshot(context) {
if (process.env.PLAYWRIGHT_NO_COPY_PROMPT)
return;
if (this._testInfo.errors.length === 0)
return;
if (this._pageSnapshot)
return;
const page = context.pages()[0];
if (!page)
return;
try {
await page._wrapApiCall(async () => {
this._pageSnapshot = await page._snapshotForAI({ timeout: 5e3 });
}, { internal: true });
} catch {
}
}
async didCreateRequestContext(context) {
await this._startTraceChunkOnContextCreation(context, context._tracing);
}
async willCloseRequestContext(context) {
await this._stopTracing(context, context._tracing);
}
async didFinishTestFunction() {
await this._screenshotRecorder.maybeCapture();
}
async didFinishTest() {
await this.didFinishTestFunction();
const leftoverContexts = this._playwright._allContexts();
const leftoverApiRequests = Array.from(this._playwright.request._contexts);
await Promise.all(leftoverContexts.map(async (context2) => {
await this._stopTracing(context2, context2.tracing);
}).concat(leftoverApiRequests.map(async (context2) => {
await this._stopTracing(context2, context2._tracing);
})));
await this._screenshotRecorder.persistTemporary();
const context = leftoverContexts[0];
if (context)
await this._takePageSnapshot(context);
if (this._pageSnapshot && this._testInfo.errors.length > 0 && !this._testInfo.attachments.some((a) => a.name === "error-context")) {
const lines = [
"# Page snapshot",
"",
"```yaml",
this._pageSnapshot,
"```"
];
const filePath = this._testInfo.outputPath("error-context.md");
await import_fs.default.promises.writeFile(filePath, lines.join("\n"), "utf8");
this._testInfo._attach({
name: "error-context",
contentType: "text/markdown",
path: filePath
}, void 0);
}
}
async _startTraceChunkOnContextCreation(channelOwner, tracing2) {
await channelOwner._wrapApiCall(async () => {
const options = this._testInfo._tracing.traceOptions();
if (options) {
const title = this._testInfo._tracing.traceTitle();
const name = this._testInfo._tracing.generateNextTraceRecordingName();
if (!tracing2[kTracingStarted]) {
await tracing2.start({ ...options, title, name });
tracing2[kTracingStarted] = true;
} else {
await tracing2.startChunk({ title, name });
}
} else {
if (tracing2[kTracingStarted]) {
tracing2[kTracingStarted] = false;
await tracing2.stop();
}
}
}, { internal: true });
}
async _stopTracing(channelOwner, tracing2) {
await channelOwner._wrapApiCall(async () => {
if (tracing2[this._startedCollectingArtifacts])
return;
tracing2[this._startedCollectingArtifacts] = true;
if (this._testInfo._tracing.traceOptions() && tracing2[kTracingStarted])
await tracing2.stopChunk({ path: this._testInfo._tracing.maybeGenerateNextTraceRecordingPath() });
}, { internal: true });
}
}
function renderTitle(type, method, params, title) {
const prefix = (0, import_utils.renderTitleForCall)({ title, type, method, params });
let selector;
if (params?.["selector"] && typeof params.selector === "string")
selector = (0, import_utils.asLocatorDescription)("javascript", params.selector);
return prefix + (selector ? ` ${selector}` : "");
}
function tracing() {
return test.info()._tracing;
}
const test = _baseTest.extend(playwrightFixtures);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
_baseTest,
defineConfig,
expect,
mergeExpects,
mergeTests,
test
});
+42
View File
@@ -0,0 +1,42 @@
"use strict";
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 __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);
var internalsForTest_exports = {};
__export(internalsForTest_exports, {
fileDependencies: () => fileDependencies
});
module.exports = __toCommonJS(internalsForTest_exports);
var import_path = __toESM(require("path"));
var import_compilationCache = require("./transform/compilationCache");
function fileDependencies() {
return Object.fromEntries([...(0, import_compilationCache.fileDependenciesForTest)().entries()].map((entry) => [import_path.default.basename(entry[0]), [...entry[1]].map((f) => import_path.default.basename(f)).sort()]));
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
fileDependencies
});
+77
View File
@@ -0,0 +1,77 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var events_exports = {};
__export(events_exports, {
Disposable: () => Disposable,
EventEmitter: () => EventEmitter
});
module.exports = __toCommonJS(events_exports);
var Disposable;
((Disposable2) => {
function disposeAll(disposables) {
for (const disposable of disposables.splice(0))
disposable.dispose();
}
Disposable2.disposeAll = disposeAll;
})(Disposable || (Disposable = {}));
class EventEmitter {
constructor() {
this._listeners = /* @__PURE__ */ new Set();
this.event = (listener, disposables) => {
this._listeners.add(listener);
let disposed = false;
const self = this;
const result = {
dispose() {
if (!disposed) {
disposed = true;
self._listeners.delete(listener);
}
}
};
if (disposables)
disposables.push(result);
return result;
};
}
fire(event) {
const dispatch = !this._deliveryQueue;
if (!this._deliveryQueue)
this._deliveryQueue = [];
for (const listener of this._listeners)
this._deliveryQueue.push({ listener, event });
if (!dispatch)
return;
for (let index = 0; index < this._deliveryQueue.length; index++) {
const { listener, event: event2 } = this._deliveryQueue[index];
listener.call(null, event2);
}
this._deliveryQueue = void 0;
}
dispose() {
this._listeners.clear();
if (this._deliveryQueue)
this._deliveryQueue = [];
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Disposable,
EventEmitter
});
+30
View File
@@ -0,0 +1,30 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var folders_exports = {};
__export(folders_exports, {
artifactsFolderName: () => artifactsFolderName
});
module.exports = __toCommonJS(folders_exports);
function artifactsFolderName(workerIndex) {
return `.playwright-artifacts-${workerIndex}`;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
artifactsFolderName
});
+69
View File
@@ -0,0 +1,69 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var stringInternPool_exports = {};
__export(stringInternPool_exports, {
JsonStringInternalizer: () => JsonStringInternalizer,
StringInternPool: () => StringInternPool
});
module.exports = __toCommonJS(stringInternPool_exports);
class StringInternPool {
constructor() {
this._stringCache = /* @__PURE__ */ new Map();
}
internString(s) {
let result = this._stringCache.get(s);
if (!result) {
this._stringCache.set(s, s);
result = s;
}
return result;
}
}
class JsonStringInternalizer {
constructor(pool) {
this._pool = pool;
}
traverse(value) {
if (typeof value !== "object")
return;
if (Array.isArray(value)) {
for (let i = 0; i < value.length; i++) {
if (typeof value[i] === "string")
value[i] = this.intern(value[i]);
else
this.traverse(value[i]);
}
} else {
for (const name in value) {
if (typeof value[name] === "string")
value[name] = this.intern(value[name]);
else
this.traverse(value[name]);
}
}
}
intern(value) {
return this._pool.internString(value);
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
JsonStringInternalizer,
StringInternPool
});
+507
View File
@@ -0,0 +1,507 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var teleReceiver_exports = {};
__export(teleReceiver_exports, {
TeleReporterReceiver: () => TeleReporterReceiver,
TeleSuite: () => TeleSuite,
TeleTestCase: () => TeleTestCase,
TeleTestResult: () => TeleTestResult,
baseFullConfig: () => baseFullConfig,
computeTestCaseOutcome: () => computeTestCaseOutcome,
parseRegexPatterns: () => parseRegexPatterns,
serializeRegexPatterns: () => serializeRegexPatterns
});
module.exports = __toCommonJS(teleReceiver_exports);
class TeleReporterReceiver {
constructor(reporter, options = {}) {
this.isListing = false;
this._tests = /* @__PURE__ */ new Map();
this._rootSuite = new TeleSuite("", "root");
this._options = options;
this._reporter = reporter;
}
reset() {
this._rootSuite._entries = [];
this._tests.clear();
}
dispatch(message) {
const { method, params } = message;
if (method === "onConfigure") {
this._onConfigure(params.config);
return;
}
if (method === "onProject") {
this._onProject(params.project);
return;
}
if (method === "onBegin") {
this._onBegin();
return;
}
if (method === "onTestBegin") {
this._onTestBegin(params.testId, params.result);
return;
}
if (method === "onTestEnd") {
this._onTestEnd(params.test, params.result);
return;
}
if (method === "onStepBegin") {
this._onStepBegin(params.testId, params.resultId, params.step);
return;
}
if (method === "onAttach") {
this._onAttach(params.testId, params.resultId, params.attachments);
return;
}
if (method === "onStepEnd") {
this._onStepEnd(params.testId, params.resultId, params.step);
return;
}
if (method === "onError") {
this._onError(params.error);
return;
}
if (method === "onStdIO") {
this._onStdIO(params.type, params.testId, params.resultId, params.data, params.isBase64);
return;
}
if (method === "onEnd")
return this._onEnd(params.result);
if (method === "onExit")
return this._onExit();
}
_onConfigure(config) {
this._rootDir = config.rootDir;
this._config = this._parseConfig(config);
this._reporter.onConfigure?.(this._config);
}
_onProject(project) {
let projectSuite = this._options.mergeProjects ? this._rootSuite.suites.find((suite) => suite.project().name === project.name) : void 0;
if (!projectSuite) {
projectSuite = new TeleSuite(project.name, "project");
this._rootSuite._addSuite(projectSuite);
}
projectSuite._project = this._parseProject(project);
for (const suite of project.suites)
this._mergeSuiteInto(suite, projectSuite);
}
_onBegin() {
this._reporter.onBegin?.(this._rootSuite);
}
_onTestBegin(testId, payload) {
const test = this._tests.get(testId);
if (this._options.clearPreviousResultsWhenTestBegins)
test.results = [];
const testResult = test._createTestResult(payload.id);
testResult.retry = payload.retry;
testResult.workerIndex = payload.workerIndex;
testResult.parallelIndex = payload.parallelIndex;
testResult.setStartTimeNumber(payload.startTime);
this._reporter.onTestBegin?.(test, testResult);
}
_onTestEnd(testEndPayload, payload) {
const test = this._tests.get(testEndPayload.testId);
test.timeout = testEndPayload.timeout;
test.expectedStatus = testEndPayload.expectedStatus;
const result = test.results.find((r) => r._id === payload.id);
result.duration = payload.duration;
result.status = payload.status;
result.errors = payload.errors;
result.error = result.errors?.[0];
if (!!payload.attachments)
result.attachments = this._parseAttachments(payload.attachments);
if (payload.annotations) {
this._absoluteAnnotationLocationsInplace(payload.annotations);
result.annotations = payload.annotations;
test.annotations = payload.annotations;
}
this._reporter.onTestEnd?.(test, result);
result._stepMap = /* @__PURE__ */ new Map();
}
_onStepBegin(testId, resultId, payload) {
const test = this._tests.get(testId);
const result = test.results.find((r) => r._id === resultId);
const parentStep = payload.parentStepId ? result._stepMap.get(payload.parentStepId) : void 0;
const location = this._absoluteLocation(payload.location);
const step = new TeleTestStep(payload, parentStep, location, result);
if (parentStep)
parentStep.steps.push(step);
else
result.steps.push(step);
result._stepMap.set(payload.id, step);
this._reporter.onStepBegin?.(test, result, step);
}
_onStepEnd(testId, resultId, payload) {
const test = this._tests.get(testId);
const result = test.results.find((r) => r._id === resultId);
const step = result._stepMap.get(payload.id);
step._endPayload = payload;
step.duration = payload.duration;
step.error = payload.error;
this._reporter.onStepEnd?.(test, result, step);
}
_onAttach(testId, resultId, attachments) {
const test = this._tests.get(testId);
const result = test.results.find((r) => r._id === resultId);
result.attachments.push(...attachments.map((a) => ({
name: a.name,
contentType: a.contentType,
path: a.path,
body: a.base64 && globalThis.Buffer ? Buffer.from(a.base64, "base64") : void 0
})));
}
_onError(error) {
this._reporter.onError?.(error);
}
_onStdIO(type, testId, resultId, data, isBase64) {
const chunk = isBase64 ? globalThis.Buffer ? Buffer.from(data, "base64") : atob(data) : data;
const test = testId ? this._tests.get(testId) : void 0;
const result = test && resultId ? test.results.find((r) => r._id === resultId) : void 0;
if (type === "stdout") {
result?.stdout.push(chunk);
this._reporter.onStdOut?.(chunk, test, result);
} else {
result?.stderr.push(chunk);
this._reporter.onStdErr?.(chunk, test, result);
}
}
async _onEnd(result) {
await this._reporter.onEnd?.({
status: result.status,
startTime: new Date(result.startTime),
duration: result.duration
});
}
_onExit() {
return this._reporter.onExit?.();
}
_parseConfig(config) {
const result = { ...baseFullConfig, ...config };
if (this._options.configOverrides) {
result.configFile = this._options.configOverrides.configFile;
result.reportSlowTests = this._options.configOverrides.reportSlowTests;
result.quiet = this._options.configOverrides.quiet;
result.reporter = [...this._options.configOverrides.reporter];
}
return result;
}
_parseProject(project) {
return {
metadata: project.metadata,
name: project.name,
outputDir: this._absolutePath(project.outputDir),
repeatEach: project.repeatEach,
retries: project.retries,
testDir: this._absolutePath(project.testDir),
testIgnore: parseRegexPatterns(project.testIgnore),
testMatch: parseRegexPatterns(project.testMatch),
timeout: project.timeout,
grep: parseRegexPatterns(project.grep),
grepInvert: parseRegexPatterns(project.grepInvert),
dependencies: project.dependencies,
teardown: project.teardown,
snapshotDir: this._absolutePath(project.snapshotDir),
use: project.use
};
}
_parseAttachments(attachments) {
return attachments.map((a) => {
return {
...a,
body: a.base64 && globalThis.Buffer ? Buffer.from(a.base64, "base64") : void 0
};
});
}
_mergeSuiteInto(jsonSuite, parent) {
let targetSuite = parent.suites.find((s) => s.title === jsonSuite.title);
if (!targetSuite) {
targetSuite = new TeleSuite(jsonSuite.title, parent.type === "project" ? "file" : "describe");
parent._addSuite(targetSuite);
}
targetSuite.location = this._absoluteLocation(jsonSuite.location);
jsonSuite.entries.forEach((e) => {
if ("testId" in e)
this._mergeTestInto(e, targetSuite);
else
this._mergeSuiteInto(e, targetSuite);
});
}
_mergeTestInto(jsonTest, parent) {
let targetTest = this._options.mergeTestCases ? parent.tests.find((s) => s.title === jsonTest.title && s.repeatEachIndex === jsonTest.repeatEachIndex) : void 0;
if (!targetTest) {
targetTest = new TeleTestCase(jsonTest.testId, jsonTest.title, this._absoluteLocation(jsonTest.location), jsonTest.repeatEachIndex);
parent._addTest(targetTest);
this._tests.set(targetTest.id, targetTest);
}
this._updateTest(jsonTest, targetTest);
}
_updateTest(payload, test) {
test.id = payload.testId;
test.location = this._absoluteLocation(payload.location);
test.retries = payload.retries;
test.tags = payload.tags ?? [];
test.annotations = payload.annotations ?? [];
this._absoluteAnnotationLocationsInplace(test.annotations);
return test;
}
_absoluteAnnotationLocationsInplace(annotations) {
for (const annotation of annotations) {
if (annotation.location)
annotation.location = this._absoluteLocation(annotation.location);
}
}
_absoluteLocation(location) {
if (!location)
return location;
return {
...location,
file: this._absolutePath(location.file)
};
}
_absolutePath(relativePath) {
if (relativePath === void 0)
return;
return this._options.resolvePath ? this._options.resolvePath(this._rootDir, relativePath) : this._rootDir + "/" + relativePath;
}
}
class TeleSuite {
constructor(title, type) {
this._entries = [];
this._requireFile = "";
this._parallelMode = "none";
this.title = title;
this._type = type;
}
get type() {
return this._type;
}
get suites() {
return this._entries.filter((e) => e.type !== "test");
}
get tests() {
return this._entries.filter((e) => e.type === "test");
}
entries() {
return this._entries;
}
allTests() {
const result = [];
const visit = (suite) => {
for (const entry of suite.entries()) {
if (entry.type === "test")
result.push(entry);
else
visit(entry);
}
};
visit(this);
return result;
}
titlePath() {
const titlePath = this.parent ? this.parent.titlePath() : [];
if (this.title || this._type !== "describe")
titlePath.push(this.title);
return titlePath;
}
project() {
return this._project ?? this.parent?.project();
}
_addTest(test) {
test.parent = this;
this._entries.push(test);
}
_addSuite(suite) {
suite.parent = this;
this._entries.push(suite);
}
}
class TeleTestCase {
constructor(id, title, location, repeatEachIndex) {
this.fn = () => {
};
this.results = [];
this.type = "test";
this.expectedStatus = "passed";
this.timeout = 0;
this.annotations = [];
this.retries = 0;
this.tags = [];
this.repeatEachIndex = 0;
this.id = id;
this.title = title;
this.location = location;
this.repeatEachIndex = repeatEachIndex;
}
titlePath() {
const titlePath = this.parent ? this.parent.titlePath() : [];
titlePath.push(this.title);
return titlePath;
}
outcome() {
return computeTestCaseOutcome(this);
}
ok() {
const status = this.outcome();
return status === "expected" || status === "flaky" || status === "skipped";
}
_createTestResult(id) {
const result = new TeleTestResult(this.results.length, id);
this.results.push(result);
return result;
}
}
class TeleTestStep {
constructor(payload, parentStep, location, result) {
this.duration = -1;
this.steps = [];
this._startTime = 0;
this.title = payload.title;
this.category = payload.category;
this.location = location;
this.parent = parentStep;
this._startTime = payload.startTime;
this._result = result;
}
titlePath() {
const parentPath = this.parent?.titlePath() || [];
return [...parentPath, this.title];
}
get startTime() {
return new Date(this._startTime);
}
set startTime(value) {
this._startTime = +value;
}
get attachments() {
return this._endPayload?.attachments?.map((index) => this._result.attachments[index]) ?? [];
}
get annotations() {
return this._endPayload?.annotations ?? [];
}
}
class TeleTestResult {
constructor(retry, id) {
this.parallelIndex = -1;
this.workerIndex = -1;
this.duration = -1;
this.stdout = [];
this.stderr = [];
this.attachments = [];
this.annotations = [];
this.status = "skipped";
this.steps = [];
this.errors = [];
this._stepMap = /* @__PURE__ */ new Map();
this._startTime = 0;
this.retry = retry;
this._id = id;
}
setStartTimeNumber(startTime) {
this._startTime = startTime;
}
get startTime() {
return new Date(this._startTime);
}
set startTime(value) {
this._startTime = +value;
}
}
const baseFullConfig = {
forbidOnly: false,
fullyParallel: false,
globalSetup: null,
globalTeardown: null,
globalTimeout: 0,
grep: /.*/,
grepInvert: null,
maxFailures: 0,
metadata: {},
preserveOutput: "always",
projects: [],
reporter: [[process.env.CI ? "dot" : "list"]],
reportSlowTests: {
max: 5,
threshold: 3e5
/* 5 minutes */
},
configFile: "",
rootDir: "",
quiet: false,
shard: null,
updateSnapshots: "missing",
updateSourceMethod: "patch",
version: "",
workers: 0,
webServer: null
};
function serializeRegexPatterns(patterns) {
if (!Array.isArray(patterns))
patterns = [patterns];
return patterns.map((s) => {
if (typeof s === "string")
return { s };
return { r: { source: s.source, flags: s.flags } };
});
}
function parseRegexPatterns(patterns) {
return patterns.map((p) => {
if (p.s !== void 0)
return p.s;
return new RegExp(p.r.source, p.r.flags);
});
}
function computeTestCaseOutcome(test) {
let skipped = 0;
let didNotRun = 0;
let expected = 0;
let interrupted = 0;
let unexpected = 0;
for (const result of test.results) {
if (result.status === "interrupted") {
++interrupted;
} else if (result.status === "skipped" && test.expectedStatus === "skipped") {
++skipped;
} else if (result.status === "skipped") {
++didNotRun;
} else if (result.status === test.expectedStatus) {
++expected;
} else {
++unexpected;
}
}
if (expected === 0 && unexpected === 0)
return "skipped";
if (unexpected === 0)
return "expected";
if (expected === 0 && skipped === 0)
return "unexpected";
return "flaky";
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
TeleReporterReceiver,
TeleSuite,
TeleTestCase,
TeleTestResult,
baseFullConfig,
computeTestCaseOutcome,
parseRegexPatterns,
serializeRegexPatterns
});
+137
View File
@@ -0,0 +1,137 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var teleSuiteUpdater_exports = {};
__export(teleSuiteUpdater_exports, {
TeleSuiteUpdater: () => TeleSuiteUpdater
});
module.exports = __toCommonJS(teleSuiteUpdater_exports);
var import_teleReceiver = require("./teleReceiver");
var import_testTree = require("./testTree");
class TeleSuiteUpdater {
constructor(options) {
this.loadErrors = [];
this.progress = {
total: 0,
passed: 0,
failed: 0,
skipped: 0
};
this._lastRunTestCount = 0;
this._receiver = new import_teleReceiver.TeleReporterReceiver(this._createReporter(), {
mergeProjects: true,
mergeTestCases: true,
resolvePath: (rootDir, relativePath) => rootDir + options.pathSeparator + relativePath,
clearPreviousResultsWhenTestBegins: true
});
this._options = options;
}
_createReporter() {
return {
version: () => "v2",
onConfigure: (c) => {
this.config = c;
this._lastRunReceiver = new import_teleReceiver.TeleReporterReceiver({
version: () => "v2",
onBegin: (suite) => {
this._lastRunTestCount = suite.allTests().length;
this._lastRunReceiver = void 0;
}
}, {
mergeProjects: true,
mergeTestCases: false,
resolvePath: (rootDir, relativePath) => rootDir + this._options.pathSeparator + relativePath
});
},
onBegin: (suite) => {
if (!this.rootSuite)
this.rootSuite = suite;
if (this._testResultsSnapshot) {
for (const test of this.rootSuite.allTests())
test.results = this._testResultsSnapshot?.get(test.id) || test.results;
this._testResultsSnapshot = void 0;
}
this.progress.total = this._lastRunTestCount;
this.progress.passed = 0;
this.progress.failed = 0;
this.progress.skipped = 0;
this._options.onUpdate(true);
},
onEnd: () => {
this._options.onUpdate(true);
},
onTestBegin: (test, testResult) => {
testResult[import_testTree.statusEx] = "running";
this._options.onUpdate();
},
onTestEnd: (test, testResult) => {
if (test.outcome() === "skipped")
++this.progress.skipped;
else if (test.outcome() === "unexpected")
++this.progress.failed;
else
++this.progress.passed;
testResult[import_testTree.statusEx] = testResult.status;
this._options.onUpdate();
},
onError: (error) => this._handleOnError(error),
printsToStdio: () => false
};
}
processGlobalReport(report) {
const receiver = new import_teleReceiver.TeleReporterReceiver({
version: () => "v2",
onConfigure: (c) => {
this.config = c;
},
onError: (error) => this._handleOnError(error)
});
for (const message of report)
void receiver.dispatch(message);
}
processListReport(report) {
const tests = this.rootSuite?.allTests() || [];
this._testResultsSnapshot = new Map(tests.map((test) => [test.id, test.results]));
this._receiver.reset();
for (const message of report)
void this._receiver.dispatch(message);
}
processTestReportEvent(message) {
this._lastRunReceiver?.dispatch(message)?.catch(() => {
});
this._receiver.dispatch(message)?.catch(() => {
});
}
_handleOnError(error) {
this.loadErrors.push(error);
this._options.onError?.(error);
this._options.onUpdate();
}
asModel() {
return {
rootSuite: this.rootSuite || new import_teleReceiver.TeleSuite("", "root"),
config: this.config,
loadErrors: this.loadErrors,
progress: this.progress
};
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
TeleSuiteUpdater
});
+218
View File
@@ -0,0 +1,218 @@
"use strict";
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 __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);
var testServerConnection_exports = {};
__export(testServerConnection_exports, {
TestServerConnection: () => TestServerConnection,
WebSocketTestServerTransport: () => WebSocketTestServerTransport
});
module.exports = __toCommonJS(testServerConnection_exports);
var events = __toESM(require("./events"));
class WebSocketTestServerTransport {
constructor(url) {
this._ws = new WebSocket(url);
}
onmessage(listener) {
this._ws.addEventListener("message", (event) => listener(event.data.toString()));
}
onopen(listener) {
this._ws.addEventListener("open", listener);
}
onerror(listener) {
this._ws.addEventListener("error", listener);
}
onclose(listener) {
this._ws.addEventListener("close", listener);
}
send(data) {
this._ws.send(data);
}
close() {
this._ws.close();
}
}
class TestServerConnection {
constructor(transport) {
this._onCloseEmitter = new events.EventEmitter();
this._onReportEmitter = new events.EventEmitter();
this._onStdioEmitter = new events.EventEmitter();
this._onTestFilesChangedEmitter = new events.EventEmitter();
this._onLoadTraceRequestedEmitter = new events.EventEmitter();
this._onRecoverFromStepErrorEmitter = new events.EventEmitter();
this._lastId = 0;
this._callbacks = /* @__PURE__ */ new Map();
this._isClosed = false;
this.onClose = this._onCloseEmitter.event;
this.onReport = this._onReportEmitter.event;
this.onStdio = this._onStdioEmitter.event;
this.onTestFilesChanged = this._onTestFilesChangedEmitter.event;
this.onLoadTraceRequested = this._onLoadTraceRequestedEmitter.event;
this.onRecoverFromStepError = this._onRecoverFromStepErrorEmitter.event;
this._transport = transport;
this._transport.onmessage((data) => {
const message = JSON.parse(data);
const { id, result, error, method, params } = message;
if (id) {
const callback = this._callbacks.get(id);
if (!callback)
return;
this._callbacks.delete(id);
if (error)
callback.reject(new Error(error));
else
callback.resolve(result);
} else {
this._dispatchEvent(method, params);
}
});
const pingInterval = setInterval(() => this._sendMessage("ping").catch(() => {
}), 3e4);
this._connectedPromise = new Promise((f, r) => {
this._transport.onopen(f);
this._transport.onerror(r);
});
this._transport.onclose(() => {
this._isClosed = true;
this._onCloseEmitter.fire();
clearInterval(pingInterval);
});
}
isClosed() {
return this._isClosed;
}
async _sendMessage(method, params) {
const logForTest = globalThis.__logForTest;
logForTest?.({ method, params });
await this._connectedPromise;
const id = ++this._lastId;
const message = { id, method, params };
this._transport.send(JSON.stringify(message));
return new Promise((resolve, reject) => {
this._callbacks.set(id, { resolve, reject });
});
}
_sendMessageNoReply(method, params) {
this._sendMessage(method, params).catch(() => {
});
}
_dispatchEvent(method, params) {
if (method === "report")
this._onReportEmitter.fire(params);
else if (method === "stdio")
this._onStdioEmitter.fire(params);
else if (method === "testFilesChanged")
this._onTestFilesChangedEmitter.fire(params);
else if (method === "loadTraceRequested")
this._onLoadTraceRequestedEmitter.fire(params);
else if (method === "recoverFromStepError")
this._onRecoverFromStepErrorEmitter.fire(params);
}
async initialize(params) {
await this._sendMessage("initialize", params);
}
async ping(params) {
await this._sendMessage("ping", params);
}
async pingNoReply(params) {
this._sendMessageNoReply("ping", params);
}
async watch(params) {
await this._sendMessage("watch", params);
}
watchNoReply(params) {
this._sendMessageNoReply("watch", params);
}
async open(params) {
await this._sendMessage("open", params);
}
openNoReply(params) {
this._sendMessageNoReply("open", params);
}
async resizeTerminal(params) {
await this._sendMessage("resizeTerminal", params);
}
resizeTerminalNoReply(params) {
this._sendMessageNoReply("resizeTerminal", params);
}
async checkBrowsers(params) {
return await this._sendMessage("checkBrowsers", params);
}
async installBrowsers(params) {
await this._sendMessage("installBrowsers", params);
}
async runGlobalSetup(params) {
return await this._sendMessage("runGlobalSetup", params);
}
async runGlobalTeardown(params) {
return await this._sendMessage("runGlobalTeardown", params);
}
async startDevServer(params) {
return await this._sendMessage("startDevServer", params);
}
async stopDevServer(params) {
return await this._sendMessage("stopDevServer", params);
}
async clearCache(params) {
return await this._sendMessage("clearCache", params);
}
async listFiles(params) {
return await this._sendMessage("listFiles", params);
}
async listTests(params) {
return await this._sendMessage("listTests", params);
}
async runTests(params) {
return await this._sendMessage("runTests", params);
}
async findRelatedTestFiles(params) {
return await this._sendMessage("findRelatedTestFiles", params);
}
async stopTests(params) {
await this._sendMessage("stopTests", params);
}
stopTestsNoReply(params) {
this._sendMessageNoReply("stopTests", params);
}
async closeGracefully(params) {
await this._sendMessage("closeGracefully", params);
}
async resumeAfterStepError(params) {
await this._sendMessage("resumeAfterStepError", params);
}
close() {
try {
this._transport.close();
} catch {
}
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
TestServerConnection,
WebSocketTestServerTransport
});
+16
View File
@@ -0,0 +1,16 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var testServerInterface_exports = {};
module.exports = __toCommonJS(testServerInterface_exports);
+307
View File
@@ -0,0 +1,307 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var testTree_exports = {};
__export(testTree_exports, {
TestTree: () => TestTree,
collectTestIds: () => collectTestIds,
sortAndPropagateStatus: () => sortAndPropagateStatus,
statusEx: () => statusEx
});
module.exports = __toCommonJS(testTree_exports);
class TestTree {
constructor(rootFolder, rootSuite, loadErrors, projectFilters, pathSeparator) {
this._treeItemById = /* @__PURE__ */ new Map();
this._treeItemByTestId = /* @__PURE__ */ new Map();
const filterProjects = projectFilters && [...projectFilters.values()].some(Boolean);
this.pathSeparator = pathSeparator;
this.rootItem = {
kind: "group",
subKind: "folder",
id: rootFolder,
title: "",
location: { file: "", line: 0, column: 0 },
duration: 0,
parent: void 0,
children: [],
status: "none",
hasLoadErrors: false
};
this._treeItemById.set(rootFolder, this.rootItem);
const visitSuite = (project, parentSuite, parentGroup) => {
for (const suite of parentSuite.suites) {
if (!suite.title) {
visitSuite(project, suite, parentGroup);
continue;
}
let group = parentGroup.children.find((item) => item.kind === "group" && item.title === suite.title);
if (!group) {
group = {
kind: "group",
subKind: "describe",
id: "suite:" + parentSuite.titlePath().join("") + "" + suite.title,
// account for anonymous suites
title: suite.title,
location: suite.location,
duration: 0,
parent: parentGroup,
children: [],
status: "none",
hasLoadErrors: false
};
this._addChild(parentGroup, group);
}
visitSuite(project, suite, group);
}
for (const test of parentSuite.tests) {
const title = test.title;
let testCaseItem = parentGroup.children.find((t) => t.kind !== "group" && t.title === title);
if (!testCaseItem) {
testCaseItem = {
kind: "case",
id: "test:" + test.titlePath().join(""),
title,
parent: parentGroup,
children: [],
tests: [],
location: test.location,
duration: 0,
status: "none",
project: void 0,
test: void 0,
tags: test.tags
};
this._addChild(parentGroup, testCaseItem);
}
const result = test.results[0];
let status = "none";
if (result?.[statusEx] === "scheduled")
status = "scheduled";
else if (result?.[statusEx] === "running")
status = "running";
else if (result?.status === "skipped")
status = "skipped";
else if (result?.status === "interrupted")
status = "none";
else if (result && test.outcome() !== "expected")
status = "failed";
else if (result && test.outcome() === "expected")
status = "passed";
testCaseItem.tests.push(test);
const testItem = {
kind: "test",
id: test.id,
title: project.name,
location: test.location,
test,
parent: testCaseItem,
children: [],
status,
duration: test.results.length ? Math.max(0, test.results[0].duration) : 0,
project
};
this._addChild(testCaseItem, testItem);
this._treeItemByTestId.set(test.id, testItem);
testCaseItem.duration = testCaseItem.children.reduce((a, b) => a + b.duration, 0);
}
};
for (const projectSuite of rootSuite?.suites || []) {
if (filterProjects && !projectFilters.get(projectSuite.title))
continue;
for (const fileSuite of projectSuite.suites) {
const fileItem = this._fileItem(fileSuite.location.file.split(pathSeparator), true);
visitSuite(projectSuite.project(), fileSuite, fileItem);
}
}
for (const loadError of loadErrors) {
if (!loadError.location)
continue;
const fileItem = this._fileItem(loadError.location.file.split(pathSeparator), true);
fileItem.hasLoadErrors = true;
}
}
_addChild(parent, child) {
parent.children.push(child);
child.parent = parent;
this._treeItemById.set(child.id, child);
}
filterTree(filterText, statusFilters, runningTestIds) {
const tokens = filterText.trim().toLowerCase().split(" ");
const filtersStatuses = [...statusFilters.values()].some(Boolean);
const filter = (testCase) => {
const titleWithTags = [...testCase.tests[0].titlePath(), ...testCase.tests[0].tags].join(" ").toLowerCase();
if (!tokens.every((token) => titleWithTags.includes(token)) && !testCase.tests.some((t) => runningTestIds?.has(t.id)))
return false;
testCase.children = testCase.children.filter((test) => {
return !filtersStatuses || runningTestIds?.has(test.test.id) || statusFilters.get(test.status);
});
testCase.tests = testCase.children.map((c) => c.test);
return !!testCase.children.length;
};
const visit = (treeItem) => {
const newChildren = [];
for (const child of treeItem.children) {
if (child.kind === "case") {
if (filter(child))
newChildren.push(child);
} else {
visit(child);
if (child.children.length || child.hasLoadErrors)
newChildren.push(child);
}
}
treeItem.children = newChildren;
};
visit(this.rootItem);
}
_fileItem(filePath, isFile) {
if (filePath.length === 0)
return this.rootItem;
const fileName = filePath.join(this.pathSeparator);
const existingFileItem = this._treeItemById.get(fileName);
if (existingFileItem)
return existingFileItem;
const parentFileItem = this._fileItem(filePath.slice(0, filePath.length - 1), false);
const fileItem = {
kind: "group",
subKind: isFile ? "file" : "folder",
id: fileName,
title: filePath[filePath.length - 1],
location: { file: fileName, line: 0, column: 0 },
duration: 0,
parent: parentFileItem,
children: [],
status: "none",
hasLoadErrors: false
};
this._addChild(parentFileItem, fileItem);
return fileItem;
}
sortAndPropagateStatus() {
sortAndPropagateStatus(this.rootItem);
}
flattenForSingleProject() {
const visit = (treeItem) => {
if (treeItem.kind === "case" && treeItem.children.length === 1) {
treeItem.project = treeItem.children[0].project;
treeItem.test = treeItem.children[0].test;
treeItem.children = [];
this._treeItemByTestId.set(treeItem.test.id, treeItem);
} else {
treeItem.children.forEach(visit);
}
};
visit(this.rootItem);
}
shortenRoot() {
let shortRoot = this.rootItem;
while (shortRoot.children.length === 1 && shortRoot.children[0].kind === "group" && shortRoot.children[0].subKind === "folder")
shortRoot = shortRoot.children[0];
shortRoot.location = this.rootItem.location;
this.rootItem = shortRoot;
}
testIds() {
const result = /* @__PURE__ */ new Set();
const visit = (treeItem) => {
if (treeItem.kind === "case")
treeItem.tests.forEach((t) => result.add(t.id));
treeItem.children.forEach(visit);
};
visit(this.rootItem);
return result;
}
fileNames() {
const result = /* @__PURE__ */ new Set();
const visit = (treeItem) => {
if (treeItem.kind === "group" && treeItem.subKind === "file")
result.add(treeItem.id);
else
treeItem.children.forEach(visit);
};
visit(this.rootItem);
return [...result];
}
flatTreeItems() {
const result = [];
const visit = (treeItem) => {
result.push(treeItem);
treeItem.children.forEach(visit);
};
visit(this.rootItem);
return result;
}
treeItemById(id) {
return this._treeItemById.get(id);
}
collectTestIds(treeItem) {
return treeItem ? collectTestIds(treeItem) : /* @__PURE__ */ new Set();
}
}
function sortAndPropagateStatus(treeItem) {
for (const child of treeItem.children)
sortAndPropagateStatus(child);
if (treeItem.kind === "group") {
treeItem.children.sort((a, b) => {
const fc = a.location.file.localeCompare(b.location.file);
return fc || a.location.line - b.location.line;
});
}
let allPassed = treeItem.children.length > 0;
let allSkipped = treeItem.children.length > 0;
let hasFailed = false;
let hasRunning = false;
let hasScheduled = false;
for (const child of treeItem.children) {
allSkipped = allSkipped && child.status === "skipped";
allPassed = allPassed && (child.status === "passed" || child.status === "skipped");
hasFailed = hasFailed || child.status === "failed";
hasRunning = hasRunning || child.status === "running";
hasScheduled = hasScheduled || child.status === "scheduled";
}
if (hasRunning)
treeItem.status = "running";
else if (hasScheduled)
treeItem.status = "scheduled";
else if (hasFailed)
treeItem.status = "failed";
else if (allSkipped)
treeItem.status = "skipped";
else if (allPassed)
treeItem.status = "passed";
}
function collectTestIds(treeItem) {
const testIds = /* @__PURE__ */ new Set();
const visit = (treeItem2) => {
if (treeItem2.kind === "case")
treeItem2.tests.map((t) => t.id).forEach((id) => testIds.add(id));
else if (treeItem2.kind === "test")
testIds.add(treeItem2.id);
else
treeItem2.children?.forEach(visit);
};
visit(treeItem);
return testIds;
}
const statusEx = Symbol("statusEx");
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
TestTree,
collectTestIds,
sortAndPropagateStatus,
statusEx
});
+16
View File
@@ -0,0 +1,16 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var types_d_exports = {};
module.exports = __toCommonJS(types_d_exports);
+59
View File
@@ -0,0 +1,59 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var loaderMain_exports = {};
__export(loaderMain_exports, {
LoaderMain: () => LoaderMain,
create: () => create
});
module.exports = __toCommonJS(loaderMain_exports);
var import_configLoader = require("../common/configLoader");
var import_esmLoaderHost = require("../common/esmLoaderHost");
var import_poolBuilder = require("../common/poolBuilder");
var import_process = require("../common/process");
var import_testLoader = require("../common/testLoader");
var import_compilationCache = require("../transform/compilationCache");
class LoaderMain extends import_process.ProcessRunner {
constructor(serializedConfig) {
super();
this._poolBuilder = import_poolBuilder.PoolBuilder.createForLoader();
this._serializedConfig = serializedConfig;
}
_config() {
if (!this._configPromise)
this._configPromise = (0, import_configLoader.deserializeConfig)(this._serializedConfig);
return this._configPromise;
}
async loadTestFile(params) {
const testErrors = [];
const config = await this._config();
const fileSuite = await (0, import_testLoader.loadTestFile)(params.file, config.config.rootDir, testErrors);
this._poolBuilder.buildPools(fileSuite);
return { fileSuite: fileSuite._deepSerialize(), testErrors };
}
async getCompilationCacheFromLoader() {
await (0, import_esmLoaderHost.incorporateCompilationCache)();
return (0, import_compilationCache.serializeCompilationCache)();
}
}
const create = (config) => new LoaderMain(config);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
LoaderMain,
create
});
+338
View File
@@ -0,0 +1,338 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var expect_exports = {};
__export(expect_exports, {
expect: () => expect,
mergeExpects: () => mergeExpects,
printReceivedStringContainExpectedResult: () => printReceivedStringContainExpectedResult,
printReceivedStringContainExpectedSubstring: () => printReceivedStringContainExpectedSubstring
});
module.exports = __toCommonJS(expect_exports);
var import_utils = require("playwright-core/lib/utils");
var import_matcherHint = require("./matcherHint");
var import_matchers = require("./matchers");
var import_toMatchAriaSnapshot = require("./toMatchAriaSnapshot");
var import_toMatchSnapshot = require("./toMatchSnapshot");
var import_expectBundle = require("../common/expectBundle");
var import_globals = require("../common/globals");
var import_util = require("../util");
var import_testInfo = require("../worker/testInfo");
const printSubstring = (val) => val.replace(/"|\\/g, "\\$&");
const printReceivedStringContainExpectedSubstring = (received, start, length) => (0, import_expectBundle.RECEIVED_COLOR)(
'"' + printSubstring(received.slice(0, start)) + (0, import_expectBundle.INVERTED_COLOR)(printSubstring(received.slice(start, start + length))) + printSubstring(received.slice(start + length)) + '"'
);
const printReceivedStringContainExpectedResult = (received, result) => result === null ? (0, import_expectBundle.printReceived)(received) : printReceivedStringContainExpectedSubstring(
received,
result.index,
result[0].length
);
function createMatchers(actual, info, prefix) {
return new Proxy((0, import_expectBundle.expect)(actual), new ExpectMetaInfoProxyHandler(info, prefix));
}
const userMatchersSymbol = Symbol("userMatchers");
function qualifiedMatcherName(qualifier, matcherName) {
return qualifier.join(":") + "$" + matcherName;
}
function createExpect(info, prefix, userMatchers) {
const expectInstance = new Proxy(import_expectBundle.expect, {
apply: function(target, thisArg, argumentsList) {
const [actual, messageOrOptions] = argumentsList;
const message = (0, import_utils.isString)(messageOrOptions) ? messageOrOptions : messageOrOptions?.message || info.message;
const newInfo = { ...info, message };
if (newInfo.poll) {
if (typeof actual !== "function")
throw new Error("`expect.poll()` accepts only function as a first argument");
newInfo.poll.generator = actual;
}
return createMatchers(actual, newInfo, prefix);
},
get: function(target, property) {
if (property === "configure")
return configure;
if (property === "extend") {
return (matchers) => {
const qualifier = [...prefix, (0, import_utils.createGuid)()];
const wrappedMatchers = {};
for (const [name, matcher] of Object.entries(matchers)) {
wrappedMatchers[name] = wrapPlaywrightMatcherToPassNiceThis(matcher);
const key = qualifiedMatcherName(qualifier, name);
wrappedMatchers[key] = wrappedMatchers[name];
Object.defineProperty(wrappedMatchers[key], "name", { value: name });
}
import_expectBundle.expect.extend(wrappedMatchers);
return createExpect(info, qualifier, { ...userMatchers, ...matchers });
};
}
if (property === "soft") {
return (actual, messageOrOptions) => {
return configure({ soft: true })(actual, messageOrOptions);
};
}
if (property === userMatchersSymbol)
return userMatchers;
if (property === "poll") {
return (actual, messageOrOptions) => {
const poll = (0, import_utils.isString)(messageOrOptions) ? {} : messageOrOptions || {};
return configure({ _poll: poll })(actual, messageOrOptions);
};
}
return import_expectBundle.expect[property];
}
});
const configure = (configuration) => {
const newInfo = { ...info };
if ("message" in configuration)
newInfo.message = configuration.message;
if ("timeout" in configuration)
newInfo.timeout = configuration.timeout;
if ("soft" in configuration)
newInfo.isSoft = configuration.soft;
if ("_poll" in configuration) {
newInfo.poll = configuration._poll ? { ...info.poll, generator: () => {
} } : void 0;
if (typeof configuration._poll === "object") {
newInfo.poll.timeout = configuration._poll.timeout ?? newInfo.poll.timeout;
newInfo.poll.intervals = configuration._poll.intervals ?? newInfo.poll.intervals;
}
}
return createExpect(newInfo, prefix, userMatchers);
};
return expectInstance;
}
let matcherCallContext;
function setMatcherCallContext(context) {
matcherCallContext = context;
}
function takeMatcherCallContext() {
try {
return matcherCallContext;
} finally {
matcherCallContext = void 0;
}
}
const defaultExpectTimeout = 5e3;
function wrapPlaywrightMatcherToPassNiceThis(matcher) {
return function(...args) {
const { isNot, promise, utils } = this;
const context = takeMatcherCallContext();
const timeout = context?.expectInfo.timeout ?? context?.testInfo?._projectInternal?.expect?.timeout ?? defaultExpectTimeout;
const newThis = {
isNot,
promise,
utils,
timeout,
_stepInfo: context?.step
};
newThis.equals = throwUnsupportedExpectMatcherError;
return matcher.call(newThis, ...args);
};
}
function throwUnsupportedExpectMatcherError() {
throw new Error("It looks like you are using custom expect matchers that are not compatible with Playwright. See https://aka.ms/playwright/expect-compatibility");
}
import_expectBundle.expect.setState({ expand: false });
const customAsyncMatchers = {
toBeAttached: import_matchers.toBeAttached,
toBeChecked: import_matchers.toBeChecked,
toBeDisabled: import_matchers.toBeDisabled,
toBeEditable: import_matchers.toBeEditable,
toBeEmpty: import_matchers.toBeEmpty,
toBeEnabled: import_matchers.toBeEnabled,
toBeFocused: import_matchers.toBeFocused,
toBeHidden: import_matchers.toBeHidden,
toBeInViewport: import_matchers.toBeInViewport,
toBeOK: import_matchers.toBeOK,
toBeVisible: import_matchers.toBeVisible,
toContainText: import_matchers.toContainText,
toContainClass: import_matchers.toContainClass,
toHaveAccessibleDescription: import_matchers.toHaveAccessibleDescription,
toHaveAccessibleName: import_matchers.toHaveAccessibleName,
toHaveAccessibleErrorMessage: import_matchers.toHaveAccessibleErrorMessage,
toHaveAttribute: import_matchers.toHaveAttribute,
toHaveClass: import_matchers.toHaveClass,
toHaveCount: import_matchers.toHaveCount,
toHaveCSS: import_matchers.toHaveCSS,
toHaveId: import_matchers.toHaveId,
toHaveJSProperty: import_matchers.toHaveJSProperty,
toHaveRole: import_matchers.toHaveRole,
toHaveText: import_matchers.toHaveText,
toHaveTitle: import_matchers.toHaveTitle,
toHaveURL: import_matchers.toHaveURL,
toHaveValue: import_matchers.toHaveValue,
toHaveValues: import_matchers.toHaveValues,
toHaveScreenshot: import_toMatchSnapshot.toHaveScreenshot,
toMatchAriaSnapshot: import_toMatchAriaSnapshot.toMatchAriaSnapshot,
toPass: import_matchers.toPass
};
const customMatchers = {
...customAsyncMatchers,
toMatchSnapshot: import_toMatchSnapshot.toMatchSnapshot
};
class ExpectMetaInfoProxyHandler {
constructor(info, prefix) {
this._info = { ...info };
this._prefix = prefix;
}
get(target, matcherName, receiver) {
let matcher = Reflect.get(target, matcherName, receiver);
if (typeof matcherName !== "string")
return matcher;
let resolvedMatcherName = matcherName;
for (let i = this._prefix.length; i > 0; i--) {
const qualifiedName = qualifiedMatcherName(this._prefix.slice(0, i), matcherName);
if (Reflect.has(target, qualifiedName)) {
matcher = Reflect.get(target, qualifiedName, receiver);
resolvedMatcherName = qualifiedName;
break;
}
}
if (matcher === void 0)
throw new Error(`expect: Property '${matcherName}' not found.`);
if (typeof matcher !== "function") {
if (matcherName === "not")
this._info.isNot = !this._info.isNot;
return new Proxy(matcher, this);
}
if (this._info.poll) {
if (customAsyncMatchers[matcherName] || matcherName === "resolves" || matcherName === "rejects")
throw new Error(`\`expect.poll()\` does not support "${matcherName}" matcher.`);
matcher = (...args) => pollMatcher(resolvedMatcherName, this._info, this._prefix, ...args);
}
return (...args) => {
const testInfo = (0, import_globals.currentTestInfo)();
setMatcherCallContext({ expectInfo: this._info, testInfo });
if (!testInfo)
return matcher.call(target, ...args);
const customMessage = this._info.message || "";
const argsSuffix = computeArgsSuffix(matcherName, args);
const defaultTitle = `${this._info.poll ? "poll " : ""}${this._info.isSoft ? "soft " : ""}${this._info.isNot ? "not " : ""}${matcherName}${argsSuffix}`;
const title = customMessage || `Expect ${(0, import_utils.escapeWithQuotes)(defaultTitle, '"')}`;
const apiName = `expect${this._info.poll ? ".poll " : ""}${this._info.isSoft ? ".soft " : ""}${this._info.isNot ? ".not" : ""}.${matcherName}${argsSuffix}`;
const stackFrames = (0, import_util.filteredStackTrace)((0, import_utils.captureRawStack)());
const category = matcherName === "toPass" || this._info.poll ? "test.step" : "expect";
const stepInfo = {
category,
apiName,
title,
params: args[0] ? { expected: args[0] } : void 0,
infectParentStepsWithError: this._info.isSoft
};
const step = testInfo._addStep(stepInfo);
const reportStepError = (isAsync, e) => {
const jestError = (0, import_matcherHint.isJestError)(e) ? e : null;
const expectError = jestError ? new import_matcherHint.ExpectError(jestError, customMessage, stackFrames) : void 0;
if (jestError?.matcherResult.suggestedRebaseline) {
step.complete({ suggestedRebaseline: jestError?.matcherResult.suggestedRebaseline });
return;
}
const error = expectError ?? e;
step.complete({ error });
if (!isAsync || !expectError) {
if (this._info.isSoft)
testInfo._failWithError(error);
else
throw error;
return;
}
return (async () => {
const recoveryResult = await step.recoverFromStepError(expectError);
if (recoveryResult.status === "recovered")
return recoveryResult.value;
if (this._info.isSoft)
testInfo._failWithError(expectError);
else
throw expectError;
})();
};
const finalizer = () => {
step.complete({});
};
try {
setMatcherCallContext({ expectInfo: this._info, testInfo, step: step.info });
const callback = () => matcher.call(target, ...args);
const result = (0, import_utils.currentZone)().with("stepZone", step).run(callback);
if (result instanceof Promise)
return result.then(finalizer).catch(reportStepError.bind(null, true));
finalizer();
return result;
} catch (e) {
void reportStepError(false, e);
}
};
}
}
async function pollMatcher(qualifiedMatcherName2, info, prefix, ...args) {
const testInfo = (0, import_globals.currentTestInfo)();
const poll = info.poll;
const timeout = poll.timeout ?? info.timeout ?? testInfo?._projectInternal?.expect?.timeout ?? defaultExpectTimeout;
const { deadline, timeoutMessage } = testInfo ? testInfo._deadlineForMatcher(timeout) : import_testInfo.TestInfoImpl._defaultDeadlineForMatcher(timeout);
const result = await (0, import_utils.pollAgainstDeadline)(async () => {
if (testInfo && (0, import_globals.currentTestInfo)() !== testInfo)
return { continuePolling: false, result: void 0 };
const innerInfo = {
...info,
isSoft: false,
// soft is outside of poll, not inside
poll: void 0
};
const value = await poll.generator();
try {
let matchers = createMatchers(value, innerInfo, prefix);
if (info.isNot)
matchers = matchers.not;
matchers[qualifiedMatcherName2](...args);
return { continuePolling: false, result: void 0 };
} catch (error) {
return { continuePolling: true, result: error };
}
}, deadline, poll.intervals ?? [100, 250, 500, 1e3]);
if (result.timedOut) {
const message = result.result ? [
result.result.message,
"",
`Call Log:`,
`- ${timeoutMessage}`
].join("\n") : timeoutMessage;
throw new Error(message);
}
}
function computeArgsSuffix(matcherName, args) {
let value = "";
if (matcherName === "toHaveScreenshot")
value = (0, import_toMatchSnapshot.toHaveScreenshotStepTitle)(...args);
return value ? `(${value})` : "";
}
const expect = createExpect({}, [], {}).extend(customMatchers);
function mergeExpects(...expects) {
let merged = expect;
for (const e of expects) {
const internals = e[userMatchersSymbol];
if (!internals)
continue;
merged = merged.extend(internals);
}
return merged;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
expect,
mergeExpects,
printReceivedStringContainExpectedResult,
printReceivedStringContainExpectedSubstring
});
+63
View File
@@ -0,0 +1,63 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var matcherHint_exports = {};
__export(matcherHint_exports, {
ExpectError: () => ExpectError,
isJestError: () => isJestError,
kNoElementsFoundError: () => kNoElementsFoundError,
matcherHint: () => matcherHint
});
module.exports = __toCommonJS(matcherHint_exports);
var import_utils = require("playwright-core/lib/utils");
const kNoElementsFoundError = "<element(s) not found>";
function matcherHint(state, locator, matcherName, expression, actual, matcherOptions, timeout, expectedReceivedString, preventExtraStatIndent = false) {
let header = state.utils.matcherHint(matcherName, expression, actual, matcherOptions).replace(/ \/\/ deep equality/, "") + " failed\n\n";
const extraSpace = preventExtraStatIndent ? "" : " ";
if (locator)
header += `Locator: ${extraSpace}${String(locator)}
`;
if (expectedReceivedString)
header += `${expectedReceivedString}
`;
if (timeout)
header += `Timeout: ${extraSpace}${timeout}ms
`;
return header;
}
class ExpectError extends Error {
constructor(jestError, customMessage, stackFrames) {
super("");
this.name = jestError.name;
this.message = jestError.message;
this.matcherResult = jestError.matcherResult;
if (customMessage)
this.message = customMessage + "\n\n" + this.message;
this.stack = this.name + ": " + this.message + "\n" + (0, import_utils.stringifyStackFrames)(stackFrames).join("\n");
}
}
function isJestError(e) {
return e instanceof Error && "matcherResult" in e;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
ExpectError,
isJestError,
kNoElementsFoundError,
matcherHint
});
+360
View File
@@ -0,0 +1,360 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var matchers_exports = {};
__export(matchers_exports, {
toBeAttached: () => toBeAttached,
toBeChecked: () => toBeChecked,
toBeDisabled: () => toBeDisabled,
toBeEditable: () => toBeEditable,
toBeEmpty: () => toBeEmpty,
toBeEnabled: () => toBeEnabled,
toBeFocused: () => toBeFocused,
toBeHidden: () => toBeHidden,
toBeInViewport: () => toBeInViewport,
toBeOK: () => toBeOK,
toBeVisible: () => toBeVisible,
toContainClass: () => toContainClass,
toContainText: () => toContainText,
toHaveAccessibleDescription: () => toHaveAccessibleDescription,
toHaveAccessibleErrorMessage: () => toHaveAccessibleErrorMessage,
toHaveAccessibleName: () => toHaveAccessibleName,
toHaveAttribute: () => toHaveAttribute,
toHaveCSS: () => toHaveCSS,
toHaveClass: () => toHaveClass,
toHaveCount: () => toHaveCount,
toHaveId: () => toHaveId,
toHaveJSProperty: () => toHaveJSProperty,
toHaveRole: () => toHaveRole,
toHaveText: () => toHaveText,
toHaveTitle: () => toHaveTitle,
toHaveURL: () => toHaveURL,
toHaveValue: () => toHaveValue,
toHaveValues: () => toHaveValues,
toPass: () => toPass
});
module.exports = __toCommonJS(matchers_exports);
var import_utils = require("playwright-core/lib/utils");
var import_utils2 = require("playwright-core/lib/utils");
var import_util = require("../util");
var import_toBeTruthy = require("./toBeTruthy");
var import_toEqual = require("./toEqual");
var import_toHaveURL = require("./toHaveURL");
var import_toMatchText = require("./toMatchText");
var import_config = require("../common/config");
var import_globals = require("../common/globals");
var import_testInfo = require("../worker/testInfo");
function toBeAttached(locator, options) {
const attached = !options || options.attached === void 0 || options.attached;
const expected = attached ? "attached" : "detached";
const arg = attached ? "" : "{ attached: false }";
return import_toBeTruthy.toBeTruthy.call(this, "toBeAttached", locator, "Locator", expected, arg, async (isNot, timeout) => {
return await locator._expect(attached ? "to.be.attached" : "to.be.detached", { isNot, timeout });
}, options);
}
function toBeChecked(locator, options) {
const checked = options?.checked;
const indeterminate = options?.indeterminate;
const expectedValue = {
checked,
indeterminate
};
let expected;
let arg;
if (options?.indeterminate) {
expected = "indeterminate";
arg = `{ indeterminate: true }`;
} else {
expected = options?.checked === false ? "unchecked" : "checked";
arg = options?.checked === false ? `{ checked: false }` : "";
}
return import_toBeTruthy.toBeTruthy.call(this, "toBeChecked", locator, "Locator", expected, arg, async (isNot, timeout) => {
return await locator._expect("to.be.checked", { isNot, timeout, expectedValue });
}, options);
}
function toBeDisabled(locator, options) {
return import_toBeTruthy.toBeTruthy.call(this, "toBeDisabled", locator, "Locator", "disabled", "", async (isNot, timeout) => {
return await locator._expect("to.be.disabled", { isNot, timeout });
}, options);
}
function toBeEditable(locator, options) {
const editable = !options || options.editable === void 0 || options.editable;
const expected = editable ? "editable" : "readOnly";
const arg = editable ? "" : "{ editable: false }";
return import_toBeTruthy.toBeTruthy.call(this, "toBeEditable", locator, "Locator", expected, arg, async (isNot, timeout) => {
return await locator._expect(editable ? "to.be.editable" : "to.be.readonly", { isNot, timeout });
}, options);
}
function toBeEmpty(locator, options) {
return import_toBeTruthy.toBeTruthy.call(this, "toBeEmpty", locator, "Locator", "empty", "", async (isNot, timeout) => {
return await locator._expect("to.be.empty", { isNot, timeout });
}, options);
}
function toBeEnabled(locator, options) {
const enabled = !options || options.enabled === void 0 || options.enabled;
const expected = enabled ? "enabled" : "disabled";
const arg = enabled ? "" : "{ enabled: false }";
return import_toBeTruthy.toBeTruthy.call(this, "toBeEnabled", locator, "Locator", expected, arg, async (isNot, timeout) => {
return await locator._expect(enabled ? "to.be.enabled" : "to.be.disabled", { isNot, timeout });
}, options);
}
function toBeFocused(locator, options) {
return import_toBeTruthy.toBeTruthy.call(this, "toBeFocused", locator, "Locator", "focused", "", async (isNot, timeout) => {
return await locator._expect("to.be.focused", { isNot, timeout });
}, options);
}
function toBeHidden(locator, options) {
return import_toBeTruthy.toBeTruthy.call(this, "toBeHidden", locator, "Locator", "hidden", "", async (isNot, timeout) => {
return await locator._expect("to.be.hidden", { isNot, timeout });
}, options);
}
function toBeVisible(locator, options) {
const visible = !options || options.visible === void 0 || options.visible;
const expected = visible ? "visible" : "hidden";
const arg = visible ? "" : "{ visible: false }";
return import_toBeTruthy.toBeTruthy.call(this, "toBeVisible", locator, "Locator", expected, arg, async (isNot, timeout) => {
return await locator._expect(visible ? "to.be.visible" : "to.be.hidden", { isNot, timeout });
}, options);
}
function toBeInViewport(locator, options) {
return import_toBeTruthy.toBeTruthy.call(this, "toBeInViewport", locator, "Locator", "in viewport", "", async (isNot, timeout) => {
return await locator._expect("to.be.in.viewport", { isNot, expectedNumber: options?.ratio, timeout });
}, options);
}
function toContainText(locator, expected, options = {}) {
if (Array.isArray(expected)) {
return import_toEqual.toEqual.call(this, "toContainText", locator, "Locator", async (isNot, timeout) => {
const expectedText = (0, import_utils.serializeExpectedTextValues)(expected, { matchSubstring: true, normalizeWhiteSpace: true, ignoreCase: options.ignoreCase });
return await locator._expect("to.contain.text.array", { expectedText, isNot, useInnerText: options.useInnerText, timeout });
}, expected, { ...options, contains: true });
} else {
return import_toMatchText.toMatchText.call(this, "toContainText", locator, "Locator", async (isNot, timeout) => {
const expectedText = (0, import_utils.serializeExpectedTextValues)([expected], { matchSubstring: true, normalizeWhiteSpace: true, ignoreCase: options.ignoreCase });
return await locator._expect("to.have.text", { expectedText, isNot, useInnerText: options.useInnerText, timeout });
}, expected, options);
}
}
function toHaveAccessibleDescription(locator, expected, options) {
return import_toMatchText.toMatchText.call(this, "toHaveAccessibleDescription", locator, "Locator", async (isNot, timeout) => {
const expectedText = (0, import_utils.serializeExpectedTextValues)([expected], { ignoreCase: options?.ignoreCase, normalizeWhiteSpace: true });
return await locator._expect("to.have.accessible.description", { expectedText, isNot, timeout });
}, expected, options);
}
function toHaveAccessibleName(locator, expected, options) {
return import_toMatchText.toMatchText.call(this, "toHaveAccessibleName", locator, "Locator", async (isNot, timeout) => {
const expectedText = (0, import_utils.serializeExpectedTextValues)([expected], { ignoreCase: options?.ignoreCase, normalizeWhiteSpace: true });
return await locator._expect("to.have.accessible.name", { expectedText, isNot, timeout });
}, expected, options);
}
function toHaveAccessibleErrorMessage(locator, expected, options) {
return import_toMatchText.toMatchText.call(this, "toHaveAccessibleErrorMessage", locator, "Locator", async (isNot, timeout) => {
const expectedText = (0, import_utils.serializeExpectedTextValues)([expected], { ignoreCase: options?.ignoreCase, normalizeWhiteSpace: true });
return await locator._expect("to.have.accessible.error.message", { expectedText, isNot, timeout });
}, expected, options);
}
function toHaveAttribute(locator, name, expected, options) {
if (!options) {
if (typeof expected === "object" && !(0, import_utils.isRegExp)(expected)) {
options = expected;
expected = void 0;
}
}
if (expected === void 0) {
return import_toBeTruthy.toBeTruthy.call(this, "toHaveAttribute", locator, "Locator", "have attribute", "", async (isNot, timeout) => {
return await locator._expect("to.have.attribute", { expressionArg: name, isNot, timeout });
}, options);
}
return import_toMatchText.toMatchText.call(this, "toHaveAttribute", locator, "Locator", async (isNot, timeout) => {
const expectedText = (0, import_utils.serializeExpectedTextValues)([expected], { ignoreCase: options?.ignoreCase });
return await locator._expect("to.have.attribute.value", { expressionArg: name, expectedText, isNot, timeout });
}, expected, options);
}
function toHaveClass(locator, expected, options) {
if (Array.isArray(expected)) {
return import_toEqual.toEqual.call(this, "toHaveClass", locator, "Locator", async (isNot, timeout) => {
const expectedText = (0, import_utils.serializeExpectedTextValues)(expected);
return await locator._expect("to.have.class.array", { expectedText, isNot, timeout });
}, expected, options, true);
} else {
return import_toMatchText.toMatchText.call(this, "toHaveClass", locator, "Locator", async (isNot, timeout) => {
const expectedText = (0, import_utils.serializeExpectedTextValues)([expected]);
return await locator._expect("to.have.class", { expectedText, isNot, timeout });
}, expected, options);
}
}
function toContainClass(locator, expected, options) {
if (Array.isArray(expected)) {
if (expected.some((e) => (0, import_utils.isRegExp)(e)))
throw new Error(`"expected" argument in toContainClass cannot contain RegExp values`);
return import_toEqual.toEqual.call(this, "toContainClass", locator, "Locator", async (isNot, timeout) => {
const expectedText = (0, import_utils.serializeExpectedTextValues)(expected);
return await locator._expect("to.contain.class.array", { expectedText, isNot, timeout });
}, expected, options, true);
} else {
if ((0, import_utils.isRegExp)(expected))
throw new Error(`"expected" argument in toContainClass cannot be a RegExp value`);
return import_toMatchText.toMatchText.call(this, "toContainClass", locator, "Locator", async (isNot, timeout) => {
const expectedText = (0, import_utils.serializeExpectedTextValues)([expected]);
return await locator._expect("to.contain.class", { expectedText, isNot, timeout });
}, expected, options);
}
}
function toHaveCount(locator, expected, options) {
return import_toEqual.toEqual.call(this, "toHaveCount", locator, "Locator", async (isNot, timeout) => {
return await locator._expect("to.have.count", { expectedNumber: expected, isNot, timeout });
}, expected, options);
}
function toHaveCSS(locator, name, expected, options) {
return import_toMatchText.toMatchText.call(this, "toHaveCSS", locator, "Locator", async (isNot, timeout) => {
const expectedText = (0, import_utils.serializeExpectedTextValues)([expected]);
return await locator._expect("to.have.css", { expressionArg: name, expectedText, isNot, timeout });
}, expected, options);
}
function toHaveId(locator, expected, options) {
return import_toMatchText.toMatchText.call(this, "toHaveId", locator, "Locator", async (isNot, timeout) => {
const expectedText = (0, import_utils.serializeExpectedTextValues)([expected]);
return await locator._expect("to.have.id", { expectedText, isNot, timeout });
}, expected, options);
}
function toHaveJSProperty(locator, name, expected, options) {
return import_toEqual.toEqual.call(this, "toHaveJSProperty", locator, "Locator", async (isNot, timeout) => {
return await locator._expect("to.have.property", { expressionArg: name, expectedValue: expected, isNot, timeout });
}, expected, options);
}
function toHaveRole(locator, expected, options) {
if (!(0, import_utils.isString)(expected))
throw new Error(`"role" argument in toHaveRole must be a string`);
return import_toMatchText.toMatchText.call(this, "toHaveRole", locator, "Locator", async (isNot, timeout) => {
const expectedText = (0, import_utils.serializeExpectedTextValues)([expected]);
return await locator._expect("to.have.role", { expectedText, isNot, timeout });
}, expected, options);
}
function toHaveText(locator, expected, options = {}) {
if (Array.isArray(expected)) {
return import_toEqual.toEqual.call(this, "toHaveText", locator, "Locator", async (isNot, timeout) => {
const expectedText = (0, import_utils.serializeExpectedTextValues)(expected, { normalizeWhiteSpace: true, ignoreCase: options.ignoreCase });
return await locator._expect("to.have.text.array", { expectedText, isNot, useInnerText: options?.useInnerText, timeout });
}, expected, options);
} else {
return import_toMatchText.toMatchText.call(this, "toHaveText", locator, "Locator", async (isNot, timeout) => {
const expectedText = (0, import_utils.serializeExpectedTextValues)([expected], { normalizeWhiteSpace: true, ignoreCase: options.ignoreCase });
return await locator._expect("to.have.text", { expectedText, isNot, useInnerText: options?.useInnerText, timeout });
}, expected, options);
}
}
function toHaveValue(locator, expected, options) {
return import_toMatchText.toMatchText.call(this, "toHaveValue", locator, "Locator", async (isNot, timeout) => {
const expectedText = (0, import_utils.serializeExpectedTextValues)([expected]);
return await locator._expect("to.have.value", { expectedText, isNot, timeout });
}, expected, options);
}
function toHaveValues(locator, expected, options) {
return import_toEqual.toEqual.call(this, "toHaveValues", locator, "Locator", async (isNot, timeout) => {
const expectedText = (0, import_utils.serializeExpectedTextValues)(expected);
return await locator._expect("to.have.values", { expectedText, isNot, timeout });
}, expected, options);
}
function toHaveTitle(page, expected, options = {}) {
return import_toMatchText.toMatchText.call(this, "toHaveTitle", page, "Page", async (isNot, timeout) => {
const expectedText = (0, import_utils.serializeExpectedTextValues)([expected], { normalizeWhiteSpace: true });
return await page.mainFrame()._expect("to.have.title", { expectedText, isNot, timeout });
}, expected, { receiverLabel: "page", ...options });
}
function toHaveURL(page, expected, options) {
if (typeof expected === "function")
return import_toHaveURL.toHaveURLWithPredicate.call(this, page, expected, options);
const baseURL = page.context()._options.baseURL;
expected = typeof expected === "string" ? (0, import_utils.constructURLBasedOnBaseURL)(baseURL, expected) : expected;
return import_toMatchText.toMatchText.call(this, "toHaveURL", page, "Page", async (isNot, timeout) => {
const expectedText = (0, import_utils.serializeExpectedTextValues)([expected], { ignoreCase: options?.ignoreCase });
return await page.mainFrame()._expect("to.have.url", { expectedText, isNot, timeout });
}, expected, { receiverLabel: "page", ...options });
}
async function toBeOK(response) {
const matcherName = "toBeOK";
(0, import_util.expectTypes)(response, ["APIResponse"], matcherName);
const contentType = response.headers()["content-type"];
const isTextEncoding = contentType && (0, import_utils.isTextualMimeType)(contentType);
const [log, text] = this.isNot === response.ok() ? await Promise.all([
response._fetchLog(),
isTextEncoding ? response.text() : null
]) : [];
const message = () => this.utils.matcherHint(matcherName, void 0, "", { isNot: this.isNot }) + (0, import_util.callLogText)(log) + (text === null ? "" : `
Response text:
${import_utils2.colors.dim(text?.substring(0, 1e3) || "")}`);
const pass = response.ok();
return { message, pass };
}
async function toPass(callback, options = {}) {
const testInfo = (0, import_globals.currentTestInfo)();
const timeout = (0, import_config.takeFirst)(options.timeout, testInfo?._projectInternal.expect?.toPass?.timeout, 0);
const intervals = (0, import_config.takeFirst)(options.intervals, testInfo?._projectInternal.expect?.toPass?.intervals, [100, 250, 500, 1e3]);
const { deadline, timeoutMessage } = testInfo ? testInfo._deadlineForMatcher(timeout) : import_testInfo.TestInfoImpl._defaultDeadlineForMatcher(timeout);
const result = await (0, import_utils.pollAgainstDeadline)(async () => {
if (testInfo && (0, import_globals.currentTestInfo)() !== testInfo)
return { continuePolling: false, result: void 0 };
try {
await callback();
return { continuePolling: !!this.isNot, result: void 0 };
} catch (e) {
return { continuePolling: !this.isNot, result: e };
}
}, deadline, intervals);
if (result.timedOut) {
const message = result.result ? [
result.result.message,
"",
`Call Log:`,
`- ${timeoutMessage}`
].join("\n") : timeoutMessage;
return { message: () => message, pass: !!this.isNot };
}
return { pass: !this.isNot, message: () => "" };
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
toBeAttached,
toBeChecked,
toBeDisabled,
toBeEditable,
toBeEmpty,
toBeEnabled,
toBeFocused,
toBeHidden,
toBeInViewport,
toBeOK,
toBeVisible,
toContainClass,
toContainText,
toHaveAccessibleDescription,
toHaveAccessibleErrorMessage,
toHaveAccessibleName,
toHaveAttribute,
toHaveCSS,
toHaveClass,
toHaveCount,
toHaveId,
toHaveJSProperty,
toHaveRole,
toHaveText,
toHaveTitle,
toHaveURL,
toHaveValue,
toHaveValues,
toPass
});
+71
View File
@@ -0,0 +1,71 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var toBeTruthy_exports = {};
__export(toBeTruthy_exports, {
toBeTruthy: () => toBeTruthy
});
module.exports = __toCommonJS(toBeTruthy_exports);
var import_util = require("../util");
var import_matcherHint = require("./matcherHint");
async function toBeTruthy(matcherName, receiver, receiverType, expected, arg, query, options = {}) {
(0, import_util.expectTypes)(receiver, [receiverType], matcherName);
const matcherOptions = {
isNot: this.isNot,
promise: this.promise
};
const timeout = options.timeout ?? this.timeout;
const { matches: pass, log, timedOut, received } = await query(!!this.isNot, timeout);
if (pass === !this.isNot) {
return {
name: matcherName,
message: () => "",
pass,
expected
};
}
const notFound = received === import_matcherHint.kNoElementsFoundError ? received : void 0;
let printedReceived;
let printedExpected;
if (pass) {
printedExpected = `Expected: not ${expected}`;
printedReceived = `Received: ${notFound ? import_matcherHint.kNoElementsFoundError : expected}`;
} else {
printedExpected = `Expected: ${expected}`;
printedReceived = `Received: ${notFound ? import_matcherHint.kNoElementsFoundError : received}`;
}
const message = () => {
const header = (0, import_matcherHint.matcherHint)(this, receiver, matcherName, "locator", arg, matcherOptions, timedOut ? timeout : void 0, `${printedExpected}
${printedReceived}`);
const logText = (0, import_util.callLogText)(log);
return `${header}${logText}`;
};
return {
message,
pass,
actual: received,
name: matcherName,
expected,
log,
timeout: timedOut ? timeout : void 0
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
toBeTruthy
});
+94
View File
@@ -0,0 +1,94 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var toEqual_exports = {};
__export(toEqual_exports, {
toEqual: () => toEqual
});
module.exports = __toCommonJS(toEqual_exports);
var import_utils = require("playwright-core/lib/utils");
var import_util = require("../util");
var import_matcherHint = require("./matcherHint");
const EXPECTED_LABEL = "Expected";
const RECEIVED_LABEL = "Received";
async function toEqual(matcherName, receiver, receiverType, query, expected, options = {}, messagePreventExtraStatIndent) {
(0, import_util.expectTypes)(receiver, [receiverType], matcherName);
const matcherOptions = {
comment: options.contains ? "" : "deep equality",
isNot: this.isNot,
promise: this.promise
};
const timeout = options.timeout ?? this.timeout;
const { matches: pass, received, log, timedOut } = await query(!!this.isNot, timeout);
if (pass === !this.isNot) {
return {
name: matcherName,
message: () => "",
pass,
expected
};
}
let printedReceived;
let printedExpected;
let printedDiff;
if (pass) {
printedExpected = `Expected: not ${this.utils.printExpected(expected)}`;
printedReceived = `Received: ${this.utils.printReceived(received)}`;
} else if (Array.isArray(expected) && Array.isArray(received)) {
const normalizedExpected = expected.map((exp, index) => {
const rec = received[index];
if ((0, import_utils.isRegExp)(exp))
return exp.test(rec) ? rec : exp;
return exp;
});
printedDiff = this.utils.printDiffOrStringify(
normalizedExpected,
received,
EXPECTED_LABEL,
RECEIVED_LABEL,
false
);
} else {
printedDiff = this.utils.printDiffOrStringify(
expected,
received,
EXPECTED_LABEL,
RECEIVED_LABEL,
false
);
}
const message = () => {
const details = printedDiff || `${printedExpected}
${printedReceived}`;
const header = (0, import_matcherHint.matcherHint)(this, receiver, matcherName, "locator", void 0, matcherOptions, timedOut ? timeout : void 0, details, messagePreventExtraStatIndent);
return `${header}${(0, import_util.callLogText)(log)}`;
};
return {
actual: received,
expected,
message,
name: matcherName,
pass,
log,
timeout: timedOut ? timeout : void 0
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
toEqual
});
+117
View File
@@ -0,0 +1,117 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var toHaveURL_exports = {};
__export(toHaveURL_exports, {
toHaveURLWithPredicate: () => toHaveURLWithPredicate
});
module.exports = __toCommonJS(toHaveURL_exports);
var import_utils = require("playwright-core/lib/utils");
var import_utils2 = require("playwright-core/lib/utils");
var import_expect = require("./expect");
var import_matcherHint = require("./matcherHint");
var import_expectBundle = require("../common/expectBundle");
async function toHaveURLWithPredicate(page, expected, options) {
const matcherName = "toHaveURL";
const expression = "page";
const matcherOptions = {
isNot: this.isNot,
promise: this.promise
};
if (typeof expected !== "function") {
throw new Error(
[
// Always display `expected` in expectation place
(0, import_matcherHint.matcherHint)(this, void 0, matcherName, expression, void 0, matcherOptions, void 0, void 0, true),
`${import_utils2.colors.bold("Matcher error")}: ${(0, import_expectBundle.EXPECTED_COLOR)("expected")} value must be a string, regular expression, or predicate`,
this.utils.printWithType("Expected", expected, this.utils.printExpected)
].join("\n\n")
);
}
const timeout = options?.timeout ?? this.timeout;
const baseURL = page.context()._options.baseURL;
let conditionSucceeded = false;
let lastCheckedURLString = void 0;
try {
await page.mainFrame().waitForURL(
(url) => {
lastCheckedURLString = url.toString();
if (options?.ignoreCase) {
return !this.isNot === (0, import_utils.urlMatches)(
baseURL?.toLocaleLowerCase(),
lastCheckedURLString.toLocaleLowerCase(),
expected
);
}
return !this.isNot === (0, import_utils.urlMatches)(baseURL, lastCheckedURLString, expected);
},
{ timeout }
);
conditionSucceeded = true;
} catch (e) {
conditionSucceeded = false;
}
if (conditionSucceeded)
return { name: matcherName, pass: !this.isNot, message: () => "" };
return {
name: matcherName,
pass: this.isNot,
message: () => toHaveURLMessage(
this,
matcherName,
expression,
expected,
lastCheckedURLString,
this.isNot,
true,
timeout
),
actual: lastCheckedURLString,
timeout
};
}
function toHaveURLMessage(state, matcherName, expression, expected, received, pass, didTimeout, timeout) {
const matcherOptions = {
isNot: state.isNot,
promise: state.promise
};
const receivedString = received || "";
const messagePrefix = (0, import_matcherHint.matcherHint)(state, void 0, matcherName, expression, void 0, matcherOptions, didTimeout ? timeout : void 0, void 0, true);
let printedReceived;
let printedExpected;
let printedDiff;
if (typeof expected === "function") {
printedExpected = `Expected predicate to ${!state.isNot ? "succeed" : "fail"}`;
printedReceived = `Received string: ${(0, import_expectBundle.printReceived)(receivedString)}`;
} else {
if (pass) {
printedExpected = `Expected pattern: not ${state.utils.printExpected(expected)}`;
const formattedReceived = (0, import_expect.printReceivedStringContainExpectedResult)(receivedString, null);
printedReceived = `Received string: ${formattedReceived}`;
} else {
const labelExpected = `Expected ${typeof expected === "string" ? "string" : "pattern"}`;
printedDiff = state.utils.printDiffOrStringify(expected, receivedString, labelExpected, "Received string", false);
}
}
const resultDetails = printedDiff ? printedDiff : printedExpected + "\n" + printedReceived;
return messagePrefix + resultDetails;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
toHaveURLWithPredicate
});
+163
View File
@@ -0,0 +1,163 @@
"use strict";
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 __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);
var toMatchAriaSnapshot_exports = {};
__export(toMatchAriaSnapshot_exports, {
toMatchAriaSnapshot: () => toMatchAriaSnapshot
});
module.exports = __toCommonJS(toMatchAriaSnapshot_exports);
var import_fs = __toESM(require("fs"));
var import_path = __toESM(require("path"));
var import_utils = require("playwright-core/lib/utils");
var import_matcherHint = require("./matcherHint");
var import_expectBundle = require("../common/expectBundle");
var import_util = require("../util");
var import_expect = require("./expect");
var import_globals = require("../common/globals");
async function toMatchAriaSnapshot(receiver, expectedParam, options = {}) {
const matcherName = "toMatchAriaSnapshot";
const testInfo = (0, import_globals.currentTestInfo)();
if (!testInfo)
throw new Error(`toMatchAriaSnapshot() must be called during the test`);
if (testInfo._projectInternal.ignoreSnapshots)
return { pass: !this.isNot, message: () => "", name: "toMatchAriaSnapshot", expected: "" };
const updateSnapshots = testInfo.config.updateSnapshots;
const matcherOptions = {
isNot: this.isNot,
promise: this.promise
};
let expected;
let timeout;
let expectedPath;
if ((0, import_utils.isString)(expectedParam)) {
expected = expectedParam;
timeout = options.timeout ?? this.timeout;
} else {
const legacyPath = testInfo._resolveSnapshotPaths("aria", expectedParam?.name, "dontUpdateSnapshotIndex", ".yml").absoluteSnapshotPath;
expectedPath = testInfo._resolveSnapshotPaths("aria", expectedParam?.name, "updateSnapshotIndex").absoluteSnapshotPath;
if (!await (0, import_util.fileExistsAsync)(expectedPath) && await (0, import_util.fileExistsAsync)(legacyPath))
expectedPath = legacyPath;
expected = await import_fs.default.promises.readFile(expectedPath, "utf8").catch(() => "");
timeout = expectedParam?.timeout ?? this.timeout;
}
const generateMissingBaseline = updateSnapshots === "missing" && !expected;
if (generateMissingBaseline) {
if (this.isNot) {
const message2 = `Matchers using ".not" can't generate new baselines`;
return { pass: this.isNot, message: () => message2, name: "toMatchAriaSnapshot" };
} else {
expected = `- none "Generating new baseline"`;
}
}
expected = unshift(expected);
const { matches: pass, received, log, timedOut } = await receiver._expect("to.match.aria", { expectedValue: expected, isNot: this.isNot, timeout });
const typedReceived = received;
const matcherHintWithExpect = (expectedReceivedString) => {
return (0, import_matcherHint.matcherHint)(this, receiver, matcherName, "locator", void 0, matcherOptions, timedOut ? timeout : void 0, expectedReceivedString);
};
const notFound = typedReceived === import_matcherHint.kNoElementsFoundError;
if (notFound) {
return {
pass: this.isNot,
message: () => matcherHintWithExpect(`Expected: ${this.utils.printExpected(expected)}
Received: ${(0, import_expectBundle.EXPECTED_COLOR)("<element not found>")}`) + (0, import_util.callLogText)(log),
name: "toMatchAriaSnapshot",
expected
};
}
const receivedText = typedReceived.raw;
const message = () => {
if (pass) {
const receivedString = notFound ? receivedText : (0, import_expect.printReceivedStringContainExpectedSubstring)(receivedText, receivedText.indexOf(expected), expected.length);
const expectedReceivedString = `Expected: not ${this.utils.printExpected(expected)}
Received: ${receivedString}`;
return matcherHintWithExpect(expectedReceivedString) + (0, import_util.callLogText)(log);
} else {
const labelExpected = `Expected`;
const expectedReceivedString = notFound ? `${labelExpected}: ${this.utils.printExpected(expected)}
Received: ${receivedText}` : this.utils.printDiffOrStringify(expected, receivedText, labelExpected, "Received", false);
return matcherHintWithExpect(expectedReceivedString) + (0, import_util.callLogText)(log);
}
};
if (!this.isNot) {
if (updateSnapshots === "all" || updateSnapshots === "changed" && pass === this.isNot || generateMissingBaseline) {
if (expectedPath) {
await import_fs.default.promises.mkdir(import_path.default.dirname(expectedPath), { recursive: true });
await import_fs.default.promises.writeFile(expectedPath, typedReceived.regex, "utf8");
const relativePath = import_path.default.relative(process.cwd(), expectedPath);
if (updateSnapshots === "missing") {
const message2 = `A snapshot doesn't exist at ${relativePath}, writing actual.`;
testInfo._hasNonRetriableError = true;
testInfo._failWithError(new Error(message2));
} else {
const message2 = `A snapshot is generated at ${relativePath}.`;
console.log(message2);
}
return { pass: true, message: () => "", name: "toMatchAriaSnapshot" };
} else {
const suggestedRebaseline = `\`
${(0, import_utils.escapeTemplateString)(indent(typedReceived.regex, "{indent} "))}
{indent}\``;
if (updateSnapshots === "missing") {
const message2 = "A snapshot is not provided, generating new baseline.";
testInfo._hasNonRetriableError = true;
testInfo._failWithError(new Error(message2));
}
return { pass: false, message: () => "", name: "toMatchAriaSnapshot", suggestedRebaseline };
}
}
}
return {
name: matcherName,
expected,
message,
pass,
actual: received,
log,
timeout: timedOut ? timeout : void 0
};
}
function unshift(snapshot) {
const lines = snapshot.split("\n");
let whitespacePrefixLength = 100;
for (const line of lines) {
if (!line.trim())
continue;
const match = line.match(/^(\s*)/);
if (match && match[1].length < whitespacePrefixLength)
whitespacePrefixLength = match[1].length;
}
return lines.filter((t) => t.trim()).map((line) => line.substring(whitespacePrefixLength)).join("\n");
}
function indent(snapshot, indent2) {
return snapshot.split("\n").map((line) => indent2 + line).join("\n");
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
toMatchAriaSnapshot
});
+338
View File
@@ -0,0 +1,338 @@
"use strict";
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 __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);
var toMatchSnapshot_exports = {};
__export(toMatchSnapshot_exports, {
toHaveScreenshot: () => toHaveScreenshot,
toHaveScreenshotStepTitle: () => toHaveScreenshotStepTitle,
toMatchSnapshot: () => toMatchSnapshot
});
module.exports = __toCommonJS(toMatchSnapshot_exports);
var import_fs = __toESM(require("fs"));
var import_path = __toESM(require("path"));
var import_utils = require("playwright-core/lib/utils");
var import_utils2 = require("playwright-core/lib/utils");
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
var import_util = require("../util");
var import_matcherHint = require("./matcherHint");
var import_globals = require("../common/globals");
const NonConfigProperties = [
"clip",
"fullPage",
"mask",
"maskColor",
"omitBackground",
"timeout"
];
class SnapshotHelper {
constructor(testInfo, matcherName, locator, anonymousSnapshotExtension, configOptions, nameOrOptions, optOptions) {
let name;
if (Array.isArray(nameOrOptions) || typeof nameOrOptions === "string") {
name = nameOrOptions;
this.options = { ...optOptions };
} else {
const { name: nameFromOptions, ...options } = nameOrOptions;
this.options = options;
name = nameFromOptions;
}
this.name = Array.isArray(name) ? name.join(import_path.default.sep) : name || "";
const resolvedPaths = testInfo._resolveSnapshotPaths(matcherName === "toHaveScreenshot" ? "screenshot" : "snapshot", name, "updateSnapshotIndex", anonymousSnapshotExtension);
this.expectedPath = resolvedPaths.absoluteSnapshotPath;
this.attachmentBaseName = resolvedPaths.relativeOutputPath;
const outputBasePath = testInfo._getOutputPath(resolvedPaths.relativeOutputPath);
this.legacyExpectedPath = (0, import_util.addSuffixToFilePath)(outputBasePath, "-expected");
this.previousPath = (0, import_util.addSuffixToFilePath)(outputBasePath, "-previous");
this.actualPath = (0, import_util.addSuffixToFilePath)(outputBasePath, "-actual");
this.diffPath = (0, import_util.addSuffixToFilePath)(outputBasePath, "-diff");
const filteredConfigOptions = { ...configOptions };
for (const prop of NonConfigProperties)
delete filteredConfigOptions[prop];
this.options = {
...filteredConfigOptions,
...this.options
};
if (this.options._comparator) {
this.options.comparator = this.options._comparator;
delete this.options._comparator;
}
if (this.options.maxDiffPixels !== void 0 && this.options.maxDiffPixels < 0)
throw new Error("`maxDiffPixels` option value must be non-negative integer");
if (this.options.maxDiffPixelRatio !== void 0 && (this.options.maxDiffPixelRatio < 0 || this.options.maxDiffPixelRatio > 1))
throw new Error("`maxDiffPixelRatio` option value must be between 0 and 1");
this.matcherName = matcherName;
this.locator = locator;
this.updateSnapshots = testInfo.config.updateSnapshots;
this.mimeType = import_utilsBundle.mime.getType(import_path.default.basename(this.expectedPath)) ?? "application/octet-stream";
this.comparator = (0, import_utils.getComparator)(this.mimeType);
this.testInfo = testInfo;
this.kind = this.mimeType.startsWith("image/") ? "Screenshot" : "Snapshot";
}
createMatcherResult(message, pass, log) {
const unfiltered = {
name: this.matcherName,
expected: this.expectedPath,
actual: this.actualPath,
diff: this.diffPath,
pass,
message: () => message,
log
};
return Object.fromEntries(Object.entries(unfiltered).filter(([_, v]) => v !== void 0));
}
handleMissingNegated() {
const isWriteMissingMode = this.updateSnapshots !== "none";
const message = `A snapshot doesn't exist at ${this.expectedPath}${isWriteMissingMode ? `, matchers using ".not" won't write them automatically.` : "."}`;
return this.createMatcherResult(message, true);
}
handleDifferentNegated() {
return this.createMatcherResult("", false);
}
handleMatchingNegated() {
const message = [
import_utils2.colors.red(`${this.kind} comparison failed:`),
"",
indent("Expected result should be different from the actual one.", " ")
].join("\n");
return this.createMatcherResult(message, true);
}
handleMissing(actual, step) {
const isWriteMissingMode = this.updateSnapshots !== "none";
if (isWriteMissingMode)
writeFileSync(this.expectedPath, actual);
step?._attachToStep({ name: (0, import_util.addSuffixToFilePath)(this.attachmentBaseName, "-expected"), contentType: this.mimeType, path: this.expectedPath });
writeFileSync(this.actualPath, actual);
step?._attachToStep({ name: (0, import_util.addSuffixToFilePath)(this.attachmentBaseName, "-actual"), contentType: this.mimeType, path: this.actualPath });
const message = `A snapshot doesn't exist at ${this.expectedPath}${isWriteMissingMode ? ", writing actual." : "."}`;
if (this.updateSnapshots === "all" || this.updateSnapshots === "changed") {
console.log(message);
return this.createMatcherResult(message, true);
}
if (this.updateSnapshots === "missing") {
this.testInfo._hasNonRetriableError = true;
this.testInfo._failWithError(new Error(message));
return this.createMatcherResult("", true);
}
return this.createMatcherResult(message, false);
}
handleDifferent(actual, expected, previous, diff, header, diffError, log, step) {
const output = [`${header}${indent(diffError, " ")}`];
if (this.name) {
output.push("");
output.push(` Snapshot: ${this.name}`);
}
if (expected !== void 0) {
writeFileSync(this.legacyExpectedPath, expected);
step?._attachToStep({ name: (0, import_util.addSuffixToFilePath)(this.attachmentBaseName, "-expected"), contentType: this.mimeType, path: this.expectedPath });
}
if (previous !== void 0) {
writeFileSync(this.previousPath, previous);
step?._attachToStep({ name: (0, import_util.addSuffixToFilePath)(this.attachmentBaseName, "-previous"), contentType: this.mimeType, path: this.previousPath });
}
if (actual !== void 0) {
writeFileSync(this.actualPath, actual);
step?._attachToStep({ name: (0, import_util.addSuffixToFilePath)(this.attachmentBaseName, "-actual"), contentType: this.mimeType, path: this.actualPath });
}
if (diff !== void 0) {
writeFileSync(this.diffPath, diff);
step?._attachToStep({ name: (0, import_util.addSuffixToFilePath)(this.attachmentBaseName, "-diff"), contentType: this.mimeType, path: this.diffPath });
}
if (log?.length)
output.push((0, import_util.callLogText)(log));
else
output.push("");
return this.createMatcherResult(output.join("\n"), false, log);
}
handleMatching() {
return this.createMatcherResult("", true);
}
}
function toMatchSnapshot(received, nameOrOptions = {}, optOptions = {}) {
const testInfo = (0, import_globals.currentTestInfo)();
if (!testInfo)
throw new Error(`toMatchSnapshot() must be called during the test`);
if (received instanceof Promise)
throw new Error("An unresolved Promise was passed to toMatchSnapshot(), make sure to resolve it by adding await to it.");
if (testInfo._projectInternal.ignoreSnapshots)
return { pass: !this.isNot, message: () => "", name: "toMatchSnapshot", expected: nameOrOptions };
const configOptions = testInfo._projectInternal.expect?.toMatchSnapshot || {};
const helper = new SnapshotHelper(
testInfo,
"toMatchSnapshot",
void 0,
"." + determineFileExtension(received),
configOptions,
nameOrOptions,
optOptions
);
if (this.isNot) {
if (!import_fs.default.existsSync(helper.expectedPath))
return helper.handleMissingNegated();
const isDifferent = !!helper.comparator(received, import_fs.default.readFileSync(helper.expectedPath), helper.options);
return isDifferent ? helper.handleDifferentNegated() : helper.handleMatchingNegated();
}
if (!import_fs.default.existsSync(helper.expectedPath))
return helper.handleMissing(received, this._stepInfo);
const expected = import_fs.default.readFileSync(helper.expectedPath);
if (helper.updateSnapshots === "all") {
if (!(0, import_utils.compareBuffersOrStrings)(received, expected))
return helper.handleMatching();
writeFileSync(helper.expectedPath, received);
console.log(helper.expectedPath + " is not the same, writing actual.");
return helper.createMatcherResult(helper.expectedPath + " running with --update-snapshots, writing actual.", true);
}
if (helper.updateSnapshots === "changed") {
const result2 = helper.comparator(received, expected, helper.options);
if (!result2)
return helper.handleMatching();
writeFileSync(helper.expectedPath, received);
console.log(helper.expectedPath + " does not match, writing actual.");
return helper.createMatcherResult(helper.expectedPath + " running with --update-snapshots, writing actual.", true);
}
const result = helper.comparator(received, expected, helper.options);
if (!result)
return helper.handleMatching();
const receiver = (0, import_utils.isString)(received) ? "string" : "Buffer";
const header = (0, import_matcherHint.matcherHint)(this, void 0, "toMatchSnapshot", receiver, void 0, void 0, void 0);
return helper.handleDifferent(received, expected, void 0, result.diff, header, result.errorMessage, void 0, this._stepInfo);
}
function toHaveScreenshotStepTitle(nameOrOptions = {}, optOptions = {}) {
let name;
if (typeof nameOrOptions === "object" && !Array.isArray(nameOrOptions))
name = nameOrOptions.name;
else
name = nameOrOptions;
return Array.isArray(name) ? name.join(import_path.default.sep) : name || "";
}
async function toHaveScreenshot(pageOrLocator, nameOrOptions = {}, optOptions = {}) {
const testInfo = (0, import_globals.currentTestInfo)();
if (!testInfo)
throw new Error(`toHaveScreenshot() must be called during the test`);
if (testInfo._projectInternal.ignoreSnapshots)
return { pass: !this.isNot, message: () => "", name: "toHaveScreenshot", expected: nameOrOptions };
(0, import_util.expectTypes)(pageOrLocator, ["Page", "Locator"], "toHaveScreenshot");
const [page, locator] = pageOrLocator.constructor.name === "Page" ? [pageOrLocator, void 0] : [pageOrLocator.page(), pageOrLocator];
const configOptions = testInfo._projectInternal.expect?.toHaveScreenshot || {};
const helper = new SnapshotHelper(testInfo, "toHaveScreenshot", locator, void 0, configOptions, nameOrOptions, optOptions);
if (!helper.expectedPath.toLowerCase().endsWith(".png"))
throw new Error(`Screenshot name "${import_path.default.basename(helper.expectedPath)}" must have '.png' extension`);
(0, import_util.expectTypes)(pageOrLocator, ["Page", "Locator"], "toHaveScreenshot");
const style = await loadScreenshotStyles(helper.options.stylePath);
const timeout = helper.options.timeout ?? this.timeout;
const expectScreenshotOptions = {
locator,
animations: helper.options.animations ?? "disabled",
caret: helper.options.caret ?? "hide",
clip: helper.options.clip,
fullPage: helper.options.fullPage,
mask: helper.options.mask,
maskColor: helper.options.maskColor,
omitBackground: helper.options.omitBackground,
scale: helper.options.scale ?? "css",
style,
isNot: !!this.isNot,
timeout,
comparator: helper.options.comparator,
maxDiffPixels: helper.options.maxDiffPixels,
maxDiffPixelRatio: helper.options.maxDiffPixelRatio,
threshold: helper.options.threshold
};
const hasSnapshot = import_fs.default.existsSync(helper.expectedPath);
if (this.isNot) {
if (!hasSnapshot)
return helper.handleMissingNegated();
expectScreenshotOptions.expected = await import_fs.default.promises.readFile(helper.expectedPath);
const isDifferent = !(await page._expectScreenshot(expectScreenshotOptions)).errorMessage;
return isDifferent ? helper.handleDifferentNegated() : helper.handleMatchingNegated();
}
if (helper.updateSnapshots === "none" && !hasSnapshot)
return helper.createMatcherResult(`A snapshot doesn't exist at ${helper.expectedPath}.`, false);
const receiver = locator ? "locator" : "page";
if (!hasSnapshot) {
const { actual: actual2, previous: previous2, diff: diff2, errorMessage: errorMessage2, log: log2, timedOut: timedOut2 } = await page._expectScreenshot(expectScreenshotOptions);
if (errorMessage2) {
const header2 = (0, import_matcherHint.matcherHint)(this, locator, "toHaveScreenshot", receiver, void 0, void 0, timedOut2 ? timeout : void 0);
return helper.handleDifferent(actual2, void 0, previous2, diff2, header2, errorMessage2, log2, this._stepInfo);
}
return helper.handleMissing(actual2, this._stepInfo);
}
const expected = await import_fs.default.promises.readFile(helper.expectedPath);
expectScreenshotOptions.expected = helper.updateSnapshots === "all" ? void 0 : expected;
const { actual, previous, diff, errorMessage, log, timedOut } = await page._expectScreenshot(expectScreenshotOptions);
const writeFiles = () => {
writeFileSync(helper.expectedPath, actual);
writeFileSync(helper.actualPath, actual);
console.log(helper.expectedPath + " is re-generated, writing actual.");
return helper.createMatcherResult(helper.expectedPath + " running with --update-snapshots, writing actual.", true);
};
if (!errorMessage) {
if (helper.updateSnapshots === "all" && actual && (0, import_utils.compareBuffersOrStrings)(actual, expected)) {
console.log(helper.expectedPath + " is re-generated, writing actual.");
return writeFiles();
}
return helper.handleMatching();
}
if (helper.updateSnapshots === "changed" || helper.updateSnapshots === "all")
return writeFiles();
const header = (0, import_matcherHint.matcherHint)(this, void 0, "toHaveScreenshot", receiver, void 0, void 0, timedOut ? timeout : void 0);
return helper.handleDifferent(actual, expectScreenshotOptions.expected, previous, diff, header, errorMessage, log, this._stepInfo);
}
function writeFileSync(aPath, content) {
import_fs.default.mkdirSync(import_path.default.dirname(aPath), { recursive: true });
import_fs.default.writeFileSync(aPath, content);
}
function indent(lines, tab) {
return lines.replace(/^(?=.+$)/gm, tab);
}
function determineFileExtension(file) {
if (typeof file === "string")
return "txt";
if (compareMagicBytes(file, [137, 80, 78, 71, 13, 10, 26, 10]))
return "png";
if (compareMagicBytes(file, [255, 216, 255]))
return "jpg";
return "dat";
}
function compareMagicBytes(file, magicBytes) {
return Buffer.compare(Buffer.from(magicBytes), file.slice(0, magicBytes.length)) === 0;
}
async function loadScreenshotStyles(stylePath) {
if (!stylePath)
return;
const stylePaths = Array.isArray(stylePath) ? stylePath : [stylePath];
const styles = await Promise.all(stylePaths.map(async (stylePath2) => {
const text = await import_fs.default.promises.readFile(stylePath2, "utf8");
return text.trim();
}));
return styles.join("\n").trim() || void 0;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
toHaveScreenshot,
toHaveScreenshotStepTitle,
toMatchSnapshot
});
+105
View File
@@ -0,0 +1,105 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var toMatchText_exports = {};
__export(toMatchText_exports, {
toMatchText: () => toMatchText
});
module.exports = __toCommonJS(toMatchText_exports);
var import_utils = require("playwright-core/lib/utils");
var import_util = require("../util");
var import_expect = require("./expect");
var import_matcherHint = require("./matcherHint");
var import_expectBundle = require("../common/expectBundle");
async function toMatchText(matcherName, receiver, receiverType, query, expected, options = {}) {
(0, import_util.expectTypes)(receiver, [receiverType], matcherName);
const matcherOptions = {
isNot: this.isNot,
promise: this.promise
};
if (!(typeof expected === "string") && !(expected && typeof expected.test === "function")) {
throw new Error([
(0, import_matcherHint.matcherHint)(this, receiverType === "Locator" ? receiver : void 0, matcherName, options.receiverLabel ?? receiver, expected, matcherOptions, void 0, void 0, true),
`${import_utils.colors.bold("Matcher error")}: ${(0, import_expectBundle.EXPECTED_COLOR)("expected")} value must be a string or regular expression`,
this.utils.printWithType("Expected", expected, this.utils.printExpected)
].join("\n\n"));
}
const timeout = options.timeout ?? this.timeout;
const { matches: pass, received, log, timedOut } = await query(!!this.isNot, timeout);
if (pass === !this.isNot) {
return {
name: matcherName,
message: () => "",
pass,
expected
};
}
const stringSubstring = options.matchSubstring ? "substring" : "string";
const receivedString = received || "";
const notFound = received === import_matcherHint.kNoElementsFoundError;
let printedReceived;
let printedExpected;
let printedDiff;
if (pass) {
if (typeof expected === "string") {
if (notFound) {
printedExpected = `Expected ${stringSubstring}: not ${this.utils.printExpected(expected)}`;
printedReceived = `Received: ${received}`;
} else {
printedExpected = `Expected ${stringSubstring}: not ${this.utils.printExpected(expected)}`;
const formattedReceived = (0, import_expect.printReceivedStringContainExpectedSubstring)(receivedString, receivedString.indexOf(expected), expected.length);
printedReceived = `Received string: ${formattedReceived}`;
}
} else {
if (notFound) {
printedExpected = `Expected pattern: not ${this.utils.printExpected(expected)}`;
printedReceived = `Received: ${received}`;
} else {
printedExpected = `Expected pattern: not ${this.utils.printExpected(expected)}`;
const formattedReceived = (0, import_expect.printReceivedStringContainExpectedResult)(receivedString, typeof expected.exec === "function" ? expected.exec(receivedString) : null);
printedReceived = `Received string: ${formattedReceived}`;
}
}
} else {
const labelExpected = `Expected ${typeof expected === "string" ? stringSubstring : "pattern"}`;
if (notFound) {
printedExpected = `${labelExpected}: ${this.utils.printExpected(expected)}`;
printedReceived = `Received: ${received}`;
} else {
printedDiff = this.utils.printDiffOrStringify(expected, receivedString, labelExpected, "Received string", false);
}
}
const message = () => {
const resultDetails = printedDiff ? printedDiff : printedExpected + "\n" + printedReceived;
const hints = (0, import_matcherHint.matcherHint)(this, receiverType === "Locator" ? receiver : void 0, matcherName, options.receiverLabel ?? "locator", void 0, matcherOptions, timedOut ? timeout : void 0, resultDetails, true);
return hints + (0, import_util.callLogText)(log);
};
return {
name: matcherName,
expected,
message,
pass,
actual: received,
log,
timeout: timedOut ? timeout : void 0
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
toMatchText
});
+59
View File
@@ -0,0 +1,59 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var bundle_exports = {};
__export(bundle_exports, {
CallToolRequestSchema: () => CallToolRequestSchema,
Client: () => Client,
ListRootsRequestSchema: () => ListRootsRequestSchema,
ListToolsRequestSchema: () => ListToolsRequestSchema,
PingRequestSchema: () => PingRequestSchema,
SSEServerTransport: () => SSEServerTransport,
Server: () => Server,
StdioServerTransport: () => StdioServerTransport,
StreamableHTTPServerTransport: () => StreamableHTTPServerTransport,
z: () => z,
zodToJsonSchema: () => zodToJsonSchema
});
module.exports = __toCommonJS(bundle_exports);
const bundle = require("./mcpBundleImpl");
const zodToJsonSchema = require("./mcpBundleImpl").zodToJsonSchema;
const Client = bundle.Client;
const Server = bundle.Server;
const SSEServerTransport = bundle.SSEServerTransport;
const StdioServerTransport = bundle.StdioServerTransport;
const StreamableHTTPServerTransport = bundle.StreamableHTTPServerTransport;
const CallToolRequestSchema = bundle.CallToolRequestSchema;
const ListRootsRequestSchema = bundle.ListRootsRequestSchema;
const ListToolsRequestSchema = bundle.ListToolsRequestSchema;
const PingRequestSchema = bundle.PingRequestSchema;
const z = bundle.z;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
CallToolRequestSchema,
Client,
ListRootsRequestSchema,
ListToolsRequestSchema,
PingRequestSchema,
SSEServerTransport,
Server,
StdioServerTransport,
StreamableHTTPServerTransport,
z,
zodToJsonSchema
});
+30
View File
@@ -0,0 +1,30 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var exports_exports = {};
module.exports = __toCommonJS(exports_exports);
__reExport(exports_exports, require("./inProcessTransport.js"), module.exports);
__reExport(exports_exports, require("./proxyBackend.js"), module.exports);
__reExport(exports_exports, require("./server.js"), module.exports);
__reExport(exports_exports, require("./tool.js"), module.exports);
__reExport(exports_exports, require("./transport.js"), module.exports);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
...require("./inProcessTransport.js"),
...require("./proxyBackend.js"),
...require("./server.js"),
...require("./tool.js"),
...require("./transport.js")
});
+71
View File
@@ -0,0 +1,71 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var inProcessTransport_exports = {};
__export(inProcessTransport_exports, {
InProcessTransport: () => InProcessTransport
});
module.exports = __toCommonJS(inProcessTransport_exports);
class InProcessTransport {
constructor(server) {
this._connected = false;
this._server = server;
this._serverTransport = new InProcessServerTransport(this);
}
async start() {
if (this._connected)
throw new Error("InprocessTransport already started!");
await this._server.connect(this._serverTransport);
this._connected = true;
}
async send(message, options) {
if (!this._connected)
throw new Error("Transport not connected");
this._serverTransport._receiveFromClient(message);
}
async close() {
if (this._connected) {
this._connected = false;
this.onclose?.();
this._serverTransport.onclose?.();
}
}
_receiveFromServer(message, extra) {
this.onmessage?.(message, extra);
}
}
class InProcessServerTransport {
constructor(clientTransport) {
this._clientTransport = clientTransport;
}
async start() {
}
async send(message, options) {
this._clientTransport._receiveFromServer(message);
}
async close() {
this.onclose?.();
}
_receiveFromClient(message) {
this.onmessage?.(message);
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
InProcessTransport
});
+123
View File
@@ -0,0 +1,123 @@
"use strict";
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 __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);
var proxyBackend_exports = {};
__export(proxyBackend_exports, {
ProxyBackend: () => ProxyBackend
});
module.exports = __toCommonJS(proxyBackend_exports);
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
var mcpBundle = __toESM(require("./bundle"));
const errorsDebug = (0, import_utilsBundle.debug)("pw:mcp:errors");
class ProxyBackend {
constructor(name, version, mcpProviders) {
this._roots = [];
this.name = name;
this.version = version;
this._mcpProviders = mcpProviders;
this._contextSwitchTool = this._defineContextSwitchTool();
}
async initialize(clientVersion, roots) {
this._roots = roots;
await this._setCurrentClient(this._mcpProviders[0]);
}
async listTools() {
const response = await this._currentClient.listTools();
if (this._mcpProviders.length === 1)
return response.tools;
return [
...response.tools,
this._contextSwitchTool
];
}
async callTool(name, args) {
if (name === this._contextSwitchTool.name)
return this._callContextSwitchTool(args);
return await this._currentClient.callTool({
name,
arguments: args
});
}
serverClosed() {
void this._currentClient?.close().catch(errorsDebug);
}
async _callContextSwitchTool(params) {
try {
const factory = this._mcpProviders.find((factory2) => factory2.name === params.name);
if (!factory)
throw new Error("Unknown connection method: " + params.name);
await this._setCurrentClient(factory);
return {
content: [{ type: "text", text: "### Result\nSuccessfully changed connection method.\n" }]
};
} catch (error) {
return {
content: [{ type: "text", text: `### Result
Error: ${error}
` }],
isError: true
};
}
}
_defineContextSwitchTool() {
return {
name: "browser_connect",
description: [
"Connect to a browser using one of the available methods:",
...this._mcpProviders.map((factory) => `- "${factory.name}": ${factory.description}`)
].join("\n"),
inputSchema: mcpBundle.zodToJsonSchema(mcpBundle.z.object({
name: mcpBundle.z.enum(this._mcpProviders.map((factory) => factory.name)).default(this._mcpProviders[0].name).describe("The method to use to connect to the browser")
}), { strictUnions: true }),
annotations: {
title: "Connect to a browser context",
readOnlyHint: true,
openWorldHint: false
}
};
}
async _setCurrentClient(factory) {
await this._currentClient?.close();
this._currentClient = void 0;
const client = new mcpBundle.Client({ name: this.name, version: this.version });
client.registerCapabilities({
roots: {
listRoots: true
}
});
client.setRequestHandler(mcpBundle.ListRootsRequestSchema, () => ({ roots: this._roots }));
client.setRequestHandler(mcpBundle.PingRequestSchema, () => ({}));
const transport = await factory.connect();
await client.connect(transport);
this._currentClient = client;
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
ProxyBackend
});
+118
View File
@@ -0,0 +1,118 @@
"use strict";
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 __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);
var server_exports = {};
__export(server_exports, {
connect: () => connect,
createServer: () => createServer
});
module.exports = __toCommonJS(server_exports);
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
var mcpBundle = __toESM(require("./bundle"));
const serverDebug = (0, import_utilsBundle.debug)("pw:mcp:server");
const errorsDebug = (0, import_utilsBundle.debug)("pw:mcp:errors");
async function connect(serverBackendFactory, transport, runHeartbeat) {
const backend = serverBackendFactory();
const server = createServer(backend, runHeartbeat);
await server.connect(transport);
}
function createServer(backend, runHeartbeat) {
let initializedCallback = () => {
};
const initializedPromise = new Promise((resolve) => initializedCallback = resolve);
const server = new mcpBundle.Server({ name: backend.name, version: backend.version }, {
capabilities: {
tools: {}
}
});
server.setRequestHandler(mcpBundle.ListToolsRequestSchema, async () => {
serverDebug("listTools");
await initializedPromise;
const tools = await backend.listTools();
return { tools };
});
let heartbeatRunning = false;
server.setRequestHandler(mcpBundle.CallToolRequestSchema, async (request) => {
serverDebug("callTool", request);
await initializedPromise;
if (runHeartbeat && !heartbeatRunning) {
heartbeatRunning = true;
startHeartbeat(server);
}
try {
return await backend.callTool(request.params.name, request.params.arguments || {});
} catch (error) {
return {
content: [{ type: "text", text: "### Result\n" + String(error) }],
isError: true
};
}
});
addServerListener(server, "initialized", async () => {
try {
const capabilities = server.getClientCapabilities();
let clientRoots = [];
if (capabilities?.roots) {
const { roots } = await server.listRoots(void 0, { timeout: 2e3 }).catch(() => ({ roots: [] }));
clientRoots = roots;
}
const clientVersion = server.getClientVersion() ?? { name: "unknown", version: "unknown" };
await backend.initialize?.(clientVersion, clientRoots);
initializedCallback();
} catch (e) {
errorsDebug(e);
}
});
addServerListener(server, "close", () => backend.serverClosed?.());
return server;
}
const startHeartbeat = (server) => {
const beat = () => {
Promise.race([
server.ping(),
new Promise((_, reject) => setTimeout(() => reject(new Error("ping timeout")), 5e3))
]).then(() => {
setTimeout(beat, 3e3);
}).catch(() => {
void server.close();
});
};
beat();
};
function addServerListener(server, event, listener) {
const oldListener = server[`on${event}`];
server[`on${event}`] = () => {
oldListener?.();
listener();
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
connect,
createServer
});
+41
View File
@@ -0,0 +1,41 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var tool_exports = {};
__export(tool_exports, {
toMcpTool: () => toMcpTool
});
module.exports = __toCommonJS(tool_exports);
var import_bundle = require("./bundle");
function toMcpTool(tool) {
return {
name: tool.name,
description: tool.description,
inputSchema: (0, import_bundle.zodToJsonSchema)(tool.inputSchema, { strictUnions: true }),
annotations: {
title: tool.title,
readOnlyHint: tool.type === "readOnly",
destructiveHint: tool.type === "destructive",
openWorldHint: true
}
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
toMcpTool
});
+161
View File
@@ -0,0 +1,161 @@
"use strict";
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 __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);
var transport_exports = {};
__export(transport_exports, {
start: () => start
});
module.exports = __toCommonJS(transport_exports);
var import_assert = __toESM(require("assert"));
var import_http = __toESM(require("http"));
var import_crypto = __toESM(require("crypto"));
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
var mcpBundle = __toESM(require("./bundle"));
var mcpServer = __toESM(require("./server"));
async function start(serverBackendFactory, options) {
if (options.port !== void 0) {
const httpServer = await startHttpServer(options);
startHttpTransport(httpServer, serverBackendFactory);
} else {
await startStdioTransport(serverBackendFactory);
}
}
async function startStdioTransport(serverBackendFactory) {
await mcpServer.connect(serverBackendFactory, new mcpBundle.StdioServerTransport(), false);
}
const testDebug = (0, import_utilsBundle.debug)("pw:mcp:test");
async function handleSSE(serverBackendFactory, req, res, url, sessions) {
if (req.method === "POST") {
const sessionId = url.searchParams.get("sessionId");
if (!sessionId) {
res.statusCode = 400;
return res.end("Missing sessionId");
}
const transport = sessions.get(sessionId);
if (!transport) {
res.statusCode = 404;
return res.end("Session not found");
}
return await transport.handlePostMessage(req, res);
} else if (req.method === "GET") {
const transport = new mcpBundle.SSEServerTransport("/sse", res);
sessions.set(transport.sessionId, transport);
testDebug(`create SSE session: ${transport.sessionId}`);
await mcpServer.connect(serverBackendFactory, transport, false);
res.on("close", () => {
testDebug(`delete SSE session: ${transport.sessionId}`);
sessions.delete(transport.sessionId);
});
return;
}
res.statusCode = 405;
res.end("Method not allowed");
}
async function handleStreamable(serverBackendFactory, req, res, sessions) {
const sessionId = req.headers["mcp-session-id"];
if (sessionId) {
const transport = sessions.get(sessionId);
if (!transport) {
res.statusCode = 404;
res.end("Session not found");
return;
}
return await transport.handleRequest(req, res);
}
if (req.method === "POST") {
const transport = new mcpBundle.StreamableHTTPServerTransport({
sessionIdGenerator: () => import_crypto.default.randomUUID(),
onsessioninitialized: async (sessionId2) => {
testDebug(`create http session: ${transport.sessionId}`);
await mcpServer.connect(serverBackendFactory, transport, true);
sessions.set(sessionId2, transport);
}
});
transport.onclose = () => {
if (!transport.sessionId)
return;
sessions.delete(transport.sessionId);
testDebug(`delete http session: ${transport.sessionId}`);
};
await transport.handleRequest(req, res);
return;
}
res.statusCode = 400;
res.end("Invalid request");
}
function startHttpTransport(httpServer, serverBackendFactory) {
const sseSessions = /* @__PURE__ */ new Map();
const streamableSessions = /* @__PURE__ */ new Map();
httpServer.on("request", async (req, res) => {
const url2 = new URL(`http://localhost${req.url}`);
if (url2.pathname.startsWith("/sse"))
await handleSSE(serverBackendFactory, req, res, url2, sseSessions);
else
await handleStreamable(serverBackendFactory, req, res, streamableSessions);
});
const url = httpAddressToString(httpServer.address());
const message = [
`Listening on ${url}`,
"Put this in your client config:",
JSON.stringify({
"mcpServers": {
"playwright": {
"url": `${url}/mcp`
}
}
}, void 0, 2),
"For legacy SSE transport support, you can use the /sse endpoint instead."
].join("\n");
console.error(message);
}
async function startHttpServer(config) {
const { host, port } = config;
const httpServer = import_http.default.createServer();
await new Promise((resolve, reject) => {
httpServer.on("error", reject);
httpServer.listen(port, host, () => {
resolve();
httpServer.removeListener("error", reject);
});
});
return httpServer;
}
function httpAddressToString(address) {
(0, import_assert.default)(address, "Could not bind server socket");
if (typeof address === "string")
return address;
const resolvedPort = address.port;
let resolvedHost = address.family === "IPv4" ? address.address : `[${address.address}]`;
if (resolvedHost === "0.0.0.0" || resolvedHost === "[::]")
resolvedHost = "localhost";
return `http://${resolvedHost}:${resolvedPort}`;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
start
});
+94
View File
@@ -0,0 +1,94 @@
"use strict";var _f=Object.create;var oa=Object.defineProperty;var xf=Object.getOwnPropertyDescriptor;var Ef=Object.getOwnPropertyNames;var wf=Object.getPrototypeOf,Sf=Object.prototype.hasOwnProperty;var $=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),_i=(a,e)=>{for(var t in e)oa(a,t,{get:e[t],enumerable:!0})},xi=(a,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ef(e))!Sf.call(a,r)&&r!==t&&oa(a,r,{get:()=>e[r],enumerable:!(s=xf(e,r))||s.enumerable});return a};var zr=(a,e,t)=>(t=a!=null?_f(wf(a)):{},xi(e||!a||!a.__esModule?oa(t,"default",{value:a,enumerable:!0}):t,a)),Pf=a=>xi(oa({},"__esModule",{value:!0}),a);var Ki=$((Ea,Gi)=>{(function(a,e){typeof Ea=="object"&&typeof Gi!="undefined"?e(Ea):typeof define=="function"&&define.amd?define(["exports"],e):e(a.URI=a.URI||{})})(Ea,function(a){"use strict";function e(){for(var v=arguments.length,h=Array(v),b=0;b<v;b++)h[b]=arguments[b];if(h.length>1){h[0]=h[0].slice(0,-1);for(var E=h.length-1,w=1;w<E;++w)h[w]=h[w].slice(1,-1);return h[E]=h[E].slice(1),h.join("")}else return h[0]}function t(v){return"(?:"+v+")"}function s(v){return v===void 0?"undefined":v===null?"null":Object.prototype.toString.call(v).split(" ").pop().split("]").shift().toLowerCase()}function r(v){return v.toUpperCase()}function n(v){return v!=null?v instanceof Array?v:typeof v.length!="number"||v.split||v.setInterval||v.call?[v]:Array.prototype.slice.call(v):[]}function i(v,h){var b=v;if(h)for(var E in h)b[E]=h[E];return b}function o(v){var h="[A-Za-z]",b="[\\x0D]",E="[0-9]",w="[\\x22]",F=e(E,"[A-Fa-f]"),K="[\\x0A]",se="[\\x20]",ce=t(t("%[EFef]"+F+"%"+F+F+"%"+F+F)+"|"+t("%[89A-Fa-f]"+F+"%"+F+F)+"|"+t("%"+F+F)),xe="[\\:\\/\\?\\#\\[\\]\\@]",ae="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",pe=e(xe,ae),Ee=v?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",de=v?"[\\uE000-\\uF8FF]":"[]",ie=e(h,E,"[\\-\\.\\_\\~]",Ee),me=t(h+e(h,E,"[\\+\\-\\.]")+"*"),ue=t(t(ce+"|"+e(ie,ae,"[\\:]"))+"*"),Mr=t(t("25[0-5]")+"|"+t("2[0-4]"+E)+"|"+t("1"+E+E)+"|"+t("[1-9]"+E)+"|"+E),Ue=t(t("25[0-5]")+"|"+t("2[0-4]"+E)+"|"+t("1"+E+E)+"|"+t("0?[1-9]"+E)+"|0?0?"+E),He=t(Ue+"\\."+Ue+"\\."+Ue+"\\."+Ue),fe=t(F+"{1,4}"),ze=t(t(fe+"\\:"+fe)+"|"+He),Ze=t(t(fe+"\\:")+"{6}"+ze),cr=t("\\:\\:"+t(fe+"\\:")+"{5}"+ze),Br=t(t(fe)+"?\\:\\:"+t(fe+"\\:")+"{4}"+ze),vr=t(t(t(fe+"\\:")+"{0,1}"+fe)+"?\\:\\:"+t(fe+"\\:")+"{3}"+ze),Bt=t(t(t(fe+"\\:")+"{0,2}"+fe)+"?\\:\\:"+t(fe+"\\:")+"{2}"+ze),sa=t(t(t(fe+"\\:")+"{0,3}"+fe)+"?\\:\\:"+fe+"\\:"+ze),na=t(t(t(fe+"\\:")+"{0,4}"+fe)+"?\\:\\:"+ze),vt=t(t(t(fe+"\\:")+"{0,5}"+fe)+"?\\:\\:"+fe),gt=t(t(t(fe+"\\:")+"{0,6}"+fe)+"?\\:\\:"),gr=t([Ze,cr,Br,vr,Bt,sa,na,vt,gt].join("|")),yt=t(t(ie+"|"+ce)+"+"),ms=t(gr+"\\%25"+yt),Ur=t(gr+t("\\%25|\\%(?!"+F+"{2})")+yt),hf=t("[vV]"+F+"+\\."+e(ie,ae,"[\\:]")+"+"),pf=t("\\["+t(Ur+"|"+gr+"|"+hf)+"\\]"),vi=t(t(ce+"|"+e(ie,ae))+"*"),Ut=t(pf+"|"+He+"(?!"+vi+")|"+vi),zt=t(E+"*"),gi=t(t(ue+"@")+"?"+Ut+t("\\:"+zt)+"?"),Vt=t(ce+"|"+e(ie,ae,"[\\:\\@]")),mf=t(Vt+"*"),yi=t(Vt+"+"),vf=t(t(ce+"|"+e(ie,ae,"[\\@]"))+"+"),yr=t(t("\\/"+mf)+"*"),bt=t("\\/"+t(yi+yr)+"?"),vs=t(vf+yr),ia=t(yi+yr),_t="(?!"+Vt+")",x0=t(yr+"|"+bt+"|"+vs+"|"+ia+"|"+_t),xt=t(t(Vt+"|"+e("[\\/\\?]",de))+"*"),Ht=t(t(Vt+"|[\\/\\?]")+"*"),bi=t(t("\\/\\/"+gi+yr)+"|"+bt+"|"+ia+"|"+_t),gf=t(me+"\\:"+bi+t("\\?"+xt)+"?"+t("\\#"+Ht)+"?"),yf=t(t("\\/\\/"+gi+yr)+"|"+bt+"|"+vs+"|"+_t),bf=t(yf+t("\\?"+xt)+"?"+t("\\#"+Ht)+"?"),E0=t(gf+"|"+bf),w0=t(me+"\\:"+bi+t("\\?"+xt)+"?"),S0="^("+me+")\\:"+t(t("\\/\\/("+t("("+ue+")@")+"?("+Ut+")"+t("\\:("+zt+")")+"?)")+"?("+yr+"|"+bt+"|"+ia+"|"+_t+")")+t("\\?("+xt+")")+"?"+t("\\#("+Ht+")")+"?$",P0="^(){0}"+t(t("\\/\\/("+t("("+ue+")@")+"?("+Ut+")"+t("\\:("+zt+")")+"?)")+"?("+yr+"|"+bt+"|"+vs+"|"+_t+")")+t("\\?("+xt+")")+"?"+t("\\#("+Ht+")")+"?$",R0="^("+me+")\\:"+t(t("\\/\\/("+t("("+ue+")@")+"?("+Ut+")"+t("\\:("+zt+")")+"?)")+"?("+yr+"|"+bt+"|"+ia+"|"+_t+")")+t("\\?("+xt+")")+"?$",T0="^"+t("\\#("+Ht+")")+"?$",O0="^"+t("("+ue+")@")+"?("+Ut+")"+t("\\:("+zt+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",h,E,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",ie,ae),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",ie,ae),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",ie,ae),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",ie,ae),"g"),NOT_QUERY:new RegExp(e("[^\\%]",ie,ae,"[\\:\\@\\/\\?]",de),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",ie,ae,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",ie,ae),"g"),UNRESERVED:new RegExp(ie,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",ie,pe),"g"),PCT_ENCODED:new RegExp(ce,"g"),IPV4ADDRESS:new RegExp("^("+He+")$"),IPV6ADDRESS:new RegExp("^\\[?("+gr+")"+t(t("\\%25|\\%(?!"+F+"{2})")+"("+yt+")")+"?\\]?$")}}var c=o(!1),u=o(!0),d=function(){function v(h,b){var E=[],w=!0,F=!1,K=void 0;try{for(var se=h[Symbol.iterator](),ce;!(w=(ce=se.next()).done)&&(E.push(ce.value),!(b&&E.length===b));w=!0);}catch(xe){F=!0,K=xe}finally{try{!w&&se.return&&se.return()}finally{if(F)throw K}}return E}return function(h,b){if(Array.isArray(h))Line truncated
at `+a[t].toString();return e}function um(a){if(!a)throw new TypeError("argument namespace is required");var e=Va(),t=Dt(e[1]),s=t[0];function r(n){za.call(r,n)}return r._file=s,r._ignored=dm(a),r._namespace=a,r._traced=hm(a),r._warned=Object.create(null),r.function=gm,r.property=ym,r}function fm(a,e){var t=typeof a.listenerCount!="function"?a.listeners(e).length:a.listenerCount(e);return t>0}function dm(a){if(process.noDeprecation)return!0;var e=process.env.NO_DEPRECATION||"";return tl(e,a)}function hm(a){if(process.traceDeprecation)return!0;var e=process.env.TRACE_DEPRECATION||"";return tl(e,a)}function za(a,e){var t=fm(process,"deprecation");if(!(!t&&this._ignored)){var s,r,n,i,o=0,c=!1,u=Va(),d=this._file;for(e?(i=e,n=Dt(u[1]),n.name=i.name,d=n[0]):(o=2,i=Dt(u[o]),n=i);o<u.length;o++)if(s=Dt(u[o]),r=s[0],r===d)c=!0;else if(r===this._file)d=this._file;else if(c)break;var p=s?i.join(":")+"__"+s.join(":"):void 0;if(!(p!==void 0&&p in this._warned)){this._warned[p]=!0;var m=a;if(m||(m=n===i||!n.name?rl(i):rl(n)),t){var f=al(this._namespace,m,u.slice(o));process.emit("deprecation",f);return}var g=process.stderr.isTTY?mm:pm,_=g.call(this,m,s,u.slice(o));process.stderr.write(_+`
`,"utf8")}}}function Dt(a){var e=a.getFileName()||"<anonymous>",t=a.getLineNumber(),s=a.getColumnNumber();a.isEval()&&(e=a.getEvalOrigin()+", "+e);var r=[e,t,s];return r.callSite=a,r.name=a.getFunctionName(),r}function rl(a){var e=a.callSite,t=a.name;t||(t="<anonymous@"+fn(a)+">");var s=e.getThis(),r=s&&e.getTypeName();return r==="Object"&&(r=void 0),r==="Function"&&(r=s.name||r),r&&e.getMethodName()?r+"."+t:t}function pm(a,e,t){var s=new Date().toUTCString(),r=s+" "+this._namespace+" deprecated "+a;if(this._traced){for(var n=0;n<t.length;n++)r+=`
at `+t[n].toString();return r}return e&&(r+=" at "+fn(e)),r}function mm(a,e,t){var s="\x1B[36;1m"+this._namespace+"\x1B[22;39m \x1B[33;1mdeprecated\x1B[22;39m \x1B[0m"+a+"\x1B[39m";if(this._traced){for(var r=0;r<t.length;r++)s+=`
\x1B[36mat `+t[r].toString()+"\x1B[39m";return s}return e&&(s+=" \x1B[36m"+fn(e)+"\x1B[39m"),s}function fn(a){return nm(im,a[0])+":"+a[1]+":"+a[2]}function Va(){var a=Error.stackTraceLimit,e={},t=Error.prepareStackTrace;Error.prepareStackTrace=vm,Error.stackTraceLimit=Math.max(10,a),Error.captureStackTrace(e);var s=e.stack.slice(1);return Error.prepareStackTrace=t,Error.stackTraceLimit=a,s}function vm(a,e){return e}function gm(a,e){if(typeof a!="function")throw new TypeError("argument fn must be a function");var t=cm(a.length),s=Va(),r=Dt(s[1]);r.name=a.name;var n=new Function("fn","log","deprecate","message","site",`"use strict"
return function (`+t+`) {log.call(deprecate, message, site)
return fn.apply(this, arguments)
}`)(a,za,this,e,r);return n}function ym(a,e,t){if(!a||typeof a!="object"&&typeof a!="function")throw new TypeError("argument obj must be object");var s=Object.getOwnPropertyDescriptor(a,e);if(!s)throw new TypeError("must call property on owner object");if(!s.configurable)throw new TypeError("property must be configurable");var r=this,n=Va(),i=Dt(n[1]);i.name=e,"value"in s&&(s=om(a,e,t));var o=s.get,c=s.set;typeof o=="function"&&(s.get=function(){return za.call(r,t,i),o.apply(this,arguments)}),typeof c=="function"&&(s.set=function(){return za.call(r,t,i),c.apply(this,arguments)}),Object.defineProperty(a,e,s)}function al(a,e,t){var s=new Error,r;return Object.defineProperty(s,"constructor",{value:al}),Object.defineProperty(s,"message",{configurable:!0,enumerable:!1,value:e,writable:!0}),Object.defineProperty(s,"name",{enumerable:!1,configurable:!0,value:"DeprecationError",writable:!0}),Object.defineProperty(s,"namespace",{configurable:!0,enumerable:!1,value:a,writable:!0}),Object.defineProperty(s,"stack",{configurable:!0,enumerable:!1,get:function(){return r!==void 0?r:r=lm.call(this,t)},set:function(i){r=i}}),s}});var ol=$((d1,il)=>{"use strict";il.exports=Object.setPrototypeOf||({__proto__:[]}instanceof Array?bm:_m);function bm(a,e){return a.__proto__=e,a}function _m(a,e){for(var t in e)Object.prototype.hasOwnProperty.call(a,t)||(a[t]=e[t]);return a}});var cl=$((h1,xm)=>{xm.exports={"100":"Continue","101":"Switching Protocols","102":"Processing","103":"Early Hints","200":"OK","201":"Created","202":"Accepted","203":"Non-Authoritative Information","204":"No Content","205":"Reset Content","206":"Partial Content","207":"Multi-Status","208":"Already Reported","226":"IM Used","300":"Multiple Choices","301":"Moved Permanently","302":"Found","303":"See Other","304":"Not Modified","305":"Use Proxy","307":"Temporary Redirect","308":"Permanent Redirect","400":"Bad Request","401":"Unauthorized","402":"Payment Required","403":"Forbidden","404":"Not Found","405":"Method Not Allowed","406":"Not Acceptable","407":"Proxy Authentication Required","408":"Request Timeout","409":"Conflict","410":"Gone","411":"Length Required","412":"Precondition Failed","413":"Payload Too Large","414":"URI Too Long","415":"Unsupported Media Type","416":"Range Not Satisfiable","417":"Expectation Failed","418":"I'm a Teapot","421":"Misdirected Request","422":"Unprocessable Entity","423":"Locked","424":"Failed Dependency","425":"Too Early","426":"Upgrade Required","428":"Precondition Required","429":"Too Many Requests","431":"Request Header Fields Too Large","451":"Unavailable For Legal Reasons","500":"Internal Server Error","501":"Not Implemented","502":"Bad Gateway","503":"Service Unavailable","504":"Gateway Timeout","505":"HTTP Version Not Supported","506":"Variant Also Negotiates","507":"Insufficient Storage","508":"Loop Detected","509":"Bandwidth Limit Exceeded","510":"Not Extended","511":"Network Authentication Required"}});var fl=$((p1,ul)=>{"use strict";var dn=cl();ul.exports=ar;ar.message=dn;ar.code=Em(dn);ar.codes=wm(dn);ar.redirect={300:!0,301:!0,302:!0,303:!0,305:!0,307:!0,308:!0};ar.empty={204:!0,205:!0,304:!0};ar.retry={502:!0,503:!0,504:!0};function Em(a){var e={};return Object.keys(a).forEach(function(s){var r=a[s],n=Number(s);e[r.toLowerCase()]=n}),e}function wm(a){return Object.keys(a).map(function(t){return Number(t)})}function Sm(a){var e=a.toLowerCase();if(!Object.prototype.hasOwnProperty.call(ar.code,e))throw new Error('invalid status message: "'+a+'"');return ar.code[e]}function ll(a){if(!Object.prototype.hasOwnProperty.call(ar.message,a))throw new Error("invalid status code: "+a);return ar.message[a]}function ar(a){if(typeof a=="number")return ll(a);if(typeof a!="string")throw new TypeError("code must be a number or string");var e=parseInt(a,10);return isNaN(e)?Sm(a):ll(e)}});var dl=$((m1,hn)=>{typeof Object.create=="function"?hn.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:hn.exports=function(e,t){if(t){e.super_=t;var s=function(){};s.prototype=t.prototype,e.prototype=new s,e.prototype.constructor=e}}});var hl=$((v1,mn)=>{try{if(pn=require("util"),typeof pn.inherits!="function")throw"";mn.exports=pn.inherits}catch{mn.exports=dl()}var pn});var ml=$((g1,pl)=>{"use strict";pl.exports=Pm;function Pm(a){return a.split(" ").map(function(e){return e.slice(0,1).toUpperCase()+e.slice(1)}).join("").replace(/[^ _0-9a-z]/gi,"")}});var _l=$((y1,ft)=>{"use strict";var Rm=nl()("http-errors"),vl=ol(),$t=fl(),vn=hl(),Tm=ml();ft.exports=Ha;ft.exports.HttpError=Om();ft.exports.isHttpError=Im(ft.exports.HttpError);Cm(ft.exports,$t.codes,ft.exports.HttpError);function gl(a){return+(String(a).charAt(0)+"00")}function Ha(){for(var a,e,t=500,s={},r=0;r<arguments.length;r++){var n=arguments[r],i=typeof n;if(i==="object"&&n instanceof Error)a=n,t=a.status||a.statusCode||t;else if(i==="number"&&r===0)t=n;else if(i==="string")e=n;else if(i==="object")s Line truncated
\v\f\r\x1B !"#$\u066A&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~\x7F\xB0\xB7\u2219\u221A\u2592\u2500\u2502\u253C\u2524\u252C\u251C\u2534\u2510\u250C\u2514\u2518\u03B2\u221E\u03C6\xB1\xBD\xBC\u2248\xAB\xBB\uFEF7\uFEF8\uFFFD\uFFFD\uFEFB\uFEFC\uFFFD\xA0\xAD\uFE82\xA3\xA4\uFE84\uFFFD\uFFFD\uFE8E\uFE8F\uFE95\uFE99\u060C\uFE9D\uFEA1\uFEA5\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669\uFED1\u061B\uFEB1\uFEB5\uFEB9\u061F\xA2\uFE80\uFE81\uFE83\uFE85\uFECA\uFE8B\uFE8D\uFE91\uFE93\uFE97\uFE9B\uFE9F\uFEA3\uFEA7\uFEA9\uFEAB\uFEAD\uFEAF\uFEB3\uFEB7\uFEBB\uFEBF\uFEC1\uFEC5\uFECB\uFECF\xA6\xAC\xF7\xD7\uFEC9\u0640\uFED3\uFED7\uFEDB\uFEDF\uFEE3\uFEE7\uFEEB\uFEED\uFEEF\uFEF3\uFEBD\uFECC\uFECE\uFECD\uFEE1\uFE7D\u0651\uFEE5\uFEE9\uFEEC\uFEF0\uFEF2\uFED0\uFED5\uFEF5\uFEF6\uFEDD\uFED9\uFEF1\u25A0\uFFFD`},ibm864:"cp864",csibm864:"cp864",cp865:{type:"_sbcs",chars:"\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xF8\xA3\xD8\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xA4\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"},ibm865:"cp865",csibm865:"cp865",cp866:{type:"_sbcs",chars:"\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F\u0401\u0451\u0404\u0454\u0407\u0457\u040E\u045E\xB0\u2219\xB7\u221A\u2116\xA4\u25A0\xA0"},ibm866:"cp866",csibm866:"cp866",cp869:{type:"_sbcs",chars:"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u0386\uFFFD\xB7\xAC\xA6\u2018\u2019\u0388\u2015\u0389\u038A\u03AA\u038C\uFFFD\uFFFD\u038E\u03AB\xA9\u038F\xB2\xB3\u03AC\xA3\u03AD\u03AE\u03AF\u03CA\u0390\u03CC\u03CD\u0391\u0392\u0393\u0394\u0395\u0396\u0397\xBD\u0398\u0399\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u039A\u039B\u039C\u039D\u2563\u2551\u2557\u255D\u039E\u039F\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u03A0\u03A1\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u03A3\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9\u03B1\u03B2\u03B3\u2518\u250C\u2588\u2584\u03B4\u03B5\u2580\u03B6\u03B7\u03B8\u03B9\u03BA\u03BB\u03BC\u03BD\u03BE\u03BF\u03C0\u03C1\u03C3\u03C2\u03C4\u0384\xAD\xB1\u03C5\u03C6\u03C7\xA7\u03C8\u0385\xB0\xA8\u03C9\u03CB\u03B0\u03CE\u25A0\xA0"},ibm869:"cp869",csibm869:"cp869",cp922:{type:"_sbcs",chars:"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\u203E\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\u0160\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\u017D\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\u0161\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\u017E\xFF"},ibm922:"cp922",csibm922:"cp922",cp1046:{type:"_sbcs",chars:"\uFE88\xD7\xF7\uF8F6\uF8F5\uF8F4\uF8F7\uFE71\x88\u25A0\u2502\u2500\u2510\u250C\u2514\u2518\uFE79\uFE7B\uFE7D\uFE7F\uFE77\uFE8A\uFEF0\uFEF3\uFEF2\uFECE\uFECF\uFED0\uFEF6\uFEF8\uFEFA\uFEFC\xA0\uF8FA\uF8F9\uF8F8\xA4\uF8FB\uFE8B\uFE91\uFE97\uFE9B\uFE9F\uFEA3\u060C\xAD\uFEA7\uFEB3\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669\uFEB7\u061B\uFEBB\uFEBF\uFECA\u061F\uFECB\u0621\u0622\u0623\u0624\u0625\u0626\u0627\u0628\u0629\u062A\u062B\u062C\u062D\u062E\u062F\u0630\u0631\u0632\u0633\u0634\u0635\u0636\u0637\uFEC7\u0639\u063A\uFECC\uFE82\uFE84\uFE8E\uFED3\u0640\u0641\u0642\u0643\u0644\u0645\u0646\u0647\u0648\u0649\u064A\u064B\u064C\u064D\u064E\u064F\u0650\u0651\u0652\uFED7\uFEDB\uFEDF\uF8FC\uFEF5\uFEF7\uFEF9\uFEFB\uFEE3\uFEE7\uFEEC\uFEE9\uFFFD"},ibm1046:"cp1046",csibm1046:"cp1046",cp1124:{type:"_sbcs",chars:"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\u0401\u0402\u0490\u0404\u0405\u0406\u0407\u0408\u0409\u040A\u040B\u040C\xAD\u040E\u040F\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041FLine truncated
\v\f\r\u1EE8\u1EF0\u1EF2\u1EF6\u1EF8\xDD\u1EF4\x1B !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~\x7F\xC0\u1EA2\xC3\xC1\u1EA0\u1EB6\u1EAC\xC8\u1EBA\u1EBC\xC9\u1EB8\u1EC6\xCC\u1EC8\u0128\xCD\u1ECA\xD2\u1ECE\xD5\xD3\u1ECC\u1ED8\u1EDC\u1EDE\u1EE0\u1EDA\u1EE2\xD9\u1EE6\u0168\xA0\u0102\xC2\xCA\xD4\u01A0\u01AF\u0110\u0103\xE2\xEA\xF4\u01A1\u01B0\u0111\u1EB0\u0300\u0309\u0303\u0301\u0323\xE0\u1EA3\xE3\xE1\u1EA1\u1EB2\u1EB1\u1EB3\u1EB5\u1EAF\u1EB4\u1EAE\u1EA6\u1EA8\u1EAA\u1EA4\u1EC0\u1EB7\u1EA7\u1EA9\u1EAB\u1EA5\u1EAD\xE8\u1EC2\u1EBB\u1EBD\xE9\u1EB9\u1EC1\u1EC3\u1EC5\u1EBF\u1EC7\xEC\u1EC9\u1EC4\u1EBE\u1ED2\u0129\xED\u1ECB\xF2\u1ED4\u1ECF\xF5\xF3\u1ECD\u1ED3\u1ED5\u1ED7\u1ED1\u1ED9\u1EDD\u1EDF\u1EE1\u1EDB\u1EE3\xF9\u1ED6\u1EE7\u0169\xFA\u1EE5\u1EEB\u1EED\u1EEF\u1EE9\u1EF1\u1EF3\u1EF7\u1EF9\xFD\u1EF5\u1ED0`},georgianacademy:{type:"_sbcs",chars:"\x80\x81\u201A\u0192\u201E\u2026\u2020\u2021\u02C6\u2030\u0160\u2039\u0152\x8D\x8E\x8F\x90\u2018\u2019\u201C\u201D\u2022\u2013\u2014\u02DC\u2122\u0161\u203A\u0153\x9D\x9E\u0178\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\u10D0\u10D1\u10D2\u10D3\u10D4\u10D5\u10D6\u10D7\u10D8\u10D9\u10DA\u10DB\u10DC\u10DD\u10DE\u10DF\u10E0\u10E1\u10E2\u10E3\u10E4\u10E5\u10E6\u10E7\u10E8\u10E9\u10EA\u10EB\u10EC\u10ED\u10EE\u10EF\u10F0\u10F1\u10F2\u10F3\u10F4\u10F5\u10F6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"},georgianps:{type:"_sbcs",chars:"\x80\x81\u201A\u0192\u201E\u2026\u2020\u2021\u02C6\u2030\u0160\u2039\u0152\x8D\x8E\x8F\x90\u2018\u2019\u201C\u201D\u2022\u2013\u2014\u02DC\u2122\u0161\u203A\u0153\x9D\x9E\u0178\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\u10D0\u10D1\u10D2\u10D3\u10D4\u10D5\u10D6\u10F1\u10D7\u10D8\u10D9\u10DA\u10DB\u10DC\u10F2\u10DD\u10DE\u10DF\u10E0\u10E1\u10E2\u10F3\u10E3\u10E4\u10E5\u10E6\u10E7\u10E8\u10E9\u10EA\u10EB\u10EC\u10ED\u10EE\u10F4\u10EF\u10F0\u10F5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"},pt154:{type:"_sbcs",chars:"\u0496\u0492\u04EE\u0493\u201E\u2026\u04B6\u04AE\u04B2\u04AF\u04A0\u04E2\u04A2\u049A\u04BA\u04B8\u0497\u2018\u2019\u201C\u201D\u2022\u2013\u2014\u04B3\u04B7\u04A1\u04E3\u04A3\u049B\u04BB\u04B9\xA0\u040E\u045E\u0408\u04E8\u0498\u04B0\xA7\u0401\xA9\u04D8\xAB\xAC\u04EF\xAE\u049C\xB0\u04B1\u0406\u0456\u0499\u04E9\xB6\xB7\u0451\u2116\u04D9\xBB\u0458\u04AA\u04AB\u049D\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F"},viscii:{type:"_sbcs",chars:`\0\u1EB2\u1EB4\u1EAA\x07\b
\v\f\r\u1EF6\u1EF8\x1B\u1EF4 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~\x7F\u1EA0\u1EAE\u1EB0\u1EB6\u1EA4\u1EA6\u1EA8\u1EAC\u1EBC\u1EB8\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EE2\u1EDA\u1EDC\u1EDE\u1ECA\u1ECE\u1ECC\u1EC8\u1EE6\u0168\u1EE4\u1EF2\xD5\u1EAF\u1EB1\u1EB7\u1EA5\u1EA7\u1EA9\u1EAD\u1EBD\u1EB9\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1ED1\u1ED3\u1ED5\u1ED7\u1EE0\u01A0\u1ED9\u1EDD\u1EDF\u1ECB\u1EF0\u1EE8\u1EEA\u1EEC\u01A1\u1EDB\u01AF\xC0\xC1\xC2\xC3\u1EA2\u0102\u1EB3\u1EB5\xC8\xC9\xCA\u1EBA\xCC\xCD\u0128\u1EF3\u0110\u1EE9\xD2\xD3\xD4\u1EA1\u1EF7\u1EEB\u1EED\xD9\xDA\u1EF9\u1EF5\xDD\u1EE1\u01B0\xE0\xE1\xE2\xE3\u1EA3\u0103\u1EEF\u1EAB\xE8\xE9\xEA\u1EBB\xEC\xED\u0129\u1EC9\u0111\u1EF1\xF2\xF3\xF4\xF5\u1ECF\u1ECD\u1EE5\xF9\xFA\u0169\u1EE7\xFD\u1EE3\u1EEE`},iso646cn:{type:"_sbcs",chars:`\0\x07\b
\v\f\r\x1B !"#\xA5%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}\u203E\x7F\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD`},iso646jp:{type:"_sbcs",chars:`\0\x07\b
\v\f\r\x1B !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\xA5]^_\`abcdefghijklmnopqrstuvwxyz{|}\u203E\x7F\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD`},hproman8:{type:"_sbcs",chars:"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xC0\xC2\xC8\xCA\xCB\xCE\xCF\xB4\u02CB\u02C6\xA8\u02DC\xD9\xDB\u20A4\xAF\xDD\xFD\xB0\xC7\xE7\xD1\xF1\xA1\xBF\xA4\xA3\xA5\xA7\u0192\xA2\xE2\xEA\xF4\xFB\xE1\xE9\xF3\xFA\xE0\xE8\xF2\xF9\xE4\xEB\xF6\xFC\xC5\xEE\xD8\xC6\xE5\xED\xF8\xE6\xC4\xEC\xD6\xDC\xC9\xEF\xDF\xD4\xC1\xC3\xE3\xD0\xF0\xCD\xCC\xD3\xD2\xD5\xF5\u0160\u0161\xDA\u0178\xFF\xDE\xFE\xB7\xB5\xB6\xBE\u2014\xBC\xBD\xAA\xBA\xAB\u25A0\xBB\xB1\uFFFD"},macintosh:{type:"_sbcs",chars:"\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\u2020\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\xB4\xA8\u2260\xC6\xD8\u221E\xB1\u2264\u2265\xA5\xB5\u2202\u2211\u220F\u03C0\u222B\xAA\xBA\u2126\xE6\xF8\xBF\xA1\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\xFF\u0178\u2044\xA4\u2039\u203A\uFB01\uFB02\u2021\xB7\u201A\u201E\u2030\xC2\xCA\xC1\xCB\xC8\xCD\xCE\xCF\xCC\xD3\xD4\uFFFD\xD2\xDA\xDB\xD9\u0131\u02C6\u02DC\xAF\u02D8\u02D9\u02DA\xB8\u02DD\u02DB\u02C7"},ascii:{type:"_sbcs",chars:"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"},tis620:{type:"_sbcs",chars:"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u0E01\u0E02\u0E03\u0E04\u0E05\u0E06\u0E07\u0E08\u0E09\u0E0A\u0E0B\u0E0C\u0E0D\u0E0E\u0E0F\u0E10\u0E11\u0E12\u0E13\u0E14\u0E15\u0E16\u0E17\u0E18\u0E19\u0E1A\u0E1B\u0E1C\u0E1D\u0E1E\u0E1F\u0E20\u0E21\u0E22\u0E23\u0E24\u0E25\u0E26\u0E27\u0E28\u0E29\u0E2A\u0E2B\u0E2C\u0E2D\u0E2E\u0E2F\u0E30\u0E31\u0E32\u0E33\u0E34\u0E35\u0E36\u0E37\u0E38\u0E39\u0E3A\uFFFD\uFFFD\uFFFD\uFFFD\u0E3F\u0E40\u0E41\u0E42\u0E43\u0E44\u0E45\u0E46\u0E47\u0E48\u0E49\u0E4A\u0E4B\u0E4C\u0E4D\u0E4E\u0E4F\u0E50\u0E51\u0E52\u0E53\u0E54\u0E55\u0E56\u0E57\u0E58\u0E59\u0E5A\u0E5B\uFFFD\uFFFD\uFFFD\uFFFD"}}});var Ul=$(Bl=>{"use strict";var Jn=Sr().Buffer;Bl._dbcs=Pr;var Re=-1,Ml=-2,er=-10,je=-1e3,Ft=new Array(256),ra=-1;for(Xa=0;Xa<256;Xa++)Ft[Xa]=Re;var Xa;function Pr(a,e){if(this.encodingName=a.encodingName,!a)throw new Error("DBCS codec is called without the data.");if(!a.table)throw new Error("Encoding '"+this.encodingName+"' has no data.");var t=a.table();this.decodeTables=[],this.decodeTables[0]=Ft.slice(0),this.decodeTableSeq=[];for(var s=0;s<t.length;s++)this._addDecodeChunk(t[s]);if(typeof a.gb18030=="function"){this.gb18030=a.gb18030();var r=this.decodeTables.length;this.decodeTables.push(Ft.slice(0));var n=this.decodeTables.length;this.decodeTables.push(Ft.slice(0));for(var i=this.decodeTables[0],s=129;s<=254;s++)for(var o=this.decodeTables[je-i[s]],c=48;c<=57;c++){if(o[c]===Re)o[c]=je-r;else if(o[c]>je)throw new Error("gb18030 decode tables conflict at byte 2");for(var u=this.decodeTables[je-o[c]],d=129;d<=254;d++){if(u[d]===Re)u[d]=je-n;else{if(u[d]===je-n)continue;if(u[d]>je)throw new Error("gb18030 decode tables conflict at byte 3")}for(var p=this.decodeTables[je-u[d]],m=48;m<=57;m++)p[m]===Re&&(p[m]=Ml)}}}this.defaultCharUnicode=e.defaultCharUnicode,this.encodeTable=[],this.encodeTableSeq=[];var f={};if(a.encodeSkipVals)for(var s=0;s<a.encodeSkipVals.lengLine truncated
data: ${s}
`),this._sseResponse=this.res,this.res.on("close",()=>{var r;this._sseResponse=void 0,(r=this.onclose)===null||r===void 0||r.call(this)})}async handlePostMessage(e,t,s){var r,n,i,o;if(!this._sseResponse){let m="SSE connection not established";throw t.writeHead(500).end(m),new Error(m)}let c=this.validateRequestHeaders(e);if(c){t.writeHead(403).end(c),(r=this.onerror)===null||r===void 0||r.call(this,new Error(c));return}let u=e.auth,d={headers:e.headers},p;try{let m=vu.default.parse((n=e.headers["content-type"])!==null&&n!==void 0?n:"");if(m.type!=="application/json")throw new Error(`Unsupported content-type: ${m.type}`);p=s!=null?s:await(0,mu.default)(e,{limit:l0,encoding:(i=m.parameters.charset)!==null&&i!==void 0?i:"utf-8"})}catch(m){t.writeHead(400).end(String(m)),(o=this.onerror)===null||o===void 0||o.call(this,m);return}try{await this.handleMessage(typeof p=="string"?JSON.parse(p):p,{requestInfo:d,authInfo:u})}catch{t.writeHead(400).end(`Invalid message: ${p}`);return}t.writeHead(202).end("Accepted")}async handleMessage(e,t){var s,r;let n;try{n=ct.parse(e)}catch(i){throw(s=this.onerror)===null||s===void 0||s.call(this,i),i}(r=this.onmessage)===null||r===void 0||r.call(this,n,t)}async close(){var e,t;(e=this._sseResponse)===null||e===void 0||e.end(),this._sseResponse=void 0,(t=this.onclose)===null||t===void 0||t.call(this)}async send(e){if(!this._sseResponse)throw new Error("Not connected");this._sseResponse.write(`event: message
data: ${JSON.stringify(e)}
`)}get sessionId(){return this._sessionId}};var ti=zr(require("node:process"),1);var is=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
`);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),u0(t)}clear(){this._buffer=void 0}};function u0(a){return ct.parse(JSON.parse(a))}function yu(a){return JSON.stringify(a)+`
`}var os=class{constructor(e=ti.default.stdin,t=ti.default.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new is,this._started=!1,this._ondata=s=>{this._readBuffer.append(s),this.processReadBuffer()},this._onerror=s=>{var r;(r=this.onerror)===null||r===void 0||r.call(this,s)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(var e,t;;)try{let s=this._readBuffer.readMessage();if(s===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,s)}catch(s){(t=this.onerror)===null||t===void 0||t.call(this,s)}}async close(){var e;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}send(e){return new Promise(t=>{let s=yu(e);this._stdout.write(s)?t():this._stdout.once("drain",t)})}};var bu=zr(Xn(),1),_u=zr(ri(),1),xu=require("node:crypto"),f0="4mb",cs=class{constructor(e){var t,s;this._started=!1,this._streamMapping=new Map,this._requestToStreamMapping=new Map,this._requestResponseMap=new Map,this._initialized=!1,this._enableJsonResponse=!1,this._standaloneSseStreamId="_GET_stream",this.sessionIdGenerator=e.sessionIdGenerator,this._enableJsonResponse=(t=e.enableJsonResponse)!==null&&t!==void 0?t:!1,this._eventStore=e.eventStore,this._onsessioninitialized=e.onsessioninitialized,this._onsessionclosed=e.onsessionclosed,this._allowedHosts=e.allowedHosts,this._allowedOrigins=e.allowedOrigins,this._enableDnsRebindingProtection=(s=e.enableDnsRebindingProtection)!==null&&s!==void 0?s:!1}async start(){if(this._started)throw new Error("Transport already started");this._started=!0}validateRequestHeaders(e){if(this._enableDnsRebindingProtection){if(this._allowedHosts&&this._allowedHosts.length>0){let t=e.headers.host;if(!t||!this._allowedHosts.includes(t))return`Invalid Host header: ${t}`}if(this._allowedOrigins&&this._allowedOrigins.length>0){let t=e.headers.origin;if(!t||!this._allowedOrigins.includes(t))return`Invalid Origin header: ${t}`}}}async handleRequest(e,t,s){var r;let n=this.validateRequestHeaders(e);if(n){t.writeHead(403).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:n},id:null})),(r=this.onerror)===null||r===void 0||r.call(this,new Error(n));return}e.method==="POST"?await this.handlePostRequest(e,t,s):e.method==="GET"?await this.handleGetRequest(e,t):e.method==="DELETE"?await this.handleDeleteRequest(e,t):await this.handleUnsupportedRequest(t)}async handleGetRequest(e,t){let s=e.headers.accept;if(!(s!=null&&s.includes("text/event-stream"))){t.writeHead(406).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Not Acceptable: Client must accept text/event-stream"},id:null}));return}if(!this.validateSession(e,t)||!this.validateProtocolVersion(e,t))return;if(this._eventStore){let n=e.headers["last-event-id"];if(n){await this.replayEvents(n,t);return}}let r={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive"};if(this.sessionId!==void 0&&(r["mcp-session-id"]=this.sessionId),this._streamMapping.get(this._standaloneSseStreamId)!==void 0){t.writeHead(409).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Conflict: Only one SSE stream is allowed per session"},id:null}));return}t.writeHead(200,r).flushHeaders(),this._streamMapping.set(this._standaloneSseStreamId,t),t.on("close",()=>{this._streamMapping.delete(this._standaloneSseStreamId)})}async replayEvents(e,t){var s,r;if(this._eventStore)try{let n={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive"};this.sessionId!==void 0&&(n["mcp-session-id"]=this.sessionId),t.writeHead(200,n).flushHeaders();let i=await((s=this._eventStore)===null||s===void 0?void 0:s.replayEventsAfter(e,{send:async(o,c)=>{var u;this.writeSSEEvent(t,c,o)||((u=this.onerror)===null||u===void 0||u.call(this,new Error("Failed replay events")),t.end())}}));this._streamMapping.set(i,t)}catch(n){(r=this.onerror)===null||r===void 0||r.call(this,n)}}writeSSEEvent(e,t,s){let r=`event: message
`;return s&&(r+=`id: ${s}
`),r+=`data: ${JSON.stringify(t)}
`,e.write(r)}async handleUnsupportedRequest(e){e.writeHead(405,{Allow:"GET, POST, DELETE"}).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Method not allowed."},id:null}))}async handlePostRequest(e,t,s){var r,n,i,o,c;try{let u=e.headers.accept;if(!(u!=null&&u.includes("application/json"))||!u.includes("text/event-stream")){t.writeHead(406).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Not Acceptable: Client must accept both application/json and text/event-stream"},id:null}));return}let d=e.headers["content-type"];if(!d||!d.includes("application/json")){t.writeHead(415).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Unsupported Media Type: Content-Type must be application/json"},id:null}));return}let p=e.auth,m={headers:e.headers},f;if(s!==void 0)f=s;else{let x=_u.default.parse(d),P=await(0,bu.default)(e,{limit:f0,encoding:(r=x.parameters.charset)!==null&&r!==void 0?r:"utf-8"});f=JSON.parse(P.toString())}let g;Array.isArray(f)?g=f.map(x=>ct.parse(x)):g=[ct.parse(f)];let _=g.some(Ui);if(_){if(this._initialized&&this.sessionId!==void 0){t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32600,message:"Invalid Request: Server already initialized"},id:null}));return}if(g.length>1){t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32600,message:"Invalid Request: Only one initialization request is allowed"},id:null}));return}this.sessionId=(n=this.sessionIdGenerator)===null||n===void 0?void 0:n.call(this),this._initialized=!0,this.sessionId&&this._onsessioninitialized&&await Promise.resolve(this._onsessioninitialized(this.sessionId))}if(!_&&(!this.validateSession(e,t)||!this.validateProtocolVersion(e,t)))return;let y=g.some(Wt);if(y){if(y){let x=(0,xu.randomUUID)();if(!this._enableJsonResponse){let P={"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"};this.sessionId!==void 0&&(P["mcp-session-id"]=this.sessionId),t.writeHead(200,P)}for(let P of g)Wt(P)&&(this._streamMapping.set(x,t),this._requestToStreamMapping.set(P.id,x));t.on("close",()=>{this._streamMapping.delete(x)});for(let P of g)(o=this.onmessage)===null||o===void 0||o.call(this,P,{authInfo:p,requestInfo:m})}}else{t.writeHead(202).end();for(let x of g)(i=this.onmessage)===null||i===void 0||i.call(this,x,{authInfo:p,requestInfo:m})}}catch(u){t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32700,message:"Parse error",data:String(u)},id:null})),(c=this.onerror)===null||c===void 0||c.call(this,u)}}async handleDeleteRequest(e,t){var s;this.validateSession(e,t)&&this.validateProtocolVersion(e,t)&&(await Promise.resolve((s=this._onsessionclosed)===null||s===void 0?void 0:s.call(this,this.sessionId)),await this.close(),t.writeHead(200).end())}validateSession(e,t){if(this.sessionIdGenerator===void 0)return!0;if(!this._initialized)return t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Bad Request: Server not initialized"},id:null})),!1;let s=e.headers["mcp-session-id"];if(s){if(Array.isArray(s))return t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Bad Request: Mcp-Session-Id header must be a single value"},id:null})),!1;if(s!==this.sessionId)return t.writeHead(404).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32001,message:"Session not found"},id:null})),!1}else return t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Bad Request: Mcp-Session-Id header is required"},id:null})),!1;return!0}validateProtocolVersion(e,t){var s;let r=(s=e.headers["mcp-protocol-version"])!==null&&s!==void 0?s:Di;return Array.isArray(r)&&(r=r[r.length-1]),it.includes(r)?!0:(t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:`Bad Request: Unsupported protocol version (supported versions: ${it.join(", ")})`},id:null})),!1)}async close(){var e;this._streamMapping.forEach(t=>{t.end()}),this._streamMapping.clear(),this._requestResponseMap.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}async send(e,t){let s=t==null?void 0:t.relatedRequestId;if((ot(e)||It(e))&&(s=e.id),s===void 0){if(ot(e)||It(e))throw new Error("Cannot send a response on a standalone SSE stream unless resuming a previous client request");let i=this._streamMapping.get(this._standaloneSseStreamId);if(i===void 0)return;let o;this._eventStore&&(o=await this._eventStore.storeEvent(this._standaloneSseStreamId,e)),this.writeSSEEvent(i,e,o);return}let r=this._requestToStreamMapping.get(s),n=this._streamMapping.get(r);if(!r)throw new Error(`No connection established for request ID: ${String(s)}`);if(!this._enableJsonResponse){let i;this._eventStore&&(i=await this._eventStore.storeEvent(r,e)),n&&this.writeSSEEvent(n,e,i)}if(ot(e)||It(e)){this._requestResponseMap.set(s,e);let i=Array.from(this._requestToStreamMapping.entries()).filter(([c,u])=>this._streamMapping.get(u)===n).map(([c])=>c);if(i.every(c=>this._requestResponseMap.has(c))){if(!n)throw new Error(`No connection established for requeLine truncated
]))`;continue}else if(s[u]==="$"){r+=`($|(?=[\r
]))`;continue}}if(t.s&&s[u]==="."){r+=i?`${s[u]}\r
`:`[${s[u]}\r
]`;continue}r+=s[u],s[u]==="\\"?n=!0:i&&s[u]==="]"?i=!1:!i&&s[u]==="["&&(i=!0)}try{new RegExp(r)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),a.source}return r}function ds(a,e){var s,r,n,i,o,c,u;if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&((s=a.keyType)==null?void 0:s._def.typeName)===O.ZodEnum)return{type:"object",required:a.keyType._def.values,properties:a.keyType._def.values.reduce((d,p)=>{var m;return{...d,[p]:(m=Q(a.valueType._def,{...e,currentPath:[...e.currentPath,"properties",p]}))!=null?m:he(e)}},{}),additionalProperties:e.rejectedAdditionalProperties};let t={type:"object",additionalProperties:(r=Q(a.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?r:e.allowedAdditionalProperties};if(e.target==="openApi3")return t;if(((n=a.keyType)==null?void 0:n._def.typeName)===O.ZodString&&((i=a.keyType._def.checks)!=null&&i.length)){let{type:d,...p}=fs(a.keyType._def,e);return{...t,propertyNames:p}}else{if(((o=a.keyType)==null?void 0:o._def.typeName)===O.ZodEnum)return{...t,propertyNames:{enum:a.keyType._def.values}};if(((c=a.keyType)==null?void 0:c._def.typeName)===O.ZodBranded&&a.keyType._def.type._def.typeName===O.ZodString&&((u=a.keyType._def.type._def.checks)!=null&&u.length)){let{type:d,...p}=us(a.keyType._def,e);return{...t,propertyNames:p}}}return t}function Nu(a,e){if(e.mapStrategy==="record")return ds(a,e);let t=Q(a.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||he(e),s=Q(a.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||he(e);return{type:"array",maxItems:125,items:{type:"array",items:[t,s],minItems:2,maxItems:2}}}function Fu(a){let e=a.values,s=Object.keys(a.values).filter(n=>typeof e[e[n]]!="number").map(n=>e[n]),r=Array.from(new Set(s.map(n=>typeof n)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:s}}function qu(a){return a.target==="openAi"?void 0:{not:he({...a,currentPath:[...a.currentPath,"not"]})}}function Lu(a){return a.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var ta={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Bu(a,e){if(e.target==="openApi3")return Mu(a,e);let t=a.options instanceof Map?Array.from(a.options.values()):a.options;if(t.every(s=>s._def.typeName in ta&&(!s._def.checks||!s._def.checks.length))){let s=t.reduce((r,n)=>{let i=ta[n._def.typeName];return i&&!r.includes(i)?[...r,i]:r},[]);return{type:s.length>1?s:s[0]}}else if(t.every(s=>s._def.typeName==="ZodLiteral"&&!s.description)){let s=t.reduce((r,n)=>{let i=typeof n._def.value;switch(i){case"string":case"number":case"boolean":return[...r,i];case"bigint":return[...r,"integer"];case"object":if(n._def.value===null)return[...r,"null"];case"symbol":case"undefined":case"function":default:return r}},[]);if(s.length===t.length){let r=s.filter((n,i,o)=>o.indexOf(n)===i);return{type:r.length>1?r:r[0],enum:t.reduce((n,i)=>n.includes(i._def.value)?n:[...n,i._def.value],[])}}}else if(t.every(s=>s._def.typeName==="ZodEnum"))return{type:"string",enum:t.reduce((s,r)=>[...s,...r._def.values.filter(n=>!s.includes(n))],[])};return Mu(a,e)}var Mu=(a,e)=>{let t=(a.options instanceof Map?Array.from(a.options.values()):a.options).map((s,r)=>Q(s._def,{...e,currentPath:[...e.currentPath,"anyOf",`${r}`]})).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).length>0));return t.length?{anyOf:t}:void 0};function Uu(a,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(a.innerType._def.typeName)&&(!a.innerType._def.checks||!a.innerType._def.checks.length))return e.target==="openApi3"?{type:ta[a.innerType._def.typeName],nullable:!0}:{type:[ta[a.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let s=Q(a.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}let t=Q(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return t&&{anyOf:[t,{type:"null"}]}}function zu(a,e){let t={type:"number"};if(!a.checks)return t;for(let s of a.checks)switch(s.kind){case"int":t.type="integer",ai(t,"type",s.message,e);break;case"min":e.target==="jsonSchema7"?s.inclusive?re(t,"minimum",s.value,s.message,e):re(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),re(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?re(t,"maximum",s.value,s.message,e):re(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),re(t,"maximum",s.value,s.message,e));break;case"multipleOf":re(t,"multipleOf",s.value,s.message,e);break}return t}function Vu(a,e){let t=e.target==="openAi",s={type:"object",properties:{}},r=[],n=a.shape();for(let o in n){let c=n[o];if Line truncated
/*! Bundled license information:
uri-js/dist/es5/uri.all.js:
(** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js *)
bytes/index.js:
(*!
* bytes
* Copyright(c) 2012-2014 TJ Holowaychuk
* Copyright(c) 2015 Jed Watson
* MIT Licensed
*)
depd/index.js:
(*!
* depd
* Copyright(c) 2014-2018 Douglas Christopher Wilson
* MIT Licensed
*)
statuses/index.js:
(*!
* statuses
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2016 Douglas Christopher Wilson
* MIT Licensed
*)
toidentifier/index.js:
(*!
* toidentifier
* Copyright(c) 2016 Douglas Christopher Wilson
* MIT Licensed
*)
http-errors/index.js:
(*!
* http-errors
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2016 Douglas Christopher Wilson
* MIT Licensed
*)
unpipe/index.js:
(*!
* unpipe
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*)
raw-body/index.js:
(*!
* raw-body
* Copyright(c) 2013-2014 Jonathan Ong
* Copyright(c) 2014-2022 Douglas Christopher Wilson
* MIT Licensed
*)
content-type/index.js:
(*!
* content-type
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*)
*/
+198
View File
@@ -0,0 +1,198 @@
"use strict";
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 __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);
var gitCommitInfoPlugin_exports = {};
__export(gitCommitInfoPlugin_exports, {
addGitCommitInfoPlugin: () => addGitCommitInfoPlugin
});
module.exports = __toCommonJS(gitCommitInfoPlugin_exports);
var fs = __toESM(require("fs"));
var import_utils = require("playwright-core/lib/utils");
const GIT_OPERATIONS_TIMEOUT_MS = 3e3;
const addGitCommitInfoPlugin = (fullConfig) => {
fullConfig.plugins.push({ factory: gitCommitInfoPlugin.bind(null, fullConfig) });
};
function print(s, ...args) {
console.log("GitCommitInfo: " + s, ...args);
}
function debug(s, ...args) {
if (!process.env.DEBUG_GIT_COMMIT_INFO)
return;
print(s, ...args);
}
const gitCommitInfoPlugin = (fullConfig) => {
return {
name: "playwright:git-commit-info",
setup: async (config, configDir) => {
const metadata = config.metadata;
const ci = await ciInfo();
if (!metadata.ci && ci) {
debug("ci info", ci);
metadata.ci = ci;
}
if (fullConfig.captureGitInfo?.commit || fullConfig.captureGitInfo?.commit === void 0 && ci) {
const git = await gitCommitInfo(configDir).catch((e) => print("failed to get git commit info", e));
if (git) {
debug("commit info", git);
metadata.gitCommit = git;
}
}
if (fullConfig.captureGitInfo?.diff || fullConfig.captureGitInfo?.diff === void 0 && ci) {
const diffResult = await gitDiff(configDir, ci).catch((e) => print("failed to get git diff", e));
if (diffResult) {
debug(`diff length ${diffResult.length}`);
metadata.gitDiff = diffResult;
}
}
}
};
};
async function ciInfo() {
if (process.env.GITHUB_ACTIONS) {
let pr;
try {
const json = JSON.parse(await fs.promises.readFile(process.env.GITHUB_EVENT_PATH, "utf8"));
pr = { title: json.pull_request.title, number: json.pull_request.number, baseHash: json.pull_request.base.sha };
} catch {
}
return {
commitHref: `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/commit/${process.env.GITHUB_SHA}`,
commitHash: process.env.GITHUB_SHA,
prHref: pr ? `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/pull/${pr.number}` : void 0,
prTitle: pr?.title,
prBaseHash: pr?.baseHash,
buildHref: `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`
};
}
if (process.env.GITLAB_CI) {
return {
commitHref: `${process.env.CI_PROJECT_URL}/-/commit/${process.env.CI_COMMIT_SHA}`,
commitHash: process.env.CI_COMMIT_SHA,
buildHref: process.env.CI_JOB_URL,
branch: process.env.CI_COMMIT_REF_NAME
};
}
if (process.env.JENKINS_URL && process.env.BUILD_URL) {
return {
commitHref: process.env.BUILD_URL,
commitHash: process.env.GIT_COMMIT,
branch: process.env.GIT_BRANCH
};
}
}
async function gitCommitInfo(gitDir) {
const separator = `---786eec917292---`;
const tokens = [
"%H",
// commit hash
"%h",
// abbreviated commit hash
"%s",
// subject
"%B",
// raw body (unwrapped subject and body)
"%an",
// author name
"%ae",
// author email
"%at",
// author date, UNIX timestamp
"%cn",
// committer name
"%ce",
// committer email
"%ct",
// committer date, UNIX timestamp
""
// branch
];
const output = await runGit(`git log -1 --pretty=format:"${tokens.join(separator)}" && git rev-parse --abbrev-ref HEAD`, gitDir);
if (!output)
return void 0;
const [hash, shortHash, subject, body, authorName, authorEmail, authorTime, committerName, committerEmail, committerTime, branch] = output.split(separator);
return {
shortHash,
hash,
subject,
body,
author: {
name: authorName,
email: authorEmail,
time: +authorTime * 1e3
},
committer: {
name: committerName,
email: committerEmail,
time: +committerTime * 1e3
},
branch: branch.trim()
};
}
async function gitDiff(gitDir, ci) {
const diffLimit = 1e5;
if (ci?.prBaseHash) {
await runGit(`git fetch origin ${ci.prBaseHash} --depth=1 --no-auto-maintenance --no-auto-gc --no-tags --no-recurse-submodules`, gitDir);
const diff2 = await runGit(`git diff ${ci.prBaseHash} HEAD`, gitDir);
if (diff2)
return diff2.substring(0, diffLimit);
}
if (ci)
return;
const uncommitted = await runGit("git diff", gitDir);
if (uncommitted === void 0) {
return;
}
if (uncommitted)
return uncommitted.substring(0, diffLimit);
const diff = await runGit("git diff HEAD~1", gitDir);
return diff?.substring(0, diffLimit);
}
async function runGit(command, cwd) {
debug(`running "${command}"`);
const start = (0, import_utils.monotonicTime)();
const result = await (0, import_utils.spawnAsync)(
command,
[],
{ stdio: "pipe", cwd, timeout: GIT_OPERATIONS_TIMEOUT_MS, shell: true }
);
if ((0, import_utils.monotonicTime)() - start > GIT_OPERATIONS_TIMEOUT_MS) {
print(`timeout of ${GIT_OPERATIONS_TIMEOUT_MS}ms exceeded while running "${command}"`);
return;
}
if (result.code)
debug(`failure, code=${result.code}
${result.stderr}`);
else
debug(`success`);
return result.code ? void 0 : result.stdout.trim();
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
addGitCommitInfoPlugin
});
+28
View File
@@ -0,0 +1,28 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var plugins_exports = {};
__export(plugins_exports, {
webServer: () => import_webServerPlugin.webServer
});
module.exports = __toCommonJS(plugins_exports);
var import_webServerPlugin = require("./webServerPlugin");
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
webServer
});
+207
View File
@@ -0,0 +1,207 @@
"use strict";
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 __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);
var webServerPlugin_exports = {};
__export(webServerPlugin_exports, {
WebServerPlugin: () => WebServerPlugin,
webServer: () => webServer,
webServerPluginsForConfig: () => webServerPluginsForConfig
});
module.exports = __toCommonJS(webServerPlugin_exports);
var import_net = __toESM(require("net"));
var import_path = __toESM(require("path"));
var import_utils = require("playwright-core/lib/utils");
var import_utils2 = require("playwright-core/lib/utils");
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
const DEFAULT_ENVIRONMENT_VARIABLES = {
"BROWSER": "none",
// Disable that create-react-app will open the page in the browser
"FORCE_COLOR": "1",
"DEBUG_COLORS": "1"
};
const debugWebServer = (0, import_utilsBundle.debug)("pw:webserver");
class WebServerPlugin {
constructor(options, checkPortOnly) {
this.name = "playwright:webserver";
this._options = options;
this._checkPortOnly = checkPortOnly;
}
async setup(config, configDir, reporter) {
this._reporter = reporter;
this._isAvailableCallback = this._options.url ? getIsAvailableFunction(this._options.url, this._checkPortOnly, !!this._options.ignoreHTTPSErrors, this._reporter.onStdErr?.bind(this._reporter)) : void 0;
this._options.cwd = this._options.cwd ? import_path.default.resolve(configDir, this._options.cwd) : configDir;
try {
await this._startProcess();
await this._waitForProcess();
} catch (error) {
await this.teardown();
throw error;
}
}
async teardown() {
debugWebServer(`Terminating the WebServer`);
await this._killProcess?.();
debugWebServer(`Terminated the WebServer`);
}
async _startProcess() {
let processExitedReject = (error) => {
};
this._processExitedPromise = new Promise((_, reject) => processExitedReject = reject);
const isAlreadyAvailable = await this._isAvailableCallback?.();
if (isAlreadyAvailable) {
debugWebServer(`WebServer is already available`);
if (this._options.reuseExistingServer)
return;
const port = new URL(this._options.url).port;
throw new Error(`${this._options.url ?? `http://localhost${port ? ":" + port : ""}`} is already used, make sure that nothing is running on the port/url or set reuseExistingServer:true in config.webServer.`);
}
debugWebServer(`Starting WebServer process ${this._options.command}...`);
const { launchedProcess, gracefullyClose } = await (0, import_utils.launchProcess)({
command: this._options.command,
env: {
...DEFAULT_ENVIRONMENT_VARIABLES,
...process.env,
...this._options.env
},
cwd: this._options.cwd,
stdio: "stdin",
shell: true,
attemptToGracefullyClose: async () => {
if (process.platform === "win32")
throw new Error("Graceful shutdown is not supported on Windows");
if (!this._options.gracefulShutdown)
throw new Error("skip graceful shutdown");
const { signal, timeout = 0 } = this._options.gracefulShutdown;
process.kill(-launchedProcess.pid, signal);
return new Promise((resolve, reject) => {
const timer = timeout !== 0 ? setTimeout(() => reject(new Error(`process didn't close gracefully within timeout`)), timeout) : void 0;
launchedProcess.once("close", (...args) => {
clearTimeout(timer);
resolve();
});
});
},
log: () => {
},
onExit: (code) => processExitedReject(new Error(code ? `Process from config.webServer was not able to start. Exit code: ${code}` : "Process from config.webServer exited early.")),
tempDirectories: []
});
this._killProcess = gracefullyClose;
debugWebServer(`Process started`);
launchedProcess.stderr.on("data", (data) => {
if (debugWebServer.enabled || (this._options.stderr === "pipe" || !this._options.stderr))
this._reporter.onStdErr?.(prefixOutputLines(data.toString(), this._options.name));
});
launchedProcess.stdout.on("data", (data) => {
if (debugWebServer.enabled || this._options.stdout === "pipe")
this._reporter.onStdOut?.(prefixOutputLines(data.toString(), this._options.name));
});
}
async _waitForProcess() {
if (!this._isAvailableCallback) {
this._processExitedPromise.catch(() => {
});
return;
}
debugWebServer(`Waiting for availability...`);
const launchTimeout = this._options.timeout || 60 * 1e3;
const cancellationToken = { canceled: false };
const { timedOut } = await Promise.race([
(0, import_utils.raceAgainstDeadline)(() => waitFor(this._isAvailableCallback, cancellationToken), (0, import_utils.monotonicTime)() + launchTimeout),
this._processExitedPromise
]);
cancellationToken.canceled = true;
if (timedOut)
throw new Error(`Timed out waiting ${launchTimeout}ms from config.webServer.`);
debugWebServer(`WebServer available`);
}
}
async function isPortUsed(port) {
const innerIsPortUsed = (host) => new Promise((resolve) => {
const conn = import_net.default.connect(port, host).on("error", () => {
resolve(false);
}).on("connect", () => {
conn.end();
resolve(true);
});
});
return await innerIsPortUsed("127.0.0.1") || await innerIsPortUsed("::1");
}
async function waitFor(waitFn, cancellationToken) {
const logScale = [100, 250, 500];
while (!cancellationToken.canceled) {
const connected = await waitFn();
if (connected)
return;
const delay = logScale.shift() || 1e3;
debugWebServer(`Waiting ${delay}ms`);
await new Promise((x) => setTimeout(x, delay));
}
}
function getIsAvailableFunction(url, checkPortOnly, ignoreHTTPSErrors, onStdErr) {
const urlObject = new URL(url);
if (!checkPortOnly)
return () => (0, import_utils.isURLAvailable)(urlObject, ignoreHTTPSErrors, debugWebServer, onStdErr);
const port = urlObject.port;
return () => isPortUsed(+port);
}
const webServer = (options) => {
return new WebServerPlugin(options, false);
};
const webServerPluginsForConfig = (config) => {
const shouldSetBaseUrl = !!config.config.webServer;
const webServerPlugins = [];
for (const webServerConfig of config.webServers) {
if (webServerConfig.port && webServerConfig.url)
throw new Error(`Either 'port' or 'url' should be specified in config.webServer.`);
let url;
if (webServerConfig.port || webServerConfig.url) {
url = webServerConfig.url || `http://localhost:${webServerConfig.port}`;
if (shouldSetBaseUrl && !webServerConfig.url)
process.env.PLAYWRIGHT_TEST_BASE_URL = url;
}
webServerPlugins.push(new WebServerPlugin({ ...webServerConfig, url }, webServerConfig.port !== void 0));
}
return webServerPlugins;
};
function prefixOutputLines(output, prefixName = "WebServer") {
const lastIsNewLine = output[output.length - 1] === "\n";
let lines = output.split("\n");
if (lastIsNewLine)
lines.pop();
lines = lines.map((line) => import_utils2.colors.dim(`[${prefixName}] `) + line);
if (lastIsNewLine)
lines.push("");
return lines.join("\n");
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
WebServerPlugin,
webServer,
webServerPluginsForConfig
});
+344
View File
@@ -0,0 +1,344 @@
"use strict";
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 __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);
var program_exports = {};
__export(program_exports, {
program: () => import_program2.program
});
module.exports = __toCommonJS(program_exports);
var import_fs = __toESM(require("fs"));
var import_path = __toESM(require("path"));
var import_program = require("playwright-core/lib/cli/program");
var import_utils = require("playwright-core/lib/utils");
var import_config = require("./common/config");
var import_configLoader = require("./common/configLoader");
var import_program2 = require("playwright-core/lib/cli/program");
var import_base = require("./reporters/base");
var import_html = require("./reporters/html");
var import_merge = require("./reporters/merge");
var import_projectUtils = require("./runner/projectUtils");
var testServer = __toESM(require("./runner/testServer"));
var import_watchMode = require("./runner/watchMode");
var import_testRunner = require("./runner/testRunner");
var import_reporters = require("./runner/reporters");
function addTestCommand(program3) {
const command = program3.command("test [test-filter...]");
command.description("run tests with Playwright Test");
const options = testOptions.sort((a, b) => a[0].replace(/-/g, "").localeCompare(b[0].replace(/-/g, "")));
options.forEach(([name, { description, choices, preset }]) => {
const option = command.createOption(name, description);
if (choices)
option.choices(choices);
if (preset)
option.preset(preset);
command.addOption(option);
return command;
});
command.action(async (args, opts) => {
try {
await runTests(args, opts);
} catch (e) {
console.error(e);
(0, import_utils.gracefullyProcessExitDoNotHang)(1);
}
});
command.addHelpText("afterAll", `
Arguments [test-filter...]:
Pass arguments to filter test files. Each argument is treated as a regular expression. Matching is performed against the absolute file paths.
Examples:
$ npx playwright test my.spec.ts
$ npx playwright test some.spec.ts:42
$ npx playwright test --headed
$ npx playwright test --project=webkit`);
}
function addClearCacheCommand(program3) {
const command = program3.command("clear-cache");
command.description("clears build and test caches");
command.option("-c, --config <file>", `Configuration file, or a test directory with optional "playwright.config.{m,c}?{js,ts}"`);
command.action(async (opts) => {
const runner = new import_testRunner.TestRunner((0, import_configLoader.resolveConfigLocation)(opts.config), {});
const { status } = await runner.clearCache((0, import_reporters.createErrorCollectingReporter)(import_base.terminalScreen));
const exitCode = status === "interrupted" ? 130 : status === "passed" ? 0 : 1;
(0, import_utils.gracefullyProcessExitDoNotHang)(exitCode);
});
}
function addDevServerCommand(program3) {
const command = program3.command("dev-server", { hidden: true });
command.description("start dev server");
command.option("-c, --config <file>", `Configuration file, or a test directory with optional "playwright.config.{m,c}?{js,ts}"`);
command.action(async (options) => {
const runner = new import_testRunner.TestRunner((0, import_configLoader.resolveConfigLocation)(options.config), {});
await runner.startDevServer((0, import_reporters.createErrorCollectingReporter)(import_base.terminalScreen), "in-process");
});
}
function addTestServerCommand(program3) {
const command = program3.command("test-server", { hidden: true });
command.description("start test server");
command.option("-c, --config <file>", `Configuration file, or a test directory with optional "playwright.config.{m,c}?{js,ts}"`);
command.option("--host <host>", "Host to start the server on", "localhost");
command.option("--port <port>", "Port to start the server on", "0");
command.action((opts) => runTestServer(opts));
}
function addShowReportCommand(program3) {
const command = program3.command("show-report [report]");
command.description("show HTML report");
command.action((report, options) => (0, import_html.showHTMLReport)(report, options.host, +options.port));
command.option("--host <host>", "Host to serve report on", "localhost");
command.option("--port <port>", "Port to serve report on", "9323");
command.addHelpText("afterAll", `
Arguments [report]:
When specified, opens given report, otherwise opens last generated report.
Examples:
$ npx playwright show-report
$ npx playwright show-report playwright-report`);
}
function addMergeReportsCommand(program3) {
const command = program3.command("merge-reports [dir]");
command.description("merge multiple blob reports (for sharded tests) into a single report");
command.action(async (dir, options) => {
try {
await mergeReports(dir, options);
} catch (e) {
console.error(e);
(0, import_utils.gracefullyProcessExitDoNotHang)(1);
}
});
command.option("-c, --config <file>", `Configuration file. Can be used to specify additional configuration for the output report.`);
command.option("--reporter <reporter>", `Reporter to use, comma-separated, can be ${import_config.builtInReporters.map((name) => `"${name}"`).join(", ")} (default: "${import_config.defaultReporter}")`);
command.addHelpText("afterAll", `
Arguments [dir]:
Directory containing blob reports.
Examples:
$ npx playwright merge-reports playwright-report`);
}
async function runTests(args, opts) {
await (0, import_utils.startProfiling)();
const cliOverrides = overridesFromOptions(opts);
const config = await (0, import_configLoader.loadConfigFromFile)(opts.config, cliOverrides, opts.deps === false);
config.cliArgs = args;
config.cliGrep = opts.grep;
config.cliOnlyChanged = opts.onlyChanged === true ? "HEAD" : opts.onlyChanged;
config.cliGrepInvert = opts.grepInvert;
config.cliListOnly = !!opts.list;
config.cliProjectFilter = opts.project || void 0;
config.cliPassWithNoTests = !!opts.passWithNoTests;
config.cliLastFailed = !!opts.lastFailed;
(0, import_projectUtils.filterProjects)(config.projects, config.cliProjectFilter);
if (opts.ui || opts.uiHost || opts.uiPort) {
if (opts.onlyChanged)
throw new Error(`--only-changed is not supported in UI mode. If you'd like that to change, see https://github.com/microsoft/playwright/issues/15075 for more details.`);
const status2 = await testServer.runUIMode(opts.config, cliOverrides, {
host: opts.uiHost,
port: opts.uiPort ? +opts.uiPort : void 0,
args,
grep: opts.grep,
grepInvert: opts.grepInvert,
project: opts.project || void 0,
reporter: Array.isArray(opts.reporter) ? opts.reporter : opts.reporter ? [opts.reporter] : void 0
});
await (0, import_utils.stopProfiling)("runner");
const exitCode2 = status2 === "interrupted" ? 130 : status2 === "passed" ? 0 : 1;
(0, import_utils.gracefullyProcessExitDoNotHang)(exitCode2);
return;
}
if (process.env.PWTEST_WATCH) {
if (opts.onlyChanged)
throw new Error(`--only-changed is not supported in watch mode. If you'd like that to change, file an issue and let us know about your usecase for it.`);
const status2 = await (0, import_watchMode.runWatchModeLoop)(
(0, import_configLoader.resolveConfigLocation)(opts.config),
{
projects: opts.project,
files: args,
grep: opts.grep
}
);
await (0, import_utils.stopProfiling)("runner");
const exitCode2 = status2 === "interrupted" ? 130 : status2 === "passed" ? 0 : 1;
(0, import_utils.gracefullyProcessExitDoNotHang)(exitCode2);
return;
}
const status = await (0, import_testRunner.runAllTestsWithConfig)(config);
await (0, import_utils.stopProfiling)("runner");
const exitCode = status === "interrupted" ? 130 : status === "passed" ? 0 : 1;
(0, import_utils.gracefullyProcessExitDoNotHang)(exitCode);
}
async function runTestServer(opts) {
const host = opts.host || "localhost";
const port = opts.port ? +opts.port : 0;
const status = await testServer.runTestServer(opts.config, {}, { host, port });
const exitCode = status === "interrupted" ? 130 : status === "passed" ? 0 : 1;
(0, import_utils.gracefullyProcessExitDoNotHang)(exitCode);
}
async function mergeReports(reportDir, opts) {
const configFile = opts.config;
const config = configFile ? await (0, import_configLoader.loadConfigFromFile)(configFile) : await (0, import_configLoader.loadEmptyConfigForMergeReports)();
const dir = import_path.default.resolve(process.cwd(), reportDir || "");
const dirStat = await import_fs.default.promises.stat(dir).catch((e) => null);
if (!dirStat)
throw new Error("Directory does not exist: " + dir);
if (!dirStat.isDirectory())
throw new Error(`"${dir}" is not a directory`);
let reporterDescriptions = resolveReporterOption(opts.reporter);
if (!reporterDescriptions && configFile)
reporterDescriptions = config.config.reporter;
if (!reporterDescriptions)
reporterDescriptions = [[import_config.defaultReporter]];
const rootDirOverride = configFile ? config.config.rootDir : void 0;
await (0, import_merge.createMergedReport)(config, dir, reporterDescriptions, rootDirOverride);
(0, import_utils.gracefullyProcessExitDoNotHang)(0);
}
function overridesFromOptions(options) {
const overrides = {
failOnFlakyTests: options.failOnFlakyTests ? true : void 0,
forbidOnly: options.forbidOnly ? true : void 0,
fullyParallel: options.fullyParallel ? true : void 0,
globalTimeout: options.globalTimeout ? parseInt(options.globalTimeout, 10) : void 0,
maxFailures: options.x ? 1 : options.maxFailures ? parseInt(options.maxFailures, 10) : void 0,
outputDir: options.output ? import_path.default.resolve(process.cwd(), options.output) : void 0,
quiet: options.quiet ? options.quiet : void 0,
repeatEach: options.repeatEach ? parseInt(options.repeatEach, 10) : void 0,
retries: options.retries ? parseInt(options.retries, 10) : void 0,
reporter: resolveReporterOption(options.reporter),
shard: resolveShardOption(options.shard),
timeout: options.timeout ? parseInt(options.timeout, 10) : void 0,
tsconfig: options.tsconfig ? import_path.default.resolve(process.cwd(), options.tsconfig) : void 0,
ignoreSnapshots: options.ignoreSnapshots ? !!options.ignoreSnapshots : void 0,
updateSnapshots: options.updateSnapshots,
updateSourceMethod: options.updateSourceMethod,
workers: options.workers
};
if (options.browser) {
const browserOpt = options.browser.toLowerCase();
if (!["all", "chromium", "firefox", "webkit"].includes(browserOpt))
throw new Error(`Unsupported browser "${options.browser}", must be one of "all", "chromium", "firefox" or "webkit"`);
const browserNames = browserOpt === "all" ? ["chromium", "firefox", "webkit"] : [browserOpt];
overrides.projects = browserNames.map((browserName) => {
return {
name: browserName,
use: { browserName }
};
});
}
if (options.headed || options.debug)
overrides.use = { headless: false };
if (!options.ui && options.debug) {
overrides.debug = true;
process.env.PWDEBUG = "1";
}
if (!options.ui && options.trace) {
overrides.use = overrides.use || {};
overrides.use.trace = options.trace;
}
if (overrides.tsconfig && !import_fs.default.existsSync(overrides.tsconfig))
throw new Error(`--tsconfig "${options.tsconfig}" does not exist`);
return overrides;
}
function resolveReporterOption(reporter) {
if (!reporter || !reporter.length)
return void 0;
return reporter.split(",").map((r) => [resolveReporter(r)]);
}
function resolveShardOption(shard) {
if (!shard)
return void 0;
const shardPair = shard.split("/");
if (shardPair.length !== 2) {
throw new Error(
`--shard "${shard}", expected format is "current/all", 1-based, for example "3/5".`
);
}
const current = parseInt(shardPair[0], 10);
const total = parseInt(shardPair[1], 10);
if (isNaN(total) || total < 1)
throw new Error(`--shard "${shard}" total must be a positive number`);
if (isNaN(current) || current < 1 || current > total) {
throw new Error(
`--shard "${shard}" current must be a positive number, not greater than shard total`
);
}
return { current, total };
}
function resolveReporter(id) {
if (import_config.builtInReporters.includes(id))
return id;
const localPath = import_path.default.resolve(process.cwd(), id);
if (import_fs.default.existsSync(localPath))
return localPath;
return require.resolve(id, { paths: [process.cwd()] });
}
const kTraceModes = ["on", "off", "on-first-retry", "on-all-retries", "retain-on-failure", "retain-on-first-failure"];
const testOptions = [
/* deprecated */
["--browser <browser>", { description: `Browser to use for tests, one of "all", "chromium", "firefox" or "webkit" (default: "chromium")` }],
["-c, --config <file>", { description: `Configuration file, or a test directory with optional "playwright.config.{m,c}?{js,ts}"` }],
["--debug", { description: `Run tests with Playwright Inspector. Shortcut for "PWDEBUG=1" environment variable and "--timeout=0 --max-failures=1 --headed --workers=1" options` }],
["--fail-on-flaky-tests", { description: `Fail if any test is flagged as flaky (default: false)` }],
["--forbid-only", { description: `Fail if test.only is called (default: false)` }],
["--fully-parallel", { description: `Run all tests in parallel (default: false)` }],
["--global-timeout <timeout>", { description: `Maximum time this test suite can run in milliseconds (default: unlimited)` }],
["-g, --grep <grep>", { description: `Only run tests matching this regular expression (default: ".*")` }],
["--grep-invert <grep>", { description: `Only run tests that do not match this regular expression` }],
["--headed", { description: `Run tests in headed browsers (default: headless)` }],
["--ignore-snapshots", { description: `Ignore screenshot and snapshot expectations` }],
["--last-failed", { description: `Only re-run the failures` }],
["--list", { description: `Collect all the tests and report them, but do not run` }],
["--max-failures <N>", { description: `Stop after the first N failures` }],
["--no-deps", { description: `Do not run project dependencies` }],
["--output <dir>", { description: `Folder for output artifacts (default: "test-results")` }],
["--only-changed [ref]", { description: `Only run test files that have been changed between 'HEAD' and 'ref'. Defaults to running all uncommitted changes. Only supports Git.` }],
["--pass-with-no-tests", { description: `Makes test run succeed even if no tests were found` }],
["--project <project-name...>", { description: `Only run tests from the specified list of projects, supports '*' wildcard (default: run all projects)` }],
["--quiet", { description: `Suppress stdio` }],
["--repeat-each <N>", { description: `Run each test N times (default: 1)` }],
["--reporter <reporter>", { description: `Reporter to use, comma-separated, can be ${import_config.builtInReporters.map((name) => `"${name}"`).join(", ")} (default: "${import_config.defaultReporter}")` }],
["--retries <retries>", { description: `Maximum retry count for flaky tests, zero for no retries (default: no retries)` }],
["--shard <shard>", { description: `Shard tests and execute only the selected shard, specify in the form "current/all", 1-based, for example "3/5"` }],
["--timeout <timeout>", { description: `Specify test timeout threshold in milliseconds, zero for unlimited (default: ${import_config.defaultTimeout})` }],
["--trace <mode>", { description: `Force tracing mode`, choices: kTraceModes }],
["--tsconfig <path>", { description: `Path to a single tsconfig applicable to all imported files (default: look up tsconfig for each imported file separately)` }],
["--ui", { description: `Run tests in interactive UI mode` }],
["--ui-host <host>", { description: `Host to serve UI on; specifying this option opens UI in a browser tab` }],
["--ui-port <port>", { description: `Port to serve UI on, 0 for any free port; specifying this option opens UI in a browser tab` }],
["-u, --update-snapshots [mode]", { description: `Update snapshots with actual results. Running tests without the flag defaults to "missing"`, choices: ["all", "changed", "missing", "none"], preset: "changed" }],
["--update-source-method <method>", { description: `Chooses the way source is updated (default: "patch")`, choices: ["overwrite", "3way", "patch"] }],
["-j, --workers <workers>", { description: `Number of concurrent workers or percentage of logical CPU cores, use 1 to run in a single worker (default: 50%)` }],
["-x", { description: `Stop after the first failure` }]
];
addTestCommand(import_program.program);
addShowReportCommand(import_program.program);
addMergeReportsCommand(import_program.program);
addClearCacheCommand(import_program.program);
addDevServerCommand(import_program.program);
addTestServerCommand(import_program.program);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
program
});
+611
View File
@@ -0,0 +1,611 @@
"use strict";
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 __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);
var base_exports = {};
__export(base_exports, {
TerminalReporter: () => TerminalReporter,
fitToWidth: () => fitToWidth,
formatError: () => formatError,
formatFailure: () => formatFailure,
formatResultFailure: () => formatResultFailure,
formatRetry: () => formatRetry,
internalScreen: () => internalScreen,
kOutputSymbol: () => kOutputSymbol,
nonTerminalScreen: () => nonTerminalScreen,
prepareErrorStack: () => prepareErrorStack,
relativeFilePath: () => relativeFilePath,
resolveOutputFile: () => resolveOutputFile,
separator: () => separator,
stepSuffix: () => stepSuffix,
terminalScreen: () => terminalScreen
});
module.exports = __toCommonJS(base_exports);
var import_path = __toESM(require("path"));
var import_utils = require("playwright-core/lib/utils");
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
var import_utils2 = require("playwright-core/lib/utils");
var import_util = require("../util");
var import_utilsBundle2 = require("../utilsBundle");
const kOutputSymbol = Symbol("output");
const DEFAULT_TTY_WIDTH = 100;
const DEFAULT_TTY_HEIGHT = 40;
const originalProcessStdout = process.stdout;
const originalProcessStderr = process.stderr;
const terminalScreen = (() => {
let isTTY = !!originalProcessStdout.isTTY;
let ttyWidth = originalProcessStdout.columns || 0;
let ttyHeight = originalProcessStdout.rows || 0;
if (process.env.PLAYWRIGHT_FORCE_TTY === "false" || process.env.PLAYWRIGHT_FORCE_TTY === "0") {
isTTY = false;
ttyWidth = 0;
ttyHeight = 0;
} else if (process.env.PLAYWRIGHT_FORCE_TTY === "true" || process.env.PLAYWRIGHT_FORCE_TTY === "1") {
isTTY = true;
ttyWidth = originalProcessStdout.columns || DEFAULT_TTY_WIDTH;
ttyHeight = originalProcessStdout.rows || DEFAULT_TTY_HEIGHT;
} else if (process.env.PLAYWRIGHT_FORCE_TTY) {
isTTY = true;
const sizeMatch = process.env.PLAYWRIGHT_FORCE_TTY.match(/^(\d+)x(\d+)$/);
if (sizeMatch) {
ttyWidth = +sizeMatch[1];
ttyHeight = +sizeMatch[2];
} else {
ttyWidth = +process.env.PLAYWRIGHT_FORCE_TTY;
ttyHeight = DEFAULT_TTY_HEIGHT;
}
if (isNaN(ttyWidth))
ttyWidth = DEFAULT_TTY_WIDTH;
if (isNaN(ttyHeight))
ttyHeight = DEFAULT_TTY_HEIGHT;
}
let useColors = isTTY;
if (process.env.DEBUG_COLORS === "0" || process.env.DEBUG_COLORS === "false" || process.env.FORCE_COLOR === "0" || process.env.FORCE_COLOR === "false")
useColors = false;
else if (process.env.DEBUG_COLORS || process.env.FORCE_COLOR)
useColors = true;
const colors = useColors ? import_utils2.colors : import_utils2.noColors;
return {
resolveFiles: "cwd",
isTTY,
ttyWidth,
ttyHeight,
colors,
stdout: originalProcessStdout,
stderr: originalProcessStderr
};
})();
const nonTerminalScreen = {
colors: terminalScreen.colors,
isTTY: false,
ttyWidth: 0,
ttyHeight: 0,
resolveFiles: "rootDir"
};
const internalScreen = {
colors: import_utils2.colors,
isTTY: false,
ttyWidth: 0,
ttyHeight: 0,
resolveFiles: "rootDir"
};
class TerminalReporter {
constructor(options = {}) {
this.totalTestCount = 0;
this.fileDurations = /* @__PURE__ */ new Map();
this._fatalErrors = [];
this._failureCount = 0;
this.screen = options.screen ?? terminalScreen;
this._omitFailures = options.omitFailures || false;
}
version() {
return "v2";
}
onConfigure(config) {
this.config = config;
}
onBegin(suite) {
this.suite = suite;
this.totalTestCount = suite.allTests().length;
}
onStdOut(chunk, test, result) {
this._appendOutput({ chunk, type: "stdout" }, result);
}
onStdErr(chunk, test, result) {
this._appendOutput({ chunk, type: "stderr" }, result);
}
_appendOutput(output, result) {
if (!result)
return;
result[kOutputSymbol] = result[kOutputSymbol] || [];
result[kOutputSymbol].push(output);
}
onTestEnd(test, result) {
if (result.status !== "skipped" && result.status !== test.expectedStatus)
++this._failureCount;
const projectName = test.titlePath()[1];
const relativePath = relativeTestPath(this.screen, this.config, test);
const fileAndProject = (projectName ? `[${projectName}] \u203A ` : "") + relativePath;
const entry = this.fileDurations.get(fileAndProject) || { duration: 0, workers: /* @__PURE__ */ new Set() };
entry.duration += result.duration;
entry.workers.add(result.workerIndex);
this.fileDurations.set(fileAndProject, entry);
}
onError(error) {
this._fatalErrors.push(error);
}
async onEnd(result) {
this.result = result;
}
fitToScreen(line, prefix) {
if (!this.screen.ttyWidth) {
return line;
}
return fitToWidth(line, this.screen.ttyWidth, prefix);
}
generateStartingMessage() {
const jobs = this.config.metadata.actualWorkers ?? this.config.workers;
const shardDetails = this.config.shard ? `, shard ${this.config.shard.current} of ${this.config.shard.total}` : "";
if (!this.totalTestCount)
return "";
return "\n" + this.screen.colors.dim("Running ") + this.totalTestCount + this.screen.colors.dim(` test${this.totalTestCount !== 1 ? "s" : ""} using `) + jobs + this.screen.colors.dim(` worker${jobs !== 1 ? "s" : ""}${shardDetails}`);
}
getSlowTests() {
if (!this.config.reportSlowTests)
return [];
const fileDurations = [...this.fileDurations.entries()].filter(([key, value]) => value.workers.size === 1).map(([key, value]) => [key, value.duration]);
fileDurations.sort((a, b) => b[1] - a[1]);
const count = Math.min(fileDurations.length, this.config.reportSlowTests.max || Number.POSITIVE_INFINITY);
const threshold = this.config.reportSlowTests.threshold;
return fileDurations.filter(([, duration]) => duration > threshold).slice(0, count);
}
generateSummaryMessage({ didNotRun, skipped, expected, interrupted, unexpected, flaky, fatalErrors }) {
const tokens = [];
if (unexpected.length) {
tokens.push(this.screen.colors.red(` ${unexpected.length} failed`));
for (const test of unexpected)
tokens.push(this.screen.colors.red(this.formatTestHeader(test, { indent: " " })));
}
if (interrupted.length) {
tokens.push(this.screen.colors.yellow(` ${interrupted.length} interrupted`));
for (const test of interrupted)
tokens.push(this.screen.colors.yellow(this.formatTestHeader(test, { indent: " " })));
}
if (flaky.length) {
tokens.push(this.screen.colors.yellow(` ${flaky.length} flaky`));
for (const test of flaky)
tokens.push(this.screen.colors.yellow(this.formatTestHeader(test, { indent: " " })));
}
if (skipped)
tokens.push(this.screen.colors.yellow(` ${skipped} skipped`));
if (didNotRun)
tokens.push(this.screen.colors.yellow(` ${didNotRun} did not run`));
if (expected)
tokens.push(this.screen.colors.green(` ${expected} passed`) + this.screen.colors.dim(` (${(0, import_utilsBundle.ms)(this.result.duration)})`));
if (fatalErrors.length && expected + unexpected.length + interrupted.length + flaky.length > 0)
tokens.push(this.screen.colors.red(` ${fatalErrors.length === 1 ? "1 error was not a part of any test" : fatalErrors.length + " errors were not a part of any test"}, see above for details`));
return tokens.join("\n");
}
generateSummary() {
let didNotRun = 0;
let skipped = 0;
let expected = 0;
const interrupted = [];
const interruptedToPrint = [];
const unexpected = [];
const flaky = [];
this.suite.allTests().forEach((test) => {
switch (test.outcome()) {
case "skipped": {
if (test.results.some((result) => result.status === "interrupted")) {
if (test.results.some((result) => !!result.error))
interruptedToPrint.push(test);
interrupted.push(test);
} else if (!test.results.length || test.expectedStatus !== "skipped") {
++didNotRun;
} else {
++skipped;
}
break;
}
case "expected":
++expected;
break;
case "unexpected":
unexpected.push(test);
break;
case "flaky":
flaky.push(test);
break;
}
});
const failuresToPrint = [...unexpected, ...flaky, ...interruptedToPrint];
return {
didNotRun,
skipped,
expected,
interrupted,
unexpected,
flaky,
failuresToPrint,
fatalErrors: this._fatalErrors
};
}
epilogue(full) {
const summary = this.generateSummary();
const summaryMessage = this.generateSummaryMessage(summary);
if (full && summary.failuresToPrint.length && !this._omitFailures)
this._printFailures(summary.failuresToPrint);
this._printSlowTests();
this._printSummary(summaryMessage);
}
_printFailures(failures) {
this.writeLine("");
failures.forEach((test, index) => {
this.writeLine(this.formatFailure(test, index + 1));
});
}
_printSlowTests() {
const slowTests = this.getSlowTests();
slowTests.forEach(([file, duration]) => {
this.writeLine(this.screen.colors.yellow(" Slow test file: ") + file + this.screen.colors.yellow(` (${(0, import_utilsBundle.ms)(duration)})`));
});
if (slowTests.length)
this.writeLine(this.screen.colors.yellow(" Consider running tests from slow files in parallel. See: https://playwright.dev/docs/test-parallel"));
}
_printSummary(summary) {
if (summary.trim())
this.writeLine(summary);
}
willRetry(test) {
return test.outcome() === "unexpected" && test.results.length <= test.retries;
}
formatTestTitle(test, step, omitLocation = false) {
return formatTestTitle(this.screen, this.config, test, step, omitLocation);
}
formatTestHeader(test, options = {}) {
return formatTestHeader(this.screen, this.config, test, options);
}
formatFailure(test, index) {
return formatFailure(this.screen, this.config, test, index);
}
formatError(error) {
return formatError(this.screen, error);
}
writeLine(line) {
this.screen.stdout?.write(line ? line + "\n" : "\n");
}
}
function formatFailure(screen, config, test, index) {
const lines = [];
const header = formatTestHeader(screen, config, test, { indent: " ", index, mode: "error" });
lines.push(screen.colors.red(header));
for (const result of test.results) {
const resultLines = [];
const errors = formatResultFailure(screen, test, result, " ");
if (!errors.length)
continue;
if (result.retry) {
resultLines.push("");
resultLines.push(screen.colors.gray(separator(screen, ` Retry #${result.retry}`)));
}
resultLines.push(...errors.map((error) => "\n" + error.message));
const attachmentGroups = groupAttachments(result.attachments);
for (let i = 0; i < attachmentGroups.length; ++i) {
const attachment = attachmentGroups[i];
if (attachment.name === "error-context" && attachment.path) {
resultLines.push("");
resultLines.push(screen.colors.dim(` Error Context: ${relativeFilePath(screen, config, attachment.path)}`));
continue;
}
if (attachment.name.startsWith("_"))
continue;
const hasPrintableContent = attachment.contentType.startsWith("text/");
if (!attachment.path && !hasPrintableContent)
continue;
resultLines.push("");
resultLines.push(screen.colors.dim(separator(screen, ` attachment #${i + 1}: ${screen.colors.bold(attachment.name)} (${attachment.contentType})`)));
if (attachment.actual?.path) {
if (attachment.expected?.path) {
const expectedPath = relativeFilePath(screen, config, attachment.expected.path);
resultLines.push(screen.colors.dim(` Expected: ${expectedPath}`));
}
const actualPath = relativeFilePath(screen, config, attachment.actual.path);
resultLines.push(screen.colors.dim(` Received: ${actualPath}`));
if (attachment.previous?.path) {
const previousPath = relativeFilePath(screen, config, attachment.previous.path);
resultLines.push(screen.colors.dim(` Previous: ${previousPath}`));
}
if (attachment.diff?.path) {
const diffPath = relativeFilePath(screen, config, attachment.diff.path);
resultLines.push(screen.colors.dim(` Diff: ${diffPath}`));
}
} else if (attachment.path) {
const relativePath = relativeFilePath(screen, config, attachment.path);
resultLines.push(screen.colors.dim(` ${relativePath}`));
if (attachment.name === "trace") {
const packageManagerCommand = (0, import_utils.getPackageManagerExecCommand)();
resultLines.push(screen.colors.dim(` Usage:`));
resultLines.push("");
resultLines.push(screen.colors.dim(` ${packageManagerCommand} playwright show-trace ${quotePathIfNeeded(relativePath)}`));
resultLines.push("");
}
} else {
if (attachment.contentType.startsWith("text/") && attachment.body) {
let text = attachment.body.toString();
if (text.length > 300)
text = text.slice(0, 300) + "...";
for (const line of text.split("\n"))
resultLines.push(screen.colors.dim(` ${line}`));
}
}
resultLines.push(screen.colors.dim(separator(screen, " ")));
}
lines.push(...resultLines);
}
lines.push("");
return lines.join("\n");
}
function formatRetry(screen, result) {
const retryLines = [];
if (result.retry) {
retryLines.push("");
retryLines.push(screen.colors.gray(separator(screen, ` Retry #${result.retry}`)));
}
return retryLines;
}
function quotePathIfNeeded(path2) {
if (/\s/.test(path2))
return `"${path2}"`;
return path2;
}
function formatResultFailure(screen, test, result, initialIndent) {
const errorDetails = [];
if (result.status === "passed" && test.expectedStatus === "failed") {
errorDetails.push({
message: indent(screen.colors.red(`Expected to fail, but passed.`), initialIndent)
});
}
if (result.status === "interrupted") {
errorDetails.push({
message: indent(screen.colors.red(`Test was interrupted.`), initialIndent)
});
}
for (const error of result.errors) {
const formattedError = formatError(screen, error);
errorDetails.push({
message: indent(formattedError.message, initialIndent),
location: formattedError.location
});
}
return errorDetails;
}
function relativeFilePath(screen, config, file) {
if (screen.resolveFiles === "cwd")
return import_path.default.relative(process.cwd(), file);
return import_path.default.relative(config.rootDir, file);
}
function relativeTestPath(screen, config, test) {
return relativeFilePath(screen, config, test.location.file);
}
function stepSuffix(step) {
const stepTitles = step ? step.titlePath() : [];
return stepTitles.map((t) => t.split("\n")[0]).map((t) => " \u203A " + t).join("");
}
function formatTestTitle(screen, config, test, step, omitLocation = false) {
const [, projectName, , ...titles] = test.titlePath();
let location;
if (omitLocation)
location = `${relativeTestPath(screen, config, test)}`;
else
location = `${relativeTestPath(screen, config, test)}:${test.location.line}:${test.location.column}`;
const projectTitle = projectName ? `[${projectName}] \u203A ` : "";
const testTitle = `${projectTitle}${location} \u203A ${titles.join(" \u203A ")}`;
const extraTags = test.tags.filter((t) => !testTitle.includes(t));
return `${testTitle}${stepSuffix(step)}${extraTags.length ? " " + extraTags.join(" ") : ""}`;
}
function formatTestHeader(screen, config, test, options = {}) {
const title = formatTestTitle(screen, config, test);
const header = `${options.indent || ""}${options.index ? options.index + ") " : ""}${title}`;
let fullHeader = header;
if (options.mode === "error") {
const stepPaths = /* @__PURE__ */ new Set();
for (const result of test.results.filter((r) => !!r.errors.length)) {
const stepPath = [];
const visit = (steps) => {
const errors = steps.filter((s) => s.error);
if (errors.length > 1)
return;
if (errors.length === 1 && errors[0].category === "test.step") {
stepPath.push(errors[0].title);
visit(errors[0].steps);
}
};
visit(result.steps);
stepPaths.add(["", ...stepPath].join(" \u203A "));
}
fullHeader = header + (stepPaths.size === 1 ? stepPaths.values().next().value : "");
}
return separator(screen, fullHeader);
}
function formatError(screen, error) {
const message = error.message || error.value || "";
const stack = error.stack;
if (!stack && !error.location)
return { message };
const tokens = [];
const parsedStack = stack ? prepareErrorStack(stack) : void 0;
tokens.push(parsedStack?.message || message);
if (error.snippet) {
let snippet = error.snippet;
if (!screen.colors.enabled)
snippet = (0, import_util.stripAnsiEscapes)(snippet);
tokens.push("");
tokens.push(snippet);
}
if (parsedStack && parsedStack.stackLines.length)
tokens.push(screen.colors.dim(parsedStack.stackLines.join("\n")));
let location = error.location;
if (parsedStack && !location)
location = parsedStack.location;
if (error.cause)
tokens.push(screen.colors.dim("[cause]: ") + formatError(screen, error.cause).message);
return {
location,
message: tokens.join("\n")
};
}
function separator(screen, text = "") {
if (text)
text += " ";
const columns = Math.min(100, screen.ttyWidth || 100);
return text + screen.colors.dim("\u2500".repeat(Math.max(0, columns - (0, import_util.stripAnsiEscapes)(text).length)));
}
function indent(lines, tab) {
return lines.replace(/^(?=.+$)/gm, tab);
}
function prepareErrorStack(stack) {
return (0, import_utils.parseErrorStack)(stack, import_path.default.sep, !!process.env.PWDEBUGIMPL);
}
function characterWidth(c) {
return import_utilsBundle2.getEastAsianWidth.eastAsianWidth(c.codePointAt(0));
}
function stringWidth(v) {
let width = 0;
for (const { segment } of new Intl.Segmenter(void 0, { granularity: "grapheme" }).segment(v))
width += characterWidth(segment);
return width;
}
function suffixOfWidth(v, width) {
const segments = [...new Intl.Segmenter(void 0, { granularity: "grapheme" }).segment(v)];
let suffixBegin = v.length;
for (const { segment, index } of segments.reverse()) {
const segmentWidth = stringWidth(segment);
if (segmentWidth > width)
break;
width -= segmentWidth;
suffixBegin = index;
}
return v.substring(suffixBegin);
}
function fitToWidth(line, width, prefix) {
const prefixLength = prefix ? (0, import_util.stripAnsiEscapes)(prefix).length : 0;
width -= prefixLength;
if (stringWidth(line) <= width)
return line;
const parts = line.split(import_util.ansiRegex);
const taken = [];
for (let i = parts.length - 1; i >= 0; i--) {
if (i % 2) {
taken.push(parts[i]);
} else {
let part = suffixOfWidth(parts[i], width);
const wasTruncated = part.length < parts[i].length;
if (wasTruncated && parts[i].length > 0) {
part = "\u2026" + suffixOfWidth(parts[i], width - 1);
}
taken.push(part);
width -= stringWidth(part);
}
}
return taken.reverse().join("");
}
function resolveFromEnv(name) {
const value = process.env[name];
if (value)
return import_path.default.resolve(process.cwd(), value);
return void 0;
}
function resolveOutputFile(reporterName, options) {
const name = reporterName.toUpperCase();
let outputFile = resolveFromEnv(`PLAYWRIGHT_${name}_OUTPUT_FILE`);
if (!outputFile && options.outputFile)
outputFile = import_path.default.resolve(options.configDir, options.outputFile);
if (outputFile)
return { outputFile };
let outputDir = resolveFromEnv(`PLAYWRIGHT_${name}_OUTPUT_DIR`);
if (!outputDir && options.outputDir)
outputDir = import_path.default.resolve(options.configDir, options.outputDir);
if (!outputDir && options.default)
outputDir = (0, import_util.resolveReporterOutputPath)(options.default.outputDir, options.configDir, void 0);
if (!outputDir)
outputDir = options.configDir;
const reportName = process.env[`PLAYWRIGHT_${name}_OUTPUT_NAME`] ?? options.fileName ?? options.default?.fileName;
if (!reportName)
return void 0;
outputFile = import_path.default.resolve(outputDir, reportName);
return { outputFile, outputDir };
}
function groupAttachments(attachments) {
const result = [];
const attachmentsByPrefix = /* @__PURE__ */ new Map();
for (const attachment of attachments) {
if (!attachment.path) {
result.push(attachment);
continue;
}
const match = attachment.name.match(/^(.*)-(expected|actual|diff|previous)(\.[^.]+)?$/);
if (!match) {
result.push(attachment);
continue;
}
const [, name, category] = match;
let group = attachmentsByPrefix.get(name);
if (!group) {
group = { ...attachment, name };
attachmentsByPrefix.set(name, group);
result.push(group);
}
if (category === "expected")
group.expected = attachment;
else if (category === "actual")
group.actual = attachment;
else if (category === "diff")
group.diff = attachment;
else if (category === "previous")
group.previous = attachment;
}
return result;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
TerminalReporter,
fitToWidth,
formatError,
formatFailure,
formatResultFailure,
formatRetry,
internalScreen,
kOutputSymbol,
nonTerminalScreen,
prepareErrorStack,
relativeFilePath,
resolveOutputFile,
separator,
stepSuffix,
terminalScreen
});
+135
View File
@@ -0,0 +1,135 @@
"use strict";
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 __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);
var blob_exports = {};
__export(blob_exports, {
BlobReporter: () => BlobReporter,
currentBlobReportVersion: () => currentBlobReportVersion
});
module.exports = __toCommonJS(blob_exports);
var import_fs = __toESM(require("fs"));
var import_path = __toESM(require("path"));
var import_stream = require("stream");
var import_utils = require("playwright-core/lib/utils");
var import_utils2 = require("playwright-core/lib/utils");
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
var import_zipBundle = require("playwright-core/lib/zipBundle");
var import_base = require("./base");
var import_teleEmitter = require("./teleEmitter");
const currentBlobReportVersion = 2;
class BlobReporter extends import_teleEmitter.TeleReporterEmitter {
constructor(options) {
super((message) => this._messages.push(message));
this._messages = [];
this._attachments = [];
this._options = options;
if (this._options.fileName && !this._options.fileName.endsWith(".zip"))
throw new Error(`Blob report file name must end with .zip extension: ${this._options.fileName}`);
this._salt = (0, import_utils2.createGuid)();
}
onConfigure(config) {
const metadata = {
version: currentBlobReportVersion,
userAgent: (0, import_utils2.getUserAgent)(),
name: process.env.PWTEST_BOT_NAME,
shard: config.shard ?? void 0,
pathSeparator: import_path.default.sep
};
this._messages.push({
method: "onBlobReportMetadata",
params: metadata
});
this._config = config;
super.onConfigure(config);
}
async onEnd(result) {
await super.onEnd(result);
const zipFileName = await this._prepareOutputFile();
const zipFile = new import_zipBundle.yazl.ZipFile();
const zipFinishPromise = new import_utils2.ManualPromise();
const finishPromise = zipFinishPromise.catch((e) => {
throw new Error(`Failed to write report ${zipFileName}: ` + e.message);
});
zipFile.on("error", (error) => zipFinishPromise.reject(error));
zipFile.outputStream.pipe(import_fs.default.createWriteStream(zipFileName)).on("close", () => {
zipFinishPromise.resolve(void 0);
}).on("error", (error) => zipFinishPromise.reject(error));
for (const { originalPath, zipEntryPath } of this._attachments) {
if (!import_fs.default.statSync(originalPath, { throwIfNoEntry: false })?.isFile())
continue;
zipFile.addFile(originalPath, zipEntryPath);
}
const lines = this._messages.map((m) => JSON.stringify(m) + "\n");
const content = import_stream.Readable.from(lines);
zipFile.addReadStream(content, "report.jsonl");
zipFile.end();
await finishPromise;
}
async _prepareOutputFile() {
const { outputFile, outputDir } = (0, import_base.resolveOutputFile)("BLOB", {
...this._options,
default: {
fileName: this._defaultReportName(this._config),
outputDir: "blob-report"
}
});
if (!process.env.PWTEST_BLOB_DO_NOT_REMOVE)
await (0, import_utils.removeFolders)([outputDir]);
await import_fs.default.promises.mkdir(import_path.default.dirname(outputFile), { recursive: true });
return outputFile;
}
_defaultReportName(config) {
let reportName = "report";
if (this._options._commandHash)
reportName += "-" + (0, import_utils.sanitizeForFilePath)(this._options._commandHash);
if (config.shard) {
const paddedNumber = `${config.shard.current}`.padStart(`${config.shard.total}`.length, "0");
reportName = `${reportName}-${paddedNumber}`;
}
return `${reportName}.zip`;
}
_serializeAttachments(attachments) {
return super._serializeAttachments(attachments).map((attachment) => {
if (!attachment.path)
return attachment;
const sha1 = (0, import_utils2.calculateSha1)(attachment.path + this._salt);
const extension = import_utilsBundle.mime.getExtension(attachment.contentType) || "dat";
const newPath = `resources/${sha1}.${extension}`;
this._attachments.push({ originalPath: attachment.path, zipEntryPath: newPath });
return {
...attachment,
path: newPath
};
});
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
BlobReporter,
currentBlobReportVersion
});
+82
View File
@@ -0,0 +1,82 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var dot_exports = {};
__export(dot_exports, {
default: () => dot_default
});
module.exports = __toCommonJS(dot_exports);
var import_base = require("./base");
class DotReporter extends import_base.TerminalReporter {
constructor() {
super(...arguments);
this._counter = 0;
}
onBegin(suite) {
super.onBegin(suite);
this.writeLine(this.generateStartingMessage());
}
onStdOut(chunk, test, result) {
super.onStdOut(chunk, test, result);
if (!this.config.quiet)
this.screen.stdout.write(chunk);
}
onStdErr(chunk, test, result) {
super.onStdErr(chunk, test, result);
if (!this.config.quiet)
this.screen.stderr.write(chunk);
}
onTestEnd(test, result) {
super.onTestEnd(test, result);
if (this._counter === 80) {
this.screen.stdout.write("\n");
this._counter = 0;
}
++this._counter;
if (result.status === "skipped") {
this.screen.stdout.write(this.screen.colors.yellow("\xB0"));
return;
}
if (this.willRetry(test)) {
this.screen.stdout.write(this.screen.colors.gray("\xD7"));
return;
}
switch (test.outcome()) {
case "expected":
this.screen.stdout.write(this.screen.colors.green("\xB7"));
break;
case "unexpected":
this.screen.stdout.write(this.screen.colors.red(result.status === "timedOut" ? "T" : "F"));
break;
case "flaky":
this.screen.stdout.write(this.screen.colors.yellow("\xB1"));
break;
}
}
onError(error) {
super.onError(error);
this.writeLine("\n" + this.formatError(error).message);
this._counter = 0;
}
async onEnd(result) {
await super.onEnd(result);
this.screen.stdout.write("\n");
this.epilogue(true);
}
}
var dot_default = DotReporter;
+32
View File
@@ -0,0 +1,32 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var empty_exports = {};
__export(empty_exports, {
default: () => empty_default
});
module.exports = __toCommonJS(empty_exports);
class EmptyReporter {
version() {
return "v2";
}
printsToStdio() {
return false;
}
}
var empty_default = EmptyReporter;
+128
View File
@@ -0,0 +1,128 @@
"use strict";
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 __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);
var github_exports = {};
__export(github_exports, {
GitHubReporter: () => GitHubReporter,
default: () => github_default
});
module.exports = __toCommonJS(github_exports);
var import_path = __toESM(require("path"));
var import_utils = require("playwright-core/lib/utils");
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
var import_base = require("./base");
var import_util = require("../util");
class GitHubLogger {
_log(message, type = "notice", options = {}) {
message = message.replace(/\n/g, "%0A");
const configs = Object.entries(options).map(([key, option]) => `${key}=${option}`).join(",");
process.stdout.write((0, import_util.stripAnsiEscapes)(`::${type} ${configs}::${message}
`));
}
debug(message, options) {
this._log(message, "debug", options);
}
error(message, options) {
this._log(message, "error", options);
}
notice(message, options) {
this._log(message, "notice", options);
}
warning(message, options) {
this._log(message, "warning", options);
}
}
class GitHubReporter extends import_base.TerminalReporter {
constructor(options = {}) {
super(options);
this.githubLogger = new GitHubLogger();
this.screen = { ...this.screen, colors: import_utils.noColors };
}
printsToStdio() {
return false;
}
async onEnd(result) {
await super.onEnd(result);
this._printAnnotations();
}
onError(error) {
const errorMessage = this.formatError(error).message;
this.githubLogger.error(errorMessage);
}
_printAnnotations() {
const summary = this.generateSummary();
const summaryMessage = this.generateSummaryMessage(summary);
if (summary.failuresToPrint.length)
this._printFailureAnnotations(summary.failuresToPrint);
this._printSlowTestAnnotations();
this._printSummaryAnnotation(summaryMessage);
}
_printSlowTestAnnotations() {
this.getSlowTests().forEach(([file, duration]) => {
const filePath = workspaceRelativePath(import_path.default.join(process.cwd(), file));
this.githubLogger.warning(`${filePath} took ${(0, import_utilsBundle.ms)(duration)}`, {
title: "Slow Test",
file: filePath
});
});
}
_printSummaryAnnotation(summary) {
this.githubLogger.notice(summary, {
title: "\u{1F3AD} Playwright Run Summary"
});
}
_printFailureAnnotations(failures) {
failures.forEach((test, index) => {
const title = this.formatTestTitle(test);
const header = this.formatTestHeader(test, { indent: " ", index: index + 1, mode: "error" });
for (const result of test.results) {
const errors = (0, import_base.formatResultFailure)(this.screen, test, result, " ");
for (const error of errors) {
const options = {
file: workspaceRelativePath(error.location?.file || test.location.file),
title
};
if (error.location) {
options.line = error.location.line;
options.col = error.location.column;
}
const message = [header, ...(0, import_base.formatRetry)(this.screen, result), error.message].join("\n");
this.githubLogger.error(message, options);
}
}
});
}
}
function workspaceRelativePath(filePath) {
return import_path.default.relative(process.env["GITHUB_WORKSPACE"] ?? "", filePath);
}
var github_default = GitHubReporter;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
GitHubReporter
});
+631
View File
@@ -0,0 +1,631 @@
"use strict";
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 __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);
var html_exports = {};
__export(html_exports, {
default: () => html_default,
showHTMLReport: () => showHTMLReport,
startHtmlReportServer: () => startHtmlReportServer
});
module.exports = __toCommonJS(html_exports);
var import_fs = __toESM(require("fs"));
var import_path = __toESM(require("path"));
var import_stream = require("stream");
var import_utils = require("playwright-core/lib/utils");
var import_utils2 = require("playwright-core/lib/utils");
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
var import_utilsBundle2 = require("playwright-core/lib/utilsBundle");
var import_zipBundle = require("playwright-core/lib/zipBundle");
var import_base = require("./base");
var import_babelBundle = require("../transform/babelBundle");
var import_util = require("../util");
const htmlReportOptions = ["always", "never", "on-failure"];
const isHtmlReportOption = (type) => {
return htmlReportOptions.includes(type);
};
class HtmlReporter {
constructor(options) {
this._topLevelErrors = [];
this._options = options;
}
version() {
return "v2";
}
printsToStdio() {
return false;
}
onConfigure(config) {
this.config = config;
}
onBegin(suite) {
const { outputFolder, open: open2, attachmentsBaseURL, host, port } = this._resolveOptions();
this._outputFolder = outputFolder;
this._open = open2;
this._host = host;
this._port = port;
this._attachmentsBaseURL = attachmentsBaseURL;
const reportedWarnings = /* @__PURE__ */ new Set();
for (const project of this.config.projects) {
if (this._isSubdirectory(outputFolder, project.outputDir) || this._isSubdirectory(project.outputDir, outputFolder)) {
const key = outputFolder + "|" + project.outputDir;
if (reportedWarnings.has(key))
continue;
reportedWarnings.add(key);
writeLine(import_utils2.colors.red(`Configuration Error: HTML reporter output folder clashes with the tests output folder:`));
writeLine(`
html reporter folder: ${import_utils2.colors.bold(outputFolder)}
test results folder: ${import_utils2.colors.bold(project.outputDir)}`);
writeLine("");
writeLine(`HTML reporter will clear its output directory prior to being generated, which will lead to the artifact loss.
`);
}
}
this.suite = suite;
}
_resolveOptions() {
const outputFolder = reportFolderFromEnv() ?? (0, import_util.resolveReporterOutputPath)("playwright-report", this._options.configDir, this._options.outputFolder);
return {
outputFolder,
open: getHtmlReportOptionProcessEnv() || this._options.open || "on-failure",
attachmentsBaseURL: process.env.PLAYWRIGHT_HTML_ATTACHMENTS_BASE_URL || this._options.attachmentsBaseURL || "data/",
host: process.env.PLAYWRIGHT_HTML_HOST || this._options.host,
port: process.env.PLAYWRIGHT_HTML_PORT ? +process.env.PLAYWRIGHT_HTML_PORT : this._options.port
};
}
_isSubdirectory(parentDir, dir) {
const relativePath = import_path.default.relative(parentDir, dir);
return !!relativePath && !relativePath.startsWith("..") && !import_path.default.isAbsolute(relativePath);
}
onError(error) {
this._topLevelErrors.push(error);
}
async onEnd(result) {
const projectSuites = this.suite.suites;
await (0, import_utils.removeFolders)([this._outputFolder]);
let noSnippets;
if (process.env.PLAYWRIGHT_HTML_NO_SNIPPETS === "false" || process.env.PLAYWRIGHT_HTML_NO_SNIPPETS === "0")
noSnippets = false;
else if (process.env.PLAYWRIGHT_HTML_NO_SNIPPETS)
noSnippets = true;
noSnippets = noSnippets || this._options.noSnippets;
const builder = new HtmlBuilder(this.config, this._outputFolder, this._attachmentsBaseURL, process.env.PLAYWRIGHT_HTML_TITLE || this._options.title, noSnippets);
this._buildResult = await builder.build(this.config.metadata, projectSuites, result, this._topLevelErrors);
}
async onExit() {
if (process.env.CI || !this._buildResult)
return;
const { ok, singleTestId } = this._buildResult;
const shouldOpen = !this._options._isTestServer && (this._open === "always" || !ok && this._open === "on-failure");
if (shouldOpen) {
await showHTMLReport(this._outputFolder, this._host, this._port, singleTestId);
} else if (this._options._mode === "test" && !this._options._isTestServer) {
const packageManagerCommand = (0, import_utils.getPackageManagerExecCommand)();
const relativeReportPath = this._outputFolder === standaloneDefaultFolder() ? "" : " " + import_path.default.relative(process.cwd(), this._outputFolder);
const hostArg = this._host ? ` --host ${this._host}` : "";
const portArg = this._port ? ` --port ${this._port}` : "";
writeLine("");
writeLine("To open last HTML report run:");
writeLine(import_utils2.colors.cyan(`
${packageManagerCommand} playwright show-report${relativeReportPath}${hostArg}${portArg}
`));
}
}
}
function reportFolderFromEnv() {
const envValue = process.env.PLAYWRIGHT_HTML_OUTPUT_DIR || process.env.PLAYWRIGHT_HTML_REPORT;
return envValue ? import_path.default.resolve(envValue) : void 0;
}
function getHtmlReportOptionProcessEnv() {
const htmlOpenEnv = process.env.PLAYWRIGHT_HTML_OPEN || process.env.PW_TEST_HTML_REPORT_OPEN;
if (!htmlOpenEnv)
return void 0;
if (!isHtmlReportOption(htmlOpenEnv)) {
writeLine(import_utils2.colors.red(`Configuration Error: HTML reporter Invalid value for PLAYWRIGHT_HTML_OPEN: ${htmlOpenEnv}. Valid values are: ${htmlReportOptions.join(", ")}`));
return void 0;
}
return htmlOpenEnv;
}
function standaloneDefaultFolder() {
return reportFolderFromEnv() ?? (0, import_util.resolveReporterOutputPath)("playwright-report", process.cwd(), void 0);
}
async function showHTMLReport(reportFolder, host = "localhost", port, testId) {
const folder = reportFolder ?? standaloneDefaultFolder();
try {
(0, import_utils.assert)(import_fs.default.statSync(folder).isDirectory());
} catch (e) {
writeLine(import_utils2.colors.red(`No report found at "${folder}"`));
(0, import_utils.gracefullyProcessExitDoNotHang)(1);
return;
}
const server = startHtmlReportServer(folder);
await server.start({ port, host, preferredPort: port ? void 0 : 9323 });
let url = server.urlPrefix("human-readable");
writeLine("");
writeLine(import_utils2.colors.cyan(` Serving HTML report at ${url}. Press Ctrl+C to quit.`));
if (testId)
url += `#?testId=${testId}`;
url = url.replace("0.0.0.0", "localhost");
await (0, import_utilsBundle.open)(url, { wait: true }).catch(() => {
});
await new Promise(() => {
});
}
function startHtmlReportServer(folder) {
const server = new import_utils.HttpServer();
server.routePrefix("/", (request, response) => {
let relativePath = new URL("http://localhost" + request.url).pathname;
if (relativePath.startsWith("/trace/file")) {
const url = new URL("http://localhost" + request.url);
try {
return server.serveFile(request, response, url.searchParams.get("path"));
} catch (e) {
return false;
}
}
if (relativePath.endsWith("/stall.js"))
return true;
if (relativePath === "/")
relativePath = "/index.html";
const absolutePath = import_path.default.join(folder, ...relativePath.split("/"));
return server.serveFile(request, response, absolutePath);
});
return server;
}
class HtmlBuilder {
constructor(config, outputDir, attachmentsBaseURL, title, noSnippets = false) {
this._stepsInFile = new import_utils.MultiMap();
this._hasTraces = false;
this._config = config;
this._reportFolder = outputDir;
this._noSnippets = noSnippets;
import_fs.default.mkdirSync(this._reportFolder, { recursive: true });
this._dataZipFile = new import_zipBundle.yazl.ZipFile();
this._attachmentsBaseURL = attachmentsBaseURL;
this._title = title;
}
async build(metadata, projectSuites, result, topLevelErrors) {
const data = /* @__PURE__ */ new Map();
for (const projectSuite of projectSuites) {
for (const fileSuite of projectSuite.suites) {
const fileName = this._relativeLocation(fileSuite.location).file;
const fileId = (0, import_utils.calculateSha1)((0, import_utils.toPosixPath)(fileName)).slice(0, 20);
let fileEntry = data.get(fileId);
if (!fileEntry) {
fileEntry = {
testFile: { fileId, fileName, tests: [] },
testFileSummary: { fileId, fileName, tests: [], stats: emptyStats() }
};
data.set(fileId, fileEntry);
}
const { testFile, testFileSummary } = fileEntry;
const testEntries = [];
this._processSuite(fileSuite, projectSuite.project().name, [], testEntries);
for (const test of testEntries) {
testFile.tests.push(test.testCase);
testFileSummary.tests.push(test.testCaseSummary);
}
}
}
if (!this._noSnippets)
createSnippets(this._stepsInFile);
let ok = true;
for (const [fileId, { testFile, testFileSummary }] of data) {
const stats = testFileSummary.stats;
for (const test of testFileSummary.tests) {
if (test.outcome === "expected")
++stats.expected;
if (test.outcome === "skipped")
++stats.skipped;
if (test.outcome === "unexpected")
++stats.unexpected;
if (test.outcome === "flaky")
++stats.flaky;
++stats.total;
}
stats.ok = stats.unexpected + stats.flaky === 0;
if (!stats.ok)
ok = false;
const testCaseSummaryComparator = (t1, t2) => {
const w1 = (t1.outcome === "unexpected" ? 1e3 : 0) + (t1.outcome === "flaky" ? 1 : 0);
const w2 = (t2.outcome === "unexpected" ? 1e3 : 0) + (t2.outcome === "flaky" ? 1 : 0);
return w2 - w1;
};
testFileSummary.tests.sort(testCaseSummaryComparator);
this._addDataFile(fileId + ".json", testFile);
}
const htmlReport = {
metadata,
title: this._title,
startTime: result.startTime.getTime(),
duration: result.duration,
files: [...data.values()].map((e) => e.testFileSummary),
projectNames: projectSuites.map((r) => r.project().name),
stats: { ...[...data.values()].reduce((a, e) => addStats(a, e.testFileSummary.stats), emptyStats()) },
errors: topLevelErrors.map((error) => (0, import_base.formatError)(import_base.internalScreen, error).message)
};
htmlReport.files.sort((f1, f2) => {
const w1 = f1.stats.unexpected * 1e3 + f1.stats.flaky;
const w2 = f2.stats.unexpected * 1e3 + f2.stats.flaky;
return w2 - w1;
});
this._addDataFile("report.json", htmlReport);
let singleTestId;
if (htmlReport.stats.total === 1) {
const testFile = data.values().next().value.testFile;
singleTestId = testFile.tests[0].testId;
}
if (process.env.PW_HMR === "1") {
const redirectFile = import_path.default.join(this._reportFolder, "index.html");
await this._writeReportData(redirectFile);
async function redirect() {
const hmrURL = new URL("http://localhost:44224");
const popup = window.open(hmrURL);
const listener = (evt) => {
if (evt.source === popup && evt.data === "ready") {
const element = document.getElementById("playwrightReportBase64");
popup.postMessage(element?.textContent ?? "", hmrURL.origin);
window.removeEventListener("message", listener);
window.close();
}
};
window.addEventListener("message", listener);
}
import_fs.default.appendFileSync(redirectFile, `<script>(${redirect.toString()})()</script>`);
return { ok, singleTestId };
}
const appFolder = import_path.default.join(require.resolve("playwright-core"), "..", "lib", "vite", "htmlReport");
await (0, import_utils.copyFileAndMakeWritable)(import_path.default.join(appFolder, "index.html"), import_path.default.join(this._reportFolder, "index.html"));
if (this._hasTraces) {
const traceViewerFolder = import_path.default.join(require.resolve("playwright-core"), "..", "lib", "vite", "traceViewer");
const traceViewerTargetFolder = import_path.default.join(this._reportFolder, "trace");
const traceViewerAssetsTargetFolder = import_path.default.join(traceViewerTargetFolder, "assets");
import_fs.default.mkdirSync(traceViewerAssetsTargetFolder, { recursive: true });
for (const file of import_fs.default.readdirSync(traceViewerFolder)) {
if (file.endsWith(".map") || file.includes("watch") || file.includes("assets"))
continue;
await (0, import_utils.copyFileAndMakeWritable)(import_path.default.join(traceViewerFolder, file), import_path.default.join(traceViewerTargetFolder, file));
}
for (const file of import_fs.default.readdirSync(import_path.default.join(traceViewerFolder, "assets"))) {
if (file.endsWith(".map") || file.includes("xtermModule"))
continue;
await (0, import_utils.copyFileAndMakeWritable)(import_path.default.join(traceViewerFolder, "assets", file), import_path.default.join(traceViewerAssetsTargetFolder, file));
}
}
await this._writeReportData(import_path.default.join(this._reportFolder, "index.html"));
return { ok, singleTestId };
}
async _writeReportData(filePath) {
import_fs.default.appendFileSync(filePath, '<script id="playwrightReportBase64" type="application/zip">data:application/zip;base64,');
await new Promise((f) => {
this._dataZipFile.end(void 0, () => {
this._dataZipFile.outputStream.pipe(new Base64Encoder()).pipe(import_fs.default.createWriteStream(filePath, { flags: "a" })).on("close", f);
});
});
import_fs.default.appendFileSync(filePath, "</script>");
}
_addDataFile(fileName, data) {
this._dataZipFile.addBuffer(Buffer.from(JSON.stringify(data)), fileName);
}
_processSuite(suite, projectName, path2, outTests) {
const newPath = [...path2, suite.title];
suite.entries().forEach((e) => {
if (e.type === "test")
outTests.push(this._createTestEntry(e, projectName, newPath));
else
this._processSuite(e, projectName, newPath, outTests);
});
}
_createTestEntry(test, projectName, path2) {
const duration = test.results.reduce((a, r) => a + r.duration, 0);
const location = this._relativeLocation(test.location);
path2 = path2.slice(1).filter((path3) => path3.length > 0);
const results = test.results.map((r) => this._createTestResult(test, r));
return {
testCase: {
testId: test.id,
title: test.title,
projectName,
location,
duration,
annotations: this._serializeAnnotations(test.annotations),
tags: test.tags,
outcome: test.outcome(),
path: path2,
results,
ok: test.outcome() === "expected" || test.outcome() === "flaky"
},
testCaseSummary: {
testId: test.id,
title: test.title,
projectName,
location,
duration,
annotations: this._serializeAnnotations(test.annotations),
tags: test.tags,
outcome: test.outcome(),
path: path2,
ok: test.outcome() === "expected" || test.outcome() === "flaky",
results: results.map((result) => {
return { attachments: result.attachments.map((a) => ({ name: a.name, contentType: a.contentType, path: a.path })) };
})
}
};
}
_serializeAttachments(attachments) {
let lastAttachment;
return attachments.map((a) => {
if (a.name === "trace")
this._hasTraces = true;
if ((a.name === "stdout" || a.name === "stderr") && a.contentType === "text/plain") {
if (lastAttachment && lastAttachment.name === a.name && lastAttachment.contentType === a.contentType) {
lastAttachment.body += (0, import_util.stripAnsiEscapes)(a.body);
return null;
}
a.body = (0, import_util.stripAnsiEscapes)(a.body);
lastAttachment = a;
return a;
}
if (a.path) {
let fileName = a.path;
try {
const buffer = import_fs.default.readFileSync(a.path);
const sha1 = (0, import_utils.calculateSha1)(buffer) + import_path.default.extname(a.path);
fileName = this._attachmentsBaseURL + sha1;
import_fs.default.mkdirSync(import_path.default.join(this._reportFolder, "data"), { recursive: true });
import_fs.default.writeFileSync(import_path.default.join(this._reportFolder, "data", sha1), buffer);
} catch (e) {
}
return {
name: a.name,
contentType: a.contentType,
path: fileName,
body: a.body
};
}
if (a.body instanceof Buffer) {
if (isTextContentType(a.contentType)) {
const charset = a.contentType.match(/charset=(.*)/)?.[1];
try {
const body = a.body.toString(charset || "utf-8");
return {
name: a.name,
contentType: a.contentType,
body
};
} catch (e) {
}
}
import_fs.default.mkdirSync(import_path.default.join(this._reportFolder, "data"), { recursive: true });
const extension = (0, import_utils.sanitizeForFilePath)(import_path.default.extname(a.name).replace(/^\./, "")) || import_utilsBundle2.mime.getExtension(a.contentType) || "dat";
const sha1 = (0, import_utils.calculateSha1)(a.body) + "." + extension;
import_fs.default.writeFileSync(import_path.default.join(this._reportFolder, "data", sha1), a.body);
return {
name: a.name,
contentType: a.contentType,
path: this._attachmentsBaseURL + sha1
};
}
return {
name: a.name,
contentType: a.contentType,
body: a.body
};
}).filter(Boolean);
}
_serializeAnnotations(annotations) {
return annotations.map((a) => ({
type: a.type,
description: a.description === void 0 ? void 0 : String(a.description),
location: a.location ? {
file: a.location.file,
line: a.location.line,
column: a.location.column
} : void 0
}));
}
_createTestResult(test, result) {
return {
duration: result.duration,
startTime: result.startTime.toISOString(),
retry: result.retry,
steps: dedupeSteps(result.steps).map((s) => this._createTestStep(s, result)),
errors: (0, import_base.formatResultFailure)(import_base.internalScreen, test, result, "").map((error) => {
return {
message: error.message,
codeframe: error.location ? createErrorCodeframe(error.message, error.location) : void 0
};
}),
status: result.status,
annotations: this._serializeAnnotations(result.annotations),
attachments: this._serializeAttachments([
...result.attachments,
...result.stdout.map((m) => stdioAttachment(m, "stdout")),
...result.stderr.map((m) => stdioAttachment(m, "stderr"))
])
};
}
_createTestStep(dedupedStep, result) {
const { step, duration, count } = dedupedStep;
const skipped = dedupedStep.step.annotations?.find((a) => a.type === "skip");
let title = step.title;
if (skipped)
title = `${title} (skipped${skipped.description ? ": " + skipped.description : ""})`;
const testStep = {
title,
startTime: step.startTime.toISOString(),
duration,
steps: dedupeSteps(step.steps).map((s) => this._createTestStep(s, result)),
attachments: step.attachments.map((s) => {
const index = result.attachments.indexOf(s);
if (index === -1)
throw new Error("Unexpected, attachment not found");
return index;
}),
location: this._relativeLocation(step.location),
error: step.error?.message,
count,
skipped: !!skipped
};
if (step.location)
this._stepsInFile.set(step.location.file, testStep);
return testStep;
}
_relativeLocation(location) {
if (!location)
return void 0;
const file = (0, import_utils.toPosixPath)(import_path.default.relative(this._config.rootDir, location.file));
return {
file,
line: location.line,
column: location.column
};
}
}
const emptyStats = () => {
return {
total: 0,
expected: 0,
unexpected: 0,
flaky: 0,
skipped: 0,
ok: true
};
};
const addStats = (stats, delta) => {
stats.total += delta.total;
stats.skipped += delta.skipped;
stats.expected += delta.expected;
stats.unexpected += delta.unexpected;
stats.flaky += delta.flaky;
stats.ok = stats.ok && delta.ok;
return stats;
};
class Base64Encoder extends import_stream.Transform {
_transform(chunk, encoding, callback) {
if (this._remainder) {
chunk = Buffer.concat([this._remainder, chunk]);
this._remainder = void 0;
}
const remaining = chunk.length % 3;
if (remaining) {
this._remainder = chunk.slice(chunk.length - remaining);
chunk = chunk.slice(0, chunk.length - remaining);
}
chunk = chunk.toString("base64");
this.push(Buffer.from(chunk));
callback();
}
_flush(callback) {
if (this._remainder)
this.push(Buffer.from(this._remainder.toString("base64")));
callback();
}
}
function isTextContentType(contentType) {
return contentType.startsWith("text/") || contentType.startsWith("application/json");
}
function stdioAttachment(chunk, type) {
return {
name: type,
contentType: "text/plain",
body: typeof chunk === "string" ? chunk : chunk.toString("utf-8")
};
}
function dedupeSteps(steps) {
const result = [];
let lastResult = void 0;
for (const step of steps) {
const canDedupe = !step.error && step.duration >= 0 && step.location?.file && !step.steps.length;
const lastStep = lastResult?.step;
if (canDedupe && lastResult && lastStep && step.category === lastStep.category && step.title === lastStep.title && step.location?.file === lastStep.location?.file && step.location?.line === lastStep.location?.line && step.location?.column === lastStep.location?.column) {
++lastResult.count;
lastResult.duration += step.duration;
continue;
}
lastResult = { step, count: 1, duration: step.duration };
result.push(lastResult);
if (!canDedupe)
lastResult = void 0;
}
return result;
}
function createSnippets(stepsInFile) {
for (const file of stepsInFile.keys()) {
let source;
try {
source = import_fs.default.readFileSync(file, "utf-8") + "\n//";
} catch (e) {
continue;
}
const lines = source.split("\n").length;
const highlighted = (0, import_babelBundle.codeFrameColumns)(source, { start: { line: lines, column: 1 } }, { highlightCode: true, linesAbove: lines, linesBelow: 0 });
const highlightedLines = highlighted.split("\n");
const lineWithArrow = highlightedLines[highlightedLines.length - 1];
for (const step of stepsInFile.get(file)) {
if (step.location.line < 2 || step.location.line >= lines)
continue;
const snippetLines = highlightedLines.slice(step.location.line - 2, step.location.line + 1);
const index = lineWithArrow.indexOf("^");
const shiftedArrow = lineWithArrow.slice(0, index) + " ".repeat(step.location.column - 1) + lineWithArrow.slice(index);
snippetLines.splice(2, 0, shiftedArrow);
step.snippet = snippetLines.join("\n");
}
}
}
function createErrorCodeframe(message, location) {
let source;
try {
source = import_fs.default.readFileSync(location.file, "utf-8") + "\n//";
} catch (e) {
return;
}
return (0, import_babelBundle.codeFrameColumns)(
source,
{
start: {
line: location.line,
column: location.column
}
},
{
highlightCode: false,
linesAbove: 100,
linesBelow: 100,
message: (0, import_util.stripAnsiEscapes)(message).split("\n")[0] || void 0
}
);
}
function writeLine(line) {
process.stdout.write(line + "\n");
}
var html_default = HtmlReporter;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
showHTMLReport,
startHtmlReportServer
});
+130
View File
@@ -0,0 +1,130 @@
"use strict";
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 __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);
var internalReporter_exports = {};
__export(internalReporter_exports, {
InternalReporter: () => InternalReporter
});
module.exports = __toCommonJS(internalReporter_exports);
var import_fs = __toESM(require("fs"));
var import_utils = require("playwright-core/lib/utils");
var import_base = require("./base");
var import_multiplexer = require("./multiplexer");
var import_test = require("../common/test");
var import_babelBundle = require("../transform/babelBundle");
var import_reporterV2 = require("./reporterV2");
class InternalReporter {
constructor(reporters) {
this._didBegin = false;
this._reporter = new import_multiplexer.Multiplexer(reporters.map(import_reporterV2.wrapReporterAsV2));
}
version() {
return "v2";
}
onConfigure(config) {
this._config = config;
this._startTime = /* @__PURE__ */ new Date();
this._monotonicStartTime = (0, import_utils.monotonicTime)();
this._reporter.onConfigure?.(config);
}
onBegin(suite) {
this._didBegin = true;
this._reporter.onBegin?.(suite);
}
onTestBegin(test, result) {
this._reporter.onTestBegin?.(test, result);
}
onStdOut(chunk, test, result) {
this._reporter.onStdOut?.(chunk, test, result);
}
onStdErr(chunk, test, result) {
this._reporter.onStdErr?.(chunk, test, result);
}
onTestEnd(test, result) {
this._addSnippetToTestErrors(test, result);
this._reporter.onTestEnd?.(test, result);
}
async onEnd(result) {
if (!this._didBegin) {
this.onBegin(new import_test.Suite("", "root"));
}
return await this._reporter.onEnd?.({
...result,
startTime: this._startTime,
duration: (0, import_utils.monotonicTime)() - this._monotonicStartTime
});
}
async onExit() {
await this._reporter.onExit?.();
}
onError(error) {
addLocationAndSnippetToError(this._config, error);
this._reporter.onError?.(error);
}
onStepBegin(test, result, step) {
this._reporter.onStepBegin?.(test, result, step);
}
onStepEnd(test, result, step) {
this._addSnippetToStepError(test, step);
this._reporter.onStepEnd?.(test, result, step);
}
printsToStdio() {
return this._reporter.printsToStdio ? this._reporter.printsToStdio() : true;
}
_addSnippetToTestErrors(test, result) {
for (const error of result.errors)
addLocationAndSnippetToError(this._config, error, test.location.file);
}
_addSnippetToStepError(test, step) {
if (step.error)
addLocationAndSnippetToError(this._config, step.error, test.location.file);
}
}
function addLocationAndSnippetToError(config, error, file) {
if (error.stack && !error.location)
error.location = (0, import_base.prepareErrorStack)(error.stack).location;
const location = error.location;
if (!location)
return;
try {
const tokens = [];
const source = import_fs.default.readFileSync(location.file, "utf8");
const codeFrame = (0, import_babelBundle.codeFrameColumns)(source, { start: location }, { highlightCode: true });
if (!file || import_fs.default.realpathSync(file) !== location.file) {
tokens.push(import_base.internalScreen.colors.gray(` at `) + `${(0, import_base.relativeFilePath)(import_base.internalScreen, config, location.file)}:${location.line}`);
tokens.push("");
}
tokens.push(codeFrame);
error.snippet = tokens.join("\n");
} catch (e) {
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
InternalReporter
});
+254
View File
@@ -0,0 +1,254 @@
"use strict";
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 __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);
var json_exports = {};
__export(json_exports, {
default: () => json_default,
serializePatterns: () => serializePatterns
});
module.exports = __toCommonJS(json_exports);
var import_fs = __toESM(require("fs"));
var import_path = __toESM(require("path"));
var import_utils = require("playwright-core/lib/utils");
var import_base = require("./base");
var import_config = require("../common/config");
class JSONReporter {
constructor(options) {
this._errors = [];
this._resolvedOutputFile = (0, import_base.resolveOutputFile)("JSON", options)?.outputFile;
}
version() {
return "v2";
}
printsToStdio() {
return !this._resolvedOutputFile;
}
onConfigure(config) {
this.config = config;
}
onBegin(suite) {
this.suite = suite;
}
onError(error) {
this._errors.push(error);
}
async onEnd(result) {
await outputReport(this._serializeReport(result), this._resolvedOutputFile);
}
_serializeReport(result) {
const report = {
config: {
...removePrivateFields(this.config),
rootDir: (0, import_utils.toPosixPath)(this.config.rootDir),
projects: this.config.projects.map((project) => {
return {
outputDir: (0, import_utils.toPosixPath)(project.outputDir),
repeatEach: project.repeatEach,
retries: project.retries,
metadata: project.metadata,
id: (0, import_config.getProjectId)(project),
name: project.name,
testDir: (0, import_utils.toPosixPath)(project.testDir),
testIgnore: serializePatterns(project.testIgnore),
testMatch: serializePatterns(project.testMatch),
timeout: project.timeout
};
})
},
suites: this._mergeSuites(this.suite.suites),
errors: this._errors,
stats: {
startTime: result.startTime.toISOString(),
duration: result.duration,
expected: 0,
skipped: 0,
unexpected: 0,
flaky: 0
}
};
for (const test of this.suite.allTests())
++report.stats[test.outcome()];
return report;
}
_mergeSuites(suites) {
const fileSuites = new import_utils.MultiMap();
for (const projectSuite of suites) {
const projectId = (0, import_config.getProjectId)(projectSuite.project());
const projectName = projectSuite.project().name;
for (const fileSuite of projectSuite.suites) {
const file = fileSuite.location.file;
const serialized = this._serializeSuite(projectId, projectName, fileSuite);
if (serialized)
fileSuites.set(file, serialized);
}
}
const results = [];
for (const [, suites2] of fileSuites) {
const result = {
title: suites2[0].title,
file: suites2[0].file,
column: 0,
line: 0,
specs: []
};
for (const suite of suites2)
this._mergeTestsFromSuite(result, suite);
results.push(result);
}
return results;
}
_relativeLocation(location) {
if (!location)
return { file: "", line: 0, column: 0 };
return {
file: (0, import_utils.toPosixPath)(import_path.default.relative(this.config.rootDir, location.file)),
line: location.line,
column: location.column
};
}
_locationMatches(s1, s2) {
return s1.file === s2.file && s1.line === s2.line && s1.column === s2.column;
}
_mergeTestsFromSuite(to, from) {
for (const fromSuite of from.suites || []) {
const toSuite = (to.suites || []).find((s) => s.title === fromSuite.title && this._locationMatches(s, fromSuite));
if (toSuite) {
this._mergeTestsFromSuite(toSuite, fromSuite);
} else {
if (!to.suites)
to.suites = [];
to.suites.push(fromSuite);
}
}
for (const spec of from.specs || []) {
const toSpec = to.specs.find((s) => s.title === spec.title && s.file === (0, import_utils.toPosixPath)(import_path.default.relative(this.config.rootDir, spec.file)) && s.line === spec.line && s.column === spec.column);
if (toSpec)
toSpec.tests.push(...spec.tests);
else
to.specs.push(spec);
}
}
_serializeSuite(projectId, projectName, suite) {
if (!suite.allTests().length)
return null;
const suites = suite.suites.map((suite2) => this._serializeSuite(projectId, projectName, suite2)).filter((s) => s);
return {
title: suite.title,
...this._relativeLocation(suite.location),
specs: suite.tests.map((test) => this._serializeTestSpec(projectId, projectName, test)),
suites: suites.length ? suites : void 0
};
}
_serializeTestSpec(projectId, projectName, test) {
return {
title: test.title,
ok: test.ok(),
tags: test.tags.map((tag) => tag.substring(1)),
// Strip '@'.
tests: [this._serializeTest(projectId, projectName, test)],
id: test.id,
...this._relativeLocation(test.location)
};
}
_serializeTest(projectId, projectName, test) {
return {
timeout: test.timeout,
annotations: test.annotations,
expectedStatus: test.expectedStatus,
projectId,
projectName,
results: test.results.map((r) => this._serializeTestResult(r, test)),
status: test.outcome()
};
}
_serializeTestResult(result, test) {
const steps = result.steps.filter((s) => s.category === "test.step");
const jsonResult = {
workerIndex: result.workerIndex,
parallelIndex: result.parallelIndex,
status: result.status,
duration: result.duration,
error: result.error,
errors: result.errors.map((e) => this._serializeError(e)),
stdout: result.stdout.map((s) => stdioEntry(s)),
stderr: result.stderr.map((s) => stdioEntry(s)),
retry: result.retry,
steps: steps.length ? steps.map((s) => this._serializeTestStep(s)) : void 0,
startTime: result.startTime.toISOString(),
annotations: result.annotations,
attachments: result.attachments.map((a) => ({
name: a.name,
contentType: a.contentType,
path: a.path,
body: a.body?.toString("base64")
}))
};
if (result.error?.stack)
jsonResult.errorLocation = (0, import_base.prepareErrorStack)(result.error.stack).location;
return jsonResult;
}
_serializeError(error) {
return (0, import_base.formatError)(import_base.nonTerminalScreen, error);
}
_serializeTestStep(step) {
const steps = step.steps.filter((s) => s.category === "test.step");
return {
title: step.title,
duration: step.duration,
error: step.error,
steps: steps.length ? steps.map((s) => this._serializeTestStep(s)) : void 0
};
}
}
async function outputReport(report, resolvedOutputFile) {
const reportString = JSON.stringify(report, void 0, 2);
if (resolvedOutputFile) {
await import_fs.default.promises.mkdir(import_path.default.dirname(resolvedOutputFile), { recursive: true });
await import_fs.default.promises.writeFile(resolvedOutputFile, reportString);
} else {
console.log(reportString);
}
}
function stdioEntry(s) {
if (typeof s === "string")
return { text: s };
return { buffer: s.toString("base64") };
}
function removePrivateFields(config) {
return Object.fromEntries(Object.entries(config).filter(([name, value]) => !name.startsWith("_")));
}
function serializePatterns(patterns) {
if (!Array.isArray(patterns))
patterns = [patterns];
return patterns.map((s) => s.toString());
}
var json_default = JSONReporter;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
serializePatterns
});
+230
View File
@@ -0,0 +1,230 @@
"use strict";
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 __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);
var junit_exports = {};
__export(junit_exports, {
default: () => junit_default
});
module.exports = __toCommonJS(junit_exports);
var import_fs = __toESM(require("fs"));
var import_path = __toESM(require("path"));
var import_utils = require("playwright-core/lib/utils");
var import_base = require("./base");
var import_util = require("../util");
class JUnitReporter {
constructor(options) {
this.totalTests = 0;
this.totalFailures = 0;
this.totalSkipped = 0;
this.stripANSIControlSequences = false;
this.includeProjectInTestName = false;
this.stripANSIControlSequences = (0, import_utils.getAsBooleanFromENV)("PLAYWRIGHT_JUNIT_STRIP_ANSI", !!options.stripANSIControlSequences);
this.includeProjectInTestName = (0, import_utils.getAsBooleanFromENV)("PLAYWRIGHT_JUNIT_INCLUDE_PROJECT_IN_TEST_NAME", !!options.includeProjectInTestName);
this.configDir = options.configDir;
this.resolvedOutputFile = (0, import_base.resolveOutputFile)("JUNIT", options)?.outputFile;
}
version() {
return "v2";
}
printsToStdio() {
return !this.resolvedOutputFile;
}
onConfigure(config) {
this.config = config;
}
onBegin(suite) {
this.suite = suite;
this.timestamp = /* @__PURE__ */ new Date();
}
async onEnd(result) {
const children = [];
for (const projectSuite of this.suite.suites) {
for (const fileSuite of projectSuite.suites)
children.push(await this._buildTestSuite(projectSuite.title, fileSuite));
}
const tokens = [];
const self = this;
const root = {
name: "testsuites",
attributes: {
id: process.env[`PLAYWRIGHT_JUNIT_SUITE_ID`] || "",
name: process.env[`PLAYWRIGHT_JUNIT_SUITE_NAME`] || "",
tests: self.totalTests,
failures: self.totalFailures,
skipped: self.totalSkipped,
errors: 0,
time: result.duration / 1e3
},
children
};
serializeXML(root, tokens, this.stripANSIControlSequences);
const reportString = tokens.join("\n");
if (this.resolvedOutputFile) {
await import_fs.default.promises.mkdir(import_path.default.dirname(this.resolvedOutputFile), { recursive: true });
await import_fs.default.promises.writeFile(this.resolvedOutputFile, reportString);
} else {
console.log(reportString);
}
}
async _buildTestSuite(projectName, suite) {
let tests = 0;
let skipped = 0;
let failures = 0;
let duration = 0;
const children = [];
const testCaseNamePrefix = projectName && this.includeProjectInTestName ? `[${projectName}] ` : "";
for (const test of suite.allTests()) {
++tests;
if (test.outcome() === "skipped")
++skipped;
if (!test.ok())
++failures;
for (const result of test.results)
duration += result.duration;
await this._addTestCase(suite.title, testCaseNamePrefix, test, children);
}
this.totalTests += tests;
this.totalSkipped += skipped;
this.totalFailures += failures;
const entry = {
name: "testsuite",
attributes: {
name: suite.title,
timestamp: this.timestamp.toISOString(),
hostname: projectName,
tests,
failures,
skipped,
time: duration / 1e3,
errors: 0
},
children
};
return entry;
}
async _addTestCase(suiteName, namePrefix, test, entries) {
const entry = {
name: "testcase",
attributes: {
// Skip root, project, file
name: namePrefix + test.titlePath().slice(3).join(" \u203A "),
// filename
classname: suiteName,
time: test.results.reduce((acc, value) => acc + value.duration, 0) / 1e3
},
children: []
};
entries.push(entry);
const properties = {
name: "properties",
children: []
};
for (const annotation of test.annotations) {
const property = {
name: "property",
attributes: {
name: annotation.type,
value: annotation?.description ? annotation.description : ""
}
};
properties.children?.push(property);
}
if (properties.children?.length)
entry.children.push(properties);
if (test.outcome() === "skipped") {
entry.children.push({ name: "skipped" });
return;
}
if (!test.ok()) {
entry.children.push({
name: "failure",
attributes: {
message: `${import_path.default.basename(test.location.file)}:${test.location.line}:${test.location.column} ${test.title}`,
type: "FAILURE"
},
text: (0, import_util.stripAnsiEscapes)((0, import_base.formatFailure)(import_base.nonTerminalScreen, this.config, test))
});
}
const systemOut = [];
const systemErr = [];
for (const result of test.results) {
systemOut.push(...result.stdout.map((item) => item.toString()));
systemErr.push(...result.stderr.map((item) => item.toString()));
for (const attachment of result.attachments) {
if (!attachment.path)
continue;
let attachmentPath = import_path.default.relative(this.configDir, attachment.path);
try {
if (this.resolvedOutputFile)
attachmentPath = import_path.default.relative(import_path.default.dirname(this.resolvedOutputFile), attachment.path);
} catch {
systemOut.push(`
Warning: Unable to make attachment path ${attachment.path} relative to report output file ${this.resolvedOutputFile}`);
}
try {
await import_fs.default.promises.access(attachment.path);
systemOut.push(`
[[ATTACHMENT|${attachmentPath}]]
`);
} catch {
systemErr.push(`
Warning: attachment ${attachmentPath} is missing`);
}
}
}
if (systemOut.length)
entry.children.push({ name: "system-out", text: systemOut.join("") });
if (systemErr.length)
entry.children.push({ name: "system-err", text: systemErr.join("") });
}
}
function serializeXML(entry, tokens, stripANSIControlSequences) {
const attrs = [];
for (const [name, value] of Object.entries(entry.attributes || {}))
attrs.push(`${name}="${escape(String(value), stripANSIControlSequences, false)}"`);
tokens.push(`<${entry.name}${attrs.length ? " " : ""}${attrs.join(" ")}>`);
for (const child of entry.children || [])
serializeXML(child, tokens, stripANSIControlSequences);
if (entry.text)
tokens.push(escape(entry.text, stripANSIControlSequences, true));
tokens.push(`</${entry.name}>`);
}
const discouragedXMLCharacters = /[\u0000-\u0008\u000b-\u000c\u000e-\u001f\u007f-\u0084\u0086-\u009f]/g;
function escape(text, stripANSIControlSequences, isCharacterData) {
if (stripANSIControlSequences)
text = (0, import_util.stripAnsiEscapes)(text);
if (isCharacterData) {
text = "<![CDATA[" + text.replace(/]]>/g, "]]&gt;") + "]]>";
} else {
const escapeRe = /[&"'<>]/g;
text = text.replace(escapeRe, (c) => ({ "&": "&amp;", '"': "&quot;", "'": "&apos;", "<": "&lt;", ">": "&gt;" })[c]);
}
text = text.replace(discouragedXMLCharacters, "");
return text;
}
var junit_default = JUnitReporter;
+113
View File
@@ -0,0 +1,113 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var line_exports = {};
__export(line_exports, {
default: () => line_default
});
module.exports = __toCommonJS(line_exports);
var import_base = require("./base");
class LineReporter extends import_base.TerminalReporter {
constructor() {
super(...arguments);
this._current = 0;
this._failures = 0;
this._didBegin = false;
}
onBegin(suite) {
super.onBegin(suite);
const startingMessage = this.generateStartingMessage();
if (startingMessage) {
this.writeLine(startingMessage);
this.writeLine();
}
this._didBegin = true;
}
onStdOut(chunk, test, result) {
super.onStdOut(chunk, test, result);
this._dumpToStdio(test, chunk, this.screen.stdout);
}
onStdErr(chunk, test, result) {
super.onStdErr(chunk, test, result);
this._dumpToStdio(test, chunk, this.screen.stderr);
}
_dumpToStdio(test, chunk, stream) {
if (this.config.quiet)
return;
if (!process.env.PW_TEST_DEBUG_REPORTERS)
stream.write(`\x1B[1A\x1B[2K`);
if (test && this._lastTest !== test) {
const title = this.screen.colors.dim(this.formatTestTitle(test));
stream.write(this.fitToScreen(title) + `
`);
this._lastTest = test;
}
stream.write(chunk);
if (chunk[chunk.length - 1] !== "\n")
this.writeLine();
this.writeLine();
}
onTestBegin(test, result) {
++this._current;
this._updateLine(test, result, void 0);
}
onStepBegin(test, result, step) {
if (this.screen.isTTY && step.category === "test.step")
this._updateLine(test, result, step);
}
onStepEnd(test, result, step) {
if (this.screen.isTTY && step.category === "test.step")
this._updateLine(test, result, step.parent);
}
onTestEnd(test, result) {
super.onTestEnd(test, result);
if (!this.willRetry(test) && (test.outcome() === "flaky" || test.outcome() === "unexpected" || result.status === "interrupted")) {
if (!process.env.PW_TEST_DEBUG_REPORTERS)
this.screen.stdout.write(`\x1B[1A\x1B[2K`);
this.writeLine(this.formatFailure(test, ++this._failures));
this.writeLine();
}
}
_updateLine(test, result, step) {
const retriesPrefix = this.totalTestCount < this._current ? ` (retries)` : ``;
const prefix = `[${this._current}/${this.totalTestCount}]${retriesPrefix} `;
const currentRetrySuffix = result.retry ? this.screen.colors.yellow(` (retry #${result.retry})`) : "";
const title = this.formatTestTitle(test, step) + currentRetrySuffix;
if (process.env.PW_TEST_DEBUG_REPORTERS)
this.screen.stdout.write(`${prefix + title}
`);
else
this.screen.stdout.write(`\x1B[1A\x1B[2K${prefix + this.fitToScreen(title, prefix)}
`);
}
onError(error) {
super.onError(error);
const message = this.formatError(error).message + "\n";
if (!process.env.PW_TEST_DEBUG_REPORTERS && this._didBegin)
this.screen.stdout.write(`\x1B[1A\x1B[2K`);
this.screen.stdout.write(message);
this.writeLine();
}
async onEnd(result) {
if (!process.env.PW_TEST_DEBUG_REPORTERS && this._didBegin)
this.screen.stdout.write(`\x1B[1A\x1B[2K`);
await super.onEnd(result);
this.epilogue(false);
}
}
var line_default = LineReporter;
+231
View File
@@ -0,0 +1,231 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var list_exports = {};
__export(list_exports, {
default: () => list_default
});
module.exports = __toCommonJS(list_exports);
var import_utils = require("playwright-core/lib/utils");
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
var import_base = require("./base");
var import_util = require("../util");
const DOES_NOT_SUPPORT_UTF8_IN_TERMINAL = process.platform === "win32" && process.env.TERM_PROGRAM !== "vscode" && !process.env.WT_SESSION;
const POSITIVE_STATUS_MARK = DOES_NOT_SUPPORT_UTF8_IN_TERMINAL ? "ok" : "\u2713";
const NEGATIVE_STATUS_MARK = DOES_NOT_SUPPORT_UTF8_IN_TERMINAL ? "x" : "\u2718";
class ListReporter extends import_base.TerminalReporter {
constructor(options) {
super(options);
this._lastRow = 0;
this._lastColumn = 0;
this._testRows = /* @__PURE__ */ new Map();
this._stepRows = /* @__PURE__ */ new Map();
this._resultIndex = /* @__PURE__ */ new Map();
this._stepIndex = /* @__PURE__ */ new Map();
this._needNewLine = false;
this._printSteps = (0, import_utils.getAsBooleanFromENV)("PLAYWRIGHT_LIST_PRINT_STEPS", options?.printSteps);
}
onBegin(suite) {
super.onBegin(suite);
const startingMessage = this.generateStartingMessage();
if (startingMessage) {
this.writeLine(startingMessage);
this.writeLine("");
}
}
onTestBegin(test, result) {
const index = String(this._resultIndex.size + 1);
this._resultIndex.set(result, index);
if (!this.screen.isTTY)
return;
this._maybeWriteNewLine();
this._testRows.set(test, this._lastRow);
const prefix = this._testPrefix(index, "");
const line = this.screen.colors.dim(this.formatTestTitle(test)) + this._retrySuffix(result);
this._appendLine(line, prefix);
}
onStdOut(chunk, test, result) {
super.onStdOut(chunk, test, result);
this._dumpToStdio(test, chunk, this.screen.stdout);
}
onStdErr(chunk, test, result) {
super.onStdErr(chunk, test, result);
this._dumpToStdio(test, chunk, this.screen.stderr);
}
getStepIndex(testIndex, result, step) {
if (this._stepIndex.has(step))
return this._stepIndex.get(step);
const ordinal = (result[lastStepOrdinalSymbol] || 0) + 1;
result[lastStepOrdinalSymbol] = ordinal;
const stepIndex = `${testIndex}.${ordinal}`;
this._stepIndex.set(step, stepIndex);
return stepIndex;
}
onStepBegin(test, result, step) {
if (step.category !== "test.step")
return;
const testIndex = this._resultIndex.get(result) || "";
if (!this.screen.isTTY)
return;
if (this._printSteps) {
this._maybeWriteNewLine();
this._stepRows.set(step, this._lastRow);
const prefix = this._testPrefix(this.getStepIndex(testIndex, result, step), "");
const line = test.title + this.screen.colors.dim((0, import_base.stepSuffix)(step));
this._appendLine(line, prefix);
} else {
this._updateOrAppendLine(this._testRows, test, this.screen.colors.dim(this.formatTestTitle(test, step)) + this._retrySuffix(result), this._testPrefix(testIndex, ""));
}
}
onStepEnd(test, result, step) {
if (step.category !== "test.step")
return;
const testIndex = this._resultIndex.get(result) || "";
if (!this._printSteps) {
if (this.screen.isTTY)
this._updateOrAppendLine(this._testRows, test, this.screen.colors.dim(this.formatTestTitle(test, step.parent)) + this._retrySuffix(result), this._testPrefix(testIndex, ""));
return;
}
const index = this.getStepIndex(testIndex, result, step);
const title = this.screen.isTTY ? test.title + this.screen.colors.dim((0, import_base.stepSuffix)(step)) : this.formatTestTitle(test, step);
const prefix = this._testPrefix(index, "");
let text = "";
if (step.error)
text = this.screen.colors.red(title);
else
text = title;
text += this.screen.colors.dim(` (${(0, import_utilsBundle.ms)(step.duration)})`);
this._updateOrAppendLine(this._stepRows, step, text, prefix);
}
_maybeWriteNewLine() {
if (this._needNewLine) {
this._needNewLine = false;
this.screen.stdout.write("\n");
++this._lastRow;
this._lastColumn = 0;
}
}
_updateLineCountAndNewLineFlagForOutput(text) {
this._needNewLine = text[text.length - 1] !== "\n";
if (!this.screen.ttyWidth)
return;
for (const ch of text) {
if (ch === "\n") {
this._lastColumn = 0;
++this._lastRow;
continue;
}
++this._lastColumn;
if (this._lastColumn > this.screen.ttyWidth) {
this._lastColumn = 0;
++this._lastRow;
}
}
}
_dumpToStdio(test, chunk, stream) {
if (this.config.quiet)
return;
const text = chunk.toString("utf-8");
this._updateLineCountAndNewLineFlagForOutput(text);
stream.write(chunk);
}
onTestEnd(test, result) {
super.onTestEnd(test, result);
const title = this.formatTestTitle(test);
let prefix = "";
let text = "";
let index = this._resultIndex.get(result);
if (!index) {
index = String(this._resultIndex.size + 1);
this._resultIndex.set(result, index);
}
if (result.status === "skipped") {
prefix = this._testPrefix(index, this.screen.colors.green("-"));
text = this.screen.colors.cyan(title) + this._retrySuffix(result);
} else {
const statusMark = result.status === "passed" ? POSITIVE_STATUS_MARK : NEGATIVE_STATUS_MARK;
if (result.status === test.expectedStatus) {
prefix = this._testPrefix(index, this.screen.colors.green(statusMark));
text = title;
} else {
prefix = this._testPrefix(index, this.screen.colors.red(statusMark));
text = this.screen.colors.red(title);
}
text += this._retrySuffix(result) + this.screen.colors.dim(` (${(0, import_utilsBundle.ms)(result.duration)})`);
}
this._updateOrAppendLine(this._testRows, test, text, prefix);
}
_updateOrAppendLine(entityRowNumbers, entity, text, prefix) {
const row = entityRowNumbers.get(entity);
if (row !== void 0 && this.screen.isTTY && this._lastRow - row < this.screen.ttyHeight) {
this._updateLine(row, text, prefix);
} else {
this._maybeWriteNewLine();
entityRowNumbers.set(entity, this._lastRow);
this._appendLine(text, prefix);
}
}
_appendLine(text, prefix) {
const line = prefix + this.fitToScreen(text, prefix);
if (process.env.PW_TEST_DEBUG_REPORTERS) {
this.screen.stdout.write("#" + this._lastRow + " : " + line + "\n");
} else {
this.screen.stdout.write(line);
this.screen.stdout.write("\n");
}
++this._lastRow;
this._lastColumn = 0;
}
_updateLine(row, text, prefix) {
const line = prefix + this.fitToScreen(text, prefix);
if (process.env.PW_TEST_DEBUG_REPORTERS)
this.screen.stdout.write("#" + row + " : " + line + "\n");
else
this._updateLineForTTY(row, line);
}
_updateLineForTTY(row, line) {
if (row !== this._lastRow)
this.screen.stdout.write(`\x1B[${this._lastRow - row}A`);
this.screen.stdout.write("\x1B[2K\x1B[0G");
this.screen.stdout.write(line);
if (row !== this._lastRow)
this.screen.stdout.write(`\x1B[${this._lastRow - row}E`);
}
_testPrefix(index, statusMark) {
const statusMarkLength = (0, import_util.stripAnsiEscapes)(statusMark).length;
const indexLength = Math.ceil(Math.log10(this.totalTestCount + 1));
return " " + statusMark + " ".repeat(3 - statusMarkLength) + this.screen.colors.dim(index.padStart(indexLength) + " ");
}
_retrySuffix(result) {
return result.retry ? this.screen.colors.yellow(` (retry #${result.retry})`) : "";
}
onError(error) {
super.onError(error);
this._maybeWriteNewLine();
const message = this.formatError(error).message + "\n";
this._updateLineCountAndNewLineFlagForOutput(message);
this.screen.stdout.write(message);
}
async onEnd(result) {
await super.onEnd(result);
this.screen.stdout.write("\n");
this.epilogue(true);
}
}
const lastStepOrdinalSymbol = Symbol("lastStepOrdinal");
var list_default = ListReporter;
+66
View File
@@ -0,0 +1,66 @@
"use strict";
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 __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);
var listModeReporter_exports = {};
__export(listModeReporter_exports, {
default: () => listModeReporter_default
});
module.exports = __toCommonJS(listModeReporter_exports);
var import_path = __toESM(require("path"));
var import_base = require("./base");
class ListModeReporter {
constructor(options) {
this.screen = options?.screen ?? import_base.terminalScreen;
}
version() {
return "v2";
}
onConfigure(config) {
this.config = config;
}
onBegin(suite) {
this._writeLine(`Listing tests:`);
const tests = suite.allTests();
const files = /* @__PURE__ */ new Set();
for (const test of tests) {
const [, projectName, , ...titles] = test.titlePath();
const location = `${import_path.default.relative(this.config.rootDir, test.location.file)}:${test.location.line}:${test.location.column}`;
const projectTitle = projectName ? `[${projectName}] \u203A ` : "";
this._writeLine(` ${projectTitle}${location} \u203A ${titles.join(" \u203A ")}`);
files.add(test.location.file);
}
this._writeLine(`Total: ${tests.length} ${tests.length === 1 ? "test" : "tests"} in ${files.size} ${files.size === 1 ? "file" : "files"}`);
}
onError(error) {
this.screen.stderr.write("\n" + (0, import_base.formatError)(import_base.terminalScreen, error).message + "\n");
}
_writeLine(line) {
this.screen.stdout.write(line + "\n");
}
}
var listModeReporter_default = ListModeReporter;
+144
View File
@@ -0,0 +1,144 @@
"use strict";
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 __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);
var markdown_exports = {};
__export(markdown_exports, {
default: () => markdown_default
});
module.exports = __toCommonJS(markdown_exports);
var import_fs = __toESM(require("fs"));
var import_path = __toESM(require("path"));
class MarkdownReporter {
constructor(options) {
this._fatalErrors = [];
this._options = options;
}
printsToStdio() {
return false;
}
onBegin(config, suite) {
this._config = config;
this._suite = suite;
}
onError(error) {
this._fatalErrors.push(error);
}
async onEnd(result) {
const summary = this._generateSummary();
const lines = [];
if (this._fatalErrors.length)
lines.push(`**${this._fatalErrors.length} fatal errors, not part of any test**`);
if (summary.unexpected.length) {
lines.push(`**${summary.unexpected.length} failed**`);
this._printTestList(":x:", summary.unexpected, lines);
}
if (summary.flaky.length) {
lines.push(`<details>`);
lines.push(`<summary><b>${summary.flaky.length} flaky</b></summary>`);
this._printTestList(":warning:", summary.flaky, lines, " <br/>");
lines.push(`</details>`);
lines.push(``);
}
if (summary.interrupted.length) {
lines.push(`<details>`);
lines.push(`<summary><b>${summary.interrupted.length} interrupted</b></summary>`);
this._printTestList(":warning:", summary.interrupted, lines, " <br/>");
lines.push(`</details>`);
lines.push(``);
}
const skipped = summary.skipped ? `, ${summary.skipped} skipped` : "";
const didNotRun = summary.didNotRun ? `, ${summary.didNotRun} did not run` : "";
lines.push(`**${summary.expected} passed${skipped}${didNotRun}**`);
lines.push(``);
await this.publishReport(lines.join("\n"));
}
async publishReport(report) {
const maybeRelativeFile = this._options.outputFile || "report.md";
const reportFile = import_path.default.resolve(this._options.configDir, maybeRelativeFile);
await import_fs.default.promises.mkdir(import_path.default.dirname(reportFile), { recursive: true });
await import_fs.default.promises.writeFile(reportFile, report);
}
_generateSummary() {
let didNotRun = 0;
let skipped = 0;
let expected = 0;
const interrupted = [];
const interruptedToPrint = [];
const unexpected = [];
const flaky = [];
this._suite.allTests().forEach((test) => {
switch (test.outcome()) {
case "skipped": {
if (test.results.some((result) => result.status === "interrupted")) {
if (test.results.some((result) => !!result.error))
interruptedToPrint.push(test);
interrupted.push(test);
} else if (!test.results.length || test.expectedStatus !== "skipped") {
++didNotRun;
} else {
++skipped;
}
break;
}
case "expected":
++expected;
break;
case "unexpected":
unexpected.push(test);
break;
case "flaky":
flaky.push(test);
break;
}
});
return {
didNotRun,
skipped,
expected,
interrupted,
unexpected,
flaky
};
}
_printTestList(prefix, tests, lines, suffix) {
for (const test of tests)
lines.push(`${prefix} ${formatTestTitle(this._config.rootDir, test)}${suffix || ""}`);
lines.push(``);
}
}
function formatTestTitle(rootDir, test) {
const [, projectName, , ...titles] = test.titlePath();
const relativeTestPath = import_path.default.relative(rootDir, test.location.file);
const location = `${relativeTestPath}:${test.location.line}`;
const projectTitle = projectName ? `[${projectName}] \u203A ` : "";
const testTitle = `${projectTitle}${location} \u203A ${titles.join(" \u203A ")}`;
const extraTags = test.tags.filter((t) => !testTitle.includes(t));
const formattedTags = extraTags.map((t) => `\`${t}\``).join(" ");
return `${testTitle}${extraTags.length ? " " + formattedTags : ""}`;
}
var markdown_default = MarkdownReporter;
+533
View File
@@ -0,0 +1,533 @@
"use strict";
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 __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);
var merge_exports = {};
__export(merge_exports, {
createMergedReport: () => createMergedReport
});
module.exports = __toCommonJS(merge_exports);
var import_fs = __toESM(require("fs"));
var import_path = __toESM(require("path"));
var import_utils = require("playwright-core/lib/utils");
var import_blob = require("./blob");
var import_multiplexer = require("./multiplexer");
var import_stringInternPool = require("../isomorphic/stringInternPool");
var import_teleReceiver = require("../isomorphic/teleReceiver");
var import_reporters = require("../runner/reporters");
var import_util = require("../util");
async function createMergedReport(config, dir, reporterDescriptions, rootDirOverride) {
const reporters = await (0, import_reporters.createReporters)(config, "merge", false, reporterDescriptions);
const multiplexer = new import_multiplexer.Multiplexer(reporters);
const stringPool = new import_stringInternPool.StringInternPool();
let printStatus = () => {
};
if (!multiplexer.printsToStdio()) {
printStatus = printStatusToStdout;
printStatus(`merging reports from ${dir}`);
}
const shardFiles = await sortedShardFiles(dir);
if (shardFiles.length === 0)
throw new Error(`No report files found in ${dir}`);
const eventData = await mergeEvents(dir, shardFiles, stringPool, printStatus, rootDirOverride);
const pathSeparator = rootDirOverride ? import_path.default.sep : eventData.pathSeparatorFromMetadata ?? import_path.default.sep;
const receiver = new import_teleReceiver.TeleReporterReceiver(multiplexer, {
mergeProjects: false,
mergeTestCases: false,
resolvePath: (rootDir, relativePath) => stringPool.internString(rootDir + pathSeparator + relativePath),
configOverrides: config.config
});
printStatus(`processing test events`);
const dispatchEvents = async (events) => {
for (const event of events) {
if (event.method === "onEnd")
printStatus(`building final report`);
await receiver.dispatch(event);
if (event.method === "onEnd")
printStatus(`finished building report`);
}
};
await dispatchEvents(eventData.prologue);
for (const { reportFile, eventPatchers, metadata } of eventData.reports) {
const reportJsonl = await import_fs.default.promises.readFile(reportFile);
const events = parseTestEvents(reportJsonl);
new import_stringInternPool.JsonStringInternalizer(stringPool).traverse(events);
eventPatchers.patchers.push(new AttachmentPathPatcher(dir));
if (metadata.name)
eventPatchers.patchers.push(new GlobalErrorPatcher(metadata.name));
eventPatchers.patchEvents(events);
await dispatchEvents(events);
}
await dispatchEvents(eventData.epilogue);
}
const commonEventNames = ["onBlobReportMetadata", "onConfigure", "onProject", "onBegin", "onEnd"];
const commonEvents = new Set(commonEventNames);
const commonEventRegex = new RegExp(`${commonEventNames.join("|")}`);
function parseCommonEvents(reportJsonl) {
return splitBufferLines(reportJsonl).map((line) => line.toString("utf8")).filter((line) => commonEventRegex.test(line)).map((line) => JSON.parse(line)).filter((event) => commonEvents.has(event.method));
}
function parseTestEvents(reportJsonl) {
return splitBufferLines(reportJsonl).map((line) => line.toString("utf8")).filter((line) => line.length).map((line) => JSON.parse(line)).filter((event) => !commonEvents.has(event.method));
}
function splitBufferLines(buffer) {
const lines = [];
let start = 0;
while (start < buffer.length) {
const end = buffer.indexOf(10, start);
if (end === -1) {
lines.push(buffer.slice(start));
break;
}
lines.push(buffer.slice(start, end));
start = end + 1;
}
return lines;
}
async function extractAndParseReports(dir, shardFiles, internalizer, printStatus) {
const shardEvents = [];
await import_fs.default.promises.mkdir(import_path.default.join(dir, "resources"), { recursive: true });
const reportNames = new UniqueFileNameGenerator();
for (const file of shardFiles) {
const absolutePath = import_path.default.join(dir, file);
printStatus(`extracting: ${(0, import_util.relativeFilePath)(absolutePath)}`);
const zipFile = new import_utils.ZipFile(absolutePath);
const entryNames = await zipFile.entries();
for (const entryName of entryNames.sort()) {
let fileName = import_path.default.join(dir, entryName);
const content = await zipFile.read(entryName);
if (entryName.endsWith(".jsonl")) {
fileName = reportNames.makeUnique(fileName);
let parsedEvents = parseCommonEvents(content);
internalizer.traverse(parsedEvents);
const metadata = findMetadata(parsedEvents, file);
parsedEvents = modernizer.modernize(metadata.version, parsedEvents);
shardEvents.push({
file,
localPath: fileName,
metadata,
parsedEvents
});
}
await import_fs.default.promises.writeFile(fileName, content);
}
zipFile.close();
}
return shardEvents;
}
function findMetadata(events, file) {
if (events[0]?.method !== "onBlobReportMetadata")
throw new Error(`No metadata event found in ${file}`);
const metadata = events[0].params;
if (metadata.version > import_blob.currentBlobReportVersion)
throw new Error(`Blob report ${file} was created with a newer version of Playwright.`);
return metadata;
}
async function mergeEvents(dir, shardReportFiles, stringPool, printStatus, rootDirOverride) {
const internalizer = new import_stringInternPool.JsonStringInternalizer(stringPool);
const configureEvents = [];
const projectEvents = [];
const endEvents = [];
const blobs = await extractAndParseReports(dir, shardReportFiles, internalizer, printStatus);
blobs.sort((a, b) => {
const nameA = a.metadata.name ?? "";
const nameB = b.metadata.name ?? "";
if (nameA !== nameB)
return nameA.localeCompare(nameB);
const shardA = a.metadata.shard?.current ?? 0;
const shardB = b.metadata.shard?.current ?? 0;
if (shardA !== shardB)
return shardA - shardB;
return a.file.localeCompare(b.file);
});
printStatus(`merging events`);
const reports = [];
const globalTestIdSet = /* @__PURE__ */ new Set();
for (let i = 0; i < blobs.length; ++i) {
const { parsedEvents, metadata, localPath } = blobs[i];
const eventPatchers = new JsonEventPatchers();
eventPatchers.patchers.push(new IdsPatcher(
stringPool,
metadata.name,
String(i),
globalTestIdSet
));
if (rootDirOverride)
eventPatchers.patchers.push(new PathSeparatorPatcher(metadata.pathSeparator));
eventPatchers.patchEvents(parsedEvents);
for (const event of parsedEvents) {
if (event.method === "onConfigure")
configureEvents.push(event);
else if (event.method === "onProject")
projectEvents.push(event);
else if (event.method === "onEnd")
endEvents.push(event);
}
reports.push({
eventPatchers,
reportFile: localPath,
metadata
});
}
return {
prologue: [
mergeConfigureEvents(configureEvents, rootDirOverride),
...projectEvents,
{ method: "onBegin", params: void 0 }
],
reports,
epilogue: [
mergeEndEvents(endEvents),
{ method: "onExit", params: void 0 }
],
pathSeparatorFromMetadata: blobs[0]?.metadata.pathSeparator
};
}
function mergeConfigureEvents(configureEvents, rootDirOverride) {
if (!configureEvents.length)
throw new Error("No configure events found");
let config = {
configFile: void 0,
globalTimeout: 0,
maxFailures: 0,
metadata: {},
rootDir: "",
version: "",
workers: 0
};
for (const event of configureEvents)
config = mergeConfigs(config, event.params.config);
if (rootDirOverride) {
config.rootDir = rootDirOverride;
} else {
const rootDirs = new Set(configureEvents.map((e) => e.params.config.rootDir));
if (rootDirs.size > 1) {
throw new Error([
`Blob reports being merged were recorded with different test directories, and`,
`merging cannot proceed. This may happen if you are merging reports from`,
`machines with different environments, like different operating systems or`,
`if the tests ran with different playwright configs.`,
``,
`You can force merge by specifying a merge config file with "-c" option. If`,
`you'd like all test paths to be correct, make sure 'testDir' in the merge config`,
`file points to the actual tests location.`,
``,
`Found directories:`,
...rootDirs
].join("\n"));
}
}
return {
method: "onConfigure",
params: {
config
}
};
}
function mergeConfigs(to, from) {
return {
...to,
...from,
metadata: {
...to.metadata,
...from.metadata,
actualWorkers: (to.metadata.actualWorkers || 0) + (from.metadata.actualWorkers || 0)
},
workers: to.workers + from.workers
};
}
function mergeEndEvents(endEvents) {
let startTime = endEvents.length ? 1e13 : Date.now();
let status = "passed";
let duration = 0;
for (const event of endEvents) {
const shardResult = event.params.result;
if (shardResult.status === "failed")
status = "failed";
else if (shardResult.status === "timedout" && status !== "failed")
status = "timedout";
else if (shardResult.status === "interrupted" && status !== "failed" && status !== "timedout")
status = "interrupted";
startTime = Math.min(startTime, shardResult.startTime);
duration = Math.max(duration, shardResult.duration);
}
const result = {
status,
startTime,
duration
};
return {
method: "onEnd",
params: {
result
}
};
}
async function sortedShardFiles(dir) {
const files = await import_fs.default.promises.readdir(dir);
return files.filter((file) => file.endsWith(".zip")).sort();
}
function printStatusToStdout(message) {
process.stdout.write(`${message}
`);
}
class UniqueFileNameGenerator {
constructor() {
this._usedNames = /* @__PURE__ */ new Set();
}
makeUnique(name) {
if (!this._usedNames.has(name)) {
this._usedNames.add(name);
return name;
}
const extension = import_path.default.extname(name);
name = name.substring(0, name.length - extension.length);
let index = 0;
while (true) {
const candidate = `${name}-${++index}${extension}`;
if (!this._usedNames.has(candidate)) {
this._usedNames.add(candidate);
return candidate;
}
}
}
}
class IdsPatcher {
constructor(stringPool, botName, salt, globalTestIdSet) {
this._stringPool = stringPool;
this._botName = botName;
this._salt = salt;
this._testIdsMap = /* @__PURE__ */ new Map();
this._globalTestIdSet = globalTestIdSet;
}
patchEvent(event) {
const { method, params } = event;
switch (method) {
case "onProject":
this._onProject(params.project);
return;
case "onAttach":
case "onTestBegin":
case "onStepBegin":
case "onStepEnd":
case "onStdIO":
params.testId = params.testId ? this._mapTestId(params.testId) : void 0;
return;
case "onTestEnd":
params.test.testId = this._mapTestId(params.test.testId);
return;
}
}
_onProject(project) {
project.metadata ??= {};
project.suites.forEach((suite) => this._updateTestIds(suite));
}
_updateTestIds(suite) {
suite.entries.forEach((entry) => {
if ("testId" in entry)
this._updateTestId(entry);
else
this._updateTestIds(entry);
});
}
_updateTestId(test) {
test.testId = this._mapTestId(test.testId);
if (this._botName) {
test.tags = test.tags || [];
test.tags.unshift("@" + this._botName);
}
}
_mapTestId(testId) {
const t1 = this._stringPool.internString(testId);
if (this._testIdsMap.has(t1))
return this._testIdsMap.get(t1);
if (this._globalTestIdSet.has(t1)) {
const t2 = this._stringPool.internString(testId + this._salt);
this._globalTestIdSet.add(t2);
this._testIdsMap.set(t1, t2);
return t2;
}
this._globalTestIdSet.add(t1);
this._testIdsMap.set(t1, t1);
return t1;
}
}
class AttachmentPathPatcher {
constructor(_resourceDir) {
this._resourceDir = _resourceDir;
}
patchEvent(event) {
if (event.method === "onAttach")
this._patchAttachments(event.params.attachments);
else if (event.method === "onTestEnd")
this._patchAttachments(event.params.result.attachments ?? []);
}
_patchAttachments(attachments) {
for (const attachment of attachments) {
if (!attachment.path)
continue;
attachment.path = import_path.default.join(this._resourceDir, attachment.path);
}
}
}
class PathSeparatorPatcher {
constructor(from) {
this._from = from ?? (import_path.default.sep === "/" ? "\\" : "/");
this._to = import_path.default.sep;
}
patchEvent(jsonEvent) {
if (this._from === this._to)
return;
if (jsonEvent.method === "onProject") {
this._updateProject(jsonEvent.params.project);
return;
}
if (jsonEvent.method === "onTestEnd") {
const test = jsonEvent.params.test;
test.annotations?.forEach((annotation) => this._updateAnnotationLocation(annotation));
const testResult = jsonEvent.params.result;
testResult.annotations?.forEach((annotation) => this._updateAnnotationLocation(annotation));
testResult.errors.forEach((error) => this._updateErrorLocations(error));
(testResult.attachments ?? []).forEach((attachment) => {
if (attachment.path)
attachment.path = this._updatePath(attachment.path);
});
return;
}
if (jsonEvent.method === "onStepBegin") {
const step = jsonEvent.params.step;
this._updateLocation(step.location);
return;
}
if (jsonEvent.method === "onStepEnd") {
const step = jsonEvent.params.step;
this._updateErrorLocations(step.error);
step.annotations?.forEach((annotation) => this._updateAnnotationLocation(annotation));
return;
}
if (jsonEvent.method === "onAttach") {
const attach = jsonEvent.params;
attach.attachments.forEach((attachment) => {
if (attachment.path)
attachment.path = this._updatePath(attachment.path);
});
return;
}
}
_updateProject(project) {
project.outputDir = this._updatePath(project.outputDir);
project.testDir = this._updatePath(project.testDir);
project.snapshotDir = this._updatePath(project.snapshotDir);
project.suites.forEach((suite) => this._updateSuite(suite, true));
}
_updateSuite(suite, isFileSuite = false) {
this._updateLocation(suite.location);
if (isFileSuite)
suite.title = this._updatePath(suite.title);
for (const entry of suite.entries) {
if ("testId" in entry) {
this._updateLocation(entry.location);
entry.annotations?.forEach((annotation) => this._updateAnnotationLocation(annotation));
} else {
this._updateSuite(entry);
}
}
}
_updateErrorLocations(error) {
while (error) {
this._updateLocation(error.location);
error = error.cause;
}
}
_updateAnnotationLocation(annotation) {
this._updateLocation(annotation.location);
}
_updateLocation(location) {
if (location)
location.file = this._updatePath(location.file);
}
_updatePath(text) {
return text.split(this._from).join(this._to);
}
}
class GlobalErrorPatcher {
constructor(botName) {
this._prefix = `(${botName}) `;
}
patchEvent(event) {
if (event.method !== "onError")
return;
const error = event.params.error;
if (error.message !== void 0)
error.message = this._prefix + error.message;
if (error.stack !== void 0)
error.stack = this._prefix + error.stack;
}
}
class JsonEventPatchers {
constructor() {
this.patchers = [];
}
patchEvents(events) {
for (const event of events) {
for (const patcher of this.patchers)
patcher.patchEvent(event);
}
}
}
class BlobModernizer {
modernize(fromVersion, events) {
const result = [];
for (const event of events)
result.push(...this._modernize(fromVersion, event));
return result;
}
_modernize(fromVersion, event) {
let events = [event];
for (let version = fromVersion; version < import_blob.currentBlobReportVersion; ++version)
events = this[`_modernize_${version}_to_${version + 1}`].call(this, events);
return events;
}
_modernize_1_to_2(events) {
return events.map((event) => {
if (event.method === "onProject") {
const modernizeSuite = (suite) => {
const newSuites = suite.suites.map(modernizeSuite);
const { suites, tests, ...remainder } = suite;
return { entries: [...newSuites, ...tests], ...remainder };
};
const project = event.params.project;
project.suites = project.suites.map(modernizeSuite);
}
return event;
});
}
}
const modernizer = new BlobModernizer();
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
createMergedReport
});
+104
View File
@@ -0,0 +1,104 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var multiplexer_exports = {};
__export(multiplexer_exports, {
Multiplexer: () => Multiplexer
});
module.exports = __toCommonJS(multiplexer_exports);
class Multiplexer {
constructor(reporters) {
this._reporters = reporters;
}
version() {
return "v2";
}
onConfigure(config) {
for (const reporter of this._reporters)
wrap(() => reporter.onConfigure?.(config));
}
onBegin(suite) {
for (const reporter of this._reporters)
wrap(() => reporter.onBegin?.(suite));
}
onTestBegin(test, result) {
for (const reporter of this._reporters)
wrap(() => reporter.onTestBegin?.(test, result));
}
onStdOut(chunk, test, result) {
for (const reporter of this._reporters)
wrap(() => reporter.onStdOut?.(chunk, test, result));
}
onStdErr(chunk, test, result) {
for (const reporter of this._reporters)
wrap(() => reporter.onStdErr?.(chunk, test, result));
}
onTestEnd(test, result) {
for (const reporter of this._reporters)
wrap(() => reporter.onTestEnd?.(test, result));
}
async onEnd(result) {
for (const reporter of this._reporters) {
const outResult = await wrapAsync(() => reporter.onEnd?.(result));
if (outResult?.status)
result.status = outResult.status;
}
return result;
}
async onExit() {
for (const reporter of this._reporters)
await wrapAsync(() => reporter.onExit?.());
}
onError(error) {
for (const reporter of this._reporters)
wrap(() => reporter.onError?.(error));
}
onStepBegin(test, result, step) {
for (const reporter of this._reporters)
wrap(() => reporter.onStepBegin?.(test, result, step));
}
onStepEnd(test, result, step) {
for (const reporter of this._reporters)
wrap(() => reporter.onStepEnd?.(test, result, step));
}
printsToStdio() {
return this._reporters.some((r) => {
let prints = false;
wrap(() => prints = r.printsToStdio ? r.printsToStdio() : true);
return prints;
});
}
}
async function wrapAsync(callback) {
try {
return await callback();
} catch (e) {
console.error("Error in reporter", e);
}
}
function wrap(callback) {
try {
callback();
} catch (e) {
console.error("Error in reporter", e);
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Multiplexer
});
+102
View File
@@ -0,0 +1,102 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var reporterV2_exports = {};
__export(reporterV2_exports, {
wrapReporterAsV2: () => wrapReporterAsV2
});
module.exports = __toCommonJS(reporterV2_exports);
function wrapReporterAsV2(reporter) {
try {
if ("version" in reporter && reporter.version() === "v2")
return reporter;
} catch (e) {
}
return new ReporterV2Wrapper(reporter);
}
class ReporterV2Wrapper {
constructor(reporter) {
this._deferred = [];
this._reporter = reporter;
}
version() {
return "v2";
}
onConfigure(config) {
this._config = config;
}
onBegin(suite) {
this._reporter.onBegin?.(this._config, suite);
const deferred = this._deferred;
this._deferred = null;
for (const item of deferred) {
if (item.error)
this.onError(item.error);
if (item.stdout)
this.onStdOut(item.stdout.chunk, item.stdout.test, item.stdout.result);
if (item.stderr)
this.onStdErr(item.stderr.chunk, item.stderr.test, item.stderr.result);
}
}
onTestBegin(test, result) {
this._reporter.onTestBegin?.(test, result);
}
onStdOut(chunk, test, result) {
if (this._deferred) {
this._deferred.push({ stdout: { chunk, test, result } });
return;
}
this._reporter.onStdOut?.(chunk, test, result);
}
onStdErr(chunk, test, result) {
if (this._deferred) {
this._deferred.push({ stderr: { chunk, test, result } });
return;
}
this._reporter.onStdErr?.(chunk, test, result);
}
onTestEnd(test, result) {
this._reporter.onTestEnd?.(test, result);
}
async onEnd(result) {
return await this._reporter.onEnd?.(result);
}
async onExit() {
await this._reporter.onExit?.();
}
onError(error) {
if (this._deferred) {
this._deferred.push({ error });
return;
}
this._reporter.onError?.(error);
}
onStepBegin(test, result, step) {
this._reporter.onStepBegin?.(test, result, step);
}
onStepEnd(test, result, step) {
this._reporter.onStepEnd?.(test, result, step);
}
printsToStdio() {
return this._reporter.printsToStdio ? this._reporter.printsToStdio() : true;
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
wrapReporterAsV2
});
+295
View File
@@ -0,0 +1,295 @@
"use strict";
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 __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);
var teleEmitter_exports = {};
__export(teleEmitter_exports, {
TeleReporterEmitter: () => TeleReporterEmitter
});
module.exports = __toCommonJS(teleEmitter_exports);
var import_path = __toESM(require("path"));
var import_utils = require("playwright-core/lib/utils");
var import_teleReceiver = require("../isomorphic/teleReceiver");
class TeleReporterEmitter {
constructor(messageSink, options = {}) {
this._resultKnownAttachmentCounts = /* @__PURE__ */ new Map();
// In case there is blob reporter and UI mode, make sure one does override
// the id assigned by the other.
this._idSymbol = Symbol("id");
this._messageSink = messageSink;
this._emitterOptions = options;
}
version() {
return "v2";
}
onConfigure(config) {
this._rootDir = config.rootDir;
this._messageSink({ method: "onConfigure", params: { config: this._serializeConfig(config) } });
}
onBegin(suite) {
const projects = suite.suites.map((projectSuite) => this._serializeProject(projectSuite));
for (const project of projects)
this._messageSink({ method: "onProject", params: { project } });
this._messageSink({ method: "onBegin", params: void 0 });
}
onTestBegin(test, result) {
result[this._idSymbol] = (0, import_utils.createGuid)();
this._messageSink({
method: "onTestBegin",
params: {
testId: test.id,
result: this._serializeResultStart(result)
}
});
}
onTestEnd(test, result) {
const testEnd = {
testId: test.id,
expectedStatus: test.expectedStatus,
timeout: test.timeout,
annotations: []
};
this._sendNewAttachments(result, test.id);
this._messageSink({
method: "onTestEnd",
params: {
test: testEnd,
result: this._serializeResultEnd(result)
}
});
this._resultKnownAttachmentCounts.delete(result[this._idSymbol]);
}
onStepBegin(test, result, step) {
step[this._idSymbol] = (0, import_utils.createGuid)();
this._messageSink({
method: "onStepBegin",
params: {
testId: test.id,
resultId: result[this._idSymbol],
step: this._serializeStepStart(step)
}
});
}
onStepEnd(test, result, step) {
const resultId = result[this._idSymbol];
this._sendNewAttachments(result, test.id);
this._messageSink({
method: "onStepEnd",
params: {
testId: test.id,
resultId,
step: this._serializeStepEnd(step, result)
}
});
}
onError(error) {
this._messageSink({
method: "onError",
params: { error }
});
}
onStdOut(chunk, test, result) {
this._onStdIO("stdout", chunk, test, result);
}
onStdErr(chunk, test, result) {
this._onStdIO("stderr", chunk, test, result);
}
_onStdIO(type, chunk, test, result) {
if (this._emitterOptions.omitOutput)
return;
const isBase64 = typeof chunk !== "string";
const data = isBase64 ? chunk.toString("base64") : chunk;
this._messageSink({
method: "onStdIO",
params: { testId: test?.id, resultId: result ? result[this._idSymbol] : void 0, type, data, isBase64 }
});
}
async onEnd(result) {
const resultPayload = {
status: result.status,
startTime: result.startTime.getTime(),
duration: result.duration
};
this._messageSink({
method: "onEnd",
params: {
result: resultPayload
}
});
}
printsToStdio() {
return false;
}
_serializeConfig(config) {
return {
configFile: this._relativePath(config.configFile),
globalTimeout: config.globalTimeout,
maxFailures: config.maxFailures,
metadata: config.metadata,
rootDir: config.rootDir,
version: config.version,
workers: config.workers
};
}
_serializeProject(suite) {
const project = suite.project();
const report = {
metadata: project.metadata,
name: project.name,
outputDir: this._relativePath(project.outputDir),
repeatEach: project.repeatEach,
retries: project.retries,
testDir: this._relativePath(project.testDir),
testIgnore: (0, import_teleReceiver.serializeRegexPatterns)(project.testIgnore),
testMatch: (0, import_teleReceiver.serializeRegexPatterns)(project.testMatch),
timeout: project.timeout,
suites: suite.suites.map((fileSuite) => {
return this._serializeSuite(fileSuite);
}),
grep: (0, import_teleReceiver.serializeRegexPatterns)(project.grep),
grepInvert: (0, import_teleReceiver.serializeRegexPatterns)(project.grepInvert || []),
dependencies: project.dependencies,
snapshotDir: this._relativePath(project.snapshotDir),
teardown: project.teardown,
use: this._serializeProjectUseOptions(project.use)
};
return report;
}
_serializeProjectUseOptions(use) {
return {
testIdAttribute: use.testIdAttribute
};
}
_serializeSuite(suite) {
const result = {
title: suite.title,
location: this._relativeLocation(suite.location),
entries: suite.entries().map((e) => {
if (e.type === "test")
return this._serializeTest(e);
return this._serializeSuite(e);
})
};
return result;
}
_serializeTest(test) {
return {
testId: test.id,
title: test.title,
location: this._relativeLocation(test.location),
retries: test.retries,
tags: test.tags,
repeatEachIndex: test.repeatEachIndex,
annotations: this._relativeAnnotationLocations(test.annotations)
};
}
_serializeResultStart(result) {
return {
id: result[this._idSymbol],
retry: result.retry,
workerIndex: result.workerIndex,
parallelIndex: result.parallelIndex,
startTime: +result.startTime
};
}
_serializeResultEnd(result) {
return {
id: result[this._idSymbol],
duration: result.duration,
status: result.status,
errors: result.errors,
annotations: result.annotations?.length ? this._relativeAnnotationLocations(result.annotations) : void 0
};
}
_sendNewAttachments(result, testId) {
const resultId = result[this._idSymbol];
const knownAttachmentCount = this._resultKnownAttachmentCounts.get(resultId) ?? 0;
if (result.attachments.length > knownAttachmentCount) {
this._messageSink({
method: "onAttach",
params: {
testId,
resultId,
attachments: this._serializeAttachments(result.attachments.slice(knownAttachmentCount))
}
});
}
this._resultKnownAttachmentCounts.set(resultId, result.attachments.length);
}
_serializeAttachments(attachments) {
return attachments.map((a) => {
const { body, ...rest } = a;
return {
...rest,
// There is no Buffer in the browser, so there is no point in sending the data there.
base64: body && !this._emitterOptions.omitBuffers ? body.toString("base64") : void 0
};
});
}
_serializeStepStart(step) {
return {
id: step[this._idSymbol],
parentStepId: step.parent?.[this._idSymbol],
title: step.title,
category: step.category,
startTime: +step.startTime,
location: this._relativeLocation(step.location)
};
}
_serializeStepEnd(step, result) {
return {
id: step[this._idSymbol],
duration: step.duration,
error: step.error,
attachments: step.attachments.length ? step.attachments.map((a) => result.attachments.indexOf(a)) : void 0,
annotations: step.annotations.length ? this._relativeAnnotationLocations(step.annotations) : void 0
};
}
_relativeAnnotationLocations(annotations) {
return annotations.map((annotation) => ({
...annotation,
location: annotation.location ? this._relativeLocation(annotation.location) : void 0
}));
}
_relativeLocation(location) {
if (!location)
return location;
return {
...location,
file: this._relativePath(location.file)
};
}
_relativePath(absolutePath) {
if (!absolutePath)
return absolutePath;
return import_path.default.relative(this._rootDir, absolutePath);
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
TeleReporterEmitter
});
+16
View File
@@ -0,0 +1,16 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var blobV1_exports = {};
module.exports = __toCommonJS(blobV1_exports);
+505
View File
@@ -0,0 +1,505 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var dispatcher_exports = {};
__export(dispatcher_exports, {
Dispatcher: () => Dispatcher
});
module.exports = __toCommonJS(dispatcher_exports);
var import_utils = require("playwright-core/lib/utils");
var import_utils2 = require("playwright-core/lib/utils");
var import_rebase = require("./rebase");
var import_workerHost = require("./workerHost");
var import_ipc = require("../common/ipc");
class Dispatcher {
constructor(config, reporter, failureTracker) {
this._workerSlots = [];
this._queue = [];
this._workerLimitPerProjectId = /* @__PURE__ */ new Map();
this._queuedOrRunningHashCount = /* @__PURE__ */ new Map();
this._finished = new import_utils.ManualPromise();
this._isStopped = true;
this._extraEnvByProjectId = /* @__PURE__ */ new Map();
this._producedEnvByProjectId = /* @__PURE__ */ new Map();
this._config = config;
this._reporter = reporter;
this._failureTracker = failureTracker;
for (const project of config.projects) {
if (project.workers)
this._workerLimitPerProjectId.set(project.id, project.workers);
}
}
_findFirstJobToRun() {
for (let index = 0; index < this._queue.length; index++) {
const job = this._queue[index];
const projectIdWorkerLimit = this._workerLimitPerProjectId.get(job.projectId);
if (!projectIdWorkerLimit)
return index;
const runningWorkersWithSameProjectId = this._workerSlots.filter((w) => w.busy && w.worker && w.worker.projectId() === job.projectId).length;
if (runningWorkersWithSameProjectId < projectIdWorkerLimit)
return index;
}
return -1;
}
_scheduleJob() {
if (this._isStopped)
return;
const jobIndex = this._findFirstJobToRun();
if (jobIndex === -1)
return;
const job = this._queue[jobIndex];
let workerIndex = this._workerSlots.findIndex((w) => !w.busy && w.worker && w.worker.hash() === job.workerHash && !w.worker.didSendStop());
if (workerIndex === -1)
workerIndex = this._workerSlots.findIndex((w) => !w.busy);
if (workerIndex === -1) {
return;
}
this._queue.splice(jobIndex, 1);
const jobDispatcher = new JobDispatcher(job, this._reporter, this._failureTracker, () => this.stop().catch(() => {
}));
this._workerSlots[workerIndex].busy = true;
this._workerSlots[workerIndex].jobDispatcher = jobDispatcher;
void this._runJobInWorker(workerIndex, jobDispatcher).then(() => {
this._workerSlots[workerIndex].jobDispatcher = void 0;
this._workerSlots[workerIndex].busy = false;
this._checkFinished();
this._scheduleJob();
});
}
async _runJobInWorker(index, jobDispatcher) {
const job = jobDispatcher.job;
if (jobDispatcher.skipWholeJob())
return;
let worker = this._workerSlots[index].worker;
if (worker && (worker.hash() !== job.workerHash || worker.didSendStop())) {
await worker.stop();
worker = void 0;
if (this._isStopped)
return;
}
let startError;
if (!worker) {
worker = this._createWorker(job, index, (0, import_ipc.serializeConfig)(this._config, true));
this._workerSlots[index].worker = worker;
worker.on("exit", () => this._workerSlots[index].worker = void 0);
startError = await worker.start();
if (this._isStopped)
return;
}
if (startError)
jobDispatcher.onExit(startError);
else
jobDispatcher.runInWorker(worker);
const result = await jobDispatcher.jobResult;
this._updateCounterForWorkerHash(job.workerHash, -1);
if (result.didFail)
void worker.stop(
true
/* didFail */
);
else if (this._isWorkerRedundant(worker))
void worker.stop();
if (!this._isStopped && result.newJob) {
this._queue.unshift(result.newJob);
this._updateCounterForWorkerHash(result.newJob.workerHash, 1);
}
}
_checkFinished() {
if (this._finished.isDone())
return;
if (this._queue.length && !this._isStopped)
return;
if (this._workerSlots.some((w) => w.busy))
return;
this._finished.resolve();
}
_isWorkerRedundant(worker) {
let workersWithSameHash = 0;
for (const slot of this._workerSlots) {
if (slot.worker && !slot.worker.didSendStop() && slot.worker.hash() === worker.hash())
workersWithSameHash++;
}
return workersWithSameHash > this._queuedOrRunningHashCount.get(worker.hash());
}
_updateCounterForWorkerHash(hash, delta) {
this._queuedOrRunningHashCount.set(hash, delta + (this._queuedOrRunningHashCount.get(hash) || 0));
}
async run(testGroups, extraEnvByProjectId) {
this._extraEnvByProjectId = extraEnvByProjectId;
this._queue = testGroups;
for (const group of testGroups)
this._updateCounterForWorkerHash(group.workerHash, 1);
this._isStopped = false;
this._workerSlots = [];
if (this._failureTracker.hasReachedMaxFailures())
void this.stop();
for (let i = 0; i < this._config.config.workers; i++)
this._workerSlots.push({ busy: false });
for (let i = 0; i < this._workerSlots.length; i++)
this._scheduleJob();
this._checkFinished();
await this._finished;
}
_createWorker(testGroup, parallelIndex, loaderData) {
const projectConfig = this._config.projects.find((p) => p.id === testGroup.projectId);
const outputDir = projectConfig.project.outputDir;
const recoverFromStepErrors = this._failureTracker.canRecoverFromStepError();
const worker = new import_workerHost.WorkerHost(testGroup, parallelIndex, loaderData, recoverFromStepErrors, this._extraEnvByProjectId.get(testGroup.projectId) || {}, outputDir);
const handleOutput = (params) => {
const chunk = chunkFromParams(params);
if (worker.didFail()) {
return { chunk };
}
const currentlyRunning = this._workerSlots[parallelIndex].jobDispatcher?.currentlyRunning();
if (!currentlyRunning)
return { chunk };
return { chunk, test: currentlyRunning.test, result: currentlyRunning.result };
};
worker.on("stdOut", (params) => {
const { chunk, test, result } = handleOutput(params);
result?.stdout.push(chunk);
this._reporter.onStdOut?.(chunk, test, result);
});
worker.on("stdErr", (params) => {
const { chunk, test, result } = handleOutput(params);
result?.stderr.push(chunk);
this._reporter.onStdErr?.(chunk, test, result);
});
worker.on("teardownErrors", (params) => {
this._failureTracker.onWorkerError();
for (const error of params.fatalErrors)
this._reporter.onError?.(error);
});
worker.on("exit", () => {
const producedEnv = this._producedEnvByProjectId.get(testGroup.projectId) || {};
this._producedEnvByProjectId.set(testGroup.projectId, { ...producedEnv, ...worker.producedEnv() });
});
return worker;
}
producedEnvByProjectId() {
return this._producedEnvByProjectId;
}
async stop() {
if (this._isStopped)
return;
this._isStopped = true;
await Promise.all(this._workerSlots.map(({ worker }) => worker?.stop()));
this._checkFinished();
}
}
class JobDispatcher {
constructor(job, reporter, failureTracker, stopCallback) {
this.jobResult = new import_utils.ManualPromise();
this._listeners = [];
this._failedTests = /* @__PURE__ */ new Set();
this._failedWithNonRetriableError = /* @__PURE__ */ new Set();
this._remainingByTestId = /* @__PURE__ */ new Map();
this._dataByTestId = /* @__PURE__ */ new Map();
this._parallelIndex = 0;
this._workerIndex = 0;
this.job = job;
this._reporter = reporter;
this._failureTracker = failureTracker;
this._stopCallback = stopCallback;
this._remainingByTestId = new Map(this.job.tests.map((e) => [e.id, e]));
}
_onTestBegin(params) {
const test = this._remainingByTestId.get(params.testId);
if (!test) {
return;
}
const result = test._appendTestResult();
this._dataByTestId.set(test.id, { test, result, steps: /* @__PURE__ */ new Map() });
result.parallelIndex = this._parallelIndex;
result.workerIndex = this._workerIndex;
result.startTime = new Date(params.startWallTime);
this._reporter.onTestBegin?.(test, result);
this._currentlyRunning = { test, result };
}
_onTestEnd(params) {
if (this._failureTracker.hasReachedMaxFailures()) {
params.status = "interrupted";
params.errors = [];
}
const data = this._dataByTestId.get(params.testId);
if (!data) {
return;
}
this._dataByTestId.delete(params.testId);
this._remainingByTestId.delete(params.testId);
const { result, test } = data;
result.duration = params.duration;
result.errors = params.errors;
result.error = result.errors[0];
result.status = params.status;
result.annotations = params.annotations;
test.annotations = [...params.annotations];
test.expectedStatus = params.expectedStatus;
test.timeout = params.timeout;
const isFailure = result.status !== "skipped" && result.status !== test.expectedStatus;
if (isFailure)
this._failedTests.add(test);
if (params.hasNonRetriableError)
this._addNonretriableTestAndSerialModeParents(test);
this._reportTestEnd(test, result);
this._currentlyRunning = void 0;
}
_addNonretriableTestAndSerialModeParents(test) {
this._failedWithNonRetriableError.add(test);
for (let parent = test.parent; parent; parent = parent.parent) {
if (parent._parallelMode === "serial")
this._failedWithNonRetriableError.add(parent);
}
}
_onStepBegin(params) {
const data = this._dataByTestId.get(params.testId);
if (!data) {
return;
}
const { result, steps, test } = data;
const parentStep = params.parentStepId ? steps.get(params.parentStepId) : void 0;
const step = {
title: params.title,
titlePath: () => {
const parentPath = parentStep?.titlePath() || [];
return [...parentPath, params.title];
},
parent: parentStep,
category: params.category,
startTime: new Date(params.wallTime),
duration: -1,
steps: [],
attachments: [],
annotations: [],
location: params.location
};
steps.set(params.stepId, step);
(parentStep || result).steps.push(step);
this._reporter.onStepBegin?.(test, result, step);
}
_onStepEnd(params) {
const data = this._dataByTestId.get(params.testId);
if (!data) {
return;
}
const { result, steps, test } = data;
const step = steps.get(params.stepId);
if (!step) {
this._reporter.onStdErr?.("Internal error: step end without step begin: " + params.stepId, test, result);
return;
}
step.duration = params.wallTime - step.startTime.getTime();
if (params.error)
step.error = params.error;
if (params.suggestedRebaseline)
(0, import_rebase.addSuggestedRebaseline)(step.location, params.suggestedRebaseline);
step.annotations = params.annotations;
steps.delete(params.stepId);
this._reporter.onStepEnd?.(test, result, step);
}
_onStepRecoverFromError(resumeAfterStepError, params) {
const data = this._dataByTestId.get(params.testId);
if (!data) {
resumeAfterStepError({ stepId: params.stepId, status: "failed" });
return;
}
const { steps } = data;
const step = steps.get(params.stepId);
if (!step) {
resumeAfterStepError({ stepId: params.stepId, status: "failed" });
return;
}
const testError = {
...params.error,
location: step.location
};
this._failureTracker.recoverFromStepError(params.stepId, testError, resumeAfterStepError);
}
_onAttach(params) {
const data = this._dataByTestId.get(params.testId);
if (!data) {
return;
}
const attachment = {
name: params.name,
path: params.path,
contentType: params.contentType,
body: params.body !== void 0 ? Buffer.from(params.body, "base64") : void 0
};
data.result.attachments.push(attachment);
if (params.stepId) {
const step = data.steps.get(params.stepId);
if (step)
step.attachments.push(attachment);
else
this._reporter.onStdErr?.("Internal error: step id not found: " + params.stepId);
}
}
_failTestWithErrors(test, errors) {
const runData = this._dataByTestId.get(test.id);
let result;
if (runData) {
result = runData.result;
} else {
result = test._appendTestResult();
this._reporter.onTestBegin?.(test, result);
}
result.errors = [...errors];
result.error = result.errors[0];
result.status = errors.length ? "failed" : "skipped";
this._reportTestEnd(test, result);
this._failedTests.add(test);
}
_massSkipTestsFromRemaining(testIds, errors) {
for (const test of this._remainingByTestId.values()) {
if (!testIds.has(test.id))
continue;
if (!this._failureTracker.hasReachedMaxFailures()) {
this._failTestWithErrors(test, errors);
errors = [];
}
this._remainingByTestId.delete(test.id);
}
if (errors.length) {
this._failureTracker.onWorkerError();
for (const error of errors)
this._reporter.onError?.(error);
}
}
_onDone(params) {
if (!this._remainingByTestId.size && !this._failedTests.size && !params.fatalErrors.length && !params.skipTestsDueToSetupFailure.length && !params.fatalUnknownTestIds && !params.unexpectedExitError) {
this._finished({ didFail: false });
return;
}
for (const testId of params.fatalUnknownTestIds || []) {
const test = this._remainingByTestId.get(testId);
if (test) {
this._remainingByTestId.delete(testId);
this._failTestWithErrors(test, [{ message: `Test not found in the worker process. Make sure test title does not change.` }]);
}
}
if (params.fatalErrors.length) {
this._massSkipTestsFromRemaining(new Set(this._remainingByTestId.keys()), params.fatalErrors);
}
this._massSkipTestsFromRemaining(new Set(params.skipTestsDueToSetupFailure), []);
if (params.unexpectedExitError) {
if (this._currentlyRunning)
this._massSkipTestsFromRemaining(/* @__PURE__ */ new Set([this._currentlyRunning.test.id]), [params.unexpectedExitError]);
else
this._massSkipTestsFromRemaining(new Set(this._remainingByTestId.keys()), [params.unexpectedExitError]);
}
const retryCandidates = /* @__PURE__ */ new Set();
const serialSuitesWithFailures = /* @__PURE__ */ new Set();
for (const failedTest of this._failedTests) {
if (this._failedWithNonRetriableError.has(failedTest))
continue;
retryCandidates.add(failedTest);
let outermostSerialSuite;
for (let parent = failedTest.parent; parent; parent = parent.parent) {
if (parent._parallelMode === "serial")
outermostSerialSuite = parent;
}
if (outermostSerialSuite && !this._failedWithNonRetriableError.has(outermostSerialSuite))
serialSuitesWithFailures.add(outermostSerialSuite);
}
const testsBelongingToSomeSerialSuiteWithFailures = [...this._remainingByTestId.values()].filter((test) => {
let parent = test.parent;
while (parent && !serialSuitesWithFailures.has(parent))
parent = parent.parent;
return !!parent;
});
this._massSkipTestsFromRemaining(new Set(testsBelongingToSomeSerialSuiteWithFailures.map((test) => test.id)), []);
for (const serialSuite of serialSuitesWithFailures) {
serialSuite.allTests().forEach((test) => retryCandidates.add(test));
}
const remaining = [...this._remainingByTestId.values()];
for (const test of retryCandidates) {
if (test.results.length < test.retries + 1)
remaining.push(test);
}
const newJob = remaining.length ? { ...this.job, tests: remaining } : void 0;
this._finished({ didFail: true, newJob });
}
onExit(data) {
const unexpectedExitError = data.unexpectedly ? {
message: `Error: worker process exited unexpectedly (code=${data.code}, signal=${data.signal})`
} : void 0;
this._onDone({ skipTestsDueToSetupFailure: [], fatalErrors: [], unexpectedExitError });
}
_finished(result) {
import_utils.eventsHelper.removeEventListeners(this._listeners);
this.jobResult.resolve(result);
}
runInWorker(worker) {
this._parallelIndex = worker.parallelIndex;
this._workerIndex = worker.workerIndex;
const runPayload = {
file: this.job.requireFile,
entries: this.job.tests.map((test) => {
return { testId: test.id, retry: test.results.length };
})
};
worker.runTestGroup(runPayload);
const resumeAfterStepError = worker.resumeAfterStepError.bind(worker);
this._listeners = [
import_utils.eventsHelper.addEventListener(worker, "testBegin", this._onTestBegin.bind(this)),
import_utils.eventsHelper.addEventListener(worker, "testEnd", this._onTestEnd.bind(this)),
import_utils.eventsHelper.addEventListener(worker, "stepBegin", this._onStepBegin.bind(this)),
import_utils.eventsHelper.addEventListener(worker, "stepEnd", this._onStepEnd.bind(this)),
import_utils.eventsHelper.addEventListener(worker, "stepRecoverFromError", this._onStepRecoverFromError.bind(this, resumeAfterStepError)),
import_utils.eventsHelper.addEventListener(worker, "attach", this._onAttach.bind(this)),
import_utils.eventsHelper.addEventListener(worker, "done", this._onDone.bind(this)),
import_utils.eventsHelper.addEventListener(worker, "exit", this.onExit.bind(this))
];
}
skipWholeJob() {
const allTestsSkipped = this.job.tests.every((test) => test.expectedStatus === "skipped");
if (allTestsSkipped && !this._failureTracker.hasReachedMaxFailures()) {
for (const test of this.job.tests) {
const result = test._appendTestResult();
this._reporter.onTestBegin?.(test, result);
result.status = "skipped";
this._reportTestEnd(test, result);
}
return true;
}
return false;
}
currentlyRunning() {
return this._currentlyRunning;
}
_reportTestEnd(test, result) {
this._reporter.onTestEnd?.(test, result);
const hadMaxFailures = this._failureTracker.hasReachedMaxFailures();
this._failureTracker.onTestEnd(test, result);
if (this._failureTracker.hasReachedMaxFailures()) {
this._stopCallback();
if (!hadMaxFailures)
this._reporter.onError?.({ message: import_utils2.colors.red(`Testing stopped early after ${this._failureTracker.maxFailures()} maximum allowed failures.`) });
}
}
}
function chunkFromParams(params) {
if (typeof params.text === "string")
return params.text;
return Buffer.from(params.buffer, "base64");
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Dispatcher
});
+76
View File
@@ -0,0 +1,76 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var failureTracker_exports = {};
__export(failureTracker_exports, {
FailureTracker: () => FailureTracker
});
module.exports = __toCommonJS(failureTracker_exports);
class FailureTracker {
constructor(_config) {
this._config = _config;
this._failureCount = 0;
this._hasWorkerErrors = false;
}
canRecoverFromStepError() {
return !!this._recoverFromStepErrorHandler;
}
setRecoverFromStepErrorHandler(recoverFromStepErrorHandler) {
this._recoverFromStepErrorHandler = recoverFromStepErrorHandler;
}
onRootSuite(rootSuite) {
this._rootSuite = rootSuite;
}
onTestEnd(test, result) {
if (test.outcome() === "unexpected" && test.results.length > test.retries)
++this._failureCount;
}
recoverFromStepError(stepId, error, resumeAfterStepError) {
if (!this._recoverFromStepErrorHandler) {
resumeAfterStepError({ stepId, status: "failed" });
return;
}
void this._recoverFromStepErrorHandler(stepId, error).then(resumeAfterStepError).catch(() => {
});
}
onWorkerError() {
this._hasWorkerErrors = true;
}
hasReachedMaxFailures() {
return this.maxFailures() > 0 && this._failureCount >= this.maxFailures();
}
hasWorkerErrors() {
return this._hasWorkerErrors;
}
result() {
return this._hasWorkerErrors || this.hasReachedMaxFailures() || this.hasFailedTests() || this._config.failOnFlakyTests && this.hasFlakyTests() ? "failed" : "passed";
}
hasFailedTests() {
return this._rootSuite?.allTests().some((test) => !test.ok());
}
hasFlakyTests() {
return this._rootSuite?.allTests().some((test) => test.outcome() === "flaky");
}
maxFailures() {
return this._config.config.maxFailures;
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
FailureTracker
});
+77
View File
@@ -0,0 +1,77 @@
"use strict";
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 __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);
var lastRun_exports = {};
__export(lastRun_exports, {
LastRunReporter: () => LastRunReporter
});
module.exports = __toCommonJS(lastRun_exports);
var import_fs = __toESM(require("fs"));
var import_path = __toESM(require("path"));
var import_projectUtils = require("./projectUtils");
class LastRunReporter {
constructor(config) {
this._config = config;
const [project] = (0, import_projectUtils.filterProjects)(config.projects, config.cliProjectFilter);
if (project)
this._lastRunFile = import_path.default.join(project.project.outputDir, ".last-run.json");
}
async filterLastFailed() {
if (!this._lastRunFile)
return;
try {
const lastRunInfo = JSON.parse(await import_fs.default.promises.readFile(this._lastRunFile, "utf8"));
const failedTestIds = new Set(lastRunInfo.failedTests);
this._config.postShardTestFilters.push((test) => failedTestIds.has(test.id));
} catch {
}
}
version() {
return "v2";
}
printsToStdio() {
return false;
}
onBegin(suite) {
this._suite = suite;
}
async onEnd(result) {
if (!this._lastRunFile || this._config.cliListOnly)
return;
const lastRunInfo = {
status: result.status,
failedTests: this._suite?.allTests().filter((t) => !t.ok()).map((t) => t.id) || []
};
await import_fs.default.promises.mkdir(import_path.default.dirname(this._lastRunFile), { recursive: true });
await import_fs.default.promises.writeFile(this._lastRunFile, JSON.stringify(lastRunInfo, void 0, 2));
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
LastRunReporter
});
+297
View File
@@ -0,0 +1,297 @@
"use strict";
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 __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);
var loadUtils_exports = {};
__export(loadUtils_exports, {
collectProjectsAndTestFiles: () => collectProjectsAndTestFiles,
createRootSuite: () => createRootSuite,
loadFileSuites: () => loadFileSuites,
loadGlobalHook: () => loadGlobalHook,
loadReporter: () => loadReporter
});
module.exports = __toCommonJS(loadUtils_exports);
var import_path = __toESM(require("path"));
var import_loaderHost = require("./loaderHost");
var import_util = require("../util");
var import_projectUtils = require("./projectUtils");
var import_testGroups = require("./testGroups");
var import_suiteUtils = require("../common/suiteUtils");
var import_test = require("../common/test");
var import_compilationCache = require("../transform/compilationCache");
var import_transform = require("../transform/transform");
var import_utilsBundle = require("../utilsBundle");
async function collectProjectsAndTestFiles(testRun, doNotRunTestsOutsideProjectFilter) {
const config = testRun.config;
const fsCache = /* @__PURE__ */ new Map();
const sourceMapCache = /* @__PURE__ */ new Map();
const cliFileMatcher = config.cliArgs.length ? (0, import_util.createFileMatcherFromArguments)(config.cliArgs) : null;
const allFilesForProject = /* @__PURE__ */ new Map();
const filteredProjects = (0, import_projectUtils.filterProjects)(config.projects, config.cliProjectFilter);
for (const project of filteredProjects) {
const files = await (0, import_projectUtils.collectFilesForProject)(project, fsCache);
allFilesForProject.set(project, files);
}
const filesToRunByProject = /* @__PURE__ */ new Map();
for (const [project, files] of allFilesForProject) {
const matchedFiles = files.filter((file) => {
const hasMatchingSources = sourceMapSources(file, sourceMapCache).some((source) => {
if (cliFileMatcher && !cliFileMatcher(source))
return false;
return true;
});
return hasMatchingSources;
});
const filteredFiles = matchedFiles.filter(Boolean);
filesToRunByProject.set(project, filteredFiles);
}
const projectClosure = (0, import_projectUtils.buildProjectsClosure)([...filesToRunByProject.keys()]);
for (const [project, type] of projectClosure) {
if (type === "dependency") {
const treatProjectAsEmpty = doNotRunTestsOutsideProjectFilter && !filteredProjects.includes(project);
const files = treatProjectAsEmpty ? [] : allFilesForProject.get(project) || await (0, import_projectUtils.collectFilesForProject)(project, fsCache);
filesToRunByProject.set(project, files);
}
}
testRun.projectFiles = filesToRunByProject;
testRun.projectSuites = /* @__PURE__ */ new Map();
}
async function loadFileSuites(testRun, mode, errors) {
const config = testRun.config;
const allTestFiles = /* @__PURE__ */ new Set();
for (const files of testRun.projectFiles.values())
files.forEach((file) => allTestFiles.add(file));
const fileSuiteByFile = /* @__PURE__ */ new Map();
const loaderHost = mode === "out-of-process" ? new import_loaderHost.OutOfProcessLoaderHost(config) : new import_loaderHost.InProcessLoaderHost(config);
if (await loaderHost.start(errors)) {
for (const file of allTestFiles) {
const fileSuite = await loaderHost.loadTestFile(file, errors);
fileSuiteByFile.set(file, fileSuite);
errors.push(...createDuplicateTitlesErrors(config, fileSuite));
}
await loaderHost.stop();
}
for (const file of allTestFiles) {
for (const dependency of (0, import_compilationCache.dependenciesForTestFile)(file)) {
if (allTestFiles.has(dependency)) {
const importer = import_path.default.relative(config.config.rootDir, file);
const importee = import_path.default.relative(config.config.rootDir, dependency);
errors.push({
message: `Error: test file "${importer}" should not import test file "${importee}"`,
location: { file, line: 1, column: 1 }
});
}
}
}
for (const [project, files] of testRun.projectFiles) {
const suites = files.map((file) => fileSuiteByFile.get(file)).filter(Boolean);
testRun.projectSuites.set(project, suites);
}
}
async function createRootSuite(testRun, errors, shouldFilterOnly) {
const config = testRun.config;
const rootSuite = new import_test.Suite("", "root");
const projectSuites = /* @__PURE__ */ new Map();
const filteredProjectSuites = /* @__PURE__ */ new Map();
{
const cliFileFilters = (0, import_util.createFileFiltersFromArguments)(config.cliArgs);
const grepMatcher = config.cliGrep ? (0, import_util.createTitleMatcher)((0, import_util.forceRegExp)(config.cliGrep)) : () => true;
const grepInvertMatcher = config.cliGrepInvert ? (0, import_util.createTitleMatcher)((0, import_util.forceRegExp)(config.cliGrepInvert)) : () => false;
const cliTitleMatcher = (title) => !grepInvertMatcher(title) && grepMatcher(title);
for (const [project, fileSuites] of testRun.projectSuites) {
const projectSuite = createProjectSuite(project, fileSuites);
projectSuites.set(project, projectSuite);
const filteredProjectSuite = filterProjectSuite(projectSuite, { cliFileFilters, cliTitleMatcher, testFilters: config.preOnlyTestFilters });
filteredProjectSuites.set(project, filteredProjectSuite);
}
}
if (shouldFilterOnly) {
const filteredRoot = new import_test.Suite("", "root");
for (const filteredProjectSuite of filteredProjectSuites.values())
filteredRoot._addSuite(filteredProjectSuite);
(0, import_suiteUtils.filterOnly)(filteredRoot);
for (const [project, filteredProjectSuite] of filteredProjectSuites) {
if (!filteredRoot.suites.includes(filteredProjectSuite))
filteredProjectSuites.delete(project);
}
}
const projectClosure = (0, import_projectUtils.buildProjectsClosure)([...filteredProjectSuites.keys()], (project) => filteredProjectSuites.get(project)._hasTests());
for (const [project, type] of projectClosure) {
if (type === "top-level") {
project.project.repeatEach = project.fullConfig.configCLIOverrides.repeatEach ?? project.project.repeatEach;
rootSuite._addSuite(buildProjectSuite(project, filteredProjectSuites.get(project)));
}
}
if (config.config.forbidOnly) {
const onlyTestsAndSuites = rootSuite._getOnlyItems();
if (onlyTestsAndSuites.length > 0) {
const configFilePath = config.config.configFile ? import_path.default.relative(config.config.rootDir, config.config.configFile) : void 0;
errors.push(...createForbidOnlyErrors(onlyTestsAndSuites, config.configCLIOverrides.forbidOnly, configFilePath));
}
}
if (config.config.shard) {
const testGroups = [];
for (const projectSuite of rootSuite.suites) {
testGroups.push(...(0, import_testGroups.createTestGroups)(projectSuite, config.config.shard.total));
}
const testGroupsInThisShard = (0, import_testGroups.filterForShard)(config.config.shard, testGroups);
const testsInThisShard = /* @__PURE__ */ new Set();
for (const group of testGroupsInThisShard) {
for (const test of group.tests)
testsInThisShard.add(test);
}
(0, import_suiteUtils.filterTestsRemoveEmptySuites)(rootSuite, (test) => testsInThisShard.has(test));
}
if (config.postShardTestFilters.length)
(0, import_suiteUtils.filterTestsRemoveEmptySuites)(rootSuite, (test) => config.postShardTestFilters.every((filter) => filter(test)));
{
const projectClosure2 = new Map((0, import_projectUtils.buildProjectsClosure)(rootSuite.suites.map((suite) => suite._fullProject)));
for (const [project, level] of projectClosure2.entries()) {
if (level === "dependency")
rootSuite._prependSuite(buildProjectSuite(project, projectSuites.get(project)));
}
}
return rootSuite;
}
function createProjectSuite(project, fileSuites) {
const projectSuite = new import_test.Suite(project.project.name, "project");
for (const fileSuite of fileSuites)
projectSuite._addSuite((0, import_suiteUtils.bindFileSuiteToProject)(project, fileSuite));
const grepMatcher = (0, import_util.createTitleMatcher)(project.project.grep);
const grepInvertMatcher = project.project.grepInvert ? (0, import_util.createTitleMatcher)(project.project.grepInvert) : null;
(0, import_suiteUtils.filterTestsRemoveEmptySuites)(projectSuite, (test) => {
const grepTitle = test._grepTitleWithTags();
if (grepInvertMatcher?.(grepTitle))
return false;
return grepMatcher(grepTitle);
});
return projectSuite;
}
function filterProjectSuite(projectSuite, options) {
if (!options.cliFileFilters.length && !options.cliTitleMatcher && !options.testFilters.length)
return projectSuite;
const result = projectSuite._deepClone();
if (options.cliFileFilters.length)
(0, import_suiteUtils.filterByFocusedLine)(result, options.cliFileFilters);
(0, import_suiteUtils.filterTestsRemoveEmptySuites)(result, (test) => {
if (!options.testFilters.every((filter) => filter(test)))
return false;
if (options.cliTitleMatcher && !options.cliTitleMatcher(test._grepTitleWithTags()))
return false;
return true;
});
return result;
}
function buildProjectSuite(project, projectSuite) {
const result = new import_test.Suite(project.project.name, "project");
result._fullProject = project;
if (project.fullyParallel)
result._parallelMode = "parallel";
for (const fileSuite of projectSuite.suites) {
result._addSuite(fileSuite);
for (let repeatEachIndex = 1; repeatEachIndex < project.project.repeatEach; repeatEachIndex++) {
const clone = fileSuite._deepClone();
(0, import_suiteUtils.applyRepeatEachIndex)(project, clone, repeatEachIndex);
result._addSuite(clone);
}
}
return result;
}
function createForbidOnlyErrors(onlyTestsAndSuites, forbidOnlyCLIFlag, configFilePath) {
const errors = [];
for (const testOrSuite of onlyTestsAndSuites) {
const title = testOrSuite.titlePath().slice(2).join(" ");
const configFilePathName = configFilePath ? `'${configFilePath}'` : "the Playwright configuration file";
const forbidOnlySource = forbidOnlyCLIFlag ? `'--forbid-only' CLI flag` : `'forbidOnly' option in ${configFilePathName}`;
const error = {
message: `Error: item focused with '.only' is not allowed due to the ${forbidOnlySource}: "${title}"`,
location: testOrSuite.location
};
errors.push(error);
}
return errors;
}
function createDuplicateTitlesErrors(config, fileSuite) {
const errors = [];
const testsByFullTitle = /* @__PURE__ */ new Map();
for (const test of fileSuite.allTests()) {
const fullTitle = test.titlePath().slice(1).join(" \u203A ");
const existingTest = testsByFullTitle.get(fullTitle);
if (existingTest) {
const error = {
message: `Error: duplicate test title "${fullTitle}", first declared in ${buildItemLocation(config.config.rootDir, existingTest)}`,
location: test.location
};
errors.push(error);
}
testsByFullTitle.set(fullTitle, test);
}
return errors;
}
function buildItemLocation(rootDir, testOrSuite) {
if (!testOrSuite.location)
return "";
return `${import_path.default.relative(rootDir, testOrSuite.location.file)}:${testOrSuite.location.line}`;
}
async function requireOrImportDefaultFunction(file, expectConstructor) {
let func = await (0, import_transform.requireOrImport)(file);
if (func && typeof func === "object" && "default" in func)
func = func["default"];
if (typeof func !== "function")
throw (0, import_util.errorWithFile)(file, `file must export a single ${expectConstructor ? "class" : "function"}.`);
return func;
}
function loadGlobalHook(config, file) {
return requireOrImportDefaultFunction(import_path.default.resolve(config.config.rootDir, file), false);
}
function loadReporter(config, file) {
return requireOrImportDefaultFunction(config ? import_path.default.resolve(config.config.rootDir, file) : file, true);
}
function sourceMapSources(file, cache) {
let sources = [file];
if (!file.endsWith(".js"))
return sources;
if (cache.has(file))
return cache.get(file);
try {
const sourceMap = import_utilsBundle.sourceMapSupport.retrieveSourceMap(file);
const sourceMapData = typeof sourceMap?.map === "string" ? JSON.parse(sourceMap.map) : sourceMap?.map;
if (sourceMapData?.sources)
sources = sourceMapData.sources.map((source) => import_path.default.resolve(import_path.default.dirname(file), source));
} finally {
cache.set(file, sources);
return sources;
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
collectProjectsAndTestFiles,
createRootSuite,
loadFileSuites,
loadGlobalHook,
loadReporter
});
+89
View File
@@ -0,0 +1,89 @@
"use strict";
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 __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);
var loaderHost_exports = {};
__export(loaderHost_exports, {
InProcessLoaderHost: () => InProcessLoaderHost,
OutOfProcessLoaderHost: () => OutOfProcessLoaderHost
});
module.exports = __toCommonJS(loaderHost_exports);
var import_processHost = require("./processHost");
var import_esmLoaderHost = require("../common/esmLoaderHost");
var import_ipc = require("../common/ipc");
var import_poolBuilder = require("../common/poolBuilder");
var import_test = require("../common/test");
var import_testLoader = require("../common/testLoader");
var import_compilationCache = require("../transform/compilationCache");
class InProcessLoaderHost {
constructor(config) {
this._config = config;
this._poolBuilder = import_poolBuilder.PoolBuilder.createForLoader();
}
async start(errors) {
return true;
}
async loadTestFile(file, testErrors) {
const result = await (0, import_testLoader.loadTestFile)(file, this._config.config.rootDir, testErrors);
this._poolBuilder.buildPools(result, testErrors);
return result;
}
async stop() {
await (0, import_esmLoaderHost.incorporateCompilationCache)();
}
}
class OutOfProcessLoaderHost {
constructor(config) {
this._config = config;
this._processHost = new import_processHost.ProcessHost(require.resolve("../loader/loaderMain.js"), "loader", {});
}
async start(errors) {
const startError = await this._processHost.startRunner((0, import_ipc.serializeConfig)(this._config, false));
if (startError) {
errors.push({
message: `Test loader process failed to start with code "${startError.code}" and signal "${startError.signal}"`
});
return false;
}
return true;
}
async loadTestFile(file, testErrors) {
const result = await this._processHost.sendMessage({ method: "loadTestFile", params: { file } });
testErrors.push(...result.testErrors);
return import_test.Suite._deepParse(result.fileSuite);
}
async stop() {
const result = await this._processHost.sendMessage({ method: "getCompilationCacheFromLoader" });
(0, import_compilationCache.addToCompilationCache)(result);
await this._processHost.stop();
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
InProcessLoaderHost,
OutOfProcessLoaderHost
});
+161
View File
@@ -0,0 +1,161 @@
"use strict";
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 __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);
var processHost_exports = {};
__export(processHost_exports, {
ProcessHost: () => ProcessHost
});
module.exports = __toCommonJS(processHost_exports);
var import_child_process = __toESM(require("child_process"));
var import_events = require("events");
var import_utils = require("playwright-core/lib/utils");
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
class ProcessHost extends import_events.EventEmitter {
constructor(runnerScript, processName, env) {
super();
this._didSendStop = false;
this._processDidExit = false;
this._didExitAndRanOnExit = false;
this._lastMessageId = 0;
this._callbacks = /* @__PURE__ */ new Map();
this._producedEnv = {};
this._runnerScript = runnerScript;
this._processName = processName;
this._extraEnv = env;
}
async startRunner(runnerParams, options = {}) {
(0, import_utils.assert)(!this.process, "Internal error: starting the same process twice");
this.process = import_child_process.default.fork(require.resolve("../common/process"), {
detached: false,
env: {
...process.env,
...this._extraEnv
},
stdio: [
"ignore",
options.onStdOut ? "pipe" : "inherit",
options.onStdErr && !process.env.PW_RUNNER_DEBUG ? "pipe" : "inherit",
"ipc"
]
});
this.process.on("exit", async (code, signal) => {
this._processDidExit = true;
await this.onExit();
this._didExitAndRanOnExit = true;
this.emit("exit", { unexpectedly: !this._didSendStop, code, signal });
});
this.process.on("error", (e) => {
});
this.process.on("message", (message) => {
if (import_utilsBundle.debug.enabled("pw:test:protocol"))
(0, import_utilsBundle.debug)("pw:test:protocol")("\u25C0 RECV " + JSON.stringify(message));
if (message.method === "__env_produced__") {
const producedEnv = message.params;
this._producedEnv = Object.fromEntries(producedEnv.map((e) => [e[0], e[1] ?? void 0]));
} else if (message.method === "__dispatch__") {
const { id, error: error2, method, params, result } = message.params;
if (id && this._callbacks.has(id)) {
const { resolve, reject } = this._callbacks.get(id);
this._callbacks.delete(id);
if (error2) {
const errorObject = new Error(error2.message);
errorObject.stack = error2.stack;
reject(errorObject);
} else {
resolve(result);
}
} else {
this.emit(method, params);
}
} else {
this.emit(message.method, message.params);
}
});
if (options.onStdOut)
this.process.stdout?.on("data", options.onStdOut);
if (options.onStdErr)
this.process.stderr?.on("data", options.onStdErr);
const error = await new Promise((resolve) => {
this.process.once("exit", (code, signal) => resolve({ unexpectedly: true, code, signal }));
this.once("ready", () => resolve(void 0));
});
if (error)
return error;
const processParams = {
processName: this._processName,
timeOrigin: (0, import_utils.timeOrigin)()
};
this.send({
method: "__init__",
params: {
processParams,
runnerScript: this._runnerScript,
runnerParams
}
});
}
sendMessage(message) {
const id = ++this._lastMessageId;
this.send({
method: "__dispatch__",
params: { id, ...message }
});
return new Promise((resolve, reject) => {
this._callbacks.set(id, { resolve, reject });
});
}
sendMessageNoReply(message) {
this.sendMessage(message).catch(() => {
});
}
async onExit() {
}
async stop() {
if (!this._processDidExit && !this._didSendStop) {
this.send({ method: "__stop__" });
this._didSendStop = true;
}
if (!this._didExitAndRanOnExit)
await new Promise((f) => this.once("exit", f));
}
didSendStop() {
return this._didSendStop;
}
producedEnv() {
return this._producedEnv;
}
send(message) {
if (import_utilsBundle.debug.enabled("pw:test:protocol"))
(0, import_utilsBundle.debug)("pw:test:protocol")("SEND \u25BA " + JSON.stringify(message));
this.process?.send(message);
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
ProcessHost
});
+235
View File
@@ -0,0 +1,235 @@
"use strict";
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 __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);
var projectUtils_exports = {};
__export(projectUtils_exports, {
buildDependentProjects: () => buildDependentProjects,
buildProjectsClosure: () => buildProjectsClosure,
buildTeardownToSetupsMap: () => buildTeardownToSetupsMap,
collectFilesForProject: () => collectFilesForProject,
filterProjects: () => filterProjects
});
module.exports = __toCommonJS(projectUtils_exports);
var import_fs = __toESM(require("fs"));
var import_path = __toESM(require("path"));
var import_util = require("util");
var import_utils = require("playwright-core/lib/utils");
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
var import_util2 = require("../util");
const readFileAsync = (0, import_util.promisify)(import_fs.default.readFile);
const readDirAsync = (0, import_util.promisify)(import_fs.default.readdir);
function wildcardPatternToRegExp(pattern) {
return new RegExp("^" + pattern.split("*").map(import_utils.escapeRegExp).join(".*") + "$", "ig");
}
function filterProjects(projects, projectNames) {
if (!projectNames)
return [...projects];
const projectNamesToFind = /* @__PURE__ */ new Set();
const unmatchedProjectNames = /* @__PURE__ */ new Map();
const patterns = /* @__PURE__ */ new Set();
for (const name of projectNames) {
const lowerCaseName = name.toLocaleLowerCase();
if (lowerCaseName.includes("*")) {
patterns.add(wildcardPatternToRegExp(lowerCaseName));
} else {
projectNamesToFind.add(lowerCaseName);
unmatchedProjectNames.set(lowerCaseName, name);
}
}
const result = projects.filter((project) => {
const lowerCaseName = project.project.name.toLocaleLowerCase();
if (projectNamesToFind.has(lowerCaseName)) {
unmatchedProjectNames.delete(lowerCaseName);
return true;
}
for (const regex of patterns) {
regex.lastIndex = 0;
if (regex.test(lowerCaseName))
return true;
}
return false;
});
if (unmatchedProjectNames.size) {
const unknownProjectNames = Array.from(unmatchedProjectNames.values()).map((n) => `"${n}"`).join(", ");
throw new Error(`Project(s) ${unknownProjectNames} not found. Available projects: ${projects.map((p) => `"${p.project.name}"`).join(", ")}`);
}
if (!result.length) {
const allProjects = projects.map((p) => `"${p.project.name}"`).join(", ");
throw new Error(`No projects matched. Available projects: ${allProjects}`);
}
return result;
}
function buildTeardownToSetupsMap(projects) {
const result = /* @__PURE__ */ new Map();
for (const project of projects) {
if (project.teardown) {
const setups = result.get(project.teardown) || [];
setups.push(project);
result.set(project.teardown, setups);
}
}
return result;
}
function buildProjectsClosure(projects, hasTests) {
const result = /* @__PURE__ */ new Map();
const visit = (depth, project) => {
if (depth > 100) {
const error = new Error("Circular dependency detected between projects.");
error.stack = "";
throw error;
}
if (depth === 0 && hasTests && !hasTests(project))
return;
if (result.get(project) !== "dependency")
result.set(project, depth ? "dependency" : "top-level");
for (const dep of project.deps)
visit(depth + 1, dep);
if (project.teardown)
visit(depth + 1, project.teardown);
};
for (const p of projects)
visit(0, p);
return result;
}
function buildDependentProjects(forProjects, projects) {
const reverseDeps = new Map(projects.map((p) => [p, []]));
for (const project of projects) {
for (const dep of project.deps)
reverseDeps.get(dep).push(project);
}
const result = /* @__PURE__ */ new Set();
const visit = (depth, project) => {
if (depth > 100) {
const error = new Error("Circular dependency detected between projects.");
error.stack = "";
throw error;
}
result.add(project);
for (const reverseDep of reverseDeps.get(project))
visit(depth + 1, reverseDep);
if (project.teardown)
visit(depth + 1, project.teardown);
};
for (const forProject of forProjects)
visit(0, forProject);
return result;
}
async function collectFilesForProject(project, fsCache = /* @__PURE__ */ new Map()) {
const extensions = /* @__PURE__ */ new Set([".js", ".ts", ".mjs", ".mts", ".cjs", ".cts", ".jsx", ".tsx", ".mjsx", ".mtsx", ".cjsx", ".ctsx"]);
const testFileExtension = (file) => extensions.has(import_path.default.extname(file));
const allFiles = await cachedCollectFiles(project.project.testDir, project.respectGitIgnore, fsCache);
const testMatch = (0, import_util2.createFileMatcher)(project.project.testMatch);
const testIgnore = (0, import_util2.createFileMatcher)(project.project.testIgnore);
const testFiles = allFiles.filter((file) => {
if (!testFileExtension(file))
return false;
const isTest = !testIgnore(file) && testMatch(file);
if (!isTest)
return false;
return true;
});
return testFiles;
}
async function cachedCollectFiles(testDir, respectGitIgnore, fsCache) {
const key = testDir + ":" + respectGitIgnore;
let result = fsCache.get(key);
if (!result) {
result = await collectFiles(testDir, respectGitIgnore);
fsCache.set(key, result);
}
return result;
}
async function collectFiles(testDir, respectGitIgnore) {
if (!import_fs.default.existsSync(testDir))
return [];
if (!import_fs.default.statSync(testDir).isDirectory())
return [];
const checkIgnores = (entryPath, rules, isDirectory, parentStatus) => {
let status = parentStatus;
for (const rule of rules) {
const ruleIncludes = rule.negate;
if (status === "included" === ruleIncludes)
continue;
const relative = import_path.default.relative(rule.dir, entryPath);
if (rule.match("/" + relative) || rule.match(relative)) {
status = ruleIncludes ? "included" : "ignored";
} else if (isDirectory && (rule.match("/" + relative + "/") || rule.match(relative + "/"))) {
status = ruleIncludes ? "included" : "ignored";
} else if (isDirectory && ruleIncludes && (rule.match("/" + relative, true) || rule.match(relative, true))) {
status = "ignored-but-recurse";
}
}
return status;
};
const files = [];
const visit = async (dir, rules, status) => {
const entries = await readDirAsync(dir, { withFileTypes: true });
entries.sort((a, b) => a.name.localeCompare(b.name));
if (respectGitIgnore) {
const gitignore = entries.find((e) => e.isFile() && e.name === ".gitignore");
if (gitignore) {
const content = await readFileAsync(import_path.default.join(dir, gitignore.name), "utf8");
const newRules = content.split(/\r?\n/).map((s) => {
s = s.trim();
if (!s)
return;
const rule = new import_utilsBundle.minimatch.Minimatch(s, { matchBase: true, dot: true, flipNegate: true });
if (rule.comment)
return;
rule.dir = dir;
return rule;
}).filter((rule) => !!rule);
rules = [...rules, ...newRules];
}
}
for (const entry of entries) {
if (entry.name === "." || entry.name === "..")
continue;
if (entry.isFile() && entry.name === ".gitignore")
continue;
if (entry.isDirectory() && entry.name === "node_modules")
continue;
const entryPath = import_path.default.join(dir, entry.name);
const entryStatus = checkIgnores(entryPath, rules, entry.isDirectory(), status);
if (entry.isDirectory() && entryStatus !== "ignored")
await visit(entryPath, rules, entryStatus);
else if (entry.isFile() && entryStatus === "included")
files.push(entryPath);
}
};
await visit(testDir, [], "included");
return files;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
buildDependentProjects,
buildProjectsClosure,
buildTeardownToSetupsMap,
collectFilesForProject,
filterProjects
});
+189
View File
@@ -0,0 +1,189 @@
"use strict";
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 __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);
var rebase_exports = {};
__export(rebase_exports, {
addSuggestedRebaseline: () => addSuggestedRebaseline,
applySuggestedRebaselines: () => applySuggestedRebaselines,
clearSuggestedRebaselines: () => clearSuggestedRebaselines
});
module.exports = __toCommonJS(rebase_exports);
var import_fs = __toESM(require("fs"));
var import_path = __toESM(require("path"));
var import_utils = require("playwright-core/lib/utils");
var import_utils2 = require("playwright-core/lib/utils");
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
var import_projectUtils = require("./projectUtils");
var import_babelBundle = require("../transform/babelBundle");
const t = import_babelBundle.types;
const suggestedRebaselines = new import_utils.MultiMap();
function addSuggestedRebaseline(location, suggestedRebaseline) {
suggestedRebaselines.set(location.file, { location, code: suggestedRebaseline });
}
function clearSuggestedRebaselines() {
suggestedRebaselines.clear();
}
async function applySuggestedRebaselines(config, reporter) {
if (config.config.updateSnapshots === "none")
return;
if (!suggestedRebaselines.size)
return;
const [project] = (0, import_projectUtils.filterProjects)(config.projects, config.cliProjectFilter);
if (!project)
return;
const patches = [];
const files = [];
const gitCache = /* @__PURE__ */ new Map();
const patchFile = import_path.default.join(project.project.outputDir, "rebaselines.patch");
for (const fileName of [...suggestedRebaselines.keys()].sort()) {
const source = await import_fs.default.promises.readFile(fileName, "utf8");
const lines = source.split("\n");
const replacements = suggestedRebaselines.get(fileName);
const fileNode = (0, import_babelBundle.babelParse)(source, fileName, true);
const ranges = [];
(0, import_babelBundle.traverse)(fileNode, {
CallExpression: (path2) => {
const node = path2.node;
if (node.arguments.length < 1)
return;
if (!t.isMemberExpression(node.callee))
return;
const argument = node.arguments[0];
if (!t.isStringLiteral(argument) && !t.isTemplateLiteral(argument))
return;
const prop = node.callee.property;
if (!prop.loc || !argument.start || !argument.end)
return;
for (const replacement of replacements) {
if (prop.loc.start.line !== replacement.location.line)
continue;
if (prop.loc.start.column + 1 !== replacement.location.column)
continue;
const indent = lines[prop.loc.start.line - 1].match(/^\s*/)[0];
const newText = replacement.code.replace(/\{indent\}/g, indent);
ranges.push({ start: argument.start, end: argument.end, oldText: source.substring(argument.start, argument.end), newText });
break;
}
}
});
ranges.sort((a, b) => b.start - a.start);
let result = source;
for (const range of ranges)
result = result.substring(0, range.start) + range.newText + result.substring(range.end);
const relativeName = import_path.default.relative(process.cwd(), fileName);
files.push(relativeName);
if (config.config.updateSourceMethod === "overwrite") {
await import_fs.default.promises.writeFile(fileName, result);
} else if (config.config.updateSourceMethod === "3way") {
await import_fs.default.promises.writeFile(fileName, applyPatchWithConflictMarkers(source, result));
} else {
const gitFolder = findGitRoot(import_path.default.dirname(fileName), gitCache);
const relativeToGit = import_path.default.relative(gitFolder || process.cwd(), fileName);
patches.push(createPatch(relativeToGit, source, result));
}
}
const fileList = files.map((file) => " " + import_utils2.colors.dim(file)).join("\n");
reporter.onStdErr(`
New baselines created for:
${fileList}
`);
if (config.config.updateSourceMethod === "patch") {
await import_fs.default.promises.mkdir(import_path.default.dirname(patchFile), { recursive: true });
await import_fs.default.promises.writeFile(patchFile, patches.join("\n"));
reporter.onStdErr(`
` + import_utils2.colors.cyan("git apply " + import_path.default.relative(process.cwd(), patchFile)) + "\n");
}
}
function createPatch(fileName, before, after) {
const file = fileName.replace(/\\/g, "/");
const text = import_utilsBundle.diff.createPatch(file, before, after, void 0, void 0, { context: 3 });
return [
"diff --git a/" + file + " b/" + file,
"--- a/" + file,
"+++ b/" + file,
...text.split("\n").slice(4)
].join("\n");
}
function findGitRoot(dir, cache) {
const result = cache.get(dir);
if (result !== void 0)
return result;
const gitPath = import_path.default.join(dir, ".git");
if (import_fs.default.existsSync(gitPath) && import_fs.default.lstatSync(gitPath).isDirectory()) {
cache.set(dir, dir);
return dir;
}
const parentDir = import_path.default.dirname(dir);
if (dir === parentDir) {
cache.set(dir, null);
return null;
}
const parentResult = findGitRoot(parentDir, cache);
cache.set(dir, parentResult);
return parentResult;
}
function applyPatchWithConflictMarkers(oldText, newText) {
const diffResult = import_utilsBundle.diff.diffLines(oldText, newText);
let result = "";
let conflict = false;
diffResult.forEach((part) => {
if (part.added) {
if (conflict) {
result += part.value;
result += ">>>>>>> SNAPSHOT\n";
conflict = false;
} else {
result += "<<<<<<< HEAD\n";
result += part.value;
result += "=======\n";
conflict = true;
}
} else if (part.removed) {
result += "<<<<<<< HEAD\n";
result += part.value;
result += "=======\n";
conflict = true;
} else {
if (conflict) {
result += ">>>>>>> SNAPSHOT\n";
conflict = false;
}
result += part.value;
}
});
if (conflict)
result += ">>>>>>> SNAPSHOT\n";
return result;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
addSuggestedRebaseline,
applySuggestedRebaselines,
clearSuggestedRebaselines
});
+137
View File
@@ -0,0 +1,137 @@
"use strict";
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 __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);
var reporters_exports = {};
__export(reporters_exports, {
createErrorCollectingReporter: () => createErrorCollectingReporter,
createReporterForTestServer: () => createReporterForTestServer,
createReporters: () => createReporters
});
module.exports = __toCommonJS(reporters_exports);
var import_utils = require("playwright-core/lib/utils");
var import_loadUtils = require("./loadUtils");
var import_base = require("../reporters/base");
var import_blob = require("../reporters/blob");
var import_dot = __toESM(require("../reporters/dot"));
var import_empty = __toESM(require("../reporters/empty"));
var import_github = __toESM(require("../reporters/github"));
var import_html = __toESM(require("../reporters/html"));
var import_json = __toESM(require("../reporters/json"));
var import_junit = __toESM(require("../reporters/junit"));
var import_line = __toESM(require("../reporters/line"));
var import_list = __toESM(require("../reporters/list"));
var import_listModeReporter = __toESM(require("../reporters/listModeReporter"));
var import_reporterV2 = require("../reporters/reporterV2");
async function createReporters(config, mode, isTestServer, descriptions) {
const defaultReporters = {
blob: import_blob.BlobReporter,
dot: mode === "list" ? import_listModeReporter.default : import_dot.default,
line: mode === "list" ? import_listModeReporter.default : import_line.default,
list: mode === "list" ? import_listModeReporter.default : import_list.default,
github: import_github.default,
json: import_json.default,
junit: import_junit.default,
null: import_empty.default,
html: import_html.default
};
const reporters = [];
descriptions ??= config.config.reporter;
if (config.configCLIOverrides.additionalReporters)
descriptions = [...descriptions, ...config.configCLIOverrides.additionalReporters];
const runOptions = reporterOptions(config, mode, isTestServer);
for (const r of descriptions) {
const [name, arg] = r;
const options = { ...runOptions, ...arg };
if (name in defaultReporters) {
reporters.push(new defaultReporters[name](options));
} else {
const reporterConstructor = await (0, import_loadUtils.loadReporter)(config, name);
reporters.push((0, import_reporterV2.wrapReporterAsV2)(new reporterConstructor(options)));
}
}
if (process.env.PW_TEST_REPORTER) {
const reporterConstructor = await (0, import_loadUtils.loadReporter)(config, process.env.PW_TEST_REPORTER);
reporters.push((0, import_reporterV2.wrapReporterAsV2)(new reporterConstructor(runOptions)));
}
const someReporterPrintsToStdio = reporters.some((r) => r.printsToStdio ? r.printsToStdio() : true);
if (reporters.length && !someReporterPrintsToStdio) {
if (mode === "list")
reporters.unshift(new import_listModeReporter.default());
else if (mode !== "merge")
reporters.unshift(!process.env.CI ? new import_line.default() : new import_dot.default());
}
return reporters;
}
async function createReporterForTestServer(file, messageSink) {
const reporterConstructor = await (0, import_loadUtils.loadReporter)(null, file);
return (0, import_reporterV2.wrapReporterAsV2)(new reporterConstructor({
_send: messageSink
}));
}
function createErrorCollectingReporter(screen) {
const errors = [];
return {
version: () => "v2",
onError(error) {
errors.push(error);
screen.stderr?.write((0, import_base.formatError)(screen, error).message + "\n");
},
errors: () => errors
};
}
function reporterOptions(config, mode, isTestServer) {
return {
configDir: config.configDir,
_mode: mode,
_isTestServer: isTestServer,
_commandHash: computeCommandHash(config)
};
}
function computeCommandHash(config) {
const parts = [];
if (config.cliProjectFilter)
parts.push(...config.cliProjectFilter);
const command = {};
if (config.cliArgs.length)
command.cliArgs = config.cliArgs;
if (config.cliGrep)
command.cliGrep = config.cliGrep;
if (config.cliGrepInvert)
command.cliGrepInvert = config.cliGrepInvert;
if (config.cliOnlyChanged)
command.cliOnlyChanged = config.cliOnlyChanged;
if (Object.keys(command).length)
parts.push((0, import_utils.calculateSha1)(JSON.stringify(command)).substring(0, 7));
return parts.join("-");
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
createErrorCollectingReporter,
createReporterForTestServer,
createReporters
});
+96
View File
@@ -0,0 +1,96 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var sigIntWatcher_exports = {};
__export(sigIntWatcher_exports, {
SigIntWatcher: () => SigIntWatcher
});
module.exports = __toCommonJS(sigIntWatcher_exports);
class SigIntWatcher {
constructor() {
this._hadSignal = false;
let sigintCallback;
this._sigintPromise = new Promise((f) => sigintCallback = f);
this._sigintHandler = () => {
FixedNodeSIGINTHandler.off(this._sigintHandler);
this._hadSignal = true;
sigintCallback();
};
FixedNodeSIGINTHandler.on(this._sigintHandler);
}
promise() {
return this._sigintPromise;
}
hadSignal() {
return this._hadSignal;
}
disarm() {
FixedNodeSIGINTHandler.off(this._sigintHandler);
}
}
class FixedNodeSIGINTHandler {
static {
this._handlers = [];
}
static {
this._ignoreNextSIGINTs = false;
}
static {
this._handlerInstalled = false;
}
static {
this._dispatch = () => {
if (this._ignoreNextSIGINTs)
return;
this._ignoreNextSIGINTs = true;
setTimeout(() => {
this._ignoreNextSIGINTs = false;
if (!this._handlers.length)
this._uninstall();
}, 1e3);
for (const handler of this._handlers)
handler();
};
}
static _install() {
if (!this._handlerInstalled) {
this._handlerInstalled = true;
process.on("SIGINT", this._dispatch);
}
}
static _uninstall() {
if (this._handlerInstalled) {
this._handlerInstalled = false;
process.off("SIGINT", this._dispatch);
}
}
static on(handler) {
this._handlers.push(handler);
if (this._handlers.length === 1)
this._install();
}
static off(handler) {
this._handlers = this._handlers.filter((h) => h !== handler);
if (!this._ignoreNextSIGINTs && !this._handlers.length)
this._uninstall();
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
SigIntWatcher
});
+127
View File
@@ -0,0 +1,127 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var taskRunner_exports = {};
__export(taskRunner_exports, {
TaskRunner: () => TaskRunner
});
module.exports = __toCommonJS(taskRunner_exports);
var import_utils = require("playwright-core/lib/utils");
var import_utils2 = require("playwright-core/lib/utils");
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
var import_sigIntWatcher = require("./sigIntWatcher");
var import_util = require("../util");
class TaskRunner {
constructor(reporter, globalTimeoutForError) {
this._tasks = [];
this._hasErrors = false;
this._interrupted = false;
this._isTearDown = false;
this._reporter = reporter;
this._globalTimeoutForError = globalTimeoutForError;
}
addTask(task) {
this._tasks.push(task);
}
async run(context, deadline, cancelPromise) {
const { status, cleanup } = await this.runDeferCleanup(context, deadline, cancelPromise);
const teardownStatus = await cleanup();
return status === "passed" ? teardownStatus : status;
}
async runDeferCleanup(context, deadline, cancelPromise = new import_utils.ManualPromise()) {
const sigintWatcher = new import_sigIntWatcher.SigIntWatcher();
const timeoutWatcher = new TimeoutWatcher(deadline);
const teardownRunner = new TaskRunner(this._reporter, this._globalTimeoutForError);
teardownRunner._isTearDown = true;
let currentTaskName;
const taskLoop = async () => {
for (const task of this._tasks) {
currentTaskName = task.title;
if (this._interrupted)
break;
(0, import_utilsBundle.debug)("pw:test:task")(`"${task.title}" started`);
const errors = [];
const softErrors = [];
try {
teardownRunner._tasks.unshift({ title: `teardown for ${task.title}`, setup: task.teardown });
await task.setup?.(context, errors, softErrors);
} catch (e) {
(0, import_utilsBundle.debug)("pw:test:task")(`error in "${task.title}": `, e);
errors.push((0, import_util.serializeError)(e));
} finally {
for (const error of [...softErrors, ...errors])
this._reporter.onError?.(error);
if (errors.length) {
if (!this._isTearDown)
this._interrupted = true;
this._hasErrors = true;
}
}
(0, import_utilsBundle.debug)("pw:test:task")(`"${task.title}" finished`);
}
};
await Promise.race([
taskLoop(),
cancelPromise,
sigintWatcher.promise(),
timeoutWatcher.promise
]);
sigintWatcher.disarm();
timeoutWatcher.disarm();
this._interrupted = true;
let status = "passed";
if (sigintWatcher.hadSignal() || cancelPromise?.isDone()) {
status = "interrupted";
} else if (timeoutWatcher.timedOut()) {
this._reporter.onError?.({ message: import_utils2.colors.red(`Timed out waiting ${this._globalTimeoutForError / 1e3}s for the ${currentTaskName} to run`) });
status = "timedout";
} else if (this._hasErrors) {
status = "failed";
}
cancelPromise?.resolve();
const cleanup = () => teardownRunner.runDeferCleanup(context, deadline).then((r) => r.status);
return { status, cleanup };
}
}
class TimeoutWatcher {
constructor(deadline) {
this._timedOut = false;
this.promise = new import_utils.ManualPromise();
if (!deadline)
return;
if (deadline - (0, import_utils.monotonicTime)() <= 0) {
this._timedOut = true;
this.promise.resolve();
return;
}
this._timer = setTimeout(() => {
this._timedOut = true;
this.promise.resolve();
}, deadline - (0, import_utils.monotonicTime)());
}
timedOut() {
return this._timedOut;
}
disarm() {
clearTimeout(this._timer);
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
TaskRunner
});
+399
View File
@@ -0,0 +1,399 @@
"use strict";
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 __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);
var tasks_exports = {};
__export(tasks_exports, {
TestRun: () => TestRun,
createApplyRebaselinesTask: () => createApplyRebaselinesTask,
createClearCacheTask: () => createClearCacheTask,
createGlobalSetupTasks: () => createGlobalSetupTasks,
createListFilesTask: () => createListFilesTask,
createLoadTask: () => createLoadTask,
createPluginSetupTasks: () => createPluginSetupTasks,
createReportBeginTask: () => createReportBeginTask,
createRunTestsTasks: () => createRunTestsTasks,
createStartDevServerTask: () => createStartDevServerTask,
runTasks: () => runTasks,
runTasksDeferCleanup: () => runTasksDeferCleanup
});
module.exports = __toCommonJS(tasks_exports);
var import_fs = __toESM(require("fs"));
var import_path = __toESM(require("path"));
var import_util = require("util");
var import_utils = require("playwright-core/lib/utils");
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
var import_dispatcher = require("./dispatcher");
var import_failureTracker = require("./failureTracker");
var import_loadUtils = require("./loadUtils");
var import_projectUtils = require("./projectUtils");
var import_rebase = require("./rebase");
var import_taskRunner = require("./taskRunner");
var import_vcs = require("./vcs");
var import_test = require("../common/test");
var import_testGroups = require("../runner/testGroups");
var import_compilationCache = require("../transform/compilationCache");
var import_util2 = require("../util");
const readDirAsync = (0, import_util.promisify)(import_fs.default.readdir);
class TestRun {
constructor(config, reporter) {
this.rootSuite = void 0;
this.phases = [];
this.projectFiles = /* @__PURE__ */ new Map();
this.projectSuites = /* @__PURE__ */ new Map();
this.config = config;
this.reporter = reporter;
this.failureTracker = new import_failureTracker.FailureTracker(config);
}
}
async function runTasks(testRun, tasks, globalTimeout, cancelPromise) {
const deadline = globalTimeout ? (0, import_utils.monotonicTime)() + globalTimeout : 0;
const taskRunner = new import_taskRunner.TaskRunner(testRun.reporter, globalTimeout || 0);
for (const task of tasks)
taskRunner.addTask(task);
testRun.reporter.onConfigure(testRun.config.config);
const status = await taskRunner.run(testRun, deadline, cancelPromise);
return await finishTaskRun(testRun, status);
}
async function runTasksDeferCleanup(testRun, tasks) {
const taskRunner = new import_taskRunner.TaskRunner(testRun.reporter, 0);
for (const task of tasks)
taskRunner.addTask(task);
testRun.reporter.onConfigure(testRun.config.config);
const { status, cleanup } = await taskRunner.runDeferCleanup(testRun, 0);
return { status: await finishTaskRun(testRun, status), cleanup };
}
async function finishTaskRun(testRun, status) {
if (status === "passed")
status = testRun.failureTracker.result();
const modifiedResult = await testRun.reporter.onEnd({ status });
if (modifiedResult && modifiedResult.status)
status = modifiedResult.status;
await testRun.reporter.onExit();
return status;
}
function createGlobalSetupTasks(config) {
const tasks = [];
if (!config.configCLIOverrides.preserveOutputDir)
tasks.push(createRemoveOutputDirsTask());
tasks.push(
...createPluginSetupTasks(config),
...config.globalTeardowns.map((file) => createGlobalTeardownTask(file, config)).reverse(),
...config.globalSetups.map((file) => createGlobalSetupTask(file, config))
);
return tasks;
}
function createRunTestsTasks(config) {
return [
createPhasesTask(),
createReportBeginTask(),
...config.plugins.map((plugin) => createPluginBeginTask(plugin)),
createRunTestsTask()
];
}
function createClearCacheTask(config) {
return {
title: "clear cache",
setup: async () => {
await (0, import_util2.removeDirAndLogToConsole)(import_compilationCache.cacheDir);
for (const plugin of config.plugins)
await plugin.instance?.clearCache?.();
}
};
}
function createReportBeginTask() {
return {
title: "report begin",
setup: async (testRun) => {
testRun.reporter.onBegin?.(testRun.rootSuite);
},
teardown: async ({}) => {
}
};
}
function createPluginSetupTasks(config) {
return config.plugins.map((plugin) => ({
title: "plugin setup",
setup: async ({ reporter }) => {
if (typeof plugin.factory === "function")
plugin.instance = await plugin.factory();
else
plugin.instance = plugin.factory;
await plugin.instance?.setup?.(config.config, config.configDir, reporter);
},
teardown: async () => {
await plugin.instance?.teardown?.();
}
}));
}
function createPluginBeginTask(plugin) {
return {
title: "plugin begin",
setup: async (testRun) => {
await plugin.instance?.begin?.(testRun.rootSuite);
},
teardown: async () => {
await plugin.instance?.end?.();
}
};
}
function createGlobalSetupTask(file, config) {
let title = "global setup";
if (config.globalSetups.length > 1)
title += ` (${file})`;
let globalSetupResult;
return {
title,
setup: async ({ config: config2 }) => {
const setupHook = await (0, import_loadUtils.loadGlobalHook)(config2, file);
globalSetupResult = await setupHook(config2.config);
},
teardown: async () => {
if (typeof globalSetupResult === "function")
await globalSetupResult();
}
};
}
function createGlobalTeardownTask(file, config) {
let title = "global teardown";
if (config.globalTeardowns.length > 1)
title += ` (${file})`;
return {
title,
teardown: async ({ config: config2 }) => {
const teardownHook = await (0, import_loadUtils.loadGlobalHook)(config2, file);
await teardownHook(config2.config);
}
};
}
function createRemoveOutputDirsTask() {
return {
title: "clear output",
setup: async ({ config }) => {
const outputDirs = /* @__PURE__ */ new Set();
const projects = (0, import_projectUtils.filterProjects)(config.projects, config.cliProjectFilter);
projects.forEach((p) => outputDirs.add(p.project.outputDir));
await Promise.all(Array.from(outputDirs).map((outputDir) => (0, import_utils.removeFolders)([outputDir]).then(async ([error]) => {
if (!error)
return;
if (error.code === "EBUSY") {
const entries = await readDirAsync(outputDir).catch((e) => []);
await Promise.all(entries.map((entry) => (0, import_utils.removeFolders)([import_path.default.join(outputDir, entry)])));
} else {
throw error;
}
})));
}
};
}
function createListFilesTask() {
return {
title: "load tests",
setup: async (testRun, errors) => {
testRun.rootSuite = await (0, import_loadUtils.createRootSuite)(testRun, errors, false);
testRun.failureTracker.onRootSuite(testRun.rootSuite);
await (0, import_loadUtils.collectProjectsAndTestFiles)(testRun, false);
for (const [project, files] of testRun.projectFiles) {
const projectSuite = new import_test.Suite(project.project.name, "project");
projectSuite._fullProject = project;
testRun.rootSuite._addSuite(projectSuite);
const suites = files.map((file) => {
const title = import_path.default.relative(testRun.config.config.rootDir, file);
const suite = new import_test.Suite(title, "file");
suite.location = { file, line: 0, column: 0 };
projectSuite._addSuite(suite);
return suite;
});
testRun.projectSuites.set(project, suites);
}
}
};
}
function createLoadTask(mode, options) {
return {
title: "load tests",
setup: async (testRun, errors, softErrors) => {
await (0, import_loadUtils.collectProjectsAndTestFiles)(testRun, !!options.doNotRunDepsOutsideProjectFilter);
await (0, import_loadUtils.loadFileSuites)(testRun, mode, options.failOnLoadErrors ? errors : softErrors);
if (testRun.config.cliOnlyChanged || options.populateDependencies) {
for (const plugin of testRun.config.plugins)
await plugin.instance?.populateDependencies?.();
}
if (testRun.config.cliOnlyChanged) {
const changedFiles = await (0, import_vcs.detectChangedTestFiles)(testRun.config.cliOnlyChanged, testRun.config.configDir);
testRun.config.preOnlyTestFilters.push((test) => changedFiles.has(test.location.file));
}
testRun.rootSuite = await (0, import_loadUtils.createRootSuite)(testRun, options.failOnLoadErrors ? errors : softErrors, !!options.filterOnly);
testRun.failureTracker.onRootSuite(testRun.rootSuite);
if (options.failOnLoadErrors && !testRun.rootSuite.allTests().length && !testRun.config.cliPassWithNoTests && !testRun.config.config.shard && !testRun.config.cliOnlyChanged) {
if (testRun.config.cliArgs.length) {
throw new Error([
`No tests found.`,
`Make sure that arguments are regular expressions matching test files.`,
`You may need to escape symbols like "$" or "*" and quote the arguments.`
].join("\n"));
}
throw new Error(`No tests found`);
}
}
};
}
function createApplyRebaselinesTask() {
return {
title: "apply rebaselines",
setup: async () => {
(0, import_rebase.clearSuggestedRebaselines)();
},
teardown: async ({ config, reporter }) => {
await (0, import_rebase.applySuggestedRebaselines)(config, reporter);
}
};
}
function createPhasesTask() {
return {
title: "create phases",
setup: async (testRun) => {
let maxConcurrentTestGroups = 0;
const processed = /* @__PURE__ */ new Set();
const projectToSuite = new Map(testRun.rootSuite.suites.map((suite) => [suite._fullProject, suite]));
const allProjects = [...projectToSuite.keys()];
const teardownToSetups = (0, import_projectUtils.buildTeardownToSetupsMap)(allProjects);
const teardownToSetupsDependents = /* @__PURE__ */ new Map();
for (const [teardown, setups] of teardownToSetups) {
const closure = (0, import_projectUtils.buildDependentProjects)(setups, allProjects);
closure.delete(teardown);
teardownToSetupsDependents.set(teardown, [...closure]);
}
for (let i = 0; i < projectToSuite.size; i++) {
const phaseProjects = [];
for (const project of projectToSuite.keys()) {
if (processed.has(project))
continue;
const projectsThatShouldFinishFirst = [...project.deps, ...teardownToSetupsDependents.get(project) || []];
if (projectsThatShouldFinishFirst.find((p) => !processed.has(p)))
continue;
phaseProjects.push(project);
}
for (const project of phaseProjects)
processed.add(project);
if (phaseProjects.length) {
let testGroupsInPhase = 0;
const phase = { dispatcher: new import_dispatcher.Dispatcher(testRun.config, testRun.reporter, testRun.failureTracker), projects: [] };
testRun.phases.push(phase);
for (const project of phaseProjects) {
const projectSuite = projectToSuite.get(project);
const testGroups = (0, import_testGroups.createTestGroups)(projectSuite, testRun.config.config.workers);
phase.projects.push({ project, projectSuite, testGroups });
testGroupsInPhase += Math.min(project.workers ?? Number.MAX_SAFE_INTEGER, testGroups.length);
}
(0, import_utilsBundle.debug)("pw:test:task")(`created phase #${testRun.phases.length} with ${phase.projects.map((p) => p.project.project.name).sort()} projects, ${testGroupsInPhase} testGroups`);
maxConcurrentTestGroups = Math.max(maxConcurrentTestGroups, testGroupsInPhase);
}
}
testRun.config.config.metadata.actualWorkers = Math.min(testRun.config.config.workers, maxConcurrentTestGroups);
}
};
}
function createRunTestsTask() {
return {
title: "test suite",
setup: async ({ phases, failureTracker }) => {
const successfulProjects = /* @__PURE__ */ new Set();
const extraEnvByProjectId = /* @__PURE__ */ new Map();
const teardownToSetups = (0, import_projectUtils.buildTeardownToSetupsMap)(phases.map((phase) => phase.projects.map((p) => p.project)).flat());
for (const { dispatcher, projects } of phases) {
const phaseTestGroups = [];
for (const { project, testGroups } of projects) {
let extraEnv = {};
for (const dep of project.deps)
extraEnv = { ...extraEnv, ...extraEnvByProjectId.get(dep.id) };
for (const setup of teardownToSetups.get(project) || [])
extraEnv = { ...extraEnv, ...extraEnvByProjectId.get(setup.id) };
extraEnvByProjectId.set(project.id, extraEnv);
const hasFailedDeps = project.deps.some((p) => !successfulProjects.has(p));
if (!hasFailedDeps)
phaseTestGroups.push(...testGroups);
}
if (phaseTestGroups.length) {
await dispatcher.run(phaseTestGroups, extraEnvByProjectId);
await dispatcher.stop();
for (const [projectId, envProduced] of dispatcher.producedEnvByProjectId()) {
const extraEnv = extraEnvByProjectId.get(projectId) || {};
extraEnvByProjectId.set(projectId, { ...extraEnv, ...envProduced });
}
}
if (!failureTracker.hasWorkerErrors()) {
for (const { project, projectSuite } of projects) {
const hasFailedDeps = project.deps.some((p) => !successfulProjects.has(p));
if (!hasFailedDeps && !projectSuite.allTests().some((test) => !test.ok()))
successfulProjects.add(project);
}
}
}
},
teardown: async ({ phases }) => {
for (const { dispatcher } of phases.reverse())
await dispatcher.stop();
}
};
}
function createStartDevServerTask() {
return {
title: "start dev server",
setup: async ({ config }, errors, softErrors) => {
if (config.plugins.some((plugin) => !!plugin.devServerCleanup)) {
errors.push({ message: `DevServer is already running` });
return;
}
for (const plugin of config.plugins)
plugin.devServerCleanup = await plugin.instance?.startDevServer?.();
if (!config.plugins.some((plugin) => !!plugin.devServerCleanup))
errors.push({ message: `DevServer is not available in the package you are using. Did you mean to use component testing?` });
},
teardown: async ({ config }) => {
for (const plugin of config.plugins) {
await plugin.devServerCleanup?.();
plugin.devServerCleanup = void 0;
}
}
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
TestRun,
createApplyRebaselinesTask,
createClearCacheTask,
createGlobalSetupTasks,
createListFilesTask,
createLoadTask,
createPluginSetupTasks,
createReportBeginTask,
createRunTestsTasks,
createStartDevServerTask,
runTasks,
runTasksDeferCleanup
});
+117
View File
@@ -0,0 +1,117 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var testGroups_exports = {};
__export(testGroups_exports, {
createTestGroups: () => createTestGroups,
filterForShard: () => filterForShard
});
module.exports = __toCommonJS(testGroups_exports);
function createTestGroups(projectSuite, expectedParallelism) {
const groups = /* @__PURE__ */ new Map();
const createGroup = (test) => {
return {
workerHash: test._workerHash,
requireFile: test._requireFile,
repeatEachIndex: test.repeatEachIndex,
projectId: test._projectId,
tests: []
};
};
for (const test of projectSuite.allTests()) {
let withWorkerHash = groups.get(test._workerHash);
if (!withWorkerHash) {
withWorkerHash = /* @__PURE__ */ new Map();
groups.set(test._workerHash, withWorkerHash);
}
let withRequireFile = withWorkerHash.get(test._requireFile);
if (!withRequireFile) {
withRequireFile = {
general: createGroup(test),
parallel: /* @__PURE__ */ new Map(),
parallelWithHooks: createGroup(test)
};
withWorkerHash.set(test._requireFile, withRequireFile);
}
let insideParallel = false;
let outerMostSequentialSuite;
let hasAllHooks = false;
for (let parent = test.parent; parent; parent = parent.parent) {
if (parent._parallelMode === "serial" || parent._parallelMode === "default")
outerMostSequentialSuite = parent;
insideParallel = insideParallel || parent._parallelMode === "parallel";
hasAllHooks = hasAllHooks || parent._hooks.some((hook) => hook.type === "beforeAll" || hook.type === "afterAll");
}
if (insideParallel) {
if (hasAllHooks && !outerMostSequentialSuite) {
withRequireFile.parallelWithHooks.tests.push(test);
} else {
const key = outerMostSequentialSuite || test;
let group = withRequireFile.parallel.get(key);
if (!group) {
group = createGroup(test);
withRequireFile.parallel.set(key, group);
}
group.tests.push(test);
}
} else {
withRequireFile.general.tests.push(test);
}
}
const result = [];
for (const withWorkerHash of groups.values()) {
for (const withRequireFile of withWorkerHash.values()) {
if (withRequireFile.general.tests.length)
result.push(withRequireFile.general);
result.push(...withRequireFile.parallel.values());
const parallelWithHooksGroupSize = Math.ceil(withRequireFile.parallelWithHooks.tests.length / expectedParallelism);
let lastGroup;
for (const test of withRequireFile.parallelWithHooks.tests) {
if (!lastGroup || lastGroup.tests.length >= parallelWithHooksGroupSize) {
lastGroup = createGroup(test);
result.push(lastGroup);
}
lastGroup.tests.push(test);
}
}
}
return result;
}
function filterForShard(shard, testGroups) {
let shardableTotal = 0;
for (const group of testGroups)
shardableTotal += group.tests.length;
const shardSize = Math.floor(shardableTotal / shard.total);
const extraOne = shardableTotal - shardSize * shard.total;
const currentShard = shard.current - 1;
const from = shardSize * currentShard + Math.min(extraOne, currentShard);
const to = from + shardSize + (currentShard < extraOne ? 1 : 0);
let current = 0;
const result = /* @__PURE__ */ new Set();
for (const group of testGroups) {
if (current >= from && current < to)
result.add(group);
current += group.tests.length;
}
return result;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
createTestGroups,
filterForShard
});
+402
View File
@@ -0,0 +1,402 @@
"use strict";
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 __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);
var testRunner_exports = {};
__export(testRunner_exports, {
TestRunner: () => TestRunner,
TestRunnerEvent: () => TestRunnerEvent,
runAllTestsWithConfig: () => runAllTestsWithConfig
});
module.exports = __toCommonJS(testRunner_exports);
var import_events = __toESM(require("events"));
var import_fs = __toESM(require("fs"));
var import_path = __toESM(require("path"));
var import_server = require("playwright-core/lib/server");
var import_utils = require("playwright-core/lib/utils");
var import_configLoader = require("../common/configLoader");
var import_fsWatcher = require("../fsWatcher");
var import_teleReceiver = require("../isomorphic/teleReceiver");
var import_gitCommitInfoPlugin = require("../plugins/gitCommitInfoPlugin");
var import_webServerPlugin = require("../plugins/webServerPlugin");
var import_base = require("../reporters/base");
var import_internalReporter = require("../reporters/internalReporter");
var import_compilationCache = require("../transform/compilationCache");
var import_util = require("../util");
var import_reporters = require("./reporters");
var import_tasks = require("./tasks");
var import_lastRun = require("./lastRun");
const TestRunnerEvent = {
TestFilesChanged: "testFilesChanged",
RecoverFromStepError: "recoverFromStepError"
};
class TestRunner extends import_events.default {
constructor(configLocation, configCLIOverrides) {
super();
this._watchedProjectDirs = /* @__PURE__ */ new Set();
this._ignoredProjectOutputs = /* @__PURE__ */ new Set();
this._watchedTestDependencies = /* @__PURE__ */ new Set();
this._queue = Promise.resolve();
this._watchTestDirs = false;
this._populateDependenciesOnList = false;
this._recoverFromStepErrors = false;
this._resumeAfterStepErrors = /* @__PURE__ */ new Map();
this.configLocation = configLocation;
this._configCLIOverrides = configCLIOverrides;
this._watcher = new import_fsWatcher.Watcher((events) => {
const collector = /* @__PURE__ */ new Set();
events.forEach((f) => (0, import_compilationCache.collectAffectedTestFiles)(f.file, collector));
this.emit(TestRunnerEvent.TestFilesChanged, [...collector]);
});
}
async initialize(params) {
this._watchTestDirs = !!params.watchTestDirs;
this._populateDependenciesOnList = !!params.populateDependenciesOnList;
this._recoverFromStepErrors = !!params.recoverFromStepErrors;
}
resizeTerminal(params) {
process.stdout.columns = params.cols;
process.stdout.rows = params.rows;
process.stderr.columns = params.cols;
process.stderr.rows = params.rows;
}
hasSomeBrowsers() {
for (const browserName of ["chromium", "webkit", "firefox"]) {
try {
import_server.registry.findExecutable(browserName).executablePathOrDie("javascript");
return true;
} catch {
}
}
return false;
}
async installBrowsers() {
const executables = import_server.registry.defaultExecutables();
await import_server.registry.install(executables, false);
}
async runGlobalSetup(userReporters) {
await this.runGlobalTeardown();
const reporter = new import_internalReporter.InternalReporter(userReporters);
const config = await this._loadConfigOrReportError(reporter, this._configCLIOverrides);
if (!config)
return { status: "failed" };
const { status, cleanup } = await (0, import_tasks.runTasksDeferCleanup)(new import_tasks.TestRun(config, reporter), [
...(0, import_tasks.createGlobalSetupTasks)(config)
]);
if (status !== "passed")
await cleanup();
else
this._globalSetup = { cleanup };
return { status };
}
async runGlobalTeardown() {
const globalSetup = this._globalSetup;
const status = await globalSetup?.cleanup();
this._globalSetup = void 0;
return { status };
}
async startDevServer(userReporter, mode) {
await this.stopDevServer();
const reporter = new import_internalReporter.InternalReporter([userReporter]);
const config = await this._loadConfigOrReportError(reporter);
if (!config)
return { status: "failed" };
const { status, cleanup } = await (0, import_tasks.runTasksDeferCleanup)(new import_tasks.TestRun(config, reporter), [
...(0, import_tasks.createPluginSetupTasks)(config),
(0, import_tasks.createLoadTask)(mode, { failOnLoadErrors: true, filterOnly: false }),
(0, import_tasks.createStartDevServerTask)()
]);
if (status !== "passed")
await cleanup();
else
this._devServer = { cleanup };
return { status };
}
async stopDevServer() {
const devServer = this._devServer;
const status = await devServer?.cleanup();
this._devServer = void 0;
return { status };
}
async clearCache(userReporter) {
const reporter = new import_internalReporter.InternalReporter(userReporter ? [userReporter] : []);
const config = await this._loadConfigOrReportError(reporter);
if (!config)
return { status: "failed" };
const status = await (0, import_tasks.runTasks)(new import_tasks.TestRun(config, reporter), [
...(0, import_tasks.createPluginSetupTasks)(config),
(0, import_tasks.createClearCacheTask)(config)
]);
return { status };
}
async listFiles(userReporter, projects) {
const reporter = new import_internalReporter.InternalReporter([userReporter]);
const config = await this._loadConfigOrReportError(reporter);
if (!config)
return { status: "failed" };
config.cliProjectFilter = projects?.length ? projects : void 0;
const status = await (0, import_tasks.runTasks)(new import_tasks.TestRun(config, reporter), [
(0, import_tasks.createListFilesTask)(),
(0, import_tasks.createReportBeginTask)()
]);
return { status };
}
async listTests(userReporter, params) {
let result;
this._queue = this._queue.then(async () => {
const { config, status } = await this._innerListTests(userReporter, params);
if (config)
await this._updateWatchedDirs(config);
result = { status };
}).catch(printInternalError);
await this._queue;
return result;
}
async _innerListTests(userReporter, params) {
const overrides = {
...this._configCLIOverrides,
repeatEach: 1,
retries: 0
};
const reporter = new import_internalReporter.InternalReporter([userReporter]);
const config = await this._loadConfigOrReportError(reporter, overrides);
if (!config)
return { status: "failed" };
config.cliArgs = params.locations || [];
config.cliGrep = params.grep;
config.cliGrepInvert = params.grepInvert;
config.cliProjectFilter = params.projects?.length ? params.projects : void 0;
config.cliListOnly = true;
const status = await (0, import_tasks.runTasks)(new import_tasks.TestRun(config, reporter), [
(0, import_tasks.createLoadTask)("out-of-process", { failOnLoadErrors: false, filterOnly: false, populateDependencies: this._populateDependenciesOnList }),
(0, import_tasks.createReportBeginTask)()
]);
return { config, status };
}
async _updateWatchedDirs(config) {
this._watchedProjectDirs = /* @__PURE__ */ new Set();
this._ignoredProjectOutputs = /* @__PURE__ */ new Set();
for (const p of config.projects) {
this._watchedProjectDirs.add(p.project.testDir);
this._ignoredProjectOutputs.add(p.project.outputDir);
}
const result = await resolveCtDirs(config);
if (result) {
this._watchedProjectDirs.add(result.templateDir);
this._ignoredProjectOutputs.add(result.outDir);
}
if (this._watchTestDirs)
await this._updateWatcher(false);
}
async _updateWatcher(reportPending) {
await this._watcher.update([...this._watchedProjectDirs, ...this._watchedTestDependencies], [...this._ignoredProjectOutputs], reportPending);
}
async runTests(userReporter, params) {
let result = { status: "passed" };
this._queue = this._queue.then(async () => {
result = await this._innerRunTests(userReporter, params).catch((e) => {
printInternalError(e);
return { status: "failed" };
});
});
await this._queue;
return result;
}
async _innerRunTests(userReporter, params) {
await this.stopTests();
const overrides = {
...this._configCLIOverrides,
repeatEach: 1,
retries: 0,
preserveOutputDir: true,
reporter: params.reporters ? params.reporters.map((r) => [r]) : void 0,
use: {
...this._configCLIOverrides.use,
...params.trace === "on" ? { trace: { mode: "on", sources: false, _live: true } } : {},
...params.trace === "off" ? { trace: "off" } : {},
...params.video === "on" || params.video === "off" ? { video: params.video } : {},
...params.headed !== void 0 ? { headless: !params.headed } : {},
_optionContextReuseMode: params.reuseContext ? "when-possible" : void 0,
_optionConnectOptions: params.connectWsEndpoint ? { wsEndpoint: params.connectWsEndpoint } : void 0
},
...params.updateSnapshots ? { updateSnapshots: params.updateSnapshots } : {},
...params.updateSourceMethod ? { updateSourceMethod: params.updateSourceMethod } : {},
...params.workers ? { workers: params.workers } : {}
};
if (params.trace === "on")
process.env.PW_LIVE_TRACE_STACKS = "1";
else
process.env.PW_LIVE_TRACE_STACKS = void 0;
const config = await this._loadConfigOrReportError(new import_internalReporter.InternalReporter([userReporter]), overrides);
if (!config)
return { status: "failed" };
config.cliListOnly = false;
config.cliPassWithNoTests = true;
config.cliArgs = params.locations || [];
config.cliGrep = params.grep;
config.cliGrepInvert = params.grepInvert;
config.cliProjectFilter = params.projects?.length ? params.projects : void 0;
config.preOnlyTestFilters = [];
if (params.testIds) {
const testIdSet = new Set(params.testIds);
config.preOnlyTestFilters.push((test) => testIdSet.has(test.id));
}
const configReporters = await (0, import_reporters.createReporters)(config, "test", true);
const reporter = new import_internalReporter.InternalReporter([...configReporters, userReporter]);
const stop = new import_utils.ManualPromise();
const tasks = [
(0, import_tasks.createApplyRebaselinesTask)(),
(0, import_tasks.createLoadTask)("out-of-process", { filterOnly: true, failOnLoadErrors: false, doNotRunDepsOutsideProjectFilter: true }),
...(0, import_tasks.createRunTestsTasks)(config)
];
const testRun = new import_tasks.TestRun(config, reporter);
testRun.failureTracker.setRecoverFromStepErrorHandler(this._recoverFromStepError.bind(this));
const run = (0, import_tasks.runTasks)(testRun, tasks, 0, stop).then(async (status) => {
this._testRun = void 0;
return status;
});
this._testRun = { run, stop };
return { status: await run };
}
async _recoverFromStepError(stepId, error) {
if (!this._recoverFromStepErrors)
return { stepId, status: "failed" };
const recoveryPromise = new import_utils.ManualPromise();
this._resumeAfterStepErrors.set(stepId, recoveryPromise);
if (!error?.message || !error?.location)
return { stepId, status: "failed" };
this.emit(TestRunnerEvent.RecoverFromStepError, stepId, error.message, error.location);
const recoveredResult = await recoveryPromise;
if (recoveredResult.stepId !== stepId)
return { stepId, status: "failed" };
return recoveredResult;
}
async resumeAfterStepError(params) {
const recoveryPromise = this._resumeAfterStepErrors.get(params.stepId);
if (recoveryPromise)
recoveryPromise.resolve(params);
}
async watch(fileNames) {
this._watchedTestDependencies = /* @__PURE__ */ new Set();
for (const fileName of fileNames) {
this._watchedTestDependencies.add(fileName);
(0, import_compilationCache.dependenciesForTestFile)(fileName).forEach((file) => this._watchedTestDependencies.add(file));
}
await this._updateWatcher(true);
}
async findRelatedTestFiles(files, userReporter) {
const errorReporter = (0, import_reporters.createErrorCollectingReporter)(import_base.internalScreen);
const reporter = new import_internalReporter.InternalReporter(userReporter ? [userReporter, errorReporter] : [errorReporter]);
const config = await this._loadConfigOrReportError(reporter);
if (!config)
return { errors: errorReporter.errors(), testFiles: [] };
const status = await (0, import_tasks.runTasks)(new import_tasks.TestRun(config, reporter), [
...(0, import_tasks.createPluginSetupTasks)(config),
(0, import_tasks.createLoadTask)("out-of-process", { failOnLoadErrors: true, filterOnly: false, populateDependencies: true })
]);
if (status !== "passed")
return { errors: errorReporter.errors(), testFiles: [] };
return { testFiles: (0, import_compilationCache.affectedTestFiles)(files) };
}
async stopTests() {
this._testRun?.stop?.resolve();
await this._testRun?.run;
this._resumeAfterStepErrors.clear();
}
async closeGracefully() {
(0, import_utils.gracefullyProcessExitDoNotHang)(0);
}
async _loadConfig(overrides) {
try {
const config = await (0, import_configLoader.loadConfig)(this.configLocation, overrides);
if (!this._plugins) {
(0, import_webServerPlugin.webServerPluginsForConfig)(config).forEach((p) => config.plugins.push({ factory: p }));
(0, import_gitCommitInfoPlugin.addGitCommitInfoPlugin)(config);
this._plugins = config.plugins || [];
} else {
config.plugins.splice(0, config.plugins.length, ...this._plugins);
}
return { config };
} catch (e) {
return { config: null, error: (0, import_util.serializeError)(e) };
}
}
async _loadConfigOrReportError(reporter, overrides) {
const { config, error } = await this._loadConfig(overrides);
if (config)
return config;
reporter.onConfigure(import_teleReceiver.baseFullConfig);
reporter.onError(error);
await reporter.onEnd({ status: "failed" });
await reporter.onExit();
return null;
}
}
function printInternalError(e) {
console.error("Internal error:", e);
}
async function resolveCtDirs(config) {
const use = config.config.projects[0].use;
const relativeTemplateDir = use.ctTemplateDir || "playwright";
const templateDir = await import_fs.default.promises.realpath(import_path.default.normalize(import_path.default.join(config.configDir, relativeTemplateDir))).catch(() => void 0);
if (!templateDir)
return null;
const outDir = use.ctCacheDir ? import_path.default.resolve(config.configDir, use.ctCacheDir) : import_path.default.resolve(templateDir, ".cache");
return {
outDir,
templateDir
};
}
async function runAllTestsWithConfig(config) {
const listOnly = config.cliListOnly;
(0, import_gitCommitInfoPlugin.addGitCommitInfoPlugin)(config);
(0, import_webServerPlugin.webServerPluginsForConfig)(config).forEach((p) => config.plugins.push({ factory: p }));
const reporters = await (0, import_reporters.createReporters)(config, listOnly ? "list" : "test", false);
const lastRun = new import_lastRun.LastRunReporter(config);
if (config.cliLastFailed)
await lastRun.filterLastFailed();
const reporter = new import_internalReporter.InternalReporter([...reporters, lastRun]);
const tasks = listOnly ? [
(0, import_tasks.createLoadTask)("in-process", { failOnLoadErrors: true, filterOnly: false }),
(0, import_tasks.createReportBeginTask)()
] : [
(0, import_tasks.createApplyRebaselinesTask)(),
...(0, import_tasks.createGlobalSetupTasks)(config),
(0, import_tasks.createLoadTask)("in-process", { filterOnly: true, failOnLoadErrors: true }),
...(0, import_tasks.createRunTestsTasks)(config)
];
const status = await (0, import_tasks.runTasks)(new import_tasks.TestRun(config, reporter), tasks, config.config.globalTimeout);
await new Promise((resolve) => process.stdout.write("", () => resolve()));
await new Promise((resolve) => process.stderr.write("", () => resolve()));
return status;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
TestRunner,
TestRunnerEvent,
runAllTestsWithConfig
});
+270
View File
@@ -0,0 +1,270 @@
"use strict";
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 __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);
var testServer_exports = {};
__export(testServer_exports, {
TestRunnerEvent: () => TestRunnerEvent,
TestServerDispatcher: () => TestServerDispatcher,
runTestServer: () => runTestServer,
runUIMode: () => runUIMode
});
module.exports = __toCommonJS(testServer_exports);
var import_util = __toESM(require("util"));
var import_server = require("playwright-core/lib/server");
var import_utils = require("playwright-core/lib/utils");
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
var import_configLoader = require("../common/configLoader");
var import_list = __toESM(require("../reporters/list"));
var import_reporters = require("./reporters");
var import_sigIntWatcher = require("./sigIntWatcher");
var import_testRunner = require("./testRunner");
const originalDebugLog = import_utilsBundle.debug.log;
const originalStdoutWrite = process.stdout.write;
const originalStderrWrite = process.stderr.write;
class TestServer {
constructor(configLocation, configCLIOverrides) {
this._configLocation = configLocation;
this._configCLIOverrides = configCLIOverrides;
}
async start(options) {
this._dispatcher = new TestServerDispatcher(this._configLocation, this._configCLIOverrides);
return await (0, import_server.startTraceViewerServer)({ ...options, transport: this._dispatcher.transport });
}
async stop() {
await this._dispatcher?._setInterceptStdio(false);
await this._dispatcher?.runGlobalTeardown();
}
}
const TestRunnerEvent = {
TestFilesChanged: "testFilesChanged",
RecoverFromStepError: "recoverFromStepError"
};
class TestServerDispatcher {
constructor(configLocation, configCLIOverrides) {
this._serializer = require.resolve("./uiModeReporter");
this._closeOnDisconnect = false;
this._testRunner = new import_testRunner.TestRunner(configLocation, configCLIOverrides);
this.transport = {
onconnect: () => {
},
dispatch: (method, params) => this[method](params),
onclose: () => {
if (this._closeOnDisconnect)
(0, import_utils.gracefullyProcessExitDoNotHang)(0);
}
};
this._dispatchEvent = (method, params) => this.transport.sendEvent?.(method, params);
this._testRunner.on(TestRunnerEvent.TestFilesChanged, (testFiles) => this._dispatchEvent("testFilesChanged", { testFiles }));
this._testRunner.on(TestRunnerEvent.RecoverFromStepError, (stepId, message, location) => this._dispatchEvent("recoverFromStepError", { stepId, message, location }));
}
async _wireReporter(messageSink) {
return await (0, import_reporters.createReporterForTestServer)(this._serializer, messageSink);
}
async _collectingReporter() {
const report = [];
return {
reporter: await (0, import_reporters.createReporterForTestServer)(this._serializer, (e) => report.push(e)),
report
};
}
async initialize(params) {
this._serializer = params.serializer || require.resolve("./uiModeReporter");
this._closeOnDisconnect = !!params.closeOnDisconnect;
await this._setInterceptStdio(!!params.interceptStdio);
await this._testRunner.initialize({
watchTestDirs: !!params.watchTestDirs,
populateDependenciesOnList: !!params.populateDependenciesOnList,
recoverFromStepErrors: !!params.recoverFromStepErrors
});
}
async ping() {
}
async open(params) {
if ((0, import_utils.isUnderTest)())
return;
(0, import_utilsBundle.open)("vscode://file/" + params.location.file + ":" + params.location.line).catch((e) => console.error(e));
}
async resizeTerminal(params) {
this._testRunner.resizeTerminal(params);
}
async checkBrowsers() {
return { hasBrowsers: this._testRunner.hasSomeBrowsers() };
}
async installBrowsers() {
await this._testRunner.installBrowsers();
}
async runGlobalSetup(params) {
await this.runGlobalTeardown();
const { reporter, report } = await this._collectingReporter();
this._globalSetupReport = report;
const { status } = await this._testRunner.runGlobalSetup([reporter, new import_list.default()]);
return { report, status };
}
async runGlobalTeardown() {
const { status } = await this._testRunner.runGlobalTeardown();
const report = this._globalSetupReport || [];
this._globalSetupReport = void 0;
return { status, report };
}
async startDevServer(params) {
await this.stopDevServer({});
const { reporter, report } = await this._collectingReporter();
const { status } = await this._testRunner.startDevServer(reporter, "out-of-process");
return { report, status };
}
async stopDevServer(params) {
const { status } = await this._testRunner.stopDevServer();
const report = this._devServerReport || [];
this._devServerReport = void 0;
return { status, report };
}
async clearCache(params) {
await this._testRunner.clearCache();
}
async listFiles(params) {
const { reporter, report } = await this._collectingReporter();
const { status } = await this._testRunner.listFiles(reporter, params.projects);
return { report, status };
}
async listTests(params) {
const { reporter, report } = await this._collectingReporter();
const { status } = await this._testRunner.listTests(reporter, params);
return { report, status };
}
async runTests(params) {
const wireReporter = await this._wireReporter((e) => this._dispatchEvent("report", e));
const { status } = await this._testRunner.runTests(wireReporter, params);
return { status };
}
async resumeAfterStepError(params) {
await this._testRunner.resumeAfterStepError(params);
}
async watch(params) {
await this._testRunner.watch(params.fileNames);
}
async findRelatedTestFiles(params) {
return this._testRunner.findRelatedTestFiles(params.files);
}
async stopTests() {
await this._testRunner.stopTests();
}
async _setInterceptStdio(intercept) {
if (process.env.PWTEST_DEBUG)
return;
if (intercept) {
if (import_utilsBundle.debug.log === originalDebugLog) {
import_utilsBundle.debug.log = (...args) => {
const string = import_util.default.format(...args) + "\n";
return originalStderrWrite.apply(process.stderr, [string]);
};
}
const stdoutWrite = (chunk) => {
this._dispatchEvent("stdio", chunkToPayload("stdout", chunk));
return true;
};
const stderrWrite = (chunk) => {
this._dispatchEvent("stdio", chunkToPayload("stderr", chunk));
return true;
};
process.stdout.write = stdoutWrite;
process.stderr.write = stderrWrite;
} else {
import_utilsBundle.debug.log = originalDebugLog;
process.stdout.write = originalStdoutWrite;
process.stderr.write = originalStderrWrite;
}
}
async closeGracefully() {
await this._testRunner.closeGracefully();
}
}
async function runUIMode(configFile, configCLIOverrides, options) {
const configLocation = (0, import_configLoader.resolveConfigLocation)(configFile);
return await innerRunTestServer(configLocation, configCLIOverrides, options, async (server, cancelPromise) => {
await (0, import_server.installRootRedirect)(server, [], { ...options, webApp: "uiMode.html" });
if (options.host !== void 0 || options.port !== void 0) {
await (0, import_server.openTraceInBrowser)(server.urlPrefix("human-readable"));
} else {
const channel = await installedChromiumChannelForUI(configLocation, configCLIOverrides);
const page = await (0, import_server.openTraceViewerApp)(server.urlPrefix("precise"), "chromium", {
headless: (0, import_utils.isUnderTest)() && process.env.PWTEST_HEADED_FOR_TEST !== "1",
persistentContextOptions: {
handleSIGINT: false,
channel
}
});
page.on("close", () => cancelPromise.resolve());
}
});
}
async function installedChromiumChannelForUI(configLocation, configCLIOverrides) {
const config = await (0, import_configLoader.loadConfig)(configLocation, configCLIOverrides).catch((e) => null);
if (!config)
return void 0;
if (config.projects.some((p) => (!p.project.use.browserName || p.project.use.browserName === "chromium") && !p.project.use.channel))
return void 0;
for (const channel of ["chromium", "chrome", "msedge"]) {
if (config.projects.some((p) => p.project.use.channel === channel))
return channel;
}
return void 0;
}
async function runTestServer(configFile, configCLIOverrides, options) {
const configLocation = (0, import_configLoader.resolveConfigLocation)(configFile);
return await innerRunTestServer(configLocation, configCLIOverrides, options, async (server) => {
console.log("Listening on " + server.urlPrefix("precise").replace("http:", "ws:") + "/" + server.wsGuid());
});
}
async function innerRunTestServer(configLocation, configCLIOverrides, options, openUI) {
const testServer = new TestServer(configLocation, configCLIOverrides);
const cancelPromise = new import_utils.ManualPromise();
const sigintWatcher = new import_sigIntWatcher.SigIntWatcher();
process.stdin.on("close", () => (0, import_utils.gracefullyProcessExitDoNotHang)(0));
void sigintWatcher.promise().then(() => cancelPromise.resolve());
try {
const server = await testServer.start(options);
await openUI(server, cancelPromise);
await cancelPromise;
} finally {
await testServer.stop();
sigintWatcher.disarm();
}
return sigintWatcher.hadSignal() ? "interrupted" : "passed";
}
function chunkToPayload(type, chunk) {
if (chunk instanceof Uint8Array)
return { type, buffer: chunk.toString("base64") };
return { type, text: chunk };
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
TestRunnerEvent,
TestServerDispatcher,
runTestServer,
runUIMode
});
+30
View File
@@ -0,0 +1,30 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var uiModeReporter_exports = {};
__export(uiModeReporter_exports, {
default: () => uiModeReporter_default
});
module.exports = __toCommonJS(uiModeReporter_exports);
var import_teleEmitter = require("../reporters/teleEmitter");
class UIModeReporter extends import_teleEmitter.TeleReporterEmitter {
constructor(options) {
super(options._send, { omitBuffers: true });
}
}
var uiModeReporter_default = UIModeReporter;
+72
View File
@@ -0,0 +1,72 @@
"use strict";
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 __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);
var vcs_exports = {};
__export(vcs_exports, {
detectChangedTestFiles: () => detectChangedTestFiles
});
module.exports = __toCommonJS(vcs_exports);
var import_child_process = __toESM(require("child_process"));
var import_path = __toESM(require("path"));
var import_compilationCache = require("../transform/compilationCache");
async function detectChangedTestFiles(baseCommit, configDir) {
function gitFileList(command) {
try {
return import_child_process.default.execSync(
`git ${command}`,
{ encoding: "utf-8", stdio: "pipe", cwd: configDir }
).split("\n").filter(Boolean);
} catch (_error) {
const error = _error;
const unknownRevision = error.output.some((line) => line?.includes("unknown revision"));
if (unknownRevision) {
const isShallowClone = import_child_process.default.execSync("git rev-parse --is-shallow-repository", { encoding: "utf-8", stdio: "pipe", cwd: configDir }).trim() === "true";
if (isShallowClone) {
throw new Error([
`The repository is a shallow clone and does not have '${baseCommit}' available locally.`,
`Note that GitHub Actions checkout is shallow by default: https://github.com/actions/checkout`
].join("\n"));
}
}
throw new Error([
`Cannot detect changed files for --only-changed mode:`,
`git ${command}`,
"",
...error.output
].join("\n"));
}
}
const untrackedFiles = gitFileList(`ls-files --others --exclude-standard`).map((file) => import_path.default.join(configDir, file));
const [gitRoot] = gitFileList("rev-parse --show-toplevel");
const trackedFilesWithChanges = gitFileList(`diff ${baseCommit} --name-only`).map((file) => import_path.default.join(gitRoot, file));
return new Set((0, import_compilationCache.affectedTestFiles)([...untrackedFiles, ...trackedFilesWithChanges]));
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
detectChangedTestFiles
});
+447
View File
@@ -0,0 +1,447 @@
"use strict";
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 __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);
var watchMode_exports = {};
__export(watchMode_exports, {
runWatchModeLoop: () => runWatchModeLoop
});
module.exports = __toCommonJS(watchMode_exports);
var import_fs = __toESM(require("fs"));
var import_path = __toESM(require("path"));
var import_readline = __toESM(require("readline"));
var import_stream = require("stream");
var import_playwrightServer = require("playwright-core/lib/remote/playwrightServer");
var import_utils = require("playwright-core/lib/utils");
var import_utils2 = require("playwright-core/lib/utils");
var import_base = require("../reporters/base");
var import_utilsBundle = require("../utilsBundle");
var import_testServer = require("./testServer");
var import_teleSuiteUpdater = require("../isomorphic/teleSuiteUpdater");
var import_testServerConnection = require("../isomorphic/testServerConnection");
var import_util = require("../util");
var import_babelBundle = require("../transform/babelBundle");
class InMemoryTransport extends import_stream.EventEmitter {
constructor(send) {
super();
this._send = send;
}
close() {
this.emit("close");
}
onclose(listener) {
this.on("close", listener);
}
onerror(listener) {
}
onmessage(listener) {
this.on("message", listener);
}
onopen(listener) {
this.on("open", listener);
}
send(data) {
this._send(data);
}
}
async function runWatchModeLoop(configLocation, initialOptions) {
const options = { ...initialOptions };
let bufferMode = false;
const testServerDispatcher = new import_testServer.TestServerDispatcher(configLocation, {});
const transport = new InMemoryTransport(
async (data) => {
const { id, method, params } = JSON.parse(data);
try {
const result2 = await testServerDispatcher.transport.dispatch(method, params);
transport.emit("message", JSON.stringify({ id, result: result2 }));
} catch (e) {
transport.emit("message", JSON.stringify({ id, error: String(e) }));
}
}
);
testServerDispatcher.transport.sendEvent = (method, params) => {
transport.emit("message", JSON.stringify({ method, params }));
};
const testServerConnection = new import_testServerConnection.TestServerConnection(transport);
transport.emit("open");
const teleSuiteUpdater = new import_teleSuiteUpdater.TeleSuiteUpdater({ pathSeparator: import_path.default.sep, onUpdate() {
} });
const dirtyTestFiles = /* @__PURE__ */ new Set();
const dirtyTestIds = /* @__PURE__ */ new Set();
let onDirtyTests = new import_utils.ManualPromise();
let queue = Promise.resolve();
const changedFiles = /* @__PURE__ */ new Set();
testServerConnection.onTestFilesChanged(({ testFiles }) => {
testFiles.forEach((file) => changedFiles.add(file));
queue = queue.then(async () => {
if (changedFiles.size === 0)
return;
const { report: report2 } = await testServerConnection.listTests({ locations: options.files, projects: options.projects, grep: options.grep });
teleSuiteUpdater.processListReport(report2);
for (const test of teleSuiteUpdater.rootSuite.allTests()) {
if (changedFiles.has(test.location.file)) {
dirtyTestFiles.add(test.location.file);
dirtyTestIds.add(test.id);
}
}
changedFiles.clear();
if (dirtyTestIds.size > 0) {
onDirtyTests.resolve("changed");
onDirtyTests = new import_utils.ManualPromise();
}
});
});
testServerConnection.onReport((report2) => teleSuiteUpdater.processTestReportEvent(report2));
testServerConnection.onRecoverFromStepError(({ stepId, message, location }) => {
process.stdout.write(`
Test error occurred.
`);
process.stdout.write("\n" + createErrorCodeframe(message, location) + "\n");
process.stdout.write(`
${import_utils2.colors.dim("Try recovering from the error. Press")} ${import_utils2.colors.bold("c")} ${import_utils2.colors.dim("to continue or")} ${import_utils2.colors.bold("t")} ${import_utils2.colors.dim("to throw the error")}
`);
readKeyPress((text) => {
if (text === "c") {
process.stdout.write(`
${import_utils2.colors.dim("Continuing after recovery...")}
`);
testServerConnection.resumeAfterStepError({ stepId, status: "recovered", value: void 0 }).catch(() => {
});
} else if (text === "t") {
process.stdout.write(`
${import_utils2.colors.dim("Throwing error...")}
`);
testServerConnection.resumeAfterStepError({ stepId, status: "failed" }).catch(() => {
});
}
return text;
});
});
await testServerConnection.initialize({
interceptStdio: false,
watchTestDirs: true,
populateDependenciesOnList: true,
recoverFromStepErrors: !process.env.PWTEST_RECOVERY_DISABLED
});
await testServerConnection.runGlobalSetup({});
const { report } = await testServerConnection.listTests({});
teleSuiteUpdater.processListReport(report);
const projectNames = teleSuiteUpdater.rootSuite.suites.map((s) => s.title);
let lastRun = { type: "regular" };
let result = "passed";
while (true) {
if (bufferMode)
printBufferPrompt(dirtyTestFiles, teleSuiteUpdater.config.rootDir);
else
printPrompt();
const waitForCommand = readCommand();
const command = await Promise.race([
onDirtyTests,
waitForCommand.result
]);
if (command === "changed")
waitForCommand.dispose();
if (bufferMode && command === "changed")
continue;
const shouldRunChangedFiles = bufferMode ? command === "run" : command === "changed";
if (shouldRunChangedFiles) {
if (dirtyTestIds.size === 0)
continue;
const testIds = [...dirtyTestIds];
dirtyTestIds.clear();
dirtyTestFiles.clear();
await runTests(options, testServerConnection, { testIds, title: "files changed" });
lastRun = { type: "changed", dirtyTestIds: testIds };
continue;
}
if (command === "run") {
await runTests(options, testServerConnection);
lastRun = { type: "regular" };
continue;
}
if (command === "project") {
const { selectedProjects } = await import_utilsBundle.enquirer.prompt({
type: "multiselect",
name: "selectedProjects",
message: "Select projects",
choices: projectNames
}).catch(() => ({ selectedProjects: null }));
if (!selectedProjects)
continue;
options.projects = selectedProjects.length ? selectedProjects : void 0;
await runTests(options, testServerConnection);
lastRun = { type: "regular" };
continue;
}
if (command === "file") {
const { filePattern } = await import_utilsBundle.enquirer.prompt({
type: "text",
name: "filePattern",
message: "Input filename pattern (regex)"
}).catch(() => ({ filePattern: null }));
if (filePattern === null)
continue;
if (filePattern.trim())
options.files = filePattern.split(" ");
else
options.files = void 0;
await runTests(options, testServerConnection);
lastRun = { type: "regular" };
continue;
}
if (command === "grep") {
const { testPattern } = await import_utilsBundle.enquirer.prompt({
type: "text",
name: "testPattern",
message: "Input test name pattern (regex)"
}).catch(() => ({ testPattern: null }));
if (testPattern === null)
continue;
if (testPattern.trim())
options.grep = testPattern;
else
options.grep = void 0;
await runTests(options, testServerConnection);
lastRun = { type: "regular" };
continue;
}
if (command === "failed") {
const failedTestIds = teleSuiteUpdater.rootSuite.allTests().filter((t) => !t.ok()).map((t) => t.id);
await runTests({}, testServerConnection, { title: "running failed tests", testIds: failedTestIds });
lastRun = { type: "failed", failedTestIds };
continue;
}
if (command === "repeat") {
if (lastRun.type === "regular") {
await runTests(options, testServerConnection, { title: "re-running tests" });
continue;
} else if (lastRun.type === "changed") {
await runTests(options, testServerConnection, { title: "re-running tests", testIds: lastRun.dirtyTestIds });
} else if (lastRun.type === "failed") {
await runTests({}, testServerConnection, { title: "re-running tests", testIds: lastRun.failedTestIds });
}
continue;
}
if (command === "toggle-show-browser") {
await toggleShowBrowser();
continue;
}
if (command === "toggle-buffer-mode") {
bufferMode = !bufferMode;
continue;
}
if (command === "exit")
break;
if (command === "interrupted") {
result = "interrupted";
break;
}
}
const teardown = await testServerConnection.runGlobalTeardown({});
return result === "passed" ? teardown.status : result;
}
function readKeyPress(handler) {
const promise = new import_utils.ManualPromise();
const rl = import_readline.default.createInterface({ input: process.stdin, escapeCodeTimeout: 50 });
import_readline.default.emitKeypressEvents(process.stdin, rl);
if (process.stdin.isTTY)
process.stdin.setRawMode(true);
const listener = import_utils.eventsHelper.addEventListener(process.stdin, "keypress", (text, key) => {
const result = handler(text, key);
if (result)
promise.resolve(result);
});
const dispose = () => {
import_utils.eventsHelper.removeEventListeners([listener]);
rl.close();
if (process.stdin.isTTY)
process.stdin.setRawMode(false);
};
void promise.finally(dispose);
return { result: promise, dispose };
}
const isInterrupt = (text, key) => text === "" || text === "\x1B" || key && key.name === "escape" || key && key.ctrl && key.name === "c";
async function runTests(watchOptions, testServerConnection, options) {
printConfiguration(watchOptions, options?.title);
const waitForDone = readKeyPress((text, key) => {
if (isInterrupt(text, key)) {
testServerConnection.stopTestsNoReply({});
return "done";
}
});
await testServerConnection.runTests({
grep: watchOptions.grep,
testIds: options?.testIds,
locations: watchOptions?.files,
projects: watchOptions.projects,
connectWsEndpoint,
reuseContext: connectWsEndpoint ? true : void 0,
workers: connectWsEndpoint ? 1 : void 0,
headed: connectWsEndpoint ? true : void 0
}).finally(() => waitForDone.dispose());
}
function readCommand() {
return readKeyPress((text, key) => {
if (isInterrupt(text, key))
return "interrupted";
if (process.platform !== "win32" && key && key.ctrl && key.name === "z") {
process.kill(process.ppid, "SIGTSTP");
process.kill(process.pid, "SIGTSTP");
}
const name = key?.name;
if (name === "q")
return "exit";
if (name === "h") {
process.stdout.write(`${(0, import_base.separator)(import_base.terminalScreen)}
Run tests
${import_utils2.colors.bold("enter")} ${import_utils2.colors.dim("run tests")}
${import_utils2.colors.bold("f")} ${import_utils2.colors.dim("run failed tests")}
${import_utils2.colors.bold("r")} ${import_utils2.colors.dim("repeat last run")}
${import_utils2.colors.bold("q")} ${import_utils2.colors.dim("quit")}
Change settings
${import_utils2.colors.bold("c")} ${import_utils2.colors.dim("set project")}
${import_utils2.colors.bold("p")} ${import_utils2.colors.dim("set file filter")}
${import_utils2.colors.bold("t")} ${import_utils2.colors.dim("set title filter")}
${import_utils2.colors.bold("s")} ${import_utils2.colors.dim("toggle show & reuse the browser")}
${import_utils2.colors.bold("b")} ${import_utils2.colors.dim("toggle buffer mode")}
`);
return;
}
switch (name) {
case "return":
return "run";
case "r":
return "repeat";
case "c":
return "project";
case "p":
return "file";
case "t":
return "grep";
case "f":
return "failed";
case "s":
return "toggle-show-browser";
case "b":
return "toggle-buffer-mode";
}
});
}
let showBrowserServer;
let connectWsEndpoint = void 0;
let seq = 1;
function printConfiguration(options, title) {
const packageManagerCommand = (0, import_utils.getPackageManagerExecCommand)();
const tokens = [];
tokens.push(`${packageManagerCommand} playwright test`);
if (options.projects)
tokens.push(...options.projects.map((p) => import_utils2.colors.blue(`--project ${p}`)));
if (options.grep)
tokens.push(import_utils2.colors.red(`--grep ${options.grep}`));
if (options.files)
tokens.push(...options.files.map((a) => import_utils2.colors.bold(a)));
if (title)
tokens.push(import_utils2.colors.dim(`(${title})`));
tokens.push(import_utils2.colors.dim(`#${seq++}`));
const lines = [];
const sep = (0, import_base.separator)(import_base.terminalScreen);
lines.push("\x1Bc" + sep);
lines.push(`${tokens.join(" ")}`);
lines.push(`${import_utils2.colors.dim("Show & reuse browser:")} ${import_utils2.colors.bold(showBrowserServer ? "on" : "off")}`);
process.stdout.write(lines.join("\n"));
}
function printBufferPrompt(dirtyTestFiles, rootDir) {
const sep = (0, import_base.separator)(import_base.terminalScreen);
process.stdout.write("\x1Bc");
process.stdout.write(`${sep}
`);
if (dirtyTestFiles.size === 0) {
process.stdout.write(`${import_utils2.colors.dim("Waiting for file changes. Press")} ${import_utils2.colors.bold("q")} ${import_utils2.colors.dim("to quit or")} ${import_utils2.colors.bold("h")} ${import_utils2.colors.dim("for more options.")}
`);
return;
}
process.stdout.write(`${import_utils2.colors.dim(`${dirtyTestFiles.size} test ${dirtyTestFiles.size === 1 ? "file" : "files"} changed:`)}
`);
for (const file of dirtyTestFiles)
process.stdout.write(` \xB7 ${import_path.default.relative(rootDir, file)}
`);
process.stdout.write(`
${import_utils2.colors.dim(`Press`)} ${import_utils2.colors.bold("enter")} ${import_utils2.colors.dim("to run")}, ${import_utils2.colors.bold("q")} ${import_utils2.colors.dim("to quit or")} ${import_utils2.colors.bold("h")} ${import_utils2.colors.dim("for more options.")}
`);
}
function printPrompt() {
const sep = (0, import_base.separator)(import_base.terminalScreen);
process.stdout.write(`
${sep}
${import_utils2.colors.dim("Waiting for file changes. Press")} ${import_utils2.colors.bold("enter")} ${import_utils2.colors.dim("to run tests")}, ${import_utils2.colors.bold("q")} ${import_utils2.colors.dim("to quit or")} ${import_utils2.colors.bold("h")} ${import_utils2.colors.dim("for more options.")}
`);
}
async function toggleShowBrowser() {
if (!showBrowserServer) {
showBrowserServer = new import_playwrightServer.PlaywrightServer({ mode: "extension", path: "/" + (0, import_utils.createGuid)(), maxConnections: 1 });
connectWsEndpoint = await showBrowserServer.listen();
process.stdout.write(`${import_utils2.colors.dim("Show & reuse browser:")} ${import_utils2.colors.bold("on")}
`);
} else {
await showBrowserServer?.close();
showBrowserServer = void 0;
connectWsEndpoint = void 0;
process.stdout.write(`${import_utils2.colors.dim("Show & reuse browser:")} ${import_utils2.colors.bold("off")}
`);
}
}
function createErrorCodeframe(message, location) {
let source;
try {
source = import_fs.default.readFileSync(location.file, "utf-8") + "\n//";
} catch (e) {
return;
}
return (0, import_babelBundle.codeFrameColumns)(
source,
{
start: {
line: location.line,
column: location.column
}
},
{
highlightCode: true,
linesAbove: 5,
linesBelow: 5,
message: (0, import_util.stripAnsiEscapes)(message).split("\n")[0] || void 0
}
);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
runWatchModeLoop
});
+97
View File
@@ -0,0 +1,97 @@
"use strict";
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 __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);
var workerHost_exports = {};
__export(workerHost_exports, {
WorkerHost: () => WorkerHost
});
module.exports = __toCommonJS(workerHost_exports);
var import_fs = __toESM(require("fs"));
var import_path = __toESM(require("path"));
var import_utils = require("playwright-core/lib/utils");
var import_processHost = require("./processHost");
var import_ipc = require("../common/ipc");
var import_folders = require("../isomorphic/folders");
let lastWorkerIndex = 0;
class WorkerHost extends import_processHost.ProcessHost {
constructor(testGroup, parallelIndex, config, recoverFromStepErrors, extraEnv, outputDir) {
const workerIndex = lastWorkerIndex++;
super(require.resolve("../worker/workerMain.js"), `worker-${workerIndex}`, {
...extraEnv,
FORCE_COLOR: "1",
DEBUG_COLORS: process.env.DEBUG_COLORS === void 0 ? "1" : process.env.DEBUG_COLORS
});
this._didFail = false;
this.workerIndex = workerIndex;
this.parallelIndex = parallelIndex;
this._hash = testGroup.workerHash;
this._params = {
workerIndex: this.workerIndex,
parallelIndex,
repeatEachIndex: testGroup.repeatEachIndex,
projectId: testGroup.projectId,
config,
artifactsDir: import_path.default.join(outputDir, (0, import_folders.artifactsFolderName)(workerIndex)),
recoverFromStepErrors
};
}
async start() {
await import_fs.default.promises.mkdir(this._params.artifactsDir, { recursive: true });
return await this.startRunner(this._params, {
onStdOut: (chunk) => this.emit("stdOut", (0, import_ipc.stdioChunkToParams)(chunk)),
onStdErr: (chunk) => this.emit("stdErr", (0, import_ipc.stdioChunkToParams)(chunk))
});
}
async onExit() {
await (0, import_utils.removeFolders)([this._params.artifactsDir]);
}
async stop(didFail) {
if (didFail)
this._didFail = true;
await super.stop();
}
runTestGroup(runPayload) {
this.sendMessageNoReply({ method: "runTestGroup", params: runPayload });
}
resumeAfterStepError(result) {
this.sendMessageNoReply({ method: "resumeAfterStepError", params: result });
}
hash() {
return this._hash;
}
projectId() {
return this._params.projectId;
}
didFail() {
return this._didFail;
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
WorkerHost
});
+62
View File
@@ -0,0 +1,62 @@
"use strict";
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 __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);
var pirates_exports = {};
__export(pirates_exports, {
addHook: () => addHook
});
module.exports = __toCommonJS(pirates_exports);
var import_module = __toESM(require("module"));
var import_path = __toESM(require("path"));
function addHook(transformHook, shouldTransform, extensions) {
const extensionsToOverwrite = extensions.filter((e) => e !== ".cjs");
const allSupportedExtensions = new Set(extensions);
const loaders = import_module.default._extensions;
const jsLoader = loaders[".js"];
for (const extension of extensionsToOverwrite) {
let newLoader2 = function(mod, filename, ...loaderArgs) {
if (allSupportedExtensions.has(import_path.default.extname(filename)) && shouldTransform(filename)) {
let newCompile2 = function(code, file, ...ignoredArgs) {
mod._compile = oldCompile;
return oldCompile.call(this, transformHook(code, filename), file);
};
var newCompile = newCompile2;
const oldCompile = mod._compile;
mod._compile = newCompile2;
}
originalLoader.call(this, mod, filename, ...loaderArgs);
};
var newLoader = newLoader2;
const originalLoader = loaders[extension] || jsLoader;
loaders[extension] = newLoader2;
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
addHook
});
+103
View File
@@ -0,0 +1,103 @@
"use strict";
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 __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);
var tsconfig_loader_exports = {};
__export(tsconfig_loader_exports, {
loadTsConfig: () => loadTsConfig
});
module.exports = __toCommonJS(tsconfig_loader_exports);
var import_path = __toESM(require("path"));
var import_fs = __toESM(require("fs"));
var import_utilsBundle = require("../utilsBundle");
function loadTsConfig(configPath) {
try {
const references = [];
const config = innerLoadTsConfig(configPath, references);
return [config, ...references];
} catch (e) {
throw new Error(`Failed to load tsconfig file at ${configPath}:
${e.message}`);
}
}
function resolveConfigFile(baseConfigFile, referencedConfigFile) {
if (!referencedConfigFile.endsWith(".json"))
referencedConfigFile += ".json";
const currentDir = import_path.default.dirname(baseConfigFile);
let resolvedConfigFile = import_path.default.resolve(currentDir, referencedConfigFile);
if (referencedConfigFile.includes("/") && referencedConfigFile.includes(".") && !import_fs.default.existsSync(resolvedConfigFile))
resolvedConfigFile = import_path.default.join(currentDir, "node_modules", referencedConfigFile);
return resolvedConfigFile;
}
function innerLoadTsConfig(configFilePath, references, visited = /* @__PURE__ */ new Map()) {
if (visited.has(configFilePath))
return visited.get(configFilePath);
let result = {
tsConfigPath: configFilePath
};
visited.set(configFilePath, result);
if (!import_fs.default.existsSync(configFilePath))
return result;
const configString = import_fs.default.readFileSync(configFilePath, "utf-8");
const cleanedJson = StripBom(configString);
const parsedConfig = import_utilsBundle.json5.parse(cleanedJson);
const extendsArray = Array.isArray(parsedConfig.extends) ? parsedConfig.extends : parsedConfig.extends ? [parsedConfig.extends] : [];
for (const extendedConfig of extendsArray) {
const extendedConfigPath = resolveConfigFile(configFilePath, extendedConfig);
const base = innerLoadTsConfig(extendedConfigPath, references, visited);
Object.assign(result, base, { tsConfigPath: configFilePath });
}
if (parsedConfig.compilerOptions?.allowJs !== void 0)
result.allowJs = parsedConfig.compilerOptions.allowJs;
if (parsedConfig.compilerOptions?.paths !== void 0) {
result.paths = {
mapping: parsedConfig.compilerOptions.paths,
pathsBasePath: import_path.default.dirname(configFilePath)
};
}
if (parsedConfig.compilerOptions?.baseUrl !== void 0) {
result.absoluteBaseUrl = import_path.default.resolve(import_path.default.dirname(configFilePath), parsedConfig.compilerOptions.baseUrl);
}
for (const ref of parsedConfig.references || [])
references.push(innerLoadTsConfig(resolveConfigFile(configFilePath, ref.path), references, visited));
if (import_path.default.basename(configFilePath) === "jsconfig.json" && result.allowJs === void 0)
result.allowJs = true;
return result;
}
function StripBom(string) {
if (typeof string !== "string") {
throw new TypeError(`Expected a string, got ${typeof string}`);
}
if (string.charCodeAt(0) === 65279) {
return string.slice(1);
}
return string;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
loadTsConfig
});
+43
View File
@@ -0,0 +1,43 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var babelBundle_exports = {};
__export(babelBundle_exports, {
babelParse: () => babelParse,
babelTransform: () => babelTransform,
codeFrameColumns: () => codeFrameColumns,
declare: () => declare,
traverse: () => traverse,
types: () => types
});
module.exports = __toCommonJS(babelBundle_exports);
const codeFrameColumns = require("./babelBundleImpl").codeFrameColumns;
const declare = require("./babelBundleImpl").declare;
const types = require("./babelBundleImpl").types;
const traverse = require("./babelBundleImpl").traverse;
const babelTransform = require("./babelBundleImpl").babelTransform;
const babelParse = require("./babelBundleImpl").babelParse;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
babelParse,
babelTransform,
codeFrameColumns,
declare,
traverse,
types
});
+461
View File
@@ -0,0 +1,461 @@
"use strict";var L3=Object.create;var tu=Object.defineProperty;var j3=Object.getOwnPropertyDescriptor;var M3=Object.getOwnPropertyNames;var R3=Object.getPrototypeOf,q3=Object.prototype.hasOwnProperty;var x=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),U3=(e,t)=>{for(var r in t)tu(e,r,{get:t[r],enumerable:!0})},oT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of M3(t))!q3.call(e,s)&&s!==r&&tu(e,s,{get:()=>t[s],enumerable:!(n=j3(t,s))||n.enumerable});return e};var ci=(e,t,r)=>(r=e!=null?L3(R3(e)):{},oT(t||!e||!e.__esModule?tu(r,"default",{value:e,enumerable:!0}):r,e)),V3=e=>oT(tu({},"__esModule",{value:!0}),e);var ru=x(ld=>{"use strict";Object.defineProperty(ld,"__esModule",{value:!0});ld.default=$3;function $3(e,t){let r=Object.keys(t);for(let n of r)if(e[n]!==t[n])return!1;return!0}});var na=x(ud=>{"use strict";Object.defineProperty(ud,"__esModule",{value:!0});ud.default=W3;var lT=new Set;function W3(e,t,r="",n=e){if(lT.has(n))return;lT.add(n);let{internal:s,trace:i}=K3(1,2);s||console.warn(`${r}\`${e}\` has been deprecated, please migrate to \`${t}\`
${i}`)}function K3(e,t){let{stackTraceLimit:r,prepareStackTrace:n}=Error,s;if(Error.stackTraceLimit=1+e+t,Error.prepareStackTrace=function(a,o){s=o},new Error().stack,Error.stackTraceLimit=r,Error.prepareStackTrace=n,!s)return{internal:!1,trace:""};let i=s.slice(1+e,1+e+t);return{internal:/[\\/]@babel[\\/]/.test(i[1].getFileName()),trace:i.map(a=>` at ${a}`).join(`
`)}}});var Wt=x(S=>{"use strict";Object.defineProperty(S,"__esModule",{value:!0});S.isAccessor=uL;S.isAnyTypeAnnotation=Dk;S.isArgumentPlaceholder=r4;S.isArrayExpression=H3;S.isArrayPattern=WB;S.isArrayTypeAnnotation=wk;S.isArrowFunctionExpression=KB;S.isAssignmentExpression=G3;S.isAssignmentPattern=$B;S.isAwaitExpression=hk;S.isBigIntLiteral=yk;S.isBinary=N8;S.isBinaryExpression=X3;S.isBindExpression=n4;S.isBlock=k8;S.isBlockParent=B8;S.isBlockStatement=Q3;S.isBooleanLiteral=EB;S.isBooleanLiteralTypeAnnotation=_k;S.isBooleanTypeAnnotation=Ik;S.isBreakStatement=Z3;S.isCallExpression=eB;S.isCatchClause=tB;S.isClass=aL;S.isClassAccessorProperty=xk;S.isClassBody=HB;S.isClassDeclaration=XB;S.isClassExpression=GB;S.isClassImplements=Ok;S.isClassMethod=ak;S.isClassPrivateMethod=vk;S.isClassPrivateProperty=Sk;S.isClassProperty=Tk;S.isCompletionStatement=j8;S.isConditional=M8;S.isConditionalExpression=rB;S.isContinueStatement=nB;S.isDebuggerStatement=sB;S.isDecimalLiteral=u4;S.isDeclaration=G8;S.isDeclareClass=Bk;S.isDeclareExportAllDeclaration=Vk;S.isDeclareExportDeclaration=Uk;S.isDeclareFunction=kk;S.isDeclareInterface=Fk;S.isDeclareModule=Lk;S.isDeclareModuleExports=jk;S.isDeclareOpaqueType=Rk;S.isDeclareTypeAlias=Mk;S.isDeclareVariable=qk;S.isDeclaredPredicate=$k;S.isDecorator=s4;S.isDirective=J3;S.isDirectiveLiteral=z3;S.isDoExpression=i4;S.isDoWhileStatement=iB;S.isEmptyStatement=aB;S.isEmptyTypeAnnotation=eF;S.isEnumBody=yL;S.isEnumBooleanBody=wF;S.isEnumBooleanMember=OF;S.isEnumDeclaration=DF;S.isEnumDefaultedMember=FF;S.isEnumMember=gL;S.isEnumNumberBody=IF;S.isEnumNumberMember=BF;S.isEnumStringBody=_F;S.isEnumStringMember=kF;S.isEnumSymbolBody=NF;S.isExistsTypeAnnotation=Wk;S.isExportAllDeclaration=YB;S.isExportDeclaration=oL;S.isExportDefaultDeclaration=JB;S.isExportDefaultSpecifier=a4;S.isExportNamedDeclaration=zB;S.isExportNamespaceSpecifier=gk;S.isExportSpecifier=QB;S.isExpression=_8;S.isExpressionStatement=oB;S.isExpressionWrapper=U8;S.isFile=lB;S.isFlow=pL;S.isFlowBaseAnnotation=dL;S.isFlowDeclaration=hL;S.isFlowPredicate=mL;S.isFlowType=fL;S.isFor=V8;S.isForInStatement=uB;S.isForOfStatement=ZB;S.isForStatement=cB;S.isForXStatement=$8;S.isFunction=W8;S.isFunctionDeclaration=pB;S.isFunctionExpression=fB;S.isFunctionParameter=X8;S.isFunctionParent=K8;S.isFunctionTypeAnnotation=Kk;S.isFunctionTypeParam=Hk;S.isGenericTypeAnnotation=Gk;S.isIdentifier=dB;S.isIfStatement=hB;S.isImmutable=Z8;S.isImport=mk;S.isImportAttribute=Ck;S.isImportDeclaration=ek;S.isImportDefaultSpecifier=tk;S.isImportExpression=sk;S.isImportNamespaceSpecifier=rk;S.isImportOrExportDeclaration=uT;S.isImportSpecifier=nk;S.isIndexedAccessType=LF;S.isInferredPredicate=Xk;S.isInterfaceDeclaration=Jk;S.isInterfaceExtends=Yk;S.isInterfaceTypeAnnotation=zk;S.isInterpreterDirective=Y3;S.isIntersectionTypeAnnotation=Qk;S.isJSX=bL;S.isJSXAttribute=MF;S.isJSXClosingElement=RF;S.isJSXClosingFragment=QF;S.isJSXElement=qF;S.isJSXEmptyExpression=UF;S.isJSXExpressionContainer=VF;S.isJSXFragment=JF;S.isJSXIdentifier=WF;S.isJSXMemberExpression=KF;S.isJSXNamespacedName=HF;S.isJSXOpeningElement=GF;S.isJSXOpeningFragment=zF;S.isJSXSpreadAttribute=XF;S.isJSXSpreadChild=$F;S.isJSXText=YF;S.isLVal=J8;S.isLabeledStatement=mB;S.isLiteral=Q8;S.isLogicalExpression=xB;S.isLoop=R8;S.isMemberExpression=SB;S.isMetaProperty=ik;S.isMethod=tL;S.isMiscellaneous=EL;S.isMixedTypeAnnotation=Zk;S.isModuleDeclaration=wL;S.isModuleExpression=c4;S.isModuleSpecifier=lL;S.isNewExpression=vB;S.isNoop=ZF;S.isNullLiteral=bB;S.isNullLiteralTypeAnnotation=Nk;S.isNullableTypeAnnotation=tF;S.isNumberLiteral=PL;S.isNumberLiteralTypeAnnotation=rF;S.isNumberTypeAnnotation=nF;S.isNumericLiteral=gB;S.isObjectExpression=AB;S.isObjectMember=rL;S.isObjectMethod=CB;S.isObjectPattern=ok;S.isObjectProperty=DB;S.isObjectTypeAnnotation=sF;S.isObjectTypeCallProperty=aF;S.isObjectTypeIndexer=oF;S.isObjectTypeInternalSlot=iF;S.isObjectTypeProperty=lF;S.isObjectTypeSpreadProperty=uF;S.isOpaqueType=cF;S.isOptionalCallExpression=Ek;S.isOptionalIndexedAccessType=jF;S.isOptionalMemberExpression=bk;S.isParenthesizedExpression=NB;S.isPattern=iL;S.isPatternLike=Y8;S.isPipelineBareFunction=d4;S.isPipelinePrimaryTopicReference=h4;S.isPipelineTopicExpression=f4;S.isPlaceholder=e4;S.isPrivate=cL;S.isPrivateName=Pk;S.isProgram=PB;S.isProperty=nL;S.isPureish=H8;S.isQualifiedTypeIdentifier=pF;S.isRecordExpression=o4;S.isRegExpLiteral=TB;S.isRegexLiteral=AL;S.isRestElement=wB;S.isRestProperty=CL;S.isReturnStatement=IB;S.isScopable=O8;S.isSequenceExpression=_B;S.isSpreadElement=lk;S.isSpreadProperty=DL;S.isStandardized=I8;S.isStatement=F8;S.isStaticBlock=Ak;S.isStringLiteral=yB;S.isStringLiteralTypeAnnotation=fF;S.isStringTypeAnnotation=dF;S.isSuper=uk;S.isSwitchCase=OB;S.isSwitchStatement=BB;S.isSymbolTypeAnnotation=hF;S.isTSAnyKeyword=A4;S.isTSArrayType=K4;S.isTSAsExpression=p8;S.isTSBaseType=vL;S.isTSBigIntKeyword=D4;S.isTSBooleanKeyword=C4;S.isTSCallSignatureDeclaration=T4;S.isTSConditionalType=Q4;S.isTSConstruc Line truncated
`,++r,m===13&&t.charCodeAt(r)===10&&++r,++s,p=n=r):i.unterminated(a,o,l):++r}return{pos:r,str:u,firstInvalidLoc:c,lineStart:n,curLine:s,containsInvalid:!!c}}function t6(e,t,r,n){return e==="template"?t===96||t===36&&r.charCodeAt(n+1)===123:t===(e==="double"?34:39)}function r6(e,t,r,n,s,i){let a=!s;t++;let o=u=>({pos:t,ch:u,lineStart:r,curLine:n}),l=e.charCodeAt(t++);switch(l){case 110:return o(`
`);case 114:return o("\r");case 120:{let u;return{code:u,pos:t}=Ad(e,t,r,n,2,!1,a,i),o(u===null?null:String.fromCharCode(u))}case 117:{let u;return{code:u,pos:t}=AT(e,t,r,n,a,i),o(u===null?null:String.fromCodePoint(u))}case 116:return o(" ");case 98:return o("\b");case 118:return o("\v");case 102:return o("\f");case 13:e.charCodeAt(t)===10&&++t;case 10:r=t,++n;case 8232:case 8233:return o("");case 56:case 57:if(s)return o(null);i.strictNumericEscape(t-1,r,n);default:if(l>=48&&l<=55){let u=t-1,p=/^[0-7]+/.exec(e.slice(u,t+2))[0],d=parseInt(p,8);d>255&&(p=p.slice(0,-1),d=parseInt(p,8)),t+=p.length-1;let m=e.charCodeAt(t);if(p!=="0"||m===56||m===57){if(s)return o(null);i.strictNumericEscape(u,r,n)}return o(String.fromCharCode(d))}return o(String.fromCharCode(l))}}function Ad(e,t,r,n,s,i,a,o){let l=t,u;return{n:u,pos:t}=PT(e,t,r,n,16,s,i,!1,o,!a),u===null&&(a?o.invalidEscapeSequence(l,r,n):t=l-1),{code:u,pos:t}}function PT(e,t,r,n,s,i,a,o,l,u){let c=t,p=s===16?vT.hex:vT.decBinOct,d=s===16?iu.hex:s===10?iu.dec:s===8?iu.oct:iu.bin,m=!1,g=0;for(let f=0,b=i==null?1/0:i;f<b;++f){let T=e.charCodeAt(t),w;if(T===95&&o!=="bail"){let I=e.charCodeAt(t-1),N=e.charCodeAt(t+1);if(o){if(Number.isNaN(N)||!d(N)||p.has(I)||p.has(N)){if(u)return{n:null,pos:t};l.unexpectedNumericSeparator(t,r,n)}}else{if(u)return{n:null,pos:t};l.numericSeparatorInEscapeSequence(t,r,n)}++t;continue}if(T>=97?w=T-97+10:T>=65?w=T-65+10:ZL(T)?w=T-48:w=1/0,w>=s){if(w<=9&&u)return{n:null,pos:t};if(w<=9&&l.invalidDigit(t,r,n,s))w=0;else if(a)w=0,m=!0;else break}++t,g=g*s+w}return t===c||i!=null&&t-c!==i||m?{n:null,pos:t}:{n:g,pos:t}}function AT(e,t,r,n,s,i){let a=e.charCodeAt(t),o;if(a===123){if(++t,{code:o,pos:t}=Ad(e,t,r,n,e.indexOf("}",t)-t,!0,s,i),++t,o!==null&&o>1114111)if(s)i.invalidCodePoint(t,r,n);else return{code:null,pos:t}}else({code:o,pos:t}=Ad(e,t,r,n,4,!1,s,i));return{code:o,pos:t}}});var oa=x(He=>{"use strict";Object.defineProperty(He,"__esModule",{value:!0});He.UPDATE_OPERATORS=He.UNARY_OPERATORS=He.STRING_UNARY_OPERATORS=He.STATEMENT_OR_BLOCK_KEYS=He.NUMBER_UNARY_OPERATORS=He.NUMBER_BINARY_OPERATORS=He.LOGICAL_OPERATORS=He.INHERIT_KEYS=He.FOR_INIT_KEYS=He.FLATTENABLE_KEYS=He.EQUALITY_BINARY_OPERATORS=He.COMPARISON_BINARY_OPERATORS=He.COMMENT_KEYS=He.BOOLEAN_UNARY_OPERATORS=He.BOOLEAN_NUMBER_BINARY_OPERATORS=He.BOOLEAN_BINARY_OPERATORS=He.BINARY_OPERATORS=He.ASSIGNMENT_OPERATORS=void 0;var Kxe=He.STATEMENT_OR_BLOCK_KEYS=["consequent","body","alternate"],Hxe=He.FLATTENABLE_KEYS=["body","expressions"],Gxe=He.FOR_INIT_KEYS=["left","init"],Xxe=He.COMMENT_KEYS=["leadingComments","trailingComments","innerComments"],n6=He.LOGICAL_OPERATORS=["||","&&","??"],Yxe=He.UPDATE_OPERATORS=["++","--"],s6=He.BOOLEAN_NUMBER_BINARY_OPERATORS=[">","<",">=","<="],i6=He.EQUALITY_BINARY_OPERATORS=["==","===","!=","!=="],a6=He.COMPARISON_BINARY_OPERATORS=[...i6,"in","instanceof"],o6=He.BOOLEAN_BINARY_OPERATORS=[...a6,...s6],DT=He.NUMBER_BINARY_OPERATORS=["-","/","%","*","**","&","|",">>",">>>","<<","^"],Jxe=He.BINARY_OPERATORS=["+",...DT,...o6,"|>"],zxe=He.ASSIGNMENT_OPERATORS=["=","+=",...DT.map(e=>e+"="),...n6.map(e=>e+"=")],l6=He.BOOLEAN_UNARY_OPERATORS=["delete","!"],u6=He.NUMBER_UNARY_OPERATORS=["+","-","~"],c6=He.STRING_UNARY_OPERATORS=["typeof"],Qxe=He.UNARY_OPERATORS=["void","throw",...l6,...u6,...c6],Zxe=He.INHERIT_KEYS={optional:["typeAnnotation","typeParameters","returnType"],force:["start","loc","end"]};He.BLOCK_SCOPED_SYMBOL=Symbol.for("var used to be block scoped"),He.NOT_LOCAL_BINDING=Symbol.for("should not be considered a local binding")});var qn=x(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.allExpandedTypes=at.VISITOR_KEYS=at.NODE_PARENT_VALIDATIONS=at.NODE_FIELDS=at.FLIPPED_ALIAS_KEYS=at.DEPRECATED_KEYS=at.BUILDER_KEYS=at.ALIAS_KEYS=void 0;at.arrayOf=IT;at.arrayOfType=_T;at.assertEach=NT;at.assertNodeOrValueType=v6;at.assertNodeType=ou;at.assertOneOf=x6;at.assertOptionalChainStart=A6;at.assertShape=P6;at.assertValueType=Id;at.chain=OT;at.default=BT;at.defineAliasedType=w6;at.validate=wd;at.validateArrayOfType=T6;at.validateOptional=b6;at.validateOptionalType=E6;at.validateType=g6;var wT=sa(),Eo=lu(),p6=at.VISITOR_KEYS={},f6=at.ALIAS_KEYS={},Cd=at.FLIPPED_ALIAS_KEYS={},d6=at.NODE_FIELDS={},h6=at.BUILDER_KEYS={},m6=at.DEPRECATED_KEYS={},y6=at.NODE_PARENT_VALIDATIONS={};function au(e){return Array.isArray(e)?"array":e===null?"null":typeof e}function wd(e){return{validate:e}}function g6(...e){return wd(ou(...e))}function b6(e){return{validate:e,optional:!0}}function E6(...e){return{validate:ou(...e),optional:!0}}function IT(e){return OT(Id("array"),NT(e))}function _T(...e){return IT(ou(...e))}function T6(...e){return wd(_T(...e))}function NT(e){let t=process.env.BABEL_TYPES_8_BREAKING?Eo.validateChild:()=>{};function r(n,s,i){if(!Array.isArray(i))return;let a=0,o={toString(){return`${s}[${a}]`}};for(;a<i.length;a++){let l=i[a];e(n,o,l),t(n,o,l)}}return r.each=e,r}function x6(...e){function t(r,n,s){if(!e.includes(s))throw Line truncated
${a.join(`
`)}`)}return r.shapeOf=e,r}function A6(){function e(t){var r;let n=t;for(;t;){let{type:s}=n;if(s==="OptionalCallExpression"){if(n.optional)return;n=n.callee;continue}if(s==="OptionalMemberExpression"){if(n.optional)return;n=n.object;continue}break}throw new TypeError(`Non-optional ${t.type} must chain from an optional OptionalMemberExpression or OptionalCallExpression. Found chain from ${(r=n)==null?void 0:r.type}`)}return e}function OT(...e){function t(...r){for(let n of e)n(...r)}if(t.chainOf=e,e.length>=2&&"type"in e[0]&&e[0].type==="array"&&!("each"in e[1]))throw new Error('An assertValueType("array") validator can only be followed by an assertEach(...) validator.');return t}var C6=new Set(["aliases","builder","deprecatedAlias","fields","inherits","visitor","validate"]),D6=new Set(["default","optional","deprecated","validate"]),Dd={};function w6(...e){return(t,r={})=>{let n=r.aliases;if(!n){var s;r.inherits&&(n=(s=Dd[r.inherits].aliases)==null?void 0:s.slice()),n!=null||(n=[]),r.aliases=n}let i=e.filter(a=>!n.includes(a));n.unshift(...i),BT(t,r)}}function BT(e,t={}){let r=t.inherits&&Dd[t.inherits]||{},n=t.fields;if(!n&&(n={},r.fields)){let o=Object.getOwnPropertyNames(r.fields);for(let l of o){let u=r.fields[l],c=u.default;if(Array.isArray(c)?c.length>0:c&&typeof c=="object")throw new Error("field defaults can only be primitives or empty arrays currently");n[l]={default:Array.isArray(c)?[]:c,optional:u.optional,deprecated:u.deprecated,validate:u.validate}}}let s=t.visitor||r.visitor||[],i=t.aliases||r.aliases||[],a=t.builder||r.builder||t.visitor||[];for(let o of Object.keys(t))if(!C6.has(o))throw new Error(`Unknown type option "${o}" on ${e}`);t.deprecatedAlias&&(m6[t.deprecatedAlias]=e);for(let o of s.concat(a))n[o]=n[o]||{};for(let o of Object.keys(n)){let l=n[o];l.default!==void 0&&!a.includes(o)&&(l.optional=!0),l.default===void 0?l.default=null:!l.validate&&l.default!=null&&(l.validate=Id(au(l.default)));for(let u of Object.keys(l))if(!D6.has(u))throw new Error(`Unknown field key "${u}" on ${e}.${o}`)}p6[e]=t.visitor=s,h6[e]=t.builder=a,d6[e]=t.fields=n,f6[e]=t.aliases=i,i.forEach(o=>{Cd[o]=Cd[o]||[],Cd[o].push(e)}),t.validate&&(y6[e]=t.validate),Dd[e]=t}});var To=x(vr=>{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});vr.patternLikeCommon=vr.importAttributes=vr.functionTypeAnnotationCommon=vr.functionDeclarationCommon=vr.functionCommon=vr.classMethodOrPropertyCommon=vr.classMethodOrDeclareMethodCommon=void 0;var Nr=sa(),I6=aa(),kT=ia(),_6=CT(),la=oa(),D=qn(),oe=(0,D.defineAliasedType)("Standardized");oe("ArrayExpression",{fields:{elements:{validate:(0,D.arrayOf)((0,D.assertNodeOrValueType)("null","Expression","SpreadElement")),default:process.env.BABEL_TYPES_8_BREAKING?void 0:[]}},visitor:["elements"],aliases:["Expression"]});oe("AssignmentExpression",{fields:{operator:{validate:process.env.BABEL_TYPES_8_BREAKING?Object.assign(function(){let e=(0,D.assertOneOf)(...la.ASSIGNMENT_OPERATORS),t=(0,D.assertOneOf)("=");return function(r,n,s){((0,Nr.default)("Pattern",r.left)?t:e)(r,n,s)}}(),{oneOf:la.ASSIGNMENT_OPERATORS}):(0,D.assertValueType)("string")},left:{validate:process.env.BABEL_TYPES_8_BREAKING?(0,D.assertNodeType)("Identifier","MemberExpression","OptionalMemberExpression","ArrayPattern","ObjectPattern","TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSNonNullExpression"):(0,D.assertNodeType)("LVal","OptionalMemberExpression")},right:{validate:(0,D.assertNodeType)("Expression")}},builder:["operator","left","right"],visitor:["left","right"],aliases:["Expression"]});oe("BinaryExpression",{builder:["operator","left","right"],fields:{operator:{validate:(0,D.assertOneOf)(...la.BINARY_OPERATORS)},left:{validate:function(){let e=(0,D.assertNodeType)("Expression"),t=(0,D.assertNodeType)("Expression","PrivateName");return Object.assign(function(n,s,i){(n.operator==="in"?t:e)(n,s,i)},{oneOfNodeTypes:["Expression","PrivateName"]})}()},right:{validate:(0,D.assertNodeType)("Expression")}},visitor:["left","right"],aliases:["Binary","Expression"]});oe("InterpreterDirective",{builder:["value"],fields:{value:{validate:(0,D.assertValueType)("string")}}});oe("Directive",{visitor:["value"],fields:{value:{validate:(0,D.assertNodeType)("DirectiveLiteral")}}});oe("DirectiveLiteral",{builder:["value"],fields:{value:{validate:(0,D.assertValueType)("string")}}});oe("BlockStatement",{builder:["body","directives"],visitor:["directives","body"],fields:{directives:{validate:(0,D.arrayOfType)("Directive"),default:[]},body:(0,D.validateArrayOfType)("Statement")},aliases:["Scopable","BlockParent","Block","Statement"]});oe("BreakStatement",{visitor:["label"],fields:{label:{validate:(0,D.assertNodeType)("Identifier"),optional:!0}},aliases:["Statement","Terminatorless","CompletionStatement"]});oe("CallExpression",{visitor:["callee","typeParameters","typeArguments","arguments"],builder:["callee","arguments"],aliases:["Expression"],fields:Object.assign({callee:{validate:(0,D.assertNodeType)("ExpressionLine truncated
Expected ${r.length+1} quasis but got ${e.quasis.length}`)})}}});oe("YieldExpression",{builder:["argument","delegate"],visitor:["argument"],aliases:["Expression","Terminatorless"],fields:{delegate:{validate:process.env.BABEL_TYPES_8_BREAKING?(0,D.chain)((0,D.assertValueType)("boolean"),Object.assign(function(e,t,r){if(r&&!e.argument)throw new TypeError("Property delegate of YieldExpression cannot be true if there is no argument")},{type:"boolean"})):(0,D.assertValueType)("boolean"),default:!1},argument:{optional:!0,validate:(0,D.assertNodeType)("Expression")}}});oe("AwaitExpression",{builder:["argument"],visitor:["argument"],aliases:["Expression","Terminatorless"],fields:{argument:{validate:(0,D.assertNodeType)("Expression")}}});oe("Import",{aliases:["Expression"]});oe("BigIntLiteral",{builder:["value"],fields:{value:{validate:(0,D.assertValueType)("string")}},aliases:["Expression","Pureish","Literal","Immutable"]});oe("ExportNamespaceSpecifier",{visitor:["exported"],aliases:["ModuleSpecifier"],fields:{exported:{validate:(0,D.assertNodeType)("Identifier")}}});oe("OptionalMemberExpression",{builder:["object","property","computed","optional"],visitor:["object","property"],aliases:["Expression"],fields:{object:{validate:(0,D.assertNodeType)("Expression")},property:{validate:function(){let e=(0,D.assertNodeType)("Identifier"),t=(0,D.assertNodeType)("Expression");return Object.assign(function(n,s,i){(n.computed?t:e)(n,s,i)},{oneOfNodeTypes:["Expression","Identifier"]})}()},computed:{default:!1},optional:{validate:process.env.BABEL_TYPES_8_BREAKING?(0,D.chain)((0,D.assertValueType)("boolean"),(0,D.assertOptionalChainStart)()):(0,D.assertValueType)("boolean")}}});oe("OptionalCallExpression",{visitor:["callee","typeParameters","typeArguments","arguments"],builder:["callee","arguments","optional"],aliases:["Expression"],fields:Object.assign({callee:{validate:(0,D.assertNodeType)("Expression")},arguments:(0,D.validateArrayOfType)("Expression","SpreadElement","ArgumentPlaceholder"),optional:{validate:process.env.BABEL_TYPES_8_BREAKING?(0,D.chain)((0,D.assertValueType)("boolean"),(0,D.assertOptionalChainStart)()):(0,D.assertValueType)("boolean")},typeArguments:{validate:(0,D.assertNodeType)("TypeParameterInstantiation"),optional:!0}},{typeParameters:{validate:(0,D.assertNodeType)("TSTypeParameterInstantiation"),optional:!0}})});oe("ClassProperty",{visitor:["decorators","variance","key","typeAnnotation","value"],builder:["key","value","typeAnnotation","decorators","computed","static"],aliases:["Property"],fields:Object.assign({},uu(),{value:{validate:(0,D.assertNodeType)("Expression"),optional:!0},definite:{validate:(0,D.assertValueType)("boolean"),optional:!0},typeAnnotation:{validate:(0,D.assertNodeType)("TypeAnnotation","TSTypeAnnotation","Noop"),optional:!0},decorators:{validate:(0,D.arrayOfType)("Decorator"),optional:!0},readonly:{validate:(0,D.assertValueType)("boolean"),optional:!0},declare:{validate:(0,D.assertValueType)("boolean"),optional:!0},variance:{validate:(0,D.assertNodeType)("Variance"),optional:!0}})});oe("ClassAccessorProperty",{visitor:["decorators","key","typeAnnotation","value"],builder:["key","value","typeAnnotation","decorators","computed","static"],aliases:["Property","Accessor"],fields:Object.assign({},uu(),{key:{validate:(0,D.chain)(function(){let e=(0,D.assertNodeType)("Identifier","StringLiteral","NumericLiteral","BigIntLiteral","PrivateName"),t=(0,D.assertNodeType)("Expression");return function(r,n,s){(r.computed?t:e)(r,n,s)}}(),(0,D.assertNodeType)("Identifier","StringLiteral","NumericLiteral","BigIntLiteral","Expression","PrivateName"))},value:{validate:(0,D.assertNodeType)("Expression"),optional:!0},definite:{validate:(0,D.assertValueType)("boolean"),optional:!0},typeAnnotation:{validate:(0,D.assertNodeType)("TypeAnnotation","TSTypeAnnotation","Noop"),optional:!0},decorators:{validate:(0,D.arrayOfType)("Decorator"),optional:!0},readonly:{validate:(0,D.assertValueType)("boolean"),optional:!0},declare:{validate:(0,D.assertValueType)("boolean"),optional:!0},variance:{validate:(0,D.assertNodeType)("Variance"),optional:!0}})});oe("ClassPrivateProperty",{visitor:["decorators","variance","key","typeAnnotation","value"],builder:["key","value","decorators","static"],aliases:["Property","Private"],fields:{key:{validate:(0,D.assertNodeType)("PrivateName")},value:{validate:(0,D.assertNodeType)("Expression"),optional:!0},typeAnnotation:{validate:(0,D.assertNodeType)("TypeAnnotation","TSTypeAnnotation","Noop"),optional:!0},decorators:{validate:(0,D.arrayOfType)("Decorator"),optional:!0},static:{validate:(0,D.assertValueType)("boolean"),default:!1},readonly:{validate:(0,D.assertValueType)("boolean"),optional:!0},optional:{validate:(0,D.assertValueType)("boolean"),optional:!0},definite:{validate:(0,D.assertValueType)("boolean"),optional:!0},variance:{validate:(0,D.assertNodeType)("Variance"),optional:!0}}});oe("ClassPrivateMethod",{builder:["kind","key","params","body","static"],visitor:["decorators"," Line truncated
Expected ${r.length+1} quasis but got ${e.quasis.length}`)})}}});Oe("TSLiteralType",{aliases:["TSType","TSBaseType"],visitor:["literal"],fields:{literal:{validate:function(){let e=(0,Y.assertNodeType)("NumericLiteral","BigIntLiteral"),t=(0,Y.assertOneOf)("-"),r=(0,Y.assertNodeType)("NumericLiteral","StringLiteral","BooleanLiteral","BigIntLiteral","TemplateLiteral");function n(s,i,a){(0,F6.default)("UnaryExpression",a)?(t(a,"operator",a.operator),e(a,"argument",a.argument)):r(s,i,a)}return n.oneOfNodeTypes=["NumericLiteral","StringLiteral","BooleanLiteral","BigIntLiteral","TemplateLiteral","UnaryExpression"],n}()}}});Oe("TSExpressionWithTypeArguments",{aliases:["TSType"],visitor:["expression","typeParameters"],fields:{expression:(0,Y.validateType)("TSEntityName"),typeParameters:(0,Y.validateOptionalType)("TSTypeParameterInstantiation")}});Oe("TSInterfaceDeclaration",{aliases:["Statement","Declaration"],visitor:["id","typeParameters","extends","body"],fields:{declare:(0,Y.validateOptional)($r),id:(0,Y.validateType)("Identifier"),typeParameters:(0,Y.validateOptionalType)("TSTypeParameterDeclaration"),extends:(0,Y.validateOptional)((0,Y.arrayOfType)("TSExpressionWithTypeArguments")),body:(0,Y.validateType)("TSInterfaceBody")}});Oe("TSInterfaceBody",{visitor:["body"],fields:{body:(0,Y.validateArrayOfType)("TSTypeElement")}});Oe("TSTypeAliasDeclaration",{aliases:["Statement","Declaration"],visitor:["id","typeParameters","typeAnnotation"],fields:{declare:(0,Y.validateOptional)($r),id:(0,Y.validateType)("Identifier"),typeParameters:(0,Y.validateOptionalType)("TSTypeParameterDeclaration"),typeAnnotation:(0,Y.validateType)("TSType")}});Oe("TSInstantiationExpression",{aliases:["Expression"],visitor:["expression","typeParameters"],fields:{expression:(0,Y.validateType)("Expression"),typeParameters:(0,Y.validateOptionalType)("TSTypeParameterInstantiation")}});var GT={aliases:["Expression","LVal","PatternLike"],visitor:["expression","typeAnnotation"],fields:{expression:(0,Y.validateType)("Expression"),typeAnnotation:(0,Y.validateType)("TSType")}};Oe("TSAsExpression",GT);Oe("TSSatisfiesExpression",GT);Oe("TSTypeAssertion",{aliases:["Expression","LVal","PatternLike"],visitor:["typeAnnotation","expression"],fields:{typeAnnotation:(0,Y.validateType)("TSType"),expression:(0,Y.validateType)("Expression")}});Oe("TSEnumBody",{visitor:["members"],fields:{members:(0,Y.validateArrayOfType)("TSEnumMember")}});Oe("TSEnumDeclaration",{aliases:["Statement","Declaration"],visitor:["id","members"],fields:{declare:(0,Y.validateOptional)($r),const:(0,Y.validateOptional)($r),id:(0,Y.validateType)("Identifier"),members:(0,Y.validateArrayOfType)("TSEnumMember"),initializer:(0,Y.validateOptionalType)("Expression"),body:(0,Y.validateOptionalType)("TSEnumBody")}});Oe("TSEnumMember",{visitor:["id","initializer"],fields:{id:(0,Y.validateType)("Identifier","StringLiteral"),initializer:(0,Y.validateOptionalType)("Expression")}});Oe("TSModuleDeclaration",{aliases:["Statement","Declaration"],visitor:["id","body"],fields:Object.assign({kind:{validate:(0,Y.assertOneOf)("global","module","namespace")},declare:(0,Y.validateOptional)($r)},{global:(0,Y.validateOptional)($r)},{id:(0,Y.validateType)("Identifier","StringLiteral"),body:(0,Y.validateType)("TSModuleBlock","TSModuleDeclaration")})});Oe("TSModuleBlock",{aliases:["Scopable","Block","BlockParent","FunctionParent"],visitor:["body"],fields:{body:(0,Y.validateArrayOfType)("Statement")}});Oe("TSImportType",{aliases:["TSType"],builder:["argument","qualifier","typeParameters"],visitor:["argument","options","qualifier","typeParameters"],fields:{argument:(0,Y.validateType)("StringLiteral"),qualifier:(0,Y.validateOptionalType)("TSEntityName"),typeParameters:(0,Y.validateOptionalType)("TSTypeParameterInstantiation"),options:{validate:(0,Y.assertNodeType)("ObjectExpression"),optional:!0}}});Oe("TSImportEqualsDeclaration",{aliases:["Statement","Declaration"],visitor:["id","moduleReference"],fields:Object.assign({},{isExport:(0,Y.validate)($r)},{id:(0,Y.validateType)("Identifier"),moduleReference:(0,Y.validateType)("TSEntityName","TSExternalModuleReference"),importKind:{validate:(0,Y.assertOneOf)("type","value"),optional:!0}})});Oe("TSExternalModuleReference",{visitor:["expression"],fields:{expression:(0,Y.validateType)("StringLiteral")}});Oe("TSNonNullExpression",{aliases:["Expression","LVal","PatternLike"],visitor:["expression"],fields:{expression:(0,Y.validateType)("Expression")}});Oe("TSExportAssignment",{aliases:["Statement"],visitor:["expression"],fields:{expression:(0,Y.validateType)("Expression")}});Oe("TSNamespaceExportDeclaration",{aliases:["Statement"],visitor:["id"],fields:{id:(0,Y.validateType)("Identifier")}});Oe("TSTypeAnnotation",{visitor:["typeAnnotation"],fields:{typeAnnotation:{validate:(0,Y.assertNodeType)("TSType")}}});Oe("TSTypeParameterInstantiation",{visitor:["params"],fields:{params:(0,Y.validateArrayOfType)("TSType")}});Oe("TSTypeParameterDeclaration",{visitor:["params"],fields:{params:( Line truncated
${t}`,validate:()=>{},unwrap:t=>e(t.program.body.slice(1))}}var ywe=ln.smart=hm(e=>e.length>1?e:e[0]),gwe=ln.statements=hm(e=>e),bwe=ln.statement=hm(e=>{if(e.length===0)throw new Error("Found nothing to return.");if(e.length>1)throw new Error("Found multiple statements but wanted one");return e[0]}),mG=ln.expression={code:e=>`(
${e}
)`,validate:e=>{if(e.program.body.length>1)throw new Error("Found multiple statements but wanted one");if(mG.unwrap(e).start===0)throw new Error("Parse result included parens.")},unwrap:({program:e})=>{let[t]=e.body;return hG(t),t.expression}},Ewe=ln.program={code:e=>e,validate:()=>{},unwrap:e=>e.program}});var Au=x(wo=>{"use strict";Object.defineProperty(wo,"__esModule",{value:!0});wo.merge=bG;wo.normalizeReplacements=TG;wo.validate=EG;var yG=["placeholderWhitelist","placeholderPattern","preserveComments","syntacticPlaceholders"];function gG(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function bG(e,t){let{placeholderWhitelist:r=e.placeholderWhitelist,placeholderPattern:n=e.placeholderPattern,preserveComments:s=e.preserveComments,syntacticPlaceholders:i=e.syntacticPlaceholders}=t;return{parser:Object.assign({},e.parser,t.parser),placeholderWhitelist:r,placeholderPattern:n,preserveComments:s,syntacticPlaceholders:i}}function EG(e){if(e!=null&&typeof e!="object")throw new Error("Unknown template options.");let t=e||{},{placeholderWhitelist:r,placeholderPattern:n,preserveComments:s,syntacticPlaceholders:i}=t,a=gG(t,yG);if(r!=null&&!(r instanceof Set))throw new Error("'.placeholderWhitelist' must be a Set, null, or undefined");if(n!=null&&!(n instanceof RegExp)&&n!==!1)throw new Error("'.placeholderPattern' must be a RegExp, false, null, or undefined");if(s!=null&&typeof s!="boolean")throw new Error("'.preserveComments' must be a boolean, null, or undefined");if(i!=null&&typeof i!="boolean")throw new Error("'.syntacticPlaceholders' must be a boolean, null, or undefined");if(i===!0&&(r!=null||n!=null))throw new Error("'.placeholderWhitelist' and '.placeholderPattern' aren't compatible with '.syntacticPlaceholders: true'");return{parser:a,placeholderWhitelist:r||void 0,placeholderPattern:n==null?void 0:n,preserveComments:s==null?void 0:s,syntacticPlaceholders:i==null?void 0:i}}function TG(e){if(Array.isArray(e))return e.reduce((t,r,n)=>(t["$"+n]=r,t),{});if(typeof e=="object"||e==null)return e||void 0;throw new Error("Template replacements must be an array, object, null, or undefined")}});var Ro=x(Mo=>{"use strict";Object.defineProperty(Mo,"__esModule",{value:!0});function xG(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var Wn=class{constructor(t,r,n){this.line=void 0,this.column=void 0,this.index=void 0,this.line=t,this.column=r,this.index=n}},ga=class{constructor(t,r){this.start=void 0,this.end=void 0,this.filename=void 0,this.identifierName=void 0,this.start=t,this.end=r}};function Fr(e,t){let{line:r,column:n,index:s}=e;return new Wn(r,n+t,s+t)}var pS="BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED",SG={ImportMetaOutsideModule:{message:`import.meta may appear only with 'sourceType: "module"'`,code:pS},ImportOutsideModule:{message:`'import' and 'export' may appear only with 'sourceType: "module"'`,code:pS}},fS={ArrayPattern:"array destructuring pattern",AssignmentExpression:"assignment expression",AssignmentPattern:"assignment expression",ArrowFunctionExpression:"arrow function expression",ConditionalExpression:"conditional expression",CatchClause:"catch clause",ForOfStatement:"for-of statement",ForInStatement:"for-in statement",ForStatement:"for-loop",FormalParameters:"function parameter list",Identifier:"identifier",ImportSpecifier:"import specifier",ImportDefaultSpecifier:"import default specifier",ImportNamespaceSpecifier:"import namespace specifier",ObjectPattern:"object destructuring pattern",ParenthesizedExpression:"parenthesized expression",RestElement:"rest element",UpdateExpression:{true:"prefix operation",false:"postfix operation"},VariableDeclarator:"variable declaration",YieldExpression:"yield expression"},wu=e=>e.type==="UpdateExpression"?fS.UpdateExpression[`${e.prefix}`]:fS[e.type],vG={AccessorIsGenerator:({kind:e})=>`A ${e}ter cannot be a generator.`,ArgumentsInClass:"'arguments' is only allowed in functions and class methods.",AsyncFunctionInSingleStatementContext:"Async functions can only be declared at the top level or inside a block.",AwaitBindingIdentifier:"Can not use 'await' as identifier inside an async function.",AwaitBindingIdentifierInStaticBlock:"Can not use 'await' as identifier inside a static block.",AwaitExpressionFormalParameter:"'await' is not allowed in async function parameters.",AwaitUsingNotInAsyncContext:"'await using' is only allowed within async functions and at the top levels of modules.",AwaitNotInAsyncContext:"'await' is only allowed within async functions and at the top levels of modules.",BadGetterArity:"A 'get' accessor must not have any formal parameters.",BadSetterArity:"A 'set' accessor must have exactly one formal parameter.",BadSetterRestParameter:"A 'set' accessor function argument must not be a rest parameter.",ConstructorClassField:"Classes may not have a field named 'constructor'.",Constructor Line truncated
- Did you mean \`export { '${e}' as '${t}' } from 'some-module'\`?`,ExportDefaultFromAsIdentifier:"'from' is not allowed as an identifier after 'export default'.",ForInOfLoopInitializer:({type:e})=>`'${e==="ForInStatement"?"for-in":"for-of"}' loop variable declaration may not have an initializer.`,ForInUsing:"For-in loop may not start with 'using' declaration.",ForOfAsync:"The left-hand side of a for-of loop may not be 'async'.",ForOfLet:"The left-hand side of a for-of loop may not start with 'let'.",GeneratorInSingleStatementContext:"Generators can only be declared at the top level or inside a block.",IllegalBreakContinue:({type:e})=>`Unsyntactic ${e==="BreakStatement"?"break":"continue"}.`,IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list.",IllegalReturn:"'return' outside of function.",ImportAttributesUseAssert:"The `assert` keyword in import attributes is deprecated and it has been replaced by the `with` keyword. You can enable the `deprecatedImportAssert` parser plugin to suppress this error.",ImportBindingIsString:({importName:e})=>`A string literal cannot be used as an imported binding.
- Did you mean \`import { "${e}" as foo }\`?`,ImportCallArity:"`import()` requires exactly one or two arguments.",ImportCallNotNewExpression:"Cannot use new with import(...).",ImportCallSpreadArgument:"`...` is not allowed in `import()`.",ImportJSONBindingNotDefault:"A JSON module can only be imported with `default`.",ImportReflectionHasAssertion:"`import module x` cannot have assertions.",ImportReflectionNotBinding:'Only `import module x from "./module"` is valid.',IncompatibleRegExpUVFlags:"The 'u' and 'v' regular expression flags cannot be enabled at the same time.",InvalidBigIntLiteral:"Invalid BigIntLiteral.",InvalidCodePoint:"Code point out of bounds.",InvalidCoverDiscardElement:"'void' must be followed by an expression when not used in a binding position.",InvalidCoverInitializedName:"Invalid shorthand property initializer.",InvalidDecimal:"Invalid decimal.",InvalidDigit:({radix:e})=>`Expected number in radix ${e}.`,InvalidEscapeSequence:"Bad character escape sequence.",InvalidEscapeSequenceTemplate:"Invalid escape sequence in template.",InvalidEscapedReservedWord:({reservedWord:e})=>`Escape sequence in keyword ${e}.`,InvalidIdentifier:({identifierName:e})=>`Invalid identifier ${e}.`,InvalidLhs:({ancestor:e})=>`Invalid left-hand side in ${wu(e)}.`,InvalidLhsBinding:({ancestor:e})=>`Binding invalid left-hand side in ${wu(e)}.`,InvalidLhsOptionalChaining:({ancestor:e})=>`Invalid optional chaining in the left-hand side of ${wu(e)}.`,InvalidNumber:"Invalid number.",InvalidOrMissingExponent:"Floating-point numbers require a valid exponent after the 'e'.",InvalidOrUnexpectedToken:({unexpected:e})=>`Unexpected character '${e}'.`,InvalidParenthesizedAssignment:"Invalid parenthesized assignment pattern.",InvalidPrivateFieldResolution:({identifierName:e})=>`Private name #${e} is not defined.`,InvalidPropertyBindingPattern:"Binding member expression.",InvalidRecordProperty:"Only properties and spread elements are allowed in record definitions.",InvalidRestAssignmentPattern:"Invalid rest operator's argument.",LabelRedeclaration:({labelName:e})=>`Label '${e}' is already declared.`,LetInLexicalBinding:"'let' is disallowed as a lexically bound name.",LineTerminatorBeforeArrow:"No line break is allowed before '=>'.",MalformedRegExpFlags:"Invalid regular expression flag.",MissingClassName:"A class name is required.",MissingEqInAssignment:"Only '=' operator can be used for specifying default value.",MissingSemicolon:"Missing semicolon.",MissingPlugin:({missingPlugin:e})=>`This experimental syntax requires enabling the parser plugin: ${e.map(t=>JSON.stringify(t)).join(", ")}.`,MissingOneOfPlugins:({missingPlugin:e})=>`This experimental syntax requires enabling one of the following parser plugin(s): ${e.map(t=>JSON.stringify(t)).join(", ")}.`,MissingUnicodeEscape:"Expecting Unicode escape sequence \\uXXXX.",MixingCoalesceWithLogical:"Nullish coalescing operator(??) requires parens when mixing with logical operators.",ModuleAttributeDifferentFromType:"The only accepted module attribute is `type`.",ModuleAttributeInvalidValue:"Only string literals are allowed as module attribute values.",ModuleAttributesWithDuplicateKeys:({key:e})=>`Duplicate key "${e}" is not allowed in module attributes.`,ModuleExportNameHasLoneSurrogate:({surrogateCharCode:e})=>`An export name cannot include a lone surrogate, found '\\u${e.toString(16)}'.`,ModuleExportUndefined:({localName:e})=>`Export '${e}' is not defined.`,MultipleDefaultsInSwitch:"Multiple default clauses.",NewlineAfterThrow:"Illegal newline after throw.",NoCatchOrFinally:"Missing catch or finally clause.",NumberIdentifier:"Identifier directly after number.",NumericSeparatorInEscapeSequence:"Numeric separators are not allowed inside unicode escape sequences or hex escape sequences.",ObsoleteAwaitStar:"'await*' has been removed from the async functions proposal. Use Promise.all() instead.",OptionalChainingNoNew:"Constructors in/after an Optional Chain are not allowed.",OptionalChainingNoTemplate:"Tagged Template Literals are not allowed in optionalChain.",OverrideOnConstructor:"'override' modifier cannot appear on a constructor declaration.",ParamDupe:"Argument name clash.",PatternHasAccessor:"Object pattern can't contain getter or setter.",PatternHasMethod:"Object pattern can't contain methods.",PrivateInExpectedIn:({identifierName:e})=>`Private names are only allowed in property accesses (\`obj.#${e}\`) or in \`in\` expressions (\`#${e} in obj\`).`,PrivateNameRedeclaration:({identifierName:e})=>`Duplicate private name #${e}.`,RecordExpressionBarIncorrectEndSyntaxType:"Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",RecordExpressionBarIncorrectStartSyntaxType:"Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",RecordExpressionHashIncorrectStartSyntaxType:"Record expressions starting with '#{' are only allowed when the Line truncated
`:`\r
`):s=String.fromCharCode(n),++this.state.curLine,this.state.lineStart=this.state.pos,s}jsxReadString(r){let n="",s=++this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(O.UnterminatedString,this.state.startLoc);let i=this.input.charCodeAt(this.state.pos);if(i===r)break;i===38?(n+=this.input.slice(s,this.state.pos),n+=this.jsxReadEntity(),s=this.state.pos):ma(i)?(n+=this.input.slice(s,this.state.pos),n+=this.jsxReadNewLine(!1),s=this.state.pos):++this.state.pos}n+=this.input.slice(s,this.state.pos++),this.finishToken(134,n)}jsxReadEntity(){let r=++this.state.pos;if(this.codePointAtPos(this.state.pos)===35){++this.state.pos;let n=10;this.codePointAtPos(this.state.pos)===120&&(n=16,++this.state.pos);let s=this.readInt(n,void 0,!1,"bail");if(s!==null&&this.codePointAtPos(this.state.pos)===59)return++this.state.pos,String.fromCodePoint(s)}else{let n=0,s=!1;for(;n++<10&&this.state.pos<this.length&&!(s=this.codePointAtPos(this.state.pos)===59);)++this.state.pos;if(s){let i=this.input.slice(r,this.state.pos),a=lX[i];if(++this.state.pos,a)return a}}return this.state.pos=r,"&"}jsxReadWord(){let r,n=this.state.pos;do r=this.input.charCodeAt(++this.state.pos);while(ha(r)||r===45);this.finishToken(141,this.input.slice(n,this.state.pos))}jsxParseIdentifier(){let r=this.startNode();return this.match(141)?r.name=this.state.value:Hm(this.state.type)?r.name=Ms(this.state.type):this.unexpected(),this.next(),this.finishNode(r,"JSXIdentifier")}jsxParseNamespacedName(){let r=this.state.startLoc,n=this.jsxParseIdentifier();if(!this.eat(14))return n;let s=this.startNodeAt(r);return s.namespace=n,s.name=this.jsxParseIdentifier(),this.finishNode(s,"JSXNamespacedName")}jsxParseElementName(){let r=this.state.startLoc,n=this.jsxParseNamespacedName();if(n.type==="JSXNamespacedName")return n;for(;this.eat(16);){let s=this.startNodeAt(r);s.object=n,s.property=this.jsxParseIdentifier(),n=this.finishNode(s,"JSXMemberExpression")}return n}jsxParseAttributeValue(){let r;switch(this.state.type){case 5:return r=this.startNode(),this.setContext(dt.brace),this.next(),r=this.jsxParseExpressionContainer(r,dt.j_oTag),r.expression.type==="JSXEmptyExpression"&&this.raise(gi.AttributeIsEmpty,r),r;case 143:case 134:return this.parseExprAtom();default:throw this.raise(gi.UnsupportedJsxValue,this.state.startLoc)}}jsxParseEmptyExpression(){let r=this.startNodeAt(this.state.lastTokEndLoc);return this.finishNodeAt(r,"JSXEmptyExpression",this.state.startLoc)}jsxParseSpreadChild(r){return this.next(),r.expression=this.parseExpression(),this.setContext(dt.j_expr),this.state.canStartJSXElement=!0,this.expect(8),this.finishNode(r,"JSXSpreadChild")}jsxParseExpressionContainer(r,n){if(this.match(8))r.expression=this.jsxParseEmptyExpression();else{let s=this.parseExpression();r.expression=s}return this.setContext(n),this.state.canStartJSXElement=!0,this.expect(8),this.finishNode(r,"JSXExpressionContainer")}jsxParseAttribute(){let r=this.startNode();return this.match(5)?(this.setContext(dt.brace),this.next(),this.expect(21),r.argument=this.parseMaybeAssignAllowIn(),this.setContext(dt.j_oTag),this.state.canStartJSXElement=!0,this.expect(8),this.finishNode(r,"JSXSpreadAttribute")):(r.name=this.jsxParseNamespacedName(),r.value=this.eat(29)?this.jsxParseAttributeValue():null,this.finishNode(r,"JSXAttribute"))}jsxParseOpeningElementAt(r){let n=this.startNodeAt(r);return this.eat(144)?this.finishNode(n,"JSXOpeningFragment"):(n.name=this.jsxParseElementName(),this.jsxParseOpeningElementAfterName(n))}jsxParseOpeningElementAfterName(r){let n=[];for(;!this.match(56)&&!this.match(144);)n.push(this.jsxParseAttribute());return r.attributes=n,r.selfClosing=this.eat(56),this.expect(144),this.finishNode(r,"JSXOpeningElement")}jsxParseClosingElementAt(r){let n=this.startNodeAt(r);return this.eat(144)?this.finishNode(n,"JSXClosingFragment"):(n.name=this.jsxParseElementName(),this.expect(144),this.finishNode(n,"JSXClosingElement"))}jsxParseElementAt(r){let n=this.startNodeAt(r),s=[],i=this.jsxParseOpeningElementAt(r),a=null;if(!i.selfClosing){e:for(;;)switch(this.state.type){case 143:if(r=this.state.startLoc,this.next(),this.eat(56)){a=this.jsxParseClosingElementAt(r);break e}s.push(this.jsxParseElementAt(r));break;case 142:s.push(this.parseLiteral(this.state.value,"JSXText"));break;case 5:{let o=this.startNode();this.setContext(dt.brace),this.next(),this.match(21)?s.push(this.jsxParseSpreadChild(o)):s.push(this.jsxParseExpressionContainer(o,dt.j_expr));break}default:this.unexpected()}Ls(i)&&!Ls(a)&&a!==null?this.raise(gi.MissingClosingTagFragment,a):!Ls(i)&&Ls(a)?this.raise(gi.MissingClosingTagElement,a,{openingTagName:da(i.name)}):!Ls(i)&&!Ls(a)&&da(a.name)!==da(i.name)&&this.raise(gi.MissingClosingTagElement,a,{openingTagName:da(i.name)})}if(Ls(i)?(n.openingFragment=i,n.closingFragment=a):(n.openingElement=i,n.closingElement=a),n.children=s,this.match(47))throw this.raise(gi.UnwrappedAdjacentJSXElements,this.state.startLoc);return Ls(i)?this.finishNode(n,"JSXFrag Line truncated
`,++r,m===13&&t.charCodeAt(r)===10&&++r,++s,p=n=r):i.unterminated(a,o,l):++r}return{pos:r,str:u,firstInvalidLoc:c,lineStart:n,curLine:s,containsInvalid:!!c}}function hX(e,t,r,n){return e==="template"?t===96||t===36&&r.charCodeAt(n+1)===123:t===(e==="double"?34:39)}function mX(e,t,r,n,s,i){let a=!s;t++;let o=u=>({pos:t,ch:u,lineStart:r,curLine:n}),l=e.charCodeAt(t++);switch(l){case 110:return o(`
`);case 114:return o("\r");case 120:{let u;return{code:u,pos:t}=Im(e,t,r,n,2,!1,a,i),o(u===null?null:String.fromCharCode(u))}case 117:{let u;return{code:u,pos:t}=FS(e,t,r,n,a,i),o(u===null?null:String.fromCodePoint(u))}case 116:return o(" ");case 98:return o("\b");case 118:return o("\v");case 102:return o("\f");case 13:e.charCodeAt(t)===10&&++t;case 10:r=t,++n;case 8232:case 8233:return o("");case 56:case 57:if(s)return o(null);i.strictNumericEscape(t-1,r,n);default:if(l>=48&&l<=55){let u=t-1,p=/^[0-7]+/.exec(e.slice(u,t+2))[0],d=parseInt(p,8);d>255&&(p=p.slice(0,-1),d=parseInt(p,8)),t+=p.length-1;let m=e.charCodeAt(t);if(p!=="0"||m===56||m===57){if(s)return o(null);i.strictNumericEscape(u,r,n)}return o(String.fromCharCode(d))}return o(String.fromCharCode(l))}}function Im(e,t,r,n,s,i,a,o){let l=t,u;return{n:u,pos:t}=kS(e,t,r,n,16,s,i,!1,o,!a),u===null&&(a?o.invalidEscapeSequence(l,r,n):t=l-1),{code:u,pos:t}}function kS(e,t,r,n,s,i,a,o,l,u){let c=t,p=s===16?bS.hex:bS.decBinOct,d=s===16?Du.hex:s===10?Du.dec:s===8?Du.oct:Du.bin,m=!1,g=0;for(let f=0,b=i==null?1/0:i;f<b;++f){let T=e.charCodeAt(t),w;if(T===95&&o!=="bail"){let I=e.charCodeAt(t-1),N=e.charCodeAt(t+1);if(o){if(Number.isNaN(N)||!d(N)||p.has(I)||p.has(N)){if(u)return{n:null,pos:t};l.unexpectedNumericSeparator(t,r,n)}}else{if(u)return{n:null,pos:t};l.numericSeparatorInEscapeSequence(t,r,n)}++t;continue}if(T>=97?w=T-97+10:T>=65?w=T-65+10:dX(T)?w=T-48:w=1/0,w>=s){if(w<=9&&u)return{n:null,pos:t};if(w<=9&&l.invalidDigit(t,r,n,s))w=0;else if(a)w=0,m=!0;else break}++t,g=g*s+w}return t===c||i!=null&&t-c!==i||m?{n:null,pos:t}:{n:g,pos:t}}function FS(e,t,r,n,s,i){let a=e.charCodeAt(t),o;if(a===123){if(++t,{code:o,pos:t}=Im(e,t,r,n,e.indexOf("}",t)-t,!0,s,i),++t,o!==null&&o>1114111)if(s)i.invalidCodePoint(t,r,n);else return{code:null,pos:t}}else({code:o,pos:t}=Im(e,t,r,n,4,!1,s,i));return{code:o,pos:t}}function No(e,t,r){return new Wn(r,e-t,e)}var yX=new Set([103,109,115,105,121,117,100,118]),Vn=class{constructor(t){let r=t.startIndex||0;this.type=t.type,this.value=t.value,this.start=r+t.start,this.end=r+t.end,this.loc=new ga(t.startLoc,t.endLoc)}},_m=class extends Dm{constructor(t,r){super(),this.isLookahead=void 0,this.tokens=[],this.errorHandlers_readInt={invalidDigit:(n,s,i,a)=>this.optionFlags&2048?(this.raise(O.InvalidDigit,No(n,s,i),{radix:a}),!0):!1,numericSeparatorInEscapeSequence:this.errorBuilder(O.NumericSeparatorInEscapeSequence),unexpectedNumericSeparator:this.errorBuilder(O.UnexpectedNumericSeparator)},this.errorHandlers_readCodePoint=Object.assign({},this.errorHandlers_readInt,{invalidEscapeSequence:this.errorBuilder(O.InvalidEscapeSequence),invalidCodePoint:this.errorBuilder(O.InvalidCodePoint)}),this.errorHandlers_readStringContents_string=Object.assign({},this.errorHandlers_readCodePoint,{strictNumericEscape:(n,s,i)=>{this.recordStrictModeErrors(O.StrictNumericEscape,No(n,s,i))},unterminated:(n,s,i)=>{throw this.raise(O.UnterminatedString,No(n-1,s,i))}}),this.errorHandlers_readStringContents_template=Object.assign({},this.errorHandlers_readCodePoint,{strictNumericEscape:this.errorBuilder(O.StrictNumericEscape),unterminated:(n,s,i)=>{throw this.raise(O.UnterminatedTemplate,No(n,s,i))}}),this.state=new wm,this.state.init(t),this.input=r,this.length=r.length,this.comments=[],this.isLookahead=!1}pushToken(t){this.tokens.length=this.state.tokensLength,this.tokens.push(t),++this.state.tokensLength}next(){this.checkKeywordEscapes(),this.optionFlags&256&&this.pushToken(new Vn(this.state)),this.state.lastTokEndLoc=this.state.endLoc,this.state.lastTokStartLoc=this.state.startLoc,this.nextToken()}eat(t){return this.match(t)?(this.next(),!0):!1}match(t){return this.state.type===t}createLookaheadState(t){return{pos:t.pos,value:null,type:t.type,start:t.start,end:t.end,context:[this.curContext()],inType:t.inType,startLoc:t.startLoc,lastTokEndLoc:t.lastTokEndLoc,curLine:t.curLine,lineStart:t.lineStart,curPosition:t.curPosition}}lookahead(){let t=this.state;this.state=this.createLookaheadState(t),this.isLookahead=!0,this.nextToken(),this.isLookahead=!1;let r=this.state;return this.state=t,r}nextTokenStart(){return this.nextTokenStartSince(this.state.pos)}nextTokenStartSince(t){return ym.lastIndex=t,ym.test(this.input)?ym.lastIndex:t}lookaheadCharCode(){return this.lookaheadCharCodeSince(this.state.pos)}lookaheadCharCodeSince(t){return this.input.charCodeAt(this.nextTokenStartSince(t))}nextTokenInLineStart(){return this.nextTokenInLineStartSince(this.state.pos)}nextTokenInLineStartSince(t){return gm.lastIndex=t,gm.test(this.input)?gm.lastIndex:t}lookaheadInLineCharCode(){return this.input.charCodeAt(this.nextTokenInLineStart())}codePointAtPos(t){let r=this.input.charCodeAt(t);if((r&64512)===55296&&++t<this.input.length){let n=this.input.charCodeAt(t);(n&64512)===56320&&(r=65536+((r&1023)<<10)+(n&1023))}return r}setStrict(t){this.state.strict=t,t&&(this.state.strictErrors.forEach(([r,n])=>this.raise(r,n)),this.state.strictErrors.clear())}curContext(){return thi Line truncated
`),cooked:i===null?null:i.slice(1,u)},o.tail=l,this.next();let p=this.finishNode(o,"TemplateElement");return this.resetEndLocation(p,Fr(this.state.lastTokEndLoc,u)),p}parseTemplate(t){let r=this.startNode(),n=this.parseTemplateElement(t),s=[n],i=[];for(;!n.tail;)i.push(this.parseTemplateSubstitution()),this.readTemplateContinuation(),s.push(n=this.parseTemplateElement(t));return r.expressions=i,r.quasis=s,this.finishNode(r,"TemplateLiteral")}parseTemplateSubstitution(){return this.parseExpression()}parseObjectLike(t,r,n,s){n&&this.expectPlugin("recordAndTuple");let i=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!1;let a=!1,o=!0,l=this.startNode();for(l.properties=[],this.next();!this.match(t);){if(o)o=!1;else if(this.expect(12),this.match(t)){this.addTrailingCommaExtraToNode(l);break}let c;r?c=this.parseBindingProperty():(c=this.parsePropertyDefinition(s),a=this.checkProto(c,n,a,s)),n&&!this.isObjectProperty(c)&&c.type!=="SpreadElement"&&this.raise(O.InvalidRecordProperty,c),c.shorthand&&this.addExtra(c,"shorthand",!0),l.properties.push(c)}this.next(),this.state.inFSharpPipelineDirectBody=i;let u="ObjectExpression";return r?u="ObjectPattern":n&&(u="RecordExpression"),this.finishNode(l,u)}addTrailingCommaExtraToNode(t){this.addExtra(t,"trailingComma",this.state.lastTokStartLoc.index),this.addExtra(t,"trailingCommaLoc",this.state.lastTokStartLoc,!1)}maybeAsyncOrAccessorProp(t){return!t.computed&&t.key.type==="Identifier"&&(this.isLiteralPropertyName()||this.match(0)||this.match(55))}parsePropertyDefinition(t){let r=[];if(this.match(26))for(this.hasPlugin("decorators")&&this.raise(O.UnsupportedPropertyDecorator,this.state.startLoc);this.match(26);)r.push(this.parseDecorator());let n=this.startNode(),s=!1,i=!1,a;if(this.match(21))return r.length&&this.unexpected(),this.parseSpread();r.length&&(n.decorators=r,r=[]),n.method=!1,t&&(a=this.state.startLoc);let o=this.eat(55);this.parsePropertyNamePrefixOperator(n);let l=this.state.containsEsc;if(this.parsePropertyName(n,t),!o&&!l&&this.maybeAsyncOrAccessorProp(n)){let{key:u}=n,c=u.name;c==="async"&&!this.hasPrecedingLineBreak()&&(s=!0,this.resetPreviousNodeTrailingComments(u),o=this.eat(55),this.parsePropertyName(n)),(c==="get"||c==="set")&&(i=!0,this.resetPreviousNodeTrailingComments(u),n.kind=c,this.match(55)&&(o=!0,this.raise(O.AccessorIsGenerator,this.state.curPosition(),{kind:c}),this.next()),this.parsePropertyName(n))}return this.parseObjPropValue(n,a,o,s,!1,i,t)}getGetterSetterExpectedParamCount(t){return t.kind==="get"?0:1}getObjectOrClassMethodParams(t){return t.params}checkGetterSetterParams(t){var r;let n=this.getGetterSetterExpectedParamCount(t),s=this.getObjectOrClassMethodParams(t);s.length!==n&&this.raise(t.kind==="get"?O.BadGetterArity:O.BadSetterArity,t),t.kind==="set"&&((r=s[s.length-1])==null?void 0:r.type)==="RestElement"&&this.raise(O.BadSetterRestParameter,t)}parseObjectMethod(t,r,n,s,i){if(i){let a=this.parseMethod(t,r,!1,!1,!1,"ObjectMethod");return this.checkGetterSetterParams(a),a}if(n||r||this.match(10))return s&&this.unexpected(),t.kind="method",t.method=!0,this.parseMethod(t,r,n,!1,!1,"ObjectMethod")}parseObjectProperty(t,r,n,s){if(t.shorthand=!1,this.eat(14))return t.value=n?this.parseMaybeDefault(this.state.startLoc):this.parseMaybeAssignAllowInOrVoidPattern(8,s),this.finishObjectProperty(t);if(!t.computed&&t.key.type==="Identifier"){if(this.checkReservedWord(t.key.name,t.key.loc.start,!0,!1),n)t.value=this.parseMaybeDefault(r,this.cloneIdentifier(t.key));else if(this.match(29)){let i=this.state.startLoc;s!=null?s.shorthandAssignLoc===null&&(s.shorthandAssignLoc=i):this.raise(O.InvalidCoverInitializedName,i),t.value=this.parseMaybeDefault(r,this.cloneIdentifier(t.key))}else t.value=this.cloneIdentifier(t.key);return t.shorthand=!0,this.finishObjectProperty(t)}}finishObjectProperty(t){return this.finishNode(t,"ObjectProperty")}parseObjPropValue(t,r,n,s,i,a,o){let l=this.parseObjectMethod(t,n,s,i,a)||this.parseObjectProperty(t,r,i,o);return l||this.unexpected(),l}parsePropertyName(t,r){if(this.eat(0))t.computed=!0,t.key=this.parseMaybeAssignAllowIn(),this.expect(3);else{let{type:n,value:s}=this.state,i;if(Sn(n))i=this.parseIdentifier(!0);else switch(n){case 135:i=this.parseNumericLiteral(s);break;case 134:i=this.parseStringLiteral(s);break;case 136:i=this.parseBigIntLiteral(s);break;case 139:{let a=this.state.startLoc;r!=null?r.privateKeyLoc===null&&(r.privateKeyLoc=a):this.raise(O.UnexpectedPrivateField,a),i=this.parsePrivateName();break}default:if(n===137){i=this.parseDecimalLiteral(s);break}this.unexpected()}t.key=i,n!==139&&(t.computed=!1)}}initFunction(t,r){t.id=null,t.generator=!1,t.async=r}parseMethod(t,r,n,s,i,a,o=!1){this.initFunction(t,n),t.generator=r,this.scope.enter(530|(o?576:0)|(i?32:0)),this.prodParam.enter(_u(n,t.generator)),this.parseFunctionParams(t,s);let l=this.parseFunctionBodyAndFinish(t,a,!0);return this.prodParam.exit(),this.scope.exit(),l}parseArrayLike(t,r,n,s){n&&this.expectPlu Line truncated
`):r+=s;return r}var GS=!1,XS=/\r\n|[\n\r\u2028\u2029]/;function XX(e,t,r){let n=Object.assign({column:0,line:-1},e.start),s=Object.assign({},n,e.end),{linesAbove:i=2,linesBelow:a=3}=r||{},o=n.line,l=n.column,u=s.line,c=s.column,p=Math.max(o-(i+1),0),d=Math.min(t.length,u+a);o===-1&&(p=0),u===-1&&(d=t.length);let m=u-o,g={};if(m)for(let f=0;f<=m;f++){let b=f+o;if(!l)g[b]=!0;else if(f===0){let T=t[b-1].length;g[b]=[l,T-l+1]}else if(f===m)g[b]=[0,c];else{let T=t[b-f].length;g[b]=[0,T]}}else l===c?l?g[o]=[l,0]:g[o]=!0:g[o]=[l,c-l];return{start:p,end:d,markerLines:g}}function ZS(e,t,r={}){let n=r.forceColor||VX()&&r.highlightCode,s=JS(n),i=e.split(XS),{start:a,end:o,markerLines:l}=XX(t,i,r),u=t.start&&typeof t.start.column=="number",c=String(o).length,d=(n?QS(e):e).split(XS,o).slice(a,o).map((m,g)=>{let f=a+1+g,T=` ${` ${f}`.slice(-c)} |`,w=l[f],I=!l[f+1];if(w){let N="";if(Array.isArray(w)){let L=m.slice(0,Math.max(w[0]-1,0)).replace(/[^\t]/g," "),W=w[1]||1;N=[`
`,s.gutter(T.replace(/\d/g," "))," ",L,s.marker("^").repeat(W)].join(""),I&&r.message&&(N+=" "+s.message(r.message))}return[s.marker(">"),s.gutter(T),m.length>0?` ${m}`:"",N].join("")}else return` ${s.gutter(T)}${m.length>0?` ${m}`:""}`}).join(`
`);return r.message&&!u&&(d=`${" ".repeat(c+1)}${r.message}
${d}`),n?s.reset(d):d}function YX(e,t,r,n={}){if(!GS){GS=!0;let i="Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";if(process.emitWarning)process.emitWarning(i,"DeprecationWarning");else{let a=new Error(i);a.name="DeprecationWarning",console.warn(new Error(i))}}return r=Math.max(r,0),ZS(e,{start:{column:r,line:t}},n)}qo.codeFrameColumns=ZS;qo.default=YX;qo.highlight=QS});var Qm=x(zm=>{"use strict";Object.defineProperty(zm,"__esModule",{value:!0});zm.default=uY;var JX=Fe(),zX=Ro(),QX=Ta(),{isCallExpression:ZX,isExpressionStatement:eY,isFunction:tY,isIdentifier:rY,isJSXIdentifier:nY,isNewExpression:sY,isPlaceholder:Ru,isStatement:iY,isStringLiteral:ev,removePropertiesDeep:aY,traverse:oY}=JX,lY=/^[_$A-Z0-9]+$/;function uY(e,t,r){let{placeholderWhitelist:n,placeholderPattern:s,preserveComments:i,syntacticPlaceholders:a}=r,o=fY(t,r.parser,a);aY(o,{preserveComments:i}),e.validate(o);let l={syntactic:{placeholders:[],placeholderNames:new Set},legacy:{placeholders:[],placeholderNames:new Set},placeholderWhitelist:n,placeholderPattern:s,syntacticPlaceholders:a};return oY(o,cY,l),Object.assign({ast:o},l.syntactic.placeholders.length?l.syntactic:l.legacy)}function cY(e,t,r){var n;let s,i=r.syntactic.placeholders.length>0;if(Ru(e)){if(r.syntacticPlaceholders===!1)throw new Error("%%foo%%-style placeholders can't be used when '.syntacticPlaceholders' is false.");s=e.name.name,i=!0}else{if(i||r.syntacticPlaceholders)return;if(rY(e)||nY(e))s=e.name;else if(ev(e))s=e.value;else return}if(i&&(r.placeholderPattern!=null||r.placeholderWhitelist!=null))throw new Error("'.placeholderWhitelist' and '.placeholderPattern' aren't compatible with '.syntacticPlaceholders: true'");if(!i&&(r.placeholderPattern===!1||!(r.placeholderPattern||lY).test(s))&&!((n=r.placeholderWhitelist)!=null&&n.has(s)))return;t=t.slice();let{node:a,key:o}=t[t.length-1],l;ev(e)||Ru(e,{expectedNode:"StringLiteral"})?l="string":sY(a)&&o==="arguments"||ZX(a)&&o==="arguments"||tY(a)&&o==="params"?l="param":eY(a)&&!Ru(e)?(l="statement",t=t.slice(0,-1)):iY(e)&&Ru(e)?l="statement":l="other";let{placeholders:u,placeholderNames:c}=i?r.syntactic:r.legacy;u.push({name:s,type:l,resolve:p=>pY(p,t),isDuplicate:c.has(s)}),c.add(s)}function pY(e,t){let r=e;for(let i=0;i<t.length-1;i++){let{key:a,index:o}=t[i];o===void 0?r=r[a]:r=r[a][o]}let{key:n,index:s}=t[t.length-1];return{parent:r,key:n,index:s}}function fY(e,t,r){let n=(t.plugins||[]).slice();r!==!1&&n.push("placeholders"),t=Object.assign({allowAwaitOutsideFunction:!0,allowReturnOutsideFunction:!0,allowNewTargetOutsideFunction:!0,allowSuperOutsideMethod:!0,allowYieldOutsideFunction:!0,sourceType:"module"},t,{plugins:n});try{return(0,zX.parse)(e,t)}catch(s){let i=s.loc;throw i&&(s.message+=`
`+(0,QX.codeFrameColumns)(e,{start:i}),s.code="BABEL_TEMPLATE_PARSE_ERROR"),s}}});var ry=x(ty=>{"use strict";Object.defineProperty(ty,"__esModule",{value:!0});ty.default=bY;var dY=Fe(),{blockStatement:hY,cloneNode:ey,emptyStatement:mY,expressionStatement:Zm,identifier:qu,isStatement:tv,isStringLiteral:yY,stringLiteral:gY,validate:rv}=dY;function bY(e,t){let r=ey(e.ast);return t&&(e.placeholders.forEach(n=>{if(!hasOwnProperty.call(t,n.name)){let s=n.name;throw new Error(`Error: No substitution given for "${s}". If this is not meant to be a
placeholder you may want to consider passing one of the following options to @babel/template:
- { placeholderPattern: false, placeholderWhitelist: new Set(['${s}'])}
- { placeholderPattern: /^${s}$/ }`)}}),Object.keys(t).forEach(n=>{if(!e.placeholderNames.has(n))throw new Error(`Unknown substitution "${n}" given`)})),e.placeholders.slice().reverse().forEach(n=>{try{var s;EY(n,r,(s=t&&t[n.name])!=null?s:null)}catch(i){throw i.message=`@babel/template placeholder "${n.name}": ${i.message}`,i}}),r}function EY(e,t,r){e.isDuplicate&&(Array.isArray(r)?r=r.map(o=>ey(o)):typeof r=="object"&&(r=ey(r)));let{parent:n,key:s,index:i}=e.resolve(t);if(e.type==="string"){if(typeof r=="string"&&(r=gY(r)),!r||!yY(r))throw new Error("Expected string substitution")}else if(e.type==="statement")i===void 0?r?Array.isArray(r)?r=hY(r):typeof r=="string"?r=Zm(qu(r)):tv(r)||(r=Zm(r)):r=mY():r&&!Array.isArray(r)&&(typeof r=="string"&&(r=qu(r)),tv(r)||(r=Zm(r)));else if(e.type==="param"){if(typeof r=="string"&&(r=qu(r)),i===void 0)throw new Error("Assertion failure.")}else if(typeof r=="string"&&(r=qu(r)),Array.isArray(r))throw new Error("Cannot replace single expression with an array.");function a(o,l,u){let c=o[l];o[l]=u,(c.type==="Identifier"||c.type==="Placeholder")&&(c.typeAnnotation&&(u.typeAnnotation=c.typeAnnotation),c.optional&&(u.optional=c.optional),c.decorators&&(u.decorators=c.decorators))}if(i===void 0)rv(n,s,r),a(n,s,r);else{let o=n[s].slice();e.type==="statement"||e.type==="param"?r==null?o.splice(i,1):Array.isArray(r)?o.splice(i,1,...r):a(o,i,r):a(o,i,r),rv(n,s,o),n[s]=o}}});var nv=x(ny=>{"use strict";Object.defineProperty(ny,"__esModule",{value:!0});ny.default=vY;var TY=Au(),xY=Qm(),SY=ry();function vY(e,t,r){t=e.code(t);let n;return s=>{let i=(0,TY.normalizeReplacements)(s);return n||(n=(0,xY.default)(e,t,r)),e.unwrap((0,SY.default)(n,i))}}});var sv=x(sy=>{"use strict";Object.defineProperty(sy,"__esModule",{value:!0});sy.default=DY;var PY=Au(),AY=Qm(),CY=ry();function DY(e,t,r){let{metadata:n,names:s}=wY(e,t,r);return i=>{let a={};return i.forEach((o,l)=>{a[s[l]]=o}),o=>{let l=(0,PY.normalizeReplacements)(o);return l&&Object.keys(l).forEach(u=>{if(hasOwnProperty.call(a,u))throw new Error("Unexpected replacement overlap.")}),e.unwrap((0,CY.default)(n,l?Object.assign(l,a):a))}}}function wY(e,t,r){let n="BABEL_TPL$",s=t.join("");do n="$$"+n;while(s.includes(n));let{names:i,code:a}=IY(t,n);return{metadata:(0,AY.default)(e,e.code(a),{parser:r.parser,placeholderWhitelist:new Set(i.concat(r.placeholderWhitelist?Array.from(r.placeholderWhitelist):[])),placeholderPattern:r.placeholderPattern,preserveComments:r.preserveComments,syntacticPlaceholders:r.syntacticPlaceholders}),names:i}}function IY(e,t){let r=[],n=e[0];for(let s=1;s<e.length;s++){let i=`${t}${s-1}`;r.push(i),n+=i+e[s]}return{names:r,code:n}}});var cv=x(iy=>{"use strict";Object.defineProperty(iy,"__esModule",{value:!0});iy.default=uv;var Kn=Au(),iv=nv(),av=sv(),ov=(0,Kn.validate)({placeholderPattern:!1});function uv(e,t){let r=new WeakMap,n=new WeakMap,s=t||(0,Kn.validate)(null);return Object.assign((i,...a)=>{if(typeof i=="string"){if(a.length>1)throw new Error("Unexpected extra params.");return lv((0,iv.default)(e,i,(0,Kn.merge)(s,(0,Kn.validate)(a[0]))))}else if(Array.isArray(i)){let o=r.get(i);return o||(o=(0,av.default)(e,i,s),r.set(i,o)),lv(o(a))}else if(typeof i=="object"&&i){if(a.length>0)throw new Error("Unexpected extra params.");return uv(e,(0,Kn.merge)(s,(0,Kn.validate)(i)))}throw new Error(`Unexpected template param ${typeof i}`)},{ast:(i,...a)=>{if(typeof i=="string"){if(a.length>1)throw new Error("Unexpected extra params.");return(0,iv.default)(e,i,(0,Kn.merge)((0,Kn.merge)(s,(0,Kn.validate)(a[0])),ov))()}else if(Array.isArray(i)){let o=n.get(i);return o||(o=(0,av.default)(e,i,(0,Kn.merge)(s,ov)),n.set(i,o)),o(a)()}throw new Error(`Unexpected template param ${typeof i}`)}})}function lv(e){let t="";try{throw new Error}catch(r){r.stack&&(t=r.stack.split(`
`).slice(3).join(`
`))}return r=>{try{return e(r)}catch(n){throw n.stack+=`
=============
${t}`,n}}}});var $o=x(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.statements=Hr.statement=Hr.smart=Hr.program=Hr.expression=Hr.default=void 0;var Uo=cS(),Vo=cv(),ay=Hr.smart=(0,Vo.default)(Uo.smart),_Y=Hr.statement=(0,Vo.default)(Uo.statement),NY=Hr.statements=(0,Vo.default)(Uo.statements),OY=Hr.expression=(0,Vo.default)(Uo.expression),BY=Hr.program=(0,Vo.default)(Uo.program),jwe=Hr.default=Object.assign(ay.bind(void 0),{smart:ay,statement:_Y,statements:NY,expression:OY,program:BY,ast:ay.ast})});var pv=x(Uu=>{"use strict";Object.defineProperty(Uu,"__esModule",{value:!0});Uu.default=void 0;var kY=$o();function X(e,t,r){return Object.freeze({minVersion:e,ast:()=>kY.default.program.ast(t,{preserveComments:!0}),metadata:r})}var FY=Uu.default={__proto__:null,OverloadYield:X("7.18.14","function _OverloadYield(e,d){this.v=e,this.k=d}",{globals:[],locals:{_OverloadYield:["body.0.id"]},exportBindingAssignments:[],exportName:"_OverloadYield",dependencies:{},internal:!1}),applyDecoratedDescriptor:X("7.0.0-beta.0",'function _applyDecoratedDescriptor(i,e,r,n,l){var a={};return Object.keys(n).forEach((function(i){a[i]=n[i]})),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=r.slice().reverse().reduce((function(r,n){return n(i,e,r)||r}),a),l&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(l):void 0,a.initializer=void 0),void 0===a.initializer?(Object.defineProperty(i,e,a),null):a}',{globals:["Object"],locals:{_applyDecoratedDescriptor:["body.0.id"]},exportBindingAssignments:[],exportName:"_applyDecoratedDescriptor",dependencies:{},internal:!1}),applyDecs2311:X("7.24.0",'function applyDecs2311(e,t,n,r,o,i){var a,c,u,s,f,l,p,d=Symbol.metadata||Symbol.for("Symbol.metadata"),m=Object.defineProperty,h=Object.create,y=[h(null),h(null)],v=t.length;function g(t,n,r){return function(o,i){n&&(i=o,o=e);for(var a=0;a<t.length;a++)i=t[a].apply(o,r?[i]:[]);return r?i:o}}function b(e,t,n,r){if("function"!=typeof e&&(r||void 0!==e))throw new TypeError(t+" must "+(n||"be")+" a function"+(r?"":" or undefined"));return e}function applyDec(e,t,n,r,o,i,u,s,f,l,p){function d(e){if(!p(e))throw new TypeError("Attempted to access private element on non-instance")}var h=[].concat(t[0]),v=t[3],w=!u,D=1===o,S=3===o,j=4===o,E=2===o;function I(t,n,r){return function(o,i){return n&&(i=o,o=e),r&&r(o),P[t].call(o,i)}}if(!w){var P={},k=[],F=S?"get":j||D?"set":"value";if(f?(l||D?P={get:setFunctionName((function(){return v(this)}),r,"get"),set:function(e){t[4](this,e)}}:P[F]=v,l||setFunctionName(P[F],r,E?"":F)):l||(P=Object.getOwnPropertyDescriptor(e,r)),!l&&!f){if((c=y[+s][r])&&7!=(c^o))throw Error("Decorating two elements with the same name ("+P[F].name+") is not supported yet");y[+s][r]=o<3?1:o}}for(var N=e,O=h.length-1;O>=0;O-=n?2:1){var T=b(h[O],"A decorator","be",!0),z=n?h[O-1]:void 0,A={},H={kind:["field","accessor","method","getter","setter","class"][o],name:r,metadata:a,addInitializer:function(e,t){if(e.v)throw new TypeError("attempted to call addInitializer after decoration was finished");b(t,"An initializer","be",!0),i.push(t)}.bind(null,A)};if(w)c=T.call(z,N,H),A.v=1,b(c,"class decorators","return")&&(N=c);else if(H.static=s,H.private=f,c=H.access={has:f?p.bind():function(e){return r in e}},j||(c.get=f?E?function(e){return d(e),P.value}:I("get",0,d):function(e){return e[r]}),E||S||(c.set=f?I("set",0,d):function(e,t){e[r]=t}),N=T.call(z,D?{get:P.get,set:P.set}:P[F],H),A.v=1,D){if("object"==typeof N&&N)(c=b(N.get,"accessor.get"))&&(P.get=c),(c=b(N.set,"accessor.set"))&&(P.set=c),(c=b(N.init,"accessor.init"))&&k.unshift(c);else if(void 0!==N)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else b(N,(l?"field":"method")+" decorators","return")&&(l?k.unshift(N):P[F]=N)}return o<2&&u.push(g(k,s,1),g(i,s,0)),l||w||(f?D?u.splice(-1,0,I("get",s),I("set",s)):u.push(E?P[F]:b.call.bind(P[F])):m(e,r,P)),N}function w(e){return m(e,d,{configurable:!0,enumerable:!0,value:a})}return void 0!==i&&(a=i[d]),a=h(null==a?null:a),f=[],l=function(e){e&&f.push(g(e))},p=function(t,r){for(var i=0;i<n.length;i++){var a=n[i],c=a[1],l=7&c;if((8&c)==t&&!l==r){var p=a[2],d=!!a[3],m=16&c;applyDec(t?e:e.prototype,a,m,d?"#"+p:toPropertyKey(p),l,l<2?[]:t?s=s||[]:u=u||[],f,!!t,d,r,t&&d?function(t){return checkInRHS(t)===e}:o)}}},p(8,0),p(0,0),p(8,1),p(0,1),l(u),l(s),c=f,v||w(e),{e:c,get c(){var n=[];return v&&[w(e=applyDec(e,[t],r,e.name,5,n)),g(n,1)]}}}',{globals:["Symbol","Object","TypeError","Error"],locals:{applyDecs2311:["body.0.id"]},exportBindingAssignments:[],exportName:"applyDecs2311",dependencies:{checkInRHS:["body.0.body.body.5.argument.expressions.4.right.body.body.0.body.body.1.consequent.body.1.expression.arguments.10.consequent.body.body.0.argument.left.callee"],setFunctionName:["body.0.body.body.3.body.body.3.consequent.body.1.test.expressions.0.consequent.expressions.0.consequent.right.properties.0.v Line truncated
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof Generator?n:Generator,u=Object.create(c.prototype);return define(u,"_invoke",function(r,n,o){var i,c,u,f=0,p=o||[],y=!1,G={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,c=0,u=e,G.n=r,a}};function d(r,n){for(c=r,u=n,t=0;!y&&f&&!o&&t<p.length;t++){var o,i=p[t],d=G.p,l=i[2];r>3?(o=l===n)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(c=0,G.v=n,G.n=i[1]):d<l&&(o=r<3||i[0]>n||n>l)&&(i[4]=r,i[5]=n,G.n=l,c=0))}if(o||r>1)return a;throw y=!0,n}return function(o,p,l){if(f>1)throw TypeError("Generator is already running");for(y&&1===p&&d(p,l),c=p,u=l;(t=c<2?e:u)||!y;){i||(c?c<3?(c>1&&(G.n=-1),d(c,u)):G.n=u:G.v=u);try{if(f=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(y=G.n<0)?u:r.call(n,G))!==a)break}catch(t){i=e,c=1,u=t}finally{f=1}}return{value:t,done:y}}}(r,o,i),!0),u}var a={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}t=Object.getPrototypeOf;var c=[][n]?t(t([][n]())):(define(t={},n,(function(){return this})),t),u=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(c);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,GeneratorFunctionPrototype):(e.__proto__=GeneratorFunctionPrototype,define(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(u,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName="GeneratorFunction",define(GeneratorFunctionPrototype,o,"GeneratorFunction"),define(u),define(u,o,"Generator"),define(u,n,(function(){return this})),define(u,"toString",(function(){return"[object Generator]"})),(_regenerator=function(){return{w:i,m:f}})()}`,{globals:["Symbol","Object","TypeError"],locals:{_regenerator:["body.0.id","body.0.body.body.9.argument.expressions.9.callee.left"]},exportBindingAssignments:["body.0.body.body.9.argument.expressions.9.callee"],exportName:"_regenerator",dependencies:{regeneratorDefine:["body.0.body.body.1.body.body.1.argument.expressions.0.callee","body.0.body.body.7.declarations.0.init.alternate.expressions.0.callee","body.0.body.body.8.body.body.0.argument.expressions.0.alternate.expressions.1.callee","body.0.body.body.9.argument.expressions.1.callee","body.0.body.body.9.argument.expressions.2.callee","body.0.body.body.9.argument.expressions.4.callee","body.0.body.body.9.argument.expressions.5.callee","body.0.body.body.9.argument.expressions.6.callee","body.0.body.body.9.argument.expressions.7.callee","body.0.body.body.9.argument.expressions.8.callee"]},internal:!1}),regeneratorAsync:X("7.27.0","function _regeneratorAsync(n,e,r,t,o){var a=asyncGen(n,e,r,t,o);return a.next().then((function(n){return n.done?n.value:a.next()}))}",{globals:[],locals:{_regeneratorAsync:["body.0.id"]},exportBindingAssignments:[],exportName:"_regeneratorAsync",dependencies:{regeneratorAsyncGen:["body.0.body.body.0.declarations.0.init.callee"]},internal:!1}),regeneratorAsyncGen:X("7.27.0","function _regeneratorAsyncGen(r,e,t,o,n){return new regeneratorAsyncIterator(regenerator().w(r,e,t,o),n||Promise)}",{globals:["Promise"],locals:{_regeneratorAsyncGen:["body.0.id"]},exportBindingAssignments:[],exportName:"_regeneratorAsyncGen",dependencies:{regenerator:["body.0.body.body.0.argument.arguments.0.callee.object.callee"],regeneratorAsyncIterator:["body.0.body.body.0.argument.callee"]},internal:!1}),regeneratorAsyncIterator:X("7.27.0",'function AsyncIterator(t,e){function n(r,o,i,f){try{var c=t[r](o),u=c.value;return u instanceof OverloadYield?e.resolve(u.v).then((function(t){n("next",t,i,f)}),(function(t){n("throw",t,i,f)})):e.resolve(u).then((function(t){c.value=t,i(c)}),(function(t){return n("throw",t,i,f)}))}catch(t){f(t)}}var r;this.next||(define(AsyncIterator.prototype),define(AsyncIterator.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",(function(){return this}))),define(this,"_invoke",(function(t,o,i){function f(){return new e((function(e,r){n(t,i,e,r)}))}return r=r?r.then(f,f):f()}),!0)}',{globals:["Symbol"],locals:{AsyncIterator:["body.0.id","body.0.body.body.2.expression.expressions.0.right.expressions.0.arguments.0.object","body.0.body.body.2.expression.expressions.0.right.expressions.1.arguments.0.object"]},exportBindingAssignments:[],exportName:"AsyncIterator",dependencies:{OverloadYield:["body.0.body.body.0.body.body.0.block.body.1.argument.test.right"],regeneratorDefine:["body.0.body.body.2.expression.expressions.0.right.expressions.0.callee","body.0.body.body.2.expression.expressions.0.right.expressions.1.callee","body.0.body.bo Line truncated
`).join(`
`+i),e.push(s+"m+"+Xu.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=oJ()+t+" "+e[0]}function oJ(){return lr.inspectOpts.hideDate?"":new Date().toISOString()+" "}function lJ(...e){return process.stderr.write(Gu.formatWithOptions(lr.inspectOpts,...e)+`
`)}function uJ(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function cJ(){return process.env.DEBUG}function pJ(e){e.inspectOpts={};let t=Object.keys(lr.inspectOpts);for(let r=0;r<t.length;r++)e.inspectOpts[t[r]]=lr.inspectOpts[t[r]]}Xu.exports=py()(lr);var{formatters:vv}=Xu.exports;vv.o=function(e){return this.inspectOpts.colors=this.useColors,Gu.inspect(e,this.inspectOpts).split(`
`).map(t=>t.trim()).join(" ")};vv.O=function(e){return this.inspectOpts.colors=this.useColors,Gu.inspect(e,this.inspectOpts)}});var Ti=x((fIe,dy)=>{typeof process=="undefined"||process.type==="renderer"||process.browser===!0||process.__nwjs?dy.exports=gv():dy.exports=Pv()});var my=x(rr=>{"use strict";Object.defineProperty(rr,"__esModule",{value:!0});rr.isBindingIdentifier=kJ;rr.isBlockScoped=RJ;rr.isExpression=LJ;rr.isFlow=WJ;rr.isForAwaitStatement=GJ;rr.isGenerated=VJ;rr.isPure=$J;rr.isReferenced=MJ;rr.isReferencedIdentifier=OJ;rr.isReferencedMemberExpression=BJ;rr.isRestProperty=KJ;rr.isScope=jJ;rr.isSpreadProperty=HJ;rr.isStatement=FJ;rr.isUser=UJ;rr.isVar=qJ;var fJ=Fe(),{isBinding:dJ,isBlockScoped:hJ,isExportDeclaration:mJ,isExpression:yJ,isFlow:gJ,isForStatement:bJ,isForXStatement:EJ,isIdentifier:Av,isImportDeclaration:TJ,isImportSpecifier:xJ,isJSXIdentifier:SJ,isJSXMemberExpression:vJ,isMemberExpression:PJ,isRestElement:Cv,isReferenced:hy,isScope:AJ,isStatement:CJ,isVar:DJ,isVariableDeclaration:wJ,react:IJ,isForOfStatement:_J}=fJ,{isCompatTag:NJ}=IJ;function OJ(e){let{node:t,parent:r}=this;if(!Av(t,e)&&!vJ(r,e))if(SJ(t,e)){if(NJ(t.name))return!1}else return!1;return hy(t,r,this.parentPath.parent)}function BJ(){let{node:e,parent:t}=this;return PJ(e)&&hy(e,t)}function kJ(){let{node:e,parent:t}=this,r=this.parentPath.parent;return Av(e)&&dJ(e,t,r)}function FJ(){let{node:e,parent:t}=this;return CJ(e)?!(wJ(e)&&(EJ(t,{left:e})||bJ(t,{init:e}))):!1}function LJ(){return this.isIdentifier()?this.isReferencedIdentifier():yJ(this.node)}function jJ(){return AJ(this.node,this.parent)}function MJ(){return hy(this.node,this.parent)}function RJ(){return hJ(this.node)}function qJ(){return DJ(this.node)}function UJ(){return this.node&&!!this.node.loc}function VJ(){return!this.isUser()}function $J(e){return this.scope.isPure(this.node,e)}function WJ(){let{node:e}=this;return gJ(e)?!0:TJ(e)?e.importKind==="type"||e.importKind==="typeof":mJ(e)?e.exportKind==="type":xJ(e)?e.importKind==="type"||e.importKind==="typeof":!1}function KJ(){var e;return Cv(this.node)&&((e=this.parentPath)==null?void 0:e.isObjectPattern())}function HJ(){var e;return Cv(this.node)&&((e=this.parentPath)==null?void 0:e.isObjectExpression())}function GJ(){return _J(this.node,{await:!0})}rr.isExistentialTypeParam=function(){throw new Error("`path.isExistentialTypeParam` has been renamed to `path.isExistsTypeAnnotation()` in Babel 7.")},rr.isNumericLiteralTypeAnnotation=function(){throw new Error("`path.isNumericLiteralTypeAnnotation()` has been renamed to `path.isNumberLiteralTypeAnnotation()` in Babel 7.")}});var Yu=x(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.environmentVisitor=tz;Si.explode=jv;Si.isExplodedVisitor=Lv;Si.merge=Rv;Si.verify=Mv;var Fv=cy(),XJ=my(),YJ=Fe(),Dv=Pn(),{DEPRECATED_KEYS:wv,DEPRECATED_ALIASES:Iv,FLIPPED_ALIAS_KEYS:_v,TYPES:JJ,__internal__deprecationWarning:Nv}=YJ;function zJ(e){return e in Fv}function Lv(e){return e==null?void 0:e._exploded}function jv(e){if(Lv(e))return e;e._exploded=!0;for(let t of Object.keys(e)){if(xi(t))continue;let r=t.split("|");if(r.length===1)continue;let n=e[t];delete e[t];for(let s of r)e[s]=n}Mv(e),delete e.__esModule,QJ(e),kv(e);for(let t of Object.keys(e)){if(xi(t)||!zJ(t))continue;let r=e[t];for(let s of Object.keys(r))r[s]=ZJ(t,r[s]);delete e[t];let n=Fv[t];if(n!==null)for(let s of n)e[s]?Wo(e[s],r):e[s]=r;else Wo(e,r)}for(let t of Object.keys(e)){if(xi(t))continue;let r=_v[t];if(t in wv){let s=wv[t];Nv(t,s,"Visitor "),r=[s]}else if(t in Iv){let s=Iv[t];Nv(t,s,"Visitor "),r=_v[s]}if(!r)continue;let n=e[t];delete e[t];for(let s of r){let i=e[s];i?Wo(i,n):e[s]=Object.assign({},n)}}for(let t of Object.keys(e))xi(t)||kv(e[t]);return e}function Mv(e){if(!e._verified){if(typeof e=="function")throw new Error("You passed `traverse()` a function when it expected a visitor object, are you sure you didn't mean `{ enter: Function }`?");for(let t of Object.keys(e)){if((t==="enter"||t==="exit")&&Ov(t,e[t]),xi(t))continue;if(!JJ.includes(t))throw new Error(`You gave us a visitor for the node type ${t} but it's not a valid type in @babel/traverse 7.28.0`);let r=e[t];if(typeof r=="object")for(let n of Object.keys(r))if(n==="enter"||n==="exit")Ov(`${t}.${n}`,r[n]);else throw new Error(`You passed \`traverse()\` a visitor object with the property ${t} that has the invalid property ${n}`)}e._verified=!0}}function Ov(e,t){let r=[].concat(t);for(let n of r)if(typeof n!="function")throw new TypeError(`Non-function found defined in ${e} with type ${typeof n}`)}function Rv(e,t=[],r){let n={_verified:!0,_exploded:!0};Object.defineProperty(n,"_exploded",{enumerable:!1}),Object.defineProperty(n,"_verified",{enumerable:!1});for(let s=0;s<e.length;s++){let i=jv(e[s]),a=t[s],o=i;(a||r)&&(o=Bv(o,a,r)),Wo(n,o);for(let l of Object.keys(i)){if(xi(l))continue;let u=i[l];(a||r)&&(u=Bv(u,a,r));let c=n[l]||(n[l]={});Wo(c,u)}}return n}function Bv(e,t,r){let n={};for(let s of["enter","exit"]){let i=e[s];ALine truncated
`),d=0;for(p!==0&&this._mark(c,a,o,l,u);p!==-1;)i.line++,i.column=0,d=p+1,d<s&&c!==void 0&&this._mark(++c,0,null,null,u),p=t.indexOf(`
`,d);i.column+=s-d}_mark(t,r,n,s,i){var a;(a=this._map)==null||a.mark(this._position,t,r,n,s,i)}removeTrailingNewline(){let t=this._queueCursor;t!==0&&this._queue[t-1].char===10&&this._queueCursor--}removeLastSemicolon(){let t=this._queueCursor;t!==0&&this._queue[t-1].char===59&&this._queueCursor--}getLastChar(){let t=this._queueCursor;return t!==0?this._queue[t-1].char:this._last}getNewlineCount(){let t=this._queueCursor,r=0;if(t===0)return this._last===10?1:0;for(let n=t-1;n>=0&&this._queue[n].char===10;n--)r++;return r===t&&this._last===10?r+1:r}endsWithCharAndNewline(){let t=this._queue,r=this._queueCursor;if(r!==0)return t[r-1].char!==10?void 0:r>1?t[r-2].char:this._last}hasContent(){return this._queueCursor!==0||!!this._last}exactSource(t,r){if(!this._map){r();return}this.source("start",t);let n=t.identifierName,s=this._sourcePosition;n&&(this._canMarkIdName=!1,s.identifierName=n),r(),n&&(this._canMarkIdName=!0,s.identifierName=void 0,s.identifierNamePos=void 0),this.source("end",t)}source(t,r){this._map&&this._normalizePosition(t,r,0)}sourceWithOffset(t,r,n){this._map&&this._normalizePosition(t,r,n)}_normalizePosition(t,r,n){let s=r[t],i=this._sourcePosition;s&&(i.line=s.line,i.column=Math.max(s.column+n,0),i.filename=r.filename)}getCurrentColumn(){let t=this._queue,r=this._queueCursor,n=-1,s=0;for(let i=0;i<r;i++){let a=t[i];a.char===10&&(n=s),s+=a.repeat}return n===-1?this._position.column+s:s-1-n}getCurrentLine(){let t=0,r=this._queue;for(let n=0;n<this._queueCursor;n++)r[n].char===10&&t++;return this._position.line+t}};sc.default=Fy});var hP=x(ac=>{"use strict";Object.defineProperty(ac,"__esModule",{value:!0});ac.nodes=void 0;var eQ=Fe(),{FLIPPED_ALIAS_KEYS:tQ,isArrayExpression:rQ,isAssignmentExpression:pP,isBinary:fP,isBlockStatement:nQ,isCallExpression:dP,isFunction:Ho,isIdentifier:ic,isLiteral:sQ,isMemberExpression:Ly,isObjectExpression:iQ,isOptionalCallExpression:aQ,isOptionalMemberExpression:oQ,isStringLiteral:lQ}=eQ;function Pa(e,t){return e&&(Ly(e)||oQ(e)?(Pa(e.object,t),e.computed&&Pa(e.property,t)):fP(e)||pP(e)?(Pa(e.left,t),Pa(e.right,t)):dP(e)||aQ(e)?(t.hasCall=!0,Pa(e.callee,t)):Ho(e)?t.hasFunction=!0:ic(e)&&(t.hasHelper=t.hasHelper||e.callee&&ns(e.callee))),t}function cP(e){return Pa(e,{hasCall:!1,hasFunction:!1,hasHelper:!1})}function ns(e){return e?Ly(e)?ns(e.object)||ns(e.property):ic(e)?e.name==="require"||e.name.charCodeAt(0)===95:dP(e)?ns(e.callee):fP(e)||pP(e)?ic(e.left)&&ns(e.left)||ns(e.right):!1:!1}function uQ(e){return sQ(e)||iQ(e)||rQ(e)||ic(e)||Ly(e)}var Ci=ac.nodes={AssignmentExpression(e){let t=cP(e.right);if(t.hasCall&&t.hasHelper||t.hasFunction)return t.hasFunction?3:2},SwitchCase(e,t){return(e.consequent.length||t.cases[0]===e?1:0)|(!e.consequent.length&&t.cases[t.cases.length-1]===e?2:0)},LogicalExpression(e){if(Ho(e.left)||Ho(e.right))return 2},Literal(e){if(lQ(e)&&e.value==="use strict")return 2},CallExpression(e){if(Ho(e.callee)||ns(e))return 3},OptionalCallExpression(e){if(Ho(e.callee))return 3},VariableDeclaration(e){for(let t=0;t<e.declarations.length;t++){let r=e.declarations[t],n=ns(r.id)&&!uQ(r.init);if(!n&&r.init){let s=cP(r.init);n=ns(r.init)&&s.hasCall||s.hasFunction}if(n)return 3}},IfStatement(e){if(nQ(e.consequent))return 3}};Ci.ObjectProperty=Ci.ObjectTypeProperty=Ci.ObjectMethod=function(e,t){if(t.properties[0]===e)return 1};Ci.ObjectTypeCallProperty=function(e,t){var r;if(t.callProperties[0]===e&&!((r=t.properties)!=null&&r.length))return 1};Ci.ObjectTypeIndexer=function(e,t){var r,n;if(t.indexers[0]===e&&!((r=t.properties)!=null&&r.length)&&!((n=t.callProperties)!=null&&n.length))return 1};Ci.ObjectTypeInternalSlot=function(e,t){var r,n,s;if(t.internalSlots[0]===e&&!((r=t.properties)!=null&&r.length)&&!((n=t.callProperties)!=null&&n.length)&&!((s=t.indexers)!=null&&s.length))return 1};[["Function",!0],["Class",!0],["Loop",!0],["LabeledStatement",!0],["SwitchStatement",!0],["TryStatement",!0]].forEach(function([e,t]){[e].concat(tQ[e]||[]).forEach(function(r){let n=t?3:0;Ci[r]=()=>n})})});var SP=x(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.AssignmentExpression=UQ;rt.Binary=EP;rt.BinaryExpression=FQ;rt.ClassExpression=MQ;rt.ArrowFunctionExpression=rt.ConditionalExpression=xP;rt.DoExpression=PQ;rt.FunctionExpression=RQ;rt.FunctionTypeAnnotation=xQ;rt.Identifier=$Q;rt.LogicalExpression=VQ;rt.NullableTypeAnnotation=TQ;rt.ObjectExpression=vQ;rt.OptionalIndexedAccessType=CQ;rt.OptionalCallExpression=rt.OptionalMemberExpression=qQ;rt.SequenceExpression=LQ;rt.TSSatisfiesExpression=rt.TSAsExpression=DQ;rt.TSConditionalType=wQ;rt.TSConstructorType=rt.TSFunctionType=kQ;rt.TSInferType=NQ;rt.TSInstantiationExpression=BQ;rt.TSIntersectionType=_Q;rt.UnaryLike=rt.TSTypeAssertion=TP;rt.TSTypeOperator=OQ;rt.TSUnionType=IQ;rt.IntersectionTypeAnnotation=rt.UnionTypeAnnotation=AQ;rt.UpdateExpression=SQ;rt.AwaitExpression=rt.YieldExpression=jQ;var cQ=Fe(),zr=Di(),{isArrayTypeAnnotation:pQ,isBinaryExpression:fQ,isCallExpression:dQ,isForOfState Line truncated
`,m,g=!0,f=t.numbers=="binary",b=t.numbers=="octal",T=t.numbers=="decimal",w=t.numbers=="hexadecimal";if(s&&e&&dte(e.toJSON)&&(e=e.toJSON()),!pte(e)){if(hte(e))return e.size==0?"new Map()":(a||(t.__inline1__=!0,t.__inline2__=!1),"new Map("+qs(Array.from(e),t)+")");if(mte(e))return e.size==0?"new Set()":"new Set("+qs(Array.from(e),t)+")";if(ute(e))return e.length==0?"Buffer.from([])":"Buffer.from("+qs(Array.from(e),t)+")";if(lte(e))return m=[],t.wrap=!0,c&&(t.__inline1__=!1,t.__inline2__=!0),p||r(),ote(e,N=>{g=!1,p&&(t.__inline2__=!1),m.push((a||p?"":l)+qs(N,t))}),g?"[]":p?"["+m.join(", ")+"]":"["+d+m.join(","+d)+d+(a?"":u)+"]";if(fte(e)||$y(e)){if(s)return JSON.stringify(Number(e));let N;if(T)N=String(e);else if(w){let L=e.toString(16);o||(L=L.toUpperCase()),N="0x"+L}else f?N="0b"+e.toString(2):b&&(N="0o"+e.toString(8));return $y(e)?N+"n":N}else return $y(e)?s?JSON.stringify(Number(e)):e+"n":cte(e)?(m=[],t.wrap=!0,r(),qP(e,(N,L)=>{g=!1,m.push((a?"":l)+qs(N,t)+":"+(a?"":" ")+qs(L,t))}),g?"{}":"{"+d+m.join(","+d)+d+(a?"":u)+"}"):s?JSON.stringify(e)||"null":String(e)}let I=t.escapeEverything?Tte:xte;return m=e.replace(I,(N,L,W,U,H,pe)=>{if(L){if(t.minimal)return L;let ce=L.charCodeAt(0),qe=L.charCodeAt(1);if(t.es6){let ze=(ce-55296)*1024+qe-56320+65536;return"\\u{"+Go(ze,o)+"}"}return pc(Go(ce,o))+pc(Go(qe,o))}if(W)return pc(Go(W.charCodeAt(0),o));if(N=="\0"&&!s&&!bte.test(pe.charAt(H+1)))return"\\0";if(U)return U==i||t.escapeEverything?"\\"+U:U;if(gte.test(N))return yte[N];if(t.minimal&&!Ete.test(N))return N;let Ee=Go(N.charCodeAt(0),o);return s||Ee.length>2?pc(Ee):"\\x"+("00"+Ee).slice(-2)}),i=="`"&&(m=m.replace(/\$\{/g,"\\${")),t.isScriptContext&&(m=m.replace(/<\/(script|style)/gi,"<\\/$1").replace(/<!--/g,s?"\\u003C!--":"\\x3C!--")),t.wrap&&(m=i+m+i),m};qs.version="3.0.2";UP.exports=qs});var Ky=x(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.ArgumentPlaceholder=Cte;Nt.ArrayPattern=Nt.ArrayExpression=Nte;Nt.BigIntLiteral=Rte;Nt.BooleanLiteral=Fte;Nt.Identifier=Ate;Nt.NullLiteral=Lte;Nt.NumericLiteral=jte;Nt.ObjectPattern=Nt.ObjectExpression=wte;Nt.ObjectMethod=Ite;Nt.ObjectProperty=_te;Nt.PipelineBareFunction=Vte;Nt.PipelinePrimaryTopicReference=$te;Nt.PipelineTopicExpression=Ute;Nt.RecordExpression=Ote;Nt.RegExpLiteral=kte;Nt.SpreadElement=Nt.RestElement=Dte;Nt.StringLiteral=Mte;Nt.TopicReference=qte;Nt.TupleExpression=Bte;Nt.VoidPattern=Wte;Nt._getRawIdentifier=Pte;var Ste=Fe(),KP=VP(),{isAssignmentPattern:vte,isIdentifier:Wy}=Ste,$P=null,fc="";function Pte(e){if(e===$P)return fc;$P=e;let{name:t}=e,r=this.tokenMap.find(e,n=>n.value===t);return r?(fc=this._originalCode.slice(r.start,r.end),fc):fc=e.name}function Ate(e){var t;this.sourceIdentifierName(((t=e.loc)==null?void 0:t.identifierName)||e.name),this.word(this.tokenMap?this._getRawIdentifier(e):e.name)}function Cte(){this.tokenChar(63)}function Dte(e){this.token("..."),this.print(e.argument)}function wte(e){let t=e.properties;if(this.tokenChar(123),t.length){let r=this.enterDelimited();this.space(),this.printList(t,this.shouldPrintTrailingComma("}"),!0,!0),this.space(),r()}this.sourceWithOffset("end",e.loc,-1),this.tokenChar(125)}function Ite(e){this.printJoin(e.decorators),this._methodHead(e),this.space(),this.print(e.body)}function _te(e){if(this.printJoin(e.decorators),e.computed)this.tokenChar(91),this.print(e.key),this.tokenChar(93);else{if(vte(e.value)&&Wy(e.key)&&e.key.name===e.value.left.name){this.print(e.value);return}if(this.print(e.key),e.shorthand&&Wy(e.key)&&Wy(e.value)&&e.key.name===e.value.name)return}this.tokenChar(58),this.space(),this.print(e.value)}function Nte(e){let t=e.elements,r=t.length;this.tokenChar(91);let n=this.enterDelimited();for(let s=0;s<t.length;s++){let i=t[s];i?(s>0&&this.space(),this.print(i),(s<r-1||this.shouldPrintTrailingComma("]"))&&this.token(",",!1,s)):this.token(",",!1,s)}n(),this.tokenChar(93)}function Ote(e){let t=e.properties,r,n;if(this.format.recordAndTupleSyntaxType==="bar")r="{|",n="|}";else{if(this.format.recordAndTupleSyntaxType!=="hash"&&this.format.recordAndTupleSyntaxType!=null)throw new Error(`The "recordAndTupleSyntaxType" generator option must be "bar" or "hash" (${JSON.stringify(this.format.recordAndTupleSyntaxType)} received).`);r="#{",n="}"}this.token(r),t.length&&(this.space(),this.printList(t,this.shouldPrintTrailingComma(n),!0,!0),this.space()),this.token(n)}function Bte(e){let t=e.elements,r=t.length,n,s;if(this.format.recordAndTupleSyntaxType==="bar")n="[|",s="|]";else if(this.format.recordAndTupleSyntaxType==="hash")n="#[",s="]";else throw new Error(`${this.format.recordAndTupleSyntaxType} is not a valid recordAndTuple syntax type`);this.token(n);for(let i=0;i<t.length;i++){let a=t[i];a&&(i>0&&this.space(),this.print(a),(i<r-1||this.shouldPrintTrailingComma(s))&&this.token(",",!1,i))}this.token(s)}function kte(e){this.word(`/${e.pattern}/${e.flags}`)}function Fte(e){this.word(e.value?"true":"false")}function Lte(){this.word("null")}function jte(e){let t=thisLine truncated
`)}if(this.format.concise)o=o.replace(/\n(?!$)/g,`
`);else{let c=this.format.retainLines?0:this._buf.getCurrentColumn();(this._shouldIndent(47)||this.format.retainLines)&&(c+=this._getIndent()),o=o.replace(/\n(?!$)/g,`
${" ".repeat(c)}`)}}}else n?o=`/*${t.value}*/`:o=`//${t.value}`;if(this._endsWithDiv&&this._space(),this.tokenMap){let{_printSemicolonBeforeNextToken:u,_printSemicolonBeforeNextNode:c}=this;this._printSemicolonBeforeNextToken=-1,this._printSemicolonBeforeNextNode=-1,this.source("start",t.loc),this._append(o,s),this._printSemicolonBeforeNextNode=c,this._printSemicolonBeforeNextToken=u}else this.source("start",t.loc),this._append(o,s);!s&&!n&&this.newline(1,!0),i&&r!==3&&this.newline(1)}_printComments(t,r,n,s,i=0,a){let o=n.loc,l=r.length,u=!!o,c=u?o.start.line:0,p=u?o.end.line:0,d=0,m=0,g=this._noLineTerminator?function(){}:this.newline.bind(this);for(let f=0;f<l;f++){let b=r[f],T=this._shouldPrintComment(b,a);if(T===2){u=!1;break}if(u&&b.loc&&T===1){let w=b.loc.start.line,I=b.loc.end.line;if(t===0){let N=0;f===0?this._buf.hasContent()&&(b.type==="CommentLine"||w!==I)&&(N=m=1):N=w-d,d=I,g(N),this._printComment(b,1),f+1===l&&(g(Math.max(c-d,m)),d=c)}else if(t===1){let N=w-(f===0?c:d);d=I,g(N),this._printComment(b,1),f+1===l&&(g(Math.min(1,p-d)),d=p)}else{let N=w-(f===0?p-i:d);d=I,g(N),this._printComment(b,1)}}else{if(u=!1,T!==1)continue;if(l===1){let w=b.loc?b.loc.start.line===b.loc.end.line:!iA.test(b.value),I=w&&!Zse(n)&&!eie(s)&&!tie(s)&&!rie(n);t===0?this._printComment(b,I&&n.type!=="ObjectExpression"||w&&Qse(s,{body:n})?1:0):I&&t===2?this._printComment(b,1):this._printComment(b,0)}else t===1&&!(n.type==="ObjectExpression"&&n.properties.length>1)&&n.type!=="ClassBody"&&n.type!=="TSInterfaceBody"?this._printComment(b,f===0?2:f===l-1?3:0):this._printComment(b,0)}}t===2&&u&&d&&(this._lastCommentLine=d)}};Object.assign(Jo.prototype,Yse);(0,Jse.addDeprecatedGenerators)(Jo);var YIe=gc.default=Jo;function oie(e,t){this.token(",",!1,e),t||this.space()}});var bc=x(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});Ca.default=void 0;Ca.generate=cA;var oA=lP(),lA=aA();function uA(e,t,r){if(t.experimental_preserveFormat){if(typeof e!="string")throw new Error("`experimental_preserveFormat` requires the original `code` to be passed to @babel/generator as a string");if(!t.retainLines)throw new Error("`experimental_preserveFormat` requires `retainLines` to be set to `true`");if(t.compact&&t.compact!=="auto")throw new Error("`experimental_preserveFormat` is not compatible with the `compact` option");if(t.minified)throw new Error("`experimental_preserveFormat` is not compatible with the `minified` option");if(t.jsescOption)throw new Error("`experimental_preserveFormat` is not compatible with the `jsescOption` option");if(!Array.isArray(r.tokens))throw new Error("`experimental_preserveFormat` requires the AST to have attatched the token of the input code. Make sure to enable the `tokens: true` parser option.")}let n={auxiliaryCommentBefore:t.auxiliaryCommentBefore,auxiliaryCommentAfter:t.auxiliaryCommentAfter,shouldPrintComment:t.shouldPrintComment,preserveFormat:t.experimental_preserveFormat,retainLines:t.retainLines,retainFunctionParens:t.retainFunctionParens,comments:t.comments==null||t.comments,compact:t.compact,minified:t.minified,concise:t.concise,indent:{adjustMultilineComment:!0,style:" "},jsescOption:Object.assign({quotes:"double",wrap:!0,minimal:!1},t.jsescOption),topicToken:t.topicToken,importAttributesKeyword:t.importAttributesKeyword};{var s;n.decoratorsBeforeExport=t.decoratorsBeforeExport,n.jsescOption.json=t.jsonCompatibleStrings,n.recordAndTupleSyntaxType=(s=t.recordAndTupleSyntaxType)!=null?s:"hash"}n.minified?(n.compact=!0,n.shouldPrintComment=n.shouldPrintComment||(()=>n.comments)):n.shouldPrintComment=n.shouldPrintComment||(l=>n.comments||l.includes("@license")||l.includes("@preserve")),n.compact==="auto"&&(n.compact=typeof e=="string"&&e.length>5e5,n.compact&&console.error(`[BABEL] Note: The code generator has deoptimised the styling of ${t.filename} as it exceeds the max of 500KB.`)),(n.compact||n.preserveFormat)&&(n.indent.adjustMultilineComment=!1);let{auxiliaryCommentBefore:i,auxiliaryCommentAfter:a,shouldPrintComment:o}=n;return i&&!o(i)&&(n.auxiliaryCommentBefore=void 0),a&&!o(a)&&(n.auxiliaryCommentAfter=void 0),n}Ca.CodeGenerator=class{constructor(t,r={},n){this._ast=void 0,this._format=void 0,this._map=void 0,this._ast=t,this._format=uA(n,r,t),this._map=r.sourceMaps?new oA.default(r,n):null}generate(){return new lA.default(this._format,this._map).generate(this._ast)}};function cA(e,t={},r){let n=uA(r,t,e),s=t.sourceMaps?new oA.default(t,r):null;return new lA.default(n,s,e.tokens,typeof r=="string"?r:null).generate(e)}var QIe=Ca.default=cA});var pA=x(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.find=pie;fn.findParent=cie;fn.getAncestry=yie;fn.getDeepestCommonAncestorFrom=mie;fn.getEarliestCommonAncestorFrom=hie;fn.getFunctionParent=fie;fn.getStatementParent=die;fn.inType=Eie;fn.isAncestor=gie;fn.isDescendant=bie;var lie=Fe(),{VISITOR_KEYS:uie}=lie;function cie(e){let t=this;for(;t=t.parentPath;)if(e(t))return t;return null}function pie(e){let t=this; Line truncated
`+(0,Eoe.codeFrameColumns)(e,{start:{line:s.line,column:s.column+1}}),n.code="BABEL_REPLACE_SOURCE_ERROR"),n}let r=t.program.body[0].expression;return S0.default.removeProperties(r),this.replaceWith(r)}function Koe(e){if(wa.resync.call(this),this.removed)throw new Error("You can't replace this node, we've already removed it");let t=e instanceof Toe.default?e.node:e;if(!t)throw new Error("You passed `path.replaceWith()` a falsy node, use `path.remove()` instead");if(this.node===t)return[this];if(this.isProgram()&&!joe(t))throw new Error("You can only replace a Program root node with another Program node");if(Array.isArray(t))throw new Error("Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`");if(typeof t=="string")throw new Error("Don't use `path.replaceWith()` with a source string, use `path.replaceWithSourceString()`");let r="";if(this.isNodeType("Statement")&&QA(t)&&!this.canHaveVariableDeclarationOrExpression()&&!this.canSwapBetweenExpressionAndStatement(t)&&!this.parentPath.isExportDefaultDeclaration()&&(t=woe(t),r="expression"),this.isNodeType("Expression")&&Moe(t)&&!this.canHaveVariableDeclarationOrExpression()&&!this.canSwapBetweenExpressionAndStatement(t))return this.replaceExpressionWithStatements([t]);let n=this.node;return n&&(Boe(t,n),qoe(n)),ZA.call(this,t),this.type=t.type,wa.setScope.call(this),this.requeue(),[r?this.get(r):this]}function ZA(e){var t;if(!this.container)throw new ReferenceError("Container is falsy");this.inList?YA(this.parent,this.key,[e]):YA(this.parent,this.key,e),this.debug(`Replace with ${e==null?void 0:e.type}`),(t=(0,JA.getCachedPaths)(this))==null||t.set(e,this).delete(this.node),this.node=this.container[this.key]=e}function Hoe(e){wa.resync.call(this);let t=[],r=Cc(e,t);if(r){for(let d of t)this.scope.push({id:d});return this.replaceWith(r)[0].get("expressions")}let n=this.getFunctionParent(),s=n==null?void 0:n.node.async,i=n==null?void 0:n.node.generator,a=voe([],Aoe(e));this.replaceWith(Coe(a,[]));let o=this.get("callee");o.get("body").scope.hoistVariables(d=>this.scope.push({id:d}));let l=o.getCompletionRecords();for(let d of l){if(!d.isExpressionStatement())continue;let m=d.findParent(g=>g.isLoop());if(m){let g=m.getData("expressionReplacementReturnUid");g?g=_oe(g.name):(g=o.scope.generateDeclaredUidIdentifier("ret"),o.get("body").pushContainer("body",XA(P0(g))),m.setData("expressionReplacementReturnUid",g)),d.get("expression").replaceWith(zA("=",P0(g),d.node.expression))}else d.replaceWith(XA(d.node.expression))}o.arrowFunctionToExpression();let u=o,c=s&&S0.default.hasType(this.get("callee.body").node,"AwaitExpression",HA),p=i&&S0.default.hasType(this.get("callee.body").node,"YieldExpression",HA);return c&&(u.set("async",!0),p||this.replaceWith(Poe(this.node))),p&&(u.set("generator",!0),this.replaceWith(Voe(this.node,!0))),u.get("body.body")}function Cc(e,t){let r=[],n=!0;for(let s of e)if(GA(s)||(n=!1),QA(s))r.push(s);else if(Foe(s))r.push(s.expression);else if(Roe(s)){if(s.kind!=="var")return;for(let i of s.declarations){let a=Ioe(i);for(let o of Object.keys(a))t.push(P0(a[o]));i.init&&r.push(zA("=",i.id,i.init))}n=!0}else if(Loe(s)){let i=s.consequent?Cc([s.consequent],t):x0(),a=s.alternate?Cc([s.alternate],t):x0();if(!i||!a)return;r.push(Doe(s.test,i,a))}else if(koe(s)){let i=Cc(s.body,t);if(!i)return;r.push(i)}else if(GA(s))e.indexOf(s)===0&&(n=!0);else return;return n&&r.push(x0()),r.length===1?r[0]:Uoe(r)}function Goe(e){if(wa.resync.call(this),Array.isArray(e))if(Array.isArray(this.container)){e=v0._verifyNodeList.call(this,e);let t=v0._containerInsertAfter.call(this,e);return this.remove(),t}else return this.replaceWithMultiple(e);else return this.replaceWith(e)}});var nC=x(Dc=>{"use strict";Object.defineProperty(Dc,"__esModule",{value:!0});Dc.evaluate=tle;Dc.evaluateTruthy=Zoe;var Xoe=["Number","String","Math"],Yoe=["isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent",null,null],Joe=["random"];function eC(e){return Xoe.includes(e)}function zoe(e){return Yoe.includes(e)}function Qoe(e){return Joe.includes(e)}function Zoe(){let e=this.evaluate();if(e.confident)return!!e.value}function Cn(e,t){t.confident&&(t.deoptPath=e,t.confident=!1)}var tC=new Map([["undefined",void 0],["Infinity",1/0],["NaN",NaN]]);function jr(e,t){let{node:r}=e,{seen:n}=t;if(n.has(r)){let s=n.get(r);if(s.resolved)return s.value;Cn(e,t);return}else{let s={resolved:!1};n.set(r,s);let i=ele(e,t);return t.confident&&(s.resolved=!0,s.value=i),i}}function ele(e,t){if(t.confident){if(e.isSequenceExpression()){let n=e.get("expressions");return jr(n[n.length-1],t)}if(e.isStringLiteral()||e.isNumericLiteral()||e.isBooleanLiteral())return e.node.value;if(e.isNullLiteral())return null;if(e.isTemplateLiteral())return rC(e,e.node.quasis,t);if(e.isTaggedTemplateExpression()&&e.get("tag").isMemberExpression()){let n=e.get("tag.object"),{node:{name:s}}=n,i=e.get("tag.property");if(n.isIdentifier()&&s==="Stri Line truncated
(function (${o}) {
function ${n}(${l}) {
return ${Ni(o)}.apply(this, arguments);
}
${Ni(n)}.toString = function () {
return ${Ni(o)}.toString();
}
return ${Ni(n)};
})(${lC(this.node)})
`;return this.replaceWith(u)[0].get("arguments.0")}function Wle(e){let t=e.params.findIndex(r=>xle(r)||Sle(r));return t===-1?e.params.length:t}});var gC=x(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt._guessExecutionStatusRelativeTo=pue;Kt._resolve=yC;Kt.canHaveVariableDeclarationOrExpression=nue;Kt.canSwapBetweenExpressionAndStatement=sue;Kt.getSource=lue;Kt.isCompletionRecord=iue;Kt.isConstantExpression=mue;Kt.isInStrictMode=yue;Kt.isNodeType=rue;Kt.isStatementOrBlock=aue;Kt.isStatic=tue;Kt.matchesPattern=eue;Kt.referencesImport=oue;Kt.resolve=hue;Kt.willIMaybeExecuteBefore=uue;var Kle=Fe(),{STATEMENT_OR_BLOCK_KEYS:Hle,VISITOR_KEYS:Gle,isBlockStatement:mC,isExpression:Xle,isIdentifier:Yle,isLiteral:Jle,isStringLiteral:zle,isType:Qle,matchesPattern:Zle}=Kle;function eue(e,t){return Zle(this.node,e,t)}Kt.has=function(t){var r;let n=(r=this.node)==null?void 0:r[t];return n&&Array.isArray(n)?!!n.length:!!n};function tue(){return this.scope.isStatic(this.node)}Kt.is=Kt.has,Kt.isnt=function(t){return!this.has(t)},Kt.equals=function(t,r){return this.node[t]===r};function rue(e){return Qle(this.type,e)}function nue(){return(this.key==="init"||this.key==="left")&&this.parentPath.isFor()}function sue(e){return this.key!=="body"||!this.parentPath.isArrowFunctionExpression()?!1:this.isExpression()?mC(e):this.isBlockStatement()?Xle(e):!1}function iue(e){let t=this,r=!0;do{let{type:n,container:s}=t;if(!r&&(t.isFunction()||n==="StaticBlock"))return!!e;if(r=!1,Array.isArray(s)&&t.key!==s.length-1)return!1}while((t=t.parentPath)&&!t.isProgram()&&!t.isDoExpression());return!0}function aue(){return this.parentPath.isLabeledStatement()||mC(this.container)?!1:Hle.includes(this.key)}function oue(e,t){if(!this.isReferencedIdentifier()){if(this.isJSXMemberExpression()&&this.node.property.name===t||(this.isMemberExpression()||this.isOptionalMemberExpression())&&(this.node.computed?zle(this.node.property,{value:t}):this.node.property.name===t)){let i=this.get("object");return i.isReferencedIdentifier()&&i.referencesImport(e,"*")}return!1}let r=this.scope.getBinding(this.node.name);if(!r||r.kind!=="module")return!1;let n=r.path,s=n.parentPath;if(!s.isImportDeclaration())return!1;if(s.node.source.value===e){if(!t)return!0}else return!1;return!!(n.isImportDefaultSpecifier()&&t==="default"||n.isImportNamespaceSpecifier()&&t==="*"||n.isImportSpecifier()&&Yle(n.node.imported,{name:t}))}function lue(){let e=this.node;if(e.end){let t=this.hub.getCode();if(t)return t.slice(e.start,e.end)}return""}function uue(e){return this._guessExecutionStatusRelativeTo(e)!=="after"}function fC(e){return e.isProgram()?e:(e.parentPath.scope.getFunctionParent()||e.parentPath.scope.getProgramParent()).path}function cue(e,t){switch(e){case"LogicalExpression":return t==="right";case"ConditionalExpression":case"IfStatement":return t==="consequent"||t==="alternate";case"WhileStatement":case"DoWhileStatement":case"ForInStatement":case"ForOfStatement":return t==="body";case"ForStatement":return t==="body"||t==="update";case"SwitchStatement":return t==="cases";case"TryStatement":return t==="handler";case"AssignmentPattern":return t==="right";case"OptionalMemberExpression":return t==="property";case"OptionalCallExpression":return t==="arguments";default:return!1}}function dC(e,t){for(let r=0;r<t;r++){let n=e[r];if(cue(n.parent.type,n.parentKey))return!0}return!1}var hC=Symbol();function pue(e){return I0(this,e,new Map)}function I0(e,t,r){let n={this:fC(e),target:fC(t)};if(n.target.node!==n.this.node)return due(e,n.target,r);let s={target:t.getAncestry(),this:e.getAncestry()};if(s.target.includes(e))return"after";if(s.this.includes(t))return"before";let i,a={target:0,this:0};for(;!i&&a.this<s.this.length;){let c=s.this[a.this];a.target=s.target.indexOf(c),a.target>=0?i=c:a.this++}if(!i)throw new Error("Internal Babel error - The two compared nodes don't appear to belong to the same program.");if(dC(s.this,a.this-1)||dC(s.target,a.target-1))return"unknown";let o={this:s.this[a.this-1],target:s.target[a.target-1]};if(o.target.listKey&&o.this.listKey&&o.target.container===o.this.container)return o.target.key>o.this.key?"before":"after";let l=Gle[i.type],u={this:l.indexOf(o.this.parentKey),target:l.indexOf(o.target.parentKey)};return u.target>u.this?"before":"after"}function fue(e,t,r){if(t.isFunctionDeclaration()){if(t.parentPath.isExportDeclaration())return"unknown"}else return I0(e,t,r)==="before"?"before":"unknown";let n=t.scope.getBinding(t.node.id.name);if(!n.references)return"before";let s=n.referencePaths,i;for(let a of s){if(!!a.find(u=>u.node===t.node))continue;if(a.key!=="callee"||!a.parentPath.isCallExpression())return"unknown";let l=I0(e,a,r);if(i&&i!==l)return"unknown";i=l}return i}function due(e,t,r){let n=r.get(e.node),s;if(!n)r.set(e.node,n=new Map);else if(s=n.get(t.node))return s===hC?"unknown":s;n.set(t.node,hC);let i=fue(e,t,r);return n.set(t.node,i),i}function hue(e,t){return yC.call(this,e,t)||this}function yC(e,t){var Line truncated
(function() {
throw new Error('"' + '${e}' + '" is read-only.');
})()
`,jpe={ReferencedIdentifier(e){let{seen:t,buildImportReference:r,scope:n,imported:s,requeueInParent:i}=this;if(t.has(e.node))return;t.add(e.node);let a=e.node.name,o=s.get(a);if(o){if(kpe(e))throw e.buildCodeFrameError(`Cannot transform the imported binding "${a}" since it's also used in a type annotation. Please strip type annotations using @babel/preset-typescript or @babel/preset-flow.`);let l=e.scope.getBinding(a);if(n.getBinding(a)!==l)return;let c=r(o,e.node);if(c.loc=e.node.loc,(e.parentPath.isCallExpression({callee:e.node})||e.parentPath.isOptionalCallExpression({callee:e.node})||e.parentPath.isTaggedTemplateExpression({tag:e.node}))&&ke.types.isMemberExpression(c))e.replaceWith(ke.types.sequenceExpression([ke.types.numericLiteral(0),c]));else if(e.isJSXIdentifier()&&ke.types.isMemberExpression(c)){let{object:p,property:d}=c;e.replaceWith(ke.types.jsxMemberExpression(ke.types.jsxIdentifier(p.name),ke.types.jsxIdentifier(d.name)))}else e.replaceWith(c);i(e),e.skip()}},UpdateExpression(e){let{scope:t,seen:r,imported:n,exported:s,requeueInParent:i,buildImportReference:a}=this;if(r.has(e.node))return;r.add(e.node);let o=e.get("argument");if(o.isMemberExpression())return;let l=e.node;if(o.isIdentifier()){let u=o.node.name;if(t.getBinding(u)!==e.scope.getBinding(u))return;let c=s.get(u),p=n.get(u);if((c==null?void 0:c.length)>0||p)if(p)e.replaceWith(ke.types.assignmentExpression(l.operator[0]+"=",a(p,o.node),Uc(u)));else if(l.prefix)e.replaceWith(Fi(this.metadata,c,ke.types.cloneNode(l),e.scope));else{let d=t.generateDeclaredUidIdentifier(u);e.replaceWith(ke.types.sequenceExpression([ke.types.assignmentExpression("=",ke.types.cloneNode(d),ke.types.cloneNode(l)),Fi(this.metadata,c,ke.types.identifier(u),e.scope),ke.types.cloneNode(d)]))}}i(e),e.skip()},AssignmentExpression:{exit(e){let{scope:t,seen:r,imported:n,exported:s,requeueInParent:i,buildImportReference:a}=this;if(r.has(e.node))return;r.add(e.node);let o=e.get("left");if(!o.isMemberExpression())if(o.isIdentifier()){let l=o.node.name;if(t.getBinding(l)!==e.scope.getBinding(l))return;let u=s.get(l),c=n.get(l);if((u==null?void 0:u.length)>0||c){let p=e.node;c&&(p.left=a(c,o.node),p.right=ke.types.sequenceExpression([p.right,Uc(l)]));let{operator:d}=p,m;d==="="?m=p:d==="&&="||d==="||="||d==="??="?m=ke.types.assignmentExpression("=",p.left,ke.types.logicalExpression(d.slice(0,-1),ke.types.cloneNode(p.left),p.right)):m=ke.types.assignmentExpression("=",p.left,ke.types.binaryExpression(d.slice(0,-1),ke.types.cloneNode(p.left),p.right)),e.replaceWith(Fi(this.metadata,u,m,e.scope)),i(e),e.skip()}}else{let l=o.getOuterBindingIdentifiers(),u=Object.keys(l).filter(d=>t.getBinding(d)===e.scope.getBinding(d)),c=u.find(d=>n.has(d));c&&(e.node.right=ke.types.sequenceExpression([e.node.right,Uc(c)]));let p=[];if(u.forEach(d=>{let m=s.get(d)||[];m.length>0&&p.push(Fi(this.metadata,m,ke.types.identifier(d),e.scope))}),p.length>0){let d=ke.types.sequenceExpression(p);e.parentPath.isExpressionStatement()&&(d=ke.types.expressionStatement(d),d._blockHoist=e.parentPath.node._blockHoist);let m=e.insertAfter(d)[0];i(m)}}}},ForXStatement(e){let{scope:t,node:r}=e,{left:n}=r,{exported:s,imported:i,scope:a}=this;if(!ke.types.isVariableDeclaration(n)){let o=!1,l,u=e.get("body").scope;for(let d of Object.keys(ke.types.getOuterBindingIdentifiers(n)))a.getBinding(d)===t.getBinding(d)&&(s.has(d)&&(o=!0,u.hasOwnBinding(d)&&u.rename(d)),i.has(d)&&!l&&(l=d));if(!o&&!l)return;e.ensureBlock();let c=e.get("body"),p=t.generateUidIdentifierBasedOnNode(n);e.get("left").replaceWith(ke.types.variableDeclaration("let",[ke.types.variableDeclarator(ke.types.cloneNode(p))])),t.registerDeclaration(e.get("left")),o&&c.unshiftContainer("body",ke.types.expressionStatement(ke.types.assignmentExpression("=",n,p))),l&&c.unshiftContainer("body",ke.types.expressionStatement(Uc(l)))}}}});var rg=x(ja=>{"use strict";Object.defineProperty(ja,"__esModule",{value:!0});ja.default=Vpe;ja.hasExports=Rpe;ja.isSideEffectImport=qpe;ja.validateImportInteropOption=i2;var s2=require("path"),Mpe=ia();function Rpe(e){return e.hasExports}function qpe(e){return e.imports.size===0&&e.importsNamespace.size===0&&e.reexports.size===0&&e.reexportNamespace.size===0&&!e.reexportAll}function i2(e){if(typeof e!="function"&&e!=="none"&&e!=="babel"&&e!=="node")throw new Error(`.importInterop must be one of "none", "babel", "node", or a function returning one of those values (received ${e}).`);return e}function Upe(e,t,r){return typeof e=="function"?i2(e(t,r)):e}function Vpe(e,t,{importInterop:r,initializeReexports:n=!1,getWrapperPayload:s,esNamespaceOnly:i=!1,filename:a}){t||(t=e.scope.generateUidIdentifier("exports").name);let o=new Set;Kpe(e);let{local:l,sources:u,hasExports:c}=$pe(e,{initializeReexports:n,getWrapperPayload:s},o);Hpe(e);for(let[p,d]of u){let{importsNamespace:m,imports:g}=d;if(m.size>0&&g.size===0){let[b]=m;d.name=b}let f=Upe(r,p,a);f==="none"?d.interop="none":f==="node"&&d.interop==="namespace"?d.interop="node-name Line truncated
Promise.resolve().then(() => ${n(s)})
`:n(s);let i=yr.types.isTemplateLiteral(s)?yr.types.identifier("specifier"):yr.types.templateLiteral([yr.types.templateElement({raw:""}),yr.types.templateElement({raw:""})],[yr.types.identifier("specifier")]);return t?yr.template.expression.ast`
(specifier =>
new Promise(r => r(${i}))
.then(s => ${n(yr.types.identifier("s"))})
)(${s})
`:r?yr.template.expression.ast`
(specifier =>
new Promise(r => r(${n(i)}))
)(${s})
`:yr.template.expression.ast`
(specifier => ${n(i)})(${s})
`}});var l2=x(Kc=>{"use strict";Object.defineProperty(Kc,"__esModule",{value:!0});Kc.default=sg;{let e=sg;Kc.default=sg=function(r,n){var s,i,a,o;return e(r,{moduleId:(s=n.moduleId)!=null?s:r.moduleId,moduleIds:(i=n.moduleIds)!=null?i:r.moduleIds,getModuleId:(a=n.getModuleId)!=null?a:r.getModuleId,moduleRoot:(o=n.moduleRoot)!=null?o:r.moduleRoot})}}function sg(e,t){let{filename:r,filenameRelative:n=r,sourceRoot:s=t.moduleRoot}=e,{moduleId:i,moduleIds:a=!!i,getModuleId:o,moduleRoot:l=s}=t;if(!a)return null;if(i!=null&&!o)return i;let u=l!=null?l+"/":"";if(n){let c=s!=null?new RegExp("^"+s+"/?"):"";u+=n.replace(c,"").replace(/\.\w*$/,"")}return u=u.replace(/\\/g,"/"),o&&o(u)||u}});var cl=x(Qr=>{"use strict";Object.defineProperty(Qr,"__esModule",{value:!0});Object.defineProperty(Qr,"buildDynamicImport",{enumerable:!0,get:function(){return efe.buildDynamicImport}});Qr.buildNamespaceInitStatements=ife;Qr.ensureStatementsHoisted=nfe;Object.defineProperty(Qr,"getModuleName",{enumerable:!0,get:function(){return tfe.default}});Object.defineProperty(Qr,"hasExports",{enumerable:!0,get:function(){return ul.hasExports}});Object.defineProperty(Qr,"isModule",{enumerable:!0,get:function(){return u2.isModule}});Object.defineProperty(Qr,"isSideEffectImport",{enumerable:!0,get:function(){return ul.isSideEffectImport}});Qr.rewriteModuleStatementsAndPrepareHeader=rfe;Object.defineProperty(Qr,"rewriteThis",{enumerable:!0,get:function(){return c2.default}});Qr.wrapInterop=sfe;var Qpe=require("assert"),nt=vt(),u2=Z0(),c2=r2(),Zpe=n2(),ul=rg(),lg=o2(),efe=ng(),tfe=l2();Qr.getDynamicImportSource=ng().getDynamicImportSource;function rfe(e,{exportName:t,strict:r,allowTopLevelThis:n,strictMode:s,noInterop:i,importInterop:a=i?"none":"babel",lazy:o,getWrapperPayload:l=lg.toGetWrapperPayload(o!=null?o:!1),wrapReference:u=lg.wrapReference,esNamespaceOnly:c,filename:p,constantReexports:d=arguments[1].loose,enumerableModuleMeta:m=arguments[1].loose,noIncompleteNsImportDetection:g}){(0,ul.validateImportInteropOption)(a),Qpe((0,u2.isModule)(e),"Cannot process module statements in a script"),e.node.sourceType="script";let f=(0,ul.default)(e,t,{importInterop:a,initializeReexports:d,getWrapperPayload:l,esNamespaceOnly:c,filename:p});n||(0,c2.default)(e),(0,Zpe.default)(e,f,u),s!==!1&&(e.node.directives.some(I=>I.value.value==="use strict")||e.unshiftContainer("directives",nt.types.directive(nt.types.directiveLiteral("use strict"))));let b=[];(0,ul.hasExports)(f)&&!r&&b.push(afe(f,m));let T=lfe(e,f);return T&&(f.exportNameListName=T.name,b.push(T.statement)),b.push(...ufe(e,f,u,d,g)),{meta:f,headers:b}}function nfe(e){e.forEach(t=>{t._blockHoist=3})}function sfe(e,t,r){if(r==="none")return null;if(r==="node-namespace")return nt.types.callExpression(e.hub.addHelper("interopRequireWildcard"),[t,nt.types.booleanLiteral(!0)]);if(r==="node-default")return null;let n;if(r==="default")n="interopRequireDefault";else if(r==="namespace")n="interopRequireWildcard";else throw new Error(`Unknown interop: ${r}`);return nt.types.callExpression(e.hub.addHelper(n),[t])}function ife(e,t,r=!1,n=lg.wrapReference){var s;let i=[],a=nt.types.identifier(t.name);for(let l of t.importsNamespace)l!==t.name&&i.push(nt.template.statement`var NAME = SOURCE;`({NAME:l,SOURCE:nt.types.cloneNode(a)}));let o=(s=n(a,t.wrap))!=null?s:a;r&&i.push(...p2(e,t,!0,n));for(let l of t.reexportNamespace)i.push((nt.types.isIdentifier(o)?nt.template.statement`EXPORTS.NAME = NAMESPACE;`:nt.template.statement`
Object.defineProperty(EXPORTS, "NAME", {
enumerable: true,
get: function() {
return NAMESPACE;
}
});
`)({EXPORTS:e.exportName,NAME:l,NAMESPACE:nt.types.cloneNode(o)}));if(t.reexportAll){let l=ofe(e,nt.types.cloneNode(o),r);l.loc=t.reexportAll.loc,i.push(l)}return i}var ig={constant:({exports:e,exportName:t,namespaceImport:r})=>nt.template.statement.ast`
${e}.${t} = ${r};
`,constantComputed:({exports:e,exportName:t,namespaceImport:r})=>nt.template.statement.ast`
${e}["${t}"] = ${r};
`,spec:({exports:e,exportName:t,namespaceImport:r})=>nt.template.statement.ast`
Object.defineProperty(${e}, "${t}", {
enumerable: true,
get: function() {
return ${r};
},
});
`};function p2(e,t,r,n){var s;let i=nt.types.identifier(t.name);i=(s=n(i,t.wrap))!=null?s:i;let{stringSpecifiers:a}=e;return Array.from(t.reexports,([o,l])=>{let u=nt.types.cloneNode(i);l==="default"&&t.interop==="node-default"||(a.has(l)?u=nt.types.memberExpression(u,nt.types.stringLiteral(l),!0):u=nt.types.memberExpression(u,nt.types.identifier(l)));let c={exports:e.exportName,exportName:o,namespaceImport:u};return r||nt.types.isIdentifier(u)?a.has(o)?ig.constantComputed(c):ig.constant(c):ig.spec(c)})}function afe(e,t=!1){return(t?nt.template.statement`
EXPORTS.__esModule = true;
`:nt.template.statement`
Object.defineProperty(EXPORTS, "__esModule", {
value: true,
});
`)({EXPORTS:e.exportName})}function ofe(e,t,r){return(r?nt.template.statement`
Object.keys(NAMESPACE).forEach(function(key) {
if (key === "default" || key === "__esModule") return;
VERIFY_NAME_LIST;
if (key in EXPORTS && EXPORTS[key] === NAMESPACE[key]) return;
EXPORTS[key] = NAMESPACE[key];
});
`:nt.template.statement`
Object.keys(NAMESPACE).forEach(function(key) {
if (key === "default" || key === "__esModule") return;
VERIFY_NAME_LIST;
if (key in EXPORTS && EXPORTS[key] === NAMESPACE[key]) return;
Object.defineProperty(EXPORTS, key, {
enumerable: true,
get: function() {
return NAMESPACE[key];
},
});
});
`)({NAMESPACE:t,EXPORTS:e.exportName,VERIFY_NAME_LIST:e.exportNameListName?(0,nt.template)`
if (Object.prototype.hasOwnProperty.call(EXPORTS_LIST, key)) return;
`({EXPORTS_LIST:e.exportNameListName}):null})}function lfe(e,t){let r=Object.create(null);for(let i of t.local.values())for(let a of i.names)r[a]=!0;let n=!1;for(let i of t.source.values()){for(let a of i.reexports.keys())r[a]=!0;for(let a of i.reexportNamespace)r[a]=!0;n=n||!!i.reexportAll}if(!n||Object.keys(r).length===0)return null;let s=e.scope.generateUidIdentifier("exportNames");return delete r.default,{name:s.name,statement:nt.types.variableDeclaration("var",[nt.types.variableDeclarator(s,nt.types.valueToNode(r))])}}function ufe(e,t,r,n=!1,s=!1){let i=[];for(let[o,l]of t.local)if(l.kind!=="import"){if(l.kind==="hoisted")i.push([l.names[0],og(t,l.names,nt.types.identifier(o))]);else if(!s)for(let u of l.names)i.push([u,null])}for(let o of t.source.values()){if(!n){let l=p2(t,o,!1,r),u=[...o.reexports.keys()];for(let c=0;c<l.length;c++)i.push([u[c],l[c]])}if(!s)for(let l of o.reexportNamespace)i.push([l,null])}i.sort(([o],[l])=>o<l?-1:l<o?1:0);let a=[];if(s)for(let[,o]of i)a.push(o);else for(let l=0;l<i.length;l+=100){let u=[];for(let c=0;c<100&&l+c<i.length;c++){let[p,d]=i[l+c];d!==null?(u.length>0&&(a.push(og(t,u,e.scope.buildUndefinedNode())),u=[]),a.push(d)):u.push(p)}u.length>0&&a.push(og(t,u,e.scope.buildUndefinedNode()))}return a}var ag={computed:({exports:e,name:t,value:r})=>nt.template.expression.ast`${e}["${t}"] = ${r}`,default:({exports:e,name:t,value:r})=>nt.template.expression.ast`${e}.${t} = ${r}`,define:({exports:e,name:t,value:r})=>nt.template.expression.ast`
Object.defineProperty(${e}, "${t}", {
enumerable: true,
value: void 0,
writable: true
})["${t}"] = ${r}`};function og(e,t,r){let{stringSpecifiers:n,exportName:s}=e;return nt.types.expressionStatement(t.reduce((i,a)=>{let o={exports:s,name:a,value:i};return a==="__proto__"?ag.define(o):n.has(a)?ag.computed(o):ag.default(o)},r))}});var d2=x(f2=>{f2.getModuleName=()=>cl().getModuleName});var cg=x(Gc=>{"use strict";Object.defineProperty(Gc,"__esModule",{value:!0});Gc.default=void 0;function Li(){let e=uy();return Li=function(){return e},e}function ug(){let e=zt();return ug=function(){return e},e}function h2(){let e=Ta();return h2=function(){return e},e}function m2(){let e=Fe();return m2=function(){return e},e}function Hc(){let e=ps();return Hc=function(){return e},e}var cfe=d2(),{cloneNode:pfe,interpreterDirective:ffe}=m2(),dfe={enter(e,t){let r=e.node.loc;r&&(t.loc=r,e.stop())}},Ma=class{constructor(t,{code:r,ast:n,inputMap:s}){this._map=new Map,this.opts=void 0,this.declarations={},this.path=void 0,this.ast=void 0,this.scope=void 0,this.metadata={},this.code="",this.inputMap=void 0,this.hub={file:this,getCode:()=>this.code,getScope:()=>this.scope,addHelper:this.addHelper.bind(this),buildError:this.buildCodeFrameError.bind(this)},this.opts=t,this.code=r,this.ast=n,this.inputMap=s,this.path=ug().NodePath.get({hub:this.hub,parentPath:null,parent:this.ast,container:this.ast,key:"program"}).setContext(),this.scope=this.path.scope}get shebang(){let{interpreter:t}=this.path.node;return t?t.value:""}set shebang(t){t?this.path.get("interpreter").replaceWith(ffe(t)):this.path.get("interpreter").remove()}set(t,r){if(t==="helpersNamespace")throw new Error("Babel 7.0.0-beta.56 has dropped support for the 'helpersNamespace' utility.If you are using @babel/plugin-external-helpers you will need to use a newer version than the one you currently have installed. If you have your own implementation, you'll want to explore using 'helperGenerator' alongside 'file.availableHelper()'.");this._map.set(t,r)}get(t){return this._map.get(t)}has(t){return this._map.has(t)}availableHelper(t,r){if(Li().isInternal(t))return!1;let n;try{n=Li().minVersion(t)}catch(s){if(s.code!=="BABEL_HELPER_UNKNOWN")throw s;return!1}return typeof r!="string"?!0:(Hc().valid(r)&&(r=`^${r}`),!Hc().intersects(`<${n}`,r)&&!Hc().intersects(">=8.0.0",r))}addHelper(t){if(Li().isInternal(t))throw new Error("Cannot use internal helper "+t);return this._addHelper(t)}_addHelper(t){let r=this.declarations[t];if(r)return pfe(r);let n=this.get("helperGenerator");if(n){let u=n(t);if(u)return u}Li().minVersion(t);let s=this.declarations[t]=this.scope.generateUidIdentifier(t),i={};for(let u of Li().getDependencies(t))i[u]=this._addHelper(u);let{nodes:a,globals:o}=Li().get(t,u=>i[u],s.name,Object.keys(this.scope.getAllBindings()));o.forEach(u=>{this.path.scope.hasBinding(u,!0)&&this.path.scope.rename(u)}),a.forEach(u=>{u._compact=!0});let l=this.path.unshiftContainer("body",a);for(let u of l)u.isVariableDeclaration()&&this.scope.registerDeclaration(u);return s}buildCodeFrameError(t,r,n=SyntaxError){let s=t==null?void 0:t.loc;if(!s&&t){let i={loc:null};(0,ug().default)(t,dfe,this.scope,i),s=i.loc;let a="This is an error on an internal node. Probably an internal error.";s&&(a+=" Location has been estimated."),r+=` (${a})`}if(s){let{highlightCode:i=!0}=this.opts;r+=`
`+(0,h2().codeFrameColumns)(this.code,{start:{line:s.start.line,column:s.start.column+1},end:s.end&&s.start.line===s.end.line?{line:s.end.line,column:s.end.column+1}:void 0},{highlightCode:i})}return new n(r)}};Gc.default=Ma;Ma.prototype.addImport=function(){throw new Error("This API has been removed. If you're looking for this functionality in Babel 7, you should import the '@babel/helper-module-imports' module and use the functions exposed from that module, such as 'addNamed' or 'addDefault'.")},Ma.prototype.addTemplateObject=function(){throw new Error("This function has been moved into the template literal transform itself.")},Ma.prototype.getModuleName=function(){return cfe.getModuleName()(this.opts,this.opts)}});var T2=x(gg=>{"use strict";Object.defineProperty(gg,"__esModule",{value:!0});gg.default=Ife;function pg(){let e=uy();return pg=function(){return e},e}function y2(){let e=bc();return y2=function(){return e},e}function g2(){let e=$o();return g2=function(){return e},e}function b2(){let e=Fe();return b2=function(){return e},e}var{arrayExpression:hfe,assignmentExpression:Xc,binaryExpression:mfe,blockStatement:yfe,callExpression:gfe,cloneNode:bfe,conditionalExpression:Efe,exportNamedDeclaration:Tfe,exportSpecifier:xfe,expressionStatement:fg,functionExpression:Sfe,identifier:gr,memberExpression:dg,objectExpression:hg,program:Yc,stringLiteral:E2,unaryExpression:vfe,variableDeclaration:mg,variableDeclarator:yg}=b2(),Pfe=e=>g2().default.statement`
(function (root, factory) {
if (typeof define === "function" && define.amd) {
define(AMD_ARGUMENTS, factory);
} else if (typeof exports === "object") {
factory(COMMON_ARGUMENTS);
} else {
factory(BROWSER_ARGUMENTS);
}
})(UMD_ROOT, function (FACTORY_PARAMETERS) {
FACTORY_BODY
});
`(e);function Afe(e){let t=gr("babelHelpers"),r=[],n=Sfe(null,[gr("global")],yfe(r)),s=Yc([fg(gfe(n,[Efe(mfe("===",vfe("typeof",gr("global")),E2("undefined")),gr("self"),gr("global"))]))]);return r.push(mg("var",[yg(t,Xc("=",dg(gr("global"),t),hg([])))])),Jc(r,t,e),s}function Cfe(e){let t=[],r=Jc(t,null,e);return t.unshift(Tfe(null,Object.keys(r).map(n=>xfe(bfe(r[n]),gr(n))))),Yc(t,[],"module")}function Dfe(e){let t=gr("babelHelpers"),r=[];return r.push(mg("var",[yg(t,gr("global"))])),Jc(r,t,e),Yc([Pfe({FACTORY_PARAMETERS:gr("global"),BROWSER_ARGUMENTS:Xc("=",dg(gr("root"),t),hg([])),COMMON_ARGUMENTS:gr("exports"),AMD_ARGUMENTS:hfe([E2("exports")]),FACTORY_BODY:r,UMD_ROOT:gr("this")})])}function wfe(e){let t=gr("babelHelpers"),r=[];r.push(mg("var",[yg(t,hg([]))]));let n=Yc(r);return Jc(r,t,e),r.push(fg(t)),n}function Jc(e,t,r){let n=i=>t?dg(t,gr(i)):gr(`_${i}`),s={};return pg().list.forEach(function(i){if(r&&!r.includes(i))return;let a=s[i]=n(i),{nodes:o}=pg().get(i,n,t?null:`_${i}`,[],t?(l,u,c)=>{c(p=>Xc("=",a,p)),l.body.push(fg(Xc("=",a,gr(u))))}:null);e.push(...o)}),s}function Ife(e,t="global"){let r,n={global:Afe,module:Cfe,umd:Dfe,var:wfe}[t];if(n)r=n(e);else throw new Error(`Unsupported output type ${t}`);return(0,y2().default)(r).code}});var Zr=x((V_e,w2)=>{"use strict";var S2=Symbol.for("gensync:v1:start"),v2=Symbol.for("gensync:v1:suspend"),_fe="GENSYNC_EXPECTED_START",Nfe="GENSYNC_EXPECTED_SUSPEND",P2="GENSYNC_OPTIONS_ERROR",x2="GENSYNC_RACE_NONEMPTY",Ofe="GENSYNC_ERRBACK_NO_CALLBACK";w2.exports=Object.assign(function(t){let r=t;return typeof t!="function"?r=kfe(t):r=Ffe(t),Object.assign(r,Bfe(r))},{all:bg({name:"all",arity:1,sync:function(e){return Array.from(e[0]).map(r=>Eg(r))},async:function(e,t,r){let n=Array.from(e[0]);if(n.length===0){Promise.resolve().then(()=>t([]));return}let s=0,i=n.map(()=>{});n.forEach((a,o)=>{zc(a,l=>{i[o]=l,s+=1,s===i.length&&t(i)},r)})}}),race:bg({name:"race",arity:1,sync:function(e){let t=Array.from(e[0]);if(t.length===0)throw ji("Must race at least 1 item",x2);return Eg(t[0])},async:function(e,t,r){let n=Array.from(e[0]);if(n.length===0)throw ji("Must race at least 1 item",x2);for(let s of n)zc(s,t,r)}})});function Bfe(e){return{sync:function(...r){return Eg(e.apply(this,r))},async:function(...r){return new Promise((n,s)=>{zc(e.apply(this,r),n,s)})},errback:function(...r){let n=r.pop();if(typeof n!="function")throw ji("Asynchronous function called without callback",Ofe);let s;try{s=e.apply(this,r)}catch(i){n(i);return}zc(s,i=>n(void 0,i),i=>n(i))}}}function pl(e,t,r,n){if(typeof r===e||n&&typeof r=="undefined")return;let s;throw n?s=`Expected opts.${t} to be either a ${e}, or undefined.`:s=`Expected opts.${t} to be a ${e}.`,ji(s,P2)}function ji(e,t){return Object.assign(new Error(e),{code:t})}function kfe({name:e,arity:t,sync:r,async:n,errback:s}){if(pl("string","name",e,!0),pl("number","arity",t,!0),pl("function","sync",r),pl("function","async",n,!0),pl("function","errback",s,!0),n&&s)throw ji("Expected one of either opts.async or opts.errback, but got _both_.",P2);if(typeof e!="string"){let i;s&&s.name&&s.name!=="errback"&&(i=s.name),n&&n.name&&n.name!=="async"&&(i=n.name.replace(/Async$/,"")),r&&r.name&&r.name!=="sync"&&(i=r.name.replace(/Sync$/,"")),typeof i=="string"&&(e=i)}return typeof t!="number"&&(t=r.length),bg({name:e,arity:t,sync:function(i){return r.apply(this,i)},async:function(i,a,o){n?n.apply(this,i).then(a,o):s?s.call(this,...i,(l,u)=>{l==null?a(u):o(l)}):a(r.apply(this,i))}})}function Ffe(e){return D2(e.name,e.length,function(...t){return e.apply(this,t)})}function bg({name:e,arity:t,sync:r,async:n}){return D2(e,t,function*(...s){let i=yield S2;if(!i)return r.call(this,s);let a;try{n.call(this,s,o=>{a||(a={value:o},i())},o=>{a||(a={err:o},i())})}catch(o){a={err:o},i()}if(yield v2,a.hasOwnProperty("err"))throw a.err;return a.value})}function Eg(e){let t;for(;!({value:t}=e.next()).done;)A2(t,e);return t}function zc(e,t,r){(function n(){try{let s;for(;!({value:s}=e.next()).done;){A2(s,e);let i=!0,a=!1,o=e.next(()=>{i?a=!0:n()});if(i=!1,Lfe(o,e),!a)return}return t(s)}catch(s){return r(s)}})()}function A2(e,t){e!==S2&&C2(t,ji(`Got unexpected yielded value in gensync generator: ${JSON.stringify(e)}. Did you perhaps mean to use 'yield*' instead of 'yield'?`,_fe))}function Lfe({value:e,done:t},r){!t&&e===v2||C2(r,ji(t?"Unexpected generator completion. If you get this, it is probably a gensync bug.":`Expected GENSYNC_SUSPEND, got ${JSON.stringify(e)}. If you get this, it is probably a gensync bug.`,Nfe))}function C2(e,t){throw e.throw&&e.throw(t),t}function D2(e,t,r){if(typeof e=="string"){let n=Object.getOwnPropertyDescriptor(r,"name");(!n||n.configurable)&&Object.defineProperty(r,"name",Object.assign(n||{},{configurable:!0,value:e}))}if(typeof t=="number"){let n=Object.getOwnPropertyDescriptor(r,"length");(!n||n.configurable)&&Object.defineProperty(r,"length",Object.assign(n||{},{configurable:!0,value:t}))}return r}});var Gs=x(_n=>{"use strict";Obje Line truncated
at ${t.join(`
at `)}`}});var qi=x(sp=>{"use strict";Object.defineProperty(sp,"__esModule",{value:!0});sp.default=void 0;var H2=fs(),Cg=class extends Error{constructor(t,r){super(t),(0,H2.expectedError)(this),r&&(0,H2.injectVirtualStackFrame)(this,r)}};sp.default=Cg});var G2=x(wg=>{"use strict";Object.defineProperty(wg,"__esModule",{value:!0});wg.findPackageData=ude;function Va(){let e=require("path");return Va=function(){return e},e}var ade=Ag(),Dg=qi(),ode="package.json",lde=(0,ade.makeStaticFileCache)((e,t)=>{let r;try{r=JSON.parse(t)}catch(n){throw new Dg.default(`Error while parsing JSON - ${n.message}`,e)}if(!r)throw new Error(`${e}: No config detected`);if(typeof r!="object")throw new Dg.default(`Config returned typeof ${typeof r}`,e);if(Array.isArray(r))throw new Dg.default("Expected config object but found array",e);return{filepath:e,dirname:Va().dirname(e),options:r}});function*ude(e){let t=null,r=[],n=!0,s=Va().dirname(e);for(;!t&&Va().basename(s)!=="node_modules";){r.push(s),t=yield*lde(Va().join(s,ode));let i=Va().dirname(s);if(s===i){n=!1;break}s=i}return{filepath:e,directories:r,pkg:t,isPackage:n}}});var X2=x((rNe,ip)=>{ip.exports.Space_Separator=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/;ip.exports.ID_Start=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60Line truncated
`?(Xs++,Nn=0):e?Nn+=e.length:Nn++,e&&(op+=e.length),e}var z2={default(){switch(st){case" ":case"\v":case"\f":case" ":case"\xA0":case"\uFEFF":case`
`:case"\r":case"\u2028":case"\u2029":Z();return;case"/":Z(),Ye="comment";return;case void 0:return Z(),Bt("eof")}if(ur.isSpaceSeparator(st)){Z();return}return z2[qr]()},comment(){switch(st){case"*":Z(),Ye="multiLineComment";return;case"/":Z(),Ye="singleLineComment";return}throw kt(Z())},multiLineComment(){switch(st){case"*":Z(),Ye="multiLineCommentAsterisk";return;case void 0:throw kt(Z())}Z()},multiLineCommentAsterisk(){switch(st){case"*":Z();return;case"/":Z(),Ye="default";return;case void 0:throw kt(Z())}Z(),Ye="multiLineComment"},singleLineComment(){switch(st){case`
`:case"\r":case"\u2028":case"\u2029":Z(),Ye="default";return;case void 0:return Z(),Bt("eof")}Z()},value(){switch(st){case"{":case"[":return Bt("punctuator",Z());case"n":return Z(),Ui("ull"),Bt("null",null);case"t":return Z(),Ui("rue"),Bt("boolean",!0);case"f":return Z(),Ui("alse"),Bt("boolean",!1);case"-":case"+":Z()==="-"&&(ds=-1),Ye="sign";return;case".":$e=Z(),Ye="decimalPointLeading";return;case"0":$e=Z(),Ye="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":$e=Z(),Ye="decimalInteger";return;case"I":return Z(),Ui("nfinity"),Bt("numeric",1/0);case"N":return Z(),Ui("aN"),Bt("numeric",NaN);case'"':case"'":dl=Z()==='"',$e="",Ye="string";return}throw kt(Z())},identifierNameStartEscape(){if(st!=="u")throw kt(Z());Z();let e=kg();switch(e){case"$":case"_":break;default:if(!ur.isIdStartChar(e))throw J2();break}$e+=e,Ye="identifierName"},identifierName(){switch(st){case"$":case"_":case"\u200C":case"\u200D":$e+=Z();return;case"\\":Z(),Ye="identifierNameEscape";return}if(ur.isIdContinueChar(st)){$e+=Z();return}return Bt("identifier",$e)},identifierNameEscape(){if(st!=="u")throw kt(Z());Z();let e=kg();switch(e){case"$":case"_":case"\u200C":case"\u200D":break;default:if(!ur.isIdContinueChar(e))throw J2();break}$e+=e,Ye="identifierName"},sign(){switch(st){case".":$e=Z(),Ye="decimalPointLeading";return;case"0":$e=Z(),Ye="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":$e=Z(),Ye="decimalInteger";return;case"I":return Z(),Ui("nfinity"),Bt("numeric",ds*(1/0));case"N":return Z(),Ui("aN"),Bt("numeric",NaN)}throw kt(Z())},zero(){switch(st){case".":$e+=Z(),Ye="decimalPoint";return;case"e":case"E":$e+=Z(),Ye="decimalExponent";return;case"x":case"X":$e+=Z(),Ye="hexadecimal";return}return Bt("numeric",ds*0)},decimalInteger(){switch(st){case".":$e+=Z(),Ye="decimalPoint";return;case"e":case"E":$e+=Z(),Ye="decimalExponent";return}if(ur.isDigit(st)){$e+=Z();return}return Bt("numeric",ds*Number($e))},decimalPointLeading(){if(ur.isDigit(st)){$e+=Z(),Ye="decimalFraction";return}throw kt(Z())},decimalPoint(){switch(st){case"e":case"E":$e+=Z(),Ye="decimalExponent";return}if(ur.isDigit(st)){$e+=Z(),Ye="decimalFraction";return}return Bt("numeric",ds*Number($e))},decimalFraction(){switch(st){case"e":case"E":$e+=Z(),Ye="decimalExponent";return}if(ur.isDigit(st)){$e+=Z();return}return Bt("numeric",ds*Number($e))},decimalExponent(){switch(st){case"+":case"-":$e+=Z(),Ye="decimalExponentSign";return}if(ur.isDigit(st)){$e+=Z(),Ye="decimalExponentInteger";return}throw kt(Z())},decimalExponentSign(){if(ur.isDigit(st)){$e+=Z(),Ye="decimalExponentInteger";return}throw kt(Z())},decimalExponentInteger(){if(ur.isDigit(st)){$e+=Z();return}return Bt("numeric",ds*Number($e))},hexadecimal(){if(ur.isHexDigit(st)){$e+=Z(),Ye="hexadecimalInteger";return}throw kt(Z())},hexadecimalInteger(){if(ur.isHexDigit(st)){$e+=Z();return}return Bt("numeric",ds*Number($e))},string(){switch(st){case"\\":Z(),$e+=pde();return;case'"':if(dl)return Z(),Bt("string",$e);$e+=Z();return;case"'":if(!dl)return Z(),Bt("string",$e);$e+=Z();return;case`
`:case"\r":throw kt(Z());case"\u2028":case"\u2029":hde(st);break;case void 0:throw kt(Z())}$e+=Z()},start(){switch(st){case"{":case"[":return Bt("punctuator",Z())}Ye="value"},beforePropertyName(){switch(st){case"$":case"_":$e=Z(),Ye="identifierName";return;case"\\":Z(),Ye="identifierNameStartEscape";return;case"}":return Bt("punctuator",Z());case'"':case"'":dl=Z()==='"',Ye="string";return}if(ur.isIdStartChar(st)){$e+=Z(),Ye="identifierName";return}throw kt(Z())},afterPropertyName(){if(st===":")return Bt("punctuator",Z());throw kt(Z())},beforePropertyValue(){Ye="value"},afterPropertyValue(){switch(st){case",":case"}":return Bt("punctuator",Z())}throw kt(Z())},beforeArrayValue(){if(st==="]")return Bt("punctuator",Z());Ye="value"},afterArrayValue(){switch(st){case",":case"]":return Bt("punctuator",Z())}throw kt(Z())},end(){throw kt(Z())}};function Bt(e,t){return{type:e,value:t,line:Xs,column:Nn}}function Ui(e){for(let t of e){if(ms()!==t)throw kt(Z());Z()}}function pde(){switch(ms()){case"b":return Z(),"\b";case"f":return Z(),"\f";case"n":return Z(),`
`;case"r":return Z(),"\r";case"t":return Z()," ";case"v":return Z(),"\v";case"0":if(Z(),ur.isDigit(ms()))throw kt(Z());return"\0";case"x":return Z(),fde();case"u":return Z(),kg();case`
`:case"\u2028":case"\u2029":return Z(),"";case"\r":return Z(),ms()===`
`&&Z(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw kt(Z());case void 0:throw kt(Z())}return Z()}function fde(){let e="",t=ms();if(!ur.isHexDigit(t)||(e+=Z(),t=ms(),!ur.isHexDigit(t)))throw kt(Z());return e+=Z(),String.fromCodePoint(parseInt(e,16))}function kg(){let e="",t=4;for(;t-- >0;){let r=ms();if(!ur.isHexDigit(r))throw kt(Z());e+=Z()}return String.fromCodePoint(parseInt(e,16))}var dde={start(){if(cr.type==="eof")throw Vi();Ng()},beforePropertyName(){switch(cr.type){case"identifier":case"string":Fg=cr.value,qr="afterPropertyName";return;case"punctuator":ap();return;case"eof":throw Vi()}},afterPropertyName(){if(cr.type==="eof")throw Vi();qr="beforePropertyValue"},beforePropertyValue(){if(cr.type==="eof")throw Vi();Ng()},beforeArrayValue(){if(cr.type==="eof")throw Vi();if(cr.type==="punctuator"&&cr.value==="]"){ap();return}Ng()},afterPropertyValue(){if(cr.type==="eof")throw Vi();switch(cr.value){case",":qr="beforePropertyName";return;case"}":ap()}},afterArrayValue(){if(cr.type==="eof")throw Vi();switch(cr.value){case",":qr="beforeArrayValue";return;case"]":ap()}},end(){}};function Ng(){let e;switch(cr.type){case"punctuator":switch(cr.value){case"{":e={};break;case"[":e=[];break}break;case"null":case"boolean":case"numeric":case"string":e=cr.value;break}if(hl===void 0)hl=e;else{let t=hs[hs.length-1];Array.isArray(t)?t.push(e):Object.defineProperty(t,Fg,{value:e,writable:!0,enumerable:!0,configurable:!0})}if(e!==null&&typeof e=="object")hs.push(e),Array.isArray(e)?qr="beforeArrayValue":qr="beforePropertyName";else{let t=hs[hs.length-1];t==null?qr="end":Array.isArray(t)?qr="afterArrayValue":qr="afterPropertyValue"}}function ap(){hs.pop();let e=hs[hs.length-1];e==null?qr="end":Array.isArray(e)?qr="afterArrayValue":qr="afterPropertyValue"}function kt(e){return lp(e===void 0?`JSON5: invalid end of input at ${Xs}:${Nn}`:`JSON5: invalid character '${Q2(e)}' at ${Xs}:${Nn}`)}function Vi(){return lp(`JSON5: invalid end of input at ${Xs}:${Nn}`)}function J2(){return Nn-=5,lp(`JSON5: invalid identifier character at ${Xs}:${Nn}`)}function hde(e){console.warn(`JSON5: '${Q2(e)}' in strings is not valid ECMAScript; consider escaping`)}function Q2(e){let t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){let r=e.charCodeAt(0).toString(16);return"\\x"+("00"+r).substring(r.length)}return e}function lp(e){let t=new SyntaxError(e);return t.lineNumber=Xs,t.columnNumber=Nn,t}});var rD=x((iNe,tD)=>{var Lg=_g();tD.exports=function(t,r,n){let s=[],i="",a,o,l="",u;if(r!=null&&typeof r=="object"&&!Array.isArray(r)&&(n=r.space,u=r.quote,r=r.replacer),typeof r=="function")o=r;else if(Array.isArray(r)){a=[];for(let f of r){let b;typeof f=="string"?b=f:(typeof f=="number"||f instanceof String||f instanceof Number)&&(b=String(f)),b!==void 0&&a.indexOf(b)<0&&a.push(b)}}return n instanceof Number?n=Number(n):n instanceof String&&(n=String(n)),typeof n=="number"?n>0&&(n=Math.min(10,Math.floor(n)),l=" ".substr(0,n)):typeof n=="string"&&(l=n.substr(0,10)),c("",{"":t});function c(f,b){let T=b[f];switch(T!=null&&(typeof T.toJSON5=="function"?T=T.toJSON5(f):typeof T.toJSON=="function"&&(T=T.toJSON(f))),o&&(T=o.call(b,f,T)),T instanceof Number?T=Number(T):T instanceof String?T=String(T):T instanceof Boolean&&(T=T.valueOf()),T){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof T=="string")return p(T,!1);if(typeof T=="number")return String(T);if(typeof T=="object")return Array.isArray(T)?g(T):d(T)}function p(f){let b={"'":.1,'"':.2},T={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"},w="";for(let N=0;N<f.length;N++){let L=f[N];switch(L){case"'":case'"':b[L]++,w+=L;continue;case"\0":if(Lg.isDigit(f[N+1])){w+="\\x00";continue}}if(T[L]){w+=T[L];continue}if(L<" "){let W=L.charCodeAt(0).toString(16);w+="\\x"+("00"+W).substring(W.length);continue}w+=L}let I=u||Object.keys(b).reduce((N,L)=>b[N]<b[L]?N:L);return w=w.replace(new RegExp(I,"g"),T[I]),I+w+I}function d(f){if(s.indexOf(f)>=0)throw TypeError("Converting circular structure to JSON5");s.push(f);let b=i;i=i+l;let T=a||Object.keys(f),w=[];for(let N of T){let L=c(N,f);if(L!==void 0){let W=m(N)+":";l!==""&&(W+=" "),W+=L,w.push(W)}}let I;if(w.length===0)I="{}";else{let N;if(l==="")N=w.join(","),I="{"+N+"}";else{let L=`,
`+i;N=w.join(L),I=`{
`+i+N+`,
`+b+"}"}}return s.pop(),i=b,I}function m(f){if(f.length===0)return p(f,!0);let b=String.fromCodePoint(f.codePointAt(0));if(!Lg.isIdStartChar(b))return p(f,!0);for(let T=b.length;T<f.length;T++)if(!Lg.isIdContinueChar(String.fromCodePoint(f.codePointAt(T))))return p(f,!0);return f}function g(f){if(s.indexOf(f)>=0)throw TypeError("Converting circular structure to JSON5");s.push(f);let b=i;i=i+l;let T=[];for(let I=0;I<f.length;I++){let N=c(String(I),f);T.push(N!==void 0?N:"null")}let w;if(T.length===0)w="[]";else if(l==="")w="["+T.join(",")+"]";else{let I=`,
`+i,N=T.join(I);w=`[
`+i+N+`,
`+b+"]"}return s.pop(),i=b,w}}});var sD=x((aNe,nD)=>{var mde=eD(),yde=rD(),gde={parse:mde,stringify:yde};nD.exports=gde});var jg=x(ml=>{"use strict";Object.defineProperty(ml,"__esModule",{value:!0});ml.makeConfigAPI=oD;ml.makePluginAPI=bde;ml.makePresetAPI=lD;function aD(){let e=ps();return aD=function(){return e},e}var up=vt(),iD=Ri();function oD(e){let t=n=>e.using(s=>n===void 0?s.envName:typeof n=="function"?(0,iD.assertSimpleType)(n(s.envName)):(Array.isArray(n)?n:[n]).some(i=>{if(typeof i!="string")throw new Error("Unexpected non-string value");return i===s.envName})),r=n=>e.using(s=>(0,iD.assertSimpleType)(n(s.caller)));return{version:up.version,cache:e.simple(),env:t,async:()=>!1,caller:r,assertVersion:Ede}}function lD(e,t){let r=()=>JSON.parse(e.using(s=>JSON.stringify(s.targets))),n=s=>{t.push(s)};return Object.assign({},oD(e),{targets:r,addExternalDependency:n})}function bde(e,t){let r=n=>e.using(s=>s.assumptions[n]);return Object.assign({},lD(e,t),{assumption:r})}function Ede(e){if(typeof e=="number"){if(!Number.isInteger(e))throw new Error("Expected string or integer value.");e=`^${e}.0.0-0`}if(typeof e!="string")throw new Error("Expected string or integer value.");if(e==="*"||aD().satisfies(up.version,e))return;let t=Error.stackTraceLimit;typeof t=="number"&&t<25&&(Error.stackTraceLimit=25);let r=new Error(`Requires Babel "${e}", but was loaded with "${up.version}". If you are sure you have a compatible version of @babel/core, it is likely that something in your build process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "@babel/core" or "babel-core" to see what is calling Babel.`);throw typeof t=="number"&&(Error.stackTraceLimit=t),Object.assign(r,{code:"BABEL_VERSION_UNSUPPORTED",version:up.version,range:e})}});var pp=x(cp=>{"use strict";Object.defineProperty(cp,"__esModule",{value:!0});cp.finalize=Tde;cp.flattenToSet=xde;function Tde(e){return Object.freeze(e)}function xde(e){let t=new Set,r=[e];for(;r.length>0;)for(let n of r.pop())Array.isArray(n)?r.push(n):t.add(n);return t}});var dp=x(fp=>{"use strict";Object.defineProperty(fp,"__esModule",{value:!0});fp.default=void 0;var Sde=pp(),Mg=class{constructor(t,r,n,s=(0,Sde.finalize)([])){this.key=void 0,this.manipulateOptions=void 0,this.post=void 0,this.pre=void 0,this.visitor=void 0,this.parserOverride=void 0,this.generatorOverride=void 0,this.options=void 0,this.externalDependencies=void 0,this.key=t.name||n,this.manipulateOptions=t.manipulateOptions,this.post=t.post,this.pre=t.pre,this.visitor=t.visitor||{},this.parserOverride=t.parserOverride,this.generatorOverride=t.generatorOverride,this.options=r,this.externalDependencies=s}};fp.default=Mg});var cD=x(Rg=>{"use strict";Object.defineProperty(Rg,"__esModule",{value:!0});Rg.once=vde;var uD=Gs();function vde(e){let t,r,n=!1;return function*(){if(!t){if(r)return n=!0,yield*(0,uD.waitFor)(r);if(yield*(0,uD.isAsync)()){let s,i;r=new Promise((a,o)=>{s=a,i=o});try{t={ok:!0,value:yield*e()},r=null,n&&s(t.value)}catch(a){t={ok:!1,value:a},r=null,n&&i(a)}}else try{t={ok:!0,value:yield*e()}}catch(s){t={ok:!1,value:s}}}if(t.ok)return t.value;throw t.value}}});var pD=x((pNe,Pde)=>{Pde.exports=[{name:"nodejs",version:"0.2.0",date:"2011-08-26",lts:!1,security:!1,v8:"2.3.8.0"},{name:"nodejs",version:"0.3.0",date:"2011-08-26",lts:!1,security:!1,v8:"2.5.1.0"},{name:"nodejs",version:"0.4.0",date:"2011-08-26",lts:!1,security:!1,v8:"3.1.2.0"},{name:"nodejs",version:"0.5.0",date:"2011-08-26",lts:!1,security:!1,v8:"3.1.8.25"},{name:"nodejs",version:"0.6.0",date:"2011-11-04",lts:!1,security:!1,v8:"3.6.6.6"},{name:"nodejs",version:"0.7.0",date:"2012-01-17",lts:!1,security:!1,v8:"3.8.6.0"},{name:"nodejs",version:"0.8.0",date:"2012-06-22",lts:!1,security:!1,v8:"3.11.10.10"},{name:"nodejs",version:"0.9.0",date:"2012-07-20",lts:!1,security:!1,v8:"3.11.10.15"},{name:"nodejs",version:"0.10.0",date:"2013-03-11",lts:!1,security:!1,v8:"3.14.5.8"},{name:"nodejs",version:"0.11.0",date:"2013-03-28",lts:!1,security:!1,v8:"3.17.13.0"},{name:"nodejs",version:"0.12.0",date:"2015-02-06",lts:!1,security:!1,v8:"3.28.73.0"},{name:"nodejs",version:"4.0.0",date:"2015-09-08",lts:!1,security:!1,v8:"4.5.103.30"},{name:"nodejs",version:"4.1.0",date:"2015-09-17",lts:!1,security:!1,v8:"4.5.103.33"},{name:"nodejs",version:"4.2.0",date:"2015-10-12",lts:"Argon",security:!1,v8:"4.5.103.35"},{name:"nodejs",version:"4.3.0",date:"2016-02-09",lts:"Argon",security:!1,v8:"4.5.103.35"},{name:"nodejs",version:"4.4.0",date:"2016-03-08",lts:"Argon",security:!1,v8:"4.5.103.35"},{name:"nodejs",version:"4.5.0",date:"2016-08-16",lts:"Argon",security:!1,v8:"4.5.103.37"},{name:"nodejs",version:"4.6.0",date:"2016-09-27",lts:"Argon",security:!0,v8:"4.5.103.37"},{name:"nodejs",version:"4.7.0",date:"2016-12-06",lts:"Argon",security:!1,v8:"4.5.103.43"},{name:"nodejs",version:"4.8.0",date:"2017-02-21",lts:"Argon",security:!1,v8:"4.5.103.45"},{name:"nodejs",version:"4.9.0",date:"2018-03-28",lts:" Line truncated
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme`)}}},currentNode:function(){return"node "+process.versions.node},env:process.env}});var zD=x((CNe,JD)=>{var GD=/^\s+and\s+(.*)/i,XD=/^(?:,\s*|\s+or\s+)(.*)/i;function YD(e){return Array.isArray(e)?e.reduce(function(t,r){return t.concat(YD(r))},[]):[e]}function $de(e,t){for(var r=e.length,n=1;n<=r;n++){var s=e.substr(-n,n);if(t(s,n,r))return e.slice(0,-n)}return""}function Xg(e,t){var r={query:t};t.indexOf("not ")===0&&(r.not=!0,t=t.slice(4));for(var n in e){var s=e[n],i=t.match(s.regexp);if(i){r.type=n;for(var a=0;a<s.matches.length;a++)r[s.matches[a]]=i[a+1];return r}}return r.type="unknown",r}function Wde(e,t,r){var n;return $de(t,function(s,i,a){return GD.test(s)?(n=Xg(e,s.match(GD)[1]),n.compose="and",r.unshift(n),!0):XD.test(s)?(n=Xg(e,s.match(XD)[1]),n.compose="or",r.unshift(n),!0):i===a?(n=Xg(e,s.trim()),n.compose="or",r.unshift(n),!0):!1})}JD.exports=function(t,r){return Array.isArray(r)||(r=[r]),YD(r.map(function(n){var s=[];do n=Wde(t,n,s);while(n);return s}))}});var hw=x((DNe,dw)=>{var Kde=pD(),gs=vD().agents,Bn=AD(),Yg=CD(),xp=require("path"),Gr=$g(),pr=HD(),Hde=zD(),Gde=365.259641*24*60*60*1e3,iw="37",Xde=14;function aw(e,t){return(e+".").indexOf(t+".")===0}function Yde(e){var t=e.slice(1);return Ce.nodeVersions.some(function(r){return aw(r,t)})}function QD(e){return e.filter(function(t){return typeof t=="string"})}function yp(e){var t=e;return e.split(".").length===3&&(t=e.split(".").slice(0,-1).join(".")),t}function Js(e){return function(r){return e+" "+r}}function tb(e){return parseInt(e.split(".")[0])}function gp(e,t){if(e.length===0)return[];var r=ow(e.map(tb)),n=r[r.length-t];if(!n)return e;for(var s=[],i=e.length-1;i>=0&&!(n>tb(e[i]));i--)s.unshift(e[i]);return s}function ow(e){for(var t=[],r=0;r<e.length;r++)t.indexOf(e[r])===-1&&t.push(e[r]);return t}function Sp(e,t,r){for(var n in r)e[t+" "+n]=r[n]}function ZD(e,t){if(t=parseFloat(t),e===">")return function(n){return r(n)>t};return e===">="?function(n){return r(n)>=t}:e==="<"?function(n){return parseFloat(n)<t}:function(n){return parseFloat(n)<=t};function r(n){return parseFloat(n.split("-")[1]||n)}}function Jde(e,t){return t=t.split(".").map(zs),t[1]=t[1]||0,t[2]=t[2]||0,e===">"?function(r){return r=r.split(".").map(zs),gl(r,t)>0}:e===">="?function(r){return r=r.split(".").map(zs),gl(r,t)>=0}:e==="<"?function(r){return r=r.split(".").map(zs),gl(t,r)>0}:function(r){return r=r.split(".").map(zs),gl(t,r)>=0}}function zs(e){return parseInt(e)}function Tp(e,t){return e<t?-1:e>t?1:0}function gl(e,t){return Tp(parseInt(e[0]),parseInt(t[0]))||Tp(parseInt(e[1]||"0"),parseInt(t[1]||"0"))||Tp(parseInt(e[2]||"0"),parseInt(t[2]||"0"))}function ew(e,t){switch(t=t.split(".").map(zs),typeof t[1]=="undefined"&&(t[1]="x"),e){case"<=":return function(r){return r=r.split(".").map(zs),tw(r,t)<=0};case">=":default:return function(r){return r=r.split(".").map(zs),tw(r,t)>=0}}}function tw(e,t){return e[0]!==t[0]?e[0]<t[0]?-1:1:t[1]==="x"?0:e[1]!==t[1]?e[1]<t[1]?-1:1:0}function zde(e,t){return e.versions.indexOf(t)!==-1?t:Ce.versionAliases[e.name][t]?Ce.versionAliases[e.name][t]:!1}function bp(e,t){var r=zde(e,t);return r||(e.versions.length===1?e.versions[0]:!1)}function lw(e,t){return e=e/1e3,Object.keys(gs).reduce(function(r,n){var s=Qs(n,t);if(!s)return r;var i=Object.keys(s.releaseDate).filter(function(a){var o=s.releaseDate[a];return o!==null&&o>=e});return r.concat(i.map(Js(s.name)))},[])}function rw(e){return{name:e.name,versions:e.versions,released:e.released,releaseDate:e.releaseDate}}function Qs(e,t){if(e=e.toLowerCase(),e=Ce.aliases[e]||e,t.mobileToDesktop&&Ce.desktopNames[e]){var r=Ce.data[Ce.desktopNames[e]];if(e==="android")return Zde(rw(Ce.data[e]),r);var n=rw(r);return n.name=e,n}return Ce.data[e]}function nw(e,t){var r=t.indexOf(iw);return e.filter(function(n){return/^(?:[2-4]\.|[34]$)/.test(n)}).concat(t.slice(r))}function Qde(e){var t={};for(var r in e)t[r]=e[r];return t}function Zde(e,t){return e.released=nw(e.released,t.released),e.versions=nw(e.versions,t.versions),e.releaseDate=Qde(e.releaseDate),e.released.forEach(function(r){e.releaseDate[r]===void 0&&(e.releaseDate[r]=t.releaseDate[r])}),e}function $a(e,t){var r=Qs(e,t);if(!r)throw new Gr("Unknown browser "+e);return r}function ehe(e){return new Gr("Unknown browser query `"+e+"`. Maybe you are using old Browserslist or made typo in query.")}function Ep(e,t,r,n){var s=1;switch(t){case"android":if(n.mobileToDesktop)return e;var i=Ce.data.chrome.released;s=i.length-i.indexOf(iw);break;case"op_mob":var a=Ce.data.op_mob.released.slice(-1)[0];s=tb(a)-Xde+1;break;default:return e}return r<=s?e.slice(-1):e.slice(s-1-r)}function sw(e,t){return typeof e=="string"&&(e.indexOf("y")>=0||t&&e.indexOf("a")>=0)}function Wa(e,t){return rb(e).reduce(function(r,n,s){if(n.not&&s===0)throw new Gr("Write any browsers query (for instance, `defaults`) before `"+n.query+"`");var i=nb[n.type],a=i.select.call(Ce,t,n).map(func Line truncated
- Did you mean '${(0,nhe.findSuggestion)(s,n)}'?`))}validateBooleanOption(t,r,n){return r===void 0?n:(this.invariant(typeof r=="boolean",`'${t}' option must be a boolean.`),r)}validateStringOption(t,r,n){return r===void 0?n:(this.invariant(typeof r=="string",`'${t}' option must be a string.`),r)}invariant(t,r){if(!t)throw new Error(this.formatMessage(r))}formatMessage(t){return`${this.descriptor}: ${t}`}};vp.OptionValidator=ab});var Ap=x(Pp=>{"use strict";Object.defineProperty(Pp,"__esModule",{value:!0});Object.defineProperty(Pp,"OptionValidator",{enumerable:!0,get:function(){return she.OptionValidator}});Object.defineProperty(Pp,"findSuggestion",{enumerable:!0,get:function(){return ihe.findSuggestion}});var she=yw(),ihe=ib()});var bw=x((NNe,gw)=>{"use strict";gw.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}});var Tw=x((ONe,Ew)=>{"use strict";Ew.exports=mt;mt.Node=$i;mt.create=mt;function mt(e){var t=this;if(t instanceof mt||(t=new mt),t.tail=null,t.head=null,t.length=0,e&&typeof e.forEach=="function")e.forEach(function(s){t.push(s)});else if(arguments.length>0)for(var r=0,n=arguments.length;r<n;r++)t.push(arguments[r]);return t}mt.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,r=e.prev;return t&&(t.prev=r),r&&(r.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=r),e.list.length--,e.next=null,e.prev=null,e.list=null,t};mt.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}};mt.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}};mt.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)ohe(this,arguments[e]);return this.length};mt.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)lhe(this,arguments[e]);return this.length};mt.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}};mt.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}};mt.prototype.forEach=function(e,t){t=t||this;for(var r=this.head,n=0;r!==null;n++)e.call(t,r.value,n,this),r=r.next};mt.prototype.forEachReverse=function(e,t){t=t||this;for(var r=this.tail,n=this.length-1;r!==null;n--)e.call(t,r.value,n,this),r=r.prev};mt.prototype.get=function(e){for(var t=0,r=this.head;r!==null&&t<e;t++)r=r.next;if(t===e&&r!==null)return r.value};mt.prototype.getReverse=function(e){for(var t=0,r=this.tail;r!==null&&t<e;t++)r=r.prev;if(t===e&&r!==null)return r.value};mt.prototype.map=function(e,t){t=t||this;for(var r=new mt,n=this.head;n!==null;)r.push(e.call(t,n.value,this)),n=n.next;return r};mt.prototype.mapReverse=function(e,t){t=t||this;for(var r=new mt,n=this.tail;n!==null;)r.push(e.call(t,n.value,this)),n=n.prev;return r};mt.prototype.reduce=function(e,t){var r,n=this.head;if(arguments.length>1)r=t;else if(this.head)n=this.head.next,r=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var s=0;n!==null;s++)r=e(r,n.value,s),n=n.next;return r};mt.prototype.reduceReverse=function(e,t){var r,n=this.tail;if(arguments.length>1)r=t;else if(this.tail)n=this.tail.prev,r=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var s=this.length-1;n!==null;s--)r=e(r,n.value,s),n=n.prev;return r};mt.prototype.toArray=function(){for(var e=new Array(this.length),t=0,r=this.head;r!==null;t++)e[t]=r.value,r=r.next;return e};mt.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,r=this.tail;r!==null;t++)e[t]=r.value,r=r.prev;return e};mt.prototype.slice=function(e,t){t=t||this.length,t<0&&(t+=this.length),e=e||0,e<0&&(e+=this.length);var r=new mt;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var n=0,s=this.head;s!==null&&n<e;n++)s=s.next;for(;s!==null&&n<t;n++,s=s.next)r.push(s.value);return r};mt.prototype.sliceReverse=function(e,t){t=t||this.length,t<0&&(t+=this.length),e=e||0,e<0&&(e+=this.length);var r=new mt;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var n=this.length,s=this.tail;s!==null&&n>t;n--)s=s.prev;for(;s!==null&&n>e;n--,s=s.prev)r.push(s.value);return r};mt.prototype.splice=function(e,t){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var r=0,n=this.head;n!==null&&r<e;r++)n=n.next;for(var s=[],r=0;n&&r<t;r++)s.push(n.value),n=this.removeNode(n);n===null&&(n=this.tail),n!==this.head&&n!==this.tail&&(n=n.prev);for(var r=2;r<arguments.length;r++)n=ahe(this,n,arguments[r]);return s};mt.prototype.reverse=function(){for(var e=this.head,t=this.tail,r=e;r!==null;r=r.prev){v Line truncated
- Did you mean '${(0,Kw.findSuggestion)(r,t)}'?`));return e}function Xw(e){return typeof e=="string"||Array.isArray(e)&&e.every(t=>typeof t=="string")}function Nhe(e){return yb.invariant(e===void 0||Xw(e),`'${String(e)}' is not a valid browserslist query`),e}function Ohe(e){return e.reduce((t,r)=>{let[n,s]=r.split(" "),i=Hw.browserNameMap[n];if(!i)return t;try{let a=s.split("-")[0].toLowerCase(),o=(0,Fn.isUnreleasedVersion)(a,i);if(!t[i])return t[i]=o?a:(0,Fn.semverify)(a),t;let l=t[i],u=(0,Fn.isUnreleasedVersion)(l,i);if(u&&o)t[i]=(0,Fn.getLowestUnreleased)(l,a,i);else if(u)t[i]=(0,Fn.semverify)(a);else if(!u&&!o){let c=(0,Fn.semverify)(a);t[i]=(0,Fn.semverMin)(l,c)}}catch{}return t},{})}function Bhe(e){e.length&&(console.warn(`Warning, the following targets are using a decimal version:
`),e.forEach(({target:t,value:r})=>console.warn(` ${t}: ${r}`)),console.warn(`
We recommend using a string for minor/patch versions to avoid numbers like 6.10
getting parsed as 6.1, which can lead to unexpected behavior.
`))}function Yw(e,t){try{return(0,Fn.semverify)(t)}catch{throw new Error(yb.formatMessage(`'${t}' is not a valid value for 'targets.${e}'.`))}}function khe(e){return["node",e===!0||e==="current"?process.versions.node.split("-")[0]:Yw("node",e)]}function Fhe(e,t){let r=(0,Fn.isUnreleasedVersion)(t,e)?t.toLowerCase():Yw(e,t);return[e,r]}function Lhe(e){let t=Object.assign({},e);return delete t.esmodules,delete t.browsers,t}function jhe(e,t){let r=hb(e,{mobileToDesktop:!0,env:t});return Ohe(r)}var Ww=new Che({max:64});function Mhe(e,t){let r=typeof e=="string"?e:e.join()+t,n=Ww.get(r);return n||(n=jhe(e,t),Ww.set(r,n)),Object.assign({},n)}function Rhe(e={},t={}){var r,n;let{browsers:s,esmodules:i}=e,{configPath:a=".",onBrowserslistConfigFound:o}=t;Nhe(s);let l=Lhe(e),u=_he(l),p=!!s||Object.keys(u).length>0,d=!t.ignoreBrowserslistConfig&&!p;if(!s&&d){if(s=process.env.BROWSERSLIST,!s){let f=t.configFile||process.env.BROWSERSLIST_CONFIG||hb.findConfigFile(a);f!=null&&(o==null||o(f),s=hb.loadConfig({config:f,env:t.browserslistEnv}))}s==null&&(s=[])}if(i&&(i!=="intersect"||!((r=s)!=null&&r.length))&&(s=Object.keys(db).map(f=>`${f} >= ${db[f]}`).join(", "),i=!1),(n=s)!=null&&n.length){let f=Mhe(s,t.browserslistEnv);if(i==="intersect")for(let b of Object.keys(f))if(b!=="deno"&&b!=="ie"){let T=db[b==="opera_mobile"?"op_mob":b];if(T){let w=f[b];f[b]=(0,Fn.getHighestUnreleased)(w,(0,Fn.semverify)(T),b)}else delete f[b]}else delete f[b];u=Object.assign(f,u)}let m={},g=[];for(let f of Object.keys(u).sort()){let b=u[f];typeof b=="number"&&b%1!==0&&g.push({target:f,value:b});let[T,w]=f==="node"?khe(b):Fhe(f,b);w&&(m[T]=w)}return Bhe(g),m}});var bb=x(Bp=>{"use strict";Object.defineProperty(Bp,"__esModule",{value:!0});Bp.resolveBrowserslistConfigFile=qhe;Bp.resolveTargets=Uhe;function Jw(){let e=require("path");return Jw=function(){return e},e}function zw(){let e=gb();return zw=function(){return e},e}function qhe(e,t){return Jw().resolve(t,e)}function Uhe(e,t){let r=e.targets,n;typeof r=="string"||Array.isArray(r)?n={browsers:r}:r&&("esmodules"in r?n=Object.assign({},r,{esmodules:"intersect"}):n=r);let{browserslistConfigFile:s}=e,i,a=!1;return typeof s=="string"?i=s:a=s===!1,(0,zw().default)(n,{ignoreBrowserslistConfig:a,configFile:i,configPath:t,browserslistEnv:e.browserslistEnv})}});var Eb=x(Sl=>{"use strict";Object.defineProperty(Sl,"__esModule",{value:!0});Sl.createCachedDescriptors=Khe;Sl.createDescriptor=oI;Sl.createUncachedDescriptors=Hhe;function tI(){let e=Zr();return tI=function(){return e},e}var Qw=cD(),Zw=Pl(),Vhe=vl(),xl=Ri(),$he=bb();function Whe(e,t){var r,n,s,i;return e.name===t.name&&e.value===t.value&&e.options===t.options&&e.dirname===t.dirname&&e.alias===t.alias&&e.ownPass===t.ownPass&&((r=e.file)==null?void 0:r.request)===((n=t.file)==null?void 0:n.request)&&((s=e.file)==null?void 0:s.resolved)===((i=t.file)==null?void 0:i.resolved)}function*eI(e){return e}function rI(e,t){return typeof e.browserslistConfigFile=="string"&&(e.browserslistConfigFile=(0,$he.resolveBrowserslistConfigFile)(e.browserslistConfigFile,t)),e}function Khe(e,t,r){let{plugins:n,presets:s,passPerPreset:i}=t;return{options:rI(t,e),plugins:n?()=>Jhe(n,e)(r):()=>eI([]),presets:s?()=>Xhe(s,e)(r)(!!i):()=>eI([])}}function Hhe(e,t,r){return{options:rI(t,e),plugins:(0,Qw.once)(()=>iI(t.plugins||[],e,r)),presets:(0,Qw.once)(()=>sI(t.presets||[],e,r,!!t.passPerPreset))}}var Ghe=new WeakMap,Xhe=(0,xl.makeWeakCacheSync)((e,t)=>{let r=t.using(n=>n);return(0,xl.makeStrongCacheSync)(n=>(0,xl.makeStrongCache)(function*(s){return(yield*sI(e,r,n,s)).map(a=>nI(Ghe,a))}))}),Yhe=new WeakMap,Jhe=(0,xl.makeWeakCacheSync)((e,t)=>{let r=t.using(n=>n);return(0,xl.makeStrongCache)(function*(n){return(yield*iI(e,r,n)).map(i=>nI(Yhe,i))})}),zhe={};function nI(e,t){let{value:r,options:n=zhe}=t;if(n===!1)return t;let s=e.get(r);s||(s=new WeakMap,e.set(r,s));let i=s.get(n);if(i||(i=[],s.set(n,i)),!i.includes(t)){let a=i.filter(o=>Whe(o,t));if(a.length>0)return a[0];i.push(t)}return t}function*sI(e,t,r,n){return yield*aI("preset",e,t,r,n)}function*iI(e,t,r){return yield*aI("plugin",e,t,r)}function*aI(e,t,r,n,s){let i=yield*tI().all(t.map((a,o)=>oI(a,r,{type:e,alias:`${n}$${o}`,ownPass:!!s})));return Qhe(i),i}function*oI(e,t,{type:r,alias:n,ownPass:s}){let i=(0,Vhe.getItemDescriptor)(e);if(i)return i;let a,o,l=e;Array.isArray(l)&&(l.length===3?[l,o,a]=l:[l,o]=l);let u,c=null;if(typeof l=="string"){if(typeof r!="string")throw new Error("To resolve a string-based item, the type of item must be given");let p=r==="plugin"?Zw.loadPlugin:Zw.loadPreset,d=l;({filepath:c,value:l}=yield*p(l,t)),u={request:d,resolved:c}}if(!l)throw new Error(`Unexpected falsy value: ${String(l)}`);if(typeof l=="object"&&l.__esModule)if(l.default)l=l.default;else throw new Error("Must export a default export when using ES6 modules.");if(typeof l!="object"&&typeof l!="function")throw new Error(`Unsupported format: ${typeof l}. Expected an object or a function.`);if(c!==null&&typeof l=="object"&&l Line truncated
`))}n.add(r.name)}}});var vl=x(Al=>{"use strict";Object.defineProperty(Al,"__esModule",{value:!0});Al.createConfigItem=eme;Al.createItemFromDescriptor=uI;Al.getItemDescriptor=tme;function lI(){let e=require("path");return lI=function(){return e},e}var Zhe=Eb();function uI(e){return new kp(e)}function*eme(e,{dirname:t=".",type:r}={}){let n=yield*(0,Zhe.createDescriptor)(e,lI().resolve(t),{type:r,alias:"programmatic item"});return uI(n)}var Tb=Symbol.for("@babel/core@7 - ConfigItem");function tme(e){if(e!=null&&e[Tb])return e._descriptor}var kp=class{constructor(t){this._descriptor=void 0,this[Tb]=!0,this.value=void 0,this.options=void 0,this.dirname=void 0,this.name=void 0,this.file=void 0,this._descriptor=t,Object.defineProperty(this,"_descriptor",{enumerable:!1}),Object.defineProperty(this,Tb,{enumerable:!1}),this.value=this._descriptor.value,this.options=this._descriptor.options,this.dirname=this._descriptor.dirname,this.name=this._descriptor.name,this.file=this._descriptor.file?{request:this._descriptor.file.request,resolved:this._descriptor.file.resolved}:void 0,Object.freeze(this)}};Object.freeze(kp.prototype)});var cI=x(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});Fp.default=void 0;var zNe=Fp.default={auxiliaryComment:{message:"Use `auxiliaryCommentBefore` or `auxiliaryCommentAfter`"},blacklist:{message:"Put the specific transforms you want in the `plugins` option"},breakConfig:{message:"This is not a necessary option in Babel 6"},experimental:{message:"Put the specific transforms you want in the `plugins` option"},externalHelpers:{message:"Use the `external-helpers` plugin instead. Check out http://babeljs.io/docs/plugins/external-helpers/"},extra:{message:""},jsxPragma:{message:"use the `pragma` option in the `react-jsx` plugin. Check out http://babeljs.io/docs/plugins/transform-react-jsx/"},loose:{message:"Specify the `loose` option for the relevant plugin you are using or use a preset that sets the option."},metadataUsedHelpers:{message:"Not required anymore as this is enabled by default"},modules:{message:"Use the corresponding module transform plugin in the `plugins` option. Check out http://babeljs.io/docs/plugins/#modules"},nonStandard:{message:"Use the `react-jsx` and `flow-strip-types` plugins to support JSX and Flow. Also check out the react preset http://babeljs.io/docs/plugins/preset-react/"},optional:{message:"Put the specific transforms you want in the `plugins` option"},sourceMapName:{message:"The `sourceMapName` option has been removed because it makes more sense for the tooling that calls Babel to assign `map.file` themselves."},stage:{message:"Check out the corresponding stage-x presets http://babeljs.io/docs/plugins/#presets"},whitelist:{message:"Put the specific transforms you want in the `plugins` option"},resolveModuleSource:{version:6,message:"Use `babel-plugin-module-resolver@3`'s 'resolvePath' options"},metadata:{version:6,message:"Generated plugin metadata is always included in the output result"},sourceMapTarget:{version:6,message:"The `sourceMapTarget` option has been removed because it makes more sense for the tooling that calls Babel to assign `map.file` themselves."}}});var vb=x(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.access=en;Gt.assertArray=Sb;Gt.assertAssumptions=Tme;Gt.assertBabelrcSearch=mme;Gt.assertBoolean=xb;Gt.assertCallerMetadata=ome;Gt.assertCompact=ime;Gt.assertConfigApplicableTest=dme;Gt.assertConfigFileSearch=hme;Gt.assertFunction=cme;Gt.assertIgnoreList=pme;Gt.assertInputSourceMap=lme;Gt.assertObject=dI;Gt.assertPluginList=yme;Gt.assertRootMode=nme;Gt.assertSourceMaps=sme;Gt.assertSourceType=ame;Gt.assertString=ume;Gt.assertTargets=bme;Gt.msg=it;function Cl(){let e=gb();return Cl=function(){return e},e}var rme=Dl();function it(e){switch(e.type){case"root":return"";case"env":return`${it(e.parent)}.env["${e.name}"]`;case"overrides":return`${it(e.parent)}.overrides[${e.index}]`;case"option":return`${it(e.parent)}.${e.name}`;case"access":return`${it(e.parent)}[${JSON.stringify(e.name)}]`;default:throw new Error(`Assertion failure: Unknown type ${e.type}`)}}function en(e,t){return{type:"access",name:t,parent:e}}function nme(e,t){if(t!==void 0&&t!=="root"&&t!=="upward"&&t!=="upward-optional")throw new Error(`${it(e)} must be a "root", "upward", "upward-optional" or undefined`);return t}function sme(e,t){if(t!==void 0&&typeof t!="boolean"&&t!=="inline"&&t!=="both")throw new Error(`${it(e)} must be a boolean, "inline", "both", or undefined`);return t}function ime(e,t){if(t!==void 0&&typeof t!="boolean"&&t!=="auto")throw new Error(`${it(e)} must be a boolean, "auto", or undefined`);return t}function ame(e,t){if(t!==void 0&&t!=="module"&&t!=="commonjs"&&t!=="script"&&t!=="unambiguous")throw new Error(`${it(e)} must be "module", "commonjs", "script", "unambiguous", or undefined`);return t}function ome(e,t){let r=dI(e,t);if(r){if(typeof r.name!="string")throw new Error(`${it(e)} set but does not contain "name" prLine truncated
- Maybe you meant to use
"${r}s": [
["${s.file.request}", ${JSON.stringify(i.value,void 0,2)}]
]
To be a valid ${r}, its name and options should be wrapped in a pair of brackets`)}});var Ib=x(wb=>{"use strict";Object.defineProperty(wb,"__esModule",{value:!0});wb.default=Nme;function jp(){let e=require("path");return jp=function(){return e},e}var wl=`\\${jp().sep}`,Ab=`(?:${wl}|$)`,Cb=`[^${wl}]+`,Db=`(?:${Cb}${wl})`,xI=`(?:${Cb}${Ab})`,Ime=`${Db}*?`,_me=`${Db}*?${xI}?`;function TI(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&")}function Nme(e,t){let r=jp().resolve(t,e).split(jp().sep);return new RegExp(["^",...r.map((n,s)=>{let i=s===r.length-1;return n==="**"?i?_me:Ime:n==="*"?i?xI:Db:n.indexOf("*.")===0?Cb+TI(n.slice(1))+(i?Ab:wl):TI(n)+(i?Ab:wl)})].join(""))}});var PI=x(Ya=>{"use strict";Object.defineProperty(Ya,"__esModule",{value:!0});Ya.ConfigPrinter=Ya.ChainFormatter=void 0;function vI(){let e=Zr();return vI=function(){return e},e}var Ome=Ya.ChainFormatter={Programmatic:0,Config:1},_b={title(e,t,r){let n="";return e===Ome.Programmatic?(n="programmatic options",t&&(n+=" from "+t)):n="config "+r,n},loc(e,t){let r="";return e!=null&&(r+=`.overrides[${e}]`),t!=null&&(r+=`.env["${t}"]`),r},*optionsAndDescriptors(e){let t=Object.assign({},e.options);delete t.overrides,delete t.env;let r=[...yield*e.plugins()];r.length&&(t.plugins=r.map(s=>SI(s)));let n=[...yield*e.presets()];return n.length&&(t.presets=[...n].map(s=>SI(s))),JSON.stringify(t,void 0,2)}};function SI(e){var t;let r=(t=e.file)==null?void 0:t.request;return r==null&&(typeof e.value=="object"?r=e.value:typeof e.value=="function"&&(r=`[Function: ${e.value.toString().slice(0,50)} ... ]`)),r==null&&(r="[Unknown]"),e.options===void 0?r:e.name==null?[r,e.options]:[r,e.options,e.name]}var Nb=class e{constructor(){this._stack=[]}configure(t,r,{callerName:n,filepath:s}){return t?(i,a,o)=>{this._stack.push({type:r,callerName:n,filepath:s,content:i,index:a,envName:o})}:()=>{}}static*format(t){let r=_b.title(t.type,t.callerName,t.filepath),n=_b.loc(t.index,t.envName);n&&(r+=` ${n}`);let s=yield*_b.optionsAndDescriptors(t.content);return`${r}
${s}`}*output(){return this._stack.length===0?"":(yield*vI().all(this._stack.map(r=>e.format(r)))).join(`
`)}};Ya.ConfigPrinter=Nb});var Ub=x(za=>{"use strict";Object.defineProperty(za,"__esModule",{value:!0});za.buildPresetChain=Fme;za.buildPresetChainWalker=void 0;za.buildRootChain=Ume;function DI(){let e=require("path");return DI=function(){return e},e}function wI(){let e=Ti();return wI=function(){return e},e}var Fb=Dl(),II=Ib(),_l=PI(),Bme=fs(),kme=qi(),Il=Pl(),ir=Ri(),mn=Eb(),AI=wI()("babel:config:config-chain");function*Fme(e,t){let r=yield*Lme(e,t);return r?{plugins:qp(r.plugins),presets:qp(r.presets),options:r.options.map(n=>_I(n)),files:new Set}:null}var Lme=za.buildPresetChainWalker=qb({root:e=>jme(e),env:(e,t)=>Mme(e)(t),overrides:(e,t)=>Rme(e)(t),overridesEnv:(e,t,r)=>qme(e)(t)(r),createLogger:()=>()=>{}}),jme=(0,ir.makeWeakCacheSync)(e=>Lb(e,e.alias,mn.createUncachedDescriptors)),Mme=(0,ir.makeWeakCacheSync)(e=>(0,ir.makeStrongCacheSync)(t=>jb(e,e.alias,mn.createUncachedDescriptors,t))),Rme=(0,ir.makeWeakCacheSync)(e=>(0,ir.makeStrongCacheSync)(t=>Mb(e,e.alias,mn.createUncachedDescriptors,t))),qme=(0,ir.makeWeakCacheSync)(e=>(0,ir.makeStrongCacheSync)(t=>(0,ir.makeStrongCacheSync)(r=>Rb(e,e.alias,mn.createUncachedDescriptors,t,r))));function*Ume(e,t){let r,n,s=new _l.ConfigPrinter,i=yield*Hme({options:e,dirname:t.cwd},t,void 0,s);if(!i)return null;let a=yield*s.output(),o;typeof e.configFile=="string"?o=yield*(0,Il.loadConfig)(e.configFile,t.cwd,t.envName,t.caller):e.configFile!==!1&&(o=yield*(0,Il.findRootConfig)(t.root,t.envName,t.caller));let{babelrc:l,babelrcRoots:u}=e,c=t.cwd,p=Rp(),d=new _l.ConfigPrinter;if(o){let w=$me(o),I=yield*Bb(w,t,void 0,d);if(!I)return null;r=yield*d.output(),l===void 0&&(l=w.options.babelrc),u===void 0&&(c=w.dirname,u=w.options.babelrcRoots),Ja(p,I)}let m,g,f=!1,b=Rp();if((l===!0||l===void 0)&&typeof t.filename=="string"){let w=yield*(0,Il.findPackageData)(t.filename);if(w&&Vme(t,w,u,c)){if({ignore:m,config:g}=yield*(0,Il.findRelativeConfig)(w,t.envName,t.caller),m&&b.files.add(m.filepath),m&&NI(t,m.ignore,null,m.dirname)&&(f=!0),g&&!f){let I=Wme(g),N=new _l.ConfigPrinter,L=yield*Bb(I,t,void 0,N);L?(n=yield*N.output(),Ja(b,L)):f=!0}g&&f&&b.files.add(g.filepath)}}t.showConfig&&console.log(`Babel configs on "${t.filename}" (ascending priority):
`+[r,n,a].filter(w=>!!w).join(`
`)+`
-----End Babel configs-----`);let T=Ja(Ja(Ja(Rp(),p),b),i);return{plugins:f?[]:qp(T.plugins),presets:f?[]:qp(T.presets),options:f?[]:T.options.map(w=>_I(w)),fileHandling:f?"ignored":"transpile",ignore:m||void 0,babelrc:g||void 0,config:o||void 0,files:T.files}}function Vme(e,t,r,n){if(typeof r=="boolean")return r;let s=e.root;if(r===void 0)return t.directories.includes(s);let i=r;return Array.isArray(i)||(i=[i]),i=i.map(a=>typeof a=="string"?DI().resolve(n,a):a),i.length===1&&i[0]===s?t.directories.includes(s):i.some(a=>(typeof a=="string"&&(a=(0,II.default)(a,n)),t.directories.some(o=>OI(a,n,o,e))))}var $me=(0,ir.makeWeakCacheSync)(e=>({filepath:e.filepath,dirname:e.dirname,options:(0,Fb.validate)("configfile",e.options,e.filepath)})),Wme=(0,ir.makeWeakCacheSync)(e=>({filepath:e.filepath,dirname:e.dirname,options:(0,Fb.validate)("babelrcfile",e.options,e.filepath)})),Kme=(0,ir.makeWeakCacheSync)(e=>({filepath:e.filepath,dirname:e.dirname,options:(0,Fb.validate)("extendsfile",e.options,e.filepath)})),Hme=qb({root:e=>Lb(e,"base",mn.createCachedDescriptors),env:(e,t)=>jb(e,"base",mn.createCachedDescriptors,t),overrides:(e,t)=>Mb(e,"base",mn.createCachedDescriptors,t),overridesEnv:(e,t,r)=>Rb(e,"base",mn.createCachedDescriptors,t,r),createLogger:(e,t,r)=>Zme(e,t,r)}),Gme=qb({root:e=>Xme(e),env:(e,t)=>Yme(e)(t),overrides:(e,t)=>Jme(e)(t),overridesEnv:(e,t,r)=>zme(e)(t)(r),createLogger:(e,t,r)=>Qme(e.filepath,t,r)});function*Bb(e,t,r,n){let s=yield*Gme(e,t,r,n);return s==null||s.files.add(e.filepath),s}var Xme=(0,ir.makeWeakCacheSync)(e=>Lb(e,e.filepath,mn.createUncachedDescriptors)),Yme=(0,ir.makeWeakCacheSync)(e=>(0,ir.makeStrongCacheSync)(t=>jb(e,e.filepath,mn.createUncachedDescriptors,t))),Jme=(0,ir.makeWeakCacheSync)(e=>(0,ir.makeStrongCacheSync)(t=>Mb(e,e.filepath,mn.createUncachedDescriptors,t))),zme=(0,ir.makeWeakCacheSync)(e=>(0,ir.makeStrongCacheSync)(t=>(0,ir.makeStrongCacheSync)(r=>Rb(e,e.filepath,mn.createUncachedDescriptors,t,r))));function Qme(e,t,r){return r?r.configure(t.showConfig,_l.ChainFormatter.Config,{filepath:e}):()=>{}}function Lb({dirname:e,options:t},r,n){return n(e,t,r)}function Zme(e,t,r){var n;return r?r.configure(t.showConfig,_l.ChainFormatter.Programmatic,{callerName:(n=t.caller)==null?void 0:n.name}):()=>{}}function jb({dirname:e,options:t},r,n,s){var i;let a=(i=t.env)==null?void 0:i[s];return a?n(e,a,`${r}.env["${s}"]`):null}function Mb({dirname:e,options:t},r,n,s){var i;let a=(i=t.overrides)==null?void 0:i[s];if(!a)throw new Error("Assertion failure - missing override");return n(e,a,`${r}.overrides[${s}]`)}function Rb({dirname:e,options:t},r,n,s,i){var a,o;let l=(a=t.overrides)==null?void 0:a[s];if(!l)throw new Error("Assertion failure - missing override");let u=(o=l.env)==null?void 0:o[i];return u?n(e,u,`${r}.overrides[${s}].env["${i}"]`):null}function qb({root:e,env:t,overrides:r,overridesEnv:n,createLogger:s}){return function*(a,o,l=new Set,u){let{dirname:c}=a,p=[],d=e(a);if(Mp(d,c,o,a.filepath)){p.push({config:d,envName:void 0,index:void 0});let f=t(a,o.envName);f&&Mp(f,c,o,a.filepath)&&p.push({config:f,envName:o.envName,index:void 0}),(d.options.overrides||[]).forEach((b,T)=>{let w=r(a,T);if(Mp(w,c,o,a.filepath)){p.push({config:w,index:T,envName:void 0});let I=n(a,T,o.envName);I&&Mp(I,c,o,a.filepath)&&p.push({config:I,index:T,envName:o.envName})}})}if(p.some(({config:{options:{ignore:f,only:b}}})=>NI(o,f,b,c)))return null;let m=Rp(),g=s(a,o,u);for(let{config:f,index:b,envName:T}of p){if(!(yield*eye(m,f.options,c,o,l,u)))return null;g(f,b,T),yield*tye(m,f)}return m}}function*eye(e,t,r,n,s,i){if(t.extends===void 0)return!0;let a=yield*(0,Il.loadConfig)(t.extends,r,n.envName,n.caller);if(s.has(a))throw new Error(`Configuration cycle detected loading ${a.filepath}.
File already loaded following the config chain:
`+Array.from(s,l=>` - ${l.filepath}`).join(`
`));s.add(a);let o=yield*Bb(Kme(a),n,s,i);return s.delete(a),o?(Ja(e,o),!0):!1}function Ja(e,t){e.options.push(...t.options),e.plugins.push(...t.plugins),e.presets.push(...t.presets);for(let r of t.files)e.files.add(r);return e}function*tye(e,{options:t,plugins:r,presets:n}){return e.options.push(t),e.plugins.push(...yield*r()),e.presets.push(...yield*n()),e}function Rp(){return{options:[],presets:[],plugins:[],files:new Set}}function _I(e){let t=Object.assign({},e);return delete t.extends,delete t.env,delete t.overrides,delete t.plugins,delete t.presets,delete t.passPerPreset,delete t.ignore,delete t.only,delete t.test,delete t.include,delete t.exclude,hasOwnProperty.call(t,"sourceMap")&&(t.sourceMaps=t.sourceMap,delete t.sourceMap),t}function qp(e){let t=new Map,r=[];for(let n of e)if(typeof n.value=="function"){let s=n.value,i=t.get(s);i||(i=new Map,t.set(s,i));let a=i.get(n.name);a?a.value=n:(a={value:n},r.push(a),n.ownPass||i.set(n.name,a))}else r.push({value:n});return r.reduce((n,s)=>(n.push(s.value),n),[])}function Mp({options:e},t,r,n){return(e.test===void 0||Ob(r,e.test,t,n))&&(e.include===void 0||Ob(r,e.include,t,n))&&(e.exclude===void 0||!Ob(r,e.exclude,t,n))}function Ob(e,t,r,n){let s=Array.isArray(t)?t:[t];return kb(e,s,r,n)}function CI(e,t){return t instanceof RegExp?String(t):t}function NI(e,t,r,n){if(t&&kb(e,t,n)){var s;let a=`No config is applied to "${(s=e.filename)!=null?s:"(unknown)"}" because it matches one of \`ignore: ${JSON.stringify(t,CI)}\` from "${n}"`;return AI(a),e.showConfig&&console.log(a),!0}if(r&&!kb(e,r,n)){var i;let a=`No config is applied to "${(i=e.filename)!=null?i:"(unknown)"}" because it fails to match one of \`only: ${JSON.stringify(r,CI)}\` from "${n}"`;return AI(a),e.showConfig&&console.log(a),!0}return!1}function kb(e,t,r,n){return t.some(s=>OI(s,r,e.filename,e,n))}function OI(e,t,r,n,s){if(typeof e=="function")return!!(0,Bme.endHiddenCallStack)(e)(r,{dirname:t,envName:n.envName,caller:n.caller});if(typeof r!="string")throw new kme.default("Configuration contains string/RegExp pattern, but no filename was passed to Babel",s);return typeof e=="string"&&(e=(0,II.default)(e,t)),e.test(r)}});var BI=x(Vb=>{"use strict";Object.defineProperty(Vb,"__esModule",{value:!0});Vb.validatePluginObject=iye;var Ts=vb(),rye={name:Ts.assertString,manipulateOptions:Ts.assertFunction,pre:Ts.assertFunction,post:Ts.assertFunction,inherits:Ts.assertFunction,visitor:nye,parserOverride:Ts.assertFunction,generatorOverride:Ts.assertFunction};function nye(e,t){let r=(0,Ts.assertObject)(e,t);if(r&&(Object.keys(r).forEach(n=>{n!=="_exploded"&&n!=="_verified"&&sye(n,r[n])}),r.enter||r.exit))throw new Error(`${(0,Ts.msg)(e)} cannot contain catch-all "enter" or "exit" handlers. Please target individual nodes.`);return r}function sye(e,t){if(t&&typeof t=="object")Object.keys(t).forEach(r=>{if(r!=="enter"&&r!=="exit")throw new Error(`.visitor["${e}"] may only have .enter and/or .exit handlers.`)});else if(typeof t!="function")throw new Error(`.visitor["${e}"] must be a function`)}function iye(e){let t={type:"root",source:"plugin"};return Object.keys(e).forEach(r=>{let n=rye[r];if(n)n({type:"option",name:r,parent:t},e[r]);else{let s=new Error(`.${r} is not a valid Plugin property`);throw s.code="BABEL_UNKNOWN_PLUGIN_PROPERTY",s}}),e}});var Wb=x($b=>{"use strict";Object.defineProperty($b,"__esModule",{value:!0});$b.getEnv=aye;function aye(e="development"){return process.env.BABEL_ENV||process.env.NODE_ENV||e}});var Kb=x(Wp=>{"use strict";Object.defineProperty(Wp,"__esModule",{value:!0});Wp.default=FI;Wp.loadPartialConfig=yye;function Up(){let e=require("path");return Up=function(){return e},e}var oye=dp(),lye=Zc(),kI=vl(),uye=Ub(),cye=Wb(),pye=Dl(),Vp=Pl(),fye=bb(),dye=["showIgnoredFiles"];function hye(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function mye(e,t){switch(t){case"root":return e;case"upward-optional":{let r=(0,Vp.findConfigUpwards)(e);return r===null?e:r}case"upward":{let r=(0,Vp.findConfigUpwards)(e);if(r!==null)return r;throw Object.assign(new Error(`Babel was run with rootMode:"upward" but a root could not be found when searching upward from "${e}".
One of the following config files must be in the directory tree: "${Vp.ROOT_CONFIG_FILENAMES.join(", ")}".`),{code:"BABEL_ROOT_NOT_FOUND",dirname:e})}default:throw new Error("Assertion failure - unknown rootMode value.")}}function*FI(e){if(e!=null&&(typeof e!="object"||Array.isArray(e)))throw new Error("Babel options must be an object, null, or undefined");let t=e?(0,pye.validate)("arguments",e):{},{envName:r=(0,cye.getEnv)(),cwd:n=".",root:s=".",rootMode:i="root",caller:a,cloneInputAst:o=!0}=t,l=Up().resolve(n),u=mye(Up().resolve(l,s),i),c=typeof t.filename=="string"?Up().resolve(n,t.filename):void 0,p=yield*(0,Vp.resolveShowConfigPath)(l),d={filename:c,cwd:l,root:u,envName:r,caller:a,showConfig:p===c},m=yield*(0,uye.buildRootChain)(t,d);if(!m)return null;let g={assumptions:{}};return m.options.forEach(b=>{(0,lye.mergeOptions)(g,b)}),{options:Object.assign({},g,{targets:(0,fye.resolveTargets)(g,u),cloneInputAst:o,babelrc:!1,configFile:!1,browserslistConfigFile:!1,passPerPreset:!1,envName:d.envName,cwd:d.cwd,root:d.root,rootMode:"root",filename:typeof d.filename=="string"?d.filename:void 0,plugins:m.plugins.map(b=>(0,kI.createItemFromDescriptor)(b)),presets:m.presets.map(b=>(0,kI.createItemFromDescriptor)(b))}),context:d,fileHandling:m.fileHandling,ignore:m.ignore,babelrc:m.babelrc,config:m.config,files:m.files}}function*yye(e){let t=!1;if(typeof e=="object"&&e!==null&&!Array.isArray(e)){var r=e;({showIgnoredFiles:t}=r),e=hye(r,dye)}let n=yield*FI(e);if(!n)return null;let{options:s,babelrc:i,ignore:a,config:o,fileHandling:l,files:u}=n;return l==="ignored"&&!t?null:((s.plugins||[]).forEach(c=>{if(c.value instanceof oye.default)throw new Error("Passing cached plugin instances is not supported in babel.loadPartialConfig()")}),new $p(s,i?i.filepath:void 0,a?a.filepath:void 0,o?o.filepath:void 0,l,u))}var $p=class{constructor(t,r,n,s,i,a){this.options=void 0,this.babelrc=void 0,this.babelignore=void 0,this.config=void 0,this.fileHandling=void 0,this.files=void 0,this.options=t,this.babelignore=n,this.babelrc=r,this.config=s,this.fileHandling=i,this.files=a,Object.freeze(this)}hasFilesystemConfig(){return this.babelrc!==void 0||this.config!==void 0}};Object.freeze($p.prototype)});var WI=x(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});Kp.default=void 0;function RI(){let e=Zr();return RI=function(){return e},e}var Xb=Gs(),LI=Zc(),gye=vt(),qI=dp(),bye=vl(),Eye=Ub(),zb=pp();function Yb(){let e=zt();return Yb=function(){return e},e}var Qb=Ri(),Jb=Dl(),Tye=BI(),UI=jg(),xye=Kb(),Sye=qi(),lOe=Kp.default=RI()(function*(t){var r;let n=yield*(0,xye.default)(t);if(!n)return null;let{options:s,context:i,fileHandling:a}=n;if(a==="ignored")return null;let o={},{plugins:l,presets:u}=s;if(!l||!u)throw new Error("Assertion failure - plugins and presets exist");let c=Object.assign({},i,{targets:s.targets}),p=N=>{let L=(0,bye.getItemDescriptor)(N);if(!L)throw new Error("Assertion failure - must be config item");return L},d=u.map(p),m=l.map(p),g=[[]],f=[],b=[];if(yield*jI(i,function*N(L,W){let U=[];for(let pe=0;pe<L.length;pe++){let Ee=L[pe];if(Ee.options!==!1){try{var H=yield*wye(Ee,c)}catch(ce){throw ce.code==="BABEL_UNKNOWN_OPTION"&&(0,Jb.checkNoUnwrappedItemOptionPairs)(L,pe,"preset",ce),ce}b.push(H.externalDependencies),Ee.ownPass?U.push({preset:H.chain,pass:[]}):U.unshift({preset:H.chain,pass:W})}}if(U.length>0){g.splice(1,0,...U.map(pe=>pe.pass).filter(pe=>pe!==W));for(let{preset:pe,pass:Ee}of U){if(!pe||(Ee.push(...pe.plugins),yield*N(pe.presets,Ee)))return!0;pe.options.forEach(qe=>{(0,LI.mergeOptions)(o,qe)})}}})(d,g[0]))return null;let w=o;(0,LI.mergeOptions)(w,s);let I=Object.assign({},c,{assumptions:(r=w.assumptions)!=null?r:{}});return yield*jI(i,function*(){g[0].unshift(...m);for(let W of g){let U=[];f.push(U);for(let H=0;H<W.length;H++){let pe=W[H];if(pe.options!==!1){try{var L=yield*$I(pe,I)}catch(Ee){throw Ee.code==="BABEL_UNKNOWN_PLUGIN_PROPERTY"&&(0,Jb.checkNoUnwrappedItemOptionPairs)(W,H,"plugin",Ee),Ee}U.push(L),b.push(L.externalDependencies)}}}})(),w.plugins=f[0],w.presets=f.slice(1).filter(N=>N.length>0).map(N=>({plugins:N})),w.passPerPreset=w.presets.length>0,{options:w,passes:f,externalDependencies:(0,zb.finalize)(b)}});function jI(e,t){return function*(r,n){try{return yield*t(r,n)}catch(i){if(!/^\[BABEL\]/.test(i.message)){var s;i.message=`[BABEL] ${(s=e.filename)!=null?s:"unknown file"}: ${i.message}`}throw i}}}var VI=e=>(0,Qb.makeWeakCache)(function*({value:t,options:r,dirname:n,alias:s},i){if(r===!1)throw new Error("Assertion failure");r=r||{};let a=[],o=t;if(typeof t=="function"){let l=(0,Xb.maybeAsync)(t,"You appear to be using an async plugin/preset, but Babel has been called synchronously"),u=Object.assign({},gye,e(i,a));try{o=yield*l(u,r,n)}catch(c){throw s&&(c.message+=` (While processing: ${JSON.stringify(s)})`),c}}if(!o||typeof o!="object")throw new Error("Plugin/Preset did not return an object.");if((0,Xb.isThenable)(o))throw yield*[],new Error(`You appear to be using a proLine truncated
(While processing: ${JSON.stringify(s)})`,new Error(l)}return{value:o,options:r,dirname:n,alias:s,externalDependencies:(0,zb.finalize)(a)}}),vye=VI(UI.makePluginAPI),Pye=VI(UI.makePresetAPI),Aye=(0,Qb.makeWeakCache)(function*({value:e,options:t,dirname:r,alias:n,externalDependencies:s},i){let a=(0,Tye.validatePluginObject)(e),o=Object.assign({},a);if(o.visitor&&(o.visitor=Yb().default.explode(Object.assign({},o.visitor))),o.inherits){let l={name:void 0,alias:`${n}$inherits`,value:o.inherits,options:t,dirname:r},u=yield*(0,Xb.forwardAsync)($I,c=>i.invalidate(p=>c(l,p)));o.pre=Gb(u.pre,o.pre),o.post=Gb(u.post,o.post),o.manipulateOptions=Gb(u.manipulateOptions,o.manipulateOptions),o.visitor=Yb().default.visitors.merge([u.visitor||{},o.visitor||{}]),u.externalDependencies.length>0&&(s.length===0?s=u.externalDependencies:s=(0,zb.finalize)([s,u.externalDependencies]))}return new qI.default(o,t,n,s)});function*$I(e,t){if(e.value instanceof qI.default){if(e.options)throw new Error("Passed options to an existing Plugin instance will not work.");return e.value}return yield*Aye(yield*vye(e,t),t)}var Hb=e=>e&&typeof e!="function",MI=(e,t)=>{if(Hb(e.test)||Hb(e.include)||Hb(e.exclude)){let r=t.name?`"${t.name}"`:"/* your preset */";throw new Sye.default([`Preset ${r} requires a filename to be set when babel is called directly,`,"```",`babel.transformSync(code, { filename: 'file.ts', presets: [${r}] });`,"```","See https://babeljs.io/docs/en/options#filename for more information."].join(`
`))}},Cye=(e,t,r)=>{if(!t.filename){var n;let{options:s}=e;MI(s,r),(n=s.overrides)==null||n.forEach(i=>MI(i,r))}},Dye=(0,Qb.makeWeakCacheSync)(({value:e,dirname:t,alias:r,externalDependencies:n})=>({options:(0,Jb.validate)("preset",e),alias:r,dirname:t,externalDependencies:n}));function*wye(e,t){let r=Dye(yield*Pye(e,t));return Cye(r,t,e),{chain:yield*(0,Eye.buildPresetChain)(r,t),externalDependencies:r.externalDependencies}}function Gb(e,t){return e?t?function(...r){let n=e.apply(this,r);return n&&typeof n.then=="function"?n.then(()=>t.apply(this,r)):t.apply(this,r)}:e:t}});var Qa=x(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.createConfigItem=jye;gn.createConfigItemAsync=Lye;gn.createConfigItemSync=XI;Object.defineProperty(gn,"default",{enumerable:!0,get:function(){return KI.default}});gn.loadOptions=Fye;gn.loadOptionsAsync=kye;gn.loadOptionsSync=GI;gn.loadPartialConfig=Oye;gn.loadPartialConfigAsync=Nye;gn.loadPartialConfigSync=HI;function Yp(){let e=Zr();return Yp=function(){return e},e}var KI=WI(),Iye=Kb(),_ye=vl(),yn=fs(),Hp=Yp()(Iye.loadPartialConfig);function Nye(...e){return(0,yn.beginHiddenCallStack)(Hp.async)(...e)}function HI(...e){return(0,yn.beginHiddenCallStack)(Hp.sync)(...e)}function Oye(e,t){if(t!==void 0)(0,yn.beginHiddenCallStack)(Hp.errback)(e,t);else if(typeof e=="function")(0,yn.beginHiddenCallStack)(Hp.errback)(void 0,e);else return HI(e)}function*Bye(e){var t;let r=yield*(0,KI.default)(e);return(t=r==null?void 0:r.options)!=null?t:null}var Gp=Yp()(Bye);function kye(...e){return(0,yn.beginHiddenCallStack)(Gp.async)(...e)}function GI(...e){return(0,yn.beginHiddenCallStack)(Gp.sync)(...e)}function Fye(e,t){if(t!==void 0)(0,yn.beginHiddenCallStack)(Gp.errback)(e,t);else if(typeof e=="function")(0,yn.beginHiddenCallStack)(Gp.errback)(void 0,e);else return GI(e)}var Xp=Yp()(_ye.createConfigItem);function Lye(...e){return(0,yn.beginHiddenCallStack)(Xp.async)(...e)}function XI(...e){return(0,yn.beginHiddenCallStack)(Xp.sync)(...e)}function jye(e,t,r){if(r!==void 0)(0,yn.beginHiddenCallStack)(Xp.errback)(e,t,r);else if(typeof t=="function")(0,yn.beginHiddenCallStack)(Xp.errback)(e,void 0,r);else return XI(e,t)}});var YI=x(Jp=>{"use strict";Object.defineProperty(Jp,"__esModule",{value:!0});Jp.default=void 0;var Nl=class{constructor(t,r,n,s){this._map=new Map,this.key=void 0,this.file=void 0,this.opts=void 0,this.cwd=void 0,this.filename=void 0,this.isAsync=void 0,this.key=r,this.file=t,this.opts=n||{},this.cwd=t.opts.cwd,this.filename=t.opts.filename,this.isAsync=s}set(t,r){this._map.set(t,r)}get(t){return this._map.get(t)}availableHelper(t,r){return this.file.availableHelper(t,r)}addHelper(t){return this.file.addHelper(t)}buildCodeFrameError(t,r,n){return this.file.buildCodeFrameError(t,r,n)}};Jp.default=Nl;Nl.prototype.getModuleName=function(){return this.file.getModuleName()},Nl.prototype.addImport=function(){this.file.addImport()}});var e_=x(e1=>{"use strict";Object.defineProperty(e1,"__esModule",{value:!0});e1.default=Rye;function QI(){let e=zt();return QI=function(){return e},e}var Mye=dp(),Zb,JI={name:"internal.blockHoist",visitor:{Block:{exit({node:e}){e.body=zI(e.body)}},SwitchCase:{exit({node:e}){e.consequent=zI(e.consequent)}}}};function zI(e){let t=Math.pow(2,30)-1,r=!1;for(let n=0;n<e.length;n++){let s=e[n],i=ZI(s);if(i>t){r=!0;break}t=i}return r?qye(e.slice()):e}function Rye(){return Zb||(Zb=new Mye.default(Object.assign({},JI,{visitor:QI().default.explode(JI.visitor)}),{})),Zb}function ZI(e){let t=e==null?void 0:e._blockHoist;return t==null?1:t===!0?2:t}function qye(e){let t=Object.create(null);for(let s=0;s<e.length;s++){let i=e[s],a=ZI(i);(t[a]||(t[a]=[])).push(i)}let r=Object.keys(t).map(s=>+s).sort((s,i)=>i-s),n=0;for(let s of r){let i=t[s];for(let a of i)e[n++]=a}return e}});var r1=x(t1=>{"use strict";Object.defineProperty(t1,"__esModule",{value:!0});t1.default=Uye;function zp(){let e=require("path");return zp=function(){return e},e}function Uye(e){let{filename:t,cwd:r,filenameRelative:n=typeof t=="string"?zp().relative(r,t):"unknown",sourceType:s="module",inputSourceMap:i,sourceMaps:a=!!i,sourceRoot:o=e.options.moduleRoot,sourceFileName:l=zp().basename(n),comments:u=!0,compact:c="auto"}=e.options,p=e.options,d=Object.assign({},p,{parserOpts:Object.assign({sourceType:zp().extname(n)===".mjs"?"module":s,sourceFileName:t,plugins:[]},p.parserOpts),generatorOpts:Object.assign({filename:t,auxiliaryCommentBefore:p.auxiliaryCommentBefore,auxiliaryCommentAfter:p.auxiliaryCommentAfter,retainLines:p.retainLines,comments:u,shouldPrintComment:p.shouldPrintComment,compact:c,minified:p.minified,sourceMaps:a,sourceRoot:o,sourceFileName:l},p.generatorOpts)});for(let m of e.passes)for(let g of m)g.manipulateOptions&&g.manipulateOptions(d,d.parserOpts);return d}});var n1=x(Xt=>{"use strict";Object.defineProperty(Xt,"commentRegex",{get:function(){return/^\s*?\/[\/\*][@#]\s+?sourceMappingURL=data:(((?:application|text)\/json)(?:;charset=([^;,]+?)?)?)?(?:;(base64))?,( Line truncated
`+i.stack)}}function Cr(e,t){t=t||{},t.hasComment&&(e=Kye(e)),t.encoding==="base64"?e=Qp(e):t.encoding==="uri"&&(e=decodeURIComponent(e)),(t.isJSON||t.encoding)&&(e=JSON.parse(e)),this.sourcemap=e}Cr.prototype.toJSON=function(e){return JSON.stringify(this.sourcemap,null,e)};typeof Buffer!="undefined"?typeof Buffer.from=="function"?Cr.prototype.toBase64=Gye:Cr.prototype.toBase64=Xye:Cr.prototype.toBase64=Yye;function Gye(){var e=this.toJSON();return Buffer.from(e,"utf8").toString("base64")}function Xye(){var e=this.toJSON();if(typeof e=="number")throw new TypeError("The json to encode must not be of type number.");return new Buffer(e,"utf8").toString("base64")}function Yye(){var e=this.toJSON();return btoa(unescape(encodeURIComponent(e)))}Cr.prototype.toURI=function(){var e=this.toJSON();return encodeURIComponent(e)};Cr.prototype.toComment=function(e){var t,r,n;return e!=null&&e.encoding==="uri"?(t="",r=this.toURI()):(t=";base64",r=this.toBase64()),n="sourceMappingURL=data:application/json;charset=utf-8"+t+","+r,e!=null&&e.multiline?"/*# "+n+" */":"//# "+n};Cr.prototype.toObject=function(){return JSON.parse(this.toJSON())};Cr.prototype.addProperty=function(e,t){if(this.sourcemap.hasOwnProperty(e))throw new Error('property "'+e+'" already exists on the sourcemap, use set property instead');return this.setProperty(e,t)};Cr.prototype.setProperty=function(e,t){return this.sourcemap[e]=t,this};Cr.prototype.getProperty=function(e){return this.sourcemap[e]};Xt.fromObject=function(e){return new Cr(e)};Xt.fromJSON=function(e){return new Cr(e,{isJSON:!0})};Xt.fromURI=function(e){return new Cr(e,{encoding:"uri"})};Xt.fromBase64=function(e){return new Cr(e,{encoding:"base64"})};Xt.fromComment=function(e){var t,r;return e=e.replace(/^\/\*/g,"//").replace(/\*\/$/g,""),t=Xt.commentRegex.exec(e),r=t&&t[4]||"uri",new Cr(e,{encoding:r,hasComment:!0})};function t_(e){return new Cr(e,{isJSON:!0})}Xt.fromMapFileComment=function(e,t){if(typeof t=="string")throw new Error("String directory paths are no longer supported with `fromMapFileComment`\nPlease review the Upgrading documentation at https://github.com/thlorenz/convert-source-map#upgrading");var r=Hye(e,t);return r!=null&&typeof r.then=="function"?r.then(t_):t_(r)};Xt.fromSource=function(e){var t=e.match(Xt.commentRegex);return t?Xt.fromComment(t.pop()):null};Xt.fromMapFileSource=function(e,t){if(typeof t=="string")throw new Error("String directory paths are no longer supported with `fromMapFileSource`\nPlease review the Upgrading documentation at https://github.com/thlorenz/convert-source-map#upgrading");var r=e.match(Xt.mapFileCommentRegex);return r?Xt.fromMapFileComment(r.pop(),t):null};Xt.removeComments=function(e){return e.replace(Xt.commentRegex,"")};Xt.removeMapFileComments=function(e){return e.replace(Xt.mapFileCommentRegex,"")};Xt.generateMapFileComment=function(e,t){var r="sourceMappingURL="+e;return t&&t.multiline?"/*# "+r+" */":"//# "+r}});var s_=x(s1=>{"use strict";Object.defineProperty(s1,"__esModule",{value:!0});s1.default=Jye;var n_={asyncDoExpressions:{syntax:{name:"@babel/plugin-syntax-async-do-expressions",url:"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-async-do-expressions"}},decimal:{syntax:{name:"@babel/plugin-syntax-decimal",url:"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-decimal"}},decorators:{syntax:{name:"@babel/plugin-syntax-decorators",url:"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-decorators"},transform:{name:"@babel/plugin-proposal-decorators",url:"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-decorators"}},doExpressions:{syntax:{name:"@babel/plugin-syntax-do-expressions",url:"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-do-expressions"},transform:{name:"@babel/plugin-proposal-do-expressions",url:"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-do-expressions"}},exportDefaultFrom:{syntax:{name:"@babel/plugin-syntax-export-default-from",url:"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-export-default-from"},transform:{name:"@babel/plugin-proposal-export-default-from",url:"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-export-default-from"}},flow:{syntax:{name:"@babel/plugin-syntax-flow",url:"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-flow"},transform:{name:"@babel/preset-flow",url:"https://github.com/babel/babel/tree/main/packages/babel-preset-flow"}},functionBind:{syntax:{name:"@babel/plugin-syntax-function-bind",url:"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-function-bind"},transform:{name:"@babel/plugin-proposal-function-bind",url:"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-function-bind"}},functionSent:{syntax:{name:"@babel/plugin-syntax-function-sent",url:"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-function-sent"},transform:{nam Line truncated
`+r,i=n_[e];if(i){let{syntax:o,transform:l}=i;if(o){let u=r_(o);if(l){let c=r_(l),p=l.name.startsWith("@babel/plugin")?"plugins":"presets";s+=`
Add ${c} to the '${p}' section of your Babel config to enable transformation.
If you want to leave it as-is, add ${u} to the 'plugins' section to enable parsing.`}else s+=`
Add ${u} to the 'plugins' section of your Babel config to enable parsing.`}}return s+=`
If you already added the plugin for this syntax to your config, it's possible that your config isn't being loaded.
You can re-run Babel with the BABEL_SHOW_CONFIG_FOR environment variable to show the loaded configuration:
npx cross-env BABEL_SHOW_CONFIG_FOR=${n==="unknown"?"<name of the input file>":n} <your build command>
See https://babeljs.io/docs/configuration#print-effective-configs for more info.
`,s}});var o1=x(a1=>{"use strict";Object.defineProperty(a1,"__esModule",{value:!0});a1.default=Qye;function i1(){let e=Ro();return i1=function(){return e},e}function i_(){let e=Ta();return i_=function(){return e},e}var zye=s_();function*Qye(e,{parserOpts:t,highlightCode:r=!0,filename:n="unknown"},s){try{let i=[];for(let a of e)for(let o of a){let{parserOverride:l}=o;if(l){let u=l(s,t,i1().parse);u!==void 0&&i.push(u)}}if(i.length===0)return(0,i1().parse)(s,t);if(i.length===1){if(yield*[],typeof i[0].then=="function")throw new Error("You appear to be using an async parser plugin, which your current version of Babel does not support. If you're using a published plugin, you may need to upgrade your @babel/core version.");return i[0]}throw new Error("More than one plugin attempted to override parsing.")}catch(i){i.code==="BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED"&&(i.message+=`
Consider renaming the file to '.mjs', or setting sourceType:module or sourceType:unambiguous in your Babel config for this file.`);let{loc:a,missingPlugin:o}=i;if(a){let l=(0,i_().codeFrameColumns)(s,{start:{line:a.line,column:a.column+1}},{highlightCode:r});o?i.message=`${n}: `+(0,zye.default)(o[0],a,l,n):i.message=`${n}: ${i.message}
`+l,i.code="BABEL_PARSE_ERROR"}throw i}}});var a_=x(c1=>{"use strict";Object.defineProperty(c1,"__esModule",{value:!0});c1.default=Zye;var Zp=new Set,l1=0;function u1(e,t,r){if(e!==null){if(r){if(t.has(e))return t.get(e)}else if(++l1>250){if(Zp.has(e))throw l1=0,Zp.clear(),new Error("Babel-deepClone: Cycles are not allowed in AST");Zp.add(e)}let n;if(Array.isArray(e)){n=new Array(e.length),r&&t.set(e,n);for(let s=0;s<e.length;s++)n[s]=typeof e[s]!="object"?e[s]:u1(e[s],t,r)}else{n={},r&&t.set(e,n);let s=Object.keys(e);for(let i=0;i<s.length;i++){let a=s[i];n[a]=typeof e[a]!="object"?e[a]:u1(e[a],t,r||a==="leadingComments"||a==="innerComments"||a==="trailingComments"||a==="extra")}}return r||l1-- >250&&Zp.delete(e),n}return e}function Zye(e){if(typeof e!="object")return e;try{return u1(e,new Map,!0)}catch{return structuredClone(e)}}});var f_=x(h1=>{"use strict";Object.defineProperty(h1,"__esModule",{value:!0});h1.default=a0e;function u_(){let e=require("fs");return u_=function(){return e},e}function d1(){let e=require("path");return d1=function(){return e},e}function c_(){let e=Ti();return c_=function(){return e},e}function p_(){let e=Fe();return p_=function(){return e},e}function ef(){let e=n1();return ef=function(){return e},e}var e0e=cg(),t0e=o1(),r0e=a_(),{file:n0e,traverseFast:s0e}=p_(),p1=c_()("babel:transform:file"),i0e=/^[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,.*$/,o_=/^[@#][ \t]+sourceMappingURL=([^\s'"`]+)[ \t]*$/;function*a0e(e,t,r,n){if(r=`${r||""}`,n){if(n.type==="Program")n=n0e(n,[],[]);else if(n.type!=="File")throw new Error("AST root must be a Program or File node");t.cloneInputAst&&(n=(0,r0e.default)(n))}else n=yield*(0,t0e.default)(e,t,r);let s=null;if(t.inputSourceMap!==!1){if(typeof t.inputSourceMap=="object"&&(s=ef().fromObject(t.inputSourceMap)),!s){let i=l_(i0e,n);if(i)try{s=ef().fromComment("//"+i)}catch{p1("discarding unknown inline input sourcemap")}}if(!s){let i=l_(o_,n);if(typeof t.filename=="string"&&i)try{let a=o_.exec(i),o=u_().readFileSync(d1().resolve(d1().dirname(t.filename),a[1]),"utf8");s=ef().fromJSON(o)}catch(a){p1("discarding unknown file input sourcemap",a)}else i&&p1("discarding un-loadable file input sourcemap")}}return new e0e.default(t,{code:r,ast:n,inputMap:s})}function f1(e,t,r){return t&&(t=t.filter(({value:n})=>e.test(n)?(r=n,!1):!0)),[t,r]}function l_(e,t){let r=null;return s0e(t,n=>{[n.leadingComments,r]=f1(e,n.leadingComments,r),[n.innerComments,r]=f1(e,n.innerComments,r),[n.trailingComments,r]=f1(e,n.trailingComments,r)}),r}});var d_=x((m1,y1)=>{(function(e,t){typeof m1=="object"&&typeof y1!="undefined"?y1.exports=t(rc(),Oy()):typeof define=="function"&&define.amd?define(["@jridgewell/trace-mapping","@jridgewell/gen-mapping"],t):(e=typeof globalThis!="undefined"?globalThis:e||self,e.remapping=t(e.traceMapping,e.genMapping))})(m1,function(e,t){"use strict";let r=s("",-1,-1,"",null),n=[];function s(f,b,T,w,I){return{source:f,line:b,column:T,name:w,content:I}}function i(f,b,T,w){return{map:f,sources:b,source:T,content:w}}function a(f,b){return i(f,b,"",null)}function o(f,b){return i(null,n,f,b)}function l(f){let b=new t.GenMapping({file:f.map.file}),{sources:T,map:w}=f,I=w.names,N=e.decodedMappings(w);for(let L=0;L<N.length;L++){let W=N[L];for(let U=0;U<W.length;U++){let H=W[U],pe=H[0],Ee=r;if(H.length!==1){let se=T[H[1]];if(Ee=u(se,H[2],H[3],H.length===5?I[H[4]]:""),Ee==null)continue}let{column:ce,line:qe,name:ze,content:Ot,source:J}=Ee;t.maybeAddSegment(b,L,pe,J,qe,ce,ze),J&&Ot!=null&&t.setSourceContent(b,J,Ot)}}return b}function u(f,b,T,w){if(!f.map)return s(f.source,b,T,w,f.content);let I=e.traceSegment(f.map,b,T);return I==null?null:I.length===1?r:u(f.sources[I[1]],I[2],I[3],I.length===5?f.map.names[I[4]]:w)}function c(f){return Array.isArray(f)?f:[f]}function p(f,b){let T=c(f).map(N=>new e.TraceMap(N,"")),w=T.pop();for(let N=0;N<T.length;N++)if(T[N].sources.length>1)throw new Error(`Transformation map ${N} must have exactly one source file.
Did you specify these with the most recent transformation maps first?`);let I=d(w,b,"",0);for(let N=T.length-1;N>=0;N--)I=a(T[N],[I]);return I}function d(f,b,T,w){let{resolvedSources:I,sourcesContent:N}=f,L=w+1,W=I.map((U,H)=>{let pe={importer:T,depth:L,source:U||"",content:void 0},Ee=b(pe.source,pe),{source:ce,content:qe}=pe;if(Ee)return d(new e.TraceMap(Ee,ce),b,ce,L);let ze=qe!==void 0?qe:N?N[H]:null;return o(ce,ze)});return a(f,W)}class m{constructor(b,T){let w=T.decodedMappings?t.toDecodedMap(b):t.toEncodedMap(b);this.version=w.version,this.file=w.file,this.mappings=w.mappings,this.names=w.names,this.sourceRoot=w.sourceRoot,this.sources=w.sources,T.excludeContent||(this.sourcesContent=w.sourcesContent)}toString(){return JSON.stringify(this)}}function g(f,b,T){let w=typeof T=="object"?T:{excludeContent:!!T,decodedMappings:!1},I=p(f,b);return new m(l(I),w)}return g})});var y_=x(g1=>{"use strict";Object.defineProperty(g1,"__esModule",{value:!0});g1.default=o0e;function m_(){let e=d_();return m_=function(){return e},e}function o0e(e,t,r){let n=r.replace(/\\/g,"/"),s=!1,i=m_()(h_(t),(a,o)=>a===n&&!s?(s=!0,o.source="",h_(e)):null);return typeof e.sourceRoot=="string"&&(i.sourceRoot=e.sourceRoot),Object.assign({},i)}function h_(e){return Object.assign({},e,{sourceRoot:null})}});var b_=x(E1=>{"use strict";Object.defineProperty(E1,"__esModule",{value:!0});E1.default=u0e;function g_(){let e=n1();return g_=function(){return e},e}function b1(){let e=bc();return b1=function(){return e},e}var l0e=y_();function u0e(e,t){let{opts:r,ast:n,code:s,inputMap:i}=t,{generatorOpts:a}=r;a.inputSourceMap=i==null?void 0:i.toObject();let o=[];for(let p of e)for(let d of p){let{generatorOverride:m}=d;if(m){let g=m(n,a,s,b1().default);g!==void 0&&o.push(g)}}let l;if(o.length===0)l=(0,b1().default)(n,a,s);else if(o.length===1){if(l=o[0],typeof l.then=="function")throw new Error("You appear to be using an async codegen plugin, which your current version of Babel does not support. If you're using a published plugin, you may need to upgrade your @babel/core version.")}else throw new Error("More than one plugin attempted to override codegen.");let{code:u,decodedMap:c=l.map}=l;return l.__mergedMap?c=Object.assign({},l.map):c&&(i?c=(0,l0e.default)(i.toObject(),c,a.sourceFileName):c=l.map),(r.sourceMaps==="inline"||r.sourceMaps==="both")&&(u+=`
`+g_().fromObject(c).toComment()),r.sourceMaps==="inline"&&(c=null),{outputCode:u,outputMap:c}}});var tf=x(S1=>{"use strict";Object.defineProperty(S1,"__esModule",{value:!0});S1.run=y0e;function x1(){let e=zt();return x1=function(){return e},e}var c0e=YI(),p0e=e_(),f0e=r1(),d0e=f_(),h0e=b_(),m0e=pp(),T1=Gs();function*y0e(e,t,r){let n=yield*(0,d0e.default)(e.passes,(0,f0e.default)(e),t,r),s=n.opts;try{yield*g0e(n,e.passes)}catch(u){var i;throw u.message=`${(i=s.filename)!=null?i:"unknown file"}: ${u.message}`,u.code||(u.code="BABEL_TRANSFORM_ERROR"),u}let a,o;try{s.code!==!1&&({outputCode:a,outputMap:o}=(0,h0e.default)(e.passes,n))}catch(u){var l;throw u.message=`${(l=s.filename)!=null?l:"unknown file"}: ${u.message}`,u.code||(u.code="BABEL_GENERATE_ERROR"),u}return{metadata:n.metadata,options:s,ast:s.ast===!0?n.ast:null,code:a===void 0?null:a,map:o===void 0?null:o,sourceType:n.ast.program.sourceType,externalDependencies:(0,m0e.flattenToSet)(e.externalDependencies)}}function*g0e(e,t){let r=yield*(0,T1.isAsync)();for(let n of t){let s=[],i=[],a=[];for(let l of n.concat([(0,p0e.default)()])){let u=new c0e.default(e,l.key,l.options,r);s.push([l,u]),i.push(u),a.push(l.visitor)}for(let[l,u]of s)l.pre&&(yield*(0,T1.maybeAsync)(l.pre,"You appear to be using an async plugin/preset, but Babel has been called synchronously").call(u,e));let o=x1().default.visitors.merge(a,i,e.opts.wrapPluginVisitorMethod);(0,x1().default)(e.ast,o,e.scope);for(let[l,u]of s)l.post&&(yield*(0,T1.maybeAsync)(l.post,"You appear to be using an async plugin/preset, but Babel has been called synchronously").call(u,e))}}});var P1=x(Ol=>{"use strict";Object.defineProperty(Ol,"__esModule",{value:!0});Ol.transformFile=x0e;Ol.transformFileAsync=v0e;Ol.transformFileSync=S0e;function E_(){let e=Zr();return E_=function(){return e},e}var b0e=Qa(),E0e=tf(),T0e=tp(),v1=E_()(function*(e,t){let r=Object.assign({},t,{filename:e}),n=yield*(0,b0e.default)(r);if(n===null)return null;let s=yield*T0e.readFile(e,"utf8");return yield*(0,E0e.run)(n,s)});function x0e(...e){v1.errback(...e)}function S0e(...e){return v1.sync(...e)}function v0e(...e){return v1.async(...e)}});var x_=x((vOe,T_)=>{T_.exports=function(t){return import(t)}});var S_=x((POe,P0e)=>{P0e.exports={name:"@babel/preset-typescript",version:"7.27.1",description:"Babel preset for TypeScript.",repository:{type:"git",url:"https://github.com/babel/babel.git",directory:"packages/babel-preset-typescript"},license:"MIT",publishConfig:{access:"public"},main:"./lib/index.js",keywords:["babel-preset","typescript"],dependencies:{"@babel/helper-plugin-utils":"^7.27.1","@babel/helper-validator-option":"^7.27.1","@babel/plugin-syntax-jsx":"^7.27.1","@babel/plugin-transform-modules-commonjs":"^7.27.1","@babel/plugin-transform-typescript":"^7.27.1"},peerDependencies:{"@babel/core":"^7.0.0-0"},devDependencies:{"@babel/core":"^7.27.1","@babel/helper-plugin-test-runner":"^7.27.1"},homepage:"https://babel.dev/docs/en/next/babel-preset-typescript",bugs:"https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22area%3A%20typescript%22+is%3Aopen",engines:{node:">=6.9.0"},author:"The Babel Team (https://babel.dev/team)",type:"commonjs"}});var Ft=x(Bl=>{"use strict";Object.defineProperty(Bl,"__esModule",{value:!0});Bl.declare=v_;Bl.declarePreset=void 0;var A1={assertVersion:e=>t=>{C0e(t,e.version)}};Object.assign(A1,{targets:()=>()=>({}),assumption:()=>()=>{},addExternalDependency:()=>()=>{}});function v_(e){return(t,r,n)=>{let s;for(let i of Object.keys(A1))t[i]||(s!=null||(s=A0e(t)),s[i]=A1[i](s));return e(s!=null?s:t,r||{},n)}}var AOe=Bl.declarePreset=v_;function A0e(e){let t=null;return typeof e.version=="string"&&/^7\./.test(e.version)&&(t=Object.getPrototypeOf(e),t&&(!hasOwnProperty.call(t,"version")||!hasOwnProperty.call(t,"transform")||!hasOwnProperty.call(t,"template")||!hasOwnProperty.call(t,"types"))&&(t=null)),Object.assign({},t,e)}function C0e(e,t){if(typeof e=="number"){if(!Number.isInteger(e))throw new Error("Expected string or integer value.");e=`^${e}.0.0-0`}if(typeof e!="string")throw new Error("Expected string or integer value.");let r=Error.stackTraceLimit;typeof r=="number"&&r<25&&(Error.stackTraceLimit=25);let n;throw t.slice(0,2)==="7."?n=new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${t}". You'll need to update your @babel/core version.`):n=new Error(`Requires Babel "${e}", but was loaded with "${t}". If you are sure you have a compatible version of @babel/core, it is likely that something in your build process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "@babel/core" or "babel-core" to see what is calling Babel.`),typeof r=="number"&&(Error.stackTraceLimit=r),Object.assign(n,{code:"BABEL_VERSION_UNSUPPORTED",version:t,range:e})}});var P_=x(rf=>{"use strict";Object.defineProperty(rf,"__esModule",{value:!0});rf.default=void 0;var D0e=Ft();C1=function(e,t){let r=[];e.forEach((n,s)=>{(Array.isA Line truncated
function () { throw new ReferenceError("'delete super[expr]' is invalid"); }()
`]):Dr.template.expression.ast`
function () { throw new ReferenceError("'delete super.prop' is invalid"); }()
`}},Y0e={memoise(e,t){let{scope:r,node:n}=e,{computed:s,property:i}=n;if(!s)return;let a=r.maybeGenerateMemoised(i);a&&this.memoiser.set(i,a,t)},prop(e){let{computed:t,property:r}=e.node;return this.memoiser.has(r)?br(this.memoiser.get(r)):t?br(r):j_(r.name)},_getPrototypeOfExpression(){let e=br(this.getObjectRef()),t=this.isStatic||this.isPrivateMethod?e:Gi(e,eo("prototype"));return xs(this.file.addHelper("getPrototypeOf"),[t])},get(e){return this._get(e)},_get(e){let t=this._getPrototypeOfExpression();return xs(this.file.addHelper("get"),[this.isDerivedConstructor?Xi([wr(),t]):t,this.prop(e),wr()])},set(e,t){let r=this._getPrototypeOfExpression();return xs(this.file.addHelper("set"),[this.isDerivedConstructor?Xi([wr(),r]):r,this.prop(e),t,wr(),Dr.types.booleanLiteral(e.isInStrictMode())])},destructureSet(e){throw e.buildCodeFrameError("Destructuring to a super field is not supported yet.")},call(e,t){return(0,lf.default)(this._get(e),wr(),t,!1)},optionalCall(e,t){return(0,lf.default)(this._get(e),br(wr()),t,!0)},delete(e){return e.node.computed?Xi([xs(this.file.addHelper("toPropertyKey"),[br(e.node.property)]),Dr.template.expression.ast`
function () { throw new ReferenceError("'delete super[expr]' is invalid"); }()
`]):Dr.template.expression.ast`
function () { throw new ReferenceError("'delete super.prop' is invalid"); }()
`}},J0e=Object.assign({},M_,{prop(e){let{property:t}=e.node;return this.memoiser.has(t)?br(this.memoiser.get(t)):br(t)},get(e){let{isStatic:t,getSuperRef:r}=this,{computed:n}=e.node,s=this.prop(e),i;if(t){var a;i=(a=r())!=null?a:Gi(eo("Function"),eo("prototype"))}else{var o;i=Gi((o=r())!=null?o:eo("Object"),eo("prototype"))}return Gi(i,s,n)},set(e,t){let{computed:r}=e.node,n=this.prop(e);return G0e("=",Gi(wr(),n,r),t)},destructureSet(e){let{computed:t}=e.node,r=this.prop(e);return Gi(wr(),r,t)},call(e,t){return(0,lf.default)(this.get(e),wr(),t,!1)},optionalCall(e,t){return(0,lf.default)(this.get(e),wr(),t,!0)}}),k1=class{constructor(t){var r;let n=t.methodPath;this.methodPath=n,this.isDerivedConstructor=n.isClassMethod({kind:"constructor"})&&!!t.superRef,this.isStatic=n.isObjectMethod()||n.node.static||(n.isStaticBlock==null?void 0:n.isStaticBlock()),this.isPrivateMethod=n.isPrivate()&&n.isMethod(),this.file=t.file,this.constantSuper=(r=t.constantSuper)!=null?r:t.isLoose,this.opts=t}getObjectRef(){return br(this.opts.objectRef||this.opts.getObjectRef())}getSuperRef(){if(this.opts.superRef)return br(this.opts.superRef);if(this.opts.getSuperRef)return br(this.opts.getSuperRef())}replace(){let{methodPath:t}=this;this.opts.refToPreserve&&t.traverse(X0e,{refName:this.opts.refToPreserve.name});let r=this.constantSuper?J0e:this.file.availableHelper("superPropSet")?M_:Y0e;L_.shouldSkip=n=>{if(n.parentPath===t&&(n.parentKey==="decorators"||n.parentKey==="key"))return!0},(0,H0e.default)(t,L_,Object.assign({file:this.file,scope:this.methodPath.scope,isDerivedConstructor:this.isDerivedConstructor,isStatic:this.isStatic,isPrivateMethod:this.isPrivateMethod,getObjectRef:this.getObjectRef.bind(this),getSuperRef:this.getSuperRef.bind(this),boundGet:r.get},r))}};to.default=k1});var cf=x(L1=>{"use strict";Object.defineProperty(L1,"__esModule",{value:!0});L1.default=tge;var z0e=Fe(),{addComment:Q0e}=z0e,Z0e="#__PURE__",ege=({leadingComments:e})=>!!e&&e.some(t=>/[@#]__PURE__/.test(t.value));function tge(e){let t=e.node||e;ege(t)||Q0e(t,"leading",Z0e)}});var Fl=x(kl=>{"use strict";Object.defineProperty(kl,"__esModule",{value:!0});kl.isTransparentExprWrapper=j1;kl.skipTransparentExprWrapperNodes=cge;kl.skipTransparentExprWrappers=uge;var rge=Fe(),{isParenthesizedExpression:nge,isTSAsExpression:sge,isTSNonNullExpression:ige,isTSSatisfiesExpression:age,isTSTypeAssertion:oge,isTypeCastExpression:lge}=rge;function j1(e){return sge(e)||age(e)||oge(e)||ige(e)||lge(e)||nge(e)}function uge(e){for(;j1(e.node);)e=e.get("expression");return e}function cge(e){for(;j1(e);)e=e.expression;return e}});var R1=x(M1=>{"use strict";Object.defineProperty(M1,"__esModule",{value:!0});M1.assertFieldTransformed=pge;function pge(e){if(e.node.declare)throw e.buildCodeFrameError(`TypeScript 'declare' fields must first be transformed by @babel/plugin-transform-typescript.
If you have already enabled that plugin (or '@babel/preset-typescript'), make sure that it runs before any plugin related to additional class features:
- @babel/plugin-transform-class-properties
- @babel/plugin-transform-private-methods
- @babel/plugin-proposal-decorators`)}});var W1=x(ei=>{"use strict";Object.defineProperty(ei,"__esModule",{value:!0});ei.buildCheckInRHS=df;ei.buildFieldsInitNodes=Fge;ei.buildPrivateNamesMap=gge;ei.buildPrivateNamesNodes=bge;ei.privateNameVisitorFactory=$1;ei.transformPrivateNamesUsage=Pge;var k=vt(),W_=zt(),fge=uf(),dge=N1(),R_=B1(),hge=cf(),mge=Fl(),yge=R1();Ir=e=>e.availableHelper("classPrivateFieldGet2");var Ir;function gge(e,t,r,n){let s=new Map,i;for(let a of r)if(a.isPrivate()){let{name:o}=a.node.key.id,l=s.get(o);if(!l){let u=!a.isProperty(),c=a.node.static,p=!1,d;!t&&Ir(n)&&u&&!c?(p=!!i,i!=null||(i=a.scope.generateUidIdentifier(`${e}_brand`)),d=i):d=a.scope.generateUidIdentifier(o),l={id:d,static:c,method:u,initAdded:p},s.set(o,l)}if(a.isClassPrivateMethod())if(a.node.kind==="get"){let{body:u}=a.node.body,c;u.length===1&&k.types.isReturnStatement(c=u[0])&&k.types.isCallExpression(c=c.argument)&&c.arguments.length===1&&k.types.isThisExpression(c.arguments[0])&&k.types.isIdentifier(c=c.callee)?(l.getId=k.types.cloneNode(c),l.getterDeclared=!0):l.getId=a.scope.generateUidIdentifier(`get_${o}`)}else if(a.node.kind==="set"){let{params:u}=a.node,{body:c}=a.node.body,p;c.length===1&&k.types.isExpressionStatement(p=c[0])&&k.types.isCallExpression(p=p.expression)&&p.arguments.length===2&&k.types.isThisExpression(p.arguments[0])&&k.types.isIdentifier(p.arguments[1],{name:u[0].name})&&k.types.isIdentifier(p=p.callee)?(l.setId=k.types.cloneNode(p),l.setterDeclared=!0):l.setId=a.scope.generateUidIdentifier(`set_${o}`)}else a.node.kind==="method"&&(l.methodId=a.scope.generateUidIdentifier(o));s.set(o,l)}return s}function bge(e,t,r,n){let s=[],i=new Set;for(let[a,o]of e){let{static:l,method:u,getId:c,setId:p}=o,d=c||p,m=k.types.cloneNode(o.id),g;if(t)g=k.types.callExpression(n.addHelper("classPrivateFieldLooseKey"),[k.types.stringLiteral(a)]);else if(r)g=k.types.callExpression(k.types.identifier("Symbol"),[k.types.stringLiteral(a)]);else if(!l){if(i.has(m.name))continue;i.add(m.name),g=k.types.newExpression(k.types.identifier(u&&(!d||Ir(n))?"WeakSet":"WeakMap"),[])}g&&(r||(0,hge.default)(g),s.push(k.template.statement.ast`var ${m} = ${g}`))}return s}function $1(e){let t=W_.visitors.environmentVisitor(Object.assign({},e)),r=Object.assign({},e,{Class(n){let{privateNamesMap:s}=this,i=n.get("body.body"),a=new Map(s),o=[];for(let l of i){if(!l.isPrivate())continue;let{name:u}=l.node.key.id;a.delete(u),o.push(u)}o.length&&(n.get("body").traverse(t,Object.assign({},this,{redeclared:o})),n.traverse(r,Object.assign({},this,{privateNamesMap:a})),n.skipKey("body"))}});return r}var Ege=$1({PrivateName(e,{noDocumentAll:t}){let{privateNamesMap:r,redeclared:n}=this,{node:s,parentPath:i}=e;if(!i.isMemberExpression({property:s})&&!i.isOptionalMemberExpression({property:s}))return;let{name:a}=s.id;r.has(a)&&(n!=null&&n.includes(a)||this.handle(i,t))}});function K_(e,t,r){for(;(n=t)!=null&&n.hasBinding(e)&&!t.bindingIdentifierEquals(e,r);){var n;t.rename(e),t=t.parent}}function df(e,t,r){return r||!(t.availableHelper!=null&&t.availableHelper("checkInRHS"))?e:k.types.callExpression(t.addHelper("checkInRHS"),[e])}var Tge=$1({BinaryExpression(e,{file:t}){let{operator:r,left:n,right:s}=e.node;if(r!=="in"||!k.types.isPrivateName(n))return;let{privateFieldsAsProperties:i,privateNamesMap:a,redeclared:o}=this,{name:l}=n.id;if(!a.has(l)||o!=null&&o.includes(l))return;if(K_(this.classRef.name,e.scope,this.innerBinding),i){let{id:p}=a.get(l);e.replaceWith(k.template.expression.ast`
Object.prototype.hasOwnProperty.call(${df(s,t)}, ${k.types.cloneNode(p)})
`);return}let{id:u,static:c}=a.get(l);if(c){e.replaceWith(k.template.expression.ast`${df(s,t)} === ${k.types.cloneNode(this.classRef)}`);return}e.replaceWith(k.template.expression.ast`${k.types.cloneNode(u)}.has(${df(s,t)})`)}});function pf(e,t){return k.types.callExpression(e.addHelper("readOnlyError"),[k.types.stringLiteral(`#${t}`)])}function xge(e,t){return e.availableHelper("writeOnlyError")?k.types.callExpression(e.addHelper("writeOnlyError"),[k.types.stringLiteral(`#${t}`)]):(console.warn("@babel/helpers is outdated, update it to silence this warning."),k.types.buildUndefinedNode())}function q1(e,t){return t?e:k.types.memberExpression(e,k.types.identifier("_"))}function q_(e){return function(t){return k.types.inherits(e.apply(this,arguments),t.node)}}var Sge={memoise(e,t){let{scope:r}=e,{object:n}=e.node,s=r.maybeGenerateMemoised(n);s&&this.memoiser.set(n,s,t)},receiver(e){let{object:t}=e.node;return this.memoiser.has(t)?k.types.cloneNode(this.memoiser.get(t)):k.types.cloneNode(t)},get:q_(function(e){let{classRef:t,privateNamesMap:r,file:n,innerBinding:s,noUninitializedPrivateFieldAccess:i}=this,a=e.node.property,{name:o}=a.id,{id:l,static:u,method:c,methodId:p,getId:d,setId:m}=r.get(o),g=d||m,f=b=>k.types.inherits(k.types.cloneNode(b),a);if(u){if(K_(t.name,e.scope,s),!Ir(n)){let w=c&&!g?"classStaticPrivateMethodGet":"classStaticPrivateFieldSpecGet";return k.types.callExpression(n.addHelper(w),[this.receiver(e),k.types.cloneNode(t),f(l)])}let b=this.receiver(e),T=k.types.isIdentifier(b)&&b.name===t.name;if(!c)return q1(T?f(l):k.types.callExpression(n.addHelper("assertClassBrand"),[k.types.cloneNode(t),b,f(l)]),i);if(d)return T?k.types.callExpression(f(d),[b]):k.types.callExpression(n.addHelper("classPrivateGetter"),[k.types.cloneNode(t),b,f(d)]);if(m){let w=k.types.buildUndefinedNode();return T?w:k.types.sequenceExpression([k.types.callExpression(n.addHelper("assertClassBrand"),[k.types.cloneNode(t),b]),w])}return T?f(l):k.types.callExpression(n.addHelper("assertClassBrand"),[k.types.cloneNode(t),b,f(l)])}return c?g?d?Ir(n)?k.types.callExpression(n.addHelper("classPrivateGetter"),[k.types.cloneNode(l),this.receiver(e),f(d)]):k.types.callExpression(n.addHelper("classPrivateFieldGet"),[this.receiver(e),f(l)]):k.types.sequenceExpression([this.receiver(e),xge(n,o)]):Ir(n)?k.types.callExpression(n.addHelper("assertClassBrand"),[k.types.cloneNode(l),this.receiver(e),f(p)]):k.types.callExpression(n.addHelper("classPrivateMethodGet"),[this.receiver(e),k.types.cloneNode(l),f(p)]):Ir(n)?k.types.callExpression(n.addHelper("classPrivateFieldGet2"),[f(l),this.receiver(e)]):k.types.callExpression(n.addHelper("classPrivateFieldGet"),[this.receiver(e),f(l)])}),boundGet(e){return this.memoise(e,1),k.types.callExpression(k.types.memberExpression(this.get(e),k.types.identifier("bind")),[this.receiver(e)])},set:q_(function(e,t){let{classRef:r,privateNamesMap:n,file:s,noUninitializedPrivateFieldAccess:i}=this,a=e.node.property,{name:o}=a.id,{id:l,static:u,method:c,setId:p,getId:d}=n.get(o),m=d||p,g=f=>k.types.inherits(k.types.cloneNode(f),a);if(u){if(!Ir(s)){let T=c&&!m?"classStaticPrivateMethodSet":"classStaticPrivateFieldSpecSet";return k.types.callExpression(s.addHelper(T),[this.receiver(e),k.types.cloneNode(r),g(l),t])}let f=this.receiver(e),b=k.types.isIdentifier(f)&&f.name===r.name;if(c&&!p){let T=pf(s,o);return b?k.types.sequenceExpression([t,T]):k.types.sequenceExpression([t,k.types.callExpression(s.addHelper("assertClassBrand"),[k.types.cloneNode(r),f]),pf(s,o)])}return p?b?k.types.callExpression(k.types.cloneNode(p),[f,t]):k.types.callExpression(s.addHelper("classPrivateSetter"),[k.types.cloneNode(r),g(p),f,t]):k.types.assignmentExpression("=",q1(g(l),i),b?t:k.types.callExpression(s.addHelper("assertClassBrand"),[k.types.cloneNode(r),f,t]))}return c?p?Ir(s)?k.types.callExpression(s.addHelper("classPrivateSetter"),[k.types.cloneNode(l),g(p),this.receiver(e),t]):k.types.callExpression(s.addHelper("classPrivateFieldSet"),[this.receiver(e),g(l),t]):k.types.sequenceExpression([this.receiver(e),t,pf(s,o)]):Ir(s)?k.types.callExpression(s.addHelper("classPrivateFieldSet2"),[g(l),this.receiver(e),t]):k.types.callExpression(s.addHelper("classPrivateFieldSet"),[this.receiver(e),g(l),t])}),destructureSet(e){let{classRef:t,privateNamesMap:r,file:n,noUninitializedPrivateFieldAccess:s}=this,i=e.node.property,{name:a}=i.id,{id:o,static:l,method:u,setId:c}=r.get(a),p=f=>k.types.inherits(k.types.cloneNode(f),i);if(!Ir(n)){if(l){try{var d=n.addHelper("classStaticPrivateFieldDestructureSet")}catch{throw new Error("Babel can not transpile `[C.#p] = [0]` with @babel/helpers < 7.13.10, \nplease update @babel/helpers to the latest version.")}return k.types.memberExpression(k.types.callExpression(d,[this.receiver(e),k.types.cloneNode(t),p(o)]),k.types.identifier("value"))}return k.types.memberExpression(k.types.callExpression(n.addHelper("classPrivateFieldDestructureSet"),[this.receiver(e),p(o)]),k.types.identifier("value"))}if( Line truncated
Object.defineProperty(${e}, ${k.types.cloneNode(n)}, {
// configurable is false by default
// enumerable is false by default
writable: true,
value: ${s}
});
`,t)}function Age(e,t,r,n){let{id:s}=r.get(t.node.key.id.name),i=t.node.value||t.scope.buildUndefinedNode();if(!n.availableHelper("classPrivateFieldInitSpec"))return dr(k.template.statement.ast`${k.types.cloneNode(s)}.set(${e}, {
// configurable is always false for private elements
// enumerable is always false for private elements
writable: true,
value: ${i},
})`,t);let a=n.addHelper("classPrivateFieldInitSpec");return V1(dr(k.types.expressionStatement(k.types.callExpression(a,[k.types.thisExpression(),V1(k.types.cloneNode(s),t.node.key),Ir(n)?i:k.template.expression.ast`{ writable: true, value: ${i} }`])),t),t.node)}function Cge(e,t,r){let n=t.get(e.node.key.id.name),s=r?e.node.value:k.template.expression.ast`{
_: ${e.node.value||k.types.buildUndefinedNode()}
}`;return dr(k.types.variableDeclaration("var",[k.types.variableDeclarator(k.types.cloneNode(n.id),s)]),e)}U1=function(e,t){let r=t.get(e.node.key.id.name),{id:n,getId:s,setId:i,initAdded:a}=r,o=s||i;if(!e.isProperty()&&(a||!o))return;if(o)return t.set(e.node.key.id.name,Object.assign({},r,{initAdded:!0})),dr(k.template.statement.ast`
var ${k.types.cloneNode(n)} = {
// configurable is false by default
// enumerable is false by default
// writable is false by default
get: ${s?s.name:e.scope.buildUndefinedNode()},
set: ${i?i.name:e.scope.buildUndefinedNode()}
}
`,e);let l=e.node.value||e.scope.buildUndefinedNode();return dr(k.template.statement.ast`
var ${k.types.cloneNode(n)} = {
// configurable is false by default
// enumerable is false by default
writable: true,
value: ${l}
};
`,e)};var U1;function Dge(e,t,r){let n=r.get(t.node.key.id.name),{methodId:s,id:i,getId:a,setId:o,initAdded:l}=n;if(l)return;if(s)return dr(k.template.statement.ast`
Object.defineProperty(${e}, ${i}, {
// configurable is false by default
// enumerable is false by default
// writable is false by default
value: ${s.name}
});
`,t);if(a||o)return r.set(t.node.key.id.name,Object.assign({},n,{initAdded:!0})),dr(k.template.statement.ast`
Object.defineProperty(${e}, ${i}, {
// configurable is false by default
// enumerable is false by default
// writable is false by default
get: ${a?a.name:t.scope.buildUndefinedNode()},
set: ${o?o.name:t.scope.buildUndefinedNode()}
});
`,t)}function wge(e,t,r,n){let s=r.get(t.node.key.id.name);if(!s.initAdded)return!Ir(n)&&(s.getId||s.setId)?Ige(e,t,r,n):_ge(e,t,r,n)}function Ige(e,t,r,n){let s=r.get(t.node.key.id.name),{id:i,getId:a,setId:o}=s;if(r.set(t.node.key.id.name,Object.assign({},s,{initAdded:!0})),!n.availableHelper("classPrivateFieldInitSpec"))return dr(k.template.statement.ast`
${i}.set(${e}, {
get: ${a?a.name:t.scope.buildUndefinedNode()},
set: ${o?o.name:t.scope.buildUndefinedNode()}
});
`,t);let l=n.addHelper("classPrivateFieldInitSpec");return V1(dr(k.template.statement.ast`${l}(
${k.types.thisExpression()},
${k.types.cloneNode(i)},
{
get: ${a?a.name:t.scope.buildUndefinedNode()},
set: ${o?o.name:t.scope.buildUndefinedNode()}
},
)`,t),t.node)}function _ge(e,t,r,n){let s=r.get(t.node.key.id.name),{id:i}=s;if(!n.availableHelper("classPrivateMethodInitSpec"))return dr(k.template.statement.ast`${i}.add(${e})`,t);let a=n.addHelper("classPrivateMethodInitSpec");return dr(k.template.statement.ast`${a}(
${k.types.thisExpression()},
${k.types.cloneNode(i)}
)`,t)}function V_(e,t){let{key:r,computed:n}=t.node,s=t.node.value||t.scope.buildUndefinedNode();return dr(k.types.expressionStatement(k.types.assignmentExpression("=",k.types.memberExpression(e,r,n||k.types.isLiteral(r)),s)),t)}function $_(e,t,r){let{key:n,computed:s}=t.node,i=t.node.value||t.scope.buildUndefinedNode();return dr(k.types.expressionStatement(k.types.callExpression(r.addHelper("defineProperty"),[e,s||k.types.isLiteral(n)?n:k.types.stringLiteral(n.name),i])),t)}function Nge(e,t,r,n){let s=n.get(t.node.key.id.name),{id:i,methodId:a,getId:o,setId:l,initAdded:u}=s;return u?void 0:o||l?(n.set(t.node.key.id.name,Object.assign({},s,{initAdded:!0})),dr(k.template.statement.ast`
Object.defineProperty(${e}, ${i}, {
// configurable is false by default
// enumerable is false by default
// writable is false by default
get: ${o?o.name:t.scope.buildUndefinedNode()},
set: ${l?l.name:t.scope.buildUndefinedNode()}
})
`,t)):dr(k.template.statement.ast`
Object.defineProperty(${e}, ${i}, {
// configurable is false by default
// enumerable is false by default
// writable is false by default
value: ${a.name}
});
`,t)}function ff(e,t,r,n=!1){let s=r.get(t.node.key.id.name),{id:i,methodId:a,getId:o,setId:l,getterDeclared:u,setterDeclared:c,static:p}=s,{params:d,body:m,generator:g,async:f}=t.node,b=o&&d.length===0,T=l&&d.length>0;if(b&&u||T&&c)return r.set(t.node.key.id.name,Object.assign({},s,{initAdded:!0})),null;if(Ir(e)&&(b||T)&&!n){let I=t.get("body").scope,N=I.generateUidIdentifier("this"),L={thisRef:N,argumentsPath:[]};if(t.traverse(H_,L),L.argumentsPath.length){let W=I.generateUidIdentifier("arguments");I.push({id:W,init:k.template.expression.ast`[].slice.call(arguments, 1)`});for(let U of L.argumentsPath)U.replaceWith(k.types.cloneNode(W))}d.unshift(k.types.cloneNode(N))}let w=a;return b?(r.set(t.node.key.id.name,Object.assign({},s,{getterDeclared:!0,initAdded:!0})),w=o):T?(r.set(t.node.key.id.name,Object.assign({},s,{setterDeclared:!0,initAdded:!0})),w=l):p&&!n&&(w=i),dr(k.types.functionDeclaration(k.types.cloneNode(w),d,m,g,f),t)}var H_=W_.visitors.environmentVisitor({Identifier(e,t){t.argumentsPath&&e.node.name==="arguments"&&t.argumentsPath.push(e)},UnaryExpression(e){let{node:t}=e;if(t.operator==="delete"){let r=(0,mge.skipTransparentExprWrapperNodes)(t.argument);k.types.isThisExpression(r)&&e.replaceWith(k.types.booleanLiteral(!0))}},ThisExpression(e,t){t.needsClassRef=!0,e.replaceWith(k.types.cloneNode(t.thisRef))},MetaProperty(e){let{node:t,scope:r}=e;t.meta.name==="new"&&t.property.name==="target"&&e.replaceWith(r.buildUndefinedNode())}}),Oge={ReferencedIdentifier(e,t){e.scope.bindingIdentifierEquals(e.node.name,t.innerBinding)&&(t.needsClassRef=!0,e.node.name=t.thisRef.name)}};function Bge(e,t,r){var n;let s={thisRef:t,needsClassRef:!1,innerBinding:r};return e.isMethod()||e.traverse(H_,s),r!=null&&(n=s.thisRef)!=null&&n.name&&s.thisRef.name!==r.name&&e.traverse(Oge,s),s.needsClassRef}function kge({key:e,computed:t}){return e.type==="Identifier"?!t&&(e.name==="name"||e.name==="length"):e.type==="StringLiteral"?e.value==="name"||e.value==="length":!1}function dr(e,t){return k.types.inheritLeadingComments(e,t.node),k.types.inheritInnerComments(e,t.node),e}function V1(e,t){return e.start=t.start,e.end=t.end,e.loc=t.loc,e}function Fge(e,t,r,n,s,i,a,o,l,u){let c=0,p,d=[],m=[],g=!1,f=[],b=null,T=k.types.isIdentifier(t)?()=>t:()=>(p!=null||(p=r[0].scope.generateUidIdentifierBasedOnNode(t)),p),w=e!=null?e:r[0].scope.generateUidIdentifier((u==null?void 0:u.name)||"Class");e!=null||(e=k.types.cloneNode(u));for(let I of r){I.isClassProperty()&&yge.assertFieldTransformed(I);let N=!(k.types.isStaticBlock!=null&&k.types.isStaticBlock(I.node))&&I.node.static,L=!N,W=I.isPrivate(),U=!W,H=I.isProperty(),pe=!H,Ee=I.isStaticBlock==null?void 0:I.isStaticBlock();switch(N&&(c|=1),(N||pe&&W||Ee)&&(new fge.default({methodPath:I,constantSuper:l,file:s,refToPreserve:u,getSuperRef:T,getObjectRef(){return c|=2,N||Ee?w:k.types.memberExpression(w,k.types.identifier("prototype"))}}).replace(),Bge(I,w,u)&&(c|=2)),g=!1,!0){case Ee:{let ce=I.node.body;ce.length===1&&k.types.isExpressionStatement(ce[0])?d.push(dr(ce[0],I)):d.push(k.types.inheritsComments(k.template.statement.ast`(() => { ${ce} })()`,I.node));break}case(N&&W&&H&&a):d.push(U_(k.types.cloneNode(e),I,n));break;case(N&&W&&H&&!a):Ir(s)?d.push(Cge(I,n,o)):d.push(U1(I,n));break;case(N&&U&&H&&i):if(!kge(I.node)){d.push(V_(k.types.cloneNode(e),I));break}case(N&&U&&H&&!i):d.push($_(k.types.cloneNode(e),I,s));break;case(L&&W&&H&&a):m.push(U_(k.types.thisExpression(),I,n));break;case(L&&W&&H&&!a):m.push(Age(k.types.thisExpression(),I,n,s));break;case(L&&W&&pe&&a):m.unshift(Dge(k.types.thisExpression(),I,n)),f.push(ff(s,I,n,a));break;case(L&&W&&pe&&!a):m.unshift(wge(k.types.thisExpression(),I,n,s)),f.push(ff(s,I,n,a));break;case(N&&W&&pe&&!a):Ir(s)||d.unshift(U1(I,n)),f.push(ff(s,I,n,a));break;case(N&&W&&pe&&a):d.unshift(Nge(k.types.cloneNode(e),I,s,n)),f.push(ff(s,I,n,a));break;case(L&&U&&H&&i):m.push(V_(k.types.thisExpression(),I));break;case(L&&U&&H&&!i):g=!0,m.push($_(k.types.thisExpression(),I,s));break;default:throw new Error("Unreachable.")}}return c&2&&u!=null&&(b=k.types.expressionStatement(k.types.assignmentExpression("=",k.types.cloneNode(w),k.types.cloneNode(u)))),{staticNodes:d.filter(Boolean),instanceNodes:m.filter(Boolean),lastInstanceNodeReturnsThis:g,pureStaticNodes:f.filter(Boolean),classBindingNode:b,wrapClass(I){for(let N of r)N.node.leadingComments=null,N.remove();return p&&(I.scope.push({id:k.types.cloneNode(p)}),I.set("superClass",k.types.assignmentExpression("=",p,I.node.superClass))),c!==0&&(I.isClassExpression()?(I.scope.push({id:e}),I.replaceWith(k.types.assignmentExpression("=",k.types.cloneNode(e),I.node))):(u==null&&(I.node.id=e),b!=null&&I.scope.push({id:w}))),I}}}});var K1=x(Ll=>{"use strict";Object.defineProperty(Ll,"__esModule",{value:!0});Ll.extractComputedKeys=Uge;Ll.injectInitialization=qge;Ll.memoiseComputedKey=X_;var Yt=vt(),Lge=zt(),jge=Lge.visitors.environmentVisitor({Super(e){let{node:t,parentPath:r}=e;r.isCallExpression({callee:t})&&th Line truncated
function () {
return this.${C.types.cloneNode(e)};
}
`,C.template.expression.ast`
function (value) {
this.${C.types.cloneNode(e)} = value;
}
`]:[C.template.expression.ast`
o => o.${C.types.cloneNode(e)}
`,C.template.expression.ast`
(o, v) => o.${C.types.cloneNode(e)} = v
`]}function Q1(e){if(e=(0,ti.skipTransparentExprWrappers)(e),e.isSequenceExpression()){let t=e.get("expressions");return Q1(t[t.length-1])}return e}function Hge(e){let t=Q1(e);if(t.isConstantExpression())return C.types.cloneNode(e.node);if(t.isIdentifier()&&e.scope.hasUid(t.node.name))return C.types.cloneNode(e.node);if(t.isAssignmentExpression()&&t.get("left").isIdentifier())return C.types.cloneNode(t.node.left);throw new Error(`Internal Error: the computed key ${e.toString()} has not yet been memoised.`)}function jl(e,t){let r=t.get("key");r.isSequenceExpression()?e.push(...r.node.expressions):e.push(r.node),r.replaceWith(ni(e))}function Gge(e,t){let r=t.get("key"),n=Q1(r);if(n.isConstantExpression())jl(e,t);else{let s=r.scope.parent,i=(0,hf.memoiseComputedKey)(n.node,s,s.generateUid("computedKey"));if(!i)jl(e,t);else{let a=[...e,C.types.cloneNode(i.left)],o=n.parentPath;o.isSequenceExpression()?o.pushContainer("expressions",a):n.replaceWith(ni([C.types.cloneNode(i),...a]))}}}function G1(e,t){let r=t.get("value");r.node?e.push(r.node):e.length>0&&(e[e.length-1]=C.types.unaryExpression("void",e[e.length-1])),r.replaceWith(ni(e))}function Xge(e,t){t.unshiftContainer("body",C.types.expressionStatement(ni(e)))}function Yge(e,t){t.node.body.body.unshift(C.types.expressionStatement(ni(e)))}function Z_(e,t){return C.types.isCallExpression(e)&&C.types.isIdentifier(e.callee,{name:t.name})}function Jge(e,t){if(t){if(e.length>=2&&Z_(e[1],t)){let r=C.types.callExpression(C.types.cloneNode(t),[e[0]]);e.splice(0,2,r)}e.length>=2&&C.types.isThisExpression(e[e.length-1])&&Z_(e[e.length-2],t)&&e.splice(e.length-1,1)}return ni(e)}function zge(e,t,r){t.traverse({CallExpression:{exit(n){if(!n.get("callee").isSuper())return;let s=[n.node,...e.map(i=>C.types.cloneNode(i))];n.isCompletionRecord()&&s.push(C.types.thisExpression()),n.replaceWith(Jge(s,r)),n.skip()}},ClassMethod(n){n.node.kind==="constructor"&&n.skip()}})}function eN(e,t){let r=[C.types.expressionStatement(ni(e))];return t&&r.unshift(C.types.expressionStatement(C.types.callExpression(C.types.super(),[C.types.spreadElement(C.types.identifier("args"))]))),C.types.classMethod("constructor",C.types.identifier("constructor"),t?[C.types.restElement(C.types.identifier("args"))]:[],C.types.blockStatement(r))}function tN(e){return C.types.staticBlock([C.types.expressionStatement(ni(e))])}var Yi=0,ri=1,Qge=2,oN=3,mf=4,Zge=5,ebe=8,tbe=16;function rbe(e){switch(e.node.type){case"ClassProperty":case"ClassPrivateProperty":return Yi;case"ClassAccessorProperty":return ri;case"ClassMethod":case"ClassPrivateMethod":return e.node.kind==="get"?oN:e.node.kind==="set"?mf:Qge}}function nbe(e){return[...e.filter(t=>t.isStatic&&t.kind>=ri&&t.kind<=mf),...e.filter(t=>!t.isStatic&&t.kind>=ri&&t.kind<=mf),...e.filter(t=>t.isStatic&&t.kind===Yi),...e.filter(t=>!t.isStatic&&t.kind===Yi)]}function rN(e,t,r){let n=e.length,s=t.some(Boolean),i=[];for(let a=0;a<n;a++)(r==="2023-11"||r==="2023-05")&&s&&i.push(t[a]||C.types.unaryExpression("void",C.types.numericLiteral(0))),i.push(e[a].expression);return{haveThis:s,decs:i}}function sbe(e,t){return C.types.arrayExpression(e.map(r=>{let n=r.kind;return r.isStatic&&(n+=t==="2023-11"||t==="2023-05"?ebe:Zge),r.decoratorsHaveThis&&(n+=tbe),C.types.arrayExpression([r.decoratorsArray,C.types.numericLiteral(n),r.name,...r.privateMethods||[]])}))}function ibe(e){let t=[];for(let r of e){let{locals:n}=r;Array.isArray(n)?t.push(...n):n!==void 0&&t.push(n)}return t}function abe(e,t,r,n,s,i){t.insertAfter(C.types.classPrivateMethod("get",C.types.cloneNode(r),[],C.types.blockStatement([C.types.returnStatement(C.types.callExpression(C.types.cloneNode(n),e==="2023-11"&&i?[]:[C.types.thisExpression()]))]),i)),t.insertAfter(C.types.classPrivateMethod("set",C.types.cloneNode(r),[C.types.identifier("v")],C.types.blockStatement([C.types.expressionStatement(C.types.callExpression(C.types.cloneNode(s),e==="2023-11"&&i?[C.types.identifier("v")]:[C.types.thisExpression(),C.types.identifier("v")]))]),i))}function obe(e,t,r,n){let s,i;e.node.kind==="set"?(s=[C.types.identifier("v")],i=[C.types.expressionStatement(C.types.callExpression(r,[C.types.thisExpression(),C.types.identifier("v")]))]):(s=[],i=[C.types.returnStatement(C.types.callExpression(r,[C.types.thisExpression()]))]),e.replaceWith(C.types.classPrivateMethod(e.node.kind,C.types.cloneNode(t),s,C.types.blockStatement(i),n))}function nN(e){let{type:t}=e;return t!=="TSDeclareMethod"&&t!=="TSIndexSignature"&&t!=="StaticBlock"}function lbe(e){return C.types.callExpression(C.types.arrowFunctionExpression([],C.types.blockStatement(e.body)),[])}function ube(e){return C.types.functionExpression(null,[],C.types.blockStatement(e.body))}function cbe(e){return C.types.functionExpression(null,[],C.types.blockStatement([C.types.returnStatement(e)]))}function ni(e){return e.length===0?C.types.unaryExpression("void",C.types.numericLiteral(0)):e.length===1?e[0]:C.types.sequenceExpression(e)}function sN(e){let{params:t,body:r,gene Line truncated
class extends ${t.addHelper("identity")} {}
`;F.body.body=[C.types.classProperty(C.types.toExpression(gt),void 0,void 0,void 0,!0,!0),...R];let Q=[],ie=C.types.newExpression(F,[]);Te.length>0&&Q.push(...Te),ut&&(pt=!0,Q.push(ut)),Q.length>0?(Q.unshift(C.types.callExpression(C.types.super(),[C.types.cloneNode(ce)])),F.body.body.push(eN(Q,!1))):ie.arguments.push(C.types.cloneNode(ce));let[ve]=e.replaceWith(ie);Ke=ve.get("callee").get("body").get("body.0.key")}}!pt&&ut&&e.node.body.body.push(C.types.staticBlock([C.types.expressionStatement(ut)]));let{superClass:_r}=gt;if(_r&&(a==="2023-11"||a==="2023-05")){let R=e.scope.maybeGenerateMemoised(_r);R&&(gt.superClass=C.types.assignmentExpression("=",R,_r),_r=R)}let xr=C.types.staticBlock([]);gt.body.body.unshift(xr);let nr=xr.body;if(j.length>0){let R=Ke.get("body.body"),F;for(let Q of R)if((Q.isClassProperty()||Q.isClassMethod())&&Q.node.kind!=="constructor"){F=Q;break}F!=null?(fbe(F),jl(j,F)):(gt.body.body.unshift(C.types.classProperty(C.types.sequenceExpression([...j,C.types.stringLiteral("_")]),void 0,void 0,void 0,!0,!0)),nr.push(C.types.expressionStatement(C.types.unaryExpression("delete",C.types.memberExpression(C.types.thisExpression(),C.types.identifier("_")))))),j=[]}if(nr.push(C.types.expressionStatement(mbe(we,Ve,De,G!=null?G:C.types.arrayExpression(V),C.types.numericLiteral(se),de?re:null,N,C.types.cloneNode(_r),t,a))),w&&nr.push(C.types.expressionStatement(C.types.callExpression(C.types.cloneNode(w),[C.types.thisExpression()]))),Dt.length>0&&nr.push(...Dt.map(R=>C.types.expressionStatement(R))),e.insertBefore(g.map(R=>C.types.expressionStatement(R))),J)if(!f.getBinding(ce.name).constantViolations.length)e.insertBefore(C.types.variableDeclaration("let",[C.types.variableDeclarator(C.types.cloneNode(ce))]));else{let F=f.generateUidIdentifier("t"+ce.name),Q=ce;e.replaceWithMultiple([C.types.variableDeclaration("let",[C.types.variableDeclarator(C.types.cloneNode(Q)),C.types.variableDeclarator(F)]),C.types.blockStatement([C.types.variableDeclaration("let",[C.types.variableDeclarator(C.types.cloneNode(ce))]),e.node,C.types.expressionStatement(C.types.assignmentExpression("=",C.types.cloneNode(F),C.types.cloneNode(ce)))]),C.types.expressionStatement(C.types.assignmentExpression("=",C.types.cloneNode(Q),C.types.cloneNode(F)))])}return pe.size>0&&dbe(e,pe),e.scope.crawl(),e}function mbe(e,t,r,n,s,i,a,o,l,u){let c,p,d=[a?lN(l,a):C.types.thisExpression(),n,r];{if(u!=="2023-11"&&d.splice(1,2,r,n),u==="2021-12"||u==="2022-03"&&!l.availableHelper("applyDecs2203R"))return c=C.types.arrayPattern([...e,...t]),p=C.types.callExpression(l.addHelper(u==="2021-12"?"applyDecs":"applyDecs2203"),d),C.types.assignmentExpression("=",c,p);u==="2022-03"?p=C.types.callExpression(l.addHelper("applyDecs2203R"),d):u==="2023-01"?(i&&d.push(X1(i)),p=C.types.callExpression(l.addHelper("applyDecs2301"),d)):u==="2023-05"&&((i||o||s.value!==0)&&d.push(s),i?d.push(X1(i)):o&&d.push(C.types.unaryExpression("void",C.types.numericLiteral(0))),o&&d.push(o),p=C.types.callExpression(l.addHelper("applyDecs2305"),d))}return u==="2023-11"&&((i||o||s.value!==0)&&d.push(s),i?d.push(X1(i)):o&&d.push(C.types.unaryExpression("void",C.types.numericLiteral(0))),o&&d.push(o),p=C.types.callExpression(l.addHelper("applyDecs2311"),d)),e.length>0?t.length>0?c=C.types.objectPattern([C.types.objectProperty(C.types.identifier("e"),C.types.arrayPattern(e)),C.types.objectProperty(C.types.identifier("c"),C.types.arrayPattern(t))]):(c=C.types.arrayPattern(e),p=C.types.memberExpression(p,C.types.identifier("e"),!1,!1)):(c=C.types.arrayPattern(t),p=C.types.memberExpression(p,C.types.identifier("c"),!1,!1)),C.types.assignmentExpression("=",c,p)}function ybe(e){return e.type==="Identifier"?e.name==="__proto__":e.value==="__proto__"}function Ml(e){return e.decorators&&e.decorators.length>0}function gbe(e){switch(e.type){case"ClassAccessorProperty":return!0;case"ClassMethod":case"ClassProperty":case"ClassPrivateMethod":case"ClassPrivateProperty":return Ml(e);default:return!1}}function bbe(e){return Ml(e)||e.body.body.some(gbe)}function Ebe(e,t){function r(n,s,i){switch(s.type){case"StringLiteral":return C.types.stringLiteral(s.value);case"NumericLiteral":case"BigIntLiteral":{let a=s.value+"";return n.get("key").replaceWith(C.types.stringLiteral(a)),C.types.stringLiteral(a)}default:{let a=n.scope.maybeGenerateMemoised(s);return n.get("key").replaceWith(C.types.assignmentExpression("=",a,z1(i,s))),C.types.cloneNode(a)}}}return{VariableDeclarator(n,s){let i=n.node.id;if(i.type==="Identifier"){let a=(0,ti.skipTransparentExprWrappers)(n.get("init"));if(e(a)){let o=i.name;t(a,s,o)}}},AssignmentExpression(n,s){let i=n.node.left;if(i.type==="Identifier"){let a=(0,ti.skipTransparentExprWrappers)(n.get("right"));if(e(a))switch(n.node.operator){case"=":case"&&=":case"||=":case"??=":t(a,s,i.name)}}},AssignmentPattern(n,s){let i=n.node.left;if(i.type==="Identifier"){let a=(0,ti.skipTransparentExprWrappers)(n.get("right"));if(e(a)){let o=i.name;t(a,s,o)}}},ObjectExpression(n Line truncated
${Cbe(n)}(
${p||Ct.types.nullLiteral()},
function (${a}, ${u?Ct.types.cloneNode(c):null}) {
${s}
return { F: ${Ct.types.cloneNode(s.id)}, d: ${d} };
},
${u}
)
`;l||m.arguments[1].body.directives.push(Ct.types.directive(Ct.types.directiveLiteral("use strict")));let g=m,f="arguments.1.body.body.0";return o&&(g=Ct.template.statement.ast`let ${e} = ${m}`,f="declarations.0.init."+f),{instanceNodes:[Ct.template.statement.ast`
${Ct.types.cloneNode(a)}(this)
`],wrapClass(b){return b.replaceWith(g),b.get(f)}}}});var hN=x(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji.FEATURES=void 0;Ji.enableFeature=wbe;Ji.isLoose=nE;Ji.shouldTransform=Ibe;var pN=Z1(),Ss=Ji.FEATURES=Object.freeze({fields:2,privateMethods:4,decorators:8,privateIn:16,staticBlocks:32}),fN=new Map([[Ss.fields,"@babel/plugin-transform-class-properties"],[Ss.privateMethods,"@babel/plugin-transform-private-methods"],[Ss.privateIn,"@babel/plugin-transform-private-property-in-object"]]),tE="@babel/plugin-class-features/featuresKey",ql="@babel/plugin-class-features/looseKey";si="@babel/plugin-class-features/looseLowPriorityKey/#__internal__@babel/preset-env__please-overwrite-loose-instead-of-throwing";var si;rE=function(e,t){return!!(e.get(si)&t)};var rE;function wbe(e,t,r){(!vs(e,t)||rE(e,t))&&(e.set(tE,e.get(tE)|t),r==="#__internal__@babel/preset-env__prefer-true-but-false-is-ok-if-it-prevents-an-error"?(yf(e,t,!0),e.set(si,e.get(si)|t)):r==="#__internal__@babel/preset-env__prefer-false-but-true-is-ok-if-it-prevents-an-error"?(yf(e,t,!1),e.set(si,e.get(si)|t)):yf(e,t,r));let n;for(let[i,a]of fN){if(!vs(e,i)||rE(e,i))continue;let o=nE(e,i);if(n===!o)throw new Error(`'loose' mode configuration must be the same for @babel/plugin-transform-class-properties, @babel/plugin-transform-private-methods and @babel/plugin-transform-private-property-in-object (when they are enabled).
`+dN(e));n=o;var s=a}if(n!==void 0)for(let[i,a]of fN)vs(e,i)&&nE(e,i)!==n&&(yf(e,i,n),console.warn(`Though the "loose" option was set to "${!n}" in your @babel/preset-env config, it will not be used for ${a} since the "loose" mode option was set to "${n}" for ${s}.
The "loose" option must be the same for @babel/plugin-transform-class-properties, @babel/plugin-transform-private-methods and @babel/plugin-transform-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding
["${a}", { "loose": ${n} }]
to the "plugins" section of your Babel config.
`+dN(e)))}function dN(e){let{filename:t}=e.opts;return(!t||t==="unknown")&&(t="[name of the input file]"),`If you already set the same 'loose' mode for these plugins in your config, it's possible that they are enabled multiple times with different options.
You can re-run Babel with the BABEL_SHOW_CONFIG_FOR environment variable to show the loaded configuration:
npx cross-env BABEL_SHOW_CONFIG_FOR=${t} <your build command>
See https://babeljs.io/docs/configuration#print-effective-configs for more info.`}function vs(e,t){return!!(e.get(tE)&t)}function nE(e,t){return!!(e.get(ql)&t)}function yf(e,t,r){r?e.set(ql,e.get(ql)|t):e.set(ql,e.get(ql)&~t),e.set(si,e.get(si)&~t)}function Ibe(e,t){let r=null,n=null,s=null,i=null,a=null;(0,pN.hasOwnDecorators)(e.node)&&(r=e.get("decorators.0"));for(let o of e.get("body.body"))!r&&(0,pN.hasOwnDecorators)(o.node)&&(r=o.get("decorators.0")),!n&&o.isClassProperty()&&(n=o),!s&&o.isClassPrivateProperty()&&(s=o),!i&&o.isClassPrivateMethod!=null&&o.isClassPrivateMethod()&&(i=o),!a&&o.isStaticBlock!=null&&o.isStaticBlock()&&(a=o);if(r&&s)throw s.buildCodeFrameError("Private fields in decorated classes are not supported yet.");if(r&&i)throw i.buildCodeFrameError("Private methods in decorated classes are not supported yet.");if(r&&!vs(t,Ss.decorators))throw e.buildCodeFrameError(`Decorators are not enabled.
If you are using ["@babel/plugin-proposal-decorators", { "version": "legacy" }], make sure it comes *before* "@babel/plugin-transform-class-properties" and enable loose mode, like so:
["@babel/plugin-proposal-decorators", { "version": "legacy" }]
["@babel/plugin-transform-class-properties", { "loose": true }]`);if(i&&!vs(t,Ss.privateMethods))throw i.buildCodeFrameError("Class private methods are not enabled. Please add `@babel/plugin-transform-private-methods` to your configuration.");if((n||s)&&!vs(t,Ss.fields)&&!vs(t,Ss.privateMethods))throw e.buildCodeFrameError("Class fields are not enabled. Please add `@babel/plugin-transform-class-properties` to your configuration.");if(a&&!vs(t,Ss.staticBlocks))throw e.buildCodeFrameError("Static class blocks are not enabled. Please add `@babel/plugin-transform-class-static-block` to your configuration.");return!!(r||i||a||(n||s)&&vs(t,Ss.fields))}});var so=x(Qi=>{"use strict";Object.defineProperty(Qi,"__esModule",{value:!0});Object.defineProperty(Qi,"FEATURES",{enumerable:!0,get:function(){return no.FEATURES}});Object.defineProperty(Qi,"buildCheckInRHS",{enumerable:!0,get:function(){return Ul.buildCheckInRHS}});Qi.createClassFeaturePlugin=Bbe;Object.defineProperty(Qi,"enableFeature",{enumerable:!0,get:function(){return no.enableFeature}});Object.defineProperty(Qi,"injectInitialization",{enumerable:!0,get:function(){return aE.injectInitialization}});var sE=vt(),_be=ps(),Ul=W1(),iE=Z1(),Nbe=cN(),aE=K1(),no=hN(),Obe=R1(),zi="@babel/plugin-class-features/version";function Bbe({name:e,feature:t,loose:r,manipulateOptions:n,api:s,inherits:i,decoratorVersion:a}){var o;if(t&no.FEATURES.decorators&&(a==="2023-11"||a==="2023-05"||a==="2023-01"||a==="2022-03"||a==="2021-12"))return(0,iE.default)(s,{loose:r},a,i);s!=null||(s={assumption:()=>{}});let l=s.assumption("setPublicClassFields"),u=s.assumption("privateFieldsAsSymbols"),c=s.assumption("privateFieldsAsProperties"),p=(o=s.assumption("noUninitializedPrivateFieldAccess"))!=null?o:!1,d=s.assumption("constantSuper"),m=s.assumption("noDocumentAll");if(c&&u)throw new Error('Cannot enable both the "privateFieldsAsProperties" and "privateFieldsAsSymbols" assumptions as the same time.');let g=c||u;if(r===!0){let f=[];l!==void 0&&f.push('"setPublicClassFields"'),c!==void 0&&f.push('"privateFieldsAsProperties"'),u!==void 0&&f.push('"privateFieldsAsSymbols"'),f.length!==0&&console.warn(`[${e}]: You are using the "loose: true" option and you are explicitly setting a value for the ${f.join(" and ")} assumption${f.length>1?"s":""}. The "loose" option can cause incompatibilities with the other class features plugins, so it's recommended that you replace it with the following top-level option:
"assumptions": {
"setPublicClassFields": true,
"privateFieldsAsSymbols": true
}`)}return{name:e,manipulateOptions:n,inherits:i,pre(f){if((0,no.enableFeature)(f,t,r),typeof f.get(zi)=="number"){f.set(zi,"7.27.1");return}(!f.get(zi)||_be.lt(f.get(zi),"7.27.1"))&&f.set(zi,"7.27.1")},visitor:{Class(f,{file:b}){if(b.get(zi)!=="7.27.1"||!(0,no.shouldTransform)(f,b))return;let T=f.isClassDeclaration();T&&(0,Obe.assertFieldTransformed)(f);let w=(0,no.isLoose)(b,t),I,N=(0,iE.hasDecorators)(f.node),L=[],W=[],U=[],H=new Set,pe=f.get("body");for(let he of pe.get("body")){if((he.isClassProperty()||he.isClassMethod())&&he.node.computed&&U.push(he),he.isPrivate()){let{name:De}=he.node.key.id,we=`get ${De}`,Ve=`set ${De}`;if(he.isClassPrivateMethod()){if(he.node.kind==="get"){if(H.has(we)||H.has(De)&&!H.has(Ve))throw he.buildCodeFrameError("Duplicate private field");H.add(we).add(De)}else if(he.node.kind==="set"){if(H.has(Ve)||H.has(De)&&!H.has(we))throw he.buildCodeFrameError("Duplicate private field");H.add(Ve).add(De)}}else{if(H.has(De)&&!H.has(we)&&!H.has(Ve)||H.has(De)&&(H.has(we)||H.has(Ve)))throw he.buildCodeFrameError("Duplicate private field");H.add(De)}}he.isClassMethod({kind:"constructor"})?I=he:(W.push(he),(he.isProperty()||he.isPrivate()||he.isStaticBlock!=null&&he.isStaticBlock())&&L.push(he))}if(!L.length&&!N)return;let Ee=f.node.id,ce;if(!Ee||!T){{var qe;(qe=f.ensureFunctionName)!=null||(f.ensureFunctionName=zt().NodePath.prototype.ensureFunctionName)}f.ensureFunctionName(!1),ce=f.scope.generateUidIdentifier((Ee==null?void 0:Ee.name)||"Class")}let ze=ce!=null?ce:sE.types.cloneNode(Ee),Ot=(0,Ul.buildPrivateNamesMap)(ze.name,g!=null?g:w,L,b),J=(0,Ul.buildPrivateNamesNodes)(Ot,c!=null?c:w,u!=null?u:!1,b);(0,Ul.transformPrivateNamesUsage)(ze,f,Ot,{privateFieldsAsProperties:g!=null?g:w,noUninitializedPrivateFieldAccess:p,noDocumentAll:m,innerBinding:Ee},b);let se,V,G,j,re,de,ye;N?(V=re=se=[],{instanceNodes:G,wrapClass:ye}=(0,Nbe.buildDecoratedClass)(ze,f,W,b)):(se=(0,aE.extractComputedKeys)(f,U,b),{staticNodes:V,pureStaticNodes:re,instanceNodes:G,lastInstanceNodeReturnsThis:j,classBindingNode:de,wrapClass:ye}=(0,Ul.buildFieldsInitNodes)(ce,f.node.superClass,L,Ot,b,l!=null?l:w,g!=null?g:w,p,d!=null?d:w,Ee)),G.length>0&&(0,aE.injectInitialization)(f,I,G,(he,De)=>{if(!N)for(let we of L)sE.types.isStaticBlock!=null&&sE.types.isStaticBlock(we.node)||we.node.static||we.traverse(he,De)},j);let Te=ye(f);Te.insertBefore([...J,...se]),V.length>0&&Te.insertAfter(V),re.length>0&&Te.find(he=>he.isStatement()||he.isDeclaration()).insertAfter(re),de!=null&&T&&Te.insertAfter(de)},ExportDefaultDeclaration(f,{file:b}){{if(b.get(zi)!=="7.27.1")return;let w=f.get("declaration");if(w.isClassDeclaration()&&(0,iE.hasDecorators)(w.node))if(w.node.id){{var T;(T=f.splitExportDeclaration)!=null||(f.splitExportDeclaration=zt().NodePath.prototype.splitExportDeclaration)}f.splitExportDeclaration()}else w.node.type="ClassExpression"}}}}}});var lE=x(Vl=>{"use strict";Object.defineProperty(Vl,"__esModule",{value:!0});Vl.default=Mbe;Vl.isSyntacticallyString=gf;Vl.translateEnumValues=yN;var io=vt(),kbe=require("assert"),Fbe=cf(),Lbe=Fl(),oE=new WeakMap,jbe=io.template.expression(`
(function (ID) {
ASSIGNMENTS;
return ID;
})(INIT)
`);function Mbe(e,t){let{node:r,parentPath:n}=e;if(r.declare){e.remove();return}let s=r.id.name,{fill:i,data:a,isPure:o}=Vbe(e,t,r.id);switch(n.type){case"BlockStatement":case"ExportNamedDeclaration":case"Program":{let u=t.isProgram(e.parent),c=l(n),p=t.objectExpression([]);(c||u)&&(p=t.logicalExpression("||",t.cloneNode(i.ID),p));let d=jbe(Object.assign({},i,{INIT:p}));o&&(0,Fbe.default)(d),c?(n.isExportDeclaration()?n:e).replaceWith(t.expressionStatement(t.assignmentExpression("=",t.cloneNode(r.id),d))):e.scope.registerDeclaration(e.replaceWith(t.variableDeclaration(u?"var":"let",[t.variableDeclarator(r.id,d)]))[0]),oE.set(e.scope.getBindingIdentifier(s),a);break}default:throw new Error(`Unexpected enum parent '${e.parent.type}`)}function l(u){return u.isExportDeclaration()?l(u.parentPath):u.getData(s)?!0:(u.setData(s,!0),!1)}}var Rbe=io.template.statement(`
ENUM["NAME"] = VALUE;
`),qbe=io.template.statement(`
ENUM[ENUM["NAME"] = VALUE] = "NAME";
`),Ube=(e,t)=>(e?Rbe:qbe)(t);function Vbe(e,t,r){let{enumValues:n,data:s,isPure:i}=yN(e,t),a=e.get("members"),o=[];for(let l=0;l<a.length;l++){let[u,c]=n[l];o.push(t.inheritsComments(Ube(gf(c),{ENUM:t.cloneNode(r),NAME:u,VALUE:c}),a[l].node))}return{fill:{ID:t.cloneNode(r),ASSIGNMENTS:o},data:s,isPure:i}}function gf(e){switch(e=(0,Lbe.skipTransparentExprWrapperNodes)(e),e.type){case"BinaryExpression":{let t=e.left,r=e.right;return e.operator==="+"&&(gf(t)||gf(r))}case"TemplateLiteral":case"StringLiteral":return!0}return!1}function mN(e,t){let{seen:r,path:n,t:s}=t,i=e.node.name;if(r.has(i)){for(let a=e.scope;a!==n.scope;a=a.parent)if(a.hasOwnBinding(i))return;e.replaceWith(s.memberExpression(s.cloneNode(n.node.id),s.cloneNode(e.node))),e.skip()}}var $be={ReferencedIdentifier:mN};function yN(e,t){var r;let n=e.scope.getBindingIdentifier(e.node.id.name),s=(r=oE.get(n))!=null?r:new Map,i=-1,a,o=!0,u=e.get("members").map(c=>{let p=c.node,d=t.isIdentifier(p.id)?p.id.name:p.id.value,m=c.get("initializer"),g=p.initializer,f;if(g)i=gN(m,s),i!==void 0?(s.set(d,i),kbe(typeof i=="number"||typeof i=="string"),i===1/0||Number.isNaN(i)?f=t.identifier(String(i)):i===-1/0?f=t.unaryExpression("-",t.identifier("Infinity")):f=t.valueToNode(i)):(o&&(o=m.isPure()),m.isReferencedIdentifier()?mN(m,{t,seen:s,path:e}):m.traverse($be,{t,seen:s,path:e}),f=m.node,s.set(d,void 0));else if(typeof i=="number")i+=1,f=t.numericLiteral(i),s.set(d,i);else{if(typeof i=="string")throw e.buildCodeFrameError("Enum member must have initializer.");{let b=t.memberExpression(t.cloneNode(e.node.id),t.stringLiteral(a),!0);f=t.binaryExpression("+",t.numericLiteral(1),b),s.set(d,void 0)}}return a=d,[d,f]});return{isPure:o,data:s,enumValues:u}}function gN(e,t,r=new Set){return n(e);function n(o){let l=o.node;switch(l.type){case"MemberExpression":return s(o,t,r);case"StringLiteral":return l.value;case"UnaryExpression":return i(o);case"BinaryExpression":return a(o);case"NumericLiteral":return l.value;case"ParenthesizedExpression":return n(o.get("expression"));case"Identifier":return s(o,t,r);case"TemplateLiteral":{if(l.quasis.length===1)return l.quasis[0].value.cooked;let u=o.get("expressions"),c=l.quasis,p="";for(let d=0;d<c.length;d++)if(p+=c[d].value.cooked,d+1<c.length){let m=s(u[d],t,r);if(m===void 0)return;p+=m}return p}default:return}}function s(o,l,u){if(o.isMemberExpression()){let c=o.node,p=c.object,d=c.property;if(!io.types.isIdentifier(p)||(c.computed?!io.types.isStringLiteral(d):!io.types.isIdentifier(d)))return;let m=o.scope.getBindingIdentifier(p.name),g=oE.get(m);return g?g.get(d.computed?d.value:d.name):void 0}else if(o.isIdentifier()){let c=o.node.name;if(["Infinity","NaN"].includes(c))return Number(c);let p=l==null?void 0:l.get(c);return p!==void 0?p:l!=null&&l.has(c)||u.has(o.node)?void 0:(u.add(o.node),p=gN(o.resolve(),l,u),p)}}function i(o){let l=n(o.get("argument"));if(l!==void 0)switch(o.node.operator){case"+":return l;case"-":return-l;case"~":return~l;default:return}}function a(o){let l=n(o.get("left"));if(l===void 0)return;let u=n(o.get("right"));if(u!==void 0)switch(o.node.operator){case"|":return l|u;case"&":return l&u;case">>":return l>>u;case">>>":return l>>>u;case"<<":return l<<u;case"^":return l^u;case"*":return l*u;case"/":return l/u;case"+":return l+u;case"-":return l-u;case"%":return l%u;case"**":return Math.pow(l,u);default:return}}}});var uE=x($l=>{"use strict";Object.defineProperty($l,"__esModule",{value:!0});$l.EXPORTED_CONST_ENUMS_IN_NAMESPACE=void 0;$l.default=Hbe;var Wbe=lE(),Kbe=$l.EXPORTED_CONST_ENUMS_IN_NAMESPACE=new WeakSet;function Hbe(e,t){let{name:r}=e.node.id,n=e.parentPath.isExportNamedDeclaration(),s=n;!s&&t.isProgram(e.parent)&&(s=e.parent.body.some(o=>t.isExportNamedDeclaration(o)&&o.exportKind!=="type"&&!o.source&&o.specifiers.some(l=>t.isExportSpecifier(l)&&l.exportKind!=="type"&&l.local.name===r)));let{enumValues:i}=(0,Wbe.translateEnumValues)(e,t);if(s||Kbe.has(e.node)){let o=t.objectExpression(i.map(([l,u])=>t.objectProperty(t.isValidIdentifier(l)?t.identifier(l):t.stringLiteral(l),u)));e.scope.hasOwnBinding(r)?(n?e.parentPath:e).replaceWith(t.expressionStatement(t.callExpression(t.memberExpression(t.identifier("Object"),t.identifier("assign")),[e.node.id,o]))):(e.replaceWith(t.variableDeclaration("var",[t.variableDeclarator(e.node.id,o)])),e.scope.registerDeclaration(e));return}let a=new Map(i);e.scope.path.traverse({Scope(o){o.scope.hasOwnBinding(r)&&o.skip()},MemberExpression(o){if(!t.isIdentifier(o.node.object,{name:r}))return;let l;if(o.node.computed)if(t.isStringLiteral(o.node.property))l=o.node.property.value;else return;else if(t.isIdentifier(o.node.property))l=o.node.property.name;else return;a.has(l)&&o.replaceWith(t.cloneNode(a.get(l)))}}),e.remove()}});var cE=x(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.GLOBAL_TYPES=void 0;ao.isGlobalType=Gbe;ao.registerGlobalType=Xbe;var bN=ao.GLOBAL_TYPES=new WeakMap;function Gbe({scope:e},t){return e.hasBinding(t)?!1:bN.ge Line truncated
as a JavaScript value binding, and "@babel/plugin-transform-typescript"
never encountered it as a TypeScript type declaration.
It will be treated as a JavaScript value.
This problem is likely caused by another plugin injecting
"${t}" without registering it in the scope tracker. If you are the author
of that plugin, please use "scope.registerDeclaration(declarationPath)".`),!1)}function Xbe(e,t){bN.get(e).add(t)}});var TN=x(bf=>{"use strict";Object.defineProperty(bf,"__esModule",{value:!0});bf.default=zbe;bf.getFirstIdentifier=hE;var yt=vt(),Ybe=cE(),Jbe=uE();function hE(e){return yt.types.isIdentifier(e)?e:hE(e.left)}function zbe(e,t){if(e.node.declare||e.node.id.type==="StringLiteral"){e.remove();return}if(!t)throw e.get("id").buildCodeFrameError("Namespace not marked type-only declare. Non-declarative namespaces are only supported experimentally in Babel. To enable and review caveats see: https://babeljs.io/docs/en/babel-plugin-transform-typescript");let r=hE(e.node.id).name,n=dE(e,e.node);if(n===null){let s=e.findParent(i=>i.isProgram());(0,Ybe.registerGlobalType)(s.scope,r),e.remove()}else e.scope.hasOwnBinding(r)?e.replaceWith(n):e.scope.registerDeclaration(e.replaceWithMultiple([pE(r),n])[0])}function pE(e){return yt.types.variableDeclaration("let",[yt.types.variableDeclarator(yt.types.identifier(e))])}function fE(e,t){return yt.types.memberExpression(yt.types.identifier(e),yt.types.identifier(t))}function Qbe(e,t,r){if(e.kind!=="const")throw r.file.buildCodeFrameError(e,"Namespaces exporting non-const are not supported by Babel. Change to const or see: https://babeljs.io/docs/en/babel-plugin-transform-typescript");let{declarations:n}=e;if(n.every(a=>yt.types.isIdentifier(a.id))){for(let a of n)a.init=yt.types.assignmentExpression("=",fE(t,a.id.name),a.init);return[e]}let s=yt.types.getBindingIdentifiers(e),i=[];for(let a in s)i.push(yt.types.assignmentExpression("=",fE(t,a),yt.types.cloneNode(s[a])));return[e,yt.types.expressionStatement(yt.types.sequenceExpression(i))]}function EN(e,t){return e.hub.buildError(t,"Ambient modules cannot be nested in other modules or namespaces.",Error)}function dE(e,t,r){let n=new Set,s=t.id,i=e.scope.generateUid(s.name),a=t.body,o=t.id,l;l=yt.types.isTSModuleBlock(a)?a.body:[yt.types.exportNamedDeclaration(a)];let u=!0;for(let p=0;p<l.length;p++){let d=l[p];switch(d.type){case"TSModuleDeclaration":{if(!yt.types.isIdentifier(d.id))throw EN(e,d);let m=dE(e,d);if(m!==null){u=!1;let g=d.id.name;n.has(g)?l[p]=m:(n.add(g),l.splice(p++,1,pE(g),m))}continue}case"TSEnumDeclaration":case"FunctionDeclaration":case"ClassDeclaration":u=!1,n.add(d.id.name);continue;case"VariableDeclaration":{u=!1;for(let m in yt.types.getBindingIdentifiers(d))n.add(m);continue}default:u&&(u=yt.types.isTypeScript(d));continue;case"ExportNamedDeclaration":}if(!("declare"in d.declaration&&d.declaration.declare))switch(d.declaration.type){case"TSEnumDeclaration":Jbe.EXPORTED_CONST_ENUMS_IN_NAMESPACE.add(d.declaration);case"FunctionDeclaration":case"ClassDeclaration":{u=!1;let m=d.declaration.id.name;n.add(m),l.splice(p++,1,d.declaration,yt.types.expressionStatement(yt.types.assignmentExpression("=",fE(i,m),yt.types.identifier(m))));break}case"VariableDeclaration":{u=!1;let m=Qbe(d.declaration,i,e.hub);l.splice(p,m.length,...m),p+=m.length-1;break}case"TSModuleDeclaration":{if(!yt.types.isIdentifier(d.declaration.id))throw EN(e,d.declaration);let m=dE(e,d.declaration,yt.types.identifier(i));if(m!==null){u=!1;let g=d.declaration.id.name;n.has(g)?l[p]=m:(n.add(g),l.splice(p++,1,pE(g),m))}else l.splice(p,1),p--}}}if(u)return null;let c=yt.types.objectExpression([]);if(r){let p=yt.types.memberExpression(r,s);c=yt.template.expression.ast`
${yt.types.cloneNode(p)} ||
(${yt.types.cloneNode(p)} = ${c})
`}return yt.template.statement.ast`
(function (${yt.types.identifier(i)}) {
${l}
})(${s} || (${yt.types.cloneNode(s)} = ${c}));
`}});var PN=x(Tf=>{"use strict";Object.defineProperty(Tf,"__esModule",{value:!0});Tf.default=void 0;var Zbe=Ft(),e1e=P_(),t1e=so(),r1e=uE(),n1e=lE(),Ps=cE(),xN=TN();function s1e(e){switch(e.parent.type){case"TSTypeReference":case"TSExpressionWithTypeArguments":case"TSExpressionWithTypeArguments":case"TSTypeQuery":return!0;case"TSQualifiedName":return e.parentPath.findParent(t=>t.type!=="TSQualifiedName").type!=="TSImportEqualsDeclaration";case"ExportSpecifier":return e.parent.exportKind==="type"||e.parentPath.parent.exportKind==="type";default:return!1}}var En=new WeakMap,SN=new WeakSet;function Ef(e){let t=e.getBindingIdentifiers();for(let r of Object.keys(t)){let n=e.scope.getBinding(r);n&&n.identifier===t[r]&&n.scope.removeBinding(r)}e.opts.noScope=!0,e.remove(),e.opts.noScope=!1}function vN(e,t,r,n,s=""){if(t.file.get("@babel/plugin-transform-modules-*")!=="commonjs")throw e.buildCodeFrameError(`\`${r}\` is only supported when compiling modules to CommonJS.
Please consider using \`${n}\`${s}, or add @babel/plugin-transform-modules-commonjs to your Babel config.`)}var KOe=Tf.default=(0,Zbe.declare)((e,t)=>{let{types:r,template:n}=e;e.assertVersion(7);let s=/\*?\s*@jsx((?:Frag)?)\s+(\S+)/,{allowNamespaces:i=!0,jsxPragma:a="React.createElement",jsxPragmaFrag:o="React.Fragment",onlyRemoveTypeImports:l=!1,optimizeConstEnums:u=!1}=t;var{allowDeclareFields:c=!1}=t;let p={field(f){let{node:b}=f;if(!c&&b.declare)throw f.buildCodeFrameError("The 'declare' modifier is only allowed when the 'allowDeclareFields' option of @babel/plugin-transform-typescript or @babel/preset-typescript is enabled.");if(b.declare){if(b.value)throw f.buildCodeFrameError("Fields with the 'declare' modifier cannot be initialized here, but only in the constructor");b.decorators||f.remove()}else if(b.definite){if(b.value)throw f.buildCodeFrameError("Definitely assigned fields cannot be initialized here, but only in the constructor");!c&&!b.decorators&&!r.isClassPrivateProperty(b)&&f.remove()}else(b.abstract||!c&&!b.value&&!b.decorators&&!r.isClassPrivateProperty(b))&&f.remove();b.accessibility&&(b.accessibility=null),b.abstract&&(b.abstract=null),b.readonly&&(b.readonly=null),b.optional&&(b.optional=null),b.typeAnnotation&&(b.typeAnnotation=null),b.definite&&(b.definite=null),b.declare&&(b.declare=null),b.override&&(b.override=null)},method({node:f}){f.accessibility&&(f.accessibility=null),f.abstract&&(f.abstract=null),f.optional&&(f.optional=null),f.override&&(f.override=null)},constructor(f,b){f.node.accessibility&&(f.node.accessibility=null);let T=[],{scope:w}=f;for(let I of f.get("params")){let N=I.node;if(N.type==="TSParameterProperty"){let L=N.parameter;if(SN.has(L))continue;SN.add(L);let W;if(r.isIdentifier(L))W=L;else if(r.isAssignmentPattern(L)&&r.isIdentifier(L.left))W=L.left;else throw I.buildCodeFrameError("Parameter properties can not be destructuring patterns.");T.push(n.statement.ast`
this.${r.cloneNode(W)} = ${r.cloneNode(W)}
`),I.replaceWith(I.get("parameter")),w.registerBinding("param",I)}}(0,t1e.injectInitialization)(b,f,T)}};return{name:"transform-typescript",inherits:e1e.default,visitor:{Pattern:m,Identifier:m,RestElement:m,Program:{enter(f,b){let{file:T}=b,w=null,I=null,N=f.scope;if(Ps.GLOBAL_TYPES.has(N)||Ps.GLOBAL_TYPES.set(N,new Set),T.ast.comments)for(let U of T.ast.comments){let H=s.exec(U.value);H&&(H[1]?I=H[2]:w=H[2])}let L=w||a;L&&([L]=L.split("."));let W=I||o;W&&([W]=W.split("."));for(let U of f.get("body")){if(U.isImportDeclaration()){if(En.has(b.file.ast.program)||En.set(b.file.ast.program,!0),U.node.importKind==="type"){for(let ce of U.node.specifiers)(0,Ps.registerGlobalType)(N,ce.local.name);U.remove();continue}let H=new Set,pe=U.node.specifiers.length,Ee=()=>pe>0&&pe===H.size;for(let ce of U.node.specifiers)if(ce.type==="ImportSpecifier"&&ce.importKind==="type"){(0,Ps.registerGlobalType)(N,ce.local.name);let qe=U.scope.getBinding(ce.local.name);qe&&H.add(qe.path)}if(l)En.set(f.node,!1);else{if(U.node.specifiers.length===0){En.set(f.node,!1);continue}for(let ce of U.node.specifiers){let qe=U.scope.getBinding(ce.local.name);qe&&!H.has(qe.path)&&(g({binding:qe,programPath:f,pragmaImportName:L,pragmaFragImportName:W})?H.add(qe.path):En.set(f.node,!1))}}if(Ee()&&!l)U.remove();else for(let ce of H)ce.remove();continue}if(!l&&U.isTSImportEqualsDeclaration()){let{id:H}=U.node,pe=U.scope.getBinding(H.name);if(pe&&!U.node.isExport&&g({binding:pe,programPath:f,pragmaImportName:L,pragmaFragImportName:W})){U.remove();continue}}if(U.isExportDeclaration()&&(U=U.get("declaration")),U.isVariableDeclaration({declare:!0}))for(let H of Object.keys(U.getBindingIdentifiers()))(0,Ps.registerGlobalType)(N,H);else(U.isTSTypeAliasDeclaration()||U.isTSDeclareFunction()&&U.get("id").isIdentifier()||U.isTSInterfaceDeclaration()||U.isClassDeclaration({declare:!0})||U.isTSEnumDeclaration({declare:!0})||U.isTSModuleDeclaration({declare:!0})&&U.get("id").isIdentifier())&&(0,Ps.registerGlobalType)(N,U.node.id.name)}},exit(f){f.node.sourceType==="module"&&En.get(f.node)&&f.pushContainer("body",r.exportNamedDeclaration())}},ExportNamedDeclaration(f,b){if(En.has(b.file.ast.program)||En.set(b.file.ast.program,!0),f.node.exportKind==="type"){f.remove();return}if(f.node.source&&f.node.specifiers.length>0&&f.node.specifiers.every(T=>T.type==="ExportSpecifier"&&T.exportKind==="type")){f.remove();return}if(!f.node.source&&f.node.specifiers.length>0&&f.node.specifiers.every(T=>r.isExportSpecifier(T)&&(0,Ps.isGlobalType)(f,T.local.name))){f.remove();return}if(r.isTSModuleDeclaration(f.node.declaration)){let T=f.node.declaration;if(!r.isStringLiteral(T.id)){let w=(0,xN.getFirstIdentifier)(T.id);if(f.scope.hasOwnBinding(w.name))f.replaceWith(T);else{let[I]=f.replaceWithMultiple([r.exportNamedDeclaration(r.variableDeclaration("let",[r.variableDeclarator(r.cloneNode(w))])),T]);f.scope.registerDeclaration(I)}}}En.set(b.file.ast.program,!1)},ExportAllDeclaration(f){f.node.exportKind==="type"&&f.remove()},ExportSpecifier(f){(!f.parent.source&&(0,Ps.isGlobalType)(f,f.node.local.name)||f.node.exportKind==="type")&&f.remove()},ExportDefaultDeclaration(f,b){if(En.has(b.file.ast.program)||En.set(b.file.ast.program,!0),r.isIdentifier(f.node.declaration)&&(0,Ps.isGlobalType)(f,f.node.declaration.name)){f.remove();return}En.set(b.file.ast.program,!1)},TSDeclareFunction(f){Ef(f)},TSDeclareMethod(f){Ef(f)},VariableDeclaration(f){f.node.declare&&Ef(f)},VariableDeclarator({node:f}){f.definite&&(f.definite=null)},TSIndexSignature(f){f.remove()},ClassDeclaration(f){let{node:b}=f;b.declare&&Ef(f)},Class(f){let{node:b}=f;b.typeParameters&&(b.typeParameters=null),b.superTypeParameters&&(b.superTypeParameters=null),b.implements&&(b.implements=null),b.abstract&&(b.abstract=null),f.get("body.body").forEach(T=>{T.isClassMethod()||T.isClassPrivateMethod()?T.node.kind==="constructor"?p.constructor(T,f):p.method(T):(T.isClassProperty()||T.isClassPrivateProperty()||T.isClassAccessorProperty())&&p.field(T)})},Function(f){let{node:b}=f;b.typeParameters&&(b.typeParameters=null),b.returnType&&(b.returnType=null);let T=b.params;T.length>0&&r.isIdentifier(T[0],{name:"this"})&&T.shift()},TSModuleDeclaration(f){(0,xN.default)(f,i)},TSInterfaceDeclaration(f){f.remove()},TSTypeAliasDeclaration(f){f.remove()},TSEnumDeclaration(f){u&&f.node.const?(0,r1e.default)(f,r):(0,n1e.default)(f,r)},TSImportEqualsDeclaration(f,b){let{id:T,moduleReference:w}=f.node,I,N;r.isTSExternalModuleReference(w)?(vN(f,b,`import ${T.name} = require(...);`,`import ${T.name} from '...';`," alongside Typescript's --allowSyntheticDefaultImports option"),I=r.callExpression(r.identifier("require"),[w.expression]),N="const"):(I=d(w),N="var");let L=r.variableDeclaration(N,[r.variableDeclarator(T,I)]);f.replaceWith(f.node.isExport?r.exportNamedDeclaration(L):L),f.scope.registerDeclaration(f)},TSExportAssignment(f,b){vN(f,b,"export = <value>;","export default <value>;"),f.replaceWith(n.statement.ast`module.exports =Line truncated
function ${t}() {
const data = ${r};
${t} = function(){ return data; };
return data;
}
`:!1},wrapReference(t,r){if(r==="lazy/function")return wN.types.callExpression(t,[])}});Sf.lazyImportsHook=c1e});var _N=x(vf=>{"use strict";Object.defineProperty(vf,"__esModule",{value:!0});vf.defineCommonJSHook=p1e;vf.makeInvokers=f1e;var bE="@babel/plugin-transform-modules-commonjs/customWrapperPlugin";function p1e(e,t){let r=e.get(bE);r||e.set(bE,r=[]),r.push(t)}function gE(e,t){if(e)for(let r of e){let n=t(r);if(n!=null)return n}}function f1e(e){let t=e.get(bE);return{getWrapperPayload(...r){return gE(t,n=>n.getWrapperPayload==null?void 0:n.getWrapperPayload(...r))},wrapReference(...r){return gE(t,n=>n.wrapReference==null?void 0:n.wrapReference(...r))},buildRequireWrapper(...r){return gE(t,n=>n.buildRequireWrapper==null?void 0:n.buildRequireWrapper(...r))}}}});var TE=x(Wl=>{"use strict";Object.defineProperty(Wl,"__esModule",{value:!0});Wl.default=void 0;Object.defineProperty(Wl,"defineCommonJSHook",{enumerable:!0,get:function(){return EE.defineCommonJSHook}});var d1e=Ft(),Zi=cl(),Ln=vt(),h1e=DN(),m1e=IN(),EE=_N(),QOe=Wl.default=(0,d1e.declare)((e,t)=>{var r,n,s;e.assertVersion(7);let{strictNamespace:i=!1,mjsStrictNamespace:a=i,allowTopLevelThis:o,strict:l,strictMode:u,noInterop:c,importInterop:p,lazy:d=!1,allowCommonJSExports:m=!0,loose:g=!1}=t,f=(r=e.assumption("constantReexports"))!=null?r:g,b=(n=e.assumption("enumerableModuleMeta"))!=null?n:g,T=(s=e.assumption("noIncompleteNsImportDetection"))!=null?s:!1;if(typeof d!="boolean"&&typeof d!="function"&&(!Array.isArray(d)||!d.every(N=>typeof N=="string")))throw new Error(".lazy must be a boolean, array of strings, or a function");if(typeof i!="boolean")throw new Error(".strictNamespace must be a boolean, or undefined");if(typeof a!="boolean")throw new Error(".mjsStrictNamespace must be a boolean, or undefined");let w=N=>Ln.template.expression.ast`
(function(){
throw new Error(
"The CommonJS '" + "${N}" + "' variable is not available in ES6 modules." +
"Consider setting setting sourceType:script or sourceType:unambiguous in your " +
"Babel config for this file.");
})()
`,I={ReferencedIdentifier(N){let L=N.node.name;if(L!=="module"&&L!=="exports")return;let W=N.scope.getBinding(L);this.scope.getBinding(L)!==W||N.parentPath.isObjectProperty({value:N.node})&&N.parentPath.parentPath.isObjectPattern()||N.parentPath.isAssignmentExpression({left:N.node})||N.isAssignmentExpression({left:N.node})||N.replaceWith(w(L))},UpdateExpression(N){let L=N.get("argument");if(!L.isIdentifier())return;let W=L.node.name;if(W!=="module"&&W!=="exports")return;let U=N.scope.getBinding(W);this.scope.getBinding(W)===U&&N.replaceWith(Ln.types.assignmentExpression(N.node.operator[0]+"=",L.node,w(W)))},AssignmentExpression(N){let L=N.get("left");if(L.isIdentifier()){let W=L.node.name;if(W!=="module"&&W!=="exports")return;let U=N.scope.getBinding(W);if(this.scope.getBinding(W)!==U)return;let pe=N.get("right");pe.replaceWith(Ln.types.sequenceExpression([pe.node,w(W)]))}else if(L.isPattern()){let W=L.getOuterBindingIdentifiers(),U=Object.keys(W).find(H=>H!=="module"&&H!=="exports"?!1:this.scope.getBinding(H)===N.scope.getBinding(H));if(U){let H=N.get("right");H.replaceWith(Ln.types.sequenceExpression([H.node,w(U)]))}}}};return{name:"transform-modules-commonjs",pre(){this.file.set("@babel/plugin-transform-modules-*","commonjs"),d&&(0,EE.defineCommonJSHook)(this.file,(0,m1e.lazyImportsHook)(d))},visitor:{["CallExpression"+(e.types.importExpression?"|ImportExpression":"")](N){if(!this.file.has("@babel/plugin-proposal-dynamic-import")||N.isCallExpression()&&!Ln.types.isImport(N.node.callee))return;let{scope:L}=N;do L.rename("require");while(L=L.parent);(0,h1e.transformDynamicImport)(N,c,this.file)},Program:{exit(N,L){if(!(0,Zi.isModule)(N))return;N.scope.rename("exports"),N.scope.rename("module"),N.scope.rename("require"),N.scope.rename("__filename"),N.scope.rename("__dirname"),m||N.traverse(I,{scope:N.scope});let W=(0,Zi.getModuleName)(this.file.opts,t);W&&(W=Ln.types.stringLiteral(W));let U=(0,EE.makeInvokers)(this.file),{meta:H,headers:pe}=(0,Zi.rewriteModuleStatementsAndPrepareHeader)(N,{exportName:"exports",constantReexports:f,enumerableModuleMeta:b,strict:l,strictMode:u,allowTopLevelThis:o,noInterop:c,importInterop:p,wrapReference:U.wrapReference,getWrapperPayload:U.getWrapperPayload,esNamespaceOnly:typeof L.filename=="string"&&/\.mjs$/.test(L.filename)?a:i,noIncompleteNsImportDetection:T,filename:this.file.opts.filename});for(let[Ee,ce]of H.source){let qe=Ln.types.callExpression(Ln.types.identifier("require"),[Ln.types.stringLiteral(Ee)]),ze;if((0,Zi.isSideEffectImport)(ce)){if(d&&ce.wrap==="function")throw new Error("Assertion failure");ze=Ln.types.expressionStatement(qe)}else{let Ot=(0,Zi.wrapInterop)(N,qe,ce.interop)||qe;if(ce.wrap){let J=U.buildRequireWrapper(ce.name,Ot,ce.wrap,ce.referenced);if(J===!1)continue;ze=J}ze!=null||(ze=Ln.template.statement.ast`
var ${ce.name} = ${Ot};
`)}ze.loc=ce.loc,pe.push(ze),pe.push(...(0,Zi.buildNamespaceInitStatements)(H,ce,f,U.wrapReference))}(0,Zi.ensureStatementsHoisted)(pe),N.unshiftContainer("body",pe),N.get("body").forEach(Ee=>{pe.includes(Ee.node)&&Ee.isVariableDeclaration()&&Ee.scope.registerDeclaration(Ee)})}}}}})});var SE=x(xE=>{"use strict";Object.defineProperty(xE,"__esModule",{value:!0});var ON=Ft(),y1e=PN();mE();var g1e=TE(),b1e=Ap();function BN(e){return e&&e.__esModule?e:{default:e}}var NN=BN(y1e),E1e=BN(g1e),As=new b1e.OptionValidator("@babel/preset-typescript");function T1e(e={}){let{allowNamespaces:t=!0,jsxPragma:r,onlyRemoveTypeImports:n}=e,s={ignoreExtensions:"ignoreExtensions",allowNamespaces:"allowNamespaces",disallowAmbiguousJSXLike:"disallowAmbiguousJSXLike",jsxPragma:"jsxPragma",jsxPragmaFrag:"jsxPragmaFrag",onlyRemoveTypeImports:"onlyRemoveTypeImports",optimizeConstEnums:"optimizeConstEnums",rewriteImportExtensions:"rewriteImportExtensions",allExtensions:"allExtensions",isTSX:"isTSX"},i=As.validateStringOption(s.jsxPragmaFrag,e.jsxPragmaFrag,"React.Fragment");{var a=As.validateBooleanOption(s.allExtensions,e.allExtensions,!1),o=As.validateBooleanOption(s.isTSX,e.isTSX,!1);o&&As.invariant(a,"isTSX:true requires allExtensions:true")}let l=As.validateBooleanOption(s.ignoreExtensions,e.ignoreExtensions,!1),u=As.validateBooleanOption(s.disallowAmbiguousJSXLike,e.disallowAmbiguousJSXLike,!1);u&&As.invariant(a,"disallowAmbiguousJSXLike:true requires allExtensions:true");let c=As.validateBooleanOption(s.optimizeConstEnums,e.optimizeConstEnums,!1),p=As.validateBooleanOption(s.rewriteImportExtensions,e.rewriteImportExtensions,!1),d={ignoreExtensions:l,allowNamespaces:t,disallowAmbiguousJSXLike:u,jsxPragma:r,jsxPragmaFrag:i,onlyRemoveTypeImports:n,optimizeConstEnums:c,rewriteImportExtensions:p};return d.allExtensions=a,d.isTSX=o,d}var x1e=ON.declare(function({types:e,template:t}){function r(n,s,i){if(n){if(e.isStringLiteral(n)){/^\.\.?\//.test(n.value)&&(n.value=n.value.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+)?)\.([cm]?)ts$/i,function(a,o,l,u,c){return o?".js":l&&(!u||!c)?a:l+u+"."+c.toLowerCase()+"js"}));return}i.availableHelper("tsRewriteRelativeImportExtensions")?s.replaceWith(e.callExpression(i.addHelper("tsRewriteRelativeImportExtensions"),[n])):s.replaceWith(t.expression.ast`(${n} + "").replace(/([\\/].*\.[mc]?)tsx?$/, "$1js")`)}}return{name:"preset-typescript/plugin-rewrite-ts-imports",visitor:{"ImportDeclaration|ExportAllDeclaration|ExportNamedDeclaration"(n,s){let i=n.node;(e.isImportDeclaration(i)?i.importKind:i.exportKind)==="value"&&r(i.source,n.get("source"),s)},CallExpression(n,s){e.isImport(n.node.callee)&&r(n.node.arguments[0],n.get("arguments.0"),s)},ImportExpression(n,s){r(n.node.source,n.get("source"),s)}}}}),S1e=ON.declarePreset((e,t)=>{e.assertVersion(7);let{allExtensions:r,ignoreExtensions:n,allowNamespaces:s,disallowAmbiguousJSXLike:i,isTSX:a,jsxPragma:o,jsxPragmaFrag:l,onlyRemoveTypeImports:u,optimizeConstEnums:c,rewriteImportExtensions:p}=T1e(t),d=f=>({allowDeclareFields:t.allowDeclareFields,allowNamespaces:s,disallowAmbiguousJSXLike:f,jsxPragma:o,jsxPragmaFrag:l,onlyRemoveTypeImports:u,optimizeConstEnums:c}),m=(f,b)=>[[NN.default,Object.assign({isTSX:f},d(b))]];return{plugins:p?[x1e]:[],overrides:r||n?[{plugins:m(a,i)}]:[{test:/\.ts$/,plugins:m(!1,!1)},{test:/\.mts$/,sourceType:"module",plugins:m(!1,!0)},{test:/\.cts$/,sourceType:"unambiguous",plugins:[[E1e.default,{allowTopLevelThis:!0}],[NN.default,d(!0)]]},{test:/\.tsx$/,plugins:m(!0,!1)}]}});xE.default=S1e});var IE=x(Kl=>{"use strict";Object.defineProperty(Kl,"__esModule",{value:!0});Kl.default=C1e;Kl.supportsESM=void 0;var vE=Gs();function DE(){let e=require("path");return DE=function(){return e},e}function MN(){let e=require("url");return MN=function(){return e},e}require("module");function wE(){let e=ps();return wE=function(){return e},e}function RN(){let e=Ti();return RN=function(){return e},e}var qN=fs(),oo=qi(),v1e=P1();function kN(e,t,r,n,s,i,a){try{var o=e[i](a),l=o.value}catch(u){return void r(u)}o.done?t(l):Promise.resolve(l).then(n,s)}function P1e(e){return function(){var t=this,r=arguments;return new Promise(function(n,s){var i=e.apply(t,r);function a(l){kN(i,n,s,a,o,"next",l)}function o(l){kN(i,n,s,a,o,"throw",l)}a(void 0)})}}var A1e=RN()("babel:config:loading:files:module-types");try{CE=x_()}catch{}var CE,t3e=Kl.supportsESM=wE().satisfies(process.versions.node,"^12.17 || >=13.2"),PE=new Set;function Pf(e){if(PE.has(e))return A1e("Auto-ignoring usage of config %o.",e),{};let t;try{PE.add(e),t=(0,qN.endHiddenCallStack)(require)(e)}finally{PE.delete(e)}return t!=null&&(t.__esModule||t[Symbol.toStringTag]==="Module")?t.default||(arguments[1]?t:void 0):t}var FN=(0,qN.endHiddenCallStack)(function(){var e=P1e(function*(r){let n=(0,MN().pathToFileURL)(r).toString()+"?import";{if(!CE)throw new oo.default(`Internal error: Native ECMAScript modules aren't supported by this platform.
`,r);return yield CE(n)}});function t(r){return e.apply(this,arguments)}return t}()),UN=e=>`You are using a ${e} config file, but Babel only supports transpiling .cts configs. Either:
- Use a .cts config file
- Update to Node.js 23.6.0, which has native TypeScript support
- Install tsx to transpile ${e} files on the fly`,LN={".js":"unknown",".mjs":"esm",".cjs":"cjs",".ts":"unknown",".mts":"esm",".cts":"cjs"},jN=new Set;function*C1e(e,t,r,n){let s,i=DE().extname(e),a=i===".ts"||i===".cts"||i===".mts",o=LN[hasOwnProperty.call(LN,i)?i:".js"];switch(`${t} ${o}`){case"require cjs":case"auto cjs":return a?AE(e,i,()=>Pf(e)):Pf(e,arguments[2]);case"auto unknown":case"require unknown":case"require esm":try{return a?AE(e,i,()=>Pf(e)):Pf(e,arguments[2])}catch(u){if(u.code==="ERR_REQUIRE_ASYNC_MODULE"||u.code==="ERR_REQUIRE_CYCLE_MODULE"&&jN.has(e)){if(jN.add(e),!(s!=null?s:s=yield*(0,vE.isAsync)()))throw new oo.default(n,e)}else if(!(u.code==="ERR_REQUIRE_ESM"||o==="esm"))throw u}case"auto esm":if(s!=null?s:s=yield*(0,vE.isAsync)()){let u=a?AE(e,i,()=>FN(e)):FN(e);return(yield*(0,vE.waitFor)(u)).default}throw a?new oo.default(UN(i),e):new oo.default(r,e);default:throw new Error("Internal Babel error: unreachable code.")}}function AE(e,t,r){if(process.features.typescript||require.extensions[".ts"]||require.extensions[".cts"]||require.extensions[".mts"])return r();if(t!==".cts")throw new oo.default(UN(t),e);let n={babelrc:!1,configFile:!1,sourceType:"unambiguous",sourceMaps:"inline",sourceFileName:DE().basename(e),presets:[[D1e(e),Object.assign({onlyRemoveTypeImports:!0,optimizeConstEnums:!0},{allowDeclareFields:!0})]]},s=function(i,a){if(s&&a.endsWith(".cts"))try{return i._compile((0,v1e.transformFileSync)(a,Object.assign({},n,{filename:a})).code,a)}catch(o){let l=S_();throw wE().lt(l.version,"7.21.4")&&console.error("`.cts` configuration file failed to load, please try to update `@babel/preset-typescript`."),o}return require.extensions[".js"](i,a)};require.extensions[t]=s;try{return r()}finally{require.extensions[t]===s&&delete require.extensions[t],s=void 0}}function D1e(e){try{return SE()}catch(t){if(t.code!=="MODULE_NOT_FOUND")throw t;let r="You appear to be using a .cts file as Babel configuration, but the `@babel/preset-typescript` package was not found: please install it!";throw process.versions.pnp&&(r+=`
If you are using Yarn Plug'n'Play, you may also need to add the following configuration to your .yarnrc.yml file:
packageExtensions:
"@babel/core@*":
peerDependencies:
"@babel/preset-typescript": "*"
`),new oo.default(r,e)}}});var zN=x(Cs=>{"use strict";Object.defineProperty(Cs,"__esModule",{value:!0});Cs.ROOT_CONFIG_FILENAMES=void 0;Cs.findConfigUpwards=V1e;Cs.findRelativeConfig=$1e;Cs.findRootConfig=W1e;Cs.loadConfig=K1e;Cs.resolveShowConfigPath=H1e;function $N(){let e=Ti();return $N=function(){return e},e}function _E(){let e=require("fs");return _E=function(){return e},e}function rn(){let e=require("path");return rn=function(){return e},e}function WN(){let e=sD();return WN=function(){return e},e}function KN(){let e=Zr();return KN=function(){return e},e}var HN=Ri(),w1e=jg(),GN=Ag(),I1e=IE(),_1e=Ib(),jn=qi(),N1e=tp();require("module");var O1e=fs(),B1e=Gs(),NE=$N()("babel:config:loading:files:configuration"),XN=Cs.ROOT_CONFIG_FILENAMES=["babel.config.js","babel.config.cjs","babel.config.mjs","babel.config.json","babel.config.cts","babel.config.ts","babel.config.mts"],k1e=[".babelrc",".babelrc.js",".babelrc.cjs",".babelrc.mjs",".babelrc.json",".babelrc.cts"],F1e=".babelignore",L1e=(0,HN.makeWeakCache)(function*(t,r){return yield*[],{options:(0,O1e.endHiddenCallStack)(t)((0,w1e.makeConfigAPI)(r)),cacheNeedsConfiguration:!r.configured()}});function*j1e(e,t){if(!_E().existsSync(e))return null;let r=yield*(0,I1e.default)(e,(yield*(0,B1e.isAsync)())?"auto":"require","You appear to be using a native ECMAScript module configuration file, which is only supported when running Babel asynchronously or when using the Node.js `--experimental-require-module` flag.","You appear to be using a configuration file that contains top-level await, which is only supported when running Babel asynchronously."),n=!1;if(typeof r=="function"&&({options:r,cacheNeedsConfiguration:n}=yield*L1e(r,t)),!r||typeof r!="object"||Array.isArray(r))throw new jn.default("Configuration should be an exported JavaScript object.",e);if(typeof r.then=="function")throw r.catch==null||r.catch(()=>{}),new jn.default("You appear to be using an async configuration, which your current version of Babel does not support. We may add support for this in the future, but if you're on the most recent version of @babel/core and still seeing this error, then you'll need to synchronously return your config.",e);return n&&G1e(e),M1e(r,e)}var VN=new WeakMap;function M1e(e,t){let r=VN.get(e);r||VN.set(e,r=new Map);let n=r.get(t);return n||(n={filepath:t,dirname:rn().dirname(t),options:e},r.set(t,n)),n}var R1e=(0,HN.makeWeakCacheSync)(e=>{let t=e.options.babel;if(t===void 0)return null;if(typeof t!="object"||Array.isArray(t)||t===null)throw new jn.default(".babel property must be an object",e.filepath);return{filepath:e.filepath,dirname:e.dirname,options:t}}),q1e=(0,GN.makeStaticFileCache)((e,t)=>{let r;try{r=WN().parse(t)}catch(n){throw new jn.default(`Error while parsing config - ${n.message}`,e)}if(!r)throw new jn.default("No config detected",e);if(typeof r!="object")throw new jn.default(`Config returned typeof ${typeof r}`,e);if(Array.isArray(r))throw new jn.default("Expected config object but found array",e);return delete r.$schema,{filepath:e,dirname:rn().dirname(e),options:r}}),U1e=(0,GN.makeStaticFileCache)((e,t)=>{let r=rn().dirname(e),n=t.split(`
`).map(s=>s.replace(/#.*$/,"").trim()).filter(Boolean);for(let s of n)if(s[0]==="!")throw new jn.default("Negation of file paths is not supported.",e);return{filepath:e,dirname:rn().dirname(e),ignore:n.map(s=>(0,_1e.default)(s,r))}});function V1e(e){let t=e;for(;;){for(let n of XN)if(_E().existsSync(rn().join(t,n)))return t;let r=rn().dirname(t);if(t===r)break;t=r}return null}function*$1e(e,t,r){let n=null,s=null,i=rn().dirname(e.filepath);for(let o of e.directories){if(!n){var a;n=yield*YN(k1e,o,t,r,((a=e.pkg)==null?void 0:a.dirname)===o?R1e(e.pkg):null)}if(!s){let l=rn().join(o,F1e);s=yield*U1e(l),s&&NE("Found ignore %o from %o.",s.filepath,i)}}return{config:n,ignore:s}}function W1e(e,t,r){return YN(XN,e,t,r)}function*YN(e,t,r,n,s=null){let a=(yield*KN().all(e.map(o=>JN(rn().join(t,o),r,n)))).reduce((o,l)=>{if(l&&o)throw new jn.default(`Multiple configuration files found. Please remove one:
- ${rn().basename(o.filepath)}
- ${l.filepath}
from ${t}`);return l||o},s);return a&&NE("Found configuration %o from %o.",a.filepath,t),a}function*K1e(e,t,r,n){let s=(((a,o)=>(a=a.split("."),o=o.split("."),+a[0]>+o[0]||a[0]==o[0]&&+a[1]>=+o[1]))(process.versions.node,"8.9")?require.resolve:(a,{paths:[o]},l=require("module"))=>{let u=l._findPath(a,l._nodeModulePaths(o).concat(o));if(u)return u;throw u=new Error(`Cannot resolve module '${a}'`),u.code="MODULE_NOT_FOUND",u})(e,{paths:[t]}),i=yield*JN(s,r,n);if(!i)throw new jn.default("Config file contains no configuration data",s);return NE("Loaded config %o from %o.",e,t),i}function JN(e,t,r){switch(rn().extname(e)){case".js":case".cjs":case".mjs":case".ts":case".cts":case".mts":return j1e(e,{envName:t,caller:r});default:return q1e(e)}}function*H1e(e){let t=process.env.BABEL_SHOW_CONFIG_FOR;if(t!=null){let r=rn().resolve(e,t);if(!(yield*N1e.stat(r)).isFile())throw new Error(`${r}: BABEL_SHOW_CONFIG_FOR must refer to a regular file, directories are not supported.`);return r}return null}function G1e(e){throw new jn.default(`Caching was left unconfigured. Babel's plugins, presets, and .babelrc.js files can be configured
for various types of caching, using the first param of their handler functions:
module.exports = function(api) {
// The API exposes the following:
// Cache the returned value forever and don't call this function again.
api.cache(true);
// Don't cache at all. Not recommended because it will be very slow.
api.cache(false);
// Cached based on the value of some function. If this function returns a value different from
// a previously-encountered value, the plugins will re-evaluate.
var env = api.cache(() => process.env.NODE_ENV);
// If testing for a specific env, we recommend specifics to avoid instantiating a plugin for
// any possible NODE_ENV value that might come up during plugin execution.
var isProd = api.cache(() => process.env.NODE_ENV === "production");
// .cache(fn) will perform a linear search though instances to find the matching plugin based
// based on previous instantiated plugins. If you want to recreate the plugin and discard the
// previous instance whenever something changes, you may use:
var isProd = api.cache.invalidate(() => process.env.NODE_ENV === "production");
// Note, we also expose the following more-verbose versions of the above examples:
api.cache.forever(); // api.cache(true)
api.cache.never(); // api.cache(false)
api.cache.using(fn); // api.cache(fn)
// Return the value that will be cached.
return { };
};`,e)}});var SO=x(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});_f.moduleResolve=xO;_f.resolve=MEe;function zn(){let e=require("assert");return zn=function(){return e},e}function Yl(){let e=pO(require("fs"),!0);return Yl=function(){return e},e}function ii(){let e=require("process");return ii=function(){return e},e}function Ie(){let e=require("url");return Ie=function(){return e},e}function Df(){let e=require("path");return Df=function(){return e},e}function wf(){let e=require("module");return wf=function(){return e},e}function cO(){let e=require("v8");return cO=function(){return e},e}function Xl(){let e=require("util");return Xl=function(){return e},e}function pO(e,t){if(typeof WeakMap=="function")var r=new WeakMap,n=new WeakMap;return(pO=function(s,i){if(!i&&s&&s.__esModule)return s;var a,o,l={__proto__:null,default:s};if(s===null||typeof s!="object"&&typeof s!="function")return l;if(a=i?n:r){if(a.has(s))return a.get(s);a.set(s,l)}for(let u in s)u!=="default"&&{}.hasOwnProperty.call(s,u)&&((o=(a=Object.defineProperty)&&Object.getOwnPropertyDescriptor(s,u))&&(o.get||o.set)?a(l,u,o):l[u]=s[u]);return l})(e,t)}var X1e={}.hasOwnProperty,Y1e=/^([A-Z][a-z\d]*)+$/,J1e=new Set(["string","function","number","object","Function","Object","boolean","bigint","symbol"]),Er={};function OE(e,t="and"){return e.length<3?e.join(` ${t} `):`${e.slice(0,-1).join(", ")}, ${t} ${e[e.length-1]}`}var fO=new Map,z1e="__node_internal_",QN;Er.ERR_INVALID_ARG_TYPE=Tn("ERR_INVALID_ARG_TYPE",(e,t,r)=>{zn()(typeof e=="string","'name' must be a string"),Array.isArray(t)||(t=[t]);let n="The ";if(e.endsWith(" argument"))n+=`${e} `;else{let o=e.includes(".")?"property":"argument";n+=`"${e}" ${o} `}n+="must be ";let s=[],i=[],a=[];for(let o of t)zn()(typeof o=="string","All expected entries have to be of type string"),J1e.has(o)?s.push(o.toLowerCase()):Y1e.exec(o)===null?(zn()(o!=="object",'The value "object" should be written as "Object"'),a.push(o)):i.push(o);if(i.length>0){let o=s.indexOf("object");o!==-1&&(s.slice(o,1),i.push("Object"))}return s.length>0&&(n+=`${s.length>1?"one of type":"of type"} ${OE(s,"or")}`,(i.length>0||a.length>0)&&(n+=" or ")),i.length>0&&(n+=`an instance of ${OE(i,"or")}`,a.length>0&&(n+=" or ")),a.length>0&&(a.length>1?n+=`one of ${OE(a,"or")}`:(a[0].toLowerCase()!==a[0]&&(n+="an "),n+=`${a[0]}`)),n+=`. Received ${rEe(r)}`,n},TypeError);Er.ERR_INVALID_MODULE_SPECIFIER=Tn("ERR_INVALID_MODULE_SPECIFIER",(e,t,r=void 0)=>`Invalid module "${e}" ${t}${r?` imported from ${r}`:""}`,TypeError);Er.ERR_INVALID_PACKAGE_CONFIG=Tn("ERR_INVALID_PACKAGE_CONFIG",(e,t,r)=>`Invalid package config ${e}${t?` while importing ${t}`:""}${r?`. ${r}`:""}`,Error);Er.ERR_INVALID_PACKAGE_TARGET=Tn("ERR_INVALID_PACKAGE_TARGET",(e,t,r,n=!1,s=void 0)=>{let i=typeof r=="string"&&!n&&r.length>0&&!r.startsWith("./");return t==="."?(zn()(n===!1),`Invalid "exports" main target ${JSON.stringify(r)} defined in the package config ${e}package.json${s?` imported from ${s}`:""}${i?'; targets must start with "./"':""}`):`Invalid "${n?"imports":"exports"}" target ${JSON.stringify(r)} defined for '${t}' in the package config ${e}package.json${s?` imported from ${s}`:""}${i?'; targets must start with "./"':""}`},Error);Er.ERR_MODULE_NOT_FOUND=Tn("ERR_MODULE_NOT_FOUND",(e,t,r=!1)=>`Cannot find ${r?"module":"package"} '${e}' imported from ${t}`,Error);Er.ERR_NETWORK_IMPORT_DISALLOWED=Tn("ERR_NETWORK_IMPORT_DISALLOWED","import of '%s' by %s is not supported: %s",Error);Er.ERR_PACKAGE_IMPORT_NOT_DEFINED=Tn("ERR_PACKAGE_IMPORT_NOT_DEFINED",(e,t,r)=>`Package import specifier "${e}" is not defined${t?` in package ${t}package.json`:""} imported from ${r}`,TypeError);Er.ERR_PACKAGE_PATH_NOT_EXPORTED=Tn("ERR_PACKAGE_PATH_NOT_EXPORTED",(e,t,r=void 0)=>t==="."?`No "exports" main defined in ${e}package.json${r?` imported from ${r}`:""}`:`Package subpath '${t}' is not defined by "exports" in ${e}package.json${r?` imported from ${r}`:""}`,Error);Er.ERR_UNSUPPORTED_DIR_IMPORT=Tn("ERR_UNSUPPORTED_DIR_IMPORT","Directory import '%s' is not supported resolving ES modules imported from %s",Error);Er.ERR_UNSUPPORTED_RESOLVE_REQUEST=Tn("ERR_UNSUPPORTED_RESOLVE_REQUEST",'Failed to resolve module specifier "%s" from "%s": Invalid relative URL or base scheme is not hierarchical.',TypeError);Er.ERR_UNKNOWN_FILE_EXTENSION=Tn("ERR_UNKNOWN_FILE_EXTENSION",(e,t)=>`Unknown file extension "${e}" for ${t}`,TypeError);Er.ERR_INVALID_ARG_VALUE=Tn("ERR_INVALID_ARG_VALUE",(e,t,r="is invalid")=>{let n=(0,Xl().inspect)(t);return n.length>128&&(n=`${n.slice(0,128)}...`),`The ${e.includes(".")?"property":"argument"} '${e}' ${r}. Received ${n}`},TypeError);function Tn(e,t,r){return fO.set(e,t),Q1e(r,e)}function Q1e(e,t){return r;function r(...n){let s=Error.stackTraceLimit;LE()&&(Error.stackTraceLimit=0);let i=new e;LE()&&(Error.stackTraceLimit=s);let a=tEe(t,n,i);return Object.defineProperties(i,{message:{value:a,enumerable:!1,writable:!0,configurable:!0},toString:{value(){retu Line truncated
Automatic extension resolution of the "main" field is deprecated for ES modules.`,"DeprecationWarning","DEP0151"):ii().emitWarning(`No "main" or "exports" field defined in the package.json for ${a} resolving the main entry point "${i.slice(a.length)}", imported from ${o}.
Default "index" lookups for the main are deprecated for ES modules.`,"DeprecationWarning","DEP0151")}function bO(e){try{return(0,Yl().statSync)(e)}catch{}}function kE(e){let t=(0,Yl().statSync)(e,{throwIfNoEntry:!1}),r=t?t.isFile():void 0;return r==null?!1:r}function vEe(e,t,r){let n;if(t.main!==void 0){if(n=new(Ie()).URL(t.main,e),kE(n))return n;let a=[`./${t.main}.js`,`./${t.main}.json`,`./${t.main}.node`,`./${t.main}/index.js`,`./${t.main}/index.json`,`./${t.main}/index.node`],o=-1;for(;++o<a.length&&(n=new(Ie()).URL(a[o],e),!kE(n));)n=void 0;if(n)return lO(n,e,r,t.main),n}let s=["./index.js","./index.json","./index.node"],i=-1;for(;++i<s.length&&(n=new(Ie()).URL(s[i],e),!kE(n));)n=void 0;if(n)return lO(n,e,r,t.main),n;throw new ME((0,Ie().fileURLToPath)(new(Ie()).URL(".",e)),(0,Ie().fileURLToPath)(r))}function PEe(e,t,r){if(xEe.exec(e.pathname)!==null)throw new If(e.pathname,'must not include encoded "/" or "\\" characters',(0,Ie().fileURLToPath)(t));let n;try{n=(0,Ie().fileURLToPath)(e)}catch(i){let a=i;throw Object.defineProperty(a,"input",{value:String(e)}),Object.defineProperty(a,"module",{value:String(t)}),a}let s=bO(n.endsWith("/")?n.slice(-1):n);if(s&&s.isDirectory()){let i=new EEe(n,(0,Ie().fileURLToPath)(t));throw i.url=String(e),i}if(!s||!s.isFile()){let i=new ME(n||e.pathname,t&&(0,Ie().fileURLToPath)(t),!0);throw i.url=String(e),i}if(!r){let i=(0,Yl().realpathSync)(n),{search:a,hash:o}=e;e=(0,Ie().pathToFileURL)(i+(n.endsWith(Df().sep)?"/":"")),e.search=a,e.hash=o}return e}function AEe(e,t,r){return new gEe(e,t&&(0,Ie().fileURLToPath)(new(Ie()).URL(".",t)),(0,Ie().fileURLToPath)(r))}function FE(e,t,r){return new bEe((0,Ie().fileURLToPath)(new(Ie()).URL(".",t)),e,r&&(0,Ie().fileURLToPath)(r))}function CEe(e,t,r,n,s){let i=`request is not a valid match in pattern "${t}" for the "${n?"imports":"exports"}" resolution of ${(0,Ie().fileURLToPath)(r)}`;throw new If(e,i,s&&(0,Ie().fileURLToPath)(s))}function Gl(e,t,r,n,s){return t=typeof t=="object"&&t!==null?JSON.stringify(t,null,""):`${t}`,new yEe((0,Ie().fileURLToPath)(new(Ie()).URL(".",r)),e,t,n,s&&(0,Ie().fileURLToPath)(s))}function DEe(e,t,r,n,s,i,a,o,l){if(t!==""&&!i&&e[e.length-1]!=="/")throw Gl(r,e,n,a,s);if(!e.startsWith("./")){if(a&&!e.startsWith("../")&&!e.startsWith("/")){let d=!1;try{new(Ie()).URL(e),d=!0}catch{}if(!d){let m=i?Af.call(Cf,e,()=>t):e+t;return TO(m,n,l)}}throw Gl(r,e,n,a,s)}if(sO.exec(e.slice(2))!==null)if(iO.exec(e.slice(2))===null){if(!o){let d=i?r.replace("*",()=>t):r+t,m=i?Af.call(Cf,e,()=>t):e;oO(m,d,r,n,a,s,!0)}}else throw Gl(r,e,n,a,s);let u=new(Ie()).URL(e,n),c=u.pathname,p=new(Ie()).URL(".",n).pathname;if(!c.startsWith(p))throw Gl(r,e,n,a,s);if(t==="")return u;if(sO.exec(t)!==null){let d=i?r.replace("*",()=>t):r+t;if(iO.exec(t)===null){if(!o){let m=i?Af.call(Cf,e,()=>t):e;oO(m,d,r,n,a,s,!1)}}else CEe(d,r,n,a,s)}return i?new(Ie()).URL(Af.call(Cf,u.href,()=>t)):new(Ie()).URL(t,u)}function wEe(e){let t=Number(e);return`${t}`!==e?!1:t>=0&&t<4294967295}function lo(e,t,r,n,s,i,a,o,l){if(typeof t=="string")return DEe(t,r,n,e,s,i,a,o,l);if(Array.isArray(t)){let u=t;if(u.length===0)return null;let c,p=-1;for(;++p<u.length;){let d=u[p],m;try{m=lo(e,d,r,n,s,i,a,o,l)}catch(g){let f=g;if(c=f,f.code==="ERR_INVALID_PACKAGE_TARGET")continue;throw g}if(m!==void 0){if(m===null){c=null;continue}return m}}if(c==null)return null;throw c}if(typeof t=="object"&&t!==null){let u=Object.getOwnPropertyNames(t),c=-1;for(;++c<u.length;){let p=u[c];if(wEe(p))throw new yO((0,Ie().fileURLToPath)(e),s,'"exports" cannot contain numeric property keys.')}for(c=-1;++c<u.length;){let p=u[c];if(p==="default"||l&&l.has(p)){let d=t[p],m=lo(e,d,r,n,s,i,a,o,l);if(m===void 0)continue;return m}}return null}if(t===null)return null;throw Gl(n,t,e,a,s)}function IEe(e,t,r){if(typeof e=="string"||Array.isArray(e))return!0;if(typeof e!="object"||e===null)return!1;let n=Object.getOwnPropertyNames(e),s=!1,i=0,a=-1;for(;++a<n.length;){let o=n[a],l=o===""||o[0]!==".";if(i++===0)s=l;else if(s!==l)throw new yO((0,Ie().fileURLToPath)(t),r,`"exports" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.`)}return s}function _Ee(e,t,r){if(ii().noDeprecation)return;let n=(0,Ie().fileURLToPath)(t);aO.has(n+"|"+e)||(aO.add(n+"|"+e),ii().emitWarning(`Use of deprecated trailing slash pattern mapping "${e}" in the "exports" field module resolution of the package at ${n}${r?` imported from ${(0,Ie().fileURLToPath)(r)}`:""}. Mapping specifiers ending in "/" is no longer supported.`,"DeprecationWarning","DEP0155"))}function uO(e,t,r,n,s){let i=r.exports;if(IEe(i,e,n)&&(i={".":i}),gO.call(i,t)&&!t.includes("*")&&!t.endsWith("/")){let c=i[t],p=lo(e,c,"",t,n,!1,!1,!1,s);if(p==null)throw FE(t,e,n);return p}let a="",o="",l=Object.getOwnPropertyNames(i),u=-1;for(;++u<l.length;){let c=l[u],p=c.indexOf("*");if(p!==-1&&t.startsWith(c.slice(0,p))){t.endsWith("/")&&_Ee( Line truncated
- If you want to resolve "${t}", use "module:${t}"`),(yield qE(e,"@babel/"+t)).error||(n.message+=`
- Did you mean "@babel/${t}"?`);let i=e==="preset"?"plugin":"preset";if((yield qE(i,t)).error||(n.message+=`
- Did you accidentally pass a ${i} as a ${e}?`),e==="plugin"){let a=r.replace("-proposal-","-transform-");a!==r&&!(yield a).error&&(n.message+=`
- Did you mean "${a}"?`)}throw n.message+=`
Make sure that all the Babel plugins and presets you are using
are defined as dependencies or devDependencies in your package.json
file. It's possible that the missing plugin is loaded by a preset
you are using that forgot to add the plugin to its dependencies: you
can workaround this problem by explicitly adding the missing package
to your top-level package.json.
`,n}function QEe(e,t){try{return t?{error:null,value:(((r,n)=>(r=r.split("."),n=n.split("."),+r[0]>+n[0]||r[0]==n[0]&&+r[1]>=+n[1]))(process.versions.node,"8.9")?require.resolve:(r,{paths:[n]},s=require("module"))=>{let i=s._findPath(r,s._nodeModulePaths(n).concat(n));if(i)return i;throw i=new Error(`Cannot resolve module '${r}'`),i.code="MODULE_NOT_FOUND",i})(e,{paths:[t]})}:{error:null,value:require.resolve(e)}}catch(r){return{error:r,value:null}}}function ZEe(e,t){try{return{error:null,value:(0,REe.resolve)(e,t)}}catch(r){return{error:r,value:null}}}function vO(e,t,r){let n=wO(e,t),s=n.next();for(;!s.done;)s=n.next(QEe(s.value,r));return{loader:"require",filepath:s.value}}function eTe(e,t,r){let n=(0,UE().pathToFileURL)(VE().join(r,"./babel-virtual-resolve-base.js")).href,s=wO(e,t),i=s.next();for(;!i.done;)i=s.next(ZEe(i.value,n));return{loader:"auto",filepath:(0,UE().fileURLToPath)(i.value)}}function IO(e,t,r,n){if(!AO.supportsESM||!n)return vO(e,t,r);try{let s=eTe(e,t,r);if(!(0,CO().existsSync)(s.filepath))throw Object.assign(new Error(`Could not resolve "${t}" in file ${r}.`),{type:"MODULE_NOT_FOUND"});return s}catch(s){try{return vO(e,t,r)}catch(i){throw s.type==="MODULE_NOT_FOUND"?s:i.type==="MODULE_NOT_FOUND"?i:s}}}Nf=new Set;var Nf;function*_O(e,t,r){if(!(yield*(0,$E.isAsync)())&&Nf.has(r))throw new Error(`Reentrant ${e} detected trying to load "${r}". This module is not ignored and is trying to load itself while compiling itself, leading to a dependency cycle. We recommend adding it to your "ignore" list in your babelrc, or to a .babelignore.`);try{return Nf.add(r),yield*(0,AO.default)(r,t,`You appear to be using a native ECMAScript module ${e}, which is only supported when running Babel asynchronously or when using the Node.js \`--experimental-require-module\` flag.`,`You appear to be using a ${e} that contains top-level await, which is only supported when running Babel asynchronously.`,!0)}catch(n){throw n.message=`[BABEL]: ${n.message} (While processing: ${r})`,n}finally{Nf.delete(r)}}});var Pl=x(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});Object.defineProperty(nn,"ROOT_CONFIG_FILENAMES",{enumerable:!0,get:function(){return uo.ROOT_CONFIG_FILENAMES}});Object.defineProperty(nn,"findConfigUpwards",{enumerable:!0,get:function(){return uo.findConfigUpwards}});Object.defineProperty(nn,"findPackageData",{enumerable:!0,get:function(){return tTe.findPackageData}});Object.defineProperty(nn,"findRelativeConfig",{enumerable:!0,get:function(){return uo.findRelativeConfig}});Object.defineProperty(nn,"findRootConfig",{enumerable:!0,get:function(){return uo.findRootConfig}});Object.defineProperty(nn,"loadConfig",{enumerable:!0,get:function(){return uo.loadConfig}});Object.defineProperty(nn,"loadPlugin",{enumerable:!0,get:function(){return Of.loadPlugin}});Object.defineProperty(nn,"loadPreset",{enumerable:!0,get:function(){return Of.loadPreset}});Object.defineProperty(nn,"resolvePlugin",{enumerable:!0,get:function(){return Of.resolvePlugin}});Object.defineProperty(nn,"resolvePreset",{enumerable:!0,get:function(){return Of.resolvePreset}});Object.defineProperty(nn,"resolveShowConfigPath",{enumerable:!0,get:function(){return uo.resolveShowConfigPath}});var tTe=G2(),uo=zN(),Of=NO()});var BO=x(co=>{"use strict";Object.defineProperty(co,"__esModule",{value:!0});co.transform=void 0;co.transformAsync=iTe;co.transformSync=sTe;function OO(){let e=Zr();return OO=function(){return e},e}var rTe=Qa(),nTe=tf(),Bf=fs(),kf=OO()(function*(t,r){let n=yield*(0,rTe.default)(r);return n===null?null:yield*(0,nTe.run)(n,t)}),o3e=co.transform=function(t,r,n){let s,i;if(typeof r=="function"?(i=r,s=void 0):(s=r,i=n),i===void 0)return(0,Bf.beginHiddenCallStack)(kf.sync)(t,s);(0,Bf.beginHiddenCallStack)(kf.errback)(t,s,i)};function sTe(...e){return(0,Bf.beginHiddenCallStack)(kf.sync)(...e)}function iTe(...e){return(0,Bf.beginHiddenCallStack)(kf.async)(...e)}});var FO=x(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});po.transformFromAst=void 0;po.transformFromAstAsync=uTe;po.transformFromAstSync=lTe;function kO(){let e=Zr();return kO=function(){return e},e}var aTe=Qa(),oTe=tf(),Ff=fs(),Lf=kO()(function*(e,t,r){let n=yield*(0,aTe.default)(r);if(n===null)return null;if(!e)throw new Error("No AST given");return yield*(0,oTe.run)(n,t,e)}),u3e=po.transformFromAst=function(t,r,n,s){let i,a;if(typeof n=="function"?(a=n,i=void 0):(i=n,a=s),a===void 0)return(0,Ff.beginHiddenCallStack)(Lf.sync)(t,r,i);(0,Ff.beginHiddenCallStack)(Lf.errback)(t,r,i,a)};function lTe(...e){return(0,Ff.beginHiddenCallStack)(Lf.sync)(...e)}function uTe(...e){return(0,Ff.beginHiddenCallStack)(Lf.async)(...e)}});var jO=x(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.parse=void 0;fo.parseAsync=hTe;fo.parseSync=dTe;function LO(){let e=Zr();return LO=function(){return e},e}var cTe=Qa(),pTe=o1(),fTe=r1(),jf=fs(),Mf=LO()(function*(t,r){let n=yield*(0,cTe.default)(r);return n===null?null:yield*(0,pTe.default)Line truncated
DECORATOR(CLASS_REF = INNER) || CLASS_REF;
`),vTe=(0,ge.template)(`
CLASS_REF.prototype;
`),PTe=(0,ge.template)(`
Object.getOwnPropertyDescriptor(TARGET, PROPERTY);
`),ATe=(0,ge.template)(`
(TEMP = Object.getOwnPropertyDescriptor(TARGET, PROPERTY), (TEMP = TEMP ? TEMP.value : undefined), {
enumerable: true,
configurable: true,
writable: true,
initializer: function(){
return TEMP;
}
})
`),XE=new WeakSet;function KO(e){let r=(e.isClass()?[e,...e.get("body.body")]:e.get("properties")).reduce((n,s)=>n.concat(s.node.decorators||[]),[]).filter(n=>!ge.types.isIdentifier(n.expression));if(r.length!==0)return ge.types.sequenceExpression(r.map(n=>{let s=n.expression,i=n.expression=e.scope.generateDeclaredUidIdentifier("dec");return ge.types.assignmentExpression("=",i,s)}).concat([e.node]))}function CTe(e){if(!GO(e.node))return;let t=e.node.decorators||[];e.node.decorators=null;let r=e.scope.generateDeclaredUidIdentifier("class");return t.map(n=>n.expression).reverse().reduce(function(n,s){return STe({CLASS_REF:ge.types.cloneNode(r),DECORATOR:ge.types.cloneNode(s),INNER:n}).expression},e.node)}function GO(e){var t;return!!((t=e.decorators)!=null&&t.length)}function DTe(e,t){if(YE(e.node.body.body))return XO(e,t,e.node.body.body)}function YE(e){return e.some(t=>{var r;return(r=t.decorators)==null?void 0:r.length})}function wTe(e,t){if(YE(e.node.properties))return XO(e,t,e.node.properties.filter(r=>r.type!=="SpreadElement"))}function XO(e,t,r){let n=e.scope.generateDeclaredUidIdentifier(e.isClass()?"class":"obj"),s=r.reduce(function(i,a){let o=[];if(a.decorators!=null&&(o=a.decorators,a.decorators=null),o.length===0)return i;if(a.computed)throw e.buildCodeFrameError("Computed method/property decorators are not yet supported.");let l=ge.types.isLiteral(a.key)?a.key:ge.types.stringLiteral(a.key.name),u=e.isClass()&&!a.static?vTe({CLASS_REF:n}).expression:n;if(ge.types.isClassProperty(a,{static:!1})){let c=e.scope.generateDeclaredUidIdentifier("descriptor"),p=a.value?ge.types.functionExpression(null,[],ge.types.blockStatement([ge.types.returnStatement(a.value)])):ge.types.nullLiteral();a.value=ge.types.callExpression(t.addHelper("initializerWarningHelper"),[c,ge.types.thisExpression()]),XE.add(a.value),i.push(ge.types.assignmentExpression("=",ge.types.cloneNode(c),ge.types.callExpression(t.addHelper("applyDecoratedDescriptor"),[ge.types.cloneNode(u),ge.types.cloneNode(l),ge.types.arrayExpression(o.map(d=>ge.types.cloneNode(d.expression))),ge.types.objectExpression([ge.types.objectProperty(ge.types.identifier("configurable"),ge.types.booleanLiteral(!0)),ge.types.objectProperty(ge.types.identifier("enumerable"),ge.types.booleanLiteral(!0)),ge.types.objectProperty(ge.types.identifier("writable"),ge.types.booleanLiteral(!0)),ge.types.objectProperty(ge.types.identifier("initializer"),p)])])))}else i.push(ge.types.callExpression(t.addHelper("applyDecoratedDescriptor"),[ge.types.cloneNode(u),ge.types.cloneNode(l),ge.types.arrayExpression(o.map(c=>ge.types.cloneNode(c.expression))),ge.types.isObjectProperty(a)||ge.types.isClassProperty(a,{static:!0})?ATe({TEMP:e.scope.generateDeclaredUidIdentifier("init"),TARGET:ge.types.cloneNode(u),PROPERTY:ge.types.cloneNode(l)}).expression:PTe({TARGET:ge.types.cloneNode(u),PROPERTY:ge.types.cloneNode(l)}).expression,ge.types.cloneNode(u)]));return i},[]);return ge.types.sequenceExpression([ge.types.assignmentExpression("=",ge.types.cloneNode(n),e.node),ge.types.sequenceExpression(s),ge.types.cloneNode(n)])}function HO({node:e,scope:t}){if(!GO(e)&&!YE(e.body.body))return;let r=e.id?ge.types.cloneNode(e.id):t.generateUidIdentifier("class");return ge.types.variableDeclaration("let",[ge.types.variableDeclarator(r,ge.types.toExpression(e))])}var ITe={ExportDefaultDeclaration(e){let t=e.get("declaration");if(!t.isClassDeclaration())return;let r=HO(t);if(r){let[n]=e.replaceWithMultiple([r,ge.types.exportNamedDeclaration(null,[ge.types.exportSpecifier(ge.types.cloneNode(r.declarations[0].id),ge.types.identifier("default"))])]);t.node.id||e.scope.registerDeclaration(n)}},ClassDeclaration(e){let t=HO(e);if(t){let[r]=e.replaceWith(t),n=r.get("declarations.0"),s=n.node.id,i=e.scope.getOwnBinding(s.name);i.identifier=s,i.path=n}},ClassExpression(e,t){let r=KO(e)||CTe(e)||DTe(e,t);r&&e.replaceWith(r)},ObjectExpression(e,t){let r=KO(e)||wTe(e,t);r&&e.replaceWith(r)},AssignmentExpression(e,t){XE.has(e.node.right)&&e.replaceWith(ge.types.callExpression(t.addHelper("initializerDefineProperty"),[ge.types.cloneNode(e.get("left.object").node),ge.types.stringLiteral(e.get("left.property").node.name||e.get("left.property").node.value),ge.types.cloneNode(e.get("right.arguments")[0].node),ge.types.cloneNode(e.get("right.arguments")[1].node)]))},CallExpression(e,t){e.node.arguments.length===3&&XE.has(e.node.arguments[2])&&e.node.callee.name===t.addHelper("defineProperty").name&&e.replaceWith(ge.types.callExpression(t.addHelper("initializerDefineProperty"),[ge.types.cloneNode(e.get("arguments")[0].node),ge.types.cloneNode(e.get("arguments")[1].node),ge.types.cloneNode(e.get("arguments.2.arguments")[0].node),ge.types.cloneNode(e.get("arguments.2.arguments")[1].node)]))}},x3e=Uf.default=ITe});var QO=x(Vf=>{"use strict";Object.defineProperty(Vf,"__esModule",{value:!0});Vf.default=void 0;var _Te=Ft(),JO=WO(),zO=so(),NTe=YO(),v3e=Vf.default=(0,_Te.declare)((e,t)=>{e.assertVersion(7);var{legacy:r}=t;let{v Line truncated
Array.prototype.slice.call(${t})
`;let i,a=[t];return typeof r=="number"?(a.push(K.types.numericLiteral(r)),i="slicedToArray"):i="toArray",s&&(a.unshift(n.path.hub.addHelper(i)),i="maybeArrayLike"),K.types.callExpression(n.path.hub.addHelper(i),a)}}pushAssignmentPattern({left:t,right:r},n){if(ZO(n)){this.push(t,r);return}let s=this.scope.generateUidIdentifierBasedOnNode(n);this.nodes.push(this.buildVariableDeclaration(s,n));let i=K.types.conditionalExpression(K.types.binaryExpression("===",K.types.cloneNode(s),this.scope.buildUndefinedNode()),r,K.types.cloneNode(s));if(K.types.isPattern(t)){let a,o;this.kind==="const"||this.kind==="let"?(a=this.scope.generateUidIdentifier(s.name),o=this.buildVariableDeclaration(a,i)):(a=s,o=K.types.expressionStatement(K.types.assignmentExpression("=",K.types.cloneNode(s),i))),this.nodes.push(o),this.push(t,a)}else this.nodes.push(this.buildVariableAssignment(t,i))}pushObjectRest(t,r,n,s){let i=n3(t.properties.slice(0,s),r,this.scope,a=>this.addHelper(a),this.objectRestNoSymbols,this.useBuiltIns);this.nodes.push(this.buildVariableAssignment(n.argument,i))}pushObjectProperty(t,r){K.types.isLiteral(t.key)&&(t.computed=!0);let n=t.value,s=K.types.memberExpression(K.types.cloneNode(r),t.key,t.computed);K.types.isPattern(n)?this.push(n,s):this.nodes.push(this.buildVariableAssignment(n,s))}pushObjectPattern(t,r){if(!t.properties.length){this.nodes.push(K.types.expressionStatement(K.types.callExpression(this.addHelper("objectDestructuringEmpty"),ZO(r)?[]:[r])));return}if(t.properties.length>1&&!this.scope.isStatic(r)){let n=this.scope.generateUidIdentifierBasedOnNode(r);this.nodes.push(this.buildVariableDeclaration(n,r)),r=n}if(BTe(t)){let n;for(let s=0;s<t.properties.length;s++){let i=t.properties[s];if(K.types.isRestElement(i))break;let a=i.key;if(i.computed&&!this.scope.isPure(a)){let o=this.scope.generateUidIdentifierBasedOnNode(a);this.nodes.push(this.buildVariableDeclaration(o,a)),n||(n=t=Object.assign({},t,{properties:t.properties.slice()})),n.properties[s]=Object.assign({},i,{key:o})}}}for(let n=0;n<t.properties.length;n++){let s=t.properties[n];K.types.isRestElement(s)?this.pushObjectRest(t,r,s,n):this.pushObjectProperty(s,r)}}canUnpackArrayPattern(t,r){if(!K.types.isArrayExpression(r))return!1;if(t.elements.length>r.elements.length)return;if(t.elements.length<r.elements.length&&!e3(t))return!1;for(let i of t.elements)if(!i||K.types.isMemberExpression(i))return!1;for(let i of r.elements)if(K.types.isSpreadElement(i)||K.types.isCallExpression(i)||K.types.isMemberExpression(i))return!1;let s={deopt:!1,bindings:K.types.getBindingIdentifiers(t)};try{K.types.traverse(r,kTe,s)}catch(i){if(i!==r3)throw i}return!s.deopt}pushUnpackedArrayPattern(t,r){let n=s=>s!=null?s:this.scope.buildUndefinedNode();for(let s=0;s<t.elements.length;s++){let i=t.elements[s];K.types.isRestElement(i)?this.push(i.argument,K.types.arrayExpression(r.elements.slice(s).map(n))):this.push(i,n(r.elements[s]))}}pushArrayPattern(t,r){if(r===null){this.nodes.push(K.types.expressionStatement(K.types.callExpression(this.addHelper("objectDestructuringEmpty"),[])));return}if(!t.elements)return;if(this.canUnpackArrayPattern(t,r)){this.pushUnpackedArrayPattern(t,r);return}let n=!e3(t)&&t.elements.length,s=this.toArray(r,n);K.types.isIdentifier(s)?r=s:(r=this.scope.generateUidIdentifierBasedOnNode(r),this.arrayRefSet.add(r.name),this.nodes.push(this.buildVariableDeclaration(r,s)));for(let i=0;i<t.elements.length;i++){let a=t.elements[i];if(!a)continue;let o;K.types.isRestElement(a)?(o=this.toArray(r),o=K.types.callExpression(K.types.memberExpression(o,K.types.identifier("slice")),[K.types.numericLiteral(i)]),this.push(a.argument,o)):(o=K.types.memberExpression(r,K.types.numericLiteral(i),!0),this.push(a,o))}}init(t,r){if(!K.types.isArrayExpression(r)&&!K.types.isMemberExpression(r)){let n=this.scope.maybeGenerateMemoised(r,!0);n&&(this.nodes.push(this.buildVariableDeclaration(n,K.types.cloneNode(r))),r=n)}return this.push(t,r),this.nodes}};function n3(e,t,r,n,s,i){let a=[],o=!0,l=!1;for(let c=0;c<e.length;c++){let p=e[c],d=p.key;K.types.isIdentifier(d)&&!p.computed?a.push(K.types.stringLiteral(d.name)):K.types.isTemplateLiteral(d)?(a.push(K.types.cloneNode(d)),l=!0):K.types.isLiteral(d)?a.push(K.types.stringLiteral(String(d.value))):K.types.isPrivateName(d)||(a.push(K.types.cloneNode(d)),o=!1)}let u;if(a.length===0){let c=i?K.types.memberExpression(K.types.identifier("Object"),K.types.identifier("assign")):n("extends");u=K.types.callExpression(c,[K.types.objectExpression([]),K.types.sequenceExpression([K.types.callExpression(n("objectDestructuringEmpty"),[K.types.cloneNode(t)]),K.types.cloneNode(t)])])}else{let c=K.types.arrayExpression(a);if(!o)c=K.types.callExpression(K.types.memberExpression(c,K.types.identifier("map")),[n("toPropertyKey")]);else if(!l&&!K.types.isProgram(r.block)){let p=r.getProgramParent(),d=p.generateUidIdentifier("excluded");p.push({id:d,init:c,kind:"const"}),c=K.types.cloneNode(d)}u=K.types.callExpression(n(`objectWiLine truncated
try {
var ${Re.types.cloneNode(o)} = ${a.addHelper("usingCtx")}();
${i.node.body}
} catch (_) {
${Re.types.cloneNode(o)}.e = _;
} finally {
${l?Re.types.awaitExpression(c):c}
}
`;Re.types.inherits(p,i.node);let{parentPath:d}=i;d.isFunction()||d.isTryStatement()||d.isCatchClause()?i.replaceWith(Re.types.blockStatement([p])):i.isStaticBlock()?i.node.body=[p]:i.replaceWith(p)}},s=Re.traverse.visitors.merge([n,{Function(i){i.skip()}}]);return{name:"transform-explicit-resource-management",manipulateOptions:(i,a)=>a.plugins.push("explicitResourceManagement"),visitor:Re.traverse.visitors.merge([n,{Program(i){if(t.clear(),i.node.sourceType!=="module"||!i.node.body.some(r))return;let a=[];for(let o of i.get("body")){if(o.isFunctionDeclaration()||o.isImportDeclaration())continue;let l=o.node,u=!0;if(o.isExportDefaultDeclaration()){let{declaration:c}=o.node,p;if(Re.types.isClassDeclaration(c))p=c.id,c.id=Re.types.cloneNode(p),c=Re.types.toExpression(c);else if(!Re.types.isExpression(c))continue;p!=null||(p=i.scope.generateUidIdentifier("_default")),a.push(Re.types.variableDeclaration("var",[Re.types.variableDeclarator(p,c)])),o.replaceWith(Re.types.exportNamedDeclaration(null,[Re.types.exportSpecifier(Re.types.cloneNode(p),Re.types.identifier("default"))]));continue}if(o.isExportNamedDeclaration()){if(l=o.node.declaration,!l||Re.types.isFunction(l))continue;o.replaceWith(Re.types.exportNamedDeclaration(null,Object.keys(Re.types.getOuterBindingIdentifiers(l,!1)).map(c=>Re.types.exportSpecifier(Re.types.identifier(c),Re.types.identifier(c))))),u=!1}else if(o.isExportDeclaration())continue;if(Re.types.isClassDeclaration(l)){let{id:c}=l;l.id=Re.types.cloneNode(c),a.push(Re.types.variableDeclaration("var",[Re.types.variableDeclarator(c,Re.types.toExpression(l))]))}else Re.types.isVariableDeclaration(l)?(l.kind==="using"?t.set(o.node,0):l.kind==="await using"&&t.set(o.node,1),l.kind="var",a.push(l)):a.push(o.node);u&&o.remove()}i.pushContainer("body",Re.types.blockStatement(a))},Function(i,a){i.node.async&&i.traverse(s,a)}}])}})});var o3=x(Wf=>{"use strict";Object.defineProperty(Wf,"__esModule",{value:!0});Wf.default=void 0;var VTe=Ft(),a3=so(),w3e=Wf.default=(0,VTe.declare)((e,t)=>(e.assertVersion(7),(0,a3.createClassFeaturePlugin)({name:"transform-class-properties",api:e,feature:a3.FEATURES.fields,loose:t.loose,manipulateOptions(r,n){n.plugins.push("classProperties","classPrivateProperties")}})))});var u3=x(Kf=>{"use strict";Object.defineProperty(Kf,"__esModule",{value:!0});Kf.default=void 0;var $Te=Ft(),l3=so();function WTe(e,t){let r="",n,s=1;do n=`_${r}`,s>1&&(n+=s),s++;while(t.has(n));return n}var _3e=Kf.default=(0,$Te.declare)(({types:e,template:t,assertVersion:r})=>(r("^7.12.0 || >8.0.0-alpha <8.0.0-beta"),{name:"transform-class-static-block",manipulateOptions:(n,s)=>s.plugins.push("classStaticBlock"),pre(){(0,l3.enableFeature)(this.file,l3.FEATURES.staticBlocks,!1)},visitor:{ClassBody(n){let{scope:s}=n,i=new Set,a=n.get("body");for(let o of a)o.isPrivate()&&i.add(o.get("key.id").node.name);for(let o of a){if(!o.isStaticBlock())continue;let l=WTe(s,i);i.add(l);let u=e.privateName(e.identifier(l)),c,p=o.node.body;p.length===1&&e.isExpressionStatement(p[0])?c=e.inheritsComments(p[0].expression,p[0]):c=t.expression.ast`(() => { ${p} })()`,o.replaceWith(e.classPrivateProperty(u,c,[],!0))}}}}))});var p3=x(Hf=>{"use strict";Object.defineProperty(Hf,"__esModule",{value:!0});Hf.default=void 0;var KTe=Ft();function c3({node:e}){var t;let{extra:r}=e;r!=null&&(t=r.raw)!=null&&t.includes("_")&&(r.raw=r.raw.replace(/_/g,""))}var O3e=Hf.default=(0,KTe.declare)(e=>(e.assertVersion("^7.0.0-0 || >8.0.0-alpha <8.0.0-beta"),{name:"transform-numeric-separator",manipulateOptions:(t,r)=>r.plugins.push("numericSeparator"),visitor:{NumericLiteral:c3,BigIntLiteral:c3}}))});var f3=x(Gf=>{"use strict";Object.defineProperty(Gf,"__esModule",{value:!0});Gf.default=void 0;var HTe=Ft(),Ds=vt(),k3e=Gf.default=(0,HTe.declare)(e=>(e.assertVersion("^7.0.0-0 || >8.0.0-alpha <8.0.0-beta"),{name:"transform-logical-assignment-operators",manipulateOptions:(t,r)=>r.plugins.push("logicalAssignment"),visitor:{AssignmentExpression(t){let{node:r,scope:n}=t,{operator:s,left:i,right:a}=r,o=s.slice(0,-1);if(!Ds.types.LOGICAL_OPERATORS.includes(o))return;let l=Ds.types.cloneNode(i);if(Ds.types.isMemberExpression(i)){let{object:u,property:c,computed:p}=i,d=n.maybeGenerateMemoised(u);if(d&&(i.object=d,l.object=Ds.types.assignmentExpression("=",Ds.types.cloneNode(d),u)),p){let m=n.maybeGenerateMemoised(c);m&&(i.property=m,l.property=Ds.types.assignmentExpression("=",Ds.types.cloneNode(m),c))}}t.replaceWith(Ds.types.logicalExpression(o,l,Ds.types.assignmentExpression("=",i,a)))}}}))});var d3=x(Xf=>{"use strict";Object.defineProperty(Xf,"__esModule",{value:!0});Xf.default=void 0;var GTe=Ft(),Tr=vt(),L3e=Xf.default=(0,GTe.declare)((e,{loose:t=!1})=>{var r,n;e.assertVersion("^7.0.0-0 || >8.0.0-alpha <8.0.0-beta");let s=(r=e.assumption("noDocumentAll"))!=null?r:t,i=(n=e.assumption("pureGetters"))!=null?n:!1;return{name:"transform-nullish-coalescing-operator",manipulateOptions:(a,o)=>o.plugins.push("nullishCoalescingOperator"),visitor:{Logi Line truncated
fileName: ${e},
lineNumber: ${n},
columnNumber: ${s},
}`}function A3(e,t){let r=`transform-react-jsx-${t.slice(2)}`;return e.buildCodeFrameError(`Duplicate ${t} prop found. You are most likely using the deprecated ${r} Babel plugin. Both __source and __self are automatically set when using the automatic runtime. Please remove transform-react-jsx-source and transform-react-jsx-self from your Babel config.`)}});var D3=x(rd=>{"use strict";Object.defineProperty(rd,"__esModule",{value:!0});rd.default=void 0;var vxe=C3(),X3e=rd.default=(0,vxe.default)({name:"transform-react-jsx",development:!1})});var Dxe={};U3(Dxe,{babelParse:()=>Cxe,babelTransform:()=>Axe,codeFrameColumns:()=>O3.codeFrameColumns,declare:()=>B3.declare,traverse:()=>Pxe,types:()=>k3.types});module.exports=V3(Dxe);var w3=ci(require("path")),nd=ci(vt()),I3=ci(zt()),O3=ci(Ta()),B3=ci(Ft()),k3=ci(vt()),Pxe=I3.default;function _3(e,t,r,n){let s=[[$O(),{deprecatedAssertSyntax:!0}]];return e&&s.push([QO(),{version:"2023-05"}],[i3()],[o3()],[u3()],[p3()],[f3()],[d3()],[y3()],[b3()],[E3()],[T3()],[x3()],[S3()],[v3()],[({template:i})=>({name:"replace-ts-export-assignment",visitor:{TSExportAssignment(a){a.replaceWith(i("module.exports = ASSIGNMENT;")({ASSIGNMENT:a.node.expression}))}}})]),s.push([D3(),{throwIfNamespace:!1,runtime:"automatic",importSource:w3.default.dirname(require.resolve("playwright"))}]),t||(s.push([TE()]),s.push([()=>({name:"css-to-identity-obj-proxy",visitor:{ImportDeclaration(i){i.node.source.value.match(/\.(css|less|scss)$/)&&i.remove()}}})])),{browserslistConfigFile:!1,babelrc:!1,configFile:!1,assumptions:{setPublicClassFields:!0},presets:e?[[SE(),{onlyRemoveTypeImports:!1}]]:[],plugins:[...r.map(([i,a])=>[require(i),a]),...s,...n.map(([i,a])=>[require(i),a])],compact:!1,sourceMaps:"both"}}var tT=!1;function N3(e){return e.endsWith(".ts")||e.endsWith(".tsx")||e.endsWith(".mts")||e.endsWith(".cts")}function Axe(e,t,r,n,s){if(tT)return null;tT=!0;try{let i=_3(N3(t),r,n,s);return nd.transform(e,{filename:t,...i})}finally{tT=!1}}function Cxe(e,t,r){let n=_3(N3(t),r,[],[]);return nd.parse(e,{filename:t,...n})}0&&(module.exports={babelParse,babelTransform,codeFrameColumns,declare,traverse,types});
+255
View File
@@ -0,0 +1,255 @@
"use strict";
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 __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);
var compilationCache_exports = {};
__export(compilationCache_exports, {
addToCompilationCache: () => addToCompilationCache,
affectedTestFiles: () => affectedTestFiles,
belongsToNodeModules: () => belongsToNodeModules,
cacheDir: () => cacheDir,
collectAffectedTestFiles: () => collectAffectedTestFiles,
currentFileDepsCollector: () => currentFileDepsCollector,
dependenciesForTestFile: () => dependenciesForTestFile,
fileDependenciesForTest: () => fileDependenciesForTest,
getFromCompilationCache: () => getFromCompilationCache,
getUserData: () => getUserData,
installSourceMapSupport: () => installSourceMapSupport,
internalDependenciesForTestFile: () => internalDependenciesForTestFile,
serializeCompilationCache: () => serializeCompilationCache,
setExternalDependencies: () => setExternalDependencies,
startCollectingFileDeps: () => startCollectingFileDeps,
stopCollectingFileDeps: () => stopCollectingFileDeps
});
module.exports = __toCommonJS(compilationCache_exports);
var import_fs = __toESM(require("fs"));
var import_os = __toESM(require("os"));
var import_path = __toESM(require("path"));
var import_globals = require("../common/globals");
var import_utilsBundle = require("../utilsBundle");
const cacheDir = process.env.PWTEST_CACHE_DIR || (() => {
if (process.platform === "win32")
return import_path.default.join(import_os.default.tmpdir(), `playwright-transform-cache`);
return import_path.default.join(import_os.default.tmpdir(), `playwright-transform-cache-` + process.geteuid?.());
})();
const sourceMaps = /* @__PURE__ */ new Map();
const memoryCache = /* @__PURE__ */ new Map();
const fileDependencies = /* @__PURE__ */ new Map();
const externalDependencies = /* @__PURE__ */ new Map();
function installSourceMapSupport() {
Error.stackTraceLimit = 200;
import_utilsBundle.sourceMapSupport.install({
environment: "node",
handleUncaughtExceptions: false,
retrieveSourceMap(source) {
if (!sourceMaps.has(source))
return null;
const sourceMapPath = sourceMaps.get(source);
try {
return {
map: JSON.parse(import_fs.default.readFileSync(sourceMapPath, "utf-8")),
url: source
};
} catch {
return null;
}
}
});
}
function _innerAddToCompilationCacheAndSerialize(filename, entry) {
sourceMaps.set(entry.moduleUrl || filename, entry.sourceMapPath);
memoryCache.set(filename, entry);
return {
sourceMaps: [[entry.moduleUrl || filename, entry.sourceMapPath]],
memoryCache: [[filename, entry]],
fileDependencies: [],
externalDependencies: []
};
}
function getFromCompilationCache(filename, hash, moduleUrl) {
const cache = memoryCache.get(filename);
if (cache?.codePath) {
try {
return { cachedCode: import_fs.default.readFileSync(cache.codePath, "utf-8") };
} catch {
}
}
const cachePath = calculateCachePath(filename, hash);
const codePath = cachePath + ".js";
const sourceMapPath = cachePath + ".map";
const dataPath = cachePath + ".data";
try {
const cachedCode = import_fs.default.readFileSync(codePath, "utf8");
const serializedCache = _innerAddToCompilationCacheAndSerialize(filename, { codePath, sourceMapPath, dataPath, moduleUrl });
return { cachedCode, serializedCache };
} catch {
}
return {
addToCache: (code, map, data) => {
if ((0, import_globals.isWorkerProcess)())
return {};
import_fs.default.mkdirSync(import_path.default.dirname(cachePath), { recursive: true });
if (map)
import_fs.default.writeFileSync(sourceMapPath, JSON.stringify(map), "utf8");
if (data.size)
import_fs.default.writeFileSync(dataPath, JSON.stringify(Object.fromEntries(data.entries()), void 0, 2), "utf8");
import_fs.default.writeFileSync(codePath, code, "utf8");
const serializedCache = _innerAddToCompilationCacheAndSerialize(filename, { codePath, sourceMapPath, dataPath, moduleUrl });
return { serializedCache };
}
};
}
function serializeCompilationCache() {
return {
sourceMaps: [...sourceMaps.entries()],
memoryCache: [...memoryCache.entries()],
fileDependencies: [...fileDependencies.entries()].map(([filename, deps]) => [filename, [...deps]]),
externalDependencies: [...externalDependencies.entries()].map(([filename, deps]) => [filename, [...deps]])
};
}
function addToCompilationCache(payload) {
for (const entry of payload.sourceMaps)
sourceMaps.set(entry[0], entry[1]);
for (const entry of payload.memoryCache)
memoryCache.set(entry[0], entry[1]);
for (const entry of payload.fileDependencies) {
const existing = fileDependencies.get(entry[0]) || [];
fileDependencies.set(entry[0], /* @__PURE__ */ new Set([...entry[1], ...existing]));
}
for (const entry of payload.externalDependencies) {
const existing = externalDependencies.get(entry[0]) || [];
externalDependencies.set(entry[0], /* @__PURE__ */ new Set([...entry[1], ...existing]));
}
}
function calculateCachePath(filePath, hash) {
const fileName = import_path.default.basename(filePath, import_path.default.extname(filePath)).replace(/\W/g, "") + "_" + hash;
return import_path.default.join(cacheDir, hash[0] + hash[1], fileName);
}
let depsCollector;
function startCollectingFileDeps() {
depsCollector = /* @__PURE__ */ new Set();
}
function stopCollectingFileDeps(filename) {
if (!depsCollector)
return;
depsCollector.delete(filename);
for (const dep of depsCollector) {
if (belongsToNodeModules(dep))
depsCollector.delete(dep);
}
fileDependencies.set(filename, depsCollector);
depsCollector = void 0;
}
function currentFileDepsCollector() {
return depsCollector;
}
function setExternalDependencies(filename, deps) {
const depsSet = new Set(deps.filter((dep) => !belongsToNodeModules(dep) && dep !== filename));
externalDependencies.set(filename, depsSet);
}
function fileDependenciesForTest() {
return fileDependencies;
}
function collectAffectedTestFiles(changedFile, testFileCollector) {
const isTestFile = (file) => fileDependencies.has(file);
if (isTestFile(changedFile))
testFileCollector.add(changedFile);
for (const [testFile, deps] of fileDependencies) {
if (deps.has(changedFile))
testFileCollector.add(testFile);
}
for (const [importingFile, depsOfImportingFile] of externalDependencies) {
if (depsOfImportingFile.has(changedFile)) {
if (isTestFile(importingFile))
testFileCollector.add(importingFile);
for (const [testFile, depsOfTestFile] of fileDependencies) {
if (depsOfTestFile.has(importingFile))
testFileCollector.add(testFile);
}
}
}
}
function affectedTestFiles(changes) {
const result = /* @__PURE__ */ new Set();
for (const change of changes)
collectAffectedTestFiles(change, result);
return [...result];
}
function internalDependenciesForTestFile(filename) {
return fileDependencies.get(filename);
}
function dependenciesForTestFile(filename) {
const result = /* @__PURE__ */ new Set();
for (const testDependency of fileDependencies.get(filename) || []) {
result.add(testDependency);
for (const externalDependency of externalDependencies.get(testDependency) || [])
result.add(externalDependency);
}
for (const dep of externalDependencies.get(filename) || [])
result.add(dep);
return result;
}
const kPlaywrightInternalPrefix = import_path.default.resolve(__dirname, "../../../playwright");
function belongsToNodeModules(file) {
if (file.includes(`${import_path.default.sep}node_modules${import_path.default.sep}`))
return true;
if (file.startsWith(kPlaywrightInternalPrefix) && (file.endsWith(".js") || file.endsWith(".mjs")))
return true;
return false;
}
async function getUserData(pluginName) {
const result = /* @__PURE__ */ new Map();
for (const [fileName, cache] of memoryCache) {
if (!cache.dataPath)
continue;
if (!import_fs.default.existsSync(cache.dataPath))
continue;
const data = JSON.parse(await import_fs.default.promises.readFile(cache.dataPath, "utf8"));
if (data[pluginName])
result.set(fileName, data[pluginName]);
}
return result;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
addToCompilationCache,
affectedTestFiles,
belongsToNodeModules,
cacheDir,
collectAffectedTestFiles,
currentFileDepsCollector,
dependenciesForTestFile,
fileDependenciesForTest,
getFromCompilationCache,
getUserData,
installSourceMapSupport,
internalDependenciesForTestFile,
serializeCompilationCache,
setExternalDependencies,
startCollectingFileDeps,
stopCollectingFileDeps
});
+104
View File
@@ -0,0 +1,104 @@
"use strict";
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 __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 import_fs = __toESM(require("fs"));
var import_url = __toESM(require("url"));
var import_compilationCache = require("./compilationCache");
var import_portTransport = require("./portTransport");
var import_transform = require("./transform");
var import_util = require("../util");
async function resolve(specifier, context, defaultResolve) {
if (context.parentURL && context.parentURL.startsWith("file://")) {
const filename = import_url.default.fileURLToPath(context.parentURL);
const resolved = (0, import_transform.resolveHook)(filename, specifier);
if (resolved !== void 0)
specifier = import_url.default.pathToFileURL(resolved).toString();
}
const result = await defaultResolve(specifier, context, defaultResolve);
if (result?.url && result.url.startsWith("file://"))
(0, import_compilationCache.currentFileDepsCollector)()?.add(import_url.default.fileURLToPath(result.url));
return result;
}
const kSupportedFormats = /* @__PURE__ */ new Map([
["commonjs", "commonjs"],
["module", "module"],
["commonjs-typescript", "commonjs"],
["module-typescript", "module"],
[null, null],
[void 0, void 0]
]);
async function load(moduleUrl, context, defaultLoad) {
if (!kSupportedFormats.has(context.format))
return defaultLoad(moduleUrl, context, defaultLoad);
if (!moduleUrl.startsWith("file://"))
return defaultLoad(moduleUrl, context, defaultLoad);
const filename = import_url.default.fileURLToPath(moduleUrl);
if (!(0, import_transform.shouldTransform)(filename))
return defaultLoad(moduleUrl, context, defaultLoad);
const code = import_fs.default.readFileSync(filename, "utf-8");
const transformed = (0, import_transform.transformHook)(code, filename, moduleUrl);
if (transformed.serializedCache) {
if (legacyWaitForSourceMaps)
await transport?.send("pushToCompilationCache", { cache: transformed.serializedCache });
else
transport?.post("pushToCompilationCache", { cache: transformed.serializedCache });
}
return {
format: kSupportedFormats.get(context.format) || ((0, import_util.fileIsModule)(filename) ? "module" : "commonjs"),
source: transformed.code,
shortCircuit: true
};
}
let transport;
let legacyWaitForSourceMaps = false;
function initialize(data) {
transport = createTransport(data?.port);
legacyWaitForSourceMaps = !!process.env.PLAYWRIGHT_WAIT_FOR_SOURCE_MAPS;
}
function createTransport(port) {
return new import_portTransport.PortTransport(port, async (method, params) => {
if (method === "setSingleTSConfig") {
(0, import_transform.setSingleTSConfig)(params.tsconfig);
return;
}
if (method === "setTransformConfig") {
(0, import_transform.setTransformConfig)(params.config);
return;
}
if (method === "addToCompilationCache") {
(0, import_compilationCache.addToCompilationCache)(params.cache);
return;
}
if (method === "getCompilationCache")
return { cache: (0, import_compilationCache.serializeCompilationCache)() };
if (method === "startCollectingFileDeps") {
(0, import_compilationCache.startCollectingFileDeps)();
return;
}
if (method === "stopCollectingFileDeps") {
(0, import_compilationCache.stopCollectingFileDeps)(params.file);
return;
}
});
}
module.exports = { initialize, load, resolve };
+67
View File
@@ -0,0 +1,67 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var portTransport_exports = {};
__export(portTransport_exports, {
PortTransport: () => PortTransport
});
module.exports = __toCommonJS(portTransport_exports);
class PortTransport {
constructor(port, handler) {
this._lastId = 0;
this._callbacks = /* @__PURE__ */ new Map();
this._port = port;
port.addEventListener("message", async (event) => {
const message = event.data;
const { id, ackId, method, params, result } = message;
if (ackId) {
const callback = this._callbacks.get(ackId);
this._callbacks.delete(ackId);
this._resetRef();
callback?.(result);
return;
}
const handlerResult = await handler(method, params);
if (id)
this._port.postMessage({ ackId: id, result: handlerResult });
});
this._resetRef();
}
post(method, params) {
this._port.postMessage({ method, params });
}
async send(method, params) {
return await new Promise((f) => {
const id = ++this._lastId;
this._callbacks.set(id, f);
this._resetRef();
this._port.postMessage({ id, method, params });
});
}
_resetRef() {
if (this._callbacks.size) {
this._port.ref();
} else {
this._port.unref();
}
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
PortTransport
});
+293
View File
@@ -0,0 +1,293 @@
"use strict";
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 __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);
var transform_exports = {};
__export(transform_exports, {
requireOrImport: () => requireOrImport,
resolveHook: () => resolveHook,
setSingleTSConfig: () => setSingleTSConfig,
setTransformConfig: () => setTransformConfig,
setTransformData: () => setTransformData,
shouldTransform: () => shouldTransform,
singleTSConfig: () => singleTSConfig,
transformConfig: () => transformConfig,
transformHook: () => transformHook,
wrapFunctionWithLocation: () => wrapFunctionWithLocation
});
module.exports = __toCommonJS(transform_exports);
var import_fs = __toESM(require("fs"));
var import_module = __toESM(require("module"));
var import_path = __toESM(require("path"));
var import_url = __toESM(require("url"));
var import_crypto = __toESM(require("crypto"));
var import_tsconfig_loader = require("../third_party/tsconfig-loader");
var import_util = require("../util");
var import_utilsBundle = require("../utilsBundle");
var import_compilationCache = require("./compilationCache");
var import_pirates = require("../third_party/pirates");
const version = require("../../package.json").version;
const cachedTSConfigs = /* @__PURE__ */ new Map();
let _transformConfig = {
babelPlugins: [],
external: []
};
let _externalMatcher = () => false;
function setTransformConfig(config) {
_transformConfig = config;
_externalMatcher = (0, import_util.createFileMatcher)(_transformConfig.external);
}
function transformConfig() {
return _transformConfig;
}
let _singleTSConfigPath;
let _singleTSConfig;
function setSingleTSConfig(value) {
_singleTSConfigPath = value;
}
function singleTSConfig() {
return _singleTSConfigPath;
}
function validateTsConfig(tsconfig) {
const pathsBase = tsconfig.absoluteBaseUrl ?? tsconfig.paths?.pathsBasePath;
const pathsFallback = tsconfig.absoluteBaseUrl ? [{ key: "*", values: ["*"] }] : [];
return {
allowJs: !!tsconfig.allowJs,
pathsBase,
paths: Object.entries(tsconfig.paths?.mapping || {}).map(([key, values]) => ({ key, values })).concat(pathsFallback)
};
}
function loadAndValidateTsconfigsForFile(file2) {
if (_singleTSConfigPath && !_singleTSConfig)
_singleTSConfig = (0, import_tsconfig_loader.loadTsConfig)(_singleTSConfigPath).map(validateTsConfig);
if (_singleTSConfig)
return _singleTSConfig;
return loadAndValidateTsconfigsForFolder(import_path.default.dirname(file2));
}
function loadAndValidateTsconfigsForFolder(folder) {
const foldersWithConfig = [];
let currentFolder = import_path.default.resolve(folder);
let result2;
while (true) {
const cached = cachedTSConfigs.get(currentFolder);
if (cached) {
result2 = cached;
break;
}
foldersWithConfig.push(currentFolder);
for (const name of ["tsconfig.json", "jsconfig.json"]) {
const configPath = import_path.default.join(currentFolder, name);
if (import_fs.default.existsSync(configPath)) {
const loaded = (0, import_tsconfig_loader.loadTsConfig)(configPath);
result2 = loaded.map(validateTsConfig);
break;
}
}
if (result2)
break;
const parentFolder = import_path.default.resolve(currentFolder, "../");
if (currentFolder === parentFolder)
break;
currentFolder = parentFolder;
}
result2 = result2 || [];
for (const folder2 of foldersWithConfig)
cachedTSConfigs.set(folder2, result2);
return result2;
}
const pathSeparator = process.platform === "win32" ? ";" : ":";
const builtins = new Set(import_module.default.builtinModules);
function resolveHook(filename, specifier) {
if (specifier.startsWith("node:") || builtins.has(specifier))
return;
if (!shouldTransform(filename))
return;
if (isRelativeSpecifier(specifier))
return (0, import_util.resolveImportSpecifierAfterMapping)(import_path.default.resolve(import_path.default.dirname(filename), specifier), false);
const isTypeScript = filename.endsWith(".ts") || filename.endsWith(".tsx");
const tsconfigs = loadAndValidateTsconfigsForFile(filename);
for (const tsconfig of tsconfigs) {
if (!isTypeScript && !tsconfig.allowJs)
continue;
let longestPrefixLength = -1;
let pathMatchedByLongestPrefix;
for (const { key, values } of tsconfig.paths) {
let matchedPartOfSpecifier = specifier;
const [keyPrefix, keySuffix] = key.split("*");
if (key.includes("*")) {
if (keyPrefix) {
if (!specifier.startsWith(keyPrefix))
continue;
matchedPartOfSpecifier = matchedPartOfSpecifier.substring(keyPrefix.length, matchedPartOfSpecifier.length);
}
if (keySuffix) {
if (!specifier.endsWith(keySuffix))
continue;
matchedPartOfSpecifier = matchedPartOfSpecifier.substring(0, matchedPartOfSpecifier.length - keySuffix.length);
}
} else {
if (specifier !== key)
continue;
matchedPartOfSpecifier = specifier;
}
if (keyPrefix.length <= longestPrefixLength)
continue;
for (const value of values) {
let candidate = value;
if (value.includes("*"))
candidate = candidate.replace("*", matchedPartOfSpecifier);
candidate = import_path.default.resolve(tsconfig.pathsBase, candidate);
const existing = (0, import_util.resolveImportSpecifierAfterMapping)(candidate, true);
if (existing) {
longestPrefixLength = keyPrefix.length;
pathMatchedByLongestPrefix = existing;
}
}
}
if (pathMatchedByLongestPrefix)
return pathMatchedByLongestPrefix;
}
if (import_path.default.isAbsolute(specifier)) {
return (0, import_util.resolveImportSpecifierAfterMapping)(specifier, false);
}
}
function shouldTransform(filename) {
if (_externalMatcher(filename))
return false;
return !(0, import_compilationCache.belongsToNodeModules)(filename);
}
let transformData;
function setTransformData(pluginName, value) {
transformData.set(pluginName, value);
}
function transformHook(originalCode, filename, moduleUrl) {
const hasPreprocessor = process.env.PW_TEST_SOURCE_TRANSFORM && process.env.PW_TEST_SOURCE_TRANSFORM_SCOPE && process.env.PW_TEST_SOURCE_TRANSFORM_SCOPE.split(pathSeparator).some((f) => filename.startsWith(f));
const pluginsPrologue = _transformConfig.babelPlugins;
const pluginsEpilogue = hasPreprocessor ? [[process.env.PW_TEST_SOURCE_TRANSFORM]] : [];
const hash = calculateHash(originalCode, filename, !!moduleUrl, pluginsPrologue, pluginsEpilogue);
const { cachedCode, addToCache, serializedCache } = (0, import_compilationCache.getFromCompilationCache)(filename, hash, moduleUrl);
if (cachedCode !== void 0)
return { code: cachedCode, serializedCache };
process.env.BROWSERSLIST_IGNORE_OLD_DATA = "true";
const { babelTransform } = require("./babelBundle");
transformData = /* @__PURE__ */ new Map();
const babelResult = babelTransform(originalCode, filename, !!moduleUrl, pluginsPrologue, pluginsEpilogue);
if (!babelResult?.code)
return { code: originalCode, serializedCache };
const { code, map } = babelResult;
const added = addToCache(code, map, transformData);
return { code, serializedCache: added.serializedCache };
}
function calculateHash(content, filePath, isModule2, pluginsPrologue, pluginsEpilogue) {
const hash = import_crypto.default.createHash("sha1").update(isModule2 ? "esm" : "no_esm").update(content).update(filePath).update(version).update(pluginsPrologue.map((p) => p[0]).join(",")).update(pluginsEpilogue.map((p) => p[0]).join(",")).digest("hex");
return hash;
}
async function requireOrImport(file) {
installTransformIfNeeded();
const isModule = (0, import_util.fileIsModule)(file);
const esmImport = () => eval(`import(${JSON.stringify(import_url.default.pathToFileURL(file))})`);
if (isModule) {
return await esmImport().finally(async () => {
await new Promise((resolve) => setTimeout(resolve, 0));
});
}
const result = require(file);
const depsCollector = (0, import_compilationCache.currentFileDepsCollector)();
if (depsCollector) {
const module2 = require.cache[file];
if (module2)
collectCJSDependencies(module2, depsCollector);
}
return result;
}
let transformInstalled = false;
function installTransformIfNeeded() {
if (transformInstalled)
return;
transformInstalled = true;
(0, import_compilationCache.installSourceMapSupport)();
const originalResolveFilename = import_module.default._resolveFilename;
function resolveFilename(specifier, parent, ...rest) {
if (parent) {
const resolved = resolveHook(parent.filename, specifier);
if (resolved !== void 0)
specifier = resolved;
}
return originalResolveFilename.call(this, specifier, parent, ...rest);
}
import_module.default._resolveFilename = resolveFilename;
(0, import_pirates.addHook)((code, filename) => {
return transformHook(code, filename).code;
}, shouldTransform, [".ts", ".tsx", ".js", ".jsx", ".mjs", ".mts", ".cjs", ".cts"]);
}
const collectCJSDependencies = (module2, dependencies) => {
module2.children.forEach((child) => {
if (!(0, import_compilationCache.belongsToNodeModules)(child.filename) && !dependencies.has(child.filename)) {
dependencies.add(child.filename);
collectCJSDependencies(child, dependencies);
}
});
};
function wrapFunctionWithLocation(func) {
return (...args) => {
const oldPrepareStackTrace = Error.prepareStackTrace;
Error.prepareStackTrace = (error, stackFrames) => {
const frame = import_utilsBundle.sourceMapSupport.wrapCallSite(stackFrames[1]);
const fileName = frame.getFileName();
const file2 = fileName && fileName.startsWith("file://") ? import_url.default.fileURLToPath(fileName) : fileName;
return {
file: file2,
line: frame.getLineNumber(),
column: frame.getColumnNumber()
};
};
const oldStackTraceLimit = Error.stackTraceLimit;
Error.stackTraceLimit = 2;
const obj = {};
Error.captureStackTrace(obj);
const location = obj.stack;
Error.stackTraceLimit = oldStackTraceLimit;
Error.prepareStackTrace = oldPrepareStackTrace;
return func(location, ...args);
};
}
function isRelativeSpecifier(specifier) {
return specifier === "." || specifier === ".." || specifier.startsWith("./") || specifier.startsWith("../");
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
requireOrImport,
resolveHook,
setSingleTSConfig,
setTransformConfig,
setTransformData,
shouldTransform,
singleTSConfig,
transformConfig,
transformHook,
wrapFunctionWithLocation
});
+407
View File
@@ -0,0 +1,407 @@
"use strict";
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 __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);
var util_exports = {};
__export(util_exports, {
addSuffixToFilePath: () => addSuffixToFilePath,
ansiRegex: () => ansiRegex,
callLogText: () => callLogText,
createFileFiltersFromArguments: () => createFileFiltersFromArguments,
createFileMatcher: () => createFileMatcher,
createFileMatcherFromArguments: () => createFileMatcherFromArguments,
createTitleMatcher: () => createTitleMatcher,
debugTest: () => debugTest,
errorWithFile: () => errorWithFile,
expectTypes: () => expectTypes,
fileExistsAsync: () => fileExistsAsync,
fileIsModule: () => fileIsModule,
filterStackFile: () => filterStackFile,
filterStackTrace: () => filterStackTrace,
filteredStackTrace: () => filteredStackTrace,
forceRegExp: () => forceRegExp,
formatLocation: () => formatLocation,
getContainedPath: () => getContainedPath,
getPackageJsonPath: () => getPackageJsonPath,
mergeObjects: () => mergeObjects,
normalizeAndSaveAttachment: () => normalizeAndSaveAttachment,
relativeFilePath: () => relativeFilePath,
removeDirAndLogToConsole: () => removeDirAndLogToConsole,
resolveImportSpecifierAfterMapping: () => resolveImportSpecifierAfterMapping,
resolveReporterOutputPath: () => resolveReporterOutputPath,
sanitizeFilePathBeforeExtension: () => sanitizeFilePathBeforeExtension,
serializeError: () => serializeError,
stripAnsiEscapes: () => stripAnsiEscapes,
trimLongString: () => trimLongString,
windowsFilesystemFriendlyLength: () => windowsFilesystemFriendlyLength
});
module.exports = __toCommonJS(util_exports);
var import_fs = __toESM(require("fs"));
var import_path = __toESM(require("path"));
var import_url = __toESM(require("url"));
var import_util = __toESM(require("util"));
var import_utils = require("playwright-core/lib/utils");
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
const PLAYWRIGHT_TEST_PATH = import_path.default.join(__dirname, "..");
const PLAYWRIGHT_CORE_PATH = import_path.default.dirname(require.resolve("playwright-core/package.json"));
function filterStackTrace(e) {
const name = e.name ? e.name + ": " : "";
const cause = e.cause instanceof Error ? filterStackTrace(e.cause) : void 0;
if (process.env.PWDEBUGIMPL)
return { message: name + e.message, stack: e.stack || "", cause };
const stackLines = (0, import_utils.stringifyStackFrames)(filteredStackTrace(e.stack?.split("\n") || []));
return {
message: name + e.message,
stack: `${name}${e.message}${stackLines.map((line) => "\n" + line).join("")}`,
cause
};
}
function filterStackFile(file) {
if (!process.env.PWDEBUGIMPL && file.startsWith(PLAYWRIGHT_TEST_PATH))
return false;
if (!process.env.PWDEBUGIMPL && file.startsWith(PLAYWRIGHT_CORE_PATH))
return false;
return true;
}
function filteredStackTrace(rawStack) {
const frames = [];
for (const line of rawStack) {
const frame = (0, import_utils.parseStackFrame)(line, import_path.default.sep, !!process.env.PWDEBUGIMPL);
if (!frame || !frame.file)
continue;
if (!filterStackFile(frame.file))
continue;
frames.push(frame);
}
return frames;
}
function serializeError(error) {
if (error instanceof Error)
return filterStackTrace(error);
return {
value: import_util.default.inspect(error)
};
}
function createFileFiltersFromArguments(args) {
return args.map((arg) => {
const match = /^(.*?):(\d+):?(\d+)?$/.exec(arg);
return {
re: forceRegExp(match ? match[1] : arg),
line: match ? parseInt(match[2], 10) : null,
column: match?.[3] ? parseInt(match[3], 10) : null
};
});
}
function createFileMatcherFromArguments(args) {
const filters = createFileFiltersFromArguments(args);
return createFileMatcher(filters.map((filter) => filter.re || filter.exact || ""));
}
function createFileMatcher(patterns) {
const reList = [];
const filePatterns = [];
for (const pattern of Array.isArray(patterns) ? patterns : [patterns]) {
if ((0, import_utils.isRegExp)(pattern)) {
reList.push(pattern);
} else {
if (!pattern.startsWith("**/"))
filePatterns.push("**/" + pattern);
else
filePatterns.push(pattern);
}
}
return (filePath) => {
for (const re of reList) {
re.lastIndex = 0;
if (re.test(filePath))
return true;
}
if (import_path.default.sep === "\\") {
const fileURL = import_url.default.pathToFileURL(filePath).href;
for (const re of reList) {
re.lastIndex = 0;
if (re.test(fileURL))
return true;
}
}
for (const pattern of filePatterns) {
if ((0, import_utilsBundle.minimatch)(filePath, pattern, { nocase: true, dot: true }))
return true;
}
return false;
};
}
function createTitleMatcher(patterns) {
const reList = Array.isArray(patterns) ? patterns : [patterns];
return (value) => {
for (const re of reList) {
re.lastIndex = 0;
if (re.test(value))
return true;
}
return false;
};
}
function mergeObjects(a, b, c) {
const result = { ...a };
for (const x of [b, c].filter(Boolean)) {
for (const [name, value] of Object.entries(x)) {
if (!Object.is(value, void 0))
result[name] = value;
}
}
return result;
}
function forceRegExp(pattern) {
const match = pattern.match(/^\/(.*)\/([gi]*)$/);
if (match)
return new RegExp(match[1], match[2]);
return new RegExp(pattern, "gi");
}
function relativeFilePath(file) {
if (!import_path.default.isAbsolute(file))
return file;
return import_path.default.relative(process.cwd(), file);
}
function formatLocation(location) {
return relativeFilePath(location.file) + ":" + location.line + ":" + location.column;
}
function errorWithFile(file, message) {
return new Error(`${relativeFilePath(file)}: ${message}`);
}
function expectTypes(receiver, types, matcherName) {
if (typeof receiver !== "object" || !types.includes(receiver.constructor.name)) {
const commaSeparated = types.slice();
const lastType = commaSeparated.pop();
const typesString = commaSeparated.length ? commaSeparated.join(", ") + " or " + lastType : lastType;
throw new Error(`${matcherName} can be only used with ${typesString} object${types.length > 1 ? "s" : ""}`);
}
}
const windowsFilesystemFriendlyLength = 60;
function trimLongString(s, length = 100) {
if (s.length <= length)
return s;
const hash = (0, import_utils.calculateSha1)(s);
const middle = `-${hash.substring(0, 5)}-`;
const start = Math.floor((length - middle.length) / 2);
const end = length - middle.length - start;
return s.substring(0, start) + middle + s.slice(-end);
}
function addSuffixToFilePath(filePath, suffix) {
const ext = import_path.default.extname(filePath);
const base = filePath.substring(0, filePath.length - ext.length);
return base + suffix + ext;
}
function sanitizeFilePathBeforeExtension(filePath, ext) {
ext ??= import_path.default.extname(filePath);
const base = filePath.substring(0, filePath.length - ext.length);
return (0, import_utils.sanitizeForFilePath)(base) + ext;
}
function getContainedPath(parentPath, subPath = "") {
const resolvedPath = import_path.default.resolve(parentPath, subPath);
if (resolvedPath === parentPath || resolvedPath.startsWith(parentPath + import_path.default.sep))
return resolvedPath;
return null;
}
const debugTest = (0, import_utilsBundle.debug)("pw:test");
const callLogText = (log) => {
if (!log || !log.some((l) => !!l))
return "";
return `
Call log:
${import_utilsBundle.colors.dim(log.join("\n"))}
`;
};
const folderToPackageJsonPath = /* @__PURE__ */ new Map();
function getPackageJsonPath(folderPath) {
const cached = folderToPackageJsonPath.get(folderPath);
if (cached !== void 0)
return cached;
const packageJsonPath = import_path.default.join(folderPath, "package.json");
if (import_fs.default.existsSync(packageJsonPath)) {
folderToPackageJsonPath.set(folderPath, packageJsonPath);
return packageJsonPath;
}
const parentFolder = import_path.default.dirname(folderPath);
if (folderPath === parentFolder) {
folderToPackageJsonPath.set(folderPath, "");
return "";
}
const result = getPackageJsonPath(parentFolder);
folderToPackageJsonPath.set(folderPath, result);
return result;
}
function resolveReporterOutputPath(defaultValue, configDir, configValue) {
if (configValue)
return import_path.default.resolve(configDir, configValue);
let basePath = getPackageJsonPath(configDir);
basePath = basePath ? import_path.default.dirname(basePath) : process.cwd();
return import_path.default.resolve(basePath, defaultValue);
}
async function normalizeAndSaveAttachment(outputPath, name, options = {}) {
if (options.path === void 0 && options.body === void 0)
return { name, contentType: "text/plain" };
if ((options.path !== void 0 ? 1 : 0) + (options.body !== void 0 ? 1 : 0) !== 1)
throw new Error(`Exactly one of "path" and "body" must be specified`);
if (options.path !== void 0) {
const hash = (0, import_utils.calculateSha1)(options.path);
if (!(0, import_utils.isString)(name))
throw new Error('"name" should be string.');
const sanitizedNamePrefix = (0, import_utils.sanitizeForFilePath)(name) + "-";
const dest = import_path.default.join(outputPath, "attachments", sanitizedNamePrefix + hash + import_path.default.extname(options.path));
await import_fs.default.promises.mkdir(import_path.default.dirname(dest), { recursive: true });
await import_fs.default.promises.copyFile(options.path, dest);
const contentType = options.contentType ?? (import_utilsBundle.mime.getType(import_path.default.basename(options.path)) || "application/octet-stream");
return { name, contentType, path: dest };
} else {
const contentType = options.contentType ?? (typeof options.body === "string" ? "text/plain" : "application/octet-stream");
return { name, contentType, body: typeof options.body === "string" ? Buffer.from(options.body) : options.body };
}
}
function fileIsModule(file) {
if (file.endsWith(".mjs") || file.endsWith(".mts"))
return true;
if (file.endsWith(".cjs") || file.endsWith(".cts"))
return false;
const folder = import_path.default.dirname(file);
return folderIsModule(folder);
}
function folderIsModule(folder) {
const packageJsonPath = getPackageJsonPath(folder);
if (!packageJsonPath)
return false;
return require(packageJsonPath).type === "module";
}
const packageJsonMainFieldCache = /* @__PURE__ */ new Map();
function getMainFieldFromPackageJson(packageJsonPath) {
if (!packageJsonMainFieldCache.has(packageJsonPath)) {
let mainField;
try {
mainField = JSON.parse(import_fs.default.readFileSync(packageJsonPath, "utf8")).main;
} catch {
}
packageJsonMainFieldCache.set(packageJsonPath, mainField);
}
return packageJsonMainFieldCache.get(packageJsonPath);
}
const kExtLookups = /* @__PURE__ */ new Map([
[".js", [".jsx", ".ts", ".tsx"]],
[".jsx", [".tsx"]],
[".cjs", [".cts"]],
[".mjs", [".mts"]],
["", [".js", ".ts", ".jsx", ".tsx", ".cjs", ".mjs", ".cts", ".mts"]]
]);
function resolveImportSpecifierExtension(resolved) {
if (fileExists(resolved))
return resolved;
for (const [ext, others] of kExtLookups) {
if (!resolved.endsWith(ext))
continue;
for (const other of others) {
const modified = resolved.substring(0, resolved.length - ext.length) + other;
if (fileExists(modified))
return modified;
}
break;
}
}
function resolveImportSpecifierAfterMapping(resolved, afterPathMapping) {
const resolvedFile = resolveImportSpecifierExtension(resolved);
if (resolvedFile)
return resolvedFile;
if (dirExists(resolved)) {
const packageJsonPath = import_path.default.join(resolved, "package.json");
if (afterPathMapping) {
const mainField = getMainFieldFromPackageJson(packageJsonPath);
const mainFieldResolved = mainField ? resolveImportSpecifierExtension(import_path.default.resolve(resolved, mainField)) : void 0;
return mainFieldResolved || resolveImportSpecifierExtension(import_path.default.join(resolved, "index"));
}
if (fileExists(packageJsonPath))
return resolved;
const dirImport = import_path.default.join(resolved, "index");
return resolveImportSpecifierExtension(dirImport);
}
}
function fileExists(resolved) {
return import_fs.default.statSync(resolved, { throwIfNoEntry: false })?.isFile();
}
async function fileExistsAsync(resolved) {
try {
const stat = await import_fs.default.promises.stat(resolved);
return stat.isFile();
} catch {
return false;
}
}
function dirExists(resolved) {
return import_fs.default.statSync(resolved, { throwIfNoEntry: false })?.isDirectory();
}
async function removeDirAndLogToConsole(dir) {
try {
if (!import_fs.default.existsSync(dir))
return;
console.log(`Removing ${await import_fs.default.promises.realpath(dir)}`);
await import_fs.default.promises.rm(dir, { recursive: true, force: true });
} catch {
}
}
const ansiRegex = new RegExp("([\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~])))", "g");
function stripAnsiEscapes(str) {
return str.replace(ansiRegex, "");
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
addSuffixToFilePath,
ansiRegex,
callLogText,
createFileFiltersFromArguments,
createFileMatcher,
createFileMatcherFromArguments,
createTitleMatcher,
debugTest,
errorWithFile,
expectTypes,
fileExistsAsync,
fileIsModule,
filterStackFile,
filterStackTrace,
filteredStackTrace,
forceRegExp,
formatLocation,
getContainedPath,
getPackageJsonPath,
mergeObjects,
normalizeAndSaveAttachment,
relativeFilePath,
removeDirAndLogToConsole,
resolveImportSpecifierAfterMapping,
resolveReporterOutputPath,
sanitizeFilePathBeforeExtension,
serializeError,
stripAnsiEscapes,
trimLongString,
windowsFilesystemFriendlyLength
});
+43
View File
@@ -0,0 +1,43 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var utilsBundle_exports = {};
__export(utilsBundle_exports, {
chokidar: () => chokidar,
enquirer: () => enquirer,
getEastAsianWidth: () => getEastAsianWidth,
json5: () => json5,
sourceMapSupport: () => sourceMapSupport,
stoppable: () => stoppable
});
module.exports = __toCommonJS(utilsBundle_exports);
const json5 = require("./utilsBundleImpl").json5;
const sourceMapSupport = require("./utilsBundleImpl").sourceMapSupport;
const stoppable = require("./utilsBundleImpl").stoppable;
const enquirer = require("./utilsBundleImpl").enquirer;
const chokidar = require("./utilsBundleImpl").chokidar;
const getEastAsianWidth = require("./utilsBundleImpl").getEastAsianWidth;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
chokidar,
enquirer,
getEastAsianWidth,
json5,
sourceMapSupport,
stoppable
});
+100
View File
@@ -0,0 +1,100 @@
"use strict";var Pl=Object.create;var Wt=Object.defineProperty;var Il=Object.getOwnPropertyDescriptor;var kl=Object.getOwnPropertyNames;var Ml=Object.getPrototypeOf,$l=Object.prototype.hasOwnProperty;var y=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Qs=(t,e)=>{for(var r in e)Wt(t,r,{get:e[r],enumerable:!0})},Xs=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of kl(e))!$l.call(t,s)&&s!==r&&Wt(t,s,{get:()=>e[s],enumerable:!(i=Il(e,s))||i.enumerable});return t};var Et=(t,e,r)=>(r=t!=null?Pl(Ml(t)):{},Xs(e||!t||!t.__esModule?Wt(r,"default",{value:t,enumerable:!0}):r,t)),Hl=t=>Xs(Wt({},"__esModule",{value:!0}),t);var Zs=y((Cp,Ut)=>{Ut.exports.Space_Separator=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/;Ut.exports.ID_Start=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF2Line truncated
`?(He++,Fe=0):t?Fe+=t.length:Fe++,t&&(Vt+=t.length),t}var tn={default(){switch(I){case" ":case"\v":case"\f":case" ":case"\xA0":case"\uFEFF":case`
`:case"\r":case"\u2028":case"\u2029":C();return;case"/":C(),T="comment";return;case void 0:return C(),U("eof")}if(re.isSpaceSeparator(I)){C();return}return tn[fe]()},comment(){switch(I){case"*":C(),T="multiLineComment";return;case"/":C(),T="singleLineComment";return}throw z(C())},multiLineComment(){switch(I){case"*":C(),T="multiLineCommentAsterisk";return;case void 0:throw z(C())}C()},multiLineCommentAsterisk(){switch(I){case"*":C();return;case"/":C(),T="default";return;case void 0:throw z(C())}C(),T="multiLineComment"},singleLineComment(){switch(I){case`
`:case"\r":case"\u2028":case"\u2029":C(),T="default";return;case void 0:return C(),U("eof")}C()},value(){switch(I){case"{":case"[":return U("punctuator",C());case"n":return C(),Ve("ull"),U("null",null);case"t":return C(),Ve("rue"),U("boolean",!0);case"f":return C(),Ve("alse"),U("boolean",!1);case"-":case"+":C()==="-"&&(Le=-1),T="sign";return;case".":L=C(),T="decimalPointLeading";return;case"0":L=C(),T="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":L=C(),T="decimalInteger";return;case"I":return C(),Ve("nfinity"),U("numeric",1/0);case"N":return C(),Ve("aN"),U("numeric",NaN);case'"':case"'":Ct=C()==='"',L="",T="string";return}throw z(C())},identifierNameStartEscape(){if(I!=="u")throw z(C());C();let t=Pr();switch(t){case"$":case"_":break;default:if(!re.isIdStartChar(t))throw en();break}L+=t,T="identifierName"},identifierName(){switch(I){case"$":case"_":case"\u200C":case"\u200D":L+=C();return;case"\\":C(),T="identifierNameEscape";return}if(re.isIdContinueChar(I)){L+=C();return}return U("identifier",L)},identifierNameEscape(){if(I!=="u")throw z(C());C();let t=Pr();switch(t){case"$":case"_":case"\u200C":case"\u200D":break;default:if(!re.isIdContinueChar(t))throw en();break}L+=t,T="identifierName"},sign(){switch(I){case".":L=C(),T="decimalPointLeading";return;case"0":L=C(),T="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":L=C(),T="decimalInteger";return;case"I":return C(),Ve("nfinity"),U("numeric",Le*(1/0));case"N":return C(),Ve("aN"),U("numeric",NaN)}throw z(C())},zero(){switch(I){case".":L+=C(),T="decimalPoint";return;case"e":case"E":L+=C(),T="decimalExponent";return;case"x":case"X":L+=C(),T="hexadecimal";return}return U("numeric",Le*0)},decimalInteger(){switch(I){case".":L+=C(),T="decimalPoint";return;case"e":case"E":L+=C(),T="decimalExponent";return}if(re.isDigit(I)){L+=C();return}return U("numeric",Le*Number(L))},decimalPointLeading(){if(re.isDigit(I)){L+=C(),T="decimalFraction";return}throw z(C())},decimalPoint(){switch(I){case"e":case"E":L+=C(),T="decimalExponent";return}if(re.isDigit(I)){L+=C(),T="decimalFraction";return}return U("numeric",Le*Number(L))},decimalFraction(){switch(I){case"e":case"E":L+=C(),T="decimalExponent";return}if(re.isDigit(I)){L+=C();return}return U("numeric",Le*Number(L))},decimalExponent(){switch(I){case"+":case"-":L+=C(),T="decimalExponentSign";return}if(re.isDigit(I)){L+=C(),T="decimalExponentInteger";return}throw z(C())},decimalExponentSign(){if(re.isDigit(I)){L+=C(),T="decimalExponentInteger";return}throw z(C())},decimalExponentInteger(){if(re.isDigit(I)){L+=C();return}return U("numeric",Le*Number(L))},hexadecimal(){if(re.isHexDigit(I)){L+=C(),T="hexadecimalInteger";return}throw z(C())},hexadecimalInteger(){if(re.isHexDigit(I)){L+=C();return}return U("numeric",Le*Number(L))},string(){switch(I){case"\\":C(),L+=jl();return;case'"':if(Ct)return C(),U("string",L);L+=C();return;case"'":if(!Ct)return C(),U("string",L);L+=C();return;case`
`:case"\r":throw z(C());case"\u2028":case"\u2029":Ul(I);break;case void 0:throw z(C())}L+=C()},start(){switch(I){case"{":case"[":return U("punctuator",C())}T="value"},beforePropertyName(){switch(I){case"$":case"_":L=C(),T="identifierName";return;case"\\":C(),T="identifierNameStartEscape";return;case"}":return U("punctuator",C());case'"':case"'":Ct=C()==='"',T="string";return}if(re.isIdStartChar(I)){L+=C(),T="identifierName";return}throw z(C())},afterPropertyName(){if(I===":")return U("punctuator",C());throw z(C())},beforePropertyValue(){T="value"},afterPropertyValue(){switch(I){case",":case"}":return U("punctuator",C())}throw z(C())},beforeArrayValue(){if(I==="]")return U("punctuator",C());T="value"},afterArrayValue(){switch(I){case",":case"]":return U("punctuator",C())}throw z(C())},end(){throw z(C())}};function U(t,e){return{type:t,value:e,line:He,column:Fe}}function Ve(t){for(let e of t){if(Ne()!==e)throw z(C());C()}}function jl(){switch(Ne()){case"b":return C(),"\b";case"f":return C(),"\f";case"n":return C(),`
`;case"r":return C(),"\r";case"t":return C()," ";case"v":return C(),"\v";case"0":if(C(),re.isDigit(Ne()))throw z(C());return"\0";case"x":return C(),Gl();case"u":return C(),Pr();case`
`:case"\u2028":case"\u2029":return C(),"";case"\r":return C(),Ne()===`
`&&C(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw z(C());case void 0:throw z(C())}return C()}function Gl(){let t="",e=Ne();if(!re.isHexDigit(e)||(t+=C(),e=Ne(),!re.isHexDigit(e)))throw z(C());return t+=C(),String.fromCodePoint(parseInt(t,16))}function Pr(){let t="",e=4;for(;e-- >0;){let r=Ne();if(!re.isHexDigit(r))throw z(C());t+=C()}return String.fromCodePoint(parseInt(t,16))}var Wl={start(){if(ie.type==="eof")throw Ke();Lr()},beforePropertyName(){switch(ie.type){case"identifier":case"string":Ir=ie.value,fe="afterPropertyName";return;case"punctuator":zt();return;case"eof":throw Ke()}},afterPropertyName(){if(ie.type==="eof")throw Ke();fe="beforePropertyValue"},beforePropertyValue(){if(ie.type==="eof")throw Ke();Lr()},beforeArrayValue(){if(ie.type==="eof")throw Ke();if(ie.type==="punctuator"&&ie.value==="]"){zt();return}Lr()},afterPropertyValue(){if(ie.type==="eof")throw Ke();switch(ie.value){case",":fe="beforePropertyName";return;case"}":zt()}},afterArrayValue(){if(ie.type==="eof")throw Ke();switch(ie.value){case",":fe="beforeArrayValue";return;case"]":zt()}},end(){}};function Lr(){let t;switch(ie.type){case"punctuator":switch(ie.value){case"{":t={};break;case"[":t=[];break}break;case"null":case"boolean":case"numeric":case"string":t=ie.value;break}if(At===void 0)At=t;else{let e=Te[Te.length-1];Array.isArray(e)?e.push(t):Object.defineProperty(e,Ir,{value:t,writable:!0,enumerable:!0,configurable:!0})}if(t!==null&&typeof t=="object")Te.push(t),Array.isArray(t)?fe="beforeArrayValue":fe="beforePropertyName";else{let e=Te[Te.length-1];e==null?fe="end":Array.isArray(e)?fe="afterArrayValue":fe="afterPropertyValue"}}function zt(){Te.pop();let t=Te[Te.length-1];t==null?fe="end":Array.isArray(t)?fe="afterArrayValue":fe="afterPropertyValue"}function z(t){return Kt(t===void 0?`JSON5: invalid end of input at ${He}:${Fe}`:`JSON5: invalid character '${rn(t)}' at ${He}:${Fe}`)}function Ke(){return Kt(`JSON5: invalid end of input at ${He}:${Fe}`)}function en(){return Fe-=5,Kt(`JSON5: invalid identifier character at ${He}:${Fe}`)}function Ul(t){console.warn(`JSON5: '${rn(t)}' in strings is not valid ECMAScript; consider escaping`)}function rn(t){let e={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(e[t])return e[t];if(t<" "){let r=t.charCodeAt(0).toString(16);return"\\x"+("00"+r).substring(r.length)}return t}function Kt(t){let e=new SyntaxError(t);return e.lineNumber=He,e.columnNumber=Fe,e}});var on=y((Fp,un)=>{var kr=Or();un.exports=function(e,r,i){let s=[],n="",u,o,a="",l;if(r!=null&&typeof r=="object"&&!Array.isArray(r)&&(i=r.space,l=r.quote,r=r.replacer),typeof r=="function")o=r;else if(Array.isArray(r)){u=[];for(let d of r){let v;typeof d=="string"?v=d:(typeof d=="number"||d instanceof String||d instanceof Number)&&(v=String(d)),v!==void 0&&u.indexOf(v)<0&&u.push(v)}}return i instanceof Number?i=Number(i):i instanceof String&&(i=String(i)),typeof i=="number"?i>0&&(i=Math.min(10,Math.floor(i)),a=" ".substr(0,i)):typeof i=="string"&&(a=i.substr(0,10)),c("",{"":e});function c(d,v){let g=v[d];switch(g!=null&&(typeof g.toJSON5=="function"?g=g.toJSON5(d):typeof g.toJSON=="function"&&(g=g.toJSON(d))),o&&(g=o.call(v,d,g)),g instanceof Number?g=Number(g):g instanceof String?g=String(g):g instanceof Boolean&&(g=g.valueOf()),g){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof g=="string")return h(g,!1);if(typeof g=="number")return String(g);if(typeof g=="object")return Array.isArray(g)?D(g):f(g)}function h(d){let v={"'":.1,'"':.2},g={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"},w="";for(let B=0;B<d.length;B++){let O=d[B];switch(O){case"'":case'"':v[O]++,w+=O;continue;case"\0":if(kr.isDigit(d[B+1])){w+="\\x00";continue}}if(g[O]){w+=g[O];continue}if(O<" "){let q=O.charCodeAt(0).toString(16);w+="\\x"+("00"+q).substring(q.length);continue}w+=O}let F=l||Object.keys(v).reduce((B,O)=>v[B]<v[O]?B:O);return w=w.replace(new RegExp(F,"g"),g[F]),F+w+F}function f(d){if(s.indexOf(d)>=0)throw TypeError("Converting circular structure to JSON5");s.push(d);let v=n;n=n+a;let g=u||Object.keys(d),w=[];for(let B of g){let O=c(B,d);if(O!==void 0){let q=p(B)+":";a!==""&&(q+=" "),q+=O,w.push(q)}}let F;if(w.length===0)F="{}";else{let B;if(a==="")B=w.join(","),F="{"+B+"}";else{let O=`,
`+n;B=w.join(O),F=`{
`+n+B+`,
`+v+"}"}}return s.pop(),n=v,F}function p(d){if(d.length===0)return h(d,!0);let v=String.fromCodePoint(d.codePointAt(0));if(!kr.isIdStartChar(v))return h(d,!0);for(let g=v.length;g<d.length;g++)if(!kr.isIdContinueChar(String.fromCodePoint(d.codePointAt(g))))return h(d,!0);return d}function D(d){if(s.indexOf(d)>=0)throw TypeError("Converting circular structure to JSON5");s.push(d);let v=n;n=n+a;let g=[];for(let F=0;F<d.length;F++){let B=c(String(F),d);g.push(B!==void 0?B:"null")}let w;if(g.length===0)w="[]";else if(a==="")w="["+g.join(",")+"]";else{let F=`,
`+n,B=g.join(F);w=`[
`+n+B+`,
`+v+"]"}return s.pop(),n=v,w}}});var ln=y((wp,an)=>{var zl=nn(),Vl=on(),Kl={parse:zl,stringify:Vl};an.exports=Kl});var hn=y(Mr=>{var cn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");Mr.encode=function(t){if(0<=t&&t<cn.length)return cn[t];throw new TypeError("Must be between 0 and 63: "+t)};Mr.decode=function(t){var e=65,r=90,i=97,s=122,n=48,u=57,o=43,a=47,l=26,c=52;return e<=t&&t<=r?t-e:i<=t&&t<=s?t-i+l:n<=t&&t<=u?t-n+c:t==o?62:t==a?63:-1}});var qr=y(Hr=>{var fn=hn(),$r=5,dn=1<<$r,pn=dn-1,Dn=dn;function Yl(t){return t<0?(-t<<1)+1:(t<<1)+0}function Ql(t){var e=(t&1)===1,r=t>>1;return e?-r:r}Hr.encode=function(e){var r="",i,s=Yl(e);do i=s&pn,s>>>=$r,s>0&&(i|=Dn),r+=fn.encode(i);while(s>0);return r};Hr.decode=function(e,r,i){var s=e.length,n=0,u=0,o,a;do{if(r>=s)throw new Error("Expected more digits in base 64 VLQ value.");if(a=fn.decode(e.charCodeAt(r++)),a===-1)throw new Error("Invalid base64 digit: "+e.charAt(r-1));o=!!(a&Dn),a&=pn,n=n+(a<<u),u+=$r}while(o);i.value=Ql(n),i.rest=r}});var ot=y(ae=>{function Xl(t,e,r){if(e in t)return t[e];if(arguments.length===3)return r;throw new Error('"'+e+'" is a required argument.')}ae.getArg=Xl;var gn=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,Zl=/^data:.+\,.+$/;function yt(t){var e=t.match(gn);return e?{scheme:e[1],auth:e[2],host:e[3],port:e[4],path:e[5]}:null}ae.urlParse=yt;function nt(t){var e="";return t.scheme&&(e+=t.scheme+":"),e+="//",t.auth&&(e+=t.auth+"@"),t.host&&(e+=t.host),t.port&&(e+=":"+t.port),t.path&&(e+=t.path),e}ae.urlGenerate=nt;function jr(t){var e=t,r=yt(t);if(r){if(!r.path)return t;e=r.path}for(var i=ae.isAbsolute(e),s=e.split(/\/+/),n,u=0,o=s.length-1;o>=0;o--)n=s[o],n==="."?s.splice(o,1):n===".."?u++:u>0&&(n===""?(s.splice(o+1,u),u=0):(s.splice(o,2),u--));return e=s.join("/"),e===""&&(e=i?"/":"."),r?(r.path=e,nt(r)):e}ae.normalize=jr;function mn(t,e){t===""&&(t="."),e===""&&(e=".");var r=yt(e),i=yt(t);if(i&&(t=i.path||"/"),r&&!r.scheme)return i&&(r.scheme=i.scheme),nt(r);if(r||e.match(Zl))return e;if(i&&!i.host&&!i.path)return i.host=e,nt(i);var s=e.charAt(0)==="/"?e:jr(t.replace(/\/+$/,"")+"/"+e);return i?(i.path=s,nt(i)):s}ae.join=mn;ae.isAbsolute=function(t){return t.charAt(0)==="/"||gn.test(t)};function Jl(t,e){t===""&&(t="."),t=t.replace(/\/$/,"");for(var r=0;e.indexOf(t+"/")!==0;){var i=t.lastIndexOf("/");if(i<0||(t=t.slice(0,i),t.match(/^([^\/]+:\/)?\/*$/)))return e;++r}return Array(r+1).join("../")+e.substr(t.length+1)}ae.relative=Jl;var En=function(){var t=Object.create(null);return!("__proto__"in t)}();function Cn(t){return t}function ec(t){return An(t)?"$"+t:t}ae.toSetString=En?Cn:ec;function tc(t){return An(t)?t.slice(1):t}ae.fromSetString=En?Cn:tc;function An(t){if(!t)return!1;var e=t.length;if(e<9||t.charCodeAt(e-1)!==95||t.charCodeAt(e-2)!==95||t.charCodeAt(e-3)!==111||t.charCodeAt(e-4)!==116||t.charCodeAt(e-5)!==111||t.charCodeAt(e-6)!==114||t.charCodeAt(e-7)!==112||t.charCodeAt(e-8)!==95||t.charCodeAt(e-9)!==95)return!1;for(var r=e-10;r>=0;r--)if(t.charCodeAt(r)!==36)return!1;return!0}function rc(t,e,r){var i=ut(t.source,e.source);return i!==0||(i=t.originalLine-e.originalLine,i!==0)||(i=t.originalColumn-e.originalColumn,i!==0||r)||(i=t.generatedColumn-e.generatedColumn,i!==0)||(i=t.generatedLine-e.generatedLine,i!==0)?i:ut(t.name,e.name)}ae.compareByOriginalPositions=rc;function ic(t,e,r){var i=t.generatedLine-e.generatedLine;return i!==0||(i=t.generatedColumn-e.generatedColumn,i!==0||r)||(i=ut(t.source,e.source),i!==0)||(i=t.originalLine-e.originalLine,i!==0)||(i=t.originalColumn-e.originalColumn,i!==0)?i:ut(t.name,e.name)}ae.compareByGeneratedPositionsDeflated=ic;function ut(t,e){return t===e?0:t===null?1:e===null?-1:t>e?1:-1}function sc(t,e){var r=t.generatedLine-e.generatedLine;return r!==0||(r=t.generatedColumn-e.generatedColumn,r!==0)||(r=ut(t.source,e.source),r!==0)||(r=t.originalLine-e.originalLine,r!==0)||(r=t.originalColumn-e.originalColumn,r!==0)?r:ut(t.name,e.name)}ae.compareByGeneratedPositionsInflated=sc;function nc(t){return JSON.parse(t.replace(/^\)]}'[^\n]*\n/,""))}ae.parseSourceMapInput=nc;function uc(t,e,r){if(e=e||"",t&&(t[t.length-1]!=="/"&&e[0]!=="/"&&(t+="/"),e=t+e),r){var i=yt(r);if(!i)throw new Error("sourceMapURL could not be parsed");if(i.path){var s=i.path.lastIndexOf("/");s>=0&&(i.path=i.path.substring(0,s+1))}e=mn(nt(i),e)}return jr(e)}ae.computeSourceURL=uc});var Ur=y(yn=>{var Gr=ot(),Wr=Object.prototype.hasOwnProperty,Ye=typeof Map!="undefined";function Pe(){this._array=[],this._set=Ye?new Map:Object.create(null)}Pe.fromArray=function(e,r){for(var i=new Pe,s=0,n=e.length;s<n;s++)i.add(e[s],r);return i};Pe.prototype.size=function(){return Ye?this._set.size:Object.getOwnPropertyNames(this._set).length};Pe.prototype.add=function(e,r){var i=Ye?e:Gr.toSetString(e),s=Ye?this.has(e):Wr.call(this._set,i),n=this._array.length;(!s||r)&&this._array.push(e),s||(Ye?this._set.set(e,n):this._set[i]=n)};Pe.prototype.has=function(e){if(Ye)return this._set.has(e Line truncated
at `+qn(e[o],n)),n.nextPosition=n.curPosition;return n.curPosition=n.nextPosition=null,s+u.reverse().join("")}function jn(t){var e=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(t.stack);if(e){var r=e[1],i=+e[2],s=+e[3],n=Xe[r];if(!n&&Re&&Re.existsSync(r))try{n=Re.readFileSync(r,"utf8")}catch{n=""}if(n){var u=n.split(/(?:\r\n|\r|\n)/)[i-1];if(u)return r+":"+i+`
`+u+`
`+new Array(s).join(" ")+"^"}}return null}function Bc(t){var e=jn(t),r=_c();r&&r._handle&&r._handle.setBlocking&&r._handle.setBlocking(!0),e&&(console.error(),console.error(e)),console.error(t.stack),bc(1)}function Rc(){var t=process.emit;process.emit=function(e){if(e==="uncaughtException"){var r=arguments[1]&&arguments[1].stack,i=this.listeners(e).length>0;if(r&&!i)return Bc(arguments[1])}return t.apply(this,arguments)}}var Oc=qe.slice(0),Lc=je.slice(0);Ze.wrapCallSite=qn;Ze.getErrorSource=jn;Ze.mapSourcePosition=ni;Ze.retrieveSourceMap=si;Ze.install=function(t){if(t=t||{},t.environment&&(_t=t.environment,["node","browser","auto"].indexOf(_t)===-1))throw new Error("environment "+_t+" was unknown. Available options are {auto, browser, node}");if(t.retrieveFile&&(t.overrideRetrieveFile&&(qe.length=0),qe.unshift(t.retrieveFile)),t.retrieveSourceMap&&(t.overrideRetrieveSourceMap&&(je.length=0),je.unshift(t.retrieveSourceMap)),t.hookRequire&&!ri()){var e=In(ti,"module"),r=e.prototype._compile;r.__sourceMapSupport||(e.prototype._compile=function(n,u){return Xe[u]=n,bt[u]=void 0,r.call(this,n,u)},e.prototype._compile.__sourceMapSupport=!0)}if(Jr||(Jr="emptyCacheBetweenOperations"in t?t.emptyCacheBetweenOperations:!1),kn||(kn=!0,Error.prepareStackTrace=Sc),!Mn){var i="handleUncaughtExceptions"in t?t.handleUncaughtExceptions:!0;try{var s=In(ti,"worker_threads");s.isMainThread===!1&&(i=!1)}catch{}i&&Fc()&&(Mn=!0,Rc())}};Ze.resetRetrieveHandlers=function(){qe.length=0,je.length=0,qe=Oc.slice(0),je=Lc.slice(0),si=er(je),ii=er(qe)}});var Un=y((Ip,Wn)=>{"use strict";var Tc=require("https");Wn.exports=(t,e)=>{e=typeof e=="undefined"?1/0:e;let r=new Map,i=!1,s=!0;return t instanceof Tc.Server?t.on("secureConnection",n):t.on("connection",n),t.on("request",u),t.stop=o,t._pendingSockets=r,t;function n(c){r.set(c,0),c.once("close",()=>r.delete(c))}function u(c,h){r.set(c.socket,r.get(c.socket)+1),h.once("finish",()=>{let f=r.get(c.socket)-1;r.set(c.socket,f),i&&f===0&&c.socket.end()})}function o(c){setImmediate(()=>{i=!0,e<1/0&&setTimeout(l,e).unref(),t.close(h=>{c&&c(h,s)}),r.forEach(a)})}function a(c,h){c===0&&h.end()}function l(){s=!1,r.forEach((c,h)=>h.end()),setImmediate(()=>{r.forEach((c,h)=>h.destroy())})}}});var Yn=y((kp,vt)=>{"use strict";var Nc=typeof process!="undefined"&&process.env.TERM_PROGRAM==="Hyper",Pc=typeof process!="undefined"&&process.platform==="win32",zn=typeof process!="undefined"&&process.platform==="linux",ui={ballotDisabled:"\u2612",ballotOff:"\u2610",ballotOn:"\u2611",bullet:"\u2022",bulletWhite:"\u25E6",fullBlock:"\u2588",heart:"\u2764",identicalTo:"\u2261",line:"\u2500",mark:"\u203B",middot:"\xB7",minus:"\uFF0D",multiplication:"\xD7",obelus:"\xF7",pencilDownRight:"\u270E",pencilRight:"\u270F",pencilUpRight:"\u2710",percent:"%",pilcrow2:"\u2761",pilcrow:"\xB6",plusMinus:"\xB1",question:"?",section:"\xA7",starsOff:"\u2606",starsOn:"\u2605",upDownArrow:"\u2195"},Vn=Object.assign({},ui,{check:"\u221A",cross:"\xD7",ellipsisLarge:"...",ellipsis:"...",info:"i",questionSmall:"?",pointer:">",pointerSmall:"\xBB",radioOff:"( )",radioOn:"(*)",warning:"\u203C"}),Kn=Object.assign({},ui,{ballotCross:"\u2718",check:"\u2714",cross:"\u2716",ellipsisLarge:"\u22EF",ellipsis:"\u2026",info:"\u2139",questionFull:"\uFF1F",questionSmall:"\uFE56",pointer:zn?"\u25B8":"\u276F",pointerSmall:zn?"\u2023":"\u203A",radioOff:"\u25EF",radioOn:"\u25C9",warning:"\u26A0"});vt.exports=Pc&&!Nc?Vn:Kn;Reflect.defineProperty(vt.exports,"common",{enumerable:!1,value:ui});Reflect.defineProperty(vt.exports,"windows",{enumerable:!1,value:Vn});Reflect.defineProperty(vt.exports,"other",{enumerable:!1,value:Kn})});var _e=y((Mp,oi)=>{"use strict";var Ic=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),kc=/[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g,Mc=()=>typeof process!="undefined"?process.env.FORCE_COLOR!=="0":!1,Qn=()=>{let t={enabled:Mc(),visible:!0,styles:{},keys:{}},e=n=>{let u=n.open=`\x1B[${n.codes[0]}m`,o=n.close=`\x1B[${n.codes[1]}m`,a=n.regex=new RegExp(`\\u001b\\[${n.codes[1]}m`,"g");return n.wrap=(l,c)=>{l.includes(o)&&(l=l.replace(a,o+u));let h=u+l+o;return c?h.replace(/\r*\n/g,`${o}$&${u}`):h},n},r=(n,u,o)=>typeof n=="function"?n(u):n.wrap(u,o),i=(n,u)=>{if(n===""||n==null)return"";if(t.enabled===!1)return n;if(t.visible===!1)return"";let o=""+n,a=o.includes(`
`),l=u.length;for(l>0&&u.includes("unstyle")&&(u=[...new Set(["unstyle",...u])].reverse());l-- >0;)o=r(t.styles[u[l]],o,a);return o},s=(n,u,o)=>{t.styles[n]=e({name:n,codes:u}),(t.keys[o]||(t.keys[o]=[])).push(n),Reflect.defineProperty(t,n,{configurable:!0,enumerable:!0,set(l){t.alias(n,l)},get(){let l=c=>i(c,l.stack);return Reflect.setPrototypeOf(l,t),l.stack=this.stack?this.stack.concat(n):[n],l}})};return s("reset",[0,0],"modifier"),s("bold",[1,22],"modifier"),s("dim",[2,22],"modifier"),s("italic",[3,23],"modifier"),s("underline",[4,24],"modifier"),s("inverse",[7,27],"modifier"),s("hidden",[8,28],"modifier"),s("strikethrough",[9,29],"modifier"),s("black",[30,39],"color"),s("red",[31,39],"color"),s("green",[32,39],"color"),s("yellow",[33,39],"color"),s("blue",[34,39],"color"),s("magenta",[35,39],"color"),s("cyan",[36,39],"color"),s("white",[37,39],"color"),s("gray",[90,39],"color"),s("grey",[90,39],"color"),s("bgBlack",[40,49],"bg"),s("bgRed",[41,49],"bg"),s("bgGreen",[42,49],"bg"),s("bgYellow",[43,49],"bg"),s("bgBlue",[44,49],"bg"),s("bgMagenta",[45,49],"bg"),s("bgCyan",[46,49],"bg"),s("bgWhite",[47,49],"bg"),s("blackBright",[90,39],"bright"),s("redBright",[91,39],"bright"),s("greenBright",[92,39],"bright"),s("yellowBright",[93,39],"bright"),s("blueBright",[94,39],"bright"),s("magentaBright",[95,39],"bright"),s("cyanBright",[96,39],"bright"),s("whiteBright",[97,39],"bright"),s("bgBlackBright",[100,49],"bgBright"),s("bgRedBright",[101,49],"bgBright"),s("bgGreenBright",[102,49],"bgBright"),s("bgYellowBright",[103,49],"bgBright"),s("bgBlueBright",[104,49],"bgBright"),s("bgMagentaBright",[105,49],"bgBright"),s("bgCyanBright",[106,49],"bgBright"),s("bgWhiteBright",[107,49],"bgBright"),t.ansiRegex=kc,t.hasColor=t.hasAnsi=n=>(t.ansiRegex.lastIndex=0,typeof n=="string"&&n!==""&&t.ansiRegex.test(n)),t.alias=(n,u)=>{let o=typeof u=="string"?t[u]:u;if(typeof o!="function")throw new TypeError("Expected alias to be the name of an existing color (string) or a function");o.stack||(Reflect.defineProperty(o,"name",{value:n}),t.styles[n]=o,o.stack=[n]),Reflect.defineProperty(t,n,{configurable:!0,enumerable:!0,set(a){t.alias(n,a)},get(){let a=l=>i(l,a.stack);return Reflect.setPrototypeOf(a,t),a.stack=this.stack?this.stack.concat(o.stack):o.stack,a}})},t.theme=n=>{if(!Ic(n))throw new TypeError("Expected theme to be an object");for(let u of Object.keys(n))t.alias(u,n[u]);return t},t.alias("unstyle",n=>typeof n=="string"&&n!==""?(t.ansiRegex.lastIndex=0,n.replace(t.ansiRegex,"")):""),t.alias("noop",n=>n),t.none=t.clear=t.noop,t.stripColor=t.unstyle,t.symbols=Yn(),t.define=s,t};oi.exports=Qn();oi.exports.create=Qn});var le=y(k=>{"use strict";var $c=Object.prototype.toString,Ae=_e(),Xn=!1,ai=[],Zn={yellow:"blue",cyan:"red",green:"magenta",black:"white",blue:"yellow",red:"cyan",magenta:"green",white:"black"};k.longest=(t,e)=>t.reduce((r,i)=>Math.max(r,e?i[e].length:i.length),0);k.hasColor=t=>!!t&&Ae.hasColor(t);var tr=k.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);k.nativeType=t=>$c.call(t).slice(8,-1).toLowerCase().replace(/\s/g,"");k.isAsyncFn=t=>k.nativeType(t)==="asyncfunction";k.isPrimitive=t=>t!=null&&typeof t!="object"&&typeof t!="function";k.resolve=(t,e,...r)=>typeof e=="function"?e.call(t,...r):e;k.scrollDown=(t=[])=>[...t.slice(1),t[0]];k.scrollUp=(t=[])=>[t.pop(),...t];k.reorder=(t=[])=>{let e=t.slice();return e.sort((r,i)=>r.index>i.index?1:r.index<i.index?-1:0),e};k.swap=(t,e,r)=>{let i=t.length,s=r===i?0:r<0?i-1:r,n=t[e];t[e]=t[s],t[s]=n};k.width=(t,e=80)=>{let r=t&&t.columns?t.columns:e;return t&&typeof t.getWindowSize=="function"&&(r=t.getWindowSize()[0]),process.platform==="win32"?r-1:r};k.height=(t,e=20)=>{let r=t&&t.rows?t.rows:e;return t&&typeof t.getWindowSize=="function"&&(r=t.getWindowSize()[1]),r};k.wordWrap=(t,e={})=>{if(!t)return t;typeof e=="number"&&(e={width:e});let{indent:r="",newline:i=`
`+r,width:s=80}=e,n=(i+r).match(/[^\S\n]/g)||[];s-=n.length;let u=`.{1,${s}}([\\s\\u200B]+|$)|[^\\s\\u200B]+?([\\s\\u200B]+|$)`,o=t.trim(),a=new RegExp(u,"g"),l=o.match(a)||[];return l=l.map(c=>c.replace(/\n$/,"")),e.padEnd&&(l=l.map(c=>c.padEnd(s," "))),e.padStart&&(l=l.map(c=>c.padStart(s," "))),r+l.join(i)};k.unmute=t=>{let e=t.stack.find(i=>Ae.keys.color.includes(i));return e?Ae[e]:t.stack.find(i=>i.slice(2)==="bg")?Ae[e.slice(2)]:i=>i};k.pascal=t=>t?t[0].toUpperCase()+t.slice(1):"";k.inverse=t=>{if(!t||!t.stack)return t;let e=t.stack.find(i=>Ae.keys.color.includes(i));if(e){let i=Ae["bg"+k.pascal(e)];return i?i.black:t}let r=t.stack.find(i=>i.slice(0,2)==="bg");return r?Ae[r.slice(2).toLowerCase()]||t:Ae.none};k.complement=t=>{if(!t||!t.stack)return t;let e=t.stack.find(i=>Ae.keys.color.includes(i)),r=t.stack.find(i=>i.slice(0,2)==="bg");if(e&&!r)return Ae[Zn[e]||e];if(r){let i=r.slice(2).toLowerCase(),s=Zn[i];return s&&Ae["bg"+k.pascal(s)]||t}return Ae.none};k.meridiem=t=>{let e=t.getHours(),r=t.getMinutes(),i=e>=12?"pm":"am";e=e%12;let s=e===0?12:e,n=r<10?"0"+r:r;return s+":"+n+" "+i};k.set=(t={},e="",r)=>e.split(".").reduce((i,s,n,u)=>{let o=u.length-1>n?i[s]||{}:r;return!k.isObject(o)&&n<u.length-1&&(o={}),i[s]=o},t);k.get=(t={},e="",r)=>{let i=t[e]==null?e.split(".").reduce((s,n)=>s&&s[n],t):t[e];return i==null?r:i};k.mixin=(t,e)=>{if(!tr(t))return e;if(!tr(e))return t;for(let r of Object.keys(e)){let i=Object.getOwnPropertyDescriptor(e,r);if(i.hasOwnProperty("value"))if(t.hasOwnProperty(r)&&tr(i.value)){let s=Object.getOwnPropertyDescriptor(t,r);tr(s.value)?t[r]=k.merge({},t[r],e[r]):Reflect.defineProperty(t,r,i)}else Reflect.defineProperty(t,r,i);else Reflect.defineProperty(t,r,i)}return t};k.merge=(...t)=>{let e={};for(let r of t)k.mixin(e,r);return e};k.mixinEmitter=(t,e)=>{let r=e.constructor.prototype;for(let i of Object.keys(r)){let s=r[i];typeof s=="function"?k.define(t,i,s.bind(e)):k.define(t,i,s)}};k.onExit=t=>{let e=(r,i)=>{Xn||(Xn=!0,ai.forEach(s=>s()),r===!0&&process.exit(128+i))};ai.length===0&&(process.once("SIGTERM",e.bind(null,!0,15)),process.once("SIGINT",e.bind(null,!0,2)),process.once("exit",e)),ai.push(t)};k.define=(t,e,r)=>{Reflect.defineProperty(t,e,{value:r})};k.defineExport=(t,e,r)=>{let i;Reflect.defineProperty(t,e,{enumerable:!0,configurable:!0,set(s){i=s},get(){return i?i():r()}})}});var Jn=y(ct=>{"use strict";ct.ctrl={a:"first",b:"backward",c:"cancel",d:"deleteForward",e:"last",f:"forward",g:"reset",i:"tab",k:"cutForward",l:"reset",n:"newItem",m:"cancel",j:"submit",p:"search",r:"remove",s:"save",u:"undo",w:"cutLeft",x:"toggleCursor",v:"paste"};ct.shift={up:"shiftUp",down:"shiftDown",left:"shiftLeft",right:"shiftRight",tab:"prev"};ct.fn={up:"pageUp",down:"pageDown",left:"pageLeft",right:"pageRight",delete:"deleteForward"};ct.option={b:"backward",f:"forward",d:"cutRight",left:"cutLeft",up:"altUp",down:"altDown"};ct.keys={pageup:"pageUp",pagedown:"pageDown",home:"home",end:"end",cancel:"cancel",delete:"deleteForward",backspace:"delete",down:"down",enter:"submit",escape:"cancel",left:"left",space:"space",number:"number",return:"submit",right:"right",tab:"next",up:"up"}});var ru=y((qp,tu)=>{"use strict";var eu=require("readline"),Hc=Jn(),qc=/^(?:\x1b)([a-zA-Z0-9])$/,jc=/^(?:\x1b+)(O|N|\[|\[\[)(?:(\d+)(?:;(\d+))?([~^$])|(?:1;)?(\d+)?([a-zA-Z]))/,Gc={OP:"f1",OQ:"f2",OR:"f3",OS:"f4","[11~":"f1","[12~":"f2","[13~":"f3","[14~":"f4","[[A":"f1","[[B":"f2","[[C":"f3","[[D":"f4","[[E":"f5","[15~":"f5","[17~":"f6","[18~":"f7","[19~":"f8","[20~":"f9","[21~":"f10","[23~":"f11","[24~":"f12","[A":"up","[B":"down","[C":"right","[D":"left","[E":"clear","[F":"end","[H":"home",OA:"up",OB:"down",OC:"right",OD:"left",OE:"clear",OF:"end",OH:"home","[1~":"home","[2~":"insert","[3~":"delete","[4~":"end","[5~":"pageup","[6~":"pagedown","[[5~":"pageup","[[6~":"pagedown","[7~":"home","[8~":"end","[a":"up","[b":"down","[c":"right","[d":"left","[e":"clear","[2$":"insert","[3$":"delete","[5$":"pageup","[6$":"pagedown","[7$":"home","[8$":"end",Oa:"up",Ob:"down",Oc:"right",Od:"left",Oe:"clear","[2^":"insert","[3^":"delete","[5^":"pageup","[6^":"pagedown","[7^":"home","[8^":"end","[Z":"tab"};function Wc(t){return["[a","[b","[c","[d","[e","[2$","[3$","[5$","[6$","[7$","[8$","[Z"].includes(t)}function Uc(t){return["Oa","Ob","Oc","Od","Oe","[2^","[3^","[5^","[6^","[7^","[8^"].includes(t)}var rr=(t="",e={})=>{let r,i={name:e.name,ctrl:!1,meta:!1,shift:!1,option:!1,sequence:t,raw:t,...e};if(Buffer.isBuffer(t)?t[0]>127&&t[1]===void 0?(t[0]-=128,t="\x1B"+String(t)):t=String(t):t!==void 0&&typeof t!="string"?t=String(t):t||(t=i.sequence||""),i.sequence=i.sequence||t||i.name,t==="\r")i.raw=void 0,i.name="return";else if(t===`
`)i.name="enter";else if(t===" ")i.name="tab";else if(t==="\b"||t==="\x7F"||t==="\x1B\x7F"||t==="\x1B\b")i.name="backspace",i.meta=t.charAt(0)==="\x1B";else if(t==="\x1B"||t==="\x1B\x1B")i.name="escape",i.meta=t.length===2;else if(t===" "||t==="\x1B ")i.name="space",i.meta=t.length===2;else if(t<="")i.name=String.fromCharCode(t.charCodeAt(0)+97-1),i.ctrl=!0;else if(t.length===1&&t>="0"&&t<="9")i.name="number";else if(t.length===1&&t>="a"&&t<="z")i.name=t;else if(t.length===1&&t>="A"&&t<="Z")i.name=t.toLowerCase(),i.shift=!0;else if(r=qc.exec(t))i.meta=!0,i.shift=/^[A-Z]$/.test(r[1]);else if(r=jc.exec(t)){let s=[...t];s[0]==="\x1B"&&s[1]==="\x1B"&&(i.option=!0);let n=[r[1],r[2],r[4],r[6]].filter(Boolean).join(""),u=(r[3]||r[5]||1)-1;i.ctrl=!!(u&4),i.meta=!!(u&10),i.shift=!!(u&1),i.code=n,i.name=Gc[n],i.shift=Wc(n)||i.shift,i.ctrl=Uc(n)||i.ctrl}return i};rr.listen=(t={},e)=>{let{stdin:r}=t;if(!r||r!==process.stdin&&!r.isTTY)throw new Error("Invalid stream passed");let i=eu.createInterface({terminal:!0,input:r});eu.emitKeypressEvents(r,i);let s=(o,a)=>e(o,rr(o,a),i),n=r.isRaw;return r.isTTY&&r.setRawMode(!0),r.on("keypress",s),i.resume(),()=>{r.isTTY&&r.setRawMode(n),r.removeListener("keypress",s),i.pause(),i.close()}};rr.action=(t,e,r)=>{let i={...Hc,...r};return e.ctrl?(e.action=i.ctrl[e.name],e):e.option&&i.option?(e.action=i.option[e.name],e):e.shift?(e.action=i.shift[e.name],e):(e.action=i.keys[e.name],e)};tu.exports=rr});var su=y((jp,iu)=>{"use strict";iu.exports=t=>{t.timers=t.timers||{};let e=t.options.timers;if(e)for(let r of Object.keys(e)){let i=e[r];typeof i=="number"&&(i={interval:i}),zc(t,r,i)}};function zc(t,e,r={}){let i=t.timers[e]={name:e,start:Date.now(),ms:0,tick:0},s=r.interval||120;i.frames=r.frames||[],i.loading=!0;let n=setInterval(()=>{i.ms=Date.now()-i.start,i.tick++,t.render()},s);return i.stop=()=>{i.loading=!1,clearInterval(n)},Reflect.defineProperty(i,"interval",{value:n}),t.once("close",()=>i.stop()),i.stop}});var uu=y((Gp,nu)=>{"use strict";var{define:Vc,width:Kc}=le(),li=class{constructor(e){let r=e.options;Vc(this,"_prompt",e),this.type=e.type,this.name=e.name,this.message="",this.header="",this.footer="",this.error="",this.hint="",this.input="",this.cursor=0,this.index=0,this.lines=0,this.tick=0,this.prompt="",this.buffer="",this.width=Kc(r.stdout||process.stdout),Object.assign(this,r),this.name=this.name||this.message,this.message=this.message||this.name,this.symbols=e.symbols,this.styles=e.styles,this.required=new Set,this.cancelled=!1,this.submitted=!1}clone(){let e={...this};return e.status=this.status,e.buffer=Buffer.from(e.buffer),delete e.clone,e}set color(e){this._color=e}get color(){let e=this.prompt.styles;if(this.cancelled)return e.cancelled;if(this.submitted)return e.submitted;let r=this._color||e[this.status];return typeof r=="function"?r:e.pending}set loading(e){this._loading=e}get loading(){return typeof this._loading=="boolean"?this._loading:this.loadingChoices?"choices":!1}get status(){return this.cancelled?"cancelled":this.submitted?"submitted":"pending"}};nu.exports=li});var au=y((Wp,ou)=>{"use strict";var ci=le(),oe=_e(),hi={default:oe.noop,noop:oe.noop,set inverse(t){this._inverse=t},get inverse(){return this._inverse||ci.inverse(this.primary)},set complement(t){this._complement=t},get complement(){return this._complement||ci.complement(this.primary)},primary:oe.cyan,success:oe.green,danger:oe.magenta,strong:oe.bold,warning:oe.yellow,muted:oe.dim,disabled:oe.gray,dark:oe.dim.gray,underline:oe.underline,set info(t){this._info=t},get info(){return this._info||this.primary},set em(t){this._em=t},get em(){return this._em||this.primary.underline},set heading(t){this._heading=t},get heading(){return this._heading||this.muted.underline},set pending(t){this._pending=t},get pending(){return this._pending||this.primary},set submitted(t){this._submitted=t},get submitted(){return this._submitted||this.success},set cancelled(t){this._cancelled=t},get cancelled(){return this._cancelled||this.danger},set typing(t){this._typing=t},get typing(){return this._typing||this.dim},set placeholder(t){this._placeholder=t},get placeholder(){return this._placeholder||this.primary.dim},set highlight(t){this._highlight=t},get highlight(){return this._highlight||this.inverse}};hi.merge=(t={})=>{t.styles&&typeof t.styles.enabled=="boolean"&&(oe.enabled=t.styles.enabled),t.styles&&typeof t.styles.visible=="boolean"&&(oe.visible=t.styles.visible);let e=ci.merge({},hi,t.styles);delete e.merge;for(let r of Object.keys(oe))e.hasOwnProperty(r)||Reflect.defineProperty(e,r,{get:()=>oe[r]});for(let r of Object.keys(oe.styles))e.hasOwnProperty(r)||Reflect.defineProperty(e,r,{get:()=>oe[r]});return e};ou.exports=hi});var cu=y((Up,lu)=>{"use strict";var fi=process.platform==="win32",Ie=_e(),Yc=le(),di={...Ie.symbols,upDownDoubleArrow:"\u21D5",upDownDoubleArrow2:"\u2B0D",upDownArrow:"\u2195",asterisk:"*",asterism:"\u2042",bulletWhite:"\u25E6",electricArrow:"\u2301",ellipsisLarge:"\u22EF",ellipsis Line truncated
`),l=a[0],c=a[a.length-1],f=(i+(r?" "+r:"")).length,p=f<l.length?l.slice(f+1):"";return{header:u,prompt:l,after:p,rest:a.slice(1),last:c}}async submit(){this.state.submitted=!0,this.state.validating=!0,this.options.onSubmit&&await this.options.onSubmit.call(this,this.name,this.value,this);let e=this.state.error||await this.validate(this.value,this.state);if(e!==!0){let r=`
`+this.symbols.pointer+" ";typeof e=="string"?r+=e.trim():r+="Invalid input",this.state.error=`
`+this.styles.danger(r),this.state.submitted=!1,await this.render(),await this.alert(),this.state.validating=!1,this.state.error=void 0;return}this.state.validating=!1,await this.render(),await this.close(),this.value=await this.result(this.value),this.emit("submit",this.value)}async cancel(e){this.state.cancelled=this.state.submitted=!0,await this.render(),await this.close(),typeof this.options.onCancel=="function"&&await this.options.onCancel.call(this,this.name,this.value,this),this.emit("cancel",await this.error(e))}async close(){this.state.closed=!0;try{let e=this.sections(),r=Math.ceil(e.prompt.length/this.width);e.rest&&this.write(et.cursor.down(e.rest.length)),this.write(`
`.repeat(r))}catch{}this.emit("close")}start(){!this.stop&&this.options.show!==!1&&(this.stop=mi.listen(this,this.keypress.bind(this)),this.once("close",this.stop))}async skip(){return this.skipped=this.options.skip===!0,typeof this.options.skip=="function"&&(this.skipped=await this.options.skip.call(this,this.name,this.value)),this.skipped}async initialize(){let{format:e,options:r,result:i}=this;if(this.format=()=>e.call(this,this.value),this.result=()=>i.call(this,this.value),typeof r.initial=="function"&&(this.initial=await r.initial.call(this,this)),typeof r.onRun=="function"&&await r.onRun.call(this,this),typeof r.onSubmit=="function"){let s=r.onSubmit.bind(this),n=this.submit.bind(this);delete this.options.onSubmit,this.submit=async()=>(await s(this.name,this.value,this),n())}await this.start(),await this.render()}render(){throw new Error("expected prompt to have a custom render method")}run(){return new Promise(async(e,r)=>{if(this.once("submit",e),this.once("cancel",r),await this.skip())return this.render=()=>{},this.submit();await this.initialize(),this.emit("run")})}async element(e,r,i){let{options:s,state:n,symbols:u,timers:o}=this,a=o&&o[e];n.timer=a;let l=s[e]||n[e]||u[e],c=r&&r[e]!=null?r[e]:await l;if(c==="")return c;let h=await this.resolve(c,n,r,i);return!h&&r&&r[e]?this.resolve(l,n,r,i):h}async prefix(){let e=await this.element("prefix")||this.symbols,r=this.timers&&this.timers.prefix,i=this.state;return i.timer=r,de.isObject(e)&&(e=e[i.status]||e.pending),de.hasColor(e)?e:(this.styles[i.status]||this.styles.pending)(e)}async message(){let e=await this.element("message");return de.hasColor(e)?e:this.styles.strong(e)}async separator(){let e=await this.element("separator")||this.symbols,r=this.timers&&this.timers.separator,i=this.state;i.timer=r;let s=e[i.status]||e.pending||i.separator,n=await this.resolve(s,i);return de.isObject(n)&&(n=n[i.status]||n.pending),de.hasColor(n)?n:this.styles.muted(n)}async pointer(e,r){let i=await this.element("pointer",e,r);if(typeof i=="string"&&de.hasColor(i))return i;if(i){let s=this.styles,n=this.index===r,u=n?s.primary:l=>l,o=await this.resolve(i[n?"on":"off"]||i,this.state),a=de.hasColor(o)?o:u(o);return n?a:" ".repeat(o.length)}}async indicator(e,r){let i=await this.element("indicator",e,r);if(typeof i=="string"&&de.hasColor(i))return i;if(i){let s=this.styles,n=e.enabled===!0,u=n?s.success:s.dark,o=i[n?"on":"off"]||i;return de.hasColor(o)?o:u(o)}return""}body(){return null}footer(){if(this.state.status==="pending")return this.element("footer")}header(){if(this.state.status==="pending")return this.element("header")}async hint(){if(this.state.status==="pending"&&!this.isValue(this.state.input)){let e=await this.element("hint");return de.hasColor(e)?e:this.styles.muted(e)}}error(e){return this.state.submitted?"":e||this.state.error}format(e){return e}result(e){return e}validate(e){return this.options.required===!0?this.isValue(e):!0}isValue(e){return e!=null&&e!==""}resolve(e,...r){return de.resolve(this,e,...r)}get base(){return t.prototype}get style(){return this.styles[this.state.status]}get height(){return this.options.rows||de.height(this.stdout,25)}get width(){return this.options.columns||de.width(this.stdout,80)}get size(){return{width:this.width,height:this.height}}set cursor(e){this.state.cursor=e}get cursor(){return this.state.cursor}set input(e){this.state.input=e}get input(){return this.state.input}set value(e){this.state.value=e}get value(){let{input:e,value:r}=this.state,i=[r,e].find(this.isValue.bind(this));return this.isValue(i)?i:this.initial}static get prompt(){return e=>new this(e).run()}};function sh(t){let e=s=>t[s]===void 0||typeof t[s]=="function",r=["actions","choices","initial","margin","roles","styles","symbols","theme","timers","value"],i=["body","footer","error","header","hint","indicator","message","prefix","separator","skip"];for(let s of Object.keys(t.options)){if(r.includes(s)||/^on[A-Z]/.test(s))continue;let n=t.options[s];typeof n=="function"&&e(s)?i.includes(s)||(t[s]=n.bind(t)):typeof t[s]!="function"&&(t[s]=n)}}function nh(t){typeof t=="number"&&(t=[t,t,t,t]);let e=[].concat(t||[]),r=s=>s%2===0?`
`:" ",i=[];for(let s=0;s<4;s++){let n=r(s);e[s]?i.push(n.repeat(e[s])):i.push("")}return i}Cu.exports=Ei});var Fu=y((Kp,yu)=>{"use strict";var uh=le(),Au={default(t,e){return e},checkbox(t,e){throw new Error("checkbox role is not implemented yet")},editable(t,e){throw new Error("editable role is not implemented yet")},expandable(t,e){throw new Error("expandable role is not implemented yet")},heading(t,e){return e.disabled="",e.indicator=[e.indicator," "].find(r=>r!=null),e.message=e.message||"",e},input(t,e){throw new Error("input role is not implemented yet")},option(t,e){return Au.default(t,e)},radio(t,e){throw new Error("radio role is not implemented yet")},separator(t,e){return e.disabled="",e.indicator=[e.indicator," "].find(r=>r!=null),e.message=e.message||t.symbols.line.repeat(5),e},spacer(t,e){return e}};yu.exports=(t,e={})=>{let r=uh.merge({},Au,e.roles);return r[t]||r.default}});var xt=y((Yp,bu)=>{"use strict";var oh=_e(),ah=ht(),lh=Fu(),ir=le(),{reorder:Ci,scrollUp:ch,scrollDown:hh,isObject:wu,swap:fh}=ir,Ai=class extends ah{constructor(e){super(e),this.cursorHide(),this.maxSelected=e.maxSelected||1/0,this.multiple=e.multiple||!1,this.initial=e.initial||0,this.delay=e.delay||0,this.longest=0,this.num=""}async initialize(){typeof this.options.initial=="function"&&(this.initial=await this.options.initial.call(this)),await this.reset(!0),await super.initialize()}async reset(){let{choices:e,initial:r,autofocus:i,suggest:s}=this.options;if(this.state._choices=[],this.state.choices=[],this.choices=await Promise.all(await this.toChoices(e)),this.choices.forEach(n=>n.enabled=!1),typeof s!="function"&&this.selectable.length===0)throw new Error("At least one choice must be selectable");wu(r)&&(r=Object.keys(r)),Array.isArray(r)?(i!=null&&(this.index=this.findIndex(i)),r.forEach(n=>this.enable(this.find(n))),await this.render()):(i!=null&&(r=i),typeof r=="string"&&(r=this.findIndex(r)),typeof r=="number"&&r>-1&&(this.index=Math.max(0,Math.min(r,this.choices.length)),this.enable(this.find(this.index)))),this.isDisabled(this.focused)&&await this.down()}async toChoices(e,r){this.state.loadingChoices=!0;let i=[],s=0,n=async(u,o)=>{typeof u=="function"&&(u=await u.call(this)),u instanceof Promise&&(u=await u);for(let a=0;a<u.length;a++){let l=u[a]=await this.toChoice(u[a],s++,o);i.push(l),l.choices&&await n(l.choices,l)}return i};return n(e,r).then(u=>(this.state.loadingChoices=!1,u))}async toChoice(e,r,i){if(typeof e=="function"&&(e=await e.call(this,this)),e instanceof Promise&&(e=await e),typeof e=="string"&&(e={name:e}),e.normalized)return e;e.normalized=!0;let s=e.value;if(e=lh(e.role,this.options)(this,e),typeof e.disabled=="string"&&!e.hint&&(e.hint=e.disabled,e.disabled=!0),e.disabled===!0&&e.hint==null&&(e.hint="(disabled)"),e.index!=null)return e;e.name=e.name||e.key||e.title||e.value||e.message,e.message=e.message||e.name||"",e.value=[e.value,e.name].find(this.isValue.bind(this)),e.input="",e.index=r,e.cursor=0,ir.define(e,"parent",i),e.level=i?i.level+1:1,e.indent==null&&(e.indent=i?i.indent+" ":e.indent||""),e.path=i?i.path+"."+e.name:e.name,e.enabled=!!(this.multiple&&!this.isDisabled(e)&&(e.enabled||this.isSelected(e))),this.isDisabled(e)||(this.longest=Math.max(this.longest,oh.unstyle(e.message).length));let u={...e};return e.reset=(o=u.input,a=u.value)=>{for(let l of Object.keys(u))e[l]=u[l];e.input=o,e.value=a},s==null&&typeof e.initial=="function"&&(e.input=await e.initial.call(this,this.state,e,r)),e}async onChoice(e,r){this.emit("choice",e,r,this),typeof e.onChoice=="function"&&await e.onChoice.call(this,this.state,e,r)}async addChoice(e,r,i){let s=await this.toChoice(e,r,i);return this.choices.push(s),this.index=this.choices.length-1,this.limit=this.choices.length,s}async newItem(e,r,i){let s={name:"New choice name?",editable:!0,newChoice:!0,...e},n=await this.addChoice(s,r,i);return n.updateChoice=()=>{delete n.newChoice,n.name=n.message=n.input,n.input="",n.cursor=0},this.render()}indent(e){return e.indent==null?e.level>1?" ".repeat(e.level-1):"":e.indent}dispatch(e,r){if(this.multiple&&this[r.name])return this[r.name]();this.alert()}focus(e,r){return typeof r!="boolean"&&(r=e.enabled),r&&!e.enabled&&this.selected.length>=this.maxSelected?this.alert():(this.index=e.index,e.enabled=r&&!this.isDisabled(e),e)}space(){return this.multiple?(this.toggle(this.focused),this.render()):this.alert()}a(){if(this.maxSelected<this.choices.length)return this.alert();let e=this.selectable.every(r=>r.enabled);return this.choices.forEach(r=>r.enabled=!e),this.render()}i(){return this.choices.length-this.selected.length>this.maxSelected?this.alert():(this.choices.forEach(e=>e.enabled=!e.enabled),this.render())}g(e=this.focused){return this.choices.some(r=>!!r.parent)?(this.toggle(e.parent&&!e.choices?e.parent:e),this.render()):this.a()}toggle(e,r){if(!e.enabled&&this.selected.length>=this.maxSelected)return this.alert();typeof r!="boolean"&&(r=!e.enabled),e.enabled=r,e.choices&&e.choices.forEach(s=>this. Line truncated
`),s;return this.options.choicesHeader&&(s=await this.resolve(this.options.choicesHeader,this.state)),[s,i].filter(Boolean).join(`
`)}format(){return!this.state.submitted||this.state.cancelled?"":Array.isArray(this.selected)?this.selected.map(e=>this.styles.primary(e.name)).join(", "):this.styles.primary(this.selected.name)}async render(){let{submitted:e,size:r}=this.state,i="",s=await this.header(),n=await this.prefix(),u=await this.separator(),o=await this.message();this.options.promptLine!==!1&&(i=[n,o,u,""].join(" "),this.state.prompt=i);let a=await this.format(),l=await this.error()||await this.hint(),c=await this.renderChoices(),h=await this.footer();a&&(i+=a),l&&!i.includes(l)&&(i+=" "+l),e&&!a&&!c.trim()&&this.multiple&&this.emptyError!=null&&(i+=this.styles.danger(this.emptyError)),this.clear(r),this.write([s,i,c,h].filter(Boolean).join(`
`)),this.write(this.margin[2]),this.restore()}};vu.exports=Fi});var Su=y((Xp,xu)=>{"use strict";var ph=We(),Dh=(t,e)=>{let r=t.toLowerCase();return i=>{let n=i.toLowerCase().indexOf(r),u=e(i.slice(n,n+r.length));return n>=0?i.slice(0,n)+u+i.slice(n+r.length):i}},wi=class extends ph{constructor(e){super(e),this.cursorShow()}moveCursor(e){this.state.cursor+=e}dispatch(e){return this.append(e)}space(e){return this.options.multiple?super.space(e):this.append(e)}append(e){let{cursor:r,input:i}=this.state;return this.input=i.slice(0,r)+e+i.slice(r),this.moveCursor(1),this.complete()}delete(){let{cursor:e,input:r}=this.state;return r?(this.input=r.slice(0,e-1)+r.slice(e),this.moveCursor(-1),this.complete()):this.alert()}deleteForward(){let{cursor:e,input:r}=this.state;return r[e]===void 0?this.alert():(this.input=`${r}`.slice(0,e)+`${r}`.slice(e+1),this.complete())}number(e){return this.append(e)}async complete(){this.completing=!0,this.choices=await this.suggest(this.input,this.state._choices),this.state.limit=void 0,this.index=Math.min(Math.max(this.visible.length-1,0),this.index),await this.render(),this.completing=!1}suggest(e=this.input,r=this.state._choices){if(typeof this.options.suggest=="function")return this.options.suggest.call(this,e,r);let i=e.toLowerCase();return r.filter(s=>s.message.toLowerCase().includes(i))}pointer(){return""}format(){if(!this.focused)return this.input;if(this.options.multiple&&this.state.submitted)return this.selected.map(e=>this.styles.primary(e.message)).join(", ");if(this.state.submitted){let e=this.value=this.input=this.focused.value;return this.styles.primary(e)}return this.input}async render(){if(this.state.status!=="pending")return super.render();let e=this.options.highlight?this.options.highlight.bind(this):this.styles.placeholder,r=Dh(this.input,e),i=this.choices;this.choices=i.map(s=>({...s,message:r(s.message)})),await super.render(),this.choices=i}submit(){return this.options.multiple&&(this.value=this.selected.map(e=>e.name)),super.submit()}};xu.exports=wi});var bi=y((Zp,Bu)=>{"use strict";var _i=le();Bu.exports=(t,e={})=>{t.cursorHide();let{input:r="",initial:i="",pos:s,showCursor:n=!0,color:u}=e,o=u||t.styles.placeholder,a=_i.inverse(t.styles.primary),l=d=>a(t.styles.black(d)),c=r,h=" ",f=l(h);if(t.blink&&t.blink.off===!0&&(l=d=>d,f=""),n&&s===0&&i===""&&r==="")return l(h);if(n&&s===0&&(r===i||r===""))return l(i[0])+o(i.slice(1));i=_i.isPrimitive(i)?`${i}`:"",r=_i.isPrimitive(r)?`${r}`:"";let p=i&&i.startsWith(r)&&i!==r,D=p?l(i[r.length]):f;if(s!==r.length&&n===!0&&(c=r.slice(0,s)+l(r[s])+r.slice(s+1),D=""),n===!1&&(D=""),p){let d=t.styles.unstyle(c+D);return c+D+o(i.slice(d.length))}return c+D}});var sr=y((Jp,Ru)=>{"use strict";var gh=_e(),mh=We(),Eh=bi(),vi=class extends mh{constructor(e){super({...e,multiple:!0}),this.type="form",this.initial=this.options.initial,this.align=[this.options.align,"right"].find(r=>r!=null),this.emptyError="",this.values={}}async reset(e){return await super.reset(),e===!0&&(this._index=this.index),this.index=this._index,this.values={},this.choices.forEach(r=>r.reset&&r.reset()),this.render()}dispatch(e){return!!e&&this.append(e)}append(e){let r=this.focused;if(!r)return this.alert();let{cursor:i,input:s}=r;return r.value=r.input=s.slice(0,i)+e+s.slice(i),r.cursor++,this.render()}delete(){let e=this.focused;if(!e||e.cursor<=0)return this.alert();let{cursor:r,input:i}=e;return e.value=e.input=i.slice(0,r-1)+i.slice(r),e.cursor--,this.render()}deleteForward(){let e=this.focused;if(!e)return this.alert();let{cursor:r,input:i}=e;if(i[r]===void 0)return this.alert();let s=`${i}`.slice(0,r)+`${i}`.slice(r+1);return e.value=e.input=s,this.render()}right(){let e=this.focused;return e?e.cursor>=e.input.length?this.alert():(e.cursor++,this.render()):this.alert()}left(){let e=this.focused;return e?e.cursor<=0?this.alert():(e.cursor--,this.render()):this.alert()}space(e,r){return this.dispatch(e,r)}number(e,r){return this.dispatch(e,r)}next(){let e=this.focused;if(!e)return this.alert();let{initial:r,input:i}=e;return r&&r.startsWith(i)&&i!==r?(e.value=e.input=r,e.cursor=e.value.length,this.render()):super.next()}prev(){let e=this.focused;return e?e.cursor===0?super.prev():(e.value=e.input="",e.cursor=0,this.render()):this.alert()}separator(){return""}format(e){return this.state.submitted?"":super.format(e)}pointer(){return""}indicator(e){return e.input?"\u29BF":"\u2299"}async choiceSeparator(e,r){let i=await this.resolve(e.separator,this.state,e,r)||":";return i?" "+this.styles.disabled(i):""}async renderChoice(e,r){await this.onChoice(e,r);let{state:i,styles:s}=this,{cursor:n,initial:u="",name:o,hint:a,input:l=""}=e,{muted:c,submitted:h,primary:f,danger:p}=s,D=a,d=this.index===r,v=e.validate||(()=>!0),g=await this.choiceSeparator(e,r),w=e.message;this.align==="right"&&(w=w.padStart(this.longest+1," ")),this.align==="left"&&(w=w.padEnd(this.longest+1," "));let F=this.values[o]=l||u,B=l?"success":"dark";await v.call(e,F,this.state)!==!0&&(B="da Line truncated
`)),this.restore()}set value(e){super.value=e}get value(){return this.cast(super.value)}};Iu.exports=Si});var Mu=y((iD,ku)=>{"use strict";var vh=nr(),Bi=class extends vh{constructor(e){super(e),this.default=this.options.default||(this.initial?"(Y/n)":"(y/N)")}};ku.exports=Bi});var Hu=y((sD,$u)=>{"use strict";var xh=We(),Sh=sr(),ft=Sh.prototype,Ri=class extends xh{constructor(e){super({...e,multiple:!0}),this.align=[this.options.align,"left"].find(r=>r!=null),this.emptyError="",this.values={}}dispatch(e,r){let i=this.focused,s=i.parent||{};return!i.editable&&!s.editable&&(e==="a"||e==="i")?super[e]():ft.dispatch.call(this,e,r)}append(e,r){return ft.append.call(this,e,r)}delete(e,r){return ft.delete.call(this,e,r)}space(e){return this.focused.editable?this.append(e):super.space()}number(e){return this.focused.editable?this.append(e):super.number(e)}next(){return this.focused.editable?ft.next.call(this):super.next()}prev(){return this.focused.editable?ft.prev.call(this):super.prev()}async indicator(e,r){let i=e.indicator||"",s=e.editable?i:super.indicator(e,r);return await this.resolve(s,this.state,e,r)||""}indent(e){return e.role==="heading"?"":e.editable?" ":" "}async renderChoice(e,r){return e.indent="",e.editable?ft.renderChoice.call(this,e,r):super.renderChoice(e,r)}error(){return""}footer(){return this.state.error}async validate(){let e=!0;for(let r of this.choices){if(typeof r.validate!="function"||r.role==="heading")continue;let i=r.parent?this.value[r.parent.name]:this.value;if(r.editable?i=r.value===r.name?r.initial||"":r.value:this.isDisabled(r)||(i=r.enabled===!0),e=await r.validate(i,this.state),e!==!0)break}return e!==!0&&(this.state.error=typeof e=="string"?e:"Invalid Input"),e}submit(){if(this.focused.newChoice===!0)return super.submit();if(this.choices.some(e=>e.newChoice))return this.alert();this.value={};for(let e of this.choices){let r=e.parent?this.value[e.parent.name]:this.value;if(e.role==="heading"){this.value[e.name]={};continue}e.editable?r[e.name]=e.value===e.name?e.initial||"":e.value:this.isDisabled(e)||(r[e.name]=e.enabled===!0)}return this.base.submit.call(this)}};$u.exports=Ri});var tt=y((nD,qu)=>{"use strict";var Bh=ht(),Rh=bi(),{isPrimitive:Oh}=le(),Oi=class extends Bh{constructor(e){super(e),this.initial=Oh(this.initial)?String(this.initial):"",this.initial&&this.cursorHide(),this.state.prevCursor=0,this.state.clipboard=[]}async keypress(e,r={}){let i=this.state.prevKeypress;return this.state.prevKeypress=r,this.options.multiline===!0&&r.name==="return"&&(!i||i.name!=="return")?this.append(`
`,r):super.keypress(e,r)}moveCursor(e){this.cursor+=e}reset(){return this.input=this.value="",this.cursor=0,this.render()}dispatch(e,r){if(!e||r.ctrl||r.code)return this.alert();this.append(e)}append(e){let{cursor:r,input:i}=this.state;this.input=`${i}`.slice(0,r)+e+`${i}`.slice(r),this.moveCursor(String(e).length),this.render()}insert(e){this.append(e)}delete(){let{cursor:e,input:r}=this.state;if(e<=0)return this.alert();this.input=`${r}`.slice(0,e-1)+`${r}`.slice(e),this.moveCursor(-1),this.render()}deleteForward(){let{cursor:e,input:r}=this.state;if(r[e]===void 0)return this.alert();this.input=`${r}`.slice(0,e)+`${r}`.slice(e+1),this.render()}cutForward(){let e=this.cursor;if(this.input.length<=e)return this.alert();this.state.clipboard.push(this.input.slice(e)),this.input=this.input.slice(0,e),this.render()}cutLeft(){let e=this.cursor;if(e===0)return this.alert();let r=this.input.slice(0,e),i=this.input.slice(e),s=r.split(" ");this.state.clipboard.push(s.pop()),this.input=s.join(" "),this.cursor=this.input.length,this.input+=i,this.render()}paste(){if(!this.state.clipboard.length)return this.alert();this.insert(this.state.clipboard.pop()),this.render()}toggleCursor(){this.state.prevCursor?(this.cursor=this.state.prevCursor,this.state.prevCursor=0):(this.state.prevCursor=this.cursor,this.cursor=0),this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.input.length-1,this.render()}next(){let e=this.initial!=null?String(this.initial):"";if(!e||!e.startsWith(this.input))return this.alert();this.input=this.initial,this.cursor=this.initial.length,this.render()}prev(){if(!this.input)return this.alert();this.reset()}backward(){return this.left()}forward(){return this.right()}right(){return this.cursor>=this.input.length?this.alert():(this.moveCursor(1),this.render())}left(){return this.cursor<=0?this.alert():(this.moveCursor(-1),this.render())}isValue(e){return!!e}async format(e=this.value){let r=await this.resolve(this.initial,this.state);return this.state.submitted?this.styles.submitted(e||r):Rh(this,{input:e,initial:r,pos:this.cursor})}async render(){let e=this.state.size,r=await this.prefix(),i=await this.separator(),s=await this.message(),n=[r,s,i].filter(Boolean).join(" ");this.state.prompt=n;let u=await this.header(),o=await this.format(),a=await this.error()||await this.hint(),l=await this.footer();a&&!o.includes(a)&&(o+=" "+a),n+=" "+o,this.clear(e),this.write([u,n,l].filter(Boolean).join(`
`)),this.restore()}};qu.exports=Oi});var Gu=y((uD,ju)=>{"use strict";var Lh=t=>t.filter((e,r)=>t.lastIndexOf(e)===r),ur=t=>Lh(t).filter(Boolean);ju.exports=(t,e={},r="")=>{let{past:i=[],present:s=""}=e,n,u;switch(t){case"prev":case"undo":return n=i.slice(0,i.length-1),u=i[i.length-1]||"",{past:ur([r,...n]),present:u};case"next":case"redo":return n=i.slice(1),u=i[0]||"",{past:ur([...n,r]),present:u};case"save":return{past:ur([...i,r]),present:""};case"remove":return u=ur(i.filter(o=>o!==r)),s="",u.length&&(s=u.pop()),{past:u,present:s};default:throw new Error(`Invalid action: "${t}"`)}}});var Ti=y((oD,Uu)=>{"use strict";var Th=tt(),Wu=Gu(),Li=class extends Th{constructor(e){super(e);let r=this.options.history;if(r&&r.store){let i=r.values||this.initial;this.autosave=!!r.autosave,this.store=r.store,this.data=this.store.get("values")||{past:[],present:i},this.initial=this.data.present||this.data.past[this.data.past.length-1]}}completion(e){return this.store?(this.data=Wu(e,this.data,this.input),this.data.present?(this.input=this.data.present,this.cursor=this.input.length,this.render()):this.alert()):this.alert()}altUp(){return this.completion("prev")}altDown(){return this.completion("next")}prev(){return this.save(),super.prev()}save(){this.store&&(this.data=Wu("save",this.data,this.input),this.store.set("values",this.data))}submit(){return this.store&&this.autosave===!0&&this.save(),super.submit()}};Uu.exports=Li});var Vu=y((aD,zu)=>{"use strict";var Nh=tt(),Ni=class extends Nh{format(){return""}};zu.exports=Ni});var Yu=y((lD,Ku)=>{"use strict";var Ph=tt(),Pi=class extends Ph{constructor(e={}){super(e),this.sep=this.options.separator||/, */,this.initial=e.initial||""}split(e=this.value){return e?String(e).split(this.sep):[]}format(){let e=this.state.submitted?this.styles.primary:r=>r;return this.list.map(e).join(", ")}async submit(e){let r=this.state.error||await this.validate(this.list,this.state);return r!==!0?(this.state.error=r,super.submit()):(this.value=this.list,super.submit())}get list(){return this.split()}};Ku.exports=Pi});var Xu=y((cD,Qu)=>{"use strict";var Ih=We(),Ii=class extends Ih{constructor(e){super({...e,multiple:!0})}};Qu.exports=Ii});var Mi=y((hD,Zu)=>{"use strict";var kh=tt(),ki=class extends kh{constructor(e={}){super({style:"number",...e}),this.min=this.isValue(e.min)?this.toNumber(e.min):-1/0,this.max=this.isValue(e.max)?this.toNumber(e.max):1/0,this.delay=e.delay!=null?e.delay:1e3,this.float=e.float!==!1,this.round=e.round===!0||e.float===!1,this.major=e.major||10,this.minor=e.minor||1,this.initial=e.initial!=null?e.initial:"",this.input=String(this.initial),this.cursor=this.input.length,this.cursorShow()}append(e){return!/[-+.]/.test(e)||e==="."&&this.input.includes(".")?this.alert("invalid number"):super.append(e)}number(e){return super.append(e)}next(){return this.input&&this.input!==this.initial?this.alert():this.isValue(this.initial)?(this.input=this.initial,this.cursor=String(this.initial).length,this.render()):this.alert()}up(e){let r=e||this.minor,i=this.toNumber(this.input);return i>this.max+r?this.alert():(this.input=`${i+r}`,this.render())}down(e){let r=e||this.minor,i=this.toNumber(this.input);return i<this.min-r?this.alert():(this.input=`${i-r}`,this.render())}shiftDown(){return this.down(this.major)}shiftUp(){return this.up(this.major)}format(e=this.input){return typeof this.options.format=="function"?this.options.format.call(this,e):this.styles.info(e)}toNumber(e=""){return this.float?+e:Math.round(+e)}isValue(e){return/^[-+]?[0-9]+((\.)|(\.[0-9]+))?$/.test(e)}submit(){let e=[this.input,this.initial].find(r=>this.isValue(r));return this.value=this.toNumber(e||0),super.submit()}};Zu.exports=ki});var eo=y((fD,Ju)=>{Ju.exports=Mi()});var ro=y((dD,to)=>{"use strict";var Mh=tt(),$i=class extends Mh{constructor(e){super(e),this.cursorShow()}format(e=this.input){return this.keypressed?(this.state.submitted?this.styles.primary:this.styles.muted)(this.symbols.asterisk.repeat(e.length)):""}};to.exports=$i});var no=y((pD,so)=>{"use strict";var $h=_e(),Hh=xt(),io=le(),Hi=class extends Hh{constructor(e={}){super(e),this.widths=[].concat(e.messageWidth||50),this.align=[].concat(e.align||"left"),this.linebreak=e.linebreak||!1,this.edgeLength=e.edgeLength||3,this.newline=e.newline||`
`;let r=e.startNumber||1;typeof this.scale=="number"&&(this.scaleKey=!1,this.scale=Array(this.scale).fill(0).map((i,s)=>({name:s+r})))}async reset(){return this.tableized=!1,await super.reset(),this.render()}tableize(){if(this.tableized===!0)return;this.tableized=!0;let e=0;for(let r of this.choices){e=Math.max(e,r.message.length),r.scaleIndex=r.initial||2,r.scale=[];for(let i=0;i<this.scale.length;i++)r.scale.push({index:i})}this.widths[0]=Math.min(this.widths[0],e+3)}async dispatch(e,r){if(this.multiple)return this[r.name]?await this[r.name](e,r):await super.dispatch(e,r);this.alert()}heading(e,r,i){return this.styles.strong(e)}separator(){return this.styles.muted(this.symbols.ellipsis)}right(){let e=this.focused;return e.scaleIndex>=this.scale.length-1?this.alert():(e.scaleIndex++,this.render())}left(){let e=this.focused;return e.scaleIndex<=0?this.alert():(e.scaleIndex--,this.render())}indent(){return""}format(){return this.state.submitted?this.choices.map(r=>this.styles.info(r.index)).join(", "):""}pointer(){return""}renderScaleKey(){return this.scaleKey===!1||this.state.submitted?"":["",...this.scale.map(i=>` ${i.name} - ${i.message}`)].map(i=>this.styles.muted(i)).join(`
`)}renderScaleHeading(e){let r=this.scale.map(a=>a.name);typeof this.options.renderScaleHeading=="function"&&(r=this.options.renderScaleHeading.call(this,e));let i=this.scaleLength-r.join("").length,s=Math.round(i/(r.length-1)),u=r.map(a=>this.styles.strong(a)).join(" ".repeat(s)),o=" ".repeat(this.widths[0]);return this.margin[3]+o+this.margin[1]+u}scaleIndicator(e,r,i){if(typeof this.options.scaleIndicator=="function")return this.options.scaleIndicator.call(this,e,r,i);let s=e.scaleIndex===r.index;return r.disabled?this.styles.hint(this.symbols.radio.disabled):s?this.styles.success(this.symbols.radio.on):this.symbols.radio.off}renderScale(e,r){let i=e.scale.map(n=>this.scaleIndicator(e,n,r)),s=this.term==="Hyper"?"":" ";return i.join(s+this.symbols.line.repeat(this.edgeLength))}async renderChoice(e,r){await this.onChoice(e,r);let i=this.index===r,s=await this.pointer(e,r),n=await e.hint;n&&!io.hasColor(n)&&(n=this.styles.muted(n));let u=D=>this.margin[3]+D.replace(/\s+$/,"").padEnd(this.widths[0]," "),o=this.newline,a=this.indent(e),l=await this.resolve(e.message,this.state,e,r),c=await this.renderScale(e,r),h=this.margin[1]+this.margin[3];this.scaleLength=$h.unstyle(c).length,this.widths[0]=Math.min(this.widths[0],this.width-this.scaleLength-h.length);let p=io.wordWrap(l,{width:this.widths[0],newline:o}).split(`
`).map(D=>u(D)+this.margin[1]);return i&&(c=this.styles.info(c),p=p.map(D=>this.styles.info(D))),p[0]+=c,this.linebreak&&p.push(""),[a+s,p.join(`
`)].filter(Boolean)}async renderChoices(){if(this.state.submitted)return"";this.tableize();let e=this.visible.map(async(s,n)=>await this.renderChoice(s,n)),r=await Promise.all(e),i=await this.renderScaleHeading();return this.margin[0]+[i,...r.map(s=>s.join(" "))].join(`
`)}async render(){let{submitted:e,size:r}=this.state,i=await this.prefix(),s=await this.separator(),n=await this.message(),u="";this.options.promptLine!==!1&&(u=[i,n,s,""].join(" "),this.state.prompt=u);let o=await this.header(),a=await this.format(),l=await this.renderScaleKey(),c=await this.error()||await this.hint(),h=await this.renderChoices(),f=await this.footer(),p=this.emptyError;a&&(u+=a),c&&!u.includes(c)&&(u+=" "+c),e&&!a&&!h.trim()&&this.multiple&&p!=null&&(u+=this.styles.danger(p)),this.clear(r),this.write([o,u,l,h,f].filter(Boolean).join(`
`)),this.state.submitted||this.write(this.margin[2]),this.restore()}submit(){this.value={};for(let e of this.choices)this.value[e.name]=e.scaleIndex;return this.base.submit.call(this)}};so.exports=Hi});var ao=y((DD,oo)=>{"use strict";var uo=_e(),qh=(t="")=>typeof t=="string"?t.replace(/^['"]|['"]$/g,""):"",ji=class{constructor(e){this.name=e.key,this.field=e.field||{},this.value=qh(e.initial||this.field.initial||""),this.message=e.message||this.name,this.cursor=0,this.input="",this.lines=[]}},jh=async(t={},e={},r=i=>i)=>{let i=new Set,s=t.fields||[],n=t.template,u=[],o=[],a=[],l=1;typeof n=="function"&&(n=await n());let c=-1,h=()=>n[++c],f=()=>n[c+1],p=D=>{D.line=l,u.push(D)};for(p({type:"bos",value:""});c<n.length-1;){let D=h();if(/^[^\S\n ]$/.test(D)){p({type:"text",value:D});continue}if(D===`
`){p({type:"newline",value:D}),l++;continue}if(D==="\\"){D+=h(),p({type:"text",value:D});continue}if((D==="$"||D==="#"||D==="{")&&f()==="{"){let v=h();D+=v;let g={type:"template",open:D,inner:"",close:"",value:D},w;for(;w=h();){if(w==="}"){f()==="}"&&(w+=h()),g.value+=w,g.close=w;break}w===":"?(g.initial="",g.key=g.inner):g.initial!==void 0&&(g.initial+=w),g.value+=w,g.inner+=w}g.template=g.open+(g.initial||g.inner)+g.close,g.key=g.key||g.inner,e.hasOwnProperty(g.key)&&(g.initial=e[g.key]),g=r(g),p(g),a.push(g.key),i.add(g.key);let F=o.find(B=>B.name===g.key);g.field=s.find(B=>B.name===g.key),F||(F=new ji(g),o.push(F)),F.lines.push(g.line-1);continue}let d=u[u.length-1];d.type==="text"&&d.line===l?d.value+=D:p({type:"text",value:D})}return p({type:"eos",value:""}),{input:n,tabstops:u,unique:i,keys:a,items:o}};oo.exports=async t=>{let e=t.options,r=new Set(e.required===!0?[]:e.required||[]),i={...e.values,...e.initial},{tabstops:s,items:n,keys:u}=await jh(e,i),o=qi("result",t,e),a=qi("format",t,e),l=qi("validate",t,e,!0),c=t.isValue.bind(t);return async(h={},f=!1)=>{let p=0;h.required=r,h.items=n,h.keys=u,h.output="";let D=async(w,F,B,O)=>{let q=await l(w,F,B,O);return q===!1?"Invalid field "+B.name:q};for(let w of s){let F=w.value,B=w.key;if(w.type!=="template"){F&&(h.output+=F);continue}if(w.type==="template"){let O=n.find(j=>j.name===B);e.required===!0&&h.required.add(O.name);let q=[O.input,h.values[O.value],O.value,F].find(c),R=(O.field||{}).message||w.inner;if(f){let j=await D(h.values[B],h,O,p);if(j&&typeof j=="string"||j===!1){h.invalid.set(B,j);continue}h.invalid.delete(B);let A=await o(h.values[B],h,O,p);h.output+=uo.unstyle(A);continue}O.placeholder=!1;let M=F;F=await a(F,h,O,p),q!==F?(h.values[B]=q,F=t.styles.typing(q),h.missing.delete(R)):(h.values[B]=void 0,q=`<${R}>`,F=t.styles.primary(q),O.placeholder=!0,h.required.has(B)&&h.missing.add(R)),h.missing.has(R)&&h.validating&&(F=t.styles.warning(q)),h.invalid.has(B)&&h.validating&&(F=t.styles.danger(q)),p===h.index&&(M!==F?F=t.styles.underline(F):F=t.styles.heading(uo.unstyle(F))),p++}F&&(h.output+=F)}let d=h.output.split(`
`).map(w=>" "+w),v=n.length,g=0;for(let w of n)h.invalid.has(w.name)&&w.lines.forEach(F=>{d[F][0]===" "&&(d[F]=h.styles.danger(h.symbols.bullet)+d[F].slice(1))}),t.isValue(h.values[w.name])&&g++;return h.completed=(g/v*100).toFixed(0),h.output=d.join(`
`),h.output}};function qi(t,e,r,i){return(s,n,u,o)=>typeof u.field[t]=="function"?u.field[t].call(e,s,n,u,o):[i,s].find(a=>e.isValue(a))}});var co=y((gD,lo)=>{"use strict";var Gh=_e(),Wh=ao(),Uh=ht(),Gi=class extends Uh{constructor(e){super(e),this.cursorHide(),this.reset(!0)}async initialize(){this.interpolate=await Wh(this),await super.initialize()}async reset(e){this.state.keys=[],this.state.invalid=new Map,this.state.missing=new Set,this.state.completed=0,this.state.values={},e!==!0&&(await this.initialize(),await this.render())}moveCursor(e){let r=this.getItem();this.cursor+=e,r.cursor+=e}dispatch(e,r){if(!r.code&&!r.ctrl&&e!=null&&this.getItem()){this.append(e,r);return}this.alert()}append(e,r){let i=this.getItem(),s=i.input.slice(0,this.cursor),n=i.input.slice(this.cursor);this.input=i.input=`${s}${e}${n}`,this.moveCursor(1),this.render()}delete(){let e=this.getItem();if(this.cursor<=0||!e.input)return this.alert();let r=e.input.slice(this.cursor),i=e.input.slice(0,this.cursor-1);this.input=e.input=`${i}${r}`,this.moveCursor(-1),this.render()}increment(e){return e>=this.state.keys.length-1?0:e+1}decrement(e){return e<=0?this.state.keys.length-1:e-1}first(){this.state.index=0,this.render()}last(){this.state.index=this.state.keys.length-1,this.render()}right(){if(this.cursor>=this.input.length)return this.alert();this.moveCursor(1),this.render()}left(){if(this.cursor<=0)return this.alert();this.moveCursor(-1),this.render()}prev(){this.state.index=this.decrement(this.state.index),this.getItem(),this.render()}next(){this.state.index=this.increment(this.state.index),this.getItem(),this.render()}up(){this.prev()}down(){this.next()}format(e){let r=this.state.completed<100?this.styles.warning:this.styles.success;return this.state.submitted===!0&&this.state.completed!==100&&(r=this.styles.danger),r(`${this.state.completed}% completed`)}async render(){let{index:e,keys:r=[],submitted:i,size:s}=this.state,n=[this.options.newline,`
`].find(w=>w!=null),u=await this.prefix(),o=await this.separator(),a=await this.message(),l=[u,a,o].filter(Boolean).join(" ");this.state.prompt=l;let c=await this.header(),h=await this.error()||"",f=await this.hint()||"",p=i?"":await this.interpolate(this.state),D=this.state.key=r[e]||"",d=await this.format(D),v=await this.footer();d&&(l+=" "+d),f&&!d&&this.state.completed===0&&(l+=" "+f),this.clear(s);let g=[c,l,p,v,h.trim()];this.write(g.filter(Boolean).join(n)),this.restore()}getItem(e){let{items:r,keys:i,index:s}=this.state,n=r.find(u=>u.name===i[s]);return n&&n.input!=null&&(this.input=n.input,this.cursor=n.cursor),n}async submit(){typeof this.interpolate!="function"&&await this.initialize(),await this.interpolate(this.state,!0);let{invalid:e,missing:r,output:i,values:s}=this.state;if(e.size){let o="";for(let[a,l]of e)o+=`Invalid ${a}: ${l}
`;return this.state.error=o,super.submit()}if(r.size)return this.state.error="Required: "+[...r.keys()].join(", "),super.submit();let u=Gh.unstyle(i).split(`
`).map(o=>o.slice(1)).join(`
`);return this.value={values:s,result:u},super.submit()}};lo.exports=Gi});var fo=y((mD,ho)=>{"use strict";var zh="(Use <shift>+<up/down> to sort)",Vh=We(),Wi=class extends Vh{constructor(e){super({...e,reorder:!1,sort:!0,multiple:!0}),this.state.hint=[this.options.hint,zh].find(this.isValue.bind(this))}indicator(){return""}async renderChoice(e,r){let i=await super.renderChoice(e,r),s=this.symbols.identicalTo+" ",n=this.index===r&&this.sorting?this.styles.muted(s):" ";return this.options.drag===!1&&(n=""),this.options.numbered===!0?n+`${r+1} - `+i:n+i}get selected(){return this.choices}submit(){return this.value=this.choices.map(e=>e.value),super.submit()}};ho.exports=Wi});var Do=y((ED,po)=>{"use strict";var Kh=xt(),Ui=class extends Kh{constructor(e={}){if(super(e),this.emptyError=e.emptyError||"No items were selected",this.term=process.env.TERM_PROGRAM,!this.options.header){let r=["","4 - Strongly Agree","3 - Agree","2 - Neutral","1 - Disagree","0 - Strongly Disagree",""];r=r.map(i=>this.styles.muted(i)),this.state.header=r.join(`
`)}}async toChoices(...e){if(this.createdScales)return!1;this.createdScales=!0;let r=await super.toChoices(...e);for(let i of r)i.scale=Yh(5,this.options),i.scaleIdx=2;return r}dispatch(){this.alert()}space(){let e=this.focused,r=e.scale[e.scaleIdx],i=r.selected;return e.scale.forEach(s=>s.selected=!1),r.selected=!i,this.render()}indicator(){return""}pointer(){return""}separator(){return this.styles.muted(this.symbols.ellipsis)}right(){let e=this.focused;return e.scaleIdx>=e.scale.length-1?this.alert():(e.scaleIdx++,this.render())}left(){let e=this.focused;return e.scaleIdx<=0?this.alert():(e.scaleIdx--,this.render())}indent(){return" "}async renderChoice(e,r){await this.onChoice(e,r);let i=this.index===r,s=this.term==="Hyper",n=s?9:8,u=s?"":" ",o=this.symbols.line.repeat(n),a=" ".repeat(n+(s?0:1)),l=F=>(F?this.styles.success("\u25C9"):"\u25EF")+u,c=r+1+".",h=i?this.styles.heading:this.styles.noop,f=await this.resolve(e.message,this.state,e,r),p=this.indent(e),D=p+e.scale.map((F,B)=>l(B===e.scaleIdx)).join(o),d=F=>F===e.scaleIdx?h(F):F,v=p+e.scale.map((F,B)=>d(B)).join(a),g=()=>[c,f].filter(Boolean).join(" "),w=()=>[g(),D,v," "].filter(Boolean).join(`
`);return i&&(D=this.styles.cyan(D),v=this.styles.cyan(v)),w()}async renderChoices(){if(this.state.submitted)return"";let e=this.visible.map(async(i,s)=>await this.renderChoice(i,s)),r=await Promise.all(e);return r.length||r.push(this.styles.danger("No matching choices")),r.join(`
`)}format(){return this.state.submitted?this.choices.map(r=>this.styles.info(r.scaleIdx)).join(", "):""}async render(){let{submitted:e,size:r}=this.state,i=await this.prefix(),s=await this.separator(),n=await this.message(),u=[i,n,s].filter(Boolean).join(" ");this.state.prompt=u;let o=await this.header(),a=await this.format(),l=await this.error()||await this.hint(),c=await this.renderChoices(),h=await this.footer();(a||!l)&&(u+=" "+a),l&&!u.includes(l)&&(u+=" "+l),e&&!a&&!c&&this.multiple&&this.type!=="form"&&(u+=this.styles.danger(this.emptyError)),this.clear(r),this.write([u,o,c,h].filter(Boolean).join(`
`)),this.restore()}submit(){this.value={};for(let e of this.choices)this.value[e.name]=e.scaleIdx;return this.base.submit.call(this)}};function Yh(t,e={}){if(Array.isArray(e.scale))return e.scale.map(i=>({...i}));let r=[];for(let i=1;i<t+1;i++)r.push({i,selected:!1});return r}po.exports=Ui});var mo=y((CD,go)=>{go.exports=Ti()});var Co=y((AD,Eo)=>{"use strict";var Qh=nr(),zi=class extends Qh{async initialize(){await super.initialize(),this.value=this.initial=!!this.options.initial,this.disabled=this.options.disabled||"no",this.enabled=this.options.enabled||"yes",await this.render()}reset(){this.value=this.initial,this.render()}delete(){this.alert()}toggle(){this.value=!this.value,this.render()}enable(){if(this.value===!0)return this.alert();this.value=!0,this.render()}disable(){if(this.value===!1)return this.alert();this.value=!1,this.render()}up(){this.toggle()}down(){this.toggle()}right(){this.toggle()}left(){this.toggle()}next(){this.toggle()}prev(){this.toggle()}dispatch(e="",r){switch(e.toLowerCase()){case" ":return this.toggle();case"1":case"y":case"t":return this.enable();case"0":case"n":case"f":return this.disable();default:return this.alert()}}format(){let e=i=>this.styles.primary.underline(i);return[this.value?this.disabled:e(this.disabled),this.value?e(this.enabled):this.enabled].join(this.styles.muted(" / "))}async render(){let{size:e}=this.state,r=await this.header(),i=await this.prefix(),s=await this.separator(),n=await this.message(),u=await this.format(),o=await this.error()||await this.hint(),a=await this.footer(),l=[i,n,s,u].join(" ");this.state.prompt=l,o&&!l.includes(o)&&(l+=" "+o),this.clear(e),this.write([r,l,a].filter(Boolean).join(`
`)),this.write(this.margin[2]),this.restore()}};Eo.exports=zi});var yo=y((yD,Ao)=>{"use strict";var Xh=We(),Vi=class extends Xh{constructor(e){if(super(e),typeof this.options.correctChoice!="number"||this.options.correctChoice<0)throw new Error("Please specify the index of the correct answer from the list of choices")}async toChoices(e,r){let i=await super.toChoices(e,r);if(i.length<2)throw new Error("Please give at least two choices to the user");if(this.options.correctChoice>i.length)throw new Error("Please specify the index of the correct answer from the list of choices");return i}check(e){return e.index===this.options.correctChoice}async result(e){return{selectedAnswer:e,correctAnswer:this.options.choices[this.options.correctChoice].value,correct:await this.check(this.state)}}};Ao.exports=Vi});var wo=y(Ki=>{"use strict";var Fo=le(),ee=(t,e)=>{Fo.defineExport(Ki,t,e),Fo.defineExport(Ki,t.toLowerCase(),e)};ee("AutoComplete",()=>Su());ee("BasicAuth",()=>Pu());ee("Confirm",()=>Mu());ee("Editable",()=>Hu());ee("Form",()=>sr());ee("Input",()=>Ti());ee("Invisible",()=>Vu());ee("List",()=>Yu());ee("MultiSelect",()=>Xu());ee("Numeral",()=>eo());ee("Password",()=>ro());ee("Scale",()=>no());ee("Select",()=>We());ee("Snippet",()=>co());ee("Sort",()=>fo());ee("Survey",()=>Do());ee("Text",()=>mo());ee("Toggle",()=>Co());ee("Quiz",()=>yo())});var bo=y((wD,_o)=>{_o.exports={ArrayPrompt:xt(),AuthPrompt:xi(),BooleanPrompt:nr(),NumberPrompt:Mi(),StringPrompt:tt()}});var So=y((_D,xo)=>{"use strict";var vo=require("assert"),Qi=require("events"),Ue=le(),ve=class extends Qi{constructor(e,r){super(),this.options=Ue.merge({},e),this.answers={...r}}register(e,r){if(Ue.isObject(e)){for(let s of Object.keys(e))this.register(s,e[s]);return this}vo.equal(typeof r,"function","expected a function");let i=e.toLowerCase();return r.prototype instanceof this.Prompt?this.prompts[i]=r:this.prompts[i]=r(this.Prompt,this),this}async prompt(e=[]){for(let r of[].concat(e))try{typeof r=="function"&&(r=await r.call(this)),await this.ask(Ue.merge({},this.options,r))}catch(i){return Promise.reject(i)}return this.answers}async ask(e){typeof e=="function"&&(e=await e.call(this));let r=Ue.merge({},this.options,e),{type:i,name:s}=e,{set:n,get:u}=Ue;if(typeof i=="function"&&(i=await i.call(this,e,this.answers)),!i)return this.answers[s];vo(this.prompts[i],`Prompt "${i}" is not registered`);let o=new this.prompts[i](r),a=u(this.answers,s);o.state.answers=this.answers,o.enquirer=this,s&&o.on("submit",c=>{this.emit("answer",s,c,o),n(this.answers,s,c)});let l=o.emit.bind(o);return o.emit=(...c)=>(this.emit.call(this,...c),l(...c)),this.emit("prompt",o,this),r.autofill&&a!=null?(o.value=o.input=a,r.autofill==="show"&&await o.submit()):a=o.value=await o.run(),a}use(e){return e.call(this,this),this}set Prompt(e){this._Prompt=e}get Prompt(){return this._Prompt||this.constructor.Prompt}get prompts(){return this.constructor.prompts}static set Prompt(e){this._Prompt=e}static get Prompt(){return this._Prompt||ht()}static get prompts(){return wo()}static get types(){return bo()}static get prompt(){let e=(r,...i)=>{let s=new this(...i),n=s.emit.bind(s);return s.emit=(...u)=>(e.emit(...u),n(...u)),s.prompt(r)};return Ue.mixinEmitter(e,new Qi),e}};Ue.mixinEmitter(ve,new Qi);var Yi=ve.prompts;for(let t of Object.keys(Yi)){let e=t.toLowerCase(),r=i=>new Yi[t](i).run();ve.prompt[e]=r,ve[e]=r,ve[t]||Reflect.defineProperty(ve,t,{get:()=>Yi[t]})}var St=t=>{Ue.defineExport(ve,t,()=>ve.types[t])};St("ArrayPrompt");St("AuthPrompt");St("BooleanPrompt");St("NumberPrompt");St("StringPrompt");xo.exports=ve});var Bt=y((bD,To)=>{"use strict";var Zh=require("path"),Oe="\\\\/",Bo=`[^${Oe}]`,ke="\\.",Jh="\\+",ef="\\?",or="\\/",tf="(?=.)",Ro="[^/]",Xi=`(?:${or}|$)`,Oo=`(?:^|${or})`,Zi=`${ke}{1,2}${Xi}`,rf=`(?!${ke})`,sf=`(?!${Oo}${Zi})`,nf=`(?!${ke}{0,1}${Xi})`,uf=`(?!${Zi})`,of=`[^.${or}]`,af=`${Ro}*?`,Lo={DOT_LITERAL:ke,PLUS_LITERAL:Jh,QMARK_LITERAL:ef,SLASH_LITERAL:or,ONE_CHAR:tf,QMARK:Ro,END_ANCHOR:Xi,DOTS_SLASH:Zi,NO_DOT:rf,NO_DOTS:sf,NO_DOT_SLASH:nf,NO_DOTS_SLASH:uf,QMARK_NO_DOT:of,STAR:af,START_ANCHOR:Oo},lf={...Lo,SLASH_LITERAL:`[${Oe}]`,QMARK:Bo,STAR:`${Bo}*?`,DOTS_SLASH:`${ke}{1,2}(?:[${Oe}]|$)`,NO_DOT:`(?!${ke})`,NO_DOTS:`(?!(?:^|[${Oe}])${ke}{1,2}(?:[${Oe}]|$))`,NO_DOT_SLASH:`(?!${ke}{0,1}(?:[${Oe}]|$))`,NO_DOTS_SLASH:`(?!${ke}{1,2}(?:[${Oe}]|$))`,QMARK_NO_DOT:`[^.${Oe}]`,START_ANCHOR:`(?:^|[${Oe}])`,END_ANCHOR:`(?:[${Oe}]|$)`},cf={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};To.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:cf,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|Line truncated
`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var Va=y((WD,za)=>{"use strict";var y0=gr(),{MAX_LENGTH:Ga,CHAR_BACKSLASH:Es,CHAR_BACKTICK:F0,CHAR_COMMA:w0,CHAR_DOT:_0,CHAR_LEFT_PARENTHESES:b0,CHAR_RIGHT_PARENTHESES:v0,CHAR_LEFT_CURLY_BRACE:x0,CHAR_RIGHT_CURLY_BRACE:S0,CHAR_LEFT_SQUARE_BRACKET:Wa,CHAR_RIGHT_SQUARE_BRACKET:Ua,CHAR_DOUBLE_QUOTE:B0,CHAR_SINGLE_QUOTE:R0,CHAR_NO_BREAK_SPACE:O0,CHAR_ZERO_WIDTH_NOBREAK_SPACE:L0}=ja(),T0=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},i=typeof r.maxLength=="number"?Math.min(Ga,r.maxLength):Ga;if(t.length>i)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${i})`);let s={type:"root",input:t,nodes:[]},n=[s],u=s,o=s,a=0,l=t.length,c=0,h=0,f,p=()=>t[c++],D=d=>{if(d.type==="text"&&o.type==="dot"&&(o.type="text"),o&&o.type==="text"&&d.type==="text"){o.value+=d.value;return}return u.nodes.push(d),d.parent=u,d.prev=o,o=d,d};for(D({type:"bos"});c<l;)if(u=n[n.length-1],f=p(),!(f===L0||f===O0)){if(f===Es){D({type:"text",value:(e.keepEscaping?f:"")+p()});continue}if(f===Ua){D({type:"text",value:"\\"+f});continue}if(f===Wa){a++;let d;for(;c<l&&(d=p());){if(f+=d,d===Wa){a++;continue}if(d===Es){f+=p();continue}if(d===Ua&&(a--,a===0))break}D({type:"text",value:f});continue}if(f===b0){u=D({type:"paren",nodes:[]}),n.push(u),D({type:"text",value:f});continue}if(f===v0){if(u.type!=="paren"){D({type:"text",value:f});continue}u=n.pop(),D({type:"text",value:f}),u=n[n.length-1];continue}if(f===B0||f===R0||f===F0){let d=f,v;for(e.keepQuotes!==!0&&(f="");c<l&&(v=p());){if(v===Es){f+=v+p();continue}if(v===d){e.keepQuotes===!0&&(f+=v);break}f+=v}D({type:"text",value:f});continue}if(f===x0){h++;let v={type:"brace",open:!0,close:!1,dollar:o.value&&o.value.slice(-1)==="$"||u.dollar===!0,depth:h,commas:0,ranges:0,nodes:[]};u=D(v),n.push(u),D({type:"open",value:f});continue}if(f===S0){if(u.type!=="brace"){D({type:"text",value:f});continue}let d="close";u=n.pop(),u.close=!0,D({type:d,value:f}),h--,u=n[n.length-1];continue}if(f===w0&&h>0){if(u.ranges>0){u.ranges=0;let d=u.nodes.shift();u.nodes=[d,{type:"text",value:y0(u)}]}D({type:"comma",value:f}),u.commas++;continue}if(f===_0&&h>0&&u.commas===0){let d=u.nodes;if(h===0||d.length===0){D({type:"text",value:f});continue}if(o.type==="dot"){if(u.range=[],o.value+=f,o.type="range",u.nodes.length!==3&&u.nodes.length!==5){u.invalid=!0,u.ranges=0,o.type="text";continue}u.ranges++,u.args=[];continue}if(o.type==="range"){d.pop();let v=d[d.length-1];v.value+=o.value+f,o=v,u.ranges--;continue}D({type:"dot",value:f});continue}D({type:"text",value:f})}do if(u=n.pop(),u.type!=="root"){u.nodes.forEach(g=>{g.nodes||(g.type==="open"&&(g.isOpen=!0),g.type==="close"&&(g.isClose=!0),g.nodes||(g.type="text"),g.invalid=!0)});let d=n[n.length-1],v=d.nodes.indexOf(u);d.nodes.splice(v,1,...u.nodes)}while(n.length>0);return D({type:"eos"}),s};za.exports=T0});var Qa=y((UD,Ya)=>{"use strict";var Ka=gr(),N0=ka(),P0=Ha(),I0=Va(),Ee=(t,e={})=>{let r=[];if(Array.isArray(t))for(let i of t){let s=Ee.create(i,e);Array.isArray(s)?r.push(...s):r.push(s)}else r=[].concat(Ee.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};Ee.parse=(t,e={})=>I0(t,e);Ee.stringify=(t,e={})=>Ka(typeof t=="string"?Ee.parse(t,e):t,e);Ee.compile=(t,e={})=>(typeof t=="string"&&(t=Ee.parse(t,e)),N0(t,e));Ee.expand=(t,e={})=>{typeof t=="string"&&(t=Ee.parse(t,e));let r=P0(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};Ee.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?Ee.compile(t,e):Ee.expand(t,e);Ya.exports=Ee});var Xa=y((zD,k0)=>{k0.exports=["3dm","3ds","3g2","3gp","7z","a","aac","adp","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","p Line truncated
/*! Bundled license information:
normalize-path/index.js:
(*!
* normalize-path <https://github.com/jonschlinkert/normalize-path>
*
* Copyright (c) 2014-2018, Jon Schlinkert.
* Released under the MIT License.
*)
is-extglob/index.js:
(*!
* is-extglob <https://github.com/jonschlinkert/is-extglob>
*
* Copyright (c) 2014-2016, Jon Schlinkert.
* Licensed under the MIT License.
*)
is-glob/index.js:
(*!
* is-glob <https://github.com/jonschlinkert/is-glob>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*)
is-number/index.js:
(*!
* is-number <https://github.com/jonschlinkert/is-number>
*
* Copyright (c) 2014-present, Jon Schlinkert.
* Released under the MIT License.
*)
to-regex-range/index.js:
(*!
* to-regex-range <https://github.com/micromatch/to-regex-range>
*
* Copyright (c) 2015-present, Jon Schlinkert.
* Released under the MIT License.
*)
fill-range/index.js:
(*!
* fill-range <https://github.com/jonschlinkert/fill-range>
*
* Copyright (c) 2014-present, Jon Schlinkert.
* Licensed under the MIT License.
*)
*/
+250
View File
@@ -0,0 +1,250 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var fixtureRunner_exports = {};
__export(fixtureRunner_exports, {
FixtureRunner: () => FixtureRunner
});
module.exports = __toCommonJS(fixtureRunner_exports);
var import_utils = require("playwright-core/lib/utils");
var import_fixtures = require("../common/fixtures");
var import_util = require("../util");
class Fixture {
constructor(runner, registration) {
this.failed = false;
this._deps = /* @__PURE__ */ new Set();
this._usages = /* @__PURE__ */ new Set();
this.runner = runner;
this.registration = registration;
this.value = null;
const isUserFixture = this.registration.location && (0, import_util.filterStackFile)(this.registration.location.file);
const title = this.registration.customTitle || this.registration.name;
const location = isUserFixture ? this.registration.location : void 0;
this._stepInfo = { title: `Fixture ${(0, import_utils.escapeWithQuotes)(title, '"')}`, category: "fixture", location };
if (this.registration.box)
this._stepInfo.group = isUserFixture ? "configuration" : "internal";
this._setupDescription = {
title,
phase: "setup",
location,
slot: this.registration.timeout === void 0 ? void 0 : {
timeout: this.registration.timeout,
elapsed: 0
}
};
this._teardownDescription = { ...this._setupDescription, phase: "teardown" };
}
async setup(testInfo, runnable) {
this.runner.instanceForId.set(this.registration.id, this);
if (typeof this.registration.fn !== "function") {
this.value = this.registration.fn;
return;
}
await testInfo._runAsStep(this._stepInfo, async () => {
await testInfo._runWithTimeout({ ...runnable, fixture: this._setupDescription }, () => this._setupInternal(testInfo));
});
}
async _setupInternal(testInfo) {
const params = {};
for (const name of this.registration.deps) {
const registration = this.runner.pool.resolve(name, this.registration);
const dep = this.runner.instanceForId.get(registration.id);
if (!dep) {
this.failed = true;
return;
}
dep._usages.add(this);
this._deps.add(dep);
params[name] = dep.value;
if (dep.failed) {
this.failed = true;
return;
}
}
let called = false;
const useFuncStarted = new import_utils.ManualPromise();
const useFunc = async (value) => {
if (called)
throw new Error(`Cannot provide fixture value for the second time`);
called = true;
this.value = value;
this._useFuncFinished = new import_utils.ManualPromise();
useFuncStarted.resolve();
await this._useFuncFinished;
};
const workerInfo = { config: testInfo.config, parallelIndex: testInfo.parallelIndex, workerIndex: testInfo.workerIndex, project: testInfo.project };
const info = this.registration.scope === "worker" ? workerInfo : testInfo;
this._selfTeardownComplete = (async () => {
try {
await this.registration.fn(params, useFunc, info);
} catch (error) {
this.failed = true;
if (!useFuncStarted.isDone())
useFuncStarted.reject(error);
else
throw error;
}
})();
await useFuncStarted;
}
async teardown(testInfo, runnable) {
try {
const fixtureRunnable = { ...runnable, fixture: this._teardownDescription };
if (!testInfo._timeoutManager.isTimeExhaustedFor(fixtureRunnable)) {
await testInfo._runAsStep(this._stepInfo, async () => {
await testInfo._runWithTimeout(fixtureRunnable, () => this._teardownInternal());
});
}
} finally {
for (const dep of this._deps)
dep._usages.delete(this);
this.runner.instanceForId.delete(this.registration.id);
}
}
async _teardownInternal() {
if (typeof this.registration.fn !== "function")
return;
if (this._usages.size !== 0) {
console.error("Internal error: fixture integrity at", this._teardownDescription.title);
this._usages.clear();
}
if (this._useFuncFinished) {
this._useFuncFinished.resolve();
this._useFuncFinished = void 0;
await this._selfTeardownComplete;
}
}
_collectFixturesInTeardownOrder(scope, collector) {
if (this.registration.scope !== scope)
return;
for (const fixture of this._usages)
fixture._collectFixturesInTeardownOrder(scope, collector);
collector.add(this);
}
}
class FixtureRunner {
constructor() {
this.testScopeClean = true;
this.instanceForId = /* @__PURE__ */ new Map();
}
setPool(pool) {
if (!this.testScopeClean)
throw new Error("Did not teardown test scope");
if (this.pool && pool.digest !== this.pool.digest) {
throw new Error([
`Playwright detected inconsistent test.use() options.`,
`Most common mistakes that lead to this issue:`,
` - Calling test.use() outside of the test file, for example in a common helper.`,
` - One test file imports from another test file.`
].join("\n"));
}
this.pool = pool;
}
_collectFixturesInSetupOrder(registration, collector) {
if (collector.has(registration))
return;
for (const name of registration.deps) {
const dep = this.pool.resolve(name, registration);
this._collectFixturesInSetupOrder(dep, collector);
}
collector.add(registration);
}
async teardownScope(scope, testInfo, runnable) {
const fixtures = Array.from(this.instanceForId.values()).reverse();
const collector = /* @__PURE__ */ new Set();
for (const fixture of fixtures)
fixture._collectFixturesInTeardownOrder(scope, collector);
let firstError;
for (const fixture of collector) {
try {
await fixture.teardown(testInfo, runnable);
} catch (error) {
firstError = firstError ?? error;
}
}
if (scope === "test")
this.testScopeClean = true;
if (firstError)
throw firstError;
}
async resolveParametersForFunction(fn, testInfo, autoFixtures, runnable) {
const collector = /* @__PURE__ */ new Set();
const auto = [];
for (const registration of this.pool.autoFixtures()) {
let shouldRun = true;
if (autoFixtures === "all-hooks-only")
shouldRun = registration.scope === "worker" || registration.auto === "all-hooks-included";
else if (autoFixtures === "worker")
shouldRun = registration.scope === "worker";
if (shouldRun)
auto.push(registration);
}
auto.sort((r1, r2) => (r1.scope === "worker" ? 0 : 1) - (r2.scope === "worker" ? 0 : 1));
for (const registration of auto)
this._collectFixturesInSetupOrder(registration, collector);
const names = getRequiredFixtureNames(fn);
for (const name of names)
this._collectFixturesInSetupOrder(this.pool.resolve(name), collector);
for (const registration of collector)
await this._setupFixtureForRegistration(registration, testInfo, runnable);
const params = {};
for (const name of names) {
const registration = this.pool.resolve(name);
const fixture = this.instanceForId.get(registration.id);
if (!fixture || fixture.failed)
return null;
params[name] = fixture.value;
}
return params;
}
async resolveParametersAndRunFunction(fn, testInfo, autoFixtures, runnable) {
const params = await this.resolveParametersForFunction(fn, testInfo, autoFixtures, runnable);
if (params === null) {
return null;
}
await testInfo._runWithTimeout(runnable, () => fn(params, testInfo));
}
async _setupFixtureForRegistration(registration, testInfo, runnable) {
if (registration.scope === "test")
this.testScopeClean = false;
let fixture = this.instanceForId.get(registration.id);
if (fixture)
return fixture;
fixture = new Fixture(this, registration);
await fixture.setup(testInfo, runnable);
return fixture;
}
dependsOnWorkerFixturesOnly(fn, location) {
const names = getRequiredFixtureNames(fn, location);
for (const name of names) {
const registration = this.pool.resolve(name);
if (registration.scope !== "worker")
return false;
}
return true;
}
}
function getRequiredFixtureNames(fn, location) {
return (0, import_fixtures.fixtureParameterNames)(fn, location ?? { file: "<unknown>", line: 1, column: 1 }, (e) => {
throw new Error(`${(0, import_util.formatLocation)(e.location)}: ${e.message}`);
});
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
FixtureRunner
});
+517
View File
@@ -0,0 +1,517 @@
"use strict";
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 __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);
var testInfo_exports = {};
__export(testInfo_exports, {
StepSkipError: () => StepSkipError,
TestInfoImpl: () => TestInfoImpl,
TestSkipError: () => TestSkipError,
TestStepInfoImpl: () => TestStepInfoImpl
});
module.exports = __toCommonJS(testInfo_exports);
var import_fs = __toESM(require("fs"));
var import_path = __toESM(require("path"));
var import_utils = require("playwright-core/lib/utils");
var import_timeoutManager = require("./timeoutManager");
var import_util = require("../util");
var import_testTracing = require("./testTracing");
var import_util2 = require("./util");
var import_transform = require("../transform/transform");
class TestInfoImpl {
constructor(configInternal, projectInternal, workerParams, test, retry, onStepBegin, onStepRecoverFromError, onStepEnd, onAttach) {
this._snapshotNames = { lastAnonymousSnapshotIndex: 0, lastNamedSnapshotIndex: {} };
this._ariaSnapshotNames = { lastAnonymousSnapshotIndex: 0, lastNamedSnapshotIndex: {} };
this._wasInterrupted = false;
this._lastStepId = 0;
this._steps = [];
this._stepMap = /* @__PURE__ */ new Map();
this._hasNonRetriableError = false;
this._hasUnhandledError = false;
this._allowSkips = false;
this.duration = 0;
this.annotations = [];
this.attachments = [];
this.status = "passed";
this.snapshotSuffix = "";
this.errors = [];
this.testId = test?.id ?? "";
this._onStepBegin = onStepBegin;
this._onStepRecoverFromError = onStepRecoverFromError;
this._onStepEnd = onStepEnd;
this._onAttach = onAttach;
this._startTime = (0, import_utils.monotonicTime)();
this._startWallTime = Date.now();
this._requireFile = test?._requireFile ?? "";
this._uniqueSymbol = Symbol("testInfoUniqueSymbol");
this.repeatEachIndex = workerParams.repeatEachIndex;
this.retry = retry;
this.workerIndex = workerParams.workerIndex;
this.parallelIndex = workerParams.parallelIndex;
this._projectInternal = projectInternal;
this.project = projectInternal.project;
this._configInternal = configInternal;
this.config = configInternal.config;
this.title = test?.title ?? "";
this.titlePath = test?.titlePath() ?? [];
this.file = test?.location.file ?? "";
this.line = test?.location.line ?? 0;
this.column = test?.location.column ?? 0;
this.tags = test?.tags ?? [];
this.fn = test?.fn ?? (() => {
});
this.expectedStatus = test?.expectedStatus ?? "skipped";
this._recoverFromStepErrorResults = workerParams.recoverFromStepErrors ? /* @__PURE__ */ new Map() : void 0;
this._timeoutManager = new import_timeoutManager.TimeoutManager(this.project.timeout);
if (configInternal.configCLIOverrides.debug)
this._setDebugMode();
this.outputDir = (() => {
const relativeTestFilePath = import_path.default.relative(this.project.testDir, this._requireFile.replace(/\.(spec|test)\.(js|ts|jsx|tsx|mjs|mts|cjs|cts)$/, ""));
const sanitizedRelativePath = relativeTestFilePath.replace(process.platform === "win32" ? new RegExp("\\\\", "g") : new RegExp("/", "g"), "-");
const fullTitleWithoutSpec = this.titlePath.slice(1).join(" ");
let testOutputDir = (0, import_util.trimLongString)(sanitizedRelativePath + "-" + (0, import_utils.sanitizeForFilePath)(fullTitleWithoutSpec), import_util.windowsFilesystemFriendlyLength);
if (projectInternal.id)
testOutputDir += "-" + (0, import_utils.sanitizeForFilePath)(projectInternal.id);
if (this.retry)
testOutputDir += "-retry" + this.retry;
if (this.repeatEachIndex)
testOutputDir += "-repeat" + this.repeatEachIndex;
return import_path.default.join(this.project.outputDir, testOutputDir);
})();
this.snapshotDir = (() => {
const relativeTestFilePath = import_path.default.relative(this.project.testDir, this._requireFile);
return import_path.default.join(this.project.snapshotDir, relativeTestFilePath + "-snapshots");
})();
this._attachmentsPush = this.attachments.push.bind(this.attachments);
this.attachments.push = (...attachments) => {
for (const a of attachments)
this._attach(a, this._parentStep()?.stepId);
return this.attachments.length;
};
this._tracing = new import_testTracing.TestTracing(this, workerParams.artifactsDir);
this.skip = (0, import_transform.wrapFunctionWithLocation)((location, ...args) => this._modifier("skip", location, args));
this.fixme = (0, import_transform.wrapFunctionWithLocation)((location, ...args) => this._modifier("fixme", location, args));
this.fail = (0, import_transform.wrapFunctionWithLocation)((location, ...args) => this._modifier("fail", location, args));
this.slow = (0, import_transform.wrapFunctionWithLocation)((location, ...args) => this._modifier("slow", location, args));
}
get error() {
return this.errors[0];
}
set error(e) {
if (e === void 0)
throw new Error("Cannot assign testInfo.error undefined value!");
this.errors[0] = e;
}
get timeout() {
return this._timeoutManager.defaultSlot().timeout;
}
set timeout(timeout) {
}
_deadlineForMatcher(timeout) {
const startTime = (0, import_utils.monotonicTime)();
const matcherDeadline = timeout ? startTime + timeout : import_timeoutManager.kMaxDeadline;
const testDeadline = this._timeoutManager.currentSlotDeadline() - 250;
const matcherMessage = `Timeout ${timeout}ms exceeded while waiting on the predicate`;
const testMessage = `Test timeout of ${this.timeout}ms exceeded`;
return { deadline: Math.min(testDeadline, matcherDeadline), timeoutMessage: testDeadline < matcherDeadline ? testMessage : matcherMessage };
}
static _defaultDeadlineForMatcher(timeout) {
return { deadline: timeout ? (0, import_utils.monotonicTime)() + timeout : 0, timeoutMessage: `Timeout ${timeout}ms exceeded while waiting on the predicate` };
}
_modifier(type, location, modifierArgs) {
if (typeof modifierArgs[1] === "function") {
throw new Error([
"It looks like you are calling test.skip() inside the test and pass a callback.",
"Pass a condition instead and optional description instead:",
`test('my test', async ({ page, isMobile }) => {`,
` test.skip(isMobile, 'This test is not applicable on mobile');`,
`});`
].join("\n"));
}
if (modifierArgs.length >= 1 && !modifierArgs[0])
return;
const description = modifierArgs[1];
this.annotations.push({ type, description, location });
if (type === "slow") {
this._timeoutManager.slow();
} else if (type === "skip" || type === "fixme") {
this.expectedStatus = "skipped";
throw new TestSkipError("Test is skipped: " + (description || ""));
} else if (type === "fail") {
if (this.expectedStatus !== "skipped")
this.expectedStatus = "failed";
}
}
_findLastPredefinedStep(steps) {
for (let i = steps.length - 1; i >= 0; i--) {
const child = this._findLastPredefinedStep(steps[i].steps);
if (child)
return child;
if ((steps[i].category === "hook" || steps[i].category === "fixture") && !steps[i].endWallTime)
return steps[i];
}
}
_parentStep() {
return (0, import_utils.currentZone)().data("stepZone") ?? this._findLastPredefinedStep(this._steps);
}
_addStep(data, parentStep) {
const stepId = `${data.category}@${++this._lastStepId}`;
if (data.category === "hook" || data.category === "fixture") {
parentStep = this._findLastPredefinedStep(this._steps);
} else {
if (!parentStep)
parentStep = this._parentStep();
}
const filteredStack = (0, import_util.filteredStackTrace)((0, import_utils.captureRawStack)());
let boxedStack = parentStep?.boxedStack;
let location = data.location;
if (!boxedStack && data.box) {
boxedStack = filteredStack.slice(1);
location = location || boxedStack[0];
}
location = location || filteredStack[0];
const step = {
...data,
stepId,
group: parentStep?.group ?? data.group,
boxedStack,
location,
steps: [],
attachmentIndices: [],
info: new TestStepInfoImpl(this, stepId, data.title, parentStep?.info),
recoverFromStepError: async (error) => {
if (!this._recoverFromStepErrorResults)
return { stepId, status: "failed" };
const payload = {
testId: this.testId,
stepId,
error: (0, import_util.serializeError)(error)
};
this._onStepRecoverFromError(payload);
const recoveryPromise = new import_utils.ManualPromise();
this._recoverFromStepErrorResults.set(stepId, recoveryPromise);
const recoveryResult = await recoveryPromise;
if (recoveryResult.stepId !== stepId)
return { stepId, status: "failed" };
return recoveryResult;
},
complete: (result) => {
if (step.endWallTime)
return;
step.endWallTime = Date.now();
if (result.error) {
if (typeof result.error === "object" && !result.error?.[stepSymbol])
result.error[stepSymbol] = step;
const error = (0, import_util2.testInfoError)(result.error);
if (step.boxedStack)
error.stack = `${error.message}
${(0, import_utils.stringifyStackFrames)(step.boxedStack).join("\n")}`;
step.error = error;
}
if (!step.error) {
for (const childStep of step.steps) {
if (childStep.error && childStep.infectParentStepsWithError) {
step.error = childStep.error;
step.infectParentStepsWithError = true;
break;
}
}
}
if (!step.group) {
const payload = {
testId: this.testId,
stepId,
wallTime: step.endWallTime,
error: step.error,
suggestedRebaseline: result.suggestedRebaseline,
annotations: step.info.annotations
};
this._onStepEnd(payload);
}
if (step.group !== "internal") {
const errorForTrace = step.error ? { name: "", message: step.error.message || "", stack: step.error.stack } : void 0;
const attachments = step.attachmentIndices.map((i) => this.attachments[i]);
this._tracing.appendAfterActionForStep(stepId, errorForTrace, attachments, step.info.annotations);
}
}
};
const parentStepList = parentStep ? parentStep.steps : this._steps;
parentStepList.push(step);
this._stepMap.set(stepId, step);
if (!step.group) {
const payload = {
testId: this.testId,
stepId,
parentStepId: parentStep ? parentStep.stepId : void 0,
title: step.title,
category: step.category,
wallTime: Date.now(),
location: step.location
};
this._onStepBegin(payload);
}
if (step.group !== "internal") {
this._tracing.appendBeforeActionForStep({
stepId,
parentId: parentStep?.stepId,
title: step.title,
category: step.category,
params: step.params,
stack: step.location ? [step.location] : [],
group: step.group
});
}
return step;
}
resumeAfterStepError(result) {
const recoveryPromise = this._recoverFromStepErrorResults?.get(result.stepId);
if (recoveryPromise)
recoveryPromise.resolve(result);
}
_interrupt() {
this._wasInterrupted = true;
this._timeoutManager.interrupt();
if (this.status === "passed")
this.status = "interrupted";
}
_failWithError(error) {
if (this.status === "passed" || this.status === "skipped")
this.status = error instanceof import_timeoutManager.TimeoutManagerError ? "timedOut" : "failed";
const serialized = (0, import_util2.testInfoError)(error);
const step = typeof error === "object" ? error?.[stepSymbol] : void 0;
if (step && step.boxedStack)
serialized.stack = `${error.name}: ${error.message}
${(0, import_utils.stringifyStackFrames)(step.boxedStack).join("\n")}`;
this.errors.push(serialized);
this._tracing.appendForError(serialized);
}
async _runAsStep(stepInfo, cb) {
const step = this._addStep(stepInfo);
try {
await cb();
step.complete({});
} catch (error) {
step.complete({ error });
throw error;
}
}
async _runWithTimeout(runnable, cb) {
try {
await this._timeoutManager.withRunnable(runnable, async () => {
try {
await cb();
} catch (e) {
if (this._allowSkips && e instanceof TestSkipError) {
if (this.status === "passed")
this.status = "skipped";
} else {
this._failWithError(e);
}
throw e;
}
});
} catch (error) {
if (!this._wasInterrupted && error instanceof import_timeoutManager.TimeoutManagerError)
this._failWithError(error);
throw error;
}
}
_isFailure() {
return this.status !== "skipped" && this.status !== this.expectedStatus;
}
_currentHookType() {
const type = this._timeoutManager.currentSlotType();
return ["beforeAll", "afterAll", "beforeEach", "afterEach"].includes(type) ? type : void 0;
}
_setDebugMode() {
this._timeoutManager.setIgnoreTimeouts();
}
// ------------ TestInfo methods ------------
async attach(name, options = {}) {
const step = this._addStep({
title: `Attach ${(0, import_utils.escapeWithQuotes)(name, '"')}`,
category: "test.attach"
});
this._attach(await (0, import_util.normalizeAndSaveAttachment)(this.outputPath(), name, options), step.stepId);
step.complete({});
}
_attach(attachment, stepId) {
const index = this._attachmentsPush(attachment) - 1;
if (stepId) {
this._stepMap.get(stepId).attachmentIndices.push(index);
} else {
const stepId2 = `attach@${(0, import_utils.createGuid)()}`;
this._tracing.appendBeforeActionForStep({ stepId: stepId2, title: `Attach ${(0, import_utils.escapeWithQuotes)(attachment.name, '"')}`, category: "test.attach", stack: [] });
this._tracing.appendAfterActionForStep(stepId2, void 0, [attachment]);
}
this._onAttach({
testId: this.testId,
name: attachment.name,
contentType: attachment.contentType,
path: attachment.path,
body: attachment.body?.toString("base64"),
stepId
});
}
outputPath(...pathSegments) {
const outputPath = this._getOutputPath(...pathSegments);
import_fs.default.mkdirSync(this.outputDir, { recursive: true });
return outputPath;
}
_getOutputPath(...pathSegments) {
const joinedPath = import_path.default.join(...pathSegments);
const outputPath = (0, import_util.getContainedPath)(this.outputDir, joinedPath);
if (outputPath)
return outputPath;
throw new Error(`The outputPath is not allowed outside of the parent directory. Please fix the defined path.
outputPath: ${joinedPath}`);
}
_fsSanitizedTestName() {
const fullTitleWithoutSpec = this.titlePath.slice(1).join(" ");
return (0, import_utils.sanitizeForFilePath)((0, import_util.trimLongString)(fullTitleWithoutSpec));
}
_resolveSnapshotPaths(kind, name, updateSnapshotIndex, anonymousExtension) {
const snapshotNames = kind === "aria" ? this._ariaSnapshotNames : this._snapshotNames;
const defaultExtensions = { "aria": ".aria.yml", "screenshot": ".png", "snapshot": ".txt" };
const ariaAwareExtname = (filePath) => kind === "aria" && filePath.endsWith(".aria.yml") ? ".aria.yml" : import_path.default.extname(filePath);
let subPath;
let ext;
let relativeOutputPath;
if (!name) {
const index = snapshotNames.lastAnonymousSnapshotIndex + 1;
if (updateSnapshotIndex === "updateSnapshotIndex")
snapshotNames.lastAnonymousSnapshotIndex = index;
const fullTitleWithoutSpec = [...this.titlePath.slice(1), index].join(" ");
ext = anonymousExtension ?? defaultExtensions[kind];
subPath = (0, import_util.sanitizeFilePathBeforeExtension)((0, import_util.trimLongString)(fullTitleWithoutSpec) + ext, ext);
relativeOutputPath = (0, import_util.sanitizeFilePathBeforeExtension)((0, import_util.trimLongString)(fullTitleWithoutSpec, import_util.windowsFilesystemFriendlyLength) + ext, ext);
} else {
if (Array.isArray(name)) {
subPath = import_path.default.join(...name);
relativeOutputPath = import_path.default.join(...name);
ext = ariaAwareExtname(subPath);
} else {
ext = ariaAwareExtname(name);
subPath = (0, import_util.sanitizeFilePathBeforeExtension)(name, ext);
relativeOutputPath = (0, import_util.sanitizeFilePathBeforeExtension)((0, import_util.trimLongString)(name, import_util.windowsFilesystemFriendlyLength), ext);
}
const index = (snapshotNames.lastNamedSnapshotIndex[relativeOutputPath] || 0) + 1;
if (updateSnapshotIndex === "updateSnapshotIndex")
snapshotNames.lastNamedSnapshotIndex[relativeOutputPath] = index;
if (index > 1)
relativeOutputPath = (0, import_util.addSuffixToFilePath)(relativeOutputPath, `-${index - 1}`);
}
const absoluteSnapshotPath = this._applyPathTemplate(kind, subPath, ext);
return { absoluteSnapshotPath, relativeOutputPath };
}
_applyPathTemplate(kind, relativePath, ext) {
const legacyTemplate = "{snapshotDir}/{testFileDir}/{testFileName}-snapshots/{arg}{-projectName}{-snapshotSuffix}{ext}";
let template;
if (kind === "screenshot") {
template = this._projectInternal.expect?.toHaveScreenshot?.pathTemplate || this._projectInternal.snapshotPathTemplate || legacyTemplate;
} else if (kind === "aria") {
const ariaDefaultTemplate = "{snapshotDir}/{testFileDir}/{testFileName}-snapshots/{arg}{ext}";
template = this._projectInternal.expect?.toMatchAriaSnapshot?.pathTemplate || this._projectInternal.snapshotPathTemplate || ariaDefaultTemplate;
} else {
template = this._projectInternal.snapshotPathTemplate || legacyTemplate;
}
const dir = import_path.default.dirname(relativePath);
const name = import_path.default.basename(relativePath, ext);
const relativeTestFilePath = import_path.default.relative(this.project.testDir, this._requireFile);
const parsedRelativeTestFilePath = import_path.default.parse(relativeTestFilePath);
const projectNamePathSegment = (0, import_utils.sanitizeForFilePath)(this.project.name);
const snapshotPath = template.replace(/\{(.)?testDir\}/g, "$1" + this.project.testDir).replace(/\{(.)?snapshotDir\}/g, "$1" + this.project.snapshotDir).replace(/\{(.)?snapshotSuffix\}/g, this.snapshotSuffix ? "$1" + this.snapshotSuffix : "").replace(/\{(.)?testFileDir\}/g, "$1" + parsedRelativeTestFilePath.dir).replace(/\{(.)?platform\}/g, "$1" + process.platform).replace(/\{(.)?projectName\}/g, projectNamePathSegment ? "$1" + projectNamePathSegment : "").replace(/\{(.)?testName\}/g, "$1" + this._fsSanitizedTestName()).replace(/\{(.)?testFileName\}/g, "$1" + parsedRelativeTestFilePath.base).replace(/\{(.)?testFilePath\}/g, "$1" + relativeTestFilePath).replace(/\{(.)?arg\}/g, "$1" + import_path.default.join(dir, name)).replace(/\{(.)?ext\}/g, ext ? "$1" + ext : "");
return import_path.default.normalize(import_path.default.resolve(this._configInternal.configDir, snapshotPath));
}
snapshotPath(...args) {
let name = args;
let kind = "snapshot";
const options = args[args.length - 1];
if (options && typeof options === "object") {
kind = options.kind ?? kind;
name = args.slice(0, -1);
}
if (!["snapshot", "screenshot", "aria"].includes(kind))
throw new Error(`testInfo.snapshotPath: unknown kind "${kind}", must be one of "snapshot", "screenshot" or "aria"`);
return this._resolveSnapshotPaths(kind, name.length <= 1 ? name[0] : name, "dontUpdateSnapshotIndex").absoluteSnapshotPath;
}
setTimeout(timeout) {
this._timeoutManager.setTimeout(timeout);
}
}
class TestStepInfoImpl {
constructor(testInfo, stepId, title, parentStep) {
this.annotations = [];
this._testInfo = testInfo;
this._stepId = stepId;
this._title = title;
this._parentStep = parentStep;
this.skip = (0, import_transform.wrapFunctionWithLocation)((location, ...args) => {
if (args.length > 0 && !args[0])
return;
const description = args[1];
this.annotations.push({ type: "skip", description, location });
throw new StepSkipError(description);
});
}
async _runStepBody(skip, body, location) {
if (skip) {
this.annotations.push({ type: "skip", location });
return void 0;
}
try {
return await body(this);
} catch (e) {
if (e instanceof StepSkipError)
return void 0;
throw e;
}
}
_attachToStep(attachment) {
this._testInfo._attach(attachment, this._stepId);
}
async attach(name, options) {
this._attachToStep(await (0, import_util.normalizeAndSaveAttachment)(this._testInfo.outputPath(), name, options));
}
get titlePath() {
const parent = this._parentStep ?? this._testInfo;
return [...parent.titlePath, this._title];
}
}
class TestSkipError extends Error {
}
class StepSkipError extends Error {
}
const stepSymbol = Symbol("step");
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
StepSkipError,
TestInfoImpl,
TestSkipError,
TestStepInfoImpl
});
+344
View File
@@ -0,0 +1,344 @@
"use strict";
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 __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);
var testTracing_exports = {};
__export(testTracing_exports, {
TestTracing: () => TestTracing,
testTraceEntryName: () => testTraceEntryName
});
module.exports = __toCommonJS(testTracing_exports);
var import_fs = __toESM(require("fs"));
var import_path = __toESM(require("path"));
var import_utils = require("playwright-core/lib/utils");
var import_zipBundle = require("playwright-core/lib/zipBundle");
var import_util = require("../util");
const testTraceEntryName = "test.trace";
const version = 8;
let traceOrdinal = 0;
class TestTracing {
constructor(testInfo, artifactsDir) {
this._traceEvents = [];
this._temporaryTraceFiles = [];
this._didFinishTestFunctionAndAfterEachHooks = false;
this._testInfo = testInfo;
this._artifactsDir = artifactsDir;
this._tracesDir = import_path.default.join(this._artifactsDir, "traces");
this._contextCreatedEvent = {
version,
type: "context-options",
origin: "testRunner",
browserName: "",
options: {},
platform: process.platform,
wallTime: Date.now(),
monotonicTime: (0, import_utils.monotonicTime)(),
sdkLanguage: "javascript"
};
this._appendTraceEvent(this._contextCreatedEvent);
}
_shouldCaptureTrace() {
if (this._options?.mode === "on")
return true;
if (this._options?.mode === "retain-on-failure")
return true;
if (this._options?.mode === "on-first-retry" && this._testInfo.retry === 1)
return true;
if (this._options?.mode === "on-all-retries" && this._testInfo.retry > 0)
return true;
if (this._options?.mode === "retain-on-first-failure" && this._testInfo.retry === 0)
return true;
return false;
}
async startIfNeeded(value) {
const defaultTraceOptions = { screenshots: true, snapshots: true, sources: true, attachments: true, _live: false, mode: "off" };
if (!value) {
this._options = defaultTraceOptions;
} else if (typeof value === "string") {
this._options = { ...defaultTraceOptions, mode: value === "retry-with-trace" ? "on-first-retry" : value };
} else {
const mode = value.mode || "off";
this._options = { ...defaultTraceOptions, ...value, mode: mode === "retry-with-trace" ? "on-first-retry" : mode };
}
if (!this._shouldCaptureTrace()) {
this._options = void 0;
return;
}
if (!this._liveTraceFile && this._options._live) {
this._liveTraceFile = { file: import_path.default.join(this._tracesDir, `${this._testInfo.testId}-test.trace`), fs: new import_utils.SerializedFS() };
this._liveTraceFile.fs.mkdir(import_path.default.dirname(this._liveTraceFile.file));
const data = this._traceEvents.map((e) => JSON.stringify(e)).join("\n") + "\n";
this._liveTraceFile.fs.writeFile(this._liveTraceFile.file, data);
}
}
didFinishTestFunctionAndAfterEachHooks() {
this._didFinishTestFunctionAndAfterEachHooks = true;
}
artifactsDir() {
return this._artifactsDir;
}
tracesDir() {
return this._tracesDir;
}
traceTitle() {
return [import_path.default.relative(this._testInfo.project.testDir, this._testInfo.file) + ":" + this._testInfo.line, ...this._testInfo.titlePath.slice(1)].join(" \u203A ");
}
generateNextTraceRecordingName() {
const ordinalSuffix = traceOrdinal ? `-recording${traceOrdinal}` : "";
++traceOrdinal;
const retrySuffix = this._testInfo.retry ? `-retry${this._testInfo.retry}` : "";
return `${this._testInfo.testId}${retrySuffix}${ordinalSuffix}`;
}
_generateNextTraceRecordingPath() {
const file = import_path.default.join(this._artifactsDir, (0, import_utils.createGuid)() + ".zip");
this._temporaryTraceFiles.push(file);
return file;
}
traceOptions() {
return this._options;
}
maybeGenerateNextTraceRecordingPath() {
if (this._didFinishTestFunctionAndAfterEachHooks && this._shouldAbandonTrace())
return;
return this._generateNextTraceRecordingPath();
}
_shouldAbandonTrace() {
if (!this._options)
return true;
const testFailed = this._testInfo.status !== this._testInfo.expectedStatus;
return !testFailed && (this._options.mode === "retain-on-failure" || this._options.mode === "retain-on-first-failure");
}
async stopIfNeeded() {
if (!this._options)
return;
const error = await this._liveTraceFile?.fs.syncAndGetError();
if (error)
throw error;
if (this._shouldAbandonTrace()) {
for (const file of this._temporaryTraceFiles)
await import_fs.default.promises.unlink(file).catch(() => {
});
return;
}
const zipFile = new import_zipBundle.yazl.ZipFile();
if (!this._options?.attachments) {
for (const event of this._traceEvents) {
if (event.type === "after")
delete event.attachments;
}
}
if (this._options?.sources) {
const sourceFiles = /* @__PURE__ */ new Set();
for (const event of this._traceEvents) {
if (event.type === "before") {
for (const frame of event.stack || [])
sourceFiles.add(frame.file);
}
}
for (const sourceFile of sourceFiles) {
await import_fs.default.promises.readFile(sourceFile, "utf8").then((source) => {
zipFile.addBuffer(Buffer.from(source), "resources/src@" + (0, import_utils.calculateSha1)(sourceFile) + ".txt");
}).catch(() => {
});
}
}
const sha1s = /* @__PURE__ */ new Set();
for (const event of this._traceEvents.filter((e) => e.type === "after")) {
for (const attachment of event.attachments || []) {
let contentPromise;
if (attachment.path)
contentPromise = import_fs.default.promises.readFile(attachment.path).catch(() => void 0);
else if (attachment.base64)
contentPromise = Promise.resolve(Buffer.from(attachment.base64, "base64"));
const content = await contentPromise;
if (content === void 0)
continue;
const sha1 = (0, import_utils.calculateSha1)(content);
attachment.sha1 = sha1;
delete attachment.path;
delete attachment.base64;
if (sha1s.has(sha1))
continue;
sha1s.add(sha1);
zipFile.addBuffer(content, "resources/" + sha1);
}
}
const traceContent = Buffer.from(this._traceEvents.map((e) => JSON.stringify(e)).join("\n"));
zipFile.addBuffer(traceContent, testTraceEntryName);
await new Promise((f) => {
zipFile.end(void 0, () => {
zipFile.outputStream.pipe(import_fs.default.createWriteStream(this._generateNextTraceRecordingPath())).on("close", f);
});
});
const tracePath = this._testInfo.outputPath("trace.zip");
await mergeTraceFiles(tracePath, this._temporaryTraceFiles);
this._testInfo.attachments.push({ name: "trace", path: tracePath, contentType: "application/zip" });
}
appendForError(error) {
const rawStack = error.stack?.split("\n") || [];
const stack = rawStack ? (0, import_util.filteredStackTrace)(rawStack) : [];
this._appendTraceEvent({
type: "error",
message: this._formatError(error),
stack
});
}
_formatError(error) {
const parts = [error.message || String(error.value)];
if (error.cause)
parts.push("[cause]: " + this._formatError(error.cause));
return parts.join("\n");
}
appendStdioToTrace(type, chunk) {
this._appendTraceEvent({
type,
timestamp: (0, import_utils.monotonicTime)(),
text: typeof chunk === "string" ? chunk : void 0,
base64: typeof chunk === "string" ? void 0 : chunk.toString("base64")
});
}
appendBeforeActionForStep(options) {
this._appendTraceEvent({
type: "before",
callId: options.stepId,
stepId: options.stepId,
parentId: options.parentId,
startTime: (0, import_utils.monotonicTime)(),
class: "Test",
method: options.category,
title: options.title,
params: Object.fromEntries(Object.entries(options.params || {}).map(([name, value]) => [name, generatePreview(value)])),
stack: options.stack,
group: options.group
});
}
appendAfterActionForStep(callId, error, attachments = [], annotations) {
this._appendTraceEvent({
type: "after",
callId,
endTime: (0, import_utils.monotonicTime)(),
attachments: serializeAttachments(attachments),
annotations,
error
});
}
_appendTraceEvent(event) {
this._traceEvents.push(event);
if (this._liveTraceFile)
this._liveTraceFile.fs.appendFile(this._liveTraceFile.file, JSON.stringify(event) + "\n", true);
}
}
function serializeAttachments(attachments) {
if (attachments.length === 0)
return void 0;
return attachments.filter((a) => a.name !== "trace").map((a) => {
return {
name: a.name,
contentType: a.contentType,
path: a.path,
base64: a.body?.toString("base64")
};
});
}
function generatePreview(value, visited = /* @__PURE__ */ new Set()) {
if (visited.has(value))
return "";
visited.add(value);
if (typeof value === "string")
return value;
if (typeof value === "number")
return value.toString();
if (typeof value === "boolean")
return value.toString();
if (value === null)
return "null";
if (value === void 0)
return "undefined";
if (Array.isArray(value))
return "[" + value.map((v) => generatePreview(v, visited)).join(", ") + "]";
if (typeof value === "object")
return "Object";
return String(value);
}
async function mergeTraceFiles(fileName, temporaryTraceFiles) {
temporaryTraceFiles = temporaryTraceFiles.filter((file) => import_fs.default.existsSync(file));
if (temporaryTraceFiles.length === 1) {
await import_fs.default.promises.rename(temporaryTraceFiles[0], fileName);
return;
}
const mergePromise = new import_utils.ManualPromise();
const zipFile = new import_zipBundle.yazl.ZipFile();
const entryNames = /* @__PURE__ */ new Set();
zipFile.on("error", (error) => mergePromise.reject(error));
for (let i = temporaryTraceFiles.length - 1; i >= 0; --i) {
const tempFile = temporaryTraceFiles[i];
const promise = new import_utils.ManualPromise();
import_zipBundle.yauzl.open(tempFile, (err, inZipFile) => {
if (err) {
promise.reject(err);
return;
}
let pendingEntries = inZipFile.entryCount;
inZipFile.on("entry", (entry) => {
let entryName = entry.fileName;
if (entry.fileName === testTraceEntryName) {
} else if (entry.fileName.match(/trace\.[a-z]*$/)) {
entryName = i + "-" + entry.fileName;
}
if (entryNames.has(entryName)) {
if (--pendingEntries === 0)
promise.resolve();
return;
}
entryNames.add(entryName);
inZipFile.openReadStream(entry, (err2, readStream) => {
if (err2) {
promise.reject(err2);
return;
}
zipFile.addReadStream(readStream, entryName);
if (--pendingEntries === 0)
promise.resolve();
});
});
});
await promise;
}
zipFile.end(void 0, () => {
zipFile.outputStream.pipe(import_fs.default.createWriteStream(fileName)).on("close", () => {
void Promise.all(temporaryTraceFiles.map((tempFile) => import_fs.default.promises.unlink(tempFile))).then(() => {
mergePromise.resolve();
}).catch((error) => mergePromise.reject(error));
}).on("error", (error) => mergePromise.reject(error));
});
await mergePromise;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
TestTracing,
testTraceEntryName
});
+174
View File
@@ -0,0 +1,174 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var timeoutManager_exports = {};
__export(timeoutManager_exports, {
TimeoutManager: () => TimeoutManager,
TimeoutManagerError: () => TimeoutManagerError,
kMaxDeadline: () => kMaxDeadline
});
module.exports = __toCommonJS(timeoutManager_exports);
var import_utils = require("playwright-core/lib/utils");
var import_utils2 = require("playwright-core/lib/utils");
var import_util = require("../util");
const kMaxDeadline = 2147483647;
class TimeoutManager {
constructor(timeout) {
this._ignoreTimeouts = false;
this._defaultSlot = { timeout, elapsed: 0 };
}
setIgnoreTimeouts() {
this._ignoreTimeouts = true;
if (this._running)
this._updateTimeout(this._running);
}
interrupt() {
if (this._running)
this._running.timeoutPromise.reject(this._createTimeoutError(this._running));
}
isTimeExhaustedFor(runnable) {
const slot = runnable.fixture?.slot || runnable.slot || this._defaultSlot;
return slot.timeout > 0 && slot.elapsed >= slot.timeout - 1;
}
async withRunnable(runnable, cb) {
if (this._running)
throw new Error(`Internal error: duplicate runnable`);
const running = this._running = {
runnable,
slot: runnable.fixture?.slot || runnable.slot || this._defaultSlot,
start: (0, import_utils.monotonicTime)(),
deadline: kMaxDeadline,
timer: void 0,
timeoutPromise: new import_utils.ManualPromise()
};
let debugTitle = "";
try {
if (import_util.debugTest.enabled) {
debugTitle = runnable.fixture ? `${runnable.fixture.phase} "${runnable.fixture.title}"` : runnable.type;
const location = runnable.location ? ` at "${(0, import_util.formatLocation)(runnable.location)}"` : ``;
(0, import_util.debugTest)(`started ${debugTitle}${location}`);
}
this._updateTimeout(running);
return await Promise.race([
cb(),
running.timeoutPromise
]);
} finally {
if (running.timer)
clearTimeout(running.timer);
running.timer = void 0;
running.slot.elapsed += (0, import_utils.monotonicTime)() - running.start;
this._running = void 0;
if (import_util.debugTest.enabled)
(0, import_util.debugTest)(`finished ${debugTitle}`);
}
}
_updateTimeout(running) {
if (running.timer)
clearTimeout(running.timer);
running.timer = void 0;
if (this._ignoreTimeouts || !running.slot.timeout) {
running.deadline = kMaxDeadline;
return;
}
running.deadline = running.start + (running.slot.timeout - running.slot.elapsed);
const timeout = running.deadline - (0, import_utils.monotonicTime)() + 1;
if (timeout <= 0)
running.timeoutPromise.reject(this._createTimeoutError(running));
else
running.timer = setTimeout(() => running.timeoutPromise.reject(this._createTimeoutError(running)), timeout);
}
defaultSlot() {
return this._defaultSlot;
}
slow() {
const slot = this._running ? this._running.slot : this._defaultSlot;
slot.timeout = slot.timeout * 3;
if (this._running)
this._updateTimeout(this._running);
}
setTimeout(timeout) {
const slot = this._running ? this._running.slot : this._defaultSlot;
slot.timeout = timeout;
if (this._running)
this._updateTimeout(this._running);
}
currentSlotDeadline() {
return this._running ? this._running.deadline : kMaxDeadline;
}
currentSlotType() {
return this._running ? this._running.runnable.type : "test";
}
_createTimeoutError(running) {
let message = "";
const timeout = running.slot.timeout;
const runnable = running.runnable;
switch (runnable.type) {
case "test": {
if (runnable.fixture) {
if (runnable.fixture.phase === "setup")
message = `Test timeout of ${timeout}ms exceeded while setting up "${runnable.fixture.title}".`;
else
message = `Tearing down "${runnable.fixture.title}" exceeded the test timeout of ${timeout}ms.`;
} else {
message = `Test timeout of ${timeout}ms exceeded.`;
}
break;
}
case "afterEach":
case "beforeEach":
message = `Test timeout of ${timeout}ms exceeded while running "${runnable.type}" hook.`;
break;
case "beforeAll":
case "afterAll":
message = `"${runnable.type}" hook timeout of ${timeout}ms exceeded.`;
break;
case "teardown": {
if (runnable.fixture)
message = `Worker teardown timeout of ${timeout}ms exceeded while ${runnable.fixture.phase === "setup" ? "setting up" : "tearing down"} "${runnable.fixture.title}".`;
else
message = `Worker teardown timeout of ${timeout}ms exceeded.`;
break;
}
case "skip":
case "slow":
case "fixme":
case "fail":
message = `"${runnable.type}" modifier timeout of ${timeout}ms exceeded.`;
break;
}
const fixtureWithSlot = runnable.fixture?.slot ? runnable.fixture : void 0;
if (fixtureWithSlot)
message = `Fixture "${fixtureWithSlot.title}" timeout of ${timeout}ms exceeded during ${fixtureWithSlot.phase}.`;
message = import_utils2.colors.red(message);
const location = (fixtureWithSlot || runnable).location;
const error = new TimeoutManagerError(message);
error.name = "";
error.stack = message + (location ? `
at ${location.file}:${location.line}:${location.column}` : "");
return error;
}
}
class TimeoutManagerError extends Error {
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
TimeoutManager,
TimeoutManagerError,
kMaxDeadline
});
Loaded 100 of 488 files, more files were not shown because too many files have changed in this diff. Show more