@arbidocs/blocks 0.4.101 → 0.4.102

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 (180) hide show
  1. package/dist/chunk-6MG62I5B.cjs +272 -0
  2. package/dist/chunk-6MG62I5B.cjs.map +1 -0
  3. package/dist/chunk-EQB3WELX.js +269 -0
  4. package/dist/chunk-EQB3WELX.js.map +1 -0
  5. package/dist/document-tools/AdoptSignatureDialog.d.ts +25 -0
  6. package/dist/document-tools/DocumentToolButtons.d.ts +2 -0
  7. package/dist/document-tools/SignatureRequestBanner.d.ts +18 -0
  8. package/dist/document-tools/index.cjs +175 -0
  9. package/dist/document-tools/index.cjs.map +1 -1
  10. package/dist/document-tools/index.d.ts +3 -1
  11. package/dist/document-tools/index.js +168 -3
  12. package/dist/document-tools/index.js.map +1 -1
  13. package/dist/document-tools/viewer/GuidedSigningViewer.d.ts +26 -0
  14. package/dist/document-tools/viewer/SignatureFieldsOverlay.d.ts +41 -0
  15. package/dist/document-tools/viewer/SignatureRequestEditor.d.ts +26 -0
  16. package/dist/document-tools/viewer/index.cjs +983 -0
  17. package/dist/document-tools/viewer/index.cjs.map +1 -1
  18. package/dist/document-tools/viewer/index.d.ts +3 -0
  19. package/dist/document-tools/viewer/index.js +983 -5
  20. package/dist/document-tools/viewer/index.js.map +1 -1
  21. package/node_modules/@arbidocs/coedit/LICENSE +21 -0
  22. package/node_modules/@arbidocs/coedit/dist/encoding.cjs +751 -0
  23. package/node_modules/@arbidocs/coedit/dist/encoding.cjs.map +1 -0
  24. package/node_modules/@arbidocs/coedit/dist/encoding.d.cts +192 -0
  25. package/node_modules/@arbidocs/coedit/dist/encoding.d.ts +192 -0
  26. package/node_modules/@arbidocs/coedit/dist/encoding.js +716 -0
  27. package/node_modules/@arbidocs/coedit/dist/encoding.js.map +1 -0
  28. package/node_modules/@arbidocs/coedit/dist/hocuspocus.cjs +1759 -0
  29. package/node_modules/@arbidocs/coedit/dist/hocuspocus.cjs.map +1 -0
  30. package/node_modules/@arbidocs/coedit/dist/hocuspocus.d.cts +39 -0
  31. package/node_modules/@arbidocs/coedit/dist/hocuspocus.d.ts +39 -0
  32. package/node_modules/@arbidocs/coedit/dist/hocuspocus.js +1736 -0
  33. package/node_modules/@arbidocs/coedit/dist/hocuspocus.js.map +1 -0
  34. package/node_modules/@arbidocs/coedit/dist/index.cjs +1692 -0
  35. package/node_modules/@arbidocs/coedit/dist/index.cjs.map +1 -0
  36. package/node_modules/@arbidocs/coedit/dist/index.d.cts +16 -0
  37. package/node_modules/@arbidocs/coedit/dist/index.d.ts +16 -0
  38. package/node_modules/@arbidocs/coedit/dist/index.js +1664 -0
  39. package/node_modules/@arbidocs/coedit/dist/index.js.map +1 -0
  40. package/node_modules/@arbidocs/coedit/dist/server.cjs +1852 -0
  41. package/node_modules/@arbidocs/coedit/dist/server.cjs.map +1 -0
  42. package/node_modules/@arbidocs/coedit/dist/server.d.cts +43 -0
  43. package/node_modules/@arbidocs/coedit/dist/server.d.ts +43 -0
  44. package/node_modules/@arbidocs/coedit/dist/server.js +1822 -0
  45. package/node_modules/@arbidocs/coedit/dist/server.js.map +1 -0
  46. package/node_modules/@arbidocs/coedit/dist/session-Cf9iu1Vt.d.cts +82 -0
  47. package/node_modules/@arbidocs/coedit/dist/session-Cf9iu1Vt.d.ts +82 -0
  48. package/node_modules/@arbidocs/coedit/dist/template.cjs +1627 -0
  49. package/node_modules/@arbidocs/coedit/dist/template.cjs.map +1 -0
  50. package/node_modules/@arbidocs/coedit/dist/template.d.cts +125 -0
  51. package/node_modules/@arbidocs/coedit/dist/template.d.ts +125 -0
  52. package/node_modules/@arbidocs/coedit/dist/template.js +1612 -0
  53. package/node_modules/@arbidocs/coedit/dist/template.js.map +1 -0
  54. package/node_modules/@arbidocs/coedit/dist/versions-DXiFQMA6.d.cts +8 -0
  55. package/node_modules/@arbidocs/coedit/dist/versions-DXiFQMA6.d.ts +8 -0
  56. package/node_modules/@arbidocs/coedit/package.json +68 -0
  57. package/node_modules/@docx-editor.dev/core/LICENSE +201 -0
  58. package/node_modules/@docx-editor.dev/core/README.md +125 -0
  59. package/node_modules/@docx-editor.dev/core/THIRD_PARTY_NOTICES.md +56 -0
  60. package/node_modules/@docx-editor.dev/core/dist/automation.cjs +1 -0
  61. package/node_modules/@docx-editor.dev/core/dist/automation.d.ts +162 -0
  62. package/node_modules/@docx-editor.dev/core/dist/automation.js +1 -0
  63. package/node_modules/@docx-editor.dev/core/dist/binding.cjs +1 -0
  64. package/node_modules/@docx-editor.dev/core/dist/binding.d.ts +164 -0
  65. package/node_modules/@docx-editor.dev/core/dist/binding.js +1 -0
  66. package/node_modules/@docx-editor.dev/core/dist/chunk-2GO5T2JU.cjs +1 -0
  67. package/node_modules/@docx-editor.dev/core/dist/chunk-2RC2EPND.js +3 -0
  68. package/node_modules/@docx-editor.dev/core/dist/chunk-4GBTELJV.cjs +28 -0
  69. package/node_modules/@docx-editor.dev/core/dist/chunk-4R3TEXMN.js +18 -0
  70. package/node_modules/@docx-editor.dev/core/dist/chunk-5CSUYANV.js +1 -0
  71. package/node_modules/@docx-editor.dev/core/dist/chunk-6APGXLBB.cjs +3 -0
  72. package/node_modules/@docx-editor.dev/core/dist/chunk-6AWEKBLB.cjs +1 -0
  73. package/node_modules/@docx-editor.dev/core/dist/chunk-6EYYL7FL.js +1 -0
  74. package/node_modules/@docx-editor.dev/core/dist/chunk-6JIJOZDW.js +1 -0
  75. package/node_modules/@docx-editor.dev/core/dist/chunk-BTQKU64Q.cjs +1 -0
  76. package/node_modules/@docx-editor.dev/core/dist/chunk-E7BQA6UP.js +2 -0
  77. package/node_modules/@docx-editor.dev/core/dist/chunk-EO4C5QJW.cjs +2 -0
  78. package/node_modules/@docx-editor.dev/core/dist/chunk-ETTO6GK3.js +1 -0
  79. package/node_modules/@docx-editor.dev/core/dist/chunk-FIJZIQXA.cjs +18 -0
  80. package/node_modules/@docx-editor.dev/core/dist/chunk-FRXAOVTB.js +28 -0
  81. package/node_modules/@docx-editor.dev/core/dist/chunk-J6BVWIDB.js +2 -0
  82. package/node_modules/@docx-editor.dev/core/dist/chunk-JGNVNT2A.cjs +2 -0
  83. package/node_modules/@docx-editor.dev/core/dist/chunk-K5U2PLDP.cjs +2 -0
  84. package/node_modules/@docx-editor.dev/core/dist/chunk-KKIJG3C6.js +2 -0
  85. package/node_modules/@docx-editor.dev/core/dist/chunk-LWDSDCMO.js +27 -0
  86. package/node_modules/@docx-editor.dev/core/dist/chunk-NBCVVZOM.cjs +1 -0
  87. package/node_modules/@docx-editor.dev/core/dist/chunk-O2AL2HSJ.cjs +1 -0
  88. package/node_modules/@docx-editor.dev/core/dist/chunk-O5INAWZQ.js +1 -0
  89. package/node_modules/@docx-editor.dev/core/dist/chunk-QMLCVPCD.cjs +1 -0
  90. package/node_modules/@docx-editor.dev/core/dist/chunk-RCHS4ZEH.cjs +27 -0
  91. package/node_modules/@docx-editor.dev/core/dist/chunk-RIYSCEFQ.js +2 -0
  92. package/node_modules/@docx-editor.dev/core/dist/chunk-S6J4O5XP.js +1 -0
  93. package/node_modules/@docx-editor.dev/core/dist/chunk-SRPILEWV.cjs +5 -0
  94. package/node_modules/@docx-editor.dev/core/dist/chunk-TSLBZ26X.js +1 -0
  95. package/node_modules/@docx-editor.dev/core/dist/chunk-UKVVUHZL.cjs +1 -0
  96. package/node_modules/@docx-editor.dev/core/dist/chunk-VDNNLG6X.js +2 -0
  97. package/node_modules/@docx-editor.dev/core/dist/chunk-VHAVHCQY.js +7 -0
  98. package/node_modules/@docx-editor.dev/core/dist/chunk-VX43VBAX.cjs +7 -0
  99. package/node_modules/@docx-editor.dev/core/dist/chunk-Z6WBFXJU.js +5 -0
  100. package/node_modules/@docx-editor.dev/core/dist/chunk-ZUHOMK52.cjs +2 -0
  101. package/node_modules/@docx-editor.dev/core/dist/collaboration/replication.cjs +1 -0
  102. package/node_modules/@docx-editor.dev/core/dist/collaboration/replication.d.ts +270 -0
  103. package/node_modules/@docx-editor.dev/core/dist/collaboration/replication.js +1 -0
  104. package/node_modules/@docx-editor.dev/core/dist/collaboration.cjs +1 -0
  105. package/node_modules/@docx-editor.dev/core/dist/collaboration.d.ts +269 -0
  106. package/node_modules/@docx-editor.dev/core/dist/collaboration.js +1 -0
  107. package/node_modules/@docx-editor.dev/core/dist/contracts/document.cjs +1 -0
  108. package/node_modules/@docx-editor.dev/core/dist/contracts/document.d.ts +290 -0
  109. package/node_modules/@docx-editor.dev/core/dist/contracts/document.js +0 -0
  110. package/node_modules/@docx-editor.dev/core/dist/contracts/editor.cjs +1 -0
  111. package/node_modules/@docx-editor.dev/core/dist/contracts/editor.d.ts +22 -0
  112. package/node_modules/@docx-editor.dev/core/dist/contracts/editor.js +1 -0
  113. package/node_modules/@docx-editor.dev/core/dist/contracts/interaction.cjs +1 -0
  114. package/node_modules/@docx-editor.dev/core/dist/contracts/interaction.d.ts +103 -0
  115. package/node_modules/@docx-editor.dev/core/dist/contracts/interaction.js +0 -0
  116. package/node_modules/@docx-editor.dev/core/dist/contracts/modules.cjs +1 -0
  117. package/node_modules/@docx-editor.dev/core/dist/contracts/modules.d.ts +143 -0
  118. package/node_modules/@docx-editor.dev/core/dist/contracts/modules.js +1 -0
  119. package/node_modules/@docx-editor.dev/core/dist/contracts/types.cjs +1 -0
  120. package/node_modules/@docx-editor.dev/core/dist/contracts/types.d.ts +11 -0
  121. package/node_modules/@docx-editor.dev/core/dist/contracts/types.js +0 -0
  122. package/node_modules/@docx-editor.dev/core/dist/custom-node-writes-cvL5rhcD.d.ts +323 -0
  123. package/node_modules/@docx-editor.dev/core/dist/dist-PKZR6RSH.js +2 -0
  124. package/node_modules/@docx-editor.dev/core/dist/document-protection-BAGVGqaP.d.ts +20 -0
  125. package/node_modules/@docx-editor.dev/core/dist/editor-Ci7IZGmG.d.ts +2448 -0
  126. package/node_modules/@docx-editor.dev/core/dist/editor-scope-OHPwVQ5l.d.ts +84 -0
  127. package/node_modules/@docx-editor.dev/core/dist/editor.cjs +1 -0
  128. package/node_modules/@docx-editor.dev/core/dist/editor.css +15 -0
  129. package/node_modules/@docx-editor.dev/core/dist/editor.d.ts +1394 -0
  130. package/node_modules/@docx-editor.dev/core/dist/editor.js +1 -0
  131. package/node_modules/@docx-editor.dev/core/dist/export.cjs +2 -0
  132. package/node_modules/@docx-editor.dev/core/dist/export.d.ts +391 -0
  133. package/node_modules/@docx-editor.dev/core/dist/export.js +2 -0
  134. package/node_modules/@docx-editor.dev/core/dist/failure-NS2lsya4.d.ts +115 -0
  135. package/node_modules/@docx-editor.dev/core/dist/font-resolver-BVQB14qT.d.ts +256 -0
  136. package/node_modules/@docx-editor.dev/core/dist/harfbuzz.wasm +0 -0
  137. package/node_modules/@docx-editor.dev/core/dist/headless-document-view-qH331moE.d.ts +143 -0
  138. package/node_modules/@docx-editor.dev/core/dist/image-resources-BN-hUgCn.d.ts +211 -0
  139. package/node_modules/@docx-editor.dev/core/dist/index-Bsg7oIKP.d.ts +3869 -0
  140. package/node_modules/@docx-editor.dev/core/dist/index.cjs +1 -0
  141. package/node_modules/@docx-editor.dev/core/dist/index.d.ts +53 -0
  142. package/node_modules/@docx-editor.dev/core/dist/index.js +1 -0
  143. package/node_modules/@docx-editor.dev/core/dist/layout-shaping-BEyuiQOk.d.ts +246 -0
  144. package/node_modules/@docx-editor.dev/core/dist/layout.cjs +1 -0
  145. package/node_modules/@docx-editor.dev/core/dist/layout.d.ts +3151 -0
  146. package/node_modules/@docx-editor.dev/core/dist/layout.js +1 -0
  147. package/node_modules/@docx-editor.dev/core/dist/node-module-shim-TTKTT66I.js +1 -0
  148. package/node_modules/@docx-editor.dev/core/dist/note-properties-4Y9o6Gyk.d.ts +68 -0
  149. package/node_modules/@docx-editor.dev/core/dist/omml-equation-CuzBL5DD.d.ts +85 -0
  150. package/node_modules/@docx-editor.dev/core/dist/output.cjs +1 -0
  151. package/node_modules/@docx-editor.dev/core/dist/output.d.ts +97 -0
  152. package/node_modules/@docx-editor.dev/core/dist/output.js +1 -0
  153. package/node_modules/@docx-editor.dev/core/dist/protocol-Bqk4Izjc.d.ts +1651 -0
  154. package/node_modules/@docx-editor.dev/core/dist/review-pane-D9jm8DcY.d.ts +128 -0
  155. package/node_modules/@docx-editor.dev/core/dist/review-paragraph-order-DT-n6ouC.d.ts +85 -0
  156. package/node_modules/@docx-editor.dev/core/dist/revision-projection-DZ4kKVev.d.ts +242 -0
  157. package/node_modules/@docx-editor.dev/core/dist/semantic-cell-selection-D9D1KSXq.d.ts +464 -0
  158. package/node_modules/@docx-editor.dev/core/dist/semantic-interaction-CIC-PooQ.d.ts +135 -0
  159. package/node_modules/@docx-editor.dev/core/dist/semantic-paint-BME37OMv.d.ts +326 -0
  160. package/node_modules/@docx-editor.dev/core/dist/semantic-record-queries-CBlZqZNa.d.ts +177 -0
  161. package/node_modules/@docx-editor.dev/core/dist/semantic-records-4B3WwFAi.d.ts +3532 -0
  162. package/node_modules/@docx-editor.dev/core/dist/store.cjs +1 -0
  163. package/node_modules/@docx-editor.dev/core/dist/store.d.ts +2706 -0
  164. package/node_modules/@docx-editor.dev/core/dist/store.js +1 -0
  165. package/node_modules/@docx-editor.dev/core/dist/tree-package-fragment-BeeKxDw8.d.ts +1201 -0
  166. package/node_modules/@docx-editor.dev/core/dist/tree-session-contract-CVbmlMlq.d.ts +664 -0
  167. package/node_modules/@docx-editor.dev/core/dist/types-barrel-D3xCgQX6.d.ts +4269 -0
  168. package/node_modules/@docx-editor.dev/core/licenses/HarfBuzz-COPYING.txt +42 -0
  169. package/node_modules/@docx-editor.dev/core/package.json +140 -0
  170. package/node_modules/@docx-editor.dev/react/LICENSE +201 -0
  171. package/node_modules/@docx-editor.dev/react/README.md +141 -0
  172. package/node_modules/@docx-editor.dev/react/THIRD_PARTY_NOTICES.md +18 -0
  173. package/node_modules/@docx-editor.dev/react/dist/index.d.mts +4928 -0
  174. package/node_modules/@docx-editor.dev/react/dist/index.d.ts +4928 -0
  175. package/node_modules/@docx-editor.dev/react/dist/index.js +4 -0
  176. package/node_modules/@docx-editor.dev/react/dist/index.mjs +4 -0
  177. package/node_modules/@docx-editor.dev/react/package.json +74 -0
  178. package/node_modules/@docx-editor.dev/react/src/styles/editor.css +6 -0
  179. package/node_modules/@docx-editor.dev/react/src/styles/zIndex.ts +28 -0
  180. package/package.json +26 -15
@@ -0,0 +1,1651 @@
1
+ import { a9 as AutomationTableMutation, a6 as RevisionBatchResult, a3 as RevisionAuthorResult } from './types-barrel-D3xCgQX6.js';
2
+ import { c as HeaderFooterVariant, N as NoteKind } from './tree-package-fragment-BeeKxDw8.js';
3
+
4
+ /** Word's shape types, as `Word.ShapeType` spells them. */
5
+ type AutomationShapeType = 'TextBox' | 'GeometricShape' | 'Picture' | 'Group' | 'Canvas' | 'Unsupported';
6
+ /** What a shape read answers. */
7
+ interface AutomationShapeRead {
8
+ readonly id: number;
9
+ readonly name: string;
10
+ readonly type: AutomationShapeType;
11
+ }
12
+
13
+ interface AutomationInlinePictureRead {
14
+ readonly width: number;
15
+ readonly height: number;
16
+ readonly lockAspectRatio: boolean;
17
+ readonly altTextDescription: string;
18
+ }
19
+ interface AutomationInlinePictureWrite {
20
+ readonly width?: number;
21
+ readonly height?: number;
22
+ readonly lockAspectRatio?: boolean;
23
+ readonly altTextDescription?: string;
24
+ }
25
+
26
+ /** Alignment as this protocol publishes it. `Mixed`/`Unknown` are read-only answers. */
27
+ type AutomationAlignment = 'Mixed' | 'Unknown' | 'Left' | 'Centered' | 'Right' | 'Justified';
28
+ /**
29
+ * A paragraph's base direction (`w:bidi`) as this protocol publishes it: the direction the
30
+ * paragraph reads in, after its style cascade.
31
+ */
32
+ type AutomationReadingOrder = 'LeftToRight' | 'RightToLeft';
33
+ /**
34
+ * What a range agrees about its characters' formatting.
35
+ *
36
+ * `null` means "no agreed value": the runs disagree, or none of them authors the property. The
37
+ * two are one answer on purpose — a caller that must not guess is told not to guess, and a
38
+ * caller writing a value writes it unconditionally either way.
39
+ */
40
+ interface AutomationFontRead {
41
+ readonly bold: boolean | null;
42
+ readonly italic: boolean | null;
43
+ readonly underline: string | null;
44
+ readonly strikeThrough: boolean | null;
45
+ readonly highlightColor: string | null;
46
+ readonly subscript: boolean | null;
47
+ readonly superscript: boolean | null;
48
+ /** `w:rFonts/@w:ascii`. */
49
+ readonly name: string | null;
50
+ /** Points. */
51
+ readonly size: number | null;
52
+ /** `#RRGGBB`. `null` for `auto`, which names no colour. */
53
+ readonly color: string | null;
54
+ }
55
+ /** What a caller asks to author. Every field is optional; an empty request is refused. */
56
+ interface AutomationFontWrite {
57
+ readonly bold?: boolean;
58
+ readonly italic?: boolean;
59
+ readonly underline?: string;
60
+ readonly strikeThrough?: boolean;
61
+ readonly highlightColor?: string | null;
62
+ readonly subscript?: boolean;
63
+ readonly superscript?: boolean;
64
+ readonly name?: string;
65
+ readonly size?: number;
66
+ readonly color?: string;
67
+ }
68
+ /** One paragraph's own paragraph properties, in points. `null` = the paragraph authors none. */
69
+ interface AutomationParagraphFormatRead {
70
+ readonly alignment: AutomationAlignment;
71
+ /**
72
+ * The paragraph style's NAME, or null where the document names none.
73
+ *
74
+ * Read here rather than through its own operation so that one load of a paragraph's properties is
75
+ * one round trip: the style lives in the same `w:pPr`, and a caller asking for its name and its
76
+ * indent should not pay for two.
77
+ */
78
+ readonly style: string | null;
79
+ readonly firstLineIndent: number | null;
80
+ readonly leftIndent: number | null;
81
+ readonly rightIndent: number | null;
82
+ readonly lineSpacing: number | null;
83
+ readonly spaceBefore: number | null;
84
+ readonly spaceAfter: number | null;
85
+ readonly widowControl: boolean | null;
86
+ /** The direction the paragraph reads in: its own `w:bidi` if any, else the style cascade's. */
87
+ readonly readingOrder: AutomationReadingOrder;
88
+ }
89
+ /**
90
+ * A paragraph-property write. Every field optional; omitted means "leave alone".
91
+ *
92
+ * Deliberately ONE request covering style and spacing together, because both rewrite `w:pPr` —
93
+ * two ops naming the same paragraph in one batch are refused, since the second would carry
94
+ * properties the first had already replaced.
95
+ */
96
+ interface AutomationParagraphFormatWrite {
97
+ readonly alignment?: AutomationAlignment;
98
+ /**
99
+ * A paragraph style name the document already defines. An unknown name is refused.
100
+ *
101
+ * In the same request as the rest so that applying a style and adjusting a spacing is ONE write:
102
+ * both rewrite `w:pPr`, and two ops naming it in one batch are refused because the second would
103
+ * carry properties the first had already replaced.
104
+ */
105
+ readonly style?: string;
106
+ readonly firstLineIndent?: number;
107
+ readonly leftIndent?: number;
108
+ readonly rightIndent?: number;
109
+ readonly lineSpacing?: number;
110
+ readonly spaceBefore?: number;
111
+ readonly spaceAfter?: number;
112
+ readonly widowControl?: boolean;
113
+ /**
114
+ * The direction the paragraph should read in. Nothing is written when it already does. Else the
115
+ * paragraph's own `w:bidi` is removed when that alone set the other direction, or stated:
116
+ * `<w:bidi/>`, or `<w:bidi w:val="0"/>` over a right-to-left style.
117
+ */
118
+ readonly readingOrder?: AutomationReadingOrder;
119
+ }
120
+
121
+ declare const MEMBERS: {
122
+ readonly author: readonly ["http://purl.org/dc/elements/1.1/", 'creator'];
123
+ readonly title: readonly ["http://purl.org/dc/elements/1.1/", 'title'];
124
+ readonly subject: readonly ["http://purl.org/dc/elements/1.1/", 'subject'];
125
+ readonly comments: readonly ["http://purl.org/dc/elements/1.1/", 'description'];
126
+ readonly keywords: readonly ["http://schemas.openxmlformats.org/package/2006/metadata/core-properties", 'keywords'];
127
+ readonly category: readonly ["http://schemas.openxmlformats.org/package/2006/metadata/core-properties", 'category'];
128
+ };
129
+ declare const READ_MEMBERS: {
130
+ readonly author: readonly ["http://purl.org/dc/elements/1.1/", 'creator'];
131
+ readonly title: readonly ["http://purl.org/dc/elements/1.1/", 'title'];
132
+ readonly subject: readonly ["http://purl.org/dc/elements/1.1/", 'subject'];
133
+ readonly comments: readonly ["http://purl.org/dc/elements/1.1/", 'description'];
134
+ readonly keywords: readonly ["http://schemas.openxmlformats.org/package/2006/metadata/core-properties", 'keywords'];
135
+ readonly category: readonly ["http://schemas.openxmlformats.org/package/2006/metadata/core-properties", 'category'];
136
+ readonly lastAuthor: readonly ["http://schemas.openxmlformats.org/package/2006/metadata/core-properties", 'lastModifiedBy'];
137
+ };
138
+ type DocumentPropertyName = keyof typeof READ_MEMBERS;
139
+ type DocumentPropertyWrites = Partial<Record<keyof typeof MEMBERS, string>>;
140
+
141
+ type AutomationListBullet = 'Custom' | 'Solid' | 'Hollow' | 'Square' | 'Diamonds' | 'Arrow' | 'Checkmark';
142
+ type AutomationListNumbering = 'None' | 'Arabic' | 'UpperRoman' | 'LowerRoman' | 'UpperLetter' | 'LowerLetter';
143
+ interface AutomationListLevelFormat {
144
+ readonly bullet?: AutomationListBullet;
145
+ readonly charCode?: number;
146
+ readonly fontName?: string;
147
+ readonly numbering?: AutomationListNumbering;
148
+ readonly formatString?: readonly (string | number)[];
149
+ readonly startingNumber?: number;
150
+ readonly textIndent?: number;
151
+ readonly bulletNumberPictureIndent?: number;
152
+ }
153
+
154
+ /** Table, picture, field, break, and list authoring transport operations. */
155
+ type AutomationAuthoringOperation = {
156
+ readonly op: 'getFields';
157
+ readonly span: AutomationSpanRef;
158
+ } | {
159
+ readonly op: 'getField' | 'deleteField' | 'updateFieldResult';
160
+ readonly field: AutomationHandle;
161
+ } | {
162
+ readonly op: 'setFieldCode';
163
+ readonly field: AutomationHandle;
164
+ readonly code: string;
165
+ } | {
166
+ readonly op: 'insertField';
167
+ readonly span: AutomationSpanRef;
168
+ readonly location: 'Before' | 'After' | 'Start' | 'End' | 'Replace';
169
+ readonly fieldType?: string;
170
+ readonly text?: string;
171
+ readonly removeFormatting?: boolean;
172
+ } | {
173
+ readonly op: 'getTables';
174
+ readonly scope: AutomationSpanRef;
175
+ } | {
176
+ readonly op: 'getTable' | 'getTableRows';
177
+ readonly table: AutomationHandle;
178
+ } | {
179
+ readonly op: 'getTableCells';
180
+ readonly row: AutomationHandle;
181
+ } | {
182
+ readonly op: 'insertTableRows';
183
+ readonly row: AutomationHandle;
184
+ readonly location: 'before' | 'after';
185
+ readonly count: number;
186
+ readonly values?: readonly (readonly string[])[];
187
+ } | {
188
+ readonly op: 'getTableCell';
189
+ readonly table: AutomationHandle;
190
+ readonly rowIndex: number;
191
+ readonly cellIndex: number;
192
+ } | {
193
+ readonly op: 'getTableCellProperties' | 'getTableCellBody';
194
+ readonly cell: AutomationHandle;
195
+ } | {
196
+ readonly op: 'updateTable';
197
+ readonly table: AutomationHandle;
198
+ readonly mutation: Exclude<AutomationTableMutation, {
199
+ kind: 'cell';
200
+ } | {
201
+ kind: 'insertRows';
202
+ }>;
203
+ } | {
204
+ readonly op: 'updateTableCell';
205
+ readonly cell: AutomationHandle;
206
+ readonly properties: Omit<Extract<AutomationTableMutation, {
207
+ kind: 'cell';
208
+ } | {
209
+ kind: 'insertRows';
210
+ }>, 'kind' | 'cellId'>;
211
+ } | {
212
+ readonly op: 'insertTable';
213
+ readonly span: AutomationSpanRef;
214
+ readonly location: 'Before' | 'After';
215
+ readonly rowCount: number;
216
+ readonly columnCount: number;
217
+ readonly values?: readonly (readonly string[])[];
218
+ }
219
+ /** The floating shapes anchored in a span's paragraphs, in reading order. */
220
+ | {
221
+ readonly op: 'getShapes';
222
+ readonly span: AutomationSpanRef;
223
+ /** Only shapes of these types. Absent lists every type. */
224
+ readonly types?: readonly AutomationShapeType[];
225
+ } | {
226
+ readonly op: 'getShape';
227
+ readonly shape: AutomationHandle;
228
+ }
229
+ /** A text box's own story. Any other shape has no body and refuses. */
230
+ | {
231
+ readonly op: 'getShapeBody';
232
+ readonly shape: AutomationHandle;
233
+ } | {
234
+ readonly op: 'getInlinePictures';
235
+ readonly span: AutomationSpanRef;
236
+ } | {
237
+ readonly op: 'getInlinePicture';
238
+ readonly picture: AutomationHandle;
239
+ } | {
240
+ readonly op: 'setInlinePicture';
241
+ readonly picture: AutomationHandle;
242
+ readonly properties: AutomationInlinePictureWrite;
243
+ } | {
244
+ readonly op: 'deleteInlinePicture';
245
+ readonly picture: AutomationHandle;
246
+ } | {
247
+ readonly op: 'insertInlinePicture';
248
+ readonly span: AutomationSpanRef;
249
+ readonly base64: string;
250
+ readonly location: 'Before' | 'After' | 'Start' | 'End' | 'Replace';
251
+ } | {
252
+ readonly op: 'insertBreak';
253
+ readonly span: AutomationSpanRef;
254
+ readonly breakType: string;
255
+ readonly location: string;
256
+ } | {
257
+ readonly op: 'startNewList';
258
+ readonly paragraph: AutomationHandle;
259
+ } | {
260
+ readonly op: 'attachToList';
261
+ readonly paragraph: AutomationHandle;
262
+ readonly listId: number;
263
+ readonly level: number;
264
+ } | {
265
+ readonly op: 'detachFromList';
266
+ readonly paragraph: AutomationHandle;
267
+ } | {
268
+ readonly op: 'setListLevelFormat';
269
+ readonly list: AutomationHandle;
270
+ readonly level: number;
271
+ readonly format: AutomationListLevelFormat;
272
+ } | {
273
+ readonly op: 'getRange';
274
+ readonly span: AutomationSpanRef;
275
+ readonly location: 'Whole' | 'Content' | 'Start' | 'End' | 'Before' | 'After';
276
+ };
277
+
278
+ /**
279
+ * Which way round a page is, in OOXML's own lower-case spelling.
280
+ *
281
+ * The public object model capitalises it; the mapping between the two lives at that boundary and
282
+ * nowhere else.
283
+ */
284
+ type AutomationPageOrientation = 'portrait' | 'landscape';
285
+ /** One section's page geometry, in points. */
286
+ interface AutomationPageSetupRead {
287
+ readonly pageWidth: number;
288
+ readonly pageHeight: number;
289
+ readonly orientation: AutomationPageOrientation;
290
+ readonly topMargin: number;
291
+ readonly rightMargin: number;
292
+ readonly bottomMargin: number;
293
+ readonly leftMargin: number;
294
+ readonly headerDistance: number;
295
+ readonly footerDistance: number;
296
+ readonly gutter: number;
297
+ }
298
+ /** What a caller may author on a section. Only the fields present are written. */
299
+ interface AutomationPageSetupWrite {
300
+ readonly pageWidth?: number;
301
+ readonly pageHeight?: number;
302
+ readonly orientation?: AutomationPageOrientation;
303
+ readonly topMargin?: number;
304
+ readonly rightMargin?: number;
305
+ readonly bottomMargin?: number;
306
+ readonly leftMargin?: number;
307
+ readonly headerDistance?: number;
308
+ readonly footerDistance?: number;
309
+ }
310
+
311
+ /**
312
+ * A position in a story.
313
+ *
314
+ * Either exact, or an EDGE of something the host can measure: a story, or one paragraph.
315
+ * `{ body, at: 'end' }` is the position after the last character of the last paragraph, which is
316
+ * what "append to the document" means; `{ paragraph, at: 'end' }` is the same for one paragraph.
317
+ *
318
+ * The edges are not sugar. A caller has no way to know a paragraph's length without reading it
319
+ * first, so "insert at the end of this paragraph" would otherwise cost a round trip and then
320
+ * carry an offset that a concurrent edit could have invalidated. The host knows the length at
321
+ * the moment it plans, so the edge is both shorter and correct.
322
+ */
323
+ type AutomationPoint = AutomationEndpoint | {
324
+ readonly paragraph: AutomationHandle;
325
+ readonly at: 'start' | 'end';
326
+ } | {
327
+ readonly body: AutomationHandle;
328
+ readonly at: 'start' | 'end';
329
+ };
330
+ /**
331
+ * A stretch of a story to read, replace, or select.
332
+ *
333
+ * `{ body }` is the whole story — every paragraph, first offset to last — and `{ paragraph }` is
334
+ * the whole of one paragraph. Spelling both as their own shapes rather than making the caller
335
+ * find the edges keeps "replace the body" and "clear this paragraph" single operations, which is
336
+ * what makes each of them one transaction.
337
+ */
338
+ type AutomationSpanRef = {
339
+ readonly start: AutomationPoint;
340
+ readonly end: AutomationPoint;
341
+ } | {
342
+ readonly paragraph: AutomationHandle;
343
+ } | {
344
+ readonly body: AutomationHandle;
345
+ };
346
+ /**
347
+ * Where to look for content controls: a whole story, or inside one control.
348
+ *
349
+ * A control's own scope is how nesting is expressed. Listing every control of a story flat
350
+ * would answer a form field and the group wrapping it as siblings, which is not what either of
351
+ * them is.
352
+ */
353
+ type AutomationContentControlScope = {
354
+ readonly body: AutomationHandle;
355
+ } | {
356
+ readonly contentControl: AutomationHandle;
357
+ };
358
+ /** The value a control accepts, by what kind of control it is. */
359
+ type AutomationContentControlValue = {
360
+ readonly kind: 'text';
361
+ readonly text: string;
362
+ } | {
363
+ readonly kind: 'listItem';
364
+ readonly value: string;
365
+ } | {
366
+ readonly kind: 'checkbox';
367
+ readonly checked: boolean;
368
+ } | {
369
+ readonly kind: 'date';
370
+ readonly iso: string;
371
+ };
372
+ /** The `ST_Lock` values an author may write. */
373
+ type AutomationContentControlLock = 'unlocked' | 'sdtLocked' | 'contentLocked' | 'sdtContentLocked';
374
+ /**
375
+ * Which part of a control a range read answers.
376
+ *
377
+ * `whole` and `content` are the same stretch, and `before`/`after` are the content's own edges:
378
+ * a control's boundary marks occupy no offset in the text a caller addresses, so there is no
379
+ * position between a mark and the first character to answer with.
380
+ */
381
+ type AutomationContentControlRangeLocation = 'whole' | 'content' | 'start' | 'end' | 'before' | 'after';
382
+ /** The control types an insertion may author. Picture and repeating section are deferred. */
383
+ type AutomationContentControlSubtype = 'richText' | 'plainText' | 'dropDownList' | 'comboBox' | 'date';
384
+ /**
385
+ * Which paragraph a structural command is anchored at.
386
+ *
387
+ * A story edge resolves to its first or last paragraph. An empty story has neither, and the
388
+ * command is refused rather than inventing a block: creating a paragraph in a story that holds
389
+ * none is a different operation than inserting beside one, and this protocol has only the
390
+ * second (see the object model's recorded omissions).
391
+ */
392
+ type AutomationParagraphRef = {
393
+ readonly paragraph: AutomationHandle;
394
+ } | {
395
+ readonly body: AutomationHandle;
396
+ readonly at: 'first' | 'last';
397
+ };
398
+ /**
399
+ * How a story search is narrowed.
400
+ *
401
+ * Every flag is either honoured or REFUSED — never accepted and ignored. A search that quietly
402
+ * dropped `matchWildcards` would answer plain-text matches to a caller who asked for pattern
403
+ * ones, which is worse than saying no.
404
+ */
405
+ interface AutomationSearchOptions {
406
+ readonly matchCase?: boolean;
407
+ readonly matchWholeWord?: boolean;
408
+ /** Display or raw model text to search. `allMarkup` preserves the historical behavior. */
409
+ readonly projection?: AutomationTextProjection;
410
+ /** Not supported; `true` is refused. Punctuation-insensitive matching is not implemented. */
411
+ readonly ignorePunct?: boolean;
412
+ /** Not supported; `true` is refused. Whitespace-insensitive matching is not implemented. */
413
+ readonly ignoreSpace?: boolean;
414
+ /** Not supported; `true` is refused. There is no wildcard grammar behind this protocol. */
415
+ readonly matchWildcards?: boolean;
416
+ /** Tighten the result cap. Clamped to the engine's own limit; never raised past it. */
417
+ readonly limit?: number;
418
+ }
419
+ /**
420
+ * Which text an automation read exposes.
421
+ *
422
+ * `allMarkup` includes pending insertions, deletions, and both sides of replacements. `original`
423
+ * matches Word's Original review view: deletions remain visible and insertions are hidden.
424
+ * Both are display text and expand saved field results. `model` returns raw model text with
425
+ * atomic fields represented by `U+FFFC`. Only `model` shares the protocol's offset vocabulary.
426
+ */
427
+ type AutomationTextProjection = 'allMarkup' | 'original' | 'model';
428
+ /** Where a selection lands. `start`/`end` collapse it to one edge of the span. */
429
+ type AutomationSelectionMode = 'select' | 'start' | 'end';
430
+ /**
431
+ * Every operation a host answers: the whole read-and-write vocabulary, as one discriminated
432
+ * union keyed on `op`.
433
+ *
434
+ * Reads never open a transaction; commands in one batch commit together. Handles are NAMES the
435
+ * host minted, never pointers, so an operation is plain transport data.
436
+ */
437
+ type AutomationOperation = AutomationAuthoringOperation | {
438
+ readonly op: 'getChangeTrackingMode';
439
+ } | {
440
+ readonly op: 'setChangeTrackingMode';
441
+ readonly mode: 'Off' | 'TrackAll' | 'TrackMineOnly';
442
+ readonly author?: string;
443
+ }
444
+ /** The document itself — the root every other handle is reached through. */
445
+ | {
446
+ readonly op: 'getDocument';
447
+ } | {
448
+ readonly op: 'removeDocumentInformation';
449
+ readonly removeDocInfoType: string;
450
+ } | {
451
+ readonly op: 'getDocumentProperty';
452
+ readonly name: DocumentPropertyName;
453
+ } | {
454
+ readonly op: 'setDocumentProperties';
455
+ readonly values: DocumentPropertyWrites;
456
+ }
457
+ /** The main story of a document. */
458
+ | {
459
+ readonly op: 'getBody';
460
+ readonly document: AutomationHandle;
461
+ }
462
+ /**
463
+ * A story's paragraphs, in reading order.
464
+ *
465
+ * Includes paragraphs inside tables — descending through rows, cells and nested tables — and
466
+ * inside block-level content controls, because those are ordinary editable paragraphs and
467
+ * Word's own paragraph collection contains them. A story with no paragraphs answers none.
468
+ */
469
+ | {
470
+ readonly op: 'getParagraphs';
471
+ readonly body: AutomationHandle;
472
+ }
473
+ /** The paragraphs a span covers, in reading order. */
474
+ | {
475
+ readonly op: 'getSpanParagraphs';
476
+ readonly span: AutomationSpanRef;
477
+ }
478
+ /**
479
+ * Text of a body or a paragraph.
480
+ *
481
+ * A story reads as its paragraphs joined by a carriage return — one paragraph mark, one
482
+ * `\r` — which is the separator Word's own text property uses. Display projections expand
483
+ * fields, so clients must not derive model offsets from this text.
484
+ */
485
+ | {
486
+ readonly op: 'getText';
487
+ readonly target: AutomationHandle;
488
+ readonly projection?: AutomationTextProjection;
489
+ }
490
+ /**
491
+ * Display text between two endpoints, with a carriage return at each paragraph boundary.
492
+ * Use the `model` projection when a client needs text in the endpoint offset vocabulary.
493
+ */
494
+ | {
495
+ readonly op: 'getSpanText';
496
+ readonly span: AutomationSpanRef;
497
+ readonly projection?: AutomationTextProjection;
498
+ }
499
+ /**
500
+ * A paragraph's own identity as the DOCUMENT writes it (`w14:paraId`).
501
+ *
502
+ * Not an index and not a handle ref: it survives paragraphs being inserted or deleted around
503
+ * it, and it is the same value a file written by Word carries.
504
+ */
505
+ | {
506
+ readonly op: 'getParagraphId';
507
+ readonly paragraph: AutomationHandle;
508
+ }
509
+ /**
510
+ * Every occurrence of `text` inside a scope, in reading order, as spans.
511
+ *
512
+ * The scope is a span, so `{ body }` searches a whole story and a pair of endpoints searches
513
+ * part of one. There is no "search the whole document" — a document is several stories, and
514
+ * answering one story's matches to that request would be a claim about the others.
515
+ */
516
+ | {
517
+ readonly op: 'search';
518
+ readonly scope: AutomationSpanRef;
519
+ readonly text: string;
520
+ readonly options?: AutomationSearchOptions;
521
+ }
522
+ /**
523
+ * Insert text at a position. Answers the span the inserted text occupies.
524
+ *
525
+ * Offsets in one batch are validated against the state at the START of the batch, and the
526
+ * commands apply in order INSIDE one transaction — so two insertions into the same paragraph
527
+ * shift each other exactly as two sequential edits would, and the second answer's offsets are
528
+ * the ones it was planned with. Addressing distinct paragraphs keeps a batch
529
+ * order-independent.
530
+ */
531
+ /** Explicit inline Word revision, independent of a browser's editing mode. */
532
+ | {
533
+ readonly op: 'proposeInsertion';
534
+ readonly span: AutomationSpanRef;
535
+ readonly text: string;
536
+ readonly where: 'Before' | 'After';
537
+ readonly author: string;
538
+ } | {
539
+ readonly op: 'proposeDeletion';
540
+ readonly span: AutomationSpanRef;
541
+ readonly author: string;
542
+ } | {
543
+ readonly op: 'proposeReplacement';
544
+ readonly span: AutomationSpanRef;
545
+ readonly text: string;
546
+ readonly author: string;
547
+ } | {
548
+ readonly op: 'insertText';
549
+ readonly at: AutomationPoint;
550
+ readonly text: string;
551
+ }
552
+ /**
553
+ * Replace a span with text, which may be empty — that is how a deletion is spelled.
554
+ *
555
+ * A span that crosses paragraph marks removes the paragraphs between its endpoints and joins
556
+ * what is left, because that is what deleting a stretch of a document means. A join across a
557
+ * table-cell boundary is refused by the canonical mutation path, and the whole batch is then
558
+ * refused: half a deletion is not an outcome this protocol offers.
559
+ */
560
+ | {
561
+ readonly op: 'replaceSpan';
562
+ readonly span: AutomationSpanRef;
563
+ readonly text: string;
564
+ }
565
+ /**
566
+ * Replace a story's complete block structure with fresh plain paragraphs.
567
+ *
568
+ * This is the fresh-document operation. It removes tables, content controls, paragraph-level
569
+ * section marks, comments, and revisions. A body's final page-level section properties survive.
570
+ */
571
+ | {
572
+ readonly op: 'replaceStoryBlocks';
573
+ readonly body: AutomationHandle;
574
+ readonly paragraphs: readonly string[];
575
+ }
576
+ /**
577
+ * Insert a paragraph beside another one. Answers the NEW paragraph's handle.
578
+ *
579
+ * Resolved after the commit, because the paragraph it names does not exist until then.
580
+ */
581
+ | {
582
+ readonly op: 'insertParagraph';
583
+ readonly anchor: AutomationParagraphRef;
584
+ readonly where: 'before' | 'after';
585
+ readonly text: string;
586
+ }
587
+ /**
588
+ * Split a paragraph at every occurrence of any delimiter. Answers a span per resulting
589
+ * paragraph, in reading order, including the one that keeps the original identity.
590
+ */
591
+ | {
592
+ readonly op: 'splitParagraph';
593
+ readonly paragraph: AutomationHandle;
594
+ readonly delimiters: readonly string[];
595
+ /** Drop the delimiter characters themselves. */
596
+ readonly trimDelimiters?: boolean;
597
+ /** Drop leading and trailing whitespace from each resulting paragraph. */
598
+ readonly trimSpacing?: boolean;
599
+ }
600
+ /**
601
+ * What the characters a span covers AGREE about their formatting.
602
+ *
603
+ * Not "what does this text look like": a value inherited from `styles.xml` reads as no agreed
604
+ * value, because this lane reads what the document authors and a write merges against the
605
+ * same thing. See `formatting.ts`.
606
+ */
607
+ | {
608
+ readonly op: 'getFont';
609
+ readonly span: AutomationSpanRef;
610
+ }
611
+ /**
612
+ * Author run properties over a span. Only the fields present are written.
613
+ *
614
+ * A span covering a WHOLE paragraph also writes the paragraph MARK's own `w:rPr`, which is
615
+ * what Word does — the pilcrow carries the formatting a list marker inherits its face from,
616
+ * so sizing a bulleted paragraph without it leaves the bullet at the old size.
617
+ */
618
+ | {
619
+ readonly op: 'setFont';
620
+ readonly span: AutomationSpanRef;
621
+ readonly font: AutomationFontWrite;
622
+ }
623
+ /**
624
+ * The paragraph style NAME every paragraph a span covers agrees on.
625
+ *
626
+ * The name a reader sees (`heading 1`), not the internal `w:styleId` (`Heading1`) — the two are
627
+ * routinely different, and the id is not the vocabulary an object model talks in.
628
+ */
629
+ | {
630
+ readonly op: 'getStyle';
631
+ readonly span: AutomationSpanRef;
632
+ }
633
+ /**
634
+ * Apply a paragraph style, by name, to every paragraph a span covers.
635
+ *
636
+ * A name the document does not already define is REFUSED. Minting the definition would report a
637
+ * style applied for one with no formatting in it — the paragraph unchanged on screen, styled when
638
+ * read back — and would turn a caller's string into a new part.
639
+ */
640
+ | {
641
+ readonly op: 'setStyle';
642
+ readonly span: AutomationSpanRef;
643
+ readonly name: string;
644
+ }
645
+ /** One paragraph's own paragraph properties, in points. */
646
+ | {
647
+ readonly op: 'getParagraphFormat';
648
+ readonly paragraph: AutomationParagraphRef;
649
+ }
650
+ /** Author paragraph properties. Only the fields present are written. */
651
+ | {
652
+ readonly op: 'setParagraphFormat';
653
+ readonly paragraph: AutomationParagraphRef;
654
+ readonly format: AutomationParagraphFormatWrite;
655
+ }
656
+ /** Remove a paragraph and everything in it. */
657
+ | {
658
+ readonly op: 'deleteParagraph';
659
+ readonly paragraph: AutomationHandle;
660
+ }
661
+ /**
662
+ * The document's sections, in document order.
663
+ *
664
+ * A document nobody sectioned still has one: the body-level `w:sectPr` Word writes even for a
665
+ * file that has never been sectioned. The index a section answers to is the one the furniture
666
+ * lifecycle ops take, so a read here and a header written afterwards agree about which section
667
+ * is which.
668
+ */
669
+ | {
670
+ readonly op: 'getSections';
671
+ readonly document: AutomationHandle;
672
+ }
673
+ /** One section's page geometry, in points. */
674
+ | {
675
+ readonly op: 'getPageSetup';
676
+ readonly section: AutomationHandle;
677
+ }
678
+ /**
679
+ * Author page geometry on ONE section — Word's "Apply to: This section".
680
+ *
681
+ * Only the fields present are written; the rest of that `w:sectPr` is left exactly as authored.
682
+ * `orientation` without dimensions swaps the section's own, so a document of mixed paper sizes
683
+ * survives a flip. A dimension outside what a page can be is refused rather than clamped.
684
+ */
685
+ | {
686
+ readonly op: 'setPageSetup';
687
+ readonly section: AutomationHandle;
688
+ readonly setup: AutomationPageSetupWrite;
689
+ }
690
+ /**
691
+ * The header or footer story a section declares or inherits, as a BODY.
692
+ *
693
+ * A variant the document has neither declared nor inherited is still answered, as an empty
694
+ * body: every read on it answers what it answers for an empty story. Asking does not create
695
+ * the part. The first text written into the body creates it; any other write that would change
696
+ * the body is refused until then.
697
+ */
698
+ | {
699
+ readonly op: 'getFurniture';
700
+ readonly section: AutomationHandle;
701
+ readonly kind: 'header' | 'footer';
702
+ readonly variant: HeaderFooterVariant;
703
+ }
704
+ /**
705
+ * Every footnote or endnote the document holds, in the order its notes part writes them.
706
+ *
707
+ * The reserved separator and continuation-separator notes (`w:id` -1 and 0) are not notes a
708
+ * caller can reach: reporting them would say the document has two more footnotes than it has.
709
+ */
710
+ | {
711
+ readonly op: 'getNotes';
712
+ readonly document: AutomationHandle;
713
+ readonly noteKind: NoteKind;
714
+ readonly scope?: AutomationHandle;
715
+ }
716
+ /** One note's story, as a BODY. Two notes in one part are two stories. */
717
+ | {
718
+ readonly op: 'getNoteBody';
719
+ readonly note: AutomationHandle;
720
+ }
721
+ /**
722
+ * One note's story as plain text.
723
+ *
724
+ * Exactly the same projection as reading `getText` from the body returned by `getNoteBody`,
725
+ * without requiring that intermediate handle: paragraphs joined by one `\r` paragraph mark.
726
+ */
727
+ | {
728
+ readonly op: 'getNoteText';
729
+ readonly note: AutomationHandle;
730
+ readonly projection?: AutomationTextProjection;
731
+ }
732
+ /** Whether a note is a footnote or an endnote. */
733
+ | {
734
+ readonly op: 'getNoteKind';
735
+ readonly note: AutomationHandle;
736
+ }
737
+ /**
738
+ * Delete a note: its body in the notes part and every reference that reached it.
739
+ *
740
+ * A PACKAGE-level transaction, so it shares its batch with nothing — see
741
+ * `AUTOMATION_SOLITARY_OPERATIONS`.
742
+ */
743
+ | {
744
+ readonly op: 'deleteNote';
745
+ readonly note: AutomationHandle;
746
+ }
747
+ /**
748
+ * Every list one story holds, in the order its numbers first appear.
749
+ *
750
+ * A list is the paragraphs that share a `w:numId`, so this is derived rather than walked: there
751
+ * is no list element in a `.docx` to enumerate. Two stories that number with the same value are
752
+ * still two lists, because the paragraphs are not in the same story.
753
+ */
754
+ | {
755
+ readonly op: 'getLists';
756
+ readonly body: AutomationHandle;
757
+ }
758
+ /** A list's `w:numId`, as the number the file states. */
759
+ | {
760
+ readonly op: 'getListId';
761
+ readonly list: AutomationHandle;
762
+ }
763
+ /**
764
+ * One story's list by the `w:numId` its paragraphs share, refused where none does.
765
+ *
766
+ * Refused rather than answered for an unused number: a `w:numId` with no paragraph names a
767
+ * numbering DEFINITION, and a list handle for it would answer no paragraphs forever.
768
+ */
769
+ | {
770
+ readonly op: 'getListById';
771
+ readonly body: AutomationHandle;
772
+ readonly id: number;
773
+ }
774
+ /**
775
+ * A list's paragraphs in reading order, or only the ones at one level.
776
+ *
777
+ * `level` is `w:ilvl` — 0-8. A level the list has no paragraphs at answers none, which is not an
778
+ * error: a list is free to skip a level.
779
+ */
780
+ | {
781
+ readonly op: 'getListParagraphs';
782
+ readonly list: AutomationHandle;
783
+ readonly level?: number;
784
+ }
785
+ /**
786
+ * The list a paragraph is in.
787
+ *
788
+ * A paragraph in none is REFUSED rather than answered an empty list of its own: "this paragraph
789
+ * is not a list item" is a different fact from "this list has one paragraph", and a caller that
790
+ * cannot tell them apart will indent prose.
791
+ */
792
+ | {
793
+ readonly op: 'getParagraphList';
794
+ readonly paragraph: AutomationHandle;
795
+ }
796
+ /** A list item's `w:ilvl`. Refused for a paragraph that is in no list. */
797
+ | {
798
+ readonly op: 'getListLevel';
799
+ readonly paragraph: AutomationHandle;
800
+ }
801
+ /**
802
+ * Move a list item to another level — Increase/Decrease Indent on a list.
803
+ *
804
+ * The level selects the format out of `numbering.xml`, so the marker changes with it. A level
805
+ * outside 0-8 is refused rather than clamped: nothing defines a format there.
806
+ */
807
+ | {
808
+ readonly op: 'setListLevel';
809
+ readonly paragraph: AutomationHandle;
810
+ readonly level: number;
811
+ }
812
+ /**
813
+ * Add a paragraph to a list, at one of its edges. Answers the NEW paragraph.
814
+ *
815
+ * The new paragraph is numbered with the list it joins, at the level of the item it is inserted
816
+ * beside — which is what continuing a list means, and what Word does when the caret is at the
817
+ * end of one and Enter is pressed.
818
+ */
819
+ | {
820
+ readonly op: 'insertListParagraph';
821
+ readonly list: AutomationHandle;
822
+ readonly where: 'start' | 'end';
823
+ readonly text: string;
824
+ }
825
+ /**
826
+ * Where a span points: an absolute URL, `#anchor`, or empty for text in no link.
827
+ *
828
+ * Empty rather than an error, because "this text is not a link" is an ordinary fact about a
829
+ * document. Also empty when no SINGLE link covers the whole span — a span half in and half out
830
+ * of a link is not that link's, and answering its target would tell a caller the words they
831
+ * measured are all linked when some of them are not.
832
+ *
833
+ * The answer is the SANITIZED target. A file may carry `javascript:`; nothing reads it back out
834
+ * of this protocol as a target, because a caller handed one would put it in front of a reader.
835
+ */
836
+ | {
837
+ readonly op: 'getHyperlink';
838
+ readonly span: AutomationSpanRef;
839
+ }
840
+ /**
841
+ * Make a span a link, re-aim the link it already is, or unlink it.
842
+ *
843
+ * `''` unlinks: the `w:hyperlink` element goes and its runs stay exactly as they were, which is
844
+ * what Word's Remove Hyperlink does. `#name` points at a bookmark THIS document declares — an
845
+ * anchor nothing declares is refused rather than written as a jump to nowhere. Anything else is
846
+ * an external address, and it is authored only if the engine would open it: a refused scheme
847
+ * never reaches the package, and nothing is written at all.
848
+ */
849
+ | {
850
+ readonly op: 'setHyperlink';
851
+ readonly span: AutomationSpanRef;
852
+ readonly target: string;
853
+ }
854
+ /**
855
+ * The bookmarks a scope holds, in document order.
856
+ *
857
+ * `{ body }` is a whole story; a narrower span answers the ones it OVERLAPS, which is what
858
+ * "the bookmarks of this range" means. Word's own scratch names (`_GoBack` and the rest of the
859
+ * underscore-prefixed ones) are not answered, matching Word's default.
860
+ */
861
+ | {
862
+ readonly op: 'getBookmarks';
863
+ readonly scope: AutomationSpanRef;
864
+ }
865
+ /** The name a bookmark is declared with. */
866
+ | {
867
+ readonly op: 'getBookmarkName';
868
+ readonly bookmark: AutomationHandle;
869
+ }
870
+ /**
871
+ * The range a bookmark's two markers enclose.
872
+ *
873
+ * Refused once the document no longer declares the name: the markers are gone with the text
874
+ * that held them, and a stale range would point a caller at whatever moved into their place.
875
+ */
876
+ | {
877
+ readonly op: 'getBookmarkRange';
878
+ readonly bookmark: AutomationHandle;
879
+ }
880
+ /**
881
+ * The comments anchored in a scope, in document order — the TOP-LEVEL ones.
882
+ *
883
+ * A reply is reached through the comment it answers rather than listed beside it, because a flat
884
+ * list makes a conversation look like several remarks and loses which answered which.
885
+ */
886
+ | {
887
+ readonly op: 'getComments';
888
+ readonly scope: AutomationSpanRef;
889
+ }
890
+ /** Replies to one comment, in document order. */
891
+ | {
892
+ readonly op: 'getCommentReplies';
893
+ readonly comment: AutomationHandle;
894
+ }
895
+ /** The `w:id` the comments part holds a comment under. */
896
+ | {
897
+ readonly op: 'getCommentId';
898
+ readonly comment: AutomationHandle;
899
+ }
900
+ /** Who wrote a comment. `CT_TrackChange` requires it, so a comment always has one. */
901
+ | {
902
+ readonly op: 'getCommentAuthor';
903
+ readonly comment: AutomationHandle;
904
+ }
905
+ /** `@w:date` verbatim, or empty where the file wrote none. Never invented. */
906
+ | {
907
+ readonly op: 'getCommentDate';
908
+ readonly comment: AutomationHandle;
909
+ }
910
+ /** A comment's body as plain text. */
911
+ | {
912
+ readonly op: 'getCommentText';
913
+ readonly comment: AutomationHandle;
914
+ }
915
+ /** The words a comment is about. Refused for a comment the file gave no usable range. */
916
+ | {
917
+ readonly op: 'getCommentRange';
918
+ readonly comment: AutomationHandle;
919
+ }
920
+ /** Whether the thread is resolved (`w15:commentEx/@w15:done`). */
921
+ | {
922
+ readonly op: 'getCommentResolved';
923
+ readonly comment: AutomationHandle;
924
+ }
925
+ /**
926
+ * Create a top-level comment anchored to a span.
927
+ *
928
+ * Empty spans are valid insertion-point comments. A span may cross paragraphs in one story,
929
+ * but not table-cell boundaries: range markers cannot safely open in one cell and close in
930
+ * another. `author` and non-empty, single-paragraph `text` are required by this slice.
931
+ *
932
+ * Answers the NEW comment whose id is minted inside the package transaction.
933
+ */
934
+ | {
935
+ readonly op: 'insertComment';
936
+ readonly span: AutomationSpanRef;
937
+ readonly text: string;
938
+ readonly author: string;
939
+ /** ISO-8601. Omitted writes no `@w:date` — inventing one is a content change. */
940
+ readonly date?: string;
941
+ }
942
+ /**
943
+ * Resolve a comment thread, or reopen it.
944
+ *
945
+ * A THREAD: the comment and its replies together, which is what resolving means in Word. Marking
946
+ * the parent alone would leave a reply reading as open under a closed remark.
947
+ */
948
+ | {
949
+ readonly op: 'setCommentResolved';
950
+ readonly comment: AutomationHandle;
951
+ readonly resolved: boolean;
952
+ }
953
+ /**
954
+ * Reply to a comment, over the same words it is anchored to.
955
+ *
956
+ * `author` is required and must not be blank: `CT_TrackChange` makes `@w:author` mandatory, so a
957
+ * reply without one is invalid XML rather than an anonymous remark.
958
+ *
959
+ * Answers the NEW comment, because its `w:id` is minted inside the package transaction and a
960
+ * caller that had to re-read the thread to find its own reply would be reading a document that
961
+ * another writer may have changed in between.
962
+ */
963
+ | {
964
+ readonly op: 'replyToComment';
965
+ readonly comment: AutomationHandle;
966
+ readonly text: string;
967
+ readonly author: string;
968
+ /** ISO-8601. Omitted writes no `@w:date` — inventing one is a content change. */
969
+ readonly date?: string;
970
+ }
971
+ /**
972
+ * Delete one comment object.
973
+ *
974
+ * A top-level comment removes its whole thread and anchors. A reply removes only that reply;
975
+ * its parent and siblings remain. Several delete operations may share one batch and commit as
976
+ * one package transaction and one undo unit, but they cannot share a batch with any other write.
977
+ */
978
+ | {
979
+ readonly op: 'deleteComment';
980
+ readonly comment: AutomationHandle;
981
+ }
982
+ /**
983
+ * The tracked changes of a story, in document order.
984
+ *
985
+ * Structural revisions are omitted because this protocol does not publish their exact Word
986
+ * subtype. Collection accept/reject can still resolve structural revisions the store supports,
987
+ * such as a complete tracked row.
988
+ */
989
+ | {
990
+ readonly op: 'getRevisions';
991
+ readonly body: AutomationHandle;
992
+ }
993
+ /** Resolve eligible decisions in one story. Omit revisions to select every canonical decision. */
994
+ | {
995
+ readonly op: 'resolveRevisionBatch';
996
+ readonly body: AutomationHandle;
997
+ readonly action: 'accept' | 'reject';
998
+ readonly revisions?: readonly AutomationHandle[];
999
+ }
1000
+ /**
1001
+ * Attribute pending decisions in one story to another author, keeping them pending. Omit
1002
+ * revisions to select every canonical decision. `date` is `xsd:dateTime`; omitted keeps each.
1003
+ */
1004
+ | {
1005
+ readonly op: 'setRevisionAuthorBatch';
1006
+ readonly body: AutomationHandle;
1007
+ readonly author: string;
1008
+ readonly date?: string;
1009
+ readonly revisions?: readonly AutomationHandle[];
1010
+ /** Keep only changes these authors made. Not allowed with `revisions`. */
1011
+ readonly authors?: readonly string[];
1012
+ }
1013
+ /** Word's name for the kind of change: `Insert`, `Delete`, `Replace`, `Property`, … */
1014
+ | {
1015
+ readonly op: 'getRevisionType';
1016
+ readonly revision: AutomationHandle;
1017
+ } | {
1018
+ readonly op: 'getRevisionAuthor';
1019
+ readonly revision: AutomationHandle;
1020
+ }
1021
+ /** `@w:date` verbatim, or empty where the file wrote none. */
1022
+ | {
1023
+ readonly op: 'getRevisionDate';
1024
+ readonly revision: AutomationHandle;
1025
+ }
1026
+ /** The words a change covers. Empty-range changes — a formatting one — answer their site. */
1027
+ | {
1028
+ readonly op: 'getRevisionRange';
1029
+ readonly revision: AutomationHandle;
1030
+ }
1031
+ /**
1032
+ * Accept one change, resolving every site that carries its identity.
1033
+ *
1034
+ * Both halves of a replacement go together: accepting the deletion and leaving the insertion
1035
+ * unproposed is a state no reviewer asked for.
1036
+ */
1037
+ | {
1038
+ readonly op: 'acceptRevision';
1039
+ readonly revision: AutomationHandle;
1040
+ } | {
1041
+ readonly op: 'rejectRevision';
1042
+ readonly revision: AutomationHandle;
1043
+ }
1044
+ /**
1045
+ * Accept every change in one story, as ONE decision and one undo unit.
1046
+ *
1047
+ * The document-handle form names the main story. The body-handle form names that story: a
1048
+ * header, footer, or the main body uses the part-wide store op; a note uses one store
1049
+ * all-decision scoped to that exact canonical note root. Both forms agree for the main story.
1050
+ */
1051
+ | {
1052
+ readonly op: 'acceptAllRevisions';
1053
+ readonly body: AutomationHandle;
1054
+ } | {
1055
+ readonly op: 'acceptAllRevisions';
1056
+ readonly document: AutomationHandle;
1057
+ } | {
1058
+ readonly op: 'rejectAllRevisions';
1059
+ readonly body: AutomationHandle;
1060
+ } | {
1061
+ readonly op: 'rejectAllRevisions';
1062
+ readonly document: AutomationHandle;
1063
+ }
1064
+ /**
1065
+ * Put the reader's selection on a span. Requires the `selection` capability, so a headless
1066
+ * host refuses it rather than pretending to have a caret.
1067
+ */
1068
+ | {
1069
+ readonly op: 'selectSpan';
1070
+ readonly span: AutomationSpanRef;
1071
+ readonly mode: AutomationSelectionMode;
1072
+ }
1073
+ /**
1074
+ * Put the reader's selection on the range a bookmark currently encloses.
1075
+ *
1076
+ * The bookmark is resolved inside the batch so callers do not need a separate round trip to
1077
+ * obtain an addressable range. Requires the `selection` capability, like `selectSpan`.
1078
+ */
1079
+ | {
1080
+ readonly op: 'selectBookmark';
1081
+ readonly bookmark: AutomationHandle;
1082
+ readonly mode: AutomationSelectionMode;
1083
+ }
1084
+ /**
1085
+ * The content controls a scope holds, outermost first and in document order.
1086
+ *
1087
+ * A control INSIDE another is reached through the one that holds it, never listed beside it:
1088
+ * a flat list of a document's controls makes a form field and the section wrapping it look
1089
+ * like siblings, and a caller iterating to fill a form would write into both.
1090
+ */
1091
+ | {
1092
+ readonly op: 'getContentControls';
1093
+ readonly scope: AutomationContentControlScope;
1094
+ }
1095
+ /**
1096
+ * The first control in a scope whose `w:id` is the one asked for.
1097
+ *
1098
+ * FIRST, not "the" — `w:id` is not unique in OOXML and a file may write the same number
1099
+ * twice. Both controls remain reachable by listing; only this lookup has to choose, and
1100
+ * choosing document order is the choice a caller can predict.
1101
+ */
1102
+ | {
1103
+ readonly op: 'getContentControlById';
1104
+ readonly scope: AutomationContentControlScope;
1105
+ readonly id: number;
1106
+ }
1107
+ /** Every control in a scope carrying a tag, in document order. */
1108
+ | {
1109
+ readonly op: 'getContentControlsByTag';
1110
+ readonly scope: AutomationContentControlScope;
1111
+ readonly tag: string;
1112
+ }
1113
+ /** Every control in a scope carrying a title (`w:alias`), in document order. */
1114
+ | {
1115
+ readonly op: 'getContentControlsByTitle';
1116
+ readonly scope: AutomationContentControlScope;
1117
+ readonly title: string;
1118
+ }
1119
+ /** `w:tag`, or empty where the file wrote none. Never invented. */
1120
+ | {
1121
+ readonly op: 'getContentControlTag';
1122
+ readonly contentControl: AutomationHandle;
1123
+ }
1124
+ /** `w:alias` — what Word's UI calls the title. Empty where absent. */
1125
+ | {
1126
+ readonly op: 'getContentControlTitle';
1127
+ readonly contentControl: AutomationHandle;
1128
+ }
1129
+ /**
1130
+ * `w:id` as a STRING, and empty where the file wrote none.
1131
+ *
1132
+ * Metadata, deliberately: the identity a caller holds is the handle. A file id answered as a
1133
+ * number would invite a caller to treat it as one, and an optional non-unique attribute is
1134
+ * not an identity however it is spelled.
1135
+ */
1136
+ | {
1137
+ readonly op: 'getContentControlFileId';
1138
+ readonly contentControl: AutomationHandle;
1139
+ }
1140
+ /** The control's type: `richText`, `plainText`, `dropDownList`, `comboBox`, `date`, … */
1141
+ | {
1142
+ readonly op: 'getContentControlSubtype';
1143
+ readonly contentControl: AutomationHandle;
1144
+ }
1145
+ /** The `ST_Lock` in force, INCLUDING what an enclosing control imposes. */
1146
+ | {
1147
+ readonly op: 'getContentControlLock';
1148
+ readonly contentControl: AutomationHandle;
1149
+ }
1150
+ /**
1151
+ * Whether the control declares `w:dataBinding`.
1152
+ *
1153
+ * Presence only: no XPath, namespace mapping, store id, or custom XML content crosses this
1154
+ * protocol boundary, and the binding target is never resolved or fetched.
1155
+ */
1156
+ | {
1157
+ readonly op: 'getContentControlIsBound';
1158
+ readonly contentControl: AutomationHandle;
1159
+ }
1160
+ /** Whether the control is showing its placeholder rather than a value (`w:showingPlcHdr`). */
1161
+ | {
1162
+ readonly op: 'getContentControlPlaceholderShown';
1163
+ readonly contentControl: AutomationHandle;
1164
+ }
1165
+ /** Whether the control removes itself on the first edit (`w:temporary`). */
1166
+ | {
1167
+ readonly op: 'getContentControlTemporary';
1168
+ readonly contentControl: AutomationHandle;
1169
+ }
1170
+ /** The text the control encloses, as the document reads it. */
1171
+ | {
1172
+ readonly op: 'getContentControlText';
1173
+ readonly contentControl: AutomationHandle;
1174
+ readonly projection?: AutomationTextProjection;
1175
+ }
1176
+ /** The paragraphs the control holds, in reading order. Empty for an inline control's own. */
1177
+ | {
1178
+ readonly op: 'getContentControlParagraphs';
1179
+ readonly contentControl: AutomationHandle;
1180
+ }
1181
+ /**
1182
+ * The span the control's content covers, so a caller can read or format it.
1183
+ *
1184
+ * `location` narrows it: `start`/`end` collapse onto the content's edges, and `before`/`after`
1185
+ * answer those same edges because a control's boundary marks occupy no offset here.
1186
+ */
1187
+ | {
1188
+ readonly op: 'getContentControlRange';
1189
+ readonly contentControl: AutomationHandle;
1190
+ readonly location?: AutomationContentControlRangeLocation;
1191
+ }
1192
+ /**
1193
+ * Write the control's value in the vocabulary its own type accepts.
1194
+ *
1195
+ * The refusals are the store's: `locked`, `bound`, `type-mismatch`, `invalid-value`. This
1196
+ * operation adds none of its own, because a script and a keystroke must be refused for the
1197
+ * same reasons or a form is only as protected as the path a caller happened to take.
1198
+ */
1199
+ | {
1200
+ readonly op: 'setContentControlValue';
1201
+ readonly contentControl: AutomationHandle;
1202
+ readonly value: AutomationContentControlValue;
1203
+ }
1204
+ /** Author tag, title or lock. An omitted member is left as it is; `null` removes it. */
1205
+ | {
1206
+ readonly op: 'setContentControlProperties';
1207
+ readonly cannotEdit?: boolean;
1208
+ readonly cannotDelete?: boolean;
1209
+ readonly contentControl: AutomationHandle;
1210
+ readonly tag?: string | null;
1211
+ readonly title?: string | null;
1212
+ readonly lock?: AutomationContentControlLock;
1213
+ }
1214
+ /** Remove the control. `keepContent` is Word's own "Remove content control". */
1215
+ | {
1216
+ readonly op: 'deleteContentControl';
1217
+ readonly contentControl: AutomationHandle;
1218
+ readonly keepContent: boolean;
1219
+ }
1220
+ /**
1221
+ * Put text into the control, at `replace` (its value) or at one edge of its content.
1222
+ *
1223
+ * The edge is resolved HERE and not by the caller: a script that read the span first and wrote
1224
+ * to it second could only write to where the control was when it asked, and the read and the
1225
+ * write would be two refusals instead of one.
1226
+ */
1227
+ | {
1228
+ readonly op: 'insertContentControlText';
1229
+ readonly contentControl: AutomationHandle;
1230
+ readonly text: string;
1231
+ readonly at: 'replace' | 'start' | 'end';
1232
+ }
1233
+ /** Wrap a span in a new control of the named type. */
1234
+ | {
1235
+ readonly op: 'insertContentControl';
1236
+ readonly returnHandle?: boolean;
1237
+ readonly span: AutomationSpanRef;
1238
+ readonly subtype: AutomationContentControlSubtype;
1239
+ readonly tag?: string;
1240
+ readonly title?: string;
1241
+ }
1242
+ /**
1243
+ * Insert a custom node: a tagged inline control, optionally bound to a payload.
1244
+ *
1245
+ * `w:tag` caps at 64 characters, so a node whose identity is a query string fits and a node
1246
+ * carrying authors, a year and a locator does not. The payload answers that — it lives in a
1247
+ * customXml data part and the control points at it — and the store, the node and the control
1248
+ * are ONE transaction. A control bound to a store that was never written is a document Word
1249
+ * offers to repair, and repairing it throws the control away.
1250
+ *
1251
+ * It lives HERE rather than on the editor session so both hosts answer it identically: a
1252
+ * payload write needs package scope, and putting it on the session would make the browser the
1253
+ * real implementation and leave the headless host to reimplement it or do without.
1254
+ *
1255
+ * `at` is a position; `span` wraps existing text instead. Exactly one, because a node with
1256
+ * both would be an insertion the caller thinks is a wrap.
1257
+ */
1258
+ | {
1259
+ readonly op: 'insertCustomNode';
1260
+ /** Where the node goes. Omitted with `span`, which supplies its own place. */
1261
+ readonly at?: AutomationPoint;
1262
+ /** Text to wrap, in place of `at`. The node's label replaces it. */
1263
+ readonly span?: AutomationSpanRef;
1264
+ /** The node's identity, as its definition encoded it. Word caps this at 64 characters. */
1265
+ readonly tag: string;
1266
+ /** The literal text the control holds — what Word and a reader without this library see. */
1267
+ readonly text: string;
1268
+ /** `w:alias` — the title Word shows on the control. */
1269
+ readonly title?: string;
1270
+ /** `w:lock`; omitted writes none. */
1271
+ readonly lock?: AutomationContentControlLock;
1272
+ /** The payload, and where it lives. Omitted authors a control with no store. */
1273
+ readonly payload?: AutomationCustomNodePayload;
1274
+ };
1275
+ /**
1276
+ * A custom node's payload, and the store it lives in.
1277
+ *
1278
+ * `data` is a STRING and stays one all the way down. A schema belongs to the definition that
1279
+ * declared it, and an automation lane that parsed payloads would be a second opinion about what
1280
+ * a host's node means — carried over a transport that cannot hold the schema in the first place.
1281
+ *
1282
+ * @public
1283
+ */
1284
+ interface AutomationCustomNodePayload {
1285
+ /** Namespace of the store's root element. One store per namespace, per document. */
1286
+ readonly namespaceUri: string;
1287
+ /** Local name of that root. An NCName; anything else refuses. */
1288
+ readonly rootLocalName: string;
1289
+ /** The node's id inside the store, which the binding's xpath quotes. */
1290
+ readonly nodeId: string;
1291
+ /** The text Word paints the control from. Empty is an empty chip. */
1292
+ readonly label: string;
1293
+ /** The payload, serialized. */
1294
+ readonly data: string;
1295
+ }
1296
+ /** Just the `op` discriminants of {@link AutomationOperation}, for dispatch tables. */
1297
+ type AutomationOperationKind = AutomationOperation['op'];
1298
+
1299
+ /**
1300
+ * What kind of document object a handle names.
1301
+ *
1302
+ * `body` is one STORY — the main body, a header or footer variant of a section, or one note — so
1303
+ * every object reached through a body is reached in a named story rather than in "the document".
1304
+ */
1305
+ type AutomationObjectKind = 'document' | 'body' | 'paragraph' | 'section' | 'note' | 'comment' | 'revision' | 'bookmark' | 'list' | 'contentControl' | 'table' | 'tableRow' | 'tableCell' | 'field' | 'inlinePicture' | 'shape';
1306
+ declare const AUTOMATION_HANDLE_BRAND: unique symbol;
1307
+ /**
1308
+ * An opaque host-minted name for a document object.
1309
+ *
1310
+ * Branded so a consumer cannot invent one: the only way to hold a ref is to have been given
1311
+ * it by the host that minted it. Its CONTENT is deliberately meaningless — it is not a node
1312
+ * id, not a part name, not a path. A host that returned engine identity here would hand
1313
+ * every consumer a way to address the canonical tree directly, and the next thing to arrive
1314
+ * would be a second write path.
1315
+ *
1316
+ * SCOPED TO ONE HOST. Each host draws a random token when it starts and stamps it into every
1317
+ * ref it mints, so a ref carries no meaning anywhere else: passed to another host — including
1318
+ * one open on the same bytes — it is `invalid-handle`, not a paragraph.
1319
+ */
1320
+ type AutomationHandleRef = string & {
1321
+ readonly [AUTOMATION_HANDLE_BRAND]: 'handle';
1322
+ };
1323
+ /** A stable reference to one document object, valid for the life of the host that minted it. */
1324
+ interface AutomationHandle<K extends AutomationObjectKind = AutomationObjectKind> {
1325
+ readonly kind: K;
1326
+ readonly ref: AutomationHandleRef;
1327
+ }
1328
+ /**
1329
+ * What a host supports, fixed at construction and frozen.
1330
+ *
1331
+ * Immutable because capability is a property of the host, not a mode it can be talked into:
1332
+ * a consumer that branched on `capabilities` once must not find the answer different later.
1333
+ * A headless host reports `selection`, `scrolling` and `layout` false — it paints nothing and
1334
+ * has no reader to move — and refuses those operations rather than approximating them.
1335
+ */
1336
+ interface AutomationCapabilities {
1337
+ /** Reading and editing document content. Every document operation requires it. */
1338
+ readonly document: boolean;
1339
+ /** Serializing the current document back to DOCX bytes. */
1340
+ readonly save: boolean;
1341
+ /** Change notification through {@link AutomationHost.subscribe}. */
1342
+ readonly events: boolean;
1343
+ /** A reader's selection or caret exists and can be addressed. */
1344
+ readonly selection: boolean;
1345
+ /** The document is displayed in something that can be scrolled to a position. */
1346
+ readonly scrolling: boolean;
1347
+ /** Paginated layout exists, so pages and page geometry can be asked about. */
1348
+ readonly layout: boolean;
1349
+ }
1350
+ /**
1351
+ * Why an operation was refused, as a value to branch on.
1352
+ *
1353
+ * Deliberately distinguishable rather than one "failed": the object model above this protocol
1354
+ * maps each code to a different consumer-facing error, and a caller that retries a
1355
+ * `stale-revision` must not retry an `invalid-handle`.
1356
+ */
1357
+ type AutomationErrorCode =
1358
+ /**
1359
+ * Nothing was applied because the request was built from an older read: `expectedRevision`
1360
+ * did not match the host's current revision, or an endpoint's `readAt` names a position
1361
+ * that moved since. Read again before retrying; resending the same endpoints fails again.
1362
+ */
1363
+ 'stale-revision'
1364
+ /** A handle this host never minted, or one naming a different kind of object. */
1365
+ | 'invalid-handle'
1366
+ /** A UTF-16 offset that is not an integer inside the target's bounds. */
1367
+ | 'invalid-offset'
1368
+ /** The operation needs a capability this host reports false. */
1369
+ | 'unsupported-capability'
1370
+ /** The host has been disposed. Every subsequent call fails this way. */
1371
+ | 'disposed'
1372
+ /** The canonical mutation path refused the transaction; nothing was applied. */
1373
+ | 'transaction-refused'
1374
+ /** The operation is not one this protocol version defines. */
1375
+ | 'unknown-operation'
1376
+ /**
1377
+ * The value asked to be written is one this host will not write — text carrying a paragraph
1378
+ * mark, a delimiter set with nothing in it. Not `invalid-offset` and not
1379
+ * `unsupported-capability`: the request is well-formed and the host is capable, the CONTENT
1380
+ * is the problem, and writing an approximation of it would mean something else.
1381
+ */
1382
+ | 'unsupported-content'
1383
+ /** A tracked-change kind this engine preserves but cannot yet accept or reject safely. */
1384
+ | 'unsupported-revision'
1385
+ /**
1386
+ * File-authored identities are ambiguous, so exposing either object would alias another.
1387
+ *
1388
+ * This is document corruption, not an invalid caller argument or an unsupported capability.
1389
+ */
1390
+ | 'ambiguous-document'
1391
+ /**
1392
+ * Two operations in one batch make claims on the same paragraph that cannot both hold.
1393
+ *
1394
+ * A batch is one ordered transaction, so its commands are planned against the state at its
1395
+ * start. That is unambiguous until two of them restructure the same paragraph — inserting a
1396
+ * paragraph before it AND writing into it, splitting it twice — where the second command's
1397
+ * positions describe a paragraph the first one already reshaped. Refusing the batch is the
1398
+ * only answer that is not a guess; the caller sequences them across two syncs.
1399
+ */
1400
+ | 'conflicting-operations'
1401
+ /**
1402
+ * The host is live but has no document to act on right now — a browser host whose editor
1403
+ * is detached between mounts. Distinct from `disposed`: the host may answer again later.
1404
+ */
1405
+ | 'document-unavailable';
1406
+ /**
1407
+ * One refused operation. Plain data, not an `Error` — it crosses transports.
1408
+ *
1409
+ * `code` is the stable part; `message` and `detail` are for logs. The object model above this
1410
+ * protocol deliberately does NOT copy `detail` into what a consumer sees, because a store's
1411
+ * rejection reason would become documented API the moment somebody matched on it.
1412
+ */
1413
+ interface AutomationError {
1414
+ readonly code: AutomationErrorCode;
1415
+ /** Human-readable, for a log or a thrown error in a layer above. Never parsed. */
1416
+ readonly message: string;
1417
+ /** Machine-ish specifics: the offending offset, the store's own rejection reason. */
1418
+ readonly detail?: string;
1419
+ }
1420
+ /**
1421
+ * One end of a stretch of a story: a paragraph, and a UTF-16 offset in it.
1422
+ *
1423
+ * The only addressing vocabulary in this protocol. A stable paragraph handle plus a raw model
1424
+ * offset is what tree operations, selection, and layout use. Display text reads can expand field
1425
+ * atoms and apply a review view. A client must not calculate offsets from display text. It can
1426
+ * request the `model` projection when it needs text in this offset vocabulary. Painted DOM
1427
+ * indices and document-wide character counters appear nowhere.
1428
+ */
1429
+ interface AutomationEndpoint {
1430
+ /**
1431
+ * Typed as a handle of any kind on purpose. A ref is opaque, so the only thing that can
1432
+ * establish what one names is the host that minted it — every operation resolves the kind at
1433
+ * the boundary and answers `invalid-handle`. Narrowing the phantom here would add a
1434
+ * compile-time check that holds only inside this repository, while forcing a cast at every
1435
+ * point an object model carries a handle it received from a response.
1436
+ */
1437
+ readonly paragraph: AutomationHandle;
1438
+ readonly offset: number;
1439
+ /**
1440
+ * The host revision this endpoint was read at. Hosts stamp every endpoint they answer with
1441
+ * it; send it back unchanged. An endpoint whose paragraph text changed since then is refused
1442
+ * with `stale-revision` instead of addressing whatever text now sits at its offset. Omit it
1443
+ * for an endpoint built by hand, which the host then takes as current.
1444
+ */
1445
+ readonly readAt?: number;
1446
+ }
1447
+ /** A stretch of a story between two endpoints, in reading order. */
1448
+ interface AutomationSpan {
1449
+ readonly start: AutomationEndpoint;
1450
+ readonly end: AutomationEndpoint;
1451
+ }
1452
+ /** What an operation answered with. */
1453
+ type AutomationValue = {
1454
+ readonly kind: 'revisionBatch';
1455
+ readonly result: RevisionBatchResult;
1456
+ } | {
1457
+ readonly kind: 'revisionAuthors';
1458
+ readonly result: RevisionAuthorResult;
1459
+ } | {
1460
+ readonly kind: 'field';
1461
+ readonly field: {
1462
+ readonly code: string;
1463
+ };
1464
+ } | {
1465
+ readonly kind: 'table';
1466
+ readonly table: {
1467
+ readonly values: readonly (readonly string[])[];
1468
+ readonly style: string;
1469
+ readonly headerRowCount: number;
1470
+ readonly rowCount: number;
1471
+ readonly columnCount: number;
1472
+ };
1473
+ } | {
1474
+ readonly kind: 'tableCell';
1475
+ readonly cell: {
1476
+ readonly value: string;
1477
+ readonly columnWidth: number;
1478
+ readonly shadingColor: string;
1479
+ readonly verticalAlignment: 'Top' | 'Center' | 'Bottom';
1480
+ };
1481
+ } | {
1482
+ readonly kind: 'inlinePicture';
1483
+ readonly picture: AutomationInlinePictureRead;
1484
+ } | {
1485
+ readonly kind: 'shape';
1486
+ readonly shape: AutomationShapeRead;
1487
+ } | {
1488
+ readonly kind: 'handle';
1489
+ readonly handle: AutomationHandle;
1490
+ } | {
1491
+ readonly kind: 'handles';
1492
+ readonly handles: readonly AutomationHandle[];
1493
+ } | {
1494
+ readonly kind: 'text';
1495
+ readonly text: string;
1496
+ } | {
1497
+ readonly kind: 'span';
1498
+ readonly span: AutomationSpan;
1499
+ } | {
1500
+ readonly kind: 'spans';
1501
+ readonly spans: readonly AutomationSpan[];
1502
+ }
1503
+ /**
1504
+ * A bag of property values, rather than a document object.
1505
+ *
1506
+ * Typed per KIND rather than as one generic record, for the same reason the operation
1507
+ * vocabulary is: a caller destructures a named shape, and a new kind of answer has to be
1508
+ * declared before it can be sent. A record keyed by strings would let a host answer anything.
1509
+ */
1510
+ | {
1511
+ readonly kind: 'font';
1512
+ readonly font: AutomationFontRead;
1513
+ } | {
1514
+ readonly kind: 'paragraphFormat';
1515
+ readonly format: AutomationParagraphFormatRead;
1516
+ }
1517
+ /** One section's page geometry, in points. */
1518
+ | {
1519
+ readonly kind: 'pageSetup';
1520
+ readonly setup: AutomationPageSetupRead;
1521
+ }
1522
+ /**
1523
+ * A number the document states: a list's `w:numId`, a list item's level.
1524
+ *
1525
+ * Its own kind rather than a stringified `text`, because a caller that has to parse an answer
1526
+ * back into a number is a caller that can parse it wrongly.
1527
+ */
1528
+ | {
1529
+ readonly kind: 'number';
1530
+ readonly value: number;
1531
+ }
1532
+ /** A yes-or-no the document states: whether a comment thread is resolved. */
1533
+ | {
1534
+ readonly kind: 'flag';
1535
+ readonly value: boolean;
1536
+ }
1537
+ /**
1538
+ * A paragraph style NAME, or null where nothing names one — the paragraphs disagree, or the
1539
+ * document declares no styles at all.
1540
+ */
1541
+ | {
1542
+ readonly kind: 'style';
1543
+ readonly name: string | null;
1544
+ }
1545
+ /** A command that committed. The observable effect is the response's revision/changed. */
1546
+ | {
1547
+ readonly kind: 'applied';
1548
+ };
1549
+ /**
1550
+ * One operation's outcome.
1551
+ *
1552
+ * `skipped` is what makes an atomic batch honest. When a batch fails, every operation other
1553
+ * than the one that failed reports `skipped` — including the ones that came BEFORE it and
1554
+ * including reads. Reporting those as `ok` would describe a document state that was never
1555
+ * published, which is exactly the partial-application illusion the batch exists to prevent.
1556
+ */
1557
+ type AutomationOperationResult = {
1558
+ readonly status: 'ok';
1559
+ readonly value: AutomationValue;
1560
+ } | {
1561
+ readonly status: 'error';
1562
+ readonly error: AutomationError;
1563
+ } | {
1564
+ readonly status: 'skipped';
1565
+ };
1566
+ /**
1567
+ * One ordered batch: what to run, and the revision it was planned against.
1568
+ *
1569
+ * Transport-shaped data, never references into the engine, so the same request crosses a worker
1570
+ * port or an HTTP boundary unchanged.
1571
+ */
1572
+ interface AutomationBatchRequest {
1573
+ /** Queries and commands, in the order they are to be interpreted. */
1574
+ readonly operations: readonly AutomationOperation[];
1575
+ /**
1576
+ * Refuse the whole batch unless the host is at this revision.
1577
+ *
1578
+ * How an object model built on cached reads stays honest: it read the document at a
1579
+ * revision, decided what to write, and says so. Omitted means "apply against whatever the
1580
+ * current state is", which is what an unconditional command wants.
1581
+ */
1582
+ readonly expectedRevision?: number;
1583
+ }
1584
+ /**
1585
+ * What one batch produced: a verdict, one result per operation, and the revision afterwards.
1586
+ *
1587
+ * `results` is positionally aligned with the request, so a failed operation is identified by its
1588
+ * index rather than by anything the caller has to correlate.
1589
+ */
1590
+ interface AutomationBatchResponse {
1591
+ /** True only when every operation succeeded and any commands committed. */
1592
+ readonly ok: boolean;
1593
+ /** One entry per requested operation, in request order. */
1594
+ readonly results: readonly AutomationOperationResult[];
1595
+ /** The host's revision AFTER the batch. Unchanged when nothing committed. */
1596
+ readonly revision: number;
1597
+ /** Whether the batch moved the document. False for a read-only or refused batch. */
1598
+ readonly changed: boolean;
1599
+ }
1600
+ /**
1601
+ * DOCX bytes, or why they could not be produced.
1602
+ *
1603
+ * A browser host that borrows an editor refuses with `unsupported-capability`: it does not own
1604
+ * the document and serializing one behind the editor's back would answer bytes the user's
1605
+ * session never agreed to.
1606
+ */
1607
+ type AutomationSaveResult = {
1608
+ readonly ok: true;
1609
+ readonly bytes: Uint8Array;
1610
+ } | {
1611
+ readonly ok: false;
1612
+ readonly error: AutomationError;
1613
+ };
1614
+ /** The document moved. Coarse on purpose: a consumer re-reads what it cares about. */
1615
+ interface AutomationChangeEvent {
1616
+ readonly revision: number;
1617
+ }
1618
+ /** What an automation subscription returns. Calling it twice is safe. */
1619
+ type AutomationUnsubscribe = () => void;
1620
+ /**
1621
+ * The protocol both hosts implement: a headless one owning bytes it opened, and a browser one
1622
+ * borrowing the live editor's session.
1623
+ *
1624
+ * Both answer the same operations identically, because the operations are implemented ONCE above
1625
+ * this interface over a canonical package neither host may bypass. A batch is one revision, one
1626
+ * undo unit, and one transaction.
1627
+ */
1628
+ interface AutomationHost {
1629
+ readonly capabilities: AutomationCapabilities;
1630
+ /** Monotonic revision of the document this host acts on. */
1631
+ revision(): number;
1632
+ /**
1633
+ * Run one ordered batch.
1634
+ *
1635
+ * Queries answer against the state as of the START of the batch; every command in the
1636
+ * batch commits as ONE transaction at its end. So a batch is one revision, one undo unit
1637
+ * and one change event however many commands it carries — and if any operation is refused,
1638
+ * nothing is written at all.
1639
+ */
1640
+ execute(request: AutomationBatchRequest): AutomationBatchResponse;
1641
+ /** Settle optional pagination resources before a field-update batch. Does not write content. */
1642
+ prepare?(request: AutomationBatchRequest): Promise<void>;
1643
+ /** The current document as DOCX bytes, through the normalizing serializer. */
1644
+ save(): AutomationSaveResult;
1645
+ /** Change notification. Returns an unsubscribe that is safe to call more than once. */
1646
+ subscribe(listener: (event: AutomationChangeEvent) => void): AutomationUnsubscribe;
1647
+ /** Release everything this host holds. Idempotent; every later call fails `disposed`. */
1648
+ dispose(): void;
1649
+ }
1650
+
1651
+ export type { AutomationOperation as A, AutomationPoint as B, AutomationReadingOrder as C, AutomationSaveResult as D, AutomationSearchOptions as E, AutomationSelectionMode as F, AutomationSpan as G, AutomationSpanRef as H, AutomationTextProjection as I, AutomationUnsubscribe as J, AutomationValue as K, AutomationCapabilities as a, AutomationHost as b, AutomationAlignment as c, AutomationBatchRequest as d, AutomationBatchResponse as e, AutomationChangeEvent as f, AutomationContentControlLock as g, AutomationContentControlRangeLocation as h, AutomationContentControlScope as i, AutomationContentControlSubtype as j, AutomationContentControlValue as k, AutomationError as l, AutomationErrorCode as m, AutomationFontRead as n, AutomationFontWrite as o, AutomationHandle as p, AutomationHandleRef as q, AutomationObjectKind as r, AutomationOperationKind as s, AutomationOperationResult as t, AutomationPageOrientation as u, AutomationPageSetupRead as v, AutomationPageSetupWrite as w, AutomationParagraphFormatRead as x, AutomationParagraphFormatWrite as y, AutomationParagraphRef as z };