reamkit 1.15.0 → 1.15.2

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 (316) hide show
  1. package/dist/esm/core/arc-to-bezier.d.ts +23 -0
  2. package/dist/esm/core/arc-to-bezier.js +23 -0
  3. package/dist/esm/core/bidi/algorithm.d.ts +26 -0
  4. package/dist/esm/core/bidi/algorithm.js +21 -0
  5. package/dist/esm/core/bidi/char-types.d.ts +17 -0
  6. package/dist/esm/core/bidi/char-types.js +10 -0
  7. package/dist/esm/core/bidi/index.d.ts +42 -0
  8. package/dist/esm/core/bidi/index.js +27 -0
  9. package/dist/esm/core/bidi/segments.d.ts +22 -0
  10. package/dist/esm/core/bidi/segments.js +14 -0
  11. package/dist/esm/core/bytes.d.ts +9 -0
  12. package/dist/esm/core/bytes.js +9 -0
  13. package/dist/esm/core/converter/facade.d.ts +38 -1
  14. package/dist/esm/core/converter/facade.js +25 -0
  15. package/dist/esm/core/converter/project.d.ts +12 -0
  16. package/dist/esm/core/converter/project.js +11 -0
  17. package/dist/esm/core/converter/ream.d.ts +107 -0
  18. package/dist/esm/core/converter/ream.js +76 -0
  19. package/dist/esm/core/crypto/asn1.d.ts +77 -0
  20. package/dist/esm/core/crypto/asn1.js +65 -0
  21. package/dist/esm/core/crypto/cms.d.ts +25 -0
  22. package/dist/esm/core/crypto/cms.js +8 -0
  23. package/dist/esm/core/document-model/index.d.ts +7 -0
  24. package/dist/esm/core/document-model/types.d.ts +328 -0
  25. package/dist/esm/core/drawingml/chart-geometry.d.ts +125 -0
  26. package/dist/esm/core/drawingml/chart-geometry.js +96 -0
  27. package/dist/esm/core/drawingml/chart-parser.d.ts +34 -0
  28. package/dist/esm/core/drawingml/chart-parser.js +34 -0
  29. package/dist/esm/core/drawingml/chart-serializer.d.ts +12 -0
  30. package/dist/esm/core/drawingml/chart-serializer.js +12 -0
  31. package/dist/esm/core/drawingml/colors.d.ts +53 -0
  32. package/dist/esm/core/drawingml/colors.js +41 -0
  33. package/dist/esm/core/drawingml/preset-geometry.d.ts +30 -0
  34. package/dist/esm/core/drawingml/preset-geometry.js +30 -0
  35. package/dist/esm/core/drawingml/shape-render.d.ts +54 -0
  36. package/dist/esm/core/drawingml/shape-render.js +54 -0
  37. package/dist/esm/core/drawingml/sparkline-geometry.d.ts +15 -0
  38. package/dist/esm/core/drawingml/sparkline-geometry.js +13 -0
  39. package/dist/esm/core/drawingml/theme-parser.d.ts +11 -0
  40. package/dist/esm/core/drawingml/theme-parser.js +11 -0
  41. package/dist/esm/core/font/arabic-joining.d.ts +21 -0
  42. package/dist/esm/core/font/arabic-joining.js +16 -0
  43. package/dist/esm/core/font/binary-reader.d.ts +17 -0
  44. package/dist/esm/core/font/binary-reader.js +17 -0
  45. package/dist/esm/core/font/font-registry.d.ts +37 -0
  46. package/dist/esm/core/font/font-registry.js +31 -0
  47. package/dist/esm/core/font/measure.d.ts +20 -0
  48. package/dist/esm/core/font/measure.js +11 -0
  49. package/dist/esm/core/font/opentype-layout.d.ts +49 -0
  50. package/dist/esm/core/font/opentype-layout.js +37 -0
  51. package/dist/esm/core/font/ttf-parser.d.ts +32 -0
  52. package/dist/esm/core/font/ttf-parser.js +7 -0
  53. package/dist/esm/core/font/ttf-subset.d.ts +21 -0
  54. package/dist/esm/core/font/ttf-subset.js +21 -0
  55. package/dist/esm/core/fonts/provider.d.ts +8 -1
  56. package/dist/esm/core/fonts/provider.js +1 -0
  57. package/dist/esm/core/fonts/remote-fonts.d.ts +22 -0
  58. package/dist/esm/core/fonts/remote-fonts.js +16 -0
  59. package/dist/esm/core/hyphenation/index.d.ts +25 -0
  60. package/dist/esm/core/hyphenation/index.js +17 -0
  61. package/dist/esm/core/hyphenation/liang.d.ts +27 -0
  62. package/dist/esm/core/hyphenation/liang.js +14 -0
  63. package/dist/esm/core/images.d.ts +32 -0
  64. package/dist/esm/core/images.js +12 -0
  65. package/dist/esm/core/ir/adapters.d.ts +23 -0
  66. package/dist/esm/core/ir/features.d.ts +8 -0
  67. package/dist/esm/core/ir/features.js +1 -0
  68. package/dist/esm/core/ir/flow.d.ts +20 -0
  69. package/dist/esm/core/ir/index.d.ts +7 -0
  70. package/dist/esm/core/ir/loss.d.ts +12 -0
  71. package/dist/esm/core/ir/loss.js +8 -0
  72. package/dist/esm/core/ir/resources.d.ts +12 -0
  73. package/dist/esm/core/ir/resources.js +11 -0
  74. package/dist/esm/core/ir/sheet.d.ts +81 -0
  75. package/dist/esm/core/ir/units.d.ts +9 -0
  76. package/dist/esm/core/ir/units.js +2 -0
  77. package/dist/esm/core/line-breaker/cjk.d.ts +26 -0
  78. package/dist/esm/core/line-breaker/cjk.js +60 -0
  79. package/dist/esm/core/line-breaker/greedy.d.ts +14 -0
  80. package/dist/esm/core/line-breaker/greedy.js +14 -0
  81. package/dist/esm/core/line-breaker/index.d.ts +1 -0
  82. package/dist/esm/core/line-breaker/index.js +3 -0
  83. package/dist/esm/core/line-breaker/knuth-plass.d.ts +29 -5
  84. package/dist/esm/core/line-breaker/knuth-plass.js +10 -5
  85. package/dist/esm/core/numbering/apply.d.ts +19 -0
  86. package/dist/esm/core/numbering/apply.js +19 -0
  87. package/dist/esm/core/numbering/state.d.ts +15 -0
  88. package/dist/esm/core/numbering/state.js +15 -0
  89. package/dist/esm/core/ole/cfb.d.ts +19 -0
  90. package/dist/esm/core/ole/cfb.js +50 -4
  91. package/dist/esm/core/opc/core-properties.d.ts +12 -0
  92. package/dist/esm/core/opc/core-properties.js +5 -0
  93. package/dist/esm/core/opc/opc-writer.d.ts +24 -4
  94. package/dist/esm/core/opc/opc-writer.js +12 -0
  95. package/dist/esm/core/opc/package.d.ts +55 -0
  96. package/dist/esm/core/opc/package.js +46 -0
  97. package/dist/esm/core/opc/relationship-types.d.ts +8 -0
  98. package/dist/esm/core/opc/relationship-types.js +5 -0
  99. package/dist/esm/core/opc/relationships.d.ts +12 -0
  100. package/dist/esm/core/opc/relationships.js +7 -0
  101. package/dist/esm/core/po-helpers.d.ts +38 -0
  102. package/dist/esm/core/po-helpers.js +33 -0
  103. package/dist/esm/core/spreadsheet-model/types.d.ts +281 -0
  104. package/dist/esm/core/style-cascade/resolver.d.ts +31 -0
  105. package/dist/esm/core/style-cascade/resolver.js +31 -0
  106. package/dist/esm/core/style-cascade/table.d.ts +7 -0
  107. package/dist/esm/core/style-cascade/table.js +7 -0
  108. package/dist/esm/core/style-cascade/types.d.ts +27 -0
  109. package/dist/esm/core/style-cascade/types.js +2 -0
  110. package/dist/esm/core/vector.d.ts +67 -0
  111. package/dist/esm/core/vector.js +23 -0
  112. package/dist/esm/excel/activex-parser.d.ts +31 -0
  113. package/dist/esm/excel/activex-parser.js +24 -0
  114. package/dist/esm/excel/cell-reference.d.ts +14 -0
  115. package/dist/esm/excel/cell-reference.js +9 -0
  116. package/dist/esm/excel/column-bands.d.ts +29 -0
  117. package/dist/esm/excel/column-bands.js +26 -0
  118. package/dist/esm/excel/comments-parser.d.ts +19 -0
  119. package/dist/esm/excel/comments-parser.js +19 -0
  120. package/dist/esm/excel/conditional-format.d.ts +38 -0
  121. package/dist/esm/excel/conditional-format.js +25 -0
  122. package/dist/esm/excel/defined-name-ref.d.ts +21 -0
  123. package/dist/esm/excel/defined-name-ref.js +20 -0
  124. package/dist/esm/excel/form-control-parser.d.ts +13 -0
  125. package/dist/esm/excel/form-control-parser.js +5 -0
  126. package/dist/esm/excel/formula/context.d.ts +37 -0
  127. package/dist/esm/excel/formula/dates.d.ts +23 -0
  128. package/dist/esm/excel/formula/dates.js +20 -0
  129. package/dist/esm/excel/formula/eval.d.ts +21 -0
  130. package/dist/esm/excel/formula/eval.js +11 -0
  131. package/dist/esm/excel/formula/functions.d.ts +12 -0
  132. package/dist/esm/excel/formula/functions.js +12 -0
  133. package/dist/esm/excel/formula/index.d.ts +21 -0
  134. package/dist/esm/excel/formula/index.js +16 -0
  135. package/dist/esm/excel/formula/lexer.d.ts +12 -0
  136. package/dist/esm/excel/formula/lexer.js +10 -0
  137. package/dist/esm/excel/formula/parser.d.ts +20 -0
  138. package/dist/esm/excel/formula/parser.js +53 -0
  139. package/dist/esm/excel/formula/value.d.ts +53 -0
  140. package/dist/esm/excel/formula/value.js +30 -0
  141. package/dist/esm/excel/header-footer.d.ts +9 -0
  142. package/dist/esm/excel/header-footer.js +9 -0
  143. package/dist/esm/excel/number-format.d.ts +34 -0
  144. package/dist/esm/excel/number-format.js +34 -0
  145. package/dist/esm/excel/pivot-table-parser.d.ts +8 -0
  146. package/dist/esm/excel/pivot-table-parser.js +8 -0
  147. package/dist/esm/excel/print-model.d.ts +56 -0
  148. package/dist/esm/excel/print-model.js +43 -0
  149. package/dist/esm/excel/shared-strings-parser.d.ts +13 -0
  150. package/dist/esm/excel/shared-strings-parser.js +5 -0
  151. package/dist/esm/excel/sheet-drawing.d.ts +34 -0
  152. package/dist/esm/excel/sheet-drawing.js +21 -0
  153. package/dist/esm/excel/sheet-shape-parser.d.ts +12 -0
  154. package/dist/esm/excel/sheet-shape-parser.js +12 -0
  155. package/dist/esm/excel/sheet-to-flow.d.ts +19 -0
  156. package/dist/esm/excel/sheet-to-flow.js +10 -0
  157. package/dist/esm/excel/slicer-parser.d.ts +23 -0
  158. package/dist/esm/excel/slicer-parser.js +10 -0
  159. package/dist/esm/excel/styles-parser.d.ts +8 -0
  160. package/dist/esm/excel/styles-parser.js +8 -0
  161. package/dist/esm/excel/table-parser.d.ts +24 -0
  162. package/dist/esm/excel/table-parser.js +5 -0
  163. package/dist/esm/excel/workbook-parser.d.ts +17 -0
  164. package/dist/esm/excel/workbook-parser.js +5 -0
  165. package/dist/esm/excel/worksheet-parser.d.ts +9 -0
  166. package/dist/esm/excel/worksheet-parser.js +9 -0
  167. package/dist/esm/excel/xls/biff-chart.d.ts +10 -0
  168. package/dist/esm/excel/xls/biff-chart.js +10 -0
  169. package/dist/esm/excel/xls/biff-reader.d.ts +27 -0
  170. package/dist/esm/excel/xls/biff-reader.js +44 -0
  171. package/dist/esm/excel/xls/biff-styles.d.ts +20 -0
  172. package/dist/esm/excel/xls/biff-styles.js +20 -0
  173. package/dist/esm/excel/xls/escher.d.ts +27 -0
  174. package/dist/esm/excel/xls/escher.js +18 -0
  175. package/dist/esm/excel/xls/xls-reader.d.ts +6 -0
  176. package/dist/esm/excel/xls/xls-reader.js +6 -0
  177. package/dist/esm/excel/xlsx-reader.d.ts +26 -0
  178. package/dist/esm/excel/xlsx-reader.js +26 -0
  179. package/dist/esm/excel/xlsx-to-pdf.d.ts +27 -0
  180. package/dist/esm/excel/xlsx-writer.d.ts +14 -0
  181. package/dist/esm/excel/xlsx-writer.js +13 -0
  182. package/dist/esm/html/html-writer.d.ts +18 -0
  183. package/dist/esm/html/html-writer.js +18 -0
  184. package/dist/esm/index.d.ts +23 -0
  185. package/dist/esm/layout/math-layout.d.ts +39 -0
  186. package/dist/esm/layout/math-layout.js +18 -0
  187. package/dist/esm/layout/page-doc.d.ts +91 -0
  188. package/dist/esm/layout/styled-layout.d.ts +175 -0
  189. package/dist/esm/layout/styled-layout.js +117 -2
  190. package/dist/esm/pdf/builtin-fonts.d.ts +5 -0
  191. package/dist/esm/pdf/cid-font.d.ts +22 -0
  192. package/dist/esm/pdf/cid-font.js +10 -0
  193. package/dist/esm/pdf/embedded-file.d.ts +16 -0
  194. package/dist/esm/pdf/embedded-file.js +9 -0
  195. package/dist/esm/pdf/encryption.d.ts +59 -0
  196. package/dist/esm/pdf/encryption.js +37 -0
  197. package/dist/esm/pdf/icc-profile.d.ts +8 -0
  198. package/dist/esm/pdf/icc-profile.js +8 -0
  199. package/dist/esm/pdf/image-xobject.d.ts +19 -0
  200. package/dist/esm/pdf/image-xobject.js +9 -0
  201. package/dist/esm/pdf/objects.d.ts +40 -0
  202. package/dist/esm/pdf/objects.js +36 -0
  203. package/dist/esm/pdf/serialize.d.ts +18 -0
  204. package/dist/esm/pdf/serialize.js +18 -0
  205. package/dist/esm/pdf/shading.d.ts +16 -0
  206. package/dist/esm/pdf/shading.js +16 -0
  207. package/dist/esm/pdf/signature.d.ts +36 -0
  208. package/dist/esm/pdf/signature.js +22 -0
  209. package/dist/esm/pdf/struct-tree.d.ts +64 -0
  210. package/dist/esm/pdf/struct-tree.js +60 -0
  211. package/dist/esm/pdf/styled-page-emitter.d.ts +33 -0
  212. package/dist/esm/pdf/styled-page-emitter.js +21 -0
  213. package/dist/esm/pdf/styled-page-renderer.d.ts +18 -0
  214. package/dist/esm/pdf/styled-page-renderer.js +18 -0
  215. package/dist/esm/pdf/text-encoding.d.ts +16 -0
  216. package/dist/esm/pdf/text-page-renderer.d.ts +11 -0
  217. package/dist/esm/pdf/vector-graphics.d.ts +12 -0
  218. package/dist/esm/pdf/vector-graphics.js +12 -0
  219. package/dist/esm/pdf/writer.d.ts +39 -0
  220. package/dist/esm/pdf/writer.js +27 -0
  221. package/dist/esm/pdf/xmp.d.ts +16 -0
  222. package/dist/esm/pdf/xmp.js +9 -0
  223. package/dist/esm/pdf-reader/ccitt.d.ts +25 -0
  224. package/dist/esm/pdf-reader/ccitt.js +15 -0
  225. package/dist/esm/pdf-reader/cmap.d.ts +12 -0
  226. package/dist/esm/pdf-reader/cmap.js +9 -0
  227. package/dist/esm/pdf-reader/content.d.ts +69 -0
  228. package/dist/esm/pdf-reader/content.js +16 -0
  229. package/dist/esm/pdf-reader/crypto.d.ts +5 -0
  230. package/dist/esm/pdf-reader/crypto.js +5 -0
  231. package/dist/esm/pdf-reader/decrypt.d.ts +17 -0
  232. package/dist/esm/pdf-reader/decrypt.js +12 -0
  233. package/dist/esm/pdf-reader/document.d.ts +53 -0
  234. package/dist/esm/pdf-reader/document.js +50 -0
  235. package/dist/esm/pdf-reader/flow-build.d.ts +51 -2
  236. package/dist/esm/pdf-reader/flow-build.js +67 -2
  237. package/dist/esm/pdf-reader/font.d.ts +12 -0
  238. package/dist/esm/pdf-reader/font.js +12 -0
  239. package/dist/esm/pdf-reader/image-decode.d.ts +21 -0
  240. package/dist/esm/pdf-reader/image-decode.js +14 -0
  241. package/dist/esm/pdf-reader/images.d.ts +19 -0
  242. package/dist/esm/pdf-reader/images.js +9 -0
  243. package/dist/esm/pdf-reader/layout.d.ts +15 -0
  244. package/dist/esm/pdf-reader/layout.js +17 -2
  245. package/dist/esm/pdf-reader/lexer.d.ts +43 -0
  246. package/dist/esm/pdf-reader/lexer.js +38 -0
  247. package/dist/esm/pdf-reader/parser.d.ts +15 -0
  248. package/dist/esm/pdf-reader/parser.js +8 -0
  249. package/dist/esm/pdf-reader/png-encode.d.ts +9 -0
  250. package/dist/esm/pdf-reader/png-encode.js +8 -0
  251. package/dist/esm/pdf-reader/predictor.d.ts +9 -0
  252. package/dist/esm/pdf-reader/predictor.js +8 -0
  253. package/dist/esm/pdf-reader/reader.d.ts +16 -0
  254. package/dist/esm/pdf-reader/reader.js +16 -0
  255. package/dist/esm/pdf-reader/shading.d.ts +10 -0
  256. package/dist/esm/pdf-reader/shading.js +10 -0
  257. package/dist/esm/pdf-reader/struct-tree.d.ts +24 -0
  258. package/dist/esm/pdf-reader/struct-tree.js +12 -0
  259. package/dist/esm/pdf-reader/tagged.d.ts +13 -0
  260. package/dist/esm/pdf-reader/tagged.js +15 -2
  261. package/dist/esm/pdf-reader/text.d.ts +11 -0
  262. package/dist/esm/pdf-reader/text.js +11 -0
  263. package/dist/esm/pdf-reader/vector.d.ts +19 -0
  264. package/dist/esm/pdf-reader/vector.js +9 -0
  265. package/dist/esm/pptx/placeholder-cascade.d.ts +21 -0
  266. package/dist/esm/pptx/placeholder-cascade.js +10 -0
  267. package/dist/esm/pptx/ppt/ppt-reader.d.ts +16 -0
  268. package/dist/esm/pptx/ppt/ppt-reader.js +16 -0
  269. package/dist/esm/pptx/ppt/ppt-text.d.ts +55 -0
  270. package/dist/esm/pptx/ppt/ppt-text.js +14 -0
  271. package/dist/esm/pptx/pptx-reader.d.ts +21 -0
  272. package/dist/esm/pptx/pptx-reader.js +37 -1
  273. package/dist/esm/pptx/slide-parser.d.ts +102 -0
  274. package/dist/esm/pptx/slide-parser.js +78 -0
  275. package/dist/esm/pptx/sp-helpers.d.ts +28 -0
  276. package/dist/esm/pptx/sp-helpers.js +22 -0
  277. package/dist/esm/svg/svg-writer.d.ts +17 -0
  278. package/dist/esm/svg/svg-writer.js +16 -0
  279. package/dist/esm/word/doc/doc-reader.d.ts +16 -0
  280. package/dist/esm/word/doc/doc-reader.js +26 -4
  281. package/dist/esm/word/doc/doc-text.d.ts +81 -0
  282. package/dist/esm/word/doc/doc-text.js +38 -0
  283. package/dist/esm/word/document-parser.d.ts +134 -0
  284. package/dist/esm/word/document-parser.js +86 -0
  285. package/dist/esm/word/docx-reader.d.ts +16 -0
  286. package/dist/esm/word/docx-reader.js +16 -0
  287. package/dist/esm/word/docx-to-pdf.d.ts +52 -0
  288. package/dist/esm/word/docx-to-pdf.js +21 -0
  289. package/dist/esm/word/docx-writer.d.ts +17 -0
  290. package/dist/esm/word/docx-writer.js +17 -0
  291. package/dist/esm/word/drawing-parser.d.ts +88 -0
  292. package/dist/esm/word/drawing-parser.js +68 -0
  293. package/dist/esm/word/font-table.d.ts +24 -0
  294. package/dist/esm/word/font-table.js +24 -0
  295. package/dist/esm/word/numbering-parser.d.ts +11 -0
  296. package/dist/esm/word/numbering-parser.js +11 -0
  297. package/dist/esm/word/omml-parser.d.ts +15 -0
  298. package/dist/esm/word/omml-parser.js +15 -0
  299. package/dist/esm/word/omml-serializer.d.ts +9 -0
  300. package/dist/esm/word/omml-serializer.js +9 -0
  301. package/dist/esm/word/paragraph-properties.d.ts +10 -0
  302. package/dist/esm/word/paragraph-properties.js +10 -0
  303. package/dist/esm/word/po-to-flat.d.ts +11 -0
  304. package/dist/esm/word/po-to-flat.js +11 -0
  305. package/dist/esm/word/run-properties.d.ts +10 -0
  306. package/dist/esm/word/run-properties.js +10 -0
  307. package/dist/esm/word/settings-parser.d.ts +13 -0
  308. package/dist/esm/word/settings-parser.js +8 -0
  309. package/dist/esm/word/styles-parser.d.ts +10 -0
  310. package/dist/esm/word/styles-parser.js +10 -0
  311. package/dist/esm/word/table-parser.d.ts +11 -0
  312. package/dist/esm/word/table-parser.js +11 -0
  313. package/dist/esm/word/text-extractor.d.ts +9 -0
  314. package/dist/esm/word/xml-helpers.d.ts +44 -0
  315. package/dist/esm/word/xml-helpers.js +38 -0
  316. package/package.json +1 -1
@@ -1,11 +1,24 @@
1
1
  import { pt } from "../core/ir/units.js";
2
2
  import { ResourceStore } from "../core/ir/resources.js";
3
- import { buildFlowDoc, dedupeLosses, imageBlock, paragraphBlock, paragraphFromRuns } from "./flow-build.js";
3
+ import { buildFlowDoc, dedupeLosses, imageBlock, paragraphBlock, paragraphFromRuns, sectionFromPdfPages } from "./flow-build.js";
4
4
  import { collectPageImages } from "./images.js";
5
5
  import { extractPageText } from "./text.js";
6
6
  import { readStructTree } from "./struct-tree.js";
7
7
  //#region src/pdf-reader/tagged.ts
8
8
  var ASSUMED_CONTENT_WIDTH_PT = 468;
9
+ /**
10
+ * Reconstruct a {@link Reconstruction} from a tagged PDF's logical structure
11
+ * (E-PDF EP3 — the honest inverse of the tagged PDF Ream writes). Walks the
12
+ * structure tree ({@link readStructTree}), pulls each element's text from the
13
+ * per-page MCID → text map the content interpreter produced (EP2), and rebuilds
14
+ * headings (`H1`–`H6` → outline level), paragraphs, tables (`Table` → `TR` →
15
+ * `TH`/`TD`), list items (each `LI` → label + body) and figures (EP6 — each
16
+ * `/Figure`'s MCID resolves to a lifted image carrying its `/Alt`). Images no
17
+ * `/Figure` claims are appended in page + top-down order so nothing is lost.
18
+ *
19
+ * @returns The reconstructed document and image losses, or `undefined` when the
20
+ * PDF carries no structure tree or yields no body content.
21
+ */
9
22
  function reconstructTaggedPdf(file) {
10
23
  const root = readStructTree(file);
11
24
  if (!root) return void 0;
@@ -126,7 +139,7 @@ function reconstructTaggedPdf(file) {
126
139
  for (const { img } of orphans) body.push(imageBlock(img, resources));
127
140
  if (body.length === 0) return void 0;
128
141
  return {
129
- doc: buildFlowDoc(body, resources),
142
+ doc: buildFlowDoc(body, resources, sectionFromPdfPages(pages)),
130
143
  losses: imageLosses
131
144
  };
132
145
  }
@@ -1,3 +1,14 @@
1
1
  import { TextRun } from './content.js';
2
2
  import { PdfFile, PdfPage } from './document.js';
3
+ /**
4
+ * Extract a page's text as positioned {@link TextRun}s (E-PDF EP2/EP8/EP13).
5
+ * Interprets the page content stream and, recursively, the Form XObjects it
6
+ * paints (EP13 — their text would otherwise be missed), then tags any run whose
7
+ * origin falls inside a `/Link` annotation's `/Rect` with that link's URI (EP8)
8
+ * so hyperlinks survive.
9
+ *
10
+ * @param file The owning {@link PdfFile}.
11
+ * @param page The page to extract.
12
+ * @returns The page's runs, each carrying an `href` when it sits under a link.
13
+ */
3
14
  export declare function extractPageText(file: PdfFile, page: PdfPage): Array<TextRun>;
@@ -3,6 +3,17 @@ import { IDENTITY, interpretContent, multiply } from "./content.js";
3
3
  import { buildContentFont } from "./font.js";
4
4
  //#region src/pdf-reader/text.ts
5
5
  var MAX_FORM_DEPTH = 8;
6
+ /**
7
+ * Extract a page's text as positioned {@link TextRun}s (E-PDF EP2/EP8/EP13).
8
+ * Interprets the page content stream and, recursively, the Form XObjects it
9
+ * paints (EP13 — their text would otherwise be missed), then tags any run whose
10
+ * origin falls inside a `/Link` annotation's `/Rect` with that link's URI (EP8)
11
+ * so hyperlinks survive.
12
+ *
13
+ * @param file The owning {@link PdfFile}.
14
+ * @param page The page to extract.
15
+ * @returns The page's runs, each carrying an `href` when it sits under a link.
16
+ */
6
17
  function extractPageText(file, page) {
7
18
  const runs = [];
8
19
  collectRuns(file, page.resources, file.pageContent(page), IDENTITY, 0, /* @__PURE__ */ new Set(), runs);
@@ -1,11 +1,21 @@
1
1
  import { PathSeg } from './content.js';
2
2
  import { ShapeGradient } from '../core/vector.js';
3
3
  import { PdfFile, PdfPage } from './document.js';
4
+ /**
5
+ * One painted vector path lifted off a page (E-PDF EP10/EP11/EP16c): the path
6
+ * segments, whichever of solid fill / gradient fill / stroke survived the
7
+ * de-cluttering filter, and the path's page-space bounding box plus enclosing
8
+ * marked-content id.
9
+ */
4
10
  export interface PdfVector {
5
11
  readonly segs: ReadonlyArray<PathSeg>;
12
+ /** Present iff a qualifying solid fill survived (EP10). */
6
13
  readonly fillHex?: string;
14
+ /** Present iff a shading-pattern fill survived (EP16c). */
7
15
  readonly gradient?: ShapeGradient;
16
+ /** Present iff a qualifying stroke survived (EP11). */
8
17
  readonly strokeHex?: string;
18
+ /** Stroke width in page-space points (EP11). */
9
19
  readonly lineWidth?: number;
10
20
  readonly minX: number;
11
21
  readonly minY: number;
@@ -13,4 +23,13 @@ export interface PdfVector {
13
23
  readonly maxY: number;
14
24
  readonly mcid?: number;
15
25
  }
26
+ /**
27
+ * Lift the painted vector paths off a page (E-PDF EP10/EP11/EP16c). Runs the
28
+ * content interpreter for its fill (EP10), stroke (EP11) and shading-pattern
29
+ * (EP16c) placements and keeps only the ones that read as real graphics:
30
+ * hairline/degenerate fills, invisible white paint, short stroke specks and the
31
+ * near-full-page background are all dropped, so a reconstructed document gains
32
+ * genuine coloured shapes, lines and gradients without the dot / page-background
33
+ * clutter. Clips and the bare `sh` operator are not captured (a documented loss).
34
+ */
16
35
  export declare function collectPageVectors(file: PdfFile, page: PdfPage): Array<PdfVector>;
@@ -6,6 +6,15 @@ var MIN_SIDE = 2;
6
6
  var MIN_AREA = 16;
7
7
  var MIN_STROKE_LEN = 6;
8
8
  var MAX_VECTORS = 2e3;
9
+ /**
10
+ * Lift the painted vector paths off a page (E-PDF EP10/EP11/EP16c). Runs the
11
+ * content interpreter for its fill (EP10), stroke (EP11) and shading-pattern
12
+ * (EP16c) placements and keeps only the ones that read as real graphics:
13
+ * hairline/degenerate fills, invisible white paint, short stroke specks and the
14
+ * near-full-page background are all dropped, so a reconstructed document gains
15
+ * genuine coloured shapes, lines and gradients without the dot / page-background
16
+ * clutter. Clips and the bare `sh` operator are not captured (a documented loss).
17
+ */
9
18
  function collectPageVectors(file, page) {
10
19
  const [px0, py0, px1, py1] = page.mediaBox;
11
20
  const pageArea = Math.max(1, Math.abs((px1 - px0) * (py1 - py0)));
@@ -2,8 +2,29 @@ import { RunProperties } from '../core/document-model/index.js';
2
2
  import { ColorResolver } from '../core/drawingml/colors.js';
3
3
  import { PoNode } from '../core/po-helpers.js';
4
4
  import { PlaceholderRef, ShapeBoxEmu } from './sp-helpers.js';
5
+ /**
6
+ * The placeholder cascade (PX2): the resolver a slide parser consults whenever a
7
+ * slide placeholder shape (`p:sp` with a `p:ph`) lacks its own geometry or run
8
+ * formatting, supplying the inherited values from the slide's layout, then its
9
+ * master.
10
+ */
5
11
  export interface PlaceholderCascade {
12
+ /** The inherited EMU box for a slide placeholder without its own `a:xfrm`. */
6
13
  readonly geometryFor: (ph: PlaceholderRef) => ShapeBoxEmu | undefined;
14
+ /**
15
+ * The master's default run formatting for a placeholder's paragraph at the
16
+ * given 0-based outline level (empty when no master text styles apply).
17
+ */
7
18
  readonly defaultsFor: (ph: PlaceholderRef, level: number) => RunProperties;
8
19
  }
20
+ /**
21
+ * Build a {@link PlaceholderCascade} from a slide's already-parsed layout and
22
+ * master trees: it resolves a placeholder's inherited geometry (the layout's
23
+ * matching `a:xfrm`, else the master's) and per-level default run formatting (the
24
+ * master's `p:txStyles`).
25
+ *
26
+ * @param layoutTree The parsed `p:sldLayout` part.
27
+ * @param masterTree The parsed `p:sldMaster` part, when present.
28
+ * @param colors The deck's colour resolver, for scheme colours in the text styles.
29
+ */
9
30
  export declare function buildPlaceholderCascade(layoutTree: ReadonlyArray<PoNode>, masterTree: ReadonlyArray<PoNode> | undefined, colors: ColorResolver): PlaceholderCascade;
@@ -6,6 +6,16 @@ function categoryOf(type) {
6
6
  if (type === void 0 || type === "body" || type === "subTitle" || type === "obj") return "body";
7
7
  return "other";
8
8
  }
9
+ /**
10
+ * Build a {@link PlaceholderCascade} from a slide's already-parsed layout and
11
+ * master trees: it resolves a placeholder's inherited geometry (the layout's
12
+ * matching `a:xfrm`, else the master's) and per-level default run formatting (the
13
+ * master's `p:txStyles`).
14
+ *
15
+ * @param layoutTree The parsed `p:sldLayout` part.
16
+ * @param masterTree The parsed `p:sldMaster` part, when present.
17
+ * @param colors The deck's colour resolver, for scheme colours in the text styles.
18
+ */
9
19
  function buildPlaceholderCascade(layoutTree, masterTree, colors) {
10
20
  const layoutPhs = collectPlaceholders(layoutTree, "p:sldLayout");
11
21
  const masterPhs = masterTree ? collectPlaceholders(masterTree, "p:sldMaster") : [];
@@ -1,4 +1,20 @@
1
1
  import { DocumentReader, ReadResult } from '../../core/ir/adapters.js';
2
2
  import { FlowDoc } from '../../core/ir/flow.js';
3
+ /**
4
+ * Read a legacy `.ppt` (PowerPoint 97–2003 OLE2/CFB) into the same
5
+ * {@link FlowDoc} the OOXML pptx reader produces: one page per slide at the deck
6
+ * size, with each slide's text (run + paragraph formatting), embedded images,
7
+ * per-shape placement and decorative autoshapes. Always reports a single
8
+ * {@link Loss} — degraded (the format is read best-effort; re-save as `.pptx` for
9
+ * full fidelity), or dropped when the file is encrypted/obfuscated.
10
+ *
11
+ * @param bytes The raw `.ppt` (CFB) bytes.
12
+ * @returns The {@link FlowDoc} plus the one-element loss report.
13
+ */
3
14
  export declare function readPpt(bytes: Uint8Array): ReadResult<FlowDoc>;
15
+ /**
16
+ * The {@link DocumentReader} for legacy `.ppt`: sniffs an OLE2/CFB container with
17
+ * a `PowerPoint Document` stream (which also keeps an `.xls`/`.doc` or an
18
+ * encrypted OOXML from mis-routing here) and reads it via {@link readPpt}.
19
+ */
4
20
  export declare const pptReader: DocumentReader<FlowDoc>;
@@ -29,6 +29,17 @@ var PPT_ENCRYPTED_LOSS = {
29
29
  feature: FEATURES.text,
30
30
  detail: "legacy .ppt is encrypted/obfuscated — its text cannot be read"
31
31
  };
32
+ /**
33
+ * Read a legacy `.ppt` (PowerPoint 97–2003 OLE2/CFB) into the same
34
+ * {@link FlowDoc} the OOXML pptx reader produces: one page per slide at the deck
35
+ * size, with each slide's text (run + paragraph formatting), embedded images,
36
+ * per-shape placement and decorative autoshapes. Always reports a single
37
+ * {@link Loss} — degraded (the format is read best-effort; re-save as `.pptx` for
38
+ * full fidelity), or dropped when the file is encrypted/obfuscated.
39
+ *
40
+ * @param bytes The raw `.ppt` (CFB) bytes.
41
+ * @returns The {@link FlowDoc} plus the one-element loss report.
42
+ */
32
43
  function readPpt(bytes) {
33
44
  const content = extractPptContent(bytes);
34
45
  const width = pt(content.slideWidthPt ?? DEFAULT_SLIDE_W);
@@ -326,6 +337,11 @@ function anchorParagraph(breakBefore) {
326
337
  }
327
338
  };
328
339
  }
340
+ /**
341
+ * The {@link DocumentReader} for legacy `.ppt`: sniffs an OLE2/CFB container with
342
+ * a `PowerPoint Document` stream (which also keeps an `.xls`/`.doc` or an
343
+ * encrypted OOXML from mis-routing here) and reads it via {@link readPpt}.
344
+ */
329
345
  var pptReader = {
330
346
  id: "ppt",
331
347
  produces: "flow",
@@ -1,25 +1,45 @@
1
+ /** A run of uniformly-formatted text within a paragraph (PPT-2). */
1
2
  export interface PptRun {
2
3
  readonly text: string;
3
4
  readonly bold?: boolean;
4
5
  readonly italic?: boolean;
5
6
  readonly underline?: boolean;
7
+ /** The font size in points, when set on the run. */
6
8
  readonly sizePt?: number;
9
+ /** The run colour as 6-hex RGB (no `#`), when an explicit sRGB colour is set. */
7
10
  readonly colorHex?: string;
8
11
  }
12
+ /**
13
+ * One slide paragraph: its runs plus the raw PPT alignment enum (0 left, 1
14
+ * center, 2 right, 3 justify, 4 distribute) and indent level (0–4), mapped by the
15
+ * reader.
16
+ */
9
17
  export interface PptParagraph {
10
18
  readonly runs: ReadonlyArray<PptRun>;
19
+ /** The raw PowerPoint TextAlignmentEnum (mapped to a document-model alignment by the reader). */
11
20
  readonly align?: number;
21
+ /** The 0-based outline/indent level. */
12
22
  readonly level?: number;
13
23
  }
24
+ /**
25
+ * An embedded picture referenced by a slide shape — the raw image bytes pulled
26
+ * from the Pictures stream (PPT-3).
27
+ */
14
28
  export interface PptImage {
15
29
  readonly bytes: Uint8Array;
16
30
  }
31
+ /** A shape's rectangle on the slide, in points (from the OfficeArtClientAnchor). */
17
32
  export interface PptRect {
18
33
  readonly x: number;
19
34
  readonly y: number;
20
35
  readonly w: number;
21
36
  readonly h: number;
22
37
  }
38
+ /**
39
+ * One command of a freeform path (PPT-7), in geometry-bounds space
40
+ * (`0..pathWidth`, `0..pathHeight`, y down) — the same path-space the DrawingML
41
+ * custom geometry uses.
42
+ */
23
43
  export type PptPathCmd = {
24
44
  readonly kind: 'move';
25
45
  readonly x: number;
@@ -39,31 +59,66 @@ export type PptPathCmd = {
39
59
  } | {
40
60
  readonly kind: 'close';
41
61
  };
62
+ /**
63
+ * A shape's exact custom geometry (PPT-7): the freeform path from the OPT's
64
+ * `pVertices` + `pSegmentInfo` arrays, in its geometry-bounds coordinate space.
65
+ */
42
66
  export interface PptCustomGeometry {
43
67
  readonly pathWidth: number;
44
68
  readonly pathHeight: number;
45
69
  readonly commands: ReadonlyArray<PptPathCmd>;
46
70
  }
71
+ /**
72
+ * A decorative autoshape (PPT-5): its preset type plus any literal fill / line
73
+ * colour. Carried only by an anchored shape that has no text and no picture. A
74
+ * freeform additionally carries its exact custom geometry (PPT-7).
75
+ */
47
76
  export interface PptAutoShape {
77
+ /** The MSOSPT shape type (the FSP `recInstance`). */
48
78
  readonly shapeType: number;
79
+ /** The resolved fill colour as 6-hex RGB, when present. */
49
80
  readonly fillColorHex?: string;
81
+ /** The resolved line colour as 6-hex RGB, when present. */
50
82
  readonly lineColorHex?: string;
51
83
  readonly geometry?: PptCustomGeometry;
52
84
  }
85
+ /**
86
+ * One slide shape (PPT-4..5): its text, picture and/or autoshape geometry, plus
87
+ * its slide rectangle when the shape carries an explicit anchor (else it is laid
88
+ * out in reading order).
89
+ */
53
90
  export interface PptShape {
54
91
  readonly rectPt?: PptRect;
55
92
  readonly paragraphs?: ReadonlyArray<PptParagraph>;
56
93
  readonly image?: PptImage;
57
94
  readonly autoShape?: PptAutoShape;
58
95
  }
96
+ /** One slide: its shapes in document order. */
59
97
  export interface PptSlide {
60
98
  readonly shapes: ReadonlyArray<PptShape>;
61
99
  }
100
+ /** The extracted content of a `.ppt`: its slides, deck page size and encryption flag. */
62
101
  export interface PptContent {
63
102
  readonly slides: ReadonlyArray<PptSlide>;
103
+ /** The deck page size in points, when the DocumentAtom gives a sane slide size. */
64
104
  readonly slideWidthPt?: number;
65
105
  readonly slideHeightPt?: number;
106
+ /** Whether the document streams are encrypted/obfuscated (so no text can be read). */
66
107
  readonly encrypted: boolean;
67
108
  }
109
+ /**
110
+ * Walk a `.ppt` (CFB) into its {@link PptContent}: reads the `Current User`
111
+ * stream for the latest edit (and the encryption token), walks the edit chain to
112
+ * a persist directory, resolves the DocumentContainer and its slide list, and
113
+ * reads each slide's shapes/text/pictures. Degrades gracefully — when the
114
+ * persist/document structure can't be resolved it falls back to scanning the
115
+ * stream for slide containers directly, and structural doubt yields missing
116
+ * content, never wrong content. An encrypted file returns no slides with
117
+ * `encrypted: true`.
118
+ *
119
+ * @param bytes The raw `.ppt` (CFB) bytes.
120
+ * @returns The slides, deck size and encryption flag (empty when not a readable `.ppt`).
121
+ */
68
122
  export declare function extractPptContent(bytes: Uint8Array): PptContent;
123
+ /** The concatenated plain text of a paragraph's runs. */
69
124
  export declare function paragraphText(p: PptParagraph): string;
@@ -66,6 +66,19 @@ function* records(d) {
66
66
  off += consumed;
67
67
  }
68
68
  }
69
+ /**
70
+ * Walk a `.ppt` (CFB) into its {@link PptContent}: reads the `Current User`
71
+ * stream for the latest edit (and the encryption token), walks the edit chain to
72
+ * a persist directory, resolves the DocumentContainer and its slide list, and
73
+ * reads each slide's shapes/text/pictures. Degrades gracefully — when the
74
+ * persist/document structure can't be resolved it falls back to scanning the
75
+ * stream for slide containers directly, and structural doubt yields missing
76
+ * content, never wrong content. An encrypted file returns no slides with
77
+ * `encrypted: true`.
78
+ *
79
+ * @param bytes The raw `.ppt` (CFB) bytes.
80
+ * @returns The slides, deck size and encryption flag (empty when not a readable `.ppt`).
81
+ */
69
82
  function extractPptContent(bytes) {
70
83
  const empty = {
71
84
  slides: [],
@@ -549,6 +562,7 @@ function matchesMagic(d, off, magic) {
549
562
  for (let i = 0; i < magic.length; i++) if (d[off + i] !== magic[i]) return false;
550
563
  return true;
551
564
  }
565
+ /** The concatenated plain text of a paragraph's runs. */
552
566
  function paragraphText(p) {
553
567
  return p.runs.map((r) => r.text).join("");
554
568
  }
@@ -1,6 +1,27 @@
1
1
  import { DocumentReader, ReadResult } from '../core/ir/adapters.js';
2
2
  import { FlowDoc } from '../core/ir/flow.js';
3
3
  import { PoNode } from '../core/po-helpers.js';
4
+ /**
5
+ * Read a PresentationML (`.pptx`) package into a {@link FlowDoc}: one page per
6
+ * slide at the deck size (`p:sldSz`), each slide's shapes placed as absolutely
7
+ * positioned floating elements. Hidden slides (`p:sld@show="0"`) are omitted (and
8
+ * recorded as a {@link Loss}, mirroring PowerPoint/LibreOffice export). Resolves
9
+ * each slide's layout → master → theme chain into the placeholder cascade, colour
10
+ * resolver and inherited background, plus its images and charts.
11
+ *
12
+ * @param bytes The raw `.pptx` (OPC ZIP) bytes.
13
+ * @returns The {@link FlowDoc} plus the accumulated loss report.
14
+ */
4
15
  export declare function readPptx(bytes: Uint8Array): ReadResult<FlowDoc>;
16
+ /**
17
+ * Parse an OOXML part's bytes into preserve-order {@link PoNode} roots with the
18
+ * module's shared, presentation-tuned {@link XMLParser} (attributes kept, values
19
+ * not coerced, whitespace preserved). Shared with the slide-style resolvers.
20
+ */
5
21
  export declare function parseXml(data: Uint8Array): Array<PoNode>;
22
+ /**
23
+ * The {@link DocumentReader} for PresentationML (`.pptx`): sniffs the OPC ZIP for
24
+ * `ppt/presentation.xml` (a cheap substring probe, no unzip) and reads it via
25
+ * {@link readPptx}.
26
+ */
6
27
  export declare const pptxReader: DocumentReader<FlowDoc>;
@@ -26,6 +26,21 @@ var parser = new XMLParser({
26
26
  parseTagValue: false,
27
27
  trimValues: false
28
28
  });
29
+ function isSlideHidden(data) {
30
+ const root = decoder.decode(data.subarray(0, 4096)).match(/<p:sld\b[^>]*>/);
31
+ return root ? /\bshow\s*=\s*["']0["']/.test(root[0]) : false;
32
+ }
33
+ /**
34
+ * Read a PresentationML (`.pptx`) package into a {@link FlowDoc}: one page per
35
+ * slide at the deck size (`p:sldSz`), each slide's shapes placed as absolutely
36
+ * positioned floating elements. Hidden slides (`p:sld@show="0"`) are omitted (and
37
+ * recorded as a {@link Loss}, mirroring PowerPoint/LibreOffice export). Resolves
38
+ * each slide's layout → master → theme chain into the placeholder cascade, colour
39
+ * resolver and inherited background, plus its images and charts.
40
+ *
41
+ * @param bytes The raw `.pptx` (OPC ZIP) bytes.
42
+ * @returns The {@link FlowDoc} plus the accumulated loss report.
43
+ */
29
44
  function readPptx(bytes) {
30
45
  const losses = [];
31
46
  const pkg = OpcPackage.open(bytes);
@@ -45,12 +60,23 @@ function readPptx(bytes) {
45
60
  const slideRelById = new Map(pkg.getPartRelationships(presPath).filter((r) => r.type.endsWith("/slide")).map((r) => [r.id, r]));
46
61
  const lst = kids.find((c) => poIs(c, "p:sldIdLst"));
47
62
  const ids = lst ? poChildren(lst).filter((c) => poIs(c, "p:sldId")) : [];
63
+ let hidden = 0;
48
64
  for (const sldId of ids) {
49
65
  const rid = poAttr(sldId, "r:id");
50
66
  const rel = rid !== void 0 ? slideRelById.get(rid) : void 0;
51
67
  const part = rel ? pkg.resolveRelatedPart(presPath, rel) : void 0;
52
- if (part) slideParts.push(part);
68
+ if (!part) continue;
69
+ if (isSlideHidden(part.data)) {
70
+ hidden++;
71
+ continue;
72
+ }
73
+ slideParts.push(part);
53
74
  }
75
+ if (hidden > 0) losses.push({
76
+ severity: "dropped",
77
+ feature: FEATURES.text,
78
+ detail: `${hidden} hidden slide(s) omitted (p:sld@show="0")`
79
+ });
54
80
  }
55
81
  if (slideParts.length === 0) losses.push({
56
82
  severity: "dropped",
@@ -118,6 +144,11 @@ function readPptx(bytes) {
118
144
  losses
119
145
  };
120
146
  }
147
+ /**
148
+ * Parse an OOXML part's bytes into preserve-order {@link PoNode} roots with the
149
+ * module's shared, presentation-tuned {@link XMLParser} (attributes kept, values
150
+ * not coerced, whitespace preserved). Shared with the slide-style resolvers.
151
+ */
121
152
  function parseXml(data) {
122
153
  return parser.parse(decoder.decode(data));
123
154
  }
@@ -223,6 +254,11 @@ function deckColorResolver(pkg, masterPath) {
223
254
  for (const [slot, hex] of parseTheme(theme.data)) palette.set(slot, hex);
224
255
  return makeColorResolver(palette);
225
256
  }
257
+ /**
258
+ * The {@link DocumentReader} for PresentationML (`.pptx`): sniffs the OPC ZIP for
259
+ * `ppt/presentation.xml` (a cheap substring probe, no unzip) and reads it via
260
+ * {@link readPptx}.
261
+ */
226
262
  var pptxReader = {
227
263
  id: "pptx",
228
264
  produces: "flow",
@@ -4,23 +4,125 @@ import { Loss, Pt, ResourceId } from '../core/ir/index.js';
4
4
  import { PoNode } from '../core/po-helpers.js';
5
5
  import { PlaceholderCascade } from './placeholder-cascade.js';
6
6
  import { PlaceholderRef, ShapeBoxEmu } from './sp-helpers.js';
7
+ /**
8
+ * Per-slide parsing context: the placeholder cascade (PX2), an image resolver
9
+ * that turns a slide-scoped relationship id (`a:blip @r:embed`) into a
10
+ * {@link ResourceId} (PX3a), and a chart resolver that parses a referenced chart
11
+ * part (`c:chart @r:id`) and returns its document-unique key (PX4a). All optional
12
+ * — a bare slide needs none.
13
+ */
7
14
  export interface SlideContext {
8
15
  readonly cascade?: PlaceholderCascade;
16
+ /** A slide-scoped blip relationship id (`a:blip @r:embed`) → a stored resource (PX3a). */
9
17
  readonly resolveImage?: (relId: string) => ResourceId | undefined;
18
+ /** A chart relationship id (`c:chart @r:id`) → its document-unique key (PX4a). */
10
19
  readonly resolveChart?: (relId: string) => string | undefined;
20
+ /**
21
+ * The deck's colour resolver (master theme palette, PX5); defaults to the
22
+ * Office palette when absent.
23
+ */
11
24
  readonly colors?: ColorResolver;
25
+ /** A run hyperlink (`a:hlinkClick @r:id`) → its external URL (PX6). */
12
26
  readonly resolveHyperlink?: (relId: string) => string | undefined;
27
+ /**
28
+ * A SmartArt data relationship (`dgm:relIds @r:dm`) → the diagram's pre-rendered
29
+ * drawing override (its `dsp:spTree`), or `undefined` when the file ships no
30
+ * override (E-SMARTART SA0).
31
+ */
13
32
  readonly resolveDiagram?: (relId: string) => PoNode | undefined;
33
+ /**
34
+ * Sink for graceful-degradation notices (E-SMARTART SA3): a SmartArt that
35
+ * declares a diagram but ships no drawing override records a dropped-feature
36
+ * {@link Loss} here rather than vanishing without a trace.
37
+ */
14
38
  readonly onLoss?: (loss: Loss) => void;
15
39
  }
16
40
  type LinkResolver = ((relId: string) => string | undefined) | undefined;
17
41
  type GroupTransform = (box: ShapeBoxEmu) => ShapeBoxEmu;
42
+ /**
43
+ * Walk a shape container (`p:spTree` or a `p:grpSp`), turning each `p:sp` into a
44
+ * floating text/graphic shape, each `p:pic` into a floating image, each
45
+ * `p:graphicFrame` into a chart/table, and recursing into nested `p:grpSp` groups
46
+ * (composing their transforms).
47
+ *
48
+ * @param container The shape container node.
49
+ * @param ctx The per-slide parsing context.
50
+ * @param transform Maps child-space boxes to the slide (identity at the top level).
51
+ * @returns The container's shapes as positioned {@link BodyElement}s.
52
+ */
18
53
  export declare function parseSlideShapes(container: PoNode, ctx?: SlideContext, transform?: GroupTransform): Array<BodyElement>;
54
+ /**
55
+ * The diagram's child shapes live in the spTree's own coordinate space
56
+ * (`dsp:grpSpPr/a:xfrm` `chOff`/`chExt`); map that onto a target box (the frame on
57
+ * a slide, or the inline/anchored box in docx). Usually the child space equals
58
+ * the box, so the scale is 1. Shared by pptx and docx (E-SMARTART).
59
+ *
60
+ * @param spTree The diagram drawing's `dsp:spTree`.
61
+ * @param frame The target box the diagram is placed into.
62
+ * @returns A transform mapping diagram-space boxes onto `frame`.
63
+ */
19
64
  export declare function diagramTransform(spTree: PoNode, frame: ShapeBoxEmu): GroupTransform;
65
+ /**
66
+ * A {@link Loss} for a SmartArt diagram that declares its data part but ships no
67
+ * pre-rendered drawing override (older files, or a generator that omitted the
68
+ * fallback). Ream renders the override rather than executing Office's layout
69
+ * engine, so without it the diagram can't be drawn — this records the gap as a
70
+ * dropped feature instead of letting it vanish. Shared by pptx and docx
71
+ * (E-SMARTART SA3).
72
+ *
73
+ * @param where Optional location tag for the loss report (e.g. `slide 3`).
74
+ */
20
75
  export declare function noDiagramOverrideLoss(where?: string): Loss;
76
+ /**
77
+ * Render a SmartArt drawing override (a `dsp:spTree`) into floating shapes. The
78
+ * `dsp:` wrapper holds an ordinary `a:` `spPr`/`txBody`, so the shared DrawingML
79
+ * readers apply unchanged. Shared by pptx and docx (E-SMARTART); diagrams carry
80
+ * no placeholder cascade.
81
+ *
82
+ * @param spTree The diagram drawing's `dsp:spTree`.
83
+ * @param transform Maps each shape's diagram-space box to the target space.
84
+ * @param makeFloat Anchors a box — page-relative for a slide, column/paragraph-
85
+ * relative for an inline docx diagram.
86
+ * @param colors The colour resolver for the shapes' fills/strokes/text.
87
+ * @param resolveLink A run hyperlink resolver, or `undefined`.
88
+ * @returns The diagram's visible shapes as positioned {@link ShapeBlock}s.
89
+ */
21
90
  export declare function parseDiagramDrawing(spTree: PoNode, transform: GroupTransform, makeFloat: (box: ShapeBoxEmu) => FloatAnchor, colors: ColorResolver, resolveLink: LinkResolver): Array<ShapeBlock>;
91
+ /**
92
+ * `p:bg` → the background fill, or `undefined` when none/unsupported. `p:bgPr`
93
+ * carries the fill directly (`a:solidFill`/`a:gradFill` — the same children
94
+ * `parseFill` reads; a picture background is not yet supported); `p:bgRef` (a
95
+ * theme fill-style index) is approximated by its colour child as a solid fill.
96
+ * Used for the slide's own background and the inherited layout/master one (PX5b).
97
+ */
22
98
  export declare function parseBackgroundFill(bg: PoNode, colors: ColorResolver): ShapeFill | undefined;
99
+ /**
100
+ * A full-slide backdrop element for a background fill: a rectangle covering the
101
+ * page, anchored behind the content (PX5b).
102
+ *
103
+ * @param fill The resolved background fill.
104
+ * @param widthPt The page width in points.
105
+ * @param heightPt The page height in points.
106
+ */
23
107
  export declare function backdropElement(fill: ShapeFill, widthPt: Pt, heightPt: Pt): BodyElement;
108
+ /**
109
+ * `p:spPr` geometry: `a:prstGeom` (preset) or `a:custGeom` (custom path), default
110
+ * rect. Exported for sheet shapes (E-SHEET W2), whose `xdr:spPr` carries the same
111
+ * `a:` children.
112
+ */
24
113
  export declare function parseGeometry(spPr: PoNode | undefined): ShapeGeometry;
114
+ /**
115
+ * `p:txBody` → {@link ShapeTextBody}. `a:bodyPr` carries the insets and the
116
+ * vertical anchor (PX6: anchor `t`/`ctr`/`b`). Exported for sheet shapes
117
+ * (E-SHEET W2) — like SmartArt, they pass no placeholder cascade, so runs use
118
+ * their direct `a:rPr` formatting.
119
+ *
120
+ * @param txBody The `p:txBody` node.
121
+ * @param ph The owning placeholder ref, when this is a placeholder shape.
122
+ * @param cascade The placeholder cascade supplying inherited run defaults.
123
+ * @param colors The colour resolver for run colours.
124
+ * @param resolveLink A run hyperlink resolver, or `undefined`.
125
+ * @returns The text body, or `undefined` when it holds no paragraphs.
126
+ */
25
127
  export declare function parseTxBody(txBody: PoNode, ph: PlaceholderRef | undefined, cascade: PlaceholderCascade | undefined, colors: ColorResolver, resolveLink: LinkResolver): ShapeTextBody | undefined;
26
128
  export {};