ooxml-core 1.37.0 → 1.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (335) hide show
  1. package/README.md +7 -0
  2. package/dist/automation/index.cjs +207 -207
  3. package/dist/automation/index.mjs +207 -207
  4. package/dist/{chunk-M2DFN3SP.mjs → chunk-XBIZIBTJ.mjs} +507 -10
  5. package/dist/collab/merge-values.d.ts +14 -0
  6. package/dist/collab/merge-values.d.ts.map +1 -0
  7. package/dist/docx/embedded.cjs +476 -474
  8. package/dist/docx/embedded.mjs +476 -474
  9. package/dist/docx/index.cjs +1075 -719
  10. package/dist/docx/index.d.ts +1 -0
  11. package/dist/docx/index.d.ts.map +1 -1
  12. package/dist/docx/index.mjs +1075 -720
  13. package/dist/docx/layout/index.cjs +4 -0
  14. package/dist/docx/layout/index.mjs +4 -0
  15. package/dist/docx/load/index.cjs +164 -164
  16. package/dist/docx/load/index.mjs +164 -164
  17. package/dist/docx/merge-snapshots.d.ts +9 -0
  18. package/dist/docx/merge-snapshots.d.ts.map +1 -0
  19. package/dist/docx/ui/index.cjs +155 -155
  20. package/dist/docx/ui/index.mjs +155 -155
  21. package/dist/embedding/index.cjs +207 -0
  22. package/dist/embedding/index.d.ts +3 -0
  23. package/dist/embedding/index.d.ts.map +1 -1
  24. package/dist/embedding/index.mjs +205 -1
  25. package/dist/embedding/onedrive/client.d.ts +4 -0
  26. package/dist/embedding/onedrive/client.d.ts.map +1 -0
  27. package/dist/embedding/onedrive/index.cjs +617 -0
  28. package/dist/embedding/onedrive/index.d.ts +6 -0
  29. package/dist/embedding/onedrive/index.d.ts.map +1 -0
  30. package/dist/embedding/onedrive/index.mjs +611 -0
  31. package/dist/embedding/onedrive/metadata.d.ts +6 -0
  32. package/dist/embedding/onedrive/metadata.d.ts.map +1 -0
  33. package/dist/embedding/onedrive/requests.d.ts +8 -0
  34. package/dist/embedding/onedrive/requests.d.ts.map +1 -0
  35. package/dist/embedding/onedrive/session.d.ts +4 -0
  36. package/dist/embedding/onedrive/session.d.ts.map +1 -0
  37. package/dist/embedding/onedrive/transport.d.ts +9 -0
  38. package/dist/embedding/onedrive/transport.d.ts.map +1 -0
  39. package/dist/embedding/onedrive/types.d.ts +86 -0
  40. package/dist/embedding/onedrive/types.d.ts.map +1 -0
  41. package/dist/embedding/onedrive/upload.d.ts +3 -0
  42. package/dist/embedding/onedrive/upload.d.ts.map +1 -0
  43. package/dist/embedding/storage-merge.d.ts +8 -0
  44. package/dist/embedding/storage-merge.d.ts.map +1 -0
  45. package/dist/embedding/storage-session.d.ts +7 -0
  46. package/dist/embedding/storage-session.d.ts.map +1 -0
  47. package/dist/embedding/versioned-storage.d.ts +67 -0
  48. package/dist/embedding/versioned-storage.d.ts.map +1 -0
  49. package/dist/index.cjs +1013 -340
  50. package/dist/index.mjs +1013 -340
  51. package/dist/opc/index.cjs +680 -216
  52. package/dist/opc/index.d.ts +1 -0
  53. package/dist/opc/index.d.ts.map +1 -1
  54. package/dist/opc/index.mjs +680 -217
  55. package/dist/opc/merge-snapshots.d.ts +26 -0
  56. package/dist/opc/merge-snapshots.d.ts.map +1 -0
  57. package/dist/pptx/automation/index.cjs +20 -6
  58. package/dist/pptx/automation/index.d.ts +8 -17
  59. package/dist/pptx/automation/index.d.ts.map +1 -1
  60. package/dist/pptx/automation/index.mjs +1 -1
  61. package/dist/pptx/automation/schemas/chart-formatting-schemas.d.ts +1 -3
  62. package/dist/pptx/automation/schemas/chart-formatting-schemas.d.ts.map +1 -1
  63. package/dist/pptx/automation/schemas/chart-schemas.d.ts +1 -3
  64. package/dist/pptx/automation/schemas/chart-schemas.d.ts.map +1 -1
  65. package/dist/pptx/automation/schemas/chart-user-shape-schemas.d.ts +1 -3
  66. package/dist/pptx/automation/schemas/chart-user-shape-schemas.d.ts.map +1 -1
  67. package/dist/pptx/automation/schemas/element-schemas.d.ts +1 -3
  68. package/dist/pptx/automation/schemas/element-schemas.d.ts.map +1 -1
  69. package/dist/pptx/automation/schemas/export-schemas.d.ts +1 -3
  70. package/dist/pptx/automation/schemas/export-schemas.d.ts.map +1 -1
  71. package/dist/pptx/automation/schemas/geometry-schemas.d.ts +1 -3
  72. package/dist/pptx/automation/schemas/geometry-schemas.d.ts.map +1 -1
  73. package/dist/pptx/automation/schemas/hyperlink-schemas.d.ts +1 -3
  74. package/dist/pptx/automation/schemas/hyperlink-schemas.d.ts.map +1 -1
  75. package/dist/pptx/automation/schemas/index.d.ts +1 -3
  76. package/dist/pptx/automation/schemas/index.d.ts.map +1 -1
  77. package/dist/pptx/automation/schemas/json-schemas.d.ts +1 -3
  78. package/dist/pptx/automation/schemas/json-schemas.d.ts.map +1 -1
  79. package/dist/pptx/automation/schemas/layout-schemas.d.ts +1 -3
  80. package/dist/pptx/automation/schemas/layout-schemas.d.ts.map +1 -1
  81. package/dist/pptx/automation/schemas/lock-schemas.d.ts +1 -3
  82. package/dist/pptx/automation/schemas/lock-schemas.d.ts.map +1 -1
  83. package/dist/pptx/automation/schemas/metadata-schemas.d.ts +1 -3
  84. package/dist/pptx/automation/schemas/metadata-schemas.d.ts.map +1 -1
  85. package/dist/pptx/automation/schemas/ole-schemas.d.ts +1 -3
  86. package/dist/pptx/automation/schemas/ole-schemas.d.ts.map +1 -1
  87. package/dist/pptx/automation/schemas/presentation-schemas.d.ts +1 -3
  88. package/dist/pptx/automation/schemas/presentation-schemas.d.ts.map +1 -1
  89. package/dist/pptx/automation/schemas/section-schemas.d.ts +1 -3
  90. package/dist/pptx/automation/schemas/section-schemas.d.ts.map +1 -1
  91. package/dist/pptx/automation/schemas/slide-schemas.d.ts +1 -3
  92. package/dist/pptx/automation/schemas/slide-schemas.d.ts.map +1 -1
  93. package/dist/pptx/automation/schemas/smartart-schemas.d.ts +1 -3
  94. package/dist/pptx/automation/schemas/smartart-schemas.d.ts.map +1 -1
  95. package/dist/pptx/automation/schemas/table-style-schemas.d.ts +1 -3
  96. package/dist/pptx/automation/schemas/table-style-schemas.d.ts.map +1 -1
  97. package/dist/pptx/automation/schemas/template-schemas.d.ts +1 -3
  98. package/dist/pptx/automation/schemas/template-schemas.d.ts.map +1 -1
  99. package/dist/pptx/automation/schemas/theme-schemas.d.ts +1 -3
  100. package/dist/pptx/automation/schemas/theme-schemas.d.ts.map +1 -1
  101. package/dist/pptx/automation/schemas/validation-schemas.d.ts +1 -3
  102. package/dist/pptx/automation/schemas/validation-schemas.d.ts.map +1 -1
  103. package/dist/pptx/chunks/{collaboration-text-codec-Du_XeE_i.d.ts → collaboration-text-codec-1VmwD3yq.d.ts} +1 -3
  104. package/dist/pptx/chunks/collaboration-text-codec-1VmwD3yq.d.ts.map +1 -0
  105. package/dist/pptx/chunks/{collaboration-text-merge-DWWWdT_t.d.ts → collaboration-text-merge-B-tth-0W.d.ts} +2 -4
  106. package/dist/pptx/chunks/collaboration-text-merge-B-tth-0W.d.ts.map +1 -0
  107. package/dist/pptx/chunks/{collaboration-text-positions-MMT3GkZi.d.ts → collaboration-text-positions-D-1Jo1Fz.d.ts} +1 -3
  108. package/dist/pptx/chunks/collaboration-text-positions-D-1Jo1Fz.d.ts.map +1 -0
  109. package/dist/pptx/chunks/{collaboration-text-session-D0NOLQk7.d.ts → collaboration-text-session-CWHTaWF4.d.ts} +4 -6
  110. package/dist/pptx/chunks/collaboration-text-session-CWHTaWF4.d.ts.map +1 -0
  111. package/dist/pptx/chunks/{collaboration-text-session-delta-CzJGrTKJ.d.ts → collaboration-text-session-delta-Dxzybssp.d.ts} +2 -4
  112. package/dist/pptx/chunks/collaboration-text-session-delta-Dxzybssp.d.ts.map +1 -0
  113. package/dist/pptx/chunks/{color-ref-DT599vEx.d.ts → color-ref-CwUQoKPJ.d.ts} +1 -3
  114. package/dist/pptx/chunks/color-ref-CwUQoKPJ.d.ts.map +1 -0
  115. package/dist/pptx/chunks/{elements-f3UbFph-.d.ts → elements-DheCTwi0.d.ts} +4 -54
  116. package/dist/pptx/chunks/elements-DheCTwi0.d.ts.map +1 -0
  117. package/dist/pptx/chunks/{index-Bp-1pGo1.d.ts → index-B4ofjG6_.d.ts} +6 -384
  118. package/dist/pptx/chunks/index-B4ofjG6_.d.ts.map +1 -0
  119. package/dist/pptx/chunks/{index-BnH2QjYm.d.ts → index-Jcce8TlI.d.ts} +5 -37
  120. package/dist/pptx/chunks/index-Jcce8TlI.d.ts.map +1 -0
  121. package/dist/pptx/chunks/{index-pLLN4OTz.d.ts → index-bgj0Ztnq.d.ts} +23 -543
  122. package/dist/pptx/chunks/index-bgj0Ztnq.d.ts.map +1 -0
  123. package/dist/pptx/chunks/{inspection-status-DjiWd_Aa.d.ts → inspection-status-TKac7eqb.d.ts} +1 -13
  124. package/dist/pptx/chunks/inspection-status-TKac7eqb.d.ts.map +1 -0
  125. package/dist/pptx/chunks/{schemas-fuDGetRe.d.ts → schemas-LHsDbVOw.d.ts} +1 -29
  126. package/dist/pptx/chunks/schemas-LHsDbVOw.d.ts.map +1 -0
  127. package/dist/pptx/chunks/{smart-art-CmOrPLLQ.d.ts → smart-art-DB37AsFP.d.ts} +2 -46
  128. package/dist/pptx/chunks/smart-art-DB37AsFP.d.ts.map +1 -0
  129. package/dist/pptx/chunks/{text-operations-D5sgspO6.d.ts → text-operations-CdgEnFuK.d.ts} +4 -32
  130. package/dist/pptx/chunks/text-operations-CdgEnFuK.d.ts.map +1 -0
  131. package/dist/pptx/chunks/{text-P9xVnXXf.d.ts → text-t_wJ2OwM.d.ts} +2 -12
  132. package/dist/pptx/chunks/text-t_wJ2OwM.d.ts.map +1 -0
  133. package/dist/pptx/cli/index.cjs +20 -6
  134. package/dist/pptx/cli/index.d.ts +1 -3
  135. package/dist/pptx/cli/index.d.ts.map +1 -1
  136. package/dist/pptx/converter/index.cjs +7 -0
  137. package/dist/pptx/converter/index.d.ts +1 -1
  138. package/dist/pptx/editor/ai/table-merge.d.ts +0 -2
  139. package/dist/pptx/editor/ai/table-merge.d.ts.map +1 -1
  140. package/dist/pptx/editor/loader/element-patch-walker.d.ts +0 -2
  141. package/dist/pptx/editor/loader/element-patch-walker.d.ts.map +1 -1
  142. package/dist/pptx/editor/loader/is-external-url.d.ts +0 -2
  143. package/dist/pptx/editor/loader/is-external-url.d.ts.map +1 -1
  144. package/dist/pptx/editor/loader/lazy-image-resolution.d.ts +0 -2
  145. package/dist/pptx/editor/loader/lazy-image-resolution.d.ts.map +1 -1
  146. package/dist/pptx/editor/loader/load-content-helpers.d.ts +0 -2
  147. package/dist/pptx/editor/loader/load-content-helpers.d.ts.map +1 -1
  148. package/dist/pptx/editor/loader/table-style-image-paths.d.ts +0 -2
  149. package/dist/pptx/editor/loader/table-style-image-paths.d.ts.map +1 -1
  150. package/dist/pptx/editor/loader/text-fill-image-paths.d.ts +0 -2
  151. package/dist/pptx/editor/loader/text-fill-image-paths.d.ts.map +1 -1
  152. package/dist/pptx/editor/render/bullet-list.d.ts +0 -2
  153. package/dist/pptx/editor/render/bullet-list.d.ts.map +1 -1
  154. package/dist/pptx/editor/render/bullet-toggle.d.ts +0 -2
  155. package/dist/pptx/editor/render/bullet-toggle.d.ts.map +1 -1
  156. package/dist/pptx/editor/render/chart-user-shape-edit.d.ts +0 -2
  157. package/dist/pptx/editor/render/chart-user-shape-edit.d.ts.map +1 -1
  158. package/dist/pptx/editor/render/clone.d.ts +0 -2
  159. package/dist/pptx/editor/render/clone.d.ts.map +1 -1
  160. package/dist/pptx/editor/render/collaboration-active-session.d.ts +0 -2
  161. package/dist/pptx/editor/render/collaboration-active-session.d.ts.map +1 -1
  162. package/dist/pptx/editor/render/collaboration-departure.d.ts +0 -2
  163. package/dist/pptx/editor/render/collaboration-departure.d.ts.map +1 -1
  164. package/dist/pptx/editor/render/collaboration-live-patch-target.d.ts +0 -2
  165. package/dist/pptx/editor/render/collaboration-live-patch-target.d.ts.map +1 -1
  166. package/dist/pptx/editor/render/collaboration-load-origin.d.ts +0 -2
  167. package/dist/pptx/editor/render/collaboration-load-origin.d.ts.map +1 -1
  168. package/dist/pptx/editor/render/collaboration-reconcile.d.ts +0 -2
  169. package/dist/pptx/editor/render/collaboration-reconcile.d.ts.map +1 -1
  170. package/dist/pptx/editor/render/collaboration-sync.d.ts +4 -8
  171. package/dist/pptx/editor/render/collaboration-sync.d.ts.map +1 -1
  172. package/dist/pptx/editor/render/collaboration-text-codec.d.ts +1 -1
  173. package/dist/pptx/editor/render/collaboration-text-lease.d.ts +0 -2
  174. package/dist/pptx/editor/render/collaboration-text-lease.d.ts.map +1 -1
  175. package/dist/pptx/editor/render/collaboration-text-merge.d.ts +1 -1
  176. package/dist/pptx/editor/render/collaboration-text-native-edit.d.ts +2 -4
  177. package/dist/pptx/editor/render/collaboration-text-native-edit.d.ts.map +1 -1
  178. package/dist/pptx/editor/render/collaboration-text-positions.d.ts +1 -1
  179. package/dist/pptx/editor/render/collaboration-text-projection.d.ts +1 -3
  180. package/dist/pptx/editor/render/collaboration-text-projection.d.ts.map +1 -1
  181. package/dist/pptx/editor/render/collaboration-text-session-apply.d.ts +3 -5
  182. package/dist/pptx/editor/render/collaboration-text-session-apply.d.ts.map +1 -1
  183. package/dist/pptx/editor/render/collaboration-text-session-delta.d.ts +1 -1
  184. package/dist/pptx/editor/render/collaboration-text-session-paragraph.d.ts +1 -3
  185. package/dist/pptx/editor/render/collaboration-text-session-paragraph.d.ts.map +1 -1
  186. package/dist/pptx/editor/render/collaboration-text-session.d.ts +1 -1
  187. package/dist/pptx/editor/render/collaboration-text-snapshot-positions.d.ts +2 -4
  188. package/dist/pptx/editor/render/collaboration-text-snapshot-positions.d.ts.map +1 -1
  189. package/dist/pptx/editor/render/custom-show-operations.d.ts +0 -2
  190. package/dist/pptx/editor/render/custom-show-operations.d.ts.map +1 -1
  191. package/dist/pptx/editor/render/deck-save-encryption.d.ts +0 -2
  192. package/dist/pptx/editor/render/deck-save-encryption.d.ts.map +1 -1
  193. package/dist/pptx/editor/render/editor-history.d.ts +0 -2
  194. package/dist/pptx/editor/render/editor-history.d.ts.map +1 -1
  195. package/dist/pptx/editor/render/editor-mutations.d.ts +0 -2
  196. package/dist/pptx/editor/render/editor-mutations.d.ts.map +1 -1
  197. package/dist/pptx/editor/render/element-locks.d.ts +0 -2
  198. package/dist/pptx/editor/render/element-locks.d.ts.map +1 -1
  199. package/dist/pptx/editor/render/element-operations.d.ts +0 -2
  200. package/dist/pptx/editor/render/element-operations.d.ts.map +1 -1
  201. package/dist/pptx/editor/render/element.d.ts +0 -2
  202. package/dist/pptx/editor/render/element.d.ts.map +1 -1
  203. package/dist/pptx/editor/render/find-replace.d.ts +2 -4
  204. package/dist/pptx/editor/render/find-replace.d.ts.map +1 -1
  205. package/dist/pptx/editor/render/font-family-update.d.ts +1 -3
  206. package/dist/pptx/editor/render/font-family-update.d.ts.map +1 -1
  207. package/dist/pptx/editor/render/group-drill.d.ts +0 -2
  208. package/dist/pptx/editor/render/group-drill.d.ts.map +1 -1
  209. package/dist/pptx/editor/render/inline-list-body.d.ts +0 -2
  210. package/dist/pptx/editor/render/inline-list-body.d.ts.map +1 -1
  211. package/dist/pptx/editor/render/paragraph-geometry-overrides.d.ts +1 -3
  212. package/dist/pptx/editor/render/paragraph-geometry-overrides.d.ts.map +1 -1
  213. package/dist/pptx/editor/render/remap-empty-paragraph.d.ts +0 -2
  214. package/dist/pptx/editor/render/remap-empty-paragraph.d.ts.map +1 -1
  215. package/dist/pptx/editor/render/remap-paragraph-sources.d.ts +0 -2
  216. package/dist/pptx/editor/render/remap-paragraph-sources.d.ts.map +1 -1
  217. package/dist/pptx/editor/render/remap-text-bullets.d.ts +0 -2
  218. package/dist/pptx/editor/render/remap-text-bullets.d.ts.map +1 -1
  219. package/dist/pptx/editor/render/remap-text.d.ts +0 -2
  220. package/dist/pptx/editor/render/remap-text.d.ts.map +1 -1
  221. package/dist/pptx/editor/render/schema-label-keys.d.ts +0 -2
  222. package/dist/pptx/editor/render/schema-label-keys.d.ts.map +1 -1
  223. package/dist/pptx/editor/render/section-operations.d.ts +0 -2
  224. package/dist/pptx/editor/render/section-operations.d.ts.map +1 -1
  225. package/dist/pptx/editor/render/slide-background-patch.d.ts +0 -2
  226. package/dist/pptx/editor/render/slide-background-patch.d.ts.map +1 -1
  227. package/dist/pptx/editor/render/slide-operations.d.ts +0 -2
  228. package/dist/pptx/editor/render/slide-operations.d.ts.map +1 -1
  229. package/dist/pptx/editor/render/slide-search.d.ts +0 -2
  230. package/dist/pptx/editor/render/slide-search.d.ts.map +1 -1
  231. package/dist/pptx/editor/render/slide-size-rescale.d.ts +0 -2
  232. package/dist/pptx/editor/render/slide-size-rescale.d.ts.map +1 -1
  233. package/dist/pptx/editor/render/slide-transition-edits.d.ts +0 -2
  234. package/dist/pptx/editor/render/slide-transition-edits.d.ts.map +1 -1
  235. package/dist/pptx/editor/render/table-cell-edit.d.ts +0 -2
  236. package/dist/pptx/editor/render/table-cell-edit.d.ts.map +1 -1
  237. package/dist/pptx/editor/render/table-cell-merge.d.ts +0 -2
  238. package/dist/pptx/editor/render/table-cell-merge.d.ts.map +1 -1
  239. package/dist/pptx/editor/render/table-data-grid-ops.d.ts +0 -2
  240. package/dist/pptx/editor/render/table-data-grid-ops.d.ts.map +1 -1
  241. package/dist/pptx/editor/render/table-layout.d.ts +0 -2
  242. package/dist/pptx/editor/render/table-layout.d.ts.map +1 -1
  243. package/dist/pptx/editor/render/table-merge.d.ts +0 -2
  244. package/dist/pptx/editor/render/table-merge.d.ts.map +1 -1
  245. package/dist/pptx/editor/render/table-style-editor-descriptor.d.ts +0 -2
  246. package/dist/pptx/editor/render/table-style-editor-descriptor.d.ts.map +1 -1
  247. package/dist/pptx/editor/render/table-style-editor-edit.d.ts +0 -2
  248. package/dist/pptx/editor/render/table-style-editor-edit.d.ts.map +1 -1
  249. package/dist/pptx/editor/render/table-style-editor-parts.d.ts +0 -2
  250. package/dist/pptx/editor/render/table-style-editor-parts.d.ts.map +1 -1
  251. package/dist/pptx/editor/render/table-style-map-edits.d.ts +0 -2
  252. package/dist/pptx/editor/render/table-style-map-edits.d.ts.map +1 -1
  253. package/dist/pptx/editor/render/template-editing.d.ts +0 -2
  254. package/dist/pptx/editor/render/template-editing.d.ts.map +1 -1
  255. package/dist/pptx/editor/render/text-content-style.d.ts +1 -3
  256. package/dist/pptx/editor/render/text-content-style.d.ts.map +1 -1
  257. package/dist/pptx/editor/render/text-runs-style-patch.d.ts +2 -4
  258. package/dist/pptx/editor/render/text-runs-style-patch.d.ts.map +1 -1
  259. package/dist/pptx/editor/render/text-segment-paragraph-break.d.ts +0 -2
  260. package/dist/pptx/editor/render/text-segment-paragraph-break.d.ts.map +1 -1
  261. package/dist/pptx/editor/render/text-style-scope.d.ts +2 -4
  262. package/dist/pptx/editor/render/text-style-scope.d.ts.map +1 -1
  263. package/dist/pptx/editor/render/text-theme.d.ts +0 -2
  264. package/dist/pptx/editor/render/text-theme.d.ts.map +1 -1
  265. package/dist/pptx/editor/render/theme-editor-model.d.ts +0 -2
  266. package/dist/pptx/editor/render/theme-editor-model.d.ts.map +1 -1
  267. package/dist/pptx/editor/render/theme-editor-presets.d.ts +0 -2
  268. package/dist/pptx/editor/render/theme-editor-presets.d.ts.map +1 -1
  269. package/dist/pptx/editor/render/update-text-segment-style.d.ts +1 -3
  270. package/dist/pptx/editor/render/update-text-segment-style.d.ts.map +1 -1
  271. package/dist/pptx/index.cjs +1687 -1159
  272. package/dist/pptx/index.d.ts +10 -10
  273. package/dist/pptx/index.mjs +1 -1
  274. package/dist/pptx/node/index.d.ts +1 -3
  275. package/dist/pptx/node/index.d.ts.map +1 -1
  276. package/dist/pptx/signature-node/index.d.ts +1 -21
  277. package/dist/pptx/signature-node/index.d.ts.map +1 -1
  278. package/dist/pptx/smartart-layouts/index.d.ts +1 -7
  279. package/dist/pptx/smartart-layouts/index.d.ts.map +1 -1
  280. package/dist/pptx/ui/index.d.ts +1 -9
  281. package/dist/pptx/ui/index.d.ts.map +1 -1
  282. package/dist/teams/index.cjs +215 -201
  283. package/dist/teams/index.mjs +215 -201
  284. package/dist/text/index.cjs +193 -0
  285. package/dist/text/index.d.ts +1 -0
  286. package/dist/text/index.d.ts.map +1 -1
  287. package/dist/text/index.mjs +193 -1
  288. package/dist/text/merge-three-way.d.ts +9 -0
  289. package/dist/text/merge-three-way.d.ts.map +1 -0
  290. package/dist/visio/collab/index.cjs +226 -7
  291. package/dist/visio/collab/index.d.ts +1 -0
  292. package/dist/visio/collab/index.d.ts.map +1 -1
  293. package/dist/visio/collab/index.mjs +225 -7
  294. package/dist/visio/collab/merge-snapshots.d.ts +14 -0
  295. package/dist/visio/collab/merge-snapshots.d.ts.map +1 -0
  296. package/dist/visio/index.cjs +9 -9
  297. package/dist/visio/index.mjs +9 -9
  298. package/dist/visio/ui/index.cjs +9 -9
  299. package/dist/visio/ui/index.mjs +9 -9
  300. package/dist/xlsx/collab/index.cjs +49966 -507
  301. package/dist/xlsx/collab/index.d.ts +1 -0
  302. package/dist/xlsx/collab/index.d.ts.map +1 -1
  303. package/dist/xlsx/collab/index.mjs +49961 -507
  304. package/dist/xlsx/collab/merge-residual.d.ts +16 -0
  305. package/dist/xlsx/collab/merge-residual.d.ts.map +1 -0
  306. package/dist/xlsx/collab/merge-snapshots.d.ts +8 -0
  307. package/dist/xlsx/collab/merge-snapshots.d.ts.map +1 -0
  308. package/dist/xlsx/index.cjs +202 -202
  309. package/dist/xlsx/index.mjs +202 -202
  310. package/dist/xlsx/load/index.cjs +155 -155
  311. package/dist/xlsx/load/index.mjs +155 -155
  312. package/dist/xlsx/ui/index.cjs +202 -202
  313. package/dist/xlsx/ui/index.mjs +202 -202
  314. package/dist/xml/index.cjs +390 -22
  315. package/dist/xml/index.d.ts +1 -0
  316. package/dist/xml/index.d.ts.map +1 -1
  317. package/dist/xml/index.mjs +390 -23
  318. package/dist/xml/merge-three-way.d.ts +16 -0
  319. package/dist/xml/merge-three-way.d.ts.map +1 -0
  320. package/package.json +13 -8
  321. package/dist/pptx/chunks/collaboration-text-codec-Du_XeE_i.d.ts.map +0 -1
  322. package/dist/pptx/chunks/collaboration-text-merge-DWWWdT_t.d.ts.map +0 -1
  323. package/dist/pptx/chunks/collaboration-text-positions-MMT3GkZi.d.ts.map +0 -1
  324. package/dist/pptx/chunks/collaboration-text-session-D0NOLQk7.d.ts.map +0 -1
  325. package/dist/pptx/chunks/collaboration-text-session-delta-CzJGrTKJ.d.ts.map +0 -1
  326. package/dist/pptx/chunks/color-ref-DT599vEx.d.ts.map +0 -1
  327. package/dist/pptx/chunks/elements-f3UbFph-.d.ts.map +0 -1
  328. package/dist/pptx/chunks/index-BnH2QjYm.d.ts.map +0 -1
  329. package/dist/pptx/chunks/index-Bp-1pGo1.d.ts.map +0 -1
  330. package/dist/pptx/chunks/index-pLLN4OTz.d.ts.map +0 -1
  331. package/dist/pptx/chunks/inspection-status-DjiWd_Aa.d.ts.map +0 -1
  332. package/dist/pptx/chunks/schemas-fuDGetRe.d.ts.map +0 -1
  333. package/dist/pptx/chunks/smart-art-CmOrPLLQ.d.ts.map +0 -1
  334. package/dist/pptx/chunks/text-P9xVnXXf.d.ts.map +0 -1
  335. package/dist/pptx/chunks/text-operations-D5sgspO6.d.ts.map +0 -1
@@ -7,6 +7,161 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
7
 
8
8
  var JSZip__default = /*#__PURE__*/_interopDefault(JSZip);
9
9
 
10
+ // text/text-diff.ts
11
+ var isLowSurrogate = (text, at) => {
12
+ const code = text.charCodeAt(at);
13
+ return code >= 56320 && code <= 57343;
14
+ };
15
+ function shortestEdit(n, m, same6, maxEdits) {
16
+ const max = Math.min(n + m, maxEdits);
17
+ const offset = max + 1;
18
+ const v = new Int32Array(2 * max + 3);
19
+ const trace = [];
20
+ for (let d = 0; d <= max; d++) {
21
+ for (let k = -d; k <= d; k += 2) {
22
+ const down = k === -d || k !== d && v[offset + k - 1] < v[offset + k + 1];
23
+ let x = down ? v[offset + k + 1] : v[offset + k - 1] + 1;
24
+ let y = x - k;
25
+ while (x < n && y < m && same6(x, y)) {
26
+ x++;
27
+ y++;
28
+ }
29
+ v[offset + k] = x;
30
+ if (x >= n && y >= m) return backtrack(trace, n, m, d);
31
+ }
32
+ trace.push(v.slice(offset - d, offset + d + 1));
33
+ }
34
+ return void 0;
35
+ }
36
+ function backtrack(trace, n, m, d) {
37
+ const edits = [];
38
+ let x = n;
39
+ let y = m;
40
+ for (let step = d; step > 0; step--) {
41
+ const previous = trace[step - 1];
42
+ const at = (k2) => previous[k2 + step - 1];
43
+ const k = x - y;
44
+ const down = k === -step || k !== step && at(k - 1) < at(k + 1);
45
+ const before = down ? k + 1 : k - 1;
46
+ const startX = at(before);
47
+ const startY = startX - before;
48
+ edits.push(down ? [startX, startY, true] : [startX, startY, false]);
49
+ x = startX;
50
+ y = startY;
51
+ }
52
+ return edits.reverse();
53
+ }
54
+ function changesOf(edits) {
55
+ const changes = [];
56
+ for (const [x, y, inserts] of edits) {
57
+ const last = changes.at(-1);
58
+ if (last && last.fromEnd === x && last.toEnd === y) {
59
+ if (inserts) last.toEnd++;
60
+ else last.fromEnd++;
61
+ } else
62
+ changes.push({
63
+ fromStart: x,
64
+ fromEnd: inserts ? x : x + 1,
65
+ toStart: y,
66
+ toEnd: inserts ? y + 1 : y
67
+ });
68
+ }
69
+ return changes;
70
+ }
71
+ function characterChanges(a2, b, maxEdits) {
72
+ const edits = shortestEdit(
73
+ a2.length,
74
+ b.length,
75
+ (x, y) => a2.charCodeAt(x) === b.charCodeAt(y),
76
+ maxEdits
77
+ );
78
+ return edits && changesOf(edits);
79
+ }
80
+ var TOKEN = /[\p{L}\p{N}\p{M}]+|\s+|[\s\S]/gu;
81
+ function tokensOf(text, ids) {
82
+ const tokens = [];
83
+ const starts = [];
84
+ for (const match of text.matchAll(TOKEN)) {
85
+ let id = ids.get(match[0]);
86
+ if (id === void 0) ids.set(match[0], id = ids.size);
87
+ tokens.push(id);
88
+ starts.push(match.index);
89
+ }
90
+ starts.push(text.length);
91
+ return { tokens, starts };
92
+ }
93
+ function tokenChanges(a2, b, maxEdits) {
94
+ const ids = /* @__PURE__ */ new Map();
95
+ const from = tokensOf(a2, ids);
96
+ const to = tokensOf(b, ids);
97
+ const edits = shortestEdit(
98
+ from.tokens.length,
99
+ to.tokens.length,
100
+ (x, y) => from.tokens[x] === to.tokens[y],
101
+ maxEdits
102
+ );
103
+ if (!edits) return void 0;
104
+ let budget = maxEdits;
105
+ return changesOf(edits).flatMap((stretch) => {
106
+ const change = {
107
+ fromStart: from.starts[stretch.fromStart],
108
+ fromEnd: from.starts[stretch.fromEnd],
109
+ toStart: to.starts[stretch.toStart],
110
+ toEnd: to.starts[stretch.toEnd]
111
+ };
112
+ const inner = change.fromEnd > change.fromStart && change.toEnd > change.toStart ? characterChanges(
113
+ a2.slice(change.fromStart, change.fromEnd),
114
+ b.slice(change.toStart, change.toEnd),
115
+ budget
116
+ ) : void 0;
117
+ if (!inner) return [change];
118
+ for (const found of inner)
119
+ budget -= found.fromEnd - found.fromStart + found.toEnd - found.toStart;
120
+ return inner.map((found) => ({
121
+ fromStart: found.fromStart + change.fromStart,
122
+ fromEnd: found.fromEnd + change.fromStart,
123
+ toStart: found.toStart + change.toStart,
124
+ toEnd: found.toEnd + change.toStart
125
+ }));
126
+ });
127
+ }
128
+ function diffText(from, to, maxEdits = 500) {
129
+ let start = 0;
130
+ while (start < from.length && start < to.length && from.charCodeAt(start) === to.charCodeAt(start))
131
+ start++;
132
+ let end = 0;
133
+ while (end < from.length - start && end < to.length - start && from.charCodeAt(from.length - 1 - end) === to.charCodeAt(to.length - 1 - end))
134
+ end++;
135
+ const a2 = from.slice(start, from.length - end);
136
+ const b = to.slice(start, to.length - end);
137
+ if (!a2.length && !b.length) return [];
138
+ const found = a2.length && b.length ? characterChanges(a2, b, maxEdits) ?? tokenChanges(a2, b, maxEdits) : void 0;
139
+ const changes = found ?? [{ fromStart: 0, fromEnd: a2.length, toStart: 0, toEnd: b.length }];
140
+ const result = [];
141
+ for (const change of changes) {
142
+ const placed = {
143
+ fromStart: change.fromStart + start,
144
+ fromEnd: change.fromEnd + start,
145
+ toStart: change.toStart + start,
146
+ toEnd: change.toEnd + start
147
+ };
148
+ if (placed.fromStart > 0 && placed.toStart > 0 && (isLowSurrogate(from, placed.fromStart) || isLowSurrogate(to, placed.toStart))) {
149
+ placed.fromStart--;
150
+ placed.toStart--;
151
+ }
152
+ if (isLowSurrogate(from, placed.fromEnd) || isLowSurrogate(to, placed.toEnd)) {
153
+ placed.fromEnd++;
154
+ placed.toEnd++;
155
+ }
156
+ const last = result.at(-1);
157
+ if (last && placed.fromStart <= last.fromEnd) {
158
+ last.fromEnd = Math.max(last.fromEnd, placed.fromEnd);
159
+ last.toEnd = Math.max(last.toEnd, placed.toEnd);
160
+ } else result.push(placed);
161
+ }
162
+ return result;
163
+ }
164
+
10
165
  // xml/namespaces.ts
11
166
  var NS = {
12
167
  /** WordprocessingML main. */
@@ -76,6 +231,8 @@ var NS = {
76
231
  /** XML itself (`xml:space`). */
77
232
  xml: "http://www.w3.org/XML/1998/namespace"
78
233
  };
234
+
235
+ // xml/xml.ts
79
236
  var DEFAULT_XML_LIMITS = {
80
237
  maxDepth: 512,
81
238
  maxNodes: 5e6
@@ -161,29 +318,299 @@ function parseXml(xml, options = {}) {
161
318
  { cause: error }
162
319
  );
163
320
  }
164
- if (parseError || !parsed.documentElement)
165
- throw new Error(`Invalid ${label} XML: ${parseError || "missing root element"}`);
166
- if (CRLF_DECLARATION.test(xml)) crlfDeclarations.add(parsed);
167
- return parsed;
321
+ if (parseError || !parsed.documentElement)
322
+ throw new Error(`Invalid ${label} XML: ${parseError || "missing root element"}`);
323
+ if (CRLF_DECLARATION.test(xml)) crlfDeclarations.add(parsed);
324
+ return parsed;
325
+ }
326
+ var buildXml = (node) => {
327
+ const xml = new xmldom.XMLSerializer().serializeToString(node);
328
+ return crlfDeclarations.has(node) ? xml.replace(/^(<\?xml[^>]*\?>)\n/, "$1\r\n") : xml;
329
+ };
330
+ var isElement = (node) => node.nodeType === 1;
331
+ var elements = (parent) => Array.from(parent.childNodes).filter(isElement);
332
+ var textContent = (element4) => element4.textContent ?? "";
333
+ var makeNS = (doc, ns, qualified) => doc.createElementNS(ns, qualified);
334
+ function named(element4, local, ns, lenient = true) {
335
+ if (!element4 || element4.localName !== local) return false;
336
+ return element4.namespaceURI === ns || lenient && !element4.namespaceURI;
337
+ }
338
+ var children = (parent, local, ns, lenient = true) => elements(parent).filter((element4) => named(element4, local, ns, lenient));
339
+ var first = (parent, local, ns, lenient = true) => parent ? children(parent, local, ns, lenient)[0] : void 0;
340
+ function attr(element4, local, ns, prefix2) {
341
+ return element4?.getAttributeNS(ns, local) ?? element4?.getAttribute(`${prefix2}:${local}`) ?? void 0;
342
+ }
343
+ var relAttr = (element4, local) => attr(element4, local, NS.r, "r");
344
+ var DEFAULT_ZIP_LIMITS = {
345
+ maxInputBytes: 100 * 1024 * 1024,
346
+ maxEntries: 1e4,
347
+ maxEntryBytes: 100 * 1024 * 1024,
348
+ maxTotalBytes: 100 * 1024 * 1024
349
+ };
350
+ var ZipLimitError = class extends Error {
351
+ code = "ZIP_BOMB";
352
+ limit;
353
+ /** The check that failed (absent when the error was built without one). */
354
+ kind;
355
+ /** The observed value, when known (a lower bound for a size found while inflating). */
356
+ actual;
357
+ constructor(message, details) {
358
+ super(message);
359
+ this.name = "ZipLimitError";
360
+ this.limit = details.limit;
361
+ this.kind = details.kind;
362
+ this.actual = details.actual;
363
+ }
364
+ };
365
+ var mib = (bytes) => Math.round(bytes / 1048576);
366
+ function isSafePartName(name) {
367
+ if (name.includes("\0") || name.includes("\\")) return false;
368
+ if (/^[A-Za-z]:/u.test(name)) return false;
369
+ const body = name.startsWith("/") ? name.slice(1) : name;
370
+ if (body.startsWith("/")) return false;
371
+ return !body.split("/").some((segment) => segment === "..");
372
+ }
373
+ function declaredEntrySize(entry2) {
374
+ const data = entry2._data;
375
+ const size = Number(data?.uncompressedSize ?? 0);
376
+ return Number.isFinite(size) && size > 0 ? size : 0;
377
+ }
378
+ function resolveLimits(limits) {
379
+ const create2 = limits.createError;
380
+ return {
381
+ maxEntries: limits.maxEntries ?? DEFAULT_ZIP_LIMITS.maxEntries,
382
+ maxEntryBytes: limits.maxEntryBytes ?? DEFAULT_ZIP_LIMITS.maxEntryBytes,
383
+ maxTotalBytes: limits.maxTotalBytes ?? DEFAULT_ZIP_LIMITS.maxTotalBytes,
384
+ label: limits.label ?? "ZIP",
385
+ fail: (message, limit, kind, actual) => create2 ? create2(message, { limit, kind, actual }) : new ZipLimitError(message, { limit, kind, actual })
386
+ };
387
+ }
388
+ async function inflateEntryGuarded(entry2, alreadyRead, limits) {
389
+ const chunks = [];
390
+ let size = 0;
391
+ for await (const chunk of streamEntryGuarded(entry2, alreadyRead, limits)) {
392
+ chunks.push(chunk);
393
+ size += chunk.byteLength;
394
+ }
395
+ if (chunks.length === 1 && chunks[0]) return chunks[0];
396
+ const out = new Uint8Array(size);
397
+ let offset = 0;
398
+ for (const chunk of chunks) {
399
+ out.set(chunk, offset);
400
+ offset += chunk.byteLength;
401
+ }
402
+ return out;
403
+ }
404
+ var AHEAD = 8;
405
+ async function* streamEntryGuarded(entry2, alreadyRead, limits) {
406
+ const r = resolveLimits(limits);
407
+ const declared = declaredEntrySize(entry2);
408
+ const stream = entry2.internalStream("uint8array");
409
+ const queue = [];
410
+ let size = 0;
411
+ let ended = false;
412
+ let stopped = false;
413
+ let failure;
414
+ let paused = false;
415
+ let wake;
416
+ const pause = () => {
417
+ paused = true;
418
+ stream.pause();
419
+ };
420
+ const resume = () => {
421
+ if (!paused || stopped) return;
422
+ paused = false;
423
+ stream.resume();
424
+ };
425
+ const fail = (error) => {
426
+ failure ??= error;
427
+ stopped = true;
428
+ queue.length = 0;
429
+ pause();
430
+ wake?.();
431
+ };
432
+ stream.on("data", (chunk) => {
433
+ if (stopped) return pause();
434
+ size += chunk.byteLength;
435
+ if (size > declared || size > r.maxEntryBytes)
436
+ return fail(
437
+ r.fail(
438
+ `${r.label} part ${entry2.name} inflates past its declared size`,
439
+ r.maxEntryBytes,
440
+ size > declared ? "declaredSize" : "maxEntryBytes",
441
+ size
442
+ )
443
+ );
444
+ if (alreadyRead + size > r.maxTotalBytes)
445
+ return fail(
446
+ r.fail(
447
+ `${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
448
+ r.maxTotalBytes,
449
+ "maxTotalBytes",
450
+ alreadyRead + size
451
+ )
452
+ );
453
+ queue.push(chunk);
454
+ if (queue.length >= AHEAD) pause();
455
+ wake?.();
456
+ });
457
+ stream.on("error", (error) => fail(error));
458
+ stream.on("end", () => {
459
+ ended = true;
460
+ wake?.();
461
+ });
462
+ stream.resume();
463
+ try {
464
+ for (; ; ) {
465
+ if (failure) throw failure;
466
+ const chunk = queue.shift();
467
+ if (chunk) {
468
+ if (queue.length < AHEAD / 2) resume();
469
+ yield chunk;
470
+ continue;
471
+ }
472
+ if (ended) return;
473
+ await new Promise((resolve) => {
474
+ wake = resolve;
475
+ resume();
476
+ });
477
+ wake = void 0;
478
+ }
479
+ } finally {
480
+ stopped = true;
481
+ if (!ended) pause();
482
+ }
483
+ }
484
+ function toBase64(bytes) {
485
+ let binary = "";
486
+ for (let i = 0; i < bytes.length; i += 32768)
487
+ binary += String.fromCharCode(...bytes.subarray(i, i + 32768));
488
+ return btoa(binary);
489
+ }
490
+ function guardZip(zip, limits = {}) {
491
+ const r = resolveLimits(limits);
492
+ const entries = Object.values(zip.files);
493
+ if (entries.length > r.maxEntries)
494
+ throw r.fail(
495
+ `${r.label} package exceeds the ${r.maxEntries.toLocaleString("en-US")} part limit`,
496
+ r.maxEntries,
497
+ "maxEntries",
498
+ entries.length
499
+ );
500
+ let declared = 0;
501
+ for (const entry2 of entries) {
502
+ const original = entry2.unsafeOriginalName;
503
+ if (!isSafePartName(entry2.name) || original !== void 0 && !isSafePartName(original))
504
+ throw r.fail(`${r.label} package has an unsafe part name`, r.maxEntries, "partName");
505
+ if (entry2.dir) continue;
506
+ const size = declaredEntrySize(entry2);
507
+ if (size > r.maxEntryBytes)
508
+ throw r.fail(
509
+ `${r.label} part ${entry2.name} exceeds the uncompressed part size limit`,
510
+ r.maxEntryBytes,
511
+ "maxEntryBytes",
512
+ size
513
+ );
514
+ declared += size;
515
+ }
516
+ if (declared > r.maxTotalBytes)
517
+ throw r.fail(
518
+ `${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
519
+ r.maxTotalBytes,
520
+ "maxTotalBytes",
521
+ declared
522
+ );
523
+ const produced = /* @__PURE__ */ new Map();
524
+ let total = 0;
525
+ for (const entry2 of entries) {
526
+ if (entry2.dir) continue;
527
+ const inflateOriginal = entry2.async.bind(entry2);
528
+ entry2.async = async (type, onUpdate) => {
529
+ const previous = produced.get(entry2.name) ?? 0;
530
+ const bytes = await inflateEntryGuarded(entry2, total - previous, limits);
531
+ if (bytes.byteLength > previous) {
532
+ total += bytes.byteLength - previous;
533
+ produced.set(entry2.name, bytes.byteLength);
534
+ }
535
+ switch (type) {
536
+ case "uint8array":
537
+ return bytes;
538
+ case "string":
539
+ case "text":
540
+ return new TextDecoder("utf-8", { ignoreBOM: true }).decode(bytes);
541
+ case "arraybuffer":
542
+ return bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
543
+ case "base64":
544
+ return toBase64(bytes);
545
+ default:
546
+ return inflateOriginal(type, onUpdate);
547
+ }
548
+ };
549
+ }
550
+ return zip;
551
+ }
552
+ async function openZip(input, limits = {}) {
553
+ const r = resolveLimits(limits);
554
+ const maxInput = limits.maxInputBytes ?? DEFAULT_ZIP_LIMITS.maxInputBytes;
555
+ const bytes = input instanceof Uint8Array ? input : new Uint8Array(input);
556
+ if (bytes.byteLength > maxInput)
557
+ throw r.fail(
558
+ `${r.label} package exceeds the ${mib(maxInput)} MiB compressed input limit`,
559
+ maxInput,
560
+ "maxInputBytes",
561
+ bytes.byteLength
562
+ );
563
+ return guardZip(await JSZip__default.default.loadAsync(bytes), limits);
564
+ }
565
+
566
+ // opc/relationships.ts
567
+ function parseRelationships(xml) {
568
+ const map = /* @__PURE__ */ new Map();
569
+ if (!xml) return map;
570
+ const root = parseXml(xml).documentElement;
571
+ for (const node of elements(root)) {
572
+ if (node.localName !== "Relationship") continue;
573
+ const id = node.getAttribute("Id");
574
+ const target = node.getAttribute("Target");
575
+ if (!id || target == null) continue;
576
+ map.set(id, {
577
+ id,
578
+ type: node.getAttribute("Type") ?? "",
579
+ target,
580
+ mode: node.getAttribute("TargetMode") === "External" ? "External" : "Internal"
581
+ });
582
+ }
583
+ return map;
584
+ }
585
+ var escapeAttr = (value) => value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
586
+ function buildRelationshipsXml(relationships) {
587
+ const items = Array.from(relationships).map(([id, rel]) => {
588
+ const mode = rel.mode === "External" ? ' TargetMode="External"' : "";
589
+ return `<Relationship Id="${escapeAttr(id)}" Type="${escapeAttr(rel.type)}" Target="${escapeAttr(rel.target)}"${mode}/>`;
590
+ }).join("");
591
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${NS.rels}">${items}</Relationships>`;
592
+ }
593
+ function resolvePartPath(basePart, target) {
594
+ if (target.startsWith("/")) return target.slice(1);
595
+ const baseDir = basePart.slice(0, basePart.lastIndexOf("/") + 1);
596
+ const resolved = [];
597
+ for (const segment of `${baseDir}${target}`.split("/")) {
598
+ if (segment === "." || segment === "") continue;
599
+ if (segment === "..") resolved.pop();
600
+ else resolved.push(segment);
601
+ }
602
+ return resolved.join("/");
168
603
  }
169
- var buildXml = (node) => {
170
- const xml = new xmldom.XMLSerializer().serializeToString(node);
171
- return crlfDeclarations.has(node) ? xml.replace(/^(<\?xml[^>]*\?>)\n/, "$1\r\n") : xml;
172
- };
173
- var isElement = (node) => node.nodeType === 1;
174
- var elements = (parent) => Array.from(parent.childNodes).filter(isElement);
175
- var textContent = (element4) => element4.textContent ?? "";
176
- var makeNS = (doc, ns, qualified) => doc.createElementNS(ns, qualified);
177
- function named(element4, local, ns, lenient = true) {
178
- if (!element4 || element4.localName !== local) return false;
179
- return element4.namespaceURI === ns || lenient && !element4.namespaceURI;
604
+ function relationshipsPartFor(partName) {
605
+ const slash = partName.lastIndexOf("/");
606
+ return `${partName.slice(0, slash + 1)}_rels/${partName.slice(slash + 1)}.rels`;
180
607
  }
181
- var children = (parent, local, ns, lenient = true) => elements(parent).filter((element4) => named(element4, local, ns, lenient));
182
- var first = (parent, local, ns, lenient = true) => parent ? children(parent, local, ns, lenient)[0] : void 0;
183
- function attr(element4, local, ns, prefix2) {
184
- return element4?.getAttributeNS(ns, local) ?? element4?.getAttribute(`${prefix2}:${local}`) ?? void 0;
608
+ function nextRelationshipId(used) {
609
+ let index = 1;
610
+ while (used.has(`rId${index}`)) index++;
611
+ return `rId${index}`;
185
612
  }
186
- var relAttr = (element4, local) => attr(element4, local, NS.r, "r");
613
+ var getRelationshipId = (element4) => relAttr(element4, "id") || void 0;
187
614
 
188
615
  // docx/xml.ts
189
616
  var WORD_NS = NS.w;
@@ -3004,55 +3431,6 @@ var RELATIONSHIP_TYPES = {
3004
3431
  diagramColors: `${BASE}/diagramColors`,
3005
3432
  diagramDrawing: "http://schemas.microsoft.com/office/2007/relationships/diagramDrawing"};
3006
3433
 
3007
- // opc/relationships.ts
3008
- function parseRelationships(xml) {
3009
- const map = /* @__PURE__ */ new Map();
3010
- if (!xml) return map;
3011
- const root = parseXml(xml).documentElement;
3012
- for (const node of elements(root)) {
3013
- if (node.localName !== "Relationship") continue;
3014
- const id = node.getAttribute("Id");
3015
- const target = node.getAttribute("Target");
3016
- if (!id || target == null) continue;
3017
- map.set(id, {
3018
- id,
3019
- type: node.getAttribute("Type") ?? "",
3020
- target,
3021
- mode: node.getAttribute("TargetMode") === "External" ? "External" : "Internal"
3022
- });
3023
- }
3024
- return map;
3025
- }
3026
- var escapeAttr = (value) => value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
3027
- function buildRelationshipsXml(relationships) {
3028
- const items = Array.from(relationships).map(([id, rel]) => {
3029
- const mode = rel.mode === "External" ? ' TargetMode="External"' : "";
3030
- return `<Relationship Id="${escapeAttr(id)}" Type="${escapeAttr(rel.type)}" Target="${escapeAttr(rel.target)}"${mode}/>`;
3031
- }).join("");
3032
- return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${NS.rels}">${items}</Relationships>`;
3033
- }
3034
- function resolvePartPath(basePart, target) {
3035
- if (target.startsWith("/")) return target.slice(1);
3036
- const baseDir = basePart.slice(0, basePart.lastIndexOf("/") + 1);
3037
- const resolved = [];
3038
- for (const segment of `${baseDir}${target}`.split("/")) {
3039
- if (segment === "." || segment === "") continue;
3040
- if (segment === "..") resolved.pop();
3041
- else resolved.push(segment);
3042
- }
3043
- return resolved.join("/");
3044
- }
3045
- function relationshipsPartFor(partName) {
3046
- const slash = partName.lastIndexOf("/");
3047
- return `${partName.slice(0, slash + 1)}_rels/${partName.slice(slash + 1)}.rels`;
3048
- }
3049
- function nextRelationshipId(used) {
3050
- let index = 1;
3051
- while (used.has(`rId${index}`)) index++;
3052
- return `rId${index}`;
3053
- }
3054
- var getRelationshipId = (element4) => relAttr(element4, "id") || void 0;
3055
-
3056
3434
  // opc/content-types.ts
3057
3435
  var escapeAttr2 = (value) => value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
3058
3436
  function parseContentTypes(xml) {
@@ -3116,260 +3494,39 @@ async function ensureContentTypeOverride(zip, partName, contentType) {
3116
3494
  async function removeContentTypeOverride(zip, partName) {
3117
3495
  const xml = await zip.file(CONTENT_TYPES_PATH)?.async("string");
3118
3496
  if (!xml) return;
3119
- const target = `/${partName}`;
3120
- const tag = (xml.match(/<Override\b[^>]*\/>/g) ?? []).find(
3121
- (candidate) => attr2(candidate, "PartName") === target
3122
- );
3123
- if (tag) zip.file(CONTENT_TYPES_PATH, xml.replace(tag, ""));
3124
- }
3125
- async function ensureRelationship(zip, relsPath, type, target) {
3126
- const xml = await zip.file(relsPath)?.async("string") ?? EMPTY_RELS;
3127
- const used = /* @__PURE__ */ new Set();
3128
- for (const tag of xml.match(/<Relationship\b[^>]*\/>/g) ?? []) {
3129
- const id2 = attr2(tag, "Id");
3130
- if (id2) used.add(id2);
3131
- if (id2 && attr2(tag, "Type") === type && attr2(tag, "Target") === target) return id2;
3132
- }
3133
- const highest = Math.max(
3134
- 0,
3135
- ...[...used].map((id2) => Number(id2.replace(/^rId/, ""))).filter(Number.isFinite)
3136
- );
3137
- let id = `rId${highest + 1}`;
3138
- if (used.has(id)) id = nextRelationshipId(used);
3139
- const insertion = `<Relationship Id="${id}" Type="${type}" Target="${target}"/>`;
3140
- zip.file(relsPath, xml.replace("</Relationships>", `${insertion}</Relationships>`));
3141
- return id;
3142
- }
3143
-
3144
- // opc/safe-href.ts
3145
- var SAFE_SCHEMES = /* @__PURE__ */ new Set(["http:", "https:", "mailto:"]);
3146
- function isSafeHyperlinkHref(href) {
3147
- const scheme2 = /^([a-z][a-z0-9+.-]*:)/i.exec(href.trim())?.[1];
3148
- return scheme2 !== void 0 && SAFE_SCHEMES.has(scheme2.toLowerCase());
3149
- }
3150
- var OPEN_SCHEMES = /* @__PURE__ */ new Set(["http", "https", "mailto"]);
3151
- /* @__PURE__ */ new Set([...OPEN_SCHEMES, "ftp", "file"]);
3152
- var DEFAULT_ZIP_LIMITS = {
3153
- maxInputBytes: 100 * 1024 * 1024,
3154
- maxEntries: 1e4,
3155
- maxEntryBytes: 100 * 1024 * 1024,
3156
- maxTotalBytes: 100 * 1024 * 1024
3157
- };
3158
- var ZipLimitError = class extends Error {
3159
- code = "ZIP_BOMB";
3160
- limit;
3161
- /** The check that failed (absent when the error was built without one). */
3162
- kind;
3163
- /** The observed value, when known (a lower bound for a size found while inflating). */
3164
- actual;
3165
- constructor(message, details) {
3166
- super(message);
3167
- this.name = "ZipLimitError";
3168
- this.limit = details.limit;
3169
- this.kind = details.kind;
3170
- this.actual = details.actual;
3171
- }
3172
- };
3173
- var mib = (bytes) => Math.round(bytes / 1048576);
3174
- function isSafePartName(name) {
3175
- if (name.includes("\0") || name.includes("\\")) return false;
3176
- if (/^[A-Za-z]:/u.test(name)) return false;
3177
- const body = name.startsWith("/") ? name.slice(1) : name;
3178
- if (body.startsWith("/")) return false;
3179
- return !body.split("/").some((segment) => segment === "..");
3180
- }
3181
- function declaredEntrySize(entry2) {
3182
- const data = entry2._data;
3183
- const size = Number(data?.uncompressedSize ?? 0);
3184
- return Number.isFinite(size) && size > 0 ? size : 0;
3185
- }
3186
- function resolveLimits(limits) {
3187
- const create2 = limits.createError;
3188
- return {
3189
- maxEntries: limits.maxEntries ?? DEFAULT_ZIP_LIMITS.maxEntries,
3190
- maxEntryBytes: limits.maxEntryBytes ?? DEFAULT_ZIP_LIMITS.maxEntryBytes,
3191
- maxTotalBytes: limits.maxTotalBytes ?? DEFAULT_ZIP_LIMITS.maxTotalBytes,
3192
- label: limits.label ?? "ZIP",
3193
- fail: (message, limit, kind, actual) => create2 ? create2(message, { limit, kind, actual }) : new ZipLimitError(message, { limit, kind, actual })
3194
- };
3195
- }
3196
- async function inflateEntryGuarded(entry2, alreadyRead, limits) {
3197
- const chunks = [];
3198
- let size = 0;
3199
- for await (const chunk of streamEntryGuarded(entry2, alreadyRead, limits)) {
3200
- chunks.push(chunk);
3201
- size += chunk.byteLength;
3202
- }
3203
- if (chunks.length === 1 && chunks[0]) return chunks[0];
3204
- const out = new Uint8Array(size);
3205
- let offset = 0;
3206
- for (const chunk of chunks) {
3207
- out.set(chunk, offset);
3208
- offset += chunk.byteLength;
3209
- }
3210
- return out;
3211
- }
3212
- var AHEAD = 8;
3213
- async function* streamEntryGuarded(entry2, alreadyRead, limits) {
3214
- const r = resolveLimits(limits);
3215
- const declared = declaredEntrySize(entry2);
3216
- const stream = entry2.internalStream("uint8array");
3217
- const queue = [];
3218
- let size = 0;
3219
- let ended = false;
3220
- let stopped = false;
3221
- let failure;
3222
- let paused = false;
3223
- let wake;
3224
- const pause = () => {
3225
- paused = true;
3226
- stream.pause();
3227
- };
3228
- const resume = () => {
3229
- if (!paused || stopped) return;
3230
- paused = false;
3231
- stream.resume();
3232
- };
3233
- const fail = (error) => {
3234
- failure ??= error;
3235
- stopped = true;
3236
- queue.length = 0;
3237
- pause();
3238
- wake?.();
3239
- };
3240
- stream.on("data", (chunk) => {
3241
- if (stopped) return pause();
3242
- size += chunk.byteLength;
3243
- if (size > declared || size > r.maxEntryBytes)
3244
- return fail(
3245
- r.fail(
3246
- `${r.label} part ${entry2.name} inflates past its declared size`,
3247
- r.maxEntryBytes,
3248
- size > declared ? "declaredSize" : "maxEntryBytes",
3249
- size
3250
- )
3251
- );
3252
- if (alreadyRead + size > r.maxTotalBytes)
3253
- return fail(
3254
- r.fail(
3255
- `${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
3256
- r.maxTotalBytes,
3257
- "maxTotalBytes",
3258
- alreadyRead + size
3259
- )
3260
- );
3261
- queue.push(chunk);
3262
- if (queue.length >= AHEAD) pause();
3263
- wake?.();
3264
- });
3265
- stream.on("error", (error) => fail(error));
3266
- stream.on("end", () => {
3267
- ended = true;
3268
- wake?.();
3269
- });
3270
- stream.resume();
3271
- try {
3272
- for (; ; ) {
3273
- if (failure) throw failure;
3274
- const chunk = queue.shift();
3275
- if (chunk) {
3276
- if (queue.length < AHEAD / 2) resume();
3277
- yield chunk;
3278
- continue;
3279
- }
3280
- if (ended) return;
3281
- await new Promise((resolve) => {
3282
- wake = resolve;
3283
- resume();
3284
- });
3285
- wake = void 0;
3286
- }
3287
- } finally {
3288
- stopped = true;
3289
- if (!ended) pause();
3290
- }
3291
- }
3292
- function toBase64(bytes) {
3293
- let binary = "";
3294
- for (let i = 0; i < bytes.length; i += 32768)
3295
- binary += String.fromCharCode(...bytes.subarray(i, i + 32768));
3296
- return btoa(binary);
3497
+ const target = `/${partName}`;
3498
+ const tag = (xml.match(/<Override\b[^>]*\/>/g) ?? []).find(
3499
+ (candidate) => attr2(candidate, "PartName") === target
3500
+ );
3501
+ if (tag) zip.file(CONTENT_TYPES_PATH, xml.replace(tag, ""));
3297
3502
  }
3298
- function guardZip(zip, limits = {}) {
3299
- const r = resolveLimits(limits);
3300
- const entries = Object.values(zip.files);
3301
- if (entries.length > r.maxEntries)
3302
- throw r.fail(
3303
- `${r.label} package exceeds the ${r.maxEntries.toLocaleString("en-US")} part limit`,
3304
- r.maxEntries,
3305
- "maxEntries",
3306
- entries.length
3307
- );
3308
- let declared = 0;
3309
- for (const entry2 of entries) {
3310
- const original = entry2.unsafeOriginalName;
3311
- if (!isSafePartName(entry2.name) || original !== void 0 && !isSafePartName(original))
3312
- throw r.fail(`${r.label} package has an unsafe part name`, r.maxEntries, "partName");
3313
- if (entry2.dir) continue;
3314
- const size = declaredEntrySize(entry2);
3315
- if (size > r.maxEntryBytes)
3316
- throw r.fail(
3317
- `${r.label} part ${entry2.name} exceeds the uncompressed part size limit`,
3318
- r.maxEntryBytes,
3319
- "maxEntryBytes",
3320
- size
3321
- );
3322
- declared += size;
3323
- }
3324
- if (declared > r.maxTotalBytes)
3325
- throw r.fail(
3326
- `${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
3327
- r.maxTotalBytes,
3328
- "maxTotalBytes",
3329
- declared
3330
- );
3331
- const produced = /* @__PURE__ */ new Map();
3332
- let total = 0;
3333
- for (const entry2 of entries) {
3334
- if (entry2.dir) continue;
3335
- const inflateOriginal = entry2.async.bind(entry2);
3336
- entry2.async = async (type, onUpdate) => {
3337
- const previous = produced.get(entry2.name) ?? 0;
3338
- const bytes = await inflateEntryGuarded(entry2, total - previous, limits);
3339
- if (bytes.byteLength > previous) {
3340
- total += bytes.byteLength - previous;
3341
- produced.set(entry2.name, bytes.byteLength);
3342
- }
3343
- switch (type) {
3344
- case "uint8array":
3345
- return bytes;
3346
- case "string":
3347
- case "text":
3348
- return new TextDecoder("utf-8", { ignoreBOM: true }).decode(bytes);
3349
- case "arraybuffer":
3350
- return bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
3351
- case "base64":
3352
- return toBase64(bytes);
3353
- default:
3354
- return inflateOriginal(type, onUpdate);
3355
- }
3356
- };
3503
+ async function ensureRelationship(zip, relsPath, type, target) {
3504
+ const xml = await zip.file(relsPath)?.async("string") ?? EMPTY_RELS;
3505
+ const used = /* @__PURE__ */ new Set();
3506
+ for (const tag of xml.match(/<Relationship\b[^>]*\/>/g) ?? []) {
3507
+ const id2 = attr2(tag, "Id");
3508
+ if (id2) used.add(id2);
3509
+ if (id2 && attr2(tag, "Type") === type && attr2(tag, "Target") === target) return id2;
3357
3510
  }
3358
- return zip;
3511
+ const highest = Math.max(
3512
+ 0,
3513
+ ...[...used].map((id2) => Number(id2.replace(/^rId/, ""))).filter(Number.isFinite)
3514
+ );
3515
+ let id = `rId${highest + 1}`;
3516
+ if (used.has(id)) id = nextRelationshipId(used);
3517
+ const insertion = `<Relationship Id="${id}" Type="${type}" Target="${target}"/>`;
3518
+ zip.file(relsPath, xml.replace("</Relationships>", `${insertion}</Relationships>`));
3519
+ return id;
3359
3520
  }
3360
- async function openZip(input, limits = {}) {
3361
- const r = resolveLimits(limits);
3362
- const maxInput = limits.maxInputBytes ?? DEFAULT_ZIP_LIMITS.maxInputBytes;
3363
- const bytes = input instanceof Uint8Array ? input : new Uint8Array(input);
3364
- if (bytes.byteLength > maxInput)
3365
- throw r.fail(
3366
- `${r.label} package exceeds the ${mib(maxInput)} MiB compressed input limit`,
3367
- maxInput,
3368
- "maxInputBytes",
3369
- bytes.byteLength
3370
- );
3371
- return guardZip(await JSZip__default.default.loadAsync(bytes), limits);
3521
+
3522
+ // opc/safe-href.ts
3523
+ var SAFE_SCHEMES = /* @__PURE__ */ new Set(["http:", "https:", "mailto:"]);
3524
+ function isSafeHyperlinkHref(href) {
3525
+ const scheme2 = /^([a-z][a-z0-9+.-]*:)/i.exec(href.trim())?.[1];
3526
+ return scheme2 !== void 0 && SAFE_SCHEMES.has(scheme2.toLowerCase());
3372
3527
  }
3528
+ var OPEN_SCHEMES = /* @__PURE__ */ new Set(["http", "https", "mailto"]);
3529
+ /* @__PURE__ */ new Set([...OPEN_SCHEMES, "ftp", "file"]);
3373
3530
 
3374
3531
  // opc/properties/patch.ts
3375
3532
  var XMLNS3 = "http://www.w3.org/2000/xmlns/";
@@ -5424,161 +5581,6 @@ function patchCommentMetadata(parts, identities) {
5424
5581
  return result;
5425
5582
  }
5426
5583
 
5427
- // text/text-diff.ts
5428
- var isLowSurrogate = (text, at) => {
5429
- const code = text.charCodeAt(at);
5430
- return code >= 56320 && code <= 57343;
5431
- };
5432
- function shortestEdit(n, m, same6, maxEdits) {
5433
- const max = Math.min(n + m, maxEdits);
5434
- const offset = max + 1;
5435
- const v = new Int32Array(2 * max + 3);
5436
- const trace = [];
5437
- for (let d = 0; d <= max; d++) {
5438
- for (let k = -d; k <= d; k += 2) {
5439
- const down = k === -d || k !== d && v[offset + k - 1] < v[offset + k + 1];
5440
- let x = down ? v[offset + k + 1] : v[offset + k - 1] + 1;
5441
- let y = x - k;
5442
- while (x < n && y < m && same6(x, y)) {
5443
- x++;
5444
- y++;
5445
- }
5446
- v[offset + k] = x;
5447
- if (x >= n && y >= m) return backtrack(trace, n, m, d);
5448
- }
5449
- trace.push(v.slice(offset - d, offset + d + 1));
5450
- }
5451
- return void 0;
5452
- }
5453
- function backtrack(trace, n, m, d) {
5454
- const edits = [];
5455
- let x = n;
5456
- let y = m;
5457
- for (let step = d; step > 0; step--) {
5458
- const previous = trace[step - 1];
5459
- const at = (k2) => previous[k2 + step - 1];
5460
- const k = x - y;
5461
- const down = k === -step || k !== step && at(k - 1) < at(k + 1);
5462
- const before = down ? k + 1 : k - 1;
5463
- const startX = at(before);
5464
- const startY = startX - before;
5465
- edits.push(down ? [startX, startY, true] : [startX, startY, false]);
5466
- x = startX;
5467
- y = startY;
5468
- }
5469
- return edits.reverse();
5470
- }
5471
- function changesOf(edits) {
5472
- const changes = [];
5473
- for (const [x, y, inserts] of edits) {
5474
- const last = changes.at(-1);
5475
- if (last && last.fromEnd === x && last.toEnd === y) {
5476
- if (inserts) last.toEnd++;
5477
- else last.fromEnd++;
5478
- } else
5479
- changes.push({
5480
- fromStart: x,
5481
- fromEnd: inserts ? x : x + 1,
5482
- toStart: y,
5483
- toEnd: inserts ? y + 1 : y
5484
- });
5485
- }
5486
- return changes;
5487
- }
5488
- function characterChanges(a2, b, maxEdits) {
5489
- const edits = shortestEdit(
5490
- a2.length,
5491
- b.length,
5492
- (x, y) => a2.charCodeAt(x) === b.charCodeAt(y),
5493
- maxEdits
5494
- );
5495
- return edits && changesOf(edits);
5496
- }
5497
- var TOKEN = /[\p{L}\p{N}\p{M}]+|\s+|[\s\S]/gu;
5498
- function tokensOf(text, ids) {
5499
- const tokens = [];
5500
- const starts = [];
5501
- for (const match of text.matchAll(TOKEN)) {
5502
- let id = ids.get(match[0]);
5503
- if (id === void 0) ids.set(match[0], id = ids.size);
5504
- tokens.push(id);
5505
- starts.push(match.index);
5506
- }
5507
- starts.push(text.length);
5508
- return { tokens, starts };
5509
- }
5510
- function tokenChanges(a2, b, maxEdits) {
5511
- const ids = /* @__PURE__ */ new Map();
5512
- const from = tokensOf(a2, ids);
5513
- const to = tokensOf(b, ids);
5514
- const edits = shortestEdit(
5515
- from.tokens.length,
5516
- to.tokens.length,
5517
- (x, y) => from.tokens[x] === to.tokens[y],
5518
- maxEdits
5519
- );
5520
- if (!edits) return void 0;
5521
- let budget = maxEdits;
5522
- return changesOf(edits).flatMap((stretch) => {
5523
- const change = {
5524
- fromStart: from.starts[stretch.fromStart],
5525
- fromEnd: from.starts[stretch.fromEnd],
5526
- toStart: to.starts[stretch.toStart],
5527
- toEnd: to.starts[stretch.toEnd]
5528
- };
5529
- const inner = change.fromEnd > change.fromStart && change.toEnd > change.toStart ? characterChanges(
5530
- a2.slice(change.fromStart, change.fromEnd),
5531
- b.slice(change.toStart, change.toEnd),
5532
- budget
5533
- ) : void 0;
5534
- if (!inner) return [change];
5535
- for (const found of inner)
5536
- budget -= found.fromEnd - found.fromStart + found.toEnd - found.toStart;
5537
- return inner.map((found) => ({
5538
- fromStart: found.fromStart + change.fromStart,
5539
- fromEnd: found.fromEnd + change.fromStart,
5540
- toStart: found.toStart + change.toStart,
5541
- toEnd: found.toEnd + change.toStart
5542
- }));
5543
- });
5544
- }
5545
- function diffText(from, to, maxEdits = 500) {
5546
- let start = 0;
5547
- while (start < from.length && start < to.length && from.charCodeAt(start) === to.charCodeAt(start))
5548
- start++;
5549
- let end = 0;
5550
- while (end < from.length - start && end < to.length - start && from.charCodeAt(from.length - 1 - end) === to.charCodeAt(to.length - 1 - end))
5551
- end++;
5552
- const a2 = from.slice(start, from.length - end);
5553
- const b = to.slice(start, to.length - end);
5554
- if (!a2.length && !b.length) return [];
5555
- const found = a2.length && b.length ? characterChanges(a2, b, maxEdits) ?? tokenChanges(a2, b, maxEdits) : void 0;
5556
- const changes = found ?? [{ fromStart: 0, fromEnd: a2.length, toStart: 0, toEnd: b.length }];
5557
- const result = [];
5558
- for (const change of changes) {
5559
- const placed = {
5560
- fromStart: change.fromStart + start,
5561
- fromEnd: change.fromEnd + start,
5562
- toStart: change.toStart + start,
5563
- toEnd: change.toEnd + start
5564
- };
5565
- if (placed.fromStart > 0 && placed.toStart > 0 && (isLowSurrogate(from, placed.fromStart) || isLowSurrogate(to, placed.toStart))) {
5566
- placed.fromStart--;
5567
- placed.toStart--;
5568
- }
5569
- if (isLowSurrogate(from, placed.fromEnd) || isLowSurrogate(to, placed.toEnd)) {
5570
- placed.fromEnd++;
5571
- placed.toEnd++;
5572
- }
5573
- const last = result.at(-1);
5574
- if (last && placed.fromStart <= last.fromEnd) {
5575
- last.fromEnd = Math.max(last.fromEnd, placed.fromEnd);
5576
- last.toEnd = Math.max(last.toEnd, placed.toEnd);
5577
- } else result.push(placed);
5578
- }
5579
- return result;
5580
- }
5581
-
5582
5584
  // docx/write-run-extra.ts
5583
5585
  function setAttribute2(element4, local, value) {
5584
5586
  element4.setAttributeNS(WORD_NS, `w:${local}`, value);