ooxml-core 1.32.1 → 1.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (595) hide show
  1. package/dist/PptxHandler-5UDSMCBG.cjs +14 -0
  2. package/dist/PptxHandler-TTRTAQAR.mjs +5 -0
  3. package/dist/PptxHandler-XCYX5DVX.mjs +7 -0
  4. package/dist/{PresentationBuilder-5NFBUP7Y.cjs → PresentationBuilder-HA56ZY23.cjs} +6 -5
  5. package/dist/{PresentationBuilder-S6HXHKEJ.mjs → PresentationBuilder-IVLUEB4K.mjs} +4 -4
  6. package/dist/{PresentationBuilder-3CH5TR4W.mjs → PresentationBuilder-JBTNOIL7.mjs} +3 -2
  7. package/dist/automation/index.cjs +47133 -42384
  8. package/dist/automation/index.mjs +47133 -42384
  9. package/dist/chart/funnel-geometry.d.ts +1 -1
  10. package/dist/chart/funnel-geometry.d.ts.map +1 -1
  11. package/dist/chart/index.cjs +5743 -3820
  12. package/dist/chart/index.mjs +5736 -3821
  13. package/dist/chart/region-map/alias.d.ts +12 -0
  14. package/dist/chart/region-map/alias.d.ts.map +1 -0
  15. package/dist/chart/region-map/cache.d.ts +20 -0
  16. package/dist/chart/region-map/cache.d.ts.map +1 -0
  17. package/dist/chart/region-map/colors.d.ts +4 -0
  18. package/dist/chart/region-map/colors.d.ts.map +1 -0
  19. package/dist/chart/region-map/data.d.ts +45 -0
  20. package/dist/chart/region-map/data.d.ts.map +1 -0
  21. package/dist/chart/region-map/geographic-projection.d.ts +4 -0
  22. package/dist/chart/region-map/geographic-projection.d.ts.map +1 -0
  23. package/dist/chart/region-map/geometry.d.ts +10 -0
  24. package/dist/chart/region-map/geometry.d.ts.map +1 -0
  25. package/dist/chart/region-map/index.cjs +892 -0
  26. package/dist/chart/region-map/index.d.ts +12 -0
  27. package/dist/chart/region-map/index.d.ts.map +1 -0
  28. package/dist/chart/region-map/index.mjs +870 -0
  29. package/dist/chart/region-map/projection.d.ts +19 -0
  30. package/dist/chart/region-map/projection.d.ts.map +1 -0
  31. package/dist/chart/region-map/types.d.ts +39 -0
  32. package/dist/chart/region-map/types.d.ts.map +1 -0
  33. package/dist/chart/region-map/value-color-positions.d.ts +4 -0
  34. package/dist/chart/region-map/value-color-positions.d.ts.map +1 -0
  35. package/dist/chart/region-map/value-colors.d.ts +4 -0
  36. package/dist/chart/region-map/value-colors.d.ts.map +1 -0
  37. package/dist/chart/region-map/world-regions.d.ts +22 -0
  38. package/dist/chart/region-map/world-regions.d.ts.map +1 -0
  39. package/dist/chart/render/chart-3d-camera.d.ts +26 -0
  40. package/dist/chart/render/chart-3d-camera.d.ts.map +1 -0
  41. package/dist/chart/render/chart-3d-layout.d.ts +27 -0
  42. package/dist/chart/render/chart-3d-layout.d.ts.map +1 -0
  43. package/dist/chart/render/chart-3d-marks.d.ts +10 -0
  44. package/dist/chart/render/chart-3d-marks.d.ts.map +1 -0
  45. package/dist/chart/render/chart-3d-mesh.d.ts +32 -0
  46. package/dist/chart/render/chart-3d-mesh.d.ts.map +1 -0
  47. package/dist/chart/render/chart-3d-pie.d.ts +16 -0
  48. package/dist/chart/render/chart-3d-pie.d.ts.map +1 -0
  49. package/dist/chart/render/chart-3d-projection.d.ts +37 -0
  50. package/dist/chart/render/chart-3d-projection.d.ts.map +1 -0
  51. package/dist/chart/render/chart-3d-scene.d.ts +9 -0
  52. package/dist/chart/render/chart-3d-scene.d.ts.map +1 -0
  53. package/dist/chart/render/chart-3d-shading.d.ts +10 -0
  54. package/dist/chart/render/chart-3d-shading.d.ts.map +1 -0
  55. package/dist/chart/render/chart-3d-surface.d.ts +5 -0
  56. package/dist/chart/render/chart-3d-surface.d.ts.map +1 -0
  57. package/dist/chart/render/chart-3d-svg.d.ts +7 -0
  58. package/dist/chart/render/chart-3d-svg.d.ts.map +1 -0
  59. package/dist/chart/render/chart-3d-walls.d.ts +13 -0
  60. package/dist/chart/render/chart-3d-walls.d.ts.map +1 -0
  61. package/dist/chart/render/chart-svg-funnel.d.ts.map +1 -1
  62. package/dist/chart/render/chart-svg-region-map.d.ts +4 -0
  63. package/dist/chart/render/chart-svg-region-map.d.ts.map +1 -0
  64. package/dist/chart/render/chart-svg-text-metrics.d.ts +2 -0
  65. package/dist/chart/render/chart-svg-text-metrics.d.ts.map +1 -1
  66. package/dist/chart/render/chart-svg.d.ts.map +1 -1
  67. package/dist/chart/render/chart-view.d.ts +5 -1
  68. package/dist/chart/render/chart-view.d.ts.map +1 -1
  69. package/dist/chart/render/index.d.ts +5 -0
  70. package/dist/chart/render/index.d.ts.map +1 -1
  71. package/dist/chart/render/render-space.d.ts.map +1 -1
  72. package/dist/chart/render/summary-ex-formatting.d.ts +5 -0
  73. package/dist/chart/render/summary-ex-formatting.d.ts.map +1 -0
  74. package/dist/chart/render/summary-ex-series.d.ts.map +1 -1
  75. package/dist/chart/render/summary-from-chartex.d.ts.map +1 -1
  76. package/dist/chart/render/summary-from-space.d.ts.map +1 -1
  77. package/dist/chart/render/summary.d.ts +5 -1
  78. package/dist/chart/render/summary.d.ts.map +1 -1
  79. package/dist/chunk-2N7RZQLC.mjs +8 -0
  80. package/dist/{chunk-Q6NM64J2.cjs → chunk-A27O7M5X.cjs} +4938 -1083
  81. package/dist/{chunk-4R65YYAD.mjs → chunk-EGBNPVBA.mjs} +6256 -2277
  82. package/dist/{chunk-3H5UAJB3.mjs → chunk-GNGL4BO7.mjs} +935 -568
  83. package/dist/chunk-LSO5SSFX.mjs +112 -0
  84. package/dist/chunk-MB3TYNMV.mjs +28 -0
  85. package/dist/{chunk-N6424WKA.mjs → chunk-MK2IBZU6.mjs} +1 -1
  86. package/dist/{chunk-X6VNUBES.cjs → chunk-PA5ADSTX.cjs} +2124 -1791
  87. package/dist/{chunk-IOTGRLJH.mjs → chunk-RI56PFGL.mjs} +933 -600
  88. package/dist/{chunk-NAWLWKOJ.mjs → chunk-RPJHMPEL.mjs} +2 -2
  89. package/dist/{chunk-UYMSFJQZ.mjs → chunk-TJXK4D4U.mjs} +5 -5
  90. package/dist/{chunk-O7SVHLD7.mjs → chunk-UQMAPY6D.mjs} +4901 -1077
  91. package/dist/{chunk-54S5A5PZ.mjs → chunk-VDUNZTJC.mjs} +36 -1
  92. package/dist/chunk-XF6ZRA2D.cjs +120 -0
  93. package/dist/crypto/index.cjs +23 -15
  94. package/dist/crypto/index.mjs +23 -15
  95. package/dist/diagram/drawing-resolve.d.ts.map +1 -1
  96. package/dist/diagram/drawing-view.d.ts +6 -0
  97. package/dist/diagram/drawing-view.d.ts.map +1 -1
  98. package/dist/diagram/engine/engine-to-result.d.ts.map +1 -1
  99. package/dist/diagram/index.cjs +786 -145
  100. package/dist/diagram/index.d.ts +1 -0
  101. package/dist/diagram/index.d.ts.map +1 -1
  102. package/dist/diagram/index.mjs +783 -147
  103. package/dist/diagram/layout/smartart-layout-types.d.ts +7 -0
  104. package/dist/diagram/layout/smartart-layout-types.d.ts.map +1 -1
  105. package/dist/diagram/layout-preview.d.ts +4 -0
  106. package/dist/diagram/layout-preview.d.ts.map +1 -1
  107. package/dist/diagram/layout-role-style.d.ts +4 -0
  108. package/dist/diagram/layout-role-style.d.ts.map +1 -0
  109. package/dist/diagram/load.d.ts.map +1 -1
  110. package/dist/diagram/picture-layout.d.ts +23 -0
  111. package/dist/diagram/picture-layout.d.ts.map +1 -0
  112. package/dist/diagram/types.d.ts +6 -0
  113. package/dist/diagram/types.d.ts.map +1 -1
  114. package/dist/diagram/write/cache.d.ts +1 -0
  115. package/dist/diagram/write/cache.d.ts.map +1 -1
  116. package/dist/digest/crc32.d.ts +2 -0
  117. package/dist/digest/crc32.d.ts.map +1 -0
  118. package/dist/digest/index.cjs +11 -0
  119. package/dist/digest/index.d.ts +1 -0
  120. package/dist/digest/index.d.ts.map +1 -1
  121. package/dist/digest/index.mjs +11 -1
  122. package/dist/docx/block-parser.d.ts.map +1 -1
  123. package/dist/docx/diagram-cache.d.ts.map +1 -1
  124. package/dist/docx/diagram-save.d.ts.map +1 -1
  125. package/dist/docx/drawing.d.ts.map +1 -1
  126. package/dist/docx/embedded.cjs +1394 -366
  127. package/dist/docx/embedded.mjs +1394 -366
  128. package/dist/docx/find-pattern.d.ts +33 -0
  129. package/dist/docx/find-pattern.d.ts.map +1 -0
  130. package/dist/docx/find-replacement.d.ts +16 -0
  131. package/dist/docx/find-replacement.d.ts.map +1 -0
  132. package/dist/docx/find-syntax.d.ts +13 -0
  133. package/dist/docx/find-syntax.d.ts.map +1 -0
  134. package/dist/docx/find-wildcards.d.ts +8 -0
  135. package/dist/docx/find-wildcards.d.ts.map +1 -0
  136. package/dist/docx/form-field-model.d.ts +39 -0
  137. package/dist/docx/form-field-model.d.ts.map +1 -1
  138. package/dist/docx/index.cjs +6107 -1728
  139. package/dist/docx/index.d.ts +3 -1
  140. package/dist/docx/index.d.ts.map +1 -1
  141. package/dist/docx/index.mjs +6103 -1729
  142. package/dist/docx/inline-model.d.ts +4 -0
  143. package/dist/docx/inline-model.d.ts.map +1 -1
  144. package/dist/docx/layout/adapt-floats.d.ts.map +1 -1
  145. package/dist/docx/layout/adapter.d.ts.map +1 -1
  146. package/dist/docx/layout/floats.d.ts.map +1 -1
  147. package/dist/docx/layout/index.cjs +2338 -554
  148. package/dist/docx/layout/index.mjs +2338 -554
  149. package/dist/docx/layout/input.d.ts +5 -0
  150. package/dist/docx/layout/input.d.ts.map +1 -1
  151. package/dist/docx/layout/result.d.ts +3 -0
  152. package/dist/docx/layout/result.d.ts.map +1 -1
  153. package/dist/docx/load/index.cjs +7593 -1539
  154. package/dist/docx/load/index.mjs +7593 -1539
  155. package/dist/docx/load/legacy-doc/binary-save.d.ts +4 -0
  156. package/dist/docx/load/legacy-doc/binary-save.d.ts.map +1 -0
  157. package/dist/docx/load/legacy-doc/blocks.d.ts +19 -0
  158. package/dist/docx/load/legacy-doc/blocks.d.ts.map +1 -0
  159. package/dist/docx/load/legacy-doc/borders.d.ts +7 -0
  160. package/dist/docx/load/legacy-doc/borders.d.ts.map +1 -0
  161. package/dist/docx/load/legacy-doc/context.d.ts +65 -0
  162. package/dist/docx/load/legacy-doc/context.d.ts.map +1 -0
  163. package/dist/docx/load/legacy-doc/drawing.d.ts +15 -0
  164. package/dist/docx/load/legacy-doc/drawing.d.ts.map +1 -0
  165. package/dist/docx/load/legacy-doc/error.d.ts +5 -0
  166. package/dist/docx/load/legacy-doc/error.d.ts.map +1 -0
  167. package/dist/docx/load/legacy-doc/inline.d.ts +7 -0
  168. package/dist/docx/load/legacy-doc/inline.d.ts.map +1 -0
  169. package/dist/docx/load/legacy-doc/numbering-part.d.ts +3 -0
  170. package/dist/docx/load/legacy-doc/numbering-part.d.ts.map +1 -0
  171. package/dist/docx/load/legacy-doc/package.d.ts +8 -0
  172. package/dist/docx/load/legacy-doc/package.d.ts.map +1 -0
  173. package/dist/docx/load/legacy-doc/para-props.d.ts +6 -0
  174. package/dist/docx/load/legacy-doc/para-props.d.ts.map +1 -0
  175. package/dist/docx/load/legacy-doc/run-props.d.ts +8 -0
  176. package/dist/docx/load/legacy-doc/run-props.d.ts.map +1 -0
  177. package/dist/docx/load/legacy-doc/sections.d.ts +23 -0
  178. package/dist/docx/load/legacy-doc/sections.d.ts.map +1 -0
  179. package/dist/docx/load/legacy-doc/styles-part.d.ts +3 -0
  180. package/dist/docx/load/legacy-doc/styles-part.d.ts.map +1 -0
  181. package/dist/docx/load/legacy-doc/table.d.ts +6 -0
  182. package/dist/docx/load/legacy-doc/table.d.ts.map +1 -0
  183. package/dist/docx/load/legacy-doc/xml.d.ts +21 -0
  184. package/dist/docx/load/legacy-doc/xml.d.ts.map +1 -0
  185. package/dist/docx/load/legacy-doc.d.ts +5 -4
  186. package/dist/docx/load/legacy-doc.d.ts.map +1 -1
  187. package/dist/docx/model-paragraph.d.ts +5 -0
  188. package/dist/docx/model-paragraph.d.ts.map +1 -1
  189. package/dist/docx/model.d.ts +3 -0
  190. package/dist/docx/model.d.ts.map +1 -1
  191. package/dist/docx/numbering-editing.d.ts +11 -1
  192. package/dist/docx/numbering-editing.d.ts.map +1 -1
  193. package/dist/docx/numbering-format.d.ts.map +1 -1
  194. package/dist/docx/numbering-model.d.ts +17 -0
  195. package/dist/docx/numbering-model.d.ts.map +1 -1
  196. package/dist/docx/numbering-package.d.ts +2 -2
  197. package/dist/docx/numbering-package.d.ts.map +1 -1
  198. package/dist/docx/numbering-parse.d.ts +2 -1
  199. package/dist/docx/numbering-parse.d.ts.map +1 -1
  200. package/dist/docx/numbering-picture-save.d.ts +13 -0
  201. package/dist/docx/numbering-picture-save.d.ts.map +1 -0
  202. package/dist/docx/numbering-picture.d.ts +18 -0
  203. package/dist/docx/numbering-picture.d.ts.map +1 -0
  204. package/dist/docx/parse.d.ts.map +1 -1
  205. package/dist/docx/permission-markers.d.ts +19 -0
  206. package/dist/docx/permission-markers.d.ts.map +1 -0
  207. package/dist/docx/permissions.d.ts +11 -0
  208. package/dist/docx/permissions.d.ts.map +1 -0
  209. package/dist/docx/protection-legacy.d.ts +13 -0
  210. package/dist/docx/protection-legacy.d.ts.map +1 -0
  211. package/dist/docx/protection.d.ts +30 -0
  212. package/dist/docx/protection.d.ts.map +1 -0
  213. package/dist/docx/save.d.ts.map +1 -1
  214. package/dist/docx/settings.d.ts +6 -1
  215. package/dist/docx/settings.d.ts.map +1 -1
  216. package/dist/docx/ui/customization.d.ts.map +1 -1
  217. package/dist/docx/ui/edit-restriction.d.ts +53 -0
  218. package/dist/docx/ui/edit-restriction.d.ts.map +1 -0
  219. package/dist/docx/ui/index.cjs +3617 -1097
  220. package/dist/docx/ui/index.d.ts +4 -0
  221. package/dist/docx/ui/index.d.ts.map +1 -1
  222. package/dist/docx/ui/index.mjs +3597 -1098
  223. package/dist/docx/ui/inline-content-schema.d.ts.map +1 -1
  224. package/dist/docx/ui/paragraph-attributes.d.ts.map +1 -1
  225. package/dist/docx/ui/ribbon-action-ids.d.ts +1 -1
  226. package/dist/docx/ui/ribbon-action-ids.d.ts.map +1 -1
  227. package/dist/docx/ui/run-adapter.d.ts.map +1 -1
  228. package/dist/docx/write-drawing.d.ts.map +1 -1
  229. package/dist/docx/write-paragraph.d.ts.map +1 -1
  230. package/dist/drawingml/index.cjs +708 -111
  231. package/dist/drawingml/index.d.ts +7 -0
  232. package/dist/drawingml/index.d.ts.map +1 -1
  233. package/dist/drawingml/index.mjs +698 -113
  234. package/dist/drawingml/picture-artistic.d.ts +14 -0
  235. package/dist/drawingml/picture-artistic.d.ts.map +1 -0
  236. package/dist/drawingml/picture-effects.d.ts +4 -1
  237. package/dist/drawingml/picture-effects.d.ts.map +1 -1
  238. package/dist/drawingml/picture-fill.d.ts.map +1 -1
  239. package/dist/drawingml/picture-hsl-pixels.d.ts +4 -0
  240. package/dist/drawingml/picture-hsl-pixels.d.ts.map +1 -0
  241. package/dist/drawingml/picture-layout.d.ts +25 -0
  242. package/dist/drawingml/picture-layout.d.ts.map +1 -0
  243. package/dist/drawingml/picture-standard-effects.d.ts +15 -0
  244. package/dist/drawingml/picture-standard-effects.d.ts.map +1 -0
  245. package/dist/drawingml/picture-transfer.d.ts +11 -0
  246. package/dist/drawingml/picture-transfer.d.ts.map +1 -0
  247. package/dist/drawingml/raster-image.d.ts +29 -0
  248. package/dist/drawingml/raster-image.d.ts.map +1 -0
  249. package/dist/drawingml/types.d.ts +1 -0
  250. package/dist/drawingml/types.d.ts.map +1 -1
  251. package/dist/drawingml/write-pattern-picture.d.ts.map +1 -1
  252. package/dist/drawingml/write-theme.d.ts +2 -0
  253. package/dist/drawingml/write-theme.d.ts.map +1 -1
  254. package/dist/geometry/index.cjs +38 -0
  255. package/dist/geometry/index.d.ts +1 -0
  256. package/dist/geometry/index.d.ts.map +1 -1
  257. package/dist/geometry/index.mjs +36 -1
  258. package/dist/geometry/picture-tile.d.ts +29 -0
  259. package/dist/geometry/picture-tile.d.ts.map +1 -0
  260. package/dist/index.cjs +15671 -12934
  261. package/dist/index.mjs +15671 -12934
  262. package/dist/pptx/automation/index.cjs +9313 -3688
  263. package/dist/pptx/automation/index.d.ts +40 -6
  264. package/dist/pptx/automation/index.d.ts.map +1 -1
  265. package/dist/pptx/automation/index.mjs +254 -12
  266. package/dist/pptx/automation/schemas/index.cjs +26 -0
  267. package/dist/pptx/automation/schemas/index.d.ts +26 -1
  268. package/dist/pptx/automation/schemas/index.d.ts.map +1 -0
  269. package/dist/pptx/automation/schemas/index.mjs +1 -1
  270. package/dist/pptx/chunks/{elements-mSCZ84Tc.d.ts → elements-f3UbFph-.d.ts} +7 -2
  271. package/dist/pptx/chunks/elements-f3UbFph-.d.ts.map +1 -0
  272. package/dist/pptx/chunks/{index-DnWlmYCy.d.ts → index-BnH2QjYm.d.ts} +4 -4
  273. package/dist/pptx/chunks/{index-DnWlmYCy.d.ts.map → index-BnH2QjYm.d.ts.map} +1 -1
  274. package/dist/pptx/chunks/{index-D-FdgqrP.d.ts → index-Bp-1pGo1.d.ts} +4 -4
  275. package/dist/pptx/chunks/{index-D-FdgqrP.d.ts.map → index-Bp-1pGo1.d.ts.map} +1 -1
  276. package/dist/pptx/chunks/{index-DKybuHPT.d.ts → index-pLLN4OTz.d.ts} +62 -24
  277. package/dist/pptx/chunks/index-pLLN4OTz.d.ts.map +1 -0
  278. package/dist/pptx/chunks/{smart-art-DLumQo90.d.ts → smart-art-CmOrPLLQ.d.ts} +86 -2
  279. package/dist/pptx/chunks/smart-art-CmOrPLLQ.d.ts.map +1 -0
  280. package/dist/pptx/chunks/{text-operations-hyPODwIQ.d.ts → text-operations-D5sgspO6.d.ts} +2 -2
  281. package/dist/pptx/chunks/{text-operations-hyPODwIQ.d.ts.map → text-operations-D5sgspO6.d.ts.map} +1 -1
  282. package/dist/pptx/cli/index.cjs +7477 -2848
  283. package/dist/pptx/cli/index.d.ts +1 -1
  284. package/dist/pptx/cli/index.mjs +6 -6
  285. package/dist/pptx/converter/index.cjs +3895 -503
  286. package/dist/pptx/converter/index.d.ts +1 -1
  287. package/dist/pptx/converter/index.mjs +3 -3
  288. package/dist/pptx/editor/render/custom-show-operations.cjs +133 -0
  289. package/dist/pptx/editor/render/custom-show-operations.d.ts +42 -0
  290. package/dist/pptx/editor/render/custom-show-operations.d.ts.map +1 -0
  291. package/dist/pptx/editor/render/custom-show-operations.mjs +119 -0
  292. package/dist/pptx/editor/render/find-replace.cjs +15 -14
  293. package/dist/pptx/editor/render/find-replace.d.ts +2 -2
  294. package/dist/pptx/editor/render/find-replace.mjs +2 -1
  295. package/dist/pptx/editor/render/slide-operations.cjs +9 -8
  296. package/dist/pptx/editor/render/slide-operations.mjs +3 -2
  297. package/dist/pptx/editor/render/table-data-grid-ops.cjs +1 -1
  298. package/dist/pptx/editor/render/table-data-grid-ops.mjs +1 -1
  299. package/dist/pptx/editor/render/text-runs-style-patch.d.ts +1 -1
  300. package/dist/pptx/editor/render/text-style-scope.d.ts +1 -1
  301. package/dist/pptx/index.cjs +8447 -3693
  302. package/dist/pptx/index.d.ts +7 -7
  303. package/dist/pptx/index.mjs +7 -7
  304. package/dist/pptx/node/index.d.ts +1 -1
  305. package/dist/pptx/smartart-layouts/index.d.ts +1 -1
  306. package/dist/pptx/smartart-layouts/index.mjs +2 -2
  307. package/dist/teams/index.cjs +2176 -751
  308. package/dist/teams/index.mjs +2176 -751
  309. package/dist/text/index.cjs +241 -0
  310. package/dist/text/index.d.ts +2 -0
  311. package/dist/text/index.d.ts.map +1 -1
  312. package/dist/text/index.mjs +240 -1
  313. package/dist/text/truetype/parse.d.ts +36 -0
  314. package/dist/text/truetype/parse.d.ts.map +1 -0
  315. package/dist/text/truetype/subset.d.ts +16 -0
  316. package/dist/text/truetype/subset.d.ts.map +1 -0
  317. package/dist/visio/cell-formula.d.ts +5 -1
  318. package/dist/visio/cell-formula.d.ts.map +1 -1
  319. package/dist/visio/collab/index.cjs +3 -1
  320. package/dist/visio/collab/index.mjs +3 -1
  321. package/dist/visio/container-relationships.d.ts +53 -0
  322. package/dist/visio/container-relationships.d.ts.map +1 -0
  323. package/dist/visio/data-connections.d.ts +32 -0
  324. package/dist/visio/data-connections.d.ts.map +1 -0
  325. package/dist/visio/data-recordsets.d.ts +7 -0
  326. package/dist/visio/data-recordsets.d.ts.map +1 -1
  327. package/dist/visio/data-refresh.d.ts +33 -0
  328. package/dist/visio/data-refresh.d.ts.map +1 -0
  329. package/dist/visio/edit-commands.d.ts +6 -1
  330. package/dist/visio/edit-commands.d.ts.map +1 -1
  331. package/dist/visio/edit-connector.d.ts.map +1 -1
  332. package/dist/visio/edit-container-fit.d.ts +32 -0
  333. package/dist/visio/edit-container-fit.d.ts.map +1 -0
  334. package/dist/visio/edit-container-members.d.ts +33 -0
  335. package/dist/visio/edit-container-members.d.ts.map +1 -0
  336. package/dist/visio/edit-container-options.d.ts +33 -0
  337. package/dist/visio/edit-container-options.d.ts.map +1 -0
  338. package/dist/visio/edit-data-commands.d.ts +5 -0
  339. package/dist/visio/edit-data-commands.d.ts.map +1 -1
  340. package/dist/visio/edit-data-parts.d.ts +2 -0
  341. package/dist/visio/edit-data-parts.d.ts.map +1 -1
  342. package/dist/visio/edit-data.d.ts.map +1 -1
  343. package/dist/visio/edit-delete.d.ts.map +1 -1
  344. package/dist/visio/edit-diagram-parts-commands.d.ts +24 -1
  345. package/dist/visio/edit-diagram-parts-commands.d.ts.map +1 -1
  346. package/dist/visio/edit-diagram-parts.d.ts +11 -2
  347. package/dist/visio/edit-diagram-parts.d.ts.map +1 -1
  348. package/dist/visio/edit-geometry.d.ts +4 -1
  349. package/dist/visio/edit-geometry.d.ts.map +1 -1
  350. package/dist/visio/edit-group-resize.d.ts.map +1 -1
  351. package/dist/visio/edit-instance-checks.d.ts.map +1 -1
  352. package/dist/visio/edit-package.d.ts.map +1 -1
  353. package/dist/visio/edit-page-theme-commands.d.ts +26 -0
  354. package/dist/visio/edit-page-theme-commands.d.ts.map +1 -1
  355. package/dist/visio/edit-page-theme-part.d.ts +6 -0
  356. package/dist/visio/edit-page-theme-part.d.ts.map +1 -0
  357. package/dist/visio/edit-page-theme.d.ts +9 -1
  358. package/dist/visio/edit-page-theme.d.ts.map +1 -1
  359. package/dist/visio/edit-picture-adjust.d.ts +32 -0
  360. package/dist/visio/edit-picture-adjust.d.ts.map +1 -0
  361. package/dist/visio/edit-recalculate-index.d.ts +13 -0
  362. package/dist/visio/edit-recalculate-index.d.ts.map +1 -1
  363. package/dist/visio/edit-recalculate-values.d.ts.map +1 -1
  364. package/dist/visio/edit-recalculate.d.ts.map +1 -1
  365. package/dist/visio/edit-resize-anchor.d.ts.map +1 -1
  366. package/dist/visio/edit-swimlane-commands.d.ts +91 -0
  367. package/dist/visio/edit-swimlane-commands.d.ts.map +1 -0
  368. package/dist/visio/edit-swimlane-layout.d.ts +64 -0
  369. package/dist/visio/edit-swimlane-layout.d.ts.map +1 -0
  370. package/dist/visio/edit-swimlane-ops.d.ts +11 -0
  371. package/dist/visio/edit-swimlane-ops.d.ts.map +1 -0
  372. package/dist/visio/edit-swimlane-shapes.d.ts +42 -0
  373. package/dist/visio/edit-swimlane-shapes.d.ts.map +1 -0
  374. package/dist/visio/edit-swimlane-turn.d.ts +9 -0
  375. package/dist/visio/edit-swimlane-turn.d.ts.map +1 -0
  376. package/dist/visio/edit.d.ts.map +1 -1
  377. package/dist/visio/effects.d.ts +3 -2
  378. package/dist/visio/effects.d.ts.map +1 -1
  379. package/dist/visio/formula-analyze.d.ts +2 -0
  380. package/dist/visio/formula-analyze.d.ts.map +1 -1
  381. package/dist/visio/formula-evaluate.d.ts.map +1 -1
  382. package/dist/visio/formula-master.d.ts +1 -0
  383. package/dist/visio/formula-master.d.ts.map +1 -1
  384. package/dist/visio/geometry.d.ts +2 -1
  385. package/dist/visio/geometry.d.ts.map +1 -1
  386. package/dist/visio/index.cjs +12207 -7779
  387. package/dist/visio/index.d.ts +8 -1
  388. package/dist/visio/index.d.ts.map +1 -1
  389. package/dist/visio/index.mjs +12201 -7780
  390. package/dist/visio/infinite-line.d.ts +17 -0
  391. package/dist/visio/infinite-line.d.ts.map +1 -0
  392. package/dist/visio/media.d.ts +4 -23
  393. package/dist/visio/media.d.ts.map +1 -1
  394. package/dist/visio/model.d.ts +46 -0
  395. package/dist/visio/model.d.ts.map +1 -1
  396. package/dist/visio/package-common.d.ts +1 -1
  397. package/dist/visio/package-common.d.ts.map +1 -1
  398. package/dist/visio/package-kind.d.ts +34 -0
  399. package/dist/visio/package-kind.d.ts.map +1 -0
  400. package/dist/visio/page-theme.d.ts +7 -0
  401. package/dist/visio/page-theme.d.ts.map +1 -1
  402. package/dist/visio/parser.d.ts +2 -2
  403. package/dist/visio/parser.d.ts.map +1 -1
  404. package/dist/visio/shadow.d.ts +2 -1
  405. package/dist/visio/shadow.d.ts.map +1 -1
  406. package/dist/visio/shape-structure.d.ts +19 -3
  407. package/dist/visio/shape-structure.d.ts.map +1 -1
  408. package/dist/visio/shapes.d.ts +7 -1
  409. package/dist/visio/shapes.d.ts.map +1 -1
  410. package/dist/visio/stencil-file.d.ts +2 -2
  411. package/dist/visio/style.d.ts.map +1 -1
  412. package/dist/visio/swimlane-stack.d.ts +65 -0
  413. package/dist/visio/swimlane-stack.d.ts.map +1 -0
  414. package/dist/visio/theme-builtins.d.ts +3 -0
  415. package/dist/visio/theme-builtins.d.ts.map +1 -1
  416. package/dist/visio/theme-effects.d.ts +19 -0
  417. package/dist/visio/theme-effects.d.ts.map +1 -0
  418. package/dist/visio/theme-font.d.ts +13 -0
  419. package/dist/visio/theme-font.d.ts.map +1 -0
  420. package/dist/visio/theme-line.d.ts.map +1 -1
  421. package/dist/visio/theme-write.d.ts.map +1 -1
  422. package/dist/visio/theme.d.ts +7 -0
  423. package/dist/visio/theme.d.ts.map +1 -1
  424. package/dist/visio/ui/data-graphic-config.d.ts +45 -0
  425. package/dist/visio/ui/data-graphic-config.d.ts.map +1 -0
  426. package/dist/visio/ui/data-graphic-rules.d.ts +7 -0
  427. package/dist/visio/ui/data-graphic-rules.d.ts.map +1 -1
  428. package/dist/visio/ui/data-graphics.d.ts +9 -0
  429. package/dist/visio/ui/data-graphics.d.ts.map +1 -1
  430. package/dist/visio/ui/diagram-parts.d.ts +20 -2
  431. package/dist/visio/ui/diagram-parts.d.ts.map +1 -1
  432. package/dist/visio/ui/edit-commands.d.ts.map +1 -1
  433. package/dist/visio/ui/guides.d.ts +9 -1
  434. package/dist/visio/ui/guides.d.ts.map +1 -1
  435. package/dist/visio/ui/index.cjs +14266 -10008
  436. package/dist/visio/ui/index.d.ts +4 -0
  437. package/dist/visio/ui/index.d.ts.map +1 -1
  438. package/dist/visio/ui/index.mjs +14231 -10009
  439. package/dist/visio/ui/org-chart.d.ts +75 -0
  440. package/dist/visio/ui/org-chart.d.ts.map +1 -0
  441. package/dist/visio/ui/resize-snap.d.ts +51 -0
  442. package/dist/visio/ui/resize-snap.d.ts.map +1 -0
  443. package/dist/visio/ui/sample-drawing.d.ts +26 -0
  444. package/dist/visio/ui/sample-drawing.d.ts.map +1 -1
  445. package/dist/visio/ui/scene-validation.d.ts.map +1 -1
  446. package/dist/visio/ui/selection-resize.d.ts +2 -2
  447. package/dist/visio/ui/selection-resize.d.ts.map +1 -1
  448. package/dist/visio/ui/shape-resize.d.ts +29 -1
  449. package/dist/visio/ui/shape-resize.d.ts.map +1 -1
  450. package/dist/visio/ui/snapshot-scene.d.ts.map +1 -1
  451. package/dist/visio/ui/swimlane.d.ts +37 -0
  452. package/dist/visio/ui/swimlane.d.ts.map +1 -0
  453. package/dist/visio/ui/templates.d.ts +26 -0
  454. package/dist/visio/ui/templates.d.ts.map +1 -0
  455. package/dist/xlsx/audit/ast-text.d.ts +12 -0
  456. package/dist/xlsx/audit/ast-text.d.ts.map +1 -0
  457. package/dist/xlsx/audit/error-check.d.ts +23 -0
  458. package/dist/xlsx/audit/error-check.d.ts.map +1 -0
  459. package/dist/xlsx/audit/evaluate-steps.d.ts +48 -0
  460. package/dist/xlsx/audit/evaluate-steps.d.ts.map +1 -0
  461. package/dist/xlsx/audit/index.d.ts +6 -0
  462. package/dist/xlsx/audit/index.d.ts.map +1 -0
  463. package/dist/xlsx/audit/trace.d.ts +59 -0
  464. package/dist/xlsx/audit/trace.d.ts.map +1 -0
  465. package/dist/xlsx/audit/watch.d.ts +17 -0
  466. package/dist/xlsx/audit/watch.d.ts.map +1 -0
  467. package/dist/xlsx/edit/cell-values.d.ts.map +1 -1
  468. package/dist/xlsx/edit/chart-ex.d.ts +1 -0
  469. package/dist/xlsx/edit/chart-ex.d.ts.map +1 -1
  470. package/dist/xlsx/edit/filter.d.ts +8 -1
  471. package/dist/xlsx/edit/filter.d.ts.map +1 -1
  472. package/dist/xlsx/edit/index.d.ts +5 -1
  473. package/dist/xlsx/edit/index.d.ts.map +1 -1
  474. package/dist/xlsx/edit/session-calc.d.ts +5 -0
  475. package/dist/xlsx/edit/session-calc.d.ts.map +1 -1
  476. package/dist/xlsx/edit/session.d.ts.map +1 -1
  477. package/dist/xlsx/edit/sort-choices.d.ts +23 -0
  478. package/dist/xlsx/edit/sort-choices.d.ts.map +1 -0
  479. package/dist/xlsx/edit/sort-keys.d.ts +49 -0
  480. package/dist/xlsx/edit/sort-keys.d.ts.map +1 -0
  481. package/dist/xlsx/edit/sort-reapply.d.ts +11 -0
  482. package/dist/xlsx/edit/sort-reapply.d.ts.map +1 -0
  483. package/dist/xlsx/edit/sort.d.ts +14 -12
  484. package/dist/xlsx/edit/sort.d.ts.map +1 -1
  485. package/dist/xlsx/edit/text-columns.d.ts +21 -0
  486. package/dist/xlsx/edit/text-columns.d.ts.map +1 -0
  487. package/dist/xlsx/edit/types.d.ts +10 -5
  488. package/dist/xlsx/edit/types.d.ts.map +1 -1
  489. package/dist/xlsx/edit/view.d.ts +9 -1
  490. package/dist/xlsx/edit/view.d.ts.map +1 -1
  491. package/dist/xlsx/embedded-chart-ex-space.d.ts +18 -0
  492. package/dist/xlsx/embedded-chart-ex-space.d.ts.map +1 -0
  493. package/dist/xlsx/filter-criteria.d.ts +23 -0
  494. package/dist/xlsx/filter-criteria.d.ts.map +1 -0
  495. package/dist/xlsx/filter-dynamic.d.ts +8 -0
  496. package/dist/xlsx/filter-dynamic.d.ts.map +1 -0
  497. package/dist/xlsx/filter-menu.d.ts +49 -0
  498. package/dist/xlsx/filter-menu.d.ts.map +1 -0
  499. package/dist/xlsx/filter-rows.d.ts +4 -4
  500. package/dist/xlsx/filter-rows.d.ts.map +1 -1
  501. package/dist/xlsx/formula/engine-types.d.ts +8 -0
  502. package/dist/xlsx/formula/engine-types.d.ts.map +1 -1
  503. package/dist/xlsx/formula/engine.d.ts.map +1 -1
  504. package/dist/xlsx/index.cjs +7259 -3079
  505. package/dist/xlsx/index.d.ts +5 -0
  506. package/dist/xlsx/index.d.ts.map +1 -1
  507. package/dist/xlsx/index.mjs +7213 -3079
  508. package/dist/xlsx/layout/index.d.ts +1 -0
  509. package/dist/xlsx/layout/index.d.ts.map +1 -1
  510. package/dist/xlsx/layout/split.d.ts +55 -0
  511. package/dist/xlsx/layout/split.d.ts.map +1 -0
  512. package/dist/xlsx/layout/viewport.d.ts +2 -0
  513. package/dist/xlsx/layout/viewport.d.ts.map +1 -1
  514. package/dist/xlsx/load/index.cjs +2170 -688
  515. package/dist/xlsx/load/index.mjs +2170 -688
  516. package/dist/xlsx/model-filter.d.ts +54 -0
  517. package/dist/xlsx/model-filter.d.ts.map +1 -0
  518. package/dist/xlsx/model-sort.d.ts +27 -0
  519. package/dist/xlsx/model-sort.d.ts.map +1 -0
  520. package/dist/xlsx/model.d.ts +81 -4
  521. package/dist/xlsx/model.d.ts.map +1 -1
  522. package/dist/xlsx/read/chart.d.ts.map +1 -1
  523. package/dist/xlsx/read/drawing.d.ts.map +1 -1
  524. package/dist/xlsx/read/filter-columns.d.ts +5 -0
  525. package/dist/xlsx/read/filter-columns.d.ts.map +1 -0
  526. package/dist/xlsx/read/ignored-errors.d.ts +4 -0
  527. package/dist/xlsx/read/ignored-errors.d.ts.map +1 -0
  528. package/dist/xlsx/read/shared-strings.d.ts +5 -3
  529. package/dist/xlsx/read/shared-strings.d.ts.map +1 -1
  530. package/dist/xlsx/read/sheet-data.d.ts.map +1 -1
  531. package/dist/xlsx/read/sheet-props.d.ts +2 -2
  532. package/dist/xlsx/read/sheet-props.d.ts.map +1 -1
  533. package/dist/xlsx/read/sort-state.d.ts +5 -0
  534. package/dist/xlsx/read/sort-state.d.ts.map +1 -0
  535. package/dist/xlsx/read/tables.d.ts +2 -2
  536. package/dist/xlsx/read/tables.d.ts.map +1 -1
  537. package/dist/xlsx/read/worksheet.d.ts.map +1 -1
  538. package/dist/xlsx/sort-lists.d.ts +6 -0
  539. package/dist/xlsx/sort-lists.d.ts.map +1 -0
  540. package/dist/xlsx/ui/audit-state.d.ts +19 -0
  541. package/dist/xlsx/ui/audit-state.d.ts.map +1 -0
  542. package/dist/xlsx/ui/commands/audit.d.ts +3 -0
  543. package/dist/xlsx/ui/commands/audit.d.ts.map +1 -0
  544. package/dist/xlsx/ui/commands/formulas.d.ts.map +1 -1
  545. package/dist/xlsx/ui/commands/i18n/audit.d.ts +3 -0
  546. package/dist/xlsx/ui/commands/i18n/audit.d.ts.map +1 -0
  547. package/dist/xlsx/ui/commands/i18n/filters.d.ts +3 -0
  548. package/dist/xlsx/ui/commands/i18n/filters.d.ts.map +1 -0
  549. package/dist/xlsx/ui/commands/i18n/index.d.ts.map +1 -1
  550. package/dist/xlsx/ui/commands/i18n/navigation.d.ts.map +1 -1
  551. package/dist/xlsx/ui/commands/i18n/ribbon-tabs.d.ts.map +1 -1
  552. package/dist/xlsx/ui/commands/i18n/rules.d.ts.map +1 -1
  553. package/dist/xlsx/ui/commands/i18n/tools.d.ts.map +1 -1
  554. package/dist/xlsx/ui/commands/icons.d.ts.map +1 -1
  555. package/dist/xlsx/ui/commands/sort-filter.d.ts.map +1 -1
  556. package/dist/xlsx/ui/context.d.ts +6 -1
  557. package/dist/xlsx/ui/context.d.ts.map +1 -1
  558. package/dist/xlsx/ui/dialogs/grid-chart.d.ts.map +1 -1
  559. package/dist/xlsx/ui/grid/geometry.d.ts +29 -1
  560. package/dist/xlsx/ui/grid/geometry.d.ts.map +1 -1
  561. package/dist/xlsx/ui/index.cjs +9454 -5323
  562. package/dist/xlsx/ui/index.d.ts +1 -0
  563. package/dist/xlsx/ui/index.d.ts.map +1 -1
  564. package/dist/xlsx/ui/index.mjs +9448 -5324
  565. package/dist/xlsx/ui/ribbon/icon-paths.d.ts.map +1 -1
  566. package/dist/xlsx/ui/ribbon/tabs/review-view.d.ts.map +1 -1
  567. package/dist/xlsx/write/drawing.d.ts.map +1 -1
  568. package/dist/xlsx/write/filter-columns.d.ts +53 -0
  569. package/dist/xlsx/write/filter-columns.d.ts.map +1 -0
  570. package/dist/xlsx/write/ignored-errors.d.ts +3 -0
  571. package/dist/xlsx/write/ignored-errors.d.ts.map +1 -0
  572. package/dist/xlsx/write/shared-strings.d.ts +4 -4
  573. package/dist/xlsx/write/shared-strings.d.ts.map +1 -1
  574. package/dist/xlsx/write/sheet-parts.d.ts.map +1 -1
  575. package/dist/xlsx/write/sheet-props.d.ts +2 -1
  576. package/dist/xlsx/write/sheet-props.d.ts.map +1 -1
  577. package/dist/xlsx/write/smart-art-cache.d.ts.map +1 -1
  578. package/dist/xlsx/write/smart-art.d.ts.map +1 -1
  579. package/dist/xlsx/write/sort-state.d.ts +55 -0
  580. package/dist/xlsx/write/sort-state.d.ts.map +1 -0
  581. package/dist/xlsx/write/table-patch.d.ts +2 -1
  582. package/dist/xlsx/write/table-patch.d.ts.map +1 -1
  583. package/dist/xlsx/write/tables.d.ts +2 -1
  584. package/dist/xlsx/write/tables.d.ts.map +1 -1
  585. package/dist/xlsx/write/workbook-part.d.ts.map +1 -1
  586. package/dist/xlsx/write/worksheet.d.ts.map +1 -1
  587. package/package.json +7 -2
  588. package/dist/PptxHandler-QY5VL3CY.mjs +0 -7
  589. package/dist/PptxHandler-SJ5ZUIUX.mjs +0 -4
  590. package/dist/PptxHandler-TESZUH66.cjs +0 -13
  591. package/dist/chunk-3GXV5MPC.mjs +0 -41
  592. package/dist/chunk-MHNETXQB.mjs +0 -1
  593. package/dist/pptx/chunks/elements-mSCZ84Tc.d.ts.map +0 -1
  594. package/dist/pptx/chunks/index-DKybuHPT.d.ts.map +0 -1
  595. package/dist/pptx/chunks/smart-art-DLumQo90.d.ts.map +0 -1
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var xmldom = require('@xmldom/xmldom');
4
+ var fflate = require('fflate');
4
5
 
5
6
  // xml/namespaces.ts
6
7
  var NS = {
@@ -8,6 +9,8 @@ var NS = {
8
9
  w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
9
10
  /** DrawingML main. */
10
11
  a: "http://schemas.openxmlformats.org/drawingml/2006/main",
12
+ /** Office 2016 extended charts (waterfall, histogram, funnel...; `cx:chartSpace`). */
13
+ cx: "http://schemas.microsoft.com/office/drawing/2014/chartex",
11
14
  /** Relationships (`r:id`, `r:embed`). */
12
15
  r: "http://schemas.openxmlformats.org/officeDocument/2006/relationships"};
13
16
  var DEFAULT_XML_LIMITS = {
@@ -415,9 +418,9 @@ function parseRunProperties(props) {
415
418
  if (themeColor2) {
416
419
  result.colorTheme = { token: themeColor2 };
417
420
  const tint = parseTintShade(getW(color, "themeTint"));
418
- const shade = parseTintShade(getW(color, "themeShade"));
421
+ const shade2 = parseTintShade(getW(color, "themeShade"));
419
422
  if (tint !== void 0) result.colorTheme.tint = tint;
420
- if (shade !== void 0) result.colorTheme.shade = shade;
423
+ if (shade2 !== void 0) result.colorTheme.shade = shade2;
421
424
  }
422
425
  const spacing2 = parseSignedTwips(getW(first2(props, "spacing"), "val"));
423
426
  if (spacing2 !== void 0) result.characterSpacingTwips = spacing2;
@@ -435,9 +438,9 @@ function parseRunProperties(props) {
435
438
  if (shdTheme) {
436
439
  result.shadingThemeFill = { token: shdTheme };
437
440
  const tint = parseTintShade(getW(shd, "themeFillTint"));
438
- const shade = parseTintShade(getW(shd, "themeFillShade"));
441
+ const shade2 = parseTintShade(getW(shd, "themeFillShade"));
439
442
  if (tint !== void 0) result.shadingThemeFill.tint = tint;
440
- if (shade !== void 0) result.shadingThemeFill.shade = shade;
443
+ if (shade2 !== void 0) result.shadingThemeFill.shade = shade2;
441
444
  }
442
445
  return result;
443
446
  }
@@ -1371,11 +1374,11 @@ function resolveDrawingColor(color, theme, options2) {
1371
1374
  }
1372
1375
  if (has("inv")) [r, g, b] = [255 - r, 255 - g, 255 - b];
1373
1376
  if (has("gray")) r = g = b = Math.round(0.299 * r + 0.587 * g + 0.114 * b);
1374
- const shade = parseDrawingPercent(find("shade"));
1375
- if (shade !== void 0) {
1376
- r = linearToSrgb255(srgb255ToLinear(r) * shade);
1377
- g = linearToSrgb255(srgb255ToLinear(g) * shade);
1378
- b = linearToSrgb255(srgb255ToLinear(b) * shade);
1377
+ const shade2 = parseDrawingPercent(find("shade"));
1378
+ if (shade2 !== void 0) {
1379
+ r = linearToSrgb255(srgb255ToLinear(r) * shade2);
1380
+ g = linearToSrgb255(srgb255ToLinear(g) * shade2);
1381
+ b = linearToSrgb255(srgb255ToLinear(b) * shade2);
1379
1382
  }
1380
1383
  const tint = parseDrawingPercent(find("tint"));
1381
1384
  if (tint !== void 0) {
@@ -1421,20 +1424,140 @@ function resolveDrawingColor(color, theme, options2) {
1421
1424
  };
1422
1425
  }
1423
1426
 
1424
- // drawingml/picture-crop.ts
1425
- var SIDES = { l: "cropLeft", t: "cropTop", r: "cropRight", b: "cropBottom" };
1426
- function parsePictureCrop(blipFill) {
1427
- const rect3 = first(blipFill, "srcRect", NS.a);
1428
- if (!rect3) return void 0;
1429
- const result = {};
1430
- for (const [attr3, key] of Object.entries(SIDES)) {
1431
- const raw = rect3.getAttribute(attr3);
1432
- if (raw === null || !raw.trim()) continue;
1427
+ // drawingml/picture-artistic.ts
1428
+ var ARTISTIC_PRIMARY_ATTRIBUTE = {
1429
+ artisticBlur: "radius",
1430
+ artisticCement: "crackSpacing",
1431
+ artisticChalkSketch: "pressure",
1432
+ artisticCrisscrossEtching: "pressure",
1433
+ artisticCutout: "numberOfShades",
1434
+ artisticFilmGrain: "grainSize",
1435
+ artisticGlass: "scaling",
1436
+ artisticGlowDiffused: "intensity",
1437
+ artisticGlowEdges: "smoothness",
1438
+ artisticLightScreen: "gridSize",
1439
+ artisticLineDrawing: "pencilSize",
1440
+ artisticMarker: "size",
1441
+ // Spelled "Mosiaic" in the schema; Microsoft's typo is part of the format.
1442
+ artisticMosiaicBubbles: "pressure",
1443
+ artisticPaintBrush: "brushSize",
1444
+ artisticPaintStrokes: "intensity",
1445
+ artisticPastelsSmooth: "scaling",
1446
+ artisticPencilGrayscale: "pencilSize",
1447
+ artisticPencilSketch: "pressure",
1448
+ artisticPhotocopy: "detail",
1449
+ artisticPlasticWrap: "smoothness",
1450
+ artisticTexturizer: "scaling",
1451
+ artisticWatercolorSponge: "brushSize"
1452
+ };
1453
+ function parseArtisticPictureExtension(node) {
1454
+ if (node.namespaceURI !== NS.a || node.localName !== "extLst") return void 0;
1455
+ const found = [];
1456
+ const unhandled = [];
1457
+ const pending = [node];
1458
+ while (pending.length) {
1459
+ const item = pending.pop();
1460
+ if (item !== node && !(item.namespaceURI === NS.a && item.localName === "ext") && !(item.namespaceURI === "http://schemas.microsoft.com/office/drawing/2010/main" && (["imgProps", "imgLayer", "imgEffect", "useLocalDpi"].includes(item.localName) || ARTISTIC_PRIMARY_ATTRIBUTE[item.localName])))
1461
+ unhandled.push(item.localName);
1462
+ if (item.namespaceURI === "http://schemas.microsoft.com/office/drawing/2010/main" && item.localName.startsWith("artistic"))
1463
+ found.push(item);
1464
+ pending.push(...elements(item));
1465
+ }
1466
+ if (found.length !== 1) return void 0;
1467
+ const effect = found[0];
1468
+ const key = ARTISTIC_PRIMARY_ATTRIBUTE[effect.localName];
1469
+ if (!key) return void 0;
1470
+ const raw = key ? effect.getAttribute(key) : null;
1471
+ const n2 = raw === null ? 0 : Number(raw);
1472
+ if (!Number.isFinite(n2)) return void 0;
1473
+ return {
1474
+ kind: "artistic",
1475
+ name: effect.localName,
1476
+ radius: effect.localName === "artisticBlur" ? n2 : n2 / 1e3,
1477
+ baked: true,
1478
+ ...unhandled.length ? { unhandled } : {}
1479
+ };
1480
+ }
1481
+
1482
+ // drawingml/picture-standard-effects.ts
1483
+ var attrs = {
1484
+ biLevel: { threshold: "thresh" },
1485
+ alphaRepl: { amount: "a" },
1486
+ alphaBiLevel: { threshold: "thresh" },
1487
+ hsl: { hue: "hue", saturation: "sat", luminance: "lum" },
1488
+ tint: { hue: "hue", amount: "amt" },
1489
+ blur: { radiusEmu: "rad" }
1490
+ };
1491
+ function parseStandardPictureEffect(node) {
1492
+ const name = node.localName;
1493
+ if (![
1494
+ "biLevel",
1495
+ "alphaInv",
1496
+ "alphaCeiling",
1497
+ "alphaFloor",
1498
+ "alphaRepl",
1499
+ "alphaBiLevel",
1500
+ "alphaMod",
1501
+ "duotone",
1502
+ "clrRepl",
1503
+ "clrChange",
1504
+ "hsl",
1505
+ "tint",
1506
+ "blur"
1507
+ ].includes(name))
1508
+ return void 0;
1509
+ const values = {};
1510
+ for (const [key, attribute] of Object.entries(attrs[name] ?? {})) {
1511
+ const raw = node.getAttribute(attribute);
1512
+ if (raw === null) continue;
1433
1513
  const percent = raw.endsWith("%");
1434
- const value = Number(percent ? raw.slice(0, -1) : raw) / (percent ? 100 : 1e5);
1435
- if (Number.isFinite(value)) result[key] = value;
1514
+ const n2 = Number(percent ? raw.slice(0, -1) : raw) / (key === "hue" ? 6e4 : key === "radiusEmu" ? 1 : percent ? 100 : 1e5);
1515
+ if (!Number.isFinite(n2) || key === "hue" && (n2 < 0 || n2 >= 360) || key === "threshold" && (n2 < 0 || n2 > 1) || key === "radiusEmu" && (!Number.isSafeInteger(n2) || n2 < 0) || ["saturation", "luminance", "amount"].includes(key) && name !== "alphaMod" && (n2 < (name === "alphaRepl" ? 0 : -1) || n2 > 1))
1516
+ return void 0;
1517
+ values[key] = n2;
1436
1518
  }
1437
- return result;
1519
+ if (["biLevel", "alphaBiLevel"].includes(name) && values.threshold === void 0)
1520
+ return void 0;
1521
+ if (name === "alphaRepl" && values.amount === void 0) return void 0;
1522
+ if (name === "alphaMod") {
1523
+ const cont = first(node, "cont", NS.a);
1524
+ const nested = cont ? elements(cont) : [];
1525
+ if (nested.length !== 1 || nested[0]?.localName !== "alphaModFix") return void 0;
1526
+ const raw = nested[0].getAttribute("amt") ?? "100000";
1527
+ const n2 = Number(raw.endsWith("%") ? raw.slice(0, -1) : raw) / (raw.endsWith("%") ? 100 : 1e5);
1528
+ if (!Number.isFinite(n2) || n2 < 0) return void 0;
1529
+ values.amount = n2;
1530
+ }
1531
+ let colors = [];
1532
+ if (name === "duotone") {
1533
+ const candidates = elements(node).filter(
1534
+ (item) => item.namespaceURI === NS.a && /Clr$/.test(item.localName)
1535
+ );
1536
+ colors = candidates.map((item) => parseDrawingColor(item)).filter((item) => Boolean(item));
1537
+ if (colors.length !== 2) return void 0;
1538
+ }
1539
+ if (name === "clrRepl") {
1540
+ const color = parseDrawingColorIn(node);
1541
+ if (!color) return void 0;
1542
+ colors = [color];
1543
+ }
1544
+ if (name === "clrChange") {
1545
+ const from = parseDrawingColorIn(first(node, "clrFrom", NS.a)), to = parseDrawingColorIn(first(node, "clrTo", NS.a));
1546
+ if (!from || !to) return void 0;
1547
+ colors = [from, to];
1548
+ }
1549
+ if (name === "alphaInv") {
1550
+ const color = parseDrawingColorIn(node);
1551
+ if (color) colors = [color];
1552
+ }
1553
+ return {
1554
+ kind: "standard",
1555
+ name,
1556
+ ...Object.keys(values).length ? { values } : {},
1557
+ ...colors.length ? { colors } : {},
1558
+ ...name === "clrChange" && node.hasAttribute("useA") ? { useAlpha: !["0", "false"].includes(node.getAttribute("useA") ?? "") } : {},
1559
+ ...name === "blur" && node.hasAttribute("grow") ? { grow: !["0", "false"].includes(node.getAttribute("grow") ?? "") } : {}
1560
+ };
1438
1561
  }
1439
1562
 
1440
1563
  // drawingml/picture-effects.ts
@@ -1474,11 +1597,70 @@ function readPictureEffect(name, attribute) {
1474
1597
  function parsePictureEffects(blip) {
1475
1598
  if (!blip) return [];
1476
1599
  return elements(blip).map((node) => ({
1477
- ...(node.namespaceURI === NS.a ? readPictureEffect(node.localName, (name) => node.getAttribute(name)) : void 0) ?? { kind: "unsupported", name: node.localName },
1600
+ ...(node.namespaceURI === NS.a ? readPictureEffect(node.localName, (name) => node.getAttribute(name)) ?? parseStandardPictureEffect(node) ?? parseArtisticPictureExtension(node) : void 0) ?? { kind: "unsupported", name: node.localName },
1478
1601
  sourceXml: buildXml(node)
1479
1602
  }));
1480
1603
  }
1481
1604
 
1605
+ // drawingml/picture-layout.ts
1606
+ function parsePictureLayout(fill) {
1607
+ const out = {};
1608
+ const rot = fill.getAttribute("rotWithShape");
1609
+ if (rot !== null) out.rotWithShape = rot !== "0" && rot !== "false";
1610
+ const dpi = Number(fill.getAttribute("dpi"));
1611
+ if (fill.hasAttribute("dpi") && Number.isFinite(dpi) && dpi > 0) out.dpi = dpi;
1612
+ const tile = first(fill, "tile", NS.a);
1613
+ if (tile) {
1614
+ const value = {};
1615
+ for (const [key, attr3] of [
1616
+ ["scaleX", "sx"],
1617
+ ["scaleY", "sy"]
1618
+ ]) {
1619
+ const n2 = picturePercentage(tile.getAttribute(attr3));
1620
+ if (n2 !== void 0) value[key] = n2;
1621
+ }
1622
+ for (const [key, attr3] of [
1623
+ ["offsetXEmu", "tx"],
1624
+ ["offsetYEmu", "ty"]
1625
+ ]) {
1626
+ const raw = tile.getAttribute(attr3);
1627
+ const n2 = raw === null ? NaN : Number(raw);
1628
+ if (Number.isSafeInteger(n2)) value[key] = n2;
1629
+ }
1630
+ const alignment = tile.getAttribute("algn");
1631
+ if (alignment) value.alignment = alignment;
1632
+ const flip = tile.getAttribute("flip");
1633
+ if (flip && ["none", "x", "y", "xy"].includes(flip))
1634
+ value.flip = flip;
1635
+ out.tile = value;
1636
+ }
1637
+ const rect3 = first(first(fill, "stretch", NS.a), "fillRect", NS.a);
1638
+ if (rect3)
1639
+ out.fillRect = {
1640
+ l: picturePercentage(rect3.getAttribute("l")) ?? 0,
1641
+ t: picturePercentage(rect3.getAttribute("t")) ?? 0,
1642
+ r: picturePercentage(rect3.getAttribute("r")) ?? 0,
1643
+ b: picturePercentage(rect3.getAttribute("b")) ?? 0
1644
+ };
1645
+ return out;
1646
+ }
1647
+
1648
+ // drawingml/picture-crop.ts
1649
+ var SIDES = { l: "cropLeft", t: "cropTop", r: "cropRight", b: "cropBottom" };
1650
+ function parsePictureCrop(blipFill) {
1651
+ const rect3 = first(blipFill, "srcRect", NS.a);
1652
+ if (!rect3) return void 0;
1653
+ const result = {};
1654
+ for (const [attr3, key] of Object.entries(SIDES)) {
1655
+ const raw = rect3.getAttribute(attr3);
1656
+ if (raw === null || !raw.trim()) continue;
1657
+ const percent = raw.endsWith("%");
1658
+ const value = Number(percent ? raw.slice(0, -1) : raw) / (percent ? 100 : 1e5);
1659
+ if (Number.isFinite(value)) result[key] = value;
1660
+ }
1661
+ return result;
1662
+ }
1663
+
1482
1664
  // drawingml/picture-fill.ts
1483
1665
  function parseDrawingPictureFill(fill) {
1484
1666
  const blip = first(fill, "blip", NS.a);
@@ -1486,13 +1668,32 @@ function parseDrawingPictureFill(fill) {
1486
1668
  const linkRelId = blip?.getAttributeNS(NS.r, "link") || void 0;
1487
1669
  const crop = parsePictureCrop(fill);
1488
1670
  const effects = parsePictureEffects(blip);
1489
- const tile = first(fill, "tile", NS.a);
1490
- const rect3 = first(first(fill, "stretch", NS.a), "fillRect", NS.a);
1491
- const unsupported = [
1492
- ...tile ? ["tile"] : [],
1493
- ...rect3 && ["l", "t", "r", "b"].some((key) => Number(rect3.getAttribute(key) ?? 0) !== 0) ? ["fillRect"] : [],
1494
- ...fill.getAttribute("rotWithShape") === "0" || fill.getAttribute("rotWithShape") === "false" ? ["rotWithShape"] : []
1495
- ];
1671
+ const layout = parsePictureLayout(fill);
1672
+ const unsupported = [];
1673
+ const tile = first(fill, "tile", NS.a), stretch = first(fill, "stretch", NS.a);
1674
+ if (tile && stretch) unsupported.push("tile/stretch-choice");
1675
+ if (tile) {
1676
+ for (const [attr3, key] of [
1677
+ ["sx", "scaleX"],
1678
+ ["sy", "scaleY"],
1679
+ ["tx", "offsetXEmu"],
1680
+ ["ty", "offsetYEmu"]
1681
+ ])
1682
+ if (tile.hasAttribute(attr3) && (layout.tile?.[key] === void 0 || (attr3 === "sx" || attr3 === "sy") && layout.tile[key] <= 0))
1683
+ unsupported.push(`tile:${attr3}`);
1684
+ if (tile.hasAttribute("algn") && !["tl", "t", "tr", "l", "ctr", "r", "bl", "b", "br"].includes(tile.getAttribute("algn") ?? ""))
1685
+ unsupported.push("tile:algn");
1686
+ if (tile.hasAttribute("flip") && !layout.tile?.flip) unsupported.push("tile:flip");
1687
+ }
1688
+ const rect3 = first(stretch, "fillRect", NS.a);
1689
+ if (rect3)
1690
+ for (const key of ["l", "t", "r", "b"]) {
1691
+ const raw = rect3.getAttribute(key);
1692
+ if (raw !== null && !/^[-+]?(?:\d+\.?\d*|\.\d+)%?$/.test(raw))
1693
+ unsupported.push(`fillRect:${key}`);
1694
+ }
1695
+ if (fill.hasAttribute("rotWithShape") && !["0", "1", "true", "false"].includes(fill.getAttribute("rotWithShape") ?? ""))
1696
+ unsupported.push("rotWithShape");
1496
1697
  return {
1497
1698
  kind: "picture",
1498
1699
  sourceXml: buildXml(fill),
@@ -1500,6 +1701,7 @@ function parseDrawingPictureFill(fill) {
1500
1701
  ...linkRelId ? { linkRelId } : {},
1501
1702
  ...crop ? { crop } : {},
1502
1703
  ...effects.length ? { effects } : {},
1704
+ ...Object.keys(layout).length ? { layout } : {},
1503
1705
  ...unsupported.length ? { unsupportedPicture: unsupported } : {}
1504
1706
  };
1505
1707
  }
@@ -1773,16 +1975,16 @@ function escapeXmlAttr(value) {
1773
1975
 
1774
1976
  // docx/element-order.ts
1775
1977
  function orderChildren(parent, order) {
1776
- const elements2 = Array.from(parent.childNodes).filter(isElement);
1978
+ const elements3 = Array.from(parent.childNodes).filter(isElement);
1777
1979
  const rankOf = (name) => order.findIndex((entry) => typeof entry === "string" ? entry === name : entry.includes(name));
1778
1980
  let previousRank = -1;
1779
- const ranked = elements2.map((element, index) => {
1981
+ const ranked = elements3.map((element, index) => {
1780
1982
  const rank = element.namespaceURI === WORD_NS ? rankOf(element.localName ?? "") : -1;
1781
1983
  if (rank >= 0) previousRank = rank;
1782
1984
  return { element, index, rank: rank >= 0 ? rank : previousRank + 0.5 };
1783
1985
  });
1784
1986
  const sorted = [...ranked].sort((a, b) => a.rank - b.rank || a.index - b.index);
1785
- if (sorted.every((entry, index) => entry.element === elements2[index])) return;
1987
+ if (sorted.every((entry, index) => entry.element === elements3[index])) return;
1786
1988
  for (const { element } of sorted) parent.appendChild(element);
1787
1989
  }
1788
1990
 
@@ -1859,16 +2061,16 @@ function tableGrid(table) {
1859
2061
  const cells = table.rows[row2] ?? [];
1860
2062
  if (!cells.length || sumSpans(cells) !== columns) return void 0;
1861
2063
  const placed2 = [];
1862
- const line3 = new Array(columns);
2064
+ const line4 = new Array(columns);
1863
2065
  let col = 0;
1864
2066
  cells.forEach((cell, index) => {
1865
2067
  const entry = { cell, row: row2, index, col, span: spanOf(cell) };
1866
- for (let k = 0; k < entry.span; k++) line3[col + k] = entry;
2068
+ for (let k = 0; k < entry.span; k++) line4[col + k] = entry;
1867
2069
  col += entry.span;
1868
2070
  placed2.push(entry);
1869
2071
  });
1870
2072
  rows2.push(placed2);
1871
- cover.push(line3);
2073
+ cover.push(line4);
1872
2074
  }
1873
2075
  const grid = { columns, rows: rows2, cover };
1874
2076
  for (const entry of rows2.flat())
@@ -12388,6 +12590,24 @@ function computeHierarchicalSunburstArcs(categoryLevels, values, cx, cy, maxR) {
12388
12590
  return out;
12389
12591
  }
12390
12592
 
12593
+ // chart/style-palette.ts
12594
+ function hexToRgb3(hex) {
12595
+ const h = hex.replace("#", "");
12596
+ return [
12597
+ parseInt(h.substring(0, 2), 16),
12598
+ parseInt(h.substring(2, 4), 16),
12599
+ parseInt(h.substring(4, 6), 16)
12600
+ ];
12601
+ }
12602
+ function rgbToHex(r, g, b) {
12603
+ const clamp3 = (v) => Math.max(0, Math.min(255, Math.round(v)));
12604
+ return `#${clamp3(r).toString(16).padStart(2, "0")}${clamp3(g).toString(16).padStart(2, "0")}${clamp3(b).toString(16).padStart(2, "0")}`;
12605
+ }
12606
+ function shade(hex, amount) {
12607
+ const [r, g, b] = hexToRgb3(hex);
12608
+ return rgbToHex(r * (1 - amount), g * (1 - amount), b * (1 - amount));
12609
+ }
12610
+
12391
12611
  // chart/histogram-binning.ts
12392
12612
  function binLabel(lower, upper, closed, format) {
12393
12613
  return closed === "r" ? `(${format(lower)}, ${format(upper)}]` : `[${format(lower)}, ${format(upper)})`;
@@ -12894,11 +13114,11 @@ function resolveChartStyleDefinition(style, resolve) {
12894
13114
  const value = source[key];
12895
13115
  if (value !== void 0) Object.assign(entry, { [key]: value });
12896
13116
  }
12897
- const line3 = fillColor(source.line?.fill) ?? (source.lineRef?.color && resolve(source.lineRef.color));
13117
+ const line4 = fillColor(source.line?.fill) ?? (source.lineRef?.color && resolve(source.lineRef.color));
12898
13118
  const fill = fillColor(source.fill) ?? (source.fillRef?.color && resolve(source.fillRef.color));
12899
13119
  const color = (source.textColor && resolve(source.textColor)) ?? (source.fontRef?.color && resolve(source.fontRef.color));
12900
13120
  if (color !== void 0) entry.color = color;
12901
- if (line3 !== void 0) entry.lineColor = line3;
13121
+ if (line4 !== void 0) entry.lineColor = line4;
12902
13122
  if (fill !== void 0) entry.fillColor = fill;
12903
13123
  if (source.line?.widthEmu !== void 0 && source.line.widthEmu > 0)
12904
13124
  entry.lineWidth = source.line.widthEmu / 12700;
@@ -13044,10 +13264,10 @@ function buildChartGradientDef(id, fill, bounds) {
13044
13264
  stops
13045
13265
  };
13046
13266
  }
13047
- const rad = (fill.angle ?? 0) * Math.PI / 180;
13048
- const span = fill.scaled ? Math.abs(Math.cos(rad)) + Math.abs(Math.sin(rad)) : 1;
13049
- const dx = Math.cos(rad) * span / 2;
13050
- const dy = Math.sin(rad) * span / 2;
13267
+ const rad2 = (fill.angle ?? 0) * Math.PI / 180;
13268
+ const span = fill.scaled ? Math.abs(Math.cos(rad2)) + Math.abs(Math.sin(rad2)) : 1;
13269
+ const dx = Math.cos(rad2) * span / 2;
13270
+ const dy = Math.sin(rad2) * span / 2;
13051
13271
  const round3 = (value) => Math.round(value * 1e4) / 1e4;
13052
13272
  return {
13053
13273
  kind: "linearGradient",
@@ -13162,23 +13382,23 @@ function buildMarkerPrimitive(input) {
13162
13382
  return null;
13163
13383
  }
13164
13384
  const r = markerRadius(input.size, input.defaultRadius);
13165
- const outline = input.stroke ? {
13385
+ const outline2 = input.stroke ? {
13166
13386
  stroke: input.stroke,
13167
13387
  strokeWidth: input.strokeWidth ?? DEFAULT_MARKER_OUTLINE_PT * CHART_PX_PER_PT
13168
13388
  } : void 0;
13169
- const polygonStroke = outline ?? { stroke: fill, strokeWidth: 0 };
13389
+ const polygonStroke = outline2 ?? { stroke: fill, strokeWidth: 0 };
13170
13390
  const lineStroke = input.stroke ?? fill;
13171
13391
  switch (symbol) {
13172
13392
  case "square":
13173
13393
  case "dash": {
13174
13394
  const h = symbol === "dash" ? r * 0.64 : r * 2;
13175
13395
  const y = cy - h / 2;
13176
- if (outline) {
13396
+ if (outline2) {
13177
13397
  return {
13178
13398
  kind: "polygon",
13179
13399
  points: rectPolygon(cx - r, y, r * 2, h),
13180
13400
  fill,
13181
- ...outline,
13401
+ ...outline2,
13182
13402
  ...part
13183
13403
  };
13184
13404
  }
@@ -13236,9 +13456,9 @@ function buildMarkerPrimitive(input) {
13236
13456
  ...part
13237
13457
  };
13238
13458
  case "dot":
13239
- return { kind: "circle", cx, cy, r: Math.max(r * 0.6, 1), fill, ...part, ...outline };
13459
+ return { kind: "circle", cx, cy, r: Math.max(r * 0.6, 1), fill, ...part, ...outline2 };
13240
13460
  default:
13241
- return { kind: "circle", cx, cy, r, fill, ...part, ...outline };
13461
+ return { kind: "circle", cx, cy, r, fill, ...part, ...outline2 };
13242
13462
  }
13243
13463
  }
13244
13464
 
@@ -13515,6 +13735,18 @@ function chartSummaryFromSpace(chartSpace, extras = {}) {
13515
13735
  showNegativeBubbles: group2.showNegativeBubbles === true
13516
13736
  };
13517
13737
  }
13738
+ if (group2?.is3D) {
13739
+ const v = chartSpace.view3D;
13740
+ summary.view3D = {
13741
+ ...v?.rotX === void 0 ? {} : { rotX: v.rotX },
13742
+ ...v?.rotY === void 0 ? {} : { rotY: v.rotY },
13743
+ ...v?.perspective === void 0 ? {} : { perspective: v.perspective },
13744
+ ...v?.rightAngleAxes === void 0 ? {} : { rAngAx: v.rightAngleAxes },
13745
+ ...v?.depthPercent === void 0 ? {} : { depthPercent: v.depthPercent },
13746
+ ...v?.heightPercent === void 0 ? {} : { hPercent: v.heightPercent },
13747
+ ...group2.gapDepth === void 0 ? {} : { gapDepth: group2.gapDepth }
13748
+ };
13749
+ }
13518
13750
  const grouping = group2?.grouping;
13519
13751
  if (grouping && GROUPINGS.has(grouping))
13520
13752
  summary.grouping = grouping;
@@ -13542,17 +13774,6 @@ function chartSummaryFromSpace(chartSpace, extras = {}) {
13542
13774
  return summary;
13543
13775
  }
13544
13776
 
13545
- // chart/funnel-geometry.ts
13546
- function computeFunnelGeometry(values, plot) {
13547
- const max = Math.max(...values.map((v) => Math.abs(v)), 1);
13548
- const height = plot.height / Math.max(1, values.length);
13549
- const center = plot.x + plot.width / 2;
13550
- return values.map((value, index) => {
13551
- const width = Math.abs(value) / max * plot.width;
13552
- return { index, x: center - width / 2, y: plot.y + index * height, width, height, center };
13553
- });
13554
- }
13555
-
13556
13777
  // chart/render/theme-palette.ts
13557
13778
  var THEME_SLOTS = [
13558
13779
  "lt1",
@@ -13693,6 +13914,266 @@ function chartAppearance(chart, theme) {
13693
13914
  return out;
13694
13915
  }
13695
13916
 
13917
+ // chart/render/chart-title-text.ts
13918
+ function chartRunStyle(run) {
13919
+ return {
13920
+ ...run.sizePt === void 0 ? {} : { fontSize: run.sizePt },
13921
+ ...run.bold === void 0 ? {} : { bold: run.bold },
13922
+ ...run.italic === void 0 ? {} : { italic: run.italic },
13923
+ ...run.underline === void 0 ? {} : { underline: run.underline },
13924
+ ...run.typeface === void 0 ? {} : { typeface: run.typeface },
13925
+ ...run.color === void 0 ? {} : { textColor: run.color }
13926
+ };
13927
+ }
13928
+ function chartTitleText(chart, theme) {
13929
+ const formatting = chart.formatting;
13930
+ const entry = formatting?.entries.title;
13931
+ const body = entry?.textBody;
13932
+ if (!formatting || !body || body.text !== chart.title) return void 0;
13933
+ if (body.paragraphs.length === 1 && body.paragraphs[0].runs.length <= 1 && !body.text.includes("\n") && !body.paragraphs[0].lineSpacing && !body.paragraphs[0].spaceBefore && !body.paragraphs[0].spaceAfter)
13934
+ return void 0;
13935
+ return {
13936
+ paragraphs: body.paragraphs.map((paragraph) => ({
13937
+ ...paragraph.align ? { align: paragraph.align } : {},
13938
+ ...paragraph.lineSpacing ? { lineSpacing: paragraph.lineSpacing } : {},
13939
+ ...paragraph.spaceBefore ? { spaceBefore: paragraph.spaceBefore } : {},
13940
+ ...paragraph.spaceAfter ? { spaceAfter: paragraph.spaceAfter } : {},
13941
+ runs: paragraph.runs.map((run) => {
13942
+ const direct = {
13943
+ sourceXml: "",
13944
+ ...entry.textBodyStyle,
13945
+ ...chartRunStyle(paragraph.defaultProperties ?? {}),
13946
+ ...chartRunStyle(run)
13947
+ };
13948
+ const appearance = chartAppearance(
13949
+ {
13950
+ ...chart,
13951
+ formatting: { ...formatting, entries: { ...formatting.entries, title: direct } }
13952
+ },
13953
+ theme
13954
+ )?.title ?? {};
13955
+ return { text: run.text, appearance };
13956
+ })
13957
+ }))
13958
+ };
13959
+ }
13960
+
13961
+ // chart/render/chart-3d-camera.ts
13962
+ var OBLIQUE_DEPTH_SCALE = 0.5;
13963
+ var rad = (deg) => deg * Math.PI / 180;
13964
+ function fitTransform(raw, size, fit2) {
13965
+ const xs = [];
13966
+ const ys = [];
13967
+ for (const x of [0, size.w])
13968
+ for (const y of [0, size.h])
13969
+ for (const z of [0, size.d]) {
13970
+ const q = raw([x, y, z]);
13971
+ xs.push(q.x);
13972
+ ys.push(q.y);
13973
+ }
13974
+ const minX = Math.min(...xs);
13975
+ const maxX = Math.max(...xs);
13976
+ const minY = Math.min(...ys);
13977
+ const maxY = Math.max(...ys);
13978
+ const scale = Math.min(fit2.w / Math.max(1e-6, maxX - minX), fit2.h / Math.max(1e-6, maxY - minY));
13979
+ return {
13980
+ scale,
13981
+ ox: fit2.x + (fit2.w - (maxX - minX) * scale) / 2 - minX * scale,
13982
+ oy: fit2.y + (fit2.h - (maxY - minY) * scale) / 2 + maxY * scale
13983
+ };
13984
+ }
13985
+ function createChart3DCamera(projection, size, fit2) {
13986
+ if (projection.mode === "oblique") {
13987
+ const kx = projection.shearX * OBLIQUE_DEPTH_SCALE;
13988
+ const ky = projection.shearY * OBLIQUE_DEPTH_SCALE;
13989
+ const raw2 = (p) => ({ x: p[0] + p[2] * kx, y: p[1] - p[2] * ky });
13990
+ const t2 = fitTransform(raw2, size, fit2);
13991
+ return {
13992
+ project: (p) => {
13993
+ const q = raw2(p);
13994
+ return { x: t2.ox + q.x * t2.scale, y: t2.oy - q.y * t2.scale, depth: p[2] };
13995
+ },
13996
+ viewDir: () => [-kx, ky, 1],
13997
+ eye: void 0,
13998
+ order: (a, b) => b[2] - a[2] || (projection.shearX >= 0 ? a[0] - b[0] : b[0] - a[0]) || (projection.shearY <= 0 ? a[1] - b[1] : b[1] - a[1]),
13999
+ sideWallAtZero: projection.shearX >= 0
14000
+ };
14001
+ }
14002
+ const cx = size.w / 2;
14003
+ const cy = size.h / 2;
14004
+ const cz = size.d / 2;
14005
+ const [cosY, sinY] = [Math.cos(rad(projection.rotYDeg)), Math.sin(rad(projection.rotYDeg))];
14006
+ const [cosX, sinX] = [Math.cos(rad(projection.rotXDeg)), Math.sin(rad(projection.rotXDeg))];
14007
+ const radius = Math.hypot(size.w, size.h, size.d) / 2;
14008
+ const dist = radius / Math.tan(rad(projection.fovDeg) / 2);
14009
+ const rotate = (p) => {
14010
+ const x = p[0] - cx;
14011
+ const y = p[1] - cy;
14012
+ const z = p[2] - cz;
14013
+ const x1 = x * cosY + z * sinY;
14014
+ const z1 = -x * sinY + z * cosY;
14015
+ return [x1, y * cosX + z1 * sinX, -y * sinX + z1 * cosX];
14016
+ };
14017
+ const raw = (p) => {
14018
+ const r = rotate(p);
14019
+ const s = dist / (dist + r[2]);
14020
+ return { x: r[0] * s, y: r[1] * s, depth: r[2] };
14021
+ };
14022
+ const t = fitTransform(raw, size, fit2);
14023
+ const ey = dist * sinX;
14024
+ const ez1 = -dist * cosX;
14025
+ const eyeX = cx - ez1 * sinY;
14026
+ const eye = [eyeX, cy + ey, cz + ez1 * cosY];
14027
+ return {
14028
+ project: (p) => {
14029
+ const q = raw(p);
14030
+ return { x: t.ox + q.x * t.scale, y: t.oy - q.y * t.scale, depth: q.depth };
14031
+ },
14032
+ viewDir: (p) => [p[0] - eye[0], p[1] - eye[1], p[2] - eye[2]],
14033
+ eye,
14034
+ order: (a, b) => {
14035
+ const da = (a[0] - eyeX) ** 2 + (a[1] - eye[1]) ** 2 + (a[2] - eye[2]) ** 2;
14036
+ const db = (b[0] - eyeX) ** 2 + (b[1] - eye[1]) ** 2 + (b[2] - eye[2]) ** 2;
14037
+ return db - da;
14038
+ },
14039
+ sideWallAtZero: eyeX > cx
14040
+ };
14041
+ }
14042
+
14043
+ // chart/render/chart-spacing.ts
14044
+ function chartBarSpacing(chart) {
14045
+ const stacked = chart.grouping === "stacked" || chart.grouping === "percentStacked";
14046
+ return {
14047
+ barGapWidth: chart.barGapWidth ?? DEFAULT_BAR_GAP_WIDTH,
14048
+ barOverlap: chart.barOverlap ?? (stacked ? 100 : 0)
14049
+ };
14050
+ }
14051
+
14052
+ // chart/render/chart-3d-layout.ts
14053
+ var DEFAULT_GAP_DEPTH = 150;
14054
+ var clamp = (v, lo, hi) => Math.min(Math.max(v, lo), hi);
14055
+ function chart3DSeriesInDepth(model) {
14056
+ return model.type === "surface" || model.grouping === "standard";
14057
+ }
14058
+ function chart3DLayout(model, inner, view) {
14059
+ const horizontal = model.horizontal;
14060
+ const w = Math.max(1, inner.w);
14061
+ const h = Math.max(
14062
+ 1,
14063
+ inner.h * (view.hPercent !== void 0 ? clamp(view.hPercent, 5, 500) / 100 : 1)
14064
+ );
14065
+ const catLength = horizontal ? h : w;
14066
+ const valueLength = horizontal ? w : h;
14067
+ const cats = Math.max(1, model.categories.length);
14068
+ const band = catLength / cats;
14069
+ const rows2 = chart3DSeriesInDepth(model) ? Math.max(1, model.series.length) : 1;
14070
+ const isBar = model.type === "bar" || model.type === "column";
14071
+ const clustered = isBar && model.grouping === "clustered";
14072
+ const bars2 = isBar ? clusteredBarGeometry(
14073
+ band,
14074
+ clustered ? Math.max(1, model.series.length) : 1,
14075
+ chartBarSpacing(model)
14076
+ ) : void 0;
14077
+ const depthScale = clamp(view.depthPercent ?? 100, 20, 2e3) / 100;
14078
+ const gap = clamp(view.gapDepth ?? DEFAULT_GAP_DEPTH, 0, 500) / 100;
14079
+ const wanted = (bars2?.singleBarWidth ?? band * 0.5) * depthScale;
14080
+ const wantedCell = rows2 === 1 ? wanted * 1.5 : wanted * (1 + gap);
14081
+ const depth = Math.min(rows2 * wantedCell, Math.max(w, h) * 0.9);
14082
+ const cell = depth / rows2;
14083
+ const scale = model.valueAxis;
14084
+ const span = scale ? scale.max - scale.min || 1 : 1;
14085
+ return {
14086
+ size: { w, h, d: depth },
14087
+ horizontal,
14088
+ catLength,
14089
+ valueLength,
14090
+ band,
14091
+ rows: rows2,
14092
+ cell,
14093
+ markDepth: rows2 === 1 ? cell / 1.5 : cell / (1 + gap),
14094
+ bars: bars2,
14095
+ value: (v) => (v - (scale?.min ?? 0)) / span * valueLength || 0,
14096
+ rowZ: (r) => {
14097
+ const mark = rows2 === 1 ? cell / 1.5 : cell / (1 + gap);
14098
+ const z0 = r * cell + (cell - mark) / 2;
14099
+ return [z0, z0 + mark];
14100
+ }
14101
+ };
14102
+ }
14103
+
14104
+ // chart/render/chart-3d-mesh.ts
14105
+ function faceKind(n2) {
14106
+ const [x, y, z] = n2;
14107
+ if (Math.abs(y) >= Math.abs(x) && Math.abs(y) >= Math.abs(z)) return y >= 0 ? "top" : "bottom";
14108
+ if (Math.abs(x) >= Math.abs(z)) return x >= 0 ? "right" : "left";
14109
+ return z < 0 ? "front" : "back";
14110
+ }
14111
+ function signedArea(outline2) {
14112
+ let sum = 0;
14113
+ for (let i = 0; i < outline2.length; i++) {
14114
+ const [x0, y0] = outline2[i];
14115
+ const [x1, y1] = outline2[(i + 1) % outline2.length];
14116
+ sum += x0 * y1 - x1 * y0;
14117
+ }
14118
+ return sum / 2;
14119
+ }
14120
+ function extrudeMesh(outline2, z0, z1, meta) {
14121
+ if (outline2.length < 3 || Math.abs(signedArea(outline2)) < 1e-6) return void 0;
14122
+ const ccw = signedArea(outline2) > 0 ? [...outline2] : [...outline2].reverse();
14123
+ const faces = [
14124
+ { pts: ccw.map(([x, y]) => [x, y, z0]), normal: [0, 0, -1], kind: "front" },
14125
+ { pts: ccw.map(([x, y]) => [x, y, z1]), normal: [0, 0, 1], kind: "back" }
14126
+ ];
14127
+ for (let i = 0; i < ccw.length; i++) {
14128
+ const [ax, ay] = ccw[i];
14129
+ const [bx, by] = ccw[(i + 1) % ccw.length];
14130
+ const dx = bx - ax;
14131
+ const dy = by - ay;
14132
+ const len = Math.hypot(dx, dy);
14133
+ if (len < 1e-9) continue;
14134
+ const normal = [dy / len, -dx / len, 0];
14135
+ faces.push({
14136
+ pts: [
14137
+ [ax, ay, z0],
14138
+ [bx, by, z0],
14139
+ [bx, by, z1],
14140
+ [ax, ay, z1]
14141
+ ],
14142
+ normal,
14143
+ kind: faceKind(normal)
14144
+ });
14145
+ }
14146
+ const xs = ccw.map((p) => p[0]);
14147
+ const ys = ccw.map((p) => p[1]);
14148
+ const center = [
14149
+ (Math.min(...xs) + Math.max(...xs)) / 2,
14150
+ (Math.min(...ys) + Math.max(...ys)) / 2,
14151
+ (z0 + z1) / 2
14152
+ ];
14153
+ return { ...meta, center, faces };
14154
+ }
14155
+ function boxMesh(x0, x1, y0, y1, z0, z1, meta) {
14156
+ return extrudeMesh(
14157
+ [
14158
+ [Math.min(x0, x1), Math.min(y0, y1)],
14159
+ [Math.max(x0, x1), Math.min(y0, y1)],
14160
+ [Math.max(x0, x1), Math.max(y0, y1)],
14161
+ [Math.min(x0, x1), Math.max(y0, y1)]
14162
+ ],
14163
+ Math.min(z0, z1),
14164
+ Math.max(z0, z1),
14165
+ meta
14166
+ );
14167
+ }
14168
+
14169
+ // chart/data-table-layout.ts
14170
+ function chartDataTableMetrics(fontSize, names, showKeys = true) {
14171
+ const rowH = Math.max(14, Math.round(fontSize * 1.45));
14172
+ const longestName = names.reduce((m, name) => Math.max(m, name.length), 0);
14173
+ const keyW = Math.min(160, Math.max(40, longestName * fontSize * 0.55 + (showKeys ? 24 : 8)));
14174
+ return { fontSize, rowH, keyW, height: rowH * (1 + names.length) };
14175
+ }
14176
+
13696
14177
  // chart/render/chart-svg-util.ts
13697
14178
  var TEXT_COLOR = "#595959";
13698
14179
  var GRID_COLOR = "#D9D9D9";
@@ -13703,18 +14184,18 @@ function esc(text2) {
13703
14184
  }
13704
14185
  var n = (value) => String(Math.round(value * 100) / 100);
13705
14186
  var textWidth = (text2, size = FONT_SIZE) => text2.length * size * 0.55;
13706
- function text(x, y, content, attrs = {}) {
14187
+ function text(x, y, content, attrs2 = {}) {
13707
14188
  const parts = [`x="${n(x)}"`, `y="${n(y)}"`];
13708
- parts.push(`font-size="${attrs.size ?? FONT_SIZE}"`);
13709
- parts.push(`fill="${esc(attrs.fill ?? TEXT_COLOR)}"`);
13710
- if (attrs.anchor && attrs.anchor !== "start") parts.push(`text-anchor="${attrs.anchor}"`);
13711
- if (attrs.weight) parts.push(`font-weight="${attrs.weight}"`);
13712
- if (attrs.baseline) parts.push(`dominant-baseline="${attrs.baseline}"`);
13713
- if (attrs.family) parts.push(`font-family="${esc(attrs.family)}"`);
13714
- if (attrs.filter) parts.push(`filter="${esc(attrs.filter)}"`);
13715
- if (attrs.italic !== void 0) parts.push(`font-style="${attrs.italic ? "italic" : "normal"}"`);
13716
- if (attrs.underline !== void 0)
13717
- parts.push(`text-decoration="${attrs.underline ? "underline" : "none"}"`);
14189
+ parts.push(`font-size="${attrs2.size ?? FONT_SIZE}"`);
14190
+ parts.push(`fill="${esc(attrs2.fill ?? TEXT_COLOR)}"`);
14191
+ if (attrs2.anchor && attrs2.anchor !== "start") parts.push(`text-anchor="${attrs2.anchor}"`);
14192
+ if (attrs2.weight) parts.push(`font-weight="${attrs2.weight}"`);
14193
+ if (attrs2.baseline) parts.push(`dominant-baseline="${attrs2.baseline}"`);
14194
+ if (attrs2.family) parts.push(`font-family="${esc(attrs2.family)}"`);
14195
+ if (attrs2.filter) parts.push(`filter="${esc(attrs2.filter)}"`);
14196
+ if (attrs2.italic !== void 0) parts.push(`font-style="${attrs2.italic ? "italic" : "normal"}"`);
14197
+ if (attrs2.underline !== void 0)
14198
+ parts.push(`text-decoration="${attrs2.underline ? "underline" : "none"}"`);
13718
14199
  return `<text ${parts.join(" ")}>${esc(content)}</text>`;
13719
14200
  }
13720
14201
  var line2 = (x1, y1, x2, y2, stroke, width = 1) => `<line x1="${n(x1)}" y1="${n(y1)}" x2="${n(x2)}" y2="${n(y2)}" stroke="${stroke}" stroke-width="${width}"/>`;
@@ -13830,179 +14311,30 @@ function chartAreaRect(model, part, area) {
13830
14311
  return `${defs}<rect x="${n(area.x)}" y="${n(area.y)}" width="${n(area.w)}" height="${n(area.h)}" fill="${esc(fill)}" stroke="${esc(stroke)}" stroke-width="${n(width)}" data-chart-part="${part}"/>`;
13831
14312
  }
13832
14313
 
13833
- // chart/render/chart-svg-funnel.ts
13834
- function funnelSvg(model, area) {
13835
- const series = model.series[0];
13836
- if (!series || series.hidden) return "";
13837
- const attrs = chartTextAttributes(model, "categoryAxis", 10);
13838
- const width = Math.min(
13839
- area.w * 0.3,
13840
- Math.max(32, ...model.categories.map((s) => s.length * (attrs.size ?? 10) * 0.55 + 8))
13841
- );
13842
- const plot = { x: area.x + width, y: area.y, width: Math.max(1, area.w - width), height: area.h };
13843
- const out = [
13844
- chartAreaRect(model, "plotArea", { x: plot.x, y: plot.y, w: plot.width, h: plot.height })
13845
- ];
13846
- for (const bar of computeFunnelGeometry(
13847
- series.values.map((v) => v ?? 0),
13848
- plot
13849
- )) {
13850
- const value = series.values[bar.index];
13851
- if (value === null || value === void 0) continue;
13852
- out.push(`<g data-chart-series="${series.sourceIndex ?? 0}" data-chart-point="${bar.index}">`);
13853
- out.push(
13854
- rect2(bar.x, bar.y, bar.width, bar.height, series.pointColors?.[bar.index] ?? series.color)
13855
- );
13856
- const size = Math.min(10, bar.height * 0.4);
13857
- const label = series.labels?.[bar.index];
13858
- if (label)
13859
- out.push(
13860
- text(bar.center, bar.y + bar.height / 2 + size * 0.35, label.text, {
13861
- ...chartTextAttributes(model, "dataLabel", size),
13862
- size,
13863
- anchor: "middle"
13864
- })
13865
- );
13866
- out.push(
13867
- text(
13868
- plot.x - 8,
13869
- bar.y + bar.height / 2 + (attrs.size ?? 10) * 0.35,
13870
- fit(model.categories[bar.index] ?? "", width - 8, attrs.size ?? 10),
13871
- { ...attrs, anchor: "end" }
13872
- )
13873
- );
13874
- out.push("</g>");
13875
- }
13876
- return out.join("");
13877
- }
13878
-
13879
- // chart/box-distribution.ts
13880
- function boxWhiskerDistribution(values, method = "exclusive", trimOutliers = false) {
13881
- const stats = computeBoxStats(values, method);
13882
- if (!stats) return void 0;
13883
- const iqr = stats.q3 - stats.q1;
13884
- const lowerFence = stats.q1 - 1.5 * iqr;
13885
- const upperFence = stats.q3 + 1.5 * iqr;
13886
- const inliers = values.filter((v) => !trimOutliers || v >= lowerFence && v <= upperFence);
14314
+ // chart/render/chart-svg-labels.ts
14315
+ var GAP = 3;
14316
+ var LINE = 1.2;
14317
+ var NAMED_COLORS = /^(black|blue|cyan|green|magenta|red|white|yellow)$/iu;
14318
+ function measure(model, label) {
14319
+ const attrs2 = chartTextAttributes(model, "dataLabel", 10);
14320
+ const size = attrs2.size ?? 10;
14321
+ const lines = label.text.split("\n");
13887
14322
  return {
13888
- stats,
13889
- whiskerMin: inliers.length ? Math.min(...inliers) : stats.min,
13890
- whiskerMax: inliers.length ? Math.max(...inliers) : stats.max,
13891
- mean: values.reduce((a, b) => a + b, 0) / values.length
14323
+ ...model.frameSize ? { frame: model.frameSize } : {},
14324
+ lines,
14325
+ size,
14326
+ w: Math.max(...lines.map((l) => textWidth(l, size))),
14327
+ h: lines.length * size * LINE,
14328
+ attrs: attrs2
13892
14329
  };
13893
14330
  }
13894
- function boxMeanMarkerPath(x, y, radius = 3) {
13895
- return `M${x - radius},${y - radius} L${x + radius},${y + radius} M${x - radius},${y + radius} L${x + radius},${y - radius}`;
13896
- }
13897
-
13898
- // chart/render/chart-svg-box.ts
13899
- function boxWhiskerSvg(model, frame2, out) {
13900
- const visible = model.series.filter((s) => !s.hidden);
13901
- const slot = frame2.bandSize / Math.max(1, visible.length);
13902
- const width = slot * 0.7;
13903
- visible.forEach((series, si) => {
13904
- if (series.hidden) return;
13905
- const groups = groupRowsByCategory(series.boxCategories ?? []);
13906
- model.categories.forEach((category, ci) => {
13907
- const observations = (groups.rowIndexesByCategory.get(category) ?? []).flatMap((row2) => {
13908
- const value = series.values[row2];
13909
- return value === null || value === void 0 ? [] : [{ row: row2, value }];
13910
- });
13911
- const options2 = series.boxWhisker;
13912
- const rawMethod = options2?.statistics?.quartileMethod;
13913
- const method = rawMethod === "inclusive" ? "inclusive" : "exclusive";
13914
- const visibility = options2?.visibility;
13915
- const trim = rawMethod === "inclusive" || rawMethod === "exclusive" || !!visibility && Object.values(visibility).some((v) => v !== void 0);
13916
- const distribution = boxWhiskerDistribution(
13917
- observations.map((p) => p.value),
13918
- method,
13919
- trim
13920
- );
13921
- if (!distribution) return;
13922
- const { stats, whiskerMin, whiskerMax, mean } = distribution;
13923
- const x = frame2.band(ci) - frame2.bandSize / 2 + si * slot + (slot - width) / 2;
13924
- const mid = x + width / 2;
13925
- const y = frame2.value;
13926
- out.push(
13927
- `<g data-chart-part="box" data-chart-series="${series.sourceIndex ?? si}" data-chart-point="${ci}">`
13928
- );
13929
- out.push(line2(mid, y(whiskerMax), mid, y(stats.q3), "#64748b", 1));
13930
- out.push(line2(mid, y(stats.q1), mid, y(whiskerMin), "#64748b", 1));
13931
- out.push(
13932
- line2(x + width * 0.25, y(whiskerMin), x + width * 0.75, y(whiskerMin), "#64748b", 1)
13933
- );
13934
- out.push(
13935
- line2(x + width * 0.25, y(whiskerMax), x + width * 0.75, y(whiskerMax), "#64748b", 1)
13936
- );
13937
- out.push(
13938
- rect2(
13939
- x,
13940
- Math.min(y(stats.q1), y(stats.q3)),
13941
- width,
13942
- Math.abs(y(stats.q1) - y(stats.q3)),
13943
- series.pointColors?.[ci] ?? series.color
13944
- )
13945
- );
13946
- out.push(line2(x, y(stats.median), x + width, y(stats.median), "#1e293b", 2));
13947
- if (visibility?.meanLine) out.push(line2(x, y(mean), x + width, y(mean), "#0f766e", 1.5));
13948
- if (visibility?.meanMarker !== false)
13949
- out.push(
13950
- `<path d="${boxMeanMarkerPath(mid, y(mean))}" fill="none" stroke="#0f766e" stroke-width="1.5" data-chart-part="mean"/>`
13951
- );
13952
- observations.forEach((point, index) => {
13953
- const outlier = point.value < whiskerMin || point.value > whiskerMax;
13954
- if (outlier ? !visibility?.outliers : !visibility?.nonoutliers) return;
13955
- const px = x + width * (0.2 + 0.6 * (index + 1) / (observations.length + 1));
13956
- out.push(
13957
- `<circle cx="${n(px)}" cy="${n(y(point.value))}" r="2.25" fill="${outlier ? "#dc2626" : "#1e293b"}" data-chart-series="${series.sourceIndex ?? si}" data-chart-point="${point.row}" data-chart-part="${outlier ? "outlier" : "observation"}"/>`
13958
- );
13959
- });
13960
- out.push("</g>");
13961
- });
13962
- });
13963
- }
13964
-
13965
- // chart/data-table-layout.ts
13966
- function chartDataTableMetrics(fontSize, names, showKeys = true) {
13967
- const rowH = Math.max(14, Math.round(fontSize * 1.45));
13968
- const longestName = names.reduce((m, name) => Math.max(m, name.length), 0);
13969
- const keyW = Math.min(160, Math.max(40, longestName * fontSize * 0.55 + (showKeys ? 24 : 8)));
13970
- return { fontSize, rowH, keyW, height: rowH * (1 + names.length) };
13971
- }
13972
-
13973
- // chart/render/chart-spacing.ts
13974
- function chartBarSpacing(chart) {
13975
- const stacked = chart.grouping === "stacked" || chart.grouping === "percentStacked";
13976
- return {
13977
- barGapWidth: chart.barGapWidth ?? DEFAULT_BAR_GAP_WIDTH,
13978
- barOverlap: chart.barOverlap ?? (stacked ? 100 : 0)
13979
- };
13980
- }
13981
-
13982
- // chart/render/chart-svg-labels.ts
13983
- var GAP = 3;
13984
- var LINE = 1.2;
13985
- var NAMED_COLORS = /^(black|blue|cyan|green|magenta|red|white|yellow)$/iu;
13986
- function measure(model, label) {
13987
- const attrs = chartTextAttributes(model, "dataLabel", 10);
13988
- const size = attrs.size ?? 10;
13989
- const lines = label.text.split("\n");
13990
- return {
13991
- ...model.frameSize ? { frame: model.frameSize } : {},
13992
- lines,
13993
- size,
13994
- w: Math.max(...lines.map((l) => textWidth(l, size))),
13995
- h: lines.length * size * LINE,
13996
- attrs
13997
- };
13998
- }
13999
- function draw(m, label, x, y, anchor, out) {
14000
- if (m.frame) ({ x, y } = applyLabelManualLayout(label.layout, m.frame, { x, y }));
14001
- const fill = label.color && NAMED_COLORS.test(label.color) ? label.color.toLowerCase() : void 0;
14002
- m.lines.forEach((line3, k) => {
14003
- const lineY = y - m.h / 2 + (k + 0.5) * m.size * LINE + m.size * 0.35;
14004
- out.push(text(x, lineY, line3, { ...m.attrs, ...fill ? { fill } : {}, anchor }));
14005
- });
14331
+ function draw(m, label, x, y, anchor, out) {
14332
+ if (m.frame) ({ x, y } = applyLabelManualLayout(label.layout, m.frame, { x, y }));
14333
+ const fill = label.color && NAMED_COLORS.test(label.color) ? label.color.toLowerCase() : void 0;
14334
+ m.lines.forEach((line4, k) => {
14335
+ const lineY = y - m.h / 2 + (k + 0.5) * m.size * LINE + m.size * 0.35;
14336
+ out.push(text(x, lineY, line4, { ...m.attrs, ...fill ? { fill } : {}, anchor }));
14337
+ });
14006
14338
  }
14007
14339
  function barLabels(model, marks, out) {
14008
14340
  const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
@@ -14302,13 +14634,13 @@ function chartDataTableSvg(model, plot) {
14302
14634
  const bottom = top + height;
14303
14635
  const cellW = plot.w / Math.max(1, model.categories.length);
14304
14636
  const styled = { ...model, appearance: { ...model.appearance, dataLabel: table.text ?? {} } };
14305
- const attrs = chartTextAttributes(styled, "dataLabel", fontSize);
14637
+ const attrs2 = chartTextAttributes(styled, "dataLabel", fontSize);
14306
14638
  const out = ['<g data-chart-part="dataTable">'];
14307
14639
  const border2 = (x1, y1, x2, y2) => out.push(
14308
14640
  `<line x1="${n(x1)}" y1="${n(y1)}" x2="${n(x2)}" y2="${n(y2)}" ${strokeAttributes(table.stroke)}/>`
14309
14641
  );
14310
14642
  const label = (x, y, value, width, anchor = "middle") => out.push(
14311
- text(x, y + fontSize * 0.35, fit(value, Math.max(1, width), fontSize), { ...attrs, anchor })
14643
+ text(x, y + fontSize * 0.35, fit(value, Math.max(1, width), fontSize), { ...attrs2, anchor })
14312
14644
  );
14313
14645
  if (table.fill) out.push(rect2(left, top, right - left, height, table.fill));
14314
14646
  if (source.showOutline !== false) {
@@ -14560,8 +14892,8 @@ function chartDateAxis(model, plot, out) {
14560
14892
  unit,
14561
14893
  Math.max(1, axis.majorUnit ?? 1)
14562
14894
  );
14563
- const attrs = chartTextAttributes(model, "categoryAxis");
14564
- const size = attrs.size ?? 10;
14895
+ const attrs2 = chartTextAttributes(model, "categoryAxis");
14896
+ const size = attrs2.size ?? 10;
14565
14897
  const y = axis.position === "t" ? plot.y : plot.y + plot.h;
14566
14898
  const paint2 = model.axes?.category?.line;
14567
14899
  const stroke = { color: paint2?.color ?? "#BFBFBF", width: paint2?.width ?? 1 };
@@ -14593,13 +14925,13 @@ function chartDateAxis(model, plot, out) {
14593
14925
  axis.numberFormat?.formatCode
14594
14926
  );
14595
14927
  if (model.horizontal)
14596
- out.push(text(plot.x - 4, position(serial) + size * 0.3, label, { ...attrs, anchor: "end" }));
14928
+ out.push(text(plot.x - 4, position(serial) + size * 0.3, label, { ...attrs2, anchor: "end" }));
14597
14929
  else {
14598
14930
  const above2 = axis.tickLabelPosition === "high" || axis.tickLabelPosition !== "low" && axis.position === "t";
14599
14931
  const baseline = axis.tickLabelPosition === "high" ? plot.y : axis.tickLabelPosition === "low" ? plot.y + plot.h : y;
14600
14932
  out.push(
14601
14933
  text(position(serial), baseline + (above2 ? -4 : size + 3), label, {
14602
- ...attrs,
14934
+ ...attrs2,
14603
14935
  anchor: "middle"
14604
14936
  })
14605
14937
  );
@@ -14655,11 +14987,11 @@ function smoothSegment(points, i) {
14655
14987
  function chartLineSvg(points, series) {
14656
14988
  if (points.length < 2) return "";
14657
14989
  const stroke = series.stroke;
14658
- const attrs = strokeAttributes(
14990
+ const attrs2 = strokeAttributes(
14659
14991
  stroke ? { ...stroke, color: stroke.color === "none" ? "none" : series.color } : { color: series.color, width: 2.25 }
14660
14992
  );
14661
14993
  const filter = series.shadowFilter ? ` filter="${series.shadowFilter}"` : "";
14662
- return series.smooth ? `<path d="${smoothLinePath(points)}" fill="none" ${attrs} stroke-linejoin="round"${filter}/>` : `<polyline points="${points.map((p) => `${n(p.x)},${n(p.y)}`).join(" ")}" fill="none" ${attrs} stroke-linejoin="round"${filter}/>`;
14994
+ return series.smooth ? `<path d="${smoothLinePath(points)}" fill="none" ${attrs2} stroke-linejoin="round"${filter}/>` : `<polyline points="${points.map((p) => `${n(p.x)},${n(p.y)}`).join(" ")}" fill="none" ${attrs2} stroke-linejoin="round"${filter}/>`;
14663
14995
  }
14664
14996
 
14665
14997
  // chart/render/chart-svg-plot-layout.ts
@@ -14713,9 +15045,9 @@ function chartSeriesMarkerSvg(series, index, cx, cy, defaultRadius = 3) {
14713
15045
  geometry = `points="${esc(primitive.points)}"`;
14714
15046
  break;
14715
15047
  }
14716
- const outline = primitive.stroke ? ` stroke="${esc(primitive.stroke)}" stroke-width="${n(primitive.strokeWidth ?? 1)}"` : "";
15048
+ const outline2 = primitive.stroke ? ` stroke="${esc(primitive.stroke)}" stroke-width="${n(primitive.strokeWidth ?? 1)}"` : "";
14717
15049
  const filter = series.shadowFilter ? ` filter="${esc(series.shadowFilter)}"` : "";
14718
- return `<${primitive.kind} ${geometry} fill="${esc(primitive.fill)}"${outline}${filter}/>`;
15050
+ return `<${primitive.kind} ${geometry} fill="${esc(primitive.fill)}"${outline2}${filter}/>`;
14719
15051
  }
14720
15052
 
14721
15053
  // chart/line-dash.ts
@@ -14959,69 +15291,76 @@ function applyChartAxes(model, chart, color) {
14959
15291
  model.axes = out;
14960
15292
  }
14961
15293
 
14962
- // chart/render/chart-title-text.ts
14963
- function chartRunStyle(run) {
14964
- return {
14965
- ...run.sizePt === void 0 ? {} : { fontSize: run.sizePt },
14966
- ...run.bold === void 0 ? {} : { bold: run.bold },
14967
- ...run.italic === void 0 ? {} : { italic: run.italic },
14968
- ...run.underline === void 0 ? {} : { underline: run.underline },
14969
- ...run.typeface === void 0 ? {} : { typeface: run.typeface },
14970
- ...run.color === void 0 ? {} : { textColor: run.color }
14971
- };
14972
- }
14973
- function chartTitleText(chart, theme) {
14974
- const formatting = chart.formatting;
14975
- const entry = formatting?.entries.title;
14976
- const body = entry?.textBody;
14977
- if (!formatting || !body || body.text !== chart.title) return void 0;
14978
- if (body.paragraphs.length === 1 && body.paragraphs[0].runs.length <= 1 && !body.text.includes("\n") && !body.paragraphs[0].lineSpacing && !body.paragraphs[0].spaceBefore && !body.paragraphs[0].spaceAfter)
14979
- return void 0;
14980
- return {
14981
- paragraphs: body.paragraphs.map((paragraph) => ({
14982
- ...paragraph.align ? { align: paragraph.align } : {},
14983
- ...paragraph.lineSpacing ? { lineSpacing: paragraph.lineSpacing } : {},
14984
- ...paragraph.spaceBefore ? { spaceBefore: paragraph.spaceBefore } : {},
14985
- ...paragraph.spaceAfter ? { spaceAfter: paragraph.spaceAfter } : {},
14986
- runs: paragraph.runs.map((run) => {
14987
- const direct = {
14988
- sourceXml: "",
14989
- ...entry.textBodyStyle,
14990
- ...chartRunStyle(paragraph.defaultProperties ?? {}),
14991
- ...chartRunStyle(run)
14992
- };
14993
- const appearance = chartAppearance(
14994
- {
14995
- ...chart,
14996
- formatting: { ...formatting, entries: { ...formatting.entries, title: direct } }
14997
- },
14998
- theme
14999
- )?.title ?? {};
15000
- return { text: run.text, appearance };
15001
- })
15002
- }))
15003
- };
15294
+ // chart/region-map/value-color-positions.ts
15295
+ function schemaPosition(node, end) {
15296
+ for (const kind of ["number", "percent"]) {
15297
+ const element = first(node, kind, NS.cx), raw = element?.getAttribute("val");
15298
+ const value = raw === null || raw === void 0 || raw === "" ? NaN : Number(raw);
15299
+ if (Number.isFinite(value)) return { kind, value };
15300
+ }
15301
+ return end === "mid" ? { kind: "percent", value: 50 } : { kind: end };
15302
+ }
15303
+ function parseRegionValueColorPositions(xml) {
15304
+ if (!xml) return void 0;
15305
+ const root = parseXml(`<cx:root xmlns:cx="${NS.cx}">${xml}</cx:root>`).documentElement;
15306
+ const positions = first(root, "valueColorPositions", NS.cx);
15307
+ if (!positions) return void 0;
15308
+ const count = positions.getAttribute("count");
15309
+ const native = ["min", "mid", "max"].some((key) => first(positions, key, NS.cx));
15310
+ if (native || count !== null && children(positions, "pos", NS.cx).length === 0) {
15311
+ const keys = count === "3" || first(positions, "mid", NS.cx) ? ["min", "mid", "max"] : ["min", "max"];
15312
+ return keys.map((key) => schemaPosition(first(positions, key, NS.cx), key));
15313
+ }
15314
+ const legacy = children(positions, "pos", NS.cx).flatMap(
15315
+ (element) => {
15316
+ const type = element.getAttribute("type");
15317
+ if (type === "min" || type === "max") return [{ kind: type }];
15318
+ if (type !== "num" && type !== "percent") return [];
15319
+ const raw = element.getAttribute("val"), value = raw === null || raw === "" ? NaN : Number(raw);
15320
+ return [
15321
+ { kind: type === "num" ? "number" : type, ...Number.isFinite(value) ? { value } : {} }
15322
+ ];
15323
+ }
15324
+ );
15325
+ return legacy.length ? legacy : void 0;
15326
+ }
15327
+
15328
+ // chart/region-map/value-colors.ts
15329
+ function resolveRegionValueColors(options2, color) {
15330
+ const result = { ...options2 };
15331
+ const xml = `<cx:root xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">${options2.valueColorsXml ?? ""}${options2.valueColorPositionsXml ?? ""}</cx:root>`;
15332
+ const root = parseXml(xml).documentElement;
15333
+ if (options2.valueColorsXml) {
15334
+ const colors = Array.from(root.getElementsByTagName("*")).flatMap((node) => {
15335
+ const c = color(parseDrawingColorIn(node));
15336
+ return c ? [c] : [];
15337
+ });
15338
+ if (colors.length) result.valueColors = colors;
15339
+ }
15340
+ const positions = parseRegionValueColorPositions(options2.valueColorPositionsXml);
15341
+ if (positions) result.valueColorPositions = positions;
15342
+ return result;
15004
15343
  }
15005
15344
 
15006
15345
  // chart/render/chart-view-analysis.ts
15007
- function strokeOf(line3, fallback, resolve) {
15008
- if (line3?.fill?.kind === "none") return void 0;
15009
- const color = (line3?.fill?.kind === "solid" ? resolve(line3.fill.color) : void 0) ?? fallback.color;
15010
- const width = line3?.widthEmu === void 0 ? fallback.width : chartPointsToPixels(line3.widthEmu / 12700);
15011
- const dash = line3?.dash ?? fallback.dash;
15346
+ function strokeOf(line4, fallback, resolve) {
15347
+ if (line4?.fill?.kind === "none") return void 0;
15348
+ const color = (line4?.fill?.kind === "solid" ? resolve(line4.fill.color) : void 0) ?? fallback.color;
15349
+ const width = line4?.widthEmu === void 0 ? fallback.width : chartPointsToPixels(line4.widthEmu / 12700);
15350
+ const dash = line4?.dash ?? fallback.dash;
15012
15351
  return { color, width, ...dash && dash !== "solid" ? { dash } : {} };
15013
15352
  }
15014
15353
  function analysisView(source, seriesColor, resolve) {
15015
15354
  const plain2 = seriesColor === "none" || seriesColor.startsWith("url(") ? TEXT_COLOR : seriesColor;
15016
15355
  const trendlines2 = (source.trendlines ?? []).flatMap((entry) => {
15017
- const { name: _name, line: line3, ...fit2 } = entry;
15356
+ const { name: _name, line: line4, ...fit2 } = entry;
15018
15357
  const fallback = { color: plain2, width: chartPointsToPixels(1.5), dash: "sysDot" };
15019
- const stroke = strokeOf(line3, fallback, resolve);
15358
+ const stroke = strokeOf(line4, fallback, resolve);
15020
15359
  return stroke ? [{ fit: fit2, stroke }] : [];
15021
15360
  });
15022
15361
  const errorBars = (source.errorBars ?? []).flatMap((entry) => {
15023
- const { direction, barType, noEndCap, line: line3, ...amount } = entry;
15024
- const stroke = strokeOf(line3, { color: TEXT_COLOR, width: chartPointsToPixels(0.75) }, resolve);
15362
+ const { direction, barType, noEndCap, line: line4, ...amount } = entry;
15363
+ const stroke = strokeOf(line4, { color: TEXT_COLOR, width: chartPointsToPixels(0.75) }, resolve);
15025
15364
  return stroke ? [{ direction, barType, amount, endCap: noEndCap !== true, stroke }] : [];
15026
15365
  });
15027
15366
  return {
@@ -15205,10 +15544,10 @@ function paintOf(fill, ctx) {
15205
15544
  return fill?.kind === "solid" ? ctx.drawingColor(fill.color) : void 0;
15206
15545
  }
15207
15546
  function lineOf(shape, ctx, color) {
15208
- const line3 = shape?.line;
15547
+ const line4 = shape?.line;
15209
15548
  return {
15210
- color: paintOf(line3?.fill, ctx) ?? color,
15211
- width: line3?.widthEmu === void 0 ? 1 : Math.max(0.5, line3.widthEmu / EMU_PER_PX)
15549
+ color: paintOf(line4?.fill, ctx) ?? color,
15550
+ width: line4?.widthEmu === void 0 ? 1 : Math.max(0.5, line4.widthEmu / EMU_PER_PX)
15212
15551
  };
15213
15552
  }
15214
15553
  function barOf(shape, ctx, fallback) {
@@ -15444,6 +15783,7 @@ var SUPPORTED = /* @__PURE__ */ new Set([
15444
15783
  "treemap",
15445
15784
  "sunburst",
15446
15785
  "funnel",
15786
+ "regionMap",
15447
15787
  "boxWhisker"
15448
15788
  ]);
15449
15789
  function chartSummaryView(chart, theme, options2 = {}) {
@@ -15504,8 +15844,14 @@ function chartSummaryView(chart, theme, options2 = {}) {
15504
15844
  categories,
15505
15845
  series: type === "boxWhisker" ? series.filter((s) => !s.hidden) : series,
15506
15846
  horizontal: type === "bar",
15507
- supported: SUPPORTED.has(type)
15847
+ supported: SUPPORTED.has(type) || type === "surface" && chart.view3D !== void 0
15508
15848
  };
15849
+ if (chart.view3D) model.view3D = chart.view3D;
15850
+ if (chart.funnelGapWidth !== void 0) model.funnelGapWidth = chart.funnelGapWidth;
15851
+ if (chart.series[0]?.regionMap)
15852
+ model.regionMap = resolveRegionValueColors(chart.series[0].regionMap, ctx.drawingColor);
15853
+ if (model.regionMap && chart.series[0]?.fill?.kind === "solid" && series[0])
15854
+ model.regionMap.fixedColor = series[0].color;
15509
15855
  const table = chartDataTableView(chart, theme, ctx.drawingColor);
15510
15856
  if (table) model.dataTable = table;
15511
15857
  if (chart.date1904 !== void 0) model.date1904 = chart.date1904;
@@ -15631,131 +15977,1539 @@ function cartesianAxes(model, area, out, size) {
15631
15977
  const zero = value(Math.min(Math.max(crossing, scale.min), scale.max));
15632
15978
  if (horizontal)
15633
15979
  out.push(
15634
- axisLine(model, model.axes?.category, "categoryAxis", zero, plot.y, zero, plot.y + plot.h)
15980
+ axisLine(model, model.axes?.category, "categoryAxis", zero, plot.y, zero, plot.y + plot.h)
15981
+ );
15982
+ else
15983
+ out.push(
15984
+ axisLine(model, model.axes?.category, "categoryAxis", plot.x, zero, plot.x + plot.w, zero)
15985
+ );
15986
+ out.push(...dateMarkup);
15987
+ const step = Math.max(
15988
+ 1,
15989
+ Math.ceil(cats / Math.max(1, Math.floor((horizontal ? plot.h : plot.w) / 14)))
15990
+ );
15991
+ model.categories.forEach((c, i) => {
15992
+ if (dates || !categoryLabels || i % step !== 0) return;
15993
+ const p = band(i);
15994
+ if (horizontal)
15995
+ out.push(
15996
+ text(plot.x - 4, p + categorySize * 0.3, fit(c, catW - 6, categorySize), {
15997
+ anchor: "end",
15998
+ ...categoryAttrs
15999
+ })
16000
+ );
16001
+ else
16002
+ out.push(
16003
+ text(p, plot.y + plot.h + categorySize + 3, fit(c, bandSize * step, categorySize), {
16004
+ anchor: "middle",
16005
+ ...categoryAttrs
16006
+ })
16007
+ );
16008
+ });
16009
+ const frame2 = { plot, value, band, bandSize, ...dates ? { order: dates.order } : {} };
16010
+ if (second) {
16011
+ frame2.secondary = (v) => plot.y + plot.h - chartAxisRatio(v, second, model.axes?.secondary) * plot.h;
16012
+ out.push(
16013
+ axisLine(
16014
+ model,
16015
+ model.axes?.secondary,
16016
+ "valueAxis",
16017
+ plot.x + plot.w,
16018
+ plot.y,
16019
+ plot.x + plot.w,
16020
+ plot.y + plot.h
16021
+ )
16022
+ );
16023
+ if (model.axes?.secondary?.source.majorGridlines || model.axes?.secondary?.source.minorGridlines)
16024
+ out.push(
16025
+ axisGridlines(model, model.axes.secondary, second.ticks, frame2.secondary, plot, false)
16026
+ );
16027
+ if (chartAxisLabels(model.axes?.secondary))
16028
+ second.ticks.forEach(
16029
+ (t, i) => out.push(
16030
+ text(plot.x + plot.w + 4, frame2.secondary(t) + valueSize * 0.3, secondLabels[i] ?? "", {
16031
+ anchor: "start",
16032
+ ...valueAttrs
16033
+ })
16034
+ )
16035
+ );
16036
+ }
16037
+ return frame2;
16038
+ }
16039
+ function plotted(model) {
16040
+ if (model.grouping !== "percentStacked") return model.series.map((s) => s.values);
16041
+ const totals = categoryTotals(model);
16042
+ return model.series.map(
16043
+ (s) => s.values.map((v, i) => v === null ? null : v / (totals[i] || 1))
16044
+ );
16045
+ }
16046
+ function linesAndAreas(model, frame2, out) {
16047
+ const values = plotted(model);
16048
+ const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
16049
+ const acc = new Array(model.categories.length).fill(0);
16050
+ const area = model.type === "area";
16051
+ const marks = [];
16052
+ const layers = [];
16053
+ model.series.forEach((s, si) => {
16054
+ const points = [];
16055
+ const lower = [];
16056
+ (frame2.order ?? model.categories.map((_, i) => i)).forEach((i) => {
16057
+ const v = values[si]?.[i] ?? null;
16058
+ if (v === null && !area) {
16059
+ points.push([NaN, NaN]);
16060
+ return;
16061
+ }
16062
+ const below2 = stacked ? acc[i] ?? 0 : 0;
16063
+ const top = below2 + (v ?? 0);
16064
+ if (stacked) acc[i] = top;
16065
+ points.push([frame2.band(i), frame2.value(top)]);
16066
+ marks.push({
16067
+ series: s,
16068
+ index: i,
16069
+ x: frame2.band(i),
16070
+ y: frame2.value(top),
16071
+ radius: area ? 0 : chartMarkerRadius(s, i, 2.5)
16072
+ });
16073
+ lower.push([frame2.band(i), frame2.value(below2)]);
16074
+ });
16075
+ layers.push({
16076
+ series: s,
16077
+ points,
16078
+ lower,
16079
+ color: s.color,
16080
+ filter: s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""
16081
+ });
16082
+ });
16083
+ for (const { points, lower, color, filter, series } of area ? [...layers].reverse() : layers) {
16084
+ if (area) {
16085
+ const poly = [...points, ...[...lower].reverse()].map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
16086
+ out.push(`<polygon points="${poly}" fill="${color}" fill-opacity="0.85"${filter}/>`);
16087
+ continue;
16088
+ }
16089
+ let segment2 = [];
16090
+ const flush = () => {
16091
+ out.push(chartLineSvg(segment2, series));
16092
+ segment2 = [];
16093
+ };
16094
+ for (const [x, y] of points) {
16095
+ if (Number.isNaN(x)) flush();
16096
+ else segment2.push({ x, y });
16097
+ }
16098
+ flush();
16099
+ points.forEach(([x, y], index) => {
16100
+ if (!Number.isNaN(x))
16101
+ out.push(chartSeriesMarkerSvg(series, frame2.order?.[index] ?? index, x, y, 2.5));
16102
+ });
16103
+ }
16104
+ pointLabels(model, marks, out);
16105
+ }
16106
+
16107
+ // chart/render/chart-3d-marks.ts
16108
+ var RIBBON_THICKNESS = 0.025;
16109
+ var stackedOf = (model) => model.grouping === "stacked" || model.grouping === "percentStacked";
16110
+ function chart3DBarMeshes(model, layout) {
16111
+ const bars2 = layout.bars;
16112
+ if (!bars2) return [];
16113
+ const values = plotted(model);
16114
+ const stacked = stackedOf(model);
16115
+ const clustered = model.grouping === "clustered";
16116
+ const inDepth = chart3DSeriesInDepth(model);
16117
+ const pos = new Array(model.categories.length).fill(0);
16118
+ const neg = new Array(model.categories.length).fill(0);
16119
+ const base = layout.value(0);
16120
+ const meshes = [];
16121
+ model.series.forEach((s, si) => {
16122
+ const slot = clustered ? si : 0;
16123
+ const [z0, z1] = layout.rowZ(inDepth ? si : 0);
16124
+ values[si]?.forEach((v, i) => {
16125
+ if (v === null || i >= model.categories.length) return;
16126
+ let from = 0;
16127
+ let to = v;
16128
+ if (stacked) {
16129
+ const acc = v >= 0 ? pos : neg;
16130
+ from = acc[i] ?? 0;
16131
+ to = from + v;
16132
+ acc[i] = to;
16133
+ }
16134
+ const a = stacked ? layout.value(from) : base;
16135
+ const b = layout.value(to);
16136
+ const centre = (i + 0.5) * layout.band;
16137
+ const meta = {
16138
+ series: s.sourceIndex ?? si,
16139
+ point: i,
16140
+ color: s.pointColors?.[i] ?? s.color
16141
+ };
16142
+ const mesh = layout.horizontal ? boxMesh(
16143
+ a,
16144
+ b,
16145
+ centre - (bars2.clusterWidth / 2 - bars2.singleBarWidth - slot * bars2.step) - bars2.singleBarWidth,
16146
+ centre - (bars2.clusterWidth / 2 - bars2.singleBarWidth - slot * bars2.step),
16147
+ z0,
16148
+ z1,
16149
+ meta
16150
+ ) : boxMesh(
16151
+ centre - bars2.clusterWidth / 2 + slot * bars2.step,
16152
+ centre - bars2.clusterWidth / 2 + slot * bars2.step + bars2.singleBarWidth,
16153
+ a,
16154
+ b,
16155
+ z0,
16156
+ z1,
16157
+ meta
16158
+ );
16159
+ if (mesh) meshes.push(mesh);
16160
+ });
16161
+ });
16162
+ return meshes;
16163
+ }
16164
+ function chart3DLineMeshes(model, layout) {
16165
+ const values = plotted(model);
16166
+ const stacked = stackedOf(model);
16167
+ const inDepth = chart3DSeriesInDepth(model);
16168
+ const thick = layout.valueLength * RIBBON_THICKNESS;
16169
+ const acc = new Array(model.categories.length).fill(0);
16170
+ const meshes = [];
16171
+ model.series.forEach((s, si) => {
16172
+ const [z0, z1] = layout.rowZ(inDepth ? si : 0);
16173
+ const pts = (values[si] ?? []).map((v, i) => {
16174
+ if (v === null || i >= model.categories.length) return null;
16175
+ const top = stacked ? acc[i] = (acc[i] ?? 0) + v : v;
16176
+ return [(i + 0.5) * layout.band, layout.value(top)];
16177
+ });
16178
+ for (let i = 0; i + 1 < pts.length; i++) {
16179
+ const p = pts[i];
16180
+ const q = pts[i + 1];
16181
+ if (!p || !q) continue;
16182
+ const mesh = extrudeMesh([p, q, [q[0], q[1] - thick], [p[0], p[1] - thick]], z0, z1, {
16183
+ series: s.sourceIndex ?? si,
16184
+ point: i,
16185
+ color: s.color
16186
+ });
16187
+ if (mesh) meshes.push(mesh);
16188
+ }
16189
+ });
16190
+ return meshes;
16191
+ }
16192
+ function chart3DAreaMeshes(model, layout) {
16193
+ const values = plotted(model);
16194
+ const stacked = stackedOf(model);
16195
+ const inDepth = chart3DSeriesInDepth(model);
16196
+ const cats = model.categories.length;
16197
+ const x = (i) => cats > 1 ? i / (cats - 1) * layout.catLength : layout.catLength / 2;
16198
+ const base = layout.value(0);
16199
+ const acc = new Array(cats).fill(0);
16200
+ const meshes = [];
16201
+ model.series.forEach((s, si) => {
16202
+ const [z0, z1] = layout.rowZ(inDepth ? si : 0);
16203
+ const upper = [];
16204
+ const lower = [];
16205
+ for (let i = 0; i < cats; i++) {
16206
+ const v = values[si]?.[i] ?? 0;
16207
+ const below2 = stacked ? acc[i] ?? 0 : 0;
16208
+ if (stacked) acc[i] = below2 + v;
16209
+ upper.push([x(i), layout.value(below2 + v)]);
16210
+ lower.push([x(i), stacked ? layout.value(below2) : base]);
16211
+ }
16212
+ const mesh = extrudeMesh([...upper, ...lower.reverse()], z0, z1, {
16213
+ series: s.sourceIndex ?? si,
16214
+ point: 0,
16215
+ color: s.color
16216
+ });
16217
+ if (mesh) meshes.push(mesh);
16218
+ });
16219
+ return meshes;
16220
+ }
16221
+
16222
+ // chart/render/chart-3d-projection.ts
16223
+ var DEFAULT_ROT_X = 15;
16224
+ var DEFAULT_ROT_Y = 20;
16225
+ var DEFAULT_PIE_ROT_X = 30;
16226
+ var DEFAULT_PIE_ROT_Y = 0;
16227
+ var DEFAULT_PERSPECTIVE_DEG = 30;
16228
+ var PERSPECTIVE_MAX_DEG = 120;
16229
+ var FOV_MIN = 15;
16230
+ var FOV_MAX = 75;
16231
+ var clamp2 = (value, min, max) => Math.min(Math.max(value, min), max);
16232
+ function resolvePerspectiveFov(perspectiveDeg) {
16233
+ const perspective = clamp2(perspectiveDeg ?? DEFAULT_PERSPECTIVE_DEG, 0, PERSPECTIVE_MAX_DEG);
16234
+ return FOV_MIN + perspective / PERSPECTIVE_MAX_DEG * (FOV_MAX - FOV_MIN);
16235
+ }
16236
+ function resolveChart3DProjection(chartType, view3D) {
16237
+ const isPie = chartType === "pie3D";
16238
+ const rotXDeg = view3D?.rotX ?? (isPie ? DEFAULT_PIE_ROT_X : DEFAULT_ROT_X);
16239
+ const rotYDeg = view3D?.rotY ?? (isPie ? DEFAULT_PIE_ROT_Y : DEFAULT_ROT_Y);
16240
+ const rAngAx = view3D?.rAngAx ?? chartType === "bar3D";
16241
+ if (rAngAx) {
16242
+ const rx = rotXDeg * Math.PI / 180;
16243
+ const ry = rotYDeg * Math.PI / 180;
16244
+ return { mode: "oblique", shearX: Math.sin(ry), shearY: -Math.sin(rx), rotXDeg, rotYDeg };
16245
+ }
16246
+ return {
16247
+ mode: "perspective",
16248
+ rotXDeg,
16249
+ rotYDeg,
16250
+ fovDeg: resolvePerspectiveFov(view3D?.perspective)
16251
+ };
16252
+ }
16253
+
16254
+ // chart/render/chart-3d-shading.ts
16255
+ var FACE_SHADE_AMOUNT = {
16256
+ front: 0,
16257
+ top: 0.25,
16258
+ right: 0.36,
16259
+ left: 0.36,
16260
+ back: 0.36,
16261
+ bottom: 0.5
16262
+ };
16263
+ var HEX = /^#[0-9a-f]{6}$/i;
16264
+ function shadeChart3DFace(baseColor, face) {
16265
+ const amount = FACE_SHADE_AMOUNT[face];
16266
+ return amount === 0 || !HEX.test(baseColor) ? baseColor : shade(baseColor, amount);
16267
+ }
16268
+
16269
+ // chart/render/chart-3d-pie.ts
16270
+ var STEP = Math.PI / 45;
16271
+ function chart3DPieGeometry(area, view) {
16272
+ const tilt = resolveChart3DProjection("pie3D", view).rotXDeg;
16273
+ const sin = Math.min(1, Math.max(0.08, Math.sin(Math.abs(tilt) * Math.PI / 180)));
16274
+ const cos = Math.cos(Math.min(90, Math.abs(tilt)) * Math.PI / 180);
16275
+ const depth = Math.min(2e3, Math.max(20, view.depthPercent ?? 100)) / 100;
16276
+ const rx0 = Math.max(1, Math.min(area.w / 2, area.h / 2 / sin) - 4);
16277
+ const thickness = rx0 * 0.35 * cos * depth;
16278
+ const rx = Math.min(rx0, Math.max(1, (area.h - thickness) / 2 / sin));
16279
+ const ry = rx * sin;
16280
+ const thick = Math.min(thickness, Math.max(0, area.h - ry * 2));
16281
+ return {
16282
+ cx: area.x + area.w / 2,
16283
+ cy: area.y + (area.h - thick) / 2 + ry,
16284
+ rx,
16285
+ ry,
16286
+ thickness: thick
16287
+ };
16288
+ }
16289
+ var pt = (g, a, dy) => `${n(g.cx + g.rx * Math.cos(a))},${n(g.cy + g.ry * Math.sin(a) + dy)}`;
16290
+ function frontRanges(a0, a1) {
16291
+ const out = [];
16292
+ for (let k = Math.floor(a0 / (2 * Math.PI)) - 1; k <= Math.ceil(a1 / (2 * Math.PI)); k++) {
16293
+ const lo = Math.max(a0, k * 2 * Math.PI);
16294
+ const hi = Math.min(a1, k * 2 * Math.PI + Math.PI);
16295
+ if (hi - lo > 1e-6) out.push([lo, hi]);
16296
+ }
16297
+ return out;
16298
+ }
16299
+ function chart3DPieSvg(model, area, view) {
16300
+ const series = model.series[0];
16301
+ if (!series) return "";
16302
+ const total = series.values.reduce((sum, v) => sum + (v !== null && v > 0 ? v : 0), 0);
16303
+ if (total <= 0) return "";
16304
+ const g = chart3DPieGeometry(area, view);
16305
+ const walls = [];
16306
+ const tops = [];
16307
+ let angle = -Math.PI / 2;
16308
+ series.values.forEach((v, i) => {
16309
+ if (v === null || v <= 0) return;
16310
+ const sweep = v / total * Math.PI * 2;
16311
+ const a0 = angle;
16312
+ const a1 = angle + sweep;
16313
+ angle = a1;
16314
+ const color = series.pointColors?.[i] ?? series.color;
16315
+ const wall = shadeChart3DFace(color, "right");
16316
+ const top = color;
16317
+ const filter = series.shadowFilter ? ` filter="${series.shadowFilter}"` : "";
16318
+ for (const [lo, hi] of frontRanges(a0, a1)) {
16319
+ const steps = Math.max(2, Math.ceil((hi - lo) / STEP));
16320
+ const upper = [];
16321
+ const lower = [];
16322
+ for (let s = 0; s <= steps; s++) {
16323
+ const a = lo + (hi - lo) * s / steps;
16324
+ upper.push(pt(g, a, 0));
16325
+ lower.push(pt(g, a, g.thickness));
16326
+ }
16327
+ walls.push(
16328
+ `<polygon points="${[...upper, ...lower.reverse()].join(" ")}" fill="${wall}" stroke="${wall}" stroke-width="0.5" data-chart-series="0" data-chart-point="${i}"${filter}/>`
16329
+ );
16330
+ }
16331
+ const full = sweep >= Math.PI * 2 - 1e-6;
16332
+ const start = pt(g, a0, 0);
16333
+ const end = pt(g, a1, 0);
16334
+ const d = full ? `M${pt(g, a0, 0)} A${n(g.rx)},${n(g.ry)} 0 1 1 ${pt(g, a0 + Math.PI, 0)} A${n(g.rx)},${n(g.ry)} 0 1 1 ${start} Z` : `M${n(g.cx)},${n(g.cy)} L${start} A${n(g.rx)},${n(g.ry)} 0 ${sweep > Math.PI ? 1 : 0} 1 ${end} Z`;
16335
+ tops.push(
16336
+ `<path d="${d}" fill="${top}" stroke="#FFFFFF" stroke-width="1" data-chart-series="0" data-chart-point="${i}"${filter}/>`
16337
+ );
16338
+ });
16339
+ return walls.join("") + tops.join("");
16340
+ }
16341
+
16342
+ // chart/render/chart-3d-scene.ts
16343
+ var centroid = (pts) => {
16344
+ const sum = pts.reduce(
16345
+ (acc, p) => [acc[0] + p[0], acc[1] + p[1], acc[2] + p[2]],
16346
+ [0, 0, 0]
16347
+ );
16348
+ return [sum[0] / pts.length, sum[1] / pts.length, sum[2] / pts.length];
16349
+ };
16350
+ function chart3DFaceVisible(camera, face) {
16351
+ if (!face.normal) return true;
16352
+ const d = camera.viewDir(centroid(face.pts));
16353
+ return face.normal[0] * d[0] + face.normal[1] * d[1] + face.normal[2] * d[2] < 0;
16354
+ }
16355
+ function chart3DPolygon(camera, pts, fill, extra = "") {
16356
+ const points = pts.map((p) => {
16357
+ const q = camera.project(p);
16358
+ return `${n(q.x)},${n(q.y)}`;
16359
+ }).join(" ");
16360
+ return `<polygon points="${points}" fill="${fill}" stroke="${fill}" stroke-width="0.5" stroke-linejoin="round"${extra}/>`;
16361
+ }
16362
+ function chart3DMeshesSvg(camera, meshes) {
16363
+ const out = [];
16364
+ const ordered = [...meshes].sort((a, b) => camera.order(a.center, b.center));
16365
+ for (const mesh of ordered) {
16366
+ const faces = mesh.faces.filter((face) => chart3DFaceVisible(camera, face)).map((face) => ({ face, depth: camera.project(centroid(face.pts)).depth })).sort((a, b) => b.depth - a.depth);
16367
+ if (!faces.length) continue;
16368
+ out.push(`<g data-chart-series="${mesh.series}" data-chart-point="${mesh.point}">`);
16369
+ for (const { face } of faces)
16370
+ out.push(
16371
+ chart3DPolygon(camera, face.pts, face.fill ?? shadeChart3DFace(mesh.color, face.kind))
16372
+ );
16373
+ out.push("</g>");
16374
+ }
16375
+ return out.join("");
16376
+ }
16377
+
16378
+ // chart/render/chart-3d-surface.ts
16379
+ var LIGHT = (() => {
16380
+ const v = [-0.3, 0.8, -0.5];
16381
+ const len = Math.hypot(...v);
16382
+ return [v[0] / len, v[1] / len, v[2] / len];
16383
+ })();
16384
+ var HEX2 = /^#[0-9a-f]{6}$/i;
16385
+ var BAND_FALLBACK = ["#4472C4", "#ED7D31", "#A5A5A5", "#FFC000", "#5B9BD5", "#70AD47"];
16386
+ function chart3DSurfaceMeshes(model, layout) {
16387
+ const cols = model.categories.length;
16388
+ const rows2 = model.series.length;
16389
+ const scale = model.valueAxis;
16390
+ if (cols < 2 || rows2 < 1 || !scale) return [];
16391
+ const zRows = rows2 === 1 ? 2 : rows2;
16392
+ const height = (r, c) => layout.value(model.series[Math.min(r, rows2 - 1)]?.values[c] ?? 0);
16393
+ const x = (c) => c / (cols - 1) * layout.catLength;
16394
+ const z = (r) => r / (zRows - 1) * layout.size.d;
16395
+ const meshes = [];
16396
+ for (let r = 0; r + 1 < zRows; r++)
16397
+ for (let c = 0; c + 1 < cols; c++) {
16398
+ const pts = [
16399
+ [x(c), height(r, c), z(r)],
16400
+ [x(c + 1), height(r, c + 1), z(r)],
16401
+ [x(c + 1), height(r + 1, c + 1), z(r + 1)],
16402
+ [x(c), height(r + 1, c), z(r + 1)]
16403
+ ];
16404
+ const avg = pts.reduce((sum, p) => sum + p[1], 0) / 4;
16405
+ const band = Math.max(
16406
+ 0,
16407
+ Math.min(
16408
+ Math.max(0, scale.ticks.length - 2),
16409
+ Math.floor(avg / layout.valueLength * Math.max(1, scale.ticks.length - 1))
16410
+ )
16411
+ );
16412
+ const color = model.series[band % rows2]?.color && HEX2.test(model.series[band % rows2].color) ? model.series[band % rows2].color : BAND_FALLBACK[band % BAND_FALLBACK.length] ?? "#4472C4";
16413
+ const [a, b, , d] = pts;
16414
+ const e1 = [b[0] - a[0], b[1] - a[1], b[2] - a[2]];
16415
+ const e2 = [d[0] - a[0], d[1] - a[1], d[2] - a[2]];
16416
+ const nx = e1[1] * e2[2] - e1[2] * e2[1];
16417
+ const ny = e1[2] * e2[0] - e1[0] * e2[2];
16418
+ const nz = e1[0] * e2[1] - e1[1] * e2[0];
16419
+ const len = Math.hypot(nx, ny, nz) || 1;
16420
+ const lit = Math.abs((nx * LIGHT[0] + ny * LIGHT[1] + nz * LIGHT[2]) / len);
16421
+ meshes.push({
16422
+ series: Math.min(r, rows2 - 1),
16423
+ point: c,
16424
+ color,
16425
+ center: [(a[0] + b[0]) / 2, avg, (a[2] + d[2]) / 2],
16426
+ faces: [{ pts, normal: void 0, kind: "top", fill: shade(color, 0.35 * (1 - lit)) }]
16427
+ });
16428
+ }
16429
+ return meshes;
16430
+ }
16431
+
16432
+ // chart/render/chart-3d-walls.ts
16433
+ var LABEL_SIZE = 10;
16434
+ function line3(camera, a, b, color) {
16435
+ const p = camera.project(a);
16436
+ const q = camera.project(b);
16437
+ return `<line x1="${n(p.x)}" y1="${n(p.y)}" x2="${n(q.x)}" y2="${n(q.y)}" stroke="${color}" stroke-width="1"/>`;
16438
+ }
16439
+ function outline(camera, pts, fill) {
16440
+ const points = pts.map((p) => {
16441
+ const q = camera.project(p);
16442
+ return `${n(q.x)},${n(q.y)}`;
16443
+ }).join(" ");
16444
+ return `<polygon points="${points}" fill="${fill}" stroke="${AXIS_COLOR}" stroke-width="1"/>`;
16445
+ }
16446
+ function chart3DLabelMargins(model) {
16447
+ const scale = model.valueAxis;
16448
+ const value = scale ? Math.max(
16449
+ ...scale.ticks.map(
16450
+ (t) => textWidth(axisTickText(t, model.axes?.value, scale.percent), LABEL_SIZE)
16451
+ ),
16452
+ 8
16453
+ ) + 6 : 8;
16454
+ const category = Math.max(...model.categories.map((c) => textWidth(c, LABEL_SIZE)), 8) + 6;
16455
+ return model.horizontal ? { left: Math.min(category, 120), bottom: LABEL_SIZE + 8 } : { left: Math.min(value, 80), bottom: LABEL_SIZE + 8 };
16456
+ }
16457
+ function chart3DWallsSvg(model, layout, camera) {
16458
+ const { w, h, d } = layout.size;
16459
+ const sx = camera.sideWallAtZero ? 0 : w;
16460
+ const out = [];
16461
+ out.push(
16462
+ outline(
16463
+ camera,
16464
+ [
16465
+ [0, 0, 0],
16466
+ [w, 0, 0],
16467
+ [w, 0, d],
16468
+ [0, 0, d]
16469
+ ],
16470
+ "#F2F2F2"
16471
+ )
16472
+ );
16473
+ out.push(
16474
+ outline(
16475
+ camera,
16476
+ [
16477
+ [0, 0, d],
16478
+ [w, 0, d],
16479
+ [w, h, d],
16480
+ [0, h, d]
16481
+ ],
16482
+ "none"
16483
+ )
16484
+ );
16485
+ out.push(
16486
+ outline(
16487
+ camera,
16488
+ [
16489
+ [sx, 0, 0],
16490
+ [sx, 0, d],
16491
+ [sx, h, d],
16492
+ [sx, h, 0]
16493
+ ],
16494
+ "none"
16495
+ )
16496
+ );
16497
+ for (const tick of model.valueAxis?.ticks ?? []) {
16498
+ const p = layout.value(tick);
16499
+ if (layout.horizontal) {
16500
+ out.push(line3(camera, [p, 0, d], [p, h, d], GRID_COLOR));
16501
+ out.push(line3(camera, [p, 0, 0], [p, 0, d], GRID_COLOR));
16502
+ } else {
16503
+ out.push(line3(camera, [0, p, d], [w, p, d], GRID_COLOR));
16504
+ out.push(line3(camera, [sx, p, 0], [sx, p, d], GRID_COLOR));
16505
+ }
16506
+ }
16507
+ return out.join("");
16508
+ }
16509
+ function chart3DLabelsSvg(model, layout, camera, catPos) {
16510
+ const { w } = layout.size;
16511
+ const sx = camera.sideWallAtZero ? 0 : w;
16512
+ const scale = model.valueAxis;
16513
+ const out = [];
16514
+ const anchor = sx === 0 ? "end" : "start";
16515
+ const dx = sx === 0 ? -4 : 4;
16516
+ for (const tick of scale?.ticks ?? []) {
16517
+ const label = axisTickText(tick, model.axes?.value, scale?.percent ?? false);
16518
+ const p = layout.value(tick);
16519
+ if (layout.horizontal) {
16520
+ const q = camera.project([p, 0, 0]);
16521
+ out.push(text(q.x, q.y + LABEL_SIZE + 3, label, { anchor: "middle", size: LABEL_SIZE }));
16522
+ } else {
16523
+ const q = camera.project([sx, p, 0]);
16524
+ out.push(text(q.x + dx, q.y + 3, label, { anchor, size: LABEL_SIZE }));
16525
+ }
16526
+ }
16527
+ const a = camera.project([0, 0, 0]);
16528
+ const b = camera.project(layout.horizontal ? [0, layout.band, 0] : [layout.band, 0, 0]);
16529
+ const bandPx = Math.max(1, layout.horizontal ? Math.abs(b.y - a.y) : Math.abs(b.x - a.x));
16530
+ const extent = layout.horizontal ? LABEL_SIZE + 2 : Math.max(...model.categories.map((c) => textWidth(c, LABEL_SIZE)), 1);
16531
+ const stride = Math.max(1, Math.ceil(extent / bandPx));
16532
+ model.categories.forEach((label, i) => {
16533
+ if (i % stride) return;
16534
+ if (layout.horizontal) {
16535
+ const q = camera.project([sx, catPos(i), 0]);
16536
+ out.push(text(q.x + dx, q.y + 3, label, { anchor, size: LABEL_SIZE }));
16537
+ } else {
16538
+ const q = camera.project([catPos(i), 0, 0]);
16539
+ out.push(text(q.x, q.y + LABEL_SIZE + 3, label, { anchor: "middle", size: LABEL_SIZE }));
16540
+ }
16541
+ });
16542
+ return out.join("");
16543
+ }
16544
+
16545
+ // chart/render/chart-3d-svg.ts
16546
+ var PROJECTION_TYPE = {
16547
+ bar: "bar3D",
16548
+ column: "bar3D",
16549
+ line: "line3D",
16550
+ area: "area3D",
16551
+ pie: "pie3D",
16552
+ surface: "surface"
16553
+ };
16554
+ function chart3DApplies(model) {
16555
+ return model.view3D !== void 0 && PROJECTION_TYPE[model.type] !== void 0;
16556
+ }
16557
+ function chart3DSvg(model, area) {
16558
+ const view = model.view3D ?? {};
16559
+ if (model.type === "pie")
16560
+ return chartAreaRect(model, "plotArea", area) + chart3DPieSvg(model, area, view);
16561
+ const projection = resolveChart3DProjection(PROJECTION_TYPE[model.type] ?? "bar3D", view);
16562
+ const margins = chart3DLabelMargins(model);
16563
+ const inner = {
16564
+ x: area.x + margins.left,
16565
+ y: area.y + 6,
16566
+ w: Math.max(1, area.w - margins.left - 8),
16567
+ h: Math.max(1, area.h - margins.bottom - 10)
16568
+ };
16569
+ const layout = chart3DLayout(model, inner, view);
16570
+ const camera = createChart3DCamera(projection, layout.size, inner);
16571
+ let meshes;
16572
+ if (model.type === "surface") meshes = chart3DSurfaceMeshes(model, layout);
16573
+ else if (model.type === "line") meshes = chart3DLineMeshes(model, layout);
16574
+ else if (model.type === "area") meshes = chart3DAreaMeshes(model, layout);
16575
+ else meshes = chart3DBarMeshes(model, layout);
16576
+ const edge = model.type === "area" || model.type === "surface";
16577
+ const cats = model.categories.length;
16578
+ const catPos = edge ? (i) => cats > 1 ? i / (cats - 1) * layout.catLength : layout.catLength / 2 : (i) => (i + 0.5) * layout.band;
16579
+ return [
16580
+ chartAreaRect(model, "plotArea", area),
16581
+ chart3DWallsSvg(model, layout, camera),
16582
+ chart3DMeshesSvg(camera, meshes),
16583
+ chart3DLabelsSvg(model, layout, camera, catPos)
16584
+ ].join("");
16585
+ }
16586
+
16587
+ // chart/region-map/alias.ts
16588
+ var REGION_ALIAS_MAP = {
16589
+ us: "US",
16590
+ usa: "US",
16591
+ "united states": "US",
16592
+ "united states of america": "US",
16593
+ ca: "CA",
16594
+ can: "CA",
16595
+ canada: "CA",
16596
+ br: "BR",
16597
+ bra: "BR",
16598
+ brazil: "BR",
16599
+ gb: "GB",
16600
+ gbr: "GB",
16601
+ uk: "GB",
16602
+ "united kingdom": "GB",
16603
+ fr: "FR",
16604
+ fra: "FR",
16605
+ france: "FR",
16606
+ de: "DE",
16607
+ deu: "DE",
16608
+ germany: "DE",
16609
+ it: "IT",
16610
+ ita: "IT",
16611
+ italy: "IT",
16612
+ es: "ES",
16613
+ esp: "ES",
16614
+ spain: "ES",
16615
+ ru: "RU",
16616
+ rus: "RU",
16617
+ russia: "RU",
16618
+ cn: "CN",
16619
+ chn: "CN",
16620
+ china: "CN",
16621
+ in: "IN",
16622
+ ind: "IN",
16623
+ india: "IN",
16624
+ jp: "JP",
16625
+ jpn: "JP",
16626
+ japan: "JP",
16627
+ kr: "KR",
16628
+ kor: "KR",
16629
+ "south korea": "KR",
16630
+ korea: "KR",
16631
+ au: "AU",
16632
+ aus: "AU",
16633
+ australia: "AU",
16634
+ mx: "MX",
16635
+ mex: "MX",
16636
+ mexico: "MX",
16637
+ id: "ID",
16638
+ idn: "ID",
16639
+ indonesia: "ID",
16640
+ tr: "TR",
16641
+ tur: "TR",
16642
+ turkey: "TR",
16643
+ sa: "SA",
16644
+ sau: "SA",
16645
+ "saudi arabia": "SA",
16646
+ za: "ZA",
16647
+ zaf: "ZA",
16648
+ "south africa": "ZA",
16649
+ ar: "AR",
16650
+ arg: "AR",
16651
+ argentina: "AR",
16652
+ ng: "NG",
16653
+ nga: "NG",
16654
+ nigeria: "NG",
16655
+ eg: "EG",
16656
+ egy: "EG",
16657
+ egypt: "EG"
16658
+ };
16659
+ function resolveRegionCode(label) {
16660
+ const normalized = label.trim().toLowerCase();
16661
+ return REGION_ALIAS_MAP[normalized];
16662
+ }
16663
+
16664
+ // chart/region-map/data.ts
16665
+ function sourceIndices(indices, length) {
16666
+ return Array.from({ length }, (_, position) => indices?.[position] ?? position);
16667
+ }
16668
+ function valueAtSource(values, indices, sourceIndex) {
16669
+ const position = indices.indexOf(sourceIndex);
16670
+ return position >= 0 ? values[position] : void 0;
16671
+ }
16672
+ function cachedEntityName(cache2, entityId) {
16673
+ if (!cache2 || typeof cache2 !== "object") {
16674
+ return void 0;
16675
+ }
16676
+ const record = cache2;
16677
+ if (String(record["@_entityId"] ?? "") === entityId && record["@_entityName"] !== void 0) {
16678
+ return String(record["@_entityName"]);
16679
+ }
16680
+ for (const value of Object.values(record)) {
16681
+ if (Array.isArray(value)) {
16682
+ for (const item of value) {
16683
+ const name = cachedEntityName(item, entityId);
16684
+ if (name) {
16685
+ return name;
16686
+ }
16687
+ }
16688
+ } else {
16689
+ const name = cachedEntityName(value, entityId);
16690
+ if (name) {
16691
+ return name;
16692
+ }
16693
+ }
16694
+ }
16695
+ return void 0;
16696
+ }
16697
+ function resolveRegionEntityCode(entityId, options2, resolveCode) {
16698
+ if (!entityId) {
16699
+ return void 0;
16700
+ }
16701
+ const direct = resolveCode(entityId);
16702
+ if (direct) {
16703
+ return direct;
16704
+ }
16705
+ const tokens = entityId.split(/[:/|._-]+/u).filter(Boolean);
16706
+ for (let index = tokens.length - 1; index >= 0; index--) {
16707
+ const resolved = resolveCode(tokens[index] ?? "");
16708
+ if (resolved) {
16709
+ return resolved;
16710
+ }
16711
+ }
16712
+ const cachedName = cachedEntityName(options2?.geographyCache, entityId);
16713
+ return cachedName ? resolveCode(cachedName) : void 0;
16714
+ }
16715
+ function buildRegionMapEntries(categories, values, options2, resolveCode) {
16716
+ const entityIds = options2?.entityIds ?? [];
16717
+ const categoryIndices = sourceIndices(options2?.categorySourceIndices, categories.length);
16718
+ const valueIndices = sourceIndices(options2?.valueSourceIndices, values.length);
16719
+ const entityIndices = sourceIndices(options2?.entityIdSourceIndices, entityIds.length);
16720
+ const indices = [.../* @__PURE__ */ new Set([...categoryIndices, ...valueIndices, ...entityIndices])].sort(
16721
+ (a, b) => a - b
16722
+ );
16723
+ return indices.flatMap((sourceIndex) => {
16724
+ const category = valueAtSource(categories, categoryIndices, sourceIndex) ?? "";
16725
+ const value = valueAtSource(values, valueIndices, sourceIndex);
16726
+ if (value === null || value === void 0 || !Number.isFinite(value)) return [];
16727
+ const entityId = valueAtSource(entityIds, entityIndices, sourceIndex);
16728
+ const code = resolveRegionEntityCode(entityId, options2, resolveCode) ?? resolveCode(category);
16729
+ return {
16730
+ sourceIndex,
16731
+ label: category || entityId || `Region ${sourceIndex + 1}`,
16732
+ value,
16733
+ ...entityId ? { entityId } : {},
16734
+ ...code ? { code } : {}
16735
+ };
16736
+ });
16737
+ }
16738
+ function shouldRenderRegionLabel(layout, projectedWidth, projectedHeight) {
16739
+ if (!layout || layout === "none") {
16740
+ return false;
16741
+ }
16742
+ if (layout === "bestFitOnly") {
16743
+ return projectedWidth >= 18 && projectedHeight >= 10;
16744
+ }
16745
+ return true;
16746
+ }
16747
+ function formatRegionMapValue(value, cultureLanguage) {
16748
+ if (!cultureLanguage) {
16749
+ return String(value);
16750
+ }
16751
+ try {
16752
+ return new Intl.NumberFormat(cultureLanguage, { maximumFractionDigits: 2 }).format(value);
16753
+ } catch {
16754
+ return String(value);
16755
+ }
16756
+ }
16757
+ function lerpColor(a, b, t) {
16758
+ const clamp3 = (v) => Math.max(0, Math.min(255, Math.round(v))), ha = a.replace("#", ""), hb = b.replace("#", ""), r1 = parseInt(ha.substring(0, 2), 16), g1 = parseInt(ha.substring(2, 4), 16), b1 = parseInt(ha.substring(4, 6), 16), r2 = parseInt(hb.substring(0, 2), 16), g2 = parseInt(hb.substring(2, 4), 16), b2 = parseInt(hb.substring(4, 6), 16), r = clamp3(r1 + (r2 - r1) * t), g = clamp3(g1 + (g2 - g1) * t), bl = clamp3(b1 + (b2 - b1) * t), toHex2 = (n2) => n2.toString(16).padStart(2, "0");
16759
+ return `#${toHex2(r)}${toHex2(g)}${toHex2(bl)}`;
16760
+ }
16761
+ function resolveValueColorStops(valueColors, valueColorPositions, minVal, maxVal) {
16762
+ if (!valueColors || valueColors.length < 2) {
16763
+ return void 0;
16764
+ }
16765
+ const span = maxVal - minVal || 1, count = valueColors.length, resolvePosition = (position, index) => {
16766
+ if (position?.kind === "min") {
16767
+ return 0;
16768
+ }
16769
+ if (position?.kind === "max") {
16770
+ return 1;
16771
+ }
16772
+ if (position?.kind === "number" && position.value !== void 0) {
16773
+ return Math.min(1, Math.max(0, (position.value - minVal) / span));
16774
+ }
16775
+ if (position?.kind === "percent" && position.value !== void 0) {
16776
+ return Math.min(1, Math.max(0, position.value / 100));
16777
+ }
16778
+ return count === 1 ? 0 : index / (count - 1);
16779
+ };
16780
+ return valueColors.map((color, index) => ({
16781
+ color,
16782
+ position: resolvePosition(valueColorPositions?.[index], index)
16783
+ }));
16784
+ }
16785
+ function buildValueColorScale(stops) {
16786
+ const sorted = [...stops].sort((a, b) => a.position - b.position);
16787
+ return (t) => {
16788
+ const clamped = Math.max(0, Math.min(1, t)), first3 = sorted[0];
16789
+ if (!first3) {
16790
+ return "#94a3b8";
16791
+ }
16792
+ if (sorted.length === 1) {
16793
+ return first3.color;
16794
+ }
16795
+ for (let i = 0; i < sorted.length - 1; i++) {
16796
+ const a = sorted[i], b = sorted[i + 1];
16797
+ if (clamped >= a.position && clamped <= b.position) {
16798
+ return lerpColor(
16799
+ a.color,
16800
+ b.color,
16801
+ (clamped - a.position) / (b.position - a.position || 1)
16802
+ );
16803
+ }
16804
+ }
16805
+ const last = sorted[sorted.length - 1] ?? first3;
16806
+ return clamped <= first3.position ? first3.color : last.color;
16807
+ };
16808
+ }
16809
+
16810
+ // chart/region-map/colors.ts
16811
+ function sequentialColorScale(t, accent) {
16812
+ const clamped = Math.max(0, Math.min(1, t));
16813
+ if (accent && /^#[0-9a-f]{6}$/iu.test(accent))
16814
+ return lerpColor(lerpColor("#ffffff", accent, 0.2), accent, clamped);
16815
+ if (clamped <= 0.5) {
16816
+ return lerpColor("#dbeafe", "#3b82f6", clamped * 2);
16817
+ }
16818
+ return lerpColor("#3b82f6", "#1e3a5f", (clamped - 0.5) * 2);
16819
+ }
16820
+ function normalizeValue(value, min, max) {
16821
+ if (max === min) {
16822
+ return 0.5;
16823
+ }
16824
+ return (value - min) / (max - min);
16825
+ }
16826
+
16827
+ // chart/region-map/world-regions.ts
16828
+ var WORLD_REGIONS = [
16829
+ {
16830
+ code: "US",
16831
+ name: "United States",
16832
+ path: "M130,160 L250,155 265,170 270,190 260,210 230,215 200,220 170,215 145,205 130,195Z M280,175 L295,165 310,170 310,185 295,195 280,190Z",
16833
+ labelXY: [200, 190]
16834
+ },
16835
+ {
16836
+ code: "CA",
16837
+ name: "Canada",
16838
+ path: "M120,90 L280,85 290,100 295,130 280,150 250,155 200,155 160,155 130,155 115,140 110,115Z",
16839
+ labelXY: [200, 125]
16840
+ },
16841
+ {
16842
+ code: "MX",
16843
+ name: "Mexico",
16844
+ path: "M145,215 L200,220 210,235 200,255 185,265 165,260 150,245 140,230Z",
16845
+ labelXY: [175, 240]
16846
+ },
16847
+ {
16848
+ code: "BR",
16849
+ name: "Brazil",
16850
+ path: "M270,300 L310,280 335,290 340,320 330,355 310,370 285,365 265,345 260,320Z",
16851
+ labelXY: [300, 330]
16852
+ },
16853
+ {
16854
+ code: "AR",
16855
+ name: "Argentina",
16856
+ path: "M260,370 L280,365 290,380 285,410 275,435 260,445 250,425 248,395Z",
16857
+ labelXY: [268, 410]
16858
+ },
16859
+ {
16860
+ code: "GB",
16861
+ name: "United Kingdom",
16862
+ path: "M440,120 L448,110 455,115 455,135 448,142 440,138Z",
16863
+ labelXY: [448, 128]
16864
+ },
16865
+ {
16866
+ code: "FR",
16867
+ name: "France",
16868
+ path: "M450,145 L470,140 480,150 478,168 465,175 450,170 445,158Z",
16869
+ labelXY: [463, 158]
16870
+ },
16871
+ {
16872
+ code: "DE",
16873
+ name: "Germany",
16874
+ path: "M478,125 L498,120 505,130 502,148 490,152 478,148 475,138Z",
16875
+ labelXY: [490, 138]
16876
+ },
16877
+ {
16878
+ code: "IT",
16879
+ name: "Italy",
16880
+ path: "M490,155 L498,152 505,162 500,180 492,190 488,178 486,165Z",
16881
+ labelXY: [495, 172]
16882
+ },
16883
+ {
16884
+ code: "ES",
16885
+ name: "Spain",
16886
+ path: "M432,168 L460,165 465,175 460,188 442,192 430,185 428,175Z",
16887
+ labelXY: [448, 180]
16888
+ },
16889
+ {
16890
+ code: "RU",
16891
+ name: "Russia",
16892
+ path: "M510,60 L780,50 830,70 840,100 820,120 750,115 700,105 650,100 580,105 530,110 510,100 505,80Z",
16893
+ labelXY: [670, 85]
16894
+ },
16895
+ {
16896
+ code: "TR",
16897
+ name: "Turkey",
16898
+ path: "M530,165 L570,160 585,170 580,182 555,185 530,180Z",
16899
+ labelXY: [558, 175]
16900
+ },
16901
+ {
16902
+ code: "EG",
16903
+ name: "Egypt",
16904
+ path: "M530,200 L555,195 565,205 560,225 545,230 530,222Z",
16905
+ labelXY: [548, 215]
16906
+ },
16907
+ {
16908
+ code: "NG",
16909
+ name: "Nigeria",
16910
+ path: "M475,275 L500,270 510,280 505,298 490,302 475,295Z",
16911
+ labelXY: [492, 288]
16912
+ },
16913
+ {
16914
+ code: "ZA",
16915
+ name: "South Africa",
16916
+ path: "M520,380 L545,370 560,380 555,400 540,410 520,405 515,392Z",
16917
+ labelXY: [538, 392]
16918
+ },
16919
+ {
16920
+ code: "SA",
16921
+ name: "Saudi Arabia",
16922
+ path: "M565,220 L600,210 615,225 610,250 590,258 570,250 560,238Z",
16923
+ labelXY: [590, 238]
16924
+ },
16925
+ {
16926
+ code: "IN",
16927
+ name: "India",
16928
+ path: "M640,210 L665,195 685,210 688,240 678,268 660,278 645,265 635,240Z",
16929
+ labelXY: [662, 240]
16930
+ },
16931
+ {
16932
+ code: "CN",
16933
+ name: "China",
16934
+ path: "M700,120 L775,115 800,130 805,160 790,180 760,185 730,180 710,168 695,150 690,135Z",
16935
+ labelXY: [750, 155]
16936
+ },
16937
+ {
16938
+ code: "JP",
16939
+ name: "Japan",
16940
+ path: "M835,145 L845,135 852,140 850,158 842,165 835,160Z",
16941
+ labelXY: [843, 152]
16942
+ },
16943
+ {
16944
+ code: "KR",
16945
+ name: "South Korea",
16946
+ path: "M815,158 L825,152 830,160 827,170 818,172 813,165Z",
16947
+ labelXY: [822, 163]
16948
+ },
16949
+ {
16950
+ code: "ID",
16951
+ name: "Indonesia",
16952
+ path: "M740,295 L780,288 810,292 830,298 825,310 790,312 755,308 740,305Z",
16953
+ labelXY: [785, 302]
16954
+ },
16955
+ {
16956
+ code: "AU",
16957
+ name: "Australia",
16958
+ path: "M790,350 L850,340 880,355 885,385 870,405 840,410 810,400 790,380Z",
16959
+ labelXY: [838, 378]
16960
+ }
16961
+ ];
16962
+
16963
+ // chart/region-map/projection.ts
16964
+ function regionBounds(region) {
16965
+ const coordinates = region.path.match(/-?\d+(?:\.\d+)?/gu)?.map(Number) ?? [];
16966
+ let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
16967
+ for (let index = 0; index < coordinates.length; index += 2) {
16968
+ const x = coordinates[index] ?? 0, y = coordinates[index + 1] ?? 0;
16969
+ minX = Math.min(minX, x);
16970
+ maxX = Math.max(maxX, x);
16971
+ minY = Math.min(minY, y);
16972
+ maxY = Math.max(maxY, y);
16973
+ }
16974
+ return { minX, minY, maxX, maxY };
16975
+ }
16976
+ function regionViewBounds(viewedRegionType, regionValues, regions = WORLD_REGIONS) {
16977
+ if (!viewedRegionType || viewedRegionType === "world" || regionValues.size === 0) {
16978
+ return { minX: 0, minY: 0, maxX: 1e3, maxY: 500 };
16979
+ }
16980
+ const matched = regions.filter((region) => regionValues.has(region.code));
16981
+ const targets = viewedRegionType === "countryRegion" ? matched.slice(0, 1) : matched;
16982
+ if (targets.length === 0) {
16983
+ return { minX: 0, minY: 0, maxX: 1e3, maxY: 500 };
16984
+ }
16985
+ const bounds = targets.map(regionBounds);
16986
+ const padding = 10;
16987
+ return {
16988
+ minX: Math.max(0, Math.min(...bounds.map((item) => item.minX)) - padding),
16989
+ minY: Math.max(0, Math.min(...bounds.map((item) => item.minY)) - padding),
16990
+ maxX: Math.min(1e3, Math.max(...bounds.map((item) => item.maxX)) + padding),
16991
+ maxY: Math.min(500, Math.max(...bounds.map((item) => item.maxY)) + padding)
16992
+ };
16993
+ }
16994
+ function scalePathD(d, scale, dx, dy) {
16995
+ const tokens = d.match(/[A-Za-z]|-?\d+(?:\.\d+)?/gu) ?? [];
16996
+ const out = [];
16997
+ let i = 0;
16998
+ while (i < tokens.length) {
16999
+ const tok = tokens[i];
17000
+ if (tok === void 0) {
17001
+ i++;
17002
+ continue;
17003
+ }
17004
+ if (/^[A-Za-z]$/u.test(tok)) {
17005
+ out.push(tok);
17006
+ i++;
17007
+ continue;
17008
+ }
17009
+ const xRaw = parseFloat(tok);
17010
+ const yRaw = parseFloat(tokens[i + 1] ?? "");
17011
+ if (!Number.isNaN(xRaw) && !Number.isNaN(yRaw)) {
17012
+ out.push(`${(xRaw * scale + dx).toFixed(2)},${(yRaw * scale + dy).toFixed(2)}`);
17013
+ i += 2;
17014
+ } else {
17015
+ out.push(tok);
17016
+ i++;
17017
+ }
17018
+ }
17019
+ return out.join(" ");
17020
+ }
17021
+ var CX = "http://schemas.microsoft.com/office/drawing/2014/chartex";
17022
+ var LIMIT = 16 * 1024 * 1024;
17023
+ var ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";
17024
+ function decodeGeoRing(encoded, limit = 1e6) {
17025
+ const out = [];
17026
+ let lat = 0, lon = 0, number = 0, shift = 0;
17027
+ for (const ch of encoded) {
17028
+ const value = ALPHABET.indexOf(ch);
17029
+ if (value < 0 || shift > 50) return void 0;
17030
+ number += (value & 31) * 2 ** shift;
17031
+ if (!Number.isSafeInteger(number)) return void 0;
17032
+ if (value >= 32) {
17033
+ shift += 5;
17034
+ continue;
17035
+ }
17036
+ const diagonal = Math.floor((Math.sqrt(8 * number + 1) - 1) / 2);
17037
+ const a = number - diagonal * (diagonal + 1) / 2, b = diagonal - a;
17038
+ lat += a % 2 ? -(a + 1) / 2 : a / 2;
17039
+ lon += b % 2 ? -(b + 1) / 2 : b / 2;
17040
+ if (Math.abs(lat) > 9e6 || Math.abs(lon) > 54e6 || out.length >= limit) return void 0;
17041
+ out.push({ latitude: lat / 1e5, longitude: lon / 1e5 });
17042
+ number = 0;
17043
+ shift = 0;
17044
+ }
17045
+ return shift || out.length < 3 ? void 0 : out;
17046
+ }
17047
+ function elements2(root, name) {
17048
+ return Array.from(root.getElementsByTagNameNS(CX, name));
17049
+ }
17050
+ function inflateGeoCache(binary, maxOutputBytes = LIMIT) {
17051
+ if (!Number.isSafeInteger(maxOutputBytes) || maxOutputBytes < 1 || maxOutputBytes > LIMIT)
17052
+ throw new Error("Invalid geography cache output limit.");
17053
+ if (binary.length > 12 * 1024 * 1024) throw new Error("Geography cache input limit exceeded.");
17054
+ const bytes = Uint8Array.from(atob(binary.replace(/\s/gu, "")), (c) => c.charCodeAt(0));
17055
+ const chunks = [];
17056
+ let size = 0;
17057
+ const stream = new fflate.Inflate((chunk) => {
17058
+ size += chunk.length;
17059
+ if (size > maxOutputBytes) throw new Error("Geography cache output limit exceeded.");
17060
+ chunks.push(chunk);
17061
+ });
17062
+ for (let i = 0; i < bytes.length; i += 256)
17063
+ stream.push(bytes.subarray(i, i + 256), false);
17064
+ const out = new Uint8Array(size);
17065
+ let offset = 0;
17066
+ for (const chunk of chunks) {
17067
+ out.set(chunk, offset);
17068
+ offset += chunk.length;
17069
+ }
17070
+ return new TextDecoder("utf-8", { fatal: true }).decode(out);
17071
+ }
17072
+ function readGeographyCache(xml, pointLimit = 1e6) {
17073
+ const result = { regions: [], issues: [] };
17074
+ if (!xml) return result;
17075
+ try {
17076
+ if (!Number.isSafeInteger(pointLimit) || pointLimit < 1 || pointLimit > 1e6)
17077
+ throw new Error("Invalid geography point limit.");
17078
+ if (xml.length > LIMIT) throw new Error("Geography cache input limit exceeded.");
17079
+ let root = parseXml(`<cx:root xmlns:cx="${CX}">${xml}</cx:root>`).documentElement;
17080
+ const binary = elements2(root, "binary")[0];
17081
+ if (binary) root = parseXml(inflateGeoCache(binary.textContent ?? "")).documentElement;
17082
+ let points = 0;
17083
+ for (const data of elements2(root, "geoData")) {
17084
+ const rings = [];
17085
+ for (const polygon of elements2(data, "geoPolygon")) {
17086
+ const parts = (polygon.getAttribute("pcaRings") ?? "").split(",");
17087
+ const version = Number(parts.shift());
17088
+ const expected = Number(polygon.getAttribute("numPoints"));
17089
+ if (version !== 1 || parts.length < 1 || !Number.isInteger(expected) || expected < 3) {
17090
+ result.issues.push("Invalid geography ring count.");
17091
+ continue;
17092
+ }
17093
+ const decoded = [];
17094
+ let polygonPoints2 = 0;
17095
+ for (const part of parts) {
17096
+ const ring = decodeGeoRing(
17097
+ part,
17098
+ Math.min(expected - polygonPoints2, pointLimit - points - polygonPoints2)
17099
+ );
17100
+ if (!ring) break;
17101
+ decoded.push(ring);
17102
+ polygonPoints2 += ring.length;
17103
+ }
17104
+ if (decoded.length !== parts.length) {
17105
+ result.issues.push("Invalid compressed geography polygon.");
17106
+ continue;
17107
+ }
17108
+ for (const ring of decoded) {
17109
+ rings.push(ring);
17110
+ points += ring.length;
17111
+ }
17112
+ }
17113
+ if (rings.length)
17114
+ result.regions.push({
17115
+ entityId: data.getAttribute("entityId") ?? "",
17116
+ name: data.getAttribute("entityName") ?? "",
17117
+ rings,
17118
+ copyright: elements2(data, "copyright").map((c) => c.textContent ?? "")
17119
+ });
17120
+ }
17121
+ } catch (error) {
17122
+ result.issues.push(error instanceof Error ? error.message : String(error));
17123
+ }
17124
+ return result;
17125
+ }
17126
+
17127
+ // chart/region-map/geographic-projection.ts
17128
+ var RAD = Math.PI / 180;
17129
+ var RX = [
17130
+ 1,
17131
+ 0.9986,
17132
+ 0.9954,
17133
+ 0.99,
17134
+ 0.9822,
17135
+ 0.973,
17136
+ 0.96,
17137
+ 0.9427,
17138
+ 0.9216,
17139
+ 0.8962,
17140
+ 0.8679,
17141
+ 0.835,
17142
+ 0.7986,
17143
+ 0.7597,
17144
+ 0.7186,
17145
+ 0.6732,
17146
+ 0.6213,
17147
+ 0.5722,
17148
+ 0.5322
17149
+ ];
17150
+ var RY = [
17151
+ 0,
17152
+ 0.062,
17153
+ 0.124,
17154
+ 0.186,
17155
+ 0.248,
17156
+ 0.31,
17157
+ 0.372,
17158
+ 0.434,
17159
+ 0.4958,
17160
+ 0.5571,
17161
+ 0.6176,
17162
+ 0.6769,
17163
+ 0.7346,
17164
+ 0.7903,
17165
+ 0.8435,
17166
+ 0.8936,
17167
+ 0.9394,
17168
+ 0.9761,
17169
+ 1
17170
+ ];
17171
+ function projectGeoPoint(point, projection = "mercator") {
17172
+ const lon = point.longitude * RAD, lat = Math.max(-89.999, Math.min(89.999, point.latitude)) * RAD;
17173
+ if (projection === "mercator")
17174
+ return [
17175
+ lon,
17176
+ -Math.log(
17177
+ Math.tan(Math.PI / 4 + Math.max(-85.05112878 * RAD, Math.min(85.05112878 * RAD, lat)) / 2)
17178
+ )
17179
+ ];
17180
+ if (projection === "miller") return [lon, -1.25 * Math.log(Math.tan(Math.PI / 4 + 0.4 * lat))];
17181
+ if (projection === "robinson") {
17182
+ const index = Math.min(17, Math.floor(Math.abs(point.latitude) / 5)), t = Math.min(1, Math.abs(point.latitude) / 5 - index);
17183
+ return [
17184
+ 0.8487 * lon * (RX[index] + (RX[index + 1] - RX[index]) * t),
17185
+ -1.3523 * Math.sign(lat) * (RY[index] + (RY[index + 1] - RY[index]) * t)
17186
+ ];
17187
+ }
17188
+ if (projection === "albers") {
17189
+ const n2 = (Math.sin(20 * RAD) + Math.sin(50 * RAD)) / 2;
17190
+ const c = Math.cos(20 * RAD) ** 2 + 2 * n2 * Math.sin(20 * RAD);
17191
+ const rho = Math.sqrt(Math.max(0, c - 2 * n2 * Math.sin(lat))) / n2;
17192
+ return [rho * Math.sin(n2 * lon), rho * Math.cos(n2 * lon) - Math.sqrt(c) / n2];
17193
+ }
17194
+ return void 0;
17195
+ }
17196
+
17197
+ // chart/region-map/geometry.ts
17198
+ function regionMapGeometry(options2) {
17199
+ const cache2 = readGeographyCache(options2?.geographyCacheXml);
17200
+ if (!cache2.regions.length)
17201
+ return { regions: WORLD_REGIONS, approximate: true, issues: cache2.issues, copyright: [] };
17202
+ const projection = options2?.projectionType ?? "robinson";
17203
+ const projected = cache2.regions.map((region) => ({
17204
+ region,
17205
+ rings: region.rings.map((ring) => ring.map((p) => projectGeoPoint(p, projection)))
17206
+ }));
17207
+ if (projected.some((r) => r.rings.some((ring) => ring.some((p) => !p))))
17208
+ return {
17209
+ regions: [],
17210
+ approximate: false,
17211
+ issues: [...cache2.issues, "Unsupported geographic projection."],
17212
+ copyright: []
17213
+ };
17214
+ const all = projected.flatMap((r) => r.rings.flatMap((ring) => ring));
17215
+ let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
17216
+ for (const [x, y] of all) {
17217
+ minX = Math.min(minX, x);
17218
+ maxX = Math.max(maxX, x);
17219
+ minY = Math.min(minY, y);
17220
+ maxY = Math.max(maxY, y);
17221
+ }
17222
+ const factor = Math.min(1e3 / Math.max(maxX - minX, 1e-12), 500 / Math.max(maxY - minY, 1e-12));
17223
+ const sx = factor, sy = factor, ox = (1e3 - (maxX - minX) * factor) / 2, oy = (500 - (maxY - minY) * factor) / 2;
17224
+ const regions = projected.map(({ region, rings }) => {
17225
+ const paths = rings.map(
17226
+ (ring) => ring.map((p) => {
17227
+ const [x2, y2] = p;
17228
+ return [(x2 - minX) * sx + ox, (y2 - minY) * sy + oy];
17229
+ })
17230
+ );
17231
+ const coords = paths.flat();
17232
+ let x = 0, y = 0;
17233
+ for (const p of coords) {
17234
+ x += p[0];
17235
+ y += p[1];
17236
+ }
17237
+ return {
17238
+ code: resolveRegionCode(region.name) ?? region.entityId,
17239
+ entityId: region.entityId,
17240
+ name: region.name,
17241
+ labelXY: [x / coords.length, y / coords.length],
17242
+ path: paths.map(
17243
+ (r) => r.map((p, i) => `${i ? "L" : "M"}${p[0].toFixed(3)},${p[1].toFixed(3)}`).join(" ") + "Z"
17244
+ ).join(" ")
17245
+ };
17246
+ });
17247
+ return {
17248
+ regions,
17249
+ approximate: false,
17250
+ issues: cache2.issues,
17251
+ copyright: [...new Set(cache2.regions.flatMap((r) => r.copyright))]
17252
+ };
17253
+ }
17254
+
17255
+ // chart/render/chart-svg-region-map.ts
17256
+ function regionMapSvg(model, area, approximationLabel) {
17257
+ const series = model.series[0];
17258
+ if (!series || series.hidden) return "";
17259
+ const options2 = model.regionMap;
17260
+ const geometry = regionMapGeometry(options2);
17261
+ const resolve = (label) => geometry.regions.find(
17262
+ (r) => r.entityId === label || r.code === label || r.name.toLowerCase() === label.toLowerCase()
17263
+ )?.code ?? resolveRegionCode(label);
17264
+ const entries = buildRegionMapEntries(model.categories, series.values, options2, resolve);
17265
+ const min = entries.length ? Math.min(...entries.map((e) => e.value)) : 0, max = entries.length ? Math.max(...entries.map((e) => e.value)) : 1;
17266
+ const stops = resolveValueColorStops(
17267
+ options2?.valueColors,
17268
+ options2?.valueColorPositions,
17269
+ min,
17270
+ max
17271
+ );
17272
+ const colors = stops ? buildValueColorScale(stops) : (t) => sequentialColorScale(t, series.color);
17273
+ const matched = new Map(entries.filter((e) => e.code).map((e) => [e.code, e]));
17274
+ const missing = entries.filter(
17275
+ (e) => !e.code || !geometry.regions.some((r) => r.code === e.code)
17276
+ );
17277
+ const bounds = regionViewBounds(options2?.viewedRegionType, matched, geometry.regions);
17278
+ const width = bounds.maxX - bounds.minX || 1, height = bounds.maxY - bounds.minY || 1;
17279
+ const reserve = (model.showLegend ? 46 : 12) + Math.min(missing.length, 5) * 14 + (geometry.approximate && approximationLabel ? 14 : 0);
17280
+ const scale = Math.max(
17281
+ 1e-5,
17282
+ Math.min(Math.max(1, area.w - 8) / width, Math.max(1, area.h - reserve) / height)
17283
+ );
17284
+ const dx = area.x + (area.w - width * scale) / 2 - bounds.minX * scale, dy = area.y - bounds.minY * scale;
17285
+ const out = [
17286
+ `<g data-chart-part="regionMap" data-map-geometry="${geometry.approximate ? "approximate" : "cached"}"${geometry.approximate ? ' data-map-report="approximate-country-outlines"' : ""}${geometry.issues.length ? ' data-map-partial="true"' : ""}>`
17287
+ ];
17288
+ out.push(
17289
+ `<svg x="${area.x}" y="${area.y}" width="${area.w}" height="${Math.max(1, area.h - reserve)}" viewBox="${area.x} ${area.y} ${area.w} ${Math.max(1, area.h - reserve)}" overflow="hidden">`
17290
+ );
17291
+ for (const region of geometry.regions) {
17292
+ const entry = matched.get(region.code);
17293
+ out.push(
17294
+ `<path d="${scalePathD(region.path, scale, dx, dy)}" fill="${esc(options2?.fixedColor ?? (entry ? colors(normalizeValue(entry.value, min, max)) : "#e2e8f0"))}" stroke="${esc(series.stroke?.color ?? "none")}" stroke-width="${series.stroke?.width ?? 0}" fill-rule="evenodd"${entry ? ` data-chart-series="0" data-chart-point="${entry.sourceIndex}"` : ""}><title>${esc(region.name)}${entry ? ": " + esc(formatRegionMapValue(entry.value, options2?.cultureLanguage)) : ""}</title></path>`
17295
+ );
17296
+ const b = regionBounds(region);
17297
+ if (entry && shouldRenderRegionLabel(
17298
+ options2?.regionLabelLayout,
17299
+ (b.maxX - b.minX) * scale,
17300
+ (b.maxY - b.minY) * scale
17301
+ ))
17302
+ out.push(
17303
+ text(region.labelXY[0] * scale + dx, region.labelXY[1] * scale + dy, region.name, {
17304
+ size: 8,
17305
+ anchor: "middle"
17306
+ })
17307
+ );
17308
+ const label = entry && series.labels?.[entry.sourceIndex];
17309
+ if (label)
17310
+ draw(
17311
+ measure(model, label),
17312
+ label,
17313
+ region.labelXY[0] * scale + dx,
17314
+ region.labelXY[1] * scale + dy,
17315
+ "middle",
17316
+ out
17317
+ );
17318
+ }
17319
+ out.push("</svg>");
17320
+ const y = area.y + height * scale + 5, bar = Math.min(160, area.w * 0.4), left = area.x + (area.w - bar) / 2;
17321
+ if (model.showLegend) {
17322
+ const attrs2 = chartTextAttributes(model, "legend", 16), size = attrs2.size ?? 16;
17323
+ out.push(text(left - 8, y + size * 0.4, series.name, { ...attrs2, anchor: "end" }));
17324
+ for (let i = 0; i < 32; i++)
17325
+ out.push(rect2(left + i * bar / 32, y, bar / 32 + 0.1, 7, colors((i + 0.5) / 32)));
17326
+ out.push(
17327
+ text(left, y + 8 + size, String(min), attrs2),
17328
+ text(left + bar, y + 8 + size, String(max), { ...attrs2, anchor: "end" })
15635
17329
  );
15636
- else
17330
+ }
17331
+ let row2 = y + (model.showLegend ? 32 : 0);
17332
+ if (geometry.approximate && approximationLabel) {
17333
+ out.push(text(area.x, row2, approximationLabel, { size: 8 }));
17334
+ row2 += 14;
17335
+ }
17336
+ for (const entry of missing.slice(0, 5)) {
15637
17337
  out.push(
15638
- axisLine(model, model.axes?.category, "categoryAxis", plot.x, zero, plot.x + plot.w, zero)
17338
+ text(
17339
+ area.x,
17340
+ row2,
17341
+ `${entry.label}: ${formatRegionMapValue(entry.value, options2?.cultureLanguage)}`,
17342
+ { size: 9 }
17343
+ )
15639
17344
  );
15640
- out.push(...dateMarkup);
15641
- const step = Math.max(
15642
- 1,
15643
- Math.ceil(cats / Math.max(1, Math.floor((horizontal ? plot.h : plot.w) / 14)))
17345
+ row2 += 14;
17346
+ }
17347
+ const credits = [options2?.attribution, ...geometry.copyright].filter(Boolean).join("; ");
17348
+ if (credits)
17349
+ out.push(
17350
+ `<title>${esc(credits)}</title>`,
17351
+ text(
17352
+ area.x,
17353
+ area.y + area.h - 1,
17354
+ credits.length > 180 ? credits.slice(0, 177) + "..." : credits,
17355
+ { size: 6 }
17356
+ )
17357
+ );
17358
+ return out.join("") + "</g>";
17359
+ }
17360
+
17361
+ // chart/funnel-geometry.ts
17362
+ function computeFunnelGeometry(values, plot, gapWidth = 33) {
17363
+ const max = Math.max(...values.map((v) => Math.abs(v)), 1);
17364
+ const band = plot.height / Math.max(1, values.length);
17365
+ const gap = Number.isFinite(gapWidth) && gapWidth >= 0 ? gapWidth : 33;
17366
+ const height = band / (1 + gap / 100);
17367
+ const inset = (band - height) / 2;
17368
+ const center = plot.x + plot.width / 2;
17369
+ return values.map((value, index) => {
17370
+ const width = Math.abs(value) / max * plot.width;
17371
+ return {
17372
+ index,
17373
+ x: center - width / 2,
17374
+ y: plot.y + index * band + inset,
17375
+ width,
17376
+ height,
17377
+ center
17378
+ };
17379
+ });
17380
+ }
17381
+
17382
+ // chart/render/chart-svg-funnel.ts
17383
+ function funnelSvg(model, area) {
17384
+ const series = model.series[0];
17385
+ if (!series || series.hidden) return "";
17386
+ const attrs2 = chartTextAttributes(model, "categoryAxis", 10);
17387
+ const width = Math.min(
17388
+ area.w * 0.3,
17389
+ Math.max(32, ...model.categories.map((s) => s.length * (attrs2.size ?? 10) * 0.55 + 8))
15644
17390
  );
15645
- model.categories.forEach((c, i) => {
15646
- if (dates || !categoryLabels || i % step !== 0) return;
15647
- const p = band(i);
15648
- if (horizontal)
15649
- out.push(
15650
- text(plot.x - 4, p + categorySize * 0.3, fit(c, catW - 6, categorySize), {
15651
- anchor: "end",
15652
- ...categoryAttrs
15653
- })
15654
- );
15655
- else
17391
+ const plot = { x: area.x + width, y: area.y, width: Math.max(1, area.w - width), height: area.h };
17392
+ const out = [
17393
+ chartAreaRect(model, "plotArea", { x: plot.x, y: plot.y, w: plot.width, h: plot.height })
17394
+ ];
17395
+ for (const bar of computeFunnelGeometry(
17396
+ series.values.map((v) => v ?? 0),
17397
+ plot,
17398
+ model.funnelGapWidth
17399
+ )) {
17400
+ const value = series.values[bar.index];
17401
+ if (value === null || value === void 0) continue;
17402
+ out.push(`<g data-chart-series="${series.sourceIndex ?? 0}" data-chart-point="${bar.index}">`);
17403
+ out.push(
17404
+ rect2(bar.x, bar.y, bar.width, bar.height, series.pointColors?.[bar.index] ?? series.color)
17405
+ );
17406
+ const size = Math.min(10, bar.height * 0.4);
17407
+ const label = series.labels?.[bar.index];
17408
+ if (label)
15656
17409
  out.push(
15657
- text(p, plot.y + plot.h + categorySize + 3, fit(c, bandSize * step, categorySize), {
15658
- anchor: "middle",
15659
- ...categoryAttrs
17410
+ text(bar.center, bar.y + bar.height / 2 + size * 0.35, label.text, {
17411
+ ...chartTextAttributes(model, "dataLabel", size),
17412
+ size,
17413
+ anchor: "middle"
15660
17414
  })
15661
17415
  );
15662
- });
15663
- const frame2 = { plot, value, band, bandSize, ...dates ? { order: dates.order } : {} };
15664
- if (second) {
15665
- frame2.secondary = (v) => plot.y + plot.h - chartAxisRatio(v, second, model.axes?.secondary) * plot.h;
15666
17416
  out.push(
15667
- axisLine(
15668
- model,
15669
- model.axes?.secondary,
15670
- "valueAxis",
15671
- plot.x + plot.w,
15672
- plot.y,
15673
- plot.x + plot.w,
15674
- plot.y + plot.h
17417
+ text(
17418
+ plot.x - 8,
17419
+ bar.y + bar.height / 2 + (attrs2.size ?? 10) * 0.35,
17420
+ fit(model.categories[bar.index] ?? "", width - 8, attrs2.size ?? 10),
17421
+ { ...attrs2, anchor: "end" }
15675
17422
  )
15676
17423
  );
15677
- if (model.axes?.secondary?.source.majorGridlines || model.axes?.secondary?.source.minorGridlines)
17424
+ out.push("</g>");
17425
+ }
17426
+ return out.join("");
17427
+ }
17428
+
17429
+ // chart/box-distribution.ts
17430
+ function boxWhiskerDistribution(values, method = "exclusive", trimOutliers = false) {
17431
+ const stats = computeBoxStats(values, method);
17432
+ if (!stats) return void 0;
17433
+ const iqr = stats.q3 - stats.q1;
17434
+ const lowerFence = stats.q1 - 1.5 * iqr;
17435
+ const upperFence = stats.q3 + 1.5 * iqr;
17436
+ const inliers = values.filter((v) => !trimOutliers || v >= lowerFence && v <= upperFence);
17437
+ return {
17438
+ stats,
17439
+ whiskerMin: inliers.length ? Math.min(...inliers) : stats.min,
17440
+ whiskerMax: inliers.length ? Math.max(...inliers) : stats.max,
17441
+ mean: values.reduce((a, b) => a + b, 0) / values.length
17442
+ };
17443
+ }
17444
+ function boxMeanMarkerPath(x, y, radius = 3) {
17445
+ return `M${x - radius},${y - radius} L${x + radius},${y + radius} M${x - radius},${y + radius} L${x + radius},${y - radius}`;
17446
+ }
17447
+
17448
+ // chart/render/chart-svg-box.ts
17449
+ function boxWhiskerSvg(model, frame2, out) {
17450
+ const visible = model.series.filter((s) => !s.hidden);
17451
+ const slot = frame2.bandSize / Math.max(1, visible.length);
17452
+ const width = slot * 0.7;
17453
+ visible.forEach((series, si) => {
17454
+ if (series.hidden) return;
17455
+ const groups = groupRowsByCategory(series.boxCategories ?? []);
17456
+ model.categories.forEach((category, ci) => {
17457
+ const observations = (groups.rowIndexesByCategory.get(category) ?? []).flatMap((row2) => {
17458
+ const value = series.values[row2];
17459
+ return value === null || value === void 0 ? [] : [{ row: row2, value }];
17460
+ });
17461
+ const options2 = series.boxWhisker;
17462
+ const rawMethod = options2?.statistics?.quartileMethod;
17463
+ const method = rawMethod === "inclusive" ? "inclusive" : "exclusive";
17464
+ const visibility = options2?.visibility;
17465
+ const trim = rawMethod === "inclusive" || rawMethod === "exclusive" || !!visibility && Object.values(visibility).some((v) => v !== void 0);
17466
+ const distribution = boxWhiskerDistribution(
17467
+ observations.map((p) => p.value),
17468
+ method,
17469
+ trim
17470
+ );
17471
+ if (!distribution) return;
17472
+ const { stats, whiskerMin, whiskerMax, mean } = distribution;
17473
+ const x = frame2.band(ci) - frame2.bandSize / 2 + si * slot + (slot - width) / 2;
17474
+ const mid = x + width / 2;
17475
+ const y = frame2.value;
15678
17476
  out.push(
15679
- axisGridlines(model, model.axes.secondary, second.ticks, frame2.secondary, plot, false)
17477
+ `<g data-chart-part="box" data-chart-series="${series.sourceIndex ?? si}" data-chart-point="${ci}">`
15680
17478
  );
15681
- if (chartAxisLabels(model.axes?.secondary))
15682
- second.ticks.forEach(
15683
- (t, i) => out.push(
15684
- text(plot.x + plot.w + 4, frame2.secondary(t) + valueSize * 0.3, secondLabels[i] ?? "", {
15685
- anchor: "start",
15686
- ...valueAttrs
15687
- })
17479
+ out.push(line2(mid, y(whiskerMax), mid, y(stats.q3), "#64748b", 1));
17480
+ out.push(line2(mid, y(stats.q1), mid, y(whiskerMin), "#64748b", 1));
17481
+ out.push(
17482
+ line2(x + width * 0.25, y(whiskerMin), x + width * 0.75, y(whiskerMin), "#64748b", 1)
17483
+ );
17484
+ out.push(
17485
+ line2(x + width * 0.25, y(whiskerMax), x + width * 0.75, y(whiskerMax), "#64748b", 1)
17486
+ );
17487
+ out.push(
17488
+ rect2(
17489
+ x,
17490
+ Math.min(y(stats.q1), y(stats.q3)),
17491
+ width,
17492
+ Math.abs(y(stats.q1) - y(stats.q3)),
17493
+ series.pointColors?.[ci] ?? series.color
15688
17494
  )
15689
17495
  );
15690
- }
15691
- return frame2;
15692
- }
15693
- function plotted(model) {
15694
- if (model.grouping !== "percentStacked") return model.series.map((s) => s.values);
15695
- const totals = categoryTotals(model);
15696
- return model.series.map(
15697
- (s) => s.values.map((v, i) => v === null ? null : v / (totals[i] || 1))
15698
- );
15699
- }
15700
- function linesAndAreas(model, frame2, out) {
15701
- const values = plotted(model);
15702
- const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
15703
- const acc = new Array(model.categories.length).fill(0);
15704
- const area = model.type === "area";
15705
- const marks = [];
15706
- const layers = [];
15707
- model.series.forEach((s, si) => {
15708
- const points = [];
15709
- const lower = [];
15710
- (frame2.order ?? model.categories.map((_, i) => i)).forEach((i) => {
15711
- const v = values[si]?.[i] ?? null;
15712
- if (v === null && !area) {
15713
- points.push([NaN, NaN]);
15714
- return;
15715
- }
15716
- const below2 = stacked ? acc[i] ?? 0 : 0;
15717
- const top = below2 + (v ?? 0);
15718
- if (stacked) acc[i] = top;
15719
- points.push([frame2.band(i), frame2.value(top)]);
15720
- marks.push({
15721
- series: s,
15722
- index: i,
15723
- x: frame2.band(i),
15724
- y: frame2.value(top),
15725
- radius: area ? 0 : chartMarkerRadius(s, i, 2.5)
17496
+ out.push(line2(x, y(stats.median), x + width, y(stats.median), "#1e293b", 2));
17497
+ if (visibility?.meanLine) out.push(line2(x, y(mean), x + width, y(mean), "#0f766e", 1.5));
17498
+ if (visibility?.meanMarker !== false)
17499
+ out.push(
17500
+ `<path d="${boxMeanMarkerPath(mid, y(mean))}" fill="none" stroke="#0f766e" stroke-width="1.5" data-chart-part="mean"/>`
17501
+ );
17502
+ observations.forEach((point, index) => {
17503
+ const outlier = point.value < whiskerMin || point.value > whiskerMax;
17504
+ if (outlier ? !visibility?.outliers : !visibility?.nonoutliers) return;
17505
+ const px = x + width * (0.2 + 0.6 * (index + 1) / (observations.length + 1));
17506
+ out.push(
17507
+ `<circle cx="${n(px)}" cy="${n(y(point.value))}" r="2.25" fill="${outlier ? "#dc2626" : "#1e293b"}" data-chart-series="${series.sourceIndex ?? si}" data-chart-point="${point.row}" data-chart-part="${outlier ? "outlier" : "observation"}"/>`
17508
+ );
15726
17509
  });
15727
- lower.push([frame2.band(i), frame2.value(below2)]);
15728
- });
15729
- layers.push({
15730
- series: s,
15731
- points,
15732
- lower,
15733
- color: s.color,
15734
- filter: s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""
17510
+ out.push("</g>");
15735
17511
  });
15736
17512
  });
15737
- for (const { points, lower, color, filter, series } of area ? [...layers].reverse() : layers) {
15738
- if (area) {
15739
- const poly = [...points, ...[...lower].reverse()].map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
15740
- out.push(`<polygon points="${poly}" fill="${color}" fill-opacity="0.85"${filter}/>`);
15741
- continue;
15742
- }
15743
- let segment2 = [];
15744
- const flush = () => {
15745
- out.push(chartLineSvg(segment2, series));
15746
- segment2 = [];
15747
- };
15748
- for (const [x, y] of points) {
15749
- if (Number.isNaN(x)) flush();
15750
- else segment2.push({ x, y });
15751
- }
15752
- flush();
15753
- points.forEach(([x, y], index) => {
15754
- if (!Number.isNaN(x))
15755
- out.push(chartSeriesMarkerSvg(series, frame2.order?.[index] ?? index, x, y, 2.5));
15756
- });
15757
- }
15758
- pointLabels(model, marks, out);
15759
17513
  }
15760
17514
 
15761
17515
  // chart/render/chart-svg-xy.ts
@@ -16320,26 +18074,26 @@ function sunburstSvg(model, area) {
16320
18074
 
16321
18075
  // chart/render/chart-svg-text-metrics.ts
16322
18076
  var CHART_FONT_FAMILY = "Calibri, Carlito, Arial, sans-serif";
16323
- function cssFont(attrs) {
16324
- return `${attrs.italic ? "italic" : "normal"} ${attrs.weight ?? "normal"} ${attrs.size ?? 10}px ${attrs.family ?? CHART_FONT_FAMILY}`;
18077
+ function cssFont(attrs2) {
18078
+ return `${attrs2.italic ? "italic" : "normal"} ${attrs2.weight ?? "normal"} ${attrs2.size ?? 10}px ${attrs2.family ?? CHART_FONT_FAMILY}`;
16325
18079
  }
16326
- function chartFontMetrics(attrs, options2) {
16327
- const metrics = options2.measureFont?.(cssFont(attrs));
18080
+ function chartFontMetrics(attrs2, options2) {
18081
+ const metrics = options2.measureFont?.(cssFont(attrs2));
16328
18082
  return metrics && Number.isFinite(metrics.ascent) && Number.isFinite(metrics.descent) && metrics.ascent >= 0 && metrics.descent >= 0 && metrics.ascent + metrics.descent > 0 ? metrics : void 0;
16329
18083
  }
16330
- function chartTextWidth(content, attrs, options2) {
16331
- const width = options2.measureText?.(content, cssFont(attrs));
16332
- return width !== void 0 && Number.isFinite(width) && width >= 0 ? width : textWidth(content, attrs.size);
18084
+ function chartTextWidth(content, attrs2, options2) {
18085
+ const width = options2.measureText?.(content, cssFont(attrs2));
18086
+ return width !== void 0 && Number.isFinite(width) && width >= 0 ? width : textWidth(content, attrs2.size);
16333
18087
  }
16334
- function fitChartText(content, maxWidth, attrs, options2) {
16335
- if (!options2.measureText) return fit(content, maxWidth, attrs.size);
16336
- if (chartTextWidth(content, attrs, options2) <= maxWidth) return content;
18088
+ function fitChartText(content, maxWidth, attrs2, options2) {
18089
+ if (!options2.measureText) return fit(content, maxWidth, attrs2.size);
18090
+ if (chartTextWidth(content, attrs2, options2) <= maxWidth) return content;
16337
18091
  const points = [...content];
16338
18092
  let low = 0;
16339
18093
  let high = points.length;
16340
18094
  while (low < high) {
16341
18095
  const mid = Math.ceil((low + high) / 2);
16342
- if (chartTextWidth(`${points.slice(0, mid).join("")}\u2026`, attrs, options2) <= maxWidth) low = mid;
18096
+ if (chartTextWidth(`${points.slice(0, mid).join("")}\u2026`, attrs2, options2) <= maxWidth) low = mid;
16343
18097
  else high = mid - 1;
16344
18098
  }
16345
18099
  return `${points.slice(0, low).join("")}\u2026`;
@@ -16361,13 +18115,13 @@ function chartLegendSvg(model, area, frame2, options2) {
16361
18115
  });
16362
18116
  if (!manual) return { plot, markup: automatic.join(""), foreground: !!model.legendOverlay };
16363
18117
  const entries = legendEntries(model);
16364
- const attrs = chartTextAttributes(model, "legend");
16365
- const size = attrs.size ?? 10;
16366
- const font = chartFontMetrics(attrs, options2);
18118
+ const attrs2 = chartTextAttributes(model, "legend");
18119
+ const size = attrs2.size ?? 10;
18120
+ const font = chartFontMetrics(attrs2, options2);
16367
18121
  const keySize = size / 2;
16368
18122
  const keyGap = size / 4;
16369
18123
  const widths = entries.map(
16370
- (entry) => chartTextWidth(entry.label, attrs, options2) + keySize + keyGap
18124
+ (entry) => chartTextWidth(entry.label, attrs2, options2) + keySize + keyGap
16371
18125
  );
16372
18126
  const horizontal = manual.width > manual.height && widths.reduce((sum, width) => sum + width, 0) + size <= manual.width;
16373
18127
  const rowWidth = horizontal ? manual.width / entries.length : manual.width;
@@ -16383,13 +18137,13 @@ function chartLegendSvg(model, area, frame2, options2) {
16383
18137
  const baselineOffset = font ? (font.ascent - font.descent) / 2 : size * 0.35;
16384
18138
  const widest = extentOf(widths).max;
16385
18139
  entries.forEach((entry, i) => {
16386
- const available = horizontal ? chartTextWidth(entry.label, attrs, options2) : Math.max(0, rowWidth - size / 2 - keySize - keyGap);
16387
- const label = fitChartText(entry.label, available, attrs, options2);
18140
+ const available = horizontal ? chartTextWidth(entry.label, attrs2, options2) : Math.max(0, rowWidth - size / 2 - keySize - keyGap);
18141
+ const label = fitChartText(entry.label, available, attrs2, options2);
16388
18142
  const contentWidth = Math.min(horizontal ? widths[i] ?? 0 : widest, rowWidth - size / 2);
16389
18143
  const x = horizontal ? horizontalX : manual.x + Math.max(size / 4, (rowWidth - contentWidth) / 2);
16390
18144
  const centerY = manual.y + (horizontal ? 0 : i * rowHeight) + rowHeight / 2;
16391
18145
  markup.push(rect2(x, centerY - keySize / 2, keySize, keySize, entry.color));
16392
- markup.push(text(x + keySize + keyGap, centerY + baselineOffset, label, attrs));
18146
+ markup.push(text(x + keySize + keyGap, centerY + baselineOffset, label, attrs2));
16393
18147
  if (horizontal) horizontalX += (widths[i] ?? 0) + horizontalGap;
16394
18148
  });
16395
18149
  return {
@@ -16428,12 +18182,12 @@ function automaticLegend(model, area, out, options2, bounds) {
16428
18182
  const entries = legendEntries(model);
16429
18183
  if (!model.showLegend || entries.length === 0) return area;
16430
18184
  const pos = model.legendPosition;
16431
- const attrs = chartTextAttributes(model, "legend");
16432
- const size = attrs.size ?? 10;
18185
+ const attrs2 = chartTextAttributes(model, "legend");
18186
+ const size = attrs2.size ?? 10;
16433
18187
  const rowH = Math.max(16, size * 1.4);
16434
18188
  if (pos === "t" || pos === "b") {
16435
18189
  const widths = entries.map(
16436
- (e) => Math.min(chartTextWidth(e.label, attrs, options2) + 20, area.w / 2)
18190
+ (e) => Math.min(chartTextWidth(e.label, attrs2, options2) + 20, area.w / 2)
16437
18191
  );
16438
18192
  const total = widths.reduce((a, b) => a + b, 0);
16439
18193
  let x2 = area.x + Math.max(0, (area.w - total) / 2);
@@ -16450,14 +18204,14 @@ function automaticLegend(model, area, out, options2, bounds) {
16450
18204
  entries.forEach((e, i) => {
16451
18205
  const w = widths[i] ?? 0;
16452
18206
  out.push(rect2(x2, y, 8, 8, e.color));
16453
- out.push(text(x2 + 12, y + 8, fitChartText(e.label, w - 16, attrs, options2), attrs));
18207
+ out.push(text(x2 + 12, y + 8, fitChartText(e.label, w - 16, attrs2, options2), attrs2));
16454
18208
  x2 += w;
16455
18209
  });
16456
18210
  return pos === "t" ? { x: area.x, y: area.y + rowH + 4, w: area.w, h: area.h - rowH - 4 } : { x: area.x, y: area.y, w: area.w, h: area.h - rowH - 4 };
16457
18211
  }
16458
18212
  const width = Math.min(
16459
18213
  area.w * 0.35,
16460
- extentOf(entries.map((e) => chartTextWidth(e.label, attrs, options2))).max + 22
18214
+ extentOf(entries.map((e) => chartTextWidth(e.label, attrs2, options2))).max + 22
16461
18215
  );
16462
18216
  const height = entries.length * rowH;
16463
18217
  const x = pos === "l" ? area.x + 4 : area.x + area.w - width;
@@ -16475,7 +18229,7 @@ function automaticLegend(model, area, out, options2, bounds) {
16475
18229
  const y = y0 + i * rowH;
16476
18230
  if (y + rowH > area.y + area.h + 2) return;
16477
18231
  out.push(rect2(x, y + 3, 8, 8, e.color));
16478
- out.push(text(x + 12, y + 11, fitChartText(e.label, width - 16, attrs, options2), attrs));
18232
+ out.push(text(x + 12, y + 11, fitChartText(e.label, width - 16, attrs2, options2), attrs2));
16479
18233
  });
16480
18234
  return pos === "l" ? { x: area.x + width + 8, y: area.y, w: area.w - width - 8, h: area.h } : { x: area.x, y: area.y, w: area.w - width - 8, h: area.h };
16481
18235
  }
@@ -16509,11 +18263,11 @@ function wrapStyledRuns(runs, maxWidth, measure2, options2 = {}) {
16509
18263
  return sum + (Number.isFinite(advance) && advance >= 0 ? advance : 0);
16510
18264
  }, 0);
16511
18265
  const result = [];
16512
- let line3 = [];
18266
+ let line4 = [];
16513
18267
  let spaces = [];
16514
18268
  const flush = () => {
16515
- result.push(line3.map((piece) => ({ ...piece.run, text: piece.text })));
16516
- line3 = [];
18269
+ result.push(line4.map((piece) => ({ ...piece.run, text: piece.text })));
18270
+ line4 = [];
16517
18271
  spaces = [];
16518
18272
  };
16519
18273
  for (const group2 of groups) {
@@ -16525,20 +18279,20 @@ function wrapStyledRuns(runs, maxWidth, measure2, options2 = {}) {
16525
18279
  spaces = group2.pieces;
16526
18280
  continue;
16527
18281
  }
16528
- const separator = line3.length ? spaces : [];
18282
+ const separator = line4.length ? spaces : [];
16529
18283
  const wordWidth = width(group2.pieces);
16530
- if (line3.length && width(merged(line3, [...separator, ...group2.pieces])) > maxWidth) flush();
16531
- else line3 = merged(line3, separator);
18284
+ if (line4.length && width(merged(line4, [...separator, ...group2.pieces])) > maxWidth) flush();
18285
+ else line4 = merged(line4, separator);
16532
18286
  spaces = [];
16533
18287
  if (options2.breakWords && wordWidth > maxWidth) {
16534
18288
  for (const piece of group2.pieces) {
16535
18289
  for (const { segment: segment2 } of graphemes.segment(piece.text)) {
16536
18290
  const next = { ...piece, text: segment2 };
16537
- if (line3.length && width(merged(line3, [next])) > maxWidth) flush();
16538
- line3 = merged(line3, [next]);
18291
+ if (line4.length && width(merged(line4, [next])) > maxWidth) flush();
18292
+ line4 = merged(line4, [next]);
16539
18293
  }
16540
18294
  }
16541
- } else line3 = merged(line3, group2.pieces);
18295
+ } else line4 = merged(line4, group2.pieces);
16542
18296
  }
16543
18297
  flush();
16544
18298
  return result;
@@ -16561,25 +18315,25 @@ function chartRichTitleSvg(model, width, options2 = {}, frameHeight = 400) {
16561
18315
  ];
16562
18316
  const hardLines = [];
16563
18317
  for (const paragraph of paragraphs) {
16564
- let line3 = {
18318
+ let line4 = {
16565
18319
  ...paragraph,
16566
18320
  runs: []
16567
18321
  };
16568
- hardLines.push(line3);
18322
+ hardLines.push(line4);
16569
18323
  for (const run of paragraph.runs) {
16570
18324
  const pieces = run.text.split("\n");
16571
18325
  for (const [index, piece] of pieces.entries()) {
16572
18326
  if (index) {
16573
- line3 = { ...paragraph, runs: [] };
16574
- hardLines.push(line3);
18327
+ line4 = { ...paragraph, runs: [] };
18328
+ hardLines.push(line4);
16575
18329
  }
16576
- if (piece) line3.runs.push({ ...run, text: piece });
18330
+ if (piece) line4.runs.push({ ...run, text: piece });
16577
18331
  }
16578
18332
  }
16579
18333
  }
16580
- const lines = hardLines.flatMap((line3) => {
18334
+ const lines = hardLines.flatMap((line4) => {
16581
18335
  const wrapped = wrapStyledRuns(
16582
- line3.runs,
18336
+ line4.runs,
16583
18337
  capacity,
16584
18338
  (content, run) => chartTextWidth(
16585
18339
  content,
@@ -16592,7 +18346,7 @@ function chartRichTitleSvg(model, width, options2 = {}, frameHeight = 400) {
16592
18346
  ),
16593
18347
  { breakWords: true }
16594
18348
  );
16595
- const { spaceBefore, spaceAfter, ...properties } = line3;
18349
+ const { spaceBefore, spaceAfter, ...properties } = line4;
16596
18350
  return wrapped.map((runs, index) => ({
16597
18351
  ...properties,
16598
18352
  runs,
@@ -16600,8 +18354,8 @@ function chartRichTitleSvg(model, width, options2 = {}, frameHeight = 400) {
16600
18354
  ...index === wrapped.length - 1 && spaceAfter ? { spaceAfter } : {}
16601
18355
  }));
16602
18356
  });
16603
- const metrics = lines.map((line3) => {
16604
- const runs = line3.runs.map((run) => ({
18357
+ const metrics = lines.map((line4) => {
18358
+ const runs = line4.runs.map((run) => ({
16605
18359
  ...run,
16606
18360
  attrs: chartTextAttributes(
16607
18361
  { ...model, appearance: { title: run.appearance } },
@@ -16610,43 +18364,43 @@ function chartRichTitleSvg(model, width, options2 = {}, frameHeight = 400) {
16610
18364
  )
16611
18365
  }));
16612
18366
  return {
16613
- ...line3,
18367
+ ...line4,
16614
18368
  runs,
16615
18369
  width: runs.reduce((sum, run) => sum + chartTextWidth(run.text, run.attrs, options2), 0),
16616
18370
  size: runs.length ? Math.max(...runs.map((run) => run.attrs.size ?? 14)) : base.size ?? 14,
16617
18371
  fontMetrics: (runs.length ? runs.map((run) => run.attrs) : [base]).map(
16618
- (attrs) => chartFontMetrics(attrs, options2)
18372
+ (attrs2) => chartFontMetrics(attrs2, options2)
16619
18373
  )
16620
18374
  };
16621
18375
  });
16622
- const measured = metrics.every((line3) => line3.fontMetrics.every((font) => font !== void 0));
16623
- const vertical = metrics.map((line3) => {
16624
- const ascent = measured ? Math.max(...line3.fontMetrics.map((font) => font.ascent)) : line3.size;
16625
- const descent = measured ? Math.max(...line3.fontMetrics.map((font) => font.descent)) : line3.size * 0.4 + 4;
18376
+ const measured = metrics.every((line4) => line4.fontMetrics.every((font) => font !== void 0));
18377
+ const vertical = metrics.map((line4) => {
18378
+ const ascent = measured ? Math.max(...line4.fontMetrics.map((font) => font.ascent)) : line4.size;
18379
+ const descent = measured ? Math.max(...line4.fontMetrics.map((font) => font.descent)) : line4.size * 0.4 + 4;
16626
18380
  const natural = ascent + descent;
16627
- const height2 = spacing(line3.lineSpacing, natural, natural);
18381
+ const height2 = spacing(line4.lineSpacing, natural, natural);
16628
18382
  const leading = (height2 - natural) / 2;
16629
18383
  return {
16630
18384
  ascent: ascent + leading,
16631
18385
  descent: descent + leading,
16632
18386
  height: height2,
16633
- before: spacing(line3.spaceBefore, natural, 0),
16634
- after: spacing(line3.spaceAfter, natural, 0),
18387
+ before: spacing(line4.spaceBefore, natural, 0),
18388
+ after: spacing(line4.spaceAfter, natural, 0),
16635
18389
  leading
16636
18390
  };
16637
18391
  });
16638
- const boxWidth = Math.min(width - 16, Math.max(0, ...metrics.map((line3) => line3.width)) + 8);
18392
+ const boxWidth = Math.min(width - 16, Math.max(0, ...metrics.map((line4) => line4.width)) + 8);
16639
18393
  const height = vertical.reduce(
16640
- (sum, line3) => sum + line3.height + line3.before + line3.after,
18394
+ (sum, line4) => sum + line4.height + line4.before + line4.after,
16641
18395
  measured ? 4 : 0
16642
18396
  );
16643
18397
  let baseline = 8 + (metrics[0]?.size ?? base.size ?? 14) + (vertical[0]?.before ?? 0) + (vertical[0]?.leading ?? 0);
16644
18398
  const spans = [];
16645
- for (const [index, line3] of metrics.entries()) {
18399
+ for (const [index, line4] of metrics.entries()) {
16646
18400
  if (index)
16647
18401
  baseline += vertical[index - 1].descent + vertical[index - 1].after + vertical[index].before + vertical[index].ascent;
16648
- let x = line3.align === "l" ? (width - boxWidth) / 2 + 4 : line3.align === "r" ? (width + boxWidth) / 2 - 4 - line3.width : (width - line3.width) / 2;
16649
- for (const run of line3.runs) {
18402
+ let x = line4.align === "l" ? (width - boxWidth) / 2 + 4 : line4.align === "r" ? (width + boxWidth) / 2 - 4 - line4.width : (width - line4.width) / 2;
18403
+ for (const run of line4.runs) {
16650
18404
  spans.push(
16651
18405
  text(x, baseline, run.text, {
16652
18406
  ...run.attrs,
@@ -16700,11 +18454,11 @@ function renderChartSvg(model, width, height, options2 = {}) {
16700
18454
  if (!model.titleOverlay)
16701
18455
  area = { ...area, y: area.y + richTitle.height, h: area.h - richTitle.height };
16702
18456
  } else if (model.title) {
16703
- const attrs = chartTextAttributes(model, "title", 14);
16704
- const size = attrs.size ?? 14;
16705
- const label = fitChartText(model.title, w - 16, attrs, options2);
16706
- const titleWidth = Math.min(w - 16, chartTextWidth(label, attrs, options2) + 8);
16707
- const font = chartFontMetrics(attrs, options2);
18457
+ const attrs2 = chartTextAttributes(model, "title", 14);
18458
+ const size = attrs2.size ?? 14;
18459
+ const label = fitChartText(model.title, w - 16, attrs2, options2);
18460
+ const titleWidth = Math.min(w - 16, chartTextWidth(label, attrs2, options2) + 8);
18461
+ const font = chartFontMetrics(attrs2, options2);
16708
18462
  const titleHeight = Math.max(24, font ? font.ascent + font.descent + 4 : size * 1.4 + 4);
16709
18463
  out.push(
16710
18464
  chartAreaRect(model, "title", {
@@ -16718,7 +18472,7 @@ function renderChartSvg(model, width, height, options2 = {}) {
16718
18472
  text(w / 2, 8 + size, label, {
16719
18473
  anchor: "middle",
16720
18474
  fill: "#404040",
16721
- ...attrs
18475
+ ...attrs2
16722
18476
  })
16723
18477
  );
16724
18478
  if (!model.titleOverlay)
@@ -16732,11 +18486,14 @@ function renderChartSvg(model, width, height, options2 = {}) {
16732
18486
  out.push("</svg>");
16733
18487
  return out.join("");
16734
18488
  }
16735
- const legend = chartLegendSvg(model, area, { width: w, height: h }, options2);
18489
+ const legend = model.type === "regionMap" ? { plot: area, foreground: false, markup: "" } : chartLegendSvg(model, area, { width: w, height: h }, options2);
16736
18490
  area = legend.plot;
16737
18491
  if (!legend.foreground) out.push(legend.markup);
16738
18492
  if (area.w > 4 && area.h > 4) {
16739
- if (model.type === "pie" || model.type === "doughnut") out.push(pieSvg(model, area));
18493
+ if (chart3DApplies(model)) out.push(chart3DSvg(model, area));
18494
+ else if (model.type === "regionMap")
18495
+ out.push(regionMapSvg(model, area, options2.mapApproximationLabel));
18496
+ else if (model.type === "pie" || model.type === "doughnut") out.push(pieSvg(model, area));
16740
18497
  else if (model.type === "funnel") out.push(funnelSvg(model, area));
16741
18498
  else if (model.type === "radar") out.push(radarSvg(model, area));
16742
18499
  else if (model.type === "treemap") out.push(treemapSvg(model, area));
@@ -16766,6 +18523,7 @@ var DRAWN_CHART_TYPES = /* @__PURE__ */ new Set([
16766
18523
  "treemap",
16767
18524
  "sunburst",
16768
18525
  "funnel",
18526
+ "regionMap",
16769
18527
  "boxWhisker"
16770
18528
  ]);
16771
18529
  function chartThemePalette(theme, fonts = {}) {
@@ -16780,7 +18538,8 @@ function chartThemePalette(theme, fonts = {}) {
16780
18538
  function chartSpaceKind(space) {
16781
18539
  if (!space.plotArea.groups.length) return { drawn: false };
16782
18540
  const type = chartSummaryFromSpace(space).chartType;
16783
- return { type, drawn: DRAWN_CHART_TYPES.has(type) };
18541
+ const summary3D = type === "surface" && chartSummaryFromSpace(space).view3D !== void 0;
18542
+ return { type, drawn: DRAWN_CHART_TYPES.has(type) || summary3D };
16784
18543
  }
16785
18544
  function renderChartSpaceSvg(space, options2) {
16786
18545
  const { width, height, theme, fonts, formatting, colorPalette, styleDefinition, ...svg } = options2;
@@ -16997,8 +18756,8 @@ function parseDirectParagraphProperties(props) {
16997
18756
  const value = onOffElement(first2(props, key));
16998
18757
  if (value !== void 0) paragraph[key] = value;
16999
18758
  }
17000
- const outline = parseOutlineLevel(first2(props, "outlineLvl"));
17001
- if (outline !== void 0) paragraph.outlineLevel = outline;
18759
+ const outline2 = parseOutlineLevel(first2(props, "outlineLvl"));
18760
+ if (outline2 !== void 0) paragraph.outlineLevel = outline2;
17002
18761
  const frame2 = first2(props, "framePr");
17003
18762
  const dropCap = getW(frame2, "dropCap");
17004
18763
  if (dropCap === "drop" || dropCap === "margin") {
@@ -17018,19 +18777,19 @@ function parseDirectParagraphProperties(props) {
17018
18777
  const spacing2 = first2(props, "spacing");
17019
18778
  const before = twipValue(getW(spacing2, "before"));
17020
18779
  const after = twipValue(getW(spacing2, "after"));
17021
- const line3 = signedTwipValue(getW(spacing2, "line"));
18780
+ const line4 = signedTwipValue(getW(spacing2, "line"));
17022
18781
  if (before !== void 0) paragraph.spacingBeforeTwips = before;
17023
18782
  if (after !== void 0) paragraph.spacingAfterTwips = after;
17024
18783
  const beforeAuto = parseOnOff(getW(spacing2, "beforeAutospacing"));
17025
18784
  const afterAuto = parseOnOff(getW(spacing2, "afterAutospacing"));
17026
18785
  if (beforeAuto !== void 0) paragraph.spacingBeforeAuto = beforeAuto;
17027
18786
  if (afterAuto !== void 0) paragraph.spacingAfterAuto = afterAuto;
17028
- if (line3 !== void 0) {
17029
- paragraph.lineSpacingTwips = line3;
18787
+ if (line4 !== void 0) {
18788
+ paragraph.lineSpacingTwips = line4;
17030
18789
  }
17031
18790
  const rule = getW(spacing2, "lineRule");
17032
18791
  if (rule === "auto" || rule === "exact" || rule === "atLeast") paragraph.lineSpacingRule = rule;
17033
- else if (line3 !== void 0) paragraph.lineSpacingRule = "auto";
18792
+ else if (line4 !== void 0) paragraph.lineSpacingRule = "auto";
17034
18793
  const indent = first2(props, "ind");
17035
18794
  const indentLeft = signedTwipValue(getW(indent, "left"));
17036
18795
  const indentRight = signedTwipValue(getW(indent, "right"));
@@ -17054,6 +18813,12 @@ function parseDirectParagraphProperties(props) {
17054
18813
  return paragraph;
17055
18814
  }
17056
18815
 
18816
+ // docx/numbering-picture.ts
18817
+ function pictureBulletSizePt(picture, fontSizePt) {
18818
+ const heightPt = picture.heightPt ?? picture.widthPt ?? fontSizePt;
18819
+ return { widthPt: picture.widthPt ?? heightPt, heightPt };
18820
+ }
18821
+
17057
18822
  // docx/numbering-parse.ts
17058
18823
  var own = (map, key) => Object.prototype.hasOwnProperty.call(map, key) ? map[key] : void 0;
17059
18824
  function resolveNumberingLevel(catalog, numId, level2) {
@@ -17410,6 +19175,7 @@ function computeListLabels(model) {
17410
19175
  if (def.numFmt === "none") continue;
17411
19176
  counters.advance(numId, level2, def, catalog);
17412
19177
  const text2 = def.numFmt === "bullet" ? def.lvlText : substituteLvlText(def.lvlText, numId, level2, catalog, counters, Boolean(def.isLgl));
19178
+ const picture = def.pictureBulletId !== void 0 ? catalog.pictureBullets?.[def.pictureBulletId] : void 0;
17413
19179
  labels.set(paragraph.id, {
17414
19180
  numId,
17415
19181
  level: level2,
@@ -17421,7 +19187,8 @@ function computeListLabels(model) {
17421
19187
  hangingTwips: def.hangingTwips,
17422
19188
  firstLineTwips: def.firstLineTwips,
17423
19189
  markerFormat: def.markerFormat,
17424
- tabStopTwips: def.tabStopTwips
19190
+ tabStopTwips: def.tabStopTwips,
19191
+ picture
17425
19192
  })
17426
19193
  });
17427
19194
  }
@@ -18162,12 +19929,12 @@ function fillPaint(fill, theme) {
18162
19929
  return DEFAULT_SHAPE_FILL;
18163
19930
  }
18164
19931
  function shapeAppearance(spec, theme) {
18165
- const line3 = spec.line;
19932
+ const line4 = spec.line;
18166
19933
  return {
18167
19934
  fill: isLinePreset(spec.preset) ? "none" : fillPaint(spec.fill, theme),
18168
- stroke: linePaint(line3?.fill, theme),
18169
- strokeWidthPx: round((line3?.widthEmu ?? DEFAULT_SHAPE_LINE_EMU) / EMU_PER_PIXEL),
18170
- ...line3?.dash && DASHES2[line3.dash] ? { dash: DASHES2[line3.dash] } : {}
19935
+ stroke: linePaint(line4?.fill, theme),
19936
+ strokeWidthPx: round((line4?.widthEmu ?? DEFAULT_SHAPE_LINE_EMU) / EMU_PER_PIXEL),
19937
+ ...line4?.dash && DASHES2[line4.dash] ? { dash: DASHES2[line4.dash] } : {}
18171
19938
  };
18172
19939
  }
18173
19940
  var luminance = (css) => {
@@ -18180,11 +19947,11 @@ var shapeTextColor = (fill) => fill === "none" || luminance(fill) > 0.6 ? "#0000
18180
19947
  var FONT_PX = 14.67;
18181
19948
  function wrapShapeText(lines, widthPx) {
18182
19949
  const perLine = Math.max(1, Math.floor(widthPx / (FONT_PX * 0.52)));
18183
- return lines.flatMap((line3) => {
18184
- if (line3.length <= perLine) return [line3];
19950
+ return lines.flatMap((line4) => {
19951
+ if (line4.length <= perLine) return [line4];
18185
19952
  const out = [];
18186
19953
  let current = "";
18187
- for (const word of line3.split(/\s+/)) {
19954
+ for (const word of line4.split(/\s+/)) {
18188
19955
  if (current && current.length + 1 + word.length > perLine) {
18189
19956
  out.push(current);
18190
19957
  current = word;
@@ -18223,7 +19990,7 @@ function shapeSvg(spec, widthPx, heightPx, theme) {
18223
19990
  const lineHeight = FONT_PX * 1.2;
18224
19991
  const first3 = (textRect.t + textRect.b) / 2 - (lines.length - 1) * lineHeight / 2;
18225
19992
  const text2 = lines.length ? `<text font-family="Calibri,Arial,sans-serif" font-size="${FONT_PX}" fill="${color}" text-anchor="middle" dominant-baseline="central">${lines.map(
18226
- (line3, index) => `<tspan x="${round((textRect.l + textRect.r) / 2)}" y="${round(first3 + index * lineHeight)}">${escapeXml(line3)}</tspan>`
19993
+ (line4, index) => `<tspan x="${round((textRect.l + textRect.r) / 2)}" y="${round(first3 + index * lineHeight)}">${escapeXml(line4)}</tspan>`
18227
19994
  ).join("")}</text>` : "";
18228
19995
  const transform = [
18229
19996
  spec.rotation ? `rotate(${spec.rotation} ${round(w / 2)} ${round(h / 2)})` : "",
@@ -18241,8 +20008,8 @@ var NO_TWIPS = twips(0);
18241
20008
  function pxToTwips(px) {
18242
20009
  return roundSignedTwips(px * 1440 / 96);
18243
20010
  }
18244
- function ptToPx(pt) {
18245
- return pt * 96 / 72;
20011
+ function ptToPx(pt2) {
20012
+ return pt2 * 96 / 72;
18246
20013
  }
18247
20014
  var DEFAULT_TAB_STOP_PX = twipsToPx(twips(720));
18248
20015
  var DEFAULT_FONT_FAMILY = "Calibri";
@@ -18418,7 +20185,7 @@ function paragraphsByPage(pages, source) {
18418
20185
  if (at === void 0) return;
18419
20186
  const shown = found.get(at) ?? [];
18420
20187
  if (!box.lines.length) shown.push([0, Number.POSITIVE_INFINITY]);
18421
- for (const line3 of box.lines) shown.push([line3.sourceStart, line3.sourceEnd]);
20188
+ for (const line4 of box.lines) shown.push([line4.sourceStart, line4.sourceEnd]);
18422
20189
  found.set(at, shown);
18423
20190
  };
18424
20191
  const visit = (blocks) => {
@@ -18826,12 +20593,18 @@ function measureParagraph(paragraph, contentWidthPx, measurer, note, lineBox, st
18826
20593
  );
18827
20594
  };
18828
20595
  const lineStart = (lineIndex) => leftPx + (lineIndex === 0 ? firstLineExtraPx : 0) + boxFor(lineIndex).leftInsetPx;
18829
- const tokenWidth = (token) => token.kind === "word" || token.kind === "space" ? runTextWidth(
18830
- token.text,
18831
- expectDefined(paragraph.runs[token.runIndex], "token run"),
18832
- measurer,
18833
- fonts[token.runIndex]
18834
- ) : token.kind === "object" ? paragraph.runs[token.runIndex]?.object?.widthPx ?? 0 : 0;
20596
+ const tokenWidth = (token) => {
20597
+ const run = token.kind === "word" ? paragraph.runs[token.runIndex] : void 0;
20598
+ if (run?.marker?.widthPx !== void 0 && token.kind === "word" && token.sourceStart === 0) {
20599
+ if (token.text === run.text.slice(0, run.marker.length)) return run.marker.widthPx;
20600
+ }
20601
+ return token.kind === "word" || token.kind === "space" ? runTextWidth(
20602
+ token.text,
20603
+ expectDefined(paragraph.runs[token.runIndex], "token run"),
20604
+ measurer,
20605
+ fonts[token.runIndex]
20606
+ ) : token.kind === "object" ? paragraph.runs[token.runIndex]?.object?.widthPx ?? 0 : 0;
20607
+ };
18835
20608
  const widths = tokens.map(tokenWidth);
18836
20609
  const ends = /* @__PURE__ */ new Set(["tab", "lineBreak", "pageBreak", "columnBreak"]);
18837
20610
  function segmentAfter(index) {
@@ -18982,11 +20755,11 @@ function measureParagraph(paragraph, contentWidthPx, measurer, note, lineBox, st
18982
20755
  }
18983
20756
  flushLine(lines.length === 0, void 0);
18984
20757
  const lastIndex = lines.length - 1;
18985
- for (const [index, line3] of lines.entries()) {
20758
+ for (const [index, line4] of lines.entries()) {
18986
20759
  lines[index] = {
18987
- ...line3,
20760
+ ...line4,
18988
20761
  fragments: alignFragments(
18989
- line3.fragments,
20762
+ line4.fragments,
18990
20763
  availableWidth(index),
18991
20764
  index === lastIndex,
18992
20765
  // A line that runs around a picture is not aligned across it.
@@ -18999,10 +20772,10 @@ function measureParagraph(paragraph, contentWidthPx, measurer, note, lineBox, st
18999
20772
  const insetTopPx = extent("top");
19000
20773
  const insetBottomPx = extent("bottom");
19001
20774
  let y = insetTopPx;
19002
- for (const line3 of lines) {
19003
- y += line3.gapBeforePx ?? 0;
19004
- line3.yPx = y;
19005
- y += line3.heightPx;
20775
+ for (const line4 of lines) {
20776
+ y += line4.gapBeforePx ?? 0;
20777
+ line4.yPx = y;
20778
+ y += line4.heightPx;
19006
20779
  }
19007
20780
  const frame2 = borders || paragraph.shading ? {
19008
20781
  leftPx: leftPx - extent("left"),
@@ -19303,7 +21076,7 @@ function splitCellAtHeight(boxes, cutHeightPx, paragraphCuts) {
19303
21076
  continue;
19304
21077
  }
19305
21078
  const beforeLines = box.lines.filter(
19306
- (line3) => box.yPx + line3.yPx + line3.heightPx + (box.tableFragmentBottomPx ?? box.tableFrameInsets?.bottom ?? 0) <= cut
21079
+ (line4) => box.yPx + line4.yPx + line4.heightPx + (box.tableFragmentBottomPx ?? box.tableFrameInsets?.bottom ?? 0) <= cut
19307
21080
  );
19308
21081
  const afterLines = box.lines.slice(beforeLines.length);
19309
21082
  if (beforeLines.length) {
@@ -19320,7 +21093,7 @@ function splitCellAtHeight(boxes, cutHeightPx, paragraphCuts) {
19320
21093
  ...box,
19321
21094
  yPx: box.yPx + shift,
19322
21095
  heightPx: afterLines.at(-1).yPx + afterLines.at(-1).heightPx - shift,
19323
- lines: afterLines.map((line3) => ({ ...line3, yPx: line3.yPx - shift }))
21096
+ lines: afterLines.map((line4) => ({ ...line4, yPx: line4.yPx - shift }))
19324
21097
  });
19325
21098
  }
19326
21099
  }
@@ -19417,7 +21190,7 @@ function stackParagraphs(paragraphs, widthPx, measurer, note, topPx = 0, startTo
19417
21190
  );
19418
21191
  y += layout.spacingBeforePx;
19419
21192
  const top = y;
19420
- const lines = layout.lines.map((line3) => ({ ...line3 }));
21193
+ const lines = layout.lines.map((line4) => ({ ...line4 }));
19421
21194
  boxes.push({
19422
21195
  kind: "paragraph",
19423
21196
  blockId: paragraph.id,
@@ -19515,7 +21288,7 @@ function splitNote(note, budget) {
19515
21288
  continue;
19516
21289
  }
19517
21290
  const count = paragraph.lines.filter(
19518
- (line3) => paragraph.yPx + line3.yPx + line3.heightPx <= budget + 1e-6
21291
+ (line4) => paragraph.yPx + line4.yPx + line4.heightPx <= budget + 1e-6
19519
21292
  ).length;
19520
21293
  const head = paragraph.lines.slice(0, count);
19521
21294
  const tail = paragraph.lines.slice(count);
@@ -19531,7 +21304,7 @@ function splitNote(note, budget) {
19531
21304
  ...paragraph,
19532
21305
  yPx: 0,
19533
21306
  heightPx: Math.max(0, paragraph.heightPx - (first3?.yPx ?? 0)),
19534
- lines: tail.map((line3) => ({ ...line3, yPx: line3.yPx - (first3?.yPx ?? 0) }))
21307
+ lines: tail.map((line4) => ({ ...line4, yPx: line4.yPx - (first3?.yPx ?? 0) }))
19535
21308
  });
19536
21309
  }
19537
21310
  if (!before.length) return { after: note };
@@ -20120,7 +21893,7 @@ function placeParagraph(cursor, placement, note) {
20120
21893
  let lineCursor = 0;
20121
21894
  let nextToken = 0;
20122
21895
  let firstSegment = true;
20123
- const lineHeight = (line3, index) => placement.trimLeadingColumnBreak && layout.columnBreakAfterLine.has(index) && line3.fragments.every((fragment) => !fragment.text && !fragment.object) ? 0 : line3.heightPx;
21896
+ const lineHeight = (line4, index) => placement.trimLeadingColumnBreak && layout.columnBreakAfterLine.has(index) && line4.fragments.every((fragment) => !fragment.text && !fragment.object) ? 0 : line4.heightPx;
20124
21897
  const placedNotes = /* @__PURE__ */ new Set();
20125
21898
  const notesFor = (lines) => (placement.footnotes?.(lines, firstSegment) ?? []).filter((item) => !placedNotes.has(item.id));
20126
21899
  const hold = (lines, bodyMinimum) => {
@@ -20130,7 +21903,7 @@ function placeParagraph(cursor, placement, note) {
20130
21903
  paragraph.id,
20131
21904
  notes,
20132
21905
  bodyMinimum,
20133
- Math.max(0, ...lines.map((line3) => line3.heightPx))
21906
+ Math.max(0, ...lines.map((line4) => line4.heightPx))
20134
21907
  );
20135
21908
  return notes;
20136
21909
  };
@@ -20163,9 +21936,9 @@ function placeParagraph(cursor, placement, note) {
20163
21936
  let end = lineCursor;
20164
21937
  let forced;
20165
21938
  for (let i = lineCursor; i < layout.lines.length; i++) {
20166
- const line3 = expectDefined(layout.lines[i], "paragraph line index");
20167
- const gap = i === lineCursor && !firstSegment ? 0 : line3.gapBeforePx ?? 0;
20168
- const height = lineHeight(line3, i) + gap;
21939
+ const line4 = expectDefined(layout.lines[i], "paragraph line index");
21940
+ const gap = i === lineCursor && !firstSegment ? 0 : line4.gapBeforePx ?? 0;
21941
+ const height = lineHeight(line4, i) + gap;
20169
21942
  hold(
20170
21943
  layout.lines.slice(lineCursor, i + 1),
20171
21944
  cumulative + height + (firstSegment ? spacingBeforePx : 0)
@@ -20203,10 +21976,10 @@ function placeParagraph(cursor, placement, note) {
20203
21976
  );
20204
21977
  const first3 = expectDefined(layout.lines[lineCursor], "first line of paragraph segment");
20205
21978
  const origin = first3.yPx - (firstSegment ? (first3.gapBeforePx ?? 0) + layout.insetTopPx : 0);
20206
- const segmentLines = layout.lines.slice(lineCursor, lineCursor + placedCount).map((line3, index) => ({
20207
- ...line3,
20208
- yPx: line3.yPx - origin,
20209
- heightPx: lineHeight(line3, lineCursor + index)
21979
+ const segmentLines = layout.lines.slice(lineCursor, lineCursor + placedCount).map((line4, index) => ({
21980
+ ...line4,
21981
+ yPx: line4.yPx - origin,
21982
+ heightPx: lineHeight(line4, lineCursor + index)
20210
21983
  }));
20211
21984
  const isFinal = lineCursor + placedCount >= layout.lines.length;
20212
21985
  const lastLine = segmentLines.at(-1);
@@ -20405,10 +22178,10 @@ function prefix(row2, cut, cellCuts, paragraphCuts) {
20405
22178
  continue;
20406
22179
  }
20407
22180
  const lines = [];
20408
- for (const line3 of box.lines) {
20409
- if (box.yPx + line3.yPx + line3.heightPx + (box.tableFrameInsets?.bottom ?? 0) > contentCut + 1e-6)
22181
+ for (const line4 of box.lines) {
22182
+ if (box.yPx + line4.yPx + line4.heightPx + (box.tableFrameInsets?.bottom ?? 0) > contentCut + 1e-6)
20410
22183
  break;
20411
- lines.push(line3);
22184
+ lines.push(line4);
20412
22185
  }
20413
22186
  if (lines.length)
20414
22187
  boxes.push({ ...box, lines, heightPx: lines.at(-1).yPx + lines.at(-1).heightPx });
@@ -20468,14 +22241,14 @@ var TableFootnotes = class {
20468
22241
  (box.lines[0]?.sourceStart ?? 0) === 0
20469
22242
  )) {
20470
22243
  if (this.placed.has(note.id)) continue;
20471
- const line3 = box.lines.find(
20472
- (line4) => line4.fragments.some(
22244
+ const line4 = box.lines.find(
22245
+ (line5) => line5.fragments.some(
20473
22246
  (fragment) => source.runs[fragment.runIndex]?.footnoteReferenceId === note.id
20474
22247
  )
20475
22248
  ) ?? box.lines[0];
20476
22249
  const bottom = Math.min(
20477
22250
  row2.heightPx,
20478
- box.yPx + (line3?.yPx ?? 0) + (line3?.heightPx ?? box.heightPx) + (box.tableFrameInsets?.bottom ?? 0)
22251
+ box.yPx + (line4?.yPx ?? 0) + (line4?.heightPx ?? box.heightPx) + (box.tableFrameInsets?.bottom ?? 0)
20479
22252
  );
20480
22253
  const prior = refs.get(note.id);
20481
22254
  if (!prior || bottom < prior.bottom)
@@ -20483,7 +22256,7 @@ var TableFootnotes = class {
20483
22256
  note,
20484
22257
  bottom,
20485
22258
  blockId: box.blockId,
20486
- before: box.yPx + (line3?.yPx ?? 0) + (box.tableFrameInsets?.bottom ?? 0)
22259
+ before: box.yPx + (line4?.yPx ?? 0) + (box.tableFrameInsets?.bottom ?? 0)
20487
22260
  });
20488
22261
  }
20489
22262
  }
@@ -20549,8 +22322,8 @@ var TableFootnotes = class {
20549
22322
  for (const [index, cell] of row2.cells.entries())
20550
22323
  for (const box of cell) {
20551
22324
  if (box.yPx > available + 1e-6) break;
20552
- for (const line3 of box.lines) {
20553
- const bottom = box.yPx + line3.yPx + line3.heightPx + (box.tableFrameInsets?.bottom ?? 0) + (row2.cellPadding?.[index]?.bottom ?? 0);
22325
+ for (const line4 of box.lines) {
22326
+ const bottom = box.yPx + line4.yPx + line4.heightPx + (box.tableFrameInsets?.bottom ?? 0) + (row2.cellPadding?.[index]?.bottom ?? 0);
20554
22327
  if (bottom > available + 1e-6) break;
20555
22328
  if (bottom > 0) cuts.add(bottom);
20556
22329
  }
@@ -20959,7 +22732,7 @@ function createReferenceFootnotes(width, measurer, report) {
20959
22732
  return (paragraph, lines, includeUnanchored) => {
20960
22733
  const selected = new Set(
20961
22734
  lines.flatMap(
20962
- (line3) => line3.fragments.map((fragment) => paragraph.runs[fragment.runIndex]?.footnoteReferenceId)
22735
+ (line4) => line4.fragments.map((fragment) => paragraph.runs[fragment.runIndex]?.footnoteReferenceId)
20963
22736
  )
20964
22737
  );
20965
22738
  const anchored = new Set(paragraph.runs.map((run) => run.footnoteReferenceId));
@@ -21132,7 +22905,7 @@ var SectionFlow = class {
21132
22905
  run.object.noteSeparator === "continuationSeparator" ? width : 192,
21133
22906
  Math.max(
21134
22907
  0,
21135
- width - (probe?.lines.flatMap((line3) => line3.fragments).find(
22908
+ width - (probe?.lines.flatMap((line4) => line4.fragments).find(
21136
22909
  (fragment) => fragment.runIndex === index && fragment.object?.noteSeparator
21137
22910
  )?.xPx ?? 0)
21138
22911
  )
@@ -21805,6 +23578,7 @@ function paragraphFloats(paragraph, theme) {
21805
23578
  index: floats.length,
21806
23579
  ...svg ? { chart: { svg, label: "Shape", shape: true } } : {},
21807
23580
  partName: image.partName,
23581
+ ...image.pictureFill ? { pictureFill: image.pictureFill } : {},
21808
23582
  contentType: image.contentType,
21809
23583
  widthPx: image.widthPx,
21810
23584
  heightPx: image.heightPx,
@@ -22289,8 +24063,8 @@ function delimiterToLatex(emit, node) {
22289
24063
  const endNode = childNode(dPr, "m:endChr");
22290
24064
  const open = hasAttr(begNode) ? attrVal(begNode) : "(";
22291
24065
  const close = hasAttr(endNode) ? attrVal(endNode) : ")";
22292
- const elements2 = ensureArr(node["m:e"]);
22293
- const sole = elements2.length === 1 ? soleChild(elements2[0]) : null;
24066
+ const elements3 = ensureArr(node["m:e"]);
24067
+ const sole = elements3.length === 1 ? soleChild(elements3[0]) : null;
22294
24068
  if (sole?.tag === "m:m") {
22295
24069
  const env = matrixEnvFor(open, close);
22296
24070
  if (env) {
@@ -22307,7 +24081,7 @@ function delimiterToLatex(emit, node) {
22307
24081
  }
22308
24082
  const sepNode = childNode(dPr, "m:sepChr");
22309
24083
  const separator = hasAttr(sepNode) ? attrVal(sepNode) : "|";
22310
- const inner = elements2.map((e) => emit.children(e)).join(escapeMathText(separator));
24084
+ const inner = elements3.map((e) => emit.children(e)).join(escapeMathText(separator));
22311
24085
  return `\\left${delimToLatex(open)}${inner}\\right${delimToLatex(close)}`;
22312
24086
  }
22313
24087
 
@@ -22900,16 +24674,16 @@ function layoutStructure(tag, node, style, ctx) {
22900
24674
  return val(child(pr, "m:pos")) === "top" ? above(arg2("m:e"), mark, style) : below(arg2("m:e"), mark, style);
22901
24675
  }
22902
24676
  case "m:eqArr": {
22903
- const lines = ensureArray(node["m:e"]).map((line3) => ctx.layout(line3, style));
24677
+ const lines = ensureArray(node["m:e"]).map((line4) => ctx.layout(line4, style));
22904
24678
  const result = emptyBox();
22905
24679
  const gap = style.size * 0.25;
22906
- const total = lines.reduce((sum, line3) => sum + line3.ascent + line3.descent, 0) + gap * Math.max(0, lines.length - 1);
24680
+ const total = lines.reduce((sum, line4) => sum + line4.ascent + line4.descent, 0) + gap * Math.max(0, lines.length - 1);
22907
24681
  let y = -(total / 2) + style.size * AXIS;
22908
- for (const line3 of lines) {
22909
- y += line3.ascent;
22910
- result.prims.push(...shifted(line3.prims, 0, y));
22911
- result.width = Math.max(result.width, line3.width);
22912
- y += line3.descent + gap;
24682
+ for (const line4 of lines) {
24683
+ y += line4.ascent;
24684
+ result.prims.push(...shifted(line4.prims, 0, y));
24685
+ result.width = Math.max(result.width, line4.width);
24686
+ y += line4.descent + gap;
22913
24687
  }
22914
24688
  result.ascent = total / 2 + style.size * AXIS;
22915
24689
  result.descent = total / 2 - style.size * AXIS;
@@ -23069,14 +24843,14 @@ var FONT_FAMILY = "'Cambria Math','STIX Two Math','Latin Modern Math','Times New
23069
24843
  function primMarkup(prim) {
23070
24844
  switch (prim.kind) {
23071
24845
  case "text": {
23072
- const attrs = [
24846
+ const attrs2 = [
23073
24847
  `font-size="${round2(prim.size)}"`,
23074
24848
  prim.italic ? 'font-style="italic"' : "",
23075
24849
  prim.bold ? 'font-weight="bold"' : "",
23076
24850
  Array.from(prim.text).length > 1 ? `textLength="${round2(prim.fit)}" lengthAdjust="spacing"` : ""
23077
24851
  ].filter(Boolean);
23078
24852
  const at = prim.stretch ? `transform="translate(${round2(prim.x)} ${round2(prim.y)}) scale(1 ${round2(prim.stretch)})"` : `x="${round2(prim.x)}" y="${round2(prim.y)}"`;
23079
- return `<text ${at} ${attrs.join(" ")}>${escapeXml2(prim.text)}</text>`;
24853
+ return `<text ${at} ${attrs2.join(" ")}>${escapeXml2(prim.text)}</text>`;
23080
24854
  }
23081
24855
  case "line":
23082
24856
  return `<line x1="${round2(prim.x1)}" y1="${round2(prim.y1)}" x2="${round2(prim.x2)}" y2="${round2(prim.y2)}" stroke="currentColor" stroke-width="${round2(prim.width)}"/>`;
@@ -23266,9 +25040,9 @@ function paragraphBox(formatting, theme) {
23266
25040
  let betweenBorder;
23267
25041
  for (const side of ["top", "bottom", "left", "right", "between"]) {
23268
25042
  const source = formatting.borders?.[side];
23269
- const line3 = border(source, theme);
23270
- if (!line3) continue;
23271
- const resolved = { ...line3, spacePx: pointsToPx(source?.spacePoints ?? 0) };
25043
+ const line4 = border(source, theme);
25044
+ if (!line4) continue;
25045
+ const resolved = { ...line4, spacePx: pointsToPx(source?.spacePoints ?? 0) };
23272
25046
  if (side === "between") betweenBorder = resolved;
23273
25047
  else borders[side] = resolved;
23274
25048
  }
@@ -23291,8 +25065,8 @@ function groupParagraphBorders(blocks, between) {
23291
25065
  const borders = { ...block.borders };
23292
25066
  if (sameAsNext) delete borders.bottom;
23293
25067
  if (sameAsPrevious) {
23294
- const line3 = between.get(block);
23295
- if (line3) borders.top = line3;
25068
+ const line4 = between.get(block);
25069
+ if (line4) borders.top = line4;
23296
25070
  else delete borders.top;
23297
25071
  }
23298
25072
  block.borders = borders;
@@ -23424,6 +25198,7 @@ function adaptDocumentModel(model, note = () => {
23424
25198
  noteSeparator: run.noteSeparator
23425
25199
  } : image && !image.anchored ? {
23426
25200
  partName: image.partName,
25201
+ ...image.pictureFill ? { pictureFill: image.pictureFill } : {},
23427
25202
  contentType: image.contentType,
23428
25203
  widthPx: image.widthPx,
23429
25204
  heightPx: image.heightPx,
@@ -23461,10 +25236,18 @@ function adaptDocumentModel(model, note = () => {
23461
25236
  const first3 = adaptRun(paragraph.runs[0] ?? { text: "" }, paragraph.style);
23462
25237
  const marker = label.markerFormat;
23463
25238
  const suffix = label.suffix === "tab" ? " " : label.suffix === "space" ? " " : "";
25239
+ const pictureWidthPx = label.picture ? pictureBulletSizePt(
25240
+ label.picture,
25241
+ marker?.fontSizeHalfPoints ? marker.fontSizeHalfPoints / 2 : first3.fontSizePt ?? 11
25242
+ ).widthPt * 4 / 3 : void 0;
23464
25243
  return {
23465
25244
  text: `${displayListLabel(label.text)}${suffix}`,
23466
25245
  synthetic: true,
23467
- marker: { length: displayListLabel(label.text).length, alignment: label.alignment ?? "left" },
25246
+ marker: {
25247
+ length: displayListLabel(label.text).length,
25248
+ alignment: label.alignment ?? "left",
25249
+ ...pictureWidthPx !== void 0 ? { widthPx: pictureWidthPx } : {}
25250
+ },
23468
25251
  ...definedProps({
23469
25252
  bold: marker?.bold ?? first3.bold,
23470
25253
  italic: marker?.italic ?? first3.italic,
@@ -23768,6 +25551,7 @@ function positionFloats(input, pages) {
23768
25551
  widthPx: float.widthPx,
23769
25552
  heightPx: float.heightPx,
23770
25553
  partName: float.partName,
25554
+ ...float.pictureFill ? { pictureFill: float.pictureFill } : {},
23771
25555
  contentType: float.contentType,
23772
25556
  ...float.chart ? { chart: float.chart } : {},
23773
25557
  behindText: Boolean(float.behindText),
@@ -23858,8 +25642,8 @@ function describePages(pages, indexOf) {
23858
25642
  for (const page of pages) {
23859
25643
  const first3 = paragraphBoxes(page)[0];
23860
25644
  firstBlock.push(first3 ? indexOf.get(first3.blockId) : void 0);
23861
- const line3 = first3?.kind === "paragraph" ? first3.lines[0] : void 0;
23862
- startsBlock.push(line3 !== void 0 && line3.sourceStart === 0);
25645
+ const line4 = first3?.kind === "paragraph" ? first3.lines[0] : void 0;
25646
+ startsBlock.push(line4 !== void 0 && line4.sourceStart === 0);
23863
25647
  }
23864
25648
  return { firstBlock, startsBlock };
23865
25649
  }