| Current Path : /proc/1908984/task/1908984/root/proc/2897192/root/tmp/ |
| Current File : //proc/1908984/task/1908984/root/proc/2897192/root/tmp/phpK1079b |
"use strict";
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 = (fn2, res) => function __init() {
return fn2 && (res = (0, fn2[__getOwnPropNames(fn2)[0]])(fn2 = 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 name2 in all)
__defProp(target, name2, { get: all[name2], enumerable: true });
};
var __copyProps = (to, from, except, desc2) => {
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: !(desc2 = __getOwnPropDesc(from, key)) || desc2.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);
// .yarn/cache/typanion-npm-3.14.0-8af344c436-8b03b19844.zip/node_modules/typanion/lib/index.mjs
var lib_exports = {};
__export(lib_exports, {
KeyRelationship: () => KeyRelationship,
TypeAssertionError: () => TypeAssertionError,
applyCascade: () => applyCascade,
as: () => as,
assert: () => assert,
assertWithErrors: () => assertWithErrors,
cascade: () => cascade,
fn: () => fn,
hasAtLeastOneKey: () => hasAtLeastOneKey,
hasExactLength: () => hasExactLength,
hasForbiddenKeys: () => hasForbiddenKeys,
hasKeyRelationship: () => hasKeyRelationship,
hasMaxLength: () => hasMaxLength,
hasMinLength: () => hasMinLength,
hasMutuallyExclusiveKeys: () => hasMutuallyExclusiveKeys,
hasRequiredKeys: () => hasRequiredKeys,
hasUniqueItems: () => hasUniqueItems,
isArray: () => isArray,
isAtLeast: () => isAtLeast,
isAtMost: () => isAtMost,
isBase64: () => isBase64,
isBoolean: () => isBoolean,
isDate: () => isDate,
isDict: () => isDict,
isEnum: () => isEnum,
isHexColor: () => isHexColor,
isISO8601: () => isISO8601,
isInExclusiveRange: () => isInExclusiveRange,
isInInclusiveRange: () => isInInclusiveRange,
isInstanceOf: () => isInstanceOf,
isInteger: () => isInteger,
isJSON: () => isJSON,
isLiteral: () => isLiteral,
isLowerCase: () => isLowerCase,
isMap: () => isMap,
isNegative: () => isNegative,
isNullable: () => isNullable,
isNumber: () => isNumber,
isObject: () => isObject,
isOneOf: () => isOneOf,
isOptional: () => isOptional,
isPartial: () => isPartial,
isPayload: () => isPayload,
isPositive: () => isPositive,
isRecord: () => isRecord,
isSet: () => isSet,
isString: () => isString,
isTuple: () => isTuple,
isUUID4: () => isUUID4,
isUnknown: () => isUnknown,
isUpperCase: () => isUpperCase,
makeTrait: () => makeTrait,
makeValidator: () => makeValidator,
matchesRegExp: () => matchesRegExp,
softAssert: () => softAssert
});
function getPrintable(value) {
if (value === null)
return `null`;
if (value === void 0)
return `undefined`;
if (value === ``)
return `an empty string`;
if (typeof value === "symbol")
return `<${value.toString()}>`;
if (Array.isArray(value))
return `an array`;
return JSON.stringify(value);
}
function getPrintableArray(value, conjunction) {
if (value.length === 0)
return `nothing`;
if (value.length === 1)
return getPrintable(value[0]);
const rest = value.slice(0, -1);
const trailing = value[value.length - 1];
const separator = value.length > 2 ? `, ${conjunction} ` : ` ${conjunction} `;
return `${rest.map((value2) => getPrintable(value2)).join(`, `)}${separator}${getPrintable(trailing)}`;
}
function computeKey(state, key) {
var _a, _b, _c;
if (typeof key === `number`) {
return `${(_a = state === null || state === void 0 ? void 0 : state.p) !== null && _a !== void 0 ? _a : `.`}[${key}]`;
} else if (simpleKeyRegExp.test(key)) {
return `${(_b = state === null || state === void 0 ? void 0 : state.p) !== null && _b !== void 0 ? _b : ``}.${key}`;
} else {
return `${(_c = state === null || state === void 0 ? void 0 : state.p) !== null && _c !== void 0 ? _c : `.`}[${JSON.stringify(key)}]`;
}
}
function plural(n, singular, plural2) {
return n === 1 ? singular : plural2;
}
function pushError({ errors, p } = {}, message) {
errors === null || errors === void 0 ? void 0 : errors.push(`${p !== null && p !== void 0 ? p : `.`}: ${message}`);
return false;
}
function makeSetter(target, key) {
return (v) => {
target[key] = v;
};
}
function makeCoercionFn(target, key) {
return (v) => {
const previous = target[key];
target[key] = v;
return makeCoercionFn(target, key).bind(null, previous);
};
}
function makeLazyCoercionFn(fn2, orig, generator) {
const commit = () => {
fn2(generator());
return revert;
};
const revert = () => {
fn2(orig);
return commit;
};
return commit;
}
function isUnknown() {
return makeValidator({
test: (value, state) => {
return true;
}
});
}
function isLiteral(expected) {
return makeValidator({
test: (value, state) => {
if (value !== expected)
return pushError(state, `Expected ${getPrintable(expected)} (got ${getPrintable(value)})`);
return true;
}
});
}
function isString() {
return makeValidator({
test: (value, state) => {
if (typeof value !== `string`)
return pushError(state, `Expected a string (got ${getPrintable(value)})`);
return true;
}
});
}
function isEnum(enumSpec) {
const valuesArray = Array.isArray(enumSpec) ? enumSpec : Object.values(enumSpec);
const isAlphaNum = valuesArray.every((item) => typeof item === "string" || typeof item === "number");
const values = new Set(valuesArray);
if (values.size === 1)
return isLiteral([...values][0]);
return makeValidator({
test: (value, state) => {
if (!values.has(value)) {
if (isAlphaNum) {
return pushError(state, `Expected one of ${getPrintableArray(valuesArray, `or`)} (got ${getPrintable(value)})`);
} else {
return pushError(state, `Expected a valid enumeration value (got ${getPrintable(value)})`);
}
}
return true;
}
});
}
function isBoolean() {
return makeValidator({
test: (value, state) => {
var _a;
if (typeof value !== `boolean`) {
if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {
if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)
return pushError(state, `Unbound coercion result`);
const coercion = BOOLEAN_COERCIONS.get(value);
if (typeof coercion !== `undefined`) {
state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, state.coercion.bind(null, coercion)]);
return true;
}
}
return pushError(state, `Expected a boolean (got ${getPrintable(value)})`);
}
return true;
}
});
}
function isNumber() {
return makeValidator({
test: (value, state) => {
var _a;
if (typeof value !== `number`) {
if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {
if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)
return pushError(state, `Unbound coercion result`);
let coercion;
if (typeof value === `string`) {
let val;
try {
val = JSON.parse(value);
} catch (_b) {
}
if (typeof val === `number`) {
if (JSON.stringify(val) === value) {
coercion = val;
} else {
return pushError(state, `Received a number that can't be safely represented by the runtime (${value})`);
}
}
}
if (typeof coercion !== `undefined`) {
state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, state.coercion.bind(null, coercion)]);
return true;
}
}
return pushError(state, `Expected a number (got ${getPrintable(value)})`);
}
return true;
}
});
}
function isPayload(spec) {
return makeValidator({
test: (value, state) => {
var _a;
if (typeof (state === null || state === void 0 ? void 0 : state.coercions) === `undefined`)
return pushError(state, `The isPayload predicate can only be used with coercion enabled`);
if (typeof state.coercion === `undefined`)
return pushError(state, `Unbound coercion result`);
if (typeof value !== `string`)
return pushError(state, `Expected a string (got ${getPrintable(value)})`);
let inner;
try {
inner = JSON.parse(value);
} catch (_b) {
return pushError(state, `Expected a JSON string (got ${getPrintable(value)})`);
}
const wrapper = { value: inner };
if (!spec(inner, Object.assign(Object.assign({}, state), { coercion: makeCoercionFn(wrapper, `value`) })))
return false;
state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, state.coercion.bind(null, wrapper.value)]);
return true;
}
});
}
function isDate() {
return makeValidator({
test: (value, state) => {
var _a;
if (!(value instanceof Date)) {
if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {
if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)
return pushError(state, `Unbound coercion result`);
let coercion;
if (typeof value === `string` && iso8601RegExp.test(value)) {
coercion = new Date(value);
} else {
let timestamp;
if (typeof value === `string`) {
let val;
try {
val = JSON.parse(value);
} catch (_b) {
}
if (typeof val === `number`) {
timestamp = val;
}
} else if (typeof value === `number`) {
timestamp = value;
}
if (typeof timestamp !== `undefined`) {
if (Number.isSafeInteger(timestamp) || !Number.isSafeInteger(timestamp * 1e3)) {
coercion = new Date(timestamp * 1e3);
} else {
return pushError(state, `Received a timestamp that can't be safely represented by the runtime (${value})`);
}
}
}
if (typeof coercion !== `undefined`) {
state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, state.coercion.bind(null, coercion)]);
return true;
}
}
return pushError(state, `Expected a date (got ${getPrintable(value)})`);
}
return true;
}
});
}
function isArray(spec, { delimiter } = {}) {
return makeValidator({
test: (value, state) => {
var _a;
const originalValue = value;
if (typeof value === `string` && typeof delimiter !== `undefined`) {
if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {
if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)
return pushError(state, `Unbound coercion result`);
value = value.split(delimiter);
}
}
if (!Array.isArray(value))
return pushError(state, `Expected an array (got ${getPrintable(value)})`);
let valid = true;
for (let t = 0, T = value.length; t < T; ++t) {
valid = spec(value[t], Object.assign(Object.assign({}, state), { p: computeKey(state, t), coercion: makeCoercionFn(value, t) })) && valid;
if (!valid && (state === null || state === void 0 ? void 0 : state.errors) == null) {
break;
}
}
if (value !== originalValue)
state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, state.coercion.bind(null, value)]);
return valid;
}
});
}
function isSet(spec, { delimiter } = {}) {
const isArrayValidator = isArray(spec, { delimiter });
return makeValidator({
test: (value, state) => {
var _a, _b;
if (Object.getPrototypeOf(value).toString() === `[object Set]`) {
if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {
if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)
return pushError(state, `Unbound coercion result`);
const originalValues = [...value];
const coercedValues = [...value];
if (!isArrayValidator(coercedValues, Object.assign(Object.assign({}, state), { coercion: void 0 })))
return false;
const updateValue = () => coercedValues.some((val, t) => val !== originalValues[t]) ? new Set(coercedValues) : value;
state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, makeLazyCoercionFn(state.coercion, value, updateValue)]);
return true;
} else {
let valid = true;
for (const subValue of value) {
valid = spec(subValue, Object.assign({}, state)) && valid;
if (!valid && (state === null || state === void 0 ? void 0 : state.errors) == null) {
break;
}
}
return valid;
}
}
if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {
if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)
return pushError(state, `Unbound coercion result`);
const store = { value };
if (!isArrayValidator(value, Object.assign(Object.assign({}, state), { coercion: makeCoercionFn(store, `value`) })))
return false;
state.coercions.push([(_b = state.p) !== null && _b !== void 0 ? _b : `.`, makeLazyCoercionFn(state.coercion, value, () => new Set(store.value))]);
return true;
}
return pushError(state, `Expected a set (got ${getPrintable(value)})`);
}
});
}
function isMap(keySpec, valueSpec) {
const isArrayValidator = isArray(isTuple([keySpec, valueSpec]));
const isRecordValidator = isRecord(valueSpec, { keys: keySpec });
return makeValidator({
test: (value, state) => {
var _a, _b, _c;
if (Object.getPrototypeOf(value).toString() === `[object Map]`) {
if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) {
if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`)
return pushError(state, `Unbound coercion result`);
const originalValues = [...value];
const coercedValues = [...value];
if (!isArrayValidator(coercedValues, Object.assign(Object.assign({}, state), { coercion: void 0 })))
return false;
const updateValue = () => coercedValues.some((val, t) => val[0] !== originalValues[t][0] || val[1] !== originalValues[t][1]) ? new Map(coercedValues) : value;
state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, makeLazyCoercionFn(state.coercion, value, updateValue)]);
return true;
} else {
let valid = true;
for (const [key, subValue] of value) {
valid = keySpec(key, Object.assign({}, state)) && valid;
if (!valid && (state === null || state === void 0