import { asEditorBlockId, asEditorBlockValues, asEditorContentValues, asEditorEntryId, asEditorMetadataValues, asEditorPageId, asEditorSiteId, type EditorBlockBaselineInput, type EditorBlockId, type EditorBlockPublishedBaselineInput, type EditorDraftBlockBaselineUpdateMetaInput, type EditorDraftBlockInitMetaInput, type EditorBlockValues, type EditorContentValues, type EditorEntryId, type EditorMetadataValues, type EditorPageId, type EditorPersistedBlock, type EditorSiteId, type EditorStructuralCommand, type EditorStructuralDraftSnapshot, type EditorSyncState, type EditorValueRecord } from '@riverbankcms/core';
export { asEditorBlockId, asEditorBlockValues, asEditorContentValues, asEditorEntryId, asEditorMetadataValues, asEditorPageId, asEditorSiteId, type EditorBlockId, type EditorBlockValues, type EditorContentValues, type EditorEntryId, type EditorMetadataValues, type EditorPageId, type EditorSiteId, };
export type EditorCommand = {
    type: 'set-metadata-value';
    path: string;
    value: unknown;
} | {
    type: 'replace-metadata';
    value: EditorMetadataValues | null;
} | {
    type: 'set-content-value';
    path: string;
    value: unknown;
} | {
    type: 'replace-content';
    value: EditorContentValues | null;
} | {
    type: 'set-block-value';
    blockId: EditorBlockId;
    path: string;
    value: unknown;
} | {
    type: 'replace-block';
    blockId: EditorBlockId;
    value: EditorBlockValues | null;
} | EditorStructuralCommand | {
    type: 'batch';
    changes: readonly EditorCommand[];
};
type PersistReorderEffect = Readonly<{
    type: 'persist-reorder';
    blockIds: readonly EditorBlockId[];
}>;
type PersistInsertEffect = Readonly<{
    type: 'persist-insert';
    block: PersistedEditorBlockItem;
    draft: EditorDraftSnapshot;
    index: number;
}>;
type PersistRemoveEffect = Readonly<{
    type: 'persist-remove';
    blockId: EditorBlockId;
}>;
export type EditorEffect = PersistReorderEffect | PersistInsertEffect | PersistRemoveEffect;
export type EditorValueSnapshot<TValue extends EditorValueRecord | null> = Readonly<{
    version: number;
    baseline: TValue;
    current: TValue;
    publishedBaseline: TValue;
    syncState: EditorSyncState;
}>;
type EditorMetadataSnapshot = EditorValueSnapshot<EditorMetadataValues | null>;
type EditorContentSnapshot = EditorValueSnapshot<EditorContentValues | null>;
export type EditorBlockMeta = Readonly<{
    kind: string;
    purpose: string | null;
    orderIndex: number | null;
    publishedContent: EditorBlockValues | null;
}>;
export type EditorDraftSnapshot = EditorStructuralDraftSnapshot;
export type DraftBlockInitMetaInput = EditorDraftBlockInitMetaInput;
export type DraftBlockBaselineUpdateMetaInput = EditorDraftBlockBaselineUpdateMetaInput;
export type DraftBlockBaselineInput = EditorBlockBaselineInput;
export type BlockPublishedBaselineInput = EditorBlockPublishedBaselineInput;
export type EditorBlockItem = Readonly<{
    id?: string | null;
    kind: string;
    content?: EditorValueRecord | null;
    orderIndex?: number | null;
    draftContent?: EditorValueRecord | null;
    publishedContent?: EditorValueRecord | null;
    bindings?: EditorValueRecord | null;
    purpose?: string | null;
}>;
type NormalizedEditorBlockBase = Readonly<{
    kind: string;
    content: EditorBlockValues | null;
    orderIndex: number | null;
    draftContent: EditorBlockValues | null;
    publishedContent: EditorBlockValues | null;
    bindings: EditorBlockValues | null;
    purpose: string | null;
}>;
export type PersistedEditorBlockItem = EditorPersistedBlock;
export type PendingEditorBlockItem = NormalizedEditorBlockBase & Readonly<{
    id: null;
}>;
export type NormalizedEditorBlockItem = PersistedEditorBlockItem | PendingEditorBlockItem;
export type EditorHistorySnapshot = Readonly<{
    metadata: EditorMetadataSnapshot;
    content: EditorContentSnapshot;
    /**
     * Persisted structural block state mirrored from acknowledged server snapshots.
     * Structural/history operations and baseline acknowledgements keep this list in sync,
     * while draft-only validation/edit metadata continues to live in `drafts`.
     */
    blockList: readonly NormalizedEditorBlockItem[];
    drafts: Readonly<Record<EditorBlockId, EditorDraftSnapshot>>;
}>;
export declare function requirePersistedEditorBlock(block: EditorBlockItem | NormalizedEditorBlockItem): PersistedEditorBlockItem;
export declare function createEditorDraftSnapshotFromBlock(block: PersistedEditorBlockItem): EditorDraftSnapshot;
export declare function createEditorHistorySnapshot(): EditorHistorySnapshot;
export declare function remapEditorBlockIdInSnapshot(snapshot: EditorHistorySnapshot, fromBlockId: EditorBlockId, toBlockId: EditorBlockId): EditorHistorySnapshot;
export declare function normalizeEditorBlock(block: EditorBlockItem): NormalizedEditorBlockItem;
export declare function normalizeEditorBlockList(blocks: readonly EditorBlockItem[]): readonly NormalizedEditorBlockItem[];
export declare function editorBlockListsEqual(left: readonly EditorBlockItem[] | readonly NormalizedEditorBlockItem[], right: readonly EditorBlockItem[] | readonly NormalizedEditorBlockItem[]): boolean;
export declare function editorHistorySnapshotsEqual(left: EditorHistorySnapshot, right: EditorHistorySnapshot): boolean;
export declare function diffToReorderOnly(previous: EditorHistorySnapshot, next: EditorHistorySnapshot): readonly EditorBlockId[] | null;
export declare function deriveEditorEffectsForHistoryTransition(previous: EditorHistorySnapshot, next: EditorHistorySnapshot): readonly EditorEffect[];
export type EditorUserOperation = {
    type: 'user-command';
    command: EditorCommand;
};
export type EditorSystemOperation = {
    type: 'hydrate-metadata';
    baseline: EditorMetadataValues | null;
    current?: EditorMetadataValues | null;
    published?: EditorMetadataValues | null;
} | {
    type: 'hydrate-content';
    baseline: EditorContentValues | null;
    current?: EditorContentValues | null;
    published?: EditorContentValues | null;
} | {
    type: 'set-metadata-published-baseline';
    published: EditorMetadataValues | null;
} | {
    type: 'set-content-published-baseline';
    published: EditorContentValues | null;
} | {
    type: 'autosave-metadata-succeeded';
    savedValues: EditorMetadataValues | null;
    acknowledgedVersion: number;
} | {
    type: 'autosave-content-succeeded';
    savedValues: EditorContentValues | null;
    acknowledgedVersion: number;
} | {
    type: 'autosave-metadata-failed';
    message?: string;
} | {
    type: 'autosave-content-failed';
    message?: string;
} | {
    type: 'clear-metadata-error';
} | {
    type: 'clear-content-error';
} | {
    type: 'init-new-draft-block';
    blockId: EditorBlockId;
    baseline: DraftBlockBaselineInput;
    meta: DraftBlockInitMetaInput;
} | {
    type: 'update-draft-block-baseline';
    blockId: EditorBlockId;
    baseline: DraftBlockBaselineInput;
    meta?: DraftBlockBaselineUpdateMetaInput;
} | {
    type: 'remove-draft-block';
    blockId: EditorBlockId;
} | {
    type: 'set-draft-published-baselines';
    blocks: readonly BlockPublishedBaselineInput[];
} | {
    type: 'autosave-draft-succeeded';
    blockId: EditorBlockId;
    savedValues: EditorBlockValues | null;
    acknowledgedVersion: number;
} | {
    type: 'autosave-draft-failed';
    blockId: EditorBlockId;
    message?: string;
} | {
    type: 'clear-draft-error';
    blockId: EditorBlockId;
} | {
    type: 'set-draft-pending';
    blockId: EditorBlockId;
} | {
    type: 'clear-draft-pending';
    blockId: EditorBlockId;
} | {
    type: 'replace-block-list';
    next: readonly EditorBlockItem[];
};
export type EditorOperation = EditorUserOperation | EditorSystemOperation;
export declare function applyEditorCommand(snapshot: EditorHistorySnapshot, command: EditorCommand): EditorHistorySnapshot;
export declare function applyUserOperation(snapshot: EditorHistorySnapshot, operation: EditorUserOperation): EditorHistorySnapshot;
export declare function applySystemOperation(snapshot: EditorHistorySnapshot, operation: EditorSystemOperation): EditorHistorySnapshot;
export declare function applyEditorOperation(snapshot: EditorHistorySnapshot, operation: EditorOperation): EditorHistorySnapshot;
export declare function hydrateMetadataSnapshot(snapshot: EditorHistorySnapshot, baseline: EditorMetadataValues | null, current?: EditorMetadataValues | null, published?: EditorMetadataValues | null): EditorHistorySnapshot;
export declare function hydrateContentSnapshot(snapshot: EditorHistorySnapshot, baseline: EditorContentValues | null, current?: EditorContentValues | null, published?: EditorContentValues | null): EditorHistorySnapshot;
export declare function setMetadataPublishedBaseline(snapshot: EditorHistorySnapshot, published: EditorMetadataValues | null): EditorHistorySnapshot;
export declare function setContentPublishedBaseline(snapshot: EditorHistorySnapshot, published: EditorContentValues | null): EditorHistorySnapshot;
export declare function autosaveMetadataSucceeded(snapshot: EditorHistorySnapshot, savedValues: EditorMetadataValues | null, acknowledgedVersion: number): EditorHistorySnapshot;
export declare function autosaveContentSucceeded(snapshot: EditorHistorySnapshot, savedValues: EditorContentValues | null, acknowledgedVersion: number): EditorHistorySnapshot;
export declare function autosaveMetadataFailed(snapshot: EditorHistorySnapshot, message?: string): EditorHistorySnapshot;
export declare function autosaveContentFailed(snapshot: EditorHistorySnapshot, message?: string): EditorHistorySnapshot;
export declare function clearMetadataError(snapshot: EditorHistorySnapshot): EditorHistorySnapshot;
export declare function clearContentError(snapshot: EditorHistorySnapshot): EditorHistorySnapshot;
export declare function getCurrentValues<TValue extends EditorValueRecord | null>(snapshot: EditorValueSnapshot<TValue>): TValue;
export declare function getSnapshotStatus(syncState: EditorSyncState): 'baseline' | 'pending' | 'failed';
export declare function getSnapshotError(syncState: EditorSyncState): string | null;
export declare function initNewDraftBlock(snapshot: EditorHistorySnapshot, blockId: EditorBlockId, baseline: DraftBlockBaselineInput, meta: DraftBlockInitMetaInput): EditorHistorySnapshot;
export declare function updateDraftBlockBaseline(snapshot: EditorHistorySnapshot, blockId: EditorBlockId, baseline: DraftBlockBaselineInput, meta?: DraftBlockBaselineUpdateMetaInput): EditorHistorySnapshot;
export declare function removeDraftBlock(snapshot: EditorHistorySnapshot, blockId: EditorBlockId): EditorHistorySnapshot;
export declare function setDraftPublishedBaselines(snapshot: EditorHistorySnapshot, blocks: readonly BlockPublishedBaselineInput[]): EditorHistorySnapshot;
export declare function autosaveDraftSucceeded(snapshot: EditorHistorySnapshot, blockId: EditorBlockId, savedValues: EditorBlockValues | null, acknowledgedVersion: number): EditorHistorySnapshot;
export declare function autosaveDraftFailed(snapshot: EditorHistorySnapshot, blockId: EditorBlockId, message?: string): EditorHistorySnapshot;
export declare function clearDraftError(snapshot: EditorHistorySnapshot, blockId: EditorBlockId): EditorHistorySnapshot;
export declare function setDraftPending(snapshot: EditorHistorySnapshot, blockId: EditorBlockId): EditorHistorySnapshot;
export declare function clearDraftPending(snapshot: EditorHistorySnapshot, blockId: EditorBlockId): EditorHistorySnapshot;
export declare function replaceEditorBlockList(snapshot: EditorHistorySnapshot, blockList: readonly EditorBlockItem[]): EditorHistorySnapshot;
export declare function getDraftSnapshot(snapshot: EditorHistorySnapshot, blockId: string): EditorDraftSnapshot | null;
export declare function inspectDrafts(snapshot: EditorHistorySnapshot): EditorDraftSnapshot[];
export declare function hasUnpublishedDraftChanges(snapshot: EditorHistorySnapshot): boolean;
