import { StoryLocator } from '@superdoc/document-api'; /** * Resolves the effective story locator from potentially overlapping sources. * * Returns `undefined` when all sources are absent, which signals "use the * body story" to downstream consumers. * * @param input - The operation input, which may carry an `in` story locator. * @param target - A resolved target that may carry a `story` locator (e.g., from a ref). * @param within - A nesting context — must NOT carry a `story` field. * @returns The resolved story locator, or `undefined` for body default. * * @throws {DocumentApiAdapterError} `INVALID_INPUT` if `within.story` is set. * @throws {DocumentApiAdapterError} `INVALID_INPUT` with code `STORY_MISMATCH` * if both `input.in` and `target.story` are set but refer to different stories. */ export declare function resolveStoryFromInput(input?: { in?: StoryLocator; }, target?: { story?: StoryLocator; }, within?: { story?: StoryLocator; }): StoryLocator | undefined; /** * Extracts a {@link StoryLocator} from an opaque ref string. * * - V4 refs carry an embedded story key that is decoded and parsed. * - V3 refs are body-scoped by convention and return an explicit body * locator so that cross-story mismatch detection works correctly * (e.g., a body V3 ref paired with `in: footnote/...` is rejected). * - Non-ref or unparseable strings return `undefined`. * * @param ref - An opaque text ref string, or `undefined`. * @returns The decoded story locator, or `undefined` when `ref` is absent * or not a recognized ref format. * * @throws {DocumentApiAdapterError} `INVALID_TARGET` if the ref is V4 * but carries a malformed story key. */ export declare function resolveStoryFromRef(ref: string | undefined): StoryLocator | undefined; /** * Resolves the story locator from a mutation's full context. * * Composes three potential sources using the standard precedence rules: * 1. `input.in` — explicit story targeting on the operation input * 2. `target.story` — story threaded on a resolved target (from discovery APIs) * 3. `ref` — V4 ref string whose embedded story key is decoded * * Sources 2 and 3 are merged (target takes precedence), then validated * against source 1 via {@link resolveStoryFromInput}. * * @param context - The mutation context containing any combination of the three sources. */ export declare function resolveMutationStory(context: { in?: StoryLocator; target?: { story?: StoryLocator; }; ref?: string; }): StoryLocator | undefined; //# sourceMappingURL=resolve-story-context.d.ts.map