"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.pullSecretValidationSchema = void 0;
const tslib_1 = require("tslib");
const Yup = tslib_1.__importStar(require("yup"));
const pullSecretValidationSchema = (t) => Yup.string().test('is-well-formed-json', t("ai:Invalid pull secret format. You must use your Red Hat account's pull secret."), (value) => {
    if (!value || !value.trim())
        return true;
    try {
        const pullSecret = JSON.parse(value);
        return (typeof pullSecret === 'object' &&
            pullSecret !== null &&
            'auths' in pullSecret &&
            typeof pullSecret.auths === 'object' &&
            pullSecret.auths !== null);
    }
    catch (_a) {
        return false;
    }
});
exports.pullSecretValidationSchema = pullSecretValidationSchema;
//# sourceMappingURL=pullSecretValidation.js.map