UNPKG

babel-plugin-react-compiler

Version:

Babel plugin for React Compiler.

1,542 lines (1,530 loc) 3.83 MB
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @lightSyntaxTransform * @noflow * @nolint * @preventMunge * @preserve-invariant-messages */ "use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __defProps = Object.defineProperties; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropDescs = Object.getOwnPropertyDescriptors; var __getOwnPropNames = Object.getOwnPropertyNames; var __getOwnPropSymbols = Object.getOwnPropertySymbols; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __propIsEnum = Object.prototype.propertyIsEnumerable; var __knownSymbol = (name, symbol2) => (symbol2 = Symbol[name]) ? symbol2 : Symbol.for("Symbol." + name); var __typeError = (msg) => { throw TypeError(msg); }; var __pow = Math.pow; var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value; var __spreadValues = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]); if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) { if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]); } return a; }; var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); var __esm = (fn, res) => function __init() { return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; }; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key2 of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key2) && key2 !== except) __defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var __publicField = (obj, key2, value) => __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value); var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg); var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)); var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value); var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value); var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method); var __privateWrapper = (obj, member, setter, getter) => ({ set _(value) { __privateSet(obj, member, value, setter); }, get _() { return __privateGet(obj, member, getter); } }); var __async = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; var __await = function(promise2, isYieldStar) { this[0] = promise2; this[1] = isYieldStar; }; var __yieldStar = (value) => { var obj = value[__knownSymbol("asyncIterator")], isAwait = false, method, it = {}; if (obj == null) { obj = value[__knownSymbol("iterator")](); method = (k) => it[k] = (x) => obj[k](x); } else { obj = obj.call(value); method = (k) => it[k] = (v) => { if (isAwait) { isAwait = false; if (k === "throw") throw v; return v; } isAwait = true; return { done: false, value: new __await(new Promise((resolve) => { var x = obj[k](v); if (!(x instanceof Object)) __typeError("Object expected"); resolve(x); }), 1) }; }; } return it[__knownSymbol("iterator")] = () => it, method("next"), "throw" in obj ? method("throw") : it.throw = (x) => { throw x; }, "return" in obj && method("return"), it; }; // node_modules/@babel/helpers/node_modules/@babel/traverse/lib/path/lib/virtual-types.js var require_virtual_types = __commonJS({ "node_modules/@babel/helpers/node_modules/@babel/traverse/lib/path/lib/virtual-types.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Var = exports2.User = exports2.Statement = exports2.SpreadProperty = exports2.Scope = exports2.RestProperty = exports2.ReferencedMemberExpression = exports2.ReferencedIdentifier = exports2.Referenced = exports2.Pure = exports2.NumericLiteralTypeAnnotation = exports2.Generated = exports2.ForAwaitStatement = exports2.Flow = exports2.Expression = exports2.ExistentialTypeParam = exports2.BlockScoped = exports2.BindingIdentifier = void 0; var ReferencedIdentifier = exports2.ReferencedIdentifier = ["Identifier", "JSXIdentifier"]; var ReferencedMemberExpression = exports2.ReferencedMemberExpression = ["MemberExpression"]; var BindingIdentifier = exports2.BindingIdentifier = ["Identifier"]; var Statement = exports2.Statement = ["Statement"]; var Expression = exports2.Expression = ["Expression"]; var Scope = exports2.Scope = ["Scopable", "Pattern"]; var Referenced = exports2.Referenced = null; var BlockScoped = exports2.BlockScoped = null; var Var = exports2.Var = ["VariableDeclaration"]; var User = exports2.User = null; var Generated = exports2.Generated = null; var Pure = exports2.Pure = null; var Flow = exports2.Flow = ["Flow", "ImportDeclaration", "ExportDeclaration", "ImportSpecifier"]; var RestProperty = exports2.RestProperty = ["RestElement"]; var SpreadProperty = exports2.SpreadProperty = ["RestElement"]; var ExistentialTypeParam = exports2.ExistentialTypeParam = ["ExistsTypeAnnotation"]; var NumericLiteralTypeAnnotation = exports2.NumericLiteralTypeAnnotation = ["NumberLiteralTypeAnnotation"]; var ForAwaitStatement = exports2.ForAwaitStatement = ["ForOfStatement"]; } }); // ../../node_modules/ms/index.js var require_ms = __commonJS({ "../../node_modules/ms/index.js"(exports2, module2) { "use strict"; var s = 1e3; var m = s * 60; var h = m * 60; var d = h * 24; var w = d * 7; var y = d * 365.25; module2.exports = function(val, options) { options = options || {}; var type = typeof val; if (type === "string" && val.length > 0) { return parse6(val); } else if (type === "number" && isFinite(val)) { return options.long ? fmtLong(val) : fmtShort(val); } throw new Error( "val is not a non-empty string or a valid number. val=" + JSON.stringify(val) ); }; function parse6(str) { str = String(str); if (str.length > 100) { return; } var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( str ); if (!match) { return; } var n = parseFloat(match[1]); var type = (match[2] || "ms").toLowerCase(); switch (type) { case "years": case "year": case "yrs": case "yr": case "y": return n * y; case "weeks": case "week": case "w": return n * w; case "days": case "day": case "d": return n * d; case "hours": case "hour": case "hrs": case "hr": case "h": return n * h; case "minutes": case "minute": case "mins": case "min": case "m": return n * m; case "seconds": case "second": case "secs": case "sec": case "s": return n * s; case "milliseconds": case "millisecond": case "msecs": case "msec": case "ms": return n; default: return void 0; } } function fmtShort(ms) { var msAbs = Math.abs(ms); if (msAbs >= d) { return Math.round(ms / d) + "d"; } if (msAbs >= h) { return Math.round(ms / h) + "h"; } if (msAbs >= m) { return Math.round(ms / m) + "m"; } if (msAbs >= s) { return Math.round(ms / s) + "s"; } return ms + "ms"; } function fmtLong(ms) { var msAbs = Math.abs(ms); if (msAbs >= d) { return plural(ms, msAbs, d, "day"); } if (msAbs >= h) { return plural(ms, msAbs, h, "hour"); } if (msAbs >= m) { return plural(ms, msAbs, m, "minute"); } if (msAbs >= s) { return plural(ms, msAbs, s, "second"); } return ms + " ms"; } function plural(ms, msAbs, n, name) { var isPlural = msAbs >= n * 1.5; return Math.round(ms / n) + " " + name + (isPlural ? "s" : ""); } } }); // ../../node_modules/debug/src/common.js var require_common = __commonJS({ "../../node_modules/debug/src/common.js"(exports2, module2) { "use strict"; function setup(env) { createDebug.debug = createDebug; createDebug.default = createDebug; createDebug.coerce = coerce; createDebug.disable = disable; createDebug.enable = enable; createDebug.enabled = enabled; createDebug.humanize = require_ms(); createDebug.destroy = destroy; Object.keys(env).forEach((key2) => { createDebug[key2] = env[key2]; }); createDebug.names = []; createDebug.skips = []; createDebug.formatters = {}; function selectColor(namespace) { let hash2 = 0; for (let i = 0; i < namespace.length; i++) { hash2 = (hash2 << 5) - hash2 + namespace.charCodeAt(i); hash2 |= 0; } return createDebug.colors[Math.abs(hash2) % createDebug.colors.length]; } createDebug.selectColor = selectColor; function createDebug(namespace) { let prevTime; let enableOverride = null; let namespacesCache; let enabledCache; function debug(...args) { if (!debug.enabled) { return; } const self2 = debug; const curr = Number(/* @__PURE__ */ new Date()); const ms = curr - (prevTime || curr); self2.diff = ms; self2.prev = prevTime; self2.curr = curr; prevTime = curr; args[0] = createDebug.coerce(args[0]); if (typeof args[0] !== "string") { args.unshift("%O"); } let index = 0; args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { if (match === "%%") { return "%"; } index++; const formatter = createDebug.formatters[format]; if (typeof formatter === "function") { const val = args[index]; match = formatter.call(self2, val); args.splice(index, 1); index--; } return match; }); createDebug.formatArgs.call(self2, args); const logFn = self2.log || createDebug.log; logFn.apply(self2, args); } debug.namespace = namespace; debug.useColors = createDebug.useColors(); debug.color = createDebug.selectColor(namespace); debug.extend = extend2; debug.destroy = createDebug.destroy; Object.defineProperty(debug, "enabled", { enumerable: true, configurable: false, get: () => { if (enableOverride !== null) { return enableOverride; } if (namespacesCache !== createDebug.namespaces) { namespacesCache = createDebug.namespaces; enabledCache = createDebug.enabled(namespace); } return enabledCache; }, set: (v) => { enableOverride = v; } }); if (typeof createDebug.init === "function") { createDebug.init(debug); } return debug; } function extend2(namespace, delimiter) { const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace); newDebug.log = this.log; return newDebug; } function enable(namespaces) { createDebug.save(namespaces); createDebug.namespaces = namespaces; createDebug.names = []; createDebug.skips = []; const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(" ", ",").split(",").filter(Boolean); for (const ns of split) { if (ns[0] === "-") { createDebug.skips.push(ns.slice(1)); } else { createDebug.names.push(ns); } } } function matchesTemplate(search, template) { let searchIndex = 0; let templateIndex = 0; let starIndex = -1; let matchIndex = 0; while (searchIndex < search.length) { if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) { if (template[templateIndex] === "*") { starIndex = templateIndex; matchIndex = searchIndex; templateIndex++; } else { searchIndex++; templateIndex++; } } else if (starIndex !== -1) { templateIndex = starIndex + 1; matchIndex++; searchIndex = matchIndex; } else { return false; } } while (templateIndex < template.length && template[templateIndex] === "*") { templateIndex++; } return templateIndex === template.length; } function disable() { const namespaces = [ ...createDebug.names, ...createDebug.skips.map((namespace) => "-" + namespace) ].join(","); createDebug.enable(""); return namespaces; } function enabled(name) { for (const skip of createDebug.skips) { if (matchesTemplate(name, skip)) { return false; } } for (const ns of createDebug.names) { if (matchesTemplate(name, ns)) { return true; } } return false; } function coerce(val) { if (val instanceof Error) { return val.stack || val.message; } return val; } function destroy() { console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."); } createDebug.enable(createDebug.load()); return createDebug; } module2.exports = setup; } }); // ../../node_modules/debug/src/browser.js var require_browser = __commonJS({ "../../node_modules/debug/src/browser.js"(exports2, module2) { "use strict"; exports2.formatArgs = formatArgs; exports2.save = save; exports2.load = load; exports2.useColors = useColors; exports2.storage = localstorage(); exports2.destroy = /* @__PURE__ */ (() => { let warned = false; return () => { if (!warned) { warned = true; console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."); } }; })(); exports2.colors = [ "#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33" ]; function useColors() { if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) { return true; } if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { return false; } let m; return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773 typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31? // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); } function formatArgs(args) { args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module2.exports.humanize(this.diff); if (!this.useColors) { return; } const c2 = "color: " + this.color; args.splice(1, 0, c2, "color: inherit"); let index = 0; let lastC = 0; args[0].replace(/%[a-zA-Z%]/g, (match) => { if (match === "%%") { return; } index++; if (match === "%c") { lastC = index; } }); args.splice(lastC, 0, c2); } exports2.log = console.debug || console.log || (() => { }); function save(namespaces) { try { if (namespaces) { exports2.storage.setItem("debug", namespaces); } else { exports2.storage.removeItem("debug"); } } catch (error45) { } } function load() { let r; try { r = exports2.storage.getItem("debug"); } catch (error45) { } if (!r && typeof process !== "undefined" && "env" in process) { r = process.env.DEBUG; } return r; } function localstorage() { try { return localStorage; } catch (error45) { } } module2.exports = require_common()(exports2); var { formatters } = module2.exports; formatters.j = function(v) { try { return JSON.stringify(v); } catch (error45) { return "[UnexpectedJSONParseError]: " + error45.message; } }; } }); // ../../node_modules/has-flag/index.js var require_has_flag = __commonJS({ "../../node_modules/has-flag/index.js"(exports2, module2) { "use strict"; module2.exports = (flag, argv = process.argv) => { const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--"; const position = argv.indexOf(prefix + flag); const terminatorPosition = argv.indexOf("--"); return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition); }; } }); // ../../node_modules/supports-color/index.js var require_supports_color = __commonJS({ "../../node_modules/supports-color/index.js"(exports2, module2) { "use strict"; var os = require("os"); var tty = require("tty"); var hasFlag = require_has_flag(); var { env } = process; var flagForceColor; if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) { flagForceColor = 0; } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) { flagForceColor = 1; } function envForceColor() { if ("FORCE_COLOR" in env) { if (env.FORCE_COLOR === "true") { return 1; } if (env.FORCE_COLOR === "false") { return 0; } return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3); } } function translateLevel(level) { if (level === 0) { return false; } return { level, hasBasic: true, has256: level >= 2, has16m: level >= 3 }; } function supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) { const noFlagForceColor = envForceColor(); if (noFlagForceColor !== void 0) { flagForceColor = noFlagForceColor; } const forceColor = sniffFlags ? flagForceColor : noFlagForceColor; if (forceColor === 0) { return 0; } if (sniffFlags) { if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) { return 3; } if (hasFlag("color=256")) { return 2; } } if (haveStream && !streamIsTTY && forceColor === void 0) { return 0; } const min = forceColor || 0; if (env.TERM === "dumb") { return min; } if (process.platform === "win32") { const osRelease = os.release().split("."); if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) { return Number(osRelease[2]) >= 14931 ? 3 : 2; } return 1; } if ("CI" in env) { if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE", "DRONE"].some((sign2) => sign2 in env) || env.CI_NAME === "codeship") { return 1; } return min; } if ("TEAMCITY_VERSION" in env) { return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; } if (env.COLORTERM === "truecolor") { return 3; } if ("TERM_PROGRAM" in env) { const version2 = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10); switch (env.TERM_PROGRAM) { case "iTerm.app": return version2 >= 3 ? 3 : 2; case "Apple_Terminal": return 2; } } if (/-256(color)?$/i.test(env.TERM)) { return 2; } if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { return 1; } if ("COLORTERM" in env) { return 1; } return min; } function getSupportLevel(stream, options = {}) { const level = supportsColor(stream, __spreadValues({ streamIsTTY: stream && stream.isTTY }, options)); return translateLevel(level); } module2.exports = { supportsColor: getSupportLevel, stdout: getSupportLevel({ isTTY: tty.isatty(1) }), stderr: getSupportLevel({ isTTY: tty.isatty(2) }) }; } }); // ../../node_modules/debug/src/node.js var require_node = __commonJS({ "../../node_modules/debug/src/node.js"(exports2, module2) { "use strict"; var tty = require("tty"); var util2 = require("util"); exports2.init = init; exports2.log = log2; exports2.formatArgs = formatArgs; exports2.save = save; exports2.load = load; exports2.useColors = useColors; exports2.destroy = util2.deprecate( () => { }, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`." ); exports2.colors = [6, 2, 3, 4, 5, 1]; try { const supportsColor = require_supports_color(); if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { exports2.colors = [ 20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221 ]; } } catch (error45) { } exports2.inspectOpts = Object.keys(process.env).filter((key2) => { return /^debug_/i.test(key2); }).reduce((obj, key2) => { const prop = key2.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => { return k.toUpperCase(); }); let val = process.env[key2]; if (/^(yes|on|true|enabled)$/i.test(val)) { val = true; } else if (/^(no|off|false|disabled)$/i.test(val)) { val = false; } else if (val === "null") { val = null; } else { val = Number(val); } obj[prop] = val; return obj; }, {}); function useColors() { return "colors" in exports2.inspectOpts ? Boolean(exports2.inspectOpts.colors) : tty.isatty(process.stderr.fd); } function formatArgs(args) { const { namespace: name, useColors: useColors2 } = this; if (useColors2) { const c2 = this.color; const colorCode = "\x1B[3" + (c2 < 8 ? c2 : "8;5;" + c2); const prefix = ` ${colorCode};1m${name} \x1B[0m`; args[0] = prefix + args[0].split("\n").join("\n" + prefix); args.push(colorCode + "m+" + module2.exports.humanize(this.diff) + "\x1B[0m"); } else { args[0] = getDate() + name + " " + args[0]; } } function getDate() { if (exports2.inspectOpts.hideDate) { return ""; } return (/* @__PURE__ */ new Date()).toISOString() + " "; } function log2(...args) { return process.stderr.write(util2.formatWithOptions(exports2.inspectOpts, ...args) + "\n"); } function save(namespaces) { if (namespaces) { process.env.DEBUG = namespaces; } else { delete process.env.DEBUG; } } function load() { return process.env.DEBUG; } function init(debug) { debug.inspectOpts = {}; const keys = Object.keys(exports2.inspectOpts); for (let i = 0; i < keys.length; i++) { debug.inspectOpts[keys[i]] = exports2.inspectOpts[keys[i]]; } } module2.exports = require_common()(exports2); var { formatters } = module2.exports; formatters.o = function(v) { this.inspectOpts.colors = this.useColors; return util2.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" "); }; formatters.O = function(v) { this.inspectOpts.colors = this.useColors; return util2.inspect(v, this.inspectOpts); }; } }); // ../../node_modules/debug/src/index.js var require_src = __commonJS({ "../../node_modules/debug/src/index.js"(exports2, module2) { "use strict"; if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) { module2.exports = require_browser(); } else { module2.exports = require_node(); } } }); // node_modules/@babel/helpers/node_modules/@babel/traverse/lib/path/lib/virtual-types-validator.js var require_virtual_types_validator = __commonJS({ "node_modules/@babel/helpers/node_modules/@babel/traverse/lib/path/lib/virtual-types-validator.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.isBindingIdentifier = isBindingIdentifier; exports2.isBlockScoped = isBlockScoped; exports2.isExpression = isExpression2; exports2.isFlow = isFlow; exports2.isForAwaitStatement = isForAwaitStatement; exports2.isGenerated = isGenerated; exports2.isPure = isPure; exports2.isReferenced = isReferenced; exports2.isReferencedIdentifier = isReferencedIdentifier; exports2.isReferencedMemberExpression = isReferencedMemberExpression; exports2.isRestProperty = isRestProperty; exports2.isScope = isScope; exports2.isSpreadProperty = isSpreadProperty; exports2.isStatement = isStatement2; exports2.isUser = isUser; exports2.isVar = isVar; var _t = require("@babel/types"); var { isBinding, isBlockScoped: nodeIsBlockScoped, isExportDeclaration, isExpression: nodeIsExpression, isFlow: nodeIsFlow, isForStatement, isForXStatement, isIdentifier, isImportDeclaration, isImportSpecifier, isJSXIdentifier, isJSXMemberExpression, isMemberExpression: isMemberExpression2, isRestElement: nodeIsRestElement, isReferenced: nodeIsReferenced, isScope: nodeIsScope, isStatement: nodeIsStatement, isVar: nodeIsVar, isVariableDeclaration: isVariableDeclaration2, react, isForOfStatement } = _t; var { isCompatTag } = react; function isReferencedIdentifier(opts) { const { node, parent } = this; if (!isIdentifier(node, opts) && !isJSXMemberExpression(parent, opts)) { if (isJSXIdentifier(node, opts)) { if (isCompatTag(node.name)) return false; } else { return false; } } return nodeIsReferenced(node, parent, this.parentPath.parent); } function isReferencedMemberExpression() { const { node, parent } = this; return isMemberExpression2(node) && nodeIsReferenced(node, parent); } function isBindingIdentifier() { const { node, parent } = this; const grandparent = this.parentPath.parent; return isIdentifier(node) && isBinding(node, parent, grandparent); } function isStatement2() { const { node, parent } = this; if (nodeIsStatement(node)) { if (isVariableDeclaration2(node)) { if (isForXStatement(parent, { left: node })) return false; if (isForStatement(parent, { init: node })) return false; } return true; } else { return false; } } function isExpression2() { if (this.isIdentifier()) { return this.isReferencedIdentifier(); } else { return nodeIsExpression(this.node); } } function isScope() { return nodeIsScope(this.node, this.parent); } function isReferenced() { return nodeIsReferenced(this.node, this.parent); } function isBlockScoped() { return nodeIsBlockScoped(this.node); } function isVar() { return nodeIsVar(this.node); } function isUser() { return this.node && !!this.node.loc; } function isGenerated() { return !this.isUser(); } function isPure(constantsOnly) { return this.scope.isPure(this.node, constantsOnly); } function isFlow() { const { node } = this; if (nodeIsFlow(node)) { return true; } else if (isImportDeclaration(node)) { return node.importKind === "type" || node.importKind === "typeof"; } else if (isExportDeclaration(node)) { return node.exportKind === "type"; } else if (isImportSpecifier(node)) { return node.importKind === "type" || node.importKind === "typeof"; } else { return false; } } function isRestProperty() { var _this$parentPath; return nodeIsRestElement(this.node) && ((_this$parentPath = this.parentPath) == null ? void 0 : _this$parentPath.isObjectPattern()); } function isSpreadProperty() { var _this$parentPath2; return nodeIsRestElement(this.node) && ((_this$parentPath2 = this.parentPath) == null ? void 0 : _this$parentPath2.isObjectExpression()); } function isForAwaitStatement() { return isForOfStatement(this.node, { await: true }); } { exports2.isExistentialTypeParam = function isExistentialTypeParam() { throw new Error("`path.isExistentialTypeParam` has been renamed to `path.isExistsTypeAnnotation()` in Babel 7."); }; exports2.isNumericLiteralTypeAnnotation = function isNumericLiteralTypeAnnotation() { throw new Error("`path.isNumericLiteralTypeAnnotation()` has been renamed to `path.isNumberLiteralTypeAnnotation()` in Babel 7."); }; } } }); // node_modules/@babel/helpers/node_modules/@babel/traverse/lib/visitors.js var require_visitors = __commonJS({ "node_modules/@babel/helpers/node_modules/@babel/traverse/lib/visitors.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.environmentVisitor = environmentVisitor; exports2.explode = explode$1; exports2.isExplodedVisitor = isExplodedVisitor; exports2.merge = merge4; exports2.verify = verify$1; var virtualTypes = require_virtual_types(); var virtualTypesValidators = require_virtual_types_validator(); var _t = require("@babel/types"); var _context3 = require_context2(); var { DEPRECATED_KEYS, DEPRECATED_ALIASES, FLIPPED_ALIAS_KEYS, TYPES, __internal__deprecationWarning: deprecationWarning } = _t; function isVirtualType(type) { return type in virtualTypes; } function isExplodedVisitor(visitor) { return visitor == null ? void 0 : visitor._exploded; } function explode$1(visitor) { if (isExplodedVisitor(visitor)) return visitor; visitor._exploded = true; for (const nodeType of Object.keys(visitor)) { if (shouldIgnoreKey(nodeType)) continue; const parts = nodeType.split("|"); if (parts.length === 1) continue; const fns = visitor[nodeType]; delete visitor[nodeType]; for (const part of parts) { visitor[part] = fns; } } verify$1(visitor); delete visitor.__esModule; ensureEntranceObjects(visitor); ensureCallbackArrays(visitor); for (const nodeType of Object.keys(visitor)) { if (shouldIgnoreKey(nodeType)) continue; if (!isVirtualType(nodeType)) continue; const fns = visitor[nodeType]; for (const type of Object.keys(fns)) { fns[type] = wrapCheck(nodeType, fns[type]); } delete visitor[nodeType]; const types = virtualTypes[nodeType]; if (types !== null) { for (const type of types) { if (visitor[type]) { mergePair(visitor[type], fns); } else { visitor[type] = fns; } } } else { mergePair(visitor, fns); } } for (const nodeType of Object.keys(visitor)) { if (shouldIgnoreKey(nodeType)) continue; let aliases = FLIPPED_ALIAS_KEYS[nodeType]; if (nodeType in DEPRECATED_KEYS) { const deprecatedKey = DEPRECATED_KEYS[nodeType]; deprecationWarning(nodeType, deprecatedKey, "Visitor "); aliases = [deprecatedKey]; } else if (nodeType in DEPRECATED_ALIASES) { const deprecatedAlias = DEPRECATED_ALIASES[nodeType]; deprecationWarning(nodeType, deprecatedAlias, "Visitor "); aliases = FLIPPED_ALIAS_KEYS[deprecatedAlias]; } if (!aliases) continue; const fns = visitor[nodeType]; delete visitor[nodeType]; for (const alias of aliases) { const existing = visitor[alias]; if (existing) { mergePair(existing, fns); } else { visitor[alias] = Object.assign({}, fns); } } } for (const nodeType of Object.keys(visitor)) { if (shouldIgnoreKey(nodeType)) continue; ensureCallbackArrays(visitor[nodeType]); } return visitor; } function verify$1(visitor) { if (visitor._verified) return; if (typeof visitor === "function") { throw new Error("You passed `traverse()` a function when it expected a visitor object, are you sure you didn't mean `{ enter: Function }`?"); } for (const nodeType of Object.keys(visitor)) { if (nodeType === "enter" || nodeType === "exit") { validateVisitorMethods(nodeType, visitor[nodeType]); } if (shouldIgnoreKey(nodeType)) continue; if (!TYPES.includes(nodeType)) { throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type in @babel/traverse ${"7.26.4"}`); } const visitors = visitor[nodeType]; if (typeof visitors === "object") { for (const visitorKey of Object.keys(visitors)) { if (visitorKey === "enter" || visitorKey === "exit") { validateVisitorMethods(`${nodeType}.${visitorKey}`, visitors[visitorKey]); } else { throw new Error(`You passed \`traverse()\` a visitor object with the property ${nodeType} that has the invalid property ${visitorKey}`); } } } } visitor._verified = true; } function validateVisitorMethods(path, val) { const fns = [].concat(val); for (const fn of fns) { if (typeof fn !== "function") { throw new TypeError(`Non-function found defined in ${path} with type ${typeof fn}`); } } } function merge4(visitors, states = [], wrapper) { const mergedVisitor = { _verified: true, _exploded: true }; { Object.defineProperty(mergedVisitor, "_exploded", { enumerable: false }); Object.defineProperty(mergedVisitor, "_verified", { enumerable: false }); } for (let i = 0; i < visitors.length; i++) { const visitor = explode$1(visitors[i]); const state = states[i]; let topVisitor = visitor; if (state || wrapper) { topVisitor = wrapWithStateOrWrapper(topVisitor, state, wrapper); } mergePair(mergedVisitor, topVisitor); for (const key2 of Object.keys(visitor)) { if (shouldIgnoreKey(key2)) continue; let typeVisitor = visitor[key2]; if (state || wrapper) { typeVisitor = wrapWithStateOrWrapper(typeVisitor, state, wrapper); } const nodeVisitor = mergedVisitor[key2] || (mergedVisitor[key2] = {}); mergePair(nodeVisitor, typeVisitor); } } return mergedVisitor; } function wrapWithStateOrWrapper(oldVisitor, state, wrapper) { const newVisitor = {}; for (const phase of ["enter", "exit"]) { let fns = oldVisitor[phase]; if (!Array.isArray(fns)) continue; fns = fns.map(function(fn) { let newFn = fn; if (state) { newFn = function(path) { fn.call(state, path, state); }; } if (wrapper) { newFn = wrapper(state == null ? void 0 : state.key, phase, newFn); } if (newFn !== fn) { newFn.toString = () => fn.toString(); } return newFn; }); newVisitor[phase] = fns; } return newVisitor; } function ensureEntranceObjects(obj) { for (const key2 of Object.keys(obj)) { if (shouldIgnoreKey(key2)) continue; const fns = obj[key2]; if (typeof fns === "function") { obj[key2] = { enter: fns }; } } } function ensureCallbackArrays(obj) { if (obj.enter && !Array.isArray(obj.enter)) obj.enter = [obj.enter]; if (obj.exit && !Array.isArray(obj.exit)) obj.exit = [obj.exit]; } function wrapCheck(nodeType, fn) { const fnKey = `is${nodeType}`; const validator = virtualTypesValidators[fnKey]; const newFn = function(path) { if (validator.call(path)) { return fn.apply(this, arguments); } }; newFn.toString = () => fn.toString(); return newFn; } function shouldIgnoreKey(key2) { if (key2[0] === "_") return true; if (key2 === "enter" || key2 === "exit" || key2 === "shouldSkip") return true; if (key2 === "denylist" || key2 === "noScope" || key2 === "skipKeys") { return true; } { if (key2 === "blacklist") { return true; } } return false; } function mergePair(dest, src) { for (const phase of ["enter", "exit"]) { if (!src[phase]) continue; dest[phase] = [].concat(dest[phase] || [], src[phase]); } } var _environmentVisitor = { FunctionParent(path) { if (path.isArrowFunctionExpression()) return; path.skip(); if (path.isMethod()) { if (!path.requeueComputedKeyAndDecorators) { _context3.requeueComputedKeyAndDecorators.call(path); } else { path.requeueComputedKeyAndDecorators(); } } }, Property(path) { if (path.isObjectProperty()) return; path.skip(); if (!path.requeueComputedKeyAndDecorators) { _context3.requeueComputedKeyAndDecorators.call(path); } else { path.requeueComputedKeyAndDecorators(); } } }; function environmentVisitor(visitor) { return merge4([_environmentVisitor, visitor]); } } }); // node_modules/@babel/helpers/node_modules/@babel/traverse/lib/scope/lib/renamer.js var require_renamer = __commonJS({ "node_modules/@babel/helpers/node_modules/@babel/traverse/lib/scope/lib/renamer.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.default = void 0; var t6 = require("@babel/types"); var _t = t6; var _traverseNode = require_traverse_node(); var _visitors = require_visitors(); var _context3 = require_context2(); var { getAssignmentIdentifiers } = _t; var renameVisitor = { ReferencedIdentifier({ node }, state) { if (node.name === state.oldName) { node.name = state.newName; } }, Scope(path, state) { if (!path.scope.bindingIdentifierEquals(state.oldName, state.binding.identifier)) { path.skip(); if (path.isMethod()) { if (!path.requeueComputedKeyAndDecorators) { _context3.requeueComputedKeyAndDecorators.call(path); } else { path.requeueComputedKeyAndDecorators(); } } } }, ObjectProperty({ node, scope }, state) { const { name } = node.key; if (node.shorthand && (name === state.oldName || name === state.newName) && scope.getBindingIdentifier(name) === state.binding.identifier) { node.shorthand = false; { var _node$extra; if ((_node$extra = node.extra) != null && _node$extra.shorthand) node.extra.shorthand = false; } } }, "AssignmentExpression|Declaration|VariableDeclarator"(path, state) { if (path.isVariableDeclaration()) return; const ids = path.isAssignmentExpression() ? getAssignmentIdentifiers(path.node) : path.getOuterBindingIdentifiers(); for (const name in ids) { if (name === state.oldName) ids[name].name = state.newName; } } }; var Renamer = class { constructor(binding, oldName, newName) { this.newName = newName; this.oldName = oldName; this.binding = binding; } maybeConvertFromExportDeclaration(parentDeclar) { const maybeExportDeclar = parentDeclar.parentPath; if (!maybeExportDeclar.isExportDeclaration()) { return; } if (maybeExportDeclar.isExportDefaultDeclaration()) { const { declaration } = maybeExportDeclar.node; if (t6.isDeclaration(declaration) && !declaration.id) { return; } } if (maybeExportDeclar.isExportAllDeclaration()) { return; } maybeExportDeclar.splitExportDeclaration(); } maybeConvertFromClassFunctionDeclaration(path) { return path; } maybeConvertFromClassFunctionExpression(path) { return path; } rename() { const { binding, oldName, newName } = this; const { scope, path } = binding; const parentDeclar = path.find((path2) => path2.isDeclaration() || path2.isFunctionExpression() || path2.isClassExpression()); if (parentDeclar) { const bindingIds = parentDeclar.getOuterBindingIdentifiers(); if (bindingIds[oldName] === binding.identifier) { this.maybeConvertFromExportDeclaration(parentDeclar); } } const blockToTraverse = arguments[0] || scope.block; const skipKeys = { discriminant: true }; if (t6.isMethod(blockToTraverse)) { if (blockToTraverse.computed) { skipKeys.key = true; } if (!t6.isObjectMethod(blockToTraverse)) { skipKeys.decorators = true; } } (0, _traverseNode.traverseNode)(blockToTraverse, (0, _visitors.explode)(renameVisitor), scope, this, scope.path, skipKeys); if (!arguments[0]) { scope.removeOwnBinding(oldName); scope.bindings[newName] = binding; this.binding.identifier.name = newName; } if (parentDeclar) { this.maybeConvertFromClassFunctionDeclaration(path); this.maybeConvertFromClassFunctionExpression(path); } } }; exports2.default = Renamer; } }); // node_modules/@babel/helpers/node_modules/@babel/traverse/lib/scope/binding.js var require_binding = __commonJS({ "node_modules/@babel/helpers/node_modules/@babel/traverse/lib/scope/binding.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.default = void 0; var Binding = class { constructor({ identifier: identifier4, scope, path, kind }) { this.identifier = void 0; this.scope = void 0; this.path = void 0; this.kind = void 0; this.constantViolations = []; this.constant = true; this.referencePaths = []; this.referenced = false; this.references = 0; this.identifier = identifier4; this.scope = scope; this.path = path; this.kind = kind; if ((kind === "var" || kind === "hoisted") && isDeclaredInLoop(path)) { this.reassign(path); } this.clearValue(); } deoptValue() { this.clearValue(); this.hasDeoptedValue = true; } setValu