ooxml-core 1.24.2 → 1.25.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 (444) hide show
  1. package/dist/PptxHandler-AN42B3JR.mjs +4 -0
  2. package/dist/{PptxHandler-KFEE7O7W.cjs → PptxHandler-O25PF53M.cjs} +3 -3
  3. package/dist/{PptxHandler-5TWAQWPK.mjs → PptxHandler-UTNNU6PO.mjs} +3 -3
  4. package/dist/{PresentationBuilder-SXLRXYDI.cjs → PresentationBuilder-A4XU72IV.cjs} +5 -5
  5. package/dist/{PresentationBuilder-SCT5AQBP.mjs → PresentationBuilder-GTXNYSRI.mjs} +2 -2
  6. package/dist/{PresentationBuilder-SVHIKT4C.mjs → PresentationBuilder-TNMO5MPC.mjs} +3 -3
  7. package/dist/automation/index.cjs +10181 -6066
  8. package/dist/automation/index.mjs +10181 -6066
  9. package/dist/chart/data-sheet.d.ts +86 -0
  10. package/dist/chart/data-sheet.d.ts.map +1 -0
  11. package/dist/chart/edit/axes.d.ts +49 -0
  12. package/dist/chart/edit/axes.d.ts.map +1 -0
  13. package/dist/chart/edit/chartex-data.d.ts +15 -0
  14. package/dist/chart/edit/chartex-data.d.ts.map +1 -0
  15. package/dist/chart/edit/chartex.d.ts +61 -0
  16. package/dist/chart/edit/chartex.d.ts.map +1 -0
  17. package/dist/chart/edit/data-sheet.d.ts +10 -0
  18. package/dist/chart/edit/data-sheet.d.ts.map +1 -0
  19. package/dist/chart/edit/draft.d.ts +27 -0
  20. package/dist/chart/edit/draft.d.ts.map +1 -0
  21. package/dist/chart/edit/fill.d.ts +47 -0
  22. package/dist/chart/edit/fill.d.ts.map +1 -0
  23. package/dist/chart/edit/gradient.d.ts +44 -0
  24. package/dist/chart/edit/gradient.d.ts.map +1 -0
  25. package/dist/chart/edit/group-options.d.ts +14 -0
  26. package/dist/chart/edit/group-options.d.ts.map +1 -0
  27. package/dist/chart/edit/index.d.ts +23 -0
  28. package/dist/chart/edit/index.d.ts.map +1 -0
  29. package/dist/chart/edit/intent.d.ts +72 -0
  30. package/dist/chart/edit/intent.d.ts.map +1 -0
  31. package/dist/chart/edit/legend-labels.d.ts +34 -0
  32. package/dist/chart/edit/legend-labels.d.ts.map +1 -0
  33. package/dist/chart/edit/new-chart.d.ts +14 -0
  34. package/dist/chart/edit/new-chart.d.ts.map +1 -0
  35. package/dist/chart/edit/paint.d.ts +20 -0
  36. package/dist/chart/edit/paint.d.ts.map +1 -0
  37. package/dist/chart/edit/quick-layout.d.ts +16 -0
  38. package/dist/chart/edit/quick-layout.d.ts.map +1 -0
  39. package/dist/chart/edit/series-data.d.ts +8 -0
  40. package/dist/chart/edit/series-data.d.ts.map +1 -0
  41. package/dist/chart/edit/series.d.ts +57 -0
  42. package/dist/chart/edit/series.d.ts.map +1 -0
  43. package/dist/chart/edit/style.d.ts +18 -0
  44. package/dist/chart/edit/style.d.ts.map +1 -0
  45. package/dist/chart/edit/target-paint.d.ts +19 -0
  46. package/dist/chart/edit/target-paint.d.ts.map +1 -0
  47. package/dist/chart/edit/target.d.ts +31 -0
  48. package/dist/chart/edit/target.d.ts.map +1 -0
  49. package/dist/chart/edit/title.d.ts +24 -0
  50. package/dist/chart/edit/title.d.ts.map +1 -0
  51. package/dist/chart/edit/type-axes.d.ts +14 -0
  52. package/dist/chart/edit/type-axes.d.ts.map +1 -0
  53. package/dist/chart/edit/type-schema.d.ts +15 -0
  54. package/dist/chart/edit/type-schema.d.ts.map +1 -0
  55. package/dist/chart/edit/type.d.ts +16 -0
  56. package/dist/chart/edit/type.d.ts.map +1 -0
  57. package/dist/chart/ex/index.d.ts +4 -0
  58. package/dist/chart/ex/index.d.ts.map +1 -0
  59. package/dist/chart/ex/model.d.ts +291 -0
  60. package/dist/chart/ex/model.d.ts.map +1 -0
  61. package/dist/chart/ex/parse-axis.d.ts +6 -0
  62. package/dist/chart/ex/parse-axis.d.ts.map +1 -0
  63. package/dist/chart/ex/parse-series.d.ts +6 -0
  64. package/dist/chart/ex/parse-series.d.ts.map +1 -0
  65. package/dist/chart/ex/parse-text.d.ts +14 -0
  66. package/dist/chart/ex/parse-text.d.ts.map +1 -0
  67. package/dist/chart/ex/parse-util.d.ts +36 -0
  68. package/dist/chart/ex/parse-util.d.ts.map +1 -0
  69. package/dist/chart/ex/parse.d.ts +10 -0
  70. package/dist/chart/ex/parse.d.ts.map +1 -0
  71. package/dist/chart/ex/write-series.d.ts +13 -0
  72. package/dist/chart/ex/write-series.d.ts.map +1 -0
  73. package/dist/chart/ex/write-util.d.ts +23 -0
  74. package/dist/chart/ex/write-util.d.ts.map +1 -0
  75. package/dist/chart/ex/write.d.ts +24 -0
  76. package/dist/chart/ex/write.d.ts.map +1 -0
  77. package/dist/chart/index.cjs +7258 -3107
  78. package/dist/chart/index.d.ts +8 -0
  79. package/dist/chart/index.d.ts.map +1 -1
  80. package/dist/chart/index.mjs +7117 -3110
  81. package/dist/chart/keep-source.d.ts +11 -0
  82. package/dist/chart/keep-source.d.ts.map +1 -0
  83. package/dist/chart/keep-unmodelled.d.ts +6 -0
  84. package/dist/chart/keep-unmodelled.d.ts.map +1 -0
  85. package/dist/chart/model-series.d.ts +6 -0
  86. package/dist/chart/model-series.d.ts.map +1 -1
  87. package/dist/chart/model.d.ts +14 -0
  88. package/dist/chart/model.d.ts.map +1 -1
  89. package/dist/chart/parse-plot.d.ts.map +1 -1
  90. package/dist/chart/parse-series.d.ts +1 -1
  91. package/dist/chart/parse-series.d.ts.map +1 -1
  92. package/dist/chart/parse-util.d.ts +2 -0
  93. package/dist/chart/parse-util.d.ts.map +1 -1
  94. package/dist/chart/quick-layouts.d.ts +41 -0
  95. package/dist/chart/quick-layouts.d.ts.map +1 -0
  96. package/dist/chart/render/summary-from-chartex.d.ts +3 -0
  97. package/dist/chart/render/summary-from-chartex.d.ts.map +1 -1
  98. package/dist/chart/style-presets.d.ts +20 -0
  99. package/dist/chart/style-presets.d.ts.map +1 -0
  100. package/dist/chart/workbook/cellref.d.ts +53 -0
  101. package/dist/chart/workbook/cellref.d.ts.map +1 -0
  102. package/dist/chart/workbook/create.d.ts +6 -0
  103. package/dist/chart/workbook/create.d.ts.map +1 -0
  104. package/dist/chart/workbook/index.d.ts +10 -0
  105. package/dist/chart/workbook/index.d.ts.map +1 -0
  106. package/dist/chart/workbook/layout.d.ts +35 -0
  107. package/dist/chart/workbook/layout.d.ts.map +1 -0
  108. package/dist/chart/workbook/package-save.d.ts +48 -0
  109. package/dist/chart/workbook/package-save.d.ts.map +1 -0
  110. package/dist/chart/workbook/sheet-cells.d.ts +31 -0
  111. package/dist/chart/workbook/sheet-cells.d.ts.map +1 -0
  112. package/dist/chart/workbook/space-writes.d.ts +5 -0
  113. package/dist/chart/workbook/space-writes.d.ts.map +1 -0
  114. package/dist/chart/workbook/tables.d.ts +20 -0
  115. package/dist/chart/workbook/tables.d.ts.map +1 -0
  116. package/dist/chart/workbook/validation.d.ts +12 -0
  117. package/dist/chart/workbook/validation.d.ts.map +1 -0
  118. package/dist/chart/workbook/writer.d.ts +55 -0
  119. package/dist/chart/workbook/writer.d.ts.map +1 -0
  120. package/dist/chart/write-axes.d.ts.map +1 -1
  121. package/dist/chart/write-plot.d.ts.map +1 -1
  122. package/dist/chart/write-series.d.ts.map +1 -1
  123. package/dist/chart/write-shape.d.ts +2 -0
  124. package/dist/chart/write-shape.d.ts.map +1 -1
  125. package/dist/{chunk-NE7626A4.mjs → chunk-4IYYW3CX.mjs} +5 -5
  126. package/dist/{chunk-6IIMI5RS.mjs → chunk-6DHZZD5R.mjs} +1103 -1025
  127. package/dist/{chunk-GBKBR4CX.mjs → chunk-E2PYQQQV.mjs} +1 -1
  128. package/dist/{chunk-XK55DEUD.cjs → chunk-JE3DVWAJ.cjs} +4991 -2865
  129. package/dist/{chunk-7N7C5BNM.mjs → chunk-NBSJDA3B.mjs} +2236 -2096
  130. package/dist/{chunk-GVP262WE.mjs → chunk-QXWRJDVE.mjs} +4077 -1951
  131. package/dist/{chunk-4LZIUJI3.cjs → chunk-S5TGOEQX.cjs} +1108 -1029
  132. package/dist/{chunk-CWCDFPKN.mjs → chunk-VHGMYNWM.mjs} +1 -1
  133. package/dist/{chunk-ON7XVRHQ.mjs → chunk-X7IIABZ6.mjs} +3978 -1835
  134. package/dist/{chunk-KVKTHGIY.mjs → chunk-YWTKOZMT.mjs} +1 -1
  135. package/dist/crypto/detect.d.ts +5 -1
  136. package/dist/crypto/detect.d.ts.map +1 -1
  137. package/dist/crypto/index.cjs +1 -1
  138. package/dist/crypto/index.mjs +1 -1
  139. package/dist/diagram/approximate.d.ts +19 -0
  140. package/dist/diagram/approximate.d.ts.map +1 -0
  141. package/dist/diagram/builtin/catalog.d.ts +3 -0
  142. package/dist/diagram/builtin/catalog.d.ts.map +1 -0
  143. package/dist/diagram/builtin/data.d.ts +3 -0
  144. package/dist/diagram/builtin/data.d.ts.map +1 -0
  145. package/dist/diagram/builtin/definitions.d.ts +7 -0
  146. package/dist/diagram/builtin/definitions.d.ts.map +1 -0
  147. package/dist/diagram/builtin/index.cjs +1348 -0
  148. package/dist/diagram/builtin/index.d.ts +3 -0
  149. package/dist/diagram/builtin/index.d.ts.map +1 -0
  150. package/dist/diagram/builtin/index.mjs +1337 -0
  151. package/dist/diagram/builtin/layouts.d.ts +15 -0
  152. package/dist/diagram/builtin/layouts.d.ts.map +1 -0
  153. package/dist/diagram/builtin/types.d.ts +13 -0
  154. package/dist/diagram/builtin/types.d.ts.map +1 -0
  155. package/dist/diagram/catalogue.d.ts +51 -0
  156. package/dist/diagram/catalogue.d.ts.map +1 -0
  157. package/dist/diagram/data-model.d.ts.map +1 -1
  158. package/dist/diagram/drawing-from-views.d.ts +11 -0
  159. package/dist/diagram/drawing-from-views.d.ts.map +1 -0
  160. package/dist/diagram/drawing-resolve.d.ts +34 -0
  161. package/dist/diagram/drawing-resolve.d.ts.map +1 -0
  162. package/dist/diagram/drawing-view.d.ts +104 -0
  163. package/dist/diagram/drawing-view.d.ts.map +1 -0
  164. package/dist/diagram/drawing.d.ts.map +1 -1
  165. package/dist/diagram/edit/design-commands.d.ts +27 -0
  166. package/dist/diagram/edit/design-commands.d.ts.map +1 -0
  167. package/dist/diagram/edit/index.d.ts +15 -0
  168. package/dist/diagram/edit/index.d.ts.map +1 -0
  169. package/dist/diagram/edit/node-edit.d.ts +66 -0
  170. package/dist/diagram/edit/node-edit.d.ts.map +1 -0
  171. package/dist/diagram/edit/node-ops.d.ts +71 -0
  172. package/dist/diagram/edit/node-ops.d.ts.map +1 -0
  173. package/dist/diagram/edit/node-order.d.ts +28 -0
  174. package/dist/diagram/edit/node-order.d.ts.map +1 -0
  175. package/dist/diagram/edit/node-style.d.ts +42 -0
  176. package/dist/diagram/edit/node-style.d.ts.map +1 -0
  177. package/dist/diagram/edit/node-tree.d.ts +10 -0
  178. package/dist/diagram/edit/node-tree.d.ts.map +1 -0
  179. package/dist/diagram/edit/outline.d.ts +11 -0
  180. package/dist/diagram/edit/outline.d.ts.map +1 -0
  181. package/dist/diagram/edit/reflow-category.d.ts +18 -0
  182. package/dist/diagram/edit/reflow-category.d.ts.map +1 -0
  183. package/dist/diagram/edit/reflow-directional.d.ts +53 -0
  184. package/dist/diagram/edit/reflow-directional.d.ts.map +1 -0
  185. package/dist/diagram/edit/reflow-geometric.d.ts +59 -0
  186. package/dist/diagram/edit/reflow-geometric.d.ts.map +1 -0
  187. package/dist/diagram/edit/reflow-stacked.d.ts +32 -0
  188. package/dist/diagram/edit/reflow-stacked.d.ts.map +1 -0
  189. package/dist/diagram/edit/reflow.d.ts +48 -0
  190. package/dist/diagram/edit/reflow.d.ts.map +1 -0
  191. package/dist/diagram/edit/shape-match.d.ts +34 -0
  192. package/dist/diagram/edit/shape-match.d.ts.map +1 -0
  193. package/dist/diagram/edit/types.d.ts +31 -0
  194. package/dist/diagram/edit/types.d.ts.map +1 -0
  195. package/dist/diagram/index.cjs +3934 -910
  196. package/dist/diagram/index.d.ts +9 -0
  197. package/dist/diagram/index.d.ts.map +1 -1
  198. package/dist/diagram/index.mjs +3860 -912
  199. package/dist/diagram/model/node.d.ts +10 -0
  200. package/dist/diagram/model/node.d.ts.map +1 -1
  201. package/dist/diagram/relationships.d.ts +8 -0
  202. package/dist/diagram/relationships.d.ts.map +1 -1
  203. package/dist/diagram/strings/de.d.ts +3 -0
  204. package/dist/diagram/strings/de.d.ts.map +1 -0
  205. package/dist/diagram/strings/en.d.ts +74 -0
  206. package/dist/diagram/strings/en.d.ts.map +1 -0
  207. package/dist/diagram/strings/es.d.ts +3 -0
  208. package/dist/diagram/strings/es.d.ts.map +1 -0
  209. package/dist/diagram/strings/fr.d.ts +3 -0
  210. package/dist/diagram/strings/fr.d.ts.map +1 -0
  211. package/dist/diagram/strings/index.d.ts +11 -0
  212. package/dist/diagram/strings/index.d.ts.map +1 -0
  213. package/dist/diagram/strings/zh-CN.d.ts +3 -0
  214. package/dist/diagram/strings/zh-CN.d.ts.map +1 -0
  215. package/dist/diagram/text/index.d.ts +5 -0
  216. package/dist/diagram/text/index.d.ts.map +1 -0
  217. package/dist/diagram/text/node-text-neutral.d.ts +29 -0
  218. package/dist/diagram/text/node-text-neutral.d.ts.map +1 -0
  219. package/dist/diagram/text/node-text-paragraphs.d.ts +6 -0
  220. package/dist/diagram/text/node-text-paragraphs.d.ts.map +1 -0
  221. package/dist/diagram/text/node-text-projection.d.ts +48 -0
  222. package/dist/diagram/text/node-text-projection.d.ts.map +1 -0
  223. package/dist/diagram/text/node-text-reconciliation.d.ts +4 -0
  224. package/dist/diagram/text/node-text-reconciliation.d.ts.map +1 -0
  225. package/dist/diagram/types.d.ts +12 -0
  226. package/dist/diagram/types.d.ts.map +1 -1
  227. package/dist/diagram/write/data-edit.d.ts +30 -0
  228. package/dist/diagram/write/data-edit.d.ts.map +1 -0
  229. package/dist/diagram/write/data.d.ts +62 -0
  230. package/dist/diagram/write/data.d.ts.map +1 -0
  231. package/dist/diagram/write/index.d.ts +4 -0
  232. package/dist/diagram/write/index.d.ts.map +1 -0
  233. package/dist/diagram/write/inserted.d.ts +14 -0
  234. package/dist/diagram/write/inserted.d.ts.map +1 -0
  235. package/dist/docx/chart-edit.d.ts +33 -0
  236. package/dist/docx/chart-edit.d.ts.map +1 -0
  237. package/dist/docx/chart-save.d.ts +14 -0
  238. package/dist/docx/chart-save.d.ts.map +1 -0
  239. package/dist/docx/chart.d.ts +5 -3
  240. package/dist/docx/chart.d.ts.map +1 -1
  241. package/dist/docx/diagram-edit.d.ts +50 -0
  242. package/dist/docx/diagram-edit.d.ts.map +1 -0
  243. package/dist/docx/diagram-nodes.d.ts +2 -0
  244. package/dist/docx/diagram-nodes.d.ts.map +1 -0
  245. package/dist/docx/diagram-save.d.ts +12 -0
  246. package/dist/docx/diagram-save.d.ts.map +1 -0
  247. package/dist/docx/diagram.d.ts +17 -9
  248. package/dist/docx/diagram.d.ts.map +1 -1
  249. package/dist/docx/embedded.cjs +5191 -2423
  250. package/dist/docx/embedded.mjs +5191 -2423
  251. package/dist/docx/index.cjs +10063 -6083
  252. package/dist/docx/index.d.ts +4 -1
  253. package/dist/docx/index.d.ts.map +1 -1
  254. package/dist/docx/index.mjs +10049 -6084
  255. package/dist/docx/load/index.cjs +5841 -3073
  256. package/dist/docx/load/index.mjs +5841 -3073
  257. package/dist/docx/parse.d.ts.map +1 -1
  258. package/dist/docx/part-relationships.d.ts.map +1 -1
  259. package/dist/docx/relationship-allocator.d.ts +19 -0
  260. package/dist/docx/relationship-allocator.d.ts.map +1 -1
  261. package/dist/docx/save.d.ts.map +1 -1
  262. package/dist/docx/ui/chart-commands.d.ts +19 -0
  263. package/dist/docx/ui/chart-commands.d.ts.map +1 -0
  264. package/dist/docx/ui/index.cjs +1482 -655
  265. package/dist/docx/ui/index.d.ts +2 -0
  266. package/dist/docx/ui/index.d.ts.map +1 -1
  267. package/dist/docx/ui/index.mjs +1479 -656
  268. package/dist/docx/ui/ribbon-action-ids.d.ts +1 -1
  269. package/dist/docx/ui/ribbon-action-ids.d.ts.map +1 -1
  270. package/dist/docx/ui/smartart-approximate.d.ts +5 -0
  271. package/dist/docx/ui/smartart-approximate.d.ts.map +1 -0
  272. package/dist/docx/write-chart-drawing.d.ts +12 -0
  273. package/dist/docx/write-chart-drawing.d.ts.map +1 -0
  274. package/dist/docx/write-diagram-drawing.d.ts +13 -0
  275. package/dist/docx/write-diagram-drawing.d.ts.map +1 -0
  276. package/dist/docx/write-drawing-patch.d.ts +8 -0
  277. package/dist/docx/write-drawing-patch.d.ts.map +1 -0
  278. package/dist/docx/write-drawing.d.ts.map +1 -1
  279. package/dist/drawingml/index.cjs +863 -0
  280. package/dist/drawingml/index.d.ts +7 -0
  281. package/dist/drawingml/index.d.ts.map +1 -1
  282. package/dist/drawingml/index.mjs +840 -1
  283. package/dist/drawingml/read-paragraph-properties.d.ts +8 -0
  284. package/dist/drawingml/read-paragraph-properties.d.ts.map +1 -0
  285. package/dist/drawingml/read-run-properties.d.ts +15 -0
  286. package/dist/drawingml/read-run-properties.d.ts.map +1 -0
  287. package/dist/drawingml/read-text-body.d.ts +13 -0
  288. package/dist/drawingml/read-text-body.d.ts.map +1 -0
  289. package/dist/drawingml/text-model.d.ts +210 -0
  290. package/dist/drawingml/text-model.d.ts.map +1 -0
  291. package/dist/drawingml/write-paragraph-properties.d.ts +12 -0
  292. package/dist/drawingml/write-paragraph-properties.d.ts.map +1 -0
  293. package/dist/drawingml/write-run-properties.d.ts +11 -0
  294. package/dist/drawingml/write-run-properties.d.ts.map +1 -0
  295. package/dist/drawingml/write-text-body.d.ts +18 -0
  296. package/dist/drawingml/write-text-body.d.ts.map +1 -0
  297. package/dist/drawingml/write-text-xml.d.ts +26 -0
  298. package/dist/drawingml/write-text-xml.d.ts.map +1 -0
  299. package/dist/index.cjs +10068 -2908
  300. package/dist/index.mjs +10068 -2908
  301. package/dist/pptx/automation/index.cjs +6849 -3889
  302. package/dist/pptx/automation/index.d.ts +9 -6
  303. package/dist/pptx/automation/index.d.ts.map +1 -1
  304. package/dist/pptx/automation/index.mjs +7 -7
  305. package/dist/pptx/chunks/{elements-iUzpAeqR.d.ts → elements-DhW764aK.d.ts} +23 -14
  306. package/dist/pptx/chunks/elements-DhW764aK.d.ts.map +1 -0
  307. package/dist/pptx/chunks/{index-C3xhAMSa.d.ts → index-CX0RM1fF.d.ts} +4 -4
  308. package/dist/pptx/chunks/{index-C3xhAMSa.d.ts.map → index-CX0RM1fF.d.ts.map} +1 -1
  309. package/dist/pptx/chunks/{index-nKQ4s7FA.d.ts → index-CgjEEpfK.d.ts} +18 -9
  310. package/dist/pptx/chunks/index-CgjEEpfK.d.ts.map +1 -0
  311. package/dist/pptx/chunks/{index-4FmgJajb.d.ts → index-DCbp5fOs.d.ts} +100 -95
  312. package/dist/pptx/chunks/index-DCbp5fOs.d.ts.map +1 -0
  313. package/dist/pptx/chunks/{smart-art-ENMMEbmW.d.ts → smart-art-BEEl0l8X.d.ts} +514 -306
  314. package/dist/pptx/chunks/smart-art-BEEl0l8X.d.ts.map +1 -0
  315. package/dist/pptx/chunks/{text-operations-CfLVZ7DK.d.ts → text-operations-CjalmJIi.d.ts} +2 -2
  316. package/dist/pptx/chunks/{text-operations-CfLVZ7DK.d.ts.map → text-operations-CjalmJIi.d.ts.map} +1 -1
  317. package/dist/pptx/cli/index.cjs +6333 -3375
  318. package/dist/pptx/cli/index.d.ts +1 -1
  319. package/dist/pptx/cli/index.mjs +5 -5
  320. package/dist/pptx/converter/index.cjs +107 -75
  321. package/dist/pptx/converter/index.d.ts +1 -1
  322. package/dist/pptx/converter/index.mjs +3 -3
  323. package/dist/pptx/editor/render/editor-history.cjs +3 -1
  324. package/dist/pptx/editor/render/editor-history.d.ts +9 -1
  325. package/dist/pptx/editor/render/editor-history.d.ts.map +1 -1
  326. package/dist/pptx/editor/render/editor-history.mjs +3 -2
  327. package/dist/pptx/editor/render/find-replace.cjs +14 -14
  328. package/dist/pptx/editor/render/find-replace.d.ts +2 -2
  329. package/dist/pptx/editor/render/find-replace.mjs +1 -1
  330. package/dist/pptx/editor/render/slide-operations.cjs +8 -8
  331. package/dist/pptx/editor/render/slide-operations.mjs +2 -2
  332. package/dist/pptx/editor/render/text-runs-style-patch.d.ts +1 -1
  333. package/dist/pptx/editor/render/text-style-scope.d.ts +1 -1
  334. package/dist/pptx/index.cjs +7753 -4728
  335. package/dist/pptx/index.d.ts +7 -7
  336. package/dist/pptx/index.mjs +6 -6
  337. package/dist/pptx/node/index.d.ts +1 -1
  338. package/dist/pptx/signature-node/index.mjs +2 -2
  339. package/dist/pptx/smartart-layouts/index.cjs +26 -23
  340. package/dist/pptx/smartart-layouts/index.d.ts +7 -5
  341. package/dist/pptx/smartart-layouts/index.d.ts.map +1 -1
  342. package/dist/pptx/smartart-layouts/index.mjs +26 -23
  343. package/dist/teams/index.cjs +20165 -18388
  344. package/dist/teams/index.mjs +20165 -18388
  345. package/dist/text/index.cjs +106 -0
  346. package/dist/text/index.d.ts +2 -0
  347. package/dist/text/index.d.ts.map +1 -1
  348. package/dist/text/index.mjs +103 -1
  349. package/dist/text/locale-number.d.ts +15 -0
  350. package/dist/text/locale-number.d.ts.map +1 -0
  351. package/dist/text/tsv.d.ts +8 -0
  352. package/dist/text/tsv.d.ts.map +1 -0
  353. package/dist/visio/index.cjs +3574 -1953
  354. package/dist/visio/index.mjs +3574 -1953
  355. package/dist/visio/ui/index.cjs +3562 -1941
  356. package/dist/visio/ui/index.mjs +3562 -1941
  357. package/dist/xlsx/edit/chart-colors.d.ts +2 -2
  358. package/dist/xlsx/edit/chart-colors.d.ts.map +1 -1
  359. package/dist/xlsx/edit/chart-design.d.ts +11 -0
  360. package/dist/xlsx/edit/chart-design.d.ts.map +1 -0
  361. package/dist/xlsx/edit/chart-element-fill.d.ts.map +1 -1
  362. package/dist/xlsx/edit/chart-series-fill.d.ts.map +1 -1
  363. package/dist/xlsx/edit/chart-series-gradient.d.ts +6 -34
  364. package/dist/xlsx/edit/chart-series-gradient.d.ts.map +1 -1
  365. package/dist/xlsx/edit/chart-series-transparency.d.ts.map +1 -1
  366. package/dist/xlsx/edit/chart-space-patch.d.ts +13 -0
  367. package/dist/xlsx/edit/chart-space-patch.d.ts.map +1 -0
  368. package/dist/xlsx/edit/chart-space-series.d.ts +14 -0
  369. package/dist/xlsx/edit/chart-space-series.d.ts.map +1 -0
  370. package/dist/xlsx/edit/charts.d.ts +22 -6
  371. package/dist/xlsx/edit/charts.d.ts.map +1 -1
  372. package/dist/xlsx/edit/clipboard-text.d.ts +2 -7
  373. package/dist/xlsx/edit/clipboard-text.d.ts.map +1 -1
  374. package/dist/xlsx/edit/index.d.ts +3 -1
  375. package/dist/xlsx/edit/index.d.ts.map +1 -1
  376. package/dist/xlsx/edit/session.d.ts.map +1 -1
  377. package/dist/xlsx/edit/shift-formulas.d.ts.map +1 -1
  378. package/dist/xlsx/edit/smart-art.d.ts +32 -0
  379. package/dist/xlsx/edit/smart-art.d.ts.map +1 -0
  380. package/dist/xlsx/edit/types.d.ts +12 -1
  381. package/dist/xlsx/edit/types.d.ts.map +1 -1
  382. package/dist/xlsx/embedded-chart-space.d.ts +19 -0
  383. package/dist/xlsx/embedded-chart-space.d.ts.map +1 -0
  384. package/dist/xlsx/index.cjs +6457 -3105
  385. package/dist/xlsx/index.d.ts +1 -0
  386. package/dist/xlsx/index.d.ts.map +1 -1
  387. package/dist/xlsx/index.mjs +6451 -3106
  388. package/dist/xlsx/load/index.cjs +5733 -3844
  389. package/dist/xlsx/load/index.mjs +5733 -3844
  390. package/dist/xlsx/model.d.ts +71 -15
  391. package/dist/xlsx/model.d.ts.map +1 -1
  392. package/dist/xlsx/read/chart.d.ts +10 -0
  393. package/dist/xlsx/read/chart.d.ts.map +1 -1
  394. package/dist/xlsx/read/drawing.d.ts.map +1 -1
  395. package/dist/xlsx/read/smart-art.d.ts.map +1 -1
  396. package/dist/xlsx/smart-art-notices.d.ts +6 -0
  397. package/dist/xlsx/smart-art-notices.d.ts.map +1 -0
  398. package/dist/xlsx/ui/commands/contextual.d.ts +6 -1
  399. package/dist/xlsx/ui/commands/contextual.d.ts.map +1 -1
  400. package/dist/xlsx/ui/commands/i18n/chart-series.d.ts.map +1 -1
  401. package/dist/xlsx/ui/commands/i18n/core-features.d.ts.map +1 -1
  402. package/dist/xlsx/ui/commands/i18n/index.d.ts.map +1 -1
  403. package/dist/xlsx/ui/commands/i18n/ribbon-tabs.d.ts.map +1 -1
  404. package/dist/xlsx/ui/commands/i18n/smartart.d.ts +3 -0
  405. package/dist/xlsx/ui/commands/i18n/smartart.d.ts.map +1 -0
  406. package/dist/xlsx/ui/commands/icons.d.ts.map +1 -1
  407. package/dist/xlsx/ui/index.cjs +6664 -2907
  408. package/dist/xlsx/ui/index.mjs +6663 -2907
  409. package/dist/xlsx/ui/locales/de/index.d.ts.map +1 -1
  410. package/dist/xlsx/ui/locales/de/smartart.d.ts +2 -0
  411. package/dist/xlsx/ui/locales/de/smartart.d.ts.map +1 -0
  412. package/dist/xlsx/ui/locales/en/index.d.ts.map +1 -1
  413. package/dist/xlsx/ui/locales/en/smartart.d.ts +2 -0
  414. package/dist/xlsx/ui/locales/en/smartart.d.ts.map +1 -0
  415. package/dist/xlsx/ui/locales/es/index.d.ts.map +1 -1
  416. package/dist/xlsx/ui/locales/es/smartart.d.ts +2 -0
  417. package/dist/xlsx/ui/locales/es/smartart.d.ts.map +1 -0
  418. package/dist/xlsx/ui/locales/fr/index.d.ts.map +1 -1
  419. package/dist/xlsx/ui/locales/fr/smartart.d.ts +2 -0
  420. package/dist/xlsx/ui/locales/fr/smartart.d.ts.map +1 -0
  421. package/dist/xlsx/ui/locales/zh-CN/index.d.ts.map +1 -1
  422. package/dist/xlsx/ui/locales/zh-CN/smartart.d.ts +2 -0
  423. package/dist/xlsx/ui/locales/zh-CN/smartart.d.ts.map +1 -0
  424. package/dist/xlsx/write/chart-cache.d.ts.map +1 -1
  425. package/dist/xlsx/write/chart-colors.d.ts +1 -8
  426. package/dist/xlsx/write/chart-colors.d.ts.map +1 -1
  427. package/dist/xlsx/write/chart-space.d.ts +8 -0
  428. package/dist/xlsx/write/chart-space.d.ts.map +1 -1
  429. package/dist/xlsx/write/chart-title.d.ts +2 -2
  430. package/dist/xlsx/write/chart-title.d.ts.map +1 -1
  431. package/dist/xlsx/write/chart.d.ts +4 -3
  432. package/dist/xlsx/write/chart.d.ts.map +1 -1
  433. package/dist/xlsx/write/drawing.d.ts +10 -3
  434. package/dist/xlsx/write/drawing.d.ts.map +1 -1
  435. package/dist/xlsx/write/smart-art.d.ts +17 -0
  436. package/dist/xlsx/write/smart-art.d.ts.map +1 -0
  437. package/package.json +6 -1
  438. package/dist/PptxHandler-KBJ4TN3T.mjs +0 -4
  439. package/dist/pptx/chunks/elements-iUzpAeqR.d.ts.map +0 -1
  440. package/dist/pptx/chunks/index-4FmgJajb.d.ts.map +0 -1
  441. package/dist/pptx/chunks/index-nKQ4s7FA.d.ts.map +0 -1
  442. package/dist/pptx/chunks/smart-art-ENMMEbmW.d.ts.map +0 -1
  443. package/dist/xlsx/write/chart-patch.d.ts +0 -9
  444. package/dist/xlsx/write/chart-patch.d.ts.map +0 -1
@@ -10,16 +10,16 @@ import { toggleMark } from 'prosemirror-commands';
10
10
  import { DecorationSet, Decoration } from 'prosemirror-view';
11
11
 
12
12
  // docx/ui/backstage-focus.ts
13
- function backstageFocus(element2) {
13
+ function backstageFocus(element3) {
14
14
  let opener = null;
15
15
  const siblings = /* @__PURE__ */ new Map();
16
- const active = () => element2.getRootNode().activeElement;
16
+ const active = () => element3.getRootNode().activeElement;
17
17
  return {
18
18
  open() {
19
19
  const current = active();
20
- if (current instanceof HTMLElement && !element2.contains(current)) opener = current;
21
- for (const sibling of element2.parentElement?.children ?? []) {
22
- if (!(sibling instanceof HTMLElement) || sibling === element2 || siblings.has(sibling))
20
+ if (current instanceof HTMLElement && !element3.contains(current)) opener = current;
21
+ for (const sibling of element3.parentElement?.children ?? []) {
22
+ if (!(sibling instanceof HTMLElement) || sibling === element3 || siblings.has(sibling))
23
23
  continue;
24
24
  siblings.set(sibling, Boolean(sibling.inert));
25
25
  sibling.inert = true;
@@ -369,34 +369,34 @@ var buildXml = (node) => {
369
369
  var isElement = (node) => node.nodeType === 1;
370
370
  var elements = (parent) => Array.from(parent.childNodes).filter(isElement);
371
371
  var makeNS = (doc, ns, qualified) => doc.createElementNS(ns, qualified);
372
- function named(element2, local, ns, lenient = true) {
373
- if (!element2 || element2.localName !== local) return false;
374
- return element2.namespaceURI === ns || lenient && !element2.namespaceURI;
372
+ function named(element3, local, ns, lenient = true) {
373
+ if (!element3 || element3.localName !== local) return false;
374
+ return element3.namespaceURI === ns || lenient && !element3.namespaceURI;
375
375
  }
376
- var children = (parent, local, ns, lenient = true) => elements(parent).filter((element2) => named(element2, local, ns, lenient));
376
+ var children = (parent, local, ns, lenient = true) => elements(parent).filter((element3) => named(element3, local, ns, lenient));
377
377
  var first = (parent, local, ns, lenient = true) => parent ? children(parent, local, ns, lenient)[0] : void 0;
378
- function attr(element2, local, ns, prefix) {
379
- return element2?.getAttributeNS(ns, local) ?? element2?.getAttribute(`${prefix}:${local}`) ?? void 0;
378
+ function attr(element3, local, ns, prefix) {
379
+ return element3?.getAttributeNS(ns, local) ?? element3?.getAttribute(`${prefix}:${local}`) ?? void 0;
380
380
  }
381
381
 
382
382
  // docx/xml.ts
383
383
  var WORD_NS = NS.w;
384
384
  var WORD_DATE_UTC_NS = "http://schemas.microsoft.com/office/word/2023/wordml/word16du";
385
385
  var parseXml2 = (xml) => parseXml(xml, { label: "DOCX" });
386
- var named2 = (element2, local) => named(element2, local, WORD_NS);
386
+ var named2 = (element3, local) => named(element3, local, WORD_NS);
387
387
  var children2 = (parent, local) => children(parent, local, WORD_NS);
388
388
  var first2 = (parent, local) => first(parent, local, WORD_NS);
389
- var getW = (element2, local) => attr(element2, local, WORD_NS, "w");
389
+ var getW = (element3, local) => attr(element3, local, WORD_NS, "w");
390
390
  var makeW = (doc, local) => doc.createElementNS(WORD_NS, `w:${local}`);
391
391
  var XMLNS = "http://www.w3.org/2000/xmlns/";
392
- function importElement(doc, element2) {
393
- const imported = doc.importNode(element2, true);
392
+ function importElement(doc, element3) {
393
+ const imported = doc.importNode(element3, true);
394
394
  const root = doc.documentElement;
395
395
  const drop = (node) => {
396
396
  for (const attribute of Array.from(node.attributes))
397
397
  if (attribute.namespaceURI === XMLNS && root?.lookupNamespaceURI(attribute.prefix ? attribute.localName : null) === attribute.value)
398
398
  node.removeAttributeNode(attribute);
399
- for (const child of Array.from(node.childNodes)) if (isElement(child)) drop(child);
399
+ for (const child3 of Array.from(node.childNodes)) if (isElement(child3)) drop(child3);
400
400
  };
401
401
  drop(imported);
402
402
  return imported;
@@ -417,9 +417,9 @@ function parseOnOff(value) {
417
417
  return void 0;
418
418
  }
419
419
  }
420
- function onOffElement(element2) {
421
- if (!element2) return void 0;
422
- const value = getW(element2, "val");
420
+ function onOffElement(element3) {
421
+ if (!element3) return void 0;
422
+ const value = getW(element3, "val");
423
423
  return value === void 0 ? true : parseOnOff(value);
424
424
  }
425
425
  var SAFE_INTEGER = /^-?\d+$/;
@@ -496,14 +496,14 @@ function parseTintShade(value) {
496
496
  var KINDS = { textInput: "text", checkBox: "checkbox", ddList: "dropDown" };
497
497
  var elementOfKind = (kind) => Object.keys(KINDS).find((name) => KINDS[name] === kind);
498
498
  var elementChildren = (parent) => Array.from(parent.childNodes).filter(isElement);
499
- function infoText(element2) {
500
- if (!element2) return void 0;
501
- const type = getW(element2, "type") ?? "text";
502
- return isStInfoTextType(type) ? { type, value: getW(element2, "val") ?? "" } : void 0;
499
+ function infoText(element3) {
500
+ if (!element3) return void 0;
501
+ const type = getW(element3, "type") ?? "text";
502
+ return isStInfoTextType(type) ? { type, value: getW(element3, "val") ?? "" } : void 0;
503
503
  }
504
504
  function parseFormField(ffData) {
505
505
  const typed = elementChildren(ffData).find(
506
- (child) => Object.hasOwn(KINDS, child.localName ?? "")
506
+ (child3) => Object.hasOwn(KINDS, child3.localName ?? "")
507
507
  );
508
508
  if (!typed || typed.namespaceURI !== WORD_NS) return void 0;
509
509
  const field = { kind: KINDS[typed.localName] };
@@ -542,7 +542,7 @@ function parseFormField(ffData) {
542
542
  const result = parseInteger(getW(first2(typed, "result"), "val"));
543
543
  const fallback = parseInteger(getW(first2(typed, "default"), "val"));
544
544
  field.dropDown = {
545
- entries: elementChildren(typed).filter((child) => named2(child, "listEntry")).map((entry) => getW(entry, "val") ?? ""),
545
+ entries: elementChildren(typed).filter((child3) => named2(child3, "listEntry")).map((entry) => getW(entry, "val") ?? ""),
546
546
  ...result !== void 0 && { result },
547
547
  ...fallback !== void 0 && { default: fallback }
548
548
  };
@@ -550,18 +550,18 @@ function parseFormField(ffData) {
550
550
  field.sourceXml = buildXml(ffData);
551
551
  return field;
552
552
  }
553
- var isModeledFormFieldData = (element2) => named2(element2, "ffData") && parseFormField(element2) !== void 0;
553
+ var isModeledFormFieldData = (element3) => named2(element3, "ffData") && parseFormField(element3) !== void 0;
554
554
  var withoutSource = ({ sourceXml: _source, ...field }) => field;
555
555
  var sameField = (a, b) => JSON.stringify(withoutSource(a)) === JSON.stringify(withoutSource(b));
556
556
  function valued(doc, local, value) {
557
- const element2 = makeW(doc, local);
558
- element2.setAttributeNS(WORD_NS, "w:val", value);
559
- return element2;
557
+ const element3 = makeW(doc, local);
558
+ element3.setAttributeNS(WORD_NS, "w:val", value);
559
+ return element3;
560
560
  }
561
561
  var onOff = (doc, local, on) => on ? makeW(doc, local) : valued(doc, local, "0");
562
562
  function kindElement(doc, field) {
563
- const element2 = makeW(doc, elementOfKind(field.kind));
564
- const add3 = (child) => child && element2.appendChild(child);
563
+ const element3 = makeW(doc, elementOfKind(field.kind));
564
+ const add3 = (child3) => child3 && element3.appendChild(child3);
565
565
  if (field.kind === "text") {
566
566
  const input = field.textInput ?? {};
567
567
  if (input.type) add3(valued(doc, "type", input.type));
@@ -581,7 +581,7 @@ function kindElement(doc, field) {
581
581
  if (list.default !== void 0) add3(valued(doc, "default", String(list.default)));
582
582
  for (const entry of list.entries) add3(valued(doc, "listEntry", entry));
583
583
  }
584
- return element2;
584
+ return element3;
585
585
  }
586
586
  function setChild(ffData, local, next) {
587
587
  const current = first2(ffData, local);
@@ -589,7 +589,7 @@ function setChild(ffData, local, next) {
589
589
  else if (current) ffData.removeChild(current);
590
590
  else if (next) {
591
591
  const kind = elementChildren(ffData).find(
592
- (child) => Object.hasOwn(KINDS, child.localName ?? "")
592
+ (child3) => Object.hasOwn(KINDS, child3.localName ?? "")
593
593
  );
594
594
  ffData.insertBefore(next, kind ?? null);
595
595
  }
@@ -605,14 +605,14 @@ function writeFormFieldData(doc, field, source) {
605
605
  for (const key of ["helpText", "statusText"]) {
606
606
  if (JSON.stringify(current?.[key]) === JSON.stringify(field[key])) continue;
607
607
  const text2 = field[key];
608
- const element2 = text2 && makeW(doc, key);
609
- if (element2 && text2) {
610
- element2.setAttributeNS(WORD_NS, "w:type", text2.type);
611
- element2.setAttributeNS(WORD_NS, "w:val", text2.value);
608
+ const element3 = text2 && makeW(doc, key);
609
+ if (element3 && text2) {
610
+ element3.setAttributeNS(WORD_NS, "w:type", text2.type);
611
+ element3.setAttributeNS(WORD_NS, "w:val", text2.value);
612
612
  }
613
- setChild(ffData, key, element2);
613
+ setChild(ffData, key, element3);
614
614
  }
615
- const kind = elementChildren(ffData).find((child) => Object.hasOwn(KINDS, child.localName ?? ""));
615
+ const kind = elementChildren(ffData).find((child3) => Object.hasOwn(KINDS, child3.localName ?? ""));
616
616
  if (kind) ffData.replaceChild(kindElement(doc, field), kind);
617
617
  else ffData.appendChild(kindElement(doc, field));
618
618
  return ffData;
@@ -953,10 +953,10 @@ function cellText(doc, pos) {
953
953
  const cell = doc.nodeAt(pos);
954
954
  const text2 = { from: pos + 2, to: pos + cell.nodeSize - 2 };
955
955
  let first3 = true;
956
- cell.forEach((child, offset) => {
957
- if (child.type.name !== "paragraph") return;
956
+ cell.forEach((child3, offset) => {
957
+ if (child3.type.name !== "paragraph") return;
958
958
  if (first3) text2.from = pos + 2 + offset;
959
- text2.to = pos + offset + child.nodeSize;
959
+ text2.to = pos + offset + child3.nodeSize;
960
960
  first3 = false;
961
961
  });
962
962
  return text2;
@@ -964,13 +964,13 @@ function cellText(doc, pos) {
964
964
  function cellContent(state, cell, text2) {
965
965
  const nodes = [];
966
966
  let placed = false;
967
- cell.forEach((child) => {
968
- if (child.type.name !== "paragraph") {
969
- nodes.push(child);
967
+ cell.forEach((child3) => {
968
+ if (child3.type.name !== "paragraph") {
969
+ nodes.push(child3);
970
970
  return;
971
971
  }
972
- const attrs2 = child.attrs.contentControl ? { ...child.attrs, contentControl: null } : child.attrs;
973
- nodes.push(child.type.create(attrs2, placed ? null : text2));
972
+ const attrs2 = child3.attrs.contentControl ? { ...child3.attrs, contentControl: null } : child3.attrs;
973
+ nodes.push(child3.type.create(attrs2, placed ? null : text2));
974
974
  placed = true;
975
975
  });
976
976
  if (!placed) nodes.push(state.schema.nodes.paragraph.create(null, text2));
@@ -1386,9 +1386,9 @@ function pastedControlSources(slice, doc, copied = /* @__PURE__ */ new Set()) {
1386
1386
  const mapFragment = (fragment) => {
1387
1387
  const nodes = [];
1388
1388
  let changed = false;
1389
- fragment.forEach((child) => {
1390
- const next = mapNode(child);
1391
- changed ||= next !== child;
1389
+ fragment.forEach((child3) => {
1390
+ const next = mapNode(child3);
1391
+ changed ||= next !== child3;
1392
1392
  nodes.push(next);
1393
1393
  });
1394
1394
  return changed ? Fragment.fromArray(nodes) : fragment;
@@ -1552,7 +1552,7 @@ var IdempotencyCache = class {
1552
1552
  };
1553
1553
  function freezeDeep(value) {
1554
1554
  if (value && typeof value === "object" && !Object.isFrozen(value)) {
1555
- for (const child of Object.values(value)) freezeDeep(child);
1555
+ for (const child3 of Object.values(value)) freezeDeep(child3);
1556
1556
  Object.freeze(value);
1557
1557
  }
1558
1558
  return value;
@@ -1591,21 +1591,21 @@ function repairCollaborativeDocumentIds(state, clientId, idGenerator = createCol
1591
1591
  var repairCollaborativeParagraphIds = repairCollaborativeDocumentIds;
1592
1592
 
1593
1593
  // docx/revision-properties.ts
1594
- function propertiesSignature(element2) {
1594
+ function propertiesSignature(element3) {
1595
1595
  return JSON.stringify([
1596
- element2.namespaceURI,
1597
- element2.localName,
1598
- Array.from(element2.attributes).filter((attribute) => attribute.namespaceURI !== "http://www.w3.org/2000/xmlns/").map((attribute) => [attribute.namespaceURI, attribute.localName, attribute.value]).sort((a, b) => JSON.stringify(a).localeCompare(JSON.stringify(b))),
1599
- Array.from(element2.childNodes).flatMap(
1600
- (child) => child.nodeType === 1 ? [propertiesSignature(child)] : child.textContent?.trim() ? [child.textContent] : []
1596
+ element3.namespaceURI,
1597
+ element3.localName,
1598
+ Array.from(element3.attributes).filter((attribute) => attribute.namespaceURI !== "http://www.w3.org/2000/xmlns/").map((attribute) => [attribute.namespaceURI, attribute.localName, attribute.value]).sort((a, b) => JSON.stringify(a).localeCompare(JSON.stringify(b))),
1599
+ Array.from(element3.childNodes).flatMap(
1600
+ (child3) => child3.nodeType === 1 ? [propertiesSignature(child3)] : child3.textContent?.trim() ? [child3.textContent] : []
1601
1601
  )
1602
1602
  ]);
1603
1603
  }
1604
1604
  function parsePropertiesSnapshot(xml, local) {
1605
- const element2 = parseXml2(xml).documentElement;
1606
- if (!named2(element2, local))
1605
+ const element3 = parseXml2(xml).documentElement;
1606
+ if (!named2(element3, local))
1607
1607
  throw new Error(`A formatting revision snapshot must contain Word ${local} properties.`);
1608
- return element2;
1608
+ return element3;
1609
1609
  }
1610
1610
 
1611
1611
  // docx/element-order.ts
@@ -1659,14 +1659,14 @@ function orderChildren(parent, order) {
1659
1659
  const elements2 = Array.from(parent.childNodes).filter(isElement);
1660
1660
  const rankOf = (name) => order.findIndex((entry) => typeof entry === "string" ? entry === name : entry.includes(name));
1661
1661
  let previousRank = -1;
1662
- const ranked = elements2.map((element2, index) => {
1663
- const rank2 = element2.namespaceURI === WORD_NS ? rankOf(element2.localName ?? "") : -1;
1662
+ const ranked = elements2.map((element3, index) => {
1663
+ const rank2 = element3.namespaceURI === WORD_NS ? rankOf(element3.localName ?? "") : -1;
1664
1664
  if (rank2 >= 0) previousRank = rank2;
1665
- return { element: element2, index, rank: rank2 >= 0 ? rank2 : previousRank + 0.5 };
1665
+ return { element: element3, index, rank: rank2 >= 0 ? rank2 : previousRank + 0.5 };
1666
1666
  });
1667
1667
  const sorted = [...ranked].sort((a, b) => a.rank - b.rank || a.index - b.index);
1668
1668
  if (sorted.every((entry, index) => entry.element === elements2[index])) return;
1669
- for (const { element: element2 } of sorted) parent.appendChild(element2);
1669
+ for (const { element: element3 } of sorted) parent.appendChild(element3);
1670
1670
  }
1671
1671
 
1672
1672
  // color/color-primitives.ts
@@ -2137,7 +2137,7 @@ var WORD_2010_NS = "http://schemas.microsoft.com/office/word/2010/wordml";
2137
2137
  var MC = "http://schemas.openxmlformats.org/markup-compatibility/2006";
2138
2138
  var XMLNS2 = "http://www.w3.org/2000/xmlns/";
2139
2139
  var ligatureElements = (props) => elements(props).filter(
2140
- (element2) => element2.namespaceURI === WORD_2010_NS && element2.localName === "ligatures"
2140
+ (element3) => element3.namespaceURI === WORD_2010_NS && element3.localName === "ligatures"
2141
2141
  );
2142
2142
  var parseLigatures = (props) => {
2143
2143
  const value = ligatureElements(props)[0]?.getAttributeNS(WORD_2010_NS, "val");
@@ -2162,12 +2162,12 @@ function declareIgnorableExtension(doc, ns, preferred) {
2162
2162
  return prefix;
2163
2163
  }
2164
2164
  function writeLigatures(doc, props, value) {
2165
- for (const element3 of ligatureElements(props)) props.removeChild(element3);
2165
+ for (const element4 of ligatureElements(props)) props.removeChild(element4);
2166
2166
  if (value === void 0) return;
2167
2167
  const prefix = declareIgnorableExtension(doc, WORD_2010_NS, "w14");
2168
- const element2 = doc.createElementNS(WORD_2010_NS, `${prefix}:ligatures`);
2169
- element2.setAttributeNS(WORD_2010_NS, `${prefix}:val`, value);
2170
- props.appendChild(element2);
2168
+ const element3 = doc.createElementNS(WORD_2010_NS, `${prefix}:ligatures`);
2169
+ element3.setAttributeNS(WORD_2010_NS, `${prefix}:val`, value);
2170
+ props.appendChild(element3);
2171
2171
  }
2172
2172
  function enumValue(guard, raw, label) {
2173
2173
  if (raw === null || raw === void 0 || raw === "") return void 0;
@@ -2320,18 +2320,18 @@ function parseRunProperties(props) {
2320
2320
  }
2321
2321
 
2322
2322
  // docx/write-run-extra.ts
2323
- function setAttribute(element2, local, value) {
2324
- element2.setAttributeNS(WORD_NS, `w:${local}`, value);
2323
+ function setAttribute(element3, local, value) {
2324
+ element3.setAttributeNS(WORD_NS, `w:${local}`, value);
2325
2325
  }
2326
- function removeChildren(element2, local) {
2327
- for (const child of children2(element2, local)) element2.removeChild(child);
2326
+ function removeChildren(element3, local) {
2327
+ for (const child3 of children2(element3, local)) element3.removeChild(child3);
2328
2328
  }
2329
2329
  function setToggle(doc, props, local, value) {
2330
2330
  removeChildren(props, local);
2331
2331
  if (value === void 0) return;
2332
- const element2 = makeW(doc, local);
2333
- if (!value) setAttribute(element2, "val", "0");
2334
- props.appendChild(element2);
2332
+ const element3 = makeW(doc, local);
2333
+ if (!value) setAttribute(element3, "val", "0");
2334
+ props.appendChild(element3);
2335
2335
  }
2336
2336
  function setExtendedRunProperties(doc, props, run, base) {
2337
2337
  const changed = (key) => runPropertyChanged(run, base, key);
@@ -2356,9 +2356,9 @@ function setExtendedRunProperties(doc, props, run, base) {
2356
2356
  if (!changed(key)) continue;
2357
2357
  removeChildren(props, local);
2358
2358
  if (run[key] === void 0) continue;
2359
- const element2 = makeW(doc, local);
2360
- setAttribute(element2, "val", String(run[key]));
2361
- props.appendChild(element2);
2359
+ const element3 = makeW(doc, local);
2360
+ setAttribute(element3, "val", String(run[key]));
2361
+ props.appendChild(element3);
2362
2362
  }
2363
2363
  if (changed("characterSpacingTwips")) {
2364
2364
  removeChildren(props, "spacing");
@@ -2453,7 +2453,7 @@ function buildWatermarkRun(doc, spec, uniqueId) {
2453
2453
  lock.setAttributeNS(VML_NS, "v:ext", "edit");
2454
2454
  lock.setAttribute("text", "t");
2455
2455
  lock.setAttribute("shapetype", "t");
2456
- for (const child of [formulas, path, typePath, handles, lock]) type.appendChild(child);
2456
+ for (const child3 of [formulas, path, typePath, handles, lock]) type.appendChild(child3);
2457
2457
  const size = watermarkSizePt(spec);
2458
2458
  const shape = v("shape");
2459
2459
  shape.setAttribute("id", `${WATERMARK_PREFIX}${uniqueId}`);
@@ -2474,7 +2474,7 @@ function buildWatermarkRun(doc, spec, uniqueId) {
2474
2474
  const wrap = makeNS(doc, WORD10_NS, "w10:wrap");
2475
2475
  wrap.setAttribute("anchorx", "margin");
2476
2476
  wrap.setAttribute("anchory", "margin");
2477
- for (const child of [fill, text2, wrap]) shape.appendChild(child);
2477
+ for (const child3 of [fill, text2, wrap]) shape.appendChild(child3);
2478
2478
  pict.appendChild(type);
2479
2479
  pict.appendChild(shape);
2480
2480
  run.appendChild(pict);
@@ -2530,7 +2530,7 @@ function patchTextBox(doc, drawing, image, base) {
2530
2530
  if (JSON.stringify(image.textBoxText) !== JSON.stringify(base.textBoxText)) {
2531
2531
  const content = descendants(drawing, W_NS, "txbxContent")[0];
2532
2532
  if (content) {
2533
- for (const child of Array.from(content.childNodes)) content.removeChild(child);
2533
+ for (const child3 of Array.from(content.childNodes)) content.removeChild(child3);
2534
2534
  add(content, ...paragraphsFor(doc, image.textBoxText ?? []));
2535
2535
  }
2536
2536
  }
@@ -2603,33 +2603,33 @@ var COLOR_ELEMENTS = {
2603
2603
  scrgbClr: "scrgb",
2604
2604
  hslClr: "hsl"
2605
2605
  };
2606
- function colorValue(kind, element2) {
2607
- const attribute = (name) => element2.getAttribute(name) ?? "";
2606
+ function colorValue(kind, element3) {
2607
+ const attribute = (name) => element3.getAttribute(name) ?? "";
2608
2608
  if (kind === "scrgb") return `${attribute("r")},${attribute("g")},${attribute("b")}`;
2609
2609
  if (kind === "hsl") return `${attribute("hue")},${attribute("sat")},${attribute("lum")}`;
2610
2610
  return attribute("val");
2611
2611
  }
2612
2612
  function parseDrawingColorIn(container) {
2613
2613
  if (!container) return void 0;
2614
- for (const element2 of elements(container)) {
2615
- const kind = COLOR_ELEMENTS[element2.localName];
2616
- if (!kind || element2.namespaceURI && element2.namespaceURI !== NS.a) continue;
2617
- return parseDrawingColor(element2);
2614
+ for (const element3 of elements(container)) {
2615
+ const kind = COLOR_ELEMENTS[element3.localName];
2616
+ if (!kind || element3.namespaceURI && element3.namespaceURI !== NS.a) continue;
2617
+ return parseDrawingColor(element3);
2618
2618
  }
2619
2619
  return void 0;
2620
2620
  }
2621
- function parseDrawingColor(element2) {
2622
- const kind = COLOR_ELEMENTS[element2.localName];
2621
+ function parseDrawingColor(element3) {
2622
+ const kind = COLOR_ELEMENTS[element3.localName];
2623
2623
  if (!kind) return void 0;
2624
2624
  const color = {
2625
2625
  kind,
2626
- value: colorValue(kind, element2),
2627
- transforms: elements(element2).map((child) => ({
2628
- name: child.localName,
2629
- value: child.getAttribute("val") ?? ""
2626
+ value: colorValue(kind, element3),
2627
+ transforms: elements(element3).map((child3) => ({
2628
+ name: child3.localName,
2629
+ value: child3.getAttribute("val") ?? ""
2630
2630
  }))
2631
2631
  };
2632
- const fallback = kind === "system" ? element2.getAttribute("lastClr") : null;
2632
+ const fallback = kind === "system" ? element3.getAttribute("lastClr") : null;
2633
2633
  if (fallback) color.fallback = fallback;
2634
2634
  return color;
2635
2635
  }
@@ -3024,11 +3024,758 @@ function themeSlotHex(color) {
3024
3024
  return value ? value.toUpperCase() : void 0;
3025
3025
  }
3026
3026
 
3027
+ // drawingml/write-line.ts
3028
+ var FILLS = /* @__PURE__ */ new Set(["noFill", "solidFill", "gradFill", "pattFill"]);
3029
+ function dropDrawingDeclarations(element3) {
3030
+ if (element3.getAttribute("xmlns:a") === NS.a) element3.removeAttribute("xmlns:a");
3031
+ for (const child3 of elements(element3)) dropDrawingDeclarations(child3);
3032
+ }
3033
+ function patchDrawingLine(ln, line2) {
3034
+ if (line2.widthEmu === void 0) ln.removeAttribute("w");
3035
+ else ln.setAttribute("w", String(Math.round(line2.widthEmu)));
3036
+ if (line2.cap === void 0) ln.removeAttribute("cap");
3037
+ else ln.setAttribute("cap", line2.cap);
3038
+ const fill = line2.fill && drawingFillXml(line2.fill);
3039
+ if (fill || !line2.fill) {
3040
+ for (const node of elements(ln))
3041
+ if (node.namespaceURI === NS.a && FILLS.has(node.localName)) ln.removeChild(node);
3042
+ }
3043
+ if (fill) {
3044
+ const parsed = parseXml(`<w xmlns:a="${NS.a}">${fill}</w>`).documentElement;
3045
+ for (const node of elements(parsed).reverse()) {
3046
+ const imported = ln.ownerDocument.importNode(node, true);
3047
+ dropDrawingDeclarations(imported);
3048
+ ln.insertBefore(imported, ln.firstChild);
3049
+ }
3050
+ }
3051
+ const dashes = elements(ln).filter(
3052
+ (node) => node.namespaceURI === NS.a && (node.localName === "prstDash" || node.localName === "custDash")
3053
+ );
3054
+ if (line2.dash === void 0) {
3055
+ for (const node of dashes) if (node.localName === "prstDash") ln.removeChild(node);
3056
+ return;
3057
+ }
3058
+ const dash = ln.ownerDocument.createElementNS(NS.a, "a:prstDash");
3059
+ dash.setAttribute("val", line2.dash);
3060
+ for (const node of dashes) ln.removeChild(node);
3061
+ const afterFill = elements(ln).find(
3062
+ (node) => node.namespaceURI !== NS.a || !FILLS.has(node.localName)
3063
+ );
3064
+ ln.insertBefore(dash, afterFill ?? null);
3065
+ }
3066
+ function drawingLineXml(line2) {
3067
+ const doc = parseXml(`<a:ln xmlns:a="${NS.a}"/>`);
3068
+ patchDrawingLine(doc.documentElement, line2);
3069
+ return buildXml(doc);
3070
+ }
3071
+
3027
3072
  // docx/shape-parse.ts
3028
3073
  var A_NS2 = "http://schemas.openxmlformats.org/drawingml/2006/main";
3029
3074
  var WPS_NS2 = "http://schemas.microsoft.com/office/word/2010/wordprocessingShape";
3030
3075
  var W_NS2 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
3031
3076
 
3077
+ // diagram/layout/smartart-tree.ts
3078
+ function buildForest(nodes) {
3079
+ const map = /* @__PURE__ */ new Map();
3080
+ for (const n2 of nodes) {
3081
+ map.set(n2.id, { node: n2, children: [] });
3082
+ }
3083
+ const roots = [];
3084
+ for (const n2 of nodes) {
3085
+ const tn = map.get(n2.id);
3086
+ if (n2.parentId && map.has(n2.parentId)) {
3087
+ map.get(n2.parentId).children.push(tn);
3088
+ } else {
3089
+ roots.push(tn);
3090
+ }
3091
+ }
3092
+ return roots;
3093
+ }
3094
+ var MAX_TREE_DEPTH = 256;
3095
+ function treeWidth(t, depth = 0) {
3096
+ if (depth >= MAX_TREE_DEPTH) {
3097
+ return 1;
3098
+ }
3099
+ if (t.children.length === 0) {
3100
+ return 1;
3101
+ }
3102
+ let sum = 0;
3103
+ for (const c of t.children) {
3104
+ sum += treeWidth(c, depth + 1);
3105
+ }
3106
+ return sum;
3107
+ }
3108
+ function treeDepth(t, depth = 0) {
3109
+ if (depth >= MAX_TREE_DEPTH) {
3110
+ return 0;
3111
+ }
3112
+ if (t.children.length === 0) {
3113
+ return 1;
3114
+ }
3115
+ let max = 0;
3116
+ for (const c of t.children) {
3117
+ const d = treeDepth(c, depth + 1);
3118
+ if (d > max) {
3119
+ max = d;
3120
+ }
3121
+ }
3122
+ return 1 + max;
3123
+ }
3124
+
3125
+ // diagram/edit/reflow-directional.ts
3126
+ function reflowTimeline(nodes, bounds) {
3127
+ const padding = 24;
3128
+ const lineY = bounds.y + bounds.height / 2;
3129
+ const lineStartX = bounds.x + padding;
3130
+ const lineEndX = bounds.x + bounds.width - padding;
3131
+ const lineLen = lineEndX - lineStartX;
3132
+ const nodeW = Math.max(40, Math.min(80, lineLen / (nodes.length * 1.2)));
3133
+ const nodeH = nodeW * 0.5;
3134
+ const labelOffset = Math.min(bounds.height * 0.28, 40);
3135
+ const shapes = [];
3136
+ shapes.push({
3137
+ id: "reflow-timeline-bar",
3138
+ shapeType: "rect",
3139
+ x: lineStartX,
3140
+ y: lineY - 2,
3141
+ width: lineLen,
3142
+ height: 4,
3143
+ fillColor: "#94a3b8"
3144
+ });
3145
+ nodes.forEach((node, i) => {
3146
+ const x = nodes.length === 1 ? (lineStartX + lineEndX) / 2 : lineStartX + i / (nodes.length - 1) * lineLen;
3147
+ const above = i % 2 === 0;
3148
+ const ny = above ? lineY - labelOffset - nodeH / 2 : lineY + labelOffset - nodeH / 2;
3149
+ shapes.push({
3150
+ id: `reflow-timeline-${node.id}`,
3151
+ shapeType: "roundRect",
3152
+ x: x - nodeW / 2,
3153
+ y: ny,
3154
+ width: nodeW,
3155
+ height: nodeH,
3156
+ text: node.text,
3157
+ fontSize: Math.max(6, Math.min(10, nodeW * 0.1))
3158
+ });
3159
+ });
3160
+ return shapes;
3161
+ }
3162
+ function reflowRelationship(nodes, bounds) {
3163
+ const shapes = [];
3164
+ if (nodes.length <= 2) {
3165
+ const padding = 16;
3166
+ const arrowGap = 24;
3167
+ const usableW = bounds.width - padding * 2 - arrowGap;
3168
+ const nodeW = usableW / nodes.length;
3169
+ const nodeH = bounds.height * 0.5;
3170
+ const yOffset = bounds.y + (bounds.height - nodeH) / 2;
3171
+ nodes.forEach((node, i) => {
3172
+ shapes.push({
3173
+ id: `reflow-rel-${node.id}`,
3174
+ shapeType: "roundRect",
3175
+ x: bounds.x + padding + i * (nodeW + arrowGap),
3176
+ y: yOffset,
3177
+ width: nodeW,
3178
+ height: nodeH,
3179
+ text: node.text,
3180
+ fontSize: Math.max(8, Math.min(11, nodeW * 0.1))
3181
+ });
3182
+ });
3183
+ if (nodes.length === 2) {
3184
+ const arrowX = bounds.x + padding + nodeW;
3185
+ const arrowY = yOffset + nodeH / 2 - 6;
3186
+ shapes.push({
3187
+ id: "reflow-rel-arrow",
3188
+ shapeType: "leftRightArrow",
3189
+ x: arrowX,
3190
+ y: arrowY,
3191
+ width: arrowGap,
3192
+ height: 12,
3193
+ fillColor: "#94a3b8"
3194
+ });
3195
+ }
3196
+ } else {
3197
+ const size = Math.min(bounds.width, bounds.height);
3198
+ const cx = bounds.x + bounds.width / 2;
3199
+ const cy = bounds.y + bounds.height / 2;
3200
+ const radius = size * 0.3;
3201
+ const nodeW = Math.max(size * 0.16, Math.min(size * 0.24, 250 / nodes.length));
3202
+ const nodeH = nodeW * 0.6;
3203
+ nodes.forEach((node, i) => {
3204
+ const angle = i / nodes.length * Math.PI * 2 - Math.PI / 2;
3205
+ const nx = cx + radius * Math.cos(angle) - nodeW / 2;
3206
+ const ny = cy + radius * Math.sin(angle) - nodeH / 2;
3207
+ shapes.push({
3208
+ id: `reflow-rel-${node.id}`,
3209
+ shapeType: "roundRect",
3210
+ x: nx,
3211
+ y: ny,
3212
+ width: nodeW,
3213
+ height: nodeH,
3214
+ text: node.text,
3215
+ fontSize: Math.max(7, Math.min(10, nodeW * 0.1))
3216
+ });
3217
+ });
3218
+ }
3219
+ return shapes;
3220
+ }
3221
+ function reflowChevron(nodes, bounds) {
3222
+ const padding = 8;
3223
+ const gap = 4;
3224
+ const usableW = bounds.width - padding * 2;
3225
+ const itemW = (usableW - gap * (nodes.length - 1)) / nodes.length;
3226
+ const itemH = Math.min(bounds.height - padding * 2, 60);
3227
+ const yOffset = bounds.y + (bounds.height - itemH) / 2;
3228
+ return nodes.map((node, i) => {
3229
+ const x = bounds.x + padding + i * (itemW + gap);
3230
+ return {
3231
+ id: `reflow-chevron-${node.id}`,
3232
+ shapeType: "chevron",
3233
+ x,
3234
+ y: yOffset,
3235
+ width: itemW,
3236
+ height: itemH,
3237
+ text: node.text,
3238
+ fontSize: Math.max(7, Math.min(11, itemW * 0.1))
3239
+ };
3240
+ });
3241
+ }
3242
+ function reflowBending(nodes, bounds) {
3243
+ const COLS = 4;
3244
+ const padding = 8;
3245
+ const gap = 6;
3246
+ const rows = Math.ceil(nodes.length / COLS);
3247
+ const usableW = bounds.width - padding * 2;
3248
+ const usableH = bounds.height - padding * 2;
3249
+ const cellW = (usableW - gap * (COLS - 1)) / COLS;
3250
+ const cellH = (usableH - gap * (rows - 1)) / Math.max(rows, 1);
3251
+ const boxW = cellW * 0.85;
3252
+ const boxH = Math.min(cellH * 0.7, 40);
3253
+ const shapes = [];
3254
+ nodes.forEach((node, i) => {
3255
+ const row = Math.floor(i / COLS);
3256
+ const colInRow = i % COLS;
3257
+ const col = row % 2 === 0 ? colInRow : COLS - 1 - colInRow;
3258
+ const nodeCx = bounds.x + padding + col * (cellW + gap) + cellW / 2;
3259
+ const nodeCy = bounds.y + padding + row * (cellH + gap) + cellH / 2;
3260
+ shapes.push({
3261
+ id: `reflow-bending-${node.id}`,
3262
+ shapeType: "roundRect",
3263
+ x: nodeCx - boxW / 2,
3264
+ y: nodeCy - boxH / 2,
3265
+ width: boxW,
3266
+ height: boxH,
3267
+ text: node.text,
3268
+ fontSize: Math.max(7, Math.min(10, boxW * 0.1))
3269
+ });
3270
+ if (i < nodes.length - 1) {
3271
+ const nextRow = Math.floor((i + 1) / COLS);
3272
+ const nextColInRow = (i + 1) % COLS;
3273
+ const nextCol = nextRow % 2 === 0 ? nextColInRow : COLS - 1 - nextColInRow;
3274
+ const nextCx = bounds.x + padding + nextCol * (cellW + gap) + cellW / 2;
3275
+ const nextCy = bounds.y + padding + nextRow * (cellH + gap) + cellH / 2;
3276
+ if (nextRow === row) {
3277
+ const dir = nextCx > nodeCx ? 1 : -1;
3278
+ const arrowX = dir > 0 ? nodeCx + boxW / 2 : nextCx + boxW / 2;
3279
+ const arrowW = Math.abs(nextCx - nodeCx) - boxW;
3280
+ shapes.push({
3281
+ id: `reflow-bending-arrow-${node.id}`,
3282
+ shapeType: dir > 0 ? "rightArrow" : "leftArrow",
3283
+ x: arrowX,
3284
+ y: nodeCy - 4,
3285
+ width: Math.max(arrowW, 4),
3286
+ height: 8,
3287
+ fillColor: "#94a3b8"
3288
+ });
3289
+ } else {
3290
+ const arrowY = nodeCy + boxH / 2;
3291
+ const arrowH = Math.abs(nextCy - nodeCy) - boxH;
3292
+ shapes.push({
3293
+ id: `reflow-bending-arrow-${node.id}`,
3294
+ shapeType: "downArrow",
3295
+ x: nodeCx - 4,
3296
+ y: arrowY,
3297
+ width: 8,
3298
+ height: Math.max(arrowH, 4),
3299
+ fillColor: "#94a3b8"
3300
+ });
3301
+ }
3302
+ }
3303
+ });
3304
+ return shapes;
3305
+ }
3306
+
3307
+ // diagram/edit/reflow-geometric.ts
3308
+ function reflowCycle(nodes, bounds) {
3309
+ const size = Math.min(bounds.width, bounds.height);
3310
+ const cx = bounds.x + bounds.width / 2;
3311
+ const cy = bounds.y + bounds.height / 2;
3312
+ const radius = size * 0.32;
3313
+ const nodeW = Math.max(size * 0.18, Math.min(size * 0.28, 300 / nodes.length));
3314
+ const nodeH = nodeW * 0.6;
3315
+ return nodes.map((node, i) => {
3316
+ const angle = i / nodes.length * Math.PI * 2 - Math.PI / 2;
3317
+ const nx = cx + radius * Math.cos(angle) - nodeW / 2;
3318
+ const ny = cy + radius * Math.sin(angle) - nodeH / 2;
3319
+ return {
3320
+ id: `reflow-cycle-${node.id}`,
3321
+ shapeType: "ellipse",
3322
+ x: nx,
3323
+ y: ny,
3324
+ width: nodeW,
3325
+ height: nodeH,
3326
+ text: node.text,
3327
+ fontSize: Math.max(7, Math.min(10, nodeW * 0.1))
3328
+ };
3329
+ });
3330
+ }
3331
+ function reflowMatrix(nodes, bounds) {
3332
+ const cols = Math.ceil(Math.sqrt(nodes.length));
3333
+ const rows = Math.ceil(nodes.length / cols);
3334
+ const padding = 8;
3335
+ const gap = 6;
3336
+ const usableW = bounds.width - padding * 2;
3337
+ const usableH = bounds.height - padding * 2;
3338
+ const cellW = (usableW - gap * (cols - 1)) / cols;
3339
+ const cellH = (usableH - gap * (rows - 1)) / rows;
3340
+ return nodes.map((node, i) => {
3341
+ const col = i % cols;
3342
+ const row = Math.floor(i / cols);
3343
+ return {
3344
+ id: `reflow-matrix-${node.id}`,
3345
+ shapeType: "roundRect",
3346
+ x: bounds.x + padding + col * (cellW + gap),
3347
+ y: bounds.y + padding + row * (cellH + gap),
3348
+ width: cellW,
3349
+ height: cellH,
3350
+ text: node.text,
3351
+ fontSize: Math.max(8, Math.min(11, Math.min(cellW, cellH) * 0.12))
3352
+ };
3353
+ });
3354
+ }
3355
+ function reflowTarget(nodes, bounds) {
3356
+ const cx = bounds.x + bounds.width / 2;
3357
+ const cy = bounds.y + bounds.height / 2;
3358
+ const size = Math.min(bounds.width, bounds.height);
3359
+ const maxRadius = size * 0.45;
3360
+ return nodes.map((node, i) => {
3361
+ const radiusFraction = 1 - i / nodes.length;
3362
+ const r = maxRadius * radiusFraction;
3363
+ const diameter = r * 2;
3364
+ return {
3365
+ id: `reflow-target-${node.id}`,
3366
+ shapeType: "ellipse",
3367
+ x: cx - r,
3368
+ y: cy - r,
3369
+ width: diameter,
3370
+ height: diameter,
3371
+ text: node.text,
3372
+ fontSize: Math.max(7, Math.min(10, r * 0.15))
3373
+ };
3374
+ });
3375
+ }
3376
+ function reflowGear(nodes, bounds) {
3377
+ const gearNodes = nodes.slice(0, 3);
3378
+ const extraNodes = nodes.slice(3);
3379
+ const gearAreaW = extraNodes.length > 0 ? bounds.width * 0.7 : bounds.width;
3380
+ const gearAreaH = bounds.height;
3381
+ bounds.x + gearAreaW / 2;
3382
+ const cy = bounds.y + gearAreaH / 2;
3383
+ const spacing2 = gearAreaW / (gearNodes.length + 1);
3384
+ const gearR = Math.min(spacing2 * 0.4, gearAreaH * 0.35);
3385
+ const gearDiameter = gearR * 2;
3386
+ const shapes = [];
3387
+ gearNodes.forEach((node, i) => {
3388
+ const gx = bounds.x + spacing2 * (i + 1);
3389
+ const gy = cy + (i % 2 === 0 ? 0 : gearR * 0.35);
3390
+ shapes.push({
3391
+ id: `reflow-gear-${node.id}`,
3392
+ shapeType: "ellipse",
3393
+ x: gx - gearR,
3394
+ y: gy - gearR,
3395
+ width: gearDiameter,
3396
+ height: gearDiameter,
3397
+ text: node.text,
3398
+ fontSize: Math.max(7, Math.min(10, gearR * 0.15))
3399
+ });
3400
+ });
3401
+ const labelH = 20;
3402
+ const labelGap = 6;
3403
+ const labelW = bounds.width - gearAreaW - 16;
3404
+ const labelStartX = bounds.x + gearAreaW + 8;
3405
+ const labelStartY = bounds.y + (bounds.height - extraNodes.length * (labelH + labelGap)) / 2;
3406
+ extraNodes.forEach((node, i) => {
3407
+ shapes.push({
3408
+ id: `reflow-gear-extra-${node.id}`,
3409
+ shapeType: "roundRect",
3410
+ x: labelStartX,
3411
+ y: labelStartY + i * (labelH + labelGap),
3412
+ width: Math.max(labelW, 30),
3413
+ height: labelH,
3414
+ text: node.text,
3415
+ fontSize: Math.max(7, Math.min(10, 10))
3416
+ });
3417
+ });
3418
+ return shapes;
3419
+ }
3420
+ function reflowVenn(nodes, bounds) {
3421
+ const cx = bounds.x + bounds.width / 2;
3422
+ const cy = bounds.y + bounds.height / 2;
3423
+ const size = Math.min(bounds.width, bounds.height);
3424
+ if (nodes.length <= 4) {
3425
+ const r2 = size * 0.22;
3426
+ const spread = r2 * 0.6;
3427
+ return nodes.map((node, i) => {
3428
+ const angle = i / nodes.length * Math.PI * 2 - Math.PI / 2;
3429
+ const nx = cx + spread * Math.cos(angle) - r2;
3430
+ const ny = cy + spread * Math.sin(angle) - r2;
3431
+ return {
3432
+ id: `reflow-venn-${node.id}`,
3433
+ shapeType: "ellipse",
3434
+ x: nx,
3435
+ y: ny,
3436
+ width: r2 * 2,
3437
+ height: r2 * 2,
3438
+ text: node.text,
3439
+ fontSize: Math.max(7, Math.min(10, r2 * 0.1))
3440
+ };
3441
+ });
3442
+ }
3443
+ const r = Math.min(size * 0.15, bounds.width / (nodes.length * 1.5));
3444
+ const totalW = nodes.length * r * 2;
3445
+ const startX = cx - totalW / 2 + r;
3446
+ return nodes.map((node, i) => ({
3447
+ id: `reflow-venn-${node.id}`,
3448
+ shapeType: "ellipse",
3449
+ x: startX + i * r * 2 - r,
3450
+ y: cy - r,
3451
+ width: r * 2,
3452
+ height: r * 2,
3453
+ text: node.text,
3454
+ fontSize: Math.max(6, Math.min(9, r * 0.1))
3455
+ }));
3456
+ }
3457
+
3458
+ // diagram/edit/reflow-stacked.ts
3459
+ function reflowPyramid(nodes, bounds) {
3460
+ const padding = 8;
3461
+ const gap = 4;
3462
+ const usableH = bounds.height - padding * 2;
3463
+ const bandH = (usableH - gap * (nodes.length - 1)) / nodes.length;
3464
+ const maxW = bounds.width - padding * 2;
3465
+ return nodes.map((node, i) => {
3466
+ const widthFraction = 0.3 + i / Math.max(nodes.length - 1, 1) * 0.7;
3467
+ const w = maxW * widthFraction;
3468
+ const x = bounds.x + (bounds.width - w) / 2;
3469
+ const y = bounds.y + padding + i * (bandH + gap);
3470
+ return {
3471
+ id: `reflow-pyramid-${node.id}`,
3472
+ shapeType: "rect",
3473
+ x,
3474
+ y,
3475
+ width: w,
3476
+ height: bandH,
3477
+ text: node.text,
3478
+ fontSize: Math.max(8, Math.min(11, bandH * 0.4))
3479
+ };
3480
+ });
3481
+ }
3482
+ function reflowFunnel(nodes, bounds) {
3483
+ const padding = 8;
3484
+ const gap = 4;
3485
+ const usableH = bounds.height - padding * 2;
3486
+ const bandH = (usableH - gap * (nodes.length - 1)) / nodes.length;
3487
+ const maxW = bounds.width - padding * 2;
3488
+ return nodes.map((node, i) => {
3489
+ const widthFraction = 1 - i / Math.max(nodes.length - 1, 1) * 0.7;
3490
+ const w = maxW * widthFraction;
3491
+ const x = bounds.x + (bounds.width - w) / 2;
3492
+ const y = bounds.y + padding + i * (bandH + gap);
3493
+ return {
3494
+ id: `reflow-funnel-${node.id}`,
3495
+ shapeType: "rect",
3496
+ x,
3497
+ y,
3498
+ width: w,
3499
+ height: bandH,
3500
+ text: node.text,
3501
+ fontSize: Math.max(8, Math.min(11, bandH * 0.4))
3502
+ };
3503
+ });
3504
+ }
3505
+
3506
+ // diagram/edit/reflow-category.ts
3507
+ function resolveDiagramReflowCategory(layoutType) {
3508
+ if (!layoutType) {
3509
+ return "list";
3510
+ }
3511
+ const lower = layoutType.toLowerCase();
3512
+ if (lower.includes("hierarchy") || lower.includes("org")) {
3513
+ return "hierarchy";
3514
+ }
3515
+ if (lower.includes("cycle") || lower.includes("radial")) {
3516
+ return "cycle";
3517
+ }
3518
+ if (lower.includes("funnel")) {
3519
+ return "funnel";
3520
+ }
3521
+ if (lower.includes("target") || lower.includes("bullseye")) {
3522
+ return "target";
3523
+ }
3524
+ if (lower.includes("gear") || lower.includes("interlock")) {
3525
+ return "gear";
3526
+ }
3527
+ if (lower.includes("venn")) {
3528
+ return "venn";
3529
+ }
3530
+ if (lower.includes("timeline")) {
3531
+ return "timeline";
3532
+ }
3533
+ if (lower.includes("bending") || lower.includes("snake") || lower.includes("zigzag")) {
3534
+ return "bending";
3535
+ }
3536
+ if (lower.includes("chevron")) {
3537
+ return "chevron";
3538
+ }
3539
+ if (lower.includes("relationship")) {
3540
+ return "relationship";
3541
+ }
3542
+ if (lower.includes("process") || lower.includes("arrow")) {
3543
+ return "process";
3544
+ }
3545
+ if (lower.includes("matrix")) {
3546
+ return "matrix";
3547
+ }
3548
+ if (lower.includes("pyramid")) {
3549
+ return "pyramid";
3550
+ }
3551
+ if (lower.includes("list") || lower.includes("block")) {
3552
+ return "list";
3553
+ }
3554
+ return "list";
3555
+ }
3556
+
3557
+ // diagram/edit/reflow.ts
3558
+ function diagramContentNodes(nodes) {
3559
+ return nodes.filter((n2) => n2.text.length > 0);
3560
+ }
3561
+ function reflowDiagramLayout(data, bounds) {
3562
+ const nodes = diagramContentNodes(data.nodes);
3563
+ if (nodes.length === 0) {
3564
+ return void 0;
3565
+ }
3566
+ const layoutType = data.resolvedLayoutType ?? resolveDiagramReflowCategory(data.layoutType);
3567
+ switch (layoutType) {
3568
+ case "list":
3569
+ return reflowList(nodes, bounds);
3570
+ case "process":
3571
+ return reflowProcess(nodes, bounds);
3572
+ case "hierarchy":
3573
+ return reflowHierarchy(data.nodes, bounds);
3574
+ case "cycle":
3575
+ return reflowCycle(nodes, bounds);
3576
+ case "matrix":
3577
+ return reflowMatrix(nodes, bounds);
3578
+ case "pyramid":
3579
+ return reflowPyramid(nodes, bounds);
3580
+ case "funnel":
3581
+ return reflowFunnel(nodes, bounds);
3582
+ case "target":
3583
+ return reflowTarget(nodes, bounds);
3584
+ case "gear":
3585
+ return reflowGear(nodes, bounds);
3586
+ case "venn":
3587
+ return reflowVenn(nodes, bounds);
3588
+ case "timeline":
3589
+ return reflowTimeline(nodes, bounds);
3590
+ case "relationship":
3591
+ return reflowRelationship(nodes, bounds);
3592
+ case "chevron":
3593
+ return reflowChevron(nodes, bounds);
3594
+ case "bending":
3595
+ return reflowBending(nodes, bounds);
3596
+ default:
3597
+ return reflowList(nodes, bounds);
3598
+ }
3599
+ }
3600
+ function reflowList(nodes, bounds) {
3601
+ const padding = 8;
3602
+ const gap = 6;
3603
+ const usableW = bounds.width - padding * 2;
3604
+ const usableH = bounds.height - padding * 2;
3605
+ const itemH = (usableH - gap * (nodes.length - 1)) / nodes.length;
3606
+ return nodes.map((node, i) => ({
3607
+ id: `reflow-list-${node.id}`,
3608
+ shapeType: "roundRect",
3609
+ x: bounds.x + padding,
3610
+ y: bounds.y + padding + i * (itemH + gap),
3611
+ width: usableW,
3612
+ height: itemH,
3613
+ text: node.text,
3614
+ fontSize: Math.max(8, Math.min(11, itemH * 0.4))
3615
+ }));
3616
+ }
3617
+ function reflowProcess(nodes, bounds) {
3618
+ const padding = 8;
3619
+ const arrowGap = 16;
3620
+ const usableW = bounds.width - padding * 2;
3621
+ const usableH = bounds.height - padding * 2;
3622
+ const nodeW = (usableW - arrowGap * (nodes.length - 1)) / nodes.length;
3623
+ const nodeH = usableH * 0.6;
3624
+ const yOffset = bounds.y + padding + (usableH - nodeH) / 2;
3625
+ const shapes = [];
3626
+ nodes.forEach((node, i) => {
3627
+ const x = bounds.x + padding + i * (nodeW + arrowGap);
3628
+ shapes.push({
3629
+ id: `reflow-proc-${node.id}`,
3630
+ shapeType: "roundRect",
3631
+ x,
3632
+ y: yOffset,
3633
+ width: nodeW,
3634
+ height: nodeH,
3635
+ text: node.text,
3636
+ fontSize: Math.max(8, Math.min(11, nodeW * 0.12))
3637
+ });
3638
+ if (i < nodes.length - 1) {
3639
+ const arrowX = x + nodeW;
3640
+ const arrowY = yOffset + nodeH / 2 - 6;
3641
+ shapes.push({
3642
+ id: `reflow-proc-arrow-${node.id}`,
3643
+ shapeType: "rightArrow",
3644
+ x: arrowX,
3645
+ y: arrowY,
3646
+ width: arrowGap,
3647
+ height: 12,
3648
+ fillColor: "#94a3b8"
3649
+ });
3650
+ }
3651
+ });
3652
+ return shapes;
3653
+ }
3654
+ function reflowHierarchy(nodes, bounds) {
3655
+ const roots = buildForest(nodes);
3656
+ if (roots.length === 0) {
3657
+ return reflowList(diagramContentNodes(nodes), bounds);
3658
+ }
3659
+ const totalLeaves = roots.reduce((s, r) => s + treeWidth(r), 0);
3660
+ const depth = Math.max(...roots.map(treeDepth));
3661
+ const padding = 8;
3662
+ const usableW = bounds.width - padding * 2;
3663
+ const usableH = bounds.height - padding * 2;
3664
+ const cellW = usableW / Math.max(totalLeaves, 1);
3665
+ const cellH = usableH / Math.max(depth, 1);
3666
+ const boxW = Math.min(cellW * 0.8, 140);
3667
+ const boxH = Math.min(cellH * 0.35, 28);
3668
+ const shapes = [];
3669
+ const MAX_WALK_DEPTH = 256;
3670
+ function walkTree(t, xOffset, level2) {
3671
+ if (level2 >= MAX_WALK_DEPTH) {
3672
+ return 1;
3673
+ }
3674
+ const w = treeWidth(t);
3675
+ const cx = bounds.x + padding + (xOffset + w / 2) * cellW;
3676
+ const cy = bounds.y + padding + level2 * cellH + cellH / 2;
3677
+ shapes.push({
3678
+ id: `reflow-hier-${t.node.id}`,
3679
+ shapeType: "roundRect",
3680
+ x: cx - boxW / 2,
3681
+ y: cy - boxH / 2,
3682
+ width: boxW,
3683
+ height: boxH,
3684
+ text: t.node.text,
3685
+ fontSize: Math.max(7, Math.min(10, boxW / 14))
3686
+ });
3687
+ let childOffset = xOffset;
3688
+ for (const child3 of t.children) {
3689
+ walkTree(child3, childOffset, level2 + 1);
3690
+ childOffset += treeWidth(child3);
3691
+ }
3692
+ return w;
3693
+ }
3694
+ let offset = 0;
3695
+ for (const root of roots) {
3696
+ offset += walkTree(root, offset, 0);
3697
+ }
3698
+ return shapes;
3699
+ }
3700
+
3701
+ // diagram/drawing-from-views.ts
3702
+ var scheme = (value) => ({ kind: "scheme", value, transforms: [] });
3703
+ var srgb = (hex) => ({
3704
+ kind: "srgb",
3705
+ value: hex.replace("#", "").toUpperCase(),
3706
+ transforms: []
3707
+ });
3708
+ function diagramDrawingFromViews(views, options2 = {}) {
3709
+ const emu3 = options2.emuPerUnit ?? 9525;
3710
+ const accents = options2.accents?.length ? options2.accents : ["accent1"];
3711
+ let filled = 0;
3712
+ const shapes = views.map((view) => {
3713
+ const themed = !view.fillColor && !view.fillNone;
3714
+ const fill = view.fillColor ? srgb(view.fillColor) : scheme(accents[filled++ % accents.length]);
3715
+ const text2 = view.text?.trim() ? view.text : "";
3716
+ const textColor = view.fontColor ? srgb(view.fontColor) : scheme(themed ? "lt1" : "tx1");
3717
+ return {
3718
+ modelId: view.id,
3719
+ frame: {
3720
+ x: Math.round(view.x * emu3),
3721
+ y: Math.round(view.y * emu3),
3722
+ width: Math.round(view.width * emu3),
3723
+ height: Math.round(view.height * emu3)
3724
+ },
3725
+ ...view.rotation ? { rotation: view.rotation } : {},
3726
+ geometry: view.shapeType ?? "rect",
3727
+ fill: view.fillNone ? { kind: "none" } : { kind: "solid", color: fill },
3728
+ line: {
3729
+ widthEmu: 12700,
3730
+ fill: { kind: "solid", color: view.strokeColor ? srgb(view.strokeColor) : scheme("lt1") }
3731
+ },
3732
+ ...text2 ? {
3733
+ text: {
3734
+ anchor: "ctr",
3735
+ text: text2,
3736
+ paragraphs: text2.split("\n").map((line2) => ({
3737
+ runs: [
3738
+ {
3739
+ text: line2,
3740
+ sizePt: Math.round((view.fontSize ?? 12) * 0.75 * 10) / 10,
3741
+ color: textColor
3742
+ }
3743
+ ]
3744
+ }))
3745
+ }
3746
+ } : {},
3747
+ has3d: false
3748
+ };
3749
+ });
3750
+ return { shapes, issues: [] };
3751
+ }
3752
+
3753
+ // diagram/approximate.ts
3754
+ var EMU_PER_PX = 9525;
3755
+ var COLORFUL = ["accent1", "accent2", "accent3", "accent4", "accent5", "accent6"];
3756
+ function approximateDiagramDrawingFromNodes(input) {
3757
+ const width = input.extentEmu.width / EMU_PER_PX;
3758
+ const height = input.extentEmu.height / EMU_PER_PX;
3759
+ if (!(width > 0 && height > 0) || input.nodes.length === 0) return void 0;
3760
+ const nodes = input.nodes.map((node) => ({
3761
+ id: node.id,
3762
+ text: node.text || " ",
3763
+ ...node.parentId ? { parentId: node.parentId } : {}
3764
+ }));
3765
+ const views = reflowDiagramLayout(
3766
+ {
3767
+ nodes,
3768
+ ...input.family ? { resolvedLayoutType: input.family } : {},
3769
+ ...input.layoutId ? { layoutType: input.layoutId } : {}
3770
+ },
3771
+ { x: 0, y: 0, width, height }
3772
+ );
3773
+ if (!views?.length) return void 0;
3774
+ return diagramDrawingFromViews(views, {
3775
+ accents: input.colorsId?.includes("colorful") ? COLORFUL : ["accent1"]
3776
+ });
3777
+ }
3778
+
3032
3779
  // chart/regression.ts
3033
3780
  function computeLinearRegression(xVals, yVals) {
3034
3781
  const n2 = xVals.length;
@@ -3551,7 +4298,7 @@ function normalizeLevels(levels, pointCount) {
3551
4298
  });
3552
4299
  }
3553
4300
  function findOrAddParent(children3, label, colorIndex, parentLabelLayout) {
3554
- const existing = children3.find((child) => child.children && child.label === label);
4301
+ const existing = children3.find((child3) => child3.children && child3.label === label);
3555
4302
  if (existing?.children) return existing;
3556
4303
  const parent = { label, weight: 0, children: [], colorIndex, parentLabelLayout };
3557
4304
  children3.push(parent);
@@ -3580,12 +4327,12 @@ function buildSeriesHierarchy(series, seriesIndex, categoryLabels, categoryLevel
3580
4327
  return roots;
3581
4328
  }
3582
4329
  function aggregate(node) {
3583
- if (node.children) node.weight = node.children.reduce((sum, child) => sum + aggregate(child), 0);
4330
+ if (node.children) node.weight = node.children.reduce((sum, child3) => sum + aggregate(child3), 0);
3584
4331
  return node.weight;
3585
4332
  }
3586
4333
  function propagateColor(node, colorIndex) {
3587
4334
  node.colorIndex = colorIndex;
3588
- for (const child of node.children ?? []) propagateColor(child, colorIndex);
4335
+ for (const child3 of node.children ?? []) propagateColor(child3, colorIndex);
3589
4336
  }
3590
4337
  function buildHierarchyRoots(series, categoryLabels, categoryLevels) {
3591
4338
  const colorStride = Math.max(categoryLabels.length, ...series.map((s) => s.values.length), 1);
@@ -4165,9 +4912,9 @@ function chartPaletteSeriesColorChoice(palette, i, n2) {
4165
4912
  transforms: Object.entries(transform).map(([name, value]) => ({ name, value: String(value) }))
4166
4913
  };
4167
4914
  }
4168
- function chartPaletteSeriesColor(palette, i, n2, scheme) {
4915
+ function chartPaletteSeriesColor(palette, i, n2, scheme2) {
4169
4916
  const choice = chartPaletteSeriesColorChoice(palette, i, n2);
4170
- return (resolveDrawingColor(choice, { scheme: (name) => scheme[name] })?.hex ?? scheme[choice.value]).toUpperCase();
4917
+ return (resolveDrawingColor(choice, { scheme: (name) => scheme2[name] })?.hex ?? scheme2[choice.value]).toUpperCase();
4171
4918
  }
4172
4919
 
4173
4920
  // chart/style-definition.ts
@@ -4397,51 +5144,6 @@ function chartCacheValues(cache) {
4397
5144
  }
4398
5145
  var chartSourceValues = (source) => chartCacheValues(source?.cache ?? source?.levels?.[0]);
4399
5146
 
4400
- // drawingml/write-line.ts
4401
- var FILLS = /* @__PURE__ */ new Set(["noFill", "solidFill", "gradFill", "pattFill"]);
4402
- function dropDrawingDeclarations(element2) {
4403
- if (element2.getAttribute("xmlns:a") === NS.a) element2.removeAttribute("xmlns:a");
4404
- for (const child of elements(element2)) dropDrawingDeclarations(child);
4405
- }
4406
- function patchDrawingLine(ln, line2) {
4407
- if (line2.widthEmu === void 0) ln.removeAttribute("w");
4408
- else ln.setAttribute("w", String(Math.round(line2.widthEmu)));
4409
- if (line2.cap === void 0) ln.removeAttribute("cap");
4410
- else ln.setAttribute("cap", line2.cap);
4411
- const fill = line2.fill && drawingFillXml(line2.fill);
4412
- if (fill || !line2.fill) {
4413
- for (const node of elements(ln))
4414
- if (node.namespaceURI === NS.a && FILLS.has(node.localName)) ln.removeChild(node);
4415
- }
4416
- if (fill) {
4417
- const parsed = parseXml(`<w xmlns:a="${NS.a}">${fill}</w>`).documentElement;
4418
- for (const node of elements(parsed).reverse()) {
4419
- const imported = ln.ownerDocument.importNode(node, true);
4420
- dropDrawingDeclarations(imported);
4421
- ln.insertBefore(imported, ln.firstChild);
4422
- }
4423
- }
4424
- const dashes = elements(ln).filter(
4425
- (node) => node.namespaceURI === NS.a && (node.localName === "prstDash" || node.localName === "custDash")
4426
- );
4427
- if (line2.dash === void 0) {
4428
- for (const node of dashes) if (node.localName === "prstDash") ln.removeChild(node);
4429
- return;
4430
- }
4431
- const dash = ln.ownerDocument.createElementNS(NS.a, "a:prstDash");
4432
- dash.setAttribute("val", line2.dash);
4433
- for (const node of dashes) ln.removeChild(node);
4434
- const afterFill = elements(ln).find(
4435
- (node) => node.namespaceURI !== NS.a || !FILLS.has(node.localName)
4436
- );
4437
- ln.insertBefore(dash, afterFill ?? null);
4438
- }
4439
- function drawingLineXml(line2) {
4440
- const doc = parseXml(`<a:ln xmlns:a="${NS.a}"/>`);
4441
- patchDrawingLine(doc.documentElement, line2);
4442
- return buildXml(doc);
4443
- }
4444
-
4445
5147
  // chart/marker-shape.ts
4446
5148
  var CHART_PX_PER_PT = 4 / 3;
4447
5149
  var DEFAULT_MARKER_OUTLINE_PT = 0.75;
@@ -5007,10 +5709,10 @@ function chartAppearance(chart, theme) {
5007
5709
  if (base?.line || direct?.line) entry.line = { ...base?.line, ...direct?.line };
5008
5710
  entries[part] = entry;
5009
5711
  }
5010
- const scheme = chartColorScheme(theme);
5712
+ const scheme2 = chartColorScheme(theme);
5011
5713
  const resolve = (color) => resolveDrawingColor(
5012
5714
  color,
5013
- { scheme: (name) => scheme[name] },
5715
+ { scheme: (name) => scheme2[name] },
5014
5716
  { hslRounding: "halfDown", transformOrder: "document" }
5015
5717
  );
5016
5718
  const out = resolveChartStyleDefinition(
@@ -5022,7 +5724,7 @@ function chartAppearance(chart, theme) {
5022
5724
  if (!entry) continue;
5023
5725
  const family = typeface(entry, theme);
5024
5726
  const shadow = resolveDrawingShadowXml(entry.textEffectsXml, {
5025
- scheme: (name) => scheme[name]
5727
+ scheme: (name) => scheme2[name]
5026
5728
  });
5027
5729
  if (shadow) (out[part] ??= {}).textShadow = shadow;
5028
5730
  if (family) (out[part] ??= {}).typeface = family;
@@ -5804,11 +6506,11 @@ function seriesName(series, index, evaluateRef) {
5804
6506
  return fromRef || series.name || `Series${index + 1}`;
5805
6507
  }
5806
6508
  function seriesContext(chart, theme, options2) {
5807
- const scheme = chartColorScheme(theme);
5808
- const resolver = { scheme: (name) => scheme[name] };
6509
+ const scheme2 = chartColorScheme(theme);
6510
+ const resolver = { scheme: (name) => scheme2[name] };
5809
6511
  return {
5810
6512
  theme,
5811
- scheme,
6513
+ scheme: scheme2,
5812
6514
  palette: chart.colorPalette === void 0 ? void 0 : findChartColorPalette(chart.colorPalette),
5813
6515
  evaluateRef: options2.evaluateRef ?? (() => []),
5814
6516
  seriesColor: options2.seriesColor,
@@ -5820,13 +6522,13 @@ function seriesContext(chart, theme, options2) {
5820
6522
  };
5821
6523
  }
5822
6524
  function seriesView(ctx, s, index, total, categoriesOf) {
5823
- const { theme, scheme, palette, evaluateRef } = ctx;
6525
+ const { theme, scheme: scheme2, palette, evaluateRef } = ctx;
5824
6526
  const values = resolveRef(s.valuesRef, evaluateRef)?.map(toNumber) ?? s.values.map(toNumber);
5825
6527
  categoriesOf(resolveRef(s.categoriesRef, evaluateRef) ?? s.categories);
5826
- const paletteColor = palette && chartPaletteSeriesColor(palette, index, total, scheme);
6528
+ const paletteColor = palette && chartPaletteSeriesColor(palette, index, total, scheme2);
5827
6529
  const color = s.fill?.kind === "none" ? "none" : ctx.drawingColor(s.fill?.kind === "solid" ? s.fill.color : s.drawingColor) ?? ctx.seriesColor?.(s, index) ?? paletteColor ?? autoSeriesColor(theme, index);
5828
6530
  const view = { name: seriesName(s, index, evaluateRef), values, color };
5829
- const shadow = resolveDrawingShadowXml(s.effectsXml, { scheme: (name) => scheme[name] });
6531
+ const shadow = resolveDrawingShadowXml(s.effectsXml, { scheme: (name) => scheme2[name] });
5830
6532
  if (shadow) view.shadow = shadow;
5831
6533
  const resolvedGradient = ctx.gradient(s.fill);
5832
6534
  if (resolvedGradient) view.gradient = resolvedGradient;
@@ -5897,7 +6599,7 @@ function hierarchyView(chart, model, evaluateRef) {
5897
6599
  }
5898
6600
 
5899
6601
  // chart/render/chart-view-stock.ts
5900
- var EMU_PER_PX = 9525;
6602
+ var EMU_PER_PX2 = 9525;
5901
6603
  function paintOf(fill, ctx) {
5902
6604
  if (fill?.kind === "none") return "none";
5903
6605
  return fill?.kind === "solid" ? ctx.drawingColor(fill.color) : void 0;
@@ -5906,7 +6608,7 @@ function lineOf(shape, ctx, color) {
5906
6608
  const line2 = shape?.line;
5907
6609
  return {
5908
6610
  color: paintOf(line2?.fill, ctx) ?? color,
5909
- width: line2?.widthEmu === void 0 ? 1 : Math.max(0.5, line2.widthEmu / EMU_PER_PX)
6611
+ width: line2?.widthEmu === void 0 ? 1 : Math.max(0.5, line2.widthEmu / EMU_PER_PX2)
5910
6612
  };
5911
6613
  }
5912
6614
  function barOf(shape, ctx, fallback) {
@@ -6175,7 +6877,7 @@ function chartSummaryView(chart, theme, options2 = {}) {
6175
6877
  const radial = type === "pie" || type === "doughnut";
6176
6878
  const byPoint = radial || type === "treemap" || type === "sunburst";
6177
6879
  const ctx = seriesContext(chart, theme, options2);
6178
- const { palette, scheme, drawingColor } = ctx;
6880
+ const { palette, scheme: scheme2, drawingColor } = ctx;
6179
6881
  const grouping = chart.grouping ?? (type === "bar" || type === "column" ? "clustered" : "standard");
6180
6882
  const rawCategories = [];
6181
6883
  const collect = (cats) => void rawCategories.push(cats);
@@ -6196,7 +6898,7 @@ function chartSummaryView(chart, theme, options2 = {}) {
6196
6898
  series.forEach((s, seriesIndex) => {
6197
6899
  s.pointColors = s.values.map((_, i) => {
6198
6900
  const explicit = drawingColor(chart.series[seriesIndex]?.pointColors?.[i]);
6199
- return explicit ?? (palette ? chartPaletteSeriesColor(palette, i, s.values.length, scheme) : autoSeriesColor(theme, i));
6901
+ return explicit ?? (palette ? chartPaletteSeriesColor(palette, i, s.values.length, scheme2) : autoSeriesColor(theme, i));
6200
6902
  });
6201
6903
  });
6202
6904
  } else
@@ -7389,13 +8091,13 @@ function renderChartSummarySvg(summary, options2) {
7389
8091
  }
7390
8092
 
7391
8093
  // docx/breaks.ts
7392
- function isCachedPageBreak(element2) {
7393
- return named2(element2, "lastRenderedPageBreak") && !element2.childNodes.length && Array.from(element2.attributes).every(
8094
+ function isCachedPageBreak(element3) {
8095
+ return named2(element3, "lastRenderedPageBreak") && !element3.childNodes.length && Array.from(element3.attributes).every(
7394
8096
  (attribute) => attribute.namespaceURI === "http://www.w3.org/2000/xmlns/"
7395
8097
  );
7396
8098
  }
7397
- function hasSpecialBreak(element2) {
7398
- for (const attribute of Array.from(element2.attributes)) {
8099
+ function hasSpecialBreak(element3) {
8100
+ for (const attribute of Array.from(element3.attributes)) {
7399
8101
  if (attribute.namespaceURI === "http://www.w3.org/2000/xmlns/") continue;
7400
8102
  if (attribute.namespaceURI !== WORD_NS) return true;
7401
8103
  if (attribute.localName === "type") {
@@ -7406,14 +8108,14 @@ function hasSpecialBreak(element2) {
7406
8108
  }
7407
8109
  return false;
7408
8110
  }
7409
- function classifyBreak(element2) {
7410
- const type = getW(element2, "type");
8111
+ function classifyBreak(element3) {
8112
+ const type = getW(element3, "type");
7411
8113
  return type === "page" || type === "column" ? type : "textWrapping";
7412
8114
  }
7413
- function isModeledBreak(element2) {
7414
- const kind = classifyBreak(element2);
8115
+ function isModeledBreak(element3) {
8116
+ const kind = classifyBreak(element3);
7415
8117
  if (kind === "textWrapping") return false;
7416
- for (const attribute of Array.from(element2.attributes)) {
8118
+ for (const attribute of Array.from(element3.attributes)) {
7417
8119
  if (attribute.namespaceURI === "http://www.w3.org/2000/xmlns/") continue;
7418
8120
  if (attribute.namespaceURI !== WORD_NS || attribute.localName !== "type") return false;
7419
8121
  }
@@ -7429,13 +8131,13 @@ var add2 = (parent, ...items) => {
7429
8131
  };
7430
8132
  var emu2 = (px) => String(Math.max(1, Math.round(px * EMU_PER_PIXEL)));
7431
8133
  var emuOffset = (px) => String(Math.round(px * EMU_PER_PIXEL));
7432
- var attrs = (element2, values) => {
7433
- for (const [name, value] of Object.entries(values)) element2.setAttribute(name, value);
7434
- return element2;
8134
+ var attrs = (element3, values) => {
8135
+ for (const [name, value] of Object.entries(values)) element3.setAttribute(name, value);
8136
+ return element3;
7435
8137
  };
7436
- function dropDeclarations(element2) {
7437
- if (element2.getAttribute("xmlns:a") === A_NS2) element2.removeAttribute("xmlns:a");
7438
- for (const node of Array.from(element2.childNodes))
8138
+ function dropDeclarations(element3) {
8139
+ if (element3.getAttribute("xmlns:a") === A_NS2) element3.removeAttribute("xmlns:a");
8140
+ for (const node of Array.from(element3.childNodes))
7439
8141
  if (node.nodeType === 1) dropDeclarations(node);
7440
8142
  }
7441
8143
  function importFragment(doc, xml) {
@@ -7446,11 +8148,11 @@ function importFragment(doc, xml) {
7446
8148
  return imported;
7447
8149
  });
7448
8150
  }
7449
- var srgb = (fill) => fill?.kind === "solid" && fill.color.kind === "srgb" ? fill.color.value : void 0;
8151
+ var srgb2 = (fill) => fill?.kind === "solid" && fill.color.kind === "srgb" ? fill.color.value : void 0;
7450
8152
  function explicitTextColor(spec) {
7451
8153
  if (!spec.fill) return void 0;
7452
8154
  if (spec.fill.kind === "none") return "000000";
7453
- const hex = srgb(spec.fill);
8155
+ const hex = srgb2(spec.fill);
7454
8156
  if (!hex || !/^[0-9a-f]{6}$/i.test(hex)) return void 0;
7455
8157
  const channel = (i) => Number.parseInt(hex.slice(i, i + 2), 16) / 255;
7456
8158
  const light = 0.2126 * channel(0) + 0.7152 * channel(2) + 0.0722 * channel(4) > 0.6;
@@ -7481,9 +8183,9 @@ function textParagraphs(doc, lines, color) {
7481
8183
  });
7482
8184
  }
7483
8185
  function shapeStyle(doc) {
7484
- const ref = (name, idx, scheme, shade) => {
8186
+ const ref = (name, idx, scheme2, shade) => {
7485
8187
  const node = attrs(el2(doc, A_NS2, `a:${name}`), { idx });
7486
- const color = attrs(el2(doc, A_NS2, "a:schemeClr"), { val: scheme });
8188
+ const color = attrs(el2(doc, A_NS2, "a:schemeClr"), { val: scheme2 });
7487
8189
  if (shade) add2(color, attrs(el2(doc, A_NS2, "a:shade"), { val: shade }));
7488
8190
  return add2(node, color);
7489
8191
  };
@@ -7674,43 +8376,15 @@ function rebuildShapeDrawing(doc, image, old) {
7674
8376
  return next;
7675
8377
  }
7676
8378
 
7677
- // docx/write-drawing.ts
8379
+ // docx/write-drawing-patch.ts
7678
8380
  var A_NS3 = "http://schemas.openxmlformats.org/drawingml/2006/main";
7679
8381
  var WP_NS3 = "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing";
7680
- function alternateContentDrawing(content) {
7681
- const choice = Array.from(content.childNodes).filter(isElement).find((node) => node.localName === "Choice");
7682
- return choice && findDrawingChild(choice);
7683
- }
7684
- function drawingContainer(run) {
7685
- if (!run) return void 0;
7686
- for (const child of Array.from(run.childNodes))
7687
- if (isElement(child) && (named2(child, "drawing") || named2(child, "pict"))) return child;
7688
- for (const child of Array.from(run.childNodes))
7689
- if (isElement(child) && child.localName === "AlternateContent" && alternateContentDrawing(child))
7690
- return child;
7691
- return void 0;
7692
- }
7693
- function findDrawingChild(run) {
7694
- if (!run) return void 0;
7695
- for (const child of Array.from(run.childNodes)) {
7696
- if (!isElement(child)) continue;
7697
- if (named2(child, "drawing") || named2(child, "pict")) return child;
7698
- if (child.localName === "AlternateContent") {
7699
- const inner = alternateContentDrawing(child);
7700
- if (inner) return inner;
7701
- }
7702
- }
7703
- return void 0;
7704
- }
7705
- function sameUnderlyingImage(a, b) {
7706
- return Boolean(a.partName) && a.relId === b.relId && a.partName === b.partName;
7707
- }
7708
8382
  function walk(root, visit) {
7709
8383
  const stack = [root];
7710
8384
  while (stack.length) {
7711
8385
  const node = stack.shift();
7712
8386
  visit(node);
7713
- for (const child of Array.from(node.childNodes)) if (isElement(child)) stack.push(child);
8387
+ for (const child3 of Array.from(node.childNodes)) if (isElement(child3)) stack.push(child3);
7714
8388
  }
7715
8389
  }
7716
8390
  function updateExtent(drawing, widthPx, heightPx) {
@@ -7737,11 +8411,11 @@ function updateDocPr(drawing, altText, title) {
7737
8411
  }
7738
8412
  function patchPosition(doc, anchor, name, relativeFrom, align, offsetPx) {
7739
8413
  const position2 = Array.from(anchor.childNodes).find(
7740
- (child) => isElement(child) && child.namespaceURI === WP_NS3 && child.localName === name
8414
+ (child3) => isElement(child3) && child3.namespaceURI === WP_NS3 && child3.localName === name
7741
8415
  );
7742
8416
  if (!position2) return;
7743
8417
  if (relativeFrom) position2.setAttribute("relativeFrom", relativeFrom);
7744
- for (const child of Array.from(position2.childNodes)) position2.removeChild(child);
8418
+ for (const child3 of Array.from(position2.childNodes)) position2.removeChild(child3);
7745
8419
  const value = align ? makeNS(doc, WP_NS3, "wp:align") : makeNS(doc, WP_NS3, "wp:posOffset");
7746
8420
  value.appendChild(
7747
8421
  doc.createTextNode(align ?? String(Math.round((offsetPx ?? 0) * EMU_PER_PIXEL)))
@@ -7770,10 +8444,79 @@ function updatePlacement(drawing, doc, placement) {
7770
8444
  });
7771
8445
  }
7772
8446
  function clearNonProperties(node, keep) {
7773
- for (const child of Array.from(node.childNodes)) {
7774
- if (isElement(child) && (named2(child, "rPr") || child === keep)) continue;
7775
- node.removeChild(child);
8447
+ for (const child3 of Array.from(node.childNodes)) {
8448
+ if (isElement(child3) && (named2(child3, "rPr") || child3 === keep)) continue;
8449
+ node.removeChild(child3);
8450
+ }
8451
+ }
8452
+ function chartRun(doc, node, image, base, oldDrawing, oldContainer, allocator) {
8453
+ if (base?.chart && oldDrawing && image.chart?.partName && image.chart.partName === base.chart.partName && image.chart.relId === base.chart.relId) {
8454
+ if (image.widthPx !== base.widthPx || image.heightPx !== base.heightPx)
8455
+ updateExtent(oldDrawing, image.widthPx, image.heightPx);
8456
+ clearNonProperties(node, oldContainer);
8457
+ return node;
8458
+ }
8459
+ if (!base && image.chart?.chartSpace && !image.chart.relId && !image.chart.partName) {
8460
+ throw new Error("Cannot insert a chart without a relationship allocator.");
8461
+ }
8462
+ return void 0;
8463
+ }
8464
+
8465
+ // docx/chart-edit.ts
8466
+ function isDocxChartEditable(chart) {
8467
+ return Boolean(chart?.chartSpace) && !chart?.layoutId && !chart?.chartEx;
8468
+ }
8469
+ var WP_NS5 = "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing";
8470
+ var EMU_PER_PIXEL2 = 9525;
8471
+ function isSameDiagram(base, next) {
8472
+ return Boolean(base?.parts.data?.partName) && base?.parts.data?.partName === next.parts.data?.partName && !next.inserted;
8473
+ }
8474
+ function patchDiagramExtent(drawing, widthPx, heightPx) {
8475
+ const extent = drawing.getElementsByTagNameNS(WP_NS5, "extent")[0];
8476
+ if (!extent) return;
8477
+ extent.setAttribute("cx", String(Math.max(1, Math.round(widthPx * EMU_PER_PIXEL2))));
8478
+ extent.setAttribute("cy", String(Math.max(1, Math.round(heightPx * EMU_PER_PIXEL2))));
8479
+ }
8480
+ function diagramRun(doc, node, image, base, oldDrawing, oldContainer, allocator) {
8481
+ if (!image.diagram) return void 0;
8482
+ if (base?.diagram && oldDrawing && isSameDiagram(base.diagram, image.diagram)) {
8483
+ if (image.widthPx !== base.widthPx || image.heightPx !== base.heightPx)
8484
+ patchDiagramExtent(oldDrawing, image.widthPx, image.heightPx);
8485
+ clearNonProperties(node, oldContainer);
8486
+ return node;
8487
+ }
8488
+ if (!base && image.diagram.inserted) {
8489
+ throw new Error("Cannot insert SmartArt without a relationship allocator.");
8490
+ }
8491
+ return void 0;
8492
+ }
8493
+ function alternateContentDrawing(content) {
8494
+ const choice = Array.from(content.childNodes).filter(isElement).find((node) => node.localName === "Choice");
8495
+ return choice && findDrawingChild(choice);
8496
+ }
8497
+ function drawingContainer(run) {
8498
+ if (!run) return void 0;
8499
+ for (const child3 of Array.from(run.childNodes))
8500
+ if (isElement(child3) && (named2(child3, "drawing") || named2(child3, "pict"))) return child3;
8501
+ for (const child3 of Array.from(run.childNodes))
8502
+ if (isElement(child3) && child3.localName === "AlternateContent" && alternateContentDrawing(child3))
8503
+ return child3;
8504
+ return void 0;
8505
+ }
8506
+ function findDrawingChild(run) {
8507
+ if (!run) return void 0;
8508
+ for (const child3 of Array.from(run.childNodes)) {
8509
+ if (!isElement(child3)) continue;
8510
+ if (named2(child3, "drawing") || named2(child3, "pict")) return child3;
8511
+ if (child3.localName === "AlternateContent") {
8512
+ const inner = alternateContentDrawing(child3);
8513
+ if (inner) return inner;
8514
+ }
7776
8515
  }
8516
+ return void 0;
8517
+ }
8518
+ function sameUnderlyingImage(a, b) {
8519
+ return Boolean(a.partName) && a.relId === b.relId && a.partName === b.partName;
7777
8520
  }
7778
8521
  function createImageRun(doc, image, base, old, allocator) {
7779
8522
  const node = old ?? makeW(doc, "r");
@@ -7788,6 +8531,10 @@ function createImageRun(doc, image, base, old, allocator) {
7788
8531
  clearNonProperties(node, oldContainer);
7789
8532
  return node;
7790
8533
  }
8534
+ const diagram = diagramRun(doc, node, image, base, oldDrawing, oldContainer);
8535
+ if (diagram) return diagram;
8536
+ const chart = chartRun(doc, node, image, base, oldDrawing, oldContainer);
8537
+ if (chart) return chart;
7791
8538
  if (base && oldDrawing && image.unsupported && JSON.stringify(image) === JSON.stringify(base)) {
7792
8539
  clearNonProperties(node, oldContainer);
7793
8540
  return node;
@@ -7839,24 +8586,24 @@ var COMMENT_ANCHOR_NAMES = [
7839
8586
  "moveToRangeStart",
7840
8587
  "moveToRangeEnd"
7841
8588
  ];
7842
- function isWordElement(element2, names) {
7843
- return (!element2.namespaceURI || element2.namespaceURI === WORD_NS) && names.includes(element2.localName);
8589
+ function isWordElement(element3, names) {
8590
+ return (!element3.namespaceURI || element3.namespaceURI === WORD_NS) && names.includes(element3.localName);
7844
8591
  }
7845
- var isRevisionWrapperElement = (element2) => isWordElement(element2, REVISION_WRAPPER_NAMES);
7846
- var isCommentAnchorElement = (element2) => isWordElement(element2, COMMENT_ANCHOR_NAMES);
7847
- function setAttribute2(element2, local, value) {
7848
- element2.setAttributeNS(WORD_NS, `w:${local}`, value);
8592
+ var isRevisionWrapperElement = (element3) => isWordElement(element3, REVISION_WRAPPER_NAMES);
8593
+ var isCommentAnchorElement = (element3) => isWordElement(element3, COMMENT_ANCHOR_NAMES);
8594
+ function setAttribute2(element3, local, value) {
8595
+ element3.setAttributeNS(WORD_NS, `w:${local}`, value);
7849
8596
  }
7850
- function removeChildren2(element2, local) {
7851
- for (const child of children2(element2, local)) element2.removeChild(child);
8597
+ function removeChildren2(element3, local) {
8598
+ for (const child3 of children2(element3, local)) element3.removeChild(child3);
7852
8599
  }
7853
- function writeRevisionMetadata(element2, revision) {
7854
- setAttribute2(element2, "id", revision.id);
7855
- setAttribute2(element2, "author", revision.author);
7856
- if (revision.date) setAttribute2(element2, "date", revision.date);
7857
- else element2.removeAttributeNS(WORD_NS, "date");
7858
- if (revision.dateUtc) element2.setAttributeNS(WORD_DATE_UTC_NS, "w16du:dateUtc", revision.dateUtc);
7859
- else element2.removeAttributeNS(WORD_DATE_UTC_NS, "dateUtc");
8600
+ function writeRevisionMetadata(element3, revision) {
8601
+ setAttribute2(element3, "id", revision.id);
8602
+ setAttribute2(element3, "author", revision.author);
8603
+ if (revision.date) setAttribute2(element3, "date", revision.date);
8604
+ else element3.removeAttributeNS(WORD_NS, "date");
8605
+ if (revision.dateUtc) element3.setAttributeNS(WORD_DATE_UTC_NS, "w16du:dateUtc", revision.dateUtc);
8606
+ else element3.removeAttributeNS(WORD_DATE_UTC_NS, "dateUtc");
7860
8607
  }
7861
8608
  function revisionTag(kind) {
7862
8609
  return kind === "delete" ? "del" : kind === "moveFrom" ? "moveFrom" : kind === "moveTo" ? "moveTo" : "ins";
@@ -7916,9 +8663,9 @@ function writeParagraphMarkRevision(doc, pPr, paragraph, base) {
7916
8663
  pPr.appendChild(rPr);
7917
8664
  }
7918
8665
  const revision = paragraph.markRevision;
7919
- const element2 = makeW(doc, revision.kind === "delete" ? "del" : "ins");
7920
- writeRevisionMetadata(element2, revision);
7921
- rPr.insertBefore(element2, rPr.firstChild);
8666
+ const element3 = makeW(doc, revision.kind === "delete" ? "del" : "ins");
8667
+ writeRevisionMetadata(element3, revision);
8668
+ rPr.insertBefore(element3, rPr.firstChild);
7922
8669
  }
7923
8670
 
7924
8671
  // docx/highlight.ts
@@ -8016,8 +8763,8 @@ var allowedRunPropertyAttributes = {
8016
8763
  color: ["val", "themeColor", "themeTint", "themeShade"],
8017
8764
  shd: ["val", "fill", "color", "themeFill", "themeFillTint", "themeFillShade"]
8018
8765
  };
8019
- function hasUnexpectedAttributes(element2, allowed, allowDateUtc = false) {
8020
- for (const attribute of Array.from(element2.attributes)) {
8766
+ function hasUnexpectedAttributes(element3, allowed, allowDateUtc = false) {
8767
+ for (const attribute of Array.from(element3.attributes)) {
8021
8768
  if (attribute.namespaceURI === "http://www.w3.org/2000/xmlns/") continue;
8022
8769
  if (allowDateUtc && attribute.namespaceURI === WORD_DATE_UTC_NS && attribute.localName === "dateUtc")
8023
8770
  continue;
@@ -8036,7 +8783,7 @@ function runPropertiesHaveUnknownContent(properties4) {
8036
8783
  const property = node;
8037
8784
  if (property.namespaceURI === WORD_NS && property.localName === "rPrChange") {
8038
8785
  if (hasUnexpectedAttributes(property, ["id", "author", "date"], true) || Array.from(property.childNodes).some(
8039
- (child) => child.nodeType === 3 && child.textContent?.trim()
8786
+ (child3) => child3.nodeType === 3 && child3.textContent?.trim()
8040
8787
  ) || elements(property).length !== 1 || !first2(property, "rPr") || !getW(property, "id") || !getW(property, "author"))
8041
8788
  return true;
8042
8789
  continue;
@@ -8111,13 +8858,13 @@ function restoreRunFormatting(run) {
8111
8858
  }
8112
8859
 
8113
8860
  // docx/field-flags.ts
8114
- function writeFieldFlags(element2, flags) {
8861
+ function writeFieldFlags(element3, flags) {
8115
8862
  for (const [name, value] of [
8116
8863
  ["fldLock", flags?.locked],
8117
8864
  ["dirty", flags?.dirty]
8118
8865
  ]) {
8119
- if (value === void 0) element2.removeAttributeNS(WORD_NS, name);
8120
- else element2.setAttributeNS(WORD_NS, `w:${name}`, value ? "true" : "false");
8866
+ if (value === void 0) element3.removeAttributeNS(WORD_NS, name);
8867
+ else element3.setAttributeNS(WORD_NS, `w:${name}`, value ? "true" : "false");
8121
8868
  }
8122
8869
  }
8123
8870
 
@@ -8132,16 +8879,16 @@ function symbolCharacter(char) {
8132
8879
  var isSymbolFontCharacter = (character) => /^[\uF000-\uF0FF]$/.test(character);
8133
8880
  function runSymbol(content) {
8134
8881
  let found;
8135
- for (const child of content) {
8136
- if (!named2(child, "sym")) continue;
8137
- const symbol = { font: getW(child, "font") ?? "", char: getW(child, "char") ?? "" };
8882
+ for (const child3 of content) {
8883
+ if (!named2(child3, "sym")) continue;
8884
+ const symbol = { font: getW(child3, "font") ?? "", char: getW(child3, "char") ?? "" };
8138
8885
  if (!isSymbolFontCharacter(symbolCharacter(symbol.char))) return null;
8139
8886
  if (found && (found.font !== symbol.font || found.char !== symbol.char)) return null;
8140
8887
  found = symbol;
8141
8888
  }
8142
8889
  const character = found && symbolCharacter(found.char);
8143
8890
  if (character && content.some(
8144
- (child) => (named2(child, "t") || named2(child, "delText")) && child.textContent?.includes(character)
8891
+ (child3) => (named2(child3, "t") || named2(child3, "delText")) && child3.textContent?.includes(character)
8145
8892
  ))
8146
8893
  return null;
8147
8894
  return found;
@@ -8149,12 +8896,12 @@ function runSymbol(content) {
8149
8896
  function runPositionalTab(content) {
8150
8897
  let found;
8151
8898
  let ordinary = false;
8152
- for (const child of content) {
8153
- if (named2(child, "tab")) ordinary = true;
8154
- if (!named2(child, "ptab")) continue;
8155
- const alignment = getW(child, "alignment");
8156
- const relativeTo = getW(child, "relativeTo");
8157
- const leader = getW(child, "leader");
8899
+ for (const child3 of content) {
8900
+ if (named2(child3, "tab")) ordinary = true;
8901
+ if (!named2(child3, "ptab")) continue;
8902
+ const alignment = getW(child3, "alignment");
8903
+ const relativeTo = getW(child3, "relativeTo");
8904
+ const leader = getW(child3, "leader");
8158
8905
  if (!isStPTabAlignment(alignment) || !isStPTabRelativeTo(relativeTo) || leader !== void 0 && !isStPTabLeader(leader))
8159
8906
  return null;
8160
8907
  const tab = { alignment, relativeTo, ...leader !== void 0 && { leader } };
@@ -8163,7 +8910,7 @@ function runPositionalTab(content) {
8163
8910
  }
8164
8911
  return found && ordinary ? null : found;
8165
8912
  }
8166
- function element(doc, local, attributes) {
8913
+ function element2(doc, local, attributes) {
8167
8914
  const node = makeW(doc, local);
8168
8915
  for (const [name, value] of Object.entries(attributes))
8169
8916
  if (value !== void 0) node.setAttributeNS(node.namespaceURI, `w:${name}`, value);
@@ -8172,40 +8919,40 @@ function element(doc, local, attributes) {
8172
8919
  function specialCharacterElement(doc, run, character) {
8173
8920
  if (character === " " && run.positionalTab) {
8174
8921
  const { relativeTo, alignment, leader } = run.positionalTab;
8175
- return element(doc, "ptab", { relativeTo, alignment, leader });
8922
+ return element2(doc, "ptab", { relativeTo, alignment, leader });
8176
8923
  }
8177
8924
  if (character === SOFT_HYPHEN) return makeW(doc, "softHyphen");
8178
8925
  if (character === NON_BREAKING_HYPHEN) return makeW(doc, "noBreakHyphen");
8179
8926
  if (run.symbol && character === symbolCharacter(run.symbol.char))
8180
- return element(doc, "sym", { font: run.symbol.font, char: run.symbol.char });
8927
+ return element2(doc, "sym", { font: run.symbol.font, char: run.symbol.char });
8181
8928
  return void 0;
8182
8929
  }
8183
8930
 
8184
8931
  // docx/write-run.ts
8185
- function setAttribute3(element2, local, value) {
8186
- element2.setAttributeNS(WORD_NS, `w:${local}`, value);
8932
+ function setAttribute3(element3, local, value) {
8933
+ element3.setAttributeNS(WORD_NS, `w:${local}`, value);
8187
8934
  }
8188
- function removeChildren3(element2, local) {
8189
- for (const child of children2(element2, local)) element2.removeChild(child);
8935
+ function removeChildren3(element3, local) {
8936
+ for (const child3 of children2(element3, local)) element3.removeChild(child3);
8190
8937
  }
8191
8938
  function setToggle2(doc, props, local, value) {
8192
8939
  removeChildren3(props, local);
8193
8940
  if (value === void 0) return;
8194
- const element2 = makeW(doc, local);
8195
- if (!value) setAttribute3(element2, "val", "0");
8196
- props.appendChild(element2);
8941
+ const element3 = makeW(doc, local);
8942
+ if (!value) setAttribute3(element3, "val", "0");
8943
+ props.appendChild(element3);
8197
8944
  }
8198
8945
  function setBooleanAttribute(doc, props, local, value) {
8199
- let element2 = first2(props, local);
8946
+ let element3 = first2(props, local);
8200
8947
  if (value === void 0) {
8201
8948
  removeChildren3(props, local);
8202
8949
  return;
8203
8950
  }
8204
- if (!element2) {
8205
- element2 = makeW(doc, local);
8206
- props.appendChild(element2);
8951
+ if (!element3) {
8952
+ element3 = makeW(doc, local);
8953
+ props.appendChild(element3);
8207
8954
  }
8208
- setAttribute3(element2, "val", value ? "1" : "0");
8955
+ setAttribute3(element3, "val", value ? "1" : "0");
8209
8956
  }
8210
8957
  function setLanguageAttribute(doc, props, attribute, value) {
8211
8958
  let language = first2(props, "lang");
@@ -8379,8 +9126,8 @@ function createRun(doc, run, base, old, allocator) {
8379
9126
  setRunProperties(doc, node, run, base);
8380
9127
  if (run.image) return node;
8381
9128
  const formData = run.formField ? first2(first2(node, "fldChar"), "ffData") : void 0;
8382
- for (const child of Array.from(node.childNodes))
8383
- if (child.nodeType !== 1 || child.localName !== "rPr") node.removeChild(child);
9129
+ for (const child3 of Array.from(node.childNodes))
9130
+ if (child3.nodeType !== 1 || child3.localName !== "rPr") node.removeChild(child3);
8384
9131
  if (run.break) {
8385
9132
  const br = makeW(doc, "br");
8386
9133
  setAttribute3(br, "type", run.break);
@@ -8438,21 +9185,21 @@ function createRun(doc, run, base, old, allocator) {
8438
9185
  // docx/character-styles.ts
8439
9186
  function styleElements(document) {
8440
9187
  return Array.from(document.getElementsByTagName("*")).filter(
8441
- (element2) => named2(element2, "style") && (getW(element2, "type") === "character" || getW(element2, "type") === "paragraph")
9188
+ (element3) => named2(element3, "style") && (getW(element3, "type") === "character" || getW(element3, "type") === "paragraph")
8442
9189
  );
8443
9190
  }
8444
9191
  function parseRunStyleCatalog(xml) {
8445
9192
  const document = parseXml2(xml);
8446
9193
  const defaults = first2(first2(document.documentElement, "docDefaults"), "rPrDefault");
8447
9194
  const styles = /* @__PURE__ */ Object.create(null);
8448
- for (const element2 of styleElements(document)) {
8449
- const id = getW(element2, "styleId");
9195
+ for (const element3 of styleElements(document)) {
9196
+ const id = getW(element3, "styleId");
8450
9197
  if (!id) continue;
8451
- const type = getW(element2, "type") === "character" ? "character" : "paragraph";
8452
- const basedOn = getW(first2(element2, "basedOn"), "val");
8453
- const linkedStyle = getW(first2(element2, "link"), "val");
8454
- const isDefault = parseOnOff(getW(element2, "default"));
8455
- const name = getW(first2(element2, "name"), "val");
9198
+ const type = getW(element3, "type") === "character" ? "character" : "paragraph";
9199
+ const basedOn = getW(first2(element3, "basedOn"), "val");
9200
+ const linkedStyle = getW(first2(element3, "link"), "val");
9201
+ const isDefault = parseOnOff(getW(element3, "default"));
9202
+ const name = getW(first2(element3, "name"), "val");
8456
9203
  styles[id] = {
8457
9204
  id,
8458
9205
  type,
@@ -8460,7 +9207,7 @@ function parseRunStyleCatalog(xml) {
8460
9207
  ...basedOn ? { basedOn } : {},
8461
9208
  ...linkedStyle ? { linkedStyle } : {},
8462
9209
  ...isDefault === void 0 ? {} : { isDefault },
8463
- formatting: parseRunProperties(first2(element2, "rPr"))
9210
+ formatting: parseRunProperties(first2(element3, "rPr"))
8464
9211
  };
8465
9212
  }
8466
9213
  const warnings = [];
@@ -8494,12 +9241,12 @@ var SIDES = [
8494
9241
  "insideH",
8495
9242
  "insideV"
8496
9243
  ];
8497
- function borderSide(element2) {
8498
- if (!element2) return void 0;
8499
- const style = enumValue(isStBorder, getW(element2, "val"));
8500
- const size = parseEighthPoints(getW(element2, "sz"));
8501
- const color = parseRgbColor(getW(element2, "color"));
8502
- const themeColor2 = enumValue(isStThemeColor, getW(element2, "themeColor"));
9244
+ function borderSide(element3) {
9245
+ if (!element3) return void 0;
9246
+ const style = enumValue(isStBorder, getW(element3, "val"));
9247
+ const size = parseEighthPoints(getW(element3, "sz"));
9248
+ const color = parseRgbColor(getW(element3, "color"));
9249
+ const themeColor2 = enumValue(isStThemeColor, getW(element3, "themeColor"));
8503
9250
  if (!style && size === void 0 && !color && !themeColor2) return void 0;
8504
9251
  const side = {};
8505
9252
  if (style) side.style = style;
@@ -8538,10 +9285,10 @@ function parseParagraphBorders(pBdr) {
8538
9285
  if (!pBdr) return void 0;
8539
9286
  const result = {};
8540
9287
  for (const side of ["top", "bottom", "left", "right", "between"]) {
8541
- const element2 = first2(pBdr, side) ?? (side === "left" ? first2(pBdr, "start") : side === "right" ? first2(pBdr, "end") : void 0);
8542
- const value = borderSide(element2);
9288
+ const element3 = first2(pBdr, side) ?? (side === "left" ? first2(pBdr, "start") : side === "right" ? first2(pBdr, "end") : void 0);
9289
+ const value = borderSide(element3);
8543
9290
  if (!value) continue;
8544
- const space = parseUnsignedInteger(getW(element2, "space"));
9291
+ const space = parseUnsignedInteger(getW(element3, "space"));
8545
9292
  if (space !== void 0) value.spacePoints = space;
8546
9293
  result[side] = value;
8547
9294
  }
@@ -8594,8 +9341,8 @@ var PAGINATION_KEYS = [
8594
9341
  "contextualSpacing",
8595
9342
  "suppressLineNumbers"
8596
9343
  ];
8597
- function parseOutlineLevel(element2) {
8598
- const raw = getW(element2, "val");
9344
+ function parseOutlineLevel(element3) {
9345
+ const raw = getW(element3, "val");
8599
9346
  if (raw === void 0) return void 0;
8600
9347
  const value = Number(raw);
8601
9348
  if (!Number.isInteger(value) || value < 0 || value > 9) return void 0;
@@ -8658,7 +9405,7 @@ function parseStyleNumbering(pPr) {
8658
9405
  }
8659
9406
  function styleElements2(document) {
8660
9407
  return Array.from(document.getElementsByTagName("*")).filter(
8661
- (element2) => named2(element2, "style") && getW(element2, "type") === "paragraph"
9408
+ (element3) => named2(element3, "style") && getW(element3, "type") === "paragraph"
8662
9409
  );
8663
9410
  }
8664
9411
  function parseParagraphStyleCatalog(xml) {
@@ -8666,20 +9413,20 @@ function parseParagraphStyleCatalog(xml) {
8666
9413
  const defaults = first2(first2(document.documentElement, "docDefaults"), "pPrDefault");
8667
9414
  const pDefaults = first2(defaults, "pPr");
8668
9415
  const styles = /* @__PURE__ */ Object.create(null);
8669
- for (const element2 of styleElements2(document)) {
8670
- const id = getW(element2, "styleId");
9416
+ for (const element3 of styleElements2(document)) {
9417
+ const id = getW(element3, "styleId");
8671
9418
  if (!id) continue;
8672
- const basedOn = getW(first2(element2, "basedOn"), "val");
8673
- const isDefault = parseOnOff(getW(element2, "default"));
8674
- const name = getW(first2(element2, "name"), "val");
8675
- const numbering = parseStyleNumbering(first2(element2, "pPr"));
9419
+ const basedOn = getW(first2(element3, "basedOn"), "val");
9420
+ const isDefault = parseOnOff(getW(element3, "default"));
9421
+ const name = getW(first2(element3, "name"), "val");
9422
+ const numbering = parseStyleNumbering(first2(element3, "pPr"));
8676
9423
  styles[id] = {
8677
9424
  id,
8678
9425
  ...name ? { name } : {},
8679
9426
  ...basedOn ? { basedOn } : {},
8680
9427
  ...isDefault === void 0 ? {} : { isDefault },
8681
9428
  ...numbering ? { numbering } : {},
8682
- formatting: parseFormatting(first2(element2, "pPr"))
9429
+ formatting: parseFormatting(first2(element3, "pPr"))
8683
9430
  };
8684
9431
  }
8685
9432
  const warnings = [];
@@ -8727,7 +9474,7 @@ var REGIONS = [
8727
9474
  ];
8728
9475
  function tableStyleElements(document) {
8729
9476
  return Array.from(document.getElementsByTagName("*")).filter(
8730
- (element2) => named2(element2, "style") && getW(element2, "type") === "table"
9477
+ (element3) => named2(element3, "style") && getW(element3, "type") === "table"
8731
9478
  );
8732
9479
  }
8733
9480
  function conditionalFormatting(block) {
@@ -8747,17 +9494,17 @@ function conditionalFormatting(block) {
8747
9494
  function parseTableStyleCatalog(xml) {
8748
9495
  const document = parseXml2(xml);
8749
9496
  const styles = /* @__PURE__ */ Object.create(null);
8750
- for (const element2 of tableStyleElements(document)) {
8751
- const id = getW(element2, "styleId");
9497
+ for (const element3 of tableStyleElements(document)) {
9498
+ const id = getW(element3, "styleId");
8752
9499
  if (!id) continue;
8753
- const basedOn = getW(first2(element2, "basedOn"), "val");
8754
- const isDefault = parseOnOff(getW(element2, "default"));
8755
- const name = getW(first2(element2, "name"), "val");
8756
- const tblPr = first2(element2, "tblPr");
9500
+ const basedOn = getW(first2(element3, "basedOn"), "val");
9501
+ const isDefault = parseOnOff(getW(element3, "default"));
9502
+ const name = getW(first2(element3, "name"), "val");
9503
+ const tblPr = first2(element3, "tblPr");
8757
9504
  const borders = parseTableBorders(first2(tblPr, "tblBorders"));
8758
9505
  const shadingFill = parseShadingFill(first2(tblPr, "shd"));
8759
9506
  const conditional = {};
8760
- for (const block of children2(element2, "tblStylePr")) {
9507
+ for (const block of children2(element3, "tblStylePr")) {
8761
9508
  const type = getW(block, "type");
8762
9509
  if (type && REGIONS.includes(type))
8763
9510
  conditional[type] = conditionalFormatting(block);
@@ -8870,7 +9617,7 @@ function resolveTableStyleFormatting(tableStyleId, catalog, look, rowIndex, rowC
8870
9617
  // docx/content-control.ts
8871
9618
  var WORD_2012_NS = "http://schemas.microsoft.com/office/word/2012/wordml";
8872
9619
  var sdtContent = (sdt) => first2(sdt, "sdtContent");
8873
- var isSdt = (element2) => named2(element2, "sdt");
9620
+ var isSdt = (element3) => named2(element3, "sdt");
8874
9621
  var TYPE_ELEMENTS = {
8875
9622
  text: "text",
8876
9623
  dropDownList: "dropDownList",
@@ -8884,25 +9631,25 @@ var TYPE_ELEMENTS = {
8884
9631
  docPartObj: "docPartObj",
8885
9632
  docPartList: "docPartList"
8886
9633
  };
8887
- function attrW14(element2, local) {
8888
- return element2?.getAttributeNS(WORD_2010_NS, local) ?? void 0;
9634
+ function attrW14(element3, local) {
9635
+ return element3?.getAttributeNS(WORD_2010_NS, local) ?? void 0;
8889
9636
  }
8890
- function glyph(element2) {
8891
- const code = attrW14(element2, "val");
9637
+ function glyph(element3) {
9638
+ const code = attrW14(element3, "val");
8892
9639
  if (!code) return void 0;
8893
- const font = attrW14(element2, "font");
9640
+ const font = attrW14(element3, "font");
8894
9641
  return { code, ...font ? { font } : {} };
8895
9642
  }
8896
- function kindOf(child) {
8897
- if (child.namespaceURI === WORD_NS)
8898
- return Object.hasOwn(TYPE_ELEMENTS, child.localName) ? TYPE_ELEMENTS[child.localName] : void 0;
8899
- if (child.namespaceURI === WORD_2010_NS && child.localName === "checkbox") return "checkbox";
8900
- if (child.namespaceURI === WORD_2012_NS && child.localName === "repeatingSection")
9643
+ function kindOf(child3) {
9644
+ if (child3.namespaceURI === WORD_NS)
9645
+ return Object.hasOwn(TYPE_ELEMENTS, child3.localName) ? TYPE_ELEMENTS[child3.localName] : void 0;
9646
+ if (child3.namespaceURI === WORD_2010_NS && child3.localName === "checkbox") return "checkbox";
9647
+ if (child3.namespaceURI === WORD_2012_NS && child3.localName === "repeatingSection")
8901
9648
  return "repeatingSection";
8902
9649
  return void 0;
8903
9650
  }
8904
9651
  var typeElements = (sdtPr) => Array.from(sdtPr.childNodes).filter(isElement).filter(
8905
- (child) => kindOf(child) !== void 0 || child.namespaceURI === WORD_NS && child.localName === "richText" || child.namespaceURI === WORD_2010_NS && child.localName === "entityPicker" || child.namespaceURI === WORD_2012_NS && child.localName === "repeatingSectionItem"
9652
+ (child3) => kindOf(child3) !== void 0 || child3.namespaceURI === WORD_NS && child3.localName === "richText" || child3.namespaceURI === WORD_2010_NS && child3.localName === "entityPicker" || child3.namespaceURI === WORD_2012_NS && child3.localName === "repeatingSectionItem"
8906
9653
  );
8907
9654
  function parseKind(sdtPr) {
8908
9655
  const [type] = typeElements(sdtPr);
@@ -8977,9 +9724,9 @@ function expectDefined2(value, context) {
8977
9724
  }
8978
9725
  function isCommentReferenceRun(run) {
8979
9726
  const content = Array.from(run.childNodes).filter(
8980
- (child) => isElement(child) && !named2(child, "rPr")
9727
+ (child3) => isElement(child3) && !named2(child3, "rPr")
8981
9728
  );
8982
- return content.length > 0 && content.every((child) => named2(child, "commentReference"));
9729
+ return content.length > 0 && content.every((child3) => named2(child3, "commentReference"));
8983
9730
  }
8984
9731
 
8985
9732
  // docx/content-control-values.ts
@@ -9055,28 +9802,28 @@ var TYPES = /* @__PURE__ */ new Set([
9055
9802
  `${WORD_2012_NS} repeatingSectionItem`
9056
9803
  ]);
9057
9804
  var EXTENSIBLE = /* @__PURE__ */ new Set(["sdtPr", "rPr"]);
9058
- function propertyShaped(element2) {
9059
- if (Array.from(element2.attributes).some(
9805
+ function propertyShaped(element3) {
9806
+ if (Array.from(element3.attributes).some(
9060
9807
  (attribute) => !ATTRIBUTE_NAMESPACES.has(attribute.namespaceURI ?? "")
9061
9808
  ))
9062
9809
  return false;
9063
- const word = element2.namespaceURI === WORD_NS;
9064
- const allowed = word ? PROPERTY_CHILDREN[element2.localName] : void 0;
9065
- const extensible = !word || EXTENSIBLE.has(element2.localName);
9066
- return Array.from(element2.childNodes).every((child) => {
9067
- if (child.nodeType === 3 || child.nodeType === 4) return !child.textContent?.trim();
9068
- if (child.nodeType !== 1) return true;
9069
- const item = child;
9810
+ const word = element3.namespaceURI === WORD_NS;
9811
+ const allowed = word ? PROPERTY_CHILDREN[element3.localName] : void 0;
9812
+ const extensible = !word || EXTENSIBLE.has(element3.localName);
9813
+ return Array.from(element3.childNodes).every((child3) => {
9814
+ if (child3.nodeType === 3 || child3.nodeType === 4) return !child3.textContent?.trim();
9815
+ if (child3.nodeType !== 1) return true;
9816
+ const item = child3;
9070
9817
  const known = item.namespaceURI === WORD_NS ? allowed?.has(item.localName) === true : extensible && WORD_EXTENSIONS.has(item.namespaceURI ?? "");
9071
9818
  return known && propertyShaped(item);
9072
9819
  });
9073
9820
  }
9074
9821
  function onlyProperties(sdtPr) {
9075
9822
  if (!propertyShaped(sdtPr)) return false;
9076
- const names = elements(sdtPr).map((child) => `${child.namespaceURI} ${child.localName}`);
9823
+ const names = elements(sdtPr).map((child3) => `${child3.namespaceURI} ${child3.localName}`);
9077
9824
  if (new Set(names).size < names.length) return false;
9078
9825
  if (names.filter((name) => TYPES.has(name)).length > 1) return false;
9079
- const value = (local) => children2(sdtPr, local).map((child) => getW(child, "val"));
9826
+ const value = (local) => children2(sdtPr, local).map((child3) => getW(child3, "val"));
9080
9827
  return value("id").every((id) => validId(id) !== void 0) && value("lock").every((lock) => lock === "unlocked" || validLock(lock) !== void 0);
9081
9828
  }
9082
9829
  function verbatimProperties(doc, xml) {
@@ -9114,30 +9861,30 @@ var PROPERTY_ORDER = [
9114
9861
  "label",
9115
9862
  "tabIndex"
9116
9863
  ];
9117
- var rank = (element2) => {
9118
- const index = element2.namespaceURI === WORD_NS ? PROPERTY_ORDER.indexOf(element2.localName) : -1;
9864
+ var rank = (element3) => {
9865
+ const index = element3.namespaceURI === WORD_NS ? PROPERTY_ORDER.indexOf(element3.localName) : -1;
9119
9866
  return index < 0 ? PROPERTY_ORDER.length : index;
9120
9867
  };
9121
- function place(sdtPr, element2) {
9868
+ function place(sdtPr, element3) {
9122
9869
  const siblings = Array.from(sdtPr.childNodes).filter((n2) => n2.nodeType === 1);
9123
- const after = siblings.find((sibling) => rank(sibling) > rank(element2));
9124
- sdtPr.insertBefore(element2, after ?? null);
9870
+ const after = siblings.find((sibling) => rank(sibling) > rank(element3));
9871
+ sdtPr.insertBefore(element3, after ?? null);
9125
9872
  }
9126
9873
  function setValued(doc, sdtPr, local, value) {
9127
9874
  for (const existing of children2(sdtPr, local)) sdtPr.removeChild(existing);
9128
9875
  if (typeof value !== "string") return;
9129
- const element2 = makeW(doc, local);
9130
- element2.setAttributeNS(WORD_NS, "w:val", value);
9131
- place(sdtPr, element2);
9876
+ const element3 = makeW(doc, local);
9877
+ element3.setAttributeNS(WORD_NS, "w:val", value);
9878
+ place(sdtPr, element3);
9132
9879
  }
9133
9880
  var same = (left, right) => JSON.stringify(left) === JSON.stringify(right);
9134
9881
  function w14(doc, local) {
9135
9882
  const prefix = declareIgnorableExtension(doc, WORD_2010_NS, "w14");
9136
9883
  return doc.createElementNS(WORD_2010_NS, `${prefix}:${local}`);
9137
9884
  }
9138
- function w14Attribute(element2, local, value) {
9139
- const prefix = element2.lookupPrefix(WORD_2010_NS) ?? "w14";
9140
- element2.setAttributeNS(WORD_2010_NS, `${prefix}:${local}`, value);
9885
+ function w14Attribute(element3, local, value) {
9886
+ const prefix = element3.lookupPrefix(WORD_2010_NS) ?? "w14";
9887
+ element3.setAttributeNS(WORD_2010_NS, `${prefix}:${local}`, value);
9141
9888
  }
9142
9889
  function checkboxElement(sdtPr) {
9143
9890
  return Array.from(sdtPr.childNodes).find(
@@ -9170,20 +9917,20 @@ function writeCheckbox(doc, sdtPr, control) {
9170
9917
  const replace = (local, build, order) => {
9171
9918
  for (const old of Array.from(box.childNodes))
9172
9919
  if (old.localName === local) box.removeChild(old);
9173
- const element2 = w14(doc, local);
9174
- build(element2);
9920
+ const element3 = w14(doc, local);
9921
+ build(element3);
9175
9922
  const siblings = Array.from(box.childNodes);
9176
- box.insertBefore(element2, siblings[order] ?? null);
9923
+ box.insertBefore(element3, siblings[order] ?? null);
9177
9924
  };
9178
- replace("checked", (el4) => w14Attribute(el4, "val", control.checked ? "1" : "0"), 0);
9925
+ replace("checked", (el5) => w14Attribute(el5, "val", control.checked ? "1" : "0"), 0);
9179
9926
  const states = [validGlyph(control.checkedGlyph), validGlyph(control.uncheckedGlyph)];
9180
9927
  states.forEach((glyph2, index) => {
9181
9928
  if (glyph2)
9182
9929
  replace(
9183
9930
  index ? "uncheckedState" : "checkedState",
9184
- (el4) => {
9185
- w14Attribute(el4, "val", glyph2.code);
9186
- if (glyph2.font) w14Attribute(el4, "font", glyph2.font);
9931
+ (el5) => {
9932
+ w14Attribute(el5, "val", glyph2.code);
9933
+ if (glyph2.font) w14Attribute(el5, "font", glyph2.font);
9187
9934
  },
9188
9935
  index + 1
9189
9936
  );
@@ -9194,10 +9941,10 @@ function writeItems(doc, sdtPr, control) {
9194
9941
  if (!list) return;
9195
9942
  for (const item of children2(list, "listItem")) list.removeChild(item);
9196
9943
  for (const item of validItems(control.items)) {
9197
- const element2 = makeW(doc, "listItem");
9198
- element2.setAttributeNS(WORD_NS, "w:displayText", item.display);
9199
- element2.setAttributeNS(WORD_NS, "w:value", item.value);
9200
- list.appendChild(element2);
9944
+ const element3 = makeW(doc, "listItem");
9945
+ element3.setAttributeNS(WORD_NS, "w:displayText", item.display);
9946
+ element3.setAttributeNS(WORD_NS, "w:value", item.value);
9947
+ list.appendChild(element3);
9201
9948
  }
9202
9949
  }
9203
9950
  function writeDate(doc, sdtPr, control) {
@@ -9210,9 +9957,9 @@ function writeDate(doc, sdtPr, control) {
9210
9957
  const set = (local, value, order) => {
9211
9958
  for (const old of children2(date, local)) date.removeChild(old);
9212
9959
  if (typeof value !== "string") return;
9213
- const element2 = makeW(doc, local);
9214
- element2.setAttributeNS(WORD_NS, "w:val", value);
9215
- date.insertBefore(element2, Array.from(date.childNodes)[order] ?? null);
9960
+ const element3 = makeW(doc, local);
9961
+ element3.setAttributeNS(WORD_NS, "w:val", value);
9962
+ date.insertBefore(element3, Array.from(date.childNodes)[order] ?? null);
9216
9963
  };
9217
9964
  set("dateFormat", control.dateFormat, 0);
9218
9965
  set("lid", control.dateLocale, 1);
@@ -9304,7 +10051,7 @@ function resetContentControl(doc, sdt, control) {
9304
10051
  content = makeW(doc, "sdtContent");
9305
10052
  sdt.appendChild(content);
9306
10053
  }
9307
- for (const child of Array.from(content.childNodes)) content.removeChild(child);
10054
+ for (const child3 of Array.from(content.childNodes)) content.removeChild(child3);
9308
10055
  return content;
9309
10056
  }
9310
10057
 
@@ -9318,13 +10065,13 @@ function rangeKeys(run) {
9318
10065
  }
9319
10066
 
9320
10067
  // docx/write-comments.ts
9321
- function setAttribute4(element2, local, value) {
9322
- element2.setAttributeNS(WORD_NS, `w:${local}`, value);
10068
+ function setAttribute4(element3, local, value) {
10069
+ element3.setAttributeNS(WORD_NS, `w:${local}`, value);
9323
10070
  }
9324
10071
  function commentRangeStartNode(doc, id) {
9325
- const element2 = makeW(doc, "commentRangeStart");
9326
- setAttribute4(element2, "id", id);
9327
- return element2;
10072
+ const element3 = makeW(doc, "commentRangeStart");
10073
+ setAttribute4(element3, "id", id);
10074
+ return element3;
9328
10075
  }
9329
10076
  function commentRangeEndNodes(doc, id) {
9330
10077
  const end = makeW(doc, "commentRangeEnd");
@@ -9337,8 +10084,8 @@ function commentRangeEndNodes(doc, id) {
9337
10084
  }
9338
10085
 
9339
10086
  // docx/write-ranges.ts
9340
- function setW(element2, local, value) {
9341
- element2.setAttributeNS(WORD_NS, `w:${local}`, value);
10087
+ function setW(element3, local, value) {
10088
+ element3.setAttributeNS(WORD_NS, `w:${local}`, value);
9342
10089
  }
9343
10090
  function rangeStartNodes(doc, edge) {
9344
10091
  if (edge.kind === "comment") return [commentRangeStartNode(doc, edge.id)];
@@ -9718,11 +10465,11 @@ function moveMarkers(before, after, markers) {
9718
10465
 
9719
10466
  // docx/inline-markers.ts
9720
10467
  var POSITION_MARKERS = ["bookmarkStart", "bookmarkEnd", "proofErr", "permStart", "permEnd"];
9721
- var isPositionMarker = (element2) => POSITION_MARKERS.some((name) => named2(element2, name));
9722
- var isAnnotationWrapper = (element2) => named2(element2, "smartTag") || named2(element2, "customXml");
9723
- function opensRange(element2) {
9724
- if (named2(element2, "proofErr")) return /Start$/.test(getW(element2, "type") ?? "");
9725
- return named2(element2, "bookmarkStart") || named2(element2, "permStart");
10468
+ var isPositionMarker = (element3) => POSITION_MARKERS.some((name) => named2(element3, name));
10469
+ var isAnnotationWrapper = (element3) => named2(element3, "smartTag") || named2(element3, "customXml");
10470
+ function opensRange(element3) {
10471
+ if (named2(element3, "proofErr")) return /Start$/.test(getW(element3, "type") ?? "");
10472
+ return named2(element3, "bookmarkStart") || named2(element3, "permStart");
9726
10473
  }
9727
10474
  function topLevel(node, paragraph) {
9728
10475
  let current = node;
@@ -9730,27 +10477,27 @@ function topLevel(node, paragraph) {
9730
10477
  current = current.parentNode;
9731
10478
  return current;
9732
10479
  }
9733
- function contentLength(child) {
9734
- if (named2(child, "t") || named2(child, "delText")) return (child.textContent ?? "").length;
9735
- return named2(child, "sym") ? symbolCharacter(getW(child, "char") ?? "").length || 1 : 1;
10480
+ function contentLength(child3) {
10481
+ if (named2(child3, "t") || named2(child3, "delText")) return (child3.textContent ?? "").length;
10482
+ return named2(child3, "sym") ? symbolCharacter(getW(child3, "char") ?? "").length || 1 : 1;
9736
10483
  }
9737
10484
  function splitRun(run, offset) {
9738
10485
  const children3 = Array.from(run.childNodes).filter(isElement);
9739
- const properties4 = children3.find((child) => named2(child, "rPr"));
10486
+ const properties4 = children3.find((child3) => named2(child3, "rPr"));
9740
10487
  const second = run.cloneNode(false);
9741
10488
  if (properties4) second.appendChild(properties4.cloneNode(true));
9742
10489
  let seen = 0;
9743
- for (const child of children3) {
9744
- if (child === properties4) continue;
9745
- const length = contentLength(child);
9746
- if (seen >= offset) second.appendChild(child);
10490
+ for (const child3 of children3) {
10491
+ if (child3 === properties4) continue;
10492
+ const length = contentLength(child3);
10493
+ if (seen >= offset) second.appendChild(child3);
9747
10494
  else if (seen + length > offset) {
9748
- const text2 = child.textContent ?? "";
9749
- const tail = child.cloneNode(false);
9750
- for (const node of Array.from(child.childNodes)) child.removeChild(node);
9751
- child.appendChild(run.ownerDocument.createTextNode(text2.slice(0, offset - seen)));
10495
+ const text2 = child3.textContent ?? "";
10496
+ const tail = child3.cloneNode(false);
10497
+ for (const node of Array.from(child3.childNodes)) child3.removeChild(node);
10498
+ child3.appendChild(run.ownerDocument.createTextNode(text2.slice(0, offset - seen)));
9752
10499
  tail.appendChild(run.ownerDocument.createTextNode(text2.slice(offset - seen)));
9753
- for (const part of [child, tail])
10500
+ for (const part of [child3, tail])
9754
10501
  if (/^\s|\s$/.test(part.textContent ?? ""))
9755
10502
  part.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
9756
10503
  second.appendChild(tail);
@@ -9761,11 +10508,11 @@ function splitRun(run, offset) {
9761
10508
  run.parentNode.insertBefore(second, run.nextSibling);
9762
10509
  return second;
9763
10510
  }
9764
- function rangeKey(element2) {
9765
- const id = getW(element2, "id");
10511
+ function rangeKey(element3) {
10512
+ const id = getW(element3, "id");
9766
10513
  if (id === void 0) return void 0;
9767
- if (named2(element2, "bookmarkStart") || named2(element2, "bookmarkEnd")) return `bookmark:${id}`;
9768
- if (named2(element2, "permStart") || named2(element2, "permEnd")) return `perm:${id}`;
10514
+ if (named2(element3, "bookmarkStart") || named2(element3, "bookmarkEnd")) return `bookmark:${id}`;
10515
+ if (named2(element3, "permStart") || named2(element3, "permEnd")) return `perm:${id}`;
9769
10516
  return void 0;
9770
10517
  }
9771
10518
  function orderRangeEnds(markers) {
@@ -9784,7 +10531,7 @@ function orderRangeEnds(markers) {
9784
10531
  function placeMarkers(paragraph, markers, runs, placed, containers) {
9785
10532
  const positions = runPositions(runs);
9786
10533
  const pieces = /* @__PURE__ */ new Map();
9787
- const insideRun = (index, position2, element2) => {
10534
+ const insideRun = (index, position2, element3) => {
9788
10535
  const run = placed[index]?.splittable;
9789
10536
  if (!run) return false;
9790
10537
  const parts = pieces.get(index) ?? [{ element: run, start: positions[index] }];
@@ -9793,7 +10540,7 @@ function placeMarkers(paragraph, markers, runs, placed, containers) {
9793
10540
  while (at > 0 && parts[at].start > position2) at--;
9794
10541
  const part = parts[at];
9795
10542
  if (part.start === position2) {
9796
- part.element.parentNode.insertBefore(element2, part.element);
10543
+ part.element.parentNode.insertBefore(element3, part.element);
9797
10544
  return true;
9798
10545
  }
9799
10546
  const second = splitRun(part.element, position2 - part.start);
@@ -9801,14 +10548,14 @@ function placeMarkers(paragraph, markers, runs, placed, containers) {
9801
10548
  parts.splice(at + 1, 0, { element: second, start: position2 });
9802
10549
  const written = placed[index];
9803
10550
  if (written?.last === part.element) written.last = second;
9804
- second.parentNode.insertBefore(element2, second);
10551
+ second.parentNode.insertBefore(element3, second);
9805
10552
  return true;
9806
10553
  };
9807
10554
  const done = /* @__PURE__ */ new Set();
9808
- const after = (node, element2) => {
10555
+ const after = (node, element3) => {
9809
10556
  let anchor = node;
9810
10557
  while (anchor.nextSibling && done.has(anchor.nextSibling)) anchor = anchor.nextSibling;
9811
- anchor.parentNode.insertBefore(element2, anchor.nextSibling);
10558
+ anchor.parentNode.insertBefore(element3, anchor.nextSibling);
9812
10559
  };
9813
10560
  const put = (marker) => {
9814
10561
  let boundary = marker.opening ? positions.indexOf(marker.position) : positions.lastIndexOf(marker.position);
@@ -9924,9 +10671,9 @@ function restoreAnnotations(markers, before, after) {
9924
10671
  }
9925
10672
  if (start && opening?.parentNode && node === closing && !between.some((item) => isElement(item) && isSdt(item)) && from.slice(start.source, marker.source) === to.slice(start.position, marker.position)) {
9926
10673
  const copy = annotation.wrapper.cloneNode(false);
9927
- for (const child of Array.from(annotation.wrapper.childNodes))
9928
- if (isElement(child) && (named2(child, "smartTagPr") || named2(child, "customXmlPr")))
9929
- copy.appendChild(child.cloneNode(true));
10674
+ for (const child3 of Array.from(annotation.wrapper.childNodes))
10675
+ if (isElement(child3) && (named2(child3, "smartTagPr") || named2(child3, "customXmlPr")))
10676
+ copy.appendChild(child3.cloneNode(true));
9930
10677
  opening.parentNode.insertBefore(copy, opening);
9931
10678
  for (const item of between) copy.appendChild(item);
9932
10679
  }
@@ -9942,8 +10689,8 @@ function wordColor(color) {
9942
10689
  return hex ? hex.toUpperCase() : "auto";
9943
10690
  }
9944
10691
  function borderElement(doc, name, side) {
9945
- const element2 = makeW(doc, name);
9946
- const set = (local, value) => element2.setAttributeNS(WORD_NS, `w:${local}`, value);
10692
+ const element3 = makeW(doc, name);
10693
+ const set = (local, value) => element3.setAttributeNS(WORD_NS, `w:${local}`, value);
9947
10694
  set("val", side.style ?? "single");
9948
10695
  if (side.style !== "none" && side.style !== "nil") {
9949
10696
  set("sz", String(side.sizeEighthPoints ?? 4));
@@ -9951,12 +10698,12 @@ function borderElement(doc, name, side) {
9951
10698
  set("color", wordColor(side.color));
9952
10699
  if (side.themeColor) set("themeColor", side.themeColor);
9953
10700
  }
9954
- return element2;
10701
+ return element3;
9955
10702
  }
9956
10703
  var sameJson = (a, b) => JSON.stringify(a ?? null) === JSON.stringify(b ?? null);
9957
10704
  function updateShading(doc, props, paragraph, base) {
9958
10705
  if (base && paragraph.shadingFill === base.shadingFill) return;
9959
- for (const element2 of children2(props, "shd")) props.removeChild(element2);
10706
+ for (const element3 of children2(props, "shd")) props.removeChild(element3);
9960
10707
  if (!paragraph.shadingFill) return;
9961
10708
  const shd = makeW(doc, "shd");
9962
10709
  shd.setAttributeNS(WORD_NS, "w:val", "clear");
@@ -9966,7 +10713,7 @@ function updateShading(doc, props, paragraph, base) {
9966
10713
  }
9967
10714
  function updateBorders(doc, props, paragraph, base) {
9968
10715
  if (base && sameJson(paragraph.borders, base.borders)) return;
9969
- for (const element2 of children2(props, "pBdr")) props.removeChild(element2);
10716
+ for (const element3 of children2(props, "pBdr")) props.removeChild(element3);
9970
10717
  const borders = paragraph.borders;
9971
10718
  if (!borders) return;
9972
10719
  const pBdr = makeW(doc, "pBdr");
@@ -9982,18 +10729,18 @@ function writeParagraphDecoration(doc, props, paragraph, base) {
9982
10729
  }
9983
10730
 
9984
10731
  // docx/write-paragraph-properties.ts
9985
- function setAttribute5(element2, local, value) {
9986
- element2.setAttributeNS(WORD_NS, `w:${local}`, value);
10732
+ function setAttribute5(element3, local, value) {
10733
+ element3.setAttributeNS(WORD_NS, `w:${local}`, value);
9987
10734
  }
9988
- function setWordValue(element2, local, value) {
9989
- if (value === void 0) element2.removeAttributeNS(WORD_NS, local);
9990
- else setAttribute5(element2, local, String(value));
10735
+ function setWordValue(element3, local, value) {
10736
+ if (value === void 0) element3.removeAttributeNS(WORD_NS, local);
10737
+ else setAttribute5(element3, local, String(value));
9991
10738
  }
9992
10739
  function updateDirection(doc, props, paragraph, base) {
9993
10740
  if (base && paragraph.direction === base.direction) return;
9994
10741
  let bidi = first2(props, "bidi");
9995
10742
  if (paragraph.direction === void 0) {
9996
- for (const element2 of children2(props, "bidi")) props.removeChild(element2);
10743
+ for (const element3 of children2(props, "bidi")) props.removeChild(element3);
9997
10744
  } else {
9998
10745
  if (!bidi) {
9999
10746
  bidi = makeW(doc, "bidi");
@@ -10044,11 +10791,11 @@ function updateIndent(doc, props, paragraph, base) {
10044
10791
  }
10045
10792
  function updatePageBreakBefore(doc, props, paragraph, base) {
10046
10793
  if (base && paragraph.pageBreakBefore === base.pageBreakBefore) return;
10047
- for (const element2 of children2(props, "pageBreakBefore")) props.removeChild(element2);
10794
+ for (const element3 of children2(props, "pageBreakBefore")) props.removeChild(element3);
10048
10795
  if (paragraph.pageBreakBefore !== void 0) {
10049
- const element2 = makeW(doc, "pageBreakBefore");
10050
- if (!paragraph.pageBreakBefore) element2.setAttributeNS(WORD_NS, "w:val", "0");
10051
- props.appendChild(element2);
10796
+ const element3 = makeW(doc, "pageBreakBefore");
10797
+ if (!paragraph.pageBreakBefore) element3.setAttributeNS(WORD_NS, "w:val", "0");
10798
+ props.appendChild(element3);
10052
10799
  }
10053
10800
  }
10054
10801
  function updateKeepOptions(doc, props, paragraph, base) {
@@ -10060,12 +10807,12 @@ function updateKeepOptions(doc, props, paragraph, base) {
10060
10807
  "suppressLineNumbers"
10061
10808
  ]) {
10062
10809
  if (base && paragraph[key] === base[key]) continue;
10063
- for (const element3 of children2(props, key)) props.removeChild(element3);
10810
+ for (const element4 of children2(props, key)) props.removeChild(element4);
10064
10811
  const value = paragraph[key];
10065
10812
  if (value === void 0) continue;
10066
- const element2 = makeW(doc, key);
10067
- if (!value) setAttribute5(element2, "val", "0");
10068
- props.appendChild(element2);
10813
+ const element3 = makeW(doc, key);
10814
+ if (!value) setAttribute5(element3, "val", "0");
10815
+ props.appendChild(element3);
10069
10816
  }
10070
10817
  }
10071
10818
  function updateDropCap(doc, props, paragraph, base) {
@@ -10139,8 +10886,8 @@ function reconcileBookmarks(doc, starts, ends, names, baseNames, nextId) {
10139
10886
  }
10140
10887
 
10141
10888
  // docx/numbering-write.ts
10142
- function setAttribute6(element2, local, value) {
10143
- element2.setAttributeNS(WORD_NS, `w:${local}`, value);
10889
+ function setAttribute6(element3, local, value) {
10890
+ element3.setAttributeNS(WORD_NS, `w:${local}`, value);
10144
10891
  }
10145
10892
  function sameNumbering(a, b) {
10146
10893
  return a?.numId === b?.numId && a?.level === b?.level;
@@ -10206,8 +10953,8 @@ var MATH_NAMESPACES = /* @__PURE__ */ new Set([
10206
10953
  "http://purl.oclc.org/ooxml/officeDocument/math"
10207
10954
  ]);
10208
10955
  var MATH_NS = "http://schemas.openxmlformats.org/officeDocument/2006/math";
10209
- function isEquationElement(element2) {
10210
- return MATH_NAMESPACES.has(element2.namespaceURI ?? "") && (element2.localName === "oMath" || element2.localName === "oMathPara");
10956
+ function isEquationElement(element3) {
10957
+ return MATH_NAMESPACES.has(element3.namespaceURI ?? "") && (element3.localName === "oMath" || element3.localName === "oMathPara");
10211
10958
  }
10212
10959
  function writeEquation(doc, run, base, old) {
10213
10960
  const equation = run.equation;
@@ -10225,19 +10972,19 @@ function writeEquation(doc, run, base, old) {
10225
10972
  }
10226
10973
  if (!isEquationElement(source))
10227
10974
  throw new Error("Equation markup must be an m:oMath or m:oMathPara element.");
10228
- let element2 = doc.importNode(source, true);
10229
- if (equation.display && element2.localName === "oMath") {
10975
+ let element3 = doc.importNode(source, true);
10976
+ if (equation.display && element3.localName === "oMath") {
10230
10977
  const para = doc.createElementNS(MATH_NS, "m:oMathPara");
10231
10978
  para.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:m", MATH_NS);
10232
- para.appendChild(element2);
10233
- element2 = para;
10234
- } else if (!equation.display && element2.localName === "oMathPara") {
10235
- const inner = Array.from(element2.childNodes).find(
10979
+ para.appendChild(element3);
10980
+ element3 = para;
10981
+ } else if (!equation.display && element3.localName === "oMathPara") {
10982
+ const inner = Array.from(element3.childNodes).find(
10236
10983
  (node) => node.nodeType === 1 && node.localName === "oMath"
10237
10984
  );
10238
- if (inner) element2 = inner;
10985
+ if (inner) element3 = inner;
10239
10986
  }
10240
- return element2;
10987
+ return element3;
10241
10988
  }
10242
10989
 
10243
10990
  // docx/field-lock.ts
@@ -10414,8 +11161,8 @@ function containerSources(runs, base, slots) {
10414
11161
  }
10415
11162
 
10416
11163
  // docx/write-inline.ts
10417
- function setW2(element2, local, value) {
10418
- element2.setAttributeNS(WORD_NS, `w:${local}`, value);
11164
+ function setW2(element3, local, value) {
11165
+ element3.setAttributeNS(WORD_NS, `w:${local}`, value);
10419
11166
  }
10420
11167
  function newHyperlink(doc, link, allocator) {
10421
11168
  const container = makeW(doc, "hyperlink");
@@ -10499,7 +11246,7 @@ function buildInlineContent(doc, runs, base, slots, allocator, ranges, sources =
10499
11246
  target = resetContentControl(doc, container, group2.control);
10500
11247
  } else if (reusable) {
10501
11248
  container = onlyContainer;
10502
- for (const child of Array.from(container.childNodes)) container.removeChild(child);
11249
+ for (const child3 of Array.from(container.childNodes)) container.removeChild(child3);
10503
11250
  } else if (group2.kind === "control") {
10504
11251
  const created = createContentControl(doc, group2.control);
10505
11252
  container = created.sdt;
@@ -10526,7 +11273,7 @@ function buildInlineContent(doc, runs, base, slots, allocator, ranges, sources =
10526
11273
  // docx/inline-slots.ts
10527
11274
  function runIsSafe(run) {
10528
11275
  const content = Array.from(run.childNodes).filter(
10529
- (child) => isElement(child) && !named2(child, "rPr") && !isCachedPageBreak(child)
11276
+ (child3) => isElement(child3) && !named2(child3, "rPr") && !isCachedPageBreak(child3)
10530
11277
  );
10531
11278
  const only = content.length === 1 ? content[0] : void 0;
10532
11279
  if (only && named2(only, "br") && isModeledBreak(only)) return true;
@@ -10543,14 +11290,14 @@ function runIsSafe(run) {
10543
11290
  const [ffData] = data;
10544
11291
  return type === "begin" && data.length === 1 && isElement(ffData) && isModeledFormFieldData(ffData);
10545
11292
  }
10546
- if (content.length && content.every((element2) => named2(element2, "instrText"))) return true;
11293
+ if (content.length && content.every((element3) => named2(element3, "instrText"))) return true;
10547
11294
  if (runSymbol(content) === null || runPositionalTab(content) === null) return false;
10548
11295
  const kinds = /* @__PURE__ */ new Set();
10549
- for (const element2 of content) {
10550
- if (element2.localName === "br" && hasSpecialBreak(element2)) return false;
10551
- if (element2.localName === "cr" && element2.attributes.length > 0) return false;
10552
- if (element2.localName === "AlternateContent") {
10553
- if (!alternateContentDrawing(element2)) return false;
11296
+ for (const element3 of content) {
11297
+ if (element3.localName === "br" && hasSpecialBreak(element3)) return false;
11298
+ if (element3.localName === "cr" && element3.attributes.length > 0) return false;
11299
+ if (element3.localName === "AlternateContent") {
11300
+ if (!alternateContentDrawing(element3)) return false;
10554
11301
  kinds.add("drawing");
10555
11302
  continue;
10556
11303
  }
@@ -10567,51 +11314,51 @@ function runIsSafe(run) {
10567
11314
  "drawing",
10568
11315
  "pict"
10569
11316
  ];
10570
- if (!allowed.includes(element2.localName)) return false;
10571
- kinds.add(element2.localName);
11317
+ if (!allowed.includes(element3.localName)) return false;
11318
+ kinds.add(element3.localName);
10572
11319
  }
10573
11320
  return !((kinds.has("drawing") || kinds.has("pict")) && kinds.size > 1);
10574
11321
  }
10575
11322
  function runsOf(parent, container, slots, markers, paragraph, revision) {
10576
11323
  const inContainer = { ...container && { container }, ...revision && { revision } };
10577
- for (const child of Array.from(parent.childNodes)) {
10578
- if (!isElement(child)) {
10579
- if (child.nodeType === 3 && child.textContent?.trim()) return false;
11324
+ for (const child3 of Array.from(parent.childNodes)) {
11325
+ if (!isElement(child3)) {
11326
+ if (child3.nodeType === 3 && child3.textContent?.trim()) return false;
10580
11327
  continue;
10581
11328
  }
10582
- if (parent === paragraph && named2(child, "pPr")) continue;
10583
- if (isEquationElement(child)) {
10584
- slots.push({ element: child, ...inContainer });
10585
- } else if (named2(child, "r")) {
10586
- if (isCommentReferenceRun(child)) continue;
10587
- if (!runIsSafe(child)) return false;
10588
- slots.push({ element: child, ...inContainer });
10589
- } else if (isPositionMarker(child)) {
10590
- markers.push({ element: child, boundary: slots.length, ...inContainer });
10591
- } else if (named2(child, "smartTagPr") || named2(child, "customXmlPr")) {
11329
+ if (parent === paragraph && named2(child3, "pPr")) continue;
11330
+ if (isEquationElement(child3)) {
11331
+ slots.push({ element: child3, ...inContainer });
11332
+ } else if (named2(child3, "r")) {
11333
+ if (isCommentReferenceRun(child3)) continue;
11334
+ if (!runIsSafe(child3)) return false;
11335
+ slots.push({ element: child3, ...inContainer });
11336
+ } else if (isPositionMarker(child3)) {
11337
+ markers.push({ element: child3, boundary: slots.length, ...inContainer });
11338
+ } else if (named2(child3, "smartTagPr") || named2(child3, "customXmlPr")) {
10592
11339
  if (!isAnnotationWrapper(parent)) return false;
10593
- } else if (isAnnotationWrapper(child)) {
11340
+ } else if (isAnnotationWrapper(child3)) {
10594
11341
  const edge = (side) => markers.push({
10595
- element: annotationEdge(child),
11342
+ element: annotationEdge(child3),
10596
11343
  boundary: slots.length,
10597
- annotation: { wrapper: child, edge: side },
11344
+ annotation: { wrapper: child3, edge: side },
10598
11345
  ...inContainer
10599
11346
  });
10600
11347
  edge("start");
10601
- if (!runsOf(child, container, slots, markers, paragraph, revision)) return false;
11348
+ if (!runsOf(child3, container, slots, markers, paragraph, revision)) return false;
10602
11349
  edge("end");
10603
- } else if (isRevisionWrapperElement(child) && (!container || isSdt(container))) {
10604
- if (!runsOf(child, container, slots, markers, paragraph, child)) return false;
10605
- } else if (isSdt(child) && parent === paragraph) {
10606
- const content = sdtContent(child);
11350
+ } else if (isRevisionWrapperElement(child3) && (!container || isSdt(container))) {
11351
+ if (!runsOf(child3, container, slots, markers, paragraph, child3)) return false;
11352
+ } else if (isSdt(child3) && parent === paragraph) {
11353
+ const content = sdtContent(child3);
10607
11354
  const before = slots.length;
10608
- if (content && !runsOf(content, child, slots, markers, paragraph)) return false;
10609
- if (slots.length === before) slots.push({ container: child });
10610
- } else if ((named2(child, "hyperlink") || named2(child, "fldSimple")) && !container) {
11355
+ if (content && !runsOf(content, child3, slots, markers, paragraph)) return false;
11356
+ if (slots.length === before) slots.push({ container: child3 });
11357
+ } else if ((named2(child3, "hyperlink") || named2(child3, "fldSimple")) && !container) {
10611
11358
  const before = slots.length;
10612
- if (!runsOf(child, child, slots, markers, paragraph, revision)) return false;
10613
- if (named2(child, "fldSimple") && slots.length === before) slots.push({ container: child });
10614
- } else if (!isCommentAnchorElement(child) || container) return false;
11359
+ if (!runsOf(child3, child3, slots, markers, paragraph, revision)) return false;
11360
+ if (named2(child3, "fldSimple") && slots.length === before) slots.push({ container: child3 });
11361
+ } else if (!isCommentAnchorElement(child3) || container) return false;
10615
11362
  }
10616
11363
  return true;
10617
11364
  }
@@ -10622,7 +11369,7 @@ function collectInlineSlots(paragraph) {
10622
11369
  }
10623
11370
  function replaceableInlineChildren(paragraph) {
10624
11371
  return Array.from(paragraph.childNodes).filter(
10625
- (child) => isElement(child) && (isEquationElement(child) || named2(child, "r") || named2(child, "hyperlink") || named2(child, "fldSimple") || isSdt(child) || isRevisionWrapperElement(child) || isAnnotationWrapper(child) || isPositionMarker(child) || isCommentAnchorElement(child))
11372
+ (child3) => isElement(child3) && (isEquationElement(child3) || named2(child3, "r") || named2(child3, "hyperlink") || named2(child3, "fldSimple") || isSdt(child3) || isRevisionWrapperElement(child3) || isAnnotationWrapper(child3) || isPositionMarker(child3) || isCommentAnchorElement(child3))
10626
11373
  );
10627
11374
  }
10628
11375
 
@@ -10703,11 +11450,11 @@ function runsToWriteAnew(paragraph, base, slots) {
10703
11450
  }
10704
11451
 
10705
11452
  // docx/write-paragraph.ts
10706
- function setAttribute7(element2, local, value) {
10707
- element2.setAttributeNS(WORD_NS, `w:${local}`, value);
11453
+ function setAttribute7(element3, local, value) {
11454
+ element3.setAttributeNS(WORD_NS, `w:${local}`, value);
10708
11455
  }
10709
- function removeChildren4(element2, local) {
10710
- for (const child of children2(element2, local)) element2.removeChild(child);
11456
+ function removeChildren4(element3, local) {
11457
+ for (const child3 of children2(element3, local)) element3.removeChild(child3);
10711
11458
  }
10712
11459
  function writeParagraphImpl(doc, paragraph, node, base, allocator, spans) {
10713
11460
  const ranges = spans;
@@ -10761,12 +11508,12 @@ function writeParagraphImpl(doc, paragraph, node, base, allocator, spans) {
10761
11508
  orderParagraphProperties(pPr);
10762
11509
  const { slots, markers } = layout;
10763
11510
  const anew = runsToWriteAnew(paragraph, base, slots);
10764
- const isBookmark = (element2) => named2(element2, "bookmarkStart") || named2(element2, "bookmarkEnd");
11511
+ const isBookmark = (element3) => named2(element3, "bookmarkStart") || named2(element3, "bookmarkEnd");
10765
11512
  const sourceBookmarks = markers.map((marker) => marker.element).filter(isBookmark);
10766
11513
  const { starts, ends } = reconcileBookmarks(
10767
11514
  doc,
10768
- sourceBookmarks.filter((element2) => named2(element2, "bookmarkStart")),
10769
- sourceBookmarks.filter((element2) => named2(element2, "bookmarkEnd")),
11515
+ sourceBookmarks.filter((element3) => named2(element3, "bookmarkStart")),
11516
+ sourceBookmarks.filter((element3) => named2(element3, "bookmarkEnd")),
10770
11517
  paragraph.bookmarks ?? [],
10771
11518
  [],
10772
11519
  () => "0"
@@ -10805,7 +11552,7 @@ function writeParagraphImpl(doc, paragraph, node, base, allocator, spans) {
10805
11552
  anew
10806
11553
  );
10807
11554
  let anchor = pPr;
10808
- for (const bookmark of starts.filter((element2) => !source.has(element2))) {
11555
+ for (const bookmark of starts.filter((element3) => !source.has(element3))) {
10809
11556
  node.insertBefore(bookmark, anchor.nextSibling);
10810
11557
  anchor = bookmark;
10811
11558
  }
@@ -10815,7 +11562,7 @@ function writeParagraphImpl(doc, paragraph, node, base, allocator, spans) {
10815
11562
  }
10816
11563
  placeMarkers(node, carried, paragraph.runs, placed, containers);
10817
11564
  restoreAnnotations(carried, [], paragraph.runs);
10818
- for (const bookmark of ends.filter((element2) => !source.has(element2))) node.appendChild(bookmark);
11565
+ for (const bookmark of ends.filter((element3) => !source.has(element3))) node.appendChild(bookmark);
10819
11566
  if (!pPr.childNodes.length) node.removeChild(pPr);
10820
11567
  return node;
10821
11568
  }
@@ -10986,9 +11733,9 @@ function restoreParagraphFormatting(paragraph) {
10986
11733
  if (paragraph.sourceParagraphPropertiesXml) {
10987
11734
  const current = parsePropertiesSnapshot(paragraph.sourceParagraphPropertiesXml, "pPr");
10988
11735
  for (const name of ["rPr", "sectPr"]) {
10989
- const element2 = first2(current, name);
10990
- if (element2 && !first2(properties4, name))
10991
- properties4.appendChild(properties4.ownerDocument.importNode(element2, true));
11736
+ const element3 = first2(current, name);
11737
+ if (element3 && !first2(properties4, name))
11738
+ properties4.appendChild(properties4.ownerDocument.importNode(element3, true));
10992
11739
  }
10993
11740
  orderParagraphProperties(properties4);
10994
11741
  }
@@ -11355,9 +12102,9 @@ var runPropertiesMark = {
11355
12102
  parseDOM: [
11356
12103
  {
11357
12104
  tag: "span[data-run-props]",
11358
- getAttrs: (el4) => {
12105
+ getAttrs: (el5) => {
11359
12106
  try {
11360
- return { props: JSON.parse(el4.dataset.runProps || "null") };
12107
+ return { props: JSON.parse(el5.dataset.runProps || "null") };
11361
12108
  } catch {
11362
12109
  return { props: null };
11363
12110
  }
@@ -11406,11 +12153,11 @@ function commentIdsFromNode(node) {
11406
12153
  }
11407
12154
 
11408
12155
  // docx/ui/run-mark-properties.ts
11409
- function propertyOfMark(child, name) {
11410
- return child.marks.find((mark) => mark.type.name === name);
12156
+ function propertyOfMark(child3, name) {
12157
+ return child3.marks.find((mark) => mark.type.name === name);
11411
12158
  }
11412
- function linkFromMarks(child) {
11413
- const link = propertyOfMark(child, "link");
12159
+ function linkFromMarks(child3) {
12160
+ const link = propertyOfMark(child3, "link");
11414
12161
  if (!link) return void 0;
11415
12162
  const info = {};
11416
12163
  if (link.attrs.href) info.href = link.attrs.href;
@@ -11418,28 +12165,28 @@ function linkFromMarks(child) {
11418
12165
  if (link.attrs.tooltip) info.tooltip = link.attrs.tooltip;
11419
12166
  return info.href || info.anchor ? info : void 0;
11420
12167
  }
11421
- function applyMarkFormatting(run, child) {
11422
- if (propertyOfMark(child, "bold")) run.bold = true;
11423
- if (propertyOfMark(child, "italic")) run.italic = true;
11424
- if (propertyOfMark(child, "underline")) run.underline = true;
11425
- if (propertyOfMark(child, "strike")) run.strike = true;
11426
- const highlight = propertyOfMark(child, "highlight");
12168
+ function applyMarkFormatting(run, child3) {
12169
+ if (propertyOfMark(child3, "bold")) run.bold = true;
12170
+ if (propertyOfMark(child3, "italic")) run.italic = true;
12171
+ if (propertyOfMark(child3, "underline")) run.underline = true;
12172
+ if (propertyOfMark(child3, "strike")) run.strike = true;
12173
+ const highlight = propertyOfMark(child3, "highlight");
11427
12174
  if (highlight?.attrs.color) run.highlight = highlight.attrs.color;
11428
- const verticalAlign = propertyOfMark(child, "verticalAlign");
12175
+ const verticalAlign = propertyOfMark(child3, "verticalAlign");
11429
12176
  if (verticalAlign?.attrs.value) run.verticalAlign = verticalAlign.attrs.value;
11430
- const language = propertyOfMark(child, "language");
12177
+ const language = propertyOfMark(child3, "language");
11431
12178
  if (language?.attrs.language != null) run.language = language.attrs.language;
11432
12179
  if (language?.attrs.eastAsiaLanguage != null)
11433
12180
  run.eastAsiaLanguage = language.attrs.eastAsiaLanguage;
11434
12181
  if (language?.attrs.bidiLanguage != null) run.bidiLanguage = language.attrs.bidiLanguage;
11435
- const rtl = propertyOfMark(child, "runRtl");
12182
+ const rtl = propertyOfMark(child3, "runRtl");
11436
12183
  if (rtl) run.rtl = rtl.attrs.value;
11437
- const font = propertyOfMark(child, "font");
12184
+ const font = propertyOfMark(child3, "font");
11438
12185
  if (font?.attrs.family) run.fontFamily = font.attrs.family;
11439
12186
  if (font?.attrs.size) run.fontSize = font.attrs.size;
11440
12187
  if (font?.attrs.color) run.color = font.attrs.color;
11441
- const insertion = propertyOfMark(child, "insertion");
11442
- const deletion = propertyOfMark(child, "deletion");
12188
+ const insertion = propertyOfMark(child3, "insertion");
12189
+ const deletion = propertyOfMark(child3, "deletion");
11443
12190
  const revisionMark = insertion ?? deletion;
11444
12191
  if (revisionMark) {
11445
12192
  const move = typeof revisionMark.attrs.move === "string" ? JSON.parse(revisionMark.attrs.move) : void 0;
@@ -11453,19 +12200,19 @@ function applyMarkFormatting(run, child) {
11453
12200
  ...move ? { move } : {}
11454
12201
  };
11455
12202
  }
11456
- const commentIds = commentIdsFromMarks(child.marks);
12203
+ const commentIds = commentIdsFromMarks(child3.marks);
11457
12204
  if (commentIds.length) run.commentIds = commentIds;
11458
- const control = propertyOfMark(child, "contentControl");
12205
+ const control = propertyOfMark(child3, "contentControl");
11459
12206
  if (control?.attrs.data) run.contentControl = JSON.parse(String(control.attrs.data));
11460
- const field = propertyOfMark(child, "field");
12207
+ const field = propertyOfMark(child3, "field");
11461
12208
  if (field)
11462
12209
  run.field = {
11463
12210
  instr: String(field.attrs.instr),
11464
12211
  ...field.attrs.simple ? { simple: true } : {}
11465
12212
  };
11466
- const characterStyle = propertyOfMark(child, "characterStyle");
12213
+ const characterStyle = propertyOfMark(child3, "characterStyle");
11467
12214
  if (characterStyle?.attrs.id) run.style = String(characterStyle.attrs.id);
11468
- const extra = propertyOfMark(child, "runProperties");
12215
+ const extra = propertyOfMark(child3, "runProperties");
11469
12216
  if (extra?.attrs.props)
11470
12217
  for (const [key, value] of Object.entries(structuredClone(extra.attrs.props))) {
11471
12218
  const field2 = key;
@@ -11667,90 +12414,90 @@ function runToInlineNodes(run, schema, noteNumber) {
11667
12414
  (piece) => piece === "\n" ? [breakNode()] : piece ? [schema.text(piece, marks)] : []
11668
12415
  );
11669
12416
  }
11670
- function applyInlineFormat(run, child) {
11671
- Object.assign(run, inlineRunProperties(child));
12417
+ function applyInlineFormat(run, child3) {
12418
+ Object.assign(run, inlineRunProperties(child3));
11672
12419
  const marks = { text: "", ...run.revision ? { revision: run.revision } : {} };
11673
- applyMarkFormatting(marks, child);
12420
+ applyMarkFormatting(marks, child3);
11674
12421
  const { text: _text, ...properties4 } = marks;
11675
12422
  Object.assign(run, properties4);
11676
- const ids = commentIdsFromNode(child);
12423
+ const ids = commentIdsFromNode(child3);
11677
12424
  if (ids.length) run.commentIds = ids;
11678
12425
  else delete run.commentIds;
11679
12426
  }
11680
- function inlineNodeRun(child) {
12427
+ function inlineNodeRun(child3) {
11681
12428
  const runs = [];
11682
- appendInlineNode(runs, child);
12429
+ appendInlineNode(runs, child3);
11683
12430
  return runs[0];
11684
12431
  }
11685
- function appendInlineNode(runs, child) {
11686
- if (child.type.name === "equation") {
12432
+ function appendInlineNode(runs, child3) {
12433
+ if (child3.type.name === "equation") {
11687
12434
  const run2 = {
11688
12435
  text: "",
11689
- equation: { omml: String(child.attrs.omml), display: Boolean(child.attrs.display) }
12436
+ equation: { omml: String(child3.attrs.omml), display: Boolean(child3.attrs.display) }
11690
12437
  };
11691
- applyInlineFormat(run2, child);
12438
+ applyInlineFormat(run2, child3);
11692
12439
  runs.push(run2);
11693
12440
  return;
11694
12441
  }
11695
- if (child.type.name === "pageBreak") {
11696
- const run2 = { text: "", break: child.attrs.kind === "column" ? "column" : "page" };
11697
- applyInlineFormat(run2, child);
12442
+ if (child3.type.name === "pageBreak") {
12443
+ const run2 = { text: "", break: child3.attrs.kind === "column" ? "column" : "page" };
12444
+ applyInlineFormat(run2, child3);
11698
12445
  runs.push(run2);
11699
12446
  return;
11700
12447
  }
11701
- if (child.type.name === "fieldMarker") {
11702
- const marker = child.attrs.kind === "code" ? { text: "", fieldCode: String(child.attrs.code ?? "") } : { text: "", fieldChar: child.attrs.kind };
11703
- applyInlineFormat(marker, child);
12448
+ if (child3.type.name === "fieldMarker") {
12449
+ const marker = child3.attrs.kind === "code" ? { text: "", fieldCode: String(child3.attrs.code ?? "") } : { text: "", fieldChar: child3.attrs.kind };
12450
+ applyInlineFormat(marker, child3);
11704
12451
  runs.push(marker);
11705
12452
  return;
11706
12453
  }
11707
- if (child.type.name === "noteReference") {
12454
+ if (child3.type.name === "noteReference") {
11708
12455
  const reference = {
11709
12456
  text: "",
11710
12457
  noteReference: {
11711
- kind: child.attrs.kind === "endnote" ? "endnote" : "footnote",
11712
- id: String(child.attrs.id || "")
12458
+ kind: child3.attrs.kind === "endnote" ? "endnote" : "footnote",
12459
+ id: String(child3.attrs.id || "")
11713
12460
  }
11714
12461
  };
11715
- applyInlineFormat(reference, child);
12462
+ applyInlineFormat(reference, child3);
11716
12463
  runs.push(reference);
11717
12464
  return;
11718
12465
  }
11719
- if (child.type.name === "image") {
11720
- const imageLink = linkFromMarks(child);
12466
+ if (child3.type.name === "image") {
12467
+ const imageLink = linkFromMarks(child3);
11721
12468
  runs.push({
11722
12469
  text: "",
11723
12470
  image: {
11724
- relId: child.attrs.relId,
11725
- partName: child.attrs.partName,
11726
- contentType: child.attrs.contentType,
11727
- widthPx: child.attrs.widthPx,
11728
- heightPx: child.attrs.heightPx,
11729
- ...child.attrs.altText ? { altText: child.attrs.altText } : {},
11730
- ...child.attrs.title ? { title: child.attrs.title } : {},
11731
- ...child.attrs.anchored ? { anchored: true } : {},
11732
- ...child.attrs.svgPartName ? { svgPartName: child.attrs.svgPartName } : {},
12471
+ relId: child3.attrs.relId,
12472
+ partName: child3.attrs.partName,
12473
+ contentType: child3.attrs.contentType,
12474
+ widthPx: child3.attrs.widthPx,
12475
+ heightPx: child3.attrs.heightPx,
12476
+ ...child3.attrs.altText ? { altText: child3.attrs.altText } : {},
12477
+ ...child3.attrs.title ? { title: child3.attrs.title } : {},
12478
+ ...child3.attrs.anchored ? { anchored: true } : {},
12479
+ ...child3.attrs.svgPartName ? { svgPartName: child3.attrs.svgPartName } : {},
11733
12480
  // Same key order as the parser's run: the writer compares an unchanged placeholder run by JSON.
11734
- ...child.attrs.unsupported ? { unsupported: child.attrs.unsupported } : {},
11735
- ...typeof child.attrs.diagram === "string" ? { diagram: JSON.parse(child.attrs.diagram) } : {},
11736
- ...typeof child.attrs.chart === "string" ? { chart: JSON.parse(child.attrs.chart) } : {},
11737
- ...typeof child.attrs.shape === "string" ? { shape: JSON.parse(child.attrs.shape) } : {},
11738
- ...typeof child.attrs.placement === "string" ? { placement: JSON.parse(child.attrs.placement) } : {},
11739
- ...typeof child.attrs.textBoxText === "string" ? { textBoxText: JSON.parse(child.attrs.textBoxText) } : {},
11740
- ...child.attrs.textBoxEditable ? { textBoxEditable: true } : {},
11741
- ...child.attrs.textBoxEditable && child.attrs.textBoxBorder !== null ? { textBoxBorder: Boolean(child.attrs.textBoxBorder) } : {}
12481
+ ...child3.attrs.unsupported ? { unsupported: child3.attrs.unsupported } : {},
12482
+ ...typeof child3.attrs.diagram === "string" ? { diagram: JSON.parse(child3.attrs.diagram) } : {},
12483
+ ...typeof child3.attrs.chart === "string" ? { chart: JSON.parse(child3.attrs.chart) } : {},
12484
+ ...typeof child3.attrs.shape === "string" ? { shape: JSON.parse(child3.attrs.shape) } : {},
12485
+ ...typeof child3.attrs.placement === "string" ? { placement: JSON.parse(child3.attrs.placement) } : {},
12486
+ ...typeof child3.attrs.textBoxText === "string" ? { textBoxText: JSON.parse(child3.attrs.textBoxText) } : {},
12487
+ ...child3.attrs.textBoxEditable ? { textBoxEditable: true } : {},
12488
+ ...child3.attrs.textBoxEditable && child3.attrs.textBoxBorder !== null ? { textBoxBorder: Boolean(child3.attrs.textBoxBorder) } : {}
11742
12489
  },
11743
12490
  ...imageLink && { link: imageLink }
11744
12491
  });
11745
- applyInlineFormat(runs.at(-1), child);
12492
+ applyInlineFormat(runs.at(-1), child3);
11746
12493
  return;
11747
12494
  }
11748
- if (!child.isText && child.type.name !== "hardBreak") return;
11749
- const run = { text: child.isText ? child.text || "" : "\n" };
11750
- const link = linkFromMarks(child);
12495
+ if (!child3.isText && child3.type.name !== "hardBreak") return;
12496
+ const run = { text: child3.isText ? child3.text || "" : "\n" };
12497
+ const link = linkFromMarks(child3);
11751
12498
  if (link) run.link = link;
11752
- if (!child.isText && child.type.spec.attrs?.format) applyInlineFormat(run, child);
11753
- else applyMarkFormatting(run, child);
12499
+ if (!child3.isText && child3.type.spec.attrs?.format) applyInlineFormat(run, child3);
12500
+ else applyMarkFormatting(run, child3);
11754
12501
  const previous = runs.at(-1);
11755
12502
  const fields = [
11756
12503
  "bold",
@@ -12045,10 +12792,10 @@ function sameContent(before, after) {
12045
12792
  if (!sameContent(before.child(index), after.child(index))) return false;
12046
12793
  return true;
12047
12794
  }
12048
- function paragraphProperties(element2) {
12795
+ function paragraphProperties(element3) {
12049
12796
  for (const name of ["rPr", "sectPr", "pPrChange"])
12050
- for (const child of children2(element2, name)) element2.removeChild(child);
12051
- return element2;
12797
+ for (const child3 of children2(element3, name)) element3.removeChild(child3);
12798
+ return element3;
12052
12799
  }
12053
12800
  function properties3(node) {
12054
12801
  const paragraph = paragraphFromAttrs(node.attrs, String(node.attrs.id), []);
@@ -12135,19 +12882,19 @@ function fieldResultRanges(doc) {
12135
12882
  doc.descendants((node, pos) => {
12136
12883
  if (node.type.name !== "paragraph") return true;
12137
12884
  let open;
12138
- node.forEach((child, offset) => {
12139
- const mark = child.isText ? child.marks.find((item) => item.type === field) : void 0;
12885
+ node.forEach((child3, offset) => {
12886
+ const mark = child3.isText ? child3.marks.find((item) => item.type === field) : void 0;
12140
12887
  const start = pos + 1 + offset;
12141
- if (mark && open?.mark.eq(mark) && identityOf(open.marks) === identityOf(child.marks) && sameFieldFlags(flagsOf(open.marks), flagsOf(child.marks))) {
12142
- open.to = start + child.nodeSize;
12143
- open.text += child.text ?? "";
12888
+ if (mark && open?.mark.eq(mark) && identityOf(open.marks) === identityOf(child3.marks) && sameFieldFlags(flagsOf(open.marks), flagsOf(child3.marks))) {
12889
+ open.to = start + child3.nodeSize;
12890
+ open.text += child3.text ?? "";
12144
12891
  } else if (mark) {
12145
12892
  open = {
12146
12893
  from: start,
12147
- to: start + child.nodeSize,
12894
+ to: start + child3.nodeSize,
12148
12895
  mark,
12149
- text: child.text ?? "",
12150
- marks: child.marks
12896
+ text: child3.text ?? "",
12897
+ marks: child3.marks
12151
12898
  };
12152
12899
  runs.push(open);
12153
12900
  } else open = void 0;
@@ -12166,7 +12913,7 @@ function fieldClipboardSlice(slice) {
12166
12913
  const open = stack.pop();
12167
12914
  if (open?.valid) {
12168
12915
  complete.add(pos);
12169
- for (const child of open.positions) complete.add(child);
12916
+ for (const child3 of open.positions) complete.add(child3);
12170
12917
  }
12171
12918
  } else {
12172
12919
  const open = stack.at(-1);
@@ -12185,8 +12932,8 @@ function fieldClipboardSlice(slice) {
12185
12932
  if (node.type.name === "fieldMarker" && !complete.has(pos)) return null;
12186
12933
  if (!node.isLeaf) {
12187
12934
  const children4 = [];
12188
- node.forEach((child, offset) => {
12189
- const projected = project(child, pos + 1 + offset);
12935
+ node.forEach((child3, offset) => {
12936
+ const projected = project(child3, pos + 1 + offset);
12190
12937
  if (projected) children4.push(projected);
12191
12938
  });
12192
12939
  return node.copy(Fragment.fromArray(children4));
@@ -12282,8 +13029,8 @@ function safeParagraph(node, allowInsertion = false) {
12282
13029
  if (node.type.name !== "paragraph" || !node.type.spec.attrs?.markRevision) return false;
12283
13030
  if (node.attrs.markRevision && !allowInsertion) return false;
12284
13031
  let fields = false;
12285
- node.descendants((child) => {
12286
- if (child.type.name === "fieldMarker" || child.marks.some((mark) => mark.type.name === "field"))
13032
+ node.descendants((child3) => {
13033
+ if (child3.type.name === "fieldMarker" || child3.marks.some((mark) => mark.type.name === "field"))
12287
13034
  fields = true;
12288
13035
  });
12289
13036
  return !fields;
@@ -12395,7 +13142,7 @@ function simpleFieldPasteSlice(slice, state) {
12395
13142
  const project = (node) => {
12396
13143
  if (node.isText) return node.mark(resultMarks(node, field));
12397
13144
  const children4 = [];
12398
- node.forEach((child) => children4.push(project(child)));
13145
+ node.forEach((child3) => children4.push(project(child3)));
12399
13146
  return node.copy(Fragment.fromArray(children4));
12400
13147
  };
12401
13148
  const children3 = [];
@@ -13118,15 +13865,15 @@ function formFieldBeside(doc, pos) {
13118
13865
  if (!$pos.parent.isTextblock) return void 0;
13119
13866
  const open = [];
13120
13867
  let beside;
13121
- $pos.parent.forEach((child, offset) => {
13122
- if (child.type.name !== "fieldMarker") return;
13868
+ $pos.parent.forEach((child3, offset) => {
13869
+ if (child3.type.name !== "fieldMarker") return;
13123
13870
  const at = $pos.start() + offset;
13124
- if (child.attrs.kind === "begin") open.push({ begin: at, field: formFieldOfNode(child) });
13125
- else if (child.attrs.kind === "end") {
13871
+ if (child3.attrs.kind === "begin") open.push({ begin: at, field: formFieldOfNode(child3) });
13872
+ else if (child3.attrs.kind === "end") {
13126
13873
  const top = open.pop();
13127
13874
  const kind = top?.field?.kind;
13128
13875
  if (!top || kind !== "checkbox" && kind !== "dropDown") return;
13129
- if (pos >= top.begin && pos <= at + child.nodeSize && (beside === void 0 || pos === top.begin))
13876
+ if (pos >= top.begin && pos <= at + child3.nodeSize && (beside === void 0 || pos === top.begin))
13130
13877
  beside = top.begin;
13131
13878
  }
13132
13879
  });
@@ -13137,19 +13884,19 @@ function formTextResults(doc) {
13137
13884
  const open = [];
13138
13885
  doc.descendants((node, pos) => {
13139
13886
  if (!node.isTextblock) return true;
13140
- node.forEach((child, offset) => {
13887
+ node.forEach((child3, offset) => {
13141
13888
  const at = pos + 1 + offset;
13142
- if (child.type.name !== "fieldMarker") {
13889
+ if (child3.type.name !== "fieldMarker") {
13143
13890
  const top = open.at(-1);
13144
- if (top?.from !== void 0) top.length += child.isText ? child.text.length : 1;
13891
+ if (top?.from !== void 0) top.length += child3.isText ? child3.text.length : 1;
13145
13892
  return;
13146
13893
  }
13147
- if (child.attrs.kind === "begin")
13148
- open.push({ field: formFieldOfNode(child), begin: at, length: 0 });
13149
- else if (child.attrs.kind === "separate") {
13894
+ if (child3.attrs.kind === "begin")
13895
+ open.push({ field: formFieldOfNode(child3), begin: at, length: 0 });
13896
+ else if (child3.attrs.kind === "separate") {
13150
13897
  const top = open.at(-1);
13151
- if (top) top.from = at + child.nodeSize;
13152
- } else if (child.attrs.kind === "end") {
13898
+ if (top) top.from = at + child3.nodeSize;
13899
+ } else if (child3.attrs.kind === "end") {
13153
13900
  const top = open.pop();
13154
13901
  if (top?.field?.kind === "text" && top.from !== void 0)
13155
13902
  results.push({
@@ -13177,7 +13924,7 @@ var hardBreakNodeSpec = {
13177
13924
  parseDOM: [
13178
13925
  {
13179
13926
  tag: "br",
13180
- getAttrs: (el4) => ({ format: el4.dataset.runProperties ?? null })
13927
+ getAttrs: (el5) => ({ format: el5.dataset.runProperties ?? null })
13181
13928
  }
13182
13929
  ],
13183
13930
  toDOM: (node) => ["br", inlineRunPropertiesDomAttrs(node)]
@@ -13192,9 +13939,9 @@ var pageBreakNodeSpec = {
13192
13939
  parseDOM: [
13193
13940
  {
13194
13941
  tag: "span[data-docx-break]",
13195
- getAttrs: (el4) => ({
13196
- kind: el4.dataset.docxBreak === "column" ? "column" : "page",
13197
- format: el4.dataset.runProperties ?? null
13942
+ getAttrs: (el5) => ({
13943
+ kind: el5.dataset.docxBreak === "column" ? "column" : "page",
13944
+ format: el5.dataset.runProperties ?? null
13198
13945
  })
13199
13946
  }
13200
13947
  ],
@@ -13230,11 +13977,11 @@ var noteReferenceNodeSpec = {
13230
13977
  {
13231
13978
  tag: "sup[data-docx-note-kind]",
13232
13979
  priority: 60,
13233
- getAttrs: (el4) => ({
13234
- kind: el4.dataset.docxNoteKind === "endnote" ? "endnote" : "footnote",
13235
- format: el4.dataset.runProperties ?? null,
13236
- id: el4.dataset.docxNoteId || "",
13237
- number: Number(el4.textContent) || 1
13980
+ getAttrs: (el5) => ({
13981
+ kind: el5.dataset.docxNoteKind === "endnote" ? "endnote" : "footnote",
13982
+ format: el5.dataset.runProperties ?? null,
13983
+ id: el5.dataset.docxNoteId || "",
13984
+ number: Number(el5.textContent) || 1
13238
13985
  })
13239
13986
  }
13240
13987
  ],
@@ -13265,10 +14012,10 @@ var fieldMarkerNodeSpec = {
13265
14012
  parseDOM: [
13266
14013
  {
13267
14014
  tag: "span[data-field-marker]",
13268
- getAttrs: (el4) => ({
13269
- kind: el4.dataset.fieldMarker || "begin",
13270
- format: el4.dataset.runProperties ?? null,
13271
- code: el4.dataset.fieldCode ?? null
14015
+ getAttrs: (el5) => ({
14016
+ kind: el5.dataset.fieldMarker || "begin",
14017
+ format: el5.dataset.runProperties ?? null,
14018
+ code: el5.dataset.fieldCode ?? null
13272
14019
  })
13273
14020
  }
13274
14021
  ],
@@ -13859,7 +14606,7 @@ var WordYjsInlineCommentAnchors = class {
13859
14606
  if (node.isLeaf) return node;
13860
14607
  const children3 = [];
13861
14608
  node.forEach(
13862
- (child, offset) => children3.push(visit(child, pos + offset + (node.type === doc.type ? 0 : 1)))
14609
+ (child3, offset) => children3.push(visit(child3, pos + offset + (node.type === doc.type ? 0 : 1)))
13863
14610
  );
13864
14611
  return node.copy(Fragment.fromArray(children3));
13865
14612
  };
@@ -13990,15 +14737,15 @@ var WordYjsComments = class {
13990
14737
  }
13991
14738
  };
13992
14739
  function removeSharedAnchor(fragment, id) {
13993
- for (const child of fragment.toArray()) {
13994
- if (child instanceof Y2.XmlElement) removeSharedAnchor(child, id);
13995
- else if (child instanceof Y2.XmlText) {
14740
+ for (const child3 of fragment.toArray()) {
14741
+ if (child3 instanceof Y2.XmlElement) removeSharedAnchor(child3, id);
14742
+ else if (child3 instanceof Y2.XmlText) {
13996
14743
  let offset = 0;
13997
- for (const part of child.toDelta()) {
14744
+ for (const part of child3.toDelta()) {
13998
14745
  const length = typeof part.insert === "string" ? part.insert.length : 1;
13999
14746
  for (const [key, attrs2] of Object.entries(part.attributes ?? {})) {
14000
14747
  if (key.startsWith("comment--") && Array.isArray(attrs2.ids) && attrs2.ids.includes(id))
14001
- child.format(offset, length, { [key]: null });
14748
+ child3.format(offset, length, { [key]: null });
14002
14749
  }
14003
14750
  offset += length;
14004
14751
  }
@@ -14030,14 +14777,14 @@ function independentCommentAnchors(node) {
14030
14777
  return node.mark(marks);
14031
14778
  }
14032
14779
  const children3 = [];
14033
- node.forEach((child) => children3.push(independentCommentAnchors(child)));
14780
+ node.forEach((child3) => children3.push(independentCommentAnchors(child3)));
14034
14781
  return node.type.create(node.attrs, children3, marks);
14035
14782
  }
14036
14783
  function seedEmptyParagraphText(fragment) {
14037
- for (const child of fragment.toArray()) {
14038
- if (!(child instanceof Y2.XmlElement)) continue;
14039
- if (child.nodeName === "paragraph" && child.length === 0) child.insert(0, [new Y2.XmlText()]);
14040
- else seedEmptyParagraphText(child);
14784
+ for (const child3 of fragment.toArray()) {
14785
+ if (!(child3 instanceof Y2.XmlElement)) continue;
14786
+ if (child3.nodeName === "paragraph" && child3.length === 0) child3.insert(0, [new Y2.XmlText()]);
14787
+ else seedEmptyParagraphText(child3);
14041
14788
  }
14042
14789
  }
14043
14790
  function guardDeletedNodeSelection(doc, view, binding) {
@@ -14315,8 +15062,8 @@ function tableStructureGuardPlugin() {
14315
15062
  const result = /* @__PURE__ */ new Map();
14316
15063
  if (node.type.name === "table") result.set(String(node.attrs.id), node);
14317
15064
  else if (!node.isTextblock && !node.isLeaf)
14318
- node.forEach((child) => {
14319
- for (const [id, table] of tables(child)) result.set(id, table);
15065
+ node.forEach((child3) => {
15066
+ for (const [id, table] of tables(child3)) result.set(id, table);
14320
15067
  });
14321
15068
  cache.set(node, result);
14322
15069
  return result;
@@ -14332,13 +15079,13 @@ function tableStructureGuardPlugin() {
14332
15079
  for (const attr2 of ["sourceCellKey", "colspan", "rowspan", "widthTwips"])
14333
15080
  if (cell.attrs[attr2] !== target.attrs[attr2]) return false;
14334
15081
  for (let i = 0; i < cell.childCount; i++) {
14335
- const child = cell.child(i), other = target.child(i);
14336
- if (child.type !== other.type) return false;
14337
- if (child.type.name === "paragraph") {
14338
- if (child.attrs.id !== other.attrs.id) return false;
14339
- } else if (child.type.name === "table") {
14340
- if (!child.sameMarkup(other) || !sameStructure(child, other)) return false;
14341
- } else if (!child.eq(other)) return false;
15082
+ const child3 = cell.child(i), other = target.child(i);
15083
+ if (child3.type !== other.type) return false;
15084
+ if (child3.type.name === "paragraph") {
15085
+ if (child3.attrs.id !== other.attrs.id) return false;
15086
+ } else if (child3.type.name === "table") {
15087
+ if (!child3.sameMarkup(other) || !sameStructure(child3, other)) return false;
15088
+ } else if (!child3.eq(other)) return false;
14342
15089
  }
14343
15090
  }
14344
15091
  }
@@ -14404,18 +15151,18 @@ var insertWordHardBreak = (state, dispatch, view) => {
14404
15151
 
14405
15152
  // docx/ui/chart-spec.ts
14406
15153
  var SVG_NS2 = "http://www.w3.org/2000/svg";
14407
- function elementSpec(element2, root) {
15154
+ function elementSpec(element3, root) {
14408
15155
  const attrs2 = {};
14409
- for (const attr2 of Array.from(element2.attributes)) {
15156
+ for (const attr2 of Array.from(element3.attributes)) {
14410
15157
  if (attr2.name === "xmlns" || attr2.name.startsWith("xmlns:") || /^on/i.test(attr2.name)) continue;
14411
15158
  attrs2[attr2.name] = attr2.value;
14412
15159
  }
14413
15160
  const children3 = [];
14414
- for (const child of Array.from(element2.childNodes)) {
14415
- if (isElement(child)) children3.push(elementSpec(child, false));
14416
- else if (child.nodeType === 3 && child.nodeValue) children3.push(child.nodeValue);
15161
+ for (const child3 of Array.from(element3.childNodes)) {
15162
+ if (isElement(child3)) children3.push(elementSpec(child3, false));
15163
+ else if (child3.nodeType === 3 && child3.nodeValue) children3.push(child3.nodeValue);
14417
15164
  }
14418
- const tag = root ? `${SVG_NS2} ${element2.localName}` : element2.localName;
15165
+ const tag = root ? `${SVG_NS2} ${element3.localName}` : element3.localName;
14419
15166
  return [tag, attrs2, ...children3];
14420
15167
  }
14421
15168
  function svgMarkupSpec(svg) {
@@ -14521,17 +15268,17 @@ var imageNodeSpec = {
14521
15268
  parseDOM: [
14522
15269
  {
14523
15270
  tag: "img[data-docx-image], span[data-docx-image-placeholder]",
14524
- getAttrs: (el4) => ({
14525
- format: el4.dataset.runProperties ?? null,
14526
- relId: el4.dataset.relId || "",
14527
- partName: el4.dataset.partName || "",
14528
- contentType: el4.dataset.contentType || "",
14529
- widthPx: Number(el4.dataset.widthPx) || 96,
14530
- heightPx: Number(el4.dataset.heightPx) || 96,
14531
- altText: el4.getAttribute("alt") || null,
14532
- title: el4.getAttribute("title") || null,
14533
- anchored: el4.dataset.anchored === "1",
14534
- unsupported: el4.dataset.unsupported || null
15271
+ getAttrs: (el5) => ({
15272
+ format: el5.dataset.runProperties ?? null,
15273
+ relId: el5.dataset.relId || "",
15274
+ partName: el5.dataset.partName || "",
15275
+ contentType: el5.dataset.contentType || "",
15276
+ widthPx: Number(el5.dataset.widthPx) || 96,
15277
+ heightPx: Number(el5.dataset.heightPx) || 96,
15278
+ altText: el5.getAttribute("alt") || null,
15279
+ title: el5.getAttribute("title") || null,
15280
+ anchored: el5.dataset.anchored === "1",
15281
+ unsupported: el5.dataset.unsupported || null
14535
15282
  })
14536
15283
  }
14537
15284
  ],
@@ -14582,10 +15329,10 @@ var linkMarkSpec = {
14582
15329
  parseDOM: [
14583
15330
  {
14584
15331
  tag: "a[data-docx-link]",
14585
- getAttrs: (el4) => ({
14586
- href: el4.dataset.href || (el4.dataset.anchor ? null : el4.getAttribute("href")) || null,
14587
- anchor: el4.dataset.anchor || null,
14588
- tooltip: el4.getAttribute("title") || null
15332
+ getAttrs: (el5) => ({
15333
+ href: el5.dataset.href || (el5.dataset.anchor ? null : el5.getAttribute("href")) || null,
15334
+ anchor: el5.dataset.anchor || null,
15335
+ tooltip: el5.getAttribute("title") || null
14589
15336
  })
14590
15337
  }
14591
15338
  ],
@@ -14610,11 +15357,11 @@ function wordLinkRangeAt(state, pos) {
14610
15357
  const $pos = state.doc.resolve(pos);
14611
15358
  const items = [];
14612
15359
  let cursor = $pos.start();
14613
- $pos.parent.forEach((child) => {
14614
- const target = inlineNodeRun(child)?.link;
15360
+ $pos.parent.forEach((child3) => {
15361
+ const target = inlineNodeRun(child3)?.link;
14615
15362
  const link = target ? type.create(target) : void 0;
14616
- items.push({ from: cursor, to: cursor + child.nodeSize, ...link && { link } });
14617
- cursor += child.nodeSize;
15363
+ items.push({ from: cursor, to: cursor + child3.nodeSize, ...link && { link } });
15364
+ cursor += child3.nodeSize;
14618
15365
  });
14619
15366
  let index = items.findIndex((item) => item.link && item.from <= pos && pos < item.to);
14620
15367
  if (index < 0) index = items.findIndex((item) => item.link && item.from < pos && pos <= item.to);
@@ -14791,6 +15538,45 @@ function resolveNoteRevisions(doc, resolvedBody, mode) {
14791
15538
  const value = notePartsJson(next);
14792
15539
  return value !== notePartsJson(notesModel(doc)) ? new NotePartsStep(value) : void 0;
14793
15540
  }
15541
+ function selectedChart(state) {
15542
+ const { selection } = state;
15543
+ if (!(selection instanceof NodeSelection) || selection.node.type.name !== "image")
15544
+ return void 0;
15545
+ const chart = nodeChart(selection.node);
15546
+ if (!chart) return void 0;
15547
+ return { pos: selection.from, node: selection.node, chart, editable: isDocxChartEditable(chart) };
15548
+ }
15549
+ function replaceSelectedChart(state, chart) {
15550
+ const selected = selectedChart(state);
15551
+ if (!selected) return null;
15552
+ const tr = state.tr.setNodeMarkup(selected.pos, void 0, {
15553
+ ...selected.node.attrs,
15554
+ chart: JSON.stringify(chart)
15555
+ });
15556
+ return closeHistory(tr.setSelection(NodeSelection.create(tr.doc, selected.pos)));
15557
+ }
15558
+ function insertChartImage(state, image) {
15559
+ const type = state.schema.nodes.image;
15560
+ if (!type || !image.chart) return null;
15561
+ const node = type.create({
15562
+ relId: image.relId,
15563
+ partName: image.partName,
15564
+ contentType: image.contentType,
15565
+ widthPx: image.widthPx,
15566
+ heightPx: image.heightPx,
15567
+ altText: image.altText ?? null,
15568
+ title: image.title ?? null,
15569
+ anchored: false,
15570
+ unsupported: image.unsupported ?? "Chart",
15571
+ chart: JSON.stringify(image.chart)
15572
+ });
15573
+ const tr = closeHistory(state.tr.replaceSelectionWith(node, false));
15574
+ const pos = tr.mapping.map(state.selection.from, -1);
15575
+ const at = tr.doc.nodeAt(pos)?.type === type ? pos : tr.selection.from - node.nodeSize;
15576
+ if (at >= 0 && tr.doc.nodeAt(at)?.type === type)
15577
+ tr.setSelection(NodeSelection.create(tr.doc, at));
15578
+ return closeHistory(tr.scrollIntoView());
15579
+ }
14794
15580
 
14795
15581
  // docx/ui/node-numbering.ts
14796
15582
  function nodeNumbering(node, model) {
@@ -14837,8 +15623,8 @@ var reviewMarks = {
14837
15623
  parseDOM: [
14838
15624
  {
14839
15625
  tag: "span[data-inline-comment-ids]",
14840
- getAttrs: (el4) => ({
14841
- ids: (el4.dataset.inlineCommentIds ?? "").split(",").filter(Boolean)
15626
+ getAttrs: (el5) => ({
15627
+ ids: (el5.dataset.inlineCommentIds ?? "").split(",").filter(Boolean)
14842
15628
  })
14843
15629
  }
14844
15630
  ],
@@ -14866,11 +15652,11 @@ var reviewMarks = {
14866
15652
  parseDOM: [
14867
15653
  {
14868
15654
  tag: "ins[data-revision-id]",
14869
- getAttrs: (el4) => ({
14870
- author: el4.dataset.author || "",
14871
- date: el4.dataset.date || null,
14872
- dateUtc: el4.dataset.dateUtc || null,
14873
- id: el4.dataset.revisionId || "",
15655
+ getAttrs: (el5) => ({
15656
+ author: el5.dataset.author || "",
15657
+ date: el5.dataset.date || null,
15658
+ dateUtc: el5.dataset.dateUtc || null,
15659
+ id: el5.dataset.revisionId || "",
14874
15660
  move: null
14875
15661
  })
14876
15662
  }
@@ -14901,11 +15687,11 @@ var reviewMarks = {
14901
15687
  parseDOM: [
14902
15688
  {
14903
15689
  tag: "del[data-revision-id]",
14904
- getAttrs: (el4) => ({
14905
- author: el4.dataset.author || "",
14906
- date: el4.dataset.date || null,
14907
- dateUtc: el4.dataset.dateUtc || null,
14908
- id: el4.dataset.revisionId || "",
15690
+ getAttrs: (el5) => ({
15691
+ author: el5.dataset.author || "",
15692
+ date: el5.dataset.date || null,
15693
+ dateUtc: el5.dataset.dateUtc || null,
15694
+ id: el5.dataset.revisionId || "",
14909
15695
  move: null
14910
15696
  })
14911
15697
  }
@@ -14931,8 +15717,8 @@ var reviewMarks = {
14931
15717
  parseDOM: [
14932
15718
  {
14933
15719
  tag: "span[data-comment-ids]",
14934
- getAttrs: (el4) => ({
14935
- ids: (el4.dataset.commentIds || "").split(",").filter(Boolean)
15720
+ getAttrs: (el5) => ({
15721
+ ids: (el5.dataset.commentIds || "").split(",").filter(Boolean)
14936
15722
  })
14937
15723
  }
14938
15724
  ],
@@ -15444,12 +16230,25 @@ var RIBBON_ACTION_IDS = [
15444
16230
  "drop-cap",
15445
16231
  "content-control",
15446
16232
  "shapes",
16233
+ "insert-smartart",
16234
+ "add-smartart-shape",
16235
+ "smartart-text-pane",
16236
+ "promote-smartart-shape",
16237
+ "demote-smartart-shape",
16238
+ "move-smartart-shape-up",
16239
+ "move-smartart-shape-down",
16240
+ "change-smartart-layout",
15447
16241
  "shape-fill",
15448
16242
  "shape-outline",
15449
16243
  "shape-outline-weight",
15450
16244
  "wrap-text",
15451
16245
  "shape-height",
15452
16246
  "shape-width",
16247
+ "insert-chart",
16248
+ "chart-legend",
16249
+ "edit-chart-data",
16250
+ "change-chart-type",
16251
+ "format-chart-selection",
15453
16252
  "equation",
15454
16253
  "change-case",
15455
16254
  "format-painter",
@@ -15625,12 +16424,25 @@ var RIBBON_ACTION_LABELS = {
15625
16424
  "drop-cap": "Drop cap",
15626
16425
  "content-control": "Content control",
15627
16426
  shapes: "Shapes",
16427
+ "insert-smartart": "Insert SmartArt",
16428
+ "add-smartart-shape": "Add Shape",
16429
+ "smartart-text-pane": "Text Pane",
16430
+ "promote-smartart-shape": "Promote",
16431
+ "demote-smartart-shape": "Demote",
16432
+ "move-smartart-shape-up": "Move Up",
16433
+ "move-smartart-shape-down": "Move Down",
16434
+ "change-smartart-layout": "Change Layout",
15628
16435
  "shape-fill": "Shape fill",
15629
16436
  "shape-outline": "Shape outline",
15630
16437
  "shape-outline-weight": "Shape outline weight",
15631
16438
  "wrap-text": "Wrap text",
15632
16439
  "shape-height": "Shape height (inches)",
15633
16440
  "shape-width": "Shape width (inches)",
16441
+ "insert-chart": "Insert chart",
16442
+ "chart-legend": "Legend",
16443
+ "edit-chart-data": "Edit Data",
16444
+ "change-chart-type": "Change Chart Type",
16445
+ "format-chart-selection": "Format Selection",
15634
16446
  equation: "Equation",
15635
16447
  "change-case": "Change case",
15636
16448
  "format-painter": "Format painter",
@@ -15918,8 +16730,8 @@ var markSpecs = {
15918
16730
  parseDOM: [
15919
16731
  {
15920
16732
  tag: 'span[style*="background-color"]',
15921
- getAttrs: (el4) => {
15922
- const color = el4.style.backgroundColor.toLowerCase();
16733
+ getAttrs: (el5) => {
16734
+ const color = el5.style.backgroundColor.toLowerCase();
15923
16735
  if (color === "white" || color === "rgb(255, 255, 255)" || color === "#ffffff")
15924
16736
  return false;
15925
16737
  const entry = Object.entries(wordHighlightColors).find(([, css]) => {
@@ -15956,10 +16768,10 @@ var markSpecs = {
15956
16768
  parseDOM: [
15957
16769
  {
15958
16770
  tag: "span[lang], span[data-docx-east-asia-language], span[data-docx-bidi-language]",
15959
- getAttrs: (el4) => ({
15960
- language: el4.getAttribute("lang"),
15961
- eastAsiaLanguage: el4.dataset.docxEastAsiaLanguage || null,
15962
- bidiLanguage: el4.dataset.docxBidiLanguage || null
16771
+ getAttrs: (el5) => ({
16772
+ language: el5.getAttribute("lang"),
16773
+ eastAsiaLanguage: el5.dataset.docxEastAsiaLanguage || null,
16774
+ bidiLanguage: el5.dataset.docxBidiLanguage || null
15963
16775
  })
15964
16776
  }
15965
16777
  ],
@@ -15989,8 +16801,8 @@ var markSpecs = {
15989
16801
  parseDOM: [
15990
16802
  {
15991
16803
  tag: "span",
15992
- getAttrs: (el4) => {
15993
- const style = el4.style;
16804
+ getAttrs: (el5) => {
16805
+ const style = el5.style;
15994
16806
  const attrs2 = {
15995
16807
  family: pastedFontFamily(style.fontFamily),
15996
16808
  size: style.fontSize ? parseFontSize(style.fontSize) : null,
@@ -16018,7 +16830,7 @@ var markSpecs = {
16018
16830
  parseDOM: [
16019
16831
  {
16020
16832
  tag: "span[data-docx-style]",
16021
- getAttrs: (el4) => ({ id: el4.dataset.docxStyle || null })
16833
+ getAttrs: (el5) => ({ id: el5.dataset.docxStyle || null })
16022
16834
  }
16023
16835
  ],
16024
16836
  toDOM: (mark) => ["span", { "data-docx-style": mark.attrs.id }, 0]
@@ -16030,8 +16842,8 @@ var markSpecs = {
16030
16842
  {
16031
16843
  tag: "span[data-sdt]",
16032
16844
  // Only a control is taken from (pasted) HTML; the span's text stays either way.
16033
- getAttrs: (el4) => {
16034
- const control = controlFromData(el4.dataset.sdt, "inline");
16845
+ getAttrs: (el5) => {
16846
+ const control = controlFromData(el5.dataset.sdt, "inline");
16035
16847
  return control ? { data: JSON.stringify(control) } : false;
16036
16848
  }
16037
16849
  }
@@ -16045,9 +16857,9 @@ var markSpecs = {
16045
16857
  parseDOM: [
16046
16858
  {
16047
16859
  tag: "span[data-field]",
16048
- getAttrs: (el4) => ({
16049
- instr: el4.dataset.field || "",
16050
- simple: el4.dataset.fieldSimple === "1"
16860
+ getAttrs: (el5) => ({
16861
+ instr: el5.dataset.field || "",
16862
+ simple: el5.dataset.fieldSimple === "1"
16051
16863
  })
16052
16864
  }
16053
16865
  ],
@@ -16112,6 +16924,17 @@ function themeDrawing(drawing, theme) {
16112
16924
  };
16113
16925
  }
16114
16926
 
16927
+ // docx/ui/smartart-approximate.ts
16928
+ function approximateDiagramDrawing(diagram) {
16929
+ return approximateDiagramDrawingFromNodes({
16930
+ extentEmu: diagram.extentEmu,
16931
+ nodes: diagram.nodes,
16932
+ layoutId: diagram.layout?.uniqueId,
16933
+ family: diagram.layout?.family,
16934
+ colorsId: diagram.colorsId
16935
+ });
16936
+ }
16937
+
16115
16938
  // docx/ui/table-render.ts
16116
16939
  var NONE_STYLES = /* @__PURE__ */ new Set(["none", "nil"]);
16117
16940
  function cssBorderStyle(style) {
@@ -16327,7 +17150,7 @@ function documentWordCount(node, locale) {
16327
17150
  if (value !== void 0) return value;
16328
17151
  let count = 0;
16329
17152
  if (node.isTextblock) count = countWords(node.textBetween(0, node.content.size, " "), locale);
16330
- else node.forEach((child) => count += documentWordCount(child, locale));
17153
+ else node.forEach((child3) => count += documentWordCount(child3, locale));
16331
17154
  const counts = cached2 ?? /* @__PURE__ */ new Map();
16332
17155
  counts.set(key, count);
16333
17156
  documentCounts.set(node, counts);
@@ -16679,4 +17502,4 @@ function formFieldGuardPlugin(protection) {
16679
17502
  });
16680
17503
  }
16681
17504
 
16682
- export { CONTROL_EDIT_META, CollaborationAuthority, CollaborationClient, DirtyState, EDITOR_THEME_MODES, FIELD_RESULT_REPAIR_META, FORM_FIELD_EDIT_META, HEADER_FOOTER_INPUT, NotePartsStep, PAGE_GAP, PARAGRAPH_KEEP_KEYS, REMOTE_TRANSACTION_META, RIBBON_ACTION_IDS, RIBBON_ACTION_LABELS, SectionPartsStep, THEME_KEYS, WORD_CAPABILITY_ACTIONS, WORD_CAPABILITY_BACKSTAGE_PAGES, WORD_CAPABILITY_FILE_COMMANDS, WORD_CAPABILITY_IDS, WORD_CAPABILITY_MENU_ITEMS, WORD_CAPABILITY_SHORTCUTS, WordYjsCollaboration, WordYjsComments, WordYjsMedia, acceptAllChanges, acceptChangeAtCursor, acceptRevisionRange, addComment, appendInlineNode, applyMarkFormatting, applyRunFormattingPatch, applyThemeColors, applyWordLink, authorColor, backstageFocus, chartNodeSpec, chooseDate, chooseListItem, clearDirectRunFormatting, collectRevisionRanges, commentAnchors, commentHistoryAttributes, commentIdsAtSelection, commentIdsFromMarks, commentIdsFromNode, commentThreadsFromDoc, contentControlPlugin, controlAt, controlAtSelection, controlFromData, controlFromValue, controlOfMark, controlSpans, countWords, createCollaborationIdGenerator, createToggleFormat, cssBorderSide, darkTheme, deleteAroundMarkers, deleteComment, deleteFieldSelection, deleteToPlaceholder, dispatchIsolatedCommand, documentWordCount, emptySimpleFieldResult, everyControlSpan, exceedsFormTextLength, expectDefined, explicitOffFields, extraRunFields, extraRunProperties, fieldGuardPlugin, fieldMarkerNodeSpec, fieldResultRanges, fieldsBalanced, fitZoomPercent, formFieldBeside, formFieldGuardPlugin, formFieldLocked, formFieldNodeDisplay, formFieldOfNode, formTextResults, formattingRevision, freezeBatch, goToComment, goToNextChange, goToPreviousChange, hardBreakNodeSpec, hasAnyChange, hasChangeAtCursor, hasNoteRevisions, imageNodeSpec, inlineNodeRun, insertContentControl, insertWordHardBreak, insertedTextMarks, isFormsProtected, isNavigableHref, isRibbonActionId, isWordYjsRemoteTransaction, ligatureCss, ligatureStyle, lightTheme, linkFromMarks, linkMarkSpec, markSpecs, marksForRun, moveName, newControlId, nodeChart, nodeNumbering, normalizeRibbonActions, normalizeThemeMode, notePartsJson, noteReferenceNodeSpec, operatesFormField, pageBreakNodeSpec, paragraphAttrs, paragraphBoxCss, paragraphFormattingRevision, paragraphFromAttrs, parseBatch, parseBordersJson, pasteInCell, placementClass, positionalTabInputPlugin, refreshWordYjsPresence, rejectAllChanges, rejectChangeAtCursor, rejectRevisionRange, removeCommentAnchor, removeCommentThread, removeWordLink, repairCollaborativeDocumentIds, repairCollaborativeParagraphIds, replaceAroundMarkers, replaceControlContent, replyToComment, resolveCellVisuals, resolveComment, resolveNoteRevisions, restoreNoteParts, restoreSectionParts, reviewMarks, ribbonActionIdForLabel, runPropertiesMark, runToInlineNodes, sameJson2 as sameJson, sameRuns, sectionPartsJson, selectFormDropDownAt, setCommentThreads, setReviewRecordingPreferences, staysInFormFields, svgMarkupSpec, swatchColor, symbolFontPlugin, tableCellStyle, tableControlSpans, tableStructureGuardPlugin, tableStyle, themeDrawing, themeToCssVars, toggleCheckboxControl, toggleFormCheckboxAt, toggleTrackChanges, toggleTrackFormatting, toggleTrackMoves, trackChangesPlugin, trackChangesPluginKey, typeOverPlaceholder, updateCommentThreads, updateControlProperties, violatesControlLock, wordHighlightColors, wordLinkRangeAt, wordYjsPluginKey, wordYjsPresencePlugin, wordYjsRedo, wordYjsUndo };
17505
+ export { CONTROL_EDIT_META, CollaborationAuthority, CollaborationClient, DirtyState, EDITOR_THEME_MODES, FIELD_RESULT_REPAIR_META, FORM_FIELD_EDIT_META, HEADER_FOOTER_INPUT, NotePartsStep, PAGE_GAP, PARAGRAPH_KEEP_KEYS, REMOTE_TRANSACTION_META, RIBBON_ACTION_IDS, RIBBON_ACTION_LABELS, SectionPartsStep, THEME_KEYS, WORD_CAPABILITY_ACTIONS, WORD_CAPABILITY_BACKSTAGE_PAGES, WORD_CAPABILITY_FILE_COMMANDS, WORD_CAPABILITY_IDS, WORD_CAPABILITY_MENU_ITEMS, WORD_CAPABILITY_SHORTCUTS, WordYjsCollaboration, WordYjsComments, WordYjsMedia, acceptAllChanges, acceptChangeAtCursor, acceptRevisionRange, addComment, appendInlineNode, applyMarkFormatting, applyRunFormattingPatch, applyThemeColors, applyWordLink, approximateDiagramDrawing, authorColor, backstageFocus, chartNodeSpec, chooseDate, chooseListItem, clearDirectRunFormatting, collectRevisionRanges, commentAnchors, commentHistoryAttributes, commentIdsAtSelection, commentIdsFromMarks, commentIdsFromNode, commentThreadsFromDoc, contentControlPlugin, controlAt, controlAtSelection, controlFromData, controlFromValue, controlOfMark, controlSpans, countWords, createCollaborationIdGenerator, createToggleFormat, cssBorderSide, darkTheme, deleteAroundMarkers, deleteComment, deleteFieldSelection, deleteToPlaceholder, dispatchIsolatedCommand, documentWordCount, emptySimpleFieldResult, everyControlSpan, exceedsFormTextLength, expectDefined, explicitOffFields, extraRunFields, extraRunProperties, fieldGuardPlugin, fieldMarkerNodeSpec, fieldResultRanges, fieldsBalanced, fitZoomPercent, formFieldBeside, formFieldGuardPlugin, formFieldLocked, formFieldNodeDisplay, formFieldOfNode, formTextResults, formattingRevision, freezeBatch, goToComment, goToNextChange, goToPreviousChange, hardBreakNodeSpec, hasAnyChange, hasChangeAtCursor, hasNoteRevisions, imageNodeSpec, inlineNodeRun, insertChartImage, insertContentControl, insertWordHardBreak, insertedTextMarks, isFormsProtected, isNavigableHref, isRibbonActionId, isWordYjsRemoteTransaction, ligatureCss, ligatureStyle, lightTheme, linkFromMarks, linkMarkSpec, markSpecs, marksForRun, moveName, newControlId, nodeChart, nodeNumbering, normalizeRibbonActions, normalizeThemeMode, notePartsJson, noteReferenceNodeSpec, operatesFormField, pageBreakNodeSpec, paragraphAttrs, paragraphBoxCss, paragraphFormattingRevision, paragraphFromAttrs, parseBatch, parseBordersJson, pasteInCell, placementClass, positionalTabInputPlugin, refreshWordYjsPresence, rejectAllChanges, rejectChangeAtCursor, rejectRevisionRange, removeCommentAnchor, removeCommentThread, removeWordLink, repairCollaborativeDocumentIds, repairCollaborativeParagraphIds, replaceAroundMarkers, replaceControlContent, replaceSelectedChart, replyToComment, resolveCellVisuals, resolveComment, resolveNoteRevisions, restoreNoteParts, restoreSectionParts, reviewMarks, ribbonActionIdForLabel, runPropertiesMark, runToInlineNodes, sameJson2 as sameJson, sameRuns, sectionPartsJson, selectFormDropDownAt, selectedChart, setCommentThreads, setReviewRecordingPreferences, staysInFormFields, svgMarkupSpec, swatchColor, symbolFontPlugin, tableCellStyle, tableControlSpans, tableStructureGuardPlugin, tableStyle, themeDrawing, themeToCssVars, toggleCheckboxControl, toggleFormCheckboxAt, toggleTrackChanges, toggleTrackFormatting, toggleTrackMoves, trackChangesPlugin, trackChangesPluginKey, typeOverPlaceholder, updateCommentThreads, updateControlProperties, violatesControlLock, wordHighlightColors, wordLinkRangeAt, wordYjsPluginKey, wordYjsPresencePlugin, wordYjsRedo, wordYjsUndo };