ooxml-core 1.32.1 → 1.33.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 (318) hide show
  1. package/dist/{PptxHandler-TESZUH66.cjs → PptxHandler-MGKMIK22.cjs} +3 -3
  2. package/dist/PptxHandler-Q7CFNKOU.mjs +7 -0
  3. package/dist/PptxHandler-TEC7SWBU.mjs +4 -0
  4. package/dist/{PresentationBuilder-3CH5TR4W.mjs → PresentationBuilder-PJMQRZI6.mjs} +2 -2
  5. package/dist/{PresentationBuilder-S6HXHKEJ.mjs → PresentationBuilder-SADKXDWC.mjs} +4 -4
  6. package/dist/{PresentationBuilder-5NFBUP7Y.cjs → PresentationBuilder-VP2637RH.cjs} +5 -5
  7. package/dist/automation/index.cjs +4398 -2262
  8. package/dist/automation/index.mjs +4398 -2262
  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-Q6NM64J2.cjs → chunk-2LTIDUXH.cjs} +4791 -950
  80. package/dist/chunk-2N7RZQLC.mjs +8 -0
  81. package/dist/{chunk-NAWLWKOJ.mjs → chunk-3LMHYL4W.mjs} +2 -2
  82. package/dist/{chunk-O7SVHLD7.mjs → chunk-6LJW76BZ.mjs} +4756 -951
  83. package/dist/{chunk-X6VNUBES.cjs → chunk-BDZR4DZ6.cjs} +2058 -1748
  84. package/dist/{chunk-IOTGRLJH.mjs → chunk-BQGLWC6N.mjs} +867 -557
  85. package/dist/{chunk-N6424WKA.mjs → chunk-EBBWRRSB.mjs} +1 -1
  86. package/dist/{chunk-UYMSFJQZ.mjs → chunk-JQVOUS6B.mjs} +5 -5
  87. package/dist/{chunk-3H5UAJB3.mjs → chunk-QRXMYOVN.mjs} +870 -525
  88. package/dist/{chunk-54S5A5PZ.mjs → chunk-VDUNZTJC.mjs} +36 -1
  89. package/dist/{chunk-4R65YYAD.mjs → chunk-Y2RH4QWG.mjs} +4228 -1070
  90. package/dist/diagram/drawing-resolve.d.ts.map +1 -1
  91. package/dist/diagram/drawing-view.d.ts +6 -0
  92. package/dist/diagram/drawing-view.d.ts.map +1 -1
  93. package/dist/diagram/engine/engine-to-result.d.ts.map +1 -1
  94. package/dist/diagram/index.cjs +786 -145
  95. package/dist/diagram/index.d.ts +1 -0
  96. package/dist/diagram/index.d.ts.map +1 -1
  97. package/dist/diagram/index.mjs +783 -147
  98. package/dist/diagram/layout/smartart-layout-types.d.ts +7 -0
  99. package/dist/diagram/layout/smartart-layout-types.d.ts.map +1 -1
  100. package/dist/diagram/layout-preview.d.ts +4 -0
  101. package/dist/diagram/layout-preview.d.ts.map +1 -1
  102. package/dist/diagram/layout-role-style.d.ts +4 -0
  103. package/dist/diagram/layout-role-style.d.ts.map +1 -0
  104. package/dist/diagram/load.d.ts.map +1 -1
  105. package/dist/diagram/picture-layout.d.ts +23 -0
  106. package/dist/diagram/picture-layout.d.ts.map +1 -0
  107. package/dist/diagram/types.d.ts +6 -0
  108. package/dist/diagram/types.d.ts.map +1 -1
  109. package/dist/diagram/write/cache.d.ts +1 -0
  110. package/dist/diagram/write/cache.d.ts.map +1 -1
  111. package/dist/digest/crc32.d.ts +2 -0
  112. package/dist/digest/crc32.d.ts.map +1 -0
  113. package/dist/digest/index.cjs +11 -0
  114. package/dist/digest/index.d.ts +1 -0
  115. package/dist/digest/index.d.ts.map +1 -1
  116. package/dist/digest/index.mjs +11 -1
  117. package/dist/docx/diagram-cache.d.ts.map +1 -1
  118. package/dist/docx/diagram-save.d.ts.map +1 -1
  119. package/dist/docx/drawing.d.ts.map +1 -1
  120. package/dist/docx/embedded.cjs +882 -212
  121. package/dist/docx/embedded.mjs +882 -212
  122. package/dist/docx/index.cjs +3082 -866
  123. package/dist/docx/index.mjs +3082 -866
  124. package/dist/docx/inline-model.d.ts +4 -0
  125. package/dist/docx/inline-model.d.ts.map +1 -1
  126. package/dist/docx/layout/adapt-floats.d.ts.map +1 -1
  127. package/dist/docx/layout/adapter.d.ts.map +1 -1
  128. package/dist/docx/layout/floats.d.ts.map +1 -1
  129. package/dist/docx/layout/index.cjs +2200 -438
  130. package/dist/docx/layout/index.mjs +2200 -438
  131. package/dist/docx/layout/input.d.ts +3 -0
  132. package/dist/docx/layout/input.d.ts.map +1 -1
  133. package/dist/docx/layout/result.d.ts +3 -0
  134. package/dist/docx/layout/result.d.ts.map +1 -1
  135. package/dist/docx/load/index.cjs +1311 -641
  136. package/dist/docx/load/index.mjs +1311 -641
  137. package/dist/docx/parse.d.ts.map +1 -1
  138. package/dist/docx/ui/index.cjs +2832 -842
  139. package/dist/docx/ui/index.mjs +2832 -842
  140. package/dist/docx/ui/inline-content-schema.d.ts.map +1 -1
  141. package/dist/docx/ui/run-adapter.d.ts.map +1 -1
  142. package/dist/docx/write-drawing.d.ts.map +1 -1
  143. package/dist/drawingml/index.cjs +707 -111
  144. package/dist/drawingml/index.d.ts +7 -0
  145. package/dist/drawingml/index.d.ts.map +1 -1
  146. package/dist/drawingml/index.mjs +697 -113
  147. package/dist/drawingml/picture-artistic.d.ts +14 -0
  148. package/dist/drawingml/picture-artistic.d.ts.map +1 -0
  149. package/dist/drawingml/picture-effects.d.ts +4 -1
  150. package/dist/drawingml/picture-effects.d.ts.map +1 -1
  151. package/dist/drawingml/picture-fill.d.ts.map +1 -1
  152. package/dist/drawingml/picture-hsl-pixels.d.ts +4 -0
  153. package/dist/drawingml/picture-hsl-pixels.d.ts.map +1 -0
  154. package/dist/drawingml/picture-layout.d.ts +25 -0
  155. package/dist/drawingml/picture-layout.d.ts.map +1 -0
  156. package/dist/drawingml/picture-standard-effects.d.ts +15 -0
  157. package/dist/drawingml/picture-standard-effects.d.ts.map +1 -0
  158. package/dist/drawingml/picture-transfer.d.ts +11 -0
  159. package/dist/drawingml/picture-transfer.d.ts.map +1 -0
  160. package/dist/drawingml/raster-image.d.ts +29 -0
  161. package/dist/drawingml/raster-image.d.ts.map +1 -0
  162. package/dist/drawingml/types.d.ts +1 -0
  163. package/dist/drawingml/types.d.ts.map +1 -1
  164. package/dist/drawingml/write-pattern-picture.d.ts.map +1 -1
  165. package/dist/geometry/index.cjs +38 -0
  166. package/dist/geometry/index.d.ts +1 -0
  167. package/dist/geometry/index.d.ts.map +1 -1
  168. package/dist/geometry/index.mjs +36 -1
  169. package/dist/geometry/picture-tile.d.ts +29 -0
  170. package/dist/geometry/picture-tile.d.ts.map +1 -0
  171. package/dist/index.cjs +15164 -12669
  172. package/dist/index.mjs +15164 -12669
  173. package/dist/pptx/automation/index.cjs +7431 -2967
  174. package/dist/pptx/automation/index.d.ts +5 -5
  175. package/dist/pptx/automation/index.mjs +7 -7
  176. package/dist/pptx/chunks/{elements-mSCZ84Tc.d.ts → elements-f3UbFph-.d.ts} +7 -2
  177. package/dist/pptx/chunks/elements-f3UbFph-.d.ts.map +1 -0
  178. package/dist/pptx/chunks/{index-DnWlmYCy.d.ts → index-BnH2QjYm.d.ts} +4 -4
  179. package/dist/pptx/chunks/{index-DnWlmYCy.d.ts.map → index-BnH2QjYm.d.ts.map} +1 -1
  180. package/dist/pptx/chunks/{index-D-FdgqrP.d.ts → index-Bp-1pGo1.d.ts} +4 -4
  181. package/dist/pptx/chunks/{index-D-FdgqrP.d.ts.map → index-Bp-1pGo1.d.ts.map} +1 -1
  182. package/dist/pptx/chunks/{index-DKybuHPT.d.ts → index-BuMPQDQb.d.ts} +27 -16
  183. package/dist/pptx/chunks/index-BuMPQDQb.d.ts.map +1 -0
  184. package/dist/pptx/chunks/{smart-art-DLumQo90.d.ts → smart-art-CmOrPLLQ.d.ts} +86 -2
  185. package/dist/pptx/chunks/smart-art-CmOrPLLQ.d.ts.map +1 -0
  186. package/dist/pptx/chunks/{text-operations-hyPODwIQ.d.ts → text-operations-D5sgspO6.d.ts} +2 -2
  187. package/dist/pptx/chunks/{text-operations-hyPODwIQ.d.ts.map → text-operations-D5sgspO6.d.ts.map} +1 -1
  188. package/dist/pptx/cli/index.cjs +7196 -2732
  189. package/dist/pptx/cli/index.d.ts +1 -1
  190. package/dist/pptx/cli/index.mjs +6 -6
  191. package/dist/pptx/converter/index.cjs +3895 -503
  192. package/dist/pptx/converter/index.d.ts +1 -1
  193. package/dist/pptx/converter/index.mjs +3 -3
  194. package/dist/pptx/editor/render/find-replace.cjs +14 -14
  195. package/dist/pptx/editor/render/find-replace.d.ts +2 -2
  196. package/dist/pptx/editor/render/find-replace.mjs +1 -1
  197. package/dist/pptx/editor/render/slide-operations.cjs +8 -8
  198. package/dist/pptx/editor/render/slide-operations.mjs +2 -2
  199. package/dist/pptx/editor/render/text-runs-style-patch.d.ts +1 -1
  200. package/dist/pptx/editor/render/text-style-scope.d.ts +1 -1
  201. package/dist/pptx/index.cjs +6828 -2969
  202. package/dist/pptx/index.d.ts +7 -7
  203. package/dist/pptx/index.mjs +7 -7
  204. package/dist/pptx/node/index.d.ts +1 -1
  205. package/dist/pptx/smartart-layouts/index.d.ts +1 -1
  206. package/dist/pptx/smartart-layouts/index.mjs +2 -2
  207. package/dist/teams/index.cjs +1964 -726
  208. package/dist/teams/index.mjs +1964 -726
  209. package/dist/visio/cell-formula.d.ts +5 -1
  210. package/dist/visio/cell-formula.d.ts.map +1 -1
  211. package/dist/visio/collab/index.cjs +3 -1
  212. package/dist/visio/collab/index.mjs +3 -1
  213. package/dist/visio/container-relationships.d.ts +19 -0
  214. package/dist/visio/container-relationships.d.ts.map +1 -0
  215. package/dist/visio/edit-container-fit.d.ts +19 -0
  216. package/dist/visio/edit-container-fit.d.ts.map +1 -0
  217. package/dist/visio/edit-container-members.d.ts +21 -0
  218. package/dist/visio/edit-container-members.d.ts.map +1 -0
  219. package/dist/visio/edit-delete.d.ts.map +1 -1
  220. package/dist/visio/edit-diagram-parts-commands.d.ts +23 -1
  221. package/dist/visio/edit-diagram-parts-commands.d.ts.map +1 -1
  222. package/dist/visio/edit-diagram-parts.d.ts +3 -2
  223. package/dist/visio/edit-diagram-parts.d.ts.map +1 -1
  224. package/dist/visio/edit-geometry.d.ts +4 -1
  225. package/dist/visio/edit-geometry.d.ts.map +1 -1
  226. package/dist/visio/edit-recalculate-index.d.ts +13 -0
  227. package/dist/visio/edit-recalculate-index.d.ts.map +1 -1
  228. package/dist/visio/edit-recalculate-values.d.ts.map +1 -1
  229. package/dist/visio/edit-recalculate.d.ts.map +1 -1
  230. package/dist/visio/edit.d.ts.map +1 -1
  231. package/dist/visio/formula-analyze.d.ts +2 -0
  232. package/dist/visio/formula-analyze.d.ts.map +1 -1
  233. package/dist/visio/formula-evaluate.d.ts.map +1 -1
  234. package/dist/visio/formula-master.d.ts +1 -0
  235. package/dist/visio/formula-master.d.ts.map +1 -1
  236. package/dist/visio/index.cjs +2771 -1312
  237. package/dist/visio/index.d.ts +1 -1
  238. package/dist/visio/index.d.ts.map +1 -1
  239. package/dist/visio/index.mjs +2771 -1312
  240. package/dist/visio/media.d.ts +4 -23
  241. package/dist/visio/media.d.ts.map +1 -1
  242. package/dist/visio/package-common.d.ts +1 -1
  243. package/dist/visio/package-common.d.ts.map +1 -1
  244. package/dist/visio/shape-structure.d.ts +6 -3
  245. package/dist/visio/shape-structure.d.ts.map +1 -1
  246. package/dist/visio/ui/diagram-parts.d.ts +12 -1
  247. package/dist/visio/ui/diagram-parts.d.ts.map +1 -1
  248. package/dist/visio/ui/index.cjs +2679 -1201
  249. package/dist/visio/ui/index.mjs +2679 -1202
  250. package/dist/xlsx/edit/cell-values.d.ts.map +1 -1
  251. package/dist/xlsx/edit/chart-ex.d.ts +1 -0
  252. package/dist/xlsx/edit/chart-ex.d.ts.map +1 -1
  253. package/dist/xlsx/edit/filter.d.ts +5 -1
  254. package/dist/xlsx/edit/filter.d.ts.map +1 -1
  255. package/dist/xlsx/edit/index.d.ts +1 -0
  256. package/dist/xlsx/edit/index.d.ts.map +1 -1
  257. package/dist/xlsx/edit/session-calc.d.ts +5 -0
  258. package/dist/xlsx/edit/session-calc.d.ts.map +1 -1
  259. package/dist/xlsx/edit/session.d.ts.map +1 -1
  260. package/dist/xlsx/edit/text-columns.d.ts +21 -0
  261. package/dist/xlsx/edit/text-columns.d.ts.map +1 -0
  262. package/dist/xlsx/edit/types.d.ts +5 -1
  263. package/dist/xlsx/edit/types.d.ts.map +1 -1
  264. package/dist/xlsx/embedded-chart-ex-space.d.ts +18 -0
  265. package/dist/xlsx/embedded-chart-ex-space.d.ts.map +1 -0
  266. package/dist/xlsx/filter-criteria.d.ts +22 -0
  267. package/dist/xlsx/filter-criteria.d.ts.map +1 -0
  268. package/dist/xlsx/filter-dynamic.d.ts +8 -0
  269. package/dist/xlsx/filter-dynamic.d.ts.map +1 -0
  270. package/dist/xlsx/filter-menu.d.ts +49 -0
  271. package/dist/xlsx/filter-menu.d.ts.map +1 -0
  272. package/dist/xlsx/filter-rows.d.ts +4 -4
  273. package/dist/xlsx/filter-rows.d.ts.map +1 -1
  274. package/dist/xlsx/index.cjs +5856 -2934
  275. package/dist/xlsx/index.d.ts +4 -0
  276. package/dist/xlsx/index.d.ts.map +1 -1
  277. package/dist/xlsx/index.mjs +5839 -2934
  278. package/dist/xlsx/load/index.cjs +1871 -585
  279. package/dist/xlsx/load/index.mjs +1871 -585
  280. package/dist/xlsx/model-filter.d.ts +54 -0
  281. package/dist/xlsx/model-filter.d.ts.map +1 -0
  282. package/dist/xlsx/model.d.ts +42 -3
  283. package/dist/xlsx/model.d.ts.map +1 -1
  284. package/dist/xlsx/read/chart.d.ts.map +1 -1
  285. package/dist/xlsx/read/drawing.d.ts.map +1 -1
  286. package/dist/xlsx/read/filter-columns.d.ts +5 -0
  287. package/dist/xlsx/read/filter-columns.d.ts.map +1 -0
  288. package/dist/xlsx/read/shared-strings.d.ts +5 -3
  289. package/dist/xlsx/read/shared-strings.d.ts.map +1 -1
  290. package/dist/xlsx/read/sheet-data.d.ts.map +1 -1
  291. package/dist/xlsx/read/sheet-props.d.ts +2 -2
  292. package/dist/xlsx/read/sheet-props.d.ts.map +1 -1
  293. package/dist/xlsx/ui/commands/i18n/filters.d.ts +3 -0
  294. package/dist/xlsx/ui/commands/i18n/filters.d.ts.map +1 -0
  295. package/dist/xlsx/ui/commands/i18n/index.d.ts.map +1 -1
  296. package/dist/xlsx/ui/commands/i18n/navigation.d.ts.map +1 -1
  297. package/dist/xlsx/ui/commands/i18n/tools.d.ts.map +1 -1
  298. package/dist/xlsx/ui/commands/sort-filter.d.ts.map +1 -1
  299. package/dist/xlsx/ui/dialogs/grid-chart.d.ts.map +1 -1
  300. package/dist/xlsx/ui/index.cjs +7177 -4234
  301. package/dist/xlsx/ui/index.mjs +7177 -4234
  302. package/dist/xlsx/write/drawing.d.ts.map +1 -1
  303. package/dist/xlsx/write/filter-columns.d.ts +39 -0
  304. package/dist/xlsx/write/filter-columns.d.ts.map +1 -0
  305. package/dist/xlsx/write/shared-strings.d.ts +4 -4
  306. package/dist/xlsx/write/shared-strings.d.ts.map +1 -1
  307. package/dist/xlsx/write/sheet-props.d.ts +2 -1
  308. package/dist/xlsx/write/sheet-props.d.ts.map +1 -1
  309. package/dist/xlsx/write/smart-art-cache.d.ts.map +1 -1
  310. package/dist/xlsx/write/smart-art.d.ts.map +1 -1
  311. package/dist/xlsx/write/workbook-part.d.ts.map +1 -1
  312. package/package.json +6 -1
  313. package/dist/PptxHandler-QY5VL3CY.mjs +0 -7
  314. package/dist/PptxHandler-SJ5ZUIUX.mjs +0 -4
  315. package/dist/chunk-3GXV5MPC.mjs +0 -41
  316. package/dist/pptx/chunks/elements-mSCZ84Tc.d.ts.map +0 -1
  317. package/dist/pptx/chunks/index-DKybuHPT.d.ts.map +0 -1
  318. package/dist/pptx/chunks/smart-art-DLumQo90.d.ts.map +0 -1
@@ -3626,8 +3626,8 @@ var LiteElement = class {
3626
3626
  return out;
3627
3627
  }
3628
3628
  getAttribute(name) {
3629
- const attrs2 = this.attrs;
3630
- for (let i2 = 0; i2 < attrs2.length; i2 += 2) if (attrs2[i2] === name) return attrs2[i2 + 1] ?? null;
3629
+ const attrs3 = this.attrs;
3630
+ for (let i2 = 0; i2 < attrs3.length; i2 += 2) if (attrs3[i2] === name) return attrs3[i2 + 1] ?? null;
3631
3631
  return null;
3632
3632
  }
3633
3633
  hasAttribute(name) {
@@ -4782,6 +4782,11 @@ var MS_PER_DAY = 864e5;
4782
4782
  var EPOCH_1900 = Date.UTC(1899, 11, 30);
4783
4783
  var EPOCH_1904 = Date.UTC(1904, 0, 1);
4784
4784
  var MAX_DATE_SERIAL = 2958465;
4785
+ function serialToDate(serial, date1904 = false) {
4786
+ if (date1904) return new Date(EPOCH_1904 + Math.round(serial * MS_PER_DAY));
4787
+ const adjusted = serial < 61 ? serial + 1 : serial;
4788
+ return new Date(EPOCH_1900 + Math.round(adjusted * MS_PER_DAY));
4789
+ }
4785
4790
  function dateToSerial(date, date1904 = false) {
4786
4791
  const ms = date.getTime();
4787
4792
  if (date1904) return (ms - EPOCH_1904) / MS_PER_DAY;
@@ -5554,23 +5559,23 @@ function compileFormat(format) {
5554
5559
  if (hit) return hit;
5555
5560
  const code = format.trim() === "" ? "General" : format;
5556
5561
  const sections = splitSections(code).slice(0, 4).map(compileSection);
5557
- let numeric2;
5562
+ let numeric3;
5558
5563
  let text;
5559
5564
  const last = sections[sections.length - 1];
5560
5565
  if (sections.length === 4) {
5561
- numeric2 = sections.slice(0, 3);
5566
+ numeric3 = sections.slice(0, 3);
5562
5567
  text = sections[3];
5563
5568
  } else if (last && last.kind === "text") {
5564
- numeric2 = sections.slice(0, -1);
5569
+ numeric3 = sections.slice(0, -1);
5565
5570
  text = last;
5566
- } else numeric2 = sections;
5567
- if (numeric2.length === 0) numeric2 = [generalSection()];
5568
- const conditional = numeric2.some((s) => s.condition !== void 0);
5569
- if (conditional && numeric2.length === 1) numeric2.push(generalSection());
5571
+ } else numeric3 = sections;
5572
+ if (numeric3.length === 0) numeric3 = [generalSection()];
5573
+ const conditional = numeric3.some((s) => s.condition !== void 0);
5574
+ if (conditional && numeric3.length === 1) numeric3.push(generalSection());
5570
5575
  const compiled = {
5571
- numeric: numeric2,
5576
+ numeric: numeric3,
5572
5577
  conditional,
5573
- isDate: numeric2.some((s) => s.kind === "date")
5578
+ isDate: numeric3.some((s) => s.kind === "date")
5574
5579
  };
5575
5580
  if (text) compiled.text = text;
5576
5581
  if (cache.size >= CACHE_LIMIT) cache.clear();
@@ -6041,26 +6046,494 @@ function displayText(workbook, cell) {
6041
6046
  }).text;
6042
6047
  }
6043
6048
 
6044
- // xlsx/filter-rows.ts
6045
- function rowMatchesFilter(workbook, sheet, row2, filter2) {
6046
- return (filter2.columns ?? []).every((column2) => {
6047
- if (!column2.values && !column2.blank) return true;
6048
- const text = displayText(workbook, getCell(sheet, row2, filter2.range.start.col + column2.offset));
6049
- return text === "" ? !!column2.blank : (column2.values ?? []).includes(text);
6050
- });
6049
+ // xlsx/time-period.ts
6050
+ function timePeriodFormula(period, cell) {
6051
+ const day = `FLOOR(${cell},1)`;
6052
+ const down = `ROUNDDOWN(${cell},0)`;
6053
+ const month = (offset2) => `AND(MONTH(${cell})=MONTH(EDATE(TODAY(),${offset2})),YEAR(${cell})=YEAR(EDATE(TODAY(),${offset2})))`;
6054
+ switch (period) {
6055
+ case "today":
6056
+ return `${day}=TODAY()`;
6057
+ case "yesterday":
6058
+ return `${day}=TODAY()-1`;
6059
+ case "tomorrow":
6060
+ return `${day}=TODAY()+1`;
6061
+ case "last7Days":
6062
+ return `AND(TODAY()-${day}<=6,${day}<=TODAY())`;
6063
+ case "thisWeek":
6064
+ return `AND(TODAY()-${down}<=WEEKDAY(TODAY())-1,${down}-TODAY()<=7-WEEKDAY(TODAY()))`;
6065
+ case "lastWeek":
6066
+ return `AND(TODAY()-${down}>=(WEEKDAY(TODAY())),TODAY()-${down}<(WEEKDAY(TODAY())+7))`;
6067
+ case "nextWeek":
6068
+ return `AND(${down}-TODAY()>(7-WEEKDAY(TODAY())),${down}-TODAY()<(15-WEEKDAY(TODAY())))`;
6069
+ case "thisMonth":
6070
+ return `AND(MONTH(${cell})=MONTH(TODAY()),YEAR(${cell})=YEAR(TODAY()))`;
6071
+ case "lastMonth":
6072
+ return month("0-1");
6073
+ case "nextMonth":
6074
+ return month("0+1");
6075
+ }
6076
+ }
6077
+ function inTimePeriod(period, value2, today, date1904 = false) {
6078
+ const v = Math.floor(value2);
6079
+ const t = Math.floor(today);
6080
+ const todayDate = serialToDate(t, date1904);
6081
+ const weekday2 = todayDate.getUTCDay() + 1;
6082
+ const monthOf = (serial) => {
6083
+ const d = serialToDate(serial, date1904);
6084
+ return d.getUTCFullYear() * 12 + d.getUTCMonth();
6085
+ };
6086
+ const current = todayDate.getUTCFullYear() * 12 + todayDate.getUTCMonth();
6087
+ switch (period) {
6088
+ case "today":
6089
+ return v === t;
6090
+ case "yesterday":
6091
+ return v === t - 1;
6092
+ case "tomorrow":
6093
+ return v === t + 1;
6094
+ case "last7Days":
6095
+ return t - v <= 6 && v <= t;
6096
+ case "thisWeek":
6097
+ return t - v <= weekday2 - 1 && v - t <= 7 - weekday2;
6098
+ case "lastWeek":
6099
+ return t - v >= weekday2 && t - v < weekday2 + 7;
6100
+ case "nextWeek":
6101
+ return v - t > 7 - weekday2 && v - t < 15 - weekday2;
6102
+ case "thisMonth":
6103
+ return monthOf(v) === current;
6104
+ case "lastMonth":
6105
+ return monthOf(v) === current - 1;
6106
+ case "nextMonth":
6107
+ return monthOf(v) === current + 1;
6108
+ }
6109
+ }
6110
+
6111
+ // xlsx/filter-dynamic.ts
6112
+ function todaySerial(date1904) {
6113
+ const now = /* @__PURE__ */ new Date();
6114
+ return Math.floor(
6115
+ dateToSerial(new Date(Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())), date1904)
6116
+ );
6117
+ }
6118
+ var PERIODS = {
6119
+ today: "today",
6120
+ yesterday: "yesterday",
6121
+ tomorrow: "tomorrow",
6122
+ thisWeek: "thisWeek",
6123
+ lastWeek: "lastWeek",
6124
+ nextWeek: "nextWeek",
6125
+ thisMonth: "thisMonth",
6126
+ lastMonth: "lastMonth",
6127
+ nextMonth: "nextMonth"
6128
+ };
6129
+ function inDynamicPeriod(type, value2, today, date1904) {
6130
+ const period = PERIODS[type];
6131
+ if (period) return inTimePeriod(period, value2, today, date1904);
6132
+ const d = serialToDate(Math.floor(value2), date1904);
6133
+ const now = serialToDate(today, date1904);
6134
+ const quarter = (date) => date.getUTCFullYear() * 4 + Math.floor(date.getUTCMonth() / 3);
6135
+ switch (type) {
6136
+ case "thisQuarter":
6137
+ return quarter(d) === quarter(now);
6138
+ case "lastQuarter":
6139
+ return quarter(d) === quarter(now) - 1;
6140
+ case "nextQuarter":
6141
+ return quarter(d) === quarter(now) + 1;
6142
+ case "thisYear":
6143
+ return d.getUTCFullYear() === now.getUTCFullYear();
6144
+ case "lastYear":
6145
+ return d.getUTCFullYear() === now.getUTCFullYear() - 1;
6146
+ case "nextYear":
6147
+ return d.getUTCFullYear() === now.getUTCFullYear() + 1;
6148
+ case "yearToDate":
6149
+ return d.getUTCFullYear() === now.getUTCFullYear() && Math.floor(value2) <= today;
6150
+ }
6151
+ const q = /^Q([1-4])$/.exec(type);
6152
+ if (q) return Math.floor(d.getUTCMonth() / 3) + 1 === Number(q[1]);
6153
+ const m = /^M(\d{1,2})$/.exec(type);
6154
+ if (m) return d.getUTCMonth() + 1 === Number(m[1]);
6155
+ return false;
6156
+ }
6157
+ function inDateGroup(item2, serial, date1904) {
6158
+ const d = serialToDate(serial, date1904);
6159
+ const fields = [
6160
+ [item2.year, d.getUTCFullYear()],
6161
+ [item2.month, d.getUTCMonth() + 1],
6162
+ [item2.day, d.getUTCDate()],
6163
+ [item2.hour, d.getUTCHours()],
6164
+ [item2.minute, d.getUTCMinutes()],
6165
+ [item2.second, d.getUTCSeconds()]
6166
+ ];
6167
+ const depth = ["year", "month", "day", "hour", "minute", "second"].indexOf(item2.grouping);
6168
+ return fields.slice(0, depth + 1).every(([want, have]) => want === void 0 || want === have);
6169
+ }
6170
+
6171
+ // color/hex-rgb.ts
6172
+ function parseArgbHex(hex) {
6173
+ const clean = hex.replace(/^#/, "");
6174
+ const rgb = clean.length === 8 ? clean.slice(2) : clean;
6175
+ if (!/^[0-9a-fA-F]{6}$/.test(rgb)) return void 0;
6176
+ return [0, 2, 4].map((i2) => parseInt(rgb.slice(i2, i2 + 2), 16));
6177
+ }
6178
+ var clamp255 = (v) => Math.max(0, Math.min(255, v));
6179
+ var rgbToUpperHex = (rgb) => `#${rgb.map((v) => clamp255(Math.round(v)).toString(16).padStart(2, "0")).join("").toUpperCase()}`;
6180
+
6181
+ // xlsx/layout/tint.ts
6182
+ var HLSMAX = 240;
6183
+ var RGBMAX = 255;
6184
+ var idiv = (a2, b) => Math.trunc(a2 / b);
6185
+ function rgbToHls240(r, g2, b) {
6186
+ const max = Math.max(r, g2, b);
6187
+ const min = Math.min(r, g2, b);
6188
+ const l = idiv((max + min) * HLSMAX + RGBMAX, 2 * RGBMAX);
6189
+ if (max === min) return { h: idiv(HLSMAX * 2, 3), l, s: 0 };
6190
+ const sum3 = max + min;
6191
+ const s = l <= HLSMAX / 2 ? idiv((max - min) * HLSMAX + idiv(sum3, 2), sum3) : idiv((max - min) * HLSMAX + idiv(2 * RGBMAX - sum3, 2), 2 * RGBMAX - sum3);
6192
+ const delta = (c2) => idiv((max - c2) * idiv(HLSMAX, 6) + idiv(max - min, 2), max - min);
6193
+ const rd = delta(r);
6194
+ const gd18 = delta(g2);
6195
+ const bd = delta(b);
6196
+ let h2;
6197
+ if (r === max) h2 = bd - gd18;
6198
+ else if (g2 === max) h2 = idiv(HLSMAX, 3) + rd - bd;
6199
+ else h2 = idiv(2 * HLSMAX, 3) + gd18 - rd;
6200
+ if (h2 < 0) h2 += HLSMAX;
6201
+ if (h2 > HLSMAX) h2 -= HLSMAX;
6202
+ return { h: h2, l, s };
6203
+ }
6204
+ function hueToRgb(n1, n2, hue) {
6205
+ let h2 = hue;
6206
+ if (h2 < 0) h2 += HLSMAX;
6207
+ if (h2 > HLSMAX) h2 -= HLSMAX;
6208
+ const sixth = idiv(HLSMAX, 6);
6209
+ if (h2 < sixth) return n1 + idiv((n2 - n1) * h2 + idiv(HLSMAX, 12), sixth);
6210
+ if (h2 < idiv(HLSMAX, 2)) return n2;
6211
+ if (h2 < idiv(HLSMAX * 2, 3))
6212
+ return n1 + idiv((n2 - n1) * (idiv(HLSMAX * 2, 3) - h2) + idiv(HLSMAX, 12), sixth);
6213
+ return n1;
6214
+ }
6215
+ var clamp2552 = (v) => Math.max(0, Math.min(255, v));
6216
+ function hls240ToRgb({ h: h2, l, s }) {
6217
+ if (s === 0) {
6218
+ const v = clamp2552(Math.round(l * RGBMAX / HLSMAX));
6219
+ return [v, v, v];
6220
+ }
6221
+ const m2 = l <= HLSMAX / 2 ? idiv(l * (HLSMAX + s) + idiv(HLSMAX, 2), HLSMAX) : l + s - idiv(l * s + idiv(HLSMAX, 2), HLSMAX);
6222
+ const m1 = 2 * l - m2;
6223
+ const channel = (hue) => clamp2552(idiv(hueToRgb(m1, m2, hue) * RGBMAX + idiv(HLSMAX, 2), HLSMAX));
6224
+ return [channel(h2 + idiv(HLSMAX, 3)), channel(h2), channel(h2 - idiv(HLSMAX, 3))];
6225
+ }
6226
+ var parseHex = parseArgbHex;
6227
+ var toHexColor = rgbToUpperHex;
6228
+ function applyTint(hex, tint) {
6229
+ const rgb = parseHex(hex) ?? [0, 0, 0];
6230
+ if (!tint) return toHexColor(rgb);
6231
+ const t = Math.max(-1, Math.min(1, tint));
6232
+ const hls = rgbToHls240(...rgb);
6233
+ const l = t < 0 ? Math.trunc(hls.l * (1 + t)) : Math.round(hls.l * (1 - t) + HLSMAX * t);
6234
+ return toHexColor(hls240ToRgb({ ...hls, l: Math.max(0, Math.min(HLSMAX, l)) }));
6235
+ }
6236
+
6237
+ // chart/render/theme-palette.ts
6238
+ var THEME_SLOTS = [
6239
+ "lt1",
6240
+ "dk1",
6241
+ "lt2",
6242
+ "dk2",
6243
+ "accent1",
6244
+ "accent2",
6245
+ "accent3",
6246
+ "accent4",
6247
+ "accent5",
6248
+ "accent6",
6249
+ "hlink",
6250
+ "folHlink"
6251
+ ];
6252
+ var DEFAULT_THEME_COLORS = [
6253
+ "FFFFFF",
6254
+ "000000",
6255
+ "E7E6E6",
6256
+ "44546A",
6257
+ "4472C4",
6258
+ "ED7D31",
6259
+ "A5A5A5",
6260
+ "FFC000",
6261
+ "5B9BD5",
6262
+ "70AD47",
6263
+ "0563C1",
6264
+ "954F72"
6265
+ ];
6266
+ function themeColor(theme, index3) {
6267
+ const hex = theme.colors[index3] ?? DEFAULT_THEME_COLORS[index3];
6268
+ return hex && parseArgbHex(hex) ? hex.replace(/^#/, "") : void 0;
6269
+ }
6270
+
6271
+ // xlsx/layout/colors.ts
6272
+ var INDEXED_COLORS = [
6273
+ "000000",
6274
+ "FFFFFF",
6275
+ "FF0000",
6276
+ "00FF00",
6277
+ "0000FF",
6278
+ "FFFF00",
6279
+ "FF00FF",
6280
+ "00FFFF",
6281
+ "000000",
6282
+ "FFFFFF",
6283
+ "FF0000",
6284
+ "00FF00",
6285
+ "0000FF",
6286
+ "FFFF00",
6287
+ "FF00FF",
6288
+ "00FFFF",
6289
+ "800000",
6290
+ "008000",
6291
+ "000080",
6292
+ "808000",
6293
+ "800080",
6294
+ "008080",
6295
+ "C0C0C0",
6296
+ "808080",
6297
+ "9999FF",
6298
+ "993366",
6299
+ "FFFFCC",
6300
+ "CCFFFF",
6301
+ "660066",
6302
+ "FF8080",
6303
+ "0066CC",
6304
+ "CCCCFF",
6305
+ "000080",
6306
+ "FF00FF",
6307
+ "FFFF00",
6308
+ "00FFFF",
6309
+ "800080",
6310
+ "800000",
6311
+ "008080",
6312
+ "0000FF",
6313
+ "00CCFF",
6314
+ "CCFFFF",
6315
+ "CCFFCC",
6316
+ "FFFF99",
6317
+ "99CCFF",
6318
+ "FF99CC",
6319
+ "CC99FF",
6320
+ "FFCC99",
6321
+ "3366FF",
6322
+ "33CCCC",
6323
+ "99CC00",
6324
+ "FFCC00",
6325
+ "FF9900",
6326
+ "FF6600",
6327
+ "666699",
6328
+ "969696",
6329
+ "003366",
6330
+ "339966",
6331
+ "003300",
6332
+ "333300",
6333
+ "993300",
6334
+ "993366",
6335
+ "333399",
6336
+ "333333",
6337
+ "000000",
6338
+ "FFFFFF"
6339
+ ];
6340
+ function resolveColor(color, theme, fallback, indexed = INDEXED_COLORS) {
6341
+ if (!color) return fallback;
6342
+ let base;
6343
+ if (color.rgb !== void 0) base = parseHex(color.rgb) ? color.rgb : void 0;
6344
+ else if (color.theme !== void 0) base = themeColor(theme, color.theme);
6345
+ else if (color.indexed !== void 0)
6346
+ base = indexed[color.indexed] ?? INDEXED_COLORS[color.indexed];
6347
+ if (base === void 0) return fallback;
6348
+ return applyTint(base, color.tint);
6349
+ }
6350
+
6351
+ // xlsx/filter-criteria.ts
6352
+ var numeric = (cell) => typeof cell?.value === "number" ? cell.value : void 0;
6353
+ function wildcardRegex(pattern) {
6354
+ let out = "";
6355
+ let wild = false;
6356
+ for (let i2 = 0; i2 < pattern.length; i2++) {
6357
+ const ch = pattern[i2];
6358
+ if (ch === "~" && i2 + 1 < pattern.length) {
6359
+ wild = true;
6360
+ out += pattern[++i2].replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
6361
+ } else if (ch === "*") {
6362
+ out += "[\\s\\S]*";
6363
+ wild = true;
6364
+ } else if (ch === "?") {
6365
+ out += "[\\s\\S]";
6366
+ wild = true;
6367
+ } else out += ch.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
6368
+ }
6369
+ return wild ? new RegExp(`^${out}$`, "i") : void 0;
6370
+ }
6371
+ var rank = (v) => typeof v === "number" ? 0 : typeof v === "string" ? 1 : 2;
6372
+ function compare(cell, text, operand2) {
6373
+ const value2 = cell?.value ?? null;
6374
+ const asNumber = operand2.trim() === "" ? NaN : Number(operand2);
6375
+ if (typeof value2 === "number" && !Number.isNaN(asNumber)) return value2 - asNumber;
6376
+ if (typeof value2 === "string") {
6377
+ const a2 = value2.toLowerCase();
6378
+ const b = operand2.toLowerCase();
6379
+ return a2 < b ? -1 : a2 > b ? 1 : 0;
6380
+ }
6381
+ return rank(value2) - (Number.isNaN(asNumber) ? 1 : 0);
6382
+ }
6383
+ function conditionTest(workbook, condition) {
6384
+ const { operator, value: operand2 } = condition;
6385
+ if (operand2 === " " && (operator === "notEqual" || operator === "equal")) {
6386
+ const blank = (cell) => cell?.value === null || cell?.value === void 0 || cell.value === "";
6387
+ return operator === "notEqual" ? (cell) => !blank(cell) : blank;
6388
+ }
6389
+ const wild = operator === "equal" || operator === "notEqual" ? wildcardRegex(operand2) : void 0;
6390
+ return (cell) => {
6391
+ const empty = cell?.value === null || cell?.value === void 0 || cell.value === "";
6392
+ if (empty)
6393
+ return operator === "notEqual" ? operand2 !== "" : operator === "equal" && operand2 === "";
6394
+ if (wild) {
6395
+ const hit = wild.test(displayText(workbook, cell));
6396
+ return operator === "equal" ? hit : !hit;
6397
+ }
6398
+ const cmp = compare(cell, displayText(workbook, cell), operand2);
6399
+ switch (operator) {
6400
+ case "equal":
6401
+ return cmp === 0;
6402
+ case "notEqual":
6403
+ return cmp !== 0;
6404
+ case "lessThan":
6405
+ return cmp < 0;
6406
+ case "lessThanOrEqual":
6407
+ return cmp <= 0;
6408
+ case "greaterThan":
6409
+ return cmp > 0;
6410
+ case "greaterThanOrEqual":
6411
+ return cmp >= 0;
6412
+ }
6413
+ };
6414
+ }
6415
+ var SOLID = (fill) => fill?.type === "pattern" && fill.pattern !== "none" ? fill.fgColor ?? fill.bgColor : void 0;
6416
+ function cellFillColor(workbook, cell, cf) {
6417
+ const fromCf = SOLID(cf?.style?.fill);
6418
+ if (fromCf) return resolveColor(fromCf, workbook.theme)?.toUpperCase();
6419
+ if (cf?.colorScale) return cf.colorScale.toUpperCase();
6420
+ const fill = styleAt(workbook, cell?.styleId).fill;
6421
+ return resolveColor(SOLID(fill), workbook.theme)?.toUpperCase();
6422
+ }
6423
+ function cellFontColor(workbook, cell, cf) {
6424
+ const color = cf?.style?.font?.color ?? styleAt(workbook, cell?.styleId).font.color;
6425
+ return (resolveColor(color, workbook.theme, "#000000") ?? "#000000").toUpperCase();
6426
+ }
6427
+ function colourTest(workbook, column2, read) {
6428
+ const color = column2.color;
6429
+ if (!color?.style) return void 0;
6430
+ if (color.cellColor) {
6431
+ const want2 = resolveColor(SOLID(color.style.fill), workbook.theme)?.toUpperCase();
6432
+ return (row2) => {
6433
+ const { cell, cf } = read(row2);
6434
+ return cellFillColor(workbook, cell, cf) === want2;
6435
+ };
6436
+ }
6437
+ const want = (resolveColor(color.style.font?.color, workbook.theme, "#000000") ?? "#000000").toUpperCase();
6438
+ return (row2) => {
6439
+ const { cell, cf } = read(row2);
6440
+ return cellFontColor(workbook, cell, cf) === want;
6441
+ };
6051
6442
  }
6052
- function isFilteredRow(workbook, sheet, row2) {
6443
+ function compileAutoFilter(workbook, sheet, filter2, options = {}) {
6444
+ const { range } = filter2;
6445
+ const tests = [];
6446
+ const today = options.today ?? todaySerial(workbook.date1904);
6447
+ for (const column2 of filter2.columns ?? []) {
6448
+ const col = range.start.col + column2.offset;
6449
+ const cellOf2 = (row2) => getCell(sheet, row2, col);
6450
+ const numbers3 = () => {
6451
+ const out = [];
6452
+ for (let r = range.start.row + 1; r <= range.end.row; r++) {
6453
+ const n = numeric(cellOf2(r));
6454
+ if (n !== void 0) out.push(n);
6455
+ }
6456
+ return out;
6457
+ };
6458
+ if (column2.top10) {
6459
+ const spec2 = column2.top10;
6460
+ const sorted2 = numbers3().sort((a2, b) => spec2.top ? b - a2 : a2 - b);
6461
+ const count2 = spec2.percent ? Math.max(1, Math.floor(sorted2.length * spec2.value / 100)) : Math.max(1, Math.floor(spec2.value));
6462
+ const cut = sorted2[Math.min(count2, sorted2.length) - 1];
6463
+ tests.push((row2) => {
6464
+ const n = numeric(cellOf2(row2));
6465
+ return n !== void 0 && cut !== void 0 && (spec2.top ? n >= cut : n <= cut);
6466
+ });
6467
+ } else if (column2.custom?.conditions.length) {
6468
+ const parts = column2.custom.conditions.slice(0, 2).map((c2) => conditionTest(workbook, c2));
6469
+ const and = !!column2.custom.and;
6470
+ tests.push((row2) => {
6471
+ const cell = cellOf2(row2);
6472
+ return and ? parts.every((t) => t(cell)) : parts.some((t) => t(cell));
6473
+ });
6474
+ } else if (column2.dynamic) {
6475
+ const { type } = column2.dynamic;
6476
+ if (type === "aboveAverage" || type === "belowAverage") {
6477
+ const all2 = numbers3();
6478
+ const avg = all2.length ? all2.reduce((a2, b) => a2 + b, 0) / all2.length : 0;
6479
+ tests.push((row2) => {
6480
+ const n = numeric(cellOf2(row2));
6481
+ return n !== void 0 && (type === "aboveAverage" ? n > avg : n < avg);
6482
+ });
6483
+ } else if (type !== "null")
6484
+ tests.push((row2) => {
6485
+ const n = numeric(cellOf2(row2));
6486
+ return n !== void 0 && inDynamicPeriod(type, n, today, workbook.date1904);
6487
+ });
6488
+ } else if (column2.color) {
6489
+ const test = colourTest(workbook, column2, (row2) => ({
6490
+ cell: cellOf2(row2),
6491
+ cf: options.formatAt?.(row2, col)
6492
+ }));
6493
+ if (test) tests.push(test);
6494
+ } else if (column2.icon) {
6495
+ const { iconSet, iconId } = column2.icon;
6496
+ if (options.formatAt)
6497
+ tests.push((row2) => {
6498
+ const icon = options.formatAt?.(row2, col)?.icon;
6499
+ return iconId === void 0 ? !icon : icon?.set === iconSet && icon.index === iconId;
6500
+ });
6501
+ } else if (column2.values || column2.blank || column2.dateGroups?.length) {
6502
+ const values2 = new Set(column2.values ?? []);
6503
+ const groups = column2.dateGroups ?? [];
6504
+ tests.push((row2) => {
6505
+ const cell = cellOf2(row2);
6506
+ const text = displayText(workbook, cell);
6507
+ if (text === "") return !!column2.blank;
6508
+ if (values2.has(text)) return true;
6509
+ const n = numeric(cell);
6510
+ return n !== void 0 && groups.some((g2) => inDateGroup(g2, n, workbook.date1904));
6511
+ });
6512
+ }
6513
+ }
6514
+ return (row2) => tests.every((test) => test(row2));
6515
+ }
6516
+ function rowMatchesFilter(workbook, sheet, row2, filter2, options) {
6517
+ return compileAutoFilter(workbook, sheet, filter2, options)(row2);
6518
+ }
6519
+
6520
+ // xlsx/filter-rows.ts
6521
+ function isFilteredRow(workbook, sheet, row2, matches2) {
6053
6522
  const filter2 = sheet.autoFilter;
6054
6523
  if (!filter2) return false;
6055
6524
  const info = sheet.rowInfo.get(row2);
6056
6525
  if (info?.filteredOut !== void 0) return info.filteredOut;
6057
- return !!info?.hidden && row2 > filter2.range.start.row && row2 <= filter2.range.end.row && !rowMatchesFilter(workbook, sheet, row2, filter2);
6526
+ return !!info?.hidden && row2 > filter2.range.start.row && row2 <= filter2.range.end.row && !(matches2 ?? compileAutoFilter(workbook, sheet, filter2))(row2);
6058
6527
  }
6059
6528
  function readFilteredRows(workbook) {
6060
- for (const sheet of workbook.sheets)
6529
+ for (const sheet of workbook.sheets) {
6530
+ const filter2 = sheet.autoFilter;
6531
+ if (!filter2) continue;
6532
+ const matches2 = compileAutoFilter(workbook, sheet, filter2);
6061
6533
  for (const [row2, info] of sheet.rowInfo)
6062
- if (sheet.autoFilter && row2 > sheet.autoFilter.range.start.row && row2 <= sheet.autoFilter.range.end.row && info.hidden)
6063
- info.filteredOut = isFilteredRow(workbook, sheet, row2);
6534
+ if (row2 > filter2.range.start.row && row2 <= filter2.range.end.row && info.hidden)
6535
+ info.filteredOut = isFilteredRow(workbook, sheet, row2, matches2);
6536
+ }
6064
6537
  }
6065
6538
 
6066
6539
  // xlsx/workbook.ts
@@ -6567,14 +7040,14 @@ function tokenize(formula2) {
6567
7040
  }
6568
7041
  if (ch === "'" || ch === "[") throw new FormulaError("Malformed sheet reference", start);
6569
7042
  }
6570
- const numeric2 = isDigit3(code) || ch === ".";
6571
- if (numeric2 || ch === "$" || nameStart) {
7043
+ const numeric3 = isDigit3(code) || ch === ".";
7044
+ if (numeric3 || ch === "$" || nameStart) {
6572
7045
  const ref = readReference(source3, i2);
6573
7046
  if (ref) {
6574
7047
  push(refToken(source3, start, i2 + ref.length, ref.ref, void 0));
6575
7048
  continue;
6576
7049
  }
6577
- if (numeric2) {
7050
+ if (numeric3) {
6578
7051
  const m = matchAt(NUMBER_AT, source3, i2);
6579
7052
  if (!m) throw new FormulaError(`Unexpected '${ch}'`, start);
6580
7053
  push({ kind: "number", text: m[0], start, value: numberLiteral(m[0]) });
@@ -7548,9 +8021,9 @@ function pivotItems(pivot, field) {
7548
8021
  const key = pivotValueKey(value2);
7549
8022
  if (!items.has(key)) items.set(key, value2);
7550
8023
  }
7551
- const rank3 = (value2) => value2 === null || value2 === "" ? 4 : isCellError(value2) ? 3 : typeof value2 === "boolean" ? 2 : typeof value2 === "string" ? 1 : 0;
8024
+ const rank4 = (value2) => value2 === null || value2 === "" ? 4 : isCellError(value2) ? 3 : typeof value2 === "boolean" ? 2 : typeof value2 === "string" ? 1 : 0;
7552
8025
  return [...items.values()].sort(
7553
- (a2, b) => (group ? groupRank(group, a2) - groupRank(group, b) : 0) || rank3(a2) - rank3(b) || (typeof a2 === "number" && typeof b === "number" ? a2 - b : String(pivotItemLabel(a2)).localeCompare(String(pivotItemLabel(b)), "en", {
8026
+ (a2, b) => (group ? groupRank(group, a2) - groupRank(group, b) : 0) || rank4(a2) - rank4(b) || (typeof a2 === "number" && typeof b === "number" ? a2 - b : String(pivotItemLabel(a2)).localeCompare(String(pivotItemLabel(b)), "en", {
7554
8027
  sensitivity: "base",
7555
8028
  numeric: true
7556
8029
  }))
@@ -9903,9 +10376,39 @@ function parseIndexedPalette(styleSheet) {
9903
10376
  }
9904
10377
 
9905
10378
  // xlsx/read/shared-strings.ts
10379
+ var PHONETIC_TYPES = [
10380
+ "halfwidthKatakana",
10381
+ "fullwidthKatakana",
10382
+ "Hiragana",
10383
+ "noConversion"
10384
+ ];
10385
+ var PHONETIC_ALIGNMENTS = ["noControl", "left", "center", "distributed"];
10386
+ var oneOf = (allowed, value2) => allowed.find((item2) => item2 === value2);
10387
+ function parsePhonetic(element3) {
10388
+ const runs = xChildren(element3, "rPh").map((run2) => {
10389
+ const sb = numAttr(run2, "sb") ?? 0;
10390
+ return { text: xText(xFirst(run2, "t")), sb, eb: numAttr(run2, "eb") ?? sb };
10391
+ });
10392
+ const pr = xFirst(element3, "phoneticPr");
10393
+ if (!runs.length && !pr) return void 0;
10394
+ const phonetic = { runs };
10395
+ if (pr) {
10396
+ const properties2 = {};
10397
+ const fontId = numAttr(pr, "fontId");
10398
+ if (fontId !== void 0) properties2.fontId = fontId;
10399
+ const type = oneOf(PHONETIC_TYPES, att(pr, "type"));
10400
+ if (type) properties2.type = type;
10401
+ const alignment = oneOf(PHONETIC_ALIGNMENTS, att(pr, "alignment"));
10402
+ if (alignment) properties2.alignment = alignment;
10403
+ if (Object.keys(properties2).length) phonetic.properties = properties2;
10404
+ }
10405
+ return phonetic;
10406
+ }
9906
10407
  function parseRichString(element3, palette) {
10408
+ const phonetic = parsePhonetic(element3);
10409
+ const withPhonetic = (value2) => phonetic ? { ...value2, phonetic } : value2;
9907
10410
  const runs = xChildren(element3, "r");
9908
- if (!runs.length) return { text: xText(xFirst(element3, "t")) };
10411
+ if (!runs.length) return withPhonetic({ text: xText(xFirst(element3, "t")) });
9909
10412
  const parsed = runs.map((run2) => {
9910
10413
  const out = { text: xText(xFirst(run2, "t")) };
9911
10414
  const rPr = xFirst(run2, "rPr");
@@ -9916,7 +10419,7 @@ function parseRichString(element3, palette) {
9916
10419
  return out;
9917
10420
  });
9918
10421
  const text = parsed.map((run2) => run2.text).join("");
9919
- return { text, runs: parsed };
10422
+ return withPhonetic({ text, runs: parsed });
9920
10423
  }
9921
10424
  var LABEL = "XLSX shared strings";
9922
10425
  function parseSharedStrings(xml, palette, maxXmlElements) {
@@ -10411,37 +10914,271 @@ function resolveDrawingColor(color, theme, options) {
10411
10914
  };
10412
10915
  }
10413
10916
 
10414
- // drawingml/picture-crop.ts
10415
- var SIDES = { l: "cropLeft", t: "cropTop", r: "cropRight", b: "cropBottom" };
10416
- function parsePictureCrop(blipFill) {
10417
- const rect2 = first(blipFill, "srcRect", NS.a);
10418
- if (!rect2) return void 0;
10419
- const result2 = {};
10420
- for (const [attr3, key] of Object.entries(SIDES)) {
10421
- const raw2 = rect2.getAttribute(attr3);
10422
- if (raw2 === null || !raw2.trim()) continue;
10423
- const percent = raw2.endsWith("%");
10424
- const value2 = Number(percent ? raw2.slice(0, -1) : raw2) / (percent ? 100 : 1e5);
10425
- if (Number.isFinite(value2)) result2[key] = value2;
10917
+ // drawingml/picture-artistic.ts
10918
+ var ARTISTIC_PRIMARY_ATTRIBUTE = {
10919
+ artisticBlur: "radius",
10920
+ artisticCement: "crackSpacing",
10921
+ artisticChalkSketch: "pressure",
10922
+ artisticCrisscrossEtching: "pressure",
10923
+ artisticCutout: "numberOfShades",
10924
+ artisticFilmGrain: "grainSize",
10925
+ artisticGlass: "scaling",
10926
+ artisticGlowDiffused: "intensity",
10927
+ artisticGlowEdges: "smoothness",
10928
+ artisticLightScreen: "gridSize",
10929
+ artisticLineDrawing: "pencilSize",
10930
+ artisticMarker: "size",
10931
+ // Spelled "Mosiaic" in the schema; Microsoft's typo is part of the format.
10932
+ artisticMosiaicBubbles: "pressure",
10933
+ artisticPaintBrush: "brushSize",
10934
+ artisticPaintStrokes: "intensity",
10935
+ artisticPastelsSmooth: "scaling",
10936
+ artisticPencilGrayscale: "pencilSize",
10937
+ artisticPencilSketch: "pressure",
10938
+ artisticPhotocopy: "detail",
10939
+ artisticPlasticWrap: "smoothness",
10940
+ artisticTexturizer: "scaling",
10941
+ artisticWatercolorSponge: "brushSize"
10942
+ };
10943
+ function parseArtisticPictureExtension(node2) {
10944
+ if (node2.namespaceURI !== NS.a || node2.localName !== "extLst") return void 0;
10945
+ const found = [];
10946
+ const unhandled = [];
10947
+ const pending2 = [node2];
10948
+ while (pending2.length) {
10949
+ const item2 = pending2.pop();
10950
+ if (item2 !== node2 && !(item2.namespaceURI === NS.a && item2.localName === "ext") && !(item2.namespaceURI === "http://schemas.microsoft.com/office/drawing/2010/main" && (["imgProps", "imgLayer", "imgEffect", "useLocalDpi"].includes(item2.localName) || ARTISTIC_PRIMARY_ATTRIBUTE[item2.localName])))
10951
+ unhandled.push(item2.localName);
10952
+ if (item2.namespaceURI === "http://schemas.microsoft.com/office/drawing/2010/main" && item2.localName.startsWith("artistic"))
10953
+ found.push(item2);
10954
+ pending2.push(...elements(item2));
10955
+ }
10956
+ if (found.length !== 1) return void 0;
10957
+ const effect = found[0];
10958
+ const key = ARTISTIC_PRIMARY_ATTRIBUTE[effect.localName];
10959
+ if (!key) return void 0;
10960
+ const raw2 = key ? effect.getAttribute(key) : null;
10961
+ const n = raw2 === null ? 0 : Number(raw2);
10962
+ if (!Number.isFinite(n)) return void 0;
10963
+ return {
10964
+ kind: "artistic",
10965
+ name: effect.localName,
10966
+ radius: effect.localName === "artisticBlur" ? n : n / 1e3,
10967
+ baked: true,
10968
+ ...unhandled.length ? { unhandled } : {}
10969
+ };
10970
+ }
10971
+
10972
+ // drawingml/write-color.ts
10973
+ var ELEMENTS = {
10974
+ srgb: "srgbClr",
10975
+ scheme: "schemeClr",
10976
+ system: "sysClr",
10977
+ preset: "prstClr",
10978
+ scrgb: "scrgbClr",
10979
+ hsl: "hslClr"
10980
+ };
10981
+ function drawingColorXml(color) {
10982
+ const local = ELEMENTS[color.kind];
10983
+ const doc = parseXml(`<a:${local} xmlns:a="${NS.a}"/>`);
10984
+ const root = doc.documentElement;
10985
+ if (color.kind === "scrgb" || color.kind === "hsl") {
10986
+ const keys = color.kind === "scrgb" ? ["r", "g", "b"] : ["hue", "sat", "lum"];
10987
+ const values2 = color.value.split(",");
10988
+ keys.forEach((key, i2) => root.setAttribute(key, values2[i2] ?? "0"));
10989
+ } else root.setAttribute("val", color.value);
10990
+ if (color.fallback !== void 0 && color.kind === "system")
10991
+ root.setAttribute("lastClr", color.fallback);
10992
+ for (const transform6 of color.transforms) {
10993
+ if (!/^[A-Za-z_][\w.-]*$/.test(transform6.name))
10994
+ throw new Error(`Invalid DrawingML transform ${transform6.name}`);
10995
+ const node2 = doc.createElementNS(NS.a, `a:${transform6.name}`);
10996
+ if (transform6.value !== "") node2.setAttribute("val", transform6.value);
10997
+ root.appendChild(node2);
10426
10998
  }
10427
- return result2;
10999
+ return buildXml(doc);
10428
11000
  }
10429
- function applyPictureCrop(blipFill, crop) {
10430
- let rect2 = first(blipFill, "srcRect", NS.a);
10431
- if (!rect2 && crop && Object.values(crop).some((value2) => value2 !== void 0)) {
10432
- rect2 = blipFill.ownerDocument.createElementNS(NS.a, "a:srcRect");
10433
- const blip = first(blipFill, "blip", NS.a);
10434
- blipFill.insertBefore(rect2, blip?.nextSibling ?? blipFill.firstChild);
11001
+
11002
+ // drawingml/patch-color.ts
11003
+ function patchDrawingColorIn(container2, color) {
11004
+ const old = elements(container2).find((node2) => parseDrawingColor(node2));
11005
+ const before = parseDrawingColorIn(container2);
11006
+ if (!old || !before || before.kind !== color.kind) {
11007
+ const next = container2.ownerDocument.importNode(
11008
+ parseXml(drawingColorXml(color)).documentElement,
11009
+ true
11010
+ );
11011
+ if (old) container2.replaceChild(next, old);
11012
+ else container2.insertBefore(next, container2.firstChild);
11013
+ return;
10435
11014
  }
10436
- if (!rect2) return;
10437
- for (const [attr3, key] of Object.entries(SIDES)) {
10438
- const value2 = crop?.[key];
10439
- if (value2 === void 0) rect2.removeAttribute(attr3);
10440
- else {
10441
- if (!Number.isFinite(value2)) throw new RangeError("Picture crop must be finite");
10442
- rect2.setAttribute(attr3, String(Math.round(value2 * 1e5)));
11015
+ if (before.value !== color.value) {
11016
+ if (color.kind === "scrgb" || color.kind === "hsl") {
11017
+ const keys = color.kind === "scrgb" ? ["r", "g", "b"] : ["hue", "sat", "lum"];
11018
+ const values2 = color.value.split(",");
11019
+ keys.forEach((key, index3) => old.setAttribute(key, values2[index3] ?? "0"));
11020
+ } else old.setAttribute("val", color.value);
11021
+ }
11022
+ if (before.fallback !== color.fallback && color.kind === "system") {
11023
+ if (color.fallback === void 0) old.removeAttribute("lastClr");
11024
+ else old.setAttribute("lastClr", color.fallback);
11025
+ }
11026
+ const originals = elements(old);
11027
+ color.transforms.forEach((transform6, index3) => {
11028
+ const source3 = originals[index3];
11029
+ if (source3?.localName === transform6.name) {
11030
+ if (before.transforms[index3]?.value !== transform6.value) {
11031
+ if (transform6.value === "") source3.removeAttribute("val");
11032
+ else source3.setAttribute("val", transform6.value);
11033
+ }
11034
+ return;
10443
11035
  }
11036
+ if (!/^[A-Za-z_][\w.-]*$/u.test(transform6.name))
11037
+ throw new Error("Invalid DrawingML colour transform");
11038
+ const next = old.ownerDocument.createElementNS(NS.a, `a:${transform6.name}`);
11039
+ if (transform6.value !== "") next.setAttribute("val", transform6.value);
11040
+ if (source3) old.replaceChild(next, source3);
11041
+ else old.appendChild(next);
11042
+ });
11043
+ for (const extra of originals.slice(color.transforms.length)) old.removeChild(extra);
11044
+ }
11045
+
11046
+ // drawingml/picture-standard-effects.ts
11047
+ var attrs2 = {
11048
+ biLevel: { threshold: "thresh" },
11049
+ alphaRepl: { amount: "a" },
11050
+ alphaBiLevel: { threshold: "thresh" },
11051
+ hsl: { hue: "hue", saturation: "sat", luminance: "lum" },
11052
+ tint: { hue: "hue", amount: "amt" },
11053
+ blur: { radiusEmu: "rad" }
11054
+ };
11055
+ function parseStandardPictureEffect(node2) {
11056
+ const name = node2.localName;
11057
+ if (![
11058
+ "biLevel",
11059
+ "alphaInv",
11060
+ "alphaCeiling",
11061
+ "alphaFloor",
11062
+ "alphaRepl",
11063
+ "alphaBiLevel",
11064
+ "alphaMod",
11065
+ "duotone",
11066
+ "clrRepl",
11067
+ "clrChange",
11068
+ "hsl",
11069
+ "tint",
11070
+ "blur"
11071
+ ].includes(name))
11072
+ return void 0;
11073
+ const values2 = {};
11074
+ for (const [key, attribute2] of Object.entries(attrs2[name] ?? {})) {
11075
+ const raw2 = node2.getAttribute(attribute2);
11076
+ if (raw2 === null) continue;
11077
+ const percent = raw2.endsWith("%");
11078
+ const n = Number(percent ? raw2.slice(0, -1) : raw2) / (key === "hue" ? 6e4 : key === "radiusEmu" ? 1 : percent ? 100 : 1e5);
11079
+ if (!Number.isFinite(n) || key === "hue" && (n < 0 || n >= 360) || key === "threshold" && (n < 0 || n > 1) || key === "radiusEmu" && (!Number.isSafeInteger(n) || n < 0) || ["saturation", "luminance", "amount"].includes(key) && name !== "alphaMod" && (n < (name === "alphaRepl" ? 0 : -1) || n > 1))
11080
+ return void 0;
11081
+ values2[key] = n;
11082
+ }
11083
+ if (["biLevel", "alphaBiLevel"].includes(name) && values2.threshold === void 0)
11084
+ return void 0;
11085
+ if (name === "alphaRepl" && values2.amount === void 0) return void 0;
11086
+ if (name === "alphaMod") {
11087
+ const cont = first(node2, "cont", NS.a);
11088
+ const nested = cont ? elements(cont) : [];
11089
+ if (nested.length !== 1 || nested[0]?.localName !== "alphaModFix") return void 0;
11090
+ const raw2 = nested[0].getAttribute("amt") ?? "100000";
11091
+ const n = Number(raw2.endsWith("%") ? raw2.slice(0, -1) : raw2) / (raw2.endsWith("%") ? 100 : 1e5);
11092
+ if (!Number.isFinite(n) || n < 0) return void 0;
11093
+ values2.amount = n;
11094
+ }
11095
+ let colors = [];
11096
+ if (name === "duotone") {
11097
+ const candidates = elements(node2).filter(
11098
+ (item2) => item2.namespaceURI === NS.a && /Clr$/.test(item2.localName)
11099
+ );
11100
+ colors = candidates.map((item2) => parseDrawingColor(item2)).filter((item2) => Boolean(item2));
11101
+ if (colors.length !== 2) return void 0;
11102
+ }
11103
+ if (name === "clrRepl") {
11104
+ const color = parseDrawingColorIn(node2);
11105
+ if (!color) return void 0;
11106
+ colors = [color];
11107
+ }
11108
+ if (name === "clrChange") {
11109
+ const from = parseDrawingColorIn(first(node2, "clrFrom", NS.a)), to = parseDrawingColorIn(first(node2, "clrTo", NS.a));
11110
+ if (!from || !to) return void 0;
11111
+ colors = [from, to];
11112
+ }
11113
+ if (name === "alphaInv") {
11114
+ const color = parseDrawingColorIn(node2);
11115
+ if (color) colors = [color];
11116
+ }
11117
+ return {
11118
+ kind: "standard",
11119
+ name,
11120
+ ...Object.keys(values2).length ? { values: values2 } : {},
11121
+ ...colors.length ? { colors } : {},
11122
+ ...name === "clrChange" && node2.hasAttribute("useA") ? { useAlpha: !["0", "false"].includes(node2.getAttribute("useA") ?? "") } : {},
11123
+ ...name === "blur" && node2.hasAttribute("grow") ? { grow: !["0", "false"].includes(node2.getAttribute("grow") ?? "") } : {}
11124
+ };
11125
+ }
11126
+ function applyStandardPictureEffect(node2, effect) {
11127
+ const doc = node2.ownerDocument, before = parseStandardPictureEffect(node2);
11128
+ for (const [key, value2] of Object.entries(effect.values ?? {})) {
11129
+ if (!Number.isFinite(value2) || key === "hue" && (value2 < 0 || value2 >= 360) || key === "threshold" && (value2 < 0 || value2 > 1) || key === "radiusEmu" && (!Number.isSafeInteger(value2) || value2 < 0) || key === "amount" && effect.name === "alphaMod" && value2 < 0 || ["saturation", "luminance", "amount"].includes(key) && effect.name !== "alphaMod" && (value2 < (effect.name === "alphaRepl" ? 0 : -1) || value2 > 1))
11130
+ throw new RangeError("Invalid picture effect values");
11131
+ }
11132
+ const count2 = effect.colors?.length ?? 0;
11133
+ if (["duotone", "clrChange"].includes(effect.name) && count2 !== 2 || effect.name === "clrRepl" && count2 !== 1 || effect.name === "alphaInv" && count2 > 1)
11134
+ throw new RangeError("Invalid picture effect colours");
11135
+ for (const [key, attribute2] of Object.entries(attrs2[effect.name] ?? {})) {
11136
+ const value2 = effect.values?.[key];
11137
+ if (value2 === before?.values?.[key]) continue;
11138
+ if (value2 === void 0) node2.removeAttribute(attribute2);
11139
+ else
11140
+ node2.setAttribute(
11141
+ attribute2,
11142
+ String(Math.round(value2 * (key === "hue" ? 6e4 : key === "radiusEmu" ? 1 : 1e5)))
11143
+ );
11144
+ }
11145
+ if (effect.name === "alphaMod" && effect.values?.amount !== before?.values?.amount) {
11146
+ const cont = first(node2, "cont", NS.a) ?? doc.createElementNS(NS.a, "a:cont");
11147
+ const fix = first(cont, "alphaModFix", NS.a) ?? doc.createElementNS(NS.a, "a:alphaModFix");
11148
+ fix.setAttribute("amt", String(Math.round((effect.values?.amount ?? 1) * 1e5)));
11149
+ if (!fix.parentNode) cont.appendChild(fix);
11150
+ if (!cont.parentNode) node2.appendChild(cont);
11151
+ }
11152
+ if (effect.useAlpha !== before?.useAlpha) {
11153
+ if (effect.useAlpha === void 0) node2.removeAttribute("useA");
11154
+ else node2.setAttribute("useA", effect.useAlpha ? "1" : "0");
11155
+ }
11156
+ if (effect.grow !== before?.grow) {
11157
+ if (effect.grow === void 0) node2.removeAttribute("grow");
11158
+ else node2.setAttribute("grow", effect.grow ? "1" : "0");
11159
+ }
11160
+ if (JSON.stringify(effect.colors) !== JSON.stringify(before?.colors)) {
11161
+ if (effect.name === "duotone") {
11162
+ const old = elements(node2).filter(
11163
+ (item2) => item2.namespaceURI === NS.a && /Clr$/.test(item2.localName)
11164
+ );
11165
+ for (let i2 = 0; i2 < (effect.colors?.length ?? 0); i2++) {
11166
+ const holder = doc.createElementNS(NS.a, "a:holder");
11167
+ if (old[i2]) holder.appendChild(doc.importNode(old[i2], true));
11168
+ patchDrawingColorIn(holder, effect.colors[i2]);
11169
+ const next = elements(holder)[0];
11170
+ if (old[i2]) node2.replaceChild(next, old[i2]);
11171
+ else node2.insertBefore(next, first(node2, "extLst", NS.a) ?? null);
11172
+ }
11173
+ } else if (effect.name === "clrChange") {
11174
+ for (const [i2, name] of ["clrFrom", "clrTo"].entries()) {
11175
+ const holder = first(node2, name, NS.a) ?? doc.createElementNS(NS.a, `a:${name}`);
11176
+ if (effect.colors?.[i2]) patchDrawingColorIn(holder, effect.colors[i2]);
11177
+ if (!holder.parentNode) node2.insertBefore(holder, first(node2, "extLst", NS.a) ?? null);
11178
+ }
11179
+ } else if (effect.colors?.[0]) patchDrawingColorIn(node2, effect.colors[0]);
10444
11180
  }
11181
+ if (!parseStandardPictureEffect(node2)) throw new RangeError("Invalid picture effect values");
10445
11182
  }
10446
11183
 
10447
11184
  // drawingml/picture-effects.ts
@@ -10481,14 +11218,19 @@ function readPictureEffect(name, attribute2) {
10481
11218
  function parsePictureEffects(blip) {
10482
11219
  if (!blip) return [];
10483
11220
  return elements(blip).map((node2) => ({
10484
- ...(node2.namespaceURI === NS.a ? readPictureEffect(node2.localName, (name) => node2.getAttribute(name)) : void 0) ?? { kind: "unsupported", name: node2.localName },
11221
+ ...(node2.namespaceURI === NS.a ? readPictureEffect(node2.localName, (name) => node2.getAttribute(name)) ?? parseStandardPictureEffect(node2) ?? parseArtisticPictureExtension(node2) : void 0) ?? { kind: "unsupported", name: node2.localName },
10485
11222
  sourceXml: buildXml(node2)
10486
11223
  }));
10487
11224
  }
10488
11225
  function applyPictureEffects(blip, effects) {
10489
11226
  if (JSON.stringify(parsePictureEffects(blip)) === JSON.stringify(effects)) return;
10490
11227
  const nodes = effects.map((effect) => {
10491
- const name = effect.kind === "grayscale" ? "grayscl" : effect.kind === "luminance" ? "lum" : effect.kind === "unsupported" ? effect.name : effect.kind;
11228
+ const name = effect.kind === "grayscale" ? "grayscl" : effect.kind === "luminance" ? "lum" : effect.kind === "unsupported" ? effect.name : effect.kind === "artistic" ? "extLst" : effect.kind === "standard" ? effect.name : effect.kind;
11229
+ if (effect.kind === "artistic") {
11230
+ const before = effect.sourceXml ? parseArtisticPictureExtension(parseXml(effect.sourceXml).documentElement) : void 0;
11231
+ if (!effect.baked || !before || before.name !== effect.name || before.radius !== effect.radius)
11232
+ throw new Error("Artistic authoring requires a host-generated baked picture cache");
11233
+ }
10492
11234
  const source3 = effect.sourceXml ? parseXml(effect.sourceXml).documentElement : void 0;
10493
11235
  if (effect.kind === "unsupported" && !source3)
10494
11236
  throw new Error("An unsupported picture effect needs source XML");
@@ -10515,12 +11257,157 @@ function applyPictureEffects(blip, effects) {
10515
11257
  if (effect.amount < 0) throw new RangeError("Picture alpha must be nonnegative");
10516
11258
  set("amt", effect.amount);
10517
11259
  }
11260
+ if (effect.kind === "standard") applyStandardPictureEffect(node2, effect);
10518
11261
  return node2;
10519
11262
  });
10520
11263
  for (const node2 of elements(blip)) blip.removeChild(node2);
10521
11264
  for (const node2 of nodes) blip.appendChild(node2);
10522
11265
  }
10523
11266
 
11267
+ // drawingml/picture-layout.ts
11268
+ function parsePictureLayout(fill) {
11269
+ const out = {};
11270
+ const rot = fill.getAttribute("rotWithShape");
11271
+ if (rot !== null) out.rotWithShape = rot !== "0" && rot !== "false";
11272
+ const dpi = Number(fill.getAttribute("dpi"));
11273
+ if (fill.hasAttribute("dpi") && Number.isFinite(dpi) && dpi > 0) out.dpi = dpi;
11274
+ const tile = first(fill, "tile", NS.a);
11275
+ if (tile) {
11276
+ const value2 = {};
11277
+ for (const [key, attr3] of [
11278
+ ["scaleX", "sx"],
11279
+ ["scaleY", "sy"]
11280
+ ]) {
11281
+ const n = picturePercentage(tile.getAttribute(attr3));
11282
+ if (n !== void 0) value2[key] = n;
11283
+ }
11284
+ for (const [key, attr3] of [
11285
+ ["offsetXEmu", "tx"],
11286
+ ["offsetYEmu", "ty"]
11287
+ ]) {
11288
+ const raw2 = tile.getAttribute(attr3);
11289
+ const n = raw2 === null ? NaN : Number(raw2);
11290
+ if (Number.isSafeInteger(n)) value2[key] = n;
11291
+ }
11292
+ const alignment = tile.getAttribute("algn");
11293
+ if (alignment) value2.alignment = alignment;
11294
+ const flip = tile.getAttribute("flip");
11295
+ if (flip && ["none", "x", "y", "xy"].includes(flip))
11296
+ value2.flip = flip;
11297
+ out.tile = value2;
11298
+ }
11299
+ const rect2 = first(first(fill, "stretch", NS.a), "fillRect", NS.a);
11300
+ if (rect2)
11301
+ out.fillRect = {
11302
+ l: picturePercentage(rect2.getAttribute("l")) ?? 0,
11303
+ t: picturePercentage(rect2.getAttribute("t")) ?? 0,
11304
+ r: picturePercentage(rect2.getAttribute("r")) ?? 0,
11305
+ b: picturePercentage(rect2.getAttribute("b")) ?? 0
11306
+ };
11307
+ return out;
11308
+ }
11309
+ function applyPictureLayout(fill, layout3) {
11310
+ const before = parsePictureLayout(fill);
11311
+ const attr3 = (node2, name, value2, old) => {
11312
+ if (value2 === old) return;
11313
+ if (value2 === void 0) node2.removeAttribute(name);
11314
+ else node2.setAttribute(name, String(value2));
11315
+ };
11316
+ if (layout3.rotWithShape !== before.rotWithShape)
11317
+ attr3(
11318
+ fill,
11319
+ "rotWithShape",
11320
+ layout3.rotWithShape === void 0 ? void 0 : layout3.rotWithShape ? "1" : "0",
11321
+ void 0
11322
+ );
11323
+ if (layout3.dpi !== before.dpi) {
11324
+ if (layout3.dpi !== void 0 && (!Number.isSafeInteger(layout3.dpi) || layout3.dpi <= 0))
11325
+ throw new RangeError("Invalid picture DPI");
11326
+ attr3(fill, "dpi", layout3.dpi, void 0);
11327
+ }
11328
+ const make2 = (parent, name) => {
11329
+ const old = first(parent, name, NS.a);
11330
+ if (old) return old;
11331
+ const node2 = fill.ownerDocument.createElementNS(NS.a, `a:${name}`);
11332
+ parent.insertBefore(node2, first(parent, "extLst", NS.a) ?? null);
11333
+ return node2;
11334
+ };
11335
+ if (layout3.tile) {
11336
+ const stretch = first(fill, "stretch", NS.a);
11337
+ if (stretch) fill.removeChild(stretch);
11338
+ const tile = make2(fill, "tile");
11339
+ for (const [key, name] of [
11340
+ ["scaleX", "sx"],
11341
+ ["scaleY", "sy"],
11342
+ ["offsetXEmu", "tx"],
11343
+ ["offsetYEmu", "ty"]
11344
+ ]) {
11345
+ const n = layout3.tile[key];
11346
+ if (n !== void 0 && (!Number.isFinite(n) || (name === "sx" || name === "sy" ? n <= 0 : !Number.isSafeInteger(n))))
11347
+ throw new RangeError("Invalid picture tile");
11348
+ if (n !== before.tile?.[key])
11349
+ attr3(
11350
+ tile,
11351
+ name,
11352
+ n === void 0 ? void 0 : Math.round(n * (name === "sx" || name === "sy" ? 1e5 : 1)),
11353
+ void 0
11354
+ );
11355
+ }
11356
+ if (layout3.tile.alignment !== before.tile?.alignment) {
11357
+ if (layout3.tile.alignment && !["tl", "t", "tr", "l", "ctr", "r", "bl", "b", "br"].includes(layout3.tile.alignment))
11358
+ throw new RangeError("Invalid picture tile alignment");
11359
+ attr3(tile, "algn", layout3.tile.alignment, void 0);
11360
+ }
11361
+ if (layout3.tile.flip !== void 0 && !["none", "x", "y", "xy"].includes(layout3.tile.flip))
11362
+ throw new RangeError("Invalid picture tile flip");
11363
+ if (layout3.tile.flip !== before.tile?.flip) attr3(tile, "flip", layout3.tile.flip, void 0);
11364
+ } else if (before.tile || layout3.fillRect) {
11365
+ const tile = first(fill, "tile", NS.a);
11366
+ if (tile) fill.removeChild(tile);
11367
+ const rect2 = make2(make2(fill, "stretch"), "fillRect");
11368
+ for (const key of ["l", "t", "r", "b"]) {
11369
+ const n = layout3.fillRect?.[key];
11370
+ if (n !== void 0 && !Number.isFinite(n))
11371
+ throw new RangeError("Invalid picture fill rectangle");
11372
+ if (n !== before.fillRect?.[key])
11373
+ attr3(rect2, key, n === void 0 ? void 0 : Math.round(n * 1e5), void 0);
11374
+ }
11375
+ }
11376
+ }
11377
+
11378
+ // drawingml/picture-crop.ts
11379
+ var SIDES = { l: "cropLeft", t: "cropTop", r: "cropRight", b: "cropBottom" };
11380
+ function parsePictureCrop(blipFill) {
11381
+ const rect2 = first(blipFill, "srcRect", NS.a);
11382
+ if (!rect2) return void 0;
11383
+ const result2 = {};
11384
+ for (const [attr3, key] of Object.entries(SIDES)) {
11385
+ const raw2 = rect2.getAttribute(attr3);
11386
+ if (raw2 === null || !raw2.trim()) continue;
11387
+ const percent = raw2.endsWith("%");
11388
+ const value2 = Number(percent ? raw2.slice(0, -1) : raw2) / (percent ? 100 : 1e5);
11389
+ if (Number.isFinite(value2)) result2[key] = value2;
11390
+ }
11391
+ return result2;
11392
+ }
11393
+ function applyPictureCrop(blipFill, crop) {
11394
+ let rect2 = first(blipFill, "srcRect", NS.a);
11395
+ if (!rect2 && crop && Object.values(crop).some((value2) => value2 !== void 0)) {
11396
+ rect2 = blipFill.ownerDocument.createElementNS(NS.a, "a:srcRect");
11397
+ const blip = first(blipFill, "blip", NS.a);
11398
+ blipFill.insertBefore(rect2, blip?.nextSibling ?? blipFill.firstChild);
11399
+ }
11400
+ if (!rect2) return;
11401
+ for (const [attr3, key] of Object.entries(SIDES)) {
11402
+ const value2 = crop?.[key];
11403
+ if (value2 === void 0) rect2.removeAttribute(attr3);
11404
+ else {
11405
+ if (!Number.isFinite(value2)) throw new RangeError("Picture crop must be finite");
11406
+ rect2.setAttribute(attr3, String(Math.round(value2 * 1e5)));
11407
+ }
11408
+ }
11409
+ }
11410
+
10524
11411
  // drawingml/picture-fill.ts
10525
11412
  function parseDrawingPictureFill(fill) {
10526
11413
  const blip = first(fill, "blip", NS.a);
@@ -10528,13 +11415,32 @@ function parseDrawingPictureFill(fill) {
10528
11415
  const linkRelId = blip?.getAttributeNS(NS.r, "link") || void 0;
10529
11416
  const crop = parsePictureCrop(fill);
10530
11417
  const effects = parsePictureEffects(blip);
10531
- const tile = first(fill, "tile", NS.a);
10532
- const rect2 = first(first(fill, "stretch", NS.a), "fillRect", NS.a);
10533
- const unsupported2 = [
10534
- ...tile ? ["tile"] : [],
10535
- ...rect2 && ["l", "t", "r", "b"].some((key) => Number(rect2.getAttribute(key) ?? 0) !== 0) ? ["fillRect"] : [],
10536
- ...fill.getAttribute("rotWithShape") === "0" || fill.getAttribute("rotWithShape") === "false" ? ["rotWithShape"] : []
10537
- ];
11418
+ const layout3 = parsePictureLayout(fill);
11419
+ const unsupported2 = [];
11420
+ const tile = first(fill, "tile", NS.a), stretch = first(fill, "stretch", NS.a);
11421
+ if (tile && stretch) unsupported2.push("tile/stretch-choice");
11422
+ if (tile) {
11423
+ for (const [attr3, key] of [
11424
+ ["sx", "scaleX"],
11425
+ ["sy", "scaleY"],
11426
+ ["tx", "offsetXEmu"],
11427
+ ["ty", "offsetYEmu"]
11428
+ ])
11429
+ if (tile.hasAttribute(attr3) && (layout3.tile?.[key] === void 0 || (attr3 === "sx" || attr3 === "sy") && layout3.tile[key] <= 0))
11430
+ unsupported2.push(`tile:${attr3}`);
11431
+ if (tile.hasAttribute("algn") && !["tl", "t", "tr", "l", "ctr", "r", "bl", "b", "br"].includes(tile.getAttribute("algn") ?? ""))
11432
+ unsupported2.push("tile:algn");
11433
+ if (tile.hasAttribute("flip") && !layout3.tile?.flip) unsupported2.push("tile:flip");
11434
+ }
11435
+ const rect2 = first(stretch, "fillRect", NS.a);
11436
+ if (rect2)
11437
+ for (const key of ["l", "t", "r", "b"]) {
11438
+ const raw2 = rect2.getAttribute(key);
11439
+ if (raw2 !== null && !/^[-+]?(?:\d+\.?\d*|\.\d+)%?$/.test(raw2))
11440
+ unsupported2.push(`fillRect:${key}`);
11441
+ }
11442
+ if (fill.hasAttribute("rotWithShape") && !["0", "1", "true", "false"].includes(fill.getAttribute("rotWithShape") ?? ""))
11443
+ unsupported2.push("rotWithShape");
10538
11444
  return {
10539
11445
  kind: "picture",
10540
11446
  sourceXml: buildXml(fill),
@@ -10542,6 +11448,7 @@ function parseDrawingPictureFill(fill) {
10542
11448
  ...linkRelId ? { linkRelId } : {},
10543
11449
  ...crop ? { crop } : {},
10544
11450
  ...effects.length ? { effects } : {},
11451
+ ...Object.keys(layout3).length ? { layout: layout3 } : {},
10545
11452
  ...unsupported2.length ? { unsupportedPicture: unsupported2 } : {}
10546
11453
  };
10547
11454
  }
@@ -10673,80 +11580,6 @@ function drawingDashLength(value2) {
10673
11580
  return Number.isSafeInteger(number2) && number2 <= 2147483647 ? number2 : void 0;
10674
11581
  }
10675
11582
 
10676
- // drawingml/write-color.ts
10677
- var ELEMENTS = {
10678
- srgb: "srgbClr",
10679
- scheme: "schemeClr",
10680
- system: "sysClr",
10681
- preset: "prstClr",
10682
- scrgb: "scrgbClr",
10683
- hsl: "hslClr"
10684
- };
10685
- function drawingColorXml(color) {
10686
- const local = ELEMENTS[color.kind];
10687
- const doc = parseXml(`<a:${local} xmlns:a="${NS.a}"/>`);
10688
- const root = doc.documentElement;
10689
- if (color.kind === "scrgb" || color.kind === "hsl") {
10690
- const keys = color.kind === "scrgb" ? ["r", "g", "b"] : ["hue", "sat", "lum"];
10691
- const values2 = color.value.split(",");
10692
- keys.forEach((key, i2) => root.setAttribute(key, values2[i2] ?? "0"));
10693
- } else root.setAttribute("val", color.value);
10694
- if (color.fallback !== void 0 && color.kind === "system")
10695
- root.setAttribute("lastClr", color.fallback);
10696
- for (const transform6 of color.transforms) {
10697
- if (!/^[A-Za-z_][\w.-]*$/.test(transform6.name))
10698
- throw new Error(`Invalid DrawingML transform ${transform6.name}`);
10699
- const node2 = doc.createElementNS(NS.a, `a:${transform6.name}`);
10700
- if (transform6.value !== "") node2.setAttribute("val", transform6.value);
10701
- root.appendChild(node2);
10702
- }
10703
- return buildXml(doc);
10704
- }
10705
-
10706
- // drawingml/patch-color.ts
10707
- function patchDrawingColorIn(container2, color) {
10708
- const old = elements(container2).find((node2) => parseDrawingColor(node2));
10709
- const before = parseDrawingColorIn(container2);
10710
- if (!old || !before || before.kind !== color.kind) {
10711
- const next = container2.ownerDocument.importNode(
10712
- parseXml(drawingColorXml(color)).documentElement,
10713
- true
10714
- );
10715
- if (old) container2.replaceChild(next, old);
10716
- else container2.insertBefore(next, container2.firstChild);
10717
- return;
10718
- }
10719
- if (before.value !== color.value) {
10720
- if (color.kind === "scrgb" || color.kind === "hsl") {
10721
- const keys = color.kind === "scrgb" ? ["r", "g", "b"] : ["hue", "sat", "lum"];
10722
- const values2 = color.value.split(",");
10723
- keys.forEach((key, index3) => old.setAttribute(key, values2[index3] ?? "0"));
10724
- } else old.setAttribute("val", color.value);
10725
- }
10726
- if (before.fallback !== color.fallback && color.kind === "system") {
10727
- if (color.fallback === void 0) old.removeAttribute("lastClr");
10728
- else old.setAttribute("lastClr", color.fallback);
10729
- }
10730
- const originals = elements(old);
10731
- color.transforms.forEach((transform6, index3) => {
10732
- const source3 = originals[index3];
10733
- if (source3?.localName === transform6.name) {
10734
- if (before.transforms[index3]?.value !== transform6.value) {
10735
- if (transform6.value === "") source3.removeAttribute("val");
10736
- else source3.setAttribute("val", transform6.value);
10737
- }
10738
- return;
10739
- }
10740
- if (!/^[A-Za-z_][\w.-]*$/u.test(transform6.name))
10741
- throw new Error("Invalid DrawingML colour transform");
10742
- const next = old.ownerDocument.createElementNS(NS.a, `a:${transform6.name}`);
10743
- if (transform6.value !== "") next.setAttribute("val", transform6.value);
10744
- if (source3) old.replaceChild(next, source3);
10745
- else old.appendChild(next);
10746
- });
10747
- for (const extra of originals.slice(color.transforms.length)) old.removeChild(extra);
10748
- }
10749
-
10750
11583
  // drawingml/write-pattern-picture.ts
10751
11584
  function drawingPatternPictureXml(fill) {
10752
11585
  const name = fill.kind === "pattern" ? "pattFill" : "blipFill";
@@ -10808,7 +11641,8 @@ function drawingPatternPictureXml(fill) {
10808
11641
  applyPictureCrop(root, fill.crop);
10809
11642
  if (fill.effects !== void 0 && JSON.stringify(before?.kind === "picture" ? before.effects ?? [] : []) !== JSON.stringify(fill.effects ?? []))
10810
11643
  applyPictureEffects(blip, fill.effects ?? []);
10811
- if (!fill.sourceXml) {
11644
+ if (fill.layout !== void 0) applyPictureLayout(root, fill.layout);
11645
+ if (!fill.sourceXml && !fill.layout?.tile && !first(root, "stretch", NS.a)) {
10812
11646
  const stretch = doc.createElementNS(NS.a, "a:stretch");
10813
11647
  stretch.appendChild(doc.createElementNS(NS.a, "a:fillRect"));
10814
11648
  root.appendChild(stretch);
@@ -10936,11 +11770,11 @@ function dropDrawingDeclarations(node2) {
10936
11770
  for (const child6 of elements(node2)) dropDrawingDeclarations(child6);
10937
11771
  }
10938
11772
  function insert(host, child6) {
10939
- const rank3 = ORDER.indexOf(child6.localName);
11773
+ const rank4 = ORDER.indexOf(child6.localName);
10940
11774
  host.insertBefore(
10941
11775
  child6,
10942
11776
  elements(host).find(
10943
- (node2) => node2.namespaceURI === NS.a && ORDER.indexOf(node2.localName) > rank3
11777
+ (node2) => node2.namespaceURI === NS.a && ORDER.indexOf(node2.localName) > rank4
10944
11778
  ) ?? null
10945
11779
  );
10946
11780
  }
@@ -11402,8 +12236,8 @@ function readPrintOptions(node2) {
11402
12236
  }
11403
12237
  function printOptionsXml(options) {
11404
12238
  if (!options) return "";
11405
- const attrs2 = KEYS.filter((key) => options[key]).map((key) => ` ${key}="1"`);
11406
- return attrs2.length ? `<printOptions${attrs2.join("")}/>` : "";
12239
+ const attrs3 = KEYS.filter((key) => options[key]).map((key) => ` ${key}="1"`);
12240
+ return attrs3.length ? `<printOptions${attrs3.join("")}/>` : "";
11407
12241
  }
11408
12242
 
11409
12243
  // xlsx/read/password-hash.ts
@@ -11429,6 +12263,89 @@ function readModernHash(node2, prefix = "") {
11429
12263
  return hash2;
11430
12264
  }
11431
12265
 
12266
+ // xlsx/read/filter-columns.ts
12267
+ var MAIN_NS_DECL = /(?<=^<[^>]*) xmlns="http:\/\/schemas\.openxmlformats\.org\/spreadsheetml\/2006\/main"/;
12268
+ var OPERATORS2 = /* @__PURE__ */ new Set([
12269
+ "equal",
12270
+ "lessThan",
12271
+ "lessThanOrEqual",
12272
+ "notEqual",
12273
+ "greaterThanOrEqual",
12274
+ "greaterThan"
12275
+ ]);
12276
+ var LEVELS = /* @__PURE__ */ new Set(["year", "month", "day", "hour", "minute", "second"]);
12277
+ function readDateGroup(node2) {
12278
+ const grouping = att(node2, "dateTimeGrouping");
12279
+ const year = numAttr(node2, "year");
12280
+ if (year === void 0 || !grouping || !LEVELS.has(grouping)) return void 0;
12281
+ const item2 = { year, grouping };
12282
+ for (const key of ["month", "day", "hour", "minute", "second"]) {
12283
+ const value2 = numAttr(node2, key);
12284
+ if (value2 !== void 0) item2[key] = value2;
12285
+ }
12286
+ return item2;
12287
+ }
12288
+ function readFilterColumn(column2, dxfs) {
12289
+ const entry3 = { offset: numAttr(column2, "colId") ?? 0 };
12290
+ const filters = xFirst(column2, "filters");
12291
+ if (filters) {
12292
+ entry3.values = xChildren(filters, "filter").map((f6) => att(f6, "val") ?? "");
12293
+ if (boolAttr(filters, "blank")) entry3.blank = true;
12294
+ const groups = xChildren(filters, "dateGroupItem").map(readDateGroup).filter((g2) => g2 !== void 0);
12295
+ if (groups.length) entry3.dateGroups = groups;
12296
+ }
12297
+ const custom = xFirst(column2, "customFilters");
12298
+ if (custom) {
12299
+ const conditions = xChildren(custom, "customFilter").map((c2) => {
12300
+ const op2 = att(c2, "operator") ?? "equal";
12301
+ return {
12302
+ operator: OPERATORS2.has(op2) ? op2 : "equal",
12303
+ value: att(c2, "val") ?? ""
12304
+ };
12305
+ });
12306
+ entry3.custom = { ...boolAttr(custom, "and") ? { and: true } : {}, conditions };
12307
+ }
12308
+ const top = xFirst(column2, "top10");
12309
+ if (top) {
12310
+ const filterValue = numAttr(top, "filterVal");
12311
+ entry3.top10 = {
12312
+ top: boolAttr(top, "top", true),
12313
+ percent: boolAttr(top, "percent", false),
12314
+ value: numAttr(top, "val") ?? 10,
12315
+ ...filterValue !== void 0 ? { filterValue } : {}
12316
+ };
12317
+ }
12318
+ const dynamic = xFirst(column2, "dynamicFilter");
12319
+ if (dynamic) {
12320
+ const value2 = numAttr(dynamic, "val");
12321
+ const maxValue = numAttr(dynamic, "maxVal");
12322
+ entry3.dynamic = {
12323
+ type: att(dynamic, "type") ?? "null",
12324
+ ...value2 !== void 0 ? { value: value2 } : {},
12325
+ ...maxValue !== void 0 ? { maxValue } : {}
12326
+ };
12327
+ }
12328
+ const color = xFirst(column2, "colorFilter");
12329
+ if (color) {
12330
+ const dxfId = numAttr(color, "dxfId");
12331
+ const style2 = dxfId === void 0 ? void 0 : dxfs?.[dxfId];
12332
+ entry3.color = {
12333
+ cellColor: boolAttr(color, "cellColor", true),
12334
+ ...dxfId !== void 0 ? { dxfId } : {},
12335
+ ...style2 ? { style: structuredClone(style2) } : {}
12336
+ };
12337
+ }
12338
+ const icon = xFirst(column2, "iconFilter");
12339
+ const iconSet = att(icon, "iconSet");
12340
+ if (iconSet) {
12341
+ const iconId = numAttr(icon, "iconId");
12342
+ entry3.icon = { iconSet, ...iconId !== void 0 ? { iconId } : {} };
12343
+ }
12344
+ if (boolAttr(column2, "hiddenButton")) entry3.hiddenButton = true;
12345
+ entry3.sourceXml = outerXml(column2).replace(MAIN_NS_DECL, "");
12346
+ return entry3;
12347
+ }
12348
+
11432
12349
  // xlsx/read/sheet-props.ts
11433
12350
  var defaultSheetView = () => ({
11434
12351
  showGridLines: true,
@@ -11518,24 +12435,11 @@ function readColumns(cols, xfMap) {
11518
12435
  }
11519
12436
  return out;
11520
12437
  }
11521
- var MAIN_NS_DECL = /(?<=^<[^>]*) xmlns="http:\/\/schemas\.openxmlformats\.org\/spreadsheetml\/2006\/main"/;
11522
- function readAutoFilter(node2) {
12438
+ function readAutoFilter(node2, dxfs) {
11523
12439
  const range = parseRange(att(node2, "ref") ?? "");
11524
12440
  if (!node2 || !range) return void 0;
11525
12441
  const filter2 = { range };
11526
- const columns = [];
11527
- for (const column2 of xChildren(node2, "filterColumn")) {
11528
- const entry3 = {
11529
- offset: numAttr(column2, "colId") ?? 0
11530
- };
11531
- const filters = xFirst(column2, "filters");
11532
- if (filters) {
11533
- entry3.values = xChildren(filters, "filter").map((f6) => att(f6, "val") ?? "");
11534
- if (boolAttr(filters, "blank")) entry3.blank = true;
11535
- }
11536
- entry3.sourceXml = outerXml(column2).replace(MAIN_NS_DECL, "");
11537
- columns.push(entry3);
11538
- }
12442
+ const columns = xChildren(node2, "filterColumn").map((column2) => readFilterColumn(column2, dxfs));
11539
12443
  if (columns.length) filter2.columns = columns;
11540
12444
  return filter2;
11541
12445
  }
@@ -11645,17 +12549,17 @@ function readCustomWorkbookViews(node2) {
11645
12549
  return xChildren(node2, "customWorkbookView").flatMap((view) => {
11646
12550
  const guid2 = att(view, "guid");
11647
12551
  if (!guid2) return [];
11648
- const attrs2 = {};
12552
+ const attrs3 = {};
11649
12553
  for (const attribute2 of Array.from(view.attributes))
11650
12554
  if (!WORKBOOK_VIEW_KNOWN.includes(attribute2.name) && !attribute2.name.startsWith("xmlns"))
11651
- attrs2[attribute2.name] = attribute2.value;
12555
+ attrs3[attribute2.name] = attribute2.value;
11652
12556
  return [
11653
12557
  {
11654
12558
  guid: guid2,
11655
12559
  name: att(view, "name") ?? "",
11656
12560
  includePrintSettings: boolAttr(view, "includePrintSettings", true),
11657
12561
  includeHiddenRowCol: boolAttr(view, "includeHiddenRowCol", true),
11658
- attrs: attrs2
12562
+ attrs: attrs3
11659
12563
  }
11660
12564
  ];
11661
12565
  });
@@ -11693,10 +12597,10 @@ function readCustomSheetViews(node2) {
11693
12597
  );
11694
12598
  const printOptions = readPrintOptions(child6("printOptions"));
11695
12599
  const filter2 = readAutoFilter(child6("autoFilter"));
11696
- const attrs2 = {};
12600
+ const attrs3 = {};
11697
12601
  for (const attribute2 of Array.from(view.attributes))
11698
12602
  if (!SHEET_VIEW_ATTRS.includes(attribute2.name) && !attribute2.name.startsWith("xmlns"))
11699
- attrs2[attribute2.name] = attribute2.value;
12603
+ attrs3[attribute2.name] = attribute2.value;
11700
12604
  const modelled = [
11701
12605
  "pane",
11702
12606
  "selection",
@@ -11716,7 +12620,7 @@ function readCustomSheetViews(node2) {
11716
12620
  ...boolAttr(view, "showAutoFilter", false) ? { showAutoFilter: true } : {},
11717
12621
  ...pageSetup ? { pageSetup } : {},
11718
12622
  ...printOptions ? { printOptions } : {},
11719
- attrs: attrs2,
12623
+ attrs: attrs3,
11720
12624
  extra: elements(view).filter((c2) => !modelled.includes(c2.localName ?? "")).map((c2) => outerXml(c2))
11721
12625
  }
11722
12626
  ];
@@ -12298,7 +13202,7 @@ function isSpace3(ch) {
12298
13202
  return ch === " " || ch === " " || ch === "\n" || ch === "\r";
12299
13203
  }
12300
13204
  function parseAttributes(source3) {
12301
- const attrs2 = {};
13205
+ const attrs3 = {};
12302
13206
  let i2 = 0;
12303
13207
  const n = source3.length;
12304
13208
  while (i2 < n) {
@@ -12333,9 +13237,9 @@ function parseAttributes(source3) {
12333
13237
  if (name === "xmlns" || name.startsWith("xmlns:")) {
12334
13238
  continue;
12335
13239
  }
12336
- attrs2[localName(name)] = decodeEntities(value2);
13240
+ attrs3[localName(name)] = decodeEntities(value2);
12337
13241
  }
12338
- return attrs2;
13242
+ return attrs3;
12339
13243
  }
12340
13244
  function tagEnd2(xml, from) {
12341
13245
  let quote2 = "";
@@ -12461,14 +13365,14 @@ function numOrNaN(value2) {
12461
13365
  function relation(value2) {
12462
13366
  return value2 === "ch" || value2 === "des" ? value2 : "self";
12463
13367
  }
12464
- function parseIterator(attrs2) {
13368
+ function parseIterator(attrs3) {
12465
13369
  return {
12466
- axis: list(attrs2.axis),
12467
- ptType: list(attrs2.ptType),
12468
- hideLastTrans: list(attrs2.hideLastTrans).map((v) => v === "1" || v === "true"),
12469
- st: numberList(attrs2.st),
12470
- cnt: numberList(attrs2.cnt),
12471
- step: numberList(attrs2.step)
13370
+ axis: list(attrs3.axis),
13371
+ ptType: list(attrs3.ptType),
13372
+ hideLastTrans: list(attrs3.hideLastTrans).map((v) => v === "1" || v === "true"),
13373
+ st: numberList(attrs3.st),
13374
+ cnt: numberList(attrs3.cnt),
13375
+ step: numberList(attrs3.step)
12472
13376
  };
12473
13377
  }
12474
13378
  function parseAlgorithm(element3) {
@@ -12499,41 +13403,41 @@ function parseShape(element3) {
12499
13403
  adj
12500
13404
  };
12501
13405
  }
12502
- function parseConstraint(attrs2) {
12503
- const op2 = attrs2.op;
13406
+ function parseConstraint(attrs3) {
13407
+ const op2 = attrs3.op;
12504
13408
  return {
12505
- type: attrs2.type ?? "none",
12506
- for: relation(attrs2.for),
12507
- forName: attrs2.forName || void 0,
12508
- ptType: attrs2.ptType ?? "all",
12509
- refType: attrs2.refType ?? "none",
12510
- refFor: relation(attrs2.refFor),
12511
- refForName: attrs2.refForName || void 0,
12512
- refPtType: attrs2.refPtType ?? "all",
13409
+ type: attrs3.type ?? "none",
13410
+ for: relation(attrs3.for),
13411
+ forName: attrs3.forName || void 0,
13412
+ ptType: attrs3.ptType ?? "all",
13413
+ refType: attrs3.refType ?? "none",
13414
+ refFor: relation(attrs3.refFor),
13415
+ refForName: attrs3.refForName || void 0,
13416
+ refPtType: attrs3.refPtType ?? "all",
12513
13417
  op: op2 === "equ" || op2 === "gte" || op2 === "lte" ? op2 : "none",
12514
- val: num2(attrs2.val, 0),
12515
- hasVal: attrs2.val !== void 0,
12516
- fact: num2(attrs2.fact, 1)
13418
+ val: num2(attrs3.val, 0),
13419
+ hasVal: attrs3.val !== void 0,
13420
+ fact: num2(attrs3.fact, 1)
12517
13421
  };
12518
13422
  }
12519
- function parseRule(attrs2) {
13423
+ function parseRule(attrs3) {
12520
13424
  return {
12521
- type: attrs2.type ?? "none",
12522
- for: relation(attrs2.for),
12523
- forName: attrs2.forName || void 0,
12524
- ptType: attrs2.ptType ?? "all",
12525
- val: numOrNaN(attrs2.val),
12526
- fact: numOrNaN(attrs2.fact),
12527
- max: numOrNaN(attrs2.max)
13425
+ type: attrs3.type ?? "none",
13426
+ for: relation(attrs3.for),
13427
+ forName: attrs3.forName || void 0,
13428
+ ptType: attrs3.ptType ?? "all",
13429
+ val: numOrNaN(attrs3.val),
13430
+ fact: numOrNaN(attrs3.fact),
13431
+ max: numOrNaN(attrs3.max)
12528
13432
  };
12529
13433
  }
12530
- function parseCondition(attrs2) {
13434
+ function parseCondition(attrs3) {
12531
13435
  return {
12532
- ...parseIterator(attrs2),
12533
- func: attrs2.func ?? "cnt",
12534
- arg: attrs2.arg,
12535
- op: attrs2.op ?? "equ",
12536
- val: attrs2.val ?? ""
13436
+ ...parseIterator(attrs3),
13437
+ func: attrs3.func ?? "cnt",
13438
+ arg: attrs3.arg,
13439
+ op: attrs3.op ?? "equ",
13440
+ val: attrs3.val ?? ""
12537
13441
  };
12538
13442
  }
12539
13443
  function parseBody(element3, state) {
@@ -24052,12 +24956,12 @@ function functionValue(condition, point, lookup2) {
24052
24956
  return void 0;
24053
24957
  }
24054
24958
  }
24055
- function compare(left2, op2, rightRaw) {
24959
+ function compare2(left2, op2, rightRaw) {
24056
24960
  const leftNumber = typeof left2 === "number" ? left2 : Number(left2);
24057
24961
  const rightNumber = Number(rightRaw);
24058
- const numeric2 = !Number.isNaN(leftNumber) && !Number.isNaN(rightNumber) && rightRaw !== "";
24059
- const a2 = numeric2 ? leftNumber : String(left2);
24060
- const b = numeric2 ? rightNumber : rightRaw;
24962
+ const numeric3 = !Number.isNaN(leftNumber) && !Number.isNaN(rightNumber) && rightRaw !== "";
24963
+ const a2 = numeric3 ? leftNumber : String(left2);
24964
+ const b = numeric3 ? rightNumber : rightRaw;
24061
24965
  switch (op2) {
24062
24966
  case "equ":
24063
24967
  return a2 === b;
@@ -24090,7 +24994,7 @@ function evaluateCondition(condition, point, lookup2) {
24090
24994
  return false;
24091
24995
  }
24092
24996
  const expected = condition.func === "var" ? String(normaliseVariable(condition.val)) : condition.val;
24093
- return compare(normaliseVariable(value2), condition.op, expected);
24997
+ return compare2(normaliseVariable(value2), condition.op, expected);
24094
24998
  }
24095
24999
 
24096
25000
  // diagram/engine/pres-tree.ts
@@ -26049,7 +26953,13 @@ function buildRenderedNode(node2, index3, nodeById, palette, style2, mergedSourc
26049
26953
  fontSize: 0,
26050
26954
  textX: x + width / 2,
26051
26955
  textY: y + height / 2,
26052
- nodeId: primary?.id,
26956
+ // Picture roles often omit presOf: they present the current point's image, not its text.
26957
+ nodeId: primary?.id ?? (node2.shape?.blipPhldr ? node2.point.source?.id : void 0),
26958
+ picturePlaceholder: node2.shape?.blipPhldr,
26959
+ layoutRole: node2.name,
26960
+ contextNodeId: node2.point.source?.id,
26961
+ textAlign: ["l", "ctr", "r"].includes(node2.alg.params.parTxLTRAlign ?? "") ? node2.alg.params.parTxLTRAlign : void 0,
26962
+ textVerticalAnchor: ["t", "ctr", "b"].includes(node2.alg.params.txAnchorVert ?? "") ? node2.alg.params.txAnchorVert : void 0,
26053
26963
  rotation: transform6.rotation === 0 ? void 0 : transform6.rotation,
26054
26964
  presetOverride: node2.shape?.type ?? "roundRect",
26055
26965
  foldedNodeIds: foldedNodeIds.length > 0 ? foldedNodeIds : void 0,
@@ -27238,11 +28148,11 @@ function keptChildren(doc, xml) {
27238
28148
  }));
27239
28149
  }
27240
28150
  function appendInSchemaOrder(parent, order, entries) {
27241
- const rank3 = (name) => {
28151
+ const rank4 = (name) => {
27242
28152
  const index3 = order.indexOf(name);
27243
28153
  return index3 < 0 ? order.length : index3;
27244
28154
  };
27245
- entries.map((entry3, index3) => ({ entry: entry3, index: index3 })).sort((a2, b) => rank3(a2.entry.name) - rank3(b.entry.name) || a2.index - b.index).forEach(({ entry: entry3 }) => parent.appendChild(entry3.node));
28155
+ entries.map((entry3, index3) => ({ entry: entry3, index: index3 })).sort((a2, b) => rank4(a2.entry.name) - rank4(b.entry.name) || a2.index - b.index).forEach(({ entry: entry3 }) => parent.appendChild(entry3.node));
27246
28156
  }
27247
28157
  function setBoolean(element3, name, value2) {
27248
28158
  if (value2 !== void 0) element3.setAttribute(name, value2 ? "1" : "0");
@@ -28336,11 +29246,11 @@ function child3(node2, name) {
28336
29246
  if (existing) return existing;
28337
29247
  const result2 = node2.ownerDocument.createElementNS(NS.a, `a:${name}`);
28338
29248
  const order = node2.localName === "scene3d" ? ["camera", "lightRig", "backdrop", "extLst"] : node2.localName === "sp3d" ? ["bevelT", "bevelB", "extrusionClr", "contourClr", "extLst"] : node2.localName === "backdrop" ? ["anchor", "norm", "up", "extLst"] : ["rot", "extLst"];
28339
- const rank3 = order.indexOf(name);
29249
+ const rank4 = order.indexOf(name);
28340
29250
  node2.insertBefore(
28341
29251
  result2,
28342
29252
  elements(node2).find(
28343
- (item2) => item2.namespaceURI === NS.a && order.indexOf(item2.localName) > rank3
29253
+ (item2) => item2.namespaceURI === NS.a && order.indexOf(item2.localName) > rank4
28344
29254
  ) ?? null
28345
29255
  );
28346
29256
  return result2;
@@ -29434,6 +30344,203 @@ function approximateDiagramDrawingFromNodes(input) {
29434
30344
  });
29435
30345
  }
29436
30346
 
30347
+ // diagram/picture-layout.ts
30348
+ var DIAGRAM_PICTURE_SOURCE_NS = "urn:ooxml-core:diagram-picture-sources:1";
30349
+ function remapFill(fill, id) {
30350
+ if (!fill.sourceXml) return { ...fill, relId: id };
30351
+ const node2 = parseXml(fill.sourceXml).documentElement;
30352
+ const blip = first(node2, "blip", NS.a);
30353
+ if (blip) {
30354
+ blip.setAttributeNS(NS.r, "r:embed", id);
30355
+ blip.removeAttributeNS(NS.r, "link");
30356
+ }
30357
+ return { ...fill, relId: id, sourceXml: buildXml(node2) };
30358
+ }
30359
+ function captureDiagramPictures(model2, dataXml2, dataParts, drawing) {
30360
+ const pictures = [];
30361
+ const parts = { ...dataParts };
30362
+ const add3 = (source3, owner) => {
30363
+ const part = source3.fill.relId ? owner[source3.fill.relId] : void 0;
30364
+ if (!part) return;
30365
+ let id = Object.keys(parts).find((key) => parts[key] === part);
30366
+ if (!id) {
30367
+ let index3 = 1;
30368
+ while (Object.hasOwn(parts, `ooxmlDiagramPicture${index3}`)) index3++;
30369
+ id = `ooxmlDiagramPicture${index3}`;
30370
+ parts[id] = part;
30371
+ }
30372
+ const entry3 = { ...source3, fill: remapFill(source3.fill, id) };
30373
+ const existing = pictures.findIndex(
30374
+ (item2) => item2.nodeId === entry3.nodeId && (item2.role === entry3.role && item2.styleLabel === entry3.styleLabel || !item2.role && !item2.styleLabel && item2.fill.relId === entry3.fill.relId)
30375
+ );
30376
+ if (existing < 0) pictures.push(entry3);
30377
+ else pictures[existing] = entry3;
30378
+ };
30379
+ const root = parseXml(dataXml2).documentElement;
30380
+ const saved = root.getElementsByTagNameNS(DIAGRAM_PICTURE_SOURCE_NS, "picture");
30381
+ for (const element3 of saved) {
30382
+ const nodeId = element3.getAttribute("nodeId");
30383
+ const fill = first(element3, "blipFill", NS.a);
30384
+ if (nodeId && fill && model2.nodes.some((node2) => node2.modelId === nodeId))
30385
+ add3(
30386
+ {
30387
+ nodeId,
30388
+ fill: parseDrawingPictureFill(fill),
30389
+ ...element3.getAttribute("role") ? { role: element3.getAttribute("role") } : {},
30390
+ ...element3.getAttribute("styleLabel") ? { styleLabel: element3.getAttribute("styleLabel") } : {}
30391
+ },
30392
+ dataParts
30393
+ );
30394
+ }
30395
+ for (const point of model2.points) {
30396
+ if (point.fill?.kind !== "picture") continue;
30397
+ const nodeId = point.type === "pres" ? point.presAssocId : point.modelId;
30398
+ if (nodeId && model2.nodes.some((node2) => node2.modelId === nodeId) && !pictures.some((item2) => item2.nodeId === nodeId))
30399
+ add3(
30400
+ {
30401
+ nodeId,
30402
+ fill: point.fill,
30403
+ ...point.presName ? { role: point.presName } : {},
30404
+ ...point.presStyleLabel ? { styleLabel: point.presStyleLabel } : {}
30405
+ },
30406
+ dataParts
30407
+ );
30408
+ }
30409
+ for (const shape2 of drawing?.shapes ?? []) {
30410
+ if (shape2.fill?.kind !== "picture") continue;
30411
+ const point = model2.points.find((point2) => point2.modelId === shape2.modelId);
30412
+ const nodeId = shape2.sourceNodeId ?? (point?.type === "pres" ? point.presAssocId : point?.modelId);
30413
+ const part = shape2.fill.relId ? drawing?.pictureParts?.[shape2.fill.relId] : void 0;
30414
+ if (saved.length && pictures.some(
30415
+ (item2) => item2.nodeId === nodeId && item2.fill.relId && parts[item2.fill.relId] === part && item2.role !== point?.presName && item2.styleLabel !== point?.presStyleLabel
30416
+ ))
30417
+ continue;
30418
+ if (nodeId && model2.nodes.some((node2) => node2.modelId === nodeId))
30419
+ add3(
30420
+ {
30421
+ nodeId,
30422
+ fill: shape2.fill,
30423
+ ...point?.presName ? { role: point.presName } : {},
30424
+ ...point?.presStyleLabel ? { styleLabel: point.presStyleLabel } : {}
30425
+ },
30426
+ drawing?.pictureParts ?? {}
30427
+ );
30428
+ }
30429
+ return pictures.length ? { pictures, pictureParts: parts } : {};
30430
+ }
30431
+ function applyDiagramPictureSources(drawing, nodes, source3, issues, liveNodeIds) {
30432
+ if (!source3?.pictures?.length) return;
30433
+ if (source3.pictureParts) drawing.pictureParts = { ...source3.pictureParts };
30434
+ const used = /* @__PURE__ */ new Set();
30435
+ nodes.forEach((node2, index3) => {
30436
+ if (!node2.picturePlaceholder || !node2.nodeId) return;
30437
+ const shape2 = drawing.shapes[index3];
30438
+ if (!shape2) return;
30439
+ const candidates = source3.pictures.filter((picture2) => picture2.nodeId === node2.nodeId);
30440
+ const matching2 = candidates.filter(
30441
+ (picture2) => picture2.role === node2.layoutRole || !!picture2.styleLabel && picture2.styleLabel === node2.styleLabel
30442
+ );
30443
+ const picture = matching2.length === 1 ? matching2[0] : candidates.length === 1 ? candidates[0] : void 0;
30444
+ if (picture) {
30445
+ shape2.fill = structuredClone(picture.fill);
30446
+ delete shape2.text;
30447
+ delete shape2.body;
30448
+ used.add(picture);
30449
+ } else if (candidates.length)
30450
+ issues.push({
30451
+ code: "DIAGRAM_PICTURE_AMBIGUOUS",
30452
+ message: `Picture role ${node2.layoutRole ?? node2.key} has multiple source pictures; no arbitrary assignment was made.`
30453
+ });
30454
+ });
30455
+ if (source3.pictures.some(
30456
+ (picture) => (!liveNodeIds || liveNodeIds.has(picture.nodeId)) && !used.has(picture)
30457
+ ))
30458
+ issues.push({
30459
+ code: "DIAGRAM_PICTURE_LAYOUT_UNSUPPORTED",
30460
+ message: "Some retained pictures have no matching image placeholder in this layout. Their source associations are preserved for a compatible layout."
30461
+ });
30462
+ }
30463
+ function withDiagramPictureSources(dataXml2, source3) {
30464
+ if (!source3?.pictures?.length) return dataXml2;
30465
+ const doc = parseXml(dataXml2);
30466
+ const root = doc.documentElement;
30467
+ const points2 = first(root, "ptLst", NS.dgm);
30468
+ const live = children(points2 ?? root, "pt", NS.dgm).filter(
30469
+ (point) => !["doc", "pres", "parTrans", "sibTrans"].includes(point.getAttribute("type") ?? "node")
30470
+ );
30471
+ for (const element3 of [...root.getElementsByTagNameNS(DIAGRAM_PICTURE_SOURCE_NS, "pictures")]) {
30472
+ const extension2 = element3.parentNode;
30473
+ if (extension2?.parentNode) extension2.parentNode.removeChild(extension2);
30474
+ }
30475
+ const retained = source3.pictures.filter(
30476
+ (picture) => live.some((point) => point.getAttribute("modelId") === picture.nodeId)
30477
+ );
30478
+ if (!retained.length) return buildXml(doc);
30479
+ const list2 = first(root, "extLst", NS.dgm) ?? doc.createElementNS(NS.dgm, "dgm:extLst");
30480
+ if (!list2.parentNode) root.appendChild(list2);
30481
+ const extension = doc.createElementNS(NS.a, "a:ext");
30482
+ extension.setAttribute("uri", DIAGRAM_PICTURE_SOURCE_NS);
30483
+ const payload = doc.createElementNS(DIAGRAM_PICTURE_SOURCE_NS, "op:pictures");
30484
+ extension.appendChild(payload);
30485
+ list2.appendChild(extension);
30486
+ for (const picture of retained) {
30487
+ if (!picture.fill.sourceXml)
30488
+ throw new Error("A retained SmartArt picture needs source fill XML");
30489
+ const element3 = doc.createElementNS(DIAGRAM_PICTURE_SOURCE_NS, "op:picture");
30490
+ element3.setAttribute("nodeId", picture.nodeId);
30491
+ if (picture.role) element3.setAttribute("role", picture.role);
30492
+ if (picture.styleLabel) element3.setAttribute("styleLabel", picture.styleLabel);
30493
+ const fill = parseXml(picture.fill.sourceXml).documentElement;
30494
+ element3.appendChild(doc.importNode(fill, true));
30495
+ payload.appendChild(element3);
30496
+ const presentations = children(points2 ?? root, "pt", NS.dgm).filter((point) => {
30497
+ const props = first(point, "prSet", NS.dgm);
30498
+ return point.getAttribute("type") === "pres" && props?.getAttribute("presAssocID") === picture.nodeId && (picture.role && props.getAttribute("presName") === picture.role || picture.styleLabel && props.getAttribute("presStyleLbl") === picture.styleLabel);
30499
+ });
30500
+ if (presentations.length === 1) {
30501
+ const point = presentations[0];
30502
+ const props = first(point, "spPr", NS.dgm) ?? doc.createElementNS(NS.dgm, "dgm:spPr");
30503
+ if (!props.parentNode) point.appendChild(props);
30504
+ for (const old of [...props.childNodes].filter((node2) => node2.nodeType === 1).filter(
30505
+ (node2) => node2.namespaceURI === NS.a && ["blipFill", "solidFill", "gradFill", "pattFill", "noFill", "grpFill"].includes(
30506
+ node2.localName
30507
+ )
30508
+ ))
30509
+ props.removeChild(old);
30510
+ props.insertBefore(doc.importNode(fill, true), props.firstChild);
30511
+ }
30512
+ }
30513
+ return buildXml(doc);
30514
+ }
30515
+ function diagramPictureRelationships(owner, source3, existing) {
30516
+ if (!source3?.pictures?.length || !source3.pictureParts) return existing;
30517
+ const rels = parseRelationships(existing);
30518
+ for (const [id, part] of Object.entries(source3.pictureParts)) {
30519
+ const previous = rels.get(id);
30520
+ if (previous && (previous.mode === "External" || resolvePartPath(owner, previous.target) !== part))
30521
+ throw new Error(`Conflicting SmartArt picture relationship: ${id}`);
30522
+ rels.set(id, { id, type: RELATIONSHIP_TYPES.image, target: `/${part}`, mode: "Internal" });
30523
+ }
30524
+ return buildRelationshipsXml(rels);
30525
+ }
30526
+
30527
+ // diagram/layout-role-style.ts
30528
+ function applyDiagramRoleColors(shape2, role, index3, minorFont) {
30529
+ const at = (colors) => colors[index3 % colors.length];
30530
+ const fill = role && at(role.fill.colors);
30531
+ if (fill && shape2.fill?.kind !== "none" && shape2.fill?.kind !== "picture")
30532
+ shape2.fill = { kind: "solid", color: structuredClone(fill) };
30533
+ const line3 = role && at(role.line.colors);
30534
+ if (line3 && shape2.line) shape2.line.fill = { kind: "solid", color: structuredClone(line3) };
30535
+ const text = role && at(role.textFill.colors);
30536
+ for (const paragraph2 of shape2.text?.paragraphs ?? []) {
30537
+ for (const run2 of paragraph2.runs) {
30538
+ if (!run2.color && text) run2.color = structuredClone(text);
30539
+ if (!run2.typeface && minorFont) run2.typeface = minorFont;
30540
+ }
30541
+ }
30542
+ }
30543
+
29437
30544
  // diagram/layout-preview.ts
29438
30545
  function diagramLayoutData(input) {
29439
30546
  const original = input.source?.dataXml ? parseDiagramDataModel(input.source.dataXml) : void 0;
@@ -29579,6 +30686,8 @@ function previewDiagramLayout(input) {
29579
30686
  ];
29580
30687
  });
29581
30688
  const drawing2 = diagramDrawingFromViews(views);
30689
+ drawing2.extentEmu = { ...input.extentEmu };
30690
+ const colors = input.source?.colorsXml ? parseDiagramColors(input.source.colorsXml) : void 0;
29582
30691
  const quickStyle = input.source?.quickStyleXml ? parseDiagramQuickStyle(input.source.quickStyleXml) : void 0;
29583
30692
  const originalModel = input.source?.dataXml ? parseDiagramDataModel(input.source.dataXml) : void 0;
29584
30693
  result2.nodes.forEach((node2, index3) => {
@@ -29589,7 +30698,9 @@ function previewDiagramLayout(input) {
29589
30698
  shape2.style = label2;
29590
30699
  shape2.has3d = label2.requires3d ?? label2.hasShape3d;
29591
30700
  }
29592
- if (node2.nodeId) shape2.sourceNodeId = node2.nodeId;
30701
+ const contextNodeId = node2.nodeId ?? node2.contextNodeId;
30702
+ if (contextNodeId) shape2.sourceNodeId = contextNodeId;
30703
+ if (node2.layoutRole) shape2.sourceLayoutRole = node2.layoutRole;
29593
30704
  if (node2.styleLabel) shape2.sourceStyleLabel = node2.styleLabel;
29594
30705
  if (node2.foldedNodeIds?.length) shape2.foldedNodeIds = node2.foldedNodeIds;
29595
30706
  const sourceNode = data.nodes.find((entry3) => entry3.id === node2.nodeId);
@@ -29602,15 +30713,36 @@ function previewDiagramLayout(input) {
29602
30713
  if (fill) shape2.fill = fill;
29603
30714
  }
29604
30715
  const direct = originalModel?.nodes.find((entry3) => entry3.modelId === node2.nodeId);
29605
- if (direct?.fill) shape2.fill = direct.fill;
29606
- if (direct?.line) shape2.line = { ...shape2.line, ...direct.line };
29607
30716
  const sourceIds = [node2.nodeId, ...node2.foldedNodeIds ?? []];
29608
30717
  const textNodes = sourceIds.flatMap((id) => {
29609
30718
  const source3 = input.nodes.find((entry3) => entry3.id === id);
29610
30719
  return source3 ? [source3] : [];
29611
30720
  });
29612
30721
  if (textNodes.length) shape2.text = diagramPreviewText(textNodes, node2.fontSize);
30722
+ if (shape2.text) {
30723
+ if (node2.textVerticalAnchor) shape2.text.anchor = node2.textVerticalAnchor;
30724
+ for (const paragraph2 of shape2.text.paragraphs)
30725
+ if (!paragraph2.align && node2.textAlign) paragraph2.align = node2.textAlign;
30726
+ }
30727
+ applyDiagramRoleColors(
30728
+ shape2,
30729
+ colors?.labels.find((label3) => label3.name === node2.styleLabel),
30730
+ Math.max(
30731
+ 0,
30732
+ input.nodes.findIndex((entry3) => entry3.id === contextNodeId)
30733
+ ),
30734
+ input.minorFont
30735
+ );
30736
+ if (direct?.fill && direct.fill.kind !== "picture") shape2.fill = direct.fill;
30737
+ if (direct?.line) shape2.line = { ...shape2.line, ...direct.line };
29613
30738
  });
30739
+ applyDiagramPictureSources(
30740
+ drawing2,
30741
+ result2.nodes,
30742
+ input.source,
30743
+ issues,
30744
+ new Set(input.nodes.map((node2) => node2.id))
30745
+ );
29614
30746
  return { drawing: drawing2, mode: "interpreted", issues };
29615
30747
  }
29616
30748
  } catch (error) {
@@ -29651,9 +30783,9 @@ function resolveDiagramDrawingStyles(drawing, scheme2) {
29651
30783
 
29652
30784
  // diagram/write/cache.ts
29653
30785
  var DSP2 = "http://schemas.microsoft.com/office/drawing/2008/diagram";
29654
- function add(parent, namespace, name, attrs2 = {}) {
30786
+ function add(parent, namespace, name, attrs3 = {}) {
29655
30787
  const child6 = parent.ownerDocument.createElementNS(namespace, name);
29656
- for (const [key, value2] of Object.entries(attrs2)) child6.setAttribute(key, value2);
30788
+ for (const [key, value2] of Object.entries(attrs3)) child6.setAttribute(key, value2);
29657
30789
  parent.appendChild(child6);
29658
30790
  return child6;
29659
30791
  }
@@ -29671,6 +30803,7 @@ function withDiagramDrawingRelationship(xml, relationshipId) {
29671
30803
  return buildXml(doc);
29672
30804
  }
29673
30805
  function buildGeneratedDiagramCache(dataXml2, input) {
30806
+ dataXml2 = withDiagramPictureSources(dataXml2, input.source);
29674
30807
  const source3 = { ...input.source, dataXml: dataXml2 };
29675
30808
  const model2 = parseDiagramDataModel(dataXml2);
29676
30809
  const scheme2 = { ...DEFAULT_GENERATED_DIAGRAM_SCHEME, ...input.scheme };
@@ -29697,7 +30830,10 @@ function buildGeneratedDiagramCache(dataXml2, input) {
29697
30830
  }
29698
30831
  for (const shape2 of drawing.shapes) {
29699
30832
  if (shape2.has3d || shape2.foldedNodeIds?.length) return void 0;
29700
- if (shape2.fill && !["none", "solid", "gradient"].includes(shape2.fill.kind)) return void 0;
30833
+ if (shape2.fill && !["none", "solid", "gradient", "picture"].includes(shape2.fill.kind))
30834
+ return void 0;
30835
+ if (shape2.fill?.kind === "picture" && (!shape2.fill.relId || !drawing.pictureParts?.[shape2.fill.relId]))
30836
+ return void 0;
29701
30837
  if (shape2.fill?.kind === "gradient" && shape2.fill.path && !["circle", "rect"].includes(shape2.fill.path))
29702
30838
  return void 0;
29703
30839
  if (shape2.effects?.effects.some(
@@ -29804,12 +30940,15 @@ function buildGeneratedDiagramCache(dataXml2, input) {
29804
30940
  const point = add(points2, NS.dgm, "dgm:pt", { modelId: id, type: "pres" });
29805
30941
  add(point, NS.dgm, "dgm:prSet", {
29806
30942
  ...shape2.sourceNodeId ? { presAssocID: shape2.sourceNodeId } : {},
29807
- presName: "node",
30943
+ presName: shape2.sourceLayoutRole ?? "node",
29808
30944
  presStyleLbl: shape2.sourceStyleLabel ?? "node1",
29809
30945
  presStyleIdx: String(index3),
29810
30946
  presStyleCnt: String(drawing.shapes.length)
29811
30947
  });
29812
- add(point, NS.dgm, "dgm:spPr");
30948
+ const properties2 = add(point, NS.dgm, "dgm:spPr");
30949
+ if (shape2.fill?.kind === "picture" && shape2.fill.sourceXml) {
30950
+ properties2.appendChild(doc.importNode(parseXml(shape2.fill.sourceXml).documentElement, true));
30951
+ }
29813
30952
  if (shape2.sourceNodeId)
29814
30953
  add(connections, NS.dgm, "dgm:cxn", {
29815
30954
  modelId: createOfficeGuid(),
@@ -29822,7 +30961,11 @@ function buildGeneratedDiagramCache(dataXml2, input) {
29822
30961
  });
29823
30962
  add(marker3, GENERATED_DIAGRAM_CACHE_NS, "oc:shape", { id });
29824
30963
  });
29825
- return { dataXml: buildXml(doc), drawingXml: serialized.xml };
30964
+ return {
30965
+ dataXml: buildXml(doc),
30966
+ drawingXml: serialized.xml,
30967
+ ...drawing.pictureParts ? { pictureParts: drawing.pictureParts } : {}
30968
+ };
29826
30969
  }
29827
30970
 
29828
30971
  // diagram/relationships.ts
@@ -30327,6 +31470,29 @@ async function loadDiagram(hostPart, relationshipIds, host) {
30327
31470
  code: "DIAGRAM_DRAWING_ABSENT",
30328
31471
  message: "The package has no cached drawing for this diagram; its layout can only be recomputed from the layout definition."
30329
31472
  });
31473
+ if (data && layoutSource.dataXml) {
31474
+ let pictureParts = {};
31475
+ if (paths.data) {
31476
+ const owner = paths.data;
31477
+ try {
31478
+ const entries = await host.readRelationshipEntries(diagramRelationshipsPart(owner));
31479
+ pictureParts = Object.fromEntries(
31480
+ (entries ?? []).filter(
31481
+ (entry3) => entry3.type.endsWith("/image") && entry3.mode !== "External" && !/^[a-z][a-z0-9+.-]*:/i.test(entry3.target)
31482
+ ).map((entry3) => [entry3.id, host.resolvePath(owner, entry3.target)])
31483
+ );
31484
+ } catch {
31485
+ issues.push({
31486
+ code: "DIAGRAM_PICTURE_RELATIONSHIPS_UNREADABLE",
31487
+ message: "Picture relationships in the diagram data could not be read."
31488
+ });
31489
+ }
31490
+ }
31491
+ Object.assign(
31492
+ layoutSource,
31493
+ captureDiagramPictures(data, layoutSource.dataXml, pictureParts, drawing)
31494
+ );
31495
+ }
30330
31496
  return {
30331
31497
  layoutSource,
30332
31498
  ...generatedCache ? { generatedCache: true } : {},
@@ -30940,11 +32106,11 @@ function readChartFormatting(root) {
30940
32106
  // chart/data-cache.ts
30941
32107
  function chartCacheValues(cache2) {
30942
32108
  if (!cache2) return [];
30943
- const numeric2 = cache2.type === "number";
32109
+ const numeric3 = cache2.type === "number";
30944
32110
  const out = [];
30945
32111
  for (const point of cache2.points) {
30946
32112
  const text = point.value;
30947
- out[point.index ?? out.length] = numeric2 && text.trim() !== "" && Number.isFinite(Number(text)) ? Number(text) : text;
32113
+ out[point.index ?? out.length] = numeric3 && text.trim() !== "" && Number.isFinite(Number(text)) ? Number(text) : text;
30948
32114
  }
30949
32115
  const size = Math.max(cache2.pointCount ?? 0, out.length);
30950
32116
  for (let index3 = 0; index3 < size; index3++) if (out[index3] === void 0) out[index3] = "";
@@ -32415,8 +33581,8 @@ function graft(from, to, order, kinds) {
32415
33581
  for (const child6 of elements(from)) {
32416
33582
  if (child6.namespaceURI !== NS.c || !kinds.has(child6.localName)) continue;
32417
33583
  if (first(to, child6.localName, NS.c)) continue;
32418
- const rank3 = order.indexOf(child6.localName);
32419
- const before = elements(to).find((item2) => order.indexOf(item2.localName) > rank3);
33584
+ const rank4 = order.indexOf(child6.localName);
33585
+ const before = elements(to).find((item2) => order.indexOf(item2.localName) > rank4);
32420
33586
  to.insertBefore(to.ownerDocument.importNode(child6, true), before ?? null);
32421
33587
  changed = true;
32422
33588
  }
@@ -32694,17 +33860,17 @@ var GROUPINGS = /* @__PURE__ */ new Set(["clustered", "stacked", "percentStacked
32694
33860
  function chartSummarySeries(source3, chartType, groupLabels, groupSmooth) {
32695
33861
  const categories = source3.categories ?? source3.xValues;
32696
33862
  const values2 = source3.values ?? source3.yValues;
32697
- const numeric2 = (v) => typeof v === "number" ? v : v === "" ? null : Number.isFinite(Number(v)) ? Number(v) : null;
33863
+ const numeric3 = (v) => typeof v === "number" ? v : v === "" ? null : Number.isFinite(Number(v)) ? Number(v) : null;
32698
33864
  const out = {
32699
33865
  categories: chartSourceValues(categories),
32700
- values: chartSourceValues(values2).map(numeric2)
33866
+ values: chartSourceValues(values2).map(numeric3)
32701
33867
  };
32702
33868
  const smooth = source3.smooth ?? groupSmooth;
32703
33869
  if (smooth !== void 0) out.smooth = smooth;
32704
33870
  if (source3.spPr?.line) out.line = source3.spPr.line;
32705
33871
  if (values2?.cache?.formatCode !== void 0) out.numberFormat = values2.cache.formatCode;
32706
33872
  if (source3.bubbleSizes) {
32707
- out.bubbleSizes = chartSourceValues(source3.bubbleSizes).map(numeric2);
33873
+ out.bubbleSizes = chartSourceValues(source3.bubbleSizes).map(numeric3);
32708
33874
  if (source3.bubbleSizes.formula) out.bubbleSizesRef = source3.bubbleSizes.formula;
32709
33875
  }
32710
33876
  if (source3.tx?.text !== void 0) out.name = source3.tx.text;
@@ -32817,6 +33983,18 @@ function chartSummaryFromSpace(chartSpace, extras = {}) {
32817
33983
  showNegativeBubbles: group.showNegativeBubbles === true
32818
33984
  };
32819
33985
  }
33986
+ if (group?.is3D) {
33987
+ const v = chartSpace.view3D;
33988
+ summary.view3D = {
33989
+ ...v?.rotX === void 0 ? {} : { rotX: v.rotX },
33990
+ ...v?.rotY === void 0 ? {} : { rotY: v.rotY },
33991
+ ...v?.perspective === void 0 ? {} : { perspective: v.perspective },
33992
+ ...v?.rightAngleAxes === void 0 ? {} : { rAngAx: v.rightAngleAxes },
33993
+ ...v?.depthPercent === void 0 ? {} : { depthPercent: v.depthPercent },
33994
+ ...v?.heightPercent === void 0 ? {} : { hPercent: v.heightPercent },
33995
+ ...group.gapDepth === void 0 ? {} : { gapDepth: group.gapDepth }
33996
+ };
33997
+ }
32820
33998
  const grouping = group?.grouping;
32821
33999
  if (grouping && GROUPINGS.has(grouping))
32822
34000
  summary.grouping = grouping;
@@ -32898,6 +34076,7 @@ function chartObjectFromSpace(space, frame2, root) {
32898
34076
  if (summary.extraGroups) object.extraGroups = summary.extraGroups;
32899
34077
  if (summary.bubble) object.bubble = summary.bubble;
32900
34078
  if (summary.stock) object.stock = summary.stock;
34079
+ if (summary.view3D) object.view3D = summary.view3D;
32901
34080
  if (frame2.name) object.name = frame2.name;
32902
34081
  if (frame2.quickLayout !== void 0) object.quickLayout = frame2.quickLayout;
32903
34082
  if (frame2.colorPalette !== void 0) object.colorPalette = frame2.colorPalette;
@@ -33448,6 +34627,136 @@ function parseChartExSpace(source3) {
33448
34627
  return { chartExSpace, issues: context.issues };
33449
34628
  }
33450
34629
 
34630
+ // chart/color-palettes.ts
34631
+ var COLORFUL_VARIATIONS = [
34632
+ {},
34633
+ { lumMod: 6e4 },
34634
+ { lumMod: 8e4, lumOff: 2e4 },
34635
+ { lumMod: 8e4 },
34636
+ { lumMod: 6e4, lumOff: 4e4 },
34637
+ { lumMod: 5e4 },
34638
+ { lumMod: 7e4, lumOff: 3e4 },
34639
+ { lumMod: 7e4 },
34640
+ { lumMod: 5e4, lumOff: 5e4 }
34641
+ ];
34642
+ var GRAY_VARIATIONS = [
34643
+ { tint: 88500 },
34644
+ { tint: 55e3 },
34645
+ { tint: 75e3 },
34646
+ { tint: 98500 },
34647
+ { tint: 3e4 },
34648
+ { tint: 6e4 },
34649
+ { tint: 8e4 }
34650
+ ];
34651
+ var ACCENTS = ["accent1", "accent2", "accent3", "accent4", "accent5", "accent6"];
34652
+ function colorful(id, index3, base) {
34653
+ return { id, group: "colorful", index: index3, meth: "cycle", base, variations: COLORFUL_VARIATIONS };
34654
+ }
34655
+ function mono(id, index3, accent, meth) {
34656
+ return { id, group: "monochromatic", index: index3, meth, base: [accent], variations: [] };
34657
+ }
34658
+ var CHART_COLOR_PALETTES = [
34659
+ colorful(10, 1, ACCENTS),
34660
+ colorful(11, 2, ["accent1", "accent3", "accent5"]),
34661
+ colorful(12, 3, ["accent2", "accent4", "accent6"]),
34662
+ colorful(13, 4, ["accent6", "accent5", "accent4"]),
34663
+ ...ACCENTS.map((accent, i2) => mono(14 + i2, 1 + i2, accent, "withinLinear")),
34664
+ {
34665
+ id: 20,
34666
+ group: "monochromatic",
34667
+ index: 7,
34668
+ meth: "cycle",
34669
+ base: ["dk1"],
34670
+ variations: GRAY_VARIATIONS
34671
+ },
34672
+ ...ACCENTS.map((accent, i2) => mono(21 + i2, 8 + i2, accent, "withinLinearReversed"))
34673
+ ];
34674
+ function findChartColorPalette(id) {
34675
+ return CHART_COLOR_PALETTES.find((palette) => palette.id === id);
34676
+ }
34677
+ function withinLinearTransform(i2, n) {
34678
+ if (n <= 1) {
34679
+ return {};
34680
+ }
34681
+ const step = 140 / (n + 1);
34682
+ const centre = (n - 1) / 2;
34683
+ const value2 = 100 - step * Math.abs(i2 - centre);
34684
+ if (i2 < centre) {
34685
+ return { shade: Math.floor(value2 + 1e-9) * 1e3 };
34686
+ }
34687
+ if (i2 > centre) {
34688
+ return { tint: Math.ceil(value2 - 1e-9) * 1e3 };
34689
+ }
34690
+ return {};
34691
+ }
34692
+ function chartPaletteSeriesColorChoice(palette, i2, n) {
34693
+ let base;
34694
+ let transform6;
34695
+ if (palette.meth === "cycle") {
34696
+ base = palette.base[i2 % palette.base.length];
34697
+ const round3 = Math.floor(i2 / palette.base.length);
34698
+ transform6 = (palette.variations.length ? palette.variations[round3 % palette.variations.length] : {}) ?? {};
34699
+ } else {
34700
+ const index3 = palette.meth === "withinLinearReversed" ? n - 1 - i2 : i2;
34701
+ base = palette.base[0];
34702
+ transform6 = withinLinearTransform(index3, n);
34703
+ }
34704
+ if (!base) throw new RangeError("A chart palette must have a base color");
34705
+ return {
34706
+ kind: "scheme",
34707
+ value: base,
34708
+ transforms: Object.entries(transform6).map(([name, value2]) => ({ name, value: String(value2) }))
34709
+ };
34710
+ }
34711
+
34712
+ // chart/render/chart-title-text.ts
34713
+ function chartRunStyle(run2) {
34714
+ return {
34715
+ ...run2.sizePt === void 0 ? {} : { fontSize: run2.sizePt },
34716
+ ...run2.bold === void 0 ? {} : { bold: run2.bold },
34717
+ ...run2.italic === void 0 ? {} : { italic: run2.italic },
34718
+ ...run2.underline === void 0 ? {} : { underline: run2.underline },
34719
+ ...run2.typeface === void 0 ? {} : { typeface: run2.typeface },
34720
+ ...run2.color === void 0 ? {} : { textColor: run2.color }
34721
+ };
34722
+ }
34723
+
34724
+ // chart/render/summary-ex-formatting.ts
34725
+ function textStyle(body) {
34726
+ const paragraph2 = body?.paragraphs[0];
34727
+ return {
34728
+ ...chartRunStyle(paragraph2?.defaultProperties ?? {}),
34729
+ ...chartRunStyle(paragraph2?.runs[0] ?? {})
34730
+ };
34731
+ }
34732
+ function chartExFormatting(space) {
34733
+ return {
34734
+ builtInStyle: 2,
34735
+ sourceXml: "",
34736
+ entries: {
34737
+ title: {
34738
+ fontSize: 18,
34739
+ bold: false,
34740
+ textColor: {
34741
+ kind: "scheme",
34742
+ value: "tx1",
34743
+ transforms: []
34744
+ },
34745
+ ...textStyle(space.title?.txPr),
34746
+ ...textStyle(space.title?.tx?.rich),
34747
+ ...space.title?.tx?.rich ? { textBody: space.title.tx.rich } : {},
34748
+ sourceXml: ""
34749
+ },
34750
+ legend: { fontSize: 12, ...textStyle(space.legend?.txPr), sourceXml: "" },
34751
+ categoryAxis: {
34752
+ fontSize: 10,
34753
+ ...textStyle(space.plotArea.axes.find((a2) => a2.scaling?.kind === "cat")?.txPr),
34754
+ sourceXml: ""
34755
+ }
34756
+ }
34757
+ };
34758
+ }
34759
+
33451
34760
  // chart/render/summary-ex-series.ts
33452
34761
  var level3 = (source3) => ({
33453
34762
  ...source3.visibility?.value === void 0 ? {} : { showValue: source3.visibility.value },
@@ -33460,6 +34769,7 @@ var level3 = (source3) => ({
33460
34769
  function chartExSeriesPaint(source3, series, defaultValues = false) {
33461
34770
  const fill = source3.spPr?.fill;
33462
34771
  if (fill) series.fill = fill;
34772
+ if (source3.spPr?.line) series.line = source3.spPr.line;
33463
34773
  const points2 = {};
33464
34774
  const fills = {};
33465
34775
  for (const point of source3.dataPoints) {
@@ -33543,34 +34853,13 @@ function chartExSummary(source3) {
33543
34853
  if (!isChartExRoot(root)) return void 0;
33544
34854
  return chartExSummaryFromModel(parseChartExSpace(root).chartExSpace);
33545
34855
  }
33546
- function chartExFormatting() {
33547
- return {
33548
- builtInStyle: 2,
33549
- sourceXml: "",
33550
- entries: {
33551
- title: {
33552
- fontSize: 14,
33553
- bold: false,
33554
- textColor: {
33555
- kind: "scheme",
33556
- value: "tx1",
33557
- transforms: [
33558
- { name: "lumMod", value: "65000" },
33559
- { name: "lumOff", value: "35000" }
33560
- ]
33561
- },
33562
- sourceXml: ""
33563
- }
33564
- }
33565
- };
33566
- }
33567
34856
  function summarySeries(space, source3, chartType) {
33568
34857
  const data = seriesData(space, source3);
33569
34858
  const categories = dimension(data, "strDim", "cat");
33570
34859
  const values2 = dimension(
33571
34860
  data,
33572
34861
  "numDim",
33573
- chartType === "treemap" || chartType === "sunburst" ? "size" : "val"
34862
+ chartType === "treemap" || chartType === "sunburst" ? "size" : chartType === "regionMap" ? "colorVal" : "val"
33574
34863
  );
33575
34864
  const series = {
33576
34865
  categories: categories?.points ?? [],
@@ -33579,11 +34868,24 @@ function summarySeries(space, source3, chartType) {
33579
34868
  ),
33580
34869
  ...seriesFill(source3)
33581
34870
  };
33582
- if (chartType === "funnel" || chartType === "boxWhisker") {
34871
+ if (chartType === "funnel" || chartType === "boxWhisker" || chartType === "regionMap") {
33583
34872
  chartExSeriesPaint(source3, series, chartType === "funnel" && source3.dataLabels !== void 0);
33584
34873
  if (source3.hidden !== void 0) series.hidden = source3.hidden;
33585
34874
  }
33586
34875
  if (chartType === "boxWhisker") series.boxWhisker = source3.layoutProperties ?? {};
34876
+ if (chartType === "regionMap") {
34877
+ const geo = source3.layoutProperties?.geography;
34878
+ series.regionMap = {
34879
+ ...geo,
34880
+ ...geo?.geoCacheXml ? { geographyCacheXml: geo.geoCacheXml } : {},
34881
+ ...dimension(data, "strDim", "entityId") ? { entityIds: dimension(data, "strDim", "entityId").points } : {},
34882
+ ...source3.layoutProperties?.regionLabelLayout ? {
34883
+ regionLabelLayout: source3.layoutProperties.regionLabelLayout
34884
+ } : {},
34885
+ ...source3.valueColorsXml ? { valueColorsXml: source3.valueColorsXml } : {},
34886
+ ...source3.valueColorPositionsXml ? { valueColorPositionsXml: source3.valueColorPositionsXml } : {}
34887
+ };
34888
+ }
33587
34889
  const name = source3.tx?.value?.trim();
33588
34890
  if (name) series.name = name;
33589
34891
  const nameRef = source3.tx?.formula?.formula.trim();
@@ -33596,7 +34898,7 @@ function chartExSummaryFromModel(space) {
33596
34898
  const all2 = space.plotArea.series;
33597
34899
  const primary = all2.find((s) => s.layoutId !== "paretoLine") ?? all2[0];
33598
34900
  const layoutId = primary?.layoutId ?? "";
33599
- const chartType = layoutId === "waterfall" ? "waterfall" : layoutId === "clusteredColumn" ? "histogram" : layoutId === "treemap" || layoutId === "sunburst" || layoutId === "funnel" || layoutId === "boxWhisker" ? layoutId : void 0;
34901
+ const chartType = layoutId === "waterfall" ? "waterfall" : layoutId === "clusteredColumn" ? "histogram" : layoutId === "treemap" || layoutId === "sunburst" || layoutId === "funnel" || layoutId === "boxWhisker" || layoutId === "regionMap" ? layoutId : void 0;
33600
34902
  if (!primary || !chartType) return { layoutId };
33601
34903
  const series = summarySeries(space, primary, chartType);
33602
34904
  const layout3 = primary.layoutProperties;
@@ -33634,7 +34936,12 @@ function chartExSummaryFromModel(space) {
33634
34936
  ];
33635
34937
  });
33636
34938
  }
33637
- summary.formatting = chartExFormatting();
34939
+ if (chartType === "funnel") {
34940
+ const cat = space.plotArea.axes.find((axis) => axis.scaling?.kind === "cat")?.scaling;
34941
+ if (cat?.kind === "cat" && typeof cat.gapWidth === "number")
34942
+ summary.funnelGapWidth = cat.gapWidth;
34943
+ }
34944
+ summary.formatting = chartExFormatting(space);
33638
34945
  const title = titleOf(space);
33639
34946
  if (title) summary.title = title;
33640
34947
  const position = legend?.position;
@@ -34108,6 +35415,7 @@ function parseDrawing(source3, partName, warn) {
34108
35415
  kind: "image",
34109
35416
  anchor,
34110
35417
  sourceXml: selfContainedXml(anchorEl),
35418
+ ...blipFill ? { layout: parsePictureLayout(blipFill) } : {},
34111
35419
  ...parsePictureCrop(blipFill) ? { crop: parsePictureCrop(blipFill) } : {},
34112
35420
  ...parsePictureEffects(blip).length ? { effects: parsePictureEffects(blip) } : {},
34113
35421
  partName: target,
@@ -34259,6 +35567,7 @@ function readValue2(ctx, c2, cell) {
34259
35567
  }
34260
35568
  cell.value = entry3.text;
34261
35569
  if (entry3.runs) cell.richText = entry3.runs.map((run2) => ({ ...run2 }));
35570
+ if (entry3.phonetic) cell.phonetic = structuredClone(entry3.phonetic);
34262
35571
  return;
34263
35572
  }
34264
35573
  case "inlineStr": {
@@ -34267,6 +35576,7 @@ function readValue2(ctx, c2, cell) {
34267
35576
  const entry3 = parseRichString(is2, ctx.palette);
34268
35577
  cell.value = entry3.text;
34269
35578
  if (entry3.runs) cell.richText = entry3.runs;
35579
+ if (entry3.phonetic) cell.phonetic = entry3.phonetic;
34270
35580
  return;
34271
35581
  }
34272
35582
  case "str":
@@ -34672,7 +35982,7 @@ function readWorksheet(ctx, partName, name, sheetId, xml, rows) {
34672
35982
  if (data) readSheetData(ctx, rows ?? elements(data), sheet);
34673
35983
  const protection = readProtection(byName.get("sheetProtection"));
34674
35984
  if (protection) sheet.protection = protection;
34675
- const autoFilter = readAutoFilter(byName.get("autoFilter"));
35985
+ const autoFilter = readAutoFilter(byName.get("autoFilter"), ctx.dxfs);
34676
35986
  if (autoFilter) sheet.autoFilter = autoFilter;
34677
35987
  sheet.merges = xChildren(byName.get("mergeCells") ?? root, "mergeCell").map((node2) => parseRange(att(node2, "ref") ?? "")).filter((range) => range !== void 0);
34678
35988
  sheet.conditionalFormats = readConditionalFormats(
@@ -34958,8 +36268,8 @@ function attributes(entries) {
34958
36268
  return ` ${name}="${text}"`;
34959
36269
  }).join("");
34960
36270
  }
34961
- var cxElement = (local, content2 = "", attrs2 = "") => content2 ? `<cx:${local}${attrs2}>${content2}</cx:${local}>` : `<cx:${local}${attrs2}/>`;
34962
- var cxText = (local, text, attrs2 = "") => text === void 0 ? "" : `<cx:${local}${attrs2}>${escapeText3(text)}</cx:${local}>`;
36271
+ var cxElement = (local, content2 = "", attrs3 = "") => content2 ? `<cx:${local}${attrs3}>${content2}</cx:${local}>` : `<cx:${local}${attrs3}/>`;
36272
+ var cxText = (local, text, attrs3 = "") => text === void 0 ? "" : `<cx:${local}${attrs3}>${escapeText3(text)}</cx:${local}>`;
34963
36273
  var cxVal = (local, value2) => value2 === void 0 ? "" : `<cx:${local}${attributes([["val", value2]])}/>`;
34964
36274
  var formulaXml = (local, formula2) => formula2 ? cxText(local, formula2.formula, attributes([["dir", formula2.direction]])) : "";
34965
36275
  var shapeXml = (context, shape2) => shape2 ? cxElement("spPr", shapePropertiesInnerXml(context, shape2)) : "";
@@ -35933,104 +37243,6 @@ function defaultChartAxes(horizontal, scatter, ids = DEFAULT_CHART_AXIS_IDS) {
35933
37243
  return [first2, second];
35934
37244
  }
35935
37245
 
35936
- // chart/color-palettes.ts
35937
- var COLORFUL_VARIATIONS = [
35938
- {},
35939
- { lumMod: 6e4 },
35940
- { lumMod: 8e4, lumOff: 2e4 },
35941
- { lumMod: 8e4 },
35942
- { lumMod: 6e4, lumOff: 4e4 },
35943
- { lumMod: 5e4 },
35944
- { lumMod: 7e4, lumOff: 3e4 },
35945
- { lumMod: 7e4 },
35946
- { lumMod: 5e4, lumOff: 5e4 }
35947
- ];
35948
- var GRAY_VARIATIONS = [
35949
- { tint: 88500 },
35950
- { tint: 55e3 },
35951
- { tint: 75e3 },
35952
- { tint: 98500 },
35953
- { tint: 3e4 },
35954
- { tint: 6e4 },
35955
- { tint: 8e4 }
35956
- ];
35957
- var ACCENTS = ["accent1", "accent2", "accent3", "accent4", "accent5", "accent6"];
35958
- function colorful(id, index3, base) {
35959
- return { id, group: "colorful", index: index3, meth: "cycle", base, variations: COLORFUL_VARIATIONS };
35960
- }
35961
- function mono(id, index3, accent, meth) {
35962
- return { id, group: "monochromatic", index: index3, meth, base: [accent], variations: [] };
35963
- }
35964
- var CHART_COLOR_PALETTES = [
35965
- colorful(10, 1, ACCENTS),
35966
- colorful(11, 2, ["accent1", "accent3", "accent5"]),
35967
- colorful(12, 3, ["accent2", "accent4", "accent6"]),
35968
- colorful(13, 4, ["accent6", "accent5", "accent4"]),
35969
- ...ACCENTS.map((accent, i2) => mono(14 + i2, 1 + i2, accent, "withinLinear")),
35970
- {
35971
- id: 20,
35972
- group: "monochromatic",
35973
- index: 7,
35974
- meth: "cycle",
35975
- base: ["dk1"],
35976
- variations: GRAY_VARIATIONS
35977
- },
35978
- ...ACCENTS.map((accent, i2) => mono(21 + i2, 8 + i2, accent, "withinLinearReversed"))
35979
- ];
35980
- function findChartColorPalette(id) {
35981
- return CHART_COLOR_PALETTES.find((palette) => palette.id === id);
35982
- }
35983
- function withinLinearTransform(i2, n) {
35984
- if (n <= 1) {
35985
- return {};
35986
- }
35987
- const step = 140 / (n + 1);
35988
- const centre = (n - 1) / 2;
35989
- const value2 = 100 - step * Math.abs(i2 - centre);
35990
- if (i2 < centre) {
35991
- return { shade: Math.floor(value2 + 1e-9) * 1e3 };
35992
- }
35993
- if (i2 > centre) {
35994
- return { tint: Math.ceil(value2 - 1e-9) * 1e3 };
35995
- }
35996
- return {};
35997
- }
35998
- function chartPaletteSeriesColorChoice(palette, i2, n) {
35999
- let base;
36000
- let transform6;
36001
- if (palette.meth === "cycle") {
36002
- base = palette.base[i2 % palette.base.length];
36003
- const round3 = Math.floor(i2 / palette.base.length);
36004
- transform6 = (palette.variations.length ? palette.variations[round3 % palette.variations.length] : {}) ?? {};
36005
- } else {
36006
- const index3 = palette.meth === "withinLinearReversed" ? n - 1 - i2 : i2;
36007
- base = palette.base[0];
36008
- transform6 = withinLinearTransform(index3, n);
36009
- }
36010
- if (!base) throw new RangeError("A chart palette must have a base color");
36011
- return {
36012
- kind: "scheme",
36013
- value: base,
36014
- transforms: Object.entries(transform6).map(([name, value2]) => ({ name, value: String(value2) }))
36015
- };
36016
- }
36017
-
36018
- // chart/render/theme-palette.ts
36019
- var THEME_SLOTS = [
36020
- "lt1",
36021
- "dk1",
36022
- "lt2",
36023
- "dk2",
36024
- "accent1",
36025
- "accent2",
36026
- "accent3",
36027
- "accent4",
36028
- "accent5",
36029
- "accent6",
36030
- "hlink",
36031
- "folHlink"
36032
- ];
36033
-
36034
37246
  // xlsx/edit/chart-series-fill.ts
36035
37247
  function chartDrawingColor(color) {
36036
37248
  if (!color) return void 0;
@@ -36170,7 +37382,7 @@ var PackageWriter = class {
36170
37382
  const date = new Date(Date.UTC(1980, 0, 1));
36171
37383
  const options = { date, createFolders: false };
36172
37384
  zip.file("[Content_Types].xml", this.contentTypesXml(), options);
36173
- const names = [...this.parts.keys()].sort((a2, b) => rank(a2) - rank(b) || a2.localeCompare(b));
37385
+ const names = [...this.parts.keys()].sort((a2, b) => rank2(a2) - rank2(b) || a2.localeCompare(b));
36174
37386
  for (const name of names) zip.file(name, this.parts.get(name) ?? "", options);
36175
37387
  return zip.generateAsync({
36176
37388
  type: "uint8array",
@@ -36179,7 +37391,7 @@ var PackageWriter = class {
36179
37391
  });
36180
37392
  }
36181
37393
  };
36182
- var rank = (name) => name === "_rels/.rels" ? 0 : name.startsWith("docProps/") ? 1 : name === "xl/workbook.xml" ? 2 : 3;
37394
+ var rank2 = (name) => name === "_rels/.rels" ? 0 : name.startsWith("docProps/") ? 1 : name === "xl/workbook.xml" ? 2 : 3;
36183
37395
 
36184
37396
  // xlsx/write/chart-colors.ts
36185
37397
  function chartSeriesDrawingFill(chart, series, index3) {
@@ -36274,8 +37486,8 @@ function seriesModel(chart, series, index3) {
36274
37486
  }
36275
37487
  if (lineLike) out.marker = { symbol: "none" };
36276
37488
  if (type === "bar" || type === "column") out.invertIfNegative = false;
36277
- const numeric2 = series.categories.length > 0 && series.categories.every((c2) => typeof c2 === "number");
36278
- const categories = series.categoriesRef !== void 0 || series.categories.length > 0 ? source2(numeric2 ? "num" : "str", series.categoriesRef, series.categories) : void 0;
37489
+ const numeric3 = series.categories.length > 0 && series.categories.every((c2) => typeof c2 === "number");
37490
+ const categories = series.categoriesRef !== void 0 || series.categories.length > 0 ? source2(numeric3 ? "num" : "str", series.categoriesRef, series.categories) : void 0;
36279
37491
  const values2 = source2("num", series.valuesRef, series.values);
36280
37492
  if (type === "scatter") {
36281
37493
  if (categories) out.xValues = categories;
@@ -36440,6 +37652,7 @@ function writeSmartArtCache(writer, object, parts, rels, relativeTarget2, contex
36440
37652
  height: object.anchor.ext?.cy ?? 2667e3
36441
37653
  },
36442
37654
  source: {
37655
+ ...object.layoutSource,
36443
37656
  ...layoutXml3 ? { layoutXml: layoutXml3 } : {},
36444
37657
  ...colorsXml ? { colorsXml } : {},
36445
37658
  ...quickStyleXml ? { quickStyleXml } : {}
@@ -36457,6 +37670,8 @@ function writeSmartArtCache(writer, object, parts, rels, relativeTarget2, contex
36457
37670
  const drawingName = `xl/diagrams/drawing${index3}.xml`;
36458
37671
  const relationship2 = rels.add(DIAGRAM_RELATIONSHIP_TYPES.drawing, relativeTarget2(drawingName));
36459
37672
  writer.add(drawingName, cache2.drawingXml, DIAGRAM_CONTENT_TYPES.drawing);
37673
+ const pictureRels = diagramPictureRelationships(drawingName, object.layoutSource);
37674
+ if (pictureRels) writer.add(drawingName.replace(/([^/]+)$/, "_rels/$1.rels"), pictureRels);
36460
37675
  writer.add(
36461
37676
  parts.data,
36462
37677
  withDiagramDrawingRelationship(cache2.dataXml, relationship2),
@@ -36523,6 +37738,20 @@ function writeEditedSmartArt(writer, object, rels, relativeTarget2, context = {}
36523
37738
  ...relaid && object.layoutId ? { layout: { uniqueId: object.layoutId, category: object.layoutFamily } } : {}
36524
37739
  })
36525
37740
  );
37741
+ if (object.layoutSource?.pictures?.length) {
37742
+ const pending2 = writer.peek(dataPart);
37743
+ if (typeof pending2 === "string")
37744
+ writer.add(dataPart, withDiagramPictureSources(pending2, object.layoutSource));
37745
+ const name = relationshipsPartFor(dataPart);
37746
+ const existing = writer.peek(name) ?? writer.source?.text(name);
37747
+ const relsXml = diagramPictureRelationships(
37748
+ dataPart,
37749
+ object.layoutSource,
37750
+ typeof existing === "string" ? existing : existing ? new TextDecoder().decode(existing) : void 0
37751
+ );
37752
+ if (relsXml) writer.add(name, relsXml, CONTENT_TYPES.rels);
37753
+ for (const part of Object.values(object.layoutSource.pictureParts ?? {})) writer.carry(part);
37754
+ }
36526
37755
  if (rels && relativeTarget2)
36527
37756
  writeSmartArtCache(
36528
37757
  writer,
@@ -36786,6 +38015,7 @@ function writeDrawing(writer, partName, objects, sourceDrawing, context) {
36786
38015
  }
36787
38016
  if (blip && object.effects !== void 0 && !sameModel(object.effects, parsePictureEffects(blip)))
36788
38017
  applyPictureEffects(blip, object.effects ?? []);
38018
+ if (fill && object.layout !== void 0) applyPictureLayout(fill, object.layout);
36789
38019
  if (fill && object.crop !== void 0 && !sameModel(object.crop, parsePictureCrop(fill)))
36790
38020
  applyPictureCrop(fill, object.crop);
36791
38021
  body += buildXml(imported ? picture.documentElement : elements(picture.documentElement)[0]);
@@ -37393,7 +38623,7 @@ function collectNumbers(ctx, args, options = {}) {
37393
38623
  }
37394
38624
  var all = (ctx, args) => collectNumbers(ctx, args, { includeAll: true });
37395
38625
  var domain = (ok, value2) => ok ? value2 : fail(ERR.NUM);
37396
- var wildcardRegex = compileWildcard;
38626
+ var wildcardRegex2 = compileWildcard;
37397
38627
  var hasWildcards = (text) => /[*?~]/.test(text);
37398
38628
  function makeCriteria(criteria) {
37399
38629
  if (isError(criteria)) return (value2) => isError(value2) && value2.error === criteria.error;
@@ -37424,7 +38654,7 @@ function makeCriteria(criteria) {
37424
38654
  } else if (errorOperand) {
37425
38655
  test = (value2) => isError(value2) && value2.error === errorOperand;
37426
38656
  } else if (hasWildcards(operandText)) {
37427
- const regex = wildcardRegex(operandText);
38657
+ const regex = wildcardRegex2(operandText);
37428
38658
  test = (value2) => typeof value2 === "string" && regex.test(value2);
37429
38659
  } else {
37430
38660
  const lower3 = operandText.toLowerCase();
@@ -37447,7 +38677,7 @@ function spec(name, category, syntax, description, minArgs, maxArgs, fn, params,
37447
38677
  if (volatile) out.volatile = true;
37448
38678
  return out;
37449
38679
  }
37450
- function numeric(name, category, syntax, description, minArgs, maxArgs, fn, defaults = []) {
38680
+ function numeric2(name, category, syntax, description, minArgs, maxArgs, fn, defaults = []) {
37451
38681
  return spec(name, category, syntax, description, minArgs, maxArgs, (args) => {
37452
38682
  const values2 = [];
37453
38683
  for (let i2 = 0; i2 < maxArgs; i2++) {
@@ -37974,19 +39204,19 @@ function percentRank(values2, x, digits2, exclusive) {
37974
39204
  const first2 = s[0];
37975
39205
  const last = s[n - 1];
37976
39206
  if (x < first2 || x > last) fail(ERR.NA);
37977
- let rank3;
39207
+ let rank4;
37978
39208
  const lower3 = s.filter((v) => v < x).length;
37979
39209
  const exact = s.includes(x);
37980
39210
  if (exact) {
37981
- rank3 = exclusive ? (lower3 + 1) / (n + 1) : n === 1 ? 1 : lower3 / (n - 1);
39211
+ rank4 = exclusive ? (lower3 + 1) / (n + 1) : n === 1 ? 1 : lower3 / (n - 1);
37982
39212
  } else {
37983
39213
  const below = s[lower3 - 1];
37984
39214
  const above = s[lower3];
37985
39215
  const frac = (x - below) / (above - below);
37986
- rank3 = exclusive ? (lower3 + frac) / (n + 1) : (lower3 - 1 + frac) / (n - 1);
39216
+ rank4 = exclusive ? (lower3 + frac) / (n + 1) : (lower3 - 1 + frac) / (n - 1);
37987
39217
  }
37988
39218
  const factor = Math.pow(10, Math.trunc(digits2));
37989
- return Math.floor(rank3 * factor + 1e-9) / factor;
39219
+ return Math.floor(rank4 * factor + 1e-9) / factor;
37990
39220
  }
37991
39221
  function covariance(xs, ys, sample) {
37992
39222
  if (xs.length !== ys.length) fail(ERR.NA);
@@ -38020,7 +39250,7 @@ function linearFit(xs, ys) {
38020
39250
  const slope = sxy / sxx;
38021
39251
  return { slope, intercept: my - slope * mx };
38022
39252
  }
38023
- function rank2(values2, x, ascending, average) {
39253
+ function rank3(values2, x, ascending, average) {
38024
39254
  let better2 = 0;
38025
39255
  let ties = 0;
38026
39256
  for (const v of values2) {
@@ -39219,7 +40449,7 @@ var ENGINEERING_FUNCTIONS = [
39219
40449
  const out = Math.floor(bitArg(args[0]) / Math.pow(2, int3(args[1])));
39220
40450
  return out >= 2 ** 48 ? fail(ERR.NUM) : out;
39221
40451
  }),
39222
- numeric(
40452
+ numeric2(
39223
40453
  "DELTA",
39224
40454
  C8,
39225
40455
  "DELTA(number1, [number2])",
@@ -39228,7 +40458,7 @@ var ENGINEERING_FUNCTIONS = [
39228
40458
  2,
39229
40459
  (a2, b = 0) => a2 === b ? 1 : 0
39230
40460
  ),
39231
- numeric(
40461
+ numeric2(
39232
40462
  "GESTEP",
39233
40463
  C8,
39234
40464
  "GESTEP(number, [step])",
@@ -39849,7 +41079,7 @@ function variableDeclining(cost, salvage, life, start, end, factor, noSwitch) {
39849
41079
  return total2;
39850
41080
  }
39851
41081
  var DEPRECIATION_FUNCTIONS = [
39852
- numeric(
41082
+ numeric2(
39853
41083
  "SLN",
39854
41084
  C12,
39855
41085
  "SLN(cost, salvage, life)",
@@ -39858,7 +41088,7 @@ var DEPRECIATION_FUNCTIONS = [
39858
41088
  3,
39859
41089
  (c2, s, l) => l === 0 ? fail(ERR.DIV0) : (c2 - (s ?? 0)) / (l ?? 1)
39860
41090
  ),
39861
- numeric(
41091
+ numeric2(
39862
41092
  "SYD",
39863
41093
  C12,
39864
41094
  "SYD(cost, salvage, life, per)",
@@ -39870,7 +41100,7 @@ var DEPRECIATION_FUNCTIONS = [
39870
41100
  return (c2 - s) * (l - p + 1) * 2 / (l * (l + 1));
39871
41101
  }
39872
41102
  ),
39873
- numeric(
41103
+ numeric2(
39874
41104
  "DDB",
39875
41105
  C12,
39876
41106
  "DDB(cost, salvage, life, period, [factor])",
@@ -39908,7 +41138,7 @@ var DEPRECIATION_FUNCTIONS = [
39908
41138
  );
39909
41139
  }
39910
41140
  ),
39911
- numeric(
41141
+ numeric2(
39912
41142
  "DB",
39913
41143
  C12,
39914
41144
  "DB(cost, salvage, life, period, [month])",
@@ -39927,7 +41157,7 @@ var DEPRECIATION_FUNCTIONS = [
39927
41157
  return period === Math.trunc(l) + 1 ? book * rate * (12 - month) / 12 : book * rate;
39928
41158
  }
39929
41159
  ),
39930
- numeric(
41160
+ numeric2(
39931
41161
  "EFFECT",
39932
41162
  C12,
39933
41163
  "EFFECT(nominal_rate, npery)",
@@ -39940,7 +41170,7 @@ var DEPRECIATION_FUNCTIONS = [
39940
41170
  return Math.pow(1 + r / p, p) - 1;
39941
41171
  }
39942
41172
  ),
39943
- numeric(
41173
+ numeric2(
39944
41174
  "NOMINAL",
39945
41175
  C12,
39946
41176
  "NOMINAL(effect_rate, npery)",
@@ -39953,7 +41183,7 @@ var DEPRECIATION_FUNCTIONS = [
39953
41183
  return p * (Math.pow(1 + r, 1 / p) - 1);
39954
41184
  }
39955
41185
  ),
39956
- numeric(
41186
+ numeric2(
39957
41187
  "CUMIPMT",
39958
41188
  C12,
39959
41189
  "CUMIPMT(rate, nper, pv, start_period, end_period, type)",
@@ -39962,7 +41192,7 @@ var DEPRECIATION_FUNCTIONS = [
39962
41192
  6,
39963
41193
  (...a2) => cumulative(a2, false)
39964
41194
  ),
39965
- numeric(
41195
+ numeric2(
39966
41196
  "CUMPRINC",
39967
41197
  C12,
39968
41198
  "CUMPRINC(rate, nper, pv, start_period, end_period, type)",
@@ -39971,7 +41201,7 @@ var DEPRECIATION_FUNCTIONS = [
39971
41201
  6,
39972
41202
  (...a2) => cumulative(a2, true)
39973
41203
  ),
39974
- numeric(
41204
+ numeric2(
39975
41205
  "ISPMT",
39976
41206
  C12,
39977
41207
  "ISPMT(rate, per, nper, pv)",
@@ -39983,7 +41213,7 @@ var DEPRECIATION_FUNCTIONS = [
39983
41213
  return p * r * (per / n - 1);
39984
41214
  }
39985
41215
  ),
39986
- numeric(
41216
+ numeric2(
39987
41217
  "PDURATION",
39988
41218
  C12,
39989
41219
  "PDURATION(rate, pv, fv)",
@@ -39995,7 +41225,7 @@ var DEPRECIATION_FUNCTIONS = [
39995
41225
  return (Math.log(f6) - Math.log(p)) / Math.log(1 + r);
39996
41226
  }
39997
41227
  ),
39998
- numeric(
41228
+ numeric2(
39999
41229
  "RRI",
40000
41230
  C12,
40001
41231
  "RRI(nper, pv, fv)",
@@ -40017,7 +41247,7 @@ var DEPRECIATION_FUNCTIONS = [
40017
41247
  (args, ctx) => collectNumbers(ctx, [args[1] ?? null]).reduce((acc, r) => acc * (1 + r), num4(args[0])),
40018
41248
  ["value", "any"]
40019
41249
  ),
40020
- numeric(
41250
+ numeric2(
40021
41251
  "DOLLARDE",
40022
41252
  C12,
40023
41253
  "DOLLARDE(fractional_dollar, fraction)",
@@ -40033,7 +41263,7 @@ var DEPRECIATION_FUNCTIONS = [
40033
41263
  return int4 + (d - int4) * Math.pow(10, digits2) / frac;
40034
41264
  }
40035
41265
  ),
40036
- numeric(
41266
+ numeric2(
40037
41267
  "DOLLARFR",
40038
41268
  C12,
40039
41269
  "DOLLARFR(decimal_dollar, fraction)",
@@ -40207,7 +41437,7 @@ var FINANCIAL_FUNCTIONS = [
40207
41437
  ...COUPON_FUNCTIONS,
40208
41438
  ...BOND_FUNCTIONS,
40209
41439
  ...SECURITY_FUNCTIONS,
40210
- numeric(
41440
+ numeric2(
40211
41441
  "PMT",
40212
41442
  C15,
40213
41443
  "PMT(rate, nper, pv, [fv], [type])",
@@ -40216,7 +41446,7 @@ var FINANCIAL_FUNCTIONS = [
40216
41446
  5,
40217
41447
  (r, n, p, f6, t) => pmt(r, n ?? 0, p ?? 0, f6, t)
40218
41448
  ),
40219
- numeric(
41449
+ numeric2(
40220
41450
  "FV",
40221
41451
  C15,
40222
41452
  "FV(rate, nper, pmt, [pv], [type])",
@@ -40225,7 +41455,7 @@ var FINANCIAL_FUNCTIONS = [
40225
41455
  5,
40226
41456
  (r, n, p, v, t) => fv(r, n ?? 0, p ?? 0, v, t)
40227
41457
  ),
40228
- numeric(
41458
+ numeric2(
40229
41459
  "PV",
40230
41460
  C15,
40231
41461
  "PV(rate, nper, pmt, [fv], [type])",
@@ -40234,7 +41464,7 @@ var FINANCIAL_FUNCTIONS = [
40234
41464
  5,
40235
41465
  (r, n, p, f6, t) => pv(r, n ?? 0, p ?? 0, f6, t)
40236
41466
  ),
40237
- numeric(
41467
+ numeric2(
40238
41468
  "NPER",
40239
41469
  C15,
40240
41470
  "NPER(rate, pmt, pv, [fv], [type])",
@@ -40251,7 +41481,7 @@ var FINANCIAL_FUNCTIONS = [
40251
41481
  return Math.log(num1 / den) / Math.log(1 + r);
40252
41482
  }
40253
41483
  ),
40254
- numeric(
41484
+ numeric2(
40255
41485
  "IPMT",
40256
41486
  C15,
40257
41487
  "IPMT(rate, per, nper, pv, [fv], [type])",
@@ -40260,7 +41490,7 @@ var FINANCIAL_FUNCTIONS = [
40260
41490
  6,
40261
41491
  (r, per, n, p, f6, t) => ipmt(r, per ?? 0, n ?? 0, p ?? 0, f6, t)
40262
41492
  ),
40263
- numeric(
41493
+ numeric2(
40264
41494
  "PPMT",
40265
41495
  C15,
40266
41496
  "PPMT(rate, per, nper, pv, [fv], [type])",
@@ -40269,7 +41499,7 @@ var FINANCIAL_FUNCTIONS = [
40269
41499
  6,
40270
41500
  (r, per, n, p, f6, t) => pmt(r, n ?? 0, p ?? 0, f6, t) - ipmt(r, per ?? 0, n ?? 0, p ?? 0, f6, t)
40271
41501
  ),
40272
- numeric(
41502
+ numeric2(
40273
41503
  "RATE",
40274
41504
  C15,
40275
41505
  "RATE(nper, pmt, pv, [fv], [type], [guess])",
@@ -40955,7 +42185,7 @@ var sameKind = (a2, b) => typeof a2 === "number" && typeof b === "number" || typ
40955
42185
  var compareLookup = (a2, b) => a2 === null ? b === null ? 0 : 1 : b === null ? -1 : compareScalars(a2, b);
40956
42186
  function exactMatcher(lookup2, wildcards) {
40957
42187
  if (typeof lookup2 === "string" && wildcards && hasWildcards(lookup2)) {
40958
- const regex = wildcardRegex(lookup2);
42188
+ const regex = wildcardRegex2(lookup2);
40959
42189
  return (v) => typeof v === "string" && regex.test(v);
40960
42190
  }
40961
42191
  if (lookup2 === null) return (v) => v === null;
@@ -42049,10 +43279,10 @@ var SUM_FUNCTIONS = [
42049
43279
  // xlsx/formula/functions/math-more.ts
42050
43280
  var C22 = "Math & Trig";
42051
43281
  var MATH_MORE = [
42052
- numeric("SIN", C22, "SIN(number)", "The sine of an angle in radians.", 1, 1, Math.sin),
42053
- numeric("COS", C22, "COS(number)", "The cosine of an angle in radians.", 1, 1, Math.cos),
42054
- numeric("TAN", C22, "TAN(number)", "The tangent of an angle in radians.", 1, 1, Math.tan),
42055
- numeric(
43282
+ numeric2("SIN", C22, "SIN(number)", "The sine of an angle in radians.", 1, 1, Math.sin),
43283
+ numeric2("COS", C22, "COS(number)", "The cosine of an angle in radians.", 1, 1, Math.cos),
43284
+ numeric2("TAN", C22, "TAN(number)", "The tangent of an angle in radians.", 1, 1, Math.tan),
43285
+ numeric2(
42056
43286
  "ASIN",
42057
43287
  C22,
42058
43288
  "ASIN(number)",
@@ -42061,7 +43291,7 @@ var MATH_MORE = [
42061
43291
  1,
42062
43292
  (x) => domain(Math.abs(x) <= 1, Math.asin(x))
42063
43293
  ),
42064
- numeric(
43294
+ numeric2(
42065
43295
  "ACOS",
42066
43296
  C22,
42067
43297
  "ACOS(number)",
@@ -42070,8 +43300,8 @@ var MATH_MORE = [
42070
43300
  1,
42071
43301
  (x) => domain(Math.abs(x) <= 1, Math.acos(x))
42072
43302
  ),
42073
- numeric("ATAN", C22, "ATAN(number)", "The arctangent in radians.", 1, 1, Math.atan),
42074
- numeric(
43303
+ numeric2("ATAN", C22, "ATAN(number)", "The arctangent in radians.", 1, 1, Math.atan),
43304
+ numeric2(
42075
43305
  "ATAN2",
42076
43306
  C22,
42077
43307
  "ATAN2(x_num, y_num)",
@@ -42083,11 +43313,11 @@ var MATH_MORE = [
42083
43313
  return Math.atan2(y ?? 0, x);
42084
43314
  }
42085
43315
  ),
42086
- numeric("SINH", C22, "SINH(number)", "The hyperbolic sine.", 1, 1, Math.sinh),
42087
- numeric("COSH", C22, "COSH(number)", "The hyperbolic cosine.", 1, 1, Math.cosh),
42088
- numeric("TANH", C22, "TANH(number)", "The hyperbolic tangent.", 1, 1, Math.tanh),
42089
- numeric("ASINH", C22, "ASINH(number)", "The inverse hyperbolic sine.", 1, 1, Math.asinh),
42090
- numeric(
43316
+ numeric2("SINH", C22, "SINH(number)", "The hyperbolic sine.", 1, 1, Math.sinh),
43317
+ numeric2("COSH", C22, "COSH(number)", "The hyperbolic cosine.", 1, 1, Math.cosh),
43318
+ numeric2("TANH", C22, "TANH(number)", "The hyperbolic tangent.", 1, 1, Math.tanh),
43319
+ numeric2("ASINH", C22, "ASINH(number)", "The inverse hyperbolic sine.", 1, 1, Math.asinh),
43320
+ numeric2(
42091
43321
  "ACOSH",
42092
43322
  C22,
42093
43323
  "ACOSH(number)",
@@ -42096,7 +43326,7 @@ var MATH_MORE = [
42096
43326
  1,
42097
43327
  (x) => domain(x >= 1, Math.acosh(x))
42098
43328
  ),
42099
- numeric(
43329
+ numeric2(
42100
43330
  "ATANH",
42101
43331
  C22,
42102
43332
  "ATANH(number)",
@@ -42105,7 +43335,7 @@ var MATH_MORE = [
42105
43335
  1,
42106
43336
  (x) => domain(Math.abs(x) < 1, Math.atanh(x))
42107
43337
  ),
42108
- numeric(
43338
+ numeric2(
42109
43339
  "COT",
42110
43340
  C22,
42111
43341
  "COT(number)",
@@ -42114,7 +43344,7 @@ var MATH_MORE = [
42114
43344
  1,
42115
43345
  (x) => x === 0 ? fail(ERR.DIV0) : 1 / Math.tan(x)
42116
43346
  ),
42117
- numeric(
43347
+ numeric2(
42118
43348
  "COTH",
42119
43349
  C22,
42120
43350
  "COTH(number)",
@@ -42123,7 +43353,7 @@ var MATH_MORE = [
42123
43353
  1,
42124
43354
  (x) => x === 0 ? fail(ERR.DIV0) : 1 / Math.tanh(x)
42125
43355
  ),
42126
- numeric(
43356
+ numeric2(
42127
43357
  "CSC",
42128
43358
  C22,
42129
43359
  "CSC(number)",
@@ -42132,7 +43362,7 @@ var MATH_MORE = [
42132
43362
  1,
42133
43363
  (x) => x === 0 ? fail(ERR.DIV0) : 1 / Math.sin(x)
42134
43364
  ),
42135
- numeric(
43365
+ numeric2(
42136
43366
  "CSCH",
42137
43367
  C22,
42138
43368
  "CSCH(number)",
@@ -42141,10 +43371,10 @@ var MATH_MORE = [
42141
43371
  1,
42142
43372
  (x) => x === 0 ? fail(ERR.DIV0) : 1 / Math.sinh(x)
42143
43373
  ),
42144
- numeric("SEC", C22, "SEC(number)", "The secant of an angle.", 1, 1, (x) => 1 / Math.cos(x)),
42145
- numeric("SECH", C22, "SECH(number)", "The hyperbolic secant.", 1, 1, (x) => 1 / Math.cosh(x)),
42146
- numeric("ACOT", C22, "ACOT(number)", "The arccotangent.", 1, 1, (x) => Math.PI / 2 - Math.atan(x)),
42147
- numeric(
43374
+ numeric2("SEC", C22, "SEC(number)", "The secant of an angle.", 1, 1, (x) => 1 / Math.cos(x)),
43375
+ numeric2("SECH", C22, "SECH(number)", "The hyperbolic secant.", 1, 1, (x) => 1 / Math.cosh(x)),
43376
+ numeric2("ACOT", C22, "ACOT(number)", "The arccotangent.", 1, 1, (x) => Math.PI / 2 - Math.atan(x)),
43377
+ numeric2(
42148
43378
  "ACOTH",
42149
43379
  C22,
42150
43380
  "ACOTH(number)",
@@ -42153,7 +43383,7 @@ var MATH_MORE = [
42153
43383
  1,
42154
43384
  (x) => domain(Math.abs(x) > 1, 0.5 * Math.log((x + 1) / (x - 1)))
42155
43385
  ),
42156
- numeric(
43386
+ numeric2(
42157
43387
  "DEGREES",
42158
43388
  C22,
42159
43389
  "DEGREES(angle)",
@@ -42162,7 +43392,7 @@ var MATH_MORE = [
42162
43392
  1,
42163
43393
  (x) => x * 180 / Math.PI
42164
43394
  ),
42165
- numeric(
43395
+ numeric2(
42166
43396
  "RADIANS",
42167
43397
  C22,
42168
43398
  "RADIANS(angle)",
@@ -42243,14 +43473,14 @@ function integers(args, ctx) {
42243
43473
  });
42244
43474
  }
42245
43475
  var COMBINATORIC_FUNCTIONS = [
42246
- numeric("FACT", C23, "FACT(number)", "The factorial of a number.", 1, 1, fact),
42247
- numeric("FACTDOUBLE", C23, "FACTDOUBLE(number)", "The double factorial of a number.", 1, 1, (n) => {
43476
+ numeric2("FACT", C23, "FACT(number)", "The factorial of a number.", 1, 1, fact),
43477
+ numeric2("FACTDOUBLE", C23, "FACTDOUBLE(number)", "The double factorial of a number.", 1, 1, (n) => {
42248
43478
  if (n < -1) fail(ERR.NUM);
42249
43479
  let out = 1;
42250
43480
  for (let i2 = Math.trunc(n); i2 > 1; i2 -= 2) out *= i2;
42251
43481
  return out;
42252
43482
  }),
42253
- numeric(
43483
+ numeric2(
42254
43484
  "COMBIN",
42255
43485
  C23,
42256
43486
  "COMBIN(number, number_chosen)",
@@ -42259,7 +43489,7 @@ var COMBINATORIC_FUNCTIONS = [
42259
43489
  2,
42260
43490
  (n, k) => combin(n, k ?? 0)
42261
43491
  ),
42262
- numeric(
43492
+ numeric2(
42263
43493
  "COMBINA",
42264
43494
  C23,
42265
43495
  "COMBINA(number, number_chosen)",
@@ -42364,8 +43594,8 @@ var quotientMultiple = (x, sig, op2) => {
42364
43594
  var MATH_FUNCTIONS = [
42365
43595
  ...MATH_MORE,
42366
43596
  ...SUM_FUNCTIONS,
42367
- numeric("ABS", C24, "ABS(number)", "The absolute value of a number.", 1, 1, Math.abs),
42368
- numeric(
43597
+ numeric2("ABS", C24, "ABS(number)", "The absolute value of a number.", 1, 1, Math.abs),
43598
+ numeric2(
42369
43599
  "SIGN",
42370
43600
  C24,
42371
43601
  "SIGN(number)",
@@ -42374,7 +43604,7 @@ var MATH_FUNCTIONS = [
42374
43604
  1,
42375
43605
  (x) => Math.sign(x)
42376
43606
  ),
42377
- numeric(
43607
+ numeric2(
42378
43608
  "INT",
42379
43609
  C24,
42380
43610
  "INT(number)",
@@ -42383,7 +43613,7 @@ var MATH_FUNCTIONS = [
42383
43613
  1,
42384
43614
  Math.floor
42385
43615
  ),
42386
- numeric(
43616
+ numeric2(
42387
43617
  "TRUNC",
42388
43618
  C24,
42389
43619
  "TRUNC(number, [num_digits])",
@@ -42392,7 +43622,7 @@ var MATH_FUNCTIONS = [
42392
43622
  2,
42393
43623
  (x, d) => roundTo(x, d ?? 0, "down")
42394
43624
  ),
42395
- numeric(
43625
+ numeric2(
42396
43626
  "ROUND",
42397
43627
  C24,
42398
43628
  "ROUND(number, num_digits)",
@@ -42401,7 +43631,7 @@ var MATH_FUNCTIONS = [
42401
43631
  2,
42402
43632
  (x, d) => roundTo(x, d ?? 0, "half")
42403
43633
  ),
42404
- numeric(
43634
+ numeric2(
42405
43635
  "ROUNDUP",
42406
43636
  C24,
42407
43637
  "ROUNDUP(number, num_digits)",
@@ -42410,7 +43640,7 @@ var MATH_FUNCTIONS = [
42410
43640
  2,
42411
43641
  (x, d) => roundTo(x, d ?? 0, "up")
42412
43642
  ),
42413
- numeric(
43643
+ numeric2(
42414
43644
  "ROUNDDOWN",
42415
43645
  C24,
42416
43646
  "ROUNDDOWN(number, num_digits)",
@@ -42419,7 +43649,7 @@ var MATH_FUNCTIONS = [
42419
43649
  2,
42420
43650
  (x, d) => roundTo(x, d ?? 0, "down")
42421
43651
  ),
42422
- numeric(
43652
+ numeric2(
42423
43653
  "MROUND",
42424
43654
  C24,
42425
43655
  "MROUND(number, multiple)",
@@ -42428,7 +43658,7 @@ var MATH_FUNCTIONS = [
42428
43658
  2,
42429
43659
  (x, m) => mround(x, m ?? 0)
42430
43660
  ),
42431
- numeric(
43661
+ numeric2(
42432
43662
  "CEILING",
42433
43663
  C24,
42434
43664
  "CEILING(number, significance)",
@@ -42440,7 +43670,7 @@ var MATH_FUNCTIONS = [
42440
43670
  return quotientMultiple(x, s ?? 0, Math.ceil);
42441
43671
  }
42442
43672
  ),
42443
- numeric(
43673
+ numeric2(
42444
43674
  "FLOOR",
42445
43675
  C24,
42446
43676
  "FLOOR(number, significance)",
@@ -42453,7 +43683,7 @@ var MATH_FUNCTIONS = [
42453
43683
  return quotientMultiple(x, s ?? 1, Math.floor);
42454
43684
  }
42455
43685
  ),
42456
- numeric(
43686
+ numeric2(
42457
43687
  "CEILING.MATH",
42458
43688
  C24,
42459
43689
  "CEILING.MATH(number, [significance], [mode])",
@@ -42466,7 +43696,7 @@ var MATH_FUNCTIONS = [
42466
43696
  return quotientMultiple(x, sig, Math.ceil);
42467
43697
  }
42468
43698
  ),
42469
- numeric(
43699
+ numeric2(
42470
43700
  "FLOOR.MATH",
42471
43701
  C24,
42472
43702
  "FLOOR.MATH(number, [significance], [mode])",
@@ -42479,7 +43709,7 @@ var MATH_FUNCTIONS = [
42479
43709
  return quotientMultiple(x, sig, Math.floor);
42480
43710
  }
42481
43711
  ),
42482
- numeric(
43712
+ numeric2(
42483
43713
  "CEILING.PRECISE",
42484
43714
  C24,
42485
43715
  "CEILING.PRECISE(number, [significance])",
@@ -42488,7 +43718,7 @@ var MATH_FUNCTIONS = [
42488
43718
  2,
42489
43719
  (x, s) => quotientMultiple(x, Math.abs(s ?? 1), Math.ceil)
42490
43720
  ),
42491
- numeric(
43721
+ numeric2(
42492
43722
  "ISO.CEILING",
42493
43723
  C24,
42494
43724
  "ISO.CEILING(number, [significance])",
@@ -42497,7 +43727,7 @@ var MATH_FUNCTIONS = [
42497
43727
  2,
42498
43728
  (x, s) => quotientMultiple(x, Math.abs(s ?? 1), Math.ceil)
42499
43729
  ),
42500
- numeric(
43730
+ numeric2(
42501
43731
  "FLOOR.PRECISE",
42502
43732
  C24,
42503
43733
  "FLOOR.PRECISE(number, [significance])",
@@ -42506,7 +43736,7 @@ var MATH_FUNCTIONS = [
42506
43736
  2,
42507
43737
  (x, s) => quotientMultiple(x, Math.abs(s ?? 1), Math.floor)
42508
43738
  ),
42509
- numeric(
43739
+ numeric2(
42510
43740
  "EVEN",
42511
43741
  C24,
42512
43742
  "EVEN(number)",
@@ -42515,7 +43745,7 @@ var MATH_FUNCTIONS = [
42515
43745
  1,
42516
43746
  (x) => Math.sign(x) * Math.ceil(round15(Math.abs(x)) / 2) * 2
42517
43747
  ),
42518
- numeric(
43748
+ numeric2(
42519
43749
  "ODD",
42520
43750
  C24,
42521
43751
  "ODD(number)",
@@ -42527,7 +43757,7 @@ var MATH_FUNCTIONS = [
42527
43757
  return (x < 0 ? -1 : 1) * (n % 2 === 0 ? n + 1 : n);
42528
43758
  }
42529
43759
  ),
42530
- numeric(
43760
+ numeric2(
42531
43761
  "MOD",
42532
43762
  C24,
42533
43763
  "MOD(number, divisor)",
@@ -42536,7 +43766,7 @@ var MATH_FUNCTIONS = [
42536
43766
  2,
42537
43767
  (n, d) => excelMod(n, d ?? 0)
42538
43768
  ),
42539
- numeric(
43769
+ numeric2(
42540
43770
  "QUOTIENT",
42541
43771
  C24,
42542
43772
  "QUOTIENT(numerator, denominator)",
@@ -42548,7 +43778,7 @@ var MATH_FUNCTIONS = [
42548
43778
  return Math.trunc(n / (d ?? 1));
42549
43779
  }
42550
43780
  ),
42551
- numeric(
43781
+ numeric2(
42552
43782
  "SQRT",
42553
43783
  C24,
42554
43784
  "SQRT(number)",
@@ -42557,7 +43787,7 @@ var MATH_FUNCTIONS = [
42557
43787
  1,
42558
43788
  (x) => domain(x >= 0, Math.sqrt(x))
42559
43789
  ),
42560
- numeric(
43790
+ numeric2(
42561
43791
  "SQRTPI",
42562
43792
  C24,
42563
43793
  "SQRTPI(number)",
@@ -42566,7 +43796,7 @@ var MATH_FUNCTIONS = [
42566
43796
  1,
42567
43797
  (x) => domain(x >= 0, Math.sqrt(x * Math.PI))
42568
43798
  ),
42569
- numeric(
43799
+ numeric2(
42570
43800
  "POWER",
42571
43801
  C24,
42572
43802
  "POWER(number, power)",
@@ -42575,9 +43805,9 @@ var MATH_FUNCTIONS = [
42575
43805
  2,
42576
43806
  (b, e) => power(b, e ?? 1)
42577
43807
  ),
42578
- numeric("EXP", C24, "EXP(number)", "e raised to a power.", 1, 1, Math.exp),
42579
- numeric("LN", C24, "LN(number)", "The natural logarithm.", 1, 1, (x) => domain(x > 0, Math.log(x))),
42580
- numeric(
43808
+ numeric2("EXP", C24, "EXP(number)", "e raised to a power.", 1, 1, Math.exp),
43809
+ numeric2("LN", C24, "LN(number)", "The natural logarithm.", 1, 1, (x) => domain(x > 0, Math.log(x))),
43810
+ numeric2(
42581
43811
  "LOG10",
42582
43812
  C24,
42583
43813
  "LOG10(number)",
@@ -42586,7 +43816,7 @@ var MATH_FUNCTIONS = [
42586
43816
  1,
42587
43817
  (x) => domain(x > 0, Math.log10(x))
42588
43818
  ),
42589
- numeric(
43819
+ numeric2(
42590
43820
  "LOG",
42591
43821
  C24,
42592
43822
  "LOG(number, [base])",
@@ -42600,7 +43830,7 @@ var MATH_FUNCTIONS = [
42600
43830
  return base === 10 ? Math.log10(x) : Math.log(x) / Math.log(base);
42601
43831
  }
42602
43832
  ),
42603
- numeric("PI", C24, "PI()", "The value of pi.", 0, 0, () => Math.PI),
43833
+ numeric2("PI", C24, "PI()", "The value of pi.", 0, 0, () => Math.PI),
42604
43834
  ...COMBINATORIC_FUNCTIONS
42605
43835
  ];
42606
43836
 
@@ -44043,7 +45273,7 @@ var negbinomPmf = (f6, s, p) => {
44043
45273
  return combin(ff + ss - 1, ss - 1) * Math.pow(p, ss) * Math.pow(1 - p, ff);
44044
45274
  };
44045
45275
  var DISTRIBUTION_F = [
44046
- numeric(
45276
+ numeric2(
44047
45277
  "F.DIST",
44048
45278
  C28,
44049
45279
  "F.DIST(x, deg_freedom1, deg_freedom2, cumulative)",
@@ -44059,7 +45289,7 @@ var DISTRIBUTION_F = [
44059
45289
  }
44060
45290
  ),
44061
45291
  ...["F.DIST.RT", "FDIST"].map(
44062
- (name) => numeric(
45292
+ (name) => numeric2(
44063
45293
  name,
44064
45294
  C28,
44065
45295
  `${name}(x, deg_freedom1, deg_freedom2)`,
@@ -44073,7 +45303,7 @@ var DISTRIBUTION_F = [
44073
45303
  }
44074
45304
  )
44075
45305
  ),
44076
- numeric(
45306
+ numeric2(
44077
45307
  "F.INV",
44078
45308
  C28,
44079
45309
  "F.INV(probability, deg_freedom1, deg_freedom2)",
@@ -44087,7 +45317,7 @@ var DISTRIBUTION_F = [
44087
45317
  }
44088
45318
  ),
44089
45319
  ...["F.INV.RT", "FINV"].map(
44090
- (name) => numeric(
45320
+ (name) => numeric2(
44091
45321
  name,
44092
45322
  C28,
44093
45323
  `${name}(probability, deg_freedom1, deg_freedom2)`,
@@ -44102,7 +45332,7 @@ var DISTRIBUTION_F = [
44102
45332
  )
44103
45333
  ),
44104
45334
  ...["BETA.INV", "BETAINV"].map(
44105
- (name) => numeric(
45335
+ (name) => numeric2(
44106
45336
  name,
44107
45337
  C28,
44108
45338
  `${name}(probability, alpha, beta, [A], [B])`,
@@ -44113,7 +45343,7 @@ var DISTRIBUTION_F = [
44113
45343
  [0, 0, 0, 0, 1]
44114
45344
  )
44115
45345
  ),
44116
- numeric(
45346
+ numeric2(
44117
45347
  "BETADIST",
44118
45348
  C28,
44119
45349
  "BETADIST(x, alpha, beta, [A], [B])",
@@ -44127,7 +45357,7 @@ var DISTRIBUTION_F = [
44127
45357
  [0, 0, 0, 0, 1]
44128
45358
  ),
44129
45359
  ...["GAMMA.INV", "GAMMAINV"].map(
44130
- (name) => numeric(
45360
+ (name) => numeric2(
44131
45361
  name,
44132
45362
  C28,
44133
45363
  `${name}(probability, alpha, beta)`,
@@ -44137,7 +45367,7 @@ var DISTRIBUTION_F = [
44137
45367
  (p, a2, b) => gammaInverse(p, a2 ?? 1, b ?? 1)
44138
45368
  )
44139
45369
  ),
44140
- numeric(
45370
+ numeric2(
44141
45371
  "GAMMADIST",
44142
45372
  C28,
44143
45373
  "GAMMADIST(x, alpha, beta, cumulative)",
@@ -44152,7 +45382,7 @@ var DISTRIBUTION_F = [
44152
45382
  return c2 ? gammaP(al, x / be) : Math.exp((al - 1) * Math.log(x) - x / be - gammaLn(al) - al * Math.log(be));
44153
45383
  }
44154
45384
  ),
44155
- numeric(
45385
+ numeric2(
44156
45386
  "LOGINV",
44157
45387
  C28,
44158
45388
  "LOGINV(probability, mean, standard_dev)",
@@ -44165,7 +45395,7 @@ var DISTRIBUTION_F = [
44165
45395
  return Math.exp((m ?? 0) + (s ?? 1) * normInv(p));
44166
45396
  }
44167
45397
  ),
44168
- numeric(
45398
+ numeric2(
44169
45399
  "LOGNORMDIST",
44170
45400
  C28,
44171
45401
  "LOGNORMDIST(x, mean, standard_dev)",
@@ -44178,7 +45408,7 @@ var DISTRIBUTION_F = [
44178
45408
  }
44179
45409
  ),
44180
45410
  ...["BINOM.INV", "CRITBINOM"].map(
44181
- (name) => numeric(
45411
+ (name) => numeric2(
44182
45412
  name,
44183
45413
  C28,
44184
45414
  `${name}(trials, probability_s, alpha)`,
@@ -44188,7 +45418,7 @@ var DISTRIBUTION_F = [
44188
45418
  (n, p, alpha) => binomInverse(n, p ?? 0, alpha ?? 0)
44189
45419
  )
44190
45420
  ),
44191
- numeric(
45421
+ numeric2(
44192
45422
  "BINOM.DIST.RANGE",
44193
45423
  C28,
44194
45424
  "BINOM.DIST.RANGE(trials, probability_s, number_s, [number_s2])",
@@ -44206,7 +45436,7 @@ var DISTRIBUTION_F = [
44206
45436
  return Math.min(1, total2);
44207
45437
  }
44208
45438
  ),
44209
- numeric(
45439
+ numeric2(
44210
45440
  "HYPGEOMDIST",
44211
45441
  C28,
44212
45442
  "HYPGEOMDIST(sample_s, number_sample, population_s, number_pop)",
@@ -44215,7 +45445,7 @@ var DISTRIBUTION_F = [
44215
45445
  4,
44216
45446
  hypgeomPmf
44217
45447
  ),
44218
- numeric(
45448
+ numeric2(
44219
45449
  "NEGBINOMDIST",
44220
45450
  C28,
44221
45451
  "NEGBINOMDIST(number_f, number_s, probability_s)",
@@ -44345,7 +45575,7 @@ var STATISTICAL_SHAPE = [
44345
45575
  },
44346
45576
  ["any"]
44347
45577
  ),
44348
- numeric(
45578
+ numeric2(
44349
45579
  "STANDARDIZE",
44350
45580
  C29,
44351
45581
  "STANDARDIZE(x, mean, standard_dev)",
@@ -44383,7 +45613,7 @@ var STATISTICAL_SHAPE = [
44383
45613
  (args, ctx) => frequency(collectNumbers(ctx, [args[0] ?? null]), collectNumbers(ctx, [args[1] ?? null])),
44384
45614
  ["any"]
44385
45615
  ),
44386
- numeric(
45616
+ numeric2(
44387
45617
  "PERMUT",
44388
45618
  C29,
44389
45619
  "PERMUT(number, number_chosen)",
@@ -44399,7 +45629,7 @@ var STATISTICAL_SHAPE = [
44399
45629
  return out;
44400
45630
  }
44401
45631
  ),
44402
- numeric(
45632
+ numeric2(
44403
45633
  "PERMUTATIONA",
44404
45634
  C29,
44405
45635
  "PERMUTATIONA(number, number_chosen)",
@@ -44411,11 +45641,11 @@ var STATISTICAL_SHAPE = [
44411
45641
  return Math.pow(Math.trunc(n), Math.trunc(k ?? 0));
44412
45642
  }
44413
45643
  ),
44414
- numeric("FISHER", C29, "FISHER(x)", "The Fisher transformation.", 1, 1, (x) => {
45644
+ numeric2("FISHER", C29, "FISHER(x)", "The Fisher transformation.", 1, 1, (x) => {
44415
45645
  if (x <= -1 || x >= 1) fail(ERR.NUM);
44416
45646
  return 0.5 * Math.log((1 + x) / (1 - x));
44417
45647
  }),
44418
- numeric(
45648
+ numeric2(
44419
45649
  "FISHERINV",
44420
45650
  C29,
44421
45651
  "FISHERINV(y)",
@@ -44424,11 +45654,11 @@ var STATISTICAL_SHAPE = [
44424
45654
  1,
44425
45655
  (y) => Math.tanh(y)
44426
45656
  ),
44427
- numeric("GAMMA", C29, "GAMMA(number)", "The gamma function value.", 1, 1, (x) => {
45657
+ numeric2("GAMMA", C29, "GAMMA(number)", "The gamma function value.", 1, 1, (x) => {
44428
45658
  if (x <= 0 && Number.isInteger(x)) fail(ERR.NUM);
44429
45659
  return gamma(x);
44430
45660
  }),
44431
- numeric(
45661
+ numeric2(
44432
45662
  "GAMMALN",
44433
45663
  C29,
44434
45664
  "GAMMALN(x)",
@@ -44437,7 +45667,7 @@ var STATISTICAL_SHAPE = [
44437
45667
  1,
44438
45668
  gammaLn
44439
45669
  ),
44440
- numeric(
45670
+ numeric2(
44441
45671
  "GAMMALN.PRECISE",
44442
45672
  C29,
44443
45673
  "GAMMALN.PRECISE(x)",
@@ -45145,7 +46375,7 @@ var STATISTICAL_FUNCTIONS = [
45145
46375
  const x = num4(args[0]);
45146
46376
  const values2 = collectNumbers(ctx, [args[1] ?? null]);
45147
46377
  const ascending = args.length > 2 && num4(args[2]) !== 0;
45148
- return rank2(values2, x, ascending, name === "RANK.AVG");
46378
+ return rank3(values2, x, ascending, name === "RANK.AVG");
45149
46379
  },
45150
46380
  ["value", "any", "value"]
45151
46381
  )
@@ -45155,7 +46385,7 @@ var STATISTICAL_FUNCTIONS = [
45155
46385
  // xlsx/formula/functions/distributions-more.ts
45156
46386
  var C35 = "Statistical";
45157
46387
  var DISTRIBUTION_MORE = [
45158
- numeric(
46388
+ numeric2(
45159
46389
  "T.DIST",
45160
46390
  C35,
45161
46391
  "T.DIST(x, deg_freedom, cumulative)",
@@ -45167,7 +46397,7 @@ var DISTRIBUTION_MORE = [
45167
46397
  return c2 ? tCdf(x, Math.trunc(df ?? 1)) : tPdf(x, Math.trunc(df ?? 1));
45168
46398
  }
45169
46399
  ),
45170
- numeric(
46400
+ numeric2(
45171
46401
  "T.DIST.RT",
45172
46402
  C35,
45173
46403
  "T.DIST.RT(x, deg_freedom)",
@@ -45179,7 +46409,7 @@ var DISTRIBUTION_MORE = [
45179
46409
  return 1 - tCdf(x, Math.trunc(df ?? 1));
45180
46410
  }
45181
46411
  ),
45182
- numeric(
46412
+ numeric2(
45183
46413
  "T.DIST.2T",
45184
46414
  C35,
45185
46415
  "T.DIST.2T(x, deg_freedom)",
@@ -45191,7 +46421,7 @@ var DISTRIBUTION_MORE = [
45191
46421
  return 2 * (1 - tCdf(x, Math.trunc(df ?? 1)));
45192
46422
  }
45193
46423
  ),
45194
- numeric(
46424
+ numeric2(
45195
46425
  "TDIST",
45196
46426
  C35,
45197
46427
  "TDIST(x, deg_freedom, tails)",
@@ -45203,7 +46433,7 @@ var DISTRIBUTION_MORE = [
45203
46433
  return (tails ?? 1) * (1 - tCdf(x, Math.trunc(df ?? 1)));
45204
46434
  }
45205
46435
  ),
45206
- numeric(
46436
+ numeric2(
45207
46437
  "T.INV",
45208
46438
  C35,
45209
46439
  "T.INV(probability, deg_freedom)",
@@ -45218,7 +46448,7 @@ var DISTRIBUTION_MORE = [
45218
46448
  }
45219
46449
  ),
45220
46450
  ...["T.INV.2T", "TINV"].map(
45221
- (name) => numeric(
46451
+ (name) => numeric2(
45222
46452
  name,
45223
46453
  C35,
45224
46454
  `${name}(probability, deg_freedom)`,
@@ -45231,7 +46461,7 @@ var DISTRIBUTION_MORE = [
45231
46461
  }
45232
46462
  )
45233
46463
  ),
45234
- numeric(
46464
+ numeric2(
45235
46465
  "CHISQ.DIST",
45236
46466
  C35,
45237
46467
  "CHISQ.DIST(x, deg_freedom, cumulative)",
@@ -45245,7 +46475,7 @@ var DISTRIBUTION_MORE = [
45245
46475
  }
45246
46476
  ),
45247
46477
  ...["CHISQ.DIST.RT", "CHIDIST"].map(
45248
- (name) => numeric(
46478
+ (name) => numeric2(
45249
46479
  name,
45250
46480
  C35,
45251
46481
  `${name}(x, deg_freedom)`,
@@ -45258,7 +46488,7 @@ var DISTRIBUTION_MORE = [
45258
46488
  }
45259
46489
  )
45260
46490
  ),
45261
- numeric(
46491
+ numeric2(
45262
46492
  "CHISQ.INV",
45263
46493
  C35,
45264
46494
  "CHISQ.INV(probability, deg_freedom)",
@@ -45271,7 +46501,7 @@ var DISTRIBUTION_MORE = [
45271
46501
  }
45272
46502
  ),
45273
46503
  ...["CHISQ.INV.RT", "CHIINV"].map(
45274
- (name) => numeric(
46504
+ (name) => numeric2(
45275
46505
  name,
45276
46506
  C35,
45277
46507
  `${name}(probability, deg_freedom)`,
@@ -45284,7 +46514,7 @@ var DISTRIBUTION_MORE = [
45284
46514
  }
45285
46515
  )
45286
46516
  ),
45287
- numeric(
46517
+ numeric2(
45288
46518
  "BETA.DIST",
45289
46519
  C35,
45290
46520
  "BETA.DIST(x, alpha, beta, cumulative, [A], [B])",
@@ -45304,7 +46534,7 @@ var DISTRIBUTION_MORE = [
45304
46534
  return Math.exp((al - 1) * Math.log(t) + (be - 1) * Math.log(1 - t) - lnB) / (B - A2);
45305
46535
  }
45306
46536
  ),
45307
- numeric(
46537
+ numeric2(
45308
46538
  "NEGBINOM.DIST",
45309
46539
  C35,
45310
46540
  "NEGBINOM.DIST(number_f, number_s, probability_s, cumulative)",
@@ -45323,7 +46553,7 @@ var DISTRIBUTION_MORE = [
45323
46553
  return total2;
45324
46554
  }
45325
46555
  ),
45326
- numeric(
46556
+ numeric2(
45327
46557
  "HYPGEOM.DIST",
45328
46558
  C35,
45329
46559
  "HYPGEOM.DIST(sample_s, number_sample, population_s, number_pop, cumulative)",
@@ -45350,7 +46580,7 @@ var C36 = "Statistical";
45350
46580
  var DISTRIBUTION_FUNCTIONS = [
45351
46581
  ...DISTRIBUTION_MORE,
45352
46582
  ...DISTRIBUTION_F,
45353
- numeric(
46583
+ numeric2(
45354
46584
  "NORM.DIST",
45355
46585
  C36,
45356
46586
  "NORM.DIST(x, mean, standard_dev, cumulative)",
@@ -45359,7 +46589,7 @@ var DISTRIBUTION_FUNCTIONS = [
45359
46589
  4,
45360
46590
  (x, m, s, c2) => normDist(x, m ?? 0, s ?? 1, c2 ?? 0)
45361
46591
  ),
45362
- numeric(
46592
+ numeric2(
45363
46593
  "NORMDIST",
45364
46594
  C36,
45365
46595
  "NORMDIST(x, mean, standard_dev, cumulative)",
@@ -45368,7 +46598,7 @@ var DISTRIBUTION_FUNCTIONS = [
45368
46598
  4,
45369
46599
  (x, m, s, c2) => normDist(x, m ?? 0, s ?? 1, c2 ?? 0)
45370
46600
  ),
45371
- numeric(
46601
+ numeric2(
45372
46602
  "NORM.S.DIST",
45373
46603
  C36,
45374
46604
  "NORM.S.DIST(z, cumulative)",
@@ -45377,7 +46607,7 @@ var DISTRIBUTION_FUNCTIONS = [
45377
46607
  2,
45378
46608
  (z, c2) => c2 ? normCdf(z) : normPdf(z)
45379
46609
  ),
45380
- numeric(
46610
+ numeric2(
45381
46611
  "NORMSDIST",
45382
46612
  C36,
45383
46613
  "NORMSDIST(z)",
@@ -45386,7 +46616,7 @@ var DISTRIBUTION_FUNCTIONS = [
45386
46616
  1,
45387
46617
  normCdf
45388
46618
  ),
45389
- numeric(
46619
+ numeric2(
45390
46620
  "NORM.INV",
45391
46621
  C36,
45392
46622
  "NORM.INV(probability, mean, standard_dev)",
@@ -45398,7 +46628,7 @@ var DISTRIBUTION_FUNCTIONS = [
45398
46628
  return (m ?? 0) + (s ?? 1) * normInv(p);
45399
46629
  }
45400
46630
  ),
45401
- numeric(
46631
+ numeric2(
45402
46632
  "NORMINV",
45403
46633
  C36,
45404
46634
  "NORMINV(probability, mean, standard_dev)",
@@ -45410,7 +46640,7 @@ var DISTRIBUTION_FUNCTIONS = [
45410
46640
  return (m ?? 0) + (s ?? 1) * normInv(p);
45411
46641
  }
45412
46642
  ),
45413
- numeric(
46643
+ numeric2(
45414
46644
  "NORM.S.INV",
45415
46645
  C36,
45416
46646
  "NORM.S.INV(probability)",
@@ -45419,7 +46649,7 @@ var DISTRIBUTION_FUNCTIONS = [
45419
46649
  1,
45420
46650
  normInv
45421
46651
  ),
45422
- numeric(
46652
+ numeric2(
45423
46653
  "NORMSINV",
45424
46654
  C36,
45425
46655
  "NORMSINV(probability)",
@@ -45428,8 +46658,8 @@ var DISTRIBUTION_FUNCTIONS = [
45428
46658
  1,
45429
46659
  normInv
45430
46660
  ),
45431
- numeric("PHI", C36, "PHI(x)", "The standard normal density.", 1, 1, normPdf),
45432
- numeric(
46661
+ numeric2("PHI", C36, "PHI(x)", "The standard normal density.", 1, 1, normPdf),
46662
+ numeric2(
45433
46663
  "GAUSS",
45434
46664
  C36,
45435
46665
  "GAUSS(z)",
@@ -45438,7 +46668,7 @@ var DISTRIBUTION_FUNCTIONS = [
45438
46668
  1,
45439
46669
  (z) => normCdf(z) - 0.5
45440
46670
  ),
45441
- numeric(
46671
+ numeric2(
45442
46672
  "ERF",
45443
46673
  "Engineering",
45444
46674
  "ERF(lower_limit, [upper_limit])",
@@ -45447,8 +46677,8 @@ var DISTRIBUTION_FUNCTIONS = [
45447
46677
  2,
45448
46678
  (a2, b) => b === void 0 ? erf(a2) : erf(b) - erf(a2)
45449
46679
  ),
45450
- numeric("ERF.PRECISE", "Engineering", "ERF.PRECISE(x)", "The error function.", 1, 1, erf),
45451
- numeric(
46680
+ numeric2("ERF.PRECISE", "Engineering", "ERF.PRECISE(x)", "The error function.", 1, 1, erf),
46681
+ numeric2(
45452
46682
  "ERFC",
45453
46683
  "Engineering",
45454
46684
  "ERFC(x)",
@@ -45457,7 +46687,7 @@ var DISTRIBUTION_FUNCTIONS = [
45457
46687
  1,
45458
46688
  (x) => 1 - erf(x)
45459
46689
  ),
45460
- numeric(
46690
+ numeric2(
45461
46691
  "ERFC.PRECISE",
45462
46692
  "Engineering",
45463
46693
  "ERFC.PRECISE(x)",
@@ -45467,7 +46697,7 @@ var DISTRIBUTION_FUNCTIONS = [
45467
46697
  (x) => 1 - erf(x)
45468
46698
  ),
45469
46699
  ...["CONFIDENCE", "CONFIDENCE.NORM"].map(
45470
- (name) => numeric(
46700
+ (name) => numeric2(
45471
46701
  name,
45472
46702
  C36,
45473
46703
  `${name}(alpha, standard_dev, size)`,
@@ -45482,7 +46712,7 @@ var DISTRIBUTION_FUNCTIONS = [
45482
46712
  }
45483
46713
  )
45484
46714
  ),
45485
- numeric(
46715
+ numeric2(
45486
46716
  "CONFIDENCE.T",
45487
46717
  C36,
45488
46718
  "CONFIDENCE.T(alpha, standard_dev, size)",
@@ -45498,7 +46728,7 @@ var DISTRIBUTION_FUNCTIONS = [
45498
46728
  }
45499
46729
  ),
45500
46730
  ...["BINOM.DIST", "BINOMDIST"].map(
45501
- (name) => numeric(
46731
+ (name) => numeric2(
45502
46732
  name,
45503
46733
  C36,
45504
46734
  `${name}(number_s, trials, probability_s, cumulative)`,
@@ -45509,7 +46739,7 @@ var DISTRIBUTION_FUNCTIONS = [
45509
46739
  )
45510
46740
  ),
45511
46741
  ...["POISSON.DIST", "POISSON"].map(
45512
- (name) => numeric(
46742
+ (name) => numeric2(
45513
46743
  name,
45514
46744
  C36,
45515
46745
  `${name}(x, mean, cumulative)`,
@@ -45520,7 +46750,7 @@ var DISTRIBUTION_FUNCTIONS = [
45520
46750
  )
45521
46751
  ),
45522
46752
  ...["EXPON.DIST", "EXPONDIST"].map(
45523
- (name) => numeric(
46753
+ (name) => numeric2(
45524
46754
  name,
45525
46755
  C36,
45526
46756
  `${name}(x, lambda, cumulative)`,
@@ -45534,7 +46764,7 @@ var DISTRIBUTION_FUNCTIONS = [
45534
46764
  }
45535
46765
  )
45536
46766
  ),
45537
- numeric(
46767
+ numeric2(
45538
46768
  "LOGNORM.DIST",
45539
46769
  C36,
45540
46770
  "LOGNORM.DIST(x, mean, standard_dev, cumulative)",
@@ -45547,7 +46777,7 @@ var DISTRIBUTION_FUNCTIONS = [
45547
46777
  return c2 ? normCdf(z) : normPdf(z) / (x * (s ?? 1));
45548
46778
  }
45549
46779
  ),
45550
- numeric(
46780
+ numeric2(
45551
46781
  "LOGNORM.INV",
45552
46782
  C36,
45553
46783
  "LOGNORM.INV(probability, mean, standard_dev)",
@@ -45560,7 +46790,7 @@ var DISTRIBUTION_FUNCTIONS = [
45560
46790
  }
45561
46791
  ),
45562
46792
  ...["WEIBULL.DIST", "WEIBULL"].map(
45563
- (name) => numeric(
46793
+ (name) => numeric2(
45564
46794
  name,
45565
46795
  C36,
45566
46796
  `${name}(x, alpha, beta, cumulative)`,
@@ -45576,7 +46806,7 @@ var DISTRIBUTION_FUNCTIONS = [
45576
46806
  }
45577
46807
  )
45578
46808
  ),
45579
- numeric(
46809
+ numeric2(
45580
46810
  "GAMMA.DIST",
45581
46811
  C36,
45582
46812
  "GAMMA.DIST(x, alpha, beta, cumulative)",
@@ -45794,7 +47024,7 @@ function find2(args, insensitive) {
45794
47024
  const at2 = haystack.indexOf(needle, from);
45795
47025
  return at2 < 0 ? fail(ERR.VALUE) : at2 + 1;
45796
47026
  }
45797
- const at = wildcardRegex(needle).search(haystack, from);
47027
+ const at = wildcardRegex2(needle).search(haystack, from);
45798
47028
  return at < 0 ? fail(ERR.VALUE) : at + 1;
45799
47029
  }
45800
47030
  function joinValues(ctx, args) {
@@ -46979,7 +48209,7 @@ function patchChartFormulas2(xml, edits) {
46979
48209
  if (open && gt === -1) break;
46980
48210
  if (open) {
46981
48211
  const prefix = open[1] ?? "";
46982
- const attrs2 = xml.slice(FORMULA_OPEN.lastIndex, gt);
48212
+ const attrs3 = xml.slice(FORMULA_OPEN.lastIndex, gt);
46983
48213
  const lt = xml.indexOf("<", gt + 1);
46984
48214
  const close2 = [`</${prefix}f>`, "</f>"].find((c2) => lt !== -1 && xml.startsWith(c2, lt));
46985
48215
  if (lt !== -1 && close2 !== void 0) {
@@ -46987,7 +48217,7 @@ function patchChartFormulas2(xml, edits) {
46987
48217
  const next = patchCarriedFormula(formula2, "", edits);
46988
48218
  const end = lt + close2.length;
46989
48219
  if (next !== formula2) {
46990
- out += `${xml.slice(copied, at)}<${prefix}f${attrs2}>${escapeXmlText(next)}</${prefix}f>`;
48220
+ out += `${xml.slice(copied, at)}<${prefix}f${attrs3}>${escapeXmlText(next)}</${prefix}f>`;
46991
48221
  copied = end;
46992
48222
  }
46993
48223
  at = xml.indexOf("<", end);
@@ -47011,11 +48241,11 @@ function findWorksheetSource(xml) {
47011
48241
  const gt = nextGt(after);
47012
48242
  if (gt === -1) return void 0;
47013
48243
  const selfClose = xml[gt - 1] === "/" && gt - 1 > after;
47014
- const attrs2 = xml.slice(after, selfClose ? gt - 1 : gt);
48244
+ const attrs3 = xml.slice(after, selfClose ? gt - 1 : gt);
47015
48245
  return [
47016
48246
  xml.slice(start - 1, gt + 1),
47017
48247
  `${prefix}worksheetSource`,
47018
- attrs2,
48248
+ attrs3,
47019
48249
  selfClose ? "/" : ""
47020
48250
  ];
47021
48251
  }
@@ -47028,10 +48258,10 @@ var attrPattern = (name) => new RegExp(`(\\s${name}\\s*=\\s*)(["'])(.*?)\\2`);
47028
48258
  function patchWorksheetSource(xml, edits) {
47029
48259
  const match2 = findWorksheetSource(xml);
47030
48260
  if (!match2) return xml;
47031
- const [whole, tag, attrs2 = "", close2] = match2;
47032
- if (/\sr:id\s*=/.test(attrs2)) return xml;
47033
- const sheetMatch = attrPattern("sheet").exec(attrs2);
47034
- const refMatch = attrPattern("ref").exec(attrs2);
48261
+ const [whole, tag, attrs3 = "", close2] = match2;
48262
+ if (/\sr:id\s*=/.test(attrs3)) return xml;
48263
+ const sheetMatch = attrPattern("sheet").exec(attrs3);
48264
+ const refMatch = attrPattern("ref").exec(attrs3);
47035
48265
  if (!sheetMatch || !refMatch) return xml;
47036
48266
  const sheet = unescapeXml(sheetMatch[3] ?? "");
47037
48267
  const ref = unescapeXml(refMatch[3] ?? "");
@@ -47043,7 +48273,7 @@ function patchWorksheetSource(xml, edits) {
47043
48273
  const rename = edits.renamed.find(([from]) => from.toLowerCase() === sheet.toLowerCase());
47044
48274
  const nextSheet = rename ? rename[1] : sheet;
47045
48275
  if (nextRef === ref && nextSheet === sheet) return xml;
47046
- let nextAttrs = attrs2;
48276
+ let nextAttrs = attrs3;
47047
48277
  if (nextRef !== ref)
47048
48278
  nextAttrs = nextAttrs.replace(attrPattern("ref"), (_m, lead, q) => {
47049
48279
  return `${lead}${q}${escapeXmlAttr(nextRef)}${q}`;
@@ -47148,8 +48378,8 @@ function child5(doc, root, local) {
47148
48378
  const existing = kids(root, local)[0];
47149
48379
  if (existing) return existing;
47150
48380
  const node2 = doc.createElementNS(NS.x, local);
47151
- const rank3 = ORDER2.indexOf(local);
47152
- const next = elements(root).find((e) => ORDER2.indexOf(e.localName) > rank3);
48381
+ const rank4 = ORDER2.indexOf(local);
48382
+ const next = elements(root).find((e) => ORDER2.indexOf(e.localName) > rank4);
47153
48383
  root.insertBefore(node2, next ?? null);
47154
48384
  return node2;
47155
48385
  }
@@ -47304,19 +48534,27 @@ function protectionXml(protection) {
47304
48534
  var numFmtXml = (id, code) => `<numFmt numFmtId="${id}" formatCode="${escapeAttr3(code)}"/>`;
47305
48535
 
47306
48536
  // xlsx/write/shared-strings.ts
47307
- function richStringXml(text, runs) {
47308
- if (!runs?.length) return tElement(text);
47309
- return runs.map(
48537
+ function phoneticXml(phonetic) {
48538
+ const runs = phonetic.runs.map((run2) => `<rPh${attrs({ sb: run2.sb, eb: run2.eb })}>${tElement(run2.text)}</rPh>`).join("");
48539
+ const pr = phonetic.properties;
48540
+ const settings = pr ? `<phoneticPr${attrs({ fontId: pr.fontId, type: pr.type, alignment: pr.alignment })}/>` : "";
48541
+ return runs + settings;
48542
+ }
48543
+ function richStringXml(text, runs, phonetic) {
48544
+ const guide = phonetic ? phoneticXml(phonetic) : "";
48545
+ if (!runs?.length) return tElement(text) + guide;
48546
+ const body = runs.map(
47310
48547
  (run2) => `<r>${run2.font && Object.keys(run2.font).length ? fontXml(run2.font, "rPr") : ""}${tElement(run2.text)}</r>`
47311
48548
  ).join("");
48549
+ return body + guide;
47312
48550
  }
47313
48551
  var SharedStringTable = class {
47314
48552
  items = [];
47315
48553
  index = /* @__PURE__ */ new Map();
47316
48554
  references = 0;
47317
- id(text, runs) {
48555
+ id(text, runs, phonetic) {
47318
48556
  this.references++;
47319
- const body = richStringXml(text, runs);
48557
+ const body = richStringXml(text, runs, phonetic);
47320
48558
  let id = this.index.get(body);
47321
48559
  if (id === void 0) {
47322
48560
  id = this.items.length;
@@ -47687,6 +48925,95 @@ function pageXml(sheet) {
47687
48925
  return result2;
47688
48926
  }
47689
48927
 
48928
+ // xlsx/write/filter-columns.ts
48929
+ function criteriaOf(column2) {
48930
+ const { values: values2, blank, dateGroups, custom, top10, dynamic, color, icon, hiddenButton } = column2;
48931
+ const bare = color && { cellColor: color.cellColor, dxfId: color.dxfId };
48932
+ return { values: values2, blank, dateGroups, custom, top10, dynamic, color: bare, icon, hiddenButton };
48933
+ }
48934
+ function unresolvedFilter(filter2) {
48935
+ return filter2 && {
48936
+ range: filter2.range,
48937
+ columns: filter2.columns?.map((column2) => ({
48938
+ offset: column2.offset,
48939
+ sourceXml: column2.sourceXml,
48940
+ ...criteriaOf(column2)
48941
+ }))
48942
+ };
48943
+ }
48944
+ function sourceCriteria(xml) {
48945
+ try {
48946
+ const wrapped = `<autoFilter xmlns="${NS.x}" ref="A1">${xml}</autoFilter>`;
48947
+ const column2 = readAutoFilter(parseXml(wrapped).documentElement)?.columns?.[0];
48948
+ return column2 ? criteriaOf(column2) : void 0;
48949
+ } catch {
48950
+ return void 0;
48951
+ }
48952
+ }
48953
+ function hasCriteria(column2) {
48954
+ return !!(column2.values?.length || column2.blank || column2.dateGroups?.length || column2.custom?.conditions.length || column2.top10 || column2.dynamic || column2.color || column2.icon);
48955
+ }
48956
+ function criteriaXml(column2, styles) {
48957
+ if (column2.top10) {
48958
+ const { top, percent, value: value2, filterValue } = column2.top10;
48959
+ return el("top10", {
48960
+ top: top ? void 0 : false,
48961
+ percent: percent || void 0,
48962
+ val: value2,
48963
+ filterVal: filterValue
48964
+ });
48965
+ }
48966
+ if (column2.custom?.conditions.length) {
48967
+ const items = column2.custom.conditions.slice(0, 2).map(
48968
+ (c2) => el("customFilter", {
48969
+ operator: c2.operator === "equal" ? void 0 : c2.operator,
48970
+ val: c2.value
48971
+ })
48972
+ ).join("");
48973
+ return el("customFilters", { and: column2.custom.and || void 0 }, items);
48974
+ }
48975
+ if (column2.dynamic) {
48976
+ const { type, value: value2, maxValue } = column2.dynamic;
48977
+ return el("dynamicFilter", { type, val: value2, maxVal: maxValue });
48978
+ }
48979
+ if (column2.color) {
48980
+ const { cellColor, style: style2, dxfId } = column2.color;
48981
+ const id = style2 && styles ? styles.dxfId(style2) : dxfId;
48982
+ return el("colorFilter", { dxfId: id, cellColor: cellColor ? void 0 : false });
48983
+ }
48984
+ if (column2.icon)
48985
+ return el("iconFilter", { iconSet: column2.icon.iconSet, iconId: column2.icon.iconId });
48986
+ const values2 = (column2.values ?? []).map((value2) => el("filter", { val: value2 }));
48987
+ const groups = (column2.dateGroups ?? []).map(
48988
+ (g2) => el("dateGroupItem", {
48989
+ year: g2.year,
48990
+ month: g2.month,
48991
+ day: g2.day,
48992
+ hour: g2.hour,
48993
+ minute: g2.minute,
48994
+ second: g2.second,
48995
+ dateTimeGrouping: g2.grouping
48996
+ })
48997
+ );
48998
+ return el("filters", { blank: column2.blank || void 0 }, values2.join("") + groups.join(""));
48999
+ }
49000
+ function filterColumnXml2(column2, styles) {
49001
+ if (column2.sourceXml && sameModel(sourceCriteria(column2.sourceXml), criteriaOf(column2))) {
49002
+ const head = /^<filterColumn\b[^>]*?>/.exec(column2.sourceXml)?.[0];
49003
+ if (head) {
49004
+ const colId = ` colId="${column2.offset}"`;
49005
+ const patched = /\scolId="[^"]*"/.test(head) ? head.replace(/\scolId="[^"]*"/, colId) : head.replace(/^<filterColumn\b/, `<filterColumn${colId}`);
49006
+ return patched + column2.sourceXml.slice(head.length);
49007
+ }
49008
+ }
49009
+ if (!hasCriteria(column2)) return "";
49010
+ return el(
49011
+ "filterColumn",
49012
+ { colId: column2.offset, hiddenButton: column2.hiddenButton || void 0 },
49013
+ criteriaXml(column2, styles)
49014
+ );
49015
+ }
49016
+
47690
49017
  // xlsx/write/sheet-props.ts
47691
49018
  var sqref = (ranges) => ranges.map((range) => formatRange(range)).join(" ");
47692
49019
  function sheetPrXml(sheet) {
@@ -47829,40 +49156,14 @@ function protectionXml2(sheet) {
47829
49156
  for (const name of allow) values2[name] = false;
47830
49157
  return el("sheetProtection", values2);
47831
49158
  }
47832
- function sourceCriteria(xml) {
47833
- try {
47834
- const wrapped = `<autoFilter xmlns="${NS.x}" ref="A1">${xml}</autoFilter>`;
47835
- const column2 = readAutoFilter(parseXml(wrapped).documentElement)?.columns?.[0];
47836
- return column2 ? { values: column2.values, blank: column2.blank } : void 0;
47837
- } catch {
47838
- return void 0;
47839
- }
47840
- }
47841
- function filterColumnXml2(column2) {
47842
- if (column2.sourceXml && sameModel(sourceCriteria(column2.sourceXml), { values: column2.values, blank: column2.blank })) {
47843
- const head = /^<filterColumn\b[^>]*?>/.exec(column2.sourceXml)?.[0];
47844
- if (head) {
47845
- const colId = ` colId="${column2.offset}"`;
47846
- const patched = /\scolId="[^"]*"/.test(head) ? head.replace(/\scolId="[^"]*"/, colId) : head.replace(/^<filterColumn\b/, `<filterColumn${colId}`);
47847
- return patched + column2.sourceXml.slice(head.length);
47848
- }
47849
- }
47850
- if (!column2.values?.length && !column2.blank) return "";
47851
- const values2 = (column2.values ?? []).map((value2) => el("filter", { val: value2 })).join("");
47852
- return el(
47853
- "filterColumn",
47854
- { colId: column2.offset },
47855
- el("filters", { blank: column2.blank || void 0 }, values2) || "<filters/>"
47856
- );
47857
- }
47858
- function autoFilterXml(sheet) {
49159
+ function autoFilterXml(sheet, styles) {
47859
49160
  const filter2 = sheet.autoFilter;
47860
49161
  if (!filter2) return "";
47861
49162
  const source3 = snapshotElement(sheet, "autoFilter");
47862
- if (source3 && sameModel(readAutoFilter(source3), filter2))
49163
+ if (source3 && sameModel(unresolvedFilter(readAutoFilter(source3)), unresolvedFilter(filter2)))
47863
49164
  return snapshotXml(sheet, "autoFilter") ?? "";
47864
49165
  const width = filter2.range.end.col - filter2.range.start.col + 1;
47865
- const columns = (filter2.columns ?? []).filter((column2) => column2.offset >= 0 && column2.offset < width).sort((a2, b) => a2.offset - b.offset).map(filterColumnXml2).join("");
49166
+ const columns = (filter2.columns ?? []).filter((column2) => column2.offset >= 0 && column2.offset < width).sort((a2, b) => a2.offset - b.offset).map((column2) => filterColumnXml2(column2, styles)).join("");
47866
49167
  const sort2 = source3 && sameModel(readAutoFilter(source3)?.range, filter2.range) ? elements(source3).filter((node2) => node2.localName === "sortState" || node2.localName === "extLst").map((node2) => outerXml(node2)).join("") : "";
47867
49168
  return el("autoFilter", { ref: formatRange(filter2.range) }, columns + sort2);
47868
49169
  }
@@ -47934,6 +49235,15 @@ function absoluteRange(range) {
47934
49235
  const cell = (row2, col) => `$${columnLabel(col)}$${row2 + 1}`;
47935
49236
  return `${cell(range.start.row, range.start.col)}:${cell(range.end.row, range.end.col)}`;
47936
49237
  }
49238
+ function hasUncachedFormula(workbook) {
49239
+ return workbook.sheets.some((sheet) => {
49240
+ for (const row2 of sheet.rows.values())
49241
+ for (const cell of row2.values())
49242
+ if (cell.formula !== void 0 && (cell.value === null || cell.value === void 0))
49243
+ return true;
49244
+ return false;
49245
+ });
49246
+ }
47937
49247
  function definedNamesOf(workbook) {
47938
49248
  const names = workbook.definedNames.filter(
47939
49249
  (name) => name.name && (name.localSheet === void 0 || name.localSheet >= 0 && name.localSheet < workbook.sheets.length)
@@ -47994,7 +49304,12 @@ function workbookXml(workbook, sheets, activeTab, sourceXml, pivotCachesXml) {
47994
49304
  const mode = workbook.calcMode === "manual" ? ' calcMode="manual"' : "";
47995
49305
  const iterate = workbook.iterate ? ` iterate="1" iterateCount="${workbook.iterate.count}" iterateDelta="${workbook.iterate.delta}"` : "";
47996
49306
  const owned = ["fullCalcOnLoad", "calcId", "calcMode", "iterate", "iterateCount", "iterateDelta"];
47997
- out += `<calcPr${copyAttrs(calc, owned)} calcId="191029"${mode}${iterate} fullCalcOnLoad="1"/>`;
49307
+ const sourceAttr = (name) => calc ? Array.from(calc.attributes).find((a2) => a2.name === name)?.value : void 0;
49308
+ const calcId = sourceAttr("calcId") ?? "191029";
49309
+ const recalculate = workbook.fullCalcOnLoad || workbook.valuesStale || hasUncachedFormula(workbook);
49310
+ const sourceFull = sourceAttr("fullCalcOnLoad");
49311
+ const fullCalc = recalculate ? ' fullCalcOnLoad="1"' : sourceFull !== void 0 ? ` fullCalcOnLoad="${escapeAttr3(sourceFull)}"` : "";
49312
+ out += `<calcPr${copyAttrs(calc, owned)} calcId="${escapeAttr3(calcId)}"${mode}${iterate}${fullCalc}/>`;
47998
49313
  const tailOf = (names2) => names2.map(
47999
49314
  (name) => name === "oleSize" && workbook.oleSize ? `<oleSize ref="${escapeAttr3(workbook.oleSize)}"/>` : name === "customWorkbookViews" && workbook.customViews ? customWorkbookViewsXml(workbook.customViews) : raw2([name])
48000
49315
  ).join("");
@@ -48149,35 +49464,6 @@ function refreshFormControlParts(writer, workbook, sheet) {
48149
49464
  }
48150
49465
  }
48151
49466
 
48152
- // xlsx/time-period.ts
48153
- function timePeriodFormula(period, cell) {
48154
- const day = `FLOOR(${cell},1)`;
48155
- const down = `ROUNDDOWN(${cell},0)`;
48156
- const month = (offset2) => `AND(MONTH(${cell})=MONTH(EDATE(TODAY(),${offset2})),YEAR(${cell})=YEAR(EDATE(TODAY(),${offset2})))`;
48157
- switch (period) {
48158
- case "today":
48159
- return `${day}=TODAY()`;
48160
- case "yesterday":
48161
- return `${day}=TODAY()-1`;
48162
- case "tomorrow":
48163
- return `${day}=TODAY()+1`;
48164
- case "last7Days":
48165
- return `AND(TODAY()-${day}<=6,${day}<=TODAY())`;
48166
- case "thisWeek":
48167
- return `AND(TODAY()-${down}<=WEEKDAY(TODAY())-1,${down}-TODAY()<=7-WEEKDAY(TODAY()))`;
48168
- case "lastWeek":
48169
- return `AND(TODAY()-${down}>=(WEEKDAY(TODAY())),TODAY()-${down}<(WEEKDAY(TODAY())+7))`;
48170
- case "nextWeek":
48171
- return `AND(${down}-TODAY()>(7-WEEKDAY(TODAY())),${down}-TODAY()<(15-WEEKDAY(TODAY())))`;
48172
- case "thisMonth":
48173
- return `AND(MONTH(${cell})=MONTH(TODAY()),YEAR(${cell})=YEAR(TODAY()))`;
48174
- case "lastMonth":
48175
- return month("0-1");
48176
- case "nextMonth":
48177
- return month("0+1");
48178
- }
48179
- }
48180
-
48181
49467
  // xlsx/write/conditional.ts
48182
49468
  var cfvoXml = (threshold) => el("cfvo", {
48183
49469
  type: threshold.type,
@@ -48393,7 +49679,7 @@ function cellXml(ctx, spills, source3, row2, col, dataTable) {
48393
49679
  v = escapeText2(encodeEscapes(text));
48394
49680
  } else {
48395
49681
  t = "s";
48396
- v = String(ctx.strings.id(text, cell.richText));
49682
+ v = String(ctx.strings.id(text, cell.richText, cell.phonetic));
48397
49683
  }
48398
49684
  } else if (isCellError(value2)) {
48399
49685
  t = "e";
@@ -48500,17 +49786,17 @@ function numberSource(values2, previous, formula2) {
48500
49786
  };
48501
49787
  }
48502
49788
  function categorySource(values2, previous, formula2) {
48503
- const numeric2 = values2.length > 0 && values2.every((value2) => typeof value2 === "number");
49789
+ const numeric3 = values2.length > 0 && values2.every((value2) => typeof value2 === "number");
48504
49790
  const reference2 = formula2 ?? (previous?.kind === "numRef" || previous?.kind === "strRef" || previous?.kind === "multiLvlStrRef" ? previous.formula : void 0);
48505
- const kind = numeric2 ? reference2 !== void 0 ? "numRef" : "numLit" : reference2 !== void 0 ? "strRef" : "strLit";
49791
+ const kind = numeric3 ? reference2 !== void 0 ? "numRef" : "numLit" : reference2 !== void 0 ? "strRef" : "strLit";
48506
49792
  return {
48507
49793
  kind,
48508
49794
  ...reference2 !== void 0 ? { formula: reference2 } : {},
48509
49795
  cache: {
48510
- type: numeric2 ? "number" : "string",
48511
- ...numeric2 ? { formatCode: previous?.cache?.formatCode ?? "General" } : {},
49796
+ type: numeric3 ? "number" : "string",
49797
+ ...numeric3 ? { formatCode: previous?.cache?.formatCode ?? "General" } : {},
48512
49798
  pointCount: values2.length,
48513
- points: points(values2, numeric2 ? previous?.cache : void 0)
49799
+ points: points(values2, numeric3 ? previous?.cache : void 0)
48514
49800
  }
48515
49801
  };
48516
49802
  }
@@ -49381,7 +50667,7 @@ function writeWorksheet(ctx, sheet, index3, partName) {
49381
50667
  blocks.set("sheetProtection", protectionXml2(sheet));
49382
50668
  blocks.set("scenarios", scenariosXml(sheet.scenarios));
49383
50669
  blocks.set("customSheetViews", customSheetViewsXml(sheet.customViews));
49384
- blocks.set("autoFilter", autoFilterXml(sheet));
50670
+ blocks.set("autoFilter", autoFilterXml(sheet, ctx.styles));
49385
50671
  blocks.set("mergeCells", mergeCellsXml(sheet));
49386
50672
  blocks.set("conditionalFormatting", conditionalFormatsXml(sheet.conditionalFormats, ctx.styles));
49387
50673
  blocks.set("dataValidations", dataValidationsXml(sheet.dataValidations));