docxodus 12.4.0 → 12.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/README.md +23 -0
  2. package/dist/core.d.ts +924 -0
  3. package/dist/core.d.ts.map +1 -0
  4. package/dist/core.js +2094 -0
  5. package/dist/core.js.map +1 -0
  6. package/dist/embed.bundle.js +12229 -12229
  7. package/dist/embed.iife.js +12231 -12231
  8. package/dist/export-assets.json +39 -39
  9. package/dist/index.d.ts +2 -922
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +2 -2093
  12. package/dist/index.js.map +1 -1
  13. package/dist/wasm/_framework/Docxodus.wasm +0 -0
  14. package/dist/wasm/_framework/Docxodus.wasm.br +0 -0
  15. package/dist/wasm/_framework/DocxodusWasm.wasm +0 -0
  16. package/dist/wasm/_framework/DocxodusWasm.wasm.br +0 -0
  17. package/dist/wasm/_framework/System.Collections.Concurrent.wasm +0 -0
  18. package/dist/wasm/_framework/System.Collections.Concurrent.wasm.br +0 -0
  19. package/dist/wasm/_framework/System.Collections.Immutable.wasm +0 -0
  20. package/dist/wasm/_framework/System.Collections.Immutable.wasm.br +0 -0
  21. package/dist/wasm/_framework/System.Collections.NonGeneric.wasm +0 -0
  22. package/dist/wasm/_framework/System.Collections.NonGeneric.wasm.br +0 -0
  23. package/dist/wasm/_framework/System.Collections.Specialized.wasm +0 -0
  24. package/dist/wasm/_framework/System.Collections.Specialized.wasm.br +0 -0
  25. package/dist/wasm/_framework/System.Collections.wasm +0 -0
  26. package/dist/wasm/_framework/System.Collections.wasm.br +0 -0
  27. package/dist/wasm/_framework/System.ComponentModel.Primitives.wasm +0 -0
  28. package/dist/wasm/_framework/System.ComponentModel.Primitives.wasm.br +0 -0
  29. package/dist/wasm/_framework/System.ComponentModel.TypeConverter.wasm +0 -0
  30. package/dist/wasm/_framework/System.ComponentModel.TypeConverter.wasm.br +0 -0
  31. package/dist/wasm/_framework/System.ComponentModel.wasm +0 -0
  32. package/dist/wasm/_framework/System.ComponentModel.wasm.br +0 -0
  33. package/dist/wasm/_framework/System.Console.wasm +0 -0
  34. package/dist/wasm/_framework/System.Console.wasm.br +0 -0
  35. package/dist/wasm/_framework/System.IO.Compression.wasm +0 -0
  36. package/dist/wasm/_framework/System.IO.Compression.wasm.br +0 -0
  37. package/dist/wasm/_framework/System.IO.Pipelines.wasm +0 -0
  38. package/dist/wasm/_framework/System.IO.Pipelines.wasm.br +0 -0
  39. package/dist/wasm/_framework/System.Linq.Expressions.wasm +0 -0
  40. package/dist/wasm/_framework/System.Linq.Expressions.wasm.br +0 -0
  41. package/dist/wasm/_framework/System.Linq.wasm +0 -0
  42. package/dist/wasm/_framework/System.Linq.wasm.br +0 -0
  43. package/dist/wasm/_framework/System.Memory.wasm +0 -0
  44. package/dist/wasm/_framework/System.Memory.wasm.br +0 -0
  45. package/dist/wasm/_framework/System.Net.Http.wasm +0 -0
  46. package/dist/wasm/_framework/System.Net.Http.wasm.br +0 -0
  47. package/dist/wasm/_framework/System.Net.Primitives.wasm +0 -0
  48. package/dist/wasm/_framework/System.Net.Primitives.wasm.br +0 -0
  49. package/dist/wasm/_framework/System.ObjectModel.wasm +0 -0
  50. package/dist/wasm/_framework/System.ObjectModel.wasm.br +0 -0
  51. package/dist/wasm/_framework/System.Private.CoreLib.wasm +0 -0
  52. package/dist/wasm/_framework/System.Private.CoreLib.wasm.br +0 -0
  53. package/dist/wasm/_framework/System.Private.Uri.wasm +0 -0
  54. package/dist/wasm/_framework/System.Private.Uri.wasm.br +0 -0
  55. package/dist/wasm/_framework/System.Private.Xml.Linq.wasm +0 -0
  56. package/dist/wasm/_framework/System.Private.Xml.Linq.wasm.br +0 -0
  57. package/dist/wasm/_framework/System.Private.Xml.wasm +0 -0
  58. package/dist/wasm/_framework/System.Private.Xml.wasm.br +0 -0
  59. package/dist/wasm/_framework/System.Runtime.InteropServices.JavaScript.wasm +0 -0
  60. package/dist/wasm/_framework/System.Runtime.InteropServices.JavaScript.wasm.br +0 -0
  61. package/dist/wasm/_framework/System.Runtime.wasm +0 -0
  62. package/dist/wasm/_framework/System.Runtime.wasm.br +0 -0
  63. package/dist/wasm/_framework/System.Security.Cryptography.wasm +0 -0
  64. package/dist/wasm/_framework/System.Security.Cryptography.wasm.br +0 -0
  65. package/dist/wasm/_framework/System.Text.Encodings.Web.wasm +0 -0
  66. package/dist/wasm/_framework/System.Text.Encodings.Web.wasm.br +0 -0
  67. package/dist/wasm/_framework/System.Text.Json.wasm +0 -0
  68. package/dist/wasm/_framework/System.Text.Json.wasm.br +0 -0
  69. package/dist/wasm/_framework/System.Text.RegularExpressions.wasm +0 -0
  70. package/dist/wasm/_framework/System.Text.RegularExpressions.wasm.br +0 -0
  71. package/dist/wasm/_framework/System.Xml.Linq.wasm +0 -0
  72. package/dist/wasm/_framework/System.Xml.Linq.wasm.br +0 -0
  73. package/dist/wasm/_framework/System.Xml.XDocument.wasm +0 -0
  74. package/dist/wasm/_framework/System.Xml.XDocument.wasm.br +0 -0
  75. package/dist/wasm/_framework/System.wasm +0 -0
  76. package/dist/wasm/_framework/System.wasm.br +0 -0
  77. package/dist/wasm/_framework/dotnet.boot.js +34 -34
  78. package/dist/wasm/_framework/dotnet.boot.js.br +0 -0
  79. package/dist/wasm/_framework/dotnet.js +1 -1
  80. package/dist/wasm/_framework/dotnet.js.br +0 -0
  81. package/dist/wasm/_framework/dotnet.native.js +3 -3
  82. package/dist/wasm/_framework/dotnet.native.js.br +0 -0
  83. package/dist/wasm/_framework/dotnet.native.wasm +0 -0
  84. package/dist/wasm/_framework/dotnet.native.wasm.br +0 -0
  85. package/dist/wasm/_framework/dotnet.runtime.js +1 -1
  86. package/dist/wasm/_framework/dotnet.runtime.js.br +0 -0
  87. package/package.json +8 -1
package/dist/core.d.ts ADDED
@@ -0,0 +1,924 @@
1
+ /** Engine API: safe to import in plain Node ESM without loading the browser editor. */
2
+ import type { ConversionOptions, CompareOptions, RevisionListEntry, VersionInfo, ErrorResponse, CompareResult, PackageManifest, DeliverableVerificationResult, DeliveryReceiptVerificationResult, RedlineReversibilityProof, DocxodusWasmExports, FormatChangeDetails, DocxDiffSettings, DocxDiffRevision, DocxDiffBatchCandidate, DocxDiffBatchResult, DocxDiffProduct, DocxDiffProducts, SemanticChange, SemanticChangeFamily, SemanticChangeOperation, SemanticChangeSet, SemanticValue, DocxDiffReviewer, DocxDiffConsolidateSettings, DocxDiffConflict, DocxDiffConflictCompetitor, DocxDiffConsolidatedRevision, Annotation, AddAnnotationRequest, AddAnnotationResponse, RemoveAnnotationResponse, AnnotationOptions, DocumentStructure, DocumentElement, TableColumnInfo, AnnotationTarget, AddAnnotationWithTargetRequest, DocumentMetadata, SectionMetadata, OpenContractDocExport, PawlsPage, PawlsPageBoundary, PawlsToken, OpenContractsAnnotation, OpenContractsSinglePageAnnotation, BoundingBox, TokenId, TextSpan, OpenContractsRelationship, AnnotationLabel, ExternalAnnotationSet, ExternalAnnotationValidationResult, ExternalAnnotationValidationIssue, ExternalAnnotationProjectionSettings, MarkdownProjectionSettings, MarkdownAnchorTarget, MarkdownProjection, DocxSessionSettings } from "./types.js";
3
+ import { DocxSession } from "./session.js";
4
+ import { DocxHistoryArchive, DocxHistoryClient } from './history.js';
5
+ import type { HistoryStorage } from './history.js';
6
+ export * from './history.js';
7
+ export * from './history-checkpoints.js';
8
+ export * from './history-indexeddb.js';
9
+ export * from './history-controls.js';
10
+ /** Open history over host-owned storage after initialize(). No network layer is installed. */
11
+ export declare function openDocxHistory(storage: HistoryStorage): DocxHistoryClient;
12
+ /** Open a self-contained readonly .docxhistory file after initialize(); no storage adapter needed. */
13
+ export declare function openDocxHistoryArchive(bytes: Uint8Array): Promise<DocxHistoryArchive>;
14
+ export { DocxSession } from "./session.js";
15
+ export type { AnchorInfo, AnchorRef, AnchorTargetRef, BlockMetadata, BookmarkInfo, BookmarkRangeSegment, CharSpan, CommentListEntry, ContentControlBindingInfo, ContentControlBindingPolicy, ContentControlFillOptions, ContentControlInfo, ContentControlPlacement, ContentControlType, DocumentAnnotation, DocumentRange, DocxSessionProjection, DocxSessionSettings, EditError, EditErrorCode, EditResult, FindOptions, EditorRenderOptions, FormatOp, HyperlinkInfo, HyperlinkKind, ImageBinaryFormat, ImageCapabilities, ImageDimensions, ImageFormatCapability, ImageHorizontalAlignment, ImageHorizontalReference, ImageInsertOptions, ImageMarkupKind, ImageOccurrence, ImagePlacement, ImageVerticalAlignment, ImageVerticalReference, ImageWrapMode, ImageWrapSide, FloatingImageLayout, LineSpacingRule, ListMembership, FormattingInspection, InlineSpan, ParagraphFormatting, RunFormattingInfo, StyleInfo, TableStyleFormatting, MarkdownPatch, NumberFormat, PageCitation, PageCitationFragment, PageCitationPage, PageCitationRequest, PageCitationUnavailableReason, PageMapRegistrationResult, PageMapStatus, PageNumberField, PageNumberingOp, PageSetupOp, ParagraphBorderEdge, ParagraphFormatOp, RevisionDiagnostic, RevisionFamily, RevisionResolutionStatus, SectionInfo, SessionRevisionType, TableOfAuthoritiesOptions, TableOfContentsOptions, TableOfFiguresOptions, TableBorderScope, TableBorderSpec, TableInsertOptions, TableMergeContent, TableShadingScope, PackageManifest, PackageManifestInspectionLimits, PackageManifestEntry, PackageManifestFacts, PackageRelationship, PackageContentTypeDeclaration, PackageRevisionCounts, PackageAnnotationCounts, DeliverableVerificationResult, DeliveryArtifactVerification, DeliveryArtifactVerificationStatus, DeliveryReceiptVerificationResult, DeliverableVerificationMode, DeliverableVerificationDecision, DeliverableFindingDisposition, DeliverableFindingCategory, DeliverableCheckStatus, DeliverablePackageChangeKind, DeliverableArtifactRole, DeliverableArtifactAvailability, DeliverableSemanticChangeFamily, DeliverablePackageIdentity, DeliverableCheckResult, DeliverableFinding, DeliverablePackageChange, DeliverableSemanticChange, DeliverableSemanticDelta, DeliverableArtifactMetadata, VerificationDigest, VerificationFinding, VerificationFindingSeverity, ChangeLocation, RedlineReversibilityProof, RedlineProofPathResult, RedlineProofPackageIdentity, RedlineProofFinding, RedlineProofDirection, RedlineRevisionClassification, RedlineRevisionDisposition, RedlineRevisionIdentity, RedlineRevisionFamily, RedlineRevisionResolutionStatus, RedlineRevisionDiagnostic, RedlineModeledSemanticComparison, RedlinePackageDivergence, RedlinePackageDivergenceKind, } from "./types.js";
16
+ export type { FillOptions, BulkEditResult } from "./types.js";
17
+ export { PlaceholderKinds, ContextBoundary } from "./types.js";
18
+ export { DiffFormat } from "./types.js";
19
+ export type { EditSummary, DiffEntry } from "./types.js";
20
+ /**
21
+ * Open a {@link DocxSession} for surgical mutation of a DOCX. Requires
22
+ * {@link initialize} to have been called and awaited.
23
+ *
24
+ * The returned session keeps the document in WASM memory; call
25
+ * {@link DocxSession.close} when done.
26
+ */
27
+ export declare function openDocxSession(bytes: Uint8Array, settings?: DocxSessionSettings): DocxSession;
28
+ /**
29
+ * Mint a complete, blank single-paragraph DOCX (Normal style, US-Letter section) as bytes —
30
+ * a "New document" seed for editors that draft from scratch. Requires {@link initialize}.
31
+ */
32
+ export declare function createBlankDocx(): Uint8Array;
33
+ import { CommentRenderMode, PaginationMode, AnnotationLabelMode, RevisionType, DocxDiffRevisionGranularity, DocxDiffFormatComparison, ConflictResolution, ProjectionScopes, AnchorRenderMode, TableRenderMode, TrackedChangeMode, EmptyParagraphMode, AnchorIdRendering, ProjectionDepth, DocumentElementType, ComparisonLogLevel, ComparisonLogCodes, isInsertion, isDeletion, isMove, isFormatChange, findElementById, findElementsByType, getParagraphs, getTables, getTableColumns, targetElement, targetParagraph, targetParagraphRange, targetRun, targetTable, targetTableRow, targetTableCell, targetTableColumn, targetSearch, targetSearchInElement } from "./types.js";
34
+ export type { PageDimensions, MeasuredBlock, PageInfo, PaginationResult, PaginationOptions, PageMap, PageMapPage, PageMapFragment, PageMapRect, PageMapMode, PageMapAvailability, PageMapStory, PageCitationNavigation, } from "./pagination.js";
35
+ export { PaginationEngine, clearPageCitationHighlight, createUnavailablePageMap, navigateToPageCitation, paginateHtml, } from "./pagination.js";
36
+ export type { CommentProfile, CompleteRenderReport, DocxodusExportErrorCode, ExportPhase, ExportResourceLimits, FailedRenderReport, FontConfigurationIdentity, FontResolution, FontResolver, PaginatedHtmlOptions, PaginatedHtmlResult, PaginatedRenderMetadata, ReadinessOutcome, RenderReport, RenderReportBase, RenderWarning, ResourceOutcome, ReviewProfile, UnsupportedContentOutcome, UnsupportedContentPolicy, } from "./export-browser.js";
37
+ export { DEFAULT_MARGIN, DEFAULT_PAGE_HEIGHT, DEFAULT_PAGE_WIDTH, fitScale, parseSectionDimensions, ptToPx, pxToPt, } from "./page-geometry.js";
38
+ export { DocumentViewport } from "./viewport.js";
39
+ export type { ColumnWidth, DocumentViewportOptions } from "./viewport.js";
40
+ export type { ConversionOptions, CompareOptions, RevisionListEntry, VersionInfo, ErrorResponse, CompareResult, FormatChangeDetails, Annotation, AddAnnotationRequest, AddAnnotationResponse, RemoveAnnotationResponse, AnnotationOptions, DocumentStructure, DocumentElement, TableColumnInfo, AnnotationTarget, AddAnnotationWithTargetRequest, DocumentMetadata, SectionMetadata, OpenContractDocExport, PawlsPage, PawlsPageBoundary, PawlsToken, OpenContractsAnnotation, OpenContractsSinglePageAnnotation, BoundingBox, TokenId, TextSpan, OpenContractsRelationship, AnnotationLabel, ExternalAnnotationSet, ExternalAnnotationValidationResult, ExternalAnnotationValidationIssue, ExternalAnnotationProjectionSettings, MarkdownProjectionSettings, MarkdownAnchorTarget, MarkdownProjection, DocxDiffSettings, DocxDiffRevision, DocxDiffBatchCandidate, DocxDiffBatchResult, DocxDiffProduct, DocxDiffProducts, SemanticChange, SemanticChangeFamily, SemanticChangeOperation, SemanticChangeSet, SemanticValue, DocxDiffReviewer, DocxDiffConsolidateSettings, DocxDiffConflict, DocxDiffConflictCompetitor, DocxDiffConsolidatedRevision, };
41
+ export { CommentRenderMode, PaginationMode, AnnotationLabelMode, RevisionType, DocxDiffRevisionGranularity, DocxDiffFormatComparison, ConflictResolution, ProjectionScopes, AnchorRenderMode, TableRenderMode, TrackedChangeMode, EmptyParagraphMode, AnchorIdRendering, ProjectionDepth, DocumentElementType, ComparisonLogLevel, ComparisonLogCodes, isInsertion, isDeletion, isMove, isFormatChange, findElementById, findElementsByType, getParagraphs, getTables, getTableColumns, targetElement, targetParagraph, targetParagraphRange, targetRun, targetTable, targetTableRow, targetTableCell, targetTableColumn, targetSearch, targetSearchInElement, };
42
+ /**
43
+ * Current base path for WASM files.
44
+ * Empty string means auto-detect from module URL.
45
+ */
46
+ export declare let wasmBasePath: string;
47
+ /**
48
+ * Set custom base path for WASM files.
49
+ * Pass empty string or don't call this to auto-detect from module location.
50
+ *
51
+ * @param path - Custom path to WASM files, or empty string for auto-detection
52
+ */
53
+ export declare function setWasmBasePath(path: string): void;
54
+ /**
55
+ * Initialize the Docxodus WASM runtime.
56
+ * Must be called before using any conversion/comparison functions.
57
+ * Safe to call multiple times - will only initialize once.
58
+ *
59
+ * By default, WASM files are auto-detected from the module's location
60
+ * (works with CDN, npm, or local hosting).
61
+ * Pass a basePath to load from a custom location instead.
62
+ *
63
+ * @param basePath - Optional custom path to WASM files. Leave empty for auto-detection.
64
+ */
65
+ export declare function initialize(basePath?: string): Promise<void>;
66
+ /**
67
+ * Generate a deterministic, non-mutating verification manifest from DOCX bytes.
68
+ * Invalid, malformed, and encrypted packages are represented by structured findings.
69
+ */
70
+ export declare function generatePackageManifest(document: File | Uint8Array): Promise<PackageManifest>;
71
+ /**
72
+ * Run the default bounded deliverable-verification policy on exact DOCX bytes.
73
+ * Invalid, malformed, encrypted, and safety-limited packages are returned as
74
+ * structured report findings rather than editable-session errors. When supplied,
75
+ * the exact baseline bytes are used to classify pre-existing, new, and resolved findings.
76
+ */
77
+ export declare function verifyDeliverable(document: File | Uint8Array, baseline?: File | Uint8Array): Promise<DeliverableVerificationResult>;
78
+ /**
79
+ * Verify a portable JSON delivery change receipt against supplied artifact bytes.
80
+ *
81
+ * The receipt travels as its JSON envelope string; `artifacts` maps each artifact id
82
+ * the receipt records to the exact bytes to independently re-hash against it. Omitted
83
+ * artifacts report `"missing"`. Malformed input yields a structured invalid verdict
84
+ * whose findings carry the reason — never a thrown error.
85
+ */
86
+ export declare function verifyDeliveryReceipt(receiptJson: string, artifacts?: Record<string, Uint8Array>): Promise<DeliveryReceiptVerificationResult>;
87
+ /**
88
+ * Prove that a redline's generated revisions accept to the intended final and reject to the
89
+ * selected baseline without consuming pre-existing review state.
90
+ *
91
+ * Three packages are inspected and two rebuilt, so on a UI thread prefer the worker proxy's
92
+ * `proveRedlineReversibility`. Malformed, encrypted, and safety-limited packages are reported as
93
+ * structured proof findings rather than thrown errors. The rebuilt packages are not returned:
94
+ * the proof carries their digests and the divergences between them and each expected document.
95
+ *
96
+ * @param baseline - The document the redline was generated against
97
+ * @param intendedFinal - The document accepting the generated revisions must reproduce
98
+ * @param redline - The generated redline under proof
99
+ */
100
+ export declare function proveRedlineReversibility(baseline: File | Uint8Array, intendedFinal: File | Uint8Array, redline: File | Uint8Array): Promise<RedlineReversibilityProof>;
101
+ /**
102
+ * Convert a DOCX document to HTML.
103
+ *
104
+ * @param document - DOCX file as File object or Uint8Array
105
+ * @param options - Conversion options
106
+ * @returns HTML string
107
+ * @throws Error if conversion fails
108
+ *
109
+ * @example
110
+ * ```typescript
111
+ * // Basic conversion
112
+ * const html = await convertDocxToHtml(docxFile);
113
+ *
114
+ * // With pagination (PDF.js-style page view)
115
+ * const html = await convertDocxToHtml(docxFile, {
116
+ * paginationMode: PaginationMode.Paginated,
117
+ * paginationScale: 0.8
118
+ * });
119
+ *
120
+ * // With annotations rendered
121
+ * const html = await convertDocxToHtml(docxFile, {
122
+ * renderAnnotations: true,
123
+ * annotationLabelMode: AnnotationLabelMode.Above
124
+ * });
125
+ *
126
+ * // With footnotes and endnotes
127
+ * const html = await convertDocxToHtml(docxFile, {
128
+ * renderFootnotesAndEndnotes: true
129
+ * });
130
+ *
131
+ * // With headers and footers
132
+ * const html = await convertDocxToHtml(docxFile, {
133
+ * renderHeadersAndFooters: true
134
+ * });
135
+ *
136
+ * // With tracked changes (redlines visible)
137
+ * const html = await convertDocxToHtml(docxFile, {
138
+ * renderTrackedChanges: true,
139
+ * showDeletedContent: true,
140
+ * renderMoveOperations: true
141
+ * });
142
+ * ```
143
+ */
144
+ /**
145
+ * Render a single document block to faithful HTML, addressed by its anchor.
146
+ *
147
+ * The anchor is the `data-anchor` value stamped on a block during a full
148
+ * conversion (a bare 32-hex Unid), or a full `kind:scope:unid` anchor — either
149
+ * form works. Powers the editor's incremental per-block re-render: apply an edit
150
+ * to a DocxSession, then re-render only the changed block instead of the whole
151
+ * document. Returns the block's HTML element (no `<html>`/`<head>` wrapper).
152
+ */
153
+ export declare function renderBlockHtml(document: File | Uint8Array, anchorId: string, options?: {
154
+ cssPrefix?: string;
155
+ fabricateClasses?: boolean;
156
+ }): Promise<string>;
157
+ export declare function convertDocxToHtml(document: File | Uint8Array, options?: ConversionOptions): Promise<string>;
158
+ /**
159
+ * Compare two DOCX documents and return the redlined result as a DOCX.
160
+ *
161
+ * @param original - Original DOCX document
162
+ * @param modified - Modified DOCX document
163
+ * @param options - Comparison options
164
+ * @returns Redlined DOCX as Uint8Array
165
+ * @throws Error if comparison fails
166
+ */
167
+ export declare function compareDocuments(original: File | Uint8Array, modified: File | Uint8Array, options?: CompareOptions): Promise<Uint8Array>;
168
+ /**
169
+ * Compare two DOCX documents and return the result as HTML.
170
+ *
171
+ * @param original - Original DOCX document
172
+ * @param modified - Modified DOCX document
173
+ * @param options - Comparison options
174
+ * @returns HTML string with redlined content
175
+ * @throws Error if comparison fails
176
+ */
177
+ export declare function compareDocumentsToHtml(original: File | Uint8Array, modified: File | Uint8Array, options?: CompareOptions): Promise<string>;
178
+ /**
179
+ * Get revisions from a compared document.
180
+ *
181
+ * @param document - A document that has been through comparison (has tracked changes)
182
+ * @param options - Optional move detection configuration
183
+ * @returns Array of revisions
184
+ * @throws Error if operation fails
185
+ *
186
+ * @example
187
+ * ```typescript
188
+ * // Default settings (move detection enabled, 80% threshold)
189
+ * const revisions = await getRevisions(comparedDoc);
190
+ *
191
+ * // Custom move detection settings
192
+ * const revisions = await getRevisions(comparedDoc, {
193
+ * detectMoves: true,
194
+ * moveSimilarityThreshold: 0.9, // Require 90% word overlap
195
+ * moveMinimumWordCount: 5, // Only consider phrases of 5+ words
196
+ * caseInsensitive: true // Ignore case when matching
197
+ * });
198
+ *
199
+ * // Disable move detection entirely
200
+ * const revisions = await getRevisions(comparedDoc, { detectMoves: false });
201
+ * ```
202
+ */
203
+ export declare function getRevisions(document: File | Uint8Array): Promise<RevisionListEntry[]>;
204
+ /**
205
+ * Compare two DOCX documents with the IR diff engine and return the redlined
206
+ * result as a DOCX (native w:ins/w:del/w:moveFrom/w:moveTo/w:rPrChange markup).
207
+ *
208
+ * @param left - The earlier/original document.
209
+ * @param right - The later/revised document.
210
+ * @param settings - Optional {@link DocxDiffSettings}; omit for engine defaults.
211
+ * @returns Redlined DOCX as Uint8Array.
212
+ * @throws Error if comparison fails.
213
+ */
214
+ export declare function docxDiffCompare(left: File | Uint8Array, right: File | Uint8Array, settings?: DocxDiffSettings): Promise<Uint8Array>;
215
+ /**
216
+ * Compare two DOCX documents with the IR diff engine and return the
217
+ * anchor-addressed revision list.
218
+ *
219
+ * @param left - The earlier/original document.
220
+ * @param right - The later/revised document.
221
+ * @param settings - Optional {@link DocxDiffSettings}; omit for engine defaults.
222
+ * @returns Array of {@link DocxDiffRevision} (each carrying its left/right block anchors).
223
+ * @throws Error if the operation fails.
224
+ */
225
+ export declare function docxDiffGetRevisions(left: File | Uint8Array, right: File | Uint8Array, settings?: DocxDiffSettings): Promise<DocxDiffRevision[]>;
226
+ /**
227
+ * Compare two DOCX documents ONCE and return every requested data product from
228
+ * that single memoized pass (issue #594). Where a review pipeline calling
229
+ * {@link docxDiffCompare}, {@link docxDiffGetRevisions}, and
230
+ * {@link docxDiffGetEditScript} separately pays for the alignment per call, this
231
+ * runs it once — each product identical to its standalone counterpart (the edit
232
+ * script is handed over parsed rather than as the serialized string).
233
+ *
234
+ * @param left - The earlier/original document.
235
+ * @param right - The later/revised document.
236
+ * @param settings - Optional {@link DocxDiffSettings}; omit for engine defaults.
237
+ * @param products - Products to compute; omit for all four.
238
+ * @throws Error if the operation fails.
239
+ */
240
+ export declare function docxDiffCompareProducts(left: File | Uint8Array, right: File | Uint8Array, settings?: DocxDiffSettings, products?: DocxDiffProduct[]): Promise<DocxDiffProducts>;
241
+ /**
242
+ * Compare ONE baseline against MANY candidates, reading the baseline once (issue #617).
243
+ *
244
+ * The read is the single largest stage of a comparison, and a fan-out — one negotiated
245
+ * draft against every counterparty's markup — otherwise re-reads the baseline for each
246
+ * one. This reads it once and compares every candidate against that snapshot; each
247
+ * result is identical to what {@link docxDiffCompareProducts} returns for the same pair.
248
+ *
249
+ * A candidate that fails carries an `error` instead of products; the rest of the batch
250
+ * still comes back, because one malformed markup should not cost the other ninety-nine.
251
+ *
252
+ * @param baseline - The shared left-hand document.
253
+ * @param candidates - The documents to compare against it, in order.
254
+ * @param settings - Optional {@link DocxDiffSettings}; omit for engine defaults.
255
+ * @param products - Products to compute; omit for all four.
256
+ * @throws Error if the batch itself fails (a bad baseline, malformed settings).
257
+ */
258
+ export declare function docxDiffCompareBatch(baseline: File | Uint8Array, candidates: readonly DocxDiffBatchCandidate[], settings?: DocxDiffSettings, products?: DocxDiffProduct[]): Promise<DocxDiffBatchResult[]>;
259
+ /**
260
+ * Compare two DOCX documents with the IR diff engine and return the edit script
261
+ * as a JSON string — the diff-as-data differentiator. The script is the
262
+ * anchor-addressed list of block operations the markup and revision renderers
263
+ * both consume: stable and machine-readable for storage, transport, and audit.
264
+ *
265
+ * @param left - The earlier/original document.
266
+ * @param right - The later/revised document.
267
+ * @param settings - Optional {@link DocxDiffSettings}; omit for engine defaults.
268
+ * @returns The edit script serialized as indented JSON.
269
+ * @throws Error if the operation fails.
270
+ */
271
+ export declare function docxDiffGetEditScript(left: File | Uint8Array, right: File | Uint8Array, settings?: DocxDiffSettings): Promise<string>;
272
+ /**
273
+ * Compare two DOCX documents and return the stable, versioned semantic-change
274
+ * schema. This is the audit/verification surface; it classifies document meaning
275
+ * beyond the renderer's internal edit script and preserves unknown package changes.
276
+ */
277
+ export declare function docxDiffGetSemanticChanges(left: File | Uint8Array, right: File | Uint8Array, settings?: DocxDiffSettings): Promise<SemanticChangeSet>;
278
+ /**
279
+ * Accept every tracked revision in a redlined DOCX and return the resulting bytes
280
+ * (materializes the "right"/revised side). The byte-in, byte-out counterpart of
281
+ * {@link docxDiffCompare}: `docxDiffAcceptRevisions(await docxDiffCompare(left, right))`
282
+ * equals `right` at the per-block text level — so callers can verify the round-trip
283
+ * contract of a redline, not just inspect its shape.
284
+ *
285
+ * @param redline - A DOCX carrying tracked-changes markup (e.g. {@link docxDiffCompare} output).
286
+ * @returns The DOCX bytes with all revisions accepted.
287
+ * @throws Error if the operation fails.
288
+ */
289
+ export declare function docxDiffAcceptRevisions(redline: File | Uint8Array): Promise<Uint8Array>;
290
+ /**
291
+ * Reject every tracked revision in a redlined DOCX and return the resulting bytes
292
+ * (materializes the "left"/original side): `docxDiffRejectRevisions(await
293
+ * docxDiffCompare(left, right))` equals `left` at the per-block text level.
294
+ *
295
+ * @param redline - A DOCX carrying tracked-changes markup (e.g. {@link docxDiffCompare} output).
296
+ * @returns The DOCX bytes with all revisions rejected.
297
+ * @throws Error if the operation fails.
298
+ */
299
+ export declare function docxDiffRejectRevisions(redline: File | Uint8Array): Promise<Uint8Array>;
300
+ /**
301
+ * Consolidate several reviewers' edits against a shared base DOCX and return the
302
+ * merged redlined result as a DOCX (native multi-author tracked-changes markup).
303
+ *
304
+ * @param base - The shared base document all reviewers edited from.
305
+ * @param reviewers - The reviewers' edited copies + author names.
306
+ * @param settings - Optional {@link DocxDiffConsolidateSettings}; omit for engine defaults.
307
+ * @returns Consolidated redlined DOCX as Uint8Array.
308
+ * @throws Error if consolidation fails.
309
+ */
310
+ export declare function docxDiffConsolidate(base: File | Uint8Array, reviewers: DocxDiffReviewer[], settings?: DocxDiffConsolidateSettings): Promise<Uint8Array>;
311
+ /**
312
+ * Consolidate several reviewers' edits against a shared base DOCX and return the
313
+ * per-token conflict report — every base span two or more reviewers edited
314
+ * incompatibly, with each reviewer's competing variant.
315
+ *
316
+ * @param base - The shared base document all reviewers edited from.
317
+ * @param reviewers - The reviewers' edited copies + author names.
318
+ * @param settings - Optional {@link DocxDiffConsolidateSettings}; omit for engine defaults.
319
+ * @returns Array of {@link DocxDiffConflict}.
320
+ * @throws Error if the operation fails.
321
+ */
322
+ export declare function docxDiffGetConflicts(base: File | Uint8Array, reviewers: DocxDiffReviewer[], settings?: DocxDiffConsolidateSettings): Promise<DocxDiffConflict[]>;
323
+ /**
324
+ * Consolidate several reviewers' edits against a shared base DOCX and return the
325
+ * merged revision list — each revision carrying its author, block anchors, and
326
+ * (when contested) the {@link DocxDiffConsolidatedRevision.conflictId} linking it
327
+ * to a {@link DocxDiffConflict}.
328
+ *
329
+ * @param base - The shared base document all reviewers edited from.
330
+ * @param reviewers - The reviewers' edited copies + author names.
331
+ * @param settings - Optional {@link DocxDiffConsolidateSettings}; omit for engine defaults.
332
+ * @returns Array of {@link DocxDiffConsolidatedRevision}.
333
+ * @throws Error if the operation fails.
334
+ */
335
+ export declare function docxDiffGetConsolidatedRevisions(base: File | Uint8Array, reviewers: DocxDiffReviewer[], settings?: DocxDiffConsolidateSettings): Promise<DocxDiffConsolidatedRevision[]>;
336
+ /**
337
+ * Consolidate several reviewers' edits against a shared base DOCX and return the
338
+ * merged edit script as a JSON string — the diff-as-data view of the
339
+ * consolidation (the anchor-addressed list of composite block operations).
340
+ *
341
+ * @param base - The shared base document all reviewers edited from.
342
+ * @param reviewers - The reviewers' edited copies + author names.
343
+ * @param settings - Optional {@link DocxDiffConsolidateSettings}; omit for engine defaults.
344
+ * @returns The consolidated edit script serialized as indented JSON.
345
+ * @throws Error if the operation fails.
346
+ */
347
+ export declare function docxDiffGetConsolidatedEditScript(base: File | Uint8Array, reviewers: DocxDiffReviewer[], settings?: DocxDiffConsolidateSettings): Promise<string>;
348
+ /**
349
+ * Get version information about the library.
350
+ */
351
+ export declare function getVersion(): VersionInfo;
352
+ /**
353
+ * Check if the WASM runtime is initialized.
354
+ */
355
+ export declare function isInitialized(): boolean;
356
+ /**
357
+ * The raw WASM bridge exports (DocumentConverter, DocxSessionBridge, ...).
358
+ *
359
+ * For consumers that drive a bridge class directly — most notably
360
+ * `DocxEditor.open(container, bytes, exports)`, which needs the exports object
361
+ * rather than the wrapped functions in this module. Requires `initialize()` to
362
+ * have completed; throws otherwise.
363
+ */
364
+ export declare function getWasmExports(): DocxodusWasmExports;
365
+ /**
366
+ * Get all annotations from a document.
367
+ *
368
+ * @param document - DOCX file as File object or Uint8Array
369
+ * @returns Array of annotations
370
+ * @throws Error if operation fails
371
+ *
372
+ * @example
373
+ * ```typescript
374
+ * const annotations = await getAnnotations(docxFile);
375
+ * for (const annot of annotations) {
376
+ * console.log(`${annot.label}: "${annot.annotatedText}"`);
377
+ * }
378
+ * ```
379
+ */
380
+ export declare function getAnnotations(document: File | Uint8Array): Promise<Annotation[]>;
381
+ /**
382
+ * Add an annotation to a document.
383
+ *
384
+ * @param document - DOCX file as File object or Uint8Array
385
+ * @param request - Annotation details including search text or paragraph indices
386
+ * @returns Response with modified document bytes and annotation info
387
+ * @throws Error if operation fails
388
+ *
389
+ * @example
390
+ * ```typescript
391
+ * // Annotate by searching for text
392
+ * const result = await addAnnotation(docxFile, {
393
+ * id: "annot-1",
394
+ * labelId: "CLAUSE_A",
395
+ * label: "Important Clause",
396
+ * color: "#FFEB3B",
397
+ * searchText: "shall not be liable",
398
+ * occurrence: 1
399
+ * });
400
+ *
401
+ * // Annotate by paragraph range
402
+ * const result = await addAnnotation(docxFile, {
403
+ * id: "annot-2",
404
+ * labelId: "SECTION_1",
405
+ * label: "Introduction",
406
+ * color: "#4CAF50",
407
+ * startParagraphIndex: 0,
408
+ * endParagraphIndex: 2
409
+ * });
410
+ *
411
+ * // Get modified document
412
+ * const modifiedDocBytes = base64ToBytes(result.documentBytes);
413
+ * ```
414
+ */
415
+ export declare function addAnnotation(document: File | Uint8Array, request: AddAnnotationRequest): Promise<AddAnnotationResponse>;
416
+ /**
417
+ * Remove an annotation from a document.
418
+ *
419
+ * @param document - DOCX file as File object or Uint8Array
420
+ * @param annotationId - The ID of the annotation to remove
421
+ * @returns Response with modified document bytes
422
+ * @throws Error if operation fails
423
+ *
424
+ * @example
425
+ * ```typescript
426
+ * const result = await removeAnnotation(docxFile, "annot-1");
427
+ * const modifiedDocBytes = base64ToBytes(result.documentBytes);
428
+ * ```
429
+ */
430
+ export declare function removeAnnotation(document: File | Uint8Array, annotationId: string): Promise<RemoveAnnotationResponse>;
431
+ /**
432
+ * Check if a document has any annotations.
433
+ *
434
+ * @param document - DOCX file as File object or Uint8Array
435
+ * @returns true if the document has annotations
436
+ * @throws Error if operation fails
437
+ *
438
+ * @example
439
+ * ```typescript
440
+ * if (await hasAnnotations(docxFile)) {
441
+ * const annotations = await getAnnotations(docxFile);
442
+ * console.log(`Document has ${annotations.length} annotations`);
443
+ * }
444
+ * ```
445
+ */
446
+ export declare function hasAnnotations(document: File | Uint8Array): Promise<boolean>;
447
+ /**
448
+ * Get the document structure for element-based annotation targeting.
449
+ *
450
+ * @param document - DOCX file as File object or Uint8Array
451
+ * @returns Document structure with element tree
452
+ * @throws Error if operation fails
453
+ *
454
+ * @example
455
+ * ```typescript
456
+ * const structure = await getDocumentStructure(docxFile);
457
+ *
458
+ * // Navigate the structure tree
459
+ * console.log(`Document has ${structure.root.children.length} top-level elements`);
460
+ *
461
+ * // Find all paragraphs
462
+ * const paragraphs = getParagraphs(structure);
463
+ * console.log(`Found ${paragraphs.length} paragraphs`);
464
+ *
465
+ * // Find all tables
466
+ * const tables = getTables(structure);
467
+ * for (const table of tables) {
468
+ * const columns = getTableColumns(structure, table.id);
469
+ * console.log(`Table ${table.id} has ${columns.length} columns`);
470
+ * }
471
+ *
472
+ * // Look up element by ID
473
+ * const element = findElementById(structure, "doc/p-0");
474
+ * if (element) {
475
+ * console.log(`First paragraph: "${element.textPreview}"`);
476
+ * }
477
+ * ```
478
+ */
479
+ export declare function getDocumentStructure(document: File | Uint8Array): Promise<DocumentStructure>;
480
+ /**
481
+ * Get document metadata for lazy loading pagination.
482
+ * This is a fast operation that extracts structure information without full HTML rendering.
483
+ *
484
+ * @param document - DOCX file as File object or Uint8Array
485
+ * @returns Document metadata including sections, dimensions, and content counts
486
+ * @throws Error if operation fails
487
+ *
488
+ * @example
489
+ * ```typescript
490
+ * const metadata = await getDocumentMetadata(docxFile);
491
+ *
492
+ * // Check document overview
493
+ * console.log(`Document has ${metadata.totalParagraphs} paragraphs`);
494
+ * console.log(`Document has ${metadata.sections.length} sections`);
495
+ * console.log(`Estimated ${metadata.estimatedPageCount} pages`);
496
+ *
497
+ * // Check section properties
498
+ * for (const section of metadata.sections) {
499
+ * console.log(`Section ${section.sectionIndex}: ${section.pageWidthPt}x${section.pageHeightPt}pt`);
500
+ * console.log(` Paragraphs: ${section.paragraphCount}, Tables: ${section.tableCount}`);
501
+ * console.log(` Has header: ${section.hasHeader}, Has footer: ${section.hasFooter}`);
502
+ * }
503
+ *
504
+ * // Check document features
505
+ * if (metadata.hasTrackedChanges) {
506
+ * console.log("Document has tracked changes");
507
+ * }
508
+ * if (metadata.hasFootnotes) {
509
+ * console.log("Document has footnotes");
510
+ * }
511
+ * ```
512
+ */
513
+ export declare function getDocumentMetadata(document: File | Uint8Array): Promise<DocumentMetadata>;
514
+ /**
515
+ * Export document to OpenContracts format.
516
+ *
517
+ * This provides complete document text, structure, and layout information
518
+ * compatible with the OpenContracts ecosystem for document analysis.
519
+ *
520
+ * @param document - DOCX file as File object or Uint8Array
521
+ * @returns OpenContractDocExport with complete document data
522
+ * @throws Error if export fails
523
+ *
524
+ * @example
525
+ * ```typescript
526
+ * const result = await exportToOpenContract(docxFile);
527
+ *
528
+ * // Access complete document text
529
+ * console.log(`Content length: ${result.content.length} characters`);
530
+ *
531
+ * // Get document structure
532
+ * console.log(`Pages: ${result.pageCount}`);
533
+ * console.log(`Structural annotations: ${result.labelledText.filter(a => a.structural).length}`);
534
+ *
535
+ * // Access PAWLS layout data
536
+ * for (const page of result.pawlsFileContent) {
537
+ * console.log(`Page ${page.page.index}: ${page.tokens.length} tokens`);
538
+ * }
539
+ * ```
540
+ */
541
+ export declare function exportToOpenContract(document: File | Uint8Array): Promise<OpenContractDocExport>;
542
+ /**
543
+ * Convert a DOCX file to an anchor-addressed Markdown projection.
544
+ *
545
+ * The projection is a deterministic, anchor-keyed Markdown rendering of the document,
546
+ * suitable for LLM editing pipelines, structured search indexers, and diff/review UIs.
547
+ * Every paragraph, heading, list item, table, table cell, footnote, endnote, and
548
+ * comment is addressable by an `{#kind:scope:unid}` anchor that survives reformatting.
549
+ *
550
+ * See `docs/architecture/markdown_projection.md` for the projection spec.
551
+ *
552
+ * @param document - DOCX file as `File` or `Uint8Array`
553
+ * @param settings - Optional projection settings (defaults: all scopes, anchor blocks, accept tracked changes)
554
+ * @throws Error if conversion fails
555
+ *
556
+ * @example
557
+ * ```typescript
558
+ * const result = await convertWmlToMarkdown(docxFile);
559
+ * console.log(result.markdown);
560
+ * for (const [id, target] of Object.entries(result.anchorIndex)) {
561
+ * console.log(id, target.partUri);
562
+ * }
563
+ * ```
564
+ */
565
+ export declare function convertWmlToMarkdown(document: File | Uint8Array, settings?: MarkdownProjectionSettings): Promise<MarkdownProjection>;
566
+ /**
567
+ * Add an annotation using flexible targeting (element ID, indices, or text search).
568
+ *
569
+ * @param document - DOCX file as File object or Uint8Array
570
+ * @param request - Annotation details with target specification
571
+ * @returns Response with modified document bytes and annotation info
572
+ * @throws Error if operation fails
573
+ *
574
+ * @example
575
+ * ```typescript
576
+ * // First get the document structure to find target elements
577
+ * const structure = await getDocumentStructure(docxFile);
578
+ *
579
+ * // Annotate a specific paragraph by element ID
580
+ * const result1 = await addAnnotationWithTarget(docxFile, {
581
+ * id: "annot-1",
582
+ * labelId: "INTRO",
583
+ * label: "Introduction",
584
+ * color: "#4CAF50",
585
+ * target: targetElement("doc/p-0")
586
+ * });
587
+ *
588
+ * // Annotate a table cell
589
+ * const result2 = await addAnnotationWithTarget(docxFile, {
590
+ * id: "annot-2",
591
+ * labelId: "CELL_HIGHLIGHT",
592
+ * label: "Important Cell",
593
+ * color: "#FFEB3B",
594
+ * target: targetTableCell(0, 1, 2) // Table 0, Row 1, Cell 2
595
+ * });
596
+ *
597
+ * // Annotate a table column
598
+ * const result3 = await addAnnotationWithTarget(docxFile, {
599
+ * id: "annot-3",
600
+ * labelId: "COLUMN_DATA",
601
+ * label: "Values Column",
602
+ * color: "#2196F3",
603
+ * target: targetTableColumn(0, 1) // Table 0, Column 1
604
+ * });
605
+ *
606
+ * // Search for text within a specific element
607
+ * const result4 = await addAnnotationWithTarget(docxFile, {
608
+ * id: "annot-4",
609
+ * labelId: "KEYWORD",
610
+ * label: "Keyword",
611
+ * color: "#FF5722",
612
+ * target: targetSearchInElement("doc/p-2", "important", 1)
613
+ * });
614
+ * ```
615
+ */
616
+ export declare function addAnnotationWithTarget(document: File | Uint8Array, request: AddAnnotationWithTargetRequest): Promise<AddAnnotationResponse>;
617
+ /**
618
+ * Compute the SHA256 hash of a document for integrity validation.
619
+ *
620
+ * @param document - DOCX file as File object or Uint8Array
621
+ * @returns SHA256 hash as lowercase hex string
622
+ * @throws Error if operation fails
623
+ *
624
+ * @example
625
+ * ```typescript
626
+ * const hash = await computeDocumentHash(docxFile);
627
+ * console.log(`Document hash: ${hash}`);
628
+ *
629
+ * // Later, verify the document hasn't changed
630
+ * const currentHash = await computeDocumentHash(docxFile);
631
+ * if (currentHash !== storedHash) {
632
+ * console.log("Document has been modified");
633
+ * }
634
+ * ```
635
+ */
636
+ export declare function computeDocumentHash(document: File | Uint8Array): Promise<string>;
637
+ /**
638
+ * Create an ExternalAnnotationSet from a document.
639
+ * This extracts the document structure and computes the hash for integrity validation.
640
+ *
641
+ * @param document - DOCX file as File object or Uint8Array
642
+ * @param documentId - Unique identifier for the document (filename, UUID, etc.)
643
+ * @returns ExternalAnnotationSet ready for adding annotations
644
+ * @throws Error if operation fails
645
+ *
646
+ * @example
647
+ * ```typescript
648
+ * // Create an annotation set
649
+ * const set = await createExternalAnnotationSet(docxFile, "contract-v1.0");
650
+ *
651
+ * // Access document text for searching
652
+ * console.log(`Document length: ${set.content.length} chars`);
653
+ *
654
+ * // Add label definitions
655
+ * set.textLabels["IMPORTANT"] = {
656
+ * id: "IMPORTANT",
657
+ * text: "Important",
658
+ * color: "#FF0000",
659
+ * description: "Important text",
660
+ * icon: "",
661
+ * labelType: "text"
662
+ * };
663
+ *
664
+ * // Create annotations using the content
665
+ * const annotation = createAnnotationFromSearch(
666
+ * "ann-001", "IMPORTANT", set.content, "shall not be liable"
667
+ * );
668
+ * if (annotation) {
669
+ * set.labelledText.push(annotation);
670
+ * }
671
+ *
672
+ * // Serialize for storage
673
+ * const json = JSON.stringify(set);
674
+ * ```
675
+ */
676
+ export declare function createExternalAnnotationSet(document: File | Uint8Array, documentId: string): Promise<ExternalAnnotationSet>;
677
+ /**
678
+ * Validate an external annotation set against a document.
679
+ * Checks hash match and verifies each annotation's text still matches.
680
+ *
681
+ * @param document - DOCX file as File object or Uint8Array
682
+ * @param annotationSet - The annotation set to validate
683
+ * @returns Validation result with any issues found
684
+ * @throws Error if operation fails
685
+ *
686
+ * @example
687
+ * ```typescript
688
+ * const result = await validateExternalAnnotations(docxFile, annotationSet);
689
+ *
690
+ * if (!result.isValid) {
691
+ * if (result.hashMismatch) {
692
+ * console.log("Document has been modified since annotations were created");
693
+ * }
694
+ * for (const issue of result.issues) {
695
+ * console.log(`${issue.issueType}: ${issue.description}`);
696
+ * }
697
+ * }
698
+ * ```
699
+ */
700
+ export declare function validateExternalAnnotations(document: File | Uint8Array, annotationSet: ExternalAnnotationSet): Promise<ExternalAnnotationValidationResult>;
701
+ /**
702
+ * Convert a DOCX document to HTML with external annotations projected.
703
+ *
704
+ * @param document - DOCX file as File object or Uint8Array
705
+ * @param annotationSet - The external annotation set to project
706
+ * @param conversionOptions - HTML conversion options
707
+ * @param projectionOptions - Annotation projection options
708
+ * @returns HTML string with annotations projected
709
+ * @throws Error if operation fails
710
+ *
711
+ * @example
712
+ * ```typescript
713
+ * // Basic usage
714
+ * const html = await convertDocxToHtmlWithExternalAnnotations(
715
+ * docxFile,
716
+ * annotationSet
717
+ * );
718
+ *
719
+ * // With custom options
720
+ * const html = await convertDocxToHtmlWithExternalAnnotations(
721
+ * docxFile,
722
+ * annotationSet,
723
+ * { pageTitle: "Annotated Document" },
724
+ * { labelMode: AnnotationLabelMode.Inline, cssClassPrefix: "my-annot-" }
725
+ * );
726
+ * ```
727
+ */
728
+ export declare function convertDocxToHtmlWithExternalAnnotations(document: File | Uint8Array, annotationSet: ExternalAnnotationSet, conversionOptions?: ConversionOptions, projectionOptions?: ExternalAnnotationProjectionSettings): Promise<string>;
729
+ /**
730
+ * Search for text in a document and return character offsets.
731
+ * Useful for finding text locations to create annotations.
732
+ *
733
+ * @param document - DOCX file as File object or Uint8Array
734
+ * @param searchText - Text to search for
735
+ * @param maxResults - Maximum number of results (default: 100)
736
+ * @returns Array of TextSpan objects with offsets
737
+ * @throws Error if operation fails
738
+ *
739
+ * @example
740
+ * ```typescript
741
+ * const occurrences = await searchTextOffsets(docxFile, "liability");
742
+ * console.log(`Found ${occurrences.length} occurrences`);
743
+ *
744
+ * for (const span of occurrences) {
745
+ * console.log(`"${span.text}" at offset ${span.start}-${span.end}`);
746
+ * }
747
+ * ```
748
+ */
749
+ export declare function searchTextOffsets(document: File | Uint8Array, searchText: string, maxResults?: number): Promise<TextSpan[]>;
750
+ /**
751
+ * Create an annotation from character offsets.
752
+ * This is a client-side helper - no WASM call needed.
753
+ *
754
+ * @param id - Unique identifier for the annotation
755
+ * @param labelId - Label/category ID for the annotation
756
+ * @param documentText - Full document text (from annotationSet.content)
757
+ * @param startOffset - Start character offset (0-indexed, inclusive)
758
+ * @param endOffset - End character offset (exclusive)
759
+ * @returns OpenContractsAnnotation ready to add to an annotation set
760
+ * @throws Error if offsets are invalid
761
+ *
762
+ * @example
763
+ * ```typescript
764
+ * const set = await createExternalAnnotationSet(docxFile, "doc-1");
765
+ * const annotation = createAnnotation("ann-001", "IMPORTANT", set.content, 100, 150);
766
+ * set.labelledText.push(annotation);
767
+ * ```
768
+ */
769
+ export declare function createAnnotation(id: string, labelId: string, documentText: string, startOffset: number, endOffset: number): OpenContractsAnnotation;
770
+ /**
771
+ * Create an annotation by searching for text in the document.
772
+ * This is a client-side helper - no WASM call needed.
773
+ *
774
+ * @param id - Unique identifier for the annotation
775
+ * @param labelId - Label/category ID for the annotation
776
+ * @param documentText - Full document text (from annotationSet.content)
777
+ * @param searchText - Text to search for
778
+ * @param occurrence - Which occurrence to use (1-based, default: 1)
779
+ * @returns OpenContractsAnnotation, or null if text not found
780
+ *
781
+ * @example
782
+ * ```typescript
783
+ * const set = await createExternalAnnotationSet(docxFile, "doc-1");
784
+ *
785
+ * // Find first occurrence
786
+ * const ann1 = createAnnotationFromSearch("ann-001", "LIABILITY", set.content, "shall not be liable");
787
+ * if (ann1) set.labelledText.push(ann1);
788
+ *
789
+ * // Find second occurrence
790
+ * const ann2 = createAnnotationFromSearch("ann-002", "LIABILITY", set.content, "shall not be liable", 2);
791
+ * if (ann2) set.labelledText.push(ann2);
792
+ * ```
793
+ */
794
+ export declare function createAnnotationFromSearch(id: string, labelId: string, documentText: string, searchText: string, occurrence?: number): OpenContractsAnnotation | null;
795
+ /**
796
+ * Find all occurrences of a text string in the document.
797
+ * This is a client-side helper - no WASM call needed.
798
+ *
799
+ * @param documentText - Full document text
800
+ * @param searchText - Text to search for
801
+ * @param maxResults - Maximum number of results (default: 100)
802
+ * @returns Array of { start, end } offsets
803
+ *
804
+ * @example
805
+ * ```typescript
806
+ * const occurrences = findTextOccurrences(set.content, "the");
807
+ * console.log(`Found ${occurrences.length} occurrences of "the"`);
808
+ * ```
809
+ */
810
+ export declare function findTextOccurrences(documentText: string, searchText: string, maxResults?: number): Array<{
811
+ start: number;
812
+ end: number;
813
+ }>;
814
+ /**
815
+ * Project external annotations onto already-converted HTML.
816
+ * This avoids full DOCX re-conversion when only annotations change.
817
+ *
818
+ * Workflow:
819
+ * 1. Convert DOCX to HTML once using `convertDocxToHtml()`
820
+ * 2. Use this function to overlay annotations on the cached HTML
821
+ * 3. When annotations change, call this again with the same base HTML
822
+ *
823
+ * @param html - HTML string (previously converted via convertDocxToHtml)
824
+ * @param annotationSet - The external annotation set to project
825
+ * @param projectionOptions - Projection settings (CSS prefix, label mode, etc.)
826
+ * @returns HTML string with annotations projected
827
+ * @throws Error if projection fails
828
+ *
829
+ * @example
830
+ * ```typescript
831
+ * // Step 1: Convert once
832
+ * const baseHtml = await convertDocxToHtml(docxFile);
833
+ *
834
+ * // Step 2: Project annotations (fast, no DOCX re-conversion)
835
+ * const annotatedHtml = await projectAnnotationsOntoHtml(baseHtml, annotationSet);
836
+ *
837
+ * // Step 3: When annotations change, project again on the same base HTML
838
+ * annotationSet.labelledText.push(newAnnotation);
839
+ * const updatedHtml = await projectAnnotationsOntoHtml(baseHtml, annotationSet);
840
+ * ```
841
+ */
842
+ export declare function projectAnnotationsOntoHtml(html: string, annotationSet: ExternalAnnotationSet, projectionOptions?: ExternalAnnotationProjectionSettings): Promise<string>;
843
+ /**
844
+ * Add a single annotation to existing HTML without re-converting the document.
845
+ * This is the fastest way to add one annotation to already-rendered HTML.
846
+ *
847
+ * @param html - HTML string (with or without existing annotations)
848
+ * @param annotation - The annotation to add
849
+ * @param label - Label definition for the annotation (optional, for color/text)
850
+ * @param projectionOptions - Projection settings
851
+ * @returns HTML string with the annotation added
852
+ * @throws Error if operation fails
853
+ *
854
+ * @example
855
+ * ```typescript
856
+ * const annotation = createAnnotation("ann-new", "CLAUSE", set.content, 100, 150);
857
+ * const label = { id: "CLAUSE", text: "Clause", color: "#FF5722" };
858
+ * const updatedHtml = await addAnnotationToHtml(currentHtml, annotation, label);
859
+ * ```
860
+ */
861
+ export declare function addAnnotationToHtml(html: string, annotation: OpenContractsAnnotation, label?: AnnotationLabel, projectionOptions?: ExternalAnnotationProjectionSettings): Promise<string>;
862
+ /**
863
+ * Remove a single annotation from HTML by annotation ID.
864
+ * Unwraps annotation spans back to plain text.
865
+ *
866
+ * @param html - HTML string with annotations
867
+ * @param annotationId - ID of the annotation to remove
868
+ * @param cssClassPrefix - CSS class prefix used for annotations (default: "ext-annot-")
869
+ * @returns HTML string with the annotation removed
870
+ * @throws Error if operation fails
871
+ *
872
+ * @example
873
+ * ```typescript
874
+ * const updatedHtml = await removeAnnotationFromHtml(currentHtml, "ann-001");
875
+ * ```
876
+ */
877
+ export declare function removeAnnotationFromHtml(html: string, annotationId: string, cssClassPrefix?: string): Promise<string>;
878
+ /**
879
+ * Generate CSS to hide annotations with specific label IDs.
880
+ * Enables CSS-based label filtering without re-rendering HTML.
881
+ *
882
+ * Apply the returned CSS to your document (e.g., via a `<style>` element)
883
+ * to hide/show annotations by label. This is much faster than re-projecting
884
+ * all annotations.
885
+ *
886
+ * @param hiddenLabelIds - Array of label IDs to hide
887
+ * @param cssClassPrefix - CSS class prefix (default: "ext-annot-")
888
+ * @returns CSS string that hides the specified labels
889
+ * @throws Error if operation fails
890
+ *
891
+ * @example
892
+ * ```typescript
893
+ * // Hide annotations with label "DRAFT" and "INTERNAL"
894
+ * const css = await generateAnnotationVisibilityCss(["DRAFT", "INTERNAL"]);
895
+ *
896
+ * // Apply to a <style> element in the DOM
897
+ * const styleEl = document.getElementById("visibility-overrides");
898
+ * styleEl.textContent = css;
899
+ *
900
+ * // To show all annotations again, clear the style:
901
+ * styleEl.textContent = "";
902
+ * ```
903
+ */
904
+ export declare function generateAnnotationVisibilityCss(hiddenLabelIds: string[], cssClassPrefix?: string): Promise<string>;
905
+ /**
906
+ * Generate annotation CSS for a set of labels.
907
+ * Useful when managing CSS separately from HTML content.
908
+ *
909
+ * @param labels - Label definitions (keyed by label ID)
910
+ * @param projectionOptions - Projection settings
911
+ * @returns CSS string for the annotation styles
912
+ * @throws Error if operation fails
913
+ *
914
+ * @example
915
+ * ```typescript
916
+ * const labels = {
917
+ * "CLAUSE": { id: "CLAUSE", text: "Clause", color: "#FF5722" },
918
+ * "TERM": { id: "TERM", text: "Term", color: "#2196F3" },
919
+ * };
920
+ * const css = await generateAnnotationCss(labels);
921
+ * ```
922
+ */
923
+ export declare function generateAnnotationCss(labels: Record<string, AnnotationLabel>, projectionOptions?: ExternalAnnotationProjectionSettings): Promise<string>;
924
+ //# sourceMappingURL=core.d.ts.map