import { d as SceneElement, N as NewPageOptions, P as PageBleed, a as PageGuides } from './model-BBwyOuWG.js';

/**
 * The design-canvas operation union — the ONE mutation vocabulary shared by
 * the editor's command stack (human edits, undo/redo), the MCP tool
 * dispatcher (agent edits), and programmatic automation (template
 * instantiation, data sync). Every state change the editor can express is an
 * operation here; anything not expressible here does not happen to a
 * document. That closure is the automation contract: replaying a decision
 * log reproduces the document.
 *
 * Attribute patches are validated per element kind in ./validate before
 * ./apply mutates the document; both run server-side on every path.
 */

/** Per-kind attribute patch. `kind` is immutable after creation; ids are
 *  immutable always. Validation rejects attrs foreign to the target's kind. */
type SceneAttrsPatch = Partial<Omit<SceneElement, 'id' | 'kind' | 'children'>> & {
    text?: string;
    width?: number;
    height?: number;
    points?: number[];
    fill?: string;
    stroke?: string;
    strokeWidth?: number;
    cornerRadius?: number;
    dash?: number[];
    fontFamily?: string;
    fontSize?: number;
    fontStyle?: 'normal' | 'bold' | 'italic' | 'bold italic';
    align?: 'left' | 'center' | 'right';
    lineHeight?: number;
    letterSpacing?: number;
    src?: string;
    posterSrc?: string;
    fit?: 'fill' | 'cover' | 'contain';
};
interface AddElementOperation {
    type: 'add_element';
    pageId: string;
    /** Complete element including caller-minted id (reconciled like sequences
     *  clips when the server re-mints). */
    element: SceneElement;
    /** Insertion z-index; omitted → top. */
    index?: number;
    /** Parent group; omitted → page root. */
    parentGroupId?: string;
}
interface SetAttrsOperation {
    type: 'set_attrs';
    pageId: string;
    elementId: string;
    attrs: SceneAttrsPatch;
}
interface ReorderElementOperation {
    type: 'reorder_element';
    pageId: string;
    elementId: string;
    /** Target index within the element's CURRENT owner (page root or group). */
    toIndex: number;
}
interface DeleteElementOperation {
    type: 'delete_element';
    pageId: string;
    elementId: string;
}
interface GroupElementsOperation {
    type: 'group_elements';
    pageId: string;
    /** ≥ 2 sibling elements (same owner); grouped in their current z-order. */
    elementIds: string[];
    /** Caller-minted id for the new group. */
    groupId: string;
    name?: string;
}
interface UngroupElementOperation {
    type: 'ungroup_element';
    pageId: string;
    groupId: string;
}
interface AddPageOperation {
    type: 'add_page';
    /** Caller-minted page id. */
    pageId: string;
    options?: NewPageOptions;
    /** Position in the page list; omitted → end. */
    index?: number;
}
interface DuplicatePageOperation {
    type: 'duplicate_page';
    sourcePageId: string;
    /** Caller-minted id for the copy; element ids are re-minted server-side. */
    pageId: string;
}
interface DeletePageOperation {
    type: 'delete_page';
    pageId: string;
}
interface ReorderPageOperation {
    type: 'reorder_page';
    pageId: string;
    toIndex: number;
}
interface SetPagePropsOperation {
    type: 'set_page_props';
    pageId: string;
    name?: string;
    width?: number;
    height?: number;
    background?: string;
    /** null clears bleed; omitted leaves unchanged. */
    bleed?: PageBleed | null;
}
interface SetPageGuidesOperation {
    type: 'set_page_guides';
    pageId: string;
    guides: PageGuides;
}
interface BindSlotOperation {
    type: 'bind_slot';
    pageId: string;
    elementId: string;
    /** null unbinds. Slot names are unique document-wide. */
    slot: string | null;
}
/** Fill slots with data — text slots take strings, image/video slots take
 *  src URLs. Unknown slot names throw; partial application is allowed. */
interface ApplyDataOperation {
    type: 'apply_data';
    bindings: Record<string, string>;
}
interface SetDocumentTitleOperation {
    type: 'set_document_title';
    title: string;
}
type SceneOperation = AddElementOperation | SetAttrsOperation | ReorderElementOperation | DeleteElementOperation | GroupElementsOperation | UngroupElementOperation | AddPageOperation | DuplicatePageOperation | DeletePageOperation | ReorderPageOperation | SetPagePropsOperation | SetPageGuidesOperation | BindSlotOperation | ApplyDataOperation | SetDocumentTitleOperation;
interface ScenePlan {
    summary: string;
    operations: SceneOperation[];
}
type SceneOperationType = SceneOperation['type'];
declare const SCENE_OPERATION_TYPES: readonly SceneOperationType[];

export { type AddElementOperation as A, type BindSlotOperation as B, type DeleteElementOperation as D, type GroupElementsOperation as G, type ReorderElementOperation as R, SCENE_OPERATION_TYPES as S, type UngroupElementOperation as U, type AddPageOperation as a, type ApplyDataOperation as b, type DeletePageOperation as c, type DuplicatePageOperation as d, type ReorderPageOperation as e, type SceneAttrsPatch as f, type SceneOperation as g, type SceneOperationType as h, type ScenePlan as i, type SetAttrsOperation as j, type SetDocumentTitleOperation as k, type SetPageGuidesOperation as l, type SetPagePropsOperation as m };
