@officedk/pptxdk 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (296) hide show
  1. package/dist/build.d.ts +5 -8
  2. package/dist/build.js +44 -52
  3. package/dist/core/dist/capabilities/audio/audio-declaration.js +7 -0
  4. package/dist/core/dist/capabilities/audio/audio-source.js +172 -0
  5. package/dist/core/dist/capabilities/audio/entry.js +122 -0
  6. package/dist/{capabilities/dist → core/dist/capabilities}/box/box-codegen.js +7 -8
  7. package/dist/{capabilities/dist → core/dist/capabilities}/box/box-declaration.js +8 -8
  8. package/dist/{capabilities/dist → core/dist/capabilities}/box/box.js +14 -15
  9. package/dist/core/dist/capabilities/box/entry.js +2 -0
  10. package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-codegen.js +11 -18
  11. package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-declaration.js +2 -2
  12. package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-import.js +891 -468
  13. package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-labels.js +30 -3
  14. package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-model.js +1 -1
  15. package/dist/{capabilities/dist/chart/preview/number-format.js → core/dist/capabilities/chart/chart-number-format.js} +1 -1
  16. package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-schemas.js +73 -79
  17. package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-xml.js +41 -36
  18. package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart.js +175 -113
  19. package/dist/core/dist/capabilities/chart/entry.js +2 -0
  20. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/axes-and-grid.js +2 -2
  21. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/bar-column.js +1 -1
  22. package/dist/core/dist/capabilities/chart/preview/data-labels.js +474 -0
  23. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/error-bars.js +3 -1
  24. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/index.js +28 -9
  25. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/layout.js +7 -9
  26. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/legend.js +1 -1
  27. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/line-area.js +1 -1
  28. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/markers.js +1 -1
  29. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/pie-doughnut.js +39 -60
  30. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/scales.js +1 -1
  31. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/scatter.js +1 -1
  32. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/style.js +1 -1
  33. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/text-render.js +34 -24
  34. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/trendlines.js +3 -3
  35. package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/types.js +1 -1
  36. package/dist/core/dist/capabilities/comment/comment-codegen.js +25 -0
  37. package/dist/core/dist/capabilities/comment/comment-declaration.js +37 -0
  38. package/dist/core/dist/capabilities/comment/comment-import.js +176 -0
  39. package/dist/core/dist/capabilities/comment/comment.js +141 -0
  40. package/dist/core/dist/capabilities/comment/entry.js +1 -0
  41. package/dist/core/dist/capabilities/footer-placeholder/entry.js +2 -0
  42. package/dist/core/dist/capabilities/footer-placeholder/footer-placeholder-codegen.js +16 -0
  43. package/dist/{capabilities/dist/masters → core/dist/capabilities/footer-placeholder}/footer-placeholder.js +113 -50
  44. package/dist/core/dist/capabilities/footer-placeholder/print-header-footer-import.js +121 -0
  45. package/dist/core/dist/capabilities/footer-placeholder/print-header-footer.js +123 -0
  46. package/dist/core/dist/capabilities/group/entry.js +2 -0
  47. package/dist/{capabilities/dist → core/dist/capabilities}/group/group-codegen.js +6 -7
  48. package/dist/{capabilities/dist → core/dist/capabilities}/group/group-declaration.js +8 -8
  49. package/dist/{capabilities/dist → core/dist/capabilities}/group/group-import.js +36 -77
  50. package/dist/{capabilities/dist → core/dist/capabilities}/group/group-xml.js +1 -1
  51. package/dist/{capabilities/dist → core/dist/capabilities}/group/group.js +17 -17
  52. package/dist/core/dist/capabilities/image/entry.js +4 -0
  53. package/dist/core/dist/capabilities/image/image-codegen.js +59 -0
  54. package/dist/core/dist/capabilities/image/image-declaration.js +8 -0
  55. package/dist/core/dist/capabilities/image/image-import.js +26 -0
  56. package/dist/core/dist/capabilities/image/image.js +57 -0
  57. package/dist/core/dist/capabilities/line/entry.js +3 -0
  58. package/dist/{capabilities/dist → core/dist/capabilities}/line/line-codegen.js +6 -7
  59. package/dist/{capabilities/dist → core/dist/capabilities}/line/line-declaration.js +15 -9
  60. package/dist/{capabilities/dist → core/dist/capabilities}/line/line-import.js +15 -95
  61. package/dist/{capabilities/dist → core/dist/capabilities}/line/line-xml.js +1 -1
  62. package/dist/{capabilities/dist → core/dist/capabilities}/line/line.js +41 -43
  63. package/dist/core/dist/capabilities/masters/entry.js +1 -0
  64. package/dist/{capabilities/dist → core/dist/capabilities}/masters/masters-codegen.js +7 -26
  65. package/dist/{capabilities/dist → core/dist/capabilities}/masters/masters.js +23 -35
  66. package/dist/core/dist/capabilities/motion/entry.js +5 -0
  67. package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-codegen.js +15 -35
  68. package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-import.js +25 -9
  69. package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-plan.js +17 -14
  70. package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-query.js +2 -2
  71. package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion.js +79 -75
  72. package/dist/core/dist/capabilities/notes/entry.js +2 -0
  73. package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-codegen.js +4 -5
  74. package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-declaration.js +2 -2
  75. package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-import.js +16 -13
  76. package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-schemas.js +6 -6
  77. package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes.js +16 -41
  78. package/dist/{import/dist/sections.js → core/dist/capabilities/notes/sections-import.js} +5 -5
  79. package/dist/core/dist/capabilities/placeholder/entry.js +3 -0
  80. package/dist/{capabilities/dist → core/dist/capabilities}/placeholder/placeholder-codegen.js +5 -15
  81. package/dist/{capabilities/dist → core/dist/capabilities}/placeholder/placeholder-schemas.js +7 -9
  82. package/dist/{capabilities/dist → core/dist/capabilities}/placeholder/placeholder.js +50 -107
  83. package/dist/core/dist/capabilities/shape/entry.js +6 -0
  84. package/dist/core/dist/capabilities/shape/shape-codegen.js +112 -0
  85. package/dist/core/dist/capabilities/shape/shape-import.js +152 -0
  86. package/dist/{capabilities/dist → core/dist/capabilities}/shape/shape-xml.js +1 -1
  87. package/dist/{capabilities/dist → core/dist/capabilities}/shape/shape.js +44 -30
  88. package/dist/core/dist/capabilities/shared/container-slots.js +59 -0
  89. package/dist/core/dist/capabilities/shared/date-time.js +98 -0
  90. package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font-embedding.js +5 -6
  91. package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font-engine.js +34 -13
  92. package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font-import.js +62 -23
  93. package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font-subset.js +24 -9
  94. package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font.js +4 -4
  95. package/dist/core/dist/capabilities/shared/geometry-codegen.js +101 -0
  96. package/dist/{capabilities/dist → core/dist/capabilities}/shared/geometry.js +47 -44
  97. package/dist/{capabilities/dist → core/dist/capabilities}/shared/identity.js +56 -38
  98. package/dist/core/dist/capabilities/shared/image-codegen.js +94 -0
  99. package/dist/{capabilities/dist/image → core/dist/capabilities/shared}/image-decode.js +17 -79
  100. package/dist/{capabilities/dist/image → core/dist/capabilities/shared}/image-schemas.js +16 -26
  101. package/dist/core/dist/capabilities/shared/line-match.js +78 -0
  102. package/dist/core/dist/capabilities/shared/media-codegen.js +86 -0
  103. package/dist/core/dist/capabilities/shared/media-import.js +156 -0
  104. package/dist/core/dist/capabilities/shared/media-placement.js +20 -0
  105. package/dist/core/dist/capabilities/shared/media-poster.js +50 -0
  106. package/dist/core/dist/capabilities/shared/media-schemas.js +60 -0
  107. package/dist/core/dist/capabilities/shared/media-source.js +107 -0
  108. package/dist/core/dist/capabilities/shared/media-trim.js +102 -0
  109. package/dist/core/dist/capabilities/shared/media.js +134 -0
  110. package/dist/{capabilities/dist → core/dist/capabilities}/shared/morph-api.js +5 -5
  111. package/dist/{capabilities/dist/motion → core/dist/capabilities/shared}/motion-api.js +112 -99
  112. package/dist/{capabilities/dist/motion → core/dist/capabilities/shared}/motion-schemas.js +19 -5
  113. package/dist/{capabilities/dist/image/image-import.js → core/dist/capabilities/shared/picture-import.js} +97 -158
  114. package/dist/core/dist/capabilities/shared/picture-xml.js +13 -0
  115. package/dist/core/dist/capabilities/shared/picture.js +510 -0
  116. package/dist/{capabilities/dist → core/dist/capabilities}/shared/placeholder-import.js +50 -20
  117. package/dist/core/dist/capabilities/shared/placeholder-roles.js +42 -0
  118. package/dist/{capabilities/dist → core/dist/capabilities}/shared/preset-definitions.js +1 -1
  119. package/dist/core/dist/capabilities/shared/print-xml.js +77 -0
  120. package/dist/{capabilities/dist/text/text-codegen.js → core/dist/capabilities/shared/rich-text-codegen.js} +23 -102
  121. package/dist/core/dist/capabilities/shared/rich-text-import.js +472 -0
  122. package/dist/{capabilities/dist/shape → core/dist/capabilities/shared}/shape-declaration.js +14 -14
  123. package/dist/{capabilities/dist → core/dist/capabilities}/shared/style-inheritance.js +12 -5
  124. package/dist/{capabilities/dist/text → core/dist/capabilities/shared}/text-declaration.js +7 -3
  125. package/dist/{capabilities/dist → core/dist/capabilities}/shared/text-schemas.js +77 -77
  126. package/dist/{capabilities/dist → core/dist/capabilities}/shared/text-service.js +571 -260
  127. package/dist/{capabilities/dist → core/dist/capabilities}/shared/visual.js +137 -112
  128. package/dist/core/dist/capabilities/slide-background/entry.js +1 -0
  129. package/dist/core/dist/capabilities/slide-background/slide-background-codegen.js +15 -0
  130. package/dist/{capabilities/dist → core/dist/capabilities}/slide-background/slide-background-import.js +5 -5
  131. package/dist/{capabilities/dist → core/dist/capabilities}/slide-background/slide-background-xml.js +2 -3
  132. package/dist/{capabilities/dist → core/dist/capabilities}/slide-background/slide-background.js +27 -33
  133. package/dist/core/dist/capabilities/table/entry.js +2 -0
  134. package/dist/{capabilities/dist → core/dist/capabilities}/table/table-codegen.js +6 -13
  135. package/dist/{capabilities/dist → core/dist/capabilities}/table/table-declaration.js +2 -2
  136. package/dist/{capabilities/dist → core/dist/capabilities}/table/table-import.js +22 -57
  137. package/dist/{capabilities/dist → core/dist/capabilities}/table/table-schemas.js +40 -37
  138. package/dist/{capabilities/dist → core/dist/capabilities}/table/table-xml.js +9 -4
  139. package/dist/{capabilities/dist → core/dist/capabilities}/table/table.js +60 -45
  140. package/dist/core/dist/capabilities/text/entry.js +3 -0
  141. package/dist/core/dist/capabilities/text/text-codegen.js +66 -0
  142. package/dist/core/dist/capabilities/text/text-import.js +468 -0
  143. package/dist/{capabilities/dist → core/dist/capabilities}/text/text-xml.js +3 -4
  144. package/dist/{capabilities/dist → core/dist/capabilities}/text/text.js +61 -54
  145. package/dist/core/dist/capabilities/transition/entry.js +3 -0
  146. package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition-api.js +1 -1
  147. package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition-codegen.js +2 -3
  148. package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition-import.js +25 -27
  149. package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition.js +23 -23
  150. package/dist/core/dist/capabilities/video/entry.js +77 -0
  151. package/dist/core/dist/capabilities/video/video-declaration.js +7 -0
  152. package/dist/core/dist/capabilities/video/video-source.js +42 -0
  153. package/dist/{codegen/dist → core/dist/codegen}/assets.js +13 -8
  154. package/dist/{codegen/dist → core/dist/codegen}/codegen.js +54 -122
  155. package/dist/{codegen/dist → core/dist/codegen}/identifiers.js +17 -1
  156. package/dist/{codegen/dist → core/dist/codegen}/index.js +2 -2
  157. package/dist/{codegen/dist → core/dist/codegen}/printer.js +23 -4
  158. package/dist/core/dist/document/all.js +41 -0
  159. package/dist/core/dist/document/default.js +10 -0
  160. package/dist/core/dist/document/document.js +218 -0
  161. package/dist/core/dist/document/index.js +62 -0
  162. package/dist/core/dist/document/stages.js +54 -0
  163. package/dist/{emit/dist → core/dist/emit}/emit.js +122 -60
  164. package/dist/core/dist/emit/index.js +6 -0
  165. package/dist/core/dist/emit/ooxml.js +241 -0
  166. package/dist/{import/dist → core/dist/import}/import.js +221 -187
  167. package/dist/core/dist/import/index.js +19 -0
  168. package/dist/{import/dist → core/dist/import}/masters.js +253 -317
  169. package/dist/core/dist/import/media-timing.js +233 -0
  170. package/dist/{import/dist → core/dist/import}/notes-masters.js +48 -45
  171. package/dist/core/dist/index.js +47 -15
  172. package/dist/core/dist/{author-ids.js → kernel/author-ids.js} +1 -1
  173. package/dist/core/dist/{author-schemas.js → kernel/author-schemas.js} +59 -98
  174. package/dist/core/dist/{block-flex-layout.js → kernel/block-flex-layout.js} +109 -78
  175. package/dist/core/dist/kernel/build.js +4 -0
  176. package/dist/core/dist/kernel/capability.js +17 -0
  177. package/dist/{codegen/dist/types.js → core/dist/kernel/codegen.js} +22 -2
  178. package/dist/core/dist/kernel/container-slots.js +104 -0
  179. package/dist/core/dist/kernel/date-time-format.js +18 -0
  180. package/dist/core/dist/kernel/declaration-snapshot.js +68 -0
  181. package/dist/core/dist/{declaration.js → kernel/declaration.js} +1 -1
  182. package/dist/core/dist/{diagnostics.js → kernel/diagnostics.js} +22 -5
  183. package/dist/core/dist/{document-internals.js → kernel/document-internals.js} +1 -1
  184. package/dist/core/dist/{document.js → kernel/document.js} +6 -5
  185. package/dist/core/dist/kernel/drawing-units.js +14 -0
  186. package/dist/core/dist/{font-seal.js → kernel/font-seal.js} +2 -2
  187. package/dist/core/dist/{geometry-schemas.js → kernel/geometry-schemas.js} +2 -6
  188. package/dist/core/dist/{grid-layout.js → kernel/grid-layout.js} +156 -55
  189. package/dist/core/dist/{host.js → kernel/host.js} +1 -1
  190. package/dist/core/dist/kernel/index.js +24 -0
  191. package/dist/core/dist/{input-values.js → kernel/input-values.js} +4 -3
  192. package/dist/core/dist/kernel/layout-definition.js +7 -0
  193. package/dist/core/dist/{layout-protocol.js → kernel/layout-protocol.js} +1 -1
  194. package/dist/core/dist/{layout-schemas.js → kernel/layout-schemas.js} +2 -6
  195. package/dist/core/dist/{layout.js → kernel/layout.js} +37 -38
  196. package/dist/core/dist/{masters.js → kernel/masters.js} +32 -55
  197. package/dist/core/dist/{morph.js → kernel/morph.js} +1 -1
  198. package/dist/core/dist/{placeholders.js → kernel/placeholders.js} +23 -9
  199. package/dist/{import/dist → core/dist/kernel/pptx-read}/alternate-content.js +1 -1
  200. package/dist/{import/dist → core/dist/kernel/pptx-read}/diagnostics.js +1 -1
  201. package/dist/core/dist/kernel/pptx-read/drawing-list-import.js +251 -0
  202. package/dist/{import/dist → core/dist/kernel/pptx-read}/fonts.js +1 -1
  203. package/dist/core/dist/kernel/pptx-read/index.js +15 -0
  204. package/dist/{import/dist → core/dist/kernel/pptx-read}/mechanism.js +1 -1
  205. package/dist/core/dist/kernel/pptx-read/media.js +26 -0
  206. package/dist/{import/dist → core/dist/kernel/pptx-read}/namespaces.js +5 -7
  207. package/dist/{import/dist → core/dist/kernel/pptx-read}/opc.js +62 -13
  208. package/dist/{import/dist → core/dist/kernel/pptx-read}/resources.js +1 -1
  209. package/dist/core/dist/kernel/pptx-read/shape-tree.js +57 -0
  210. package/dist/{import/dist → core/dist/kernel/pptx-read}/themes.js +40 -5
  211. package/dist/{import/dist → core/dist/kernel/pptx-read}/visual.js +94 -67
  212. package/dist/{import/dist → core/dist/kernel/pptx-read}/xml-fragments.js +56 -13
  213. package/dist/{import/dist → core/dist/kernel/pptx-read}/xml-reader.js +8 -1
  214. package/dist/{emit/dist → core/dist/kernel/pptx-write}/shape-tree.js +1 -1
  215. package/dist/core/dist/kernel/pptx-write/timing.js +52 -0
  216. package/dist/{emit/dist/ooxml.js → core/dist/kernel/pptx-write/xml.js} +62 -274
  217. package/dist/core/dist/{query.js → kernel/query.js} +5 -1
  218. package/dist/core/dist/{resolution.js → kernel/resolution.js} +1 -1
  219. package/dist/core/dist/kernel/resolve-work.js +58 -0
  220. package/dist/core/dist/{resolve.js → kernel/resolve.js} +226 -257
  221. package/dist/core/dist/kernel/resource-source.js +11 -0
  222. package/dist/core/dist/{stage-options.js → kernel/stage-options.js} +23 -11
  223. package/dist/core/dist/{theme.js → kernel/theme.js} +54 -36
  224. package/dist/core/dist/{transform-geometry.js → kernel/transform-geometry.js} +1 -1
  225. package/dist/core/dist/kernel/xml-values.js +13 -0
  226. package/dist/{document-41spD7bq.d.ts → document-C0lPlH-L.d.ts} +614 -522
  227. package/dist/{capability-BbKW9w4O.d.ts → index-B9_OUeA-.d.ts} +660 -553
  228. package/dist/{index-BEwhk7c8.d.ts → index-BJEzQxWV.d.ts} +27 -24
  229. package/dist/{index-cK2KtukZ.d.ts → index-DA9flrlR.d.ts} +2 -17
  230. package/dist/{index-v77CTJev.d.ts → index-GSt0t9VO.d.ts} +3 -4
  231. package/dist/index.d.ts +7 -8
  232. package/dist/index.js +68 -66
  233. package/dist/node.d.ts +16 -14
  234. package/dist/node.js +86 -43
  235. package/dist/pptxdk/src/cli-commands.js +9 -5
  236. package/dist/pptxdk/src/compose.js +28 -29
  237. package/dist/pptxdk/src/preview-result.js +24 -0
  238. package/dist/{capabilities/dist/image → preview/dist}/gif-decoder.js +5 -5
  239. package/dist/preview/dist/index.js +84 -34
  240. package/dist/preview/dist/options.js +8 -4
  241. package/dist/preview/dist/raster.js +66 -0
  242. package/dist/preview/dist/svg-guard.js +8 -7
  243. package/dist/preview.d.ts +3 -9
  244. package/dist/preview.js +7 -25
  245. package/dist/react/dist/append.js +3 -3
  246. package/dist/react/dist/author/audio-elements.js +14 -0
  247. package/dist/{capabilities/dist/box → react/dist/author}/box-elements.js +5 -3
  248. package/dist/react/dist/author/chart-elements.js +14 -0
  249. package/dist/react/dist/author/comment-elements.js +15 -0
  250. package/dist/react/dist/author/group-elements.js +14 -0
  251. package/dist/react/dist/author/image-elements.js +14 -0
  252. package/dist/react/dist/author/line-elements.js +14 -0
  253. package/dist/{capabilities/dist/motion → react/dist/author}/motion-elements.js +6 -4
  254. package/dist/react/dist/author/notes-elements.js +14 -0
  255. package/dist/react/dist/author/placeholder-elements.js +14 -0
  256. package/dist/react/dist/author/shape-elements.js +14 -0
  257. package/dist/{capabilities/dist/table → react/dist/author}/table-elements.js +6 -4
  258. package/dist/{capabilities/dist/text → react/dist/author}/text-elements.js +15 -5
  259. package/dist/react/dist/author/video-elements.js +14 -0
  260. package/dist/react/dist/document-adapter.js +4 -4
  261. package/dist/react/dist/elements.js +7 -4
  262. package/dist/react/dist/from-vanilla.js +3 -3
  263. package/dist/react/dist/index.js +17 -3
  264. package/dist/react/dist/reconciler.js +3 -3
  265. package/dist/react.d.ts +103 -69
  266. package/dist/react.js +28 -28
  267. package/dist/{index-1ag7U9Jt.d.ts → stages-DYHSHKt4.d.ts} +23 -6
  268. package/dist/vanilla.d.ts +4 -4
  269. package/dist/vanilla.js +14 -15
  270. package/package.json +2 -5
  271. package/dist/build-zrZuX4fK.d.ts +0 -3
  272. package/dist/capabilities/dist/all.js +0 -34
  273. package/dist/capabilities/dist/chart/chart-elements.js +0 -12
  274. package/dist/capabilities/dist/chart/preview/data-labels.js +0 -334
  275. package/dist/capabilities/dist/document.js +0 -168
  276. package/dist/capabilities/dist/group/group-elements.js +0 -12
  277. package/dist/capabilities/dist/image/image-codegen.js +0 -164
  278. package/dist/capabilities/dist/image/image-declaration.js +0 -8
  279. package/dist/capabilities/dist/image/image-elements.js +0 -12
  280. package/dist/capabilities/dist/image/image-xml.js +0 -12
  281. package/dist/capabilities/dist/image/image.js +0 -552
  282. package/dist/capabilities/dist/line/line-elements.js +0 -12
  283. package/dist/capabilities/dist/notes/notes-elements.js +0 -12
  284. package/dist/capabilities/dist/notes/notes-xml.js +0 -38
  285. package/dist/capabilities/dist/placeholder/placeholder-elements.js +0 -13
  286. package/dist/capabilities/dist/shape/shape-codegen.js +0 -236
  287. package/dist/capabilities/dist/shape/shape-elements.js +0 -12
  288. package/dist/capabilities/dist/shape/shape-import.js +0 -628
  289. package/dist/capabilities/dist/slide-background/slide-background-codegen.js +0 -44
  290. package/dist/capabilities/dist/text/text-import.js +0 -1224
  291. package/dist/core/dist/build.js +0 -4
  292. package/dist/core/dist/capability.js +0 -15
  293. package/dist/emit/dist/index.js +0 -5
  294. package/dist/import/dist/index.js +0 -16
  295. package/dist/pptxdk/src/slide.js +0 -9
  296. package/dist/transition-6n8GZxSg.d.ts +0 -9
@@ -1,17 +1,22 @@
1
- import { bcp47LangSchema, schemeColorNameSchema } from "../../../core/dist/theme.js";
2
- import "../../../core/dist/capability.js";
3
- import { A_NS, C_NS, MC_NS, P_NS, R_NS, emuToPx } from "../../../import/dist/namespaces.js";
4
- import { XmlElementCursor, parseXmlPart } from "../../../import/dist/xml-reader.js";
5
- import { resolvePartPath } from "../../../import/dist/opc.js";
6
- import { extentEmuFragmentSchema, hexRgb6Schema, offsetEmuFragmentSchema, ooxmlBoolSchema, ooxmlIntSchema, ooxmlNonNegativeIntSchema, ooxmlPositiveLineWidthEmuSchema, ooxmlWritableExtentEmuSchema, transformAttributesFragmentSchema } from "../../../import/dist/xml-fragments.js";
7
- import { readRunFontSlots } from "../../../import/dist/fonts.js";
8
- import "../../../import/dist/index.js";
1
+ import { emuToPx } from "../../kernel/drawing-units.js";
2
+ import { colorMapSchema, schemeColorNameSchema } from "../../kernel/theme.js";
9
3
  import { attachDeferredSlideLink, readClickLink } from "../shared/identity.js";
10
- import { emitPlaceholderUnbindDiagnostic, isPlaceholderGraphicFrameElement, readNvPrPlaceholder, resolvePlaceholderImportClaim } from "../shared/placeholder-import.js";
4
+ import { emitPlaceholderUnbindDiagnostic, isPlaceholderGraphicFrameElement, readNvPrPlaceholder, readPlaceholderFrameBox, resolvePlaceholderImportClaim } from "../shared/placeholder-import.js";
5
+ import { A_NS, C_NS, MC_NS, P_NS, R_NS } from "../../kernel/pptx-read/namespaces.js";
6
+ import { XmlElementCursor, parseXmlPart } from "../../kernel/pptx-read/xml-reader.js";
7
+ import { resolvePartPath } from "../../kernel/pptx-read/opc.js";
8
+ import { cascadeOoxmlTextDecoration, hexRgb6Schema, ooxmlBoolSchema, ooxmlIntSchema, ooxmlListLevelSchema, ooxmlNonNegativeIntSchema, ooxmlPositiveFixedAngleSchema, ooxmlPositiveLineWidthEmuSchema, ooxmlWritableExtentEmuSchema, projectOoxmlTextDecoration, readOoxmlRunAttrStyles, readOoxmlTextDecoration, reportOoxmlTextDecorationLoss } from "../../kernel/pptx-read/xml-fragments.js";
9
+ import { readDrawingColor, readRunFillAndStroke } from "../../kernel/pptx-read/visual.js";
10
+ import { readPartThemeOverride } from "../../kernel/pptx-read/themes.js";
11
+ import { readRunFontSlots } from "../../kernel/pptx-read/fonts.js";
12
+ import "../../kernel/capability.js";
13
+ import { readDrawingParagraphLayout } from "../../kernel/pptx-read/drawing-list-import.js";
14
+ import "../../kernel/pptx-read/index.js";
11
15
  import { createChartNode } from "./chart-declaration.js";
12
- import { chartAxisPositionFromNative, chartDataLabelPositionFromNative, chartErrorBarValueTypeFromNative, chartLegendPositionFromNative, chartLineDashFromNative, chartTrendlineTypeFromNative } from "./chart-labels.js";
16
+ import { chartAxisPositionFromNative, chartDataLabelFieldOrder, chartDataLabelPositionFromNative, chartErrorBarValueTypeFromNative, chartLegendPositionFromNative, chartLineDashFromNative, chartTrendlineTypeFromNative, hasAutomaticDataLabels, hasVisibleDataLabels, hasVisibleSeriesDataLabels, mergeDataLabels } from "./chart-labels.js";
17
+ import { formatChartNumber } from "./chart-number-format.js";
13
18
  import { z } from "zod";
14
- // ../capabilities/dist/chart/chart-import.js
19
+ // ../core/dist/capabilities/chart/chart-import.js
15
20
  const C14_NS = "http://schemas.microsoft.com/office/drawing/2007/8/2/chart";
16
21
  const C15_NS = "http://schemas.microsoft.com/office/drawing/2012/chart";
17
22
  const WPS_ET_NS = "https://web.wps.cn/et/2018/main";
@@ -126,9 +131,10 @@ function consumeSubtree(cursor) {
126
131
  function readValAttr(cursor) {
127
132
  return cursor?.attr("val");
128
133
  }
129
- function readBoolVal(cursor) {
134
+ function readBoolVal(cursor, defaultValue) {
135
+ if (cursor === void 0) return void 0;
130
136
  const raw = readValAttr(cursor);
131
- if (raw === void 0) return void 0;
137
+ if (raw === void 0) return defaultValue;
132
138
  const parsed = ooxmlBoolSchema.safeParse(raw);
133
139
  return parsed.success ? parsed.data : void 0;
134
140
  }
@@ -174,9 +180,9 @@ function readSolidFillColor(fillCursor) {
174
180
  const lumOff = readColorModifier(colorCursor, "lumOff");
175
181
  const alpha = readColorModifier(colorCursor, "alpha");
176
182
  consumeSubtree(colorCursor);
177
- const baseColor = schemeSlot !== void 0 && lumMod !== void 0 ? {
183
+ const baseColor = schemeSlot !== void 0 && (lumMod !== void 0 || lumOff !== void 0) ? {
178
184
  slot: schemeSlot,
179
- lumMod: Math.min(1, lumMod),
185
+ lumMod: Math.min(1, lumMod ?? 1),
180
186
  ...lumOff === void 0 ? {} : { lumOff: Math.min(1, lumOff) }
181
187
  } : schemeSlot ?? baseString;
182
188
  if (baseColor === void 0) return void 0;
@@ -200,6 +206,27 @@ function consumeBenignLineElement(spPr) {
200
206
  for (const child of ln.remainingElementChildren()) consumeSubtree(child);
201
207
  return true;
202
208
  }
209
+ /** Reads the host's shape properties and reports unsupported fills on the shape itself. */
210
+ function readChartSpPr(host, ctx) {
211
+ const spPr = host.child(C_NS, "spPr");
212
+ const fills = spPr?.matchingChildren((element) => element.namespaceURI === "http://schemas.openxmlformats.org/drawingml/2006/main" && (element.localName === "blipFill" || element.localName === "gradFill" || element.localName === "pattFill")) ?? [];
213
+ for (const fill of fills) {
214
+ ctx.diagnostics.push({
215
+ code: "unsupported-mechanism",
216
+ category: "unsupported",
217
+ disposition: "omitted",
218
+ location: {
219
+ ...ctx.location,
220
+ xpath: fill.xpath
221
+ },
222
+ namespaceUri: fill.namespaceUri,
223
+ localName: fill.localName,
224
+ mechanismHint: "chart-shape-fill"
225
+ });
226
+ fill.suppressUnconsumed();
227
+ }
228
+ return spPr;
229
+ }
203
230
  function consumeBenignChartSpPr(spPr) {
204
231
  const noFillEl = directElementChild(spPr.element, A_NS, "noFill");
205
232
  if (noFillEl !== void 0 && isEmptyXmlElement(noFillEl)) spPr.child(A_NS, "noFill");
@@ -251,82 +278,114 @@ function readSeriesSpPr(spPr, ignoreLine) {
251
278
  ...line === void 0 ? {} : { line }
252
279
  };
253
280
  }
254
- function readChartOuterShadow(rPrCursor) {
281
+ const chartShadowGeometrySchema = z.object({
282
+ blurRad: ooxmlWritableExtentEmuSchema.optional(),
283
+ dist: ooxmlWritableExtentEmuSchema.optional(),
284
+ dir: ooxmlPositiveFixedAngleSchema.optional()
285
+ });
286
+ function readChartOuterShadow(rPrCursor, ctx) {
287
+ if (rPrCursor.ignoreEmptyChild("http://schemas.openxmlformats.org/drawingml/2006/main", "effectLst")) return "none";
255
288
  const effectLst = rPrCursor.child(A_NS, "effectLst");
256
289
  if (effectLst === void 0) return void 0;
257
290
  const outerShdw = effectLst.child(A_NS, "outerShdw");
258
- if (outerShdw === void 0) {
259
- consumeSubtree(effectLst);
260
- return;
291
+ for (const effect of effectLst.remainingElementChildren()) {
292
+ ctx.diagnostics.push({
293
+ code: "unconsumed-xml",
294
+ category: "unsupported",
295
+ disposition: "omitted",
296
+ location: {
297
+ ...ctx.location,
298
+ xpath: effect.xpath
299
+ },
300
+ kind: "element",
301
+ namespaceUri: effect.namespaceUri,
302
+ localName: effect.localName
303
+ });
304
+ effect.suppressUnconsumed();
261
305
  }
262
- const blurRadRaw = outerShdw.attr("blurRad");
263
- const distRaw = outerShdw.attr("dist");
264
- const dirRaw = outerShdw.attr("dir");
306
+ if (outerShdw === void 0) return void 0;
307
+ const attributes = outerShdw.attrsObject([
308
+ "blurRad",
309
+ "dist",
310
+ "dir"
311
+ ]);
265
312
  outerShdw.consumeAttr("algn");
266
313
  outerShdw.consumeAttr("rotWithShape");
267
- const color = readSolidFillColor(outerShdw);
314
+ const color = readDrawingColor(outerShdw, ctx.location, ctx.diagnostics);
268
315
  consumeSubtree(outerShdw);
269
- consumeSubtree(effectLst);
270
- const blurRad = blurRadRaw === void 0 ? void 0 : ooxmlWritableExtentEmuSchema.safeParse(blurRadRaw);
271
- const dist = distRaw === void 0 ? void 0 : ooxmlWritableExtentEmuSchema.safeParse(distRaw);
272
- const dir = dirRaw === void 0 ? void 0 : ooxmlIntSchema.safeParse(dirRaw);
273
- if (blurRad !== void 0 && !blurRad.success || dist !== void 0 && !dist.success || dir !== void 0 && !dir.success) return;
316
+ const geometry = chartShadowGeometrySchema.safeParse(attributes);
317
+ if (!geometry.success) {
318
+ const invalidAttributes = new Set(geometry.error.issues.map((issue) => String(issue.path[0])));
319
+ for (const name of invalidAttributes) ctx.diagnostics.push({
320
+ code: "invalid-xml-value",
321
+ category: "corrupt-input",
322
+ disposition: "omitted",
323
+ location: {
324
+ ...ctx.location,
325
+ xpath: `${outerShdw.xpath}/@${name}`
326
+ },
327
+ attributeOrElement: `a:outerShdw/@${name}`,
328
+ rawValue: attributes[name] ?? ""
329
+ });
330
+ return;
331
+ }
332
+ const { blurRad, dist, dir } = geometry.data;
274
333
  return {
275
334
  ...color === void 0 ? {} : { color },
276
- ...blurRad?.success ? { blur: emuToPx(blurRad.data) } : {},
277
- ...dist?.success ? { distance: emuToPx(dist.data) } : {},
278
- ...dir?.success ? { angle: dir.data / 6e4 } : {}
335
+ ...blurRad === void 0 ? {} : { blur: emuToPx(blurRad) },
336
+ ...dist === void 0 ? {} : { distance: emuToPx(dist) },
337
+ ...dir === void 0 ? {} : { angle: dir / 6e4 }
279
338
  };
280
339
  }
281
- function readChartRunProperties(rPrCursor) {
282
- const rawLang = rPrCursor.attr("lang");
283
- const parsedLang = rawLang === void 0 ? void 0 : bcp47LangSchema.safeParse(rawLang);
284
- const lang = parsedLang?.success ? parsedLang.data : void 0;
285
- const szRaw = rPrCursor.attr("sz");
286
- const szParsed = szRaw === void 0 ? void 0 : ooxmlIntSchema.safeParse(szRaw);
287
- const fontSize = szParsed?.success && szParsed.data >= 100 && szParsed.data <= 4e5 ? `${szParsed.data / 100}pt` : void 0;
288
- const bRaw = rPrCursor.attr("b");
289
- const bParsed = bRaw === void 0 ? void 0 : ooxmlBoolSchema.safeParse(bRaw);
290
- const fontWeight = bParsed?.success ? bParsed.data ? "bold" : "normal" : void 0;
291
- const iRaw = rPrCursor.attr("i");
292
- const iParsed = iRaw === void 0 ? void 0 : ooxmlBoolSchema.safeParse(iRaw);
293
- const fontStyle = iParsed?.success ? iParsed.data ? "italic" : "normal" : void 0;
294
- const uRaw = rPrCursor.attr("u");
295
- const strikeRaw = rPrCursor.attr("strike");
296
- let textDecoration;
297
- if (uRaw === "sng") textDecoration = "underline";
298
- else if (strikeRaw === "sngStrike") textDecoration = "line-through";
299
- else if (uRaw === "none" && strikeRaw === "noStrike") textDecoration = "none";
300
- const capRaw = rPrCursor.attr("cap");
301
- let textTransform;
302
- if (capRaw === "all") textTransform = "uppercase";
303
- else if (capRaw === "none") textTransform = "none";
304
- const spcRaw = rPrCursor.attr("spc");
305
- const spcParsed = spcRaw === void 0 ? void 0 : ooxmlIntSchema.safeParse(spcRaw);
306
- const letterSpacing = spcParsed?.success && spcParsed.data >= -4e5 && spcParsed.data <= 4e5 ? spcParsed.data / 75 : void 0;
307
- const solidFill = rPrCursor.child(A_NS, "solidFill");
308
- const color = solidFill === void 0 ? void 0 : readSolidFillColor(solidFill);
309
- if (solidFill !== void 0) consumeSubtree(solidFill);
310
- const textShadow = readChartOuterShadow(rPrCursor);
340
+ /** Keep both native axes until the final chart text position is known. */
341
+ function cascadeChartStyle(inherited, local) {
342
+ return {
343
+ ...inherited,
344
+ ...local,
345
+ ...local?.decoration === void 0 ? {} : { decoration: cascadeOoxmlTextDecoration(inherited?.decoration, local.decoration) }
346
+ };
347
+ }
348
+ function projectChartStyle(native) {
349
+ const { decoration, ...style } = native;
350
+ const textDecoration = projectOoxmlTextDecoration(decoration);
351
+ return {
352
+ ...style,
353
+ ...textDecoration === void 0 ? {} : { textDecoration }
354
+ };
355
+ }
356
+ function diffNativeChartStyle(local, inherited) {
357
+ return local === void 0 ? void 0 : diffChartTextStyle(projectChartStyle(cascadeChartStyle(inherited, local)), projectChartStyle(inherited ?? {}));
358
+ }
359
+ function readChartRunProperties(rPrCursor, ctx) {
360
+ const attrStyles = readOoxmlRunAttrStyles({
361
+ rPrCursor,
362
+ location: ctx.location,
363
+ diagnostics: ctx.diagnostics,
364
+ allowBaseline: false,
365
+ diagnoseUnsupportedEnums: true
366
+ });
367
+ const { color, textStroke } = readRunFillAndStroke(rPrCursor, ctx.location, ctx.diagnostics);
368
+ const textShadow = readChartOuterShadow(rPrCursor, ctx);
311
369
  const { fontFamily, eastAsianFontFamily } = readRunFontSlots(rPrCursor);
312
370
  consumeSubtree(rPrCursor);
313
371
  return {
314
372
  ...fontFamily === void 0 ? {} : { fontFamily },
315
373
  ...eastAsianFontFamily === void 0 ? {} : { eastAsianFontFamily },
316
- ...fontSize === void 0 ? {} : { fontSize },
317
- ...fontWeight === void 0 ? {} : { fontWeight },
318
- ...fontStyle === void 0 ? {} : { fontStyle },
374
+ ...attrStyles.fontSize === void 0 ? {} : { fontSize: attrStyles.fontSize },
375
+ ...attrStyles.fontWeight === void 0 ? {} : { fontWeight: attrStyles.fontWeight },
376
+ ...attrStyles.fontStyle === void 0 ? {} : { fontStyle: attrStyles.fontStyle },
319
377
  ...color === void 0 ? {} : { color },
320
- ...letterSpacing === void 0 ? {} : { letterSpacing },
321
- ...textTransform === void 0 ? {} : { textTransform },
322
- ...textDecoration === void 0 ? {} : { textDecoration },
378
+ ...attrStyles.letterSpacing === void 0 ? {} : { letterSpacing: attrStyles.letterSpacing },
379
+ ...attrStyles.textTransform === void 0 ? {} : { textTransform: attrStyles.textTransform },
380
+ ...attrStyles.decoration === void 0 ? {} : { decoration: attrStyles.decoration },
323
381
  ...textShadow === void 0 ? {} : { textShadow },
324
- ...lang === void 0 ? {} : { lang }
382
+ ...textStroke === void 0 ? {} : { textStroke },
383
+ ...attrStyles.lang === void 0 ? {} : { lang: attrStyles.lang }
325
384
  };
326
385
  }
327
- function readChartTextProperties(txPrCursor) {
386
+ function readChartTextBodyStyle(cursor) {
328
387
  let verticalAlign;
329
- const bodyPr = txPrCursor.child(A_NS, "bodyPr");
388
+ const bodyPr = cursor.child(A_NS, "bodyPr");
330
389
  if (bodyPr !== void 0) {
331
390
  const anchor = bodyPr.attr("anchor");
332
391
  if (anchor === "t") verticalAlign = "top";
@@ -334,63 +393,68 @@ function readChartTextProperties(txPrCursor) {
334
393
  else if (anchor === "b") verticalAlign = "bottom";
335
394
  consumeSubtree(bodyPr);
336
395
  }
337
- let align;
338
- let lineHeight;
339
- let spacingAfter;
340
- let defStyle = {};
341
- let runStyle = {};
342
- let endLang;
396
+ return verticalAlign === void 0 ? {} : { verticalAlign };
397
+ }
398
+ function readChartListDecorations(body, ctx) {
399
+ if (body.ignoreEmptyChild("http://schemas.openxmlformats.org/drawingml/2006/main", "lstStyle")) return void 0;
400
+ const list = body.child(A_NS, "lstStyle");
401
+ if (list === void 0) return void 0;
402
+ const read = (name) => {
403
+ const defaults = list.child(A_NS, name)?.child(A_NS, "defRPr");
404
+ return defaults === void 0 ? void 0 : readOoxmlTextDecoration(defaults, ctx.location, ctx.diagnostics, true);
405
+ };
406
+ const base = read("defPPr");
407
+ return Array.from({ length: 9 }, (_, index) => {
408
+ const level = read(`lvl${index + 1}pPr`);
409
+ return level === void 0 ? base : cascadeOoxmlTextDecoration(base, level);
410
+ });
411
+ }
412
+ function readChartParagraphStyle(pPr, ctx, levels) {
413
+ const level = ooxmlListLevelSchema.safeParse(pPr?.attr("lvl"));
414
+ const decoration = levels?.[level.success ? level.data : 0];
415
+ const inherited = decoration === void 0 ? {} : { decoration };
416
+ if (pPr === void 0) return inherited;
417
+ const layout = readDrawingParagraphLayout(pPr, ctx.location, ctx.diagnostics);
418
+ const defRPr = pPr.child(A_NS, "defRPr");
419
+ const defStyle = defRPr === void 0 ? {} : readChartRunProperties(defRPr, ctx);
420
+ for (const name of ["lnSpc", "spcAft"]) {
421
+ const spacing = pPr.child(A_NS, name);
422
+ if (spacing !== void 0) consumeSubtree(spacing);
423
+ }
424
+ consumeSubtree(pPr);
425
+ return {
426
+ ...cascadeChartStyle(inherited, defStyle),
427
+ ...layout
428
+ };
429
+ }
430
+ function readChartTextProperties(txPrCursor, ctx) {
431
+ const body = readChartTextBodyStyle(txPrCursor);
343
432
  const p = txPrCursor.child(A_NS, "p");
344
- if (p !== void 0) {
345
- const pPr = p.child(A_NS, "pPr");
346
- if (pPr !== void 0) {
347
- const algn = pPr.attr("algn");
348
- if (algn === "l") align = "left";
349
- else if (algn === "ctr") align = "center";
350
- else if (algn === "r") align = "right";
351
- else if (algn === "just") align = "justify";
352
- const lnSpc = pPr.child(A_NS, "lnSpc");
353
- if (lnSpc !== void 0) {
354
- const spcPts = readIntVal(lnSpc.child(A_NS, "spcPts"));
355
- const spcPct = readIntVal(lnSpc.child(A_NS, "spcPct"));
356
- if (spcPts !== void 0 && spcPts > 0 && spcPts <= 158400) lineHeight = `${spcPts / 100}pt`;
357
- else if (spcPct !== void 0 && spcPct > 0 && spcPct <= 132e5) lineHeight = `${spcPct / 1e3}%`;
358
- consumeSubtree(lnSpc);
359
- }
360
- const spcAft = pPr.child(A_NS, "spcAft");
361
- if (spcAft !== void 0) {
362
- const spcPts = readIntVal(spcAft.child(A_NS, "spcPts"));
363
- if (spcPts !== void 0 && spcPts >= 0 && spcPts <= 158400) spacingAfter = spcPts / 75;
364
- consumeSubtree(spcAft);
365
- }
366
- const defRPr = pPr.child(A_NS, "defRPr");
367
- if (defRPr !== void 0) defStyle = readChartRunProperties(defRPr);
368
- consumeSubtree(pPr);
369
- }
370
- const r = p.child(A_NS, "r");
371
- if (r !== void 0) {
372
- const rPr = r.child(A_NS, "rPr");
373
- if (rPr !== void 0) runStyle = readChartRunProperties(rPr);
374
- consumeSubtree(r);
375
- }
376
- const endParaRPr = p.child(A_NS, "endParaRPr");
377
- if (endParaRPr !== void 0) {
378
- const rawLang = endParaRPr.attr("lang");
379
- const parsedLang = rawLang === void 0 ? void 0 : bcp47LangSchema.safeParse(rawLang);
380
- if (parsedLang?.success) endLang = parsedLang.data;
381
- consumeSubtree(endParaRPr);
382
- }
383
- consumeSubtree(p);
433
+ if (p === void 0) {
434
+ consumeSubtree(txPrCursor);
435
+ return Object.keys(body).length === 0 ? void 0 : body;
436
+ }
437
+ const defaults = readChartParagraphStyle(p.child(A_NS, "pPr"), ctx, readChartListDecorations(txPrCursor, ctx));
438
+ const rPr = p.child(A_NS, "r")?.child(A_NS, "rPr");
439
+ const runStyle = rPr === void 0 ? {} : readChartRunProperties(rPr, ctx);
440
+ let endLang;
441
+ const endParaRPr = p.child(A_NS, "endParaRPr");
442
+ if (endParaRPr !== void 0) {
443
+ const endAttrs = readOoxmlRunAttrStyles({
444
+ rPrCursor: endParaRPr,
445
+ location: ctx.location,
446
+ diagnostics: ctx.diagnostics,
447
+ allowBaseline: false,
448
+ diagnoseUnsupportedEnums: true
449
+ });
450
+ if (endAttrs.lang !== void 0) endLang = endAttrs.lang;
451
+ consumeSubtree(endParaRPr);
384
452
  }
385
453
  consumeSubtree(txPrCursor);
386
454
  const merged = {
387
- ...defStyle,
388
- ...runStyle,
389
- ...endLang !== void 0 && defStyle.lang === void 0 && runStyle.lang === void 0 ? { lang: endLang } : {},
390
- ...verticalAlign === void 0 ? {} : { verticalAlign },
391
- ...align === void 0 ? {} : { align },
392
- ...lineHeight === void 0 ? {} : { lineHeight },
393
- ...spacingAfter === void 0 ? {} : { spacingAfter }
455
+ ...body,
456
+ ...cascadeChartStyle(defaults, runStyle),
457
+ ...endLang !== void 0 && defaults.lang === void 0 && runStyle.lang === void 0 ? { lang: endLang } : {}
394
458
  };
395
459
  return Object.keys(merged).length === 0 ? void 0 : merged;
396
460
  }
@@ -427,6 +491,9 @@ function diffChartTextStyle(child, inherited) {
427
491
  verticalAlign: "top",
428
492
  textDecoration: "none",
429
493
  textTransform: "none",
494
+ textShadow: "none",
495
+ letterSpacing: 0,
496
+ spacingAfter: 0,
430
497
  color: "dk1",
431
498
  ...inherited
432
499
  };
@@ -452,53 +519,26 @@ function normalizeRootChartStyle(rawStyle) {
452
519
  }
453
520
  return Object.keys(out).length === 0 ? void 0 : out;
454
521
  }
455
- function readChartTitle(titleCursor, inheritedStyle) {
522
+ function readChartTitle(titleCursor, inheritedStyle, ctx) {
523
+ const spPr = readChartSpPr(titleCursor, ctx);
524
+ if (spPr !== void 0) consumeBenignChartSpPr(spPr);
456
525
  let titleText;
457
526
  let richStyle;
458
527
  const tx = titleCursor.child(C_NS, "tx");
459
528
  if (tx !== void 0) {
460
529
  const rich = tx.child(C_NS, "rich");
461
530
  if (rich !== void 0) {
462
- const bodyPr = rich.child(A_NS, "bodyPr");
463
- const anchor = bodyPr?.attr("anchor");
464
- const verticalAlign = anchor === "t" ? "top" : anchor === "ctr" ? "middle" : anchor === "b" ? "bottom" : void 0;
465
- if (bodyPr !== void 0) consumeSubtree(bodyPr);
466
- let align;
467
- let lineHeight;
468
- let spacingAfter;
469
- let defRun = {};
531
+ const body = readChartTextBodyStyle(rich);
532
+ let paragraphStyle = {};
470
533
  let explicitRun = {};
471
534
  const parts = [];
472
535
  for (const [paraIndex, para] of rich.children(A_NS, "p").entries()) {
473
- if (paraIndex === 0) {
474
- const pPr = para.child(A_NS, "pPr");
475
- if (pPr !== void 0) {
476
- const algn = pPr.attr("algn");
477
- align = algn === "l" ? "left" : algn === "ctr" ? "center" : algn === "r" ? "right" : algn === "just" ? "justify" : void 0;
478
- const lnSpc = pPr.child(A_NS, "lnSpc");
479
- if (lnSpc !== void 0) {
480
- const spcPts = readIntVal(lnSpc.child(A_NS, "spcPts"));
481
- const spcPct = readIntVal(lnSpc.child(A_NS, "spcPct"));
482
- if (spcPts !== void 0 && spcPts > 0 && spcPts <= 158400) lineHeight = `${spcPts / 100}pt`;
483
- else if (spcPct !== void 0 && spcPct > 0 && spcPct <= 132e5) lineHeight = `${spcPct / 1e3}%`;
484
- consumeSubtree(lnSpc);
485
- }
486
- const spcAft = pPr.child(A_NS, "spcAft");
487
- if (spcAft !== void 0) {
488
- const spcPts = readIntVal(spcAft.child(A_NS, "spcPts"));
489
- if (spcPts !== void 0 && spcPts >= 0 && spcPts <= 158400) spacingAfter = spcPts / 75;
490
- consumeSubtree(spcAft);
491
- }
492
- const defRPr = pPr.child(A_NS, "defRPr");
493
- if (defRPr !== void 0) defRun = readChartRunProperties(defRPr);
494
- consumeSubtree(pPr);
495
- }
496
- }
536
+ if (paraIndex === 0) paragraphStyle = readChartParagraphStyle(para.child(A_NS, "pPr"), ctx);
497
537
  const runs = [];
498
538
  for (const child of para.remainingElementChildren()) if (child.namespaceUri === "http://schemas.openxmlformats.org/drawingml/2006/main" && child.localName === "r") {
499
539
  if (paraIndex === 0 && Object.keys(explicitRun).length === 0) {
500
540
  const rPr = child.child(A_NS, "rPr");
501
- if (rPr !== void 0) explicitRun = readChartRunProperties(rPr);
541
+ if (rPr !== void 0) explicitRun = readChartRunProperties(rPr, ctx);
502
542
  }
503
543
  const t = child.child(A_NS, "t");
504
544
  if (t !== void 0) runs.push(t.textContent);
@@ -513,12 +553,8 @@ function readChartTitle(titleCursor, inheritedStyle) {
513
553
  titleText = parts.join("\n");
514
554
  consumeSubtree(rich);
515
555
  richStyle = {
516
- ...defRun,
517
- ...explicitRun,
518
- ...verticalAlign === void 0 ? {} : { verticalAlign },
519
- ...align === void 0 ? {} : { align },
520
- ...lineHeight === void 0 ? {} : { lineHeight },
521
- ...spacingAfter === void 0 ? {} : { spacingAfter }
556
+ ...cascadeChartStyle(paragraphStyle, explicitRun),
557
+ ...body
522
558
  };
523
559
  } else {
524
560
  const strRef = tx.child(C_NS, "strRef");
@@ -537,13 +573,10 @@ function readChartTitle(titleCursor, inheritedStyle) {
537
573
  consumeSubtree(tx);
538
574
  }
539
575
  const txPr = titleCursor.child(C_NS, "txPr");
540
- const txPrStyle = txPr === void 0 ? void 0 : readChartTextProperties(txPr);
576
+ const txPrStyle = txPr === void 0 ? void 0 : readChartTextProperties(txPr, ctx);
541
577
  consumeSubtree(titleCursor);
542
578
  if (titleText === void 0 || titleText.trim() === "") return void 0;
543
- const styleDiff = diffChartTextStyle(richStyle !== void 0 || txPrStyle !== void 0 ? {
544
- ...txPrStyle,
545
- ...richStyle
546
- } : void 0, inheritedStyle);
579
+ const styleDiff = diffNativeChartStyle(richStyle !== void 0 || txPrStyle !== void 0 ? cascadeChartStyle(txPrStyle, richStyle) : void 0, inheritedStyle);
547
580
  return styleDiff === void 0 ? titleText : {
548
581
  text: titleText,
549
582
  style: styleDiff
@@ -692,12 +725,12 @@ function readSeriesName(txCursor) {
692
725
  consumeSubtree(txCursor);
693
726
  return text;
694
727
  }
695
- function readMarkerElement(markerCursor) {
728
+ function readMarkerElement(markerCursor, ctx) {
696
729
  const symbolCursor = markerCursor.child(C_NS, "symbol");
697
730
  const parsedSymbol = symbolCursor === void 0 ? void 0 : MarkerSymbolSchema.safeParse(symbolCursor.attrsObject(["val"]));
698
731
  const symbol = parsedSymbol?.success ? parsedSymbol.data.val : void 0;
699
732
  const size = readIntVal(markerCursor.child(C_NS, "size"));
700
- const spPr = markerCursor.child(C_NS, "spPr");
733
+ const spPr = readChartSpPr(markerCursor, ctx);
701
734
  let fill;
702
735
  let line;
703
736
  if (spPr !== void 0) {
@@ -716,7 +749,215 @@ function readMarkerElement(markerCursor) {
716
749
  ...line === void 0 ? {} : { line }
717
750
  };
718
751
  }
719
- function readDataLabelSettingsBody(cursor, kind, isPointLevel = false) {
752
+ /** Resolve same-node category aliases before cascading the two independent switches. */
753
+ function mergeCategoryFlags(categoryRange, ...levels) {
754
+ const flags = {};
755
+ for (const level of levels) {
756
+ if (level?.name !== void 0) flags.name = level.name && !(categoryRange && level.range !== void 0);
757
+ if (level?.range !== void 0) flags.range = level.range;
758
+ }
759
+ return flags;
760
+ }
761
+ function categoryLabelOverride(local, parent, inheritedCategory) {
762
+ const name = local.name ?? parent?.name;
763
+ const range = local.range ?? parent?.range;
764
+ const enabled = name === true || range === true;
765
+ return local.name || local.range || enabled !== (inheritedCategory === true) ? enabled : void 0;
766
+ }
767
+ function readPointLabelField(nativeType, scatter) {
768
+ switch (nativeType?.toUpperCase()) {
769
+ case "SERIESNAME": return "seriesName";
770
+ case "CATEGORYNAME": return scatter ? "xValue" : "category";
771
+ case "XVALUE": return "xValue";
772
+ case "VALUE":
773
+ case "YVALUE": return "value";
774
+ case "PERCENTAGE": return "percent";
775
+ case "CELLRANGE": return "cellRange";
776
+ default: return;
777
+ }
778
+ }
779
+ function formatPointLabelField(field, point, numberFormat) {
780
+ if (field === void 0) return void 0;
781
+ const data = point[field];
782
+ return typeof data === "number" ? formatChartNumber(data, numberFormat ?? (field === "percent" ? "0%" : void 0)) : data ?? void 0;
783
+ }
784
+ function isAutomaticPointLabel(tokens, settings) {
785
+ const fields = chartDataLabelFieldOrder.filter((field) => settings[field] === true);
786
+ const separator = settings.separator ?? ", ";
787
+ let index = 0;
788
+ let literal = "";
789
+ for (const token of tokens) if (!("field" in token)) literal += token.text;
790
+ else {
791
+ if (literal !== (index === 0 ? "" : separator) || token.field !== fields[index] || index >= fields.length) return false;
792
+ literal = "";
793
+ index += 1;
794
+ }
795
+ return index === fields.length && literal === "";
796
+ }
797
+ /** Reads the XML once; group point labels may be evaluated for several series. */
798
+ function readPointLabelText(tx, kind, ctx) {
799
+ const rich = tx.child(C_NS, "rich");
800
+ if (rich === void 0) {
801
+ const strRef = tx.child(C_NS, "strRef");
802
+ const cache = strRef?.child(C_NS, "strCache");
803
+ const first = cache?.child(C_NS, "pt");
804
+ const text = first?.child("http://schemas.openxmlformats.org/drawingml/2006/chart", "v")?.textContent ?? "";
805
+ if (first !== void 0) consumeSubtree(first);
806
+ if (cache !== void 0) consumeSubtree(cache);
807
+ if (strRef !== void 0) consumeSubtree(strRef);
808
+ consumeSubtree(tx);
809
+ return {
810
+ xpath: tx.xpath,
811
+ tokens: [{ text }],
812
+ hasFields: false
813
+ };
814
+ }
815
+ const body = readChartTextBodyStyle(rich);
816
+ const levels = readChartListDecorations(rich, ctx);
817
+ const tokens = [];
818
+ let hasFields = false;
819
+ for (const [index, paragraph] of rich.children(A_NS, "p").entries()) {
820
+ if (index > 0) tokens.push({ text: "\n" });
821
+ const paragraphStyle = readChartParagraphStyle(paragraph.child(A_NS, "pPr"), ctx, levels);
822
+ const endParaRPr = paragraph.child(A_NS, "endParaRPr");
823
+ if (endParaRPr !== void 0) consumeSubtree(endParaRPr);
824
+ const inlines = paragraph.matchingChildren((child) => child.namespaceURI === "http://schemas.openxmlformats.org/drawingml/2006/main" && (child.localName === "r" || child.localName === "br" || child.localName === "fld"));
825
+ for (const child of inlines) {
826
+ if (child.localName === "br") tokens.push({ text: "\n" });
827
+ else {
828
+ const textNode = child.child(A_NS, "t");
829
+ const text = textNode?.textContent ?? "";
830
+ if (textNode !== void 0) consumeSubtree(textNode);
831
+ const rPr = child.child(A_NS, "rPr");
832
+ const run = rPr === void 0 ? {} : readChartRunProperties(rPr, ctx);
833
+ const style = {
834
+ ...body,
835
+ ...cascadeChartStyle(paragraphStyle, run)
836
+ };
837
+ if (child.localName === "fld") {
838
+ hasFields = true;
839
+ const field = readPointLabelField(child.attr("type"), kind === "scatter");
840
+ tokens.push({
841
+ text,
842
+ style,
843
+ field,
844
+ xpath: child.xpath
845
+ });
846
+ } else tokens.push({
847
+ text,
848
+ style,
849
+ xpath: child.xpath
850
+ });
851
+ }
852
+ consumeSubtree(child);
853
+ }
854
+ consumeSubtree(paragraph);
855
+ }
856
+ consumeSubtree(rich);
857
+ consumeSubtree(tx);
858
+ return {
859
+ xpath: rich.xpath,
860
+ bodyStyle: body,
861
+ tokens,
862
+ hasFields
863
+ };
864
+ }
865
+ /** Resolves cached or dynamic text and retains the first visible run's style. */
866
+ function resolvePointLabelText(source, base, settings, point) {
867
+ let style;
868
+ const decorations = [];
869
+ let mixedStyles = false;
870
+ let text = "";
871
+ for (const token of source.tokens) {
872
+ const value = "field" in token && point !== void 0 ? formatPointLabelField(token.field, point, settings.numberFormat) ?? token.text : token.text;
873
+ text += value;
874
+ if (value === "" || token.style === void 0) continue;
875
+ const native = cascadeChartStyle(base, token.style);
876
+ const projected = projectChartStyle(native);
877
+ if (native.decoration !== void 0 && token.xpath !== void 0) decorations.push({
878
+ xpath: token.xpath,
879
+ state: native.decoration
880
+ });
881
+ if (style === void 0) style = projected;
882
+ else if (!mixedStyles) mixedStyles = diffChartTextStyle(projected, style) !== void 0 || diffChartTextStyle(style, projected) !== void 0;
883
+ }
884
+ const automatic = source.hasFields && isAutomaticPointLabel(source.tokens, settings);
885
+ if (text !== "" && !automatic) style ??= projectChartStyle(cascadeChartStyle(base, source.bodyStyle));
886
+ return {
887
+ ...text === "" || automatic ? {} : { text },
888
+ ...style === void 0 ? {} : { style },
889
+ mixedStyles,
890
+ decorations,
891
+ staticFieldFallback: source.hasFields && !automatic
892
+ };
893
+ }
894
+ function reportLabelDecoration(state, xpath, ctx) {
895
+ if (state === void 0 || ctx.reportedLabelFallbacks.has(xpath)) return;
896
+ const before = ctx.diagnostics.length;
897
+ reportOoxmlTextDecorationLoss(state, {
898
+ ...ctx.location,
899
+ xpath
900
+ }, ctx.diagnostics);
901
+ if (ctx.diagnostics.length > before) ctx.reportedLabelFallbacks.add(xpath);
902
+ }
903
+ function applyPointLabelText(kind, source, settings, baseStyle, baseline, ctx, point) {
904
+ const effective = mergeDataLabels(baseline, settings) || {};
905
+ const { text, style, mixedStyles, staticFieldFallback, decorations } = "resolved" in source ? source.resolved : resolvePointLabelText(source, baseStyle, effective, point);
906
+ function reportFallback(preferredMechanism, selectedFallback, retainedAs) {
907
+ const key = `${source.xpath}:${preferredMechanism}`;
908
+ if (ctx.reportedLabelFallbacks.has(key)) return;
909
+ ctx.reportedLabelFallbacks.add(key);
910
+ ctx.diagnostics.push({
911
+ code: "compatibility-fallback",
912
+ category: "unsupported",
913
+ disposition: "fallback",
914
+ location: {
915
+ ...ctx.location,
916
+ xpath: source.xpath
917
+ },
918
+ preferredMechanism,
919
+ selectedFallback,
920
+ loss: {
921
+ lost: "native-mechanism",
922
+ retainedAs
923
+ }
924
+ });
925
+ }
926
+ if (text !== void 0 || hasAutomaticDataLabels(kind, effective)) {
927
+ if (decorations.length === 0) reportLabelDecoration(baseStyle.decoration, source.xpath, ctx);
928
+ for (const { xpath, state } of decorations) reportLabelDecoration(state, xpath, ctx);
929
+ }
930
+ if (mixedStyles) reportFallback("mixed chart data label text styles", "first visible run style", "uniform chart data label style");
931
+ if (staticFieldFallback) reportFallback("dynamic chart data label fields", "static chart data label text", "static chart data label text");
932
+ return {
933
+ ...settings,
934
+ ...text === void 0 ? {} : { text },
935
+ ...style === void 0 ? {} : { style }
936
+ };
937
+ }
938
+ function readDataLabelFlag(cursor, name) {
939
+ return readBoolVal(cursor.child(C_NS, name), true);
940
+ }
941
+ /** Drops point-label layout, which the editable chart model cannot represent. */
942
+ function omitPointLabelLayout(layout, ctx) {
943
+ if (layout === void 0 || layout.ignoreEmptyChild("http://schemas.openxmlformats.org/drawingml/2006/chart", "manualLayout")) return;
944
+ const manual = layout.child(C_NS, "manualLayout");
945
+ if (manual === void 0) return;
946
+ ctx.diagnostics.push({
947
+ code: "unsupported-mechanism",
948
+ category: "unsupported",
949
+ disposition: "omitted",
950
+ location: {
951
+ ...ctx.location,
952
+ xpath: manual.xpath
953
+ },
954
+ namespaceUri: manual.namespaceUri,
955
+ localName: manual.localName,
956
+ mechanismHint: "manualLayout"
957
+ });
958
+ manual.suppressUnconsumed();
959
+ }
960
+ function readDataLabelSettingsBody(cursor, kind, ctx, isPointLevel) {
720
961
  const numFmtCursor = cursor.child(C_NS, "numFmt");
721
962
  let numberFormat;
722
963
  if (numFmtCursor !== void 0) {
@@ -725,10 +966,10 @@ function readDataLabelSettingsBody(cursor, kind, isPointLevel = false) {
725
966
  if (code !== void 0 && code.trim() !== "" && (slRaw === "0" || slRaw === "false" || code !== "General")) numberFormat = code;
726
967
  consumeSubtree(numFmtCursor);
727
968
  }
728
- const spPr = cursor.child(C_NS, "spPr");
969
+ const spPr = readChartSpPr(cursor, ctx);
729
970
  if (spPr !== void 0) consumeSubtree(spPr);
730
971
  const txPr = cursor.child(C_NS, "txPr");
731
- const rawStyle = txPr === void 0 ? void 0 : readChartTextProperties(txPr);
972
+ const rawStyle = txPr === void 0 ? void 0 : readChartTextProperties(txPr, ctx);
732
973
  const dLblPos = cursor.child(C_NS, "dLblPos");
733
974
  let position;
734
975
  if (dLblPos !== void 0) {
@@ -746,19 +987,19 @@ function readDataLabelSettingsBody(cursor, kind, isPointLevel = false) {
746
987
  }
747
988
  const legendKey = cursor.child(C_NS, "showLegendKey");
748
989
  if (legendKey !== void 0) consumeSubtree(legendKey);
749
- const showVal = readBoolVal(cursor.child(C_NS, "showVal"));
750
- const showCatName = readBoolVal(cursor.child(C_NS, "showCatName"));
751
- const showSerName = readBoolVal(cursor.child(C_NS, "showSerName"));
752
- const showPercent = readBoolVal(cursor.child(C_NS, "showPercent"));
990
+ const showVal = readDataLabelFlag(cursor, "showVal");
991
+ const showCatName = readDataLabelFlag(cursor, "showCatName");
992
+ const showSerName = readDataLabelFlag(cursor, "showSerName");
993
+ const showPercent = readDataLabelFlag(cursor, "showPercent");
753
994
  const showBubbleSize = cursor.child(C_NS, "showBubbleSize");
754
995
  if (showBubbleSize !== void 0) consumeSubtree(showBubbleSize);
755
996
  const sepCursor = cursor.child(C_NS, "separator");
756
997
  const separator = sepCursor !== void 0 && sepCursor.textContent.length > 0 ? sepCursor.textContent : void 0;
757
- const showLeaderLines = readBoolVal(cursor.child(C_NS, "showLeaderLines"));
998
+ const showLeaderLines = readDataLabelFlag(cursor, "showLeaderLines");
758
999
  const leaderLinesCursor = cursor.child(C_NS, "leaderLines");
759
1000
  let leaderLineStyle;
760
1001
  if (leaderLinesCursor !== void 0) {
761
- const lSpPr = leaderLinesCursor.child(C_NS, "spPr");
1002
+ const lSpPr = readChartSpPr(leaderLinesCursor, ctx);
762
1003
  if (lSpPr !== void 0) {
763
1004
  leaderLineStyle = readLineFromSpPr(lSpPr).line;
764
1005
  consumeSubtree(lSpPr);
@@ -768,81 +1009,114 @@ function readDataLabelSettingsBody(cursor, kind, isPointLevel = false) {
768
1009
  let showDataLabelsRange;
769
1010
  const extLst = cursor.child(C_NS, "extLst");
770
1011
  if (extLst !== void 0) for (const ext of extLst.children(C_NS, "ext")) {
1012
+ if (isPointLevel) omitPointLabelLayout(ext.child(C15_NS, "layout"), ctx);
771
1013
  const uri = ext.attr("uri");
772
1014
  if (uri === C15_DLBL_RANGE_FLAG_EXT_URI) {
773
- showDataLabelsRange = readBoolVal(ext.child(C15_NS, "showDataLabelsRange"));
1015
+ showDataLabelsRange = readBoolVal(ext.child(C15_NS, "showDataLabelsRange"), true);
774
1016
  consumeSubtree(ext);
775
1017
  } else if (uri === "{CE6537A1-D6FC-4f65-9D91-7224C49458BB}" || uri === "{0b15fc19-7d7d-44ad-8c2d-2c3a37ce22c3}" || uri === C16_UNIQUE_ID_EXT_URI) consumeSubtree(ext);
776
1018
  else if (directElementChild(ext.element, C15_NS, "layout") !== void 0 || directElementChild(ext.element, C15_NS, "showLeaderLines") !== void 0 || directElementChild(ext.element, C15_NS, "leaderLines") !== void 0 || directElementChild(ext.element, C15_NS, "showDataLabelsRange") !== void 0) consumeSubtree(ext);
777
1019
  }
778
1020
  for (const rem of cursor.remainingElementChildren()) if (rem.namespaceUri === C15_NS) consumeSubtree(rem);
779
- const category = kind === "scatter" ? void 0 : showDataLabelsRange === true ? true : showCatName === true ? true : showCatName === false && showDataLabelsRange === false ? false : void 0;
780
- const xValue = kind === "scatter" && showCatName === true ? true : void 0;
781
- const value = showVal === true ? true : showVal === false ? false : void 0;
782
- const percent = (kind === "pie" || kind === "doughnut") && showPercent === true ? true : (kind === "pie" || kind === "doughnut") && showPercent === false ? false : void 0;
783
- const seriesName = showSerName === true ? true : showSerName === false ? false : void 0;
784
- const hasVisibleContent = value === true || percent === true || category === true || xValue === true || seriesName === true;
785
- let leaderLines;
786
- if (!isPointLevel && (kind === "pie" || kind === "doughnut") && hasVisibleContent) {
787
- if (leaderLineStyle !== void 0) leaderLines = leaderLineStyle;
788
- else if (showLeaderLines !== void 0) leaderLines = showLeaderLines;
789
- }
1021
+ const xValue = kind === "scatter" ? showCatName : void 0;
1022
+ const value = showVal;
1023
+ const percent = kind === "pie" || kind === "doughnut" ? showPercent : void 0;
1024
+ const seriesName = showSerName;
1025
+ const settings = {
1026
+ ...value === void 0 ? {} : { value },
1027
+ ...percent === void 0 ? {} : { percent },
1028
+ ...xValue === void 0 ? {} : { xValue },
1029
+ ...seriesName === void 0 ? {} : { seriesName },
1030
+ ...separator === void 0 ? {} : { separator },
1031
+ ...position === void 0 ? {} : { position },
1032
+ ...numberFormat === void 0 ? {} : { numberFormat }
1033
+ };
1034
+ const leaderLines = !isPointLevel && (kind === "pie" || kind === "doughnut") ? leaderLineStyle ?? showLeaderLines : void 0;
790
1035
  return {
1036
+ ...kind === "scatter" ? {} : { categoryFlags: {
1037
+ ...showCatName === void 0 ? {} : { name: showCatName },
1038
+ ...showDataLabelsRange === void 0 ? {} : { range: showDataLabelsRange }
1039
+ } },
791
1040
  settings: {
792
- ...value === void 0 ? {} : { value },
793
- ...percent === void 0 ? {} : { percent },
794
- ...category === void 0 ? {} : { category },
795
- ...xValue === void 0 ? {} : { xValue },
796
- ...seriesName === void 0 ? {} : { seriesName },
797
- ...separator === void 0 ? {} : { separator },
798
- ...position === void 0 ? {} : { position },
799
- ...numberFormat === void 0 ? {} : { numberFormat },
1041
+ ...settings,
800
1042
  ...leaderLines === void 0 ? {} : { leaderLines }
801
1043
  },
802
- ...rawStyle === void 0 ? {} : { rawStyle },
803
- ...showDataLabelsRange === void 0 ? {} : { showDataLabelsRange }
1044
+ ...rawStyle === void 0 ? {} : { rawStyle }
804
1045
  };
805
1046
  }
806
- function readDataLabelsElement(dLblsCursor, kind, isGroupLevel, inheritedChartStyle) {
1047
+ function readDataLabelsElement(dLblsCursor, kind, isGroupLevel, inheritedChartStyle, ctx, group, categoryRange = false) {
807
1048
  const pointLabels = /* @__PURE__ */ new Map();
808
- const pointRawColors = /* @__PURE__ */ new Map();
1049
+ const inheritedLabels = group?.dataLabels;
1050
+ const del = readBoolVal(dLblsCursor.child(C_NS, "delete"), true);
1051
+ const { settings: body, categoryFlags, rawStyle } = del === true ? { settings: {} } : readDataLabelSettingsBody(dLblsCursor, kind, ctx, false);
1052
+ const category = isGroupLevel ? categoryLabelOverride(mergeCategoryFlags(categoryRange, categoryFlags)) : void 0;
1053
+ const settings = category === void 0 ? body : {
1054
+ ...body,
1055
+ category
1056
+ };
1057
+ const nativeCategory = categoryFlags === void 0 ? {} : { categoryFlags };
1058
+ const dataLabelsStyle = diffNativeChartStyle(rawStyle, inheritedChartStyle);
1059
+ const style = rawStyle === void 0 ? {} : { style: rawStyle };
809
1060
  for (const dLbl of dLblsCursor.children(C_NS, "dLbl")) {
810
1061
  const idx = readIntVal(dLbl.child(C_NS, "idx"));
811
- const del = readBoolVal(dLbl.child(C_NS, "delete"));
812
- if (idx !== void 0) {
813
- if (del === true) pointLabels.set(idx, false);
814
- else {
815
- const { settings, rawStyle } = readDataLabelSettingsBody(dLbl, kind, true);
816
- pointLabels.set(idx, settings);
817
- if (rawStyle?.color !== void 0) pointRawColors.set(idx, rawStyle.color);
1062
+ if (idx === void 0) {
1063
+ consumeSubtree(dLbl);
1064
+ continue;
1065
+ }
1066
+ if (readBoolVal(dLbl.child("http://schemas.openxmlformats.org/drawingml/2006/chart", "delete"), true) === true) {
1067
+ pointLabels.set(idx, {
1068
+ settings: false,
1069
+ xpath: dLbl.xpath
1070
+ });
1071
+ consumeSubtree(dLbl);
1072
+ continue;
1073
+ }
1074
+ omitPointLabelLayout(dLbl.child(C_NS, "layout"), ctx);
1075
+ const local = readDataLabelSettingsBody(dLbl, kind, ctx, true);
1076
+ const tx = dLbl.child(C_NS, "tx");
1077
+ let source;
1078
+ if (tx !== void 0) {
1079
+ source = readPointLabelText(tx, kind, ctx);
1080
+ if (!isGroupLevel && !source.hasFields) {
1081
+ const groupPoint = del === true || inheritedLabels === false ? void 0 : group?.pointLabels.get(idx);
1082
+ const pointStyle = cascadeChartStyle(cascadeChartStyle(cascadeChartStyle(inheritedChartStyle, rawStyle), groupPoint?.style), local.rawStyle);
1083
+ source = {
1084
+ xpath: source.xpath,
1085
+ hasFields: false,
1086
+ resolved: resolvePointLabelText(source, pointStyle, local.settings)
1087
+ };
818
1088
  }
819
1089
  }
1090
+ pointLabels.set(idx, {
1091
+ xpath: dLbl.xpath,
1092
+ settings: local.settings,
1093
+ ...local.categoryFlags === void 0 ? {} : { categoryFlags: local.categoryFlags },
1094
+ ...local.rawStyle === void 0 ? {} : { style: local.rawStyle },
1095
+ ...source === void 0 ? {} : { source }
1096
+ });
820
1097
  consumeSubtree(dLbl);
821
1098
  }
822
- if (readBoolVal(dLblsCursor.child("http://schemas.openxmlformats.org/drawingml/2006/chart", "delete")) === true) {
1099
+ if (del === true) {
823
1100
  consumeSubtree(dLblsCursor);
824
1101
  return {
825
1102
  dataLabels: false,
826
- pointLabels,
827
- pointLabelColors: /* @__PURE__ */ new Map()
1103
+ pointLabels
828
1104
  };
829
1105
  }
830
- const { settings, rawStyle, showDataLabelsRange } = readDataLabelSettingsBody(dLblsCursor, kind, false);
831
- const dataLabelsStyle = diffChartTextStyle(rawStyle, inheritedChartStyle);
832
- const inheritedLabelColor = rawStyle?.color ?? inheritedChartStyle?.color ?? "dk1";
833
- const pointLabelColors = /* @__PURE__ */ new Map();
834
- for (const [idx, color] of pointRawColors.entries()) if (!stableJsonEqual(color, inheritedLabelColor)) pointLabelColors.set(idx, color);
835
1106
  const hasAnyEnabledOrCustomized = settings.value === true || settings.percent === true || settings.category === true || settings.xValue === true || settings.seriesName === true || settings.separator !== void 0 || settings.numberFormat !== void 0 || settings.position !== void 0 || settings.leaderLines !== void 0 || dataLabelsStyle !== void 0;
836
1107
  if (isGroupLevel && !hasAnyEnabledOrCustomized) return {
837
1108
  pointLabels,
838
- pointLabelColors
1109
+ ...style,
1110
+ ...nativeCategory
839
1111
  };
1112
+ const flags = {};
1113
+ for (const field of chartDataLabelFieldOrder) {
1114
+ const enabled = settings[field];
1115
+ if (enabled !== void 0 && (enabled || inheritedLabels && inheritedLabels[field] === true)) flags[field] = enabled;
1116
+ }
840
1117
  const normalized = {
841
- ...settings.value === true ? { value: true } : {},
842
- ...settings.percent === true ? { percent: true } : {},
843
- ...settings.category === true ? { category: true } : {},
844
- ...settings.xValue === true ? { xValue: true } : {},
845
- ...settings.seriesName === true ? { seriesName: true } : {},
1118
+ ...flags,
1119
+ ...dataLabelsStyle === void 0 ? {} : { style: dataLabelsStyle },
846
1120
  ...settings.separator === void 0 ? {} : { separator: settings.separator },
847
1121
  ...settings.position === void 0 ? {} : { position: settings.position },
848
1122
  ...settings.numberFormat === void 0 ? {} : { numberFormat: settings.numberFormat },
@@ -850,24 +1124,67 @@ function readDataLabelsElement(dLblsCursor, kind, isGroupLevel, inheritedChartSt
850
1124
  };
851
1125
  return {
852
1126
  ...Object.keys(normalized).length > 0 ? { dataLabels: normalized } : {},
853
- ...dataLabelsStyle === void 0 ? {} : { dataLabelsStyle },
854
1127
  pointLabels,
855
- pointLabelColors,
856
- ...showDataLabelsRange === void 0 ? {} : { showDataLabelsRange }
1128
+ ...nativeCategory,
1129
+ ...style
857
1130
  };
858
1131
  }
859
- function diffPointDataLabels(pointLabels, seriesLabels) {
860
- if (pointLabels === false) return false;
861
- if (seriesLabels === void 0 || seriesLabels === false) return Object.keys(pointLabels).length === 0 ? void 0 : pointLabels;
862
- const out = {};
863
- for (const [key, value] of Object.entries(pointLabels)) {
864
- if (value === void 0) continue;
865
- const baseVal = seriesLabels[key];
866
- if (!stableJsonEqual(value, baseVal)) out[key] = value;
1132
+ function diffPointDataLabels(pointLabels, seriesLabels, seriesStyle) {
1133
+ if (!pointLabels) return pointLabels;
1134
+ const { style, text } = pointLabels;
1135
+ const seriesSettings = seriesLabels || void 0;
1136
+ const styleDiff = diffChartTextStyle(style, seriesStyle);
1137
+ const out = styleDiff === void 0 ? {} : { style: styleDiff };
1138
+ if (text === void 0) for (const field of chartDataLabelFieldOrder) {
1139
+ const enabled = pointLabels[field];
1140
+ if (enabled === true || enabled === false && seriesSettings?.[field] === true) out[field] = enabled;
1141
+ }
1142
+ else out.text = text;
1143
+ for (const field of [
1144
+ "position",
1145
+ "numberFormat",
1146
+ "separator"
1147
+ ]) {
1148
+ const value = pointLabels[field];
1149
+ if (value !== void 0 && value !== seriesSettings?.[field]) out[field] = value;
867
1150
  }
868
1151
  return Object.keys(out).length === 0 ? void 0 : out;
869
1152
  }
870
- function readSeriesTrendlines(serCursor, kind, stacking, pointCount, fitPoints) {
1153
+ function readEffectivePointLabels(kind, group, series, pointCount, inheritedChartStyle, seriesXpath, pointData, ctx, categoryRange = false) {
1154
+ const result = /* @__PURE__ */ new Map();
1155
+ const baseline = mergeDataLabels(group?.dataLabels, series?.dataLabels);
1156
+ const useGroup = series?.dataLabels !== false && group?.dataLabels !== false;
1157
+ const parentFlags = mergeCategoryFlags(categoryRange, useGroup ? group?.categoryFlags : void 0, series?.categoryFlags);
1158
+ const indexes = /* @__PURE__ */ new Set([...useGroup ? group?.pointLabels.keys() ?? [] : [], ...series?.pointLabels.keys() ?? []]);
1159
+ const seriesStyle = cascadeChartStyle(inheritedChartStyle, series?.style);
1160
+ const publicSeriesStyle = projectChartStyle(seriesStyle);
1161
+ let defaultCount = pointCount;
1162
+ for (const index of indexes) {
1163
+ if (useGroup && !series?.pointLabels.has(index) && (index < 0 || index >= pointCount)) continue;
1164
+ const groupPoint = useGroup ? group?.pointLabels.get(index) : void 0;
1165
+ const seriesPoint = series?.pointLabels.get(index);
1166
+ let settings = mergeDataLabels(groupPoint?.settings, seriesPoint?.settings);
1167
+ const inRange = index >= 0 && index < pointCount;
1168
+ if (inRange) defaultCount -= 1;
1169
+ if (settings) {
1170
+ const category = categoryLabelOverride(mergeCategoryFlags(categoryRange, groupPoint?.categoryFlags, seriesPoint?.categoryFlags), parentFlags, baseline ? baseline.category : void 0);
1171
+ const pointStyle = cascadeChartStyle(cascadeChartStyle(seriesStyle, groupPoint?.style), seriesPoint?.style);
1172
+ settings = {
1173
+ ...settings,
1174
+ ...category === void 0 ? {} : { category },
1175
+ style: projectChartStyle(pointStyle)
1176
+ };
1177
+ const source = seriesPoint?.source ?? groupPoint?.source;
1178
+ if (source !== void 0 && inRange) settings = applyPointLabelText(kind, source, settings, pointStyle, baseline, ctx, source.hasFields ? pointData(index) : void 0);
1179
+ else if (inRange && hasVisibleDataLabels(kind, mergeDataLabels(baseline, settings))) reportLabelDecoration(pointStyle.decoration, (seriesPoint ?? groupPoint).xpath, ctx);
1180
+ }
1181
+ const point = diffPointDataLabels(settings, baseline, publicSeriesStyle);
1182
+ if (point !== void 0) result.set(index, point);
1183
+ }
1184
+ if (defaultCount > 0 && hasVisibleDataLabels(kind, baseline)) reportLabelDecoration(seriesStyle.decoration, seriesXpath, ctx);
1185
+ return result;
1186
+ }
1187
+ function readSeriesTrendlines(serCursor, kind, stacking, pointCount, fitPoints, ctx) {
871
1188
  const nodes = serCursor.children(C_NS, "trendline");
872
1189
  if (nodes.length === 0) return void 0;
873
1190
  const supported = kind !== "pie" && kind !== "doughnut" && stacking === void 0;
@@ -875,7 +1192,7 @@ function readSeriesTrendlines(serCursor, kind, stacking, pointCount, fitPoints)
875
1192
  for (const tl of nodes) {
876
1193
  const nameEl = tl.child(C_NS, "name");
877
1194
  if (nameEl !== void 0) consumeSubtree(nameEl);
878
- const spPr = tl.child(C_NS, "spPr");
1195
+ const spPr = readChartSpPr(tl, ctx);
879
1196
  const line = spPr === void 0 ? void 0 : readLineFromSpPr(spPr).line;
880
1197
  if (spPr !== void 0) consumeSubtree(spPr);
881
1198
  const typeRaw = readValAttr(tl.child(C_NS, "trendlineType"));
@@ -887,6 +1204,12 @@ function readSeriesTrendlines(serCursor, kind, stacking, pointCount, fitPoints)
887
1204
  const rawIntercept = readFloatVal(tl.child(C_NS, "intercept"));
888
1205
  const displayRSquared = readBoolVal(tl.child(C_NS, "dispRSqr"));
889
1206
  const displayEquation = readBoolVal(tl.child(C_NS, "dispEq"));
1207
+ const label = tl.child(C_NS, "trendlineLbl");
1208
+ if (label !== void 0) {
1209
+ const labelSpPr = readChartSpPr(label, ctx);
1210
+ if (labelSpPr !== void 0) consumeSubtree(labelSpPr);
1211
+ consumeSubtree(label);
1212
+ }
890
1213
  consumeSubtree(tl);
891
1214
  if (!supported || type === void 0) continue;
892
1215
  const validForecast = (value) => {
@@ -959,7 +1282,7 @@ function alignErrorBarValues(values, pointCount) {
959
1282
  return v !== void 0 && v !== null && Number.isFinite(v) && v >= 0 ? v : null;
960
1283
  });
961
1284
  }
962
- function readSingleErrorBars(errCursor, pointCount) {
1285
+ function readSingleErrorBars(errCursor, pointCount, ctx) {
963
1286
  const direction = readValAttr(errCursor.child("http://schemas.openxmlformats.org/drawingml/2006/chart", "errDir")) === "x" ? "x" : "y";
964
1287
  const includeParsed = ErrBarTypeSchema.safeParse(errCursor.child("http://schemas.openxmlformats.org/drawingml/2006/chart", "errBarType")?.attrsObject(["val"]) ?? {});
965
1288
  const include = includeParsed.success ? includeParsed.data.val : "both";
@@ -973,7 +1296,7 @@ function readSingleErrorBars(errCursor, pointCount) {
973
1296
  const rawMinus = minusCursor === void 0 ? void 0 : readNumericDataSource(minusCursor);
974
1297
  if (minusCursor !== void 0) consumeSubtree(minusCursor);
975
1298
  const val = readFloatVal(errCursor.child(C_NS, "val"));
976
- const spPr = errCursor.child(C_NS, "spPr");
1299
+ const spPr = readChartSpPr(errCursor, ctx);
977
1300
  const line = spPr === void 0 ? void 0 : readLineFromSpPr(spPr).line;
978
1301
  if (spPr !== void 0) consumeSubtree(spPr);
979
1302
  consumeSubtree(errCursor);
@@ -1029,23 +1352,23 @@ function readSingleErrorBars(errCursor, pointCount) {
1029
1352
  }
1030
1353
  };
1031
1354
  }
1032
- function readCategoryErrorBars(serCursor, kind, pointCount) {
1355
+ function readCategoryErrorBars(serCursor, kind, pointCount, ctx) {
1033
1356
  const nodes = serCursor.children(C_NS, "errBars");
1034
1357
  if (nodes.length === 0) return void 0;
1035
1358
  let result;
1036
1359
  for (const node of nodes) {
1037
- const parsed = readSingleErrorBars(node, pointCount);
1360
+ const parsed = readSingleErrorBars(node, pointCount, ctx);
1038
1361
  if (kind !== "pie" && kind !== "doughnut" && result === void 0) result = parsed.bars;
1039
1362
  }
1040
1363
  return result;
1041
1364
  }
1042
- function readScatterErrorBars(serCursor, pointCount) {
1365
+ function readScatterErrorBars(serCursor, pointCount, ctx) {
1043
1366
  const nodes = serCursor.children(C_NS, "errBars");
1044
1367
  if (nodes.length === 0) return void 0;
1045
1368
  let x;
1046
1369
  let y;
1047
1370
  for (const node of nodes) {
1048
- const parsed = readSingleErrorBars(node, pointCount);
1371
+ const parsed = readSingleErrorBars(node, pointCount, ctx);
1049
1372
  if (parsed.bars === void 0) continue;
1050
1373
  if (parsed.direction === "x" && x === void 0) x = parsed.bars;
1051
1374
  else if (parsed.direction === "y" && y === void 0) y = parsed.bars;
@@ -1056,16 +1379,51 @@ function readScatterErrorBars(serCursor, pointCount) {
1056
1379
  ...y === void 0 ? {} : { y }
1057
1380
  };
1058
1381
  }
1059
- function readCategorySeries(serCursor, kind, fallbackIndex, stacking, inheritedChartStyle) {
1382
+ function readSeriesDataLabelRange(serCursor) {
1383
+ let datalabelsRange;
1384
+ const extLst = serCursor.child(C_NS, "extLst");
1385
+ if (extLst !== void 0) for (const ext of extLst.children(C_NS, "ext")) {
1386
+ const uri = ext.attr("uri");
1387
+ if (uri === C15_CAT_RANGE_EXT_URI) {
1388
+ const range = ext.child(C15_NS, "datalabelsRange");
1389
+ if (range !== void 0) {
1390
+ const f = range.child(C15_NS, "f");
1391
+ const formula = f?.textContent;
1392
+ if (f !== void 0) consumeSubtree(f);
1393
+ const cache = range.child(C15_NS, "dlblRangeCache");
1394
+ if (cache !== void 0) datalabelsRange = {
1395
+ ...formula === void 0 ? {} : { formula },
1396
+ values: readStringCacheOrLit(cache)
1397
+ };
1398
+ consumeSubtree(range);
1399
+ }
1400
+ consumeSubtree(ext);
1401
+ } else if (uri === C16_UNIQUE_ID_EXT_URI) consumeSubtree(ext);
1402
+ }
1403
+ return datalabelsRange;
1404
+ }
1405
+ function readSeriesCategoryData(ser) {
1406
+ const catCursor = ser.child(C_NS, "cat");
1407
+ const categories = catCursor === void 0 ? { values: [] } : readStringDataSource(catCursor);
1408
+ const range = readSeriesDataLabelRange(ser);
1409
+ return {
1410
+ categories,
1411
+ range,
1412
+ categoryRange: range?.formula !== void 0 && range.formula === categories.formula
1413
+ };
1414
+ }
1415
+ function readCategorySeries(serCursor, kind, fallbackIndex, source, stacking, inheritedChartStyle, groupLabels, ctx) {
1060
1416
  const idx = readIntVal(serCursor.child("http://schemas.openxmlformats.org/drawingml/2006/chart", "idx")) ?? fallbackIndex;
1061
1417
  const order = readIntVal(serCursor.child("http://schemas.openxmlformats.org/drawingml/2006/chart", "order")) ?? idx;
1062
- const name = readSeriesName(serCursor.child("http://schemas.openxmlformats.org/drawingml/2006/chart", "tx")) ?? `Series ${fallbackIndex + 1}`;
1063
- const spPr = serCursor.child(C_NS, "spPr");
1418
+ const nativeName = readSeriesName(serCursor.child(C_NS, "tx"));
1419
+ const name = nativeName?.trim() ? nativeName : `Series ${fallbackIndex + 1}`;
1420
+ const spPr = readChartSpPr(serCursor, ctx);
1064
1421
  const { color, line } = spPr === void 0 ? {} : readSeriesSpPr(spPr, false);
1065
1422
  const invertIfNegative = serCursor.child(C_NS, "invertIfNegative");
1066
1423
  if (invertIfNegative !== void 0) consumeSubtree(invertIfNegative);
1067
1424
  const markerCursor = serCursor.child(C_NS, "marker");
1068
- const marker = markerCursor === void 0 ? void 0 : kind === "line" ? readMarkerElement(markerCursor) : (consumeSubtree(markerCursor), void 0);
1425
+ const importedMarker = markerCursor === void 0 ? void 0 : readMarkerElement(markerCursor, ctx);
1426
+ const marker = kind === "line" ? importedMarker : void 0;
1069
1427
  const explosionVal = readIntVal(serCursor.child(C_NS, "explosion"));
1070
1428
  const explosion = (kind === "pie" || kind === "doughnut") && explosionVal !== void 0 && explosionVal >= 0 ? explosionVal : void 0;
1071
1429
  const pointsRecord = {};
@@ -1076,10 +1434,11 @@ function readCategorySeries(serCursor, kind, fallbackIndex, stacking, inheritedC
1076
1434
  const bubble3D = dPt.child(C_NS, "bubble3D");
1077
1435
  if (bubble3D !== void 0) consumeSubtree(bubble3D);
1078
1436
  const pMarkerCursor = dPt.child(C_NS, "marker");
1079
- const pMarker = pMarkerCursor === void 0 ? void 0 : kind === "line" ? readMarkerElement(pMarkerCursor) : (consumeSubtree(pMarkerCursor), void 0);
1437
+ const importedPointMarker = pMarkerCursor === void 0 ? void 0 : readMarkerElement(pMarkerCursor, ctx);
1438
+ const pMarker = kind === "line" ? importedPointMarker : void 0;
1080
1439
  const pExplosionVal = readIntVal(dPt.child(C_NS, "explosion"));
1081
1440
  const pExplosion = (kind === "pie" || kind === "doughnut") && pExplosionVal !== void 0 && pExplosionVal >= 0 ? pExplosionVal : void 0;
1082
- const pSpPr = dPt.child(C_NS, "spPr");
1441
+ const pSpPr = readChartSpPr(dPt, ctx);
1083
1442
  const pStyle = pSpPr === void 0 ? {} : readSeriesSpPr(pSpPr, false);
1084
1443
  consumeSubtree(dPt);
1085
1444
  if (pointIdx !== void 0 && pointIdx >= 0) {
@@ -1093,23 +1452,20 @@ function readCategorySeries(serCursor, kind, fallbackIndex, stacking, inheritedC
1093
1452
  }
1094
1453
  }
1095
1454
  const dLblsCursor = serCursor.child(C_NS, "dLbls");
1096
- const dLblsResult = dLblsCursor === void 0 ? void 0 : readDataLabelsElement(dLblsCursor, kind, false, inheritedChartStyle);
1097
- if (dLblsResult !== void 0) {
1098
- for (const [ptIdx, labelColor] of dLblsResult.pointLabelColors.entries()) pointsRecord[ptIdx] = {
1099
- ...pointsRecord[ptIdx] ?? {},
1100
- labelColor
1455
+ let dLblsResult = dLblsCursor === void 0 ? void 0 : readDataLabelsElement(dLblsCursor, kind, false, inheritedChartStyle, ctx, groupLabels);
1456
+ if (dLblsResult?.dataLabels !== false) {
1457
+ const groupSettings = groupLabels?.dataLabels || void 0;
1458
+ const category = categoryLabelOverride(mergeCategoryFlags(source.categoryRange, dLblsResult?.categoryFlags), mergeCategoryFlags(source.categoryRange, groupLabels?.categoryFlags), groupSettings?.category);
1459
+ if (category !== void 0) dLblsResult = {
1460
+ ...dLblsResult,
1461
+ pointLabels: dLblsResult?.pointLabels ?? /* @__PURE__ */ new Map(),
1462
+ dataLabels: {
1463
+ ...dLblsResult?.dataLabels,
1464
+ category
1465
+ }
1101
1466
  };
1102
- for (const [ptIdx, ptLabel] of dLblsResult.pointLabels.entries()) {
1103
- const diffed = diffPointDataLabels(ptLabel, dLblsResult.dataLabels);
1104
- if (diffed === void 0) continue;
1105
- pointsRecord[ptIdx] = {
1106
- ...pointsRecord[ptIdx] ?? {},
1107
- dataLabels: diffed
1108
- };
1109
- }
1110
1467
  }
1111
- const catCursor = serCursor.child(C_NS, "cat");
1112
- const catData = catCursor === void 0 ? { values: [] } : readStringDataSource(catCursor);
1468
+ const catData = source.categories;
1113
1469
  const valCursor = serCursor.child(C_NS, "val");
1114
1470
  const valData = valCursor === void 0 ? [] : readNumericDataSource(valCursor);
1115
1471
  const smoothVal = readBoolVal(serCursor.child(C_NS, "smooth"));
@@ -1118,34 +1474,49 @@ function readCategorySeries(serCursor, kind, fallbackIndex, stacking, inheritedC
1118
1474
  x: valueIndex + 1,
1119
1475
  y
1120
1476
  }]);
1121
- const trendlines = readSeriesTrendlines(serCursor, kind, stacking, valData.length, fitPoints);
1122
- const errorBars = readCategoryErrorBars(serCursor, kind, valData.length);
1123
- let datalabelsRange;
1124
- const extLst = serCursor.child(C_NS, "extLst");
1125
- if (extLst !== void 0) for (const ext of extLst.children(C_NS, "ext")) {
1126
- const uri = ext.attr("uri");
1127
- if (uri === C15_CAT_RANGE_EXT_URI) {
1128
- const range = ext.child(C15_NS, "datalabelsRange");
1129
- if (range !== void 0) {
1130
- const f = range.child(C15_NS, "f");
1131
- if (f !== void 0) consumeSubtree(f);
1132
- const cache = range.child(C15_NS, "dlblRangeCache");
1133
- if (cache !== void 0) datalabelsRange = readStringCacheOrLit(cache);
1134
- consumeSubtree(range);
1135
- }
1136
- consumeSubtree(ext);
1137
- } else if (uri === C16_UNIQUE_ID_EXT_URI) consumeSubtree(ext);
1138
- }
1139
- const pointCount = Math.max(catData.values.length, valData.length);
1477
+ const trendlines = readSeriesTrendlines(serCursor, kind, stacking, valData.length, fitPoints, ctx);
1478
+ const errorBars = readCategoryErrorBars(serCursor, kind, valData.length, ctx);
1479
+ const datalabelsRange = source.range?.values;
1140
1480
  const categories = catData.values.length === 0 && valData.length > 0 ? Array.from({ length: valData.length }, (_, i) => String(i + 1)) : catData.values;
1481
+ let ringCategories = source.categoryRange ? datalabelsRange : void 0;
1482
+ if (kind === "doughnut" && !source.categoryRange && datalabelsRange !== void 0) {
1483
+ const group = groupLabels?.dataLabels !== false && dLblsResult?.dataLabels !== false ? groupLabels : void 0;
1484
+ const base = {
1485
+ ...group?.categoryFlags,
1486
+ ...dLblsResult?.categoryFlags
1487
+ };
1488
+ ringCategories = categories.map((category, index) => {
1489
+ const groupPoint = group?.pointLabels.get(index);
1490
+ const seriesPoint = dLblsResult?.pointLabels.get(index);
1491
+ const flags = {
1492
+ ...base,
1493
+ ...groupPoint?.categoryFlags,
1494
+ ...seriesPoint?.categoryFlags
1495
+ };
1496
+ return flags.range && !flags.name && (seriesPoint?.settings ?? groupPoint?.settings) !== false ? datalabelsRange[index] ?? category : category;
1497
+ });
1498
+ }
1499
+ const pointCount = Math.max(categories.length, valData.length);
1500
+ const total = kind === "pie" || kind === "doughnut" ? valData.reduce((sum, value) => sum + Math.max(0, value ?? 0), 0) : 0;
1501
+ for (const [index, dataLabels] of readEffectivePointLabels(kind, groupLabels, dLblsResult, pointCount, inheritedChartStyle, serCursor.xpath, (index) => ({
1502
+ seriesName: name,
1503
+ category: categories[index],
1504
+ value: valData[index],
1505
+ percent: total > 0 ? (valData[index] ?? 0) / total : void 0,
1506
+ cellRange: datalabelsRange?.[index]
1507
+ }), ctx, source.categoryRange)) pointsRecord[index] = {
1508
+ ...pointsRecord[index],
1509
+ dataLabels
1510
+ };
1141
1511
  const normalizedPoints = {};
1142
1512
  for (const [key, pt] of Object.entries(pointsRecord)) {
1143
1513
  const numKey = Number(key);
1144
1514
  if (numKey >= 0 && Number.isSafeInteger(numKey)) normalizedPoints[numKey] = pt;
1145
1515
  }
1516
+ const seriesDataLabels = dLblsResult?.dataLabels;
1146
1517
  return {
1147
1518
  order,
1148
- name: name.trim() === "" ? `Series ${fallbackIndex + 1}` : name,
1519
+ name,
1149
1520
  categories,
1150
1521
  ...catData.formula === void 0 ? {} : { categoryFormula: catData.formula },
1151
1522
  values: valData,
@@ -1154,30 +1525,30 @@ function readCategorySeries(serCursor, kind, fallbackIndex, stacking, inheritedC
1154
1525
  ...explosion === void 0 ? {} : { explosion },
1155
1526
  ...marker === void 0 ? {} : { marker },
1156
1527
  ...smooth === void 0 ? {} : { smooth },
1157
- ...dLblsResult?.dataLabels === void 0 ? {} : { dataLabels: dLblsResult.dataLabels },
1158
- ...dLblsResult?.dataLabelsStyle === void 0 ? {} : { dataLabelsStyle: dLblsResult.dataLabelsStyle },
1528
+ ...seriesDataLabels === void 0 ? {} : { dataLabels: seriesDataLabels },
1159
1529
  ...Object.keys(normalizedPoints).length === 0 ? {} : { points: normalizedPoints },
1160
1530
  ...trendlines === void 0 || pointCount === 0 ? {} : { trendlines },
1161
1531
  ...errorBars === void 0 ? {} : { errorBars },
1162
- ...datalabelsRange === void 0 || datalabelsRange.length === 0 ? {} : { datalabelsRange }
1532
+ ...ringCategories === void 0 || ringCategories.length === 0 ? {} : { datalabelsRange: ringCategories }
1163
1533
  };
1164
1534
  }
1165
- function readScatterSeries(serCursor, groupLine, groupMarkers, fallbackIndex, inheritedChartStyle) {
1535
+ function readScatterSeries(serCursor, groupLine, groupMarkers, fallbackIndex, inheritedChartStyle, groupLabels, ctx) {
1166
1536
  const idx = readIntVal(serCursor.child("http://schemas.openxmlformats.org/drawingml/2006/chart", "idx")) ?? fallbackIndex;
1167
1537
  const order = readIntVal(serCursor.child("http://schemas.openxmlformats.org/drawingml/2006/chart", "order")) ?? idx;
1168
- const name = readSeriesName(serCursor.child("http://schemas.openxmlformats.org/drawingml/2006/chart", "tx")) ?? `Series ${fallbackIndex + 1}`;
1169
- const spPr = serCursor.child(C_NS, "spPr");
1538
+ const nativeName = readSeriesName(serCursor.child(C_NS, "tx"));
1539
+ const name = nativeName?.trim() ? nativeName : `Series ${fallbackIndex + 1}`;
1540
+ const spPr = readChartSpPr(serCursor, ctx);
1170
1541
  const spStyle = spPr === void 0 ? {} : readSeriesSpPr(spPr, !(groupLine !== void 0 && groupLine !== false));
1171
1542
  const markerCursor = serCursor.child(C_NS, "marker");
1172
- const rawMarker = markerCursor === void 0 ? void 0 : readMarkerElement(markerCursor);
1543
+ const rawMarker = markerCursor === void 0 ? void 0 : readMarkerElement(markerCursor, ctx);
1173
1544
  const marker = !groupMarkers && rawMarker !== void 0 && rawMarker !== false ? void 0 : rawMarker;
1174
1545
  const pointsRecord = {};
1175
1546
  for (const dPt of serCursor.children(C_NS, "dPt")) {
1176
1547
  const pointIdx = readIntVal(dPt.child(C_NS, "idx"));
1177
1548
  const pMarkerCursor = dPt.child(C_NS, "marker");
1178
- const rawPMarker = pMarkerCursor === void 0 ? void 0 : readMarkerElement(pMarkerCursor);
1549
+ const rawPMarker = pMarkerCursor === void 0 ? void 0 : readMarkerElement(pMarkerCursor, ctx);
1179
1550
  const pMarker = !groupMarkers && rawPMarker !== void 0 && rawPMarker !== false ? void 0 : rawPMarker;
1180
- const pSpPr = dPt.child(C_NS, "spPr");
1551
+ const pSpPr = readChartSpPr(dPt, ctx);
1181
1552
  const pStyle = pSpPr === void 0 ? {} : readSeriesSpPr(pSpPr, false);
1182
1553
  consumeSubtree(dPt);
1183
1554
  if (pointIdx !== void 0 && pointIdx >= 0) {
@@ -1189,21 +1560,7 @@ function readScatterSeries(serCursor, groupLine, groupMarkers, fallbackIndex, in
1189
1560
  }
1190
1561
  }
1191
1562
  const dLblsCursor = serCursor.child(C_NS, "dLbls");
1192
- const dLblsResult = dLblsCursor === void 0 ? void 0 : readDataLabelsElement(dLblsCursor, "scatter", false, inheritedChartStyle);
1193
- if (dLblsResult !== void 0) {
1194
- for (const [ptIdx, labelColor] of dLblsResult.pointLabelColors.entries()) pointsRecord[ptIdx] = {
1195
- ...pointsRecord[ptIdx] ?? {},
1196
- labelColor
1197
- };
1198
- for (const [ptIdx, ptLabel] of dLblsResult.pointLabels.entries()) {
1199
- const diffed = diffPointDataLabels(ptLabel, dLblsResult.dataLabels);
1200
- if (diffed === void 0) continue;
1201
- pointsRecord[ptIdx] = {
1202
- ...pointsRecord[ptIdx] ?? {},
1203
- dataLabels: diffed
1204
- };
1205
- }
1206
- }
1563
+ const dLblsResult = dLblsCursor === void 0 ? void 0 : readDataLabelsElement(dLblsCursor, "scatter", false, inheritedChartStyle, ctx, groupLabels);
1207
1564
  const xCursor = serCursor.child(C_NS, "xVal");
1208
1565
  const yCursor = serCursor.child(C_NS, "yVal");
1209
1566
  let x = xCursor === void 0 ? [] : readNumericDataSource(xCursor);
@@ -1220,29 +1577,35 @@ function readScatterSeries(serCursor, groupLine, groupMarkers, fallbackIndex, in
1220
1577
  y: yv
1221
1578
  }];
1222
1579
  });
1223
- const trendlines = readSeriesTrendlines(serCursor, "scatter", void 0, x.length, fitPoints);
1224
- const errorBars = readScatterErrorBars(serCursor, x.length);
1580
+ const trendlines = readSeriesTrendlines(serCursor, "scatter", void 0, x.length, fitPoints, ctx);
1581
+ const errorBars = readScatterErrorBars(serCursor, x.length, ctx);
1225
1582
  const smoothCursor = serCursor.child(C_NS, "smooth");
1226
1583
  if (smoothCursor !== void 0) consumeSubtree(smoothCursor);
1227
- const extLst = serCursor.child(C_NS, "extLst");
1228
- if (extLst !== void 0) {
1229
- for (const ext of extLst.children(C_NS, "ext")) if (ext.attr("uri") === C16_UNIQUE_ID_EXT_URI) consumeSubtree(ext);
1230
- }
1584
+ const datalabelsRange = readSeriesDataLabelRange(serCursor);
1585
+ for (const [index, dataLabels] of readEffectivePointLabels("scatter", groupLabels, dLblsResult, x.length, inheritedChartStyle, serCursor.xpath, (index) => ({
1586
+ seriesName: name,
1587
+ xValue: x[index],
1588
+ value: y[index],
1589
+ cellRange: datalabelsRange?.values[index]
1590
+ }), ctx)) pointsRecord[index] = {
1591
+ ...pointsRecord[index],
1592
+ dataLabels
1593
+ };
1231
1594
  const normalizedPoints = {};
1232
1595
  for (const [key, pt] of Object.entries(pointsRecord)) {
1233
1596
  const numKey = Number(key);
1234
1597
  if (numKey >= 0 && Number.isSafeInteger(numKey)) normalizedPoints[numKey] = pt;
1235
1598
  }
1599
+ const seriesDataLabels = dLblsResult?.dataLabels;
1236
1600
  return {
1237
1601
  order,
1238
- ...dLblsResult?.dataLabelsStyle === void 0 ? {} : { dataLabelsStyle: dLblsResult.dataLabelsStyle },
1239
1602
  series: {
1240
- name: name.trim() === "" ? `Series ${fallbackIndex + 1}` : name,
1603
+ name,
1241
1604
  x,
1242
1605
  y,
1243
1606
  ...spStyle.color === void 0 ? {} : { color: spStyle.color },
1244
1607
  ...spStyle.line === void 0 ? {} : { line: spStyle.line },
1245
- ...dLblsResult?.dataLabels === void 0 ? {} : { dataLabels: dLblsResult.dataLabels },
1608
+ ...seriesDataLabels === void 0 ? {} : { dataLabels: seriesDataLabels },
1246
1609
  ...marker === void 0 ? {} : { marker },
1247
1610
  ...Object.keys(normalizedPoints).length === 0 ? {} : { points: normalizedPoints },
1248
1611
  ...trendlines === void 0 ? {} : { trendlines },
@@ -1250,14 +1613,14 @@ function readScatterSeries(serCursor, groupLine, groupMarkers, fallbackIndex, in
1250
1613
  }
1251
1614
  };
1252
1615
  }
1253
- function readAxisGridline(el) {
1616
+ function readAxisGridline(el, ctx) {
1254
1617
  if (el === void 0) return void 0;
1255
- const spPr = el.child(C_NS, "spPr");
1618
+ const spPr = readChartSpPr(el, ctx);
1256
1619
  const result = spPr === void 0 ? true : readLineFromSpPr(spPr).line ?? true;
1257
1620
  consumeSubtree(el);
1258
1621
  return result;
1259
1622
  }
1260
- function readAxisElement(axisCursor, kind, inheritedChartStyle) {
1623
+ function readAxisElement(axisCursor, kind, inheritedChartStyle, ctx) {
1261
1624
  const id = readIntVal(axisCursor.child(C_NS, "axId"));
1262
1625
  if (id === void 0) return void 0;
1263
1626
  let reversed;
@@ -1281,16 +1644,13 @@ function readAxisElement(axisCursor, kind, inheritedChartStyle) {
1281
1644
  const val = axPos.attrsObject(["val"])["val"];
1282
1645
  if (val !== void 0) position = chartAxisPositionFromNative[val];
1283
1646
  }
1284
- const gridlines = readAxisGridline(axisCursor.child(C_NS, "majorGridlines"));
1285
- const minorGridlines = readAxisGridline(axisCursor.child(C_NS, "minorGridlines"));
1647
+ const gridlines = readAxisGridline(axisCursor.child(C_NS, "majorGridlines"), ctx);
1648
+ const minorGridlines = readAxisGridline(axisCursor.child(C_NS, "minorGridlines"), ctx);
1286
1649
  const txPr = axisCursor.child(C_NS, "txPr");
1287
- const rawAxisStyle = txPr === void 0 ? void 0 : readChartTextProperties(txPr);
1288
- const style = diffChartTextStyle(rawAxisStyle, inheritedChartStyle);
1650
+ const rawAxisStyle = txPr === void 0 ? void 0 : readChartTextProperties(txPr, ctx);
1651
+ const style = diffNativeChartStyle(rawAxisStyle, inheritedChartStyle);
1289
1652
  const titleCursor = axisCursor.child(C_NS, "title");
1290
- const title = titleCursor === void 0 ? void 0 : readChartTitle(titleCursor, rawAxisStyle === void 0 && inheritedChartStyle === void 0 ? void 0 : {
1291
- ...inheritedChartStyle,
1292
- ...rawAxisStyle
1293
- });
1653
+ const title = titleCursor === void 0 ? void 0 : readChartTitle(titleCursor, cascadeChartStyle(inheritedChartStyle, rawAxisStyle), ctx);
1294
1654
  const numFmtCursor = axisCursor.child(C_NS, "numFmt");
1295
1655
  let numberFormat;
1296
1656
  if (numFmtCursor !== void 0) {
@@ -1306,7 +1666,7 @@ function readAxisElement(axisCursor, kind, inheritedChartStyle) {
1306
1666
  const tickLblParsed = TickLblPosSchema.safeParse(axisCursor.child("http://schemas.openxmlformats.org/drawingml/2006/chart", "tickLblPos")?.attrsObject(["val"]) ?? {});
1307
1667
  const tickLabelPosition = tickLblParsed.success ? tickLblParsed.data.val : void 0;
1308
1668
  let line;
1309
- const spPr = axisCursor.child(C_NS, "spPr");
1669
+ const spPr = readChartSpPr(axisCursor, ctx);
1310
1670
  if (spPr !== void 0) {
1311
1671
  const lineRes = readLineFromSpPr(spPr);
1312
1672
  if (lineRes.noLine) line = false;
@@ -1368,7 +1728,25 @@ function readAxisElement(axisCursor, kind, inheritedChartStyle) {
1368
1728
  ...rawCrossing === void 0 ? {} : { rawCrossing }
1369
1729
  };
1370
1730
  }
1371
- function readChartGroupElement(groupCursor, inheritedChartStyle) {
1731
+ function reportInvalidGroupPointLabelIndexes(labels, pointCount, location, diagnostics) {
1732
+ for (const label of labels?.children("http://schemas.openxmlformats.org/drawingml/2006/chart", "dLbl") ?? []) {
1733
+ const idx = label.child(C_NS, "idx");
1734
+ const value = readIntVal(idx);
1735
+ if (idx === void 0 || value !== void 0 && value >= 0 && value < pointCount) continue;
1736
+ diagnostics.push({
1737
+ code: "invalid-xml-value",
1738
+ category: "corrupt-input",
1739
+ disposition: "recovered",
1740
+ location: {
1741
+ ...location,
1742
+ xpath: `${idx.xpath}/@val`
1743
+ },
1744
+ attributeOrElement: "c:idx/@val",
1745
+ rawValue: idx.attr("val")
1746
+ });
1747
+ }
1748
+ }
1749
+ function readChartGroupElement(groupCursor, inheritedChartStyle, ctx) {
1372
1750
  const local = groupCursor.localName;
1373
1751
  const varyColors = groupCursor.child(C_NS, "varyColors");
1374
1752
  if (varyColors !== void 0) consumeSubtree(varyColors);
@@ -1394,19 +1772,21 @@ function readChartGroupElement(groupCursor, inheritedChartStyle) {
1394
1772
  line = "smooth";
1395
1773
  markers = true;
1396
1774
  }
1397
- const rawEntries = groupCursor.children(C_NS, "ser").map((ser, idx) => readScatterSeries(ser, line, markers, idx, inheritedChartStyle)).toSorted((a, b) => a.order - b.order);
1398
- const rawSeries = rawEntries.map((entry) => entry.series);
1399
- const seriesDataLabelsStyle = rawEntries.find((entry) => entry.dataLabelsStyle !== void 0)?.dataLabelsStyle;
1400
1775
  const dLblsCursor = groupCursor.child(C_NS, "dLbls");
1401
- const groupLabels = (dLblsCursor === void 0 ? void 0 : readDataLabelsElement(dLblsCursor, "scatter", true, inheritedChartStyle))?.dataLabels;
1776
+ const groupLabelsResult = dLblsCursor === void 0 ? void 0 : readDataLabelsElement(dLblsCursor, "scatter", true, inheritedChartStyle, ctx);
1777
+ const groupLabels = groupLabelsResult?.dataLabels;
1778
+ const seriesBaseStyle = cascadeChartStyle(inheritedChartStyle, groupLabelsResult?.style);
1779
+ const rawSeries = groupCursor.children(C_NS, "ser").map((ser, idx) => readScatterSeries(ser, line, markers, idx, seriesBaseStyle, groupLabelsResult, ctx)).toSorted((a, b) => a.order - b.order).map((entry) => entry.series);
1780
+ reportInvalidGroupPointLabelIndexes(dLblsCursor, rawSeries.reduce((max, series) => Math.max(max, series.x.length), 0), ctx.location, ctx.diagnostics);
1781
+ const axisIds = groupCursor.children(C_NS, "axId").map((c) => readIntVal(c));
1402
1782
  return {
1403
1783
  kind: "scatter",
1404
- axisIds: groupCursor.children(C_NS, "axId").map((c) => readIntVal(c)).filter((v) => v !== void 0),
1784
+ xpath: groupCursor.xpath,
1785
+ axisIds,
1405
1786
  series: rawSeries,
1406
1787
  markers,
1407
1788
  ...line === void 0 ? {} : { line },
1408
- ...groupLabels === void 0 ? {} : { dataLabels: groupLabels },
1409
- ...seriesDataLabelsStyle === void 0 ? {} : { seriesDataLabelsStyle }
1789
+ ...groupLabels === void 0 ? {} : { dataLabels: groupLabels }
1410
1790
  };
1411
1791
  }
1412
1792
  let kind;
@@ -1428,10 +1808,16 @@ function readChartGroupElement(groupCursor, inheritedChartStyle) {
1428
1808
  else if (parsedGrouping.data.val === "percentStacked") stacking = "percent";
1429
1809
  }
1430
1810
  }
1431
- const rawSeries = groupCursor.children(C_NS, "ser").map((ser, idx) => readCategorySeries(ser, kind, idx, stacking, inheritedChartStyle)).toSorted((a, b) => a.order - b.order);
1432
- const seriesDataLabelsStyle = rawSeries.find((entry) => entry.dataLabelsStyle !== void 0)?.dataLabelsStyle;
1811
+ const seriesSources = groupCursor.children(C_NS, "ser").map((ser) => ({
1812
+ ser,
1813
+ source: readSeriesCategoryData(ser)
1814
+ }));
1433
1815
  const dLblsCursor = groupCursor.child(C_NS, "dLbls");
1434
- const groupLabels = (dLblsCursor === void 0 ? void 0 : readDataLabelsElement(dLblsCursor, kind, true, inheritedChartStyle))?.dataLabels;
1816
+ const groupLabelsResult = dLblsCursor === void 0 ? void 0 : readDataLabelsElement(dLblsCursor, kind, true, inheritedChartStyle, ctx, void 0, seriesSources.every(({ source }) => source.categoryRange));
1817
+ const groupLabels = groupLabelsResult?.dataLabels;
1818
+ const seriesBaseStyle = cascadeChartStyle(inheritedChartStyle, groupLabelsResult?.style);
1819
+ const rawSeries = seriesSources.map(({ ser, source }, idx) => readCategorySeries(ser, kind, idx, source, stacking, seriesBaseStyle, groupLabelsResult, ctx)).toSorted((a, b) => a.order - b.order);
1820
+ reportInvalidGroupPointLabelIndexes(dLblsCursor, rawSeries.reduce((max, series) => Math.max(max, series.categories.length, series.values.length), 0), ctx.location, ctx.diagnostics);
1435
1821
  let gapWidth;
1436
1822
  let overlap;
1437
1823
  if (kind === "column" || kind === "bar") {
@@ -1456,13 +1842,13 @@ function readChartGroupElement(groupCursor, inheritedChartStyle) {
1456
1842
  if (hs !== void 0 && hs >= 10 && hs <= 90) holeSize = hs;
1457
1843
  }
1458
1844
  }
1459
- const axisIds = groupCursor.children(C_NS, "axId").map((c) => readIntVal(c)).filter((v) => v !== void 0);
1845
+ const axisIds = groupCursor.children(C_NS, "axId").map((c) => readIntVal(c));
1460
1846
  return {
1461
1847
  kind,
1848
+ xpath: groupCursor.xpath,
1462
1849
  axisIds,
1463
1850
  series: rawSeries,
1464
1851
  ...groupLabels === void 0 ? {} : { dataLabels: groupLabels },
1465
- ...seriesDataLabelsStyle === void 0 ? {} : { seriesDataLabelsStyle },
1466
1852
  ...stacking === void 0 ? {} : { stacking },
1467
1853
  ...gapWidth === void 0 ? {} : { gapWidth },
1468
1854
  ...overlap === void 0 ? {} : { overlap },
@@ -1511,14 +1897,6 @@ function importedKnownValueEndpoint(crossing, partner) {
1511
1897
  if (partner.min === 0) return "min";
1512
1898
  if (partner.max === 0) return "max";
1513
1899
  }
1514
- function withLiftedDataLabelsStyle(groupLabels, seriesStyle) {
1515
- if (seriesStyle === void 0) return groupLabels;
1516
- if (groupLabels === false || groupLabels === void 0) return { style: seriesStyle };
1517
- return groupLabels.style === void 0 ? {
1518
- ...groupLabels,
1519
- style: seriesStyle
1520
- } : groupLabels;
1521
- }
1522
1900
  function trimSeriesPointsToLength(points, pointCount, chartLocation, diagnostics) {
1523
1901
  if (points === void 0) return void 0;
1524
1902
  const trimmed = {};
@@ -1539,6 +1917,44 @@ function trimSeriesPointsToLength(points, pointCount, chartLocation, diagnostics
1539
1917
  }
1540
1918
  return Object.keys(trimmed).length === 0 ? void 0 : trimmed;
1541
1919
  }
1920
+ /** Resolves leader-line visibility once the final point indexes are known. */
1921
+ function normalizeCircularLeaderLines(kind, series, groupLabels) {
1922
+ if ((!groupLabels || groupLabels.leaderLines === void 0) && !series.some(({ dataLabels }) => dataLabels && dataLabels.leaderLines !== void 0)) return {
1923
+ series,
1924
+ dataLabels: groupLabels
1925
+ };
1926
+ const withVisibility = series.map((item) => {
1927
+ const labels = mergeDataLabels(groupLabels, item.dataLabels);
1928
+ return {
1929
+ item,
1930
+ visible: hasVisibleSeriesDataLabels(kind, labels, item.points)
1931
+ };
1932
+ });
1933
+ const dataLabels = withVisibility.some(({ visible }) => visible) ? groupLabels : omitLeaderLines(groupLabels);
1934
+ const enabledGroupLines = dataLabels && dataLabels.leaderLines;
1935
+ return {
1936
+ dataLabels,
1937
+ series: withVisibility.map(({ item, visible }) => {
1938
+ const labels = item.dataLabels;
1939
+ if (visible || labels === false) return item;
1940
+ const normalized = enabledGroupLines ? {
1941
+ ...labels,
1942
+ leaderLines: false
1943
+ } : omitLeaderLines(labels);
1944
+ if (normalized === labels) return item;
1945
+ const { dataLabels: _labels, ...rest } = item;
1946
+ return normalized === void 0 ? rest : {
1947
+ ...rest,
1948
+ dataLabels: normalized
1949
+ };
1950
+ })
1951
+ };
1952
+ }
1953
+ function omitLeaderLines(labels) {
1954
+ if (!labels || labels.leaderLines === void 0) return labels;
1955
+ const { leaderLines: _leaderLines, ...remaining } = labels;
1956
+ return Object.keys(remaining).length === 0 ? void 0 : remaining;
1957
+ }
1542
1958
  function alignCustomErrorBars(errorBars, pointCount) {
1543
1959
  if (errorBars === void 0 || errorBars.type !== "custom") return errorBars;
1544
1960
  const plus = errorBars.plus === void 0 ? void 0 : alignErrorBarValues(errorBars.plus, pointCount);
@@ -1562,69 +1978,58 @@ function filterValidTrendlines(trendlines, pointCount) {
1562
1978
  const kept = trendlines.filter((item) => item.type !== "movingAverage" || item.period < pointCount);
1563
1979
  return kept.length === 0 ? void 0 : kept;
1564
1980
  }
1565
- function buildChartAxesAndGroups(groupDrafts, importedAxes, chartLocation, diagnostics) {
1981
+ function buildChartAxesAndGroups(groupDrafts, importedAxes, unsupportedAxisIds, chartLocation, diagnostics) {
1566
1982
  const axisById = new Map(importedAxes.map((ax) => [ax.id, ax]));
1567
1983
  const axisDirectionById = /* @__PURE__ */ new Map();
1568
1984
  const referencedAxisIds = /* @__PURE__ */ new Set();
1569
1985
  const validGroupDrafts = [];
1570
1986
  for (const group of groupDrafts) {
1571
- if (group.series.length === 0) {
1987
+ const needsAxes = group.kind !== "pie" && group.kind !== "doughnut";
1988
+ const [firstId, secondId] = group.axisIds;
1989
+ const firstAxis = firstId === void 0 ? void 0 : axisById.get(firstId);
1990
+ const secondAxis = secondId === void 0 ? void 0 : axisById.get(secondId);
1991
+ const firstUnsupported = firstAxis === void 0 && firstId !== void 0 && unsupportedAxisIds.has(firstId);
1992
+ const secondUnsupported = secondAxis === void 0 && secondId !== void 0 && unsupportedAxisIds.has(secondId);
1993
+ const firstKind = group.kind === "scatter" ? "value" : "category";
1994
+ const firstDir = group.kind === "bar" ? "vertical" : "horizontal";
1995
+ const secondDir = group.kind === "bar" ? "horizontal" : "vertical";
1996
+ const brokenAxes = group.axisIds.length !== 2 || firstId === secondId || (firstAxis === void 0 ? !firstUnsupported : firstAxis.kind !== firstKind) || (secondAxis === void 0 ? !secondUnsupported : secondAxis.kind !== "value");
1997
+ if (group.series.length === 0 || needsAxes && brokenAxes) {
1572
1998
  diagnostics.push({
1573
1999
  code: "corrupt-part",
1574
2000
  category: "corrupt-input",
1575
2001
  disposition: "omitted",
1576
- location: chartLocation
2002
+ location: {
2003
+ ...chartLocation,
2004
+ xpath: group.xpath
2005
+ }
1577
2006
  });
1578
2007
  continue;
1579
2008
  }
1580
- if (group.kind === "pie" || group.kind === "doughnut") {
1581
- validGroupDrafts.push(group);
1582
- continue;
1583
- }
1584
- if (group.kind === "scatter") {
1585
- const [xId, yId] = group.axisIds;
1586
- const xAx = xId === void 0 ? void 0 : axisById.get(xId);
1587
- const yAx = yId === void 0 ? void 0 : axisById.get(yId);
1588
- const xDir = xId === void 0 ? void 0 : axisDirectionById.get(xId);
1589
- const yDir = yId === void 0 ? void 0 : axisDirectionById.get(yId);
1590
- const nextAxisCount = referencedAxisIds.size + (xId !== void 0 && !referencedAxisIds.has(xId) ? 1 : 0) + (yId !== void 0 && yId !== xId && !referencedAxisIds.has(yId) ? 1 : 0);
1591
- if (xAx === void 0 || yAx === void 0 || xAx.id === yAx.id || xAx.kind !== "value" || yAx.kind !== "value" || xDir !== void 0 && xDir !== "horizontal" || yDir !== void 0 && yDir !== "vertical" || nextAxisCount > 4) {
1592
- diagnostics.push({
1593
- code: "corrupt-part",
1594
- category: "corrupt-input",
1595
- disposition: "omitted",
1596
- location: chartLocation
1597
- });
1598
- continue;
1599
- }
1600
- axisDirectionById.set(xAx.id, "horizontal");
1601
- axisDirectionById.set(yAx.id, "vertical");
1602
- referencedAxisIds.add(xAx.id);
1603
- referencedAxisIds.add(yAx.id);
2009
+ if (!needsAxes) {
1604
2010
  validGroupDrafts.push(group);
1605
2011
  continue;
1606
2012
  }
1607
- const [catId, valId] = group.axisIds;
1608
- const catAx = catId === void 0 ? void 0 : axisById.get(catId);
1609
- const valAx = valId === void 0 ? void 0 : axisById.get(valId);
1610
- const expectedCatDir = group.kind === "bar" ? "vertical" : "horizontal";
1611
- const expectedValDir = group.kind === "bar" ? "horizontal" : "vertical";
1612
- const catDir = catId === void 0 ? void 0 : axisDirectionById.get(catId);
1613
- const valDir = valId === void 0 ? void 0 : axisDirectionById.get(valId);
1614
- const nextAxisCount = referencedAxisIds.size + (catId !== void 0 && !referencedAxisIds.has(catId) ? 1 : 0) + (valId !== void 0 && valId !== catId && !referencedAxisIds.has(valId) ? 1 : 0);
1615
- if (catAx === void 0 || valAx === void 0 || catAx.id === valAx.id || catAx.kind !== "category" || valAx.kind !== "value" || catDir !== void 0 && catDir !== expectedCatDir || valDir !== void 0 && valDir !== expectedValDir || nextAxisCount > 4) {
2013
+ if (firstAxis === void 0 || secondAxis === void 0) continue;
2014
+ const firstExistingDir = axisDirectionById.get(firstAxis.id);
2015
+ const secondExistingDir = axisDirectionById.get(secondAxis.id);
2016
+ const nextAxisCount = referencedAxisIds.size + Number(!referencedAxisIds.has(firstAxis.id)) + Number(!referencedAxisIds.has(secondAxis.id));
2017
+ if (firstExistingDir !== void 0 && firstExistingDir !== firstDir || secondExistingDir !== void 0 && secondExistingDir !== secondDir || nextAxisCount > 4) {
1616
2018
  diagnostics.push({
1617
2019
  code: "corrupt-part",
1618
2020
  category: "corrupt-input",
1619
2021
  disposition: "omitted",
1620
- location: chartLocation
2022
+ location: {
2023
+ ...chartLocation,
2024
+ xpath: group.xpath
2025
+ }
1621
2026
  });
1622
2027
  continue;
1623
2028
  }
1624
- axisDirectionById.set(catAx.id, expectedCatDir);
1625
- axisDirectionById.set(valAx.id, expectedValDir);
1626
- referencedAxisIds.add(catAx.id);
1627
- referencedAxisIds.add(valAx.id);
2029
+ axisDirectionById.set(firstAxis.id, firstDir);
2030
+ axisDirectionById.set(secondAxis.id, secondDir);
2031
+ referencedAxisIds.add(firstAxis.id);
2032
+ referencedAxisIds.add(secondAxis.id);
1628
2033
  validGroupDrafts.push(group);
1629
2034
  }
1630
2035
  if (validGroupDrafts.length === 0) return { groups: [] };
@@ -1745,7 +2150,6 @@ function buildChartAxesAndGroups(groupDrafts, importedAxes, chartLocation, diagn
1745
2150
  if (nonEmpty !== void 0) sharedDomainByCatAxis.set(catId, nonEmpty.categories);
1746
2151
  }
1747
2152
  const groups = validGroupDrafts.map((group) => {
1748
- const liftedDataLabels = withLiftedDataLabelsStyle(group.dataLabels, group.seriesDataLabelsStyle);
1749
2153
  if (group.kind === "scatter") {
1750
2154
  const [xId, yId] = group.axisIds;
1751
2155
  const xName = xId === void 0 ? void 0 : axisNameById.get(xId);
@@ -1784,7 +2188,7 @@ function buildChartAxesAndGroups(groupDrafts, importedAxes, chartLocation, diagn
1784
2188
  } } : {},
1785
2189
  ...group.line === void 0 ? {} : { line: group.line },
1786
2190
  markers: scatterMarkers,
1787
- ...liftedDataLabels === void 0 ? {} : { dataLabels: liftedDataLabels }
2191
+ ...group.dataLabels === void 0 ? {} : { dataLabels: group.dataLabels }
1788
2192
  };
1789
2193
  }
1790
2194
  if (group.kind === "doughnut") {
@@ -1804,11 +2208,12 @@ function buildChartAxesAndGroups(groupDrafts, importedAxes, chartLocation, diagn
1804
2208
  ...trimmedPoints === void 0 ? {} : { points: trimmedPoints }
1805
2209
  };
1806
2210
  });
1807
- const indDoughnutLabels = narrowGroupDataLabels(liftedDataLabels, []);
2211
+ const normalized = normalizeCircularLeaderLines(group.kind, series, group.dataLabels);
2212
+ const indDoughnutLabels = narrowGroupDataLabels(normalized.dataLabels, []);
1808
2213
  return {
1809
2214
  kind: "doughnut",
1810
2215
  data: { kind: "independent-categories" },
1811
- series,
2216
+ series: normalized.series,
1812
2217
  ...group.firstSliceAngle === void 0 ? {} : { firstSliceAngle: group.firstSliceAngle },
1813
2218
  ...group.holeSize === void 0 ? {} : { holeSize: group.holeSize },
1814
2219
  ...indDoughnutLabels === void 0 ? {} : { dataLabels: indDoughnutLabels }
@@ -1838,7 +2243,8 @@ function buildChartAxesAndGroups(groupDrafts, importedAxes, chartLocation, diagn
1838
2243
  };
1839
2244
  });
1840
2245
  if (group.kind === "pie") {
1841
- const pieLabels = narrowGroupDataLabels(liftedDataLabels, [
2246
+ const normalized = normalizeCircularLeaderLines(group.kind, normalizedSeries, group.dataLabels);
2247
+ const pieLabels = narrowGroupDataLabels(normalized.dataLabels, [
1842
2248
  "center",
1843
2249
  "insideEnd",
1844
2250
  "outsideEnd",
@@ -1850,20 +2256,21 @@ function buildChartAxesAndGroups(groupDrafts, importedAxes, chartLocation, diagn
1850
2256
  kind: "shared-categories",
1851
2257
  categories: domain
1852
2258
  },
1853
- series: normalizedSeries,
2259
+ series: normalized.series,
1854
2260
  ...group.firstSliceAngle === void 0 ? {} : { firstSliceAngle: group.firstSliceAngle },
1855
2261
  ...pieLabels === void 0 ? {} : { dataLabels: pieLabels }
1856
2262
  };
1857
2263
  }
1858
2264
  if (group.kind === "doughnut") {
1859
- const doughnutLabels = narrowGroupDataLabels(liftedDataLabels, []);
2265
+ const normalized = normalizeCircularLeaderLines(group.kind, normalizedSeries, group.dataLabels);
2266
+ const doughnutLabels = narrowGroupDataLabels(normalized.dataLabels, []);
1860
2267
  return {
1861
2268
  kind: "doughnut",
1862
2269
  data: {
1863
2270
  kind: "shared-categories",
1864
2271
  categories: domain
1865
2272
  },
1866
- series: normalizedSeries,
2273
+ series: normalized.series,
1867
2274
  ...group.firstSliceAngle === void 0 ? {} : { firstSliceAngle: group.firstSliceAngle },
1868
2275
  ...group.holeSize === void 0 ? {} : { holeSize: group.holeSize },
1869
2276
  ...doughnutLabels === void 0 ? {} : { dataLabels: doughnutLabels }
@@ -1889,7 +2296,7 @@ function buildChartAxesAndGroups(groupDrafts, importedAxes, chartLocation, diagn
1889
2296
  ...group.overlap === void 0 ? {} : { overlap: group.overlap }
1890
2297
  };
1891
2298
  if (group.stacking !== void 0) {
1892
- const stackedLabels = narrowGroupDataLabels(liftedDataLabels, [
2299
+ const stackedLabels = narrowGroupDataLabels(group.dataLabels, [
1893
2300
  "center",
1894
2301
  "insideEnd",
1895
2302
  "insideBase"
@@ -1900,7 +2307,7 @@ function buildChartAxesAndGroups(groupDrafts, importedAxes, chartLocation, diagn
1900
2307
  ...stackedLabels === void 0 ? {} : { dataLabels: stackedLabels }
1901
2308
  };
1902
2309
  }
1903
- const unstackedLabels = narrowGroupDataLabels(liftedDataLabels, [
2310
+ const unstackedLabels = narrowGroupDataLabels(group.dataLabels, [
1904
2311
  "center",
1905
2312
  "insideEnd",
1906
2313
  "insideBase",
@@ -1912,7 +2319,7 @@ function buildChartAxesAndGroups(groupDrafts, importedAxes, chartLocation, diagn
1912
2319
  };
1913
2320
  }
1914
2321
  if (group.kind === "line") {
1915
- const lineLabels = narrowGroupDataLabels(liftedDataLabels, [
2322
+ const lineLabels = narrowGroupDataLabels(group.dataLabels, [
1916
2323
  "left",
1917
2324
  "right",
1918
2325
  "bottom",
@@ -1931,7 +2338,7 @@ function buildChartAxesAndGroups(groupDrafts, importedAxes, chartLocation, diagn
1931
2338
  ...lineLabels === void 0 ? {} : { dataLabels: lineLabels }
1932
2339
  };
1933
2340
  }
1934
- const areaLabels = narrowGroupDataLabels(liftedDataLabels, []);
2341
+ const areaLabels = narrowGroupDataLabels(group.dataLabels, []);
1935
2342
  return {
1936
2343
  kind: "area",
1937
2344
  data: {
@@ -1949,6 +2356,18 @@ function buildChartAxesAndGroups(groupDrafts, importedAxes, chartLocation, diagn
1949
2356
  groups
1950
2357
  };
1951
2358
  }
2359
+ const unsupportedChartGroups = /* @__PURE__ */ new Set([
2360
+ "area3DChart",
2361
+ "bar3DChart",
2362
+ "bubbleChart",
2363
+ "line3DChart",
2364
+ "ofPieChart",
2365
+ "pie3DChart",
2366
+ "radarChart",
2367
+ "stockChart",
2368
+ "surfaceChart",
2369
+ "surface3DChart"
2370
+ ]);
1952
2371
  function consumeChartAlternateContent(ac) {
1953
2372
  const choice = ac.child(MC_NS, "Choice");
1954
2373
  const fallback = ac.child(MC_NS, "Fallback");
@@ -2034,56 +2453,13 @@ function readChartGraphicFrame(context) {
2034
2453
  const claim = nativeRef === void 0 ? void 0 : resolvePlaceholderImportClaim({
2035
2454
  context,
2036
2455
  nativeRef,
2037
- compatibleRoles: /* @__PURE__ */ new Set(["chart", "obj"])
2456
+ objectKind: "chart"
2038
2457
  });
2039
2458
  const matchedKey = claim?.bound === true ? claim.key : void 0;
2040
2459
  const unboundPlaceholder = claim !== void 0 && !claim.bound;
2041
- const xfrm = cursor.child(P_NS, "xfrm");
2042
- const off = xfrm?.child(A_NS, "off");
2043
- const ext = xfrm?.child(A_NS, "ext");
2044
- if (xfrm === void 0 || off === void 0 || ext === void 0) {
2045
- diagnostics.push({
2046
- code: "corrupt-part",
2047
- category: "corrupt-input",
2048
- disposition: "omitted",
2049
- location: {
2050
- part,
2051
- xpath: cursor.xpath,
2052
- slideIndex,
2053
- ...objectId === void 0 ? {} : { objectId },
2054
- ...objectName === void 0 ? {} : { objectName }
2055
- }
2056
- });
2057
- return { diagnostics };
2058
- }
2059
- const rawXfrm = xfrm.attrsObject([
2060
- "rot",
2061
- "flipH",
2062
- "flipV"
2063
- ]);
2064
- transformAttributesFragmentSchema.safeParse(rawXfrm);
2065
- const parsedOff = offsetEmuFragmentSchema.safeParse(off.attrsObject(["x", "y"]));
2066
- const parsedExt = extentEmuFragmentSchema.safeParse(ext.attrsObject(["cx", "cy"]));
2067
- if (!parsedOff.success || !parsedExt.success) {
2068
- diagnostics.push({
2069
- code: "invalid-xml-value",
2070
- category: "corrupt-input",
2071
- disposition: "omitted",
2072
- location: {
2073
- part,
2074
- xpath: xfrm.xpath,
2075
- slideIndex,
2076
- ...objectId === void 0 ? {} : { objectId },
2077
- ...objectName === void 0 ? {} : { objectName }
2078
- },
2079
- attributeOrElement: "a:xfrm"
2080
- });
2081
- return { diagnostics };
2082
- }
2083
- const boxX = emuToPx(parsedOff.data.x);
2084
- const boxY = emuToPx(parsedOff.data.y);
2085
- const boxWidth = emuToPx(parsedExt.data.cx);
2086
- const boxHeight = emuToPx(parsedExt.data.cy);
2460
+ const frameBox = readPlaceholderFrameBox(cursor.child(P_NS, "xfrm"), claim, chartLocation, diagnostics);
2461
+ if (frameBox === void 0) return { diagnostics };
2462
+ const { x: boxX, y: boxY, width: boxWidth, height: boxHeight } = context.mapBox?.(frameBox) ?? frameBox;
2087
2463
  const graphicData = cursor.child(A_NS, "graphic")?.child(A_NS, "graphicData");
2088
2464
  if (graphicData !== void 0) GraphicDataAttrSchema.safeParse(graphicData.attrsObject(["uri"]));
2089
2465
  const cChart = graphicData?.child(C_NS, "chart");
@@ -2164,20 +2540,52 @@ function readChartGraphicFrame(context) {
2164
2540
  "date1904",
2165
2541
  "lang",
2166
2542
  "roundedCorners",
2167
- "style",
2168
- "clrMapOvr"
2543
+ "style"
2169
2544
  ]) {
2170
2545
  const el = chartSpace.child(C_NS, tag);
2171
2546
  if (el !== void 0) consumeSubtree(el);
2172
2547
  }
2173
2548
  for (const ac of chartSpace.children(MC_NS, "AlternateContent")) consumeChartAlternateContent(ac);
2174
- const chartTxPr = chartSpace.child(C_NS, "txPr");
2175
- const rawChartStyle = chartTxPr === void 0 ? void 0 : readChartTextProperties(chartTxPr);
2176
- const chartStyle = normalizeRootChartStyle(rawChartStyle);
2177
- for (const tag of ["spPr", "externalData"]) {
2178
- const el = chartSpace.child(C_NS, tag);
2179
- if (el !== void 0) consumeSubtree(el);
2549
+ const chartCtx = {
2550
+ reportedLabelFallbacks: /* @__PURE__ */ new Set(),
2551
+ location: {
2552
+ ...chartLocation,
2553
+ part: chartPartPath
2554
+ },
2555
+ diagnostics
2556
+ };
2557
+ const chartRels = pkg.readRelationships(chartPartPath);
2558
+ diagnostics.push(...chartRels.diagnostics);
2559
+ const themeOverride = readPartThemeOverride(pkg, chartRels.entries, chartCtx.location, diagnostics);
2560
+ const colorMapElement = chartSpace.child(C_NS, "clrMapOvr");
2561
+ let colorMapOverride;
2562
+ if (colorMapElement !== void 0) {
2563
+ const slotNames = Array.from(colorMapElement.element.attributes).filter((attribute) => !attribute.namespaceURI).map((attribute) => attribute.localName ?? attribute.name);
2564
+ const attrs = colorMapElement.attrsObject(slotNames);
2565
+ const parsed = colorMapSchema.safeParse(attrs);
2566
+ if (parsed.success) colorMapOverride = parsed.data;
2567
+ else {
2568
+ const badSlots = parsed.error.issues.flatMap((issue) => issue.code === "unrecognized_keys" ? issue.keys : [String(issue.path[0])]);
2569
+ for (const slot of badSlots) diagnostics.push({
2570
+ code: "invalid-xml-value",
2571
+ category: "corrupt-input",
2572
+ disposition: "recovered",
2573
+ location: {
2574
+ ...chartCtx.location,
2575
+ xpath: `${colorMapElement.xpath}/@${slot}`
2576
+ },
2577
+ attributeOrElement: `@${slot}`,
2578
+ rawValue: attrs[slot] ?? ""
2579
+ });
2580
+ }
2180
2581
  }
2582
+ const chartTxPr = chartSpace.child(C_NS, "txPr");
2583
+ const rawChartStyle = chartTxPr === void 0 ? void 0 : readChartTextProperties(chartTxPr, chartCtx);
2584
+ const chartStyle = normalizeRootChartStyle(projectChartStyle(rawChartStyle ?? {}));
2585
+ const chartSpPr = readChartSpPr(chartSpace, chartCtx);
2586
+ if (chartSpPr !== void 0) consumeSubtree(chartSpPr);
2587
+ const externalData = chartSpace.child(C_NS, "externalData");
2588
+ if (externalData !== void 0) consumeSubtree(externalData);
2181
2589
  const chartEl = chartSpace.child(C_NS, "chart");
2182
2590
  if (chartEl === void 0) {
2183
2591
  diagnostics.push({
@@ -2195,12 +2603,13 @@ function readChartGraphicFrame(context) {
2195
2603
  return { diagnostics };
2196
2604
  }
2197
2605
  const titleEl = chartEl.child(C_NS, "title");
2198
- const title = titleEl === void 0 ? void 0 : readChartTitle(titleEl, rawChartStyle);
2606
+ const title = titleEl === void 0 ? void 0 : readChartTitle(titleEl, rawChartStyle, chartCtx);
2199
2607
  const autoTitleDeleted = chartEl.child(C_NS, "autoTitleDeleted");
2200
2608
  if (autoTitleDeleted !== void 0) consumeSubtree(autoTitleDeleted);
2201
2609
  const pivotFmts = chartEl.child(C_NS, "pivotFmts");
2202
2610
  if (pivotFmts !== void 0) consumeSubtree(pivotFmts);
2203
2611
  let legend;
2612
+ let legendStyle;
2204
2613
  const legendEl = chartEl.child(C_NS, "legend");
2205
2614
  if (legendEl !== void 0) {
2206
2615
  const posVal = legendEl.child(C_NS, "legendPos")?.attrsObject(["val"])["val"];
@@ -2209,12 +2618,12 @@ function readChartGraphicFrame(context) {
2209
2618
  const legendLayoutEl = directElementChild(legendEl.element, C_NS, "layout");
2210
2619
  if (legendLayoutEl !== void 0 && isEmptyXmlElement(legendLayoutEl)) legendEl.child(C_NS, "layout");
2211
2620
  const legendTxPr = legendEl.child(C_NS, "txPr");
2212
- if (legendTxPr !== void 0) readChartTextProperties(legendTxPr);
2621
+ if (legendTxPr !== void 0) legendStyle = diffNativeChartStyle(readChartTextProperties(legendTxPr, chartCtx), rawChartStyle);
2213
2622
  for (const legendEntry of legendEl.children(C_NS, "legendEntry")) {
2214
2623
  legendEntry.child(C_NS, "idx")?.attr("val");
2215
2624
  legendEntry.child(C_NS, "delete")?.attr("val");
2216
2625
  }
2217
- const legendSpPr = legendEl.child(C_NS, "spPr");
2626
+ const legendSpPr = readChartSpPr(legendEl, chartCtx);
2218
2627
  if (legendSpPr !== void 0) consumeBenignChartSpPr(legendSpPr);
2219
2628
  }
2220
2629
  const plotVisOnly = chartEl.child(C_NS, "plotVisOnly");
@@ -2273,27 +2682,37 @@ function readChartGraphicFrame(context) {
2273
2682
  }
2274
2683
  consumeSubtree(layoutEl);
2275
2684
  }
2276
- const plotSpPr = plotAreaEl.child(C_NS, "spPr");
2685
+ const plotSpPr = readChartSpPr(plotAreaEl, chartCtx);
2277
2686
  if (plotSpPr !== void 0) consumeBenignChartSpPr(plotSpPr);
2278
2687
  const groupDrafts = [];
2279
2688
  const importedAxes = [];
2689
+ const unsupportedAxisIds = /* @__PURE__ */ new Set();
2690
+ let omittedUnsupportedGroup = false;
2280
2691
  for (const child of plotAreaEl.remainingElementChildren()) {
2281
2692
  if (child.namespaceUri !== "http://schemas.openxmlformats.org/drawingml/2006/chart") continue;
2282
2693
  if (child.localName === "catAx") {
2283
- const ax = readAxisElement(child, "category", rawChartStyle);
2694
+ const ax = readAxisElement(child, "category", rawChartStyle, chartCtx);
2284
2695
  if (ax !== void 0) importedAxes.push(ax);
2285
2696
  continue;
2286
2697
  }
2287
2698
  if (child.localName === "valAx") {
2288
- const ax = readAxisElement(child, "value", rawChartStyle);
2699
+ const ax = readAxisElement(child, "value", rawChartStyle, chartCtx);
2289
2700
  if (ax !== void 0) importedAxes.push(ax);
2290
2701
  continue;
2291
2702
  }
2292
- const group = readChartGroupElement(child, rawChartStyle);
2703
+ const group = readChartGroupElement(child, rawChartStyle, chartCtx);
2293
2704
  if (group !== void 0) {
2294
2705
  groupDrafts.push(group);
2295
2706
  continue;
2296
2707
  }
2708
+ if (child.localName === "dateAx" || child.localName === "serAx") {
2709
+ const id = readIntVal(child.child(C_NS, "axId"));
2710
+ if (id !== void 0) unsupportedAxisIds.add(id);
2711
+ consumeSubtree(child);
2712
+ } else if (unsupportedChartGroups.has(child.localName)) {
2713
+ omittedUnsupportedGroup = true;
2714
+ consumeSubtree(child);
2715
+ }
2297
2716
  diagnostics.push({
2298
2717
  code: "unsupported-mechanism",
2299
2718
  category: "unsupported",
@@ -2324,6 +2743,7 @@ function readChartGraphicFrame(context) {
2324
2743
  localName: unconsumed.localName
2325
2744
  });
2326
2745
  if (groupDrafts.length === 0) {
2746
+ if (omittedUnsupportedGroup) return { diagnostics };
2327
2747
  diagnostics.push({
2328
2748
  code: "corrupt-part",
2329
2749
  category: "corrupt-input",
@@ -2338,7 +2758,7 @@ function readChartGraphicFrame(context) {
2338
2758
  });
2339
2759
  return { diagnostics };
2340
2760
  }
2341
- const { axes, groups } = buildChartAxesAndGroups(groupDrafts, importedAxes, {
2761
+ const { axes, groups } = buildChartAxesAndGroups(groupDrafts, importedAxes, unsupportedAxisIds, {
2342
2762
  part: chartPartPath,
2343
2763
  xpath: plotAreaEl.xpath,
2344
2764
  slideIndex,
@@ -2355,9 +2775,10 @@ function readChartGraphicFrame(context) {
2355
2775
  })) displayBlanksAs = void 0;
2356
2776
  }
2357
2777
  const props = {
2778
+ ...themeOverride === void 0 ? {} : { themeOverride },
2779
+ ...colorMapOverride === void 0 ? {} : { colorMapOverride },
2358
2780
  ...objectName === void 0 ? {} : { name: objectName },
2359
2781
  ...matchedKey === void 0 ? {} : { placeholder: matchedKey },
2360
- ...matchedKey === void 0 || nativeRef === void 0 ? {} : { nativePlaceholder: nativeRef },
2361
2782
  ...clickResult?.link === void 0 ? {} : { link: clickResult.link },
2362
2783
  ...axes === void 0 ? {} : { axes },
2363
2784
  groups,
@@ -2372,6 +2793,7 @@ function readChartGraphicFrame(context) {
2372
2793
  },
2373
2794
  ...displayBlanksAs === void 0 ? {} : { displayBlanksAs },
2374
2795
  ...legend === void 0 ? {} : { legend },
2796
+ ...legendStyle === void 0 ? {} : { legendStyle },
2375
2797
  ...plotArea === void 0 ? {} : { plotArea }
2376
2798
  };
2377
2799
  if (unboundPlaceholder) emitPlaceholderUnbindDiagnostic({
@@ -2391,7 +2813,8 @@ const chartImportHandler = {
2391
2813
  target: "shape-tree",
2392
2814
  localName: "graphicFrame",
2393
2815
  matches: (cursor) => isChartGraphicFrame(cursor) && !isPlaceholderGraphicFrameElement(cursor),
2394
- read: readChartGraphicFrame
2816
+ read: readChartGraphicFrame,
2817
+ groupMember: true
2395
2818
  };
2396
2819
  /** Shape-tree import handler wired into `chartPlaceholderMechanism` for placeholder-bound charts. */
2397
2820
  const chartPlaceholderImportHandler = {