@midscene/cli 1.9.6-beta-20260615080106.0 → 1.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/framework/index.mjs +2 -1
- package/dist/es/framework/index.mjs.map +1 -1
- package/dist/es/index.mjs +4 -2
- package/dist/es/index.mjs.map +1 -1
- package/dist/lib/framework/index.js +2 -1
- package/dist/lib/framework/index.js.map +1 -1
- package/dist/lib/index.js +4 -2
- package/dist/lib/index.js.map +1 -1
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framework/index.mjs","sources":["../../../../../node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js","../../../../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/index.js","../../../../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/templates.js","../../../../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/util.js","../../../../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js","../../../../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js","../../../../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js","../../../../../node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js","../../../../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js","../../../../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js","webpack/runtime/compat_get_default_export","webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/node_module_decorator","../../../src/execution-summary.ts","../../../src/framework/rstest-dependencies.ts","../../../src/framework/rstest-project.ts","../../../src/framework/rstest-runner.ts","../../../src/framework/command.ts","../../../../../node_modules/.pnpm/yocto-queue@1.2.1/node_modules/yocto-queue/index.js","../../../../../node_modules/.pnpm/p-limit@6.2.0/node_modules/p-limit/index.js","../../../src/create-yaml-player.ts","../../../src/printer.ts","../../../../../node_modules/.pnpm/mimic-function@5.0.1/node_modules/mimic-function/index.js","../../../../../node_modules/.pnpm/onetime@7.0.0/node_modules/onetime/index.js","../../../../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js","../../../../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js","../../../../../node_modules/.pnpm/restore-cursor@5.1.0/node_modules/restore-cursor/index.js","../../../src/tty-renderer.ts","../../../src/yaml-batch-executor.ts","../../../src/framework/yaml-batch.ts","../../../src/framework/yaml-case.ts","../../../src/framework/rstest-entry.ts"],"sourcesContent":["'use strict';\n\nconst wrapAnsi16 = (fn, offset) => (...args) => {\n\tconst code = fn(...args);\n\treturn `\\u001B[${code + offset}m`;\n};\n\nconst wrapAnsi256 = (fn, offset) => (...args) => {\n\tconst code = fn(...args);\n\treturn `\\u001B[${38 + offset};5;${code}m`;\n};\n\nconst wrapAnsi16m = (fn, offset) => (...args) => {\n\tconst rgb = fn(...args);\n\treturn `\\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;\n};\n\nconst ansi2ansi = n => n;\nconst rgb2rgb = (r, g, b) => [r, g, b];\n\nconst setLazyProperty = (object, property, get) => {\n\tObject.defineProperty(object, property, {\n\t\tget: () => {\n\t\t\tconst value = get();\n\n\t\t\tObject.defineProperty(object, property, {\n\t\t\t\tvalue,\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true\n\t\t\t});\n\n\t\t\treturn value;\n\t\t},\n\t\tenumerable: true,\n\t\tconfigurable: true\n\t});\n};\n\n/** @type {typeof import('color-convert')} */\nlet colorConvert;\nconst makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {\n\tif (colorConvert === undefined) {\n\t\tcolorConvert = require('color-convert');\n\t}\n\n\tconst offset = isBackground ? 10 : 0;\n\tconst styles = {};\n\n\tfor (const [sourceSpace, suite] of Object.entries(colorConvert)) {\n\t\tconst name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;\n\t\tif (sourceSpace === targetSpace) {\n\t\t\tstyles[name] = wrap(identity, offset);\n\t\t} else if (typeof suite === 'object') {\n\t\t\tstyles[name] = wrap(suite[targetSpace], offset);\n\t\t}\n\t}\n\n\treturn styles;\n};\n\nfunction assembleStyles() {\n\tconst codes = new Map();\n\tconst styles = {\n\t\tmodifier: {\n\t\t\treset: [0, 0],\n\t\t\t// 21 isn't widely supported and 22 does the same thing\n\t\t\tbold: [1, 22],\n\t\t\tdim: [2, 22],\n\t\t\titalic: [3, 23],\n\t\t\tunderline: [4, 24],\n\t\t\tinverse: [7, 27],\n\t\t\thidden: [8, 28],\n\t\t\tstrikethrough: [9, 29]\n\t\t},\n\t\tcolor: {\n\t\t\tblack: [30, 39],\n\t\t\tred: [31, 39],\n\t\t\tgreen: [32, 39],\n\t\t\tyellow: [33, 39],\n\t\t\tblue: [34, 39],\n\t\t\tmagenta: [35, 39],\n\t\t\tcyan: [36, 39],\n\t\t\twhite: [37, 39],\n\n\t\t\t// Bright color\n\t\t\tblackBright: [90, 39],\n\t\t\tredBright: [91, 39],\n\t\t\tgreenBright: [92, 39],\n\t\t\tyellowBright: [93, 39],\n\t\t\tblueBright: [94, 39],\n\t\t\tmagentaBright: [95, 39],\n\t\t\tcyanBright: [96, 39],\n\t\t\twhiteBright: [97, 39]\n\t\t},\n\t\tbgColor: {\n\t\t\tbgBlack: [40, 49],\n\t\t\tbgRed: [41, 49],\n\t\t\tbgGreen: [42, 49],\n\t\t\tbgYellow: [43, 49],\n\t\t\tbgBlue: [44, 49],\n\t\t\tbgMagenta: [45, 49],\n\t\t\tbgCyan: [46, 49],\n\t\t\tbgWhite: [47, 49],\n\n\t\t\t// Bright color\n\t\t\tbgBlackBright: [100, 49],\n\t\t\tbgRedBright: [101, 49],\n\t\t\tbgGreenBright: [102, 49],\n\t\t\tbgYellowBright: [103, 49],\n\t\t\tbgBlueBright: [104, 49],\n\t\t\tbgMagentaBright: [105, 49],\n\t\t\tbgCyanBright: [106, 49],\n\t\t\tbgWhiteBright: [107, 49]\n\t\t}\n\t};\n\n\t// Alias bright black as gray (and grey)\n\tstyles.color.gray = styles.color.blackBright;\n\tstyles.bgColor.bgGray = styles.bgColor.bgBlackBright;\n\tstyles.color.grey = styles.color.blackBright;\n\tstyles.bgColor.bgGrey = styles.bgColor.bgBlackBright;\n\n\tfor (const [groupName, group] of Object.entries(styles)) {\n\t\tfor (const [styleName, style] of Object.entries(group)) {\n\t\t\tstyles[styleName] = {\n\t\t\t\topen: `\\u001B[${style[0]}m`,\n\t\t\t\tclose: `\\u001B[${style[1]}m`\n\t\t\t};\n\n\t\t\tgroup[styleName] = styles[styleName];\n\n\t\t\tcodes.set(style[0], style[1]);\n\t\t}\n\n\t\tObject.defineProperty(styles, groupName, {\n\t\t\tvalue: group,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tObject.defineProperty(styles, 'codes', {\n\t\tvalue: codes,\n\t\tenumerable: false\n\t});\n\n\tstyles.color.close = '\\u001B[39m';\n\tstyles.bgColor.close = '\\u001B[49m';\n\n\tsetLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));\n\tsetLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));\n\tsetLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));\n\tsetLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));\n\tsetLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));\n\tsetLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));\n\n\treturn styles;\n}\n\n// Make the export immutable\nObject.defineProperty(module, 'exports', {\n\tenumerable: true,\n\tget: assembleStyles\n});\n","'use strict';\nconst ansiStyles = require('ansi-styles');\nconst {stdout: stdoutColor, stderr: stderrColor} = require('supports-color');\nconst {\n\tstringReplaceAll,\n\tstringEncaseCRLFWithFirstIndex\n} = require('./util');\n\nconst {isArray} = Array;\n\n// `supportsColor.level` → `ansiStyles.color[name]` mapping\nconst levelMapping = [\n\t'ansi',\n\t'ansi',\n\t'ansi256',\n\t'ansi16m'\n];\n\nconst styles = Object.create(null);\n\nconst applyOptions = (object, options = {}) => {\n\tif (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {\n\t\tthrow new Error('The `level` option should be an integer from 0 to 3');\n\t}\n\n\t// Detect level if not set manually\n\tconst colorLevel = stdoutColor ? stdoutColor.level : 0;\n\tobject.level = options.level === undefined ? colorLevel : options.level;\n};\n\nclass ChalkClass {\n\tconstructor(options) {\n\t\t// eslint-disable-next-line no-constructor-return\n\t\treturn chalkFactory(options);\n\t}\n}\n\nconst chalkFactory = options => {\n\tconst chalk = {};\n\tapplyOptions(chalk, options);\n\n\tchalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_);\n\n\tObject.setPrototypeOf(chalk, Chalk.prototype);\n\tObject.setPrototypeOf(chalk.template, chalk);\n\n\tchalk.template.constructor = () => {\n\t\tthrow new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.');\n\t};\n\n\tchalk.template.Instance = ChalkClass;\n\n\treturn chalk.template;\n};\n\nfunction Chalk(options) {\n\treturn chalkFactory(options);\n}\n\nfor (const [styleName, style] of Object.entries(ansiStyles)) {\n\tstyles[styleName] = {\n\t\tget() {\n\t\t\tconst builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);\n\t\t\tObject.defineProperty(this, styleName, {value: builder});\n\t\t\treturn builder;\n\t\t}\n\t};\n}\n\nstyles.visible = {\n\tget() {\n\t\tconst builder = createBuilder(this, this._styler, true);\n\t\tObject.defineProperty(this, 'visible', {value: builder});\n\t\treturn builder;\n\t}\n};\n\nconst usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256'];\n\nfor (const model of usedModels) {\n\tstyles[model] = {\n\t\tget() {\n\t\t\tconst {level} = this;\n\t\t\treturn function (...arguments_) {\n\t\t\t\tconst styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);\n\t\t\t\treturn createBuilder(this, styler, this._isEmpty);\n\t\t\t};\n\t\t}\n\t};\n}\n\nfor (const model of usedModels) {\n\tconst bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);\n\tstyles[bgModel] = {\n\t\tget() {\n\t\t\tconst {level} = this;\n\t\t\treturn function (...arguments_) {\n\t\t\t\tconst styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);\n\t\t\t\treturn createBuilder(this, styler, this._isEmpty);\n\t\t\t};\n\t\t}\n\t};\n}\n\nconst proto = Object.defineProperties(() => {}, {\n\t...styles,\n\tlevel: {\n\t\tenumerable: true,\n\t\tget() {\n\t\t\treturn this._generator.level;\n\t\t},\n\t\tset(level) {\n\t\t\tthis._generator.level = level;\n\t\t}\n\t}\n});\n\nconst createStyler = (open, close, parent) => {\n\tlet openAll;\n\tlet closeAll;\n\tif (parent === undefined) {\n\t\topenAll = open;\n\t\tcloseAll = close;\n\t} else {\n\t\topenAll = parent.openAll + open;\n\t\tcloseAll = close + parent.closeAll;\n\t}\n\n\treturn {\n\t\topen,\n\t\tclose,\n\t\topenAll,\n\t\tcloseAll,\n\t\tparent\n\t};\n};\n\nconst createBuilder = (self, _styler, _isEmpty) => {\n\tconst builder = (...arguments_) => {\n\t\tif (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {\n\t\t\t// Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}`\n\t\t\treturn applyStyle(builder, chalkTag(builder, ...arguments_));\n\t\t}\n\n\t\t// Single argument is hot path, implicit coercion is faster than anything\n\t\t// eslint-disable-next-line no-implicit-coercion\n\t\treturn applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));\n\t};\n\n\t// We alter the prototype because we must return a function, but there is\n\t// no way to create a function with a different prototype\n\tObject.setPrototypeOf(builder, proto);\n\n\tbuilder._generator = self;\n\tbuilder._styler = _styler;\n\tbuilder._isEmpty = _isEmpty;\n\n\treturn builder;\n};\n\nconst applyStyle = (self, string) => {\n\tif (self.level <= 0 || !string) {\n\t\treturn self._isEmpty ? '' : string;\n\t}\n\n\tlet styler = self._styler;\n\n\tif (styler === undefined) {\n\t\treturn string;\n\t}\n\n\tconst {openAll, closeAll} = styler;\n\tif (string.indexOf('\\u001B') !== -1) {\n\t\twhile (styler !== undefined) {\n\t\t\t// Replace any instances already present with a re-opening code\n\t\t\t// otherwise only the part of the string until said closing code\n\t\t\t// will be colored, and the rest will simply be 'plain'.\n\t\t\tstring = stringReplaceAll(string, styler.close, styler.open);\n\n\t\t\tstyler = styler.parent;\n\t\t}\n\t}\n\n\t// We can move both next actions out of loop, because remaining actions in loop won't have\n\t// any/visible effect on parts we add here. Close the styling before a linebreak and reopen\n\t// after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92\n\tconst lfIndex = string.indexOf('\\n');\n\tif (lfIndex !== -1) {\n\t\tstring = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);\n\t}\n\n\treturn openAll + string + closeAll;\n};\n\nlet template;\nconst chalkTag = (chalk, ...strings) => {\n\tconst [firstString] = strings;\n\n\tif (!isArray(firstString) || !isArray(firstString.raw)) {\n\t\t// If chalk() was called by itself or with a string,\n\t\t// return the string itself as a string.\n\t\treturn strings.join(' ');\n\t}\n\n\tconst arguments_ = strings.slice(1);\n\tconst parts = [firstString.raw[0]];\n\n\tfor (let i = 1; i < firstString.length; i++) {\n\t\tparts.push(\n\t\t\tString(arguments_[i - 1]).replace(/[{}\\\\]/g, '\\\\$&'),\n\t\t\tString(firstString.raw[i])\n\t\t);\n\t}\n\n\tif (template === undefined) {\n\t\ttemplate = require('./templates');\n\t}\n\n\treturn template(chalk, parts.join(''));\n};\n\nObject.defineProperties(Chalk.prototype, styles);\n\nconst chalk = Chalk(); // eslint-disable-line new-cap\nchalk.supportsColor = stdoutColor;\nchalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap\nchalk.stderr.supportsColor = stderrColor;\n\nmodule.exports = chalk;\n","'use strict';\nconst TEMPLATE_REGEX = /(?:\\\\(u(?:[a-f\\d]{4}|\\{[a-f\\d]{1,6}\\})|x[a-f\\d]{2}|.))|(?:\\{(~)?(\\w+(?:\\([^)]*\\))?(?:\\.\\w+(?:\\([^)]*\\))?)*)(?:[ \\t]|(?=\\r?\\n)))|(\\})|((?:.|[\\r\\n\\f])+?)/gi;\nconst STYLE_REGEX = /(?:^|\\.)(\\w+)(?:\\(([^)]*)\\))?/g;\nconst STRING_REGEX = /^(['\"])((?:\\\\.|(?!\\1)[^\\\\])*)\\1$/;\nconst ESCAPE_REGEX = /\\\\(u(?:[a-f\\d]{4}|{[a-f\\d]{1,6}})|x[a-f\\d]{2}|.)|([^\\\\])/gi;\n\nconst ESCAPES = new Map([\n\t['n', '\\n'],\n\t['r', '\\r'],\n\t['t', '\\t'],\n\t['b', '\\b'],\n\t['f', '\\f'],\n\t['v', '\\v'],\n\t['0', '\\0'],\n\t['\\\\', '\\\\'],\n\t['e', '\\u001B'],\n\t['a', '\\u0007']\n]);\n\nfunction unescape(c) {\n\tconst u = c[0] === 'u';\n\tconst bracket = c[1] === '{';\n\n\tif ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) {\n\t\treturn String.fromCharCode(parseInt(c.slice(1), 16));\n\t}\n\n\tif (u && bracket) {\n\t\treturn String.fromCodePoint(parseInt(c.slice(2, -1), 16));\n\t}\n\n\treturn ESCAPES.get(c) || c;\n}\n\nfunction parseArguments(name, arguments_) {\n\tconst results = [];\n\tconst chunks = arguments_.trim().split(/\\s*,\\s*/g);\n\tlet matches;\n\n\tfor (const chunk of chunks) {\n\t\tconst number = Number(chunk);\n\t\tif (!Number.isNaN(number)) {\n\t\t\tresults.push(number);\n\t\t} else if ((matches = chunk.match(STRING_REGEX))) {\n\t\t\tresults.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));\n\t\t} else {\n\t\t\tthrow new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);\n\t\t}\n\t}\n\n\treturn results;\n}\n\nfunction parseStyle(style) {\n\tSTYLE_REGEX.lastIndex = 0;\n\n\tconst results = [];\n\tlet matches;\n\n\twhile ((matches = STYLE_REGEX.exec(style)) !== null) {\n\t\tconst name = matches[1];\n\n\t\tif (matches[2]) {\n\t\t\tconst args = parseArguments(name, matches[2]);\n\t\t\tresults.push([name].concat(args));\n\t\t} else {\n\t\t\tresults.push([name]);\n\t\t}\n\t}\n\n\treturn results;\n}\n\nfunction buildStyle(chalk, styles) {\n\tconst enabled = {};\n\n\tfor (const layer of styles) {\n\t\tfor (const style of layer.styles) {\n\t\t\tenabled[style[0]] = layer.inverse ? null : style.slice(1);\n\t\t}\n\t}\n\n\tlet current = chalk;\n\tfor (const [styleName, styles] of Object.entries(enabled)) {\n\t\tif (!Array.isArray(styles)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!(styleName in current)) {\n\t\t\tthrow new Error(`Unknown Chalk style: ${styleName}`);\n\t\t}\n\n\t\tcurrent = styles.length > 0 ? current[styleName](...styles) : current[styleName];\n\t}\n\n\treturn current;\n}\n\nmodule.exports = (chalk, temporary) => {\n\tconst styles = [];\n\tconst chunks = [];\n\tlet chunk = [];\n\n\t// eslint-disable-next-line max-params\n\ttemporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {\n\t\tif (escapeCharacter) {\n\t\t\tchunk.push(unescape(escapeCharacter));\n\t\t} else if (style) {\n\t\t\tconst string = chunk.join('');\n\t\t\tchunk = [];\n\t\t\tchunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string));\n\t\t\tstyles.push({inverse, styles: parseStyle(style)});\n\t\t} else if (close) {\n\t\t\tif (styles.length === 0) {\n\t\t\t\tthrow new Error('Found extraneous } in Chalk template literal');\n\t\t\t}\n\n\t\t\tchunks.push(buildStyle(chalk, styles)(chunk.join('')));\n\t\t\tchunk = [];\n\t\t\tstyles.pop();\n\t\t} else {\n\t\t\tchunk.push(character);\n\t\t}\n\t});\n\n\tchunks.push(chunk.join(''));\n\n\tif (styles.length > 0) {\n\t\tconst errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\\`}\\`)`;\n\t\tthrow new Error(errMessage);\n\t}\n\n\treturn chunks.join('');\n};\n","'use strict';\n\nconst stringReplaceAll = (string, substring, replacer) => {\n\tlet index = string.indexOf(substring);\n\tif (index === -1) {\n\t\treturn string;\n\t}\n\n\tconst substringLength = substring.length;\n\tlet endIndex = 0;\n\tlet returnValue = '';\n\tdo {\n\t\treturnValue += string.substr(endIndex, index - endIndex) + substring + replacer;\n\t\tendIndex = index + substringLength;\n\t\tindex = string.indexOf(substring, endIndex);\n\t} while (index !== -1);\n\n\treturnValue += string.substr(endIndex);\n\treturn returnValue;\n};\n\nconst stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {\n\tlet endIndex = 0;\n\tlet returnValue = '';\n\tdo {\n\t\tconst gotCR = string[index - 1] === '\\r';\n\t\treturnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\\r\\n' : '\\n') + postfix;\n\t\tendIndex = index + 1;\n\t\tindex = string.indexOf('\\n', endIndex);\n\t} while (index !== -1);\n\n\treturnValue += string.substr(endIndex);\n\treturn returnValue;\n};\n\nmodule.exports = {\n\tstringReplaceAll,\n\tstringEncaseCRLFWithFirstIndex\n};\n","/* MIT license */\n/* eslint-disable no-mixed-operators */\nconst cssKeywords = require('color-name');\n\n// NOTE: conversions should only return primitive values (i.e. arrays, or\n// values that give correct `typeof` results).\n// do not use box values types (i.e. Number(), String(), etc.)\n\nconst reverseKeywords = {};\nfor (const key of Object.keys(cssKeywords)) {\n\treverseKeywords[cssKeywords[key]] = key;\n}\n\nconst convert = {\n\trgb: {channels: 3, labels: 'rgb'},\n\thsl: {channels: 3, labels: 'hsl'},\n\thsv: {channels: 3, labels: 'hsv'},\n\thwb: {channels: 3, labels: 'hwb'},\n\tcmyk: {channels: 4, labels: 'cmyk'},\n\txyz: {channels: 3, labels: 'xyz'},\n\tlab: {channels: 3, labels: 'lab'},\n\tlch: {channels: 3, labels: 'lch'},\n\thex: {channels: 1, labels: ['hex']},\n\tkeyword: {channels: 1, labels: ['keyword']},\n\tansi16: {channels: 1, labels: ['ansi16']},\n\tansi256: {channels: 1, labels: ['ansi256']},\n\thcg: {channels: 3, labels: ['h', 'c', 'g']},\n\tapple: {channels: 3, labels: ['r16', 'g16', 'b16']},\n\tgray: {channels: 1, labels: ['gray']}\n};\n\nmodule.exports = convert;\n\n// Hide .channels and .labels properties\nfor (const model of Object.keys(convert)) {\n\tif (!('channels' in convert[model])) {\n\t\tthrow new Error('missing channels property: ' + model);\n\t}\n\n\tif (!('labels' in convert[model])) {\n\t\tthrow new Error('missing channel labels property: ' + model);\n\t}\n\n\tif (convert[model].labels.length !== convert[model].channels) {\n\t\tthrow new Error('channel and label counts mismatch: ' + model);\n\t}\n\n\tconst {channels, labels} = convert[model];\n\tdelete convert[model].channels;\n\tdelete convert[model].labels;\n\tObject.defineProperty(convert[model], 'channels', {value: channels});\n\tObject.defineProperty(convert[model], 'labels', {value: labels});\n}\n\nconvert.rgb.hsl = function (rgb) {\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\tconst min = Math.min(r, g, b);\n\tconst max = Math.max(r, g, b);\n\tconst delta = max - min;\n\tlet h;\n\tlet s;\n\n\tif (max === min) {\n\t\th = 0;\n\t} else if (r === max) {\n\t\th = (g - b) / delta;\n\t} else if (g === max) {\n\t\th = 2 + (b - r) / delta;\n\t} else if (b === max) {\n\t\th = 4 + (r - g) / delta;\n\t}\n\n\th = Math.min(h * 60, 360);\n\n\tif (h < 0) {\n\t\th += 360;\n\t}\n\n\tconst l = (min + max) / 2;\n\n\tif (max === min) {\n\t\ts = 0;\n\t} else if (l <= 0.5) {\n\t\ts = delta / (max + min);\n\t} else {\n\t\ts = delta / (2 - max - min);\n\t}\n\n\treturn [h, s * 100, l * 100];\n};\n\nconvert.rgb.hsv = function (rgb) {\n\tlet rdif;\n\tlet gdif;\n\tlet bdif;\n\tlet h;\n\tlet s;\n\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\tconst v = Math.max(r, g, b);\n\tconst diff = v - Math.min(r, g, b);\n\tconst diffc = function (c) {\n\t\treturn (v - c) / 6 / diff + 1 / 2;\n\t};\n\n\tif (diff === 0) {\n\t\th = 0;\n\t\ts = 0;\n\t} else {\n\t\ts = diff / v;\n\t\trdif = diffc(r);\n\t\tgdif = diffc(g);\n\t\tbdif = diffc(b);\n\n\t\tif (r === v) {\n\t\t\th = bdif - gdif;\n\t\t} else if (g === v) {\n\t\t\th = (1 / 3) + rdif - bdif;\n\t\t} else if (b === v) {\n\t\t\th = (2 / 3) + gdif - rdif;\n\t\t}\n\n\t\tif (h < 0) {\n\t\t\th += 1;\n\t\t} else if (h > 1) {\n\t\t\th -= 1;\n\t\t}\n\t}\n\n\treturn [\n\t\th * 360,\n\t\ts * 100,\n\t\tv * 100\n\t];\n};\n\nconvert.rgb.hwb = function (rgb) {\n\tconst r = rgb[0];\n\tconst g = rgb[1];\n\tlet b = rgb[2];\n\tconst h = convert.rgb.hsl(rgb)[0];\n\tconst w = 1 / 255 * Math.min(r, Math.min(g, b));\n\n\tb = 1 - 1 / 255 * Math.max(r, Math.max(g, b));\n\n\treturn [h, w * 100, b * 100];\n};\n\nconvert.rgb.cmyk = function (rgb) {\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\n\tconst k = Math.min(1 - r, 1 - g, 1 - b);\n\tconst c = (1 - r - k) / (1 - k) || 0;\n\tconst m = (1 - g - k) / (1 - k) || 0;\n\tconst y = (1 - b - k) / (1 - k) || 0;\n\n\treturn [c * 100, m * 100, y * 100, k * 100];\n};\n\nfunction comparativeDistance(x, y) {\n\t/*\n\t\tSee https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance\n\t*/\n\treturn (\n\t\t((x[0] - y[0]) ** 2) +\n\t\t((x[1] - y[1]) ** 2) +\n\t\t((x[2] - y[2]) ** 2)\n\t);\n}\n\nconvert.rgb.keyword = function (rgb) {\n\tconst reversed = reverseKeywords[rgb];\n\tif (reversed) {\n\t\treturn reversed;\n\t}\n\n\tlet currentClosestDistance = Infinity;\n\tlet currentClosestKeyword;\n\n\tfor (const keyword of Object.keys(cssKeywords)) {\n\t\tconst value = cssKeywords[keyword];\n\n\t\t// Compute comparative distance\n\t\tconst distance = comparativeDistance(rgb, value);\n\n\t\t// Check if its less, if so set as closest\n\t\tif (distance < currentClosestDistance) {\n\t\t\tcurrentClosestDistance = distance;\n\t\t\tcurrentClosestKeyword = keyword;\n\t\t}\n\t}\n\n\treturn currentClosestKeyword;\n};\n\nconvert.keyword.rgb = function (keyword) {\n\treturn cssKeywords[keyword];\n};\n\nconvert.rgb.xyz = function (rgb) {\n\tlet r = rgb[0] / 255;\n\tlet g = rgb[1] / 255;\n\tlet b = rgb[2] / 255;\n\n\t// Assume sRGB\n\tr = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);\n\tg = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);\n\tb = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);\n\n\tconst x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);\n\tconst y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);\n\tconst z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);\n\n\treturn [x * 100, y * 100, z * 100];\n};\n\nconvert.rgb.lab = function (rgb) {\n\tconst xyz = convert.rgb.xyz(rgb);\n\tlet x = xyz[0];\n\tlet y = xyz[1];\n\tlet z = xyz[2];\n\n\tx /= 95.047;\n\ty /= 100;\n\tz /= 108.883;\n\n\tx = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);\n\ty = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);\n\tz = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);\n\n\tconst l = (116 * y) - 16;\n\tconst a = 500 * (x - y);\n\tconst b = 200 * (y - z);\n\n\treturn [l, a, b];\n};\n\nconvert.hsl.rgb = function (hsl) {\n\tconst h = hsl[0] / 360;\n\tconst s = hsl[1] / 100;\n\tconst l = hsl[2] / 100;\n\tlet t2;\n\tlet t3;\n\tlet val;\n\n\tif (s === 0) {\n\t\tval = l * 255;\n\t\treturn [val, val, val];\n\t}\n\n\tif (l < 0.5) {\n\t\tt2 = l * (1 + s);\n\t} else {\n\t\tt2 = l + s - l * s;\n\t}\n\n\tconst t1 = 2 * l - t2;\n\n\tconst rgb = [0, 0, 0];\n\tfor (let i = 0; i < 3; i++) {\n\t\tt3 = h + 1 / 3 * -(i - 1);\n\t\tif (t3 < 0) {\n\t\t\tt3++;\n\t\t}\n\n\t\tif (t3 > 1) {\n\t\t\tt3--;\n\t\t}\n\n\t\tif (6 * t3 < 1) {\n\t\t\tval = t1 + (t2 - t1) * 6 * t3;\n\t\t} else if (2 * t3 < 1) {\n\t\t\tval = t2;\n\t\t} else if (3 * t3 < 2) {\n\t\t\tval = t1 + (t2 - t1) * (2 / 3 - t3) * 6;\n\t\t} else {\n\t\t\tval = t1;\n\t\t}\n\n\t\trgb[i] = val * 255;\n\t}\n\n\treturn rgb;\n};\n\nconvert.hsl.hsv = function (hsl) {\n\tconst h = hsl[0];\n\tlet s = hsl[1] / 100;\n\tlet l = hsl[2] / 100;\n\tlet smin = s;\n\tconst lmin = Math.max(l, 0.01);\n\n\tl *= 2;\n\ts *= (l <= 1) ? l : 2 - l;\n\tsmin *= lmin <= 1 ? lmin : 2 - lmin;\n\tconst v = (l + s) / 2;\n\tconst sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);\n\n\treturn [h, sv * 100, v * 100];\n};\n\nconvert.hsv.rgb = function (hsv) {\n\tconst h = hsv[0] / 60;\n\tconst s = hsv[1] / 100;\n\tlet v = hsv[2] / 100;\n\tconst hi = Math.floor(h) % 6;\n\n\tconst f = h - Math.floor(h);\n\tconst p = 255 * v * (1 - s);\n\tconst q = 255 * v * (1 - (s * f));\n\tconst t = 255 * v * (1 - (s * (1 - f)));\n\tv *= 255;\n\n\tswitch (hi) {\n\t\tcase 0:\n\t\t\treturn [v, t, p];\n\t\tcase 1:\n\t\t\treturn [q, v, p];\n\t\tcase 2:\n\t\t\treturn [p, v, t];\n\t\tcase 3:\n\t\t\treturn [p, q, v];\n\t\tcase 4:\n\t\t\treturn [t, p, v];\n\t\tcase 5:\n\t\t\treturn [v, p, q];\n\t}\n};\n\nconvert.hsv.hsl = function (hsv) {\n\tconst h = hsv[0];\n\tconst s = hsv[1] / 100;\n\tconst v = hsv[2] / 100;\n\tconst vmin = Math.max(v, 0.01);\n\tlet sl;\n\tlet l;\n\n\tl = (2 - s) * v;\n\tconst lmin = (2 - s) * vmin;\n\tsl = s * vmin;\n\tsl /= (lmin <= 1) ? lmin : 2 - lmin;\n\tsl = sl || 0;\n\tl /= 2;\n\n\treturn [h, sl * 100, l * 100];\n};\n\n// http://dev.w3.org/csswg/css-color/#hwb-to-rgb\nconvert.hwb.rgb = function (hwb) {\n\tconst h = hwb[0] / 360;\n\tlet wh = hwb[1] / 100;\n\tlet bl = hwb[2] / 100;\n\tconst ratio = wh + bl;\n\tlet f;\n\n\t// Wh + bl cant be > 1\n\tif (ratio > 1) {\n\t\twh /= ratio;\n\t\tbl /= ratio;\n\t}\n\n\tconst i = Math.floor(6 * h);\n\tconst v = 1 - bl;\n\tf = 6 * h - i;\n\n\tif ((i & 0x01) !== 0) {\n\t\tf = 1 - f;\n\t}\n\n\tconst n = wh + f * (v - wh); // Linear interpolation\n\n\tlet r;\n\tlet g;\n\tlet b;\n\t/* eslint-disable max-statements-per-line,no-multi-spaces */\n\tswitch (i) {\n\t\tdefault:\n\t\tcase 6:\n\t\tcase 0: r = v; g = n; b = wh; break;\n\t\tcase 1: r = n; g = v; b = wh; break;\n\t\tcase 2: r = wh; g = v; b = n; break;\n\t\tcase 3: r = wh; g = n; b = v; break;\n\t\tcase 4: r = n; g = wh; b = v; break;\n\t\tcase 5: r = v; g = wh; b = n; break;\n\t}\n\t/* eslint-enable max-statements-per-line,no-multi-spaces */\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.cmyk.rgb = function (cmyk) {\n\tconst c = cmyk[0] / 100;\n\tconst m = cmyk[1] / 100;\n\tconst y = cmyk[2] / 100;\n\tconst k = cmyk[3] / 100;\n\n\tconst r = 1 - Math.min(1, c * (1 - k) + k);\n\tconst g = 1 - Math.min(1, m * (1 - k) + k);\n\tconst b = 1 - Math.min(1, y * (1 - k) + k);\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.xyz.rgb = function (xyz) {\n\tconst x = xyz[0] / 100;\n\tconst y = xyz[1] / 100;\n\tconst z = xyz[2] / 100;\n\tlet r;\n\tlet g;\n\tlet b;\n\n\tr = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);\n\tg = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);\n\tb = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);\n\n\t// Assume sRGB\n\tr = r > 0.0031308\n\t\t? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)\n\t\t: r * 12.92;\n\n\tg = g > 0.0031308\n\t\t? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)\n\t\t: g * 12.92;\n\n\tb = b > 0.0031308\n\t\t? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)\n\t\t: b * 12.92;\n\n\tr = Math.min(Math.max(0, r), 1);\n\tg = Math.min(Math.max(0, g), 1);\n\tb = Math.min(Math.max(0, b), 1);\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.xyz.lab = function (xyz) {\n\tlet x = xyz[0];\n\tlet y = xyz[1];\n\tlet z = xyz[2];\n\n\tx /= 95.047;\n\ty /= 100;\n\tz /= 108.883;\n\n\tx = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);\n\ty = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);\n\tz = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);\n\n\tconst l = (116 * y) - 16;\n\tconst a = 500 * (x - y);\n\tconst b = 200 * (y - z);\n\n\treturn [l, a, b];\n};\n\nconvert.lab.xyz = function (lab) {\n\tconst l = lab[0];\n\tconst a = lab[1];\n\tconst b = lab[2];\n\tlet x;\n\tlet y;\n\tlet z;\n\n\ty = (l + 16) / 116;\n\tx = a / 500 + y;\n\tz = y - b / 200;\n\n\tconst y2 = y ** 3;\n\tconst x2 = x ** 3;\n\tconst z2 = z ** 3;\n\ty = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;\n\tx = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;\n\tz = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;\n\n\tx *= 95.047;\n\ty *= 100;\n\tz *= 108.883;\n\n\treturn [x, y, z];\n};\n\nconvert.lab.lch = function (lab) {\n\tconst l = lab[0];\n\tconst a = lab[1];\n\tconst b = lab[2];\n\tlet h;\n\n\tconst hr = Math.atan2(b, a);\n\th = hr * 360 / 2 / Math.PI;\n\n\tif (h < 0) {\n\t\th += 360;\n\t}\n\n\tconst c = Math.sqrt(a * a + b * b);\n\n\treturn [l, c, h];\n};\n\nconvert.lch.lab = function (lch) {\n\tconst l = lch[0];\n\tconst c = lch[1];\n\tconst h = lch[2];\n\n\tconst hr = h / 360 * 2 * Math.PI;\n\tconst a = c * Math.cos(hr);\n\tconst b = c * Math.sin(hr);\n\n\treturn [l, a, b];\n};\n\nconvert.rgb.ansi16 = function (args, saturation = null) {\n\tconst [r, g, b] = args;\n\tlet value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization\n\n\tvalue = Math.round(value / 50);\n\n\tif (value === 0) {\n\t\treturn 30;\n\t}\n\n\tlet ansi = 30\n\t\t+ ((Math.round(b / 255) << 2)\n\t\t| (Math.round(g / 255) << 1)\n\t\t| Math.round(r / 255));\n\n\tif (value === 2) {\n\t\tansi += 60;\n\t}\n\n\treturn ansi;\n};\n\nconvert.hsv.ansi16 = function (args) {\n\t// Optimization here; we already know the value and don't need to get\n\t// it converted for us.\n\treturn convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);\n};\n\nconvert.rgb.ansi256 = function (args) {\n\tconst r = args[0];\n\tconst g = args[1];\n\tconst b = args[2];\n\n\t// We use the extended greyscale palette here, with the exception of\n\t// black and white. normal palette only has 4 greyscale shades.\n\tif (r === g && g === b) {\n\t\tif (r < 8) {\n\t\t\treturn 16;\n\t\t}\n\n\t\tif (r > 248) {\n\t\t\treturn 231;\n\t\t}\n\n\t\treturn Math.round(((r - 8) / 247) * 24) + 232;\n\t}\n\n\tconst ansi = 16\n\t\t+ (36 * Math.round(r / 255 * 5))\n\t\t+ (6 * Math.round(g / 255 * 5))\n\t\t+ Math.round(b / 255 * 5);\n\n\treturn ansi;\n};\n\nconvert.ansi16.rgb = function (args) {\n\tlet color = args % 10;\n\n\t// Handle greyscale\n\tif (color === 0 || color === 7) {\n\t\tif (args > 50) {\n\t\t\tcolor += 3.5;\n\t\t}\n\n\t\tcolor = color / 10.5 * 255;\n\n\t\treturn [color, color, color];\n\t}\n\n\tconst mult = (~~(args > 50) + 1) * 0.5;\n\tconst r = ((color & 1) * mult) * 255;\n\tconst g = (((color >> 1) & 1) * mult) * 255;\n\tconst b = (((color >> 2) & 1) * mult) * 255;\n\n\treturn [r, g, b];\n};\n\nconvert.ansi256.rgb = function (args) {\n\t// Handle greyscale\n\tif (args >= 232) {\n\t\tconst c = (args - 232) * 10 + 8;\n\t\treturn [c, c, c];\n\t}\n\n\targs -= 16;\n\n\tlet rem;\n\tconst r = Math.floor(args / 36) / 5 * 255;\n\tconst g = Math.floor((rem = args % 36) / 6) / 5 * 255;\n\tconst b = (rem % 6) / 5 * 255;\n\n\treturn [r, g, b];\n};\n\nconvert.rgb.hex = function (args) {\n\tconst integer = ((Math.round(args[0]) & 0xFF) << 16)\n\t\t+ ((Math.round(args[1]) & 0xFF) << 8)\n\t\t+ (Math.round(args[2]) & 0xFF);\n\n\tconst string = integer.toString(16).toUpperCase();\n\treturn '000000'.substring(string.length) + string;\n};\n\nconvert.hex.rgb = function (args) {\n\tconst match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);\n\tif (!match) {\n\t\treturn [0, 0, 0];\n\t}\n\n\tlet colorString = match[0];\n\n\tif (match[0].length === 3) {\n\t\tcolorString = colorString.split('').map(char => {\n\t\t\treturn char + char;\n\t\t}).join('');\n\t}\n\n\tconst integer = parseInt(colorString, 16);\n\tconst r = (integer >> 16) & 0xFF;\n\tconst g = (integer >> 8) & 0xFF;\n\tconst b = integer & 0xFF;\n\n\treturn [r, g, b];\n};\n\nconvert.rgb.hcg = function (rgb) {\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\tconst max = Math.max(Math.max(r, g), b);\n\tconst min = Math.min(Math.min(r, g), b);\n\tconst chroma = (max - min);\n\tlet grayscale;\n\tlet hue;\n\n\tif (chroma < 1) {\n\t\tgrayscale = min / (1 - chroma);\n\t} else {\n\t\tgrayscale = 0;\n\t}\n\n\tif (chroma <= 0) {\n\t\thue = 0;\n\t} else\n\tif (max === r) {\n\t\thue = ((g - b) / chroma) % 6;\n\t} else\n\tif (max === g) {\n\t\thue = 2 + (b - r) / chroma;\n\t} else {\n\t\thue = 4 + (r - g) / chroma;\n\t}\n\n\thue /= 6;\n\thue %= 1;\n\n\treturn [hue * 360, chroma * 100, grayscale * 100];\n};\n\nconvert.hsl.hcg = function (hsl) {\n\tconst s = hsl[1] / 100;\n\tconst l = hsl[2] / 100;\n\n\tconst c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));\n\n\tlet f = 0;\n\tif (c < 1.0) {\n\t\tf = (l - 0.5 * c) / (1.0 - c);\n\t}\n\n\treturn [hsl[0], c * 100, f * 100];\n};\n\nconvert.hsv.hcg = function (hsv) {\n\tconst s = hsv[1] / 100;\n\tconst v = hsv[2] / 100;\n\n\tconst c = s * v;\n\tlet f = 0;\n\n\tif (c < 1.0) {\n\t\tf = (v - c) / (1 - c);\n\t}\n\n\treturn [hsv[0], c * 100, f * 100];\n};\n\nconvert.hcg.rgb = function (hcg) {\n\tconst h = hcg[0] / 360;\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\n\tif (c === 0.0) {\n\t\treturn [g * 255, g * 255, g * 255];\n\t}\n\n\tconst pure = [0, 0, 0];\n\tconst hi = (h % 1) * 6;\n\tconst v = hi % 1;\n\tconst w = 1 - v;\n\tlet mg = 0;\n\n\t/* eslint-disable max-statements-per-line */\n\tswitch (Math.floor(hi)) {\n\t\tcase 0:\n\t\t\tpure[0] = 1; pure[1] = v; pure[2] = 0; break;\n\t\tcase 1:\n\t\t\tpure[0] = w; pure[1] = 1; pure[2] = 0; break;\n\t\tcase 2:\n\t\t\tpure[0] = 0; pure[1] = 1; pure[2] = v; break;\n\t\tcase 3:\n\t\t\tpure[0] = 0; pure[1] = w; pure[2] = 1; break;\n\t\tcase 4:\n\t\t\tpure[0] = v; pure[1] = 0; pure[2] = 1; break;\n\t\tdefault:\n\t\t\tpure[0] = 1; pure[1] = 0; pure[2] = w;\n\t}\n\t/* eslint-enable max-statements-per-line */\n\n\tmg = (1.0 - c) * g;\n\n\treturn [\n\t\t(c * pure[0] + mg) * 255,\n\t\t(c * pure[1] + mg) * 255,\n\t\t(c * pure[2] + mg) * 255\n\t];\n};\n\nconvert.hcg.hsv = function (hcg) {\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\n\tconst v = c + g * (1.0 - c);\n\tlet f = 0;\n\n\tif (v > 0.0) {\n\t\tf = c / v;\n\t}\n\n\treturn [hcg[0], f * 100, v * 100];\n};\n\nconvert.hcg.hsl = function (hcg) {\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\n\tconst l = g * (1.0 - c) + 0.5 * c;\n\tlet s = 0;\n\n\tif (l > 0.0 && l < 0.5) {\n\t\ts = c / (2 * l);\n\t} else\n\tif (l >= 0.5 && l < 1.0) {\n\t\ts = c / (2 * (1 - l));\n\t}\n\n\treturn [hcg[0], s * 100, l * 100];\n};\n\nconvert.hcg.hwb = function (hcg) {\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\tconst v = c + g * (1.0 - c);\n\treturn [hcg[0], (v - c) * 100, (1 - v) * 100];\n};\n\nconvert.hwb.hcg = function (hwb) {\n\tconst w = hwb[1] / 100;\n\tconst b = hwb[2] / 100;\n\tconst v = 1 - b;\n\tconst c = v - w;\n\tlet g = 0;\n\n\tif (c < 1) {\n\t\tg = (v - c) / (1 - c);\n\t}\n\n\treturn [hwb[0], c * 100, g * 100];\n};\n\nconvert.apple.rgb = function (apple) {\n\treturn [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];\n};\n\nconvert.rgb.apple = function (rgb) {\n\treturn [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];\n};\n\nconvert.gray.rgb = function (args) {\n\treturn [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];\n};\n\nconvert.gray.hsl = function (args) {\n\treturn [0, 0, args[0]];\n};\n\nconvert.gray.hsv = convert.gray.hsl;\n\nconvert.gray.hwb = function (gray) {\n\treturn [0, 100, gray[0]];\n};\n\nconvert.gray.cmyk = function (gray) {\n\treturn [0, 0, 0, gray[0]];\n};\n\nconvert.gray.lab = function (gray) {\n\treturn [gray[0], 0, 0];\n};\n\nconvert.gray.hex = function (gray) {\n\tconst val = Math.round(gray[0] / 100 * 255) & 0xFF;\n\tconst integer = (val << 16) + (val << 8) + val;\n\n\tconst string = integer.toString(16).toUpperCase();\n\treturn '000000'.substring(string.length) + string;\n};\n\nconvert.rgb.gray = function (rgb) {\n\tconst val = (rgb[0] + rgb[1] + rgb[2]) / 3;\n\treturn [val / 255 * 100];\n};\n","const conversions = require('./conversions');\nconst route = require('./route');\n\nconst convert = {};\n\nconst models = Object.keys(conversions);\n\nfunction wrapRaw(fn) {\n\tconst wrappedFn = function (...args) {\n\t\tconst arg0 = args[0];\n\t\tif (arg0 === undefined || arg0 === null) {\n\t\t\treturn arg0;\n\t\t}\n\n\t\tif (arg0.length > 1) {\n\t\t\targs = arg0;\n\t\t}\n\n\t\treturn fn(args);\n\t};\n\n\t// Preserve .conversion property if there is one\n\tif ('conversion' in fn) {\n\t\twrappedFn.conversion = fn.conversion;\n\t}\n\n\treturn wrappedFn;\n}\n\nfunction wrapRounded(fn) {\n\tconst wrappedFn = function (...args) {\n\t\tconst arg0 = args[0];\n\n\t\tif (arg0 === undefined || arg0 === null) {\n\t\t\treturn arg0;\n\t\t}\n\n\t\tif (arg0.length > 1) {\n\t\t\targs = arg0;\n\t\t}\n\n\t\tconst result = fn(args);\n\n\t\t// We're assuming the result is an array here.\n\t\t// see notice in conversions.js; don't use box types\n\t\t// in conversion functions.\n\t\tif (typeof result === 'object') {\n\t\t\tfor (let len = result.length, i = 0; i < len; i++) {\n\t\t\t\tresult[i] = Math.round(result[i]);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t};\n\n\t// Preserve .conversion property if there is one\n\tif ('conversion' in fn) {\n\t\twrappedFn.conversion = fn.conversion;\n\t}\n\n\treturn wrappedFn;\n}\n\nmodels.forEach(fromModel => {\n\tconvert[fromModel] = {};\n\n\tObject.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});\n\tObject.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});\n\n\tconst routes = route(fromModel);\n\tconst routeModels = Object.keys(routes);\n\n\trouteModels.forEach(toModel => {\n\t\tconst fn = routes[toModel];\n\n\t\tconvert[fromModel][toModel] = wrapRounded(fn);\n\t\tconvert[fromModel][toModel].raw = wrapRaw(fn);\n\t});\n});\n\nmodule.exports = convert;\n","const conversions = require('./conversions');\n\n/*\n\tThis function routes a model to all other models.\n\n\tall functions that are routed have a property `.conversion` attached\n\tto the returned synthetic function. This property is an array\n\tof strings, each with the steps in between the 'from' and 'to'\n\tcolor models (inclusive).\n\n\tconversions that are not possible simply are not included.\n*/\n\nfunction buildGraph() {\n\tconst graph = {};\n\t// https://jsperf.com/object-keys-vs-for-in-with-closure/3\n\tconst models = Object.keys(conversions);\n\n\tfor (let len = models.length, i = 0; i < len; i++) {\n\t\tgraph[models[i]] = {\n\t\t\t// http://jsperf.com/1-vs-infinity\n\t\t\t// micro-opt, but this is simple.\n\t\t\tdistance: -1,\n\t\t\tparent: null\n\t\t};\n\t}\n\n\treturn graph;\n}\n\n// https://en.wikipedia.org/wiki/Breadth-first_search\nfunction deriveBFS(fromModel) {\n\tconst graph = buildGraph();\n\tconst queue = [fromModel]; // Unshift -> queue -> pop\n\n\tgraph[fromModel].distance = 0;\n\n\twhile (queue.length) {\n\t\tconst current = queue.pop();\n\t\tconst adjacents = Object.keys(conversions[current]);\n\n\t\tfor (let len = adjacents.length, i = 0; i < len; i++) {\n\t\t\tconst adjacent = adjacents[i];\n\t\t\tconst node = graph[adjacent];\n\n\t\t\tif (node.distance === -1) {\n\t\t\t\tnode.distance = graph[current].distance + 1;\n\t\t\t\tnode.parent = current;\n\t\t\t\tqueue.unshift(adjacent);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn graph;\n}\n\nfunction link(from, to) {\n\treturn function (args) {\n\t\treturn to(from(args));\n\t};\n}\n\nfunction wrapConversion(toModel, graph) {\n\tconst path = [graph[toModel].parent, toModel];\n\tlet fn = conversions[graph[toModel].parent][toModel];\n\n\tlet cur = graph[toModel].parent;\n\twhile (graph[cur].parent) {\n\t\tpath.unshift(graph[cur].parent);\n\t\tfn = link(conversions[graph[cur].parent][cur], fn);\n\t\tcur = graph[cur].parent;\n\t}\n\n\tfn.conversion = path;\n\treturn fn;\n}\n\nmodule.exports = function (fromModel) {\n\tconst graph = deriveBFS(fromModel);\n\tconst conversion = {};\n\n\tconst models = Object.keys(graph);\n\tfor (let len = models.length, i = 0; i < len; i++) {\n\t\tconst toModel = models[i];\n\t\tconst node = graph[toModel];\n\n\t\tif (node.parent === null) {\n\t\t\t// No possible conversion, or this node is the source model.\n\t\t\tcontinue;\n\t\t}\n\n\t\tconversion[toModel] = wrapConversion(toModel, graph);\n\t}\n\n\treturn conversion;\n};\n\n","'use strict'\r\n\r\nmodule.exports = {\r\n\t\"aliceblue\": [240, 248, 255],\r\n\t\"antiquewhite\": [250, 235, 215],\r\n\t\"aqua\": [0, 255, 255],\r\n\t\"aquamarine\": [127, 255, 212],\r\n\t\"azure\": [240, 255, 255],\r\n\t\"beige\": [245, 245, 220],\r\n\t\"bisque\": [255, 228, 196],\r\n\t\"black\": [0, 0, 0],\r\n\t\"blanchedalmond\": [255, 235, 205],\r\n\t\"blue\": [0, 0, 255],\r\n\t\"blueviolet\": [138, 43, 226],\r\n\t\"brown\": [165, 42, 42],\r\n\t\"burlywood\": [222, 184, 135],\r\n\t\"cadetblue\": [95, 158, 160],\r\n\t\"chartreuse\": [127, 255, 0],\r\n\t\"chocolate\": [210, 105, 30],\r\n\t\"coral\": [255, 127, 80],\r\n\t\"cornflowerblue\": [100, 149, 237],\r\n\t\"cornsilk\": [255, 248, 220],\r\n\t\"crimson\": [220, 20, 60],\r\n\t\"cyan\": [0, 255, 255],\r\n\t\"darkblue\": [0, 0, 139],\r\n\t\"darkcyan\": [0, 139, 139],\r\n\t\"darkgoldenrod\": [184, 134, 11],\r\n\t\"darkgray\": [169, 169, 169],\r\n\t\"darkgreen\": [0, 100, 0],\r\n\t\"darkgrey\": [169, 169, 169],\r\n\t\"darkkhaki\": [189, 183, 107],\r\n\t\"darkmagenta\": [139, 0, 139],\r\n\t\"darkolivegreen\": [85, 107, 47],\r\n\t\"darkorange\": [255, 140, 0],\r\n\t\"darkorchid\": [153, 50, 204],\r\n\t\"darkred\": [139, 0, 0],\r\n\t\"darksalmon\": [233, 150, 122],\r\n\t\"darkseagreen\": [143, 188, 143],\r\n\t\"darkslateblue\": [72, 61, 139],\r\n\t\"darkslategray\": [47, 79, 79],\r\n\t\"darkslategrey\": [47, 79, 79],\r\n\t\"darkturquoise\": [0, 206, 209],\r\n\t\"darkviolet\": [148, 0, 211],\r\n\t\"deeppink\": [255, 20, 147],\r\n\t\"deepskyblue\": [0, 191, 255],\r\n\t\"dimgray\": [105, 105, 105],\r\n\t\"dimgrey\": [105, 105, 105],\r\n\t\"dodgerblue\": [30, 144, 255],\r\n\t\"firebrick\": [178, 34, 34],\r\n\t\"floralwhite\": [255, 250, 240],\r\n\t\"forestgreen\": [34, 139, 34],\r\n\t\"fuchsia\": [255, 0, 255],\r\n\t\"gainsboro\": [220, 220, 220],\r\n\t\"ghostwhite\": [248, 248, 255],\r\n\t\"gold\": [255, 215, 0],\r\n\t\"goldenrod\": [218, 165, 32],\r\n\t\"gray\": [128, 128, 128],\r\n\t\"green\": [0, 128, 0],\r\n\t\"greenyellow\": [173, 255, 47],\r\n\t\"grey\": [128, 128, 128],\r\n\t\"honeydew\": [240, 255, 240],\r\n\t\"hotpink\": [255, 105, 180],\r\n\t\"indianred\": [205, 92, 92],\r\n\t\"indigo\": [75, 0, 130],\r\n\t\"ivory\": [255, 255, 240],\r\n\t\"khaki\": [240, 230, 140],\r\n\t\"lavender\": [230, 230, 250],\r\n\t\"lavenderblush\": [255, 240, 245],\r\n\t\"lawngreen\": [124, 252, 0],\r\n\t\"lemonchiffon\": [255, 250, 205],\r\n\t\"lightblue\": [173, 216, 230],\r\n\t\"lightcoral\": [240, 128, 128],\r\n\t\"lightcyan\": [224, 255, 255],\r\n\t\"lightgoldenrodyellow\": [250, 250, 210],\r\n\t\"lightgray\": [211, 211, 211],\r\n\t\"lightgreen\": [144, 238, 144],\r\n\t\"lightgrey\": [211, 211, 211],\r\n\t\"lightpink\": [255, 182, 193],\r\n\t\"lightsalmon\": [255, 160, 122],\r\n\t\"lightseagreen\": [32, 178, 170],\r\n\t\"lightskyblue\": [135, 206, 250],\r\n\t\"lightslategray\": [119, 136, 153],\r\n\t\"lightslategrey\": [119, 136, 153],\r\n\t\"lightsteelblue\": [176, 196, 222],\r\n\t\"lightyellow\": [255, 255, 224],\r\n\t\"lime\": [0, 255, 0],\r\n\t\"limegreen\": [50, 205, 50],\r\n\t\"linen\": [250, 240, 230],\r\n\t\"magenta\": [255, 0, 255],\r\n\t\"maroon\": [128, 0, 0],\r\n\t\"mediumaquamarine\": [102, 205, 170],\r\n\t\"mediumblue\": [0, 0, 205],\r\n\t\"mediumorchid\": [186, 85, 211],\r\n\t\"mediumpurple\": [147, 112, 219],\r\n\t\"mediumseagreen\": [60, 179, 113],\r\n\t\"mediumslateblue\": [123, 104, 238],\r\n\t\"mediumspringgreen\": [0, 250, 154],\r\n\t\"mediumturquoise\": [72, 209, 204],\r\n\t\"mediumvioletred\": [199, 21, 133],\r\n\t\"midnightblue\": [25, 25, 112],\r\n\t\"mintcream\": [245, 255, 250],\r\n\t\"mistyrose\": [255, 228, 225],\r\n\t\"moccasin\": [255, 228, 181],\r\n\t\"navajowhite\": [255, 222, 173],\r\n\t\"navy\": [0, 0, 128],\r\n\t\"oldlace\": [253, 245, 230],\r\n\t\"olive\": [128, 128, 0],\r\n\t\"olivedrab\": [107, 142, 35],\r\n\t\"orange\": [255, 165, 0],\r\n\t\"orangered\": [255, 69, 0],\r\n\t\"orchid\": [218, 112, 214],\r\n\t\"palegoldenrod\": [238, 232, 170],\r\n\t\"palegreen\": [152, 251, 152],\r\n\t\"paleturquoise\": [175, 238, 238],\r\n\t\"palevioletred\": [219, 112, 147],\r\n\t\"papayawhip\": [255, 239, 213],\r\n\t\"peachpuff\": [255, 218, 185],\r\n\t\"peru\": [205, 133, 63],\r\n\t\"pink\": [255, 192, 203],\r\n\t\"plum\": [221, 160, 221],\r\n\t\"powderblue\": [176, 224, 230],\r\n\t\"purple\": [128, 0, 128],\r\n\t\"rebeccapurple\": [102, 51, 153],\r\n\t\"red\": [255, 0, 0],\r\n\t\"rosybrown\": [188, 143, 143],\r\n\t\"royalblue\": [65, 105, 225],\r\n\t\"saddlebrown\": [139, 69, 19],\r\n\t\"salmon\": [250, 128, 114],\r\n\t\"sandybrown\": [244, 164, 96],\r\n\t\"seagreen\": [46, 139, 87],\r\n\t\"seashell\": [255, 245, 238],\r\n\t\"sienna\": [160, 82, 45],\r\n\t\"silver\": [192, 192, 192],\r\n\t\"skyblue\": [135, 206, 235],\r\n\t\"slateblue\": [106, 90, 205],\r\n\t\"slategray\": [112, 128, 144],\r\n\t\"slategrey\": [112, 128, 144],\r\n\t\"snow\": [255, 250, 250],\r\n\t\"springgreen\": [0, 255, 127],\r\n\t\"steelblue\": [70, 130, 180],\r\n\t\"tan\": [210, 180, 140],\r\n\t\"teal\": [0, 128, 128],\r\n\t\"thistle\": [216, 191, 216],\r\n\t\"tomato\": [255, 99, 71],\r\n\t\"turquoise\": [64, 224, 208],\r\n\t\"violet\": [238, 130, 238],\r\n\t\"wheat\": [245, 222, 179],\r\n\t\"white\": [255, 255, 255],\r\n\t\"whitesmoke\": [245, 245, 245],\r\n\t\"yellow\": [255, 255, 0],\r\n\t\"yellowgreen\": [154, 205, 50]\r\n};\r\n","'use strict';\n\nmodule.exports = (flag, argv = process.argv) => {\n\tconst prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');\n\tconst position = argv.indexOf(prefix + flag);\n\tconst terminatorPosition = argv.indexOf('--');\n\treturn position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);\n};\n","'use strict';\nconst os = require('os');\nconst tty = require('tty');\nconst hasFlag = require('has-flag');\n\nconst {env} = process;\n\nlet forceColor;\nif (hasFlag('no-color') ||\n\thasFlag('no-colors') ||\n\thasFlag('color=false') ||\n\thasFlag('color=never')) {\n\tforceColor = 0;\n} else if (hasFlag('color') ||\n\thasFlag('colors') ||\n\thasFlag('color=true') ||\n\thasFlag('color=always')) {\n\tforceColor = 1;\n}\n\nif ('FORCE_COLOR' in env) {\n\tif (env.FORCE_COLOR === 'true') {\n\t\tforceColor = 1;\n\t} else if (env.FORCE_COLOR === 'false') {\n\t\tforceColor = 0;\n\t} else {\n\t\tforceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);\n\t}\n}\n\nfunction translateLevel(level) {\n\tif (level === 0) {\n\t\treturn false;\n\t}\n\n\treturn {\n\t\tlevel,\n\t\thasBasic: true,\n\t\thas256: level >= 2,\n\t\thas16m: level >= 3\n\t};\n}\n\nfunction supportsColor(haveStream, streamIsTTY) {\n\tif (forceColor === 0) {\n\t\treturn 0;\n\t}\n\n\tif (hasFlag('color=16m') ||\n\t\thasFlag('color=full') ||\n\t\thasFlag('color=truecolor')) {\n\t\treturn 3;\n\t}\n\n\tif (hasFlag('color=256')) {\n\t\treturn 2;\n\t}\n\n\tif (haveStream && !streamIsTTY && forceColor === undefined) {\n\t\treturn 0;\n\t}\n\n\tconst min = forceColor || 0;\n\n\tif (env.TERM === 'dumb') {\n\t\treturn min;\n\t}\n\n\tif (process.platform === 'win32') {\n\t\t// Windows 10 build 10586 is the first Windows release that supports 256 colors.\n\t\t// Windows 10 build 14931 is the first release that supports 16m/TrueColor.\n\t\tconst osRelease = os.release().split('.');\n\t\tif (\n\t\t\tNumber(osRelease[0]) >= 10 &&\n\t\t\tNumber(osRelease[2]) >= 10586\n\t\t) {\n\t\t\treturn Number(osRelease[2]) >= 14931 ? 3 : 2;\n\t\t}\n\n\t\treturn 1;\n\t}\n\n\tif ('CI' in env) {\n\t\tif (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {\n\t\t\treturn 1;\n\t\t}\n\n\t\treturn min;\n\t}\n\n\tif ('TEAMCITY_VERSION' in env) {\n\t\treturn /^(9\\.(0*[1-9]\\d*)\\.|\\d{2,}\\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;\n\t}\n\n\tif (env.COLORTERM === 'truecolor') {\n\t\treturn 3;\n\t}\n\n\tif ('TERM_PROGRAM' in env) {\n\t\tconst version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);\n\n\t\tswitch (env.TERM_PROGRAM) {\n\t\t\tcase 'iTerm.app':\n\t\t\t\treturn version >= 3 ? 3 : 2;\n\t\t\tcase 'Apple_Terminal':\n\t\t\t\treturn 2;\n\t\t\t// No default\n\t\t}\n\t}\n\n\tif (/-256(color)?$/i.test(env.TERM)) {\n\t\treturn 2;\n\t}\n\n\tif (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {\n\t\treturn 1;\n\t}\n\n\tif ('COLORTERM' in env) {\n\t\treturn 1;\n\t}\n\n\treturn min;\n}\n\nfunction getSupportLevel(stream) {\n\tconst level = supportsColor(stream, stream && stream.isTTY);\n\treturn translateLevel(level);\n}\n\nmodule.exports = {\n\tsupportsColor: getSupportLevel,\n\tstdout: translateLevel(supportsColor(true, tty.isatty(1))),\n\tstderr: translateLevel(supportsColor(true, tty.isatty(2)))\n};\n","// getDefaultExport function for compatibility with non-ESM modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};\n","__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","__webpack_require__.nmd = (module) => {\n module.paths = [];\n if (!module.children) module.children = [];\n return module;\n};","import { createHash } from 'node:crypto';\nimport { existsSync, mkdirSync, writeFileSync } from 'node:fs';\nimport { basename, dirname, extname, relative, resolve } from 'node:path';\nimport type {\n MidsceneYamlConfigAttempt,\n MidsceneYamlConfigResult,\n MidsceneYamlScriptEnv,\n TestStatus,\n} from '@midscene/core';\nimport { ReportMergingTool } from '@midscene/core';\nimport type { ScriptPlayer } from '@midscene/core/yaml';\nimport { getMidsceneRunSubDir } from '@midscene/shared/common';\nimport { getDebug } from '@midscene/shared/logger';\n\nconst warnRetryReport = getDebug('execution-summary', { console: true });\n\nexport interface ExecutionPlanConfig {\n files: string[];\n concurrent: number;\n continueOnError: boolean;\n retry?: number;\n summary: string;\n shareBrowserContext?: boolean;\n headed: boolean;\n keepWindow: boolean;\n}\n\nexport interface ExecutionSummary {\n total: number;\n successful: number;\n failed: number;\n partialFailed: number;\n notExecuted: number;\n totalDuration: number;\n}\n\ntype ResultType = MidsceneYamlConfigResult['resultType'];\n\nexport const notExecutedError = 'Not executed (previous task failed)';\n\nexport function createNotExecutedYamlResult(\n file: string,\n): MidsceneYamlConfigResult {\n return {\n file,\n success: false,\n executed: false,\n output: undefined,\n report: undefined,\n duration: 0,\n resultType: 'notExecuted',\n error: notExecutedError,\n };\n}\n\nexport function createExecutedYamlResult(options: {\n file: string;\n player: ScriptPlayer<MidsceneYamlScriptEnv>;\n duration: number;\n}): MidsceneYamlConfigResult {\n const { file, player, duration } = options;\n const hasFailedTasks =\n player.taskStatusList?.some((task) => task.status === 'error') ?? false;\n const hasPlayerError = player.status === 'error';\n\n let success: boolean;\n let resultType: 'success' | 'failed' | 'partialFailed';\n\n if (hasPlayerError) {\n success = false;\n resultType = 'failed';\n } else if (hasFailedTasks) {\n success = false;\n resultType = 'partialFailed';\n } else {\n success = true;\n resultType = 'success';\n }\n\n let outputPath: string | undefined = player.output || undefined;\n if (outputPath && !existsSync(outputPath)) {\n outputPath = undefined;\n }\n\n let errorMessage: string | undefined;\n if (player.errorInSetup?.message) {\n errorMessage = player.errorInSetup.message;\n } else if (hasPlayerError || hasFailedTasks) {\n const taskErrors = player.taskStatusList\n ?.filter((task) => task.status === 'error' && task.error?.message)\n .map((task) => task.error!.message);\n if (taskErrors && taskErrors.length > 0) {\n errorMessage = taskErrors.join('; ');\n } else if (hasPlayerError) {\n errorMessage = 'Execution failed';\n } else {\n errorMessage = 'Some tasks failed';\n }\n }\n\n return {\n file,\n success,\n executed: true,\n output: outputPath,\n report: player.reportFile || undefined,\n duration,\n resultType,\n error: errorMessage,\n };\n}\n\nexport function getExecutionSummary(\n results: MidsceneYamlConfigResult[],\n): ExecutionSummary {\n return {\n total: results.length,\n successful: getResultsByType(results, 'success').length,\n failed: getResultsByType(results, 'failed').length,\n partialFailed: getResultsByType(results, 'partialFailed').length,\n notExecuted: getResultsByType(results, 'notExecuted').length,\n totalDuration: results.reduce((sum, r) => sum + (r.duration || 0), 0),\n };\n}\n\nexport function getResultsByType(\n results: MidsceneYamlConfigResult[],\n resultType: ResultType,\n): MidsceneYamlConfigResult[] {\n return results.filter((result) => result.resultType === resultType);\n}\n\nexport function getResultFilesByType(\n results: MidsceneYamlConfigResult[],\n resultType: ResultType,\n): string[] {\n return getResultsByType(results, resultType).map((result) => result.file);\n}\n\nexport function getSummaryAbsolutePath(summary: string): string {\n return resolve(getMidsceneRunSubDir('output'), summary);\n}\n\nconst toOutputRelativePath = (outputDir: string, filePath: string): string => {\n const relativePath = relative(outputDir, filePath);\n return relativePath.startsWith('.') ? relativePath : `./${relativePath}`;\n};\n\nconst toTestStatus = (\n attempt: Pick<MidsceneYamlConfigAttempt, 'success' | 'resultType'>,\n): TestStatus => {\n if (attempt.success) return 'passed';\n if (attempt.resultType === 'notExecuted') return 'skipped';\n return 'failed';\n};\n\nconst safeReportNamePart = (value: string): string =>\n value.replace(/[:*?\"<>|# ]/g, '-');\n\nconst createRetryReportName = (file: string): string => {\n const fileName = basename(file, extname(file)) || 'yaml';\n const fileHash = createHash('sha1')\n .update(resolve(file))\n .digest('hex')\n .slice(0, 8);\n return `${safeReportNamePart(fileName)}-${fileHash}-retry-attempts`;\n};\n\nconst createRetryAttemptReport = (\n result: MidsceneYamlConfigResult,\n): string | undefined => {\n const attemptsWithReports = result.attempts?.filter(\n (attempt) => attempt.report && existsSync(attempt.report),\n );\n if (!attemptsWithReports || attemptsWithReports.length <= 1) {\n return undefined;\n }\n\n const tool = new ReportMergingTool();\n for (const attempt of attemptsWithReports) {\n const status = toTestStatus(attempt);\n tool.append({\n reportFilePath: attempt.report!,\n reportAttributes: {\n testDuration: attempt.duration ?? 0,\n testStatus: status,\n testTitle: `Attempt ${attempt.attempt}: ${status} - ${basename(result.file)}`,\n testId: `${safeReportNamePart(basename(result.file))}-attempt-${attempt.attempt}`,\n testDescription:\n attempt.error ??\n (attempt.success ? 'YAML attempt passed' : 'YAML attempt failed'),\n },\n });\n }\n\n return (\n tool.mergeReports(createRetryReportName(result.file), {\n outputDir: getMidsceneRunSubDir('report'),\n overwrite: true,\n }) || undefined\n );\n};\n\nconst errorMessageOf = (error: unknown): string =>\n error instanceof Error ? error.message : String(error);\n\nconst warnRetryReportFailure = (message: string): void => {\n try {\n mkdirSync(getMidsceneRunSubDir('log'), { recursive: true });\n warnRetryReport(message);\n } catch {\n // Summary output is more important than warning output.\n }\n};\n\nconst createRetryAttemptReportSafely = (\n result: MidsceneYamlConfigResult,\n): { report?: string; failed: boolean } => {\n try {\n return {\n report: createRetryAttemptReport(result),\n failed: false,\n };\n } catch (error) {\n warnRetryReportFailure(\n `Failed to merge retry attempt report for ${result.file}: ${errorMessageOf(\n error,\n )}`,\n );\n return { failed: true };\n }\n};\n\nexport function writeExecutionSummaryFile(\n summary: string,\n results: MidsceneYamlConfigResult[],\n): string {\n const indexPath = getSummaryAbsolutePath(summary);\n const outputDir = dirname(indexPath);\n mkdirSync(outputDir, { recursive: true });\n\n const executionSummary = getExecutionSummary(results);\n const indexData = {\n summary: {\n ...executionSummary,\n generatedAt: new Date().toLocaleString(),\n },\n results: results.map((result) => {\n const retryReport = createRetryAttemptReportSafely(result);\n\n return {\n script: relative(outputDir, result.file),\n success: result.success,\n resultType: result.resultType,\n output: result.output\n ? toOutputRelativePath(outputDir, result.output)\n : undefined,\n report: result.report ? relative(outputDir, result.report) : undefined,\n retryReport: retryReport.report\n ? relative(outputDir, retryReport.report)\n : !retryReport.failed && result.retryReport\n ? relative(outputDir, result.retryReport)\n : undefined,\n attempts: result.attempts?.map((attempt) => ({\n attempt: attempt.attempt,\n success: attempt.success,\n resultType: attempt.resultType,\n output: attempt.output\n ? toOutputRelativePath(outputDir, attempt.output)\n : undefined,\n report: attempt.report\n ? relative(outputDir, attempt.report)\n : undefined,\n error: attempt.error,\n duration: attempt.duration,\n })),\n error: result.error,\n duration: result.duration,\n };\n }),\n };\n\n writeFileSync(indexPath, JSON.stringify(indexData, null, 2));\n return indexPath;\n}\n\nexport function printExecutionPlan(config: ExecutionPlanConfig): void {\n console.log(' Scripts:');\n for (const file of config.files) {\n console.log(` - ${file}`);\n }\n console.log('📋 Execution plan');\n console.log(` Concurrency: ${config.concurrent}`);\n console.log(` Keep window: ${config.keepWindow}`);\n console.log(` Headed: ${config.headed}`);\n console.log(` Continue on error: ${config.continueOnError}`);\n console.log(` Retry: ${config.retry ?? 0}`);\n console.log(\n ` Share browser context: ${config.shareBrowserContext ?? false}`,\n );\n console.log(` Summary output: ${config.summary}`);\n}\n\nexport function printExecutionFinished(): void {\n console.log('Execution finished:');\n}\n\nconst printResultArtifacts = (result: MidsceneYamlConfigResult): void => {\n if (result.report) {\n console.log(` Report: ${result.report}`);\n }\n if (result.output) {\n console.log(` Output: ${result.output}`);\n }\n};\n\nexport function printExecutionSummary(\n results: MidsceneYamlConfigResult[],\n summaryPath: string,\n): boolean {\n const summary = getExecutionSummary(results);\n const successfulFiles = getResultsByType(results, 'success');\n const failedFiles = getResultsByType(results, 'failed');\n const partialFailedFiles = getResultsByType(results, 'partialFailed');\n const notExecutedFiles = getResultsByType(results, 'notExecuted');\n const success =\n summary.failed === 0 &&\n summary.partialFailed === 0 &&\n summary.notExecuted === 0;\n\n console.log('\\n📊 Execution Summary:');\n console.log(` Total files: ${summary.total}`);\n console.log(` Successful: ${summary.successful}`);\n console.log(` Failed: ${summary.failed}`);\n console.log(` Partial failed: ${summary.partialFailed}`);\n console.log(` Not executed: ${summary.notExecuted}`);\n console.log(` Duration: ${(summary.totalDuration / 1000).toFixed(2)}s`);\n console.log(` Summary: ${summaryPath}`);\n\n if (successfulFiles.length > 0) {\n console.log('\\n✅ Successful files:');\n successfulFiles.forEach((result) => {\n console.log(` ${result.file}`);\n printResultArtifacts(result);\n });\n }\n\n if (failedFiles.length > 0) {\n console.log('\\n❌ Failed files');\n failedFiles.forEach((result) => {\n console.log(` ${result.file}`);\n if (result.error) {\n console.log(` Error: ${result.error}`);\n }\n });\n }\n\n if (partialFailedFiles.length > 0) {\n console.log(\n '\\n⚠️ Partial failed files (some tasks failed with continueOnError)',\n );\n partialFailedFiles.forEach((result) => {\n console.log(` ${result.file}`);\n if (result.error) {\n console.log(` Error: ${result.error}`);\n }\n });\n }\n\n if (notExecutedFiles.length > 0) {\n console.log('\\n⏸️ Not executed files');\n notExecutedFiles.forEach((result) => {\n console.log(` ${result.file}`);\n });\n }\n\n if (success) {\n console.log('\\n🎉 All files executed successfully!');\n } else {\n console.log('\\n⚠️ Some files failed or were not executed.');\n }\n\n return success;\n}\n","import { createRequire } from 'node:module';\nimport { join, resolve } from 'node:path';\n\n// `@rstest/core` and `@rsbuild/core` are direct dependencies of `@midscene/cli`,\n// so they always sit on the resolution path of the CLI's own files. Anchor the\n// lookup to this module's location (`__dirname` of the bundled output) rather\n// than `process.argv[1]`: the command-line entry can be a wrapper script, a\n// symlinked bin, an `npx` cache path, or some other launcher whose `node_modules`\n// chain does not include `@rstest/core`. Anchoring on `process.argv[1]` is what\n// caused YAML runs to fail with \"Cannot find module '@rstest/core/package.json'\"\n// in environments where the launcher differs from the install location.\nconst requireFromCliPackage = () => {\n if (typeof __dirname !== 'undefined') {\n return createRequire(join(__dirname, 'index.js'));\n }\n // ESM consumers of the bundled output have no `__dirname`; fall back to the\n // command-line entry so programmatic usage keeps working.\n const entry = process.argv[1]\n ? resolve(process.argv[1])\n : join(process.cwd(), 'midscene-cli.js');\n return createRequire(entry);\n};\n\nexport const resolvePackageFromRstestCore = (packageName: string): string => {\n const require = requireFromCliPackage();\n const rstestPackageJsonPath = require.resolve('@rstest/core/package.json');\n return createRequire(rstestPackageJsonPath).resolve(packageName);\n};\n\nexport function resolveRstestCoreImportPath(): string {\n const require = requireFromCliPackage();\n return require.resolve('@rstest/core');\n}\n","import { existsSync, mkdirSync, rmSync } from 'node:fs';\nimport {\n basename,\n dirname,\n extname,\n join,\n relative,\n resolve,\n sep,\n} from 'node:path';\nimport { getMidsceneRunSubDir } from '@midscene/shared/common';\nimport type { BatchRunnerConfig } from '../batch-runner';\nimport { resolveRstestCoreImportPath } from './rstest-dependencies';\nimport type { RunYamlCaseOptions } from './yaml-case';\n\nexport type RstestYamlCaseOptions = Omit<\n RunYamlCaseOptions,\n 'file' | 'headed' | 'keepWindow'\n>;\n\nexport type WebYamlRuntimeOptions = Pick<\n RunYamlCaseOptions,\n 'headed' | 'keepWindow'\n>;\n\nexport const DEFAULT_YAML_TEST_TIMEOUT = 0;\nexport const RSTEST_YAML_BATCH_TEST_MODULE =\n 'virtual:midscene-yaml/batch.test.ts';\nexport const RSTEST_YAML_BATCH_TEST_NAME = 'midscene yaml batch';\n\nexport interface CreateRstestYamlProjectOptions {\n files: string[];\n projectDir?: string;\n outputDir?: string;\n resultDir?: string;\n frameworkImport?: string;\n caseOptions?: Record<string, RstestYamlCaseOptions>;\n webRuntimeOptions?: Record<string, WebYamlRuntimeOptions>;\n maxConcurrency?: number;\n testTimeout?: number;\n bail?: number;\n retry?: number;\n batchConfig?: BatchRunnerConfig;\n rstestCoreImport?: string;\n}\n\nexport interface GeneratedYamlTestCase {\n yamlFile: string;\n testModule: string;\n resultFile: string;\n testName: string;\n}\n\nexport interface GeneratedYamlBatchTest {\n testModule: string;\n testName: string;\n}\n\nexport interface GeneratedRstestYamlProject {\n projectDir: string;\n outputDir: string;\n resultDir: string;\n include: string[];\n virtualModules: Record<string, string>;\n cases: GeneratedYamlTestCase[];\n batchTest?: GeneratedYamlBatchTest;\n maxConcurrency?: number;\n testTimeout: number;\n bail?: number;\n retry?: number;\n}\n\nconst toPosixPath = (value: string): string => value.split(sep).join('/');\n\nconst toImportLiteral = (value: string): string =>\n JSON.stringify(toPosixPath(value));\n\nconst toVirtualModuleId = (fileStem: string): string =>\n `virtual:midscene-yaml/${fileStem}.test.ts`;\n\nconst safeFileStem = (file: string, index: number): string => {\n const base = basename(file, extname(file))\n .replace(/[^a-zA-Z0-9._-]+/g, '-')\n .replace(/^-+|-+$/g, '');\n return `${String(index + 1).padStart(3, '0')}-${base || 'case'}`;\n};\n\nexport const resolveTestName = (\n projectDir: string,\n yamlFile: string,\n): string => {\n const relativePath = relative(projectDir, yamlFile);\n return toPosixPath(relativePath.startsWith('..') ? yamlFile : relativePath);\n};\n\nconst createGeneratedTestContent = (options: {\n rstestCoreImport: string;\n frameworkImport: string;\n yamlFile: string;\n resultFile: string;\n testName: string;\n caseOptions?: RstestYamlCaseOptions;\n webRuntimeOptions?: WebYamlRuntimeOptions;\n}): string => {\n const testOptions = {\n testName: options.testName,\n yamlFile: options.yamlFile,\n resultFile: options.resultFile,\n ...(options.caseOptions ? { caseOptions: options.caseOptions } : {}),\n ...(options.webRuntimeOptions\n ? { webRuntimeOptions: options.webRuntimeOptions }\n : {}),\n };\n\n return `import { test } from ${toImportLiteral(options.rstestCoreImport)};\nimport { defineYamlCaseTest } from ${toImportLiteral(options.frameworkImport)};\n\nconst testOptions = ${JSON.stringify(testOptions, null, 2)};\n\ndefineYamlCaseTest(test, testOptions);\n`;\n};\n\nconst createGeneratedBatchTestContent = (options: {\n rstestCoreImport: string;\n frameworkImport: string;\n testName: string;\n config: BatchRunnerConfig;\n resultFiles: Record<string, string>;\n}): string => {\n const testOptions = {\n testName: options.testName,\n config: options.config,\n resultFiles: options.resultFiles,\n };\n\n return `import { test } from ${toImportLiteral(options.rstestCoreImport)};\nimport { defineYamlBatchTest } from ${toImportLiteral(options.frameworkImport)};\n\nconst testOptions = ${JSON.stringify(testOptions, null, 2)};\n\ndefineYamlBatchTest(test, testOptions);\n`;\n};\n\n// Anchor the framework entry on this bundle's own directory rather than\n// `process.argv[1]`. The command-line entry can be a `.bin` symlink, an\n// `npx` cache path, or a wrapper script whose directory does not lead to the\n// compiled `framework/index.js`. In those cases the argv-based lookup below\n// falls through to the bare specifier `@midscene/cli/dist/lib/framework/\n// index.js`, which the generated virtual test module then fails to resolve\n// from the user's CWD (\"Cannot find module ...\"), silently turning every run\n// into \"not executed\". `__dirname` always points at the installed CLI output\n// (this mirrors `requireFromCliPackage` in rstest-runner.ts). Resolve to an\n// absolute path so the virtual module imports it regardless of CWD.\n// `moduleDir` is injectable so tests can exercise the resolution order without\n// depending on the dist layout.\nexport const resolveDefaultFrameworkImport = (moduleDir?: string): string => {\n const anchorDir =\n moduleDir ?? (typeof __dirname !== 'undefined' ? __dirname : undefined);\n const candidates = [\n anchorDir ? join(anchorDir, 'framework', 'index.js') : '',\n ];\n\n const entry = process.argv[1] ? resolve(process.argv[1]) : '';\n if (entry) {\n candidates.push(join(dirname(entry), 'framework', 'index.js'));\n candidates.push(\n join(dirname(entry), '..', 'dist', 'lib', 'framework', 'index.js'),\n );\n }\n\n const matched = candidates\n .filter(Boolean)\n .find((candidate) => existsSync(candidate));\n return matched || '@midscene/cli/dist/lib/framework/index.js';\n};\n\nexport function createRstestYamlProject(\n options: CreateRstestYamlProjectOptions,\n): GeneratedRstestYamlProject {\n const projectDir = resolve(options.projectDir || process.cwd());\n const outputDir =\n options.outputDir ||\n join(getMidsceneRunSubDir('tmp'), `rstest-yaml-${Date.now()}`);\n const resultDir = options.resultDir || join(outputDir, 'results');\n const frameworkImport =\n options.frameworkImport || resolveDefaultFrameworkImport();\n const rstestCoreImport =\n options.rstestCoreImport || resolveRstestCoreImportPath();\n const testTimeout = options.testTimeout ?? DEFAULT_YAML_TEST_TIMEOUT;\n\n rmSync(outputDir, { recursive: true, force: true });\n mkdirSync(resultDir, { recursive: true });\n\n const virtualModules: Record<string, string> = {};\n const cases = options.files.map((file, index) => {\n const yamlFile = resolve(file);\n const testName = resolveTestName(projectDir, yamlFile);\n const fileStem = safeFileStem(yamlFile, index);\n const resultFile = join(resultDir, `${fileStem}.json`);\n const testModule = toVirtualModuleId(fileStem);\n virtualModules[testModule] = createGeneratedTestContent({\n rstestCoreImport,\n frameworkImport,\n yamlFile,\n resultFile,\n testName,\n caseOptions: options.caseOptions?.[yamlFile],\n webRuntimeOptions: options.webRuntimeOptions?.[yamlFile],\n });\n return { yamlFile, testModule, resultFile, testName };\n });\n\n if (options.batchConfig) {\n const resultFiles = Object.fromEntries(\n cases.map((item) => [item.yamlFile, item.resultFile]),\n );\n const batchTest = {\n testModule: RSTEST_YAML_BATCH_TEST_MODULE,\n testName: RSTEST_YAML_BATCH_TEST_NAME,\n };\n return {\n projectDir,\n outputDir,\n resultDir,\n include: [batchTest.testModule],\n virtualModules: {\n [batchTest.testModule]: createGeneratedBatchTestContent({\n rstestCoreImport,\n frameworkImport,\n testName: batchTest.testName,\n config: options.batchConfig,\n resultFiles,\n }),\n },\n cases,\n batchTest,\n maxConcurrency: 1,\n testTimeout,\n bail: options.bail,\n };\n }\n\n return {\n projectDir,\n outputDir,\n resultDir,\n include: cases.map((item) => item.testModule),\n virtualModules,\n cases,\n maxConcurrency: options.maxConcurrency,\n testTimeout,\n bail: options.bail,\n retry: options.retry,\n };\n}\n","import { existsSync, mkdirSync, writeFileSync } from 'node:fs';\nimport { dirname, resolve } from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport type { MidsceneYamlConfigResult } from '@midscene/core';\nimport type { RstestUserConfig, TestRunResult } from '@rstest/core/api';\nimport { resolvePackageFromRstestCore } from './rstest-dependencies';\nimport type {\n GeneratedRstestYamlProject,\n GeneratedYamlTestCase,\n} from './rstest-project';\n\nexport { resolveRstestCoreImportPath } from './rstest-dependencies';\n\nexport interface RunRstestYamlProjectOptions {\n project: GeneratedRstestYamlProject;\n cwd?: string;\n stdio?: 'inherit' | 'pipe';\n}\n\nconst formatRunError = (\n error: TestRunResult['unhandledErrors'][number],\n): string => error.stack || `${error.name}: ${error.message}`;\n\n// Collect every failure rstest surfaced, not just `unhandledErrors`. A failing\n// YAML case shows up as a file-level error (e.g. a module that cannot be\n// loaded) or a test-level error under `files[].results[]`; `unhandledErrors`\n// only covers worker crashes and config-load failures. Reporting just the\n// latter is why a failed run printed nothing and looked like \"not executed\".\nconst collectRunErrors = (result: TestRunResult): string[] => {\n const messages: string[] = [];\n const push = (\n error: TestRunResult['unhandledErrors'][number],\n label?: string,\n ) => {\n const formatted = formatRunError(error);\n messages.push(label ? `${label}: ${formatted}` : formatted);\n };\n\n for (const file of result.files ?? []) {\n for (const error of file.errors ?? []) {\n push(error, file.name || file.testPath);\n }\n for (const testResult of file.results ?? []) {\n for (const error of testResult.errors ?? []) {\n push(error, testResult.name);\n }\n }\n }\n for (const error of result.unhandledErrors ?? []) {\n push(error);\n }\n\n return Array.from(new Set(messages));\n};\n\nconst errorMessage = (\n error: TestRunResult['unhandledErrors'][number],\n): string => error.message || error.name || 'YAML case failed';\n\n// Attribute each rstest failure back to the YAML case it came from, keyed by the\n// resolved YAML file path. A test-level failure matches on the test name (which\n// equals the case's `testName`); a file-level failure (e.g. the test module\n// could not be loaded) matches on the generated virtual module id.\nconst mapRunErrorsToCases = (\n project: GeneratedRstestYamlProject,\n result: TestRunResult,\n): Map<string, string> => {\n const byTestName = new Map(\n project.cases.map((item) => [item.testName, item]),\n );\n const errors = new Map<string, string>();\n const add = (item: GeneratedYamlTestCase | undefined, message: string) => {\n if (item && message && !errors.has(item.yamlFile)) {\n errors.set(item.yamlFile, message);\n }\n };\n const addAll = (message: string) => {\n for (const item of project.cases) {\n add(item, message);\n }\n };\n const matchFileCase = (\n file: TestRunResult['files'][number],\n ): GeneratedYamlTestCase | undefined => {\n for (const key of [file.name, file.testPath]) {\n if (!key) continue;\n const matched = project.cases.find(\n (item) => key === item.testModule || key.includes(item.testModule),\n );\n if (matched) return matched;\n }\n return undefined;\n };\n const isBatchFile = (file: TestRunResult['files'][number]): boolean => {\n if (!project.batchTest) return false;\n for (const key of [file.name, file.testPath]) {\n if (\n key &&\n (key === project.batchTest.testModule ||\n key.includes(project.batchTest.testModule))\n ) {\n return true;\n }\n }\n return false;\n };\n const isBatchTest = (testName: string): boolean =>\n testName === project.batchTest?.testName;\n\n for (const file of result.files ?? []) {\n const fileCase = matchFileCase(file);\n for (const error of file.errors ?? []) {\n const message = errorMessage(error);\n if (isBatchFile(file)) {\n addAll(message);\n } else {\n add(fileCase, message);\n }\n }\n for (const testResult of file.results ?? []) {\n const item = byTestName.get(testResult.name) ?? fileCase;\n for (const error of testResult.errors ?? []) {\n const message = errorMessage(error);\n if (isBatchTest(testResult.name) || isBatchFile(file)) {\n addAll(message);\n } else {\n add(item, message);\n }\n }\n }\n }\n\n if (\n project.batchTest &&\n errors.size === 0 &&\n result.unhandledErrors?.length\n ) {\n addAll(errorMessage(result.unhandledErrors[0]));\n }\n\n // A single-case run whose failure rstest could not pin to a file/test (e.g. a\n // worker crash surfaced only via `unhandledErrors`) still belongs to that one\n // case — otherwise its real error would be lost to a blank \"not executed\".\n if (\n project.cases.length === 1 &&\n errors.size === 0 &&\n result.unhandledErrors?.length\n ) {\n add(project.cases[0], errorMessage(result.unhandledErrors[0]));\n }\n\n return errors;\n};\n\n// When a case fails before it can write its own result file (module load\n// failure, crash before `writeResultFile`, ...), the batch reader would treat\n// it as \"not executed\" with no error. Persist a failed result carrying the real\n// error so the failure — and its cause — is visible in the summary JSON.\nconst recordUnreportedCaseFailures = (\n project: GeneratedRstestYamlProject,\n result: TestRunResult,\n): void => {\n if (!project.cases.length) return;\n const caseErrors = mapRunErrorsToCases(project, result);\n for (const item of project.cases) {\n if (existsSync(item.resultFile)) continue;\n const error = caseErrors.get(item.yamlFile);\n if (!error) continue;\n const failure: MidsceneYamlConfigResult = {\n file: item.yamlFile,\n success: false,\n executed: true,\n output: undefined,\n report: undefined,\n duration: 0,\n resultType: 'failed',\n error,\n };\n mkdirSync(dirname(item.resultFile), { recursive: true });\n writeFileSync(item.resultFile, JSON.stringify(failure, null, 2));\n }\n};\n\nexport async function runRstestYamlProject(\n options: RunRstestYamlProjectOptions,\n): Promise<number> {\n const [{ runRstest }, { rspack }] = await Promise.all([\n import('@rstest/core/api'),\n import(pathToFileURL(resolvePackageFromRstestCore('@rsbuild/core')).href),\n ]);\n const { project } = options;\n const maxConcurrency =\n project.maxConcurrency !== undefined\n ? Math.max(1, project.maxConcurrency)\n : undefined;\n const inlineConfig: RstestUserConfig = {\n root: project.projectDir,\n include: project.include,\n testEnvironment: 'node',\n testTimeout: project.testTimeout,\n ...(maxConcurrency !== undefined ? { maxConcurrency } : {}),\n ...(maxConcurrency !== undefined\n ? { pool: { maxWorkers: maxConcurrency, minWorkers: maxConcurrency } }\n : {}),\n ...(project.bail !== undefined ? { bail: project.bail } : {}),\n ...(project.retry !== undefined && project.retry > 0\n ? { retry: project.retry }\n : {}),\n reporters: [],\n tools: {\n rspack: (_config, { appendPlugins }) => {\n appendPlugins(\n new rspack.experiments.VirtualModulesPlugin(project.virtualModules),\n );\n },\n },\n };\n\n const result = await runRstest({\n cwd: options.cwd || project.projectDir,\n inlineConfig,\n });\n\n if (!result.ok) {\n recordUnreportedCaseFailures(project, result);\n if (options.stdio !== 'pipe') {\n const runErrors = collectRunErrors(result);\n if (runErrors.length) {\n console.error(`\\nYAML execution failed:\\n${runErrors.join('\\n\\n')}`);\n }\n }\n }\n\n return result.ok ? 0 : 1;\n}\n","import { existsSync, readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport type { MidsceneYamlConfigResult } from '@midscene/core';\nimport type { BatchRunnerConfig } from '../batch-runner';\nimport {\n createNotExecutedYamlResult,\n printExecutionFinished,\n printExecutionPlan,\n printExecutionSummary,\n writeExecutionSummaryFile,\n} from '../execution-summary';\nimport {\n type GeneratedRstestYamlProject,\n type RstestYamlCaseOptions,\n type WebYamlRuntimeOptions,\n createRstestYamlProject,\n} from './rstest-project';\nimport { runRstestYamlProject } from './rstest-runner';\n\ninterface WebRuntimeOptions {\n headed?: boolean;\n keepWindow?: boolean;\n}\n\nexport interface FrameworkTestCommandOptions extends WebRuntimeOptions {\n projectDir?: string;\n files?: string[];\n concurrent?: number;\n outputDir?: string;\n frameworkImport?: string;\n stdio?: 'inherit' | 'pipe';\n rstestRunner?: typeof runRstestYamlProject;\n}\n\nconst createCaseOptions = (\n config: BatchRunnerConfig,\n): Record<string, RstestYamlCaseOptions> => {\n const caseOptions: Record<string, RstestYamlCaseOptions> = {};\n for (const file of config.files) {\n caseOptions[resolve(file)] = {\n globalConfig: config.globalConfig,\n };\n }\n return caseOptions;\n};\n\nconst createWebRuntimeOptions = (\n config: BatchRunnerConfig,\n runtimeOptions: WebRuntimeOptions,\n): Record<string, WebYamlRuntimeOptions> => {\n const caseOptions: Record<string, WebYamlRuntimeOptions> = {};\n for (const file of config.files) {\n caseOptions[resolve(file)] = {\n headed: runtimeOptions.headed ?? config.headed,\n keepWindow: runtimeOptions.keepWindow ?? config.keepWindow,\n };\n }\n return caseOptions;\n};\n\nconst readProjectResults = (\n project: GeneratedRstestYamlProject,\n): MidsceneYamlConfigResult[] =>\n project.cases.map((item) => {\n if (existsSync(item.resultFile)) {\n return JSON.parse(\n readFileSync(item.resultFile, 'utf8'),\n ) as MidsceneYamlConfigResult;\n }\n\n return createNotExecutedYamlResult(item.yamlFile);\n });\n\nexport async function runFrameworkTestConfig(\n config: BatchRunnerConfig,\n commandOptions: FrameworkTestCommandOptions = {},\n): Promise<number> {\n printExecutionPlan(config);\n\n const projectDir = resolve(commandOptions.projectDir || process.cwd());\n const project = createRstestYamlProject({\n files: config.files,\n projectDir,\n outputDir: commandOptions.outputDir,\n frameworkImport: commandOptions.frameworkImport,\n caseOptions: createCaseOptions(config),\n webRuntimeOptions: createWebRuntimeOptions(config, commandOptions),\n maxConcurrency: commandOptions.concurrent ?? config.concurrent,\n bail: config.continueOnError ? 0 : 1,\n retry: config.retry,\n batchConfig: config.shareBrowserContext ? config : undefined,\n });\n\n const runner = commandOptions.rstestRunner || runRstestYamlProject;\n const exitCode = await runner({\n project,\n cwd: projectDir,\n stdio: commandOptions.stdio,\n });\n\n const results = readProjectResults(project);\n const summaryPath = writeExecutionSummaryFile(config.summary, results);\n printExecutionFinished();\n const success = printExecutionSummary(results, summaryPath);\n\n return success ? exitCode : 1;\n}\n","/*\nHow it works:\n`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.\n*/\n\nclass Node {\n\tvalue;\n\tnext;\n\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n}\n\nexport default class Queue {\n\t#head;\n\t#tail;\n\t#size;\n\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\n\tenqueue(value) {\n\t\tconst node = new Node(value);\n\n\t\tif (this.#head) {\n\t\t\tthis.#tail.next = node;\n\t\t\tthis.#tail = node;\n\t\t} else {\n\t\t\tthis.#head = node;\n\t\t\tthis.#tail = node;\n\t\t}\n\n\t\tthis.#size++;\n\t}\n\n\tdequeue() {\n\t\tconst current = this.#head;\n\t\tif (!current) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#head = this.#head.next;\n\t\tthis.#size--;\n\t\treturn current.value;\n\t}\n\n\tpeek() {\n\t\tif (!this.#head) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn this.#head.value;\n\n\t\t// TODO: Node.js 18.\n\t\t// return this.#head?.value;\n\t}\n\n\tclear() {\n\t\tthis.#head = undefined;\n\t\tthis.#tail = undefined;\n\t\tthis.#size = 0;\n\t}\n\n\tget size() {\n\t\treturn this.#size;\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tlet current = this.#head;\n\n\t\twhile (current) {\n\t\t\tyield current.value;\n\t\t\tcurrent = current.next;\n\t\t}\n\t}\n\n\t* drain() {\n\t\twhile (this.#head) {\n\t\t\tyield this.dequeue();\n\t\t}\n\t}\n}\n","import Queue from 'yocto-queue';\n\nexport default function pLimit(concurrency) {\n\tvalidateConcurrency(concurrency);\n\n\tconst queue = new Queue();\n\tlet activeCount = 0;\n\n\tconst resumeNext = () => {\n\t\tif (activeCount < concurrency && queue.size > 0) {\n\t\t\tqueue.dequeue()();\n\t\t\t// Since `pendingCount` has been decreased by one, increase `activeCount` by one.\n\t\t\tactiveCount++;\n\t\t}\n\t};\n\n\tconst next = () => {\n\t\tactiveCount--;\n\n\t\tresumeNext();\n\t};\n\n\tconst run = async (function_, resolve, arguments_) => {\n\t\tconst result = (async () => function_(...arguments_))();\n\n\t\tresolve(result);\n\n\t\ttry {\n\t\t\tawait result;\n\t\t} catch {}\n\n\t\tnext();\n\t};\n\n\tconst enqueue = (function_, resolve, arguments_) => {\n\t\t// Queue `internalResolve` instead of the `run` function\n\t\t// to preserve asynchronous context.\n\t\tnew Promise(internalResolve => {\n\t\t\tqueue.enqueue(internalResolve);\n\t\t}).then(\n\t\t\trun.bind(undefined, function_, resolve, arguments_),\n\t\t);\n\n\t\t(async () => {\n\t\t\t// This function needs to wait until the next microtask before comparing\n\t\t\t// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously\n\t\t\t// after the `internalResolve` function is dequeued and called. The comparison in the if-statement\n\t\t\t// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.\n\t\t\tawait Promise.resolve();\n\n\t\t\tif (activeCount < concurrency) {\n\t\t\t\tresumeNext();\n\t\t\t}\n\t\t})();\n\t};\n\n\tconst generator = (function_, ...arguments_) => new Promise(resolve => {\n\t\tenqueue(function_, resolve, arguments_);\n\t});\n\n\tObject.defineProperties(generator, {\n\t\tactiveCount: {\n\t\t\tget: () => activeCount,\n\t\t},\n\t\tpendingCount: {\n\t\t\tget: () => queue.size,\n\t\t},\n\t\tclearQueue: {\n\t\t\tvalue() {\n\t\t\t\tqueue.clear();\n\t\t\t},\n\t\t},\n\t\tconcurrency: {\n\t\t\tget: () => concurrency,\n\n\t\t\tset(newConcurrency) {\n\t\t\t\tvalidateConcurrency(newConcurrency);\n\t\t\t\tconcurrency = newConcurrency;\n\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\t// eslint-disable-next-line no-unmodified-loop-condition\n\t\t\t\t\twhile (activeCount < concurrency && queue.size > 0) {\n\t\t\t\t\t\tresumeNext();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t});\n\n\treturn generator;\n}\n\nexport function limitFunction(function_, option) {\n\tconst {concurrency} = option;\n\tconst limit = pLimit(concurrency);\n\n\treturn (...arguments_) => limit(() => function_(...arguments_));\n}\n\nfunction validateConcurrency(concurrency) {\n\tif (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {\n\t\tthrow new TypeError('Expected `concurrency` to be a number from 1 and up');\n\t}\n}\n","import { readFileSync } from 'node:fs';\nimport path, { basename, extname, join } from 'node:path';\nimport { ScriptPlayer, parseYamlScript } from '@midscene/core/yaml';\nimport { createServer } from 'http-server';\n\nimport assert from 'node:assert';\nimport type {\n AgentOpt,\n FreeFn,\n MidsceneYamlScript,\n MidsceneYamlScriptAgentOpt,\n MidsceneYamlScriptEnv,\n MidsceneYamlScriptWebEnv,\n} from '@midscene/core';\nimport { createAgent, getReportFileName } from '@midscene/core/agent';\nimport type { AbstractInterface } from '@midscene/core/device';\nimport { processCacheConfig } from '@midscene/core/utils';\nimport { getDebug } from '@midscene/shared/logger';\nimport { AgentOverChromeBridge } from '@midscene/web/bridge-mode';\nimport { puppeteerAgentForTarget } from '@midscene/web/puppeteer-agent-launcher';\nimport type { Browser, Page } from 'puppeteer';\nimport puppeteer from 'puppeteer';\n\nexport interface SingleYamlExecutionResult {\n success: boolean;\n file: string;\n player: ScriptPlayer<MidsceneYamlScriptEnv>;\n}\n\nconst debug = getDebug('create-yaml-player');\n\nexport const launchServer = async (\n dir: string,\n): Promise<ReturnType<typeof createServer>> => {\n // https://github.com/http-party/http-server/blob/master/bin/http-server\n return new Promise((resolve) => {\n const server = createServer({\n root: dir,\n });\n server.listen(0, '127.0.0.1', () => {\n resolve(server);\n });\n });\n};\n\n/**\n * Resolves reportFileName with proper priority handling.\n * Priority: YAML reportFileName > CLI testId (legacy) > YAML testId (legacy) > fileName\n * The final name always includes a unique suffix to avoid overwriting.\n */\nfunction resolveReportFileName(\n yamlReportFileName: string | undefined,\n cliTestId: string | undefined,\n yamlTestId: string | undefined,\n fileName: string,\n): string {\n const baseName = yamlReportFileName ?? cliTestId ?? yamlTestId ?? fileName;\n return getReportFileName(baseName);\n}\n\n/**\n * Builds agent options by merging YAML agent config with processed cache and report name.\n * Handles the spread of agent options and ensures proper cache configuration.\n */\nfunction buildAgentOptions(\n yamlAgent: MidsceneYamlScriptAgentOpt | undefined,\n reportFileName: string,\n fileName: string,\n): Partial<AgentOpt> {\n return {\n ...(yamlAgent || {}),\n cache: processCacheConfig(yamlAgent?.cache, fileName),\n reportFileName,\n };\n}\n\nexport async function createYamlPlayer(\n file: string,\n script?: MidsceneYamlScript,\n options?: {\n headed?: boolean;\n keepWindow?: boolean;\n browser?: Browser;\n page?: Page;\n testId?: string;\n },\n): Promise<ScriptPlayer<MidsceneYamlScriptEnv>> {\n const yamlScript =\n script || parseYamlScript(readFileSync(file, 'utf-8'), file);\n\n // Deep clone the script to avoid mutation issues when the same file is executed multiple times\n // This ensures each ScriptPlayer instance has its own independent copy of the YAML data\n const clonedYamlScript = structuredClone(yamlScript);\n\n const fileName = basename(file, extname(file));\n const preference = {\n headed: options?.headed,\n keepWindow: options?.keepWindow,\n reportFileName: resolveReportFileName(\n clonedYamlScript.agent?.reportFileName,\n options?.testId,\n clonedYamlScript.agent?.testId,\n fileName,\n ),\n };\n\n const player = new ScriptPlayer(\n clonedYamlScript,\n async () => {\n const freeFn: FreeFn[] = [];\n const webTarget = clonedYamlScript.web || clonedYamlScript.target;\n\n // Validate that only one target type is specified\n const targetCount = [\n typeof webTarget !== 'undefined',\n typeof clonedYamlScript.android !== 'undefined',\n typeof clonedYamlScript.ios !== 'undefined',\n typeof clonedYamlScript.harmony !== 'undefined',\n typeof clonedYamlScript.computer !== 'undefined',\n typeof clonedYamlScript.interface !== 'undefined',\n ].filter(Boolean).length;\n\n if (targetCount > 1) {\n const specifiedTargets = [\n typeof webTarget !== 'undefined' ? 'web' : null,\n typeof clonedYamlScript.android !== 'undefined' ? 'android' : null,\n typeof clonedYamlScript.ios !== 'undefined' ? 'ios' : null,\n typeof clonedYamlScript.harmony !== 'undefined' ? 'harmony' : null,\n typeof clonedYamlScript.computer !== 'undefined' ? 'computer' : null,\n typeof clonedYamlScript.interface !== 'undefined'\n ? 'interface'\n : null,\n ].filter(Boolean);\n\n throw new Error(\n `Only one target type can be specified, but found multiple: ${specifiedTargets.join(', ')}. Please specify only one of: web, android, ios, harmony, computer, or interface.`,\n );\n }\n\n // handle new web config\n if (typeof webTarget !== 'undefined') {\n if (typeof clonedYamlScript.target !== 'undefined') {\n console.warn(\n 'target is deprecated, please use web instead. See https://midscenejs.com/automate-with-scripts-in-yaml for more information. Sorry for the inconvenience.',\n );\n }\n\n // launch local server if needed\n let localServer: Awaited<ReturnType<typeof launchServer>> | undefined;\n let urlToVisit: string | undefined;\n if (webTarget.serve) {\n assert(\n typeof webTarget.url === 'string',\n 'url is required in serve mode',\n );\n localServer = await launchServer(webTarget.serve);\n const serverAddress = localServer.server.address();\n freeFn.push({\n name: 'local_server',\n fn: () => localServer?.server.close(),\n });\n if (webTarget.url.startsWith('/')) {\n urlToVisit = `http://${serverAddress?.address}:${serverAddress?.port}${webTarget.url}`;\n } else {\n urlToVisit = `http://${serverAddress?.address}:${serverAddress?.port}/${webTarget.url}`;\n }\n webTarget.url = urlToVisit;\n }\n\n // Validate: cdpEndpoint and bridgeMode are mutually exclusive\n if (webTarget.cdpEndpoint && webTarget.bridgeMode) {\n throw new Error(\n 'cdpEndpoint and bridgeMode are mutually exclusive. Please specify only one.',\n );\n }\n\n // CDP mode: connect to an existing browser via Chrome DevTools Protocol\n if (webTarget.cdpEndpoint) {\n // Use the shared browser from batch-runner if available (shareBrowserContext),\n // otherwise connect via CDP endpoint\n const cdpBrowser =\n options?.browser ??\n (await puppeteer.connect({\n browserWSEndpoint: webTarget.cdpEndpoint,\n defaultViewport: null,\n }));\n\n // Warn about options that don't apply to an already-running browser\n if (webTarget.chromeArgs) {\n console.warn(\n 'chromeArgs are not supported in CDP mode (browser is already running). They will be ignored.',\n );\n }\n\n // Reuse puppeteerAgentForTarget which handles page setup (userAgent, viewport,\n // cookie, waitForNetworkIdle, etc.) — pass the CDP browser as the browser param\n const { agent, freeFn: newFreeFn } = await puppeteerAgentForTarget(\n webTarget,\n {\n ...preference,\n ...buildAgentOptions(\n clonedYamlScript.agent,\n preference.reportFileName,\n fileName,\n ),\n },\n cdpBrowser as Browser,\n options?.page,\n );\n\n // Replace the default browser close with disconnect for CDP\n const cleanFreeFn = newFreeFn.filter(\n (f) => f.name !== 'puppeteer_browser',\n );\n if (!options?.browser) {\n // Only add disconnect if we created the connection (not shared from batch-runner)\n cleanFreeFn.push({\n name: 'cdp_browser_disconnect',\n fn: () => cdpBrowser.disconnect(),\n });\n }\n freeFn.push(...cleanFreeFn);\n\n return { agent, freeFn };\n }\n\n if (!webTarget.bridgeMode) {\n // use puppeteer\n const { agent, freeFn: newFreeFn } = await puppeteerAgentForTarget(\n webTarget,\n {\n ...preference,\n ...buildAgentOptions(\n clonedYamlScript.agent,\n preference.reportFileName,\n fileName,\n ),\n },\n options?.browser,\n options?.page,\n );\n freeFn.push(...newFreeFn);\n\n return { agent, freeFn };\n }\n assert(\n webTarget.bridgeMode === 'newTabWithUrl' ||\n webTarget.bridgeMode === 'currentTab',\n `bridgeMode config value must be either \"newTabWithUrl\" or \"currentTab\", but got ${webTarget.bridgeMode}`,\n );\n\n const bridgeUnsupportedKeys: (keyof MidsceneYamlScriptWebEnv)[] = [\n 'userAgent',\n 'viewportWidth',\n 'viewportHeight',\n 'deviceScaleFactor',\n 'waitForNetworkIdle',\n 'cookie',\n 'extraHTTPHeaders',\n 'chromeArgs',\n ];\n const ignoredKeys = bridgeUnsupportedKeys.filter(\n (key) => webTarget[key] != null,\n );\n if (ignoredKeys.length > 0) {\n console.warn(\n `puppeteer options (${ignoredKeys.join(', ')}) are not supported in bridge mode. They will be ignored.`,\n );\n }\n\n const agent = new AgentOverChromeBridge({\n closeNewTabsAfterDisconnect: webTarget.closeNewTabsAfterDisconnect,\n closeConflictServer: true,\n ...buildAgentOptions(\n clonedYamlScript.agent,\n preference.reportFileName,\n fileName,\n ),\n });\n\n if (webTarget.bridgeMode === 'newTabWithUrl') {\n await agent.connectNewTabWithUrl(webTarget.url);\n } else {\n if (webTarget.url) {\n console.warn(\n 'url will be ignored in bridge mode with \"currentTab\"',\n );\n }\n await agent.connectCurrentTab();\n }\n freeFn.push({\n name: 'destroy_agent_over_chrome_bridge',\n fn: () => agent.destroy(),\n });\n return {\n agent,\n freeFn,\n };\n }\n\n // handle android\n if (typeof clonedYamlScript.android !== 'undefined') {\n const androidTarget = clonedYamlScript.android;\n const { agentFromAdbDevice } = await import('@midscene/android');\n const agent = await agentFromAdbDevice(androidTarget?.deviceId, {\n ...androidTarget, // Pass all Android config options\n ...buildAgentOptions(\n clonedYamlScript.agent,\n preference.reportFileName,\n fileName,\n ),\n });\n\n if (androidTarget?.launch) {\n await agent.launch(androidTarget.launch);\n }\n\n freeFn.push({\n name: 'destroy_android_agent',\n fn: () => agent.destroy(),\n });\n\n return { agent, freeFn };\n }\n\n // handle iOS\n if (typeof clonedYamlScript.ios !== 'undefined') {\n const iosTarget = clonedYamlScript.ios;\n const { agentFromWebDriverAgent } = await import('@midscene/ios');\n const agent = await agentFromWebDriverAgent({\n ...iosTarget, // Pass all iOS config options\n ...buildAgentOptions(\n clonedYamlScript.agent,\n preference.reportFileName,\n fileName,\n ),\n });\n\n if (iosTarget?.launch) {\n await agent.launch(iosTarget.launch);\n }\n\n freeFn.push({\n name: 'destroy_ios_agent',\n fn: () => agent.destroy(),\n });\n\n return { agent, freeFn };\n }\n\n // handle harmony\n if (typeof clonedYamlScript.harmony !== 'undefined') {\n const harmonyTarget = clonedYamlScript.harmony;\n const { agentFromHdcDevice } = await import('@midscene/harmony');\n const agent = await agentFromHdcDevice(harmonyTarget?.deviceId, {\n ...harmonyTarget, // Pass all HarmonyOS config options\n ...buildAgentOptions(\n clonedYamlScript.agent,\n preference.reportFileName,\n fileName,\n ),\n });\n\n if (harmonyTarget?.launch) {\n await agent.launch(harmonyTarget.launch);\n }\n\n freeFn.push({\n name: 'destroy_harmony_agent',\n fn: () => agent.destroy(),\n });\n\n return { agent, freeFn };\n }\n\n // handle computer\n if (typeof clonedYamlScript.computer !== 'undefined') {\n const computerTarget = clonedYamlScript.computer;\n const { agentForComputer } = await import('@midscene/computer');\n const agent = await agentForComputer({\n ...computerTarget,\n ...buildAgentOptions(\n clonedYamlScript.agent,\n preference.reportFileName,\n fileName,\n ),\n });\n\n freeFn.push({\n name: 'destroy_computer_agent',\n fn: () => agent.destroy(),\n });\n\n return { agent, freeFn };\n }\n\n // handle general interface\n if (typeof clonedYamlScript.interface !== 'undefined') {\n const interfaceTarget = clonedYamlScript.interface;\n\n const moduleSpecifier = interfaceTarget.module;\n let finalModuleSpecifier: string;\n if (\n moduleSpecifier.startsWith('./') ||\n moduleSpecifier.startsWith('../') ||\n path.isAbsolute(moduleSpecifier)\n ) {\n const resolvedPath = join(process.cwd(), moduleSpecifier);\n finalModuleSpecifier = resolvedPath;\n } else {\n finalModuleSpecifier = moduleSpecifier;\n }\n\n // import the module dynamically\n debug(\n 'importing module config',\n interfaceTarget.module,\n 'with export config',\n interfaceTarget.export,\n 'final module specifier',\n finalModuleSpecifier,\n );\n\n const importedModule = await import(finalModuleSpecifier);\n\n // get the specific export or use default export\n const DeviceClass = interfaceTarget.export\n ? importedModule[interfaceTarget.export]\n : importedModule.default || importedModule;\n\n debug('DeviceClass', DeviceClass, 'with param', interfaceTarget.param);\n\n // create device instance with parameters\n const device: AbstractInterface = new DeviceClass(\n interfaceTarget.param || {},\n );\n\n // create agent from device\n debug('creating agent from device', device);\n const agent = createAgent(\n device,\n buildAgentOptions(\n clonedYamlScript.agent,\n preference.reportFileName,\n fileName,\n ),\n );\n\n freeFn.push({\n name: 'destroy_general_interface_agent',\n fn: () => {\n agent.destroy();\n },\n });\n\n return { agent, freeFn };\n }\n\n throw new Error(\n 'No valid interface configuration found in the yaml script, should be either \"web\", \"android\", \"ios\", \"harmony\", \"computer\", or \"interface\"',\n );\n },\n undefined,\n file,\n );\n\n return player;\n}\n","import { basename, dirname, relative } from 'node:path';\nimport type {\n MidsceneYamlScriptEnv,\n ScriptPlayerStatusValue,\n ScriptPlayerTaskStatus,\n} from '@midscene/core';\nimport type { ScriptPlayer } from '@midscene/core/yaml';\nimport chalk from 'chalk';\n\nexport interface MidsceneYamlFileContext {\n file: string;\n player: ScriptPlayer<MidsceneYamlScriptEnv>;\n}\n\nexport const isTTY = process.env.MIDSCENE_CLI_LOG_ON_NON_TTY\n ? false\n : process.stdout.isTTY;\nexport const indent = ' ';\nexport const spinnerInterval = 80;\nexport const spinnerFrames = ['◰', '◳', '◲', '◱']; // https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json\nexport const currentSpinningFrame = () => {\n return spinnerFrames[\n Math.floor(Date.now() / spinnerInterval) % spinnerFrames.length\n ];\n};\n\n// status: init / running / done / error\nfunction indicatorForStatus(status: ScriptPlayerStatusValue) {\n if (status === 'init') {\n return chalk.gray('◌');\n }\n if (status === 'running') {\n return chalk.yellowBright(currentSpinningFrame());\n }\n if (status === 'done') {\n return chalk.green('✔︎');\n }\n if (status === 'error') {\n return chalk.red('✘');\n }\n}\n\nexport const contextInfo = (context: MidsceneYamlFileContext) => {\n const filePath = context.file;\n const filePathToShow = relative(process.cwd(), filePath);\n const fileNameToPrint = `${chalk.gray(`${filePathToShow}`)}`;\n const fileStatusText = indicatorForStatus(context.player.status);\n const contextActionText =\n typeof context.player.currentTaskIndex === 'undefined' &&\n context.player.status === 'running'\n ? chalk.gray('(navigating)')\n : '';\n\n // error: ...\n const errorText = context.player.errorInSetup\n ? `\\n${indent}${chalk.red('error:')} ${context.player.errorInSetup?.message}\\n${indent}${indent}${context.player.errorInSetup?.stack}`\n : '';\n\n // output: ...\n const outputFile = context.player.output;\n const outputText =\n outputFile && Object.keys(context.player.result || {}).length > 0\n ? `\\n${indent}${chalk.gray(`output: ${outputFile}`)}`\n : '';\n\n // report: ...\n const reportFile = context.player.reportFile;\n const reportText = reportFile\n ? `\\n${indent}${chalk.gray(`report: ${reportFile}`)}`\n : '';\n\n // agent status: ...\n const agentStatusTip = context.player.agentStatusTip;\n const agentStatusText = agentStatusTip\n ? `\\n${indent}${chalk.gray(`agent status: ${agentStatusTip}`)}`\n : '';\n\n const mergedText =\n `${fileStatusText} ${fileNameToPrint} ${contextActionText}${outputText}${reportText}${errorText}${agentStatusText}`.trim();\n\n return {\n fileNameToPrint,\n fileStatusText,\n contextActionText,\n outputText,\n reportText,\n mergedText,\n };\n};\n\nexport const singleTaskInfo = (task: ScriptPlayerTaskStatus) => {\n let stepText = '';\n if (task.status === 'init') {\n stepText = '';\n } else if (task.status === 'running' || task.status === 'error') {\n if (typeof task.currentStep === 'undefined') {\n stepText = chalk.gray('(navigating)');\n } else if (typeof task.currentStep === 'number') {\n const actionText = ''; // taskBrief ? `, ${taskBrief}` : '';\n stepText = chalk.gray(\n `(task ${task.currentStep + 1}/${task.totalSteps}${actionText})`.trim(),\n );\n } else {\n stepText = chalk.gray('(unknown task)');\n }\n }\n\n const errorText =\n task.status === 'error'\n ? `\\n${indent}${chalk.gray('error:')}\\n${indent}${indent}${task.error?.message}`\n : '';\n\n const statusText = indicatorForStatus(task.status);\n const mergedLine = `${statusText} ${task.name} ${stepText}${errorText}`;\n return {\n nameText: task.name,\n stepText,\n errorText,\n itemStatusText: statusText,\n mergedLine,\n };\n};\n\nfunction paddingLines(lines: string[]) {\n return lines.map((line) => {\n return `${indent}${line}`;\n });\n}\n\nexport const contextTaskListSummary = (\n taskStatusArray: ScriptPlayerTaskStatus[],\n context: MidsceneYamlFileContext,\n) => {\n const prefixLines: string[] = [];\n const currentLine: string[] = [];\n const suffixText: string[] = [];\n const { mergedText: fileInfo } = contextInfo(context);\n if (!context.player.errorInSetup) {\n for (const task of taskStatusArray) {\n const { mergedLine } = singleTaskInfo(task);\n\n if (context.player.status === 'init') {\n suffixText.push(mergedLine);\n } else if (context.player.status === 'running') {\n currentLine.push(mergedLine);\n } else if (context.player.status === 'done') {\n prefixLines.push(mergedLine);\n } else if (context.player.status === 'error') {\n prefixLines.push(mergedLine);\n }\n }\n }\n const lines: string[] = [fileInfo];\n if (prefixLines.length > 0) lines.push(...paddingLines(prefixLines));\n if (currentLine.length > 0) lines.push(...paddingLines(currentLine));\n if (suffixText.length > 0) lines.push(...paddingLines(suffixText));\n return lines.join('\\n');\n};\n","const copyProperty = (to, from, property, ignoreNonConfigurable) => {\n\t// `Function#length` should reflect the parameters of `to` not `from` since we keep its body.\n\t// `Function#prototype` is non-writable and non-configurable so can never be modified.\n\tif (property === 'length' || property === 'prototype') {\n\t\treturn;\n\t}\n\n\t// `Function#arguments` and `Function#caller` should not be copied. They were reported to be present in `Reflect.ownKeys` for some devices in React Native (#41), so we explicitly ignore them here.\n\tif (property === 'arguments' || property === 'caller') {\n\t\treturn;\n\t}\n\n\tconst toDescriptor = Object.getOwnPropertyDescriptor(to, property);\n\tconst fromDescriptor = Object.getOwnPropertyDescriptor(from, property);\n\n\tif (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {\n\t\treturn;\n\t}\n\n\tObject.defineProperty(to, property, fromDescriptor);\n};\n\n// `Object.defineProperty()` throws if the property exists, is not configurable and either:\n// - one its descriptors is changed\n// - it is non-writable and its value is changed\nconst canCopyProperty = function (toDescriptor, fromDescriptor) {\n\treturn toDescriptor === undefined || toDescriptor.configurable || (\n\t\ttoDescriptor.writable === fromDescriptor.writable\n\t\t&& toDescriptor.enumerable === fromDescriptor.enumerable\n\t\t&& toDescriptor.configurable === fromDescriptor.configurable\n\t\t&& (toDescriptor.writable || toDescriptor.value === fromDescriptor.value)\n\t);\n};\n\nconst changePrototype = (to, from) => {\n\tconst fromPrototype = Object.getPrototypeOf(from);\n\tif (fromPrototype === Object.getPrototypeOf(to)) {\n\t\treturn;\n\t}\n\n\tObject.setPrototypeOf(to, fromPrototype);\n};\n\nconst wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/\\n${fromBody}`;\n\nconst toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, 'toString');\nconst toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, 'name');\n\n// We call `from.toString()` early (not lazily) to ensure `from` can be garbage collected.\n// We use `bind()` instead of a closure for the same reason.\n// Calling `from.toString()` early also allows caching it in case `to.toString()` is called several times.\nconst changeToString = (to, from, name) => {\n\tconst withName = name === '' ? '' : `with ${name.trim()}() `;\n\tconst newToString = wrappedToString.bind(null, withName, from.toString());\n\t// Ensure `to.toString.toString` is non-enumerable and has the same `same`\n\tObject.defineProperty(newToString, 'name', toStringName);\n\tconst {writable, enumerable, configurable} = toStringDescriptor; // We destructue to avoid a potential `get` descriptor.\n\tObject.defineProperty(to, 'toString', {value: newToString, writable, enumerable, configurable});\n};\n\nexport default function mimicFunction(to, from, {ignoreNonConfigurable = false} = {}) {\n\tconst {name} = to;\n\n\tfor (const property of Reflect.ownKeys(from)) {\n\t\tcopyProperty(to, from, property, ignoreNonConfigurable);\n\t}\n\n\tchangePrototype(to, from);\n\tchangeToString(to, from, name);\n\n\treturn to;\n}\n","import mimicFunction from 'mimic-function';\n\nconst calledFunctions = new WeakMap();\n\nconst onetime = (function_, options = {}) => {\n\tif (typeof function_ !== 'function') {\n\t\tthrow new TypeError('Expected a function');\n\t}\n\n\tlet returnValue;\n\tlet callCount = 0;\n\tconst functionName = function_.displayName || function_.name || '<anonymous>';\n\n\tconst onetime = function (...arguments_) {\n\t\tcalledFunctions.set(onetime, ++callCount);\n\n\t\tif (callCount === 1) {\n\t\t\treturnValue = function_.apply(this, arguments_);\n\t\t\tfunction_ = undefined;\n\t\t} else if (options.throw === true) {\n\t\t\tthrow new Error(`Function \\`${functionName}\\` can only be called once`);\n\t\t}\n\n\t\treturn returnValue;\n\t};\n\n\tmimicFunction(onetime, function_);\n\tcalledFunctions.set(onetime, callCount);\n\n\treturn onetime;\n};\n\nonetime.callCount = function_ => {\n\tif (!calledFunctions.has(function_)) {\n\t\tthrow new Error(`The given function \\`${function_.name}\\` is not wrapped by the \\`onetime\\` package`);\n\t}\n\n\treturn calledFunctions.get(function_);\n};\n\nexport default onetime;\n","/**\n * This is not the set of all possible signals.\n *\n * It IS, however, the set of all signals that trigger\n * an exit on either Linux or BSD systems. Linux is a\n * superset of the signal names supported on BSD, and\n * the unknown signals just fail to register, so we can\n * catch that easily enough.\n *\n * Windows signals are a different set, since there are\n * signals that terminate Windows processes, but don't\n * terminate (or don't even exist) on Posix systems.\n *\n * Don't bother with SIGKILL. It's uncatchable, which\n * means that we can't fire any callbacks anyway.\n *\n * If a user does happen to register a handler on a non-\n * fatal signal like SIGWINCH or something, and then\n * exit, it'll end up firing `process.emit('exit')`, so\n * the handler will be fired anyway.\n *\n * SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised\n * artificially, inherently leave the process in a\n * state from which it is not safe to try and enter JS\n * listeners.\n */\nexport const signals = [];\nsignals.push('SIGHUP', 'SIGINT', 'SIGTERM');\nif (process.platform !== 'win32') {\n signals.push('SIGALRM', 'SIGABRT', 'SIGVTALRM', 'SIGXCPU', 'SIGXFSZ', 'SIGUSR2', 'SIGTRAP', 'SIGSYS', 'SIGQUIT', 'SIGIOT'\n // should detect profiler and enable/disable accordingly.\n // see #21\n // 'SIGPROF'\n );\n}\nif (process.platform === 'linux') {\n signals.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT');\n}\n//# sourceMappingURL=signals.js.map","// Note: since nyc uses this module to output coverage, any lines\n// that are in the direct sync flow of nyc's outputCoverage are\n// ignored, since we can never get coverage for them.\n// grab a reference to node's real process object right away\nimport { signals } from './signals.js';\nexport { signals };\nconst processOk = (process) => !!process &&\n typeof process === 'object' &&\n typeof process.removeListener === 'function' &&\n typeof process.emit === 'function' &&\n typeof process.reallyExit === 'function' &&\n typeof process.listeners === 'function' &&\n typeof process.kill === 'function' &&\n typeof process.pid === 'number' &&\n typeof process.on === 'function';\nconst kExitEmitter = Symbol.for('signal-exit emitter');\nconst global = globalThis;\nconst ObjectDefineProperty = Object.defineProperty.bind(Object);\n// teeny special purpose ee\nclass Emitter {\n emitted = {\n afterExit: false,\n exit: false,\n };\n listeners = {\n afterExit: [],\n exit: [],\n };\n count = 0;\n id = Math.random();\n constructor() {\n if (global[kExitEmitter]) {\n return global[kExitEmitter];\n }\n ObjectDefineProperty(global, kExitEmitter, {\n value: this,\n writable: false,\n enumerable: false,\n configurable: false,\n });\n }\n on(ev, fn) {\n this.listeners[ev].push(fn);\n }\n removeListener(ev, fn) {\n const list = this.listeners[ev];\n const i = list.indexOf(fn);\n /* c8 ignore start */\n if (i === -1) {\n return;\n }\n /* c8 ignore stop */\n if (i === 0 && list.length === 1) {\n list.length = 0;\n }\n else {\n list.splice(i, 1);\n }\n }\n emit(ev, code, signal) {\n if (this.emitted[ev]) {\n return false;\n }\n this.emitted[ev] = true;\n let ret = false;\n for (const fn of this.listeners[ev]) {\n ret = fn(code, signal) === true || ret;\n }\n if (ev === 'exit') {\n ret = this.emit('afterExit', code, signal) || ret;\n }\n return ret;\n }\n}\nclass SignalExitBase {\n}\nconst signalExitWrap = (handler) => {\n return {\n onExit(cb, opts) {\n return handler.onExit(cb, opts);\n },\n load() {\n return handler.load();\n },\n unload() {\n return handler.unload();\n },\n };\n};\nclass SignalExitFallback extends SignalExitBase {\n onExit() {\n return () => { };\n }\n load() { }\n unload() { }\n}\nclass SignalExit extends SignalExitBase {\n // \"SIGHUP\" throws an `ENOSYS` error on Windows,\n // so use a supported signal instead\n /* c8 ignore start */\n #hupSig = process.platform === 'win32' ? 'SIGINT' : 'SIGHUP';\n /* c8 ignore stop */\n #emitter = new Emitter();\n #process;\n #originalProcessEmit;\n #originalProcessReallyExit;\n #sigListeners = {};\n #loaded = false;\n constructor(process) {\n super();\n this.#process = process;\n // { <signal>: <listener fn>, ... }\n this.#sigListeners = {};\n for (const sig of signals) {\n this.#sigListeners[sig] = () => {\n // If there are no other listeners, an exit is coming!\n // Simplest way: remove us and then re-send the signal.\n // We know that this will kill the process, so we can\n // safely emit now.\n const listeners = this.#process.listeners(sig);\n let { count } = this.#emitter;\n // This is a workaround for the fact that signal-exit v3 and signal\n // exit v4 are not aware of each other, and each will attempt to let\n // the other handle it, so neither of them do. To correct this, we\n // detect if we're the only handler *except* for previous versions\n // of signal-exit, and increment by the count of listeners it has\n // created.\n /* c8 ignore start */\n const p = process;\n if (typeof p.__signal_exit_emitter__ === 'object' &&\n typeof p.__signal_exit_emitter__.count === 'number') {\n count += p.__signal_exit_emitter__.count;\n }\n /* c8 ignore stop */\n if (listeners.length === count) {\n this.unload();\n const ret = this.#emitter.emit('exit', null, sig);\n /* c8 ignore start */\n const s = sig === 'SIGHUP' ? this.#hupSig : sig;\n if (!ret)\n process.kill(process.pid, s);\n /* c8 ignore stop */\n }\n };\n }\n this.#originalProcessReallyExit = process.reallyExit;\n this.#originalProcessEmit = process.emit;\n }\n onExit(cb, opts) {\n /* c8 ignore start */\n if (!processOk(this.#process)) {\n return () => { };\n }\n /* c8 ignore stop */\n if (this.#loaded === false) {\n this.load();\n }\n const ev = opts?.alwaysLast ? 'afterExit' : 'exit';\n this.#emitter.on(ev, cb);\n return () => {\n this.#emitter.removeListener(ev, cb);\n if (this.#emitter.listeners['exit'].length === 0 &&\n this.#emitter.listeners['afterExit'].length === 0) {\n this.unload();\n }\n };\n }\n load() {\n if (this.#loaded) {\n return;\n }\n this.#loaded = true;\n // This is the number of onSignalExit's that are in play.\n // It's important so that we can count the correct number of\n // listeners on signals, and don't wait for the other one to\n // handle it instead of us.\n this.#emitter.count += 1;\n for (const sig of signals) {\n try {\n const fn = this.#sigListeners[sig];\n if (fn)\n this.#process.on(sig, fn);\n }\n catch (_) { }\n }\n this.#process.emit = (ev, ...a) => {\n return this.#processEmit(ev, ...a);\n };\n this.#process.reallyExit = (code) => {\n return this.#processReallyExit(code);\n };\n }\n unload() {\n if (!this.#loaded) {\n return;\n }\n this.#loaded = false;\n signals.forEach(sig => {\n const listener = this.#sigListeners[sig];\n /* c8 ignore start */\n if (!listener) {\n throw new Error('Listener not defined for signal: ' + sig);\n }\n /* c8 ignore stop */\n try {\n this.#process.removeListener(sig, listener);\n /* c8 ignore start */\n }\n catch (_) { }\n /* c8 ignore stop */\n });\n this.#process.emit = this.#originalProcessEmit;\n this.#process.reallyExit = this.#originalProcessReallyExit;\n this.#emitter.count -= 1;\n }\n #processReallyExit(code) {\n /* c8 ignore start */\n if (!processOk(this.#process)) {\n return 0;\n }\n this.#process.exitCode = code || 0;\n /* c8 ignore stop */\n this.#emitter.emit('exit', this.#process.exitCode, null);\n return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);\n }\n #processEmit(ev, ...args) {\n const og = this.#originalProcessEmit;\n if (ev === 'exit' && processOk(this.#process)) {\n if (typeof args[0] === 'number') {\n this.#process.exitCode = args[0];\n /* c8 ignore start */\n }\n /* c8 ignore start */\n const ret = og.call(this.#process, ev, ...args);\n /* c8 ignore start */\n this.#emitter.emit('exit', this.#process.exitCode, null);\n /* c8 ignore stop */\n return ret;\n }\n else {\n return og.call(this.#process, ev, ...args);\n }\n }\n}\nconst process = globalThis.process;\n// wrap so that we call the method on the actual handler, without\n// exporting it directly.\nexport const { \n/**\n * Called when the process is exiting, whether via signal, explicit\n * exit, or running out of stuff to do.\n *\n * If the global process object is not suitable for instrumentation,\n * then this will be a no-op.\n *\n * Returns a function that may be used to unload signal-exit.\n */\nonExit, \n/**\n * Load the listeners. Likely you never need to call this, unless\n * doing a rather deep integration with signal-exit functionality.\n * Mostly exposed for the benefit of testing.\n *\n * @internal\n */\nload, \n/**\n * Unload the listeners. Likely you never need to call this, unless\n * doing a rather deep integration with signal-exit functionality.\n * Mostly exposed for the benefit of testing.\n *\n * @internal\n */\nunload, } = signalExitWrap(processOk(process) ? new SignalExit(process) : new SignalExitFallback());\n//# sourceMappingURL=index.js.map","import process from 'node:process';\nimport onetime from 'onetime';\nimport {onExit} from 'signal-exit';\n\nconst terminal = process.stderr.isTTY\n\t? process.stderr\n\t: (process.stdout.isTTY ? process.stdout : undefined);\n\nconst restoreCursor = terminal ? onetime(() => {\n\tonExit(() => {\n\t\tterminal.write('\\u001B[?25h');\n\t}, {alwaysLast: true});\n}) : () => {};\n\nexport default restoreCursor;\n","import { appendFileSync } from 'node:fs';\nimport type { Writable } from 'node:stream';\nimport { stripVTControlCharacters } from 'node:util';\nimport restoreCursor from 'restore-cursor';\n\nconst DEFAULT_RENDER_INTERVAL = 160;\n\nconst ESC = '\\x1B[';\nconst CLEAR_LINE = `${ESC}K`;\nconst MOVE_CURSOR_ONE_ROW_UP = `${ESC}1A`;\nconst HIDE_CURSOR = `${ESC}?25l`;\nconst SHOW_CURSOR = `${ESC}?25h`;\nconst SYNC_START = `${ESC}?2026h`;\nconst SYNC_END = `${ESC}?2026l`;\n\ninterface Options {\n outputStream: Writable;\n errorStream: Writable;\n interval?: number;\n getWindow: () => string[];\n}\n\ntype StreamType = 'output' | 'error';\n\n/**\n * Renders content of `getWindow` at the bottom of the terminal and\n * forwards all other intercepted `stdout` and `stderr` logs above it.\n */\nexport class TTYWindowRenderer {\n private options: Required<Options>;\n private streams!: Record<StreamType, Writable['write']>;\n private buffer: { type: StreamType; message: string }[] = [];\n private renderInterval: NodeJS.Timeout | undefined = undefined;\n\n private windowHeight = 0;\n private finished = false;\n private cleanups: (() => void)[] = [];\n\n constructor(options: Options) {\n this.options = {\n interval: DEFAULT_RENDER_INTERVAL,\n ...options,\n };\n\n this.streams = {\n output: options.outputStream.write.bind(options.outputStream),\n error: options.errorStream.write.bind(options.errorStream),\n };\n\n this.cleanups.push(\n this.interceptStream(process.stdout, 'output'),\n this.interceptStream(process.stderr, 'error'),\n );\n\n restoreCursor();\n this.write(HIDE_CURSOR, 'output');\n\n this.start();\n }\n\n start() {\n this.finished = false;\n this.renderInterval = setInterval(\n () => this.flushBuffer(),\n this.options.interval,\n );\n }\n\n stop() {\n this.flushBuffer();\n // this.clearWindow();\n this.write(SHOW_CURSOR, 'output');\n this.cleanups.splice(0).map((fn) => fn());\n clearInterval(this.renderInterval);\n }\n\n /**\n * Write all buffered output and stop buffering.\n * All intercepted writes are forwarded to actual write after this.\n */\n finish() {\n this.finished = true;\n this.flushBuffer();\n clearInterval(this.renderInterval);\n }\n\n private flushBuffer() {\n if (this.buffer.length === 0) {\n return this.render();\n }\n\n let current;\n\n // Concatenate same types into a single render\n for (const next of this.buffer.splice(0)) {\n if (!current) {\n current = next;\n continue;\n }\n\n if (current.type !== next.type) {\n this.render(current.message, current.type);\n current = next;\n continue;\n }\n\n current.message += next.message;\n }\n\n if (current) {\n this.render(current?.message, current?.type);\n }\n }\n\n private render(message?: string, type: StreamType = 'output') {\n if (this.finished) {\n this.clearWindow();\n return this.write(message || '', type);\n }\n\n const windowContent = this.options.getWindow();\n const rowCount = getRenderedRowCount(\n windowContent,\n this.options.outputStream,\n );\n let padding = this.windowHeight - rowCount;\n\n if (padding > 0 && message) {\n padding -= getRenderedRowCount([message], this.options.outputStream);\n }\n\n this.write(SYNC_START);\n this.clearWindow();\n\n if (message) {\n this.write(message, type);\n }\n\n if (padding > 0) {\n this.write('\\n'.repeat(padding));\n }\n\n this.write(windowContent.join('\\n'));\n this.write(SYNC_END);\n\n this.windowHeight = rowCount + Math.max(0, padding);\n }\n\n private clearWindow() {\n if (this.windowHeight === 0) {\n return;\n }\n\n this.write(CLEAR_LINE);\n\n for (let i = 1; i < this.windowHeight; i++) {\n this.write(`${MOVE_CURSOR_ONE_ROW_UP}${CLEAR_LINE}`);\n }\n\n this.windowHeight = 0;\n }\n\n private interceptStream(stream: NodeJS.WriteStream, type: StreamType) {\n const original = stream.write;\n\n // @ts-expect-error -- not sure how 2 overloads should be typed\n stream.write = (chunk, _, callback) => {\n if (chunk) {\n if (this.finished) {\n this.write(chunk.toString(), type);\n } else {\n this.buffer.push({ type, message: chunk.toString() });\n }\n }\n callback?.();\n };\n\n return function restore() {\n stream.write = original;\n };\n }\n\n private write(message: string, type: 'output' | 'error' = 'output') {\n (this.streams[type] as Writable['write'])(message);\n }\n}\n\n/** Calculate the actual row count needed to render `rows` into `stream` */\nfunction getRenderedRowCount(\n contents: string[],\n stream: Options['outputStream'],\n) {\n let count = 0;\n const columns = 'columns' in stream ? (stream.columns as number) : 80;\n\n for (const content of contents) {\n const rows = content.split('\\n');\n for (const row of rows) {\n const text = stripVTControlCharacters(row);\n count += Math.max(1, Math.ceil(text.length / columns));\n }\n }\n\n return count;\n}\n","import { readFileSync } from 'node:fs';\nimport type {\n MidsceneYamlConfigResult,\n MidsceneYamlScript,\n MidsceneYamlScriptAndroidEnv,\n MidsceneYamlScriptEnv,\n MidsceneYamlScriptIOSEnv,\n MidsceneYamlScriptWebEnv,\n} from '@midscene/core';\nimport { type ScriptPlayer, parseYamlScript } from '@midscene/core/yaml';\nimport {\n buildChromeArgs,\n defaultViewportHeight,\n defaultViewportWidth,\n} from '@midscene/web/puppeteer-agent-launcher';\n\nimport merge from 'lodash.merge';\nimport pLimit from 'p-limit';\nimport puppeteer, { type Browser, type Page } from 'puppeteer';\nimport { createYamlPlayer } from './create-yaml-player';\nimport {\n createExecutedYamlResult,\n createNotExecutedYamlResult,\n printExecutionFinished,\n printExecutionPlan,\n writeExecutionSummaryFile,\n} from './execution-summary';\nimport {\n type MidsceneYamlFileContext,\n contextInfo,\n contextTaskListSummary,\n isTTY,\n spinnerInterval,\n} from './printer';\nimport { TTYWindowRenderer } from './tty-renderer';\n\nexport interface BatchRunnerConfig {\n files: string[];\n concurrent: number;\n continueOnError: boolean;\n /**\n * Number of extra attempts for a failed yaml file. Mapped to Rstest's\n * `retry` option, so only the cases that failed in the previous attempt\n * are re-executed. Defaults to 0 (no retry).\n */\n retry?: number;\n summary: string;\n shareBrowserContext: boolean;\n globalConfig?: {\n web?: Partial<MidsceneYamlScriptWebEnv>;\n android?: Partial<MidsceneYamlScriptAndroidEnv>;\n ios?: Partial<MidsceneYamlScriptIOSEnv>;\n target?: Partial<MidsceneYamlScriptWebEnv>;\n };\n headed: boolean;\n keepWindow: boolean;\n dotenvOverride: boolean;\n dotenvDebug: boolean;\n}\n\ninterface BatchFileContext {\n file: string;\n executionConfig: MidsceneYamlScript;\n outputPath?: string;\n options: {\n headed?: boolean;\n keepWindow?: boolean;\n browser?: Browser;\n page?: Page;\n };\n}\n\nexport interface RunYamlBatchOptions {\n generateSummary?: boolean;\n printExecutionPlan?: boolean;\n}\n\nclass YamlBatchExecutor {\n private config: BatchRunnerConfig;\n private results: MidsceneYamlConfigResult[] = [];\n\n constructor(config: BatchRunnerConfig) {\n this.config = config;\n }\n\n async run(\n options: RunYamlBatchOptions = {},\n ): Promise<MidsceneYamlConfigResult[]> {\n const generateSummary = options.generateSummary ?? true;\n const shouldPrintExecutionPlan = options.printExecutionPlan ?? true;\n const { keepWindow, headed } = this.config;\n\n // Print execution plan\n if (shouldPrintExecutionPlan) {\n printExecutionPlan(this.config);\n }\n\n // Prepare file contexts\n const fileContextList: BatchFileContext[] = [];\n let browser: Browser | null = null;\n let sharedPage: Page | null = null;\n\n try {\n // First, create all file contexts without a browser instance\n for (const file of this.config.files) {\n const fileConfig = await this.loadFileConfig(file);\n const context = await this.createFileContext(file, fileConfig, {\n headed,\n keepWindow,\n });\n fileContextList.push(context);\n }\n\n // Now, check if any of the tasks require a web browser\n const needsBrowser = fileContextList.some(\n (ctx) =>\n Object.keys(\n ctx.executionConfig.web || ctx.executionConfig.target || {},\n ).length > 0,\n );\n\n if (needsBrowser && this.config.shareBrowserContext) {\n const globalWebConfig = this.config.globalConfig?.web;\n\n if (globalWebConfig?.cdpEndpoint) {\n // CDP mode: connect to an existing browser\n browser = await puppeteer.connect({\n browserWSEndpoint: globalWebConfig.cdpEndpoint,\n defaultViewport: null,\n });\n } else {\n // Extract viewport dimensions from global config or use defaults\n // This should match the logic in launchPuppeteerPage\n const width = globalWebConfig?.viewportWidth ?? defaultViewportWidth;\n const height =\n globalWebConfig?.viewportHeight ?? defaultViewportHeight;\n\n const args = buildChromeArgs({\n userAgent: globalWebConfig?.userAgent,\n // Only pass windowSize in headed mode; in headless mode, defaultViewport takes precedence\n windowSize: headed ? { width, height } : undefined,\n chromeArgs: globalWebConfig?.chromeArgs,\n });\n\n browser = await puppeteer.launch({\n headless: !headed,\n defaultViewport: headed ? null : { width, height },\n args,\n acceptInsecureCerts: globalWebConfig?.acceptInsecureCerts,\n });\n }\n\n // Create a shared page instance that will be reused across all YAML files\n // This ensures localStorage and sessionStorage are preserved between files\n sharedPage = await browser.newPage();\n\n // Assign the browser instance and shared page to all contexts\n for (const context of fileContextList) {\n context.options.browser = browser;\n context.options.page = sharedPage;\n }\n }\n\n // Execute files\n const { executedResults, notExecutedContexts } =\n await this.executeFiles(fileContextList);\n\n // Process results\n this.results = await this.processResults(\n executedResults,\n notExecutedContexts,\n );\n } finally {\n if (browser && !this.config.keepWindow) {\n // For CDP mode, disconnect instead of closing the externally managed browser\n const isCdp = !!this.config.globalConfig?.web?.cdpEndpoint;\n if (isCdp) {\n browser.disconnect();\n } else {\n await browser.close();\n }\n }\n if (generateSummary) {\n await this.generateOutputIndex();\n }\n }\n\n return this.results;\n }\n\n private async createFileContext(\n file: string,\n fileConfig: MidsceneYamlScript,\n options: { headed?: boolean; keepWindow?: boolean; browser?: Browser },\n ): Promise<BatchFileContext> {\n const { globalConfig } = this.config;\n\n // Deep clone to avoid mutation\n const clonedFileConfig = JSON.parse(JSON.stringify(fileConfig));\n\n // Normalize deprecated 'target' to 'web'\n if (clonedFileConfig.target) {\n clonedFileConfig.web = {\n ...clonedFileConfig.target,\n ...clonedFileConfig.web,\n };\n // biome-ignore lint/performance/noDelete: <explanation>\n delete clonedFileConfig.target;\n }\n if (globalConfig?.target) {\n globalConfig.web = { ...globalConfig.target, ...globalConfig.web };\n // biome-ignore lint/performance/noDelete: <explanation>\n delete globalConfig.target;\n }\n\n // Start with the file's config, then merge the global config from the index file,\n // which has already been merged with command-line options.\n const executionConfig = merge(clonedFileConfig, globalConfig);\n\n return {\n file,\n executionConfig,\n options,\n };\n }\n\n private async executeFiles(fileContextList: BatchFileContext[]): Promise<{\n executedResults: Array<MidsceneYamlFileContext & { duration: number }>;\n notExecutedContexts: Array<{\n file: string;\n player: ScriptPlayer<MidsceneYamlScriptEnv>;\n }>;\n }> {\n const executedResults: Array<\n MidsceneYamlFileContext & { duration: number }\n > = [];\n const notExecutedContexts: Array<{\n file: string;\n player: ScriptPlayer<MidsceneYamlScriptEnv>;\n }> = [];\n\n // Pre-create all player contexts for displaying task lists\n const allFileContexts: MidsceneYamlFileContext[] = [];\n for (const context of fileContextList) {\n // Create a ScriptPlayer that will be used for actual execution\n const player = await createYamlPlayer(\n context.file,\n context.executionConfig,\n context.options,\n );\n allFileContexts.push({\n file: context.file,\n player,\n });\n }\n\n // Setup TTY renderer\n let ttyRenderer: TTYWindowRenderer | undefined;\n if (isTTY) {\n const summaryContents = () => {\n const summary: string[] = [''];\n for (const context of allFileContexts) {\n summary.push(\n contextTaskListSummary(context.player.taskStatusList, context),\n );\n }\n summary.push('');\n return summary;\n };\n ttyRenderer = new TTYWindowRenderer({\n outputStream: process.stdout,\n errorStream: process.stderr,\n getWindow: summaryContents,\n interval: spinnerInterval,\n });\n ttyRenderer.start();\n }\n\n try {\n // Helper function to execute a single file\n const executeFile = async (\n context: BatchFileContext,\n ): Promise<MidsceneYamlFileContext & { duration: number }> => {\n // Find the corresponding player in allFileContexts\n const allFileContext = allFileContexts.find(\n (c) => c.file === context.file,\n );\n if (!allFileContext) {\n throw new Error(`Player not found for file: ${context.file}`);\n }\n\n if (!isTTY) {\n const { mergedText } = contextInfo(allFileContext);\n console.log(mergedText);\n }\n\n // Set output path if specified\n if (context.outputPath) {\n allFileContext.player.output = context.outputPath;\n }\n\n // Record start time\n const startTime = Date.now();\n\n // Run the player\n await allFileContext.player.run();\n\n // Calculate duration\n const endTime = Date.now();\n const duration = endTime - startTime;\n\n const executedContext: MidsceneYamlFileContext & { duration: number } =\n {\n file: context.file,\n player: allFileContext.player,\n duration,\n };\n\n if (!isTTY) {\n console.log(\n contextTaskListSummary(\n allFileContext.player.taskStatusList,\n executedContext,\n ),\n );\n }\n\n return executedContext;\n };\n\n // Execute based on concurrency and error handling settings\n await this.executeConcurrently(\n fileContextList,\n executeFile,\n executedResults,\n notExecutedContexts,\n );\n\n // Print final summary for non-TTY mode\n if (!isTTY) {\n console.log('\\n📋 Execution Results:');\n for (const context of executedResults) {\n console.log(\n contextTaskListSummary(context.player.taskStatusList, context),\n );\n }\n }\n } finally {\n if (ttyRenderer) {\n ttyRenderer.stop();\n }\n }\n\n return { executedResults, notExecutedContexts };\n }\n\n private async executeConcurrently(\n fileContextList: BatchFileContext[],\n executeFile: (\n context: BatchFileContext,\n ) => Promise<MidsceneYamlFileContext & { duration: number }>,\n executedResults: Array<MidsceneYamlFileContext & { duration: number }>,\n notExecutedContexts: Array<{\n file: string;\n player: ScriptPlayer<MidsceneYamlScriptEnv> | null;\n }>,\n ): Promise<void> {\n const limit = pLimit(this.config.concurrent);\n\n if (this.config.continueOnError) {\n // Execute all tasks with concurrency\n const tasks = fileContextList.map((context) =>\n limit(async () => {\n const executedContext = await executeFile(context);\n executedResults.push(executedContext);\n }),\n );\n await Promise.allSettled(tasks);\n } else {\n // Execute with concurrency but stop new tasks when failure occurs\n let shouldStop = false;\n const stopLock = { value: false };\n\n const tasks = fileContextList.map((context) =>\n limit(async () => {\n if (stopLock.value) {\n notExecutedContexts.push({\n file: context.file,\n player: null,\n });\n return;\n }\n\n const executedContext = await executeFile(context);\n executedResults.push(executedContext);\n\n if (executedContext.player.status === 'error' && !stopLock.value) {\n stopLock.value = true;\n shouldStop = true;\n }\n }),\n );\n\n await Promise.allSettled(tasks);\n\n // Handle not executed contexts\n if (shouldStop) {\n for (const context of fileContextList) {\n if (\n !executedResults.some((r) => r.file === context.file) &&\n !notExecutedContexts.some((ctx) => ctx.file === context.file)\n ) {\n notExecutedContexts.push({ file: context.file, player: null });\n }\n }\n }\n }\n }\n\n private async processResults(\n executedContexts: Array<MidsceneYamlFileContext & { duration: number }>,\n notExecutedContexts: Array<{\n file: string;\n player: ScriptPlayer<MidsceneYamlScriptEnv> | null;\n }>,\n ): Promise<MidsceneYamlConfigResult[]> {\n const results: MidsceneYamlConfigResult[] = [];\n\n for (const context of executedContexts) {\n const { file, player, duration } = context;\n results.push(createExecutedYamlResult({ file, player, duration }));\n }\n\n for (const context of notExecutedContexts) {\n results.push(createNotExecutedYamlResult(context.file));\n }\n\n return results;\n }\n\n private async loadFileConfig(file: string): Promise<MidsceneYamlScript> {\n const content = readFileSync(file, 'utf8');\n return parseYamlScript(content, file);\n }\n\n private async generateOutputIndex(): Promise<void> {\n try {\n writeExecutionSummaryFile(this.config.summary, this.results);\n printExecutionFinished();\n } catch (error) {\n console.error('Failed to generate output index:', error);\n }\n }\n}\n\nexport async function runYamlBatch(\n config: BatchRunnerConfig,\n options: RunYamlBatchOptions = {},\n): Promise<MidsceneYamlConfigResult[]> {\n return new YamlBatchExecutor(config).run(options);\n}\n","import { mkdirSync, writeFileSync } from 'node:fs';\nimport { dirname, resolve } from 'node:path';\nimport type { MidsceneYamlConfigResult } from '@midscene/core';\nimport { type BatchRunnerConfig, runYamlBatch } from '../yaml-batch-executor';\n\nexport interface RunYamlBatchInRstestOptions {\n config: BatchRunnerConfig;\n resultFiles: Record<string, string>;\n}\n\nconst writeResultFile = (\n resultFile: string,\n data: MidsceneYamlConfigResult,\n) => {\n mkdirSync(dirname(resultFile), { recursive: true });\n writeFileSync(resultFile, JSON.stringify(data, null, 2));\n};\n\nconst batchFailureMessage = (results: MidsceneYamlConfigResult[]): string => {\n const failed = results.filter((result) => !result.success);\n return failed\n .map((result) => `${result.file}: ${result.error || result.resultType}`)\n .join('\\n');\n};\n\nexport async function runYamlBatchInRstest(\n options: RunYamlBatchInRstestOptions,\n): Promise<MidsceneYamlConfigResult[]> {\n const results = await runYamlBatch(options.config, {\n generateSummary: false,\n printExecutionPlan: false,\n });\n\n for (const result of results) {\n const resultFile =\n options.resultFiles[result.file] ||\n options.resultFiles[resolve(result.file)];\n if (resultFile) {\n writeResultFile(resultFile, result);\n }\n }\n\n if (results.some((result) => !result.success)) {\n throw new Error(batchFailureMessage(results));\n }\n\n return results;\n}\n","import { existsSync, readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport type {\n MidsceneYamlConfigResult,\n MidsceneYamlScript,\n MidsceneYamlScriptAndroidEnv,\n MidsceneYamlScriptEnv,\n MidsceneYamlScriptIOSEnv,\n MidsceneYamlScriptWebEnv,\n ScriptPlayerTaskStatus,\n} from '@midscene/core';\nimport { type ScriptPlayer, parseYamlScript } from '@midscene/core/yaml';\nimport merge from 'lodash.merge';\nimport { createYamlPlayer } from '../create-yaml-player';\n\nexport interface RunYamlCaseGlobalConfig {\n web?: Partial<MidsceneYamlScriptWebEnv>;\n android?: Partial<MidsceneYamlScriptAndroidEnv>;\n ios?: Partial<MidsceneYamlScriptIOSEnv>;\n target?: Partial<MidsceneYamlScriptWebEnv>;\n}\n\nexport interface RunYamlCaseOptions {\n file: string;\n executionConfig?: MidsceneYamlScript;\n globalConfig?: RunYamlCaseGlobalConfig;\n headed?: boolean;\n keepWindow?: boolean;\n}\n\nexport interface RunYamlCaseResult {\n file: string;\n output?: string;\n report?: string | null;\n duration: number;\n}\n\nconst taskErrorMessage = (task: ScriptPlayerTaskStatus): string | undefined => {\n if (task.error?.message) {\n return task.error.message;\n }\n\n if (task.status === 'error') {\n return `Task \"${task.name}\" failed`;\n }\n\n return undefined;\n};\n\nconst cloneJson = <T>(value: T): T => JSON.parse(JSON.stringify(value)) as T;\n\nconst normalizeTargetConfig = (\n config: MidsceneYamlScript | RunYamlCaseGlobalConfig,\n) => {\n if (config.target) {\n config.web = {\n ...config.target,\n ...config.web,\n };\n config.target = undefined;\n }\n};\n\nconst createExecutionConfig = (\n file: string,\n globalConfig: RunYamlCaseGlobalConfig,\n): MidsceneYamlScript => {\n const content = readFileSync(file, 'utf8');\n const fileConfig = cloneJson(parseYamlScript(content, file));\n normalizeTargetConfig(fileConfig);\n\n const clonedGlobalConfig = cloneJson(globalConfig);\n normalizeTargetConfig(clonedGlobalConfig);\n\n return merge(fileConfig, clonedGlobalConfig);\n};\n\nexport const getYamlPlayerFailure = (\n player: ScriptPlayer<MidsceneYamlScriptEnv>,\n): Error | undefined => {\n if (player.errorInSetup) {\n return player.errorInSetup;\n }\n\n const failedMessages =\n player.taskStatusList?.map(taskErrorMessage).filter(Boolean) || [];\n\n if (player.status === 'error' || failedMessages.length > 0) {\n const details = failedMessages.length\n ? failedMessages.join('; ')\n : 'YAML case failed';\n const reportLine = player.reportFile\n ? `\\nReport: ${player.reportFile}`\n : '';\n const outputLine = player.output ? `\\nOutput: ${player.output}` : '';\n return new Error(`${details}${reportLine}${outputLine}`);\n }\n\n return undefined;\n};\n\nexport const createYamlCaseResult = (\n file: string,\n player: ScriptPlayer<MidsceneYamlScriptEnv>,\n duration: number,\n): MidsceneYamlConfigResult => {\n const hasFailedTasks =\n player.taskStatusList?.some((task) => task.status === 'error') ?? false;\n const hasPlayerError = player.status === 'error';\n\n const outputPath =\n player.output && existsSync(player.output) ? player.output : undefined;\n const reportFile = player.reportFile || undefined;\n\n let errorMessage: string | undefined;\n if (player.errorInSetup?.message) {\n errorMessage = player.errorInSetup.message;\n } else if (hasPlayerError || hasFailedTasks) {\n const taskErrors = player.taskStatusList\n ?.filter((task) => task.status === 'error' && task.error?.message)\n .map((task) => task.error!.message);\n if (taskErrors && taskErrors.length > 0) {\n errorMessage = taskErrors.join('; ');\n } else if (hasPlayerError) {\n errorMessage = 'Execution failed';\n } else {\n errorMessage = 'Some tasks failed';\n }\n }\n\n const resultType = hasPlayerError\n ? 'failed'\n : hasFailedTasks\n ? 'partialFailed'\n : 'success';\n\n return {\n file,\n success: resultType === 'success',\n executed: true,\n output: outputPath,\n report: reportFile,\n duration,\n resultType,\n error: errorMessage,\n };\n};\n\nexport const createYamlCaseFailure = (\n result: MidsceneYamlConfigResult,\n): Error => {\n const reportLine = result.report ? `\\nReport: ${result.report}` : '';\n const outputLine = result.output ? `\\nOutput: ${result.output}` : '';\n return new Error(\n `${result.error || 'YAML case failed'}${reportLine}${outputLine}`,\n );\n};\n\nexport async function runYamlCaseResult(\n options: RunYamlCaseOptions,\n): Promise<MidsceneYamlConfigResult> {\n const file = resolve(options.file);\n const startTime = Date.now();\n const executionConfig =\n options.executionConfig ||\n (options.globalConfig\n ? createExecutionConfig(file, options.globalConfig)\n : undefined);\n const player = await createYamlPlayer(file, executionConfig, {\n headed: options.headed,\n keepWindow: options.keepWindow,\n });\n\n await player.run();\n\n return createYamlCaseResult(file, player, Date.now() - startTime);\n}\n\nexport async function runYamlCase(\n options: RunYamlCaseOptions,\n): Promise<RunYamlCaseResult> {\n const result = await runYamlCaseResult(options);\n if (!result.success) {\n throw createYamlCaseFailure(result);\n }\n\n return {\n file: result.file,\n output: result.output || undefined,\n report: result.report,\n duration: result.duration || 0,\n };\n}\n","import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { dirname, resolve } from 'node:path';\nimport type {\n MidsceneYamlConfigAttempt,\n MidsceneYamlConfigResult,\n} from '@midscene/core';\nimport type { test as rstestTest } from '@rstest/core';\nimport type { BatchRunnerConfig } from '../batch-runner';\nimport { runYamlBatchInRstest } from './yaml-batch';\nimport {\n type RunYamlCaseOptions,\n createYamlCaseFailure,\n runYamlCaseResult,\n} from './yaml-case';\n\nexport type RstestTest = typeof rstestTest;\n\nexport interface DefineYamlCaseTestOptions {\n testName: string;\n yamlFile: string;\n resultFile: string;\n caseOptions?: Omit<RunYamlCaseOptions, 'file' | 'headed' | 'keepWindow'>;\n webRuntimeOptions?: Pick<RunYamlCaseOptions, 'headed' | 'keepWindow'>;\n}\n\nexport interface DefineYamlBatchTestOptions {\n testName: string;\n config: BatchRunnerConfig;\n resultFiles: Record<string, string>;\n}\n\nconst errorMessageOf = (error: unknown): string =>\n error instanceof Error ? error.message : String(error);\n\nconst writeResultFile = (\n resultFile: string,\n data: MidsceneYamlConfigResult,\n) => {\n mkdirSync(dirname(resultFile), { recursive: true });\n writeFileSync(resultFile, JSON.stringify(data, null, 2));\n};\n\nconst attemptHistoryFileFor = (resultFile: string): string =>\n `${resultFile}.attempts.json`;\n\nconst readAttemptHistory = (\n resultFile: string,\n): MidsceneYamlConfigAttempt[] => {\n const attemptHistoryFile = attemptHistoryFileFor(resultFile);\n if (!existsSync(attemptHistoryFile)) return [];\n\n return JSON.parse(\n readFileSync(attemptHistoryFile, 'utf8'),\n ) as MidsceneYamlConfigAttempt[];\n};\n\nconst toAttemptResult = (\n result: MidsceneYamlConfigResult,\n attempt: number,\n): MidsceneYamlConfigAttempt => ({\n attempt,\n success: result.success,\n output: result.output,\n report: result.report,\n error: result.error,\n duration: result.duration,\n resultType: result.resultType,\n});\n\nconst appendAttemptHistory = (\n resultFile: string,\n result: MidsceneYamlConfigResult,\n): MidsceneYamlConfigResult => {\n const attempts = readAttemptHistory(resultFile);\n const nextAttempts = [\n ...attempts,\n toAttemptResult(result, attempts.length + 1),\n ];\n\n mkdirSync(dirname(resultFile), { recursive: true });\n writeFileSync(\n attemptHistoryFileFor(resultFile),\n JSON.stringify(nextAttempts, null, 2),\n );\n\n return {\n ...result,\n attempts: nextAttempts,\n };\n};\n\nconst createRuntimeFailureResult = (\n file: string,\n startTime: number,\n error: unknown,\n): MidsceneYamlConfigResult => ({\n file,\n success: false,\n executed: true,\n duration: Date.now() - startTime,\n resultType: 'failed',\n error: errorMessageOf(error),\n});\n\nexport const defineYamlCaseTest = (\n test: RstestTest,\n options: DefineYamlCaseTestOptions,\n) => {\n test(options.testName, async () => {\n const file = resolve(options.yamlFile);\n const startTime = Date.now();\n let result: MidsceneYamlConfigResult | undefined;\n\n try {\n result = await runYamlCaseResult({\n ...options.caseOptions,\n ...options.webRuntimeOptions,\n file,\n });\n result = appendAttemptHistory(options.resultFile, result);\n writeResultFile(options.resultFile, result);\n\n if (!result.success) {\n throw createYamlCaseFailure(result);\n }\n } catch (error) {\n if (!result) {\n const failureResult = appendAttemptHistory(\n options.resultFile,\n createRuntimeFailureResult(file, startTime, error),\n );\n writeResultFile(options.resultFile, failureResult);\n }\n throw error;\n }\n });\n};\n\nexport const defineYamlBatchTest = (\n test: RstestTest,\n options: DefineYamlBatchTestOptions,\n) => {\n test(options.testName, async () => {\n await runYamlBatchInRstest({\n config: options.config,\n resultFiles: options.resultFiles,\n });\n });\n};\n"],"names":["wrapAnsi16","fn","offset","args","code","wrapAnsi256","wrapAnsi16m","rgb","ansi2ansi","n","rgb2rgb","r","g","b","setLazyProperty","object","property","get","Object","value","colorConvert","makeDynamicStyles","wrap","targetSpace","identity","isBackground","styles","sourceSpace","suite","name","assembleStyles","codes","Map","groupName","group","styleName","style","module","ansiStyles","stdoutColor","stderrColor","stringReplaceAll","stringEncaseCRLFWithFirstIndex","isArray","Array","levelMapping","applyOptions","options","Number","Error","colorLevel","ChalkClass","chalkFactory","chalk","arguments_","chalkTag","Chalk","builder","createBuilder","createStyler","usedModels","model","level","styler","bgModel","proto","open","close","parent","openAll","closeAll","self","_styler","_isEmpty","applyStyle","string","lfIndex","template","strings","firstString","parts","i","String","TEMPLATE_REGEX","STYLE_REGEX","STRING_REGEX","ESCAPE_REGEX","ESCAPES","unescape","c","u","bracket","parseInt","parseArguments","results","chunks","matches","chunk","number","m","escape","character","parseStyle","buildStyle","enabled","layer","current","temporary","escapeCharacter","inverse","errMessage","substring","replacer","index","substringLength","endIndex","returnValue","prefix","postfix","gotCR","cssKeywords","reverseKeywords","key","convert","channels","labels","min","Math","max","delta","h","s","l","rdif","gdif","bdif","v","diff","diffc","w","k","y","comparativeDistance","x","reversed","currentClosestDistance","currentClosestKeyword","keyword","distance","z","xyz","a","hsl","t2","t3","val","t1","smin","lmin","sv","hsv","hi","f","p","q","t","vmin","sl","hwb","wh","bl","ratio","cmyk","lab","y2","x2","z2","hr","lch","saturation","ansi","color","mult","rem","integer","match","colorString","char","chroma","grayscale","hue","hcg","pure","mg","apple","gray","conversions","route","models","wrapRaw","wrappedFn","arg0","wrapRounded","result","len","fromModel","routes","routeModels","toModel","buildGraph","graph","deriveBFS","queue","adjacents","adjacent","node","link","from","to","wrapConversion","path","cur","conversion","flag","argv","process","position","terminatorPosition","os","tty","hasFlag","env","forceColor","translateLevel","supportsColor","haveStream","streamIsTTY","osRelease","sign","version","getSupportLevel","stream","__webpack_require__","getter","exports","definition","obj","prop","warnRetryReport","getDebug","notExecutedError","createNotExecutedYamlResult","file","undefined","createExecutedYamlResult","player","duration","hasFailedTasks","task","hasPlayerError","success","resultType","outputPath","existsSync","errorMessage","taskErrors","getExecutionSummary","getResultsByType","sum","getSummaryAbsolutePath","summary","resolve","getMidsceneRunSubDir","toOutputRelativePath","outputDir","filePath","relativePath","relative","toTestStatus","attempt","safeReportNamePart","createRetryReportName","fileName","basename","extname","fileHash","createHash","createRetryAttemptReport","attemptsWithReports","tool","ReportMergingTool","status","errorMessageOf","error","warnRetryReportFailure","message","mkdirSync","createRetryAttemptReportSafely","writeExecutionSummaryFile","indexPath","dirname","executionSummary","indexData","Date","retryReport","writeFileSync","JSON","printExecutionPlan","config","console","printExecutionFinished","printResultArtifacts","printExecutionSummary","summaryPath","successfulFiles","failedFiles","partialFailedFiles","notExecutedFiles","requireFromCliPackage","__dirname","createRequire","join","entry","resolvePackageFromRstestCore","packageName","require","rstestPackageJsonPath","resolveRstestCoreImportPath","DEFAULT_YAML_TEST_TIMEOUT","RSTEST_YAML_BATCH_TEST_MODULE","RSTEST_YAML_BATCH_TEST_NAME","toPosixPath","sep","toImportLiteral","toVirtualModuleId","fileStem","safeFileStem","base","resolveTestName","projectDir","yamlFile","createGeneratedTestContent","testOptions","createGeneratedBatchTestContent","resolveDefaultFrameworkImport","moduleDir","anchorDir","candidates","matched","Boolean","candidate","createRstestYamlProject","resultDir","frameworkImport","rstestCoreImport","testTimeout","rmSync","virtualModules","cases","testName","resultFile","testModule","resultFiles","item","batchTest","formatRunError","collectRunErrors","messages","push","label","formatted","testResult","Set","mapRunErrorsToCases","project","byTestName","errors","add","addAll","matchFileCase","isBatchFile","isBatchTest","fileCase","recordUnreportedCaseFailures","caseErrors","failure","runRstestYamlProject","runRstest","rspack","Promise","pathToFileURL","maxConcurrency","inlineConfig","_config","appendPlugins","runErrors","createCaseOptions","caseOptions","createWebRuntimeOptions","runtimeOptions","readProjectResults","readFileSync","runFrameworkTestConfig","commandOptions","runner","exitCode","Node","Queue","Symbol","pLimit","concurrency","validateConcurrency","activeCount","resumeNext","next","run","function_","enqueue","internalResolve","generator","newConcurrency","queueMicrotask","TypeError","debug","launchServer","dir","server","createServer","resolveReportFileName","yamlReportFileName","cliTestId","yamlTestId","baseName","getReportFileName","buildAgentOptions","yamlAgent","reportFileName","processCacheConfig","createYamlPlayer","script","yamlScript","parseYamlScript","clonedYamlScript","structuredClone","preference","ScriptPlayer","freeFn","webTarget","targetCount","specifiedTargets","localServer","urlToVisit","assert","serverAddress","cdpBrowser","puppeteer","agent","newFreeFn","puppeteerAgentForTarget","cleanFreeFn","bridgeUnsupportedKeys","ignoredKeys","AgentOverChromeBridge","androidTarget","agentFromAdbDevice","iosTarget","agentFromWebDriverAgent","harmonyTarget","agentFromHdcDevice","computerTarget","agentForComputer","interfaceTarget","moduleSpecifier","finalModuleSpecifier","resolvedPath","importedModule","DeviceClass","device","createAgent","isTTY","indent","spinnerInterval","spinnerFrames","currentSpinningFrame","indicatorForStatus","contextInfo","context","filePathToShow","fileNameToPrint","fileStatusText","contextActionText","errorText","outputFile","outputText","reportFile","reportText","agentStatusTip","agentStatusText","mergedText","singleTaskInfo","stepText","actionText","statusText","mergedLine","paddingLines","lines","line","contextTaskListSummary","taskStatusArray","prefixLines","currentLine","suffixText","fileInfo","copyProperty","ignoreNonConfigurable","toDescriptor","fromDescriptor","canCopyProperty","changePrototype","fromPrototype","wrappedToString","withName","fromBody","toStringDescriptor","Function","toStringName","changeToString","newToString","writable","enumerable","configurable","mimicFunction","Reflect","calledFunctions","WeakMap","callCount","functionName","onetime","signals","processOk","kExitEmitter","global","globalThis","ObjectDefineProperty","Emitter","ev","list","signal","ret","SignalExitBase","signalExitWrap","handler","cb","opts","SignalExitFallback","SignalExit","sig","listeners","count","_","listener","og","onExit","load","unload","terminal","restoreCursor","DEFAULT_RENDER_INTERVAL","ESC","CLEAR_LINE","MOVE_CURSOR_ONE_ROW_UP","HIDE_CURSOR","SHOW_CURSOR","SYNC_START","SYNC_END","TTYWindowRenderer","setInterval","clearInterval","type","windowContent","rowCount","getRenderedRowCount","padding","original","callback","contents","columns","content","rows","row","text","stripVTControlCharacters","YamlBatchExecutor","generateSummary","shouldPrintExecutionPlan","keepWindow","headed","fileContextList","browser","sharedPage","fileConfig","needsBrowser","ctx","globalWebConfig","width","defaultViewportWidth","height","defaultViewportHeight","buildChromeArgs","executedResults","notExecutedContexts","isCdp","globalConfig","clonedFileConfig","executionConfig","merge","allFileContexts","ttyRenderer","summaryContents","executeFile","allFileContext","startTime","endTime","executedContext","limit","tasks","shouldStop","stopLock","executedContexts","runYamlBatch","writeResultFile","data","batchFailureMessage","failed","runYamlBatchInRstest","taskErrorMessage","cloneJson","normalizeTargetConfig","createExecutionConfig","clonedGlobalConfig","getYamlPlayerFailure","failedMessages","details","reportLine","outputLine","createYamlCaseResult","createYamlCaseFailure","runYamlCaseResult","runYamlCase","attemptHistoryFileFor","readAttemptHistory","attemptHistoryFile","toAttemptResult","appendAttemptHistory","attempts","nextAttempts","createRuntimeFailureResult","defineYamlCaseTest","test","failureResult","defineYamlBatchTest"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;QAEA,MAAMA,aAAa,CAACC,IAAIC,SAAW,CAAC,GAAGC;gBACtC,MAAMC,OAAOH,MAAME;gBACnB,OAAO,CAAC,OAAO,EAAEC,OAAOF,OAAO,CAAC,CAAC;YAClC;QAEA,MAAMG,cAAc,CAACJ,IAAIC,SAAW,CAAC,GAAGC;gBACvC,MAAMC,OAAOH,MAAME;gBACnB,OAAO,CAAC,OAAO,EAAE,KAAKD,OAAO,GAAG,EAAEE,KAAK,CAAC,CAAC;YAC1C;QAEA,MAAME,cAAc,CAACL,IAAIC,SAAW,CAAC,GAAGC;gBACvC,MAAMI,MAAMN,MAAME;gBAClB,OAAO,CAAC,OAAO,EAAE,KAAKD,OAAO,GAAG,EAAEK,GAAG,CAAC,EAAE,CAAC,CAAC,EAAEA,GAAG,CAAC,EAAE,CAAC,CAAC,EAAEA,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;YAChE;QAEA,MAAMC,YAAYC,CAAAA,IAAKA;QACvB,MAAMC,UAAU,CAACC,GAAGC,GAAGC,IAAM;gBAACF;gBAAGC;gBAAGC;aAAE;QAEtC,MAAMC,kBAAkB,CAACC,QAAQC,UAAUC;YAC1CC,OAAO,cAAc,CAACH,QAAQC,UAAU;gBACvC,KAAK;oBACJ,MAAMG,QAAQF;oBAEdC,OAAO,cAAc,CAACH,QAAQC,U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,MAAM8jB,YAAY9T,KAAK,GAAG;QAC1B,IAAIpG;QAEJ,IAAI;YACFA,SAAS,MAAM4b,kBAAkB;gBAC/B,GAAGxlB,QAAQ,WAAW;gBACtB,GAAGA,QAAQ,iBAAiB;gBAC5B6M;YACF;YACAjD,SAASkc,qBAAqB9lB,QAAQ,UAAU,EAAE4J;YAClD2a,6BAAgBvkB,QAAQ,UAAU,EAAE4J;YAEpC,IAAI,CAACA,OAAO,OAAO,EACjB,MAAM2b,sBAAsB3b;QAEhC,EAAE,OAAO0F,OAAO;YACd,IAAI,CAAC1F,QAAQ;gBACX,MAAMwc,gBAAgBN,qBACpB9lB,QAAQ,UAAU,EAClBimB,2BAA2BpZ,MAAMiX,WAAWxU;gBAE9CiV,6BAAgBvkB,QAAQ,UAAU,EAAEomB;YACtC;YACA,MAAM9W;QACR;IACF;AACF;AAEO,MAAM+W,sBAAsB,CACjCF,MACAnmB;IAEAmmB,KAAKnmB,QAAQ,QAAQ,EAAE;QACrB,MAAM2kB,qBAAqB;YACzB,QAAQ3kB,QAAQ,MAAM;YACtB,aAAaA,QAAQ,WAAW;QAClC;IACF;AACF"}
|
|
1
|
+
{"version":3,"file":"framework/index.mjs","sources":["../../../../../node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js","../../../../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/index.js","../../../../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/templates.js","../../../../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/util.js","../../../../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js","../../../../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js","../../../../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js","../../../../../node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js","../../../../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js","../../../../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js","webpack/runtime/compat_get_default_export","webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/node_module_decorator","../../../src/execution-summary.ts","../../../src/framework/rstest-dependencies.ts","../../../src/framework/rstest-project.ts","../../../src/framework/rstest-runner.ts","../../../src/framework/command.ts","../../../../../node_modules/.pnpm/yocto-queue@1.2.1/node_modules/yocto-queue/index.js","../../../../../node_modules/.pnpm/p-limit@6.2.0/node_modules/p-limit/index.js","../../../src/create-yaml-player.ts","../../../src/printer.ts","../../../../../node_modules/.pnpm/mimic-function@5.0.1/node_modules/mimic-function/index.js","../../../../../node_modules/.pnpm/onetime@7.0.0/node_modules/onetime/index.js","../../../../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js","../../../../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js","../../../../../node_modules/.pnpm/restore-cursor@5.1.0/node_modules/restore-cursor/index.js","../../../src/tty-renderer.ts","../../../src/yaml-batch-executor.ts","../../../src/framework/yaml-batch.ts","../../../src/framework/yaml-case.ts","../../../src/framework/rstest-entry.ts"],"sourcesContent":["'use strict';\n\nconst wrapAnsi16 = (fn, offset) => (...args) => {\n\tconst code = fn(...args);\n\treturn `\\u001B[${code + offset}m`;\n};\n\nconst wrapAnsi256 = (fn, offset) => (...args) => {\n\tconst code = fn(...args);\n\treturn `\\u001B[${38 + offset};5;${code}m`;\n};\n\nconst wrapAnsi16m = (fn, offset) => (...args) => {\n\tconst rgb = fn(...args);\n\treturn `\\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;\n};\n\nconst ansi2ansi = n => n;\nconst rgb2rgb = (r, g, b) => [r, g, b];\n\nconst setLazyProperty = (object, property, get) => {\n\tObject.defineProperty(object, property, {\n\t\tget: () => {\n\t\t\tconst value = get();\n\n\t\t\tObject.defineProperty(object, property, {\n\t\t\t\tvalue,\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true\n\t\t\t});\n\n\t\t\treturn value;\n\t\t},\n\t\tenumerable: true,\n\t\tconfigurable: true\n\t});\n};\n\n/** @type {typeof import('color-convert')} */\nlet colorConvert;\nconst makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {\n\tif (colorConvert === undefined) {\n\t\tcolorConvert = require('color-convert');\n\t}\n\n\tconst offset = isBackground ? 10 : 0;\n\tconst styles = {};\n\n\tfor (const [sourceSpace, suite] of Object.entries(colorConvert)) {\n\t\tconst name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;\n\t\tif (sourceSpace === targetSpace) {\n\t\t\tstyles[name] = wrap(identity, offset);\n\t\t} else if (typeof suite === 'object') {\n\t\t\tstyles[name] = wrap(suite[targetSpace], offset);\n\t\t}\n\t}\n\n\treturn styles;\n};\n\nfunction assembleStyles() {\n\tconst codes = new Map();\n\tconst styles = {\n\t\tmodifier: {\n\t\t\treset: [0, 0],\n\t\t\t// 21 isn't widely supported and 22 does the same thing\n\t\t\tbold: [1, 22],\n\t\t\tdim: [2, 22],\n\t\t\titalic: [3, 23],\n\t\t\tunderline: [4, 24],\n\t\t\tinverse: [7, 27],\n\t\t\thidden: [8, 28],\n\t\t\tstrikethrough: [9, 29]\n\t\t},\n\t\tcolor: {\n\t\t\tblack: [30, 39],\n\t\t\tred: [31, 39],\n\t\t\tgreen: [32, 39],\n\t\t\tyellow: [33, 39],\n\t\t\tblue: [34, 39],\n\t\t\tmagenta: [35, 39],\n\t\t\tcyan: [36, 39],\n\t\t\twhite: [37, 39],\n\n\t\t\t// Bright color\n\t\t\tblackBright: [90, 39],\n\t\t\tredBright: [91, 39],\n\t\t\tgreenBright: [92, 39],\n\t\t\tyellowBright: [93, 39],\n\t\t\tblueBright: [94, 39],\n\t\t\tmagentaBright: [95, 39],\n\t\t\tcyanBright: [96, 39],\n\t\t\twhiteBright: [97, 39]\n\t\t},\n\t\tbgColor: {\n\t\t\tbgBlack: [40, 49],\n\t\t\tbgRed: [41, 49],\n\t\t\tbgGreen: [42, 49],\n\t\t\tbgYellow: [43, 49],\n\t\t\tbgBlue: [44, 49],\n\t\t\tbgMagenta: [45, 49],\n\t\t\tbgCyan: [46, 49],\n\t\t\tbgWhite: [47, 49],\n\n\t\t\t// Bright color\n\t\t\tbgBlackBright: [100, 49],\n\t\t\tbgRedBright: [101, 49],\n\t\t\tbgGreenBright: [102, 49],\n\t\t\tbgYellowBright: [103, 49],\n\t\t\tbgBlueBright: [104, 49],\n\t\t\tbgMagentaBright: [105, 49],\n\t\t\tbgCyanBright: [106, 49],\n\t\t\tbgWhiteBright: [107, 49]\n\t\t}\n\t};\n\n\t// Alias bright black as gray (and grey)\n\tstyles.color.gray = styles.color.blackBright;\n\tstyles.bgColor.bgGray = styles.bgColor.bgBlackBright;\n\tstyles.color.grey = styles.color.blackBright;\n\tstyles.bgColor.bgGrey = styles.bgColor.bgBlackBright;\n\n\tfor (const [groupName, group] of Object.entries(styles)) {\n\t\tfor (const [styleName, style] of Object.entries(group)) {\n\t\t\tstyles[styleName] = {\n\t\t\t\topen: `\\u001B[${style[0]}m`,\n\t\t\t\tclose: `\\u001B[${style[1]}m`\n\t\t\t};\n\n\t\t\tgroup[styleName] = styles[styleName];\n\n\t\t\tcodes.set(style[0], style[1]);\n\t\t}\n\n\t\tObject.defineProperty(styles, groupName, {\n\t\t\tvalue: group,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tObject.defineProperty(styles, 'codes', {\n\t\tvalue: codes,\n\t\tenumerable: false\n\t});\n\n\tstyles.color.close = '\\u001B[39m';\n\tstyles.bgColor.close = '\\u001B[49m';\n\n\tsetLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));\n\tsetLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));\n\tsetLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));\n\tsetLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));\n\tsetLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));\n\tsetLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));\n\n\treturn styles;\n}\n\n// Make the export immutable\nObject.defineProperty(module, 'exports', {\n\tenumerable: true,\n\tget: assembleStyles\n});\n","'use strict';\nconst ansiStyles = require('ansi-styles');\nconst {stdout: stdoutColor, stderr: stderrColor} = require('supports-color');\nconst {\n\tstringReplaceAll,\n\tstringEncaseCRLFWithFirstIndex\n} = require('./util');\n\nconst {isArray} = Array;\n\n// `supportsColor.level` → `ansiStyles.color[name]` mapping\nconst levelMapping = [\n\t'ansi',\n\t'ansi',\n\t'ansi256',\n\t'ansi16m'\n];\n\nconst styles = Object.create(null);\n\nconst applyOptions = (object, options = {}) => {\n\tif (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {\n\t\tthrow new Error('The `level` option should be an integer from 0 to 3');\n\t}\n\n\t// Detect level if not set manually\n\tconst colorLevel = stdoutColor ? stdoutColor.level : 0;\n\tobject.level = options.level === undefined ? colorLevel : options.level;\n};\n\nclass ChalkClass {\n\tconstructor(options) {\n\t\t// eslint-disable-next-line no-constructor-return\n\t\treturn chalkFactory(options);\n\t}\n}\n\nconst chalkFactory = options => {\n\tconst chalk = {};\n\tapplyOptions(chalk, options);\n\n\tchalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_);\n\n\tObject.setPrototypeOf(chalk, Chalk.prototype);\n\tObject.setPrototypeOf(chalk.template, chalk);\n\n\tchalk.template.constructor = () => {\n\t\tthrow new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.');\n\t};\n\n\tchalk.template.Instance = ChalkClass;\n\n\treturn chalk.template;\n};\n\nfunction Chalk(options) {\n\treturn chalkFactory(options);\n}\n\nfor (const [styleName, style] of Object.entries(ansiStyles)) {\n\tstyles[styleName] = {\n\t\tget() {\n\t\t\tconst builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);\n\t\t\tObject.defineProperty(this, styleName, {value: builder});\n\t\t\treturn builder;\n\t\t}\n\t};\n}\n\nstyles.visible = {\n\tget() {\n\t\tconst builder = createBuilder(this, this._styler, true);\n\t\tObject.defineProperty(this, 'visible', {value: builder});\n\t\treturn builder;\n\t}\n};\n\nconst usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256'];\n\nfor (const model of usedModels) {\n\tstyles[model] = {\n\t\tget() {\n\t\t\tconst {level} = this;\n\t\t\treturn function (...arguments_) {\n\t\t\t\tconst styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);\n\t\t\t\treturn createBuilder(this, styler, this._isEmpty);\n\t\t\t};\n\t\t}\n\t};\n}\n\nfor (const model of usedModels) {\n\tconst bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);\n\tstyles[bgModel] = {\n\t\tget() {\n\t\t\tconst {level} = this;\n\t\t\treturn function (...arguments_) {\n\t\t\t\tconst styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);\n\t\t\t\treturn createBuilder(this, styler, this._isEmpty);\n\t\t\t};\n\t\t}\n\t};\n}\n\nconst proto = Object.defineProperties(() => {}, {\n\t...styles,\n\tlevel: {\n\t\tenumerable: true,\n\t\tget() {\n\t\t\treturn this._generator.level;\n\t\t},\n\t\tset(level) {\n\t\t\tthis._generator.level = level;\n\t\t}\n\t}\n});\n\nconst createStyler = (open, close, parent) => {\n\tlet openAll;\n\tlet closeAll;\n\tif (parent === undefined) {\n\t\topenAll = open;\n\t\tcloseAll = close;\n\t} else {\n\t\topenAll = parent.openAll + open;\n\t\tcloseAll = close + parent.closeAll;\n\t}\n\n\treturn {\n\t\topen,\n\t\tclose,\n\t\topenAll,\n\t\tcloseAll,\n\t\tparent\n\t};\n};\n\nconst createBuilder = (self, _styler, _isEmpty) => {\n\tconst builder = (...arguments_) => {\n\t\tif (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {\n\t\t\t// Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}`\n\t\t\treturn applyStyle(builder, chalkTag(builder, ...arguments_));\n\t\t}\n\n\t\t// Single argument is hot path, implicit coercion is faster than anything\n\t\t// eslint-disable-next-line no-implicit-coercion\n\t\treturn applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));\n\t};\n\n\t// We alter the prototype because we must return a function, but there is\n\t// no way to create a function with a different prototype\n\tObject.setPrototypeOf(builder, proto);\n\n\tbuilder._generator = self;\n\tbuilder._styler = _styler;\n\tbuilder._isEmpty = _isEmpty;\n\n\treturn builder;\n};\n\nconst applyStyle = (self, string) => {\n\tif (self.level <= 0 || !string) {\n\t\treturn self._isEmpty ? '' : string;\n\t}\n\n\tlet styler = self._styler;\n\n\tif (styler === undefined) {\n\t\treturn string;\n\t}\n\n\tconst {openAll, closeAll} = styler;\n\tif (string.indexOf('\\u001B') !== -1) {\n\t\twhile (styler !== undefined) {\n\t\t\t// Replace any instances already present with a re-opening code\n\t\t\t// otherwise only the part of the string until said closing code\n\t\t\t// will be colored, and the rest will simply be 'plain'.\n\t\t\tstring = stringReplaceAll(string, styler.close, styler.open);\n\n\t\t\tstyler = styler.parent;\n\t\t}\n\t}\n\n\t// We can move both next actions out of loop, because remaining actions in loop won't have\n\t// any/visible effect on parts we add here. Close the styling before a linebreak and reopen\n\t// after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92\n\tconst lfIndex = string.indexOf('\\n');\n\tif (lfIndex !== -1) {\n\t\tstring = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);\n\t}\n\n\treturn openAll + string + closeAll;\n};\n\nlet template;\nconst chalkTag = (chalk, ...strings) => {\n\tconst [firstString] = strings;\n\n\tif (!isArray(firstString) || !isArray(firstString.raw)) {\n\t\t// If chalk() was called by itself or with a string,\n\t\t// return the string itself as a string.\n\t\treturn strings.join(' ');\n\t}\n\n\tconst arguments_ = strings.slice(1);\n\tconst parts = [firstString.raw[0]];\n\n\tfor (let i = 1; i < firstString.length; i++) {\n\t\tparts.push(\n\t\t\tString(arguments_[i - 1]).replace(/[{}\\\\]/g, '\\\\$&'),\n\t\t\tString(firstString.raw[i])\n\t\t);\n\t}\n\n\tif (template === undefined) {\n\t\ttemplate = require('./templates');\n\t}\n\n\treturn template(chalk, parts.join(''));\n};\n\nObject.defineProperties(Chalk.prototype, styles);\n\nconst chalk = Chalk(); // eslint-disable-line new-cap\nchalk.supportsColor = stdoutColor;\nchalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap\nchalk.stderr.supportsColor = stderrColor;\n\nmodule.exports = chalk;\n","'use strict';\nconst TEMPLATE_REGEX = /(?:\\\\(u(?:[a-f\\d]{4}|\\{[a-f\\d]{1,6}\\})|x[a-f\\d]{2}|.))|(?:\\{(~)?(\\w+(?:\\([^)]*\\))?(?:\\.\\w+(?:\\([^)]*\\))?)*)(?:[ \\t]|(?=\\r?\\n)))|(\\})|((?:.|[\\r\\n\\f])+?)/gi;\nconst STYLE_REGEX = /(?:^|\\.)(\\w+)(?:\\(([^)]*)\\))?/g;\nconst STRING_REGEX = /^(['\"])((?:\\\\.|(?!\\1)[^\\\\])*)\\1$/;\nconst ESCAPE_REGEX = /\\\\(u(?:[a-f\\d]{4}|{[a-f\\d]{1,6}})|x[a-f\\d]{2}|.)|([^\\\\])/gi;\n\nconst ESCAPES = new Map([\n\t['n', '\\n'],\n\t['r', '\\r'],\n\t['t', '\\t'],\n\t['b', '\\b'],\n\t['f', '\\f'],\n\t['v', '\\v'],\n\t['0', '\\0'],\n\t['\\\\', '\\\\'],\n\t['e', '\\u001B'],\n\t['a', '\\u0007']\n]);\n\nfunction unescape(c) {\n\tconst u = c[0] === 'u';\n\tconst bracket = c[1] === '{';\n\n\tif ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) {\n\t\treturn String.fromCharCode(parseInt(c.slice(1), 16));\n\t}\n\n\tif (u && bracket) {\n\t\treturn String.fromCodePoint(parseInt(c.slice(2, -1), 16));\n\t}\n\n\treturn ESCAPES.get(c) || c;\n}\n\nfunction parseArguments(name, arguments_) {\n\tconst results = [];\n\tconst chunks = arguments_.trim().split(/\\s*,\\s*/g);\n\tlet matches;\n\n\tfor (const chunk of chunks) {\n\t\tconst number = Number(chunk);\n\t\tif (!Number.isNaN(number)) {\n\t\t\tresults.push(number);\n\t\t} else if ((matches = chunk.match(STRING_REGEX))) {\n\t\t\tresults.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));\n\t\t} else {\n\t\t\tthrow new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);\n\t\t}\n\t}\n\n\treturn results;\n}\n\nfunction parseStyle(style) {\n\tSTYLE_REGEX.lastIndex = 0;\n\n\tconst results = [];\n\tlet matches;\n\n\twhile ((matches = STYLE_REGEX.exec(style)) !== null) {\n\t\tconst name = matches[1];\n\n\t\tif (matches[2]) {\n\t\t\tconst args = parseArguments(name, matches[2]);\n\t\t\tresults.push([name].concat(args));\n\t\t} else {\n\t\t\tresults.push([name]);\n\t\t}\n\t}\n\n\treturn results;\n}\n\nfunction buildStyle(chalk, styles) {\n\tconst enabled = {};\n\n\tfor (const layer of styles) {\n\t\tfor (const style of layer.styles) {\n\t\t\tenabled[style[0]] = layer.inverse ? null : style.slice(1);\n\t\t}\n\t}\n\n\tlet current = chalk;\n\tfor (const [styleName, styles] of Object.entries(enabled)) {\n\t\tif (!Array.isArray(styles)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!(styleName in current)) {\n\t\t\tthrow new Error(`Unknown Chalk style: ${styleName}`);\n\t\t}\n\n\t\tcurrent = styles.length > 0 ? current[styleName](...styles) : current[styleName];\n\t}\n\n\treturn current;\n}\n\nmodule.exports = (chalk, temporary) => {\n\tconst styles = [];\n\tconst chunks = [];\n\tlet chunk = [];\n\n\t// eslint-disable-next-line max-params\n\ttemporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {\n\t\tif (escapeCharacter) {\n\t\t\tchunk.push(unescape(escapeCharacter));\n\t\t} else if (style) {\n\t\t\tconst string = chunk.join('');\n\t\t\tchunk = [];\n\t\t\tchunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string));\n\t\t\tstyles.push({inverse, styles: parseStyle(style)});\n\t\t} else if (close) {\n\t\t\tif (styles.length === 0) {\n\t\t\t\tthrow new Error('Found extraneous } in Chalk template literal');\n\t\t\t}\n\n\t\t\tchunks.push(buildStyle(chalk, styles)(chunk.join('')));\n\t\t\tchunk = [];\n\t\t\tstyles.pop();\n\t\t} else {\n\t\t\tchunk.push(character);\n\t\t}\n\t});\n\n\tchunks.push(chunk.join(''));\n\n\tif (styles.length > 0) {\n\t\tconst errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\\`}\\`)`;\n\t\tthrow new Error(errMessage);\n\t}\n\n\treturn chunks.join('');\n};\n","'use strict';\n\nconst stringReplaceAll = (string, substring, replacer) => {\n\tlet index = string.indexOf(substring);\n\tif (index === -1) {\n\t\treturn string;\n\t}\n\n\tconst substringLength = substring.length;\n\tlet endIndex = 0;\n\tlet returnValue = '';\n\tdo {\n\t\treturnValue += string.substr(endIndex, index - endIndex) + substring + replacer;\n\t\tendIndex = index + substringLength;\n\t\tindex = string.indexOf(substring, endIndex);\n\t} while (index !== -1);\n\n\treturnValue += string.substr(endIndex);\n\treturn returnValue;\n};\n\nconst stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {\n\tlet endIndex = 0;\n\tlet returnValue = '';\n\tdo {\n\t\tconst gotCR = string[index - 1] === '\\r';\n\t\treturnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\\r\\n' : '\\n') + postfix;\n\t\tendIndex = index + 1;\n\t\tindex = string.indexOf('\\n', endIndex);\n\t} while (index !== -1);\n\n\treturnValue += string.substr(endIndex);\n\treturn returnValue;\n};\n\nmodule.exports = {\n\tstringReplaceAll,\n\tstringEncaseCRLFWithFirstIndex\n};\n","/* MIT license */\n/* eslint-disable no-mixed-operators */\nconst cssKeywords = require('color-name');\n\n// NOTE: conversions should only return primitive values (i.e. arrays, or\n// values that give correct `typeof` results).\n// do not use box values types (i.e. Number(), String(), etc.)\n\nconst reverseKeywords = {};\nfor (const key of Object.keys(cssKeywords)) {\n\treverseKeywords[cssKeywords[key]] = key;\n}\n\nconst convert = {\n\trgb: {channels: 3, labels: 'rgb'},\n\thsl: {channels: 3, labels: 'hsl'},\n\thsv: {channels: 3, labels: 'hsv'},\n\thwb: {channels: 3, labels: 'hwb'},\n\tcmyk: {channels: 4, labels: 'cmyk'},\n\txyz: {channels: 3, labels: 'xyz'},\n\tlab: {channels: 3, labels: 'lab'},\n\tlch: {channels: 3, labels: 'lch'},\n\thex: {channels: 1, labels: ['hex']},\n\tkeyword: {channels: 1, labels: ['keyword']},\n\tansi16: {channels: 1, labels: ['ansi16']},\n\tansi256: {channels: 1, labels: ['ansi256']},\n\thcg: {channels: 3, labels: ['h', 'c', 'g']},\n\tapple: {channels: 3, labels: ['r16', 'g16', 'b16']},\n\tgray: {channels: 1, labels: ['gray']}\n};\n\nmodule.exports = convert;\n\n// Hide .channels and .labels properties\nfor (const model of Object.keys(convert)) {\n\tif (!('channels' in convert[model])) {\n\t\tthrow new Error('missing channels property: ' + model);\n\t}\n\n\tif (!('labels' in convert[model])) {\n\t\tthrow new Error('missing channel labels property: ' + model);\n\t}\n\n\tif (convert[model].labels.length !== convert[model].channels) {\n\t\tthrow new Error('channel and label counts mismatch: ' + model);\n\t}\n\n\tconst {channels, labels} = convert[model];\n\tdelete convert[model].channels;\n\tdelete convert[model].labels;\n\tObject.defineProperty(convert[model], 'channels', {value: channels});\n\tObject.defineProperty(convert[model], 'labels', {value: labels});\n}\n\nconvert.rgb.hsl = function (rgb) {\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\tconst min = Math.min(r, g, b);\n\tconst max = Math.max(r, g, b);\n\tconst delta = max - min;\n\tlet h;\n\tlet s;\n\n\tif (max === min) {\n\t\th = 0;\n\t} else if (r === max) {\n\t\th = (g - b) / delta;\n\t} else if (g === max) {\n\t\th = 2 + (b - r) / delta;\n\t} else if (b === max) {\n\t\th = 4 + (r - g) / delta;\n\t}\n\n\th = Math.min(h * 60, 360);\n\n\tif (h < 0) {\n\t\th += 360;\n\t}\n\n\tconst l = (min + max) / 2;\n\n\tif (max === min) {\n\t\ts = 0;\n\t} else if (l <= 0.5) {\n\t\ts = delta / (max + min);\n\t} else {\n\t\ts = delta / (2 - max - min);\n\t}\n\n\treturn [h, s * 100, l * 100];\n};\n\nconvert.rgb.hsv = function (rgb) {\n\tlet rdif;\n\tlet gdif;\n\tlet bdif;\n\tlet h;\n\tlet s;\n\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\tconst v = Math.max(r, g, b);\n\tconst diff = v - Math.min(r, g, b);\n\tconst diffc = function (c) {\n\t\treturn (v - c) / 6 / diff + 1 / 2;\n\t};\n\n\tif (diff === 0) {\n\t\th = 0;\n\t\ts = 0;\n\t} else {\n\t\ts = diff / v;\n\t\trdif = diffc(r);\n\t\tgdif = diffc(g);\n\t\tbdif = diffc(b);\n\n\t\tif (r === v) {\n\t\t\th = bdif - gdif;\n\t\t} else if (g === v) {\n\t\t\th = (1 / 3) + rdif - bdif;\n\t\t} else if (b === v) {\n\t\t\th = (2 / 3) + gdif - rdif;\n\t\t}\n\n\t\tif (h < 0) {\n\t\t\th += 1;\n\t\t} else if (h > 1) {\n\t\t\th -= 1;\n\t\t}\n\t}\n\n\treturn [\n\t\th * 360,\n\t\ts * 100,\n\t\tv * 100\n\t];\n};\n\nconvert.rgb.hwb = function (rgb) {\n\tconst r = rgb[0];\n\tconst g = rgb[1];\n\tlet b = rgb[2];\n\tconst h = convert.rgb.hsl(rgb)[0];\n\tconst w = 1 / 255 * Math.min(r, Math.min(g, b));\n\n\tb = 1 - 1 / 255 * Math.max(r, Math.max(g, b));\n\n\treturn [h, w * 100, b * 100];\n};\n\nconvert.rgb.cmyk = function (rgb) {\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\n\tconst k = Math.min(1 - r, 1 - g, 1 - b);\n\tconst c = (1 - r - k) / (1 - k) || 0;\n\tconst m = (1 - g - k) / (1 - k) || 0;\n\tconst y = (1 - b - k) / (1 - k) || 0;\n\n\treturn [c * 100, m * 100, y * 100, k * 100];\n};\n\nfunction comparativeDistance(x, y) {\n\t/*\n\t\tSee https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance\n\t*/\n\treturn (\n\t\t((x[0] - y[0]) ** 2) +\n\t\t((x[1] - y[1]) ** 2) +\n\t\t((x[2] - y[2]) ** 2)\n\t);\n}\n\nconvert.rgb.keyword = function (rgb) {\n\tconst reversed = reverseKeywords[rgb];\n\tif (reversed) {\n\t\treturn reversed;\n\t}\n\n\tlet currentClosestDistance = Infinity;\n\tlet currentClosestKeyword;\n\n\tfor (const keyword of Object.keys(cssKeywords)) {\n\t\tconst value = cssKeywords[keyword];\n\n\t\t// Compute comparative distance\n\t\tconst distance = comparativeDistance(rgb, value);\n\n\t\t// Check if its less, if so set as closest\n\t\tif (distance < currentClosestDistance) {\n\t\t\tcurrentClosestDistance = distance;\n\t\t\tcurrentClosestKeyword = keyword;\n\t\t}\n\t}\n\n\treturn currentClosestKeyword;\n};\n\nconvert.keyword.rgb = function (keyword) {\n\treturn cssKeywords[keyword];\n};\n\nconvert.rgb.xyz = function (rgb) {\n\tlet r = rgb[0] / 255;\n\tlet g = rgb[1] / 255;\n\tlet b = rgb[2] / 255;\n\n\t// Assume sRGB\n\tr = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);\n\tg = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);\n\tb = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);\n\n\tconst x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);\n\tconst y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);\n\tconst z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);\n\n\treturn [x * 100, y * 100, z * 100];\n};\n\nconvert.rgb.lab = function (rgb) {\n\tconst xyz = convert.rgb.xyz(rgb);\n\tlet x = xyz[0];\n\tlet y = xyz[1];\n\tlet z = xyz[2];\n\n\tx /= 95.047;\n\ty /= 100;\n\tz /= 108.883;\n\n\tx = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);\n\ty = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);\n\tz = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);\n\n\tconst l = (116 * y) - 16;\n\tconst a = 500 * (x - y);\n\tconst b = 200 * (y - z);\n\n\treturn [l, a, b];\n};\n\nconvert.hsl.rgb = function (hsl) {\n\tconst h = hsl[0] / 360;\n\tconst s = hsl[1] / 100;\n\tconst l = hsl[2] / 100;\n\tlet t2;\n\tlet t3;\n\tlet val;\n\n\tif (s === 0) {\n\t\tval = l * 255;\n\t\treturn [val, val, val];\n\t}\n\n\tif (l < 0.5) {\n\t\tt2 = l * (1 + s);\n\t} else {\n\t\tt2 = l + s - l * s;\n\t}\n\n\tconst t1 = 2 * l - t2;\n\n\tconst rgb = [0, 0, 0];\n\tfor (let i = 0; i < 3; i++) {\n\t\tt3 = h + 1 / 3 * -(i - 1);\n\t\tif (t3 < 0) {\n\t\t\tt3++;\n\t\t}\n\n\t\tif (t3 > 1) {\n\t\t\tt3--;\n\t\t}\n\n\t\tif (6 * t3 < 1) {\n\t\t\tval = t1 + (t2 - t1) * 6 * t3;\n\t\t} else if (2 * t3 < 1) {\n\t\t\tval = t2;\n\t\t} else if (3 * t3 < 2) {\n\t\t\tval = t1 + (t2 - t1) * (2 / 3 - t3) * 6;\n\t\t} else {\n\t\t\tval = t1;\n\t\t}\n\n\t\trgb[i] = val * 255;\n\t}\n\n\treturn rgb;\n};\n\nconvert.hsl.hsv = function (hsl) {\n\tconst h = hsl[0];\n\tlet s = hsl[1] / 100;\n\tlet l = hsl[2] / 100;\n\tlet smin = s;\n\tconst lmin = Math.max(l, 0.01);\n\n\tl *= 2;\n\ts *= (l <= 1) ? l : 2 - l;\n\tsmin *= lmin <= 1 ? lmin : 2 - lmin;\n\tconst v = (l + s) / 2;\n\tconst sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);\n\n\treturn [h, sv * 100, v * 100];\n};\n\nconvert.hsv.rgb = function (hsv) {\n\tconst h = hsv[0] / 60;\n\tconst s = hsv[1] / 100;\n\tlet v = hsv[2] / 100;\n\tconst hi = Math.floor(h) % 6;\n\n\tconst f = h - Math.floor(h);\n\tconst p = 255 * v * (1 - s);\n\tconst q = 255 * v * (1 - (s * f));\n\tconst t = 255 * v * (1 - (s * (1 - f)));\n\tv *= 255;\n\n\tswitch (hi) {\n\t\tcase 0:\n\t\t\treturn [v, t, p];\n\t\tcase 1:\n\t\t\treturn [q, v, p];\n\t\tcase 2:\n\t\t\treturn [p, v, t];\n\t\tcase 3:\n\t\t\treturn [p, q, v];\n\t\tcase 4:\n\t\t\treturn [t, p, v];\n\t\tcase 5:\n\t\t\treturn [v, p, q];\n\t}\n};\n\nconvert.hsv.hsl = function (hsv) {\n\tconst h = hsv[0];\n\tconst s = hsv[1] / 100;\n\tconst v = hsv[2] / 100;\n\tconst vmin = Math.max(v, 0.01);\n\tlet sl;\n\tlet l;\n\n\tl = (2 - s) * v;\n\tconst lmin = (2 - s) * vmin;\n\tsl = s * vmin;\n\tsl /= (lmin <= 1) ? lmin : 2 - lmin;\n\tsl = sl || 0;\n\tl /= 2;\n\n\treturn [h, sl * 100, l * 100];\n};\n\n// http://dev.w3.org/csswg/css-color/#hwb-to-rgb\nconvert.hwb.rgb = function (hwb) {\n\tconst h = hwb[0] / 360;\n\tlet wh = hwb[1] / 100;\n\tlet bl = hwb[2] / 100;\n\tconst ratio = wh + bl;\n\tlet f;\n\n\t// Wh + bl cant be > 1\n\tif (ratio > 1) {\n\t\twh /= ratio;\n\t\tbl /= ratio;\n\t}\n\n\tconst i = Math.floor(6 * h);\n\tconst v = 1 - bl;\n\tf = 6 * h - i;\n\n\tif ((i & 0x01) !== 0) {\n\t\tf = 1 - f;\n\t}\n\n\tconst n = wh + f * (v - wh); // Linear interpolation\n\n\tlet r;\n\tlet g;\n\tlet b;\n\t/* eslint-disable max-statements-per-line,no-multi-spaces */\n\tswitch (i) {\n\t\tdefault:\n\t\tcase 6:\n\t\tcase 0: r = v; g = n; b = wh; break;\n\t\tcase 1: r = n; g = v; b = wh; break;\n\t\tcase 2: r = wh; g = v; b = n; break;\n\t\tcase 3: r = wh; g = n; b = v; break;\n\t\tcase 4: r = n; g = wh; b = v; break;\n\t\tcase 5: r = v; g = wh; b = n; break;\n\t}\n\t/* eslint-enable max-statements-per-line,no-multi-spaces */\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.cmyk.rgb = function (cmyk) {\n\tconst c = cmyk[0] / 100;\n\tconst m = cmyk[1] / 100;\n\tconst y = cmyk[2] / 100;\n\tconst k = cmyk[3] / 100;\n\n\tconst r = 1 - Math.min(1, c * (1 - k) + k);\n\tconst g = 1 - Math.min(1, m * (1 - k) + k);\n\tconst b = 1 - Math.min(1, y * (1 - k) + k);\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.xyz.rgb = function (xyz) {\n\tconst x = xyz[0] / 100;\n\tconst y = xyz[1] / 100;\n\tconst z = xyz[2] / 100;\n\tlet r;\n\tlet g;\n\tlet b;\n\n\tr = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);\n\tg = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);\n\tb = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);\n\n\t// Assume sRGB\n\tr = r > 0.0031308\n\t\t? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)\n\t\t: r * 12.92;\n\n\tg = g > 0.0031308\n\t\t? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)\n\t\t: g * 12.92;\n\n\tb = b > 0.0031308\n\t\t? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)\n\t\t: b * 12.92;\n\n\tr = Math.min(Math.max(0, r), 1);\n\tg = Math.min(Math.max(0, g), 1);\n\tb = Math.min(Math.max(0, b), 1);\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.xyz.lab = function (xyz) {\n\tlet x = xyz[0];\n\tlet y = xyz[1];\n\tlet z = xyz[2];\n\n\tx /= 95.047;\n\ty /= 100;\n\tz /= 108.883;\n\n\tx = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);\n\ty = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);\n\tz = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);\n\n\tconst l = (116 * y) - 16;\n\tconst a = 500 * (x - y);\n\tconst b = 200 * (y - z);\n\n\treturn [l, a, b];\n};\n\nconvert.lab.xyz = function (lab) {\n\tconst l = lab[0];\n\tconst a = lab[1];\n\tconst b = lab[2];\n\tlet x;\n\tlet y;\n\tlet z;\n\n\ty = (l + 16) / 116;\n\tx = a / 500 + y;\n\tz = y - b / 200;\n\n\tconst y2 = y ** 3;\n\tconst x2 = x ** 3;\n\tconst z2 = z ** 3;\n\ty = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;\n\tx = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;\n\tz = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;\n\n\tx *= 95.047;\n\ty *= 100;\n\tz *= 108.883;\n\n\treturn [x, y, z];\n};\n\nconvert.lab.lch = function (lab) {\n\tconst l = lab[0];\n\tconst a = lab[1];\n\tconst b = lab[2];\n\tlet h;\n\n\tconst hr = Math.atan2(b, a);\n\th = hr * 360 / 2 / Math.PI;\n\n\tif (h < 0) {\n\t\th += 360;\n\t}\n\n\tconst c = Math.sqrt(a * a + b * b);\n\n\treturn [l, c, h];\n};\n\nconvert.lch.lab = function (lch) {\n\tconst l = lch[0];\n\tconst c = lch[1];\n\tconst h = lch[2];\n\n\tconst hr = h / 360 * 2 * Math.PI;\n\tconst a = c * Math.cos(hr);\n\tconst b = c * Math.sin(hr);\n\n\treturn [l, a, b];\n};\n\nconvert.rgb.ansi16 = function (args, saturation = null) {\n\tconst [r, g, b] = args;\n\tlet value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization\n\n\tvalue = Math.round(value / 50);\n\n\tif (value === 0) {\n\t\treturn 30;\n\t}\n\n\tlet ansi = 30\n\t\t+ ((Math.round(b / 255) << 2)\n\t\t| (Math.round(g / 255) << 1)\n\t\t| Math.round(r / 255));\n\n\tif (value === 2) {\n\t\tansi += 60;\n\t}\n\n\treturn ansi;\n};\n\nconvert.hsv.ansi16 = function (args) {\n\t// Optimization here; we already know the value and don't need to get\n\t// it converted for us.\n\treturn convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);\n};\n\nconvert.rgb.ansi256 = function (args) {\n\tconst r = args[0];\n\tconst g = args[1];\n\tconst b = args[2];\n\n\t// We use the extended greyscale palette here, with the exception of\n\t// black and white. normal palette only has 4 greyscale shades.\n\tif (r === g && g === b) {\n\t\tif (r < 8) {\n\t\t\treturn 16;\n\t\t}\n\n\t\tif (r > 248) {\n\t\t\treturn 231;\n\t\t}\n\n\t\treturn Math.round(((r - 8) / 247) * 24) + 232;\n\t}\n\n\tconst ansi = 16\n\t\t+ (36 * Math.round(r / 255 * 5))\n\t\t+ (6 * Math.round(g / 255 * 5))\n\t\t+ Math.round(b / 255 * 5);\n\n\treturn ansi;\n};\n\nconvert.ansi16.rgb = function (args) {\n\tlet color = args % 10;\n\n\t// Handle greyscale\n\tif (color === 0 || color === 7) {\n\t\tif (args > 50) {\n\t\t\tcolor += 3.5;\n\t\t}\n\n\t\tcolor = color / 10.5 * 255;\n\n\t\treturn [color, color, color];\n\t}\n\n\tconst mult = (~~(args > 50) + 1) * 0.5;\n\tconst r = ((color & 1) * mult) * 255;\n\tconst g = (((color >> 1) & 1) * mult) * 255;\n\tconst b = (((color >> 2) & 1) * mult) * 255;\n\n\treturn [r, g, b];\n};\n\nconvert.ansi256.rgb = function (args) {\n\t// Handle greyscale\n\tif (args >= 232) {\n\t\tconst c = (args - 232) * 10 + 8;\n\t\treturn [c, c, c];\n\t}\n\n\targs -= 16;\n\n\tlet rem;\n\tconst r = Math.floor(args / 36) / 5 * 255;\n\tconst g = Math.floor((rem = args % 36) / 6) / 5 * 255;\n\tconst b = (rem % 6) / 5 * 255;\n\n\treturn [r, g, b];\n};\n\nconvert.rgb.hex = function (args) {\n\tconst integer = ((Math.round(args[0]) & 0xFF) << 16)\n\t\t+ ((Math.round(args[1]) & 0xFF) << 8)\n\t\t+ (Math.round(args[2]) & 0xFF);\n\n\tconst string = integer.toString(16).toUpperCase();\n\treturn '000000'.substring(string.length) + string;\n};\n\nconvert.hex.rgb = function (args) {\n\tconst match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);\n\tif (!match) {\n\t\treturn [0, 0, 0];\n\t}\n\n\tlet colorString = match[0];\n\n\tif (match[0].length === 3) {\n\t\tcolorString = colorString.split('').map(char => {\n\t\t\treturn char + char;\n\t\t}).join('');\n\t}\n\n\tconst integer = parseInt(colorString, 16);\n\tconst r = (integer >> 16) & 0xFF;\n\tconst g = (integer >> 8) & 0xFF;\n\tconst b = integer & 0xFF;\n\n\treturn [r, g, b];\n};\n\nconvert.rgb.hcg = function (rgb) {\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\tconst max = Math.max(Math.max(r, g), b);\n\tconst min = Math.min(Math.min(r, g), b);\n\tconst chroma = (max - min);\n\tlet grayscale;\n\tlet hue;\n\n\tif (chroma < 1) {\n\t\tgrayscale = min / (1 - chroma);\n\t} else {\n\t\tgrayscale = 0;\n\t}\n\n\tif (chroma <= 0) {\n\t\thue = 0;\n\t} else\n\tif (max === r) {\n\t\thue = ((g - b) / chroma) % 6;\n\t} else\n\tif (max === g) {\n\t\thue = 2 + (b - r) / chroma;\n\t} else {\n\t\thue = 4 + (r - g) / chroma;\n\t}\n\n\thue /= 6;\n\thue %= 1;\n\n\treturn [hue * 360, chroma * 100, grayscale * 100];\n};\n\nconvert.hsl.hcg = function (hsl) {\n\tconst s = hsl[1] / 100;\n\tconst l = hsl[2] / 100;\n\n\tconst c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));\n\n\tlet f = 0;\n\tif (c < 1.0) {\n\t\tf = (l - 0.5 * c) / (1.0 - c);\n\t}\n\n\treturn [hsl[0], c * 100, f * 100];\n};\n\nconvert.hsv.hcg = function (hsv) {\n\tconst s = hsv[1] / 100;\n\tconst v = hsv[2] / 100;\n\n\tconst c = s * v;\n\tlet f = 0;\n\n\tif (c < 1.0) {\n\t\tf = (v - c) / (1 - c);\n\t}\n\n\treturn [hsv[0], c * 100, f * 100];\n};\n\nconvert.hcg.rgb = function (hcg) {\n\tconst h = hcg[0] / 360;\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\n\tif (c === 0.0) {\n\t\treturn [g * 255, g * 255, g * 255];\n\t}\n\n\tconst pure = [0, 0, 0];\n\tconst hi = (h % 1) * 6;\n\tconst v = hi % 1;\n\tconst w = 1 - v;\n\tlet mg = 0;\n\n\t/* eslint-disable max-statements-per-line */\n\tswitch (Math.floor(hi)) {\n\t\tcase 0:\n\t\t\tpure[0] = 1; pure[1] = v; pure[2] = 0; break;\n\t\tcase 1:\n\t\t\tpure[0] = w; pure[1] = 1; pure[2] = 0; break;\n\t\tcase 2:\n\t\t\tpure[0] = 0; pure[1] = 1; pure[2] = v; break;\n\t\tcase 3:\n\t\t\tpure[0] = 0; pure[1] = w; pure[2] = 1; break;\n\t\tcase 4:\n\t\t\tpure[0] = v; pure[1] = 0; pure[2] = 1; break;\n\t\tdefault:\n\t\t\tpure[0] = 1; pure[1] = 0; pure[2] = w;\n\t}\n\t/* eslint-enable max-statements-per-line */\n\n\tmg = (1.0 - c) * g;\n\n\treturn [\n\t\t(c * pure[0] + mg) * 255,\n\t\t(c * pure[1] + mg) * 255,\n\t\t(c * pure[2] + mg) * 255\n\t];\n};\n\nconvert.hcg.hsv = function (hcg) {\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\n\tconst v = c + g * (1.0 - c);\n\tlet f = 0;\n\n\tif (v > 0.0) {\n\t\tf = c / v;\n\t}\n\n\treturn [hcg[0], f * 100, v * 100];\n};\n\nconvert.hcg.hsl = function (hcg) {\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\n\tconst l = g * (1.0 - c) + 0.5 * c;\n\tlet s = 0;\n\n\tif (l > 0.0 && l < 0.5) {\n\t\ts = c / (2 * l);\n\t} else\n\tif (l >= 0.5 && l < 1.0) {\n\t\ts = c / (2 * (1 - l));\n\t}\n\n\treturn [hcg[0], s * 100, l * 100];\n};\n\nconvert.hcg.hwb = function (hcg) {\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\tconst v = c + g * (1.0 - c);\n\treturn [hcg[0], (v - c) * 100, (1 - v) * 100];\n};\n\nconvert.hwb.hcg = function (hwb) {\n\tconst w = hwb[1] / 100;\n\tconst b = hwb[2] / 100;\n\tconst v = 1 - b;\n\tconst c = v - w;\n\tlet g = 0;\n\n\tif (c < 1) {\n\t\tg = (v - c) / (1 - c);\n\t}\n\n\treturn [hwb[0], c * 100, g * 100];\n};\n\nconvert.apple.rgb = function (apple) {\n\treturn [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];\n};\n\nconvert.rgb.apple = function (rgb) {\n\treturn [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];\n};\n\nconvert.gray.rgb = function (args) {\n\treturn [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];\n};\n\nconvert.gray.hsl = function (args) {\n\treturn [0, 0, args[0]];\n};\n\nconvert.gray.hsv = convert.gray.hsl;\n\nconvert.gray.hwb = function (gray) {\n\treturn [0, 100, gray[0]];\n};\n\nconvert.gray.cmyk = function (gray) {\n\treturn [0, 0, 0, gray[0]];\n};\n\nconvert.gray.lab = function (gray) {\n\treturn [gray[0], 0, 0];\n};\n\nconvert.gray.hex = function (gray) {\n\tconst val = Math.round(gray[0] / 100 * 255) & 0xFF;\n\tconst integer = (val << 16) + (val << 8) + val;\n\n\tconst string = integer.toString(16).toUpperCase();\n\treturn '000000'.substring(string.length) + string;\n};\n\nconvert.rgb.gray = function (rgb) {\n\tconst val = (rgb[0] + rgb[1] + rgb[2]) / 3;\n\treturn [val / 255 * 100];\n};\n","const conversions = require('./conversions');\nconst route = require('./route');\n\nconst convert = {};\n\nconst models = Object.keys(conversions);\n\nfunction wrapRaw(fn) {\n\tconst wrappedFn = function (...args) {\n\t\tconst arg0 = args[0];\n\t\tif (arg0 === undefined || arg0 === null) {\n\t\t\treturn arg0;\n\t\t}\n\n\t\tif (arg0.length > 1) {\n\t\t\targs = arg0;\n\t\t}\n\n\t\treturn fn(args);\n\t};\n\n\t// Preserve .conversion property if there is one\n\tif ('conversion' in fn) {\n\t\twrappedFn.conversion = fn.conversion;\n\t}\n\n\treturn wrappedFn;\n}\n\nfunction wrapRounded(fn) {\n\tconst wrappedFn = function (...args) {\n\t\tconst arg0 = args[0];\n\n\t\tif (arg0 === undefined || arg0 === null) {\n\t\t\treturn arg0;\n\t\t}\n\n\t\tif (arg0.length > 1) {\n\t\t\targs = arg0;\n\t\t}\n\n\t\tconst result = fn(args);\n\n\t\t// We're assuming the result is an array here.\n\t\t// see notice in conversions.js; don't use box types\n\t\t// in conversion functions.\n\t\tif (typeof result === 'object') {\n\t\t\tfor (let len = result.length, i = 0; i < len; i++) {\n\t\t\t\tresult[i] = Math.round(result[i]);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t};\n\n\t// Preserve .conversion property if there is one\n\tif ('conversion' in fn) {\n\t\twrappedFn.conversion = fn.conversion;\n\t}\n\n\treturn wrappedFn;\n}\n\nmodels.forEach(fromModel => {\n\tconvert[fromModel] = {};\n\n\tObject.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});\n\tObject.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});\n\n\tconst routes = route(fromModel);\n\tconst routeModels = Object.keys(routes);\n\n\trouteModels.forEach(toModel => {\n\t\tconst fn = routes[toModel];\n\n\t\tconvert[fromModel][toModel] = wrapRounded(fn);\n\t\tconvert[fromModel][toModel].raw = wrapRaw(fn);\n\t});\n});\n\nmodule.exports = convert;\n","const conversions = require('./conversions');\n\n/*\n\tThis function routes a model to all other models.\n\n\tall functions that are routed have a property `.conversion` attached\n\tto the returned synthetic function. This property is an array\n\tof strings, each with the steps in between the 'from' and 'to'\n\tcolor models (inclusive).\n\n\tconversions that are not possible simply are not included.\n*/\n\nfunction buildGraph() {\n\tconst graph = {};\n\t// https://jsperf.com/object-keys-vs-for-in-with-closure/3\n\tconst models = Object.keys(conversions);\n\n\tfor (let len = models.length, i = 0; i < len; i++) {\n\t\tgraph[models[i]] = {\n\t\t\t// http://jsperf.com/1-vs-infinity\n\t\t\t// micro-opt, but this is simple.\n\t\t\tdistance: -1,\n\t\t\tparent: null\n\t\t};\n\t}\n\n\treturn graph;\n}\n\n// https://en.wikipedia.org/wiki/Breadth-first_search\nfunction deriveBFS(fromModel) {\n\tconst graph = buildGraph();\n\tconst queue = [fromModel]; // Unshift -> queue -> pop\n\n\tgraph[fromModel].distance = 0;\n\n\twhile (queue.length) {\n\t\tconst current = queue.pop();\n\t\tconst adjacents = Object.keys(conversions[current]);\n\n\t\tfor (let len = adjacents.length, i = 0; i < len; i++) {\n\t\t\tconst adjacent = adjacents[i];\n\t\t\tconst node = graph[adjacent];\n\n\t\t\tif (node.distance === -1) {\n\t\t\t\tnode.distance = graph[current].distance + 1;\n\t\t\t\tnode.parent = current;\n\t\t\t\tqueue.unshift(adjacent);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn graph;\n}\n\nfunction link(from, to) {\n\treturn function (args) {\n\t\treturn to(from(args));\n\t};\n}\n\nfunction wrapConversion(toModel, graph) {\n\tconst path = [graph[toModel].parent, toModel];\n\tlet fn = conversions[graph[toModel].parent][toModel];\n\n\tlet cur = graph[toModel].parent;\n\twhile (graph[cur].parent) {\n\t\tpath.unshift(graph[cur].parent);\n\t\tfn = link(conversions[graph[cur].parent][cur], fn);\n\t\tcur = graph[cur].parent;\n\t}\n\n\tfn.conversion = path;\n\treturn fn;\n}\n\nmodule.exports = function (fromModel) {\n\tconst graph = deriveBFS(fromModel);\n\tconst conversion = {};\n\n\tconst models = Object.keys(graph);\n\tfor (let len = models.length, i = 0; i < len; i++) {\n\t\tconst toModel = models[i];\n\t\tconst node = graph[toModel];\n\n\t\tif (node.parent === null) {\n\t\t\t// No possible conversion, or this node is the source model.\n\t\t\tcontinue;\n\t\t}\n\n\t\tconversion[toModel] = wrapConversion(toModel, graph);\n\t}\n\n\treturn conversion;\n};\n\n","'use strict'\r\n\r\nmodule.exports = {\r\n\t\"aliceblue\": [240, 248, 255],\r\n\t\"antiquewhite\": [250, 235, 215],\r\n\t\"aqua\": [0, 255, 255],\r\n\t\"aquamarine\": [127, 255, 212],\r\n\t\"azure\": [240, 255, 255],\r\n\t\"beige\": [245, 245, 220],\r\n\t\"bisque\": [255, 228, 196],\r\n\t\"black\": [0, 0, 0],\r\n\t\"blanchedalmond\": [255, 235, 205],\r\n\t\"blue\": [0, 0, 255],\r\n\t\"blueviolet\": [138, 43, 226],\r\n\t\"brown\": [165, 42, 42],\r\n\t\"burlywood\": [222, 184, 135],\r\n\t\"cadetblue\": [95, 158, 160],\r\n\t\"chartreuse\": [127, 255, 0],\r\n\t\"chocolate\": [210, 105, 30],\r\n\t\"coral\": [255, 127, 80],\r\n\t\"cornflowerblue\": [100, 149, 237],\r\n\t\"cornsilk\": [255, 248, 220],\r\n\t\"crimson\": [220, 20, 60],\r\n\t\"cyan\": [0, 255, 255],\r\n\t\"darkblue\": [0, 0, 139],\r\n\t\"darkcyan\": [0, 139, 139],\r\n\t\"darkgoldenrod\": [184, 134, 11],\r\n\t\"darkgray\": [169, 169, 169],\r\n\t\"darkgreen\": [0, 100, 0],\r\n\t\"darkgrey\": [169, 169, 169],\r\n\t\"darkkhaki\": [189, 183, 107],\r\n\t\"darkmagenta\": [139, 0, 139],\r\n\t\"darkolivegreen\": [85, 107, 47],\r\n\t\"darkorange\": [255, 140, 0],\r\n\t\"darkorchid\": [153, 50, 204],\r\n\t\"darkred\": [139, 0, 0],\r\n\t\"darksalmon\": [233, 150, 122],\r\n\t\"darkseagreen\": [143, 188, 143],\r\n\t\"darkslateblue\": [72, 61, 139],\r\n\t\"darkslategray\": [47, 79, 79],\r\n\t\"darkslategrey\": [47, 79, 79],\r\n\t\"darkturquoise\": [0, 206, 209],\r\n\t\"darkviolet\": [148, 0, 211],\r\n\t\"deeppink\": [255, 20, 147],\r\n\t\"deepskyblue\": [0, 191, 255],\r\n\t\"dimgray\": [105, 105, 105],\r\n\t\"dimgrey\": [105, 105, 105],\r\n\t\"dodgerblue\": [30, 144, 255],\r\n\t\"firebrick\": [178, 34, 34],\r\n\t\"floralwhite\": [255, 250, 240],\r\n\t\"forestgreen\": [34, 139, 34],\r\n\t\"fuchsia\": [255, 0, 255],\r\n\t\"gainsboro\": [220, 220, 220],\r\n\t\"ghostwhite\": [248, 248, 255],\r\n\t\"gold\": [255, 215, 0],\r\n\t\"goldenrod\": [218, 165, 32],\r\n\t\"gray\": [128, 128, 128],\r\n\t\"green\": [0, 128, 0],\r\n\t\"greenyellow\": [173, 255, 47],\r\n\t\"grey\": [128, 128, 128],\r\n\t\"honeydew\": [240, 255, 240],\r\n\t\"hotpink\": [255, 105, 180],\r\n\t\"indianred\": [205, 92, 92],\r\n\t\"indigo\": [75, 0, 130],\r\n\t\"ivory\": [255, 255, 240],\r\n\t\"khaki\": [240, 230, 140],\r\n\t\"lavender\": [230, 230, 250],\r\n\t\"lavenderblush\": [255, 240, 245],\r\n\t\"lawngreen\": [124, 252, 0],\r\n\t\"lemonchiffon\": [255, 250, 205],\r\n\t\"lightblue\": [173, 216, 230],\r\n\t\"lightcoral\": [240, 128, 128],\r\n\t\"lightcyan\": [224, 255, 255],\r\n\t\"lightgoldenrodyellow\": [250, 250, 210],\r\n\t\"lightgray\": [211, 211, 211],\r\n\t\"lightgreen\": [144, 238, 144],\r\n\t\"lightgrey\": [211, 211, 211],\r\n\t\"lightpink\": [255, 182, 193],\r\n\t\"lightsalmon\": [255, 160, 122],\r\n\t\"lightseagreen\": [32, 178, 170],\r\n\t\"lightskyblue\": [135, 206, 250],\r\n\t\"lightslategray\": [119, 136, 153],\r\n\t\"lightslategrey\": [119, 136, 153],\r\n\t\"lightsteelblue\": [176, 196, 222],\r\n\t\"lightyellow\": [255, 255, 224],\r\n\t\"lime\": [0, 255, 0],\r\n\t\"limegreen\": [50, 205, 50],\r\n\t\"linen\": [250, 240, 230],\r\n\t\"magenta\": [255, 0, 255],\r\n\t\"maroon\": [128, 0, 0],\r\n\t\"mediumaquamarine\": [102, 205, 170],\r\n\t\"mediumblue\": [0, 0, 205],\r\n\t\"mediumorchid\": [186, 85, 211],\r\n\t\"mediumpurple\": [147, 112, 219],\r\n\t\"mediumseagreen\": [60, 179, 113],\r\n\t\"mediumslateblue\": [123, 104, 238],\r\n\t\"mediumspringgreen\": [0, 250, 154],\r\n\t\"mediumturquoise\": [72, 209, 204],\r\n\t\"mediumvioletred\": [199, 21, 133],\r\n\t\"midnightblue\": [25, 25, 112],\r\n\t\"mintcream\": [245, 255, 250],\r\n\t\"mistyrose\": [255, 228, 225],\r\n\t\"moccasin\": [255, 228, 181],\r\n\t\"navajowhite\": [255, 222, 173],\r\n\t\"navy\": [0, 0, 128],\r\n\t\"oldlace\": [253, 245, 230],\r\n\t\"olive\": [128, 128, 0],\r\n\t\"olivedrab\": [107, 142, 35],\r\n\t\"orange\": [255, 165, 0],\r\n\t\"orangered\": [255, 69, 0],\r\n\t\"orchid\": [218, 112, 214],\r\n\t\"palegoldenrod\": [238, 232, 170],\r\n\t\"palegreen\": [152, 251, 152],\r\n\t\"paleturquoise\": [175, 238, 238],\r\n\t\"palevioletred\": [219, 112, 147],\r\n\t\"papayawhip\": [255, 239, 213],\r\n\t\"peachpuff\": [255, 218, 185],\r\n\t\"peru\": [205, 133, 63],\r\n\t\"pink\": [255, 192, 203],\r\n\t\"plum\": [221, 160, 221],\r\n\t\"powderblue\": [176, 224, 230],\r\n\t\"purple\": [128, 0, 128],\r\n\t\"rebeccapurple\": [102, 51, 153],\r\n\t\"red\": [255, 0, 0],\r\n\t\"rosybrown\": [188, 143, 143],\r\n\t\"royalblue\": [65, 105, 225],\r\n\t\"saddlebrown\": [139, 69, 19],\r\n\t\"salmon\": [250, 128, 114],\r\n\t\"sandybrown\": [244, 164, 96],\r\n\t\"seagreen\": [46, 139, 87],\r\n\t\"seashell\": [255, 245, 238],\r\n\t\"sienna\": [160, 82, 45],\r\n\t\"silver\": [192, 192, 192],\r\n\t\"skyblue\": [135, 206, 235],\r\n\t\"slateblue\": [106, 90, 205],\r\n\t\"slategray\": [112, 128, 144],\r\n\t\"slategrey\": [112, 128, 144],\r\n\t\"snow\": [255, 250, 250],\r\n\t\"springgreen\": [0, 255, 127],\r\n\t\"steelblue\": [70, 130, 180],\r\n\t\"tan\": [210, 180, 140],\r\n\t\"teal\": [0, 128, 128],\r\n\t\"thistle\": [216, 191, 216],\r\n\t\"tomato\": [255, 99, 71],\r\n\t\"turquoise\": [64, 224, 208],\r\n\t\"violet\": [238, 130, 238],\r\n\t\"wheat\": [245, 222, 179],\r\n\t\"white\": [255, 255, 255],\r\n\t\"whitesmoke\": [245, 245, 245],\r\n\t\"yellow\": [255, 255, 0],\r\n\t\"yellowgreen\": [154, 205, 50]\r\n};\r\n","'use strict';\n\nmodule.exports = (flag, argv = process.argv) => {\n\tconst prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');\n\tconst position = argv.indexOf(prefix + flag);\n\tconst terminatorPosition = argv.indexOf('--');\n\treturn position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);\n};\n","'use strict';\nconst os = require('os');\nconst tty = require('tty');\nconst hasFlag = require('has-flag');\n\nconst {env} = process;\n\nlet forceColor;\nif (hasFlag('no-color') ||\n\thasFlag('no-colors') ||\n\thasFlag('color=false') ||\n\thasFlag('color=never')) {\n\tforceColor = 0;\n} else if (hasFlag('color') ||\n\thasFlag('colors') ||\n\thasFlag('color=true') ||\n\thasFlag('color=always')) {\n\tforceColor = 1;\n}\n\nif ('FORCE_COLOR' in env) {\n\tif (env.FORCE_COLOR === 'true') {\n\t\tforceColor = 1;\n\t} else if (env.FORCE_COLOR === 'false') {\n\t\tforceColor = 0;\n\t} else {\n\t\tforceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);\n\t}\n}\n\nfunction translateLevel(level) {\n\tif (level === 0) {\n\t\treturn false;\n\t}\n\n\treturn {\n\t\tlevel,\n\t\thasBasic: true,\n\t\thas256: level >= 2,\n\t\thas16m: level >= 3\n\t};\n}\n\nfunction supportsColor(haveStream, streamIsTTY) {\n\tif (forceColor === 0) {\n\t\treturn 0;\n\t}\n\n\tif (hasFlag('color=16m') ||\n\t\thasFlag('color=full') ||\n\t\thasFlag('color=truecolor')) {\n\t\treturn 3;\n\t}\n\n\tif (hasFlag('color=256')) {\n\t\treturn 2;\n\t}\n\n\tif (haveStream && !streamIsTTY && forceColor === undefined) {\n\t\treturn 0;\n\t}\n\n\tconst min = forceColor || 0;\n\n\tif (env.TERM === 'dumb') {\n\t\treturn min;\n\t}\n\n\tif (process.platform === 'win32') {\n\t\t// Windows 10 build 10586 is the first Windows release that supports 256 colors.\n\t\t// Windows 10 build 14931 is the first release that supports 16m/TrueColor.\n\t\tconst osRelease = os.release().split('.');\n\t\tif (\n\t\t\tNumber(osRelease[0]) >= 10 &&\n\t\t\tNumber(osRelease[2]) >= 10586\n\t\t) {\n\t\t\treturn Number(osRelease[2]) >= 14931 ? 3 : 2;\n\t\t}\n\n\t\treturn 1;\n\t}\n\n\tif ('CI' in env) {\n\t\tif (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {\n\t\t\treturn 1;\n\t\t}\n\n\t\treturn min;\n\t}\n\n\tif ('TEAMCITY_VERSION' in env) {\n\t\treturn /^(9\\.(0*[1-9]\\d*)\\.|\\d{2,}\\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;\n\t}\n\n\tif (env.COLORTERM === 'truecolor') {\n\t\treturn 3;\n\t}\n\n\tif ('TERM_PROGRAM' in env) {\n\t\tconst version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);\n\n\t\tswitch (env.TERM_PROGRAM) {\n\t\t\tcase 'iTerm.app':\n\t\t\t\treturn version >= 3 ? 3 : 2;\n\t\t\tcase 'Apple_Terminal':\n\t\t\t\treturn 2;\n\t\t\t// No default\n\t\t}\n\t}\n\n\tif (/-256(color)?$/i.test(env.TERM)) {\n\t\treturn 2;\n\t}\n\n\tif (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {\n\t\treturn 1;\n\t}\n\n\tif ('COLORTERM' in env) {\n\t\treturn 1;\n\t}\n\n\treturn min;\n}\n\nfunction getSupportLevel(stream) {\n\tconst level = supportsColor(stream, stream && stream.isTTY);\n\treturn translateLevel(level);\n}\n\nmodule.exports = {\n\tsupportsColor: getSupportLevel,\n\tstdout: translateLevel(supportsColor(true, tty.isatty(1))),\n\tstderr: translateLevel(supportsColor(true, tty.isatty(2)))\n};\n","// getDefaultExport function for compatibility with non-ESM modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};\n","__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","__webpack_require__.nmd = (module) => {\n module.paths = [];\n if (!module.children) module.children = [];\n return module;\n};","import { createHash } from 'node:crypto';\nimport { existsSync, mkdirSync, writeFileSync } from 'node:fs';\nimport { basename, dirname, extname, relative, resolve } from 'node:path';\nimport type {\n MidsceneYamlConfigAttempt,\n MidsceneYamlConfigResult,\n MidsceneYamlScriptEnv,\n TestStatus,\n} from '@midscene/core';\nimport { ReportMergingTool } from '@midscene/core';\nimport type { ScriptPlayer } from '@midscene/core/yaml';\nimport { getMidsceneRunSubDir } from '@midscene/shared/common';\nimport { getDebug } from '@midscene/shared/logger';\n\nconst warnRetryReport = getDebug('execution-summary', { console: true });\n\nexport interface ExecutionPlanConfig {\n files: string[];\n concurrent: number;\n continueOnError: boolean;\n retry?: number;\n summary: string;\n shareBrowserContext?: boolean;\n headed: boolean;\n keepWindow: boolean;\n}\n\nexport interface ExecutionSummary {\n total: number;\n successful: number;\n failed: number;\n partialFailed: number;\n notExecuted: number;\n totalDuration: number;\n}\n\ntype ResultType = MidsceneYamlConfigResult['resultType'];\n\nexport const notExecutedError = 'Not executed (previous task failed)';\n\nexport function createNotExecutedYamlResult(\n file: string,\n): MidsceneYamlConfigResult {\n return {\n file,\n success: false,\n executed: false,\n output: undefined,\n report: undefined,\n duration: 0,\n resultType: 'notExecuted',\n error: notExecutedError,\n };\n}\n\nexport function createExecutedYamlResult(options: {\n file: string;\n player: ScriptPlayer<MidsceneYamlScriptEnv>;\n duration: number;\n}): MidsceneYamlConfigResult {\n const { file, player, duration } = options;\n const hasFailedTasks =\n player.taskStatusList?.some((task) => task.status === 'error') ?? false;\n const hasPlayerError = player.status === 'error';\n\n let success: boolean;\n let resultType: 'success' | 'failed' | 'partialFailed';\n\n if (hasPlayerError) {\n success = false;\n resultType = 'failed';\n } else if (hasFailedTasks) {\n success = false;\n resultType = 'partialFailed';\n } else {\n success = true;\n resultType = 'success';\n }\n\n let outputPath: string | undefined = player.output || undefined;\n if (outputPath && !existsSync(outputPath)) {\n outputPath = undefined;\n }\n\n let errorMessage: string | undefined;\n if (player.errorInSetup?.message) {\n errorMessage = player.errorInSetup.message;\n } else if (hasPlayerError || hasFailedTasks) {\n const taskErrors = player.taskStatusList\n ?.filter((task) => task.status === 'error' && task.error?.message)\n .map((task) => task.error!.message);\n if (taskErrors && taskErrors.length > 0) {\n errorMessage = taskErrors.join('; ');\n } else if (hasPlayerError) {\n errorMessage = 'Execution failed';\n } else {\n errorMessage = 'Some tasks failed';\n }\n }\n\n return {\n file,\n success,\n executed: true,\n output: outputPath,\n report: player.reportFile || undefined,\n duration,\n resultType,\n error: errorMessage,\n };\n}\n\nexport function getExecutionSummary(\n results: MidsceneYamlConfigResult[],\n): ExecutionSummary {\n return {\n total: results.length,\n successful: getResultsByType(results, 'success').length,\n failed: getResultsByType(results, 'failed').length,\n partialFailed: getResultsByType(results, 'partialFailed').length,\n notExecuted: getResultsByType(results, 'notExecuted').length,\n totalDuration: results.reduce((sum, r) => sum + (r.duration || 0), 0),\n };\n}\n\nexport function getResultsByType(\n results: MidsceneYamlConfigResult[],\n resultType: ResultType,\n): MidsceneYamlConfigResult[] {\n return results.filter((result) => result.resultType === resultType);\n}\n\nexport function getResultFilesByType(\n results: MidsceneYamlConfigResult[],\n resultType: ResultType,\n): string[] {\n return getResultsByType(results, resultType).map((result) => result.file);\n}\n\nexport function getSummaryAbsolutePath(summary: string): string {\n return resolve(getMidsceneRunSubDir('output'), summary);\n}\n\nconst toOutputRelativePath = (outputDir: string, filePath: string): string => {\n const relativePath = relative(outputDir, filePath);\n return relativePath.startsWith('.') ? relativePath : `./${relativePath}`;\n};\n\nconst toTestStatus = (\n attempt: Pick<MidsceneYamlConfigAttempt, 'success' | 'resultType'>,\n): TestStatus => {\n if (attempt.success) return 'passed';\n if (attempt.resultType === 'notExecuted') return 'skipped';\n return 'failed';\n};\n\nconst safeReportNamePart = (value: string): string =>\n value.replace(/[:*?\"<>|# ]/g, '-');\n\nconst createRetryReportName = (file: string): string => {\n const fileName = basename(file, extname(file)) || 'yaml';\n const fileHash = createHash('sha1')\n .update(resolve(file))\n .digest('hex')\n .slice(0, 8);\n return `${safeReportNamePart(fileName)}-${fileHash}-retry-attempts`;\n};\n\nconst createRetryAttemptReport = (\n result: MidsceneYamlConfigResult,\n): string | undefined => {\n const attemptsWithReports = result.attempts?.filter(\n (attempt) => attempt.report && existsSync(attempt.report),\n );\n if (!attemptsWithReports || attemptsWithReports.length <= 1) {\n return undefined;\n }\n\n const tool = new ReportMergingTool();\n for (const attempt of attemptsWithReports) {\n const status = toTestStatus(attempt);\n tool.append({\n reportFilePath: attempt.report!,\n reportAttributes: {\n testDuration: attempt.duration ?? 0,\n testStatus: status,\n testTitle: `Attempt ${attempt.attempt}: ${status} - ${basename(result.file)}`,\n testId: `${safeReportNamePart(basename(result.file))}-attempt-${attempt.attempt}`,\n testDescription:\n attempt.error ??\n (attempt.success ? 'YAML attempt passed' : 'YAML attempt failed'),\n },\n });\n }\n\n return (\n tool.mergeReports(createRetryReportName(result.file), {\n outputDir: getMidsceneRunSubDir('report'),\n overwrite: true,\n }) || undefined\n );\n};\n\nconst errorMessageOf = (error: unknown): string =>\n error instanceof Error ? error.message : String(error);\n\nconst warnRetryReportFailure = (message: string): void => {\n try {\n mkdirSync(getMidsceneRunSubDir('log'), { recursive: true });\n warnRetryReport(message);\n } catch {\n // Summary output is more important than warning output.\n }\n};\n\nconst createRetryAttemptReportSafely = (\n result: MidsceneYamlConfigResult,\n): { report?: string; failed: boolean } => {\n try {\n return {\n report: createRetryAttemptReport(result),\n failed: false,\n };\n } catch (error) {\n warnRetryReportFailure(\n `Failed to merge retry attempt report for ${result.file}: ${errorMessageOf(\n error,\n )}`,\n );\n return { failed: true };\n }\n};\n\nexport function writeExecutionSummaryFile(\n summary: string,\n results: MidsceneYamlConfigResult[],\n): string {\n const indexPath = getSummaryAbsolutePath(summary);\n const outputDir = dirname(indexPath);\n mkdirSync(outputDir, { recursive: true });\n\n const executionSummary = getExecutionSummary(results);\n const indexData = {\n summary: {\n ...executionSummary,\n generatedAt: new Date().toLocaleString(),\n },\n results: results.map((result) => {\n const retryReport = createRetryAttemptReportSafely(result);\n\n return {\n script: relative(outputDir, result.file),\n success: result.success,\n resultType: result.resultType,\n output: result.output\n ? toOutputRelativePath(outputDir, result.output)\n : undefined,\n report: result.report ? relative(outputDir, result.report) : undefined,\n retryReport: retryReport.report\n ? relative(outputDir, retryReport.report)\n : !retryReport.failed && result.retryReport\n ? relative(outputDir, result.retryReport)\n : undefined,\n attempts: result.attempts?.map((attempt) => ({\n attempt: attempt.attempt,\n success: attempt.success,\n resultType: attempt.resultType,\n output: attempt.output\n ? toOutputRelativePath(outputDir, attempt.output)\n : undefined,\n report: attempt.report\n ? relative(outputDir, attempt.report)\n : undefined,\n error: attempt.error,\n duration: attempt.duration,\n })),\n error: result.error,\n duration: result.duration,\n };\n }),\n };\n\n writeFileSync(indexPath, JSON.stringify(indexData, null, 2));\n return indexPath;\n}\n\nexport function printExecutionPlan(config: ExecutionPlanConfig): void {\n console.log(' Scripts:');\n for (const file of config.files) {\n console.log(` - ${file}`);\n }\n console.log('📋 Execution plan');\n console.log(` Concurrency: ${config.concurrent}`);\n console.log(` Keep window: ${config.keepWindow}`);\n console.log(` Headed: ${config.headed}`);\n console.log(` Continue on error: ${config.continueOnError}`);\n console.log(` Retry: ${config.retry ?? 0}`);\n console.log(\n ` Share browser context: ${config.shareBrowserContext ?? false}`,\n );\n console.log(` Summary output: ${config.summary}`);\n}\n\nexport function printExecutionFinished(): void {\n console.log('Execution finished:');\n}\n\nconst printResultArtifacts = (result: MidsceneYamlConfigResult): void => {\n if (result.report) {\n console.log(` Report: ${result.report}`);\n }\n if (result.output) {\n console.log(` Output: ${result.output}`);\n }\n};\n\nexport function printExecutionSummary(\n results: MidsceneYamlConfigResult[],\n summaryPath: string,\n): boolean {\n const summary = getExecutionSummary(results);\n const successfulFiles = getResultsByType(results, 'success');\n const failedFiles = getResultsByType(results, 'failed');\n const partialFailedFiles = getResultsByType(results, 'partialFailed');\n const notExecutedFiles = getResultsByType(results, 'notExecuted');\n const success =\n summary.failed === 0 &&\n summary.partialFailed === 0 &&\n summary.notExecuted === 0;\n\n console.log('\\n📊 Execution Summary:');\n console.log(` Total files: ${summary.total}`);\n console.log(` Successful: ${summary.successful}`);\n console.log(` Failed: ${summary.failed}`);\n console.log(` Partial failed: ${summary.partialFailed}`);\n console.log(` Not executed: ${summary.notExecuted}`);\n console.log(` Duration: ${(summary.totalDuration / 1000).toFixed(2)}s`);\n console.log(` Summary: ${summaryPath}`);\n\n if (successfulFiles.length > 0) {\n console.log('\\n✅ Successful files:');\n successfulFiles.forEach((result) => {\n console.log(` ${result.file}`);\n printResultArtifacts(result);\n });\n }\n\n if (failedFiles.length > 0) {\n console.log('\\n❌ Failed files');\n failedFiles.forEach((result) => {\n console.log(` ${result.file}`);\n if (result.error) {\n console.log(` Error: ${result.error}`);\n }\n });\n }\n\n if (partialFailedFiles.length > 0) {\n console.log(\n '\\n⚠️ Partial failed files (some tasks failed with continueOnError)',\n );\n partialFailedFiles.forEach((result) => {\n console.log(` ${result.file}`);\n if (result.error) {\n console.log(` Error: ${result.error}`);\n }\n });\n }\n\n if (notExecutedFiles.length > 0) {\n console.log('\\n⏸️ Not executed files');\n notExecutedFiles.forEach((result) => {\n console.log(` ${result.file}`);\n });\n }\n\n if (success) {\n console.log('\\n🎉 All files executed successfully!');\n } else {\n console.log('\\n⚠️ Some files failed or were not executed.');\n }\n\n return success;\n}\n","import { createRequire } from 'node:module';\nimport { join, resolve } from 'node:path';\n\n// `@rstest/core` and `@rsbuild/core` are direct dependencies of `@midscene/cli`,\n// so they always sit on the resolution path of the CLI's own files. Anchor the\n// lookup to this module's location (`__dirname` of the bundled output) rather\n// than `process.argv[1]`: the command-line entry can be a wrapper script, a\n// symlinked bin, an `npx` cache path, or some other launcher whose `node_modules`\n// chain does not include `@rstest/core`. Anchoring on `process.argv[1]` is what\n// caused YAML runs to fail with \"Cannot find module '@rstest/core/package.json'\"\n// in environments where the launcher differs from the install location.\nconst requireFromCliPackage = () => {\n if (typeof __dirname !== 'undefined') {\n return createRequire(join(__dirname, 'index.js'));\n }\n // ESM consumers of the bundled output have no `__dirname`; fall back to the\n // command-line entry so programmatic usage keeps working.\n const entry = process.argv[1]\n ? resolve(process.argv[1])\n : join(process.cwd(), 'midscene-cli.js');\n return createRequire(entry);\n};\n\nexport const resolvePackageFromRstestCore = (packageName: string): string => {\n const require = requireFromCliPackage();\n const rstestPackageJsonPath = require.resolve('@rstest/core/package.json');\n return createRequire(rstestPackageJsonPath).resolve(packageName);\n};\n\nexport function resolveRstestCoreImportPath(): string {\n const require = requireFromCliPackage();\n return require.resolve('@rstest/core');\n}\n","import { existsSync, mkdirSync, rmSync } from 'node:fs';\nimport {\n basename,\n dirname,\n extname,\n join,\n relative,\n resolve,\n sep,\n} from 'node:path';\nimport { getMidsceneRunSubDir } from '@midscene/shared/common';\nimport type { BatchRunnerConfig } from '../batch-runner';\nimport { resolveRstestCoreImportPath } from './rstest-dependencies';\nimport type { RunYamlCaseOptions } from './yaml-case';\n\nexport type RstestYamlCaseOptions = Omit<\n RunYamlCaseOptions,\n 'file' | 'headed' | 'keepWindow'\n>;\n\nexport type WebYamlRuntimeOptions = Pick<\n RunYamlCaseOptions,\n 'headed' | 'keepWindow'\n>;\n\nexport const DEFAULT_YAML_TEST_TIMEOUT = 0;\nexport const RSTEST_YAML_BATCH_TEST_MODULE =\n 'virtual:midscene-yaml/batch.test.ts';\nexport const RSTEST_YAML_BATCH_TEST_NAME = 'midscene yaml batch';\n\nexport interface CreateRstestYamlProjectOptions {\n files: string[];\n projectDir?: string;\n outputDir?: string;\n resultDir?: string;\n frameworkImport?: string;\n caseOptions?: Record<string, RstestYamlCaseOptions>;\n webRuntimeOptions?: Record<string, WebYamlRuntimeOptions>;\n maxConcurrency?: number;\n testTimeout?: number;\n bail?: number;\n retry?: number;\n batchConfig?: BatchRunnerConfig;\n rstestCoreImport?: string;\n}\n\nexport interface GeneratedYamlTestCase {\n yamlFile: string;\n testModule: string;\n resultFile: string;\n testName: string;\n}\n\nexport interface GeneratedYamlBatchTest {\n testModule: string;\n testName: string;\n}\n\nexport interface GeneratedRstestYamlProject {\n projectDir: string;\n outputDir: string;\n resultDir: string;\n include: string[];\n virtualModules: Record<string, string>;\n cases: GeneratedYamlTestCase[];\n batchTest?: GeneratedYamlBatchTest;\n maxConcurrency?: number;\n testTimeout: number;\n bail?: number;\n retry?: number;\n}\n\nconst toPosixPath = (value: string): string => value.split(sep).join('/');\n\nconst toImportLiteral = (value: string): string =>\n JSON.stringify(toPosixPath(value));\n\nconst toVirtualModuleId = (fileStem: string): string =>\n `virtual:midscene-yaml/${fileStem}.test.ts`;\n\nconst safeFileStem = (file: string, index: number): string => {\n const base = basename(file, extname(file))\n .replace(/[^a-zA-Z0-9._-]+/g, '-')\n .replace(/^-+|-+$/g, '');\n return `${String(index + 1).padStart(3, '0')}-${base || 'case'}`;\n};\n\nexport const resolveTestName = (\n projectDir: string,\n yamlFile: string,\n): string => {\n const relativePath = relative(projectDir, yamlFile);\n return toPosixPath(relativePath.startsWith('..') ? yamlFile : relativePath);\n};\n\nconst createGeneratedTestContent = (options: {\n rstestCoreImport: string;\n frameworkImport: string;\n yamlFile: string;\n resultFile: string;\n testName: string;\n caseOptions?: RstestYamlCaseOptions;\n webRuntimeOptions?: WebYamlRuntimeOptions;\n}): string => {\n const testOptions = {\n testName: options.testName,\n yamlFile: options.yamlFile,\n resultFile: options.resultFile,\n ...(options.caseOptions ? { caseOptions: options.caseOptions } : {}),\n ...(options.webRuntimeOptions\n ? { webRuntimeOptions: options.webRuntimeOptions }\n : {}),\n };\n\n return `import { test } from ${toImportLiteral(options.rstestCoreImport)};\nimport { defineYamlCaseTest } from ${toImportLiteral(options.frameworkImport)};\n\nconst testOptions = ${JSON.stringify(testOptions, null, 2)};\n\ndefineYamlCaseTest(test, testOptions);\n`;\n};\n\nconst createGeneratedBatchTestContent = (options: {\n rstestCoreImport: string;\n frameworkImport: string;\n testName: string;\n config: BatchRunnerConfig;\n resultFiles: Record<string, string>;\n}): string => {\n const testOptions = {\n testName: options.testName,\n config: options.config,\n resultFiles: options.resultFiles,\n };\n\n return `import { test } from ${toImportLiteral(options.rstestCoreImport)};\nimport { defineYamlBatchTest } from ${toImportLiteral(options.frameworkImport)};\n\nconst testOptions = ${JSON.stringify(testOptions, null, 2)};\n\ndefineYamlBatchTest(test, testOptions);\n`;\n};\n\n// Anchor the framework entry on this bundle's own directory rather than\n// `process.argv[1]`. The command-line entry can be a `.bin` symlink, an\n// `npx` cache path, or a wrapper script whose directory does not lead to the\n// compiled `framework/index.js`. In those cases the argv-based lookup below\n// falls through to the bare specifier `@midscene/cli/dist/lib/framework/\n// index.js`, which the generated virtual test module then fails to resolve\n// from the user's CWD (\"Cannot find module ...\"), silently turning every run\n// into \"not executed\". `__dirname` always points at the installed CLI output\n// (this mirrors `requireFromCliPackage` in rstest-runner.ts). Resolve to an\n// absolute path so the virtual module imports it regardless of CWD.\n// `moduleDir` is injectable so tests can exercise the resolution order without\n// depending on the dist layout.\nexport const resolveDefaultFrameworkImport = (moduleDir?: string): string => {\n const anchorDir =\n moduleDir ?? (typeof __dirname !== 'undefined' ? __dirname : undefined);\n const candidates = [\n anchorDir ? join(anchorDir, 'framework', 'index.js') : '',\n ];\n\n const entry = process.argv[1] ? resolve(process.argv[1]) : '';\n if (entry) {\n candidates.push(join(dirname(entry), 'framework', 'index.js'));\n candidates.push(\n join(dirname(entry), '..', 'dist', 'lib', 'framework', 'index.js'),\n );\n }\n\n const matched = candidates\n .filter(Boolean)\n .find((candidate) => existsSync(candidate));\n return matched || '@midscene/cli/dist/lib/framework/index.js';\n};\n\nexport function createRstestYamlProject(\n options: CreateRstestYamlProjectOptions,\n): GeneratedRstestYamlProject {\n const projectDir = resolve(options.projectDir || process.cwd());\n const outputDir =\n options.outputDir ||\n join(getMidsceneRunSubDir('tmp'), `rstest-yaml-${Date.now()}`);\n const resultDir = options.resultDir || join(outputDir, 'results');\n const frameworkImport =\n options.frameworkImport || resolveDefaultFrameworkImport();\n const rstestCoreImport =\n options.rstestCoreImport || resolveRstestCoreImportPath();\n const testTimeout = options.testTimeout ?? DEFAULT_YAML_TEST_TIMEOUT;\n\n rmSync(outputDir, { recursive: true, force: true });\n mkdirSync(resultDir, { recursive: true });\n\n const virtualModules: Record<string, string> = {};\n const cases = options.files.map((file, index) => {\n const yamlFile = resolve(file);\n const testName = resolveTestName(projectDir, yamlFile);\n const fileStem = safeFileStem(yamlFile, index);\n const resultFile = join(resultDir, `${fileStem}.json`);\n const testModule = toVirtualModuleId(fileStem);\n virtualModules[testModule] = createGeneratedTestContent({\n rstestCoreImport,\n frameworkImport,\n yamlFile,\n resultFile,\n testName,\n caseOptions: options.caseOptions?.[yamlFile],\n webRuntimeOptions: options.webRuntimeOptions?.[yamlFile],\n });\n return { yamlFile, testModule, resultFile, testName };\n });\n\n if (options.batchConfig) {\n const resultFiles = Object.fromEntries(\n cases.map((item) => [item.yamlFile, item.resultFile]),\n );\n const batchTest = {\n testModule: RSTEST_YAML_BATCH_TEST_MODULE,\n testName: RSTEST_YAML_BATCH_TEST_NAME,\n };\n return {\n projectDir,\n outputDir,\n resultDir,\n include: [batchTest.testModule],\n virtualModules: {\n [batchTest.testModule]: createGeneratedBatchTestContent({\n rstestCoreImport,\n frameworkImport,\n testName: batchTest.testName,\n config: options.batchConfig,\n resultFiles,\n }),\n },\n cases,\n batchTest,\n maxConcurrency: 1,\n testTimeout,\n bail: options.bail,\n };\n }\n\n return {\n projectDir,\n outputDir,\n resultDir,\n include: cases.map((item) => item.testModule),\n virtualModules,\n cases,\n maxConcurrency: options.maxConcurrency,\n testTimeout,\n bail: options.bail,\n retry: options.retry,\n };\n}\n","import { existsSync, mkdirSync, writeFileSync } from 'node:fs';\nimport { dirname, resolve } from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport type { MidsceneYamlConfigResult } from '@midscene/core';\nimport type { RstestUserConfig, TestRunResult } from '@rstest/core/api';\nimport { resolvePackageFromRstestCore } from './rstest-dependencies';\nimport type {\n GeneratedRstestYamlProject,\n GeneratedYamlTestCase,\n} from './rstest-project';\n\nexport { resolveRstestCoreImportPath } from './rstest-dependencies';\n\nexport interface RunRstestYamlProjectOptions {\n project: GeneratedRstestYamlProject;\n cwd?: string;\n stdio?: 'inherit' | 'pipe';\n}\n\nconst formatRunError = (\n error: TestRunResult['unhandledErrors'][number],\n): string => error.stack || `${error.name}: ${error.message}`;\n\n// Collect every failure rstest surfaced, not just `unhandledErrors`. A failing\n// YAML case shows up as a file-level error (e.g. a module that cannot be\n// loaded) or a test-level error under `files[].results[]`; `unhandledErrors`\n// only covers worker crashes and config-load failures. Reporting just the\n// latter is why a failed run printed nothing and looked like \"not executed\".\nconst collectRunErrors = (result: TestRunResult): string[] => {\n const messages: string[] = [];\n const push = (\n error: TestRunResult['unhandledErrors'][number],\n label?: string,\n ) => {\n const formatted = formatRunError(error);\n messages.push(label ? `${label}: ${formatted}` : formatted);\n };\n\n for (const file of result.files ?? []) {\n for (const error of file.errors ?? []) {\n push(error, file.name || file.testPath);\n }\n for (const testResult of file.results ?? []) {\n for (const error of testResult.errors ?? []) {\n push(error, testResult.name);\n }\n }\n }\n for (const error of result.unhandledErrors ?? []) {\n push(error);\n }\n\n return Array.from(new Set(messages));\n};\n\nconst errorMessage = (\n error: TestRunResult['unhandledErrors'][number],\n): string => error.message || error.name || 'YAML case failed';\n\n// Attribute each rstest failure back to the YAML case it came from, keyed by the\n// resolved YAML file path. A test-level failure matches on the test name (which\n// equals the case's `testName`); a file-level failure (e.g. the test module\n// could not be loaded) matches on the generated virtual module id.\nconst mapRunErrorsToCases = (\n project: GeneratedRstestYamlProject,\n result: TestRunResult,\n): Map<string, string> => {\n const byTestName = new Map(\n project.cases.map((item) => [item.testName, item]),\n );\n const errors = new Map<string, string>();\n const add = (item: GeneratedYamlTestCase | undefined, message: string) => {\n if (item && message && !errors.has(item.yamlFile)) {\n errors.set(item.yamlFile, message);\n }\n };\n const addAll = (message: string) => {\n for (const item of project.cases) {\n add(item, message);\n }\n };\n const matchFileCase = (\n file: TestRunResult['files'][number],\n ): GeneratedYamlTestCase | undefined => {\n for (const key of [file.name, file.testPath]) {\n if (!key) continue;\n const matched = project.cases.find(\n (item) => key === item.testModule || key.includes(item.testModule),\n );\n if (matched) return matched;\n }\n return undefined;\n };\n const isBatchFile = (file: TestRunResult['files'][number]): boolean => {\n if (!project.batchTest) return false;\n for (const key of [file.name, file.testPath]) {\n if (\n key &&\n (key === project.batchTest.testModule ||\n key.includes(project.batchTest.testModule))\n ) {\n return true;\n }\n }\n return false;\n };\n const isBatchTest = (testName: string): boolean =>\n testName === project.batchTest?.testName;\n\n for (const file of result.files ?? []) {\n const fileCase = matchFileCase(file);\n for (const error of file.errors ?? []) {\n const message = errorMessage(error);\n if (isBatchFile(file)) {\n addAll(message);\n } else {\n add(fileCase, message);\n }\n }\n for (const testResult of file.results ?? []) {\n const item = byTestName.get(testResult.name) ?? fileCase;\n for (const error of testResult.errors ?? []) {\n const message = errorMessage(error);\n if (isBatchTest(testResult.name) || isBatchFile(file)) {\n addAll(message);\n } else {\n add(item, message);\n }\n }\n }\n }\n\n if (\n project.batchTest &&\n errors.size === 0 &&\n result.unhandledErrors?.length\n ) {\n addAll(errorMessage(result.unhandledErrors[0]));\n }\n\n // A single-case run whose failure rstest could not pin to a file/test (e.g. a\n // worker crash surfaced only via `unhandledErrors`) still belongs to that one\n // case — otherwise its real error would be lost to a blank \"not executed\".\n if (\n project.cases.length === 1 &&\n errors.size === 0 &&\n result.unhandledErrors?.length\n ) {\n add(project.cases[0], errorMessage(result.unhandledErrors[0]));\n }\n\n return errors;\n};\n\n// When a case fails before it can write its own result file (module load\n// failure, crash before `writeResultFile`, ...), the batch reader would treat\n// it as \"not executed\" with no error. Persist a failed result carrying the real\n// error so the failure — and its cause — is visible in the summary JSON.\nconst recordUnreportedCaseFailures = (\n project: GeneratedRstestYamlProject,\n result: TestRunResult,\n): void => {\n if (!project.cases.length) return;\n const caseErrors = mapRunErrorsToCases(project, result);\n for (const item of project.cases) {\n if (existsSync(item.resultFile)) continue;\n const error = caseErrors.get(item.yamlFile);\n if (!error) continue;\n const failure: MidsceneYamlConfigResult = {\n file: item.yamlFile,\n success: false,\n executed: true,\n output: undefined,\n report: undefined,\n duration: 0,\n resultType: 'failed',\n error,\n };\n mkdirSync(dirname(item.resultFile), { recursive: true });\n writeFileSync(item.resultFile, JSON.stringify(failure, null, 2));\n }\n};\n\nexport async function runRstestYamlProject(\n options: RunRstestYamlProjectOptions,\n): Promise<number> {\n const [{ runRstest }, { rspack }] = await Promise.all([\n import('@rstest/core/api'),\n import(pathToFileURL(resolvePackageFromRstestCore('@rsbuild/core')).href),\n ]);\n const { project } = options;\n const maxConcurrency =\n project.maxConcurrency !== undefined\n ? Math.max(1, project.maxConcurrency)\n : undefined;\n const inlineConfig: RstestUserConfig = {\n root: project.projectDir,\n include: project.include,\n testEnvironment: 'node',\n testTimeout: project.testTimeout,\n ...(maxConcurrency !== undefined ? { maxConcurrency } : {}),\n ...(maxConcurrency !== undefined\n ? { pool: { maxWorkers: maxConcurrency, minWorkers: maxConcurrency } }\n : {}),\n ...(project.bail !== undefined ? { bail: project.bail } : {}),\n ...(project.retry !== undefined && project.retry > 0\n ? { retry: project.retry }\n : {}),\n reporters: [],\n tools: {\n rspack: (_config, { appendPlugins }) => {\n appendPlugins(\n new rspack.experiments.VirtualModulesPlugin(project.virtualModules),\n );\n },\n },\n };\n\n const result = await runRstest({\n cwd: options.cwd || project.projectDir,\n inlineConfig,\n });\n\n if (!result.ok) {\n recordUnreportedCaseFailures(project, result);\n if (options.stdio !== 'pipe') {\n const runErrors = collectRunErrors(result);\n if (runErrors.length) {\n console.error(`\\nYAML execution failed:\\n${runErrors.join('\\n\\n')}`);\n }\n }\n }\n\n return result.ok ? 0 : 1;\n}\n","import { existsSync, readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport type { MidsceneYamlConfigResult } from '@midscene/core';\nimport type { BatchRunnerConfig } from '../batch-runner';\nimport {\n createNotExecutedYamlResult,\n printExecutionFinished,\n printExecutionPlan,\n printExecutionSummary,\n writeExecutionSummaryFile,\n} from '../execution-summary';\nimport {\n type GeneratedRstestYamlProject,\n type RstestYamlCaseOptions,\n type WebYamlRuntimeOptions,\n createRstestYamlProject,\n} from './rstest-project';\nimport { runRstestYamlProject } from './rstest-runner';\n\ninterface WebRuntimeOptions {\n headed?: boolean;\n keepWindow?: boolean;\n}\n\nexport interface FrameworkTestCommandOptions extends WebRuntimeOptions {\n projectDir?: string;\n files?: string[];\n concurrent?: number;\n outputDir?: string;\n frameworkImport?: string;\n stdio?: 'inherit' | 'pipe';\n rstestRunner?: typeof runRstestYamlProject;\n}\n\nconst createCaseOptions = (\n config: BatchRunnerConfig,\n): Record<string, RstestYamlCaseOptions> => {\n const caseOptions: Record<string, RstestYamlCaseOptions> = {};\n for (const file of config.files) {\n caseOptions[resolve(file)] = {\n globalConfig: config.globalConfig,\n };\n }\n return caseOptions;\n};\n\nconst createWebRuntimeOptions = (\n config: BatchRunnerConfig,\n runtimeOptions: WebRuntimeOptions,\n): Record<string, WebYamlRuntimeOptions> => {\n const caseOptions: Record<string, WebYamlRuntimeOptions> = {};\n for (const file of config.files) {\n caseOptions[resolve(file)] = {\n headed: runtimeOptions.headed ?? config.headed,\n keepWindow: runtimeOptions.keepWindow ?? config.keepWindow,\n };\n }\n return caseOptions;\n};\n\nconst readProjectResults = (\n project: GeneratedRstestYamlProject,\n): MidsceneYamlConfigResult[] =>\n project.cases.map((item) => {\n if (existsSync(item.resultFile)) {\n return JSON.parse(\n readFileSync(item.resultFile, 'utf8'),\n ) as MidsceneYamlConfigResult;\n }\n\n return createNotExecutedYamlResult(item.yamlFile);\n });\n\nexport async function runFrameworkTestConfig(\n config: BatchRunnerConfig,\n commandOptions: FrameworkTestCommandOptions = {},\n): Promise<number> {\n printExecutionPlan(config);\n\n const projectDir = resolve(commandOptions.projectDir || process.cwd());\n const project = createRstestYamlProject({\n files: config.files,\n projectDir,\n outputDir: commandOptions.outputDir,\n frameworkImport: commandOptions.frameworkImport,\n caseOptions: createCaseOptions(config),\n webRuntimeOptions: createWebRuntimeOptions(config, commandOptions),\n maxConcurrency: commandOptions.concurrent ?? config.concurrent,\n bail: config.continueOnError ? 0 : 1,\n retry: config.retry,\n batchConfig: config.shareBrowserContext ? config : undefined,\n });\n\n const runner = commandOptions.rstestRunner || runRstestYamlProject;\n const exitCode = await runner({\n project,\n cwd: projectDir,\n stdio: commandOptions.stdio,\n });\n\n const results = readProjectResults(project);\n const summaryPath = writeExecutionSummaryFile(config.summary, results);\n printExecutionFinished();\n const success = printExecutionSummary(results, summaryPath);\n\n return success ? exitCode : 1;\n}\n","/*\nHow it works:\n`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.\n*/\n\nclass Node {\n\tvalue;\n\tnext;\n\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n}\n\nexport default class Queue {\n\t#head;\n\t#tail;\n\t#size;\n\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\n\tenqueue(value) {\n\t\tconst node = new Node(value);\n\n\t\tif (this.#head) {\n\t\t\tthis.#tail.next = node;\n\t\t\tthis.#tail = node;\n\t\t} else {\n\t\t\tthis.#head = node;\n\t\t\tthis.#tail = node;\n\t\t}\n\n\t\tthis.#size++;\n\t}\n\n\tdequeue() {\n\t\tconst current = this.#head;\n\t\tif (!current) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#head = this.#head.next;\n\t\tthis.#size--;\n\t\treturn current.value;\n\t}\n\n\tpeek() {\n\t\tif (!this.#head) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn this.#head.value;\n\n\t\t// TODO: Node.js 18.\n\t\t// return this.#head?.value;\n\t}\n\n\tclear() {\n\t\tthis.#head = undefined;\n\t\tthis.#tail = undefined;\n\t\tthis.#size = 0;\n\t}\n\n\tget size() {\n\t\treturn this.#size;\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tlet current = this.#head;\n\n\t\twhile (current) {\n\t\t\tyield current.value;\n\t\t\tcurrent = current.next;\n\t\t}\n\t}\n\n\t* drain() {\n\t\twhile (this.#head) {\n\t\t\tyield this.dequeue();\n\t\t}\n\t}\n}\n","import Queue from 'yocto-queue';\n\nexport default function pLimit(concurrency) {\n\tvalidateConcurrency(concurrency);\n\n\tconst queue = new Queue();\n\tlet activeCount = 0;\n\n\tconst resumeNext = () => {\n\t\tif (activeCount < concurrency && queue.size > 0) {\n\t\t\tqueue.dequeue()();\n\t\t\t// Since `pendingCount` has been decreased by one, increase `activeCount` by one.\n\t\t\tactiveCount++;\n\t\t}\n\t};\n\n\tconst next = () => {\n\t\tactiveCount--;\n\n\t\tresumeNext();\n\t};\n\n\tconst run = async (function_, resolve, arguments_) => {\n\t\tconst result = (async () => function_(...arguments_))();\n\n\t\tresolve(result);\n\n\t\ttry {\n\t\t\tawait result;\n\t\t} catch {}\n\n\t\tnext();\n\t};\n\n\tconst enqueue = (function_, resolve, arguments_) => {\n\t\t// Queue `internalResolve` instead of the `run` function\n\t\t// to preserve asynchronous context.\n\t\tnew Promise(internalResolve => {\n\t\t\tqueue.enqueue(internalResolve);\n\t\t}).then(\n\t\t\trun.bind(undefined, function_, resolve, arguments_),\n\t\t);\n\n\t\t(async () => {\n\t\t\t// This function needs to wait until the next microtask before comparing\n\t\t\t// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously\n\t\t\t// after the `internalResolve` function is dequeued and called. The comparison in the if-statement\n\t\t\t// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.\n\t\t\tawait Promise.resolve();\n\n\t\t\tif (activeCount < concurrency) {\n\t\t\t\tresumeNext();\n\t\t\t}\n\t\t})();\n\t};\n\n\tconst generator = (function_, ...arguments_) => new Promise(resolve => {\n\t\tenqueue(function_, resolve, arguments_);\n\t});\n\n\tObject.defineProperties(generator, {\n\t\tactiveCount: {\n\t\t\tget: () => activeCount,\n\t\t},\n\t\tpendingCount: {\n\t\t\tget: () => queue.size,\n\t\t},\n\t\tclearQueue: {\n\t\t\tvalue() {\n\t\t\t\tqueue.clear();\n\t\t\t},\n\t\t},\n\t\tconcurrency: {\n\t\t\tget: () => concurrency,\n\n\t\t\tset(newConcurrency) {\n\t\t\t\tvalidateConcurrency(newConcurrency);\n\t\t\t\tconcurrency = newConcurrency;\n\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\t// eslint-disable-next-line no-unmodified-loop-condition\n\t\t\t\t\twhile (activeCount < concurrency && queue.size > 0) {\n\t\t\t\t\t\tresumeNext();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t});\n\n\treturn generator;\n}\n\nexport function limitFunction(function_, option) {\n\tconst {concurrency} = option;\n\tconst limit = pLimit(concurrency);\n\n\treturn (...arguments_) => limit(() => function_(...arguments_));\n}\n\nfunction validateConcurrency(concurrency) {\n\tif (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {\n\t\tthrow new TypeError('Expected `concurrency` to be a number from 1 and up');\n\t}\n}\n","import { readFileSync } from 'node:fs';\nimport path, { basename, extname, join } from 'node:path';\nimport { ScriptPlayer, parseYamlScript } from '@midscene/core/yaml';\nimport { createServer } from 'http-server';\n\nimport assert from 'node:assert';\nimport type {\n AgentOpt,\n FreeFn,\n MidsceneYamlScript,\n MidsceneYamlScriptAgentOpt,\n MidsceneYamlScriptEnv,\n MidsceneYamlScriptWebEnv,\n} from '@midscene/core';\nimport { createAgent, getReportFileName } from '@midscene/core/agent';\nimport type { AbstractInterface } from '@midscene/core/device';\nimport { processCacheConfig } from '@midscene/core/utils';\nimport { getDebug } from '@midscene/shared/logger';\nimport { AgentOverChromeBridge } from '@midscene/web/bridge-mode';\nimport { puppeteerAgentForTarget } from '@midscene/web/puppeteer-agent-launcher';\nimport type { Browser, Page } from 'puppeteer';\nimport puppeteer from 'puppeteer';\n\nexport interface SingleYamlExecutionResult {\n success: boolean;\n file: string;\n player: ScriptPlayer<MidsceneYamlScriptEnv>;\n}\n\nconst debug = getDebug('create-yaml-player');\n\nexport const launchServer = async (\n dir: string,\n): Promise<ReturnType<typeof createServer>> => {\n // https://github.com/http-party/http-server/blob/master/bin/http-server\n return new Promise((resolve) => {\n const server = createServer({\n root: dir,\n });\n server.listen(0, '127.0.0.1', () => {\n resolve(server);\n });\n });\n};\n\n/**\n * Resolves reportFileName with proper priority handling.\n * Priority: YAML reportFileName > CLI testId (legacy) > YAML testId (legacy) > fileName\n * Explicit YAML reportFileName is treated as the exact output name. Generated\n * legacy fallbacks include a unique suffix to avoid overwriting.\n */\nfunction resolveReportFileName(\n yamlReportFileName: string | undefined,\n cliTestId: string | undefined,\n yamlTestId: string | undefined,\n fileName: string,\n): string {\n if (yamlReportFileName !== undefined) {\n return yamlReportFileName;\n }\n const baseName = cliTestId ?? yamlTestId ?? fileName;\n return getReportFileName(baseName);\n}\n\n/**\n * Builds agent options by merging YAML agent config with processed cache and report name.\n * Handles the spread of agent options and ensures proper cache configuration.\n */\nfunction buildAgentOptions(\n yamlAgent: MidsceneYamlScriptAgentOpt | undefined,\n reportFileName: string,\n fileName: string,\n): Partial<AgentOpt> {\n return {\n ...(yamlAgent || {}),\n cache: processCacheConfig(yamlAgent?.cache, fileName),\n reportFileName,\n };\n}\n\nexport async function createYamlPlayer(\n file: string,\n script?: MidsceneYamlScript,\n options?: {\n headed?: boolean;\n keepWindow?: boolean;\n browser?: Browser;\n page?: Page;\n testId?: string;\n },\n): Promise<ScriptPlayer<MidsceneYamlScriptEnv>> {\n const yamlScript =\n script || parseYamlScript(readFileSync(file, 'utf-8'), file);\n\n // Deep clone the script to avoid mutation issues when the same file is executed multiple times\n // This ensures each ScriptPlayer instance has its own independent copy of the YAML data\n const clonedYamlScript = structuredClone(yamlScript);\n\n const fileName = basename(file, extname(file));\n const preference = {\n headed: options?.headed,\n keepWindow: options?.keepWindow,\n reportFileName: resolveReportFileName(\n clonedYamlScript.agent?.reportFileName,\n options?.testId,\n clonedYamlScript.agent?.testId,\n fileName,\n ),\n };\n\n const player = new ScriptPlayer(\n clonedYamlScript,\n async () => {\n const freeFn: FreeFn[] = [];\n const webTarget = clonedYamlScript.web || clonedYamlScript.target;\n\n // Validate that only one target type is specified\n const targetCount = [\n typeof webTarget !== 'undefined',\n typeof clonedYamlScript.android !== 'undefined',\n typeof clonedYamlScript.ios !== 'undefined',\n typeof clonedYamlScript.harmony !== 'undefined',\n typeof clonedYamlScript.computer !== 'undefined',\n typeof clonedYamlScript.interface !== 'undefined',\n ].filter(Boolean).length;\n\n if (targetCount > 1) {\n const specifiedTargets = [\n typeof webTarget !== 'undefined' ? 'web' : null,\n typeof clonedYamlScript.android !== 'undefined' ? 'android' : null,\n typeof clonedYamlScript.ios !== 'undefined' ? 'ios' : null,\n typeof clonedYamlScript.harmony !== 'undefined' ? 'harmony' : null,\n typeof clonedYamlScript.computer !== 'undefined' ? 'computer' : null,\n typeof clonedYamlScript.interface !== 'undefined'\n ? 'interface'\n : null,\n ].filter(Boolean);\n\n throw new Error(\n `Only one target type can be specified, but found multiple: ${specifiedTargets.join(', ')}. Please specify only one of: web, android, ios, harmony, computer, or interface.`,\n );\n }\n\n // handle new web config\n if (typeof webTarget !== 'undefined') {\n if (typeof clonedYamlScript.target !== 'undefined') {\n console.warn(\n 'target is deprecated, please use web instead. See https://midscenejs.com/automate-with-scripts-in-yaml for more information. Sorry for the inconvenience.',\n );\n }\n\n // launch local server if needed\n let localServer: Awaited<ReturnType<typeof launchServer>> | undefined;\n let urlToVisit: string | undefined;\n if (webTarget.serve) {\n assert(\n typeof webTarget.url === 'string',\n 'url is required in serve mode',\n );\n localServer = await launchServer(webTarget.serve);\n const serverAddress = localServer.server.address();\n freeFn.push({\n name: 'local_server',\n fn: () => localServer?.server.close(),\n });\n if (webTarget.url.startsWith('/')) {\n urlToVisit = `http://${serverAddress?.address}:${serverAddress?.port}${webTarget.url}`;\n } else {\n urlToVisit = `http://${serverAddress?.address}:${serverAddress?.port}/${webTarget.url}`;\n }\n webTarget.url = urlToVisit;\n }\n\n // Validate: cdpEndpoint and bridgeMode are mutually exclusive\n if (webTarget.cdpEndpoint && webTarget.bridgeMode) {\n throw new Error(\n 'cdpEndpoint and bridgeMode are mutually exclusive. Please specify only one.',\n );\n }\n\n // CDP mode: connect to an existing browser via Chrome DevTools Protocol\n if (webTarget.cdpEndpoint) {\n // Use the shared browser from batch-runner if available (shareBrowserContext),\n // otherwise connect via CDP endpoint\n const cdpBrowser =\n options?.browser ??\n (await puppeteer.connect({\n browserWSEndpoint: webTarget.cdpEndpoint,\n defaultViewport: null,\n }));\n\n // Warn about options that don't apply to an already-running browser\n if (webTarget.chromeArgs) {\n console.warn(\n 'chromeArgs are not supported in CDP mode (browser is already running). They will be ignored.',\n );\n }\n\n // Reuse puppeteerAgentForTarget which handles page setup (userAgent, viewport,\n // cookie, waitForNetworkIdle, etc.) — pass the CDP browser as the browser param\n const { agent, freeFn: newFreeFn } = await puppeteerAgentForTarget(\n webTarget,\n {\n ...preference,\n ...buildAgentOptions(\n clonedYamlScript.agent,\n preference.reportFileName,\n fileName,\n ),\n },\n cdpBrowser as Browser,\n options?.page,\n );\n\n // Replace the default browser close with disconnect for CDP\n const cleanFreeFn = newFreeFn.filter(\n (f) => f.name !== 'puppeteer_browser',\n );\n if (!options?.browser) {\n // Only add disconnect if we created the connection (not shared from batch-runner)\n cleanFreeFn.push({\n name: 'cdp_browser_disconnect',\n fn: () => cdpBrowser.disconnect(),\n });\n }\n freeFn.push(...cleanFreeFn);\n\n return { agent, freeFn };\n }\n\n if (!webTarget.bridgeMode) {\n // use puppeteer\n const { agent, freeFn: newFreeFn } = await puppeteerAgentForTarget(\n webTarget,\n {\n ...preference,\n ...buildAgentOptions(\n clonedYamlScript.agent,\n preference.reportFileName,\n fileName,\n ),\n },\n options?.browser,\n options?.page,\n );\n freeFn.push(...newFreeFn);\n\n return { agent, freeFn };\n }\n assert(\n webTarget.bridgeMode === 'newTabWithUrl' ||\n webTarget.bridgeMode === 'currentTab',\n `bridgeMode config value must be either \"newTabWithUrl\" or \"currentTab\", but got ${webTarget.bridgeMode}`,\n );\n\n const bridgeUnsupportedKeys: (keyof MidsceneYamlScriptWebEnv)[] = [\n 'userAgent',\n 'viewportWidth',\n 'viewportHeight',\n 'deviceScaleFactor',\n 'waitForNetworkIdle',\n 'cookie',\n 'extraHTTPHeaders',\n 'chromeArgs',\n ];\n const ignoredKeys = bridgeUnsupportedKeys.filter(\n (key) => webTarget[key] != null,\n );\n if (ignoredKeys.length > 0) {\n console.warn(\n `puppeteer options (${ignoredKeys.join(', ')}) are not supported in bridge mode. They will be ignored.`,\n );\n }\n\n const agent = new AgentOverChromeBridge({\n closeNewTabsAfterDisconnect: webTarget.closeNewTabsAfterDisconnect,\n closeConflictServer: true,\n ...buildAgentOptions(\n clonedYamlScript.agent,\n preference.reportFileName,\n fileName,\n ),\n });\n\n if (webTarget.bridgeMode === 'newTabWithUrl') {\n await agent.connectNewTabWithUrl(webTarget.url);\n } else {\n if (webTarget.url) {\n console.warn(\n 'url will be ignored in bridge mode with \"currentTab\"',\n );\n }\n await agent.connectCurrentTab();\n }\n freeFn.push({\n name: 'destroy_agent_over_chrome_bridge',\n fn: () => agent.destroy(),\n });\n return {\n agent,\n freeFn,\n };\n }\n\n // handle android\n if (typeof clonedYamlScript.android !== 'undefined') {\n const androidTarget = clonedYamlScript.android;\n const { agentFromAdbDevice } = await import('@midscene/android');\n const agent = await agentFromAdbDevice(androidTarget?.deviceId, {\n ...androidTarget, // Pass all Android config options\n ...buildAgentOptions(\n clonedYamlScript.agent,\n preference.reportFileName,\n fileName,\n ),\n });\n\n if (androidTarget?.launch) {\n await agent.launch(androidTarget.launch);\n }\n\n freeFn.push({\n name: 'destroy_android_agent',\n fn: () => agent.destroy(),\n });\n\n return { agent, freeFn };\n }\n\n // handle iOS\n if (typeof clonedYamlScript.ios !== 'undefined') {\n const iosTarget = clonedYamlScript.ios;\n const { agentFromWebDriverAgent } = await import('@midscene/ios');\n const agent = await agentFromWebDriverAgent({\n ...iosTarget, // Pass all iOS config options\n ...buildAgentOptions(\n clonedYamlScript.agent,\n preference.reportFileName,\n fileName,\n ),\n });\n\n if (iosTarget?.launch) {\n await agent.launch(iosTarget.launch);\n }\n\n freeFn.push({\n name: 'destroy_ios_agent',\n fn: () => agent.destroy(),\n });\n\n return { agent, freeFn };\n }\n\n // handle harmony\n if (typeof clonedYamlScript.harmony !== 'undefined') {\n const harmonyTarget = clonedYamlScript.harmony;\n const { agentFromHdcDevice } = await import('@midscene/harmony');\n const agent = await agentFromHdcDevice(harmonyTarget?.deviceId, {\n ...harmonyTarget, // Pass all HarmonyOS config options\n ...buildAgentOptions(\n clonedYamlScript.agent,\n preference.reportFileName,\n fileName,\n ),\n });\n\n if (harmonyTarget?.launch) {\n await agent.launch(harmonyTarget.launch);\n }\n\n freeFn.push({\n name: 'destroy_harmony_agent',\n fn: () => agent.destroy(),\n });\n\n return { agent, freeFn };\n }\n\n // handle computer\n if (typeof clonedYamlScript.computer !== 'undefined') {\n const computerTarget = clonedYamlScript.computer;\n const { agentForComputer } = await import('@midscene/computer');\n const agent = await agentForComputer({\n ...computerTarget,\n ...buildAgentOptions(\n clonedYamlScript.agent,\n preference.reportFileName,\n fileName,\n ),\n });\n\n freeFn.push({\n name: 'destroy_computer_agent',\n fn: () => agent.destroy(),\n });\n\n return { agent, freeFn };\n }\n\n // handle general interface\n if (typeof clonedYamlScript.interface !== 'undefined') {\n const interfaceTarget = clonedYamlScript.interface;\n\n const moduleSpecifier = interfaceTarget.module;\n let finalModuleSpecifier: string;\n if (\n moduleSpecifier.startsWith('./') ||\n moduleSpecifier.startsWith('../') ||\n path.isAbsolute(moduleSpecifier)\n ) {\n const resolvedPath = join(process.cwd(), moduleSpecifier);\n finalModuleSpecifier = resolvedPath;\n } else {\n finalModuleSpecifier = moduleSpecifier;\n }\n\n // import the module dynamically\n debug(\n 'importing module config',\n interfaceTarget.module,\n 'with export config',\n interfaceTarget.export,\n 'final module specifier',\n finalModuleSpecifier,\n );\n\n const importedModule = await import(finalModuleSpecifier);\n\n // get the specific export or use default export\n const DeviceClass = interfaceTarget.export\n ? importedModule[interfaceTarget.export]\n : importedModule.default || importedModule;\n\n debug('DeviceClass', DeviceClass, 'with param', interfaceTarget.param);\n\n // create device instance with parameters\n const device: AbstractInterface = new DeviceClass(\n interfaceTarget.param || {},\n );\n\n // create agent from device\n debug('creating agent from device', device);\n const agent = createAgent(\n device,\n buildAgentOptions(\n clonedYamlScript.agent,\n preference.reportFileName,\n fileName,\n ),\n );\n\n freeFn.push({\n name: 'destroy_general_interface_agent',\n fn: () => {\n agent.destroy();\n },\n });\n\n return { agent, freeFn };\n }\n\n throw new Error(\n 'No valid interface configuration found in the yaml script, should be either \"web\", \"android\", \"ios\", \"harmony\", \"computer\", or \"interface\"',\n );\n },\n undefined,\n file,\n );\n\n return player;\n}\n","import { basename, dirname, relative } from 'node:path';\nimport type {\n MidsceneYamlScriptEnv,\n ScriptPlayerStatusValue,\n ScriptPlayerTaskStatus,\n} from '@midscene/core';\nimport type { ScriptPlayer } from '@midscene/core/yaml';\nimport chalk from 'chalk';\n\nexport interface MidsceneYamlFileContext {\n file: string;\n player: ScriptPlayer<MidsceneYamlScriptEnv>;\n}\n\nexport const isTTY = process.env.MIDSCENE_CLI_LOG_ON_NON_TTY\n ? false\n : process.stdout.isTTY;\nexport const indent = ' ';\nexport const spinnerInterval = 80;\nexport const spinnerFrames = ['◰', '◳', '◲', '◱']; // https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json\nexport const currentSpinningFrame = () => {\n return spinnerFrames[\n Math.floor(Date.now() / spinnerInterval) % spinnerFrames.length\n ];\n};\n\n// status: init / running / done / error\nfunction indicatorForStatus(status: ScriptPlayerStatusValue) {\n if (status === 'init') {\n return chalk.gray('◌');\n }\n if (status === 'running') {\n return chalk.yellowBright(currentSpinningFrame());\n }\n if (status === 'done') {\n return chalk.green('✔︎');\n }\n if (status === 'error') {\n return chalk.red('✘');\n }\n}\n\nexport const contextInfo = (context: MidsceneYamlFileContext) => {\n const filePath = context.file;\n const filePathToShow = relative(process.cwd(), filePath);\n const fileNameToPrint = `${chalk.gray(`${filePathToShow}`)}`;\n const fileStatusText = indicatorForStatus(context.player.status);\n const contextActionText =\n typeof context.player.currentTaskIndex === 'undefined' &&\n context.player.status === 'running'\n ? chalk.gray('(navigating)')\n : '';\n\n // error: ...\n const errorText = context.player.errorInSetup\n ? `\\n${indent}${chalk.red('error:')} ${context.player.errorInSetup?.message}\\n${indent}${indent}${context.player.errorInSetup?.stack}`\n : '';\n\n // output: ...\n const outputFile = context.player.output;\n const outputText =\n outputFile && Object.keys(context.player.result || {}).length > 0\n ? `\\n${indent}${chalk.gray(`output: ${outputFile}`)}`\n : '';\n\n // report: ...\n const reportFile = context.player.reportFile;\n const reportText = reportFile\n ? `\\n${indent}${chalk.gray(`report: ${reportFile}`)}`\n : '';\n\n // agent status: ...\n const agentStatusTip = context.player.agentStatusTip;\n const agentStatusText = agentStatusTip\n ? `\\n${indent}${chalk.gray(`agent status: ${agentStatusTip}`)}`\n : '';\n\n const mergedText =\n `${fileStatusText} ${fileNameToPrint} ${contextActionText}${outputText}${reportText}${errorText}${agentStatusText}`.trim();\n\n return {\n fileNameToPrint,\n fileStatusText,\n contextActionText,\n outputText,\n reportText,\n mergedText,\n };\n};\n\nexport const singleTaskInfo = (task: ScriptPlayerTaskStatus) => {\n let stepText = '';\n if (task.status === 'init') {\n stepText = '';\n } else if (task.status === 'running' || task.status === 'error') {\n if (typeof task.currentStep === 'undefined') {\n stepText = chalk.gray('(navigating)');\n } else if (typeof task.currentStep === 'number') {\n const actionText = ''; // taskBrief ? `, ${taskBrief}` : '';\n stepText = chalk.gray(\n `(task ${task.currentStep + 1}/${task.totalSteps}${actionText})`.trim(),\n );\n } else {\n stepText = chalk.gray('(unknown task)');\n }\n }\n\n const errorText =\n task.status === 'error'\n ? `\\n${indent}${chalk.gray('error:')}\\n${indent}${indent}${task.error?.message}`\n : '';\n\n const statusText = indicatorForStatus(task.status);\n const mergedLine = `${statusText} ${task.name} ${stepText}${errorText}`;\n return {\n nameText: task.name,\n stepText,\n errorText,\n itemStatusText: statusText,\n mergedLine,\n };\n};\n\nfunction paddingLines(lines: string[]) {\n return lines.map((line) => {\n return `${indent}${line}`;\n });\n}\n\nexport const contextTaskListSummary = (\n taskStatusArray: ScriptPlayerTaskStatus[],\n context: MidsceneYamlFileContext,\n) => {\n const prefixLines: string[] = [];\n const currentLine: string[] = [];\n const suffixText: string[] = [];\n const { mergedText: fileInfo } = contextInfo(context);\n if (!context.player.errorInSetup) {\n for (const task of taskStatusArray) {\n const { mergedLine } = singleTaskInfo(task);\n\n if (context.player.status === 'init') {\n suffixText.push(mergedLine);\n } else if (context.player.status === 'running') {\n currentLine.push(mergedLine);\n } else if (context.player.status === 'done') {\n prefixLines.push(mergedLine);\n } else if (context.player.status === 'error') {\n prefixLines.push(mergedLine);\n }\n }\n }\n const lines: string[] = [fileInfo];\n if (prefixLines.length > 0) lines.push(...paddingLines(prefixLines));\n if (currentLine.length > 0) lines.push(...paddingLines(currentLine));\n if (suffixText.length > 0) lines.push(...paddingLines(suffixText));\n return lines.join('\\n');\n};\n","const copyProperty = (to, from, property, ignoreNonConfigurable) => {\n\t// `Function#length` should reflect the parameters of `to` not `from` since we keep its body.\n\t// `Function#prototype` is non-writable and non-configurable so can never be modified.\n\tif (property === 'length' || property === 'prototype') {\n\t\treturn;\n\t}\n\n\t// `Function#arguments` and `Function#caller` should not be copied. They were reported to be present in `Reflect.ownKeys` for some devices in React Native (#41), so we explicitly ignore them here.\n\tif (property === 'arguments' || property === 'caller') {\n\t\treturn;\n\t}\n\n\tconst toDescriptor = Object.getOwnPropertyDescriptor(to, property);\n\tconst fromDescriptor = Object.getOwnPropertyDescriptor(from, property);\n\n\tif (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {\n\t\treturn;\n\t}\n\n\tObject.defineProperty(to, property, fromDescriptor);\n};\n\n// `Object.defineProperty()` throws if the property exists, is not configurable and either:\n// - one its descriptors is changed\n// - it is non-writable and its value is changed\nconst canCopyProperty = function (toDescriptor, fromDescriptor) {\n\treturn toDescriptor === undefined || toDescriptor.configurable || (\n\t\ttoDescriptor.writable === fromDescriptor.writable\n\t\t&& toDescriptor.enumerable === fromDescriptor.enumerable\n\t\t&& toDescriptor.configurable === fromDescriptor.configurable\n\t\t&& (toDescriptor.writable || toDescriptor.value === fromDescriptor.value)\n\t);\n};\n\nconst changePrototype = (to, from) => {\n\tconst fromPrototype = Object.getPrototypeOf(from);\n\tif (fromPrototype === Object.getPrototypeOf(to)) {\n\t\treturn;\n\t}\n\n\tObject.setPrototypeOf(to, fromPrototype);\n};\n\nconst wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/\\n${fromBody}`;\n\nconst toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, 'toString');\nconst toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, 'name');\n\n// We call `from.toString()` early (not lazily) to ensure `from` can be garbage collected.\n// We use `bind()` instead of a closure for the same reason.\n// Calling `from.toString()` early also allows caching it in case `to.toString()` is called several times.\nconst changeToString = (to, from, name) => {\n\tconst withName = name === '' ? '' : `with ${name.trim()}() `;\n\tconst newToString = wrappedToString.bind(null, withName, from.toString());\n\t// Ensure `to.toString.toString` is non-enumerable and has the same `same`\n\tObject.defineProperty(newToString, 'name', toStringName);\n\tconst {writable, enumerable, configurable} = toStringDescriptor; // We destructue to avoid a potential `get` descriptor.\n\tObject.defineProperty(to, 'toString', {value: newToString, writable, enumerable, configurable});\n};\n\nexport default function mimicFunction(to, from, {ignoreNonConfigurable = false} = {}) {\n\tconst {name} = to;\n\n\tfor (const property of Reflect.ownKeys(from)) {\n\t\tcopyProperty(to, from, property, ignoreNonConfigurable);\n\t}\n\n\tchangePrototype(to, from);\n\tchangeToString(to, from, name);\n\n\treturn to;\n}\n","import mimicFunction from 'mimic-function';\n\nconst calledFunctions = new WeakMap();\n\nconst onetime = (function_, options = {}) => {\n\tif (typeof function_ !== 'function') {\n\t\tthrow new TypeError('Expected a function');\n\t}\n\n\tlet returnValue;\n\tlet callCount = 0;\n\tconst functionName = function_.displayName || function_.name || '<anonymous>';\n\n\tconst onetime = function (...arguments_) {\n\t\tcalledFunctions.set(onetime, ++callCount);\n\n\t\tif (callCount === 1) {\n\t\t\treturnValue = function_.apply(this, arguments_);\n\t\t\tfunction_ = undefined;\n\t\t} else if (options.throw === true) {\n\t\t\tthrow new Error(`Function \\`${functionName}\\` can only be called once`);\n\t\t}\n\n\t\treturn returnValue;\n\t};\n\n\tmimicFunction(onetime, function_);\n\tcalledFunctions.set(onetime, callCount);\n\n\treturn onetime;\n};\n\nonetime.callCount = function_ => {\n\tif (!calledFunctions.has(function_)) {\n\t\tthrow new Error(`The given function \\`${function_.name}\\` is not wrapped by the \\`onetime\\` package`);\n\t}\n\n\treturn calledFunctions.get(function_);\n};\n\nexport default onetime;\n","/**\n * This is not the set of all possible signals.\n *\n * It IS, however, the set of all signals that trigger\n * an exit on either Linux or BSD systems. Linux is a\n * superset of the signal names supported on BSD, and\n * the unknown signals just fail to register, so we can\n * catch that easily enough.\n *\n * Windows signals are a different set, since there are\n * signals that terminate Windows processes, but don't\n * terminate (or don't even exist) on Posix systems.\n *\n * Don't bother with SIGKILL. It's uncatchable, which\n * means that we can't fire any callbacks anyway.\n *\n * If a user does happen to register a handler on a non-\n * fatal signal like SIGWINCH or something, and then\n * exit, it'll end up firing `process.emit('exit')`, so\n * the handler will be fired anyway.\n *\n * SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised\n * artificially, inherently leave the process in a\n * state from which it is not safe to try and enter JS\n * listeners.\n */\nexport const signals = [];\nsignals.push('SIGHUP', 'SIGINT', 'SIGTERM');\nif (process.platform !== 'win32') {\n signals.push('SIGALRM', 'SIGABRT', 'SIGVTALRM', 'SIGXCPU', 'SIGXFSZ', 'SIGUSR2', 'SIGTRAP', 'SIGSYS', 'SIGQUIT', 'SIGIOT'\n // should detect profiler and enable/disable accordingly.\n // see #21\n // 'SIGPROF'\n );\n}\nif (process.platform === 'linux') {\n signals.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT');\n}\n//# sourceMappingURL=signals.js.map","// Note: since nyc uses this module to output coverage, any lines\n// that are in the direct sync flow of nyc's outputCoverage are\n// ignored, since we can never get coverage for them.\n// grab a reference to node's real process object right away\nimport { signals } from './signals.js';\nexport { signals };\nconst processOk = (process) => !!process &&\n typeof process === 'object' &&\n typeof process.removeListener === 'function' &&\n typeof process.emit === 'function' &&\n typeof process.reallyExit === 'function' &&\n typeof process.listeners === 'function' &&\n typeof process.kill === 'function' &&\n typeof process.pid === 'number' &&\n typeof process.on === 'function';\nconst kExitEmitter = Symbol.for('signal-exit emitter');\nconst global = globalThis;\nconst ObjectDefineProperty = Object.defineProperty.bind(Object);\n// teeny special purpose ee\nclass Emitter {\n emitted = {\n afterExit: false,\n exit: false,\n };\n listeners = {\n afterExit: [],\n exit: [],\n };\n count = 0;\n id = Math.random();\n constructor() {\n if (global[kExitEmitter]) {\n return global[kExitEmitter];\n }\n ObjectDefineProperty(global, kExitEmitter, {\n value: this,\n writable: false,\n enumerable: false,\n configurable: false,\n });\n }\n on(ev, fn) {\n this.listeners[ev].push(fn);\n }\n removeListener(ev, fn) {\n const list = this.listeners[ev];\n const i = list.indexOf(fn);\n /* c8 ignore start */\n if (i === -1) {\n return;\n }\n /* c8 ignore stop */\n if (i === 0 && list.length === 1) {\n list.length = 0;\n }\n else {\n list.splice(i, 1);\n }\n }\n emit(ev, code, signal) {\n if (this.emitted[ev]) {\n return false;\n }\n this.emitted[ev] = true;\n let ret = false;\n for (const fn of this.listeners[ev]) {\n ret = fn(code, signal) === true || ret;\n }\n if (ev === 'exit') {\n ret = this.emit('afterExit', code, signal) || ret;\n }\n return ret;\n }\n}\nclass SignalExitBase {\n}\nconst signalExitWrap = (handler) => {\n return {\n onExit(cb, opts) {\n return handler.onExit(cb, opts);\n },\n load() {\n return handler.load();\n },\n unload() {\n return handler.unload();\n },\n };\n};\nclass SignalExitFallback extends SignalExitBase {\n onExit() {\n return () => { };\n }\n load() { }\n unload() { }\n}\nclass SignalExit extends SignalExitBase {\n // \"SIGHUP\" throws an `ENOSYS` error on Windows,\n // so use a supported signal instead\n /* c8 ignore start */\n #hupSig = process.platform === 'win32' ? 'SIGINT' : 'SIGHUP';\n /* c8 ignore stop */\n #emitter = new Emitter();\n #process;\n #originalProcessEmit;\n #originalProcessReallyExit;\n #sigListeners = {};\n #loaded = false;\n constructor(process) {\n super();\n this.#process = process;\n // { <signal>: <listener fn>, ... }\n this.#sigListeners = {};\n for (const sig of signals) {\n this.#sigListeners[sig] = () => {\n // If there are no other listeners, an exit is coming!\n // Simplest way: remove us and then re-send the signal.\n // We know that this will kill the process, so we can\n // safely emit now.\n const listeners = this.#process.listeners(sig);\n let { count } = this.#emitter;\n // This is a workaround for the fact that signal-exit v3 and signal\n // exit v4 are not aware of each other, and each will attempt to let\n // the other handle it, so neither of them do. To correct this, we\n // detect if we're the only handler *except* for previous versions\n // of signal-exit, and increment by the count of listeners it has\n // created.\n /* c8 ignore start */\n const p = process;\n if (typeof p.__signal_exit_emitter__ === 'object' &&\n typeof p.__signal_exit_emitter__.count === 'number') {\n count += p.__signal_exit_emitter__.count;\n }\n /* c8 ignore stop */\n if (listeners.length === count) {\n this.unload();\n const ret = this.#emitter.emit('exit', null, sig);\n /* c8 ignore start */\n const s = sig === 'SIGHUP' ? this.#hupSig : sig;\n if (!ret)\n process.kill(process.pid, s);\n /* c8 ignore stop */\n }\n };\n }\n this.#originalProcessReallyExit = process.reallyExit;\n this.#originalProcessEmit = process.emit;\n }\n onExit(cb, opts) {\n /* c8 ignore start */\n if (!processOk(this.#process)) {\n return () => { };\n }\n /* c8 ignore stop */\n if (this.#loaded === false) {\n this.load();\n }\n const ev = opts?.alwaysLast ? 'afterExit' : 'exit';\n this.#emitter.on(ev, cb);\n return () => {\n this.#emitter.removeListener(ev, cb);\n if (this.#emitter.listeners['exit'].length === 0 &&\n this.#emitter.listeners['afterExit'].length === 0) {\n this.unload();\n }\n };\n }\n load() {\n if (this.#loaded) {\n return;\n }\n this.#loaded = true;\n // This is the number of onSignalExit's that are in play.\n // It's important so that we can count the correct number of\n // listeners on signals, and don't wait for the other one to\n // handle it instead of us.\n this.#emitter.count += 1;\n for (const sig of signals) {\n try {\n const fn = this.#sigListeners[sig];\n if (fn)\n this.#process.on(sig, fn);\n }\n catch (_) { }\n }\n this.#process.emit = (ev, ...a) => {\n return this.#processEmit(ev, ...a);\n };\n this.#process.reallyExit = (code) => {\n return this.#processReallyExit(code);\n };\n }\n unload() {\n if (!this.#loaded) {\n return;\n }\n this.#loaded = false;\n signals.forEach(sig => {\n const listener = this.#sigListeners[sig];\n /* c8 ignore start */\n if (!listener) {\n throw new Error('Listener not defined for signal: ' + sig);\n }\n /* c8 ignore stop */\n try {\n this.#process.removeListener(sig, listener);\n /* c8 ignore start */\n }\n catch (_) { }\n /* c8 ignore stop */\n });\n this.#process.emit = this.#originalProcessEmit;\n this.#process.reallyExit = this.#originalProcessReallyExit;\n this.#emitter.count -= 1;\n }\n #processReallyExit(code) {\n /* c8 ignore start */\n if (!processOk(this.#process)) {\n return 0;\n }\n this.#process.exitCode = code || 0;\n /* c8 ignore stop */\n this.#emitter.emit('exit', this.#process.exitCode, null);\n return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);\n }\n #processEmit(ev, ...args) {\n const og = this.#originalProcessEmit;\n if (ev === 'exit' && processOk(this.#process)) {\n if (typeof args[0] === 'number') {\n this.#process.exitCode = args[0];\n /* c8 ignore start */\n }\n /* c8 ignore start */\n const ret = og.call(this.#process, ev, ...args);\n /* c8 ignore start */\n this.#emitter.emit('exit', this.#process.exitCode, null);\n /* c8 ignore stop */\n return ret;\n }\n else {\n return og.call(this.#process, ev, ...args);\n }\n }\n}\nconst process = globalThis.process;\n// wrap so that we call the method on the actual handler, without\n// exporting it directly.\nexport const { \n/**\n * Called when the process is exiting, whether via signal, explicit\n * exit, or running out of stuff to do.\n *\n * If the global process object is not suitable for instrumentation,\n * then this will be a no-op.\n *\n * Returns a function that may be used to unload signal-exit.\n */\nonExit, \n/**\n * Load the listeners. Likely you never need to call this, unless\n * doing a rather deep integration with signal-exit functionality.\n * Mostly exposed for the benefit of testing.\n *\n * @internal\n */\nload, \n/**\n * Unload the listeners. Likely you never need to call this, unless\n * doing a rather deep integration with signal-exit functionality.\n * Mostly exposed for the benefit of testing.\n *\n * @internal\n */\nunload, } = signalExitWrap(processOk(process) ? new SignalExit(process) : new SignalExitFallback());\n//# sourceMappingURL=index.js.map","import process from 'node:process';\nimport onetime from 'onetime';\nimport {onExit} from 'signal-exit';\n\nconst terminal = process.stderr.isTTY\n\t? process.stderr\n\t: (process.stdout.isTTY ? process.stdout : undefined);\n\nconst restoreCursor = terminal ? onetime(() => {\n\tonExit(() => {\n\t\tterminal.write('\\u001B[?25h');\n\t}, {alwaysLast: true});\n}) : () => {};\n\nexport default restoreCursor;\n","import { appendFileSync } from 'node:fs';\nimport type { Writable } from 'node:stream';\nimport { stripVTControlCharacters } from 'node:util';\nimport restoreCursor from 'restore-cursor';\n\nconst DEFAULT_RENDER_INTERVAL = 160;\n\nconst ESC = '\\x1B[';\nconst CLEAR_LINE = `${ESC}K`;\nconst MOVE_CURSOR_ONE_ROW_UP = `${ESC}1A`;\nconst HIDE_CURSOR = `${ESC}?25l`;\nconst SHOW_CURSOR = `${ESC}?25h`;\nconst SYNC_START = `${ESC}?2026h`;\nconst SYNC_END = `${ESC}?2026l`;\n\ninterface Options {\n outputStream: Writable;\n errorStream: Writable;\n interval?: number;\n getWindow: () => string[];\n}\n\ntype StreamType = 'output' | 'error';\n\n/**\n * Renders content of `getWindow` at the bottom of the terminal and\n * forwards all other intercepted `stdout` and `stderr` logs above it.\n */\nexport class TTYWindowRenderer {\n private options: Required<Options>;\n private streams!: Record<StreamType, Writable['write']>;\n private buffer: { type: StreamType; message: string }[] = [];\n private renderInterval: NodeJS.Timeout | undefined = undefined;\n\n private windowHeight = 0;\n private finished = false;\n private cleanups: (() => void)[] = [];\n\n constructor(options: Options) {\n this.options = {\n interval: DEFAULT_RENDER_INTERVAL,\n ...options,\n };\n\n this.streams = {\n output: options.outputStream.write.bind(options.outputStream),\n error: options.errorStream.write.bind(options.errorStream),\n };\n\n this.cleanups.push(\n this.interceptStream(process.stdout, 'output'),\n this.interceptStream(process.stderr, 'error'),\n );\n\n restoreCursor();\n this.write(HIDE_CURSOR, 'output');\n\n this.start();\n }\n\n start() {\n this.finished = false;\n this.renderInterval = setInterval(\n () => this.flushBuffer(),\n this.options.interval,\n );\n }\n\n stop() {\n this.flushBuffer();\n // this.clearWindow();\n this.write(SHOW_CURSOR, 'output');\n this.cleanups.splice(0).map((fn) => fn());\n clearInterval(this.renderInterval);\n }\n\n /**\n * Write all buffered output and stop buffering.\n * All intercepted writes are forwarded to actual write after this.\n */\n finish() {\n this.finished = true;\n this.flushBuffer();\n clearInterval(this.renderInterval);\n }\n\n private flushBuffer() {\n if (this.buffer.length === 0) {\n return this.render();\n }\n\n let current;\n\n // Concatenate same types into a single render\n for (const next of this.buffer.splice(0)) {\n if (!current) {\n current = next;\n continue;\n }\n\n if (current.type !== next.type) {\n this.render(current.message, current.type);\n current = next;\n continue;\n }\n\n current.message += next.message;\n }\n\n if (current) {\n this.render(current?.message, current?.type);\n }\n }\n\n private render(message?: string, type: StreamType = 'output') {\n if (this.finished) {\n this.clearWindow();\n return this.write(message || '', type);\n }\n\n const windowContent = this.options.getWindow();\n const rowCount = getRenderedRowCount(\n windowContent,\n this.options.outputStream,\n );\n let padding = this.windowHeight - rowCount;\n\n if (padding > 0 && message) {\n padding -= getRenderedRowCount([message], this.options.outputStream);\n }\n\n this.write(SYNC_START);\n this.clearWindow();\n\n if (message) {\n this.write(message, type);\n }\n\n if (padding > 0) {\n this.write('\\n'.repeat(padding));\n }\n\n this.write(windowContent.join('\\n'));\n this.write(SYNC_END);\n\n this.windowHeight = rowCount + Math.max(0, padding);\n }\n\n private clearWindow() {\n if (this.windowHeight === 0) {\n return;\n }\n\n this.write(CLEAR_LINE);\n\n for (let i = 1; i < this.windowHeight; i++) {\n this.write(`${MOVE_CURSOR_ONE_ROW_UP}${CLEAR_LINE}`);\n }\n\n this.windowHeight = 0;\n }\n\n private interceptStream(stream: NodeJS.WriteStream, type: StreamType) {\n const original = stream.write;\n\n // @ts-expect-error -- not sure how 2 overloads should be typed\n stream.write = (chunk, _, callback) => {\n if (chunk) {\n if (this.finished) {\n this.write(chunk.toString(), type);\n } else {\n this.buffer.push({ type, message: chunk.toString() });\n }\n }\n callback?.();\n };\n\n return function restore() {\n stream.write = original;\n };\n }\n\n private write(message: string, type: 'output' | 'error' = 'output') {\n (this.streams[type] as Writable['write'])(message);\n }\n}\n\n/** Calculate the actual row count needed to render `rows` into `stream` */\nfunction getRenderedRowCount(\n contents: string[],\n stream: Options['outputStream'],\n) {\n let count = 0;\n const columns = 'columns' in stream ? (stream.columns as number) : 80;\n\n for (const content of contents) {\n const rows = content.split('\\n');\n for (const row of rows) {\n const text = stripVTControlCharacters(row);\n count += Math.max(1, Math.ceil(text.length / columns));\n }\n }\n\n return count;\n}\n","import { readFileSync } from 'node:fs';\nimport type {\n MidsceneYamlConfigResult,\n MidsceneYamlScript,\n MidsceneYamlScriptAndroidEnv,\n MidsceneYamlScriptEnv,\n MidsceneYamlScriptIOSEnv,\n MidsceneYamlScriptWebEnv,\n} from '@midscene/core';\nimport { type ScriptPlayer, parseYamlScript } from '@midscene/core/yaml';\nimport {\n buildChromeArgs,\n defaultViewportHeight,\n defaultViewportWidth,\n} from '@midscene/web/puppeteer-agent-launcher';\n\nimport merge from 'lodash.merge';\nimport pLimit from 'p-limit';\nimport puppeteer, { type Browser, type Page } from 'puppeteer';\nimport { createYamlPlayer } from './create-yaml-player';\nimport {\n createExecutedYamlResult,\n createNotExecutedYamlResult,\n printExecutionFinished,\n printExecutionPlan,\n writeExecutionSummaryFile,\n} from './execution-summary';\nimport {\n type MidsceneYamlFileContext,\n contextInfo,\n contextTaskListSummary,\n isTTY,\n spinnerInterval,\n} from './printer';\nimport { TTYWindowRenderer } from './tty-renderer';\n\nexport interface BatchRunnerConfig {\n files: string[];\n concurrent: number;\n continueOnError: boolean;\n /**\n * Number of extra attempts for a failed yaml file. Mapped to Rstest's\n * `retry` option, so only the cases that failed in the previous attempt\n * are re-executed. Defaults to 0 (no retry).\n */\n retry?: number;\n summary: string;\n shareBrowserContext: boolean;\n globalConfig?: {\n web?: Partial<MidsceneYamlScriptWebEnv>;\n android?: Partial<MidsceneYamlScriptAndroidEnv>;\n ios?: Partial<MidsceneYamlScriptIOSEnv>;\n target?: Partial<MidsceneYamlScriptWebEnv>;\n };\n headed: boolean;\n keepWindow: boolean;\n dotenvOverride: boolean;\n dotenvDebug: boolean;\n}\n\ninterface BatchFileContext {\n file: string;\n executionConfig: MidsceneYamlScript;\n outputPath?: string;\n options: {\n headed?: boolean;\n keepWindow?: boolean;\n browser?: Browser;\n page?: Page;\n };\n}\n\nexport interface RunYamlBatchOptions {\n generateSummary?: boolean;\n printExecutionPlan?: boolean;\n}\n\nclass YamlBatchExecutor {\n private config: BatchRunnerConfig;\n private results: MidsceneYamlConfigResult[] = [];\n\n constructor(config: BatchRunnerConfig) {\n this.config = config;\n }\n\n async run(\n options: RunYamlBatchOptions = {},\n ): Promise<MidsceneYamlConfigResult[]> {\n const generateSummary = options.generateSummary ?? true;\n const shouldPrintExecutionPlan = options.printExecutionPlan ?? true;\n const { keepWindow, headed } = this.config;\n\n // Print execution plan\n if (shouldPrintExecutionPlan) {\n printExecutionPlan(this.config);\n }\n\n // Prepare file contexts\n const fileContextList: BatchFileContext[] = [];\n let browser: Browser | null = null;\n let sharedPage: Page | null = null;\n\n try {\n // First, create all file contexts without a browser instance\n for (const file of this.config.files) {\n const fileConfig = await this.loadFileConfig(file);\n const context = await this.createFileContext(file, fileConfig, {\n headed,\n keepWindow,\n });\n fileContextList.push(context);\n }\n\n // Now, check if any of the tasks require a web browser\n const needsBrowser = fileContextList.some(\n (ctx) =>\n Object.keys(\n ctx.executionConfig.web || ctx.executionConfig.target || {},\n ).length > 0,\n );\n\n if (needsBrowser && this.config.shareBrowserContext) {\n const globalWebConfig = this.config.globalConfig?.web;\n\n if (globalWebConfig?.cdpEndpoint) {\n // CDP mode: connect to an existing browser\n browser = await puppeteer.connect({\n browserWSEndpoint: globalWebConfig.cdpEndpoint,\n defaultViewport: null,\n });\n } else {\n // Extract viewport dimensions from global config or use defaults\n // This should match the logic in launchPuppeteerPage\n const width = globalWebConfig?.viewportWidth ?? defaultViewportWidth;\n const height =\n globalWebConfig?.viewportHeight ?? defaultViewportHeight;\n\n const args = buildChromeArgs({\n userAgent: globalWebConfig?.userAgent,\n // Only pass windowSize in headed mode; in headless mode, defaultViewport takes precedence\n windowSize: headed ? { width, height } : undefined,\n chromeArgs: globalWebConfig?.chromeArgs,\n });\n\n browser = await puppeteer.launch({\n headless: !headed,\n defaultViewport: headed ? null : { width, height },\n args,\n acceptInsecureCerts: globalWebConfig?.acceptInsecureCerts,\n });\n }\n\n // Create a shared page instance that will be reused across all YAML files\n // This ensures localStorage and sessionStorage are preserved between files\n sharedPage = await browser.newPage();\n\n // Assign the browser instance and shared page to all contexts\n for (const context of fileContextList) {\n context.options.browser = browser;\n context.options.page = sharedPage;\n }\n }\n\n // Execute files\n const { executedResults, notExecutedContexts } =\n await this.executeFiles(fileContextList);\n\n // Process results\n this.results = await this.processResults(\n executedResults,\n notExecutedContexts,\n );\n } finally {\n if (browser && !this.config.keepWindow) {\n // For CDP mode, disconnect instead of closing the externally managed browser\n const isCdp = !!this.config.globalConfig?.web?.cdpEndpoint;\n if (isCdp) {\n browser.disconnect();\n } else {\n await browser.close();\n }\n }\n if (generateSummary) {\n await this.generateOutputIndex();\n }\n }\n\n return this.results;\n }\n\n private async createFileContext(\n file: string,\n fileConfig: MidsceneYamlScript,\n options: { headed?: boolean; keepWindow?: boolean; browser?: Browser },\n ): Promise<BatchFileContext> {\n const { globalConfig } = this.config;\n\n // Deep clone to avoid mutation\n const clonedFileConfig = JSON.parse(JSON.stringify(fileConfig));\n\n // Normalize deprecated 'target' to 'web'\n if (clonedFileConfig.target) {\n clonedFileConfig.web = {\n ...clonedFileConfig.target,\n ...clonedFileConfig.web,\n };\n // biome-ignore lint/performance/noDelete: <explanation>\n delete clonedFileConfig.target;\n }\n if (globalConfig?.target) {\n globalConfig.web = { ...globalConfig.target, ...globalConfig.web };\n // biome-ignore lint/performance/noDelete: <explanation>\n delete globalConfig.target;\n }\n\n // Start with the file's config, then merge the global config from the index file,\n // which has already been merged with command-line options.\n const executionConfig = merge(clonedFileConfig, globalConfig);\n\n return {\n file,\n executionConfig,\n options,\n };\n }\n\n private async executeFiles(fileContextList: BatchFileContext[]): Promise<{\n executedResults: Array<MidsceneYamlFileContext & { duration: number }>;\n notExecutedContexts: Array<{\n file: string;\n player: ScriptPlayer<MidsceneYamlScriptEnv>;\n }>;\n }> {\n const executedResults: Array<\n MidsceneYamlFileContext & { duration: number }\n > = [];\n const notExecutedContexts: Array<{\n file: string;\n player: ScriptPlayer<MidsceneYamlScriptEnv>;\n }> = [];\n\n // Pre-create all player contexts for displaying task lists\n const allFileContexts: MidsceneYamlFileContext[] = [];\n for (const context of fileContextList) {\n // Create a ScriptPlayer that will be used for actual execution\n const player = await createYamlPlayer(\n context.file,\n context.executionConfig,\n context.options,\n );\n allFileContexts.push({\n file: context.file,\n player,\n });\n }\n\n // Setup TTY renderer\n let ttyRenderer: TTYWindowRenderer | undefined;\n if (isTTY) {\n const summaryContents = () => {\n const summary: string[] = [''];\n for (const context of allFileContexts) {\n summary.push(\n contextTaskListSummary(context.player.taskStatusList, context),\n );\n }\n summary.push('');\n return summary;\n };\n ttyRenderer = new TTYWindowRenderer({\n outputStream: process.stdout,\n errorStream: process.stderr,\n getWindow: summaryContents,\n interval: spinnerInterval,\n });\n ttyRenderer.start();\n }\n\n try {\n // Helper function to execute a single file\n const executeFile = async (\n context: BatchFileContext,\n ): Promise<MidsceneYamlFileContext & { duration: number }> => {\n // Find the corresponding player in allFileContexts\n const allFileContext = allFileContexts.find(\n (c) => c.file === context.file,\n );\n if (!allFileContext) {\n throw new Error(`Player not found for file: ${context.file}`);\n }\n\n if (!isTTY) {\n const { mergedText } = contextInfo(allFileContext);\n console.log(mergedText);\n }\n\n // Set output path if specified\n if (context.outputPath) {\n allFileContext.player.output = context.outputPath;\n }\n\n // Record start time\n const startTime = Date.now();\n\n // Run the player\n await allFileContext.player.run();\n\n // Calculate duration\n const endTime = Date.now();\n const duration = endTime - startTime;\n\n const executedContext: MidsceneYamlFileContext & { duration: number } =\n {\n file: context.file,\n player: allFileContext.player,\n duration,\n };\n\n if (!isTTY) {\n console.log(\n contextTaskListSummary(\n allFileContext.player.taskStatusList,\n executedContext,\n ),\n );\n }\n\n return executedContext;\n };\n\n // Execute based on concurrency and error handling settings\n await this.executeConcurrently(\n fileContextList,\n executeFile,\n executedResults,\n notExecutedContexts,\n );\n\n // Print final summary for non-TTY mode\n if (!isTTY) {\n console.log('\\n📋 Execution Results:');\n for (const context of executedResults) {\n console.log(\n contextTaskListSummary(context.player.taskStatusList, context),\n );\n }\n }\n } finally {\n if (ttyRenderer) {\n ttyRenderer.stop();\n }\n }\n\n return { executedResults, notExecutedContexts };\n }\n\n private async executeConcurrently(\n fileContextList: BatchFileContext[],\n executeFile: (\n context: BatchFileContext,\n ) => Promise<MidsceneYamlFileContext & { duration: number }>,\n executedResults: Array<MidsceneYamlFileContext & { duration: number }>,\n notExecutedContexts: Array<{\n file: string;\n player: ScriptPlayer<MidsceneYamlScriptEnv> | null;\n }>,\n ): Promise<void> {\n const limit = pLimit(this.config.concurrent);\n\n if (this.config.continueOnError) {\n // Execute all tasks with concurrency\n const tasks = fileContextList.map((context) =>\n limit(async () => {\n const executedContext = await executeFile(context);\n executedResults.push(executedContext);\n }),\n );\n await Promise.allSettled(tasks);\n } else {\n // Execute with concurrency but stop new tasks when failure occurs\n let shouldStop = false;\n const stopLock = { value: false };\n\n const tasks = fileContextList.map((context) =>\n limit(async () => {\n if (stopLock.value) {\n notExecutedContexts.push({\n file: context.file,\n player: null,\n });\n return;\n }\n\n const executedContext = await executeFile(context);\n executedResults.push(executedContext);\n\n if (executedContext.player.status === 'error' && !stopLock.value) {\n stopLock.value = true;\n shouldStop = true;\n }\n }),\n );\n\n await Promise.allSettled(tasks);\n\n // Handle not executed contexts\n if (shouldStop) {\n for (const context of fileContextList) {\n if (\n !executedResults.some((r) => r.file === context.file) &&\n !notExecutedContexts.some((ctx) => ctx.file === context.file)\n ) {\n notExecutedContexts.push({ file: context.file, player: null });\n }\n }\n }\n }\n }\n\n private async processResults(\n executedContexts: Array<MidsceneYamlFileContext & { duration: number }>,\n notExecutedContexts: Array<{\n file: string;\n player: ScriptPlayer<MidsceneYamlScriptEnv> | null;\n }>,\n ): Promise<MidsceneYamlConfigResult[]> {\n const results: MidsceneYamlConfigResult[] = [];\n\n for (const context of executedContexts) {\n const { file, player, duration } = context;\n results.push(createExecutedYamlResult({ file, player, duration }));\n }\n\n for (const context of notExecutedContexts) {\n results.push(createNotExecutedYamlResult(context.file));\n }\n\n return results;\n }\n\n private async loadFileConfig(file: string): Promise<MidsceneYamlScript> {\n const content = readFileSync(file, 'utf8');\n return parseYamlScript(content, file);\n }\n\n private async generateOutputIndex(): Promise<void> {\n try {\n writeExecutionSummaryFile(this.config.summary, this.results);\n printExecutionFinished();\n } catch (error) {\n console.error('Failed to generate output index:', error);\n }\n }\n}\n\nexport async function runYamlBatch(\n config: BatchRunnerConfig,\n options: RunYamlBatchOptions = {},\n): Promise<MidsceneYamlConfigResult[]> {\n return new YamlBatchExecutor(config).run(options);\n}\n","import { mkdirSync, writeFileSync } from 'node:fs';\nimport { dirname, resolve } from 'node:path';\nimport type { MidsceneYamlConfigResult } from '@midscene/core';\nimport { type BatchRunnerConfig, runYamlBatch } from '../yaml-batch-executor';\n\nexport interface RunYamlBatchInRstestOptions {\n config: BatchRunnerConfig;\n resultFiles: Record<string, string>;\n}\n\nconst writeResultFile = (\n resultFile: string,\n data: MidsceneYamlConfigResult,\n) => {\n mkdirSync(dirname(resultFile), { recursive: true });\n writeFileSync(resultFile, JSON.stringify(data, null, 2));\n};\n\nconst batchFailureMessage = (results: MidsceneYamlConfigResult[]): string => {\n const failed = results.filter((result) => !result.success);\n return failed\n .map((result) => `${result.file}: ${result.error || result.resultType}`)\n .join('\\n');\n};\n\nexport async function runYamlBatchInRstest(\n options: RunYamlBatchInRstestOptions,\n): Promise<MidsceneYamlConfigResult[]> {\n const results = await runYamlBatch(options.config, {\n generateSummary: false,\n printExecutionPlan: false,\n });\n\n for (const result of results) {\n const resultFile =\n options.resultFiles[result.file] ||\n options.resultFiles[resolve(result.file)];\n if (resultFile) {\n writeResultFile(resultFile, result);\n }\n }\n\n if (results.some((result) => !result.success)) {\n throw new Error(batchFailureMessage(results));\n }\n\n return results;\n}\n","import { existsSync, readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport type {\n MidsceneYamlConfigResult,\n MidsceneYamlScript,\n MidsceneYamlScriptAndroidEnv,\n MidsceneYamlScriptEnv,\n MidsceneYamlScriptIOSEnv,\n MidsceneYamlScriptWebEnv,\n ScriptPlayerTaskStatus,\n} from '@midscene/core';\nimport { type ScriptPlayer, parseYamlScript } from '@midscene/core/yaml';\nimport merge from 'lodash.merge';\nimport { createYamlPlayer } from '../create-yaml-player';\n\nexport interface RunYamlCaseGlobalConfig {\n web?: Partial<MidsceneYamlScriptWebEnv>;\n android?: Partial<MidsceneYamlScriptAndroidEnv>;\n ios?: Partial<MidsceneYamlScriptIOSEnv>;\n target?: Partial<MidsceneYamlScriptWebEnv>;\n}\n\nexport interface RunYamlCaseOptions {\n file: string;\n executionConfig?: MidsceneYamlScript;\n globalConfig?: RunYamlCaseGlobalConfig;\n headed?: boolean;\n keepWindow?: boolean;\n}\n\nexport interface RunYamlCaseResult {\n file: string;\n output?: string;\n report?: string | null;\n duration: number;\n}\n\nconst taskErrorMessage = (task: ScriptPlayerTaskStatus): string | undefined => {\n if (task.error?.message) {\n return task.error.message;\n }\n\n if (task.status === 'error') {\n return `Task \"${task.name}\" failed`;\n }\n\n return undefined;\n};\n\nconst cloneJson = <T>(value: T): T => JSON.parse(JSON.stringify(value)) as T;\n\nconst normalizeTargetConfig = (\n config: MidsceneYamlScript | RunYamlCaseGlobalConfig,\n) => {\n if (config.target) {\n config.web = {\n ...config.target,\n ...config.web,\n };\n config.target = undefined;\n }\n};\n\nconst createExecutionConfig = (\n file: string,\n globalConfig: RunYamlCaseGlobalConfig,\n): MidsceneYamlScript => {\n const content = readFileSync(file, 'utf8');\n const fileConfig = cloneJson(parseYamlScript(content, file));\n normalizeTargetConfig(fileConfig);\n\n const clonedGlobalConfig = cloneJson(globalConfig);\n normalizeTargetConfig(clonedGlobalConfig);\n\n return merge(fileConfig, clonedGlobalConfig);\n};\n\nexport const getYamlPlayerFailure = (\n player: ScriptPlayer<MidsceneYamlScriptEnv>,\n): Error | undefined => {\n if (player.errorInSetup) {\n return player.errorInSetup;\n }\n\n const failedMessages =\n player.taskStatusList?.map(taskErrorMessage).filter(Boolean) || [];\n\n if (player.status === 'error' || failedMessages.length > 0) {\n const details = failedMessages.length\n ? failedMessages.join('; ')\n : 'YAML case failed';\n const reportLine = player.reportFile\n ? `\\nReport: ${player.reportFile}`\n : '';\n const outputLine = player.output ? `\\nOutput: ${player.output}` : '';\n return new Error(`${details}${reportLine}${outputLine}`);\n }\n\n return undefined;\n};\n\nexport const createYamlCaseResult = (\n file: string,\n player: ScriptPlayer<MidsceneYamlScriptEnv>,\n duration: number,\n): MidsceneYamlConfigResult => {\n const hasFailedTasks =\n player.taskStatusList?.some((task) => task.status === 'error') ?? false;\n const hasPlayerError = player.status === 'error';\n\n const outputPath =\n player.output && existsSync(player.output) ? player.output : undefined;\n const reportFile = player.reportFile || undefined;\n\n let errorMessage: string | undefined;\n if (player.errorInSetup?.message) {\n errorMessage = player.errorInSetup.message;\n } else if (hasPlayerError || hasFailedTasks) {\n const taskErrors = player.taskStatusList\n ?.filter((task) => task.status === 'error' && task.error?.message)\n .map((task) => task.error!.message);\n if (taskErrors && taskErrors.length > 0) {\n errorMessage = taskErrors.join('; ');\n } else if (hasPlayerError) {\n errorMessage = 'Execution failed';\n } else {\n errorMessage = 'Some tasks failed';\n }\n }\n\n const resultType = hasPlayerError\n ? 'failed'\n : hasFailedTasks\n ? 'partialFailed'\n : 'success';\n\n return {\n file,\n success: resultType === 'success',\n executed: true,\n output: outputPath,\n report: reportFile,\n duration,\n resultType,\n error: errorMessage,\n };\n};\n\nexport const createYamlCaseFailure = (\n result: MidsceneYamlConfigResult,\n): Error => {\n const reportLine = result.report ? `\\nReport: ${result.report}` : '';\n const outputLine = result.output ? `\\nOutput: ${result.output}` : '';\n return new Error(\n `${result.error || 'YAML case failed'}${reportLine}${outputLine}`,\n );\n};\n\nexport async function runYamlCaseResult(\n options: RunYamlCaseOptions,\n): Promise<MidsceneYamlConfigResult> {\n const file = resolve(options.file);\n const startTime = Date.now();\n const executionConfig =\n options.executionConfig ||\n (options.globalConfig\n ? createExecutionConfig(file, options.globalConfig)\n : undefined);\n const player = await createYamlPlayer(file, executionConfig, {\n headed: options.headed,\n keepWindow: options.keepWindow,\n });\n\n await player.run();\n\n return createYamlCaseResult(file, player, Date.now() - startTime);\n}\n\nexport async function runYamlCase(\n options: RunYamlCaseOptions,\n): Promise<RunYamlCaseResult> {\n const result = await runYamlCaseResult(options);\n if (!result.success) {\n throw createYamlCaseFailure(result);\n }\n\n return {\n file: result.file,\n output: result.output || undefined,\n report: result.report,\n duration: result.duration || 0,\n };\n}\n","import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { dirname, resolve } from 'node:path';\nimport type {\n MidsceneYamlConfigAttempt,\n MidsceneYamlConfigResult,\n} from '@midscene/core';\nimport type { test as rstestTest } from '@rstest/core';\nimport type { BatchRunnerConfig } from '../batch-runner';\nimport { runYamlBatchInRstest } from './yaml-batch';\nimport {\n type RunYamlCaseOptions,\n createYamlCaseFailure,\n runYamlCaseResult,\n} from './yaml-case';\n\nexport type RstestTest = typeof rstestTest;\n\nexport interface DefineYamlCaseTestOptions {\n testName: string;\n yamlFile: string;\n resultFile: string;\n caseOptions?: Omit<RunYamlCaseOptions, 'file' | 'headed' | 'keepWindow'>;\n webRuntimeOptions?: Pick<RunYamlCaseOptions, 'headed' | 'keepWindow'>;\n}\n\nexport interface DefineYamlBatchTestOptions {\n testName: string;\n config: BatchRunnerConfig;\n resultFiles: Record<string, string>;\n}\n\nconst errorMessageOf = (error: unknown): string =>\n error instanceof Error ? error.message : String(error);\n\nconst writeResultFile = (\n resultFile: string,\n data: MidsceneYamlConfigResult,\n) => {\n mkdirSync(dirname(resultFile), { recursive: true });\n writeFileSync(resultFile, JSON.stringify(data, null, 2));\n};\n\nconst attemptHistoryFileFor = (resultFile: string): string =>\n `${resultFile}.attempts.json`;\n\nconst readAttemptHistory = (\n resultFile: string,\n): MidsceneYamlConfigAttempt[] => {\n const attemptHistoryFile = attemptHistoryFileFor(resultFile);\n if (!existsSync(attemptHistoryFile)) return [];\n\n return JSON.parse(\n readFileSync(attemptHistoryFile, 'utf8'),\n ) as MidsceneYamlConfigAttempt[];\n};\n\nconst toAttemptResult = (\n result: MidsceneYamlConfigResult,\n attempt: number,\n): MidsceneYamlConfigAttempt => ({\n attempt,\n success: result.success,\n output: result.output,\n report: result.report,\n error: result.error,\n duration: result.duration,\n resultType: result.resultType,\n});\n\nconst appendAttemptHistory = (\n resultFile: string,\n result: MidsceneYamlConfigResult,\n): MidsceneYamlConfigResult => {\n const attempts = readAttemptHistory(resultFile);\n const nextAttempts = [\n ...attempts,\n toAttemptResult(result, attempts.length + 1),\n ];\n\n mkdirSync(dirname(resultFile), { recursive: true });\n writeFileSync(\n attemptHistoryFileFor(resultFile),\n JSON.stringify(nextAttempts, null, 2),\n );\n\n return {\n ...result,\n attempts: nextAttempts,\n };\n};\n\nconst createRuntimeFailureResult = (\n file: string,\n startTime: number,\n error: unknown,\n): MidsceneYamlConfigResult => ({\n file,\n success: false,\n executed: true,\n duration: Date.now() - startTime,\n resultType: 'failed',\n error: errorMessageOf(error),\n});\n\nexport const defineYamlCaseTest = (\n test: RstestTest,\n options: DefineYamlCaseTestOptions,\n) => {\n test(options.testName, async () => {\n const file = resolve(options.yamlFile);\n const startTime = Date.now();\n let result: MidsceneYamlConfigResult | undefined;\n\n try {\n result = await runYamlCaseResult({\n ...options.caseOptions,\n ...options.webRuntimeOptions,\n file,\n });\n result = appendAttemptHistory(options.resultFile, result);\n writeResultFile(options.resultFile, result);\n\n if (!result.success) {\n throw createYamlCaseFailure(result);\n }\n } catch (error) {\n if (!result) {\n const failureResult = appendAttemptHistory(\n options.resultFile,\n createRuntimeFailureResult(file, startTime, error),\n );\n writeResultFile(options.resultFile, failureResult);\n }\n throw error;\n }\n });\n};\n\nexport const defineYamlBatchTest = (\n test: RstestTest,\n options: DefineYamlBatchTestOptions,\n) => {\n test(options.testName, async () => {\n await runYamlBatchInRstest({\n config: options.config,\n resultFiles: options.resultFiles,\n });\n });\n};\n"],"names":["wrapAnsi16","fn","offset","args","code","wrapAnsi256","wrapAnsi16m","rgb","ansi2ansi","n","rgb2rgb","r","g","b","setLazyProperty","object","property","get","Object","value","colorConvert","makeDynamicStyles","wrap","targetSpace","identity","isBackground","styles","sourceSpace","suite","name","assembleStyles","codes","Map","groupName","group","styleName","style","module","ansiStyles","stdoutColor","stderrColor","stringReplaceAll","stringEncaseCRLFWithFirstIndex","isArray","Array","levelMapping","applyOptions","options","Number","Error","colorLevel","ChalkClass","chalkFactory","chalk","arguments_","chalkTag","Chalk","builder","createBuilder","createStyler","usedModels","model","level","styler","bgModel","proto","open","close","parent","openAll","closeAll","self","_styler","_isEmpty","applyStyle","string","lfIndex","template","strings","firstString","parts","i","String","TEMPLATE_REGEX","STYLE_REGEX","STRING_REGEX","ESCAPE_REGEX","ESCAPES","unescape","c","u","bracket","parseInt","parseArguments","results","chunks","matches","chunk","number","m","escape","character","parseStyle","buildStyle","enabled","layer","current","temporary","escapeCharacter","inverse","errMessage","substring","replacer","index","substringLength","endIndex","returnValue","prefix","postfix","gotCR","cssKeywords","reverseKeywords","key","convert","channels","labels","min","Math","max","delta","h","s","l","rdif","gdif","bdif","v","diff","diffc","w","k","y","comparativeDistance","x","reversed","currentClosestDistance","currentClosestKeyword","keyword","distance","z","xyz","a","hsl","t2","t3","val","t1","smin","lmin","sv","hsv","hi","f","p","q","t","vmin","sl","hwb","wh","bl","ratio","cmyk","lab","y2","x2","z2","hr","lch","saturation","ansi","color","mult","rem","integer","match","colorString","char","chroma","grayscale","hue","hcg","pure","mg","apple","gray","conversions","route","models","wrapRaw","wrappedFn","arg0","wrapRounded","result","len","fromModel","routes","routeModels","toModel","buildGraph","graph","deriveBFS","queue","adjacents","adjacent","node","link","from","to","wrapConversion","path","cur","conversion","flag","argv","process","position","terminatorPosition","os","tty","hasFlag","env","forceColor","translateLevel","supportsColor","haveStream","streamIsTTY","osRelease","sign","version","getSupportLevel","stream","__webpack_require__","getter","exports","definition","obj","prop","warnRetryReport","getDebug","notExecutedError","createNotExecutedYamlResult","file","undefined","createExecutedYamlResult","player","duration","hasFailedTasks","task","hasPlayerError","success","resultType","outputPath","existsSync","errorMessage","taskErrors","getExecutionSummary","getResultsByType","sum","getSummaryAbsolutePath","summary","resolve","getMidsceneRunSubDir","toOutputRelativePath","outputDir","filePath","relativePath","relative","toTestStatus","attempt","safeReportNamePart","createRetryReportName","fileName","basename","extname","fileHash","createHash","createRetryAttemptReport","attemptsWithReports","tool","ReportMergingTool","status","errorMessageOf","error","warnRetryReportFailure","message","mkdirSync","createRetryAttemptReportSafely","writeExecutionSummaryFile","indexPath","dirname","executionSummary","indexData","Date","retryReport","writeFileSync","JSON","printExecutionPlan","config","console","printExecutionFinished","printResultArtifacts","printExecutionSummary","summaryPath","successfulFiles","failedFiles","partialFailedFiles","notExecutedFiles","requireFromCliPackage","__dirname","createRequire","join","entry","resolvePackageFromRstestCore","packageName","require","rstestPackageJsonPath","resolveRstestCoreImportPath","DEFAULT_YAML_TEST_TIMEOUT","RSTEST_YAML_BATCH_TEST_MODULE","RSTEST_YAML_BATCH_TEST_NAME","toPosixPath","sep","toImportLiteral","toVirtualModuleId","fileStem","safeFileStem","base","resolveTestName","projectDir","yamlFile","createGeneratedTestContent","testOptions","createGeneratedBatchTestContent","resolveDefaultFrameworkImport","moduleDir","anchorDir","candidates","matched","Boolean","candidate","createRstestYamlProject","resultDir","frameworkImport","rstestCoreImport","testTimeout","rmSync","virtualModules","cases","testName","resultFile","testModule","resultFiles","item","batchTest","formatRunError","collectRunErrors","messages","push","label","formatted","testResult","Set","mapRunErrorsToCases","project","byTestName","errors","add","addAll","matchFileCase","isBatchFile","isBatchTest","fileCase","recordUnreportedCaseFailures","caseErrors","failure","runRstestYamlProject","runRstest","rspack","Promise","pathToFileURL","maxConcurrency","inlineConfig","_config","appendPlugins","runErrors","createCaseOptions","caseOptions","createWebRuntimeOptions","runtimeOptions","readProjectResults","readFileSync","runFrameworkTestConfig","commandOptions","runner","exitCode","Node","Queue","Symbol","pLimit","concurrency","validateConcurrency","activeCount","resumeNext","next","run","function_","enqueue","internalResolve","generator","newConcurrency","queueMicrotask","TypeError","debug","launchServer","dir","server","createServer","resolveReportFileName","yamlReportFileName","cliTestId","yamlTestId","baseName","getReportFileName","buildAgentOptions","yamlAgent","reportFileName","processCacheConfig","createYamlPlayer","script","yamlScript","parseYamlScript","clonedYamlScript","structuredClone","preference","ScriptPlayer","freeFn","webTarget","targetCount","specifiedTargets","localServer","urlToVisit","assert","serverAddress","cdpBrowser","puppeteer","agent","newFreeFn","puppeteerAgentForTarget","cleanFreeFn","bridgeUnsupportedKeys","ignoredKeys","AgentOverChromeBridge","androidTarget","agentFromAdbDevice","iosTarget","agentFromWebDriverAgent","harmonyTarget","agentFromHdcDevice","computerTarget","agentForComputer","interfaceTarget","moduleSpecifier","finalModuleSpecifier","resolvedPath","importedModule","DeviceClass","device","createAgent","isTTY","indent","spinnerInterval","spinnerFrames","currentSpinningFrame","indicatorForStatus","contextInfo","context","filePathToShow","fileNameToPrint","fileStatusText","contextActionText","errorText","outputFile","outputText","reportFile","reportText","agentStatusTip","agentStatusText","mergedText","singleTaskInfo","stepText","actionText","statusText","mergedLine","paddingLines","lines","line","contextTaskListSummary","taskStatusArray","prefixLines","currentLine","suffixText","fileInfo","copyProperty","ignoreNonConfigurable","toDescriptor","fromDescriptor","canCopyProperty","changePrototype","fromPrototype","wrappedToString","withName","fromBody","toStringDescriptor","Function","toStringName","changeToString","newToString","writable","enumerable","configurable","mimicFunction","Reflect","calledFunctions","WeakMap","callCount","functionName","onetime","signals","processOk","kExitEmitter","global","globalThis","ObjectDefineProperty","Emitter","ev","list","signal","ret","SignalExitBase","signalExitWrap","handler","cb","opts","SignalExitFallback","SignalExit","sig","listeners","count","_","listener","og","onExit","load","unload","terminal","restoreCursor","DEFAULT_RENDER_INTERVAL","ESC","CLEAR_LINE","MOVE_CURSOR_ONE_ROW_UP","HIDE_CURSOR","SHOW_CURSOR","SYNC_START","SYNC_END","TTYWindowRenderer","setInterval","clearInterval","type","windowContent","rowCount","getRenderedRowCount","padding","original","callback","contents","columns","content","rows","row","text","stripVTControlCharacters","YamlBatchExecutor","generateSummary","shouldPrintExecutionPlan","keepWindow","headed","fileContextList","browser","sharedPage","fileConfig","needsBrowser","ctx","globalWebConfig","width","defaultViewportWidth","height","defaultViewportHeight","buildChromeArgs","executedResults","notExecutedContexts","isCdp","globalConfig","clonedFileConfig","executionConfig","merge","allFileContexts","ttyRenderer","summaryContents","executeFile","allFileContext","startTime","endTime","executedContext","limit","tasks","shouldStop","stopLock","executedContexts","runYamlBatch","writeResultFile","data","batchFailureMessage","failed","runYamlBatchInRstest","taskErrorMessage","cloneJson","normalizeTargetConfig","createExecutionConfig","clonedGlobalConfig","getYamlPlayerFailure","failedMessages","details","reportLine","outputLine","createYamlCaseResult","createYamlCaseFailure","runYamlCaseResult","runYamlCase","attemptHistoryFileFor","readAttemptHistory","attemptHistoryFile","toAttemptResult","appendAttemptHistory","attempts","nextAttempts","createRuntimeFailureResult","defineYamlCaseTest","test","failureResult","defineYamlBatchTest"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;QAEA,MAAMA,aAAa,CAACC,IAAIC,SAAW,CAAC,GAAGC;gBACtC,MAAMC,OAAOH,MAAME;gBACnB,OAAO,CAAC,OAAO,EAAEC,OAAOF,OAAO,CAAC,CAAC;YAClC;QAEA,MAAMG,cAAc,CAACJ,IAAIC,SAAW,CAAC,GAAGC;gBACvC,MAAMC,OAAOH,MAAME;gBACnB,OAAO,CAAC,OAAO,EAAE,KAAKD,OAAO,GAAG,EAAEE,KAAK,CAAC,CAAC;YAC1C;QAEA,MAAME,cAAc,CAACL,IAAIC,SAAW,CAAC,GAAGC;gBACvC,MAAMI,MAAMN,MAAME;gBAClB,OAAO,CAAC,OAAO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