/*!
 * KoliBri - The accessible HTML-Standard
 */
import { parseJson, setState } from "../utils";
import { isObject } from "../validators";
export const validateTableSelection = (component, value) => {
    const parseSerializedValue = () => {
        try {
            return parseJson(value);
        }
        catch (_a) {
            return undefined;
        }
    };
    const validateObject = (value) => {
        return value && isObject(value) && typeof value.label === 'function' && (!value.selectedKeys || Array.isArray(value.selectedKeys));
    };
    const objectValue = typeof value === 'string' ? parseSerializedValue() : value;
    if (validateObject(objectValue)) {
        setState(component, '_selection', value);
    }
};
//# sourceMappingURL=table-selection.js.map
