ooxml-core 1.24.3 → 1.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (446) hide show
  1. package/dist/PptxHandler-5UO5DD5K.mjs +4 -0
  2. package/dist/{PptxHandler-WQPEYOSS.mjs → PptxHandler-AUK27AQD.mjs} +3 -3
  3. package/dist/{PptxHandler-2YPMMGOJ.cjs → PptxHandler-QBGEZDCO.cjs} +3 -3
  4. package/dist/{PresentationBuilder-F5U4KEGH.cjs → PresentationBuilder-CI45KEHL.cjs} +5 -5
  5. package/dist/{PresentationBuilder-FGWHIJV7.mjs → PresentationBuilder-MEETJGEA.mjs} +3 -3
  6. package/dist/{PresentationBuilder-PS5S52M3.mjs → PresentationBuilder-RX7D75GZ.mjs} +2 -2
  7. package/dist/automation/index.cjs +10188 -6069
  8. package/dist/automation/index.mjs +10188 -6069
  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-K2XWOVLV.mjs → chunk-5F7OB7PA.mjs} +4075 -1949
  126. package/dist/{chunk-2AFO3HNI.mjs → chunk-635WPRNJ.mjs} +2235 -2095
  127. package/dist/{chunk-O6ISWI34.mjs → chunk-6DHZZD5R.mjs} +1102 -1024
  128. package/dist/{chunk-GBKBR4CX.mjs → chunk-E2PYQQQV.mjs} +1 -1
  129. package/dist/{chunk-4IFENOU7.mjs → chunk-E3PRAHL6.mjs} +1 -1
  130. package/dist/{chunk-5SE4FGS4.cjs → chunk-GMETZZ3V.cjs} +4989 -2863
  131. package/dist/{chunk-HKCSJAQD.mjs → chunk-HVRFRYYS.mjs} +5 -5
  132. package/dist/{chunk-QCZX6K67.cjs → chunk-S5TGOEQX.cjs} +1107 -1028
  133. package/dist/{chunk-RF2YPEKI.mjs → chunk-TX2QFS3J.mjs} +3976 -1833
  134. package/dist/{chunk-OJWKGDJF.mjs → chunk-VGDHSED6.mjs} +1 -1
  135. package/dist/diagram/approximate.d.ts +19 -0
  136. package/dist/diagram/approximate.d.ts.map +1 -0
  137. package/dist/diagram/builtin/catalog.d.ts +3 -0
  138. package/dist/diagram/builtin/catalog.d.ts.map +1 -0
  139. package/dist/diagram/builtin/data.d.ts +3 -0
  140. package/dist/diagram/builtin/data.d.ts.map +1 -0
  141. package/dist/diagram/builtin/definitions.d.ts +7 -0
  142. package/dist/diagram/builtin/definitions.d.ts.map +1 -0
  143. package/dist/diagram/builtin/index.cjs +1348 -0
  144. package/dist/diagram/builtin/index.d.ts +3 -0
  145. package/dist/diagram/builtin/index.d.ts.map +1 -0
  146. package/dist/diagram/builtin/index.mjs +1337 -0
  147. package/dist/diagram/builtin/layouts.d.ts +15 -0
  148. package/dist/diagram/builtin/layouts.d.ts.map +1 -0
  149. package/dist/diagram/builtin/types.d.ts +13 -0
  150. package/dist/diagram/builtin/types.d.ts.map +1 -0
  151. package/dist/diagram/catalogue.d.ts +51 -0
  152. package/dist/diagram/catalogue.d.ts.map +1 -0
  153. package/dist/diagram/data-model.d.ts.map +1 -1
  154. package/dist/diagram/drawing-from-views.d.ts +11 -0
  155. package/dist/diagram/drawing-from-views.d.ts.map +1 -0
  156. package/dist/diagram/drawing-resolve.d.ts +34 -0
  157. package/dist/diagram/drawing-resolve.d.ts.map +1 -0
  158. package/dist/diagram/drawing-view.d.ts +104 -0
  159. package/dist/diagram/drawing-view.d.ts.map +1 -0
  160. package/dist/diagram/drawing.d.ts.map +1 -1
  161. package/dist/diagram/edit/design-commands.d.ts +27 -0
  162. package/dist/diagram/edit/design-commands.d.ts.map +1 -0
  163. package/dist/diagram/edit/index.d.ts +15 -0
  164. package/dist/diagram/edit/index.d.ts.map +1 -0
  165. package/dist/diagram/edit/node-edit.d.ts +66 -0
  166. package/dist/diagram/edit/node-edit.d.ts.map +1 -0
  167. package/dist/diagram/edit/node-ops.d.ts +71 -0
  168. package/dist/diagram/edit/node-ops.d.ts.map +1 -0
  169. package/dist/diagram/edit/node-order.d.ts +28 -0
  170. package/dist/diagram/edit/node-order.d.ts.map +1 -0
  171. package/dist/diagram/edit/node-style.d.ts +42 -0
  172. package/dist/diagram/edit/node-style.d.ts.map +1 -0
  173. package/dist/diagram/edit/node-tree.d.ts +10 -0
  174. package/dist/diagram/edit/node-tree.d.ts.map +1 -0
  175. package/dist/diagram/edit/outline.d.ts +11 -0
  176. package/dist/diagram/edit/outline.d.ts.map +1 -0
  177. package/dist/diagram/edit/reflow-category.d.ts +18 -0
  178. package/dist/diagram/edit/reflow-category.d.ts.map +1 -0
  179. package/dist/diagram/edit/reflow-directional.d.ts +53 -0
  180. package/dist/diagram/edit/reflow-directional.d.ts.map +1 -0
  181. package/dist/diagram/edit/reflow-geometric.d.ts +59 -0
  182. package/dist/diagram/edit/reflow-geometric.d.ts.map +1 -0
  183. package/dist/diagram/edit/reflow-stacked.d.ts +32 -0
  184. package/dist/diagram/edit/reflow-stacked.d.ts.map +1 -0
  185. package/dist/diagram/edit/reflow.d.ts +48 -0
  186. package/dist/diagram/edit/reflow.d.ts.map +1 -0
  187. package/dist/diagram/edit/shape-match.d.ts +34 -0
  188. package/dist/diagram/edit/shape-match.d.ts.map +1 -0
  189. package/dist/diagram/edit/types.d.ts +31 -0
  190. package/dist/diagram/edit/types.d.ts.map +1 -0
  191. package/dist/diagram/index.cjs +3934 -910
  192. package/dist/diagram/index.d.ts +9 -0
  193. package/dist/diagram/index.d.ts.map +1 -1
  194. package/dist/diagram/index.mjs +3860 -912
  195. package/dist/diagram/model/node.d.ts +10 -0
  196. package/dist/diagram/model/node.d.ts.map +1 -1
  197. package/dist/diagram/relationships.d.ts +8 -0
  198. package/dist/diagram/relationships.d.ts.map +1 -1
  199. package/dist/diagram/strings/de.d.ts +3 -0
  200. package/dist/diagram/strings/de.d.ts.map +1 -0
  201. package/dist/diagram/strings/en.d.ts +74 -0
  202. package/dist/diagram/strings/en.d.ts.map +1 -0
  203. package/dist/diagram/strings/es.d.ts +3 -0
  204. package/dist/diagram/strings/es.d.ts.map +1 -0
  205. package/dist/diagram/strings/fr.d.ts +3 -0
  206. package/dist/diagram/strings/fr.d.ts.map +1 -0
  207. package/dist/diagram/strings/index.d.ts +11 -0
  208. package/dist/diagram/strings/index.d.ts.map +1 -0
  209. package/dist/diagram/strings/zh-CN.d.ts +3 -0
  210. package/dist/diagram/strings/zh-CN.d.ts.map +1 -0
  211. package/dist/diagram/text/index.d.ts +5 -0
  212. package/dist/diagram/text/index.d.ts.map +1 -0
  213. package/dist/diagram/text/node-text-neutral.d.ts +29 -0
  214. package/dist/diagram/text/node-text-neutral.d.ts.map +1 -0
  215. package/dist/diagram/text/node-text-paragraphs.d.ts +6 -0
  216. package/dist/diagram/text/node-text-paragraphs.d.ts.map +1 -0
  217. package/dist/diagram/text/node-text-projection.d.ts +48 -0
  218. package/dist/diagram/text/node-text-projection.d.ts.map +1 -0
  219. package/dist/diagram/text/node-text-reconciliation.d.ts +4 -0
  220. package/dist/diagram/text/node-text-reconciliation.d.ts.map +1 -0
  221. package/dist/diagram/types.d.ts +12 -0
  222. package/dist/diagram/types.d.ts.map +1 -1
  223. package/dist/diagram/write/data-edit.d.ts +30 -0
  224. package/dist/diagram/write/data-edit.d.ts.map +1 -0
  225. package/dist/diagram/write/data.d.ts +62 -0
  226. package/dist/diagram/write/data.d.ts.map +1 -0
  227. package/dist/diagram/write/index.d.ts +4 -0
  228. package/dist/diagram/write/index.d.ts.map +1 -0
  229. package/dist/diagram/write/inserted.d.ts +14 -0
  230. package/dist/diagram/write/inserted.d.ts.map +1 -0
  231. package/dist/docx/chart-edit.d.ts +33 -0
  232. package/dist/docx/chart-edit.d.ts.map +1 -0
  233. package/dist/docx/chart-save.d.ts +14 -0
  234. package/dist/docx/chart-save.d.ts.map +1 -0
  235. package/dist/docx/chart.d.ts +5 -3
  236. package/dist/docx/chart.d.ts.map +1 -1
  237. package/dist/docx/diagram-edit.d.ts +50 -0
  238. package/dist/docx/diagram-edit.d.ts.map +1 -0
  239. package/dist/docx/diagram-nodes.d.ts +2 -0
  240. package/dist/docx/diagram-nodes.d.ts.map +1 -0
  241. package/dist/docx/diagram-save.d.ts +12 -0
  242. package/dist/docx/diagram-save.d.ts.map +1 -0
  243. package/dist/docx/diagram.d.ts +17 -9
  244. package/dist/docx/diagram.d.ts.map +1 -1
  245. package/dist/docx/embedded.cjs +5741 -2973
  246. package/dist/docx/embedded.mjs +5741 -2973
  247. package/dist/docx/index.cjs +10098 -6118
  248. package/dist/docx/index.d.ts +4 -1
  249. package/dist/docx/index.d.ts.map +1 -1
  250. package/dist/docx/index.mjs +10084 -6119
  251. package/dist/docx/load/index.cjs +5840 -3072
  252. package/dist/docx/load/index.mjs +5840 -3072
  253. package/dist/docx/parse.d.ts.map +1 -1
  254. package/dist/docx/part-relationships.d.ts.map +1 -1
  255. package/dist/docx/relationship-allocator.d.ts +19 -0
  256. package/dist/docx/relationship-allocator.d.ts.map +1 -1
  257. package/dist/docx/save.d.ts.map +1 -1
  258. package/dist/docx/ui/chart-commands.d.ts +19 -0
  259. package/dist/docx/ui/chart-commands.d.ts.map +1 -0
  260. package/dist/docx/ui/index.cjs +1482 -655
  261. package/dist/docx/ui/index.d.ts +2 -0
  262. package/dist/docx/ui/index.d.ts.map +1 -1
  263. package/dist/docx/ui/index.mjs +1479 -656
  264. package/dist/docx/ui/ribbon-action-ids.d.ts +1 -1
  265. package/dist/docx/ui/ribbon-action-ids.d.ts.map +1 -1
  266. package/dist/docx/ui/smartart-approximate.d.ts +5 -0
  267. package/dist/docx/ui/smartart-approximate.d.ts.map +1 -0
  268. package/dist/docx/write-chart-drawing.d.ts +12 -0
  269. package/dist/docx/write-chart-drawing.d.ts.map +1 -0
  270. package/dist/docx/write-diagram-drawing.d.ts +13 -0
  271. package/dist/docx/write-diagram-drawing.d.ts.map +1 -0
  272. package/dist/docx/write-drawing-patch.d.ts +8 -0
  273. package/dist/docx/write-drawing-patch.d.ts.map +1 -0
  274. package/dist/docx/write-drawing.d.ts.map +1 -1
  275. package/dist/drawingml/index.cjs +863 -0
  276. package/dist/drawingml/index.d.ts +7 -0
  277. package/dist/drawingml/index.d.ts.map +1 -1
  278. package/dist/drawingml/index.mjs +840 -1
  279. package/dist/drawingml/read-paragraph-properties.d.ts +8 -0
  280. package/dist/drawingml/read-paragraph-properties.d.ts.map +1 -0
  281. package/dist/drawingml/read-run-properties.d.ts +15 -0
  282. package/dist/drawingml/read-run-properties.d.ts.map +1 -0
  283. package/dist/drawingml/read-text-body.d.ts +13 -0
  284. package/dist/drawingml/read-text-body.d.ts.map +1 -0
  285. package/dist/drawingml/text-model.d.ts +210 -0
  286. package/dist/drawingml/text-model.d.ts.map +1 -0
  287. package/dist/drawingml/write-paragraph-properties.d.ts +12 -0
  288. package/dist/drawingml/write-paragraph-properties.d.ts.map +1 -0
  289. package/dist/drawingml/write-run-properties.d.ts +11 -0
  290. package/dist/drawingml/write-run-properties.d.ts.map +1 -0
  291. package/dist/drawingml/write-text-body.d.ts +18 -0
  292. package/dist/drawingml/write-text-body.d.ts.map +1 -0
  293. package/dist/drawingml/write-text-xml.d.ts +26 -0
  294. package/dist/drawingml/write-text-xml.d.ts.map +1 -0
  295. package/dist/index.cjs +10078 -2908
  296. package/dist/index.mjs +10078 -2908
  297. package/dist/opc/index.cjs +10 -0
  298. package/dist/opc/index.mjs +10 -1
  299. package/dist/opc/package.d.ts +5 -0
  300. package/dist/opc/package.d.ts.map +1 -1
  301. package/dist/pptx/automation/index.cjs +6845 -3885
  302. package/dist/pptx/automation/index.d.ts +5 -5
  303. package/dist/pptx/automation/index.mjs +6 -6
  304. package/dist/pptx/chunks/{elements-iUzpAeqR.d.ts → elements-DhW764aK.d.ts} +23 -14
  305. package/dist/pptx/chunks/elements-DhW764aK.d.ts.map +1 -0
  306. package/dist/pptx/chunks/{index-C3xhAMSa.d.ts → index-CX0RM1fF.d.ts} +4 -4
  307. package/dist/pptx/chunks/{index-C3xhAMSa.d.ts.map → index-CX0RM1fF.d.ts.map} +1 -1
  308. package/dist/pptx/chunks/{index-nKQ4s7FA.d.ts → index-CgjEEpfK.d.ts} +18 -9
  309. package/dist/pptx/chunks/index-CgjEEpfK.d.ts.map +1 -0
  310. package/dist/pptx/chunks/{index-4FmgJajb.d.ts → index-DCbp5fOs.d.ts} +100 -95
  311. package/dist/pptx/chunks/index-DCbp5fOs.d.ts.map +1 -0
  312. package/dist/pptx/chunks/{smart-art-ENMMEbmW.d.ts → smart-art-BEEl0l8X.d.ts} +514 -306
  313. package/dist/pptx/chunks/smart-art-BEEl0l8X.d.ts.map +1 -0
  314. package/dist/pptx/chunks/{text-operations-CfLVZ7DK.d.ts → text-operations-CjalmJIi.d.ts} +2 -2
  315. package/dist/pptx/chunks/{text-operations-CfLVZ7DK.d.ts.map → text-operations-CjalmJIi.d.ts.map} +1 -1
  316. package/dist/pptx/cli/index.cjs +6330 -3372
  317. package/dist/pptx/cli/index.d.ts +1 -1
  318. package/dist/pptx/cli/index.mjs +5 -5
  319. package/dist/pptx/converter/index.cjs +107 -75
  320. package/dist/pptx/converter/index.d.ts +1 -1
  321. package/dist/pptx/converter/index.mjs +3 -3
  322. package/dist/pptx/editor/render/editor-history.cjs +3 -1
  323. package/dist/pptx/editor/render/editor-history.d.ts +9 -1
  324. package/dist/pptx/editor/render/editor-history.d.ts.map +1 -1
  325. package/dist/pptx/editor/render/editor-history.mjs +3 -2
  326. package/dist/pptx/editor/render/find-replace.cjs +14 -14
  327. package/dist/pptx/editor/render/find-replace.d.ts +2 -2
  328. package/dist/pptx/editor/render/find-replace.mjs +1 -1
  329. package/dist/pptx/editor/render/slide-operations.cjs +8 -8
  330. package/dist/pptx/editor/render/slide-operations.mjs +2 -2
  331. package/dist/pptx/editor/render/text-runs-style-patch.d.ts +1 -1
  332. package/dist/pptx/editor/render/text-style-scope.d.ts +1 -1
  333. package/dist/pptx/index.cjs +7750 -4725
  334. package/dist/pptx/index.d.ts +7 -7
  335. package/dist/pptx/index.mjs +6 -6
  336. package/dist/pptx/node/index.d.ts +1 -1
  337. package/dist/pptx/signature-node/index.mjs +2 -2
  338. package/dist/pptx/smartart-layouts/index.cjs +26 -23
  339. package/dist/pptx/smartart-layouts/index.d.ts +7 -5
  340. package/dist/pptx/smartart-layouts/index.d.ts.map +1 -1
  341. package/dist/pptx/smartart-layouts/index.mjs +26 -23
  342. package/dist/teams/index.cjs +20165 -18388
  343. package/dist/teams/index.mjs +20165 -18388
  344. package/dist/text/index.cjs +106 -0
  345. package/dist/text/index.d.ts +2 -0
  346. package/dist/text/index.d.ts.map +1 -1
  347. package/dist/text/index.mjs +103 -1
  348. package/dist/text/locale-number.d.ts +15 -0
  349. package/dist/text/locale-number.d.ts.map +1 -0
  350. package/dist/text/tsv.d.ts +8 -0
  351. package/dist/text/tsv.d.ts.map +1 -0
  352. package/dist/visio/index.cjs +3574 -1953
  353. package/dist/visio/index.mjs +3574 -1953
  354. package/dist/visio/ui/index.cjs +3562 -1941
  355. package/dist/visio/ui/index.mjs +3562 -1941
  356. package/dist/xlsx/edit/chart-colors.d.ts +2 -2
  357. package/dist/xlsx/edit/chart-colors.d.ts.map +1 -1
  358. package/dist/xlsx/edit/chart-design.d.ts +11 -0
  359. package/dist/xlsx/edit/chart-design.d.ts.map +1 -0
  360. package/dist/xlsx/edit/chart-element-fill.d.ts.map +1 -1
  361. package/dist/xlsx/edit/chart-series-fill.d.ts.map +1 -1
  362. package/dist/xlsx/edit/chart-series-gradient.d.ts +6 -34
  363. package/dist/xlsx/edit/chart-series-gradient.d.ts.map +1 -1
  364. package/dist/xlsx/edit/chart-series-transparency.d.ts.map +1 -1
  365. package/dist/xlsx/edit/chart-space-patch.d.ts +13 -0
  366. package/dist/xlsx/edit/chart-space-patch.d.ts.map +1 -0
  367. package/dist/xlsx/edit/chart-space-series.d.ts +14 -0
  368. package/dist/xlsx/edit/chart-space-series.d.ts.map +1 -0
  369. package/dist/xlsx/edit/charts.d.ts +22 -6
  370. package/dist/xlsx/edit/charts.d.ts.map +1 -1
  371. package/dist/xlsx/edit/clipboard-text.d.ts +2 -7
  372. package/dist/xlsx/edit/clipboard-text.d.ts.map +1 -1
  373. package/dist/xlsx/edit/context.d.ts +3 -1
  374. package/dist/xlsx/edit/context.d.ts.map +1 -1
  375. package/dist/xlsx/edit/drawings.d.ts.map +1 -1
  376. package/dist/xlsx/edit/index.d.ts +3 -1
  377. package/dist/xlsx/edit/index.d.ts.map +1 -1
  378. package/dist/xlsx/edit/session.d.ts.map +1 -1
  379. package/dist/xlsx/edit/shift-formulas.d.ts.map +1 -1
  380. package/dist/xlsx/edit/smart-art.d.ts +32 -0
  381. package/dist/xlsx/edit/smart-art.d.ts.map +1 -0
  382. package/dist/xlsx/edit/types.d.ts +12 -1
  383. package/dist/xlsx/edit/types.d.ts.map +1 -1
  384. package/dist/xlsx/embedded-chart-space.d.ts +19 -0
  385. package/dist/xlsx/embedded-chart-space.d.ts.map +1 -0
  386. package/dist/xlsx/index.cjs +6464 -3108
  387. package/dist/xlsx/index.d.ts +1 -0
  388. package/dist/xlsx/index.d.ts.map +1 -1
  389. package/dist/xlsx/index.mjs +6458 -3109
  390. package/dist/xlsx/load/index.cjs +5732 -3843
  391. package/dist/xlsx/load/index.mjs +5732 -3843
  392. package/dist/xlsx/model.d.ts +71 -15
  393. package/dist/xlsx/model.d.ts.map +1 -1
  394. package/dist/xlsx/read/chart.d.ts +10 -0
  395. package/dist/xlsx/read/chart.d.ts.map +1 -1
  396. package/dist/xlsx/read/drawing.d.ts.map +1 -1
  397. package/dist/xlsx/read/smart-art.d.ts.map +1 -1
  398. package/dist/xlsx/smart-art-notices.d.ts +6 -0
  399. package/dist/xlsx/smart-art-notices.d.ts.map +1 -0
  400. package/dist/xlsx/ui/commands/contextual.d.ts +6 -1
  401. package/dist/xlsx/ui/commands/contextual.d.ts.map +1 -1
  402. package/dist/xlsx/ui/commands/i18n/chart-series.d.ts.map +1 -1
  403. package/dist/xlsx/ui/commands/i18n/core-features.d.ts.map +1 -1
  404. package/dist/xlsx/ui/commands/i18n/index.d.ts.map +1 -1
  405. package/dist/xlsx/ui/commands/i18n/ribbon-tabs.d.ts.map +1 -1
  406. package/dist/xlsx/ui/commands/i18n/smartart.d.ts +3 -0
  407. package/dist/xlsx/ui/commands/i18n/smartart.d.ts.map +1 -0
  408. package/dist/xlsx/ui/commands/icons.d.ts.map +1 -1
  409. package/dist/xlsx/ui/index.cjs +6671 -2910
  410. package/dist/xlsx/ui/index.mjs +6670 -2910
  411. package/dist/xlsx/ui/locales/de/index.d.ts.map +1 -1
  412. package/dist/xlsx/ui/locales/de/smartart.d.ts +2 -0
  413. package/dist/xlsx/ui/locales/de/smartart.d.ts.map +1 -0
  414. package/dist/xlsx/ui/locales/en/index.d.ts.map +1 -1
  415. package/dist/xlsx/ui/locales/en/smartart.d.ts +2 -0
  416. package/dist/xlsx/ui/locales/en/smartart.d.ts.map +1 -0
  417. package/dist/xlsx/ui/locales/es/index.d.ts.map +1 -1
  418. package/dist/xlsx/ui/locales/es/smartart.d.ts +2 -0
  419. package/dist/xlsx/ui/locales/es/smartart.d.ts.map +1 -0
  420. package/dist/xlsx/ui/locales/fr/index.d.ts.map +1 -1
  421. package/dist/xlsx/ui/locales/fr/smartart.d.ts +2 -0
  422. package/dist/xlsx/ui/locales/fr/smartart.d.ts.map +1 -0
  423. package/dist/xlsx/ui/locales/zh-CN/index.d.ts.map +1 -1
  424. package/dist/xlsx/ui/locales/zh-CN/smartart.d.ts +2 -0
  425. package/dist/xlsx/ui/locales/zh-CN/smartart.d.ts.map +1 -0
  426. package/dist/xlsx/write/chart-cache.d.ts.map +1 -1
  427. package/dist/xlsx/write/chart-colors.d.ts +1 -8
  428. package/dist/xlsx/write/chart-colors.d.ts.map +1 -1
  429. package/dist/xlsx/write/chart-space.d.ts +8 -0
  430. package/dist/xlsx/write/chart-space.d.ts.map +1 -1
  431. package/dist/xlsx/write/chart-title.d.ts +2 -2
  432. package/dist/xlsx/write/chart-title.d.ts.map +1 -1
  433. package/dist/xlsx/write/chart.d.ts +4 -3
  434. package/dist/xlsx/write/chart.d.ts.map +1 -1
  435. package/dist/xlsx/write/drawing.d.ts +10 -3
  436. package/dist/xlsx/write/drawing.d.ts.map +1 -1
  437. package/dist/xlsx/write/smart-art.d.ts +17 -0
  438. package/dist/xlsx/write/smart-art.d.ts.map +1 -0
  439. package/package.json +6 -1
  440. package/dist/PptxHandler-VXK5EY7J.mjs +0 -4
  441. package/dist/pptx/chunks/elements-iUzpAeqR.d.ts.map +0 -1
  442. package/dist/pptx/chunks/index-4FmgJajb.d.ts.map +0 -1
  443. package/dist/pptx/chunks/index-nKQ4s7FA.d.ts.map +0 -1
  444. package/dist/pptx/chunks/smart-art-ENMMEbmW.d.ts.map +0 -1
  445. package/dist/xlsx/write/chart-patch.d.ts +0 -9
  446. package/dist/xlsx/write/chart-patch.d.ts.map +0 -1
@@ -32,16 +32,16 @@ function _interopNamespace(e) {
32
32
  var Y2__namespace = /*#__PURE__*/_interopNamespace(Y2);
33
33
 
34
34
  // docx/ui/backstage-focus.ts
35
- function backstageFocus(element2) {
35
+ function backstageFocus(element3) {
36
36
  let opener = null;
37
37
  const siblings = /* @__PURE__ */ new Map();
38
- const active = () => element2.getRootNode().activeElement;
38
+ const active = () => element3.getRootNode().activeElement;
39
39
  return {
40
40
  open() {
41
41
  const current = active();
42
- if (current instanceof HTMLElement && !element2.contains(current)) opener = current;
43
- for (const sibling of element2.parentElement?.children ?? []) {
44
- if (!(sibling instanceof HTMLElement) || sibling === element2 || siblings.has(sibling))
42
+ if (current instanceof HTMLElement && !element3.contains(current)) opener = current;
43
+ for (const sibling of element3.parentElement?.children ?? []) {
44
+ if (!(sibling instanceof HTMLElement) || sibling === element3 || siblings.has(sibling))
45
45
  continue;
46
46
  siblings.set(sibling, Boolean(sibling.inert));
47
47
  sibling.inert = true;
@@ -391,34 +391,34 @@ var buildXml = (node) => {
391
391
  var isElement = (node) => node.nodeType === 1;
392
392
  var elements = (parent) => Array.from(parent.childNodes).filter(isElement);
393
393
  var makeNS = (doc, ns, qualified) => doc.createElementNS(ns, qualified);
394
- function named(element2, local, ns, lenient = true) {
395
- if (!element2 || element2.localName !== local) return false;
396
- return element2.namespaceURI === ns || lenient && !element2.namespaceURI;
394
+ function named(element3, local, ns, lenient = true) {
395
+ if (!element3 || element3.localName !== local) return false;
396
+ return element3.namespaceURI === ns || lenient && !element3.namespaceURI;
397
397
  }
398
- var children = (parent, local, ns, lenient = true) => elements(parent).filter((element2) => named(element2, local, ns, lenient));
398
+ var children = (parent, local, ns, lenient = true) => elements(parent).filter((element3) => named(element3, local, ns, lenient));
399
399
  var first = (parent, local, ns, lenient = true) => parent ? children(parent, local, ns, lenient)[0] : void 0;
400
- function attr(element2, local, ns, prefix) {
401
- return element2?.getAttributeNS(ns, local) ?? element2?.getAttribute(`${prefix}:${local}`) ?? void 0;
400
+ function attr(element3, local, ns, prefix) {
401
+ return element3?.getAttributeNS(ns, local) ?? element3?.getAttribute(`${prefix}:${local}`) ?? void 0;
402
402
  }
403
403
 
404
404
  // docx/xml.ts
405
405
  var WORD_NS = NS.w;
406
406
  var WORD_DATE_UTC_NS = "http://schemas.microsoft.com/office/word/2023/wordml/word16du";
407
407
  var parseXml2 = (xml) => parseXml(xml, { label: "DOCX" });
408
- var named2 = (element2, local) => named(element2, local, WORD_NS);
408
+ var named2 = (element3, local) => named(element3, local, WORD_NS);
409
409
  var children2 = (parent, local) => children(parent, local, WORD_NS);
410
410
  var first2 = (parent, local) => first(parent, local, WORD_NS);
411
- var getW = (element2, local) => attr(element2, local, WORD_NS, "w");
411
+ var getW = (element3, local) => attr(element3, local, WORD_NS, "w");
412
412
  var makeW = (doc, local) => doc.createElementNS(WORD_NS, `w:${local}`);
413
413
  var XMLNS = "http://www.w3.org/2000/xmlns/";
414
- function importElement(doc, element2) {
415
- const imported = doc.importNode(element2, true);
414
+ function importElement(doc, element3) {
415
+ const imported = doc.importNode(element3, true);
416
416
  const root = doc.documentElement;
417
417
  const drop = (node) => {
418
418
  for (const attribute of Array.from(node.attributes))
419
419
  if (attribute.namespaceURI === XMLNS && root?.lookupNamespaceURI(attribute.prefix ? attribute.localName : null) === attribute.value)
420
420
  node.removeAttributeNode(attribute);
421
- for (const child of Array.from(node.childNodes)) if (isElement(child)) drop(child);
421
+ for (const child3 of Array.from(node.childNodes)) if (isElement(child3)) drop(child3);
422
422
  };
423
423
  drop(imported);
424
424
  return imported;
@@ -439,9 +439,9 @@ function parseOnOff(value) {
439
439
  return void 0;
440
440
  }
441
441
  }
442
- function onOffElement(element2) {
443
- if (!element2) return void 0;
444
- const value = getW(element2, "val");
442
+ function onOffElement(element3) {
443
+ if (!element3) return void 0;
444
+ const value = getW(element3, "val");
445
445
  return value === void 0 ? true : parseOnOff(value);
446
446
  }
447
447
  var SAFE_INTEGER = /^-?\d+$/;
@@ -518,14 +518,14 @@ function parseTintShade(value) {
518
518
  var KINDS = { textInput: "text", checkBox: "checkbox", ddList: "dropDown" };
519
519
  var elementOfKind = (kind) => Object.keys(KINDS).find((name) => KINDS[name] === kind);
520
520
  var elementChildren = (parent) => Array.from(parent.childNodes).filter(isElement);
521
- function infoText(element2) {
522
- if (!element2) return void 0;
523
- const type = getW(element2, "type") ?? "text";
524
- return isStInfoTextType(type) ? { type, value: getW(element2, "val") ?? "" } : void 0;
521
+ function infoText(element3) {
522
+ if (!element3) return void 0;
523
+ const type = getW(element3, "type") ?? "text";
524
+ return isStInfoTextType(type) ? { type, value: getW(element3, "val") ?? "" } : void 0;
525
525
  }
526
526
  function parseFormField(ffData) {
527
527
  const typed = elementChildren(ffData).find(
528
- (child) => Object.hasOwn(KINDS, child.localName ?? "")
528
+ (child3) => Object.hasOwn(KINDS, child3.localName ?? "")
529
529
  );
530
530
  if (!typed || typed.namespaceURI !== WORD_NS) return void 0;
531
531
  const field = { kind: KINDS[typed.localName] };
@@ -564,7 +564,7 @@ function parseFormField(ffData) {
564
564
  const result = parseInteger(getW(first2(typed, "result"), "val"));
565
565
  const fallback = parseInteger(getW(first2(typed, "default"), "val"));
566
566
  field.dropDown = {
567
- entries: elementChildren(typed).filter((child) => named2(child, "listEntry")).map((entry) => getW(entry, "val") ?? ""),
567
+ entries: elementChildren(typed).filter((child3) => named2(child3, "listEntry")).map((entry) => getW(entry, "val") ?? ""),
568
568
  ...result !== void 0 && { result },
569
569
  ...fallback !== void 0 && { default: fallback }
570
570
  };
@@ -572,18 +572,18 @@ function parseFormField(ffData) {
572
572
  field.sourceXml = buildXml(ffData);
573
573
  return field;
574
574
  }
575
- var isModeledFormFieldData = (element2) => named2(element2, "ffData") && parseFormField(element2) !== void 0;
575
+ var isModeledFormFieldData = (element3) => named2(element3, "ffData") && parseFormField(element3) !== void 0;
576
576
  var withoutSource = ({ sourceXml: _source, ...field }) => field;
577
577
  var sameField = (a, b) => JSON.stringify(withoutSource(a)) === JSON.stringify(withoutSource(b));
578
578
  function valued(doc, local, value) {
579
- const element2 = makeW(doc, local);
580
- element2.setAttributeNS(WORD_NS, "w:val", value);
581
- return element2;
579
+ const element3 = makeW(doc, local);
580
+ element3.setAttributeNS(WORD_NS, "w:val", value);
581
+ return element3;
582
582
  }
583
583
  var onOff = (doc, local, on) => on ? makeW(doc, local) : valued(doc, local, "0");
584
584
  function kindElement(doc, field) {
585
- const element2 = makeW(doc, elementOfKind(field.kind));
586
- const add3 = (child) => child && element2.appendChild(child);
585
+ const element3 = makeW(doc, elementOfKind(field.kind));
586
+ const add3 = (child3) => child3 && element3.appendChild(child3);
587
587
  if (field.kind === "text") {
588
588
  const input = field.textInput ?? {};
589
589
  if (input.type) add3(valued(doc, "type", input.type));
@@ -603,7 +603,7 @@ function kindElement(doc, field) {
603
603
  if (list.default !== void 0) add3(valued(doc, "default", String(list.default)));
604
604
  for (const entry of list.entries) add3(valued(doc, "listEntry", entry));
605
605
  }
606
- return element2;
606
+ return element3;
607
607
  }
608
608
  function setChild(ffData, local, next) {
609
609
  const current = first2(ffData, local);
@@ -611,7 +611,7 @@ function setChild(ffData, local, next) {
611
611
  else if (current) ffData.removeChild(current);
612
612
  else if (next) {
613
613
  const kind = elementChildren(ffData).find(
614
- (child) => Object.hasOwn(KINDS, child.localName ?? "")
614
+ (child3) => Object.hasOwn(KINDS, child3.localName ?? "")
615
615
  );
616
616
  ffData.insertBefore(next, kind ?? null);
617
617
  }
@@ -627,14 +627,14 @@ function writeFormFieldData(doc, field, source) {
627
627
  for (const key of ["helpText", "statusText"]) {
628
628
  if (JSON.stringify(current?.[key]) === JSON.stringify(field[key])) continue;
629
629
  const text2 = field[key];
630
- const element2 = text2 && makeW(doc, key);
631
- if (element2 && text2) {
632
- element2.setAttributeNS(WORD_NS, "w:type", text2.type);
633
- element2.setAttributeNS(WORD_NS, "w:val", text2.value);
630
+ const element3 = text2 && makeW(doc, key);
631
+ if (element3 && text2) {
632
+ element3.setAttributeNS(WORD_NS, "w:type", text2.type);
633
+ element3.setAttributeNS(WORD_NS, "w:val", text2.value);
634
634
  }
635
- setChild(ffData, key, element2);
635
+ setChild(ffData, key, element3);
636
636
  }
637
- const kind = elementChildren(ffData).find((child) => Object.hasOwn(KINDS, child.localName ?? ""));
637
+ const kind = elementChildren(ffData).find((child3) => Object.hasOwn(KINDS, child3.localName ?? ""));
638
638
  if (kind) ffData.replaceChild(kindElement(doc, field), kind);
639
639
  else ffData.appendChild(kindElement(doc, field));
640
640
  return ffData;
@@ -975,10 +975,10 @@ function cellText(doc, pos) {
975
975
  const cell = doc.nodeAt(pos);
976
976
  const text2 = { from: pos + 2, to: pos + cell.nodeSize - 2 };
977
977
  let first3 = true;
978
- cell.forEach((child, offset) => {
979
- if (child.type.name !== "paragraph") return;
978
+ cell.forEach((child3, offset) => {
979
+ if (child3.type.name !== "paragraph") return;
980
980
  if (first3) text2.from = pos + 2 + offset;
981
- text2.to = pos + offset + child.nodeSize;
981
+ text2.to = pos + offset + child3.nodeSize;
982
982
  first3 = false;
983
983
  });
984
984
  return text2;
@@ -986,13 +986,13 @@ function cellText(doc, pos) {
986
986
  function cellContent(state, cell, text2) {
987
987
  const nodes = [];
988
988
  let placed = false;
989
- cell.forEach((child) => {
990
- if (child.type.name !== "paragraph") {
991
- nodes.push(child);
989
+ cell.forEach((child3) => {
990
+ if (child3.type.name !== "paragraph") {
991
+ nodes.push(child3);
992
992
  return;
993
993
  }
994
- const attrs2 = child.attrs.contentControl ? { ...child.attrs, contentControl: null } : child.attrs;
995
- nodes.push(child.type.create(attrs2, placed ? null : text2));
994
+ const attrs2 = child3.attrs.contentControl ? { ...child3.attrs, contentControl: null } : child3.attrs;
995
+ nodes.push(child3.type.create(attrs2, placed ? null : text2));
996
996
  placed = true;
997
997
  });
998
998
  if (!placed) nodes.push(state.schema.nodes.paragraph.create(null, text2));
@@ -1408,9 +1408,9 @@ function pastedControlSources(slice, doc, copied = /* @__PURE__ */ new Set()) {
1408
1408
  const mapFragment = (fragment) => {
1409
1409
  const nodes = [];
1410
1410
  let changed = false;
1411
- fragment.forEach((child) => {
1412
- const next = mapNode(child);
1413
- changed ||= next !== child;
1411
+ fragment.forEach((child3) => {
1412
+ const next = mapNode(child3);
1413
+ changed ||= next !== child3;
1414
1414
  nodes.push(next);
1415
1415
  });
1416
1416
  return changed ? prosemirrorModel.Fragment.fromArray(nodes) : fragment;
@@ -1574,7 +1574,7 @@ var IdempotencyCache = class {
1574
1574
  };
1575
1575
  function freezeDeep(value) {
1576
1576
  if (value && typeof value === "object" && !Object.isFrozen(value)) {
1577
- for (const child of Object.values(value)) freezeDeep(child);
1577
+ for (const child3 of Object.values(value)) freezeDeep(child3);
1578
1578
  Object.freeze(value);
1579
1579
  }
1580
1580
  return value;
@@ -1613,21 +1613,21 @@ function repairCollaborativeDocumentIds(state, clientId, idGenerator = createCol
1613
1613
  var repairCollaborativeParagraphIds = repairCollaborativeDocumentIds;
1614
1614
 
1615
1615
  // docx/revision-properties.ts
1616
- function propertiesSignature(element2) {
1616
+ function propertiesSignature(element3) {
1617
1617
  return JSON.stringify([
1618
- element2.namespaceURI,
1619
- element2.localName,
1620
- 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))),
1621
- Array.from(element2.childNodes).flatMap(
1622
- (child) => child.nodeType === 1 ? [propertiesSignature(child)] : child.textContent?.trim() ? [child.textContent] : []
1618
+ element3.namespaceURI,
1619
+ element3.localName,
1620
+ 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))),
1621
+ Array.from(element3.childNodes).flatMap(
1622
+ (child3) => child3.nodeType === 1 ? [propertiesSignature(child3)] : child3.textContent?.trim() ? [child3.textContent] : []
1623
1623
  )
1624
1624
  ]);
1625
1625
  }
1626
1626
  function parsePropertiesSnapshot(xml, local) {
1627
- const element2 = parseXml2(xml).documentElement;
1628
- if (!named2(element2, local))
1627
+ const element3 = parseXml2(xml).documentElement;
1628
+ if (!named2(element3, local))
1629
1629
  throw new Error(`A formatting revision snapshot must contain Word ${local} properties.`);
1630
- return element2;
1630
+ return element3;
1631
1631
  }
1632
1632
 
1633
1633
  // docx/element-order.ts
@@ -1681,14 +1681,14 @@ function orderChildren(parent, order) {
1681
1681
  const elements2 = Array.from(parent.childNodes).filter(isElement);
1682
1682
  const rankOf = (name) => order.findIndex((entry) => typeof entry === "string" ? entry === name : entry.includes(name));
1683
1683
  let previousRank = -1;
1684
- const ranked = elements2.map((element2, index) => {
1685
- const rank2 = element2.namespaceURI === WORD_NS ? rankOf(element2.localName ?? "") : -1;
1684
+ const ranked = elements2.map((element3, index) => {
1685
+ const rank2 = element3.namespaceURI === WORD_NS ? rankOf(element3.localName ?? "") : -1;
1686
1686
  if (rank2 >= 0) previousRank = rank2;
1687
- return { element: element2, index, rank: rank2 >= 0 ? rank2 : previousRank + 0.5 };
1687
+ return { element: element3, index, rank: rank2 >= 0 ? rank2 : previousRank + 0.5 };
1688
1688
  });
1689
1689
  const sorted = [...ranked].sort((a, b) => a.rank - b.rank || a.index - b.index);
1690
1690
  if (sorted.every((entry, index) => entry.element === elements2[index])) return;
1691
- for (const { element: element2 } of sorted) parent.appendChild(element2);
1691
+ for (const { element: element3 } of sorted) parent.appendChild(element3);
1692
1692
  }
1693
1693
 
1694
1694
  // color/color-primitives.ts
@@ -2159,7 +2159,7 @@ var WORD_2010_NS = "http://schemas.microsoft.com/office/word/2010/wordml";
2159
2159
  var MC = "http://schemas.openxmlformats.org/markup-compatibility/2006";
2160
2160
  var XMLNS2 = "http://www.w3.org/2000/xmlns/";
2161
2161
  var ligatureElements = (props) => elements(props).filter(
2162
- (element2) => element2.namespaceURI === WORD_2010_NS && element2.localName === "ligatures"
2162
+ (element3) => element3.namespaceURI === WORD_2010_NS && element3.localName === "ligatures"
2163
2163
  );
2164
2164
  var parseLigatures = (props) => {
2165
2165
  const value = ligatureElements(props)[0]?.getAttributeNS(WORD_2010_NS, "val");
@@ -2184,12 +2184,12 @@ function declareIgnorableExtension(doc, ns, preferred) {
2184
2184
  return prefix;
2185
2185
  }
2186
2186
  function writeLigatures(doc, props, value) {
2187
- for (const element3 of ligatureElements(props)) props.removeChild(element3);
2187
+ for (const element4 of ligatureElements(props)) props.removeChild(element4);
2188
2188
  if (value === void 0) return;
2189
2189
  const prefix = declareIgnorableExtension(doc, WORD_2010_NS, "w14");
2190
- const element2 = doc.createElementNS(WORD_2010_NS, `${prefix}:ligatures`);
2191
- element2.setAttributeNS(WORD_2010_NS, `${prefix}:val`, value);
2192
- props.appendChild(element2);
2190
+ const element3 = doc.createElementNS(WORD_2010_NS, `${prefix}:ligatures`);
2191
+ element3.setAttributeNS(WORD_2010_NS, `${prefix}:val`, value);
2192
+ props.appendChild(element3);
2193
2193
  }
2194
2194
  function enumValue(guard, raw, label) {
2195
2195
  if (raw === null || raw === void 0 || raw === "") return void 0;
@@ -2342,18 +2342,18 @@ function parseRunProperties(props) {
2342
2342
  }
2343
2343
 
2344
2344
  // docx/write-run-extra.ts
2345
- function setAttribute(element2, local, value) {
2346
- element2.setAttributeNS(WORD_NS, `w:${local}`, value);
2345
+ function setAttribute(element3, local, value) {
2346
+ element3.setAttributeNS(WORD_NS, `w:${local}`, value);
2347
2347
  }
2348
- function removeChildren(element2, local) {
2349
- for (const child of children2(element2, local)) element2.removeChild(child);
2348
+ function removeChildren(element3, local) {
2349
+ for (const child3 of children2(element3, local)) element3.removeChild(child3);
2350
2350
  }
2351
2351
  function setToggle(doc, props, local, value) {
2352
2352
  removeChildren(props, local);
2353
2353
  if (value === void 0) return;
2354
- const element2 = makeW(doc, local);
2355
- if (!value) setAttribute(element2, "val", "0");
2356
- props.appendChild(element2);
2354
+ const element3 = makeW(doc, local);
2355
+ if (!value) setAttribute(element3, "val", "0");
2356
+ props.appendChild(element3);
2357
2357
  }
2358
2358
  function setExtendedRunProperties(doc, props, run, base) {
2359
2359
  const changed = (key) => runPropertyChanged(run, base, key);
@@ -2378,9 +2378,9 @@ function setExtendedRunProperties(doc, props, run, base) {
2378
2378
  if (!changed(key)) continue;
2379
2379
  removeChildren(props, local);
2380
2380
  if (run[key] === void 0) continue;
2381
- const element2 = makeW(doc, local);
2382
- setAttribute(element2, "val", String(run[key]));
2383
- props.appendChild(element2);
2381
+ const element3 = makeW(doc, local);
2382
+ setAttribute(element3, "val", String(run[key]));
2383
+ props.appendChild(element3);
2384
2384
  }
2385
2385
  if (changed("characterSpacingTwips")) {
2386
2386
  removeChildren(props, "spacing");
@@ -2475,7 +2475,7 @@ function buildWatermarkRun(doc, spec, uniqueId) {
2475
2475
  lock.setAttributeNS(VML_NS, "v:ext", "edit");
2476
2476
  lock.setAttribute("text", "t");
2477
2477
  lock.setAttribute("shapetype", "t");
2478
- for (const child of [formulas, path, typePath, handles, lock]) type.appendChild(child);
2478
+ for (const child3 of [formulas, path, typePath, handles, lock]) type.appendChild(child3);
2479
2479
  const size = watermarkSizePt(spec);
2480
2480
  const shape = v("shape");
2481
2481
  shape.setAttribute("id", `${WATERMARK_PREFIX}${uniqueId}`);
@@ -2496,7 +2496,7 @@ function buildWatermarkRun(doc, spec, uniqueId) {
2496
2496
  const wrap = makeNS(doc, WORD10_NS, "w10:wrap");
2497
2497
  wrap.setAttribute("anchorx", "margin");
2498
2498
  wrap.setAttribute("anchory", "margin");
2499
- for (const child of [fill, text2, wrap]) shape.appendChild(child);
2499
+ for (const child3 of [fill, text2, wrap]) shape.appendChild(child3);
2500
2500
  pict.appendChild(type);
2501
2501
  pict.appendChild(shape);
2502
2502
  run.appendChild(pict);
@@ -2552,7 +2552,7 @@ function patchTextBox(doc, drawing, image, base) {
2552
2552
  if (JSON.stringify(image.textBoxText) !== JSON.stringify(base.textBoxText)) {
2553
2553
  const content = descendants(drawing, W_NS, "txbxContent")[0];
2554
2554
  if (content) {
2555
- for (const child of Array.from(content.childNodes)) content.removeChild(child);
2555
+ for (const child3 of Array.from(content.childNodes)) content.removeChild(child3);
2556
2556
  add(content, ...paragraphsFor(doc, image.textBoxText ?? []));
2557
2557
  }
2558
2558
  }
@@ -2625,33 +2625,33 @@ var COLOR_ELEMENTS = {
2625
2625
  scrgbClr: "scrgb",
2626
2626
  hslClr: "hsl"
2627
2627
  };
2628
- function colorValue(kind, element2) {
2629
- const attribute = (name) => element2.getAttribute(name) ?? "";
2628
+ function colorValue(kind, element3) {
2629
+ const attribute = (name) => element3.getAttribute(name) ?? "";
2630
2630
  if (kind === "scrgb") return `${attribute("r")},${attribute("g")},${attribute("b")}`;
2631
2631
  if (kind === "hsl") return `${attribute("hue")},${attribute("sat")},${attribute("lum")}`;
2632
2632
  return attribute("val");
2633
2633
  }
2634
2634
  function parseDrawingColorIn(container) {
2635
2635
  if (!container) return void 0;
2636
- for (const element2 of elements(container)) {
2637
- const kind = COLOR_ELEMENTS[element2.localName];
2638
- if (!kind || element2.namespaceURI && element2.namespaceURI !== NS.a) continue;
2639
- return parseDrawingColor(element2);
2636
+ for (const element3 of elements(container)) {
2637
+ const kind = COLOR_ELEMENTS[element3.localName];
2638
+ if (!kind || element3.namespaceURI && element3.namespaceURI !== NS.a) continue;
2639
+ return parseDrawingColor(element3);
2640
2640
  }
2641
2641
  return void 0;
2642
2642
  }
2643
- function parseDrawingColor(element2) {
2644
- const kind = COLOR_ELEMENTS[element2.localName];
2643
+ function parseDrawingColor(element3) {
2644
+ const kind = COLOR_ELEMENTS[element3.localName];
2645
2645
  if (!kind) return void 0;
2646
2646
  const color = {
2647
2647
  kind,
2648
- value: colorValue(kind, element2),
2649
- transforms: elements(element2).map((child) => ({
2650
- name: child.localName,
2651
- value: child.getAttribute("val") ?? ""
2648
+ value: colorValue(kind, element3),
2649
+ transforms: elements(element3).map((child3) => ({
2650
+ name: child3.localName,
2651
+ value: child3.getAttribute("val") ?? ""
2652
2652
  }))
2653
2653
  };
2654
- const fallback = kind === "system" ? element2.getAttribute("lastClr") : null;
2654
+ const fallback = kind === "system" ? element3.getAttribute("lastClr") : null;
2655
2655
  if (fallback) color.fallback = fallback;
2656
2656
  return color;
2657
2657
  }
@@ -3046,11 +3046,758 @@ function themeSlotHex(color) {
3046
3046
  return value ? value.toUpperCase() : void 0;
3047
3047
  }
3048
3048
 
3049
+ // drawingml/write-line.ts
3050
+ var FILLS = /* @__PURE__ */ new Set(["noFill", "solidFill", "gradFill", "pattFill"]);
3051
+ function dropDrawingDeclarations(element3) {
3052
+ if (element3.getAttribute("xmlns:a") === NS.a) element3.removeAttribute("xmlns:a");
3053
+ for (const child3 of elements(element3)) dropDrawingDeclarations(child3);
3054
+ }
3055
+ function patchDrawingLine(ln, line2) {
3056
+ if (line2.widthEmu === void 0) ln.removeAttribute("w");
3057
+ else ln.setAttribute("w", String(Math.round(line2.widthEmu)));
3058
+ if (line2.cap === void 0) ln.removeAttribute("cap");
3059
+ else ln.setAttribute("cap", line2.cap);
3060
+ const fill = line2.fill && drawingFillXml(line2.fill);
3061
+ if (fill || !line2.fill) {
3062
+ for (const node of elements(ln))
3063
+ if (node.namespaceURI === NS.a && FILLS.has(node.localName)) ln.removeChild(node);
3064
+ }
3065
+ if (fill) {
3066
+ const parsed = parseXml(`<w xmlns:a="${NS.a}">${fill}</w>`).documentElement;
3067
+ for (const node of elements(parsed).reverse()) {
3068
+ const imported = ln.ownerDocument.importNode(node, true);
3069
+ dropDrawingDeclarations(imported);
3070
+ ln.insertBefore(imported, ln.firstChild);
3071
+ }
3072
+ }
3073
+ const dashes = elements(ln).filter(
3074
+ (node) => node.namespaceURI === NS.a && (node.localName === "prstDash" || node.localName === "custDash")
3075
+ );
3076
+ if (line2.dash === void 0) {
3077
+ for (const node of dashes) if (node.localName === "prstDash") ln.removeChild(node);
3078
+ return;
3079
+ }
3080
+ const dash = ln.ownerDocument.createElementNS(NS.a, "a:prstDash");
3081
+ dash.setAttribute("val", line2.dash);
3082
+ for (const node of dashes) ln.removeChild(node);
3083
+ const afterFill = elements(ln).find(
3084
+ (node) => node.namespaceURI !== NS.a || !FILLS.has(node.localName)
3085
+ );
3086
+ ln.insertBefore(dash, afterFill ?? null);
3087
+ }
3088
+ function drawingLineXml(line2) {
3089
+ const doc = parseXml(`<a:ln xmlns:a="${NS.a}"/>`);
3090
+ patchDrawingLine(doc.documentElement, line2);
3091
+ return buildXml(doc);
3092
+ }
3093
+
3049
3094
  // docx/shape-parse.ts
3050
3095
  var A_NS2 = "http://schemas.openxmlformats.org/drawingml/2006/main";
3051
3096
  var WPS_NS2 = "http://schemas.microsoft.com/office/word/2010/wordprocessingShape";
3052
3097
  var W_NS2 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
3053
3098
 
3099
+ // diagram/layout/smartart-tree.ts
3100
+ function buildForest(nodes) {
3101
+ const map = /* @__PURE__ */ new Map();
3102
+ for (const n2 of nodes) {
3103
+ map.set(n2.id, { node: n2, children: [] });
3104
+ }
3105
+ const roots = [];
3106
+ for (const n2 of nodes) {
3107
+ const tn = map.get(n2.id);
3108
+ if (n2.parentId && map.has(n2.parentId)) {
3109
+ map.get(n2.parentId).children.push(tn);
3110
+ } else {
3111
+ roots.push(tn);
3112
+ }
3113
+ }
3114
+ return roots;
3115
+ }
3116
+ var MAX_TREE_DEPTH = 256;
3117
+ function treeWidth(t, depth = 0) {
3118
+ if (depth >= MAX_TREE_DEPTH) {
3119
+ return 1;
3120
+ }
3121
+ if (t.children.length === 0) {
3122
+ return 1;
3123
+ }
3124
+ let sum = 0;
3125
+ for (const c of t.children) {
3126
+ sum += treeWidth(c, depth + 1);
3127
+ }
3128
+ return sum;
3129
+ }
3130
+ function treeDepth(t, depth = 0) {
3131
+ if (depth >= MAX_TREE_DEPTH) {
3132
+ return 0;
3133
+ }
3134
+ if (t.children.length === 0) {
3135
+ return 1;
3136
+ }
3137
+ let max = 0;
3138
+ for (const c of t.children) {
3139
+ const d = treeDepth(c, depth + 1);
3140
+ if (d > max) {
3141
+ max = d;
3142
+ }
3143
+ }
3144
+ return 1 + max;
3145
+ }
3146
+
3147
+ // diagram/edit/reflow-directional.ts
3148
+ function reflowTimeline(nodes, bounds) {
3149
+ const padding = 24;
3150
+ const lineY = bounds.y + bounds.height / 2;
3151
+ const lineStartX = bounds.x + padding;
3152
+ const lineEndX = bounds.x + bounds.width - padding;
3153
+ const lineLen = lineEndX - lineStartX;
3154
+ const nodeW = Math.max(40, Math.min(80, lineLen / (nodes.length * 1.2)));
3155
+ const nodeH = nodeW * 0.5;
3156
+ const labelOffset = Math.min(bounds.height * 0.28, 40);
3157
+ const shapes = [];
3158
+ shapes.push({
3159
+ id: "reflow-timeline-bar",
3160
+ shapeType: "rect",
3161
+ x: lineStartX,
3162
+ y: lineY - 2,
3163
+ width: lineLen,
3164
+ height: 4,
3165
+ fillColor: "#94a3b8"
3166
+ });
3167
+ nodes.forEach((node, i) => {
3168
+ const x = nodes.length === 1 ? (lineStartX + lineEndX) / 2 : lineStartX + i / (nodes.length - 1) * lineLen;
3169
+ const above = i % 2 === 0;
3170
+ const ny = above ? lineY - labelOffset - nodeH / 2 : lineY + labelOffset - nodeH / 2;
3171
+ shapes.push({
3172
+ id: `reflow-timeline-${node.id}`,
3173
+ shapeType: "roundRect",
3174
+ x: x - nodeW / 2,
3175
+ y: ny,
3176
+ width: nodeW,
3177
+ height: nodeH,
3178
+ text: node.text,
3179
+ fontSize: Math.max(6, Math.min(10, nodeW * 0.1))
3180
+ });
3181
+ });
3182
+ return shapes;
3183
+ }
3184
+ function reflowRelationship(nodes, bounds) {
3185
+ const shapes = [];
3186
+ if (nodes.length <= 2) {
3187
+ const padding = 16;
3188
+ const arrowGap = 24;
3189
+ const usableW = bounds.width - padding * 2 - arrowGap;
3190
+ const nodeW = usableW / nodes.length;
3191
+ const nodeH = bounds.height * 0.5;
3192
+ const yOffset = bounds.y + (bounds.height - nodeH) / 2;
3193
+ nodes.forEach((node, i) => {
3194
+ shapes.push({
3195
+ id: `reflow-rel-${node.id}`,
3196
+ shapeType: "roundRect",
3197
+ x: bounds.x + padding + i * (nodeW + arrowGap),
3198
+ y: yOffset,
3199
+ width: nodeW,
3200
+ height: nodeH,
3201
+ text: node.text,
3202
+ fontSize: Math.max(8, Math.min(11, nodeW * 0.1))
3203
+ });
3204
+ });
3205
+ if (nodes.length === 2) {
3206
+ const arrowX = bounds.x + padding + nodeW;
3207
+ const arrowY = yOffset + nodeH / 2 - 6;
3208
+ shapes.push({
3209
+ id: "reflow-rel-arrow",
3210
+ shapeType: "leftRightArrow",
3211
+ x: arrowX,
3212
+ y: arrowY,
3213
+ width: arrowGap,
3214
+ height: 12,
3215
+ fillColor: "#94a3b8"
3216
+ });
3217
+ }
3218
+ } else {
3219
+ const size = Math.min(bounds.width, bounds.height);
3220
+ const cx = bounds.x + bounds.width / 2;
3221
+ const cy = bounds.y + bounds.height / 2;
3222
+ const radius = size * 0.3;
3223
+ const nodeW = Math.max(size * 0.16, Math.min(size * 0.24, 250 / nodes.length));
3224
+ const nodeH = nodeW * 0.6;
3225
+ nodes.forEach((node, i) => {
3226
+ const angle = i / nodes.length * Math.PI * 2 - Math.PI / 2;
3227
+ const nx = cx + radius * Math.cos(angle) - nodeW / 2;
3228
+ const ny = cy + radius * Math.sin(angle) - nodeH / 2;
3229
+ shapes.push({
3230
+ id: `reflow-rel-${node.id}`,
3231
+ shapeType: "roundRect",
3232
+ x: nx,
3233
+ y: ny,
3234
+ width: nodeW,
3235
+ height: nodeH,
3236
+ text: node.text,
3237
+ fontSize: Math.max(7, Math.min(10, nodeW * 0.1))
3238
+ });
3239
+ });
3240
+ }
3241
+ return shapes;
3242
+ }
3243
+ function reflowChevron(nodes, bounds) {
3244
+ const padding = 8;
3245
+ const gap = 4;
3246
+ const usableW = bounds.width - padding * 2;
3247
+ const itemW = (usableW - gap * (nodes.length - 1)) / nodes.length;
3248
+ const itemH = Math.min(bounds.height - padding * 2, 60);
3249
+ const yOffset = bounds.y + (bounds.height - itemH) / 2;
3250
+ return nodes.map((node, i) => {
3251
+ const x = bounds.x + padding + i * (itemW + gap);
3252
+ return {
3253
+ id: `reflow-chevron-${node.id}`,
3254
+ shapeType: "chevron",
3255
+ x,
3256
+ y: yOffset,
3257
+ width: itemW,
3258
+ height: itemH,
3259
+ text: node.text,
3260
+ fontSize: Math.max(7, Math.min(11, itemW * 0.1))
3261
+ };
3262
+ });
3263
+ }
3264
+ function reflowBending(nodes, bounds) {
3265
+ const COLS = 4;
3266
+ const padding = 8;
3267
+ const gap = 6;
3268
+ const rows = Math.ceil(nodes.length / COLS);
3269
+ const usableW = bounds.width - padding * 2;
3270
+ const usableH = bounds.height - padding * 2;
3271
+ const cellW = (usableW - gap * (COLS - 1)) / COLS;
3272
+ const cellH = (usableH - gap * (rows - 1)) / Math.max(rows, 1);
3273
+ const boxW = cellW * 0.85;
3274
+ const boxH = Math.min(cellH * 0.7, 40);
3275
+ const shapes = [];
3276
+ nodes.forEach((node, i) => {
3277
+ const row = Math.floor(i / COLS);
3278
+ const colInRow = i % COLS;
3279
+ const col = row % 2 === 0 ? colInRow : COLS - 1 - colInRow;
3280
+ const nodeCx = bounds.x + padding + col * (cellW + gap) + cellW / 2;
3281
+ const nodeCy = bounds.y + padding + row * (cellH + gap) + cellH / 2;
3282
+ shapes.push({
3283
+ id: `reflow-bending-${node.id}`,
3284
+ shapeType: "roundRect",
3285
+ x: nodeCx - boxW / 2,
3286
+ y: nodeCy - boxH / 2,
3287
+ width: boxW,
3288
+ height: boxH,
3289
+ text: node.text,
3290
+ fontSize: Math.max(7, Math.min(10, boxW * 0.1))
3291
+ });
3292
+ if (i < nodes.length - 1) {
3293
+ const nextRow = Math.floor((i + 1) / COLS);
3294
+ const nextColInRow = (i + 1) % COLS;
3295
+ const nextCol = nextRow % 2 === 0 ? nextColInRow : COLS - 1 - nextColInRow;
3296
+ const nextCx = bounds.x + padding + nextCol * (cellW + gap) + cellW / 2;
3297
+ const nextCy = bounds.y + padding + nextRow * (cellH + gap) + cellH / 2;
3298
+ if (nextRow === row) {
3299
+ const dir = nextCx > nodeCx ? 1 : -1;
3300
+ const arrowX = dir > 0 ? nodeCx + boxW / 2 : nextCx + boxW / 2;
3301
+ const arrowW = Math.abs(nextCx - nodeCx) - boxW;
3302
+ shapes.push({
3303
+ id: `reflow-bending-arrow-${node.id}`,
3304
+ shapeType: dir > 0 ? "rightArrow" : "leftArrow",
3305
+ x: arrowX,
3306
+ y: nodeCy - 4,
3307
+ width: Math.max(arrowW, 4),
3308
+ height: 8,
3309
+ fillColor: "#94a3b8"
3310
+ });
3311
+ } else {
3312
+ const arrowY = nodeCy + boxH / 2;
3313
+ const arrowH = Math.abs(nextCy - nodeCy) - boxH;
3314
+ shapes.push({
3315
+ id: `reflow-bending-arrow-${node.id}`,
3316
+ shapeType: "downArrow",
3317
+ x: nodeCx - 4,
3318
+ y: arrowY,
3319
+ width: 8,
3320
+ height: Math.max(arrowH, 4),
3321
+ fillColor: "#94a3b8"
3322
+ });
3323
+ }
3324
+ }
3325
+ });
3326
+ return shapes;
3327
+ }
3328
+
3329
+ // diagram/edit/reflow-geometric.ts
3330
+ function reflowCycle(nodes, bounds) {
3331
+ const size = Math.min(bounds.width, bounds.height);
3332
+ const cx = bounds.x + bounds.width / 2;
3333
+ const cy = bounds.y + bounds.height / 2;
3334
+ const radius = size * 0.32;
3335
+ const nodeW = Math.max(size * 0.18, Math.min(size * 0.28, 300 / nodes.length));
3336
+ const nodeH = nodeW * 0.6;
3337
+ return nodes.map((node, i) => {
3338
+ const angle = i / nodes.length * Math.PI * 2 - Math.PI / 2;
3339
+ const nx = cx + radius * Math.cos(angle) - nodeW / 2;
3340
+ const ny = cy + radius * Math.sin(angle) - nodeH / 2;
3341
+ return {
3342
+ id: `reflow-cycle-${node.id}`,
3343
+ shapeType: "ellipse",
3344
+ x: nx,
3345
+ y: ny,
3346
+ width: nodeW,
3347
+ height: nodeH,
3348
+ text: node.text,
3349
+ fontSize: Math.max(7, Math.min(10, nodeW * 0.1))
3350
+ };
3351
+ });
3352
+ }
3353
+ function reflowMatrix(nodes, bounds) {
3354
+ const cols = Math.ceil(Math.sqrt(nodes.length));
3355
+ const rows = Math.ceil(nodes.length / cols);
3356
+ const padding = 8;
3357
+ const gap = 6;
3358
+ const usableW = bounds.width - padding * 2;
3359
+ const usableH = bounds.height - padding * 2;
3360
+ const cellW = (usableW - gap * (cols - 1)) / cols;
3361
+ const cellH = (usableH - gap * (rows - 1)) / rows;
3362
+ return nodes.map((node, i) => {
3363
+ const col = i % cols;
3364
+ const row = Math.floor(i / cols);
3365
+ return {
3366
+ id: `reflow-matrix-${node.id}`,
3367
+ shapeType: "roundRect",
3368
+ x: bounds.x + padding + col * (cellW + gap),
3369
+ y: bounds.y + padding + row * (cellH + gap),
3370
+ width: cellW,
3371
+ height: cellH,
3372
+ text: node.text,
3373
+ fontSize: Math.max(8, Math.min(11, Math.min(cellW, cellH) * 0.12))
3374
+ };
3375
+ });
3376
+ }
3377
+ function reflowTarget(nodes, bounds) {
3378
+ const cx = bounds.x + bounds.width / 2;
3379
+ const cy = bounds.y + bounds.height / 2;
3380
+ const size = Math.min(bounds.width, bounds.height);
3381
+ const maxRadius = size * 0.45;
3382
+ return nodes.map((node, i) => {
3383
+ const radiusFraction = 1 - i / nodes.length;
3384
+ const r = maxRadius * radiusFraction;
3385
+ const diameter = r * 2;
3386
+ return {
3387
+ id: `reflow-target-${node.id}`,
3388
+ shapeType: "ellipse",
3389
+ x: cx - r,
3390
+ y: cy - r,
3391
+ width: diameter,
3392
+ height: diameter,
3393
+ text: node.text,
3394
+ fontSize: Math.max(7, Math.min(10, r * 0.15))
3395
+ };
3396
+ });
3397
+ }
3398
+ function reflowGear(nodes, bounds) {
3399
+ const gearNodes = nodes.slice(0, 3);
3400
+ const extraNodes = nodes.slice(3);
3401
+ const gearAreaW = extraNodes.length > 0 ? bounds.width * 0.7 : bounds.width;
3402
+ const gearAreaH = bounds.height;
3403
+ bounds.x + gearAreaW / 2;
3404
+ const cy = bounds.y + gearAreaH / 2;
3405
+ const spacing2 = gearAreaW / (gearNodes.length + 1);
3406
+ const gearR = Math.min(spacing2 * 0.4, gearAreaH * 0.35);
3407
+ const gearDiameter = gearR * 2;
3408
+ const shapes = [];
3409
+ gearNodes.forEach((node, i) => {
3410
+ const gx = bounds.x + spacing2 * (i + 1);
3411
+ const gy = cy + (i % 2 === 0 ? 0 : gearR * 0.35);
3412
+ shapes.push({
3413
+ id: `reflow-gear-${node.id}`,
3414
+ shapeType: "ellipse",
3415
+ x: gx - gearR,
3416
+ y: gy - gearR,
3417
+ width: gearDiameter,
3418
+ height: gearDiameter,
3419
+ text: node.text,
3420
+ fontSize: Math.max(7, Math.min(10, gearR * 0.15))
3421
+ });
3422
+ });
3423
+ const labelH = 20;
3424
+ const labelGap = 6;
3425
+ const labelW = bounds.width - gearAreaW - 16;
3426
+ const labelStartX = bounds.x + gearAreaW + 8;
3427
+ const labelStartY = bounds.y + (bounds.height - extraNodes.length * (labelH + labelGap)) / 2;
3428
+ extraNodes.forEach((node, i) => {
3429
+ shapes.push({
3430
+ id: `reflow-gear-extra-${node.id}`,
3431
+ shapeType: "roundRect",
3432
+ x: labelStartX,
3433
+ y: labelStartY + i * (labelH + labelGap),
3434
+ width: Math.max(labelW, 30),
3435
+ height: labelH,
3436
+ text: node.text,
3437
+ fontSize: Math.max(7, Math.min(10, 10))
3438
+ });
3439
+ });
3440
+ return shapes;
3441
+ }
3442
+ function reflowVenn(nodes, bounds) {
3443
+ const cx = bounds.x + bounds.width / 2;
3444
+ const cy = bounds.y + bounds.height / 2;
3445
+ const size = Math.min(bounds.width, bounds.height);
3446
+ if (nodes.length <= 4) {
3447
+ const r2 = size * 0.22;
3448
+ const spread = r2 * 0.6;
3449
+ return nodes.map((node, i) => {
3450
+ const angle = i / nodes.length * Math.PI * 2 - Math.PI / 2;
3451
+ const nx = cx + spread * Math.cos(angle) - r2;
3452
+ const ny = cy + spread * Math.sin(angle) - r2;
3453
+ return {
3454
+ id: `reflow-venn-${node.id}`,
3455
+ shapeType: "ellipse",
3456
+ x: nx,
3457
+ y: ny,
3458
+ width: r2 * 2,
3459
+ height: r2 * 2,
3460
+ text: node.text,
3461
+ fontSize: Math.max(7, Math.min(10, r2 * 0.1))
3462
+ };
3463
+ });
3464
+ }
3465
+ const r = Math.min(size * 0.15, bounds.width / (nodes.length * 1.5));
3466
+ const totalW = nodes.length * r * 2;
3467
+ const startX = cx - totalW / 2 + r;
3468
+ return nodes.map((node, i) => ({
3469
+ id: `reflow-venn-${node.id}`,
3470
+ shapeType: "ellipse",
3471
+ x: startX + i * r * 2 - r,
3472
+ y: cy - r,
3473
+ width: r * 2,
3474
+ height: r * 2,
3475
+ text: node.text,
3476
+ fontSize: Math.max(6, Math.min(9, r * 0.1))
3477
+ }));
3478
+ }
3479
+
3480
+ // diagram/edit/reflow-stacked.ts
3481
+ function reflowPyramid(nodes, bounds) {
3482
+ const padding = 8;
3483
+ const gap = 4;
3484
+ const usableH = bounds.height - padding * 2;
3485
+ const bandH = (usableH - gap * (nodes.length - 1)) / nodes.length;
3486
+ const maxW = bounds.width - padding * 2;
3487
+ return nodes.map((node, i) => {
3488
+ const widthFraction = 0.3 + i / Math.max(nodes.length - 1, 1) * 0.7;
3489
+ const w = maxW * widthFraction;
3490
+ const x = bounds.x + (bounds.width - w) / 2;
3491
+ const y = bounds.y + padding + i * (bandH + gap);
3492
+ return {
3493
+ id: `reflow-pyramid-${node.id}`,
3494
+ shapeType: "rect",
3495
+ x,
3496
+ y,
3497
+ width: w,
3498
+ height: bandH,
3499
+ text: node.text,
3500
+ fontSize: Math.max(8, Math.min(11, bandH * 0.4))
3501
+ };
3502
+ });
3503
+ }
3504
+ function reflowFunnel(nodes, bounds) {
3505
+ const padding = 8;
3506
+ const gap = 4;
3507
+ const usableH = bounds.height - padding * 2;
3508
+ const bandH = (usableH - gap * (nodes.length - 1)) / nodes.length;
3509
+ const maxW = bounds.width - padding * 2;
3510
+ return nodes.map((node, i) => {
3511
+ const widthFraction = 1 - i / Math.max(nodes.length - 1, 1) * 0.7;
3512
+ const w = maxW * widthFraction;
3513
+ const x = bounds.x + (bounds.width - w) / 2;
3514
+ const y = bounds.y + padding + i * (bandH + gap);
3515
+ return {
3516
+ id: `reflow-funnel-${node.id}`,
3517
+ shapeType: "rect",
3518
+ x,
3519
+ y,
3520
+ width: w,
3521
+ height: bandH,
3522
+ text: node.text,
3523
+ fontSize: Math.max(8, Math.min(11, bandH * 0.4))
3524
+ };
3525
+ });
3526
+ }
3527
+
3528
+ // diagram/edit/reflow-category.ts
3529
+ function resolveDiagramReflowCategory(layoutType) {
3530
+ if (!layoutType) {
3531
+ return "list";
3532
+ }
3533
+ const lower = layoutType.toLowerCase();
3534
+ if (lower.includes("hierarchy") || lower.includes("org")) {
3535
+ return "hierarchy";
3536
+ }
3537
+ if (lower.includes("cycle") || lower.includes("radial")) {
3538
+ return "cycle";
3539
+ }
3540
+ if (lower.includes("funnel")) {
3541
+ return "funnel";
3542
+ }
3543
+ if (lower.includes("target") || lower.includes("bullseye")) {
3544
+ return "target";
3545
+ }
3546
+ if (lower.includes("gear") || lower.includes("interlock")) {
3547
+ return "gear";
3548
+ }
3549
+ if (lower.includes("venn")) {
3550
+ return "venn";
3551
+ }
3552
+ if (lower.includes("timeline")) {
3553
+ return "timeline";
3554
+ }
3555
+ if (lower.includes("bending") || lower.includes("snake") || lower.includes("zigzag")) {
3556
+ return "bending";
3557
+ }
3558
+ if (lower.includes("chevron")) {
3559
+ return "chevron";
3560
+ }
3561
+ if (lower.includes("relationship")) {
3562
+ return "relationship";
3563
+ }
3564
+ if (lower.includes("process") || lower.includes("arrow")) {
3565
+ return "process";
3566
+ }
3567
+ if (lower.includes("matrix")) {
3568
+ return "matrix";
3569
+ }
3570
+ if (lower.includes("pyramid")) {
3571
+ return "pyramid";
3572
+ }
3573
+ if (lower.includes("list") || lower.includes("block")) {
3574
+ return "list";
3575
+ }
3576
+ return "list";
3577
+ }
3578
+
3579
+ // diagram/edit/reflow.ts
3580
+ function diagramContentNodes(nodes) {
3581
+ return nodes.filter((n2) => n2.text.length > 0);
3582
+ }
3583
+ function reflowDiagramLayout(data, bounds) {
3584
+ const nodes = diagramContentNodes(data.nodes);
3585
+ if (nodes.length === 0) {
3586
+ return void 0;
3587
+ }
3588
+ const layoutType = data.resolvedLayoutType ?? resolveDiagramReflowCategory(data.layoutType);
3589
+ switch (layoutType) {
3590
+ case "list":
3591
+ return reflowList(nodes, bounds);
3592
+ case "process":
3593
+ return reflowProcess(nodes, bounds);
3594
+ case "hierarchy":
3595
+ return reflowHierarchy(data.nodes, bounds);
3596
+ case "cycle":
3597
+ return reflowCycle(nodes, bounds);
3598
+ case "matrix":
3599
+ return reflowMatrix(nodes, bounds);
3600
+ case "pyramid":
3601
+ return reflowPyramid(nodes, bounds);
3602
+ case "funnel":
3603
+ return reflowFunnel(nodes, bounds);
3604
+ case "target":
3605
+ return reflowTarget(nodes, bounds);
3606
+ case "gear":
3607
+ return reflowGear(nodes, bounds);
3608
+ case "venn":
3609
+ return reflowVenn(nodes, bounds);
3610
+ case "timeline":
3611
+ return reflowTimeline(nodes, bounds);
3612
+ case "relationship":
3613
+ return reflowRelationship(nodes, bounds);
3614
+ case "chevron":
3615
+ return reflowChevron(nodes, bounds);
3616
+ case "bending":
3617
+ return reflowBending(nodes, bounds);
3618
+ default:
3619
+ return reflowList(nodes, bounds);
3620
+ }
3621
+ }
3622
+ function reflowList(nodes, bounds) {
3623
+ const padding = 8;
3624
+ const gap = 6;
3625
+ const usableW = bounds.width - padding * 2;
3626
+ const usableH = bounds.height - padding * 2;
3627
+ const itemH = (usableH - gap * (nodes.length - 1)) / nodes.length;
3628
+ return nodes.map((node, i) => ({
3629
+ id: `reflow-list-${node.id}`,
3630
+ shapeType: "roundRect",
3631
+ x: bounds.x + padding,
3632
+ y: bounds.y + padding + i * (itemH + gap),
3633
+ width: usableW,
3634
+ height: itemH,
3635
+ text: node.text,
3636
+ fontSize: Math.max(8, Math.min(11, itemH * 0.4))
3637
+ }));
3638
+ }
3639
+ function reflowProcess(nodes, bounds) {
3640
+ const padding = 8;
3641
+ const arrowGap = 16;
3642
+ const usableW = bounds.width - padding * 2;
3643
+ const usableH = bounds.height - padding * 2;
3644
+ const nodeW = (usableW - arrowGap * (nodes.length - 1)) / nodes.length;
3645
+ const nodeH = usableH * 0.6;
3646
+ const yOffset = bounds.y + padding + (usableH - nodeH) / 2;
3647
+ const shapes = [];
3648
+ nodes.forEach((node, i) => {
3649
+ const x = bounds.x + padding + i * (nodeW + arrowGap);
3650
+ shapes.push({
3651
+ id: `reflow-proc-${node.id}`,
3652
+ shapeType: "roundRect",
3653
+ x,
3654
+ y: yOffset,
3655
+ width: nodeW,
3656
+ height: nodeH,
3657
+ text: node.text,
3658
+ fontSize: Math.max(8, Math.min(11, nodeW * 0.12))
3659
+ });
3660
+ if (i < nodes.length - 1) {
3661
+ const arrowX = x + nodeW;
3662
+ const arrowY = yOffset + nodeH / 2 - 6;
3663
+ shapes.push({
3664
+ id: `reflow-proc-arrow-${node.id}`,
3665
+ shapeType: "rightArrow",
3666
+ x: arrowX,
3667
+ y: arrowY,
3668
+ width: arrowGap,
3669
+ height: 12,
3670
+ fillColor: "#94a3b8"
3671
+ });
3672
+ }
3673
+ });
3674
+ return shapes;
3675
+ }
3676
+ function reflowHierarchy(nodes, bounds) {
3677
+ const roots = buildForest(nodes);
3678
+ if (roots.length === 0) {
3679
+ return reflowList(diagramContentNodes(nodes), bounds);
3680
+ }
3681
+ const totalLeaves = roots.reduce((s, r) => s + treeWidth(r), 0);
3682
+ const depth = Math.max(...roots.map(treeDepth));
3683
+ const padding = 8;
3684
+ const usableW = bounds.width - padding * 2;
3685
+ const usableH = bounds.height - padding * 2;
3686
+ const cellW = usableW / Math.max(totalLeaves, 1);
3687
+ const cellH = usableH / Math.max(depth, 1);
3688
+ const boxW = Math.min(cellW * 0.8, 140);
3689
+ const boxH = Math.min(cellH * 0.35, 28);
3690
+ const shapes = [];
3691
+ const MAX_WALK_DEPTH = 256;
3692
+ function walkTree(t, xOffset, level2) {
3693
+ if (level2 >= MAX_WALK_DEPTH) {
3694
+ return 1;
3695
+ }
3696
+ const w = treeWidth(t);
3697
+ const cx = bounds.x + padding + (xOffset + w / 2) * cellW;
3698
+ const cy = bounds.y + padding + level2 * cellH + cellH / 2;
3699
+ shapes.push({
3700
+ id: `reflow-hier-${t.node.id}`,
3701
+ shapeType: "roundRect",
3702
+ x: cx - boxW / 2,
3703
+ y: cy - boxH / 2,
3704
+ width: boxW,
3705
+ height: boxH,
3706
+ text: t.node.text,
3707
+ fontSize: Math.max(7, Math.min(10, boxW / 14))
3708
+ });
3709
+ let childOffset = xOffset;
3710
+ for (const child3 of t.children) {
3711
+ walkTree(child3, childOffset, level2 + 1);
3712
+ childOffset += treeWidth(child3);
3713
+ }
3714
+ return w;
3715
+ }
3716
+ let offset = 0;
3717
+ for (const root of roots) {
3718
+ offset += walkTree(root, offset, 0);
3719
+ }
3720
+ return shapes;
3721
+ }
3722
+
3723
+ // diagram/drawing-from-views.ts
3724
+ var scheme = (value) => ({ kind: "scheme", value, transforms: [] });
3725
+ var srgb = (hex) => ({
3726
+ kind: "srgb",
3727
+ value: hex.replace("#", "").toUpperCase(),
3728
+ transforms: []
3729
+ });
3730
+ function diagramDrawingFromViews(views, options2 = {}) {
3731
+ const emu3 = options2.emuPerUnit ?? 9525;
3732
+ const accents = options2.accents?.length ? options2.accents : ["accent1"];
3733
+ let filled = 0;
3734
+ const shapes = views.map((view) => {
3735
+ const themed = !view.fillColor && !view.fillNone;
3736
+ const fill = view.fillColor ? srgb(view.fillColor) : scheme(accents[filled++ % accents.length]);
3737
+ const text2 = view.text?.trim() ? view.text : "";
3738
+ const textColor = view.fontColor ? srgb(view.fontColor) : scheme(themed ? "lt1" : "tx1");
3739
+ return {
3740
+ modelId: view.id,
3741
+ frame: {
3742
+ x: Math.round(view.x * emu3),
3743
+ y: Math.round(view.y * emu3),
3744
+ width: Math.round(view.width * emu3),
3745
+ height: Math.round(view.height * emu3)
3746
+ },
3747
+ ...view.rotation ? { rotation: view.rotation } : {},
3748
+ geometry: view.shapeType ?? "rect",
3749
+ fill: view.fillNone ? { kind: "none" } : { kind: "solid", color: fill },
3750
+ line: {
3751
+ widthEmu: 12700,
3752
+ fill: { kind: "solid", color: view.strokeColor ? srgb(view.strokeColor) : scheme("lt1") }
3753
+ },
3754
+ ...text2 ? {
3755
+ text: {
3756
+ anchor: "ctr",
3757
+ text: text2,
3758
+ paragraphs: text2.split("\n").map((line2) => ({
3759
+ runs: [
3760
+ {
3761
+ text: line2,
3762
+ sizePt: Math.round((view.fontSize ?? 12) * 0.75 * 10) / 10,
3763
+ color: textColor
3764
+ }
3765
+ ]
3766
+ }))
3767
+ }
3768
+ } : {},
3769
+ has3d: false
3770
+ };
3771
+ });
3772
+ return { shapes, issues: [] };
3773
+ }
3774
+
3775
+ // diagram/approximate.ts
3776
+ var EMU_PER_PX = 9525;
3777
+ var COLORFUL = ["accent1", "accent2", "accent3", "accent4", "accent5", "accent6"];
3778
+ function approximateDiagramDrawingFromNodes(input) {
3779
+ const width = input.extentEmu.width / EMU_PER_PX;
3780
+ const height = input.extentEmu.height / EMU_PER_PX;
3781
+ if (!(width > 0 && height > 0) || input.nodes.length === 0) return void 0;
3782
+ const nodes = input.nodes.map((node) => ({
3783
+ id: node.id,
3784
+ text: node.text || " ",
3785
+ ...node.parentId ? { parentId: node.parentId } : {}
3786
+ }));
3787
+ const views = reflowDiagramLayout(
3788
+ {
3789
+ nodes,
3790
+ ...input.family ? { resolvedLayoutType: input.family } : {},
3791
+ ...input.layoutId ? { layoutType: input.layoutId } : {}
3792
+ },
3793
+ { x: 0, y: 0, width, height }
3794
+ );
3795
+ if (!views?.length) return void 0;
3796
+ return diagramDrawingFromViews(views, {
3797
+ accents: input.colorsId?.includes("colorful") ? COLORFUL : ["accent1"]
3798
+ });
3799
+ }
3800
+
3054
3801
  // chart/regression.ts
3055
3802
  function computeLinearRegression(xVals, yVals) {
3056
3803
  const n2 = xVals.length;
@@ -3573,7 +4320,7 @@ function normalizeLevels(levels, pointCount) {
3573
4320
  });
3574
4321
  }
3575
4322
  function findOrAddParent(children3, label, colorIndex, parentLabelLayout) {
3576
- const existing = children3.find((child) => child.children && child.label === label);
4323
+ const existing = children3.find((child3) => child3.children && child3.label === label);
3577
4324
  if (existing?.children) return existing;
3578
4325
  const parent = { label, weight: 0, children: [], colorIndex, parentLabelLayout };
3579
4326
  children3.push(parent);
@@ -3602,12 +4349,12 @@ function buildSeriesHierarchy(series, seriesIndex, categoryLabels, categoryLevel
3602
4349
  return roots;
3603
4350
  }
3604
4351
  function aggregate(node) {
3605
- if (node.children) node.weight = node.children.reduce((sum, child) => sum + aggregate(child), 0);
4352
+ if (node.children) node.weight = node.children.reduce((sum, child3) => sum + aggregate(child3), 0);
3606
4353
  return node.weight;
3607
4354
  }
3608
4355
  function propagateColor(node, colorIndex) {
3609
4356
  node.colorIndex = colorIndex;
3610
- for (const child of node.children ?? []) propagateColor(child, colorIndex);
4357
+ for (const child3 of node.children ?? []) propagateColor(child3, colorIndex);
3611
4358
  }
3612
4359
  function buildHierarchyRoots(series, categoryLabels, categoryLevels) {
3613
4360
  const colorStride = Math.max(categoryLabels.length, ...series.map((s) => s.values.length), 1);
@@ -4187,9 +4934,9 @@ function chartPaletteSeriesColorChoice(palette, i, n2) {
4187
4934
  transforms: Object.entries(transform).map(([name, value]) => ({ name, value: String(value) }))
4188
4935
  };
4189
4936
  }
4190
- function chartPaletteSeriesColor(palette, i, n2, scheme) {
4937
+ function chartPaletteSeriesColor(palette, i, n2, scheme2) {
4191
4938
  const choice = chartPaletteSeriesColorChoice(palette, i, n2);
4192
- return (resolveDrawingColor(choice, { scheme: (name) => scheme[name] })?.hex ?? scheme[choice.value]).toUpperCase();
4939
+ return (resolveDrawingColor(choice, { scheme: (name) => scheme2[name] })?.hex ?? scheme2[choice.value]).toUpperCase();
4193
4940
  }
4194
4941
 
4195
4942
  // chart/style-definition.ts
@@ -4419,51 +5166,6 @@ function chartCacheValues(cache) {
4419
5166
  }
4420
5167
  var chartSourceValues = (source) => chartCacheValues(source?.cache ?? source?.levels?.[0]);
4421
5168
 
4422
- // drawingml/write-line.ts
4423
- var FILLS = /* @__PURE__ */ new Set(["noFill", "solidFill", "gradFill", "pattFill"]);
4424
- function dropDrawingDeclarations(element2) {
4425
- if (element2.getAttribute("xmlns:a") === NS.a) element2.removeAttribute("xmlns:a");
4426
- for (const child of elements(element2)) dropDrawingDeclarations(child);
4427
- }
4428
- function patchDrawingLine(ln, line2) {
4429
- if (line2.widthEmu === void 0) ln.removeAttribute("w");
4430
- else ln.setAttribute("w", String(Math.round(line2.widthEmu)));
4431
- if (line2.cap === void 0) ln.removeAttribute("cap");
4432
- else ln.setAttribute("cap", line2.cap);
4433
- const fill = line2.fill && drawingFillXml(line2.fill);
4434
- if (fill || !line2.fill) {
4435
- for (const node of elements(ln))
4436
- if (node.namespaceURI === NS.a && FILLS.has(node.localName)) ln.removeChild(node);
4437
- }
4438
- if (fill) {
4439
- const parsed = parseXml(`<w xmlns:a="${NS.a}">${fill}</w>`).documentElement;
4440
- for (const node of elements(parsed).reverse()) {
4441
- const imported = ln.ownerDocument.importNode(node, true);
4442
- dropDrawingDeclarations(imported);
4443
- ln.insertBefore(imported, ln.firstChild);
4444
- }
4445
- }
4446
- const dashes = elements(ln).filter(
4447
- (node) => node.namespaceURI === NS.a && (node.localName === "prstDash" || node.localName === "custDash")
4448
- );
4449
- if (line2.dash === void 0) {
4450
- for (const node of dashes) if (node.localName === "prstDash") ln.removeChild(node);
4451
- return;
4452
- }
4453
- const dash = ln.ownerDocument.createElementNS(NS.a, "a:prstDash");
4454
- dash.setAttribute("val", line2.dash);
4455
- for (const node of dashes) ln.removeChild(node);
4456
- const afterFill = elements(ln).find(
4457
- (node) => node.namespaceURI !== NS.a || !FILLS.has(node.localName)
4458
- );
4459
- ln.insertBefore(dash, afterFill ?? null);
4460
- }
4461
- function drawingLineXml(line2) {
4462
- const doc = parseXml(`<a:ln xmlns:a="${NS.a}"/>`);
4463
- patchDrawingLine(doc.documentElement, line2);
4464
- return buildXml(doc);
4465
- }
4466
-
4467
5169
  // chart/marker-shape.ts
4468
5170
  var CHART_PX_PER_PT = 4 / 3;
4469
5171
  var DEFAULT_MARKER_OUTLINE_PT = 0.75;
@@ -5029,10 +5731,10 @@ function chartAppearance(chart, theme) {
5029
5731
  if (base?.line || direct?.line) entry.line = { ...base?.line, ...direct?.line };
5030
5732
  entries[part] = entry;
5031
5733
  }
5032
- const scheme = chartColorScheme(theme);
5734
+ const scheme2 = chartColorScheme(theme);
5033
5735
  const resolve = (color) => resolveDrawingColor(
5034
5736
  color,
5035
- { scheme: (name) => scheme[name] },
5737
+ { scheme: (name) => scheme2[name] },
5036
5738
  { hslRounding: "halfDown", transformOrder: "document" }
5037
5739
  );
5038
5740
  const out = resolveChartStyleDefinition(
@@ -5044,7 +5746,7 @@ function chartAppearance(chart, theme) {
5044
5746
  if (!entry) continue;
5045
5747
  const family = typeface(entry, theme);
5046
5748
  const shadow = resolveDrawingShadowXml(entry.textEffectsXml, {
5047
- scheme: (name) => scheme[name]
5749
+ scheme: (name) => scheme2[name]
5048
5750
  });
5049
5751
  if (shadow) (out[part] ??= {}).textShadow = shadow;
5050
5752
  if (family) (out[part] ??= {}).typeface = family;
@@ -5826,11 +6528,11 @@ function seriesName(series, index, evaluateRef) {
5826
6528
  return fromRef || series.name || `Series${index + 1}`;
5827
6529
  }
5828
6530
  function seriesContext(chart, theme, options2) {
5829
- const scheme = chartColorScheme(theme);
5830
- const resolver = { scheme: (name) => scheme[name] };
6531
+ const scheme2 = chartColorScheme(theme);
6532
+ const resolver = { scheme: (name) => scheme2[name] };
5831
6533
  return {
5832
6534
  theme,
5833
- scheme,
6535
+ scheme: scheme2,
5834
6536
  palette: chart.colorPalette === void 0 ? void 0 : findChartColorPalette(chart.colorPalette),
5835
6537
  evaluateRef: options2.evaluateRef ?? (() => []),
5836
6538
  seriesColor: options2.seriesColor,
@@ -5842,13 +6544,13 @@ function seriesContext(chart, theme, options2) {
5842
6544
  };
5843
6545
  }
5844
6546
  function seriesView(ctx, s, index, total, categoriesOf) {
5845
- const { theme, scheme, palette, evaluateRef } = ctx;
6547
+ const { theme, scheme: scheme2, palette, evaluateRef } = ctx;
5846
6548
  const values = resolveRef(s.valuesRef, evaluateRef)?.map(toNumber) ?? s.values.map(toNumber);
5847
6549
  categoriesOf(resolveRef(s.categoriesRef, evaluateRef) ?? s.categories);
5848
- const paletteColor = palette && chartPaletteSeriesColor(palette, index, total, scheme);
6550
+ const paletteColor = palette && chartPaletteSeriesColor(palette, index, total, scheme2);
5849
6551
  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);
5850
6552
  const view = { name: seriesName(s, index, evaluateRef), values, color };
5851
- const shadow = resolveDrawingShadowXml(s.effectsXml, { scheme: (name) => scheme[name] });
6553
+ const shadow = resolveDrawingShadowXml(s.effectsXml, { scheme: (name) => scheme2[name] });
5852
6554
  if (shadow) view.shadow = shadow;
5853
6555
  const resolvedGradient = ctx.gradient(s.fill);
5854
6556
  if (resolvedGradient) view.gradient = resolvedGradient;
@@ -5919,7 +6621,7 @@ function hierarchyView(chart, model, evaluateRef) {
5919
6621
  }
5920
6622
 
5921
6623
  // chart/render/chart-view-stock.ts
5922
- var EMU_PER_PX = 9525;
6624
+ var EMU_PER_PX2 = 9525;
5923
6625
  function paintOf(fill, ctx) {
5924
6626
  if (fill?.kind === "none") return "none";
5925
6627
  return fill?.kind === "solid" ? ctx.drawingColor(fill.color) : void 0;
@@ -5928,7 +6630,7 @@ function lineOf(shape, ctx, color) {
5928
6630
  const line2 = shape?.line;
5929
6631
  return {
5930
6632
  color: paintOf(line2?.fill, ctx) ?? color,
5931
- width: line2?.widthEmu === void 0 ? 1 : Math.max(0.5, line2.widthEmu / EMU_PER_PX)
6633
+ width: line2?.widthEmu === void 0 ? 1 : Math.max(0.5, line2.widthEmu / EMU_PER_PX2)
5932
6634
  };
5933
6635
  }
5934
6636
  function barOf(shape, ctx, fallback) {
@@ -6197,7 +6899,7 @@ function chartSummaryView(chart, theme, options2 = {}) {
6197
6899
  const radial = type === "pie" || type === "doughnut";
6198
6900
  const byPoint = radial || type === "treemap" || type === "sunburst";
6199
6901
  const ctx = seriesContext(chart, theme, options2);
6200
- const { palette, scheme, drawingColor } = ctx;
6902
+ const { palette, scheme: scheme2, drawingColor } = ctx;
6201
6903
  const grouping = chart.grouping ?? (type === "bar" || type === "column" ? "clustered" : "standard");
6202
6904
  const rawCategories = [];
6203
6905
  const collect = (cats) => void rawCategories.push(cats);
@@ -6218,7 +6920,7 @@ function chartSummaryView(chart, theme, options2 = {}) {
6218
6920
  series.forEach((s, seriesIndex) => {
6219
6921
  s.pointColors = s.values.map((_, i) => {
6220
6922
  const explicit = drawingColor(chart.series[seriesIndex]?.pointColors?.[i]);
6221
- return explicit ?? (palette ? chartPaletteSeriesColor(palette, i, s.values.length, scheme) : autoSeriesColor(theme, i));
6923
+ return explicit ?? (palette ? chartPaletteSeriesColor(palette, i, s.values.length, scheme2) : autoSeriesColor(theme, i));
6222
6924
  });
6223
6925
  });
6224
6926
  } else
@@ -7411,13 +8113,13 @@ function renderChartSummarySvg(summary, options2) {
7411
8113
  }
7412
8114
 
7413
8115
  // docx/breaks.ts
7414
- function isCachedPageBreak(element2) {
7415
- return named2(element2, "lastRenderedPageBreak") && !element2.childNodes.length && Array.from(element2.attributes).every(
8116
+ function isCachedPageBreak(element3) {
8117
+ return named2(element3, "lastRenderedPageBreak") && !element3.childNodes.length && Array.from(element3.attributes).every(
7416
8118
  (attribute) => attribute.namespaceURI === "http://www.w3.org/2000/xmlns/"
7417
8119
  );
7418
8120
  }
7419
- function hasSpecialBreak(element2) {
7420
- for (const attribute of Array.from(element2.attributes)) {
8121
+ function hasSpecialBreak(element3) {
8122
+ for (const attribute of Array.from(element3.attributes)) {
7421
8123
  if (attribute.namespaceURI === "http://www.w3.org/2000/xmlns/") continue;
7422
8124
  if (attribute.namespaceURI !== WORD_NS) return true;
7423
8125
  if (attribute.localName === "type") {
@@ -7428,14 +8130,14 @@ function hasSpecialBreak(element2) {
7428
8130
  }
7429
8131
  return false;
7430
8132
  }
7431
- function classifyBreak(element2) {
7432
- const type = getW(element2, "type");
8133
+ function classifyBreak(element3) {
8134
+ const type = getW(element3, "type");
7433
8135
  return type === "page" || type === "column" ? type : "textWrapping";
7434
8136
  }
7435
- function isModeledBreak(element2) {
7436
- const kind = classifyBreak(element2);
8137
+ function isModeledBreak(element3) {
8138
+ const kind = classifyBreak(element3);
7437
8139
  if (kind === "textWrapping") return false;
7438
- for (const attribute of Array.from(element2.attributes)) {
8140
+ for (const attribute of Array.from(element3.attributes)) {
7439
8141
  if (attribute.namespaceURI === "http://www.w3.org/2000/xmlns/") continue;
7440
8142
  if (attribute.namespaceURI !== WORD_NS || attribute.localName !== "type") return false;
7441
8143
  }
@@ -7451,13 +8153,13 @@ var add2 = (parent, ...items) => {
7451
8153
  };
7452
8154
  var emu2 = (px) => String(Math.max(1, Math.round(px * EMU_PER_PIXEL)));
7453
8155
  var emuOffset = (px) => String(Math.round(px * EMU_PER_PIXEL));
7454
- var attrs = (element2, values) => {
7455
- for (const [name, value] of Object.entries(values)) element2.setAttribute(name, value);
7456
- return element2;
8156
+ var attrs = (element3, values) => {
8157
+ for (const [name, value] of Object.entries(values)) element3.setAttribute(name, value);
8158
+ return element3;
7457
8159
  };
7458
- function dropDeclarations(element2) {
7459
- if (element2.getAttribute("xmlns:a") === A_NS2) element2.removeAttribute("xmlns:a");
7460
- for (const node of Array.from(element2.childNodes))
8160
+ function dropDeclarations(element3) {
8161
+ if (element3.getAttribute("xmlns:a") === A_NS2) element3.removeAttribute("xmlns:a");
8162
+ for (const node of Array.from(element3.childNodes))
7461
8163
  if (node.nodeType === 1) dropDeclarations(node);
7462
8164
  }
7463
8165
  function importFragment(doc, xml) {
@@ -7468,11 +8170,11 @@ function importFragment(doc, xml) {
7468
8170
  return imported;
7469
8171
  });
7470
8172
  }
7471
- var srgb = (fill) => fill?.kind === "solid" && fill.color.kind === "srgb" ? fill.color.value : void 0;
8173
+ var srgb2 = (fill) => fill?.kind === "solid" && fill.color.kind === "srgb" ? fill.color.value : void 0;
7472
8174
  function explicitTextColor(spec) {
7473
8175
  if (!spec.fill) return void 0;
7474
8176
  if (spec.fill.kind === "none") return "000000";
7475
- const hex = srgb(spec.fill);
8177
+ const hex = srgb2(spec.fill);
7476
8178
  if (!hex || !/^[0-9a-f]{6}$/i.test(hex)) return void 0;
7477
8179
  const channel = (i) => Number.parseInt(hex.slice(i, i + 2), 16) / 255;
7478
8180
  const light = 0.2126 * channel(0) + 0.7152 * channel(2) + 0.0722 * channel(4) > 0.6;
@@ -7503,9 +8205,9 @@ function textParagraphs(doc, lines, color) {
7503
8205
  });
7504
8206
  }
7505
8207
  function shapeStyle(doc) {
7506
- const ref = (name, idx, scheme, shade) => {
8208
+ const ref = (name, idx, scheme2, shade) => {
7507
8209
  const node = attrs(el2(doc, A_NS2, `a:${name}`), { idx });
7508
- const color = attrs(el2(doc, A_NS2, "a:schemeClr"), { val: scheme });
8210
+ const color = attrs(el2(doc, A_NS2, "a:schemeClr"), { val: scheme2 });
7509
8211
  if (shade) add2(color, attrs(el2(doc, A_NS2, "a:shade"), { val: shade }));
7510
8212
  return add2(node, color);
7511
8213
  };
@@ -7696,43 +8398,15 @@ function rebuildShapeDrawing(doc, image, old) {
7696
8398
  return next;
7697
8399
  }
7698
8400
 
7699
- // docx/write-drawing.ts
8401
+ // docx/write-drawing-patch.ts
7700
8402
  var A_NS3 = "http://schemas.openxmlformats.org/drawingml/2006/main";
7701
8403
  var WP_NS3 = "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing";
7702
- function alternateContentDrawing(content) {
7703
- const choice = Array.from(content.childNodes).filter(isElement).find((node) => node.localName === "Choice");
7704
- return choice && findDrawingChild(choice);
7705
- }
7706
- function drawingContainer(run) {
7707
- if (!run) return void 0;
7708
- for (const child of Array.from(run.childNodes))
7709
- if (isElement(child) && (named2(child, "drawing") || named2(child, "pict"))) return child;
7710
- for (const child of Array.from(run.childNodes))
7711
- if (isElement(child) && child.localName === "AlternateContent" && alternateContentDrawing(child))
7712
- return child;
7713
- return void 0;
7714
- }
7715
- function findDrawingChild(run) {
7716
- if (!run) return void 0;
7717
- for (const child of Array.from(run.childNodes)) {
7718
- if (!isElement(child)) continue;
7719
- if (named2(child, "drawing") || named2(child, "pict")) return child;
7720
- if (child.localName === "AlternateContent") {
7721
- const inner = alternateContentDrawing(child);
7722
- if (inner) return inner;
7723
- }
7724
- }
7725
- return void 0;
7726
- }
7727
- function sameUnderlyingImage(a, b) {
7728
- return Boolean(a.partName) && a.relId === b.relId && a.partName === b.partName;
7729
- }
7730
8404
  function walk(root, visit) {
7731
8405
  const stack = [root];
7732
8406
  while (stack.length) {
7733
8407
  const node = stack.shift();
7734
8408
  visit(node);
7735
- for (const child of Array.from(node.childNodes)) if (isElement(child)) stack.push(child);
8409
+ for (const child3 of Array.from(node.childNodes)) if (isElement(child3)) stack.push(child3);
7736
8410
  }
7737
8411
  }
7738
8412
  function updateExtent(drawing, widthPx, heightPx) {
@@ -7759,11 +8433,11 @@ function updateDocPr(drawing, altText, title) {
7759
8433
  }
7760
8434
  function patchPosition(doc, anchor, name, relativeFrom, align, offsetPx) {
7761
8435
  const position2 = Array.from(anchor.childNodes).find(
7762
- (child) => isElement(child) && child.namespaceURI === WP_NS3 && child.localName === name
8436
+ (child3) => isElement(child3) && child3.namespaceURI === WP_NS3 && child3.localName === name
7763
8437
  );
7764
8438
  if (!position2) return;
7765
8439
  if (relativeFrom) position2.setAttribute("relativeFrom", relativeFrom);
7766
- for (const child of Array.from(position2.childNodes)) position2.removeChild(child);
8440
+ for (const child3 of Array.from(position2.childNodes)) position2.removeChild(child3);
7767
8441
  const value = align ? makeNS(doc, WP_NS3, "wp:align") : makeNS(doc, WP_NS3, "wp:posOffset");
7768
8442
  value.appendChild(
7769
8443
  doc.createTextNode(align ?? String(Math.round((offsetPx ?? 0) * EMU_PER_PIXEL)))
@@ -7792,10 +8466,79 @@ function updatePlacement(drawing, doc, placement) {
7792
8466
  });
7793
8467
  }
7794
8468
  function clearNonProperties(node, keep) {
7795
- for (const child of Array.from(node.childNodes)) {
7796
- if (isElement(child) && (named2(child, "rPr") || child === keep)) continue;
7797
- node.removeChild(child);
8469
+ for (const child3 of Array.from(node.childNodes)) {
8470
+ if (isElement(child3) && (named2(child3, "rPr") || child3 === keep)) continue;
8471
+ node.removeChild(child3);
8472
+ }
8473
+ }
8474
+ function chartRun(doc, node, image, base, oldDrawing, oldContainer, allocator) {
8475
+ if (base?.chart && oldDrawing && image.chart?.partName && image.chart.partName === base.chart.partName && image.chart.relId === base.chart.relId) {
8476
+ if (image.widthPx !== base.widthPx || image.heightPx !== base.heightPx)
8477
+ updateExtent(oldDrawing, image.widthPx, image.heightPx);
8478
+ clearNonProperties(node, oldContainer);
8479
+ return node;
8480
+ }
8481
+ if (!base && image.chart?.chartSpace && !image.chart.relId && !image.chart.partName) {
8482
+ throw new Error("Cannot insert a chart without a relationship allocator.");
8483
+ }
8484
+ return void 0;
8485
+ }
8486
+
8487
+ // docx/chart-edit.ts
8488
+ function isDocxChartEditable(chart) {
8489
+ return Boolean(chart?.chartSpace) && !chart?.layoutId && !chart?.chartEx;
8490
+ }
8491
+ var WP_NS5 = "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing";
8492
+ var EMU_PER_PIXEL2 = 9525;
8493
+ function isSameDiagram(base, next) {
8494
+ return Boolean(base?.parts.data?.partName) && base?.parts.data?.partName === next.parts.data?.partName && !next.inserted;
8495
+ }
8496
+ function patchDiagramExtent(drawing, widthPx, heightPx) {
8497
+ const extent = drawing.getElementsByTagNameNS(WP_NS5, "extent")[0];
8498
+ if (!extent) return;
8499
+ extent.setAttribute("cx", String(Math.max(1, Math.round(widthPx * EMU_PER_PIXEL2))));
8500
+ extent.setAttribute("cy", String(Math.max(1, Math.round(heightPx * EMU_PER_PIXEL2))));
8501
+ }
8502
+ function diagramRun(doc, node, image, base, oldDrawing, oldContainer, allocator) {
8503
+ if (!image.diagram) return void 0;
8504
+ if (base?.diagram && oldDrawing && isSameDiagram(base.diagram, image.diagram)) {
8505
+ if (image.widthPx !== base.widthPx || image.heightPx !== base.heightPx)
8506
+ patchDiagramExtent(oldDrawing, image.widthPx, image.heightPx);
8507
+ clearNonProperties(node, oldContainer);
8508
+ return node;
8509
+ }
8510
+ if (!base && image.diagram.inserted) {
8511
+ throw new Error("Cannot insert SmartArt without a relationship allocator.");
8512
+ }
8513
+ return void 0;
8514
+ }
8515
+ function alternateContentDrawing(content) {
8516
+ const choice = Array.from(content.childNodes).filter(isElement).find((node) => node.localName === "Choice");
8517
+ return choice && findDrawingChild(choice);
8518
+ }
8519
+ function drawingContainer(run) {
8520
+ if (!run) return void 0;
8521
+ for (const child3 of Array.from(run.childNodes))
8522
+ if (isElement(child3) && (named2(child3, "drawing") || named2(child3, "pict"))) return child3;
8523
+ for (const child3 of Array.from(run.childNodes))
8524
+ if (isElement(child3) && child3.localName === "AlternateContent" && alternateContentDrawing(child3))
8525
+ return child3;
8526
+ return void 0;
8527
+ }
8528
+ function findDrawingChild(run) {
8529
+ if (!run) return void 0;
8530
+ for (const child3 of Array.from(run.childNodes)) {
8531
+ if (!isElement(child3)) continue;
8532
+ if (named2(child3, "drawing") || named2(child3, "pict")) return child3;
8533
+ if (child3.localName === "AlternateContent") {
8534
+ const inner = alternateContentDrawing(child3);
8535
+ if (inner) return inner;
8536
+ }
7798
8537
  }
8538
+ return void 0;
8539
+ }
8540
+ function sameUnderlyingImage(a, b) {
8541
+ return Boolean(a.partName) && a.relId === b.relId && a.partName === b.partName;
7799
8542
  }
7800
8543
  function createImageRun(doc, image, base, old, allocator) {
7801
8544
  const node = old ?? makeW(doc, "r");
@@ -7810,6 +8553,10 @@ function createImageRun(doc, image, base, old, allocator) {
7810
8553
  clearNonProperties(node, oldContainer);
7811
8554
  return node;
7812
8555
  }
8556
+ const diagram = diagramRun(doc, node, image, base, oldDrawing, oldContainer);
8557
+ if (diagram) return diagram;
8558
+ const chart = chartRun(doc, node, image, base, oldDrawing, oldContainer);
8559
+ if (chart) return chart;
7813
8560
  if (base && oldDrawing && image.unsupported && JSON.stringify(image) === JSON.stringify(base)) {
7814
8561
  clearNonProperties(node, oldContainer);
7815
8562
  return node;
@@ -7861,24 +8608,24 @@ var COMMENT_ANCHOR_NAMES = [
7861
8608
  "moveToRangeStart",
7862
8609
  "moveToRangeEnd"
7863
8610
  ];
7864
- function isWordElement(element2, names) {
7865
- return (!element2.namespaceURI || element2.namespaceURI === WORD_NS) && names.includes(element2.localName);
8611
+ function isWordElement(element3, names) {
8612
+ return (!element3.namespaceURI || element3.namespaceURI === WORD_NS) && names.includes(element3.localName);
7866
8613
  }
7867
- var isRevisionWrapperElement = (element2) => isWordElement(element2, REVISION_WRAPPER_NAMES);
7868
- var isCommentAnchorElement = (element2) => isWordElement(element2, COMMENT_ANCHOR_NAMES);
7869
- function setAttribute2(element2, local, value) {
7870
- element2.setAttributeNS(WORD_NS, `w:${local}`, value);
8614
+ var isRevisionWrapperElement = (element3) => isWordElement(element3, REVISION_WRAPPER_NAMES);
8615
+ var isCommentAnchorElement = (element3) => isWordElement(element3, COMMENT_ANCHOR_NAMES);
8616
+ function setAttribute2(element3, local, value) {
8617
+ element3.setAttributeNS(WORD_NS, `w:${local}`, value);
7871
8618
  }
7872
- function removeChildren2(element2, local) {
7873
- for (const child of children2(element2, local)) element2.removeChild(child);
8619
+ function removeChildren2(element3, local) {
8620
+ for (const child3 of children2(element3, local)) element3.removeChild(child3);
7874
8621
  }
7875
- function writeRevisionMetadata(element2, revision) {
7876
- setAttribute2(element2, "id", revision.id);
7877
- setAttribute2(element2, "author", revision.author);
7878
- if (revision.date) setAttribute2(element2, "date", revision.date);
7879
- else element2.removeAttributeNS(WORD_NS, "date");
7880
- if (revision.dateUtc) element2.setAttributeNS(WORD_DATE_UTC_NS, "w16du:dateUtc", revision.dateUtc);
7881
- else element2.removeAttributeNS(WORD_DATE_UTC_NS, "dateUtc");
8622
+ function writeRevisionMetadata(element3, revision) {
8623
+ setAttribute2(element3, "id", revision.id);
8624
+ setAttribute2(element3, "author", revision.author);
8625
+ if (revision.date) setAttribute2(element3, "date", revision.date);
8626
+ else element3.removeAttributeNS(WORD_NS, "date");
8627
+ if (revision.dateUtc) element3.setAttributeNS(WORD_DATE_UTC_NS, "w16du:dateUtc", revision.dateUtc);
8628
+ else element3.removeAttributeNS(WORD_DATE_UTC_NS, "dateUtc");
7882
8629
  }
7883
8630
  function revisionTag(kind) {
7884
8631
  return kind === "delete" ? "del" : kind === "moveFrom" ? "moveFrom" : kind === "moveTo" ? "moveTo" : "ins";
@@ -7938,9 +8685,9 @@ function writeParagraphMarkRevision(doc, pPr, paragraph, base) {
7938
8685
  pPr.appendChild(rPr);
7939
8686
  }
7940
8687
  const revision = paragraph.markRevision;
7941
- const element2 = makeW(doc, revision.kind === "delete" ? "del" : "ins");
7942
- writeRevisionMetadata(element2, revision);
7943
- rPr.insertBefore(element2, rPr.firstChild);
8688
+ const element3 = makeW(doc, revision.kind === "delete" ? "del" : "ins");
8689
+ writeRevisionMetadata(element3, revision);
8690
+ rPr.insertBefore(element3, rPr.firstChild);
7944
8691
  }
7945
8692
 
7946
8693
  // docx/highlight.ts
@@ -8038,8 +8785,8 @@ var allowedRunPropertyAttributes = {
8038
8785
  color: ["val", "themeColor", "themeTint", "themeShade"],
8039
8786
  shd: ["val", "fill", "color", "themeFill", "themeFillTint", "themeFillShade"]
8040
8787
  };
8041
- function hasUnexpectedAttributes(element2, allowed, allowDateUtc = false) {
8042
- for (const attribute of Array.from(element2.attributes)) {
8788
+ function hasUnexpectedAttributes(element3, allowed, allowDateUtc = false) {
8789
+ for (const attribute of Array.from(element3.attributes)) {
8043
8790
  if (attribute.namespaceURI === "http://www.w3.org/2000/xmlns/") continue;
8044
8791
  if (allowDateUtc && attribute.namespaceURI === WORD_DATE_UTC_NS && attribute.localName === "dateUtc")
8045
8792
  continue;
@@ -8058,7 +8805,7 @@ function runPropertiesHaveUnknownContent(properties4) {
8058
8805
  const property = node;
8059
8806
  if (property.namespaceURI === WORD_NS && property.localName === "rPrChange") {
8060
8807
  if (hasUnexpectedAttributes(property, ["id", "author", "date"], true) || Array.from(property.childNodes).some(
8061
- (child) => child.nodeType === 3 && child.textContent?.trim()
8808
+ (child3) => child3.nodeType === 3 && child3.textContent?.trim()
8062
8809
  ) || elements(property).length !== 1 || !first2(property, "rPr") || !getW(property, "id") || !getW(property, "author"))
8063
8810
  return true;
8064
8811
  continue;
@@ -8133,13 +8880,13 @@ function restoreRunFormatting(run) {
8133
8880
  }
8134
8881
 
8135
8882
  // docx/field-flags.ts
8136
- function writeFieldFlags(element2, flags) {
8883
+ function writeFieldFlags(element3, flags) {
8137
8884
  for (const [name, value] of [
8138
8885
  ["fldLock", flags?.locked],
8139
8886
  ["dirty", flags?.dirty]
8140
8887
  ]) {
8141
- if (value === void 0) element2.removeAttributeNS(WORD_NS, name);
8142
- else element2.setAttributeNS(WORD_NS, `w:${name}`, value ? "true" : "false");
8888
+ if (value === void 0) element3.removeAttributeNS(WORD_NS, name);
8889
+ else element3.setAttributeNS(WORD_NS, `w:${name}`, value ? "true" : "false");
8143
8890
  }
8144
8891
  }
8145
8892
 
@@ -8154,16 +8901,16 @@ function symbolCharacter(char) {
8154
8901
  var isSymbolFontCharacter = (character) => /^[\uF000-\uF0FF]$/.test(character);
8155
8902
  function runSymbol(content) {
8156
8903
  let found;
8157
- for (const child of content) {
8158
- if (!named2(child, "sym")) continue;
8159
- const symbol = { font: getW(child, "font") ?? "", char: getW(child, "char") ?? "" };
8904
+ for (const child3 of content) {
8905
+ if (!named2(child3, "sym")) continue;
8906
+ const symbol = { font: getW(child3, "font") ?? "", char: getW(child3, "char") ?? "" };
8160
8907
  if (!isSymbolFontCharacter(symbolCharacter(symbol.char))) return null;
8161
8908
  if (found && (found.font !== symbol.font || found.char !== symbol.char)) return null;
8162
8909
  found = symbol;
8163
8910
  }
8164
8911
  const character = found && symbolCharacter(found.char);
8165
8912
  if (character && content.some(
8166
- (child) => (named2(child, "t") || named2(child, "delText")) && child.textContent?.includes(character)
8913
+ (child3) => (named2(child3, "t") || named2(child3, "delText")) && child3.textContent?.includes(character)
8167
8914
  ))
8168
8915
  return null;
8169
8916
  return found;
@@ -8171,12 +8918,12 @@ function runSymbol(content) {
8171
8918
  function runPositionalTab(content) {
8172
8919
  let found;
8173
8920
  let ordinary = false;
8174
- for (const child of content) {
8175
- if (named2(child, "tab")) ordinary = true;
8176
- if (!named2(child, "ptab")) continue;
8177
- const alignment = getW(child, "alignment");
8178
- const relativeTo = getW(child, "relativeTo");
8179
- const leader = getW(child, "leader");
8921
+ for (const child3 of content) {
8922
+ if (named2(child3, "tab")) ordinary = true;
8923
+ if (!named2(child3, "ptab")) continue;
8924
+ const alignment = getW(child3, "alignment");
8925
+ const relativeTo = getW(child3, "relativeTo");
8926
+ const leader = getW(child3, "leader");
8180
8927
  if (!isStPTabAlignment(alignment) || !isStPTabRelativeTo(relativeTo) || leader !== void 0 && !isStPTabLeader(leader))
8181
8928
  return null;
8182
8929
  const tab = { alignment, relativeTo, ...leader !== void 0 && { leader } };
@@ -8185,7 +8932,7 @@ function runPositionalTab(content) {
8185
8932
  }
8186
8933
  return found && ordinary ? null : found;
8187
8934
  }
8188
- function element(doc, local, attributes) {
8935
+ function element2(doc, local, attributes) {
8189
8936
  const node = makeW(doc, local);
8190
8937
  for (const [name, value] of Object.entries(attributes))
8191
8938
  if (value !== void 0) node.setAttributeNS(node.namespaceURI, `w:${name}`, value);
@@ -8194,40 +8941,40 @@ function element(doc, local, attributes) {
8194
8941
  function specialCharacterElement(doc, run, character) {
8195
8942
  if (character === " " && run.positionalTab) {
8196
8943
  const { relativeTo, alignment, leader } = run.positionalTab;
8197
- return element(doc, "ptab", { relativeTo, alignment, leader });
8944
+ return element2(doc, "ptab", { relativeTo, alignment, leader });
8198
8945
  }
8199
8946
  if (character === SOFT_HYPHEN) return makeW(doc, "softHyphen");
8200
8947
  if (character === NON_BREAKING_HYPHEN) return makeW(doc, "noBreakHyphen");
8201
8948
  if (run.symbol && character === symbolCharacter(run.symbol.char))
8202
- return element(doc, "sym", { font: run.symbol.font, char: run.symbol.char });
8949
+ return element2(doc, "sym", { font: run.symbol.font, char: run.symbol.char });
8203
8950
  return void 0;
8204
8951
  }
8205
8952
 
8206
8953
  // docx/write-run.ts
8207
- function setAttribute3(element2, local, value) {
8208
- element2.setAttributeNS(WORD_NS, `w:${local}`, value);
8954
+ function setAttribute3(element3, local, value) {
8955
+ element3.setAttributeNS(WORD_NS, `w:${local}`, value);
8209
8956
  }
8210
- function removeChildren3(element2, local) {
8211
- for (const child of children2(element2, local)) element2.removeChild(child);
8957
+ function removeChildren3(element3, local) {
8958
+ for (const child3 of children2(element3, local)) element3.removeChild(child3);
8212
8959
  }
8213
8960
  function setToggle2(doc, props, local, value) {
8214
8961
  removeChildren3(props, local);
8215
8962
  if (value === void 0) return;
8216
- const element2 = makeW(doc, local);
8217
- if (!value) setAttribute3(element2, "val", "0");
8218
- props.appendChild(element2);
8963
+ const element3 = makeW(doc, local);
8964
+ if (!value) setAttribute3(element3, "val", "0");
8965
+ props.appendChild(element3);
8219
8966
  }
8220
8967
  function setBooleanAttribute(doc, props, local, value) {
8221
- let element2 = first2(props, local);
8968
+ let element3 = first2(props, local);
8222
8969
  if (value === void 0) {
8223
8970
  removeChildren3(props, local);
8224
8971
  return;
8225
8972
  }
8226
- if (!element2) {
8227
- element2 = makeW(doc, local);
8228
- props.appendChild(element2);
8973
+ if (!element3) {
8974
+ element3 = makeW(doc, local);
8975
+ props.appendChild(element3);
8229
8976
  }
8230
- setAttribute3(element2, "val", value ? "1" : "0");
8977
+ setAttribute3(element3, "val", value ? "1" : "0");
8231
8978
  }
8232
8979
  function setLanguageAttribute(doc, props, attribute, value) {
8233
8980
  let language = first2(props, "lang");
@@ -8401,8 +9148,8 @@ function createRun(doc, run, base, old, allocator) {
8401
9148
  setRunProperties(doc, node, run, base);
8402
9149
  if (run.image) return node;
8403
9150
  const formData = run.formField ? first2(first2(node, "fldChar"), "ffData") : void 0;
8404
- for (const child of Array.from(node.childNodes))
8405
- if (child.nodeType !== 1 || child.localName !== "rPr") node.removeChild(child);
9151
+ for (const child3 of Array.from(node.childNodes))
9152
+ if (child3.nodeType !== 1 || child3.localName !== "rPr") node.removeChild(child3);
8406
9153
  if (run.break) {
8407
9154
  const br = makeW(doc, "br");
8408
9155
  setAttribute3(br, "type", run.break);
@@ -8460,21 +9207,21 @@ function createRun(doc, run, base, old, allocator) {
8460
9207
  // docx/character-styles.ts
8461
9208
  function styleElements(document) {
8462
9209
  return Array.from(document.getElementsByTagName("*")).filter(
8463
- (element2) => named2(element2, "style") && (getW(element2, "type") === "character" || getW(element2, "type") === "paragraph")
9210
+ (element3) => named2(element3, "style") && (getW(element3, "type") === "character" || getW(element3, "type") === "paragraph")
8464
9211
  );
8465
9212
  }
8466
9213
  function parseRunStyleCatalog(xml) {
8467
9214
  const document = parseXml2(xml);
8468
9215
  const defaults = first2(first2(document.documentElement, "docDefaults"), "rPrDefault");
8469
9216
  const styles = /* @__PURE__ */ Object.create(null);
8470
- for (const element2 of styleElements(document)) {
8471
- const id = getW(element2, "styleId");
9217
+ for (const element3 of styleElements(document)) {
9218
+ const id = getW(element3, "styleId");
8472
9219
  if (!id) continue;
8473
- const type = getW(element2, "type") === "character" ? "character" : "paragraph";
8474
- const basedOn = getW(first2(element2, "basedOn"), "val");
8475
- const linkedStyle = getW(first2(element2, "link"), "val");
8476
- const isDefault = parseOnOff(getW(element2, "default"));
8477
- const name = getW(first2(element2, "name"), "val");
9220
+ const type = getW(element3, "type") === "character" ? "character" : "paragraph";
9221
+ const basedOn = getW(first2(element3, "basedOn"), "val");
9222
+ const linkedStyle = getW(first2(element3, "link"), "val");
9223
+ const isDefault = parseOnOff(getW(element3, "default"));
9224
+ const name = getW(first2(element3, "name"), "val");
8478
9225
  styles[id] = {
8479
9226
  id,
8480
9227
  type,
@@ -8482,7 +9229,7 @@ function parseRunStyleCatalog(xml) {
8482
9229
  ...basedOn ? { basedOn } : {},
8483
9230
  ...linkedStyle ? { linkedStyle } : {},
8484
9231
  ...isDefault === void 0 ? {} : { isDefault },
8485
- formatting: parseRunProperties(first2(element2, "rPr"))
9232
+ formatting: parseRunProperties(first2(element3, "rPr"))
8486
9233
  };
8487
9234
  }
8488
9235
  const warnings = [];
@@ -8516,12 +9263,12 @@ var SIDES = [
8516
9263
  "insideH",
8517
9264
  "insideV"
8518
9265
  ];
8519
- function borderSide(element2) {
8520
- if (!element2) return void 0;
8521
- const style = enumValue(isStBorder, getW(element2, "val"));
8522
- const size = parseEighthPoints(getW(element2, "sz"));
8523
- const color = parseRgbColor(getW(element2, "color"));
8524
- const themeColor2 = enumValue(isStThemeColor, getW(element2, "themeColor"));
9266
+ function borderSide(element3) {
9267
+ if (!element3) return void 0;
9268
+ const style = enumValue(isStBorder, getW(element3, "val"));
9269
+ const size = parseEighthPoints(getW(element3, "sz"));
9270
+ const color = parseRgbColor(getW(element3, "color"));
9271
+ const themeColor2 = enumValue(isStThemeColor, getW(element3, "themeColor"));
8525
9272
  if (!style && size === void 0 && !color && !themeColor2) return void 0;
8526
9273
  const side = {};
8527
9274
  if (style) side.style = style;
@@ -8560,10 +9307,10 @@ function parseParagraphBorders(pBdr) {
8560
9307
  if (!pBdr) return void 0;
8561
9308
  const result = {};
8562
9309
  for (const side of ["top", "bottom", "left", "right", "between"]) {
8563
- const element2 = first2(pBdr, side) ?? (side === "left" ? first2(pBdr, "start") : side === "right" ? first2(pBdr, "end") : void 0);
8564
- const value = borderSide(element2);
9310
+ const element3 = first2(pBdr, side) ?? (side === "left" ? first2(pBdr, "start") : side === "right" ? first2(pBdr, "end") : void 0);
9311
+ const value = borderSide(element3);
8565
9312
  if (!value) continue;
8566
- const space = parseUnsignedInteger(getW(element2, "space"));
9313
+ const space = parseUnsignedInteger(getW(element3, "space"));
8567
9314
  if (space !== void 0) value.spacePoints = space;
8568
9315
  result[side] = value;
8569
9316
  }
@@ -8616,8 +9363,8 @@ var PAGINATION_KEYS = [
8616
9363
  "contextualSpacing",
8617
9364
  "suppressLineNumbers"
8618
9365
  ];
8619
- function parseOutlineLevel(element2) {
8620
- const raw = getW(element2, "val");
9366
+ function parseOutlineLevel(element3) {
9367
+ const raw = getW(element3, "val");
8621
9368
  if (raw === void 0) return void 0;
8622
9369
  const value = Number(raw);
8623
9370
  if (!Number.isInteger(value) || value < 0 || value > 9) return void 0;
@@ -8680,7 +9427,7 @@ function parseStyleNumbering(pPr) {
8680
9427
  }
8681
9428
  function styleElements2(document) {
8682
9429
  return Array.from(document.getElementsByTagName("*")).filter(
8683
- (element2) => named2(element2, "style") && getW(element2, "type") === "paragraph"
9430
+ (element3) => named2(element3, "style") && getW(element3, "type") === "paragraph"
8684
9431
  );
8685
9432
  }
8686
9433
  function parseParagraphStyleCatalog(xml) {
@@ -8688,20 +9435,20 @@ function parseParagraphStyleCatalog(xml) {
8688
9435
  const defaults = first2(first2(document.documentElement, "docDefaults"), "pPrDefault");
8689
9436
  const pDefaults = first2(defaults, "pPr");
8690
9437
  const styles = /* @__PURE__ */ Object.create(null);
8691
- for (const element2 of styleElements2(document)) {
8692
- const id = getW(element2, "styleId");
9438
+ for (const element3 of styleElements2(document)) {
9439
+ const id = getW(element3, "styleId");
8693
9440
  if (!id) continue;
8694
- const basedOn = getW(first2(element2, "basedOn"), "val");
8695
- const isDefault = parseOnOff(getW(element2, "default"));
8696
- const name = getW(first2(element2, "name"), "val");
8697
- const numbering = parseStyleNumbering(first2(element2, "pPr"));
9441
+ const basedOn = getW(first2(element3, "basedOn"), "val");
9442
+ const isDefault = parseOnOff(getW(element3, "default"));
9443
+ const name = getW(first2(element3, "name"), "val");
9444
+ const numbering = parseStyleNumbering(first2(element3, "pPr"));
8698
9445
  styles[id] = {
8699
9446
  id,
8700
9447
  ...name ? { name } : {},
8701
9448
  ...basedOn ? { basedOn } : {},
8702
9449
  ...isDefault === void 0 ? {} : { isDefault },
8703
9450
  ...numbering ? { numbering } : {},
8704
- formatting: parseFormatting(first2(element2, "pPr"))
9451
+ formatting: parseFormatting(first2(element3, "pPr"))
8705
9452
  };
8706
9453
  }
8707
9454
  const warnings = [];
@@ -8749,7 +9496,7 @@ var REGIONS = [
8749
9496
  ];
8750
9497
  function tableStyleElements(document) {
8751
9498
  return Array.from(document.getElementsByTagName("*")).filter(
8752
- (element2) => named2(element2, "style") && getW(element2, "type") === "table"
9499
+ (element3) => named2(element3, "style") && getW(element3, "type") === "table"
8753
9500
  );
8754
9501
  }
8755
9502
  function conditionalFormatting(block) {
@@ -8769,17 +9516,17 @@ function conditionalFormatting(block) {
8769
9516
  function parseTableStyleCatalog(xml) {
8770
9517
  const document = parseXml2(xml);
8771
9518
  const styles = /* @__PURE__ */ Object.create(null);
8772
- for (const element2 of tableStyleElements(document)) {
8773
- const id = getW(element2, "styleId");
9519
+ for (const element3 of tableStyleElements(document)) {
9520
+ const id = getW(element3, "styleId");
8774
9521
  if (!id) continue;
8775
- const basedOn = getW(first2(element2, "basedOn"), "val");
8776
- const isDefault = parseOnOff(getW(element2, "default"));
8777
- const name = getW(first2(element2, "name"), "val");
8778
- const tblPr = first2(element2, "tblPr");
9522
+ const basedOn = getW(first2(element3, "basedOn"), "val");
9523
+ const isDefault = parseOnOff(getW(element3, "default"));
9524
+ const name = getW(first2(element3, "name"), "val");
9525
+ const tblPr = first2(element3, "tblPr");
8779
9526
  const borders = parseTableBorders(first2(tblPr, "tblBorders"));
8780
9527
  const shadingFill = parseShadingFill(first2(tblPr, "shd"));
8781
9528
  const conditional = {};
8782
- for (const block of children2(element2, "tblStylePr")) {
9529
+ for (const block of children2(element3, "tblStylePr")) {
8783
9530
  const type = getW(block, "type");
8784
9531
  if (type && REGIONS.includes(type))
8785
9532
  conditional[type] = conditionalFormatting(block);
@@ -8892,7 +9639,7 @@ function resolveTableStyleFormatting(tableStyleId, catalog, look, rowIndex, rowC
8892
9639
  // docx/content-control.ts
8893
9640
  var WORD_2012_NS = "http://schemas.microsoft.com/office/word/2012/wordml";
8894
9641
  var sdtContent = (sdt) => first2(sdt, "sdtContent");
8895
- var isSdt = (element2) => named2(element2, "sdt");
9642
+ var isSdt = (element3) => named2(element3, "sdt");
8896
9643
  var TYPE_ELEMENTS = {
8897
9644
  text: "text",
8898
9645
  dropDownList: "dropDownList",
@@ -8906,25 +9653,25 @@ var TYPE_ELEMENTS = {
8906
9653
  docPartObj: "docPartObj",
8907
9654
  docPartList: "docPartList"
8908
9655
  };
8909
- function attrW14(element2, local) {
8910
- return element2?.getAttributeNS(WORD_2010_NS, local) ?? void 0;
9656
+ function attrW14(element3, local) {
9657
+ return element3?.getAttributeNS(WORD_2010_NS, local) ?? void 0;
8911
9658
  }
8912
- function glyph(element2) {
8913
- const code = attrW14(element2, "val");
9659
+ function glyph(element3) {
9660
+ const code = attrW14(element3, "val");
8914
9661
  if (!code) return void 0;
8915
- const font = attrW14(element2, "font");
9662
+ const font = attrW14(element3, "font");
8916
9663
  return { code, ...font ? { font } : {} };
8917
9664
  }
8918
- function kindOf(child) {
8919
- if (child.namespaceURI === WORD_NS)
8920
- return Object.hasOwn(TYPE_ELEMENTS, child.localName) ? TYPE_ELEMENTS[child.localName] : void 0;
8921
- if (child.namespaceURI === WORD_2010_NS && child.localName === "checkbox") return "checkbox";
8922
- if (child.namespaceURI === WORD_2012_NS && child.localName === "repeatingSection")
9665
+ function kindOf(child3) {
9666
+ if (child3.namespaceURI === WORD_NS)
9667
+ return Object.hasOwn(TYPE_ELEMENTS, child3.localName) ? TYPE_ELEMENTS[child3.localName] : void 0;
9668
+ if (child3.namespaceURI === WORD_2010_NS && child3.localName === "checkbox") return "checkbox";
9669
+ if (child3.namespaceURI === WORD_2012_NS && child3.localName === "repeatingSection")
8923
9670
  return "repeatingSection";
8924
9671
  return void 0;
8925
9672
  }
8926
9673
  var typeElements = (sdtPr) => Array.from(sdtPr.childNodes).filter(isElement).filter(
8927
- (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"
9674
+ (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"
8928
9675
  );
8929
9676
  function parseKind(sdtPr) {
8930
9677
  const [type] = typeElements(sdtPr);
@@ -8999,9 +9746,9 @@ function expectDefined2(value, context) {
8999
9746
  }
9000
9747
  function isCommentReferenceRun(run) {
9001
9748
  const content = Array.from(run.childNodes).filter(
9002
- (child) => isElement(child) && !named2(child, "rPr")
9749
+ (child3) => isElement(child3) && !named2(child3, "rPr")
9003
9750
  );
9004
- return content.length > 0 && content.every((child) => named2(child, "commentReference"));
9751
+ return content.length > 0 && content.every((child3) => named2(child3, "commentReference"));
9005
9752
  }
9006
9753
 
9007
9754
  // docx/content-control-values.ts
@@ -9077,28 +9824,28 @@ var TYPES = /* @__PURE__ */ new Set([
9077
9824
  `${WORD_2012_NS} repeatingSectionItem`
9078
9825
  ]);
9079
9826
  var EXTENSIBLE = /* @__PURE__ */ new Set(["sdtPr", "rPr"]);
9080
- function propertyShaped(element2) {
9081
- if (Array.from(element2.attributes).some(
9827
+ function propertyShaped(element3) {
9828
+ if (Array.from(element3.attributes).some(
9082
9829
  (attribute) => !ATTRIBUTE_NAMESPACES.has(attribute.namespaceURI ?? "")
9083
9830
  ))
9084
9831
  return false;
9085
- const word = element2.namespaceURI === WORD_NS;
9086
- const allowed = word ? PROPERTY_CHILDREN[element2.localName] : void 0;
9087
- const extensible = !word || EXTENSIBLE.has(element2.localName);
9088
- return Array.from(element2.childNodes).every((child) => {
9089
- if (child.nodeType === 3 || child.nodeType === 4) return !child.textContent?.trim();
9090
- if (child.nodeType !== 1) return true;
9091
- const item = child;
9832
+ const word = element3.namespaceURI === WORD_NS;
9833
+ const allowed = word ? PROPERTY_CHILDREN[element3.localName] : void 0;
9834
+ const extensible = !word || EXTENSIBLE.has(element3.localName);
9835
+ return Array.from(element3.childNodes).every((child3) => {
9836
+ if (child3.nodeType === 3 || child3.nodeType === 4) return !child3.textContent?.trim();
9837
+ if (child3.nodeType !== 1) return true;
9838
+ const item = child3;
9092
9839
  const known = item.namespaceURI === WORD_NS ? allowed?.has(item.localName) === true : extensible && WORD_EXTENSIONS.has(item.namespaceURI ?? "");
9093
9840
  return known && propertyShaped(item);
9094
9841
  });
9095
9842
  }
9096
9843
  function onlyProperties(sdtPr) {
9097
9844
  if (!propertyShaped(sdtPr)) return false;
9098
- const names = elements(sdtPr).map((child) => `${child.namespaceURI} ${child.localName}`);
9845
+ const names = elements(sdtPr).map((child3) => `${child3.namespaceURI} ${child3.localName}`);
9099
9846
  if (new Set(names).size < names.length) return false;
9100
9847
  if (names.filter((name) => TYPES.has(name)).length > 1) return false;
9101
- const value = (local) => children2(sdtPr, local).map((child) => getW(child, "val"));
9848
+ const value = (local) => children2(sdtPr, local).map((child3) => getW(child3, "val"));
9102
9849
  return value("id").every((id) => validId(id) !== void 0) && value("lock").every((lock) => lock === "unlocked" || validLock(lock) !== void 0);
9103
9850
  }
9104
9851
  function verbatimProperties(doc, xml) {
@@ -9136,30 +9883,30 @@ var PROPERTY_ORDER = [
9136
9883
  "label",
9137
9884
  "tabIndex"
9138
9885
  ];
9139
- var rank = (element2) => {
9140
- const index = element2.namespaceURI === WORD_NS ? PROPERTY_ORDER.indexOf(element2.localName) : -1;
9886
+ var rank = (element3) => {
9887
+ const index = element3.namespaceURI === WORD_NS ? PROPERTY_ORDER.indexOf(element3.localName) : -1;
9141
9888
  return index < 0 ? PROPERTY_ORDER.length : index;
9142
9889
  };
9143
- function place(sdtPr, element2) {
9890
+ function place(sdtPr, element3) {
9144
9891
  const siblings = Array.from(sdtPr.childNodes).filter((n2) => n2.nodeType === 1);
9145
- const after = siblings.find((sibling) => rank(sibling) > rank(element2));
9146
- sdtPr.insertBefore(element2, after ?? null);
9892
+ const after = siblings.find((sibling) => rank(sibling) > rank(element3));
9893
+ sdtPr.insertBefore(element3, after ?? null);
9147
9894
  }
9148
9895
  function setValued(doc, sdtPr, local, value) {
9149
9896
  for (const existing of children2(sdtPr, local)) sdtPr.removeChild(existing);
9150
9897
  if (typeof value !== "string") return;
9151
- const element2 = makeW(doc, local);
9152
- element2.setAttributeNS(WORD_NS, "w:val", value);
9153
- place(sdtPr, element2);
9898
+ const element3 = makeW(doc, local);
9899
+ element3.setAttributeNS(WORD_NS, "w:val", value);
9900
+ place(sdtPr, element3);
9154
9901
  }
9155
9902
  var same = (left, right) => JSON.stringify(left) === JSON.stringify(right);
9156
9903
  function w14(doc, local) {
9157
9904
  const prefix = declareIgnorableExtension(doc, WORD_2010_NS, "w14");
9158
9905
  return doc.createElementNS(WORD_2010_NS, `${prefix}:${local}`);
9159
9906
  }
9160
- function w14Attribute(element2, local, value) {
9161
- const prefix = element2.lookupPrefix(WORD_2010_NS) ?? "w14";
9162
- element2.setAttributeNS(WORD_2010_NS, `${prefix}:${local}`, value);
9907
+ function w14Attribute(element3, local, value) {
9908
+ const prefix = element3.lookupPrefix(WORD_2010_NS) ?? "w14";
9909
+ element3.setAttributeNS(WORD_2010_NS, `${prefix}:${local}`, value);
9163
9910
  }
9164
9911
  function checkboxElement(sdtPr) {
9165
9912
  return Array.from(sdtPr.childNodes).find(
@@ -9192,20 +9939,20 @@ function writeCheckbox(doc, sdtPr, control) {
9192
9939
  const replace = (local, build, order) => {
9193
9940
  for (const old of Array.from(box.childNodes))
9194
9941
  if (old.localName === local) box.removeChild(old);
9195
- const element2 = w14(doc, local);
9196
- build(element2);
9942
+ const element3 = w14(doc, local);
9943
+ build(element3);
9197
9944
  const siblings = Array.from(box.childNodes);
9198
- box.insertBefore(element2, siblings[order] ?? null);
9945
+ box.insertBefore(element3, siblings[order] ?? null);
9199
9946
  };
9200
- replace("checked", (el4) => w14Attribute(el4, "val", control.checked ? "1" : "0"), 0);
9947
+ replace("checked", (el5) => w14Attribute(el5, "val", control.checked ? "1" : "0"), 0);
9201
9948
  const states = [validGlyph(control.checkedGlyph), validGlyph(control.uncheckedGlyph)];
9202
9949
  states.forEach((glyph2, index) => {
9203
9950
  if (glyph2)
9204
9951
  replace(
9205
9952
  index ? "uncheckedState" : "checkedState",
9206
- (el4) => {
9207
- w14Attribute(el4, "val", glyph2.code);
9208
- if (glyph2.font) w14Attribute(el4, "font", glyph2.font);
9953
+ (el5) => {
9954
+ w14Attribute(el5, "val", glyph2.code);
9955
+ if (glyph2.font) w14Attribute(el5, "font", glyph2.font);
9209
9956
  },
9210
9957
  index + 1
9211
9958
  );
@@ -9216,10 +9963,10 @@ function writeItems(doc, sdtPr, control) {
9216
9963
  if (!list) return;
9217
9964
  for (const item of children2(list, "listItem")) list.removeChild(item);
9218
9965
  for (const item of validItems(control.items)) {
9219
- const element2 = makeW(doc, "listItem");
9220
- element2.setAttributeNS(WORD_NS, "w:displayText", item.display);
9221
- element2.setAttributeNS(WORD_NS, "w:value", item.value);
9222
- list.appendChild(element2);
9966
+ const element3 = makeW(doc, "listItem");
9967
+ element3.setAttributeNS(WORD_NS, "w:displayText", item.display);
9968
+ element3.setAttributeNS(WORD_NS, "w:value", item.value);
9969
+ list.appendChild(element3);
9223
9970
  }
9224
9971
  }
9225
9972
  function writeDate(doc, sdtPr, control) {
@@ -9232,9 +9979,9 @@ function writeDate(doc, sdtPr, control) {
9232
9979
  const set = (local, value, order) => {
9233
9980
  for (const old of children2(date, local)) date.removeChild(old);
9234
9981
  if (typeof value !== "string") return;
9235
- const element2 = makeW(doc, local);
9236
- element2.setAttributeNS(WORD_NS, "w:val", value);
9237
- date.insertBefore(element2, Array.from(date.childNodes)[order] ?? null);
9982
+ const element3 = makeW(doc, local);
9983
+ element3.setAttributeNS(WORD_NS, "w:val", value);
9984
+ date.insertBefore(element3, Array.from(date.childNodes)[order] ?? null);
9238
9985
  };
9239
9986
  set("dateFormat", control.dateFormat, 0);
9240
9987
  set("lid", control.dateLocale, 1);
@@ -9326,7 +10073,7 @@ function resetContentControl(doc, sdt, control) {
9326
10073
  content = makeW(doc, "sdtContent");
9327
10074
  sdt.appendChild(content);
9328
10075
  }
9329
- for (const child of Array.from(content.childNodes)) content.removeChild(child);
10076
+ for (const child3 of Array.from(content.childNodes)) content.removeChild(child3);
9330
10077
  return content;
9331
10078
  }
9332
10079
 
@@ -9340,13 +10087,13 @@ function rangeKeys(run) {
9340
10087
  }
9341
10088
 
9342
10089
  // docx/write-comments.ts
9343
- function setAttribute4(element2, local, value) {
9344
- element2.setAttributeNS(WORD_NS, `w:${local}`, value);
10090
+ function setAttribute4(element3, local, value) {
10091
+ element3.setAttributeNS(WORD_NS, `w:${local}`, value);
9345
10092
  }
9346
10093
  function commentRangeStartNode(doc, id) {
9347
- const element2 = makeW(doc, "commentRangeStart");
9348
- setAttribute4(element2, "id", id);
9349
- return element2;
10094
+ const element3 = makeW(doc, "commentRangeStart");
10095
+ setAttribute4(element3, "id", id);
10096
+ return element3;
9350
10097
  }
9351
10098
  function commentRangeEndNodes(doc, id) {
9352
10099
  const end = makeW(doc, "commentRangeEnd");
@@ -9359,8 +10106,8 @@ function commentRangeEndNodes(doc, id) {
9359
10106
  }
9360
10107
 
9361
10108
  // docx/write-ranges.ts
9362
- function setW(element2, local, value) {
9363
- element2.setAttributeNS(WORD_NS, `w:${local}`, value);
10109
+ function setW(element3, local, value) {
10110
+ element3.setAttributeNS(WORD_NS, `w:${local}`, value);
9364
10111
  }
9365
10112
  function rangeStartNodes(doc, edge) {
9366
10113
  if (edge.kind === "comment") return [commentRangeStartNode(doc, edge.id)];
@@ -9740,11 +10487,11 @@ function moveMarkers(before, after, markers) {
9740
10487
 
9741
10488
  // docx/inline-markers.ts
9742
10489
  var POSITION_MARKERS = ["bookmarkStart", "bookmarkEnd", "proofErr", "permStart", "permEnd"];
9743
- var isPositionMarker = (element2) => POSITION_MARKERS.some((name) => named2(element2, name));
9744
- var isAnnotationWrapper = (element2) => named2(element2, "smartTag") || named2(element2, "customXml");
9745
- function opensRange(element2) {
9746
- if (named2(element2, "proofErr")) return /Start$/.test(getW(element2, "type") ?? "");
9747
- return named2(element2, "bookmarkStart") || named2(element2, "permStart");
10490
+ var isPositionMarker = (element3) => POSITION_MARKERS.some((name) => named2(element3, name));
10491
+ var isAnnotationWrapper = (element3) => named2(element3, "smartTag") || named2(element3, "customXml");
10492
+ function opensRange(element3) {
10493
+ if (named2(element3, "proofErr")) return /Start$/.test(getW(element3, "type") ?? "");
10494
+ return named2(element3, "bookmarkStart") || named2(element3, "permStart");
9748
10495
  }
9749
10496
  function topLevel(node, paragraph) {
9750
10497
  let current = node;
@@ -9752,27 +10499,27 @@ function topLevel(node, paragraph) {
9752
10499
  current = current.parentNode;
9753
10500
  return current;
9754
10501
  }
9755
- function contentLength(child) {
9756
- if (named2(child, "t") || named2(child, "delText")) return (child.textContent ?? "").length;
9757
- return named2(child, "sym") ? symbolCharacter(getW(child, "char") ?? "").length || 1 : 1;
10502
+ function contentLength(child3) {
10503
+ if (named2(child3, "t") || named2(child3, "delText")) return (child3.textContent ?? "").length;
10504
+ return named2(child3, "sym") ? symbolCharacter(getW(child3, "char") ?? "").length || 1 : 1;
9758
10505
  }
9759
10506
  function splitRun(run, offset) {
9760
10507
  const children3 = Array.from(run.childNodes).filter(isElement);
9761
- const properties4 = children3.find((child) => named2(child, "rPr"));
10508
+ const properties4 = children3.find((child3) => named2(child3, "rPr"));
9762
10509
  const second = run.cloneNode(false);
9763
10510
  if (properties4) second.appendChild(properties4.cloneNode(true));
9764
10511
  let seen = 0;
9765
- for (const child of children3) {
9766
- if (child === properties4) continue;
9767
- const length = contentLength(child);
9768
- if (seen >= offset) second.appendChild(child);
10512
+ for (const child3 of children3) {
10513
+ if (child3 === properties4) continue;
10514
+ const length = contentLength(child3);
10515
+ if (seen >= offset) second.appendChild(child3);
9769
10516
  else if (seen + length > offset) {
9770
- const text2 = child.textContent ?? "";
9771
- const tail = child.cloneNode(false);
9772
- for (const node of Array.from(child.childNodes)) child.removeChild(node);
9773
- child.appendChild(run.ownerDocument.createTextNode(text2.slice(0, offset - seen)));
10517
+ const text2 = child3.textContent ?? "";
10518
+ const tail = child3.cloneNode(false);
10519
+ for (const node of Array.from(child3.childNodes)) child3.removeChild(node);
10520
+ child3.appendChild(run.ownerDocument.createTextNode(text2.slice(0, offset - seen)));
9774
10521
  tail.appendChild(run.ownerDocument.createTextNode(text2.slice(offset - seen)));
9775
- for (const part of [child, tail])
10522
+ for (const part of [child3, tail])
9776
10523
  if (/^\s|\s$/.test(part.textContent ?? ""))
9777
10524
  part.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
9778
10525
  second.appendChild(tail);
@@ -9783,11 +10530,11 @@ function splitRun(run, offset) {
9783
10530
  run.parentNode.insertBefore(second, run.nextSibling);
9784
10531
  return second;
9785
10532
  }
9786
- function rangeKey(element2) {
9787
- const id = getW(element2, "id");
10533
+ function rangeKey(element3) {
10534
+ const id = getW(element3, "id");
9788
10535
  if (id === void 0) return void 0;
9789
- if (named2(element2, "bookmarkStart") || named2(element2, "bookmarkEnd")) return `bookmark:${id}`;
9790
- if (named2(element2, "permStart") || named2(element2, "permEnd")) return `perm:${id}`;
10536
+ if (named2(element3, "bookmarkStart") || named2(element3, "bookmarkEnd")) return `bookmark:${id}`;
10537
+ if (named2(element3, "permStart") || named2(element3, "permEnd")) return `perm:${id}`;
9791
10538
  return void 0;
9792
10539
  }
9793
10540
  function orderRangeEnds(markers) {
@@ -9806,7 +10553,7 @@ function orderRangeEnds(markers) {
9806
10553
  function placeMarkers(paragraph, markers, runs, placed, containers) {
9807
10554
  const positions = runPositions(runs);
9808
10555
  const pieces = /* @__PURE__ */ new Map();
9809
- const insideRun = (index, position2, element2) => {
10556
+ const insideRun = (index, position2, element3) => {
9810
10557
  const run = placed[index]?.splittable;
9811
10558
  if (!run) return false;
9812
10559
  const parts = pieces.get(index) ?? [{ element: run, start: positions[index] }];
@@ -9815,7 +10562,7 @@ function placeMarkers(paragraph, markers, runs, placed, containers) {
9815
10562
  while (at > 0 && parts[at].start > position2) at--;
9816
10563
  const part = parts[at];
9817
10564
  if (part.start === position2) {
9818
- part.element.parentNode.insertBefore(element2, part.element);
10565
+ part.element.parentNode.insertBefore(element3, part.element);
9819
10566
  return true;
9820
10567
  }
9821
10568
  const second = splitRun(part.element, position2 - part.start);
@@ -9823,14 +10570,14 @@ function placeMarkers(paragraph, markers, runs, placed, containers) {
9823
10570
  parts.splice(at + 1, 0, { element: second, start: position2 });
9824
10571
  const written = placed[index];
9825
10572
  if (written?.last === part.element) written.last = second;
9826
- second.parentNode.insertBefore(element2, second);
10573
+ second.parentNode.insertBefore(element3, second);
9827
10574
  return true;
9828
10575
  };
9829
10576
  const done = /* @__PURE__ */ new Set();
9830
- const after = (node, element2) => {
10577
+ const after = (node, element3) => {
9831
10578
  let anchor = node;
9832
10579
  while (anchor.nextSibling && done.has(anchor.nextSibling)) anchor = anchor.nextSibling;
9833
- anchor.parentNode.insertBefore(element2, anchor.nextSibling);
10580
+ anchor.parentNode.insertBefore(element3, anchor.nextSibling);
9834
10581
  };
9835
10582
  const put = (marker) => {
9836
10583
  let boundary = marker.opening ? positions.indexOf(marker.position) : positions.lastIndexOf(marker.position);
@@ -9946,9 +10693,9 @@ function restoreAnnotations(markers, before, after) {
9946
10693
  }
9947
10694
  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)) {
9948
10695
  const copy = annotation.wrapper.cloneNode(false);
9949
- for (const child of Array.from(annotation.wrapper.childNodes))
9950
- if (isElement(child) && (named2(child, "smartTagPr") || named2(child, "customXmlPr")))
9951
- copy.appendChild(child.cloneNode(true));
10696
+ for (const child3 of Array.from(annotation.wrapper.childNodes))
10697
+ if (isElement(child3) && (named2(child3, "smartTagPr") || named2(child3, "customXmlPr")))
10698
+ copy.appendChild(child3.cloneNode(true));
9952
10699
  opening.parentNode.insertBefore(copy, opening);
9953
10700
  for (const item of between) copy.appendChild(item);
9954
10701
  }
@@ -9964,8 +10711,8 @@ function wordColor(color) {
9964
10711
  return hex ? hex.toUpperCase() : "auto";
9965
10712
  }
9966
10713
  function borderElement(doc, name, side) {
9967
- const element2 = makeW(doc, name);
9968
- const set = (local, value) => element2.setAttributeNS(WORD_NS, `w:${local}`, value);
10714
+ const element3 = makeW(doc, name);
10715
+ const set = (local, value) => element3.setAttributeNS(WORD_NS, `w:${local}`, value);
9969
10716
  set("val", side.style ?? "single");
9970
10717
  if (side.style !== "none" && side.style !== "nil") {
9971
10718
  set("sz", String(side.sizeEighthPoints ?? 4));
@@ -9973,12 +10720,12 @@ function borderElement(doc, name, side) {
9973
10720
  set("color", wordColor(side.color));
9974
10721
  if (side.themeColor) set("themeColor", side.themeColor);
9975
10722
  }
9976
- return element2;
10723
+ return element3;
9977
10724
  }
9978
10725
  var sameJson = (a, b) => JSON.stringify(a ?? null) === JSON.stringify(b ?? null);
9979
10726
  function updateShading(doc, props, paragraph, base) {
9980
10727
  if (base && paragraph.shadingFill === base.shadingFill) return;
9981
- for (const element2 of children2(props, "shd")) props.removeChild(element2);
10728
+ for (const element3 of children2(props, "shd")) props.removeChild(element3);
9982
10729
  if (!paragraph.shadingFill) return;
9983
10730
  const shd = makeW(doc, "shd");
9984
10731
  shd.setAttributeNS(WORD_NS, "w:val", "clear");
@@ -9988,7 +10735,7 @@ function updateShading(doc, props, paragraph, base) {
9988
10735
  }
9989
10736
  function updateBorders(doc, props, paragraph, base) {
9990
10737
  if (base && sameJson(paragraph.borders, base.borders)) return;
9991
- for (const element2 of children2(props, "pBdr")) props.removeChild(element2);
10738
+ for (const element3 of children2(props, "pBdr")) props.removeChild(element3);
9992
10739
  const borders = paragraph.borders;
9993
10740
  if (!borders) return;
9994
10741
  const pBdr = makeW(doc, "pBdr");
@@ -10004,18 +10751,18 @@ function writeParagraphDecoration(doc, props, paragraph, base) {
10004
10751
  }
10005
10752
 
10006
10753
  // docx/write-paragraph-properties.ts
10007
- function setAttribute5(element2, local, value) {
10008
- element2.setAttributeNS(WORD_NS, `w:${local}`, value);
10754
+ function setAttribute5(element3, local, value) {
10755
+ element3.setAttributeNS(WORD_NS, `w:${local}`, value);
10009
10756
  }
10010
- function setWordValue(element2, local, value) {
10011
- if (value === void 0) element2.removeAttributeNS(WORD_NS, local);
10012
- else setAttribute5(element2, local, String(value));
10757
+ function setWordValue(element3, local, value) {
10758
+ if (value === void 0) element3.removeAttributeNS(WORD_NS, local);
10759
+ else setAttribute5(element3, local, String(value));
10013
10760
  }
10014
10761
  function updateDirection(doc, props, paragraph, base) {
10015
10762
  if (base && paragraph.direction === base.direction) return;
10016
10763
  let bidi = first2(props, "bidi");
10017
10764
  if (paragraph.direction === void 0) {
10018
- for (const element2 of children2(props, "bidi")) props.removeChild(element2);
10765
+ for (const element3 of children2(props, "bidi")) props.removeChild(element3);
10019
10766
  } else {
10020
10767
  if (!bidi) {
10021
10768
  bidi = makeW(doc, "bidi");
@@ -10066,11 +10813,11 @@ function updateIndent(doc, props, paragraph, base) {
10066
10813
  }
10067
10814
  function updatePageBreakBefore(doc, props, paragraph, base) {
10068
10815
  if (base && paragraph.pageBreakBefore === base.pageBreakBefore) return;
10069
- for (const element2 of children2(props, "pageBreakBefore")) props.removeChild(element2);
10816
+ for (const element3 of children2(props, "pageBreakBefore")) props.removeChild(element3);
10070
10817
  if (paragraph.pageBreakBefore !== void 0) {
10071
- const element2 = makeW(doc, "pageBreakBefore");
10072
- if (!paragraph.pageBreakBefore) element2.setAttributeNS(WORD_NS, "w:val", "0");
10073
- props.appendChild(element2);
10818
+ const element3 = makeW(doc, "pageBreakBefore");
10819
+ if (!paragraph.pageBreakBefore) element3.setAttributeNS(WORD_NS, "w:val", "0");
10820
+ props.appendChild(element3);
10074
10821
  }
10075
10822
  }
10076
10823
  function updateKeepOptions(doc, props, paragraph, base) {
@@ -10082,12 +10829,12 @@ function updateKeepOptions(doc, props, paragraph, base) {
10082
10829
  "suppressLineNumbers"
10083
10830
  ]) {
10084
10831
  if (base && paragraph[key] === base[key]) continue;
10085
- for (const element3 of children2(props, key)) props.removeChild(element3);
10832
+ for (const element4 of children2(props, key)) props.removeChild(element4);
10086
10833
  const value = paragraph[key];
10087
10834
  if (value === void 0) continue;
10088
- const element2 = makeW(doc, key);
10089
- if (!value) setAttribute5(element2, "val", "0");
10090
- props.appendChild(element2);
10835
+ const element3 = makeW(doc, key);
10836
+ if (!value) setAttribute5(element3, "val", "0");
10837
+ props.appendChild(element3);
10091
10838
  }
10092
10839
  }
10093
10840
  function updateDropCap(doc, props, paragraph, base) {
@@ -10161,8 +10908,8 @@ function reconcileBookmarks(doc, starts, ends, names, baseNames, nextId) {
10161
10908
  }
10162
10909
 
10163
10910
  // docx/numbering-write.ts
10164
- function setAttribute6(element2, local, value) {
10165
- element2.setAttributeNS(WORD_NS, `w:${local}`, value);
10911
+ function setAttribute6(element3, local, value) {
10912
+ element3.setAttributeNS(WORD_NS, `w:${local}`, value);
10166
10913
  }
10167
10914
  function sameNumbering(a, b) {
10168
10915
  return a?.numId === b?.numId && a?.level === b?.level;
@@ -10228,8 +10975,8 @@ var MATH_NAMESPACES = /* @__PURE__ */ new Set([
10228
10975
  "http://purl.oclc.org/ooxml/officeDocument/math"
10229
10976
  ]);
10230
10977
  var MATH_NS = "http://schemas.openxmlformats.org/officeDocument/2006/math";
10231
- function isEquationElement(element2) {
10232
- return MATH_NAMESPACES.has(element2.namespaceURI ?? "") && (element2.localName === "oMath" || element2.localName === "oMathPara");
10978
+ function isEquationElement(element3) {
10979
+ return MATH_NAMESPACES.has(element3.namespaceURI ?? "") && (element3.localName === "oMath" || element3.localName === "oMathPara");
10233
10980
  }
10234
10981
  function writeEquation(doc, run, base, old) {
10235
10982
  const equation = run.equation;
@@ -10247,19 +10994,19 @@ function writeEquation(doc, run, base, old) {
10247
10994
  }
10248
10995
  if (!isEquationElement(source))
10249
10996
  throw new Error("Equation markup must be an m:oMath or m:oMathPara element.");
10250
- let element2 = doc.importNode(source, true);
10251
- if (equation.display && element2.localName === "oMath") {
10997
+ let element3 = doc.importNode(source, true);
10998
+ if (equation.display && element3.localName === "oMath") {
10252
10999
  const para = doc.createElementNS(MATH_NS, "m:oMathPara");
10253
11000
  para.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:m", MATH_NS);
10254
- para.appendChild(element2);
10255
- element2 = para;
10256
- } else if (!equation.display && element2.localName === "oMathPara") {
10257
- const inner = Array.from(element2.childNodes).find(
11001
+ para.appendChild(element3);
11002
+ element3 = para;
11003
+ } else if (!equation.display && element3.localName === "oMathPara") {
11004
+ const inner = Array.from(element3.childNodes).find(
10258
11005
  (node) => node.nodeType === 1 && node.localName === "oMath"
10259
11006
  );
10260
- if (inner) element2 = inner;
11007
+ if (inner) element3 = inner;
10261
11008
  }
10262
- return element2;
11009
+ return element3;
10263
11010
  }
10264
11011
 
10265
11012
  // docx/field-lock.ts
@@ -10436,8 +11183,8 @@ function containerSources(runs, base, slots) {
10436
11183
  }
10437
11184
 
10438
11185
  // docx/write-inline.ts
10439
- function setW2(element2, local, value) {
10440
- element2.setAttributeNS(WORD_NS, `w:${local}`, value);
11186
+ function setW2(element3, local, value) {
11187
+ element3.setAttributeNS(WORD_NS, `w:${local}`, value);
10441
11188
  }
10442
11189
  function newHyperlink(doc, link, allocator) {
10443
11190
  const container = makeW(doc, "hyperlink");
@@ -10521,7 +11268,7 @@ function buildInlineContent(doc, runs, base, slots, allocator, ranges, sources =
10521
11268
  target = resetContentControl(doc, container, group2.control);
10522
11269
  } else if (reusable) {
10523
11270
  container = onlyContainer;
10524
- for (const child of Array.from(container.childNodes)) container.removeChild(child);
11271
+ for (const child3 of Array.from(container.childNodes)) container.removeChild(child3);
10525
11272
  } else if (group2.kind === "control") {
10526
11273
  const created = createContentControl(doc, group2.control);
10527
11274
  container = created.sdt;
@@ -10548,7 +11295,7 @@ function buildInlineContent(doc, runs, base, slots, allocator, ranges, sources =
10548
11295
  // docx/inline-slots.ts
10549
11296
  function runIsSafe(run) {
10550
11297
  const content = Array.from(run.childNodes).filter(
10551
- (child) => isElement(child) && !named2(child, "rPr") && !isCachedPageBreak(child)
11298
+ (child3) => isElement(child3) && !named2(child3, "rPr") && !isCachedPageBreak(child3)
10552
11299
  );
10553
11300
  const only = content.length === 1 ? content[0] : void 0;
10554
11301
  if (only && named2(only, "br") && isModeledBreak(only)) return true;
@@ -10565,14 +11312,14 @@ function runIsSafe(run) {
10565
11312
  const [ffData] = data;
10566
11313
  return type === "begin" && data.length === 1 && isElement(ffData) && isModeledFormFieldData(ffData);
10567
11314
  }
10568
- if (content.length && content.every((element2) => named2(element2, "instrText"))) return true;
11315
+ if (content.length && content.every((element3) => named2(element3, "instrText"))) return true;
10569
11316
  if (runSymbol(content) === null || runPositionalTab(content) === null) return false;
10570
11317
  const kinds = /* @__PURE__ */ new Set();
10571
- for (const element2 of content) {
10572
- if (element2.localName === "br" && hasSpecialBreak(element2)) return false;
10573
- if (element2.localName === "cr" && element2.attributes.length > 0) return false;
10574
- if (element2.localName === "AlternateContent") {
10575
- if (!alternateContentDrawing(element2)) return false;
11318
+ for (const element3 of content) {
11319
+ if (element3.localName === "br" && hasSpecialBreak(element3)) return false;
11320
+ if (element3.localName === "cr" && element3.attributes.length > 0) return false;
11321
+ if (element3.localName === "AlternateContent") {
11322
+ if (!alternateContentDrawing(element3)) return false;
10576
11323
  kinds.add("drawing");
10577
11324
  continue;
10578
11325
  }
@@ -10589,51 +11336,51 @@ function runIsSafe(run) {
10589
11336
  "drawing",
10590
11337
  "pict"
10591
11338
  ];
10592
- if (!allowed.includes(element2.localName)) return false;
10593
- kinds.add(element2.localName);
11339
+ if (!allowed.includes(element3.localName)) return false;
11340
+ kinds.add(element3.localName);
10594
11341
  }
10595
11342
  return !((kinds.has("drawing") || kinds.has("pict")) && kinds.size > 1);
10596
11343
  }
10597
11344
  function runsOf(parent, container, slots, markers, paragraph, revision) {
10598
11345
  const inContainer = { ...container && { container }, ...revision && { revision } };
10599
- for (const child of Array.from(parent.childNodes)) {
10600
- if (!isElement(child)) {
10601
- if (child.nodeType === 3 && child.textContent?.trim()) return false;
11346
+ for (const child3 of Array.from(parent.childNodes)) {
11347
+ if (!isElement(child3)) {
11348
+ if (child3.nodeType === 3 && child3.textContent?.trim()) return false;
10602
11349
  continue;
10603
11350
  }
10604
- if (parent === paragraph && named2(child, "pPr")) continue;
10605
- if (isEquationElement(child)) {
10606
- slots.push({ element: child, ...inContainer });
10607
- } else if (named2(child, "r")) {
10608
- if (isCommentReferenceRun(child)) continue;
10609
- if (!runIsSafe(child)) return false;
10610
- slots.push({ element: child, ...inContainer });
10611
- } else if (isPositionMarker(child)) {
10612
- markers.push({ element: child, boundary: slots.length, ...inContainer });
10613
- } else if (named2(child, "smartTagPr") || named2(child, "customXmlPr")) {
11351
+ if (parent === paragraph && named2(child3, "pPr")) continue;
11352
+ if (isEquationElement(child3)) {
11353
+ slots.push({ element: child3, ...inContainer });
11354
+ } else if (named2(child3, "r")) {
11355
+ if (isCommentReferenceRun(child3)) continue;
11356
+ if (!runIsSafe(child3)) return false;
11357
+ slots.push({ element: child3, ...inContainer });
11358
+ } else if (isPositionMarker(child3)) {
11359
+ markers.push({ element: child3, boundary: slots.length, ...inContainer });
11360
+ } else if (named2(child3, "smartTagPr") || named2(child3, "customXmlPr")) {
10614
11361
  if (!isAnnotationWrapper(parent)) return false;
10615
- } else if (isAnnotationWrapper(child)) {
11362
+ } else if (isAnnotationWrapper(child3)) {
10616
11363
  const edge = (side) => markers.push({
10617
- element: annotationEdge(child),
11364
+ element: annotationEdge(child3),
10618
11365
  boundary: slots.length,
10619
- annotation: { wrapper: child, edge: side },
11366
+ annotation: { wrapper: child3, edge: side },
10620
11367
  ...inContainer
10621
11368
  });
10622
11369
  edge("start");
10623
- if (!runsOf(child, container, slots, markers, paragraph, revision)) return false;
11370
+ if (!runsOf(child3, container, slots, markers, paragraph, revision)) return false;
10624
11371
  edge("end");
10625
- } else if (isRevisionWrapperElement(child) && (!container || isSdt(container))) {
10626
- if (!runsOf(child, container, slots, markers, paragraph, child)) return false;
10627
- } else if (isSdt(child) && parent === paragraph) {
10628
- const content = sdtContent(child);
11372
+ } else if (isRevisionWrapperElement(child3) && (!container || isSdt(container))) {
11373
+ if (!runsOf(child3, container, slots, markers, paragraph, child3)) return false;
11374
+ } else if (isSdt(child3) && parent === paragraph) {
11375
+ const content = sdtContent(child3);
10629
11376
  const before = slots.length;
10630
- if (content && !runsOf(content, child, slots, markers, paragraph)) return false;
10631
- if (slots.length === before) slots.push({ container: child });
10632
- } else if ((named2(child, "hyperlink") || named2(child, "fldSimple")) && !container) {
11377
+ if (content && !runsOf(content, child3, slots, markers, paragraph)) return false;
11378
+ if (slots.length === before) slots.push({ container: child3 });
11379
+ } else if ((named2(child3, "hyperlink") || named2(child3, "fldSimple")) && !container) {
10633
11380
  const before = slots.length;
10634
- if (!runsOf(child, child, slots, markers, paragraph, revision)) return false;
10635
- if (named2(child, "fldSimple") && slots.length === before) slots.push({ container: child });
10636
- } else if (!isCommentAnchorElement(child) || container) return false;
11381
+ if (!runsOf(child3, child3, slots, markers, paragraph, revision)) return false;
11382
+ if (named2(child3, "fldSimple") && slots.length === before) slots.push({ container: child3 });
11383
+ } else if (!isCommentAnchorElement(child3) || container) return false;
10637
11384
  }
10638
11385
  return true;
10639
11386
  }
@@ -10644,7 +11391,7 @@ function collectInlineSlots(paragraph) {
10644
11391
  }
10645
11392
  function replaceableInlineChildren(paragraph) {
10646
11393
  return Array.from(paragraph.childNodes).filter(
10647
- (child) => isElement(child) && (isEquationElement(child) || named2(child, "r") || named2(child, "hyperlink") || named2(child, "fldSimple") || isSdt(child) || isRevisionWrapperElement(child) || isAnnotationWrapper(child) || isPositionMarker(child) || isCommentAnchorElement(child))
11394
+ (child3) => isElement(child3) && (isEquationElement(child3) || named2(child3, "r") || named2(child3, "hyperlink") || named2(child3, "fldSimple") || isSdt(child3) || isRevisionWrapperElement(child3) || isAnnotationWrapper(child3) || isPositionMarker(child3) || isCommentAnchorElement(child3))
10648
11395
  );
10649
11396
  }
10650
11397
 
@@ -10725,11 +11472,11 @@ function runsToWriteAnew(paragraph, base, slots) {
10725
11472
  }
10726
11473
 
10727
11474
  // docx/write-paragraph.ts
10728
- function setAttribute7(element2, local, value) {
10729
- element2.setAttributeNS(WORD_NS, `w:${local}`, value);
11475
+ function setAttribute7(element3, local, value) {
11476
+ element3.setAttributeNS(WORD_NS, `w:${local}`, value);
10730
11477
  }
10731
- function removeChildren4(element2, local) {
10732
- for (const child of children2(element2, local)) element2.removeChild(child);
11478
+ function removeChildren4(element3, local) {
11479
+ for (const child3 of children2(element3, local)) element3.removeChild(child3);
10733
11480
  }
10734
11481
  function writeParagraphImpl(doc, paragraph, node, base, allocator, spans) {
10735
11482
  const ranges = spans;
@@ -10783,12 +11530,12 @@ function writeParagraphImpl(doc, paragraph, node, base, allocator, spans) {
10783
11530
  orderParagraphProperties(pPr);
10784
11531
  const { slots, markers } = layout;
10785
11532
  const anew = runsToWriteAnew(paragraph, base, slots);
10786
- const isBookmark = (element2) => named2(element2, "bookmarkStart") || named2(element2, "bookmarkEnd");
11533
+ const isBookmark = (element3) => named2(element3, "bookmarkStart") || named2(element3, "bookmarkEnd");
10787
11534
  const sourceBookmarks = markers.map((marker) => marker.element).filter(isBookmark);
10788
11535
  const { starts, ends } = reconcileBookmarks(
10789
11536
  doc,
10790
- sourceBookmarks.filter((element2) => named2(element2, "bookmarkStart")),
10791
- sourceBookmarks.filter((element2) => named2(element2, "bookmarkEnd")),
11537
+ sourceBookmarks.filter((element3) => named2(element3, "bookmarkStart")),
11538
+ sourceBookmarks.filter((element3) => named2(element3, "bookmarkEnd")),
10792
11539
  paragraph.bookmarks ?? [],
10793
11540
  [],
10794
11541
  () => "0"
@@ -10827,7 +11574,7 @@ function writeParagraphImpl(doc, paragraph, node, base, allocator, spans) {
10827
11574
  anew
10828
11575
  );
10829
11576
  let anchor = pPr;
10830
- for (const bookmark of starts.filter((element2) => !source.has(element2))) {
11577
+ for (const bookmark of starts.filter((element3) => !source.has(element3))) {
10831
11578
  node.insertBefore(bookmark, anchor.nextSibling);
10832
11579
  anchor = bookmark;
10833
11580
  }
@@ -10837,7 +11584,7 @@ function writeParagraphImpl(doc, paragraph, node, base, allocator, spans) {
10837
11584
  }
10838
11585
  placeMarkers(node, carried, paragraph.runs, placed, containers);
10839
11586
  restoreAnnotations(carried, [], paragraph.runs);
10840
- for (const bookmark of ends.filter((element2) => !source.has(element2))) node.appendChild(bookmark);
11587
+ for (const bookmark of ends.filter((element3) => !source.has(element3))) node.appendChild(bookmark);
10841
11588
  if (!pPr.childNodes.length) node.removeChild(pPr);
10842
11589
  return node;
10843
11590
  }
@@ -11008,9 +11755,9 @@ function restoreParagraphFormatting(paragraph) {
11008
11755
  if (paragraph.sourceParagraphPropertiesXml) {
11009
11756
  const current = parsePropertiesSnapshot(paragraph.sourceParagraphPropertiesXml, "pPr");
11010
11757
  for (const name of ["rPr", "sectPr"]) {
11011
- const element2 = first2(current, name);
11012
- if (element2 && !first2(properties4, name))
11013
- properties4.appendChild(properties4.ownerDocument.importNode(element2, true));
11758
+ const element3 = first2(current, name);
11759
+ if (element3 && !first2(properties4, name))
11760
+ properties4.appendChild(properties4.ownerDocument.importNode(element3, true));
11014
11761
  }
11015
11762
  orderParagraphProperties(properties4);
11016
11763
  }
@@ -11377,9 +12124,9 @@ var runPropertiesMark = {
11377
12124
  parseDOM: [
11378
12125
  {
11379
12126
  tag: "span[data-run-props]",
11380
- getAttrs: (el4) => {
12127
+ getAttrs: (el5) => {
11381
12128
  try {
11382
- return { props: JSON.parse(el4.dataset.runProps || "null") };
12129
+ return { props: JSON.parse(el5.dataset.runProps || "null") };
11383
12130
  } catch {
11384
12131
  return { props: null };
11385
12132
  }
@@ -11428,11 +12175,11 @@ function commentIdsFromNode(node) {
11428
12175
  }
11429
12176
 
11430
12177
  // docx/ui/run-mark-properties.ts
11431
- function propertyOfMark(child, name) {
11432
- return child.marks.find((mark) => mark.type.name === name);
12178
+ function propertyOfMark(child3, name) {
12179
+ return child3.marks.find((mark) => mark.type.name === name);
11433
12180
  }
11434
- function linkFromMarks(child) {
11435
- const link = propertyOfMark(child, "link");
12181
+ function linkFromMarks(child3) {
12182
+ const link = propertyOfMark(child3, "link");
11436
12183
  if (!link) return void 0;
11437
12184
  const info = {};
11438
12185
  if (link.attrs.href) info.href = link.attrs.href;
@@ -11440,28 +12187,28 @@ function linkFromMarks(child) {
11440
12187
  if (link.attrs.tooltip) info.tooltip = link.attrs.tooltip;
11441
12188
  return info.href || info.anchor ? info : void 0;
11442
12189
  }
11443
- function applyMarkFormatting(run, child) {
11444
- if (propertyOfMark(child, "bold")) run.bold = true;
11445
- if (propertyOfMark(child, "italic")) run.italic = true;
11446
- if (propertyOfMark(child, "underline")) run.underline = true;
11447
- if (propertyOfMark(child, "strike")) run.strike = true;
11448
- const highlight = propertyOfMark(child, "highlight");
12190
+ function applyMarkFormatting(run, child3) {
12191
+ if (propertyOfMark(child3, "bold")) run.bold = true;
12192
+ if (propertyOfMark(child3, "italic")) run.italic = true;
12193
+ if (propertyOfMark(child3, "underline")) run.underline = true;
12194
+ if (propertyOfMark(child3, "strike")) run.strike = true;
12195
+ const highlight = propertyOfMark(child3, "highlight");
11449
12196
  if (highlight?.attrs.color) run.highlight = highlight.attrs.color;
11450
- const verticalAlign = propertyOfMark(child, "verticalAlign");
12197
+ const verticalAlign = propertyOfMark(child3, "verticalAlign");
11451
12198
  if (verticalAlign?.attrs.value) run.verticalAlign = verticalAlign.attrs.value;
11452
- const language = propertyOfMark(child, "language");
12199
+ const language = propertyOfMark(child3, "language");
11453
12200
  if (language?.attrs.language != null) run.language = language.attrs.language;
11454
12201
  if (language?.attrs.eastAsiaLanguage != null)
11455
12202
  run.eastAsiaLanguage = language.attrs.eastAsiaLanguage;
11456
12203
  if (language?.attrs.bidiLanguage != null) run.bidiLanguage = language.attrs.bidiLanguage;
11457
- const rtl = propertyOfMark(child, "runRtl");
12204
+ const rtl = propertyOfMark(child3, "runRtl");
11458
12205
  if (rtl) run.rtl = rtl.attrs.value;
11459
- const font = propertyOfMark(child, "font");
12206
+ const font = propertyOfMark(child3, "font");
11460
12207
  if (font?.attrs.family) run.fontFamily = font.attrs.family;
11461
12208
  if (font?.attrs.size) run.fontSize = font.attrs.size;
11462
12209
  if (font?.attrs.color) run.color = font.attrs.color;
11463
- const insertion = propertyOfMark(child, "insertion");
11464
- const deletion = propertyOfMark(child, "deletion");
12210
+ const insertion = propertyOfMark(child3, "insertion");
12211
+ const deletion = propertyOfMark(child3, "deletion");
11465
12212
  const revisionMark = insertion ?? deletion;
11466
12213
  if (revisionMark) {
11467
12214
  const move = typeof revisionMark.attrs.move === "string" ? JSON.parse(revisionMark.attrs.move) : void 0;
@@ -11475,19 +12222,19 @@ function applyMarkFormatting(run, child) {
11475
12222
  ...move ? { move } : {}
11476
12223
  };
11477
12224
  }
11478
- const commentIds = commentIdsFromMarks(child.marks);
12225
+ const commentIds = commentIdsFromMarks(child3.marks);
11479
12226
  if (commentIds.length) run.commentIds = commentIds;
11480
- const control = propertyOfMark(child, "contentControl");
12227
+ const control = propertyOfMark(child3, "contentControl");
11481
12228
  if (control?.attrs.data) run.contentControl = JSON.parse(String(control.attrs.data));
11482
- const field = propertyOfMark(child, "field");
12229
+ const field = propertyOfMark(child3, "field");
11483
12230
  if (field)
11484
12231
  run.field = {
11485
12232
  instr: String(field.attrs.instr),
11486
12233
  ...field.attrs.simple ? { simple: true } : {}
11487
12234
  };
11488
- const characterStyle = propertyOfMark(child, "characterStyle");
12235
+ const characterStyle = propertyOfMark(child3, "characterStyle");
11489
12236
  if (characterStyle?.attrs.id) run.style = String(characterStyle.attrs.id);
11490
- const extra = propertyOfMark(child, "runProperties");
12237
+ const extra = propertyOfMark(child3, "runProperties");
11491
12238
  if (extra?.attrs.props)
11492
12239
  for (const [key, value] of Object.entries(structuredClone(extra.attrs.props))) {
11493
12240
  const field2 = key;
@@ -11689,90 +12436,90 @@ function runToInlineNodes(run, schema, noteNumber) {
11689
12436
  (piece) => piece === "\n" ? [breakNode()] : piece ? [schema.text(piece, marks)] : []
11690
12437
  );
11691
12438
  }
11692
- function applyInlineFormat(run, child) {
11693
- Object.assign(run, inlineRunProperties(child));
12439
+ function applyInlineFormat(run, child3) {
12440
+ Object.assign(run, inlineRunProperties(child3));
11694
12441
  const marks = { text: "", ...run.revision ? { revision: run.revision } : {} };
11695
- applyMarkFormatting(marks, child);
12442
+ applyMarkFormatting(marks, child3);
11696
12443
  const { text: _text, ...properties4 } = marks;
11697
12444
  Object.assign(run, properties4);
11698
- const ids = commentIdsFromNode(child);
12445
+ const ids = commentIdsFromNode(child3);
11699
12446
  if (ids.length) run.commentIds = ids;
11700
12447
  else delete run.commentIds;
11701
12448
  }
11702
- function inlineNodeRun(child) {
12449
+ function inlineNodeRun(child3) {
11703
12450
  const runs = [];
11704
- appendInlineNode(runs, child);
12451
+ appendInlineNode(runs, child3);
11705
12452
  return runs[0];
11706
12453
  }
11707
- function appendInlineNode(runs, child) {
11708
- if (child.type.name === "equation") {
12454
+ function appendInlineNode(runs, child3) {
12455
+ if (child3.type.name === "equation") {
11709
12456
  const run2 = {
11710
12457
  text: "",
11711
- equation: { omml: String(child.attrs.omml), display: Boolean(child.attrs.display) }
12458
+ equation: { omml: String(child3.attrs.omml), display: Boolean(child3.attrs.display) }
11712
12459
  };
11713
- applyInlineFormat(run2, child);
12460
+ applyInlineFormat(run2, child3);
11714
12461
  runs.push(run2);
11715
12462
  return;
11716
12463
  }
11717
- if (child.type.name === "pageBreak") {
11718
- const run2 = { text: "", break: child.attrs.kind === "column" ? "column" : "page" };
11719
- applyInlineFormat(run2, child);
12464
+ if (child3.type.name === "pageBreak") {
12465
+ const run2 = { text: "", break: child3.attrs.kind === "column" ? "column" : "page" };
12466
+ applyInlineFormat(run2, child3);
11720
12467
  runs.push(run2);
11721
12468
  return;
11722
12469
  }
11723
- if (child.type.name === "fieldMarker") {
11724
- const marker = child.attrs.kind === "code" ? { text: "", fieldCode: String(child.attrs.code ?? "") } : { text: "", fieldChar: child.attrs.kind };
11725
- applyInlineFormat(marker, child);
12470
+ if (child3.type.name === "fieldMarker") {
12471
+ const marker = child3.attrs.kind === "code" ? { text: "", fieldCode: String(child3.attrs.code ?? "") } : { text: "", fieldChar: child3.attrs.kind };
12472
+ applyInlineFormat(marker, child3);
11726
12473
  runs.push(marker);
11727
12474
  return;
11728
12475
  }
11729
- if (child.type.name === "noteReference") {
12476
+ if (child3.type.name === "noteReference") {
11730
12477
  const reference = {
11731
12478
  text: "",
11732
12479
  noteReference: {
11733
- kind: child.attrs.kind === "endnote" ? "endnote" : "footnote",
11734
- id: String(child.attrs.id || "")
12480
+ kind: child3.attrs.kind === "endnote" ? "endnote" : "footnote",
12481
+ id: String(child3.attrs.id || "")
11735
12482
  }
11736
12483
  };
11737
- applyInlineFormat(reference, child);
12484
+ applyInlineFormat(reference, child3);
11738
12485
  runs.push(reference);
11739
12486
  return;
11740
12487
  }
11741
- if (child.type.name === "image") {
11742
- const imageLink = linkFromMarks(child);
12488
+ if (child3.type.name === "image") {
12489
+ const imageLink = linkFromMarks(child3);
11743
12490
  runs.push({
11744
12491
  text: "",
11745
12492
  image: {
11746
- relId: child.attrs.relId,
11747
- partName: child.attrs.partName,
11748
- contentType: child.attrs.contentType,
11749
- widthPx: child.attrs.widthPx,
11750
- heightPx: child.attrs.heightPx,
11751
- ...child.attrs.altText ? { altText: child.attrs.altText } : {},
11752
- ...child.attrs.title ? { title: child.attrs.title } : {},
11753
- ...child.attrs.anchored ? { anchored: true } : {},
11754
- ...child.attrs.svgPartName ? { svgPartName: child.attrs.svgPartName } : {},
12493
+ relId: child3.attrs.relId,
12494
+ partName: child3.attrs.partName,
12495
+ contentType: child3.attrs.contentType,
12496
+ widthPx: child3.attrs.widthPx,
12497
+ heightPx: child3.attrs.heightPx,
12498
+ ...child3.attrs.altText ? { altText: child3.attrs.altText } : {},
12499
+ ...child3.attrs.title ? { title: child3.attrs.title } : {},
12500
+ ...child3.attrs.anchored ? { anchored: true } : {},
12501
+ ...child3.attrs.svgPartName ? { svgPartName: child3.attrs.svgPartName } : {},
11755
12502
  // Same key order as the parser's run: the writer compares an unchanged placeholder run by JSON.
11756
- ...child.attrs.unsupported ? { unsupported: child.attrs.unsupported } : {},
11757
- ...typeof child.attrs.diagram === "string" ? { diagram: JSON.parse(child.attrs.diagram) } : {},
11758
- ...typeof child.attrs.chart === "string" ? { chart: JSON.parse(child.attrs.chart) } : {},
11759
- ...typeof child.attrs.shape === "string" ? { shape: JSON.parse(child.attrs.shape) } : {},
11760
- ...typeof child.attrs.placement === "string" ? { placement: JSON.parse(child.attrs.placement) } : {},
11761
- ...typeof child.attrs.textBoxText === "string" ? { textBoxText: JSON.parse(child.attrs.textBoxText) } : {},
11762
- ...child.attrs.textBoxEditable ? { textBoxEditable: true } : {},
11763
- ...child.attrs.textBoxEditable && child.attrs.textBoxBorder !== null ? { textBoxBorder: Boolean(child.attrs.textBoxBorder) } : {}
12503
+ ...child3.attrs.unsupported ? { unsupported: child3.attrs.unsupported } : {},
12504
+ ...typeof child3.attrs.diagram === "string" ? { diagram: JSON.parse(child3.attrs.diagram) } : {},
12505
+ ...typeof child3.attrs.chart === "string" ? { chart: JSON.parse(child3.attrs.chart) } : {},
12506
+ ...typeof child3.attrs.shape === "string" ? { shape: JSON.parse(child3.attrs.shape) } : {},
12507
+ ...typeof child3.attrs.placement === "string" ? { placement: JSON.parse(child3.attrs.placement) } : {},
12508
+ ...typeof child3.attrs.textBoxText === "string" ? { textBoxText: JSON.parse(child3.attrs.textBoxText) } : {},
12509
+ ...child3.attrs.textBoxEditable ? { textBoxEditable: true } : {},
12510
+ ...child3.attrs.textBoxEditable && child3.attrs.textBoxBorder !== null ? { textBoxBorder: Boolean(child3.attrs.textBoxBorder) } : {}
11764
12511
  },
11765
12512
  ...imageLink && { link: imageLink }
11766
12513
  });
11767
- applyInlineFormat(runs.at(-1), child);
12514
+ applyInlineFormat(runs.at(-1), child3);
11768
12515
  return;
11769
12516
  }
11770
- if (!child.isText && child.type.name !== "hardBreak") return;
11771
- const run = { text: child.isText ? child.text || "" : "\n" };
11772
- const link = linkFromMarks(child);
12517
+ if (!child3.isText && child3.type.name !== "hardBreak") return;
12518
+ const run = { text: child3.isText ? child3.text || "" : "\n" };
12519
+ const link = linkFromMarks(child3);
11773
12520
  if (link) run.link = link;
11774
- if (!child.isText && child.type.spec.attrs?.format) applyInlineFormat(run, child);
11775
- else applyMarkFormatting(run, child);
12521
+ if (!child3.isText && child3.type.spec.attrs?.format) applyInlineFormat(run, child3);
12522
+ else applyMarkFormatting(run, child3);
11776
12523
  const previous = runs.at(-1);
11777
12524
  const fields = [
11778
12525
  "bold",
@@ -12067,10 +12814,10 @@ function sameContent(before, after) {
12067
12814
  if (!sameContent(before.child(index), after.child(index))) return false;
12068
12815
  return true;
12069
12816
  }
12070
- function paragraphProperties(element2) {
12817
+ function paragraphProperties(element3) {
12071
12818
  for (const name of ["rPr", "sectPr", "pPrChange"])
12072
- for (const child of children2(element2, name)) element2.removeChild(child);
12073
- return element2;
12819
+ for (const child3 of children2(element3, name)) element3.removeChild(child3);
12820
+ return element3;
12074
12821
  }
12075
12822
  function properties3(node) {
12076
12823
  const paragraph = paragraphFromAttrs(node.attrs, String(node.attrs.id), []);
@@ -12157,19 +12904,19 @@ function fieldResultRanges(doc) {
12157
12904
  doc.descendants((node, pos) => {
12158
12905
  if (node.type.name !== "paragraph") return true;
12159
12906
  let open;
12160
- node.forEach((child, offset) => {
12161
- const mark = child.isText ? child.marks.find((item) => item.type === field) : void 0;
12907
+ node.forEach((child3, offset) => {
12908
+ const mark = child3.isText ? child3.marks.find((item) => item.type === field) : void 0;
12162
12909
  const start = pos + 1 + offset;
12163
- if (mark && open?.mark.eq(mark) && identityOf(open.marks) === identityOf(child.marks) && sameFieldFlags(flagsOf(open.marks), flagsOf(child.marks))) {
12164
- open.to = start + child.nodeSize;
12165
- open.text += child.text ?? "";
12910
+ if (mark && open?.mark.eq(mark) && identityOf(open.marks) === identityOf(child3.marks) && sameFieldFlags(flagsOf(open.marks), flagsOf(child3.marks))) {
12911
+ open.to = start + child3.nodeSize;
12912
+ open.text += child3.text ?? "";
12166
12913
  } else if (mark) {
12167
12914
  open = {
12168
12915
  from: start,
12169
- to: start + child.nodeSize,
12916
+ to: start + child3.nodeSize,
12170
12917
  mark,
12171
- text: child.text ?? "",
12172
- marks: child.marks
12918
+ text: child3.text ?? "",
12919
+ marks: child3.marks
12173
12920
  };
12174
12921
  runs.push(open);
12175
12922
  } else open = void 0;
@@ -12188,7 +12935,7 @@ function fieldClipboardSlice(slice) {
12188
12935
  const open = stack.pop();
12189
12936
  if (open?.valid) {
12190
12937
  complete.add(pos);
12191
- for (const child of open.positions) complete.add(child);
12938
+ for (const child3 of open.positions) complete.add(child3);
12192
12939
  }
12193
12940
  } else {
12194
12941
  const open = stack.at(-1);
@@ -12207,8 +12954,8 @@ function fieldClipboardSlice(slice) {
12207
12954
  if (node.type.name === "fieldMarker" && !complete.has(pos)) return null;
12208
12955
  if (!node.isLeaf) {
12209
12956
  const children4 = [];
12210
- node.forEach((child, offset) => {
12211
- const projected = project(child, pos + 1 + offset);
12957
+ node.forEach((child3, offset) => {
12958
+ const projected = project(child3, pos + 1 + offset);
12212
12959
  if (projected) children4.push(projected);
12213
12960
  });
12214
12961
  return node.copy(prosemirrorModel.Fragment.fromArray(children4));
@@ -12304,8 +13051,8 @@ function safeParagraph(node, allowInsertion = false) {
12304
13051
  if (node.type.name !== "paragraph" || !node.type.spec.attrs?.markRevision) return false;
12305
13052
  if (node.attrs.markRevision && !allowInsertion) return false;
12306
13053
  let fields = false;
12307
- node.descendants((child) => {
12308
- if (child.type.name === "fieldMarker" || child.marks.some((mark) => mark.type.name === "field"))
13054
+ node.descendants((child3) => {
13055
+ if (child3.type.name === "fieldMarker" || child3.marks.some((mark) => mark.type.name === "field"))
12309
13056
  fields = true;
12310
13057
  });
12311
13058
  return !fields;
@@ -12417,7 +13164,7 @@ function simpleFieldPasteSlice(slice, state) {
12417
13164
  const project = (node) => {
12418
13165
  if (node.isText) return node.mark(resultMarks(node, field));
12419
13166
  const children4 = [];
12420
- node.forEach((child) => children4.push(project(child)));
13167
+ node.forEach((child3) => children4.push(project(child3)));
12421
13168
  return node.copy(prosemirrorModel.Fragment.fromArray(children4));
12422
13169
  };
12423
13170
  const children3 = [];
@@ -13140,15 +13887,15 @@ function formFieldBeside(doc, pos) {
13140
13887
  if (!$pos.parent.isTextblock) return void 0;
13141
13888
  const open = [];
13142
13889
  let beside;
13143
- $pos.parent.forEach((child, offset) => {
13144
- if (child.type.name !== "fieldMarker") return;
13890
+ $pos.parent.forEach((child3, offset) => {
13891
+ if (child3.type.name !== "fieldMarker") return;
13145
13892
  const at = $pos.start() + offset;
13146
- if (child.attrs.kind === "begin") open.push({ begin: at, field: formFieldOfNode(child) });
13147
- else if (child.attrs.kind === "end") {
13893
+ if (child3.attrs.kind === "begin") open.push({ begin: at, field: formFieldOfNode(child3) });
13894
+ else if (child3.attrs.kind === "end") {
13148
13895
  const top = open.pop();
13149
13896
  const kind = top?.field?.kind;
13150
13897
  if (!top || kind !== "checkbox" && kind !== "dropDown") return;
13151
- if (pos >= top.begin && pos <= at + child.nodeSize && (beside === void 0 || pos === top.begin))
13898
+ if (pos >= top.begin && pos <= at + child3.nodeSize && (beside === void 0 || pos === top.begin))
13152
13899
  beside = top.begin;
13153
13900
  }
13154
13901
  });
@@ -13159,19 +13906,19 @@ function formTextResults(doc) {
13159
13906
  const open = [];
13160
13907
  doc.descendants((node, pos) => {
13161
13908
  if (!node.isTextblock) return true;
13162
- node.forEach((child, offset) => {
13909
+ node.forEach((child3, offset) => {
13163
13910
  const at = pos + 1 + offset;
13164
- if (child.type.name !== "fieldMarker") {
13911
+ if (child3.type.name !== "fieldMarker") {
13165
13912
  const top = open.at(-1);
13166
- if (top?.from !== void 0) top.length += child.isText ? child.text.length : 1;
13913
+ if (top?.from !== void 0) top.length += child3.isText ? child3.text.length : 1;
13167
13914
  return;
13168
13915
  }
13169
- if (child.attrs.kind === "begin")
13170
- open.push({ field: formFieldOfNode(child), begin: at, length: 0 });
13171
- else if (child.attrs.kind === "separate") {
13916
+ if (child3.attrs.kind === "begin")
13917
+ open.push({ field: formFieldOfNode(child3), begin: at, length: 0 });
13918
+ else if (child3.attrs.kind === "separate") {
13172
13919
  const top = open.at(-1);
13173
- if (top) top.from = at + child.nodeSize;
13174
- } else if (child.attrs.kind === "end") {
13920
+ if (top) top.from = at + child3.nodeSize;
13921
+ } else if (child3.attrs.kind === "end") {
13175
13922
  const top = open.pop();
13176
13923
  if (top?.field?.kind === "text" && top.from !== void 0)
13177
13924
  results.push({
@@ -13199,7 +13946,7 @@ var hardBreakNodeSpec = {
13199
13946
  parseDOM: [
13200
13947
  {
13201
13948
  tag: "br",
13202
- getAttrs: (el4) => ({ format: el4.dataset.runProperties ?? null })
13949
+ getAttrs: (el5) => ({ format: el5.dataset.runProperties ?? null })
13203
13950
  }
13204
13951
  ],
13205
13952
  toDOM: (node) => ["br", inlineRunPropertiesDomAttrs(node)]
@@ -13214,9 +13961,9 @@ var pageBreakNodeSpec = {
13214
13961
  parseDOM: [
13215
13962
  {
13216
13963
  tag: "span[data-docx-break]",
13217
- getAttrs: (el4) => ({
13218
- kind: el4.dataset.docxBreak === "column" ? "column" : "page",
13219
- format: el4.dataset.runProperties ?? null
13964
+ getAttrs: (el5) => ({
13965
+ kind: el5.dataset.docxBreak === "column" ? "column" : "page",
13966
+ format: el5.dataset.runProperties ?? null
13220
13967
  })
13221
13968
  }
13222
13969
  ],
@@ -13252,11 +13999,11 @@ var noteReferenceNodeSpec = {
13252
13999
  {
13253
14000
  tag: "sup[data-docx-note-kind]",
13254
14001
  priority: 60,
13255
- getAttrs: (el4) => ({
13256
- kind: el4.dataset.docxNoteKind === "endnote" ? "endnote" : "footnote",
13257
- format: el4.dataset.runProperties ?? null,
13258
- id: el4.dataset.docxNoteId || "",
13259
- number: Number(el4.textContent) || 1
14002
+ getAttrs: (el5) => ({
14003
+ kind: el5.dataset.docxNoteKind === "endnote" ? "endnote" : "footnote",
14004
+ format: el5.dataset.runProperties ?? null,
14005
+ id: el5.dataset.docxNoteId || "",
14006
+ number: Number(el5.textContent) || 1
13260
14007
  })
13261
14008
  }
13262
14009
  ],
@@ -13287,10 +14034,10 @@ var fieldMarkerNodeSpec = {
13287
14034
  parseDOM: [
13288
14035
  {
13289
14036
  tag: "span[data-field-marker]",
13290
- getAttrs: (el4) => ({
13291
- kind: el4.dataset.fieldMarker || "begin",
13292
- format: el4.dataset.runProperties ?? null,
13293
- code: el4.dataset.fieldCode ?? null
14037
+ getAttrs: (el5) => ({
14038
+ kind: el5.dataset.fieldMarker || "begin",
14039
+ format: el5.dataset.runProperties ?? null,
14040
+ code: el5.dataset.fieldCode ?? null
13294
14041
  })
13295
14042
  }
13296
14043
  ],
@@ -13881,7 +14628,7 @@ var WordYjsInlineCommentAnchors = class {
13881
14628
  if (node.isLeaf) return node;
13882
14629
  const children3 = [];
13883
14630
  node.forEach(
13884
- (child, offset) => children3.push(visit(child, pos + offset + (node.type === doc.type ? 0 : 1)))
14631
+ (child3, offset) => children3.push(visit(child3, pos + offset + (node.type === doc.type ? 0 : 1)))
13885
14632
  );
13886
14633
  return node.copy(prosemirrorModel.Fragment.fromArray(children3));
13887
14634
  };
@@ -14012,15 +14759,15 @@ var WordYjsComments = class {
14012
14759
  }
14013
14760
  };
14014
14761
  function removeSharedAnchor(fragment, id) {
14015
- for (const child of fragment.toArray()) {
14016
- if (child instanceof Y2__namespace.XmlElement) removeSharedAnchor(child, id);
14017
- else if (child instanceof Y2__namespace.XmlText) {
14762
+ for (const child3 of fragment.toArray()) {
14763
+ if (child3 instanceof Y2__namespace.XmlElement) removeSharedAnchor(child3, id);
14764
+ else if (child3 instanceof Y2__namespace.XmlText) {
14018
14765
  let offset = 0;
14019
- for (const part of child.toDelta()) {
14766
+ for (const part of child3.toDelta()) {
14020
14767
  const length = typeof part.insert === "string" ? part.insert.length : 1;
14021
14768
  for (const [key, attrs2] of Object.entries(part.attributes ?? {})) {
14022
14769
  if (key.startsWith("comment--") && Array.isArray(attrs2.ids) && attrs2.ids.includes(id))
14023
- child.format(offset, length, { [key]: null });
14770
+ child3.format(offset, length, { [key]: null });
14024
14771
  }
14025
14772
  offset += length;
14026
14773
  }
@@ -14052,14 +14799,14 @@ function independentCommentAnchors(node) {
14052
14799
  return node.mark(marks);
14053
14800
  }
14054
14801
  const children3 = [];
14055
- node.forEach((child) => children3.push(independentCommentAnchors(child)));
14802
+ node.forEach((child3) => children3.push(independentCommentAnchors(child3)));
14056
14803
  return node.type.create(node.attrs, children3, marks);
14057
14804
  }
14058
14805
  function seedEmptyParagraphText(fragment) {
14059
- for (const child of fragment.toArray()) {
14060
- if (!(child instanceof Y2__namespace.XmlElement)) continue;
14061
- if (child.nodeName === "paragraph" && child.length === 0) child.insert(0, [new Y2__namespace.XmlText()]);
14062
- else seedEmptyParagraphText(child);
14806
+ for (const child3 of fragment.toArray()) {
14807
+ if (!(child3 instanceof Y2__namespace.XmlElement)) continue;
14808
+ if (child3.nodeName === "paragraph" && child3.length === 0) child3.insert(0, [new Y2__namespace.XmlText()]);
14809
+ else seedEmptyParagraphText(child3);
14063
14810
  }
14064
14811
  }
14065
14812
  function guardDeletedNodeSelection(doc, view, binding) {
@@ -14337,8 +15084,8 @@ function tableStructureGuardPlugin() {
14337
15084
  const result = /* @__PURE__ */ new Map();
14338
15085
  if (node.type.name === "table") result.set(String(node.attrs.id), node);
14339
15086
  else if (!node.isTextblock && !node.isLeaf)
14340
- node.forEach((child) => {
14341
- for (const [id, table] of tables(child)) result.set(id, table);
15087
+ node.forEach((child3) => {
15088
+ for (const [id, table] of tables(child3)) result.set(id, table);
14342
15089
  });
14343
15090
  cache.set(node, result);
14344
15091
  return result;
@@ -14354,13 +15101,13 @@ function tableStructureGuardPlugin() {
14354
15101
  for (const attr2 of ["sourceCellKey", "colspan", "rowspan", "widthTwips"])
14355
15102
  if (cell.attrs[attr2] !== target.attrs[attr2]) return false;
14356
15103
  for (let i = 0; i < cell.childCount; i++) {
14357
- const child = cell.child(i), other = target.child(i);
14358
- if (child.type !== other.type) return false;
14359
- if (child.type.name === "paragraph") {
14360
- if (child.attrs.id !== other.attrs.id) return false;
14361
- } else if (child.type.name === "table") {
14362
- if (!child.sameMarkup(other) || !sameStructure(child, other)) return false;
14363
- } else if (!child.eq(other)) return false;
15104
+ const child3 = cell.child(i), other = target.child(i);
15105
+ if (child3.type !== other.type) return false;
15106
+ if (child3.type.name === "paragraph") {
15107
+ if (child3.attrs.id !== other.attrs.id) return false;
15108
+ } else if (child3.type.name === "table") {
15109
+ if (!child3.sameMarkup(other) || !sameStructure(child3, other)) return false;
15110
+ } else if (!child3.eq(other)) return false;
14364
15111
  }
14365
15112
  }
14366
15113
  }
@@ -14426,18 +15173,18 @@ var insertWordHardBreak = (state, dispatch, view) => {
14426
15173
 
14427
15174
  // docx/ui/chart-spec.ts
14428
15175
  var SVG_NS2 = "http://www.w3.org/2000/svg";
14429
- function elementSpec(element2, root) {
15176
+ function elementSpec(element3, root) {
14430
15177
  const attrs2 = {};
14431
- for (const attr2 of Array.from(element2.attributes)) {
15178
+ for (const attr2 of Array.from(element3.attributes)) {
14432
15179
  if (attr2.name === "xmlns" || attr2.name.startsWith("xmlns:") || /^on/i.test(attr2.name)) continue;
14433
15180
  attrs2[attr2.name] = attr2.value;
14434
15181
  }
14435
15182
  const children3 = [];
14436
- for (const child of Array.from(element2.childNodes)) {
14437
- if (isElement(child)) children3.push(elementSpec(child, false));
14438
- else if (child.nodeType === 3 && child.nodeValue) children3.push(child.nodeValue);
15183
+ for (const child3 of Array.from(element3.childNodes)) {
15184
+ if (isElement(child3)) children3.push(elementSpec(child3, false));
15185
+ else if (child3.nodeType === 3 && child3.nodeValue) children3.push(child3.nodeValue);
14439
15186
  }
14440
- const tag = root ? `${SVG_NS2} ${element2.localName}` : element2.localName;
15187
+ const tag = root ? `${SVG_NS2} ${element3.localName}` : element3.localName;
14441
15188
  return [tag, attrs2, ...children3];
14442
15189
  }
14443
15190
  function svgMarkupSpec(svg) {
@@ -14543,17 +15290,17 @@ var imageNodeSpec = {
14543
15290
  parseDOM: [
14544
15291
  {
14545
15292
  tag: "img[data-docx-image], span[data-docx-image-placeholder]",
14546
- getAttrs: (el4) => ({
14547
- format: el4.dataset.runProperties ?? null,
14548
- relId: el4.dataset.relId || "",
14549
- partName: el4.dataset.partName || "",
14550
- contentType: el4.dataset.contentType || "",
14551
- widthPx: Number(el4.dataset.widthPx) || 96,
14552
- heightPx: Number(el4.dataset.heightPx) || 96,
14553
- altText: el4.getAttribute("alt") || null,
14554
- title: el4.getAttribute("title") || null,
14555
- anchored: el4.dataset.anchored === "1",
14556
- unsupported: el4.dataset.unsupported || null
15293
+ getAttrs: (el5) => ({
15294
+ format: el5.dataset.runProperties ?? null,
15295
+ relId: el5.dataset.relId || "",
15296
+ partName: el5.dataset.partName || "",
15297
+ contentType: el5.dataset.contentType || "",
15298
+ widthPx: Number(el5.dataset.widthPx) || 96,
15299
+ heightPx: Number(el5.dataset.heightPx) || 96,
15300
+ altText: el5.getAttribute("alt") || null,
15301
+ title: el5.getAttribute("title") || null,
15302
+ anchored: el5.dataset.anchored === "1",
15303
+ unsupported: el5.dataset.unsupported || null
14557
15304
  })
14558
15305
  }
14559
15306
  ],
@@ -14604,10 +15351,10 @@ var linkMarkSpec = {
14604
15351
  parseDOM: [
14605
15352
  {
14606
15353
  tag: "a[data-docx-link]",
14607
- getAttrs: (el4) => ({
14608
- href: el4.dataset.href || (el4.dataset.anchor ? null : el4.getAttribute("href")) || null,
14609
- anchor: el4.dataset.anchor || null,
14610
- tooltip: el4.getAttribute("title") || null
15354
+ getAttrs: (el5) => ({
15355
+ href: el5.dataset.href || (el5.dataset.anchor ? null : el5.getAttribute("href")) || null,
15356
+ anchor: el5.dataset.anchor || null,
15357
+ tooltip: el5.getAttribute("title") || null
14611
15358
  })
14612
15359
  }
14613
15360
  ],
@@ -14632,11 +15379,11 @@ function wordLinkRangeAt(state, pos) {
14632
15379
  const $pos = state.doc.resolve(pos);
14633
15380
  const items = [];
14634
15381
  let cursor = $pos.start();
14635
- $pos.parent.forEach((child) => {
14636
- const target = inlineNodeRun(child)?.link;
15382
+ $pos.parent.forEach((child3) => {
15383
+ const target = inlineNodeRun(child3)?.link;
14637
15384
  const link = target ? type.create(target) : void 0;
14638
- items.push({ from: cursor, to: cursor + child.nodeSize, ...link && { link } });
14639
- cursor += child.nodeSize;
15385
+ items.push({ from: cursor, to: cursor + child3.nodeSize, ...link && { link } });
15386
+ cursor += child3.nodeSize;
14640
15387
  });
14641
15388
  let index = items.findIndex((item) => item.link && item.from <= pos && pos < item.to);
14642
15389
  if (index < 0) index = items.findIndex((item) => item.link && item.from < pos && pos <= item.to);
@@ -14813,6 +15560,45 @@ function resolveNoteRevisions(doc, resolvedBody, mode) {
14813
15560
  const value = notePartsJson(next);
14814
15561
  return value !== notePartsJson(notesModel(doc)) ? new NotePartsStep(value) : void 0;
14815
15562
  }
15563
+ function selectedChart(state) {
15564
+ const { selection } = state;
15565
+ if (!(selection instanceof prosemirrorState.NodeSelection) || selection.node.type.name !== "image")
15566
+ return void 0;
15567
+ const chart = nodeChart(selection.node);
15568
+ if (!chart) return void 0;
15569
+ return { pos: selection.from, node: selection.node, chart, editable: isDocxChartEditable(chart) };
15570
+ }
15571
+ function replaceSelectedChart(state, chart) {
15572
+ const selected = selectedChart(state);
15573
+ if (!selected) return null;
15574
+ const tr = state.tr.setNodeMarkup(selected.pos, void 0, {
15575
+ ...selected.node.attrs,
15576
+ chart: JSON.stringify(chart)
15577
+ });
15578
+ return prosemirrorHistory.closeHistory(tr.setSelection(prosemirrorState.NodeSelection.create(tr.doc, selected.pos)));
15579
+ }
15580
+ function insertChartImage(state, image) {
15581
+ const type = state.schema.nodes.image;
15582
+ if (!type || !image.chart) return null;
15583
+ const node = type.create({
15584
+ relId: image.relId,
15585
+ partName: image.partName,
15586
+ contentType: image.contentType,
15587
+ widthPx: image.widthPx,
15588
+ heightPx: image.heightPx,
15589
+ altText: image.altText ?? null,
15590
+ title: image.title ?? null,
15591
+ anchored: false,
15592
+ unsupported: image.unsupported ?? "Chart",
15593
+ chart: JSON.stringify(image.chart)
15594
+ });
15595
+ const tr = prosemirrorHistory.closeHistory(state.tr.replaceSelectionWith(node, false));
15596
+ const pos = tr.mapping.map(state.selection.from, -1);
15597
+ const at = tr.doc.nodeAt(pos)?.type === type ? pos : tr.selection.from - node.nodeSize;
15598
+ if (at >= 0 && tr.doc.nodeAt(at)?.type === type)
15599
+ tr.setSelection(prosemirrorState.NodeSelection.create(tr.doc, at));
15600
+ return prosemirrorHistory.closeHistory(tr.scrollIntoView());
15601
+ }
14816
15602
 
14817
15603
  // docx/ui/node-numbering.ts
14818
15604
  function nodeNumbering(node, model) {
@@ -14859,8 +15645,8 @@ var reviewMarks = {
14859
15645
  parseDOM: [
14860
15646
  {
14861
15647
  tag: "span[data-inline-comment-ids]",
14862
- getAttrs: (el4) => ({
14863
- ids: (el4.dataset.inlineCommentIds ?? "").split(",").filter(Boolean)
15648
+ getAttrs: (el5) => ({
15649
+ ids: (el5.dataset.inlineCommentIds ?? "").split(",").filter(Boolean)
14864
15650
  })
14865
15651
  }
14866
15652
  ],
@@ -14888,11 +15674,11 @@ var reviewMarks = {
14888
15674
  parseDOM: [
14889
15675
  {
14890
15676
  tag: "ins[data-revision-id]",
14891
- getAttrs: (el4) => ({
14892
- author: el4.dataset.author || "",
14893
- date: el4.dataset.date || null,
14894
- dateUtc: el4.dataset.dateUtc || null,
14895
- id: el4.dataset.revisionId || "",
15677
+ getAttrs: (el5) => ({
15678
+ author: el5.dataset.author || "",
15679
+ date: el5.dataset.date || null,
15680
+ dateUtc: el5.dataset.dateUtc || null,
15681
+ id: el5.dataset.revisionId || "",
14896
15682
  move: null
14897
15683
  })
14898
15684
  }
@@ -14923,11 +15709,11 @@ var reviewMarks = {
14923
15709
  parseDOM: [
14924
15710
  {
14925
15711
  tag: "del[data-revision-id]",
14926
- getAttrs: (el4) => ({
14927
- author: el4.dataset.author || "",
14928
- date: el4.dataset.date || null,
14929
- dateUtc: el4.dataset.dateUtc || null,
14930
- id: el4.dataset.revisionId || "",
15712
+ getAttrs: (el5) => ({
15713
+ author: el5.dataset.author || "",
15714
+ date: el5.dataset.date || null,
15715
+ dateUtc: el5.dataset.dateUtc || null,
15716
+ id: el5.dataset.revisionId || "",
14931
15717
  move: null
14932
15718
  })
14933
15719
  }
@@ -14953,8 +15739,8 @@ var reviewMarks = {
14953
15739
  parseDOM: [
14954
15740
  {
14955
15741
  tag: "span[data-comment-ids]",
14956
- getAttrs: (el4) => ({
14957
- ids: (el4.dataset.commentIds || "").split(",").filter(Boolean)
15742
+ getAttrs: (el5) => ({
15743
+ ids: (el5.dataset.commentIds || "").split(",").filter(Boolean)
14958
15744
  })
14959
15745
  }
14960
15746
  ],
@@ -15466,12 +16252,25 @@ var RIBBON_ACTION_IDS = [
15466
16252
  "drop-cap",
15467
16253
  "content-control",
15468
16254
  "shapes",
16255
+ "insert-smartart",
16256
+ "add-smartart-shape",
16257
+ "smartart-text-pane",
16258
+ "promote-smartart-shape",
16259
+ "demote-smartart-shape",
16260
+ "move-smartart-shape-up",
16261
+ "move-smartart-shape-down",
16262
+ "change-smartart-layout",
15469
16263
  "shape-fill",
15470
16264
  "shape-outline",
15471
16265
  "shape-outline-weight",
15472
16266
  "wrap-text",
15473
16267
  "shape-height",
15474
16268
  "shape-width",
16269
+ "insert-chart",
16270
+ "chart-legend",
16271
+ "edit-chart-data",
16272
+ "change-chart-type",
16273
+ "format-chart-selection",
15475
16274
  "equation",
15476
16275
  "change-case",
15477
16276
  "format-painter",
@@ -15647,12 +16446,25 @@ var RIBBON_ACTION_LABELS = {
15647
16446
  "drop-cap": "Drop cap",
15648
16447
  "content-control": "Content control",
15649
16448
  shapes: "Shapes",
16449
+ "insert-smartart": "Insert SmartArt",
16450
+ "add-smartart-shape": "Add Shape",
16451
+ "smartart-text-pane": "Text Pane",
16452
+ "promote-smartart-shape": "Promote",
16453
+ "demote-smartart-shape": "Demote",
16454
+ "move-smartart-shape-up": "Move Up",
16455
+ "move-smartart-shape-down": "Move Down",
16456
+ "change-smartart-layout": "Change Layout",
15650
16457
  "shape-fill": "Shape fill",
15651
16458
  "shape-outline": "Shape outline",
15652
16459
  "shape-outline-weight": "Shape outline weight",
15653
16460
  "wrap-text": "Wrap text",
15654
16461
  "shape-height": "Shape height (inches)",
15655
16462
  "shape-width": "Shape width (inches)",
16463
+ "insert-chart": "Insert chart",
16464
+ "chart-legend": "Legend",
16465
+ "edit-chart-data": "Edit Data",
16466
+ "change-chart-type": "Change Chart Type",
16467
+ "format-chart-selection": "Format Selection",
15656
16468
  equation: "Equation",
15657
16469
  "change-case": "Change case",
15658
16470
  "format-painter": "Format painter",
@@ -15940,8 +16752,8 @@ var markSpecs = {
15940
16752
  parseDOM: [
15941
16753
  {
15942
16754
  tag: 'span[style*="background-color"]',
15943
- getAttrs: (el4) => {
15944
- const color = el4.style.backgroundColor.toLowerCase();
16755
+ getAttrs: (el5) => {
16756
+ const color = el5.style.backgroundColor.toLowerCase();
15945
16757
  if (color === "white" || color === "rgb(255, 255, 255)" || color === "#ffffff")
15946
16758
  return false;
15947
16759
  const entry = Object.entries(wordHighlightColors).find(([, css]) => {
@@ -15978,10 +16790,10 @@ var markSpecs = {
15978
16790
  parseDOM: [
15979
16791
  {
15980
16792
  tag: "span[lang], span[data-docx-east-asia-language], span[data-docx-bidi-language]",
15981
- getAttrs: (el4) => ({
15982
- language: el4.getAttribute("lang"),
15983
- eastAsiaLanguage: el4.dataset.docxEastAsiaLanguage || null,
15984
- bidiLanguage: el4.dataset.docxBidiLanguage || null
16793
+ getAttrs: (el5) => ({
16794
+ language: el5.getAttribute("lang"),
16795
+ eastAsiaLanguage: el5.dataset.docxEastAsiaLanguage || null,
16796
+ bidiLanguage: el5.dataset.docxBidiLanguage || null
15985
16797
  })
15986
16798
  }
15987
16799
  ],
@@ -16011,8 +16823,8 @@ var markSpecs = {
16011
16823
  parseDOM: [
16012
16824
  {
16013
16825
  tag: "span",
16014
- getAttrs: (el4) => {
16015
- const style = el4.style;
16826
+ getAttrs: (el5) => {
16827
+ const style = el5.style;
16016
16828
  const attrs2 = {
16017
16829
  family: pastedFontFamily(style.fontFamily),
16018
16830
  size: style.fontSize ? parseFontSize(style.fontSize) : null,
@@ -16040,7 +16852,7 @@ var markSpecs = {
16040
16852
  parseDOM: [
16041
16853
  {
16042
16854
  tag: "span[data-docx-style]",
16043
- getAttrs: (el4) => ({ id: el4.dataset.docxStyle || null })
16855
+ getAttrs: (el5) => ({ id: el5.dataset.docxStyle || null })
16044
16856
  }
16045
16857
  ],
16046
16858
  toDOM: (mark) => ["span", { "data-docx-style": mark.attrs.id }, 0]
@@ -16052,8 +16864,8 @@ var markSpecs = {
16052
16864
  {
16053
16865
  tag: "span[data-sdt]",
16054
16866
  // Only a control is taken from (pasted) HTML; the span's text stays either way.
16055
- getAttrs: (el4) => {
16056
- const control = controlFromData(el4.dataset.sdt, "inline");
16867
+ getAttrs: (el5) => {
16868
+ const control = controlFromData(el5.dataset.sdt, "inline");
16057
16869
  return control ? { data: JSON.stringify(control) } : false;
16058
16870
  }
16059
16871
  }
@@ -16067,9 +16879,9 @@ var markSpecs = {
16067
16879
  parseDOM: [
16068
16880
  {
16069
16881
  tag: "span[data-field]",
16070
- getAttrs: (el4) => ({
16071
- instr: el4.dataset.field || "",
16072
- simple: el4.dataset.fieldSimple === "1"
16882
+ getAttrs: (el5) => ({
16883
+ instr: el5.dataset.field || "",
16884
+ simple: el5.dataset.fieldSimple === "1"
16073
16885
  })
16074
16886
  }
16075
16887
  ],
@@ -16134,6 +16946,17 @@ function themeDrawing(drawing, theme) {
16134
16946
  };
16135
16947
  }
16136
16948
 
16949
+ // docx/ui/smartart-approximate.ts
16950
+ function approximateDiagramDrawing(diagram) {
16951
+ return approximateDiagramDrawingFromNodes({
16952
+ extentEmu: diagram.extentEmu,
16953
+ nodes: diagram.nodes,
16954
+ layoutId: diagram.layout?.uniqueId,
16955
+ family: diagram.layout?.family,
16956
+ colorsId: diagram.colorsId
16957
+ });
16958
+ }
16959
+
16137
16960
  // docx/ui/table-render.ts
16138
16961
  var NONE_STYLES = /* @__PURE__ */ new Set(["none", "nil"]);
16139
16962
  function cssBorderStyle(style) {
@@ -16349,7 +17172,7 @@ function documentWordCount(node, locale) {
16349
17172
  if (value !== void 0) return value;
16350
17173
  let count = 0;
16351
17174
  if (node.isTextblock) count = countWords(node.textBetween(0, node.content.size, " "), locale);
16352
- else node.forEach((child) => count += documentWordCount(child, locale));
17175
+ else node.forEach((child3) => count += documentWordCount(child3, locale));
16353
17176
  const counts = cached2 ?? /* @__PURE__ */ new Map();
16354
17177
  counts.set(key, count);
16355
17178
  documentCounts.set(node, counts);
@@ -16735,6 +17558,7 @@ exports.applyMarkFormatting = applyMarkFormatting;
16735
17558
  exports.applyRunFormattingPatch = applyRunFormattingPatch;
16736
17559
  exports.applyThemeColors = applyThemeColors;
16737
17560
  exports.applyWordLink = applyWordLink;
17561
+ exports.approximateDiagramDrawing = approximateDiagramDrawing;
16738
17562
  exports.authorColor = authorColor;
16739
17563
  exports.backstageFocus = backstageFocus;
16740
17564
  exports.chartNodeSpec = chartNodeSpec;
@@ -16795,6 +17619,7 @@ exports.hasChangeAtCursor = hasChangeAtCursor;
16795
17619
  exports.hasNoteRevisions = hasNoteRevisions;
16796
17620
  exports.imageNodeSpec = imageNodeSpec;
16797
17621
  exports.inlineNodeRun = inlineNodeRun;
17622
+ exports.insertChartImage = insertChartImage;
16798
17623
  exports.insertContentControl = insertContentControl;
16799
17624
  exports.insertWordHardBreak = insertWordHardBreak;
16800
17625
  exports.insertedTextMarks = insertedTextMarks;
@@ -16839,6 +17664,7 @@ exports.repairCollaborativeDocumentIds = repairCollaborativeDocumentIds;
16839
17664
  exports.repairCollaborativeParagraphIds = repairCollaborativeParagraphIds;
16840
17665
  exports.replaceAroundMarkers = replaceAroundMarkers;
16841
17666
  exports.replaceControlContent = replaceControlContent;
17667
+ exports.replaceSelectedChart = replaceSelectedChart;
16842
17668
  exports.replyToComment = replyToComment;
16843
17669
  exports.resolveCellVisuals = resolveCellVisuals;
16844
17670
  exports.resolveComment = resolveComment;
@@ -16853,6 +17679,7 @@ exports.sameJson = sameJson2;
16853
17679
  exports.sameRuns = sameRuns;
16854
17680
  exports.sectionPartsJson = sectionPartsJson;
16855
17681
  exports.selectFormDropDownAt = selectFormDropDownAt;
17682
+ exports.selectedChart = selectedChart;
16856
17683
  exports.setCommentThreads = setCommentThreads;
16857
17684
  exports.setReviewRecordingPreferences = setReviewRecordingPreferences;
16858
17685
  exports.staysInFormFields = staysInFormFields;