export function tryParsePictureRawValue(rawValue) {
    if (!rawValue) {
        return { Variants: [] };
    }
    const trimmedRawValue = rawValue.trim();
    if (!trimmedRawValue.startsWith("{")) {
        return null;
    }
    try {
        const parsed = JSON.parse(trimmedRawValue);
        if (!parsed || typeof parsed !== "object") {
            return null;
        }
        const variants = parsed.Variants;
        if (variants != null && !Array.isArray(variants)) {
            return null;
        }
        return {
            ...parsed,
            Variants: variants ?? [],
        };
    }
    catch {
        return null;
    }
}
export function canCropPictureFieldRawValue(rawValue) {
    return tryParsePictureRawValue(rawValue) !== null;
}
//# sourceMappingURL=pictureRawValue.js.map