@cj-tech-master/excelts 9.4.2 → 9.5.0

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 (618) hide show
  1. package/dist/browser/index.browser.d.ts +8 -5
  2. package/dist/browser/index.browser.js +19 -1
  3. package/dist/browser/index.d.ts +4 -2
  4. package/dist/browser/index.js +9 -1
  5. package/dist/browser/modules/excel/chart/cache-populator.d.ts +49 -0
  6. package/dist/browser/modules/excel/chart/cache-populator.js +1171 -0
  7. package/dist/browser/modules/excel/chart/chart-api.d.ts +92 -0
  8. package/dist/browser/modules/excel/chart/chart-api.js +364 -0
  9. package/dist/browser/modules/excel/chart/chart-builder.d.ts +48 -0
  10. package/dist/browser/modules/excel/chart/chart-builder.js +2432 -0
  11. package/dist/browser/modules/excel/chart/chart-ex-builder.d.ts +36 -0
  12. package/dist/browser/modules/excel/chart/chart-ex-builder.js +903 -0
  13. package/dist/browser/modules/excel/chart/chart-ex-parser.d.ts +8 -0
  14. package/dist/browser/modules/excel/chart/chart-ex-parser.js +1205 -0
  15. package/dist/browser/modules/excel/chart/chart-ex-renderer.d.ts +187 -0
  16. package/dist/browser/modules/excel/chart/chart-ex-renderer.js +5352 -0
  17. package/dist/browser/modules/excel/chart/chart-ex-types.d.ts +531 -0
  18. package/dist/browser/modules/excel/chart/chart-ex-types.js +11 -0
  19. package/dist/browser/modules/excel/chart/chart-images.d.ts +78 -0
  20. package/dist/browser/modules/excel/chart/chart-images.js +363 -0
  21. package/dist/browser/modules/excel/chart/chart-presets.d.ts +392 -0
  22. package/dist/browser/modules/excel/chart/chart-presets.js +179 -0
  23. package/dist/browser/modules/excel/chart/chart-renderer.d.ts +550 -0
  24. package/dist/browser/modules/excel/chart/chart-renderer.js +6440 -0
  25. package/dist/browser/modules/excel/chart/chart-sidecar.d.ts +21 -0
  26. package/dist/browser/modules/excel/chart/chart-sidecar.js +427 -0
  27. package/dist/browser/modules/excel/chart/chart-utils.d.ts +306 -0
  28. package/dist/browser/modules/excel/chart/chart-utils.js +821 -0
  29. package/dist/browser/modules/excel/chart/chart.d.ts +504 -0
  30. package/dist/browser/modules/excel/chart/chart.js +1320 -0
  31. package/dist/browser/modules/excel/chart/glyph-rasterizer.d.ts +62 -0
  32. package/dist/browser/modules/excel/chart/glyph-rasterizer.js +658 -0
  33. package/dist/browser/modules/excel/chart/index.d.ts +54 -0
  34. package/dist/browser/modules/excel/chart/index.js +46 -0
  35. package/dist/browser/modules/excel/chart/install.d.ts +44 -0
  36. package/dist/browser/modules/excel/chart/install.js +91 -0
  37. package/dist/browser/modules/excel/chart/shape-properties.d.ts +156 -0
  38. package/dist/browser/modules/excel/chart/shape-properties.js +1557 -0
  39. package/dist/browser/modules/excel/chart/stroke-font.d.ts +36 -0
  40. package/dist/browser/modules/excel/chart/stroke-font.js +1556 -0
  41. package/dist/browser/modules/excel/chart/topojson.d.ts +98 -0
  42. package/dist/browser/modules/excel/chart/topojson.js +236 -0
  43. package/dist/browser/modules/excel/chart/types.d.ts +2559 -0
  44. package/dist/browser/modules/excel/chart/types.js +8 -0
  45. package/dist/browser/modules/excel/chart-host-registry.d.ts +157 -0
  46. package/dist/browser/modules/excel/chart-host-registry.js +90 -0
  47. package/dist/browser/modules/excel/chartsheet.d.ts +102 -0
  48. package/dist/browser/modules/excel/chartsheet.js +196 -0
  49. package/dist/browser/modules/excel/defined-names.d.ts +35 -0
  50. package/dist/browser/modules/excel/defined-names.js +44 -4
  51. package/dist/browser/modules/excel/errors.d.ts +6 -0
  52. package/dist/browser/modules/excel/errors.js +9 -0
  53. package/dist/browser/modules/excel/form-control.d.ts +6 -0
  54. package/dist/browser/modules/excel/form-control.js +17 -0
  55. package/dist/browser/modules/excel/image.js +12 -2
  56. package/dist/browser/modules/excel/pivot-chart.d.ts +7 -0
  57. package/dist/browser/modules/excel/pivot-chart.js +53 -0
  58. package/dist/browser/modules/excel/pivot-table.d.ts +55 -0
  59. package/dist/browser/modules/excel/pivot-table.js +35 -0
  60. package/dist/browser/modules/excel/range.js +5 -1
  61. package/dist/browser/modules/excel/sparkline/index.d.ts +7 -0
  62. package/dist/browser/modules/excel/sparkline/index.js +7 -0
  63. package/dist/browser/modules/excel/sparkline/sparkline.d.ts +206 -0
  64. package/dist/browser/modules/excel/sparkline/sparkline.js +750 -0
  65. package/dist/browser/modules/excel/stream/worksheet-writer.js +3 -2
  66. package/dist/browser/modules/excel/table.js +42 -6
  67. package/dist/browser/modules/excel/types.d.ts +72 -0
  68. package/dist/browser/modules/excel/utils/address.d.ts +18 -0
  69. package/dist/browser/modules/excel/utils/address.js +28 -0
  70. package/dist/browser/modules/excel/utils/drawing-utils.js +11 -6
  71. package/dist/browser/modules/excel/utils/guid.d.ts +15 -0
  72. package/dist/browser/modules/excel/utils/guid.js +35 -0
  73. package/dist/browser/modules/excel/utils/ooxml-paths.d.ts +74 -0
  74. package/dist/browser/modules/excel/utils/ooxml-paths.js +206 -9
  75. package/dist/browser/modules/excel/utils/ooxml-validator/check-chart-sidecar.d.ts +35 -0
  76. package/dist/browser/modules/excel/utils/ooxml-validator/check-chart-sidecar.js +101 -0
  77. package/dist/browser/modules/excel/utils/ooxml-validator/check-chart.d.ts +32 -0
  78. package/dist/browser/modules/excel/utils/ooxml-validator/check-chart.js +2125 -0
  79. package/dist/browser/modules/excel/utils/ooxml-validator/check-chartsheet.d.ts +9 -0
  80. package/dist/browser/modules/excel/utils/ooxml-validator/check-chartsheet.js +26 -0
  81. package/dist/browser/modules/excel/utils/ooxml-validator/check-content-types.d.ts +16 -0
  82. package/dist/browser/modules/excel/utils/ooxml-validator/check-content-types.js +181 -0
  83. package/dist/browser/modules/excel/utils/ooxml-validator/check-drawing.d.ts +34 -0
  84. package/dist/browser/modules/excel/utils/ooxml-validator/check-drawing.js +267 -0
  85. package/dist/browser/modules/excel/utils/ooxml-validator/check-pivot.d.ts +14 -0
  86. package/dist/browser/modules/excel/utils/ooxml-validator/check-pivot.js +104 -0
  87. package/dist/browser/modules/excel/utils/ooxml-validator/check-relationships.d.ts +18 -0
  88. package/dist/browser/modules/excel/utils/ooxml-validator/check-relationships.js +184 -0
  89. package/dist/browser/modules/excel/utils/ooxml-validator/check-structure.d.ts +21 -0
  90. package/dist/browser/modules/excel/utils/ooxml-validator/check-structure.js +56 -0
  91. package/dist/browser/modules/excel/utils/ooxml-validator/check-styles.d.ts +15 -0
  92. package/dist/browser/modules/excel/utils/ooxml-validator/check-styles.js +89 -0
  93. package/dist/browser/modules/excel/utils/ooxml-validator/check-table.d.ts +31 -0
  94. package/dist/browser/modules/excel/utils/ooxml-validator/check-table.js +177 -0
  95. package/dist/browser/modules/excel/utils/ooxml-validator/check-workbook.d.ts +19 -0
  96. package/dist/browser/modules/excel/utils/ooxml-validator/check-workbook.js +163 -0
  97. package/dist/browser/modules/excel/utils/ooxml-validator/check-worksheet.d.ts +25 -0
  98. package/dist/browser/modules/excel/utils/ooxml-validator/check-worksheet.js +569 -0
  99. package/dist/browser/modules/excel/utils/ooxml-validator/context.d.ts +85 -0
  100. package/dist/browser/modules/excel/utils/ooxml-validator/context.js +191 -0
  101. package/dist/browser/modules/excel/utils/ooxml-validator/index.d.ts +31 -0
  102. package/dist/browser/modules/excel/utils/ooxml-validator/index.js +102 -0
  103. package/dist/browser/modules/excel/utils/ooxml-validator/path-utils.d.ts +67 -0
  104. package/dist/browser/modules/excel/utils/ooxml-validator/path-utils.js +156 -0
  105. package/dist/browser/modules/excel/utils/ooxml-validator/reporter.d.ts +41 -0
  106. package/dist/browser/modules/excel/utils/ooxml-validator/reporter.js +61 -0
  107. package/dist/browser/modules/excel/utils/ooxml-validator/types.d.ts +109 -0
  108. package/dist/browser/modules/excel/utils/ooxml-validator/types.js +12 -0
  109. package/dist/browser/modules/excel/utils/ooxml-validator/xml-utils.d.ts +38 -0
  110. package/dist/browser/modules/excel/utils/ooxml-validator/xml-utils.js +100 -0
  111. package/dist/browser/modules/excel/workbook.browser.d.ts +248 -30
  112. package/dist/browser/modules/excel/workbook.browser.js +966 -31
  113. package/dist/browser/modules/excel/workbook.d.ts +43 -0
  114. package/dist/browser/modules/excel/workbook.js +48 -0
  115. package/dist/browser/modules/excel/worksheet.d.ts +157 -3
  116. package/dist/browser/modules/excel/worksheet.js +394 -35
  117. package/dist/browser/modules/excel/xlsx/rel-type.d.ts +40 -0
  118. package/dist/browser/modules/excel/xlsx/rel-type.js +41 -1
  119. package/dist/browser/modules/excel/xlsx/xform/book/defined-name-xform.d.ts +1 -0
  120. package/dist/browser/modules/excel/xlsx/xform/book/defined-name-xform.js +11 -2
  121. package/dist/browser/modules/excel/xlsx/xform/book/external-link-xform.js +12 -10
  122. package/dist/browser/modules/excel/xlsx/xform/book/workbook-xform.js +96 -22
  123. package/dist/browser/modules/excel/xlsx/xform/chart/chart-space-xform.d.ts +353 -0
  124. package/dist/browser/modules/excel/xlsx/xform/chart/chart-space-xform.js +6000 -0
  125. package/dist/browser/modules/excel/xlsx/xform/comment/threaded-comments-xform.d.ts +60 -0
  126. package/dist/browser/modules/excel/xlsx/xform/comment/threaded-comments-xform.js +213 -0
  127. package/dist/browser/modules/excel/xlsx/xform/core/content-types-xform.js +150 -11
  128. package/dist/browser/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.js +20 -1
  129. package/dist/browser/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +1 -1
  130. package/dist/browser/modules/excel/xlsx/xform/drawing/drawing-xform.d.ts +30 -0
  131. package/dist/browser/modules/excel/xlsx/xform/drawing/drawing-xform.js +109 -5
  132. package/dist/browser/modules/excel/xlsx/xform/drawing/graphic-frame-xform.d.ts +54 -0
  133. package/dist/browser/modules/excel/xlsx/xform/drawing/graphic-frame-xform.js +225 -0
  134. package/dist/browser/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.d.ts +3 -1
  135. package/dist/browser/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.js +18 -3
  136. package/dist/browser/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.d.ts +46 -0
  137. package/dist/browser/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.js +294 -12
  138. package/dist/browser/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.d.ts +13 -2
  139. package/dist/browser/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +32 -6
  140. package/dist/browser/modules/excel/xlsx/xform/sheet/chartsheet-xform.d.ts +185 -0
  141. package/dist/browser/modules/excel/xlsx/xform/sheet/chartsheet-xform.js +441 -0
  142. package/dist/browser/modules/excel/xlsx/xform/sheet/ext-lst-xform.d.ts +1 -0
  143. package/dist/browser/modules/excel/xlsx/xform/sheet/ext-lst-xform.js +51 -2
  144. package/dist/browser/modules/excel/xlsx/xform/sheet/worksheet-xform.js +196 -20
  145. package/dist/browser/modules/excel/xlsx/xform/table/auto-filter-xform.js +16 -1
  146. package/dist/browser/modules/excel/xlsx/xform/table/table-column-xform.js +17 -2
  147. package/dist/browser/modules/excel/xlsx/xform/xsd-values.d.ts +63 -0
  148. package/dist/browser/modules/excel/xlsx/xform/xsd-values.js +101 -0
  149. package/dist/browser/modules/excel/xlsx/xlsx.browser.d.ts +115 -21
  150. package/dist/browser/modules/excel/xlsx/xlsx.browser.js +4422 -78
  151. package/dist/browser/modules/pdf/builder/document-builder.d.ts +74 -0
  152. package/dist/browser/modules/pdf/builder/document-builder.js +507 -2
  153. package/dist/browser/modules/pdf/builder/pdf-editor.js +48 -3
  154. package/dist/browser/modules/pdf/excel-bridge.d.ts +69 -0
  155. package/dist/browser/modules/pdf/excel-bridge.js +683 -12
  156. package/dist/browser/modules/pdf/font/font-manager.d.ts +25 -0
  157. package/dist/browser/modules/pdf/font/font-manager.js +39 -0
  158. package/dist/browser/modules/pdf/index.d.ts +5 -2
  159. package/dist/browser/modules/pdf/index.js +3 -1
  160. package/dist/browser/modules/pdf/render/chart-surface.d.ts +33 -0
  161. package/dist/browser/modules/pdf/render/chart-surface.js +200 -0
  162. package/dist/browser/modules/pdf/render/layout-engine.d.ts +22 -1
  163. package/dist/browser/modules/pdf/render/layout-engine.js +436 -56
  164. package/dist/browser/modules/pdf/render/page-renderer.js +169 -28
  165. package/dist/browser/modules/pdf/render/pdf-exporter.js +117 -7
  166. package/dist/browser/modules/pdf/types.d.ts +227 -23
  167. package/dist/browser/modules/pdf/types.js +4 -0
  168. package/dist/browser/modules/pdf/word-bridge.d.ts +47 -0
  169. package/dist/browser/modules/pdf/word-bridge.js +304 -0
  170. package/dist/browser/modules/word/constants.d.ts +179 -0
  171. package/dist/browser/modules/word/constants.js +231 -0
  172. package/dist/browser/modules/word/content-types.d.ts +27 -0
  173. package/dist/browser/modules/word/content-types.js +53 -0
  174. package/dist/browser/modules/word/digital-signatures.d.ts +87 -0
  175. package/dist/browser/modules/word/digital-signatures.js +134 -0
  176. package/dist/browser/modules/word/document.d.ts +728 -0
  177. package/dist/browser/modules/word/document.js +1795 -0
  178. package/dist/browser/modules/word/docx-packager.d.ts +14 -0
  179. package/dist/browser/modules/word/docx-packager.js +822 -0
  180. package/dist/browser/modules/word/docx-reader.d.ts +11 -0
  181. package/dist/browser/modules/word/docx-reader.js +4929 -0
  182. package/dist/browser/modules/word/encryption.d.ts +102 -0
  183. package/dist/browser/modules/word/encryption.js +274 -0
  184. package/dist/browser/modules/word/errors.d.ts +49 -0
  185. package/dist/browser/modules/word/errors.js +68 -0
  186. package/dist/browser/modules/word/font-obfuscation.d.ts +31 -0
  187. package/dist/browser/modules/word/font-obfuscation.js +83 -0
  188. package/dist/browser/modules/word/html-renderer.d.ts +38 -0
  189. package/dist/browser/modules/word/html-renderer.js +782 -0
  190. package/dist/browser/modules/word/index.base.d.ts +19 -0
  191. package/dist/browser/modules/word/index.base.js +51 -0
  192. package/dist/browser/modules/word/index.browser.d.ts +4 -0
  193. package/dist/browser/modules/word/index.browser.js +4 -0
  194. package/dist/browser/modules/word/index.d.ts +4 -0
  195. package/dist/browser/modules/word/index.js +4 -0
  196. package/dist/browser/modules/word/internal-utils.d.ts +23 -0
  197. package/dist/browser/modules/word/internal-utils.js +54 -0
  198. package/dist/browser/modules/word/relationships.d.ts +31 -0
  199. package/dist/browser/modules/word/relationships.js +56 -0
  200. package/dist/browser/modules/word/types.d.ts +2325 -0
  201. package/dist/browser/modules/word/types.js +10 -0
  202. package/dist/browser/modules/word/units.d.ts +49 -0
  203. package/dist/browser/modules/word/units.js +111 -0
  204. package/dist/browser/modules/word/writers/chart-writer.d.ts +10 -0
  205. package/dist/browser/modules/word/writers/chart-writer.js +385 -0
  206. package/dist/browser/modules/word/writers/checkbox-writer.d.ts +9 -0
  207. package/dist/browser/modules/word/writers/checkbox-writer.js +42 -0
  208. package/dist/browser/modules/word/writers/comment-writer.d.ts +15 -0
  209. package/dist/browser/modules/word/writers/comment-writer.js +70 -0
  210. package/dist/browser/modules/word/writers/document-writer.d.ts +16 -0
  211. package/dist/browser/modules/word/writers/document-writer.js +461 -0
  212. package/dist/browser/modules/word/writers/footnote-writer.d.ts +11 -0
  213. package/dist/browser/modules/word/writers/footnote-writer.js +72 -0
  214. package/dist/browser/modules/word/writers/header-footer-writer.d.ts +13 -0
  215. package/dist/browser/modules/word/writers/header-footer-writer.js +129 -0
  216. package/dist/browser/modules/word/writers/image-writer.d.ts +10 -0
  217. package/dist/browser/modules/word/writers/image-writer.js +185 -0
  218. package/dist/browser/modules/word/writers/math-writer.d.ts +9 -0
  219. package/dist/browser/modules/word/writers/math-writer.js +428 -0
  220. package/dist/browser/modules/word/writers/numbering-writer.d.ts +10 -0
  221. package/dist/browser/modules/word/writers/numbering-writer.js +125 -0
  222. package/dist/browser/modules/word/writers/paragraph-writer.d.ts +13 -0
  223. package/dist/browser/modules/word/writers/paragraph-writer.js +516 -0
  224. package/dist/browser/modules/word/writers/parts-writer.d.ts +26 -0
  225. package/dist/browser/modules/word/writers/parts-writer.js +660 -0
  226. package/dist/browser/modules/word/writers/run-writer.d.ts +15 -0
  227. package/dist/browser/modules/word/writers/run-writer.js +649 -0
  228. package/dist/browser/modules/word/writers/section-writer.d.ts +10 -0
  229. package/dist/browser/modules/word/writers/section-writer.js +238 -0
  230. package/dist/browser/modules/word/writers/styles-writer.d.ts +10 -0
  231. package/dist/browser/modules/word/writers/styles-writer.js +242 -0
  232. package/dist/browser/modules/word/writers/table-writer.d.ts +10 -0
  233. package/dist/browser/modules/word/writers/table-writer.js +503 -0
  234. package/dist/browser/modules/word/writers/textbox-writer.d.ts +9 -0
  235. package/dist/browser/modules/word/writers/textbox-writer.js +53 -0
  236. package/dist/browser/modules/word/writers/toc-writer.d.ts +9 -0
  237. package/dist/browser/modules/word/writers/toc-writer.js +79 -0
  238. package/dist/browser/modules/xml/encode.d.ts +56 -7
  239. package/dist/browser/modules/xml/encode.js +157 -11
  240. package/dist/cjs/index.js +13 -2
  241. package/dist/cjs/modules/excel/chart/cache-populator.js +1178 -0
  242. package/dist/cjs/modules/excel/chart/chart-api.js +371 -0
  243. package/dist/cjs/modules/excel/chart/chart-builder.js +2440 -0
  244. package/dist/cjs/modules/excel/chart/chart-ex-builder.js +907 -0
  245. package/dist/cjs/modules/excel/chart/chart-ex-parser.js +1208 -0
  246. package/dist/cjs/modules/excel/chart/chart-ex-renderer.js +5364 -0
  247. package/dist/cjs/modules/excel/chart/chart-ex-types.js +12 -0
  248. package/dist/cjs/modules/excel/chart/chart-images.js +366 -0
  249. package/dist/cjs/modules/excel/chart/chart-presets.js +184 -0
  250. package/dist/cjs/modules/excel/chart/chart-renderer.js +6450 -0
  251. package/dist/cjs/modules/excel/chart/chart-sidecar.js +433 -0
  252. package/dist/cjs/modules/excel/chart/chart-utils.js +845 -0
  253. package/dist/cjs/modules/excel/chart/chart.js +1324 -0
  254. package/dist/cjs/modules/excel/chart/glyph-rasterizer.js +664 -0
  255. package/dist/cjs/modules/excel/chart/index.js +101 -0
  256. package/dist/cjs/modules/excel/chart/install.js +95 -0
  257. package/dist/cjs/modules/excel/chart/shape-properties.js +1577 -0
  258. package/dist/cjs/modules/excel/chart/stroke-font.js +1559 -0
  259. package/dist/cjs/modules/excel/chart/topojson.js +239 -0
  260. package/dist/cjs/modules/excel/chart/types.js +9 -0
  261. package/dist/cjs/modules/excel/chart-host-registry.js +96 -0
  262. package/dist/cjs/modules/excel/chartsheet.js +199 -0
  263. package/dist/cjs/modules/excel/defined-names.js +44 -4
  264. package/dist/cjs/modules/excel/errors.js +11 -1
  265. package/dist/cjs/modules/excel/form-control.js +17 -0
  266. package/dist/cjs/modules/excel/image.js +12 -2
  267. package/dist/cjs/modules/excel/pivot-chart.js +56 -0
  268. package/dist/cjs/modules/excel/pivot-table.js +35 -0
  269. package/dist/cjs/modules/excel/range.js +5 -1
  270. package/dist/cjs/modules/excel/sparkline/index.js +23 -0
  271. package/dist/cjs/modules/excel/sparkline/sparkline.js +756 -0
  272. package/dist/cjs/modules/excel/stream/worksheet-writer.js +3 -2
  273. package/dist/cjs/modules/excel/table.js +42 -6
  274. package/dist/cjs/modules/excel/utils/address.js +29 -0
  275. package/dist/cjs/modules/excel/utils/drawing-utils.js +11 -6
  276. package/dist/cjs/modules/excel/utils/guid.js +38 -0
  277. package/dist/cjs/modules/excel/utils/ooxml-paths.js +246 -9
  278. package/dist/cjs/modules/excel/utils/ooxml-validator/check-chart-sidecar.js +103 -0
  279. package/dist/cjs/modules/excel/utils/ooxml-validator/check-chart.js +2128 -0
  280. package/dist/cjs/modules/excel/utils/ooxml-validator/check-chartsheet.js +29 -0
  281. package/dist/cjs/modules/excel/utils/ooxml-validator/check-content-types.js +184 -0
  282. package/dist/cjs/modules/excel/utils/ooxml-validator/check-drawing.js +270 -0
  283. package/dist/cjs/modules/excel/utils/ooxml-validator/check-pivot.js +107 -0
  284. package/dist/cjs/modules/excel/utils/ooxml-validator/check-relationships.js +188 -0
  285. package/dist/cjs/modules/excel/utils/ooxml-validator/check-structure.js +60 -0
  286. package/dist/cjs/modules/excel/utils/ooxml-validator/check-styles.js +92 -0
  287. package/dist/cjs/modules/excel/utils/ooxml-validator/check-table.js +180 -0
  288. package/dist/cjs/modules/excel/utils/ooxml-validator/check-workbook.js +166 -0
  289. package/dist/cjs/modules/excel/utils/ooxml-validator/check-worksheet.js +572 -0
  290. package/dist/cjs/modules/excel/utils/ooxml-validator/context.js +196 -0
  291. package/dist/cjs/modules/excel/utils/ooxml-validator/index.js +105 -0
  292. package/dist/cjs/modules/excel/utils/ooxml-validator/path-utils.js +168 -0
  293. package/dist/cjs/modules/excel/utils/ooxml-validator/reporter.js +66 -0
  294. package/dist/cjs/modules/excel/utils/ooxml-validator/types.js +13 -0
  295. package/dist/cjs/modules/excel/utils/ooxml-validator/xml-utils.js +110 -0
  296. package/dist/cjs/modules/excel/workbook.browser.js +973 -38
  297. package/dist/cjs/modules/excel/workbook.js +48 -0
  298. package/dist/cjs/modules/excel/worksheet.js +393 -34
  299. package/dist/cjs/modules/excel/xlsx/rel-type.js +41 -1
  300. package/dist/cjs/modules/excel/xlsx/xform/book/defined-name-xform.js +11 -2
  301. package/dist/cjs/modules/excel/xlsx/xform/book/external-link-xform.js +12 -10
  302. package/dist/cjs/modules/excel/xlsx/xform/book/workbook-xform.js +96 -22
  303. package/dist/cjs/modules/excel/xlsx/xform/chart/chart-space-xform.js +6003 -0
  304. package/dist/cjs/modules/excel/xlsx/xform/comment/threaded-comments-xform.js +219 -0
  305. package/dist/cjs/modules/excel/xlsx/xform/core/content-types-xform.js +149 -10
  306. package/dist/cjs/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.js +20 -1
  307. package/dist/cjs/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +1 -1
  308. package/dist/cjs/modules/excel/xlsx/xform/drawing/drawing-xform.js +109 -5
  309. package/dist/cjs/modules/excel/xlsx/xform/drawing/graphic-frame-xform.js +228 -0
  310. package/dist/cjs/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.js +18 -3
  311. package/dist/cjs/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.js +294 -12
  312. package/dist/cjs/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +32 -6
  313. package/dist/cjs/modules/excel/xlsx/xform/sheet/chartsheet-xform.js +444 -0
  314. package/dist/cjs/modules/excel/xlsx/xform/sheet/ext-lst-xform.js +51 -2
  315. package/dist/cjs/modules/excel/xlsx/xform/sheet/worksheet-xform.js +195 -19
  316. package/dist/cjs/modules/excel/xlsx/xform/table/auto-filter-xform.js +16 -1
  317. package/dist/cjs/modules/excel/xlsx/xform/table/table-column-xform.js +17 -2
  318. package/dist/cjs/modules/excel/xlsx/xform/xsd-values.js +106 -0
  319. package/dist/cjs/modules/excel/xlsx/xlsx.browser.js +4420 -76
  320. package/dist/cjs/modules/pdf/builder/document-builder.js +506 -1
  321. package/dist/cjs/modules/pdf/builder/pdf-editor.js +48 -3
  322. package/dist/cjs/modules/pdf/excel-bridge.js +684 -12
  323. package/dist/cjs/modules/pdf/font/font-manager.js +39 -0
  324. package/dist/cjs/modules/pdf/index.js +5 -1
  325. package/dist/cjs/modules/pdf/render/chart-surface.js +203 -0
  326. package/dist/cjs/modules/pdf/render/layout-engine.js +437 -56
  327. package/dist/cjs/modules/pdf/render/page-renderer.js +169 -28
  328. package/dist/cjs/modules/pdf/render/pdf-exporter.js +115 -5
  329. package/dist/cjs/modules/pdf/types.js +5 -0
  330. package/dist/cjs/modules/pdf/word-bridge.js +307 -0
  331. package/dist/cjs/modules/word/constants.js +234 -0
  332. package/dist/cjs/modules/word/content-types.js +57 -0
  333. package/dist/cjs/modules/word/digital-signatures.js +140 -0
  334. package/dist/cjs/modules/word/document.js +1909 -0
  335. package/dist/cjs/modules/word/docx-packager.js +825 -0
  336. package/dist/cjs/modules/word/docx-reader.js +4932 -0
  337. package/dist/cjs/modules/word/encryption.js +282 -0
  338. package/dist/cjs/modules/word/errors.js +88 -0
  339. package/dist/cjs/modules/word/font-obfuscation.js +88 -0
  340. package/dist/cjs/modules/word/html-renderer.js +785 -0
  341. package/dist/cjs/modules/word/index.base.js +199 -0
  342. package/dist/cjs/modules/word/index.browser.js +20 -0
  343. package/dist/cjs/modules/word/index.js +20 -0
  344. package/dist/cjs/modules/word/internal-utils.js +59 -0
  345. package/dist/cjs/modules/word/relationships.js +60 -0
  346. package/dist/cjs/modules/word/types.js +11 -0
  347. package/dist/cjs/modules/word/units.js +135 -0
  348. package/dist/cjs/modules/word/writers/chart-writer.js +388 -0
  349. package/dist/cjs/modules/word/writers/checkbox-writer.js +45 -0
  350. package/dist/cjs/modules/word/writers/comment-writer.js +74 -0
  351. package/dist/cjs/modules/word/writers/document-writer.js +465 -0
  352. package/dist/cjs/modules/word/writers/footnote-writer.js +76 -0
  353. package/dist/cjs/modules/word/writers/header-footer-writer.js +134 -0
  354. package/dist/cjs/modules/word/writers/image-writer.js +188 -0
  355. package/dist/cjs/modules/word/writers/math-writer.js +431 -0
  356. package/dist/cjs/modules/word/writers/numbering-writer.js +128 -0
  357. package/dist/cjs/modules/word/writers/paragraph-writer.js +521 -0
  358. package/dist/cjs/modules/word/writers/parts-writer.js +671 -0
  359. package/dist/cjs/modules/word/writers/run-writer.js +655 -0
  360. package/dist/cjs/modules/word/writers/section-writer.js +241 -0
  361. package/dist/cjs/modules/word/writers/styles-writer.js +245 -0
  362. package/dist/cjs/modules/word/writers/table-writer.js +506 -0
  363. package/dist/cjs/modules/word/writers/textbox-writer.js +56 -0
  364. package/dist/cjs/modules/word/writers/toc-writer.js +82 -0
  365. package/dist/cjs/modules/xml/encode.js +158 -11
  366. package/dist/esm/index.browser.js +20 -2
  367. package/dist/esm/index.js +9 -1
  368. package/dist/esm/modules/excel/chart/cache-populator.js +1171 -0
  369. package/dist/esm/modules/excel/chart/chart-api.js +364 -0
  370. package/dist/esm/modules/excel/chart/chart-builder.js +2432 -0
  371. package/dist/esm/modules/excel/chart/chart-ex-builder.js +903 -0
  372. package/dist/esm/modules/excel/chart/chart-ex-parser.js +1205 -0
  373. package/dist/esm/modules/excel/chart/chart-ex-renderer.js +5352 -0
  374. package/dist/esm/modules/excel/chart/chart-ex-types.js +11 -0
  375. package/dist/esm/modules/excel/chart/chart-images.js +363 -0
  376. package/dist/esm/modules/excel/chart/chart-presets.js +179 -0
  377. package/dist/esm/modules/excel/chart/chart-renderer.js +6440 -0
  378. package/dist/esm/modules/excel/chart/chart-sidecar.js +427 -0
  379. package/dist/esm/modules/excel/chart/chart-utils.js +821 -0
  380. package/dist/esm/modules/excel/chart/chart.js +1320 -0
  381. package/dist/esm/modules/excel/chart/glyph-rasterizer.js +658 -0
  382. package/dist/esm/modules/excel/chart/index.js +46 -0
  383. package/dist/esm/modules/excel/chart/install.js +91 -0
  384. package/dist/esm/modules/excel/chart/shape-properties.js +1557 -0
  385. package/dist/esm/modules/excel/chart/stroke-font.js +1556 -0
  386. package/dist/esm/modules/excel/chart/topojson.js +236 -0
  387. package/dist/esm/modules/excel/chart/types.js +8 -0
  388. package/dist/esm/modules/excel/chart-host-registry.js +90 -0
  389. package/dist/esm/modules/excel/chartsheet.js +196 -0
  390. package/dist/esm/modules/excel/defined-names.js +44 -4
  391. package/dist/esm/modules/excel/errors.js +9 -0
  392. package/dist/esm/modules/excel/form-control.js +17 -0
  393. package/dist/esm/modules/excel/image.js +12 -2
  394. package/dist/esm/modules/excel/pivot-chart.js +53 -0
  395. package/dist/esm/modules/excel/pivot-table.js +35 -0
  396. package/dist/esm/modules/excel/range.js +5 -1
  397. package/dist/esm/modules/excel/sparkline/index.js +7 -0
  398. package/dist/esm/modules/excel/sparkline/sparkline.js +750 -0
  399. package/dist/esm/modules/excel/stream/worksheet-writer.js +3 -2
  400. package/dist/esm/modules/excel/table.js +42 -6
  401. package/dist/esm/modules/excel/utils/address.js +28 -0
  402. package/dist/esm/modules/excel/utils/drawing-utils.js +11 -6
  403. package/dist/esm/modules/excel/utils/guid.js +35 -0
  404. package/dist/esm/modules/excel/utils/ooxml-paths.js +206 -9
  405. package/dist/esm/modules/excel/utils/ooxml-validator/check-chart-sidecar.js +101 -0
  406. package/dist/esm/modules/excel/utils/ooxml-validator/check-chart.js +2125 -0
  407. package/dist/esm/modules/excel/utils/ooxml-validator/check-chartsheet.js +26 -0
  408. package/dist/esm/modules/excel/utils/ooxml-validator/check-content-types.js +181 -0
  409. package/dist/esm/modules/excel/utils/ooxml-validator/check-drawing.js +267 -0
  410. package/dist/esm/modules/excel/utils/ooxml-validator/check-pivot.js +104 -0
  411. package/dist/esm/modules/excel/utils/ooxml-validator/check-relationships.js +184 -0
  412. package/dist/esm/modules/excel/utils/ooxml-validator/check-structure.js +56 -0
  413. package/dist/esm/modules/excel/utils/ooxml-validator/check-styles.js +89 -0
  414. package/dist/esm/modules/excel/utils/ooxml-validator/check-table.js +177 -0
  415. package/dist/esm/modules/excel/utils/ooxml-validator/check-workbook.js +163 -0
  416. package/dist/esm/modules/excel/utils/ooxml-validator/check-worksheet.js +569 -0
  417. package/dist/esm/modules/excel/utils/ooxml-validator/context.js +191 -0
  418. package/dist/esm/modules/excel/utils/ooxml-validator/index.js +102 -0
  419. package/dist/esm/modules/excel/utils/ooxml-validator/path-utils.js +156 -0
  420. package/dist/esm/modules/excel/utils/ooxml-validator/reporter.js +61 -0
  421. package/dist/esm/modules/excel/utils/ooxml-validator/types.js +12 -0
  422. package/dist/esm/modules/excel/utils/ooxml-validator/xml-utils.js +100 -0
  423. package/dist/esm/modules/excel/workbook.browser.js +969 -34
  424. package/dist/esm/modules/excel/workbook.js +48 -0
  425. package/dist/esm/modules/excel/worksheet.js +394 -35
  426. package/dist/esm/modules/excel/xlsx/rel-type.js +41 -1
  427. package/dist/esm/modules/excel/xlsx/xform/book/defined-name-xform.js +11 -2
  428. package/dist/esm/modules/excel/xlsx/xform/book/external-link-xform.js +12 -10
  429. package/dist/esm/modules/excel/xlsx/xform/book/workbook-xform.js +96 -22
  430. package/dist/esm/modules/excel/xlsx/xform/chart/chart-space-xform.js +6000 -0
  431. package/dist/esm/modules/excel/xlsx/xform/comment/threaded-comments-xform.js +213 -0
  432. package/dist/esm/modules/excel/xlsx/xform/core/content-types-xform.js +150 -11
  433. package/dist/esm/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.js +20 -1
  434. package/dist/esm/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +1 -1
  435. package/dist/esm/modules/excel/xlsx/xform/drawing/drawing-xform.js +109 -5
  436. package/dist/esm/modules/excel/xlsx/xform/drawing/graphic-frame-xform.js +225 -0
  437. package/dist/esm/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.js +18 -3
  438. package/dist/esm/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.js +294 -12
  439. package/dist/esm/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +32 -6
  440. package/dist/esm/modules/excel/xlsx/xform/sheet/chartsheet-xform.js +441 -0
  441. package/dist/esm/modules/excel/xlsx/xform/sheet/ext-lst-xform.js +51 -2
  442. package/dist/esm/modules/excel/xlsx/xform/sheet/worksheet-xform.js +196 -20
  443. package/dist/esm/modules/excel/xlsx/xform/table/auto-filter-xform.js +16 -1
  444. package/dist/esm/modules/excel/xlsx/xform/table/table-column-xform.js +17 -2
  445. package/dist/esm/modules/excel/xlsx/xform/xsd-values.js +101 -0
  446. package/dist/esm/modules/excel/xlsx/xlsx.browser.js +4422 -78
  447. package/dist/esm/modules/pdf/builder/document-builder.js +507 -2
  448. package/dist/esm/modules/pdf/builder/pdf-editor.js +48 -3
  449. package/dist/esm/modules/pdf/excel-bridge.js +683 -12
  450. package/dist/esm/modules/pdf/font/font-manager.js +39 -0
  451. package/dist/esm/modules/pdf/index.js +3 -1
  452. package/dist/esm/modules/pdf/render/chart-surface.js +200 -0
  453. package/dist/esm/modules/pdf/render/layout-engine.js +436 -56
  454. package/dist/esm/modules/pdf/render/page-renderer.js +169 -28
  455. package/dist/esm/modules/pdf/render/pdf-exporter.js +117 -7
  456. package/dist/esm/modules/pdf/types.js +4 -0
  457. package/dist/esm/modules/pdf/word-bridge.js +304 -0
  458. package/dist/esm/modules/word/constants.js +231 -0
  459. package/dist/esm/modules/word/content-types.js +53 -0
  460. package/dist/esm/modules/word/digital-signatures.js +134 -0
  461. package/dist/esm/modules/word/document.js +1795 -0
  462. package/dist/esm/modules/word/docx-packager.js +822 -0
  463. package/dist/esm/modules/word/docx-reader.js +4929 -0
  464. package/dist/esm/modules/word/encryption.js +274 -0
  465. package/dist/esm/modules/word/errors.js +68 -0
  466. package/dist/esm/modules/word/font-obfuscation.js +83 -0
  467. package/dist/esm/modules/word/html-renderer.js +782 -0
  468. package/dist/esm/modules/word/index.base.js +51 -0
  469. package/dist/esm/modules/word/index.browser.js +4 -0
  470. package/dist/esm/modules/word/index.js +4 -0
  471. package/dist/esm/modules/word/internal-utils.js +54 -0
  472. package/dist/esm/modules/word/relationships.js +56 -0
  473. package/dist/esm/modules/word/types.js +10 -0
  474. package/dist/esm/modules/word/units.js +111 -0
  475. package/dist/esm/modules/word/writers/chart-writer.js +385 -0
  476. package/dist/esm/modules/word/writers/checkbox-writer.js +42 -0
  477. package/dist/esm/modules/word/writers/comment-writer.js +70 -0
  478. package/dist/esm/modules/word/writers/document-writer.js +461 -0
  479. package/dist/esm/modules/word/writers/footnote-writer.js +72 -0
  480. package/dist/esm/modules/word/writers/header-footer-writer.js +129 -0
  481. package/dist/esm/modules/word/writers/image-writer.js +185 -0
  482. package/dist/esm/modules/word/writers/math-writer.js +428 -0
  483. package/dist/esm/modules/word/writers/numbering-writer.js +125 -0
  484. package/dist/esm/modules/word/writers/paragraph-writer.js +516 -0
  485. package/dist/esm/modules/word/writers/parts-writer.js +660 -0
  486. package/dist/esm/modules/word/writers/run-writer.js +649 -0
  487. package/dist/esm/modules/word/writers/section-writer.js +238 -0
  488. package/dist/esm/modules/word/writers/styles-writer.js +242 -0
  489. package/dist/esm/modules/word/writers/table-writer.js +503 -0
  490. package/dist/esm/modules/word/writers/textbox-writer.js +53 -0
  491. package/dist/esm/modules/word/writers/toc-writer.js +79 -0
  492. package/dist/esm/modules/xml/encode.js +157 -11
  493. package/dist/iife/excelts.iife.js +11789 -687
  494. package/dist/iife/excelts.iife.js.map +1 -1
  495. package/dist/iife/excelts.iife.min.js +52 -44
  496. package/dist/types/index.browser.d.ts +8 -5
  497. package/dist/types/index.d.ts +4 -2
  498. package/dist/types/modules/excel/chart/cache-populator.d.ts +49 -0
  499. package/dist/types/modules/excel/chart/chart-api.d.ts +92 -0
  500. package/dist/types/modules/excel/chart/chart-builder.d.ts +48 -0
  501. package/dist/types/modules/excel/chart/chart-ex-builder.d.ts +36 -0
  502. package/dist/types/modules/excel/chart/chart-ex-parser.d.ts +8 -0
  503. package/dist/types/modules/excel/chart/chart-ex-renderer.d.ts +187 -0
  504. package/dist/types/modules/excel/chart/chart-ex-types.d.ts +531 -0
  505. package/dist/types/modules/excel/chart/chart-images.d.ts +78 -0
  506. package/dist/types/modules/excel/chart/chart-presets.d.ts +392 -0
  507. package/dist/types/modules/excel/chart/chart-renderer.d.ts +550 -0
  508. package/dist/types/modules/excel/chart/chart-sidecar.d.ts +21 -0
  509. package/dist/types/modules/excel/chart/chart-utils.d.ts +306 -0
  510. package/dist/types/modules/excel/chart/chart.d.ts +504 -0
  511. package/dist/types/modules/excel/chart/glyph-rasterizer.d.ts +62 -0
  512. package/dist/types/modules/excel/chart/index.d.ts +54 -0
  513. package/dist/types/modules/excel/chart/install.d.ts +44 -0
  514. package/dist/types/modules/excel/chart/shape-properties.d.ts +156 -0
  515. package/dist/types/modules/excel/chart/stroke-font.d.ts +36 -0
  516. package/dist/types/modules/excel/chart/topojson.d.ts +98 -0
  517. package/dist/types/modules/excel/chart/types.d.ts +2559 -0
  518. package/dist/types/modules/excel/chart-host-registry.d.ts +157 -0
  519. package/dist/types/modules/excel/chartsheet.d.ts +102 -0
  520. package/dist/types/modules/excel/defined-names.d.ts +35 -0
  521. package/dist/types/modules/excel/errors.d.ts +6 -0
  522. package/dist/types/modules/excel/form-control.d.ts +6 -0
  523. package/dist/types/modules/excel/pivot-chart.d.ts +7 -0
  524. package/dist/types/modules/excel/pivot-table.d.ts +55 -0
  525. package/dist/types/modules/excel/sparkline/index.d.ts +7 -0
  526. package/dist/types/modules/excel/sparkline/sparkline.d.ts +206 -0
  527. package/dist/types/modules/excel/types.d.ts +72 -0
  528. package/dist/types/modules/excel/utils/address.d.ts +18 -0
  529. package/dist/types/modules/excel/utils/guid.d.ts +15 -0
  530. package/dist/types/modules/excel/utils/ooxml-paths.d.ts +74 -0
  531. package/dist/types/modules/excel/utils/ooxml-validator/check-chart-sidecar.d.ts +35 -0
  532. package/dist/types/modules/excel/utils/ooxml-validator/check-chart.d.ts +32 -0
  533. package/dist/types/modules/excel/utils/ooxml-validator/check-chartsheet.d.ts +9 -0
  534. package/dist/types/modules/excel/utils/ooxml-validator/check-content-types.d.ts +16 -0
  535. package/dist/types/modules/excel/utils/ooxml-validator/check-drawing.d.ts +34 -0
  536. package/dist/types/modules/excel/utils/ooxml-validator/check-pivot.d.ts +14 -0
  537. package/dist/types/modules/excel/utils/ooxml-validator/check-relationships.d.ts +18 -0
  538. package/dist/types/modules/excel/utils/ooxml-validator/check-structure.d.ts +21 -0
  539. package/dist/types/modules/excel/utils/ooxml-validator/check-styles.d.ts +15 -0
  540. package/dist/types/modules/excel/utils/ooxml-validator/check-table.d.ts +31 -0
  541. package/dist/types/modules/excel/utils/ooxml-validator/check-workbook.d.ts +19 -0
  542. package/dist/types/modules/excel/utils/ooxml-validator/check-worksheet.d.ts +25 -0
  543. package/dist/types/modules/excel/utils/ooxml-validator/context.d.ts +85 -0
  544. package/dist/types/modules/excel/utils/ooxml-validator/index.d.ts +31 -0
  545. package/dist/types/modules/excel/utils/ooxml-validator/path-utils.d.ts +67 -0
  546. package/dist/types/modules/excel/utils/ooxml-validator/reporter.d.ts +41 -0
  547. package/dist/types/modules/excel/utils/ooxml-validator/types.d.ts +109 -0
  548. package/dist/types/modules/excel/utils/ooxml-validator/xml-utils.d.ts +38 -0
  549. package/dist/types/modules/excel/workbook.browser.d.ts +248 -30
  550. package/dist/types/modules/excel/workbook.d.ts +43 -0
  551. package/dist/types/modules/excel/worksheet.d.ts +157 -3
  552. package/dist/types/modules/excel/xlsx/rel-type.d.ts +40 -0
  553. package/dist/types/modules/excel/xlsx/xform/book/defined-name-xform.d.ts +1 -0
  554. package/dist/types/modules/excel/xlsx/xform/chart/chart-space-xform.d.ts +353 -0
  555. package/dist/types/modules/excel/xlsx/xform/comment/threaded-comments-xform.d.ts +60 -0
  556. package/dist/types/modules/excel/xlsx/xform/drawing/drawing-xform.d.ts +30 -0
  557. package/dist/types/modules/excel/xlsx/xform/drawing/graphic-frame-xform.d.ts +54 -0
  558. package/dist/types/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.d.ts +3 -1
  559. package/dist/types/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.d.ts +46 -0
  560. package/dist/types/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.d.ts +13 -2
  561. package/dist/types/modules/excel/xlsx/xform/sheet/chartsheet-xform.d.ts +185 -0
  562. package/dist/types/modules/excel/xlsx/xform/sheet/ext-lst-xform.d.ts +1 -0
  563. package/dist/types/modules/excel/xlsx/xform/xsd-values.d.ts +63 -0
  564. package/dist/types/modules/excel/xlsx/xlsx.browser.d.ts +115 -21
  565. package/dist/types/modules/pdf/builder/document-builder.d.ts +74 -0
  566. package/dist/types/modules/pdf/excel-bridge.d.ts +69 -0
  567. package/dist/types/modules/pdf/font/font-manager.d.ts +25 -0
  568. package/dist/types/modules/pdf/index.d.ts +5 -2
  569. package/dist/types/modules/pdf/render/chart-surface.d.ts +33 -0
  570. package/dist/types/modules/pdf/render/layout-engine.d.ts +22 -1
  571. package/dist/types/modules/pdf/types.d.ts +227 -23
  572. package/dist/types/modules/pdf/word-bridge.d.ts +47 -0
  573. package/dist/types/modules/word/constants.d.ts +179 -0
  574. package/dist/types/modules/word/content-types.d.ts +27 -0
  575. package/dist/types/modules/word/digital-signatures.d.ts +87 -0
  576. package/dist/types/modules/word/document.d.ts +728 -0
  577. package/dist/types/modules/word/docx-packager.d.ts +14 -0
  578. package/dist/types/modules/word/docx-reader.d.ts +11 -0
  579. package/dist/types/modules/word/encryption.d.ts +102 -0
  580. package/dist/types/modules/word/errors.d.ts +49 -0
  581. package/dist/types/modules/word/font-obfuscation.d.ts +31 -0
  582. package/dist/types/modules/word/html-renderer.d.ts +38 -0
  583. package/dist/types/modules/word/index.base.d.ts +19 -0
  584. package/dist/types/modules/word/index.browser.d.ts +4 -0
  585. package/dist/types/modules/word/index.d.ts +4 -0
  586. package/dist/types/modules/word/internal-utils.d.ts +23 -0
  587. package/dist/types/modules/word/relationships.d.ts +31 -0
  588. package/dist/types/modules/word/types.d.ts +2325 -0
  589. package/dist/types/modules/word/units.d.ts +49 -0
  590. package/dist/types/modules/word/writers/chart-writer.d.ts +10 -0
  591. package/dist/types/modules/word/writers/checkbox-writer.d.ts +9 -0
  592. package/dist/types/modules/word/writers/comment-writer.d.ts +15 -0
  593. package/dist/types/modules/word/writers/document-writer.d.ts +16 -0
  594. package/dist/types/modules/word/writers/footnote-writer.d.ts +11 -0
  595. package/dist/types/modules/word/writers/header-footer-writer.d.ts +13 -0
  596. package/dist/types/modules/word/writers/image-writer.d.ts +10 -0
  597. package/dist/types/modules/word/writers/math-writer.d.ts +9 -0
  598. package/dist/types/modules/word/writers/numbering-writer.d.ts +10 -0
  599. package/dist/types/modules/word/writers/paragraph-writer.d.ts +13 -0
  600. package/dist/types/modules/word/writers/parts-writer.d.ts +26 -0
  601. package/dist/types/modules/word/writers/run-writer.d.ts +15 -0
  602. package/dist/types/modules/word/writers/section-writer.d.ts +10 -0
  603. package/dist/types/modules/word/writers/styles-writer.d.ts +10 -0
  604. package/dist/types/modules/word/writers/table-writer.d.ts +10 -0
  605. package/dist/types/modules/word/writers/textbox-writer.d.ts +9 -0
  606. package/dist/types/modules/word/writers/toc-writer.d.ts +9 -0
  607. package/dist/types/modules/xml/encode.d.ts +56 -7
  608. package/package.json +29 -11
  609. package/dist/browser/modules/excel/utils/ooxml-validator.d.ts +0 -48
  610. package/dist/browser/modules/excel/utils/ooxml-validator.js +0 -493
  611. package/dist/browser/modules/excel/utils/passthrough-manager.d.ts +0 -77
  612. package/dist/browser/modules/excel/utils/passthrough-manager.js +0 -129
  613. package/dist/cjs/modules/excel/utils/ooxml-validator.js +0 -499
  614. package/dist/cjs/modules/excel/utils/passthrough-manager.js +0 -133
  615. package/dist/esm/modules/excel/utils/ooxml-validator.js +0 -493
  616. package/dist/esm/modules/excel/utils/passthrough-manager.js +0 -129
  617. package/dist/types/modules/excel/utils/ooxml-validator.d.ts +0 -48
  618. package/dist/types/modules/excel/utils/passthrough-manager.d.ts +0 -77
@@ -0,0 +1,1208 @@
1
+ "use strict";
2
+ /**
3
+ * Best-effort ChartEx parser for Office 2016+ cx: chart XML.
4
+ *
5
+ * The parser captures the structured fields that ExcelTS can render and keeps
6
+ * the original XML on the model so clean round-trips can still use raw bytes.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.parseChartEx = parseChartEx;
10
+ const dom_1 = require("../../xml/dom.js");
11
+ const chart_utils_1 = require("./chart-utils");
12
+ const shape_properties_1 = require("./shape-properties");
13
+ // Element-name whitelists for unknown-child detection. Parents not listed here
14
+ // are either (a) purely raw-passthrough containers already captured via
15
+ // `_rawXml` / `rawXml` / `extLst`, or (b) leaf elements whose content is
16
+ // attributes only. Update these lists when a new cx: element is promoted into
17
+ // the structured model so it stops being flagged as "unknown".
18
+ const KNOWN_CHILDREN_CHART_SPACE = new Set([
19
+ "cx:chartData",
20
+ "cx:chart",
21
+ "cx:clrMapOvr",
22
+ "cx:spPr",
23
+ "cx:txPr",
24
+ "cx:protection",
25
+ "cx:printSettings",
26
+ "cx:externalData",
27
+ "cx:extLst"
28
+ ]);
29
+ const KNOWN_CHILDREN_CHART = new Set([
30
+ "cx:title",
31
+ "cx:autoTitleDeleted",
32
+ "cx:plotArea",
33
+ "cx:legend",
34
+ "cx:spPr",
35
+ "cx:extLst"
36
+ ]);
37
+ const KNOWN_CHILDREN_PLOT_AREA = new Set([
38
+ "cx:plotAreaRegion",
39
+ "cx:series",
40
+ "cx:axis",
41
+ "cx:spPr",
42
+ "cx:extLst"
43
+ ]);
44
+ const KNOWN_CHILDREN_PLOT_AREA_REGION = new Set([
45
+ "cx:layout",
46
+ "cx:plotSurface",
47
+ "cx:spPr",
48
+ "cx:series",
49
+ "cx:extLst"
50
+ ]);
51
+ const KNOWN_CHILDREN_SERIES = new Set([
52
+ "cx:tx",
53
+ "cx:spPr",
54
+ "cx:txPr",
55
+ "cx:valueColors",
56
+ "cx:valueColorPositions",
57
+ "cx:dataPt",
58
+ "cx:dataLabels",
59
+ "cx:dataId",
60
+ "cx:layoutPr",
61
+ "cx:axisId",
62
+ "cx:extLst"
63
+ ]);
64
+ const KNOWN_CHILDREN_AXIS = new Set([
65
+ "cx:catScaling",
66
+ "cx:valScaling",
67
+ // `cx:hidden`, `cx:majorTickMark`, and `cx:minorTickMark` were
68
+ // previously emitted by this library in violation of the Chart2014
69
+ // schema (hidden is an attribute; the element names are plural).
70
+ // Keep them in the known-children set so legacy files produced by
71
+ // older versions don't trip the `unknownElements` collector.
72
+ "cx:hidden",
73
+ "cx:majorTickMark",
74
+ "cx:majorTickMarks",
75
+ "cx:minorTickMark",
76
+ "cx:minorTickMarks",
77
+ "cx:numFmt",
78
+ "cx:title",
79
+ "cx:units",
80
+ "cx:majorGridlines",
81
+ "cx:minorGridlines",
82
+ "cx:spPr",
83
+ "cx:txPr",
84
+ "cx:extLst"
85
+ ]);
86
+ function collectUnknownChildren(parent, knownNames, parentPath, collector) {
87
+ if (!parent) {
88
+ return;
89
+ }
90
+ for (const child of parent.children ?? []) {
91
+ if (child.type !== "element") {
92
+ continue;
93
+ }
94
+ if (!knownNames.has(child.name)) {
95
+ collector.entries.push({
96
+ name: child.name,
97
+ path: `${parentPath}/${child.name}`
98
+ });
99
+ }
100
+ }
101
+ }
102
+ function parseChartEx(rawXml) {
103
+ const root = (0, dom_1.parseXml)(rawXml).root;
104
+ const chartDataEl = (0, dom_1.findChild)(root, "cx:chartData");
105
+ const chartEl = (0, dom_1.findChild)(root, "cx:chart");
106
+ const collector = { entries: [] };
107
+ collectUnknownChildren(root, KNOWN_CHILDREN_CHART_SPACE, "cx:chartSpace", collector);
108
+ if (chartEl) {
109
+ collectUnknownChildren(chartEl, KNOWN_CHILDREN_CHART, "cx:chartSpace/cx:chart", collector);
110
+ const plotAreaEl = (0, dom_1.findChild)(chartEl, "cx:plotArea");
111
+ if (plotAreaEl) {
112
+ collectUnknownChildren(plotAreaEl, KNOWN_CHILDREN_PLOT_AREA, "cx:chartSpace/cx:chart/cx:plotArea", collector);
113
+ const regionEl = (0, dom_1.findChild)(plotAreaEl, "cx:plotAreaRegion");
114
+ if (regionEl) {
115
+ collectUnknownChildren(regionEl, KNOWN_CHILDREN_PLOT_AREA_REGION, "cx:chartSpace/cx:chart/cx:plotArea/cx:plotAreaRegion", collector);
116
+ for (const seriesEl of (0, dom_1.findChildren)(regionEl, "cx:series")) {
117
+ collectUnknownChildren(seriesEl, KNOWN_CHILDREN_SERIES, "cx:chartSpace/cx:chart/cx:plotArea/cx:plotAreaRegion/cx:series", collector);
118
+ }
119
+ }
120
+ for (const seriesEl of (0, dom_1.findChildren)(plotAreaEl, "cx:series")) {
121
+ collectUnknownChildren(seriesEl, KNOWN_CHILDREN_SERIES, "cx:chartSpace/cx:chart/cx:plotArea/cx:series", collector);
122
+ }
123
+ for (const axisEl of (0, dom_1.findChildren)(plotAreaEl, "cx:axis")) {
124
+ collectUnknownChildren(axisEl, KNOWN_CHILDREN_AXIS, "cx:chartSpace/cx:chart/cx:plotArea/cx:axis", collector);
125
+ }
126
+ }
127
+ }
128
+ // `CT_Chart` has no `spPr` child in Chart2014, but earlier versions
129
+ // of this library emitted chart-frame styling there. Read it
130
+ // defensively, then merge into the authoritative `chartSpace.spPr`
131
+ // slot when that is absent — preserving legacy files without
132
+ // re-emitting schema-invalid XML. The write path now always uses
133
+ // `chartSpace.spPr` (`CT_ChartSpace/cx:spPr`).
134
+ const legacyChartSpPr = parseRawSpPr(chartEl ? (0, dom_1.findChild)(chartEl, "cx:spPr") : undefined);
135
+ const chartSpacespPr = parseRawSpPr((0, dom_1.findChild)(root, "cx:spPr")) ?? legacyChartSpPr;
136
+ // `cx:externalData` is a child of `cx:chartSpace` per the Chart2014
137
+ // `CT_ChartSpace` schema. Some Excel-authored files (and earlier
138
+ // versions of this library) misplaced it inside `cx:chartData`;
139
+ // read from the schema-correct location first, fall back to the
140
+ // legacy location. Prefer one or the other — concatenating both
141
+ // produces duplicate `r:id` references when a file happens to carry
142
+ // the element in BOTH places (rare but observed in files that
143
+ // migrated through multiple writers), which fails strict-open
144
+ // validation.
145
+ const externalDataAtSpace = (0, dom_1.findChildren)(root, "cx:externalData").map(el => ({
146
+ id: el.attributes["r:id"] ?? "",
147
+ autoUpdate: parseBoolAttr(el, "autoUpdate")
148
+ }));
149
+ const externalDataAtChartData = chartDataEl
150
+ ? (0, dom_1.findChildren)(chartDataEl, "cx:externalData").map(el => ({
151
+ id: el.attributes["r:id"] ?? "",
152
+ autoUpdate: parseBoolAttr(el, "autoUpdate")
153
+ }))
154
+ : [];
155
+ const externalData = externalDataAtSpace.length > 0 ? externalDataAtSpace : externalDataAtChartData;
156
+ return {
157
+ chartSpace: {
158
+ chartData: parseChartData(chartDataEl, collector),
159
+ chart: parseChart(chartEl, collector),
160
+ clrMapOvr: rawElement(root, "cx:clrMapOvr"),
161
+ // ChartSpace-level `spPr` / `txPr` are captured as structured-
162
+ // with-rawXml by `parseRawSpPr` / `parseRawTxPr` so downstream
163
+ // mutations (setSpPrFill, etc.) still work without losing the
164
+ // original XML for the unchanged field subset.
165
+ spPr: chartSpacespPr,
166
+ txPr: parseRawTxPr(root, "cx:txPr"),
167
+ // `cx:protection` / `cx:printSettings` are kept verbatim — the
168
+ // structured model does not (yet) break them into typed fields.
169
+ protection: rawElement(root, "cx:protection"),
170
+ printSettings: rawElement(root, "cx:printSettings"),
171
+ extLst: rawElement(root, "cx:extLst"),
172
+ ...(externalData.length > 0 ? { externalData } : {})
173
+ },
174
+ rawXml,
175
+ ...(collector.entries.length > 0 ? { unknownElements: collector.entries } : {})
176
+ };
177
+ }
178
+ function parseChartData(chartDataEl, collector) {
179
+ if (!chartDataEl) {
180
+ return { data: [] };
181
+ }
182
+ const data = (0, dom_1.findChildren)(chartDataEl, "cx:data").flatMap(el => parseDataEntries(el, collector));
183
+ // `cx:externalData` now lives on `ChartExSpace` (schema-correct
184
+ // location). The caller (`parseChartEx`) migrates any legacy
185
+ // occurrences found inside `cx:chartData` up to chartSpace — this
186
+ // function no longer returns the field so the migration is
187
+ // authoritative.
188
+ return { data };
189
+ }
190
+ function parseDataEntry(el, collector) {
191
+ const strDim = (0, dom_1.findChild)(el, "cx:strDim");
192
+ const numDim = (0, dom_1.findChild)(el, "cx:numDim");
193
+ // `parseIndexAttr` coerces empty / missing / non-finite / negative
194
+ // ids to `0` (see {@link parseIndexAttr}). OOXML treats absent and
195
+ // empty `id=""` identically, and sparse-array-hostile sentinels
196
+ // (`-1`, `NaN`) would poison downstream point indexing.
197
+ return {
198
+ id: parseIndexAttr(el.attributes.id),
199
+ ...(strDim ? { strDim: parseStringDimension(strDim, collector) } : {}),
200
+ ...(numDim ? { numDim: parseNumericDimension(numDim, collector) } : {})
201
+ };
202
+ }
203
+ /**
204
+ * Parse one `<cx:data id="…">` element. Per [MS-ODRAWXML] the element
205
+ * can hold multiple `<cx:strDim>` and `<cx:numDim>` children (the
206
+ * `<xsd:choice maxOccurs="unbounded">` inside CT_Data). The writer's
207
+ * `consolidateDataForRender` uses that to satisfy the `maxOccurs="1"`
208
+ * on `<cx:dataId>` in CT_Series: it packs every dimension a series
209
+ * references into ONE `<cx:data>`.
210
+ *
211
+ * The in-memory {@link ChartExDataEntry} shape stores one `strDim`
212
+ * plus one `numDim` per entry — it can't hold a 4-dimension sunburst
213
+ * in a single record. So on parse we EXPLODE a multi-dimension
214
+ * `<cx:data>` back into a contiguous run of single-dimension entries:
215
+ * the first uses the element's `id` attribute verbatim, the rest use
216
+ * fresh synthetic ids off the top of the existing id range. Series
217
+ * `dataRefs` that reference the original id still hit the first
218
+ * exploded entry, and the writer's consolidator re-merges the run on
219
+ * the next serialisation pass.
220
+ */
221
+ function parseDataEntries(el, collector) {
222
+ const baseId = parseIndexAttr(el.attributes.id);
223
+ // Collect children in document order so hierarchical sunburst /
224
+ // treemap levels come out as they were authored.
225
+ const ordered = [];
226
+ for (const child of el.children) {
227
+ if (child.type !== "element") {
228
+ continue;
229
+ }
230
+ if (child.name === "cx:strDim" || child.name === "cx:numDim") {
231
+ ordered.push(child);
232
+ }
233
+ }
234
+ if (ordered.length <= 1) {
235
+ return [parseDataEntry(el, collector)];
236
+ }
237
+ // For multi-dimension entries, produce one {@link ChartExDataEntry}
238
+ // per child, all sharing the `baseId` prefix. Use a wide numeric
239
+ // gap after the chart's highest id so the synthetic identifiers
240
+ // don't collide with legitimate, distinct `<cx:data id>` entries
241
+ // further down the `cx:chartData` block.
242
+ const entries = [];
243
+ for (let i = 0; i < ordered.length; i++) {
244
+ const child = ordered[i];
245
+ // `baseId` for the first slot preserves the series' dataRef
246
+ // linkage. Subsequent slots get an id the writer rarely picks
247
+ // on its own (10M-offset above whatever the chart already uses).
248
+ const id = i === 0 ? baseId : baseId * 1000 + 10000000 + i;
249
+ if (child.name === "cx:strDim") {
250
+ entries.push({ id, strDim: parseStringDimension(child, collector) });
251
+ }
252
+ else {
253
+ entries.push({ id, numDim: parseNumericDimension(child, collector) });
254
+ }
255
+ }
256
+ return entries;
257
+ }
258
+ function parseStringDimension(el, collector) {
259
+ return {
260
+ type: parseDimensionType(el.attributes.type, collector, "cx:strDim/@type"),
261
+ formula: childText(el, "cx:f"),
262
+ levels: (0, dom_1.findChildren)(el, "cx:lvl").map(lvl => ({
263
+ ptCount: parseOptionalInt(lvl.attributes.ptCount),
264
+ points: (0, dom_1.findChildren)(lvl, "cx:pt").map(pt => ({
265
+ index: parseIndexAttr(pt.attributes.idx),
266
+ value: (0, dom_1.textContent)(pt)
267
+ }))
268
+ }))
269
+ };
270
+ }
271
+ function parseNumericDimension(el, collector) {
272
+ return {
273
+ type: parseDimensionType(el.attributes.type, collector, "cx:numDim/@type"),
274
+ formula: childText(el, "cx:f"),
275
+ levels: (0, dom_1.findChildren)(el, "cx:lvl").map(lvl => ({
276
+ ptCount: parseOptionalInt(lvl.attributes.ptCount),
277
+ formatCode: lvl.attributes.formatCode,
278
+ // Skip `<cx:pt>` whose text content is blank / non-numeric / an
279
+ // Excel error code (`"#N/A"` etc.). Previously these flowed into
280
+ // the model as `NaN`, polluted axis-range calculations, and
281
+ // produced non-numeric `<c:v>` on the round-trip write.
282
+ points: (0, dom_1.findChildren)(lvl, "cx:pt")
283
+ .map(pt => {
284
+ const value = parseFloat((0, dom_1.textContent)(pt));
285
+ if (!Number.isFinite(value)) {
286
+ return undefined;
287
+ }
288
+ return {
289
+ index: parseIndexAttr(pt.attributes.idx),
290
+ value
291
+ };
292
+ })
293
+ .filter((p) => p !== undefined)
294
+ }))
295
+ };
296
+ }
297
+ function parseChart(chartEl, collector) {
298
+ const plotAreaEl = chartEl ? (0, dom_1.findChild)(chartEl, "cx:plotArea") : undefined;
299
+ return {
300
+ title: chartEl ? parseTitle((0, dom_1.findChild)(chartEl, "cx:title")) : undefined,
301
+ autoTitleDeleted: chartEl
302
+ ? parseBoolAttr((0, dom_1.findChild)(chartEl, "cx:autoTitleDeleted"), "val")
303
+ : undefined,
304
+ plotArea: parsePlotArea(plotAreaEl, collector),
305
+ legend: chartEl ? parseLegend((0, dom_1.findChild)(chartEl, "cx:legend"), collector) : undefined
306
+ // NOTE: `cx:spPr` on `<cx:chart>` is a schema violation (CT_Chart
307
+ // has no `spPr` child); the outer caller (`parseChartExXml`)
308
+ // migrates any legacy `chart.spPr` bytes into `chartSpace.spPr`
309
+ // before this return value is consumed. See the block above the
310
+ // `parseChart` caller for the migration path.
311
+ };
312
+ }
313
+ function parsePlotArea(plotAreaEl, collector) {
314
+ if (!plotAreaEl) {
315
+ return {};
316
+ }
317
+ const regionEl = (0, dom_1.findChild)(plotAreaEl, "cx:plotAreaRegion");
318
+ const axis = (0, dom_1.findChildren)(plotAreaEl, "cx:axis").map(el => parseAxis(el, collector));
319
+ if (regionEl) {
320
+ const regionSeriesPath = "cx:chartSpace/cx:chart/cx:plotArea/cx:plotAreaRegion/cx:series";
321
+ // `CT_PlotAreaRegion` (Chart2014) has children `plotSurface?` and
322
+ // `series*` — there is no `layout` or `spPr` child. The parser
323
+ // previously pulled `cx:spPr` directly from the region, which was a
324
+ // schema violation. `plotSurface` wraps an inner `cx:spPr`, so we
325
+ // must dig one level deeper.
326
+ const plotSurfaceEl = (0, dom_1.findChild)(regionEl, "cx:plotSurface");
327
+ return {
328
+ plotAreaRegion: {
329
+ // `layout` is not a real `plotAreaRegion` child, but earlier
330
+ // versions of this library emitted `<cx:layout/>` there — keep
331
+ // parsing it so round-trip of those files doesn't drop state.
332
+ layout: parseRawLayout((0, dom_1.findChild)(regionEl, "cx:layout")),
333
+ plotSurface: plotSurfaceEl ? parseRawSpPr((0, dom_1.findChild)(plotSurfaceEl, "cx:spPr")) : undefined,
334
+ series: (0, dom_1.findChildren)(regionEl, "cx:series").map(el => parseSeries(el, collector, regionSeriesPath)),
335
+ // `<cx:extLst>` nested inside `<cx:plotAreaRegion>` is a
336
+ // Chart2014 extension point (Excel writes `cx14:*` annotations
337
+ // here for pivot-backed region maps). Preserve the raw bytes
338
+ // for round-trip; the parser never interprets them.
339
+ extLst: rawElement(regionEl, "cx:extLst")
340
+ },
341
+ spPr: parseRawSpPr((0, dom_1.findChild)(plotAreaEl, "cx:spPr")),
342
+ extLst: rawElement(plotAreaEl, "cx:extLst"),
343
+ ...(axis.length > 0 ? { axis } : {})
344
+ };
345
+ }
346
+ const plainSeriesPath = "cx:chartSpace/cx:chart/cx:plotArea/cx:series";
347
+ const series = (0, dom_1.findChildren)(plotAreaEl, "cx:series").map(el => parseSeries(el, collector, plainSeriesPath));
348
+ return {
349
+ ...(series.length > 0 ? { series } : {}),
350
+ spPr: parseRawSpPr((0, dom_1.findChild)(plotAreaEl, "cx:spPr")),
351
+ extLst: rawElement(plotAreaEl, "cx:extLst"),
352
+ ...(axis.length > 0 ? { axis } : {})
353
+ };
354
+ }
355
+ // ECMA-376 §21.3 enumerates the legal `cx:series/@layoutId` values. Preserve
356
+ // the attribute when it matches the structured union; otherwise fall back to
357
+ // "clusteredColumn" (the most permissive single-axis layout) and surface the
358
+ // original string via `unknownElements` so callers can diagnose. Silently
359
+ // defaulting to e.g. "sunburst" would mis-route every unknown chart to the
360
+ // sunburst vector renderer.
361
+ const CHART_EX_SERIES_LAYOUT_IDS = new Set([
362
+ "clusteredColumn",
363
+ "waterfall",
364
+ "funnel",
365
+ "boxWhisker",
366
+ "paretoLine",
367
+ "regionMap",
368
+ "sunburst",
369
+ "treemap"
370
+ ]);
371
+ function parseSeriesLayoutId(value, collector, seriesPath) {
372
+ if (value !== undefined && CHART_EX_SERIES_LAYOUT_IDS.has(value)) {
373
+ return { layoutId: value };
374
+ }
375
+ collector?.entries.push({
376
+ name: value === undefined ? "@layoutId(missing)" : `@layoutId=${value}`,
377
+ path: seriesPath
378
+ });
379
+ // "clusteredColumn" is the neutral fallback: a plain column chart will at
380
+ // least render bars for the available data rather than being reinterpreted
381
+ // as a sunburst / treemap, which have different data-shape requirements.
382
+ //
383
+ // When the original attribute was present but unknown (e.g. a future
384
+ // layoutId like `"funnel3D"` that this version doesn't model), keep it
385
+ // under `rawLayoutId` so the writer can re-emit the byte-original
386
+ // attribute during round-trip. Without this, re-saving a file with
387
+ // a vendor extension silently downgrades the chart to a plain column
388
+ // chart — worse than leaving the bytes alone.
389
+ return {
390
+ layoutId: "clusteredColumn",
391
+ rawLayoutId: value
392
+ };
393
+ }
394
+ function parseSeries(el, collector, seriesPath) {
395
+ const dataRefs = (0, dom_1.findChildren)(el, "cx:dataId").map(dataId => ({
396
+ dataId: parseIndexAttr(dataId.attributes.val)
397
+ }));
398
+ // Primary form per the ECMA-376 chartEx schema and Microsoft Excel's
399
+ // own output: `<cx:axisId val="N"/>` (CT_UnsignedInteger with a
400
+ // required `val` attribute). A previous revision of our renderer
401
+ // mis-read the schema and emitted `<cx:axisId>N</cx:axisId>` as a
402
+ // text-content form — that form is not valid chartEx and Excel
403
+ // rejects it on open (drops the whole drawing). Read `val` first,
404
+ // then fall back to text content so round-trips of files authored
405
+ // by that buggy writer still recover the id instead of silently
406
+ // dropping it to `undefined`. Filter unresolvable ids so the
407
+ // returned array stays `number[]`.
408
+ const axisId = (0, dom_1.findChildren)(el, "cx:axisId")
409
+ .map(axis => {
410
+ // Prefer the `val` attribute when present and non-empty; fall
411
+ // back to text content for round-tripping files authored by
412
+ // buggy writers that emit the id as element text.
413
+ const rawAttr = axis.attributes.val;
414
+ if (rawAttr !== undefined && rawAttr !== "") {
415
+ return parseIndexAttr(rawAttr);
416
+ }
417
+ const text = (0, dom_1.textContent)(axis).trim();
418
+ if (text.length > 0) {
419
+ const parsed = Number(text);
420
+ if (Number.isFinite(parsed) && parsed >= 0) {
421
+ return Math.round(parsed);
422
+ }
423
+ }
424
+ return undefined;
425
+ })
426
+ .filter((id) => id !== undefined);
427
+ const tx = parseSeriesText((0, dom_1.findChild)(el, "cx:tx"));
428
+ const layoutPr = parseLayoutProperties((0, dom_1.findChild)(el, "cx:layoutPr"));
429
+ const layoutIdResult = parseSeriesLayoutId(el.attributes.layoutId, collector, seriesPath ?? "cx:series");
430
+ return {
431
+ layoutId: layoutIdResult.layoutId,
432
+ ...(layoutIdResult.rawLayoutId !== undefined
433
+ ? { rawLayoutId: layoutIdResult.rawLayoutId }
434
+ : {}),
435
+ hidden: parseBoolAttr(el, "hidden"),
436
+ ownerIdx: parseOptionalInt(el.attributes.ownerIdx),
437
+ ...(tx ? { tx } : {}),
438
+ spPr: parseRawSpPr((0, dom_1.findChild)(el, "cx:spPr")),
439
+ txPr: parseRawTxPr(el, "cx:txPr"),
440
+ // `<cx:valueColors>` and `<cx:valueColorPositions>` carry
441
+ // value-driven colour gradients (region map / treemap). The
442
+ // structured model doesn't yet interpret the stops, but we must
443
+ // round-trip them or the gradient evaporates on save. `rawElement`
444
+ // preserves the full outer element including attributes.
445
+ valueColors: rawElement(el, "cx:valueColors"),
446
+ valueColorPositions: rawElement(el, "cx:valueColorPositions"),
447
+ ...(dataRefs.length > 0 ? { dataRefs } : {}),
448
+ ...(layoutPr ? { layoutPr } : {}),
449
+ ...(axisId.length > 0 ? { axisId } : {}),
450
+ dataLabels: parseDataLabels((0, dom_1.findChild)(el, "cx:dataLabels"), collector, seriesPath),
451
+ dataPt: (0, dom_1.findChildren)(el, "cx:dataPt").map(pt => ({
452
+ idx: parseIndexAttr(pt.attributes.idx),
453
+ spPr: parseRawSpPr((0, dom_1.findChild)(pt, "cx:spPr"))
454
+ })),
455
+ extLst: rawElement(el, "cx:extLst")
456
+ };
457
+ }
458
+ function parseSeriesText(el) {
459
+ if (!el) {
460
+ return undefined;
461
+ }
462
+ // Check for structured rich-text first. `<cx:tx>/<cx:rich>…</cx:rich>`
463
+ // is how Excel authors encode per-run formatting on a series name
464
+ // (bold accent series, colour-coded series, etc.); previously the
465
+ // parser ignored this branch entirely and left `tx` undefined, so
466
+ // round-tripping such a series lost the entire name unless the raw
467
+ // bytes path was taken.
468
+ const richEl = (0, dom_1.findChild)(el, "cx:rich");
469
+ if (richEl) {
470
+ const rich = parseRichText(richEl);
471
+ if (rich) {
472
+ return { rich };
473
+ }
474
+ }
475
+ const txData = (0, dom_1.findChild)(el, "cx:txData");
476
+ if (!txData) {
477
+ return undefined;
478
+ }
479
+ const formula = childText(txData, "cx:f");
480
+ if (formula) {
481
+ // Capture the cached resolved value alongside the formula so
482
+ // reading clients (legend preview, title fallback, saved-chart
483
+ // displays before recalculation) can show the user's label
484
+ // immediately. Previously only the formula string was stored,
485
+ // so Excel-authored `<cx:tx><cx:txData><cx:f>...</cx:f><cx:v>
486
+ // Label</cx:v></cx:txData></cx:tx>` lost `Label` on round-trip.
487
+ const cachedValue = childText(txData, "cx:v");
488
+ return {
489
+ strRef: cachedValue !== undefined ? { formula, cached: cachedValue } : { formula }
490
+ };
491
+ }
492
+ const value = childText(txData, "cx:v");
493
+ return value !== undefined ? { value } : undefined;
494
+ }
495
+ function parseLayoutProperties(el) {
496
+ if (!el) {
497
+ return undefined;
498
+ }
499
+ const binning = (0, dom_1.findChild)(el, "cx:binning");
500
+ const subtotalsEl = (0, dom_1.findChild)(el, "cx:subtotals");
501
+ // Per the [MS-ODRAWXML] CT_Subtotals schema, children are named
502
+ // `<cx:idx val="N"/>` — with the INDEX in the `val` attribute.
503
+ // Earlier revisions of this library used a non-schema `<cx:subtotal
504
+ // idx="N"/>` element; accept both on parse. `<cx:idx>` schema has
505
+ // the index in `val`, legacy `<cx:subtotal>` had it in `idx`.
506
+ const subtotals = subtotalsEl
507
+ ? [
508
+ ...(0, dom_1.findChildren)(subtotalsEl, "cx:idx").map(st => ({
509
+ idx: parseIndexAttr(st.attributes.val)
510
+ })),
511
+ ...(0, dom_1.findChildren)(subtotalsEl, "cx:subtotal").map(st => ({
512
+ idx: parseIndexAttr(st.attributes.idx)
513
+ }))
514
+ ]
515
+ : undefined;
516
+ const parentLabelLayout = childVal(el, "cx:parentLabelLayout");
517
+ // Per the official [MS-ODRAWXML] CT_SeriesLayoutProperties schema,
518
+ // several per-type flags live on wrapper elements rather than as
519
+ // flat children:
520
+ //
521
+ // * `<cx:visibility>` carries the boxWhisker show* flags
522
+ // (`meanLine`, `meanMarker`, `nonoutliers`, `outliers`) as
523
+ // attributes, plus the waterfall `connectorLines` flag.
524
+ // * `<cx:statistics>` carries the boxWhisker `quartileMethod`
525
+ // attribute.
526
+ // * `<cx:geography>` carries regionMap `projectionType` /
527
+ // `viewedRegionType` attributes.
528
+ // * `<cx:regionLabelLayout>` carries regionMap `regionLabels` via
529
+ // a `val` attribute.
530
+ //
531
+ // Earlier revisions of this library wrote each of these as a flat
532
+ // element like `<cx:showMeanLine val="1"/>` / `<cx:projection val="…"/>`
533
+ // — that output was schema-invalid (Excel 2016+ rejects the whole
534
+ // ChartEx part on load) but we still need to parse files produced
535
+ // by those versions. Each property below checks the correct schema
536
+ // location first, then falls back to the flat form for legacy
537
+ // on-disk bytes.
538
+ const visibilityEl = (0, dom_1.findChild)(el, "cx:visibility");
539
+ const statisticsEl = (0, dom_1.findChild)(el, "cx:statistics");
540
+ const geographyEl = (0, dom_1.findChild)(el, "cx:geography");
541
+ const regionLabelLayoutEl = (0, dom_1.findChild)(el, "cx:regionLabelLayout");
542
+ const quartileMethod = statisticsEl?.attributes.quartileMethod ?? childVal(el, "cx:quartileMethod");
543
+ const projection = geographyEl?.attributes.projectionType ?? childVal(el, "cx:projection");
544
+ const regionLabelsRaw = regionLabelLayoutEl?.attributes.val ?? childVal(el, "cx:regionLabels");
545
+ const regionLabels = regionLabelsRaw === "bestFitOnly" ? "bestFit" : regionLabelsRaw;
546
+ const geoMappingLevelRaw = geographyEl?.attributes.viewedRegionType ?? childVal(el, "cx:geoMappingLevel");
547
+ // Map the spec-canonical `countryRegion` → public `country`;
548
+ // `dataOnly` → `automatic`. Other values pass through unchanged.
549
+ const geoMappingLevel = geoMappingLevelRaw === "countryRegion"
550
+ ? "country"
551
+ : geoMappingLevelRaw === "dataOnly"
552
+ ? "automatic"
553
+ : geoMappingLevelRaw;
554
+ // Collect each child only when the XML actually contains it. Emitting
555
+ // `subtotals: []` / `parentLabelLayout: undefined` triggers
556
+ // `hasStructuredLayoutProperties` (see chart-ex-renderer.ts) and forces the
557
+ // writer down the structured path, discarding `_rawXml`. That produced
558
+ // empty / corrupt `<cx:layoutPr>` sections for any ChartEx that was loaded
559
+ // and re-written without an explicit structured mutation.
560
+ return {
561
+ _rawXml: serializeElement(el),
562
+ ...(parentLabelLayout !== undefined
563
+ ? {
564
+ parentLabelLayout: parentLabelLayout
565
+ }
566
+ : {}),
567
+ ...(subtotals !== undefined ? { subtotals } : {}),
568
+ ...(() => {
569
+ // `connectorLines` (waterfall) is a `<cx:visibility>` attribute
570
+ // per CT_SeriesLayoutProperties. Read the attribute first; fall
571
+ // back to the legacy `<cx:connectorLines val="…"/>` flat element
572
+ // produced by older revisions of this library.
573
+ const raw = visibilityEl?.attributes.connectorLines;
574
+ if (raw !== undefined) {
575
+ const b = parseBoolString(raw);
576
+ return b !== undefined ? { connectorLines: b } : {};
577
+ }
578
+ const v = parseCtBoolean((0, dom_1.findChild)(el, "cx:connectorLines"));
579
+ return v !== undefined ? { connectorLines: v } : {};
580
+ })(),
581
+ ...(binning
582
+ ? {
583
+ binning: {
584
+ // Validate against `CT_Binning/@intervalClosed`
585
+ // enumeration (`"l" | "r"`). Unknown values are dropped
586
+ // rather than cast through — silently storing garbage
587
+ // here let injection attacks break out of the attribute
588
+ // on round-trip.
589
+ intervalClosed: (binning.attributes.intervalClosed === "l" ||
590
+ binning.attributes.intervalClosed === "r"
591
+ ? binning.attributes.intervalClosed
592
+ : undefined),
593
+ underflow: parseOptionalFloat(binning.attributes.underflow),
594
+ overflow: parseOptionalFloat(binning.attributes.overflow),
595
+ // Per [MS-ODRAWXML] CT_Binning, `binSize` / `binCount` are
596
+ // element-content simple types (`<cx:binSize>0.5</cx:binSize>`),
597
+ // but Microsoft Excel 2016+ actually emits them with a `val`
598
+ // attribute (`<cx:binCount val="5"/>`) and rejects the text
599
+ // form on load. Accept both shapes so files authored by
600
+ // our earlier writers (text form) AND by Excel itself
601
+ // (attribute form) both round-trip. Nullish coalescing
602
+ // (`??`) is NOT enough here — self-closing `<cx:binCount/>`
603
+ // returns empty string from `childText` (NOT nullish),
604
+ // which would mask the `val` attribute. Use an explicit
605
+ // "non-empty-string or fall back" pattern.
606
+ binSize: parseOptionalFloat((childText(binning, "cx:binSize") || undefined) ?? childVal(binning, "cx:binSize")),
607
+ binCount: parseOptionalInt((childText(binning, "cx:binCount") || undefined) ?? childVal(binning, "cx:binCount")),
608
+ // `binType` is a library-internal discriminator — the
609
+ // official CT_Binning schema has no `<cx:auto>` /
610
+ // `<cx:categories>` / `<cx:manual>` elements. Map the
611
+ // schema-valid inputs onto the discriminator so existing
612
+ // callers who read `binType` continue to work; tolerate
613
+ // the legacy element forms on the way in.
614
+ binType: (0, dom_1.findChild)(binning, "cx:auto")
615
+ ? "auto"
616
+ : (0, dom_1.findChild)(binning, "cx:categories")
617
+ ? "categories"
618
+ : (0, dom_1.findChild)(binning, "cx:manual")
619
+ ? "manual"
620
+ : (0, dom_1.findChild)(binning, "cx:binSize")
621
+ ? "binSize"
622
+ : (0, dom_1.findChild)(binning, "cx:binCount")
623
+ ? "binCount"
624
+ : "auto"
625
+ }
626
+ }
627
+ : {}),
628
+ ...(() => {
629
+ const v = parseCtBoolean((0, dom_1.findChild)(el, "cx:paretoLine"));
630
+ return v !== undefined ? { paretoLine: v } : {};
631
+ })(),
632
+ ...(quartileMethod !== undefined
633
+ ? {
634
+ quartileMethod: quartileMethod
635
+ }
636
+ : {}),
637
+ ...(() => {
638
+ // `meanLine` / `meanMarker` / `nonoutliers` / `outliers` are
639
+ // `<cx:visibility>` attributes per the schema. Read the
640
+ // attribute first; fall back to the legacy `<cx:showMeanLine
641
+ // val="…"/>` flat element for files authored by older
642
+ // revisions of this library.
643
+ const raw = visibilityEl?.attributes.meanLine;
644
+ if (raw !== undefined) {
645
+ const b = parseBoolString(raw);
646
+ return b !== undefined ? { showMeanLine: b } : {};
647
+ }
648
+ const v = parseCtBoolean((0, dom_1.findChild)(el, "cx:showMeanLine"));
649
+ return v !== undefined ? { showMeanLine: v } : {};
650
+ })(),
651
+ ...(() => {
652
+ const raw = visibilityEl?.attributes.meanMarker;
653
+ if (raw !== undefined) {
654
+ const b = parseBoolString(raw);
655
+ return b !== undefined ? { showMeanMarker: b } : {};
656
+ }
657
+ const v = parseCtBoolean((0, dom_1.findChild)(el, "cx:showMeanMarker"));
658
+ return v !== undefined ? { showMeanMarker: v } : {};
659
+ })(),
660
+ ...(() => {
661
+ const raw = visibilityEl?.attributes.nonoutliers;
662
+ if (raw !== undefined) {
663
+ const b = parseBoolString(raw);
664
+ return b !== undefined ? { showInnerPoints: b } : {};
665
+ }
666
+ const v = parseCtBoolean((0, dom_1.findChild)(el, "cx:showInnerPoints"));
667
+ return v !== undefined ? { showInnerPoints: v } : {};
668
+ })(),
669
+ ...(() => {
670
+ const raw = visibilityEl?.attributes.outliers;
671
+ if (raw !== undefined) {
672
+ const b = parseBoolString(raw);
673
+ return b !== undefined ? { showOutlierPoints: b } : {};
674
+ }
675
+ const v = parseCtBoolean((0, dom_1.findChild)(el, "cx:showOutlierPoints"));
676
+ return v !== undefined ? { showOutlierPoints: v } : {};
677
+ })(),
678
+ ...(projection !== undefined
679
+ ? { projection: projection }
680
+ : {}),
681
+ ...(regionLabels !== undefined
682
+ ? { regionLabels: regionLabels }
683
+ : {}),
684
+ ...(geoMappingLevel !== undefined
685
+ ? {
686
+ geoMappingLevel: geoMappingLevel
687
+ }
688
+ : {}),
689
+ extLst: rawElement(el, "cx:extLst")
690
+ };
691
+ }
692
+ function parseDataLabels(el, collector, parentPath) {
693
+ if (!el) {
694
+ return undefined;
695
+ }
696
+ const visibility = (0, dom_1.findChild)(el, "cx:visibility");
697
+ // ECMA-376 `ST_DLblPosition` full enumeration (Chart2014 §21.3.2.30).
698
+ // Values beyond the classic-chart subset — `ctrEnd`, `inStart`,
699
+ // `outStart` — are emitted by Excel for waterfall / funnel / box &
700
+ // whisker layouts where label anchoring is richer than the basic
701
+ // "inside/outside/centre/best-fit" vocabulary. Previously the
702
+ // enum was restricted to the classic-chart subset, causing the
703
+ // validator to strip (and log) every richer value encountered in
704
+ // user files, silently reverting those labels to default placement.
705
+ const positionValues = [
706
+ "ctr",
707
+ "l",
708
+ "r",
709
+ "t",
710
+ "b",
711
+ "inBase",
712
+ "inEnd",
713
+ "inStart",
714
+ "outEnd",
715
+ "outStart",
716
+ "ctrEnd",
717
+ "bestFit"
718
+ ];
719
+ const pathPrefix = parentPath ?? "cx:dataLabels";
720
+ return {
721
+ visibility: visibility
722
+ ? {
723
+ seriesName: parseBoolAttr(visibility, "seriesName"),
724
+ categoryName: parseBoolAttr(visibility, "categoryName"),
725
+ value: parseBoolAttr(visibility, "value"),
726
+ numFmt: parseBoolAttr(visibility, "numFmt")
727
+ }
728
+ : undefined,
729
+ position: validateEnum((0, dom_1.findChild)(el, "cx:dataLabel")?.attributes.pos, positionValues, collector, `${pathPrefix}/cx:dataLabel/@pos`),
730
+ separator: childText(el, "cx:separator"),
731
+ numFmt: (0, dom_1.findChild)(el, "cx:numFmt")?.attributes.formatCode,
732
+ spPr: parseRawSpPr((0, dom_1.findChild)(el, "cx:spPr")),
733
+ txPr: parseRawTxPr(el, "cx:txPr")
734
+ };
735
+ }
736
+ /**
737
+ * Parse `<cx:majorGridlines>` / `<cx:minorGridlines>` — each element
738
+ * wraps a single optional `<cx:spPr>` child describing the gridline
739
+ * stroke. Returns an empty `ShapeProperties` when the element is
740
+ * present but has no `<cx:spPr>` (meaning "default-styled gridlines");
741
+ * `undefined` when the parent element is absent entirely.
742
+ */
743
+ function parseGridlines(el) {
744
+ if (!el) {
745
+ return undefined;
746
+ }
747
+ const spPrEl = (0, dom_1.findChild)(el, "cx:spPr");
748
+ if (!spPrEl) {
749
+ return {};
750
+ }
751
+ return parseRawSpPr(spPrEl);
752
+ }
753
+ function parseAxis(el, collector) {
754
+ const numFmt = (0, dom_1.findChild)(el, "cx:numFmt");
755
+ const valScaling = (0, dom_1.findChild)(el, "cx:valScaling");
756
+ const catScaling = (0, dom_1.findChild)(el, "cx:catScaling");
757
+ // OOXML `ST_TickMark` values are `cross | in | out | none`; the public
758
+ // API uses friendlier `inside` / `outside` aliases (matching classic
759
+ // `types.ts:TickMark`). Map during parse so callers see a consistent
760
+ // vocabulary regardless of whether they came from classic or ChartEx.
761
+ const tickMarkOoxml = ["cross", "in", "out", "none"];
762
+ const mapTickMark = (v) => {
763
+ if (v === undefined) {
764
+ return undefined;
765
+ }
766
+ if (v === "in") {
767
+ return "inside";
768
+ }
769
+ if (v === "out") {
770
+ return "outside";
771
+ }
772
+ return v;
773
+ };
774
+ return {
775
+ axisId: parseIndexAttr(el.attributes.id),
776
+ type: (0, dom_1.findChild)(el, "cx:valScaling") ? "val" : "cat",
777
+ // Per Chart2014 `CT_Axis`, `hidden` is an **attribute** on
778
+ // `<cx:axis>`, not a child element. Accept both forms so we can
779
+ // round-trip files our earlier versions incorrectly produced: check
780
+ // the attribute first, fall back to the legacy child element.
781
+ // Per Chart2014 `CT_Axis`, `hidden` is an **attribute** on
782
+ // `<cx:axis>`, not a child element. Accept both forms so we can
783
+ // round-trip files our earlier versions incorrectly produced: check
784
+ // the attribute first, fall back to the legacy child element.
785
+ // When using the legacy child form, treat a missing `val` as
786
+ // `true` per `CT_Boolean` (previously the library only read an
787
+ // explicit `val` and dropped the hidden flag when absent).
788
+ hidden: parseBoolAttr(el, "hidden") ?? parseCtBoolean((0, dom_1.findChild)(el, "cx:hidden")),
789
+ // Element names are plural in the schema (`majorTickMarks`,
790
+ // `minorTickMarks`). Again accept the singular form for backward
791
+ // compatibility with files we produced before the rename.
792
+ // Per [MS-ODRAWXML] CT_TickMarks the discriminator is a `type`
793
+ // attribute — not `val` like most other chartEx elements. Read
794
+ // `type` first, fall back to `val` for files authored by older
795
+ // revisions of this library (which wrongly used `val`).
796
+ majorTickMark: mapTickMark(validateEnum((0, dom_1.findChild)(el, "cx:majorTickMarks")?.attributes.type ??
797
+ (0, dom_1.findChild)(el, "cx:majorTickMark")?.attributes.type ??
798
+ childVal(el, "cx:majorTickMarks") ??
799
+ childVal(el, "cx:majorTickMark"), tickMarkOoxml, collector, "cx:axis/cx:majorTickMarks/@type")),
800
+ minorTickMark: mapTickMark(validateEnum((0, dom_1.findChild)(el, "cx:minorTickMarks")?.attributes.type ??
801
+ (0, dom_1.findChild)(el, "cx:minorTickMark")?.attributes.type ??
802
+ childVal(el, "cx:minorTickMarks") ??
803
+ childVal(el, "cx:minorTickMark"), tickMarkOoxml, collector, "cx:axis/cx:minorTickMarks/@type")),
804
+ numFmt: numFmt
805
+ ? {
806
+ // `formatCode` is a required attribute per
807
+ // `CT_NumFmt/@formatCode`. When the source omits it,
808
+ // default to `"General"` (Excel's behaviour) rather than
809
+ // an empty string — the writer round-trips that default
810
+ // without producing a schema-invalid empty attribute.
811
+ formatCode: numFmt.attributes.formatCode || "General",
812
+ sourceLinked: parseBoolAttr(numFmt, "sourceLinked")
813
+ }
814
+ : undefined,
815
+ title: parseTitle((0, dom_1.findChild)(el, "cx:title")),
816
+ // `<cx:majorGridlines>` / `<cx:minorGridlines>` each wrap a
817
+ // single `<cx:spPr>` describing gridline stroke / colour. The
818
+ // structured `ShapeProperties` is extracted via `parseRawSpPr`
819
+ // so downstream consumers can read the colour without touching
820
+ // raw XML. Absent element → `undefined` on the model.
821
+ majorGridlines: parseGridlines((0, dom_1.findChild)(el, "cx:majorGridlines")),
822
+ minorGridlines: parseGridlines((0, dom_1.findChild)(el, "cx:minorGridlines")),
823
+ spPr: parseRawSpPr((0, dom_1.findChild)(el, "cx:spPr")),
824
+ txPr: parseRawTxPr(el, "cx:txPr"),
825
+ valScaling: valScaling
826
+ ? {
827
+ min: parseOptionalFloat(valScaling.attributes.min),
828
+ max: parseOptionalFloat(valScaling.attributes.max),
829
+ majorUnit: parseOptionalFloat(valScaling.attributes.majorUnit),
830
+ minorUnit: parseOptionalFloat(valScaling.attributes.minorUnit)
831
+ }
832
+ : undefined,
833
+ catScaling: catScaling
834
+ ? {
835
+ gapWidth: parseOptionalFloat(catScaling.attributes.gapWidth)
836
+ }
837
+ : undefined,
838
+ // `<cx:units>` is a value-axis display-unit scaler (thousands /
839
+ // millions / custom). The library doesn't yet interpret its
840
+ // `cx:unit` / `cx:dispUnitsLbl` children, but preserving the raw
841
+ // bytes keeps round-trip byte-equal for files that carry the
842
+ // element. Without this the element evaporated on save.
843
+ units: rawElement(el, "cx:units"),
844
+ extLst: rawElement(el, "cx:extLst")
845
+ };
846
+ }
847
+ function parseLegend(el, collector) {
848
+ if (!el) {
849
+ return undefined;
850
+ }
851
+ const legendPositions = ["b", "l", "r", "t", "tr"];
852
+ const legendAligns = ["ctr", "l", "r", "t", "b"];
853
+ // `CT_Legend` (Chart2014) sequence: `legendEntry* → spPr? → txPr? →
854
+ // extLst?`. The parser previously only read `pos` / `align` /
855
+ // `overlay` / `spPr` / legendEntry idx; every other field was
856
+ // silently dropped, breaking round-trip of legends with author-
857
+ // supplied text styling, per-entry deletions, and vendor
858
+ // extensions.
859
+ return {
860
+ legendPos: validateEnum(el.attributes.pos, legendPositions, collector, "cx:legend/@pos"),
861
+ align: validateEnum(el.attributes.align, legendAligns, collector, "cx:legend/@align"),
862
+ overlay: parseBoolAttr(el, "overlay"),
863
+ spPr: parseRawSpPr((0, dom_1.findChild)(el, "cx:spPr")),
864
+ txPr: parseRawTxPr(el, "cx:txPr"),
865
+ extLst: rawElement(el, "cx:extLst"),
866
+ legendEntries: (0, dom_1.findChildren)(el, "cx:legendEntry").map(entry => ({
867
+ index: parseIndexAttr(entry.attributes.idx),
868
+ // Per `CT_LegendEntry` in the Chart2014 XSD, both `idx` and
869
+ // `delete` are attributes (`xsd:unsignedInt` and `xsd:boolean`
870
+ // respectively) — despite the type name `CT_Boolean` appearing
871
+ // elsewhere in the schema for CHILD-element booleans. Excel's
872
+ // own output is `<cx:legendEntry idx="0" delete="1"/>` with
873
+ // attribute form, and the matching renderer emits the same
874
+ // shape. Default per schema when `delete` is absent is `false`.
875
+ delete: parseBoolAttr(entry, "delete"),
876
+ txPr: parseRawTxPr(entry, "cx:txPr"),
877
+ extLst: rawElement(entry, "cx:extLst")
878
+ }))
879
+ };
880
+ }
881
+ function parseTitle(el) {
882
+ if (!el) {
883
+ return undefined;
884
+ }
885
+ const txEl = (0, dom_1.findChild)(el, "cx:tx");
886
+ const text = parseRichText((0, dom_1.findChild)(txEl ?? emptyElement(), "cx:rich"));
887
+ // `<cx:tx>` can hold EITHER `<cx:rich>` (structured rich text) OR
888
+ // `<cx:txData>` (formula-backed text with cached value). The parser
889
+ // previously only handled the rich variant, so a title authored as
890
+ // `<cx:tx><cx:txData><cx:f>Sheet1!$A$1</cx:f><cx:v>Q1 Sales</cx:v></cx:txData></cx:tx>`
891
+ // silently dropped the formula on round-trip. Map `txData` onto the
892
+ // classic `ChartTitle.strRef` shape so writers / consumers can use
893
+ // one API for both formula-linked titles.
894
+ const txDataEl = (0, dom_1.findChild)(txEl ?? emptyElement(), "cx:txData");
895
+ const formula = txDataEl ? childText(txDataEl, "cx:f") : undefined;
896
+ const cachedValue = txDataEl ? childText(txDataEl, "cx:v") : undefined;
897
+ const strRef = formula
898
+ ? {
899
+ formula,
900
+ cache: cachedValue !== undefined
901
+ ? { points: [{ index: 0, value: cachedValue }] }
902
+ : { points: [] }
903
+ }
904
+ : undefined;
905
+ const overlay = parseBoolAttr((0, dom_1.findChild)(el, "cx:overlay"), "val");
906
+ const spPr = parseRawSpPr((0, dom_1.findChild)(el, "cx:spPr"));
907
+ const txPr = parseRawTxPr(el, "cx:txPr");
908
+ const rawTx = rawElement(el, "cx:tx");
909
+ // Return undefined for an empty `<cx:title/>` so downstream consumers
910
+ // (snapshot tests, change detection) don't see a phantom title
911
+ // object with all fields undefined. Parsing a self-closing title
912
+ // element produces `rawTx` that's itself a self-closing tag —
913
+ // treat that as equivalent to absent unless structured state is
914
+ // present.
915
+ if (text === undefined &&
916
+ strRef === undefined &&
917
+ overlay === undefined &&
918
+ spPr === undefined &&
919
+ txPr === undefined &&
920
+ (rawTx === undefined || /^<cx:tx\s*\/>$/.test(rawTx.trim()))) {
921
+ return undefined;
922
+ }
923
+ return { text, strRef, overlay, spPr, txPr, rawTx };
924
+ }
925
+ function parseRichText(el) {
926
+ if (!el) {
927
+ return undefined;
928
+ }
929
+ const paragraphs = (0, dom_1.findChildren)(el, "a:p").map(p => {
930
+ // Paragraph properties — `<a:pPr>` with optional `<a:defRPr>` child
931
+ // carrying default run formatting for the paragraph. Not fully
932
+ // modelled in `ChartParagraph` today; capturing it as raw XML so
933
+ // mutation-aware writers can still preserve author intent.
934
+ const runs = (0, dom_1.findChildren)(p, "a:r").map(r => {
935
+ const runText = childText(r, "a:t") ?? "";
936
+ // Parse `<a:rPr>` into structured `ChartTextProperties`. Wrapping
937
+ // `<a:defRPr>` around the rPr attributes is the trick that lets
938
+ // us reuse `parseTxPr`, which expects a `defRPr`-style XML block.
939
+ // Previously the parser dropped run-level properties entirely —
940
+ // any bold/italic/colour/font on a rich-text title or series
941
+ // caption silently disappeared on round-trip unless the caller
942
+ // explicitly used the raw-bytes path.
943
+ const rPr = (0, dom_1.findChild)(r, "a:rPr");
944
+ if (!rPr) {
945
+ return { text: runText };
946
+ }
947
+ const rPrRaw = rawElementFromNode(rPr);
948
+ if (!rPrRaw) {
949
+ return { text: runText };
950
+ }
951
+ // `parseTxPr` reads `<a:defRPr>` or `<a:rPr>` fragments from
952
+ // `_rawXml`; the element name doesn't matter, the attribute /
953
+ // child extraction does. Emit a thin `<a:defRPr>` envelope and
954
+ // feed the inner bytes through.
955
+ const innerBytes = rPrRaw
956
+ .replace(/^<a:rPr\b/, "<a:defRPr")
957
+ .replace(/<\/a:rPr>$/, "</a:defRPr>");
958
+ const envelope = `<a:txPr><a:p>${innerBytes}</a:p></a:txPr>`;
959
+ const parsed = (0, shape_properties_1.parseTxPr)({ _rawXml: envelope });
960
+ if (!parsed || Object.keys(parsed).length === 0) {
961
+ return { text: runText };
962
+ }
963
+ // Strip the `_rawXml` that `parseTxPr` may have carried through;
964
+ // run properties are flat, not a full `ChartTextProperties`
965
+ // wrapper.
966
+ const { _rawXml, ...structured } = parsed;
967
+ return {
968
+ text: runText,
969
+ properties: structured
970
+ };
971
+ });
972
+ return { runs };
973
+ });
974
+ return paragraphs.length > 0 ? { paragraphs } : undefined;
975
+ }
976
+ function parseRawLayout(el) {
977
+ const raw = rawElementFromNode(el);
978
+ // `ChartLayout._rawXml` was added so this path no longer needs `as any`.
979
+ return raw ? { _rawXml: raw } : undefined;
980
+ }
981
+ function parseRawSpPr(el) {
982
+ const raw = rawElementFromNode(el);
983
+ if (!raw) {
984
+ return undefined;
985
+ }
986
+ // Dual representation: keep the original XML for lossless round-trip of
987
+ // elements this parser does not structurally understand (a:xfrm,
988
+ // a:prstGeom, a:custGeom, future DrawingML extensions…) while also
989
+ // populating structured fields (fill / line / effectList / scene3d / sp3d)
990
+ // so consumers can read and mutate them programmatically.
991
+ //
992
+ // Writers (`chart-ex-renderer.renderSpPr`, `chart-space-xform._renderSpPr`)
993
+ // prefer `_rawXml` when present. Mutation APIs in `shape-properties.ts`
994
+ // (`setSpPrFill`, `setSpPrLine`, `buildSpPr`) return a new object without
995
+ // `_rawXml`, which causes the writer to take the structured path. This
996
+ // matches the contract documented at `shape-properties.ts:927`.
997
+ const structured = (0, shape_properties_1.parseSpPr)({ _rawXml: raw });
998
+ return { ...structured, _rawXml: raw };
999
+ }
1000
+ function parseRawTxPr(parent, name) {
1001
+ const raw = rawElement(parent, name);
1002
+ if (!raw) {
1003
+ return undefined;
1004
+ }
1005
+ // Same dual-representation trick as `parseRawSpPr`. `parseTxPr` extracts
1006
+ // font size / bold / italic / colour / font family / rotation from the raw
1007
+ // XML so callers can read and mutate text properties structurally; the
1008
+ // raw XML wins at write time unless the caller rebuilds via `buildTxPr`.
1009
+ const structured = (0, shape_properties_1.parseTxPr)({ _rawXml: raw });
1010
+ return { ...structured, _rawXml: raw };
1011
+ }
1012
+ function rawElement(parent, name) {
1013
+ return rawElementFromNode((0, dom_1.findChild)(parent, name));
1014
+ }
1015
+ function rawElementFromNode(el) {
1016
+ if (!el) {
1017
+ return undefined;
1018
+ }
1019
+ return serializeElement(el);
1020
+ }
1021
+ function serializeElement(el) {
1022
+ const attrs = Object.entries(el.attributes ?? {})
1023
+ .map(([key, value]) => ` ${key}="${(0, chart_utils_1.escapeXmlAttr)(value)}"`)
1024
+ .join("");
1025
+ const children = el.children ?? [];
1026
+ if (children.length === 0) {
1027
+ return `<${el.name}${attrs}/>`;
1028
+ }
1029
+ return `<${el.name}${attrs}>${children.map(serializeNode).join("")}</${el.name}>`;
1030
+ }
1031
+ function serializeNode(node) {
1032
+ if (node.type === "text") {
1033
+ return (0, chart_utils_1.escapeXml)(node.value ?? "");
1034
+ }
1035
+ if (node.type === "element") {
1036
+ return serializeElement(node);
1037
+ }
1038
+ if (node.type === "cdata") {
1039
+ return `<![CDATA[${node.value ?? ""}]]>`;
1040
+ }
1041
+ if (node.type === "comment") {
1042
+ return `<!--${node.value ?? ""}-->`;
1043
+ }
1044
+ if (node.type === "processing-instruction") {
1045
+ return `<?${node.target}${node.body ? ` ${node.body}` : ""}?>`;
1046
+ }
1047
+ return "";
1048
+ }
1049
+ function childText(el, name) {
1050
+ const child = (0, dom_1.findChild)(el, name);
1051
+ return child ? (0, dom_1.textContent)(child) : undefined;
1052
+ }
1053
+ function childVal(el, name) {
1054
+ return (0, dom_1.findChild)(el, name)?.attributes.val;
1055
+ }
1056
+ function parseBoolAttr(el, name) {
1057
+ const value = el?.attributes[name];
1058
+ if (value === undefined) {
1059
+ return undefined;
1060
+ }
1061
+ return parseBoolString(value);
1062
+ }
1063
+ /**
1064
+ * Parse an OOXML boolean string (`"1"` / `"0"` / `"true"` / `"false"`),
1065
+ * returning `undefined` for anything else. Used by the layoutPr parser
1066
+ * when reading boolean attributes off `<cx:visibility>` etc.
1067
+ */
1068
+ function parseBoolString(value) {
1069
+ if (value === undefined) {
1070
+ return undefined;
1071
+ }
1072
+ if (value === "1" || value === "true") {
1073
+ return true;
1074
+ }
1075
+ if (value === "0" || value === "false") {
1076
+ return false;
1077
+ }
1078
+ return undefined;
1079
+ }
1080
+ /**
1081
+ * Parse a Chart2014 `CT_Boolean` child element. The element's `val`
1082
+ * attribute defaults to `true` when absent — see ECMA-376 Part 1
1083
+ * §L.4.3.2.8. Callers like `<cx:connectorLines/>`, `<cx:paretoLine/>`,
1084
+ * `<cx:showMeanLine/>` depend on this default; previously the parser
1085
+ * required an explicit `val` attribute and silently dropped the field
1086
+ * otherwise, losing user intent for waterfall / box-and-whisker /
1087
+ * pareto charts on round-trip.
1088
+ *
1089
+ * Semantics by input:
1090
+ * - Element missing entirely → `undefined`
1091
+ * - `<cx:foo/>` (no `val` attr) → `true` (schema default)
1092
+ * - `<cx:foo val="1"/>` / `"true"` → `true`
1093
+ * - `<cx:foo val="0"/>` / `"false"` → `false`
1094
+ * - `<cx:foo val="yes"/>` (garbage) → `undefined` (don't promote)
1095
+ *
1096
+ * The last case previously coalesced to `true` via `?? true`, silently
1097
+ * treating an invalid attribute as opt-in. Garbage now falls through
1098
+ * so callers can distinguish "attribute absent" from "attribute
1099
+ * invalid" and react accordingly (typically: drop the field, leaving
1100
+ * the caller's default in place).
1101
+ */
1102
+ function parseCtBoolean(el) {
1103
+ if (!el) {
1104
+ return undefined;
1105
+ }
1106
+ // Distinguish "no val attribute" (schema default true) from
1107
+ // "val attribute present but unrecognised" (undefined).
1108
+ if (el.attributes.val === undefined) {
1109
+ return true;
1110
+ }
1111
+ return parseBoolAttr(el, "val");
1112
+ }
1113
+ /**
1114
+ * Narrow an attribute / child-element string to a known enum value.
1115
+ * When the input is missing returns `undefined`; when it isn't one of
1116
+ * the `allowed` variants returns `undefined` and appends a diagnostic
1117
+ * entry to the {@link UnknownCollector}, so callers can discover
1118
+ * unfamiliar OOXML values via `model.unknownElements` without replacing
1119
+ * them with an arbitrary fallback.
1120
+ */
1121
+ function validateEnum(value, allowed, collector, path) {
1122
+ if (value === undefined) {
1123
+ return undefined;
1124
+ }
1125
+ if (allowed.includes(value)) {
1126
+ return value;
1127
+ }
1128
+ collector?.entries.push({ name: `${path}=${value}`, path });
1129
+ return undefined;
1130
+ }
1131
+ function parseOptionalInt(value) {
1132
+ if (value === undefined) {
1133
+ return undefined;
1134
+ }
1135
+ const parsed = parseInt(value, 10);
1136
+ // `parseInt("Infinity", 10)` returns `NaN` — caught by the finite
1137
+ // check — but explicit finite testing guards against future
1138
+ // parser additions (e.g. `Number()` migration) still rejecting
1139
+ // non-finite slips. See `parseOptionalFloat`.
1140
+ return Number.isFinite(parsed) ? parsed : undefined;
1141
+ }
1142
+ /**
1143
+ * Parse a non-negative OOXML index attribute, falling back to `0`
1144
+ * when the value is absent / malformed. Use this for `idx`, `id`,
1145
+ * `dataId` and similar slots where `<c:pt idx="">` (empty string),
1146
+ * `<c:pt idx="abc">` (garbage), or `<c:pt idx="-1">` (negative)
1147
+ * should all coerce to 0 rather than land a poison value on the
1148
+ * model — `-1` silently corrupts dense arrays via property
1149
+ * assignment on the length slot, and `NaN` creates a string-indexed
1150
+ * property the rest of the code ignores.
1151
+ */
1152
+ function parseIndexAttr(value) {
1153
+ if (value === undefined || value === "") {
1154
+ return 0;
1155
+ }
1156
+ const parsed = parseInt(value, 10);
1157
+ if (!Number.isFinite(parsed) || parsed < 0) {
1158
+ return 0;
1159
+ }
1160
+ return parsed;
1161
+ }
1162
+ function parseOptionalFloat(value) {
1163
+ if (value === undefined) {
1164
+ return undefined;
1165
+ }
1166
+ const parsed = parseFloat(value);
1167
+ // Reject non-finite parses — `parseFloat("Infinity")` returns
1168
+ // `Infinity`, which propagates through axis scaling and collapses
1169
+ // the plot to an unrenderable degenerate range. Malformed input
1170
+ // should fall back to "absent" rather than poison downstream math.
1171
+ return Number.isFinite(parsed) ? parsed : undefined;
1172
+ }
1173
+ /**
1174
+ * Validate an OOXML `cx:strDim/@type` / `cx:numDim/@type` value
1175
+ * against {@link ChartExDimensionType}. Unknown values fall back to
1176
+ * `"val"` (the schema default) and are reported to the optional
1177
+ * {@link UnknownCollector} so `model.unknownElements` surfaces
1178
+ * vendor / forward-compat extensions instead of silently coercing
1179
+ * them into a real enum member.
1180
+ */
1181
+ function parseDimensionType(value, collector, path) {
1182
+ const allowed = [
1183
+ "cat",
1184
+ "val",
1185
+ "x",
1186
+ "y",
1187
+ "size",
1188
+ "colorVal",
1189
+ "from",
1190
+ "to",
1191
+ "classification"
1192
+ ];
1193
+ if (value === undefined) {
1194
+ return "val";
1195
+ }
1196
+ if (allowed.includes(value)) {
1197
+ return value;
1198
+ }
1199
+ const diagnosticPath = path ?? "cx:dim/@type";
1200
+ collector?.entries.push({
1201
+ name: `${diagnosticPath}=${value}`,
1202
+ path: diagnosticPath
1203
+ });
1204
+ return "val";
1205
+ }
1206
+ function emptyElement() {
1207
+ return { type: "element", name: "", attributes: {}, children: [] };
1208
+ }