import type { RichText } from '../cell/rich-text'; /** A single SST entry: either a plain string or a rich-text run array. */ export type SharedStringEntry = string | { kind: 'rich-text'; runs: RichText; }; /** * Mutable shared-strings accumulator + lookup table. The same shape is used * during read (just populate `entries`) and write (call `addSharedString` from * the worksheet writer; emit to bytes at the end). */ export interface SharedStringsTable { /** Insertion-ordered list of unique entries. */ entries: SharedStringEntry[]; /** Reverse lookup keyed by literal text — rich-text entries skip this map. */ index: Map; } export declare function makeSharedStrings(): SharedStringsTable; /** * Insert a string and return its index. Idempotent: calling with the same value * twice gives the same index. Empty strings are deduped just like everything * else. */ export declare function addSharedString(table: SharedStringsTable, value: string): number; /** Look up a shared-string index by its literal text. Returns `undefined` for unknown values. */ export declare function getSharedStringIndex(table: SharedStringsTable, value: string): number | undefined; /** * Read a shared-string by its 0-based index. Returns `undefined` for * out-of-range. Rich-text entries surface their concatenated plain text so * callers that want only the textual body don't need to know about the * discriminated union. */ export declare function getSharedStringAt(table: SharedStringsTable, index: number): string | undefined; /** Number of unique entries in the SST. */ export declare function sharedStringCount(table: SharedStringsTable): number; /** * Parse a `xl/sharedStrings.xml` payload. Returns the table directly (rather * than just the array) so the worksheet writer can keep appending to it without * rebuilding the index. * * Rich-text runs are preserved as their full per-run formatting so * round-tripping a file with rich text doesn't drop the styling. */ export declare function parseSharedStringsXml(bytes: Uint8Array | string): SharedStringsTable; /** * Serialise a SharedStringsTable to its OOXML bytes. The `count` attribute * tracks total references (we don't know that here so we report the same as * `uniqueCount` — readers tolerate the discrepancy and Excel ignores `count` in * practice). `uniqueCount` always matches `entries.length`. */ export declare function sharedStringsToBytes(table: SharedStringsTable): Uint8Array; export declare function serializeSharedStrings(table: SharedStringsTable): string; /** * Serialise a sequence of `...` runs — shared by the SST `` writer * and the worksheet's inline-string (`t="inlineStr"`) cell writer. */ export declare function serializeRichTextRuns(runs: import('../cell/rich-text').RichText): string;