web2driver
Version:
Pure-JS, browser-based WebDriver (+ Appium) client
1,486 lines (1,463 loc) • 1.43 MB
JavaScript
var $4UN2M$fs = require("fs");
var $4UN2M$util = require("util");
var $4UN2M$path = require("path");
var $4UN2M$buffer = require("buffer");
var $4UN2M$process = require("process");
var $4UN2M$events = require("events");
var $4UN2M$assert = require("assert");
var $4UN2M$url = require("url");
var $4UN2M$http = require("http");
var $4UN2M$https = require("https");
var $4UN2M$perf_hooks = require("perf_hooks");
var $4UN2M$stream = require("stream");
var $4UN2M$dns = require("dns");
var $4UN2M$os = require("os");
var $4UN2M$zlib = require("zlib");
var $4UN2M$http2 = require("http2");
var $4UN2M$tls = require("tls");
var $4UN2M$net = require("net");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
var $parcel$global =
typeof globalThis !== 'undefined'
? globalThis
: typeof self !== 'undefined'
? self
: typeof window !== 'undefined'
? window
: typeof global !== 'undefined'
? global
: {};
function $parcel$defineInteropFlag(a) {
Object.defineProperty(a, '__esModule', {value: true, configurable: true});
}
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
var $parcel$modules = {};
var $parcel$inits = {};
var parcelRequire = $parcel$global["parcelRequire3ed1"];
if (parcelRequire == null) {
parcelRequire = function(id) {
if (id in $parcel$modules) {
return $parcel$modules[id].exports;
}
if (id in $parcel$inits) {
var init = $parcel$inits[id];
delete $parcel$inits[id];
var module = {id: id, exports: {}};
$parcel$modules[id] = module;
init.call(module.exports, module, module.exports);
return module.exports;
}
var err = new Error("Cannot find module '" + id + "'");
err.code = 'MODULE_NOT_FOUND';
throw err;
};
parcelRequire.register = function register(id, init) {
$parcel$inits[id] = init;
};
$parcel$global["parcelRequire3ed1"] = parcelRequire;
}
parcelRequire.register("aZBcl", function(module, exports) {
"use strict";
var $800c74ac0983357b$var$__importDefault = module.exports && module.exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : {
"default": mod
};
};
Object.defineProperty(module.exports, "__esModule", {
value: true
});
const $800c74ac0983357b$var$fs_1 = $800c74ac0983357b$var$__importDefault($4UN2M$fs);
const $800c74ac0983357b$var$loglevel_1 = $800c74ac0983357b$var$__importDefault((parcelRequire("do3vr")));
const $800c74ac0983357b$var$util_1 = $800c74ac0983357b$var$__importDefault($4UN2M$util);
const $800c74ac0983357b$var$chalk_1 = $800c74ac0983357b$var$__importDefault((parcelRequire("LStkk")));
const $800c74ac0983357b$var$loglevel_plugin_prefix_1 = $800c74ac0983357b$var$__importDefault((parcelRequire("lEAwe")));
const $800c74ac0983357b$var$strip_ansi_1 = $800c74ac0983357b$var$__importDefault((parcelRequire("5myiz")));
$800c74ac0983357b$var$loglevel_plugin_prefix_1.default.reg($800c74ac0983357b$var$loglevel_1.default);
const $800c74ac0983357b$var$DEFAULT_LEVEL = "info";
const $800c74ac0983357b$var$COLORS = {
error: "red",
warn: "yellow",
info: "cyanBright",
debug: "green",
trace: "cyan"
};
const $800c74ac0983357b$var$matches = {
COMMAND: "COMMAND",
DATA: "DATA",
RESULT: "RESULT"
};
const $800c74ac0983357b$var$SERIALIZERS = [
{
/**
* display error stack
*/ matches: (err)=>err instanceof Error,
serialize: (err)=>err.stack
},
{
/**
* color commands blue
*/ matches: (log)=>log === $800c74ac0983357b$var$matches.COMMAND,
serialize: (log)=>$800c74ac0983357b$var$chalk_1.default.magenta(log)
},
{
/**
* color data yellow
*/ matches: (log)=>log === $800c74ac0983357b$var$matches.DATA,
serialize: (log)=>$800c74ac0983357b$var$chalk_1.default.yellow(log)
},
{
/**
* color result cyan
*/ matches: (log)=>log === $800c74ac0983357b$var$matches.RESULT,
serialize: (log)=>$800c74ac0983357b$var$chalk_1.default.cyan(log)
}
];
const $800c74ac0983357b$var$loggers = $800c74ac0983357b$var$loglevel_1.default.getLoggers();
let $800c74ac0983357b$var$logLevelsConfig = {};
const $800c74ac0983357b$var$logCache = new Set();
let $800c74ac0983357b$var$logFile;
const $800c74ac0983357b$var$originalFactory = $800c74ac0983357b$var$loglevel_1.default.methodFactory;
const $800c74ac0983357b$var$wdioLoggerMethodFactory = function(methodName, logLevel, loggerName) {
const rawMethod = $800c74ac0983357b$var$originalFactory(methodName, logLevel, loggerName);
return (...args)=>{
/**
* split `prefixer: value` sting to `prefixer: ` and `value`
* so that SERIALIZERS can match certain string
*/ const match = Object.values($800c74ac0983357b$var$matches).filter((x)=>args[0].endsWith(`: ${x}`))[0];
if (match) {
const prefixStr = args.shift().slice(0, -match.length - 1);
args.unshift(prefixStr, match);
}
args = args.map((arg)=>{
for (const s of $800c74ac0983357b$var$SERIALIZERS){
if (s.matches(arg)) return s.serialize(arg);
}
return arg;
});
const logText = (0, $800c74ac0983357b$var$strip_ansi_1.default)(`${$800c74ac0983357b$var$util_1.default.format.apply(this, args)}\n`);
if ($800c74ac0983357b$var$logFile && $800c74ac0983357b$var$logFile.writable) {
/**
* empty logging cache if stuff got logged before
*/ if ($800c74ac0983357b$var$logCache.size) {
$800c74ac0983357b$var$logCache.forEach((log)=>{
if ($800c74ac0983357b$var$logFile) $800c74ac0983357b$var$logFile.write(log);
});
$800c74ac0983357b$var$logCache.clear();
}
return $800c74ac0983357b$var$logFile.write(logText);
}
$800c74ac0983357b$var$logCache.add(logText);
rawMethod(...args);
};
};
function $800c74ac0983357b$var$getLogger(name) {
/**
* check if logger was already initiated
*/ if ($800c74ac0983357b$var$loggers[name]) return $800c74ac0983357b$var$loggers[name];
let logLevel = $800c74ac0983357b$var$DEFAULT_LEVEL;
const logLevelName = $800c74ac0983357b$var$getLogLevelName(name);
if ($800c74ac0983357b$var$logLevelsConfig[logLevelName]) logLevel = $800c74ac0983357b$var$logLevelsConfig[logLevelName];
$800c74ac0983357b$var$loggers[name] = $800c74ac0983357b$var$loglevel_1.default.getLogger(name);
$800c74ac0983357b$var$loggers[name].setLevel(logLevel);
$800c74ac0983357b$var$loggers[name].methodFactory = $800c74ac0983357b$var$wdioLoggerMethodFactory;
$800c74ac0983357b$var$loglevel_plugin_prefix_1.default.apply($800c74ac0983357b$var$loggers[name], {
template: "%t %l %n:",
timestampFormatter: (date)=>$800c74ac0983357b$var$chalk_1.default.gray(date.toISOString()),
levelFormatter: (level)=>$800c74ac0983357b$var$chalk_1.default[$800c74ac0983357b$var$COLORS[level]](level.toUpperCase()),
nameFormatter: (name)=>$800c74ac0983357b$var$chalk_1.default.whiteBright(name)
});
return $800c74ac0983357b$var$loggers[name];
}
module.exports.default = $800c74ac0983357b$var$getLogger;
/**
* Wait for writable stream to be flushed.
* Calling this prevents part of the logs in the very env to be lost.
*/ $800c74ac0983357b$var$getLogger.waitForBuffer = async ()=>new Promise((resolve)=>{
// @ts-ignore
if ($800c74ac0983357b$var$logFile && Array.isArray($800c74ac0983357b$var$logFile.writableBuffer) && $800c74ac0983357b$var$logFile.writableBuffer.length !== 0) return setTimeout(async ()=>{
await $800c74ac0983357b$var$getLogger.waitForBuffer();
resolve();
}, 20);
resolve();
});
$800c74ac0983357b$var$getLogger.setLevel = (name, level)=>$800c74ac0983357b$var$loggers[name].setLevel(level);
$800c74ac0983357b$var$getLogger.clearLogger = ()=>{
if ($800c74ac0983357b$var$logFile) $800c74ac0983357b$var$logFile.end();
$800c74ac0983357b$var$logFile = null;
};
$800c74ac0983357b$var$getLogger.setLogLevelsConfig = (logLevels = {}, wdioLogLevel = $800c74ac0983357b$var$DEFAULT_LEVEL)=>{
wdioLogLevel;
$800c74ac0983357b$var$logLevelsConfig = {};
/**
* build logLevelsConfig object
*/ Object.entries(logLevels).forEach(([logName, logLevel])=>{
const logLevelName = $800c74ac0983357b$var$getLogLevelName(logName);
$800c74ac0983357b$var$logLevelsConfig[logLevelName] = logLevel;
});
/**
* set log level for each logger
*/ Object.keys($800c74ac0983357b$var$loggers).forEach((logName)=>{
const logLevelName = $800c74ac0983357b$var$getLogLevelName(logName);
/**
* either apply log level from logLevels object or use global logLevel
*/ const logLevel = typeof $800c74ac0983357b$var$logLevelsConfig[logLevelName] !== "undefined" ? $800c74ac0983357b$var$logLevelsConfig[logLevelName] : undefined;
$800c74ac0983357b$var$loggers[logName].setLevel(logLevel);
});
};
const $800c74ac0983357b$var$getLogLevelName = (logName)=>logName.split(":").shift();
});
parcelRequire.register("do3vr", function(module, exports) {
/*
* loglevel - https://github.com/pimterry/loglevel
*
* Copyright (c) 2013 Tim Perry
* Licensed under the MIT license.
*/ (function(root, definition) {
"use strict";
if (typeof define === "function" && define.amd) define(definition);
else if (0, module.exports) module.exports = definition();
else root.log = definition();
})(module.exports, function() {
"use strict";
// Slightly dubious tricks to cut down minimized file size
var noop = function() {};
var undefinedType = "undefined";
var isIE = typeof window !== undefinedType && typeof window.navigator !== undefinedType && /Trident\/|MSIE /.test(window.navigator.userAgent);
var logMethods = [
"trace",
"debug",
"info",
"warn",
"error"
];
// Cross-browser bind equivalent that works at least back to IE6
function bindMethod(obj, methodName) {
var method = obj[methodName];
if (typeof method.bind === "function") return method.bind(obj);
else try {
return Function.prototype.bind.call(method, obj);
} catch (e) {
// Missing bind shim or IE8 + Modernizr, fallback to wrapping
return function() {
return Function.prototype.apply.apply(method, [
obj,
arguments
]);
};
}
}
// Trace() doesn't print the message in IE, so for that case we need to wrap it
function traceForIE() {
if (console.log) {
if (console.log.apply) console.log.apply(console, arguments);
else // In old IE, native console methods themselves don't have apply().
Function.prototype.apply.apply(console.log, [
console,
arguments
]);
}
if (console.trace) console.trace();
}
// Build the best logging method possible for this env
// Wherever possible we want to bind, not wrap, to preserve stack traces
function realMethod(methodName) {
if (methodName === "debug") methodName = "log";
if (typeof console === undefinedType) return false; // No method possible, for now - fixed later by enableLoggingWhenConsoleArrives
else if (methodName === "trace" && isIE) return traceForIE;
else if (console[methodName] !== undefined) return bindMethod(console, methodName);
else if (console.log !== undefined) return bindMethod(console, "log");
else return noop;
}
// These private functions always need `this` to be set properly
function replaceLoggingMethods(level, loggerName) {
/*jshint validthis:true */ for(var i = 0; i < logMethods.length; i++){
var methodName = logMethods[i];
this[methodName] = i < level ? noop : this.methodFactory(methodName, level, loggerName);
}
// Define log.log as an alias for log.debug
this.log = this.debug;
}
// In old IE versions, the console isn't present until you first open it.
// We build realMethod() replacements here that regenerate logging methods
function enableLoggingWhenConsoleArrives(methodName, level, loggerName) {
return function() {
if (typeof console !== undefinedType) {
replaceLoggingMethods.call(this, level, loggerName);
this[methodName].apply(this, arguments);
}
};
}
// By default, we use closely bound real methods wherever possible, and
// otherwise we wait for a console to appear, and then try again.
function defaultMethodFactory(methodName, level, loggerName) {
/*jshint validthis:true */ return realMethod(methodName) || enableLoggingWhenConsoleArrives.apply(this, arguments);
}
function Logger(name, defaultLevel, factory) {
var self = this;
var currentLevel;
defaultLevel = defaultLevel == null ? "WARN" : defaultLevel;
var storageKey = "loglevel";
if (typeof name === "string") storageKey += ":" + name;
else if (typeof name === "symbol") storageKey = undefined;
function persistLevelIfPossible(levelNum) {
var levelName = (logMethods[levelNum] || "silent").toUpperCase();
if (typeof window === undefinedType || !storageKey) return;
// Use localStorage if available
try {
window.localStorage[storageKey] = levelName;
return;
} catch (ignore) {}
// Use session cookie as fallback
try {
window.document.cookie = encodeURIComponent(storageKey) + "=" + levelName + ";";
} catch (ignore) {}
}
function getPersistedLevel() {
var storedLevel;
if (typeof window === undefinedType || !storageKey) return;
try {
storedLevel = window.localStorage[storageKey];
} catch (ignore) {}
// Fallback to cookies if local storage gives us nothing
if (typeof storedLevel === undefinedType) try {
var cookie = window.document.cookie;
var location = cookie.indexOf(encodeURIComponent(storageKey) + "=");
if (location !== -1) storedLevel = /^([^;]+)/.exec(cookie.slice(location))[1];
} catch (ignore) {}
// If the stored level is not valid, treat it as if nothing was stored.
if (self.levels[storedLevel] === undefined) storedLevel = undefined;
return storedLevel;
}
function clearPersistedLevel() {
if (typeof window === undefinedType || !storageKey) return;
// Use localStorage if available
try {
window.localStorage.removeItem(storageKey);
return;
} catch (ignore) {}
// Use session cookie as fallback
try {
window.document.cookie = encodeURIComponent(storageKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
} catch (ignore) {}
}
/*
*
* Public logger API - see https://github.com/pimterry/loglevel for details
*
*/ self.name = name;
self.levels = {
"TRACE": 0,
"DEBUG": 1,
"INFO": 2,
"WARN": 3,
"ERROR": 4,
"SILENT": 5
};
self.methodFactory = factory || defaultMethodFactory;
self.getLevel = function() {
return currentLevel;
};
self.setLevel = function(level, persist) {
if (typeof level === "string" && self.levels[level.toUpperCase()] !== undefined) level = self.levels[level.toUpperCase()];
if (typeof level === "number" && level >= 0 && level <= self.levels.SILENT) {
currentLevel = level;
if (persist !== false) persistLevelIfPossible(level);
replaceLoggingMethods.call(self, level, name);
if (typeof console === undefinedType && level < self.levels.SILENT) return "No console available for logging";
} else throw "log.setLevel() called with invalid level: " + level;
};
self.setDefaultLevel = function(level) {
defaultLevel = level;
if (!getPersistedLevel()) self.setLevel(level, false);
};
self.resetLevel = function() {
self.setLevel(defaultLevel, false);
clearPersistedLevel();
};
self.enableAll = function(persist) {
self.setLevel(self.levels.TRACE, persist);
};
self.disableAll = function(persist) {
self.setLevel(self.levels.SILENT, persist);
};
// Initialize with the right level
var initialLevel = getPersistedLevel();
if (initialLevel == null) initialLevel = defaultLevel;
self.setLevel(initialLevel, false);
}
/*
*
* Top-level API
*
*/ var defaultLogger = new Logger();
var _loggersByName = {};
defaultLogger.getLogger = function getLogger(name) {
if (typeof name !== "symbol" && typeof name !== "string" || name === "") throw new TypeError("You must supply a name when creating a logger.");
var logger = _loggersByName[name];
if (!logger) logger = _loggersByName[name] = new Logger(name, defaultLogger.getLevel(), defaultLogger.methodFactory);
return logger;
};
// Grab the current global log variable in case of overwrite
var _log = typeof window !== undefinedType ? window.log : undefined;
defaultLogger.noConflict = function() {
if (typeof window !== undefinedType && window.log === defaultLogger) window.log = _log;
return defaultLogger;
};
defaultLogger.getLoggers = function getLoggers() {
return _loggersByName;
};
// ES6 default export, for compatibility
defaultLogger["default"] = defaultLogger;
return defaultLogger;
});
});
parcelRequire.register("LStkk", function(module, exports) {
"use strict";
var $hnMjW = parcelRequire("hnMjW");
var $enYgM = parcelRequire("enYgM");
var $08fea4e886d027fd$require$stdoutColor = $enYgM.stdout;
var $08fea4e886d027fd$require$stderrColor = $enYgM.stderr;
var $lXemD = parcelRequire("lXemD");
var $08fea4e886d027fd$require$stringReplaceAll = $lXemD.stringReplaceAll;
var $08fea4e886d027fd$require$stringEncaseCRLFWithFirstIndex = $lXemD.stringEncaseCRLFWithFirstIndex;
const { isArray: $08fea4e886d027fd$var$isArray } = Array;
// `supportsColor.level` → `ansiStyles.color[name]` mapping
const $08fea4e886d027fd$var$levelMapping = [
"ansi",
"ansi",
"ansi256",
"ansi16m"
];
const $08fea4e886d027fd$var$styles = Object.create(null);
const $08fea4e886d027fd$var$applyOptions = (object, options = {})=>{
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) throw new Error("The `level` option should be an integer from 0 to 3");
// Detect level if not set manually
const colorLevel = $08fea4e886d027fd$require$stdoutColor ? $08fea4e886d027fd$require$stdoutColor.level : 0;
object.level = options.level === undefined ? colorLevel : options.level;
};
class $08fea4e886d027fd$var$ChalkClass {
constructor(options){
// eslint-disable-next-line no-constructor-return
return $08fea4e886d027fd$var$chalkFactory(options);
}
}
const $08fea4e886d027fd$var$chalkFactory = (options)=>{
const chalk = {};
$08fea4e886d027fd$var$applyOptions(chalk, options);
chalk.template = (...arguments_)=>$08fea4e886d027fd$var$chalkTag(chalk.template, ...arguments_);
Object.setPrototypeOf(chalk, $08fea4e886d027fd$var$Chalk.prototype);
Object.setPrototypeOf(chalk.template, chalk);
chalk.template.constructor = ()=>{
throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
};
chalk.template.Instance = $08fea4e886d027fd$var$ChalkClass;
return chalk.template;
};
function $08fea4e886d027fd$var$Chalk(options) {
return $08fea4e886d027fd$var$chalkFactory(options);
}
for (const [styleName, style] of Object.entries($hnMjW))$08fea4e886d027fd$var$styles[styleName] = {
get () {
const builder = $08fea4e886d027fd$var$createBuilder(this, $08fea4e886d027fd$var$createStyler(style.open, style.close, this._styler), this._isEmpty);
Object.defineProperty(this, styleName, {
value: builder
});
return builder;
}
};
$08fea4e886d027fd$var$styles.visible = {
get () {
const builder = $08fea4e886d027fd$var$createBuilder(this, this._styler, true);
Object.defineProperty(this, "visible", {
value: builder
});
return builder;
}
};
const $08fea4e886d027fd$var$usedModels = [
"rgb",
"hex",
"keyword",
"hsl",
"hsv",
"hwb",
"ansi",
"ansi256"
];
for (const model of $08fea4e886d027fd$var$usedModels)$08fea4e886d027fd$var$styles[model] = {
get () {
const { level: level } = this;
return function(...arguments_) {
const styler = $08fea4e886d027fd$var$createStyler($hnMjW.color[$08fea4e886d027fd$var$levelMapping[level]][model](...arguments_), $hnMjW.color.close, this._styler);
return $08fea4e886d027fd$var$createBuilder(this, styler, this._isEmpty);
};
}
};
for (const model of $08fea4e886d027fd$var$usedModels){
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
$08fea4e886d027fd$var$styles[bgModel] = {
get () {
const { level: level } = this;
return function(...arguments_) {
const styler = $08fea4e886d027fd$var$createStyler($hnMjW.bgColor[$08fea4e886d027fd$var$levelMapping[level]][model](...arguments_), $hnMjW.bgColor.close, this._styler);
return $08fea4e886d027fd$var$createBuilder(this, styler, this._isEmpty);
};
}
};
}
const $08fea4e886d027fd$var$proto = Object.defineProperties(()=>{}, {
...$08fea4e886d027fd$var$styles,
level: {
enumerable: true,
get () {
return this._generator.level;
},
set (level) {
this._generator.level = level;
}
}
});
const $08fea4e886d027fd$var$createStyler = (open, close, parent)=>{
let openAll;
let closeAll;
if (parent === undefined) {
openAll = open;
closeAll = close;
} else {
openAll = parent.openAll + open;
closeAll = close + parent.closeAll;
}
return {
open: open,
close: close,
openAll: openAll,
closeAll: closeAll,
parent: parent
};
};
const $08fea4e886d027fd$var$createBuilder = (self, _styler, _isEmpty)=>{
const builder = (...arguments_)=>{
if ($08fea4e886d027fd$var$isArray(arguments_[0]) && $08fea4e886d027fd$var$isArray(arguments_[0].raw)) // Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}`
return $08fea4e886d027fd$var$applyStyle(builder, $08fea4e886d027fd$var$chalkTag(builder, ...arguments_));
// Single argument is hot path, implicit coercion is faster than anything
// eslint-disable-next-line no-implicit-coercion
return $08fea4e886d027fd$var$applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
};
// We alter the prototype because we must return a function, but there is
// no way to create a function with a different prototype
Object.setPrototypeOf(builder, $08fea4e886d027fd$var$proto);
builder._generator = self;
builder._styler = _styler;
builder._isEmpty = _isEmpty;
return builder;
};
const $08fea4e886d027fd$var$applyStyle = (self, string)=>{
if (self.level <= 0 || !string) return self._isEmpty ? "" : string;
let styler = self._styler;
if (styler === undefined) return string;
const { openAll: openAll, closeAll: closeAll } = styler;
if (string.indexOf("\x1b") !== -1) while(styler !== undefined){
// Replace any instances already present with a re-opening code
// otherwise only the part of the string until said closing code
// will be colored, and the rest will simply be 'plain'.
string = $08fea4e886d027fd$require$stringReplaceAll(string, styler.close, styler.open);
styler = styler.parent;
}
// We can move both next actions out of loop, because remaining actions in loop won't have
// any/visible effect on parts we add here. Close the styling before a linebreak and reopen
// after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
const lfIndex = string.indexOf("\n");
if (lfIndex !== -1) string = $08fea4e886d027fd$require$stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
return openAll + string + closeAll;
};
let $08fea4e886d027fd$var$template;
const $08fea4e886d027fd$var$chalkTag = (chalk, ...strings)=>{
const [firstString] = strings;
if (!$08fea4e886d027fd$var$isArray(firstString) || !$08fea4e886d027fd$var$isArray(firstString.raw)) // If chalk() was called by itself or with a string,
// return the string itself as a string.
return strings.join(" ");
const arguments_ = strings.slice(1);
const parts = [
firstString.raw[0]
];
for(let i = 1; i < firstString.length; i++)parts.push(String(arguments_[i - 1]).replace(/[{}\\]/g, "\\$&"), String(firstString.raw[i]));
if ($08fea4e886d027fd$var$template === undefined) $08fea4e886d027fd$var$template = (parcelRequire("wHDJ7"));
return $08fea4e886d027fd$var$template(chalk, parts.join(""));
};
Object.defineProperties($08fea4e886d027fd$var$Chalk.prototype, $08fea4e886d027fd$var$styles);
const $08fea4e886d027fd$var$chalk = $08fea4e886d027fd$var$Chalk(); // eslint-disable-line new-cap
$08fea4e886d027fd$var$chalk.supportsColor = $08fea4e886d027fd$require$stdoutColor;
$08fea4e886d027fd$var$chalk.stderr = $08fea4e886d027fd$var$Chalk({
level: $08fea4e886d027fd$require$stderrColor ? $08fea4e886d027fd$require$stderrColor.level : 0
}); // eslint-disable-line new-cap
$08fea4e886d027fd$var$chalk.stderr.supportsColor = $08fea4e886d027fd$require$stderrColor;
module.exports = $08fea4e886d027fd$var$chalk;
});
parcelRequire.register("hnMjW", function(module, exports) {
"use strict";
const wrapAnsi16 = (fn, offset)=>(...args)=>{
const code = fn(...args);
return `\u001B[${code + offset}m`;
};
const wrapAnsi256 = (fn, offset)=>(...args)=>{
const code = fn(...args);
return `\u001B[${38 + offset};5;${code}m`;
};
const wrapAnsi16m = (fn, offset)=>(...args)=>{
const rgb = fn(...args);
return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
};
const ansi2ansi = (n)=>n;
const rgb2rgb = (r, g, b)=>[
r,
g,
b
];
const setLazyProperty = (object, property, get)=>{
Object.defineProperty(object, property, {
get: ()=>{
const value = get();
Object.defineProperty(object, property, {
value: value,
enumerable: true,
configurable: true
});
return value;
},
enumerable: true,
configurable: true
});
};
/** @type {typeof import('color-convert')} */ let colorConvert;
const makeDynamicStyles = (wrap, targetSpace, identity, isBackground)=>{
if (colorConvert === undefined) colorConvert = (parcelRequire("cfkdQ"));
const offset = isBackground ? 10 : 0;
const styles = {};
for (const [sourceSpace, suite] of Object.entries(colorConvert)){
const name = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
if (sourceSpace === targetSpace) styles[name] = wrap(identity, offset);
else if (typeof suite === "object") styles[name] = wrap(suite[targetSpace], offset);
}
return styles;
};
function assembleStyles() {
const codes = new Map();
const styles = {
modifier: {
reset: [
0,
0
],
// 21 isn't widely supported and 22 does the same thing
bold: [
1,
22
],
dim: [
2,
22
],
italic: [
3,
23
],
underline: [
4,
24
],
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
],
// Bright color
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
],
// Bright color
bgBlackBright: [
100,
49
],
bgRedBright: [
101,
49
],
bgGreenBright: [
102,
49
],
bgYellowBright: [
103,
49
],
bgBlueBright: [
104,
49
],
bgMagentaBright: [
105,
49
],
bgCyanBright: [
106,
49
],
bgWhiteBright: [
107,
49
]
}
};
// Alias bright black as gray (and grey)
styles.color.gray = styles.color.blackBright;
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
styles.color.grey = styles.color.blackBright;
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
for (const [groupName, group] of Object.entries(styles)){
for (const [styleName, style] of Object.entries(group)){
styles[styleName] = {
open: `\u001B[${style[0]}m`,
close: `\u001B[${style[1]}m`
};
group[styleName] = styles[styleName];
codes.set(style[0], style[1]);
}
Object.defineProperty(styles, groupName, {
value: group,
enumerable: false
});
}
Object.defineProperty(styles, "codes", {
value: codes,
enumerable: false
});
styles.color.close = "\x1b[39m";
styles.bgColor.close = "\x1b[49m";
setLazyProperty(styles.color, "ansi", ()=>makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, false));
setLazyProperty(styles.color, "ansi256", ()=>makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, false));
setLazyProperty(styles.color, "ansi16m", ()=>makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, false));
setLazyProperty(styles.bgColor, "ansi", ()=>makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, true));
setLazyProperty(styles.bgColor, "ansi256", ()=>makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, true));
setLazyProperty(styles.bgColor, "ansi16m", ()=>makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, true));
return styles;
}
// Make the export immutable
Object.defineProperty(module, "exports", {
enumerable: true,
get: assembleStyles
});
});
parcelRequire.register("cfkdQ", function(module, exports) {
var $gJ0Vv = parcelRequire("gJ0Vv");
var $2IZoC = parcelRequire("2IZoC");
const $8ea69280d8215a6f$var$convert = {};
const $8ea69280d8215a6f$var$models = Object.keys($gJ0Vv);
function $8ea69280d8215a6f$var$wrapRaw(fn) {
const wrappedFn = function(...args) {
const arg0 = args[0];
if (arg0 === undefined || arg0 === null) return arg0;
if (arg0.length > 1) args = arg0;
return fn(args);
};
// Preserve .conversion property if there is one
if ("conversion" in fn) wrappedFn.conversion = fn.conversion;
return wrappedFn;
}
function $8ea69280d8215a6f$var$wrapRounded(fn) {
const wrappedFn = function(...args) {
const arg0 = args[0];
if (arg0 === undefined || arg0 === null) return arg0;
if (arg0.length > 1) args = arg0;
const result = fn(args);
// We're assuming the result is an array here.
// see notice in conversions.js; don't use box types
// in conversion functions.
if (typeof result === "object") for(let len = result.length, i = 0; i < len; i++)result[i] = Math.round(result[i]);
return result;
};
// Preserve .conversion property if there is one
if ("conversion" in fn) wrappedFn.conversion = fn.conversion;
return wrappedFn;
}
$8ea69280d8215a6f$var$models.forEach((fromModel)=>{
$8ea69280d8215a6f$var$convert[fromModel] = {};
Object.defineProperty($8ea69280d8215a6f$var$convert[fromModel], "channels", {
value: $gJ0Vv[fromModel].channels
});
Object.defineProperty($8ea69280d8215a6f$var$convert[fromModel], "labels", {
value: $gJ0Vv[fromModel].labels
});
const routes = $2IZoC(fromModel);
const routeModels = Object.keys(routes);
routeModels.forEach((toModel)=>{
const fn = routes[toModel];
$8ea69280d8215a6f$var$convert[fromModel][toModel] = $8ea69280d8215a6f$var$wrapRounded(fn);
$8ea69280d8215a6f$var$convert[fromModel][toModel].raw = $8ea69280d8215a6f$var$wrapRaw(fn);
});
});
module.exports = $8ea69280d8215a6f$var$convert;
});
parcelRequire.register("gJ0Vv", function(module, exports) {
/* MIT license */ /* eslint-disable no-mixed-operators */
var $iOoWQ = parcelRequire("iOoWQ");
// NOTE: conversions should only return primitive values (i.e. arrays, or
// values that give correct `typeof` results).
// do not use box values types (i.e. Number(), String(), etc.)
const $c2d1914d5080196d$var$reverseKeywords = {};
for (const key of Object.keys($iOoWQ))$c2d1914d5080196d$var$reverseKeywords[$iOoWQ[key]] = key;
const $c2d1914d5080196d$var$convert = {
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"
]
}
};
module.exports = $c2d1914d5080196d$var$convert;
// Hide .channels and .labels properties
for (const model of Object.keys($c2d1914d5080196d$var$convert)){
if (!("channels" in $c2d1914d5080196d$var$convert[model])) throw new Error("missing channels property: " + model);
if (!("labels" in $c2d1914d5080196d$var$convert[model])) throw new Error("missing channel labels property: " + model);
if ($c2d1914d5080196d$var$convert[model].labels.length !== $c2d1914d5080196d$var$convert[model].channels) throw new Error("channel and label counts mismatch: " + model);
const { channels: channels, labels: labels } = $c2d1914d5080196d$var$convert[model];
delete $c2d1914d5080196d$var$convert[model].channels;
delete $c2d1914d5080196d$var$convert[model].labels;
Object.defineProperty($c2d1914d5080196d$var$convert[model], "channels", {
value: channels
});
Object.defineProperty($c2d1914d5080196d$var$convert[model], "labels", {
value: labels
});
}
$c2d1914d5080196d$var$convert.rgb.hsl = function(rgb) {
const r = rgb[0] / 255;
const g = rgb[1] / 255;
const b = rgb[2] / 255;
const min = Math.min(r, g, b);
const max = Math.max(r, g, b);
const delta = max - min;
let h;
let s;
if (max === min) h = 0;
else if (r === max) h = (g - b) / delta;
else if (g === max) h = 2 + (b - r) / delta;
else if (b === max) h = 4 + (r - g) / delta;
h = Math.min(h * 60, 360);
if (h < 0) h += 360;
const l = (min + max) / 2;
if (max === min) s = 0;
else if (l <= 0.5) s = delta / (max + min);
else s = delta / (2 - max - min);
return [
h,
s * 100,
l * 100
];
};
$c2d1914d5080196d$var$convert.rgb.hsv = function(rgb) {
let rdif;
let gdif;
let bdif;
let h;
let s;
const r = rgb[0] / 255;
const g = rgb[1] / 255;
const b = rgb[2] / 255;
const v = Math.max(r, g, b);
const diff = v - Math.min(r, g, b);
const diffc = function(c) {
return (v - c) / 6 / diff + 0.5;
};
if (diff === 0) {
h = 0;
s = 0;
} else {
s = diff / v;
rdif = diffc(r);
gdif = diffc(g);
bdif = diffc(b);
if (r === v) h = bdif - gdif;
else if (g === v) h = 1 / 3 + rdif - bdif;
else if (b === v) h = 2 / 3 + gdif - rdif;
if (h < 0) h += 1;
else if (h > 1) h -= 1;
}
return [
h * 360,
s * 100,
v * 100
];
};
$c2d1914d5080196d$var$convert.rgb.hwb = function(rgb) {
const r = rgb[0];
const g = rgb[1];
let b = rgb[2];
const h = $c2d1914d5080196d$var$convert.rgb.hsl(rgb)[0];
const w = 1 / 255 * Math.min(r, Math.min(g, b));
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
return [
h,
w * 100,
b * 100
];
};
$c2d1914d5080196d$var$convert.rgb.cmyk = function(rgb) {
const r = rgb[0] / 255;
const g = rgb[1] / 255;
const b = rgb[2] / 255;
const k = Math.min(1 - r, 1 - g, 1 - b);
const c = (1 - r - k) / (1 - k) || 0;
const m = (1 - g - k) / (1 - k) || 0;
const y = (1 - b - k) / (1 - k) || 0;
return [
c * 100,
m * 100,
y * 100,
k * 100
];
};
function $c2d1914d5080196d$var$comparativeDistance(x, y) {
/*
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
*/ return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
}
$c2d1914d5080196d$var$convert.rgb.keyword = function(rgb) {
const reversed = $c2d1914d5080196d$var$reverseKeywords[rgb];
if (reversed) return reversed;
let currentClosestDistance = Infinity;
let currentClosestKeyword;
for (const keyword of Object.keys($iOoWQ)){
const value = $iOoWQ[keyword];
// Compute comparative distance
const distance = $c2d1914d5080196d$var$comparativeDistance(rgb, value);
// Check if its less, if so set as closest
if (distance < currentClosestDistance) {
currentClosestDistance = distance;
currentClosestKeyword = keyword;
}
}
return currentClosestKeyword;
};
$c2d1914d5080196d$var$convert.keyword.rgb = function(keyword) {
return $iOoWQ[keyword];
};
$c2d1914d5080196d$var$convert.rgb.xyz = function(rgb) {
let r = rgb[0] / 255;
let g = rgb[1] / 255;
let b = rgb[2] / 255;
// Assume sRGB
r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
return [
x * 100,
y * 100,
z * 100
];
};
$c2d1914d5080196d$var$convert.rgb.lab = function(rgb) {
const xyz = $c2d1914d5080196d$var$convert.rgb.xyz(rgb);
let x = xyz[0];
let y = xyz[1];
let z = xyz[2];
x /= 95.047;
y /= 100;
z /= 108.883;
x = x > 0.008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
y = y > 0.008856 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
z = z > 0.008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
const l = 116 * y - 16;
const a = 500 * (x - y);
const b = 200 * (y - z);
return [
l,
a,
b
];
};
$c2d1914d5080196d$var$convert.hsl.rgb = function(hsl) {
const h = hsl[0] / 360;
const s = hsl[1] / 100;
const l = hsl[2] / 100;
let t2;
let t3;
let val;
if (s === 0) {
val = l * 255;
return [
val,
val,
val
];
}
if (l < 0.5) t2 = l * (1 + s);
else t2 = l + s - l * s;
const t1 = 2 * l - t2;
const rgb = [
0,
0,
0
];
for(let i = 0; i < 3; i++){
t3 = h + 1 / 3 * -(i - 1);
if (t3 < 0) t3++;
if (t3 > 1) t3--;
if (6 * t3 < 1) val = t1 + (t2 - t1) * 6 * t3;
else if (2 * t3 < 1) val = t2;
else if (3 * t3 < 2) val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
else val = t1;
rgb[i] = val * 255;
}
return rgb;
};
$c2d1914d5080196d$var$convert.hsl.hsv = function(hsl) {
const h = hsl[0];
let s = hsl[1] / 100;
let l = hsl[2] / 100;
let smin = s;
const lmin = Math.max(l, 0.01);
l *= 2;
s *= l <= 1 ? l : 2 - l;
smin *= lmin <= 1 ? lmin : 2 - lmin;
const v = (l + s) / 2;
const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
return [
h,
sv * 100,
v * 100
];
};
$c2d1914d5080196d$var$convert.hsv.rgb = function(hsv) {
const h = hsv[0] / 60;
const s = hsv[1] / 100;
let v = hsv[2] / 100;
const hi = Math.floor(h) % 6;
const f = h - Math.floor(h);
const p = 255 * v * (1 - s);
const q = 255 * v * (1 - s * f);
const t = 255 * v * (1 - s * (1 - f));
v *= 255;
switch(hi){
case 0:
return [
v,
t,
p
];
case 1:
return [
q,
v,
p
];
case 2:
return [
p,
v,
t
];
case 3:
return [
p,
q,
v
];
case 4:
return [
t,
p,
v
];
case 5:
return [
v,
p,
q
];
}
};
$c2d1914d5080196d$var$convert.hsv.hsl = function(hsv) {
const h = hsv[0];
const s = hsv[1] / 100;
const v = hsv[2] / 100;
const vmin = Math.max(v, 0.01);
let sl;
let l;
l = (2 - s) * v;
const lmin = (2 - s) * vmin;
sl = s * vmin;
sl /= lmin <= 1 ? lmin : 2 - lmin;
sl = sl || 0;
l /= 2;
return [
h,
sl * 100,
l * 100
];
};
// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
$c2d1914d5080196d$var$convert.hwb.rgb = function(hwb) {
const h = hwb[0] / 360;
let wh = hwb[1] / 100;
let bl = hwb[2] / 100;
const ratio = wh + bl;
let f;
// Wh + bl cant be > 1
if (ratio > 1) {
wh /= ratio;
bl /= ratio;
}
const i = Math.floor(6 * h);
const v = 1 - bl;
f = 6 * h - i;
if ((i & 0x01) !== 0) f = 1 - f;
const n = wh + f * (v - wh); // Linear interpolation
let r;
let g;
let b;
/* eslint-disable max-statements-per-line,no-multi-spaces */ switch(i){
default:
case 6:
case 0:
r = v;
g = n;
b = wh;
break;
case 1:
r = n;
g = v;
b = wh;
break;
case 2:
r = wh;
g = v;
b = n;
break;
case 3:
r = wh;
g = n;
b = v;
break;
case 4:
r = n;
g = wh;
b = v;
break;
case 5:
r = v;
g = wh;
b = n;
break;
}
/* eslint-enable max-statements-per-line,no-multi-spaces */ return [
r * 255,
g * 255,
b * 255
];
};
$c2d1914d5080196d$var$convert.cmyk.rgb = function(cmyk) {
const c = cmyk[0] / 100;
const m = cmyk[1] / 100;
const y = cmyk[2] / 100;
const k = cmyk[3] / 100;
const r = 1 - Math.min(1, c * (1 - k) + k);
const g = 1 - Math.min(1, m * (1 - k) + k);
const b = 1 - Math.min(1, y * (1 - k) + k);
return [
r * 255,
g * 255,
b * 255
];
};
$c2d1914d5080196d$var$convert.xyz.rgb = function(xyz) {
const x = xyz[0] / 100;
const y = xyz[1] / 100;
const z = xyz[2] / 100;
let r;
let g;
let b;
r = x * 3.2406 + y * -1.5372 + z * -0.4986;
g = x * -0.9689 + y * 1.8758 + z * 0.0415;
b = x * 0.0557 + y * -0.204 + z * 1.0570;
// Assume sRGB
r = r > 0.0031308 ? 1.055 * r ** (1.0 / 2.4) - 0.055 : r * 12.92;
g = g > 0.0031308 ? 1.055 * g ** (1.0 / 2.4) - 0.055 : g * 12.92;
b = b > 0.0031308 ? 1.055 * b ** (1.0 / 2.4) - 0.055 : b * 12.92;
r = Math.min(Math.max(0, r), 1);
g = Math.min(Math.max(0, g), 1);
b = Math.min(Math.max(0, b), 1);
return [
r * 255,
g * 255,
b * 255
];
};
$c2d1914d5080196d$var$convert.xyz.lab = function(xyz) {
let x = xyz[0];
let y = xyz[1];
let z = xyz[2];
x /= 95.047;
y /= 100;
z /= 108.883;
x = x > 0.008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
y = y > 0.008856 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
z = z > 0.008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
const l = 116 * y - 16;
const a = 500 * (x - y);
const b = 200 * (y - z);
return [
l,
a,
b
];
};
$c2d1914d5080196d$var$convert.lab.xyz = function(lab) {
const l = lab[0];
const a = lab[1];
const b = lab[2];
let x;
let y;
let z;
y = (l + 16) / 116;
x = a / 500 + y;
z = y - b / 200;
const y2 = y ** 3;
const x2 = x ** 3;
const z2 = z ** 3;
y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
x *= 95.047;
y *= 100;
z *= 108.883;
return [
x,
y,
z
];
};
$c2d1914d5080196d$var$convert.lab.lch = function(lab) {
const l = lab[0];
const a = lab[1];
const b = lab[2];
let h;
const hr = Math.atan2(b, a);
h = hr * 360 / 2 / Math.PI;
if (h < 0) h += 360;
const c = Math.sqrt(a * a + b * b);
return [
l,
c,
h
];
};
$c2d1914d5080196d$var$convert.lch.lab = function(lch) {
const l = lch[0];
const c = lch[1];
const h = lch[2];
const hr = h / 360 * 2 * Math.PI;
const a = c * Math.cos(hr);
const b = c * Math.sin(hr);
return [
l,
a,
b
];
};
$c2d1914d5080196d$var$convert.rgb.ansi16 = function(args, saturation = null) {
const [r, g, b] = args;
let value = saturation === null ? $c2d1914d5080196d$var$convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
value = Math.round(value / 50);
if (value === 0) return 30;
let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
if (value === 2) ansi += 60;
return ansi;
};
$c2d1914d5080196d$var$convert.hsv.ansi16 = function(args) {
// Optimization here; we already know the value and don't need to get
// it converted for us.
return $c2d1914d5080196d$var$convert.rgb.ansi16($c2d1914d5