import { StoryLocator } from '@superdoc/document-api'; import { StoryKind } from './story-types.js'; /** The canonical story key for the document body. */ export declare const BODY_STORY_KEY = "body"; /** * Converts a {@link StoryLocator} to a canonical internal story key. * * The key is deterministic and suitable for use as a `Map` key or cache key. * Round-tripping is supported via {@link parseStoryKey}. * * @param locator - The story locator to encode. * @returns A compact, deterministic string key. * * @example * ```ts * buildStoryKey({ kind: 'story', storyType: 'body' }); * // => 'body' * * buildStoryKey({ kind: 'story', storyType: 'footnote', noteId: '12' }); * // => 'fn:12' * * buildStoryKey({ * kind: 'story', * storyType: 'headerFooterSlot', * section: { kind: 'section', sectionId: 'sec2' }, * headerFooterKind: 'header', * variant: 'default', * }); * // => 'hf:slot:sec2:header:default:effective:materializeIfInherited' * ``` */ export declare function buildStoryKey(locator: StoryLocator): string; /** * Parses a canonical internal story key back into a {@link StoryLocator}. * * This is primarily used to recover story semantics from V4 refs so that * ref-only mutations execute against the correct non-body runtime. * * Accepts both the current header/footer slot key format and the legacy * 4-segment slot form without normalized resolution/write metadata. * * @param storyKey - The canonical story key to parse. * @returns The decoded story locator. * @throws {Error} If the key is malformed or uses an unknown prefix. */ export declare function parseStoryKey(storyKey: string): StoryLocator; /** * Extracts the broad story kind from a canonical story key. * * This is a lightweight classification that avoids full parsing — it only * inspects the key prefix to determine the category. * * @param storyKey - A canonical story key produced by {@link buildStoryKey}. * @returns The broad story kind: `'body'`, `'headerFooter'`, or `'note'`. * @throws {Error} If the key prefix is unrecognized. * * @example * ```ts * parseStoryKeyType('body'); // => 'body' * parseStoryKeyType('hf:slot:sec2:header:default:effective:materializeIfInherited'); // => 'headerFooter' * parseStoryKeyType('hf:part:rId7'); // => 'headerFooter' * parseStoryKeyType('fn:12'); // => 'note' * parseStoryKeyType('en:3'); // => 'note' * ``` */ export declare function parseStoryKeyType(storyKey: string): StoryKind; //# sourceMappingURL=story-key.d.ts.map