@eigenpal/docx-editor-core 1.4.0 → 1.6.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 (325) hide show
  1. package/dist/agent/index.d.mts +8 -7
  2. package/dist/agent/index.d.ts +8 -7
  3. package/dist/agent/index.js +1 -1
  4. package/dist/agent/index.mjs +1 -1
  5. package/dist/chunk-2KPOGFFR.js +1 -0
  6. package/dist/{chunk-KXVCCT2A.js → chunk-2KUOYHXX.js} +1 -1
  7. package/dist/chunk-2LVK7EF5.mjs +2 -0
  8. package/dist/chunk-2ZTKTE7P.js +1 -0
  9. package/dist/{chunk-C45EFOVP.js → chunk-34DJT72K.js} +1 -1
  10. package/dist/chunk-3HLRRK6N.mjs +2 -0
  11. package/dist/chunk-4272FQ2E.js +1 -0
  12. package/dist/chunk-4DCTKHS5.js +1 -0
  13. package/dist/chunk-4JPHW7ZI.js +2 -0
  14. package/dist/chunk-4QJEMD23.mjs +4 -0
  15. package/dist/chunk-4QSFBX26.mjs +1 -0
  16. package/dist/chunk-4SZAFWLV.mjs +1 -0
  17. package/dist/{chunk-GGUHM74A.mjs → chunk-5JULVEYK.mjs} +1 -1
  18. package/dist/chunk-6AGU57TL.mjs +1 -0
  19. package/dist/chunk-6ENZQGYR.mjs +1 -0
  20. package/dist/chunk-6KYOT4E7.js +4 -0
  21. package/dist/chunk-77X765ZO.js +1 -0
  22. package/dist/chunk-7UMOUKSF.js +1 -0
  23. package/dist/chunk-AXVWVIIN.js +1 -0
  24. package/dist/chunk-B6FA4MJ5.mjs +1 -0
  25. package/dist/chunk-BBJMUBTD.mjs +1 -0
  26. package/dist/chunk-BJSG6TEG.js +1 -0
  27. package/dist/chunk-BKP5QMTS.js +1 -0
  28. package/dist/chunk-C57BOE7B.mjs +2 -0
  29. package/dist/chunk-CDBKFBC2.mjs +15 -0
  30. package/dist/{chunk-BUEMXRXH.js → chunk-CDGV7CLS.js} +1 -1
  31. package/dist/{chunk-6IZOFIQH.js → chunk-CWPIXUU2.js} +1 -1
  32. package/dist/chunk-DX5XU6JN.js +1 -0
  33. package/dist/chunk-E7UN3PVC.mjs +1 -0
  34. package/dist/chunk-EJ2JAYRI.js +1 -0
  35. package/dist/{chunk-CHN26LLL.mjs → chunk-F24WZXN4.mjs} +1 -1
  36. package/dist/{chunk-2SGJZYQF.js → chunk-F44XU6G5.js} +1 -1
  37. package/dist/{chunk-TE2AF7FM.js → chunk-FETIBXTH.js} +1 -1
  38. package/dist/{chunk-CZSAC65M.js → chunk-GFM6PERG.js} +1 -1
  39. package/dist/chunk-GLPOVLZD.mjs +1 -0
  40. package/dist/chunk-H57LNDBH.js +1 -0
  41. package/dist/chunk-HEJJXAXN.mjs +1 -0
  42. package/dist/chunk-ILPNMG7Q.js +1 -0
  43. package/dist/chunk-IM56AITE.mjs +1 -0
  44. package/dist/{chunk-BH3ACQ3M.js → chunk-JQUIUKRO.js} +3 -3
  45. package/dist/chunk-KK673XRZ.mjs +1 -0
  46. package/dist/chunk-KNY7SXPJ.mjs +1 -0
  47. package/dist/{chunk-DFUWJHKF.mjs → chunk-KSW6W2EK.mjs} +4 -4
  48. package/dist/chunk-LVUL7O27.js +1 -0
  49. package/dist/{chunk-SCK6ZM5V.js → chunk-LW5OFHSW.js} +2 -2
  50. package/dist/chunk-M65C4SQJ.mjs +2 -0
  51. package/dist/chunk-MA3HLGFO.js +1 -0
  52. package/dist/chunk-MWOHCSZE.js +1 -0
  53. package/dist/chunk-NO6PIL32.mjs +1 -0
  54. package/dist/chunk-NTBZRITU.mjs +1 -0
  55. package/dist/chunk-NTYJIOUE.js +2 -0
  56. package/dist/chunk-NY36MZ55.mjs +1 -0
  57. package/dist/chunk-PJEB3ZWG.mjs +3 -0
  58. package/dist/chunk-Q2VALXEU.js +3 -0
  59. package/dist/chunk-QVRMX2AC.js +15 -0
  60. package/dist/{chunk-FYRJTDC4.mjs → chunk-QZPVZY6S.mjs} +1 -1
  61. package/dist/{chunk-3QPKTG2Y.js → chunk-RGHRXIIZ.js} +3 -3
  62. package/dist/chunk-RRJKF2XI.mjs +1 -0
  63. package/dist/{chunk-ZBCFIW2V.js → chunk-T3UP6LF5.js} +1 -1
  64. package/dist/chunk-UC7JW66O.mjs +1 -0
  65. package/dist/chunk-V3NE7Q22.js +2 -0
  66. package/dist/chunk-VDKSZ5BQ.mjs +1 -0
  67. package/dist/chunk-VJFIAFZ5.mjs +1 -0
  68. package/dist/chunk-WCB25ESG.mjs +1 -0
  69. package/dist/chunk-WEQA5PPW.mjs +1 -0
  70. package/dist/{chunk-HPAUUQAX.mjs → chunk-WQJWT4RB.mjs} +1 -1
  71. package/dist/chunk-WWG6PUWU.js +1 -0
  72. package/dist/chunk-X6AICTHN.js +1 -0
  73. package/dist/{chunk-YNUPP7UG.mjs → chunk-XTPT4TNP.mjs} +2 -2
  74. package/dist/{chunk-CHTIWTHQ.mjs → chunk-YMXWLXVF.mjs} +1 -1
  75. package/dist/{colorResolver-8A-qj-LP.d.ts → colorResolver-C696sd9x.d.ts} +1 -1
  76. package/dist/{colorResolver-BCvxTlLF.d.mts → colorResolver-DCBfI4ld.d.mts} +1 -1
  77. package/dist/{content-C8fc_tL6.d.ts → content-BebvPfXc.d.ts} +4 -148
  78. package/dist/{content-3xF4WDE8.d.mts → content-CbBCrsr0.d.mts} +4 -148
  79. package/dist/{contentControlValues-DGDKD589.d.ts → contentControlValues-Com1GnZS.d.ts} +1 -1
  80. package/dist/{contentControlValues-DjWvoJQ-.d.mts → contentControlValues-DVJyudKU.d.mts} +1 -1
  81. package/dist/core-plugins.d.mts +5 -4
  82. package/dist/core-plugins.d.ts +5 -4
  83. package/dist/core-plugins.js +1 -1
  84. package/dist/core-plugins.mjs +1 -1
  85. package/dist/core.d.mts +12 -11
  86. package/dist/core.d.ts +12 -11
  87. package/dist/core.js +1 -1
  88. package/dist/core.mjs +1 -1
  89. package/dist/{documentStyles-qR0VR2s0.d.mts → documentStyles-1G0xTl1v.d.mts} +1 -1
  90. package/dist/{documentStyles-C7k_8Sye.d.ts → documentStyles-Bw98BwEy.d.ts} +1 -1
  91. package/dist/docx/index.d.mts +8 -68
  92. package/dist/docx/index.d.ts +8 -68
  93. package/dist/docx/index.js +1 -1
  94. package/dist/docx/index.mjs +1 -1
  95. package/dist/docx/parser.d.mts +5 -4
  96. package/dist/docx/parser.d.ts +5 -4
  97. package/dist/docx/parser.js +1 -1
  98. package/dist/docx/parser.mjs +1 -1
  99. package/dist/docx/rezip.d.mts +5 -4
  100. package/dist/docx/rezip.d.ts +5 -4
  101. package/dist/docx/rezip.js +1 -1
  102. package/dist/docx/rezip.mjs +1 -1
  103. package/dist/docx/serializer/index.d.mts +6 -5
  104. package/dist/docx/serializer/index.d.ts +6 -5
  105. package/dist/docx/serializer/index.js +1 -1
  106. package/dist/docx/serializer/index.mjs +1 -1
  107. package/dist/editor/index.d.mts +5 -4
  108. package/dist/editor/index.d.ts +5 -4
  109. package/dist/editor/index.js +1 -1
  110. package/dist/editor/index.mjs +1 -1
  111. package/dist/executor-FHL5D4CB.js +1 -0
  112. package/dist/executor-FL6XGVP3.mjs +1 -0
  113. package/dist/{fontLoader-CUS1BPv7.d.mts → fontLoader-B4uFKpAy.d.mts} +48 -5
  114. package/dist/{fontLoader-Dl9SEKex.d.ts → fontLoader-D9SBYuZZ.d.ts} +48 -5
  115. package/dist/{formatting-BH4hcZiq.d.mts → formatting-DFtuRFQY.d.mts} +13 -0
  116. package/dist/{formatting-_OXU8gLB.d.ts → formatting-JhqWT_XM.d.ts} +13 -0
  117. package/dist/{headerFooterLayout-AtAOhM8E.d.ts → headerFooterLayout-CtVsfqxQ.d.ts} +2 -2
  118. package/dist/{headerFooterLayout-CU6hvszp.d.mts → headerFooterLayout-D2LZLkDC.d.mts} +2 -2
  119. package/dist/headless.d.mts +10 -9
  120. package/dist/headless.d.ts +10 -9
  121. package/dist/headless.js +1 -1
  122. package/dist/headless.mjs +1 -1
  123. package/dist/layout-bridge/clickToPositionDom.js +1 -1
  124. package/dist/layout-bridge/clickToPositionDom.mjs +1 -1
  125. package/dist/layout-bridge/index.d.mts +70 -7
  126. package/dist/layout-bridge/index.d.ts +70 -7
  127. package/dist/layout-bridge/index.js +1 -1
  128. package/dist/layout-bridge/index.mjs +1 -1
  129. package/dist/layout-bridge/measuring/index.d.mts +4 -3
  130. package/dist/layout-bridge/measuring/index.d.ts +4 -3
  131. package/dist/layout-bridge/measuring/index.js +1 -1
  132. package/dist/layout-bridge/measuring/index.mjs +1 -1
  133. package/dist/layout-bridge/tableInsertHover.js +1 -1
  134. package/dist/layout-bridge/tableInsertHover.mjs +1 -1
  135. package/dist/layout-bridge/toFlowBlocks.d.mts +5 -4
  136. package/dist/layout-bridge/toFlowBlocks.d.ts +5 -4
  137. package/dist/layout-bridge/toFlowBlocks.js +1 -1
  138. package/dist/layout-bridge/toFlowBlocks.mjs +1 -1
  139. package/dist/layout-engine/index.d.mts +5 -4
  140. package/dist/layout-engine/index.d.ts +5 -4
  141. package/dist/layout-engine/index.js +1 -1
  142. package/dist/layout-engine/index.mjs +1 -1
  143. package/dist/layout-engine/types.d.mts +22 -10
  144. package/dist/layout-engine/types.d.ts +22 -10
  145. package/dist/layout-painter/index.d.mts +6 -5
  146. package/dist/layout-painter/index.d.ts +6 -5
  147. package/dist/layout-painter/index.js +1 -1
  148. package/dist/layout-painter/index.mjs +1 -1
  149. package/dist/layout-painter/renderPage.d.mts +6 -5
  150. package/dist/layout-painter/renderPage.d.ts +6 -5
  151. package/dist/layout-painter/renderPage.js +1 -1
  152. package/dist/layout-painter/renderPage.mjs +1 -1
  153. package/dist/lists-Bn29SzeS.d.ts +148 -0
  154. package/dist/lists-CyGxd5Y2.d.mts +148 -0
  155. package/dist/managers/AutoSaveManager.d.mts +5 -4
  156. package/dist/managers/AutoSaveManager.d.ts +5 -4
  157. package/dist/managers/TableSelectionManager.d.mts +5 -4
  158. package/dist/managers/TableSelectionManager.d.ts +5 -4
  159. package/dist/managers/types.d.mts +5 -4
  160. package/dist/managers/types.d.ts +5 -4
  161. package/dist/{marks-BY573yZn.d.mts → marks-CzrbFi4o.d.mts} +1 -1
  162. package/dist/{marks-CjC9tF5k.d.ts → marks-Dq1QsxKA.d.ts} +1 -1
  163. package/dist/mcp-cli.mjs +23 -23
  164. package/dist/mcp.d.mts +5 -4
  165. package/dist/mcp.d.ts +5 -4
  166. package/dist/mcp.js +8 -8
  167. package/dist/mcp.mjs +7 -7
  168. package/dist/{nodes-75Q9GBxV.d.ts → nodes-Bd6tTkp0.d.ts} +17 -2
  169. package/dist/{nodes-cEI7hVY2.d.mts → nodes-BvO8GGD4.d.mts} +17 -2
  170. package/dist/numberingParser-ZSQ3SDCV.d.ts +81 -0
  171. package/dist/numberingParser-nSPZlzKr.d.mts +81 -0
  172. package/dist/prosemirror/applyFormatting.d.mts +39 -6
  173. package/dist/prosemirror/applyFormatting.d.ts +39 -6
  174. package/dist/prosemirror/applyFormatting.js +1 -1
  175. package/dist/prosemirror/applyFormatting.mjs +1 -1
  176. package/dist/prosemirror/cellDragSelection.d.mts +46 -0
  177. package/dist/prosemirror/cellDragSelection.d.ts +46 -0
  178. package/dist/prosemirror/cellDragSelection.js +1 -0
  179. package/dist/prosemirror/cellDragSelection.mjs +1 -0
  180. package/dist/prosemirror/commands/formatting.d.mts +2 -2
  181. package/dist/prosemirror/commands/formatting.d.ts +2 -2
  182. package/dist/prosemirror/commands/formatting.js +1 -1
  183. package/dist/prosemirror/commands/formatting.mjs +1 -1
  184. package/dist/prosemirror/commands/index.d.mts +34 -4
  185. package/dist/prosemirror/commands/index.d.ts +34 -4
  186. package/dist/prosemirror/commands/index.js +1 -1
  187. package/dist/prosemirror/commands/index.mjs +1 -1
  188. package/dist/prosemirror/commands/paragraph.d.mts +11 -1
  189. package/dist/prosemirror/commands/paragraph.d.ts +11 -1
  190. package/dist/prosemirror/commands/paragraph.js +1 -1
  191. package/dist/prosemirror/commands/paragraph.mjs +1 -1
  192. package/dist/prosemirror/commands/sectionBreak.d.mts +25 -0
  193. package/dist/prosemirror/commands/sectionBreak.d.ts +25 -0
  194. package/dist/prosemirror/commands/sectionBreak.js +1 -0
  195. package/dist/prosemirror/commands/sectionBreak.mjs +1 -0
  196. package/dist/prosemirror/commentIdAllocator.d.mts +4 -3
  197. package/dist/prosemirror/commentIdAllocator.d.ts +4 -3
  198. package/dist/prosemirror/commentOps.d.mts +4 -3
  199. package/dist/prosemirror/commentOps.d.ts +4 -3
  200. package/dist/prosemirror/conversion/fromProseDoc.d.mts +5 -4
  201. package/dist/prosemirror/conversion/fromProseDoc.d.ts +5 -4
  202. package/dist/prosemirror/conversion/fromProseDoc.js +1 -1
  203. package/dist/prosemirror/conversion/fromProseDoc.mjs +1 -1
  204. package/dist/prosemirror/conversion/index.d.mts +5 -4
  205. package/dist/prosemirror/conversion/index.d.ts +5 -4
  206. package/dist/prosemirror/conversion/index.js +1 -1
  207. package/dist/prosemirror/conversion/index.mjs +1 -1
  208. package/dist/prosemirror/editor.css +13 -0
  209. package/dist/prosemirror/extensions/index.d.mts +1 -1
  210. package/dist/prosemirror/extensions/index.d.ts +1 -1
  211. package/dist/prosemirror/extensions/index.js +1 -1
  212. package/dist/prosemirror/extensions/index.mjs +1 -1
  213. package/dist/prosemirror/extensions/nodes/TableExtension.js +1 -1
  214. package/dist/prosemirror/extensions/nodes/TableExtension.mjs +1 -1
  215. package/dist/prosemirror/index.d.mts +21 -11
  216. package/dist/prosemirror/index.d.ts +21 -11
  217. package/dist/prosemirror/index.js +3 -3
  218. package/dist/prosemirror/index.mjs +3 -3
  219. package/dist/prosemirror/plugins/index.d.mts +6 -5
  220. package/dist/prosemirror/plugins/index.d.ts +6 -5
  221. package/dist/prosemirror/plugins/index.js +1 -1
  222. package/dist/prosemirror/plugins/index.mjs +1 -1
  223. package/dist/prosemirror/plugins/selectionTracker.d.mts +1 -1
  224. package/dist/prosemirror/plugins/selectionTracker.d.ts +1 -1
  225. package/dist/prosemirror/queries.d.mts +46 -4
  226. package/dist/prosemirror/queries.d.ts +46 -4
  227. package/dist/prosemirror/queries.js +2 -2
  228. package/dist/prosemirror/queries.mjs +2 -2
  229. package/dist/prosemirror/schema/index.d.mts +6 -5
  230. package/dist/prosemirror/schema/index.d.ts +6 -5
  231. package/dist/prosemirror/schema/index.js +1 -1
  232. package/dist/prosemirror/schema/index.mjs +1 -1
  233. package/dist/prosemirror/styles/index.d.mts +2 -2
  234. package/dist/prosemirror/styles/index.d.ts +2 -2
  235. package/dist/prosemirror/tableResize.js +1 -1
  236. package/dist/prosemirror/tableResize.mjs +1 -1
  237. package/dist/prosemirror/utils/extractTrackedChanges.d.mts +4 -3
  238. package/dist/prosemirror/utils/extractTrackedChanges.d.ts +4 -3
  239. package/dist/prosemirror/utils/extractTrackedChanges.js +1 -1
  240. package/dist/prosemirror/utils/extractTrackedChanges.mjs +1 -1
  241. package/dist/{sectionPropertiesSerializer-uXyGONxu.d.ts → sectionPropertiesSerializer-CzgskSoA.d.ts} +1 -1
  242. package/dist/{sectionPropertiesSerializer-D86QlzlT.d.mts → sectionPropertiesSerializer-D3yI82iZ.d.mts} +1 -1
  243. package/dist/{selectionContext-BPAqgNgk.d.ts → selectionContext-BJZZW1JA.d.ts} +1 -1
  244. package/dist/{selectionContext-CoZat7QZ.d.mts → selectionContext-BjMyVQZO.d.mts} +1 -1
  245. package/dist/{styles-BOJ93SAm.d.mts → styles-Dqec8Aw6.d.mts} +1 -1
  246. package/dist/{styles-BWqX2AS-.d.ts → styles-gEujs7j6.d.ts} +1 -1
  247. package/dist/types/agentApi.d.mts +1 -1
  248. package/dist/types/agentApi.d.ts +1 -1
  249. package/dist/types/content.d.mts +4 -3
  250. package/dist/types/content.d.ts +4 -3
  251. package/dist/types/content.js +1 -1
  252. package/dist/types/content.mjs +1 -1
  253. package/dist/types/document.d.mts +8 -6
  254. package/dist/types/document.d.ts +8 -6
  255. package/dist/types/document.js +1 -1
  256. package/dist/types/document.mjs +1 -1
  257. package/dist/utils/cardStyles.js +1 -1
  258. package/dist/utils/cardStyles.mjs +1 -1
  259. package/dist/utils/comments.d.mts +4 -3
  260. package/dist/utils/comments.d.ts +4 -3
  261. package/dist/utils/index.d.mts +41 -7
  262. package/dist/utils/index.d.ts +41 -7
  263. package/dist/utils/index.js +3 -3
  264. package/dist/utils/index.mjs +3 -3
  265. package/dist/utils/stylePreview.d.mts +83 -0
  266. package/dist/utils/stylePreview.d.ts +83 -0
  267. package/dist/utils/stylePreview.js +1 -0
  268. package/dist/utils/stylePreview.mjs +1 -0
  269. package/dist/utils/units.d.mts +7 -1
  270. package/dist/utils/units.d.ts +7 -1
  271. package/dist/utils/units.js +1 -1
  272. package/dist/utils/units.mjs +1 -1
  273. package/dist/{variableDetector-CaY-sDau.d.mts → variableDetector-D2-xDa2O.d.mts} +1 -1
  274. package/dist/{variableDetector-1mxzPfs2.d.ts → variableDetector-d-PpDlNV.d.ts} +1 -1
  275. package/dist/{watermark-DAcnAs_J.d.mts → watermark-D90356ZM.d.mts} +7 -1
  276. package/dist/{watermark-DAcnAs_J.d.ts → watermark-D90356ZM.d.ts} +7 -1
  277. package/package.json +25 -1
  278. package/dist/chunk-2WGTGBBS.js +0 -2
  279. package/dist/chunk-3G44SFHX.mjs +0 -4
  280. package/dist/chunk-4Q2IP5FW.js +0 -1
  281. package/dist/chunk-55XWETY4.mjs +0 -1
  282. package/dist/chunk-77GRQUSK.js +0 -1
  283. package/dist/chunk-7CZEZ3UL.mjs +0 -2
  284. package/dist/chunk-7LRR7RKE.mjs +0 -15
  285. package/dist/chunk-7OW3VCZE.mjs +0 -1
  286. package/dist/chunk-BHBOAP6Z.js +0 -3
  287. package/dist/chunk-CRMZH7U7.mjs +0 -2
  288. package/dist/chunk-CUY2THAO.mjs +0 -1
  289. package/dist/chunk-D3PRIF3Y.mjs +0 -1
  290. package/dist/chunk-DKKTY56Q.js +0 -1
  291. package/dist/chunk-EM33RGHT.mjs +0 -1
  292. package/dist/chunk-ESCPS4AO.mjs +0 -1
  293. package/dist/chunk-EUZLYQRB.mjs +0 -1
  294. package/dist/chunk-EV4LVK4X.js +0 -1
  295. package/dist/chunk-FW23IMBF.mjs +0 -1
  296. package/dist/chunk-HKN2NKOG.mjs +0 -1
  297. package/dist/chunk-INDYZOOS.js +0 -1
  298. package/dist/chunk-IUJCUITW.mjs +0 -1
  299. package/dist/chunk-IYKBX24M.js +0 -1
  300. package/dist/chunk-J3YFJDZD.js +0 -1
  301. package/dist/chunk-JHTURDPX.mjs +0 -1
  302. package/dist/chunk-KAOLVBLH.js +0 -1
  303. package/dist/chunk-L5NPEM7C.js +0 -1
  304. package/dist/chunk-LERLET2D.js +0 -4
  305. package/dist/chunk-MNOHUTKE.js +0 -15
  306. package/dist/chunk-MOKKS75W.mjs +0 -3
  307. package/dist/chunk-NAFMAKLK.js +0 -2
  308. package/dist/chunk-OEC6SBDV.mjs +0 -1
  309. package/dist/chunk-OF373DBR.mjs +0 -1
  310. package/dist/chunk-OTHV7YV2.js +0 -2
  311. package/dist/chunk-Q4IEATDJ.js +0 -1
  312. package/dist/chunk-QAJSNLJR.mjs +0 -1
  313. package/dist/chunk-RSU4HTC6.js +0 -1
  314. package/dist/chunk-TUIEV7Q7.js +0 -1
  315. package/dist/chunk-U67MWOPZ.mjs +0 -1
  316. package/dist/chunk-UE2ZKRYB.mjs +0 -2
  317. package/dist/chunk-VOCHZNOF.mjs +0 -1
  318. package/dist/chunk-VW22RZ6C.mjs +0 -1
  319. package/dist/chunk-WVERBZZU.js +0 -1
  320. package/dist/chunk-WWNOXNEX.mjs +0 -2
  321. package/dist/chunk-XLB6AC5Q.js +0 -1
  322. package/dist/chunk-YPQACU4A.js +0 -1
  323. package/dist/chunk-ZX26QZJ5.mjs +0 -1
  324. package/dist/executor-DZAMMQ35.js +0 -1
  325. package/dist/executor-ZCJRLT3Z.mjs +0 -1
package/dist/mcp.d.mts CHANGED
@@ -22,11 +22,12 @@
22
22
  import { M as McpToolDefinition, e as McpSession, J as JsonSchema } from './types-DTF0N7UE.mjs';
23
23
  import './types/document.mjs';
24
24
  import './colors-C3vA7HUU.mjs';
25
- import './formatting-BH4hcZiq.mjs';
26
- import './content-3xF4WDE8.mjs';
25
+ import './formatting-DFtuRFQY.mjs';
26
+ import './lists-CyGxd5Y2.mjs';
27
+ import './content-CbBCrsr0.mjs';
27
28
  import './docx/wrapTypes.mjs';
28
- import './watermark-DAcnAs_J.mjs';
29
- import './styles-BOJ93SAm.mjs';
29
+ import './watermark-D90356ZM.mjs';
30
+ import './styles-Dqec8Aw6.mjs';
30
31
  import './types/agentApi.mjs';
31
32
 
32
33
  /**
package/dist/mcp.d.ts CHANGED
@@ -22,11 +22,12 @@
22
22
  import { M as McpToolDefinition, e as McpSession, J as JsonSchema } from './types-DDQWU7-j.js';
23
23
  import './types/document.js';
24
24
  import './colors-C3vA7HUU.js';
25
- import './formatting-_OXU8gLB.js';
26
- import './content-C8fc_tL6.js';
25
+ import './formatting-JhqWT_XM.js';
26
+ import './lists-Bn29SzeS.js';
27
+ import './content-BebvPfXc.js';
27
28
  import './docx/wrapTypes.js';
28
- import './watermark-DAcnAs_J.js';
29
- import './styles-BWqX2AS-.js';
29
+ import './watermark-D90356ZM.js';
30
+ import './styles-gEujs7j6.js';
30
31
  import './types/agentApi.js';
31
32
 
32
33
  /**
package/dist/mcp.js CHANGED
@@ -1,16 +1,16 @@
1
- 'use strict';var chunkTE2AF7FM_js=require('./chunk-TE2AF7FM.js'),chunkBH3ACQ3M_js=require('./chunk-BH3ACQ3M.js');require('./chunk-NAFMAKLK.js');var chunk4BFNWPKW_js=require('./chunk-4BFNWPKW.js'),chunkOTHV7YV2_js=require('./chunk-OTHV7YV2.js');require('./chunk-LERLET2D.js'),require('./chunk-FIGLFSNR.js'),require('./chunk-MNOHUTKE.js'),require('./chunk-SCK6ZM5V.js'),require('./chunk-Z3LGMBJC.js'),require('./chunk-3R7QHNI5.js'),require('./chunk-C2BAPYGJ.js'),require('./chunk-4Q2IP5FW.js'),require('./chunk-GSKMHXHG.js'),require('./chunk-DC7S76ZX.js');var u={type:"string",description:"Document ID returned from docx_load"},x={type:"object",properties:{paragraphIndex:{type:"number",description:"Index of the paragraph (0-indexed)",minimum:0},offset:{type:"number",description:"Character offset within the paragraph",minimum:0}},required:["paragraphIndex","offset"]},h={type:"object",properties:{start:x,end:x},required:["start","end"]},D={name:"docx_load",description:`Load a DOCX document from base64-encoded content.
1
+ 'use strict';var chunkFETIBXTH_js=require('./chunk-FETIBXTH.js'),chunkJQUIUKRO_js=require('./chunk-JQUIUKRO.js');require('./chunk-4JPHW7ZI.js');var chunk4BFNWPKW_js=require('./chunk-4BFNWPKW.js'),chunkV3NE7Q22_js=require('./chunk-V3NE7Q22.js');require('./chunk-6KYOT4E7.js'),require('./chunk-FIGLFSNR.js'),require('./chunk-QVRMX2AC.js'),require('./chunk-LW5OFHSW.js'),require('./chunk-Z3LGMBJC.js'),require('./chunk-C2BAPYGJ.js'),require('./chunk-BJSG6TEG.js'),require('./chunk-GSKMHXHG.js'),require('./chunk-H57LNDBH.js'),require('./chunk-3R7QHNI5.js'),require('./chunk-DC7S76ZX.js');var u={type:"string",description:"Document ID returned from docx_load"},x={type:"object",properties:{paragraphIndex:{type:"number",description:"Index of the paragraph (0-indexed)",minimum:0},offset:{type:"number",description:"Character offset within the paragraph",minimum:0}},required:["paragraphIndex","offset"]},h={type:"object",properties:{start:x,end:x},required:["start","end"]},D={name:"docx_load",description:`Load a DOCX document from base64-encoded content.
2
2
  Returns a document ID that can be used with other tools.
3
- The document remains in session memory until closed.`,inputSchema:{type:"object",properties:{content:{type:"string",description:"Base64-encoded DOCX file content"},source:{type:"string",description:"Optional source filename or identifier for reference"}},required:["content"]},handler:async(r,s)=>{let{content:e,source:c}=r;try{let t=atob(e),n=new Uint8Array(t.length);for(let l=0;l<t.length;l++)n[l]=t.charCodeAt(l);let o=n.buffer,a=await chunkOTHV7YV2_js.f(o),d=`doc_${Date.now()}_${Math.random().toString(36).substr(2,9)}`;s.session.documents.set(d,{id:d,document:a,buffer:o,source:c,lastModified:Date.now()});let p=a.package.document.content.filter(l=>l.type==="paragraph").length;return {content:[{type:"text",text:JSON.stringify({documentId:d,source:c,paragraphCount:p,message:"Document loaded successfully"})}]}}catch(t){return {isError:true,content:[{type:"text",text:`Failed to load document: ${t.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},C={name:"docx_save",description:`Export the document to base64-encoded DOCX format.
4
- Returns the document as a base64 string that can be saved to a file.`,inputSchema:{type:"object",properties:{documentId:u},required:["documentId"]},handler:async(r,s)=>{let{documentId:e}=r,c=s.session.documents.get(e);if(!c)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let t;c.buffer?t=await chunkBH3ACQ3M_js.i(c.document):t=await chunkBH3ACQ3M_js.t(c.document);let n=new Uint8Array(t),o="";for(let d=0;d<n.length;d++)o+=String.fromCharCode(n[d]);let a=btoa(o);return {content:[{type:"text",text:JSON.stringify({documentId:e,base64:a,size:t.byteLength,message:"Document exported successfully"})}]}}catch(t){return {isError:true,content:[{type:"text",text:`Failed to save document: ${t.message}`}]}}},annotations:{category:"core",readOnly:true,complexity:"low"}},R={name:"docx_close",description:`Close a document and free its memory.
3
+ The document remains in session memory until closed.`,inputSchema:{type:"object",properties:{content:{type:"string",description:"Base64-encoded DOCX file content"},source:{type:"string",description:"Optional source filename or identifier for reference"}},required:["content"]},handler:async(r,s)=>{let{content:e,source:c}=r;try{let t=atob(e),n=new Uint8Array(t.length);for(let l=0;l<t.length;l++)n[l]=t.charCodeAt(l);let o=n.buffer,a=await chunkV3NE7Q22_js.a(o),d=`doc_${Date.now()}_${Math.random().toString(36).substr(2,9)}`;s.session.documents.set(d,{id:d,document:a,buffer:o,source:c,lastModified:Date.now()});let p=a.package.document.content.filter(l=>l.type==="paragraph").length;return {content:[{type:"text",text:JSON.stringify({documentId:d,source:c,paragraphCount:p,message:"Document loaded successfully"})}]}}catch(t){return {isError:true,content:[{type:"text",text:`Failed to load document: ${t.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},C={name:"docx_save",description:`Export the document to base64-encoded DOCX format.
4
+ Returns the document as a base64 string that can be saved to a file.`,inputSchema:{type:"object",properties:{documentId:u},required:["documentId"]},handler:async(r,s)=>{let{documentId:e}=r,c=s.session.documents.get(e);if(!c)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let t;c.buffer?t=await chunkJQUIUKRO_js.i(c.document):t=await chunkJQUIUKRO_js.t(c.document);let n=new Uint8Array(t),o="";for(let d=0;d<n.length;d++)o+=String.fromCharCode(n[d]);let a=btoa(o);return {content:[{type:"text",text:JSON.stringify({documentId:e,base64:a,size:t.byteLength,message:"Document exported successfully"})}]}}catch(t){return {isError:true,content:[{type:"text",text:`Failed to save document: ${t.message}`}]}}},annotations:{category:"core",readOnly:true,complexity:"low"}},R={name:"docx_close",description:`Close a document and free its memory.
5
5
  Use this when done working with a document.`,inputSchema:{type:"object",properties:{documentId:u},required:["documentId"]},handler:async(r,s)=>{let{documentId:e}=r;return s.session.documents.has(e)?(s.session.documents.delete(e),{content:[{type:"text",text:JSON.stringify({documentId:e,message:"Document closed"})}]}):{isError:true,content:[{type:"text",text:`Document not found: ${e}`}]}},annotations:{category:"core",readOnly:false,complexity:"low"}},k={name:"docx_get_info",description:`Get metadata and statistics about a document.
6
6
  Returns paragraph count, word count, table count, and other useful info.`,inputSchema:{type:"object",properties:{documentId:u},required:["documentId"]},handler:async(r,s)=>{let{documentId:e}=r,c=s.session.documents.get(e);if(!c)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};let t=c.document,n=t.package.document,o=n.content.filter(p=>p.type==="paragraph"),a=n.content.filter(p=>p.type==="table"),d=0;for(let p of o)if(p.type==="paragraph"){let l=P(p);d+=l.split(/\s+/).filter(y=>y.length>0).length;}return {content:[{type:"text",text:JSON.stringify({documentId:e,paragraphCount:o.length,tableCount:a.length,wordCount:d,hasStyles:!!t.package.styles,hasTheme:!!t.package.theme,source:c.source,lastModified:c.lastModified})}]}},annotations:{category:"core",readOnly:true,complexity:"low"}},$={name:"docx_get_text",description:`Get the plain text content of the document.
7
7
  Returns all text concatenated with paragraph breaks.
8
8
  Useful for understanding document content before making edits.`,inputSchema:{type:"object",properties:{documentId:u,maxLength:{type:"number",description:"Maximum characters to return (default: 10000)",default:1e4}},required:["documentId"]},handler:async(r,s)=>{let{documentId:e,maxLength:c=1e4}=r,t=s.session.documents.get(e);if(!t)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};let n=t.document.package.document,o=[];for(let p of n.content)p.type==="paragraph"?o.push(P(p)):p.type==="table"&&o.push("[TABLE]");let a=o.join(`
9
9
  `),d=a.length>c;return d&&(a=a.slice(0,c)+"..."),{content:[{type:"text",text:JSON.stringify({documentId:e,text:a,truncated:d,totalLength:d?o.join(`
10
10
  `).length:a.length})}]}},annotations:{category:"core",readOnly:true,complexity:"low"}},J={name:"docx_insert_text",description:`Insert text at a specific position in the document.
11
- Position is specified by paragraph index (0-indexed) and character offset.`,inputSchema:{type:"object",properties:{documentId:u,position:x,text:{type:"string",description:"Text to insert"}},required:["documentId","position","text"]},handler:async(r,s)=>{let{documentId:e,position:c,text:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=chunkTE2AF7FM_js.a(n.document,{type:"insertText",position:c,text:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,insertedLength:t.length,position:c})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to insert text: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},v={name:"docx_replace_text",description:`Replace text in a range with new text.
12
- Specify start and end positions to define the range to replace.`,inputSchema:{type:"object",properties:{documentId:u,range:h,text:{type:"string",description:"Replacement text"}},required:["documentId","range","text"]},handler:async(r,s)=>{let{documentId:e,range:c,text:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=chunkTE2AF7FM_js.a(n.document,{type:"replaceText",range:c,text:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,replacedRange:c,newTextLength:t.length})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to replace text: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},j={name:"docx_delete_text",description:`Delete text in a range.
13
- Specify start and end positions to define the range to delete.`,inputSchema:{type:"object",properties:{documentId:u,range:h},required:["documentId","range"]},handler:async(r,s)=>{let{documentId:e,range:c}=r,t=s.session.documents.get(e);if(!t)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let n=chunkTE2AF7FM_js.a(t.document,{type:"deleteText",range:c});return t.document=n,t.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,deletedRange:c})}]}}catch(n){return {isError:true,content:[{type:"text",text:`Failed to delete text: ${n.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},E={name:"docx_format_text",description:`Apply formatting to text in a range.
14
- Supports bold, italic, underline, font size, font family, color, and highlight.`,inputSchema:{type:"object",properties:{documentId:u,range:h,formatting:{type:"object",description:"Formatting options to apply",properties:{bold:{type:"boolean"},italic:{type:"boolean"},underline:{type:"boolean"},strikethrough:{type:"boolean"},fontSize:{type:"number",description:"Font size in points"},fontFamily:{type:"string"},color:{type:"string",description:'Hex color (e.g., "#FF0000")'},highlight:{type:"string",description:"Highlight color name"}}}},required:["documentId","range","formatting"]},handler:async(r,s)=>{let{documentId:e,range:c,formatting:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=chunkTE2AF7FM_js.a(n.document,{type:"formatText",range:c,formatting:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,range:c,appliedFormatting:t})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to format text: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"medium"}},O={name:"docx_apply_style",description:`Apply a named style to a paragraph.
15
- Use document styles like "Heading1", "Heading2", "Normal", etc.`,inputSchema:{type:"object",properties:{documentId:u,paragraphIndex:{type:"number",description:"Index of the paragraph (0-indexed)",minimum:0},styleId:{type:"string",description:'Style ID (e.g., "Heading1", "Normal")'}},required:["documentId","paragraphIndex","styleId"]},handler:async(r,s)=>{let{documentId:e,paragraphIndex:c,styleId:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=chunkTE2AF7FM_js.a(n.document,{type:"applyStyle",paragraphIndex:c,styleId:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,paragraphIndex:c,styleId:t})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to apply style: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}};function P(r){let s=[];for(let e of r.content)e.type==="run"?s.push(_(e)):e.type==="hyperlink"&&s.push(A(e));return s.join("")}function _(r){return r.content.filter(s=>s.type==="text").map(s=>s.text).join("")}function A(r){let s=[];for(let e of r.children)e.type==="run"&&s.push(_(e));return s.join("")}var T=[D,C,R,k,$,J,v,j,E,O];function q(r={}){let{name:s="docx-editor",version:e="0.1.0",includeCoreTools:c=true,debug:t=false,additionalTools:n=[]}=r,o=new Map,a={id:`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,documents:new Map,data:new Map};if(c)for(let i of T)o.set(i.name,i),t&&console.log(`[MCP] Registered core tool: ${i.name}`);let d=chunk4BFNWPKW_js.b.getMcpTools();for(let i of d)o.has(i.name)&&console.warn(`[MCP] Tool '${i.name}' from plugin overrides existing tool`),o.set(i.name,i),t&&console.log(`[MCP] Registered plugin tool: ${i.name}`);for(let i of n)o.set(i.name,i),t&&console.log(`[MCP] Registered additional tool: ${i.name}`);let p=t?(i,f)=>{console.log(`[MCP] ${i}`,f??"");}:()=>{};async function l(i,f){let M=o.get(i);if(!M)throw new Error(`Unknown tool: ${i}`);p(`Calling tool: ${i}`,f);let N={session:a,log:p};try{let g=await M.handler(f,N);return p(`Tool ${i} completed`,g),g}catch(g){throw p(`Tool ${i} failed`,g),g}}function y(){return Array.from(o.values()).map(i=>({name:i.name,description:i.description,inputSchema:z(i.inputSchema),category:i.annotations?.category}))}function L(){return {name:s,version:e,toolCount:o.size}}return {tools:o,session:a,handleToolCall:l,listTools:y,getInfo:L}}async function F(r,s){let{id:e,method:c,params:t}=s;try{switch(c){case "initialize":return {jsonrpc:"2.0",id:e,result:{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:r.getInfo()}};case "tools/list":{let n=r.listTools();return {jsonrpc:"2.0",id:e,result:{tools:n.map(o=>({name:o.name,description:o.description,inputSchema:o.inputSchema}))}}}case "tools/call":{let{name:n,arguments:o}=t,a=await r.handleToolCall(n,o);return {jsonrpc:"2.0",id:e,result:a}}default:return {jsonrpc:"2.0",id:e,error:{code:-32601,message:`Method not found: ${c}`}}}}catch(n){return {jsonrpc:"2.0",id:e,error:{code:-32e3,message:n.message}}}}async function H(r={}){let s=q(r);r.debug&&(console.error(`[MCP] Server started: ${s.getInfo().name} v${s.getInfo().version}`),console.error(`[MCP] Tools registered: ${s.tools.size}`));let c=(await import('readline')).createInterface({input:process.stdin,output:process.stdout,terminal:false}),t="";c.on("line",async n=>{t+=n;try{let o=JSON.parse(t);t="";let a=await F(s,o);process.stdout.write(JSON.stringify(a)+`
11
+ Position is specified by paragraph index (0-indexed) and character offset.`,inputSchema:{type:"object",properties:{documentId:u,position:x,text:{type:"string",description:"Text to insert"}},required:["documentId","position","text"]},handler:async(r,s)=>{let{documentId:e,position:c,text:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=chunkFETIBXTH_js.a(n.document,{type:"insertText",position:c,text:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,insertedLength:t.length,position:c})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to insert text: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},v={name:"docx_replace_text",description:`Replace text in a range with new text.
12
+ Specify start and end positions to define the range to replace.`,inputSchema:{type:"object",properties:{documentId:u,range:h,text:{type:"string",description:"Replacement text"}},required:["documentId","range","text"]},handler:async(r,s)=>{let{documentId:e,range:c,text:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=chunkFETIBXTH_js.a(n.document,{type:"replaceText",range:c,text:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,replacedRange:c,newTextLength:t.length})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to replace text: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},j={name:"docx_delete_text",description:`Delete text in a range.
13
+ Specify start and end positions to define the range to delete.`,inputSchema:{type:"object",properties:{documentId:u,range:h},required:["documentId","range"]},handler:async(r,s)=>{let{documentId:e,range:c}=r,t=s.session.documents.get(e);if(!t)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let n=chunkFETIBXTH_js.a(t.document,{type:"deleteText",range:c});return t.document=n,t.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,deletedRange:c})}]}}catch(n){return {isError:true,content:[{type:"text",text:`Failed to delete text: ${n.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},E={name:"docx_format_text",description:`Apply formatting to text in a range.
14
+ Supports bold, italic, underline, font size, font family, color, and highlight.`,inputSchema:{type:"object",properties:{documentId:u,range:h,formatting:{type:"object",description:"Formatting options to apply",properties:{bold:{type:"boolean"},italic:{type:"boolean"},underline:{type:"boolean"},strikethrough:{type:"boolean"},fontSize:{type:"number",description:"Font size in points"},fontFamily:{type:"string"},color:{type:"string",description:'Hex color (e.g., "#FF0000")'},highlight:{type:"string",description:"Highlight color name"}}}},required:["documentId","range","formatting"]},handler:async(r,s)=>{let{documentId:e,range:c,formatting:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=chunkFETIBXTH_js.a(n.document,{type:"formatText",range:c,formatting:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,range:c,appliedFormatting:t})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to format text: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"medium"}},O={name:"docx_apply_style",description:`Apply a named style to a paragraph.
15
+ Use document styles like "Heading1", "Heading2", "Normal", etc.`,inputSchema:{type:"object",properties:{documentId:u,paragraphIndex:{type:"number",description:"Index of the paragraph (0-indexed)",minimum:0},styleId:{type:"string",description:'Style ID (e.g., "Heading1", "Normal")'}},required:["documentId","paragraphIndex","styleId"]},handler:async(r,s)=>{let{documentId:e,paragraphIndex:c,styleId:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=chunkFETIBXTH_js.a(n.document,{type:"applyStyle",paragraphIndex:c,styleId:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,paragraphIndex:c,styleId:t})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to apply style: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}};function P(r){let s=[];for(let e of r.content)e.type==="run"?s.push(_(e)):e.type==="hyperlink"&&s.push(A(e));return s.join("")}function _(r){return r.content.filter(s=>s.type==="text").map(s=>s.text).join("")}function A(r){let s=[];for(let e of r.children)e.type==="run"&&s.push(_(e));return s.join("")}var T=[D,C,R,k,$,J,v,j,E,O];function q(r={}){let{name:s="docx-editor",version:e="0.1.0",includeCoreTools:c=true,debug:t=false,additionalTools:n=[]}=r,o=new Map,a={id:`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,documents:new Map,data:new Map};if(c)for(let i of T)o.set(i.name,i),t&&console.log(`[MCP] Registered core tool: ${i.name}`);let d=chunk4BFNWPKW_js.b.getMcpTools();for(let i of d)o.has(i.name)&&console.warn(`[MCP] Tool '${i.name}' from plugin overrides existing tool`),o.set(i.name,i),t&&console.log(`[MCP] Registered plugin tool: ${i.name}`);for(let i of n)o.set(i.name,i),t&&console.log(`[MCP] Registered additional tool: ${i.name}`);let p=t?(i,f)=>{console.log(`[MCP] ${i}`,f??"");}:()=>{};async function l(i,f){let M=o.get(i);if(!M)throw new Error(`Unknown tool: ${i}`);p(`Calling tool: ${i}`,f);let N={session:a,log:p};try{let g=await M.handler(f,N);return p(`Tool ${i} completed`,g),g}catch(g){throw p(`Tool ${i} failed`,g),g}}function y(){return Array.from(o.values()).map(i=>({name:i.name,description:i.description,inputSchema:z(i.inputSchema),category:i.annotations?.category}))}function L(){return {name:s,version:e,toolCount:o.size}}return {tools:o,session:a,handleToolCall:l,listTools:y,getInfo:L}}async function F(r,s){let{id:e,method:c,params:t}=s;try{switch(c){case "initialize":return {jsonrpc:"2.0",id:e,result:{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:r.getInfo()}};case "tools/list":{let n=r.listTools();return {jsonrpc:"2.0",id:e,result:{tools:n.map(o=>({name:o.name,description:o.description,inputSchema:o.inputSchema}))}}}case "tools/call":{let{name:n,arguments:o}=t,a=await r.handleToolCall(n,o);return {jsonrpc:"2.0",id:e,result:a}}default:return {jsonrpc:"2.0",id:e,error:{code:-32601,message:`Method not found: ${c}`}}}}catch(n){return {jsonrpc:"2.0",id:e,error:{code:-32e3,message:n.message}}}}async function H(r={}){let s=q(r);r.debug&&(console.error(`[MCP] Server started: ${s.getInfo().name} v${s.getInfo().version}`),console.error(`[MCP] Tools registered: ${s.tools.size}`));let c=(await import('readline')).createInterface({input:process.stdin,output:process.stdout,terminal:false}),t="";c.on("line",async n=>{t+=n;try{let o=JSON.parse(t);t="";let a=await F(s,o);process.stdout.write(JSON.stringify(a)+`
16
16
  `);}catch{}}),c.on("close",()=>{r.debug&&console.error("[MCP] Server closed"),process.exit(0);});}function z(r){return typeof r=="object"&&r!==null&&("type"in r||"properties"in r)?r:{type:"object",properties:{}}}exports.applyStyleTool=O;exports.closeDocumentTool=R;exports.coreMcpTools=T;exports.createMcpServer=q;exports.deleteTextTool=j;exports.formatTextTool=E;exports.getDocumentInfoTool=k;exports.getDocumentTextTool=$;exports.handleJsonRpcRequest=F;exports.insertTextTool=J;exports.loadDocumentTool=D;exports.replaceTextTool=v;exports.saveDocumentTool=C;exports.startStdioServer=H;
package/dist/mcp.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import {a}from'./chunk-CUY2THAO.mjs';import {i,t}from'./chunk-CHN26LLL.mjs';import'./chunk-WWNOXNEX.mjs';import {b}from'./chunk-3NRMSZX2.mjs';import {f}from'./chunk-UE2ZKRYB.mjs';import'./chunk-3G44SFHX.mjs';import'./chunk-MOCGHQ4A.mjs';import'./chunk-7LRR7RKE.mjs';import'./chunk-7CZEZ3UL.mjs';import'./chunk-W77JXDEV.mjs';import'./chunk-3ANZ3252.mjs';import'./chunk-LE67NTCN.mjs';import'./chunk-VW22RZ6C.mjs';import'./chunk-DI6CRWSW.mjs';import'./chunk-QYUPLKLP.mjs';var u={type:"string",description:"Document ID returned from docx_load"},x={type:"object",properties:{paragraphIndex:{type:"number",description:"Index of the paragraph (0-indexed)",minimum:0},offset:{type:"number",description:"Character offset within the paragraph",minimum:0}},required:["paragraphIndex","offset"]},h={type:"object",properties:{start:x,end:x},required:["start","end"]},D={name:"docx_load",description:`Load a DOCX document from base64-encoded content.
1
+ import {a as a$1}from'./chunk-B6FA4MJ5.mjs';import {i,t}from'./chunk-F24WZXN4.mjs';import'./chunk-2LVK7EF5.mjs';import {b}from'./chunk-3NRMSZX2.mjs';import {a}from'./chunk-C57BOE7B.mjs';import'./chunk-4QJEMD23.mjs';import'./chunk-MOCGHQ4A.mjs';import'./chunk-CDBKFBC2.mjs';import'./chunk-3HLRRK6N.mjs';import'./chunk-W77JXDEV.mjs';import'./chunk-LE67NTCN.mjs';import'./chunk-KNY7SXPJ.mjs';import'./chunk-DI6CRWSW.mjs';import'./chunk-VJFIAFZ5.mjs';import'./chunk-3ANZ3252.mjs';import'./chunk-QYUPLKLP.mjs';var u={type:"string",description:"Document ID returned from docx_load"},x={type:"object",properties:{paragraphIndex:{type:"number",description:"Index of the paragraph (0-indexed)",minimum:0},offset:{type:"number",description:"Character offset within the paragraph",minimum:0}},required:["paragraphIndex","offset"]},h={type:"object",properties:{start:x,end:x},required:["start","end"]},D={name:"docx_load",description:`Load a DOCX document from base64-encoded content.
2
2
  Returns a document ID that can be used with other tools.
3
- The document remains in session memory until closed.`,inputSchema:{type:"object",properties:{content:{type:"string",description:"Base64-encoded DOCX file content"},source:{type:"string",description:"Optional source filename or identifier for reference"}},required:["content"]},handler:async(r,s)=>{let{content:e,source:c}=r;try{let t=atob(e),n=new Uint8Array(t.length);for(let l=0;l<t.length;l++)n[l]=t.charCodeAt(l);let o=n.buffer,a=await f(o),d=`doc_${Date.now()}_${Math.random().toString(36).substr(2,9)}`;s.session.documents.set(d,{id:d,document:a,buffer:o,source:c,lastModified:Date.now()});let p=a.package.document.content.filter(l=>l.type==="paragraph").length;return {content:[{type:"text",text:JSON.stringify({documentId:d,source:c,paragraphCount:p,message:"Document loaded successfully"})}]}}catch(t){return {isError:true,content:[{type:"text",text:`Failed to load document: ${t.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},C={name:"docx_save",description:`Export the document to base64-encoded DOCX format.
3
+ The document remains in session memory until closed.`,inputSchema:{type:"object",properties:{content:{type:"string",description:"Base64-encoded DOCX file content"},source:{type:"string",description:"Optional source filename or identifier for reference"}},required:["content"]},handler:async(r,s)=>{let{content:e,source:c}=r;try{let t=atob(e),n=new Uint8Array(t.length);for(let l=0;l<t.length;l++)n[l]=t.charCodeAt(l);let o=n.buffer,a$1=await a(o),d=`doc_${Date.now()}_${Math.random().toString(36).substr(2,9)}`;s.session.documents.set(d,{id:d,document:a$1,buffer:o,source:c,lastModified:Date.now()});let p=a$1.package.document.content.filter(l=>l.type==="paragraph").length;return {content:[{type:"text",text:JSON.stringify({documentId:d,source:c,paragraphCount:p,message:"Document loaded successfully"})}]}}catch(t){return {isError:true,content:[{type:"text",text:`Failed to load document: ${t.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},C={name:"docx_save",description:`Export the document to base64-encoded DOCX format.
4
4
  Returns the document as a base64 string that can be saved to a file.`,inputSchema:{type:"object",properties:{documentId:u},required:["documentId"]},handler:async(r,s)=>{let{documentId:e}=r,c=s.session.documents.get(e);if(!c)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let t$1;c.buffer?t$1=await i(c.document):t$1=await t(c.document);let n=new Uint8Array(t$1),o="";for(let d=0;d<n.length;d++)o+=String.fromCharCode(n[d]);let a=btoa(o);return {content:[{type:"text",text:JSON.stringify({documentId:e,base64:a,size:t$1.byteLength,message:"Document exported successfully"})}]}}catch(t){return {isError:true,content:[{type:"text",text:`Failed to save document: ${t.message}`}]}}},annotations:{category:"core",readOnly:true,complexity:"low"}},R={name:"docx_close",description:`Close a document and free its memory.
5
5
  Use this when done working with a document.`,inputSchema:{type:"object",properties:{documentId:u},required:["documentId"]},handler:async(r,s)=>{let{documentId:e}=r;return s.session.documents.has(e)?(s.session.documents.delete(e),{content:[{type:"text",text:JSON.stringify({documentId:e,message:"Document closed"})}]}):{isError:true,content:[{type:"text",text:`Document not found: ${e}`}]}},annotations:{category:"core",readOnly:false,complexity:"low"}},k={name:"docx_get_info",description:`Get metadata and statistics about a document.
6
6
  Returns paragraph count, word count, table count, and other useful info.`,inputSchema:{type:"object",properties:{documentId:u},required:["documentId"]},handler:async(r,s)=>{let{documentId:e}=r,c=s.session.documents.get(e);if(!c)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};let t=c.document,n=t.package.document,o=n.content.filter(p=>p.type==="paragraph"),a=n.content.filter(p=>p.type==="table"),d=0;for(let p of o)if(p.type==="paragraph"){let l=P(p);d+=l.split(/\s+/).filter(y=>y.length>0).length;}return {content:[{type:"text",text:JSON.stringify({documentId:e,paragraphCount:o.length,tableCount:a.length,wordCount:d,hasStyles:!!t.package.styles,hasTheme:!!t.package.theme,source:c.source,lastModified:c.lastModified})}]}},annotations:{category:"core",readOnly:true,complexity:"low"}},$={name:"docx_get_text",description:`Get the plain text content of the document.
@@ -8,9 +8,9 @@ Returns all text concatenated with paragraph breaks.
8
8
  Useful for understanding document content before making edits.`,inputSchema:{type:"object",properties:{documentId:u,maxLength:{type:"number",description:"Maximum characters to return (default: 10000)",default:1e4}},required:["documentId"]},handler:async(r,s)=>{let{documentId:e,maxLength:c=1e4}=r,t=s.session.documents.get(e);if(!t)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};let n=t.document.package.document,o=[];for(let p of n.content)p.type==="paragraph"?o.push(P(p)):p.type==="table"&&o.push("[TABLE]");let a=o.join(`
9
9
  `),d=a.length>c;return d&&(a=a.slice(0,c)+"..."),{content:[{type:"text",text:JSON.stringify({documentId:e,text:a,truncated:d,totalLength:d?o.join(`
10
10
  `).length:a.length})}]}},annotations:{category:"core",readOnly:true,complexity:"low"}},J={name:"docx_insert_text",description:`Insert text at a specific position in the document.
11
- Position is specified by paragraph index (0-indexed) and character offset.`,inputSchema:{type:"object",properties:{documentId:u,position:x,text:{type:"string",description:"Text to insert"}},required:["documentId","position","text"]},handler:async(r,s)=>{let{documentId:e,position:c,text:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=a(n.document,{type:"insertText",position:c,text:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,insertedLength:t.length,position:c})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to insert text: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},v={name:"docx_replace_text",description:`Replace text in a range with new text.
12
- Specify start and end positions to define the range to replace.`,inputSchema:{type:"object",properties:{documentId:u,range:h,text:{type:"string",description:"Replacement text"}},required:["documentId","range","text"]},handler:async(r,s)=>{let{documentId:e,range:c,text:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=a(n.document,{type:"replaceText",range:c,text:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,replacedRange:c,newTextLength:t.length})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to replace text: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},j={name:"docx_delete_text",description:`Delete text in a range.
13
- Specify start and end positions to define the range to delete.`,inputSchema:{type:"object",properties:{documentId:u,range:h},required:["documentId","range"]},handler:async(r,s)=>{let{documentId:e,range:c}=r,t=s.session.documents.get(e);if(!t)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let n=a(t.document,{type:"deleteText",range:c});return t.document=n,t.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,deletedRange:c})}]}}catch(n){return {isError:true,content:[{type:"text",text:`Failed to delete text: ${n.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},E={name:"docx_format_text",description:`Apply formatting to text in a range.
14
- Supports bold, italic, underline, font size, font family, color, and highlight.`,inputSchema:{type:"object",properties:{documentId:u,range:h,formatting:{type:"object",description:"Formatting options to apply",properties:{bold:{type:"boolean"},italic:{type:"boolean"},underline:{type:"boolean"},strikethrough:{type:"boolean"},fontSize:{type:"number",description:"Font size in points"},fontFamily:{type:"string"},color:{type:"string",description:'Hex color (e.g., "#FF0000")'},highlight:{type:"string",description:"Highlight color name"}}}},required:["documentId","range","formatting"]},handler:async(r,s)=>{let{documentId:e,range:c,formatting:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=a(n.document,{type:"formatText",range:c,formatting:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,range:c,appliedFormatting:t})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to format text: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"medium"}},O={name:"docx_apply_style",description:`Apply a named style to a paragraph.
15
- Use document styles like "Heading1", "Heading2", "Normal", etc.`,inputSchema:{type:"object",properties:{documentId:u,paragraphIndex:{type:"number",description:"Index of the paragraph (0-indexed)",minimum:0},styleId:{type:"string",description:'Style ID (e.g., "Heading1", "Normal")'}},required:["documentId","paragraphIndex","styleId"]},handler:async(r,s)=>{let{documentId:e,paragraphIndex:c,styleId:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=a(n.document,{type:"applyStyle",paragraphIndex:c,styleId:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,paragraphIndex:c,styleId:t})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to apply style: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}};function P(r){let s=[];for(let e of r.content)e.type==="run"?s.push(_(e)):e.type==="hyperlink"&&s.push(A(e));return s.join("")}function _(r){return r.content.filter(s=>s.type==="text").map(s=>s.text).join("")}function A(r){let s=[];for(let e of r.children)e.type==="run"&&s.push(_(e));return s.join("")}var T=[D,C,R,k,$,J,v,j,E,O];function q(r={}){let{name:s="docx-editor",version:e="0.1.0",includeCoreTools:c=true,debug:t=false,additionalTools:n=[]}=r,o=new Map,a={id:`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,documents:new Map,data:new Map};if(c)for(let i of T)o.set(i.name,i),t&&console.log(`[MCP] Registered core tool: ${i.name}`);let d=b.getMcpTools();for(let i of d)o.has(i.name)&&console.warn(`[MCP] Tool '${i.name}' from plugin overrides existing tool`),o.set(i.name,i),t&&console.log(`[MCP] Registered plugin tool: ${i.name}`);for(let i of n)o.set(i.name,i),t&&console.log(`[MCP] Registered additional tool: ${i.name}`);let p=t?(i,f)=>{console.log(`[MCP] ${i}`,f??"");}:()=>{};async function l(i,f){let M=o.get(i);if(!M)throw new Error(`Unknown tool: ${i}`);p(`Calling tool: ${i}`,f);let N={session:a,log:p};try{let g=await M.handler(f,N);return p(`Tool ${i} completed`,g),g}catch(g){throw p(`Tool ${i} failed`,g),g}}function y(){return Array.from(o.values()).map(i=>({name:i.name,description:i.description,inputSchema:z(i.inputSchema),category:i.annotations?.category}))}function L(){return {name:s,version:e,toolCount:o.size}}return {tools:o,session:a,handleToolCall:l,listTools:y,getInfo:L}}async function F(r,s){let{id:e,method:c,params:t}=s;try{switch(c){case "initialize":return {jsonrpc:"2.0",id:e,result:{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:r.getInfo()}};case "tools/list":{let n=r.listTools();return {jsonrpc:"2.0",id:e,result:{tools:n.map(o=>({name:o.name,description:o.description,inputSchema:o.inputSchema}))}}}case "tools/call":{let{name:n,arguments:o}=t,a=await r.handleToolCall(n,o);return {jsonrpc:"2.0",id:e,result:a}}default:return {jsonrpc:"2.0",id:e,error:{code:-32601,message:`Method not found: ${c}`}}}}catch(n){return {jsonrpc:"2.0",id:e,error:{code:-32e3,message:n.message}}}}async function H(r={}){let s=q(r);r.debug&&(console.error(`[MCP] Server started: ${s.getInfo().name} v${s.getInfo().version}`),console.error(`[MCP] Tools registered: ${s.tools.size}`));let c=(await import('readline')).createInterface({input:process.stdin,output:process.stdout,terminal:false}),t="";c.on("line",async n=>{t+=n;try{let o=JSON.parse(t);t="";let a=await F(s,o);process.stdout.write(JSON.stringify(a)+`
11
+ Position is specified by paragraph index (0-indexed) and character offset.`,inputSchema:{type:"object",properties:{documentId:u,position:x,text:{type:"string",description:"Text to insert"}},required:["documentId","position","text"]},handler:async(r,s)=>{let{documentId:e,position:c,text:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=a$1(n.document,{type:"insertText",position:c,text:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,insertedLength:t.length,position:c})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to insert text: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},v={name:"docx_replace_text",description:`Replace text in a range with new text.
12
+ Specify start and end positions to define the range to replace.`,inputSchema:{type:"object",properties:{documentId:u,range:h,text:{type:"string",description:"Replacement text"}},required:["documentId","range","text"]},handler:async(r,s)=>{let{documentId:e,range:c,text:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=a$1(n.document,{type:"replaceText",range:c,text:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,replacedRange:c,newTextLength:t.length})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to replace text: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},j={name:"docx_delete_text",description:`Delete text in a range.
13
+ Specify start and end positions to define the range to delete.`,inputSchema:{type:"object",properties:{documentId:u,range:h},required:["documentId","range"]},handler:async(r,s)=>{let{documentId:e,range:c}=r,t=s.session.documents.get(e);if(!t)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let n=a$1(t.document,{type:"deleteText",range:c});return t.document=n,t.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,deletedRange:c})}]}}catch(n){return {isError:true,content:[{type:"text",text:`Failed to delete text: ${n.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},E={name:"docx_format_text",description:`Apply formatting to text in a range.
14
+ Supports bold, italic, underline, font size, font family, color, and highlight.`,inputSchema:{type:"object",properties:{documentId:u,range:h,formatting:{type:"object",description:"Formatting options to apply",properties:{bold:{type:"boolean"},italic:{type:"boolean"},underline:{type:"boolean"},strikethrough:{type:"boolean"},fontSize:{type:"number",description:"Font size in points"},fontFamily:{type:"string"},color:{type:"string",description:'Hex color (e.g., "#FF0000")'},highlight:{type:"string",description:"Highlight color name"}}}},required:["documentId","range","formatting"]},handler:async(r,s)=>{let{documentId:e,range:c,formatting:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=a$1(n.document,{type:"formatText",range:c,formatting:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,range:c,appliedFormatting:t})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to format text: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"medium"}},O={name:"docx_apply_style",description:`Apply a named style to a paragraph.
15
+ Use document styles like "Heading1", "Heading2", "Normal", etc.`,inputSchema:{type:"object",properties:{documentId:u,paragraphIndex:{type:"number",description:"Index of the paragraph (0-indexed)",minimum:0},styleId:{type:"string",description:'Style ID (e.g., "Heading1", "Normal")'}},required:["documentId","paragraphIndex","styleId"]},handler:async(r,s)=>{let{documentId:e,paragraphIndex:c,styleId:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=a$1(n.document,{type:"applyStyle",paragraphIndex:c,styleId:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,paragraphIndex:c,styleId:t})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to apply style: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}};function P(r){let s=[];for(let e of r.content)e.type==="run"?s.push(_(e)):e.type==="hyperlink"&&s.push(A(e));return s.join("")}function _(r){return r.content.filter(s=>s.type==="text").map(s=>s.text).join("")}function A(r){let s=[];for(let e of r.children)e.type==="run"&&s.push(_(e));return s.join("")}var T=[D,C,R,k,$,J,v,j,E,O];function q(r={}){let{name:s="docx-editor",version:e="0.1.0",includeCoreTools:c=true,debug:t=false,additionalTools:n=[]}=r,o=new Map,a={id:`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,documents:new Map,data:new Map};if(c)for(let i of T)o.set(i.name,i),t&&console.log(`[MCP] Registered core tool: ${i.name}`);let d=b.getMcpTools();for(let i of d)o.has(i.name)&&console.warn(`[MCP] Tool '${i.name}' from plugin overrides existing tool`),o.set(i.name,i),t&&console.log(`[MCP] Registered plugin tool: ${i.name}`);for(let i of n)o.set(i.name,i),t&&console.log(`[MCP] Registered additional tool: ${i.name}`);let p=t?(i,f)=>{console.log(`[MCP] ${i}`,f??"");}:()=>{};async function l(i,f){let M=o.get(i);if(!M)throw new Error(`Unknown tool: ${i}`);p(`Calling tool: ${i}`,f);let N={session:a,log:p};try{let g=await M.handler(f,N);return p(`Tool ${i} completed`,g),g}catch(g){throw p(`Tool ${i} failed`,g),g}}function y(){return Array.from(o.values()).map(i=>({name:i.name,description:i.description,inputSchema:z(i.inputSchema),category:i.annotations?.category}))}function L(){return {name:s,version:e,toolCount:o.size}}return {tools:o,session:a,handleToolCall:l,listTools:y,getInfo:L}}async function F(r,s){let{id:e,method:c,params:t}=s;try{switch(c){case "initialize":return {jsonrpc:"2.0",id:e,result:{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:r.getInfo()}};case "tools/list":{let n=r.listTools();return {jsonrpc:"2.0",id:e,result:{tools:n.map(o=>({name:o.name,description:o.description,inputSchema:o.inputSchema}))}}}case "tools/call":{let{name:n,arguments:o}=t,a=await r.handleToolCall(n,o);return {jsonrpc:"2.0",id:e,result:a}}default:return {jsonrpc:"2.0",id:e,error:{code:-32601,message:`Method not found: ${c}`}}}}catch(n){return {jsonrpc:"2.0",id:e,error:{code:-32e3,message:n.message}}}}async function H(r={}){let s=q(r);r.debug&&(console.error(`[MCP] Server started: ${s.getInfo().name} v${s.getInfo().version}`),console.error(`[MCP] Tools registered: ${s.tools.size}`));let c=(await import('readline')).createInterface({input:process.stdin,output:process.stdout,terminal:false}),t="";c.on("line",async n=>{t+=n;try{let o=JSON.parse(t);t="";let a=await F(s,o);process.stdout.write(JSON.stringify(a)+`
16
16
  `);}catch{}}),c.on("close",()=>{r.debug&&console.error("[MCP] Server closed"),process.exit(0);});}function z(r){return typeof r=="object"&&r!==null&&("type"in r||"properties"in r)?r:{type:"object",properties:{}}}export{O as applyStyleTool,R as closeDocumentTool,T as coreMcpTools,q as createMcpServer,j as deleteTextTool,E as formatTextTool,k as getDocumentInfoTool,$ as getDocumentTextTool,F as handleJsonRpcRequest,J as insertTextTool,D as loadDocumentTool,v as replaceTextTool,C as saveDocumentTool,H as startStdioServer};
@@ -1,7 +1,8 @@
1
1
  import { B as BorderSpec, S as ShadingProperties } from './colors-C3vA7HUU.js';
2
- import { d as ParagraphAlignment, L as LineSpacingRule, S as SpacingExplicit, e as TabStop, T as TextFormatting, P as ParagraphFormatting, F as FloatingTableProperties, f as TableLook, a as TableFormatting, c as TableCellFormatting, b as TableRowFormatting } from './formatting-_OXU8gLB.js';
3
- import { N as NumberFormat, S as SectionProperties, R as RevisionInfo, a as ParagraphPropertyChange, b as TablePropertyChange, c as TableCellPropertyChange, d as TableRowPropertyChange } from './content-C8fc_tL6.js';
2
+ import { d as ParagraphAlignment, L as LineSpacingRule, S as SpacingExplicit, e as TabStop, T as TextFormatting, P as ParagraphFormatting, F as FloatingTableProperties, f as TableLook, a as TableFormatting, c as TableCellFormatting, b as TableRowFormatting } from './formatting-JhqWT_XM.js';
3
+ import { N as NumberFormat } from './lists-Bn29SzeS.js';
4
4
  import { WrapType } from './docx/wrapTypes.js';
5
+ import { S as SectionProperties, R as RevisionInfo, a as ParagraphPropertyChange, b as TablePropertyChange, c as TableCellPropertyChange, d as TableRowPropertyChange } from './content-BebvPfXc.js';
5
6
 
6
7
  /**
7
8
  * Paragraph node attributes - maps to ParagraphFormatting
@@ -24,6 +25,18 @@ interface ParagraphAttrs {
24
25
  numId?: number;
25
26
  ilvl?: number;
26
27
  };
28
+ /**
29
+ * The style-sourced numPr value when `numPr` came from the paragraph
30
+ * style rather than direct formatting. While `numPr` still equals this,
31
+ * fromProseDoc omits it from serialized formatting (writing it as direct
32
+ * `<w:numPr>` would flip Word's level-indent precedence on reload). List
33
+ * commands that change `numPr` make the values diverge, which re-enables
34
+ * direct serialization — no explicit clearing needed.
35
+ */
36
+ numPrFromStyle?: {
37
+ numId?: number;
38
+ ilvl?: number;
39
+ };
27
40
  /** List number format (decimal, lowerRoman, upperRoman, etc.) for CSS counter styling */
28
41
  listNumFmt?: NumberFormat;
29
42
  /** Whether this is a bullet list */
@@ -205,6 +218,8 @@ interface TableAttrs {
205
218
  justification?: 'left' | 'center' | 'right';
206
219
  /** Column widths (in twips) from w:tblGrid */
207
220
  columnWidths?: number[];
221
+ /** Table layout (`w:tblLayout` type). `fixed` makes Word honor explicit widths. */
222
+ tableLayout?: 'fixed' | 'autofit' | null;
208
223
  /** Floating table properties (w:tblpPr) */
209
224
  floating?: FloatingTableProperties;
210
225
  /** Default cell margins for the table (w:tblCellMar), in twips */
@@ -1,7 +1,8 @@
1
1
  import { B as BorderSpec, S as ShadingProperties } from './colors-C3vA7HUU.mjs';
2
- import { d as ParagraphAlignment, L as LineSpacingRule, S as SpacingExplicit, e as TabStop, T as TextFormatting, P as ParagraphFormatting, F as FloatingTableProperties, f as TableLook, a as TableFormatting, c as TableCellFormatting, b as TableRowFormatting } from './formatting-BH4hcZiq.mjs';
3
- import { N as NumberFormat, S as SectionProperties, R as RevisionInfo, a as ParagraphPropertyChange, b as TablePropertyChange, c as TableCellPropertyChange, d as TableRowPropertyChange } from './content-3xF4WDE8.mjs';
2
+ import { d as ParagraphAlignment, L as LineSpacingRule, S as SpacingExplicit, e as TabStop, T as TextFormatting, P as ParagraphFormatting, F as FloatingTableProperties, f as TableLook, a as TableFormatting, c as TableCellFormatting, b as TableRowFormatting } from './formatting-DFtuRFQY.mjs';
3
+ import { N as NumberFormat } from './lists-CyGxd5Y2.mjs';
4
4
  import { WrapType } from './docx/wrapTypes.mjs';
5
+ import { S as SectionProperties, R as RevisionInfo, a as ParagraphPropertyChange, b as TablePropertyChange, c as TableCellPropertyChange, d as TableRowPropertyChange } from './content-CbBCrsr0.mjs';
5
6
 
6
7
  /**
7
8
  * Paragraph node attributes - maps to ParagraphFormatting
@@ -24,6 +25,18 @@ interface ParagraphAttrs {
24
25
  numId?: number;
25
26
  ilvl?: number;
26
27
  };
28
+ /**
29
+ * The style-sourced numPr value when `numPr` came from the paragraph
30
+ * style rather than direct formatting. While `numPr` still equals this,
31
+ * fromProseDoc omits it from serialized formatting (writing it as direct
32
+ * `<w:numPr>` would flip Word's level-indent precedence on reload). List
33
+ * commands that change `numPr` make the values diverge, which re-enables
34
+ * direct serialization — no explicit clearing needed.
35
+ */
36
+ numPrFromStyle?: {
37
+ numId?: number;
38
+ ilvl?: number;
39
+ };
27
40
  /** List number format (decimal, lowerRoman, upperRoman, etc.) for CSS counter styling */
28
41
  listNumFmt?: NumberFormat;
29
42
  /** Whether this is a bullet list */
@@ -205,6 +218,8 @@ interface TableAttrs {
205
218
  justification?: 'left' | 'center' | 'right';
206
219
  /** Column widths (in twips) from w:tblGrid */
207
220
  columnWidths?: number[];
221
+ /** Table layout (`w:tblLayout` type). `fixed` makes Word honor explicit widths. */
222
+ tableLayout?: 'fixed' | 'autofit' | null;
208
223
  /** Floating table properties (w:tblpPr) */
209
224
  floating?: FloatingTableProperties;
210
225
  /** Default cell margins for the table (w:tblCellMar), in twips */
@@ -0,0 +1,81 @@
1
+ import { a as NumberingDefinitions, L as ListLevel, A as AbstractNumbering, b as NumberingInstance, c as ListRendering, N as NumberFormat } from './lists-Bn29SzeS.js';
2
+
3
+ /**
4
+ * Numbering/List Parser for DOCX
5
+ *
6
+ * Parses numbering.xml to extract:
7
+ * - Abstract numbering definitions (templates with levels)
8
+ * - Numbering instances (concrete references with optional overrides)
9
+ *
10
+ * OOXML Structure:
11
+ * - w:abstractNum - Template definitions with 9 levels (0-8)
12
+ * - w:num - Instances that reference abstractNum and can override levels
13
+ * - w:lvl - Level definition with start, format, text pattern, etc.
14
+ */
15
+
16
+ /**
17
+ * Map of rId to numbering definitions
18
+ */
19
+ type NumberingMap = {
20
+ definitions: NumberingDefinitions;
21
+ /** Get level info for a numId and ilvl */
22
+ getLevel: (numId: number, ilvl: number) => ListLevel | null;
23
+ /** Get abstract numbering by ID */
24
+ getAbstract: (abstractNumId: number) => AbstractNumbering | null;
25
+ /** Get the numbering instance (numId → abstractNumId + lvlOverrides) */
26
+ getInstance: (numId: number) => NumberingInstance | null;
27
+ /** Check if numId exists */
28
+ hasNumbering: (numId: number) => boolean;
29
+ };
30
+ /**
31
+ * Parse numbering.xml into NumberingDefinitions
32
+ *
33
+ * @param numberingXml - Raw XML string from word/numbering.xml (or null if not present)
34
+ * @returns NumberingMap with definitions and helper functions
35
+ */
36
+ declare function parseNumbering(numberingXml: string | null): NumberingMap;
37
+ declare function getCachedNumberingMap(definitions: NumberingDefinitions): NumberingMap;
38
+ declare function createNumberingMap(definitions: NumberingDefinitions): NumberingMap;
39
+ /**
40
+ * Resolve a paragraph's `numPr` against the numbering definitions into the
41
+ * `ListRendering` the layout pipeline needs (marker template, per-level
42
+ * numFmts, counter key, start override). Returns null when the numPr doesn't
43
+ * name a real level — including `numId === 0`, "no numbering" per ECMA-376.
44
+ *
45
+ * Shared by the parser (document load) and `applyStyle` (style picker), so a
46
+ * style-attached list renders identically in both paths.
47
+ */
48
+ declare function computeListRendering(numPr: {
49
+ numId?: number;
50
+ ilvl?: number;
51
+ }, numbering: NumberingMap): ListRendering | null;
52
+ /**
53
+ * Format a number according to the specified format
54
+ *
55
+ * @param num - The number to format
56
+ * @param format - The number format
57
+ * @returns Formatted string
58
+ */
59
+ declare function formatNumber(num: number, format: NumberFormat): string;
60
+ /**
61
+ * Render list marker text by replacing placeholders with formatted numbers
62
+ *
63
+ * @param lvlText - The level text pattern (e.g., "%1.", "%1.%2")
64
+ * @param counters - Array of counter values for each level (index 0 = level 0, etc.)
65
+ * @param formats - Array of number formats for each level
66
+ * @returns Rendered marker text
67
+ */
68
+ declare function renderListMarker(lvlText: string, counters: number[], formats: NumberFormat[]): string;
69
+ /**
70
+ * Get the bullet character for a bullet list level
71
+ *
72
+ * @param level - The list level definition
73
+ * @returns The bullet character to display
74
+ */
75
+ declare function getBulletCharacter(level: ListLevel): string;
76
+ /**
77
+ * Check if a list level is a bullet (not numbered)
78
+ */
79
+ declare function isBulletLevel(level: ListLevel): boolean;
80
+
81
+ export { type NumberingMap as N, createNumberingMap as a, getCachedNumberingMap as b, computeListRendering as c, formatNumber as f, getBulletCharacter as g, isBulletLevel as i, parseNumbering as p, renderListMarker as r };
@@ -0,0 +1,81 @@
1
+ import { a as NumberingDefinitions, L as ListLevel, A as AbstractNumbering, b as NumberingInstance, c as ListRendering, N as NumberFormat } from './lists-CyGxd5Y2.mjs';
2
+
3
+ /**
4
+ * Numbering/List Parser for DOCX
5
+ *
6
+ * Parses numbering.xml to extract:
7
+ * - Abstract numbering definitions (templates with levels)
8
+ * - Numbering instances (concrete references with optional overrides)
9
+ *
10
+ * OOXML Structure:
11
+ * - w:abstractNum - Template definitions with 9 levels (0-8)
12
+ * - w:num - Instances that reference abstractNum and can override levels
13
+ * - w:lvl - Level definition with start, format, text pattern, etc.
14
+ */
15
+
16
+ /**
17
+ * Map of rId to numbering definitions
18
+ */
19
+ type NumberingMap = {
20
+ definitions: NumberingDefinitions;
21
+ /** Get level info for a numId and ilvl */
22
+ getLevel: (numId: number, ilvl: number) => ListLevel | null;
23
+ /** Get abstract numbering by ID */
24
+ getAbstract: (abstractNumId: number) => AbstractNumbering | null;
25
+ /** Get the numbering instance (numId → abstractNumId + lvlOverrides) */
26
+ getInstance: (numId: number) => NumberingInstance | null;
27
+ /** Check if numId exists */
28
+ hasNumbering: (numId: number) => boolean;
29
+ };
30
+ /**
31
+ * Parse numbering.xml into NumberingDefinitions
32
+ *
33
+ * @param numberingXml - Raw XML string from word/numbering.xml (or null if not present)
34
+ * @returns NumberingMap with definitions and helper functions
35
+ */
36
+ declare function parseNumbering(numberingXml: string | null): NumberingMap;
37
+ declare function getCachedNumberingMap(definitions: NumberingDefinitions): NumberingMap;
38
+ declare function createNumberingMap(definitions: NumberingDefinitions): NumberingMap;
39
+ /**
40
+ * Resolve a paragraph's `numPr` against the numbering definitions into the
41
+ * `ListRendering` the layout pipeline needs (marker template, per-level
42
+ * numFmts, counter key, start override). Returns null when the numPr doesn't
43
+ * name a real level — including `numId === 0`, "no numbering" per ECMA-376.
44
+ *
45
+ * Shared by the parser (document load) and `applyStyle` (style picker), so a
46
+ * style-attached list renders identically in both paths.
47
+ */
48
+ declare function computeListRendering(numPr: {
49
+ numId?: number;
50
+ ilvl?: number;
51
+ }, numbering: NumberingMap): ListRendering | null;
52
+ /**
53
+ * Format a number according to the specified format
54
+ *
55
+ * @param num - The number to format
56
+ * @param format - The number format
57
+ * @returns Formatted string
58
+ */
59
+ declare function formatNumber(num: number, format: NumberFormat): string;
60
+ /**
61
+ * Render list marker text by replacing placeholders with formatted numbers
62
+ *
63
+ * @param lvlText - The level text pattern (e.g., "%1.", "%1.%2")
64
+ * @param counters - Array of counter values for each level (index 0 = level 0, etc.)
65
+ * @param formats - Array of number formats for each level
66
+ * @returns Rendered marker text
67
+ */
68
+ declare function renderListMarker(lvlText: string, counters: number[], formats: NumberFormat[]): string;
69
+ /**
70
+ * Get the bullet character for a bullet list level
71
+ *
72
+ * @param level - The list level definition
73
+ * @returns The bullet character to display
74
+ */
75
+ declare function getBulletCharacter(level: ListLevel): string;
76
+ /**
77
+ * Check if a list level is a bullet (not numbered)
78
+ */
79
+ declare function isBulletLevel(level: ListLevel): boolean;
80
+
81
+ export { type NumberingMap as N, createNumberingMap as a, getCachedNumberingMap as b, computeListRendering as c, formatNumber as f, getBulletCharacter as g, isBulletLevel as i, parseNumbering as p, renderListMarker as r };
@@ -1,18 +1,21 @@
1
1
  import { EditorView } from 'prosemirror-view';
2
2
  import { StyleResolver } from './styles/index.mjs';
3
- import '../formatting-BH4hcZiq.mjs';
3
+ import { N as NumberingMap } from '../numberingParser-nSPZlzKr.mjs';
4
+ import '../formatting-DFtuRFQY.mjs';
4
5
  import '../colors-C3vA7HUU.mjs';
5
- import '../styles-BOJ93SAm.mjs';
6
+ import '../styles-Dqec8Aw6.mjs';
7
+ import '../lists-CyGxd5Y2.mjs';
6
8
 
7
9
  /**
8
- * Agent-facing formatting operations shared by the React and Vue adapters.
10
+ * Agent-facing edit operations shared by the React and Vue adapters.
9
11
  *
10
12
  * `applyFormatting` maps a mark-toggle request (bold/italic/underline/strike/
11
13
  * color/highlight/fontSize/fontFamily) onto a PM transaction over a paragraph
12
14
  * range located by `paraId` (+ optional `search`). `setParagraphStyle` applies
13
- * a named paragraph style to that range.
15
+ * a named paragraph style to that range. `insertBreak` inserts a page or
16
+ * section break after the paragraph located by `paraId`.
14
17
  *
15
- * Both take the `EditorView` as a parameter. `setParagraphStyle` takes the
18
+ * All take the `EditorView` as a parameter. `setParagraphStyle` takes the
16
19
  * style resolver as an injected dependency so each adapter keeps its own
17
20
  * resolver-sourcing strategy (React caches per styles object; Vue rebuilds).
18
21
  *
@@ -62,6 +65,36 @@ declare function setParagraphStyle(view: EditorView, options: {
62
65
  styleId: string;
63
66
  }, deps: {
64
67
  styleResolver: StyleResolver | null;
68
+ numbering?: NumberingMap | null;
65
69
  }): boolean;
70
+ /** Kind of break `insertBreak` can insert after a paragraph. */
71
+ type BreakKind = 'page' | 'sectionNextPage' | 'sectionContinuous';
72
+ interface InsertBreakOptions {
73
+ paraId: string;
74
+ type: BreakKind;
75
+ }
76
+ /**
77
+ * Insert a page or section break after the paragraph identified by `paraId`.
78
+ *
79
+ * This is the agent edit path. It produces the same document shape as the
80
+ * headless `reviewerBridge.insertBreak` (so a given `insert_break` call yields
81
+ * identical output whether the agent drives a live editor or the headless
82
+ * reviewer) — which is intentionally leaner than the interactive Insert > Break
83
+ * menu command:
84
+ *
85
+ * - `page`: insert a single page-break node right after the target paragraph.
86
+ * `fromProseDoc` converts it to a break-run paragraph, matching the headless
87
+ * model. No trailing empty paragraph (the menu command adds one for caret
88
+ * placement; the agent keeps the caret where it was).
89
+ * - `sectionNextPage` / `sectionContinuous`: a section break is the `sectPr`
90
+ * carried by the section's *last* paragraph, so mark the target paragraph
91
+ * directly. No new block — the existing following paragraph starts the new
92
+ * section.
93
+ *
94
+ * The user's selection is preserved (mapped through the edit) rather than
95
+ * following the inserted break. Returns false when the paraId can't be resolved,
96
+ * the target isn't a top-level paragraph, or `type` is unknown.
97
+ */
98
+ declare function insertBreak(view: EditorView, options: InsertBreakOptions): boolean;
66
99
 
67
- export { type ApplyFormattingOptions, applyFormatting, setParagraphStyle };
100
+ export { type ApplyFormattingOptions, type BreakKind, type InsertBreakOptions, applyFormatting, insertBreak, setParagraphStyle };
@@ -1,18 +1,21 @@
1
1
  import { EditorView } from 'prosemirror-view';
2
2
  import { StyleResolver } from './styles/index.js';
3
- import '../formatting-_OXU8gLB.js';
3
+ import { N as NumberingMap } from '../numberingParser-ZSQ3SDCV.js';
4
+ import '../formatting-JhqWT_XM.js';
4
5
  import '../colors-C3vA7HUU.js';
5
- import '../styles-BWqX2AS-.js';
6
+ import '../styles-gEujs7j6.js';
7
+ import '../lists-Bn29SzeS.js';
6
8
 
7
9
  /**
8
- * Agent-facing formatting operations shared by the React and Vue adapters.
10
+ * Agent-facing edit operations shared by the React and Vue adapters.
9
11
  *
10
12
  * `applyFormatting` maps a mark-toggle request (bold/italic/underline/strike/
11
13
  * color/highlight/fontSize/fontFamily) onto a PM transaction over a paragraph
12
14
  * range located by `paraId` (+ optional `search`). `setParagraphStyle` applies
13
- * a named paragraph style to that range.
15
+ * a named paragraph style to that range. `insertBreak` inserts a page or
16
+ * section break after the paragraph located by `paraId`.
14
17
  *
15
- * Both take the `EditorView` as a parameter. `setParagraphStyle` takes the
18
+ * All take the `EditorView` as a parameter. `setParagraphStyle` takes the
16
19
  * style resolver as an injected dependency so each adapter keeps its own
17
20
  * resolver-sourcing strategy (React caches per styles object; Vue rebuilds).
18
21
  *
@@ -62,6 +65,36 @@ declare function setParagraphStyle(view: EditorView, options: {
62
65
  styleId: string;
63
66
  }, deps: {
64
67
  styleResolver: StyleResolver | null;
68
+ numbering?: NumberingMap | null;
65
69
  }): boolean;
70
+ /** Kind of break `insertBreak` can insert after a paragraph. */
71
+ type BreakKind = 'page' | 'sectionNextPage' | 'sectionContinuous';
72
+ interface InsertBreakOptions {
73
+ paraId: string;
74
+ type: BreakKind;
75
+ }
76
+ /**
77
+ * Insert a page or section break after the paragraph identified by `paraId`.
78
+ *
79
+ * This is the agent edit path. It produces the same document shape as the
80
+ * headless `reviewerBridge.insertBreak` (so a given `insert_break` call yields
81
+ * identical output whether the agent drives a live editor or the headless
82
+ * reviewer) — which is intentionally leaner than the interactive Insert > Break
83
+ * menu command:
84
+ *
85
+ * - `page`: insert a single page-break node right after the target paragraph.
86
+ * `fromProseDoc` converts it to a break-run paragraph, matching the headless
87
+ * model. No trailing empty paragraph (the menu command adds one for caret
88
+ * placement; the agent keeps the caret where it was).
89
+ * - `sectionNextPage` / `sectionContinuous`: a section break is the `sectPr`
90
+ * carried by the section's *last* paragraph, so mark the target paragraph
91
+ * directly. No new block — the existing following paragraph starts the new
92
+ * section.
93
+ *
94
+ * The user's selection is preserved (mapped through the edit) rather than
95
+ * following the inserted break. Returns false when the paraId can't be resolved,
96
+ * the target isn't a top-level paragraph, or `type` is unknown.
97
+ */
98
+ declare function insertBreak(view: EditorView, options: InsertBreakOptions): boolean;
66
99
 
67
- export { type ApplyFormattingOptions, applyFormatting, setParagraphStyle };
100
+ export { type ApplyFormattingOptions, type BreakKind, type InsertBreakOptions, applyFormatting, insertBreak, setParagraphStyle };
@@ -1 +1 @@
1
- 'use strict';var chunkNRWQ65NX_js=require('../chunk-NRWQ65NX.js'),chunkQEACB5VG_js=require('../chunk-QEACB5VG.js'),chunkKXVCCT2A_js=require('../chunk-KXVCCT2A.js');require('../chunk-L5NPEM7C.js'),require('../chunk-2WGTGBBS.js'),require('../chunk-BHBOAP6Z.js'),require('../chunk-MZ7LW5CH.js'),require('../chunk-N3Y5BUKV.js'),require('../chunk-WVERBZZU.js'),require('../chunk-6LVPRTB6.js'),require('../chunk-LWH66Q7Q.js'),require('../chunk-TUIEV7Q7.js'),require('../chunk-7HANRHHL.js'),require('../chunk-MJ5FQX7Q.js'),require('../chunk-C2BAPYGJ.js');var chunk4Q2IP5FW_js=require('../chunk-4Q2IP5FW.js');require('../chunk-GSKMHXHG.js'),require('../chunk-DC7S76ZX.js');var prosemirrorState=require('prosemirror-state');function I(i,l){let s=chunkNRWQ65NX_js.a(i.state.doc,l.paraId);if(!s)return false;let o=s.from+1,a=s.to-1;if(l.search){let n=chunkNRWQ65NX_js.d(i.state.doc,s.from,s.to,l.search);if(!n)return false;o=n.from,a=n.to;}if(o>=a)return true;let{schema:t}=i.state,e=l.marks,r=i.state.tr;if(e.bold!==void 0&&t.marks.bold&&(r=e.bold?r.addMark(o,a,t.marks.bold.create()):r.removeMark(o,a,t.marks.bold)),e.italic!==void 0&&t.marks.italic&&(r=e.italic?r.addMark(o,a,t.marks.italic.create()):r.removeMark(o,a,t.marks.italic)),e.underline!==void 0&&t.marks.underline)if(e.underline){let n=typeof e.underline=="object"?e.underline.style:void 0;r=r.addMark(o,a,t.marks.underline.create({style:n??"single"}));}else r=r.removeMark(o,a,t.marks.underline);if(e.strike!==void 0&&t.marks.strike&&(r=e.strike?r.addMark(o,a,t.marks.strike.create()):r.removeMark(o,a,t.marks.strike)),e.color!==void 0&&t.marks.textColor&&(e.color&&(e.color.rgb||e.color.themeColor)?r=r.addMark(o,a,t.marks.textColor.create({rgb:e.color.rgb??null,themeColor:e.color.themeColor??null})):r=r.removeMark(o,a,t.marks.textColor)),e.highlight!==void 0&&t.marks.highlight)if(e.highlight){let n=chunkQEACB5VG_js.b(e.highlight);r=r.addMark(o,a,t.marks.highlight.create({color:n||e.highlight}));}else r=r.removeMark(o,a,t.marks.highlight);return e.fontSize!==void 0&&t.marks.fontSize&&(e.fontSize>0?r=r.addMark(o,a,t.marks.fontSize.create({size:chunk4Q2IP5FW_js.l(e.fontSize)})):r=r.removeMark(o,a,t.marks.fontSize)),e.fontFamily!==void 0&&t.marks.fontFamily&&(e.fontFamily&&(e.fontFamily.ascii||e.fontFamily.hAnsi)?r=r.addMark(o,a,t.marks.fontFamily.create({ascii:e.fontFamily.ascii??null,hAnsi:e.fontFamily.hAnsi??e.fontFamily.ascii??null})):r=r.removeMark(o,a,t.marks.fontFamily)),i.dispatch(r),true}function x(i,l,s){let o=chunkNRWQ65NX_js.a(i.state.doc,l.paraId);if(!o)return false;let{styleResolver:a}=s;if(a&&!a.hasParagraphStyle(l.styleId))return false;let t=i.state.doc.resolve(o.from+1),e=i.state.doc.resolve(o.to-1),r=prosemirrorState.TextSelection.between(t,e),n=i.state.apply(i.state.tr.setSelection(r)),p=a?(()=>{let m=a.resolveParagraphStyle(l.styleId);return chunkKXVCCT2A_js.v(l.styleId,{paragraphFormatting:m.paragraphFormatting,runFormatting:m.runFormatting})})():chunkKXVCCT2A_js.v(l.styleId),c=false;return p(n,m=>{c=true,m.setSelection(i.state.selection.map(m.doc,m.mapping)),i.dispatch(m);}),c}exports.applyFormatting=I;exports.setParagraphStyle=x;
1
+ 'use strict';var chunkNRWQ65NX_js=require('../chunk-NRWQ65NX.js'),chunkQEACB5VG_js=require('../chunk-QEACB5VG.js'),chunk2KUOYHXX_js=require('../chunk-2KUOYHXX.js');require('../chunk-AXVWVIIN.js'),require('../chunk-NTYJIOUE.js'),require('../chunk-Q2VALXEU.js'),require('../chunk-MZ7LW5CH.js'),require('../chunk-N3Y5BUKV.js'),require('../chunk-ILPNMG7Q.js'),require('../chunk-6LVPRTB6.js'),require('../chunk-LWH66Q7Q.js'),require('../chunk-X6AICTHN.js'),require('../chunk-7HANRHHL.js'),require('../chunk-MJ5FQX7Q.js'),require('../chunk-C2BAPYGJ.js');var chunkBJSG6TEG_js=require('../chunk-BJSG6TEG.js');require('../chunk-GSKMHXHG.js'),require('../chunk-H57LNDBH.js'),require('../chunk-3R7QHNI5.js'),require('../chunk-DC7S76ZX.js');var prosemirrorState=require('prosemirror-state');function I(n,i){let s=chunkNRWQ65NX_js.a(n.state.doc,i.paraId);if(!s)return false;let a=s.from+1,o=s.to-1;if(i.search){let l=chunkNRWQ65NX_js.d(n.state.doc,s.from,s.to,i.search);if(!l)return false;a=l.from,o=l.to;}if(a>=o)return true;let{schema:t}=n.state,e=i.marks,r=n.state.tr;if(e.bold!==void 0&&t.marks.bold&&(r=e.bold?r.addMark(a,o,t.marks.bold.create()):r.removeMark(a,o,t.marks.bold)),e.italic!==void 0&&t.marks.italic&&(r=e.italic?r.addMark(a,o,t.marks.italic.create()):r.removeMark(a,o,t.marks.italic)),e.underline!==void 0&&t.marks.underline)if(e.underline){let l=typeof e.underline=="object"?e.underline.style:void 0;r=r.addMark(a,o,t.marks.underline.create({style:l??"single"}));}else r=r.removeMark(a,o,t.marks.underline);if(e.strike!==void 0&&t.marks.strike&&(r=e.strike?r.addMark(a,o,t.marks.strike.create()):r.removeMark(a,o,t.marks.strike)),e.color!==void 0&&t.marks.textColor&&(e.color&&(e.color.rgb||e.color.themeColor)?r=r.addMark(a,o,t.marks.textColor.create({rgb:e.color.rgb??null,themeColor:e.color.themeColor??null})):r=r.removeMark(a,o,t.marks.textColor)),e.highlight!==void 0&&t.marks.highlight)if(e.highlight){let l=chunkQEACB5VG_js.b(e.highlight);r=r.addMark(a,o,t.marks.highlight.create({color:l||e.highlight}));}else r=r.removeMark(a,o,t.marks.highlight);return e.fontSize!==void 0&&t.marks.fontSize&&(e.fontSize>0?r=r.addMark(a,o,t.marks.fontSize.create({size:chunkBJSG6TEG_js.m(e.fontSize)})):r=r.removeMark(a,o,t.marks.fontSize)),e.fontFamily!==void 0&&t.marks.fontFamily&&(e.fontFamily&&(e.fontFamily.ascii||e.fontFamily.hAnsi)?r=r.addMark(a,o,t.marks.fontFamily.create({ascii:e.fontFamily.ascii??null,hAnsi:e.fontFamily.hAnsi??e.fontFamily.ascii??null})):r=r.removeMark(a,o,t.marks.fontFamily)),n.dispatch(r),true}function P(n,i,s){let a=chunkNRWQ65NX_js.a(n.state.doc,i.paraId);if(!a)return false;let{styleResolver:o,numbering:t}=s;if(o&&!o.hasParagraphStyle(i.styleId))return false;let e=n.state.doc.resolve(a.from+1),r=n.state.doc.resolve(a.to-1),l=prosemirrorState.TextSelection.between(e,r),k=n.state.apply(n.state.tr.setSelection(l)),h=o?(()=>{let m=o.resolveParagraphStyle(i.styleId);return chunk2KUOYHXX_js.v(i.styleId,{paragraphFormatting:m.paragraphFormatting,runFormatting:m.runFormatting,numbering:t})})():chunk2KUOYHXX_js.v(i.styleId),c=false;return h(k,m=>{c=true,m.setSelection(n.state.selection.map(m.doc,m.mapping)),n.dispatch(m);}),c}function C(n,i){let s=chunkNRWQ65NX_js.a(n.state.doc,i.paraId);if(!s)return false;let{state:a}=n,o=a.doc.nodeAt(s.from);if(!o||a.doc.resolve(s.from).depth!==0)return false;let t=a.tr;if(i.type==="page"){let e=a.schema.nodes.pageBreak;if(!e)return false;t.insert(s.to,e.create());}else if(i.type==="sectionNextPage"||i.type==="sectionContinuous"){let e=i.type==="sectionNextPage"?"nextPage":"continuous";t.setNodeMarkup(s.from,void 0,{...o.attrs,sectionBreakType:e});}else return false;return t.setSelection(a.selection.map(t.doc,t.mapping)),n.dispatch(t),true}exports.applyFormatting=I;exports.insertBreak=C;exports.setParagraphStyle=P;
@@ -1 +1 @@
1
- import {a,d}from'../chunk-HPJBZL37.mjs';import {b}from'../chunk-XPV6VILW.mjs';import {v}from'../chunk-CHTIWTHQ.mjs';import'../chunk-QAJSNLJR.mjs';import'../chunk-CRMZH7U7.mjs';import'../chunk-MOKKS75W.mjs';import'../chunk-OZMNIX6U.mjs';import'../chunk-AMENZY5F.mjs';import'../chunk-U67MWOPZ.mjs';import'../chunk-BGY3CB37.mjs';import'../chunk-2XP6GLA4.mjs';import'../chunk-ZX26QZJ5.mjs';import'../chunk-MJ6XZFVD.mjs';import'../chunk-67LVRQIR.mjs';import'../chunk-LE67NTCN.mjs';import {l}from'../chunk-VW22RZ6C.mjs';import'../chunk-DI6CRWSW.mjs';import'../chunk-QYUPLKLP.mjs';import {TextSelection}from'prosemirror-state';function I(i,l$1){let s=a(i.state.doc,l$1.paraId);if(!s)return false;let o=s.from+1,a$1=s.to-1;if(l$1.search){let n=d(i.state.doc,s.from,s.to,l$1.search);if(!n)return false;o=n.from,a$1=n.to;}if(o>=a$1)return true;let{schema:t}=i.state,e=l$1.marks,r=i.state.tr;if(e.bold!==void 0&&t.marks.bold&&(r=e.bold?r.addMark(o,a$1,t.marks.bold.create()):r.removeMark(o,a$1,t.marks.bold)),e.italic!==void 0&&t.marks.italic&&(r=e.italic?r.addMark(o,a$1,t.marks.italic.create()):r.removeMark(o,a$1,t.marks.italic)),e.underline!==void 0&&t.marks.underline)if(e.underline){let n=typeof e.underline=="object"?e.underline.style:void 0;r=r.addMark(o,a$1,t.marks.underline.create({style:n??"single"}));}else r=r.removeMark(o,a$1,t.marks.underline);if(e.strike!==void 0&&t.marks.strike&&(r=e.strike?r.addMark(o,a$1,t.marks.strike.create()):r.removeMark(o,a$1,t.marks.strike)),e.color!==void 0&&t.marks.textColor&&(e.color&&(e.color.rgb||e.color.themeColor)?r=r.addMark(o,a$1,t.marks.textColor.create({rgb:e.color.rgb??null,themeColor:e.color.themeColor??null})):r=r.removeMark(o,a$1,t.marks.textColor)),e.highlight!==void 0&&t.marks.highlight)if(e.highlight){let n=b(e.highlight);r=r.addMark(o,a$1,t.marks.highlight.create({color:n||e.highlight}));}else r=r.removeMark(o,a$1,t.marks.highlight);return e.fontSize!==void 0&&t.marks.fontSize&&(e.fontSize>0?r=r.addMark(o,a$1,t.marks.fontSize.create({size:l(e.fontSize)})):r=r.removeMark(o,a$1,t.marks.fontSize)),e.fontFamily!==void 0&&t.marks.fontFamily&&(e.fontFamily&&(e.fontFamily.ascii||e.fontFamily.hAnsi)?r=r.addMark(o,a$1,t.marks.fontFamily.create({ascii:e.fontFamily.ascii??null,hAnsi:e.fontFamily.hAnsi??e.fontFamily.ascii??null})):r=r.removeMark(o,a$1,t.marks.fontFamily)),i.dispatch(r),true}function x(i,l,s){let o=a(i.state.doc,l.paraId);if(!o)return false;let{styleResolver:a$1}=s;if(a$1&&!a$1.hasParagraphStyle(l.styleId))return false;let t=i.state.doc.resolve(o.from+1),e=i.state.doc.resolve(o.to-1),r=TextSelection.between(t,e),n=i.state.apply(i.state.tr.setSelection(r)),p=a$1?(()=>{let m=a$1.resolveParagraphStyle(l.styleId);return v(l.styleId,{paragraphFormatting:m.paragraphFormatting,runFormatting:m.runFormatting})})():v(l.styleId),c=false;return p(n,m=>{c=true,m.setSelection(i.state.selection.map(m.doc,m.mapping)),i.dispatch(m);}),c}export{I as applyFormatting,x as setParagraphStyle};
1
+ import {a,d}from'../chunk-HPJBZL37.mjs';import {b}from'../chunk-XPV6VILW.mjs';import {v}from'../chunk-YMXWLXVF.mjs';import'../chunk-NO6PIL32.mjs';import'../chunk-M65C4SQJ.mjs';import'../chunk-PJEB3ZWG.mjs';import'../chunk-OZMNIX6U.mjs';import'../chunk-AMENZY5F.mjs';import'../chunk-HEJJXAXN.mjs';import'../chunk-BGY3CB37.mjs';import'../chunk-2XP6GLA4.mjs';import'../chunk-NTBZRITU.mjs';import'../chunk-MJ6XZFVD.mjs';import'../chunk-67LVRQIR.mjs';import'../chunk-LE67NTCN.mjs';import {m}from'../chunk-KNY7SXPJ.mjs';import'../chunk-DI6CRWSW.mjs';import'../chunk-VJFIAFZ5.mjs';import'../chunk-3ANZ3252.mjs';import'../chunk-QYUPLKLP.mjs';import {TextSelection}from'prosemirror-state';function I(n,i){let s=a(n.state.doc,i.paraId);if(!s)return false;let a$1=s.from+1,o=s.to-1;if(i.search){let l=d(n.state.doc,s.from,s.to,i.search);if(!l)return false;a$1=l.from,o=l.to;}if(a$1>=o)return true;let{schema:t}=n.state,e=i.marks,r=n.state.tr;if(e.bold!==void 0&&t.marks.bold&&(r=e.bold?r.addMark(a$1,o,t.marks.bold.create()):r.removeMark(a$1,o,t.marks.bold)),e.italic!==void 0&&t.marks.italic&&(r=e.italic?r.addMark(a$1,o,t.marks.italic.create()):r.removeMark(a$1,o,t.marks.italic)),e.underline!==void 0&&t.marks.underline)if(e.underline){let l=typeof e.underline=="object"?e.underline.style:void 0;r=r.addMark(a$1,o,t.marks.underline.create({style:l??"single"}));}else r=r.removeMark(a$1,o,t.marks.underline);if(e.strike!==void 0&&t.marks.strike&&(r=e.strike?r.addMark(a$1,o,t.marks.strike.create()):r.removeMark(a$1,o,t.marks.strike)),e.color!==void 0&&t.marks.textColor&&(e.color&&(e.color.rgb||e.color.themeColor)?r=r.addMark(a$1,o,t.marks.textColor.create({rgb:e.color.rgb??null,themeColor:e.color.themeColor??null})):r=r.removeMark(a$1,o,t.marks.textColor)),e.highlight!==void 0&&t.marks.highlight)if(e.highlight){let l=b(e.highlight);r=r.addMark(a$1,o,t.marks.highlight.create({color:l||e.highlight}));}else r=r.removeMark(a$1,o,t.marks.highlight);return e.fontSize!==void 0&&t.marks.fontSize&&(e.fontSize>0?r=r.addMark(a$1,o,t.marks.fontSize.create({size:m(e.fontSize)})):r=r.removeMark(a$1,o,t.marks.fontSize)),e.fontFamily!==void 0&&t.marks.fontFamily&&(e.fontFamily&&(e.fontFamily.ascii||e.fontFamily.hAnsi)?r=r.addMark(a$1,o,t.marks.fontFamily.create({ascii:e.fontFamily.ascii??null,hAnsi:e.fontFamily.hAnsi??e.fontFamily.ascii??null})):r=r.removeMark(a$1,o,t.marks.fontFamily)),n.dispatch(r),true}function P(n,i,s){let a$1=a(n.state.doc,i.paraId);if(!a$1)return false;let{styleResolver:o,numbering:t}=s;if(o&&!o.hasParagraphStyle(i.styleId))return false;let e=n.state.doc.resolve(a$1.from+1),r=n.state.doc.resolve(a$1.to-1),l=TextSelection.between(e,r),k=n.state.apply(n.state.tr.setSelection(l)),h=o?(()=>{let m=o.resolveParagraphStyle(i.styleId);return v(i.styleId,{paragraphFormatting:m.paragraphFormatting,runFormatting:m.runFormatting,numbering:t})})():v(i.styleId),c=false;return h(k,m=>{c=true,m.setSelection(n.state.selection.map(m.doc,m.mapping)),n.dispatch(m);}),c}function C(n,i){let s=a(n.state.doc,i.paraId);if(!s)return false;let{state:a$1}=n,o=a$1.doc.nodeAt(s.from);if(!o||a$1.doc.resolve(s.from).depth!==0)return false;let t=a$1.tr;if(i.type==="page"){let e=a$1.schema.nodes.pageBreak;if(!e)return false;t.insert(s.to,e.create());}else if(i.type==="sectionNextPage"||i.type==="sectionContinuous"){let e=i.type==="sectionNextPage"?"nextPage":"continuous";t.setNodeMarkup(s.from,void 0,{...o.attrs,sectionBreakType:e});}else return false;return t.setSelection(a$1.selection.map(t.doc,t.mapping)),n.dispatch(t),true}export{I as applyFormatting,C as insertBreak,P as setParagraphStyle};