import type { GDocsRequest, GDocsBatchUpdateResponse } from './google-api-types.js'; import type { GoogleApiClient } from './api-client.js'; import type { AnchorId, CachedParagraph, DocumentStructureCache, GoogleDocsCredentials, TabInfo } from './types.js'; import type { DocumentViewNodeGdocs } from './document-view.js'; /** * GoogleDocsDocument provides read/write access to a Google Docs document. * It caches the document structure for anchor resolution and performs * all writes through batchUpdate. * * Anchors use Named Ranges (not bookmarks — createBookmark does not exist * in the Google Docs API). Named ranges with the `_bk_` prefix serve as * stable paragraph anchors. */ export declare class GoogleDocsDocument { private client; private docId; private cache; private concurrency; /** Google namedRangeId -> _bk_ name */ private anchorMapping; /** _bk_ name -> Google namedRangeId */ private reverseAnchorMapping; private documentViewCache; private editCount; private editRevision; private constructor(); /** Static factory - load a Google Doc */ static load(docId: string, credentials?: GoogleDocsCredentials): Promise; /** Fetch/refresh the document structure */ fetchDocument(): Promise; /** Find the named range anchor for a paragraph by matching startIndex */ private findAnchorForParagraph; /** Inject named range anchors into all paragraphs that don't have one */ injectAnchors(tabId?: string): Promise<{ injectedCount: number; }>; /** * Replace text in the paragraph identified by anchorId. * Finds `findText` within the paragraph and replaces it with `replaceWith`. */ replaceText(anchorId: AnchorId, findText: string, replaceWith: string): Promise; /** * Insert a new paragraph before or after the anchor. */ insertParagraph(anchorId: AnchorId, position: 'BEFORE' | 'AFTER', text: string): Promise<{ newAnchorId: AnchorId; }>; /** Execute a raw batchUpdate with write control */ executeBatchUpdate(requests: GDocsRequest[]): Promise; /** Get cached paragraphs */ getParagraphs(tabId?: string): CachedParagraph[]; /** Get paragraph text by anchor ID */ getParagraphTextById(anchorId: AnchorId): string | null; /** Get paragraph by anchor ID */ getParagraphByAnchorId(anchorId: AnchorId): CachedParagraph | null; /** Get document ID */ getDocId(): string; /** Get current revision ID */ getRevisionId(): string; /** Get edit count */ getEditCount(): number; /** Get edit revision */ getEditRevision(): number; /** Get tabs */ getTabs(): TabInfo[]; /** Get default tab ID */ getDefaultTabId(): string; /** Check if revision is still fresh */ isRevisionFresh(): boolean; /** Get the document structure cache */ getCache(): DocumentStructureCache | null; /** Get the document view cache */ getDocumentViewCache(): { revisionId: string; nodes: DocumentViewNodeGdocs[]; } | null; /** Get the API client */ getClient(): GoogleApiClient; /** Get the reverse anchor mapping (_bk_ name -> namedRangeId) */ getReverseAnchorMapping(): Map; /** @deprecated Use getReverseAnchorMapping() */ getReverseBookmarkMapping(): Map; /** * Export the document as a DOCX file via the Drive export API. * * **Note:** The Drive export API has a 10 MB limit for Google Workspace files. */ exportAsDocx(): Promise; /** Mark the document as edited */ markEdited(): void; private parseParagraphsFromContent; private extractParagraphText; } //# sourceMappingURL=document.d.ts.map