import { z } from 'zod';
import { validateZodSubset } from './validate-subset.js';
export function compileSchema(zodSchema) {
    validateZodSubset(zodSchema);
    const toJSONSchema = z.toJSONSchema;
    if (typeof toJSONSchema !== 'function') {
        throw new Error('Zod 4 is required: install zod@^4.0.0');
    }
    return toJSONSchema(zodSchema, {
        target: 'draft-2020-12',
        unrepresentable: 'throw',
    });
}
