calibre
Version:
Calibre - Page speed performance testing with Google Lighthouse
1,439 lines (1,423 loc) • 685 kB
JavaScript
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __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 key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// node_modules/graceful-fs/polyfills.js
var require_polyfills = __commonJS({
"node_modules/graceful-fs/polyfills.js"(exports2, module2) {
var constants = require("constants");
var origCwd = process.cwd;
var cwd = null;
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
process.cwd = function() {
if (!cwd)
cwd = origCwd.call(process);
return cwd;
};
try {
process.cwd();
} catch (er) {
}
if (typeof process.chdir === "function") {
chdir = process.chdir;
process.chdir = function(d) {
cwd = null;
chdir.call(process, d);
};
if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
}
var chdir;
module2.exports = patch;
function patch(fs3) {
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
patchLchmod(fs3);
}
if (!fs3.lutimes) {
patchLutimes(fs3);
}
fs3.chown = chownFix(fs3.chown);
fs3.fchown = chownFix(fs3.fchown);
fs3.lchown = chownFix(fs3.lchown);
fs3.chmod = chmodFix(fs3.chmod);
fs3.fchmod = chmodFix(fs3.fchmod);
fs3.lchmod = chmodFix(fs3.lchmod);
fs3.chownSync = chownFixSync(fs3.chownSync);
fs3.fchownSync = chownFixSync(fs3.fchownSync);
fs3.lchownSync = chownFixSync(fs3.lchownSync);
fs3.chmodSync = chmodFixSync(fs3.chmodSync);
fs3.fchmodSync = chmodFixSync(fs3.fchmodSync);
fs3.lchmodSync = chmodFixSync(fs3.lchmodSync);
fs3.stat = statFix(fs3.stat);
fs3.fstat = statFix(fs3.fstat);
fs3.lstat = statFix(fs3.lstat);
fs3.statSync = statFixSync(fs3.statSync);
fs3.fstatSync = statFixSync(fs3.fstatSync);
fs3.lstatSync = statFixSync(fs3.lstatSync);
if (fs3.chmod && !fs3.lchmod) {
fs3.lchmod = function(path5, mode, cb) {
if (cb) process.nextTick(cb);
};
fs3.lchmodSync = function() {
};
}
if (fs3.chown && !fs3.lchown) {
fs3.lchown = function(path5, uid, gid, cb) {
if (cb) process.nextTick(cb);
};
fs3.lchownSync = function() {
};
}
if (platform === "win32") {
fs3.rename = typeof fs3.rename !== "function" ? fs3.rename : function(fs$rename) {
function rename(from, to, cb) {
var start = Date.now();
var backoff = 0;
fs$rename(from, to, function CB(er) {
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
setTimeout(function() {
fs3.stat(to, function(stater, st) {
if (stater && stater.code === "ENOENT")
fs$rename(from, to, CB);
else
cb(er);
});
}, backoff);
if (backoff < 100)
backoff += 10;
return;
}
if (cb) cb(er);
});
}
if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
return rename;
}(fs3.rename);
}
fs3.read = typeof fs3.read !== "function" ? fs3.read : function(fs$read) {
function read(fd, buffer, offset, length, position, callback_) {
var callback;
if (callback_ && typeof callback_ === "function") {
var eagCounter = 0;
callback = function(er, _, __) {
if (er && er.code === "EAGAIN" && eagCounter < 10) {
eagCounter++;
return fs$read.call(fs3, fd, buffer, offset, length, position, callback);
}
callback_.apply(this, arguments);
};
}
return fs$read.call(fs3, fd, buffer, offset, length, position, callback);
}
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
return read;
}(fs3.read);
fs3.readSync = typeof fs3.readSync !== "function" ? fs3.readSync : /* @__PURE__ */ function(fs$readSync) {
return function(fd, buffer, offset, length, position) {
var eagCounter = 0;
while (true) {
try {
return fs$readSync.call(fs3, fd, buffer, offset, length, position);
} catch (er) {
if (er.code === "EAGAIN" && eagCounter < 10) {
eagCounter++;
continue;
}
throw er;
}
}
};
}(fs3.readSync);
function patchLchmod(fs4) {
fs4.lchmod = function(path5, mode, callback) {
fs4.open(
path5,
constants.O_WRONLY | constants.O_SYMLINK,
mode,
function(err, fd) {
if (err) {
if (callback) callback(err);
return;
}
fs4.fchmod(fd, mode, function(err2) {
fs4.close(fd, function(err22) {
if (callback) callback(err2 || err22);
});
});
}
);
};
fs4.lchmodSync = function(path5, mode) {
var fd = fs4.openSync(path5, constants.O_WRONLY | constants.O_SYMLINK, mode);
var threw = true;
var ret;
try {
ret = fs4.fchmodSync(fd, mode);
threw = false;
} finally {
if (threw) {
try {
fs4.closeSync(fd);
} catch (er) {
}
} else {
fs4.closeSync(fd);
}
}
return ret;
};
}
function patchLutimes(fs4) {
if (constants.hasOwnProperty("O_SYMLINK") && fs4.futimes) {
fs4.lutimes = function(path5, at, mt, cb) {
fs4.open(path5, constants.O_SYMLINK, function(er, fd) {
if (er) {
if (cb) cb(er);
return;
}
fs4.futimes(fd, at, mt, function(er2) {
fs4.close(fd, function(er22) {
if (cb) cb(er2 || er22);
});
});
});
};
fs4.lutimesSync = function(path5, at, mt) {
var fd = fs4.openSync(path5, constants.O_SYMLINK);
var ret;
var threw = true;
try {
ret = fs4.futimesSync(fd, at, mt);
threw = false;
} finally {
if (threw) {
try {
fs4.closeSync(fd);
} catch (er) {
}
} else {
fs4.closeSync(fd);
}
}
return ret;
};
} else if (fs4.futimes) {
fs4.lutimes = function(_a, _b, _c, cb) {
if (cb) process.nextTick(cb);
};
fs4.lutimesSync = function() {
};
}
}
function chmodFix(orig) {
if (!orig) return orig;
return function(target, mode, cb) {
return orig.call(fs3, target, mode, function(er) {
if (chownErOk(er)) er = null;
if (cb) cb.apply(this, arguments);
});
};
}
function chmodFixSync(orig) {
if (!orig) return orig;
return function(target, mode) {
try {
return orig.call(fs3, target, mode);
} catch (er) {
if (!chownErOk(er)) throw er;
}
};
}
function chownFix(orig) {
if (!orig) return orig;
return function(target, uid, gid, cb) {
return orig.call(fs3, target, uid, gid, function(er) {
if (chownErOk(er)) er = null;
if (cb) cb.apply(this, arguments);
});
};
}
function chownFixSync(orig) {
if (!orig) return orig;
return function(target, uid, gid) {
try {
return orig.call(fs3, target, uid, gid);
} catch (er) {
if (!chownErOk(er)) throw er;
}
};
}
function statFix(orig) {
if (!orig) return orig;
return function(target, options, cb) {
if (typeof options === "function") {
cb = options;
options = null;
}
function callback(er, stats) {
if (stats) {
if (stats.uid < 0) stats.uid += 4294967296;
if (stats.gid < 0) stats.gid += 4294967296;
}
if (cb) cb.apply(this, arguments);
}
return options ? orig.call(fs3, target, options, callback) : orig.call(fs3, target, callback);
};
}
function statFixSync(orig) {
if (!orig) return orig;
return function(target, options) {
var stats = options ? orig.call(fs3, target, options) : orig.call(fs3, target);
if (stats) {
if (stats.uid < 0) stats.uid += 4294967296;
if (stats.gid < 0) stats.gid += 4294967296;
}
return stats;
};
}
function chownErOk(er) {
if (!er)
return true;
if (er.code === "ENOSYS")
return true;
var nonroot = !process.getuid || process.getuid() !== 0;
if (nonroot) {
if (er.code === "EINVAL" || er.code === "EPERM")
return true;
}
return false;
}
}
}
});
// node_modules/graceful-fs/legacy-streams.js
var require_legacy_streams = __commonJS({
"node_modules/graceful-fs/legacy-streams.js"(exports2, module2) {
var Stream = require("stream").Stream;
module2.exports = legacy;
function legacy(fs3) {
return {
ReadStream,
WriteStream
};
function ReadStream(path5, options) {
if (!(this instanceof ReadStream)) return new ReadStream(path5, options);
Stream.call(this);
var self = this;
this.path = path5;
this.fd = null;
this.readable = true;
this.paused = false;
this.flags = "r";
this.mode = 438;
this.bufferSize = 64 * 1024;
options = options || {};
var keys = Object.keys(options);
for (var index = 0, length = keys.length; index < length; index++) {
var key = keys[index];
this[key] = options[key];
}
if (this.encoding) this.setEncoding(this.encoding);
if (this.start !== void 0) {
if ("number" !== typeof this.start) {
throw TypeError("start must be a Number");
}
if (this.end === void 0) {
this.end = Infinity;
} else if ("number" !== typeof this.end) {
throw TypeError("end must be a Number");
}
if (this.start > this.end) {
throw new Error("start must be <= end");
}
this.pos = this.start;
}
if (this.fd !== null) {
process.nextTick(function() {
self._read();
});
return;
}
fs3.open(this.path, this.flags, this.mode, function(err, fd) {
if (err) {
self.emit("error", err);
self.readable = false;
return;
}
self.fd = fd;
self.emit("open", fd);
self._read();
});
}
function WriteStream(path5, options) {
if (!(this instanceof WriteStream)) return new WriteStream(path5, options);
Stream.call(this);
this.path = path5;
this.fd = null;
this.writable = true;
this.flags = "w";
this.encoding = "binary";
this.mode = 438;
this.bytesWritten = 0;
options = options || {};
var keys = Object.keys(options);
for (var index = 0, length = keys.length; index < length; index++) {
var key = keys[index];
this[key] = options[key];
}
if (this.start !== void 0) {
if ("number" !== typeof this.start) {
throw TypeError("start must be a Number");
}
if (this.start < 0) {
throw new Error("start must be >= zero");
}
this.pos = this.start;
}
this.busy = false;
this._queue = [];
if (this.fd === null) {
this._open = fs3.open;
this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
this.flush();
}
}
}
}
});
// node_modules/graceful-fs/clone.js
var require_clone = __commonJS({
"node_modules/graceful-fs/clone.js"(exports2, module2) {
"use strict";
module2.exports = clone;
var getPrototypeOf = Object.getPrototypeOf || function(obj) {
return obj.__proto__;
};
function clone(obj) {
if (obj === null || typeof obj !== "object")
return obj;
if (obj instanceof Object)
var copy = { __proto__: getPrototypeOf(obj) };
else
var copy = /* @__PURE__ */ Object.create(null);
Object.getOwnPropertyNames(obj).forEach(function(key) {
Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
});
return copy;
}
}
});
// node_modules/graceful-fs/graceful-fs.js
var require_graceful_fs = __commonJS({
"node_modules/graceful-fs/graceful-fs.js"(exports2, module2) {
var fs3 = require("fs");
var polyfills = require_polyfills();
var legacy = require_legacy_streams();
var clone = require_clone();
var util = require("util");
var gracefulQueue;
var previousSymbol;
if (typeof Symbol === "function" && typeof Symbol.for === "function") {
gracefulQueue = Symbol.for("graceful-fs.queue");
previousSymbol = Symbol.for("graceful-fs.previous");
} else {
gracefulQueue = "___graceful-fs.queue";
previousSymbol = "___graceful-fs.previous";
}
function noop() {
}
function publishQueue(context, queue2) {
Object.defineProperty(context, gracefulQueue, {
get: function() {
return queue2;
}
});
}
var debug = noop;
if (util.debuglog)
debug = util.debuglog("gfs4");
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
debug = function() {
var m = util.format.apply(util, arguments);
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
console.error(m);
};
if (!fs3[gracefulQueue]) {
queue = global[gracefulQueue] || [];
publishQueue(fs3, queue);
fs3.close = function(fs$close) {
function close(fd, cb) {
return fs$close.call(fs3, fd, function(err) {
if (!err) {
resetQueue();
}
if (typeof cb === "function")
cb.apply(this, arguments);
});
}
Object.defineProperty(close, previousSymbol, {
value: fs$close
});
return close;
}(fs3.close);
fs3.closeSync = function(fs$closeSync) {
function closeSync(fd) {
fs$closeSync.apply(fs3, arguments);
resetQueue();
}
Object.defineProperty(closeSync, previousSymbol, {
value: fs$closeSync
});
return closeSync;
}(fs3.closeSync);
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
process.on("exit", function() {
debug(fs3[gracefulQueue]);
require("assert").equal(fs3[gracefulQueue].length, 0);
});
}
}
var queue;
if (!global[gracefulQueue]) {
publishQueue(global, fs3[gracefulQueue]);
}
module2.exports = patch(clone(fs3));
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs3.__patched) {
module2.exports = patch(fs3);
fs3.__patched = true;
}
function patch(fs4) {
polyfills(fs4);
fs4.gracefulify = patch;
fs4.createReadStream = createReadStream;
fs4.createWriteStream = createWriteStream;
var fs$readFile = fs4.readFile;
fs4.readFile = readFile;
function readFile(path5, options, cb) {
if (typeof options === "function")
cb = options, options = null;
return go$readFile(path5, options, cb);
function go$readFile(path6, options2, cb2, startTime) {
return fs$readFile(path6, options2, function(err) {
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
enqueue([go$readFile, [path6, options2, cb2], err, startTime || Date.now(), Date.now()]);
else {
if (typeof cb2 === "function")
cb2.apply(this, arguments);
}
});
}
}
var fs$writeFile = fs4.writeFile;
fs4.writeFile = writeFile;
function writeFile(path5, data, options, cb) {
if (typeof options === "function")
cb = options, options = null;
return go$writeFile(path5, data, options, cb);
function go$writeFile(path6, data2, options2, cb2, startTime) {
return fs$writeFile(path6, data2, options2, function(err) {
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
enqueue([go$writeFile, [path6, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
else {
if (typeof cb2 === "function")
cb2.apply(this, arguments);
}
});
}
}
var fs$appendFile = fs4.appendFile;
if (fs$appendFile)
fs4.appendFile = appendFile;
function appendFile(path5, data, options, cb) {
if (typeof options === "function")
cb = options, options = null;
return go$appendFile(path5, data, options, cb);
function go$appendFile(path6, data2, options2, cb2, startTime) {
return fs$appendFile(path6, data2, options2, function(err) {
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
enqueue([go$appendFile, [path6, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
else {
if (typeof cb2 === "function")
cb2.apply(this, arguments);
}
});
}
}
var fs$copyFile = fs4.copyFile;
if (fs$copyFile)
fs4.copyFile = copyFile;
function copyFile(src, dest, flags, cb) {
if (typeof flags === "function") {
cb = flags;
flags = 0;
}
return go$copyFile(src, dest, flags, cb);
function go$copyFile(src2, dest2, flags2, cb2, startTime) {
return fs$copyFile(src2, dest2, flags2, function(err) {
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]);
else {
if (typeof cb2 === "function")
cb2.apply(this, arguments);
}
});
}
}
var fs$readdir = fs4.readdir;
fs4.readdir = readdir;
var noReaddirOptionVersions = /^v[0-5]\./;
function readdir(path5, options, cb) {
if (typeof options === "function")
cb = options, options = null;
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path6, options2, cb2, startTime) {
return fs$readdir(path6, fs$readdirCallback(
path6,
options2,
cb2,
startTime
));
} : function go$readdir2(path6, options2, cb2, startTime) {
return fs$readdir(path6, options2, fs$readdirCallback(
path6,
options2,
cb2,
startTime
));
};
return go$readdir(path5, options, cb);
function fs$readdirCallback(path6, options2, cb2, startTime) {
return function(err, files) {
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
enqueue([
go$readdir,
[path6, options2, cb2],
err,
startTime || Date.now(),
Date.now()
]);
else {
if (files && files.sort)
files.sort();
if (typeof cb2 === "function")
cb2.call(this, err, files);
}
};
}
}
if (process.version.substr(0, 4) === "v0.8") {
var legStreams = legacy(fs4);
ReadStream = legStreams.ReadStream;
WriteStream = legStreams.WriteStream;
}
var fs$ReadStream = fs4.ReadStream;
if (fs$ReadStream) {
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
ReadStream.prototype.open = ReadStream$open;
}
var fs$WriteStream = fs4.WriteStream;
if (fs$WriteStream) {
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
WriteStream.prototype.open = WriteStream$open;
}
Object.defineProperty(fs4, "ReadStream", {
get: function() {
return ReadStream;
},
set: function(val) {
ReadStream = val;
},
enumerable: true,
configurable: true
});
Object.defineProperty(fs4, "WriteStream", {
get: function() {
return WriteStream;
},
set: function(val) {
WriteStream = val;
},
enumerable: true,
configurable: true
});
var FileReadStream = ReadStream;
Object.defineProperty(fs4, "FileReadStream", {
get: function() {
return FileReadStream;
},
set: function(val) {
FileReadStream = val;
},
enumerable: true,
configurable: true
});
var FileWriteStream = WriteStream;
Object.defineProperty(fs4, "FileWriteStream", {
get: function() {
return FileWriteStream;
},
set: function(val) {
FileWriteStream = val;
},
enumerable: true,
configurable: true
});
function ReadStream(path5, options) {
if (this instanceof ReadStream)
return fs$ReadStream.apply(this, arguments), this;
else
return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
}
function ReadStream$open() {
var that = this;
open(that.path, that.flags, that.mode, function(err, fd) {
if (err) {
if (that.autoClose)
that.destroy();
that.emit("error", err);
} else {
that.fd = fd;
that.emit("open", fd);
that.read();
}
});
}
function WriteStream(path5, options) {
if (this instanceof WriteStream)
return fs$WriteStream.apply(this, arguments), this;
else
return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
}
function WriteStream$open() {
var that = this;
open(that.path, that.flags, that.mode, function(err, fd) {
if (err) {
that.destroy();
that.emit("error", err);
} else {
that.fd = fd;
that.emit("open", fd);
}
});
}
function createReadStream(path5, options) {
return new fs4.ReadStream(path5, options);
}
function createWriteStream(path5, options) {
return new fs4.WriteStream(path5, options);
}
var fs$open = fs4.open;
fs4.open = open;
function open(path5, flags, mode, cb) {
if (typeof mode === "function")
cb = mode, mode = null;
return go$open(path5, flags, mode, cb);
function go$open(path6, flags2, mode2, cb2, startTime) {
return fs$open(path6, flags2, mode2, function(err, fd) {
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
enqueue([go$open, [path6, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
else {
if (typeof cb2 === "function")
cb2.apply(this, arguments);
}
});
}
}
return fs4;
}
function enqueue(elem) {
debug("ENQUEUE", elem[0].name, elem[1]);
fs3[gracefulQueue].push(elem);
retry();
}
var retryTimer;
function resetQueue() {
var now = Date.now();
for (var i = 0; i < fs3[gracefulQueue].length; ++i) {
if (fs3[gracefulQueue][i].length > 2) {
fs3[gracefulQueue][i][3] = now;
fs3[gracefulQueue][i][4] = now;
}
}
retry();
}
function retry() {
clearTimeout(retryTimer);
retryTimer = void 0;
if (fs3[gracefulQueue].length === 0)
return;
var elem = fs3[gracefulQueue].shift();
var fn = elem[0];
var args = elem[1];
var err = elem[2];
var startTime = elem[3];
var lastTime = elem[4];
if (startTime === void 0) {
debug("RETRY", fn.name, args);
fn.apply(null, args);
} else if (Date.now() - startTime >= 6e4) {
debug("TIMEOUT", fn.name, args);
var cb = args.pop();
if (typeof cb === "function")
cb.call(null, err);
} else {
var sinceAttempt = Date.now() - lastTime;
var sinceStart = Math.max(lastTime - startTime, 1);
var desiredDelay = Math.min(sinceStart * 1.2, 100);
if (sinceAttempt >= desiredDelay) {
debug("RETRY", fn.name, args);
fn.apply(null, args.concat([startTime]));
} else {
fs3[gracefulQueue].push(elem);
}
}
if (retryTimer === void 0) {
retryTimer = setTimeout(retry, 0);
}
}
}
});
// node_modules/graphql/version.js
var require_version = __commonJS({
"node_modules/graphql/version.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.versionInfo = exports2.version = void 0;
var version = "16.8.1";
exports2.version = version;
var versionInfo = Object.freeze({
major: 16,
minor: 8,
patch: 1,
preReleaseTag: null
});
exports2.versionInfo = versionInfo;
}
});
// node_modules/graphql/jsutils/devAssert.js
var require_devAssert = __commonJS({
"node_modules/graphql/jsutils/devAssert.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.devAssert = devAssert;
function devAssert(condition, message) {
const booleanCondition = Boolean(condition);
if (!booleanCondition) {
throw new Error(message);
}
}
}
});
// node_modules/graphql/jsutils/isPromise.js
var require_isPromise = __commonJS({
"node_modules/graphql/jsutils/isPromise.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.isPromise = isPromise;
function isPromise(value) {
return typeof (value === null || value === void 0 ? void 0 : value.then) === "function";
}
}
});
// node_modules/graphql/jsutils/isObjectLike.js
var require_isObjectLike = __commonJS({
"node_modules/graphql/jsutils/isObjectLike.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.isObjectLike = isObjectLike;
function isObjectLike(value) {
return typeof value == "object" && value !== null;
}
}
});
// node_modules/graphql/jsutils/invariant.js
var require_invariant = __commonJS({
"node_modules/graphql/jsutils/invariant.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.invariant = invariant;
function invariant(condition, message) {
const booleanCondition = Boolean(condition);
if (!booleanCondition) {
throw new Error(
message != null ? message : "Unexpected invariant triggered."
);
}
}
}
});
// node_modules/graphql/language/location.js
var require_location = __commonJS({
"node_modules/graphql/language/location.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.getLocation = getLocation;
var _invariant = require_invariant();
var LineRegExp = /\r\n|[\n\r]/g;
function getLocation(source, position) {
let lastLineStart = 0;
let line = 1;
for (const match of source.body.matchAll(LineRegExp)) {
typeof match.index === "number" || (0, _invariant.invariant)(false);
if (match.index >= position) {
break;
}
lastLineStart = match.index + match[0].length;
line += 1;
}
return {
line,
column: position + 1 - lastLineStart
};
}
}
});
// node_modules/graphql/language/printLocation.js
var require_printLocation = __commonJS({
"node_modules/graphql/language/printLocation.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.printLocation = printLocation;
exports2.printSourceLocation = printSourceLocation;
var _location = require_location();
function printLocation(location) {
return printSourceLocation(
location.source,
(0, _location.getLocation)(location.source, location.start)
);
}
function printSourceLocation(source, sourceLocation) {
const firstLineColumnOffset = source.locationOffset.column - 1;
const body = "".padStart(firstLineColumnOffset) + source.body;
const lineIndex = sourceLocation.line - 1;
const lineOffset = source.locationOffset.line - 1;
const lineNum = sourceLocation.line + lineOffset;
const columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0;
const columnNum = sourceLocation.column + columnOffset;
const locationStr = `${source.name}:${lineNum}:${columnNum}
`;
const lines = body.split(/\r\n|[\n\r]/g);
const locationLine = lines[lineIndex];
if (locationLine.length > 120) {
const subLineIndex = Math.floor(columnNum / 80);
const subLineColumnNum = columnNum % 80;
const subLines = [];
for (let i = 0; i < locationLine.length; i += 80) {
subLines.push(locationLine.slice(i, i + 80));
}
return locationStr + printPrefixedLines([
[`${lineNum} |`, subLines[0]],
...subLines.slice(1, subLineIndex + 1).map((subLine) => ["|", subLine]),
["|", "^".padStart(subLineColumnNum)],
["|", subLines[subLineIndex + 1]]
]);
}
return locationStr + printPrefixedLines([
// Lines specified like this: ["prefix", "string"],
[`${lineNum - 1} |`, lines[lineIndex - 1]],
[`${lineNum} |`, locationLine],
["|", "^".padStart(columnNum)],
[`${lineNum + 1} |`, lines[lineIndex + 1]]
]);
}
function printPrefixedLines(lines) {
const existingLines = lines.filter(([_, line]) => line !== void 0);
const padLen = Math.max(...existingLines.map(([prefix]) => prefix.length));
return existingLines.map(([prefix, line]) => prefix.padStart(padLen) + (line ? " " + line : "")).join("\n");
}
}
});
// node_modules/graphql/error/GraphQLError.js
var require_GraphQLError = __commonJS({
"node_modules/graphql/error/GraphQLError.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.GraphQLError = void 0;
exports2.formatError = formatError;
exports2.printError = printError;
var _isObjectLike = require_isObjectLike();
var _location = require_location();
var _printLocation = require_printLocation();
function toNormalizedOptions(args) {
const firstArg = args[0];
if (firstArg == null || "kind" in firstArg || "length" in firstArg) {
return {
nodes: firstArg,
source: args[1],
positions: args[2],
path: args[3],
originalError: args[4],
extensions: args[5]
};
}
return firstArg;
}
var GraphQLError = class _GraphQLError extends Error {
/**
* An array of `{ line, column }` locations within the source GraphQL document
* which correspond to this error.
*
* Errors during validation often contain multiple locations, for example to
* point out two things with the same name. Errors during execution include a
* single location, the field which produced the error.
*
* Enumerable, and appears in the result of JSON.stringify().
*/
/**
* An array describing the JSON-path into the execution response which
* corresponds to this error. Only included for errors during execution.
*
* Enumerable, and appears in the result of JSON.stringify().
*/
/**
* An array of GraphQL AST Nodes corresponding to this error.
*/
/**
* The source GraphQL document for the first location of this error.
*
* Note that if this Error represents more than one node, the source may not
* represent nodes after the first node.
*/
/**
* An array of character offsets within the source GraphQL document
* which correspond to this error.
*/
/**
* The original error thrown from a field resolver during execution.
*/
/**
* Extension fields to add to the formatted error.
*/
/**
* @deprecated Please use the `GraphQLErrorOptions` constructor overload instead.
*/
constructor(message, ...rawArgs) {
var _this$nodes, _nodeLocations$, _ref;
const { nodes, source, positions, path: path5, originalError, extensions } = toNormalizedOptions(rawArgs);
super(message);
this.name = "GraphQLError";
this.path = path5 !== null && path5 !== void 0 ? path5 : void 0;
this.originalError = originalError !== null && originalError !== void 0 ? originalError : void 0;
this.nodes = undefinedIfEmpty(
Array.isArray(nodes) ? nodes : nodes ? [nodes] : void 0
);
const nodeLocations = undefinedIfEmpty(
(_this$nodes = this.nodes) === null || _this$nodes === void 0 ? void 0 : _this$nodes.map((node) => node.loc).filter((loc) => loc != null)
);
this.source = source !== null && source !== void 0 ? source : nodeLocations === null || nodeLocations === void 0 ? void 0 : (_nodeLocations$ = nodeLocations[0]) === null || _nodeLocations$ === void 0 ? void 0 : _nodeLocations$.source;
this.positions = positions !== null && positions !== void 0 ? positions : nodeLocations === null || nodeLocations === void 0 ? void 0 : nodeLocations.map((loc) => loc.start);
this.locations = positions && source ? positions.map((pos) => (0, _location.getLocation)(source, pos)) : nodeLocations === null || nodeLocations === void 0 ? void 0 : nodeLocations.map(
(loc) => (0, _location.getLocation)(loc.source, loc.start)
);
const originalExtensions = (0, _isObjectLike.isObjectLike)(
originalError === null || originalError === void 0 ? void 0 : originalError.extensions
) ? originalError === null || originalError === void 0 ? void 0 : originalError.extensions : void 0;
this.extensions = (_ref = extensions !== null && extensions !== void 0 ? extensions : originalExtensions) !== null && _ref !== void 0 ? _ref : /* @__PURE__ */ Object.create(null);
Object.defineProperties(this, {
message: {
writable: true,
enumerable: true
},
name: {
enumerable: false
},
nodes: {
enumerable: false
},
source: {
enumerable: false
},
positions: {
enumerable: false
},
originalError: {
enumerable: false
}
});
if (originalError !== null && originalError !== void 0 && originalError.stack) {
Object.defineProperty(this, "stack", {
value: originalError.stack,
writable: true,
configurable: true
});
} else if (Error.captureStackTrace) {
Error.captureStackTrace(this, _GraphQLError);
} else {
Object.defineProperty(this, "stack", {
value: Error().stack,
writable: true,
configurable: true
});
}
}
get [Symbol.toStringTag]() {
return "GraphQLError";
}
toString() {
let output = this.message;
if (this.nodes) {
for (const node of this.nodes) {
if (node.loc) {
output += "\n\n" + (0, _printLocation.printLocation)(node.loc);
}
}
} else if (this.source && this.locations) {
for (const location of this.locations) {
output += "\n\n" + (0, _printLocation.printSourceLocation)(this.source, location);
}
}
return output;
}
toJSON() {
const formattedError = {
message: this.message
};
if (this.locations != null) {
formattedError.locations = this.locations;
}
if (this.path != null) {
formattedError.path = this.path;
}
if (this.extensions != null && Object.keys(this.extensions).length > 0) {
formattedError.extensions = this.extensions;
}
return formattedError;
}
};
exports2.GraphQLError = GraphQLError;
function undefinedIfEmpty(array) {
return array === void 0 || array.length === 0 ? void 0 : array;
}
function printError(error) {
return error.toString();
}
function formatError(error) {
return error.toJSON();
}
}
});
// node_modules/graphql/error/syntaxError.js
var require_syntaxError = __commonJS({
"node_modules/graphql/error/syntaxError.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.syntaxError = syntaxError;
var _GraphQLError = require_GraphQLError();
function syntaxError(source, position, description) {
return new _GraphQLError.GraphQLError(`Syntax Error: ${description}`, {
source,
positions: [position]
});
}
}
});
// node_modules/graphql/language/ast.js
var require_ast = __commonJS({
"node_modules/graphql/language/ast.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.Token = exports2.QueryDocumentKeys = exports2.OperationTypeNode = exports2.Location = void 0;
exports2.isNode = isNode;
var Location = class {
/**
* The character offset at which this Node begins.
*/
/**
* The character offset at which this Node ends.
*/
/**
* The Token at which this Node begins.
*/
/**
* The Token at which this Node ends.
*/
/**
* The Source document the AST represents.
*/
constructor(startToken, endToken, source) {
this.start = startToken.start;
this.end = endToken.end;
this.startToken = startToken;
this.endToken = endToken;
this.source = source;
}
get [Symbol.toStringTag]() {
return "Location";
}
toJSON() {
return {
start: this.start,
end: this.end
};
}
};
exports2.Location = Location;
var Token = class {
/**
* The kind of Token.
*/
/**
* The character offset at which this Node begins.
*/
/**
* The character offset at which this Node ends.
*/
/**
* The 1-indexed line number on which this Token appears.
*/
/**
* The 1-indexed column number at which this Token begins.
*/
/**
* For non-punctuation tokens, represents the interpreted value of the token.
*
* Note: is undefined for punctuation tokens, but typed as string for
* convenience in the parser.
*/
/**
* Tokens exist as nodes in a double-linked-list amongst all tokens
* including ignored tokens. <SOF> is always the first node and <EOF>
* the last.
*/
constructor(kind, start, end, line, column, value) {
this.kind = kind;
this.start = start;
this.end = end;
this.line = line;
this.column = column;
this.value = value;
this.prev = null;
this.next = null;
}
get [Symbol.toStringTag]() {
return "Token";
}
toJSON() {
return {
kind: this.kind,
value: this.value,
line: this.line,
column: this.column
};
}
};
exports2.Token = Token;
var QueryDocumentKeys = {
Name: [],
Document: ["definitions"],
OperationDefinition: [
"name",
"variableDefinitions",
"directives",
"selectionSet"
],
VariableDefinition: ["variable", "type", "defaultValue", "directives"],
Variable: ["name"],
SelectionSet: ["selections"],
Field: ["alias", "name", "arguments", "directives", "selectionSet"],
Argument: ["name", "value"],
FragmentSpread: ["name", "directives"],
InlineFragment: ["typeCondition", "directives", "selectionSet"],
FragmentDefinition: [
"name",
// Note: fragment variable definitions are deprecated and will removed in v17.0.0
"variableDefinitions",
"typeCondition",
"directives",
"selectionSet"
],
IntValue: [],
FloatValue: [],
StringValue: [],
BooleanValue: [],
NullValue: [],
EnumValue: [],
ListValue: ["values"],
ObjectValue: ["fields"],
ObjectField: ["name", "value"],
Directive: ["name", "arguments"],
NamedType: ["name"],
ListType: ["type"],
NonNullType: ["type"],
SchemaDefinition: ["description", "directives", "operationTypes"],
OperationTypeDefinition: ["type"],
ScalarTypeDefinition: ["description", "name", "directives"],
ObjectTypeDefinition: [
"description",
"name",
"interfaces",
"directives",
"fields"
],
FieldDefinition: ["description", "name", "arguments", "type", "directives"],
InputValueDefinition: [
"description",
"name",
"type",
"defaultValue",
"directives"
],
InterfaceTypeDefinition: [
"description",
"name",
"interfaces",
"directives",
"fields"
],
UnionTypeDefinition: ["description", "name", "directives", "types"],
EnumTypeDefinition: ["description", "name", "directives", "values"],
EnumValueDefinition: ["description", "name", "directives"],
InputObjectTypeDefinition: ["description", "name", "directives", "fields"],
DirectiveDefinition: ["description", "name", "arguments", "locations"],
SchemaExtension: ["directives", "operationTypes"],
ScalarTypeExtension: ["name", "directives"],
ObjectTypeExtension: ["name", "interfaces", "directives", "fields"],
InterfaceTypeExtension: ["name", "interfaces", "directives", "fields"],
UnionTypeExtension: ["name", "directives", "types"],
EnumTypeExtension: ["name", "directives", "values"],
InputObjectTypeExtension: ["name", "directives", "fields"]
};
exports2.QueryDocumentKeys = QueryDocumentKeys;
var kindValues = new Set(Object.keys(QueryDocumentKeys));
function isNode(maybeNode) {
const maybeKind = maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.kind;
return typeof maybeKind === "string" && kindValues.has(maybeKind);
}
var OperationTypeNode2;
exports2.OperationTypeNode = OperationTypeNode2;
(function(OperationTypeNode3) {
OperationTypeNode3["QUERY"] = "query";
OperationTypeNode3["MUTATION"] = "mutation";
OperationTypeNode3["SUBSCRIPTION"] = "subscription";
})(OperationTypeNode2 || (exports2.OperationTypeNode = OperationTypeNode2 = {}));
}
});
// node_modules/graphql/language/directiveLocation.js
var require_directiveLocation = __commonJS({
"node_modules/graphql/language/directiveLocation.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.DirectiveLocation = void 0;
var DirectiveLocation;
exports2.DirectiveLocation = DirectiveLocation;
(function(DirectiveLocation2) {
DirectiveLocation2["QUERY"] = "QUERY";
DirectiveLocation2["MUTATION"] = "MUTATION";
DirectiveLocation2["SUBSCRIPTION"] = "SUBSCRIPTION";
DirectiveLocation2["FIELD"] = "FIELD";
DirectiveLocation2["FRAGMENT_DEFINITION"] = "FRAGMENT_DEFINITION";
DirectiveLocation2["FRAGMENT_SPREAD"] = "FRAGMENT_SPREAD";
DirectiveLocation2["INLINE_FRAGMENT"] = "INLINE_FRAGMENT";
DirectiveLocation2["VARIABLE_DEFINITION"] = "VARIABLE_DEFINITION";
DirectiveLocation2["SCHEMA"] = "SCHEMA";
DirectiveLocation2["SCALAR"] = "SCALAR";
DirectiveLocation2["OBJECT"] = "OBJECT";
DirectiveLocation2["FIELD_DEFINITION"] = "FIELD_DEFINITION";
DirectiveLocation2["ARGUMENT_DEFINITION"] = "ARGUMENT_DEFINITION";
DirectiveLocation2["INTERFACE"] = "INTERFACE";
DirectiveLocation2["UNION"] = "UNION";
DirectiveLocation2["ENUM"] = "ENUM";
DirectiveLocation2["ENUM_VALUE"] = "ENUM_VALUE";
DirectiveLocation2["INPUT_OBJECT"] = "INPUT_OBJECT";
DirectiveLocation2["INPUT_FIELD_DEFINITION"] = "INPUT_FIELD_DEFINITION";
})(DirectiveLocation || (exports2.DirectiveLocation = DirectiveLocation = {}));
}
});
// node_modules/graphql/language/kinds.js
var require_kinds = __commonJS({
"node_modules/graphql/language/kinds.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.Kind = void 0;
var Kind2;
exports2.Kind = Kind2;
(function(Kind3) {
Kind3["NAME"] = "Name";
Kind3["DOCUMENT"] = "Document";
Kind3["OPERATION_DEFINITION"] = "OperationDefinition";
Kind3["VARIABLE_DEFINITION"] = "VariableDefinition";
Kind3["SELECTION_SET"] = "SelectionSet";
Kind3["FIELD"] = "Field";
Kind3["ARGUMENT"] = "Argument";
Kind3["FRAGMENT_SPREAD"] = "FragmentSpread";
Kind3["INLINE_FRAGMENT"] = "InlineFragment";
Kind3["FRAGMENT_DEFINITION"] = "FragmentDefinition";
Kind3["VARIABLE"] = "Variable";
Kind3["INT"] = "IntValue";
Kind3["FLOAT"] = "FloatValue";
Kind3["STRING"] = "StringValue";
Kind3["BOOLEAN"] = "BooleanValue";
Kind3["NULL"] = "NullValue";
Kind3["ENUM"] = "EnumValue";
Kind3["LIST"] = "ListValue";
Kind3["OBJECT"] = "ObjectValue";
Kind3["OBJECT_FIELD"] = "ObjectField";
Kind3["DIRECTIVE"] = "Directive";
Kind3["NAMED_TYPE"] = "NamedType";
Kind3["LIST_TYPE"] = "ListType";
Kind3["NON_NULL_TYPE"] = "NonNullType";
Kind3["SCHEMA_DEFINITION"] = "SchemaDefinition";
Kind3["OPERATION_TYPE_DEFINITION"] = "OperationTypeDefinition";
Kind3["SCALAR_TYPE_DEFINITION"] = "ScalarTypeDefinition";
Kind3["OBJECT_TYPE_DEFINITION"] = "ObjectTypeDefinition";
Kind3["FIELD_DEFINITION"] = "FieldDefinition";
Kind3["INPUT_VALUE_DEFINITION"] = "InputValueDefinition";
Kind3["INTERFACE_TYPE_DEFINITION"] = "InterfaceTypeDefinition";
Kind3["UNION_TYPE_DEFINITION"] = "UnionTypeDefinition";
Kind3["ENUM_TYPE_DEFINITION"] = "EnumTypeDefinition";
Kind3["ENUM_VALUE_DEFINITION"] = "EnumValueDefinition";
Kind3["INPUT_OBJECT_TYPE_DEFINITION"] = "InputObjectTypeDefinition";
Kind3["DIRECTIVE_DEFINITION"] = "DirectiveDefinition";
Kind3["SCHEMA_EXTENSION"] = "SchemaExtension";
Kind3["SCALAR_TYPE_EXTENSION"] = "ScalarTypeExtension";
Kind3["OBJECT_TYPE_EXTENSION"] = "ObjectTypeExtension";
Kind3["INTERFACE_TYPE_EXTENSION"] = "InterfaceTypeExtension";
Kind3["UNION_TYPE_EXTENSION"] = "Uni