/**
 * Serializable canvas model for Form Studio.
 *
 * This is the source of truth for the visual builder: sections + elements +
 * layout. Code generation derives JSX from it; the round-trip parser tries
 * to reconstruct it from existing Component code on load.
 *
 * The model is plain JSON — easy to diff, easy to ship over the wire to the
 * agent when "Open in Chat" is invoked, easy to round-trip into a
 * ComponentSpec.code string.
 */
/** Generate a short stable id for canvas elements. Not cryptographic. */
export function generateCanvasId(prefix) {
    const slug = Math.random().toString(36).slice(2, 10);
    return `${prefix}-${slug}`;
}
/** Build a default, empty section. */
export function buildEmptySection(title = 'Untitled Section') {
    return {
        id: generateCanvasId('section'),
        title,
        collapsible: false,
        columns: 2,
        elements: [],
    };
}
/** Build a default empty canvas for an entity. */
export function buildEmptyCanvas(entityName, title) {
    return {
        entityName,
        title: title ?? '',
        sections: [buildEmptySection('Details')],
    };
}
//# sourceMappingURL=form-canvas-model.js.map