/* eslint-disable @typescript-eslint/ban-ts-comment */
// #region Imports
// #endregion
/**
 * @internal
 */
export function toErros(errors) {
    const result = {};
    errors.forEach((errorTuple) => {
        if (errorTuple === null) {
            return;
        }
        if (errorTuple[0]) {
            Object.keys(errorTuple[0]).forEach((key) => {
                // @ts-ignore
                const error = errorTuple[0][key];
                if (typeof error === 'boolean') {
                    result[key] = [error, errorTuple[1] ?? ''];
                }
                else if (Array.isArray(error)) {
                    result[key] = [error[0], errorTuple[1] ?? ''];
                }
            });
        }
    });
    return result;
}
/**
 * @internal
 */
export function toValidation(errors) {
    const result = {
        badInput: false,
        customError: false,
        patternMismatch: false,
        rangeOverflow: false,
        rangeUnderflow: false,
        stepMismatch: false,
        tooLong: false,
        tooShort: false,
        typeMismatch: false,
        valueMissing: false
    };
    Object.entries(errors).forEach(([key, value]) => {
        result[key] = value[0];
    });
    return result;
}
//# sourceMappingURL=Utils.js.map