import { StoryLocator } from '../../../../../../../document-api/src/index.js';
import { Editor } from '../../Editor.js';
import { StoryRuntime } from '../../../document-api-adapters/story-runtime/story-types.js';
import { StoryPresentationSession, ActivateStorySessionOptions } from './types.js';
/**
 * Creates (or returns) the ProseMirror editor that should back an active
 * session for a given runtime. May return a fresh editor mounted into a
 * freshly-created hidden host, or the runtime's existing editor.
 */
export interface StorySessionEditorFactoryInput {
    /** The resolved story runtime. */
    runtime: StoryRuntime;
    /** The element the story editor should be mounted into, if headless. */
    hostElement: HTMLElement;
    /** Activation-time options for the session being created. */
    activationOptions: ActivateStorySessionOptions;
}
export interface StorySessionEditorFactoryResult {
    /** The editor that should be used for the session. */
    editor: Editor;
    /**
     * Optional teardown to run when the session is disposed. Only set when
     * the factory created a fresh editor; reused editors are owned elsewhere.
     */
    dispose?: () => void;
}
/** Factory used by the manager to obtain a mountable story editor. */
export type StorySessionEditorFactory = (input: StorySessionEditorFactoryInput) => StorySessionEditorFactoryResult;
/**
 * Constructor options for {@link StoryPresentationSessionManager}.
 */
export interface StoryPresentationSessionManagerOptions {
    /**
     * Resolve a locator to a {@link StoryRuntime}. In production this wraps
     * `resolveStoryRuntime(hostEditor, locator, { intent: 'write' })`; in
     * tests it can be any mock.
     */
    resolveRuntime: (locator: StoryLocator) => StoryRuntime;
    /**
     * Returns the host element the session will mount into. Defaults to the
     * container the session manager was given on construction, but may be
     * overridden per session (e.g., a page-local overlay).
     */
    getMountContainer: () => HTMLElement | null;
    /**
     * Optional factory for creating the session editor. When omitted the
     * manager uses the runtime's existing editor (appending the hidden host
     * is still performed, but ProseMirror's DOM lives wherever the runtime
     * originally placed it). Most callers will pass a factory that invokes
     * `createStoryEditor` to mount a fresh editor into the hidden host.
     */
    editorFactory?: StorySessionEditorFactory;
    /**
     * Called after the active session changes (activate, exit, dispose).
     * Consumers use this to notify `PresentationInputBridge`.
     */
    onActiveSessionChanged?: (session: StoryPresentationSession | null) => void;
}
/**
 * Manages the lifecycle of a single active story-backed editing session.
 *
 * The first rollout assumes only one session is active at a time; if two
 * activations overlap, the current session is disposed before the new one
 * is activated.
 */
export declare class StoryPresentationSessionManager {
    #private;
    constructor(options: StoryPresentationSessionManagerOptions);
    /** Returns the active session, or `null` if none is active. */
    getActiveSession(): StoryPresentationSession | null;
    /**
     * Returns the DOM element that should receive forwarded input events
     * while a session is active, or `null` if there is no active session.
     */
    getActiveEditorDomTarget(): HTMLElement | null;
    /**
     * Activate a session for the given locator. If a session is already
     * active, it is disposed first.
     */
    activate(locator: StoryLocator, options?: ActivateStorySessionOptions): StoryPresentationSession;
    /**
     * Deactivate the current session. Safe to call when no session is active.
     * Commits (if policy says so) and disposes the hidden host.
     */
    exit(): void;
    /**
     * Dispose the manager and any active session.
     */
    destroy(): void;
}
//# sourceMappingURL=StoryPresentationSessionManager.d.ts.map