/** * Append-only shared string table (M1.1). * * Plain-text dedup reuses the first matching plain index. Rich entries are never * merged with plain text. Existing indexes are never renumbered or removed. * * Citations: `docs/specs/shared-strings.md`, ECMA-376-1 §18.4. * * @private */ import { RichTextRun } from './rich-text-xml'; import { SstEntryXml } from './sst-xml'; export { SstEntryXml }; export { RichTextRun }; /** * In-memory shared string table. */ export declare class SharedStringTable { private readonly entries; /** Plain text → first index (plain entries only). */ private readonly plainIndex; /** `sst/@count` semantics: total string cell references when known. */ private referenceCount; private readonly preserveChildrenXml; private readonly rootExtraAttrsXml; private _dirty; /** True when a sharedStrings part was present on open (even if empty). */ private readonly hadPart; private readonly partName; private readonly maxEntries; private constructor(); /** * Empty table (no part on disk yet). */ static empty(options?: { readonly maxEntries?: number; readonly partName?: string; }): SharedStringTable; /** * Load from part bytes. Missing part should use {@link empty} instead. */ static fromPartBytes(bytes: Uint8Array, partName: string, options?: { readonly maxEntries?: number; }): SharedStringTable; /** * Number of `si` entries (`uniqueCount`). */ readonly length: number; /** * Whether the table should be written on save. */ readonly isDirty: boolean; /** * Whether a sharedStrings part existed when the workbook was opened. */ readonly hadSharedStringsPart: boolean; /** * Part name when known (loaded or assigned for create). */ readonly sharedStringsPartName: string | undefined; /** * True when save should emit the part (had part, dirty with entries, or dirty empty preserve). */ shouldWritePart(): boolean; /** * Resolve index → plain text (rich entries use joined run text). */ getPlainText(index: number): string; /** * First plain-entry index for `text`, if any. Rich entries are not considered. */ indexOfPlainText(text: string): number | undefined; /** * Reuse existing plain index or append a new plain entry. Never renumbers. */ appendPlainText(text: string): number; /** * Always append a rich `si` entry (never plain-dedup, never renumber). * * Citations: `docs/specs/rich-text.md`; ECMA-376-1 §18.4. */ appendRichRuns(runs: ReadonlyArray): number; /** * Resolve index → structured runs. Plain entries become a single unformatted run. * * Citations: `docs/specs/rich-text.md`; ECMA-376-1 §18.4. */ getRichRuns(index: number): RichTextRun[]; /** * Bump total reference count (cell writes in TASK-1105). M1.1 tests may call via workbook. * @private */ addReferences(delta: number): void; /** * Serialize to part bytes. `count` / `uniqueCount` recomputed per schema semantics. */ toPartBytes(): Uint8Array; /** * Snapshot of entry kinds for tests. * @private */ entryKindAt(index: number): 'plain' | 'rich'; private rebuildPlainMap; }