kordoc 4.24.48 → 4.24.49

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 (208) hide show
  1. package/README.md +3 -3
  2. package/dist/{-3EMVBTE7.js → -22V6D2US.js} +42 -42
  3. package/dist/{chunk-TOOOWCKQ.cjs → chunk-2UWWWM4Q.cjs} +98 -98
  4. package/dist/{chunk-TOOOWCKQ.cjs.map → chunk-2UWWWM4Q.cjs.map} +1 -1
  5. package/dist/{chunk-MHAPDR6T.cjs → chunk-367WLMPO.cjs} +59 -67
  6. package/dist/chunk-367WLMPO.cjs.map +1 -0
  7. package/dist/{chunk-WVUR3HYW.js → chunk-4HJKBRZJ.js} +129 -40
  8. package/dist/chunk-4HJKBRZJ.js.map +1 -0
  9. package/dist/{chunk-7F5SKDUG.js → chunk-4MWUBTAE.js} +2 -2
  10. package/dist/{chunk-4N2ESXR2.js → chunk-67GSFYG7.js} +2 -2
  11. package/dist/{chunk-WICMTKWR.js → chunk-6BFWLS7E.js} +3 -3
  12. package/dist/{chunk-LBH4KAQM.cjs → chunk-6NZ32OTX.cjs} +8 -3
  13. package/dist/chunk-6NZ32OTX.cjs.map +1 -0
  14. package/dist/{chunk-JC2TMUU5.js → chunk-7KKL3PRK.js} +5 -13
  15. package/dist/chunk-7KKL3PRK.js.map +1 -0
  16. package/dist/{chunk-7EL6BCO5.js → chunk-AUAJVQQK.js} +2 -2
  17. package/dist/{chunk-QJBVP2BS.js → chunk-AXW2FMVR.js} +2 -2
  18. package/dist/{chunk-SUOJQHIN.js → chunk-CCQMSIZQ.js} +19 -19
  19. package/dist/{chunk-OUUI7I5V.js → chunk-DA5AXURC.js} +52 -4
  20. package/dist/chunk-DA5AXURC.js.map +1 -0
  21. package/dist/{chunk-3UY7ARXP.js → chunk-DAAJO62F.js} +2 -2
  22. package/dist/{chunk-QM65ELZE.js → chunk-EUJX7HTR.js} +32 -10
  23. package/dist/chunk-EUJX7HTR.js.map +1 -0
  24. package/dist/{chunk-E47LO7XG.js → chunk-EYSXMDA7.js} +17 -17
  25. package/dist/{chunk-TQ4QOCKT.js → chunk-FU6ZDWCI.js} +7 -2
  26. package/dist/chunk-FU6ZDWCI.js.map +1 -0
  27. package/dist/{chunk-MHLTZ3VI.js → chunk-HETGOJ6V.js} +2 -2
  28. package/dist/{chunk-OQPIN2OY.js → chunk-HW7WVYBF.js} +2 -2
  29. package/dist/{chunk-LHZL52HO.cjs → chunk-IRAZCKQ6.cjs} +3 -3
  30. package/dist/{chunk-LHZL52HO.cjs.map → chunk-IRAZCKQ6.cjs.map} +1 -1
  31. package/dist/{chunk-AC7FZDVP.js → chunk-KB4ORA7M.js} +2 -2
  32. package/dist/{chunk-SHYNOLL6.js → chunk-KXHUHGMC.js} +2 -2
  33. package/dist/{chunk-WO6PZMMB.js → chunk-L3JP55ZY.js} +2 -2
  34. package/dist/{chunk-OBNOOHAW.js → chunk-LCRSRVFJ.js} +2 -2
  35. package/dist/{chunk-OBNOOHAW.js.map → chunk-LCRSRVFJ.js.map} +1 -1
  36. package/dist/{chunk-OO4DHHTG.js → chunk-LFFARZYZ.js} +2 -2
  37. package/dist/{chunk-OO4DHHTG.js.map → chunk-LFFARZYZ.js.map} +1 -1
  38. package/dist/{chunk-NLPIXQOV.js → chunk-LOSCIAHY.js} +2 -2
  39. package/dist/{chunk-HW3DZ7TY.js → chunk-M5RQ2PNP.js} +6 -14
  40. package/dist/chunk-M5RQ2PNP.js.map +1 -0
  41. package/dist/{chunk-GFWCBYAI.js → chunk-MIJTZKWF.js} +2 -2
  42. package/dist/{chunk-PHU4VSNF.js → chunk-MLBX6KQM.js} +37 -3
  43. package/dist/chunk-MLBX6KQM.js.map +1 -0
  44. package/dist/{chunk-D4TKVZKB.js → chunk-OAETOHH3.js} +3 -3
  45. package/dist/{chunk-SI3GXM7Z.js → chunk-PMGJQWSW.js} +2 -2
  46. package/dist/{chunk-QOBWIFJA.cjs → chunk-PVV6OY4M.cjs} +135 -87
  47. package/dist/{chunk-QOBWIFJA.cjs.map → chunk-PVV6OY4M.cjs.map} +1 -1
  48. package/dist/{chunk-VXHZPUMS.cjs → chunk-PW7MQZI4.cjs} +2 -2
  49. package/dist/{chunk-VXHZPUMS.cjs.map → chunk-PW7MQZI4.cjs.map} +1 -1
  50. package/dist/{chunk-MYIRYP6D.js → chunk-Q7FDPJUS.js} +10 -10
  51. package/dist/{chunk-N6B5BINC.js → chunk-R2RLNUNK.js} +6 -6
  52. package/dist/{chunk-FQMPHPHE.js → chunk-RQLEGKEV.js} +2 -2
  53. package/dist/{chunk-KTGOULMH.js → chunk-S54DZB2Z.js} +51 -3
  54. package/dist/chunk-S54DZB2Z.js.map +1 -0
  55. package/dist/{chunk-D7SOY3VR.js → chunk-TAHS42ED.js} +33 -11
  56. package/dist/chunk-TAHS42ED.js.map +1 -0
  57. package/dist/{chunk-YFTD6WOP.cjs → chunk-TQOAPKLU.cjs} +6 -6
  58. package/dist/{chunk-YFTD6WOP.cjs.map → chunk-TQOAPKLU.cjs.map} +1 -1
  59. package/dist/{chunk-A6EOKPKG.cjs → chunk-UBY2PLKR.cjs} +54 -32
  60. package/dist/chunk-UBY2PLKR.cjs.map +1 -0
  61. package/dist/{chunk-UN2F6EKQ.js → chunk-UJELMNOU.js} +7 -2
  62. package/dist/chunk-UJELMNOU.js.map +1 -0
  63. package/dist/{chunk-REERG473.js → chunk-UU54HN5I.js} +6 -6
  64. package/dist/{chunk-E5RJLP2S.js → chunk-VMOUAWGD.js} +7 -7
  65. package/dist/{chunk-6YUMHSBG.js → chunk-WLFZOBZR.js} +3 -3
  66. package/dist/{chunk-SJXTCW7I.cjs → chunk-Y4MFHEK4.cjs} +40 -6
  67. package/dist/chunk-Y4MFHEK4.cjs.map +1 -0
  68. package/dist/{chunk-UJ3TZF4Y.js → chunk-Y6QW3FJQ.js} +2 -2
  69. package/dist/{chunk-GOYAJVR6.js → chunk-ZF24SO45.js} +37 -3
  70. package/dist/chunk-ZF24SO45.js.map +1 -0
  71. package/dist/chunks-Q7242OJE.js +11 -0
  72. package/dist/cli.js +73 -53
  73. package/dist/cli.js.map +1 -1
  74. package/dist/{formula-DUHNPES2.js → formula-BYEDWWZU.js} +4 -4
  75. package/dist/{formula-XNCKOV6K.js → formula-FQLMMBDP.js} +3 -3
  76. package/dist/{formula-7RJOEJHX.cjs → formula-QJEOIVKR.cjs} +9 -9
  77. package/dist/{formula-7RJOEJHX.cjs.map → formula-QJEOIVKR.cjs.map} +1 -1
  78. package/dist/generator-FTM6GOGB.cjs +11 -0
  79. package/dist/{generator-XXVCF6TG.cjs.map → generator-FTM6GOGB.cjs.map} +1 -1
  80. package/dist/generator-Q3L7RNUY.js +17 -0
  81. package/dist/generator-SU73HZHR.js +10 -0
  82. package/dist/{image-ocr-PYOXD5K4.js → image-ocr-7Y3FCGRR.js} +12 -10
  83. package/dist/image-ocr-7Y3FCGRR.js.map +1 -0
  84. package/dist/{image-ocr-NFCTNIL5.js → image-ocr-VIGZE4YL.js} +9 -7
  85. package/dist/image-ocr-VIGZE4YL.js.map +1 -0
  86. package/dist/{image-ocr-ZLAPJMES.cjs → image-ocr-WRILL3WO.cjs} +29 -27
  87. package/dist/image-ocr-WRILL3WO.cjs.map +1 -0
  88. package/dist/index.cjs +1250 -1161
  89. package/dist/index.cjs.map +1 -1
  90. package/dist/index.d.cts +13 -5
  91. package/dist/index.d.ts +13 -5
  92. package/dist/index.js +207 -118
  93. package/dist/index.js.map +1 -1
  94. package/dist/mcp.js +42 -43
  95. package/dist/mcp.js.map +1 -1
  96. package/dist/memo-T5ZQEXEA.js +17 -0
  97. package/dist/{model-bundle-TIHWFIN5.js → model-bundle-UJRQPYUU.js} +5 -5
  98. package/dist/{models-YBHBEM6J.js → models-64YLAWTI.js} +5 -5
  99. package/dist/{parse-worker-v2-Q7ST3SDO.js → parse-worker-v2-QWQZKFQO.js} +25 -24
  100. package/dist/parse-worker-v2-QWQZKFQO.js.map +1 -0
  101. package/dist/{parser-7JSQYNLS.js → parser-JPWANPLM.js} +77 -32
  102. package/dist/parser-JPWANPLM.js.map +1 -0
  103. package/dist/{parser-A76QS3VJ.cjs → parser-RB6CBNAM.cjs} +259 -214
  104. package/dist/parser-RB6CBNAM.cjs.map +1 -0
  105. package/dist/{parser-V25GYLBJ.js → parser-XFU3VRWM.js} +80 -35
  106. package/dist/parser-XFU3VRWM.js.map +1 -0
  107. package/dist/pdf-ocr-NOJHEH4M.cjs +42 -0
  108. package/dist/{pdf-ocr-5YCDSSLG.cjs.map → pdf-ocr-NOJHEH4M.cjs.map} +1 -1
  109. package/dist/{pdf-ocr-IJXT6ZJR.js → pdf-ocr-XTZZEYKJ.js} +6 -6
  110. package/dist/{pdf-ocr-GEAW23FB.js → pdf-ocr-ZV3KYIIE.js} +9 -9
  111. package/dist/{profile-io-Y7SMMS2R.js → profile-io-FAJORRD2.js} +3 -3
  112. package/dist/{rasterize-MLEHT6PU.js → rasterize-4ZJUA2DZ.js} +3 -3
  113. package/dist/{redact-doc-GPO2UTTJ.js → redact-doc-JPNROEH6.js} +30 -30
  114. package/dist/{render-TNWY53S4.js → render-D4WBOBKI.js} +13 -13
  115. package/dist/{rewrite-fallback-AHGTN757.js → rewrite-fallback-OF3QI6CX.js} +14 -14
  116. package/dist/seal-DQWEHIAM.js +16 -0
  117. package/dist/{setup-TJ57DQ6I.js → setup-YC25YCQB.js} +3 -3
  118. package/dist/to-hwpx-D7OMPDUQ.js +21 -0
  119. package/dist/to-hwpx-LUA6F5RR.cjs +16 -0
  120. package/dist/{to-hwpx-XLQUY2L2.cjs.map → to-hwpx-LUA6F5RR.cjs.map} +1 -1
  121. package/dist/{to-hwpx-DLVARUND.js → to-hwpx-ZWN64NCQ.js} +5 -5
  122. package/dist/visual-SW7NPY6K.js +37 -0
  123. package/dist/{watch-6CHDQ355.js → watch-ZU576VSR.js} +24 -24
  124. package/package.json +1 -1
  125. package/dist/chunk-A6EOKPKG.cjs.map +0 -1
  126. package/dist/chunk-D7SOY3VR.js.map +0 -1
  127. package/dist/chunk-GOYAJVR6.js.map +0 -1
  128. package/dist/chunk-HW3DZ7TY.js.map +0 -1
  129. package/dist/chunk-JC2TMUU5.js.map +0 -1
  130. package/dist/chunk-KTGOULMH.js.map +0 -1
  131. package/dist/chunk-LBH4KAQM.cjs.map +0 -1
  132. package/dist/chunk-MHAPDR6T.cjs.map +0 -1
  133. package/dist/chunk-OUUI7I5V.js.map +0 -1
  134. package/dist/chunk-PHU4VSNF.js.map +0 -1
  135. package/dist/chunk-QM65ELZE.js.map +0 -1
  136. package/dist/chunk-SJXTCW7I.cjs.map +0 -1
  137. package/dist/chunk-TQ4QOCKT.js.map +0 -1
  138. package/dist/chunk-UN2F6EKQ.js.map +0 -1
  139. package/dist/chunk-WVUR3HYW.js.map +0 -1
  140. package/dist/chunks-QTVEFJOS.js +0 -11
  141. package/dist/generator-6BFIABTF.js +0 -10
  142. package/dist/generator-XJLIBYDJ.js +0 -17
  143. package/dist/generator-XXVCF6TG.cjs +0 -11
  144. package/dist/hancom-7F53R77A.cjs +0 -85
  145. package/dist/hancom-7F53R77A.cjs.map +0 -1
  146. package/dist/hancom-D4E3WBPI.js +0 -84
  147. package/dist/hancom-D4E3WBPI.js.map +0 -1
  148. package/dist/hancom-IPF6HM5F.js +0 -85
  149. package/dist/hancom-IPF6HM5F.js.map +0 -1
  150. package/dist/image-ocr-NFCTNIL5.js.map +0 -1
  151. package/dist/image-ocr-PYOXD5K4.js.map +0 -1
  152. package/dist/image-ocr-ZLAPJMES.cjs.map +0 -1
  153. package/dist/memo-CNW6ZJFE.js +0 -17
  154. package/dist/parse-worker-v2-Q7ST3SDO.js.map +0 -1
  155. package/dist/parser-7JSQYNLS.js.map +0 -1
  156. package/dist/parser-A76QS3VJ.cjs.map +0 -1
  157. package/dist/parser-V25GYLBJ.js.map +0 -1
  158. package/dist/pdf-ocr-5YCDSSLG.cjs +0 -42
  159. package/dist/seal-7HBR3HBQ.js +0 -16
  160. package/dist/to-hwpx-6JF6Q2TZ.js +0 -21
  161. package/dist/to-hwpx-XLQUY2L2.cjs +0 -16
  162. package/dist/visual-VBDQUUKP.js +0 -37
  163. /package/dist/{-3EMVBTE7.js.map → -22V6D2US.js.map} +0 -0
  164. /package/dist/{chunk-7F5SKDUG.js.map → chunk-4MWUBTAE.js.map} +0 -0
  165. /package/dist/{chunk-4N2ESXR2.js.map → chunk-67GSFYG7.js.map} +0 -0
  166. /package/dist/{chunk-WICMTKWR.js.map → chunk-6BFWLS7E.js.map} +0 -0
  167. /package/dist/{chunk-7EL6BCO5.js.map → chunk-AUAJVQQK.js.map} +0 -0
  168. /package/dist/{chunk-QJBVP2BS.js.map → chunk-AXW2FMVR.js.map} +0 -0
  169. /package/dist/{chunk-SUOJQHIN.js.map → chunk-CCQMSIZQ.js.map} +0 -0
  170. /package/dist/{chunk-3UY7ARXP.js.map → chunk-DAAJO62F.js.map} +0 -0
  171. /package/dist/{chunk-E47LO7XG.js.map → chunk-EYSXMDA7.js.map} +0 -0
  172. /package/dist/{chunk-MHLTZ3VI.js.map → chunk-HETGOJ6V.js.map} +0 -0
  173. /package/dist/{chunk-OQPIN2OY.js.map → chunk-HW7WVYBF.js.map} +0 -0
  174. /package/dist/{chunk-AC7FZDVP.js.map → chunk-KB4ORA7M.js.map} +0 -0
  175. /package/dist/{chunk-SHYNOLL6.js.map → chunk-KXHUHGMC.js.map} +0 -0
  176. /package/dist/{chunk-WO6PZMMB.js.map → chunk-L3JP55ZY.js.map} +0 -0
  177. /package/dist/{chunk-NLPIXQOV.js.map → chunk-LOSCIAHY.js.map} +0 -0
  178. /package/dist/{chunk-GFWCBYAI.js.map → chunk-MIJTZKWF.js.map} +0 -0
  179. /package/dist/{chunk-D4TKVZKB.js.map → chunk-OAETOHH3.js.map} +0 -0
  180. /package/dist/{chunk-SI3GXM7Z.js.map → chunk-PMGJQWSW.js.map} +0 -0
  181. /package/dist/{chunk-MYIRYP6D.js.map → chunk-Q7FDPJUS.js.map} +0 -0
  182. /package/dist/{chunk-N6B5BINC.js.map → chunk-R2RLNUNK.js.map} +0 -0
  183. /package/dist/{chunk-FQMPHPHE.js.map → chunk-RQLEGKEV.js.map} +0 -0
  184. /package/dist/{chunk-REERG473.js.map → chunk-UU54HN5I.js.map} +0 -0
  185. /package/dist/{chunk-E5RJLP2S.js.map → chunk-VMOUAWGD.js.map} +0 -0
  186. /package/dist/{chunk-6YUMHSBG.js.map → chunk-WLFZOBZR.js.map} +0 -0
  187. /package/dist/{chunk-UJ3TZF4Y.js.map → chunk-Y6QW3FJQ.js.map} +0 -0
  188. /package/dist/{chunks-QTVEFJOS.js.map → chunks-Q7242OJE.js.map} +0 -0
  189. /package/dist/{formula-DUHNPES2.js.map → formula-BYEDWWZU.js.map} +0 -0
  190. /package/dist/{formula-XNCKOV6K.js.map → formula-FQLMMBDP.js.map} +0 -0
  191. /package/dist/{generator-6BFIABTF.js.map → generator-Q3L7RNUY.js.map} +0 -0
  192. /package/dist/{generator-XJLIBYDJ.js.map → generator-SU73HZHR.js.map} +0 -0
  193. /package/dist/{memo-CNW6ZJFE.js.map → memo-T5ZQEXEA.js.map} +0 -0
  194. /package/dist/{model-bundle-TIHWFIN5.js.map → model-bundle-UJRQPYUU.js.map} +0 -0
  195. /package/dist/{models-YBHBEM6J.js.map → models-64YLAWTI.js.map} +0 -0
  196. /package/dist/{pdf-ocr-GEAW23FB.js.map → pdf-ocr-XTZZEYKJ.js.map} +0 -0
  197. /package/dist/{pdf-ocr-IJXT6ZJR.js.map → pdf-ocr-ZV3KYIIE.js.map} +0 -0
  198. /package/dist/{profile-io-Y7SMMS2R.js.map → profile-io-FAJORRD2.js.map} +0 -0
  199. /package/dist/{rasterize-MLEHT6PU.js.map → rasterize-4ZJUA2DZ.js.map} +0 -0
  200. /package/dist/{redact-doc-GPO2UTTJ.js.map → redact-doc-JPNROEH6.js.map} +0 -0
  201. /package/dist/{render-TNWY53S4.js.map → render-D4WBOBKI.js.map} +0 -0
  202. /package/dist/{rewrite-fallback-AHGTN757.js.map → rewrite-fallback-OF3QI6CX.js.map} +0 -0
  203. /package/dist/{seal-7HBR3HBQ.js.map → seal-DQWEHIAM.js.map} +0 -0
  204. /package/dist/{setup-TJ57DQ6I.js.map → setup-YC25YCQB.js.map} +0 -0
  205. /package/dist/{to-hwpx-6JF6Q2TZ.js.map → to-hwpx-D7OMPDUQ.js.map} +0 -0
  206. /package/dist/{to-hwpx-DLVARUND.js.map → to-hwpx-ZWN64NCQ.js.map} +0 -0
  207. /package/dist/{visual-VBDQUUKP.js.map → visual-SW7NPY6K.js.map} +0 -0
  208. /package/dist/{watch-6CHDQ355.js.map → watch-ZU576VSR.js.map} +0 -0
package/dist/index.d.cts CHANGED
@@ -323,6 +323,17 @@ interface ParseOptions {
323
323
  /** 그림 속 QR 코드를 읽어 그림 블록 `qr` 과 Markdown 그림 자리 다음 줄에 값을 낸다 (#187). 기본 false — 끄면 출력 불변.
324
324
  * 모든 형식의 그림(HWP·HWPX·HWP3·DOCX·PPTX·PDF), `images: false` 여도 읽는다. optional dependency `zxing-wasm` 이 필요하다 */
325
325
  qrCodes?: boolean;
326
+ /**
327
+ * 그림 형식 (#188). 기본(지정 안 함)은 지금처럼 PDF 그림은 PNG, 다른 형식은 문서에 든 원본 그림 그대로다.
328
+ * 지정하면 모든 그림이 그 형식이다 — 파일명(`image_NNN.png`·`.webp`)·MIME·바이트가 같은 형식이고, 형식은 확장자가 아니라 바이트로 판정한다.
329
+ * - `"png"`: PNG. 이미 PNG 인 그림은 바이트 그대로, BMP 는 kordoc 디코더, 그 밖(JPEG·GIF·TIFF·WebP·SVG)은 sharp.
330
+ * - `"webp"`: 무손실 WebP(`exact`). PDF 그림 200개 실측 25.5 → 14.8MB(58%), 인코딩 CPU 3.25 → 8.6초(4개 스레드로 경과 시간 2.58 → 2.1초).
331
+ * 보이는 그림을 맞춘다: EXIF 회전 적용, ICC 프로필·CMYK 는 sRGB, 움직이는 GIF 는 첫 장, SVG 는 그린 그림.
332
+ * 바꿀 수 없는 그림(WMF·EMF, 못 읽는 BMP 변형·손상, WebP 한도 16,383px 초과)은 원본 형식(PDF 는 PNG)으로 내고 경고(`SKIPPED_IMAGE`)한다.
333
+ * HWP·HWPX·DOCX 2,782개(그림 6,412개) 실측: png 6,109개 바꿈·4,099 → 775MB, webp 5,680개 바꿈·4,099 → 504MB.
334
+ * optional dependency `sharp` 가 필요하다(없으면 `"png"` 는 BMP·PNG 만 맞추고 경고). `images: false` 면 인코딩하지 않는다
335
+ */
336
+ imageFormat?: "png" | "webp";
326
337
  /**
327
338
  * PDF 표 감지 활성화 (기본 true). false 면 선 기반 그리드·클러스터 표 감지를 모두 끄고
328
339
  * 자연 읽기순 텍스트만 뽑는다 (#64).
@@ -1675,17 +1686,14 @@ declare function markdownToHwpx(markdown: string, options?: MarkdownToHwpxOption
1675
1686
  interface HwpToHwpxOptions {
1676
1687
  /** 암호 문서의 열기 암호 */
1677
1688
  password?: string;
1678
- /** 변환 엔진 (convertToHwpx 만 본다). "kordoc"(기본): 자체 변환 — 어디서나. "hancom": 한/글 자체 저장(Windows + 한/글, 팝업 없이) —
1679
- * HWP 3.x·HWPML 도 서식 그대로. "auto": 한/글이 있으면 hancom, 없으면 kordoc */
1680
- engine?: "kordoc" | "hancom" | "auto";
1681
1689
  }
1682
1690
  declare function hwpToHwpx(input: Uint8Array | ArrayBuffer, options?: HwpToHwpxOptions): Promise<Uint8Array>;
1683
1691
  interface ConvertToHwpxResult {
1684
1692
  data: Uint8Array;
1685
1693
  /** preserve: 서식 그대로(HWP 5.x), content: 글·표만 옮겨 kordoc 기본 서식으로(HWP 3.x 등) */
1686
1694
  mode: "preserve" | "content";
1687
- /** 실제로 쓴 엔진 */
1688
- engine: "kordoc" | "hancom";
1695
+ /** 변환 엔진 — 늘 자체 변환 */
1696
+ engine: "kordoc";
1689
1697
  warnings: string[];
1690
1698
  }
1691
1699
  /**
package/dist/index.d.ts CHANGED
@@ -323,6 +323,17 @@ interface ParseOptions {
323
323
  /** 그림 속 QR 코드를 읽어 그림 블록 `qr` 과 Markdown 그림 자리 다음 줄에 값을 낸다 (#187). 기본 false — 끄면 출력 불변.
324
324
  * 모든 형식의 그림(HWP·HWPX·HWP3·DOCX·PPTX·PDF), `images: false` 여도 읽는다. optional dependency `zxing-wasm` 이 필요하다 */
325
325
  qrCodes?: boolean;
326
+ /**
327
+ * 그림 형식 (#188). 기본(지정 안 함)은 지금처럼 PDF 그림은 PNG, 다른 형식은 문서에 든 원본 그림 그대로다.
328
+ * 지정하면 모든 그림이 그 형식이다 — 파일명(`image_NNN.png`·`.webp`)·MIME·바이트가 같은 형식이고, 형식은 확장자가 아니라 바이트로 판정한다.
329
+ * - `"png"`: PNG. 이미 PNG 인 그림은 바이트 그대로, BMP 는 kordoc 디코더, 그 밖(JPEG·GIF·TIFF·WebP·SVG)은 sharp.
330
+ * - `"webp"`: 무손실 WebP(`exact`). PDF 그림 200개 실측 25.5 → 14.8MB(58%), 인코딩 CPU 3.25 → 8.6초(4개 스레드로 경과 시간 2.58 → 2.1초).
331
+ * 보이는 그림을 맞춘다: EXIF 회전 적용, ICC 프로필·CMYK 는 sRGB, 움직이는 GIF 는 첫 장, SVG 는 그린 그림.
332
+ * 바꿀 수 없는 그림(WMF·EMF, 못 읽는 BMP 변형·손상, WebP 한도 16,383px 초과)은 원본 형식(PDF 는 PNG)으로 내고 경고(`SKIPPED_IMAGE`)한다.
333
+ * HWP·HWPX·DOCX 2,782개(그림 6,412개) 실측: png 6,109개 바꿈·4,099 → 775MB, webp 5,680개 바꿈·4,099 → 504MB.
334
+ * optional dependency `sharp` 가 필요하다(없으면 `"png"` 는 BMP·PNG 만 맞추고 경고). `images: false` 면 인코딩하지 않는다
335
+ */
336
+ imageFormat?: "png" | "webp";
326
337
  /**
327
338
  * PDF 표 감지 활성화 (기본 true). false 면 선 기반 그리드·클러스터 표 감지를 모두 끄고
328
339
  * 자연 읽기순 텍스트만 뽑는다 (#64).
@@ -1675,17 +1686,14 @@ declare function markdownToHwpx(markdown: string, options?: MarkdownToHwpxOption
1675
1686
  interface HwpToHwpxOptions {
1676
1687
  /** 암호 문서의 열기 암호 */
1677
1688
  password?: string;
1678
- /** 변환 엔진 (convertToHwpx 만 본다). "kordoc"(기본): 자체 변환 — 어디서나. "hancom": 한/글 자체 저장(Windows + 한/글, 팝업 없이) —
1679
- * HWP 3.x·HWPML 도 서식 그대로. "auto": 한/글이 있으면 hancom, 없으면 kordoc */
1680
- engine?: "kordoc" | "hancom" | "auto";
1681
1689
  }
1682
1690
  declare function hwpToHwpx(input: Uint8Array | ArrayBuffer, options?: HwpToHwpxOptions): Promise<Uint8Array>;
1683
1691
  interface ConvertToHwpxResult {
1684
1692
  data: Uint8Array;
1685
1693
  /** preserve: 서식 그대로(HWP 5.x), content: 글·표만 옮겨 kordoc 기본 서식으로(HWP 3.x 등) */
1686
1694
  mode: "preserve" | "content";
1687
- /** 실제로 쓴 엔진 */
1688
- engine: "kordoc" | "hancom";
1695
+ /** 변환 엔진 — 늘 자체 변환 */
1696
+ engine: "kordoc";
1689
1697
  warnings: string[];
1690
1698
  }
1691
1699
  /**
package/dist/index.js CHANGED
@@ -1,66 +1,10 @@
1
1
  import {
2
- FLAG_COMPRESSED,
3
- FLAG_DISTRIBUTION,
4
- FLAG_DRM,
5
- FLAG_ENCRYPTED,
6
- FLAG_TRACK_CHANGES,
7
- INLINE_TABLE_MARK,
8
- TAG_CHAR_SHAPE,
9
- TAG_CTRL_HEADER,
10
- TAG_DOC_CHAR_SHAPE,
11
- TAG_DOC_PARA_SHAPE,
12
- TAG_FACE_NAME,
13
- TAG_ID_MAPPINGS,
14
- TAG_LIST_HEADER,
15
- TAG_PARA_HEADER,
16
- TAG_PARA_LINE_SEG,
17
- TAG_PARA_TEXT,
18
- TAG_SHAPE_COMPONENT,
19
- TAG_SHAPE_COMPONENT_PICTURE,
20
- TAG_TABLE,
21
- appendParaText,
22
- blocksPlainText,
23
- buildAddressedTable,
24
- cellTextFromBlocks,
25
- convertToHwpx,
26
- createParaTextState,
27
- decompressStream,
28
- detectImageMime,
29
- emitParagraphBlocks,
30
- fileTimeText,
31
- formatNumber,
32
- hasRealStrike,
33
- hasRealUnderline,
34
- hwpEquationToLatex,
35
- hwpToHwpx,
36
- indexHwp5Tables,
37
- isClickHereGuideText,
38
- isExtendedOnlyCtrlChar,
39
- locateMemoBlocks,
40
- memosMarkdown,
41
- openHwp5Container,
42
- parseDocInfo,
43
- parseFileHeader,
44
- parseHwp5Document,
45
- readHwp5BinData,
46
- readHwp5DocInfoRecords,
47
- readHwp5SectionRecords,
48
- readHwp5SectionStreams,
49
- readRecords,
50
- resolveImageBlocks,
51
- unfilledClickHereGuide
52
- } from "./chunk-JC2TMUU5.js";
53
- import {
2
+ WEBP_OPTIONS,
54
3
  blocksToPages,
55
- readImageQrCodes
56
- } from "./chunk-PHU4VSNF.js";
57
- import {
58
- bmpToPng,
59
- inlineImagesIntoMarkdown
60
- } from "./chunk-UN2F6EKQ.js";
61
- import {
62
- parsePageRange
63
- } from "./chunk-V4BH5SRQ.js";
4
+ loadSharp,
5
+ readImageQrCodes,
6
+ toBuffer
7
+ } from "./chunk-MLBX6KQM.js";
64
8
  import {
65
9
  detectFormat,
66
10
  detectOle2Format,
@@ -70,9 +14,6 @@ import {
70
14
  isPdfFile,
71
15
  isZipFile
72
16
  } from "./chunk-S6H3ZPYQ.js";
73
- import {
74
- parseLenientCfb
75
- } from "./chunk-PDI54TF2.js";
76
17
  import {
77
18
  validateOcrOptions
78
19
  } from "./chunk-TBGGAR7W.js";
@@ -230,7 +171,71 @@ import {
230
171
  unescapeGfm,
231
172
  unescapeGfmCell,
232
173
  wordHunks
233
- } from "./chunk-6YUMHSBG.js";
174
+ } from "./chunk-WLFZOBZR.js";
175
+ import {
176
+ FLAG_COMPRESSED,
177
+ FLAG_DISTRIBUTION,
178
+ FLAG_DRM,
179
+ FLAG_ENCRYPTED,
180
+ FLAG_TRACK_CHANGES,
181
+ INLINE_TABLE_MARK,
182
+ TAG_CHAR_SHAPE,
183
+ TAG_CTRL_HEADER,
184
+ TAG_DOC_CHAR_SHAPE,
185
+ TAG_DOC_PARA_SHAPE,
186
+ TAG_FACE_NAME,
187
+ TAG_ID_MAPPINGS,
188
+ TAG_LIST_HEADER,
189
+ TAG_PARA_HEADER,
190
+ TAG_PARA_LINE_SEG,
191
+ TAG_PARA_TEXT,
192
+ TAG_SHAPE_COMPONENT,
193
+ TAG_SHAPE_COMPONENT_PICTURE,
194
+ TAG_TABLE,
195
+ appendParaText,
196
+ blocksPlainText,
197
+ buildAddressedTable,
198
+ cellTextFromBlocks,
199
+ convertToHwpx,
200
+ createParaTextState,
201
+ decompressStream,
202
+ detectImageMime,
203
+ emitParagraphBlocks,
204
+ fileTimeText,
205
+ formatNumber,
206
+ hasRealStrike,
207
+ hasRealUnderline,
208
+ hwpEquationToLatex,
209
+ hwpToHwpx,
210
+ indexHwp5Tables,
211
+ isClickHereGuideText,
212
+ isExtendedOnlyCtrlChar,
213
+ locateMemoBlocks,
214
+ memosMarkdown,
215
+ openHwp5Container,
216
+ parseDocInfo,
217
+ parseFileHeader,
218
+ parseHwp5Document,
219
+ readHwp5BinData,
220
+ readHwp5DocInfoRecords,
221
+ readHwp5SectionRecords,
222
+ readHwp5SectionStreams,
223
+ readRecords,
224
+ resolveImageBlocks,
225
+ unfilledClickHereGuide
226
+ } from "./chunk-7KKL3PRK.js";
227
+ import {
228
+ MAX_PIXELS,
229
+ bmpToPng,
230
+ bmpToRgba,
231
+ inlineImagesIntoMarkdown
232
+ } from "./chunk-UJELMNOU.js";
233
+ import {
234
+ parsePageRange
235
+ } from "./chunk-V4BH5SRQ.js";
236
+ import {
237
+ parseLenientCfb
238
+ } from "./chunk-PDI54TF2.js";
234
239
  import "./chunk-LT4QALSF.js";
235
240
  import {
236
241
  MAX_COLS,
@@ -253,7 +258,7 @@ import {
253
258
  tidyScriptTags,
254
259
  unframeLayoutTables,
255
260
  wrapScript
256
- } from "./chunk-OO4DHHTG.js";
261
+ } from "./chunk-LFFARZYZ.js";
257
262
  import {
258
263
  KordocError,
259
264
  OPTIONAL_DEP_INSTALL_HINT,
@@ -269,7 +274,7 @@ import {
269
274
  stripDtd,
270
275
  toArrayBuffer,
271
276
  unzipLimitBytes
272
- } from "./chunk-3UY7ARXP.js";
277
+ } from "./chunk-DAAJO62F.js";
273
278
 
274
279
  // src/plain-markdown.ts
275
280
  function toPlainMarkdown(md2) {
@@ -413,9 +418,9 @@ function decryptEntry(cipher, entry, startKey) {
413
418
  const decipher = createDecipheriv("aes-256-cbc", key3, entry.iv);
414
419
  decipher.setAutoPadding(false);
415
420
  const raw = Buffer.concat([decipher.update(cipher), decipher.final()]);
416
- const plain2 = inflateRawSync(raw, { maxOutputLength: MAX_DECOMPRESS_SIZE });
417
- const sum = createHash("sha256").update(plain2.subarray(0, Math.min(CHECKSUM_PREFIX_BYTES, plain2.length))).digest();
418
- if (sum.length === entry.checksum.length && timingSafeEqual(sum, entry.checksum)) return plain2;
421
+ const plain3 = inflateRawSync(raw, { maxOutputLength: MAX_DECOMPRESS_SIZE });
422
+ const sum = createHash("sha256").update(plain3.subarray(0, Math.min(CHECKSUM_PREFIX_BYTES, plain3.length))).digest();
423
+ if (sum.length === entry.checksum.length && timingSafeEqual(sum, entry.checksum)) return plain3;
419
424
  } catch {
420
425
  }
421
426
  }
@@ -433,15 +438,15 @@ async function decryptHwpxInPlace(zip, manifestXml, password) {
433
438
  throw new KordocError(`\uC554\uD638 \uBAA9\uB85D\uC5D0 \uC788\uB294 \uD30C\uC77C\uC774 \uBB38\uC11C\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4: ${entry.path}`);
434
439
  }
435
440
  const raw = await readZipEntry(file, "uint8array", used);
436
- const plain2 = decryptEntry(Buffer.from(raw.buffer, raw.byteOffset, raw.length), entry, startKey);
437
- if (!plain2) {
441
+ const plain3 = decryptEntry(Buffer.from(raw.buffer, raw.byteOffset, raw.length), entry, startKey);
442
+ if (!plain3) {
438
443
  throw new KordocError("\uBE44\uBC00\uBC88\uD638\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uAC70\uB098 \uC554\uD638\uD654 \uB370\uC774\uD130\uAC00 \uC190\uC0C1\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
439
444
  }
440
- used += plain2.length;
445
+ used += plain3.length;
441
446
  if (used > MAX_DECOMPRESS_SIZE) throw new ZipBombError("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
442
- decrypted.push({ path: entry.path, plain: plain2 });
447
+ decrypted.push({ path: entry.path, plain: plain3 });
443
448
  }
444
- for (const { path, plain: plain2 } of decrypted) zip.file(path, plain2);
449
+ for (const { path, plain: plain3 } of decrypted) zip.file(path, plain3);
445
450
  zip.file("META-INF/manifest.xml", stripEncryptionData(manifestXml));
446
451
  return decrypted.length;
447
452
  }
@@ -17848,7 +17853,7 @@ var MIN_SIDE = 24;
17848
17853
  async function ocrEmbeddedImages(blocks, options, warnings) {
17849
17854
  const ocr = options?.ocr;
17850
17855
  if (ocr !== true && ocr !== "force" && typeof ocr !== "function") return false;
17851
- const { parseImageDocument } = await import("./image-ocr-NFCTNIL5.js");
17856
+ const { parseImageDocument } = await import("./image-ocr-VIGZE4YL.js");
17852
17857
  let inserted = false, unreadable = 0;
17853
17858
  let failed = null;
17854
17859
  const walk = async (list, depth) => {
@@ -17903,6 +17908,79 @@ async function tooSmall(bytes) {
17903
17908
  }
17904
17909
  }
17905
17910
 
17911
+ // src/image/format.ts
17912
+ var MIME = { png: "image/png", webp: "image/webp" };
17913
+ function isFormat(b, format2) {
17914
+ if (format2 === "png") return b[0] === 137 && b[1] === 80 && b[2] === 78 && b[3] === 71;
17915
+ return b.length >= 12 && b[0] === 82 && b[1] === 73 && b[2] === 70 && b[3] === 70 && b[8] === 87 && b[9] === 69 && b[10] === 66 && b[11] === 80;
17916
+ }
17917
+ var plain = (b) => b && new Uint8Array(b.buffer, b.byteOffset, b.byteLength);
17918
+ async function convert(sharp, img, format2) {
17919
+ if (isFormat(img.data, format2)) return img.data;
17920
+ if (img.data[0] === 66 && img.data[1] === 77) {
17921
+ if (format2 === "png") return bmpToPng(img.data);
17922
+ const px = bmpToRgba(img.data);
17923
+ if (!px || !sharp) return null;
17924
+ return plain(await sharp(toBuffer(px.data), { raw: { width: px.width, height: px.height, channels: 4 } }).webp(WEBP_OPTIONS).toBuffer().catch(() => null));
17925
+ }
17926
+ if (!sharp) return null;
17927
+ const out = sharp(toBuffer(img.data), { limitInputPixels: MAX_PIXELS }).rotate();
17928
+ return plain(await (format2 === "png" ? out.png() : out.webp(WEBP_OPTIONS)).toBuffer().catch(() => null));
17929
+ }
17930
+ async function convertImages(blocks, images, format2, warnings) {
17931
+ const sharp = await loadSharp();
17932
+ const names = new Set(images.map((i) => i.filename));
17933
+ const renamed = /* @__PURE__ */ new Map();
17934
+ const kept = [];
17935
+ for (const img of images) {
17936
+ const name = img.filename.replace(/\.[^./]*$/, "") + "." + format2;
17937
+ const data = await convert(sharp, img, format2);
17938
+ if (!data || name !== img.filename && names.has(name)) {
17939
+ kept.push(img.mimeType);
17940
+ continue;
17941
+ }
17942
+ if (name !== img.filename) {
17943
+ renamed.set(img.filename, img);
17944
+ names.add(name);
17945
+ }
17946
+ Object.assign(img, { filename: name, data, mimeType: MIME[format2] });
17947
+ }
17948
+ if (kept.length) {
17949
+ const byMime = [...new Set(kept)].map((m) => `${m} ${kept.filter((k) => k === m).length}`).join(", ");
17950
+ warnings.push({ code: "SKIPPED_IMAGE", message: `\uADF8\uB9BC ${kept.length}\uAC1C\uB294 ${format2.toUpperCase()} \uB85C \uBC14\uAFB8\uC9C0 \uBABB\uD574 \uC6D0\uBCF8 \uD615\uC2DD\uC73C\uB85C \uB0C8\uC2B5\uB2C8\uB2E4 (${byMime})${sharp ? "" : " \u2014 optional dependency 'sharp' \uAC00 \uC5C6\uC2B5\uB2C8\uB2E4"}` });
17951
+ }
17952
+ const byName = new Map(images.map((i) => [i.filename, i]));
17953
+ const fix = (s) => s.includes("![image](") ? s.replace(/!\[image\]\(([^()\s]+)\)/g, (m, name) => {
17954
+ const img = renamed.get(name);
17955
+ return img ? `![image](${img.filename})` : m;
17956
+ }) : s;
17957
+ const walk = (list, depth) => {
17958
+ if (!list || depth > 64) return;
17959
+ for (const b of list) {
17960
+ if (b.type === "image" && b.text) {
17961
+ const img = renamed.get(b.text) ?? byName.get(b.text);
17962
+ if (img) {
17963
+ b.text = img.filename;
17964
+ if (b.imageData) b.imageData = { ...b.imageData, data: img.data, mimeType: img.mimeType };
17965
+ }
17966
+ } else if (b.text) b.text = fix(b.text);
17967
+ if (b.footnoteText) b.footnoteText = fix(b.footnoteText);
17968
+ walk(b.children, depth + 1);
17969
+ walk(b.footnoteBlocks, depth + 1);
17970
+ if (b.table) {
17971
+ if (b.table.caption) b.table.caption = fix(b.table.caption);
17972
+ for (const row of b.table.cells) for (const cell of row) {
17973
+ cell.text = fix(cell.text);
17974
+ walk(cell.blocks, depth + 1);
17975
+ }
17976
+ walk(b.table.captionBlocks, depth + 1);
17977
+ }
17978
+ }
17979
+ };
17980
+ walk(blocks, 0);
17981
+ return renamed.size > 0;
17982
+ }
17983
+
17906
17984
  // src/table/classifier.ts
17907
17985
  var DIAGRAM_KEYWORDS = /조직도|비상\s*연락망|연락망|체계도|업무\s*체계도|기구표|배치도|흐름도|추진\s*체계/u;
17908
17986
  var KEYWORD_GATE = 0.3;
@@ -18407,11 +18485,11 @@ function parseParaGeom(el, oldUnit = false) {
18407
18485
  }
18408
18486
  const margin = findDeep(el, "margin");
18409
18487
  if (margin) {
18410
- const plain2 = oldUnit && (margin.parentNode?.tagName ?? "").replace(/^[^:]+:/, "") === "paraPr";
18488
+ const plain3 = oldUnit && (margin.parentNode?.tagName ?? "").replace(/^[^:]+:/, "") === "paraPr";
18411
18489
  const v = (n) => {
18412
18490
  const c = findDeep(margin, n);
18413
18491
  const x = c ? (Number(c.getAttribute("value")) || 0) * (c.getAttribute("unit") === "CHAR" ? 5 : 1) : 0;
18414
- return plain2 ? Math.trunc(x / 2) : x;
18492
+ return plain3 ? Math.trunc(x / 2) : x;
18415
18493
  };
18416
18494
  g3.marginLeft = v("left");
18417
18495
  g3.marginRight = v("right");
@@ -18602,7 +18680,7 @@ function parseRenderStyles(headXml, opts) {
18602
18680
  // src/form/seal.ts
18603
18681
  var HU_PER_MM = 7200 / 25.4;
18604
18682
  var mm2hu = (mm) => Math.round(mm * HU_PER_MM);
18605
- var MIME = {
18683
+ var MIME2 = {
18606
18684
  png: "image/png",
18607
18685
  jpg: "image/jpeg",
18608
18686
  jpeg: "image/jpeg",
@@ -18781,7 +18859,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
18781
18859
  if (!op.anchor) throw new KordocError("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
18782
18860
  if (!op.image || op.image.length === 0) throw new KordocError("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
18783
18861
  const ext = (op.ext ?? "png").toLowerCase();
18784
- if (!MIME[ext]) throw new KordocError(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
18862
+ if (!MIME2[ext]) throw new KordocError(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
18785
18863
  if (!imageMagicMatches(op.image, ext)) throw new KordocError(`place_seal: \uC774\uBBF8\uC9C0 \uB0B4\uC6A9\uC774 .${ext} \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 (\uB9E4\uC9C1\uBC14\uC774\uD2B8 \uBD88\uC77C\uCE58)`);
18786
18864
  const wantOcc = op.occurrence ?? 0;
18787
18865
  let found = null;
@@ -18853,7 +18931,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
18853
18931
  const itemId = `image${n}`;
18854
18932
  usedIds.add(itemId);
18855
18933
  additions.set(entry, op.image);
18856
- manifestItems.push(`<opf:item id="${itemId}" href="${entry}" media-type="${MIME[ext]}" isEmbeded="1"/>`);
18934
+ manifestItems.push(`<opf:item id="${itemId}" href="${entry}" media-type="${MIME2[ext]}" isEmbeded="1"/>`);
18857
18935
  const pic = buildFloatPicXml(itemId, mm2hu(sizeMm), mm2hu(posXMm), mm2hu(posYMm), {
18858
18936
  id: ++maxId,
18859
18937
  instid: ++maxId
@@ -19036,12 +19114,12 @@ function protoStyle(xml, ix) {
19036
19114
  if (!p) return null;
19037
19115
  const model = parsePara(xml, p);
19038
19116
  const paraPr = /\bparaPrIDRef="(\d+)"/.exec(xml.slice(p.start, p.openEnd))?.[1] ?? "0";
19039
- const plain2 = paraPlain(model);
19040
- let prefix = /^[\s ]*/.exec(plain2)[0].length;
19041
- const cp = plain2.codePointAt(prefix);
19117
+ const plain3 = paraPlain(model);
19118
+ let prefix = /^[\s ]*/.exec(plain3)[0].length;
19119
+ const cp = plain3.codePointAt(prefix);
19042
19120
  if (cp !== void 0 && isMarkerChar(mapPuaText(String.fromCodePoint(cp)))) {
19043
19121
  prefix += String.fromCodePoint(cp).length;
19044
- prefix += /^[\s ]*/.exec(plain2.slice(prefix))[0].length;
19122
+ prefix += /^[\s ]*/.exec(plain3.slice(prefix))[0].length;
19045
19123
  }
19046
19124
  let best = "", bestN = 0, pos = 0;
19047
19125
  for (const r of model.runs) {
@@ -19288,9 +19366,9 @@ var scrubText = (t) => t.replace(ROLE_LABEL_RE, (_m, label) => `${label}\u25CB\u
19288
19366
  function scrubPeople(xml) {
19289
19367
  return xml.replace(/(<hp:t\b(?:[^>/]|\/(?!>)){0,256}>)([\s\S]{0,65536}?)(<\/hp:t>)/g, (all, open, body, close) => {
19290
19368
  if (!body.includes("<")) return open + scrubText(body) + close;
19291
- const plain2 = body.replace(/<hp:(?:fwSpace|nbSpace)\/>/g, " ").replace(/<hp:tab\b[^>]{0,256}\/>/g, " ").replace(/<[^>]{1,1024}>/g, "");
19292
- const out = scrubText(plain2);
19293
- return out === plain2 ? all : open + out.replace(/&(?!(?:amp|lt|gt|quot|apos);)/g, "&amp;").replace(/</g, "&lt;") + close;
19369
+ const plain3 = body.replace(/<hp:(?:fwSpace|nbSpace)\/>/g, " ").replace(/<hp:tab\b[^>]{0,256}\/>/g, " ").replace(/<[^>]{1,1024}>/g, "");
19370
+ const out = scrubText(plain3);
19371
+ return out === plain3 ? all : open + out.replace(/&(?!(?:amp|lt|gt|quot|apos);)/g, "&amp;").replace(/</g, "&lt;") + close;
19294
19372
  });
19295
19373
  }
19296
19374
  function scrubMeta(hpf) {
@@ -20510,7 +20588,7 @@ function classify(raw) {
20510
20588
  if (li) return { kind: indent >= 2 ? "sub" : "item", body: li[1].trim() };
20511
20589
  return { kind: "para", body: t };
20512
20590
  }
20513
- function plain(s) {
20591
+ function plain2(s) {
20514
20592
  return s.replace(/!?\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/(\*\*|__|~~|`)/g, "").trim();
20515
20593
  }
20516
20594
  function stripQuoted(s) {
@@ -20615,11 +20693,11 @@ function lintMuncheText(text) {
20615
20693
  continue;
20616
20694
  }
20617
20695
  if (c.kind === "lead") {
20618
- leadBuf.push({ line: no, body: plain(c.body) });
20696
+ leadBuf.push({ line: no, body: plain2(c.body) });
20619
20697
  continue;
20620
20698
  }
20621
20699
  flushLead();
20622
- const b = plain(c.body);
20700
+ const b = plain2(c.body);
20623
20701
  if (!b) continue;
20624
20702
  const q = stripQuoted(b);
20625
20703
  if (c.kind === "item" || c.kind === "sub" || c.kind === "concl" || c.kind === "para") {
@@ -21439,9 +21517,9 @@ var UNIT_NOTE_RE = new RegExp(String.raw`[((]\s*(?:단위\s*[::]\s*)?(${unit
21439
21517
  var BOUND_AFTER = /^\s?(?:이상|이하|초과|미만|내외|수준|안팎|가량|정도)/;
21440
21518
  var BOUND_BEFORE = /(?:목표|기준|상한|하한|최소|최대|약)[^\d]{0,8}$/;
21441
21519
  function canonicalValue(text) {
21442
- const plain2 = text.replace(/,/g, "");
21443
- if (!plain2.includes(".")) return plain2;
21444
- return plain2.replace(/0+$/, "").replace(/\.$/, "");
21520
+ const plain3 = text.replace(/,/g, "");
21521
+ if (!plain3.includes(".")) return plain3;
21522
+ return plain3.replace(/0+$/, "").replace(/\.$/, "");
21445
21523
  }
21446
21524
  var isDistinctive = (value) => value.includes(".") || value.replace(/^0+/, "").length >= 3;
21447
21525
  function indexTable(rows, at) {
@@ -22544,15 +22622,15 @@ function scanTableParagraphs(table) {
22544
22622
  return out.sort((a, b) => a.start - b.start);
22545
22623
  }
22546
22624
  var LEAD_RE = /^[-•·◦○□■▪▶►※*ㅇ❍➊-➓①-⑳]$/u;
22547
- function withOptionalLeads(plain2) {
22548
- const opt = new Array(plain2.length).fill(false);
22625
+ function withOptionalLeads(plain3) {
22626
+ const opt = new Array(plain3.length).fill(false);
22549
22627
  let at = 0;
22550
- for (const line of plain2.split("\n")) {
22628
+ for (const line of plain3.split("\n")) {
22551
22629
  const w = line.match(/^(\S+)\s/)?.[1];
22552
22630
  if (w && (LEAD_RE.test(w) || AUTONUM_PREFIX_RE.test(w))) for (let k = 0; k < w.length; k++) opt[at + k] = true;
22553
22631
  at += line.length + 1;
22554
22632
  }
22555
- return { text: plain2.replace(/\n/g, " "), opt };
22633
+ return { text: plain3.replace(/\n/g, " "), opt };
22556
22634
  }
22557
22635
  function findRuns(texts, target, opt) {
22558
22636
  const tch = [], topt = [];
@@ -25055,15 +25133,15 @@ function patchLineBreakParagraph(block, orig, edited, mapping, ctx, skip) {
25055
25133
  if (block.footnoteText || mapping.noteMarks?.length || mapping.prefixStripped) {
25056
25134
  return skip("\uAC15\uC81C \uC904\uBC14\uAFC8 \uBB38\uB2E8\uC758 \uAC01\uC8FC\xB7\uC790\uB3D9\uBC88\uD638 \u2014 \uC218\uC815 \uBBF8\uC9C0\uC6D0");
25057
25135
  }
25058
- const plain2 = (raw) => parseEmphasis(textUnitInline(raw, block, "\n")).plain;
25059
- let origNorm = plain2(orig.raw);
25060
- let newNorm = plain2(edited.raw);
25136
+ const plain3 = (raw) => parseEmphasis(textUnitInline(raw, block, "\n")).plain;
25137
+ let origNorm = plain3(orig.raw);
25138
+ let newNorm = plain3(edited.raw);
25061
25139
  if (newNorm === origNorm) return skip("\uD14D\uC2A4\uD2B8 \uC678 \uBCC0\uACBD(\uD5E4\uB529 \uB808\uBCA8/\uC11C\uC2DD)\uB9CC \uAC10\uC9C0 \u2014 \uC2A4\uD0C0\uC77C \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
25062
25140
  if (newNorm.split("\n").some((l) => sanitizeText(l) !== l) && origNorm.split("\n").every((l) => sanitizeText(l) === l)) {
25063
25141
  return skip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uD328\uCE58 \uC2DC \uC6D0\uBB38 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0");
25064
25142
  }
25065
25143
  if (orig.part !== void 0) {
25066
- const parts = splitMarkdownUnits(blocksToMarkdown([block])).map((u) => plain2(u.raw));
25144
+ const parts = splitMarkdownUnits(blocksToMarkdown([block])).map((u) => plain3(u.raw));
25067
25145
  if (parts[orig.part] !== origNorm) return skip("\uBB38\uB2E8 \uBD84\uC808(\uAC15\uC81C \uC904\uBC14\uAFC8) \uC870\uAC01 \uB9E4\uD551 \uC2E4\uD328 \u2014 \uBBF8\uC9C0\uC6D0");
25068
25146
  origNorm = parts.join("\n\n");
25069
25147
  parts[orig.part] = newNorm;
@@ -30635,7 +30713,7 @@ function planTableRows(tbl, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan, n
30635
30713
  const nRows = rowH.length;
30636
30714
  const rowY = [0];
30637
30715
  for (const h of rowH) rowY.push(rowY[rowY.length - 1] + h);
30638
- const plain2 = () => rowH.map((h, r) => [{ page: 0, y: ty + rowY[r], h }]);
30716
+ const plain3 = () => rowH.map((h, r) => [{ page: 0, y: ty + rowY[r], h }]);
30639
30717
  const pageBottom = MT + BODY_H;
30640
30718
  const stackOver = tbl.getAttribute("pageBreak") === "CELL" && rowH.some((h, r) => {
30641
30719
  const rc = cells.filter((c) => c.ra === r && c.rs === 1);
@@ -30649,10 +30727,10 @@ function planTableRows(tbl, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan, n
30649
30727
  if (rowY.some((v, k) => k > 0 && k < nRows && Math.abs(v - declared) <= 2)) slack = 0;
30650
30728
  }
30651
30729
  const savedParts = tbl.getAttribute("pageBreak") === "CELL" && cells.some((c) => c.h > rowY[nRows] && cellLineBoxes(c, BODY_H).some((b) => b.part > 0));
30652
- if (BODY_H <= 0 || ty + rowY[nRows] <= pageBottom + slack && !stackOver && !savedParts) return plain2();
30730
+ if (BODY_H <= 0 || ty + rowY[nRows] <= pageBottom + slack && !stackOver && !savedParts) return plain3();
30653
30731
  if (findChildByLocalName(tbl, "pos")?.getAttribute("treatAsChar") === "1") {
30654
30732
  const declared = num2(findChildByLocalName(tbl, "sz"), "height") || rowY[nRows];
30655
- if (ty - MT < 2e3 || ty + declared <= pageBottom + slack) return plain2();
30733
+ if (ty - MT < 2e3 || ty + declared <= pageBottom + slack) return plain3();
30656
30734
  return rowH.map((h, r) => [{ page: 1, y: MT + rowY[r], h }]);
30657
30735
  }
30658
30736
  let hdrRows = 0;
@@ -33565,7 +33643,7 @@ async function actualSize(sharp, data, fallbackW, fallbackH) {
33565
33643
  }
33566
33644
  return { w: fallbackW, h: fallbackH };
33567
33645
  }
33568
- async function loadSharp() {
33646
+ async function loadSharp2() {
33569
33647
  try {
33570
33648
  const mod = await import("sharp");
33571
33649
  return mod.default ?? mod;
@@ -33576,7 +33654,7 @@ async function loadSharp() {
33576
33654
  }
33577
33655
  }
33578
33656
  async function rasterizePageSvg(svg, widthPt, heightPt, options = {}) {
33579
- const sharp = await loadSharp();
33657
+ const sharp = await loadSharp2();
33580
33658
  if (!(widthPt > 0) || !(heightPt > 0)) throw new KordocError(`\uC798\uBABB\uB41C \uD398\uC774\uC9C0 \uD06C\uAE30: ${widthPt}x${heightPt}pt`);
33581
33659
  const maxW = options.maxWidthPx ?? 1400;
33582
33660
  const maxH = options.maxHeightPx ?? 4e3;
@@ -33702,7 +33780,7 @@ async function extractRenderedRegions(input, options = {}) {
33702
33780
  const byPage = /* @__PURE__ */ new Map();
33703
33781
  for (const r of wanted) for (const b of r.regions) if (pageSvgs.has(b.page)) (byPage.get(b.page) ?? byPage.set(b.page, []).get(b.page)).push({ region: r, bbox: b });
33704
33782
  if (byPage.size === 0) return [];
33705
- const sharp = await loadSharp();
33783
+ const sharp = await loadSharp2();
33706
33784
  const out = [];
33707
33785
  for (const [page, items] of [...byPage.entries()].sort((a, b) => a[0] - b[0])) {
33708
33786
  const meta = scene.pages.find((p) => p.page === page);
@@ -33883,6 +33961,12 @@ async function withImageQr(blocks, markdown, warnings, images, options, inline)
33883
33961
  const found = await readImageQrCodes(blocks, images, list);
33884
33962
  return { markdown: found ? blocksMarkdown(blocks, options, inline) : markdown, warnings: list.length ? list : void 0 };
33885
33963
  }
33964
+ async function withImageFormat(blocks, markdown, warnings, images, options, inline) {
33965
+ if (!options?.imageFormat || options.images === false || !images?.length) return { markdown, warnings };
33966
+ const list = [...warnings ?? []];
33967
+ const renamed = await convertImages(blocks, images, options.imageFormat, list);
33968
+ return { markdown: renamed ? blocksMarkdown(blocks, options, inline) : markdown, warnings: list.length ? list : void 0 };
33969
+ }
33886
33970
  function blocksMarkdown(blocks, options, images) {
33887
33971
  const md2 = blocksToMarkdown(blocks, { tableFormat: options?.tableFormat });
33888
33972
  if (!(options?.inlineImages && options.images !== false && images?.length)) return md2;
@@ -33897,7 +33981,7 @@ function scriptsOff(r, off) {
33897
33981
  }
33898
33982
  async function parseImage(buffer, options) {
33899
33983
  try {
33900
- const { parseImageDocument } = await import("./image-ocr-NFCTNIL5.js");
33984
+ const { parseImageDocument } = await import("./image-ocr-VIGZE4YL.js");
33901
33985
  const { blocks, warnings, lines } = await parseImageDocument(buffer, options);
33902
33986
  stripScriptTags({ blocks });
33903
33987
  return {
@@ -33917,7 +34001,8 @@ async function parseHwp3(buffer, options) {
33917
34001
  try {
33918
34002
  const { markdown, blocks, metadata, outline, warnings, images } = parseHwp3Document(buffer, options);
33919
34003
  const qr = await withImageQr(blocks, markdown, warnings, images, options, images);
33920
- return { success: true, fileType: "hwp3", markdown: qr.markdown, blocks, metadata, outline, warnings: qr.warnings, images, pageCount: metadata?.pageCount };
34004
+ const webp = await withImageFormat(blocks, qr.markdown, qr.warnings, images, options, images);
34005
+ return { success: true, fileType: "hwp3", markdown: webp.markdown, blocks, metadata, outline, warnings: webp.warnings, images, pageCount: metadata?.pageCount };
33921
34006
  } catch (err) {
33922
34007
  return { success: false, fileType: "hwp3", error: sanitizeError(err), code: classifyError(err) };
33923
34008
  }
@@ -33928,8 +34013,9 @@ async function parseHwpx(buffer, options) {
33928
34013
  const { blocks, metadata, outline, images, memos } = doc;
33929
34014
  const ocr = await withEmbeddedImageOcr(blocks, doc.markdown, doc.warnings, void 0, options);
33930
34015
  const qr = await withImageQr(blocks, ocr.markdown, ocr.warnings, images, options);
33931
- const markdown = options?.memos && memos?.length ? qr.markdown + memosMarkdown(memos) : qr.markdown;
33932
- return scriptsOff({ success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings: qr.warnings, images: images?.length ? images : void 0, pageCount: metadata?.pageCount, ...memos?.length ? { memos } : {} }, options?.scriptTags === false);
34016
+ const webp = await withImageFormat(blocks, qr.markdown, qr.warnings, images, options);
34017
+ const markdown = options?.memos && memos?.length ? webp.markdown + memosMarkdown(memos) : webp.markdown;
34018
+ return scriptsOff({ success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings: webp.warnings, images: images?.length ? images : void 0, pageCount: metadata?.pageCount, ...memos?.length ? { memos } : {} }, options?.scriptTags === false);
33933
34019
  } catch (err) {
33934
34020
  return { success: false, fileType: "hwpx", error: sanitizeError(err), code: classifyError(err) };
33935
34021
  }
@@ -33957,8 +34043,9 @@ async function parseHwp(buffer, options) {
33957
34043
  }
33958
34044
  const ocred = await withEmbeddedImageOcr(blocks, markdown, warnings, images, options);
33959
34045
  const qr = await withImageQr(blocks, ocred.markdown, ocred.warnings, images, options, images);
33960
- const md2 = options?.memos && memos?.length ? qr.markdown + memosMarkdown(memos) : qr.markdown;
33961
- return scriptsOff({ success: true, fileType: "hwp", markdown: md2, blocks, metadata, outline, warnings: qr.warnings, images: images?.length ? images : void 0, pageCount: metadata?.pageCount, ...memos?.length ? { memos } : {} }, options?.scriptTags === false);
34046
+ const webp = await withImageFormat(blocks, qr.markdown, qr.warnings, images, options, images);
34047
+ const md2 = options?.memos && memos?.length ? webp.markdown + memosMarkdown(memos) : webp.markdown;
34048
+ return scriptsOff({ success: true, fileType: "hwp", markdown: md2, blocks, metadata, outline, warnings: webp.warnings, images: images?.length ? images : void 0, pageCount: metadata?.pageCount, ...memos?.length ? { memos } : {} }, options?.scriptTags === false);
33962
34049
  } catch (err) {
33963
34050
  return { success: false, fileType: "hwp", error: sanitizeError(err), code: classifyError(err) };
33964
34051
  }
@@ -33966,7 +34053,7 @@ async function parseHwp(buffer, options) {
33966
34053
  async function parsePdf(buffer, options) {
33967
34054
  let parsePdfDocument;
33968
34055
  try {
33969
- const mod = await import("./parser-V25GYLBJ.js");
34056
+ const mod = await import("./parser-XFU3VRWM.js");
33970
34057
  parsePdfDocument = mod.parsePdfDocument;
33971
34058
  } catch {
33972
34059
  return {
@@ -34004,7 +34091,8 @@ async function parseDocx(buffer, options) {
34004
34091
  try {
34005
34092
  const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
34006
34093
  const qr = await withImageQr(blocks, markdown, warnings, images, options);
34007
- return scriptsOff({ success: true, fileType: "docx", markdown: qr.markdown, blocks, metadata, outline, warnings: qr.warnings, images: images?.length ? images : void 0, pageCount: metadata?.pageCount }, options?.scriptTags === false);
34094
+ const webp = await withImageFormat(blocks, qr.markdown, qr.warnings, images, options);
34095
+ return scriptsOff({ success: true, fileType: "docx", markdown: webp.markdown, blocks, metadata, outline, warnings: webp.warnings, images: images?.length ? images : void 0, pageCount: metadata?.pageCount }, options?.scriptTags === false);
34008
34096
  } catch (err) {
34009
34097
  return { success: false, fileType: "docx", error: sanitizeError(err), code: classifyError(err) };
34010
34098
  }
@@ -34013,7 +34101,8 @@ async function parsePptx(buffer, options) {
34013
34101
  try {
34014
34102
  const { markdown, blocks, metadata, outline, warnings, images } = await parsePptxDocument(buffer, options);
34015
34103
  const qr = await withImageQr(blocks, markdown, warnings, images, options);
34016
- return scriptsOff({ success: true, fileType: "pptx", markdown: qr.markdown, blocks, metadata, outline, warnings: qr.warnings, images: images?.length ? images : void 0, pageCount: metadata?.pageCount }, options?.scriptTags === false);
34104
+ const webp = await withImageFormat(blocks, qr.markdown, qr.warnings, images, options);
34105
+ return scriptsOff({ success: true, fileType: "pptx", markdown: webp.markdown, blocks, metadata, outline, warnings: webp.warnings, images: images?.length ? images : void 0, pageCount: metadata?.pageCount }, options?.scriptTags === false);
34017
34106
  } catch (err) {
34018
34107
  return { success: false, fileType: "pptx", error: sanitizeError(err), code: classifyError(err) };
34019
34108
  }
@@ -34044,7 +34133,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
34044
34133
  throw new Error(`hwpx-preserve \uD3EC\uB9F7\uC740 HWPX\xB7HWP 5.x \uC785\uB825\uB9CC \uC9C0\uC6D0\uD569\uB2C8\uB2E4 (\uAC10\uC9C0\uB41C \uD3EC\uB9F7: ${zipFormat})`);
34045
34134
  }
34046
34135
  } else if (format2 === "hwp" && detectOle2Format(buffer) === "hwp") {
34047
- const { hwpToHwpx: hwpToHwpx2 } = await import("./to-hwpx-DLVARUND.js");
34136
+ const { hwpToHwpx: hwpToHwpx2 } = await import("./to-hwpx-ZWN64NCQ.js");
34048
34137
  const hwpx = await hwpToHwpx2(new Uint8Array(buffer));
34049
34138
  buffer = hwpx.buffer.slice(hwpx.byteOffset, hwpx.byteOffset + hwpx.byteLength);
34050
34139
  } else {