Skip to content

Instantly share code, notes, and snippets.

@cayter
Created July 13, 2023 12:41
Show Gist options
  • Save cayter/470b5add0592df616d65687b0788c1ce to your computer and use it in GitHub Desktop.
Save cayter/470b5add0592df616d65687b0788c1ce to your computer and use it in GitHub Desktop.
drizzle-kit
This file has been truncated, but you can view the full file.
#!/usr/bin/env node
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 __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 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/.pnpm/zod@3.20.2/node_modules/zod/lib/index.mjs
function getErrorMap() {
return overrideErrorMap;
}
function addIssueToContext(ctx, issueData) {
const issue = makeIssue({
issueData,
data: ctx.data,
path: ctx.path,
errorMaps: [
ctx.common.contextualErrorMap,
ctx.schemaErrorMap,
getErrorMap(),
errorMap
// then global default map
].filter((x) => !!x)
});
ctx.common.issues.push(issue);
}
function processCreateParams(params) {
if (!params)
return {};
const { errorMap: errorMap2, invalid_type_error, required_error, description } = params;
if (errorMap2 && (invalid_type_error || required_error)) {
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
}
if (errorMap2)
return { errorMap: errorMap2, description };
const customMap = (iss, ctx) => {
if (iss.code !== "invalid_type")
return { message: ctx.defaultError };
if (typeof ctx.data === "undefined") {
return { message: required_error !== null && required_error !== void 0 ? required_error : ctx.defaultError };
}
return { message: invalid_type_error !== null && invalid_type_error !== void 0 ? invalid_type_error : ctx.defaultError };
};
return { errorMap: customMap, description };
}
function floatSafeRemainder(val, step) {
const valDecCount = (val.toString().split(".")[1] || "").length;
const stepDecCount = (step.toString().split(".")[1] || "").length;
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
return valInt % stepInt / Math.pow(10, decCount);
}
function deepPartialify(schema4) {
if (schema4 instanceof ZodObject) {
const newShape = {};
for (const key in schema4.shape) {
const fieldSchema = schema4.shape[key];
newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
}
return new ZodObject({
...schema4._def,
shape: () => newShape
});
} else if (schema4 instanceof ZodArray) {
return ZodArray.create(deepPartialify(schema4.element));
} else if (schema4 instanceof ZodOptional) {
return ZodOptional.create(deepPartialify(schema4.unwrap()));
} else if (schema4 instanceof ZodNullable) {
return ZodNullable.create(deepPartialify(schema4.unwrap()));
} else if (schema4 instanceof ZodTuple) {
return ZodTuple.create(schema4.items.map((item) => deepPartialify(item)));
} else {
return schema4;
}
}
function mergeValues(a, b) {
const aType = getParsedType(a);
const bType = getParsedType(b);
if (a === b) {
return { valid: true, data: a };
} else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
const bKeys = util.objectKeys(b);
const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
const newObj = { ...a, ...b };
for (const key of sharedKeys) {
const sharedValue = mergeValues(a[key], b[key]);
if (!sharedValue.valid) {
return { valid: false };
}
newObj[key] = sharedValue.data;
}
return { valid: true, data: newObj };
} else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
if (a.length !== b.length) {
return { valid: false };
}
const newArray = [];
for (let index4 = 0; index4 < a.length; index4++) {
const itemA = a[index4];
const itemB = b[index4];
const sharedValue = mergeValues(itemA, itemB);
if (!sharedValue.valid) {
return { valid: false };
}
newArray.push(sharedValue.data);
}
return { valid: true, data: newArray };
} else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {
return { valid: true, data: a };
} else {
return { valid: false };
}
}
function createZodEnum(values, params) {
return new ZodEnum({
values,
typeName: ZodFirstPartyTypeKind.ZodEnum,
...processCreateParams(params)
});
}
var util, ZodParsedType, getParsedType, ZodIssueCode, ZodError, errorMap, overrideErrorMap, makeIssue, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync, errorUtil, ParseInputLazyPath, handleResult, ZodType, cuidRegex, uuidRegex, emailRegex, datetimeRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, objectUtil, AugmentFactory, ZodObject, ZodUnion, getDiscriminator, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, BRAND, ZodBranded, ZodPipeline, late, ZodFirstPartyTypeKind, stringType, numberType, nanType, bigIntType, booleanType, dateType, symbolType, undefinedType, nullType, anyType, unknownType, neverType, voidType, arrayType, objectType, strictObjectType, unionType, discriminatedUnionType, intersectionType, tupleType, recordType, mapType, setType, functionType, lazyType, literalType, enumType, nativeEnumType, promiseType, effectsType, optionalType, nullableType, preprocessType, pipelineType, coerce;
var init_lib = __esm({
"node_modules/.pnpm/zod@3.20.2/node_modules/zod/lib/index.mjs"() {
(function(util2) {
util2.assertEqual = (val) => val;
function assertIs(_arg) {
}
util2.assertIs = assertIs;
function assertNever(_x) {
throw new Error();
}
util2.assertNever = assertNever;
util2.arrayToEnum = (items) => {
const obj = {};
for (const item of items) {
obj[item] = item;
}
return obj;
};
util2.getValidEnumValues = (obj) => {
const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
const filtered = {};
for (const k of validKeys) {
filtered[k] = obj[k];
}
return util2.objectValues(filtered);
};
util2.objectValues = (obj) => {
return util2.objectKeys(obj).map(function(e) {
return obj[e];
});
};
util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => {
const keys = [];
for (const key in object) {
if (Object.prototype.hasOwnProperty.call(object, key)) {
keys.push(key);
}
}
return keys;
};
util2.find = (arr, checker) => {
for (const item of arr) {
if (checker(item))
return item;
}
return void 0;
};
util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
function joinValues(array, separator = " | ") {
return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
}
util2.joinValues = joinValues;
util2.jsonStringifyReplacer = (_, value) => {
if (typeof value === "bigint") {
return value.toString();
}
return value;
};
})(util || (util = {}));
ZodParsedType = util.arrayToEnum([
"string",
"nan",
"number",
"integer",
"float",
"boolean",
"date",
"bigint",
"symbol",
"function",
"undefined",
"null",
"array",
"object",
"unknown",
"promise",
"void",
"never",
"map",
"set"
]);
getParsedType = (data) => {
const t = typeof data;
switch (t) {
case "undefined":
return ZodParsedType.undefined;
case "string":
return ZodParsedType.string;
case "number":
return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
case "boolean":
return ZodParsedType.boolean;
case "function":
return ZodParsedType.function;
case "bigint":
return ZodParsedType.bigint;
case "symbol":
return ZodParsedType.symbol;
case "object":
if (Array.isArray(data)) {
return ZodParsedType.array;
}
if (data === null) {
return ZodParsedType.null;
}
if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
return ZodParsedType.promise;
}
if (typeof Map !== "undefined" && data instanceof Map) {
return ZodParsedType.map;
}
if (typeof Set !== "undefined" && data instanceof Set) {
return ZodParsedType.set;
}
if (typeof Date !== "undefined" && data instanceof Date) {
return ZodParsedType.date;
}
return ZodParsedType.object;
default:
return ZodParsedType.unknown;
}
};
ZodIssueCode = util.arrayToEnum([
"invalid_type",
"invalid_literal",
"custom",
"invalid_union",
"invalid_union_discriminator",
"invalid_enum_value",
"unrecognized_keys",
"invalid_arguments",
"invalid_return_type",
"invalid_date",
"invalid_string",
"too_small",
"too_big",
"invalid_intersection_types",
"not_multiple_of",
"not_finite"
]);
ZodError = class extends Error {
constructor(issues) {
super();
this.issues = [];
this.addIssue = (sub) => {
this.issues = [...this.issues, sub];
};
this.addIssues = (subs = []) => {
this.issues = [...this.issues, ...subs];
};
const actualProto = new.target.prototype;
if (Object.setPrototypeOf) {
Object.setPrototypeOf(this, actualProto);
} else {
this.__proto__ = actualProto;
}
this.name = "ZodError";
this.issues = issues;
}
get errors() {
return this.issues;
}
format(_mapper) {
const mapper = _mapper || function(issue) {
return issue.message;
};
const fieldErrors = { _errors: [] };
const processError = (error2) => {
for (const issue of error2.issues) {
if (issue.code === "invalid_union") {
issue.unionErrors.map(processError);
} else if (issue.code === "invalid_return_type") {
processError(issue.returnTypeError);
} else if (issue.code === "invalid_arguments") {
processError(issue.argumentsError);
} else if (issue.path.length === 0) {
fieldErrors._errors.push(mapper(issue));
} else {
let curr = fieldErrors;
let i = 0;
while (i < issue.path.length) {
const el = issue.path[i];
const terminal = i === issue.path.length - 1;
if (!terminal) {
curr[el] = curr[el] || { _errors: [] };
} else {
curr[el] = curr[el] || { _errors: [] };
curr[el]._errors.push(mapper(issue));
}
curr = curr[el];
i++;
}
}
}
};
processError(this);
return fieldErrors;
}
toString() {
return this.message;
}
get message() {
return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
}
get isEmpty() {
return this.issues.length === 0;
}
flatten(mapper = (issue) => issue.message) {
const fieldErrors = {};
const formErrors = [];
for (const sub of this.issues) {
if (sub.path.length > 0) {
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
fieldErrors[sub.path[0]].push(mapper(sub));
} else {
formErrors.push(mapper(sub));
}
}
return { formErrors, fieldErrors };
}
get formErrors() {
return this.flatten();
}
};
ZodError.create = (issues) => {
const error2 = new ZodError(issues);
return error2;
};
errorMap = (issue, _ctx) => {
let message;
switch (issue.code) {
case ZodIssueCode.invalid_type:
if (issue.received === ZodParsedType.undefined) {
message = "Required";
} else {
message = `Expected ${issue.expected}, received ${issue.received}`;
}
break;
case ZodIssueCode.invalid_literal:
message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
break;
case ZodIssueCode.unrecognized_keys:
message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
break;
case ZodIssueCode.invalid_union:
message = `Invalid input`;
break;
case ZodIssueCode.invalid_union_discriminator:
message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
break;
case ZodIssueCode.invalid_enum_value:
message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
break;
case ZodIssueCode.invalid_arguments:
message = `Invalid function arguments`;
break;
case ZodIssueCode.invalid_return_type:
message = `Invalid function return type`;
break;
case ZodIssueCode.invalid_date:
message = `Invalid date`;
break;
case ZodIssueCode.invalid_string:
if (typeof issue.validation === "object") {
if ("startsWith" in issue.validation) {
message = `Invalid input: must start with "${issue.validation.startsWith}"`;
} else if ("endsWith" in issue.validation) {
message = `Invalid input: must end with "${issue.validation.endsWith}"`;
} else {
util.assertNever(issue.validation);
}
} else if (issue.validation !== "regex") {
message = `Invalid ${issue.validation}`;
} else {
message = "Invalid";
}
break;
case ZodIssueCode.too_small:
if (issue.type === "array")
message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
else if (issue.type === "string")
message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
else if (issue.type === "number")
message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
else if (issue.type === "date")
message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(issue.minimum)}`;
else
message = "Invalid input";
break;
case ZodIssueCode.too_big:
if (issue.type === "array")
message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
else if (issue.type === "string")
message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
else if (issue.type === "number")
message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
else if (issue.type === "date")
message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(issue.maximum)}`;
else
message = "Invalid input";
break;
case ZodIssueCode.custom:
message = `Invalid input`;
break;
case ZodIssueCode.invalid_intersection_types:
message = `Intersection results could not be merged`;
break;
case ZodIssueCode.not_multiple_of:
message = `Number must be a multiple of ${issue.multipleOf}`;
break;
case ZodIssueCode.not_finite:
message = "Number must be finite";
break;
default:
message = _ctx.defaultError;
util.assertNever(issue);
}
return { message };
};
overrideErrorMap = errorMap;
makeIssue = (params) => {
const { data, path: path3, errorMaps, issueData } = params;
const fullPath = [...path3, ...issueData.path || []];
const fullIssue = {
...issueData,
path: fullPath
};
let errorMessage = "";
const maps = errorMaps.filter((m) => !!m).slice().reverse();
for (const map of maps) {
errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
}
return {
...issueData,
path: fullPath,
message: issueData.message || errorMessage
};
};
ParseStatus = class _ParseStatus {
constructor() {
this.value = "valid";
}
dirty() {
if (this.value === "valid")
this.value = "dirty";
}
abort() {
if (this.value !== "aborted")
this.value = "aborted";
}
static mergeArray(status, results) {
const arrayValue = [];
for (const s of results) {
if (s.status === "aborted")
return INVALID;
if (s.status === "dirty")
status.dirty();
arrayValue.push(s.value);
}
return { status: status.value, value: arrayValue };
}
static async mergeObjectAsync(status, pairs) {
const syncPairs = [];
for (const pair of pairs) {
syncPairs.push({
key: await pair.key,
value: await pair.value
});
}
return _ParseStatus.mergeObjectSync(status, syncPairs);
}
static mergeObjectSync(status, pairs) {
const finalObject = {};
for (const pair of pairs) {
const { key, value } = pair;
if (key.status === "aborted")
return INVALID;
if (value.status === "aborted")
return INVALID;
if (key.status === "dirty")
status.dirty();
if (value.status === "dirty")
status.dirty();
if (typeof value.value !== "undefined" || pair.alwaysSet) {
finalObject[key.value] = value.value;
}
}
return { status: status.value, value: finalObject };
}
};
INVALID = Object.freeze({
status: "aborted"
});
DIRTY = (value) => ({ status: "dirty", value });
OK = (value) => ({ status: "valid", value });
isAborted = (x) => x.status === "aborted";
isDirty = (x) => x.status === "dirty";
isValid = (x) => x.status === "valid";
isAsync = (x) => typeof Promise !== void 0 && x instanceof Promise;
(function(errorUtil2) {
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
})(errorUtil || (errorUtil = {}));
ParseInputLazyPath = class {
constructor(parent, value, path3, key) {
this.parent = parent;
this.data = value;
this._path = path3;
this._key = key;
}
get path() {
return this._path.concat(this._key);
}
};
handleResult = (ctx, result) => {
if (isValid(result)) {
return { success: true, data: result.value };
} else {
if (!ctx.common.issues.length) {
throw new Error("Validation failed but no issues detected.");
}
const error2 = new ZodError(ctx.common.issues);
return { success: false, error: error2 };
}
};
ZodType = class {
constructor(def) {
this.spa = this.safeParseAsync;
this._def = def;
this.parse = this.parse.bind(this);
this.safeParse = this.safeParse.bind(this);
this.parseAsync = this.parseAsync.bind(this);
this.safeParseAsync = this.safeParseAsync.bind(this);
this.spa = this.spa.bind(this);
this.refine = this.refine.bind(this);
this.refinement = this.refinement.bind(this);
this.superRefine = this.superRefine.bind(this);
this.optional = this.optional.bind(this);
this.nullable = this.nullable.bind(this);
this.nullish = this.nullish.bind(this);
this.array = this.array.bind(this);
this.promise = this.promise.bind(this);
this.or = this.or.bind(this);
this.and = this.and.bind(this);
this.transform = this.transform.bind(this);
this.brand = this.brand.bind(this);
this.default = this.default.bind(this);
this.catch = this.catch.bind(this);
this.describe = this.describe.bind(this);
this.pipe = this.pipe.bind(this);
this.isNullable = this.isNullable.bind(this);
this.isOptional = this.isOptional.bind(this);
}
get description() {
return this._def.description;
}
_getType(input) {
return getParsedType(input.data);
}
_getOrReturnCtx(input, ctx) {
return ctx || {
common: input.parent.common,
data: input.data,
parsedType: getParsedType(input.data),
schemaErrorMap: this._def.errorMap,
path: input.path,
parent: input.parent
};
}
_processInputParams(input) {
return {
status: new ParseStatus(),
ctx: {
common: input.parent.common,
data: input.data,
parsedType: getParsedType(input.data),
schemaErrorMap: this._def.errorMap,
path: input.path,
parent: input.parent
}
};
}
_parseSync(input) {
const result = this._parse(input);
if (isAsync(result)) {
throw new Error("Synchronous parse encountered promise.");
}
return result;
}
_parseAsync(input) {
const result = this._parse(input);
return Promise.resolve(result);
}
parse(data, params) {
const result = this.safeParse(data, params);
if (result.success)
return result.data;
throw result.error;
}
safeParse(data, params) {
var _a;
const ctx = {
common: {
issues: [],
async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,
contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap
},
path: (params === null || params === void 0 ? void 0 : params.path) || [],
schemaErrorMap: this._def.errorMap,
parent: null,
data,
parsedType: getParsedType(data)
};
const result = this._parseSync({ data, path: ctx.path, parent: ctx });
return handleResult(ctx, result);
}
async parseAsync(data, params) {
const result = await this.safeParseAsync(data, params);
if (result.success)
return result.data;
throw result.error;
}
async safeParseAsync(data, params) {
const ctx = {
common: {
issues: [],
contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
async: true
},
path: (params === null || params === void 0 ? void 0 : params.path) || [],
schemaErrorMap: this._def.errorMap,
parent: null,
data,
parsedType: getParsedType(data)
};
const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
return handleResult(ctx, result);
}
refine(check, message) {
const getIssueProperties = (val) => {
if (typeof message === "string" || typeof message === "undefined") {
return { message };
} else if (typeof message === "function") {
return message(val);
} else {
return message;
}
};
return this._refinement((val, ctx) => {
const result = check(val);
const setError = () => ctx.addIssue({
code: ZodIssueCode.custom,
...getIssueProperties(val)
});
if (typeof Promise !== "undefined" && result instanceof Promise) {
return result.then((data) => {
if (!data) {
setError();
return false;
} else {
return true;
}
});
}
if (!result) {
setError();
return false;
} else {
return true;
}
});
}
refinement(check, refinementData) {
return this._refinement((val, ctx) => {
if (!check(val)) {
ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
return false;
} else {
return true;
}
});
}
_refinement(refinement) {
return new ZodEffects({
schema: this,
typeName: ZodFirstPartyTypeKind.ZodEffects,
effect: { type: "refinement", refinement }
});
}
superRefine(refinement) {
return this._refinement(refinement);
}
optional() {
return ZodOptional.create(this);
}
nullable() {
return ZodNullable.create(this);
}
nullish() {
return this.optional().nullable();
}
array() {
return ZodArray.create(this);
}
promise() {
return ZodPromise.create(this);
}
or(option) {
return ZodUnion.create([this, option]);
}
and(incoming) {
return ZodIntersection.create(this, incoming);
}
transform(transform) {
return new ZodEffects({
schema: this,
typeName: ZodFirstPartyTypeKind.ZodEffects,
effect: { type: "transform", transform }
});
}
default(def) {
const defaultValueFunc = typeof def === "function" ? def : () => def;
return new ZodDefault({
innerType: this,
defaultValue: defaultValueFunc,
typeName: ZodFirstPartyTypeKind.ZodDefault
});
}
brand() {
return new ZodBranded({
typeName: ZodFirstPartyTypeKind.ZodBranded,
type: this,
...processCreateParams(void 0)
});
}
catch(def) {
const defaultValueFunc = typeof def === "function" ? def : () => def;
return new ZodCatch({
innerType: this,
defaultValue: defaultValueFunc,
typeName: ZodFirstPartyTypeKind.ZodCatch
});
}
describe(description) {
const This = this.constructor;
return new This({
...this._def,
description
});
}
pipe(target) {
return ZodPipeline.create(this, target);
}
isOptional() {
return this.safeParse(void 0).success;
}
isNullable() {
return this.safeParse(null).success;
}
};
cuidRegex = /^c[^\s-]{8,}$/i;
uuidRegex = /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;
emailRegex = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
datetimeRegex = (args) => {
if (args.precision) {
if (args.offset) {
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}:\\d{2})|Z)$`);
} else {
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
}
} else if (args.precision === 0) {
if (args.offset) {
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
} else {
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
}
} else {
if (args.offset) {
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
} else {
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
}
}
};
ZodString = class _ZodString extends ZodType {
constructor() {
super(...arguments);
this._regex = (regex, validation, message) => this.refinement((data) => regex.test(data), {
validation,
code: ZodIssueCode.invalid_string,
...errorUtil.errToObj(message)
});
this.nonempty = (message) => this.min(1, errorUtil.errToObj(message));
this.trim = () => new _ZodString({
...this._def,
checks: [...this._def.checks, { kind: "trim" }]
});
}
_parse(input) {
if (this._def.coerce) {
input.data = String(input.data);
}
const parsedType = this._getType(input);
if (parsedType !== ZodParsedType.string) {
const ctx2 = this._getOrReturnCtx(input);
addIssueToContext(
ctx2,
{
code: ZodIssueCode.invalid_type,
expected: ZodParsedType.string,
received: ctx2.parsedType
}
//
);
return INVALID;
}
const status = new ParseStatus();
let ctx = void 0;
for (const check of this._def.checks) {
if (check.kind === "min") {
if (input.data.length < check.value) {
ctx = this._getOrReturnCtx(input, ctx);
addIssueToContext(ctx, {
code: ZodIssueCode.too_small,
minimum: check.value,
type: "string",
inclusive: true,
exact: false,
message: check.message
});
status.dirty();
}
} else if (check.kind === "max") {
if (input.data.length > check.value) {
ctx = this._getOrReturnCtx(input, ctx);
addIssueToContext(ctx, {
code: ZodIssueCode.too_big,
maximum: check.value,
type: "string",
inclusive: true,
exact: false,
message: check.message
});
status.dirty();
}
} else if (check.kind === "length") {
const tooBig = input.data.length > check.value;
const tooSmall = input.data.length < check.value;
if (tooBig || tooSmall) {
ctx = this._getOrReturnCtx(input, ctx);
if (tooBig) {
addIssueToContext(ctx, {
code: ZodIssueCode.too_big,
maximum: check.value,
type: "string",
inclusive: true,
exact: true,
message: check.message
});
} else if (tooSmall) {
addIssueToContext(ctx, {
code: ZodIssueCode.too_small,
minimum: check.value,
type: "string",
inclusive: true,
exact: true,
message: check.message
});
}
status.dirty();
}
} else if (check.kind === "email") {
if (!emailRegex.test(input.data)) {
ctx = this._getOrReturnCtx(input, ctx);
addIssueToContext(ctx, {
validation: "email",
code: ZodIssueCode.invalid_string,
message: check.message
});
status.dirty();
}
} else if (check.kind === "uuid") {
if (!uuidRegex.test(input.data)) {
ctx = this._getOrReturnCtx(input, ctx);
addIssueToContext(ctx, {
validation: "uuid",
code: ZodIssueCode.invalid_string,
message: check.message
});
status.dirty();
}
} else if (check.kind === "cuid") {
if (!cuidRegex.test(input.data)) {
ctx = this._getOrReturnCtx(input, ctx);
addIssueToContext(ctx, {
validation: "cuid",
code: ZodIssueCode.invalid_string,
message: check.message
});
status.dirty();
}
} else if (check.kind === "url") {
try {
new URL(input.data);
} catch (_a) {
ctx = this._getOrReturnCtx(input, ctx);
addIssueToContext(ctx, {
validation: "url",
code: ZodIssueCode.invalid_string,
message: check.message
});
status.dirty();
}
} else if (check.kind === "regex") {
check.regex.lastIndex = 0;
const testResult = check.regex.test(input.data);
if (!testResult) {
ctx = this._getOrReturnCtx(input, ctx);
addIssueToContext(ctx, {
validation: "regex",
code: ZodIssueCode.invalid_string,
message: check.message
});
status.dirty();
}
} else if (check.kind === "trim") {
input.data = input.data.trim();
} else if (check.kind === "startsWith") {
if (!input.data.startsWith(check.value)) {
ctx = this._getOrReturnCtx(input, ctx);
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_string,
validation: { startsWith: check.value },
message: check.message
});
status.dirty();
}
} else if (check.kind === "endsWith") {
if (!input.data.endsWith(check.value)) {
ctx = this._getOrReturnCtx(input, ctx);
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_string,
validation: { endsWith: check.value },
message: check.message
});
status.dirty();
}
} else if (check.kind === "datetime") {
const regex = datetimeRegex(check);
if (!regex.test(input.data)) {
ctx = this._getOrReturnCtx(input, ctx);
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_string,
validation: "datetime",
message: check.message
});
status.dirty();
}
} else {
util.assertNever(check);
}
}
return { status: status.value, value: input.data };
}
_addCheck(check) {
return new _ZodString({
...this._def,
checks: [...this._def.checks, check]
});
}
email(message) {
return this._addCheck({ kind: "email", ...errorUtil.errToObj(message) });
}
url(message) {
return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
}
uuid(message) {
return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
}
cuid(message) {
return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
}
datetime(options) {
var _a;
if (typeof options === "string") {
return this._addCheck({
kind: "datetime",
precision: null,
offset: false,
message: options
});
}
return this._addCheck({
kind: "datetime",
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
});
}
regex(regex, message) {
return this._addCheck({
kind: "regex",
regex,
...errorUtil.errToObj(message)
});
}
startsWith(value, message) {
return this._addCheck({
kind: "startsWith",
value,
...errorUtil.errToObj(message)
});
}
endsWith(value, message) {
return this._addCheck({
kind: "endsWith",
value,
...errorUtil.errToObj(message)
});
}
min(minLength, message) {
return this._addCheck({
kind: "min",
value: minLength,
...errorUtil.errToObj(message)
});
}
max(maxLength, message) {
return this._addCheck({
kind: "max",
value: maxLength,
...errorUtil.errToObj(message)
});
}
length(len, message) {
return this._addCheck({
kind: "length",
value: len,
...errorUtil.errToObj(message)
});
}
get isDatetime() {
return !!this._def.checks.find((ch) => ch.kind === "datetime");
}
get isEmail() {
return !!this._def.checks.find((ch) => ch.kind === "email");
}
get isURL() {
return !!this._def.checks.find((ch) => ch.kind === "url");
}
get isUUID() {
return !!this._def.checks.find((ch) => ch.kind === "uuid");
}
get isCUID() {
return !!this._def.checks.find((ch) => ch.kind === "cuid");
}
get minLength() {
let min = null;
for (const ch of this._def.checks) {
if (ch.kind === "min") {
if (min === null || ch.value > min)
min = ch.value;
}
}
return min;
}
get maxLength() {
let max = null;
for (const ch of this._def.checks) {
if (ch.kind === "max") {
if (max === null || ch.value < max)
max = ch.value;
}
}
return max;
}
};
ZodString.create = (params) => {
var _a;
return new ZodString({
checks: [],
typeName: ZodFirstPartyTypeKind.ZodString,
coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
...processCreateParams(params)
});
};
ZodNumber = class _ZodNumber extends ZodType {
constructor() {
super(...arguments);
this.min = this.gte;
this.max = this.lte;
this.step = this.multipleOf;
}
_parse(input) {
if (this._def.coerce) {
input.data = Number(input.data);
}
const parsedType = this._getType(input);
if (parsedType !== ZodParsedType.number) {
const ctx2 = this._getOrReturnCtx(input);
addIssueToContext(ctx2, {
code: ZodIssueCode.invalid_type,
expected: ZodParsedType.number,
received: ctx2.parsedType
});
return INVALID;
}
let ctx = void 0;
const status = new ParseStatus();
for (const check of this._def.checks) {
if (check.kind === "int") {
if (!util.isInteger(input.data)) {
ctx = this._getOrReturnCtx(input, ctx);
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_type,
expected: "integer",
received: "float",
message: check.message
});
status.dirty();
}
} else if (check.kind === "min") {
const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
if (tooSmall) {
ctx = this._getOrReturnCtx(input, ctx);
addIssueToContext(ctx, {
code: ZodIssueCode.too_small,
minimum: check.value,
type: "number",
inclusive: check.inclusive,
exact: false,
message: check.message
});
status.dirty();
}
} else if (check.kind === "max") {
const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
if (tooBig) {
ctx = this._getOrReturnCtx(input, ctx);
addIssueToContext(ctx, {
code: ZodIssueCode.too_big,
maximum: check.value,
type: "number",
inclusive: check.inclusive,
exact: false,
message: check.message
});
status.dirty();
}
} else if (check.kind === "multipleOf") {
if (floatSafeRemainder(input.data, check.value) !== 0) {
ctx = this._getOrReturnCtx(input, ctx);
addIssueToContext(ctx, {
code: ZodIssueCode.not_multiple_of,
multipleOf: check.value,
message: check.message
});
status.dirty();
}
} else if (check.kind === "finite") {
if (!Number.isFinite(input.data)) {
ctx = this._getOrReturnCtx(input, ctx);
addIssueToContext(ctx, {
code: ZodIssueCode.not_finite,
message: check.message
});
status.dirty();
}
} else {
util.assertNever(check);
}
}
return { status: status.value, value: input.data };
}
gte(value, message) {
return this.setLimit("min", value, true, errorUtil.toString(message));
}
gt(value, message) {
return this.setLimit("min", value, false, errorUtil.toString(message));
}
lte(value, message) {
return this.setLimit("max", value, true, errorUtil.toString(message));
}
lt(value, message) {
return this.setLimit("max", value, false, errorUtil.toString(message));
}
setLimit(kind, value, inclusive, message) {
return new _ZodNumber({
...this._def,
checks: [
...this._def.checks,
{
kind,
value,
inclusive,
message: errorUtil.toString(message)
}
]
});
}
_addCheck(check) {
return new _ZodNumber({
...this._def,
checks: [...this._def.checks, check]
});
}
int(message) {
return this._addCheck({
kind: "int",
message: errorUtil.toString(message)
});
}
positive(message) {
return this._addCheck({
kind: "min",
value: 0,
inclusive: false,
message: errorUtil.toString(message)
});
}
negative(message) {
return this._addCheck({
kind: "max",
value: 0,
inclusive: false,
message: errorUtil.toString(message)
});
}
nonpositive(message) {
return this._addCheck({
kind: "max",
value: 0,
inclusive: true,
message: errorUtil.toString(message)
});
}
nonnegative(message) {
return this._addCheck({
kind: "min",
value: 0,
inclusive: true,
message: errorUtil.toString(message)
});
}
multipleOf(value, message) {
return this._addCheck({
kind: "multipleOf",
value,
message: errorUtil.toString(message)
});
}
finite(message) {
return this._addCheck({
kind: "finite",
message: errorUtil.toString(message)
});
}
get minValue() {
let min = null;
for (const ch of this._def.checks) {
if (ch.kind === "min") {
if (min === null || ch.value > min)
min = ch.value;
}
}
return min;
}
get maxValue() {
let max = null;
for (const ch of this._def.checks) {
if (ch.kind === "max") {
if (max === null || ch.value < max)
max = ch.value;
}
}
return max;
}
get isInt() {
return !!this._def.checks.find((ch) => ch.kind === "int");
}
};
ZodNumber.create = (params) => {
return new ZodNumber({
checks: [],
typeName: ZodFirstPartyTypeKind.ZodNumber,
coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
...processCreateParams(params)
});
};
ZodBigInt = class extends ZodType {
_parse(input) {
if (this._def.coerce) {
input.data = BigInt(input.data);
}
const parsedType = this._getType(input);
if (parsedType !== ZodParsedType.bigint) {
const ctx = this._getOrReturnCtx(input);
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_type,
expected: ZodParsedType.bigint,
received: ctx.parsedType
});
return INVALID;
}
return OK(input.data);
}
};
ZodBigInt.create = (params) => {
var _a;
return new ZodBigInt({
typeName: ZodFirstPartyTypeKind.ZodBigInt,
coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
...processCreateParams(params)
});
};
ZodBoolean = class extends ZodType {
_parse(input) {
if (this._def.coerce) {
input.data = Boolean(input.data);
}
const parsedType = this._getType(input);
if (parsedType !== ZodParsedType.boolean) {
const ctx = this._getOrReturnCtx(input);
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_type,
expected: ZodParsedType.boolean,
received: ctx.parsedType
});
return INVALID;
}
return OK(input.data);
}
};
ZodBoolean.create = (params) => {
return new ZodBoolean({
typeName: ZodFirstPartyTypeKind.ZodBoolean,
coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
...processCreateParams(params)
});
};
ZodDate = class _ZodDate extends ZodType {
_parse(input) {
if (this._def.coerce) {
input.data = new Date(input.data);
}
const parsedType = this._getType(input);
if (parsedType !== ZodParsedType.date) {
const ctx2 = this._getOrReturnCtx(input);
addIssueToContext(ctx2, {
code: ZodIssueCode.invalid_type,
expected: ZodParsedType.date,
received: ctx2.parsedType
});
return INVALID;
}
if (isNaN(input.data.getTime())) {
const ctx2 = this._getOrReturnCtx(input);
addIssueToContext(ctx2, {
code: ZodIssueCode.invalid_date
});
return INVALID;
}
const status = new ParseStatus();
let ctx = void 0;
for (const check of this._def.checks) {
if (check.kind === "min") {
if (input.data.getTime() < check.value) {
ctx = this._getOrReturnCtx(input, ctx);
addIssueToContext(ctx, {
code: ZodIssueCode.too_small,
message: check.message,
inclusive: true,
exact: false,
minimum: check.value,
type: "date"
});
status.dirty();
}
} else if (check.kind === "max") {
if (input.data.getTime() > check.value) {
ctx = this._getOrReturnCtx(input, ctx);
addIssueToContext(ctx, {
code: ZodIssueCode.too_big,
message: check.message,
inclusive: true,
exact: false,
maximum: check.value,
type: "date"
});
status.dirty();
}
} else {
util.assertNever(check);
}
}
return {
status: status.value,
value: new Date(input.data.getTime())
};
}
_addCheck(check) {
return new _ZodDate({
...this._def,
checks: [...this._def.checks, check]
});
}
min(minDate, message) {
return this._addCheck({
kind: "min",
value: minDate.getTime(),
message: errorUtil.toString(message)
});
}
max(maxDate, message) {
return this._addCheck({
kind: "max",
value: maxDate.getTime(),
message: errorUtil.toString(message)
});
}
get minDate() {
let min = null;
for (const ch of this._def.checks) {
if (ch.kind === "min") {
if (min === null || ch.value > min)
min = ch.value;
}
}
return min != null ? new Date(min) : null;
}
get maxDate() {
let max = null;
for (const ch of this._def.checks) {
if (ch.kind === "max") {
if (max === null || ch.value < max)
max = ch.value;
}
}
return max != null ? new Date(max) : null;
}
};
ZodDate.create = (params) => {
return new ZodDate({
checks: [],
coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
typeName: ZodFirstPartyTypeKind.ZodDate,
...processCreateParams(params)
});
};
ZodSymbol = class extends ZodType {
_parse(input) {
const parsedType = this._getType(input);
if (parsedType !== ZodParsedType.symbol) {
const ctx = this._getOrReturnCtx(input);
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_type,
expected: ZodParsedType.symbol,
received: ctx.parsedType
});
return INVALID;
}
return OK(input.data);
}
};
ZodSymbol.create = (params) => {
return new ZodSymbol({
typeName: ZodFirstPartyTypeKind.ZodSymbol,
...processCreateParams(params)
});
};
ZodUndefined = class extends ZodType {
_parse(input) {
const parsedType = this._getType(input);
if (parsedType !== ZodParsedType.undefined) {
const ctx = this._getOrReturnCtx(input);
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_type,
expected: ZodParsedType.undefined,
received: ctx.parsedType
});
return INVALID;
}
return OK(input.data);
}
};
ZodUndefined.create = (params) => {
return new ZodUndefined({
typeName: ZodFirstPartyTypeKind.ZodUndefined,
...processCreateParams(params)
});
};
ZodNull = class extends ZodType {
_parse(input) {
const parsedType = this._getType(input);
if (parsedType !== ZodParsedType.null) {
const ctx = this._getOrReturnCtx(input);
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_type,
expected: ZodParsedType.null,
received: ctx.parsedType
});
return INVALID;
}
return OK(input.data);
}
};
ZodNull.create = (params) => {
return new ZodNull({
typeName: ZodFirstPartyTypeKind.ZodNull,
...processCreateParams(params)
});
};
ZodAny = class extends ZodType {
constructor() {
super(...arguments);
this._any = true;
}
_parse(input) {
return OK(input.data);
}
};
ZodAny.create = (params) => {
return new ZodAny({
typeName: ZodFirstPartyTypeKind.ZodAny,
...processCreateParams(params)
});
};
ZodUnknown = class extends ZodType {
constructor() {
super(...arguments);
this._unknown = true;
}
_parse(input) {
return OK(input.data);
}
};
ZodUnknown.create = (params) => {
return new ZodUnknown({
typeName: ZodFirstPartyTypeKind.ZodUnknown,
...processCreateParams(params)
});
};
ZodNever = class extends ZodType {
_parse(input) {
const ctx = this._getOrReturnCtx(input);
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_type,
expected: ZodParsedType.never,
received: ctx.parsedType
});
return INVALID;
}
};
ZodNever.create = (params) => {
return new ZodNever({
typeName: ZodFirstPartyTypeKind.ZodNever,
...processCreateParams(params)
});
};
ZodVoid = class extends ZodType {
_parse(input) {
const parsedType = this._getType(input);
if (parsedType !== ZodParsedType.undefined) {
const ctx = this._getOrReturnCtx(input);
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_type,
expected: ZodParsedType.void,
received: ctx.parsedType
});
return INVALID;
}
return OK(input.data);
}
};
ZodVoid.create = (params) => {
return new ZodVoid({
typeName: ZodFirstPartyTypeKind.ZodVoid,
...processCreateParams(params)
});
};
ZodArray = class _ZodArray extends ZodType {
_parse(input) {
const { ctx, status } = this._processInputParams(input);
const def = this._def;
if (ctx.parsedType !== ZodParsedType.array) {
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_type,
expected: ZodParsedType.array,
received: ctx.parsedType
});
return INVALID;
}
if (def.exactLength !== null) {
const tooBig = ctx.data.length > def.exactLength.value;
const tooSmall = ctx.data.length < def.exactLength.value;
if (tooBig || tooSmall) {
addIssueToContext(ctx, {
code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,
minimum: tooSmall ? def.exactLength.value : void 0,
maximum: tooBig ? def.exactLength.value : void 0,
type: "array",
inclusive: true,
exact: true,
message: def.exactLength.message
});
status.dirty();
}
}
if (def.minLength !== null) {
if (ctx.data.length < def.minLength.value) {
addIssueToContext(ctx, {
code: ZodIssueCode.too_small,
minimum: def.minLength.value,
type: "array",
inclusive: true,
exact: false,
message: def.minLength.message
});
status.dirty();
}
}
if (def.maxLength !== null) {
if (ctx.data.length > def.maxLength.value) {
addIssueToContext(ctx, {
code: ZodIssueCode.too_big,
maximum: def.maxLength.value,
type: "array",
inclusive: true,
exact: false,
message: def.maxLength.message
});
status.dirty();
}
}
if (ctx.common.async) {
return Promise.all(ctx.data.map((item, i) => {
return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
})).then((result2) => {
return ParseStatus.mergeArray(status, result2);
});
}
const result = ctx.data.map((item, i) => {
return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
});
return ParseStatus.mergeArray(status, result);
}
get element() {
return this._def.type;
}
min(minLength, message) {
return new _ZodArray({
...this._def,
minLength: { value: minLength, message: errorUtil.toString(message) }
});
}
max(maxLength, message) {
return new _ZodArray({
...this._def,
maxLength: { value: maxLength, message: errorUtil.toString(message) }
});
}
length(len, message) {
return new _ZodArray({
...this._def,
exactLength: { value: len, message: errorUtil.toString(message) }
});
}
nonempty(message) {
return this.min(1, message);
}
};
ZodArray.create = (schema4, params) => {
return new ZodArray({
type: schema4,
minLength: null,
maxLength: null,
exactLength: null,
typeName: ZodFirstPartyTypeKind.ZodArray,
...processCreateParams(params)
});
};
(function(objectUtil2) {
objectUtil2.mergeShapes = (first, second) => {
return {
...first,
...second
// second overwrites first
};
};
})(objectUtil || (objectUtil = {}));
AugmentFactory = (def) => (augmentation) => {
return new ZodObject({
...def,
shape: () => ({
...def.shape(),
...augmentation
})
});
};
ZodObject = class _ZodObject extends ZodType {
constructor() {
super(...arguments);
this._cached = null;
this.nonstrict = this.passthrough;
this.augment = AugmentFactory(this._def);
this.extend = AugmentFactory(this._def);
}
_getCached() {
if (this._cached !== null)
return this._cached;
const shape = this._def.shape();
const keys = util.objectKeys(shape);
return this._cached = { shape, keys };
}
_parse(input) {
const parsedType = this._getType(input);
if (parsedType !== ZodParsedType.object) {
const ctx2 = this._getOrReturnCtx(input);
addIssueToContext(ctx2, {
code: ZodIssueCode.invalid_type,
expected: ZodParsedType.object,
received: ctx2.parsedType
});
return INVALID;
}
const { status, ctx } = this._processInputParams(input);
const { shape, keys: shapeKeys } = this._getCached();
const extraKeys = [];
if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
for (const key in ctx.data) {
if (!shapeKeys.includes(key)) {
extraKeys.push(key);
}
}
}
const pairs = [];
for (const key of shapeKeys) {
const keyValidator = shape[key];
const value = ctx.data[key];
pairs.push({
key: { status: "valid", value: key },
value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
alwaysSet: key in ctx.data
});
}
if (this._def.catchall instanceof ZodNever) {
const unknownKeys = this._def.unknownKeys;
if (unknownKeys === "passthrough") {
for (const key of extraKeys) {
pairs.push({
key: { status: "valid", value: key },
value: { status: "valid", value: ctx.data[key] }
});
}
} else if (unknownKeys === "strict") {
if (extraKeys.length > 0) {
addIssueToContext(ctx, {
code: ZodIssueCode.unrecognized_keys,
keys: extraKeys
});
status.dirty();
}
} else if (unknownKeys === "strip")
;
else {
throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
}
} else {
const catchall = this._def.catchall;
for (const key of extraKeys) {
const value = ctx.data[key];
pairs.push({
key: { status: "valid", value: key },
value: catchall._parse(
new ParseInputLazyPath(ctx, value, ctx.path, key)
//, ctx.child(key), value, getParsedType(value)
),
alwaysSet: key in ctx.data
});
}
}
if (ctx.common.async) {
return Promise.resolve().then(async () => {
const syncPairs = [];
for (const pair of pairs) {
const key = await pair.key;
syncPairs.push({
key,
value: await pair.value,
alwaysSet: pair.alwaysSet
});
}
return syncPairs;
}).then((syncPairs) => {
return ParseStatus.mergeObjectSync(status, syncPairs);
});
} else {
return ParseStatus.mergeObjectSync(status, pairs);
}
}
get shape() {
return this._def.shape();
}
strict(message) {
errorUtil.errToObj;
return new _ZodObject({
...this._def,
unknownKeys: "strict",
...message !== void 0 ? {
errorMap: (issue, ctx) => {
var _a, _b, _c, _d;
const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;
if (issue.code === "unrecognized_keys")
return {
message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError
};
return {
message: defaultError
};
}
} : {}
});
}
strip() {
return new _ZodObject({
...this._def,
unknownKeys: "strip"
});
}
passthrough() {
return new _ZodObject({
...this._def,
unknownKeys: "passthrough"
});
}
setKey(key, schema4) {
return this.augment({ [key]: schema4 });
}
/**
* Prior to zod@1.0.12 there was a bug in the
* inferred type of merged objects. Please
* upgrade if you are experiencing issues.
*/
merge(merging) {
const merged = new _ZodObject({
unknownKeys: merging._def.unknownKeys,
catchall: merging._def.catchall,
shape: () => objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
typeName: ZodFirstPartyTypeKind.ZodObject
});
return merged;
}
catchall(index4) {
return new _ZodObject({
...this._def,
catchall: index4
});
}
pick(mask) {
const shape = {};
util.objectKeys(mask).map((key) => {
if (this.shape[key])
shape[key] = this.shape[key];
});
return new _ZodObject({
...this._def,
shape: () => shape
});
}
omit(mask) {
const shape = {};
util.objectKeys(this.shape).map((key) => {
if (util.objectKeys(mask).indexOf(key) === -1) {
shape[key] = this.shape[key];
}
});
return new _ZodObject({
...this._def,
shape: () => shape
});
}
deepPartial() {
return deepPartialify(this);
}
partial(mask) {
const newShape = {};
if (mask) {
util.objectKeys(this.shape).map((key) => {
if (util.objectKeys(mask).indexOf(key) === -1) {
newShape[key] = this.shape[key];
} else {
newShape[key] = this.shape[key].optional();
}
});
return new _ZodObject({
...this._def,
shape: () => newShape
});
} else {
for (const key in this.shape) {
const fieldSchema = this.shape[key];
newShape[key] = fieldSchema.optional();
}
}
return new _ZodObject({
...this._def,
shape: () => newShape
});
}
required(mask) {
const newShape = {};
if (mask) {
util.objectKeys(this.shape).map((key) => {
if (util.objectKeys(mask).indexOf(key) === -1) {
newShape[key] = this.shape[key];
} else {
const fieldSchema = this.shape[key];
let newField = fieldSchema;
while (newField instanceof ZodOptional) {
newField = newField._def.innerType;
}
newShape[key] = newField;
}
});
} else {
for (const key in this.shape) {
const fieldSchema = this.shape[key];
let newField = fieldSchema;
while (newField instanceof ZodOptional) {
newField = newField._def.innerType;
}
newShape[key] = newField;
}
}
return new _ZodObject({
...this._def,
shape: () => newShape
});
}
keyof() {
return createZodEnum(util.objectKeys(this.shape));
}
};
ZodObject.create = (shape, params) => {
return new ZodObject({
shape: () => shape,
unknownKeys: "strip",
catchall: ZodNever.create(),
typeName: ZodFirstPartyTypeKind.ZodObject,
...processCreateParams(params)
});
};
ZodObject.strictCreate = (shape, params) => {
return new ZodObject({
shape: () => shape,
unknownKeys: "strict",
catchall: ZodNever.create(),
typeName: ZodFirstPartyTypeKind.ZodObject,
...processCreateParams(params)
});
};
ZodObject.lazycreate = (shape, params) => {
return new ZodObject({
shape,
unknownKeys: "strip",
catchall: ZodNever.create(),
typeName: ZodFirstPartyTypeKind.ZodObject,
...processCreateParams(params)
});
};
ZodUnion = class extends ZodType {
_parse(input) {
const { ctx } = this._processInputParams(input);
const options = this._def.options;
function handleResults(results) {
for (const result of results) {
if (result.result.status === "valid") {
return result.result;
}
}
for (const result of results) {
if (result.result.status === "dirty") {
ctx.common.issues.push(...result.ctx.common.issues);
return result.result;
}
}
const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_union,
unionErrors
});
return INVALID;
}
if (ctx.common.async) {
return Promise.all(options.map(async (option) => {
const childCtx = {
...ctx,
common: {
...ctx.common,
issues: []
},
parent: null
};
return {
result: await option._parseAsync({
data: ctx.data,
path: ctx.path,
parent: childCtx
}),
ctx: childCtx
};
})).then(handleResults);
} else {
let dirty = void 0;
const issues = [];
for (const option of options) {
const childCtx = {
...ctx,
common: {
...ctx.common,
issues: []
},
parent: null
};
const result = option._parseSync({
data: ctx.data,
path: ctx.path,
parent: childCtx
});
if (result.status === "valid") {
return result;
} else if (result.status === "dirty" && !dirty) {
dirty = { result, ctx: childCtx };
}
if (childCtx.common.issues.length) {
issues.push(childCtx.common.issues);
}
}
if (dirty) {
ctx.common.issues.push(...dirty.ctx.common.issues);
return dirty.result;
}
const unionErrors = issues.map((issues2) => new ZodError(issues2));
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_union,
unionErrors
});
return INVALID;
}
}
get options() {
return this._def.options;
}
};
ZodUnion.create = (types, params) => {
return new ZodUnion({
options: types,
typeName: ZodFirstPartyTypeKind.ZodUnion,
...processCreateParams(params)
});
};
getDiscriminator = (type) => {
if (type instanceof ZodLazy) {
return getDiscriminator(type.schema);
} else if (type instanceof ZodEffects) {
return getDiscriminator(type.innerType());
} else if (type instanceof ZodLiteral) {
return [type.value];
} else if (type instanceof ZodEnum) {
return type.options;
} else if (type instanceof ZodNativeEnum) {
return Object.keys(type.enum);
} else if (type instanceof ZodDefault) {
return getDiscriminator(type._def.innerType);
} else if (type instanceof ZodUndefined) {
return [void 0];
} else if (type instanceof ZodNull) {
return [null];
} else {
return null;
}
};
ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
_parse(input) {
const { ctx } = this._processInputParams(input);
if (ctx.parsedType !== ZodParsedType.object) {
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_type,
expected: ZodParsedType.object,
received: ctx.parsedType
});
return INVALID;
}
const discriminator = this.discriminator;
const discriminatorValue = ctx.data[discriminator];
const option = this.optionsMap.get(discriminatorValue);
if (!option) {
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_union_discriminator,
options: Array.from(this.optionsMap.keys()),
path: [discriminator]
});
return INVALID;
}
if (ctx.common.async) {
return option._parseAsync({
data: ctx.data,
path: ctx.path,
parent: ctx
});
} else {
return option._parseSync({
data: ctx.data,
path: ctx.path,
parent: ctx
});
}
}
get discriminator() {
return this._def.discriminator;
}
get options() {
return this._def.options;
}
get optionsMap() {
return this._def.optionsMap;
}
/**
* The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
* However, it only allows a union of objects, all of which need to share a discriminator property. This property must
* have a different value for each object in the union.
* @param discriminator the name of the discriminator property
* @param types an array of object schemas
* @param params
*/
static create(discriminator, options, params) {
const optionsMap = /* @__PURE__ */ new Map();
for (const type of options) {
const discriminatorValues = getDiscriminator(type.shape[discriminator]);
if (!discriminatorValues) {
throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
}
for (const value of discriminatorValues) {
if (optionsMap.has(value)) {
throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
}
optionsMap.set(value, type);
}
}
return new _ZodDiscriminatedUnion({
typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
discriminator,
options,
optionsMap,
...processCreateParams(params)
});
}
};
ZodIntersection = class extends ZodType {
_parse(input) {
const { status, ctx } = this._processInputParams(input);
const handleParsed = (parsedLeft, parsedRight) => {
if (isAborted(parsedLeft) || isAborted(parsedRight)) {
return INVALID;
}
const merged = mergeValues(parsedLeft.value, parsedRight.value);
if (!merged.valid) {
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_intersection_types
});
return INVALID;
}
if (isDirty(parsedLeft) || isDirty(parsedRight)) {
status.dirty();
}
return { status: status.value, value: merged.data };
};
if (ctx.common.async) {
return Promise.all([
this._def.left._parseAsync({
data: ctx.data,
path: ctx.path,
parent: ctx
}),
this._def.right._parseAsync({
data: ctx.data,
path: ctx.path,
parent: ctx
})
]).then(([left, right]) => handleParsed(left, right));
} else {
return handleParsed(this._def.left._parseSync({
data: ctx.data,
path: ctx.path,
parent: ctx
}), this._def.right._parseSync({
data: ctx.data,
path: ctx.path,
parent: ctx
}));
}
}
};
ZodIntersection.create = (left, right, params) => {
return new ZodIntersection({
left,
right,
typeName: ZodFirstPartyTypeKind.ZodIntersection,
...processCreateParams(params)
});
};
ZodTuple = class _ZodTuple extends ZodType {
_parse(input) {
const { status, ctx } = this._processInputParams(input);
if (ctx.parsedType !== ZodParsedType.array) {
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_type,
expected: ZodParsedType.array,
received: ctx.parsedType
});
return INVALID;
}
if (ctx.data.length < this._def.items.length) {
addIssueToContext(ctx, {
code: ZodIssueCode.too_small,
minimum: this._def.items.length,
inclusive: true,
exact: false,
type: "array"
});
return INVALID;
}
const rest = this._def.rest;
if (!rest && ctx.data.length > this._def.items.length) {
addIssueToContext(ctx, {
code: ZodIssueCode.too_big,
maximum: this._def.items.length,
inclusive: true,
exact: false,
type: "array"
});
status.dirty();
}
const items = ctx.data.map((item, itemIndex) => {
const schema4 = this._def.items[itemIndex] || this._def.rest;
if (!schema4)
return null;
return schema4._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
}).filter((x) => !!x);
if (ctx.common.async) {
return Promise.all(items).then((results) => {
return ParseStatus.mergeArray(status, results);
});
} else {
return ParseStatus.mergeArray(status, items);
}
}
get items() {
return this._def.items;
}
rest(rest) {
return new _ZodTuple({
...this._def,
rest
});
}
};
ZodTuple.create = (schemas, params) => {
if (!Array.isArray(schemas)) {
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
}
return new ZodTuple({
items: schemas,
typeName: ZodFirstPartyTypeKind.ZodTuple,
rest: null,
...processCreateParams(params)
});
};
ZodRecord = class _ZodRecord extends ZodType {
get keySchema() {
return this._def.keyType;
}
get valueSchema() {
return this._def.valueType;
}
_parse(input) {
const { status, ctx } = this._processInputParams(input);
if (ctx.parsedType !== ZodParsedType.object) {
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_type,
expected: ZodParsedType.object,
received: ctx.parsedType
});
return INVALID;
}
const pairs = [];
const keyType = this._def.keyType;
const valueType = this._def.valueType;
for (const key in ctx.data) {
pairs.push({
key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key))
});
}
if (ctx.common.async) {
return ParseStatus.mergeObjectAsync(status, pairs);
} else {
return ParseStatus.mergeObjectSync(status, pairs);
}
}
get element() {
return this._def.valueType;
}
static create(first, second, third) {
if (second instanceof ZodType) {
return new _ZodRecord({
keyType: first,
valueType: second,
typeName: ZodFirstPartyTypeKind.ZodRecord,
...processCreateParams(third)
});
}
return new _ZodRecord({
keyType: ZodString.create(),
valueType: first,
typeName: ZodFirstPartyTypeKind.ZodRecord,
...processCreateParams(second)
});
}
};
ZodMap = class extends ZodType {
_parse(input) {
const { status, ctx } = this._processInputParams(input);
if (ctx.parsedType !== ZodParsedType.map) {
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_type,
expected: ZodParsedType.map,
received: ctx.parsedType
});
return INVALID;
}
const keyType = this._def.keyType;
const valueType = this._def.valueType;
const pairs = [...ctx.data.entries()].map(([key, value], index4) => {
return {
key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index4, "key"])),
value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index4, "value"]))
};
});
if (ctx.common.async) {
const finalMap = /* @__PURE__ */ new Map();
return Promise.resolve().then(async () => {
for (const pair of pairs) {
const key = await pair.key;
const value = await pair.value;
if (key.status === "aborted" || value.status === "aborted") {
return INVALID;
}
if (key.status === "dirty" || value.status === "dirty") {
status.dirty();
}
finalMap.set(key.value, value.value);
}
return { status: status.value, value: finalMap };
});
} else {
const finalMap = /* @__PURE__ */ new Map();
for (const pair of pairs) {
const key = pair.key;
const value = pair.value;
if (key.status === "aborted" || value.status === "aborted") {
return INVALID;
}
if (key.status === "dirty" || value.status === "dirty") {
status.dirty();
}
finalMap.set(key.value, value.value);
}
return { status: status.value, value: finalMap };
}
}
};
ZodMap.create = (keyType, valueType, params) => {
return new ZodMap({
valueType,
keyType,
typeName: ZodFirstPartyTypeKind.ZodMap,
...processCreateParams(params)
});
};
ZodSet = class _ZodSet extends ZodType {
_parse(input) {
const { status, ctx } = this._processInputParams(input);
if (ctx.parsedType !== ZodParsedType.set) {
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_type,
expected: ZodParsedType.set,
received: ctx.parsedType
});
return INVALID;
}
const def = this._def;
if (def.minSize !== null) {
if (ctx.data.size < def.minSize.value) {
addIssueToContext(ctx, {
code: ZodIssueCode.too_small,
minimum: def.minSize.value,
type: "set",
inclusive: true,
exact: false,
message: def.minSize.message
});
status.dirty();
}
}
if (def.maxSize !== null) {
if (ctx.data.size > def.maxSize.value) {
addIssueToContext(ctx, {
code: ZodIssueCode.too_big,
maximum: def.maxSize.value,
type: "set",
inclusive: true,
exact: false,
message: def.maxSize.message
});
status.dirty();
}
}
const valueType = this._def.valueType;
function finalizeSet(elements2) {
const parsedSet = /* @__PURE__ */ new Set();
for (const element of elements2) {
if (element.status === "aborted")
return INVALID;
if (element.status === "dirty")
status.dirty();
parsedSet.add(element.value);
}
return { status: status.value, value: parsedSet };
}
const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
if (ctx.common.async) {
return Promise.all(elements).then((elements2) => finalizeSet(elements2));
} else {
return finalizeSet(elements);
}
}
min(minSize, message) {
return new _ZodSet({
...this._def,
minSize: { value: minSize, message: errorUtil.toString(message) }
});
}
max(maxSize, message) {
return new _ZodSet({
...this._def,
maxSize: { value: maxSize, message: errorUtil.toString(message) }
});
}
size(size, message) {
return this.min(size, message).max(size, message);
}
nonempty(message) {
return this.min(1, message);
}
};
ZodSet.create = (valueType, params) => {
return new ZodSet({
valueType,
minSize: null,
maxSize: null,
typeName: ZodFirstPartyTypeKind.ZodSet,
...processCreateParams(params)
});
};
ZodFunction = class _ZodFunction extends ZodType {
constructor() {
super(...arguments);
this.validate = this.implement;
}
_parse(input) {
const { ctx } = this._processInputParams(input);
if (ctx.parsedType !== ZodParsedType.function) {
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_type,
expected: ZodParsedType.function,
received: ctx.parsedType
});
return INVALID;
}
function makeArgsIssue(args, error2) {
return makeIssue({
data: args,
path: ctx.path,
errorMaps: [
ctx.common.contextualErrorMap,
ctx.schemaErrorMap,
getErrorMap(),
errorMap
].filter((x) => !!x),
issueData: {
code: ZodIssueCode.invalid_arguments,
argumentsError: error2
}
});
}
function makeReturnsIssue(returns, error2) {
return makeIssue({
data: returns,
path: ctx.path,
errorMaps: [
ctx.common.contextualErrorMap,
ctx.schemaErrorMap,
getErrorMap(),
errorMap
].filter((x) => !!x),
issueData: {
code: ZodIssueCode.invalid_return_type,
returnTypeError: error2
}
});
}
const params = { errorMap: ctx.common.contextualErrorMap };
const fn = ctx.data;
if (this._def.returns instanceof ZodPromise) {
return OK(async (...args) => {
const error2 = new ZodError([]);
const parsedArgs = await this._def.args.parseAsync(args, params).catch((e) => {
error2.addIssue(makeArgsIssue(args, e));
throw error2;
});
const result = await fn(...parsedArgs);
const parsedReturns = await this._def.returns._def.type.parseAsync(result, params).catch((e) => {
error2.addIssue(makeReturnsIssue(result, e));
throw error2;
});
return parsedReturns;
});
} else {
return OK((...args) => {
const parsedArgs = this._def.args.safeParse(args, params);
if (!parsedArgs.success) {
throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
}
const result = fn(...parsedArgs.data);
const parsedReturns = this._def.returns.safeParse(result, params);
if (!parsedReturns.success) {
throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
}
return parsedReturns.data;
});
}
}
parameters() {
return this._def.args;
}
returnType() {
return this._def.returns;
}
args(...items) {
return new _ZodFunction({
...this._def,
args: ZodTuple.create(items).rest(ZodUnknown.create())
});
}
returns(returnType) {
return new _ZodFunction({
...this._def,
returns: returnType
});
}
implement(func) {
const validatedFunc = this.parse(func);
return validatedFunc;
}
strictImplement(func) {
const validatedFunc = this.parse(func);
return validatedFunc;
}
static create(args, returns, params) {
return new _ZodFunction({
args: args ? args : ZodTuple.create([]).rest(ZodUnknown.create()),
returns: returns || ZodUnknown.create(),
typeName: ZodFirstPartyTypeKind.ZodFunction,
...processCreateParams(params)
});
}
};
ZodLazy = class extends ZodType {
get schema() {
return this._def.getter();
}
_parse(input) {
const { ctx } = this._processInputParams(input);
const lazySchema = this._def.getter();
return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
}
};
ZodLazy.create = (getter, params) => {
return new ZodLazy({
getter,
typeName: ZodFirstPartyTypeKind.ZodLazy,
...processCreateParams(params)
});
};
ZodLiteral = class extends ZodType {
_parse(input) {
if (input.data !== this._def.value) {
const ctx = this._getOrReturnCtx(input);
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_literal,
expected: this._def.value
});
return INVALID;
}
return { status: "valid", value: input.data };
}
get value() {
return this._def.value;
}
};
ZodLiteral.create = (value, params) => {
return new ZodLiteral({
value,
typeName: ZodFirstPartyTypeKind.ZodLiteral,
...processCreateParams(params)
});
};
ZodEnum = class extends ZodType {
_parse(input) {
if (typeof input.data !== "string") {
const ctx = this._getOrReturnCtx(input);
const expectedValues = this._def.values;
addIssueToContext(ctx, {
expected: util.joinValues(expectedValues),
received: ctx.parsedType,
code: ZodIssueCode.invalid_type
});
return INVALID;
}
if (this._def.values.indexOf(input.data) === -1) {
const ctx = this._getOrReturnCtx(input);
const expectedValues = this._def.values;
addIssueToContext(ctx, {
received: ctx.data,
code: ZodIssueCode.invalid_enum_value,
options: expectedValues
});
return INVALID;
}
return OK(input.data);
}
get options() {
return this._def.values;
}
get enum() {
const enumValues = {};
for (const val of this._def.values) {
enumValues[val] = val;
}
return enumValues;
}
get Values() {
const enumValues = {};
for (const val of this._def.values) {
enumValues[val] = val;
}
return enumValues;
}
get Enum() {
const enumValues = {};
for (const val of this._def.values) {
enumValues[val] = val;
}
return enumValues;
}
};
ZodEnum.create = createZodEnum;
ZodNativeEnum = class extends ZodType {
_parse(input) {
const nativeEnumValues = util.getValidEnumValues(this._def.values);
const ctx = this._getOrReturnCtx(input);
if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
const expectedValues = util.objectValues(nativeEnumValues);
addIssueToContext(ctx, {
expected: util.joinValues(expectedValues),
received: ctx.parsedType,
code: ZodIssueCode.invalid_type
});
return INVALID;
}
if (nativeEnumValues.indexOf(input.data) === -1) {
const expectedValues = util.objectValues(nativeEnumValues);
addIssueToContext(ctx, {
received: ctx.data,
code: ZodIssueCode.invalid_enum_value,
options: expectedValues
});
return INVALID;
}
return OK(input.data);
}
get enum() {
return this._def.values;
}
};
ZodNativeEnum.create = (values, params) => {
return new ZodNativeEnum({
values,
typeName: ZodFirstPartyTypeKind.ZodNativeEnum,
...processCreateParams(params)
});
};
ZodPromise = class extends ZodType {
_parse(input) {
const { ctx } = this._processInputParams(input);
if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_type,
expected: ZodParsedType.promise,
received: ctx.parsedType
});
return INVALID;
}
const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
return OK(promisified.then((data) => {
return this._def.type.parseAsync(data, {
path: ctx.path,
errorMap: ctx.common.contextualErrorMap
});
}));
}
};
ZodPromise.create = (schema4, params) => {
return new ZodPromise({
type: schema4,
typeName: ZodFirstPartyTypeKind.ZodPromise,
...processCreateParams(params)
});
};
ZodEffects = class extends ZodType {
innerType() {
return this._def.schema;
}
sourceType() {
return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
}
_parse(input) {
const { status, ctx } = this._processInputParams(input);
const effect = this._def.effect || null;
if (effect.type === "preprocess") {
const processed = effect.transform(ctx.data);
if (ctx.common.async) {
return Promise.resolve(processed).then((processed2) => {
return this._def.schema._parseAsync({
data: processed2,
path: ctx.path,
parent: ctx
});
});
} else {
return this._def.schema._parseSync({
data: processed,
path: ctx.path,
parent: ctx
});
}
}
const checkCtx = {
addIssue: (arg) => {
addIssueToContext(ctx, arg);
if (arg.fatal) {
status.abort();
} else {
status.dirty();
}
},
get path() {
return ctx.path;
}
};
checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
if (effect.type === "refinement") {
const executeRefinement = (acc) => {
const result = effect.refinement(acc, checkCtx);
if (ctx.common.async) {
return Promise.resolve(result);
}
if (result instanceof Promise) {
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
}
return acc;
};
if (ctx.common.async === false) {
const inner = this._def.schema._parseSync({
data: ctx.data,
path: ctx.path,
parent: ctx
});
if (inner.status === "aborted")
return INVALID;
if (inner.status === "dirty")
status.dirty();
executeRefinement(inner.value);
return { status: status.value, value: inner.value };
} else {
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {
if (inner.status === "aborted")
return INVALID;
if (inner.status === "dirty")
status.dirty();
return executeRefinement(inner.value).then(() => {
return { status: status.value, value: inner.value };
});
});
}
}
if (effect.type === "transform") {
if (ctx.common.async === false) {
const base = this._def.schema._parseSync({
data: ctx.data,
path: ctx.path,
parent: ctx
});
if (!isValid(base))
return base;
const result = effect.transform(base.value, checkCtx);
if (result instanceof Promise) {
throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
}
return { status: status.value, value: result };
} else {
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
if (!isValid(base))
return base;
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result }));
});
}
}
util.assertNever(effect);
}
};
ZodEffects.create = (schema4, effect, params) => {
return new ZodEffects({
schema: schema4,
typeName: ZodFirstPartyTypeKind.ZodEffects,
effect,
...processCreateParams(params)
});
};
ZodEffects.createWithPreprocess = (preprocess, schema4, params) => {
return new ZodEffects({
schema: schema4,
effect: { type: "preprocess", transform: preprocess },
typeName: ZodFirstPartyTypeKind.ZodEffects,
...processCreateParams(params)
});
};
ZodOptional = class extends ZodType {
_parse(input) {
const parsedType = this._getType(input);
if (parsedType === ZodParsedType.undefined) {
return OK(void 0);
}
return this._def.innerType._parse(input);
}
unwrap() {
return this._def.innerType;
}
};
ZodOptional.create = (type, params) => {
return new ZodOptional({
innerType: type,
typeName: ZodFirstPartyTypeKind.ZodOptional,
...processCreateParams(params)
});
};
ZodNullable = class extends ZodType {
_parse(input) {
const parsedType = this._getType(input);
if (parsedType === ZodParsedType.null) {
return OK(null);
}
return this._def.innerType._parse(input);
}
unwrap() {
return this._def.innerType;
}
};
ZodNullable.create = (type, params) => {
return new ZodNullable({
innerType: type,
typeName: ZodFirstPartyTypeKind.ZodNullable,
...processCreateParams(params)
});
};
ZodDefault = class extends ZodType {
_parse(input) {
const { ctx } = this._processInputParams(input);
let data = ctx.data;
if (ctx.parsedType === ZodParsedType.undefined) {
data = this._def.defaultValue();
}
return this._def.innerType._parse({
data,
path: ctx.path,
parent: ctx
});
}
removeDefault() {
return this._def.innerType;
}
};
ZodDefault.create = (type, params) => {
return new ZodDefault({
innerType: type,
typeName: ZodFirstPartyTypeKind.ZodDefault,
defaultValue: typeof params.default === "function" ? params.default : () => params.default,
...processCreateParams(params)
});
};
ZodCatch = class extends ZodType {
_parse(input) {
const { ctx } = this._processInputParams(input);
const result = this._def.innerType._parse({
data: ctx.data,
path: ctx.path,
parent: ctx
});
if (isAsync(result)) {
return result.then((result2) => {
return {
status: "valid",
value: result2.status === "valid" ? result2.value : this._def.defaultValue()
};
});
} else {
return {
status: "valid",
value: result.status === "valid" ? result.value : this._def.defaultValue()
};
}
}
removeDefault() {
return this._def.innerType;
}
};
ZodCatch.create = (type, params) => {
return new ZodCatch({
innerType: type,
typeName: ZodFirstPartyTypeKind.ZodCatch,
defaultValue: typeof params.default === "function" ? params.default : () => params.default,
...processCreateParams(params)
});
};
ZodNaN = class extends ZodType {
_parse(input) {
const parsedType = this._getType(input);
if (parsedType !== ZodParsedType.nan) {
const ctx = this._getOrReturnCtx(input);
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_type,
expected: ZodParsedType.nan,
received: ctx.parsedType
});
return INVALID;
}
return { status: "valid", value: input.data };
}
};
ZodNaN.create = (params) => {
return new ZodNaN({
typeName: ZodFirstPartyTypeKind.ZodNaN,
...processCreateParams(params)
});
};
BRAND = Symbol("zod_brand");
ZodBranded = class extends ZodType {
_parse(input) {
const { ctx } = this._processInputParams(input);
const data = ctx.data;
return this._def.type._parse({
data,
path: ctx.path,
parent: ctx
});
}
unwrap() {
return this._def.type;
}
};
ZodPipeline = class _ZodPipeline extends ZodType {
_parse(input) {
const { status, ctx } = this._processInputParams(input);
if (ctx.common.async) {
const handleAsync = async () => {
const inResult = await this._def.in._parseAsync({
data: ctx.data,
path: ctx.path,
parent: ctx
});
if (inResult.status === "aborted")
return INVALID;
if (inResult.status === "dirty") {
status.dirty();
return DIRTY(inResult.value);
} else {
return this._def.out._parseAsync({
data: inResult.value,
path: ctx.path,
parent: ctx
});
}
};
return handleAsync();
} else {
const inResult = this._def.in._parseSync({
data: ctx.data,
path: ctx.path,
parent: ctx
});
if (inResult.status === "aborted")
return INVALID;
if (inResult.status === "dirty") {
status.dirty();
return {
status: "dirty",
value: inResult.value
};
} else {
return this._def.out._parseSync({
data: inResult.value,
path: ctx.path,
parent: ctx
});
}
}
}
static create(a, b) {
return new _ZodPipeline({
in: a,
out: b,
typeName: ZodFirstPartyTypeKind.ZodPipeline
});
}
};
late = {
object: ZodObject.lazycreate
};
(function(ZodFirstPartyTypeKind2) {
ZodFirstPartyTypeKind2["ZodString"] = "ZodString";
ZodFirstPartyTypeKind2["ZodNumber"] = "ZodNumber";
ZodFirstPartyTypeKind2["ZodNaN"] = "ZodNaN";
ZodFirstPartyTypeKind2["ZodBigInt"] = "ZodBigInt";
ZodFirstPartyTypeKind2["ZodBoolean"] = "ZodBoolean";
ZodFirstPartyTypeKind2["ZodDate"] = "ZodDate";
ZodFirstPartyTypeKind2["ZodSymbol"] = "ZodSymbol";
ZodFirstPartyTypeKind2["ZodUndefined"] = "ZodUndefined";
ZodFirstPartyTypeKind2["ZodNull"] = "ZodNull";
ZodFirstPartyTypeKind2["ZodAny"] = "ZodAny";
ZodFirstPartyTypeKind2["ZodUnknown"] = "ZodUnknown";
ZodFirstPartyTypeKind2["ZodNever"] = "ZodNever";
ZodFirstPartyTypeKind2["ZodVoid"] = "ZodVoid";
ZodFirstPartyTypeKind2["ZodArray"] = "ZodArray";
ZodFirstPartyTypeKind2["ZodObject"] = "ZodObject";
ZodFirstPartyTypeKind2["ZodUnion"] = "ZodUnion";
ZodFirstPartyTypeKind2["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
ZodFirstPartyTypeKind2["ZodIntersection"] = "ZodIntersection";
ZodFirstPartyTypeKind2["ZodTuple"] = "ZodTuple";
ZodFirstPartyTypeKind2["ZodRecord"] = "ZodRecord";
ZodFirstPartyTypeKind2["ZodMap"] = "ZodMap";
ZodFirstPartyTypeKind2["ZodSet"] = "ZodSet";
ZodFirstPartyTypeKind2["ZodFunction"] = "ZodFunction";
ZodFirstPartyTypeKind2["ZodLazy"] = "ZodLazy";
ZodFirstPartyTypeKind2["ZodLiteral"] = "ZodLiteral";
ZodFirstPartyTypeKind2["ZodEnum"] = "ZodEnum";
ZodFirstPartyTypeKind2["ZodEffects"] = "ZodEffects";
ZodFirstPartyTypeKind2["ZodNativeEnum"] = "ZodNativeEnum";
ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional";
ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable";
ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault";
ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch";
ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
stringType = ZodString.create;
numberType = ZodNumber.create;
nanType = ZodNaN.create;
bigIntType = ZodBigInt.create;
booleanType = ZodBoolean.create;
dateType = ZodDate.create;
symbolType = ZodSymbol.create;
undefinedType = ZodUndefined.create;
nullType = ZodNull.create;
anyType = ZodAny.create;
unknownType = ZodUnknown.create;
neverType = ZodNever.create;
voidType = ZodVoid.create;
arrayType = ZodArray.create;
objectType = ZodObject.create;
strictObjectType = ZodObject.strictCreate;
unionType = ZodUnion.create;
discriminatedUnionType = ZodDiscriminatedUnion.create;
intersectionType = ZodIntersection.create;
tupleType = ZodTuple.create;
recordType = ZodRecord.create;
mapType = ZodMap.create;
setType = ZodSet.create;
functionType = ZodFunction.create;
lazyType = ZodLazy.create;
literalType = ZodLiteral.create;
enumType = ZodEnum.create;
nativeEnumType = ZodNativeEnum.create;
promiseType = ZodPromise.create;
effectsType = ZodEffects.create;
optionalType = ZodOptional.create;
nullableType = ZodNullable.create;
preprocessType = ZodEffects.createWithPreprocess;
pipelineType = ZodPipeline.create;
coerce = {
string: (arg) => ZodString.create({ ...arg, coerce: true }),
number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
boolean: (arg) => ZodBoolean.create({ ...arg, coerce: true }),
bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
date: (arg) => ZodDate.create({ ...arg, coerce: true })
};
}
});
// node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/ansi-styles/index.js
function assembleStyles() {
const codes = /* @__PURE__ */ new Map();
for (const [groupName, group] of Object.entries(styles)) {
for (const [styleName, style] of Object.entries(group)) {
styles[styleName] = {
open: `\x1B[${style[0]}m`,
close: `\x1B[${style[1]}m`
};
group[styleName] = styles[styleName];
codes.set(style[0], style[1]);
}
Object.defineProperty(styles, groupName, {
value: group,
enumerable: false
});
}
Object.defineProperty(styles, "codes", {
value: codes,
enumerable: false
});
styles.color.close = "\x1B[39m";
styles.bgColor.close = "\x1B[49m";
styles.color.ansi = wrapAnsi16();
styles.color.ansi256 = wrapAnsi256();
styles.color.ansi16m = wrapAnsi16m();
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
Object.defineProperties(styles, {
rgbToAnsi256: {
value(red, green, blue) {
if (red === green && green === blue) {
if (red < 8) {
return 16;
}
if (red > 248) {
return 231;
}
return Math.round((red - 8) / 247 * 24) + 232;
}
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
},
enumerable: false
},
hexToRgb: {
value(hex) {
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
if (!matches) {
return [0, 0, 0];
}
let [colorString] = matches;
if (colorString.length === 3) {
colorString = [...colorString].map((character) => character + character).join("");
}
const integer = Number.parseInt(colorString, 16);
return [
/* eslint-disable no-bitwise */
integer >> 16 & 255,
integer >> 8 & 255,
integer & 255
/* eslint-enable no-bitwise */
];
},
enumerable: false
},
hexToAnsi256: {
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
enumerable: false
},
ansi256ToAnsi: {
value(code) {
if (code < 8) {
return 30 + code;
}
if (code < 16) {
return 90 + (code - 8);
}
let red;
let green;
let blue;
if (code >= 232) {
red = ((code - 232) * 10 + 8) / 255;
green = red;
blue = red;
} else {
code -= 16;
const remainder = code % 36;
red = Math.floor(code / 36) / 5;
green = Math.floor(remainder / 6) / 5;
blue = remainder % 6 / 5;
}
const value = Math.max(red, green, blue) * 2;
if (value === 0) {
return 30;
}
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
if (value === 2) {
result += 60;
}
return result;
},
enumerable: false
},
rgbToAnsi: {
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
enumerable: false
},
hexToAnsi: {
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
enumerable: false
}
});
return styles;
}
var ANSI_BACKGROUND_OFFSET, wrapAnsi16, wrapAnsi256, wrapAnsi16m, styles, modifierNames, foregroundColorNames, backgroundColorNames, colorNames, ansiStyles, ansi_styles_default;
var init_ansi_styles = __esm({
"node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/ansi-styles/index.js"() {
ANSI_BACKGROUND_OFFSET = 10;
wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
styles = {
modifier: {
reset: [0, 0],
// 21 isn't widely supported and 22 does the same thing
bold: [1, 22],
dim: [2, 22],
italic: [3, 23],
underline: [4, 24],
overline: [53, 55],
inverse: [7, 27],
hidden: [8, 28],
strikethrough: [9, 29]
},
color: {
black: [30, 39],
red: [31, 39],
green: [32, 39],
yellow: [33, 39],
blue: [34, 39],
magenta: [35, 39],
cyan: [36, 39],
white: [37, 39],
// Bright color
blackBright: [90, 39],
gray: [90, 39],
// Alias of `blackBright`
grey: [90, 39],
// Alias of `blackBright`
redBright: [91, 39],
greenBright: [92, 39],
yellowBright: [93, 39],
blueBright: [94, 39],
magentaBright: [95, 39],
cyanBright: [96, 39],
whiteBright: [97, 39]
},
bgColor: {
bgBlack: [40, 49],
bgRed: [41, 49],
bgGreen: [42, 49],
bgYellow: [43, 49],
bgBlue: [44, 49],
bgMagenta: [45, 49],
bgCyan: [46, 49],
bgWhite: [47, 49],
// Bright color
bgBlackBright: [100, 49],
bgGray: [100, 49],
// Alias of `bgBlackBright`
bgGrey: [100, 49],
// Alias of `bgBlackBright`
bgRedBright: [101, 49],
bgGreenBright: [102, 49],
bgYellowBright: [103, 49],
bgBlueBright: [104, 49],
bgMagentaBright: [105, 49],
bgCyanBright: [106, 49],
bgWhiteBright: [107, 49]
}
};
modifierNames = Object.keys(styles.modifier);
foregroundColorNames = Object.keys(styles.color);
backgroundColorNames = Object.keys(styles.bgColor);
colorNames = [...foregroundColorNames, ...backgroundColorNames];
ansiStyles = assembleStyles();
ansi_styles_default = ansiStyles;
}
});
// node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/supports-color/index.js
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : import_node_process.default.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);
}
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 ("TF_BUILD" in env && "AGENT_NAME" in env) {
return 1;
}
if (haveStream && !streamIsTTY && forceColor === void 0) {
return 0;
}
const min = forceColor || 0;
if (env.TERM === "dumb") {
return min;
}
if (import_node_process.default.platform === "win32") {
const osRelease = import_node_os.default.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 ("GITHUB_ACTIONS" in env) {
return 3;
}
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign 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 (env.TERM === "xterm-kitty") {
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 createSupportsColor(stream, options = {}) {
const level = _supportsColor(stream, {
streamIsTTY: stream && stream.isTTY,
...options
});
return translateLevel(level);
}
var import_node_process, import_node_os, import_node_tty, env, flagForceColor, supportsColor, supports_color_default;
var init_supports_color = __esm({
"node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/supports-color/index.js"() {
import_node_process = __toESM(require("node:process"), 1);
import_node_os = __toESM(require("node:os"), 1);
import_node_tty = __toESM(require("node:tty"), 1);
({ env } = import_node_process.default);
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;
}
supportsColor = {
stdout: createSupportsColor({ isTTY: import_node_tty.default.isatty(1) }),
stderr: createSupportsColor({ isTTY: import_node_tty.default.isatty(2) })
};
supports_color_default = supportsColor;
}
});
// node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/utilities.js
function stringReplaceAll(string, substring, replacer) {
let index4 = string.indexOf(substring);
if (index4 === -1) {
return string;
}
const substringLength = substring.length;
let endIndex = 0;
let returnValue = "";
do {
returnValue += string.slice(endIndex, index4) + substring + replacer;
endIndex = index4 + substringLength;
index4 = string.indexOf(substring, endIndex);
} while (index4 !== -1);
returnValue += string.slice(endIndex);
return returnValue;
}
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index4) {
let endIndex = 0;
let returnValue = "";
do {
const gotCR = string[index4 - 1] === "\r";
returnValue += string.slice(endIndex, gotCR ? index4 - 1 : index4) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
endIndex = index4 + 1;
index4 = string.indexOf("\n", endIndex);
} while (index4 !== -1);
returnValue += string.slice(endIndex);
return returnValue;
}
var init_utilities = __esm({
"node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/utilities.js"() {
}
});
// node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/index.js
function createChalk(options) {
return chalkFactory(options);
}
var stdoutColor, stderrColor, GENERATOR, STYLER, IS_EMPTY, levelMapping, styles2, applyOptions, chalkFactory, getModelAnsi, usedModels, proto, createStyler, createBuilder, applyStyle, chalk, chalkStderr, source_default;
var init_source = __esm({
"node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/index.js"() {
init_ansi_styles();
init_supports_color();
init_utilities();
init_ansi_styles();
({ stdout: stdoutColor, stderr: stderrColor } = supports_color_default);
GENERATOR = Symbol("GENERATOR");
STYLER = Symbol("STYLER");
IS_EMPTY = Symbol("IS_EMPTY");
levelMapping = [
"ansi",
"ansi",
"ansi256",
"ansi16m"
];
styles2 = /* @__PURE__ */ Object.create(null);
applyOptions = (object, options = {}) => {
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
throw new Error("The `level` option should be an integer from 0 to 3");
}
const colorLevel = stdoutColor ? stdoutColor.level : 0;
object.level = options.level === void 0 ? colorLevel : options.level;
};
chalkFactory = (options) => {
const chalk2 = (...strings) => strings.join(" ");
applyOptions(chalk2, options);
Object.setPrototypeOf(chalk2, createChalk.prototype);
return chalk2;
};
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
for (const [styleName, style] of Object.entries(ansi_styles_default)) {
styles2[styleName] = {
get() {
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
Object.defineProperty(this, styleName, { value: builder });
return builder;
}
};
}
styles2.visible = {
get() {
const builder = createBuilder(this, this[STYLER], true);
Object.defineProperty(this, "visible", { value: builder });
return builder;
}
};
getModelAnsi = (model, level, type, ...arguments_) => {
if (model === "rgb") {
if (level === "ansi16m") {
return ansi_styles_default[type].ansi16m(...arguments_);
}
if (level === "ansi256") {
return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
}
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
}
if (model === "hex") {
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
}
return ansi_styles_default[type][model](...arguments_);
};
usedModels = ["rgb", "hex", "ansi256"];
for (const model of usedModels) {
styles2[model] = {
get() {
const { level } = this;
return function(...arguments_) {
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
return createBuilder(this, styler, this[IS_EMPTY]);
};
}
};
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
styles2[bgModel] = {
get() {
const { level } = this;
return function(...arguments_) {
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
return createBuilder(this, styler, this[IS_EMPTY]);
};
}
};
}
proto = Object.defineProperties(() => {
}, {
...styles2,
level: {
enumerable: true,
get() {
return this[GENERATOR].level;
},
set(level) {
this[GENERATOR].level = level;
}
}
});
createStyler = (open2, close, parent) => {
let openAll;
let closeAll;
if (parent === void 0) {
openAll = open2;
closeAll = close;
} else {
openAll = parent.openAll + open2;
closeAll = close + parent.closeAll;
}
return {
open: open2,
close,
openAll,
closeAll,
parent
};
};
createBuilder = (self2, _styler, _isEmpty) => {
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
Object.setPrototypeOf(builder, proto);
builder[GENERATOR] = self2;
builder[STYLER] = _styler;
builder[IS_EMPTY] = _isEmpty;
return builder;
};
applyStyle = (self2, string) => {
if (self2.level <= 0 || !string) {
return self2[IS_EMPTY] ? "" : string;
}
let styler = self2[STYLER];
if (styler === void 0) {
return string;
}
const { openAll, closeAll } = styler;
if (string.includes("\x1B")) {
while (styler !== void 0) {
string = stringReplaceAll(string, styler.close, styler.open);
styler = styler.parent;
}
}
const lfIndex = string.indexOf("\n");
if (lfIndex !== -1) {
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
}
return openAll + string + closeAll;
};
Object.defineProperties(createChalk.prototype, styles2);
chalk = createChalk();
chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
source_default = chalk;
}
});
// node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/readline.js
var require_readline = __commonJS({
"node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/readline.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.prepareReadLine = void 0;
var prepareReadLine = () => {
const stdin = process.stdin;
const stdout = process.stdout;
const readline = require("readline");
const rl = readline.createInterface({
input: stdin,
escapeCodeTimeout: 50
});
readline.emitKeypressEvents(stdin, rl);
return {
stdin,
stdout,
closable: rl
};
};
exports.prepareReadLine = prepareReadLine;
}
});
// node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
var require_src = __commonJS({
"node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports, module2) {
"use strict";
var ESC = "\x1B";
var CSI = `${ESC}[`;
var beep = "\x07";
var cursor = {
to(x, y) {
if (!y)
return `${CSI}${x + 1}G`;
return `${CSI}${y + 1};${x + 1}H`;
},
move(x, y) {
let ret = "";
if (x < 0)
ret += `${CSI}${-x}D`;
else if (x > 0)
ret += `${CSI}${x}C`;
if (y < 0)
ret += `${CSI}${-y}A`;
else if (y > 0)
ret += `${CSI}${y}B`;
return ret;
},
up: (count = 1) => `${CSI}${count}A`,
down: (count = 1) => `${CSI}${count}B`,
forward: (count = 1) => `${CSI}${count}C`,
backward: (count = 1) => `${CSI}${count}D`,
nextLine: (count = 1) => `${CSI}E`.repeat(count),
prevLine: (count = 1) => `${CSI}F`.repeat(count),
left: `${CSI}G`,
hide: `${CSI}?25l`,
show: `${CSI}?25h`,
save: `${ESC}7`,
restore: `${ESC}8`
};
var scroll = {
up: (count = 1) => `${CSI}S`.repeat(count),
down: (count = 1) => `${CSI}T`.repeat(count)
};
var erase = {
screen: `${CSI}2J`,
up: (count = 1) => `${CSI}1J`.repeat(count),
down: (count = 1) => `${CSI}J`.repeat(count),
line: `${CSI}2K`,
lineEnd: `${CSI}K`,
lineStart: `${CSI}1K`,
lines(count) {
let clear = "";
for (let i = 0; i < count; i++)
clear += this.line + (i < count - 1 ? cursor.up() : "");
if (count)
clear += cursor.left;
return clear;
}
};
module2.exports = { cursor, scroll, erase, beep };
}
});
// node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/utils.js
var require_utils = __commonJS({
"node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/utils.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.clear = void 0;
var sisteransi_1 = require_src();
var strip = (str) => {
const pattern = [
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"
].join("|");
const RGX = new RegExp(pattern, "g");
return typeof str === "string" ? str.replace(RGX, "") : str;
};
var stringWidth = (str) => [...strip(str)].length;
var clear = function(prompt, perLine) {
if (!perLine)
return sisteransi_1.erase.line + sisteransi_1.cursor.to(0);
let rows = 0;
const lines = prompt.split(/\r?\n/);
for (let line of lines) {
rows += 1 + Math.floor(Math.max(stringWidth(line) - 1, 0) / perLine);
}
return sisteransi_1.erase.lines(rows);
};
exports.clear = clear;
}
});
// node_modules/.pnpm/lodash.throttle@4.1.1/node_modules/lodash.throttle/index.js
var require_lodash = __commonJS({
"node_modules/.pnpm/lodash.throttle@4.1.1/node_modules/lodash.throttle/index.js"(exports, module2) {
var FUNC_ERROR_TEXT = "Expected a function";
var NAN = 0 / 0;
var symbolTag = "[object Symbol]";
var reTrim = /^\s+|\s+$/g;
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
var reIsBinary = /^0b[01]+$/i;
var reIsOctal = /^0o[0-7]+$/i;
var freeParseInt = parseInt;
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
var root = freeGlobal || freeSelf || Function("return this")();
var objectProto = Object.prototype;
var objectToString = objectProto.toString;
var nativeMax = Math.max;
var nativeMin = Math.min;
var now = function() {
return root.Date.now();
};
function debounce(func, wait, options) {
var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
if (typeof func != "function") {
throw new TypeError(FUNC_ERROR_TEXT);
}
wait = toNumber(wait) || 0;
if (isObject(options)) {
leading = !!options.leading;
maxing = "maxWait" in options;
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
trailing = "trailing" in options ? !!options.trailing : trailing;
}
function invokeFunc(time) {
var args = lastArgs, thisArg = lastThis;
lastArgs = lastThis = void 0;
lastInvokeTime = time;
result = func.apply(thisArg, args);
return result;
}
function leadingEdge(time) {
lastInvokeTime = time;
timerId = setTimeout(timerExpired, wait);
return leading ? invokeFunc(time) : result;
}
function remainingWait(time) {
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, result2 = wait - timeSinceLastCall;
return maxing ? nativeMin(result2, maxWait - timeSinceLastInvoke) : result2;
}
function shouldInvoke(time) {
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
}
function timerExpired() {
var time = now();
if (shouldInvoke(time)) {
return trailingEdge(time);
}
timerId = setTimeout(timerExpired, remainingWait(time));
}
function trailingEdge(time) {
timerId = void 0;
if (trailing && lastArgs) {
return invokeFunc(time);
}
lastArgs = lastThis = void 0;
return result;
}
function cancel() {
if (timerId !== void 0) {
clearTimeout(timerId);
}
lastInvokeTime = 0;
lastArgs = lastCallTime = lastThis = timerId = void 0;
}
function flush() {
return timerId === void 0 ? result : trailingEdge(now());
}
function debounced() {
var time = now(), isInvoking = shouldInvoke(time);
lastArgs = arguments;
lastThis = this;
lastCallTime = time;
if (isInvoking) {
if (timerId === void 0) {
return leadingEdge(lastCallTime);
}
if (maxing) {
timerId = setTimeout(timerExpired, wait);
return invokeFunc(lastCallTime);
}
}
if (timerId === void 0) {
timerId = setTimeout(timerExpired, wait);
}
return result;
}
debounced.cancel = cancel;
debounced.flush = flush;
return debounced;
}
function throttle(func, wait, options) {
var leading = true, trailing = true;
if (typeof func != "function") {
throw new TypeError(FUNC_ERROR_TEXT);
}
if (isObject(options)) {
leading = "leading" in options ? !!options.leading : leading;
trailing = "trailing" in options ? !!options.trailing : trailing;
}
return debounce(func, wait, {
"leading": leading,
"maxWait": wait,
"trailing": trailing
});
}
function isObject(value) {
var type = typeof value;
return !!value && (type == "object" || type == "function");
}
function isObjectLike(value) {
return !!value && typeof value == "object";
}
function isSymbol(value) {
return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag;
}
function toNumber(value) {
if (typeof value == "number") {
return value;
}
if (isSymbol(value)) {
return NAN;
}
if (isObject(value)) {
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
value = isObject(other) ? other + "" : other;
}
if (typeof value != "string") {
return value === 0 ? value : +value;
}
value = value.replace(reTrim, "");
var isBinary = reIsBinary.test(value);
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
}
module2.exports = throttle;
}
});
// node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/index.js
var require_hanji = __commonJS({
"node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/index.js"(exports) {
"use strict";
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
function adopt(value) {
return value instanceof P ? value : new P(function(resolve2) {
resolve2(value);
});
}
return new (P || (P = Promise))(function(resolve2, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator["throw"](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.onTerminate = exports.renderWithTask = exports.render = exports.TaskTerminal = exports.TaskView = exports.Terminal = exports.deferred = exports.SelectState = exports.Prompt = void 0;
var readline_1 = require_readline();
var sisteransi_1 = require_src();
var utils_1 = require_utils();
var lodash_throttle_1 = __importDefault(require_lodash());
var Prompt3 = class {
constructor() {
this.attachCallbacks = [];
this.detachCallbacks = [];
this.inputCallbacks = [];
}
requestLayout() {
this.terminal.requestLayout();
}
on(type, callback) {
if (type === "attach") {
this.attachCallbacks.push(callback);
} else if (type === "detach") {
this.detachCallbacks.push(callback);
} else if (type === "input") {
this.inputCallbacks.push(callback);
}
}
attach(terminal) {
this.terminal = terminal;
this.attachCallbacks.forEach((it) => it(terminal));
}
detach(terminal) {
this.detachCallbacks.forEach((it) => it(terminal));
this.terminal = void 0;
}
input(str, key) {
this.inputCallbacks.forEach((it) => it(str, key));
}
};
exports.Prompt = Prompt3;
var SelectState3 = class {
constructor(items) {
this.items = items;
this.selectedIdx = 0;
}
bind(prompt) {
prompt.on("input", (str, key) => {
const invalidate = this.consume(str, key);
if (invalidate)
prompt.requestLayout();
});
}
consume(str, key) {
if (!key)
return false;
if (key.name === "down") {
this.selectedIdx = (this.selectedIdx + 1) % this.items.length;
return true;
}
if (key.name === "up") {
this.selectedIdx -= 1;
this.selectedIdx = this.selectedIdx < 0 ? this.items.length - 1 : this.selectedIdx;
return true;
}
return false;
}
};
exports.SelectState = SelectState3;
var deferred = () => {
let resolve2;
let reject;
const promise = new Promise((res, rej) => {
resolve2 = res;
reject = rej;
});
return {
resolve: resolve2,
reject,
promise
};
};
exports.deferred = deferred;
var Terminal = class {
constructor(view, stdin, stdout, closable) {
this.view = view;
this.stdin = stdin;
this.stdout = stdout;
this.closable = closable;
this.text = "";
this.status = "idle";
if (this.stdin.isTTY)
this.stdin.setRawMode(true);
const keypress = (str, key) => {
if (key.name === "c" && key.ctrl === true) {
this.requestLayout();
this.view.detach(this);
this.tearDown(keypress);
if (terminateHandler) {
terminateHandler(this.stdin, this.stdout);
return;
}
this.stdout.write(`
^C
`);
process.exit(1);
}
if (key.name === "escape") {
this.status = "aborted";
this.requestLayout();
this.view.detach(this);
this.tearDown(keypress);
this.resolve({ status: "aborted", data: void 0 });
return;
}
if (key.name === "return") {
this.status = "submitted";
this.requestLayout();
this.view.detach(this);
this.tearDown(keypress);
this.resolve({ status: "submitted", data: this.view.result() });
return;
}
view.input(str, key);
};
this.stdin.on("keypress", keypress);
this.view.attach(this);
const { resolve: resolve2, promise } = (0, exports.deferred)();
this.resolve = resolve2;
this.promise = promise;
this.renderFunc = (0, lodash_throttle_1.default)((str) => {
this.stdout.write(str);
});
}
tearDown(keypress) {
this.stdout.write(sisteransi_1.cursor.show);
this.stdin.removeListener("keypress", keypress);
if (this.stdin.isTTY)
this.stdin.setRawMode(false);
this.closable.close();
}
result() {
return this.promise;
}
toggleCursor(state) {
if (state === "hide") {
this.stdout.write(sisteransi_1.cursor.hide);
} else {
this.stdout.write(sisteransi_1.cursor.show);
}
}
requestLayout() {
const string = this.view.render(this.status);
const clearPrefix = this.text ? (0, utils_1.clear)(this.text, this.stdout.columns) : "";
this.text = string;
this.renderFunc(`${clearPrefix}${string}`);
}
};
exports.Terminal = Terminal;
var TaskView2 = class {
constructor() {
this.attachCallbacks = [];
this.detachCallbacks = [];
}
requestLayout() {
this.terminal.requestLayout();
}
attach(terminal) {
this.terminal = terminal;
this.attachCallbacks.forEach((it) => it(terminal));
}
detach(terminal) {
this.detachCallbacks.forEach((it) => it(terminal));
this.terminal = void 0;
}
on(type, callback) {
if (type === "attach") {
this.attachCallbacks.push(callback);
} else if (type === "detach") {
this.detachCallbacks.push(callback);
}
}
};
exports.TaskView = TaskView2;
var TaskTerminal = class {
constructor(view, stdout) {
this.view = view;
this.stdout = stdout;
this.text = "";
this.view.attach(this);
}
requestLayout() {
const string = this.view.render("pending");
const clearPrefix = this.text ? (0, utils_1.clear)(this.text, this.stdout.columns) : "";
this.text = string;
this.stdout.write(`${clearPrefix}${string}`);
}
clear() {
const string = this.view.render("done");
this.view.detach(this);
const clearPrefix = this.text ? (0, utils_1.clear)(this.text, this.stdout.columns) : "";
this.stdout.write(`${clearPrefix}${string}`);
}
};
exports.TaskTerminal = TaskTerminal;
function render6(view) {
const { stdin, stdout, closable } = (0, readline_1.prepareReadLine)();
if (view instanceof Prompt3) {
const terminal = new Terminal(view, stdin, stdout, closable);
terminal.requestLayout();
return terminal.result();
}
stdout.write(`${view}
`);
closable.close();
return;
}
exports.render = render6;
function renderWithTask4(view, task) {
return __awaiter(this, void 0, void 0, function* () {
const terminal = new TaskTerminal(view, process.stdout);
terminal.requestLayout();
const result = yield task;
terminal.clear();
return result;
});
}
exports.renderWithTask = renderWithTask4;
var terminateHandler;
function onTerminate(callback) {
terminateHandler = callback;
}
exports.onTerminate = onTerminate;
}
});
// src/cli/views.ts
var import_hanji, err, info, error, schema, isRenamePromptItem, ResolveColumnSelect, ResolveTableSelect, ResolveSchemasSelect, Spinner, IntrospectProgress, DropMigrationView, trimmedRange;
var init_views = __esm({
"src/cli/views.ts"() {
init_source();
import_hanji = __toESM(require_hanji());
err = (msg) => {
(0, import_hanji.render)(`${source_default.bold.red("error")} ${msg}`);
};
info = (msg, greyMsg = "") => {
return `${source_default.blue.bold("Info:")} ${msg} ${greyMsg ? source_default.grey(greyMsg) : ""}`.trim();
};
error = (error2, greyMsg = "") => {
return `${source_default.red.bold("Err:")} ${error2} ${greyMsg ? source_default.grey(greyMsg) : ""}`.trim();
};
schema = (schema4) => {
const tables = Object.values(schema4.tables);
let msg = source_default.bold(`${tables.length} tables
`);
msg += tables.map((t) => {
const columnsCount = Object.values(t.columns).length;
const indexesCount = Object.values(t.indexes).length;
const foreignKeys = Object.values(t.foreignKeys).length;
return `${source_default.bold.blue(t.name)} ${source_default.gray(
`${columnsCount} columns ${indexesCount} indexes ${foreignKeys} fks`
)}`;
}).join("\n");
msg += "\n";
const enums = Object.values(schema4["enums"] || {});
if (enums.length > 0) {
msg += "\n";
msg += source_default.bold(`${enums.length} enums
`);
msg += enums.map((it) => {
return `${source_default.bold.blue(it.name)} ${source_default.gray(
`[${Object.values(it.values).join(", ")}]`
)}`;
}).join("\n");
msg += "\n";
}
return msg;
};
isRenamePromptItem = (item) => {
return item["from"] && item["to"];
};
ResolveColumnSelect = class extends import_hanji.Prompt {
constructor(tableName, base, data) {
super();
this.tableName = tableName;
this.base = base;
this.on("attach", (terminal) => terminal.toggleCursor("hide"));
this.data = new import_hanji.SelectState(data);
this.data.bind(this);
}
render(status) {
if (status === "submitted" || status === "aborted") {
return "\n";
}
let text = `
Is ${source_default.bold.blue(
this.base.name
)} column in ${source_default.bold.blue(
this.tableName
)} table created or renamed from another column?
`;
const isSelectedRenamed = isRenamePromptItem(
this.data.items[this.data.selectedIdx]
);
const selectedPrefix = isSelectedRenamed ? source_default.yellow("\u276F ") : source_default.green("\u276F ");
const labelLength = this.data.items.filter((it) => isRenamePromptItem(it)).map((it) => {
return this.base.name.length + 3 + it["from"].name.length;
}).reduce((a, b) => {
if (a > b) {
return a;
}
return b;
}, 0);
this.data.items.forEach((it, idx) => {
const isSelected = idx === this.data.selectedIdx;
const isRenamed = isRenamePromptItem(it);
const title = isRenamed ? `${it.from.name} \u203A ${it.to.name}`.padEnd(labelLength, " ") : it.name.padEnd(labelLength, " ");
const label = isRenamed ? `${source_default.yellow("~")} ${title} ${source_default.gray("rename column")}` : `${source_default.green("+")} ${title} ${source_default.gray("create column")}`;
text += isSelected ? `${selectedPrefix}${label}` : ` ${label}`;
text += idx != this.data.items.length - 1 ? "\n" : "";
});
return text;
}
result() {
return this.data.items[this.data.selectedIdx];
}
};
ResolveTableSelect = class extends import_hanji.Prompt {
constructor(base, data) {
super();
this.base = base;
this.on("attach", (terminal) => terminal.toggleCursor("hide"));
this.state = new import_hanji.SelectState(data);
this.state.bind(this);
this.base = base;
}
render(status) {
if (status === "submitted" || status === "aborted") {
return "";
}
let text = `
Is ${source_default.bold.blue(
this.base.name
)} table created or renamed from another table?
`;
const isSelectedRenamed = isRenamePromptItem(
this.state.items[this.state.selectedIdx]
);
const selectedPrefix = isSelectedRenamed ? source_default.yellow("\u276F ") : source_default.green("\u276F ");
const labelLength = this.state.items.filter((it) => isRenamePromptItem(it)).map((it) => {
return this.base.name.length + 3 + it["from"].name.length;
}).reduce((a, b) => {
if (a > b) {
return a;
}
return b;
}, 0);
this.state.items.forEach((it, idx) => {
const isSelected = idx === this.state.selectedIdx;
const isRenamed = isRenamePromptItem(it);
const title = isRenamed ? `${it.from.name} \u203A ${it.to.name}`.padEnd(labelLength, " ") : it.name.padEnd(labelLength, " ");
const label = isRenamed ? `${source_default.yellow("~")} ${title} ${source_default.gray("rename table")}` : `${source_default.green("+")} ${title} ${source_default.gray("create table")}`;
text += isSelected ? `${selectedPrefix}${label}` : ` ${label}`;
text += idx != this.state.items.length - 1 ? "\n" : "";
});
return text;
}
result() {
return this.state.items[this.state.selectedIdx];
}
};
ResolveSchemasSelect = class extends import_hanji.Prompt {
constructor(base, data) {
super();
this.base = base;
this.on("attach", (terminal) => terminal.toggleCursor("hide"));
this.state = new import_hanji.SelectState(data);
this.state.bind(this);
this.base = base;
}
render(status) {
if (status === "submitted" || status === "aborted") {
return "";
}
let text = `
Is ${source_default.bold.blue(
this.base.name
)} schema created or renamed from another schema?
`;
const isSelectedRenamed = isRenamePromptItem(
this.state.items[this.state.selectedIdx]
);
const selectedPrefix = isSelectedRenamed ? source_default.yellow("\u276F ") : source_default.green("\u276F ");
const labelLength = this.state.items.filter((it) => isRenamePromptItem(it)).map((it) => {
return this.base.name.length + 3 + it["from"].name.length;
}).reduce((a, b) => {
if (a > b) {
return a;
}
return b;
}, 0);
this.state.items.forEach((it, idx) => {
const isSelected = idx === this.state.selectedIdx;
const isRenamed = isRenamePromptItem(it);
const title = isRenamed ? `${it.from.name} \u203A ${it.to.name}`.padEnd(labelLength, " ") : it.name.padEnd(labelLength, " ");
const label = isRenamed ? `${source_default.yellow("~")} ${title} ${source_default.gray("rename schema")}` : `${source_default.green("+")} ${title} ${source_default.gray("create schema")}`;
text += isSelected ? `${selectedPrefix}${label}` : ` ${label}`;
text += idx != this.state.items.length - 1 ? "\n" : "";
});
return text;
}
result() {
return this.state.items[this.state.selectedIdx];
}
};
Spinner = class {
constructor(frames) {
this.frames = frames;
this.offset = 0;
this.tick = () => {
this.iterator();
};
this.value = () => {
return this.frames[this.offset];
};
this.iterator = () => {
this.offset += 1;
this.offset %= frames.length - 1;
};
}
};
IntrospectProgress = class extends import_hanji.TaskView {
constructor() {
super();
this.spinner = new Spinner("\u28F7\u28EF\u28DF\u287F\u28BF\u28FB\u28FD\u28FE".split(""));
this.state = {
tables: {
count: 0,
name: "tables",
status: "fetching"
},
columns: {
count: 0,
name: "columns",
status: "fetching"
},
enums: {
count: 0,
name: "enums",
status: "fetching"
},
indexes: {
count: 0,
name: "indexes",
status: "fetching"
},
fks: {
count: 0,
name: "foreign keys",
status: "fetching"
}
};
this.formatCount = (count) => {
const width = Math.max.apply(
null,
Object.values(this.state).map((it) => it.count.toFixed(0).length)
);
return count.toFixed(0).padEnd(width, " ");
};
this.statusText = (spinner, stage) => {
const { name, count } = stage;
const isDone = stage.status === "done";
const prefix = isDone ? `[${source_default.green("\u2713")}]` : `[${spinner}]`;
const formattedCount = this.formatCount(count);
const suffix = isDone ? `${formattedCount} ${name} fetched` : `${formattedCount} ${name} fetching`;
return `${prefix} ${suffix}
`;
};
this.timeout = setInterval(() => {
this.spinner.tick();
this.requestLayout();
}, 128);
this.on("detach", () => clearInterval(this.timeout));
}
update(stage, count, status) {
this.state[stage].count = count;
this.state[stage].status = status;
this.requestLayout();
}
render() {
let info2 = "";
const spin = this.spinner.value();
info2 += this.statusText(spin, this.state.tables);
info2 += this.statusText(spin, this.state.columns);
info2 += this.statusText(spin, this.state.enums);
info2 += this.statusText(spin, this.state.indexes);
info2 += this.statusText(spin, this.state.fks);
return info2;
}
};
DropMigrationView = class extends import_hanji.Prompt {
constructor(data) {
super();
this.on("attach", (terminal) => terminal.toggleCursor("hide"));
this.data = new import_hanji.SelectState(data);
this.data.selectedIdx = data.length - 1;
this.data.bind(this);
}
render(status) {
if (status === "submitted" || status === "aborted") {
return "\n";
}
let text = source_default.bold("Please select migration to drop:\n");
const selectedPrefix = source_default.yellow("\u276F ");
const data = trimmedRange(this.data.items, this.data.selectedIdx, 9);
const labelLength = data.trimmed.map((it) => it.tag.length).reduce((a, b) => {
if (a > b) {
return a;
}
return b;
}, 0);
text += data.startTrimmed ? " ...\n" : "";
data.trimmed.forEach((it, idx) => {
const isSelected = idx === this.data.selectedIdx - data.offset;
let title = it.tag.padEnd(labelLength, " ");
title = isSelected ? source_default.yellow(title) : title;
text += isSelected ? `${selectedPrefix}${title}` : ` ${title}`;
text += idx != this.data.items.length - 1 ? "\n" : "";
});
text += data.endTrimmed ? " ...\n" : "";
return text;
}
result() {
return this.data.items[this.data.selectedIdx];
}
};
trimmedRange = (arr, index4, limitLines) => {
const limit = limitLines - 2;
const sideLimit = Math.round(limit / 2);
const endTrimmed = arr.length - sideLimit > index4;
const startTrimmed = index4 > sideLimit - 1;
const paddingStart = Math.max(index4 + sideLimit - arr.length, 0);
const paddingEnd = Math.min(index4 - sideLimit + 1, 0);
const d1 = endTrimmed ? 1 : 0;
const d2 = startTrimmed ? 0 : 1;
const start = Math.max(0, index4 - sideLimit + d1 - paddingStart);
const end = Math.min(arr.length, index4 + sideLimit + d2 - paddingEnd);
return {
trimmed: arr.slice(start, end),
offset: start,
startTrimmed,
endTrimmed
};
};
}
});
// src/global.ts
var originUUID, snapshotVersion;
var init_global = __esm({
"src/global.ts"() {
originUUID = "00000000-0000-0000-0000-000000000000";
snapshotVersion = "5";
}
});
// src/serializer/mysqlSchema.ts
var index, fk, column, tableV3, compositePK, tableV4, table, dialect, schemaHash, schemaInternalV3, schemaInternalV4, schemaInternal, schemaV3, schemaV4, schema2, tableSquashedV4, tableSquashed, schemaSquashed, schemaSquashedV4, MySqlSquasher, squashMysqlSchemeV4, squashMysqlScheme, mysqlSchema, mysqlSchemaV4, mysqlSchemaV3, backwardCompatibleMysqlSchema, dryMySql;
var init_mysqlSchema = __esm({
"src/serializer/mysqlSchema.ts"() {
init_global();
init_utils2();
init_lib();
index = objectType({
name: stringType(),
columns: stringType().array(),
isUnique: booleanType(),
using: enumType(["btree", "hash"]).optional(),
algorithm: enumType(["default", "inplace", "copy"]).optional(),
lock: enumType(["default", "none", "shared", "exclusive"]).optional()
}).strict();
fk = objectType({
name: stringType(),
tableFrom: stringType(),
columnsFrom: stringType().array(),
tableTo: stringType(),
columnsTo: stringType().array(),
onUpdate: stringType().optional(),
onDelete: stringType().optional()
}).strict();
column = objectType({
name: stringType(),
type: stringType(),
primaryKey: booleanType(),
notNull: booleanType(),
autoincrement: booleanType().optional(),
default: anyType().optional(),
onUpdate: anyType().optional()
}).strict();
tableV3 = objectType({
name: stringType(),
columns: recordType(stringType(), column),
indexes: recordType(stringType(), index),
foreignKeys: recordType(stringType(), fk)
}).strict();
compositePK = objectType({
name: stringType(),
columns: stringType().array()
}).strict();
tableV4 = objectType({
name: stringType(),
schema: stringType().optional(),
columns: recordType(stringType(), column),
indexes: recordType(stringType(), index),
foreignKeys: recordType(stringType(), fk)
}).strict();
table = objectType({
name: stringType(),
schema: stringType().optional(),
columns: recordType(stringType(), column),
indexes: recordType(stringType(), index),
foreignKeys: recordType(stringType(), fk),
compositePrimaryKeys: recordType(stringType(), compositePK)
}).strict();
dialect = literalType("mysql");
schemaHash = objectType({
id: stringType(),
prevId: stringType()
});
schemaInternalV3 = objectType({
version: literalType("3"),
dialect,
tables: recordType(stringType(), tableV3)
}).strict();
schemaInternalV4 = objectType({
version: literalType("4"),
dialect,
tables: recordType(stringType(), tableV4),
schemas: recordType(stringType(), stringType())
}).strict();
schemaInternal = objectType({
version: literalType("5"),
dialect,
tables: recordType(stringType(), table),
schemas: recordType(stringType(), stringType()),
_meta: objectType({
schemas: recordType(stringType(), stringType()),
tables: recordType(stringType(), stringType()),
columns: recordType(stringType(), stringType())
})
}).strict();
schemaV3 = schemaInternalV3.merge(schemaHash);
schemaV4 = schemaInternalV4.merge(schemaHash);
schema2 = schemaInternal.merge(schemaHash);
tableSquashedV4 = objectType({
name: stringType(),
schema: stringType().optional(),
columns: recordType(stringType(), column),
indexes: recordType(stringType(), stringType()),
foreignKeys: recordType(stringType(), stringType())
}).strict();
tableSquashed = objectType({
name: stringType(),
schema: stringType().optional(),
columns: recordType(stringType(), column),
indexes: recordType(stringType(), stringType()),
foreignKeys: recordType(stringType(), stringType()),
compositePrimaryKeys: recordType(stringType(), stringType())
}).strict();
schemaSquashed = objectType({
version: literalType("5"),
dialect,
tables: recordType(stringType(), tableSquashed),
schemas: recordType(stringType(), stringType())
}).strict();
schemaSquashedV4 = objectType({
version: literalType("4"),
dialect,
tables: recordType(stringType(), tableSquashedV4),
schemas: recordType(stringType(), stringType())
}).strict();
MySqlSquasher = {
squashIdx: (idx) => {
index.parse(idx);
return `${idx.name};${idx.columns.join(",")};${idx.isUnique};${idx.using ?? ""};${idx.algorithm ?? ""};${idx.lock ?? ""}`;
},
unsquashIdx: (input) => {
const [name, columnsString, isUnique, using, algorithm, lock] = input.split(";");
const destructed = {
name,
columns: columnsString.split(","),
isUnique: isUnique === "true",
using: using ? using : void 0,
algorithm: algorithm ? algorithm : void 0,
lock: lock ? lock : void 0
};
return index.parse(destructed);
},
squashPK: (pk) => {
return `${pk.name};${pk.columns.join(",")}`;
},
unsquashPK: (pk) => {
const splitted = pk.split(";");
return { name: splitted[0], columns: splitted[1].split(",") };
},
squashFK: (fk4) => {
return `${fk4.name};${fk4.tableFrom};${fk4.columnsFrom.join(",")};${fk4.tableTo};${fk4.columnsTo.join(",")};${fk4.onUpdate ?? ""};${fk4.onDelete ?? ""}`;
},
unsquashFK: (input) => {
const [
name,
tableFrom,
columnsFromStr,
tableTo,
columnsToStr,
onUpdate,
onDelete
] = input.split(";");
const result = fk.parse({
name,
tableFrom,
columnsFrom: columnsFromStr.split(","),
tableTo,
columnsTo: columnsToStr.split(","),
onUpdate,
onDelete
});
return result;
}
};
squashMysqlSchemeV4 = (json) => {
const mappedTables = Object.fromEntries(
Object.entries(json.tables).map((it) => {
const squashedIndexes = mapValues(it[1].indexes, (index4) => {
return MySqlSquasher.squashIdx(index4);
});
const squashedFKs = mapValues(it[1].foreignKeys, (fk4) => {
return MySqlSquasher.squashFK(fk4);
});
return [
it[0],
{
name: it[1].name,
schema: it[1].schema,
columns: it[1].columns,
indexes: squashedIndexes,
foreignKeys: squashedFKs
}
];
})
);
return {
version: "4",
dialect: json.dialect,
tables: mappedTables,
schemas: json.schemas
};
};
squashMysqlScheme = (json) => {
const mappedTables = Object.fromEntries(
Object.entries(json.tables).map((it) => {
const squashedIndexes = mapValues(it[1].indexes, (index4) => {
return MySqlSquasher.squashIdx(index4);
});
const squashedFKs = mapValues(it[1].foreignKeys, (fk4) => {
return MySqlSquasher.squashFK(fk4);
});
const squashedPKs = mapValues(it[1].compositePrimaryKeys, (pk) => {
return MySqlSquasher.squashPK(pk);
});
return [
it[0],
{
name: it[1].name,
schema: it[1].schema,
columns: it[1].columns,
indexes: squashedIndexes,
foreignKeys: squashedFKs,
compositePrimaryKeys: squashedPKs
}
];
})
);
return {
version: "5",
dialect: json.dialect,
tables: mappedTables,
schemas: json.schemas
};
};
mysqlSchema = schema2;
mysqlSchemaV4 = schemaV4;
mysqlSchemaV3 = schemaV3;
backwardCompatibleMysqlSchema = unionType([schemaV3, schemaV4, schema2]);
dryMySql = mysqlSchema.parse({
version: snapshotVersion,
dialect: "mysql",
id: originUUID,
prevId: "",
tables: {},
schemas: {},
_meta: {
schemas: {},
tables: {},
columns: {}
}
});
}
});
// src/serializer/pgSchema.ts
var indexV2, columnV2, tableV2, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, index2, fk2, column2, tableV32, compositePK2, tableV42, table2, schemaHash2, pgSchemaInternalV3, pgSchemaInternalV4, pgSchemaInternal, tableSquashed2, tableSquashedV42, pgSchemaSquashedV4, pgSchemaSquashed, pgSchemaV3, pgSchemaV4, pgSchema, backwardCompatiblePgSchema, PgSquasher, squashPgSchemeV4, squashPgScheme, dryPg;
var init_pgSchema = __esm({
"src/serializer/pgSchema.ts"() {
init_global();
init_utils2();
init_lib();
indexV2 = objectType({
name: stringType(),
columns: recordType(
stringType(),
objectType({
name: stringType()
})
),
isUnique: booleanType()
}).strict();
columnV2 = objectType({
name: stringType(),
type: stringType(),
primaryKey: booleanType(),
notNull: booleanType(),
default: anyType().optional(),
references: stringType().optional()
}).strict();
tableV2 = objectType({
name: stringType(),
columns: recordType(stringType(), columnV2),
indexes: recordType(stringType(), indexV2)
}).strict();
enumSchema = objectType({
name: stringType(),
values: recordType(stringType(), stringType())
}).strict();
pgSchemaV2 = objectType({
version: literalType("2"),
tables: recordType(stringType(), tableV2),
enums: recordType(stringType(), enumSchema)
}).strict();
references = objectType({
foreignKeyName: stringType(),
table: stringType(),
column: stringType(),
onDelete: stringType().optional(),
onUpdate: stringType().optional()
}).strict();
columnV1 = objectType({
name: stringType(),
type: stringType(),
primaryKey: booleanType(),
notNull: booleanType(),
default: anyType().optional(),
references: references.optional()
}).strict();
tableV1 = objectType({
name: stringType(),
columns: recordType(stringType(), columnV1),
indexes: recordType(stringType(), indexV2)
}).strict();
pgSchemaV1 = objectType({
version: literalType("1"),
tables: recordType(stringType(), tableV1),
enums: recordType(stringType(), enumSchema)
}).strict();
index2 = objectType({
name: stringType(),
columns: stringType().array(),
isUnique: booleanType()
}).strict();
fk2 = objectType({
name: stringType(),
tableFrom: stringType(),
columnsFrom: stringType().array(),
tableTo: stringType(),
columnsTo: stringType().array(),
onUpdate: stringType().optional(),
onDelete: stringType().optional()
}).strict();
column2 = objectType({
name: stringType(),
type: stringType(),
primaryKey: booleanType(),
notNull: booleanType(),
default: anyType().optional()
}).strict();
tableV32 = objectType({
name: stringType(),
columns: recordType(stringType(), column2),
indexes: recordType(stringType(), index2),
foreignKeys: recordType(stringType(), fk2)
}).strict();
compositePK2 = objectType({
name: stringType(),
columns: stringType().array()
}).strict();
tableV42 = objectType({
name: stringType(),
schema: stringType(),
columns: recordType(stringType(), column2),
indexes: recordType(stringType(), index2),
foreignKeys: recordType(stringType(), fk2)
}).strict();
table2 = objectType({
name: stringType(),
schema: stringType(),
columns: recordType(stringType(), column2),
indexes: recordType(stringType(), index2),
foreignKeys: recordType(stringType(), fk2),
compositePrimaryKeys: recordType(stringType(), compositePK2)
}).strict();
schemaHash2 = objectType({
id: stringType(),
prevId: stringType()
});
pgSchemaInternalV3 = objectType({
version: literalType("3"),
dialect: literalType("pg"),
tables: recordType(stringType(), tableV32),
enums: recordType(stringType(), enumSchema)
}).strict();
pgSchemaInternalV4 = objectType({
version: literalType("4"),
dialect: literalType("pg"),
tables: recordType(stringType(), tableV42),
enums: recordType(stringType(), enumSchema),
schemas: recordType(stringType(), stringType())
}).strict();
pgSchemaInternal = objectType({
version: literalType("5"),
dialect: literalType("pg"),
tables: recordType(stringType(), table2),
enums: recordType(stringType(), enumSchema),
schemas: recordType(stringType(), stringType()),
_meta: objectType({
schemas: recordType(stringType(), stringType()),
tables: recordType(stringType(), stringType()),
columns: recordType(stringType(), stringType())
})
}).strict();
tableSquashed2 = objectType({
name: stringType(),
schema: stringType(),
columns: recordType(stringType(), column2),
indexes: recordType(stringType(), stringType()),
foreignKeys: recordType(stringType(), stringType()),
compositePrimaryKeys: recordType(stringType(), stringType())
}).strict();
tableSquashedV42 = objectType({
name: stringType(),
schema: stringType(),
columns: recordType(stringType(), column2),
indexes: recordType(stringType(), stringType()),
foreignKeys: recordType(stringType(), stringType())
}).strict();
pgSchemaSquashedV4 = objectType({
version: literalType("4"),
dialect: enumType(["pg"]),
tables: recordType(stringType(), tableSquashedV42),
enums: recordType(stringType(), enumSchema),
schemas: recordType(stringType(), stringType())
}).strict();
pgSchemaSquashed = objectType({
version: literalType("5"),
dialect: enumType(["pg"]),
tables: recordType(stringType(), tableSquashed2),
enums: recordType(stringType(), enumSchema),
schemas: recordType(stringType(), stringType())
}).strict();
pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
pgSchema = pgSchemaInternal.merge(schemaHash2);
backwardCompatiblePgSchema = unionType([
pgSchemaV1,
pgSchemaV2,
pgSchemaV3,
pgSchemaV4,
pgSchema
]);
PgSquasher = {
squashIdx: (idx) => {
index2.parse(idx);
return `${idx.name};${idx.columns.join(",")};${idx.isUnique}`;
},
unsquashIdx: (input) => {
const [name, columnsString, isUnique] = input.split(";");
const result = index2.parse({
name,
columns: columnsString.split(","),
isUnique: isUnique === "true"
});
return result;
},
squashFK: (fk4) => {
return `${fk4.name};${fk4.tableFrom};${fk4.columnsFrom.join(",")};${fk4.tableTo};${fk4.columnsTo.join(",")};${fk4.onUpdate ?? ""};${fk4.onDelete ?? ""}`;
},
squashPK: (pk) => {
return `${pk.columns.join(",")}`;
},
unsquashPK: (pk) => {
return { name: "", columns: pk.split(",") };
},
unsquashFK: (input) => {
const [
name,
tableFrom,
columnsFromStr,
tableTo,
columnsToStr,
onUpdate,
onDelete
] = input.split(";");
const result = fk2.parse({
name,
tableFrom,
columnsFrom: columnsFromStr.split(","),
tableTo,
columnsTo: columnsToStr.split(","),
onUpdate,
onDelete
});
return result;
}
};
squashPgSchemeV4 = (json) => {
const mappedTables = Object.fromEntries(
Object.entries(json.tables).map((it) => {
const squashedIndexes = mapValues(it[1].indexes, (index4) => {
return PgSquasher.squashIdx(index4);
});
const squashedFKs = mapValues(it[1].foreignKeys, (fk4) => {
return PgSquasher.squashFK(fk4);
});
return [
it[0],
{
name: it[1].name,
schema: it[1].schema,
columns: it[1].columns,
indexes: squashedIndexes,
foreignKeys: squashedFKs
}
];
})
);
return {
version: "4",
dialect: json.dialect,
tables: mappedTables,
enums: json.enums,
schemas: json.schemas
};
};
squashPgScheme = (json) => {
const mappedTables = Object.fromEntries(
Object.entries(json.tables).map((it) => {
const squashedIndexes = mapValues(it[1].indexes, (index4) => {
return PgSquasher.squashIdx(index4);
});
const squashedFKs = mapValues(it[1].foreignKeys, (fk4) => {
return PgSquasher.squashFK(fk4);
});
const squashedPKs = mapValues(it[1].compositePrimaryKeys, (pk) => {
return PgSquasher.squashPK(pk);
});
return [
it[0],
{
name: it[1].name,
schema: it[1].schema,
columns: it[1].columns,
indexes: squashedIndexes,
foreignKeys: squashedFKs,
compositePrimaryKeys: squashedPKs
}
];
})
);
return {
version: "5",
dialect: json.dialect,
tables: mappedTables,
enums: json.enums,
schemas: json.schemas
};
};
dryPg = pgSchema.parse({
version: snapshotVersion,
dialect: "pg",
id: originUUID,
prevId: "",
tables: {},
enums: {},
schemas: {},
_meta: {
schemas: {},
tables: {},
columns: {}
}
});
}
});
// src/serializer/sqliteSchema.ts
var index3, fk3, compositePK3, column3, tableV33, table3, dialect2, schemaHash3, schemaInternalV32, schemaInternalV42, latestVersion, schemaInternal2, schemaV32, schemaV42, schema3, tableSquashed3, schemaSquashed2, SQLiteSquasher, squashSqliteScheme, drySQLite, sqliteSchemaV3, sqliteSchemaV4, sqliteSchema, backwardCompatibleSqliteSchema;
var init_sqliteSchema = __esm({
"src/serializer/sqliteSchema.ts"() {
init_global();
init_utils2();
init_lib();
index3 = objectType({
name: stringType(),
columns: stringType().array(),
where: stringType().optional(),
isUnique: booleanType()
}).strict();
fk3 = objectType({
name: stringType(),
tableFrom: stringType(),
columnsFrom: stringType().array(),
tableTo: stringType(),
columnsTo: stringType().array(),
onUpdate: stringType().optional(),
onDelete: stringType().optional()
}).strict();
compositePK3 = objectType({
columns: stringType().array()
}).strict();
column3 = objectType({
name: stringType(),
type: stringType(),
primaryKey: booleanType(),
notNull: booleanType(),
autoincrement: booleanType().optional(),
default: anyType().optional()
}).strict();
tableV33 = objectType({
name: stringType(),
columns: recordType(stringType(), column3),
indexes: recordType(stringType(), index3),
foreignKeys: recordType(stringType(), fk3)
}).strict();
table3 = objectType({
name: stringType(),
columns: recordType(stringType(), column3),
indexes: recordType(stringType(), index3),
foreignKeys: recordType(stringType(), fk3),
compositePrimaryKeys: recordType(stringType(), compositePK3)
}).strict();
dialect2 = enumType(["sqlite"]);
schemaHash3 = objectType({
id: stringType(),
prevId: stringType()
}).strict();
schemaInternalV32 = objectType({
version: literalType("3"),
dialect: dialect2,
tables: recordType(stringType(), tableV33),
enums: objectType({})
}).strict();
schemaInternalV42 = objectType({
version: literalType("4"),
dialect: dialect2,
tables: recordType(stringType(), table3),
enums: objectType({})
}).strict();
latestVersion = literalType("5");
schemaInternal2 = objectType({
version: latestVersion,
dialect: dialect2,
tables: recordType(stringType(), table3),
enums: objectType({}),
_meta: objectType({
tables: recordType(stringType(), stringType()),
columns: recordType(stringType(), stringType())
})
}).strict();
schemaV32 = schemaInternalV32.merge(schemaHash3).strict();
schemaV42 = schemaInternalV42.merge(schemaHash3).strict();
schema3 = schemaInternal2.merge(schemaHash3).strict();
tableSquashed3 = objectType({
name: stringType(),
columns: recordType(stringType(), column3),
indexes: recordType(stringType(), stringType()),
foreignKeys: recordType(stringType(), stringType()),
compositePrimaryKeys: recordType(stringType(), stringType())
}).strict();
schemaSquashed2 = objectType({
version: latestVersion,
dialect: dialect2,
tables: recordType(stringType(), tableSquashed3),
enums: anyType()
}).strict();
SQLiteSquasher = {
squashIdx: (idx) => {
index3.parse(idx);
return `${idx.name};${idx.columns.join(",")};${idx.isUnique};${idx.where ?? ""}`;
},
unsquashIdx: (input) => {
const [name, columnsString, isUnique, where] = input.split(";");
const result = index3.parse({
name,
columns: columnsString.split(","),
isUnique: isUnique === "true",
where: where ?? void 0
});
return result;
},
squashFK: (fk4) => {
return `${fk4.name};${fk4.tableFrom};${fk4.columnsFrom.join(",")};${fk4.tableTo};${fk4.columnsTo.join(",")};${fk4.onUpdate ?? ""};${fk4.onDelete ?? ""}`;
},
unsquashFK: (input) => {
const [
name,
tableFrom,
columnsFromStr,
tableTo,
columnsToStr,
onUpdate,
onDelete
] = input.split(";");
const result = fk3.parse({
name,
tableFrom,
columnsFrom: columnsFromStr.split(","),
tableTo,
columnsTo: columnsToStr.split(","),
onUpdate,
onDelete
});
return result;
},
squashPK: (pk) => {
return pk.columns.join(",");
},
unsquashPK: (pk) => {
return pk.split(",");
}
};
squashSqliteScheme = (json) => {
const mappedTables = Object.fromEntries(
Object.entries(json.tables).map((it) => {
const squashedIndexes = mapValues(it[1].indexes, (index4) => {
return SQLiteSquasher.squashIdx(index4);
});
const squashedFKs = mapValues(it[1].foreignKeys, (fk4) => {
return SQLiteSquasher.squashFK(fk4);
});
const squashedPKs = mapValues(it[1].compositePrimaryKeys, (pk) => {
return SQLiteSquasher.squashPK(pk);
});
return [
it[0],
{
name: it[1].name,
columns: it[1].columns,
indexes: squashedIndexes,
foreignKeys: squashedFKs,
compositePrimaryKeys: squashedPKs
}
];
})
);
return {
version: "5",
dialect: json.dialect,
tables: mappedTables,
enums: json.enums
};
};
drySQLite = schema3.parse({
version: snapshotVersion,
dialect: "sqlite",
id: originUUID,
prevId: "",
tables: {},
enums: {},
_meta: {
tables: {},
columns: {}
}
});
sqliteSchemaV3 = schemaV32;
sqliteSchemaV4 = schemaV42;
sqliteSchema = schema3;
backwardCompatibleSqliteSchema = unionType([schemaV32, schemaV42, schema3]);
}
});
// src/jsonDiffer.js
function diffForRenamedTables(pairs) {
const renamed = pairs.map((it) => {
const from = it.from;
const to = it.to;
const newFrom = { ...from, name: to.name };
return [newFrom, to];
});
const altered = renamed.map((pair) => {
return diffForRenamedTable(pair[0], pair[1]);
});
return altered;
}
function diffForRenamedTable(t1, t2) {
t1.name = t2.name;
const diffed = (0, import_json_diff.diff)(t1, t2) || {};
diffed.name = t2.name;
return findAlternationsInTable(diffed, t2.schema);
}
function diffForRenamedColumn(t1, t2) {
const renamed = { ...t1, name: t2.name };
const diffed = (0, import_json_diff.diff)(renamed, t2) || {};
diffed.name = t2.name;
return alternationsInColumn(diffed);
}
function applyJsonDiff(json1, json2) {
json1 = JSON.parse(JSON.stringify(json1));
json2 = JSON.parse(JSON.stringify(json2));
const rawDiff = (0, import_json_diff.diff)(json1, json2);
const difference = rawDiff;
const tableToSchema = Object.entries(json2.tables).reduce((res, it) => {
res[it[0]] = it[1].schema;
return res;
}, {});
if (!difference)
return {};
difference.tables = difference.tables ?? {};
difference.enums = difference.enums ?? {};
difference.schemas = difference.schemas ?? {};
const tableEntries = Object.entries(difference.tables);
const addedTables = tableEntries.filter((it) => it[0].includes("__added")).map((it) => it[1]);
const deletedTables = tableEntries.filter((it) => it[0].includes("__deleted")).map((it) => it[1]);
const enumsEntries = Object.entries(difference.enums);
const addedEnums = enumsEntries.filter((it) => it[0].includes("__added")).map((it) => it[1]).map((it) => {
const values = Object.entries(it.values).map((ve) => ve[1]);
return { name: it.name, values };
});
const deletedEnums = enumsEntries.filter((it) => it[0].includes("__deleted")).map((it) => it[1]).map((it) => {
const values = Object.entries(it.values).map((ve) => ve[1]);
return { name: it.name, values };
});
const alteredEnums = enumsEntries.filter((it) => !(it[0].includes("__added") || it[0].includes("__deleted"))).map((it) => {
const vals = it[1].values;
const addedValues = Object.entries(vals).filter((val) => val[0].includes("__added")).map((val) => val[1]);
const deletedValues = Object.entries(vals).filter((val) => val[0].includes("__deleted")).map((val) => val[1]);
return { name: it[0], addedValues, deletedValues };
});
const alteredTables = Object.keys(difference.tables).filter((it) => !(it.includes("__added") || it.includes("__deleted"))).map((it) => {
return { name: it, ...difference.tables[it] };
});
const schemasEntries = Object.entries(difference.schemas);
const addedSchemas = schemasEntries.filter((it) => it[0].endsWith("__added")).map((it) => it[1]);
const deletedSchemas = schemasEntries.filter((it) => it[0].endsWith("__deleted")).map((it) => it[1]);
const alteredTablesWithColumns = alteredTables.map((table4) => findAlternationsInTable(table4, tableToSchema[table4.name]));
return {
addedTables,
deletedTables,
alteredTablesWithColumns,
addedEnums,
deletedEnums,
alteredEnums,
addedSchemas,
deletedSchemas
};
}
var import_json_diff, findAlternationsInTable, alternationsInColumn;
var init_jsonDiffer = __esm({
"src/jsonDiffer.js"() {
"use-strict";
import_json_diff = require("json-diff");
findAlternationsInTable = (table4, tableSchema) => {
const columns = table4.columns ?? {};
let schema4 = {
type: "none",
value: tableSchema
};
if ("schema" in table4) {
if (table4.schema.__new) {
schema4 = { type: "changed", old: table4.schema.__old, new: table4.schema.__new };
} else {
schema4 = { type: "deleted", value: table4.schema.__old };
}
}
if ("schema__added" in table4) {
schema4 = { type: "added", value: table4.schema__added };
}
if ("schema__deleted" in table4) {
schema4 = { type: "deleted", value: table4.schema__deleted };
}
const added = Object.keys(columns).filter((it) => it.includes("__added")).map((it) => {
return { ...columns[it] };
});
const deleted = Object.keys(columns).filter((it) => it.includes("__deleted")).map((it) => {
return { ...columns[it] };
});
const altered = Object.keys(columns).filter((it) => !(it.includes("__deleted") || it.includes("__added"))).map((it) => {
return { name: it, ...columns[it] };
});
const deletedIndexes = Object.fromEntries(
Object.entries(table4.indexes__deleted || {}).concat(Object.entries(table4.indexes || {}).filter((it) => it[0].includes("__deleted"))).map((entry) => [entry[0].replace("__deleted", ""), entry[1]])
);
const addedIndexes = Object.fromEntries(
Object.entries(table4.indexes__added || {}).concat(Object.entries(table4.indexes || {}).filter((it) => it[0].includes("__added"))).map((entry) => [entry[0].replace("__added", ""), entry[1]])
);
const alteredIndexes = Object.fromEntries(Object.entries(table4.indexes || {}).filter((it) => {
return !it[0].endsWith("__deleted") && !it[0].endsWith("__added");
}));
const deletedForeignKeys = Object.fromEntries(
Object.entries(table4.foreignKeys__deleted || {}).concat(Object.entries(table4.foreignKeys || {}).filter((it) => it[0].includes("__deleted"))).map((entry) => [entry[0].replace("__deleted", ""), entry[1]])
);
const addedForeignKeys = Object.fromEntries(
Object.entries(table4.foreignKeys__added || {}).concat(Object.entries(table4.foreignKeys || {}).filter((it) => it[0].includes("__added"))).map((entry) => [entry[0].replace("__added", ""), entry[1]])
);
const alteredForeignKeys = Object.fromEntries(Object.entries(table4.foreignKeys || {}).filter((it) => !it[0].endsWith("__added") && !it[0].endsWith("__deleted")).map((entry) => [entry[0], entry[1]]));
const addedCompositePKs = Object.fromEntries(Object.entries(table4.compositePrimaryKeys || {}).filter((it) => {
return it[0].endsWith("__added");
}));
const deletedCompositePKs = Object.fromEntries(Object.entries(table4.compositePrimaryKeys || {}).filter((it) => {
return it[0].endsWith("__deleted");
}));
const alteredCompositePKs = Object.fromEntries(Object.entries(table4.compositePrimaryKeys || {}).filter((it) => {
return !it[0].endsWith("__deleted") && !it[0].endsWith("__added");
}));
const mappedAltered = altered.map((it) => alternationsInColumn(it));
return {
name: table4.name,
schema: schema4,
deleted,
added,
altered: mappedAltered,
addedIndexes,
deletedIndexes,
alteredIndexes,
addedForeignKeys,
deletedForeignKeys,
alteredForeignKeys,
addedCompositePKs,
deletedCompositePKs,
alteredCompositePKs
};
};
alternationsInColumn = (column7) => {
const altered = [column7];
const result = altered.map((it) => {
if (typeof it.name !== "string" && "__old" in it.name) {
return { ...it, name: { type: "changed", old: it.name.__old, new: it.name.__new } };
}
return it;
}).map((it) => {
if ("type" in it) {
return { ...it, type: { type: "changed", old: it.type.__old, new: it.type.__new } };
}
return it;
}).map((it) => {
if ("default" in it) {
return { ...it, default: { type: "changed", old: it.default.__old, new: it.default.__new } };
}
if ("default__added" in it) {
const { default__added, ...others } = it;
return { ...others, default: { type: "added", value: it.default__added } };
}
if ("default__deleted" in it) {
const { default__deleted, ...others } = it;
return { ...others, default: { type: "deleted", value: it.default__deleted } };
}
return it;
}).map((it) => {
if ("notNull" in it) {
return { ...it, notNull: { type: "changed", old: it.notNull.__old, new: it.notNull.__new } };
}
if ("notNull__added" in it) {
const { notNull__added, ...others } = it;
return { ...others, notNull: { type: "added", value: it.notNull__added } };
}
if ("notNull__deleted" in it) {
const { notNull__deleted, ...others } = it;
return { ...others, notNull: { type: "deleted", value: it.notNull__deleted } };
}
return it;
}).map((it) => {
if ("primaryKey" in it) {
return { ...it, primaryKey: { type: "changed", old: it.primaryKey.__old, new: it.primaryKey.__new } };
}
if ("primaryKey__added" in it) {
const { notNull__added, ...others } = it;
return { ...others, primaryKey: { type: "added", value: it.primaryKey__added } };
}
if ("primaryKey__deleted" in it) {
const { notNull__deleted, ...others } = it;
return { ...others, primaryKey: { type: "deleted", value: it.primaryKey__deleted } };
}
return it;
}).map((it) => {
if ("onUpdate" in it) {
return { ...it, onUpdate: { type: "changed", old: it.onUpdate.__old, new: it.onUpdate.__new } };
}
if ("onUpdate__added" in it) {
const { onUpdate__added, ...others } = it;
return { ...others, onUpdate: { type: "added", value: it.onUpdate__added } };
}
if ("onUpdate__deleted" in it) {
const { onUpdate__deleted, ...others } = it;
return { ...others, onUpdate: { type: "deleted", value: it.onUpdate__deleted } };
}
return it;
}).map((it) => {
if ("autoincrement" in it) {
return { ...it, autoincrement: { type: "changed", old: it.autoincrement.__old, new: it.autoincrement.__new } };
}
if ("autoincrement__added" in it) {
const { autoincrement__added, ...others } = it;
return { ...others, autoincrement: { type: "added", value: it.autoincrement__added } };
}
if ("autoincrement__deleted" in it) {
const { autoincrement__deleted, ...others } = it;
return { ...others, autoincrement: { type: "deleted", value: it.autoincrement__deleted } };
}
return it;
});
return result[0];
};
}
});
// node_modules/.pnpm/ms@2.1.2/node_modules/ms/index.js
var require_ms = __commonJS({
"node_modules/.pnpm/ms@2.1.2/node_modules/ms/index.js"(exports, module2) {
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 parse(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 parse(str) {
str = String(str);
if (str.length > 100) {
return;
}
var match2 = /^(-?(?:\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 (!match2) {
return;
}
var n = parseFloat(match2[1]);
var type = (match2[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/.pnpm/debug@4.3.4/node_modules/debug/src/common.js
var require_common = __commonJS({
"node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/common.js"(exports, module2) {
function setup(env2) {
createDebug.debug = createDebug;
createDebug.default = createDebug;
createDebug.coerce = coerce2;
createDebug.disable = disable;
createDebug.enable = enable;
createDebug.enabled = enabled;
createDebug.humanize = require_ms();
createDebug.destroy = destroy;
Object.keys(env2).forEach((key) => {
createDebug[key] = env2[key];
});
createDebug.names = [];
createDebug.skips = [];
createDebug.formatters = {};
function selectColor(namespace) {
let hash = 0;
for (let i = 0; i < namespace.length; i++) {
hash = (hash << 5) - hash + namespace.charCodeAt(i);
hash |= 0;
}
return createDebug.colors[Math.abs(hash) % 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 index4 = 0;
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match2, format) => {
if (match2 === "%%") {
return "%";
}
index4++;
const formatter = createDebug.formatters[format];
if (typeof formatter === "function") {
const val = args[index4];
match2 = formatter.call(self2, val);
args.splice(index4, 1);
index4--;
}
return match2;
});
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 = extend;
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 extend(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 = [];
let i;
const split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/);
const len = split.length;
for (i = 0; i < len; i++) {
if (!split[i]) {
continue;
}
namespaces = split[i].replace(/\*/g, ".*?");
if (namespaces[0] === "-") {
createDebug.skips.push(new RegExp("^" + namespaces.slice(1) + "$"));
} else {
createDebug.names.push(new RegExp("^" + namespaces + "$"));
}
}
}
function disable() {
const namespaces = [
...createDebug.names.map(toNamespace),
...createDebug.skips.map(toNamespace).map((namespace) => "-" + namespace)
].join(",");
createDebug.enable("");
return namespaces;
}
function enabled(name) {
if (name[name.length - 1] === "*") {
return true;
}
let i;
let len;
for (i = 0, len = createDebug.skips.length; i < len; i++) {
if (createDebug.skips[i].test(name)) {
return false;
}
}
for (i = 0, len = createDebug.names.length; i < len; i++) {
if (createDebug.names[i].test(name)) {
return true;
}
}
return false;
}
function toNamespace(regexp) {
return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*");
}
function coerce2(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/.pnpm/debug@4.3.4/node_modules/debug/src/browser.js
var require_browser = __commonJS({
"node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/browser.js"(exports, module2) {
exports.formatArgs = formatArgs;
exports.save = save;
exports.load = load;
exports.useColors = useColors;
exports.storage = localstorage();
exports.destroy = (() => {
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`.");
}
};
})();
exports.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;
}
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 && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$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 c = "color: " + this.color;
args.splice(1, 0, c, "color: inherit");
let index4 = 0;
let lastC = 0;
args[0].replace(/%[a-zA-Z%]/g, (match2) => {
if (match2 === "%%") {
return;
}
index4++;
if (match2 === "%c") {
lastC = index4;
}
});
args.splice(lastC, 0, c);
}
exports.log = console.debug || console.log || (() => {
});
function save(namespaces) {
try {
if (namespaces) {
exports.storage.setItem("debug", namespaces);
} else {
exports.storage.removeItem("debug");
}
} catch (error2) {
}
}
function load() {
let r;
try {
r = exports.storage.getItem("debug");
} catch (error2) {
}
if (!r && typeof process !== "undefined" && "env" in process) {
r = process.env.DEBUG;
}
return r;
}
function localstorage() {
try {
return localStorage;
} catch (error2) {
}
}
module2.exports = require_common()(exports);
var { formatters } = module2.exports;
formatters.j = function(v) {
try {
return JSON.stringify(v);
} catch (error2) {
return "[UnexpectedJSONParseError]: " + error2.message;
}
};
}
});
// node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js
var require_has_flag = __commonJS({
"node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js"(exports, 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/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js
var require_supports_color = __commonJS({
"node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js"(exports, module2) {
"use strict";
var os2 = require("os");
var tty2 = require("tty");
var hasFlag2 = require_has_flag();
var { env: env2 } = process;
var forceColor;
if (hasFlag2("no-color") || hasFlag2("no-colors") || hasFlag2("color=false") || hasFlag2("color=never")) {
forceColor = 0;
} else if (hasFlag2("color") || hasFlag2("colors") || hasFlag2("color=true") || hasFlag2("color=always")) {
forceColor = 1;
}
if ("FORCE_COLOR" in env2) {
if (env2.FORCE_COLOR === "true") {
forceColor = 1;
} else if (env2.FORCE_COLOR === "false") {
forceColor = 0;
} else {
forceColor = env2.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env2.FORCE_COLOR, 10), 3);
}
}
function translateLevel2(level) {
if (level === 0) {
return false;
}
return {
level,
hasBasic: true,
has256: level >= 2,
has16m: level >= 3
};
}
function supportsColor2(haveStream, streamIsTTY) {
if (forceColor === 0) {
return 0;
}
if (hasFlag2("color=16m") || hasFlag2("color=full") || hasFlag2("color=truecolor")) {
return 3;
}
if (hasFlag2("color=256")) {
return 2;
}
if (haveStream && !streamIsTTY && forceColor === void 0) {
return 0;
}
const min = forceColor || 0;
if (env2.TERM === "dumb") {
return min;
}
if (process.platform === "win32") {
const osRelease = os2.release().split(".");
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
return Number(osRelease[2]) >= 14931 ? 3 : 2;
}
return 1;
}
if ("CI" in env2) {
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => sign in env2) || env2.CI_NAME === "codeship") {
return 1;
}
return min;
}
if ("TEAMCITY_VERSION" in env2) {
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env2.TEAMCITY_VERSION) ? 1 : 0;
}
if (env2.COLORTERM === "truecolor") {
return 3;
}
if ("TERM_PROGRAM" in env2) {
const version2 = parseInt((env2.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
switch (env2.TERM_PROGRAM) {
case "iTerm.app":
return version2 >= 3 ? 3 : 2;
case "Apple_Terminal":
return 2;
}
}
if (/-256(color)?$/i.test(env2.TERM)) {
return 2;
}
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env2.TERM)) {
return 1;
}
if ("COLORTERM" in env2) {
return 1;
}
return min;
}
function getSupportLevel(stream) {
const level = supportsColor2(stream, stream && stream.isTTY);
return translateLevel2(level);
}
module2.exports = {
supportsColor: getSupportLevel,
stdout: translateLevel2(supportsColor2(true, tty2.isatty(1))),
stderr: translateLevel2(supportsColor2(true, tty2.isatty(2)))
};
}
});
// node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/node.js
var require_node = __commonJS({
"node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/node.js"(exports, module2) {
var tty2 = require("tty");
var util2 = require("util");
exports.init = init;
exports.log = log;
exports.formatArgs = formatArgs;
exports.save = save;
exports.load = load;
exports.useColors = useColors;
exports.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`."
);
exports.colors = [6, 2, 3, 4, 5, 1];
try {
const supportsColor2 = require_supports_color();
if (supportsColor2 && (supportsColor2.stderr || supportsColor2).level >= 2) {
exports.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 (error2) {
}
exports.inspectOpts = Object.keys(process.env).filter((key) => {
return /^debug_/i.test(key);
}).reduce((obj, key) => {
const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
return k.toUpperCase();
});
let val = process.env[key];
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 exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty2.isatty(process.stderr.fd);
}
function formatArgs(args) {
const { namespace: name, useColors: useColors2 } = this;
if (useColors2) {
const c = this.color;
const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
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 (exports.inspectOpts.hideDate) {
return "";
}
return (/* @__PURE__ */ new Date()).toISOString() + " ";
}
function log(...args) {
return process.stderr.write(util2.format(...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(exports.inspectOpts);
for (let i = 0; i < keys.length; i++) {
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
}
}
module2.exports = require_common()(exports);
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/.pnpm/debug@4.3.4/node_modules/debug/src/index.js
var require_src2 = __commonJS({
"node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/index.js"(exports, module2) {
if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
module2.exports = require_browser();
} else {
module2.exports = require_node();
}
}
});
// node_modules/.pnpm/esbuild-register@3.4.2_esbuild@0.18.6/node_modules/esbuild-register/dist/node.js
var require_node2 = __commonJS({
"node_modules/.pnpm/esbuild-register@3.4.2_esbuild@0.18.6/node_modules/esbuild-register/dist/node.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function _interopRequireDefault2(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
var __create2 = Object.create;
var __defProp2 = Object.defineProperty;
var __getProtoOf2 = Object.getPrototypeOf;
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
var __getOwnPropNames2 = Object.getOwnPropertyNames;
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
var __markAsModule = (target) => __defProp2(target, "__esModule", { value: true });
var __commonJS2 = (callback, module22) => () => {
if (!module22) {
module22 = { exports: {} };
callback(module22.exports, module22);
}
return module22.exports;
};
var __exportStar = (target, module22, desc) => {
if (module22 && typeof module22 === "object" || typeof module22 === "function") {
for (let key of __getOwnPropNames2(module22))
if (!__hasOwnProp2.call(target, key) && key !== "default")
__defProp2(target, key, { get: () => module22[key], enumerable: !(desc = __getOwnPropDesc2(module22, key)) || desc.enumerable });
}
return target;
};
var __toModule = (module22) => {
return __exportStar(__markAsModule(__defProp2(module22 != null ? __create2(__getProtoOf2(module22)) : {}, "default", module22 && module22.__esModule && "default" in module22 ? { get: () => module22.default, enumerable: true } : { value: module22, enumerable: true })), module22);
};
var require_base64 = __commonJS2((exports2) => {
var intToCharMap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
exports2.encode = function(number) {
if (0 <= number && number < intToCharMap.length) {
return intToCharMap[number];
}
throw new TypeError("Must be between 0 and 63: " + number);
};
exports2.decode = function(charCode) {
var bigA = 65;
var bigZ = 90;
var littleA = 97;
var littleZ = 122;
var zero = 48;
var nine = 57;
var plus = 43;
var slash = 47;
var littleOffset = 26;
var numberOffset = 52;
if (bigA <= charCode && charCode <= bigZ) {
return charCode - bigA;
}
if (littleA <= charCode && charCode <= littleZ) {
return charCode - littleA + littleOffset;
}
if (zero <= charCode && charCode <= nine) {
return charCode - zero + numberOffset;
}
if (charCode == plus) {
return 62;
}
if (charCode == slash) {
return 63;
}
return -1;
};
});
var require_base64_vlq = __commonJS2((exports2) => {
var base64 = require_base64();
var VLQ_BASE_SHIFT = 5;
var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
var VLQ_BASE_MASK = VLQ_BASE - 1;
var VLQ_CONTINUATION_BIT = VLQ_BASE;
function toVLQSigned(aValue) {
return aValue < 0 ? (-aValue << 1) + 1 : (aValue << 1) + 0;
}
function fromVLQSigned(aValue) {
var isNegative = (aValue & 1) === 1;
var shifted = aValue >> 1;
return isNegative ? -shifted : shifted;
}
exports2.encode = function base64VLQ_encode(aValue) {
var encoded = "";
var digit;
var vlq = toVLQSigned(aValue);
do {
digit = vlq & VLQ_BASE_MASK;
vlq >>>= VLQ_BASE_SHIFT;
if (vlq > 0) {
digit |= VLQ_CONTINUATION_BIT;
}
encoded += base64.encode(digit);
} while (vlq > 0);
return encoded;
};
exports2.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
var strLen = aStr.length;
var result = 0;
var shift = 0;
var continuation, digit;
do {
if (aIndex >= strLen) {
throw new Error("Expected more digits in base 64 VLQ value.");
}
digit = base64.decode(aStr.charCodeAt(aIndex++));
if (digit === -1) {
throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
}
continuation = !!(digit & VLQ_CONTINUATION_BIT);
digit &= VLQ_BASE_MASK;
result = result + (digit << shift);
shift += VLQ_BASE_SHIFT;
} while (continuation);
aOutParam.value = fromVLQSigned(result);
aOutParam.rest = aIndex;
};
});
var require_util = __commonJS2((exports2) => {
function getArg(aArgs, aName, aDefaultValue) {
if (aName in aArgs) {
return aArgs[aName];
} else if (arguments.length === 3) {
return aDefaultValue;
} else {
throw new Error('"' + aName + '" is a required argument.');
}
}
exports2.getArg = getArg;
var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
var dataUrlRegexp = /^data:.+\,.+$/;
function urlParse(aUrl) {
var match2 = aUrl.match(urlRegexp);
if (!match2) {
return null;
}
return {
scheme: match2[1],
auth: match2[2],
host: match2[3],
port: match2[4],
path: match2[5]
};
}
exports2.urlParse = urlParse;
function urlGenerate(aParsedUrl) {
var url = "";
if (aParsedUrl.scheme) {
url += aParsedUrl.scheme + ":";
}
url += "//";
if (aParsedUrl.auth) {
url += aParsedUrl.auth + "@";
}
if (aParsedUrl.host) {
url += aParsedUrl.host;
}
if (aParsedUrl.port) {
url += ":" + aParsedUrl.port;
}
if (aParsedUrl.path) {
url += aParsedUrl.path;
}
return url;
}
exports2.urlGenerate = urlGenerate;
function normalize(aPath) {
var path3 = aPath;
var url = urlParse(aPath);
if (url) {
if (!url.path) {
return aPath;
}
path3 = url.path;
}
var isAbsolute = exports2.isAbsolute(path3);
var parts = path3.split(/\/+/);
for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
part = parts[i];
if (part === ".") {
parts.splice(i, 1);
} else if (part === "..") {
up++;
} else if (up > 0) {
if (part === "") {
parts.splice(i + 1, up);
up = 0;
} else {
parts.splice(i, 2);
up--;
}
}
}
path3 = parts.join("/");
if (path3 === "") {
path3 = isAbsolute ? "/" : ".";
}
if (url) {
url.path = path3;
return urlGenerate(url);
}
return path3;
}
exports2.normalize = normalize;
function join22(aRoot, aPath) {
if (aRoot === "") {
aRoot = ".";
}
if (aPath === "") {
aPath = ".";
}
var aPathUrl = urlParse(aPath);
var aRootUrl = urlParse(aRoot);
if (aRootUrl) {
aRoot = aRootUrl.path || "/";
}
if (aPathUrl && !aPathUrl.scheme) {
if (aRootUrl) {
aPathUrl.scheme = aRootUrl.scheme;
}
return urlGenerate(aPathUrl);
}
if (aPathUrl || aPath.match(dataUrlRegexp)) {
return aPath;
}
if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
aRootUrl.host = aPath;
return urlGenerate(aRootUrl);
}
var joined = aPath.charAt(0) === "/" ? aPath : normalize(aRoot.replace(/\/+$/, "") + "/" + aPath);
if (aRootUrl) {
aRootUrl.path = joined;
return urlGenerate(aRootUrl);
}
return joined;
}
exports2.join = join22;
exports2.isAbsolute = function(aPath) {
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
};
function relative(aRoot, aPath) {
if (aRoot === "") {
aRoot = ".";
}
aRoot = aRoot.replace(/\/$/, "");
var level = 0;
while (aPath.indexOf(aRoot + "/") !== 0) {
var index4 = aRoot.lastIndexOf("/");
if (index4 < 0) {
return aPath;
}
aRoot = aRoot.slice(0, index4);
if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
return aPath;
}
++level;
}
return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
}
exports2.relative = relative;
var supportsNullProto = function() {
var obj = /* @__PURE__ */ Object.create(null);
return !("__proto__" in obj);
}();
function identity(s) {
return s;
}
function toSetString(aStr) {
if (isProtoString(aStr)) {
return "$" + aStr;
}
return aStr;
}
exports2.toSetString = supportsNullProto ? identity : toSetString;
function fromSetString(aStr) {
if (isProtoString(aStr)) {
return aStr.slice(1);
}
return aStr;
}
exports2.fromSetString = supportsNullProto ? identity : fromSetString;
function isProtoString(s) {
if (!s) {
return false;
}
var length = s.length;
if (length < 9) {
return false;
}
if (s.charCodeAt(length - 1) !== 95 || s.charCodeAt(length - 2) !== 95 || s.charCodeAt(length - 3) !== 111 || s.charCodeAt(length - 4) !== 116 || s.charCodeAt(length - 5) !== 111 || s.charCodeAt(length - 6) !== 114 || s.charCodeAt(length - 7) !== 112 || s.charCodeAt(length - 8) !== 95 || s.charCodeAt(length - 9) !== 95) {
return false;
}
for (var i = length - 10; i >= 0; i--) {
if (s.charCodeAt(i) !== 36) {
return false;
}
}
return true;
}
function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
var cmp = strcmp(mappingA.source, mappingB.source);
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalLine - mappingB.originalLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalColumn - mappingB.originalColumn;
if (cmp !== 0 || onlyCompareOriginal) {
return cmp;
}
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.generatedLine - mappingB.generatedLine;
if (cmp !== 0) {
return cmp;
}
return strcmp(mappingA.name, mappingB.name);
}
exports2.compareByOriginalPositions = compareByOriginalPositions;
function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
var cmp = mappingA.generatedLine - mappingB.generatedLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
if (cmp !== 0 || onlyCompareGenerated) {
return cmp;
}
cmp = strcmp(mappingA.source, mappingB.source);
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalLine - mappingB.originalLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalColumn - mappingB.originalColumn;
if (cmp !== 0) {
return cmp;
}
return strcmp(mappingA.name, mappingB.name);
}
exports2.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
function strcmp(aStr1, aStr2) {
if (aStr1 === aStr2) {
return 0;
}
if (aStr1 === null) {
return 1;
}
if (aStr2 === null) {
return -1;
}
if (aStr1 > aStr2) {
return 1;
}
return -1;
}
function compareByGeneratedPositionsInflated(mappingA, mappingB) {
var cmp = mappingA.generatedLine - mappingB.generatedLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
if (cmp !== 0) {
return cmp;
}
cmp = strcmp(mappingA.source, mappingB.source);
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalLine - mappingB.originalLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalColumn - mappingB.originalColumn;
if (cmp !== 0) {
return cmp;
}
return strcmp(mappingA.name, mappingB.name);
}
exports2.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
function parseSourceMapInput(str) {
return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ""));
}
exports2.parseSourceMapInput = parseSourceMapInput;
function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
sourceURL = sourceURL || "";
if (sourceRoot) {
if (sourceRoot[sourceRoot.length - 1] !== "/" && sourceURL[0] !== "/") {
sourceRoot += "/";
}
sourceURL = sourceRoot + sourceURL;
}
if (sourceMapURL) {
var parsed = urlParse(sourceMapURL);
if (!parsed) {
throw new Error("sourceMapURL could not be parsed");
}
if (parsed.path) {
var index4 = parsed.path.lastIndexOf("/");
if (index4 >= 0) {
parsed.path = parsed.path.substring(0, index4 + 1);
}
}
sourceURL = join22(urlGenerate(parsed), sourceURL);
}
return normalize(sourceURL);
}
exports2.computeSourceURL = computeSourceURL;
});
var require_array_set = __commonJS2((exports2) => {
var util2 = require_util();
var has = Object.prototype.hasOwnProperty;
var hasNativeMap = typeof Map !== "undefined";
function ArraySet() {
this._array = [];
this._set = hasNativeMap ? /* @__PURE__ */ new Map() : /* @__PURE__ */ Object.create(null);
}
ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
var set = new ArraySet();
for (var i = 0, len = aArray.length; i < len; i++) {
set.add(aArray[i], aAllowDuplicates);
}
return set;
};
ArraySet.prototype.size = function ArraySet_size() {
return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
};
ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
var sStr = hasNativeMap ? aStr : util2.toSetString(aStr);
var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
var idx = this._array.length;
if (!isDuplicate || aAllowDuplicates) {
this._array.push(aStr);
}
if (!isDuplicate) {
if (hasNativeMap) {
this._set.set(aStr, idx);
} else {
this._set[sStr] = idx;
}
}
};
ArraySet.prototype.has = function ArraySet_has(aStr) {
if (hasNativeMap) {
return this._set.has(aStr);
} else {
var sStr = util2.toSetString(aStr);
return has.call(this._set, sStr);
}
};
ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
if (hasNativeMap) {
var idx = this._set.get(aStr);
if (idx >= 0) {
return idx;
}
} else {
var sStr = util2.toSetString(aStr);
if (has.call(this._set, sStr)) {
return this._set[sStr];
}
}
throw new Error('"' + aStr + '" is not in the set.');
};
ArraySet.prototype.at = function ArraySet_at(aIdx) {
if (aIdx >= 0 && aIdx < this._array.length) {
return this._array[aIdx];
}
throw new Error("No element indexed by " + aIdx);
};
ArraySet.prototype.toArray = function ArraySet_toArray() {
return this._array.slice();
};
exports2.ArraySet = ArraySet;
});
var require_mapping_list = __commonJS2((exports2) => {
var util2 = require_util();
function generatedPositionAfter(mappingA, mappingB) {
var lineA = mappingA.generatedLine;
var lineB = mappingB.generatedLine;
var columnA = mappingA.generatedColumn;
var columnB = mappingB.generatedColumn;
return lineB > lineA || lineB == lineA && columnB >= columnA || util2.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
}
function MappingList() {
this._array = [];
this._sorted = true;
this._last = { generatedLine: -1, generatedColumn: 0 };
}
MappingList.prototype.unsortedForEach = function MappingList_forEach(aCallback, aThisArg) {
this._array.forEach(aCallback, aThisArg);
};
MappingList.prototype.add = function MappingList_add(aMapping) {
if (generatedPositionAfter(this._last, aMapping)) {
this._last = aMapping;
this._array.push(aMapping);
} else {
this._sorted = false;
this._array.push(aMapping);
}
};
MappingList.prototype.toArray = function MappingList_toArray() {
if (!this._sorted) {
this._array.sort(util2.compareByGeneratedPositionsInflated);
this._sorted = true;
}
return this._array;
};
exports2.MappingList = MappingList;
});
var require_source_map_generator = __commonJS2((exports2) => {
var base64VLQ = require_base64_vlq();
var util2 = require_util();
var ArraySet = require_array_set().ArraySet;
var MappingList = require_mapping_list().MappingList;
function SourceMapGenerator(aArgs) {
if (!aArgs) {
aArgs = {};
}
this._file = util2.getArg(aArgs, "file", null);
this._sourceRoot = util2.getArg(aArgs, "sourceRoot", null);
this._skipValidation = util2.getArg(aArgs, "skipValidation", false);
this._sources = new ArraySet();
this._names = new ArraySet();
this._mappings = new MappingList();
this._sourcesContents = null;
}
SourceMapGenerator.prototype._version = 3;
SourceMapGenerator.fromSourceMap = function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
var sourceRoot = aSourceMapConsumer.sourceRoot;
var generator = new SourceMapGenerator({
file: aSourceMapConsumer.file,
sourceRoot
});
aSourceMapConsumer.eachMapping(function(mapping) {
var newMapping = {
generated: {
line: mapping.generatedLine,
column: mapping.generatedColumn
}
};
if (mapping.source != null) {
newMapping.source = mapping.source;
if (sourceRoot != null) {
newMapping.source = util2.relative(sourceRoot, newMapping.source);
}
newMapping.original = {
line: mapping.originalLine,
column: mapping.originalColumn
};
if (mapping.name != null) {
newMapping.name = mapping.name;
}
}
generator.addMapping(newMapping);
});
aSourceMapConsumer.sources.forEach(function(sourceFile) {
var sourceRelative = sourceFile;
if (sourceRoot !== null) {
sourceRelative = util2.relative(sourceRoot, sourceFile);
}
if (!generator._sources.has(sourceRelative)) {
generator._sources.add(sourceRelative);
}
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content != null) {
generator.setSourceContent(sourceFile, content);
}
});
return generator;
};
SourceMapGenerator.prototype.addMapping = function SourceMapGenerator_addMapping(aArgs) {
var generated = util2.getArg(aArgs, "generated");
var original = util2.getArg(aArgs, "original", null);
var source = util2.getArg(aArgs, "source", null);
var name = util2.getArg(aArgs, "name", null);
if (!this._skipValidation) {
this._validateMapping(generated, original, source, name);
}
if (source != null) {
source = String(source);
if (!this._sources.has(source)) {
this._sources.add(source);
}
}
if (name != null) {
name = String(name);
if (!this._names.has(name)) {
this._names.add(name);
}
}
this._mappings.add({
generatedLine: generated.line,
generatedColumn: generated.column,
originalLine: original != null && original.line,
originalColumn: original != null && original.column,
source,
name
});
};
SourceMapGenerator.prototype.setSourceContent = function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
var source = aSourceFile;
if (this._sourceRoot != null) {
source = util2.relative(this._sourceRoot, source);
}
if (aSourceContent != null) {
if (!this._sourcesContents) {
this._sourcesContents = /* @__PURE__ */ Object.create(null);
}
this._sourcesContents[util2.toSetString(source)] = aSourceContent;
} else if (this._sourcesContents) {
delete this._sourcesContents[util2.toSetString(source)];
if (Object.keys(this._sourcesContents).length === 0) {
this._sourcesContents = null;
}
}
};
SourceMapGenerator.prototype.applySourceMap = function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
var sourceFile = aSourceFile;
if (aSourceFile == null) {
if (aSourceMapConsumer.file == null) {
throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);
}
sourceFile = aSourceMapConsumer.file;
}
var sourceRoot = this._sourceRoot;
if (sourceRoot != null) {
sourceFile = util2.relative(sourceRoot, sourceFile);
}
var newSources = new ArraySet();
var newNames = new ArraySet();
this._mappings.unsortedForEach(function(mapping) {
if (mapping.source === sourceFile && mapping.originalLine != null) {
var original = aSourceMapConsumer.originalPositionFor({
line: mapping.originalLine,
column: mapping.originalColumn
});
if (original.source != null) {
mapping.source = original.source;
if (aSourceMapPath != null) {
mapping.source = util2.join(aSourceMapPath, mapping.source);
}
if (sourceRoot != null) {
mapping.source = util2.relative(sourceRoot, mapping.source);
}
mapping.originalLine = original.line;
mapping.originalColumn = original.column;
if (original.name != null) {
mapping.name = original.name;
}
}
}
var source = mapping.source;
if (source != null && !newSources.has(source)) {
newSources.add(source);
}
var name = mapping.name;
if (name != null && !newNames.has(name)) {
newNames.add(name);
}
}, this);
this._sources = newSources;
this._names = newNames;
aSourceMapConsumer.sources.forEach(function(sourceFile2) {
var content = aSourceMapConsumer.sourceContentFor(sourceFile2);
if (content != null) {
if (aSourceMapPath != null) {
sourceFile2 = util2.join(aSourceMapPath, sourceFile2);
}
if (sourceRoot != null) {
sourceFile2 = util2.relative(sourceRoot, sourceFile2);
}
this.setSourceContent(sourceFile2, content);
}
}, this);
};
SourceMapGenerator.prototype._validateMapping = function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, aName) {
if (aOriginal && typeof aOriginal.line !== "number" && typeof aOriginal.column !== "number") {
throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");
}
if (aGenerated && "line" in aGenerated && "column" in aGenerated && aGenerated.line > 0 && aGenerated.column >= 0 && !aOriginal && !aSource && !aName) {
return;
} else if (aGenerated && "line" in aGenerated && "column" in aGenerated && aOriginal && "line" in aOriginal && "column" in aOriginal && aGenerated.line > 0 && aGenerated.column >= 0 && aOriginal.line > 0 && aOriginal.column >= 0 && aSource) {
return;
} else {
throw new Error("Invalid mapping: " + JSON.stringify({
generated: aGenerated,
source: aSource,
original: aOriginal,
name: aName
}));
}
};
SourceMapGenerator.prototype._serializeMappings = function SourceMapGenerator_serializeMappings() {
var previousGeneratedColumn = 0;
var previousGeneratedLine = 1;
var previousOriginalColumn = 0;
var previousOriginalLine = 0;
var previousName = 0;
var previousSource = 0;
var result = "";
var next;
var mapping;
var nameIdx;
var sourceIdx;
var mappings = this._mappings.toArray();
for (var i = 0, len = mappings.length; i < len; i++) {
mapping = mappings[i];
next = "";
if (mapping.generatedLine !== previousGeneratedLine) {
previousGeneratedColumn = 0;
while (mapping.generatedLine !== previousGeneratedLine) {
next += ";";
previousGeneratedLine++;
}
} else {
if (i > 0) {
if (!util2.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
continue;
}
next += ",";
}
}
next += base64VLQ.encode(mapping.generatedColumn - previousGeneratedColumn);
previousGeneratedColumn = mapping.generatedColumn;
if (mapping.source != null) {
sourceIdx = this._sources.indexOf(mapping.source);
next += base64VLQ.encode(sourceIdx - previousSource);
previousSource = sourceIdx;
next += base64VLQ.encode(mapping.originalLine - 1 - previousOriginalLine);
previousOriginalLine = mapping.originalLine - 1;
next += base64VLQ.encode(mapping.originalColumn - previousOriginalColumn);
previousOriginalColumn = mapping.originalColumn;
if (mapping.name != null) {
nameIdx = this._names.indexOf(mapping.name);
next += base64VLQ.encode(nameIdx - previousName);
previousName = nameIdx;
}
}
result += next;
}
return result;
};
SourceMapGenerator.prototype._generateSourcesContent = function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
return aSources.map(function(source) {
if (!this._sourcesContents) {
return null;
}
if (aSourceRoot != null) {
source = util2.relative(aSourceRoot, source);
}
var key = util2.toSetString(source);
return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) ? this._sourcesContents[key] : null;
}, this);
};
SourceMapGenerator.prototype.toJSON = function SourceMapGenerator_toJSON() {
var map2 = {
version: this._version,
sources: this._sources.toArray(),
names: this._names.toArray(),
mappings: this._serializeMappings()
};
if (this._file != null) {
map2.file = this._file;
}
if (this._sourceRoot != null) {
map2.sourceRoot = this._sourceRoot;
}
if (this._sourcesContents) {
map2.sourcesContent = this._generateSourcesContent(map2.sources, map2.sourceRoot);
}
return map2;
};
SourceMapGenerator.prototype.toString = function SourceMapGenerator_toString() {
return JSON.stringify(this.toJSON());
};
exports2.SourceMapGenerator = SourceMapGenerator;
});
var require_binary_search = __commonJS2((exports2) => {
exports2.GREATEST_LOWER_BOUND = 1;
exports2.LEAST_UPPER_BOUND = 2;
function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
var mid = Math.floor((aHigh - aLow) / 2) + aLow;
var cmp = aCompare(aNeedle, aHaystack[mid], true);
if (cmp === 0) {
return mid;
} else if (cmp > 0) {
if (aHigh - mid > 1) {
return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
}
if (aBias == exports2.LEAST_UPPER_BOUND) {
return aHigh < aHaystack.length ? aHigh : -1;
} else {
return mid;
}
} else {
if (mid - aLow > 1) {
return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
}
if (aBias == exports2.LEAST_UPPER_BOUND) {
return mid;
} else {
return aLow < 0 ? -1 : aLow;
}
}
}
exports2.search = function search(aNeedle, aHaystack, aCompare, aBias) {
if (aHaystack.length === 0) {
return -1;
}
var index4 = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, aCompare, aBias || exports2.GREATEST_LOWER_BOUND);
if (index4 < 0) {
return -1;
}
while (index4 - 1 >= 0) {
if (aCompare(aHaystack[index4], aHaystack[index4 - 1], true) !== 0) {
break;
}
--index4;
}
return index4;
};
});
var require_quick_sort = __commonJS2((exports2) => {
function swap(ary, x, y) {
var temp = ary[x];
ary[x] = ary[y];
ary[y] = temp;
}
function randomIntInRange(low, high) {
return Math.round(low + Math.random() * (high - low));
}
function doQuickSort(ary, comparator, p, r) {
if (p < r) {
var pivotIndex = randomIntInRange(p, r);
var i = p - 1;
swap(ary, pivotIndex, r);
var pivot = ary[r];
for (var j = p; j < r; j++) {
if (comparator(ary[j], pivot) <= 0) {
i += 1;
swap(ary, i, j);
}
}
swap(ary, i + 1, j);
var q = i + 1;
doQuickSort(ary, comparator, p, q - 1);
doQuickSort(ary, comparator, q + 1, r);
}
}
exports2.quickSort = function(ary, comparator) {
doQuickSort(ary, comparator, 0, ary.length - 1);
};
});
var require_source_map_consumer = __commonJS2((exports2) => {
var util2 = require_util();
var binarySearch = require_binary_search();
var ArraySet = require_array_set().ArraySet;
var base64VLQ = require_base64_vlq();
var quickSort = require_quick_sort().quickSort;
function SourceMapConsumer(aSourceMap, aSourceMapURL) {
var sourceMap = aSourceMap;
if (typeof aSourceMap === "string") {
sourceMap = util2.parseSourceMapInput(aSourceMap);
}
return sourceMap.sections != null ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
}
SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) {
return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);
};
SourceMapConsumer.prototype._version = 3;
SourceMapConsumer.prototype.__generatedMappings = null;
Object.defineProperty(SourceMapConsumer.prototype, "_generatedMappings", {
configurable: true,
enumerable: true,
get: function() {
if (!this.__generatedMappings) {
this._parseMappings(this._mappings, this.sourceRoot);
}
return this.__generatedMappings;
}
});
SourceMapConsumer.prototype.__originalMappings = null;
Object.defineProperty(SourceMapConsumer.prototype, "_originalMappings", {
configurable: true,
enumerable: true,
get: function() {
if (!this.__originalMappings) {
this._parseMappings(this._mappings, this.sourceRoot);
}
return this.__originalMappings;
}
});
SourceMapConsumer.prototype._charIsMappingSeparator = function SourceMapConsumer_charIsMappingSeparator(aStr, index4) {
var c = aStr.charAt(index4);
return c === ";" || c === ",";
};
SourceMapConsumer.prototype._parseMappings = function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
throw new Error("Subclasses must implement _parseMappings");
};
SourceMapConsumer.GENERATED_ORDER = 1;
SourceMapConsumer.ORIGINAL_ORDER = 2;
SourceMapConsumer.GREATEST_LOWER_BOUND = 1;
SourceMapConsumer.LEAST_UPPER_BOUND = 2;
SourceMapConsumer.prototype.eachMapping = function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
var context = aContext || null;
var order = aOrder || SourceMapConsumer.GENERATED_ORDER;
var mappings;
switch (order) {
case SourceMapConsumer.GENERATED_ORDER:
mappings = this._generatedMappings;
break;
case SourceMapConsumer.ORIGINAL_ORDER:
mappings = this._originalMappings;
break;
default:
throw new Error("Unknown order of iteration.");
}
var sourceRoot = this.sourceRoot;
mappings.map(function(mapping) {
var source = mapping.source === null ? null : this._sources.at(mapping.source);
source = util2.computeSourceURL(sourceRoot, source, this._sourceMapURL);
return {
source,
generatedLine: mapping.generatedLine,
generatedColumn: mapping.generatedColumn,
originalLine: mapping.originalLine,
originalColumn: mapping.originalColumn,
name: mapping.name === null ? null : this._names.at(mapping.name)
};
}, this).forEach(aCallback, context);
};
SourceMapConsumer.prototype.allGeneratedPositionsFor = function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {
var line = util2.getArg(aArgs, "line");
var needle = {
source: util2.getArg(aArgs, "source"),
originalLine: line,
originalColumn: util2.getArg(aArgs, "column", 0)
};
needle.source = this._findSourceIndex(needle.source);
if (needle.source < 0) {
return [];
}
var mappings = [];
var index4 = this._findMapping(needle, this._originalMappings, "originalLine", "originalColumn", util2.compareByOriginalPositions, binarySearch.LEAST_UPPER_BOUND);
if (index4 >= 0) {
var mapping = this._originalMappings[index4];
if (aArgs.column === void 0) {
var originalLine = mapping.originalLine;
while (mapping && mapping.originalLine === originalLine) {
mappings.push({
line: util2.getArg(mapping, "generatedLine", null),
column: util2.getArg(mapping, "generatedColumn", null),
lastColumn: util2.getArg(mapping, "lastGeneratedColumn", null)
});
mapping = this._originalMappings[++index4];
}
} else {
var originalColumn = mapping.originalColumn;
while (mapping && mapping.originalLine === line && mapping.originalColumn == originalColumn) {
mappings.push({
line: util2.getArg(mapping, "generatedLine", null),
column: util2.getArg(mapping, "generatedColumn", null),
lastColumn: util2.getArg(mapping, "lastGeneratedColumn", null)
});
mapping = this._originalMappings[++index4];
}
}
}
return mappings;
};
exports2.SourceMapConsumer = SourceMapConsumer;
function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
var sourceMap = aSourceMap;
if (typeof aSourceMap === "string") {
sourceMap = util2.parseSourceMapInput(aSourceMap);
}
var version2 = util2.getArg(sourceMap, "version");
var sources = util2.getArg(sourceMap, "sources");
var names = util2.getArg(sourceMap, "names", []);
var sourceRoot = util2.getArg(sourceMap, "sourceRoot", null);
var sourcesContent = util2.getArg(sourceMap, "sourcesContent", null);
var mappings = util2.getArg(sourceMap, "mappings");
var file = util2.getArg(sourceMap, "file", null);
if (version2 != this._version) {
throw new Error("Unsupported version: " + version2);
}
if (sourceRoot) {
sourceRoot = util2.normalize(sourceRoot);
}
sources = sources.map(String).map(util2.normalize).map(function(source) {
return sourceRoot && util2.isAbsolute(sourceRoot) && util2.isAbsolute(source) ? util2.relative(sourceRoot, source) : source;
});
this._names = ArraySet.fromArray(names.map(String), true);
this._sources = ArraySet.fromArray(sources, true);
this._absoluteSources = this._sources.toArray().map(function(s) {
return util2.computeSourceURL(sourceRoot, s, aSourceMapURL);
});
this.sourceRoot = sourceRoot;
this.sourcesContent = sourcesContent;
this._mappings = mappings;
this._sourceMapURL = aSourceMapURL;
this.file = file;
}
BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;
BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) {
var relativeSource = aSource;
if (this.sourceRoot != null) {
relativeSource = util2.relative(this.sourceRoot, relativeSource);
}
if (this._sources.has(relativeSource)) {
return this._sources.indexOf(relativeSource);
}
var i;
for (i = 0; i < this._absoluteSources.length; ++i) {
if (this._absoluteSources[i] == aSource) {
return i;
}
}
return -1;
};
BasicSourceMapConsumer.fromSourceMap = function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) {
var smc = Object.create(BasicSourceMapConsumer.prototype);
var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);
smc.sourceRoot = aSourceMap._sourceRoot;
smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), smc.sourceRoot);
smc.file = aSourceMap._file;
smc._sourceMapURL = aSourceMapURL;
smc._absoluteSources = smc._sources.toArray().map(function(s) {
return util2.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);
});
var generatedMappings = aSourceMap._mappings.toArray().slice();
var destGeneratedMappings = smc.__generatedMappings = [];
var destOriginalMappings = smc.__originalMappings = [];
for (var i = 0, length = generatedMappings.length; i < length; i++) {
var srcMapping = generatedMappings[i];
var destMapping = new Mapping();
destMapping.generatedLine = srcMapping.generatedLine;
destMapping.generatedColumn = srcMapping.generatedColumn;
if (srcMapping.source) {
destMapping.source = sources.indexOf(srcMapping.source);
destMapping.originalLine = srcMapping.originalLine;
destMapping.originalColumn = srcMapping.originalColumn;
if (srcMapping.name) {
destMapping.name = names.indexOf(srcMapping.name);
}
destOriginalMappings.push(destMapping);
}
destGeneratedMappings.push(destMapping);
}
quickSort(smc.__originalMappings, util2.compareByOriginalPositions);
return smc;
};
BasicSourceMapConsumer.prototype._version = 3;
Object.defineProperty(BasicSourceMapConsumer.prototype, "sources", {
get: function() {
return this._absoluteSources.slice();
}
});
function Mapping() {
this.generatedLine = 0;
this.generatedColumn = 0;
this.source = null;
this.originalLine = null;
this.originalColumn = null;
this.name = null;
}
BasicSourceMapConsumer.prototype._parseMappings = function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
var generatedLine = 1;
var previousGeneratedColumn = 0;
var previousOriginalLine = 0;
var previousOriginalColumn = 0;
var previousSource = 0;
var previousName = 0;
var length = aStr.length;
var index4 = 0;
var cachedSegments = {};
var temp = {};
var originalMappings = [];
var generatedMappings = [];
var mapping, str, segment, end, value;
while (index4 < length) {
if (aStr.charAt(index4) === ";") {
generatedLine++;
index4++;
previousGeneratedColumn = 0;
} else if (aStr.charAt(index4) === ",") {
index4++;
} else {
mapping = new Mapping();
mapping.generatedLine = generatedLine;
for (end = index4; end < length; end++) {
if (this._charIsMappingSeparator(aStr, end)) {
break;
}
}
str = aStr.slice(index4, end);
segment = cachedSegments[str];
if (segment) {
index4 += str.length;
} else {
segment = [];
while (index4 < end) {
base64VLQ.decode(aStr, index4, temp);
value = temp.value;
index4 = temp.rest;
segment.push(value);
}
if (segment.length === 2) {
throw new Error("Found a source, but no line and column");
}
if (segment.length === 3) {
throw new Error("Found a source and line, but no column");
}
cachedSegments[str] = segment;
}
mapping.generatedColumn = previousGeneratedColumn + segment[0];
previousGeneratedColumn = mapping.generatedColumn;
if (segment.length > 1) {
mapping.source = previousSource + segment[1];
previousSource += segment[1];
mapping.originalLine = previousOriginalLine + segment[2];
previousOriginalLine = mapping.originalLine;
mapping.originalLine += 1;
mapping.originalColumn = previousOriginalColumn + segment[3];
previousOriginalColumn = mapping.originalColumn;
if (segment.length > 4) {
mapping.name = previousName + segment[4];
previousName += segment[4];
}
}
generatedMappings.push(mapping);
if (typeof mapping.originalLine === "number") {
originalMappings.push(mapping);
}
}
}
quickSort(generatedMappings, util2.compareByGeneratedPositionsDeflated);
this.__generatedMappings = generatedMappings;
quickSort(originalMappings, util2.compareByOriginalPositions);
this.__originalMappings = originalMappings;
};
BasicSourceMapConsumer.prototype._findMapping = function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, aColumnName, aComparator, aBias) {
if (aNeedle[aLineName] <= 0) {
throw new TypeError("Line must be greater than or equal to 1, got " + aNeedle[aLineName]);
}
if (aNeedle[aColumnName] < 0) {
throw new TypeError("Column must be greater than or equal to 0, got " + aNeedle[aColumnName]);
}
return binarySearch.search(aNeedle, aMappings, aComparator, aBias);
};
BasicSourceMapConsumer.prototype.computeColumnSpans = function SourceMapConsumer_computeColumnSpans() {
for (var index4 = 0; index4 < this._generatedMappings.length; ++index4) {
var mapping = this._generatedMappings[index4];
if (index4 + 1 < this._generatedMappings.length) {
var nextMapping = this._generatedMappings[index4 + 1];
if (mapping.generatedLine === nextMapping.generatedLine) {
mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;
continue;
}
}
mapping.lastGeneratedColumn = Infinity;
}
};
BasicSourceMapConsumer.prototype.originalPositionFor = function SourceMapConsumer_originalPositionFor(aArgs) {
var needle = {
generatedLine: util2.getArg(aArgs, "line"),
generatedColumn: util2.getArg(aArgs, "column")
};
var index4 = this._findMapping(needle, this._generatedMappings, "generatedLine", "generatedColumn", util2.compareByGeneratedPositionsDeflated, util2.getArg(aArgs, "bias", SourceMapConsumer.GREATEST_LOWER_BOUND));
if (index4 >= 0) {
var mapping = this._generatedMappings[index4];
if (mapping.generatedLine === needle.generatedLine) {
var source = util2.getArg(mapping, "source", null);
if (source !== null) {
source = this._sources.at(source);
source = util2.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);
}
var name = util2.getArg(mapping, "name", null);
if (name !== null) {
name = this._names.at(name);
}
return {
source,
line: util2.getArg(mapping, "originalLine", null),
column: util2.getArg(mapping, "originalColumn", null),
name
};
}
}
return {
source: null,
line: null,
column: null,
name: null
};
};
BasicSourceMapConsumer.prototype.hasContentsOfAllSources = function BasicSourceMapConsumer_hasContentsOfAllSources() {
if (!this.sourcesContent) {
return false;
}
return this.sourcesContent.length >= this._sources.size() && !this.sourcesContent.some(function(sc) {
return sc == null;
});
};
BasicSourceMapConsumer.prototype.sourceContentFor = function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
if (!this.sourcesContent) {
return null;
}
var index4 = this._findSourceIndex(aSource);
if (index4 >= 0) {
return this.sourcesContent[index4];
}
var relativeSource = aSource;
if (this.sourceRoot != null) {
relativeSource = util2.relative(this.sourceRoot, relativeSource);
}
var url;
if (this.sourceRoot != null && (url = util2.urlParse(this.sourceRoot))) {
var fileUriAbsPath = relativeSource.replace(/^file:\/\//, "");
if (url.scheme == "file" && this._sources.has(fileUriAbsPath)) {
return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)];
}
if ((!url.path || url.path == "/") && this._sources.has("/" + relativeSource)) {
return this.sourcesContent[this._sources.indexOf("/" + relativeSource)];
}
}
if (nullOnMissing) {
return null;
} else {
throw new Error('"' + relativeSource + '" is not in the SourceMap.');
}
};
BasicSourceMapConsumer.prototype.generatedPositionFor = function SourceMapConsumer_generatedPositionFor(aArgs) {
var source = util2.getArg(aArgs, "source");
source = this._findSourceIndex(source);
if (source < 0) {
return {
line: null,
column: null,
lastColumn: null
};
}
var needle = {
source,
originalLine: util2.getArg(aArgs, "line"),
originalColumn: util2.getArg(aArgs, "column")
};
var index4 = this._findMapping(needle, this._originalMappings, "originalLine", "originalColumn", util2.compareByOriginalPositions, util2.getArg(aArgs, "bias", SourceMapConsumer.GREATEST_LOWER_BOUND));
if (index4 >= 0) {
var mapping = this._originalMappings[index4];
if (mapping.source === needle.source) {
return {
line: util2.getArg(mapping, "generatedLine", null),
column: util2.getArg(mapping, "generatedColumn", null),
lastColumn: util2.getArg(mapping, "lastGeneratedColumn", null)
};
}
}
return {
line: null,
column: null,
lastColumn: null
};
};
exports2.BasicSourceMapConsumer = BasicSourceMapConsumer;
function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {
var sourceMap = aSourceMap;
if (typeof aSourceMap === "string") {
sourceMap = util2.parseSourceMapInput(aSourceMap);
}
var version2 = util2.getArg(sourceMap, "version");
var sections = util2.getArg(sourceMap, "sections");
if (version2 != this._version) {
throw new Error("Unsupported version: " + version2);
}
this._sources = new ArraySet();
this._names = new ArraySet();
var lastOffset = {
line: -1,
column: 0
};
this._sections = sections.map(function(s) {
if (s.url) {
throw new Error("Support for url field in sections not implemented.");
}
var offset = util2.getArg(s, "offset");
var offsetLine = util2.getArg(offset, "line");
var offsetColumn = util2.getArg(offset, "column");
if (offsetLine < lastOffset.line || offsetLine === lastOffset.line && offsetColumn < lastOffset.column) {
throw new Error("Section offsets must be ordered and non-overlapping.");
}
lastOffset = offset;
return {
generatedOffset: {
generatedLine: offsetLine + 1,
generatedColumn: offsetColumn + 1
},
consumer: new SourceMapConsumer(util2.getArg(s, "map"), aSourceMapURL)
};
});
}
IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;
IndexedSourceMapConsumer.prototype._version = 3;
Object.defineProperty(IndexedSourceMapConsumer.prototype, "sources", {
get: function() {
var sources = [];
for (var i = 0; i < this._sections.length; i++) {
for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {
sources.push(this._sections[i].consumer.sources[j]);
}
}
return sources;
}
});
IndexedSourceMapConsumer.prototype.originalPositionFor = function IndexedSourceMapConsumer_originalPositionFor(aArgs) {
var needle = {
generatedLine: util2.getArg(aArgs, "line"),
generatedColumn: util2.getArg(aArgs, "column")
};
var sectionIndex = binarySearch.search(needle, this._sections, function(needle2, section2) {
var cmp = needle2.generatedLine - section2.generatedOffset.generatedLine;
if (cmp) {
return cmp;
}
return needle2.generatedColumn - section2.generatedOffset.generatedColumn;
});
var section = this._sections[sectionIndex];
if (!section) {
return {
source: null,
line: null,
column: null,
name: null
};
}
return section.consumer.originalPositionFor({
line: needle.generatedLine - (section.generatedOffset.generatedLine - 1),
column: needle.generatedColumn - (section.generatedOffset.generatedLine === needle.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0),
bias: aArgs.bias
});
};
IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = function IndexedSourceMapConsumer_hasContentsOfAllSources() {
return this._sections.every(function(s) {
return s.consumer.hasContentsOfAllSources();
});
};
IndexedSourceMapConsumer.prototype.sourceContentFor = function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
for (var i = 0; i < this._sections.length; i++) {
var section = this._sections[i];
var content = section.consumer.sourceContentFor(aSource, true);
if (content) {
return content;
}
}
if (nullOnMissing) {
return null;
} else {
throw new Error('"' + aSource + '" is not in the SourceMap.');
}
};
IndexedSourceMapConsumer.prototype.generatedPositionFor = function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {
for (var i = 0; i < this._sections.length; i++) {
var section = this._sections[i];
if (section.consumer._findSourceIndex(util2.getArg(aArgs, "source")) === -1) {
continue;
}
var generatedPosition = section.consumer.generatedPositionFor(aArgs);
if (generatedPosition) {
var ret = {
line: generatedPosition.line + (section.generatedOffset.generatedLine - 1),
column: generatedPosition.column + (section.generatedOffset.generatedLine === generatedPosition.line ? section.generatedOffset.generatedColumn - 1 : 0)
};
return ret;
}
}
return {
line: null,
column: null
};
};
IndexedSourceMapConsumer.prototype._parseMappings = function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {
this.__generatedMappings = [];
this.__originalMappings = [];
for (var i = 0; i < this._sections.length; i++) {
var section = this._sections[i];
var sectionMappings = section.consumer._generatedMappings;
for (var j = 0; j < sectionMappings.length; j++) {
var mapping = sectionMappings[j];
var source = section.consumer._sources.at(mapping.source);
source = util2.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);
this._sources.add(source);
source = this._sources.indexOf(source);
var name = null;
if (mapping.name) {
name = section.consumer._names.at(mapping.name);
this._names.add(name);
name = this._names.indexOf(name);
}
var adjustedMapping = {
source,
generatedLine: mapping.generatedLine + (section.generatedOffset.generatedLine - 1),
generatedColumn: mapping.generatedColumn + (section.generatedOffset.generatedLine === mapping.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0),
originalLine: mapping.originalLine,
originalColumn: mapping.originalColumn,
name
};
this.__generatedMappings.push(adjustedMapping);
if (typeof adjustedMapping.originalLine === "number") {
this.__originalMappings.push(adjustedMapping);
}
}
}
quickSort(this.__generatedMappings, util2.compareByGeneratedPositionsDeflated);
quickSort(this.__originalMappings, util2.compareByOriginalPositions);
};
exports2.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
});
var require_source_node = __commonJS2((exports2) => {
var SourceMapGenerator = require_source_map_generator().SourceMapGenerator;
var util2 = require_util();
var REGEX_NEWLINE = /(\r?\n)/;
var NEWLINE_CODE = 10;
var isSourceNode = "$$$isSourceNode$$$";
function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
this.children = [];
this.sourceContents = {};
this.line = aLine == null ? null : aLine;
this.column = aColumn == null ? null : aColumn;
this.source = aSource == null ? null : aSource;
this.name = aName == null ? null : aName;
this[isSourceNode] = true;
if (aChunks != null)
this.add(aChunks);
}
SourceNode.fromStringWithSourceMap = function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
var node = new SourceNode();
var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
var remainingLinesIndex = 0;
var shiftNextLine = function() {
var lineContents = getNextLine();
var newLine = getNextLine() || "";
return lineContents + newLine;
function getNextLine() {
return remainingLinesIndex < remainingLines.length ? remainingLines[remainingLinesIndex++] : void 0;
}
};
var lastGeneratedLine = 1, lastGeneratedColumn = 0;
var lastMapping = null;
aSourceMapConsumer.eachMapping(function(mapping) {
if (lastMapping !== null) {
if (lastGeneratedLine < mapping.generatedLine) {
addMappingWithCode(lastMapping, shiftNextLine());
lastGeneratedLine++;
lastGeneratedColumn = 0;
} else {
var nextLine = remainingLines[remainingLinesIndex] || "";
var code = nextLine.substr(0, mapping.generatedColumn - lastGeneratedColumn);
remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - lastGeneratedColumn);
lastGeneratedColumn = mapping.generatedColumn;
addMappingWithCode(lastMapping, code);
lastMapping = mapping;
return;
}
}
while (lastGeneratedLine < mapping.generatedLine) {
node.add(shiftNextLine());
lastGeneratedLine++;
}
if (lastGeneratedColumn < mapping.generatedColumn) {
var nextLine = remainingLines[remainingLinesIndex] || "";
node.add(nextLine.substr(0, mapping.generatedColumn));
remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
lastGeneratedColumn = mapping.generatedColumn;
}
lastMapping = mapping;
}, this);
if (remainingLinesIndex < remainingLines.length) {
if (lastMapping) {
addMappingWithCode(lastMapping, shiftNextLine());
}
node.add(remainingLines.splice(remainingLinesIndex).join(""));
}
aSourceMapConsumer.sources.forEach(function(sourceFile) {
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content != null) {
if (aRelativePath != null) {
sourceFile = util2.join(aRelativePath, sourceFile);
}
node.setSourceContent(sourceFile, content);
}
});
return node;
function addMappingWithCode(mapping, code) {
if (mapping === null || mapping.source === void 0) {
node.add(code);
} else {
var source = aRelativePath ? util2.join(aRelativePath, mapping.source) : mapping.source;
node.add(new SourceNode(mapping.originalLine, mapping.originalColumn, source, code, mapping.name));
}
}
};
SourceNode.prototype.add = function SourceNode_add(aChunk) {
if (Array.isArray(aChunk)) {
aChunk.forEach(function(chunk) {
this.add(chunk);
}, this);
} else if (aChunk[isSourceNode] || typeof aChunk === "string") {
if (aChunk) {
this.children.push(aChunk);
}
} else {
throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk);
}
return this;
};
SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
if (Array.isArray(aChunk)) {
for (var i = aChunk.length - 1; i >= 0; i--) {
this.prepend(aChunk[i]);
}
} else if (aChunk[isSourceNode] || typeof aChunk === "string") {
this.children.unshift(aChunk);
} else {
throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk);
}
return this;
};
SourceNode.prototype.walk = function SourceNode_walk(aFn) {
var chunk;
for (var i = 0, len = this.children.length; i < len; i++) {
chunk = this.children[i];
if (chunk[isSourceNode]) {
chunk.walk(aFn);
} else {
if (chunk !== "") {
aFn(chunk, {
source: this.source,
line: this.line,
column: this.column,
name: this.name
});
}
}
}
};
SourceNode.prototype.join = function SourceNode_join(aSep) {
var newChildren;
var i;
var len = this.children.length;
if (len > 0) {
newChildren = [];
for (i = 0; i < len - 1; i++) {
newChildren.push(this.children[i]);
newChildren.push(aSep);
}
newChildren.push(this.children[i]);
this.children = newChildren;
}
return this;
};
SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
var lastChild = this.children[this.children.length - 1];
if (lastChild[isSourceNode]) {
lastChild.replaceRight(aPattern, aReplacement);
} else if (typeof lastChild === "string") {
this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
} else {
this.children.push("".replace(aPattern, aReplacement));
}
return this;
};
SourceNode.prototype.setSourceContent = function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
this.sourceContents[util2.toSetString(aSourceFile)] = aSourceContent;
};
SourceNode.prototype.walkSourceContents = function SourceNode_walkSourceContents(aFn) {
for (var i = 0, len = this.children.length; i < len; i++) {
if (this.children[i][isSourceNode]) {
this.children[i].walkSourceContents(aFn);
}
}
var sources = Object.keys(this.sourceContents);
for (var i = 0, len = sources.length; i < len; i++) {
aFn(util2.fromSetString(sources[i]), this.sourceContents[sources[i]]);
}
};
SourceNode.prototype.toString = function SourceNode_toString() {
var str = "";
this.walk(function(chunk) {
str += chunk;
});
return str;
};
SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
var generated = {
code: "",
line: 1,
column: 0
};
var map2 = new SourceMapGenerator(aArgs);
var sourceMappingActive = false;
var lastOriginalSource = null;
var lastOriginalLine = null;
var lastOriginalColumn = null;
var lastOriginalName = null;
this.walk(function(chunk, original) {
generated.code += chunk;
if (original.source !== null && original.line !== null && original.column !== null) {
if (lastOriginalSource !== original.source || lastOriginalLine !== original.line || lastOriginalColumn !== original.column || lastOriginalName !== original.name) {
map2.addMapping({
source: original.source,
original: {
line: original.line,
column: original.column
},
generated: {
line: generated.line,
column: generated.column
},
name: original.name
});
}
lastOriginalSource = original.source;
lastOriginalLine = original.line;
lastOriginalColumn = original.column;
lastOriginalName = original.name;
sourceMappingActive = true;
} else if (sourceMappingActive) {
map2.addMapping({
generated: {
line: generated.line,
column: generated.column
}
});
lastOriginalSource = null;
sourceMappingActive = false;
}
for (var idx = 0, length = chunk.length; idx < length; idx++) {
if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
generated.line++;
generated.column = 0;
if (idx + 1 === length) {
lastOriginalSource = null;
sourceMappingActive = false;
} else if (sourceMappingActive) {
map2.addMapping({
source: original.source,
original: {
line: original.line,
column: original.column
},
generated: {
line: generated.line,
column: generated.column
},
name: original.name
});
}
} else {
generated.column++;
}
}
});
this.walkSourceContents(function(sourceFile, sourceContent) {
map2.setSourceContent(sourceFile, sourceContent);
});
return { code: generated.code, map: map2 };
};
exports2.SourceNode = SourceNode;
});
var require_source_map = __commonJS2((exports2) => {
exports2.SourceMapGenerator = require_source_map_generator().SourceMapGenerator;
exports2.SourceMapConsumer = require_source_map_consumer().SourceMapConsumer;
exports2.SourceNode = require_source_node().SourceNode;
});
var require_buffer_from = __commonJS2((exports2, module22) => {
var toString = Object.prototype.toString;
var isModern = typeof Buffer.alloc === "function" && typeof Buffer.allocUnsafe === "function" && typeof Buffer.from === "function";
function isArrayBuffer(input) {
return toString.call(input).slice(8, -1) === "ArrayBuffer";
}
function fromArrayBuffer(obj, byteOffset, length) {
byteOffset >>>= 0;
var maxLength = obj.byteLength - byteOffset;
if (maxLength < 0) {
throw new RangeError("'offset' is out of bounds");
}
if (length === void 0) {
length = maxLength;
} else {
length >>>= 0;
if (length > maxLength) {
throw new RangeError("'length' is out of bounds");
}
}
return isModern ? Buffer.from(obj.slice(byteOffset, byteOffset + length)) : new Buffer(new Uint8Array(obj.slice(byteOffset, byteOffset + length)));
}
function fromString(string, encoding) {
if (typeof encoding !== "string" || encoding === "") {
encoding = "utf8";
}
if (!Buffer.isEncoding(encoding)) {
throw new TypeError('"encoding" must be a valid string encoding');
}
return isModern ? Buffer.from(string, encoding) : new Buffer(string, encoding);
}
function bufferFrom(value, encodingOrOffset, length) {
if (typeof value === "number") {
throw new TypeError('"value" argument must not be a number');
}
if (isArrayBuffer(value)) {
return fromArrayBuffer(value, encodingOrOffset, length);
}
if (typeof value === "string") {
return fromString(value, encodingOrOffset);
}
return isModern ? Buffer.from(value) : new Buffer(value);
}
module22.exports = bufferFrom;
});
var require_source_map_support = __commonJS2((exports2, module22) => {
var SourceMapConsumer = require_source_map().SourceMapConsumer;
var path3 = require("path");
var fs32;
try {
fs32 = require("fs");
if (!fs32.existsSync || !fs32.readFileSync) {
fs32 = null;
}
} catch (err2) {
}
var bufferFrom = require_buffer_from();
function dynamicRequire(mod, request) {
return mod.require(request);
}
var errorFormatterInstalled = false;
var uncaughtShimInstalled = false;
var emptyCacheBetweenOperations = false;
var environment = "auto";
var fileContentsCache = {};
var sourceMapCache = {};
var reSourceMap = /^data:application\/json[^,]+base64,/;
var retrieveFileHandlers = [];
var retrieveMapHandlers = [];
function isInBrowser() {
if (environment === "browser")
return true;
if (environment === "node")
return false;
return typeof window !== "undefined" && typeof XMLHttpRequest === "function" && !(window.require && window.module && window.process && window.process.type === "renderer");
}
function hasGlobalProcessEventEmitter() {
return typeof process === "object" && process !== null && typeof process.on === "function";
}
function handlerExec(list) {
return function(arg) {
for (var i = 0; i < list.length; i++) {
var ret = list[i](arg);
if (ret) {
return ret;
}
}
return null;
};
}
var retrieveFile = handlerExec(retrieveFileHandlers);
retrieveFileHandlers.push(function(path22) {
path22 = path22.trim();
if (/^file:/.test(path22)) {
path22 = path22.replace(/file:\/\/\/(\w:)?/, function(protocol, drive) {
return drive ? "" : "/";
});
}
if (path22 in fileContentsCache) {
return fileContentsCache[path22];
}
var contents = "";
try {
if (!fs32) {
var xhr = new XMLHttpRequest();
xhr.open("GET", path22, false);
xhr.send(null);
if (xhr.readyState === 4 && xhr.status === 200) {
contents = xhr.responseText;
}
} else if (fs32.existsSync(path22)) {
contents = fs32.readFileSync(path22, "utf8");
}
} catch (er) {
}
return fileContentsCache[path22] = contents;
});
function supportRelativeURL(file, url) {
if (!file)
return url;
var dir = path3.dirname(file);
var match2 = /^\w+:\/\/[^\/]*/.exec(dir);
var protocol = match2 ? match2[0] : "";
var startPath = dir.slice(protocol.length);
if (protocol && /^\/\w\:/.test(startPath)) {
protocol += "/";
return protocol + path3.resolve(dir.slice(protocol.length), url).replace(/\\/g, "/");
}
return protocol + path3.resolve(dir.slice(protocol.length), url);
}
function retrieveSourceMapURL(source) {
var fileData;
if (isInBrowser()) {
try {
var xhr = new XMLHttpRequest();
xhr.open("GET", source, false);
xhr.send(null);
fileData = xhr.readyState === 4 ? xhr.responseText : null;
var sourceMapHeader = xhr.getResponseHeader("SourceMap") || xhr.getResponseHeader("X-SourceMap");
if (sourceMapHeader) {
return sourceMapHeader;
}
} catch (e) {
}
}
fileData = retrieveFile(source);
var re = /(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg;
var lastMatch, match2;
while (match2 = re.exec(fileData))
lastMatch = match2;
if (!lastMatch)
return null;
return lastMatch[1];
}
var retrieveSourceMap = handlerExec(retrieveMapHandlers);
retrieveMapHandlers.push(function(source) {
var sourceMappingURL = retrieveSourceMapURL(source);
if (!sourceMappingURL)
return null;
var sourceMapData;
if (reSourceMap.test(sourceMappingURL)) {
var rawData = sourceMappingURL.slice(sourceMappingURL.indexOf(",") + 1);
sourceMapData = bufferFrom(rawData, "base64").toString();
sourceMappingURL = source;
} else {
sourceMappingURL = supportRelativeURL(source, sourceMappingURL);
sourceMapData = retrieveFile(sourceMappingURL);
}
if (!sourceMapData) {
return null;
}
return {
url: sourceMappingURL,
map: sourceMapData
};
});
function mapSourcePosition(position) {
var sourceMap = sourceMapCache[position.source];
if (!sourceMap) {
var urlAndMap = retrieveSourceMap(position.source);
if (urlAndMap) {
sourceMap = sourceMapCache[position.source] = {
url: urlAndMap.url,
map: new SourceMapConsumer(urlAndMap.map)
};
if (sourceMap.map.sourcesContent) {
sourceMap.map.sources.forEach(function(source, i) {
var contents = sourceMap.map.sourcesContent[i];
if (contents) {
var url = supportRelativeURL(sourceMap.url, source);
fileContentsCache[url] = contents;
}
});
}
} else {
sourceMap = sourceMapCache[position.source] = {
url: null,
map: null
};
}
}
if (sourceMap && sourceMap.map && typeof sourceMap.map.originalPositionFor === "function") {
var originalPosition = sourceMap.map.originalPositionFor(position);
if (originalPosition.source !== null) {
originalPosition.source = supportRelativeURL(sourceMap.url, originalPosition.source);
return originalPosition;
}
}
return position;
}
function mapEvalOrigin(origin) {
var match2 = /^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(origin);
if (match2) {
var position = mapSourcePosition({
source: match2[2],
line: +match2[3],
column: match2[4] - 1
});
return "eval at " + match2[1] + " (" + position.source + ":" + position.line + ":" + (position.column + 1) + ")";
}
match2 = /^eval at ([^(]+) \((.+)\)$/.exec(origin);
if (match2) {
return "eval at " + match2[1] + " (" + mapEvalOrigin(match2[2]) + ")";
}
return origin;
}
function CallSiteToString() {
var fileName;
var fileLocation = "";
if (this.isNative()) {
fileLocation = "native";
} else {
fileName = this.getScriptNameOrSourceURL();
if (!fileName && this.isEval()) {
fileLocation = this.getEvalOrigin();
fileLocation += ", ";
}
if (fileName) {
fileLocation += fileName;
} else {
fileLocation += "<anonymous>";
}
var lineNumber = this.getLineNumber();
if (lineNumber != null) {
fileLocation += ":" + lineNumber;
var columnNumber = this.getColumnNumber();
if (columnNumber) {
fileLocation += ":" + columnNumber;
}
}
}
var line = "";
var functionName = this.getFunctionName();
var addSuffix = true;
var isConstructor = this.isConstructor();
var isMethodCall = !(this.isToplevel() || isConstructor);
if (isMethodCall) {
var typeName = this.getTypeName();
if (typeName === "[object Object]") {
typeName = "null";
}
var methodName = this.getMethodName();
if (functionName) {
if (typeName && functionName.indexOf(typeName) != 0) {
line += typeName + ".";
}
line += functionName;
if (methodName && functionName.indexOf("." + methodName) != functionName.length - methodName.length - 1) {
line += " [as " + methodName + "]";
}
} else {
line += typeName + "." + (methodName || "<anonymous>");
}
} else if (isConstructor) {
line += "new " + (functionName || "<anonymous>");
} else if (functionName) {
line += functionName;
} else {
line += fileLocation;
addSuffix = false;
}
if (addSuffix) {
line += " (" + fileLocation + ")";
}
return line;
}
function cloneCallSite(frame) {
var object = {};
Object.getOwnPropertyNames(Object.getPrototypeOf(frame)).forEach(function(name) {
object[name] = /^(?:is|get)/.test(name) ? function() {
return frame[name].call(frame);
} : frame[name];
});
object.toString = CallSiteToString;
return object;
}
function wrapCallSite(frame, state) {
if (state === void 0) {
state = { nextPosition: null, curPosition: null };
}
if (frame.isNative()) {
state.curPosition = null;
return frame;
}
var source = frame.getFileName() || frame.getScriptNameOrSourceURL();
if (source) {
var line = frame.getLineNumber();
var column7 = frame.getColumnNumber() - 1;
var noHeader = /^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/;
var headerLength = noHeader.test(process.version) ? 0 : 62;
if (line === 1 && column7 > headerLength && !isInBrowser() && !frame.isEval()) {
column7 -= headerLength;
}
var position = mapSourcePosition({
source,
line,
column: column7
});
state.curPosition = position;
frame = cloneCallSite(frame);
var originalFunctionName = frame.getFunctionName;
frame.getFunctionName = function() {
if (state.nextPosition == null) {
return originalFunctionName();
}
return state.nextPosition.name || originalFunctionName();
};
frame.getFileName = function() {
return position.source;
};
frame.getLineNumber = function() {
return position.line;
};
frame.getColumnNumber = function() {
return position.column + 1;
};
frame.getScriptNameOrSourceURL = function() {
return position.source;
};
return frame;
}
var origin = frame.isEval() && frame.getEvalOrigin();
if (origin) {
origin = mapEvalOrigin(origin);
frame = cloneCallSite(frame);
frame.getEvalOrigin = function() {
return origin;
};
return frame;
}
return frame;
}
function prepareStackTrace(error2, stack) {
if (emptyCacheBetweenOperations) {
fileContentsCache = {};
sourceMapCache = {};
}
var name = error2.name || "Error";
var message = error2.message || "";
var errorString = name + ": " + message;
var state = { nextPosition: null, curPosition: null };
var processedStack = [];
for (var i = stack.length - 1; i >= 0; i--) {
processedStack.push("\n at " + wrapCallSite(stack[i], state));
state.nextPosition = state.curPosition;
}
state.curPosition = state.nextPosition = null;
return errorString + processedStack.reverse().join("");
}
function getErrorSource(error2) {
var match2 = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(error2.stack);
if (match2) {
var source = match2[1];
var line = +match2[2];
var column7 = +match2[3];
var contents = fileContentsCache[source];
if (!contents && fs32 && fs32.existsSync(source)) {
try {
contents = fs32.readFileSync(source, "utf8");
} catch (er) {
contents = "";
}
}
if (contents) {
var code = contents.split(/(?:\r\n|\r|\n)/)[line - 1];
if (code) {
return source + ":" + line + "\n" + code + "\n" + new Array(column7).join(" ") + "^";
}
}
}
return null;
}
function printErrorAndExit(error2) {
var source = getErrorSource(error2);
if (process.stderr._handle && process.stderr._handle.setBlocking) {
process.stderr._handle.setBlocking(true);
}
if (source) {
console.error();
console.error(source);
}
console.error(error2.stack);
process.exit(1);
}
function shimEmitUncaughtException() {
var origEmit = process.emit;
process.emit = function(type) {
if (type === "uncaughtException") {
var hasStack = arguments[1] && arguments[1].stack;
var hasListeners = this.listeners(type).length > 0;
if (hasStack && !hasListeners) {
return printErrorAndExit(arguments[1]);
}
}
return origEmit.apply(this, arguments);
};
}
var originalRetrieveFileHandlers = retrieveFileHandlers.slice(0);
var originalRetrieveMapHandlers = retrieveMapHandlers.slice(0);
exports2.wrapCallSite = wrapCallSite;
exports2.getErrorSource = getErrorSource;
exports2.mapSourcePosition = mapSourcePosition;
exports2.retrieveSourceMap = retrieveSourceMap;
exports2.install = function(options) {
options = options || {};
if (options.environment) {
environment = options.environment;
if (["node", "browser", "auto"].indexOf(environment) === -1) {
throw new Error("environment " + environment + " was unknown. Available options are {auto, browser, node}");
}
}
if (options.retrieveFile) {
if (options.overrideRetrieveFile) {
retrieveFileHandlers.length = 0;
}
retrieveFileHandlers.unshift(options.retrieveFile);
}
if (options.retrieveSourceMap) {
if (options.overrideRetrieveSourceMap) {
retrieveMapHandlers.length = 0;
}
retrieveMapHandlers.unshift(options.retrieveSourceMap);
}
if (options.hookRequire && !isInBrowser()) {
var Module = dynamicRequire(module22, "module");
var $compile = Module.prototype._compile;
if (!$compile.__sourceMapSupport) {
Module.prototype._compile = function(content, filename) {
fileContentsCache[filename] = content;
sourceMapCache[filename] = void 0;
return $compile.call(this, content, filename);
};
Module.prototype._compile.__sourceMapSupport = true;
}
}
if (!emptyCacheBetweenOperations) {
emptyCacheBetweenOperations = "emptyCacheBetweenOperations" in options ? options.emptyCacheBetweenOperations : false;
}
if (!errorFormatterInstalled) {
errorFormatterInstalled = true;
Error.prepareStackTrace = prepareStackTrace;
}
if (!uncaughtShimInstalled) {
var installHandler = "handleUncaughtExceptions" in options ? options.handleUncaughtExceptions : true;
try {
var worker_threads = dynamicRequire(module22, "worker_threads");
if (worker_threads.isMainThread === false) {
installHandler = false;
}
} catch (e) {
}
if (installHandler && hasGlobalProcessEventEmitter()) {
uncaughtShimInstalled = true;
shimEmitUncaughtException();
}
}
};
exports2.resetRetrieveHandlers = function() {
retrieveFileHandlers.length = 0;
retrieveMapHandlers.length = 0;
retrieveFileHandlers = originalRetrieveFileHandlers.slice(0);
retrieveMapHandlers = originalRetrieveMapHandlers.slice(0);
retrieveSourceMap = handlerExec(retrieveMapHandlers);
retrieveFile = handlerExec(retrieveFileHandlers);
};
});
var require_node_modules_regexp = __commonJS2((exports2, module22) => {
"use strict";
module22.exports = /^(?:.*[\\\/])?node_modules(?:[\\\/].*)?$/;
});
var require_lib6 = __commonJS2((exports2, module22) => {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.addHook = addHook2;
var _module = _interopRequireDefault(require("module"));
var _path = _interopRequireDefault(require("path"));
var _nodeModulesRegexp = _interopRequireDefault(require_node_modules_regexp());
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
var Module = module22.constructor.length > 1 ? module22.constructor : _module.default;
var HOOK_RETURNED_NOTHING_ERROR_MESSAGE = "[Pirates] A hook returned a non-string, or nothing at all! This is a violation of intergalactic law!\n--------------------\nIf you have no idea what this means or what Pirates is, let me explain: Pirates is a module that makes is easy to implement require hooks. One of the require hooks you're using uses it. One of these require hooks didn't return anything from it's handler, so we don't know what to do. You might want to debug this.";
function shouldCompile(filename, exts, matcher, ignoreNodeModules) {
if (typeof filename !== "string") {
return false;
}
if (exts.indexOf(_path.default.extname(filename)) === -1) {
return false;
}
const resolvedFilename = _path.default.resolve(filename);
if (ignoreNodeModules && _nodeModulesRegexp.default.test(resolvedFilename)) {
return false;
}
if (matcher && typeof matcher === "function") {
return !!matcher(resolvedFilename);
}
return true;
}
function addHook2(hook, opts = {}) {
let reverted = false;
const loaders = [];
const oldLoaders = [];
let exts;
const originalJSLoader = Module._extensions[".js"];
const matcher = opts.matcher || null;
const ignoreNodeModules = opts.ignoreNodeModules !== false;
exts = opts.extensions || opts.exts || opts.extension || opts.ext || [".js"];
if (!Array.isArray(exts)) {
exts = [exts];
}
exts.forEach((ext2) => {
if (typeof ext2 !== "string") {
throw new TypeError(`Invalid Extension: ${ext2}`);
}
const oldLoader = Module._extensions[ext2] || originalJSLoader;
oldLoaders[ext2] = oldLoader;
loaders[ext2] = Module._extensions[ext2] = function newLoader(mod, filename) {
let compile;
if (!reverted) {
if (shouldCompile(filename, exts, matcher, ignoreNodeModules)) {
compile = mod._compile;
mod._compile = function _compile(code) {
mod._compile = compile;
const newCode = hook(code, filename);
if (typeof newCode !== "string") {
throw new Error(HOOK_RETURNED_NOTHING_ERROR_MESSAGE);
}
return mod._compile(newCode, filename);
};
}
}
oldLoader(mod, filename);
};
});
return function revert() {
if (reverted)
return;
reverted = true;
exts.forEach((ext2) => {
if (Module._extensions[ext2] === loaders[ext2]) {
Module._extensions[ext2] = oldLoaders[ext2];
}
});
};
}
});
var require_lib22 = __commonJS2((exports2, module22) => {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
exports2.default = void 0;
var _fs = _interopRequireDefault(require("fs"));
var _path = _interopRequireDefault(require("path"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function asyncGeneratorStep(gen, resolve2, reject, _next, _throw, key, arg) {
try {
var info2 = gen[key](arg);
var value = info2.value;
} catch (error2) {
reject(error2);
return;
}
if (info2.done) {
resolve2(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator(fn) {
return function() {
var self2 = this, args = arguments;
return new Promise(function(resolve2, reject) {
var gen = fn.apply(self2, args);
function _next(value) {
asyncGeneratorStep(gen, resolve2, reject, _next, _throw, "next", value);
}
function _throw(err2) {
asyncGeneratorStep(gen, resolve2, reject, _next, _throw, "throw", err2);
}
_next(void 0);
});
};
}
var readFile = (fp) => new Promise((resolve2, reject) => {
_fs.default.readFile(fp, "utf8", (err2, data) => {
if (err2)
return reject(err2);
resolve2(data);
});
});
var readFileSync4 = (fp) => {
return _fs.default.readFileSync(fp, "utf8");
};
var pathExists = (fp) => new Promise((resolve2) => {
_fs.default.access(fp, (err2) => {
resolve2(!err2);
});
});
var pathExistsSync = _fs.default.existsSync;
var JoyCon2 = class {
constructor({
files,
cwd = process.cwd(),
stopDir,
packageKey,
parseJSON = JSON.parse
} = {}) {
this.options = {
files,
cwd,
stopDir,
packageKey,
parseJSON
};
this.existsCache = /* @__PURE__ */ new Map();
this.loaders = /* @__PURE__ */ new Set();
this.packageJsonCache = /* @__PURE__ */ new Map();
}
addLoader(loader) {
this.loaders.add(loader);
return this;
}
removeLoader(name) {
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = void 0;
try {
for (var _iterator = this.loaders[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
const loader = _step.value;
if (name && loader.name === name) {
this.loaders.delete(loader);
}
}
} catch (err2) {
_didIteratorError = true;
_iteratorError = err2;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
return this;
}
recusivelyResolve(options) {
var _this = this;
return _asyncToGenerator(function* () {
if (options.cwd === options.stopDir || _path.default.basename(options.cwd) === "node_modules") {
return null;
}
var _iteratorNormalCompletion4 = true;
var _didIteratorError4 = false;
var _iteratorError4 = void 0;
try {
for (var _iterator4 = options.files[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
const filename = _step4.value;
const file = _path.default.resolve(options.cwd, filename);
const exists = process.env.NODE_ENV !== "test" && _this.existsCache.has(file) ? _this.existsCache.get(file) : yield pathExists(file);
_this.existsCache.set(file, exists);
if (exists) {
if (!options.packageKey || _path.default.basename(file) !== "package.json") {
return file;
}
const data = require(file);
delete require.cache[file];
const hasPackageKey = Object.prototype.hasOwnProperty.call(data, options.packageKey);
if (hasPackageKey) {
_this.packageJsonCache.set(file, data);
return file;
}
}
continue;
}
} catch (err2) {
_didIteratorError4 = true;
_iteratorError4 = err2;
} finally {
try {
if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
_iterator4.return();
}
} finally {
if (_didIteratorError4) {
throw _iteratorError4;
}
}
}
return _this.recusivelyResolve(Object.assign({}, options, {
cwd: _path.default.dirname(options.cwd)
}));
})();
}
recusivelyResolveSync(options) {
if (options.cwd === options.stopDir || _path.default.basename(options.cwd) === "node_modules") {
return null;
}
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = void 0;
try {
for (var _iterator2 = options.files[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
const filename = _step2.value;
const file = _path.default.resolve(options.cwd, filename);
const exists = process.env.NODE_ENV !== "test" && this.existsCache.has(file) ? this.existsCache.get(file) : pathExistsSync(file);
this.existsCache.set(file, exists);
if (exists) {
if (!options.packageKey || _path.default.basename(file) !== "package.json") {
return file;
}
const data = require(file);
delete require.cache[file];
const hasPackageKey = Object.prototype.hasOwnProperty.call(data, options.packageKey);
if (hasPackageKey) {
this.packageJsonCache.set(file, data);
return file;
}
}
continue;
}
} catch (err2) {
_didIteratorError2 = true;
_iteratorError2 = err2;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
_iterator2.return();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
return this.recusivelyResolveSync(Object.assign({}, options, {
cwd: _path.default.dirname(options.cwd)
}));
}
resolve(...args) {
var _this2 = this;
return _asyncToGenerator(function* () {
const options = _this2.normalizeOptions(args);
return _this2.recusivelyResolve(options);
})();
}
resolveSync(...args) {
const options = this.normalizeOptions(args);
return this.recusivelyResolveSync(options);
}
load(...args) {
var _this3 = this;
return _asyncToGenerator(function* () {
const options = _this3.normalizeOptions(args);
const filepath = yield _this3.recusivelyResolve(options);
if (filepath) {
const loader = _this3.findLoader(filepath);
if (loader) {
return {
path: filepath,
data: yield loader.load(filepath)
};
}
const extname2 = _path.default.extname(filepath).slice(1);
if (extname2 === "js") {
delete require.cache[filepath];
return {
path: filepath,
data: require(filepath)
};
}
if (extname2 === "json") {
if (_this3.packageJsonCache.has(filepath)) {
return {
path: filepath,
data: _this3.packageJsonCache.get(filepath)[options.packageKey]
};
}
const data = _this3.options.parseJSON(yield readFile(filepath));
return {
path: filepath,
data
};
}
return {
path: filepath,
data: yield readFile(filepath)
};
}
return {};
})();
}
loadSync(...args) {
const options = this.normalizeOptions(args);
const filepath = this.recusivelyResolveSync(options);
if (filepath) {
const loader = this.findLoader(filepath);
if (loader) {
return {
path: filepath,
data: loader.loadSync(filepath)
};
}
const extname2 = _path.default.extname(filepath).slice(1);
if (extname2 === "js") {
delete require.cache[filepath];
return {
path: filepath,
data: require(filepath)
};
}
if (extname2 === "json") {
if (this.packageJsonCache.has(filepath)) {
return {
path: filepath,
data: this.packageJsonCache.get(filepath)[options.packageKey]
};
}
const data = this.options.parseJSON(readFileSync4(filepath));
return {
path: filepath,
data
};
}
return {
path: filepath,
data: readFileSync4(filepath)
};
}
return {};
}
findLoader(filepath) {
var _iteratorNormalCompletion3 = true;
var _didIteratorError3 = false;
var _iteratorError3 = void 0;
try {
for (var _iterator3 = this.loaders[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
const loader = _step3.value;
if (loader.test && loader.test.test(filepath)) {
return loader;
}
}
} catch (err2) {
_didIteratorError3 = true;
_iteratorError3 = err2;
} finally {
try {
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
_iterator3.return();
}
} finally {
if (_didIteratorError3) {
throw _iteratorError3;
}
}
}
return null;
}
clearCache() {
this.existsCache.clear();
this.packageJsonCache.clear();
return this;
}
normalizeOptions(args) {
const options = Object.assign({}, this.options);
if (Object.prototype.toString.call(args[0]) === "[object Object]") {
Object.assign(options, args[0]);
} else {
if (args[0]) {
options.files = args[0];
}
if (args[1]) {
options.cwd = args[1];
}
if (args[2]) {
options.stopDir = args[2];
}
}
options.cwd = _path.default.resolve(options.cwd);
options.stopDir = options.stopDir ? _path.default.resolve(options.stopDir) : _path.default.parse(options.cwd).root;
if (!options.files || options.files.length === 0) {
throw new Error("[joycon] files must be an non-empty array!");
}
options.__normalized__ = true;
return options;
}
};
exports2.default = JoyCon2;
module22.exports = JoyCon2;
module22.exports.default = JoyCon2;
});
var require_filesystem = __commonJS2((exports2) => {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
var fs32 = require("fs");
function fileExistsSync(path3) {
try {
var stats = fs32.statSync(path3);
return stats.isFile();
} catch (err2) {
return false;
}
}
exports2.fileExistsSync = fileExistsSync;
function readJsonFromDiskSync(packageJsonPath) {
if (!fs32.existsSync(packageJsonPath)) {
return void 0;
}
return require(packageJsonPath);
}
exports2.readJsonFromDiskSync = readJsonFromDiskSync;
function readJsonFromDiskAsync(path3, callback) {
fs32.readFile(path3, "utf8", function(err2, result) {
if (err2 || !result) {
return callback();
}
var json = JSON.parse(result);
return callback(void 0, json);
});
}
exports2.readJsonFromDiskAsync = readJsonFromDiskAsync;
function fileExistsAsync(path22, callback2) {
fs32.stat(path22, function(err2, stats) {
if (err2) {
return callback2(void 0, false);
}
callback2(void 0, stats ? stats.isFile() : false);
});
}
exports2.fileExistsAsync = fileExistsAsync;
function removeExtension(path3) {
return path3.substring(0, path3.lastIndexOf(".")) || path3;
}
exports2.removeExtension = removeExtension;
});
var require_mapping_entry = __commonJS2((exports2) => {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
var path3 = require("path");
function getAbsoluteMappingEntries(absoluteBaseUrl, paths, addMatchAll) {
var sortedKeys = sortByLongestPrefix(Object.keys(paths));
var absolutePaths = [];
for (var _i = 0, sortedKeys_1 = sortedKeys; _i < sortedKeys_1.length; _i++) {
var key = sortedKeys_1[_i];
absolutePaths.push({
pattern: key,
paths: paths[key].map(function(pathToResolve) {
return path3.join(absoluteBaseUrl, pathToResolve);
})
});
}
if (!paths["*"] && addMatchAll) {
absolutePaths.push({
pattern: "*",
paths: [absoluteBaseUrl.replace(/\/$/, "") + "/*"]
});
}
return absolutePaths;
}
exports2.getAbsoluteMappingEntries = getAbsoluteMappingEntries;
function sortByLongestPrefix(arr) {
return arr.concat().sort(function(a, b) {
return getPrefixLength(b) - getPrefixLength(a);
});
}
function getPrefixLength(pattern) {
var prefixLength = pattern.indexOf("*");
return pattern.substr(0, prefixLength).length;
}
});
var require_try_path = __commonJS2((exports2) => {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
var path3 = require("path");
var path_1 = require("path");
var filesystem_1 = require_filesystem();
function getPathsToTry(extensions, absolutePathMappings, requestedModule) {
if (!absolutePathMappings || !requestedModule || requestedModule[0] === "." || requestedModule[0] === path3.sep) {
return void 0;
}
var pathsToTry = [];
for (var _i = 0, absolutePathMappings_1 = absolutePathMappings; _i < absolutePathMappings_1.length; _i++) {
var entry = absolutePathMappings_1[_i];
var starMatch = entry.pattern === requestedModule ? "" : matchStar(entry.pattern, requestedModule);
if (starMatch !== void 0) {
var _loop_1 = function(physicalPathPattern2) {
var physicalPath = physicalPathPattern2.replace("*", starMatch);
pathsToTry.push({ type: "file", path: physicalPath });
pathsToTry.push.apply(pathsToTry, extensions.map(function(e) {
return { type: "extension", path: physicalPath + e };
}));
pathsToTry.push({
type: "package",
path: path3.join(physicalPath, "/package.json")
});
var indexPath = path3.join(physicalPath, "/index");
pathsToTry.push.apply(pathsToTry, extensions.map(function(e) {
return { type: "index", path: indexPath + e };
}));
};
for (var _a = 0, _b = entry.paths; _a < _b.length; _a++) {
var physicalPathPattern = _b[_a];
_loop_1(physicalPathPattern);
}
}
}
return pathsToTry.length === 0 ? void 0 : pathsToTry;
}
exports2.getPathsToTry = getPathsToTry;
function getStrippedPath(tryPath) {
return tryPath.type === "index" ? path_1.dirname(tryPath.path) : tryPath.type === "file" ? tryPath.path : tryPath.type === "extension" ? filesystem_1.removeExtension(tryPath.path) : tryPath.type === "package" ? tryPath.path : exhaustiveTypeException(tryPath.type);
}
exports2.getStrippedPath = getStrippedPath;
function exhaustiveTypeException(check) {
throw new Error("Unknown type " + check);
}
exports2.exhaustiveTypeException = exhaustiveTypeException;
function matchStar(pattern, search) {
if (search.length < pattern.length) {
return void 0;
}
if (pattern === "*") {
return search;
}
var star2 = pattern.indexOf("*");
if (star2 === -1) {
return void 0;
}
var part1 = pattern.substring(0, star2);
var part2 = pattern.substring(star2 + 1);
if (search.substr(0, star2) !== part1) {
return void 0;
}
if (search.substr(search.length - part2.length) !== part2) {
return void 0;
}
return search.substr(star2, search.length - part2.length);
}
});
var require_match_path_sync = __commonJS2((exports2) => {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
var path3 = require("path");
var Filesystem = require_filesystem();
var MappingEntry = require_mapping_entry();
var TryPath = require_try_path();
function createMatchPath2(absoluteBaseUrl, paths, mainFields, addMatchAll) {
if (mainFields === void 0) {
mainFields = ["main"];
}
if (addMatchAll === void 0) {
addMatchAll = true;
}
var absolutePaths = MappingEntry.getAbsoluteMappingEntries(absoluteBaseUrl, paths, addMatchAll);
return function(requestedModule, readJson, fileExists, extensions) {
return matchFromAbsolutePaths(absolutePaths, requestedModule, readJson, fileExists, extensions, mainFields);
};
}
exports2.createMatchPath = createMatchPath2;
function matchFromAbsolutePaths(absolutePathMappings, requestedModule, readJson, fileExists, extensions, mainFields) {
if (readJson === void 0) {
readJson = Filesystem.readJsonFromDiskSync;
}
if (fileExists === void 0) {
fileExists = Filesystem.fileExistsSync;
}
if (extensions === void 0) {
extensions = Object.keys(require.extensions);
}
if (mainFields === void 0) {
mainFields = ["main"];
}
var tryPaths = TryPath.getPathsToTry(extensions, absolutePathMappings, requestedModule);
if (!tryPaths) {
return void 0;
}
return findFirstExistingPath(tryPaths, readJson, fileExists, mainFields);
}
exports2.matchFromAbsolutePaths = matchFromAbsolutePaths;
function findFirstExistingMainFieldMappedFile(packageJson, mainFields, packageJsonPath, fileExists) {
for (var index4 = 0; index4 < mainFields.length; index4++) {
var mainFieldName = mainFields[index4];
var candidateMapping = packageJson[mainFieldName];
if (candidateMapping && typeof candidateMapping === "string") {
var candidateFilePath = path3.join(path3.dirname(packageJsonPath), candidateMapping);
if (fileExists(candidateFilePath)) {
return candidateFilePath;
}
}
}
return void 0;
}
function findFirstExistingPath(tryPaths, readJson, fileExists, mainFields) {
if (readJson === void 0) {
readJson = Filesystem.readJsonFromDiskSync;
}
if (mainFields === void 0) {
mainFields = ["main"];
}
for (var _i = 0, tryPaths_1 = tryPaths; _i < tryPaths_1.length; _i++) {
var tryPath = tryPaths_1[_i];
if (tryPath.type === "file" || tryPath.type === "extension" || tryPath.type === "index") {
if (fileExists(tryPath.path)) {
return TryPath.getStrippedPath(tryPath);
}
} else if (tryPath.type === "package") {
var packageJson = readJson(tryPath.path);
if (packageJson) {
var mainFieldMappedFile = findFirstExistingMainFieldMappedFile(packageJson, mainFields, tryPath.path, fileExists);
if (mainFieldMappedFile) {
return Filesystem.removeExtension(mainFieldMappedFile);
}
}
} else {
TryPath.exhaustiveTypeException(tryPath.type);
}
}
return void 0;
}
});
var require_match_path_async = __commonJS2((exports2) => {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
var path3 = require("path");
var TryPath = require_try_path();
var MappingEntry = require_mapping_entry();
var Filesystem = require_filesystem();
function createMatchPathAsync(absoluteBaseUrl, paths, mainFields, addMatchAll) {
if (mainFields === void 0) {
mainFields = ["main"];
}
if (addMatchAll === void 0) {
addMatchAll = true;
}
var absolutePaths = MappingEntry.getAbsoluteMappingEntries(absoluteBaseUrl, paths, addMatchAll);
return function(requestedModule, readJson, fileExists, extensions, callback) {
return matchFromAbsolutePathsAsync(absolutePaths, requestedModule, readJson, fileExists, extensions, callback, mainFields);
};
}
exports2.createMatchPathAsync = createMatchPathAsync;
function matchFromAbsolutePathsAsync(absolutePathMappings, requestedModule, readJson, fileExists, extensions, callback, mainFields) {
if (readJson === void 0) {
readJson = Filesystem.readJsonFromDiskAsync;
}
if (fileExists === void 0) {
fileExists = Filesystem.fileExistsAsync;
}
if (extensions === void 0) {
extensions = Object.keys(require.extensions);
}
if (mainFields === void 0) {
mainFields = ["main"];
}
var tryPaths = TryPath.getPathsToTry(extensions, absolutePathMappings, requestedModule);
if (!tryPaths) {
return callback();
}
findFirstExistingPath(tryPaths, readJson, fileExists, callback, 0, mainFields);
}
exports2.matchFromAbsolutePathsAsync = matchFromAbsolutePathsAsync;
function findFirstExistingMainFieldMappedFile(packageJson, mainFields, packageJsonPath, fileExistsAsync, doneCallback, index4) {
if (index4 === void 0) {
index4 = 0;
}
if (index4 >= mainFields.length) {
return doneCallback(void 0, void 0);
}
var tryNext = function() {
return findFirstExistingMainFieldMappedFile(packageJson, mainFields, packageJsonPath, fileExistsAsync, doneCallback, index4 + 1);
};
var mainFieldMapping = packageJson[mainFields[index4]];
if (typeof mainFieldMapping !== "string") {
return tryNext();
}
var mappedFilePath = path3.join(path3.dirname(packageJsonPath), mainFieldMapping);
fileExistsAsync(mappedFilePath, function(err2, exists) {
if (err2) {
return doneCallback(err2);
}
if (exists) {
return doneCallback(void 0, mappedFilePath);
}
return tryNext();
});
}
function findFirstExistingPath(tryPaths, readJson, fileExists, doneCallback, index4, mainFields) {
if (index4 === void 0) {
index4 = 0;
}
if (mainFields === void 0) {
mainFields = ["main"];
}
var tryPath = tryPaths[index4];
if (tryPath.type === "file" || tryPath.type === "extension" || tryPath.type === "index") {
fileExists(tryPath.path, function(err2, exists) {
if (err2) {
return doneCallback(err2);
}
if (exists) {
return doneCallback(void 0, TryPath.getStrippedPath(tryPath));
}
if (index4 === tryPaths.length - 1) {
return doneCallback();
}
return findFirstExistingPath(tryPaths, readJson, fileExists, doneCallback, index4 + 1, mainFields);
});
} else if (tryPath.type === "package") {
readJson(tryPath.path, function(err2, packageJson) {
if (err2) {
return doneCallback(err2);
}
if (packageJson) {
return findFirstExistingMainFieldMappedFile(packageJson, mainFields, tryPath.path, fileExists, function(mainFieldErr, mainFieldMappedFile) {
if (mainFieldErr) {
return doneCallback(mainFieldErr);
}
if (mainFieldMappedFile) {
return doneCallback(void 0, Filesystem.removeExtension(mainFieldMappedFile));
}
return findFirstExistingPath(tryPaths, readJson, fileExists, doneCallback, index4 + 1, mainFields);
});
}
return findFirstExistingPath(tryPaths, readJson, fileExists, doneCallback, index4 + 1, mainFields);
});
} else {
TryPath.exhaustiveTypeException(tryPath.type);
}
}
});
var require_unicode = __commonJS2((exports2) => {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
var Space_Separator = exports2.Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
var ID_Start = exports2.ID_Start = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/;
var ID_Continue = exports2.ID_Continue = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/;
});
var require_util2 = __commonJS2((exports2) => {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.isSpaceSeparator = isSpaceSeparator;
exports2.isIdStartChar = isIdStartChar;
exports2.isIdContinueChar = isIdContinueChar;
exports2.isDigit = isDigit;
exports2.isHexDigit = isHexDigit;
var _unicode = require_unicode();
var unicode = _interopRequireWildcard(_unicode);
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};
if (obj != null) {
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key))
newObj[key] = obj[key];
}
}
newObj.default = obj;
return newObj;
}
}
function isSpaceSeparator(c) {
return unicode.Space_Separator.test(c);
}
function isIdStartChar(c) {
return c >= "a" && c <= "z" || c >= "A" && c <= "Z" || c === "$" || c === "_" || unicode.ID_Start.test(c);
}
function isIdContinueChar(c) {
return c >= "a" && c <= "z" || c >= "A" && c <= "Z" || c >= "0" && c <= "9" || c === "$" || c === "_" || c === "\u200C" || c === "\u200D" || unicode.ID_Continue.test(c);
}
function isDigit(c) {
return /[0-9]/.test(c);
}
function isHexDigit(c) {
return /[0-9A-Fa-f]/.test(c);
}
});
var require_parse = __commonJS2((exports2, module22) => {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
return typeof obj;
} : function(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
exports2.default = parse;
var _util = require_util2();
var util2 = _interopRequireWildcard(_util);
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};
if (obj != null) {
for (var key2 in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key2))
newObj[key2] = obj[key2];
}
}
newObj.default = obj;
return newObj;
}
}
var source = void 0;
var parseState = void 0;
var stack = void 0;
var pos = void 0;
var line = void 0;
var column7 = void 0;
var token = void 0;
var key = void 0;
var root = void 0;
function parse(text, reviver) {
source = String(text);
parseState = "start";
stack = [];
pos = 0;
line = 1;
column7 = 0;
token = void 0;
key = void 0;
root = void 0;
do {
token = lex();
parseStates[parseState]();
} while (token.type !== "eof");
if (typeof reviver === "function") {
return internalize({ "": root }, "", reviver);
}
return root;
}
function internalize(holder, name, reviver) {
var value = holder[name];
if (value != null && (typeof value === "undefined" ? "undefined" : _typeof(value)) === "object") {
for (var _key in value) {
var replacement = internalize(value, _key, reviver);
if (replacement === void 0) {
delete value[_key];
} else {
value[_key] = replacement;
}
}
}
return reviver.call(holder, name, value);
}
var lexState = void 0;
var buffer = void 0;
var doubleQuote = void 0;
var _sign = void 0;
var c = void 0;
function lex() {
lexState = "default";
buffer = "";
doubleQuote = false;
_sign = 1;
for (; ; ) {
c = peek();
var _token = lexStates[lexState]();
if (_token) {
return _token;
}
}
}
function peek() {
if (source[pos]) {
return String.fromCodePoint(source.codePointAt(pos));
}
}
function read() {
var c2 = peek();
if (c2 === "\n") {
line++;
column7 = 0;
} else if (c2) {
column7 += c2.length;
} else {
column7++;
}
if (c2) {
pos += c2.length;
}
return c2;
}
var lexStates = { default: function _default() {
switch (c) {
case " ":
case "\v":
case "\f":
case " ":
case "\xA0":
case "\uFEFF":
case "\n":
case "\r":
case "\u2028":
case "\u2029":
read();
return;
case "/":
read();
lexState = "comment";
return;
case void 0:
read();
return newToken("eof");
}
if (util2.isSpaceSeparator(c)) {
read();
return;
}
return lexStates[parseState]();
}, comment: function comment() {
switch (c) {
case "*":
read();
lexState = "multiLineComment";
return;
case "/":
read();
lexState = "singleLineComment";
return;
}
throw invalidChar(read());
}, multiLineComment: function multiLineComment() {
switch (c) {
case "*":
read();
lexState = "multiLineCommentAsterisk";
return;
case void 0:
throw invalidChar(read());
}
read();
}, multiLineCommentAsterisk: function multiLineCommentAsterisk() {
switch (c) {
case "*":
read();
return;
case "/":
read();
lexState = "default";
return;
case void 0:
throw invalidChar(read());
}
read();
lexState = "multiLineComment";
}, singleLineComment: function singleLineComment() {
switch (c) {
case "\n":
case "\r":
case "\u2028":
case "\u2029":
read();
lexState = "default";
return;
case void 0:
read();
return newToken("eof");
}
read();
}, value: function value() {
switch (c) {
case "{":
case "[":
return newToken("punctuator", read());
case "n":
read();
literal("ull");
return newToken("null", null);
case "t":
read();
literal("rue");
return newToken("boolean", true);
case "f":
read();
literal("alse");
return newToken("boolean", false);
case "-":
case "+":
if (read() === "-") {
_sign = -1;
}
lexState = "sign";
return;
case ".":
buffer = read();
lexState = "decimalPointLeading";
return;
case "0":
buffer = read();
lexState = "zero";
return;
case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
case "7":
case "8":
case "9":
buffer = read();
lexState = "decimalInteger";
return;
case "I":
read();
literal("nfinity");
return newToken("numeric", Infinity);
case "N":
read();
literal("aN");
return newToken("numeric", NaN);
case '"':
case "'":
doubleQuote = read() === '"';
buffer = "";
lexState = "string";
return;
}
throw invalidChar(read());
}, identifierNameStartEscape: function identifierNameStartEscape() {
if (c !== "u") {
throw invalidChar(read());
}
read();
var u = unicodeEscape();
switch (u) {
case "$":
case "_":
break;
default:
if (!util2.isIdStartChar(u)) {
throw invalidIdentifier();
}
break;
}
buffer += u;
lexState = "identifierName";
}, identifierName: function identifierName() {
switch (c) {
case "$":
case "_":
case "\u200C":
case "\u200D":
buffer += read();
return;
case "\\":
read();
lexState = "identifierNameEscape";
return;
}
if (util2.isIdContinueChar(c)) {
buffer += read();
return;
}
return newToken("identifier", buffer);
}, identifierNameEscape: function identifierNameEscape() {
if (c !== "u") {
throw invalidChar(read());
}
read();
var u = unicodeEscape();
switch (u) {
case "$":
case "_":
case "\u200C":
case "\u200D":
break;
default:
if (!util2.isIdContinueChar(u)) {
throw invalidIdentifier();
}
break;
}
buffer += u;
lexState = "identifierName";
}, sign: function sign() {
switch (c) {
case ".":
buffer = read();
lexState = "decimalPointLeading";
return;
case "0":
buffer = read();
lexState = "zero";
return;
case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
case "7":
case "8":
case "9":
buffer = read();
lexState = "decimalInteger";
return;
case "I":
read();
literal("nfinity");
return newToken("numeric", _sign * Infinity);
case "N":
read();
literal("aN");
return newToken("numeric", NaN);
}
throw invalidChar(read());
}, zero: function zero() {
switch (c) {
case ".":
buffer += read();
lexState = "decimalPoint";
return;
case "e":
case "E":
buffer += read();
lexState = "decimalExponent";
return;
case "x":
case "X":
buffer += read();
lexState = "hexadecimal";
return;
}
return newToken("numeric", _sign * 0);
}, decimalInteger: function decimalInteger() {
switch (c) {
case ".":
buffer += read();
lexState = "decimalPoint";
return;
case "e":
case "E":
buffer += read();
lexState = "decimalExponent";
return;
}
if (util2.isDigit(c)) {
buffer += read();
return;
}
return newToken("numeric", _sign * Number(buffer));
}, decimalPointLeading: function decimalPointLeading() {
if (util2.isDigit(c)) {
buffer += read();
lexState = "decimalFraction";
return;
}
throw invalidChar(read());
}, decimalPoint: function decimalPoint() {
switch (c) {
case "e":
case "E":
buffer += read();
lexState = "decimalExponent";
return;
}
if (util2.isDigit(c)) {
buffer += read();
lexState = "decimalFraction";
return;
}
return newToken("numeric", _sign * Number(buffer));
}, decimalFraction: function decimalFraction() {
switch (c) {
case "e":
case "E":
buffer += read();
lexState = "decimalExponent";
return;
}
if (util2.isDigit(c)) {
buffer += read();
return;
}
return newToken("numeric", _sign * Number(buffer));
}, decimalExponent: function decimalExponent() {
switch (c) {
case "+":
case "-":
buffer += read();
lexState = "decimalExponentSign";
return;
}
if (util2.isDigit(c)) {
buffer += read();
lexState = "decimalExponentInteger";
return;
}
throw invalidChar(read());
}, decimalExponentSign: function decimalExponentSign() {
if (util2.isDigit(c)) {
buffer += read();
lexState = "decimalExponentInteger";
return;
}
throw invalidChar(read());
}, decimalExponentInteger: function decimalExponentInteger() {
if (util2.isDigit(c)) {
buffer += read();
return;
}
return newToken("numeric", _sign * Number(buffer));
}, hexadecimal: function hexadecimal() {
if (util2.isHexDigit(c)) {
buffer += read();
lexState = "hexadecimalInteger";
return;
}
throw invalidChar(read());
}, hexadecimalInteger: function hexadecimalInteger() {
if (util2.isHexDigit(c)) {
buffer += read();
return;
}
return newToken("numeric", _sign * Number(buffer));
}, string: function string() {
switch (c) {
case "\\":
read();
buffer += escape2();
return;
case '"':
if (doubleQuote) {
read();
return newToken("string", buffer);
}
buffer += read();
return;
case "'":
if (!doubleQuote) {
read();
return newToken("string", buffer);
}
buffer += read();
return;
case "\n":
case "\r":
throw invalidChar(read());
case "\u2028":
case "\u2029":
separatorChar(c);
break;
case void 0:
throw invalidChar(read());
}
buffer += read();
}, start: function start() {
switch (c) {
case "{":
case "[":
return newToken("punctuator", read());
}
lexState = "value";
}, beforePropertyName: function beforePropertyName() {
switch (c) {
case "$":
case "_":
buffer = read();
lexState = "identifierName";
return;
case "\\":
read();
lexState = "identifierNameStartEscape";
return;
case "}":
return newToken("punctuator", read());
case '"':
case "'":
doubleQuote = read() === '"';
lexState = "string";
return;
}
if (util2.isIdStartChar(c)) {
buffer += read();
lexState = "identifierName";
return;
}
throw invalidChar(read());
}, afterPropertyName: function afterPropertyName() {
if (c === ":") {
return newToken("punctuator", read());
}
throw invalidChar(read());
}, beforePropertyValue: function beforePropertyValue() {
lexState = "value";
}, afterPropertyValue: function afterPropertyValue() {
switch (c) {
case ",":
case "}":
return newToken("punctuator", read());
}
throw invalidChar(read());
}, beforeArrayValue: function beforeArrayValue() {
if (c === "]") {
return newToken("punctuator", read());
}
lexState = "value";
}, afterArrayValue: function afterArrayValue() {
switch (c) {
case ",":
case "]":
return newToken("punctuator", read());
}
throw invalidChar(read());
}, end: function end() {
throw invalidChar(read());
} };
function newToken(type, value) {
return { type, value, line, column: column7 };
}
function literal(s) {
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = void 0;
try {
for (var _iterator = s[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var _c = _step.value;
var p = peek();
if (p !== _c) {
throw invalidChar(read());
}
read();
}
} catch (err2) {
_didIteratorError = true;
_iteratorError = err2;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
}
function escape2() {
var c2 = peek();
switch (c2) {
case "b":
read();
return "\b";
case "f":
read();
return "\f";
case "n":
read();
return "\n";
case "r":
read();
return "\r";
case "t":
read();
return " ";
case "v":
read();
return "\v";
case "0":
read();
if (util2.isDigit(peek())) {
throw invalidChar(read());
}
return "\0";
case "x":
read();
return hexEscape();
case "u":
read();
return unicodeEscape();
case "\n":
case "\u2028":
case "\u2029":
read();
return "";
case "\r":
read();
if (peek() === "\n") {
read();
}
return "";
case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
case "7":
case "8":
case "9":
throw invalidChar(read());
case void 0:
throw invalidChar(read());
}
return read();
}
function hexEscape() {
var buffer2 = "";
var c2 = peek();
if (!util2.isHexDigit(c2)) {
throw invalidChar(read());
}
buffer2 += read();
c2 = peek();
if (!util2.isHexDigit(c2)) {
throw invalidChar(read());
}
buffer2 += read();
return String.fromCodePoint(parseInt(buffer2, 16));
}
function unicodeEscape() {
var buffer2 = "";
var count = 4;
while (count-- > 0) {
var _c2 = peek();
if (!util2.isHexDigit(_c2)) {
throw invalidChar(read());
}
buffer2 += read();
}
return String.fromCodePoint(parseInt(buffer2, 16));
}
var parseStates = { start: function start() {
if (token.type === "eof") {
throw invalidEOF();
}
push();
}, beforePropertyName: function beforePropertyName() {
switch (token.type) {
case "identifier":
case "string":
key = token.value;
parseState = "afterPropertyName";
return;
case "punctuator":
pop();
return;
case "eof":
throw invalidEOF();
}
}, afterPropertyName: function afterPropertyName() {
if (token.type === "eof") {
throw invalidEOF();
}
parseState = "beforePropertyValue";
}, beforePropertyValue: function beforePropertyValue() {
if (token.type === "eof") {
throw invalidEOF();
}
push();
}, beforeArrayValue: function beforeArrayValue() {
if (token.type === "eof") {
throw invalidEOF();
}
if (token.type === "punctuator" && token.value === "]") {
pop();
return;
}
push();
}, afterPropertyValue: function afterPropertyValue() {
if (token.type === "eof") {
throw invalidEOF();
}
switch (token.value) {
case ",":
parseState = "beforePropertyName";
return;
case "}":
pop();
}
}, afterArrayValue: function afterArrayValue() {
if (token.type === "eof") {
throw invalidEOF();
}
switch (token.value) {
case ",":
parseState = "beforeArrayValue";
return;
case "]":
pop();
}
}, end: function end() {
} };
function push() {
var value = void 0;
switch (token.type) {
case "punctuator":
switch (token.value) {
case "{":
value = {};
break;
case "[":
value = [];
break;
}
break;
case "null":
case "boolean":
case "numeric":
case "string":
value = token.value;
break;
}
if (root === void 0) {
root = value;
} else {
var parent = stack[stack.length - 1];
if (Array.isArray(parent)) {
parent.push(value);
} else {
parent[key] = value;
}
}
if (value !== null && (typeof value === "undefined" ? "undefined" : _typeof(value)) === "object") {
stack.push(value);
if (Array.isArray(value)) {
parseState = "beforeArrayValue";
} else {
parseState = "beforePropertyName";
}
} else {
var current = stack[stack.length - 1];
if (current == null) {
parseState = "end";
} else if (Array.isArray(current)) {
parseState = "afterArrayValue";
} else {
parseState = "afterPropertyValue";
}
}
}
function pop() {
stack.pop();
var current = stack[stack.length - 1];
if (current == null) {
parseState = "end";
} else if (Array.isArray(current)) {
parseState = "afterArrayValue";
} else {
parseState = "afterPropertyValue";
}
}
function invalidChar(c2) {
if (c2 === void 0) {
return syntaxError("JSON5: invalid end of input at " + line + ":" + column7);
}
return syntaxError("JSON5: invalid character '" + formatChar(c2) + "' at " + line + ":" + column7);
}
function invalidEOF() {
return syntaxError("JSON5: invalid end of input at " + line + ":" + column7);
}
function invalidIdentifier() {
column7 -= 5;
return syntaxError("JSON5: invalid identifier character at " + line + ":" + column7);
}
function separatorChar(c2) {
console.warn("JSON5: '" + c2 + "' is not valid ECMAScript; consider escaping");
}
function formatChar(c2) {
var replacements = { "'": "\\'", '"': '\\"', "\\": "\\\\", "\b": "\\b", "\f": "\\f", "\n": "\\n", "\r": "\\r", " ": "\\t", "\v": "\\v", "\0": "\\0", "\u2028": "\\u2028", "\u2029": "\\u2029" };
if (replacements[c2]) {
return replacements[c2];
}
if (c2 < " ") {
var hexString = c2.charCodeAt(0).toString(16);
return "\\x" + ("00" + hexString).substring(hexString.length);
}
return c2;
}
function syntaxError(message) {
var err2 = new SyntaxError(message);
err2.lineNumber = line;
err2.columnNumber = column7;
return err2;
}
module22.exports = exports2["default"];
});
var require_stringify = __commonJS2((exports2, module22) => {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
return typeof obj;
} : function(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
exports2.default = stringify;
var _util = require_util2();
var util2 = _interopRequireWildcard(_util);
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};
if (obj != null) {
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key))
newObj[key] = obj[key];
}
}
newObj.default = obj;
return newObj;
}
}
function stringify(value, replacer, space) {
var stack = [];
var indent = "";
var propertyList = void 0;
var replacerFunc = void 0;
var gap = "";
var quote = void 0;
if (replacer != null && (typeof replacer === "undefined" ? "undefined" : _typeof(replacer)) === "object" && !Array.isArray(replacer)) {
space = replacer.space;
quote = replacer.quote;
replacer = replacer.replacer;
}
if (typeof replacer === "function") {
replacerFunc = replacer;
} else if (Array.isArray(replacer)) {
propertyList = [];
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = void 0;
try {
for (var _iterator = replacer[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var v = _step.value;
var item = void 0;
if (typeof v === "string") {
item = v;
} else if (typeof v === "number" || v instanceof String || v instanceof Number) {
item = String(v);
}
if (item !== void 0 && propertyList.indexOf(item) < 0) {
propertyList.push(item);
}
}
} catch (err2) {
_didIteratorError = true;
_iteratorError = err2;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
}
if (space instanceof Number) {
space = Number(space);
} else if (space instanceof String) {
space = String(space);
}
if (typeof space === "number") {
if (space > 0) {
space = Math.min(10, Math.floor(space));
gap = " ".substr(0, space);
}
} else if (typeof space === "string") {
gap = space.substr(0, 10);
}
return serializeProperty("", { "": value });
function serializeProperty(key, holder) {
var value2 = holder[key];
if (value2 != null) {
if (typeof value2.toJSON5 === "function") {
value2 = value2.toJSON5(key);
} else if (typeof value2.toJSON === "function") {
value2 = value2.toJSON(key);
}
}
if (replacerFunc) {
value2 = replacerFunc.call(holder, key, value2);
}
if (value2 instanceof Number) {
value2 = Number(value2);
} else if (value2 instanceof String) {
value2 = String(value2);
} else if (value2 instanceof Boolean) {
value2 = value2.valueOf();
}
switch (value2) {
case null:
return "null";
case true:
return "true";
case false:
return "false";
}
if (typeof value2 === "string") {
return quoteString(value2, false);
}
if (typeof value2 === "number") {
return String(value2);
}
if ((typeof value2 === "undefined" ? "undefined" : _typeof(value2)) === "object") {
return Array.isArray(value2) ? serializeArray(value2) : serializeObject(value2);
}
return void 0;
}
function quoteString(value2) {
var quotes = { "'": 0.1, '"': 0.2 };
var replacements = { "'": "\\'", '"': '\\"', "\\": "\\\\", "\b": "\\b", "\f": "\\f", "\n": "\\n", "\r": "\\r", " ": "\\t", "\v": "\\v", "\0": "\\0", "\u2028": "\\u2028", "\u2029": "\\u2029" };
var product = "";
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = void 0;
try {
for (var _iterator2 = value2[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var c = _step2.value;
switch (c) {
case "'":
case '"':
quotes[c]++;
product += c;
continue;
}
if (replacements[c]) {
product += replacements[c];
continue;
}
if (c < " ") {
var hexString = c.charCodeAt(0).toString(16);
product += "\\x" + ("00" + hexString).substring(hexString.length);
continue;
}
product += c;
}
} catch (err2) {
_didIteratorError2 = true;
_iteratorError2 = err2;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2.return) {
_iterator2.return();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
var quoteChar = quote || Object.keys(quotes).reduce(function(a, b) {
return quotes[a] < quotes[b] ? a : b;
});
product = product.replace(new RegExp(quoteChar, "g"), replacements[quoteChar]);
return quoteChar + product + quoteChar;
}
function serializeObject(value2) {
if (stack.indexOf(value2) >= 0) {
throw TypeError("Converting circular structure to JSON5");
}
stack.push(value2);
var stepback = indent;
indent = indent + gap;
var keys = propertyList || Object.keys(value2);
var partial = [];
var _iteratorNormalCompletion3 = true;
var _didIteratorError3 = false;
var _iteratorError3 = void 0;
try {
for (var _iterator3 = keys[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
var key = _step3.value;
var propertyString = serializeProperty(key, value2);
if (propertyString !== void 0) {
var member = serializeKey(key) + ":";
if (gap !== "") {
member += " ";
}
member += propertyString;
partial.push(member);
}
}
} catch (err2) {
_didIteratorError3 = true;
_iteratorError3 = err2;
} finally {
try {
if (!_iteratorNormalCompletion3 && _iterator3.return) {
_iterator3.return();
}
} finally {
if (_didIteratorError3) {
throw _iteratorError3;
}
}
}
var final = void 0;
if (partial.length === 0) {
final = "{}";
} else {
var properties = void 0;
if (gap === "") {
properties = partial.join(",");
final = "{" + properties + "}";
} else {
var separator = ",\n" + indent;
properties = partial.join(separator);
final = "{\n" + indent + properties + ",\n" + stepback + "}";
}
}
stack.pop();
indent = stepback;
return final;
}
function serializeKey(key) {
if (key.length === 0) {
return quoteString(key, true);
}
var firstChar = String.fromCodePoint(key.codePointAt(0));
if (!util2.isIdStartChar(firstChar)) {
return quoteString(key, true);
}
for (var i = firstChar.length; i < key.length; i++) {
if (!util2.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
return quoteString(key, true);
}
}
return key;
}
function serializeArray(value2) {
if (stack.indexOf(value2) >= 0) {
throw TypeError("Converting circular structure to JSON5");
}
stack.push(value2);
var stepback = indent;
indent = indent + gap;
var partial = [];
for (var i = 0; i < value2.length; i++) {
var propertyString = serializeProperty(String(i), value2);
partial.push(propertyString !== void 0 ? propertyString : "null");
}
var final = void 0;
if (partial.length === 0) {
final = "[]";
} else {
if (gap === "") {
var properties = partial.join(",");
final = "[" + properties + "]";
} else {
var separator = ",\n" + indent;
var _properties = partial.join(separator);
final = "[\n" + indent + _properties + ",\n" + stepback + "]";
}
}
stack.pop();
indent = stepback;
return final;
}
}
module22.exports = exports2["default"];
});
var require_lib32 = __commonJS2((exports2, module22) => {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
var _parse = require_parse();
var _parse2 = _interopRequireDefault(_parse);
var _stringify = require_stringify();
var _stringify2 = _interopRequireDefault(_stringify);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
exports2.default = { parse: _parse2.default, stringify: _stringify2.default };
module22.exports = exports2["default"];
});
var require_strip_bom = __commonJS2((exports2, module22) => {
"use strict";
module22.exports = (x) => {
if (typeof x !== "string") {
throw new TypeError("Expected a string, got " + typeof x);
}
if (x.charCodeAt(0) === 65279) {
return x.slice(1);
}
return x;
};
});
var require_tsconfig_loader = __commonJS2((exports2) => {
"use strict";
var __assign = exports2 && exports2.__assign || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s)
if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
Object.defineProperty(exports2, "__esModule", { value: true });
var path3 = require("path");
var fs32 = require("fs");
var JSON5 = require_lib32();
var StripBom = require_strip_bom();
function tsConfigLoader(_a) {
var getEnv = _a.getEnv, cwd = _a.cwd, _b = _a.loadSync, loadSync = _b === void 0 ? loadSyncDefault : _b;
var TS_NODE_PROJECT = getEnv("TS_NODE_PROJECT");
var TS_NODE_BASEURL = getEnv("TS_NODE_BASEURL");
var loadResult = loadSync(cwd, TS_NODE_PROJECT, TS_NODE_BASEURL);
return loadResult;
}
exports2.tsConfigLoader = tsConfigLoader;
function loadSyncDefault(cwd, filename, baseUrl) {
var configPath = resolveConfigPath(cwd, filename);
if (!configPath) {
return {
tsConfigPath: void 0,
baseUrl: void 0,
paths: void 0
};
}
var config = loadTsconfig(configPath);
return {
tsConfigPath: configPath,
baseUrl: baseUrl || config && config.compilerOptions && config.compilerOptions.baseUrl,
paths: config && config.compilerOptions && config.compilerOptions.paths
};
}
function resolveConfigPath(cwd, filename) {
if (filename) {
var absolutePath = fs32.lstatSync(filename).isDirectory() ? path3.resolve(filename, "./tsconfig.json") : path3.resolve(cwd, filename);
return absolutePath;
}
if (fs32.statSync(cwd).isFile()) {
return path3.resolve(cwd);
}
var configAbsolutePath = walkForTsConfig(cwd);
return configAbsolutePath ? path3.resolve(configAbsolutePath) : void 0;
}
function walkForTsConfig(directory, existsSync4) {
if (existsSync4 === void 0) {
existsSync4 = fs32.existsSync;
}
var configPath = path3.join(directory, "./tsconfig.json");
if (existsSync4(configPath)) {
return configPath;
}
var parentDirectory = path3.join(directory, "../");
if (directory === parentDirectory) {
return void 0;
}
return walkForTsConfig(parentDirectory, existsSync4);
}
exports2.walkForTsConfig = walkForTsConfig;
function loadTsconfig(configFilePath, existsSync4, readFileSync4) {
if (existsSync4 === void 0) {
existsSync4 = fs32.existsSync;
}
if (readFileSync4 === void 0) {
readFileSync4 = function(filename) {
return fs32.readFileSync(filename, "utf8");
};
}
if (!existsSync4(configFilePath)) {
return void 0;
}
var configString = readFileSync4(configFilePath);
var cleanedJson = StripBom(configString);
var config = JSON5.parse(cleanedJson);
var extendedConfig = config.extends;
if (extendedConfig) {
if (typeof extendedConfig === "string" && extendedConfig.indexOf(".json") === -1) {
extendedConfig += ".json";
}
var currentDir = path3.dirname(configFilePath);
var extendedConfigPath = path3.join(currentDir, extendedConfig);
if (extendedConfig.indexOf("/") !== -1 && extendedConfig.indexOf(".") !== -1 && !existsSync4(extendedConfigPath)) {
extendedConfigPath = path3.join(currentDir, "node_modules", extendedConfig);
}
var base = loadTsconfig(extendedConfigPath, existsSync4, readFileSync4) || {};
if (base.compilerOptions && base.compilerOptions.baseUrl) {
var extendsDir = path3.dirname(extendedConfig);
base.compilerOptions.baseUrl = path3.join(extendsDir, base.compilerOptions.baseUrl);
}
return __assign({}, base, config, { compilerOptions: __assign({}, base.compilerOptions, config.compilerOptions) });
}
return config;
}
exports2.loadTsconfig = loadTsconfig;
});
var require_minimist = __commonJS2((exports2, module22) => {
module22.exports = function(args, opts) {
if (!opts)
opts = {};
var flags = { bools: {}, strings: {}, unknownFn: null };
if (typeof opts["unknown"] === "function") {
flags.unknownFn = opts["unknown"];
}
if (typeof opts["boolean"] === "boolean" && opts["boolean"]) {
flags.allBools = true;
} else {
[].concat(opts["boolean"]).filter(Boolean).forEach(function(key2) {
flags.bools[key2] = true;
});
}
var aliases = {};
Object.keys(opts.alias || {}).forEach(function(key2) {
aliases[key2] = [].concat(opts.alias[key2]);
aliases[key2].forEach(function(x) {
aliases[x] = [key2].concat(aliases[key2].filter(function(y) {
return x !== y;
}));
});
});
[].concat(opts.string).filter(Boolean).forEach(function(key2) {
flags.strings[key2] = true;
if (aliases[key2]) {
flags.strings[aliases[key2]] = true;
}
});
var defaults2 = opts["default"] || {};
var argv = { _: [] };
Object.keys(flags.bools).forEach(function(key2) {
setArg(key2, defaults2[key2] === void 0 ? false : defaults2[key2]);
});
var notFlags = [];
if (args.indexOf("--") !== -1) {
notFlags = args.slice(args.indexOf("--") + 1);
args = args.slice(0, args.indexOf("--"));
}
function argDefined(key2, arg2) {
return flags.allBools && /^--[^=]+$/.test(arg2) || flags.strings[key2] || flags.bools[key2] || aliases[key2];
}
function setArg(key2, val, arg2) {
if (arg2 && flags.unknownFn && !argDefined(key2, arg2)) {
if (flags.unknownFn(arg2) === false)
return;
}
var value2 = !flags.strings[key2] && isNumber(val) ? Number(val) : val;
setKey(argv, key2.split("."), value2);
(aliases[key2] || []).forEach(function(x) {
setKey(argv, x.split("."), value2);
});
}
function setKey(obj, keys, value2) {
var o = obj;
for (var i2 = 0; i2 < keys.length - 1; i2++) {
var key2 = keys[i2];
if (key2 === "__proto__")
return;
if (o[key2] === void 0)
o[key2] = {};
if (o[key2] === Object.prototype || o[key2] === Number.prototype || o[key2] === String.prototype)
o[key2] = {};
if (o[key2] === Array.prototype)
o[key2] = [];
o = o[key2];
}
var key2 = keys[keys.length - 1];
if (key2 === "__proto__")
return;
if (o === Object.prototype || o === Number.prototype || o === String.prototype)
o = {};
if (o === Array.prototype)
o = [];
if (o[key2] === void 0 || flags.bools[key2] || typeof o[key2] === "boolean") {
o[key2] = value2;
} else if (Array.isArray(o[key2])) {
o[key2].push(value2);
} else {
o[key2] = [o[key2], value2];
}
}
function aliasIsBoolean(key2) {
return aliases[key2].some(function(x) {
return flags.bools[x];
});
}
for (var i = 0; i < args.length; i++) {
var arg = args[i];
if (/^--.+=/.test(arg)) {
var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
var key = m[1];
var value = m[2];
if (flags.bools[key]) {
value = value !== "false";
}
setArg(key, value, arg);
} else if (/^--no-.+/.test(arg)) {
var key = arg.match(/^--no-(.+)/)[1];
setArg(key, false, arg);
} else if (/^--.+/.test(arg)) {
var key = arg.match(/^--(.+)/)[1];
var next = args[i + 1];
if (next !== void 0 && !/^-/.test(next) && !flags.bools[key] && !flags.allBools && (aliases[key] ? !aliasIsBoolean(key) : true)) {
setArg(key, next, arg);
i++;
} else if (/^(true|false)$/.test(next)) {
setArg(key, next === "true", arg);
i++;
} else {
setArg(key, flags.strings[key] ? "" : true, arg);
}
} else if (/^-[^-]+/.test(arg)) {
var letters = arg.slice(1, -1).split("");
var broken = false;
for (var j = 0; j < letters.length; j++) {
var next = arg.slice(j + 2);
if (next === "-") {
setArg(letters[j], next, arg);
continue;
}
if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) {
setArg(letters[j], next.split("=")[1], arg);
broken = true;
break;
}
if (/[A-Za-z]/.test(letters[j]) && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
setArg(letters[j], next, arg);
broken = true;
break;
}
if (letters[j + 1] && letters[j + 1].match(/\W/)) {
setArg(letters[j], arg.slice(j + 2), arg);
broken = true;
break;
} else {
setArg(letters[j], flags.strings[letters[j]] ? "" : true, arg);
}
}
var key = arg.slice(-1)[0];
if (!broken && key !== "-") {
if (args[i + 1] && !/^(-|--)[^-]/.test(args[i + 1]) && !flags.bools[key] && (aliases[key] ? !aliasIsBoolean(key) : true)) {
setArg(key, args[i + 1], arg);
i++;
} else if (args[i + 1] && /^(true|false)$/.test(args[i + 1])) {
setArg(key, args[i + 1] === "true", arg);
i++;
} else {
setArg(key, flags.strings[key] ? "" : true, arg);
}
}
} else {
if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
argv._.push(flags.strings["_"] || !isNumber(arg) ? arg : Number(arg));
}
if (opts.stopEarly) {
argv._.push.apply(argv._, args.slice(i + 1));
break;
}
}
}
Object.keys(defaults2).forEach(function(key2) {
if (!hasKey(argv, key2.split("."))) {
setKey(argv, key2.split("."), defaults2[key2]);
(aliases[key2] || []).forEach(function(x) {
setKey(argv, x.split("."), defaults2[key2]);
});
}
});
if (opts["--"]) {
argv["--"] = new Array();
notFlags.forEach(function(key2) {
argv["--"].push(key2);
});
} else {
notFlags.forEach(function(key2) {
argv._.push(key2);
});
}
return argv;
};
function hasKey(obj, keys) {
var o = obj;
keys.slice(0, -1).forEach(function(key2) {
o = o[key2] || {};
});
var key = keys[keys.length - 1];
return key in o;
}
function isNumber(x) {
if (typeof x === "number")
return true;
if (/^0x[0-9a-f]+$/i.test(x))
return true;
return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
}
});
var require_options = __commonJS2((exports2) => {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
var minimist = require_minimist();
var argv = minimist(process.argv.slice(2), {
string: ["project"],
alias: {
project: ["P"]
}
});
var project = argv && argv.project;
exports2.options = {
cwd: project || process.cwd()
};
});
var require_config_loader = __commonJS2((exports2) => {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
var TsConfigLoader = require_tsconfig_loader();
var path3 = require("path");
var options_1 = require_options();
function loadConfig2(cwd) {
if (cwd === void 0) {
cwd = options_1.options.cwd;
}
return configLoader({ cwd });
}
exports2.loadConfig = loadConfig2;
function configLoader(_a) {
var cwd = _a.cwd, explicitParams = _a.explicitParams, _b = _a.tsConfigLoader, tsConfigLoader = _b === void 0 ? TsConfigLoader.tsConfigLoader : _b;
if (explicitParams) {
var absoluteBaseUrl_1 = path3.isAbsolute(explicitParams.baseUrl) ? explicitParams.baseUrl : path3.join(cwd, explicitParams.baseUrl);
return {
resultType: "success",
configFileAbsolutePath: "",
baseUrl: explicitParams.baseUrl,
absoluteBaseUrl: absoluteBaseUrl_1,
paths: explicitParams.paths,
mainFields: explicitParams.mainFields,
addMatchAll: explicitParams.addMatchAll
};
}
var loadResult = tsConfigLoader({
cwd,
getEnv: function(key) {
return process.env[key];
}
});
if (!loadResult.tsConfigPath) {
return {
resultType: "failed",
message: "Couldn't find tsconfig.json"
};
}
if (!loadResult.baseUrl) {
return {
resultType: "failed",
message: "Missing baseUrl in compilerOptions"
};
}
var tsConfigDir = path3.dirname(loadResult.tsConfigPath);
var absoluteBaseUrl = path3.join(tsConfigDir, loadResult.baseUrl);
return {
resultType: "success",
configFileAbsolutePath: loadResult.tsConfigPath,
baseUrl: loadResult.baseUrl,
absoluteBaseUrl,
paths: loadResult.paths || {}
};
}
exports2.configLoader = configLoader;
});
var require_register = __commonJS2((exports2) => {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
var match_path_sync_1 = require_match_path_sync();
var config_loader_1 = require_config_loader();
var options_1 = require_options();
var noOp2 = function() {
return void 0;
};
function getCoreModules(builtinModules2) {
builtinModules2 = builtinModules2 || [
"assert",
"buffer",
"child_process",
"cluster",
"crypto",
"dgram",
"dns",
"domain",
"events",
"fs",
"http",
"https",
"net",
"os",
"path",
"punycode",
"querystring",
"readline",
"stream",
"string_decoder",
"tls",
"tty",
"url",
"util",
"v8",
"vm",
"zlib"
];
var coreModules = {};
for (var _i = 0, builtinModules_1 = builtinModules2; _i < builtinModules_1.length; _i++) {
var module_1 = builtinModules_1[_i];
coreModules[module_1] = true;
}
return coreModules;
}
function register22(explicitParams) {
var configLoaderResult = config_loader_1.configLoader({
cwd: options_1.options.cwd,
explicitParams
});
if (configLoaderResult.resultType === "failed") {
console.warn(configLoaderResult.message + ". tsconfig-paths will be skipped");
return noOp2;
}
var matchPath = match_path_sync_1.createMatchPath(configLoaderResult.absoluteBaseUrl, configLoaderResult.paths, configLoaderResult.mainFields, configLoaderResult.addMatchAll);
var Module = require("module");
var originalResolveFilename = Module._resolveFilename;
var coreModules = getCoreModules(Module.builtinModules);
Module._resolveFilename = function(request, _parent) {
var isCoreModule = coreModules.hasOwnProperty(request);
if (!isCoreModule) {
var found = matchPath(request);
if (found) {
var modifiedArguments = [found].concat([].slice.call(arguments, 1));
return originalResolveFilename.apply(this, modifiedArguments);
}
}
return originalResolveFilename.apply(this, arguments);
};
return function() {
Module._resolveFilename = originalResolveFilename;
};
}
exports2.register = register22;
});
var require_lib42 = __commonJS2((exports2) => {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
var match_path_sync_1 = require_match_path_sync();
exports2.createMatchPath = match_path_sync_1.createMatchPath;
exports2.matchFromAbsolutePaths = match_path_sync_1.matchFromAbsolutePaths;
var match_path_async_1 = require_match_path_async();
exports2.createMatchPathAsync = match_path_async_1.createMatchPathAsync;
exports2.matchFromAbsolutePathsAsync = match_path_async_1.matchFromAbsolutePathsAsync;
var register_1 = require_register();
exports2.register = register_1.register;
var config_loader_1 = require_config_loader();
exports2.loadConfig = config_loader_1.loadConfig;
});
var import_source_map_support = __toModule(require_source_map_support());
var import_pirates = __toModule(require_lib6());
var _path2 = require("path");
var _esbuild = require("esbuild");
var _fs2 = require("fs");
var _fs3 = _interopRequireDefault2(_fs2);
var _module2 = require("module");
var _module3 = _interopRequireDefault2(_module2);
var _process = require("process");
var _process2 = _interopRequireDefault2(_process);
var import_joycon = __toModule(require_lib22());
var singleComment = Symbol("singleComment");
var multiComment = Symbol("multiComment");
var stripWithoutWhitespace = () => "";
var stripWithWhitespace = (string, start, end) => string.slice(start, end).replace(/\S/g, " ");
var isEscaped = (jsonString, quotePosition) => {
let index4 = quotePosition - 1;
let backslashCount = 0;
while (jsonString[index4] === "\\") {
index4 -= 1;
backslashCount += 1;
}
return Boolean(backslashCount % 2);
};
function stripJsonComments(jsonString, { whitespace = true } = {}) {
if (typeof jsonString !== "string") {
throw new TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof jsonString}\``);
}
const strip = whitespace ? stripWithWhitespace : stripWithoutWhitespace;
let isInsideString = false;
let isInsideComment = false;
let offset = 0;
let result = "";
for (let index4 = 0; index4 < jsonString.length; index4++) {
const currentCharacter = jsonString[index4];
const nextCharacter = jsonString[index4 + 1];
if (!isInsideComment && currentCharacter === '"') {
const escaped = isEscaped(jsonString, index4);
if (!escaped) {
isInsideString = !isInsideString;
}
}
if (isInsideString) {
continue;
}
if (!isInsideComment && currentCharacter + nextCharacter === "//") {
result += jsonString.slice(offset, index4);
offset = index4;
isInsideComment = singleComment;
index4++;
} else if (isInsideComment === singleComment && currentCharacter + nextCharacter === "\r\n") {
index4++;
isInsideComment = false;
result += strip(jsonString, offset, index4);
offset = index4;
continue;
} else if (isInsideComment === singleComment && currentCharacter === "\n") {
isInsideComment = false;
result += strip(jsonString, offset, index4);
offset = index4;
} else if (!isInsideComment && currentCharacter + nextCharacter === "/*") {
result += jsonString.slice(offset, index4);
offset = index4;
isInsideComment = multiComment;
index4++;
continue;
} else if (isInsideComment === multiComment && currentCharacter + nextCharacter === "*/") {
index4++;
isInsideComment = false;
result += strip(jsonString, offset, index4 + 1);
offset = index4 + 1;
continue;
}
}
return result + (isInsideComment ? strip(jsonString.slice(offset)) : jsonString.slice(offset));
}
var nodeVersion = (process.versions.node.match(/^(\d+)\.(\d+)/) || []).slice(1).map(Number);
function removeNodePrefix(code) {
if (nodeVersion[0] <= 14 && nodeVersion[1] < 18) {
return code.replace(/([\b\(])require\("node:([^"]+)"\)([\b\)])/g, '$1require("$2")$3');
}
return code;
}
function jsoncParse(data) {
try {
return new Function("return " + stripJsonComments(data).trim())();
} catch (_) {
return {};
}
}
var joycon = new import_joycon.default();
joycon.addLoader({
test: /\.json$/,
loadSync: (file) => {
const content = _fs3.default.readFileSync(file, "utf8");
return jsoncParse(content);
}
});
var getOptions = (cwd) => {
var _a, _b, _c, _d;
const { data, path: path3 } = joycon.loadSync(["tsconfig.json", "jsconfig.json"], cwd);
if (path3 && data) {
return {
jsxFactory: (_a = data.compilerOptions) == null ? void 0 : _a.jsxFactory,
jsxFragment: (_b = data.compilerOptions) == null ? void 0 : _b.jsxFragmentFactory,
target: (_d = (_c = data.compilerOptions) == null ? void 0 : _c.target) == null ? void 0 : _d.toLowerCase()
};
}
return {};
};
var inferPackageFormat = (cwd, filename) => {
if (filename.endsWith(".mjs")) {
return "esm";
}
if (filename.endsWith(".cjs")) {
return "cjs";
}
const { data } = joycon.loadSync(["package.json"], cwd);
return data && data.type === "module" && /\.m?js$/.test(filename) ? "esm" : "cjs";
};
var import_tsconfig_paths = __toModule(require_lib42());
var noOp = () => {
};
function registerTsconfigPaths() {
const configLoaderResult = (0, import_tsconfig_paths.loadConfig)(process.cwd());
if (configLoaderResult.resultType === "failed") {
return noOp;
}
const matchPath = (0, import_tsconfig_paths.createMatchPath)(configLoaderResult.absoluteBaseUrl, configLoaderResult.paths, configLoaderResult.mainFields, configLoaderResult.addMatchAll);
const Module = require("module");
const originalResolveFilename = Module._resolveFilename;
Module._resolveFilename = function(request, _parent) {
const isCoreModule = _module2.builtinModules.includes(request);
if (!isCoreModule) {
const found = matchPath(request);
if (found) {
const modifiedArguments = [found, ...[].slice.call(arguments, 1)];
return originalResolveFilename.apply(this, modifiedArguments);
}
}
return originalResolveFilename.apply(this, arguments);
};
return () => {
Module._resolveFilename = originalResolveFilename;
};
}
var _debug = require_src2();
var _debug2 = _interopRequireDefault2(_debug);
var debug = _debug2.default.call(void 0, "esbuild-register");
var IMPORT_META_URL_VARIABLE_NAME = "__esbuild_register_import_meta_url__";
var map = {};
function installSourceMapSupport() {
if (_process2.default.setSourceMapsEnabled) {
;
_process2.default.setSourceMapsEnabled(true);
} else {
import_source_map_support.default.install({
handleUncaughtExceptions: false,
environment: "node",
retrieveSourceMap(file) {
if (map[file]) {
return {
url: file,
map: map[file]
};
}
return null;
}
});
}
}
function patchCommonJsLoader(compile) {
const extensions = _module3.default.Module._extensions;
const jsHandler = extensions[".js"];
extensions[".js"] = function(module22, filename) {
try {
return jsHandler.call(this, module22, filename);
} catch (error2) {
if (error2.code !== "ERR_REQUIRE_ESM") {
throw error2;
}
let content = _fs3.default.readFileSync(filename, "utf8");
content = compile(content, filename, "cjs");
module22._compile(content, filename);
}
};
return () => {
extensions[".js"] = jsHandler;
};
}
var FILE_LOADERS = {
".js": "js",
".jsx": "jsx",
".ts": "ts",
".tsx": "tsx",
".mjs": "js",
".mts": "ts",
".cts": "ts"
};
var DEFAULT_EXTENSIONS = Object.keys(FILE_LOADERS);
var getLoader = (filename) => FILE_LOADERS[_path2.extname.call(void 0, filename)];
function register2(esbuildOptions = {}) {
const {
extensions = DEFAULT_EXTENSIONS,
hookIgnoreNodeModules = true,
hookMatcher,
...overrides
} = esbuildOptions;
const compile = function compile2(code, filename, format) {
const define = {
"import.meta.url": IMPORT_META_URL_VARIABLE_NAME,
...overrides.define
};
const banner = `const ${IMPORT_META_URL_VARIABLE_NAME} = require('url').pathToFileURL(__filename).href;${overrides.banner || ""}`;
if (code.includes(banner)) {
return code;
}
const dir = _path2.dirname.call(void 0, filename);
const options = getOptions(dir);
format = format != null ? format : inferPackageFormat(dir, filename);
const result = _esbuild.transformSync.call(void 0, code, {
sourcefile: filename,
loader: getLoader(filename),
sourcemap: "both",
target: options.target,
jsxFactory: options.jsxFactory,
jsxFragment: options.jsxFragment,
format,
define,
banner,
...overrides
});
const js = result.code;
debug("compiled %s", filename);
debug("%s", js);
const warnings = result.warnings;
if (warnings && warnings.length > 0) {
for (const warning2 of warnings) {
console.log(warning2.location);
console.log(warning2.text);
}
}
if (format === "esm")
return js;
return removeNodePrefix(js);
};
const revert = (0, import_pirates.addHook)(compile, {
exts: extensions,
ignoreNodeModules: hookIgnoreNodeModules,
matcher: hookMatcher
});
installSourceMapSupport();
const unpatchCommonJsLoader = patchCommonJsLoader(compile);
const unregisterTsconfigPaths = registerTsconfigPaths();
return {
unregister() {
revert();
unpatchCommonJsLoader();
unregisterTsconfigPaths();
}
};
}
exports.register = register2;
}
});
// src/cli/commands/utils.ts
var import_path, import_fs, import_hanji2, import_node, safeRegister, prepareGenerateConfig, assertOutFolder, configCommonSchema, introspectCasing, configIntrospectSchema, configIntrospectCliSchema, configGenerateSchema, configPushSchema, mysqlConnectionSchema, mySqlCliConfigSchema, mySqlIntrospectConfigSchema, drizzleConfigFromFile, readDrizzleConfig;
var init_utils = __esm({
"src/cli/commands/utils.ts"() {
init_serializer();
init_lib();
import_path = require("path");
init_source();
import_fs = require("fs");
init_views();
import_hanji2 = __toESM(require_hanji());
import_node = __toESM(require_node2());
safeRegister = () => {
try {
return (0, import_node.register)({
format: "cjs",
loader: "ts"
});
} catch {
return {
unregister: () => {
}
};
}
};
prepareGenerateConfig = async (options) => {
const { schema: schema4, out, config, breakpoints, custom } = options;
if (!(schema4 && out)) {
const drizzleConfig = await drizzleConfigFromFile(config);
if (!drizzleConfig.out) {
console.log("You must specify 'out' param in config file");
process.exit(1);
}
return {
custom,
breakpoints: drizzleConfig.breakpoints ?? false,
schema: drizzleConfig.schema,
out: drizzleConfig.out
};
}
if (!schema4) {
console.error(`'schema' param must be set`);
process.exit(1);
}
const fileNames = prepareFilenames(schema4);
if (fileNames.length === 0) {
(0, import_hanji2.render)(`[${source_default.blue("i")}] No schema file in ${schema4} was found`);
process.exit(0);
}
if (!out) {
console.error(`'out' param must be set`);
process.exit(1);
}
return { schema: schema4, out, breakpoints, custom };
};
assertOutFolder = async (it) => {
if ("out" in it)
return it.out;
const cliConfig = await drizzleConfigFromFile(it.config);
if (!cliConfig.out) {
console.log(
error(
`'out' folder param must be set through '--out' param or in config file`
)
);
process.exit(0);
}
return cliConfig.out;
};
configCommonSchema = objectType({
schema: unionType([stringType(), stringType().array()]),
out: stringType().optional(),
breakpoints: booleanType().default(true),
tablesFilter: unionType([stringType(), stringType().array()]).optional()
});
introspectCasing = objectType({
casing: unionType([literalType("camel"), literalType("preserve")]).default("camel")
}).default({ casing: "camel" });
configIntrospectSchema = objectType({
schema: unionType([stringType(), stringType().array()]).optional(),
out: stringType().optional().default("./drizzle"),
breakpoints: booleanType().default(true),
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
introspect: introspectCasing
});
configIntrospectCliSchema = objectType({
schema: unionType([stringType(), stringType().array()]).optional(),
out: stringType().optional().default("./drizzle"),
breakpoints: booleanType().default(true),
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
introspectCasing: unionType([literalType("camel"), literalType("preserve")]).default(
"camel"
)
});
configGenerateSchema = objectType({
schema: unionType([stringType(), stringType().array()]),
out: stringType().optional().default("./drizzle"),
breakpoints: booleanType().default(true)
});
configPushSchema = objectType({
schema: unionType([stringType(), stringType().array()]),
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
verbose: booleanType().default(false),
strict: booleanType().default(false)
});
mysqlConnectionSchema = unionType([
objectType({
host: stringType(),
port: coerce.number().optional(),
user: stringType().default("mysql"),
password: stringType().optional(),
database: stringType()
// ssl: boolean().optional(),
}),
objectType({
connectionString: stringType()
}),
objectType({})
]);
mySqlCliConfigSchema = intersectionType(
configCommonSchema,
mysqlConnectionSchema
);
mySqlIntrospectConfigSchema = intersectionType(
configIntrospectSchema,
mysqlConnectionSchema
);
drizzleConfigFromFile = async (configPath) => {
const defaultTsConfigExists = (0, import_fs.existsSync)((0, import_path.join)((0, import_path.resolve)("drizzle.config.ts")));
const defaultJsConfigExists = (0, import_fs.existsSync)((0, import_path.join)((0, import_path.resolve)("drizzle.config.js")));
const defaultJsonConfigExists = (0, import_fs.existsSync)(
(0, import_path.join)((0, import_path.resolve)("drizzle.config.json"))
);
const defaultConfigPath = defaultTsConfigExists ? "drizzle.config.ts" : defaultJsConfigExists ? "drizzle.config.js" : "drizzle.config.json";
if (!configPath) {
console.log(
source_default.gray(
`No config path provided, using default '${defaultConfigPath}'`
)
);
}
const path3 = (0, import_path.join)((0, import_path.resolve)(configPath ?? defaultConfigPath));
if (!(0, import_fs.existsSync)(path3)) {
console.log(`${path3} file does not exist`);
process.exit(1);
}
console.log(source_default.grey(`Reading config file '${path3}'`));
const { unregister } = safeRegister();
const required = require(`${path3}`);
const content = required.default ?? required;
unregister();
const res = mySqlCliConfigSchema.safeParse(content);
if (!res.success) {
console.error(res.error);
console.log("Missing required params");
process.exit(1);
}
return res.data;
};
readDrizzleConfig = async (configPath) => {
const defaultTsConfigExists = (0, import_fs.existsSync)((0, import_path.join)((0, import_path.resolve)("drizzle.config.ts")));
const defaultJsConfigExists = (0, import_fs.existsSync)((0, import_path.join)((0, import_path.resolve)("drizzle.config.js")));
const defaultJsonConfigExists = (0, import_fs.existsSync)(
(0, import_path.join)((0, import_path.resolve)("drizzle.config.json"))
);
const defaultConfigPath = defaultTsConfigExists ? "drizzle.config.ts" : defaultJsConfigExists ? "drizzle.config.js" : "drizzle.config.json";
if (!configPath) {
console.log(
source_default.gray(
`No config path provided, using default '${defaultConfigPath}'`
)
);
}
const path3 = (0, import_path.join)((0, import_path.resolve)(configPath ?? defaultConfigPath));
if (!(0, import_fs.existsSync)(path3)) {
console.log(source_default.red(`${path3} file does not exist`));
process.exit(1);
}
console.log(source_default.grey(`Reading config file '${path3}'`));
const { unregister } = safeRegister();
const required = require(`${path3}`);
const content = required.default ?? required;
unregister();
return content;
};
}
});
// src/serializer/mysqlImports.ts
var mysqlImports_exports = {};
__export(mysqlImports_exports, {
prepareFromMySqlImports: () => prepareFromMySqlImports
});
var import_mysql_core, import_drizzle_orm, prepareFromMySqlImports;
var init_mysqlImports = __esm({
"src/serializer/mysqlImports.ts"() {
import_mysql_core = require("drizzle-orm/mysql-core");
import_drizzle_orm = require("drizzle-orm");
init_utils();
prepareFromMySqlImports = async (imports) => {
const tables = [];
const enums = [];
const schemas = [];
const { unregister } = safeRegister();
for (let i = 0; i < imports.length; i++) {
const it = imports[i];
const i0 = require(`${it}`);
const i0values = Object.values(i0);
i0values.forEach((t) => {
if ((0, import_drizzle_orm.is)(t, import_mysql_core.MySqlTable)) {
tables.push(t);
}
if ((0, import_drizzle_orm.is)(t, import_mysql_core.MySqlSchema)) {
schemas.push(t);
}
});
}
unregister();
return { tables, enums, schemas };
};
}
});
// src/serializer/mysqlSerializer.ts
var mysqlSerializer_exports = {};
__export(mysqlSerializer_exports, {
fromDatabase: () => fromDatabase,
generateMySqlSnapshot: () => generateMySqlSnapshot,
indexName: () => indexName
});
function clearDefaults(defaultValue, collate) {
if (typeof collate === "undefined" || collate === null) {
collate = `utf8mb4`;
}
let resultDefault = defaultValue;
collate = `_${collate}`;
if (defaultValue.startsWith(collate)) {
resultDefault = resultDefault.substring(collate.length, defaultValue.length).replace(/\\/g, "");
if (resultDefault.startsWith("'") && resultDefault.endsWith("'")) {
return `('${resultDefault.substring(1, resultDefault.length - 1)}')`;
} else {
return `('${resultDefault}')`;
}
} else {
return `(${resultDefault})`;
}
}
var import_mysql_core2, import_drizzle_orm2, import_mysql_core3, import_drizzle_orm3, dialect3, indexName, generateMySqlSnapshot, fromDatabase;
var init_mysqlSerializer = __esm({
"src/serializer/mysqlSerializer.ts"() {
import_mysql_core2 = require("drizzle-orm/mysql-core");
import_drizzle_orm2 = require("drizzle-orm");
import_mysql_core3 = require("drizzle-orm/mysql-core");
import_drizzle_orm3 = require("drizzle-orm");
init_serializer();
dialect3 = new import_mysql_core2.MySqlDialect();
indexName = (tableName, columns) => {
return `${tableName}_${columns.join("_")}_index`;
};
generateMySqlSnapshot = (tables, enums, mysqlSchemas) => {
const result = {};
for (const table4 of tables) {
const {
name: tableName,
columns,
indexes,
foreignKeys,
schema: schema4,
primaryKeys
} = (0, import_mysql_core3.getTableConfig)(table4);
const columnsObject = {};
const indexesObject = {};
const foreignKeysObject = {};
const primaryKeysObject = {};
columns.forEach((column7) => {
const notNull = column7.notNull;
const primaryKey = column7.primary;
const sqlTypeLowered = column7.getSQLType().toLowerCase();
const columnToSet = {
name: column7.name,
type: column7.getSQLType(),
primaryKey,
notNull,
autoincrement: typeof column7.autoIncrement === "undefined" ? false : column7.autoIncrement,
onUpdate: column7.hasOnUpdateNow
// autoincrement:
// column instanceof MySqlColumnWithAutoIncrement
// ? column.autoIncrement
// : false,
// onUpdate:
// column instanceof MySqlDateBaseColumn
// ? column.hasOnUpdateNow
// : undefined,
};
if (column7.default !== void 0) {
if ((0, import_drizzle_orm2.is)(column7.default, import_drizzle_orm3.SQL)) {
columnToSet.default = sqlToStr(column7.default);
} else {
if (typeof column7.default === "string") {
columnToSet.default = `'${column7.default}'`;
} else {
if (sqlTypeLowered === "json") {
columnToSet.default = `'${JSON.stringify(column7.default)}'`;
} else if (column7.default instanceof Date) {
if (sqlTypeLowered === "date") {
columnToSet.default = `'${column7.default.toISOString().split("T")[0]}'`;
} else if (sqlTypeLowered.startsWith("datetime") || sqlTypeLowered.startsWith("timestamp")) {
columnToSet.default = `'${column7.default.toISOString().replace("T", " ").slice(0, 23)}'`;
}
} else {
columnToSet.default = column7.default;
}
}
if (["blob", "text", "json"].includes(column7.getSQLType())) {
columnToSet.default = `(${columnToSet.default})`;
}
}
}
columnsObject[column7.name] = columnToSet;
});
primaryKeys.map((pk) => {
const columnNames = pk.columns.map((c) => c.name).sort();
primaryKeysObject[`${tableName}_${columnNames.join("_")}`] = {
name: `${tableName}_${columnNames.join("_")}`,
columns: columnNames
};
for (const column7 of pk.columns) {
columnsObject[column7.name].notNull = true;
}
});
const fks = foreignKeys.map((fk4) => {
const name = fk4.getName();
const tableFrom = tableName;
const onDelete = fk4.onDelete ?? "no action";
const onUpdate = fk4.onUpdate ?? "no action";
const reference = fk4.reference();
const referenceFT = reference.foreignTable;
const tableTo = (0, import_drizzle_orm2.getTableName)(referenceFT);
const columnsFrom = reference.columns.map((it) => it.name);
const columnsTo = reference.foreignColumns.map((it) => it.name);
return {
name,
tableFrom,
tableTo,
columnsFrom,
columnsTo,
onDelete,
onUpdate
};
});
fks.forEach((it) => {
foreignKeysObject[it.name] = it;
});
indexes.forEach((value) => {
const columns2 = value.config.columns;
const name = value.config.name;
let indexColumns = columns2.map((it) => {
if ((0, import_drizzle_orm2.is)(it, import_drizzle_orm3.SQL)) {
return dialect3.sqlToQuery(it).sql;
} else {
return it.name;
}
});
indexesObject[name] = {
name,
columns: indexColumns,
isUnique: value.config.unique ?? false,
using: value.config.using,
algorithm: value.config.algorythm,
lock: value.config.lock
};
});
result[tableName] = {
name: tableName,
schema: schema4,
columns: columnsObject,
indexes: indexesObject,
foreignKeys: foreignKeysObject,
compositePrimaryKeys: primaryKeysObject
};
}
const schemas = Object.fromEntries(
mysqlSchemas.map((it) => [it.schemaName, it.schemaName])
);
return {
version: "5",
dialect: "mysql",
tables: result,
schemas,
_meta: {
schemas: {},
tables: {},
columns: {}
}
};
};
fromDatabase = async (db, inputSchema, tablesFilter = (table4) => true, progressCallback) => {
const result = {};
const columns = await db.execute(`select * from information_schema.columns
where table_schema = '${inputSchema}' and table_name != '__drizzle_migrations'
order by table_name, ordinal_position;`);
const response = columns[0];
const schemas = [];
let columnsCount = 0;
let tablesCount = /* @__PURE__ */ new Set();
let indexesCount = 0;
let foreignKeysCount = 0;
const tableToPk = {};
for (const column7 of response) {
if (!tablesFilter(column7["TABLE_NAME"]))
continue;
columnsCount += 1;
if (progressCallback) {
progressCallback("columns", columnsCount, "fetching");
}
const schema4 = column7["TABLE_SCHEMA"];
const tableName = column7["TABLE_NAME"];
tablesCount.add(`${schema4}.${tableName}`);
if (progressCallback) {
progressCallback("columns", tablesCount.size, "fetching");
}
const columnName = column7["COLUMN_NAME"];
const isNullable = column7["IS_NULLABLE"] === "YES";
const dataType = column7["DATA_TYPE"];
const columnType = column7["COLUMN_TYPE"];
const isPrimary = column7["COLUMN_KEY"] === "PRI";
const columnDefault = column7["COLUMN_DEFAULT"];
const collation = column7["CHARACTER_SET_NAME"];
let columnExtra = column7["EXTRA"];
let isAutoincrement = false;
let isDefaultAnExpression = false;
if (typeof column7["EXTRA"] !== "undefined") {
columnExtra = column7["EXTRA"];
isAutoincrement = column7["EXTRA"] === "auto_increment";
isDefaultAnExpression = column7["EXTRA"].includes("DEFAULT_GENERATED");
}
if (isPrimary) {
if (typeof tableToPk[tableName] === "undefined") {
tableToPk[tableName] = [columnName];
} else {
tableToPk[tableName].push(columnName);
}
}
if (schema4 !== inputSchema) {
schemas.push(schema4);
}
const table4 = result[tableName];
let changedType = columnType.replace("bigint unsigned", "serial");
if (columnType.startsWith("tinyint")) {
changedType = "tinyint";
}
let onUpdate = void 0;
if (columnType.startsWith("timestamp") && typeof columnExtra !== "undefined" && columnExtra.includes("on update CURRENT_TIMESTAMP")) {
onUpdate = true;
}
const newColumn = {
default: columnDefault === null ? void 0 : /^-?[\d.]+(?:e-?\d+)?$/.test(columnDefault) ? Number(columnDefault) : isDefaultAnExpression ? clearDefaults(columnDefault, collation) : `'${columnDefault}'`,
autoincrement: isAutoincrement,
name: columnName,
type: changedType,
primaryKey: false,
notNull: !isNullable,
onUpdate
};
if (!table4) {
result[tableName] = {
name: tableName,
schema: schema4 !== inputSchema ? schema4 : void 0,
columns: {
[columnName]: newColumn
},
compositePrimaryKeys: {},
indexes: {},
foreignKeys: {}
};
} else {
result[tableName].columns[columnName] = newColumn;
}
}
for (const [key, value] of Object.entries(tableToPk)) {
if (value.length > 1) {
result[key].compositePrimaryKeys = {
[`${key}_${value.sort().join("_")}`]: {
name: `${key}_${value.join("_")}`,
columns: value.sort()
}
};
} else if (value.length === 1) {
result[key].columns[value[0]].primaryKey = true;
} else {
}
}
if (progressCallback) {
progressCallback("columns", columnsCount, "done");
progressCallback("tables", tablesCount.size, "done");
}
try {
const fks = await db.execute(
`SELECT INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_SCHEMA,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.COLUMN_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_TABLE_SCHEMA,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_TABLE_NAME, INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_COLUMN_NAME,information_schema.referential_constraints.UPDATE_RULE, information_schema.referential_constraints.DELETE_RULE
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
LEFT JOIN information_schema.referential_constraints on information_schema.referential_constraints.constraint_name = information_schema.KEY_COLUMN_USAGE.CONSTRAINT_NAME
WHERE INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_SCHEMA = ? AND INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME != 'PRIMARY' and INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_TABLE_NAME is not null;
`,
[inputSchema]
);
const fkRows = fks[0];
for (const fkRow of fkRows) {
foreignKeysCount += 1;
if (progressCallback) {
progressCallback("fks", foreignKeysCount, "fetching");
}
const tableSchema = fkRow["TABLE_SCHEMA"];
const tableName = fkRow["TABLE_NAME"];
const constraintName = fkRow["CONSTRAINT_NAME"];
const columnName = fkRow["COLUMN_NAME"];
const refTableSchema = fkRow["REFERENCED_TABLE_SCHEMA"];
const refTableName = fkRow["REFERENCED_TABLE_NAME"];
const refColumnName = fkRow["REFERENCED_COLUMN_NAME"];
const updateRule = fkRow["UPDATE_RULE"];
const deleteRule = fkRow["DELETE_RULE"];
const tableInResult = result[tableName];
if (typeof tableInResult === "undefined")
continue;
if (typeof tableInResult.foreignKeys[constraintName] !== "undefined") {
tableInResult.foreignKeys[constraintName].columnsFrom.push(columnName);
tableInResult.foreignKeys[constraintName].columnsTo.push(
refColumnName
);
} else {
tableInResult.foreignKeys[constraintName] = {
name: constraintName,
tableFrom: tableName,
tableTo: refTableName,
columnsFrom: [columnName],
columnsTo: [refColumnName],
onDelete: deleteRule == null ? void 0 : deleteRule.toLowerCase(),
onUpdate: updateRule == null ? void 0 : updateRule.toLowerCase()
};
}
tableInResult.foreignKeys[constraintName].columnsFrom = [
...new Set(tableInResult.foreignKeys[constraintName].columnsFrom)
];
tableInResult.foreignKeys[constraintName].columnsTo = [
...new Set(tableInResult.foreignKeys[constraintName].columnsTo)
];
}
} catch (e) {
}
if (progressCallback) {
progressCallback("fks", foreignKeysCount, "done");
}
const idxs = await db.execute(
`select * from INFORMATION_SCHEMA.STATISTICS
WHERE INFORMATION_SCHEMA.STATISTICS.TABLE_SCHEMA = ? and INFORMATION_SCHEMA.STATISTICS.INDEX_NAME != 'PRIMARY';`,
[inputSchema]
);
const idxRows = idxs[0];
for (const idxRow of idxRows) {
const tableSchema = idxRow["TABLE_SCHEMA"];
const tableName = idxRow["TABLE_NAME"];
const constraintName = idxRow["INDEX_NAME"];
const columnName = idxRow["COLUMN_NAME"];
const isUnique = idxRow["NON_UNIQUE"] === 0;
const tableInResult = result[tableName];
if (typeof tableInResult === "undefined")
continue;
if (tableInResult.columns[columnName].type === "serial")
continue;
indexesCount += 1;
if (progressCallback) {
progressCallback("indexes", indexesCount, "fetching");
}
if (typeof tableInResult.indexes[constraintName] !== "undefined") {
tableInResult.indexes[constraintName].columns.push(columnName);
} else {
tableInResult.indexes[constraintName] = {
name: constraintName,
columns: [columnName],
isUnique
};
}
}
if (progressCallback) {
progressCallback("indexes", indexesCount, "done");
progressCallback("enums", 0, "done");
}
const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
return {
version: "5",
dialect: "mysql",
tables: result,
schemas: schemasObject,
_meta: {
schemas: {},
tables: {},
columns: {}
}
};
};
}
});
// src/serializer/pgImports.ts
var pgImports_exports = {};
__export(pgImports_exports, {
prepareFromPgImports: () => prepareFromPgImports
});
var import_pg_core, import_drizzle_orm4, prepareFromPgImports;
var init_pgImports = __esm({
"src/serializer/pgImports.ts"() {
import_pg_core = require("drizzle-orm/pg-core");
import_drizzle_orm4 = require("drizzle-orm");
init_utils();
prepareFromPgImports = async (imports) => {
const tables = [];
const enums = [];
const schemas = [];
const { unregister } = safeRegister();
for (let i = 0; i < imports.length; i++) {
const it = imports[i];
const i0 = require(`${it}`);
const i0values = Object.values(i0);
i0values.forEach((t) => {
if ((0, import_pg_core.isPgEnum)(t)) {
enums.push(t);
return;
}
if ((0, import_drizzle_orm4.is)(t, import_pg_core.PgTable)) {
tables.push(t);
}
if ((0, import_drizzle_orm4.is)(t, import_pg_core.PgSchema)) {
schemas.push(t);
}
});
}
unregister();
return { tables, enums, schemas };
};
}
});
// src/serializer/pgSerializer.ts
var pgSerializer_exports = {};
__export(pgSerializer_exports, {
fromDatabase: () => fromDatabase2,
generatePgSnapshot: () => generatePgSnapshot,
indexName: () => indexName2
});
var import_pg_core2, import_pg_core3, import_drizzle_orm5, import_drizzle_orm6, dialect4, indexName2, generatePgSnapshot, trimChar, fromDatabase2, columnToDefault, defaultForColumn;
var init_pgSerializer = __esm({
"src/serializer/pgSerializer.ts"() {
import_pg_core2 = require("drizzle-orm/pg-core");
import_pg_core3 = require("drizzle-orm/pg-core");
import_drizzle_orm5 = require("drizzle-orm");
import_drizzle_orm6 = require("drizzle-orm");
init_serializer();
dialect4 = new import_pg_core2.PgDialect();
indexName2 = (tableName, columns) => {
return `${tableName}_${columns.join("_")}_index`;
};
generatePgSnapshot = (tables, enums, schemas) => {
const result = {};
for (const table4 of tables) {
const {
name: tableName,
columns,
indexes,
foreignKeys,
checks,
schema: schema4,
primaryKeys
} = (0, import_pg_core3.getTableConfig)(table4);
const columnsObject = {};
const indexesObject = {};
const foreignKeysObject = {};
const primaryKeysObject = {};
columns.forEach((column7) => {
const notNull = column7.notNull;
const primaryKey = column7.primary;
const sqlTypeLowered = column7.getSQLType().toLowerCase();
const columnToSet = {
name: column7.name,
type: column7.getSQLType(),
primaryKey,
notNull
};
if (column7.default !== void 0) {
if ((0, import_drizzle_orm5.is)(column7.default, import_drizzle_orm5.SQL)) {
columnToSet.default = sqlToStr(column7.default);
} else {
if (typeof column7.default === "string") {
columnToSet.default = `'${column7.default}'`;
} else {
if (sqlTypeLowered === "jsonb" || sqlTypeLowered === "json") {
columnToSet.default = `'${JSON.stringify(
column7.default
)}'::${sqlTypeLowered}`;
} else if (column7.default instanceof Date) {
if (sqlTypeLowered === "date") {
columnToSet.default = `'${column7.default.toISOString().split("T")[0]}'`;
} else if (sqlTypeLowered === "timestamp") {
columnToSet.default = `'${column7.default.toISOString().replace("T", " ").slice(0, 23)}'`;
} else {
columnToSet.default = `'${column7.default.toISOString()}'`;
}
} else {
columnToSet.default = column7.default;
}
}
}
}
columnsObject[column7.name] = columnToSet;
});
primaryKeys.map((pk) => {
const columnNames = pk.columns.map((c) => c.name);
primaryKeysObject[`${tableName}_${columnNames.join("_")}`] = {
name: `${tableName}_${columnNames.join("_")}`,
columns: columnNames
};
});
const fks = foreignKeys.map((fk4) => {
const name = fk4.getName();
const tableFrom = tableName;
const onDelete = fk4.onDelete;
const onUpdate = fk4.onUpdate;
const reference = fk4.reference();
const tableTo = (0, import_drizzle_orm6.getTableName)(reference.foreignTable);
const columnsFrom = reference.columns.map((it) => it.name);
const columnsTo = reference.foreignColumns.map((it) => it.name);
return {
name,
tableFrom,
tableTo,
columnsFrom,
columnsTo,
onDelete,
onUpdate
};
});
fks.forEach((it) => {
foreignKeysObject[it.name] = it;
});
indexes.forEach((value) => {
const columns2 = value.config.columns;
let name = value.config.name;
name = name ? name : indexName2(
tableName,
columns2.map((it) => it.name)
);
let indexColumns = columns2.map((it) => {
if ((0, import_drizzle_orm5.is)(it, import_drizzle_orm5.SQL)) {
return dialect4.sqlToQuery(it).sql;
} else {
return it.name;
}
});
indexesObject[name] = {
name,
columns: indexColumns,
isUnique: value.config.unique ?? false
};
});
result[tableName] = {
name: tableName,
schema: schema4 ?? "",
columns: columnsObject,
indexes: indexesObject,
foreignKeys: foreignKeysObject,
compositePrimaryKeys: primaryKeysObject
};
}
const enumsToReturn = enums.reduce((map, obj) => {
const key = obj.enumName;
const newValues = obj.enumValues.reduce((mapped, value) => {
mapped[value] = value;
return mapped;
}, {});
map[key] = { name: obj.enumName, values: newValues };
return map;
}, {});
const schemasObject = Object.fromEntries(
schemas.filter((it) => it.schemaName !== "public").map((it) => [it.schemaName, it.schemaName])
);
return {
version: "5",
dialect: "pg",
tables: result,
enums: enumsToReturn,
schemas: schemasObject,
_meta: {
schemas: {},
tables: {},
columns: {}
}
};
};
trimChar = (str, char) => {
let start = 0;
let end = str.length;
while (start < end && str[start] === char)
++start;
while (end > start && str[end - 1] === char)
--end;
return start > 0 || end < str.length ? str.substring(start, end) : str.toString();
};
fromDatabase2 = async (db, tablesFilter = (table4) => true, progressCallback) => {
const result = {};
const allTables = await db.query(
`SELECT table_schema, table_name FROM information_schema.tables WHERE table_schema = 'public';`
);
const schemas = new Set(allTables.rows.map((it) => it.table_schema));
schemas.delete("public");
let columnsCount = 0;
let indexesCount = 0;
let foreignKeysCount = 0;
let tableCount = 0;
const all = allTables.rows.map((row) => {
return new Promise(async (res, rej) => {
const tableName = row.table_name;
if (!tablesFilter(tableName))
return res("");
tableCount += 1;
const tableSchema = row.table_schema;
try {
const columnToReturn = {};
const indexToReturn = {};
const foreignKeysToReturn = {};
const primaryKeys = {};
const tableResponse = await db.query(
`SELECT a.attrelid::regclass::text, a.attname, is_nullable, a.attndims as array_dimensions
, CASE WHEN a.atttypid = ANY ('{int,int8,int2}'::regtype[])
AND EXISTS (
SELECT FROM pg_attrdef ad
WHERE ad.adrelid = a.attrelid
AND ad.adnum = a.attnum
AND pg_get_expr(ad.adbin, ad.adrelid)
= 'nextval('''
|| (pg_get_serial_sequence (a.attrelid::regclass::text
, a.attname))::regclass
|| '''::regclass)'
)
THEN CASE a.atttypid
WHEN 'int'::regtype THEN 'serial'
WHEN 'int8'::regtype THEN 'bigserial'
WHEN 'int2'::regtype THEN 'smallserial'
END
ELSE format_type(a.atttypid, a.atttypmod)
END AS data_type, INFORMATION_SCHEMA.COLUMNS.table_name, INFORMATION_SCHEMA.COLUMNS.column_name, INFORMATION_SCHEMA.COLUMNS.column_default, INFORMATION_SCHEMA.COLUMNS.data_type as additional_dt
FROM pg_attribute a
JOIN INFORMATION_SCHEMA.COLUMNS ON INFORMATION_SCHEMA.COLUMNS.column_name = a.attname
WHERE a.attrelid = '"${tableName}"'::regclass and INFORMATION_SCHEMA.COLUMNS.table_name = '${tableName}'
AND a.attnum > 0
AND NOT a.attisdropped
ORDER BY a.attnum;`
);
const tableConstraints = await db.query(
`SELECT c.column_name, c.data_type, constraint_type, constraint_name
FROM information_schema.table_constraints tc
JOIN information_schema.constraint_column_usage AS ccu USING (constraint_schema, constraint_name)
JOIN information_schema.columns AS c ON c.table_schema = tc.constraint_schema
AND tc.table_name = c.table_name AND ccu.column_name = c.column_name
WHERE tc.table_name = '${tableName}';`
);
columnsCount += tableResponse.rows.length;
if (progressCallback) {
progressCallback("columns", columnsCount, "fetching");
}
const tableForeignKeys = await db.query(
`SELECT
tc.table_schema,
tc.constraint_name,
tc.table_name,
kcu.column_name,
ccu.table_schema AS foreign_table_schema,
ccu.table_name AS foreign_table_name,
ccu.column_name AS foreign_column_name,
rc.delete_rule, rc.update_rule
FROM
information_schema.table_constraints AS tc
JOIN information_schema.key_column_usage AS kcu
ON tc.constraint_name = kcu.constraint_name
AND tc.table_schema = kcu.table_schema
JOIN information_schema.constraint_column_usage AS ccu
ON ccu.constraint_name = tc.constraint_name
AND ccu.table_schema = tc.table_schema
JOIN information_schema.referential_constraints AS rc
ON ccu.constraint_name = rc.constraint_name
WHERE tc.constraint_type = 'FOREIGN KEY' AND tc.table_name='${tableName}';`
);
foreignKeysCount += tableForeignKeys.rows.length;
if (progressCallback) {
progressCallback("fks", foreignKeysCount, "fetching");
}
for (const fk4 of tableForeignKeys.rows) {
const columnFrom = fk4.column_name;
const tableTo = fk4.foreign_table_name;
const columnTo = fk4.foreign_column_name;
const foreignKeyName = fk4.constraint_name;
const onUpdate = fk4.update_rule.toLowerCase();
const onDelete = fk4.delete_rule.toLowerCase();
if (typeof foreignKeysToReturn[foreignKeyName] !== "undefined") {
foreignKeysToReturn[foreignKeyName].columnsFrom.push(columnFrom);
foreignKeysToReturn[foreignKeyName].columnsTo.push(columnTo);
} else {
foreignKeysToReturn[foreignKeyName] = {
name: foreignKeyName,
tableFrom: tableName,
tableTo,
columnsFrom: [columnFrom],
columnsTo: [columnTo],
onDelete,
onUpdate
};
}
foreignKeysToReturn[foreignKeyName].columnsFrom = [
...new Set(foreignKeysToReturn[foreignKeyName].columnsFrom)
];
foreignKeysToReturn[foreignKeyName].columnsTo = [
...new Set(foreignKeysToReturn[foreignKeyName].columnsTo)
];
}
for (const columnResponse of tableResponse.rows) {
const columnName = columnResponse.attname;
const columnAdditionalDT = columnResponse.additional_dt;
const columnDimensions = columnResponse.array_dimensions;
let columnType = columnResponse.data_type;
const primaryKey = tableConstraints.rows.filter(
(mapRow) => columnName === mapRow.column_name && mapRow.constraint_type === "PRIMARY KEY"
);
const cprimaryKey = tableConstraints.rows.filter(
(mapRow) => mapRow.constraint_type === "PRIMARY KEY"
);
if (cprimaryKey.length > 1) {
const tableCompositePkName = await db.query(
`SELECT conname AS primary_key
FROM pg_constraint
WHERE contype = 'p'
AND connamespace = 'public'::regnamespace
AND (conrelid::regclass::text = $1 OR conrelid::regclass::text = $2);`,
[`"${tableName}"`, tableName]
);
primaryKeys[`${tableName}_${cprimaryKey.map((pk) => pk.column_name).join("_")}`] = {
name: tableCompositePkName.rows[0].primary_key,
columns: cprimaryKey.map((c) => c.column_name)
};
}
const uniqueKey = tableConstraints.rows.filter(
(mapRow) => columnName === mapRow.column_name && mapRow.constraint_type === "UNIQUE"
);
const defaultValue = defaultForColumn(columnResponse);
const isSerial = columnType === "serial";
let columnTypeMapped = columnType;
if (columnTypeMapped.startsWith("numeric(")) {
columnTypeMapped = columnTypeMapped.replace(",", ", ");
}
if (columnAdditionalDT === "ARRAY") {
for (let i = 1; i < Number(columnDimensions); i++) {
columnTypeMapped += "[]";
}
}
columnTypeMapped = columnTypeMapped.replace("character varying", "varchar").replace(" without time zone", "").replace("character", "char");
columnTypeMapped = trimChar(columnTypeMapped, '"');
columnToReturn[columnName] = {
name: columnName,
type: columnTypeMapped,
primaryKey: primaryKey.length === 1 && cprimaryKey.length < 2,
// default: isSerial ? undefined : defaultValue,
notNull: columnResponse.is_nullable === "NO"
};
if (!isSerial && typeof defaultValue !== "undefined") {
columnToReturn[columnName].default = defaultValue;
}
}
const dbIndexes = await db.query(
`select
t.relname as table_name,
i.relname as index_name,
ix.indisunique as is_unique,
a.attname as column_name
from
pg_class t,
pg_class i,
pg_index ix,
pg_attribute a
where
t.oid = ix.indrelid
and i.oid = ix.indexrelid
and a.attrelid = t.oid
and a.attnum = ANY(ix.indkey)
and t.relkind = 'r'
and t.relname = '${tableName}'
and ix.indisprimary = false
order by
t.relname,
i.relname;`
);
for (const dbIndex of dbIndexes.rows) {
const indexName4 = dbIndex.index_name;
const indexColumnName = dbIndex.column_name;
const indexIsUnique = dbIndex.is_unique;
if (typeof indexToReturn[indexName4] !== "undefined") {
indexToReturn[indexName4].columns.push(indexColumnName);
} else {
indexToReturn[indexName4] = {
name: indexName4,
columns: [indexColumnName],
isUnique: indexIsUnique
};
}
}
indexesCount += Object.keys(indexToReturn).length;
if (progressCallback) {
progressCallback("indexes", indexesCount, "fetching");
}
result[tableName] = {
name: tableName,
schema: tableSchema !== "public" ? tableSchema : "",
columns: columnToReturn,
indexes: indexToReturn,
foreignKeys: foreignKeysToReturn,
compositePrimaryKeys: primaryKeys
};
} catch (e) {
rej(e);
return;
}
res("");
});
});
if (progressCallback) {
progressCallback("tables", tableCount, "done");
}
for await (const _ of all) {
}
if (progressCallback) {
progressCallback("columns", columnsCount, "done");
progressCallback("indexes", indexesCount, "done");
progressCallback("fks", foreignKeysCount, "done");
}
const allEnums = await db.query(
`select n.nspname as enum_schema,
t.typname as enum_name,
e.enumlabel as enum_value
from pg_type t
join pg_enum e on t.oid = e.enumtypid
join pg_catalog.pg_namespace n ON n.oid = t.typnamespace;`
);
const enumsToReturn = {};
for (const dbEnum of allEnums.rows) {
const enumName = dbEnum.enum_name;
const enumValue = dbEnum.enum_value;
if (enumsToReturn[enumName] !== void 0 && enumsToReturn[enumName] !== null) {
enumsToReturn[enumName].values[enumValue] = enumValue;
} else {
enumsToReturn[enumName] = {
name: enumName,
values: { [enumValue]: enumValue }
};
}
}
if (progressCallback) {
progressCallback("enums", Object.keys(enumsToReturn).length, "done");
}
const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
return {
version: "5",
dialect: "pg",
tables: result,
enums: enumsToReturn,
schemas: schemasObject,
_meta: {
schemas: {},
tables: {},
columns: {}
}
};
};
columnToDefault = {
"numeric(": "::numeric",
// text: "::text",
// "character varying": "::character varying",
// "double precision": "::double precision",
// "time with time zone": "::time with time zone",
"time without time zone": "::time without time zone",
// "timestamp with time zone": "::timestamp with time zone",
"timestamp without time zone": "::timestamp without time zone",
// date: "::date",
// interval: "::interval",
// character: "::bpchar",
// macaddr8: "::macaddr8",
// macaddr: "::macaddr",
// inet: "::inet",
// cidr: "::cidr",
// jsonb: "::jsonb",
// json: "::json",
"character(": "::bpchar"
};
defaultForColumn = (column7) => {
if (column7.data_type === "serial" || column7.data_type === "smallserial" || column7.data_type === "bigserial") {
return void 0;
}
const hasDifferentDefaultCast = Object.keys(columnToDefault).find(
(it) => column7.data_type.startsWith(it)
);
if (column7.column_default === null) {
return void 0;
}
const columnDefaultAsString = column7.column_default.toString();
if (columnDefaultAsString.endsWith(
hasDifferentDefaultCast ? columnToDefault[hasDifferentDefaultCast] : column7.data_type
)) {
const nonPrefixPart = column7.column_default.length - (hasDifferentDefaultCast ? columnToDefault[hasDifferentDefaultCast] : `::${column7.data_type}`).length - 1;
const rt = column7.column_default.toString().substring(1, nonPrefixPart);
if (/^-?[\d.]+(?:e-?\d+)?$/.test(rt) && !column7.data_type.startsWith("numeric")) {
return Number(rt);
} else if (column7.data_type === "json" || column7.data_type === "jsonb") {
const jsonWithoutSpaces = JSON.stringify(JSON.parse(rt));
return `'${jsonWithoutSpaces}'${hasDifferentDefaultCast ? columnToDefault[hasDifferentDefaultCast] : `::${column7.data_type}`}`;
} else if (column7.data_type === "boolean") {
return column7.column_default === "true";
} else {
return `'${rt}'`;
}
} else {
if (/^-?[\d.]+(?:e-?\d+)?$/.test(columnDefaultAsString) && !column7.data_type.startsWith("numeric")) {
return Number(columnDefaultAsString);
} else if (column7.data_type === "boolean") {
return column7.column_default === "true";
} else {
return `${columnDefaultAsString}`;
}
}
};
}
});
// src/serializer/sqliteImports.ts
var sqliteImports_exports = {};
__export(sqliteImports_exports, {
prepareFromSqliteImports: () => prepareFromSqliteImports
});
var import_sqlite_core, import_drizzle_orm7, prepareFromSqliteImports;
var init_sqliteImports = __esm({
"src/serializer/sqliteImports.ts"() {
import_sqlite_core = require("drizzle-orm/sqlite-core");
import_drizzle_orm7 = require("drizzle-orm");
init_utils();
prepareFromSqliteImports = async (imports) => {
const tables = [];
const enums = [];
const { unregister } = safeRegister();
for (let i = 0; i < imports.length; i++) {
const it = imports[i];
const i0 = require(`${it}`);
const i0values = Object.values(i0);
i0values.forEach((t) => {
if ((0, import_drizzle_orm7.is)(t, import_sqlite_core.SQLiteTable)) {
tables.push(t);
}
});
}
unregister();
return { tables, enums };
};
}
});
// src/serializer/sqliteSerializer.ts
var sqliteSerializer_exports = {};
__export(sqliteSerializer_exports, {
fromDatabase: () => fromDatabase3,
generateSqliteSnapshot: () => generateSqliteSnapshot
});
function mapSqlToSqliteType(sqlType) {
if ([
"int",
"integer",
"integer auto_increment",
"tinyint",
"smallint",
"mediumint",
"bigint",
"unsigned big int",
"int2",
"int8"
].includes(sqlType.toLowerCase())) {
return "integer";
} else if ([
"character",
"varchar",
"vatying character",
"nchar",
"native character",
"nvarchar",
"text",
"clob"
].some((it) => it.startsWith(sqlType.toLowerCase()))) {
return "text";
} else if (sqlType.toLowerCase() === "blob") {
return "blob";
} else if (["real", "double", "double precision", "float"].includes(
sqlType.toLowerCase()
)) {
return "real";
} else {
return "numeric";
}
}
var import_drizzle_orm8, import_drizzle_orm9, import_sqlite_core2, dialect5, generateSqliteSnapshot, fromDatabase3;
var init_sqliteSerializer = __esm({
"src/serializer/sqliteSerializer.ts"() {
import_drizzle_orm8 = require("drizzle-orm");
import_drizzle_orm9 = require("drizzle-orm");
import_sqlite_core2 = require("drizzle-orm/sqlite-core");
init_serializer();
dialect5 = new import_sqlite_core2.SQLiteSyncDialect();
generateSqliteSnapshot = (tables, enums) => {
const result = {};
for (const table4 of tables) {
const columnsObject = {};
const indexesObject = {};
const foreignKeysObject = {};
const primaryKeysObject = {};
const {
name: tableName,
columns,
indexes,
foreignKeys: tableForeignKeys,
primaryKeys
} = (0, import_sqlite_core2.getTableConfig)(table4);
columns.forEach((column7) => {
const notNull = column7.notNull;
const primaryKey = column7.primary;
const columnToSet = {
name: column7.name,
type: column7.getSQLType(),
primaryKey,
notNull,
autoincrement: (0, import_drizzle_orm8.is)(column7, import_sqlite_core2.SQLiteBaseInteger) ? column7.autoIncrement : false
};
if (column7.default !== void 0) {
if ((0, import_drizzle_orm8.is)(column7.default, import_drizzle_orm9.SQL)) {
columnToSet.default = sqlToStr(column7.default);
} else {
columnToSet.default = typeof column7.default === "string" ? `'${column7.default}'` : column7.default;
}
}
columnsObject[column7.name] = columnToSet;
});
const foreignKeys = tableForeignKeys.map((fk4) => {
const name = fk4.getName();
const tableFrom = tableName;
const onDelete = fk4.onDelete ?? "no action";
const onUpdate = fk4.onUpdate ?? "no action";
const reference = fk4.reference();
const referenceFT = reference.foreignTable;
const tableTo = (0, import_drizzle_orm8.getTableName)(referenceFT);
const columnsFrom = reference.columns.map((it) => it.name);
const columnsTo = reference.foreignColumns.map((it) => it.name);
return {
name,
tableFrom,
tableTo,
columnsFrom,
columnsTo,
onDelete,
onUpdate
};
});
foreignKeys.forEach((it) => {
foreignKeysObject[it.name] = it;
});
indexes.forEach((value) => {
const columns2 = value.config.columns;
const name = value.config.name;
let indexColumns = columns2.map((it) => {
if ((0, import_drizzle_orm8.is)(it, import_drizzle_orm9.SQL)) {
return dialect5.sqlToQuery(it).sql;
} else {
return it.name;
}
});
let where = void 0;
if (value.config.where !== void 0) {
if ((0, import_drizzle_orm8.is)(value.config.where, import_drizzle_orm9.SQL)) {
where = dialect5.sqlToQuery(value.config.where).sql;
}
}
indexesObject[name] = {
name,
columns: indexColumns,
isUnique: value.config.unique ?? false,
where
};
});
primaryKeys.forEach((it) => {
if (it.columns.length > 1) {
primaryKeysObject[it.getName()] = {
columns: it.columns.map((it2) => it2.name).sort()
};
} else {
columnsObject[it.columns[0].name].primaryKey = true;
}
});
result[tableName] = {
name: tableName,
columns: columnsObject,
indexes: indexesObject,
foreignKeys: foreignKeysObject,
compositePrimaryKeys: primaryKeysObject
};
}
return {
version: "5",
dialect: "sqlite",
tables: result,
enums: {},
_meta: {
tables: {},
columns: {}
}
};
};
fromDatabase3 = async (db, tablesFilter = (table4) => true, progressCallback) => {
const result = {};
const columns = await db.query(
`SELECT
m.name as "tableName", p.name as "columnName", p.type as "columnType", p."notnull" as "notNull", p.dflt_value as "defaultValue", p.pk as pk
FROM sqlite_master AS m JOIN pragma_table_info(m.name) AS p
WHERE m.type = 'table' and m.tbl_name != 'sqlite_sequence' and m.tbl_name != 'sqlite_stat1' and m.tbl_name != '_litestream_seq' and m.tbl_name != '_litestream_lock';
`
);
const isSeqExists = await db.query(
`SELECT * FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';`
);
const tablesWithSeq = [];
if (isSeqExists.length > 0) {
const seq = await db.query(
`SELECT * FROM sqlite_sequence WHERE name != 'sqlite_sequence' and name != 'sqlite_stat1' and name != '_litestream_seq' and name != '_litestream_lock';`
);
for (const s of seq) {
tablesWithSeq.push(s.name);
}
}
let columnsCount = 0;
let tablesCount = /* @__PURE__ */ new Set();
let indexesCount = 0;
let foreignKeysCount = 0;
const tableToPk = {};
for (const column7 of columns) {
if (!tablesFilter(column7.tableName))
continue;
columnsCount += 1;
if (progressCallback) {
progressCallback("columns", columnsCount, "fetching");
}
const tableName = column7.tableName;
tablesCount.add(tableName);
if (progressCallback) {
progressCallback("tables", tablesCount.size, "fetching");
}
const columnName = column7.columnName;
const isNotNull = column7.notNull === 1;
const columnType = column7.columnType;
const isPrimary = column7.pk !== 0;
const columnDefault = column7.defaultValue;
const isAutoincrement = isPrimary && tablesWithSeq.includes(tableName);
if (isPrimary) {
if (typeof tableToPk[tableName] === "undefined") {
tableToPk[tableName] = [columnName];
} else {
tableToPk[tableName].push(columnName);
}
}
const table4 = result[tableName];
const newColumn = {
default: columnDefault === null ? void 0 : /^-?[\d.]+(?:e-?\d+)?$/.test(columnDefault) ? Number(columnDefault) : ["CURRENT_TIME", "CURRENT_DATE", "CURRENT_TIMESTAMP"].includes(
columnDefault
) ? `(${columnDefault})` : columnDefault === "false" ? false : columnDefault === "true" ? true : columnDefault.startsWith('"') && columnDefault.endsWith('"') ? columnDefault.substring(1, columnDefault.length - 1) : columnDefault,
autoincrement: isAutoincrement,
name: columnName,
type: mapSqlToSqliteType(columnType),
primaryKey: false,
notNull: isNotNull
};
if (!table4) {
result[tableName] = {
name: tableName,
columns: {
[columnName]: newColumn
},
compositePrimaryKeys: {},
indexes: {},
foreignKeys: {}
};
} else {
result[tableName].columns[columnName] = newColumn;
}
}
for (const [key, value] of Object.entries(tableToPk)) {
if (value.length > 1) {
value.sort();
result[key].compositePrimaryKeys = {
[`${key}_${value.join("_")}_pk`]: {
columns: value
}
};
} else if (value.length === 1) {
result[key].columns[value[0]].primaryKey = true;
} else {
}
}
if (progressCallback) {
progressCallback("columns", columnsCount, "done");
progressCallback("tables", tablesCount.size, "done");
}
try {
const fks = await db.query(
`SELECT m.name as "tableFrom", f.id as "id", f."table" as "tableTo", f."from", f."to", f."on_update" as "onUpdate", f."on_delete" as "onDelete", f.seq as "seq"
FROM sqlite_master m, pragma_foreign_key_list(m.name) as f;`
);
const fkByTableName = {};
for (const fkRow of fks) {
foreignKeysCount += 1;
if (progressCallback) {
progressCallback("fks", foreignKeysCount, "fetching");
}
const tableName = fkRow.tableFrom;
const columnName = fkRow.from;
const refTableName = fkRow.tableTo;
const refColumnName = fkRow.to;
const updateRule = fkRow.onUpdate;
const deleteRule = fkRow.onDelete;
const sequence = fkRow.seq;
const id = fkRow.id;
const tableInResult = result[tableName];
if (typeof tableInResult === "undefined")
continue;
if (typeof fkByTableName[`${tableName}_${id}`] !== "undefined") {
fkByTableName[`${tableName}_${id}`].columnsFrom.push(columnName);
fkByTableName[`${tableName}_${id}`].columnsTo.push(refColumnName);
} else {
fkByTableName[`${tableName}_${id}`] = {
name: "",
tableFrom: tableName,
tableTo: refTableName,
columnsFrom: [columnName],
columnsTo: [refColumnName],
onDelete: deleteRule == null ? void 0 : deleteRule.toLowerCase(),
onUpdate: updateRule == null ? void 0 : updateRule.toLowerCase()
};
}
const columnsFrom = fkByTableName[`${tableName}_${id}`].columnsFrom;
const columnsTo = fkByTableName[`${tableName}_${id}`].columnsTo;
fkByTableName[`${tableName}_${id}`].name = `${tableName}_${columnsFrom.join(
"_"
)}_${refTableName}_${columnsTo.join("_")}_fk`;
}
for (const idx of Object.keys(fkByTableName)) {
const value = fkByTableName[idx];
result[value.tableFrom].foreignKeys[value.name] = value;
}
} catch (e) {
}
if (progressCallback) {
progressCallback("fks", foreignKeysCount, "done");
}
const idxs = await db.query(
`SELECT
m.tbl_name as tableName,
il.name as indexName,
ii.name as columnName,
il.[unique] as isUnique,
il.seq as seq
FROM sqlite_master AS m,
pragma_index_list(m.name) AS il,
pragma_index_info(il.name) AS ii
WHERE
m.type = 'table' and il.name NOT LIKE 'sqlite_autoindex_%';`
);
for (const idxRow of idxs) {
const tableName = idxRow.tableName;
const constraintName = idxRow.indexName;
const columnName = idxRow.columnName;
const isUnique = idxRow.isUnique === 1;
const tableInResult = result[tableName];
if (typeof tableInResult === "undefined")
continue;
indexesCount += 1;
if (progressCallback) {
progressCallback("indexes", indexesCount, "fetching");
}
if (typeof tableInResult.indexes[constraintName] !== "undefined") {
tableInResult.indexes[constraintName].columns.push(columnName);
} else {
tableInResult.indexes[constraintName] = {
name: constraintName,
columns: [columnName],
isUnique
};
}
}
if (progressCallback) {
progressCallback("indexes", indexesCount, "done");
progressCallback("enums", 0, "done");
}
return {
version: "5",
dialect: "sqlite",
tables: result,
enums: {},
_meta: {
tables: {},
columns: {}
}
};
};
}
});
// src/serializer/index.ts
var import_fs2, import_path2, glob, sqlToStr, serializeMySql, serializePg, serializeSQLite, prepareFilenames;
var init_serializer = __esm({
"src/serializer/index.ts"() {
import_fs2 = __toESM(require("fs"));
import_path2 = __toESM(require("path"));
glob = __toESM(require("glob"));
init_source();
sqlToStr = (sql) => {
return sql.toQuery({
escapeName: (name) => {
throw new Error("we don't support params for `sql` default values");
},
escapeParam: (num, value) => {
throw new Error("we don't support params for `sql` default values");
},
escapeString: (str) => {
throw new Error("we don't support params for `sql` default values");
}
}).sql;
};
serializeMySql = async (path3) => {
const filenames = prepareFilenames(path3);
console.log(source_default.gray(`Reading schema files:
${filenames.join("\n")}
`));
const { prepareFromMySqlImports: prepareFromMySqlImports2 } = await Promise.resolve().then(() => (init_mysqlImports(), mysqlImports_exports));
const { generateMySqlSnapshot: generateMySqlSnapshot2 } = await Promise.resolve().then(() => (init_mysqlSerializer(), mysqlSerializer_exports));
const { tables, enums, schemas } = await prepareFromMySqlImports2(filenames);
return generateMySqlSnapshot2(tables, enums, schemas);
};
serializePg = async (path3) => {
const filenames = prepareFilenames(path3);
const { prepareFromPgImports: prepareFromPgImports2 } = await Promise.resolve().then(() => (init_pgImports(), pgImports_exports));
const { generatePgSnapshot: generatePgSnapshot2 } = await Promise.resolve().then(() => (init_pgSerializer(), pgSerializer_exports));
const { tables, enums, schemas } = await prepareFromPgImports2(filenames);
return generatePgSnapshot2(tables, enums, schemas);
};
serializeSQLite = async (path3) => {
const filenames = prepareFilenames(path3);
const { prepareFromSqliteImports: prepareFromSqliteImports2 } = await Promise.resolve().then(() => (init_sqliteImports(), sqliteImports_exports));
const { generateSqliteSnapshot: generateSqliteSnapshot2 } = await Promise.resolve().then(() => (init_sqliteSerializer(), sqliteSerializer_exports));
const { tables, enums } = await prepareFromSqliteImports2(filenames);
return generateSqliteSnapshot2(tables, enums);
};
prepareFilenames = (path3) => {
if (typeof path3 === "string") {
path3 = [path3];
}
const result = path3.reduce((result2, cur) => {
const globbed = glob.sync(cur);
globbed.forEach((it) => {
const fileName = import_fs2.default.lstatSync(it).isDirectory() ? null : import_path2.default.resolve(it);
const filenames = fileName ? [fileName] : import_fs2.default.readdirSync(it).map((file) => import_path2.default.join(import_path2.default.resolve(it), file));
filenames.filter((file) => !import_fs2.default.lstatSync(file).isDirectory()).forEach((file) => result2.add(file));
});
return result2;
}, /* @__PURE__ */ new Set());
return [...result];
};
}
});
// src/migrationPreparator.ts
var import_fs3, import_crypto, prepareMySqlDbPushSnapshot, prepareSQLiteDbPushSnapshot, prepareMySqlMigrationSnapshot, prepareSqliteMigrationSnapshot, preparePgMigrationSnapshot, preparePrevSnapshot;
var init_migrationPreparator = __esm({
"src/migrationPreparator.ts"() {
import_fs3 = __toESM(require("fs"));
import_crypto = require("crypto");
init_serializer();
init_pgSchema();
init_sqliteSchema();
init_mysqlSchema();
prepareMySqlDbPushSnapshot = async (prev, schemaPath) => {
const serialized = await serializeMySql(schemaPath);
const id = (0, import_crypto.randomUUID)();
const idPrev = prev.id;
const { version: version2, dialect: dialect6, ...rest } = serialized;
const result = { version: version2, dialect: dialect6, id, prevId: idPrev, ...rest };
return { prev, cur: result };
};
prepareSQLiteDbPushSnapshot = async (prev, schemaPath) => {
const serialized = await serializeSQLite(schemaPath);
const id = (0, import_crypto.randomUUID)();
const idPrev = prev.id;
const { version: version2, dialect: dialect6, ...rest } = serialized;
const result = { version: version2, dialect: dialect6, id, prevId: idPrev, ...rest };
return { prev, cur: result };
};
prepareMySqlMigrationSnapshot = async (migrationFolders, schemaPath) => {
const prevSnapshot = mysqlSchema.parse(
preparePrevSnapshot(migrationFolders, dryMySql)
);
const serialized = await serializeMySql(schemaPath);
const id = (0, import_crypto.randomUUID)();
const idPrev = prevSnapshot.id;
const { version: version2, dialect: dialect6, ...rest } = serialized;
const result = { version: version2, dialect: dialect6, id, prevId: idPrev, ...rest };
const { id: _ignoredId, prevId: _ignoredPrevId, ...prevRest } = prevSnapshot;
const custom = {
id,
prevId: idPrev,
...prevRest
};
return { prev: prevSnapshot, cur: result, custom };
};
prepareSqliteMigrationSnapshot = async (snapshots, schemaPath) => {
const prevSnapshot = sqliteSchema.parse(
preparePrevSnapshot(snapshots, drySQLite)
);
const serialized = await serializeSQLite(schemaPath);
const id = (0, import_crypto.randomUUID)();
const idPrev = prevSnapshot.id;
const { version: version2, dialect: dialect6, ...rest } = serialized;
const result = {
version: version2,
dialect: dialect6,
id,
prevId: idPrev,
...rest
};
const { id: _ignoredId, prevId: _ignoredPrevId, ...prevRest } = prevSnapshot;
const custom = {
id,
prevId: idPrev,
...prevRest
};
return { prev: prevSnapshot, cur: result, custom };
};
preparePgMigrationSnapshot = async (snapshots, schemaPath) => {
const prevSnapshot = pgSchema.parse(preparePrevSnapshot(snapshots, dryPg));
const serialized = await serializePg(schemaPath);
const id = (0, import_crypto.randomUUID)();
const idPrev = prevSnapshot.id;
const { version: version2, dialect: dialect6, ...rest } = serialized;
const result = { version: version2, dialect: dialect6, id, prevId: idPrev, ...rest };
const { id: _ignoredId, prevId: _ignoredPrevId, ...prevRest } = prevSnapshot;
const custom = {
id,
prevId: idPrev,
...prevRest
};
return { prev: prevSnapshot, cur: result, custom };
};
preparePrevSnapshot = (snapshots, defaultPrev) => {
let prevSnapshot;
if (snapshots.length === 0) {
prevSnapshot = defaultPrev;
} else {
const lastSnapshot = snapshots[snapshots.length - 1];
prevSnapshot = JSON.parse(import_fs3.default.readFileSync(lastSnapshot).toString());
}
return prevSnapshot;
};
}
});
// src/utils/words.ts
var prepareMigrationMetadata, adjectives, heroes;
var init_words = __esm({
"src/utils/words.ts"() {
prepareMigrationMetadata = (idx) => {
const prefix = idx.toFixed(0).padStart(4, "0");
const suffix = `${adjectives.random()}_${heroes.random()}`;
const tag = `${prefix}_${suffix}`;
return { prefix, suffix, tag };
};
adjectives = [
"abandoned",
"aberrant",
"abnormal",
"absent",
"absurd",
"acoustic",
"adorable",
"amazing",
"ambiguous",
"ambitious",
"amused",
"amusing",
"ancient",
"aromatic",
"aspiring",
"awesome",
"bent",
"big",
"bitter",
"bizarre",
"black",
"blue",
"blushing",
"bored",
"boring",
"bouncy",
"brainy",
"brave",
"breezy",
"brief",
"bright",
"broad",
"broken",
"brown",
"bumpy",
"burly",
"busy",
"calm",
"careful",
"careless",
"certain",
"charming",
"cheerful",
"chemical",
"chief",
"chilly",
"chubby",
"chunky",
"clammy",
"classy",
"clean",
"clear",
"clever",
"cloudy",
"closed",
"clumsy",
"cold",
"colorful",
"colossal",
"common",
"complete",
"complex",
"concerned",
"condemned",
"confused",
"conscious",
"cooing",
"cool",
"crazy",
"cuddly",
"cultured",
"curious",
"curly",
"curved",
"curvy",
"cute",
"cynical",
"daffy",
"daily",
"damp",
"dapper",
"dark",
"dashing",
"dazzling",
"dear",
"deep",
"demonic",
"dizzy",
"dry",
"dusty",
"eager",
"early",
"easy",
"elite",
"eminent",
"empty",
"equal",
"even",
"exotic",
"fair",
"faithful",
"familiar",
"famous",
"fancy",
"fantastic",
"far",
"fast",
"fat",
"faulty",
"fearless",
"fine",
"first",
"fixed",
"flaky",
"flashy",
"flat",
"flawless",
"flimsy",
"flippant",
"flowery",
"fluffy",
"foamy",
"free",
"freezing",
"fresh",
"friendly",
"funny",
"furry",
"futuristic",
"fuzzy",
"giant",
"gifted",
"gigantic",
"glamorous",
"glorious",
"glossy",
"good",
"goofy",
"gorgeous",
"graceful",
"gray",
"great",
"greedy",
"green",
"grey",
"groovy",
"handy",
"happy",
"hard",
"harsh",
"heavy",
"hesitant",
"high",
"hot",
"huge",
"icy",
"illegal",
"jazzy",
"jittery",
"keen",
"kind",
"known",
"lame",
"large",
"last",
"late",
"lazy",
"lean",
"left",
"legal",
"lethal",
"light",
"little",
"lively",
"living",
"lonely",
"long",
"loose",
"loud",
"lovely",
"loving",
"low",
"lowly",
"lucky",
"lumpy",
"lush",
"luxuriant",
"lying",
"lyrical",
"magenta",
"magical",
"majestic",
"many",
"massive",
"married",
"marvelous",
"material",
"mature",
"mean",
"medical",
"melodic",
"melted",
"messy",
"mighty",
"military",
"milky",
"minor",
"misty",
"mixed",
"moaning",
"modern",
"motionless",
"mushy",
"mute",
"mysterious",
"naive",
"nappy",
"narrow",
"nasty",
"natural",
"neat",
"nebulous",
"needy",
"nervous",
"new",
"next",
"nice",
"nifty",
"noisy",
"normal",
"nostalgic",
"nosy",
"numerous",
"odd",
"old",
"omniscient",
"open",
"opposite",
"optimal",
"orange",
"ordinary",
"organic",
"outgoing",
"outstanding",
"oval",
"overconfident",
"overjoyed",
"overrated",
"pale",
"panoramic",
"parallel",
"parched",
"past",
"peaceful",
"perfect",
"perpetual",
"petite",
"pink",
"plain",
"polite",
"powerful",
"premium",
"pretty",
"previous",
"productive",
"public",
"purple",
"puzzling",
"quick",
"quiet",
"rainy",
"rapid",
"rare",
"real",
"red",
"redundant",
"reflective",
"regular",
"remarkable",
"rich",
"right",
"robust",
"romantic",
"round",
"sad",
"safe",
"salty",
"same",
"secret",
"serious",
"shallow",
"sharp",
"shiny",
"shocking",
"short",
"silent",
"silky",
"silly",
"simple",
"skinny",
"sleepy",
"slim",
"slimy",
"slippery",
"sloppy",
"slow",
"small",
"smart",
"smiling",
"smooth",
"soft",
"solid",
"sour",
"sparkling",
"special",
"spicy",
"spooky",
"spotty",
"square",
"stale",
"steady",
"steep",
"sticky",
"stiff",
"stormy",
"strange",
"striped",
"strong",
"sturdy",
"sudden",
"superb",
"supreme",
"sweet",
"swift",
"talented",
"tan",
"tearful",
"tense",
"thankful",
"thick",
"thin",
"third",
"tidy",
"tiny",
"tired",
"tiresome",
"tough",
"tranquil",
"tricky",
"true",
"typical",
"uneven",
"unique",
"unknown",
"unusual",
"useful",
"vengeful",
"violet",
"volatile",
"wakeful",
"wandering",
"warm",
"watery",
"wealthy",
"wet",
"white",
"whole",
"wide",
"wild",
"windy",
"wise",
"wonderful",
"wooden",
"woozy",
"workable",
"worried",
"worthless",
"yellow",
"yielding",
"young",
"youthful",
"yummy",
"zippy"
];
heroes = [
"aaron_stack",
"abomination",
"absorbing_man",
"adam_destine",
"adam_warlock",
"agent_brand",
"agent_zero",
"albert_cleary",
"alex_power",
"alex_wilder",
"alice",
"amazoness",
"amphibian",
"angel",
"anita_blake",
"annihilus",
"anthem",
"apocalypse",
"aqueduct",
"arachne",
"archangel",
"arclight",
"ares",
"argent",
"avengers",
"azazel",
"banshee",
"baron_strucker",
"baron_zemo",
"barracuda",
"bastion",
"beast",
"bedlam",
"ben_grimm",
"ben_parker",
"ben_urich",
"betty_brant",
"betty_ross",
"beyonder",
"big_bertha",
"bill_hollister",
"bishop",
"black_bird",
"black_bolt",
"black_cat",
"black_crow",
"black_knight",
"black_panther",
"black_queen",
"black_tarantula",
"black_tom",
"black_widow",
"blackheart",
"blacklash",
"blade",
"blazing_skull",
"blindfold",
"blink",
"blizzard",
"blob",
"blockbuster",
"blonde_phantom",
"bloodaxe",
"bloodscream",
"bloodstorm",
"bloodstrike",
"blue_blade",
"blue_marvel",
"blue_shield",
"blur",
"boom_boom",
"boomer",
"boomerang",
"bromley",
"brood",
"brother_voodoo",
"bruce_banner",
"bucky",
"bug",
"bulldozer",
"bullseye",
"bushwacker",
"butterfly",
"cable",
"callisto",
"calypso",
"cammi",
"cannonball",
"captain_america",
"captain_britain",
"captain_cross",
"captain_flint",
"captain_marvel",
"captain_midlands",
"captain_stacy",
"captain_universe",
"cardiac",
"caretaker",
"cargill",
"carlie_cooper",
"carmella_unuscione",
"carnage",
"cassandra_nova",
"catseye",
"celestials",
"centennial",
"cerebro",
"cerise",
"chamber",
"chameleon",
"champions",
"changeling",
"charles_xavier",
"chat",
"chimera",
"christian_walker",
"chronomancer",
"clea",
"clint_barton",
"cloak",
"cobalt_man",
"colleen_wing",
"colonel_america",
"colossus",
"corsair",
"crusher_hogan",
"crystal",
"cyclops",
"dagger",
"daimon_hellstrom",
"dakota_north",
"daredevil",
"dark_beast",
"dark_phoenix",
"darkhawk",
"darkstar",
"darwin",
"dazzler",
"deadpool",
"deathbird",
"deathstrike",
"demogoblin",
"devos",
"dexter_bennett",
"diamondback",
"doctor_doom",
"doctor_faustus",
"doctor_octopus",
"doctor_spectrum",
"doctor_strange",
"domino",
"donald_blake",
"doomsday",
"doorman",
"dorian_gray",
"dormammu",
"dracula",
"dragon_lord",
"dragon_man",
"drax",
"dreadnoughts",
"dreaming_celestial",
"dust",
"earthquake",
"echo",
"eddie_brock",
"edwin_jarvis",
"ego",
"electro",
"elektra",
"emma_frost",
"enchantress",
"ender_wiggin",
"energizer",
"epoch",
"eternals",
"eternity",
"excalibur",
"exiles",
"exodus",
"expediter",
"ezekiel",
"ezekiel_stane",
"fabian_cortez",
"falcon",
"fallen_one",
"famine",
"fantastic_four",
"fat_cobra",
"felicia_hardy",
"fenris",
"firebird",
"firebrand",
"firedrake",
"firelord",
"firestar",
"fixer",
"flatman",
"forge",
"forgotten_one",
"frank_castle",
"franklin_richards",
"franklin_storm",
"freak",
"frightful_four",
"frog_thor",
"gabe_jones",
"galactus",
"gambit",
"gamma_corps",
"gamora",
"gargoyle",
"garia",
"gateway",
"gauntlet",
"genesis",
"george_stacy",
"gertrude_yorkes",
"ghost_rider",
"giant_girl",
"giant_man",
"gideon",
"gladiator",
"glorian",
"goblin_queen",
"golden_guardian",
"goliath",
"gorgon",
"gorilla_man",
"grandmaster",
"gravity",
"green_goblin",
"gressill",
"grey_gargoyle",
"greymalkin",
"grim_reaper",
"groot",
"guardian",
"guardsmen",
"gunslinger",
"gwen_stacy",
"hairball",
"hammerhead",
"hannibal_king",
"hardball",
"harpoon",
"harrier",
"harry_osborn",
"havok",
"hawkeye",
"hedge_knight",
"hellcat",
"hellfire_club",
"hellion",
"hemingway",
"hercules",
"hex",
"hiroim",
"hitman",
"hobgoblin",
"hulk",
"human_cannonball",
"human_fly",
"human_robot",
"human_torch",
"husk",
"hydra",
"iceman",
"ikaris",
"imperial_guard",
"impossible_man",
"inertia",
"infant_terrible",
"inhumans",
"ink",
"invaders",
"invisible_woman",
"iron_fist",
"iron_lad",
"iron_man",
"iron_monger",
"iron_patriot",
"ironclad",
"jack_flag",
"jack_murdock",
"jack_power",
"jackal",
"jackpot",
"james_howlett",
"jamie_braddock",
"jane_foster",
"jasper_sitwell",
"jazinda",
"jean_grey",
"jetstream",
"jigsaw",
"jimmy_woo",
"jocasta",
"johnny_blaze",
"johnny_storm",
"joseph",
"joshua_kane",
"joystick",
"jubilee",
"juggernaut",
"junta",
"justice",
"justin_hammer",
"kabuki",
"kang",
"karen_page",
"karma",
"karnak",
"kat_farrell",
"kate_bishop",
"katie_power",
"ken_ellis",
"khan",
"kid_colt",
"killer_shrike",
"killmonger",
"killraven",
"king_bedlam",
"king_cobra",
"kingpin",
"kinsey_walden",
"kitty_pryde",
"klaw",
"komodo",
"korath",
"korg",
"korvac",
"kree",
"krista_starr",
"kronos",
"kulan_gath",
"kylun",
"la_nuit",
"lady_bullseye",
"lady_deathstrike",
"lady_mastermind",
"lady_ursula",
"lady_vermin",
"lake",
"landau",
"layla_miller",
"leader",
"leech",
"legion",
"lenny_balinger",
"leo",
"leopardon",
"leper_queen",
"lester",
"lethal_legion",
"lifeguard",
"lightspeed",
"lila_cheney",
"lilandra",
"lilith",
"lily_hollister",
"lionheart",
"living_lightning",
"living_mummy",
"living_tribunal",
"liz_osborn",
"lizard",
"loa",
"lockheed",
"lockjaw",
"logan",
"loki",
"loners",
"longshot",
"lord_hawal",
"lord_tyger",
"lorna_dane",
"luckman",
"lucky_pierre",
"luke_cage",
"luminals",
"lyja",
"ma_gnuci",
"mac_gargan",
"mach_iv",
"machine_man",
"mad_thinker",
"madame_hydra",
"madame_masque",
"madame_web",
"maddog",
"madelyne_pryor",
"madripoor",
"madrox",
"maelstrom",
"maestro",
"magdalene",
"maggott",
"magik",
"maginty",
"magma",
"magneto",
"magus",
"major_mapleleaf",
"makkari",
"malcolm_colcord",
"malice",
"mandarin",
"mandrill",
"mandroid",
"manta",
"mantis",
"marauders",
"maria_hill",
"mariko_yashida",
"marrow",
"marten_broadcloak",
"martin_li",
"marvel_apes",
"marvel_boy",
"marvel_zombies",
"marvex",
"masked_marvel",
"masque",
"master_chief",
"master_mold",
"mastermind",
"mathemanic",
"matthew_murdock",
"mattie_franklin",
"mauler",
"maverick",
"maximus",
"may_parker",
"medusa",
"meggan",
"meltdown",
"menace",
"mentallo",
"mentor",
"mephisto",
"mephistopheles",
"mercury",
"mesmero",
"metal_master",
"meteorite",
"micromacro",
"microbe",
"microchip",
"micromax",
"midnight",
"miek",
"mikhail_rasputin",
"millenium_guard",
"mimic",
"mindworm",
"miracleman",
"miss_america",
"mister_fear",
"mister_sinister",
"misty_knight",
"mockingbird",
"moira_mactaggert",
"mojo",
"mole_man",
"molecule_man",
"molly_hayes",
"molten_man",
"mongoose",
"mongu",
"monster_badoon",
"moon_knight",
"moondragon",
"moonstone",
"morbius",
"mordo",
"morg",
"morgan_stark",
"morlocks",
"morlun",
"morph",
"mother_askani",
"mulholland_black",
"multiple_man",
"mysterio",
"mystique",
"namor",
"namora",
"namorita",
"naoko",
"natasha_romanoff",
"nebula",
"nehzno",
"nekra",
"nemesis",
"network",
"newton_destine",
"next_avengers",
"nextwave",
"nick_fury",
"nico_minoru",
"nicolaos",
"night_nurse",
"night_thrasher",
"nightcrawler",
"nighthawk",
"nightmare",
"nightshade",
"nitro",
"nocturne",
"nomad",
"norman_osborn",
"norrin_radd",
"northstar",
"nova",
"nuke",
"obadiah_stane",
"odin",
"ogun",
"old_lace",
"omega_flight",
"omega_red",
"omega_sentinel",
"onslaught",
"oracle",
"orphan",
"otto_octavius",
"outlaw_kid",
"overlord",
"owl",
"ozymandias",
"paibok",
"paladin",
"pandemic",
"paper_doll",
"patch",
"patriot",
"payback",
"penance",
"pepper_potts",
"pestilence",
"pet_avengers",
"pete_wisdom",
"peter_parker",
"peter_quill",
"phalanx",
"phantom_reporter",
"phil_sheldon",
"photon",
"piledriver",
"pixie",
"plazm",
"polaris",
"post",
"power_man",
"power_pack",
"praxagora",
"preak",
"pretty_boy",
"pride",
"prima",
"princess_powerful",
"prism",
"prodigy",
"proemial_gods",
"professor_monster",
"proteus",
"proudstar",
"prowler",
"psylocke",
"psynapse",
"puck",
"puff_adder",
"puma",
"punisher",
"puppet_master",
"purifiers",
"purple_man",
"pyro",
"quasar",
"quasimodo",
"queen_noir",
"quentin_quire",
"quicksilver",
"rachel_grey",
"radioactive_man",
"rafael_vega",
"rage",
"raider",
"randall",
"randall_flagg",
"random",
"rattler",
"ravenous",
"rawhide_kid",
"raza",
"reaper",
"reavers",
"red_ghost",
"red_hulk",
"red_shift",
"red_skull",
"red_wolf",
"redwing",
"reptil",
"retro_girl",
"revanche",
"rhino",
"rhodey",
"richard_fisk",
"rick_jones",
"ricochet",
"rictor",
"riptide",
"risque",
"robbie_robertson",
"robin_chapel",
"rocket_raccoon",
"rocket_racer",
"rockslide",
"rogue",
"roland_deschain",
"romulus",
"ronan",
"roughhouse",
"roulette",
"roxanne_simpson",
"rumiko_fujikawa",
"runaways",
"russian",
"sabra",
"sabretooth",
"sage",
"sally_floyd",
"salo",
"sandman",
"santa_claus",
"saracen",
"sasquatch",
"satana",
"sauron",
"scalphunter",
"scarecrow",
"scarlet_spider",
"scarlet_witch",
"scorpion",
"scourge",
"scrambler",
"scream",
"screwball",
"sebastian_shaw",
"secret_warriors",
"selene",
"senator_kelly",
"sentinel",
"sentinels",
"sentry",
"ser_duncan",
"serpent_society",
"sersi",
"shadow_king",
"shadowcat",
"shaman",
"shape",
"shard",
"sharon_carter",
"sharon_ventura",
"shatterstar",
"shen",
"sheva_callister",
"shinko_yamashiro",
"shinobi_shaw",
"shiva",
"shiver_man",
"shocker",
"shockwave",
"shooting_star",
"shotgun",
"shriek",
"silhouette",
"silk_fever",
"silver_centurion",
"silver_fox",
"silver_sable",
"silver_samurai",
"silver_surfer",
"silverclaw",
"silvermane",
"sinister_six",
"sir_ram",
"siren",
"sister_grimm",
"skaar",
"skin",
"skreet",
"skrulls",
"skullbuster",
"slapstick",
"slayback",
"sleeper",
"sleepwalker",
"slipstream",
"slyde",
"smasher",
"smiling_tiger",
"snowbird",
"solo",
"songbird",
"spacker_dave",
"spectrum",
"speed",
"speed_demon",
"speedball",
"spencer_smythe",
"sphinx",
"spiral",
"spirit",
"spitfire",
"spot",
"sprite",
"spyke",
"squadron_sinister",
"squadron_supreme",
"squirrel_girl",
"star_brand",
"starbolt",
"stardust",
"starfox",
"starhawk",
"starjammers",
"stark_industries",
"stature",
"steel_serpent",
"stellaris",
"stepford_cuckoos",
"stephen_strange",
"steve_rogers",
"stick",
"stingray",
"stone_men",
"storm",
"stranger",
"strong_guy",
"stryfe",
"sue_storm",
"sugar_man",
"sumo",
"sunfire",
"sunset_bain",
"sunspot",
"supernaut",
"supreme_intelligence",
"surge",
"susan_delgado",
"swarm",
"sway",
"switch",
"swordsman",
"synch",
"tag",
"talisman",
"talkback",
"talon",
"talos",
"tana_nile",
"tarantula",
"tarot",
"taskmaster",
"tattoo",
"ted_forrester",
"tempest",
"tenebrous",
"terrax",
"terror",
"texas_twister",
"thaddeus_ross",
"thanos",
"the_anarchist",
"the_call",
"the_captain",
"the_enforcers",
"the_executioner",
"the_fallen",
"the_fury",
"the_hand",
"the_hood",
"the_hunter",
"the_initiative",
"the_leader",
"the_liberteens",
"the_order",
"the_phantom",
"the_professor",
"the_renegades",
"the_santerians",
"the_spike",
"the_stranger",
"the_twelve",
"the_watchers",
"thena",
"thing",
"thor",
"thor_girl",
"thunderball",
"thunderbird",
"thunderbolt",
"thunderbolt_ross",
"thunderbolts",
"thundra",
"tiger_shark",
"tigra",
"timeslip",
"tinkerer",
"titania",
"titanium_man",
"toad",
"toad_men",
"tomas",
"tombstone",
"tomorrow_man",
"tony_stark",
"toro",
"toxin",
"trauma",
"triathlon",
"trish_tilby",
"triton",
"true_believers",
"turbo",
"tusk",
"tyger_tiger",
"typhoid_mary",
"tyrannus",
"ulik",
"ultimates",
"ultimatum",
"ultimo",
"ultragirl",
"ultron",
"umar",
"unicorn",
"union_jack",
"unus",
"valeria_richards",
"valkyrie",
"vampiro",
"vance_astro",
"vanisher",
"vapor",
"vargas",
"vector",
"veda",
"vengeance",
"venom",
"venus",
"vermin",
"vertigo",
"victor_mancha",
"vin_gonzales",
"vindicator",
"violations",
"viper",
"virginia_dare",
"vision",
"vivisector",
"vulcan",
"vulture",
"wallflower",
"wallop",
"wallow",
"war_machine",
"warbird",
"warbound",
"warhawk",
"warlock",
"warpath",
"warstar",
"wasp",
"weapon_omega",
"wendell_rand",
"wendell_vaughn",
"wendigo",
"whiplash",
"whirlwind",
"whistler",
"white_queen",
"white_tiger",
"whizzer",
"wiccan",
"wild_child",
"wild_pack",
"wildside",
"william_stryker",
"wilson_fisk",
"wind_dancer",
"winter_soldier",
"wither",
"wolf_cub",
"wolfpack",
"wolfsbane",
"wolverine",
"wonder_man",
"wong",
"wraith",
"wrecker",
"wrecking_crew",
"xavin",
"xorn",
"yellow_claw",
"yellowjacket",
"young_avengers",
"zaladane",
"zaran",
"zarda",
"zarek",
"zeigeist",
"zemo",
"zodiak",
"zombie",
"zuras",
"zzzax"
];
}
});
// src/cli/commands/migrate.ts
var migrate_exports = {};
__export(migrate_exports, {
BREAKPOINT: () => BREAKPOINT,
prepareAndMigrateMySql: () => prepareAndMigrateMySql,
prepareAndMigratePg: () => prepareAndMigratePg,
prepareAndMigrateSqlite: () => prepareAndMigrateSqlite,
prepareMySQLPush: () => prepareMySQLPush,
prepareSQL: () => prepareSQL,
prepareSQLitePush: () => prepareSQLitePush,
prepareSnapshotFolderName: () => prepareSnapshotFolderName,
writeResult: () => writeResult
});
var import_fs4, import_path3, import_hanji3, prepareAndMigratePg, prepareMySQLPush, prepareSQLitePush, prepareAndMigrateMySql, prepareAndMigrateSqlite, prepareSQL, promptColumnsConflicts, promptTablesConflict, promptSchemasConflict, BREAKPOINT, writeResult, prepareSnapshotFolderName, two;
var init_migrate = __esm({
"src/cli/commands/migrate.ts"() {
import_fs4 = __toESM(require("fs"));
init_migrationPreparator();
init_snapshotsDiffer();
import_path3 = __toESM(require("path"));
import_hanji3 = __toESM(require_hanji());
init_views();
init_source();
init_pgSchema();
init_sqliteSchema();
init_mysqlSchema();
init_utils2();
init_words();
prepareAndMigratePg = async (config) => {
const outFolder = config.out;
const schemaPath = config.schema;
try {
assertV1OutFolder(outFolder, "pg");
const { snapshots, journal } = prepareMigrationFolder(outFolder, "pg");
const { prev, cur, custom } = await preparePgMigrationSnapshot(snapshots, schemaPath);
const validatedPrev = pgSchema.parse(prev);
const validatedCur = pgSchema.parse(cur);
if (config.custom) {
writeResult(
custom,
[],
journal,
{
columns: {},
schemas: {},
tables: {}
},
outFolder,
config.breakpoints,
"custom"
);
return;
}
const squashedPrev = squashPgScheme(validatedPrev);
const squashedCur = squashPgScheme(validatedCur);
const { sqlStatements, _meta } = await prepareSQL(
squashedPrev,
squashedCur,
"pg",
validatedPrev,
validatedCur
);
writeResult(
cur,
sqlStatements,
journal,
_meta,
outFolder,
config.breakpoints
);
} catch (e) {
console.error(e);
}
};
prepareMySQLPush = async (config, snapshot) => {
const schemaPath = config.schema;
try {
const { prev, cur } = await prepareMySqlDbPushSnapshot(snapshot, schemaPath);
const validatedPrev = mysqlSchema.parse(prev);
const validatedCur = mysqlSchema.parse(cur);
const squashedPrev = squashMysqlScheme(validatedPrev);
const squashedCur = squashMysqlScheme(validatedCur);
const { sqlStatements, statements } = await prepareSQL(
squashedPrev,
squashedCur,
"mysql",
validatedPrev,
validatedCur
);
return { sqlStatements, statements };
} catch (e) {
console.error(e);
}
};
prepareSQLitePush = async (config, snapshot) => {
const schemaPath = config.schema;
try {
const { prev, cur } = await prepareSQLiteDbPushSnapshot(snapshot, schemaPath);
const validatedPrev = sqliteSchema.parse(prev);
const validatedCur = sqliteSchema.parse(cur);
const squashedPrev = squashSqliteScheme(validatedPrev);
const squashedCur = squashSqliteScheme(validatedCur);
const { sqlStatements, statements } = await prepareSQL(
squashedPrev,
squashedCur,
"sqlite",
validatedPrev,
validatedCur
);
return { sqlStatements, statements, squashedPrev, squashedCur };
} catch (e) {
console.error(e);
}
};
prepareAndMigrateMySql = async (config) => {
const outFolder = config.out;
const schemaPath = config.schema;
try {
assertV1OutFolder(outFolder, "mysql");
const { snapshots, journal } = prepareMigrationFolder(outFolder, "mysql");
const { prev, cur, custom } = await prepareMySqlMigrationSnapshot(snapshots, schemaPath);
const validatedPrev = mysqlSchema.parse(prev);
const validatedCur = mysqlSchema.parse(cur);
if (config.custom) {
writeResult(
custom,
[],
journal,
{
columns: {},
schemas: {},
tables: {}
},
outFolder,
config.breakpoints,
"custom"
);
return;
}
const squashedPrev = squashMysqlScheme(validatedPrev);
const squashedCur = squashMysqlScheme(validatedCur);
const { sqlStatements, _meta } = await prepareSQL(
squashedPrev,
squashedCur,
"mysql",
validatedPrev,
validatedCur
);
writeResult(
cur,
sqlStatements,
journal,
_meta,
outFolder,
config.breakpoints
);
} catch (e) {
console.error(e);
}
};
prepareAndMigrateSqlite = async (config) => {
const outFolder = config.out;
const schemaPath = config.schema;
try {
assertV1OutFolder(outFolder, "sqlite");
const { snapshots, journal } = prepareMigrationFolder(outFolder, "sqlite");
const { prev, cur, custom } = await prepareSqliteMigrationSnapshot(snapshots, schemaPath);
const validatedPrev = sqliteSchema.parse(prev);
const validatedCur = sqliteSchema.parse(cur);
if (config.custom) {
writeResult(
custom,
[],
journal,
{
columns: {},
schemas: {},
tables: {}
},
outFolder,
config.breakpoints,
"custom"
);
return;
}
const squashedPrev = squashSqliteScheme(validatedPrev);
const squashedCur = squashSqliteScheme(validatedCur);
const { sqlStatements, _meta } = await prepareSQL(
squashedPrev,
squashedCur,
"sqlite"
);
writeResult(
cur,
sqlStatements,
journal,
_meta,
outFolder,
config.breakpoints
);
} catch (e) {
console.error(e);
}
};
prepareSQL = async (prev, cur, dialect6, prevFull, curFull) => {
const schemasResolver = async (input) => {
try {
const { created, deleted, renamed } = await promptSchemasConflict(
input.created,
input.deleted
);
return { created, deleted, renamed };
} catch (e) {
console.error(e);
throw e;
}
};
const tablesResolver = async (input) => {
try {
const { created, deleted, renamed } = await promptTablesConflict(
input.created,
input.deleted
);
return { created, deleted, renamed };
} catch (e) {
console.error(e);
throw e;
}
};
const columnsResolver = async (input) => {
const result = await promptColumnsConflicts(
input.tableName,
input.created,
input.deleted
);
return {
tableName: input.tableName,
schema: input.schema,
created: result.created,
deleted: result.deleted,
renamed: result.renamed
};
};
return await applySnapshotsDiff(
prev,
cur,
dialect6,
schemasResolver,
tablesResolver,
columnsResolver,
prevFull,
curFull
);
};
promptColumnsConflicts = async (tableName, newColumns, missingColumns) => {
if (newColumns.length === 0 || missingColumns.length === 0) {
return { created: newColumns, renamed: [], deleted: missingColumns };
}
const result = { created: [], renamed: [], deleted: [] };
let index4 = 0;
let leftMissing = [...missingColumns];
do {
const created = newColumns[index4];
const renames = leftMissing.map((it) => {
return { from: it, to: created };
});
const promptData = [created, ...renames];
const { status, data } = await (0, import_hanji3.render)(
new ResolveColumnSelect(tableName, created, promptData)
);
if (status === "aborted") {
console.error("ERROR");
process.exit(1);
}
if (isRenamePromptItem(data)) {
console.log(
`${source_default.yellow("~")} ${data.from.name} \u203A ${data.to.name} ${source_default.gray(
"column will be renamed"
)}`
);
result.renamed.push(data);
delete leftMissing[leftMissing.indexOf(data.from)];
leftMissing = leftMissing.filter(Boolean);
} else {
console.log(
`${source_default.green("+")} ${data.name} ${source_default.gray(
"column will be created"
)}`
);
result.created.push(created);
}
index4 += 1;
} while (index4 < newColumns.length);
console.log(
source_default.gray(`--- all columns conflicts in ${tableName} table resolved ---
`)
);
result.deleted.push(...leftMissing);
return result;
};
promptTablesConflict = async (newTables, missingTables) => {
if (missingTables.length === 0 || newTables.length === 0) {
return { created: newTables, renamed: [], deleted: missingTables };
}
const result = { created: [], renamed: [], deleted: [] };
let index4 = 0;
let leftMissing = [...missingTables];
do {
const created = newTables[index4];
const renames = leftMissing.map((it) => {
return { from: it, to: created };
});
const promptData = [created, ...renames];
const { status, data } = await (0, import_hanji3.render)(
new ResolveTableSelect(created, promptData)
);
if (status === "aborted") {
console.error("ERROR");
process.exit(1);
}
if (isRenamePromptItem(data)) {
console.log(
`${source_default.yellow("~")} ${data.from.name} \u203A ${data.to.name} ${source_default.gray(
"table will be renamed"
)}`
);
result.renamed.push(data);
delete leftMissing[leftMissing.indexOf(data.from)];
leftMissing = leftMissing.filter(Boolean);
} else {
console.log(
`${source_default.green("+")} ${data.name} ${source_default.gray(
"table will be created"
)}`
);
result.created.push(created);
}
index4 += 1;
} while (index4 < newTables.length);
console.log(source_default.gray("--- all table conflicts resolved ---\n"));
result.deleted.push(...leftMissing);
return result;
};
promptSchemasConflict = async (newSchemas, missingSchemas) => {
if (missingSchemas.length === 0 || newSchemas.length === 0) {
return { created: newSchemas, renamed: [], deleted: missingSchemas };
}
const result = { created: [], renamed: [], deleted: [] };
let index4 = 0;
let leftMissing = [...missingSchemas];
do {
const created = newSchemas[index4];
const renames = leftMissing.map((it) => {
return { from: it, to: created };
});
const promptData = [created, ...renames];
const { status, data } = await (0, import_hanji3.render)(
new ResolveSchemasSelect(created, promptData)
);
if (status === "aborted") {
console.error("ERROR");
process.exit(1);
}
if (isRenamePromptItem(data)) {
console.log(
`${source_default.yellow("~")} ${data.from.name} \u203A ${data.to.name} ${source_default.gray(
"schema will be renamed"
)}`
);
result.renamed.push(data);
delete leftMissing[leftMissing.indexOf(data.from)];
leftMissing = leftMissing.filter(Boolean);
} else {
console.log(
`${source_default.green("+")} ${data.name} ${source_default.gray(
"schema will be created"
)}`
);
result.created.push(created);
}
index4 += 1;
} while (index4 < newSchemas.length);
console.log(source_default.gray("--- all schemas conflicts resolved ---\n"));
result.deleted.push(...leftMissing);
return result;
};
BREAKPOINT = "--> statement-breakpoint\n";
writeResult = (cur, sqlStatements, journal, _meta, outFolder, breakpoints, type = "none") => {
if (type === "none") {
console.log(schema(cur));
if (sqlStatements.length === 0) {
console.log("No schema changes, nothing to migrate \u{1F634}");
return;
}
}
const lastEntryInJournal = journal.entries[journal.entries.length - 1];
const idx = typeof lastEntryInJournal === "undefined" ? 0 : lastEntryInJournal.idx + 1;
const { prefix, tag } = prepareMigrationMetadata(idx);
const toSave = JSON.parse(JSON.stringify(cur));
toSave["_meta"] = _meta;
const metaFolderPath = (0, import_path3.join)(outFolder, "meta");
const metaJournal = (0, import_path3.join)(metaFolderPath, "_journal.json");
import_fs4.default.writeFileSync(
(0, import_path3.join)(metaFolderPath, `${prefix}_snapshot.json`),
JSON.stringify(toSave, null, 2)
);
const sqlDelimiter = breakpoints ? BREAKPOINT : "\n";
let sql = sqlStatements.join(sqlDelimiter);
if (type === "introspect") {
sql = `-- Current sql file was generated after introspecting the database
-- If you want to run this migration please uncomment this code before executing migrations
/*
${sql}
*/`;
}
if (type === "custom") {
console.log("Prepared empty file for your custom SQL migration!");
sql = "-- Custom SQL migration file, put you code below! --";
}
journal.entries.push({
idx,
version: cur.version,
when: +/* @__PURE__ */ new Date(),
tag,
breakpoints
});
import_fs4.default.writeFileSync(metaJournal, JSON.stringify(journal, null, 2));
import_fs4.default.writeFileSync(`${outFolder}/${tag}.sql`, sql);
(0, import_hanji3.render)(
`[${source_default.green(
"\u2713"
)}] Your SQL migration file \u279C ${source_default.bold.underline.blue(
import_path3.default.join(`${outFolder}/${tag}.sql`)
)} \u{1F680}`
);
};
prepareSnapshotFolderName = () => {
const now = /* @__PURE__ */ new Date();
return `${now.getFullYear()}${two(now.getUTCMonth() + 1)}${two(
now.getUTCDate()
)}${two(now.getUTCHours())}${two(now.getUTCMinutes())}${two(
now.getUTCSeconds()
)}`;
};
two = (input) => {
return input.toString().padStart(2, "0");
};
}
});
// src/sqlgenerator.ts
var pgNativeTypes, isPgNativeType, Convertor, PgCreateTableConvertor, MySqlCreateTableConvertor, SQLiteCreateTableConvertor, CreateTypeEnumConvertor, AlterTypeAddValueConvertor, PgDropTableConvertor, MySQLDropTableConvertor, SQLiteDropTableConvertor, PgRenameTableConvertor, SqliteRenameTableConvertor, MySqlRenameTableConvertor, PgAlterTableRenameColumnConvertor, MySqlAlterTableRenameColumnConvertor, SQLiteAlterTableRenameColumnConvertor, PgAlterTableDropColumnConvertor, MySqlAlterTableDropColumnConvertor, SQLiteAlterTableDropColumnConvertor, PgAlterTableAddColumnConvertor, MySqlAlterTableAddColumnConvertor, SQLiteAlterTableAddColumnConvertor, PgAlterTableAlterColumnSetTypeConvertor, SQLiteAlterTableAlterColumnSetTypeConvertor, PgAlterTableAlterColumnSetDefaultConvertor, SqliteAlterTableAlterColumnSetDefaultConvertor, PgAlterTableAlterColumnDropDefaultConvertor, MySqlAlterTableAddPk, MySqlAlterTableDropPk, MySqlModifyColumn, SqliteAlterTableAlterColumnDropDefaultConvertor, PgAlterTableCreateCompositePrimaryKeyConvertor, PgAlterTableDeleteCompositePrimaryKeyConvertor, PgAlterTableAlterCompositePrimaryKeyConvertor, MySqlAlterTableCreateCompositePrimaryKeyConvertor, MySqlAlterTableDeleteCompositePrimaryKeyConvertor, MySqlAlterTableAlterCompositePrimaryKeyConvertor, SqliteAlterTableCreateCompositePrimaryKeyConvertor, SqliteAlterTableDeleteCompositePrimaryKeyConvertor, SqliteAlterTableAlterCompositePrimaryKeyConvertor, PgAlterTableAlterColumnSetPrimaryKeyConvertor, PgAlterTableAlterColumnDropPrimaryKeyConvertor, PgAlterTableAlterColumnSetNotNullConvertor, SqliteAlterTableAlterColumnSetNotNullConvertor, SqliteAlterTableAlterColumnSetAutoincrementConvertor, SqliteAlterTableAlterColumnDropAutoincrementConvertor, PgAlterTableAlterColumnDropNotNullConvertor, SqliteAlterTableAlterColumnDropNotNullConvertor, PgCreateForeignKeyConvertor, SqliteCreateForeignKeyConvertor, MySqlCreateForeignKeyConvertor, PgAlterForeignKeyConvertor, SqliteAlterForeignKeyConvertor, PgDeleteForeignKeyConvertor, SqliteDeleteForeignKeyConvertor, MySqlDeleteForeignKeyConvertor, CreatePgIndexConvertor, CreateMySqlIndexConvertor, CreateSqliteIndexConvertor, PgDropIndexConvertor, PgCreateSchemaConvertor, PgRenameSchemaConvertor, PgDropSchemaConvertor, PgAlterTableSetSchemaConvertor, PgAlterTableSetNewSchemaConvertor, PgAlterTableRemoveFromSchemaConvertor, SqliteDropIndexConvertor, MysqlCreateSchemaConvertor, MysqlDropSchemaConvertor, MysqlAlterTableSetSchemaConvertor, MysqlAlterTableSetNewSchemaConvertor, MysqlAlterTableRemoveFromSchemaConvertor, MySqlDropIndexConvertor, convertors, fromJson;
var init_sqlgenerator = __esm({
"src/sqlgenerator.ts"() {
init_migrate();
init_mysqlSchema();
init_pgSchema();
init_sqliteSchema();
pgNativeTypes = /* @__PURE__ */ new Set([
"uuid",
"smallint",
"integer",
"bigint",
"boolean",
"text",
"varchar",
"serial",
"bigserial",
"decimal",
"numeric",
"real",
"json",
"jsonb",
"time",
"time with time zone",
"time without time zone",
"time",
"timestamp",
"timestamp with time zone",
"timestamp without time zone",
"date",
"interval",
"bigint",
"bigserial",
"double precision",
"interval year",
"interval month",
"interval day",
"interval hour",
"interval minute",
"interval second",
"interval year to month",
"interval day to hour",
"interval day to minute",
"interval day to second",
"interval hour to minute",
"interval hour to second",
"interval minute to second"
]);
isPgNativeType = (it) => {
if (pgNativeTypes.has(it))
return true;
const toCheck = it.replace(/ /g, "");
return toCheck.startsWith("varchar(") || toCheck.startsWith("char(") || toCheck.startsWith("numeric(") || toCheck.startsWith("timestamp(") || toCheck.startsWith("intervalyear(") || toCheck.startsWith("intervalmonth(") || toCheck.startsWith("intervalday(") || toCheck.startsWith("intervalhour(") || toCheck.startsWith("intervalminute(") || toCheck.startsWith("intervalsecond(") || toCheck.startsWith("intervalyeartomonth(") || toCheck.startsWith("intervaldaytohour(") || toCheck.startsWith("intervaldaytominute(") || toCheck.startsWith("intervaldaytosecond(") || toCheck.startsWith("intervalhourtominute(") || toCheck.startsWith("intervalhourtosecond(") || toCheck.startsWith("intervalminutetosecond(") || /^(\w+)(\[\d*])+$/.test(it);
};
Convertor = class {
};
PgCreateTableConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "create_table" && dialect6 === "pg";
}
convert(st) {
const { tableName, schema: schema4, columns, compositePKs } = st;
let statement = "";
const name = schema4 ? `"${schema4}"."${tableName}"` : `"${tableName}"`;
statement += `CREATE TABLE IF NOT EXISTS ${name} (
`;
for (let i = 0; i < columns.length; i++) {
const column7 = columns[i];
const primaryKeyStatement = column7.primaryKey ? "PRIMARY KEY" : "";
const notNullStatement = column7.notNull ? "NOT NULL" : "";
const defaultStatement = column7.default !== void 0 ? `DEFAULT ${column7.default}` : "";
const type = isPgNativeType(column7.type) ? column7.type : `"${column7.type}"`;
statement += " " + `"${column7.name}" ${type} ${primaryKeyStatement} ${defaultStatement} ${notNullStatement}`.replace(/ +/g, " ").trim();
statement += (i === columns.length - 1 ? "" : ",") + "\n";
}
statement += `);`;
statement += `
`;
if (typeof compositePKs !== "undefined" && compositePKs.length > 0) {
const compositePK4 = PgSquasher.unsquashPK(compositePKs[0]);
statement += BREAKPOINT;
statement += `ALTER TABLE ${name} ADD CONSTRAINT "${st.compositePkName}" PRIMARY KEY("${compositePK4.columns.join('","')}");`;
statement += `
`;
}
return statement;
}
};
MySqlCreateTableConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "create_table" && dialect6 === "mysql";
}
convert(st) {
const { tableName, columns, schema: schema4, compositePKs } = st;
let statement = "";
const tName = schema4 ? `\`${schema4}\`.\`${tableName}\`` : `\`${tableName}\``;
statement += `CREATE TABLE ${tName} (
`;
for (let i = 0; i < columns.length; i++) {
const column7 = columns[i];
const primaryKeyStatement = column7.primaryKey ? " PRIMARY KEY" : "";
const notNullStatement = column7.notNull ? " NOT NULL" : "";
const defaultStatement = column7.default !== void 0 ? ` DEFAULT ${column7.default}` : "";
const onUpdateStatement = column7.onUpdate ? ` ON UPDATE CURRENT_TIMESTAMP` : "";
const autoincrementStatement = column7.autoincrement ? " AUTO_INCREMENT" : "";
statement += " " + `\`${column7.name}\` ${column7.type}${autoincrementStatement}${primaryKeyStatement}${notNullStatement}${defaultStatement}${onUpdateStatement}`.trim();
statement += i === columns.length - 1 ? "" : ",\n";
}
if (typeof compositePKs !== "undefined" && compositePKs.length > 0) {
statement += ",\n";
const compositePK4 = MySqlSquasher.unsquashPK(compositePKs[0]);
statement += ` PRIMARY KEY(\`${compositePK4.columns.join("`,`")}\`)`;
statement += `
`;
}
statement += `);`;
statement += `
`;
return statement;
}
};
SQLiteCreateTableConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "sqlite_create_table" && dialect6 === "sqlite";
}
convert(st) {
const { tableName, columns, referenceData, compositePKs } = st;
let statement = "";
statement += `CREATE TABLE \`${tableName}\` (`;
for (let i = 0; i < columns.length; i++) {
const column7 = columns[i];
const primaryKeyStatement = column7.primaryKey ? " PRIMARY KEY" : "";
const notNullStatement = column7.notNull ? " NOT NULL" : "";
const defaultStatement = column7.default !== void 0 ? ` DEFAULT ${column7.default}` : "";
const autoincrementStatement = column7.autoincrement ? " AUTOINCREMENT" : "";
statement += "\n ";
statement += `\`${column7.name}\` ${column7.type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${notNullStatement}`;
statement += ",";
}
compositePKs.forEach((it) => {
statement += "\n ";
statement += `PRIMARY KEY(${it.map((it2) => `\`${it2}\``).join(", ")}),`;
});
for (let i = 0; i < referenceData.length; i++) {
const referenceAsString = referenceData[i];
const {
name,
tableFrom,
tableTo,
columnsFrom,
columnsTo,
onDelete,
onUpdate
} = SQLiteSquasher.unsquashFK(referenceAsString);
const onDeleteStatement = onDelete ? ` ON DELETE ${onDelete}` : "";
const onUpdateStatement = onUpdate ? ` ON UPDATE ${onUpdate}` : "";
const fromColumnsString = columnsFrom.map((it) => `\`${it}\``).join(",");
const toColumnsString = columnsTo.map((it) => `\`${it}\``).join(",");
statement += "\n ";
statement += `FOREIGN KEY (${fromColumnsString}) REFERENCES \`${tableTo}\`(${toColumnsString})${onUpdateStatement}${onDeleteStatement}`;
statement += ",";
}
statement = statement.trimChar(",");
statement += `
`;
statement += `);`;
statement += `
`;
return statement;
}
};
CreateTypeEnumConvertor = class extends Convertor {
can(statement) {
return statement.type === "create_type_enum";
}
convert(st) {
const { name, values } = st;
let valuesStatement = "(";
valuesStatement += values.map((it) => `'${it}'`).join(", ");
valuesStatement += ")";
let statement = "DO $$ BEGIN";
statement += "\n";
statement += ` CREATE TYPE "${name}" AS ENUM${valuesStatement};`;
statement += "\n";
statement += "EXCEPTION";
statement += "\n";
statement += " WHEN duplicate_object THEN null;";
statement += "\n";
statement += "END $$;";
statement += "\n";
return statement;
}
};
AlterTypeAddValueConvertor = class extends Convertor {
can(statement) {
return statement.type === "alter_type_add_value";
}
convert(st) {
const { name, value } = st;
return `ALTER TYPE "${name}" ADD VALUE '${value}';`;
}
};
PgDropTableConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "drop_table" && dialect6 === "pg";
}
convert(statement) {
const { tableName, schema: schema4 } = statement;
const tableNameWithSchema = schema4 ? `"${schema4}"."${tableName}"` : `"${tableName}"`;
return `DROP TABLE ${tableNameWithSchema};`;
}
};
MySQLDropTableConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "drop_table" && dialect6 === "mysql";
}
convert(statement) {
const { tableName } = statement;
return `DROP TABLE \`${tableName}\`;`;
}
};
SQLiteDropTableConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "drop_table" && dialect6 === "sqlite";
}
convert(statement) {
const { tableName } = statement;
return `DROP TABLE \`${tableName}\`;`;
}
};
PgRenameTableConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "rename_table" && dialect6 === "pg";
}
convert(statement) {
const { tableNameFrom, tableNameTo, toSchema, fromSchema } = statement;
const from = fromSchema ? `"${fromSchema}"."${tableNameFrom}"` : `"${tableNameFrom}"`;
const to = `"${tableNameTo}"`;
return `ALTER TABLE ${from} RENAME TO ${to};`;
}
};
SqliteRenameTableConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "rename_table" && dialect6 === "sqlite";
}
convert(statement) {
const { tableNameFrom, tableNameTo } = statement;
return `ALTER TABLE \`${tableNameFrom}\` RENAME TO \`${tableNameTo}\`;`;
}
};
MySqlRenameTableConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "rename_table" && dialect6 === "mysql";
}
convert(statement) {
const { tableNameFrom, tableNameTo, fromSchema, toSchema } = statement;
const from = fromSchema ? `\`${fromSchema}\`.\`${tableNameFrom}\`` : `\`${tableNameFrom}\``;
const to = fromSchema ? `\`${fromSchema}\`.\`${tableNameTo}\`` : `\`${tableNameTo}\``;
return `RENAME TABLE ${from} TO ${to};`;
}
};
PgAlterTableRenameColumnConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_rename_column" && dialect6 === "pg";
}
convert(statement) {
const { tableName, oldColumnName, newColumnName, schema: schema4 } = statement;
const tableNameWithSchema = schema4 ? `"${schema4}"."${tableName}"` : `"${tableName}"`;
return `ALTER TABLE ${tableNameWithSchema} RENAME COLUMN "${oldColumnName}" TO "${newColumnName}";`;
}
};
MySqlAlterTableRenameColumnConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_rename_column" && dialect6 === "mysql";
}
convert(statement) {
const { tableName, oldColumnName, newColumnName } = statement;
return `ALTER TABLE \`${tableName}\` RENAME COLUMN \`${oldColumnName}\` TO \`${newColumnName}\`;`;
}
};
SQLiteAlterTableRenameColumnConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_rename_column" && dialect6 === "sqlite";
}
convert(statement) {
const { tableName, oldColumnName, newColumnName } = statement;
return `ALTER TABLE \`${tableName}\` RENAME COLUMN \`${oldColumnName}\` TO \`${newColumnName}\`;`;
}
};
PgAlterTableDropColumnConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_drop_column" && dialect6 === "pg";
}
convert(statement) {
const { tableName, columnName, schema: schema4 } = statement;
const tableNameWithSchema = schema4 ? `"${schema4}"."${tableName}"` : `"${tableName}"`;
return `ALTER TABLE ${tableNameWithSchema} DROP COLUMN IF EXISTS "${columnName}";`;
}
};
MySqlAlterTableDropColumnConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_drop_column" && dialect6 === "mysql";
}
convert(statement) {
const { tableName, columnName } = statement;
return `ALTER TABLE \`${tableName}\` DROP COLUMN \`${columnName}\`;`;
}
};
SQLiteAlterTableDropColumnConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_drop_column" && dialect6 === "sqlite";
}
convert(statement) {
const { tableName, columnName } = statement;
return `ALTER TABLE \`${tableName}\` DROP COLUMN \`${columnName}\`;`;
}
};
PgAlterTableAddColumnConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_add_column" && dialect6 === "pg";
}
convert(statement) {
const { tableName, column: column7, schema: schema4 } = statement;
const { name, type, notNull } = column7;
const tableNameWithSchema = schema4 ? `"${schema4}"."${tableName}"` : `"${tableName}"`;
const defaultStatement = `${column7.default !== void 0 ? ` DEFAULT ${column7.default}` : ""}`;
const fixedType = isPgNativeType(column7.type) ? column7.type : `"${column7.type}"`;
const notNullStatement = `${notNull ? " NOT NULL" : ""}`;
return `ALTER TABLE ${tableNameWithSchema} ADD COLUMN "${name}" ${fixedType}${defaultStatement}${notNullStatement};`;
}
};
MySqlAlterTableAddColumnConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_add_column" && dialect6 === "mysql";
}
convert(statement) {
const { tableName, column: column7 } = statement;
const { name, type, notNull, primaryKey, autoincrement, onUpdate } = column7;
const defaultStatement = `${column7.default !== void 0 ? ` DEFAULT ${column7.default}` : ""}`;
const notNullStatement = `${notNull ? " NOT NULL" : ""}`;
const primaryKeyStatement = `${primaryKey ? " PRIMARY KEY" : ""}`;
const autoincrementStatement = `${autoincrement ? " AUTO_INCREMENT" : ""}`;
const onUpdateStatement = `${onUpdate ? " ON UPDATE CURRENT_TIMESTAMP" : ""}`;
return `ALTER TABLE \`${tableName}\` ADD \`${name}\` ${type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${notNullStatement}${onUpdateStatement};`;
}
};
SQLiteAlterTableAddColumnConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "sqlite_alter_table_add_column" && dialect6 === "sqlite";
}
convert(statement) {
const { tableName, column: column7, referenceData } = statement;
const { name, type, notNull, primaryKey } = column7;
const defaultStatement = `${column7.default !== void 0 ? ` DEFAULT ${column7.default}` : ""}`;
const notNullStatement = `${notNull ? " NOT NULL" : ""}`;
const primaryKeyStatement = `${primaryKey ? " PRIMARY KEY" : ""}`;
const referenceAsObject = referenceData ? SQLiteSquasher.unsquashFK(referenceData) : void 0;
const referenceStatement = `${referenceAsObject ? ` REFERENCES ${referenceAsObject.tableTo}(${referenceAsObject.columnsTo})` : ""}`;
return `ALTER TABLE ${tableName} ADD \`${name}\` ${type}${primaryKeyStatement}${defaultStatement}${notNullStatement}${referenceStatement};`;
}
};
PgAlterTableAlterColumnSetTypeConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_alter_column_set_type" && dialect6 === "pg";
}
convert(statement) {
const { tableName, columnName, newDataType, schema: schema4 } = statement;
const tableNameWithSchema = schema4 ? `"${schema4}"."${tableName}"` : `"${tableName}"`;
return `ALTER TABLE ${tableNameWithSchema} ALTER COLUMN "${columnName}" SET DATA TYPE ${newDataType};`;
}
};
SQLiteAlterTableAlterColumnSetTypeConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_alter_column_set_type" && dialect6 === "sqlite";
}
convert(statement) {
return `/*
SQLite does not support "Changing existing column type" out of the box, we do not generate automatic migration for that, so it has to be done manually
Please refer to: https://www.techonthenet.com/sqlite/tables/alter_table.php
https://www.sqlite.org/lang_altertable.html
https://stackoverflow.com/questions/2083543/modify-a-columns-type-in-sqlite3
Due to that we don't generate migration automatically and it has to be done manually
*/`;
}
};
PgAlterTableAlterColumnSetDefaultConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_alter_column_set_default" && dialect6 === "pg";
}
convert(statement) {
const { tableName, columnName, schema: schema4 } = statement;
const tableNameWithSchema = schema4 ? `"${schema4}"."${tableName}"` : `"${tableName}"`;
return `ALTER TABLE ${tableNameWithSchema} ALTER COLUMN "${columnName}" SET DEFAULT ${statement.newDefaultValue};`;
}
};
SqliteAlterTableAlterColumnSetDefaultConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_alter_column_set_default" && dialect6 === "sqlite";
}
convert(statement) {
return `/*
SQLite does not support "Set default to column" out of the box, we do not generate automatic migration for that, so it has to be done manually
Please refer to: https://www.techonthenet.com/sqlite/tables/alter_table.php
https://www.sqlite.org/lang_altertable.html
https://stackoverflow.com/questions/2083543/modify-a-columns-type-in-sqlite3
Due to that we don't generate migration automatically and it has to be done manually
*/`;
}
};
PgAlterTableAlterColumnDropDefaultConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_alter_column_drop_default" && dialect6 === "pg";
}
convert(statement) {
const { tableName, columnName, schema: schema4 } = statement;
const tableNameWithSchema = schema4 ? `"${schema4}"."${tableName}"` : `"${tableName}"`;
return `ALTER TABLE ${tableNameWithSchema} ALTER COLUMN "${columnName}" DROP DEFAULT;`;
}
};
MySqlAlterTableAddPk = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_alter_column_set_pk" && dialect6 === "mysql";
}
convert(statement) {
return `ALTER TABLE \`${statement.tableName}\` ADD PRIMARY KEY (\`${statement.columnName}\`);`;
}
};
MySqlAlterTableDropPk = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_alter_column_drop_pk" && dialect6 === "mysql";
}
convert(statement) {
return `ALTER TABLE \`${statement.tableName}\` DROP PRIMARY KEY`;
}
};
MySqlModifyColumn = class extends Convertor {
can(statement, dialect6) {
return (statement.type === "alter_table_alter_column_set_type" || statement.type === "alter_table_alter_column_set_notnull" || statement.type === "alter_table_alter_column_drop_notnull" || statement.type === "alter_table_alter_column_drop_on_update" || statement.type === "alter_table_alter_column_set_on_update" || statement.type === "alter_table_alter_column_set_autoincrement" || statement.type === "alter_table_alter_column_drop_autoincrement" || statement.type === "alter_table_alter_column_set_default" || statement.type === "alter_table_alter_column_drop_default") && dialect6 === "mysql";
}
convert(statement) {
const { tableName, columnName } = statement;
let columnType = ``;
let columnDefault = "";
let columnNotNull = "";
let columnOnUpdate = "";
let columnAutoincrement = "";
let primaryKey = statement.columnPk ? " PRIMARY KEY" : "";
if (statement.type === "alter_table_alter_column_drop_notnull") {
columnType = ` ${statement.newDataType}`;
columnDefault = statement.columnDefault ? ` DEFAULT ${statement.columnDefault}` : "";
columnNotNull = statement.columnNotNull ? ` NOT NULL` : "";
columnOnUpdate = statement.columnOnUpdate ? ` ON UPDATE CURRENT_TIMESTAMP` : "";
columnAutoincrement = statement.columnAutoIncrement ? " AUTO_INCREMENT" : "";
} else if (statement.type === "alter_table_alter_column_set_notnull") {
columnNotNull = ` NOT NULL`;
columnType = ` ${statement.newDataType}`;
columnDefault = statement.columnDefault ? ` DEFAULT ${statement.columnDefault}` : "";
columnOnUpdate = statement.columnOnUpdate ? ` ON UPDATE CURRENT_TIMESTAMP` : "";
columnAutoincrement = statement.columnAutoIncrement ? " AUTO_INCREMENT" : "";
} else if (statement.type === "alter_table_alter_column_drop_on_update") {
columnNotNull = statement.columnNotNull ? ` NOT NULL` : "";
columnType = ` ${statement.newDataType}`;
columnDefault = statement.columnDefault ? ` DEFAULT ${statement.columnDefault}` : "";
columnOnUpdate = "";
columnAutoincrement = statement.columnAutoIncrement ? " AUTO_INCREMENT" : "";
} else if (statement.type === "alter_table_alter_column_set_on_update") {
columnNotNull = statement.columnNotNull ? ` NOT NULL` : "";
columnOnUpdate = ` ON UPDATE CURRENT_TIMESTAMP`;
columnType = ` ${statement.newDataType}`;
columnDefault = statement.columnDefault ? ` DEFAULT ${statement.columnDefault}` : "";
columnAutoincrement = statement.columnAutoIncrement ? " AUTO_INCREMENT" : "";
} else if (statement.type === "alter_table_alter_column_set_autoincrement") {
columnNotNull = statement.columnNotNull ? ` NOT NULL` : "";
columnOnUpdate = columnOnUpdate = statement.columnOnUpdate ? ` ON UPDATE CURRENT_TIMESTAMP` : "";
columnType = ` ${statement.newDataType}`;
columnDefault = statement.columnDefault ? ` DEFAULT ${statement.columnDefault}` : "";
columnAutoincrement = " AUTO_INCREMENT";
} else if (statement.type === "alter_table_alter_column_drop_autoincrement") {
columnNotNull = statement.columnNotNull ? ` NOT NULL` : "";
columnOnUpdate = columnOnUpdate = statement.columnOnUpdate ? ` ON UPDATE CURRENT_TIMESTAMP` : "";
columnType = ` ${statement.newDataType}`;
columnDefault = statement.columnDefault ? ` DEFAULT ${statement.columnDefault}` : "";
columnAutoincrement = "";
} else if (statement.type === "alter_table_alter_column_set_default") {
columnNotNull = statement.columnNotNull ? ` NOT NULL` : "";
columnOnUpdate = columnOnUpdate = statement.columnOnUpdate ? ` ON UPDATE CURRENT_TIMESTAMP` : "";
columnType = ` ${statement.newDataType}`;
columnDefault = ` DEFAULT ${statement.newDefaultValue}`;
columnAutoincrement = statement.columnAutoIncrement ? " AUTO_INCREMENT" : "";
} else if (statement.type === "alter_table_alter_column_drop_default") {
columnNotNull = statement.columnNotNull ? ` NOT NULL` : "";
columnOnUpdate = columnOnUpdate = statement.columnOnUpdate ? ` ON UPDATE CURRENT_TIMESTAMP` : "";
columnType = ` ${statement.newDataType}`;
columnDefault = "";
columnAutoincrement = statement.columnAutoIncrement ? " AUTO_INCREMENT" : "";
} else {
columnType = ` ${statement.newDataType}`;
columnNotNull = statement.columnNotNull ? ` NOT NULL` : "";
columnOnUpdate = columnOnUpdate = statement.columnOnUpdate ? ` ON UPDATE CURRENT_TIMESTAMP` : "";
columnDefault = statement.columnDefault ? ` DEFAULT ${statement.columnDefault}` : "";
columnAutoincrement = statement.columnAutoIncrement ? " AUTO_INCREMENT" : "";
}
columnDefault = columnDefault instanceof Date ? columnDefault.toISOString() : columnDefault;
return `ALTER TABLE \`${tableName}\` MODIFY COLUMN \`${columnName}\`${columnType}${columnAutoincrement}${columnNotNull}${columnDefault}${columnOnUpdate};`;
}
};
SqliteAlterTableAlterColumnDropDefaultConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_alter_column_drop_default" && dialect6 === "sqlite";
}
convert(statement) {
return `/*
SQLite does not support "Drop default from column" out of the box, we do not generate automatic migration for that, so it has to be done manually
Please refer to: https://www.techonthenet.com/sqlite/tables/alter_table.php
https://www.sqlite.org/lang_altertable.html
https://stackoverflow.com/questions/2083543/modify-a-columns-type-in-sqlite3
Due to that we don't generate migration automatically and it has to be done manually
*/`;
}
};
PgAlterTableCreateCompositePrimaryKeyConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "create_composite_pk" && dialect6 === "pg";
}
convert(statement) {
const { name, columns } = PgSquasher.unsquashPK(statement.data);
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
return `ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${statement.constraintName}" PRIMARY KEY("${columns.join('","')}");`;
}
};
PgAlterTableDeleteCompositePrimaryKeyConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "delete_composite_pk" && dialect6 === "pg";
}
convert(statement) {
const { name, columns } = PgSquasher.unsquashPK(statement.data);
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
return `ALTER TABLE ${tableNameWithSchema} DROP CONSTRAINT "${statement.constraintName}";`;
}
};
PgAlterTableAlterCompositePrimaryKeyConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_composite_pk" && dialect6 === "pg";
}
convert(statement) {
const { name, columns } = PgSquasher.unsquashPK(statement.old);
const { name: newName, columns: newColumns } = PgSquasher.unsquashPK(
statement.new
);
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
return `ALTER TABLE ${tableNameWithSchema} DROP CONSTRAINT ${statement.oldConstraintName};
${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newConstraintName} PRIMARY KEY(${newColumns.join(",")});`;
}
};
MySqlAlterTableCreateCompositePrimaryKeyConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "create_composite_pk" && dialect6 === "mysql";
}
convert(statement) {
const { name, columns } = MySqlSquasher.unsquashPK(statement.data);
return `ALTER TABLE \`${statement.tableName}\` ADD PRIMARY KEY(\`${columns.join("`,`")}\`);`;
}
};
MySqlAlterTableDeleteCompositePrimaryKeyConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "delete_composite_pk" && dialect6 === "mysql";
}
convert(statement) {
const { name, columns } = MySqlSquasher.unsquashPK(statement.data);
return `ALTER TABLE \`${statement.tableName}\` DROP PRIMARY KEY;`;
}
};
MySqlAlterTableAlterCompositePrimaryKeyConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_composite_pk" && dialect6 === "mysql";
}
convert(statement) {
const { name, columns } = MySqlSquasher.unsquashPK(statement.old);
const { name: newName, columns: newColumns } = MySqlSquasher.unsquashPK(
statement.new
);
return `ALTER TABLE \`${statement.tableName}\` DROP PRIMARY KEY, ADD PRIMARY KEY(\`${newColumns.join("`,`")}\`);`;
}
};
SqliteAlterTableCreateCompositePrimaryKeyConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "create_composite_pk" && dialect6 === "sqlite";
}
convert(statement) {
let msg = "/*\n";
msg += `You're trying to add PRIMARY KEY(${statement.data}) to '${statement.tableName}' table
`;
msg += "SQLite does not support adding primary key to an already created table\n";
msg += "You can do it in 3 steps with drizzle orm:\n";
msg += " - create new mirror table with needed pk, rename current table to old_table, generate SQL\n";
msg += " - migrate old data from one table to another\n";
msg += " - delete old_table in schema, generate sql\n\n";
msg += "or create manual migration like below:\n\n";
msg += "ALTER TABLE table_name RENAME TO old_table;\n";
msg += "CREATE TABLE table_name (\n";
msg += " column1 datatype [ NULL | NOT NULL ],\n";
msg += " column2 datatype [ NULL | NOT NULL ],\n";
msg += " ...\n";
msg += " PRIMARY KEY (pk_col1, pk_col2, ... pk_col_n)\n";
msg += " );\n";
msg += "INSERT INTO table_name SELECT * FROM old_table;\n\n";
msg += "Due to that we don't generate migration automatically and it has to be done manually\n";
msg += "*/\n";
return msg;
}
};
SqliteAlterTableDeleteCompositePrimaryKeyConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "delete_composite_pk" && dialect6 === "sqlite";
}
convert(statement) {
let msg = "/*\n";
msg += `You're trying to delete PRIMARY KEY(${statement.data}) from '${statement.tableName}' table
`;
msg += "SQLite does not supportprimary key deletion from existing table\n";
msg += "You can do it in 3 steps with drizzle orm:\n";
msg += " - create new mirror table table without pk, rename current table to old_table, generate SQL\n";
msg += " - migrate old data from one table to another\n";
msg += " - delete old_table in schema, generate sql\n\n";
msg += "or create manual migration like below:\n\n";
msg += "ALTER TABLE table_name RENAME TO old_table;\n";
msg += "CREATE TABLE table_name (\n";
msg += " column1 datatype [ NULL | NOT NULL ],\n";
msg += " column2 datatype [ NULL | NOT NULL ],\n";
msg += " ...\n";
msg += " PRIMARY KEY (pk_col1, pk_col2, ... pk_col_n)\n";
msg += " );\n";
msg += "INSERT INTO table_name SELECT * FROM old_table;\n\n";
msg += "Due to that we don't generate migration automatically and it has to be done manually\n";
msg += "*/\n";
return msg;
}
};
SqliteAlterTableAlterCompositePrimaryKeyConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_composite_pk" && dialect6 === "sqlite";
}
convert(statement) {
let msg = "/*\n";
msg += "SQLite does not support altering primary key\n";
msg += "You can do it in 3 steps with drizzle orm:\n";
msg += " - create new mirror table with needed pk, rename current table to old_table, generate SQL\n";
msg += " - migrate old data from one table to another\n";
msg += " - delete old_table in schema, generate sql\n\n";
msg += "or create manual migration like below:\n\n";
msg += "ALTER TABLE table_name RENAME TO old_table;\n";
msg += "CREATE TABLE table_name (\n";
msg += " column1 datatype [ NULL | NOT NULL ],\n";
msg += " column2 datatype [ NULL | NOT NULL ],\n";
msg += " ...\n";
msg += " PRIMARY KEY (pk_col1, pk_col2, ... pk_col_n)\n";
msg += " );\n";
msg += "INSERT INTO table_name SELECT * FROM old_table;\n\n";
msg += "Due to that we don't generate migration automatically and it has to be done manually\n";
msg += "*/\n";
return msg;
}
};
PgAlterTableAlterColumnSetPrimaryKeyConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_alter_column_set_pk" && dialect6 === "pg";
}
convert(statement) {
const { tableName, columnName } = statement;
console.log(statement);
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
return `ALTER TABLE ${tableNameWithSchema} ADD PRIMARY KEY ("${columnName}");`;
}
};
PgAlterTableAlterColumnDropPrimaryKeyConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_alter_column_drop_pk" && dialect6 === "pg";
}
convert(statement) {
const { tableName, columnName, schema: schema4 } = statement;
return `/*
Unfortunately in current drizzle-kit version we can't automatically get name for primary key.
We are working on making it available!
Meanwhile you can:
1. Check pk name in your database, by running
SELECT constraint_name FROM information_schema.table_constraints
WHERE table_schema = '${typeof schema4 === "undefined" || schema4 === "" ? "public" : schema4}'
AND table_name = '${tableName}'
AND constraint_type = 'PRIMARY KEY';
2. Uncomment code below and paste pk name manually
Hope to release this update as soon as possible
*/
-- ALTER TABLE "${tableName}" DROP CONSTRAINT "<constraint_name>";`;
}
};
PgAlterTableAlterColumnSetNotNullConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_alter_column_set_notnull" && dialect6 === "pg";
}
convert(statement) {
const { tableName, columnName } = statement;
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
return `ALTER TABLE ${tableNameWithSchema} ALTER COLUMN "${columnName}" SET NOT NULL;`;
}
};
SqliteAlterTableAlterColumnSetNotNullConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_alter_column_set_notnull" && dialect6 === "sqlite";
}
convert(statement) {
return `/*
SQLite does not support "Set not null to column" out of the box, we do not generate automatic migration for that, so it has to be done manually
Please refer to: https://www.techonthenet.com/sqlite/tables/alter_table.php
https://www.sqlite.org/lang_altertable.html
https://stackoverflow.com/questions/2083543/modify-a-columns-type-in-sqlite3
Due to that we don't generate migration automatically and it has to be done manually
*/`;
}
};
SqliteAlterTableAlterColumnSetAutoincrementConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_alter_column_set_autoincrement" && dialect6 === "sqlite";
}
convert(statement) {
return `/*
SQLite does not support "Set autoincrement to a column" out of the box, we do not generate automatic migration for that, so it has to be done manually
Please refer to: https://www.techonthenet.com/sqlite/tables/alter_table.php
https://www.sqlite.org/lang_altertable.html
https://stackoverflow.com/questions/2083543/modify-a-columns-type-in-sqlite3
Due to that we don't generate migration automatically and it has to be done manually
*/`;
}
};
SqliteAlterTableAlterColumnDropAutoincrementConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_alter_column_drop_autoincrement" && dialect6 === "sqlite";
}
convert(statement) {
return `/*
SQLite does not support "Drop autoincrement from a column" out of the box, we do not generate automatic migration for that, so it has to be done manually
Please refer to: https://www.techonthenet.com/sqlite/tables/alter_table.php
https://www.sqlite.org/lang_altertable.html
https://stackoverflow.com/questions/2083543/modify-a-columns-type-in-sqlite3
Due to that we don't generate migration automatically and it has to be done manually
*/`;
}
};
PgAlterTableAlterColumnDropNotNullConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_alter_column_drop_notnull" && dialect6 === "pg";
}
convert(statement) {
const { tableName, columnName } = statement;
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
return `ALTER TABLE ${tableNameWithSchema} ALTER COLUMN "${columnName}" DROP NOT NULL;`;
}
};
SqliteAlterTableAlterColumnDropNotNullConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_alter_column_drop_notnull" && dialect6 === "sqlite";
}
convert(statement) {
return `/*
SQLite does not support "Drop not null from column" out of the box, we do not generate automatic migration for that, so it has to be done manually
Please refer to: https://www.techonthenet.com/sqlite/tables/alter_table.php
https://www.sqlite.org/lang_altertable.html
https://stackoverflow.com/questions/2083543/modify-a-columns-type-in-sqlite3
Due to that we don't generate migration automatically and it has to be done manually
*/`;
}
};
PgCreateForeignKeyConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "create_reference" && dialect6 === "pg";
}
convert(statement) {
const {
name,
tableFrom,
tableTo,
columnsFrom,
columnsTo,
onDelete,
onUpdate
} = PgSquasher.unsquashFK(statement.data);
const onDeleteStatement = onDelete ? ` ON DELETE ${onDelete}` : "";
const onUpdateStatement = onUpdate ? ` ON UPDATE ${onUpdate}` : "";
const fromColumnsString = columnsFrom.map((it) => `"${it}"`).join(",");
const toColumnsString = columnsTo.map((it) => `"${it}"`).join(",");
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${tableFrom}"` : `"${tableFrom}"`;
const tableToNameWithSchema = statement.schema ? `"${statement.schema}"."${tableTo}"` : `"${tableTo}"`;
const alterStatement = `ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${name}" FOREIGN KEY (${fromColumnsString}) REFERENCES ${tableToNameWithSchema}(${toColumnsString})${onDeleteStatement}${onUpdateStatement}`;
let sql = "DO $$ BEGIN\n";
sql += " " + alterStatement + ";\n";
sql += "EXCEPTION\n";
sql += " WHEN duplicate_object THEN null;\n";
sql += "END $$;\n";
return sql;
}
};
SqliteCreateForeignKeyConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "create_reference" && dialect6 === "sqlite";
}
convert(statement) {
return `/*
SQLite does not support "Creating foreign key on existing column" out of the box, we do not generate automatic migration for that, so it has to be done manually
Please refer to: https://www.techonthenet.com/sqlite/tables/alter_table.php
https://www.sqlite.org/lang_altertable.html
Due to that we don't generate migration automatically and it has to be done manually
*/`;
}
};
MySqlCreateForeignKeyConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "create_reference" && dialect6 === "mysql";
}
convert(statement) {
const {
name,
tableFrom,
tableTo,
columnsFrom,
columnsTo,
onDelete,
onUpdate
} = MySqlSquasher.unsquashFK(statement.data);
const onDeleteStatement = onDelete ? ` ON DELETE ${onDelete}` : "";
const onUpdateStatement = onUpdate ? ` ON UPDATE ${onUpdate}` : "";
const fromColumnsString = columnsFrom.map((it) => `\`${it}\``).join(",");
const toColumnsString = columnsTo.map((it) => `\`${it}\``).join(",");
return `ALTER TABLE \`${tableFrom}\` ADD CONSTRAINT \`${name}\` FOREIGN KEY (${fromColumnsString}) REFERENCES \`${tableTo}\`(${toColumnsString})${onDeleteStatement}${onUpdateStatement};`;
}
};
PgAlterForeignKeyConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_reference" && dialect6 === "pg";
}
convert(statement) {
const newFk = PgSquasher.unsquashFK(statement.data);
const oldFk = PgSquasher.unsquashFK(statement.oldFkey);
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${oldFk.tableFrom}"` : `"${oldFk.tableFrom}"`;
let sql = `ALTER TABLE ${tableNameWithSchema} DROP CONSTRAINT "${oldFk.name}";
`;
const onDeleteStatement = newFk.onDelete ? ` ON DELETE ${newFk.onDelete}` : "";
const onUpdateStatement = newFk.onUpdate ? ` ON UPDATE ${newFk.onUpdate}` : "";
const fromColumnsString = newFk.columnsFrom.map((it) => `"${it}"`).join(",");
const toColumnsString = newFk.columnsTo.map((it) => `"${it}"`).join(",");
const tableFromNameWithSchema = statement.schema ? `"${statement.schema}"."${newFk.tableFrom}"` : `"${newFk.tableFrom}"`;
const alterStatement = `ALTER TABLE ${tableFromNameWithSchema} ADD CONSTRAINT "${newFk.name}" FOREIGN KEY (${fromColumnsString}) REFERENCES "${newFk.tableTo}"(${toColumnsString})${onDeleteStatement}${onUpdateStatement}`;
sql += "DO $$ BEGIN\n";
sql += " " + alterStatement + ";\n";
sql += "EXCEPTION\n";
sql += " WHEN duplicate_object THEN null;\n";
sql += "END $$;\n";
return sql;
}
};
SqliteAlterForeignKeyConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_reference" && dialect6 === "sqlite";
}
convert(statement) {
return `/*
SQLite does not support "Changing existing foreign key" out of the box, we do not generate automatic migration for that, so it has to be done manually
Please refer to: https://www.techonthenet.com/sqlite/tables/alter_table.php
https://www.sqlite.org/lang_altertable.html
Due to that we don't generate migration automatically and it has to be done manually
*/`;
}
};
PgDeleteForeignKeyConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "delete_reference" && dialect6 === "pg";
}
convert(statement) {
const tableFrom = statement.tableName;
const { name } = PgSquasher.unsquashFK(statement.data);
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${tableFrom}"` : `"${tableFrom}"`;
return `ALTER TABLE ${tableNameWithSchema} DROP CONSTRAINT "${name}";
`;
}
};
SqliteDeleteForeignKeyConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "delete_reference" && dialect6 === "sqlite";
}
convert(statement) {
return `/*
SQLite does not support "Dropping foreign key" out of the box, we do not generate automatic migration for that, so it has to be done manually
Please refer to: https://www.techonthenet.com/sqlite/tables/alter_table.php
https://www.sqlite.org/lang_altertable.html
Due to that we don't generate migration automatically and it has to be done manually
*/`;
}
};
MySqlDeleteForeignKeyConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "delete_reference" && dialect6 === "mysql";
}
convert(statement) {
const tableFrom = statement.tableName;
const { name } = MySqlSquasher.unsquashFK(statement.data);
return `ALTER TABLE \`${tableFrom}\` DROP FOREIGN KEY \`${name}\`;
`;
}
};
CreatePgIndexConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "create_index" && dialect6 === "pg";
}
convert(statement) {
const { name, columns, isUnique } = PgSquasher.unsquashIdx(statement.data);
const indexPart = isUnique ? "UNIQUE INDEX" : "INDEX";
const value = columns.map((it) => `"${it}"`).join(",");
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
return `CREATE ${indexPart} IF NOT EXISTS "${name}" ON ${tableNameWithSchema} (${value});`;
}
};
CreateMySqlIndexConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "create_index" && dialect6 === "mysql";
}
convert(statement) {
const { name, columns, isUnique } = MySqlSquasher.unsquashIdx(
statement.data
);
const indexPart = isUnique ? "UNIQUE INDEX" : "INDEX";
const value = columns.map((it) => `\`${it}\``).join(",");
return `CREATE ${indexPart} \`${name}\` ON \`${statement.tableName}\` (${value});`;
}
};
CreateSqliteIndexConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "create_index" && dialect6 === "sqlite";
}
convert(statement) {
const { name, columns, isUnique, where } = SQLiteSquasher.unsquashIdx(
statement.data
);
const indexPart = isUnique ? "UNIQUE INDEX" : "INDEX";
const whereStatement = where ? ` WHERE ${where}` : "";
const value = columns.map((it) => `\`${it}\``).join(",");
return `CREATE ${indexPart} \`${name}\` ON \`${statement.tableName}\` (${value})${whereStatement};`;
}
};
PgDropIndexConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "drop_index" && dialect6 === "pg";
}
convert(statement) {
const { name } = PgSquasher.unsquashIdx(statement.data);
return `DROP INDEX IF EXISTS "${name}";`;
}
};
PgCreateSchemaConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "create_schema" && dialect6 === "pg";
}
convert(statement) {
const { name } = statement;
return `CREATE SCHEMA "${name}";
`;
}
};
PgRenameSchemaConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "rename_schema" && dialect6 === "pg";
}
convert(statement) {
const { from, to } = statement;
return `ALTER SCHEMA "${from}" RENAME TO "${to}";
`;
}
};
PgDropSchemaConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "drop_schema" && dialect6 === "pg";
}
convert(statement) {
const { name } = statement;
return `DROP SCHEMA "${name}";
`;
}
};
PgAlterTableSetSchemaConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_set_schema" && dialect6 === "pg";
}
convert(statement) {
const { tableName, schema: schema4 } = statement;
return `ALTER TABLE "${tableName}" SET SCHEMA "${schema4}";
`;
}
};
PgAlterTableSetNewSchemaConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_set_new_schema" && dialect6 === "pg";
}
convert(statement) {
const { tableName, to, from } = statement;
const tableNameWithSchema = from ? `"${from}"."${tableName}"` : `"${tableName}"`;
return `ALTER TABLE ${tableNameWithSchema} SET SCHEMA "${to}";
`;
}
};
PgAlterTableRemoveFromSchemaConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_remove_from_schema" && dialect6 === "pg";
}
convert(statement) {
const { tableName, schema: schema4 } = statement;
const tableNameWithSchema = schema4 ? `"${schema4}"."${tableName}"` : `"${tableName}"`;
return `ALTER TABLE ${tableNameWithSchema} SET SCHEMA public;
`;
}
};
SqliteDropIndexConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "drop_index" && dialect6 === "sqlite";
}
convert(statement) {
const { name } = PgSquasher.unsquashIdx(statement.data);
return `DROP INDEX IF EXISTS \`${name}\`;`;
}
};
MysqlCreateSchemaConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "create_schema" && dialect6 === "mysql";
}
convert(statement) {
const { name } = statement;
return `CREATE DATABASE \`${name}\`;
`;
}
};
MysqlDropSchemaConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "drop_schema" && dialect6 === "mysql";
}
convert(statement) {
const { name } = statement;
return `DROP DATABASE \`${name}\`;
`;
}
};
MysqlAlterTableSetSchemaConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_set_schema" && dialect6 === "mysql";
}
convert(statement) {
const { tableName, schema: schema4 } = statement;
const nameFrom = `\`${tableName}\``;
const nameTo = `\`${schema4}\`.\`${tableName}\``;
return `RENAME TABLE ${nameFrom} TO ${nameTo};
`;
}
};
MysqlAlterTableSetNewSchemaConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_set_new_schema" && dialect6 === "mysql";
}
convert(statement) {
const { tableName, to, from } = statement;
const nameFrom = from ? `\`${from}\`.\`${tableName}\`` : `\`${tableName}\``;
const nameTo = to ? `\`${to}\`.\`${tableName}\`` : `\`${tableName}\``;
return `RENAME TABLE ${nameFrom} TO ${nameTo};
`;
}
};
MysqlAlterTableRemoveFromSchemaConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "alter_table_remove_from_schema" && dialect6 === "mysql";
}
convert(statement) {
const { tableName, schema: schema4 } = statement;
const nameFrom = `\`${schema4}\`.\`${tableName}\``;
const nameTo = `\`${tableName}\``;
return `RENAME TABLE ${nameFrom} TO ${nameTo};
`;
}
};
MySqlDropIndexConvertor = class extends Convertor {
can(statement, dialect6) {
return statement.type === "drop_index" && dialect6 === "mysql";
}
convert(statement) {
const tableName = typeof statement.schema === "undefined" ? `\`${statement.tableName}\`` : `\`${statement.schema}\`.\`${statement.tableName}\``;
const { name } = MySqlSquasher.unsquashIdx(statement.data);
return `DROP INDEX \`${name}\` ON ${tableName};`;
}
};
convertors = [];
convertors.push(new PgCreateTableConvertor());
convertors.push(new MySqlCreateTableConvertor());
convertors.push(new SQLiteCreateTableConvertor());
convertors.push(new CreateTypeEnumConvertor());
convertors.push(new PgDropTableConvertor());
convertors.push(new MySQLDropTableConvertor());
convertors.push(new SQLiteDropTableConvertor());
convertors.push(new PgRenameTableConvertor());
convertors.push(new MySqlRenameTableConvertor());
convertors.push(new SqliteRenameTableConvertor());
convertors.push(new PgAlterTableRenameColumnConvertor());
convertors.push(new MySqlAlterTableRenameColumnConvertor());
convertors.push(new SQLiteAlterTableRenameColumnConvertor());
convertors.push(new PgAlterTableDropColumnConvertor());
convertors.push(new MySqlAlterTableDropColumnConvertor());
convertors.push(new SQLiteAlterTableDropColumnConvertor());
convertors.push(new PgAlterTableAddColumnConvertor());
convertors.push(new MySqlAlterTableAddColumnConvertor());
convertors.push(new SQLiteAlterTableAddColumnConvertor());
convertors.push(new PgAlterTableAlterColumnSetTypeConvertor());
convertors.push(new CreatePgIndexConvertor());
convertors.push(new CreateMySqlIndexConvertor());
convertors.push(new CreateSqliteIndexConvertor());
convertors.push(new PgDropIndexConvertor());
convertors.push(new SqliteDropIndexConvertor());
convertors.push(new MySqlDropIndexConvertor());
convertors.push(new AlterTypeAddValueConvertor());
convertors.push(new PgAlterTableAlterColumnSetPrimaryKeyConvertor());
convertors.push(new PgAlterTableAlterColumnDropPrimaryKeyConvertor());
convertors.push(new PgAlterTableAlterColumnSetNotNullConvertor());
convertors.push(new PgAlterTableAlterColumnDropNotNullConvertor());
convertors.push(new PgAlterTableAlterColumnSetDefaultConvertor());
convertors.push(new PgAlterTableAlterColumnDropDefaultConvertor());
convertors.push(new MySqlModifyColumn());
convertors.push(new PgCreateForeignKeyConvertor());
convertors.push(new MySqlCreateForeignKeyConvertor());
convertors.push(new PgAlterForeignKeyConvertor());
convertors.push(new PgDeleteForeignKeyConvertor());
convertors.push(new MySqlDeleteForeignKeyConvertor());
convertors.push(new PgCreateSchemaConvertor());
convertors.push(new PgRenameSchemaConvertor());
convertors.push(new PgDropSchemaConvertor());
convertors.push(new PgAlterTableSetSchemaConvertor());
convertors.push(new PgAlterTableSetNewSchemaConvertor());
convertors.push(new PgAlterTableRemoveFromSchemaConvertor());
convertors.push(new MysqlCreateSchemaConvertor());
convertors.push(new MysqlDropSchemaConvertor());
convertors.push(new MysqlAlterTableSetSchemaConvertor());
convertors.push(new MysqlAlterTableSetNewSchemaConvertor());
convertors.push(new MysqlAlterTableRemoveFromSchemaConvertor());
convertors.push(new SQLiteAlterTableAlterColumnSetTypeConvertor());
convertors.push(new SqliteAlterForeignKeyConvertor());
convertors.push(new SqliteDeleteForeignKeyConvertor());
convertors.push(new SqliteCreateForeignKeyConvertor());
convertors.push(new SqliteAlterTableAlterColumnSetNotNullConvertor());
convertors.push(new SqliteAlterTableAlterColumnDropNotNullConvertor());
convertors.push(new SqliteAlterTableAlterColumnSetDefaultConvertor());
convertors.push(new SqliteAlterTableAlterColumnDropDefaultConvertor());
convertors.push(new SqliteAlterTableAlterColumnSetAutoincrementConvertor());
convertors.push(new SqliteAlterTableAlterColumnDropAutoincrementConvertor());
convertors.push(new SqliteAlterTableCreateCompositePrimaryKeyConvertor());
convertors.push(new SqliteAlterTableDeleteCompositePrimaryKeyConvertor());
convertors.push(new SqliteAlterTableAlterCompositePrimaryKeyConvertor());
convertors.push(new PgAlterTableCreateCompositePrimaryKeyConvertor());
convertors.push(new PgAlterTableDeleteCompositePrimaryKeyConvertor());
convertors.push(new PgAlterTableAlterCompositePrimaryKeyConvertor());
convertors.push(new MySqlAlterTableDeleteCompositePrimaryKeyConvertor());
convertors.push(new MySqlAlterTableDropPk());
convertors.push(new MySqlAlterTableCreateCompositePrimaryKeyConvertor());
convertors.push(new MySqlAlterTableAddPk());
convertors.push(new MySqlAlterTableAlterCompositePrimaryKeyConvertor());
fromJson = (statements, dialect6) => {
const result = statements.map((statement) => {
const filtered = convertors.filter((it) => {
return it.can(statement, dialect6);
});
const convertor = filtered.length === 1 ? filtered[0] : void 0;
if (!convertor) {
return "";
}
return convertor.convert(statement);
}).filter((it) => it !== "");
return result;
};
https:
`
create table users (
id int,
name character varying(128)
);
create type venum as enum('one', 'two', 'three');
alter table users add column typed venum;
insert into users(id, name, typed) values (1, 'name1', 'one');
insert into users(id, name, typed) values (2, 'name2', 'two');
insert into users(id, name, typed) values (3, 'name3', 'three');
alter type venum rename to __venum;
create type venum as enum ('one', 'two', 'three', 'four', 'five');
ALTER TABLE users ALTER COLUMN typed TYPE venum USING typed::text::venum;
insert into users(id, name, typed) values (4, 'name4', 'four');
insert into users(id, name, typed) values (5, 'name5', 'five');
drop type __venum;
`;
}
});
// src/jsonStatements.ts
var preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareCreateSchemasJson, prepareRenameSchemasJson, prepareDeleteSchemasJson, prepareRenameColumns, prepareAlterTableColumnsJson, _prepareDropColumns, _prepareAddColumns, _prepareSQLiteAddColumns, _prepareAlterColumns, prepareCreateIndexesJson, prepareCreateReferencesJson, prepareDropReferencesJson, prepareAlterReferencesJson, prepareDropIndexesJson, prepareAddCompositePrimaryKeySqlite, prepareDeleteCompositePrimaryKeySqlite, prepareAlterCompositePrimaryKeySqlite, prepareAddCompositePrimaryKeyPg, prepareDeleteCompositePrimaryKeyPg, prepareAlterCompositePrimaryKeyPg, prepareAddCompositePrimaryKeyMySql, prepareDeleteCompositePrimaryKeyMySql, prepareAlterCompositePrimaryKeyMySql;
var init_jsonStatements = __esm({
"src/jsonStatements.ts"() {
init_mysqlSchema();
init_pgSchema();
init_sqliteSchema();
preparePgCreateTableJson = (table4, json2) => {
const { name, schema: schema4, columns, compositePrimaryKeys } = table4;
return {
type: "create_table",
tableName: name,
schema: schema4,
columns: Object.values(columns),
compositePKs: Object.values(compositePrimaryKeys),
compositePkName: Object.values(compositePrimaryKeys).length > 0 ? json2.tables[name].compositePrimaryKeys[`${name}_${PgSquasher.unsquashPK(
Object.values(compositePrimaryKeys)[0]
).columns.join("_")}`].name : ""
};
};
prepareMySqlCreateTableJson = (table4, json2) => {
const { name, schema: schema4, columns, compositePrimaryKeys } = table4;
return {
type: "create_table",
tableName: name,
schema: schema4,
columns: Object.values(columns),
compositePKs: Object.values(compositePrimaryKeys),
compositePkName: Object.values(compositePrimaryKeys).length > 0 ? json2.tables[name].compositePrimaryKeys[`${name}_${MySqlSquasher.unsquashPK(
Object.values(compositePrimaryKeys)[0]
).columns.join("_")}`].name : ""
};
};
prepareSQLiteCreateTable = (table4) => {
const { name, columns } = table4;
const references2 = Object.values(table4.foreignKeys);
const composites = Object.values(table4.compositePrimaryKeys).map(
(it) => SQLiteSquasher.unsquashPK(it)
);
return {
type: "sqlite_create_table",
tableName: name,
columns: Object.values(columns),
referenceData: references2,
compositePKs: composites
};
};
prepareDropTableJson = (table4) => {
return {
type: "drop_table",
tableName: table4.name,
schema: table4.schema
};
};
prepareRenameTableJson = (tableFrom, tableTo) => {
return {
type: "rename_table",
fromSchema: tableFrom.schema,
toSchema: tableTo.schema,
tableNameFrom: tableFrom.name,
tableNameTo: tableTo.name
};
};
prepareCreateEnumJson = (name, values) => {
return {
type: "create_type_enum",
name,
values
};
};
prepareAddValuesToEnumJson = (name, values) => {
return values.map((it) => {
return {
type: "alter_type_add_value",
name,
value: it
};
});
};
prepareCreateSchemasJson = (values) => {
return values.map((it) => {
return {
type: "create_schema",
name: it
};
});
};
prepareRenameSchemasJson = (values) => {
return values.map((it) => {
return {
type: "rename_schema",
from: it.from,
to: it.to
};
});
};
prepareDeleteSchemasJson = (values) => {
return values.map((it) => {
return {
type: "drop_schema",
name: it
};
});
};
prepareRenameColumns = (tableName, schema4, pairs) => {
return pairs.map((it) => {
return {
type: "alter_table_rename_column",
tableName,
oldColumnName: it.from.name,
newColumnName: it.to.name,
schema: schema4
};
});
};
prepareAlterTableColumnsJson = (tableName, schema4, deleted, added, altered, addedFk, json2, dialect6) => {
const addColumns = [];
const dropColumns = _prepareDropColumns(tableName, schema4, deleted);
const alterColumns = _prepareAlterColumns(tableName, schema4, altered, json2);
if (dialect6 === "sqlite") {
let jsonCreateFKStatements = Object.values(addedFk);
const sqliteAddColumns = _prepareSQLiteAddColumns(
tableName,
added,
jsonCreateFKStatements
);
addColumns.push(...sqliteAddColumns);
} else {
addColumns.push(..._prepareAddColumns(tableName, schema4, added));
}
return { addColumns, dropColumns, alterColumns };
};
_prepareDropColumns = (taleName, schema4, columns) => {
return columns.map((it) => {
return {
type: "alter_table_drop_column",
tableName: taleName,
columnName: it.name,
schema: schema4
};
});
};
_prepareAddColumns = (tableName, schema4, columns) => {
return columns.map((it) => {
return {
type: "alter_table_add_column",
tableName,
column: it,
schema: schema4
};
});
};
_prepareSQLiteAddColumns = (tableName, columns, referenceData) => {
const unsquashed = referenceData.map(
(addedFkValue) => SQLiteSquasher.unsquashFK(addedFkValue)
);
return columns.map((it) => {
const columnsWithReference = unsquashed.find(
(t) => t.columnsFrom.includes(it.name)
);
return {
type: "sqlite_alter_table_add_column",
tableName,
column: it,
referenceData: columnsWithReference ? SQLiteSquasher.squashFK(columnsWithReference) : void 0
};
});
};
_prepareAlterColumns = (tableName, schema4, columns, json2) => {
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
let statements = [];
let dropPkStatements = [];
let setPkStatements = [];
for (const column7 of columns) {
const columnName = typeof column7.name !== "string" ? column7.name.new : column7.name;
const columnType = json2.tables[tableName].columns[columnName].type;
const columnDefault = json2.tables[tableName].columns[columnName].default;
const columnOnUpdate = json2.tables[tableName].columns[columnName].onUpdate;
const columnNotNull = json2.tables[tableName].columns[columnName].notNull;
const columnAutoIncrement = json2.tables[tableName].columns[columnName].autoincrement;
const columnPk = json2.tables[tableName].columns[columnName].primaryKey;
if (((_a = column7.autoincrement) == null ? void 0 : _a.type) === "added") {
statements.push({
type: "alter_table_alter_column_set_autoincrement",
tableName,
columnName,
schema: schema4,
newDataType: columnType,
columnDefault,
columnOnUpdate,
columnNotNull,
columnAutoIncrement,
columnPk
});
}
if (((_b = column7.autoincrement) == null ? void 0 : _b.type) === "changed") {
const type = column7.autoincrement.new ? "alter_table_alter_column_set_autoincrement" : "alter_table_alter_column_drop_autoincrement";
statements.push({
type,
tableName,
columnName,
schema: schema4,
newDataType: columnType,
columnDefault,
columnOnUpdate,
columnNotNull,
columnAutoIncrement,
columnPk
});
}
if (((_c = column7.autoincrement) == null ? void 0 : _c.type) === "deleted") {
statements.push({
type: "alter_table_alter_column_drop_autoincrement",
tableName,
columnName,
schema: schema4,
newDataType: columnType,
columnDefault,
columnOnUpdate,
columnNotNull,
columnAutoIncrement,
columnPk
});
}
}
for (const column7 of columns) {
const columnName = typeof column7.name !== "string" ? column7.name.new : column7.name;
const columnType = json2.tables[tableName].columns[columnName].type;
const columnDefault = json2.tables[tableName].columns[columnName].default;
const columnOnUpdate = json2.tables[tableName].columns[columnName].onUpdate;
const columnNotNull = json2.tables[tableName].columns[columnName].notNull;
const columnAutoIncrement = json2.tables[tableName].columns[columnName].autoincrement;
const columnPk = json2.tables[tableName].columns[columnName].primaryKey;
if (typeof column7.name !== "string") {
statements.push({
type: "alter_table_rename_column",
tableName,
oldColumnName: column7.name.old,
newColumnName: column7.name.new,
schema: schema4
});
}
if (((_d = column7.type) == null ? void 0 : _d.type) === "changed") {
statements.push({
type: "alter_table_alter_column_set_type",
tableName,
columnName,
newDataType: column7.type.new,
oldDataType: column7.type.old,
schema: schema4,
columnDefault,
columnOnUpdate,
columnNotNull,
columnAutoIncrement,
columnPk
});
}
if (((_e = column7.primaryKey) == null ? void 0 : _e.type) === "deleted" || ((_f = column7.primaryKey) == null ? void 0 : _f.type) === "changed" && !column7.primaryKey.new) {
dropPkStatements.push({
////
type: "alter_table_alter_column_drop_pk",
tableName,
columnName
});
}
if (((_g = column7.default) == null ? void 0 : _g.type) === "added") {
statements.push({
type: "alter_table_alter_column_set_default",
tableName,
columnName,
newDefaultValue: column7.default.value,
schema: schema4,
columnOnUpdate,
columnNotNull,
columnAutoIncrement,
newDataType: columnType,
columnPk
});
}
if (((_h = column7.default) == null ? void 0 : _h.type) === "changed") {
statements.push({
type: "alter_table_alter_column_set_default",
tableName,
columnName,
newDefaultValue: column7.default.new,
oldDefaultValue: column7.default.old,
schema: schema4,
columnOnUpdate,
columnNotNull,
columnAutoIncrement,
newDataType: columnType,
columnPk
});
}
if (((_i = column7.default) == null ? void 0 : _i.type) === "deleted") {
statements.push({
type: "alter_table_alter_column_drop_default",
tableName,
columnName,
schema: schema4,
columnDefault,
columnOnUpdate,
columnNotNull,
columnAutoIncrement,
newDataType: columnType,
columnPk
});
}
if (((_j = column7.notNull) == null ? void 0 : _j.type) === "added") {
statements.push({
type: "alter_table_alter_column_set_notnull",
tableName,
columnName,
schema: schema4,
newDataType: columnType,
columnDefault,
columnOnUpdate,
columnNotNull,
columnAutoIncrement,
columnPk
});
}
if (((_k = column7.notNull) == null ? void 0 : _k.type) === "changed") {
const type = column7.notNull.new ? "alter_table_alter_column_set_notnull" : "alter_table_alter_column_drop_notnull";
statements.push({
type,
tableName,
columnName,
schema: schema4,
newDataType: columnType,
columnDefault,
columnOnUpdate,
columnNotNull,
columnAutoIncrement,
columnPk
});
}
if (((_l = column7.notNull) == null ? void 0 : _l.type) === "deleted") {
statements.push({
type: "alter_table_alter_column_drop_notnull",
tableName,
columnName,
schema: schema4,
newDataType: columnType,
columnDefault,
columnOnUpdate,
columnNotNull,
columnAutoIncrement,
columnPk
});
}
if (((_m = column7.primaryKey) == null ? void 0 : _m.type) === "added" || ((_n = column7.primaryKey) == null ? void 0 : _n.type) === "changed" && column7.primaryKey.new) {
const wasAutoincrement = statements.filter(
(it) => it.type === "alter_table_alter_column_set_autoincrement"
);
if (wasAutoincrement.length === 0) {
setPkStatements.push({
type: "alter_table_alter_column_set_pk",
tableName,
schema: schema4,
columnName
});
}
}
if (((_o = column7.onUpdate) == null ? void 0 : _o.type) === "added") {
statements.push({
type: "alter_table_alter_column_set_on_update",
tableName,
columnName,
schema: schema4,
newDataType: columnType,
columnDefault,
columnOnUpdate,
columnNotNull,
columnAutoIncrement,
columnPk
});
}
if (((_p = column7.onUpdate) == null ? void 0 : _p.type) === "deleted") {
statements.push({
type: "alter_table_alter_column_drop_on_update",
tableName,
columnName,
schema: schema4,
newDataType: columnType,
columnDefault,
columnOnUpdate,
columnNotNull,
columnAutoIncrement,
columnPk
});
}
}
return [...dropPkStatements, ...setPkStatements, ...statements];
};
prepareCreateIndexesJson = (tableName, schema4, indexes) => {
return Object.values(indexes).map((indexData) => {
return {
type: "create_index",
tableName,
data: indexData,
schema: schema4
};
});
};
prepareCreateReferencesJson = (tableName, schema4, foreignKeys) => {
return Object.values(foreignKeys).map((fkData) => {
return {
type: "create_reference",
tableName,
data: fkData,
schema: schema4
};
});
};
prepareDropReferencesJson = (tableName, schema4, foreignKeys) => {
return Object.values(foreignKeys).map((fkData) => {
return {
type: "delete_reference",
tableName,
data: fkData,
schema: schema4
};
});
};
prepareAlterReferencesJson = (tableName, schema4, foreignKeys) => {
const keys = Object.keys(foreignKeys);
const stmts = [];
if (keys.length > 0) {
stmts.push(
...prepareDropReferencesJson(tableName, schema4, {
[keys[0]]: foreignKeys[keys[0]].__old
})
);
stmts.push(
...prepareCreateReferencesJson(tableName, schema4, {
[keys[0]]: foreignKeys[keys[0]].__new
})
);
}
return stmts;
};
prepareDropIndexesJson = (tableName, schema4, indexes) => {
return Object.values(indexes).map((indexData) => {
return {
type: "drop_index",
tableName,
data: indexData,
schema: schema4
};
});
};
prepareAddCompositePrimaryKeySqlite = (tableName, pks) => {
return Object.values(pks).map((it) => {
return {
type: "create_composite_pk",
tableName,
data: it
};
});
};
prepareDeleteCompositePrimaryKeySqlite = (tableName, pks) => {
return Object.values(pks).map((it) => {
return {
type: "delete_composite_pk",
tableName,
data: it
};
});
};
prepareAlterCompositePrimaryKeySqlite = (tableName, pks) => {
return Object.values(pks).map((it) => {
return {
type: "alter_composite_pk",
tableName,
old: it.__old,
new: it.__new
};
});
};
prepareAddCompositePrimaryKeyPg = (tableName, schema4, pks, json2) => {
return Object.values(pks).map((it) => {
return {
type: "create_composite_pk",
tableName,
data: it,
schema: schema4,
constraintName: json2.tables[tableName].compositePrimaryKeys[`${tableName}_${PgSquasher.unsquashPK(it).columns.join("_")}`].name
};
});
};
prepareDeleteCompositePrimaryKeyPg = (tableName, schema4, pks, json1) => {
return Object.values(pks).map((it) => {
return {
type: "delete_composite_pk",
tableName,
data: it,
schema: schema4,
constraintName: json1.tables[tableName].compositePrimaryKeys[`${tableName}_${PgSquasher.unsquashPK(it).columns.join("_")}`].name
};
});
};
prepareAlterCompositePrimaryKeyPg = (tableName, schema4, pks, json1, json2) => {
return Object.values(pks).map((it) => {
return {
type: "alter_composite_pk",
tableName,
old: it.__old,
new: it.__new,
schema: schema4,
oldConstraintName: json1.tables[tableName].compositePrimaryKeys[`${tableName}_${PgSquasher.unsquashPK(it.__old).columns.join("_")}`].name,
newConstraintName: json2.tables[tableName].compositePrimaryKeys[`${tableName}_${PgSquasher.unsquashPK(it.__new).columns.join("_")}`].name
};
});
};
prepareAddCompositePrimaryKeyMySql = (tableName, pks, json2) => {
return Object.values(pks).map((it) => {
return {
type: "create_composite_pk",
tableName,
data: it,
constraintName: json2.tables[tableName].compositePrimaryKeys[`${tableName}_${MySqlSquasher.unsquashPK(it).columns.join("_")}`].name
};
});
};
prepareDeleteCompositePrimaryKeyMySql = (tableName, pks, json1) => {
return Object.values(pks).map((it) => {
return {
type: "delete_composite_pk",
tableName,
data: it,
constraintName: json1.tables[tableName].compositePrimaryKeys[`${tableName}_${MySqlSquasher.unsquashPK(it).columns.join("_")}`].name
};
});
};
prepareAlterCompositePrimaryKeyMySql = (tableName, pks, json1, json2) => {
return Object.values(pks).map((it) => {
return {
type: "alter_composite_pk",
tableName,
old: it.__old,
new: it.__new,
oldConstraintName: json1.tables[tableName].compositePrimaryKeys[`${tableName}_${MySqlSquasher.unsquashPK(it.__old).columns.join("_")}`].name,
newConstraintName: json2.tables[tableName].compositePrimaryKeys[`${tableName}_${MySqlSquasher.unsquashPK(it.__new).columns.join("_")}`].name
};
});
};
}
});
// src/snapshotsDiffer.ts
var makeChanged, makeSelfOrChanged, makePatched, makeSelfOrPatched, valueFromSelfOrPatchedNew, columnSchema, alteredColumnSchema, enumSchema2, changedEnumSchema, tableScheme, alteredTableScheme, diffResultScheme, applySnapshotsDiff;
var init_snapshotsDiffer = __esm({
"src/snapshotsDiffer.ts"() {
init_sqlgenerator();
init_lib();
init_jsonDiffer();
init_jsonStatements();
init_utils2();
init_sqliteSchema();
init_mysqlSchema();
makeChanged = (schema4) => {
return objectType({
type: enumType(["changed"]),
old: schema4,
new: schema4
});
};
makeSelfOrChanged = (schema4) => {
return unionType([
schema4,
objectType({
type: enumType(["changed"]),
old: schema4,
new: schema4
})
]);
};
makePatched = (schema4) => {
return unionType([
objectType({
type: literalType("added"),
value: schema4
}),
objectType({
type: literalType("deleted"),
value: schema4
}),
objectType({
type: literalType("changed"),
old: schema4,
new: schema4
})
]);
};
makeSelfOrPatched = (schema4) => {
return unionType([
objectType({
type: literalType("none"),
value: schema4.optional()
}),
objectType({
type: literalType("added"),
value: schema4
}),
objectType({
type: literalType("deleted"),
value: schema4
}),
objectType({
type: literalType("changed"),
old: schema4,
new: schema4
})
]);
};
valueFromSelfOrPatchedNew = (it) => {
switch (it.type) {
case "none":
return it.value;
case "added":
return it.value;
case "deleted":
return it.value;
case "changed":
return it.new;
}
};
columnSchema = objectType({
name: stringType(),
type: stringType(),
primaryKey: booleanType().optional(),
unique: booleanType().optional(),
default: anyType().optional(),
notNull: booleanType().optional(),
// should it be optional? should if be here?
autoincrement: booleanType().optional(),
onUpdate: booleanType().optional()
}).strict();
alteredColumnSchema = objectType({
name: makeSelfOrChanged(stringType()),
type: makeChanged(stringType()).optional(),
default: makePatched(anyType()).optional(),
primaryKey: makePatched(booleanType()).optional(),
notNull: makePatched(booleanType()).optional(),
onUpdate: makePatched(booleanType()).optional(),
autoincrement: makePatched(booleanType()).optional()
}).strict();
enumSchema2 = objectType({
name: stringType(),
values: arrayType(stringType())
}).strict();
changedEnumSchema = objectType({
name: stringType(),
addedValues: arrayType(stringType()),
deletedValues: arrayType(stringType())
}).strict();
tableScheme = objectType({
name: stringType(),
schema: stringType().default(""),
columns: recordType(stringType(), columnSchema),
indexes: recordType(stringType(), stringType()),
foreignKeys: recordType(stringType(), stringType()),
compositePrimaryKeys: recordType(stringType(), stringType()).default({})
}).strict();
alteredTableScheme = objectType({
name: stringType(),
schema: makeSelfOrPatched(stringType()),
deleted: columnSchema.array(),
added: columnSchema.array(),
altered: alteredColumnSchema.array(),
addedIndexes: recordType(stringType(), stringType()),
deletedIndexes: recordType(stringType(), stringType()),
alteredIndexes: recordType(
stringType(),
objectType({
__new: stringType(),
__old: stringType()
}).strict()
),
addedForeignKeys: recordType(stringType(), stringType()),
deletedForeignKeys: recordType(stringType(), stringType()),
alteredForeignKeys: recordType(
stringType(),
objectType({
__new: stringType(),
__old: stringType()
}).strict()
),
addedCompositePKs: recordType(stringType(), stringType()),
deletedCompositePKs: recordType(stringType(), stringType()),
alteredCompositePKs: recordType(
stringType(),
objectType({
__new: stringType(),
__old: stringType()
})
)
}).strict();
diffResultScheme = objectType({
addedTables: tableScheme.array(),
deletedTables: tableScheme.array(),
alteredTablesWithColumns: alteredTableScheme.array(),
addedEnums: enumSchema2.array(),
deletedEnums: enumSchema2.array(),
alteredEnums: changedEnumSchema.array(),
addedSchemas: stringType().array(),
deletedSchemas: stringType().array()
}).strict();
applySnapshotsDiff = async (json1, json2, dialect6, schemasResolver, tablesResolver, columnsResolver, prevFull, curFull) => {
var _a, _b;
const diffResult = applyJsonDiff(json1, json2);
if (Object.keys(diffResult).length === 0) {
return { statements: [], sqlStatements: [], _meta: void 0 };
}
const typedResult = diffResultScheme.parse(diffResult);
const {
created: createdSchemas,
deleted: deletedSchemas,
renamed: renamedSchemas
} = await schemasResolver({
created: typedResult.addedSchemas.map((it) => ({ name: it })),
deleted: typedResult.deletedSchemas.map((it) => ({ name: it }))
});
const { created, deleted, renamed } = await tablesResolver({
created: typedResult.addedTables,
deleted: typedResult.deletedTables
});
const rSchemas = renamedSchemas.map((it) => ({
from: it.from.name,
to: it.to.name
}));
const rTables = renamed.map((it) => {
return { from: it.from, to: it.to };
});
const jsonStatements = [];
const jsonSQLiteCreateTables = created.map((it) => {
return prepareSQLiteCreateTable(it);
});
const jsonCreateIndexesForCreatedTables = created.map((it) => {
return prepareCreateIndexesJson(it.name, it.schema, it.indexes);
}).flat();
const jsonDropTables = deleted.map((it) => {
return prepareDropTableJson(it);
});
const jsonRenameTables = renamed.map((it) => {
return prepareRenameTableJson(it.from, it.to);
});
const renamedWithAlternations = Object.values(
alteredTableScheme.array().parse(diffForRenamedTables(renamed))
).map((it) => it);
const allAltered = typedResult.alteredTablesWithColumns.concat(
renamedWithAlternations
);
const jsonRenameColumnsStatements = [];
const allAlteredResolved = [];
for (const table4 of allAltered) {
const schemaUnwrapped = valueFromSelfOrPatchedNew(table4.schema);
const result = await columnsResolver({
tableName: table4.name,
schema: schemaUnwrapped,
created: table4.added,
deleted: table4.deleted
});
const schema4 = valueFromSelfOrPatchedNew(table4.schema);
jsonRenameColumnsStatements.push(
...prepareRenameColumns(table4.name, schema4, result.renamed)
);
const renamedColumnsAltered = result.renamed.map(
(it) => alteredColumnSchema.parse(diffForRenamedColumn(it.from, it.to))
);
const allAltered2 = table4.altered.concat(renamedColumnsAltered);
const resolved = {
name: table4.name,
schema: table4.schema,
deleted: result.deleted,
added: result.created,
altered: allAltered2,
addedIndexes: table4.addedIndexes,
deletedIndexes: table4.deletedIndexes,
alteredIndexes: table4.alteredIndexes,
addedForeignKeys: table4.addedForeignKeys,
deletedForeignKeys: table4.deletedForeignKeys,
alteredForeignKeys: table4.alteredForeignKeys,
addedCompositePKs: table4.addedCompositePKs,
deletedCompositePKs: table4.deletedCompositePKs,
alteredCompositePKs: table4.alteredCompositePKs
};
allAlteredResolved.push(resolved);
}
const jsonAddedCompositePKs = [];
const jsonDeletedCompositePKs = [];
const jsonAlteredCompositePKs = [];
const jsonSetTableSchemas = [];
const jsonRemoveTableFromSchemas = [];
const jsonSetNewTableSchemas = [];
allAlteredResolved.forEach((it) => {
const schemaUnwrapped = valueFromSelfOrPatchedNew(it.schema);
let addedColumns = [];
for (const addedPkName of Object.keys(it.addedCompositePKs)) {
const addedPkColumns = it.addedCompositePKs[addedPkName];
if (dialect6 === "sqlite") {
addedColumns = SQLiteSquasher.unsquashPK(addedPkColumns);
} else if (dialect6 === "mysql") {
addedColumns = MySqlSquasher.unsquashPK(addedPkColumns).columns;
} else {
addedColumns = SQLiteSquasher.unsquashPK(addedPkColumns);
}
}
let deletedColumns = [];
for (const deletedPkName of Object.keys(it.deletedCompositePKs)) {
const deletedPkColumns = it.deletedCompositePKs[deletedPkName];
if (dialect6 === "sqlite") {
deletedColumns = SQLiteSquasher.unsquashPK(deletedPkColumns);
} else if (dialect6 === "mysql") {
deletedColumns = MySqlSquasher.unsquashPK(deletedPkColumns).columns;
} else {
deletedColumns = SQLiteSquasher.unsquashPK(deletedPkColumns);
}
}
addedColumns.sort();
deletedColumns.sort();
const doPerformDeleteAndCreate = JSON.stringify(addedColumns) !== JSON.stringify(deletedColumns);
let addedCompositePKs = [];
let deletedCompositePKs = [];
let alteredCompositePKs = [];
if (dialect6 === "sqlite") {
if (doPerformDeleteAndCreate) {
addedCompositePKs = prepareAddCompositePrimaryKeySqlite(
it.name,
it.addedCompositePKs
);
deletedCompositePKs = prepareDeleteCompositePrimaryKeySqlite(
it.name,
it.deletedCompositePKs
);
}
alteredCompositePKs = prepareAlterCompositePrimaryKeySqlite(
it.name,
it.alteredCompositePKs
);
} else if (dialect6 === "pg") {
if (doPerformDeleteAndCreate) {
addedCompositePKs = prepareAddCompositePrimaryKeyPg(
it.name,
schemaUnwrapped,
it.addedCompositePKs,
curFull
);
deletedCompositePKs = prepareDeleteCompositePrimaryKeyPg(
it.name,
schemaUnwrapped,
it.deletedCompositePKs,
prevFull
);
}
alteredCompositePKs = prepareAlterCompositePrimaryKeyPg(
it.name,
schemaUnwrapped,
it.alteredCompositePKs,
prevFull,
curFull
);
} else {
if (doPerformDeleteAndCreate) {
addedCompositePKs = prepareAddCompositePrimaryKeyMySql(
it.name,
it.addedCompositePKs,
curFull
);
deletedCompositePKs = prepareDeleteCompositePrimaryKeyMySql(
it.name,
it.deletedCompositePKs,
prevFull
);
}
;
alteredCompositePKs = prepareAlterCompositePrimaryKeyMySql(
it.name,
it.alteredCompositePKs,
prevFull,
curFull
);
}
if (it.schema && typeof it.schema !== "string") {
switch (it.schema.type) {
case "added": {
jsonSetTableSchemas.push({
schema: it.schema.value,
tableName: it.name,
type: "alter_table_set_schema"
});
break;
}
case "changed": {
jsonSetNewTableSchemas.push({
type: "alter_table_set_new_schema",
tableName: it.name,
from: it.schema.old,
to: it.schema.new
});
break;
}
case "deleted": {
jsonRemoveTableFromSchemas.push({
type: "alter_table_remove_from_schema",
tableName: it.name,
schema: it.schema.value
});
break;
}
}
}
jsonAddedCompositePKs.push(...addedCompositePKs);
jsonDeletedCompositePKs.push(...deletedCompositePKs);
jsonAlteredCompositePKs.push(...alteredCompositePKs);
});
const rColumns = jsonRenameColumnsStatements.map((it) => {
const tableName = it.tableName;
const schema4 = it.schema;
return {
from: { schema: schema4, table: tableName, column: it.oldColumnName },
to: { schema: schema4, table: tableName, column: it.newColumnName }
};
});
const jsonTableAlternations = allAlteredResolved.map((it) => {
const schema4 = valueFromSelfOrPatchedNew(it.schema);
return prepareAlterTableColumnsJson(
it.name,
schema4,
it.deleted,
it.added,
it.altered,
it.addedForeignKeys,
json2,
dialect6
);
}).flat().reduce(
(res, it) => {
res.createColumns.push(...it.addColumns);
res.dropColumns.push(...it.dropColumns);
res.alterColumns.push(...it.alterColumns);
return res;
},
{ createColumns: [], dropColumns: [], alterColumns: [] }
);
const jsonCreateIndexesForAllAlteredTables = allAltered.map((it) => {
const schema4 = valueFromSelfOrPatchedNew(it.schema);
return prepareCreateIndexesJson(it.name, schema4, it.addedIndexes || {});
}).flat();
const jsonDropIndexesForAllAlteredTables = allAltered.map((it) => {
const schema4 = valueFromSelfOrPatchedNew(it.schema);
return prepareDropIndexesJson(it.name, schema4, it.deletedIndexes || {});
}).flat();
allAltered.forEach((it) => {
const schema4 = valueFromSelfOrPatchedNew(it.schema);
const droppedIndexes = Object.keys(it.alteredIndexes).reduce(
(current, item) => {
current[item] = it.alteredIndexes[item].__old;
return current;
},
{}
);
const createdIndexes = Object.keys(it.alteredIndexes).reduce(
(current, item) => {
current[item] = it.alteredIndexes[item].__new;
return current;
},
{}
);
jsonCreateIndexesForAllAlteredTables.push(
...prepareCreateIndexesJson(it.name, schema4, createdIndexes || {})
);
jsonDropIndexesForAllAlteredTables.push(
...prepareDropIndexesJson(it.name, schema4, droppedIndexes || {})
);
});
const jsonCreateReferencesForCreatedTables = created.map((it) => {
return prepareCreateReferencesJson(it.name, it.schema, it.foreignKeys);
}).flat();
const jsonReferencesForAllAlteredTables = allAltered.map((it) => {
const schema4 = valueFromSelfOrPatchedNew(it.schema);
const forAdded = prepareCreateReferencesJson(
it.name,
schema4,
it.addedForeignKeys
);
const forAltered = prepareDropReferencesJson(
it.name,
schema4,
it.deletedForeignKeys
);
const alteredFKs = prepareAlterReferencesJson(
it.name,
schema4,
it.alteredForeignKeys
);
return [...forAdded, ...forAltered, ...alteredFKs];
}).flat();
const jsonCreateReferences = jsonCreateReferencesForCreatedTables;
const jsonCreatedReferencesForAlteredTables = jsonReferencesForAllAlteredTables.filter(
(t) => t.type === "create_reference"
);
const jsonDroppedReferencesForAlteredTables = jsonReferencesForAllAlteredTables.filter(
(t) => t.type === "delete_reference"
);
const createEnums = ((_a = typedResult.addedEnums) == null ? void 0 : _a.map((it) => {
return prepareCreateEnumJson(it.name, it.values);
})) ?? [];
const jsonAlterEnumsWithAddedValues = ((_b = typedResult.alteredEnums) == null ? void 0 : _b.map((it) => {
return prepareAddValuesToEnumJson(it.name, it.addedValues);
}).flat()) ?? [];
if (dialect6 === "mysql") {
createdSchemas.push(...renamedSchemas.map((it) => it.to));
deletedSchemas.push(...renamedSchemas.map((it) => it.from));
renamedSchemas.splice(0, renamedSchemas.length);
}
const createSchemas = prepareCreateSchemasJson(
createdSchemas.map((it) => it.name)
);
const renameSchemas = prepareRenameSchemasJson(
renamedSchemas.map((it) => ({ from: it.from.name, to: it.to.name }))
);
const dropSchemas = prepareDeleteSchemasJson(
deletedSchemas.map((it) => it.name)
);
const renamedSchemasSet = new Set(
renameSchemas.map((it) => `${it.from}-${it.to}`)
);
const filteredJsonSetNewTableSchemas = jsonSetNewTableSchemas.filter((it) => {
return !renamedSchemasSet.has(`${it.from}-${it.to}`);
});
jsonStatements.push(...createSchemas);
jsonStatements.push(...renameSchemas);
jsonStatements.push(...createEnums);
jsonStatements.push(...jsonAlterEnumsWithAddedValues);
if (dialect6 === "sqlite") {
jsonStatements.push(...jsonSQLiteCreateTables);
} else if (dialect6 === "pg") {
const jsonPgCreateTables = created.map((it) => {
return preparePgCreateTableJson(it, curFull);
});
jsonStatements.push(...jsonPgCreateTables);
} else {
const jsonMySqlCreateTables = created.map((it) => {
return prepareMySqlCreateTableJson(it, curFull);
});
jsonStatements.push(...jsonMySqlCreateTables);
}
jsonStatements.push(...jsonDropTables);
jsonStatements.push(...jsonRenameTables);
jsonStatements.push(...jsonRenameColumnsStatements);
jsonStatements.push(...jsonDeletedCompositePKs);
jsonStatements.push(...jsonDroppedReferencesForAlteredTables);
jsonStatements.push(...jsonDropIndexesForAllAlteredTables);
jsonStatements.push(...jsonTableAlternations.alterColumns);
jsonStatements.push(...jsonTableAlternations.createColumns);
jsonStatements.push(...jsonCreateIndexesForCreatedTables);
jsonStatements.push(...jsonCreateIndexesForAllAlteredTables);
jsonStatements.push(...jsonCreatedReferencesForAlteredTables);
jsonStatements.push(...jsonTableAlternations.dropColumns);
if (dialect6 !== "sqlite")
jsonStatements.push(...jsonCreateReferences);
jsonStatements.push(...jsonAddedCompositePKs);
jsonStatements.push(...jsonAlteredCompositePKs);
jsonStatements.push(...jsonSetTableSchemas);
jsonStatements.push(...filteredJsonSetNewTableSchemas);
jsonStatements.push(...jsonRemoveTableFromSchemas);
jsonStatements.push(...dropSchemas);
const sqlStatements = fromJson(jsonStatements, dialect6);
const uniqueSqlStatements = [];
sqlStatements.forEach((ss) => {
if (!uniqueSqlStatements.includes(ss)) {
uniqueSqlStatements.push(ss);
}
});
const _meta = prepareMigrationMeta(rSchemas, rTables, rColumns);
return {
statements: jsonStatements,
sqlStatements: uniqueSqlStatements,
_meta
};
};
}
});
// src/cli/commands/pgUp.ts
var import_crypto2, import_fs5, upPgHandlerV4toV5, upPgHandler, upPgHandlerV4, updateUpToV4, update1to2, update2to3, update3to4;
var init_pgUp = __esm({
"src/cli/commands/pgUp.ts"() {
init_source();
import_crypto2 = require("crypto");
import_fs5 = require("fs");
init_global();
init_pgSchema();
init_utils2();
upPgHandlerV4toV5 = (obj) => {
const mappedTables = {};
for (const [key, table4] of Object.entries(obj.tables)) {
const mappedColumns = {};
for (const [ckey, column7] of Object.entries(table4.columns)) {
let newDefault = column7.default;
let newType = column7.type;
if (column7.type.toLowerCase() === "date") {
if (typeof column7.default !== "undefined") {
if (column7.default.startsWith("'") && column7.default.endsWith("'")) {
newDefault = `'${column7.default.substring(1, column7.default.length - 1).split("T")[0]}'`;
} else {
newDefault = column7.default.split("T")[0];
}
}
} else if (column7.type.toLowerCase().startsWith("timestamp")) {
if (typeof column7.default !== "undefined") {
if (column7.default.startsWith("'") && column7.default.endsWith("'")) {
newDefault = `'${column7.default.substring(1, column7.default.length - 1).replace("T", " ").slice(0, 23)}'`;
} else {
newDefault = column7.default.replace("T", " ").slice(0, 23);
}
}
newType = column7.type.toLowerCase().replace("timestamp (", "timestamp(");
} else if (column7.type.toLowerCase().startsWith("time")) {
newType = column7.type.toLowerCase().replace("time (", "time(");
} else if (column7.type.toLowerCase().startsWith("interval")) {
newType = column7.type.toLowerCase().replace(" (", "(");
}
mappedColumns[ckey] = { ...column7, default: newDefault, type: newType };
}
mappedTables[key] = { ...table4, columns: mappedColumns, compositePrimaryKeys: {} };
}
return {
version: "5",
dialect: obj.dialect,
id: obj.id,
prevId: obj.prevId,
tables: mappedTables,
enums: obj.enums,
schemas: obj.schemas,
_meta: {
schemas: {},
tables: {},
columns: {}
}
};
};
upPgHandler = (out) => {
};
upPgHandlerV4 = (out) => {
const snapshots = snapshotsPriorV4(out);
const report = validateWithReport(snapshots, "pg");
let prevId = originUUID;
report.nonLatest.map((it) => ({
path: it,
raw: report.rawMap[it]
})).forEach((it) => {
const path3 = it.path;
const result = updateUpToV4(it.raw, prevId);
prevId = result.id;
console.log(`[${source_default.green("\u2713")}] ${path3}`);
(0, import_fs5.writeFileSync)(path3, JSON.stringify(result, null, 2));
});
console.log("Everything's fine \u{1F436}\u{1F525}");
};
updateUpToV4 = (json, prevId) => {
const version2 = Number(json["version"]);
if (version2 === 1) {
const v1 = pgSchemaV1.parse(json);
const v2 = update1to2(v1);
const v3 = update2to3(v2, prevId);
const v4 = update3to4(v3);
return v4;
}
if (version2 === 2) {
const v2 = pgSchemaV2.parse(json);
const v3 = update2to3(v2, prevId);
const v4 = update3to4(v3);
return v4;
}
if (version2 === 3) {
return update3to4(pgSchemaV3.parse(json));
}
return pgSchemaV4.parse(json);
};
update1to2 = (json) => {
const tables = Object.fromEntries(
Object.entries(json.tables).map((it) => {
const table4 = it[1];
const columns = Object.fromEntries(
Object.entries(table4.columns).map((it2) => {
const ref = it2[1].references;
const fkName = ref == null ? void 0 : ref.foreignKeyName;
const table5 = ref == null ? void 0 : ref.table;
const column7 = ref == null ? void 0 : ref.column;
const onDelete = ref == null ? void 0 : ref.onDelete;
const onUpdate = ref == null ? void 0 : ref.onDelete;
const newRef = ref ? `${fkName};${table5};${column7};${onDelete ?? ""};${onUpdate ?? ""}` : void 0;
return [it2[0], { ...it2[1], references: newRef }];
})
);
return [it[0], { name: table4.name, columns, indexes: table4.indexes }];
})
);
return { version: "2", tables, enums: json.enums };
};
update2to3 = (json, prevId) => {
const tables = Object.fromEntries(
Object.entries(json.tables).map((table4) => {
const { name, columns, indexes } = table4[1];
let refs = [];
const newColumns = Object.fromEntries(
Object.entries(columns).map((it) => {
const {
name: name2,
type,
primaryKey,
notNull,
default: defaultValue,
references: references2
} = it[1];
const newColumn = {
name: name2,
type,
primaryKey,
notNull,
default: defaultValue
};
if (references2) {
refs.push({ column: name2, value: references2 });
}
return [it[0], newColumn];
})
);
const tableName = name;
const fks = Object.fromEntries(
refs.map((it) => {
const [name2, table5, column7, onDelete, onUpdate] = it.value.split(";");
const fk4 = {
name: name2,
tableFrom: tableName,
columnsFrom: [it.column],
tableTo: table5,
columnsTo: [column7],
onUpdate,
onDelete
};
return [name2, fk4];
})
);
const idxs = Object.fromEntries(
Object.entries(indexes).map((it) => {
const { columns: columns2, isUnique, name: name2 } = it[1];
const mappedColumns = Object.entries(columns2).map((it2) => {
return it2[1].name;
});
const index4 = {
name: name2,
isUnique,
columns: mappedColumns
};
return [it[0], index4];
})
);
const newTable = {
name,
columns: newColumns,
indexes: idxs,
foreignKeys: fks
};
return [table4[0], newTable];
})
);
return {
version: "3",
dialect: "pg",
id: (0, import_crypto2.randomUUID)(),
prevId,
tables,
enums: json.enums
};
};
update3to4 = (json) => {
const tables = Object.fromEntries(
Object.entries(json.tables).map((table4) => {
const { name, columns, foreignKeys, indexes } = table4[1];
const newColumns = Object.fromEntries(
Object.entries(columns).map((it) => {
const {
name: name2,
type,
primaryKey,
notNull,
default: defaultValue
} = it[1];
const newColumn = {
name: name2,
type,
primaryKey,
notNull,
default: defaultValue
};
return [it[0], newColumn];
})
);
const newTable = {
name,
schema: "",
columns: newColumns,
indexes,
foreignKeys
};
return [table4[0], newTable];
})
);
return {
version: "4",
dialect: "pg",
id: (0, import_crypto2.randomUUID)(),
prevId: json.prevId,
tables,
enums: json.enums,
schemas: {}
};
};
}
});
// src/cli/commands/mysqlUp.ts
var import_fs6, upMysqlHandler, upMySqlHandlerV4toV5, upMysqlHandlerV4, updateToLatestV4, updateV3toV4;
var init_mysqlUp = __esm({
"src/cli/commands/mysqlUp.ts"() {
init_source();
import_fs6 = __toESM(require("fs"));
init_mysqlSchema();
init_utils2();
upMysqlHandler = (out) => {
};
upMySqlHandlerV4toV5 = (obj) => {
const mappedTables = {};
for (const [key, table4] of Object.entries(obj.tables)) {
const mappedColumns = {};
for (const [ckey, column7] of Object.entries(table4.columns)) {
let newDefault = column7.default;
let newType = column7.type;
let newAutoIncrement = column7.autoincrement;
if (column7.type.toLowerCase().startsWith("datetime")) {
if (typeof column7.default !== "undefined") {
if (column7.default.startsWith("'") && column7.default.endsWith("'")) {
newDefault = `'${column7.default.substring(1, column7.default.length - 1).replace("T", " ").slice(0, 23)}'`;
} else {
newDefault = column7.default.replace("T", " ").slice(0, 23);
}
}
newType = column7.type.toLowerCase().replace("datetime (", "datetime(");
} else if (column7.type.toLowerCase() === "date") {
if (typeof column7.default !== "undefined") {
if (column7.default.startsWith("'") && column7.default.endsWith("'")) {
newDefault = `'${column7.default.substring(1, column7.default.length - 1).split("T")[0]}'`;
} else {
newDefault = column7.default.split("T")[0];
}
}
newType = column7.type.toLowerCase().replace("date (", "date(");
} else if (column7.type.toLowerCase().startsWith("timestamp")) {
if (typeof column7.default !== "undefined") {
if (column7.default.startsWith("'") && column7.default.endsWith("'")) {
newDefault = `'${column7.default.substring(1, column7.default.length - 1).replace("T", " ").slice(0, 23)}'`;
} else {
newDefault = column7.default.replace("T", " ").slice(0, 23);
}
}
newType = column7.type.toLowerCase().replace("timestamp (", "timestamp(");
} else if (column7.type.toLowerCase().startsWith("time")) {
newType = column7.type.toLowerCase().replace("time (", "time(");
} else if (column7.type.toLowerCase().startsWith("decimal")) {
newType = column7.type.toLowerCase().replace(", ", ",");
} else if (column7.type.toLowerCase().startsWith("enum")) {
newType = column7.type.toLowerCase();
} else if (column7.type.toLowerCase().startsWith("serial")) {
newAutoIncrement = true;
}
mappedColumns[ckey] = {
...column7,
default: newDefault,
type: newType,
autoincrement: newAutoIncrement
};
}
mappedTables[key] = { ...table4, columns: mappedColumns, compositePrimaryKeys: {} };
}
return {
version: "5",
dialect: obj.dialect,
id: obj.id,
prevId: obj.prevId,
tables: mappedTables,
schemas: obj.schemas,
_meta: {
schemas: {},
tables: {},
columns: {}
}
};
};
upMysqlHandlerV4 = (out) => {
const snapshots = snapshotsPriorV4(out);
const report = validateWithReport(snapshots, "mysql");
report.nonLatest.map((it) => ({
path: it,
raw: report.rawMap[it]
})).forEach((it) => {
const path3 = it.path;
const result = updateToLatestV4(it.raw);
console.log(`[${source_default.green("\u2713")}] ${path3}`);
import_fs6.default.writeFileSync(path3, JSON.stringify(result, null, 2));
});
console.log("Everything's fine \u{1F436}\u{1F525}");
};
updateToLatestV4 = (json) => {
const version2 = Number(json["version"]);
if (version2 === 3) {
const v3 = mysqlSchemaV3.parse(json);
const v4 = updateV3toV4(v3);
return v4;
}
return mysqlSchemaV4.parse(json);
};
updateV3toV4 = (old) => {
return {
...old,
version: "4",
schemas: {}
};
};
}
});
// src/cli/commands/upFolders.ts
var import_fs7, import_path4, schemasResolverWithSQL, resolveSchemas, resolveTablesWithSQL, resolveTables, resolveColumnsWithSQL, resolveColumns, fullfill, fullfillpg, fullfillmysql, fullfillsqlite, upgradeFolders;
var init_upFolders = __esm({
"src/cli/commands/upFolders.ts"() {
import_fs7 = require("fs");
import_path4 = require("path");
init_jsonDiffer();
init_mysqlSchema();
init_sqliteSchema();
init_snapshotsDiffer();
init_utils2();
init_words();
init_pgUp();
init_pgSchema();
init_mysqlUp();
schemasResolverWithSQL = (missingSchemas, newSchemas, sql) => {
return resolveSchemas(
missingSchemas,
newSchemas,
(leftMissing, created) => {
const possibleRenames = leftMissing.map((it) => {
return {
value: it,
sql: `ALTER SCHEMA "${it.name}" RENAME TO "${created.name}"`
};
});
const renames = possibleRenames.filter((it) => {
return sql.includes(it.sql);
});
if (renames.length > 1)
throw new Error("wtf");
if (renames.length === 1) {
return renames[0].value;
}
}
);
};
resolveSchemas = (missingSchemas, newSchemas, predicate) => {
try {
if (missingSchemas.length === 0 || newSchemas.length === 0) {
return { created: newSchemas, renamed: [], deleted: missingSchemas };
}
const result = {
created: [],
renamed: [],
deleted: []
};
let index4 = 0;
let leftMissing = [...missingSchemas];
do {
const created = newSchemas[index4];
index4 += 1;
const renamed = predicate(leftMissing, created);
if (!renamed) {
result.created.push(created);
} else {
const it = renamed;
result.renamed.push({ from: it, to: created });
delete leftMissing[leftMissing.indexOf(it)];
leftMissing = leftMissing.filter(Boolean);
}
} while (index4 < newSchemas.length);
result.deleted.push(...leftMissing);
return result;
} catch (e) {
console.error(e);
throw e;
}
};
resolveTablesWithSQL = (missingTables, newTables, sql) => {
const resolver = (leftMissing, created) => {
const possibleRenames = leftMissing.map((it) => {
const pgSchemaPrefix = created.schema ? `"${created.schema}".` : "";
const mysqlSchemaPrefix = created.schema ? `\`${created.schema}\`.` : "";
return [
{
value: it,
sql: `ALTER TABLE ${pgSchemaPrefix}"${it.name}" RENAME TO ${pgSchemaPrefix}"${created.name}"`
},
{
value: it,
sql: `RENAME TABLE ${mysqlSchemaPrefix}\`${it.name}\` TO ${mysqlSchemaPrefix}\`${created.name}\`;`
},
{
value: it,
sql: `ALTER TABLE ${it.name} RENAME TO ${created.name};`
}
];
}).flat();
const renames = possibleRenames.filter((it) => {
return sql.includes(it.sql);
});
if (renames.length > 1)
throw new Error("wtf");
if (renames.length === 1)
return renames[0].value;
return void 0;
};
return resolveTables(missingTables, newTables, resolver);
};
resolveTables = (missingTables, newTables, resolver) => {
try {
if (missingTables.length === 0 || newTables.length === 0) {
return { created: newTables, renamed: [], deleted: missingTables };
}
const result = {
created: [],
renamed: [],
deleted: []
};
let index4 = 0;
let leftMissing = [...missingTables];
do {
const created = newTables[index4];
index4 += 1;
const renamed = resolver(leftMissing, created);
if (!renamed) {
result.created.push(created);
} else {
const it = renamed;
result.renamed.push({ from: it, to: created });
delete leftMissing[leftMissing.indexOf(it)];
leftMissing = leftMissing.filter(Boolean);
}
} while (index4 < newTables.length);
result.deleted.push(...leftMissing);
return result;
} catch (e) {
console.error(e);
throw e;
}
};
resolveColumnsWithSQL = (tableName, missingColumns, newColumns, sql) => {
const predicate = (leftMissing, created) => {
const possibleRenames = leftMissing.map((it) => {
return [
{
value: it,
sql: `ALTER TABLE ${tableName} RENAME COLUMN "${it.name}" TO "${created.name}"`
},
{
value: it,
sql: `ALTER TABLE ${tableName} RENAME COLUMN \`${it.name}\` TO \`${created.name}\``
}
// sqlite, same as mysql
// {
// value: it,
// sql: `ALTER TABLE ${tableName} RENAME COLUMN \`${it.name}\` TO \`${created.name}\``,
// },
];
}).flat();
const renames = possibleRenames.filter((it) => {
return sql.includes(it.sql);
});
if (renames.length > 1)
throw new Error("wtf");
if (renames.length === 1)
return renames[0].value;
return void 0;
};
return resolveColumns(missingColumns, newColumns, predicate);
};
resolveColumns = (missingColumns, newColumns, predicate) => {
try {
if (missingColumns.length === 0 || newColumns.length === 0) {
return { created: newColumns, renamed: [], deleted: missingColumns };
}
const result = {
created: [],
renamed: [],
deleted: []
};
let index4 = 0;
let leftMissing = [...missingColumns];
do {
const created = newColumns[index4];
index4 += 1;
const renamed = predicate(leftMissing, created);
if (!renamed) {
result.created.push(created);
} else {
const it = renamed;
result.renamed.push({ from: it, to: created });
delete leftMissing[leftMissing.indexOf(it)];
leftMissing = leftMissing.filter(Boolean);
}
} while (index4 < newColumns.length);
result.deleted.push(...leftMissing);
return result;
} catch (e) {
console.error(e);
throw e;
}
};
fullfill = (prev, cur, sql, dialect6) => {
if (dialect6 === "pg") {
return fullfillpg(prev, cur, sql);
}
if (dialect6 === "mysql") {
return fullfillmysql(prev, cur, sql);
}
if (dialect6 === "sqlite") {
return fullfillsqlite(prev, cur, sql);
}
throw new Error("");
};
fullfillpg = (prev, cur, sql) => {
const b = pgSchemaV4.parse(cur);
if (!prev) {
return upPgHandlerV4toV5(b);
}
const a = pgSchemaV4.parse(prev);
const json1 = squashPgSchemeV4(a);
const json2 = squashPgSchemeV4(b);
const diffResult = applyJsonDiff(json1, json2);
const emptyDiff = Object.keys(diffResult).length === 0;
const parseResult = emptyDiff ? {
success: true,
data: {
addedTables: [],
addedEnums: [],
addedSchemas: [],
deletedTables: [],
deletedSchemas: [],
deletedEnums: [],
alteredEnums: [],
alteredTablesWithColumns: []
}
} : diffResultScheme.safeParse(diffResult);
if (!parseResult.success) {
parseResult.error.errors.forEach((it) => {
console.error(it);
});
throw new Error();
}
const typedResult = parseResult.data;
const { renamed: renamedSchemas } = schemasResolverWithSQL(
typedResult.deletedSchemas.map((it) => ({ name: it })),
typedResult.addedSchemas.map((it) => ({ name: it })),
sql
);
const { renamed } = resolveTablesWithSQL(
typedResult.deletedTables,
typedResult.addedTables,
sql
);
const renamedWithAlternations = Object.values(
alteredTableScheme.array().parse(diffForRenamedTables(renamed))
);
const allAltered = typedResult.alteredTablesWithColumns.concat(
renamedWithAlternations
);
const rSchemas = renamedSchemas.map((it) => ({
from: it.from.name,
to: it.to.name
}));
const rTables = renamed.map((it) => {
return { from: it.from, to: it.to };
});
const rColumns = allAltered.map((table4) => {
const name = table4.name;
const result = resolveColumnsWithSQL(
name,
table4.deleted,
table4.added,
sql
);
const tableName = table4.name;
const schema4 = typeof table4.schema === "string" ? table4.schema : "";
return result.renamed.map((it) => {
return {
from: { schema: schema4, table: tableName, column: it.from.name },
to: { schema: schema4, table: tableName, column: it.to.name }
};
});
}).flat();
const _meta = prepareMigrationMeta(rSchemas, rTables, rColumns);
const bUpV5 = upPgHandlerV4toV5(b);
const bpatched = {
version: "5",
dialect: bUpV5.dialect,
id: bUpV5.id,
prevId: bUpV5.prevId,
tables: bUpV5.tables,
enums: bUpV5.enums,
schemas: bUpV5.schemas,
_meta
};
pgSchema.parse(bpatched);
return bUpV5;
};
fullfillmysql = (prev, cur, sql) => {
const b = mysqlSchemaV4.parse(cur);
if (!prev) {
return upMySqlHandlerV4toV5(b);
}
const a = mysqlSchemaV4.parse(prev);
const json1 = squashMysqlSchemeV4(a);
const json2 = squashMysqlSchemeV4(b);
const diffResult = applyJsonDiff(json1, json2);
const parseResult = diffResultScheme.safeParse(diffResult);
if (!parseResult.success) {
parseResult.error.errors.forEach((it) => {
console.error(it);
});
throw new Error();
}
const typedResult = parseResult.data;
const { renamed: renamedSchemas } = schemasResolverWithSQL(
typedResult.deletedSchemas.map((it) => ({ name: it })),
typedResult.addedSchemas.map((it) => ({ name: it })),
sql
);
const { renamed } = resolveTablesWithSQL(
typedResult.deletedTables,
typedResult.addedTables,
sql
);
const renamedWithAlternations = Object.values(
alteredTableScheme.array().parse(diffForRenamedTables(renamed))
);
const allAltered = typedResult.alteredTablesWithColumns.concat(
renamedWithAlternations
);
const rSchemas = renamedSchemas.map((it) => ({
from: it.from.name,
to: it.to.name
}));
const rTables = renamed.map((it) => {
return { from: it.from, to: it.to };
});
const rColumns = allAltered.map((table4) => {
const name = table4.name;
const result = resolveColumnsWithSQL(
name,
table4.deleted,
table4.added,
sql
);
const tableName = table4.name;
const schema4 = typeof table4.schema === "string" ? table4.schema : "";
return result.renamed.map((it) => {
return {
from: { schema: schema4, table: tableName, column: it.from.name },
to: { schema: schema4, table: tableName, column: it.to.name }
};
});
}).flat();
const _meta = prepareMigrationMeta(rSchemas, rTables, rColumns);
const bUpV5 = upMySqlHandlerV4toV5(b);
const bpatched = {
version: "5",
dialect: bUpV5.dialect,
id: bUpV5.id,
prevId: bUpV5.prevId,
tables: bUpV5.tables,
schemas: bUpV5.schemas,
_meta
};
mysqlSchema.parse(bpatched);
return bUpV5;
};
fullfillsqlite = (prev, cur, sql) => {
const b = sqliteSchemaV4.parse(cur);
if (!prev) {
return {
version: "5",
dialect: b.dialect,
id: b.id,
prevId: b.prevId,
tables: b.tables,
enums: {},
_meta: {
tables: {},
columns: {}
}
};
}
const a = sqliteSchemaV4.parse(prev);
const json1 = squashSqliteScheme(a);
const json2 = squashSqliteScheme(b);
const diffResult = applyJsonDiff(json1, json2);
const parseResult = diffResultScheme.safeParse(diffResult);
if (!parseResult.success) {
parseResult.error.errors.forEach((it) => {
console.error(it);
});
throw new Error();
}
const typedResult = parseResult.data;
const { renamed: renamedSchemas } = schemasResolverWithSQL(
typedResult.deletedSchemas.map((it) => ({ name: it })),
typedResult.addedSchemas.map((it) => ({ name: it })),
sql
);
const { renamed } = resolveTablesWithSQL(
typedResult.deletedTables,
typedResult.addedTables,
sql
);
const renamedWithAlternations = Object.values(
alteredTableScheme.array().parse(diffForRenamedTables(renamed))
);
const allAltered = typedResult.alteredTablesWithColumns.concat(
renamedWithAlternations
);
const rSchemas = renamedSchemas.map((it) => ({
from: it.from.name,
to: it.to.name
}));
const rTables = renamed.map((it) => {
return { from: it.from, to: it.to };
});
const rColumns = allAltered.map((table4) => {
const name = table4.name;
const result = resolveColumnsWithSQL(
name,
table4.deleted,
table4.added,
sql
);
const tableName = table4.name;
const schema4 = typeof table4.schema === "string" ? table4.schema : "";
return result.renamed.map((it) => {
return {
from: { schema: schema4, table: tableName, column: it.from.name },
to: { schema: schema4, table: tableName, column: it.to.name }
};
});
}).flat();
const _meta = prepareMigrationMeta(rSchemas, rTables, rColumns);
const bpatched = {
version: "5",
dialect: b.dialect,
id: b.id,
prevId: b.prevId,
tables: b.tables,
enums: {},
_meta
};
sqliteSchema.parse(bpatched);
return {
version: "5",
dialect: b.dialect,
id: b.id,
prevId: b.prevId,
tables: b.tables,
enums: {},
_meta
};
};
upgradeFolders = (dialect6, out) => {
const oldMigrationFolders = (0, import_fs7.readdirSync)(out).filter(
(it) => it.length === 14 && /^\d+$/.test(it)
);
oldMigrationFolders.sort();
const metaFolder = (0, import_path4.join)(`${out}`, "meta");
if ((0, import_fs7.existsSync)((0, import_path4.join)(metaFolder, "_journal.json"))) {
return;
}
const res = oldMigrationFolders.reduce(
(res2, it) => {
const date = /* @__PURE__ */ new Date();
date.setUTCFullYear(Number(it.substring(0, 4)));
date.setUTCMonth(Number(it.substring(4, 6)) - 1);
date.setUTCDate(Number(it.substring(6, 8)));
date.setUTCHours(Number(it.substring(8, 10)));
date.setUTCMinutes(Number(it.substring(10, 12)));
date.setUTCSeconds(Number(it.substring(12, 14)));
date.setUTCMilliseconds(0);
const path3 = (0, import_path4.join)(out, it);
const pathJson = (0, import_path4.join)(out, it, "snapshot.json");
const pathSQL = (0, import_path4.join)(out, it, "migration.sql");
const snapshot = JSON.parse((0, import_fs7.readFileSync)(pathJson).toString());
const sql = (0, import_fs7.readFileSync)(pathSQL).toString();
res2.entries.push({
idx: res2.idx,
version: snapshot["version"],
json: snapshot,
date,
sql,
path: path3
});
res2.idx += 1;
return res2;
},
{
entries: [],
idx: 0
}
);
if (!(0, import_fs7.existsSync)(metaFolder)) {
(0, import_fs7.mkdirSync)(metaFolder, { recursive: true });
}
const journal = dryJournal(dialect6);
let prev = void 0;
res.entries.forEach((it) => {
const { prefix, suffix, tag } = prepareMigrationMetadata(it.idx);
journal.entries.push({
idx: it.idx,
version: it.version,
when: +it.date,
tag,
breakpoints: false
});
const patchedJSON = fullfill(prev, it.json, it.sql, dialect6);
(0, import_fs7.writeFileSync)(
(0, import_path4.join)(`${out}`, "meta", `${prefix}_snapshot.json`),
JSON.stringify(patchedJSON)
);
(0, import_fs7.writeFileSync)((0, import_path4.join)(`${out}`, `${tag}.sql`), it.sql);
(0, import_fs7.rmSync)(it.path, { recursive: true });
prev = it.json;
});
(0, import_fs7.writeFileSync)((0, import_path4.join)(metaFolder, "_journal.json"), JSON.stringify(journal));
};
}
});
// src/utils.ts
var import_fs8, import_path5, assertV1OutFolder, dryJournal, snapshotsPriorV4, prepareOutFolder2, mapValues, validatorForDialect, validateWithReport, prepareMigrationFolder, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey;
var init_utils2 = __esm({
"src/utils.ts"() {
import_fs8 = require("fs");
init_views();
init_mysqlSchema();
init_pgSchema();
init_sqliteSchema();
init_source();
import_path5 = require("path");
init_global();
init_upFolders();
init_snapshotsDiffer();
assertV1OutFolder = (out, dialect6) => {
if (!(0, import_fs8.existsSync)(out))
return;
const oldMigrationFolders = (0, import_fs8.readdirSync)(out).filter(
(it) => it.length === 14 && /^\d+$/.test(it)
);
if (oldMigrationFolders.length > 0) {
console.log(
`Your migrations folder format is outdated, please run ${source_default.green.bold(
`drizzle-kit up:${dialect6}`
)}`
);
process.exit(1);
}
};
dryJournal = (dialect6) => {
return {
version: snapshotVersion,
dialect: dialect6,
entries: []
};
};
snapshotsPriorV4 = (out) => {
const oldMigrationFolders = (0, import_fs8.readdirSync)(out).filter(
(it) => it.length === 14 && /^\d+$/.test(it)
);
oldMigrationFolders.sort();
return oldMigrationFolders.map((it) => {
const pathJson = (0, import_path5.join)(out, it, "snapshot.json");
console.log(pathJson);
return pathJson;
});
};
prepareOutFolder2 = (out, dialect6) => {
const meta = (0, import_path5.join)(out, "meta");
const journalPath = (0, import_path5.join)(meta, "_journal.json");
if (!(0, import_fs8.existsSync)((0, import_path5.join)(out, "meta"))) {
(0, import_fs8.mkdirSync)(meta, { recursive: true });
(0, import_fs8.writeFileSync)(journalPath, JSON.stringify(dryJournal(dialect6)));
}
const journal = JSON.parse((0, import_fs8.readFileSync)(journalPath).toString());
const snapshots = (0, import_fs8.readdirSync)(meta).filter((it) => !it.startsWith("_")).map((it) => (0, import_path5.join)(meta, it));
snapshots.sort();
return { meta, snapshots, journal };
};
mapValues = (obj, map) => {
const result = Object.keys(obj).reduce(function(result2, key) {
result2[key] = map(obj[key]);
return result2;
}, {});
return result;
};
validatorForDialect = (dialect6) => {
switch (dialect6) {
case "pg":
return { validator: backwardCompatiblePgSchema, version: 5 };
case "sqlite":
return { validator: backwardCompatibleSqliteSchema, version: 5 };
case "mysql":
return { validator: backwardCompatibleMysqlSchema, version: 5 };
}
};
validateWithReport = (snapshots, dialect6) => {
const { validator, version: version2 } = validatorForDialect(dialect6);
const result = snapshots.reduce(
(accum, it) => {
const raw = JSON.parse((0, import_fs8.readFileSync)(`./${it}`).toString());
accum.rawMap[it] = raw;
if (raw["version"] && Number(raw["version"]) > version2) {
console.log(
info(
`${it} snapshot is of unsupported version, please update drizzle-kit`
)
);
process.exit(0);
}
const result2 = validator.safeParse(raw);
if (!result2.success) {
accum.malformed.push(it);
return accum;
}
const snapshot = result2.data;
if (snapshot.version !== String(version2)) {
accum.nonLatest.push(it);
return accum;
}
const idEntry = accum.idsMap[snapshot["prevId"]] ?? {
parent: it,
snapshots: []
};
idEntry.snapshots.push(it);
accum.idsMap[snapshot["prevId"]] = idEntry;
return accum;
},
{
malformed: [],
nonLatest: [],
idToNameMap: {},
idsMap: {},
rawMap: {}
}
);
return result;
};
prepareMigrationFolder = (outFolder = "drizzle", dialect6) => {
const { snapshots, journal } = prepareOutFolder2(outFolder, dialect6);
const report = validateWithReport(snapshots, dialect6);
if (report.nonLatest.length > 0) {
console.log(
report.nonLatest.map((it) => {
return `${it}/snapshot.json is not of the latest version`;
}).concat(`Run ${source_default.green.bold(`drizzle-kit up:${dialect6}`)}`).join("\n")
);
process.exit(0);
}
if (report.malformed.length) {
const message2 = report.malformed.map((it) => {
return `${it} data is malformed`;
}).join("\n");
console.log(message2);
}
const collisionEntries = Object.entries(report.idsMap).filter(
(it) => it[1].snapshots.length > 1
);
const message = collisionEntries.map((it) => {
const data = it[1];
return `[${data.snapshots.join(
", "
)}] are pointing to a parent snapshot: ${data.parent}/snapshot.json which is a collision.`;
}).join("\n").trim();
if (message) {
console.log(source_default.red.bold("Error:"), message);
}
const abort = report.malformed.length || collisionEntries.length > 0;
if (abort) {
process.exit(0);
}
return { snapshots, journal };
};
prepareMigrationMeta = (schemas, tables, columns) => {
const _meta = {
schemas: {},
tables: {},
columns: {}
};
schemas.forEach((it) => {
const from = schemaRenameKey(it.from);
const to = schemaRenameKey(it.to);
_meta.schemas[from] = to;
});
tables.forEach((it) => {
const from = tableRenameKey(it.from);
const to = tableRenameKey(it.to);
_meta.tables[from] = to;
});
columns.forEach((it) => {
const from = columnRenameKey(it.from.table, it.from.schema, it.from.column);
const to = columnRenameKey(it.to.table, it.to.schema, it.to.column);
_meta.columns[from] = to;
});
return _meta;
};
schemaRenameKey = (it) => {
return it;
};
tableRenameKey = (it) => {
const out = it.schema ? `"${it.schema}"."${it.name}"` : `"${it.name}"`;
return out;
};
columnRenameKey = (table4, schema4, column7) => {
const out = schema4 ? `"${schema4}"."${table4}"."${column7}"` : `"${table4}"."${column7}"`;
return out;
};
}
});
// node_modules/.pnpm/camelcase@7.0.1/node_modules/camelcase/index.js
function camelCase(input, options) {
if (!(typeof input === "string" || Array.isArray(input))) {
throw new TypeError("Expected the input to be `string | string[]`");
}
options = {
pascalCase: false,
preserveConsecutiveUppercase: false,
...options
};
if (Array.isArray(input)) {
input = input.map((x) => x.trim()).filter((x) => x.length).join("-");
} else {
input = input.trim();
}
if (input.length === 0) {
return "";
}
const toLowerCase = options.locale === false ? (string) => string.toLowerCase() : (string) => string.toLocaleLowerCase(options.locale);
const toUpperCase = options.locale === false ? (string) => string.toUpperCase() : (string) => string.toLocaleUpperCase(options.locale);
if (input.length === 1) {
if (SEPARATORS.test(input)) {
return "";
}
return options.pascalCase ? toUpperCase(input) : toLowerCase(input);
}
const hasUpperCase = input !== toLowerCase(input);
if (hasUpperCase) {
input = preserveCamelCase(input, toLowerCase, toUpperCase, options.preserveConsecutiveUppercase);
}
input = input.replace(LEADING_SEPARATORS, "");
input = options.preserveConsecutiveUppercase ? preserveConsecutiveUppercase(input, toLowerCase) : toLowerCase(input);
if (options.pascalCase) {
input = toUpperCase(input.charAt(0)) + input.slice(1);
}
return postProcess(input, toUpperCase);
}
var UPPERCASE, LOWERCASE, LEADING_CAPITAL, IDENTIFIER, SEPARATORS, LEADING_SEPARATORS, SEPARATORS_AND_IDENTIFIER, NUMBERS_AND_IDENTIFIER, preserveCamelCase, preserveConsecutiveUppercase, postProcess;
var init_camelcase = __esm({
"node_modules/.pnpm/camelcase@7.0.1/node_modules/camelcase/index.js"() {
UPPERCASE = /[\p{Lu}]/u;
LOWERCASE = /[\p{Ll}]/u;
LEADING_CAPITAL = /^[\p{Lu}](?![\p{Lu}])/gu;
IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u;
SEPARATORS = /[_.\- ]+/;
LEADING_SEPARATORS = new RegExp("^" + SEPARATORS.source);
SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, "gu");
NUMBERS_AND_IDENTIFIER = new RegExp("\\d+" + IDENTIFIER.source, "gu");
preserveCamelCase = (string, toLowerCase, toUpperCase, preserveConsecutiveUppercase2) => {
let isLastCharLower = false;
let isLastCharUpper = false;
let isLastLastCharUpper = false;
let isLastLastCharPreserved = false;
for (let index4 = 0; index4 < string.length; index4++) {
const character = string[index4];
isLastLastCharPreserved = index4 > 2 ? string[index4 - 3] === "-" : true;
if (isLastCharLower && UPPERCASE.test(character)) {
string = string.slice(0, index4) + "-" + string.slice(index4);
isLastCharLower = false;
isLastLastCharUpper = isLastCharUpper;
isLastCharUpper = true;
index4++;
} else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character) && (!isLastLastCharPreserved || preserveConsecutiveUppercase2)) {
string = string.slice(0, index4 - 1) + "-" + string.slice(index4 - 1);
isLastLastCharUpper = isLastCharUpper;
isLastCharUpper = false;
isLastCharLower = true;
} else {
isLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character;
isLastLastCharUpper = isLastCharUpper;
isLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character;
}
}
return string;
};
preserveConsecutiveUppercase = (input, toLowerCase) => {
LEADING_CAPITAL.lastIndex = 0;
return input.replace(LEADING_CAPITAL, (m1) => toLowerCase(m1));
};
postProcess = (input, toUpperCase) => {
SEPARATORS_AND_IDENTIFIER.lastIndex = 0;
NUMBERS_AND_IDENTIFIER.lastIndex = 0;
return input.replace(SEPARATORS_AND_IDENTIFIER, (_, identifier) => toUpperCase(identifier)).replace(NUMBERS_AND_IDENTIFIER, (m) => toUpperCase(m));
};
}
});
// src/@types/utils.ts
var init_utils3 = __esm({
"src/@types/utils.ts"() {
init_camelcase();
String.prototype.trimChar = function(char) {
let start = 0;
let end = this.length;
while (start < end && this[start] === char)
++start;
while (end > start && this[end - 1] === char)
--end;
return start > 0 || end < this.length ? this.substring(start, end) : this.toString();
};
String.prototype.squashSpaces = function() {
return this.replace(/ +/g, " ").trim();
};
String.prototype.camelCase = function() {
return camelCase(String(this));
};
String.prototype.concatIf = function(it, condition) {
return condition ? `${this}${it}` : this;
};
Array.prototype.random = function() {
return this[~~(Math.random() * this.length)];
};
}
});
// src/cli/commands/sqliteUtils.ts
var sqliteConnectionSchema, sqliteCliConfigSchema;
var init_sqliteUtils = __esm({
"src/cli/commands/sqliteUtils.ts"() {
init_lib();
init_utils();
sqliteConnectionSchema = unionType([
objectType({
driver: literalType("turso"),
dbCredentials: objectType({
url: stringType(),
authToken: stringType().optional()
})
}),
objectType({
driver: literalType("libsql"),
dbCredentials: objectType({
url: stringType()
})
}),
objectType({
driver: literalType("better-sqlite"),
dbCredentials: objectType({
url: stringType()
})
})
]);
sqliteCliConfigSchema = intersectionType(
configIntrospectSchema,
sqliteConnectionSchema
);
}
});
// src/cli/validations/outputs.ts
var withStyle, outputs;
var init_outputs = __esm({
"src/cli/validations/outputs.ts"() {
init_source();
withStyle = {
error: (str) => `${source_default.red(`${source_default.white.bgRed(" Invalid input ")} ${str}`)}`,
warning: (str) => `${source_default.white.bgGray(" Warning ")} ${str}`,
fullWarning: (str) => `${source_default.black.bgYellow("[Warning]")} ${source_default.bold(str)}`
};
outputs = {
studio: {
drivers: (param) => withStyle.error(
`"${param}" is not a valid driver. Available drivers: "pg", "mysql2", "better-sqlite", "libsql", "turso". You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference`
),
noCredentials: () => withStyle.error(
`You need to specify a "dbCredentials" param in you config. It will help drizzle to know how to query you database. You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference`
),
noDriver: () => withStyle.error(
`You need to specify a "driver" param in you config. It will help drizzle to know how to query you database. You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference`
)
},
common: {
ambiguousParams: (command) => withStyle.error(
`You can't use both --config and other cli options for ${command} command`
),
schema: (command) => withStyle.error(`"--schema" is a required field for ${command} command`),
schemaConfig: (command) => withStyle.error(
`"schema" is a required field in drizzle.config for ${command} command`
)
},
postgres: {
connection: {
driver: () => withStyle.error(`Only "pg" is available options for "--driver"`),
required: () => withStyle.error(
`Either "connectionString" or "host", "database" are required for database connection`
)
}
},
mysql: {
connection: {
driver: () => withStyle.error(`Only "mysql2" is available options for "--driver"`),
required: () => withStyle.error(
`Either "connectionString" or "host", "database" are required for database connection`
)
}
},
sqlite: {
connection: {
driver: () => withStyle.error(
`Either "turso", "libsql", "better-sqlite" are available options for "--driver"`
),
url: (driver) => withStyle.error(`"url" is a required option for driver "${driver}". You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference`),
authToken: (driver) => withStyle.error(
`"authToken" is a required option for driver "${driver}". You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference`
)
},
introspect: {},
push: {}
}
};
}
});
// src/cli/validations/common.ts
var checkCollisions;
var init_common = __esm({
"src/cli/validations/common.ts"() {
init_outputs();
checkCollisions = (options, command, inputWhitelist = []) => {
const { config, ...rest } = options;
let atLeastOneParam = false;
for (const key of Object.keys(rest)) {
if (inputWhitelist.includes(key))
continue;
atLeastOneParam = true;
}
if (!atLeastOneParam && typeof config !== "undefined") {
return {
success: true,
action: "config"
};
}
if (typeof config === "undefined" && atLeastOneParam) {
return {
success: true,
action: "cli"
};
}
if (typeof config === "undefined" && !atLeastOneParam) {
return {
success: true,
action: "config"
};
}
return {
success: false,
message: outputs.common.ambiguousParams(command),
action: "error"
};
};
}
});
// src/cli/validations/sqlite.ts
var sqliteConnectionCli, sqliteCliIntrospectParams, sqliteCliPushParams, sqliteConfigPushParams, printCliConnectionIssues, printConfigConnectionIssues, validateIntrospect, validatePush;
var init_sqlite = __esm({
"src/cli/validations/sqlite.ts"() {
init_lib();
init_sqliteUtils();
init_utils();
init_common();
init_outputs();
sqliteConnectionCli = unionType([
objectType({
driver: literalType("turso"),
url: stringType(),
authToken: stringType()
}),
objectType({
driver: literalType("better-sqlite"),
url: stringType()
}),
objectType({
driver: literalType("libsql"),
url: stringType()
})
]);
sqliteCliIntrospectParams = intersectionType(
configIntrospectCliSchema,
sqliteConnectionCli
);
sqliteCliPushParams = intersectionType(
configPushSchema,
sqliteConnectionCli
);
sqliteConfigPushParams = intersectionType(
configPushSchema,
sqliteConnectionSchema
);
printCliConnectionIssues = (options) => {
if (options.driver === "turso") {
if (typeof options.url === "undefined") {
console.log(outputs.sqlite.connection.url("turso"));
}
if (typeof options.authToken === "undefined") {
console.log(outputs.sqlite.connection.authToken("turso"));
}
} else if (options.driver === "libsql") {
if (typeof options.url === "undefined") {
console.log(outputs.sqlite.connection.url("libsql"));
}
} else if (options.driver === "better-sqlite") {
if (typeof options.url === "undefined") {
console.log(outputs.sqlite.connection.url("better-sqlite"));
}
} else {
console.log(outputs.sqlite.connection.driver());
}
};
printConfigConnectionIssues = (options) => {
var _a, _b, _c;
if (options.driver === "turso") {
if (typeof options.url === "undefined") {
console.log(outputs.sqlite.connection.url("turso"));
}
if (typeof ((_a = options.dbCredentials) == null ? void 0 : _a.authToken) === "undefined") {
console.log(outputs.sqlite.connection.authToken("turso"));
}
} else if (options.driver === "libsql") {
if (typeof ((_b = options.dbCredentials) == null ? void 0 : _b.url) === "undefined") {
console.log(outputs.sqlite.connection.url("libsql"));
}
} else if (options.driver === "better-sqlite") {
if (typeof ((_c = options.dbCredentials) == null ? void 0 : _c.url) === "undefined") {
console.log(outputs.sqlite.connection.url("better-sqlite"));
}
} else {
console.log(outputs.sqlite.connection.driver());
}
};
validateIntrospect = async (options) => {
const collisionRes = checkCollisions(options, "introspect:sqlite");
if (!collisionRes.success) {
console.log(collisionRes.message);
process.exit(1);
}
if (collisionRes.action === "config") {
const drizzleConfig = await readDrizzleConfig(options.config);
const configRes = sqliteCliConfigSchema.safeParse(drizzleConfig);
if (!configRes.success) {
printConfigConnectionIssues(drizzleConfig);
process.exit(1);
}
return configRes.data;
}
const cliRes = sqliteCliIntrospectParams.safeParse(options);
if (!cliRes.success) {
printCliConnectionIssues(options);
process.exit(1);
}
if (cliRes.data.driver === "turso") {
const { authToken, url: url2, introspectCasing: introspectCasing3, ...rest2 } = cliRes.data;
return {
...rest2,
dbCredentials: { url: url2, authToken },
introspect: { casing: introspectCasing3 }
};
}
if (cliRes.data.driver === "libsql") {
const { url: url2, introspectCasing: introspectCasing3, ...rest2 } = cliRes.data;
return {
...rest2,
dbCredentials: { url: url2 },
introspect: { casing: introspectCasing3 }
};
}
const { url, introspectCasing: introspectCasing2, ...rest } = cliRes.data;
return {
...rest,
dbCredentials: { url },
introspect: { casing: introspectCasing2 }
};
};
validatePush = async (options) => {
const collisionRes = checkCollisions(options, "push:sqlite");
if (!collisionRes.success) {
console.log(collisionRes.message);
console.log();
process.exit(1);
}
if (collisionRes.action === "config") {
const drizzleConfig = await readDrizzleConfig(options.config);
const configRes = sqliteConfigPushParams.safeParse(drizzleConfig);
if (!configRes.success) {
printConfigConnectionIssues(drizzleConfig);
process.exit(1);
}
return configRes.data;
}
const cliRes = sqliteCliPushParams.safeParse(options);
if (!cliRes.success) {
if (typeof options.schema === "undefined") {
console.log(outputs.common.schema("push:sqlite"));
}
printCliConnectionIssues(options);
process.exit(1);
}
if (cliRes.data.driver === "turso") {
const { authToken, url: url2, ...rest2 } = cliRes.data;
return { ...rest2, dbCredentials: { url: url2, authToken } };
}
const { url, ...rest } = cliRes.data;
return { ...rest, dbCredentials: { url } };
};
}
});
// src/cli/validations/pg.ts
var pgConnectionCli, pgConnectionConfig, pgConfigIntrospectSchema, pgCliIntrospectParams, printCliConnectionIssues2, printConfigConnectionIssues2, validatePgIntrospect;
var init_pg = __esm({
"src/cli/validations/pg.ts"() {
init_lib();
init_utils();
init_common();
init_outputs();
pgConnectionCli = unionType([
objectType({
driver: literalType("pg"),
host: stringType(),
port: coerce.number().optional(),
user: stringType().default("postgres"),
password: stringType().optional(),
database: stringType(),
ssl: coerce.boolean().optional(),
type: literalType("params").default("params")
}),
objectType({
driver: literalType("pg"),
connectionString: stringType(),
type: literalType("url").default("url")
})
]);
pgConnectionConfig = unionType([
objectType({
driver: literalType("pg"),
dbCredentials: objectType({
host: stringType(),
port: coerce.number().optional(),
user: stringType().default("postgres"),
password: stringType().optional(),
database: stringType(),
ssl: coerce.boolean().optional()
})
}),
objectType({
driver: literalType("pg"),
dbCredentials: objectType({
connectionString: stringType()
})
})
]);
pgConfigIntrospectSchema = intersectionType(
configIntrospectSchema,
pgConnectionConfig
);
pgCliIntrospectParams = intersectionType(
configIntrospectCliSchema,
pgConnectionCli
);
printCliConnectionIssues2 = (options) => {
if (options.driver === "pg") {
if (typeof options.connectionString === "undefined" && (typeof options.host === "undefined" || typeof options.database === "undefined")) {
console.log(outputs.postgres.connection.required());
}
} else {
console.log(outputs.postgres.connection.driver());
}
};
printConfigConnectionIssues2 = (options) => {
if (options.driver === "pg") {
if (typeof options.dbCredentials.connectionString === "undefined" && (typeof options.dbCredentials.host === "undefined" || typeof options.dbCredentials.database === "undefined")) {
console.log(outputs.postgres.connection.required());
}
} else {
console.log(outputs.postgres.connection.driver());
}
};
validatePgIntrospect = async (options) => {
const collisionRes = checkCollisions(options, "introspect:pg");
if (!collisionRes.success) {
console.log(collisionRes.message);
process.exit(1);
}
if (collisionRes.action === "config") {
const drizzleConfig = await readDrizzleConfig(options.config);
const configRes = pgConfigIntrospectSchema.safeParse(drizzleConfig);
if (!configRes.success) {
printConfigConnectionIssues2(drizzleConfig);
process.exit(1);
}
return configRes.data;
}
const cliRes = pgCliIntrospectParams.safeParse(options);
if (!cliRes.success) {
printCliConnectionIssues2(options);
process.exit(1);
}
if (cliRes.data.type === "url") {
const { connectionString, introspectCasing: introspectCasing3, ...rest2 } = cliRes.data;
return {
...rest2,
dbCredentials: { connectionString },
introspect: { casing: introspectCasing3 }
};
}
const {
host,
password,
port,
database,
ssl,
user,
introspectCasing: introspectCasing2,
...rest
} = cliRes.data;
return {
...rest,
dbCredentials: { host, password, port, database, ssl, user },
introspect: { casing: introspectCasing2 }
};
};
}
});
// src/cli/validations/mysql.ts
var mysqlConnectionCli, mysqlConnectionConfig, mysqlConfigIntrospectSchema, mysqlCliIntrospectParams, mysqlCliPushParams, mysqlConfigPushParams, printCliConnectionIssues3, printConfigConnectionIssues3, validateMySqlIntrospect, validateMySqlPush;
var init_mysql = __esm({
"src/cli/validations/mysql.ts"() {
init_lib();
init_utils();
init_common();
init_outputs();
mysqlConnectionCli = unionType([
objectType({
driver: literalType("mysql2"),
host: stringType(),
port: coerce.number().optional(),
user: stringType().default("mysql"),
password: stringType().optional(),
database: stringType(),
type: literalType("params").default("params")
}),
objectType({
driver: literalType("mysql2"),
connectionString: stringType(),
type: literalType("url").default("url")
})
]);
mysqlConnectionConfig = unionType([
objectType({
driver: literalType("mysql2"),
dbCredentials: objectType({
host: stringType(),
port: coerce.number().optional(),
user: stringType().default("mysql"),
password: stringType().optional(),
database: stringType(),
type: literalType("params").default("params")
})
}),
objectType({
driver: literalType("mysql2"),
dbCredentials: objectType({
connectionString: stringType(),
type: literalType("url").default("url")
})
})
]);
mysqlConfigIntrospectSchema = intersectionType(
configIntrospectSchema,
mysqlConnectionConfig
);
mysqlCliIntrospectParams = intersectionType(
configIntrospectCliSchema,
mysqlConnectionCli
);
mysqlCliPushParams = intersectionType(
configPushSchema,
mysqlConnectionCli
);
mysqlConfigPushParams = intersectionType(
configPushSchema,
mysqlConnectionConfig
);
printCliConnectionIssues3 = (options) => {
if (options.driver === "mysql2") {
if (typeof options.connectionString === "undefined" && (typeof options.host === "undefined" || typeof options.database === "undefined")) {
console.log(outputs.mysql.connection.required());
}
} else {
console.log(outputs.mysql.connection.driver());
}
};
printConfigConnectionIssues3 = (options) => {
if (options.driver === "mysql2") {
if (typeof options.dbCredentials.connectionString === "undefined" && (typeof options.dbCredentials.host === "undefined" || typeof options.dbCredentials.database === "undefined")) {
console.log(outputs.mysql.connection.required());
}
} else {
console.log(outputs.mysql.connection.driver());
}
};
validateMySqlIntrospect = async (options) => {
const collisionRes = checkCollisions(options, "introspect:mysql");
if (!collisionRes.success) {
console.log(collisionRes.message);
process.exit(1);
}
if (collisionRes.action === "config") {
const drizzleConfig = await readDrizzleConfig(options.config);
const configRes = mysqlConfigIntrospectSchema.safeParse(drizzleConfig);
if (!configRes.success) {
printConfigConnectionIssues3(drizzleConfig);
process.exit(1);
}
return configRes.data;
}
const cliRes = mysqlCliIntrospectParams.safeParse(options);
if (!cliRes.success) {
printCliConnectionIssues3(options);
process.exit(1);
}
if (cliRes.data.type === "url") {
const { connectionString, introspectCasing: introspectCasing3, type: type2, ...rest2 } = cliRes.data;
return {
...rest2,
dbCredentials: { connectionString, type: type2 },
introspect: { casing: introspectCasing3 }
};
}
const {
host,
password,
port,
database,
user,
type,
introspectCasing: introspectCasing2,
...rest
} = cliRes.data;
return {
...rest,
dbCredentials: { host, password, port, database, user, type },
introspect: { casing: introspectCasing2 }
};
};
validateMySqlPush = async (options) => {
const collisionRes = checkCollisions(options, "push:mysql");
if (!collisionRes.success) {
console.log(collisionRes.message);
console.log();
process.exit(1);
}
if (collisionRes.action === "config") {
const drizzleConfig = await readDrizzleConfig(options.config);
const configRes = mysqlConfigPushParams.safeParse(drizzleConfig);
if (!configRes.success) {
printConfigConnectionIssues3(drizzleConfig);
process.exit(1);
}
return configRes.data;
}
const cliRes = mysqlCliPushParams.safeParse(options);
if (!cliRes.success) {
if (typeof options.schema === "undefined") {
console.log(outputs.common.schema("push:mysql"));
}
printCliConnectionIssues3(options);
process.exit(1);
}
if (cliRes.data.type === "url") {
const { connectionString, type: type2, ...rest2 } = cliRes.data;
return {
...rest2,
dbCredentials: { connectionString, type: type2 }
};
}
const { host, password, port, database, user, type, ...rest } = cliRes.data;
return {
...rest,
dbCredentials: { host, password, port, database, user, type }
};
};
}
});
// node_modules/.pnpm/sqlstring@2.3.3/node_modules/sqlstring/lib/SqlString.js
var require_SqlString = __commonJS({
"node_modules/.pnpm/sqlstring@2.3.3/node_modules/sqlstring/lib/SqlString.js"(exports) {
var SqlString = exports;
var ID_GLOBAL_REGEXP = /`/g;
var QUAL_GLOBAL_REGEXP = /\./g;
var CHARS_GLOBAL_REGEXP = /[\0\b\t\n\r\x1a\"\'\\]/g;
var CHARS_ESCAPE_MAP = {
"\0": "\\0",
"\b": "\\b",
" ": "\\t",
"\n": "\\n",
"\r": "\\r",
"": "\\Z",
'"': '\\"',
"'": "\\'",
"\\": "\\\\"
};
SqlString.escapeId = function escapeId(val, forbidQualified) {
if (Array.isArray(val)) {
var sql = "";
for (var i = 0; i < val.length; i++) {
sql += (i === 0 ? "" : ", ") + SqlString.escapeId(val[i], forbidQualified);
}
return sql;
} else if (forbidQualified) {
return "`" + String(val).replace(ID_GLOBAL_REGEXP, "``") + "`";
} else {
return "`" + String(val).replace(ID_GLOBAL_REGEXP, "``").replace(QUAL_GLOBAL_REGEXP, "`.`") + "`";
}
};
SqlString.escape = function escape2(val, stringifyObjects, timeZone) {
if (val === void 0 || val === null) {
return "NULL";
}
switch (typeof val) {
case "boolean":
return val ? "true" : "false";
case "number":
return val + "";
case "object":
if (Object.prototype.toString.call(val) === "[object Date]") {
return SqlString.dateToString(val, timeZone || "local");
} else if (Array.isArray(val)) {
return SqlString.arrayToList(val, timeZone);
} else if (Buffer.isBuffer(val)) {
return SqlString.bufferToString(val);
} else if (typeof val.toSqlString === "function") {
return String(val.toSqlString());
} else if (stringifyObjects) {
return escapeString(val.toString());
} else {
return SqlString.objectToValues(val, timeZone);
}
default:
return escapeString(val);
}
};
SqlString.arrayToList = function arrayToList(array, timeZone) {
var sql = "";
for (var i = 0; i < array.length; i++) {
var val = array[i];
if (Array.isArray(val)) {
sql += (i === 0 ? "" : ", ") + "(" + SqlString.arrayToList(val, timeZone) + ")";
} else {
sql += (i === 0 ? "" : ", ") + SqlString.escape(val, true, timeZone);
}
}
return sql;
};
SqlString.format = function format(sql, values, stringifyObjects, timeZone) {
if (values == null) {
return sql;
}
if (!Array.isArray(values)) {
values = [values];
}
var chunkIndex = 0;
var placeholdersRegex = /\?+/g;
var result = "";
var valuesIndex = 0;
var match2;
while (valuesIndex < values.length && (match2 = placeholdersRegex.exec(sql))) {
var len = match2[0].length;
if (len > 2) {
continue;
}
var value = len === 2 ? SqlString.escapeId(values[valuesIndex]) : SqlString.escape(values[valuesIndex], stringifyObjects, timeZone);
result += sql.slice(chunkIndex, match2.index) + value;
chunkIndex = placeholdersRegex.lastIndex;
valuesIndex++;
}
if (chunkIndex === 0) {
return sql;
}
if (chunkIndex < sql.length) {
return result + sql.slice(chunkIndex);
}
return result;
};
SqlString.dateToString = function dateToString(date, timeZone) {
var dt = new Date(date);
if (isNaN(dt.getTime())) {
return "NULL";
}
var year;
var month;
var day;
var hour;
var minute;
var second;
var millisecond;
if (timeZone === "local") {
year = dt.getFullYear();
month = dt.getMonth() + 1;
day = dt.getDate();
hour = dt.getHours();
minute = dt.getMinutes();
second = dt.getSeconds();
millisecond = dt.getMilliseconds();
} else {
var tz = convertTimezone(timeZone);
if (tz !== false && tz !== 0) {
dt.setTime(dt.getTime() + tz * 6e4);
}
year = dt.getUTCFullYear();
month = dt.getUTCMonth() + 1;
day = dt.getUTCDate();
hour = dt.getUTCHours();
minute = dt.getUTCMinutes();
second = dt.getUTCSeconds();
millisecond = dt.getUTCMilliseconds();
}
var str = zeroPad(year, 4) + "-" + zeroPad(month, 2) + "-" + zeroPad(day, 2) + " " + zeroPad(hour, 2) + ":" + zeroPad(minute, 2) + ":" + zeroPad(second, 2) + "." + zeroPad(millisecond, 3);
return escapeString(str);
};
SqlString.bufferToString = function bufferToString(buffer) {
return "X" + escapeString(buffer.toString("hex"));
};
SqlString.objectToValues = function objectToValues(object, timeZone) {
var sql = "";
for (var key in object) {
var val = object[key];
if (typeof val === "function") {
continue;
}
sql += (sql.length === 0 ? "" : ", ") + SqlString.escapeId(key) + " = " + SqlString.escape(val, true, timeZone);
}
return sql;
};
SqlString.raw = function raw(sql) {
if (typeof sql !== "string") {
throw new TypeError("argument sql must be a string");
}
return {
toSqlString: function toSqlString() {
return sql;
}
};
};
function escapeString(val) {
var chunkIndex = CHARS_GLOBAL_REGEXP.lastIndex = 0;
var escapedVal = "";
var match2;
while (match2 = CHARS_GLOBAL_REGEXP.exec(val)) {
escapedVal += val.slice(chunkIndex, match2.index) + CHARS_ESCAPE_MAP[match2[0]];
chunkIndex = CHARS_GLOBAL_REGEXP.lastIndex;
}
if (chunkIndex === 0) {
return "'" + val + "'";
}
if (chunkIndex < val.length) {
return "'" + escapedVal + val.slice(chunkIndex) + "'";
}
return "'" + escapedVal + "'";
}
function zeroPad(number, length) {
number = number.toString();
while (number.length < length) {
number = "0" + number;
}
return number;
}
function convertTimezone(tz) {
if (tz === "Z") {
return 0;
}
var m = tz.match(/([\+\-\s])(\d\d):?(\d\d)?/);
if (m) {
return (m[1] === "-" ? -1 : 1) * (parseInt(m[2], 10) + (m[3] ? parseInt(m[3], 10) : 0) / 60) * 60;
}
return false;
}
}
});
// node_modules/.pnpm/sqlstring@2.3.3/node_modules/sqlstring/index.js
var require_sqlstring = __commonJS({
"node_modules/.pnpm/sqlstring@2.3.3/node_modules/sqlstring/index.js"(exports, module2) {
module2.exports = require_SqlString();
}
});
// node_modules/.pnpm/denque@2.1.0/node_modules/denque/index.js
var require_denque = __commonJS({
"node_modules/.pnpm/denque@2.1.0/node_modules/denque/index.js"(exports, module2) {
"use strict";
function Denque(array, options) {
var options = options || {};
this._capacity = options.capacity;
this._head = 0;
this._tail = 0;
if (Array.isArray(array)) {
this._fromArray(array);
} else {
this._capacityMask = 3;
this._list = new Array(4);
}
}
Denque.prototype.peekAt = function peekAt(index4) {
var i = index4;
if (i !== (i | 0)) {
return void 0;
}
var len = this.size();
if (i >= len || i < -len)
return void 0;
if (i < 0)
i += len;
i = this._head + i & this._capacityMask;
return this._list[i];
};
Denque.prototype.get = function get(i) {
return this.peekAt(i);
};
Denque.prototype.peek = function peek() {
if (this._head === this._tail)
return void 0;
return this._list[this._head];
};
Denque.prototype.peekFront = function peekFront() {
return this.peek();
};
Denque.prototype.peekBack = function peekBack() {
return this.peekAt(-1);
};
Object.defineProperty(Denque.prototype, "length", {
get: function length() {
return this.size();
}
});
Denque.prototype.size = function size() {
if (this._head === this._tail)
return 0;
if (this._head < this._tail)
return this._tail - this._head;
else
return this._capacityMask + 1 - (this._head - this._tail);
};
Denque.prototype.unshift = function unshift(item) {
if (arguments.length === 0)
return this.size();
var len = this._list.length;
this._head = this._head - 1 + len & this._capacityMask;
this._list[this._head] = item;
if (this._tail === this._head)
this._growArray();
if (this._capacity && this.size() > this._capacity)
this.pop();
if (this._head < this._tail)
return this._tail - this._head;
else
return this._capacityMask + 1 - (this._head - this._tail);
};
Denque.prototype.shift = function shift() {
var head = this._head;
if (head === this._tail)
return void 0;
var item = this._list[head];
this._list[head] = void 0;
this._head = head + 1 & this._capacityMask;
if (head < 2 && this._tail > 1e4 && this._tail <= this._list.length >>> 2)
this._shrinkArray();
return item;
};
Denque.prototype.push = function push(item) {
if (arguments.length === 0)
return this.size();
var tail = this._tail;
this._list[tail] = item;
this._tail = tail + 1 & this._capacityMask;
if (this._tail === this._head) {
this._growArray();
}
if (this._capacity && this.size() > this._capacity) {
this.shift();
}
if (this._head < this._tail)
return this._tail - this._head;
else
return this._capacityMask + 1 - (this._head - this._tail);
};
Denque.prototype.pop = function pop() {
var tail = this._tail;
if (tail === this._head)
return void 0;
var len = this._list.length;
this._tail = tail - 1 + len & this._capacityMask;
var item = this._list[this._tail];
this._list[this._tail] = void 0;
if (this._head < 2 && tail > 1e4 && tail <= len >>> 2)
this._shrinkArray();
return item;
};
Denque.prototype.removeOne = function removeOne(index4) {
var i = index4;
if (i !== (i | 0)) {
return void 0;
}
if (this._head === this._tail)
return void 0;
var size = this.size();
var len = this._list.length;
if (i >= size || i < -size)
return void 0;
if (i < 0)
i += size;
i = this._head + i & this._capacityMask;
var item = this._list[i];
var k;
if (index4 < size / 2) {
for (k = index4; k > 0; k--) {
this._list[i] = this._list[i = i - 1 + len & this._capacityMask];
}
this._list[i] = void 0;
this._head = this._head + 1 + len & this._capacityMask;
} else {
for (k = size - 1 - index4; k > 0; k--) {
this._list[i] = this._list[i = i + 1 + len & this._capacityMask];
}
this._list[i] = void 0;
this._tail = this._tail - 1 + len & this._capacityMask;
}
return item;
};
Denque.prototype.remove = function remove(index4, count) {
var i = index4;
var removed;
var del_count = count;
if (i !== (i | 0)) {
return void 0;
}
if (this._head === this._tail)
return void 0;
var size = this.size();
var len = this._list.length;
if (i >= size || i < -size || count < 1)
return void 0;
if (i < 0)
i += size;
if (count === 1 || !count) {
removed = new Array(1);
removed[0] = this.removeOne(i);
return removed;
}
if (i === 0 && i + count >= size) {
removed = this.toArray();
this.clear();
return removed;
}
if (i + count > size)
count = size - i;
var k;
removed = new Array(count);
for (k = 0; k < count; k++) {
removed[k] = this._list[this._head + i + k & this._capacityMask];
}
i = this._head + i & this._capacityMask;
if (index4 + count === size) {
this._tail = this._tail - count + len & this._capacityMask;
for (k = count; k > 0; k--) {
this._list[i = i + 1 + len & this._capacityMask] = void 0;
}
return removed;
}
if (index4 === 0) {
this._head = this._head + count + len & this._capacityMask;
for (k = count - 1; k > 0; k--) {
this._list[i = i + 1 + len & this._capacityMask] = void 0;
}
return removed;
}
if (i < size / 2) {
this._head = this._head + index4 + count + len & this._capacityMask;
for (k = index4; k > 0; k--) {
this.unshift(this._list[i = i - 1 + len & this._capacityMask]);
}
i = this._head - 1 + len & this._capacityMask;
while (del_count > 0) {
this._list[i = i - 1 + len & this._capacityMask] = void 0;
del_count--;
}
if (index4 < 0)
this._tail = i;
} else {
this._tail = i;
i = i + count + len & this._capacityMask;
for (k = size - (count + index4); k > 0; k--) {
this.push(this._list[i++]);
}
i = this._tail;
while (del_count > 0) {
this._list[i = i + 1 + len & this._capacityMask] = void 0;
del_count--;
}
}
if (this._head < 2 && this._tail > 1e4 && this._tail <= len >>> 2)
this._shrinkArray();
return removed;
};
Denque.prototype.splice = function splice(index4, count) {
var i = index4;
if (i !== (i | 0)) {
return void 0;
}
var size = this.size();
if (i < 0)
i += size;
if (i > size)
return void 0;
if (arguments.length > 2) {
var k;
var temp;
var removed;
var arg_len = arguments.length;
var len = this._list.length;
var arguments_index = 2;
if (!size || i < size / 2) {
temp = new Array(i);
for (k = 0; k < i; k++) {
temp[k] = this._list[this._head + k & this._capacityMask];
}
if (count === 0) {
removed = [];
if (i > 0) {
this._head = this._head + i + len & this._capacityMask;
}
} else {
removed = this.remove(i, count);
this._head = this._head + i + len & this._capacityMask;
}
while (arg_len > arguments_index) {
this.unshift(arguments[--arg_len]);
}
for (k = i; k > 0; k--) {
this.unshift(temp[k - 1]);
}
} else {
temp = new Array(size - (i + count));
var leng = temp.length;
for (k = 0; k < leng; k++) {
temp[k] = this._list[this._head + i + count + k & this._capacityMask];
}
if (count === 0) {
removed = [];
if (i != size) {
this._tail = this._head + i + len & this._capacityMask;
}
} else {
removed = this.remove(i, count);
this._tail = this._tail - leng + len & this._capacityMask;
}
while (arguments_index < arg_len) {
this.push(arguments[arguments_index++]);
}
for (k = 0; k < leng; k++) {
this.push(temp[k]);
}
}
return removed;
} else {
return this.remove(i, count);
}
};
Denque.prototype.clear = function clear() {
this._list = new Array(this._list.length);
this._head = 0;
this._tail = 0;
};
Denque.prototype.isEmpty = function isEmpty() {
return this._head === this._tail;
};
Denque.prototype.toArray = function toArray() {
return this._copyArray(false);
};
Denque.prototype._fromArray = function _fromArray(array) {
var length = array.length;
var capacity = this._nextPowerOf2(length);
this._list = new Array(capacity);
this._capacityMask = capacity - 1;
this._tail = length;
for (var i = 0; i < length; i++)
this._list[i] = array[i];
};
Denque.prototype._copyArray = function _copyArray(fullCopy, size) {
var src = this._list;
var capacity = src.length;
var length = this.length;
size = size | length;
if (size == length && this._head < this._tail) {
return this._list.slice(this._head, this._tail);
}
var dest = new Array(size);
var k = 0;
var i;
if (fullCopy || this._head > this._tail) {
for (i = this._head; i < capacity; i++)
dest[k++] = src[i];
for (i = 0; i < this._tail; i++)
dest[k++] = src[i];
} else {
for (i = this._head; i < this._tail; i++)
dest[k++] = src[i];
}
return dest;
};
Denque.prototype._growArray = function _growArray() {
if (this._head != 0) {
var newList = this._copyArray(true, this._list.length << 1);
this._tail = this._list.length;
this._head = 0;
this._list = newList;
} else {
this._tail = this._list.length;
this._list.length <<= 1;
}
this._capacityMask = this._capacityMask << 1 | 1;
};
Denque.prototype._shrinkArray = function _shrinkArray() {
this._list.length >>>= 1;
this._capacityMask >>>= 1;
};
Denque.prototype._nextPowerOf2 = function _nextPowerOf2(num) {
var log2 = Math.log(num) / Math.log(2);
var nextPow2 = 1 << log2 + 1;
return Math.max(nextPow2, 4);
};
module2.exports = Denque;
}
});
// node_modules/.pnpm/yallist@4.0.0/node_modules/yallist/iterator.js
var require_iterator = __commonJS({
"node_modules/.pnpm/yallist@4.0.0/node_modules/yallist/iterator.js"(exports, module2) {
"use strict";
module2.exports = function(Yallist) {
Yallist.prototype[Symbol.iterator] = function* () {
for (let walker = this.head; walker; walker = walker.next) {
yield walker.value;
}
};
};
}
});
// node_modules/.pnpm/yallist@4.0.0/node_modules/yallist/yallist.js
var require_yallist = __commonJS({
"node_modules/.pnpm/yallist@4.0.0/node_modules/yallist/yallist.js"(exports, module2) {
"use strict";
module2.exports = Yallist;
Yallist.Node = Node;
Yallist.create = Yallist;
function Yallist(list) {
var self2 = this;
if (!(self2 instanceof Yallist)) {
self2 = new Yallist();
}
self2.tail = null;
self2.head = null;
self2.length = 0;
if (list && typeof list.forEach === "function") {
list.forEach(function(item) {
self2.push(item);
});
} else if (arguments.length > 0) {
for (var i = 0, l = arguments.length; i < l; i++) {
self2.push(arguments[i]);
}
}
return self2;
}
Yallist.prototype.removeNode = function(node) {
if (node.list !== this) {
throw new Error("removing node which does not belong to this list");
}
var next = node.next;
var prev = node.prev;
if (next) {
next.prev = prev;
}
if (prev) {
prev.next = next;
}
if (node === this.head) {
this.head = next;
}
if (node === this.tail) {
this.tail = prev;
}
node.list.length--;
node.next = null;
node.prev = null;
node.list = null;
return next;
};
Yallist.prototype.unshiftNode = function(node) {
if (node === this.head) {
return;
}
if (node.list) {
node.list.removeNode(node);
}
var head = this.head;
node.list = this;
node.next = head;
if (head) {
head.prev = node;
}
this.head = node;
if (!this.tail) {
this.tail = node;
}
this.length++;
};
Yallist.prototype.pushNode = function(node) {
if (node === this.tail) {
return;
}
if (node.list) {
node.list.removeNode(node);
}
var tail = this.tail;
node.list = this;
node.prev = tail;
if (tail) {
tail.next = node;
}
this.tail = node;
if (!this.head) {
this.head = node;
}
this.length++;
};
Yallist.prototype.push = function() {
for (var i = 0, l = arguments.length; i < l; i++) {
push(this, arguments[i]);
}
return this.length;
};
Yallist.prototype.unshift = function() {
for (var i = 0, l = arguments.length; i < l; i++) {
unshift(this, arguments[i]);
}
return this.length;
};
Yallist.prototype.pop = function() {
if (!this.tail) {
return void 0;
}
var res = this.tail.value;
this.tail = this.tail.prev;
if (this.tail) {
this.tail.next = null;
} else {
this.head = null;
}
this.length--;
return res;
};
Yallist.prototype.shift = function() {
if (!this.head) {
return void 0;
}
var res = this.head.value;
this.head = this.head.next;
if (this.head) {
this.head.prev = null;
} else {
this.tail = null;
}
this.length--;
return res;
};
Yallist.prototype.forEach = function(fn, thisp) {
thisp = thisp || this;
for (var walker = this.head, i = 0; walker !== null; i++) {
fn.call(thisp, walker.value, i, this);
walker = walker.next;
}
};
Yallist.prototype.forEachReverse = function(fn, thisp) {
thisp = thisp || this;
for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
fn.call(thisp, walker.value, i, this);
walker = walker.prev;
}
};
Yallist.prototype.get = function(n) {
for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
walker = walker.next;
}
if (i === n && walker !== null) {
return walker.value;
}
};
Yallist.prototype.getReverse = function(n) {
for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
walker = walker.prev;
}
if (i === n && walker !== null) {
return walker.value;
}
};
Yallist.prototype.map = function(fn, thisp) {
thisp = thisp || this;
var res = new Yallist();
for (var walker = this.head; walker !== null; ) {
res.push(fn.call(thisp, walker.value, this));
walker = walker.next;
}
return res;
};
Yallist.prototype.mapReverse = function(fn, thisp) {
thisp = thisp || this;
var res = new Yallist();
for (var walker = this.tail; walker !== null; ) {
res.push(fn.call(thisp, walker.value, this));
walker = walker.prev;
}
return res;
};
Yallist.prototype.reduce = function(fn, initial) {
var acc;
var walker = this.head;
if (arguments.length > 1) {
acc = initial;
} else if (this.head) {
walker = this.head.next;
acc = this.head.value;
} else {
throw new TypeError("Reduce of empty list with no initial value");
}
for (var i = 0; walker !== null; i++) {
acc = fn(acc, walker.value, i);
walker = walker.next;
}
return acc;
};
Yallist.prototype.reduceReverse = function(fn, initial) {
var acc;
var walker = this.tail;
if (arguments.length > 1) {
acc = initial;
} else if (this.tail) {
walker = this.tail.prev;
acc = this.tail.value;
} else {
throw new TypeError("Reduce of empty list with no initial value");
}
for (var i = this.length - 1; walker !== null; i--) {
acc = fn(acc, walker.value, i);
walker = walker.prev;
}
return acc;
};
Yallist.prototype.toArray = function() {
var arr = new Array(this.length);
for (var i = 0, walker = this.head; walker !== null; i++) {
arr[i] = walker.value;
walker = walker.next;
}
return arr;
};
Yallist.prototype.toArrayReverse = function() {
var arr = new Array(this.length);
for (var i = 0, walker = this.tail; walker !== null; i++) {
arr[i] = walker.value;
walker = walker.prev;
}
return arr;
};
Yallist.prototype.slice = function(from, to) {
to = to || this.length;
if (to < 0) {
to += this.length;
}
from = from || 0;
if (from < 0) {
from += this.length;
}
var ret = new Yallist();
if (to < from || to < 0) {
return ret;
}
if (from < 0) {
from = 0;
}
if (to > this.length) {
to = this.length;
}
for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
walker = walker.next;
}
for (; walker !== null && i < to; i++, walker = walker.next) {
ret.push(walker.value);
}
return ret;
};
Yallist.prototype.sliceReverse = function(from, to) {
to = to || this.length;
if (to < 0) {
to += this.length;
}
from = from || 0;
if (from < 0) {
from += this.length;
}
var ret = new Yallist();
if (to < from || to < 0) {
return ret;
}
if (from < 0) {
from = 0;
}
if (to > this.length) {
to = this.length;
}
for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
walker = walker.prev;
}
for (; walker !== null && i > from; i--, walker = walker.prev) {
ret.push(walker.value);
}
return ret;
};
Yallist.prototype.splice = function(start, deleteCount, ...nodes) {
if (start > this.length) {
start = this.length - 1;
}
if (start < 0) {
start = this.length + start;
}
for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
walker = walker.next;
}
var ret = [];
for (var i = 0; walker && i < deleteCount; i++) {
ret.push(walker.value);
walker = this.removeNode(walker);
}
if (walker === null) {
walker = this.tail;
}
if (walker !== this.head && walker !== this.tail) {
walker = walker.prev;
}
for (var i = 0; i < nodes.length; i++) {
walker = insert(this, walker, nodes[i]);
}
return ret;
};
Yallist.prototype.reverse = function() {
var head = this.head;
var tail = this.tail;
for (var walker = head; walker !== null; walker = walker.prev) {
var p = walker.prev;
walker.prev = walker.next;
walker.next = p;
}
this.head = tail;
this.tail = head;
return this;
};
function insert(self2, node, value) {
var inserted = node === self2.head ? new Node(value, null, node, self2) : new Node(value, node, node.next, self2);
if (inserted.next === null) {
self2.tail = inserted;
}
if (inserted.prev === null) {
self2.head = inserted;
}
self2.length++;
return inserted;
}
function push(self2, item) {
self2.tail = new Node(item, self2.tail, null, self2);
if (!self2.head) {
self2.head = self2.tail;
}
self2.length++;
}
function unshift(self2, item) {
self2.head = new Node(item, null, self2.head, self2);
if (!self2.tail) {
self2.tail = self2.head;
}
self2.length++;
}
function Node(value, prev, next, list) {
if (!(this instanceof Node)) {
return new Node(value, prev, next, list);
}
this.list = list;
this.value = value;
if (prev) {
prev.next = this;
this.prev = prev;
} else {
this.prev = null;
}
if (next) {
next.prev = this;
this.next = next;
} else {
this.next = null;
}
}
try {
require_iterator()(Yallist);
} catch (er) {
}
}
});
// node_modules/.pnpm/lru-cache@6.0.0/node_modules/lru-cache/index.js
var require_lru_cache = __commonJS({
"node_modules/.pnpm/lru-cache@6.0.0/node_modules/lru-cache/index.js"(exports, module2) {
"use strict";
var Yallist = require_yallist();
var MAX = Symbol("max");
var LENGTH = Symbol("length");
var LENGTH_CALCULATOR = Symbol("lengthCalculator");
var ALLOW_STALE = Symbol("allowStale");
var MAX_AGE = Symbol("maxAge");
var DISPOSE = Symbol("dispose");
var NO_DISPOSE_ON_SET = Symbol("noDisposeOnSet");
var LRU_LIST = Symbol("lruList");
var CACHE = Symbol("cache");
var UPDATE_AGE_ON_GET = Symbol("updateAgeOnGet");
var naiveLength = () => 1;
var LRUCache = class {
constructor(options) {
if (typeof options === "number")
options = { max: options };
if (!options)
options = {};
if (options.max && (typeof options.max !== "number" || options.max < 0))
throw new TypeError("max must be a non-negative number");
const max = this[MAX] = options.max || Infinity;
const lc = options.length || naiveLength;
this[LENGTH_CALCULATOR] = typeof lc !== "function" ? naiveLength : lc;
this[ALLOW_STALE] = options.stale || false;
if (options.maxAge && typeof options.maxAge !== "number")
throw new TypeError("maxAge must be a number");
this[MAX_AGE] = options.maxAge || 0;
this[DISPOSE] = options.dispose;
this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
this.reset();
}
// resize the cache when the max changes.
set max(mL) {
if (typeof mL !== "number" || mL < 0)
throw new TypeError("max must be a non-negative number");
this[MAX] = mL || Infinity;
trim(this);
}
get max() {
return this[MAX];
}
set allowStale(allowStale) {
this[ALLOW_STALE] = !!allowStale;
}
get allowStale() {
return this[ALLOW_STALE];
}
set maxAge(mA) {
if (typeof mA !== "number")
throw new TypeError("maxAge must be a non-negative number");
this[MAX_AGE] = mA;
trim(this);
}
get maxAge() {
return this[MAX_AGE];
}
// resize the cache when the lengthCalculator changes.
set lengthCalculator(lC) {
if (typeof lC !== "function")
lC = naiveLength;
if (lC !== this[LENGTH_CALCULATOR]) {
this[LENGTH_CALCULATOR] = lC;
this[LENGTH] = 0;
this[LRU_LIST].forEach((hit) => {
hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
this[LENGTH] += hit.length;
});
}
trim(this);
}
get lengthCalculator() {
return this[LENGTH_CALCULATOR];
}
get length() {
return this[LENGTH];
}
get itemCount() {
return this[LRU_LIST].length;
}
rforEach(fn, thisp) {
thisp = thisp || this;
for (let walker = this[LRU_LIST].tail; walker !== null; ) {
const prev = walker.prev;
forEachStep(this, fn, walker, thisp);
walker = prev;
}
}
forEach(fn, thisp) {
thisp = thisp || this;
for (let walker = this[LRU_LIST].head; walker !== null; ) {
const next = walker.next;
forEachStep(this, fn, walker, thisp);
walker = next;
}
}
keys() {
return this[LRU_LIST].toArray().map((k) => k.key);
}
values() {
return this[LRU_LIST].toArray().map((k) => k.value);
}
reset() {
if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) {
this[LRU_LIST].forEach((hit) => this[DISPOSE](hit.key, hit.value));
}
this[CACHE] = /* @__PURE__ */ new Map();
this[LRU_LIST] = new Yallist();
this[LENGTH] = 0;
}
dump() {
return this[LRU_LIST].map((hit) => isStale(this, hit) ? false : {
k: hit.key,
v: hit.value,
e: hit.now + (hit.maxAge || 0)
}).toArray().filter((h) => h);
}
dumpLru() {
return this[LRU_LIST];
}
set(key, value, maxAge) {
maxAge = maxAge || this[MAX_AGE];
if (maxAge && typeof maxAge !== "number")
throw new TypeError("maxAge must be a number");
const now = maxAge ? Date.now() : 0;
const len = this[LENGTH_CALCULATOR](value, key);
if (this[CACHE].has(key)) {
if (len > this[MAX]) {
del(this, this[CACHE].get(key));
return false;
}
const node = this[CACHE].get(key);
const item = node.value;
if (this[DISPOSE]) {
if (!this[NO_DISPOSE_ON_SET])
this[DISPOSE](key, item.value);
}
item.now = now;
item.maxAge = maxAge;
item.value = value;
this[LENGTH] += len - item.length;
item.length = len;
this.get(key);
trim(this);
return true;
}
const hit = new Entry(key, value, len, now, maxAge);
if (hit.length > this[MAX]) {
if (this[DISPOSE])
this[DISPOSE](key, value);
return false;
}
this[LENGTH] += hit.length;
this[LRU_LIST].unshift(hit);
this[CACHE].set(key, this[LRU_LIST].head);
trim(this);
return true;
}
has(key) {
if (!this[CACHE].has(key))
return false;
const hit = this[CACHE].get(key).value;
return !isStale(this, hit);
}
get(key) {
return get(this, key, true);
}
peek(key) {
return get(this, key, false);
}
pop() {
const node = this[LRU_LIST].tail;
if (!node)
return null;
del(this, node);
return node.value;
}
del(key) {
del(this, this[CACHE].get(key));
}
load(arr) {
this.reset();
const now = Date.now();
for (let l = arr.length - 1; l >= 0; l--) {
const hit = arr[l];
const expiresAt = hit.e || 0;
if (expiresAt === 0)
this.set(hit.k, hit.v);
else {
const maxAge = expiresAt - now;
if (maxAge > 0) {
this.set(hit.k, hit.v, maxAge);
}
}
}
}
prune() {
this[CACHE].forEach((value, key) => get(this, key, false));
}
};
var get = (self2, key, doUse) => {
const node = self2[CACHE].get(key);
if (node) {
const hit = node.value;
if (isStale(self2, hit)) {
del(self2, node);
if (!self2[ALLOW_STALE])
return void 0;
} else {
if (doUse) {
if (self2[UPDATE_AGE_ON_GET])
node.value.now = Date.now();
self2[LRU_LIST].unshiftNode(node);
}
}
return hit.value;
}
};
var isStale = (self2, hit) => {
if (!hit || !hit.maxAge && !self2[MAX_AGE])
return false;
const diff2 = Date.now() - hit.now;
return hit.maxAge ? diff2 > hit.maxAge : self2[MAX_AGE] && diff2 > self2[MAX_AGE];
};
var trim = (self2) => {
if (self2[LENGTH] > self2[MAX]) {
for (let walker = self2[LRU_LIST].tail; self2[LENGTH] > self2[MAX] && walker !== null; ) {
const prev = walker.prev;
del(self2, walker);
walker = prev;
}
}
};
var del = (self2, node) => {
if (node) {
const hit = node.value;
if (self2[DISPOSE])
self2[DISPOSE](hit.key, hit.value);
self2[LENGTH] -= hit.length;
self2[CACHE].delete(hit.key);
self2[LRU_LIST].removeNode(node);
}
};
var Entry = class {
constructor(key, value, length, now, maxAge) {
this.key = key;
this.value = value;
this.length = length;
this.now = now;
this.maxAge = maxAge || 0;
}
};
var forEachStep = (self2, fn, node, thisp) => {
let hit = node.value;
if (isStale(self2, hit)) {
del(self2, node);
if (!self2[ALLOW_STALE])
hit = void 0;
}
if (hit)
fn.call(thisp, hit.value, hit.key, self2);
};
module2.exports = LRUCache;
}
});
// node_modules/.pnpm/mysql2@2.3.3/node_modules/mysql2/lib/constants/errors.js
var require_errors = __commonJS({
"node_modules/.pnpm/mysql2@2.3.3/node_modules/mysql2/lib/constants/errors.js"(exports) {
"use strict";
exports.EE_CANTCREATEFILE = 1;
exports.EE_READ = 2;
exports.EE_WRITE = 3;
exports.EE_BADCLOSE = 4;
exports.EE_OUTOFMEMORY = 5;
exports.EE_DELETE = 6;
exports.EE_LINK = 7;
exports.EE_EOFERR = 9;
exports.EE_CANTLOCK = 10;
exports.EE_CANTUNLOCK = 11;
exports.EE_DIR = 12;
exports.EE_STAT = 13;
exports.EE_CANT_CHSIZE = 14;
exports.EE_CANT_OPEN_STREAM = 15;
exports.EE_GETWD = 16;
exports.EE_SETWD = 17;
exports.EE_LINK_WARNING = 18;
exports.EE_OPEN_WARNING = 19;
exports.EE_DISK_FULL = 20;
exports.EE_CANT_MKDIR = 21;
exports.EE_UNKNOWN_CHARSET = 22;
exports.EE_OUT_OF_FILERESOURCES = 23;
exports.EE_CANT_READLINK = 24;
exports.EE_CANT_SYMLINK = 25;
exports.EE_REALPATH = 26;
exports.EE_SYNC = 27;
exports.EE_UNKNOWN_COLLATION = 28;
exports.EE_FILENOTFOUND = 29;
exports.EE_FILE_NOT_CLOSED = 30;
exports.EE_CHANGE_OWNERSHIP = 31;
exports.EE_CHANGE_PERMISSIONS = 32;
exports.EE_CANT_SEEK = 33;
exports.HA_ERR_KEY_NOT_FOUND = 120;
exports.HA_ERR_FOUND_DUPP_KEY = 121;
exports.HA_ERR_INTERNAL_ERROR = 122;
exports.HA_ERR_RECORD_CHANGED = 123;
exports.HA_ERR_WRONG_INDEX = 124;
exports.HA_ERR_CRASHED = 126;
exports.HA_ERR_WRONG_IN_RECORD = 127;
exports.HA_ERR_OUT_OF_MEM = 128;
exports.HA_ERR_NOT_A_TABLE = 130;
exports.HA_ERR_WRONG_COMMAND = 131;
exports.HA_ERR_OLD_FILE = 132;
exports.HA_ERR_NO_ACTIVE_RECORD = 133;
exports.HA_ERR_RECORD_DELETED = 134;
exports.HA_ERR_RECORD_FILE_FULL = 135;
exports.HA_ERR_INDEX_FILE_FULL = 136;
exports.HA_ERR_END_OF_FILE = 137;
exports.HA_ERR_UNSUPPORTED = 138;
exports.HA_ERR_TO_BIG_ROW = 139;
exports.HA_WRONG_CREATE_OPTION = 140;
exports.HA_ERR_FOUND_DUPP_UNIQUE = 141;
exports.HA_ERR_UNKNOWN_CHARSET = 142;
exports.HA_ERR_WRONG_MRG_TABLE_DEF = 143;
exports.HA_ERR_CRASHED_ON_REPAIR = 144;
exports.HA_ERR_CRASHED_ON_USAGE = 145;
exports.HA_ERR_LOCK_WAIT_TIMEOUT = 146;
exports.HA_ERR_LOCK_TABLE_FULL = 147;
exports.HA_ERR_READ_ONLY_TRANSACTION = 148;
exports.HA_ERR_LOCK_DEADLOCK = 149;
exports.HA_ERR_CANNOT_ADD_FOREIGN = 150;
exports.HA_ERR_NO_REFERENCED_ROW = 151;
exports.HA_ERR_ROW_IS_REFERENCED = 152;
exports.HA_ERR_NO_SAVEPOINT = 153;
exports.HA_ERR_NON_UNIQUE_BLOCK_SIZE = 154;
exports.HA_ERR_NO_SUCH_TABLE = 155;
exports.HA_ERR_TABLE_EXIST = 156;
exports.HA_ERR_NO_CONNECTION = 157;
exports.HA_ERR_NULL_IN_SPATIAL = 158;
exports.HA_ERR_TABLE_DEF_CHANGED = 159;
exports.HA_ERR_NO_PARTITION_FOUND = 160;
exports.HA_ERR_RBR_LOGGING_FAILED = 161;
exports.HA_ERR_DROP_INDEX_FK = 162;
exports.HA_ERR_FOREIGN_DUPLICATE_KEY = 163;
exports.HA_ERR_TABLE_NEEDS_UPGRADE = 164;
exports.HA_ERR_TABLE_READONLY = 165;
exports.HA_ERR_AUTOINC_READ_FAILED = 166;
exports.HA_ERR_AUTOINC_ERANGE = 167;
exports.HA_ERR_GENERIC = 168;
exports.HA_ERR_RECORD_IS_THE_SAME = 169;
exports.HA_ERR_LOGGING_IMPOSSIBLE = 170;
exports.HA_ERR_CORRUPT_EVENT = 171;
exports.HA_ERR_NEW_FILE = 172;
exports.HA_ERR_ROWS_EVENT_APPLY = 173;
exports.HA_ERR_INITIALIZATION = 174;
exports.HA_ERR_FILE_TOO_SHORT = 175;
exports.HA_ERR_WRONG_CRC = 176;
exports.HA_ERR_TOO_MANY_CONCURRENT_TRXS = 177;
exports.HA_ERR_NOT_IN_LOCK_PARTITIONS = 178;
exports.HA_ERR_INDEX_COL_TOO_LONG = 179;
exports.HA_ERR_INDEX_CORRUPT = 180;
exports.HA_ERR_UNDO_REC_TOO_BIG = 181;
exports.HA_FTS_INVALID_DOCID = 182;
exports.HA_ERR_TABLE_IN_FK_CHECK = 183;
exports.HA_ERR_TABLESPACE_EXISTS = 184;
exports.HA_ERR_TOO_MANY_FIELDS = 185;
exports.HA_ERR_ROW_IN_WRONG_PARTITION = 186;
exports.HA_ERR_INNODB_READ_ONLY = 187;
exports.HA_ERR_FTS_EXCEED_RESULT_CACHE_LIMIT = 188;
exports.HA_ERR_TEMP_FILE_WRITE_FAILURE = 189;
exports.HA_ERR_INNODB_FORCED_RECOVERY = 190;
exports.HA_ERR_FTS_TOO_MANY_WORDS_IN_PHRASE = 191;
exports.ER_HASHCHK = 1e3;
exports.ER_NISAMCHK = 1001;
exports.ER_NO = 1002;
exports.ER_YES = 1003;
exports.ER_CANT_CREATE_FILE = 1004;
exports.ER_CANT_CREATE_TABLE = 1005;
exports.ER_CANT_CREATE_DB = 1006;
exports.ER_DB_CREATE_EXISTS = 1007;
exports.ER_DB_DROP_EXISTS = 1008;
exports.ER_DB_DROP_DELETE = 1009;
exports.ER_DB_DROP_RMDIR = 1010;
exports.ER_CANT_DELETE_FILE = 1011;
exports.ER_CANT_FIND_SYSTEM_REC = 1012;
exports.ER_CANT_GET_STAT = 1013;
exports.ER_CANT_GET_WD = 1014;
exports.ER_CANT_LOCK = 1015;
exports.ER_CANT_OPEN_FILE = 1016;
exports.ER_FILE_NOT_FOUND = 1017;
exports.ER_CANT_READ_DIR = 1018;
exports.ER_CANT_SET_WD = 1019;
exports.ER_CHECKREAD = 1020;
exports.ER_DISK_FULL = 1021;
exports.ER_DUP_KEY = 1022;
exports.ER_ERROR_ON_CLOSE = 1023;
exports.ER_ERROR_ON_READ = 1024;
exports.ER_ERROR_ON_RENAME = 1025;
exports.ER_ERROR_ON_WRITE = 1026;
exports.ER_FILE_USED = 1027;
exports.ER_FILSORT_ABORT = 1028;
exports.ER_FORM_NOT_FOUND = 1029;
exports.ER_GET_ERRNO = 1030;
exports.ER_ILLEGAL_HA = 1031;
exports.ER_KEY_NOT_FOUND = 1032;
exports.ER_NOT_FORM_FILE = 1033;
exports.ER_NOT_KEYFILE = 1034;
exports.ER_OLD_KEYFILE = 1035;
exports.ER_OPEN_AS_READONLY = 1036;
exports.ER_OUTOFMEMORY = 1037;
exports.ER_OUT_OF_SORTMEMORY = 1038;
exports.ER_UNEXPECTED_EOF = 1039;
exports.ER_CON_COUNT_ERROR = 1040;
exports.ER_OUT_OF_RESOURCES = 1041;
exports.ER_BAD_HOST_ERROR = 1042;
exports.ER_HANDSHAKE_ERROR = 1043;
exports.ER_DBACCESS_DENIED_ERROR = 1044;
exports.ER_ACCESS_DENIED_ERROR = 1045;
exports.ER_NO_DB_ERROR = 1046;
exports.ER_UNKNOWN_COM_ERROR = 1047;
exports.ER_BAD_NULL_ERROR = 1048;
exports.ER_BAD_DB_ERROR = 1049;
exports.ER_TABLE_EXISTS_ERROR = 1050;
exports.ER_BAD_TABLE_ERROR = 1051;
exports.ER_NON_UNIQ_ERROR = 1052;
exports.ER_SERVER_SHUTDOWN = 1053;
exports.ER_BAD_FIELD_ERROR = 1054;
exports.ER_WRONG_FIELD_WITH_GROUP = 1055;
exports.ER_WRONG_GROUP_FIELD = 1056;
exports.ER_WRONG_SUM_SELECT = 1057;
exports.ER_WRONG_VALUE_COUNT = 1058;
exports.ER_TOO_LONG_IDENT = 1059;
exports.ER_DUP_FIELDNAME = 1060;
exports.ER_DUP_KEYNAME = 1061;
exports.ER_DUP_ENTRY = 1062;
exports.ER_WRONG_FIELD_SPEC = 1063;
exports.ER_PARSE_ERROR = 1064;
exports.ER_EMPTY_QUERY = 1065;
exports.ER_NONUNIQ_TABLE = 1066;
exports.ER_INVALID_DEFAULT = 1067;
exports.ER_MULTIPLE_PRI_KEY = 1068;
exports.ER_TOO_MANY_KEYS = 1069;
exports.ER_TOO_MANY_KEY_PARTS = 1070;
exports.ER_TOO_LONG_KEY = 1071;
exports.ER_KEY_COLUMN_DOES_NOT_EXITS = 1072;
exports.ER_BLOB_USED_AS_KEY = 1073;
exports.ER_TOO_BIG_FIELDLENGTH = 1074;
exports.ER_WRONG_AUTO_KEY = 1075;
exports.ER_READY = 1076;
exports.ER_NORMAL_SHUTDOWN = 1077;
exports.ER_GOT_SIGNAL = 1078;
exports.ER_SHUTDOWN_COMPLETE = 1079;
exports.ER_FORCING_CLOSE = 1080;
exports.ER_IPSOCK_ERROR = 1081;
exports.ER_NO_SUCH_INDEX = 1082;
exports.ER_WRONG_FIELD_TERMINATORS = 1083;
exports.ER_BLOBS_AND_NO_TERMINATED = 1084;
exports.ER_TEXTFILE_NOT_READABLE = 1085;
exports.ER_FILE_EXISTS_ERROR = 1086;
exports.ER_LOAD_INFO = 1087;
exports.ER_ALTER_INFO = 1088;
exports.ER_WRONG_SUB_KEY = 1089;
exports.ER_CANT_REMOVE_ALL_FIELDS = 1090;
exports.ER_CANT_DROP_FIELD_OR_KEY = 1091;
exports.ER_INSERT_INFO = 1092;
exports.ER_UPDATE_TABLE_USED = 1093;
exports.ER_NO_SUCH_THREAD = 1094;
exports.ER_KILL_DENIED_ERROR = 1095;
exports.ER_NO_TABLES_USED = 1096;
exports.ER_TOO_BIG_SET = 1097;
exports.ER_NO_UNIQUE_LOGFILE = 1098;
exports.ER_TABLE_NOT_LOCKED_FOR_WRITE = 1099;
exports.ER_TABLE_NOT_LOCKED = 1100;
exports.ER_BLOB_CANT_HAVE_DEFAULT = 1101;
exports.ER_WRONG_DB_NAME = 1102;
exports.ER_WRONG_TABLE_NAME = 1103;
exports.ER_TOO_BIG_SELECT = 1104;
exports.ER_UNKNOWN_ERROR = 1105;
exports.ER_UNKNOWN_PROCEDURE = 1106;
exports.ER_WRONG_PARAMCOUNT_TO_PROCEDURE = 1107;
exports.ER_WRONG_PARAMETERS_TO_PROCEDURE = 1108;
exports.ER_UNKNOWN_TABLE = 1109;
exports.ER_FIELD_SPECIFIED_TWICE = 1110;
exports.ER_INVALID_GROUP_FUNC_USE = 1111;
exports.ER_UNSUPPORTED_EXTENSION = 1112;
exports.ER_TABLE_MUST_HAVE_COLUMNS = 1113;
exports.ER_RECORD_FILE_FULL = 1114;
exports.ER_UNKNOWN_CHARACTER_SET = 1115;
exports.ER_TOO_MANY_TABLES = 1116;
exports.ER_TOO_MANY_FIELDS = 1117;
exports.ER_TOO_BIG_ROWSIZE = 1118;
exports.ER_STACK_OVERRUN = 1119;
exports.ER_WRONG_OUTER_JOIN = 1120;
exports.ER_NULL_COLUMN_IN_INDEX = 1121;
exports.ER_CANT_FIND_UDF = 1122;
exports.ER_CANT_INITIALIZE_UDF = 1123;
exports.ER_UDF_NO_PATHS = 1124;
exports.ER_UDF_EXISTS = 1125;
exports.ER_CANT_OPEN_LIBRARY = 1126;
exports.ER_CANT_FIND_DL_ENTRY = 1127;
exports.ER_FUNCTION_NOT_DEFINED = 1128;
exports.ER_HOST_IS_BLOCKED = 1129;
exports.ER_HOST_NOT_PRIVILEGED = 1130;
exports.ER_PASSWORD_ANONYMOUS_USER = 1131;
exports.ER_PASSWORD_NOT_ALLOWED = 1132;
exports.ER_PASSWORD_NO_MATCH = 1133;
exports.ER_UPDATE_INFO = 1134;
exports.ER_CANT_CREATE_THREAD = 1135;
exports.ER_WRONG_VALUE_COUNT_ON_ROW = 1136;
exports.ER_CANT_REOPEN_TABLE = 1137;
exports.ER_INVALID_USE_OF_NULL = 1138;
exports.ER_REGEXP_ERROR = 1139;
exports.ER_MIX_OF_GROUP_FUNC_AND_FIELDS = 1140;
exports.ER_NONEXISTING_GRANT = 1141;
exports.ER_TABLEACCESS_DENIED_ERROR = 1142;
exports.ER_COLUMNACCESS_DENIED_ERROR = 1143;
exports.ER_ILLEGAL_GRANT_FOR_TABLE = 1144;
exports.ER_GRANT_WRONG_HOST_OR_USER = 1145;
exports.ER_NO_SUCH_TABLE = 1146;
exports.ER_NONEXISTING_TABLE_GRANT = 1147;
exports.ER_NOT_ALLOWED_COMMAND = 1148;
exports.ER_SYNTAX_ERROR = 1149;
exports.ER_DELAYED_CANT_CHANGE_LOCK = 1150;
exports.ER_TOO_MANY_DELAYED_THREADS = 1151;
exports.ER_ABORTING_CONNECTION = 1152;
exports.ER_NET_PACKET_TOO_LARGE = 1153;
exports.ER_NET_READ_ERROR_FROM_PIPE = 1154;
exports.ER_NET_FCNTL_ERROR = 1155;
exports.ER_NET_PACKETS_OUT_OF_ORDER = 1156;
exports.ER_NET_UNCOMPRESS_ERROR = 1157;
exports.ER_NET_READ_ERROR = 1158;
exports.ER_NET_READ_INTERRUPTED = 1159;
exports.ER_NET_ERROR_ON_WRITE = 1160;
exports.ER_NET_WRITE_INTERRUPTED = 1161;
exports.ER_TOO_LONG_STRING = 1162;
exports.ER_TABLE_CANT_HANDLE_BLOB = 1163;
exports.ER_TABLE_CANT_HANDLE_AUTO_INCREMENT = 1164;
exports.ER_DELAYED_INSERT_TABLE_LOCKED = 1165;
exports.ER_WRONG_COLUMN_NAME = 1166;
exports.ER_WRONG_KEY_COLUMN = 1167;
exports.ER_WRONG_MRG_TABLE = 1168;
exports.ER_DUP_UNIQUE = 1169;
exports.ER_BLOB_KEY_WITHOUT_LENGTH = 1170;
exports.ER_PRIMARY_CANT_HAVE_NULL = 1171;
exports.ER_TOO_MANY_ROWS = 1172;
exports.ER_REQUIRES_PRIMARY_KEY = 1173;
exports.ER_NO_RAID_COMPILED = 1174;
exports.ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE = 1175;
exports.ER_KEY_DOES_NOT_EXITS = 1176;
exports.ER_CHECK_NO_SUCH_TABLE = 1177;
exports.ER_CHECK_NOT_IMPLEMENTED = 1178;
exports.ER_CANT_DO_THIS_DURING_AN_TRANSACTION = 1179;
exports.ER_ERROR_DURING_COMMIT = 1180;
exports.ER_ERROR_DURING_ROLLBACK = 1181;
exports.ER_ERROR_DURING_FLUSH_LOGS = 1182;
exports.ER_ERROR_DURING_CHECKPOINT = 1183;
exports.ER_NEW_ABORTING_CONNECTION = 1184;
exports.ER_DUMP_NOT_IMPLEMENTED = 1185;
exports.ER_FLUSH_MASTER_BINLOG_CLOSED = 1186;
exports.ER_FLUSH_SOURCE_BINLOG_CLOSED = 1186;
exports.ER_INDEX_REBUILD = 1187;
exports.ER_MASTER = 1188;
exports.ER_SOURCE = 1188;
exports.ER_MASTER_NET_READ = 1189;
exports.ER_SOURCE_NET_READ = 1189;
exports.ER_MASTER_NET_WRITE = 1190;
exports.ER_SOURCE_NET_WRITE = 1190;
exports.ER_FT_MATCHING_KEY_NOT_FOUND = 1191;
exports.ER_LOCK_OR_ACTIVE_TRANSACTION = 1192;
exports.ER_UNKNOWN_SYSTEM_VARIABLE = 1193;
exports.ER_CRASHED_ON_USAGE = 1194;
exports.ER_CRASHED_ON_REPAIR = 1195;
exports.ER_WARNING_NOT_COMPLETE_ROLLBACK = 1196;
exports.ER_TRANS_CACHE_FULL = 1197;
exports.ER_SLAVE_MUST_STOP = 1198;
exports.ER_REPLICA_MUST_STOP = 1198;
exports.ER_SLAVE_NOT_RUNNING = 1199;
exports.ER_REPLICA_NOT_RUNNING = 1199;
exports.ER_BAD_SLAVE = 1200;
exports.ER_BAD_REPLICA = 1200;
exports.ER_MASTER_INFO = 1201;
exports.ER_SOURCE_INFO = 1201;
exports.ER_SLAVE_THREAD = 1202;
exports.ER_REPLICA_THREAD = 1202;
exports.ER_TOO_MANY_USER_CONNECTIONS = 1203;
exports.ER_SET_CONSTANTS_ONLY = 1204;
exports.ER_LOCK_WAIT_TIMEOUT = 1205;
exports.ER_LOCK_TABLE_FULL = 1206;
exports.ER_READ_ONLY_TRANSACTION = 1207;
exports.ER_DROP_DB_WITH_READ_LOCK = 1208;
exports.ER_CREATE_DB_WITH_READ_LOCK = 1209;
exports.ER_WRONG_ARGUMENTS = 1210;
exports.ER_NO_PERMISSION_TO_CREATE_USER = 1211;
exports.ER_UNION_TABLES_IN_DIFFERENT_DIR = 1212;
exports.ER_LOCK_DEADLOCK = 1213;
exports.ER_TABLE_CANT_HANDLE_FT = 1214;
exports.ER_CANNOT_ADD_FOREIGN = 1215;
exports.ER_NO_REFERENCED_ROW = 1216;
exports.ER_ROW_IS_REFERENCED = 1217;
exports.ER_CONNECT_TO_MASTER = 1218;
exports.ER_CONNECT_TO_SOURCE = 1218;
exports.ER_QUERY_ON_MASTER = 1219;
exports.ER_QUERY_ON_SOURCE = 1219;
exports.ER_ERROR_WHEN_EXECUTING_COMMAND = 1220;
exports.ER_WRONG_USAGE = 1221;
exports.ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT = 1222;
exports.ER_CANT_UPDATE_WITH_READLOCK = 1223;
exports.ER_MIXING_NOT_ALLOWED = 1224;
exports.ER_DUP_ARGUMENT = 1225;
exports.ER_USER_LIMIT_REACHED = 1226;
exports.ER_SPECIFIC_ACCESS_DENIED_ERROR = 1227;
exports.ER_LOCAL_VARIABLE = 1228;
exports.ER_GLOBAL_VARIABLE = 1229;
exports.ER_NO_DEFAULT = 1230;
exports.ER_WRONG_VALUE_FOR_VAR = 1231;
exports.ER_WRONG_TYPE_FOR_VAR = 1232;
exports.ER_VAR_CANT_BE_READ = 1233;
exports.ER_CANT_USE_OPTION_HERE = 1234;
exports.ER_NOT_SUPPORTED_YET = 1235;
exports.ER_MASTER_FATAL_ERROR_READING_BINLOG = 1236;
exports.ER_SOURCE_FATAL_ERROR_READING_BINLOG = 1236;
exports.ER_SLAVE_IGNORED_TABLE = 1237;
exports.ER_REPLICA_IGNORED_TABLE = 1237;
exports.ER_INCORRECT_GLOBAL_LOCAL_VAR = 1238;
exports.ER_WRONG_FK_DEF = 1239;
exports.ER_KEY_REF_DO_NOT_MATCH_TABLE_REF = 1240;
exports.ER_OPERAND_COLUMNS = 1241;
exports.ER_SUBQUERY_NO_1_ROW = 1242;
exports.ER_UNKNOWN_STMT_HANDLER = 1243;
exports.ER_CORRUPT_HELP_DB = 1244;
exports.ER_CYCLIC_REFERENCE = 1245;
exports.ER_AUTO_CONVERT = 1246;
exports.ER_ILLEGAL_REFERENCE = 1247;
exports.ER_DERIVED_MUST_HAVE_ALIAS = 1248;
exports.ER_SELECT_REDUCED = 1249;
exports.ER_TABLENAME_NOT_ALLOWED_HERE = 1250;
exports.ER_NOT_SUPPORTED_AUTH_MODE = 1251;
exports.ER_SPATIAL_CANT_HAVE_NULL = 1252;
exports.ER_COLLATION_CHARSET_MISMATCH = 1253;
exports.ER_SLAVE_WAS_RUNNING = 1254;
exports.ER_REPLICA_WAS_RUNNING = 1254;
exports.ER_SLAVE_WAS_NOT_RUNNING = 1255;
exports.ER_REPLICA_WAS_NOT_RUNNING = 1255;
exports.ER_TOO_BIG_FOR_UNCOMPRESS = 1256;
exports.ER_ZLIB_Z_MEM_ERROR = 1257;
exports.ER_ZLIB_Z_BUF_ERROR = 1258;
exports.ER_ZLIB_Z_DATA_ERROR = 1259;
exports.ER_CUT_VALUE_GROUP_CONCAT = 1260;
exports.ER_WARN_TOO_FEW_RECORDS = 1261;
exports.ER_WARN_TOO_MANY_RECORDS = 1262;
exports.ER_WARN_NULL_TO_NOTNULL = 1263;
exports.ER_WARN_DATA_OUT_OF_RANGE = 1264;
exports.ER_WARN_DATA_TRUNCATED = 1265;
exports.ER_WARN_USING_OTHER_HANDLER = 1266;
exports.ER_CANT_AGGREGATE_2COLLATIONS = 1267;
exports.ER_DROP_USER = 1268;
exports.ER_REVOKE_GRANTS = 1269;
exports.ER_CANT_AGGREGATE_3COLLATIONS = 1270;
exports.ER_CANT_AGGREGATE_NCOLLATIONS = 1271;
exports.ER_VARIABLE_IS_NOT_STRUCT = 1272;
exports.ER_UNKNOWN_COLLATION = 1273;
exports.ER_SLAVE_IGNORED_SSL_PARAMS = 1274;
exports.ER_REPLICA_IGNORED_SSL_PARAMS = 1274;
exports.ER_SERVER_IS_IN_SECURE_AUTH_MODE = 1275;
exports.ER_WARN_FIELD_RESOLVED = 1276;
exports.ER_BAD_SLAVE_UNTIL_COND = 1277;
exports.ER_BAD_REPLICA_UNTIL_COND = 1277;
exports.ER_MISSING_SKIP_SLAVE = 1278;
exports.ER_MISSING_SKIP_REPLICA = 1278;
exports.ER_UNTIL_COND_IGNORED = 1279;
exports.ER_WRONG_NAME_FOR_INDEX = 1280;
exports.ER_WRONG_NAME_FOR_CATALOG = 1281;
exports.ER_WARN_QC_RESIZE = 1282;
exports.ER_BAD_FT_COLUMN = 1283;
exports.ER_UNKNOWN_KEY_CACHE = 1284;
exports.ER_WARN_HOSTNAME_WONT_WORK = 1285;
exports.ER_UNKNOWN_STORAGE_ENGINE = 1286;
exports.ER_WARN_DEPRECATED_SYNTAX = 1287;
exports.ER_NON_UPDATABLE_TABLE = 1288;
exports.ER_FEATURE_DISABLED = 1289;
exports.ER_OPTION_PREVENTS_STATEMENT = 1290;
exports.ER_DUPLICATED_VALUE_IN_TYPE = 1291;
exports.ER_TRUNCATED_WRONG_VALUE = 1292;
exports.ER_TOO_MUCH_AUTO_TIMESTAMP_COLS = 1293;
exports.ER_INVALID_ON_UPDATE = 1294;
exports.ER_UNSUPPORTED_PS = 1295;
exports.ER_GET_ERRMSG = 1296;
exports.ER_GET_TEMPORARY_ERRMSG = 1297;
exports.ER_UNKNOWN_TIME_ZONE = 1298;
exports.ER_WARN_INVALID_TIMESTAMP = 1299;
exports.ER_INVALID_CHARACTER_STRING = 1300;
exports.ER_WARN_ALLOWED_PACKET_OVERFLOWED = 1301;
exports.ER_CONFLICTING_DECLARATIONS = 1302;
exports.ER_SP_NO_RECURSIVE_CREATE = 1303;
exports.ER_SP_ALREADY_EXISTS = 1304;
exports.ER_SP_DOES_NOT_EXIST = 1305;
exports.ER_SP_DROP_FAILED = 1306;
exports.ER_SP_STORE_FAILED = 1307;
exports.ER_SP_LILABEL_MISMATCH = 1308;
exports.ER_SP_LABEL_REDEFINE = 1309;
exports.ER_SP_LABEL_MISMATCH = 1310;
exports.ER_SP_UNINIT_VAR = 1311;
exports.ER_SP_BADSELECT = 1312;
exports.ER_SP_BADRETURN = 1313;
exports.ER_SP_BADSTATEMENT = 1314;
exports.ER_UPDATE_LOG_DEPRECATED_IGNORED = 1315;
exports.ER_UPDATE_LOG_DEPRECATED_TRANSLATED = 1316;
exports.ER_QUERY_INTERRUPTED = 1317;
exports.ER_SP_WRONG_NO_OF_ARGS = 1318;
exports.ER_SP_COND_MISMATCH = 1319;
exports.ER_SP_NORETURN = 1320;
exports.ER_SP_NORETURNEND = 1321;
exports.ER_SP_BAD_CURSOR_QUERY = 1322;
exports.ER_SP_BAD_CURSOR_SELECT = 1323;
exports.ER_SP_CURSOR_MISMATCH = 1324;
exports.ER_SP_CURSOR_ALREADY_OPEN = 1325;
exports.ER_SP_CURSOR_NOT_OPEN = 1326;
exports.ER_SP_UNDECLARED_VAR = 1327;
exports.ER_SP_WRONG_NO_OF_FETCH_ARGS = 1328;
exports.ER_SP_FETCH_NO_DATA = 1329;
exports.ER_SP_DUP_PARAM = 1330;
exports.ER_SP_DUP_VAR = 1331;
exports.ER_SP_DUP_COND = 1332;
exports.ER_SP_DUP_CURS = 1333;
exports.ER_SP_CANT_ALTER = 1334;
exports.ER_SP_SUBSELECT_NYI = 1335;
exports.ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG = 1336;
exports.ER_SP_VARCOND_AFTER_CURSHNDLR = 1337;
exports.ER_SP_CURSOR_AFTER_HANDLER = 1338;
exports.ER_SP_CASE_NOT_FOUND = 1339;
exports.ER_FPARSER_TOO_BIG_FILE = 1340;
exports.ER_FPARSER_BAD_HEADER = 1341;
exports.ER_FPARSER_EOF_IN_COMMENT = 1342;
exports.ER_FPARSER_ERROR_IN_PARAMETER = 1343;
exports.ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER = 1344;
exports.ER_VIEW_NO_EXPLAIN = 1345;
exports.ER_FRM_UNKNOWN_TYPE = 1346;
exports.ER_WRONG_OBJECT = 1347;
exports.ER_NONUPDATEABLE_COLUMN = 1348;
exports.ER_VIEW_SELECT_DERIVED = 1349;
exports.ER_VIEW_SELECT_CLAUSE = 1350;
exports.ER_VIEW_SELECT_VARIABLE = 1351;
exports.ER_VIEW_SELECT_TMPTABLE = 1352;
exports.ER_VIEW_WRONG_LIST = 1353;
exports.ER_WARN_VIEW_MERGE = 1354;
exports.ER_WARN_VIEW_WITHOUT_KEY = 1355;
exports.ER_VIEW_INVALID = 1356;
exports.ER_SP_NO_DROP_SP = 1357;
exports.ER_SP_GOTO_IN_HNDLR = 1358;
exports.ER_TRG_ALREADY_EXISTS = 1359;
exports.ER_TRG_DOES_NOT_EXIST = 1360;
exports.ER_TRG_ON_VIEW_OR_TEMP_TABLE = 1361;
exports.ER_TRG_CANT_CHANGE_ROW = 1362;
exports.ER_TRG_NO_SUCH_ROW_IN_TRG = 1363;
exports.ER_NO_DEFAULT_FOR_FIELD = 1364;
exports.ER_DIVISION_BY_ZERO = 1365;
exports.ER_TRUNCATED_WRONG_VALUE_FOR_FIELD = 1366;
exports.ER_ILLEGAL_VALUE_FOR_TYPE = 1367;
exports.ER_VIEW_NONUPD_CHECK = 1368;
exports.ER_VIEW_CHECK_FAILED = 1369;
exports.ER_PROCACCESS_DENIED_ERROR = 1370;
exports.ER_RELAY_LOG_FAIL = 1371;
exports.ER_PASSWD_LENGTH = 1372;
exports.ER_UNKNOWN_TARGET_BINLOG = 1373;
exports.ER_IO_ERR_LOG_INDEX_READ = 1374;
exports.ER_BINLOG_PURGE_PROHIBITED = 1375;
exports.ER_FSEEK_FAIL = 1376;
exports.ER_BINLOG_PURGE_FATAL_ERR = 1377;
exports.ER_LOG_IN_USE = 1378;
exports.ER_LOG_PURGE_UNKNOWN_ERR = 1379;
exports.ER_RELAY_LOG_INIT = 1380;
exports.ER_NO_BINARY_LOGGING = 1381;
exports.ER_RESERVED_SYNTAX = 1382;
exports.ER_WSAS_FAILED = 1383;
exports.ER_DIFF_GROUPS_PROC = 1384;
exports.ER_NO_GROUP_FOR_PROC = 1385;
exports.ER_ORDER_WITH_PROC = 1386;
exports.ER_LOGGING_PROHIBIT_CHANGING_OF = 1387;
exports.ER_NO_FILE_MAPPING = 1388;
exports.ER_WRONG_MAGIC = 1389;
exports.ER_PS_MANY_PARAM = 1390;
exports.ER_KEY_PART_0 = 1391;
exports.ER_VIEW_CHECKSUM = 1392;
exports.ER_VIEW_MULTIUPDATE = 1393;
exports.ER_VIEW_NO_INSERT_FIELD_LIST = 1394;
exports.ER_VIEW_DELETE_MERGE_VIEW = 1395;
exports.ER_CANNOT_USER = 1396;
exports.ER_XAER_NOTA = 1397;
exports.ER_XAER_INVAL = 1398;
exports.ER_XAER_RMFAIL = 1399;
exports.ER_XAER_OUTSIDE = 1400;
exports.ER_XAER_RMERR = 1401;
exports.ER_XA_RBROLLBACK = 1402;
exports.ER_NONEXISTING_PROC_GRANT = 1403;
exports.ER_PROC_AUTO_GRANT_FAIL = 1404;
exports.ER_PROC_AUTO_REVOKE_FAIL = 1405;
exports.ER_DATA_TOO_LONG = 1406;
exports.ER_SP_BAD_SQLSTATE = 1407;
exports.ER_STARTUP = 1408;
exports.ER_LOAD_FROM_FIXED_SIZE_ROWS_TO_VAR = 1409;
exports.ER_CANT_CREATE_USER_WITH_GRANT = 1410;
exports.ER_WRONG_VALUE_FOR_TYPE = 1411;
exports.ER_TABLE_DEF_CHANGED = 1412;
exports.ER_SP_DUP_HANDLER = 1413;
exports.ER_SP_NOT_VAR_ARG = 1414;
exports.ER_SP_NO_RETSET = 1415;
exports.ER_CANT_CREATE_GEOMETRY_OBJECT = 1416;
exports.ER_FAILED_ROUTINE_BREAK_BINLOG = 1417;
exports.ER_BINLOG_UNSAFE_ROUTINE = 1418;
exports.ER_BINLOG_CREATE_ROUTINE_NEED_SUPER = 1419;
exports.ER_EXEC_STMT_WITH_OPEN_CURSOR = 1420;
exports.ER_STMT_HAS_NO_OPEN_CURSOR = 1421;
exports.ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG = 1422;
exports.ER_NO_DEFAULT_FOR_VIEW_FIELD = 1423;
exports.ER_SP_NO_RECURSION = 1424;
exports.ER_TOO_BIG_SCALE = 1425;
exports.ER_TOO_BIG_PRECISION = 1426;
exports.ER_M_BIGGER_THAN_D = 1427;
exports.ER_WRONG_LOCK_OF_SYSTEM_TABLE = 1428;
exports.ER_CONNECT_TO_FOREIGN_DATA_SOURCE = 1429;
exports.ER_QUERY_ON_FOREIGN_DATA_SOURCE = 1430;
exports.ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST = 1431;
exports.ER_FOREIGN_DATA_STRING_INVALID_CANT_CREATE = 1432;
exports.ER_FOREIGN_DATA_STRING_INVALID = 1433;
exports.ER_CANT_CREATE_FEDERATED_TABLE = 1434;
exports.ER_TRG_IN_WRONG_SCHEMA = 1435;
exports.ER_STACK_OVERRUN_NEED_MORE = 1436;
exports.ER_TOO_LONG_BODY = 1437;
exports.ER_WARN_CANT_DROP_DEFAULT_KEYCACHE = 1438;
exports.ER_TOO_BIG_DISPLAYWIDTH = 1439;
exports.ER_XAER_DUPID = 1440;
exports.ER_DATETIME_FUNCTION_OVERFLOW = 1441;
exports.ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG = 1442;
exports.ER_VIEW_PREVENT_UPDATE = 1443;
exports.ER_PS_NO_RECURSION = 1444;
exports.ER_SP_CANT_SET_AUTOCOMMIT = 1445;
exports.ER_MALFORMED_DEFINER = 1446;
exports.ER_VIEW_FRM_NO_USER = 1447;
exports.ER_VIEW_OTHER_USER = 1448;
exports.ER_NO_SUCH_USER = 1449;
exports.ER_FORBID_SCHEMA_CHANGE = 1450;
exports.ER_ROW_IS_REFERENCED_2 = 1451;
exports.ER_NO_REFERENCED_ROW_2 = 1452;
exports.ER_SP_BAD_VAR_SHADOW = 1453;
exports.ER_TRG_NO_DEFINER = 1454;
exports.ER_OLD_FILE_FORMAT = 1455;
exports.ER_SP_RECURSION_LIMIT = 1456;
exports.ER_SP_PROC_TABLE_CORRUPT = 1457;
exports.ER_SP_WRONG_NAME = 1458;
exports.ER_TABLE_NEEDS_UPGRADE = 1459;
exports.ER_SP_NO_AGGREGATE = 1460;
exports.ER_MAX_PREPARED_STMT_COUNT_REACHED = 1461;
exports.ER_VIEW_RECURSIVE = 1462;
exports.ER_NON_GROUPING_FIELD_USED = 1463;
exports.ER_TABLE_CANT_HANDLE_SPKEYS = 1464;
exports.ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA = 1465;
exports.ER_REMOVED_SPACES = 1466;
exports.ER_AUTOINC_READ_FAILED = 1467;
exports.ER_USERNAME = 1468;
exports.ER_HOSTNAME = 1469;
exports.ER_WRONG_STRING_LENGTH = 1470;
exports.ER_NON_INSERTABLE_TABLE = 1471;
exports.ER_ADMIN_WRONG_MRG_TABLE = 1472;
exports.ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT = 1473;
exports.ER_NAME_BECOMES_EMPTY = 1474;
exports.ER_AMBIGUOUS_FIELD_TERM = 1475;
exports.ER_FOREIGN_SERVER_EXISTS = 1476;
exports.ER_FOREIGN_SERVER_DOESNT_EXIST = 1477;
exports.ER_ILLEGAL_HA_CREATE_OPTION = 1478;
exports.ER_PARTITION_REQUIRES_VALUES_ERROR = 1479;
exports.ER_PARTITION_WRONG_VALUES_ERROR = 1480;
exports.ER_PARTITION_MAXVALUE_ERROR = 1481;
exports.ER_PARTITION_SUBPARTITION_ERROR = 1482;
exports.ER_PARTITION_SUBPART_MIX_ERROR = 1483;
exports.ER_PARTITION_WRONG_NO_PART_ERROR = 1484;
exports.ER_PARTITION_WRONG_NO_SUBPART_ERROR = 1485;
exports.ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR = 1486;
exports.ER_NO_CONST_EXPR_IN_RANGE_OR_LIST_ERROR = 1487;
exports.ER_FIELD_NOT_FOUND_PART_ERROR = 1488;
exports.ER_LIST_OF_FIELDS_ONLY_IN_HASH_ERROR = 1489;
exports.ER_INCONSISTENT_PARTITION_INFO_ERROR = 1490;
exports.ER_PARTITION_FUNC_NOT_ALLOWED_ERROR = 1491;
exports.ER_PARTITIONS_MUST_BE_DEFINED_ERROR = 1492;
exports.ER_RANGE_NOT_INCREASING_ERROR = 1493;
exports.ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR = 1494;
exports.ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR = 1495;
exports.ER_PARTITION_ENTRY_ERROR = 1496;
exports.ER_MIX_HANDLER_ERROR = 1497;
exports.ER_PARTITION_NOT_DEFINED_ERROR = 1498;
exports.ER_TOO_MANY_PARTITIONS_ERROR = 1499;
exports.ER_SUBPARTITION_ERROR = 1500;
exports.ER_CANT_CREATE_HANDLER_FILE = 1501;
exports.ER_BLOB_FIELD_IN_PART_FUNC_ERROR = 1502;
exports.ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF = 1503;
exports.ER_NO_PARTS_ERROR = 1504;
exports.ER_PARTITION_MGMT_ON_NONPARTITIONED = 1505;
exports.ER_FOREIGN_KEY_ON_PARTITIONED = 1506;
exports.ER_DROP_PARTITION_NON_EXISTENT = 1507;
exports.ER_DROP_LAST_PARTITION = 1508;
exports.ER_COALESCE_ONLY_ON_HASH_PARTITION = 1509;
exports.ER_REORG_HASH_ONLY_ON_SAME_NO = 1510;
exports.ER_REORG_NO_PARAM_ERROR = 1511;
exports.ER_ONLY_ON_RANGE_LIST_PARTITION = 1512;
exports.ER_ADD_PARTITION_SUBPART_ERROR = 1513;
exports.ER_ADD_PARTITION_NO_NEW_PARTITION = 1514;
exports.ER_COALESCE_PARTITION_NO_PARTITION = 1515;
exports.ER_REORG_PARTITION_NOT_EXIST = 1516;
exports.ER_SAME_NAME_PARTITION = 1517;
exports.ER_NO_BINLOG_ERROR = 1518;
exports.ER_CONSECUTIVE_REORG_PARTITIONS = 1519;
exports.ER_REORG_OUTSIDE_RANGE = 1520;
exports.ER_PARTITION_FUNCTION_FAILURE = 1521;
exports.ER_PART_STATE_ERROR = 1522;
exports.ER_LIMITED_PART_RANGE = 1523;
exports.ER_PLUGIN_IS_NOT_LOADED = 1524;
exports.ER_WRONG_VALUE = 1525;
exports.ER_NO_PARTITION_FOR_GIVEN_VALUE = 1526;
exports.ER_FILEGROUP_OPTION_ONLY_ONCE = 1527;
exports.ER_CREATE_FILEGROUP_FAILED = 1528;
exports.ER_DROP_FILEGROUP_FAILED = 1529;
exports.ER_TABLESPACE_AUTO_EXTEND_ERROR = 1530;
exports.ER_WRONG_SIZE_NUMBER = 1531;
exports.ER_SIZE_OVERFLOW_ERROR = 1532;
exports.ER_ALTER_FILEGROUP_FAILED = 1533;
exports.ER_BINLOG_ROW_LOGGING_FAILED = 1534;
exports.ER_BINLOG_ROW_WRONG_TABLE_DEF = 1535;
exports.ER_BINLOG_ROW_RBR_TO_SBR = 1536;
exports.ER_EVENT_ALREADY_EXISTS = 1537;
exports.ER_EVENT_STORE_FAILED = 1538;
exports.ER_EVENT_DOES_NOT_EXIST = 1539;
exports.ER_EVENT_CANT_ALTER = 1540;
exports.ER_EVENT_DROP_FAILED = 1541;
exports.ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG = 1542;
exports.ER_EVENT_ENDS_BEFORE_STARTS = 1543;
exports.ER_EVENT_EXEC_TIME_IN_THE_PAST = 1544;
exports.ER_EVENT_OPEN_TABLE_FAILED = 1545;
exports.ER_EVENT_NEITHER_M_EXPR_NOR_M_AT = 1546;
exports.ER_COL_COUNT_DOESNT_MATCH_CORRUPTED = 1547;
exports.ER_CANNOT_LOAD_FROM_TABLE = 1548;
exports.ER_EVENT_CANNOT_DELETE = 1549;
exports.ER_EVENT_COMPILE_ERROR = 1550;
exports.ER_EVENT_SAME_NAME = 1551;
exports.ER_EVENT_DATA_TOO_LONG = 1552;
exports.ER_DROP_INDEX_FK = 1553;
exports.ER_WARN_DEPRECATED_SYNTAX_WITH_VER = 1554;
exports.ER_CANT_WRITE_LOCK_LOG_TABLE = 1555;
exports.ER_CANT_LOCK_LOG_TABLE = 1556;
exports.ER_FOREIGN_DUPLICATE_KEY = 1557;
exports.ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE = 1558;
exports.ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR = 1559;
exports.ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT = 1560;
exports.ER_NDB_CANT_SWITCH_BINLOG_FORMAT = 1561;
exports.ER_PARTITION_NO_TEMPORARY = 1562;
exports.ER_PARTITION_CONST_DOMAIN_ERROR = 1563;
exports.ER_PARTITION_FUNCTION_IS_NOT_ALLOWED = 1564;
exports.ER_DDL_LOG_ERROR = 1565;
exports.ER_NULL_IN_VALUES_LESS_THAN = 1566;
exports.ER_WRONG_PARTITION_NAME = 1567;
exports.ER_CANT_CHANGE_TX_ISOLATION = 1568;
exports.ER_DUP_ENTRY_AUTOINCREMENT_CASE = 1569;
exports.ER_EVENT_MODIFY_QUEUE_ERROR = 1570;
exports.ER_EVENT_SET_VAR_ERROR = 1571;
exports.ER_PARTITION_MERGE_ERROR = 1572;
exports.ER_CANT_ACTIVATE_LOG = 1573;
exports.ER_RBR_NOT_AVAILABLE = 1574;
exports.ER_BASE64_DECODE_ERROR = 1575;
exports.ER_EVENT_RECURSION_FORBIDDEN = 1576;
exports.ER_EVENTS_DB_ERROR = 1577;
exports.ER_ONLY_INTEGERS_ALLOWED = 1578;
exports.ER_UNSUPORTED_LOG_ENGINE = 1579;
exports.ER_BAD_LOG_STATEMENT = 1580;
exports.ER_CANT_RENAME_LOG_TABLE = 1581;
exports.ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT = 1582;
exports.ER_WRONG_PARAMETERS_TO_NATIVE_FCT = 1583;
exports.ER_WRONG_PARAMETERS_TO_STORED_FCT = 1584;
exports.ER_NATIVE_FCT_NAME_COLLISION = 1585;
exports.ER_DUP_ENTRY_WITH_KEY_NAME = 1586;
exports.ER_BINLOG_PURGE_EMFILE = 1587;
exports.ER_EVENT_CANNOT_CREATE_IN_THE_PAST = 1588;
exports.ER_EVENT_CANNOT_ALTER_IN_THE_PAST = 1589;
exports.ER_SLAVE_INCIDENT = 1590;
exports.ER_REPLICA_INCIDENT = 1590;
exports.ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT = 1591;
exports.ER_BINLOG_UNSAFE_STATEMENT = 1592;
exports.ER_SLAVE_FATAL_ERROR = 1593;
exports.ER_REPLICA_FATAL_ERROR = 1593;
exports.ER_SLAVE_RELAY_LOG_READ_FAILURE = 1594;
exports.ER_REPLICA_RELAY_LOG_READ_FAILURE = 1594;
exports.ER_SLAVE_RELAY_LOG_WRITE_FAILURE = 1595;
exports.ER_REPLICA_RELAY_LOG_WRITE_FAILURE = 1595;
exports.ER_SLAVE_CREATE_EVENT_FAILURE = 1596;
exports.ER_REPLICA_CREATE_EVENT_FAILURE = 1596;
exports.ER_SLAVE_MASTER_COM_FAILURE = 1597;
exports.ER_REPLICA_SOURCE_COM_FAILURE = 1597;
exports.ER_BINLOG_LOGGING_IMPOSSIBLE = 1598;
exports.ER_VIEW_NO_CREATION_CTX = 1599;
exports.ER_VIEW_INVALID_CREATION_CTX = 1600;
exports.ER_SR_INVALID_CREATION_CTX = 1601;
exports.ER_TRG_CORRUPTED_FILE = 1602;
exports.ER_TRG_NO_CREATION_CTX = 1603;
exports.ER_TRG_INVALID_CREATION_CTX = 1604;
exports.ER_EVENT_INVALID_CREATION_CTX = 1605;
exports.ER_TRG_CANT_OPEN_TABLE = 1606;
exports.ER_CANT_CREATE_SROUTINE = 1607;
exports.ER_NEVER_USED = 1608;
exports.ER_NO_FORMAT_DESCRIPTION_EVENT_BEFORE_BINLOG_STATEMENT = 1609;
exports.ER_SLAVE_CORRUPT_EVENT = 1610;
exports.ER_REPLICA_CORRUPT_EVENT = 1610;
exports.ER_LOAD_DATA_INVALID_COLUMN = 1611;
exports.ER_LOG_PURGE_NO_FILE = 1612;
exports.ER_XA_RBTIMEOUT = 1613;
exports.ER_XA_RBDEADLOCK = 1614;
exports.ER_NEED_REPREPARE = 1615;
exports.ER_DELAYED_NOT_SUPPORTED = 1616;
exports.WARN_NO_MASTER_INFO = 1617;
exports.WARN_NO_SOURCE_INFO = 1617;
exports.WARN_OPTION_IGNORED = 1618;
exports.WARN_PLUGIN_DELETE_BUILTIN = 1619;
exports.WARN_PLUGIN_BUSY = 1620;
exports.ER_VARIABLE_IS_READONLY = 1621;
exports.ER_WARN_ENGINE_TRANSACTION_ROLLBACK = 1622;
exports.ER_SLAVE_HEARTBEAT_FAILURE = 1623;
exports.ER_REPLICA_HEARTBEAT_FAILURE = 1623;
exports.ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE = 1624;
exports.ER_REPLICA_HEARTBEAT_VALUE_OUT_OF_RANGE = 1624;
exports.ER_NDB_REPLICATION_SCHEMA_ERROR = 1625;
exports.ER_CONFLICT_FN_PARSE_ERROR = 1626;
exports.ER_EXCEPTIONS_WRITE_ERROR = 1627;
exports.ER_TOO_LONG_TABLE_COMMENT = 1628;
exports.ER_TOO_LONG_FIELD_COMMENT = 1629;
exports.ER_FUNC_INEXISTENT_NAME_COLLISION = 1630;
exports.ER_DATABASE_NAME = 1631;
exports.ER_TABLE_NAME = 1632;
exports.ER_PARTITION_NAME = 1633;
exports.ER_SUBPARTITION_NAME = 1634;
exports.ER_TEMPORARY_NAME = 1635;
exports.ER_RENAMED_NAME = 1636;
exports.ER_TOO_MANY_CONCURRENT_TRXS = 1637;
exports.WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED = 1638;
exports.ER_DEBUG_SYNC_TIMEOUT = 1639;
exports.ER_DEBUG_SYNC_HIT_LIMIT = 1640;
exports.ER_DUP_SIGNAL_SET = 1641;
exports.ER_SIGNAL_WARN = 1642;
exports.ER_SIGNAL_NOT_FOUND = 1643;
exports.ER_SIGNAL_EXCEPTION = 1644;
exports.ER_RESIGNAL_WITHOUT_ACTIVE_HANDLER = 1645;
exports.ER_SIGNAL_BAD_CONDITION_TYPE = 1646;
exports.WARN_COND_ITEM_TRUNCATED = 1647;
exports.ER_COND_ITEM_TOO_LONG = 1648;
exports.ER_UNKNOWN_LOCALE = 1649;
exports.ER_SLAVE_IGNORE_SERVER_IDS = 1650;
exports.ER_REPLICA_IGNORE_SERVER_IDS = 1650;
exports.ER_QUERY_CACHE_DISABLED = 1651;
exports.ER_SAME_NAME_PARTITION_FIELD = 1652;
exports.ER_PARTITION_COLUMN_LIST_ERROR = 1653;
exports.ER_WRONG_TYPE_COLUMN_VALUE_ERROR = 1654;
exports.ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR = 1655;
exports.ER_MAXVALUE_IN_VALUES_IN = 1656;
exports.ER_TOO_MANY_VALUES_ERROR = 1657;
exports.ER_ROW_SINGLE_PARTITION_FIELD_ERROR = 1658;
exports.ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD = 1659;
exports.ER_PARTITION_FIELDS_TOO_LONG = 1660;
exports.ER_BINLOG_ROW_ENGINE_AND_STMT_ENGINE = 1661;
exports.ER_BINLOG_ROW_MODE_AND_STMT_ENGINE = 1662;
exports.ER_BINLOG_UNSAFE_AND_STMT_ENGINE = 1663;
exports.ER_BINLOG_ROW_INJECTION_AND_STMT_ENGINE = 1664;
exports.ER_BINLOG_STMT_MODE_AND_ROW_ENGINE = 1665;
exports.ER_BINLOG_ROW_INJECTION_AND_STMT_MODE = 1666;
exports.ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE = 1667;
exports.ER_BINLOG_UNSAFE_LIMIT = 1668;
exports.ER_BINLOG_UNSAFE_INSERT_DELAYED = 1669;
exports.ER_BINLOG_UNSAFE_SYSTEM_TABLE = 1670;
exports.ER_BINLOG_UNSAFE_AUTOINC_COLUMNS = 1671;
exports.ER_BINLOG_UNSAFE_UDF = 1672;
exports.ER_BINLOG_UNSAFE_SYSTEM_VARIABLE = 1673;
exports.ER_BINLOG_UNSAFE_SYSTEM_FUNCTION = 1674;
exports.ER_BINLOG_UNSAFE_NONTRANS_AFTER_TRANS = 1675;
exports.ER_MESSAGE_AND_STATEMENT = 1676;
exports.ER_SLAVE_CONVERSION_FAILED = 1677;
exports.ER_REPLICA_CONVERSION_FAILED = 1677;
exports.ER_SLAVE_CANT_CREATE_CONVERSION = 1678;
exports.ER_REPLICA_CANT_CREATE_CONVERSION = 1678;
exports.ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT = 1679;
exports.ER_PATH_LENGTH = 1680;
exports.ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT = 1681;
exports.ER_WRONG_NATIVE_TABLE_STRUCTURE = 1682;
exports.ER_WRONG_PERFSCHEMA_USAGE = 1683;
exports.ER_WARN_I_S_SKIPPED_TABLE = 1684;
exports.ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT = 1685;
exports.ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_DIRECT = 1686;
exports.ER_SPATIAL_MUST_HAVE_GEOM_COL = 1687;
exports.ER_TOO_LONG_INDEX_COMMENT = 1688;
exports.ER_LOCK_ABORTED = 1689;
exports.ER_DATA_OUT_OF_RANGE = 1690;
exports.ER_WRONG_SPVAR_TYPE_IN_LIMIT = 1691;
exports.ER_BINLOG_UNSAFE_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE = 1692;
exports.ER_BINLOG_UNSAFE_MIXED_STATEMENT = 1693;
exports.ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SQL_LOG_BIN = 1694;
exports.ER_STORED_FUNCTION_PREVENTS_SWITCH_SQL_LOG_BIN = 1695;
exports.ER_FAILED_READ_FROM_PAR_FILE = 1696;
exports.ER_VALUES_IS_NOT_INT_TYPE_ERROR = 1697;
exports.ER_ACCESS_DENIED_NO_PASSWORD_ERROR = 1698;
exports.ER_SET_PASSWORD_AUTH_PLUGIN = 1699;
exports.ER_GRANT_PLUGIN_USER_EXISTS = 1700;
exports.ER_TRUNCATE_ILLEGAL_FK = 1701;
exports.ER_PLUGIN_IS_PERMANENT = 1702;
exports.ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MIN = 1703;
exports.ER_REPLICA_HEARTBEAT_VALUE_OUT_OF_RANGE_MIN = 1703;
exports.ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX = 1704;
exports.ER_REPLICA_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX = 1704;
exports.ER_STMT_CACHE_FULL = 1705;
exports.ER_MULTI_UPDATE_KEY_CONFLICT = 1706;
exports.ER_TABLE_NEEDS_REBUILD = 1707;
exports.WARN_OPTION_BELOW_LIMIT = 1708;
exports.ER_INDEX_COLUMN_TOO_LONG = 1709;
exports.ER_ERROR_IN_TRIGGER_BODY = 1710;
exports.ER_ERROR_IN_UNKNOWN_TRIGGER_BODY = 1711;
exports.ER_INDEX_CORRUPT = 1712;
exports.ER_UNDO_RECORD_TOO_BIG = 1713;
exports.ER_BINLOG_UNSAFE_INSERT_IGNORE_SELECT = 1714;
exports.ER_BINLOG_UNSAFE_INSERT_SELECT_UPDATE = 1715;
exports.ER_BINLOG_UNSAFE_REPLACE_SELECT = 1716;
exports.ER_BINLOG_UNSAFE_CREATE_IGNORE_SELECT = 1717;
exports.ER_BINLOG_UNSAFE_CREATE_REPLACE_SELECT = 1718;
exports.ER_BINLOG_UNSAFE_UPDATE_IGNORE = 1719;
exports.ER_PLUGIN_NO_UNINSTALL = 1720;
exports.ER_PLUGIN_NO_INSTALL = 1721;
exports.ER_BINLOG_UNSAFE_WRITE_AUTOINC_SELECT = 1722;
exports.ER_BINLOG_UNSAFE_CREATE_SELECT_AUTOINC = 1723;
exports.ER_BINLOG_UNSAFE_INSERT_TWO_KEYS = 1724;
exports.ER_TABLE_IN_FK_CHECK = 1725;
exports.ER_UNSUPPORTED_ENGINE = 1726;
exports.ER_BINLOG_UNSAFE_AUTOINC_NOT_FIRST = 1727;
exports.ER_CANNOT_LOAD_FROM_TABLE_V2 = 1728;
exports.ER_MASTER_DELAY_VALUE_OUT_OF_RANGE = 1729;
exports.ER_SOURCE_DELAY_VALUE_OUT_OF_RANGE = 1729;
exports.ER_ONLY_FD_AND_RBR_EVENTS_ALLOWED_IN_BINLOG_STATEMENT = 1730;
exports.ER_PARTITION_EXCHANGE_DIFFERENT_OPTION = 1731;
exports.ER_PARTITION_EXCHANGE_PART_TABLE = 1732;
exports.ER_PARTITION_EXCHANGE_TEMP_TABLE = 1733;
exports.ER_PARTITION_INSTEAD_OF_SUBPARTITION = 1734;
exports.ER_UNKNOWN_PARTITION = 1735;
exports.ER_TABLES_DIFFERENT_METADATA = 1736;
exports.ER_ROW_DOES_NOT_MATCH_PARTITION = 1737;
exports.ER_BINLOG_CACHE_SIZE_GREATER_THAN_MAX = 1738;
exports.ER_WARN_INDEX_NOT_APPLICABLE = 1739;
exports.ER_PARTITION_EXCHANGE_FOREIGN_KEY = 1740;
exports.ER_NO_SUCH_KEY_VALUE = 1741;
exports.ER_RPL_INFO_DATA_TOO_LONG = 1742;
exports.ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE = 1743;
exports.ER_BINLOG_READ_EVENT_CHECKSUM_FAILURE = 1744;
exports.ER_BINLOG_STMT_CACHE_SIZE_GREATER_THAN_MAX = 1745;
exports.ER_CANT_UPDATE_TABLE_IN_CREATE_TABLE_SELECT = 1746;
exports.ER_PARTITION_CLAUSE_ON_NONPARTITIONED = 1747;
exports.ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET = 1748;
exports.ER_NO_SUCH_PARTITION = 1749;
exports.ER_CHANGE_RPL_INFO_REPOSITORY_FAILURE = 1750;
exports.ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_CREATED_TEMP_TABLE = 1751;
exports.ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_DROPPED_TEMP_TABLE = 1752;
exports.ER_MTS_FEATURE_IS_NOT_SUPPORTED = 1753;
exports.ER_MTS_UPDATED_DBS_GREATER_MAX = 1754;
exports.ER_MTS_CANT_PARALLEL = 1755;
exports.ER_MTS_INCONSISTENT_DATA = 1756;
exports.ER_FULLTEXT_NOT_SUPPORTED_WITH_PARTITIONING = 1757;
exports.ER_DA_INVALID_CONDITION_NUMBER = 1758;
exports.ER_INSECURE_PLAIN_TEXT = 1759;
exports.ER_INSECURE_CHANGE_MASTER = 1760;
exports.ER_INSECURE_CHANGE_SOURCE = 1760;
exports.ER_FOREIGN_DUPLICATE_KEY_WITH_CHILD_INFO = 1761;
exports.ER_FOREIGN_DUPLICATE_KEY_WITHOUT_CHILD_INFO = 1762;
exports.ER_SQLTHREAD_WITH_SECURE_SLAVE = 1763;
exports.ER_SQLTHREAD_WITH_SECURE_REPLICA = 1763;
exports.ER_TABLE_HAS_NO_FT = 1764;
exports.ER_VARIABLE_NOT_SETTABLE_IN_SF_OR_TRIGGER = 1765;
exports.ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION = 1766;
exports.ER_GTID_NEXT_IS_NOT_IN_GTID_NEXT_LIST = 1767;
exports.ER_CANT_CHANGE_GTID_NEXT_IN_TRANSACTION_WHEN_GTID_NEXT_LIST_IS_NULL = 1768;
exports.ER_SET_STATEMENT_CANNOT_INVOKE_FUNCTION = 1769;
exports.ER_GTID_NEXT_CANT_BE_AUTOMATIC_IF_GTID_NEXT_LIST_IS_NON_NULL = 1770;
exports.ER_SKIPPING_LOGGED_TRANSACTION = 1771;
exports.ER_MALFORMED_GTID_SET_SPECIFICATION = 1772;
exports.ER_MALFORMED_GTID_SET_ENCODING = 1773;
exports.ER_MALFORMED_GTID_SPECIFICATION = 1774;
exports.ER_GNO_EXHAUSTED = 1775;
exports.ER_BAD_SLAVE_AUTO_POSITION = 1776;
exports.ER_BAD_REPLICA_AUTO_POSITION = 1776;
exports.ER_AUTO_POSITION_REQUIRES_GTID_MODE_ON = 1777;
exports.ER_CANT_DO_IMPLICIT_COMMIT_IN_TRX_WHEN_GTID_NEXT_IS_SET = 1778;
exports.ER_GTID_MODE_2_OR_3_REQUIRES_ENFORCE_GTID_CONSISTENCY_ON = 1779;
exports.ER_GTID_MODE_REQUIRES_BINLOG = 1780;
exports.ER_CANT_SET_GTID_NEXT_TO_GTID_WHEN_GTID_MODE_IS_OFF = 1781;
exports.ER_CANT_SET_GTID_NEXT_TO_ANONYMOUS_WHEN_GTID_MODE_IS_ON = 1782;
exports.ER_CANT_SET_GTID_NEXT_LIST_TO_NON_NULL_WHEN_GTID_MODE_IS_OFF = 1783;
exports.ER_FOUND_GTID_EVENT_WHEN_GTID_MODE_IS_OFF = 1784;
exports.ER_GTID_UNSAFE_NON_TRANSACTIONAL_TABLE = 1785;
exports.ER_GTID_UNSAFE_CREATE_SELECT = 1786;
exports.ER_GTID_UNSAFE_CREATE_DROP_TEMPORARY_TABLE_IN_TRANSACTION = 1787;
exports.ER_GTID_MODE_CAN_ONLY_CHANGE_ONE_STEP_AT_A_TIME = 1788;
exports.ER_MASTER_HAS_PURGED_REQUIRED_GTIDS = 1789;
exports.ER_SOURCE_HAS_PURGED_REQUIRED_GTIDS = 1789;
exports.ER_CANT_SET_GTID_NEXT_WHEN_OWNING_GTID = 1790;
exports.ER_UNKNOWN_EXPLAIN_FORMAT = 1791;
exports.ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION = 1792;
exports.ER_TOO_LONG_TABLE_PARTITION_COMMENT = 1793;
exports.ER_SLAVE_CONFIGURATION = 1794;
exports.ER_REPLICA_CONFIGURATION = 1794;
exports.ER_INNODB_FT_LIMIT = 1795;
exports.ER_INNODB_NO_FT_TEMP_TABLE = 1796;
exports.ER_INNODB_FT_WRONG_DOCID_COLUMN = 1797;
exports.ER_INNODB_FT_WRONG_DOCID_INDEX = 1798;
exports.ER_INNODB_ONLINE_LOG_TOO_BIG = 1799;
exports.ER_UNKNOWN_ALTER_ALGORITHM = 1800;
exports.ER_UNKNOWN_ALTER_LOCK = 1801;
exports.ER_MTS_CHANGE_MASTER_CANT_RUN_WITH_GAPS = 1802;
exports.ER_MTS_CHANGE_SOURCE_CANT_RUN_WITH_GAPS = 1802;
exports.ER_MTS_RECOVERY_FAILURE = 1803;
exports.ER_MTS_RESET_WORKERS = 1804;
exports.ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2 = 1805;
exports.ER_SLAVE_SILENT_RETRY_TRANSACTION = 1806;
exports.ER_REPLICA_SILENT_RETRY_TRANSACTION = 1806;
exports.ER_DISCARD_FK_CHECKS_RUNNING = 1807;
exports.ER_TABLE_SCHEMA_MISMATCH = 1808;
exports.ER_TABLE_IN_SYSTEM_TABLESPACE = 1809;
exports.ER_IO_READ_ERROR = 1810;
exports.ER_IO_WRITE_ERROR = 1811;
exports.ER_TABLESPACE_MISSING = 1812;
exports.ER_TABLESPACE_EXISTS = 1813;
exports.ER_TABLESPACE_DISCARDED = 1814;
exports.ER_INTERNAL_ERROR = 1815;
exports.ER_INNODB_IMPORT_ERROR = 1816;
exports.ER_INNODB_INDEX_CORRUPT = 1817;
exports.ER_INVALID_YEAR_COLUMN_LENGTH = 1818;
exports.ER_NOT_VALID_PASSWORD = 1819;
exports.ER_MUST_CHANGE_PASSWORD = 1820;
exports.ER_FK_NO_INDEX_CHILD = 1821;
exports.ER_FK_NO_INDEX_PARENT = 1822;
exports.ER_FK_FAIL_ADD_SYSTEM = 1823;
exports.ER_FK_CANNOT_OPEN_PARENT = 1824;
exports.ER_FK_INCORRECT_OPTION = 1825;
exports.ER_FK_DUP_NAME = 1826;
exports.ER_PASSWORD_FORMAT = 1827;
exports.ER_FK_COLUMN_CANNOT_DROP = 1828;
exports.ER_FK_COLUMN_CANNOT_DROP_CHILD = 1829;
exports.ER_FK_COLUMN_NOT_NULL = 1830;
exports.ER_DUP_INDEX = 1831;
exports.ER_FK_COLUMN_CANNOT_CHANGE = 1832;
exports.ER_FK_COLUMN_CANNOT_CHANGE_CHILD = 1833;
exports.ER_FK_CANNOT_DELETE_PARENT = 1834;
exports.ER_MALFORMED_PACKET = 1835;
exports.ER_READ_ONLY_MODE = 1836;
exports.ER_GTID_NEXT_TYPE_UNDEFINED_GROUP = 1837;
exports.ER_VARIABLE_NOT_SETTABLE_IN_SP = 1838;
exports.ER_CANT_SET_GTID_PURGED_WHEN_GTID_MODE_IS_OFF = 1839;
exports.ER_CANT_SET_GTID_PURGED_WHEN_GTID_EXECUTED_IS_NOT_EMPTY = 1840;
exports.ER_CANT_SET_GTID_PURGED_WHEN_OWNED_GTIDS_IS_NOT_EMPTY = 1841;
exports.ER_GTID_PURGED_WAS_CHANGED = 1842;
exports.ER_GTID_EXECUTED_WAS_CHANGED = 1843;
exports.ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES = 1844;
exports.ER_ALTER_OPERATION_NOT_SUPPORTED = 1845;
exports.ER_ALTER_OPERATION_NOT_SUPPORTED_REASON = 1846;
exports.ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COPY = 1847;
exports.ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_PARTITION = 1848;
exports.ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_RENAME = 1849;
exports.ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COLUMN_TYPE = 1850;
exports.ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_CHECK = 1851;
exports.ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_IGNORE = 1852;
exports.ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOPK = 1853;
exports.ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_AUTOINC = 1854;
exports.ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_HIDDEN_FTS = 1855;
exports.ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_CHANGE_FTS = 1856;
exports.ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FTS = 1857;
exports.ER_SQL_SLAVE_SKIP_COUNTER_NOT_SETTABLE_IN_GTID_MODE = 1858;
exports.ER_SQL_REPLICA_SKIP_COUNTER_NOT_SETTABLE_IN_GTID_MODE = 1858;
exports.ER_DUP_UNKNOWN_IN_INDEX = 1859;
exports.ER_IDENT_CAUSES_TOO_LONG_PATH = 1860;
exports.ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOT_NULL = 1861;
exports.ER_MUST_CHANGE_PASSWORD_LOGIN = 1862;
exports.ER_ROW_IN_WRONG_PARTITION = 1863;
exports.ER_MTS_EVENT_BIGGER_PENDING_JOBS_SIZE_MAX = 1864;
exports.ER_INNODB_NO_FT_USES_PARSER = 1865;
exports.ER_BINLOG_LOGICAL_CORRUPTION = 1866;
exports.ER_WARN_PURGE_LOG_IN_USE = 1867;
exports.ER_WARN_PURGE_LOG_IS_ACTIVE = 1868;
exports.ER_AUTO_INCREMENT_CONFLICT = 1869;
exports.WARN_ON_BLOCKHOLE_IN_RBR = 1870;
exports.ER_SLAVE_MI_INIT_REPOSITORY = 1871;
exports.ER_REPLICA_MI_INIT_REPOSITORY = 1871;
exports.ER_SLAVE_RLI_INIT_REPOSITORY = 1872;
exports.ER_REPLICA_RLI_INIT_REPOSITORY = 1872;
exports.ER_ACCESS_DENIED_CHANGE_USER_ERROR = 1873;
exports.ER_INNODB_READ_ONLY = 1874;
exports.ER_STOP_SLAVE_SQL_THREAD_TIMEOUT = 1875;
exports.ER_STOP_REPLICA_SQL_THREAD_TIMEOUT = 1875;
exports.ER_STOP_SLAVE_IO_THREAD_TIMEOUT = 1876;
exports.ER_STOP_REPLICA_IO_THREAD_TIMEOUT = 1876;
exports.ER_TABLE_CORRUPT = 1877;
exports.ER_TEMP_FILE_WRITE_FAILURE = 1878;
exports.ER_INNODB_FT_AUX_NOT_HEX_ID = 1879;
exports.ER_OLD_TEMPORALS_UPGRADED = 1880;
exports.ER_INNODB_FORCED_RECOVERY = 1881;
exports.ER_AES_INVALID_IV = 1882;
exports.ER_FILE_CORRUPT = 1883;
exports.ER_ERROR_ON_SOURCE = 1884;
exports.ER_INCONSISTENT_ERROR = 1885;
exports.ER_STORAGE_ENGINE_NOT_LOADED = 1886;
exports.ER_GET_STACKED_DA_WITHOUT_ACTIVE_HANDLER = 1887;
exports.ER_WARN_LEGACY_SYNTAX_CONVERTED = 1888;
exports.ER_BINLOG_UNSAFE_FULLTEXT_PLUGIN = 1889;
exports.ER_CANNOT_DISCARD_TEMPORARY_TABLE = 1890;
exports.ER_FK_DEPTH_EXCEEDED = 1891;
exports.ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE_V2 = 1892;
exports.ER_WARN_TRIGGER_DOESNT_HAVE_CREATED = 1893;
exports.ER_REFERENCED_TRG_DOES_NOT_EXIST = 1894;
exports.ER_EXPLAIN_NOT_SUPPORTED = 1895;
exports.ER_INVALID_FIELD_SIZE = 1896;
exports.ER_MISSING_HA_CREATE_OPTION = 1897;
exports.ER_ENGINE_OUT_OF_MEMORY = 1898;
exports.ER_PASSWORD_EXPIRE_ANONYMOUS_USER = 1899;
exports.ER_REPLICA_SQL_THREAD_MUST_STOP = 1900;
exports.ER_NO_FT_MATERIALIZED_SUBQUERY = 1901;
exports.ER_INNODB_UNDO_LOG_FULL = 1902;
exports.ER_INVALID_ARGUMENT_FOR_LOGARITHM = 1903;
exports.ER_REPLICA_IO_THREAD_MUST_STOP = 1904;
exports.ER_WARN_OPEN_TEMP_TABLES_MUST_BE_ZERO = 1905;
exports.ER_WARN_ONLY_SOURCE_LOG_FILE_NO_POS = 1906;
exports.ER_QUERY_TIMEOUT = 1907;
exports.ER_NON_RO_SELECT_DISABLE_TIMER = 1908;
exports.ER_DUP_LIST_ENTRY = 1909;
exports.ER_SQL_MODE_NO_EFFECT = 1910;
exports.ER_SESSION_WAS_KILLED = 3169;
exports.ER_CLIENT_INTERACTION_TIMEOUT = 4031;
exports[1] = "EE_CANTCREATEFILE";
exports[2] = "EE_READ";
exports[3] = "EE_WRITE";
exports[4] = "EE_BADCLOSE";
exports[5] = "EE_OUTOFMEMORY";
exports[6] = "EE_DELETE";
exports[7] = "EE_LINK";
exports[9] = "EE_EOFERR";
exports[10] = "EE_CANTLOCK";
exports[11] = "EE_CANTUNLOCK";
exports[12] = "EE_DIR";
exports[13] = "EE_STAT";
exports[14] = "EE_CANT_CHSIZE";
exports[15] = "EE_CANT_OPEN_STREAM";
exports[16] = "EE_GETWD";
exports[17] = "EE_SETWD";
exports[18] = "EE_LINK_WARNING";
exports[19] = "EE_OPEN_WARNING";
exports[20] = "EE_DISK_FULL";
exports[21] = "EE_CANT_MKDIR";
exports[22] = "EE_UNKNOWN_CHARSET";
exports[23] = "EE_OUT_OF_FILERESOURCES";
exports[24] = "EE_CANT_READLINK";
exports[25] = "EE_CANT_SYMLINK";
exports[26] = "EE_REALPATH";
exports[27] = "EE_SYNC";
exports[28] = "EE_UNKNOWN_COLLATION";
exports[29] = "EE_FILENOTFOUND";
exports[30] = "EE_FILE_NOT_CLOSED";
exports[31] = "EE_CHANGE_OWNERSHIP";
exports[32] = "EE_CHANGE_PERMISSIONS";
exports[33] = "EE_CANT_SEEK";
exports[120] = "HA_ERR_KEY_NOT_FOUND";
exports[121] = "HA_ERR_FOUND_DUPP_KEY";
exports[122] = "HA_ERR_INTERNAL_ERROR";
exports[123] = "HA_ERR_RECORD_CHANGED";
exports[124] = "HA_ERR_WRONG_INDEX";
exports[126] = "HA_ERR_CRASHED";
exports[127] = "HA_ERR_WRONG_IN_RECORD";
exports[128] = "HA_ERR_OUT_OF_MEM";
exports[130] = "HA_ERR_NOT_A_TABLE";
exports[131] = "HA_ERR_WRONG_COMMAND";
exports[132] = "HA_ERR_OLD_FILE";
exports[133] = "HA_ERR_NO_ACTIVE_RECORD";
exports[134] = "HA_ERR_RECORD_DELETED";
exports[135] = "HA_ERR_RECORD_FILE_FULL";
exports[136] = "HA_ERR_INDEX_FILE_FULL";
exports[137] = "HA_ERR_END_OF_FILE";
exports[138] = "HA_ERR_UNSUPPORTED";
exports[139] = "HA_ERR_TO_BIG_ROW";
exports[140] = "HA_WRONG_CREATE_OPTION";
exports[141] = "HA_ERR_FOUND_DUPP_UNIQUE";
exports[142] = "HA_ERR_UNKNOWN_CHARSET";
exports[143] = "HA_ERR_WRONG_MRG_TABLE_DEF";
exports[144] = "HA_ERR_CRASHED_ON_REPAIR";
exports[145] = "HA_ERR_CRASHED_ON_USAGE";
exports[146] = "HA_ERR_LOCK_WAIT_TIMEOUT";
exports[147] = "HA_ERR_LOCK_TABLE_FULL";
exports[148] = "HA_ERR_READ_ONLY_TRANSACTION";
exports[149] = "HA_ERR_LOCK_DEADLOCK";
exports[150] = "HA_ERR_CANNOT_ADD_FOREIGN";
exports[151] = "HA_ERR_NO_REFERENCED_ROW";
exports[152] = "HA_ERR_ROW_IS_REFERENCED";
exports[153] = "HA_ERR_NO_SAVEPOINT";
exports[154] = "HA_ERR_NON_UNIQUE_BLOCK_SIZE";
exports[155] = "HA_ERR_NO_SUCH_TABLE";
exports[156] = "HA_ERR_TABLE_EXIST";
exports[157] = "HA_ERR_NO_CONNECTION";
exports[158] = "HA_ERR_NULL_IN_SPATIAL";
exports[159] = "HA_ERR_TABLE_DEF_CHANGED";
exports[160] = "HA_ERR_NO_PARTITION_FOUND";
exports[161] = "HA_ERR_RBR_LOGGING_FAILED";
exports[162] = "HA_ERR_DROP_INDEX_FK";
exports[163] = "HA_ERR_FOREIGN_DUPLICATE_KEY";
exports[164] = "HA_ERR_TABLE_NEEDS_UPGRADE";
exports[165] = "HA_ERR_TABLE_READONLY";
exports[166] = "HA_ERR_AUTOINC_READ_FAILED";
exports[167] = "HA_ERR_AUTOINC_ERANGE";
exports[168] = "HA_ERR_GENERIC";
exports[169] = "HA_ERR_RECORD_IS_THE_SAME";
exports[170] = "HA_ERR_LOGGING_IMPOSSIBLE";
exports[171] = "HA_ERR_CORRUPT_EVENT";
exports[172] = "HA_ERR_NEW_FILE";
exports[173] = "HA_ERR_ROWS_EVENT_APPLY";
exports[174] = "HA_ERR_INITIALIZATION";
exports[175] = "HA_ERR_FILE_TOO_SHORT";
exports[176] = "HA_ERR_WRONG_CRC";
exports[177] = "HA_ERR_TOO_MANY_CONCURRENT_TRXS";
exports[178] = "HA_ERR_NOT_IN_LOCK_PARTITIONS";
exports[179] = "HA_ERR_INDEX_COL_TOO_LONG";
exports[180] = "HA_ERR_INDEX_CORRUPT";
exports[181] = "HA_ERR_UNDO_REC_TOO_BIG";
exports[182] = "HA_FTS_INVALID_DOCID";
exports[183] = "HA_ERR_TABLE_IN_FK_CHECK";
exports[184] = "HA_ERR_TABLESPACE_EXISTS";
exports[185] = "HA_ERR_TOO_MANY_FIELDS";
exports[186] = "HA_ERR_ROW_IN_WRONG_PARTITION";
exports[187] = "HA_ERR_INNODB_READ_ONLY";
exports[188] = "HA_ERR_FTS_EXCEED_RESULT_CACHE_LIMIT";
exports[189] = "HA_ERR_TEMP_FILE_WRITE_FAILURE";
exports[190] = "HA_ERR_INNODB_FORCED_RECOVERY";
exports[191] = "HA_ERR_FTS_TOO_MANY_WORDS_IN_PHRASE";
exports[1e3] = "ER_HASHCHK";
exports[1001] = "ER_NISAMCHK";
exports[1002] = "ER_NO";
exports[1003] = "ER_YES";
exports[1004] = "ER_CANT_CREATE_FILE";
exports[1005] = "ER_CANT_CREATE_TABLE";
exports[1006] = "ER_CANT_CREATE_DB";
exports[1007] = "ER_DB_CREATE_EXISTS";
exports[1008] = "ER_DB_DROP_EXISTS";
exports[1009] = "ER_DB_DROP_DELETE";
exports[1010] = "ER_DB_DROP_RMDIR";
exports[1011] = "ER_CANT_DELETE_FILE";
exports[1012] = "ER_CANT_FIND_SYSTEM_REC";
exports[1013] = "ER_CANT_GET_STAT";
exports[1014] = "ER_CANT_GET_WD";
exports[1015] = "ER_CANT_LOCK";
exports[1016] = "ER_CANT_OPEN_FILE";
exports[1017] = "ER_FILE_NOT_FOUND";
exports[1018] = "ER_CANT_READ_DIR";
exports[1019] = "ER_CANT_SET_WD";
exports[1020] = "ER_CHECKREAD";
exports[1021] = "ER_DISK_FULL";
exports[1022] = "ER_DUP_KEY";
exports[1023] = "ER_ERROR_ON_CLOSE";
exports[1024] = "ER_ERROR_ON_READ";
exports[1025] = "ER_ERROR_ON_RENAME";
exports[1026] = "ER_ERROR_ON_WRITE";
exports[1027] = "ER_FILE_USED";
exports[1028] = "ER_FILSORT_ABORT";
exports[1029] = "ER_FORM_NOT_FOUND";
exports[1030] = "ER_GET_ERRNO";
exports[1031] = "ER_ILLEGAL_HA";
exports[1032] = "ER_KEY_NOT_FOUND";
exports[1033] = "ER_NOT_FORM_FILE";
exports[1034] = "ER_NOT_KEYFILE";
exports[1035] = "ER_OLD_KEYFILE";
exports[1036] = "ER_OPEN_AS_READONLY";
exports[1037] = "ER_OUTOFMEMORY";
exports[1038] = "ER_OUT_OF_SORTMEMORY";
exports[1039] = "ER_UNEXPECTED_EOF";
exports[1040] = "ER_CON_COUNT_ERROR";
exports[1041] = "ER_OUT_OF_RESOURCES";
exports[1042] = "ER_BAD_HOST_ERROR";
exports[1043] = "ER_HANDSHAKE_ERROR";
exports[1044] = "ER_DBACCESS_DENIED_ERROR";
exports[1045] = "ER_ACCESS_DENIED_ERROR";
exports[1046] = "ER_NO_DB_ERROR";
exports[1047] = "ER_UNKNOWN_COM_ERROR";
exports[1048] = "ER_BAD_NULL_ERROR";
exports[1049] = "ER_BAD_DB_ERROR";
exports[1050] = "ER_TABLE_EXISTS_ERROR";
exports[1051] = "ER_BAD_TABLE_ERROR";
exports[1052] = "ER_NON_UNIQ_ERROR";
exports[1053] = "ER_SERVER_SHUTDOWN";
exports[1054] = "ER_BAD_FIELD_ERROR";
exports[1055] = "ER_WRONG_FIELD_WITH_GROUP";
exports[1056] = "ER_WRONG_GROUP_FIELD";
exports[1057] = "ER_WRONG_SUM_SELECT";
exports[1058] = "ER_WRONG_VALUE_COUNT";
exports[1059] = "ER_TOO_LONG_IDENT";
exports[1060] = "ER_DUP_FIELDNAME";
exports[1061] = "ER_DUP_KEYNAME";
exports[1062] = "ER_DUP_ENTRY";
exports[1063] = "ER_WRONG_FIELD_SPEC";
exports[1064] = "ER_PARSE_ERROR";
exports[1065] = "ER_EMPTY_QUERY";
exports[1066] = "ER_NONUNIQ_TABLE";
exports[1067] = "ER_INVALID_DEFAULT";
exports[1068] = "ER_MULTIPLE_PRI_KEY";
exports[1069] = "ER_TOO_MANY_KEYS";
exports[1070] = "ER_TOO_MANY_KEY_PARTS";
exports[1071] = "ER_TOO_LONG_KEY";
exports[1072] = "ER_KEY_COLUMN_DOES_NOT_EXITS";
exports[1073] = "ER_BLOB_USED_AS_KEY";
exports[1074] = "ER_TOO_BIG_FIELDLENGTH";
exports[1075] = "ER_WRONG_AUTO_KEY";
exports[1076] = "ER_READY";
exports[1077] = "ER_NORMAL_SHUTDOWN";
exports[1078] = "ER_GOT_SIGNAL";
exports[1079] = "ER_SHUTDOWN_COMPLETE";
exports[1080] = "ER_FORCING_CLOSE";
exports[1081] = "ER_IPSOCK_ERROR";
exports[1082] = "ER_NO_SUCH_INDEX";
exports[1083] = "ER_WRONG_FIELD_TERMINATORS";
exports[1084] = "ER_BLOBS_AND_NO_TERMINATED";
exports[1085] = "ER_TEXTFILE_NOT_READABLE";
exports[1086] = "ER_FILE_EXISTS_ERROR";
exports[1087] = "ER_LOAD_INFO";
exports[1088] = "ER_ALTER_INFO";
exports[1089] = "ER_WRONG_SUB_KEY";
exports[1090] = "ER_CANT_REMOVE_ALL_FIELDS";
exports[1091] = "ER_CANT_DROP_FIELD_OR_KEY";
exports[1092] = "ER_INSERT_INFO";
exports[1093] = "ER_UPDATE_TABLE_USED";
exports[1094] = "ER_NO_SUCH_THREAD";
exports[1095] = "ER_KILL_DENIED_ERROR";
exports[1096] = "ER_NO_TABLES_USED";
exports[1097] = "ER_TOO_BIG_SET";
exports[1098] = "ER_NO_UNIQUE_LOGFILE";
exports[1099] = "ER_TABLE_NOT_LOCKED_FOR_WRITE";
exports[1100] = "ER_TABLE_NOT_LOCKED";
exports[1101] = "ER_BLOB_CANT_HAVE_DEFAULT";
exports[1102] = "ER_WRONG_DB_NAME";
exports[1103] = "ER_WRONG_TABLE_NAME";
exports[1104] = "ER_TOO_BIG_SELECT";
exports[1105] = "ER_UNKNOWN_ERROR";
exports[1106] = "ER_UNKNOWN_PROCEDURE";
exports[1107] = "ER_WRONG_PARAMCOUNT_TO_PROCEDURE";
exports[1108] = "ER_WRONG_PARAMETERS_TO_PROCEDURE";
exports[1109] = "ER_UNKNOWN_TABLE";
exports[1110] = "ER_FIELD_SPECIFIED_TWICE";
exports[1111] = "ER_INVALID_GROUP_FUNC_USE";
exports[1112] = "ER_UNSUPPORTED_EXTENSION";
exports[1113] = "ER_TABLE_MUST_HAVE_COLUMNS";
exports[1114] = "ER_RECORD_FILE_FULL";
exports[1115] = "ER_UNKNOWN_CHARACTER_SET";
exports[1116] = "ER_TOO_MANY_TABLES";
exports[1117] = "ER_TOO_MANY_FIELDS";
exports[1118] = "ER_TOO_BIG_ROWSIZE";
exports[1119] = "ER_STACK_OVERRUN";
exports[1120] = "ER_WRONG_OUTER_JOIN";
exports[1121] = "ER_NULL_COLUMN_IN_INDEX";
exports[1122] = "ER_CANT_FIND_UDF";
exports[1123] = "ER_CANT_INITIALIZE_UDF";
exports[1124] = "ER_UDF_NO_PATHS";
exports[1125] = "ER_UDF_EXISTS";
exports[1126] = "ER_CANT_OPEN_LIBRARY";
exports[1127] = "ER_CANT_FIND_DL_ENTRY";
exports[1128] = "ER_FUNCTION_NOT_DEFINED";
exports[1129] = "ER_HOST_IS_BLOCKED";
exports[1130] = "ER_HOST_NOT_PRIVILEGED";
exports[1131] = "ER_PASSWORD_ANONYMOUS_USER";
exports[1132] = "ER_PASSWORD_NOT_ALLOWED";
exports[1133] = "ER_PASSWORD_NO_MATCH";
exports[1134] = "ER_UPDATE_INFO";
exports[1135] = "ER_CANT_CREATE_THREAD";
exports[1136] = "ER_WRONG_VALUE_COUNT_ON_ROW";
exports[1137] = "ER_CANT_REOPEN_TABLE";
exports[1138] = "ER_INVALID_USE_OF_NULL";
exports[1139] = "ER_REGEXP_ERROR";
exports[1140] = "ER_MIX_OF_GROUP_FUNC_AND_FIELDS";
exports[1141] = "ER_NONEXISTING_GRANT";
exports[1142] = "ER_TABLEACCESS_DENIED_ERROR";
exports[1143] = "ER_COLUMNACCESS_DENIED_ERROR";
exports[1144] = "ER_ILLEGAL_GRANT_FOR_TABLE";
exports[1145] = "ER_GRANT_WRONG_HOST_OR_USER";
exports[1146] = "ER_NO_SUCH_TABLE";
exports[1147] = "ER_NONEXISTING_TABLE_GRANT";
exports[1148] = "ER_NOT_ALLOWED_COMMAND";
exports[1149] = "ER_SYNTAX_ERROR";
exports[1150] = "ER_DELAYED_CANT_CHANGE_LOCK";
exports[1151] = "ER_TOO_MANY_DELAYED_THREADS";
exports[1152] = "ER_ABORTING_CONNECTION";
exports[1153] = "ER_NET_PACKET_TOO_LARGE";
exports[1154] = "ER_NET_READ_ERROR_FROM_PIPE";
exports[1155] = "ER_NET_FCNTL_ERROR";
exports[1156] = "ER_NET_PACKETS_OUT_OF_ORDER";
exports[1157] = "ER_NET_UNCOMPRESS_ERROR";
exports[1158] = "ER_NET_READ_ERROR";
exports[1159] = "ER_NET_READ_INTERRUPTED";
exports[1160] = "ER_NET_ERROR_ON_WRITE";
exports[1161] = "ER_NET_WRITE_INTERRUPTED";
exports[1162] = "ER_TOO_LONG_STRING";
exports[1163] = "ER_TABLE_CANT_HANDLE_BLOB";
exports[1164] = "ER_TABLE_CANT_HANDLE_AUTO_INCREMENT";
exports[1165] = "ER_DELAYED_INSERT_TABLE_LOCKED";
exports[1166] = "ER_WRONG_COLUMN_NAME";
exports[1167] = "ER_WRONG_KEY_COLUMN";
exports[1168] = "ER_WRONG_MRG_TABLE";
exports[1169] = "ER_DUP_UNIQUE";
exports[1170] = "ER_BLOB_KEY_WITHOUT_LENGTH";
exports[1171] = "ER_PRIMARY_CANT_HAVE_NULL";
exports[1172] = "ER_TOO_MANY_ROWS";
exports[1173] = "ER_REQUIRES_PRIMARY_KEY";
exports[1174] = "ER_NO_RAID_COMPILED";
exports[1175] = "ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE";
exports[1176] = "ER_KEY_DOES_NOT_EXITS";
exports[1177] = "ER_CHECK_NO_SUCH_TABLE";
exports[1178] = "ER_CHECK_NOT_IMPLEMENTED";
exports[1179] = "ER_CANT_DO_THIS_DURING_AN_TRANSACTION";
exports[1180] = "ER_ERROR_DURING_COMMIT";
exports[1181] = "ER_ERROR_DURING_ROLLBACK";
exports[1182] = "ER_ERROR_DURING_FLUSH_LOGS";
exports[1183] = "ER_ERROR_DURING_CHECKPOINT";
exports[1184] = "ER_NEW_ABORTING_CONNECTION";
exports[1185] = "ER_DUMP_NOT_IMPLEMENTED";
exports[1186] = "ER_FLUSH_SOURCE_BINLOG_CLOSED";
exports[1187] = "ER_INDEX_REBUILD";
exports[1188] = "ER_SOURCE";
exports[1189] = "ER_SOURCE_NET_READ";
exports[1190] = "ER_SOURCE_NET_WRITE";
exports[1191] = "ER_FT_MATCHING_KEY_NOT_FOUND";
exports[1192] = "ER_LOCK_OR_ACTIVE_TRANSACTION";
exports[1193] = "ER_UNKNOWN_SYSTEM_VARIABLE";
exports[1194] = "ER_CRASHED_ON_USAGE";
exports[1195] = "ER_CRASHED_ON_REPAIR";
exports[1196] = "ER_WARNING_NOT_COMPLETE_ROLLBACK";
exports[1197] = "ER_TRANS_CACHE_FULL";
exports[1198] = "ER_REPLICA_MUST_STOP";
exports[1199] = "ER_REPLICA_NOT_RUNNING";
exports[1200] = "ER_BAD_REPLICA";
exports[1201] = "ER_SOURCE_INFO";
exports[1202] = "ER_REPLICA_THREAD";
exports[1203] = "ER_TOO_MANY_USER_CONNECTIONS";
exports[1204] = "ER_SET_CONSTANTS_ONLY";
exports[1205] = "ER_LOCK_WAIT_TIMEOUT";
exports[1206] = "ER_LOCK_TABLE_FULL";
exports[1207] = "ER_READ_ONLY_TRANSACTION";
exports[1208] = "ER_DROP_DB_WITH_READ_LOCK";
exports[1209] = "ER_CREATE_DB_WITH_READ_LOCK";
exports[1210] = "ER_WRONG_ARGUMENTS";
exports[1211] = "ER_NO_PERMISSION_TO_CREATE_USER";
exports[1212] = "ER_UNION_TABLES_IN_DIFFERENT_DIR";
exports[1213] = "ER_LOCK_DEADLOCK";
exports[1214] = "ER_TABLE_CANT_HANDLE_FT";
exports[1215] = "ER_CANNOT_ADD_FOREIGN";
exports[1216] = "ER_NO_REFERENCED_ROW";
exports[1217] = "ER_ROW_IS_REFERENCED";
exports[1218] = "ER_CONNECT_TO_SOURCE";
exports[1219] = "ER_QUERY_ON_SOURCE";
exports[1220] = "ER_ERROR_WHEN_EXECUTING_COMMAND";
exports[1221] = "ER_WRONG_USAGE";
exports[1222] = "ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT";
exports[1223] = "ER_CANT_UPDATE_WITH_READLOCK";
exports[1224] = "ER_MIXING_NOT_ALLOWED";
exports[1225] = "ER_DUP_ARGUMENT";
exports[1226] = "ER_USER_LIMIT_REACHED";
exports[1227] = "ER_SPECIFIC_ACCESS_DENIED_ERROR";
exports[1228] = "ER_LOCAL_VARIABLE";
exports[1229] = "ER_GLOBAL_VARIABLE";
exports[1230] = "ER_NO_DEFAULT";
exports[1231] = "ER_WRONG_VALUE_FOR_VAR";
exports[1232] = "ER_WRONG_TYPE_FOR_VAR";
exports[1233] = "ER_VAR_CANT_BE_READ";
exports[1234] = "ER_CANT_USE_OPTION_HERE";
exports[1235] = "ER_NOT_SUPPORTED_YET";
exports[1236] = "ER_SOURCE_FATAL_ERROR_READING_BINLOG";
exports[1237] = "ER_REPLICA_IGNORED_TABLE";
exports[1238] = "ER_INCORRECT_GLOBAL_LOCAL_VAR";
exports[1239] = "ER_WRONG_FK_DEF";
exports[1240] = "ER_KEY_REF_DO_NOT_MATCH_TABLE_REF";
exports[1241] = "ER_OPERAND_COLUMNS";
exports[1242] = "ER_SUBQUERY_NO_1_ROW";
exports[1243] = "ER_UNKNOWN_STMT_HANDLER";
exports[1244] = "ER_CORRUPT_HELP_DB";
exports[1245] = "ER_CYCLIC_REFERENCE";
exports[1246] = "ER_AUTO_CONVERT";
exports[1247] = "ER_ILLEGAL_REFERENCE";
exports[1248] = "ER_DERIVED_MUST_HAVE_ALIAS";
exports[1249] = "ER_SELECT_REDUCED";
exports[1250] = "ER_TABLENAME_NOT_ALLOWED_HERE";
exports[1251] = "ER_NOT_SUPPORTED_AUTH_MODE";
exports[1252] = "ER_SPATIAL_CANT_HAVE_NULL";
exports[1253] = "ER_COLLATION_CHARSET_MISMATCH";
exports[1254] = "ER_REPLICA_WAS_RUNNING";
exports[1255] = "ER_REPLICA_WAS_NOT_RUNNING";
exports[1256] = "ER_TOO_BIG_FOR_UNCOMPRESS";
exports[1257] = "ER_ZLIB_Z_MEM_ERROR";
exports[1258] = "ER_ZLIB_Z_BUF_ERROR";
exports[1259] = "ER_ZLIB_Z_DATA_ERROR";
exports[1260] = "ER_CUT_VALUE_GROUP_CONCAT";
exports[1261] = "ER_WARN_TOO_FEW_RECORDS";
exports[1262] = "ER_WARN_TOO_MANY_RECORDS";
exports[1263] = "ER_WARN_NULL_TO_NOTNULL";
exports[1264] = "ER_WARN_DATA_OUT_OF_RANGE";
exports[1265] = "ER_WARN_DATA_TRUNCATED";
exports[1266] = "ER_WARN_USING_OTHER_HANDLER";
exports[1267] = "ER_CANT_AGGREGATE_2COLLATIONS";
exports[1268] = "ER_DROP_USER";
exports[1269] = "ER_REVOKE_GRANTS";
exports[1270] = "ER_CANT_AGGREGATE_3COLLATIONS";
exports[1271] = "ER_CANT_AGGREGATE_NCOLLATIONS";
exports[1272] = "ER_VARIABLE_IS_NOT_STRUCT";
exports[1273] = "ER_UNKNOWN_COLLATION";
exports[1274] = "ER_REPLICA_IGNORED_SSL_PARAMS";
exports[1275] = "ER_SERVER_IS_IN_SECURE_AUTH_MODE";
exports[1276] = "ER_WARN_FIELD_RESOLVED";
exports[1277] = "ER_BAD_REPLICA_UNTIL_COND";
exports[1278] = "ER_MISSING_SKIP_REPLICA";
exports[1279] = "ER_UNTIL_COND_IGNORED";
exports[1280] = "ER_WRONG_NAME_FOR_INDEX";
exports[1281] = "ER_WRONG_NAME_FOR_CATALOG";
exports[1282] = "ER_WARN_QC_RESIZE";
exports[1283] = "ER_BAD_FT_COLUMN";
exports[1284] = "ER_UNKNOWN_KEY_CACHE";
exports[1285] = "ER_WARN_HOSTNAME_WONT_WORK";
exports[1286] = "ER_UNKNOWN_STORAGE_ENGINE";
exports[1287] = "ER_WARN_DEPRECATED_SYNTAX";
exports[1288] = "ER_NON_UPDATABLE_TABLE";
exports[1289] = "ER_FEATURE_DISABLED";
exports[1290] = "ER_OPTION_PREVENTS_STATEMENT";
exports[1291] = "ER_DUPLICATED_VALUE_IN_TYPE";
exports[1292] = "ER_TRUNCATED_WRONG_VALUE";
exports[1293] = "ER_TOO_MUCH_AUTO_TIMESTAMP_COLS";
exports[1294] = "ER_INVALID_ON_UPDATE";
exports[1295] = "ER_UNSUPPORTED_PS";
exports[1296] = "ER_GET_ERRMSG";
exports[1297] = "ER_GET_TEMPORARY_ERRMSG";
exports[1298] = "ER_UNKNOWN_TIME_ZONE";
exports[1299] = "ER_WARN_INVALID_TIMESTAMP";
exports[1300] = "ER_INVALID_CHARACTER_STRING";
exports[1301] = "ER_WARN_ALLOWED_PACKET_OVERFLOWED";
exports[1302] = "ER_CONFLICTING_DECLARATIONS";
exports[1303] = "ER_SP_NO_RECURSIVE_CREATE";
exports[1304] = "ER_SP_ALREADY_EXISTS";
exports[1305] = "ER_SP_DOES_NOT_EXIST";
exports[1306] = "ER_SP_DROP_FAILED";
exports[1307] = "ER_SP_STORE_FAILED";
exports[1308] = "ER_SP_LILABEL_MISMATCH";
exports[1309] = "ER_SP_LABEL_REDEFINE";
exports[1310] = "ER_SP_LABEL_MISMATCH";
exports[1311] = "ER_SP_UNINIT_VAR";
exports[1312] = "ER_SP_BADSELECT";
exports[1313] = "ER_SP_BADRETURN";
exports[1314] = "ER_SP_BADSTATEMENT";
exports[1315] = "ER_UPDATE_LOG_DEPRECATED_IGNORED";
exports[1316] = "ER_UPDATE_LOG_DEPRECATED_TRANSLATED";
exports[1317] = "ER_QUERY_INTERRUPTED";
exports[1318] = "ER_SP_WRONG_NO_OF_ARGS";
exports[1319] = "ER_SP_COND_MISMATCH";
exports[1320] = "ER_SP_NORETURN";
exports[1321] = "ER_SP_NORETURNEND";
exports[1322] = "ER_SP_BAD_CURSOR_QUERY";
exports[1323] = "ER_SP_BAD_CURSOR_SELECT";
exports[1324] = "ER_SP_CURSOR_MISMATCH";
exports[1325] = "ER_SP_CURSOR_ALREADY_OPEN";
exports[1326] = "ER_SP_CURSOR_NOT_OPEN";
exports[1327] = "ER_SP_UNDECLARED_VAR";
exports[1328] = "ER_SP_WRONG_NO_OF_FETCH_ARGS";
exports[1329] = "ER_SP_FETCH_NO_DATA";
exports[1330] = "ER_SP_DUP_PARAM";
exports[1331] = "ER_SP_DUP_VAR";
exports[1332] = "ER_SP_DUP_COND";
exports[1333] = "ER_SP_DUP_CURS";
exports[1334] = "ER_SP_CANT_ALTER";
exports[1335] = "ER_SP_SUBSELECT_NYI";
exports[1336] = "ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG";
exports[1337] = "ER_SP_VARCOND_AFTER_CURSHNDLR";
exports[1338] = "ER_SP_CURSOR_AFTER_HANDLER";
exports[1339] = "ER_SP_CASE_NOT_FOUND";
exports[1340] = "ER_FPARSER_TOO_BIG_FILE";
exports[1341] = "ER_FPARSER_BAD_HEADER";
exports[1342] = "ER_FPARSER_EOF_IN_COMMENT";
exports[1343] = "ER_FPARSER_ERROR_IN_PARAMETER";
exports[1344] = "ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER";
exports[1345] = "ER_VIEW_NO_EXPLAIN";
exports[1346] = "ER_FRM_UNKNOWN_TYPE";
exports[1347] = "ER_WRONG_OBJECT";
exports[1348] = "ER_NONUPDATEABLE_COLUMN";
exports[1349] = "ER_VIEW_SELECT_DERIVED";
exports[1350] = "ER_VIEW_SELECT_CLAUSE";
exports[1351] = "ER_VIEW_SELECT_VARIABLE";
exports[1352] = "ER_VIEW_SELECT_TMPTABLE";
exports[1353] = "ER_VIEW_WRONG_LIST";
exports[1354] = "ER_WARN_VIEW_MERGE";
exports[1355] = "ER_WARN_VIEW_WITHOUT_KEY";
exports[1356] = "ER_VIEW_INVALID";
exports[1357] = "ER_SP_NO_DROP_SP";
exports[1358] = "ER_SP_GOTO_IN_HNDLR";
exports[1359] = "ER_TRG_ALREADY_EXISTS";
exports[1360] = "ER_TRG_DOES_NOT_EXIST";
exports[1361] = "ER_TRG_ON_VIEW_OR_TEMP_TABLE";
exports[1362] = "ER_TRG_CANT_CHANGE_ROW";
exports[1363] = "ER_TRG_NO_SUCH_ROW_IN_TRG";
exports[1364] = "ER_NO_DEFAULT_FOR_FIELD";
exports[1365] = "ER_DIVISION_BY_ZERO";
exports[1366] = "ER_TRUNCATED_WRONG_VALUE_FOR_FIELD";
exports[1367] = "ER_ILLEGAL_VALUE_FOR_TYPE";
exports[1368] = "ER_VIEW_NONUPD_CHECK";
exports[1369] = "ER_VIEW_CHECK_FAILED";
exports[1370] = "ER_PROCACCESS_DENIED_ERROR";
exports[1371] = "ER_RELAY_LOG_FAIL";
exports[1372] = "ER_PASSWD_LENGTH";
exports[1373] = "ER_UNKNOWN_TARGET_BINLOG";
exports[1374] = "ER_IO_ERR_LOG_INDEX_READ";
exports[1375] = "ER_BINLOG_PURGE_PROHIBITED";
exports[1376] = "ER_FSEEK_FAIL";
exports[1377] = "ER_BINLOG_PURGE_FATAL_ERR";
exports[1378] = "ER_LOG_IN_USE";
exports[1379] = "ER_LOG_PURGE_UNKNOWN_ERR";
exports[1380] = "ER_RELAY_LOG_INIT";
exports[1381] = "ER_NO_BINARY_LOGGING";
exports[1382] = "ER_RESERVED_SYNTAX";
exports[1383] = "ER_WSAS_FAILED";
exports[1384] = "ER_DIFF_GROUPS_PROC";
exports[1385] = "ER_NO_GROUP_FOR_PROC";
exports[1386] = "ER_ORDER_WITH_PROC";
exports[1387] = "ER_LOGGING_PROHIBIT_CHANGING_OF";
exports[1388] = "ER_NO_FILE_MAPPING";
exports[1389] = "ER_WRONG_MAGIC";
exports[1390] = "ER_PS_MANY_PARAM";
exports[1391] = "ER_KEY_PART_0";
exports[1392] = "ER_VIEW_CHECKSUM";
exports[1393] = "ER_VIEW_MULTIUPDATE";
exports[1394] = "ER_VIEW_NO_INSERT_FIELD_LIST";
exports[1395] = "ER_VIEW_DELETE_MERGE_VIEW";
exports[1396] = "ER_CANNOT_USER";
exports[1397] = "ER_XAER_NOTA";
exports[1398] = "ER_XAER_INVAL";
exports[1399] = "ER_XAER_RMFAIL";
exports[1400] = "ER_XAER_OUTSIDE";
exports[1401] = "ER_XA_RMERR";
exports[1402] = "ER_XA_RBROLLBACK";
exports[1403] = "ER_NONEXISTING_PROC_GRANT";
exports[1404] = "ER_PROC_AUTO_GRANT_FAIL";
exports[1405] = "ER_PROC_AUTO_REVOKE_FAIL";
exports[1406] = "ER_DATA_TOO_LONG";
exports[1407] = "ER_SP_BAD_SQLSTATE";
exports[1408] = "ER_STARTUP";
exports[1409] = "ER_LOAD_FROM_FIXED_SIZE_ROWS_TO_VAR";
exports[1410] = "ER_CANT_CREATE_USER_WITH_GRANT";
exports[1411] = "ER_WRONG_VALUE_FOR_TYPE";
exports[1412] = "ER_TABLE_DEF_CHANGED";
exports[1413] = "ER_SP_DUP_HANDLER";
exports[1414] = "ER_SP_NOT_VAR_ARG";
exports[1415] = "ER_SP_NO_RETSET";
exports[1416] = "ER_CANT_CREATE_GEOMETRY_OBJECT";
exports[1417] = "ER_FAILED_ROUTINE_BREAK_BINLOG";
exports[1418] = "ER_BINLOG_UNSAFE_ROUTINE";
exports[1419] = "ER_BINLOG_CREATE_ROUTINE_NEED_SUPER";
exports[1420] = "ER_EXEC_STMT_WITH_OPEN_CURSOR";
exports[1421] = "ER_STMT_HAS_NO_OPEN_CURSOR";
exports[1422] = "ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG";
exports[1423] = "ER_NO_DEFAULT_FOR_VIEW_FIELD";
exports[1424] = "ER_SP_NO_RECURSION";
exports[1425] = "ER_TOO_BIG_SCALE";
exports[1426] = "ER_TOO_BIG_PRECISION";
exports[1427] = "ER_M_BIGGER_THAN_D";
exports[1428] = "ER_WRONG_LOCK_OF_SYSTEM_TABLE";
exports[1429] = "ER_CONNECT_TO_FOREIGN_DATA_SOURCE";
exports[1430] = "ER_QUERY_ON_FOREIGN_DATA_SOURCE";
exports[1431] = "ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST";
exports[1432] = "ER_FOREIGN_DATA_STRING_INVALID_CANT_CREATE";
exports[1433] = "ER_FOREIGN_DATA_STRING_INVALID";
exports[1434] = "ER_CANT_CREATE_FEDERATED_TABLE";
exports[1435] = "ER_TRG_IN_WRONG_SCHEMA";
exports[1436] = "ER_STACK_OVERRUN_NEED_MORE";
exports[1437] = "ER_TOO_LONG_BODY";
exports[1438] = "ER_WARN_CANT_DROP_DEFAULT_KEYCACHE";
exports[1439] = "ER_TOO_BIG_DISPLAYWIDTH";
exports[1440] = "ER_XAER_DUPID";
exports[1441] = "ER_DATETIME_FUNCTION_OVERFLOW";
exports[1442] = "ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG";
exports[1443] = "ER_VIEW_PREVENT_UPDATE";
exports[1444] = "ER_PS_NO_RECURSION";
exports[1445] = "ER_SP_CANT_SET_AUTOCOMMIT";
exports[1446] = "ER_MALFORMED_DEFINER";
exports[1447] = "ER_VIEW_FRM_NO_USER";
exports[1448] = "ER_VIEW_OTHER_USER";
exports[1449] = "ER_NO_SUCH_USER";
exports[1450] = "ER_FORBID_SCHEMA_CHANGE";
exports[1451] = "ER_ROW_IS_REFERENCED_2";
exports[1452] = "ER_NO_REFERENCED_ROW_2";
exports[1453] = "ER_SP_BAD_VAR_SHADOW";
exports[1454] = "ER_TRG_NO_DEFINER";
exports[1455] = "ER_OLD_FILE_FORMAT";
exports[1456] = "ER_SP_RECURSION_LIMIT";
exports[1457] = "ER_SP_PROC_TABLE_CORRUPT";
exports[1458] = "ER_SP_WRONG_NAME";
exports[1459] = "ER_TABLE_NEEDS_UPGRADE";
exports[1460] = "ER_SP_NO_AGGREGATE";
exports[1461] = "ER_MAX_PREPARED_STMT_COUNT_REACHED";
exports[1462] = "ER_VIEW_RECURSIVE";
exports[1463] = "ER_NON_GROUPING_FIELD_USED";
exports[1464] = "ER_TABLE_CANT_HANDLE_SPKEYS";
exports[1465] = "ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA";
exports[1466] = "ER_REMOVED_SPACES";
exports[1467] = "ER_AUTOINC_READ_FAILED";
exports[1468] = "ER_USERNAME";
exports[1469] = "ER_HOSTNAME";
exports[1470] = "ER_WRONG_STRING_LENGTH";
exports[1471] = "ER_NON_INSERTABLE_TABLE";
exports[1472] = "ER_ADMIN_WRONG_MRG_TABLE";
exports[1473] = "ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT";
exports[1474] = "ER_NAME_BECOMES_EMPTY";
exports[1475] = "ER_AMBIGUOUS_FIELD_TERM";
exports[1476] = "ER_FOREIGN_SERVER_EXISTS";
exports[1477] = "ER_FOREIGN_SERVER_DOESNT_EXIST";
exports[1478] = "ER_ILLEGAL_HA_CREATE_OPTION";
exports[1479] = "ER_PARTITION_REQUIRES_VALUES_ERROR";
exports[1480] = "ER_PARTITION_WRONG_VALUES_ERROR";
exports[1481] = "ER_PARTITION_MAXVALUE_ERROR";
exports[1482] = "ER_PARTITION_SUBPARTITION_ERROR";
exports[1483] = "ER_PARTITION_SUBPART_MIX_ERROR";
exports[1484] = "ER_PARTITION_WRONG_NO_PART_ERROR";
exports[1485] = "ER_PARTITION_WRONG_NO_SUBPART_ERROR";
exports[1486] = "ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR";
exports[1487] = "ER_NO_CONST_EXPR_IN_RANGE_OR_LIST_ERROR";
exports[1488] = "ER_FIELD_NOT_FOUND_PART_ERROR";
exports[1489] = "ER_LIST_OF_FIELDS_ONLY_IN_HASH_ERROR";
exports[1490] = "ER_INCONSISTENT_PARTITION_INFO_ERROR";
exports[1491] = "ER_PARTITION_FUNC_NOT_ALLOWED_ERROR";
exports[1492] = "ER_PARTITIONS_MUST_BE_DEFINED_ERROR";
exports[1493] = "ER_RANGE_NOT_INCREASING_ERROR";
exports[1494] = "ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR";
exports[1495] = "ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR";
exports[1496] = "ER_PARTITION_ENTRY_ERROR";
exports[1497] = "ER_MIX_HANDLER_ERROR";
exports[1498] = "ER_PARTITION_NOT_DEFINED_ERROR";
exports[1499] = "ER_TOO_MANY_PARTITIONS_ERROR";
exports[1500] = "ER_SUBPARTITION_ERROR";
exports[1501] = "ER_CANT_CREATE_HANDLER_FILE";
exports[1502] = "ER_BLOB_FIELD_IN_PART_FUNC_ERROR";
exports[1503] = "ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF";
exports[1504] = "ER_NO_PARTS_ERROR";
exports[1505] = "ER_PARTITION_MGMT_ON_NONPARTITIONED";
exports[1506] = "ER_FOREIGN_KEY_ON_PARTITIONED";
exports[1507] = "ER_DROP_PARTITION_NON_EXISTENT";
exports[1508] = "ER_DROP_LAST_PARTITION";
exports[1509] = "ER_COALESCE_ONLY_ON_HASH_PARTITION";
exports[1510] = "ER_REORG_HASH_ONLY_ON_SAME_NO";
exports[1511] = "ER_REORG_NO_PARAM_ERROR";
exports[1512] = "ER_ONLY_ON_RANGE_LIST_PARTITION";
exports[1513] = "ER_ADD_PARTITION_SUBPART_ERROR";
exports[1514] = "ER_ADD_PARTITION_NO_NEW_PARTITION";
exports[1515] = "ER_COALESCE_PARTITION_NO_PARTITION";
exports[1516] = "ER_REORG_PARTITION_NOT_EXIST";
exports[1517] = "ER_SAME_NAME_PARTITION";
exports[1518] = "ER_NO_BINLOG_ERROR";
exports[1519] = "ER_CONSECUTIVE_REORG_PARTITIONS";
exports[1520] = "ER_REORG_OUTSIDE_RANGE";
exports[1521] = "ER_PARTITION_FUNCTION_FAILURE";
exports[1522] = "ER_PART_STATE_ERROR";
exports[1523] = "ER_LIMITED_PART_RANGE";
exports[1524] = "ER_PLUGIN_IS_NOT_LOADED";
exports[1525] = "ER_WRONG_VALUE";
exports[1526] = "ER_NO_PARTITION_FOR_GIVEN_VALUE";
exports[1527] = "ER_FILEGROUP_OPTION_ONLY_ONCE";
exports[1528] = "ER_CREATE_FILEGROUP_FAILED";
exports[1529] = "ER_DROP_FILEGROUP_FAILED";
exports[1530] = "ER_TABLESPACE_AUTO_EXTEND_ERROR";
exports[1531] = "ER_WRONG_SIZE_NUMBER";
exports[1532] = "ER_SIZE_OVERFLOW_ERROR";
exports[1533] = "ER_ALTER_FILEGROUP_FAILED";
exports[1534] = "ER_BINLOG_ROW_LOGGING_FAILED";
exports[1535] = "ER_BINLOG_ROW_WRONG_TABLE_DEF";
exports[1536] = "ER_BINLOG_ROW_RBR_TO_SBR";
exports[1537] = "ER_EVENT_ALREADY_EXISTS";
exports[1538] = "ER_EVENT_STORE_FAILED";
exports[1539] = "ER_EVENT_DOES_NOT_EXIST";
exports[1540] = "ER_EVENT_CANT_ALTER";
exports[1541] = "ER_EVENT_DROP_FAILED";
exports[1542] = "ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG";
exports[1543] = "ER_EVENT_ENDS_BEFORE_STARTS";
exports[1544] = "ER_EVENT_EXEC_TIME_IN_THE_PAST";
exports[1545] = "ER_EVENT_OPEN_TABLE_FAILED";
exports[1546] = "ER_EVENT_NEITHER_M_EXPR_NOR_M_AT";
exports[1547] = "ER_COL_COUNT_DOESNT_MATCH_CORRUPTED";
exports[1548] = "ER_CANNOT_LOAD_FROM_TABLE";
exports[1549] = "ER_EVENT_CANNOT_DELETE";
exports[1550] = "ER_EVENT_COMPILE_ERROR";
exports[1551] = "ER_EVENT_SAME_NAME";
exports[1552] = "ER_EVENT_DATA_TOO_LONG";
exports[1553] = "ER_DROP_INDEX_FK";
exports[1554] = "ER_WARN_DEPRECATED_SYNTAX_WITH_VER";
exports[1555] = "ER_CANT_WRITE_LOCK_LOG_TABLE";
exports[1556] = "ER_CANT_LOCK_LOG_TABLE";
exports[1557] = "ER_FOREIGN_DUPLICATE_KEY";
exports[1558] = "ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE";
exports[1559] = "ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR";
exports[1560] = "ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT";
exports[1561] = "ER_NDB_CANT_SWITCH_BINLOG_FORMAT";
exports[1562] = "ER_PARTITION_NO_TEMPORARY";
exports[1563] = "ER_PARTITION_CONST_DOMAIN_ERROR";
exports[1564] = "ER_PARTITION_FUNCTION_IS_NOT_ALLOWED";
exports[1565] = "ER_DDL_LOG_ERROR";
exports[1566] = "ER_NULL_IN_VALUES_LESS_THAN";
exports[1567] = "ER_WRONG_PARTITION_NAME";
exports[1568] = "ER_CANT_CHANGE_TX_ISOLATION";
exports[1569] = "ER_DUP_ENTRY_AUTOINCREMENT_CASE";
exports[1570] = "ER_EVENT_MODIFY_QUEUE_ERROR";
exports[1571] = "ER_EVENT_SET_VAR_ERROR";
exports[1572] = "ER_PARTITION_MERGE_ERROR";
exports[1573] = "ER_CANT_ACTIVATE_LOG";
exports[1574] = "ER_RBR_NOT_AVAILABLE";
exports[1575] = "ER_BASE64_DECODE_ERROR";
exports[1576] = "ER_EVENT_RECURSION_FORBIDDEN";
exports[1577] = "ER_EVENTS_DB_ERROR";
exports[1578] = "ER_ONLY_INTEGERS_ALLOWED";
exports[1579] = "ER_UNSUPORTED_LOG_ENGINE";
exports[1580] = "ER_BAD_LOG_STATEMENT";
exports[1581] = "ER_CANT_RENAME_LOG_TABLE";
exports[1582] = "ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT";
exports[1583] = "ER_WRONG_PARAMETERS_TO_NATIVE_FCT";
exports[1584] = "ER_WRONG_PARAMETERS_TO_STORED_FCT";
exports[1585] = "ER_NATIVE_FCT_NAME_COLLISION";
exports[1586] = "ER_DUP_ENTRY_WITH_KEY_NAME";
exports[1587] = "ER_BINLOG_PURGE_EMFILE";
exports[1588] = "ER_EVENT_CANNOT_CREATE_IN_THE_PAST";
exports[1589] = "ER_EVENT_CANNOT_ALTER_IN_THE_PAST";
exports[1590] = "ER_REPLICA_INCIDENT";
exports[1591] = "ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT";
exports[1592] = "ER_BINLOG_UNSAFE_STATEMENT";
exports[1593] = "ER_REPLICA_FATAL_ERROR";
exports[1594] = "ER_REPLICA_RELAY_LOG_READ_FAILURE";
exports[1595] = "ER_REPLICA_RELAY_LOG_WRITE_FAILURE";
exports[1596] = "ER_REPLICA_CREATE_EVENT_FAILURE";
exports[1597] = "ER_REPLICA_SOURCE_COM_FAILURE";
exports[1598] = "ER_BINLOG_LOGGING_IMPOSSIBLE";
exports[1599] = "ER_VIEW_NO_CREATION_CTX";
exports[1600] = "ER_VIEW_INVALID_CREATION_CTX";
exports[1601] = "ER_SR_INVALID_CREATION_CTX";
exports[1602] = "ER_TRG_CORRUPTED_FILE";
exports[1603] = "ER_TRG_NO_CREATION_CTX";
exports[1604] = "ER_TRG_INVALID_CREATION_CTX";
exports[1605] = "ER_EVENT_INVALID_CREATION_CTX";
exports[1606] = "ER_TRG_CANT_OPEN_TABLE";
exports[1607] = "ER_CANT_CREATE_SROUTINE";
exports[1608] = "ER_NEVER_USED";
exports[1609] = "ER_NO_FORMAT_DESCRIPTION_EVENT_BEFORE_BINLOG_STATEMENT";
exports[1610] = "ER_REPLICA_CORRUPT_EVENT";
exports[1611] = "ER_LOAD_DATA_INVALID_COLUMN";
exports[1612] = "ER_LOG_PURGE_NO_FILE";
exports[1613] = "ER_XA_RBTIMEOUT";
exports[1614] = "ER_XA_RBDEADLOCK";
exports[1615] = "ER_NEED_REPREPARE";
exports[1616] = "ER_DELAYED_NOT_SUPPORTED";
exports[1617] = "WARN_NO_SOURCE_INFO";
exports[1618] = "WARN_OPTION_IGNORED";
exports[1619] = "WARN_PLUGIN_DELETE_BUILTIN";
exports[1620] = "WARN_PLUGIN_BUSY";
exports[1621] = "ER_VARIABLE_IS_READONLY";
exports[1622] = "ER_WARN_ENGINE_TRANSACTION_ROLLBACK";
exports[1623] = "ER_REPLICA_HEARTBEAT_FAILURE";
exports[1624] = "ER_REPLICA_HEARTBEAT_VALUE_OUT_OF_RANGE";
exports[1625] = "ER_NDB_REPLICATION_SCHEMA_ERROR";
exports[1626] = "ER_CONFLICT_FN_PARSE_ERROR";
exports[1627] = "ER_EXCEPTIONS_WRITE_ERROR";
exports[1628] = "ER_TOO_LONG_TABLE_COMMENT";
exports[1629] = "ER_TOO_LONG_FIELD_COMMENT";
exports[1630] = "ER_FUNC_INEXISTENT_NAME_COLLISION";
exports[1631] = "ER_DATABASE_NAME";
exports[1632] = "ER_TABLE_NAME";
exports[1633] = "ER_PARTITION_NAME";
exports[1634] = "ER_SUBPARTITION_NAME";
exports[1635] = "ER_TEMPORARY_NAME";
exports[1636] = "ER_RENAMED_NAME";
exports[1637] = "ER_TOO_MANY_CONCURRENT_TRXS";
exports[1638] = "WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED";
exports[1639] = "ER_DEBUG_SYNC_TIMEOUT";
exports[1640] = "ER_DEBUG_SYNC_HIT_LIMIT";
exports[1641] = "ER_DUP_SIGNAL_SET";
exports[1642] = "ER_SIGNAL_WARN";
exports[1643] = "ER_SIGNAL_NOT_FOUND";
exports[1644] = "ER_SIGNAL_EXCEPTION";
exports[1645] = "ER_RESIGNAL_WITHOUT_ACTIVE_HANDLER";
exports[1646] = "ER_SIGNAL_BAD_CONDITION_TYPE";
exports[1647] = "WARN_COND_ITEM_TRUNCATED";
exports[1648] = "ER_COND_ITEM_TOO_LONG";
exports[1649] = "ER_UNKNOWN_LOCALE";
exports[1650] = "ER_REPLICA_IGNORE_SERVER_IDS";
exports[1651] = "ER_QUERY_CACHE_DISABLED";
exports[1652] = "ER_SAME_NAME_PARTITION_FIELD";
exports[1653] = "ER_PARTITION_COLUMN_LIST_ERROR";
exports[1654] = "ER_WRONG_TYPE_COLUMN_VALUE_ERROR";
exports[1655] = "ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR";
exports[1656] = "ER_MAXVALUE_IN_VALUES_IN";
exports[1657] = "ER_TOO_MANY_VALUES_ERROR";
exports[1658] = "ER_ROW_SINGLE_PARTITION_FIELD_ERROR";
exports[1659] = "ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD";
exports[1660] = "ER_PARTITION_FIELDS_TOO_LONG";
exports[1661] = "ER_BINLOG_ROW_ENGINE_AND_STMT_ENGINE";
exports[1662] = "ER_BINLOG_ROW_MODE_AND_STMT_ENGINE";
exports[1663] = "ER_BINLOG_UNSAFE_AND_STMT_ENGINE";
exports[1664] = "ER_BINLOG_ROW_INJECTION_AND_STMT_ENGINE";
exports[1665] = "ER_BINLOG_STMT_MODE_AND_ROW_ENGINE";
exports[1666] = "ER_BINLOG_ROW_INJECTION_AND_STMT_MODE";
exports[1667] = "ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE";
exports[1668] = "ER_BINLOG_UNSAFE_LIMIT";
exports[1669] = "ER_BINLOG_UNSAFE_INSERT_DELAYED";
exports[1670] = "ER_BINLOG_UNSAFE_SYSTEM_TABLE";
exports[1671] = "ER_BINLOG_UNSAFE_AUTOINC_COLUMNS";
exports[1672] = "ER_BINLOG_UNSAFE_UDF";
exports[1673] = "ER_BINLOG_UNSAFE_SYSTEM_VARIABLE";
exports[1674] = "ER_BINLOG_UNSAFE_SYSTEM_FUNCTION";
exports[1675] = "ER_BINLOG_UNSAFE_NONTRANS_AFTER_TRANS";
exports[1676] = "ER_MESSAGE_AND_STATEMENT";
exports[1677] = "ER_REPLICA_CONVERSION_FAILED";
exports[1678] = "ER_REPLICA_CANT_CREATE_CONVERSION";
exports[1679] = "ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT";
exports[1680] = "ER_PATH_LENGTH";
exports[1681] = "ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT";
exports[1682] = "ER_WRONG_NATIVE_TABLE_STRUCTURE";
exports[1683] = "ER_WRONG_PERFSCHEMA_USAGE";
exports[1684] = "ER_WARN_I_S_SKIPPED_TABLE";
exports[1685] = "ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT";
exports[1686] = "ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_DIRECT";
exports[1687] = "ER_SPATIAL_MUST_HAVE_GEOM_COL";
exports[1688] = "ER_TOO_LONG_INDEX_COMMENT";
exports[1689] = "ER_LOCK_ABORTED";
exports[1690] = "ER_DATA_OUT_OF_RANGE";
exports[1691] = "ER_WRONG_SPVAR_TYPE_IN_LIMIT";
exports[1692] = "ER_BINLOG_UNSAFE_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE";
exports[1693] = "ER_BINLOG_UNSAFE_MIXED_STATEMENT";
exports[1694] = "ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SQL_LOG_BIN";
exports[1695] = "ER_STORED_FUNCTION_PREVENTS_SWITCH_SQL_LOG_BIN";
exports[1696] = "ER_FAILED_READ_FROM_PAR_FILE";
exports[1697] = "ER_VALUES_IS_NOT_INT_TYPE_ERROR";
exports[1698] = "ER_ACCESS_DENIED_NO_PASSWORD_ERROR";
exports[1699] = "ER_SET_PASSWORD_AUTH_PLUGIN";
exports[1700] = "ER_GRANT_PLUGIN_USER_EXISTS";
exports[1701] = "ER_TRUNCATE_ILLEGAL_FK";
exports[1702] = "ER_PLUGIN_IS_PERMANENT";
exports[1703] = "ER_REPLICA_HEARTBEAT_VALUE_OUT_OF_RANGE_MIN";
exports[1704] = "ER_REPLICA_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX";
exports[1705] = "ER_STMT_CACHE_FULL";
exports[1706] = "ER_MULTI_UPDATE_KEY_CONFLICT";
exports[1707] = "ER_TABLE_NEEDS_REBUILD";
exports[1708] = "WARN_OPTION_BELOW_LIMIT";
exports[1709] = "ER_INDEX_COLUMN_TOO_LONG";
exports[1710] = "ER_ERROR_IN_TRIGGER_BODY";
exports[1711] = "ER_ERROR_IN_UNKNOWN_TRIGGER_BODY";
exports[1712] = "ER_INDEX_CORRUPT";
exports[1713] = "ER_UNDO_RECORD_TOO_BIG";
exports[1714] = "ER_BINLOG_UNSAFE_INSERT_IGNORE_SELECT";
exports[1715] = "ER_BINLOG_UNSAFE_INSERT_SELECT_UPDATE";
exports[1716] = "ER_BINLOG_UNSAFE_REPLACE_SELECT";
exports[1717] = "ER_BINLOG_UNSAFE_CREATE_IGNORE_SELECT";
exports[1718] = "ER_BINLOG_UNSAFE_CREATE_REPLACE_SELECT";
exports[1719] = "ER_BINLOG_UNSAFE_UPDATE_IGNORE";
exports[1720] = "ER_PLUGIN_NO_UNINSTALL";
exports[1721] = "ER_PLUGIN_NO_INSTALL";
exports[1722] = "ER_BINLOG_UNSAFE_WRITE_AUTOINC_SELECT";
exports[1723] = "ER_BINLOG_UNSAFE_CREATE_SELECT_AUTOINC";
exports[1724] = "ER_BINLOG_UNSAFE_INSERT_TWO_KEYS";
exports[1725] = "ER_TABLE_IN_FK_CHECK";
exports[1726] = "ER_UNSUPPORTED_ENGINE";
exports[1727] = "ER_BINLOG_UNSAFE_AUTOINC_NOT_FIRST";
exports[1728] = "ER_CANNOT_LOAD_FROM_TABLE_V2";
exports[1729] = "ER_SOURCE_DELAY_VALUE_OUT_OF_RANGE";
exports[1730] = "ER_ONLY_FD_AND_RBR_EVENTS_ALLOWED_IN_BINLOG_STATEMENT";
exports[1731] = "ER_PARTITION_EXCHANGE_DIFFERENT_OPTION";
exports[1732] = "ER_PARTITION_EXCHANGE_PART_TABLE";
exports[1733] = "ER_PARTITION_EXCHANGE_TEMP_TABLE";
exports[1734] = "ER_PARTITION_INSTEAD_OF_SUBPARTITION";
exports[1735] = "ER_UNKNOWN_PARTITION";
exports[1736] = "ER_TABLES_DIFFERENT_METADATA";
exports[1737] = "ER_ROW_DOES_NOT_MATCH_PARTITION";
exports[1738] = "ER_BINLOG_CACHE_SIZE_GREATER_THAN_MAX";
exports[1739] = "ER_WARN_INDEX_NOT_APPLICABLE";
exports[1740] = "ER_PARTITION_EXCHANGE_FOREIGN_KEY";
exports[1741] = "ER_NO_SUCH_KEY_VALUE";
exports[1742] = "ER_RPL_INFO_DATA_TOO_LONG";
exports[1743] = "ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE";
exports[1744] = "ER_BINLOG_READ_EVENT_CHECKSUM_FAILURE";
exports[1745] = "ER_BINLOG_STMT_CACHE_SIZE_GREATER_THAN_MAX";
exports[1746] = "ER_CANT_UPDATE_TABLE_IN_CREATE_TABLE_SELECT";
exports[1747] = "ER_PARTITION_CLAUSE_ON_NONPARTITIONED";
exports[1748] = "ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET";
exports[1749] = "ER_NO_SUCH_PARTITION";
exports[1750] = "ER_CHANGE_RPL_INFO_REPOSITORY_FAILURE";
exports[1751] = "ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_CREATED_TEMP_TABLE";
exports[1752] = "ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_DROPPED_TEMP_TABLE";
exports[1753] = "ER_MTS_FEATURE_IS_NOT_SUPPORTED";
exports[1754] = "ER_MTS_UPDATED_DBS_GREATER_MAX";
exports[1755] = "ER_MTS_CANT_PARALLEL";
exports[1756] = "ER_MTS_INCONSISTENT_DATA";
exports[1757] = "ER_FULLTEXT_NOT_SUPPORTED_WITH_PARTITIONING";
exports[1758] = "ER_DA_INVALID_CONDITION_NUMBER";
exports[1759] = "ER_INSECURE_PLAIN_TEXT";
exports[1760] = "ER_INSECURE_CHANGE_SOURCE";
exports[1761] = "ER_FOREIGN_DUPLICATE_KEY_WITH_CHILD_INFO";
exports[1762] = "ER_FOREIGN_DUPLICATE_KEY_WITHOUT_CHILD_INFO";
exports[1763] = "ER_SQLTHREAD_WITH_SECURE_REPLICA";
exports[1764] = "ER_TABLE_HAS_NO_FT";
exports[1765] = "ER_VARIABLE_NOT_SETTABLE_IN_SF_OR_TRIGGER";
exports[1766] = "ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION";
exports[1767] = "ER_GTID_NEXT_IS_NOT_IN_GTID_NEXT_LIST";
exports[1768] = "ER_CANT_CHANGE_GTID_NEXT_IN_TRANSACTION_WHEN_GTID_NEXT_LIST_IS_NULL";
exports[1769] = "ER_SET_STATEMENT_CANNOT_INVOKE_FUNCTION";
exports[1770] = "ER_GTID_NEXT_CANT_BE_AUTOMATIC_IF_GTID_NEXT_LIST_IS_NON_NULL";
exports[1771] = "ER_SKIPPING_LOGGED_TRANSACTION";
exports[1772] = "ER_MALFORMED_GTID_SET_SPECIFICATION";
exports[1773] = "ER_MALFORMED_GTID_SET_ENCODING";
exports[1774] = "ER_MALFORMED_GTID_SPECIFICATION";
exports[1775] = "ER_GNO_EXHAUSTED";
exports[1776] = "ER_BAD_REPLICA_AUTO_POSITION";
exports[1777] = "ER_AUTO_POSITION_REQUIRES_GTID_MODE_ON";
exports[1778] = "ER_CANT_DO_IMPLICIT_COMMIT_IN_TRX_WHEN_GTID_NEXT_IS_SET";
exports[1779] = "ER_GTID_MODE_2_OR_3_REQUIRES_ENFORCE_GTID_CONSISTENCY_ON";
exports[1780] = "ER_GTID_MODE_REQUIRES_BINLOG";
exports[1781] = "ER_CANT_SET_GTID_NEXT_TO_GTID_WHEN_GTID_MODE_IS_OFF";
exports[1782] = "ER_CANT_SET_GTID_NEXT_TO_ANONYMOUS_WHEN_GTID_MODE_IS_ON";
exports[1783] = "ER_CANT_SET_GTID_NEXT_LIST_TO_NON_NULL_WHEN_GTID_MODE_IS_OFF";
exports[1784] = "ER_FOUND_GTID_EVENT_WHEN_GTID_MODE_IS_OFF";
exports[1785] = "ER_GTID_UNSAFE_NON_TRANSACTIONAL_TABLE";
exports[1786] = "ER_GTID_UNSAFE_CREATE_SELECT";
exports[1787] = "ER_GTID_UNSAFE_CREATE_DROP_TEMPORARY_TABLE_IN_TRANSACTION";
exports[1788] = "ER_GTID_MODE_CAN_ONLY_CHANGE_ONE_STEP_AT_A_TIME";
exports[1789] = "ER_SOURCE_HAS_PURGED_REQUIRED_GTIDS";
exports[1790] = "ER_CANT_SET_GTID_NEXT_WHEN_OWNING_GTID";
exports[1791] = "ER_UNKNOWN_EXPLAIN_FORMAT";
exports[1792] = "ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION";
exports[1793] = "ER_TOO_LONG_TABLE_PARTITION_COMMENT";
exports[1794] = "ER_REPLICA_CONFIGURATION";
exports[1795] = "ER_INNODB_FT_LIMIT";
exports[1796] = "ER_INNODB_NO_FT_TEMP_TABLE";
exports[1797] = "ER_INNODB_FT_WRONG_DOCID_COLUMN";
exports[1798] = "ER_INNODB_FT_WRONG_DOCID_INDEX";
exports[1799] = "ER_INNODB_ONLINE_LOG_TOO_BIG";
exports[1800] = "ER_UNKNOWN_ALTER_ALGORITHM";
exports[1801] = "ER_UNKNOWN_ALTER_LOCK";
exports[1802] = "ER_MTS_CHANGE_SOURCE_CANT_RUN_WITH_GAPS";
exports[1803] = "ER_MTS_RECOVERY_FAILURE";
exports[1804] = "ER_MTS_RESET_WORKERS";
exports[1805] = "ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2";
exports[1806] = "ER_REPLICA_SILENT_RETRY_TRANSACTION";
exports[1807] = "ER_DISCARD_FK_CHECKS_RUNNING";
exports[1808] = "ER_TABLE_SCHEMA_MISMATCH";
exports[1809] = "ER_TABLE_IN_SYSTEM_TABLESPACE";
exports[1810] = "ER_IO_READ_ERROR";
exports[1811] = "ER_IO_WRITE_ERROR";
exports[1812] = "ER_TABLESPACE_MISSING";
exports[1813] = "ER_TABLESPACE_EXISTS";
exports[1814] = "ER_TABLESPACE_DISCARDED";
exports[1815] = "ER_INTERNAL_ERROR";
exports[1816] = "ER_INNODB_IMPORT_ERROR";
exports[1817] = "ER_INNODB_INDEX_CORRUPT";
exports[1818] = "ER_INVALID_YEAR_COLUMN_LENGTH";
exports[1819] = "ER_NOT_VALID_PASSWORD";
exports[1820] = "ER_MUST_CHANGE_PASSWORD";
exports[1821] = "ER_FK_NO_INDEX_CHILD";
exports[1822] = "ER_FK_NO_INDEX_PARENT";
exports[1823] = "ER_FK_FAIL_ADD_SYSTEM";
exports[1824] = "ER_FK_CANNOT_OPEN_PARENT";
exports[1825] = "ER_FK_INCORRECT_OPTION";
exports[1826] = "ER_FK_DUP_NAME";
exports[1827] = "ER_PASSWORD_FORMAT";
exports[1828] = "ER_FK_COLUMN_CANNOT_DROP";
exports[1829] = "ER_FK_COLUMN_CANNOT_DROP_CHILD";
exports[1830] = "ER_FK_COLUMN_NOT_NULL";
exports[1831] = "ER_DUP_INDEX";
exports[1832] = "ER_FK_COLUMN_CANNOT_CHANGE";
exports[1833] = "ER_FK_COLUMN_CANNOT_CHANGE_CHILD";
exports[1834] = "ER_FK_CANNOT_DELETE_PARENT";
exports[1835] = "ER_MALFORMED_PACKET";
exports[1836] = "ER_READ_ONLY_MODE";
exports[1837] = "ER_GTID_NEXT_TYPE_UNDEFINED_GROUP";
exports[1838] = "ER_VARIABLE_NOT_SETTABLE_IN_SP";
exports[1839] = "ER_CANT_SET_GTID_PURGED_WHEN_GTID_MODE_IS_OFF";
exports[1840] = "ER_CANT_SET_GTID_PURGED_WHEN_GTID_EXECUTED_IS_NOT_EMPTY";
exports[1841] = "ER_CANT_SET_GTID_PURGED_WHEN_OWNED_GTIDS_IS_NOT_EMPTY";
exports[1842] = "ER_GTID_PURGED_WAS_CHANGED";
exports[1843] = "ER_GTID_EXECUTED_WAS_CHANGED";
exports[1844] = "ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES";
exports[1845] = "ER_ALTER_OPERATION_NOT_SUPPORTED";
exports[1846] = "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON";
exports[1847] = "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COPY";
exports[1848] = "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_PARTITION";
exports[1849] = "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_RENAME";
exports[1850] = "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COLUMN_TYPE";
exports[1851] = "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_CHECK";
exports[1852] = "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_IGNORE";
exports[1853] = "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOPK";
exports[1854] = "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_AUTOINC";
exports[1855] = "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_HIDDEN_FTS";
exports[1856] = "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_CHANGE_FTS";
exports[1857] = "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FTS";
exports[1858] = "ER_SQL_REPLICA_SKIP_COUNTER_NOT_SETTABLE_IN_GTID_MODE";
exports[1859] = "ER_DUP_UNKNOWN_IN_INDEX";
exports[1860] = "ER_IDENT_CAUSES_TOO_LONG_PATH";
exports[1861] = "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOT_NULL";
exports[1862] = "ER_MUST_CHANGE_PASSWORD_LOGIN";
exports[1863] = "ER_ROW_IN_WRONG_PARTITION";
exports[1864] = "ER_MTS_EVENT_BIGGER_PENDING_JOBS_SIZE_MAX";
exports[1865] = "ER_INNODB_NO_FT_USES_PARSER";
exports[1866] = "ER_BINLOG_LOGICAL_CORRUPTION";
exports[1867] = "ER_WARN_PURGE_LOG_IN_USE";
exports[1868] = "ER_WARN_PURGE_LOG_IS_ACTIVE";
exports[1869] = "ER_AUTO_INCREMENT_CONFLICT";
exports[1870] = "WARN_ON_BLOCKHOLE_IN_RBR";
exports[1871] = "ER_REPLICA_MI_INIT_REPOSITORY";
exports[1872] = "ER_REPLICA_RLI_INIT_REPOSITORY";
exports[1873] = "ER_ACCESS_DENIED_CHANGE_USER_ERROR";
exports[1874] = "ER_INNODB_READ_ONLY";
exports[1875] = "ER_STOP_REPLICA_SQL_THREAD_TIMEOUT";
exports[1876] = "ER_STOP_REPLICA_IO_THREAD_TIMEOUT";
exports[1877] = "ER_TABLE_CORRUPT";
exports[1878] = "ER_TEMP_FILE_WRITE_FAILURE";
exports[1879] = "ER_INNODB_FT_AUX_NOT_HEX_ID";
exports[1880] = "ER_OLD_TEMPORALS_UPGRADED";
exports[1881] = "ER_INNODB_FORCED_RECOVERY";
exports[1882] = "ER_AES_INVALID_IV";
exports[1883] = "ER_FILE_CORRUPT";
exports[1884] = "ER_ERROR_ON_SOURCE";
exports[1885] = "ER_INCONSISTENT_ERROR";
exports[1886] = "ER_STORAGE_ENGINE_NOT_LOADED";
exports[1887] = "ER_GET_STACKED_DA_WITHOUT_ACTIVE_HANDLER";
exports[1888] = "ER_WARN_LEGACY_SYNTAX_CONVERTED";
exports[1889] = "ER_BINLOG_UNSAFE_FULLTEXT_PLUGIN";
exports[1890] = "ER_CANNOT_DISCARD_TEMPORARY_TABLE";
exports[1891] = "ER_FK_DEPTH_EXCEEDED";
exports[1892] = "ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE_V2";
exports[1893] = "ER_WARN_TRIGGER_DOESNT_HAVE_CREATED";
exports[1894] = "ER_REFERENCED_TRG_DOES_NOT_EXIST";
exports[1895] = "ER_EXPLAIN_NOT_SUPPORTED";
exports[1896] = "ER_INVALID_FIELD_SIZE";
exports[1897] = "ER_MISSING_HA_CREATE_OPTION";
exports[1898] = "ER_ENGINE_OUT_OF_MEMORY";
exports[1899] = "ER_PASSWORD_EXPIRE_ANONYMOUS_USER";
exports[1900] = "ER_REPLICA_SQL_THREAD_MUST_STOP";
exports[1901] = "ER_NO_FT_MATERIALIZED_SUBQUERY";
exports[1902] = "ER_INNODB_UNDO_LOG_FULL";
exports[1903] = "ER_INVALID_ARGUMENT_FOR_LOGARITHM";
exports[1904] = "ER_REPLICA_IO_THREAD_MUST_STOP";
exports[1905] = "ER_WARN_OPEN_TEMP_TABLES_MUST_BE_ZERO";
exports[1906] = "ER_WARN_ONLY_SOURCE_LOG_FILE_NO_POS";
exports[1907] = "ER_QUERY_TIMEOUT";
exports[1908] = "ER_NON_RO_SELECT_DISABLE_TIMER";
exports[1909] = "ER_DUP_LIST_ENTRY";
exports[1910] = "ER_SQL_MODE_NO_EFFECT";
exports[3169] = "ER_SESSION_WAS_KILLED";
exports[4031] = "ER_CLIENT_INTERACTION_TIMEOUT";
}
});
// node_modules/.pnpm/long@4.0.0/node_modules/long/src/long.js
var require_long = __commonJS({
"node_modules/.pnpm/long@4.0.0/node_modules/long/src/long.js"(exports, module2) {
module2.exports = Long;
var wasm = null;
try {
wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([
0,
97,
115,
109,
1,
0,
0,
0,
1,
13,
2,
96,
0,
1,
127,
96,
4,
127,
127,
127,
127,
1,
127,
3,
7,
6,
0,
1,
1,
1,
1,
1,
6,
6,
1,
127,
1,
65,
0,
11,
7,
50,
6,
3,
109,
117,
108,
0,
1,
5,
100,
105,
118,
95,
115,
0,
2,
5,
100,
105,
118,
95,
117,
0,
3,
5,
114,
101,
109,
95,
115,
0,
4,
5,
114,
101,
109,
95,
117,
0,
5,
8,
103,
101,
116,
95,
104,
105,
103,
104,
0,
0,
10,
191,
1,
6,
4,
0,
35,
0,
11,
36,
1,
1,
126,
32,
0,
173,
32,
1,
173,
66,
32,
134,
132,
32,
2,
173,
32,
3,
173,
66,
32,
134,
132,
126,
34,
4,
66,
32,
135,
167,
36,
0,
32,
4,
167,
11,
36,
1,
1,
126,
32,
0,
173,
32,
1,
173,
66,
32,
134,
132,
32,
2,
173,
32,
3,
173,
66,
32,
134,
132,
127,
34,
4,
66,
32,
135,
167,
36,
0,
32,
4,
167,
11,
36,
1,
1,
126,
32,
0,
173,
32,
1,
173,
66,
32,
134,
132,
32,
2,
173,
32,
3,
173,
66,
32,
134,
132,
128,
34,
4,
66,
32,
135,
167,
36,
0,
32,
4,
167,
11,
36,
1,
1,
126,
32,
0,
173,
32,
1,
173,
66,
32,
134,
132,
32,
2,
173,
32,
3,
173,
66,
32,
134,
132,
129,
34,
4,
66,
32,
135,
167,
36,
0,
32,
4,
167,
11,
36,
1,
1,
126,
32,
0,
173,
32,
1,
173,
66,
32,
134,
132,
32,
2,
173,
32,
3,
173,
66,
32,
134,
132,
130,
34,
4,
66,
32,
135,
167,
36,
0,
32,
4,
167,
11
])), {}).exports;
} catch (e) {
}
function Long(low, high, unsigned) {
this.low = low | 0;
this.high = high | 0;
this.unsigned = !!unsigned;
}
Long.prototype.__isLong__;
Object.defineProperty(Long.prototype, "__isLong__", { value: true });
function isLong(obj) {
return (obj && obj["__isLong__"]) === true;
}
Long.isLong = isLong;
var INT_CACHE = {};
var UINT_CACHE = {};
function fromInt(value, unsigned) {
var obj, cachedObj, cache;
if (unsigned) {
value >>>= 0;
if (cache = 0 <= value && value < 256) {
cachedObj = UINT_CACHE[value];
if (cachedObj)
return cachedObj;
}
obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);
if (cache)
UINT_CACHE[value] = obj;
return obj;
} else {
value |= 0;
if (cache = -128 <= value && value < 128) {
cachedObj = INT_CACHE[value];
if (cachedObj)
return cachedObj;
}
obj = fromBits(value, value < 0 ? -1 : 0, false);
if (cache)
INT_CACHE[value] = obj;
return obj;
}
}
Long.fromInt = fromInt;
function fromNumber(value, unsigned) {
if (isNaN(value))
return unsigned ? UZERO : ZERO;
if (unsigned) {
if (value < 0)
return UZERO;
if (value >= TWO_PWR_64_DBL)
return MAX_UNSIGNED_VALUE;
} else {
if (value <= -TWO_PWR_63_DBL)
return MIN_VALUE;
if (value + 1 >= TWO_PWR_63_DBL)
return MAX_VALUE;
}
if (value < 0)
return fromNumber(-value, unsigned).neg();
return fromBits(value % TWO_PWR_32_DBL | 0, value / TWO_PWR_32_DBL | 0, unsigned);
}
Long.fromNumber = fromNumber;
function fromBits(lowBits, highBits, unsigned) {
return new Long(lowBits, highBits, unsigned);
}
Long.fromBits = fromBits;
var pow_dbl = Math.pow;
function fromString(str, unsigned, radix) {
if (str.length === 0)
throw Error("empty string");
if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity")
return ZERO;
if (typeof unsigned === "number") {
radix = unsigned, unsigned = false;
} else {
unsigned = !!unsigned;
}
radix = radix || 10;
if (radix < 2 || 36 < radix)
throw RangeError("radix");
var p;
if ((p = str.indexOf("-")) > 0)
throw Error("interior hyphen");
else if (p === 0) {
return fromString(str.substring(1), unsigned, radix).neg();
}
var radixToPower = fromNumber(pow_dbl(radix, 8));
var result = ZERO;
for (var i = 0; i < str.length; i += 8) {
var size = Math.min(8, str.length - i), value = parseInt(str.substring(i, i + size), radix);
if (size < 8) {
var power = fromNumber(pow_dbl(radix, size));
result = result.mul(power).add(fromNumber(value));
} else {
result = result.mul(radixToPower);
result = result.add(fromNumber(value));
}
}
result.unsigned = unsigned;
return result;
}
Long.fromString = fromString;
function fromValue(val, unsigned) {
if (typeof val === "number")
return fromNumber(val, unsigned);
if (typeof val === "string")
return fromString(val, unsigned);
return fromBits(val.low, val.high, typeof unsigned === "boolean" ? unsigned : val.unsigned);
}
Long.fromValue = fromValue;
var TWO_PWR_16_DBL = 1 << 16;
var TWO_PWR_24_DBL = 1 << 24;
var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);
var ZERO = fromInt(0);
Long.ZERO = ZERO;
var UZERO = fromInt(0, true);
Long.UZERO = UZERO;
var ONE = fromInt(1);
Long.ONE = ONE;
var UONE = fromInt(1, true);
Long.UONE = UONE;
var NEG_ONE = fromInt(-1);
Long.NEG_ONE = NEG_ONE;
var MAX_VALUE = fromBits(4294967295 | 0, 2147483647 | 0, false);
Long.MAX_VALUE = MAX_VALUE;
var MAX_UNSIGNED_VALUE = fromBits(4294967295 | 0, 4294967295 | 0, true);
Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;
var MIN_VALUE = fromBits(0, 2147483648 | 0, false);
Long.MIN_VALUE = MIN_VALUE;
var LongPrototype = Long.prototype;
LongPrototype.toInt = function toInt() {
return this.unsigned ? this.low >>> 0 : this.low;
};
LongPrototype.toNumber = function toNumber() {
if (this.unsigned)
return (this.high >>> 0) * TWO_PWR_32_DBL + (this.low >>> 0);
return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
};
LongPrototype.toString = function toString(radix) {
radix = radix || 10;
if (radix < 2 || 36 < radix)
throw RangeError("radix");
if (this.isZero())
return "0";
if (this.isNegative()) {
if (this.eq(MIN_VALUE)) {
var radixLong = fromNumber(radix), div = this.div(radixLong), rem1 = div.mul(radixLong).sub(this);
return div.toString(radix) + rem1.toInt().toString(radix);
} else
return "-" + this.neg().toString(radix);
}
var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned), rem = this;
var result = "";
while (true) {
var remDiv = rem.div(radixToPower), intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0, digits = intval.toString(radix);
rem = remDiv;
if (rem.isZero())
return digits + result;
else {
while (digits.length < 6)
digits = "0" + digits;
result = "" + digits + result;
}
}
};
LongPrototype.getHighBits = function getHighBits() {
return this.high;
};
LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {
return this.high >>> 0;
};
LongPrototype.getLowBits = function getLowBits() {
return this.low;
};
LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {
return this.low >>> 0;
};
LongPrototype.getNumBitsAbs = function getNumBitsAbs() {
if (this.isNegative())
return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
var val = this.high != 0 ? this.high : this.low;
for (var bit = 31; bit > 0; bit--)
if ((val & 1 << bit) != 0)
break;
return this.high != 0 ? bit + 33 : bit + 1;
};
LongPrototype.isZero = function isZero() {
return this.high === 0 && this.low === 0;
};
LongPrototype.eqz = LongPrototype.isZero;
LongPrototype.isNegative = function isNegative() {
return !this.unsigned && this.high < 0;
};
LongPrototype.isPositive = function isPositive() {
return this.unsigned || this.high >= 0;
};
LongPrototype.isOdd = function isOdd() {
return (this.low & 1) === 1;
};
LongPrototype.isEven = function isEven() {
return (this.low & 1) === 0;
};
LongPrototype.equals = function equals(other) {
if (!isLong(other))
other = fromValue(other);
if (this.unsigned !== other.unsigned && this.high >>> 31 === 1 && other.high >>> 31 === 1)
return false;
return this.high === other.high && this.low === other.low;
};
LongPrototype.eq = LongPrototype.equals;
LongPrototype.notEquals = function notEquals(other) {
return !this.eq(
/* validates */
other
);
};
LongPrototype.neq = LongPrototype.notEquals;
LongPrototype.ne = LongPrototype.notEquals;
LongPrototype.lessThan = function lessThan(other) {
return this.comp(
/* validates */
other
) < 0;
};
LongPrototype.lt = LongPrototype.lessThan;
LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {
return this.comp(
/* validates */
other
) <= 0;
};
LongPrototype.lte = LongPrototype.lessThanOrEqual;
LongPrototype.le = LongPrototype.lessThanOrEqual;
LongPrototype.greaterThan = function greaterThan(other) {
return this.comp(
/* validates */
other
) > 0;
};
LongPrototype.gt = LongPrototype.greaterThan;
LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {
return this.comp(
/* validates */
other
) >= 0;
};
LongPrototype.gte = LongPrototype.greaterThanOrEqual;
LongPrototype.ge = LongPrototype.greaterThanOrEqual;
LongPrototype.compare = function compare(other) {
if (!isLong(other))
other = fromValue(other);
if (this.eq(other))
return 0;
var thisNeg = this.isNegative(), otherNeg = other.isNegative();
if (thisNeg && !otherNeg)
return -1;
if (!thisNeg && otherNeg)
return 1;
if (!this.unsigned)
return this.sub(other).isNegative() ? -1 : 1;
return other.high >>> 0 > this.high >>> 0 || other.high === this.high && other.low >>> 0 > this.low >>> 0 ? -1 : 1;
};
LongPrototype.comp = LongPrototype.compare;
LongPrototype.negate = function negate() {
if (!this.unsigned && this.eq(MIN_VALUE))
return MIN_VALUE;
return this.not().add(ONE);
};
LongPrototype.neg = LongPrototype.negate;
LongPrototype.add = function add(addend) {
if (!isLong(addend))
addend = fromValue(addend);
var a48 = this.high >>> 16;
var a32 = this.high & 65535;
var a16 = this.low >>> 16;
var a00 = this.low & 65535;
var b48 = addend.high >>> 16;
var b32 = addend.high & 65535;
var b16 = addend.low >>> 16;
var b00 = addend.low & 65535;
var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
c00 += a00 + b00;
c16 += c00 >>> 16;
c00 &= 65535;
c16 += a16 + b16;
c32 += c16 >>> 16;
c16 &= 65535;
c32 += a32 + b32;
c48 += c32 >>> 16;
c32 &= 65535;
c48 += a48 + b48;
c48 &= 65535;
return fromBits(c16 << 16 | c00, c48 << 16 | c32, this.unsigned);
};
LongPrototype.subtract = function subtract(subtrahend) {
if (!isLong(subtrahend))
subtrahend = fromValue(subtrahend);
return this.add(subtrahend.neg());
};
LongPrototype.sub = LongPrototype.subtract;
LongPrototype.multiply = function multiply(multiplier) {
if (this.isZero())
return ZERO;
if (!isLong(multiplier))
multiplier = fromValue(multiplier);
if (wasm) {
var low = wasm.mul(
this.low,
this.high,
multiplier.low,
multiplier.high
);
return fromBits(low, wasm.get_high(), this.unsigned);
}
if (multiplier.isZero())
return ZERO;
if (this.eq(MIN_VALUE))
return multiplier.isOdd() ? MIN_VALUE : ZERO;
if (multiplier.eq(MIN_VALUE))
return this.isOdd() ? MIN_VALUE : ZERO;
if (this.isNegative()) {
if (multiplier.isNegative())
return this.neg().mul(multiplier.neg());
else
return this.neg().mul(multiplier).neg();
} else if (multiplier.isNegative())
return this.mul(multiplier.neg()).neg();
if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))
return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
var a48 = this.high >>> 16;
var a32 = this.high & 65535;
var a16 = this.low >>> 16;
var a00 = this.low & 65535;
var b48 = multiplier.high >>> 16;
var b32 = multiplier.high & 65535;
var b16 = multiplier.low >>> 16;
var b00 = multiplier.low & 65535;
var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
c00 += a00 * b00;
c16 += c00 >>> 16;
c00 &= 65535;
c16 += a16 * b00;
c32 += c16 >>> 16;
c16 &= 65535;
c16 += a00 * b16;
c32 += c16 >>> 16;
c16 &= 65535;
c32 += a32 * b00;
c48 += c32 >>> 16;
c32 &= 65535;
c32 += a16 * b16;
c48 += c32 >>> 16;
c32 &= 65535;
c32 += a00 * b32;
c48 += c32 >>> 16;
c32 &= 65535;
c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
c48 &= 65535;
return fromBits(c16 << 16 | c00, c48 << 16 | c32, this.unsigned);
};
LongPrototype.mul = LongPrototype.multiply;
LongPrototype.divide = function divide(divisor) {
if (!isLong(divisor))
divisor = fromValue(divisor);
if (divisor.isZero())
throw Error("division by zero");
if (wasm) {
if (!this.unsigned && this.high === -2147483648 && divisor.low === -1 && divisor.high === -1) {
return this;
}
var low = (this.unsigned ? wasm.div_u : wasm.div_s)(
this.low,
this.high,
divisor.low,
divisor.high
);
return fromBits(low, wasm.get_high(), this.unsigned);
}
if (this.isZero())
return this.unsigned ? UZERO : ZERO;
var approx, rem, res;
if (!this.unsigned) {
if (this.eq(MIN_VALUE)) {
if (divisor.eq(ONE) || divisor.eq(NEG_ONE))
return MIN_VALUE;
else if (divisor.eq(MIN_VALUE))
return ONE;
else {
var halfThis = this.shr(1);
approx = halfThis.div(divisor).shl(1);
if (approx.eq(ZERO)) {
return divisor.isNegative() ? ONE : NEG_ONE;
} else {
rem = this.sub(divisor.mul(approx));
res = approx.add(rem.div(divisor));
return res;
}
}
} else if (divisor.eq(MIN_VALUE))
return this.unsigned ? UZERO : ZERO;
if (this.isNegative()) {
if (divisor.isNegative())
return this.neg().div(divisor.neg());
return this.neg().div(divisor).neg();
} else if (divisor.isNegative())
return this.div(divisor.neg()).neg();
res = ZERO;
} else {
if (!divisor.unsigned)
divisor = divisor.toUnsigned();
if (divisor.gt(this))
return UZERO;
if (divisor.gt(this.shru(1)))
return UONE;
res = UZERO;
}
rem = this;
while (rem.gte(divisor)) {
approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
var log2 = Math.ceil(Math.log(approx) / Math.LN2), delta = log2 <= 48 ? 1 : pow_dbl(2, log2 - 48), approxRes = fromNumber(approx), approxRem = approxRes.mul(divisor);
while (approxRem.isNegative() || approxRem.gt(rem)) {
approx -= delta;
approxRes = fromNumber(approx, this.unsigned);
approxRem = approxRes.mul(divisor);
}
if (approxRes.isZero())
approxRes = ONE;
res = res.add(approxRes);
rem = rem.sub(approxRem);
}
return res;
};
LongPrototype.div = LongPrototype.divide;
LongPrototype.modulo = function modulo(divisor) {
if (!isLong(divisor))
divisor = fromValue(divisor);
if (wasm) {
var low = (this.unsigned ? wasm.rem_u : wasm.rem_s)(
this.low,
this.high,
divisor.low,
divisor.high
);
return fromBits(low, wasm.get_high(), this.unsigned);
}
return this.sub(this.div(divisor).mul(divisor));
};
LongPrototype.mod = LongPrototype.modulo;
LongPrototype.rem = LongPrototype.modulo;
LongPrototype.not = function not() {
return fromBits(~this.low, ~this.high, this.unsigned);
};
LongPrototype.and = function and(other) {
if (!isLong(other))
other = fromValue(other);
return fromBits(this.low & other.low, this.high & other.high, this.unsigned);
};
LongPrototype.or = function or(other) {
if (!isLong(other))
other = fromValue(other);
return fromBits(this.low | other.low, this.high | other.high, this.unsigned);
};
LongPrototype.xor = function xor(other) {
if (!isLong(other))
other = fromValue(other);
return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
};
LongPrototype.shiftLeft = function shiftLeft(numBits) {
if (isLong(numBits))
numBits = numBits.toInt();
if ((numBits &= 63) === 0)
return this;
else if (numBits < 32)
return fromBits(this.low << numBits, this.high << numBits | this.low >>> 32 - numBits, this.unsigned);
else
return fromBits(0, this.low << numBits - 32, this.unsigned);
};
LongPrototype.shl = LongPrototype.shiftLeft;
LongPrototype.shiftRight = function shiftRight(numBits) {
if (isLong(numBits))
numBits = numBits.toInt();
if ((numBits &= 63) === 0)
return this;
else if (numBits < 32)
return fromBits(this.low >>> numBits | this.high << 32 - numBits, this.high >> numBits, this.unsigned);
else
return fromBits(this.high >> numBits - 32, this.high >= 0 ? 0 : -1, this.unsigned);
};
LongPrototype.shr = LongPrototype.shiftRight;
LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
if (isLong(numBits))
numBits = numBits.toInt();
numBits &= 63;
if (numBits === 0)
return this;
else {
var high = this.high;
if (numBits < 32) {
var low = this.low;
return fromBits(low >>> numBits | high << 32 - numBits, high >>> numBits, this.unsigned);
} else if (numBits === 32)
return fromBits(high, 0, this.unsigned);
else
return fromBits(high >>> numBits - 32, 0, this.unsigned);
}
};
LongPrototype.shru = LongPrototype.shiftRightUnsigned;
LongPrototype.shr_u = LongPrototype.shiftRightUnsigned;
LongPrototype.toSigned = function toSigned() {
if (!this.unsigned)
return this;
return fromBits(this.low, this.high, false);
};
LongPrototype.toUnsigned = function toUnsigned() {
if (this.unsigned)
return this;
return fromBits(this.low, this.high, true);
};
LongPrototype.toBytes = function toBytes(le) {
return le ? this.toBytesLE() : this.toBytesBE();
};
LongPrototype.toBytesLE = function toBytesLE() {
var hi = this.high, lo = this.low;
return [
lo & 255,
lo >>> 8 & 255,
lo >>> 16 & 255,
lo >>> 24,
hi & 255,
hi >>> 8 & 255,
hi >>> 16 & 255,
hi >>> 24
];
};
LongPrototype.toBytesBE = function toBytesBE() {
var hi = this.high, lo = this.low;
return [
hi >>> 24,
hi >>> 16 & 255,
hi >>> 8 & 255,
hi & 255,
lo >>> 24,
lo >>> 16 & 255,
lo >>> 8 & 255,
lo & 255
];
};
Long.fromBytes = function fromBytes(bytes, unsigned, le) {
return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);
};
Long.fromBytesLE = function fromBytesLE(bytes, unsigned) {
return new Long(
bytes[0] | bytes[1] << 8 | bytes[2] << 16 | bytes[3] << 24,
bytes[4] | bytes[5] << 8 | bytes[6] << 16 | bytes[7] << 24,
unsigned
);
};
Long.fromBytesBE = function fromBytesBE(bytes, unsigned) {
return new Long(
bytes[4] << 24 | bytes[5] << 16 | bytes[6] << 8 | bytes[7],
bytes[0] << 24 | bytes[1] << 16 | bytes[2] << 8 | bytes[3],
unsigned
);
};
}
});
// node_modules/.pnpm/safer-buffer@2.1.2/node_modules/safer-buffer/safer.js
var require_safer = __commonJS({
"node_modules/.pnpm/safer-buffer@2.1.2/node_modules/safer-buffer/safer.js"(exports, module2) {
"use strict";
var buffer = require("buffer");
var Buffer3 = buffer.Buffer;
var safer = {};
var key;
for (key in buffer) {
if (!buffer.hasOwnProperty(key))
continue;
if (key === "SlowBuffer" || key === "Buffer")
continue;
safer[key] = buffer[key];
}
var Safer = safer.Buffer = {};
for (key in Buffer3) {
if (!Buffer3.hasOwnProperty(key))
continue;
if (key === "allocUnsafe" || key === "allocUnsafeSlow")
continue;
Safer[key] = Buffer3[key];
}
safer.Buffer.prototype = Buffer3.prototype;
if (!Safer.from || Safer.from === Uint8Array.from) {
Safer.from = function(value, encodingOrOffset, length) {
if (typeof value === "number") {
throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof value);
}
if (value && typeof value.length === "undefined") {
throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value);
}
return Buffer3(value, encodingOrOffset, length);
};
}
if (!Safer.alloc) {
Safer.alloc = function(size, fill, encoding) {
if (typeof size !== "number") {
throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size);
}
if (size < 0 || size >= 2 * (1 << 30)) {
throw new RangeError('The value "' + size + '" is invalid for option "size"');
}
var buf = Buffer3(size);
if (!fill || fill.length === 0) {
buf.fill(0);
} else if (typeof encoding === "string") {
buf.fill(fill, encoding);
} else {
buf.fill(fill);
}
return buf;
};
}
if (!safer.kStringMaxLength) {
try {
safer.kStringMaxLength = process.binding("buffer").kStringMaxLength;
} catch (e) {
}
}
if (!safer.constants) {
safer.constants = {
MAX_LENGTH: safer.kMaxLength
};
if (safer.kStringMaxLength) {
safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength;
}
}
module2.exports = safer;
}
});
// node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/lib/bom-handling.js
var require_bom_handling = __commonJS({
"node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/lib/bom-handling.js"(exports) {
"use strict";
var BOMChar = "\uFEFF";
exports.PrependBOM = PrependBOMWrapper;
function PrependBOMWrapper(encoder, options) {
this.encoder = encoder;
this.addBOM = true;
}
PrependBOMWrapper.prototype.write = function(str) {
if (this.addBOM) {
str = BOMChar + str;
this.addBOM = false;
}
return this.encoder.write(str);
};
PrependBOMWrapper.prototype.end = function() {
return this.encoder.end();
};
exports.StripBOM = StripBOMWrapper;
function StripBOMWrapper(decoder, options) {
this.decoder = decoder;
this.pass = false;
this.options = options || {};
}
StripBOMWrapper.prototype.write = function(buf) {
var res = this.decoder.write(buf);
if (this.pass || !res)
return res;
if (res[0] === BOMChar) {
res = res.slice(1);
if (typeof this.options.stripBOM === "function")
this.options.stripBOM();
}
this.pass = true;
return res;
};
StripBOMWrapper.prototype.end = function() {
return this.decoder.end();
};
}
});
// node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/internal.js
var require_internal = __commonJS({
"node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/internal.js"(exports, module2) {
"use strict";
var Buffer3 = require_safer().Buffer;
module2.exports = {
// Encodings
utf8: { type: "_internal", bomAware: true },
cesu8: { type: "_internal", bomAware: true },
unicode11utf8: "utf8",
ucs2: { type: "_internal", bomAware: true },
utf16le: "ucs2",
binary: { type: "_internal" },
base64: { type: "_internal" },
hex: { type: "_internal" },
// Codec.
_internal: InternalCodec
};
function InternalCodec(codecOptions, iconv) {
this.enc = codecOptions.encodingName;
this.bomAware = codecOptions.bomAware;
if (this.enc === "base64")
this.encoder = InternalEncoderBase64;
else if (this.enc === "cesu8") {
this.enc = "utf8";
this.encoder = InternalEncoderCesu8;
if (Buffer3.from("eda0bdedb2a9", "hex").toString() !== "\u{1F4A9}") {
this.decoder = InternalDecoderCesu8;
this.defaultCharUnicode = iconv.defaultCharUnicode;
}
}
}
InternalCodec.prototype.encoder = InternalEncoder;
InternalCodec.prototype.decoder = InternalDecoder;
var StringDecoder = require("string_decoder").StringDecoder;
if (!StringDecoder.prototype.end)
StringDecoder.prototype.end = function() {
};
function InternalDecoder(options, codec) {
this.decoder = new StringDecoder(codec.enc);
}
InternalDecoder.prototype.write = function(buf) {
if (!Buffer3.isBuffer(buf)) {
buf = Buffer3.from(buf);
}
return this.decoder.write(buf);
};
InternalDecoder.prototype.end = function() {
return this.decoder.end();
};
function InternalEncoder(options, codec) {
this.enc = codec.enc;
}
InternalEncoder.prototype.write = function(str) {
return Buffer3.from(str, this.enc);
};
InternalEncoder.prototype.end = function() {
};
function InternalEncoderBase64(options, codec) {
this.prevStr = "";
}
InternalEncoderBase64.prototype.write = function(str) {
str = this.prevStr + str;
var completeQuads = str.length - str.length % 4;
this.prevStr = str.slice(completeQuads);
str = str.slice(0, completeQuads);
return Buffer3.from(str, "base64");
};
InternalEncoderBase64.prototype.end = function() {
return Buffer3.from(this.prevStr, "base64");
};
function InternalEncoderCesu8(options, codec) {
}
InternalEncoderCesu8.prototype.write = function(str) {
var buf = Buffer3.alloc(str.length * 3), bufIdx = 0;
for (var i = 0; i < str.length; i++) {
var charCode = str.charCodeAt(i);
if (charCode < 128)
buf[bufIdx++] = charCode;
else if (charCode < 2048) {
buf[bufIdx++] = 192 + (charCode >>> 6);
buf[bufIdx++] = 128 + (charCode & 63);
} else {
buf[bufIdx++] = 224 + (charCode >>> 12);
buf[bufIdx++] = 128 + (charCode >>> 6 & 63);
buf[bufIdx++] = 128 + (charCode & 63);
}
}
return buf.slice(0, bufIdx);
};
InternalEncoderCesu8.prototype.end = function() {
};
function InternalDecoderCesu8(options, codec) {
this.acc = 0;
this.contBytes = 0;
this.accBytes = 0;
this.defaultCharUnicode = codec.defaultCharUnicode;
}
InternalDecoderCesu8.prototype.write = function(buf) {
var acc = this.acc, contBytes = this.contBytes, accBytes = this.accBytes, res = "";
for (var i = 0; i < buf.length; i++) {
var curByte = buf[i];
if ((curByte & 192) !== 128) {
if (contBytes > 0) {
res += this.defaultCharUnicode;
contBytes = 0;
}
if (curByte < 128) {
res += String.fromCharCode(curByte);
} else if (curByte < 224) {
acc = curByte & 31;
contBytes = 1;
accBytes = 1;
} else if (curByte < 240) {
acc = curByte & 15;
contBytes = 2;
accBytes = 1;
} else {
res += this.defaultCharUnicode;
}
} else {
if (contBytes > 0) {
acc = acc << 6 | curByte & 63;
contBytes--;
accBytes++;
if (contBytes === 0) {
if (accBytes === 2 && acc < 128 && acc > 0)
res += this.defaultCharUnicode;
else if (accBytes === 3 && acc < 2048)
res += this.defaultCharUnicode;
else
res += String.fromCharCode(acc);
}
} else {
res += this.defaultCharUnicode;
}
}
}
this.acc = acc;
this.contBytes = contBytes;
this.accBytes = accBytes;
return res;
};
InternalDecoderCesu8.prototype.end = function() {
var res = 0;
if (this.contBytes > 0)
res += this.defaultCharUnicode;
return res;
};
}
});
// node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/utf32.js
var require_utf32 = __commonJS({
"node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/utf32.js"(exports) {
"use strict";
var Buffer3 = require_safer().Buffer;
exports._utf32 = Utf32Codec;
function Utf32Codec(codecOptions, iconv) {
this.iconv = iconv;
this.bomAware = true;
this.isLE = codecOptions.isLE;
}
exports.utf32le = { type: "_utf32", isLE: true };
exports.utf32be = { type: "_utf32", isLE: false };
exports.ucs4le = "utf32le";
exports.ucs4be = "utf32be";
Utf32Codec.prototype.encoder = Utf32Encoder;
Utf32Codec.prototype.decoder = Utf32Decoder;
function Utf32Encoder(options, codec) {
this.isLE = codec.isLE;
this.highSurrogate = 0;
}
Utf32Encoder.prototype.write = function(str) {
var src = Buffer3.from(str, "ucs2");
var dst = Buffer3.alloc(src.length * 2);
var write32 = this.isLE ? dst.writeUInt32LE : dst.writeUInt32BE;
var offset = 0;
for (var i = 0; i < src.length; i += 2) {
var code = src.readUInt16LE(i);
var isHighSurrogate = 55296 <= code && code < 56320;
var isLowSurrogate = 56320 <= code && code < 57344;
if (this.highSurrogate) {
if (isHighSurrogate || !isLowSurrogate) {
write32.call(dst, this.highSurrogate, offset);
offset += 4;
} else {
var codepoint = (this.highSurrogate - 55296 << 10 | code - 56320) + 65536;
write32.call(dst, codepoint, offset);
offset += 4;
this.highSurrogate = 0;
continue;
}
}
if (isHighSurrogate)
this.highSurrogate = code;
else {
write32.call(dst, code, offset);
offset += 4;
this.highSurrogate = 0;
}
}
if (offset < dst.length)
dst = dst.slice(0, offset);
return dst;
};
Utf32Encoder.prototype.end = function() {
if (!this.highSurrogate)
return;
var buf = Buffer3.alloc(4);
if (this.isLE)
buf.writeUInt32LE(this.highSurrogate, 0);
else
buf.writeUInt32BE(this.highSurrogate, 0);
this.highSurrogate = 0;
return buf;
};
function Utf32Decoder(options, codec) {
this.isLE = codec.isLE;
this.badChar = codec.iconv.defaultCharUnicode.charCodeAt(0);
this.overflow = [];
}
Utf32Decoder.prototype.write = function(src) {
if (src.length === 0)
return "";
var i = 0;
var codepoint = 0;
var dst = Buffer3.alloc(src.length + 4);
var offset = 0;
var isLE = this.isLE;
var overflow = this.overflow;
var badChar = this.badChar;
if (overflow.length > 0) {
for (; i < src.length && overflow.length < 4; i++)
overflow.push(src[i]);
if (overflow.length === 4) {
if (isLE) {
codepoint = overflow[i] | overflow[i + 1] << 8 | overflow[i + 2] << 16 | overflow[i + 3] << 24;
} else {
codepoint = overflow[i + 3] | overflow[i + 2] << 8 | overflow[i + 1] << 16 | overflow[i] << 24;
}
overflow.length = 0;
offset = _writeCodepoint(dst, offset, codepoint, badChar);
}
}
for (; i < src.length - 3; i += 4) {
if (isLE) {
codepoint = src[i] | src[i + 1] << 8 | src[i + 2] << 16 | src[i + 3] << 24;
} else {
codepoint = src[i + 3] | src[i + 2] << 8 | src[i + 1] << 16 | src[i] << 24;
}
offset = _writeCodepoint(dst, offset, codepoint, badChar);
}
for (; i < src.length; i++) {
overflow.push(src[i]);
}
return dst.slice(0, offset).toString("ucs2");
};
function _writeCodepoint(dst, offset, codepoint, badChar) {
if (codepoint < 0 || codepoint > 1114111) {
codepoint = badChar;
}
if (codepoint >= 65536) {
codepoint -= 65536;
var high = 55296 | codepoint >> 10;
dst[offset++] = high & 255;
dst[offset++] = high >> 8;
var codepoint = 56320 | codepoint & 1023;
}
dst[offset++] = codepoint & 255;
dst[offset++] = codepoint >> 8;
return offset;
}
Utf32Decoder.prototype.end = function() {
this.overflow.length = 0;
};
exports.utf32 = Utf32AutoCodec;
exports.ucs4 = "utf32";
function Utf32AutoCodec(options, iconv) {
this.iconv = iconv;
}
Utf32AutoCodec.prototype.encoder = Utf32AutoEncoder;
Utf32AutoCodec.prototype.decoder = Utf32AutoDecoder;
function Utf32AutoEncoder(options, codec) {
options = options || {};
if (options.addBOM === void 0)
options.addBOM = true;
this.encoder = codec.iconv.getEncoder(options.defaultEncoding || "utf-32le", options);
}
Utf32AutoEncoder.prototype.write = function(str) {
return this.encoder.write(str);
};
Utf32AutoEncoder.prototype.end = function() {
return this.encoder.end();
};
function Utf32AutoDecoder(options, codec) {
this.decoder = null;
this.initialBufs = [];
this.initialBufsLen = 0;
this.options = options || {};
this.iconv = codec.iconv;
}
Utf32AutoDecoder.prototype.write = function(buf) {
if (!this.decoder) {
this.initialBufs.push(buf);
this.initialBufsLen += buf.length;
if (this.initialBufsLen < 32)
return "";
var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding);
this.decoder = this.iconv.getDecoder(encoding, this.options);
var resStr = "";
for (var i = 0; i < this.initialBufs.length; i++)
resStr += this.decoder.write(this.initialBufs[i]);
this.initialBufs.length = this.initialBufsLen = 0;
return resStr;
}
return this.decoder.write(buf);
};
Utf32AutoDecoder.prototype.end = function() {
if (!this.decoder) {
var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding);
this.decoder = this.iconv.getDecoder(encoding, this.options);
var resStr = "";
for (var i = 0; i < this.initialBufs.length; i++)
resStr += this.decoder.write(this.initialBufs[i]);
var trail = this.decoder.end();
if (trail)
resStr += trail;
this.initialBufs.length = this.initialBufsLen = 0;
return resStr;
}
return this.decoder.end();
};
function detectEncoding(bufs, defaultEncoding) {
var b = [];
var charsProcessed = 0;
var invalidLE = 0, invalidBE = 0;
var bmpCharsLE = 0, bmpCharsBE = 0;
outer_loop:
for (var i = 0; i < bufs.length; i++) {
var buf = bufs[i];
for (var j = 0; j < buf.length; j++) {
b.push(buf[j]);
if (b.length === 4) {
if (charsProcessed === 0) {
if (b[0] === 255 && b[1] === 254 && b[2] === 0 && b[3] === 0) {
return "utf-32le";
}
if (b[0] === 0 && b[1] === 0 && b[2] === 254 && b[3] === 255) {
return "utf-32be";
}
}
if (b[0] !== 0 || b[1] > 16)
invalidBE++;
if (b[3] !== 0 || b[2] > 16)
invalidLE++;
if (b[0] === 0 && b[1] === 0 && (b[2] !== 0 || b[3] !== 0))
bmpCharsBE++;
if ((b[0] !== 0 || b[1] !== 0) && b[2] === 0 && b[3] === 0)
bmpCharsLE++;
b.length = 0;
charsProcessed++;
if (charsProcessed >= 100) {
break outer_loop;
}
}
}
}
if (bmpCharsBE - invalidBE > bmpCharsLE - invalidLE)
return "utf-32be";
if (bmpCharsBE - invalidBE < bmpCharsLE - invalidLE)
return "utf-32le";
return defaultEncoding || "utf-32le";
}
}
});
// node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/utf16.js
var require_utf16 = __commonJS({
"node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/utf16.js"(exports) {
"use strict";
var Buffer3 = require_safer().Buffer;
exports.utf16be = Utf16BECodec;
function Utf16BECodec() {
}
Utf16BECodec.prototype.encoder = Utf16BEEncoder;
Utf16BECodec.prototype.decoder = Utf16BEDecoder;
Utf16BECodec.prototype.bomAware = true;
function Utf16BEEncoder() {
}
Utf16BEEncoder.prototype.write = function(str) {
var buf = Buffer3.from(str, "ucs2");
for (var i = 0; i < buf.length; i += 2) {
var tmp = buf[i];
buf[i] = buf[i + 1];
buf[i + 1] = tmp;
}
return buf;
};
Utf16BEEncoder.prototype.end = function() {
};
function Utf16BEDecoder() {
this.overflowByte = -1;
}
Utf16BEDecoder.prototype.write = function(buf) {
if (buf.length == 0)
return "";
var buf2 = Buffer3.alloc(buf.length + 1), i = 0, j = 0;
if (this.overflowByte !== -1) {
buf2[0] = buf[0];
buf2[1] = this.overflowByte;
i = 1;
j = 2;
}
for (; i < buf.length - 1; i += 2, j += 2) {
buf2[j] = buf[i + 1];
buf2[j + 1] = buf[i];
}
this.overflowByte = i == buf.length - 1 ? buf[buf.length - 1] : -1;
return buf2.slice(0, j).toString("ucs2");
};
Utf16BEDecoder.prototype.end = function() {
this.overflowByte = -1;
};
exports.utf16 = Utf16Codec;
function Utf16Codec(codecOptions, iconv) {
this.iconv = iconv;
}
Utf16Codec.prototype.encoder = Utf16Encoder;
Utf16Codec.prototype.decoder = Utf16Decoder;
function Utf16Encoder(options, codec) {
options = options || {};
if (options.addBOM === void 0)
options.addBOM = true;
this.encoder = codec.iconv.getEncoder("utf-16le", options);
}
Utf16Encoder.prototype.write = function(str) {
return this.encoder.write(str);
};
Utf16Encoder.prototype.end = function() {
return this.encoder.end();
};
function Utf16Decoder(options, codec) {
this.decoder = null;
this.initialBufs = [];
this.initialBufsLen = 0;
this.options = options || {};
this.iconv = codec.iconv;
}
Utf16Decoder.prototype.write = function(buf) {
if (!this.decoder) {
this.initialBufs.push(buf);
this.initialBufsLen += buf.length;
if (this.initialBufsLen < 16)
return "";
var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding);
this.decoder = this.iconv.getDecoder(encoding, this.options);
var resStr = "";
for (var i = 0; i < this.initialBufs.length; i++)
resStr += this.decoder.write(this.initialBufs[i]);
this.initialBufs.length = this.initialBufsLen = 0;
return resStr;
}
return this.decoder.write(buf);
};
Utf16Decoder.prototype.end = function() {
if (!this.decoder) {
var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding);
this.decoder = this.iconv.getDecoder(encoding, this.options);
var resStr = "";
for (var i = 0; i < this.initialBufs.length; i++)
resStr += this.decoder.write(this.initialBufs[i]);
var trail = this.decoder.end();
if (trail)
resStr += trail;
this.initialBufs.length = this.initialBufsLen = 0;
return resStr;
}
return this.decoder.end();
};
function detectEncoding(bufs, defaultEncoding) {
var b = [];
var charsProcessed = 0;
var asciiCharsLE = 0, asciiCharsBE = 0;
outer_loop:
for (var i = 0; i < bufs.length; i++) {
var buf = bufs[i];
for (var j = 0; j < buf.length; j++) {
b.push(buf[j]);
if (b.length === 2) {
if (charsProcessed === 0) {
if (b[0] === 255 && b[1] === 254)
return "utf-16le";
if (b[0] === 254 && b[1] === 255)
return "utf-16be";
}
if (b[0] === 0 && b[1] !== 0)
asciiCharsBE++;
if (b[0] !== 0 && b[1] === 0)
asciiCharsLE++;
b.length = 0;
charsProcessed++;
if (charsProcessed >= 100) {
break outer_loop;
}
}
}
}
if (asciiCharsBE > asciiCharsLE)
return "utf-16be";
if (asciiCharsBE < asciiCharsLE)
return "utf-16le";
return defaultEncoding || "utf-16le";
}
}
});
// node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/utf7.js
var require_utf7 = __commonJS({
"node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/utf7.js"(exports) {
"use strict";
var Buffer3 = require_safer().Buffer;
exports.utf7 = Utf7Codec;
exports.unicode11utf7 = "utf7";
function Utf7Codec(codecOptions, iconv) {
this.iconv = iconv;
}
Utf7Codec.prototype.encoder = Utf7Encoder;
Utf7Codec.prototype.decoder = Utf7Decoder;
Utf7Codec.prototype.bomAware = true;
var nonDirectChars = /[^A-Za-z0-9'\(\),-\.\/:\? \n\r\t]+/g;
function Utf7Encoder(options, codec) {
this.iconv = codec.iconv;
}
Utf7Encoder.prototype.write = function(str) {
return Buffer3.from(str.replace(nonDirectChars, function(chunk) {
return "+" + (chunk === "+" ? "" : this.iconv.encode(chunk, "utf16-be").toString("base64").replace(/=+$/, "")) + "-";
}.bind(this)));
};
Utf7Encoder.prototype.end = function() {
};
function Utf7Decoder(options, codec) {
this.iconv = codec.iconv;
this.inBase64 = false;
this.base64Accum = "";
}
var base64Regex = /[A-Za-z0-9\/+]/;
var base64Chars = [];
for (i = 0; i < 256; i++)
base64Chars[i] = base64Regex.test(String.fromCharCode(i));
var i;
var plusChar = "+".charCodeAt(0);
var minusChar = "-".charCodeAt(0);
var andChar = "&".charCodeAt(0);
Utf7Decoder.prototype.write = function(buf) {
var res = "", lastI = 0, inBase64 = this.inBase64, base64Accum = this.base64Accum;
for (var i2 = 0; i2 < buf.length; i2++) {
if (!inBase64) {
if (buf[i2] == plusChar) {
res += this.iconv.decode(buf.slice(lastI, i2), "ascii");
lastI = i2 + 1;
inBase64 = true;
}
} else {
if (!base64Chars[buf[i2]]) {
if (i2 == lastI && buf[i2] == minusChar) {
res += "+";
} else {
var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i2), "ascii");
res += this.iconv.decode(Buffer3.from(b64str, "base64"), "utf16-be");
}
if (buf[i2] != minusChar)
i2--;
lastI = i2 + 1;
inBase64 = false;
base64Accum = "";
}
}
}
if (!inBase64) {
res += this.iconv.decode(buf.slice(lastI), "ascii");
} else {
var b64str = base64Accum + this.iconv.decode(buf.slice(lastI), "ascii");
var canBeDecoded = b64str.length - b64str.length % 8;
base64Accum = b64str.slice(canBeDecoded);
b64str = b64str.slice(0, canBeDecoded);
res += this.iconv.decode(Buffer3.from(b64str, "base64"), "utf16-be");
}
this.inBase64 = inBase64;
this.base64Accum = base64Accum;
return res;
};
Utf7Decoder.prototype.end = function() {
var res = "";
if (this.inBase64 && this.base64Accum.length > 0)
res = this.iconv.decode(Buffer3.from(this.base64Accum, "base64"), "utf16-be");
this.inBase64 = false;
this.base64Accum = "";
return res;
};
exports.utf7imap = Utf7IMAPCodec;
function Utf7IMAPCodec(codecOptions, iconv) {
this.iconv = iconv;
}
Utf7IMAPCodec.prototype.encoder = Utf7IMAPEncoder;
Utf7IMAPCodec.prototype.decoder = Utf7IMAPDecoder;
Utf7IMAPCodec.prototype.bomAware = true;
function Utf7IMAPEncoder(options, codec) {
this.iconv = codec.iconv;
this.inBase64 = false;
this.base64Accum = Buffer3.alloc(6);
this.base64AccumIdx = 0;
}
Utf7IMAPEncoder.prototype.write = function(str) {
var inBase64 = this.inBase64, base64Accum = this.base64Accum, base64AccumIdx = this.base64AccumIdx, buf = Buffer3.alloc(str.length * 5 + 10), bufIdx = 0;
for (var i2 = 0; i2 < str.length; i2++) {
var uChar = str.charCodeAt(i2);
if (32 <= uChar && uChar <= 126) {
if (inBase64) {
if (base64AccumIdx > 0) {
bufIdx += buf.write(base64Accum.slice(0, base64AccumIdx).toString("base64").replace(/\//g, ",").replace(/=+$/, ""), bufIdx);
base64AccumIdx = 0;
}
buf[bufIdx++] = minusChar;
inBase64 = false;
}
if (!inBase64) {
buf[bufIdx++] = uChar;
if (uChar === andChar)
buf[bufIdx++] = minusChar;
}
} else {
if (!inBase64) {
buf[bufIdx++] = andChar;
inBase64 = true;
}
if (inBase64) {
base64Accum[base64AccumIdx++] = uChar >> 8;
base64Accum[base64AccumIdx++] = uChar & 255;
if (base64AccumIdx == base64Accum.length) {
bufIdx += buf.write(base64Accum.toString("base64").replace(/\//g, ","), bufIdx);
base64AccumIdx = 0;
}
}
}
}
this.inBase64 = inBase64;
this.base64AccumIdx = base64AccumIdx;
return buf.slice(0, bufIdx);
};
Utf7IMAPEncoder.prototype.end = function() {
var buf = Buffer3.alloc(10), bufIdx = 0;
if (this.inBase64) {
if (this.base64AccumIdx > 0) {
bufIdx += buf.write(this.base64Accum.slice(0, this.base64AccumIdx).toString("base64").replace(/\//g, ",").replace(/=+$/, ""), bufIdx);
this.base64AccumIdx = 0;
}
buf[bufIdx++] = minusChar;
this.inBase64 = false;
}
return buf.slice(0, bufIdx);
};
function Utf7IMAPDecoder(options, codec) {
this.iconv = codec.iconv;
this.inBase64 = false;
this.base64Accum = "";
}
var base64IMAPChars = base64Chars.slice();
base64IMAPChars[",".charCodeAt(0)] = true;
Utf7IMAPDecoder.prototype.write = function(buf) {
var res = "", lastI = 0, inBase64 = this.inBase64, base64Accum = this.base64Accum;
for (var i2 = 0; i2 < buf.length; i2++) {
if (!inBase64) {
if (buf[i2] == andChar) {
res += this.iconv.decode(buf.slice(lastI, i2), "ascii");
lastI = i2 + 1;
inBase64 = true;
}
} else {
if (!base64IMAPChars[buf[i2]]) {
if (i2 == lastI && buf[i2] == minusChar) {
res += "&";
} else {
var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i2), "ascii").replace(/,/g, "/");
res += this.iconv.decode(Buffer3.from(b64str, "base64"), "utf16-be");
}
if (buf[i2] != minusChar)
i2--;
lastI = i2 + 1;
inBase64 = false;
base64Accum = "";
}
}
}
if (!inBase64) {
res += this.iconv.decode(buf.slice(lastI), "ascii");
} else {
var b64str = base64Accum + this.iconv.decode(buf.slice(lastI), "ascii").replace(/,/g, "/");
var canBeDecoded = b64str.length - b64str.length % 8;
base64Accum = b64str.slice(canBeDecoded);
b64str = b64str.slice(0, canBeDecoded);
res += this.iconv.decode(Buffer3.from(b64str, "base64"), "utf16-be");
}
this.inBase64 = inBase64;
this.base64Accum = base64Accum;
return res;
};
Utf7IMAPDecoder.prototype.end = function() {
var res = "";
if (this.inBase64 && this.base64Accum.length > 0)
res = this.iconv.decode(Buffer3.from(this.base64Accum, "base64"), "utf16-be");
this.inBase64 = false;
this.base64Accum = "";
return res;
};
}
});
// node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/sbcs-codec.js
var require_sbcs_codec = __commonJS({
"node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/sbcs-codec.js"(exports) {
"use strict";
var Buffer3 = require_safer().Buffer;
exports._sbcs = SBCSCodec;
function SBCSCodec(codecOptions, iconv) {
if (!codecOptions)
throw new Error("SBCS codec is called without the data.");
if (!codecOptions.chars || codecOptions.chars.length !== 128 && codecOptions.chars.length !== 256)
throw new Error("Encoding '" + codecOptions.type + "' has incorrect 'chars' (must be of len 128 or 256)");
if (codecOptions.chars.length === 128) {
var asciiString = "";
for (var i = 0; i < 128; i++)
asciiString += String.fromCharCode(i);
codecOptions.chars = asciiString + codecOptions.chars;
}
this.decodeBuf = Buffer3.from(codecOptions.chars, "ucs2");
var encodeBuf = Buffer3.alloc(65536, iconv.defaultCharSingleByte.charCodeAt(0));
for (var i = 0; i < codecOptions.chars.length; i++)
encodeBuf[codecOptions.chars.charCodeAt(i)] = i;
this.encodeBuf = encodeBuf;
}
SBCSCodec.prototype.encoder = SBCSEncoder;
SBCSCodec.prototype.decoder = SBCSDecoder;
function SBCSEncoder(options, codec) {
this.encodeBuf = codec.encodeBuf;
}
SBCSEncoder.prototype.write = function(str) {
var buf = Buffer3.alloc(str.length);
for (var i = 0; i < str.length; i++)
buf[i] = this.encodeBuf[str.charCodeAt(i)];
return buf;
};
SBCSEncoder.prototype.end = function() {
};
function SBCSDecoder(options, codec) {
this.decodeBuf = codec.decodeBuf;
}
SBCSDecoder.prototype.write = function(buf) {
var decodeBuf = this.decodeBuf;
var newBuf = Buffer3.alloc(buf.length * 2);
var idx1 = 0, idx2 = 0;
for (var i = 0; i < buf.length; i++) {
idx1 = buf[i] * 2;
idx2 = i * 2;
newBuf[idx2] = decodeBuf[idx1];
newBuf[idx2 + 1] = decodeBuf[idx1 + 1];
}
return newBuf.toString("ucs2");
};
SBCSDecoder.prototype.end = function() {
};
}
});
// node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/sbcs-data.js
var require_sbcs_data = __commonJS({
"node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/sbcs-data.js"(exports, module2) {
"use strict";
module2.exports = {
// Not supported by iconv, not sure why.
"10029": "maccenteuro",
"maccenteuro": {
"type": "_sbcs",
"chars": "\xC4\u0100\u0101\xC9\u0104\xD6\xDC\xE1\u0105\u010C\xE4\u010D\u0106\u0107\xE9\u0179\u017A\u010E\xED\u010F\u0112\u0113\u0116\xF3\u0117\xF4\xF6\xF5\xFA\u011A\u011B\xFC\u2020\xB0\u0118\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\u0119\xA8\u2260\u0123\u012E\u012F\u012A\u2264\u2265\u012B\u0136\u2202\u2211\u0142\u013B\u013C\u013D\u013E\u0139\u013A\u0145\u0146\u0143\xAC\u221A\u0144\u0147\u2206\xAB\xBB\u2026\xA0\u0148\u0150\xD5\u0151\u014C\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\u014D\u0154\u0155\u0158\u2039\u203A\u0159\u0156\u0157\u0160\u201A\u201E\u0161\u015A\u015B\xC1\u0164\u0165\xCD\u017D\u017E\u016A\xD3\xD4\u016B\u016E\xDA\u016F\u0170\u0171\u0172\u0173\xDD\xFD\u0137\u017B\u0141\u017C\u0122\u02C7"
},
"808": "cp808",
"ibm808": "cp808",
"cp808": {
"type": "_sbcs",
"chars": "\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F\u0401\u0451\u0404\u0454\u0407\u0457\u040E\u045E\xB0\u2219\xB7\u221A\u2116\u20AC\u25A0\xA0"
},
"mik": {
"type": "_sbcs",
"chars": "\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F\u2514\u2534\u252C\u251C\u2500\u253C\u2563\u2551\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2510\u2591\u2592\u2593\u2502\u2524\u2116\xA7\u2557\u255D\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"
},
"cp720": {
"type": "_sbcs",
"chars": "\x80\x81\xE9\xE2\x84\xE0\x86\xE7\xEA\xEB\xE8\xEF\xEE\x8D\x8E\x8F\x90\u0651\u0652\xF4\xA4\u0640\xFB\xF9\u0621\u0622\u0623\u0624\xA3\u0625\u0626\u0627\u0628\u0629\u062A\u062B\u062C\u062D\u062E\u062F\u0630\u0631\u0632\u0633\u0634\u0635\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u0636\u0637\u0638\u0639\u063A\u0641\xB5\u0642\u0643\u0644\u0645\u0646\u0647\u0648\u0649\u064A\u2261\u064B\u064C\u064D\u064E\u064F\u0650\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"
},
// Aliases of generated encodings.
"ascii8bit": "ascii",
"usascii": "ascii",
"ansix34": "ascii",
"ansix341968": "ascii",
"ansix341986": "ascii",
"csascii": "ascii",
"cp367": "ascii",
"ibm367": "ascii",
"isoir6": "ascii",
"iso646us": "ascii",
"iso646irv": "ascii",
"us": "ascii",
"latin1": "iso88591",
"latin2": "iso88592",
"latin3": "iso88593",
"latin4": "iso88594",
"latin5": "iso88599",
"latin6": "iso885910",
"latin7": "iso885913",
"latin8": "iso885914",
"latin9": "iso885915",
"latin10": "iso885916",
"csisolatin1": "iso88591",
"csisolatin2": "iso88592",
"csisolatin3": "iso88593",
"csisolatin4": "iso88594",
"csisolatincyrillic": "iso88595",
"csisolatinarabic": "iso88596",
"csisolatingreek": "iso88597",
"csisolatinhebrew": "iso88598",
"csisolatin5": "iso88599",
"csisolatin6": "iso885910",
"l1": "iso88591",
"l2": "iso88592",
"l3": "iso88593",
"l4": "iso88594",
"l5": "iso88599",
"l6": "iso885910",
"l7": "iso885913",
"l8": "iso885914",
"l9": "iso885915",
"l10": "iso885916",
"isoir14": "iso646jp",
"isoir57": "iso646cn",
"isoir100": "iso88591",
"isoir101": "iso88592",
"isoir109": "iso88593",
"isoir110": "iso88594",
"isoir144": "iso88595",
"isoir127": "iso88596",
"isoir126": "iso88597",
"isoir138": "iso88598",
"isoir148": "iso88599",
"isoir157": "iso885910",
"isoir166": "tis620",
"isoir179": "iso885913",
"isoir199": "iso885914",
"isoir203": "iso885915",
"isoir226": "iso885916",
"cp819": "iso88591",
"ibm819": "iso88591",
"cyrillic": "iso88595",
"arabic": "iso88596",
"arabic8": "iso88596",
"ecma114": "iso88596",
"asmo708": "iso88596",
"greek": "iso88597",
"greek8": "iso88597",
"ecma118": "iso88597",
"elot928": "iso88597",
"hebrew": "iso88598",
"hebrew8": "iso88598",
"turkish": "iso88599",
"turkish8": "iso88599",
"thai": "iso885911",
"thai8": "iso885911",
"celtic": "iso885914",
"celtic8": "iso885914",
"isoceltic": "iso885914",
"tis6200": "tis620",
"tis62025291": "tis620",
"tis62025330": "tis620",
"10000": "macroman",
"10006": "macgreek",
"10007": "maccyrillic",
"10079": "maciceland",
"10081": "macturkish",
"cspc8codepage437": "cp437",
"cspc775baltic": "cp775",
"cspc850multilingual": "cp850",
"cspcp852": "cp852",
"cspc862latinhebrew": "cp862",
"cpgr": "cp869",
"msee": "cp1250",
"mscyrl": "cp1251",
"msansi": "cp1252",
"msgreek": "cp1253",
"msturk": "cp1254",
"mshebr": "cp1255",
"msarab": "cp1256",
"winbaltrim": "cp1257",
"cp20866": "koi8r",
"20866": "koi8r",
"ibm878": "koi8r",
"cskoi8r": "koi8r",
"cp21866": "koi8u",
"21866": "koi8u",
"ibm1168": "koi8u",
"strk10482002": "rk1048",
"tcvn5712": "tcvn",
"tcvn57121": "tcvn",
"gb198880": "iso646cn",
"cn": "iso646cn",
"csiso14jisc6220ro": "iso646jp",
"jisc62201969ro": "iso646jp",
"jp": "iso646jp",
"cshproman8": "hproman8",
"r8": "hproman8",
"roman8": "hproman8",
"xroman8": "hproman8",
"ibm1051": "hproman8",
"mac": "macintosh",
"csmacintosh": "macintosh"
};
}
});
// node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/sbcs-data-generated.js
var require_sbcs_data_generated = __commonJS({
"node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/sbcs-data-generated.js"(exports, module2) {
"use strict";
module2.exports = {
"437": "cp437",
"737": "cp737",
"775": "cp775",
"850": "cp850",
"852": "cp852",
"855": "cp855",
"856": "cp856",
"857": "cp857",
"858": "cp858",
"860": "cp860",
"861": "cp861",
"862": "cp862",
"863": "cp863",
"864": "cp864",
"865": "cp865",
"866": "cp866",
"869": "cp869",
"874": "windows874",
"922": "cp922",
"1046": "cp1046",
"1124": "cp1124",
"1125": "cp1125",
"1129": "cp1129",
"1133": "cp1133",
"1161": "cp1161",
"1162": "cp1162",
"1163": "cp1163",
"1250": "windows1250",
"1251": "windows1251",
"1252": "windows1252",
"1253": "windows1253",
"1254": "windows1254",
"1255": "windows1255",
"1256": "windows1256",
"1257": "windows1257",
"1258": "windows1258",
"28591": "iso88591",
"28592": "iso88592",
"28593": "iso88593",
"28594": "iso88594",
"28595": "iso88595",
"28596": "iso88596",
"28597": "iso88597",
"28598": "iso88598",
"28599": "iso88599",
"28600": "iso885910",
"28601": "iso885911",
"28603": "iso885913",
"28604": "iso885914",
"28605": "iso885915",
"28606": "iso885916",
"windows874": {
"type": "_sbcs",
"chars": "\u20AC\uFFFD\uFFFD\uFFFD\uFFFD\u2026\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2018\u2019\u201C\u201D\u2022\u2013\u2014\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\xA0\u0E01\u0E02\u0E03\u0E04\u0E05\u0E06\u0E07\u0E08\u0E09\u0E0A\u0E0B\u0E0C\u0E0D\u0E0E\u0E0F\u0E10\u0E11\u0E12\u0E13\u0E14\u0E15\u0E16\u0E17\u0E18\u0E19\u0E1A\u0E1B\u0E1C\u0E1D\u0E1E\u0E1F\u0E20\u0E21\u0E22\u0E23\u0E24\u0E25\u0E26\u0E27\u0E28\u0E29\u0E2A\u0E2B\u0E2C\u0E2D\u0E2E\u0E2F\u0E30\u0E31\u0E32\u0E33\u0E34\u0E35\u0E36\u0E37\u0E38\u0E39\u0E3A\uFFFD\uFFFD\uFFFD\uFFFD\u0E3F\u0E40\u0E41\u0E42\u0E43\u0E44\u0E45\u0E46\u0E47\u0E48\u0E49\u0E4A\u0E4B\u0E4C\u0E4D\u0E4E\u0E4F\u0E50\u0E51\u0E52\u0E53\u0E54\u0E55\u0E56\u0E57\u0E58\u0E59\u0E5A\u0E5B\uFFFD\uFFFD\uFFFD\uFFFD"
},
"win874": "windows874",
"cp874": "windows874",
"windows1250": {
"type": "_sbcs",
"chars": "\u20AC\uFFFD\u201A\uFFFD\u201E\u2026\u2020\u2021\uFFFD\u2030\u0160\u2039\u015A\u0164\u017D\u0179\uFFFD\u2018\u2019\u201C\u201D\u2022\u2013\u2014\uFFFD\u2122\u0161\u203A\u015B\u0165\u017E\u017A\xA0\u02C7\u02D8\u0141\xA4\u0104\xA6\xA7\xA8\xA9\u015E\xAB\xAC\xAD\xAE\u017B\xB0\xB1\u02DB\u0142\xB4\xB5\xB6\xB7\xB8\u0105\u015F\xBB\u013D\u02DD\u013E\u017C\u0154\xC1\xC2\u0102\xC4\u0139\u0106\xC7\u010C\xC9\u0118\xCB\u011A\xCD\xCE\u010E\u0110\u0143\u0147\xD3\xD4\u0150\xD6\xD7\u0158\u016E\xDA\u0170\xDC\xDD\u0162\xDF\u0155\xE1\xE2\u0103\xE4\u013A\u0107\xE7\u010D\xE9\u0119\xEB\u011B\xED\xEE\u010F\u0111\u0144\u0148\xF3\xF4\u0151\xF6\xF7\u0159\u016F\xFA\u0171\xFC\xFD\u0163\u02D9"
},
"win1250": "windows1250",
"cp1250": "windows1250",
"windows1251": {
"type": "_sbcs",
"chars": "\u0402\u0403\u201A\u0453\u201E\u2026\u2020\u2021\u20AC\u2030\u0409\u2039\u040A\u040C\u040B\u040F\u0452\u2018\u2019\u201C\u201D\u2022\u2013\u2014\uFFFD\u2122\u0459\u203A\u045A\u045C\u045B\u045F\xA0\u040E\u045E\u0408\xA4\u0490\xA6\xA7\u0401\xA9\u0404\xAB\xAC\xAD\xAE\u0407\xB0\xB1\u0406\u0456\u0491\xB5\xB6\xB7\u0451\u2116\u0454\xBB\u0458\u0405\u0455\u0457\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F"
},
"win1251": "windows1251",
"cp1251": "windows1251",
"windows1252": {
"type": "_sbcs",
"chars": "\u20AC\uFFFD\u201A\u0192\u201E\u2026\u2020\u2021\u02C6\u2030\u0160\u2039\u0152\uFFFD\u017D\uFFFD\uFFFD\u2018\u2019\u201C\u201D\u2022\u2013\u2014\u02DC\u2122\u0161\u203A\u0153\uFFFD\u017E\u0178\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"
},
"win1252": "windows1252",
"cp1252": "windows1252",
"windows1253": {
"type": "_sbcs",
"chars": "\u20AC\uFFFD\u201A\u0192\u201E\u2026\u2020\u2021\uFFFD\u2030\uFFFD\u2039\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2018\u2019\u201C\u201D\u2022\u2013\u2014\uFFFD\u2122\uFFFD\u203A\uFFFD\uFFFD\uFFFD\uFFFD\xA0\u0385\u0386\xA3\xA4\xA5\xA6\xA7\xA8\xA9\uFFFD\xAB\xAC\xAD\xAE\u2015\xB0\xB1\xB2\xB3\u0384\xB5\xB6\xB7\u0388\u0389\u038A\xBB\u038C\xBD\u038E\u038F\u0390\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039A\u039B\u039C\u039D\u039E\u039F\u03A0\u03A1\uFFFD\u03A3\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9\u03AA\u03AB\u03AC\u03AD\u03AE\u03AF\u03B0\u03B1\u03B2\u03B3\u03B4\u03B5\u03B6\u03B7\u03B8\u03B9\u03BA\u03BB\u03BC\u03BD\u03BE\u03BF\u03C0\u03C1\u03C2\u03C3\u03C4\u03C5\u03C6\u03C7\u03C8\u03C9\u03CA\u03CB\u03CC\u03CD\u03CE\uFFFD"
},
"win1253": "windows1253",
"cp1253": "windows1253",
"windows1254": {
"type": "_sbcs",
"chars": "\u20AC\uFFFD\u201A\u0192\u201E\u2026\u2020\u2021\u02C6\u2030\u0160\u2039\u0152\uFFFD\uFFFD\uFFFD\uFFFD\u2018\u2019\u201C\u201D\u2022\u2013\u2014\u02DC\u2122\u0161\u203A\u0153\uFFFD\uFFFD\u0178\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\u011E\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\u0130\u015E\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\u011F\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\u0131\u015F\xFF"
},
"win1254": "windows1254",
"cp1254": "windows1254",
"windows1255": {
"type": "_sbcs",
"chars": "\u20AC\uFFFD\u201A\u0192\u201E\u2026\u2020\u2021\u02C6\u2030\uFFFD\u2039\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2018\u2019\u201C\u201D\u2022\u2013\u2014\u02DC\u2122\uFFFD\u203A\uFFFD\uFFFD\uFFFD\uFFFD\xA0\xA1\xA2\xA3\u20AA\xA5\xA6\xA7\xA8\xA9\xD7\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xF7\xBB\xBC\xBD\xBE\xBF\u05B0\u05B1\u05B2\u05B3\u05B4\u05B5\u05B6\u05B7\u05B8\u05B9\u05BA\u05BB\u05BC\u05BD\u05BE\u05BF\u05C0\u05C1\u05C2\u05C3\u05F0\u05F1\u05F2\u05F3\u05F4\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u05D0\u05D1\u05D2\u05D3\u05D4\u05D5\u05D6\u05D7\u05D8\u05D9\u05DA\u05DB\u05DC\u05DD\u05DE\u05DF\u05E0\u05E1\u05E2\u05E3\u05E4\u05E5\u05E6\u05E7\u05E8\u05E9\u05EA\uFFFD\uFFFD\u200E\u200F\uFFFD"
},
"win1255": "windows1255",
"cp1255": "windows1255",
"windows1256": {
"type": "_sbcs",
"chars": "\u20AC\u067E\u201A\u0192\u201E\u2026\u2020\u2021\u02C6\u2030\u0679\u2039\u0152\u0686\u0698\u0688\u06AF\u2018\u2019\u201C\u201D\u2022\u2013\u2014\u06A9\u2122\u0691\u203A\u0153\u200C\u200D\u06BA\xA0\u060C\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\u06BE\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\u061B\xBB\xBC\xBD\xBE\u061F\u06C1\u0621\u0622\u0623\u0624\u0625\u0626\u0627\u0628\u0629\u062A\u062B\u062C\u062D\u062E\u062F\u0630\u0631\u0632\u0633\u0634\u0635\u0636\xD7\u0637\u0638\u0639\u063A\u0640\u0641\u0642\u0643\xE0\u0644\xE2\u0645\u0646\u0647\u0648\xE7\xE8\xE9\xEA\xEB\u0649\u064A\xEE\xEF\u064B\u064C\u064D\u064E\xF4\u064F\u0650\xF7\u0651\xF9\u0652\xFB\xFC\u200E\u200F\u06D2"
},
"win1256": "windows1256",
"cp1256": "windows1256",
"windows1257": {
"type": "_sbcs",
"chars": "\u20AC\uFFFD\u201A\uFFFD\u201E\u2026\u2020\u2021\uFFFD\u2030\uFFFD\u2039\uFFFD\xA8\u02C7\xB8\uFFFD\u2018\u2019\u201C\u201D\u2022\u2013\u2014\uFFFD\u2122\uFFFD\u203A\uFFFD\xAF\u02DB\uFFFD\xA0\uFFFD\xA2\xA3\xA4\uFFFD\xA6\xA7\xD8\xA9\u0156\xAB\xAC\xAD\xAE\xC6\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xF8\xB9\u0157\xBB\xBC\xBD\xBE\xE6\u0104\u012E\u0100\u0106\xC4\xC5\u0118\u0112\u010C\xC9\u0179\u0116\u0122\u0136\u012A\u013B\u0160\u0143\u0145\xD3\u014C\xD5\xD6\xD7\u0172\u0141\u015A\u016A\xDC\u017B\u017D\xDF\u0105\u012F\u0101\u0107\xE4\xE5\u0119\u0113\u010D\xE9\u017A\u0117\u0123\u0137\u012B\u013C\u0161\u0144\u0146\xF3\u014D\xF5\xF6\xF7\u0173\u0142\u015B\u016B\xFC\u017C\u017E\u02D9"
},
"win1257": "windows1257",
"cp1257": "windows1257",
"windows1258": {
"type": "_sbcs",
"chars": "\u20AC\uFFFD\u201A\u0192\u201E\u2026\u2020\u2021\u02C6\u2030\uFFFD\u2039\u0152\uFFFD\uFFFD\uFFFD\uFFFD\u2018\u2019\u201C\u201D\u2022\u2013\u2014\u02DC\u2122\uFFFD\u203A\u0153\uFFFD\uFFFD\u0178\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\u0102\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\u0300\xCD\xCE\xCF\u0110\xD1\u0309\xD3\xD4\u01A0\xD6\xD7\xD8\xD9\xDA\xDB\xDC\u01AF\u0303\xDF\xE0\xE1\xE2\u0103\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\u0301\xED\xEE\xEF\u0111\xF1\u0323\xF3\xF4\u01A1\xF6\xF7\xF8\xF9\xFA\xFB\xFC\u01B0\u20AB\xFF"
},
"win1258": "windows1258",
"cp1258": "windows1258",
"iso88591": {
"type": "_sbcs",
"chars": "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"
},
"cp28591": "iso88591",
"iso88592": {
"type": "_sbcs",
"chars": "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\u0104\u02D8\u0141\xA4\u013D\u015A\xA7\xA8\u0160\u015E\u0164\u0179\xAD\u017D\u017B\xB0\u0105\u02DB\u0142\xB4\u013E\u015B\u02C7\xB8\u0161\u015F\u0165\u017A\u02DD\u017E\u017C\u0154\xC1\xC2\u0102\xC4\u0139\u0106\xC7\u010C\xC9\u0118\xCB\u011A\xCD\xCE\u010E\u0110\u0143\u0147\xD3\xD4\u0150\xD6\xD7\u0158\u016E\xDA\u0170\xDC\xDD\u0162\xDF\u0155\xE1\xE2\u0103\xE4\u013A\u0107\xE7\u010D\xE9\u0119\xEB\u011B\xED\xEE\u010F\u0111\u0144\u0148\xF3\xF4\u0151\xF6\xF7\u0159\u016F\xFA\u0171\xFC\xFD\u0163\u02D9"
},
"cp28592": "iso88592",
"iso88593": {
"type": "_sbcs",
"chars": "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\u0126\u02D8\xA3\xA4\uFFFD\u0124\xA7\xA8\u0130\u015E\u011E\u0134\xAD\uFFFD\u017B\xB0\u0127\xB2\xB3\xB4\xB5\u0125\xB7\xB8\u0131\u015F\u011F\u0135\xBD\uFFFD\u017C\xC0\xC1\xC2\uFFFD\xC4\u010A\u0108\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\uFFFD\xD1\xD2\xD3\xD4\u0120\xD6\xD7\u011C\xD9\xDA\xDB\xDC\u016C\u015C\xDF\xE0\xE1\xE2\uFFFD\xE4\u010B\u0109\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\uFFFD\xF1\xF2\xF3\xF4\u0121\xF6\xF7\u011D\xF9\xFA\xFB\xFC\u016D\u015D\u02D9"
},
"cp28593": "iso88593",
"iso88594": {
"type": "_sbcs",
"chars": "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\u0104\u0138\u0156\xA4\u0128\u013B\xA7\xA8\u0160\u0112\u0122\u0166\xAD\u017D\xAF\xB0\u0105\u02DB\u0157\xB4\u0129\u013C\u02C7\xB8\u0161\u0113\u0123\u0167\u014A\u017E\u014B\u0100\xC1\xC2\xC3\xC4\xC5\xC6\u012E\u010C\xC9\u0118\xCB\u0116\xCD\xCE\u012A\u0110\u0145\u014C\u0136\xD4\xD5\xD6\xD7\xD8\u0172\xDA\xDB\xDC\u0168\u016A\xDF\u0101\xE1\xE2\xE3\xE4\xE5\xE6\u012F\u010D\xE9\u0119\xEB\u0117\xED\xEE\u012B\u0111\u0146\u014D\u0137\xF4\xF5\xF6\xF7\xF8\u0173\xFA\xFB\xFC\u0169\u016B\u02D9"
},
"cp28594": "iso88594",
"iso88595": {
"type": "_sbcs",
"chars": "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\u0401\u0402\u0403\u0404\u0405\u0406\u0407\u0408\u0409\u040A\u040B\u040C\xAD\u040E\u040F\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F\u2116\u0451\u0452\u0453\u0454\u0455\u0456\u0457\u0458\u0459\u045A\u045B\u045C\xA7\u045E\u045F"
},
"cp28595": "iso88595",
"iso88596": {
"type": "_sbcs",
"chars": "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\uFFFD\uFFFD\uFFFD\xA4\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u060C\xAD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u061B\uFFFD\uFFFD\uFFFD\u061F\uFFFD\u0621\u0622\u0623\u0624\u0625\u0626\u0627\u0628\u0629\u062A\u062B\u062C\u062D\u062E\u062F\u0630\u0631\u0632\u0633\u0634\u0635\u0636\u0637\u0638\u0639\u063A\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u0640\u0641\u0642\u0643\u0644\u0645\u0646\u0647\u0648\u0649\u064A\u064B\u064C\u064D\u064E\u064F\u0650\u0651\u0652\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"
},
"cp28596": "iso88596",
"iso88597": {
"type": "_sbcs",
"chars": "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\u2018\u2019\xA3\u20AC\u20AF\xA6\xA7\xA8\xA9\u037A\xAB\xAC\xAD\uFFFD\u2015\xB0\xB1\xB2\xB3\u0384\u0385\u0386\xB7\u0388\u0389\u038A\xBB\u038C\xBD\u038E\u038F\u0390\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039A\u039B\u039C\u039D\u039E\u039F\u03A0\u03A1\uFFFD\u03A3\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9\u03AA\u03AB\u03AC\u03AD\u03AE\u03AF\u03B0\u03B1\u03B2\u03B3\u03B4\u03B5\u03B6\u03B7\u03B8\u03B9\u03BA\u03BB\u03BC\u03BD\u03BE\u03BF\u03C0\u03C1\u03C2\u03C3\u03C4\u03C5\u03C6\u03C7\u03C8\u03C9\u03CA\u03CB\u03CC\u03CD\u03CE\uFFFD"
},
"cp28597": "iso88597",
"iso88598": {
"type": "_sbcs",
"chars": "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\uFFFD\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xD7\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xF7\xBB\xBC\xBD\xBE\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2017\u05D0\u05D1\u05D2\u05D3\u05D4\u05D5\u05D6\u05D7\u05D8\u05D9\u05DA\u05DB\u05DC\u05DD\u05DE\u05DF\u05E0\u05E1\u05E2\u05E3\u05E4\u05E5\u05E6\u05E7\u05E8\u05E9\u05EA\uFFFD\uFFFD\u200E\u200F\uFFFD"
},
"cp28598": "iso88598",
"iso88599": {
"type": "_sbcs",
"chars": "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\u011E\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\u0130\u015E\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\u011F\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\u0131\u015F\xFF"
},
"cp28599": "iso88599",
"iso885910": {
"type": "_sbcs",
"chars": "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\u0104\u0112\u0122\u012A\u0128\u0136\xA7\u013B\u0110\u0160\u0166\u017D\xAD\u016A\u014A\xB0\u0105\u0113\u0123\u012B\u0129\u0137\xB7\u013C\u0111\u0161\u0167\u017E\u2015\u016B\u014B\u0100\xC1\xC2\xC3\xC4\xC5\xC6\u012E\u010C\xC9\u0118\xCB\u0116\xCD\xCE\xCF\xD0\u0145\u014C\xD3\xD4\xD5\xD6\u0168\xD8\u0172\xDA\xDB\xDC\xDD\xDE\xDF\u0101\xE1\xE2\xE3\xE4\xE5\xE6\u012F\u010D\xE9\u0119\xEB\u0117\xED\xEE\xEF\xF0\u0146\u014D\xF3\xF4\xF5\xF6\u0169\xF8\u0173\xFA\xFB\xFC\xFD\xFE\u0138"
},
"cp28600": "iso885910",
"iso885911": {
"type": "_sbcs",
"chars": "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\u0E01\u0E02\u0E03\u0E04\u0E05\u0E06\u0E07\u0E08\u0E09\u0E0A\u0E0B\u0E0C\u0E0D\u0E0E\u0E0F\u0E10\u0E11\u0E12\u0E13\u0E14\u0E15\u0E16\u0E17\u0E18\u0E19\u0E1A\u0E1B\u0E1C\u0E1D\u0E1E\u0E1F\u0E20\u0E21\u0E22\u0E23\u0E24\u0E25\u0E26\u0E27\u0E28\u0E29\u0E2A\u0E2B\u0E2C\u0E2D\u0E2E\u0E2F\u0E30\u0E31\u0E32\u0E33\u0E34\u0E35\u0E36\u0E37\u0E38\u0E39\u0E3A\uFFFD\uFFFD\uFFFD\uFFFD\u0E3F\u0E40\u0E41\u0E42\u0E43\u0E44\u0E45\u0E46\u0E47\u0E48\u0E49\u0E4A\u0E4B\u0E4C\u0E4D\u0E4E\u0E4F\u0E50\u0E51\u0E52\u0E53\u0E54\u0E55\u0E56\u0E57\u0E58\u0E59\u0E5A\u0E5B\uFFFD\uFFFD\uFFFD\uFFFD"
},
"cp28601": "iso885911",
"iso885913": {
"type": "_sbcs",
"chars": "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\u201D\xA2\xA3\xA4\u201E\xA6\xA7\xD8\xA9\u0156\xAB\xAC\xAD\xAE\xC6\xB0\xB1\xB2\xB3\u201C\xB5\xB6\xB7\xF8\xB9\u0157\xBB\xBC\xBD\xBE\xE6\u0104\u012E\u0100\u0106\xC4\xC5\u0118\u0112\u010C\xC9\u0179\u0116\u0122\u0136\u012A\u013B\u0160\u0143\u0145\xD3\u014C\xD5\xD6\xD7\u0172\u0141\u015A\u016A\xDC\u017B\u017D\xDF\u0105\u012F\u0101\u0107\xE4\xE5\u0119\u0113\u010D\xE9\u017A\u0117\u0123\u0137\u012B\u013C\u0161\u0144\u0146\xF3\u014D\xF5\xF6\xF7\u0173\u0142\u015B\u016B\xFC\u017C\u017E\u2019"
},
"cp28603": "iso885913",
"iso885914": {
"type": "_sbcs",
"chars": "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\u1E02\u1E03\xA3\u010A\u010B\u1E0A\xA7\u1E80\xA9\u1E82\u1E0B\u1EF2\xAD\xAE\u0178\u1E1E\u1E1F\u0120\u0121\u1E40\u1E41\xB6\u1E56\u1E81\u1E57\u1E83\u1E60\u1EF3\u1E84\u1E85\u1E61\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\u0174\xD1\xD2\xD3\xD4\xD5\xD6\u1E6A\xD8\xD9\xDA\xDB\xDC\xDD\u0176\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\u0175\xF1\xF2\xF3\xF4\xF5\xF6\u1E6B\xF8\xF9\xFA\xFB\xFC\xFD\u0177\xFF"
},
"cp28604": "iso885914",
"iso885915": {
"type": "_sbcs",
"chars": "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\u20AC\xA5\u0160\xA7\u0161\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\u017D\xB5\xB6\xB7\u017E\xB9\xBA\xBB\u0152\u0153\u0178\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"
},
"cp28605": "iso885915",
"iso885916": {
"type": "_sbcs",
"chars": "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\u0104\u0105\u0141\u20AC\u201E\u0160\xA7\u0161\xA9\u0218\xAB\u0179\xAD\u017A\u017B\xB0\xB1\u010C\u0142\u017D\u201D\xB6\xB7\u017E\u010D\u0219\xBB\u0152\u0153\u0178\u017C\xC0\xC1\xC2\u0102\xC4\u0106\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\u0110\u0143\xD2\xD3\xD4\u0150\xD6\u015A\u0170\xD9\xDA\xDB\xDC\u0118\u021A\xDF\xE0\xE1\xE2\u0103\xE4\u0107\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\u0111\u0144\xF2\xF3\xF4\u0151\xF6\u015B\u0171\xF9\xFA\xFB\xFC\u0119\u021B\xFF"
},
"cp28606": "iso885916",
"cp437": {
"type": "_sbcs",
"chars": "\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xA2\xA3\xA5\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"
},
"ibm437": "cp437",
"csibm437": "cp437",
"cp737": {
"type": "_sbcs",
"chars": "\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039A\u039B\u039C\u039D\u039E\u039F\u03A0\u03A1\u03A3\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9\u03B1\u03B2\u03B3\u03B4\u03B5\u03B6\u03B7\u03B8\u03B9\u03BA\u03BB\u03BC\u03BD\u03BE\u03BF\u03C0\u03C1\u03C3\u03C2\u03C4\u03C5\u03C6\u03C7\u03C8\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03C9\u03AC\u03AD\u03AE\u03CA\u03AF\u03CC\u03CD\u03CB\u03CE\u0386\u0388\u0389\u038A\u038C\u038E\u038F\xB1\u2265\u2264\u03AA\u03AB\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"
},
"ibm737": "cp737",
"csibm737": "cp737",
"cp775": {
"type": "_sbcs",
"chars": "\u0106\xFC\xE9\u0101\xE4\u0123\xE5\u0107\u0142\u0113\u0156\u0157\u012B\u0179\xC4\xC5\xC9\xE6\xC6\u014D\xF6\u0122\xA2\u015A\u015B\xD6\xDC\xF8\xA3\xD8\xD7\xA4\u0100\u012A\xF3\u017B\u017C\u017A\u201D\xA6\xA9\xAE\xAC\xBD\xBC\u0141\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u0104\u010C\u0118\u0116\u2563\u2551\u2557\u255D\u012E\u0160\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u0172\u016A\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u017D\u0105\u010D\u0119\u0117\u012F\u0161\u0173\u016B\u017E\u2518\u250C\u2588\u2584\u258C\u2590\u2580\xD3\xDF\u014C\u0143\xF5\xD5\xB5\u0144\u0136\u0137\u013B\u013C\u0146\u0112\u0145\u2019\xAD\xB1\u201C\xBE\xB6\xA7\xF7\u201E\xB0\u2219\xB7\xB9\xB3\xB2\u25A0\xA0"
},
"ibm775": "cp775",
"csibm775": "cp775",
"cp850": {
"type": "_sbcs",
"chars": "\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xF8\xA3\xD8\xD7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\xAE\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\xC1\xC2\xC0\xA9\u2563\u2551\u2557\u255D\xA2\xA5\u2510\u2514\u2534\u252C\u251C\u2500\u253C\xE3\xC3\u255A\u2554\u2569\u2566\u2560\u2550\u256C\xA4\xF0\xD0\xCA\xCB\xC8\u0131\xCD\xCE\xCF\u2518\u250C\u2588\u2584\xA6\xCC\u2580\xD3\xDF\xD4\xD2\xF5\xD5\xB5\xFE\xDE\xDA\xDB\xD9\xFD\xDD\xAF\xB4\xAD\xB1\u2017\xBE\xB6\xA7\xF7\xB8\xB0\xA8\xB7\xB9\xB3\xB2\u25A0\xA0"
},
"ibm850": "cp850",
"csibm850": "cp850",
"cp852": {
"type": "_sbcs",
"chars": "\xC7\xFC\xE9\xE2\xE4\u016F\u0107\xE7\u0142\xEB\u0150\u0151\xEE\u0179\xC4\u0106\xC9\u0139\u013A\xF4\xF6\u013D\u013E\u015A\u015B\xD6\xDC\u0164\u0165\u0141\xD7\u010D\xE1\xED\xF3\xFA\u0104\u0105\u017D\u017E\u0118\u0119\xAC\u017A\u010C\u015F\xAB\xBB\u2591\u2592\u2593\u2502\u2524\xC1\xC2\u011A\u015E\u2563\u2551\u2557\u255D\u017B\u017C\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u0102\u0103\u255A\u2554\u2569\u2566\u2560\u2550\u256C\xA4\u0111\u0110\u010E\xCB\u010F\u0147\xCD\xCE\u011B\u2518\u250C\u2588\u2584\u0162\u016E\u2580\xD3\xDF\xD4\u0143\u0144\u0148\u0160\u0161\u0154\xDA\u0155\u0170\xFD\xDD\u0163\xB4\xAD\u02DD\u02DB\u02C7\u02D8\xA7\xF7\xB8\xB0\xA8\u02D9\u0171\u0158\u0159\u25A0\xA0"
},
"ibm852": "cp852",
"csibm852": "cp852",
"cp855": {
"type": "_sbcs",
"chars": "\u0452\u0402\u0453\u0403\u0451\u0401\u0454\u0404\u0455\u0405\u0456\u0406\u0457\u0407\u0458\u0408\u0459\u0409\u045A\u040A\u045B\u040B\u045C\u040C\u045E\u040E\u045F\u040F\u044E\u042E\u044A\u042A\u0430\u0410\u0431\u0411\u0446\u0426\u0434\u0414\u0435\u0415\u0444\u0424\u0433\u0413\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u0445\u0425\u0438\u0418\u2563\u2551\u2557\u255D\u0439\u0419\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u043A\u041A\u255A\u2554\u2569\u2566\u2560\u2550\u256C\xA4\u043B\u041B\u043C\u041C\u043D\u041D\u043E\u041E\u043F\u2518\u250C\u2588\u2584\u041F\u044F\u2580\u042F\u0440\u0420\u0441\u0421\u0442\u0422\u0443\u0423\u0436\u0416\u0432\u0412\u044C\u042C\u2116\xAD\u044B\u042B\u0437\u0417\u0448\u0428\u044D\u042D\u0449\u0429\u0447\u0427\xA7\u25A0\xA0"
},
"ibm855": "cp855",
"csibm855": "cp855",
"cp856": {
"type": "_sbcs",
"chars": "\u05D0\u05D1\u05D2\u05D3\u05D4\u05D5\u05D6\u05D7\u05D8\u05D9\u05DA\u05DB\u05DC\u05DD\u05DE\u05DF\u05E0\u05E1\u05E2\u05E3\u05E4\u05E5\u05E6\u05E7\u05E8\u05E9\u05EA\uFFFD\xA3\uFFFD\xD7\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\xAE\xAC\xBD\xBC\uFFFD\xAB\xBB\u2591\u2592\u2593\u2502\u2524\uFFFD\uFFFD\uFFFD\xA9\u2563\u2551\u2557\u255D\xA2\xA5\u2510\u2514\u2534\u252C\u251C\u2500\u253C\uFFFD\uFFFD\u255A\u2554\u2569\u2566\u2560\u2550\u256C\xA4\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2518\u250C\u2588\u2584\xA6\uFFFD\u2580\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\xB5\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\xAF\xB4\xAD\xB1\u2017\xBE\xB6\xA7\xF7\xB8\xB0\xA8\xB7\xB9\xB3\xB2\u25A0\xA0"
},
"ibm856": "cp856",
"csibm856": "cp856",
"cp857": {
"type": "_sbcs",
"chars": "\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\u0131\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\u0130\xD6\xDC\xF8\xA3\xD8\u015E\u015F\xE1\xED\xF3\xFA\xF1\xD1\u011E\u011F\xBF\xAE\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\xC1\xC2\xC0\xA9\u2563\u2551\u2557\u255D\xA2\xA5\u2510\u2514\u2534\u252C\u251C\u2500\u253C\xE3\xC3\u255A\u2554\u2569\u2566\u2560\u2550\u256C\xA4\xBA\xAA\xCA\xCB\xC8\uFFFD\xCD\xCE\xCF\u2518\u250C\u2588\u2584\xA6\xCC\u2580\xD3\xDF\xD4\xD2\xF5\xD5\xB5\uFFFD\xD7\xDA\xDB\xD9\xEC\xFF\xAF\xB4\xAD\xB1\uFFFD\xBE\xB6\xA7\xF7\xB8\xB0\xA8\xB7\xB9\xB3\xB2\u25A0\xA0"
},
"ibm857": "cp857",
"csibm857": "cp857",
"cp858": {
"type": "_sbcs",
"chars": "\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xF8\xA3\xD8\xD7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\xAE\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\xC1\xC2\xC0\xA9\u2563\u2551\u2557\u255D\xA2\xA5\u2510\u2514\u2534\u252C\u251C\u2500\u253C\xE3\xC3\u255A\u2554\u2569\u2566\u2560\u2550\u256C\xA4\xF0\xD0\xCA\xCB\xC8\u20AC\xCD\xCE\xCF\u2518\u250C\u2588\u2584\xA6\xCC\u2580\xD3\xDF\xD4\xD2\xF5\xD5\xB5\xFE\xDE\xDA\xDB\xD9\xFD\xDD\xAF\xB4\xAD\xB1\u2017\xBE\xB6\xA7\xF7\xB8\xB0\xA8\xB7\xB9\xB3\xB2\u25A0\xA0"
},
"ibm858": "cp858",
"csibm858": "cp858",
"cp860": {
"type": "_sbcs",
"chars": "\xC7\xFC\xE9\xE2\xE3\xE0\xC1\xE7\xEA\xCA\xE8\xCD\xD4\xEC\xC3\xC2\xC9\xC0\xC8\xF4\xF5\xF2\xDA\xF9\xCC\xD5\xDC\xA2\xA3\xD9\u20A7\xD3\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\xD2\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"
},
"ibm860": "cp860",
"csibm860": "cp860",
"cp861": {
"type": "_sbcs",
"chars": "\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xD0\xF0\xDE\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xFE\xFB\xDD\xFD\xD6\xDC\xF8\xA3\xD8\u20A7\u0192\xE1\xED\xF3\xFA\xC1\xCD\xD3\xDA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"
},
"ibm861": "cp861",
"csibm861": "cp861",
"cp862": {
"type": "_sbcs",
"chars": "\u05D0\u05D1\u05D2\u05D3\u05D4\u05D5\u05D6\u05D7\u05D8\u05D9\u05DA\u05DB\u05DC\u05DD\u05DE\u05DF\u05E0\u05E1\u05E2\u05E3\u05E4\u05E5\u05E6\u05E7\u05E8\u05E9\u05EA\xA2\xA3\xA5\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"
},
"ibm862": "cp862",
"csibm862": "cp862",
"cp863": {
"type": "_sbcs",
"chars": "\xC7\xFC\xE9\xE2\xC2\xE0\xB6\xE7\xEA\xEB\xE8\xEF\xEE\u2017\xC0\xA7\xC9\xC8\xCA\xF4\xCB\xCF\xFB\xF9\xA4\xD4\xDC\xA2\xA3\xD9\xDB\u0192\xA6\xB4\xF3\xFA\xA8\xB8\xB3\xAF\xCE\u2310\xAC\xBD\xBC\xBE\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"
},
"ibm863": "cp863",
"csibm863": "cp863",
"cp864": {
"type": "_sbcs",
"chars": "\0\x07\b \n\v\f\r\x1B !\"#$\u066A&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7F\xB0\xB7\u2219\u221A\u2592\u2500\u2502\u253C\u2524\u252C\u251C\u2534\u2510\u250C\u2514\u2518\u03B2\u221E\u03C6\xB1\xBD\xBC\u2248\xAB\xBB\uFEF7\uFEF8\uFFFD\uFFFD\uFEFB\uFEFC\uFFFD\xA0\xAD\uFE82\xA3\xA4\uFE84\uFFFD\uFFFD\uFE8E\uFE8F\uFE95\uFE99\u060C\uFE9D\uFEA1\uFEA5\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669\uFED1\u061B\uFEB1\uFEB5\uFEB9\u061F\xA2\uFE80\uFE81\uFE83\uFE85\uFECA\uFE8B\uFE8D\uFE91\uFE93\uFE97\uFE9B\uFE9F\uFEA3\uFEA7\uFEA9\uFEAB\uFEAD\uFEAF\uFEB3\uFEB7\uFEBB\uFEBF\uFEC1\uFEC5\uFECB\uFECF\xA6\xAC\xF7\xD7\uFEC9\u0640\uFED3\uFED7\uFEDB\uFEDF\uFEE3\uFEE7\uFEEB\uFEED\uFEEF\uFEF3\uFEBD\uFECC\uFECE\uFECD\uFEE1\uFE7D\u0651\uFEE5\uFEE9\uFEEC\uFEF0\uFEF2\uFED0\uFED5\uFEF5\uFEF6\uFEDD\uFED9\uFEF1\u25A0\uFFFD"
},
"ibm864": "cp864",
"csibm864": "cp864",
"cp865": {
"type": "_sbcs",
"chars": "\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xF8\xA3\xD8\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xA4\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"
},
"ibm865": "cp865",
"csibm865": "cp865",
"cp866": {
"type": "_sbcs",
"chars": "\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F\u0401\u0451\u0404\u0454\u0407\u0457\u040E\u045E\xB0\u2219\xB7\u221A\u2116\xA4\u25A0\xA0"
},
"ibm866": "cp866",
"csibm866": "cp866",
"cp869": {
"type": "_sbcs",
"chars": "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u0386\uFFFD\xB7\xAC\xA6\u2018\u2019\u0388\u2015\u0389\u038A\u03AA\u038C\uFFFD\uFFFD\u038E\u03AB\xA9\u038F\xB2\xB3\u03AC\xA3\u03AD\u03AE\u03AF\u03CA\u0390\u03CC\u03CD\u0391\u0392\u0393\u0394\u0395\u0396\u0397\xBD\u0398\u0399\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u039A\u039B\u039C\u039D\u2563\u2551\u2557\u255D\u039E\u039F\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u03A0\u03A1\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u03A3\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9\u03B1\u03B2\u03B3\u2518\u250C\u2588\u2584\u03B4\u03B5\u2580\u03B6\u03B7\u03B8\u03B9\u03BA\u03BB\u03BC\u03BD\u03BE\u03BF\u03C0\u03C1\u03C3\u03C2\u03C4\u0384\xAD\xB1\u03C5\u03C6\u03C7\xA7\u03C8\u0385\xB0\xA8\u03C9\u03CB\u03B0\u03CE\u25A0\xA0"
},
"ibm869": "cp869",
"csibm869": "cp869",
"cp922": {
"type": "_sbcs",
"chars": "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\u203E\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\u0160\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\u017D\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\u0161\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\u017E\xFF"
},
"ibm922": "cp922",
"csibm922": "cp922",
"cp1046": {
"type": "_sbcs",
"chars": "\uFE88\xD7\xF7\uF8F6\uF8F5\uF8F4\uF8F7\uFE71\x88\u25A0\u2502\u2500\u2510\u250C\u2514\u2518\uFE79\uFE7B\uFE7D\uFE7F\uFE77\uFE8A\uFEF0\uFEF3\uFEF2\uFECE\uFECF\uFED0\uFEF6\uFEF8\uFEFA\uFEFC\xA0\uF8FA\uF8F9\uF8F8\xA4\uF8FB\uFE8B\uFE91\uFE97\uFE9B\uFE9F\uFEA3\u060C\xAD\uFEA7\uFEB3\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669\uFEB7\u061B\uFEBB\uFEBF\uFECA\u061F\uFECB\u0621\u0622\u0623\u0624\u0625\u0626\u0627\u0628\u0629\u062A\u062B\u062C\u062D\u062E\u062F\u0630\u0631\u0632\u0633\u0634\u0635\u0636\u0637\uFEC7\u0639\u063A\uFECC\uFE82\uFE84\uFE8E\uFED3\u0640\u0641\u0642\u0643\u0644\u0645\u0646\u0647\u0648\u0649\u064A\u064B\u064C\u064D\u064E\u064F\u0650\u0651\u0652\uFED7\uFEDB\uFEDF\uF8FC\uFEF5\uFEF7\uFEF9\uFEFB\uFEE3\uFEE7\uFEEC\uFEE9\uFFFD"
},
"ibm1046": "cp1046",
"csibm1046": "cp1046",
"cp1124": {
"type": "_sbcs",
"chars": "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\u0401\u0402\u0490\u0404\u0405\u0406\u0407\u0408\u0409\u040A\u040B\u040C\xAD\u040E\u040F\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F\u2116\u0451\u0452\u0491\u0454\u0455\u0456\u0457\u0458\u0459\u045A\u045B\u045C\xA7\u045E\u045F"
},
"ibm1124": "cp1124",
"csibm1124": "cp1124",
"cp1125": {
"type": "_sbcs",
"chars": "\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F\u0401\u0451\u0490\u0491\u0404\u0454\u0406\u0456\u0407\u0457\xB7\u221A\u2116\xA4\u25A0\xA0"
},
"ibm1125": "cp1125",
"csibm1125": "cp1125",
"cp1129": {
"type": "_sbcs",
"chars": "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\u0153\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\u0178\xB5\xB6\xB7\u0152\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\u0102\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\u0300\xCD\xCE\xCF\u0110\xD1\u0309\xD3\xD4\u01A0\xD6\xD7\xD8\xD9\xDA\xDB\xDC\u01AF\u0303\xDF\xE0\xE1\xE2\u0103\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\u0301\xED\xEE\xEF\u0111\xF1\u0323\xF3\xF4\u01A1\xF6\xF7\xF8\xF9\xFA\xFB\xFC\u01B0\u20AB\xFF"
},
"ibm1129": "cp1129",
"csibm1129": "cp1129",
"cp1133": {
"type": "_sbcs",
"chars": "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\u0E81\u0E82\u0E84\u0E87\u0E88\u0EAA\u0E8A\u0E8D\u0E94\u0E95\u0E96\u0E97\u0E99\u0E9A\u0E9B\u0E9C\u0E9D\u0E9E\u0E9F\u0EA1\u0EA2\u0EA3\u0EA5\u0EA7\u0EAB\u0EAD\u0EAE\uFFFD\uFFFD\uFFFD\u0EAF\u0EB0\u0EB2\u0EB3\u0EB4\u0EB5\u0EB6\u0EB7\u0EB8\u0EB9\u0EBC\u0EB1\u0EBB\u0EBD\uFFFD\uFFFD\uFFFD\u0EC0\u0EC1\u0EC2\u0EC3\u0EC4\u0EC8\u0EC9\u0ECA\u0ECB\u0ECC\u0ECD\u0EC6\uFFFD\u0EDC\u0EDD\u20AD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u0ED0\u0ED1\u0ED2\u0ED3\u0ED4\u0ED5\u0ED6\u0ED7\u0ED8\u0ED9\uFFFD\uFFFD\xA2\xAC\xA6\uFFFD"
},
"ibm1133": "cp1133",
"csibm1133": "cp1133",
"cp1161": {
"type": "_sbcs",
"chars": "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u0E48\u0E01\u0E02\u0E03\u0E04\u0E05\u0E06\u0E07\u0E08\u0E09\u0E0A\u0E0B\u0E0C\u0E0D\u0E0E\u0E0F\u0E10\u0E11\u0E12\u0E13\u0E14\u0E15\u0E16\u0E17\u0E18\u0E19\u0E1A\u0E1B\u0E1C\u0E1D\u0E1E\u0E1F\u0E20\u0E21\u0E22\u0E23\u0E24\u0E25\u0E26\u0E27\u0E28\u0E29\u0E2A\u0E2B\u0E2C\u0E2D\u0E2E\u0E2F\u0E30\u0E31\u0E32\u0E33\u0E34\u0E35\u0E36\u0E37\u0E38\u0E39\u0E3A\u0E49\u0E4A\u0E4B\u20AC\u0E3F\u0E40\u0E41\u0E42\u0E43\u0E44\u0E45\u0E46\u0E47\u0E48\u0E49\u0E4A\u0E4B\u0E4C\u0E4D\u0E4E\u0E4F\u0E50\u0E51\u0E52\u0E53\u0E54\u0E55\u0E56\u0E57\u0E58\u0E59\u0E5A\u0E5B\xA2\xAC\xA6\xA0"
},
"ibm1161": "cp1161",
"csibm1161": "cp1161",
"cp1162": {
"type": "_sbcs",
"chars": "\u20AC\x81\x82\x83\x84\u2026\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\u2018\u2019\u201C\u201D\u2022\u2013\u2014\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\u0E01\u0E02\u0E03\u0E04\u0E05\u0E06\u0E07\u0E08\u0E09\u0E0A\u0E0B\u0E0C\u0E0D\u0E0E\u0E0F\u0E10\u0E11\u0E12\u0E13\u0E14\u0E15\u0E16\u0E17\u0E18\u0E19\u0E1A\u0E1B\u0E1C\u0E1D\u0E1E\u0E1F\u0E20\u0E21\u0E22\u0E23\u0E24\u0E25\u0E26\u0E27\u0E28\u0E29\u0E2A\u0E2B\u0E2C\u0E2D\u0E2E\u0E2F\u0E30\u0E31\u0E32\u0E33\u0E34\u0E35\u0E36\u0E37\u0E38\u0E39\u0E3A\uFFFD\uFFFD\uFFFD\uFFFD\u0E3F\u0E40\u0E41\u0E42\u0E43\u0E44\u0E45\u0E46\u0E47\u0E48\u0E49\u0E4A\u0E4B\u0E4C\u0E4D\u0E4E\u0E4F\u0E50\u0E51\u0E52\u0E53\u0E54\u0E55\u0E56\u0E57\u0E58\u0E59\u0E5A\u0E5B\uFFFD\uFFFD\uFFFD\uFFFD"
},
"ibm1162": "cp1162",
"csibm1162": "cp1162",
"cp1163": {
"type": "_sbcs",
"chars": "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\u20AC\xA5\xA6\xA7\u0153\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\u0178\xB5\xB6\xB7\u0152\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\u0102\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\u0300\xCD\xCE\xCF\u0110\xD1\u0309\xD3\xD4\u01A0\xD6\xD7\xD8\xD9\xDA\xDB\xDC\u01AF\u0303\xDF\xE0\xE1\xE2\u0103\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\u0301\xED\xEE\xEF\u0111\xF1\u0323\xF3\xF4\u01A1\xF6\xF7\xF8\xF9\xFA\xFB\xFC\u01B0\u20AB\xFF"
},
"ibm1163": "cp1163",
"csibm1163": "cp1163",
"maccroatian": {
"type": "_sbcs",
"chars": "\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\u2020\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\u0160\u2122\xB4\xA8\u2260\u017D\xD8\u221E\xB1\u2264\u2265\u2206\xB5\u2202\u2211\u220F\u0161\u222B\xAA\xBA\u2126\u017E\xF8\xBF\xA1\xAC\u221A\u0192\u2248\u0106\xAB\u010C\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u0110\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\uFFFD\xA9\u2044\xA4\u2039\u203A\xC6\xBB\u2013\xB7\u201A\u201E\u2030\xC2\u0107\xC1\u010D\xC8\xCD\xCE\xCF\xCC\xD3\xD4\u0111\xD2\xDA\xDB\xD9\u0131\u02C6\u02DC\xAF\u03C0\xCB\u02DA\xB8\xCA\xE6\u02C7"
},
"maccyrillic": {
"type": "_sbcs",
"chars": "\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u2020\xB0\xA2\xA3\xA7\u2022\xB6\u0406\xAE\xA9\u2122\u0402\u0452\u2260\u0403\u0453\u221E\xB1\u2264\u2265\u0456\xB5\u2202\u0408\u0404\u0454\u0407\u0457\u0409\u0459\u040A\u045A\u0458\u0405\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\u040B\u045B\u040C\u045C\u0455\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u201E\u040E\u045E\u040F\u045F\u2116\u0401\u0451\u044F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\xA4"
},
"macgreek": {
"type": "_sbcs",
"chars": "\xC4\xB9\xB2\xC9\xB3\xD6\xDC\u0385\xE0\xE2\xE4\u0384\xA8\xE7\xE9\xE8\xEA\xEB\xA3\u2122\xEE\xEF\u2022\xBD\u2030\xF4\xF6\xA6\xAD\xF9\xFB\xFC\u2020\u0393\u0394\u0398\u039B\u039E\u03A0\xDF\xAE\xA9\u03A3\u03AA\xA7\u2260\xB0\u0387\u0391\xB1\u2264\u2265\xA5\u0392\u0395\u0396\u0397\u0399\u039A\u039C\u03A6\u03AB\u03A8\u03A9\u03AC\u039D\xAC\u039F\u03A1\u2248\u03A4\xAB\xBB\u2026\xA0\u03A5\u03A7\u0386\u0388\u0153\u2013\u2015\u201C\u201D\u2018\u2019\xF7\u0389\u038A\u038C\u038E\u03AD\u03AE\u03AF\u03CC\u038F\u03CD\u03B1\u03B2\u03C8\u03B4\u03B5\u03C6\u03B3\u03B7\u03B9\u03BE\u03BA\u03BB\u03BC\u03BD\u03BF\u03C0\u03CE\u03C1\u03C3\u03C4\u03B8\u03C9\u03C2\u03C7\u03C5\u03B6\u03CA\u03CB\u0390\u03B0\uFFFD"
},
"maciceland": {
"type": "_sbcs",
"chars": "\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\xDD\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\xB4\xA8\u2260\xC6\xD8\u221E\xB1\u2264\u2265\xA5\xB5\u2202\u2211\u220F\u03C0\u222B\xAA\xBA\u2126\xE6\xF8\xBF\xA1\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\xFF\u0178\u2044\xA4\xD0\xF0\xDE\xFE\xFD\xB7\u201A\u201E\u2030\xC2\xCA\xC1\xCB\xC8\xCD\xCE\xCF\xCC\xD3\xD4\uFFFD\xD2\xDA\xDB\xD9\u0131\u02C6\u02DC\xAF\u02D8\u02D9\u02DA\xB8\u02DD\u02DB\u02C7"
},
"macroman": {
"type": "_sbcs",
"chars": "\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\u2020\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\xB4\xA8\u2260\xC6\xD8\u221E\xB1\u2264\u2265\xA5\xB5\u2202\u2211\u220F\u03C0\u222B\xAA\xBA\u2126\xE6\xF8\xBF\xA1\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\xFF\u0178\u2044\xA4\u2039\u203A\uFB01\uFB02\u2021\xB7\u201A\u201E\u2030\xC2\xCA\xC1\xCB\xC8\xCD\xCE\xCF\xCC\xD3\xD4\uFFFD\xD2\xDA\xDB\xD9\u0131\u02C6\u02DC\xAF\u02D8\u02D9\u02DA\xB8\u02DD\u02DB\u02C7"
},
"macromania": {
"type": "_sbcs",
"chars": "\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\u2020\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\xB4\xA8\u2260\u0102\u015E\u221E\xB1\u2264\u2265\xA5\xB5\u2202\u2211\u220F\u03C0\u222B\xAA\xBA\u2126\u0103\u015F\xBF\xA1\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\xFF\u0178\u2044\xA4\u2039\u203A\u0162\u0163\u2021\xB7\u201A\u201E\u2030\xC2\xCA\xC1\xCB\xC8\xCD\xCE\xCF\xCC\xD3\xD4\uFFFD\xD2\xDA\xDB\xD9\u0131\u02C6\u02DC\xAF\u02D8\u02D9\u02DA\xB8\u02DD\u02DB\u02C7"
},
"macthai": {
"type": "_sbcs",
"chars": "\xAB\xBB\u2026\uF88C\uF88F\uF892\uF895\uF898\uF88B\uF88E\uF891\uF894\uF897\u201C\u201D\uF899\uFFFD\u2022\uF884\uF889\uF885\uF886\uF887\uF888\uF88A\uF88D\uF890\uF893\uF896\u2018\u2019\uFFFD\xA0\u0E01\u0E02\u0E03\u0E04\u0E05\u0E06\u0E07\u0E08\u0E09\u0E0A\u0E0B\u0E0C\u0E0D\u0E0E\u0E0F\u0E10\u0E11\u0E12\u0E13\u0E14\u0E15\u0E16\u0E17\u0E18\u0E19\u0E1A\u0E1B\u0E1C\u0E1D\u0E1E\u0E1F\u0E20\u0E21\u0E22\u0E23\u0E24\u0E25\u0E26\u0E27\u0E28\u0E29\u0E2A\u0E2B\u0E2C\u0E2D\u0E2E\u0E2F\u0E30\u0E31\u0E32\u0E33\u0E34\u0E35\u0E36\u0E37\u0E38\u0E39\u0E3A\uFEFF\u200B\u2013\u2014\u0E3F\u0E40\u0E41\u0E42\u0E43\u0E44\u0E45\u0E46\u0E47\u0E48\u0E49\u0E4A\u0E4B\u0E4C\u0E4D\u2122\u0E4F\u0E50\u0E51\u0E52\u0E53\u0E54\u0E55\u0E56\u0E57\u0E58\u0E59\xAE\xA9\uFFFD\uFFFD\uFFFD\uFFFD"
},
"macturkish": {
"type": "_sbcs",
"chars": "\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\u2020\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\xB4\xA8\u2260\xC6\xD8\u221E\xB1\u2264\u2265\xA5\xB5\u2202\u2211\u220F\u03C0\u222B\xAA\xBA\u2126\xE6\xF8\xBF\xA1\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\xFF\u0178\u011E\u011F\u0130\u0131\u015E\u015F\u2021\xB7\u201A\u201E\u2030\xC2\xCA\xC1\xCB\xC8\xCD\xCE\xCF\xCC\xD3\xD4\uFFFD\xD2\xDA\xDB\xD9\uFFFD\u02C6\u02DC\xAF\u02D8\u02D9\u02DA\xB8\u02DD\u02DB\u02C7"
},
"macukraine": {
"type": "_sbcs",
"chars": "\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u2020\xB0\u0490\xA3\xA7\u2022\xB6\u0406\xAE\xA9\u2122\u0402\u0452\u2260\u0403\u0453\u221E\xB1\u2264\u2265\u0456\xB5\u0491\u0408\u0404\u0454\u0407\u0457\u0409\u0459\u040A\u045A\u0458\u0405\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\u040B\u045B\u040C\u045C\u0455\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u201E\u040E\u045E\u040F\u045F\u2116\u0401\u0451\u044F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\xA4"
},
"koi8r": {
"type": "_sbcs",
"chars": "\u2500\u2502\u250C\u2510\u2514\u2518\u251C\u2524\u252C\u2534\u253C\u2580\u2584\u2588\u258C\u2590\u2591\u2592\u2593\u2320\u25A0\u2219\u221A\u2248\u2264\u2265\xA0\u2321\xB0\xB2\xB7\xF7\u2550\u2551\u2552\u0451\u2553\u2554\u2555\u2556\u2557\u2558\u2559\u255A\u255B\u255C\u255D\u255E\u255F\u2560\u2561\u0401\u2562\u2563\u2564\u2565\u2566\u2567\u2568\u2569\u256A\u256B\u256C\xA9\u044E\u0430\u0431\u0446\u0434\u0435\u0444\u0433\u0445\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u044F\u0440\u0441\u0442\u0443\u0436\u0432\u044C\u044B\u0437\u0448\u044D\u0449\u0447\u044A\u042E\u0410\u0411\u0426\u0414\u0415\u0424\u0413\u0425\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u042F\u0420\u0421\u0422\u0423\u0416\u0412\u042C\u042B\u0417\u0428\u042D\u0429\u0427\u042A"
},
"koi8u": {
"type": "_sbcs",
"chars": "\u2500\u2502\u250C\u2510\u2514\u2518\u251C\u2524\u252C\u2534\u253C\u2580\u2584\u2588\u258C\u2590\u2591\u2592\u2593\u2320\u25A0\u2219\u221A\u2248\u2264\u2265\xA0\u2321\xB0\xB2\xB7\xF7\u2550\u2551\u2552\u0451\u0454\u2554\u0456\u0457\u2557\u2558\u2559\u255A\u255B\u0491\u255D\u255E\u255F\u2560\u2561\u0401\u0404\u2563\u0406\u0407\u2566\u2567\u2568\u2569\u256A\u0490\u256C\xA9\u044E\u0430\u0431\u0446\u0434\u0435\u0444\u0433\u0445\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u044F\u0440\u0441\u0442\u0443\u0436\u0432\u044C\u044B\u0437\u0448\u044D\u0449\u0447\u044A\u042E\u0410\u0411\u0426\
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment