kordoc 4.24.47 → 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 (216) hide show
  1. package/NOTICE +21 -0
  2. package/README.md +4 -4
  3. package/dist/{-PWMZE4CC.js → -22V6D2US.js} +42 -42
  4. package/dist/{chunk-RQ4XTX4J.cjs → chunk-2UWWWM4Q.cjs} +98 -98
  5. package/dist/{chunk-RQ4XTX4J.cjs.map → chunk-2UWWWM4Q.cjs.map} +1 -1
  6. package/dist/{chunk-3CWVQNFL.cjs → chunk-367WLMPO.cjs} +59 -67
  7. package/dist/chunk-367WLMPO.cjs.map +1 -0
  8. package/dist/{chunk-Z5TDZDWU.js → chunk-4HJKBRZJ.js} +153 -50
  9. package/dist/chunk-4HJKBRZJ.js.map +1 -0
  10. package/dist/{chunk-GRQXAWNW.js → chunk-4MWUBTAE.js} +2 -2
  11. package/dist/{chunk-TN5ZK2WN.js → chunk-67GSFYG7.js} +2 -2
  12. package/dist/{chunk-TGLXN6VH.js → chunk-6BFWLS7E.js} +3 -3
  13. package/dist/{chunk-X7RBVVDC.cjs → chunk-6NZ32OTX.cjs} +9 -3
  14. package/dist/chunk-6NZ32OTX.cjs.map +1 -0
  15. package/dist/{chunk-Q3UCWUEV.js → chunk-7KKL3PRK.js} +5 -13
  16. package/dist/chunk-7KKL3PRK.js.map +1 -0
  17. package/dist/{chunk-T5J4GW6B.js → chunk-AUAJVQQK.js} +2 -2
  18. package/dist/{chunk-KIVWAZKL.js → chunk-AXW2FMVR.js} +2 -2
  19. package/dist/{chunk-LEUAWTMU.js → chunk-CCQMSIZQ.js} +19 -19
  20. package/dist/{chunk-PM46GSMV.js → chunk-DA5AXURC.js} +194 -6
  21. package/dist/chunk-DA5AXURC.js.map +1 -0
  22. package/dist/{chunk-SUIH5LY7.js → chunk-DAAJO62F.js} +2 -2
  23. package/dist/{chunk-4MNRUPS5.js → chunk-EUJX7HTR.js} +53 -10
  24. package/dist/chunk-EUJX7HTR.js.map +1 -0
  25. package/dist/{chunk-56FEGA44.js → chunk-EYSXMDA7.js} +17 -17
  26. package/dist/{chunk-VKVDMH7X.js → chunk-FU6ZDWCI.js} +8 -2
  27. package/dist/chunk-FU6ZDWCI.js.map +1 -0
  28. package/dist/{chunk-KSE5HSU3.js → chunk-HETGOJ6V.js} +8 -5
  29. package/dist/chunk-HETGOJ6V.js.map +1 -0
  30. package/dist/{chunk-HFQFCAEJ.js → chunk-HW7WVYBF.js} +2 -2
  31. package/dist/{chunk-O2652KK3.cjs → chunk-IRAZCKQ6.cjs} +3 -3
  32. package/dist/{chunk-O2652KK3.cjs.map → chunk-IRAZCKQ6.cjs.map} +1 -1
  33. package/dist/{chunk-AB7MYMPZ.js → chunk-KB4ORA7M.js} +2 -2
  34. package/dist/{chunk-57BKTVR5.js → chunk-KXHUHGMC.js} +2 -2
  35. package/dist/{chunk-YLYSJSEP.js → chunk-L3JP55ZY.js} +2 -2
  36. package/dist/{chunk-2CBIY2OH.js → chunk-LCRSRVFJ.js} +2 -2
  37. package/dist/{chunk-2CBIY2OH.js.map → chunk-LCRSRVFJ.js.map} +1 -1
  38. package/dist/{chunk-IPXFIH5E.js → chunk-LFFARZYZ.js} +8 -5
  39. package/dist/chunk-LFFARZYZ.js.map +1 -0
  40. package/dist/{chunk-BO2IJGNZ.js → chunk-LOSCIAHY.js} +2 -2
  41. package/dist/{chunk-SQ5Q4Q3R.js → chunk-M5RQ2PNP.js} +6 -14
  42. package/dist/chunk-M5RQ2PNP.js.map +1 -0
  43. package/dist/{chunk-MOWJOFIH.js → chunk-MIJTZKWF.js} +2 -2
  44. package/dist/chunk-MLBX6KQM.js +153 -0
  45. package/dist/chunk-MLBX6KQM.js.map +1 -0
  46. package/dist/{chunk-HMD35PMD.js → chunk-OAETOHH3.js} +3 -3
  47. package/dist/{chunk-IWC6PTMT.js → chunk-PMGJQWSW.js} +2 -2
  48. package/dist/{chunk-LMHE4HDR.cjs → chunk-PVV6OY4M.cjs} +286 -98
  49. package/dist/chunk-PVV6OY4M.cjs.map +1 -0
  50. package/dist/{chunk-BKK2SMVM.cjs → chunk-PW7MQZI4.cjs} +2 -2
  51. package/dist/{chunk-BKK2SMVM.cjs.map → chunk-PW7MQZI4.cjs.map} +1 -1
  52. package/dist/{chunk-NYIJU4Q6.js → chunk-Q7FDPJUS.js} +10 -10
  53. package/dist/{chunk-FI7ULBC6.js → chunk-R2RLNUNK.js} +6 -6
  54. package/dist/{chunk-AO3YFJVW.js → chunk-RQLEGKEV.js} +2 -2
  55. package/dist/{chunk-OAKJNKAS.js → chunk-S54DZB2Z.js} +193 -5
  56. package/dist/chunk-S54DZB2Z.js.map +1 -0
  57. package/dist/{chunk-A67OXFXM.js → chunk-TAHS42ED.js} +54 -11
  58. package/dist/chunk-TAHS42ED.js.map +1 -0
  59. package/dist/{chunk-WAFJUSUF.cjs → chunk-TQOAPKLU.cjs} +11 -8
  60. package/dist/chunk-TQOAPKLU.cjs.map +1 -0
  61. package/dist/{chunk-UFY6XX4U.cjs → chunk-UBY2PLKR.cjs} +75 -32
  62. package/dist/chunk-UBY2PLKR.cjs.map +1 -0
  63. package/dist/{chunk-U556XJW6.js → chunk-UJELMNOU.js} +8 -2
  64. package/dist/chunk-UJELMNOU.js.map +1 -0
  65. package/dist/{chunk-FOTG4MMD.js → chunk-UU54HN5I.js} +6 -6
  66. package/dist/{chunk-BP5GDQBT.js → chunk-VMOUAWGD.js} +7 -7
  67. package/dist/{chunk-2VXVBB5Q.js → chunk-WLFZOBZR.js} +3 -3
  68. package/dist/chunk-Y4MFHEK4.cjs +156 -0
  69. package/dist/chunk-Y4MFHEK4.cjs.map +1 -0
  70. package/dist/{chunk-VL43TUO6.js → chunk-Y6QW3FJQ.js} +2 -2
  71. package/dist/chunk-ZF24SO45.js +154 -0
  72. package/dist/chunk-ZF24SO45.js.map +1 -0
  73. package/dist/chunks-Q7242OJE.js +11 -0
  74. package/dist/cli.js +74 -53
  75. package/dist/cli.js.map +1 -1
  76. package/dist/{formula-W5MTLANP.js → formula-BYEDWWZU.js} +4 -4
  77. package/dist/{formula-2BQBGPM2.js → formula-FQLMMBDP.js} +3 -3
  78. package/dist/{formula-V6CNOC4G.cjs → formula-QJEOIVKR.cjs} +9 -9
  79. package/dist/{formula-V6CNOC4G.cjs.map → formula-QJEOIVKR.cjs.map} +1 -1
  80. package/dist/generator-FTM6GOGB.cjs +11 -0
  81. package/dist/{generator-U2BRFTJ4.cjs.map → generator-FTM6GOGB.cjs.map} +1 -1
  82. package/dist/generator-Q3L7RNUY.js +17 -0
  83. package/dist/generator-SU73HZHR.js +10 -0
  84. package/dist/{image-ocr-COBRSG6O.js → image-ocr-7Y3FCGRR.js} +12 -10
  85. package/dist/image-ocr-7Y3FCGRR.js.map +1 -0
  86. package/dist/{image-ocr-2WSZULNO.js → image-ocr-VIGZE4YL.js} +9 -7
  87. package/dist/image-ocr-VIGZE4YL.js.map +1 -0
  88. package/dist/{image-ocr-MVOSHIY5.cjs → image-ocr-WRILL3WO.cjs} +29 -27
  89. package/dist/image-ocr-WRILL3WO.cjs.map +1 -0
  90. package/dist/index.cjs +1645 -1542
  91. package/dist/index.cjs.map +1 -1
  92. package/dist/index.d.cts +18 -5
  93. package/dist/index.d.ts +18 -5
  94. package/dist/index.js +231 -128
  95. package/dist/index.js.map +1 -1
  96. package/dist/mcp.js +42 -43
  97. package/dist/mcp.js.map +1 -1
  98. package/dist/memo-T5ZQEXEA.js +17 -0
  99. package/dist/{model-bundle-LFLRW2SI.js → model-bundle-UJRQPYUU.js} +5 -5
  100. package/dist/{models-UGOWUUAL.js → models-64YLAWTI.js} +5 -5
  101. package/dist/{parse-worker-v2-LCCTZWPT.js → parse-worker-v2-QWQZKFQO.js} +26 -24
  102. package/dist/parse-worker-v2-QWQZKFQO.js.map +1 -0
  103. package/dist/{parser-JAL2OOOL.js → parser-JPWANPLM.js} +428 -42
  104. package/dist/parser-JPWANPLM.js.map +1 -0
  105. package/dist/{parser-RE52HQXO.cjs → parser-RB6CBNAM.cjs} +720 -334
  106. package/dist/parser-RB6CBNAM.cjs.map +1 -0
  107. package/dist/{parser-J56FGU6P.js → parser-XFU3VRWM.js} +431 -45
  108. package/dist/parser-XFU3VRWM.js.map +1 -0
  109. package/dist/pdf-ocr-NOJHEH4M.cjs +42 -0
  110. package/dist/{pdf-ocr-5O336TCR.cjs.map → pdf-ocr-NOJHEH4M.cjs.map} +1 -1
  111. package/dist/{pdf-ocr-PQZZVFI5.js → pdf-ocr-XTZZEYKJ.js} +6 -6
  112. package/dist/{pdf-ocr-NQ3HAL77.js → pdf-ocr-ZV3KYIIE.js} +9 -9
  113. package/dist/{profile-io-K22CB2ZB.js → profile-io-FAJORRD2.js} +3 -3
  114. package/dist/{rasterize-A6B5K4QN.js → rasterize-4ZJUA2DZ.js} +3 -3
  115. package/dist/{redact-doc-TPXMML5Q.js → redact-doc-JPNROEH6.js} +30 -30
  116. package/dist/{render-ROFIMWW5.js → render-D4WBOBKI.js} +13 -13
  117. package/dist/{rewrite-fallback-WG7Z3LR3.js → rewrite-fallback-OF3QI6CX.js} +14 -14
  118. package/dist/seal-DQWEHIAM.js +16 -0
  119. package/dist/{setup-J5SHDFIE.js → setup-YC25YCQB.js} +3 -3
  120. package/dist/to-hwpx-D7OMPDUQ.js +21 -0
  121. package/dist/to-hwpx-LUA6F5RR.cjs +16 -0
  122. package/dist/{to-hwpx-RWDQB3T2.cjs.map → to-hwpx-LUA6F5RR.cjs.map} +1 -1
  123. package/dist/{to-hwpx-X7JE6YJB.js → to-hwpx-ZWN64NCQ.js} +5 -5
  124. package/dist/visual-SW7NPY6K.js +37 -0
  125. package/dist/{watch-WZBW6UE7.js → watch-ZU576VSR.js} +24 -24
  126. package/package.json +3 -2
  127. package/dist/chunk-3CWVQNFL.cjs.map +0 -1
  128. package/dist/chunk-4MNRUPS5.js.map +0 -1
  129. package/dist/chunk-A67OXFXM.js.map +0 -1
  130. package/dist/chunk-AYM7XTI2.js +0 -31
  131. package/dist/chunk-AYM7XTI2.js.map +0 -1
  132. package/dist/chunk-CQ33HCSU.js +0 -32
  133. package/dist/chunk-CQ33HCSU.js.map +0 -1
  134. package/dist/chunk-IPXFIH5E.js.map +0 -1
  135. package/dist/chunk-KSE5HSU3.js.map +0 -1
  136. package/dist/chunk-LMHE4HDR.cjs.map +0 -1
  137. package/dist/chunk-OAKJNKAS.js.map +0 -1
  138. package/dist/chunk-PM46GSMV.js.map +0 -1
  139. package/dist/chunk-Q3UCWUEV.js.map +0 -1
  140. package/dist/chunk-SQ5Q4Q3R.js.map +0 -1
  141. package/dist/chunk-U556XJW6.js.map +0 -1
  142. package/dist/chunk-UFY6XX4U.cjs.map +0 -1
  143. package/dist/chunk-VKVDMH7X.js.map +0 -1
  144. package/dist/chunk-WAFJUSUF.cjs.map +0 -1
  145. package/dist/chunk-WPLAEJU5.cjs +0 -31
  146. package/dist/chunk-WPLAEJU5.cjs.map +0 -1
  147. package/dist/chunk-X7RBVVDC.cjs.map +0 -1
  148. package/dist/chunk-Z5TDZDWU.js.map +0 -1
  149. package/dist/chunks-SHXTE5HM.js +0 -11
  150. package/dist/generator-E4VQKPRP.js +0 -10
  151. package/dist/generator-MBR4V3JQ.js +0 -17
  152. package/dist/generator-U2BRFTJ4.cjs +0 -11
  153. package/dist/hancom-7SU4XBXJ.js +0 -84
  154. package/dist/hancom-7SU4XBXJ.js.map +0 -1
  155. package/dist/hancom-MP7D7HWW.cjs +0 -85
  156. package/dist/hancom-MP7D7HWW.cjs.map +0 -1
  157. package/dist/hancom-RNJWH63M.js +0 -85
  158. package/dist/hancom-RNJWH63M.js.map +0 -1
  159. package/dist/image-ocr-2WSZULNO.js.map +0 -1
  160. package/dist/image-ocr-COBRSG6O.js.map +0 -1
  161. package/dist/image-ocr-MVOSHIY5.cjs.map +0 -1
  162. package/dist/memo-QJ5RKTBN.js +0 -17
  163. package/dist/parse-worker-v2-LCCTZWPT.js.map +0 -1
  164. package/dist/parser-J56FGU6P.js.map +0 -1
  165. package/dist/parser-JAL2OOOL.js.map +0 -1
  166. package/dist/parser-RE52HQXO.cjs.map +0 -1
  167. package/dist/pdf-ocr-5O336TCR.cjs +0 -42
  168. package/dist/seal-35U76WY2.js +0 -16
  169. package/dist/to-hwpx-RWDQB3T2.cjs +0 -16
  170. package/dist/to-hwpx-XQULU2I7.js +0 -21
  171. package/dist/visual-4HRP2VIH.js +0 -37
  172. /package/dist/{-PWMZE4CC.js.map → -22V6D2US.js.map} +0 -0
  173. /package/dist/{chunk-GRQXAWNW.js.map → chunk-4MWUBTAE.js.map} +0 -0
  174. /package/dist/{chunk-TN5ZK2WN.js.map → chunk-67GSFYG7.js.map} +0 -0
  175. /package/dist/{chunk-TGLXN6VH.js.map → chunk-6BFWLS7E.js.map} +0 -0
  176. /package/dist/{chunk-T5J4GW6B.js.map → chunk-AUAJVQQK.js.map} +0 -0
  177. /package/dist/{chunk-KIVWAZKL.js.map → chunk-AXW2FMVR.js.map} +0 -0
  178. /package/dist/{chunk-LEUAWTMU.js.map → chunk-CCQMSIZQ.js.map} +0 -0
  179. /package/dist/{chunk-SUIH5LY7.js.map → chunk-DAAJO62F.js.map} +0 -0
  180. /package/dist/{chunk-56FEGA44.js.map → chunk-EYSXMDA7.js.map} +0 -0
  181. /package/dist/{chunk-HFQFCAEJ.js.map → chunk-HW7WVYBF.js.map} +0 -0
  182. /package/dist/{chunk-AB7MYMPZ.js.map → chunk-KB4ORA7M.js.map} +0 -0
  183. /package/dist/{chunk-57BKTVR5.js.map → chunk-KXHUHGMC.js.map} +0 -0
  184. /package/dist/{chunk-YLYSJSEP.js.map → chunk-L3JP55ZY.js.map} +0 -0
  185. /package/dist/{chunk-BO2IJGNZ.js.map → chunk-LOSCIAHY.js.map} +0 -0
  186. /package/dist/{chunk-MOWJOFIH.js.map → chunk-MIJTZKWF.js.map} +0 -0
  187. /package/dist/{chunk-HMD35PMD.js.map → chunk-OAETOHH3.js.map} +0 -0
  188. /package/dist/{chunk-IWC6PTMT.js.map → chunk-PMGJQWSW.js.map} +0 -0
  189. /package/dist/{chunk-NYIJU4Q6.js.map → chunk-Q7FDPJUS.js.map} +0 -0
  190. /package/dist/{chunk-FI7ULBC6.js.map → chunk-R2RLNUNK.js.map} +0 -0
  191. /package/dist/{chunk-AO3YFJVW.js.map → chunk-RQLEGKEV.js.map} +0 -0
  192. /package/dist/{chunk-FOTG4MMD.js.map → chunk-UU54HN5I.js.map} +0 -0
  193. /package/dist/{chunk-BP5GDQBT.js.map → chunk-VMOUAWGD.js.map} +0 -0
  194. /package/dist/{chunk-2VXVBB5Q.js.map → chunk-WLFZOBZR.js.map} +0 -0
  195. /package/dist/{chunk-VL43TUO6.js.map → chunk-Y6QW3FJQ.js.map} +0 -0
  196. /package/dist/{chunks-SHXTE5HM.js.map → chunks-Q7242OJE.js.map} +0 -0
  197. /package/dist/{formula-W5MTLANP.js.map → formula-BYEDWWZU.js.map} +0 -0
  198. /package/dist/{formula-2BQBGPM2.js.map → formula-FQLMMBDP.js.map} +0 -0
  199. /package/dist/{generator-E4VQKPRP.js.map → generator-Q3L7RNUY.js.map} +0 -0
  200. /package/dist/{generator-MBR4V3JQ.js.map → generator-SU73HZHR.js.map} +0 -0
  201. /package/dist/{memo-QJ5RKTBN.js.map → memo-T5ZQEXEA.js.map} +0 -0
  202. /package/dist/{model-bundle-LFLRW2SI.js.map → model-bundle-UJRQPYUU.js.map} +0 -0
  203. /package/dist/{models-UGOWUUAL.js.map → models-64YLAWTI.js.map} +0 -0
  204. /package/dist/{pdf-ocr-NQ3HAL77.js.map → pdf-ocr-XTZZEYKJ.js.map} +0 -0
  205. /package/dist/{pdf-ocr-PQZZVFI5.js.map → pdf-ocr-ZV3KYIIE.js.map} +0 -0
  206. /package/dist/{profile-io-K22CB2ZB.js.map → profile-io-FAJORRD2.js.map} +0 -0
  207. /package/dist/{rasterize-A6B5K4QN.js.map → rasterize-4ZJUA2DZ.js.map} +0 -0
  208. /package/dist/{redact-doc-TPXMML5Q.js.map → redact-doc-JPNROEH6.js.map} +0 -0
  209. /package/dist/{render-ROFIMWW5.js.map → render-D4WBOBKI.js.map} +0 -0
  210. /package/dist/{rewrite-fallback-WG7Z3LR3.js.map → rewrite-fallback-OF3QI6CX.js.map} +0 -0
  211. /package/dist/{seal-35U76WY2.js.map → seal-DQWEHIAM.js.map} +0 -0
  212. /package/dist/{setup-J5SHDFIE.js.map → setup-YC25YCQB.js.map} +0 -0
  213. /package/dist/{to-hwpx-X7JE6YJB.js.map → to-hwpx-D7OMPDUQ.js.map} +0 -0
  214. /package/dist/{to-hwpx-XQULU2I7.js.map → to-hwpx-ZWN64NCQ.js.map} +0 -0
  215. /package/dist/{visual-4HRP2VIH.js.map → visual-SW7NPY6K.js.map} +0 -0
  216. /package/dist/{watch-WZBW6UE7.js.map → watch-ZU576VSR.js.map} +0 -0
@@ -37,7 +37,7 @@
37
37
 
38
38
 
39
39
 
40
- var _chunkUFY6XX4Ucjs = require('./chunk-UFY6XX4U.cjs');
40
+ var _chunkUBY2PLKRcjs = require('./chunk-UBY2PLKR.cjs');
41
41
 
42
42
 
43
43
  var _chunkMMK32GPDcjs = require('./chunk-MMK32GPD.cjs');
@@ -47,7 +47,7 @@ var _chunkTK3FDAEEcjs = require('./chunk-TK3FDAEE.cjs');
47
47
 
48
48
 
49
49
 
50
- var _chunkBKK2SMVMcjs = require('./chunk-BKK2SMVM.cjs');
50
+ var _chunkPW7MQZI4cjs = require('./chunk-PW7MQZI4.cjs');
51
51
 
52
52
  // src/ocr/ocr-stacked-rows.ts
53
53
  var NUMERIC = /^[-+−△▲▽▼]?[\d.,]+[%p]?$|^[-–—·∼~]$|^\([-+−△▲▽▼]?[\d.,]+%?\)$/;
@@ -389,7 +389,8 @@ function detectRulingLines(rgba, width, height, scale) {
389
389
  for (const f of frames) {
390
390
  const innerH = hs.filter((h) => h.y1 > f.y1 + tol && h.y1 < f.y2 - tol && Math.abs(h.x1 - f.x1) <= tol && Math.abs(h.x2 - f.x2) <= tol);
391
391
  const innerV = vs.filter((v) => v.x1 > f.x1 + tol && v.x1 < f.x2 - tol && Math.abs(v.y1 - f.y1) <= tol && Math.abs(v.y2 - f.y2) <= tol);
392
- if (innerH.length < 3 || innerV.length < 1) continue;
392
+ const darkV = inkV.some((v) => v.x1 > f.x1 + tol && v.x1 < f.x2 - tol && v.y1 <= f.y1 + tol && v.y2 >= f.y2 - tol);
393
+ if (innerH.length < 3 || innerV.length < 1 && !darkV) continue;
393
394
  for (const h of innerH) if (!horizontals.some((p) => Math.abs(p.y1 - h.y1) <= tol && p.x1 <= h.x1 + tol && p.x2 >= h.x2 - tol)) horizontals.push(h);
394
395
  for (const v of innerV) if (!verticals.some((p) => Math.abs(p.x1 - v.x1) <= tol && p.y1 <= v.y1 + tol && p.y2 >= v.y2 - tol)) {
395
396
  verticals.push(v);
@@ -627,8 +628,8 @@ var INKLESS_DELTA = 32;
627
628
  function ringAsks(rgba, pageW, box, text, steps, stepPx) {
628
629
  const chars = [...text];
629
630
  if (chars.length !== steps.length || !/[가-힣]/.test(text)) return [];
630
- const gray = _chunkUFY6XX4Ucjs.grayCrop.call(void 0, rgba, pageW, box);
631
- const rings = _chunkUFY6XX4Ucjs.ringBoxes.call(void 0, gray, box.w, box.h, _chunkUFY6XX4Ucjs.inkStats.call(void 0, gray));
631
+ const gray = _chunkUBY2PLKRcjs.grayCrop.call(void 0, rgba, pageW, box);
632
+ const rings = _chunkUBY2PLKRcjs.ringBoxes.call(void 0, gray, box.w, box.h, _chunkUBY2PLKRcjs.inkStats.call(void 0, gray));
632
633
  const owner = ringOwners(chars, (i) => (steps[i] + 0.5) * stepPx, rings);
633
634
  return rings.flatMap((r, k) => {
634
635
  const at = owner.indexOf(k);
@@ -668,8 +669,8 @@ function ringGlyph(read, jamo = null, confidence = 1) {
668
669
  function restoreGlyphs(rgba, pageW, box, text, steps, stepPx, note = {}, rings = []) {
669
670
  const chars = [...text];
670
671
  if (chars.length !== steps.length) return text;
671
- const gray = _chunkUFY6XX4Ucjs.grayCrop.call(void 0, rgba, pageW, box);
672
- const c = { chars, cx: (i) => (steps[i] + 0.5) * stepPx, gray, w: box.w, h: box.h, ink: _chunkUFY6XX4Ucjs.inkStats.call(void 0, gray) };
672
+ const gray = _chunkUBY2PLKRcjs.grayCrop.call(void 0, rgba, pageW, box);
673
+ const c = { chars, cx: (i) => (steps[i] + 0.5) * stepPx, gray, w: box.w, h: box.h, ink: _chunkUBY2PLKRcjs.inkStats.call(void 0, gray) };
673
674
  if (/[[\]]/.test(text)) brackets(c);
674
675
  if (text.includes("'")) cornerQuotes(c);
675
676
  if (/['"]/.test(text)) quotes(c);
@@ -699,7 +700,7 @@ function restoreGlyphs(rgba, pageW, box, text, steps, stepPx, note = {}, rings =
699
700
  function trimInklessEnds(rgba, pageW, box, text, steps, stepPx) {
700
701
  const chars = [...text], { w, h } = box;
701
702
  if (chars.length !== steps.length || steps.some((s) => (s + 0.5) * stepPx > w + stepPx)) return { text, steps };
702
- const gray = _chunkUFY6XX4Ucjs.grayCrop.call(void 0, rgba, pageW, box);
703
+ const gray = _chunkUBY2PLKRcjs.grayCrop.call(void 0, rgba, pageW, box);
703
704
  const hist = new Uint32Array(256);
704
705
  for (const v of gray) hist[v]++;
705
706
  let bg = 0;
@@ -730,8 +731,8 @@ function cornerCommas({ chars, cx, gray, w, h, ink }) {
730
731
  continue;
731
732
  }
732
733
  if (open > 0) {
733
- const f = _chunkUFY6XX4Ucjs.bracketFeatures.call(void 0, gray, w, h, ink, cx(i));
734
- if (f && _chunkUFY6XX4Ucjs.bracketShape.call(void 0, f, true) === "\u300D") {
734
+ const f = _chunkUBY2PLKRcjs.bracketFeatures.call(void 0, gray, w, h, ink, cx(i));
735
+ if (f && _chunkUBY2PLKRcjs.bracketShape.call(void 0, f, true) === "\u300D") {
735
736
  chars[i] = "\u300D";
736
737
  open--;
737
738
  }
@@ -741,12 +742,12 @@ function cornerCommas({ chars, cx, gray, w, h, ink }) {
741
742
  function cornerQuotes({ chars, cx, gray, w, h, ink }) {
742
743
  for (let i = 0; i < chars.length; i++) {
743
744
  if (chars[i] !== "'" || !/^[가-힣]/.test(_nullishCoalesce(chars[i + 1], () => ( "")))) continue;
744
- const f = _chunkUFY6XX4Ucjs.bracketFeatures.call(void 0, gray, w, h, ink, cx(i));
745
- if (!f || f.ch < f.charH * 0.45 || _chunkUFY6XX4Ucjs.bracketShape.call(void 0, f, false) !== "\u300C") continue;
745
+ const f = _chunkUBY2PLKRcjs.bracketFeatures.call(void 0, gray, w, h, ink, cx(i));
746
+ if (!f || f.ch < f.charH * 0.45 || _chunkUBY2PLKRcjs.bracketShape.call(void 0, f, false) !== "\u300C") continue;
746
747
  const rest = chars.slice(i + 1), end = rest.findIndex((c) => c === "'" || c === "\u300D" || c === ",");
747
748
  const pair = end >= 0 && rest[end] !== "'" && (rest[end] === "\u300D" || (() => {
748
- const g = _chunkUFY6XX4Ucjs.bracketFeatures.call(void 0, gray, w, h, ink, cx(i + 1 + end));
749
- return !!g && _chunkUFY6XX4Ucjs.bracketShape.call(void 0, g, true) === "\u300D";
749
+ const g = _chunkUBY2PLKRcjs.bracketFeatures.call(void 0, gray, w, h, ink, cx(i + 1 + end));
750
+ return !!g && _chunkUBY2PLKRcjs.bracketShape.call(void 0, g, true) === "\u300D";
750
751
  })());
751
752
  if (pair) chars[i] = "\u300C";
752
753
  }
@@ -754,8 +755,8 @@ function cornerQuotes({ chars, cx, gray, w, h, ink }) {
754
755
  function brackets({ chars, cx, gray, w, h, ink }) {
755
756
  const shape = chars.map((c, i) => {
756
757
  if (c !== "[" && c !== "]") return null;
757
- const f = _chunkUFY6XX4Ucjs.bracketFeatures.call(void 0, gray, w, h, ink, cx(i));
758
- return f && _chunkUFY6XX4Ucjs.bracketShape.call(void 0, f, c === "]");
758
+ const f = _chunkUBY2PLKRcjs.bracketFeatures.call(void 0, gray, w, h, ink, cx(i));
759
+ return f && _chunkUBY2PLKRcjs.bracketShape.call(void 0, f, c === "]");
759
760
  });
760
761
  for (let i = 0; i < chars.length; i++) {
761
762
  if (chars[i] !== "[") continue;
@@ -787,7 +788,7 @@ function quotes({ chars, cx, gray, w, h, ink }) {
787
788
  continue;
788
789
  }
789
790
  if (!year(i) && !single[kind]) continue;
790
- const r = _chunkUFY6XX4Ucjs.quoteHead.call(void 0, gray, w, h, ink, cx(i));
791
+ const r = _chunkUBY2PLKRcjs.quoteHead.call(void 0, gray, w, h, ink, cx(i));
791
792
  if (r !== null && r >= 0.47) {
792
793
  chars[i] = kind === "'" ? "\u2018" : "\u201C";
793
794
  open[kind] = true;
@@ -798,7 +799,7 @@ function dashes({ chars, cx, gray, w, h, ink }) {
798
799
  const head = chars.findIndex((c) => c.trim()), letters = chars.some((c) => /[가-힣A-Za-z]/.test(c));
799
800
  for (let i = 0; i < chars.length; i++) {
800
801
  if (!/^[-\u2013\u2014]$/.test(chars[i])) continue;
801
- const r = _chunkUFY6XX4Ucjs.dashRatio.call(void 0, gray, w, h, ink, cx(i));
802
+ const r = _chunkUBY2PLKRcjs.dashRatio.call(void 0, gray, w, h, ink, cx(i));
802
803
  if (r === null) continue;
803
804
  if (r < 0.65) chars[i] = "-";
804
805
  else if (r > 0.75 && i === head && letters) chars[i] = "\u2014";
@@ -808,7 +809,7 @@ function circled({ chars, cx, gray, w, h, ink }) {
808
809
  const alone = (re, i) => re.test(chars[i]) && !re.test(_nullishCoalesce(chars[i - 1], () => ( ""))) && !re.test(_nullishCoalesce(chars[i + 1], () => ( "")));
809
810
  const at = chars.flatMap((_, i) => alone(/^\d$/, i) && chars[i] !== "0" || alone(/^[ㄱ-ㅎ]$/, i) || alone(/^[A-Za-z]$/, i) && /[a-zCSUVWXZ]/.test(chars[i]) ? [i] : []);
810
811
  if (!at.length) return;
811
- const hit = _chunkUFY6XX4Ucjs.circledAt.call(void 0, gray, w, h, ink, at.map(cx));
812
+ const hit = _chunkUBY2PLKRcjs.circledAt.call(void 0, gray, w, h, ink, at.map(cx));
812
813
  const JAMO = "\u3131\u3134\u3137\u3139\u3141\u3142\u3145\u3147\u3148\u314A\u314B\u314C\u314D\u314E";
813
814
  at.forEach((i, k) => {
814
815
  if (!hit[k]) return;
@@ -821,16 +822,16 @@ function stars({ chars, cx, gray, w, h, ink }) {
821
822
  if (chars[i] !== "*" || chars[i - 1] === "*") continue;
822
823
  let e = i;
823
824
  while (chars[e + 1] === "*") e++;
824
- const n = _chunkUFY6XX4Ucjs.starRun.call(void 0, gray, w, h, ink, cx(i));
825
+ const n = _chunkUBY2PLKRcjs.starRun.call(void 0, gray, w, h, ink, cx(i));
825
826
  if (n > e - i + 1 && n <= 4) chars[e] += "*".repeat(n - (e - i + 1));
826
827
  i = e;
827
828
  }
828
829
  }
829
830
  function discs({ chars, cx, gray, w, h, ink }) {
830
- for (let i = 0; i < chars.length; i++) if (/^[\u00b7\u2022]$/.test(chars[i]) && _chunkUFY6XX4Ucjs.discAt.call(void 0, gray, w, h, ink, cx(i))) chars[i] = "\u25CF";
831
+ for (let i = 0; i < chars.length; i++) if (/^[\u00b7\u2022]$/.test(chars[i]) && _chunkUBY2PLKRcjs.discAt.call(void 0, gray, w, h, ink, cx(i))) chars[i] = "\u25CF";
831
832
  }
832
833
  function gaps({ chars, cx, gray, w, h, ink }) {
833
- const { glyphs, bandH } = _chunkUFY6XX4Ucjs.gapGlyphs.call(void 0, gray, w, h, ink);
834
+ const { glyphs, bandH } = _chunkUBY2PLKRcjs.gapGlyphs.call(void 0, gray, w, h, ink);
834
835
  if (!glyphs.length) return;
835
836
  const live = chars.map((c, i) => i).filter((i) => chars[i].trim());
836
837
  if (!live.length) return;
@@ -901,18 +902,18 @@ function ring({ chars, cx, gray, w, h, ink }) {
901
902
  const rest = chars.slice(k + 1).join("").trimStart();
902
903
  const live = chars.map((c, i) => i).filter((i) => chars[i].trim());
903
904
  if (live.length <= 3 && live.every((i) => /^[Oo]$/.test(chars[i]))) {
904
- if (_optionalChain([_chunkUFY6XX4Ucjs.leadingBullet.call(void 0, gray, w, h, ink, cx(live[0])), 'optionalAccess', _11 => _11.mark]) === "\u25CE") return false;
905
- if (!live.every((i) => _chunkUFY6XX4Ucjs.ringBullet.call(void 0, gray, w, h, ink, cx(i)) === "\u25CB")) return false;
905
+ if (_optionalChain([_chunkUBY2PLKRcjs.leadingBullet.call(void 0, gray, w, h, ink, cx(live[0])), 'optionalAccess', _11 => _11.mark]) === "\u25CE") return false;
906
+ if (!live.every((i) => _chunkUBY2PLKRcjs.ringBullet.call(void 0, gray, w, h, ink, cx(i)) === "\u25CB")) return false;
906
907
  for (const i of live) chars[i] = "\u25CB";
907
908
  return true;
908
909
  }
909
910
  if (/^[A-Z]{2,}/.test(rest) && /^[Oo0]$/.test(chars[k])) {
910
- if (_chunkUFY6XX4Ucjs.ringBullet.call(void 0, gray, w, h, ink, cx(k)) !== "\u25CB") return false;
911
+ if (_chunkUBY2PLKRcjs.ringBullet.call(void 0, gray, w, h, ink, cx(k)) !== "\u25CB") return false;
911
912
  chars[k] = chars[k + 1] === " " ? "\u25CB" : "\u25CB ";
912
913
  return true;
913
914
  }
914
915
  if (!/^[(\[「【<]?\d*[가-힣]/.test(rest)) return false;
915
- const r = _chunkUFY6XX4Ucjs.ringBullet.call(void 0, gray, w, h, ink, cx(k));
916
+ const r = _chunkUBY2PLKRcjs.ringBullet.call(void 0, gray, w, h, ink, cx(k));
916
917
  if (/^[Cc]$/.test(chars[k]) && r !== "\u25CB") return false;
917
918
  if (r) chars[k] = r;
918
919
  return r !== null;
@@ -929,7 +930,7 @@ function parallels({ chars, cx, gray, w, h, ink }) {
929
930
  let p = s - 1, q = e + 1;
930
931
  while (p >= 0 && !chars[p].trim()) p--;
931
932
  while (q < chars.length && !chars[q].trim()) q++;
932
- if (_chunkUFY6XX4Ucjs.slantedPair.call(void 0, gray, w, h, ink, p >= 0 ? cx(p) : -Infinity, q < chars.length ? cx(q) : Infinity)) {
933
+ if (_chunkUBY2PLKRcjs.slantedPair.call(void 0, gray, w, h, ink, p >= 0 ? cx(p) : -Infinity, q < chars.length ? cx(q) : Infinity)) {
933
934
  chars[s] = "\u2225";
934
935
  for (let k = s + 1; k <= e; k++) chars[k] = "";
935
936
  }
@@ -941,7 +942,7 @@ function roman({ chars, cx, gray, w, h, ink }) {
941
942
  const ROMAN = /^[IⅠ-Ⅲ]$/, LATIN = /[A-Za-z]$/;
942
943
  for (let i = 0; i < chars.length; i++) {
943
944
  if (chars[i] !== "1" || /[\dA-Za-z]$/.test(_nullishCoalesce(chars[i - 1], () => ( ""))) || /^[\dA-Za-z,]/.test(_nullishCoalesce(chars[i + 1], () => ( "")))) continue;
944
- if (_chunkUFY6XX4Ucjs.serifOne.call(void 0, gray, w, h, ink, cx(i))) chars[i] = "\u2160";
945
+ if (_chunkUBY2PLKRcjs.serifOne.call(void 0, gray, w, h, ink, cx(i))) chars[i] = "\u2160";
945
946
  }
946
947
  for (let i = 0; i < chars.length; i++) {
947
948
  const hangul = /^[파피]$/.test(chars[i]);
@@ -951,13 +952,13 @@ function roman({ chars, cx, gray, w, h, ink }) {
951
952
  while (q < chars.length && !chars[q].trim()) q++;
952
953
  const glued = hangul ? chars[p] === "(" && chars[q] === "-" : /[가-힣]$/.test(_nullishCoalesce(chars[i - 1], () => ( ""))) || (_nullishCoalesce(chars[i + 1], () => ( ""))) === "." || chars[p] === "-" && chars[q] === "-";
953
954
  if (!glued) continue;
954
- const n = _chunkUFY6XX4Ucjs.romanStems.call(void 0, gray, w, h, ink, p >= 0 ? cx(p) : -Infinity, q < chars.length ? cx(q) : Infinity, /[가-힣]$/.test(_nullishCoalesce(chars[p], () => ( ""))));
955
+ const n = _chunkUBY2PLKRcjs.romanStems.call(void 0, gray, w, h, ink, p >= 0 ? cx(p) : -Infinity, q < chars.length ? cx(q) : Infinity, /[가-힣]$/.test(_nullishCoalesce(chars[p], () => ( ""))));
955
956
  if (n) chars[i] = String.fromCharCode(8543 + n);
956
957
  }
957
958
  const inRoman = (i) => ROMAN.test(chars[i]) || chars[i] === "1" && (ROMAN.test(_nullishCoalesce(chars[i - 1], () => ( ""))) || ROMAN.test(_nullishCoalesce(chars[i + 1], () => ( ""))));
958
959
  const k = chars.findIndex((c) => c.trim());
959
960
  if (chars[k] === "." && chars.slice(k + 1).some((c) => /[가-힣A-Za-z0-9]/.test(c))) {
960
- const n = _chunkUFY6XX4Ucjs.romanStems.call(void 0, gray, w, h, ink, -Infinity, cx(k));
961
+ const n = _chunkUBY2PLKRcjs.romanStems.call(void 0, gray, w, h, ink, -Infinity, cx(k));
961
962
  if (n) chars[k] = String.fromCharCode(8543 + n) + chars[k];
962
963
  }
963
964
  for (let s = 0; s < chars.length; ) {
@@ -975,7 +976,7 @@ function roman({ chars, cx, gray, w, h, ink }) {
975
976
  let p = s - 1, q = e;
976
977
  while (p >= 0 && !chars[p].trim()) p--;
977
978
  while (q < chars.length && !chars[q].trim()) q++;
978
- const n = _chunkUFY6XX4Ucjs.romanStems.call(void 0, gray, w, h, ink, p >= 0 ? cx(p) : -Infinity, q < chars.length ? cx(q) : Infinity, /[가-힣]$/.test(_nullishCoalesce(chars[p], () => ( ""))));
979
+ const n = _chunkUBY2PLKRcjs.romanStems.call(void 0, gray, w, h, ink, p >= 0 ? cx(p) : -Infinity, q < chars.length ? cx(q) : Infinity, /[가-힣]$/.test(_nullishCoalesce(chars[p], () => ( ""))));
979
980
  const canon = n ? [["\u2160", "I"], ["\u2161", "II"], ["\u2162", "III"]][n - 1] : null;
980
981
  if (canon && !canon.includes(tok)) {
981
982
  chars[s] = canon[0];
@@ -1388,8 +1389,8 @@ function joinGapLeaders(rgba, width, items) {
1388
1389
  if (g1 - g0 < h * 3) continue;
1389
1390
  const pad = Math.round(h * 0.25), y = Math.max(0, Math.min(left.y, num.y) - pad), x = Math.max(0, Math.round(g0 - h));
1390
1391
  const box = { x, y, w: Math.min(width, Math.round(g1 + h)) - x, h: Math.min(Math.floor(rgba.length / 4 / width), Math.max(left.y + left.h, num.y + num.h) + pad) - y };
1391
- const gray = _chunkUFY6XX4Ucjs.grayCrop.call(void 0, rgba, width, box);
1392
- const runs = _chunkUFY6XX4Ucjs.leaderRuns.call(void 0, gray, box.w, box.h, _chunkUFY6XX4Ucjs.inkStats.call(void 0, gray), LEADER_MIN_DOTS);
1392
+ const gray = _chunkUBY2PLKRcjs.grayCrop.call(void 0, rgba, width, box);
1393
+ const runs = _chunkUBY2PLKRcjs.leaderRuns.call(void 0, gray, box.w, box.h, _chunkUBY2PLKRcjs.inkStats.call(void 0, gray), LEADER_MIN_DOTS);
1393
1394
  const cover = runs.reduce((k, [a, b]) => k + Math.max(0, Math.min(b, g1 - box.x) - Math.max(a, g0 - box.x)), 0);
1394
1395
  if (cover < (g1 - g0) * 0.6) continue;
1395
1396
  for (const o of items) if (junk(o) && sameLine(o, num) && o.x >= g0 - 2 && o.x + o.w <= g1 + 2) gone.add(o);
@@ -1656,7 +1657,7 @@ var OcrEngine = class _OcrEngine {
1656
1657
  this.ort = parts.ort;
1657
1658
  this.sharp = parts.sharp;
1658
1659
  }
1659
- static async create(models = _chunkUFY6XX4Ucjs.DEFAULT_OCR_MODELS) {
1660
+ static async create(models = _chunkUBY2PLKRcjs.DEFAULT_OCR_MODELS) {
1660
1661
  _chunkTK3FDAEEcjs.disableOrtTelemetry.call(void 0, );
1661
1662
  const [ortMod, sharpModRaw] = await Promise.all([
1662
1663
  tryImport("onnxruntime-node", () => Promise.resolve().then(() => _interopRequireWildcard(require("onnxruntime-node")))),
@@ -1676,16 +1677,16 @@ var OcrEngine = class _OcrEngine {
1676
1677
  const local = (s) => "spec" in s ? Promise.resolve(null) : verifiedBytes(s);
1677
1678
  const [detBytes, recBytes, dictBytes] = await Promise.all([local(models.det), local(models.rec), local(models.dict)]);
1678
1679
  const session = (s, bytes) => bytes ? ortMod.InferenceSession.create(bytes, sessionOpts).catch(() => {
1679
- throw new (0, _chunkBKK2SMVMcjs.KordocError)(`OCR \uBAA8\uB378\uC744 \uC5F4\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: ${_path.basename.call(void 0, _chunkUFY6XX4Ucjs.ocrSourcePath.call(void 0, s))} \u2014 ONNX \uBAA8\uB378\uC774 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB410\uC2B5\uB2C8\uB2E4`);
1680
- }) : ortMod.InferenceSession.create(_chunkUFY6XX4Ucjs.ocrSourcePath.call(void 0, s), sessionOpts);
1680
+ throw new (0, _chunkPW7MQZI4cjs.KordocError)(`OCR \uBAA8\uB378\uC744 \uC5F4\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: ${_path.basename.call(void 0, _chunkUBY2PLKRcjs.ocrSourcePath.call(void 0, s))} \u2014 ONNX \uBAA8\uB378\uC774 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB410\uC2B5\uB2C8\uB2E4`);
1681
+ }) : ortMod.InferenceSession.create(_chunkUBY2PLKRcjs.ocrSourcePath.call(void 0, s), sessionOpts);
1681
1682
  const [det, rec, dictYml] = await Promise.all([
1682
1683
  session(models.det, detBytes),
1683
1684
  session(models.rec, recBytes),
1684
- dictBytes ? new TextDecoder().decode(dictBytes) : _promises.readFile.call(void 0, _chunkUFY6XX4Ucjs.ocrSourcePath.call(void 0, models.dict), "utf-8")
1685
+ dictBytes ? new TextDecoder().decode(dictBytes) : _promises.readFile.call(void 0, _chunkUBY2PLKRcjs.ocrSourcePath.call(void 0, models.dict), "utf-8")
1685
1686
  ]);
1686
- const dict = _chunkUFY6XX4Ucjs.parseCharacterDict.call(void 0, dictYml);
1687
+ const dict = _chunkUBY2PLKRcjs.parseCharacterDict.call(void 0, dictYml);
1687
1688
  if (dict.length === 0) {
1688
- throw "spec" in models.dict ? new Error("OCR \uC0AC\uC804 \uD30C\uC2F1 \uC2E4\uD328 \u2014 \uBAA8\uB378 \uCE90\uC2DC\uB97C \uC0AD\uC81C \uD6C4 \uC7AC\uB2E4\uC6B4\uB85C\uB4DC\uD558\uC138\uC694") : new (0, _chunkBKK2SMVMcjs.KordocError)(`OCR \uC0AC\uC804 \uD30C\uC2F1 \uC2E4\uD328 \u2014 ${_path.basename.call(void 0, models.dict.file.path)} \uC5D0 PostProcess.character_dict \uBAA9\uB85D\uC774 \uC5C6\uC2B5\uB2C8\uB2E4`);
1689
+ throw "spec" in models.dict ? new Error("OCR \uC0AC\uC804 \uD30C\uC2F1 \uC2E4\uD328 \u2014 \uBAA8\uB378 \uCE90\uC2DC\uB97C \uC0AD\uC81C \uD6C4 \uC7AC\uB2E4\uC6B4\uB85C\uB4DC\uD558\uC138\uC694") : new (0, _chunkPW7MQZI4cjs.KordocError)(`OCR \uC0AC\uC804 \uD30C\uC2F1 \uC2E4\uD328 \u2014 ${_path.basename.call(void 0, models.dict.file.path)} \uC5D0 PostProcess.character_dict \uBAA9\uB85D\uC774 \uC5C6\uC2B5\uB2C8\uB2E4`);
1689
1690
  }
1690
1691
  return new _OcrEngine({ det, rec, dict, ort: ortMod, sharp: sharpMod });
1691
1692
  }
@@ -1717,10 +1718,10 @@ var OcrEngine = class _OcrEngine {
1717
1718
  if (it.x - x < it.h * 0.8) return;
1718
1719
  if (items.some((o) => o !== it && o.x < it.x && o.x + o.w > x && o.y < it.y + it.h && o.y + o.h > it.y)) return;
1719
1720
  const box = { x, y: it.y, w: it.x + it.w - x, h: it.h };
1720
- const g = _chunkUFY6XX4Ucjs.grayCrop.call(void 0, rgba, width, box);
1721
- const b = _chunkUFY6XX4Ucjs.leadingBullet.call(void 0, g, box.w, box.h, _chunkUFY6XX4Ucjs.inkStats.call(void 0, g), it.x - x, 1.05);
1721
+ const g = _chunkUBY2PLKRcjs.grayCrop.call(void 0, rgba, width, box);
1722
+ const b = _chunkUBY2PLKRcjs.leadingBullet.call(void 0, g, box.w, box.h, _chunkUBY2PLKRcjs.inkStats.call(void 0, g), it.x - x, 1.05);
1722
1723
  if (_optionalChain([b, 'optionalAccess', _36 => _36.mark]) !== "\u25A1" || b.covers) return;
1723
- const ink = _chunkUFY6XX4Ucjs.inkStats.call(void 0, g), on = (v) => ink.darkInk ? v <= ink.threshold : v > ink.threshold;
1724
+ const ink = _chunkUBY2PLKRcjs.inkStats.call(void 0, g), on = (v) => ink.darkInk ? v <= ink.threshold : v > ink.threshold;
1724
1725
  let left = 0;
1725
1726
  while (left < it.x - x && !Array.from({ length: box.h }, (_, y) => g[y * box.w + left]).some(on)) left++;
1726
1727
  it.text = "\u25A1 " + it.text;
@@ -1752,12 +1753,12 @@ var OcrEngine = class _OcrEngine {
1752
1753
  const joins = [];
1753
1754
  let group = 0;
1754
1755
  for (const b of boxes) {
1755
- const gray = _chunkUFY6XX4Ucjs.grayCrop.call(void 0, rgba, width, b);
1756
- const ink = _chunkUFY6XX4Ucjs.inkStats.call(void 0, gray);
1756
+ const gray = _chunkUBY2PLKRcjs.grayCrop.call(void 0, rgba, width, b);
1757
+ const ink = _chunkUBY2PLKRcjs.inkStats.call(void 0, gray);
1757
1758
  if (tuning.minInkContrast > 0 && ink.contrast < tuning.minInkContrast) continue;
1758
1759
  if (tuning.minInkContrast > 0 && ink.inkRatio < MIN_INK_RATIO) continue;
1759
1760
  if (tuning.splitTall && b.h >= b.w * TALL_RATIO) {
1760
- const bands = _chunkUFY6XX4Ucjs.splitRowBands.call(void 0, gray, b.w, b.h, ink, 0.45);
1761
+ const bands = _chunkUBY2PLKRcjs.splitRowBands.call(void 0, gray, b.w, b.h, ink, 0.45);
1761
1762
  if (bands.length >= 2) {
1762
1763
  for (const sub of bandBoxes(b, bands, height)) jobs.push({ box: sub, rot: 0, group: group++ });
1763
1764
  continue;
@@ -1768,9 +1769,9 @@ var OcrEngine = class _OcrEngine {
1768
1769
  continue;
1769
1770
  }
1770
1771
  }
1771
- const trim = tuning.trimEdges ? _chunkUFY6XX4Ucjs.edgeTrim.call(void 0, gray, b.w, b.h, ink) : null;
1772
+ const trim = tuning.trimEdges ? _chunkUBY2PLKRcjs.edgeTrim.call(void 0, gray, b.w, b.h, ink) : null;
1772
1773
  const keep = trim ? { ...trim, bg: median(gray) } : void 0;
1773
- const leaders = tuning.splitLeaders ? _chunkUFY6XX4Ucjs.leaderRuns.call(void 0, gray, b.w, b.h, ink, LEADER_MIN_DOTS) : [];
1774
+ const leaders = tuning.splitLeaders ? _chunkUBY2PLKRcjs.leaderRuns.call(void 0, gray, b.w, b.h, ink, LEADER_MIN_DOTS) : [];
1774
1775
  if (leaders.length) {
1775
1776
  const join = joins.length;
1776
1777
  joins.push({ box: b, parts: [], trailDots: false });
@@ -1779,7 +1780,7 @@ var OcrEngine = class _OcrEngine {
1779
1780
  const bare = { x: b.x + x0, y: b.y, w: a - x0, h: b.h };
1780
1781
  const end = c > a ? Math.min(c, a + Math.round(b.h * LEADER_CONTEXT)) : a;
1781
1782
  x0 = c;
1782
- if (bare.w >= DET_MIN_SIZE && _chunkUFY6XX4Ucjs.inkStats.call(void 0, _chunkUFY6XX4Ucjs.grayCrop.call(void 0, rgba, width, bare)).contrast >= Math.max(1, tuning.minInkContrast)) {
1783
+ if (bare.w >= DET_MIN_SIZE && _chunkUBY2PLKRcjs.inkStats.call(void 0, _chunkUBY2PLKRcjs.grayCrop.call(void 0, rgba, width, bare)).contrast >= Math.max(1, tuning.minInkContrast)) {
1783
1784
  jobs.push({ box: { ...bare, w: end - (bare.x - b.x) }, rot: 0, group: group++, join, dotsBefore: dots, trimDots: end > a });
1784
1785
  dots = false;
1785
1786
  }
@@ -1827,15 +1828,15 @@ var OcrEngine = class _OcrEngine {
1827
1828
  let text = tuning.postprocess ? restoreSymbols(raw.trim(), note.ringLead) : raw;
1828
1829
  if (!text.trim()) continue;
1829
1830
  if (tuning.postprocess && job.rot === 0 && text !== "/" && /^[(:;/)]+$/.test(text) && text.includes("/")) {
1830
- const g = _chunkUFY6XX4Ucjs.grayCrop.call(void 0, rgba, width, job.box);
1831
- if (_chunkUFY6XX4Ucjs.tallInkCount.call(void 0, g, job.box.w, job.box.h, _chunkUFY6XX4Ucjs.inkStats.call(void 0, g)) === 1) text = "/";
1831
+ const g = _chunkUBY2PLKRcjs.grayCrop.call(void 0, rgba, width, job.box);
1832
+ if (_chunkUBY2PLKRcjs.tallInkCount.call(void 0, g, job.box.w, job.box.h, _chunkUBY2PLKRcjs.inkStats.call(void 0, g)) === 1) text = "/";
1832
1833
  }
1833
1834
  let ringByShape = false;
1834
1835
  if (tuning.postprocess && job.rot === 0 && !/^[◎●▪□■▣❐❏○ㅇ◆◇◈]/.test(text)) {
1835
1836
  const chars = [...read], k = chars.findIndex((c) => c.trim());
1836
1837
  if (k >= 0 && steps.length === chars.length) {
1837
- const g = _chunkUFY6XX4Ucjs.grayCrop.call(void 0, rgba, width, job.box);
1838
- const b = _chunkUFY6XX4Ucjs.leadingBullet.call(void 0, g, job.box.w, job.box.h, _chunkUFY6XX4Ucjs.inkStats.call(void 0, g), (steps[k] + 0.5) * stepPx);
1838
+ const g = _chunkUBY2PLKRcjs.grayCrop.call(void 0, rgba, width, job.box);
1839
+ const b = _chunkUBY2PLKRcjs.leadingBullet.call(void 0, g, job.box.w, job.box.h, _chunkUBY2PLKRcjs.inkStats.call(void 0, g), (steps[k] + 0.5) * stepPx);
1839
1840
  const body = (_nullishCoalesce(text.match(/[가-힣]/g), () => ( []))).length >= 4;
1840
1841
  const miss = /^[Oo0•·ㆍ∙‧○]/.test(text);
1841
1842
  if (_optionalChain([b, 'optionalAccess', _39 => _39.mark]) === "\u25CE" && b.covers && /^[Oo0○©]/.test(text)) {
@@ -1850,17 +1851,17 @@ var OcrEngine = class _OcrEngine {
1850
1851
  } else if (_optionalChain([b, 'optionalAccess', _46 => _46.mark]) === "\u2750" || _optionalChain([b, 'optionalAccess', _47 => _47.mark]) === "\u274F") {
1851
1852
  if (b.covers ? /^[ㅁ口]/.test(text) : body) text = b.covers ? b.mark + text.slice(1) : b.mark + " " + text;
1852
1853
  } else if (b && b.mark !== "\u25CE" && body) text = b.covers ? miss ? b.mark + " " + text.slice(1).trimStart() : text : b.mark + " " + text;
1853
- else if (!b && body && /^[가-힣]/.test(chars[k]) && _chunkUFY6XX4Ucjs.leadingRing.call(void 0, g, job.box.w, job.box.h, _chunkUFY6XX4Ucjs.inkStats.call(void 0, g), (steps[k] + 0.5) * stepPx)) text = "\u25CB " + text;
1854
+ else if (!b && body && /^[가-힣]/.test(chars[k]) && _chunkUBY2PLKRcjs.leadingRing.call(void 0, g, job.box.w, job.box.h, _chunkUBY2PLKRcjs.inkStats.call(void 0, g), (steps[k] + 0.5) * stepPx)) text = "\u25CB " + text;
1854
1855
  }
1855
1856
  }
1856
1857
  if (tuning.postprocess && /^\d/.test(text) && job.rot === 0) {
1857
- const g = _chunkUFY6XX4Ucjs.grayCrop.call(void 0, rgba, width, job.box);
1858
- const tri = _chunkUFY6XX4Ucjs.leadingTriangle.call(void 0, g, job.box.w, job.box.h, _chunkUFY6XX4Ucjs.inkStats.call(void 0, g));
1858
+ const g = _chunkUBY2PLKRcjs.grayCrop.call(void 0, rgba, width, job.box);
1859
+ const tri = _chunkUBY2PLKRcjs.leadingTriangle.call(void 0, g, job.box.w, job.box.h, _chunkUBY2PLKRcjs.inkStats.call(void 0, g));
1859
1860
  if (tri) text = tri + text;
1860
1861
  }
1861
1862
  if (tuning.postprocess && text === "\u2192" && job.rot === 0 && job.join === void 0) {
1862
- const g = _chunkUFY6XX4Ucjs.grayCrop.call(void 0, rgba, width, job.box);
1863
- text = _nullishCoalesce(_chunkUFY6XX4Ucjs.arrowGlyph.call(void 0, g, job.box.w, job.box.h, _chunkUFY6XX4Ucjs.inkStats.call(void 0, g)), () => ( text));
1863
+ const g = _chunkUBY2PLKRcjs.grayCrop.call(void 0, rgba, width, job.box);
1864
+ text = _nullishCoalesce(_chunkUBY2PLKRcjs.arrowGlyph.call(void 0, g, job.box.w, job.box.h, _chunkUBY2PLKRcjs.inkStats.call(void 0, g)), () => ( text));
1864
1865
  }
1865
1866
  if (job.footer) {
1866
1867
  if (!/^[-\u2013\u2014]?\s*(?:\d{1,4}|[ivxIVXⅰ-ⅹⅠ-Ⅹ]{1,4})\s*[-\u2013\u2014]?$/.test(text.trim())) continue;
@@ -1881,7 +1882,7 @@ var OcrEngine = class _OcrEngine {
1881
1882
  continue;
1882
1883
  }
1883
1884
  const item = { text, ...this.itemBox(rgba, width, job.box, tuning), confidence };
1884
- if (job.rot === 0) _chunkUFY6XX4Ucjs.rememberOcrTextGaps.call(void 0, item, _chunkUFY6XX4Ucjs.findOcrTextGaps.call(void 0, rgba, width, job.box, read, text, steps, stepPx));
1885
+ if (job.rot === 0) _chunkUBY2PLKRcjs.rememberOcrTextGaps.call(void 0, item, _chunkUBY2PLKRcjs.findOcrTextGaps.call(void 0, rgba, width, job.box, read, text, steps, stepPx));
1885
1886
  if (job.rot === 0 && job.keep === void 0) boxOf.set(item, job.box);
1886
1887
  items.push(item);
1887
1888
  }
@@ -1895,7 +1896,7 @@ var OcrEngine = class _OcrEngine {
1895
1896
  const merged = rereadNumberText(it.text, r.text);
1896
1897
  if (merged === null) return;
1897
1898
  it.text = merged;
1898
- _chunkUFY6XX4Ucjs.rememberOcrTextGaps.call(void 0, it, _chunkUFY6XX4Ucjs.findOcrTextGaps.call(void 0, rgba, width, boxOf.get(it), r.text, it.text, r.steps, r.stepPx));
1899
+ _chunkUBY2PLKRcjs.rememberOcrTextGaps.call(void 0, it, _chunkUBY2PLKRcjs.findOcrTextGaps.call(void 0, rgba, width, boxOf.get(it), r.text, it.text, r.steps, r.stepPx));
1899
1900
  });
1900
1901
  }
1901
1902
  const blank2 = tuning.postprocess ? jobs.filter((j) => j.rot === 0 && j.join === void 0 && !j.footer && !j.keep && !best.has(j.group)).map((j) => j.box) : [];
@@ -1903,14 +1904,14 @@ var OcrEngine = class _OcrEngine {
1903
1904
  const subs = [];
1904
1905
  const stacks = [];
1905
1906
  for (const b of [...retry, ...blank2]) {
1906
- const gray = _chunkUFY6XX4Ucjs.grayCrop.call(void 0, rgba, width, b);
1907
- const ink = _chunkUFY6XX4Ucjs.inkStats.call(void 0, gray);
1907
+ const gray = _chunkUBY2PLKRcjs.grayCrop.call(void 0, rgba, width, b);
1908
+ const ink = _chunkUBY2PLKRcjs.inkStats.call(void 0, gray);
1908
1909
  const cut = retry.includes(b) ? midBlankRow(gray, b.w, b.h, ink) : null;
1909
1910
  if (cut && b.w >= 3 * Math.max(cut[0], b.h - cut[1])) {
1910
1911
  subs.push({ ...b, h: cut[0] }, { ...b, y: b.y + cut[1], h: b.h - cut[1] });
1911
1912
  continue;
1912
1913
  }
1913
- const bands = _chunkUFY6XX4Ucjs.stackedGlyphBands.call(void 0, gray, b.w, b.h, ink);
1914
+ const bands = _chunkUBY2PLKRcjs.stackedGlyphBands.call(void 0, gray, b.w, b.h, ink);
1914
1915
  if (bands) stacks.push({ box: b, parts: bandBoxes(b, bands, height), word: bands.every((x, i) => i === 0 || x.y0 - bands[i - 1].y1 <= STACK_WORD_GAP * Math.max(x.y1 - x.y0, bands[i - 1].y1 - bands[i - 1].y0)) });
1915
1916
  }
1916
1917
  const overlap = (a, o) => Math.max(0, Math.min(a.x + a.w, o.x + o.w) - Math.max(a.x, o.x)) * Math.max(0, Math.min(a.y + a.h, o.y + o.h) - Math.max(a.y, o.y));
@@ -1983,8 +1984,8 @@ var OcrEngine = class _OcrEngine {
1983
1984
  /** 결과 좌표 — det 박스 그대로 또는 박스 안 잉크 외곽 (tightBoxes) */
1984
1985
  itemBox(rgba, width, b, tuning) {
1985
1986
  if (!tuning.tightBoxes) return b;
1986
- const gray = _chunkUFY6XX4Ucjs.grayCrop.call(void 0, rgba, width, b);
1987
- const t = _chunkUFY6XX4Ucjs.inkBounds.call(void 0, gray, b.w, b.h, _chunkUFY6XX4Ucjs.inkStats.call(void 0, gray));
1987
+ const gray = _chunkUBY2PLKRcjs.grayCrop.call(void 0, rgba, width, b);
1988
+ const t = _chunkUBY2PLKRcjs.inkBounds.call(void 0, gray, b.w, b.h, _chunkUBY2PLKRcjs.inkStats.call(void 0, gray));
1988
1989
  return { x: b.x + t.x0, y: b.y + t.y0, w: t.x1 - t.x0, h: t.y1 - t.y0 };
1989
1990
  }
1990
1991
  // ─── det ─────────────────────────────────────────────
@@ -2055,7 +2056,7 @@ var OcrEngine = class _OcrEngine {
2055
2056
  const out = await this.rec.run({ [this.rec.inputNames[0]]: tensor });
2056
2057
  const logits = out[this.rec.outputNames[0]];
2057
2058
  const [, T, C] = logits.dims;
2058
- if (C !== this.dict.length + 2) throw new (0, _chunkBKK2SMVMcjs.KordocError)(`OCR rec \uCD9C\uB825 \uD074\uB798\uC2A4 ${C}\uAC1C\uAC00 \uC0AC\uC804 ${this.dict.length}\uC790 + 2 \uC640 \uB2E4\uB985\uB2C8\uB2E4 \u2014 \uBAA8\uB378\uC5D0 \uB9DE\uB294 \uC0AC\uC804(ocrRecDict)\uC744 \uC9C0\uC815\uD558\uC138\uC694`);
2059
+ if (C !== this.dict.length + 2) throw new (0, _chunkPW7MQZI4cjs.KordocError)(`OCR rec \uCD9C\uB825 \uD074\uB798\uC2A4 ${C}\uAC1C\uAC00 \uC0AC\uC804 ${this.dict.length}\uC790 + 2 \uC640 \uB2E4\uB985\uB2C8\uB2E4 \u2014 \uBAA8\uB378\uC5D0 \uB9DE\uB294 \uC0AC\uC804(ocrRecDict)\uC744 \uC9C0\uC815\uD558\uC138\uC694`);
2059
2060
  const data = logits.data;
2060
2061
  idx.forEach((ci, k) => {
2061
2062
  const r = ctcDecode(data.subarray(k * T * C, (k + 1) * T * C), T, C, this.dict);
@@ -2065,9 +2066,9 @@ var OcrEngine = class _OcrEngine {
2065
2066
  const chars = r ? [...r.text] : [];
2066
2067
  if (r && job.rot === 0 && chars.length === r.steps.length && r.steps.some((t) => t > last) && !r.text.includes("(cid:")) {
2067
2068
  const tallCh = (c) => !/[\s.,:;\u00b7\u2026'"\u2018-\u201d`\-_~]/.test(c);
2068
- const g = _chunkUFY6XX4Ucjs.grayCrop.call(void 0, rgba, pageW, job.box);
2069
+ const g = _chunkUBY2PLKRcjs.grayCrop.call(void 0, rgba, pageW, job.box);
2069
2070
  const inside = chars.filter((c, i) => r.steps[i] <= last && tallCh(c)).length;
2070
- let budget = inside <= 2 ? _chunkUFY6XX4Ucjs.tallInkCount.call(void 0, g, job.box.w, job.box.h, _chunkUFY6XX4Ucjs.inkStats.call(void 0, g)) - inside : Infinity;
2071
+ let budget = inside <= 2 ? _chunkUBY2PLKRcjs.tallInkCount.call(void 0, g, job.box.w, job.box.h, _chunkUBY2PLKRcjs.inkStats.call(void 0, g)) - inside : Infinity;
2071
2072
  const keep = chars.map((c, i) => r.steps[i] <= last || !tallCh(c) || budget-- > 0);
2072
2073
  if (!keep.every(Boolean)) kept = { ...r, text: chars.filter((_, i) => keep[i]).join(""), steps: r.steps.filter((_, i) => keep[i]) };
2073
2074
  }
@@ -2178,13 +2179,13 @@ async function tryImport(name, loader) {
2178
2179
  return await loader();
2179
2180
  } catch (e) {
2180
2181
  throw new Error(
2181
- `\uB0B4\uC7A5 OCR \uC744 \uC0AC\uC6A9\uD558\uB824\uBA74 optional dependency '${name}' \uC774 \uD544\uC694\uD569\uB2C8\uB2E4. \`npm install ${name}\` \uD6C4 \uB2E4\uC2DC \uC2E4\uD589\uD558\uC138\uC694.${_chunkBKK2SMVMcjs.OPTIONAL_DEP_INSTALL_HINT} \uC6D0\uC778: ${e.message}`
2182
+ `\uB0B4\uC7A5 OCR \uC744 \uC0AC\uC6A9\uD558\uB824\uBA74 optional dependency '${name}' \uC774 \uD544\uC694\uD569\uB2C8\uB2E4. \`npm install ${name}\` \uD6C4 \uB2E4\uC2DC \uC2E4\uD589\uD558\uC138\uC694.${_chunkPW7MQZI4cjs.OPTIONAL_DEP_INSTALL_HINT} \uC6D0\uC778: ${e.message}`
2182
2183
  );
2183
2184
  }
2184
2185
  }
2185
2186
  async function verifiedBytes(s) {
2186
2187
  const name = _path.basename.call(void 0, s.file.path);
2187
- const fail = (why2) => new (0, _chunkBKK2SMVMcjs.KordocError)(`OCR \uBAA8\uB378 \uD30C\uC77C\uC744 \uC77D\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: ${name} (${why2})`);
2188
+ const fail = (why2) => new (0, _chunkPW7MQZI4cjs.KordocError)(`OCR \uBAA8\uB378 \uD30C\uC77C\uC744 \uC77D\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: ${name} (${why2})`);
2188
2189
  const why = (e) => {
2189
2190
  const code = e.code;
2190
2191
  return code === "ENOENT" ? "\uD30C\uC77C\uC774 \uC5C6\uC74C" : code === "EACCES" || code === "EPERM" ? "\uAD8C\uD55C \uC5C6\uC74C" : "\uC77D\uAE30 \uC2E4\uD328";
@@ -2205,13 +2206,13 @@ async function verifiedBytes(s) {
2205
2206
  }
2206
2207
  const actual = _crypto.createHash.call(void 0, "sha256").update(bytes).digest("hex");
2207
2208
  if (actual !== s.file.sha256) {
2208
- throw new (0, _chunkBKK2SMVMcjs.KordocError)(`OCR \uBAA8\uB378 SHA256 mismatch: ${_path.basename.call(void 0, s.file.path)} \u2014 expected ${s.file.sha256}, got ${actual} (\uB85C\uB4DC \uAC70\uBD80)`);
2209
+ throw new (0, _chunkPW7MQZI4cjs.KordocError)(`OCR \uBAA8\uB378 SHA256 mismatch: ${_path.basename.call(void 0, s.file.path)} \u2014 expected ${s.file.sha256}, got ${actual} (\uB85C\uB4DC \uAC70\uBD80)`);
2209
2210
  }
2210
2211
  return bytes;
2211
2212
  }
2212
2213
  var engines = /* @__PURE__ */ new Map();
2213
- function getOcrEngine(models = _chunkUFY6XX4Ucjs.DEFAULT_OCR_MODELS) {
2214
- const key = _chunkUFY6XX4Ucjs.ocrSelectionKey.call(void 0, models);
2214
+ function getOcrEngine(models = _chunkUBY2PLKRcjs.DEFAULT_OCR_MODELS) {
2215
+ const key = _chunkUBY2PLKRcjs.ocrSelectionKey.call(void 0, models);
2215
2216
  let p = engines.get(key);
2216
2217
  if (!p) {
2217
2218
  p = OcrEngine.create(models).catch((err) => {
@@ -2324,6 +2325,187 @@ function rotateRgba(rgba, width, height, deg) {
2324
2325
  return out;
2325
2326
  }
2326
2327
 
2328
+ // src/ocr/ocr-chart-axes.ts
2329
+ var NUMBER = /^-?\d+(?:\.\d+)?%?$/;
2330
+ var value = (t) => Number(t.replace(/%$/, ""));
2331
+ function evenRun(ticks) {
2332
+ let best = [];
2333
+ for (let s = 0; s + 1 < ticks.length; s++) {
2334
+ const step = ticks[s + 1].value - ticks[s].value, gap = ticks[s + 1].pos - ticks[s].pos;
2335
+ if (step === 0 || gap <= 0) continue;
2336
+ let e = s + 1;
2337
+ while (e + 1 < ticks.length) {
2338
+ const d = ticks[e + 1].pos - ticks[e].pos, v = ticks[e + 1].value - ticks[e].value;
2339
+ if (Math.abs(d - gap) > gap * 0.35 || Math.abs(v - step) > Math.abs(step) * 0.25) break;
2340
+ e++;
2341
+ }
2342
+ if (e - s + 1 > best.length) best = ticks.slice(s, e + 1);
2343
+ }
2344
+ return best;
2345
+ }
2346
+ var number = (t) => NUMBER.test(t.replace(/-$/, "").trim()) ? value(t.replace(/-$/, "").trim()) : null;
2347
+ function valueAxes(items) {
2348
+ const nums = items.filter((it) => number(it.text) !== null);
2349
+ const out = [];
2350
+ const used = /* @__PURE__ */ new Set();
2351
+ for (const seed of nums) {
2352
+ if (used.has(seed)) continue;
2353
+ const col = nums.filter((it) => Math.abs(it.x + it.w - seed.x - seed.w) <= seed.h * 0.8).sort((a, b) => a.y - b.y);
2354
+ const run = evenRun(col.map((it) => ({ pos: it.y + it.h / 2, value: number(it.text), it })));
2355
+ if (run.length < 4 || run[1].value > run[0].value) continue;
2356
+ const ticks = run.map((r) => r.it);
2357
+ for (const it of ticks) used.add(it);
2358
+ const h = ticks.reduce((a, it) => a + it.h, 0) / ticks.length;
2359
+ out.push({ x1: Math.min(...ticks.map((it) => it.x)), x2: Math.max(...ticks.map((it) => it.x + it.w)), y1: ticks[0].y, y2: ticks[ticks.length - 1].y + ticks[ticks.length - 1].h, h });
2360
+ }
2361
+ return out;
2362
+ }
2363
+ function timeAxes(items) {
2364
+ const numeric = items.filter((it) => {
2365
+ const t = it.text.trim().split(/\s+/);
2366
+ return t.length > 0 && t.every((x) => NUMBER.test(x));
2367
+ });
2368
+ const out = [];
2369
+ const used = /* @__PURE__ */ new Set();
2370
+ for (const seed of numeric) {
2371
+ if (used.has(seed)) continue;
2372
+ const row = numeric.filter((it) => Math.abs(it.y + it.h / 2 - seed.y - seed.h / 2) <= Math.min(it.h, seed.h) * 0.6).sort((a, b) => a.x - b.x);
2373
+ const ticks = row.flatMap((it) => {
2374
+ const text = it.text.trim(), per = it.w / Math.max(1, text.length);
2375
+ return [...text.matchAll(/\S+/g)].map((m) => ({ pos: it.x + (m.index + m[0].length / 2) * per, value: value(m[0]), it }));
2376
+ });
2377
+ const run = evenRun(ticks);
2378
+ if (run.length < 4 || run[1].value < run[0].value) continue;
2379
+ const boxes = [...new Set(run.map((r) => r.it))];
2380
+ for (const it of boxes) used.add(it);
2381
+ out.push({ x1: Math.min(...boxes.map((it) => it.x)), x2: Math.max(...boxes.map((it) => it.x + it.w)), y1: Math.min(...boxes.map((it) => it.y)), y2: Math.max(...boxes.map((it) => it.y + it.h)), h: seed.h });
2382
+ }
2383
+ return out;
2384
+ }
2385
+ function chartPlotItems(items) {
2386
+ const drop = /* @__PURE__ */ new Set();
2387
+ const verticals = valueAxes(items);
2388
+ if (!verticals.length) return drop;
2389
+ const horizontals = timeAxes(items);
2390
+ for (const v of verticals) {
2391
+ const hz = horizontals.find((a) => a.y1 >= v.y2 - v.h && a.y1 <= v.y2 + 5 * v.h && a.x1 >= v.x1 - v.h && a.x1 <= v.x2 + 4 * v.h && a.x2 > v.x2 + 8 * v.h);
2392
+ if (!hz) continue;
2393
+ const x1 = v.x1 - 5 * v.h, x2 = hz.x2 + 2 * v.h, y1 = v.y1 - 1.5 * v.h, y2 = hz.y2 + 2.5 * v.h;
2394
+ items.forEach((it, i) => {
2395
+ const cx = it.x + it.w / 2, cy = it.y + it.h / 2;
2396
+ if (cx >= x1 && cx <= x2 && cy >= y1 && cy <= y2 && it.x >= x1 - v.h && it.x + it.w <= x2 + v.h) drop.add(i);
2397
+ });
2398
+ }
2399
+ return drop;
2400
+ }
2401
+
2402
+ // src/ocr/ocr-contact-columns.ts
2403
+ var CONTACT = /^([가-힣](?:\s*[가-힣]){0,4})\s+([가-힣]{2,4})\s*([^가-힣\s][^가-힣]{5,48})$/;
2404
+ var PHONE = /^\(?0\d{1,3}\)?[-\s]?\d{3,4}-\d{4}\)?$/;
2405
+ var MAIL = /^\(?[\w.+-]+@[\w-]+(?:\.[\w-]+)+\)?$/;
2406
+ function contactParts(text) {
2407
+ const m = CONTACT.exec(text.trim());
2408
+ if (!m) return null;
2409
+ const contact = m[3].includes("@") ? m[3].replace(/\s+/g, "") : m[3].trim();
2410
+ return PHONE.test(contact) || MAIL.test(contact) ? [m[1], m[2], contact] : null;
2411
+ }
2412
+ function owners2(t) {
2413
+ const own = Array.from({ length: t.rows }, () => Array(t.cols));
2414
+ for (let r = 0; r < t.rows; r++) for (let c = 0; c < t.cols; c++) {
2415
+ if (own[r][c]) continue;
2416
+ const cell = t.cells[r][c];
2417
+ for (let i = r; i < Math.min(t.rows, r + Math.max(1, _nullishCoalesce(cell.rowSpan, () => ( 1)))); i++)
2418
+ for (let j = c; j < Math.min(t.cols, c + Math.max(1, _nullishCoalesce(cell.colSpan, () => ( 1)))); j++) own[i][j] ??= cell;
2419
+ }
2420
+ return own;
2421
+ }
2422
+ function splitTable3(t) {
2423
+ if (t.cells.length !== t.rows || t.cells.some((row) => row.length !== t.cols)) return;
2424
+ const own = owners2(t);
2425
+ const anchor = (r, c) => own[r][c] === t.cells[r][c] ? t.cells[r][c] : null;
2426
+ const targets = [];
2427
+ for (let c = 0; c < t.cols; c++) {
2428
+ let filled = 0, hits = 0;
2429
+ for (let r = 0; r < t.rows; r++) {
2430
+ const cell = anchor(r, c);
2431
+ if (!cell || (_nullishCoalesce(cell.colSpan, () => ( 1))) !== 1 || _optionalChain([cell, 'access', _63 => _63.blocks, 'optionalAccess', _64 => _64.length]) || !cell.text.trim()) continue;
2432
+ if (contactParts(cell.text)) hits++;
2433
+ if (hits) filled++;
2434
+ }
2435
+ if (hits >= 2 && hits >= filled * 0.8) targets.push(c);
2436
+ }
2437
+ for (const c of targets.reverse()) {
2438
+ const grown = /* @__PURE__ */ new Set();
2439
+ for (let r = 0; r < t.rows; r++) {
2440
+ const cell = anchor(r, c);
2441
+ let added = [{ text: "", colSpan: 1, rowSpan: 1 }, { text: "", colSpan: 1, rowSpan: 1 }];
2442
+ if (cell && (_nullishCoalesce(cell.colSpan, () => ( 1))) === 1 && !_optionalChain([cell, 'access', _65 => _65.blocks, 'optionalAccess', _66 => _66.length])) {
2443
+ const parts = contactParts(cell.text);
2444
+ if (parts) {
2445
+ cell.text = parts[0];
2446
+ added = [{ ...cell, text: parts[1] }, { ...cell, text: parts[2] }];
2447
+ } else cell.colSpan = 3;
2448
+ grown.add(cell);
2449
+ } else if (!grown.has(own[r][c])) {
2450
+ own[r][c].colSpan = Math.max(1, _nullishCoalesce(own[r][c].colSpan, () => ( 1))) + 2;
2451
+ grown.add(own[r][c]);
2452
+ }
2453
+ t.cells[r].splice(c + 1, 0, ...added);
2454
+ }
2455
+ t.cols += 2;
2456
+ }
2457
+ }
2458
+ function splitOcrContactColumns(blocks) {
2459
+ for (const b of blocks) if (b.type === "table" && b.table) splitTable3(b.table);
2460
+ return blocks;
2461
+ }
2462
+
2463
+ // src/ocr/empty-cell-rescue.ts
2464
+ var MAX_CELLS = 60;
2465
+ var TOL = 3;
2466
+ var PAD = 16;
2467
+ async function rescueEmptyCells(engine, tuning, rgba, width, height, ruling, items) {
2468
+ const hs = ruling.horizontals, vs = ruling.verticals;
2469
+ if (hs.length < 2 || vs.length < 2) return [];
2470
+ const uniq = (vals) => {
2471
+ const out2 = [];
2472
+ for (const v of [...vals].sort((a, b) => a - b)) if (!out2.length || v - out2[out2.length - 1] > TOL) out2.push(v);
2473
+ return out2;
2474
+ };
2475
+ const ys = uniq(hs.map((h) => h.y1)), xs = uniq(vs.map((v) => v.x1));
2476
+ const hAt = (y, a, b) => hs.some((h) => Math.abs(h.y1 - y) <= TOL && Math.min(h.x1, h.x2) <= a + TOL && Math.max(h.x1, h.x2) >= b - TOL);
2477
+ const vAt = (x, a, b) => vs.some((v) => Math.abs(v.x1 - x) <= TOL && Math.min(v.y1, v.y2) <= a + TOL && Math.max(v.y1, v.y2) >= b - TOL);
2478
+ const cells = [];
2479
+ for (let j = 0; j + 1 < xs.length && cells.length < MAX_CELLS; j++) {
2480
+ for (let i = 0; i + 1 < ys.length && cells.length < MAX_CELLS; i++) {
2481
+ let k = i + 1;
2482
+ while (k + 1 < ys.length && !hAt(ys[k], xs[j], xs[j + 1])) k++;
2483
+ const [y1, y2, x1, x2] = [ys[i], ys[k], xs[j], xs[j + 1]];
2484
+ i = k - 1;
2485
+ if (y2 - y1 < 15 || x2 - x1 < 20 || (x2 - x1) * (y2 - y1) > width * height * 0.05) continue;
2486
+ if (!hAt(y1, x1, x2) || !hAt(y2, x1, x2) || !vAt(x1, y1, y2) || !vAt(x2, y1, y2)) continue;
2487
+ const bx = Math.ceil(x1 + 4), by = Math.ceil(y1 + 4), box = { x: bx, y: by, w: Math.floor(x2 - 4) - bx, h: Math.floor(y2 - 4) - by };
2488
+ if (box.w < 10 || box.h < 8) continue;
2489
+ if (items.some((it) => Math.min(it.x + it.w, box.x + box.w) > Math.max(it.x, box.x) && Math.min(it.y + it.h, box.y + box.h) > Math.max(it.y, box.y))) continue;
2490
+ let ink = 0;
2491
+ for (let y = box.y; y < box.y + box.h; y++) for (let x = box.x, p = (y * width + x) * 4; x < box.x + box.w; x++, p += 4) {
2492
+ if (rgba[p] * 77 + rgba[p + 1] * 150 + rgba[p + 2] * 29 < 128 * 256) ink++;
2493
+ }
2494
+ if (ink >= 40 && ink >= box.w * box.h * 0.01) cells.push(box);
2495
+ }
2496
+ }
2497
+ const out = [];
2498
+ for (const c of cells) {
2499
+ const w = c.w + PAD * 2, h = c.h + PAD * 2;
2500
+ const crop = new Uint8Array(w * h * 4).fill(255);
2501
+ for (let y = 0; y < c.h; y++) crop.set(rgba.subarray(((c.y + y) * width + c.x) * 4, ((c.y + y) * width + c.x + c.w) * 4), ((y + PAD) * w + PAD) * 4);
2502
+ const stats = { droppedLowConf: 0 };
2503
+ const found = await engine.recognizePage(crop, w, h, stats, { ...tuning, orientPage: false });
2504
+ for (const it of found) out.push({ ...it, x: it.x + c.x - PAD, y: it.y + c.y - PAD });
2505
+ }
2506
+ return out;
2507
+ }
2508
+
2327
2509
  // src/ocr/pdf-ocr.ts
2328
2510
  var OCR_RENDER_SCALE = 3;
2329
2511
  var MAX_OCR_PIXELS = 24e6;
@@ -2331,20 +2513,20 @@ var PAGE_TIMEOUT_MS = 12e4;
2331
2513
  var AUTO_REC = { pageConf: 0.9, gain: 0.06 };
2332
2514
  var DEFAULT_AUTO_REC = { pageConf: 0.85, gain: 0.1, lazy: true };
2333
2515
  var DEFAULT_BUILTIN_OCR = Object.freeze({
2334
- models: _chunkUFY6XX4Ucjs.DEFAULT_OCR_MODELS,
2516
+ models: _chunkUBY2PLKRcjs.DEFAULT_OCR_MODELS,
2335
2517
  tuning: DEFAULT_OCR_TUNING,
2336
- handwriting: _chunkUFY6XX4Ucjs.handwritingFallbackModels.call(void 0, _chunkUFY6XX4Ucjs.DEFAULT_OCR_MODELS),
2518
+ handwriting: _chunkUBY2PLKRcjs.handwritingFallbackModels.call(void 0, _chunkUBY2PLKRcjs.DEFAULT_OCR_MODELS),
2337
2519
  autoRec: DEFAULT_AUTO_REC
2338
2520
  });
2339
2521
  var DEFAULT_BUILTIN_OCR_FETCH = Object.freeze({ ...DEFAULT_BUILTIN_OCR, autoRec: { ...DEFAULT_AUTO_REC, fetch: true } });
2340
2522
  function builtinOcrConfig(o) {
2341
- if (!o || o.ocrDet === void 0 && o.ocrDetLongSide === void 0 && o.ocrRec === void 0 && o.ocrRecDict === void 0 && !o.ocrLines) return _optionalChain([o, 'optionalAccess', _63 => _63.ocr]) ? DEFAULT_BUILTIN_OCR_FETCH : DEFAULT_BUILTIN_OCR;
2523
+ if (!o || o.ocrDet === void 0 && o.ocrDetLongSide === void 0 && o.ocrRec === void 0 && o.ocrRecDict === void 0 && !o.ocrLines) return _optionalChain([o, 'optionalAccess', _67 => _67.ocr]) ? DEFAULT_BUILTIN_OCR_FETCH : DEFAULT_BUILTIN_OCR;
2342
2524
  const bad = _chunkMMK32GPDcjs.validateOcrOptions.call(void 0, o);
2343
- if (bad) throw new (0, _chunkBKK2SMVMcjs.KordocError)(bad);
2344
- const models = _chunkUFY6XX4Ucjs.resolveOcrModels.call(void 0, o);
2525
+ if (bad) throw new (0, _chunkPW7MQZI4cjs.KordocError)(bad);
2526
+ const models = _chunkUBY2PLKRcjs.resolveOcrModels.call(void 0, o);
2345
2527
  return {
2346
2528
  models,
2347
- ...o.ocrRec === "auto" ? { handwriting: _chunkUFY6XX4Ucjs.handwritingFallbackModels.call(void 0, models), autoRec: AUTO_REC } : o.ocrRec === void 0 ? { handwriting: _chunkUFY6XX4Ucjs.handwritingFallbackModels.call(void 0, models), autoRec: o.ocr ? { ...DEFAULT_AUTO_REC, fetch: true } : DEFAULT_AUTO_REC } : {},
2529
+ ...o.ocrRec === "auto" ? { handwriting: _chunkUBY2PLKRcjs.handwritingFallbackModels.call(void 0, models), autoRec: AUTO_REC } : o.ocrRec === void 0 ? { handwriting: _chunkUBY2PLKRcjs.handwritingFallbackModels.call(void 0, models), autoRec: o.ocr ? { ...DEFAULT_AUTO_REC, fetch: true } : DEFAULT_AUTO_REC } : {},
2348
2530
  tuning: o.ocrDetLongSide === void 0 ? DEFAULT_OCR_TUNING : { ...DEFAULT_OCR_TUNING, detLongSide: o.ocrDetLongSide },
2349
2531
  lines: o.ocrLines === "all" ? "all" : o.ocrLines ? "kept" : void 0
2350
2532
  };
@@ -2358,8 +2540,8 @@ async function recognizeOcrPage(engine, config, tuning, rgba, width, height, sta
2358
2540
  const altStats = { droppedLowConf: 0, ...stats.dropped ? { dropped: [] } : {} };
2359
2541
  let alt;
2360
2542
  try {
2361
- if (auto.lazy && !auto.fetch && !await _chunkUFY6XX4Ucjs.ocrModelsCached.call(void 0, config.handwriting)) return items;
2362
- if (auto.lazy) await _chunkUFY6XX4Ucjs.ensureOcrModelsFor.call(void 0, config.handwriting, reportModelDownload);
2543
+ if (auto.lazy && !auto.fetch && !await _chunkUBY2PLKRcjs.ocrModelsCached.call(void 0, config.handwriting)) return items;
2544
+ if (auto.lazy) await _chunkUBY2PLKRcjs.ensureOcrModelsFor.call(void 0, config.handwriting, reportModelDownload);
2363
2545
  alt = await (await getOcrEngine(config.handwriting)).recognizePage(rgba, width, height, altStats, tuning, cellRules, rowRules);
2364
2546
  } catch (e) {
2365
2547
  if (!auto.lazy) throw e;
@@ -2398,8 +2580,8 @@ async function runPdfOcr(buffer, targets, mode, warnings, onProgress, detectTabl
2398
2580
  "@hyzyla/pdfium",
2399
2581
  () => Promise.resolve().then(() => _interopRequireWildcard(require("@hyzyla/pdfium")))
2400
2582
  );
2401
- if (mode === "builtin") await _chunkUFY6XX4Ucjs.ensureOcrModelsFor.call(void 0, config.models, reportModelDownload);
2402
- if (mode === "builtin" && config.handwriting && !_optionalChain([config, 'access', _64 => _64.autoRec, 'optionalAccess', _65 => _65.lazy])) await _chunkUFY6XX4Ucjs.ensureOcrModelsFor.call(void 0, config.handwriting, reportModelDownload);
2583
+ if (mode === "builtin") await _chunkUBY2PLKRcjs.ensureOcrModelsFor.call(void 0, config.models, reportModelDownload);
2584
+ if (mode === "builtin" && config.handwriting && !_optionalChain([config, 'access', _68 => _68.autoRec, 'optionalAccess', _69 => _69.lazy])) await _chunkUBY2PLKRcjs.ensureOcrModelsFor.call(void 0, config.handwriting, reportModelDownload);
2403
2585
  const engine = mode === "builtin" ? await getOcrEngine(config.models) : null;
2404
2586
  const pdfium = await pdfiumMod.PDFiumLibrary.init();
2405
2587
  const doc = await pdfium.loadDocument(new Uint8Array(buffer));
@@ -2408,15 +2590,15 @@ async function runPdfOcr(buffer, targets, mode, warnings, onProgress, detectTabl
2408
2590
  const count = doc.getPageCount();
2409
2591
  for (const pageNo of [...targets].filter((p) => p >= 1 && p <= count).sort((a, b) => a - b)) {
2410
2592
  const page = doc.getPage(pageNo - 1);
2411
- _optionalChain([onProgress, 'optionalCall', _66 => _66(++done, targets.size)]);
2593
+ _optionalChain([onProgress, 'optionalCall', _70 => _70(++done, targets.size)]);
2412
2594
  try {
2413
2595
  const { blocks, lines } = await withTimeout(
2414
- ocrOnePage(page, pageNo, mode, engine, warnings, detectTables, _optionalChain([vectorOps, 'optionalAccess', _67 => _67.get, 'call', _68 => _68(pageNo)]), _optionalChain([imageRegions, 'optionalAccess', _69 => _69.get, 'call', _70 => _70(pageNo)]), config),
2596
+ ocrOnePage(page, pageNo, mode, engine, warnings, detectTables, _optionalChain([vectorOps, 'optionalAccess', _71 => _71.get, 'call', _72 => _72(pageNo)]), _optionalChain([imageRegions, 'optionalAccess', _73 => _73.get, 'call', _74 => _74(pageNo)]), config),
2415
2597
  PAGE_TIMEOUT_MS,
2416
2598
  `OCR \uD398\uC774\uC9C0 ${pageNo} \uD0C0\uC784\uC544\uC6C3 (${PAGE_TIMEOUT_MS / 1e3}\uCD08)`
2417
2599
  );
2418
2600
  result.set(pageNo, blocks);
2419
- if (lines) _optionalChain([linesOut, 'optionalAccess', _71 => _71.set, 'call', _72 => _72(pageNo, lines)]);
2601
+ if (lines) _optionalChain([linesOut, 'optionalAccess', _75 => _75.set, 'call', _76 => _76(pageNo, lines)]);
2420
2602
  } catch (e) {
2421
2603
  warnings.push({
2422
2604
  page: pageNo,
@@ -2477,6 +2659,7 @@ async function ocrOnePage(page, pageNo, mode, engine, warnings, detectTables, ve
2477
2659
  cellEdgeHorizontals(ruling)
2478
2660
  );
2479
2661
  }
2662
+ if (ruling && !regions && !vectorOps && config.tuning.postprocess) items = [...items, ...await rescueEmptyCells(engine, tuning, upright, rw, rh, ruling, items)];
2480
2663
  if (stats.droppedLowConf > 0) {
2481
2664
  warnings.push({
2482
2665
  page: pageNo,
@@ -2500,7 +2683,7 @@ async function ocrOnePage(page, pageNo, mode, engine, warnings, detectTables, ve
2500
2683
  const regionBlocks = regions.flatMap((r, k) => {
2501
2684
  let own = items.filter((it) => inside(it, r));
2502
2685
  const near = reads[k];
2503
- if (_optionalChain([near, 'optionalAccess', _73 => _73.length]) && meanConfidence(near) > meanConfidence(own)) {
2686
+ if (_optionalChain([near, 'optionalAccess', _77 => _77.length]) && meanConfidence(near) > meanConfidence(own)) {
2504
2687
  own = near;
2505
2688
  reread.add(k);
2506
2689
  }
@@ -2508,9 +2691,9 @@ async function ocrOnePage(page, pageNo, mode, engine, warnings, detectTables, ve
2508
2691
  for (const it of own) used.add(it);
2509
2692
  const blocks = ocrItemsToBlocks(own, pageNo, pdfW, pdfH, scale, ruling && rulingToPdfLines(ruling, scale, pdfH), detectTables, void 0, true);
2510
2693
  const x1 = r.x1 * scale - 2, x2 = r.x2 * scale + 2, y1 = (pdfH - r.y2) * scale - 2, y2 = (pdfH - r.y1) * scale + 2;
2511
- const columnRules = _nullishCoalesce(_optionalChain([ruling, 'optionalAccess', _74 => _74.verticals, 'access', _75 => _75.filter, 'call', _76 => _76((s) => Math.min(s.x1, s.x2) >= x1 && Math.max(s.x1, s.x2) <= x2 && Math.min(s.y1, s.y2) >= y1 && Math.max(s.y1, s.y2) <= y2), 'access', _77 => _77.length]), () => ( 0));
2694
+ const columnRules = _nullishCoalesce(_optionalChain([ruling, 'optionalAccess', _78 => _78.verticals, 'access', _79 => _79.filter, 'call', _80 => _80((s) => Math.min(s.x1, s.x2) >= x1 && Math.max(s.x1, s.x2) <= x2 && Math.min(s.y1, s.y2) >= y1 && Math.max(s.y1, s.y2) <= y2), 'access', _81 => _81.length]), () => ( 0));
2512
2695
  if (columnRules < 2) {
2513
- for (const b of blocks) if (b.type === "table") _chunkUFY6XX4Ucjs.UNRULED_REGION_TABLES.add(b);
2696
+ for (const b of blocks) if (b.type === "table") _chunkUBY2PLKRcjs.UNRULED_REGION_TABLES.add(b);
2514
2697
  }
2515
2698
  return blocks;
2516
2699
  });
@@ -2582,7 +2765,7 @@ async function closerReads(rgba, rw, rh, pdfH, hi, regions, engine, tuning = REG
2582
2765
  const items = await engine.recognizePage(crop, cw, ch, void 0, tuning);
2583
2766
  out.push(items.map((it) => {
2584
2767
  const placed = { ...it, x: (it.x + x0) / 2, y: (it.y + y0) / 2, w: it.w / 2, h: it.h / 2 };
2585
- _chunkUFY6XX4Ucjs.copyOcrTextGaps.call(void 0, it, placed, 0.5, x0 / 2);
2768
+ _chunkUBY2PLKRcjs.copyOcrTextGaps.call(void 0, it, placed, 0.5, x0 / 2);
2586
2769
  return placed;
2587
2770
  }));
2588
2771
  }
@@ -2590,7 +2773,7 @@ async function closerReads(rgba, rw, rh, pdfH, hi, regions, engine, tuning = REG
2590
2773
  }
2591
2774
  var proseBox = (b) => {
2592
2775
  const t = b.text.replace(/\s/g, "");
2593
- return b.w >= b.h * 7 && (_nullishCoalesce(_optionalChain([t, 'access', _78 => _78.match, 'call', _79 => _79(/\d/g), 'optionalAccess', _80 => _80.length]), () => ( 0))) < t.length * 0.3;
2776
+ return b.w >= b.h * 7 && (_nullishCoalesce(_optionalChain([t, 'access', _82 => _82.match, 'call', _83 => _83(/\d/g), 'optionalAccess', _84 => _84.length]), () => ( 0))) < t.length * 0.3;
2594
2777
  };
2595
2778
  function groupOcrLines(items, figureRegion = false) {
2596
2779
  const order = items.map((_, i) => i).sort((a, b) => items[a].y + items[a].h / 2 - (items[b].y + items[b].h / 2));
@@ -2631,6 +2814,10 @@ function groupOcrLines(items, figureRegion = false) {
2631
2814
  return lines.filter((l) => l.length > 0);
2632
2815
  }
2633
2816
  function ocrItemsToBlocks(items, pageNumber, pdfW, pdfH, scale, extraLines, detectTables = true, opList = { fnArray: [], argsArray: [] }, figureRegion = false) {
2817
+ if (!figureRegion) {
2818
+ const chart = chartPlotItems(items);
2819
+ if (chart.size) items = items.filter((_, i) => !chart.has(i));
2820
+ }
2634
2821
  const bottoms = items.map((it) => it.y + it.h);
2635
2822
  const xs = items.map((it) => ({ x: it.x, r: it.x + it.w, space: false }));
2636
2823
  const texts = items.map((it) => it.text);
@@ -2670,15 +2857,15 @@ function ocrItemsToBlocks(items, pageNumber, pdfW, pdfH, scale, extraLines, dete
2670
2857
  isHidden: false,
2671
2858
  ...xs[i].space ? { hasSpaceBefore: true } : {}
2672
2859
  };
2673
- _chunkUFY6XX4Ucjs.copyOcrTextGaps.call(void 0, it, normalized, 1 / scale);
2860
+ _chunkUBY2PLKRcjs.copyOcrTextGaps.call(void 0, it, normalized, 1 / scale);
2674
2861
  return normalized;
2675
2862
  }).filter((it) => it.text);
2676
- const blocks = unframeOcrLayoutTables(splitOcrNameValueColumns(splitStackedOcrRows(_chunkUFY6XX4Ucjs.extractPageBlocksWithLines.call(void 0, norm, pageNumber, opList, pdfW, pdfH, extraLines, detectTables))), pdfH);
2863
+ const blocks = unframeOcrLayoutTables(splitOcrContactColumns(splitOcrNameValueColumns(splitStackedOcrRows(_chunkUBY2PLKRcjs.extractPageBlocksWithLines.call(void 0, norm, pageNumber, opList, pdfW, pdfH, extraLines, detectTables)))), pdfH);
2677
2864
  if (!figureRegion) markOcrHeadings(blocks);
2678
2865
  return blocks;
2679
2866
  }
2680
2867
  function markOcrHeadings(blocks) {
2681
- const sized = blocks.filter((b) => b.type === "paragraph" && b.text && _optionalChain([b, 'access', _81 => _81.style, 'optionalAccess', _82 => _82.fontSize]));
2868
+ const sized = blocks.filter((b) => b.type === "paragraph" && b.text && _optionalChain([b, 'access', _85 => _85.style, 'optionalAccess', _86 => _86.fontSize]));
2682
2869
  const weights = sized.map((b) => [b.style.fontSize, b.text.length]);
2683
2870
  const total = weights.reduce((n, [, w]) => n + w, 0);
2684
2871
  if (total < 100) return;
@@ -2715,9 +2902,9 @@ function markOcrHeadings(blocks) {
2715
2902
  const a = blocks[i - 1], b = blocks[i];
2716
2903
  if (a.type !== "heading" || b.type !== "heading" || !a.bbox || !b.bbox) continue;
2717
2904
  const marker = /^(?:제\s*\d+\s*[장절편부]|chapter\s*\d+|part\s*\d+)$/i.test(a.text.trim());
2718
- const sa = _nullishCoalesce(_optionalChain([a, 'access', _83 => _83.style, 'optionalAccess', _84 => _84.fontSize]), () => ( 0)), sb = _nullishCoalesce(_optionalChain([b, 'access', _85 => _85.style, 'optionalAccess', _86 => _86.fontSize]), () => ( 0));
2905
+ const sa = _nullishCoalesce(_optionalChain([a, 'access', _87 => _87.style, 'optionalAccess', _88 => _88.fontSize]), () => ( 0)), sb = _nullishCoalesce(_optionalChain([b, 'access', _89 => _89.style, 'optionalAccess', _90 => _90.fontSize]), () => ( 0));
2719
2906
  if (!marker && (a.level !== b.level || Math.max(sa, sb) > Math.min(sa, sb) * 1.3)) continue;
2720
- const gap = a.bbox.y - (b.bbox.y + b.bbox.height), size = Math.max(_nullishCoalesce(_optionalChain([a, 'access', _87 => _87.style, 'optionalAccess', _88 => _88.fontSize]), () => ( 0)), _nullishCoalesce(_optionalChain([b, 'access', _89 => _89.style, 'optionalAccess', _90 => _90.fontSize]), () => ( 0)));
2907
+ const gap = a.bbox.y - (b.bbox.y + b.bbox.height), size = Math.max(_nullishCoalesce(_optionalChain([a, 'access', _91 => _91.style, 'optionalAccess', _92 => _92.fontSize]), () => ( 0)), _nullishCoalesce(_optionalChain([b, 'access', _93 => _93.style, 'optionalAccess', _94 => _94.fontSize]), () => ( 0)));
2721
2908
  const across = Math.min(a.bbox.x + a.bbox.width, b.bbox.x + b.bbox.width) - Math.max(a.bbox.x, b.bbox.x);
2722
2909
  if (gap < 0 || gap > size * (marker ? 3 : 1.2) || across <= 0) continue;
2723
2910
  a.level = Math.min(_nullishCoalesce(a.level, () => ( 2)), _nullishCoalesce(b.level, () => ( 2)));
@@ -2732,7 +2919,7 @@ async function tryImport2(name, loader) {
2732
2919
  return await loader();
2733
2920
  } catch (e) {
2734
2921
  throw new Error(
2735
- `OCR \uC744 \uC0AC\uC6A9\uD558\uB824\uBA74 optional dependency '${name}' \uC774 \uD544\uC694\uD569\uB2C8\uB2E4. \`npm install ${name}\` \uD6C4 \uB2E4\uC2DC \uC2E4\uD589\uD558\uC138\uC694.${_chunkBKK2SMVMcjs.OPTIONAL_DEP_INSTALL_HINT} \uC6D0\uC778: ${e.message}`
2922
+ `OCR \uC744 \uC0AC\uC6A9\uD558\uB824\uBA74 optional dependency '${name}' \uC774 \uD544\uC694\uD569\uB2C8\uB2E4. \`npm install ${name}\` \uD6C4 \uB2E4\uC2DC \uC2E4\uD589\uD558\uC138\uC694.${_chunkPW7MQZI4cjs.OPTIONAL_DEP_INSTALL_HINT} \uC6D0\uC778: ${e.message}`
2736
2923
  );
2737
2924
  }
2738
2925
  }
@@ -2783,5 +2970,6 @@ function bgraToRgba(bgra) {
2783
2970
 
2784
2971
 
2785
2972
 
2786
- exports.getOcrEngine = getOcrEngine; exports.detectRulingLines = detectRulingLines; exports.rulingToPdfLines = rulingToPdfLines; exports.deskewPage = deskewPage; exports.rotateQuarter = rotateQuarter; exports.MAX_OCR_PIXELS = MAX_OCR_PIXELS; exports.DEFAULT_BUILTIN_OCR = DEFAULT_BUILTIN_OCR; exports.builtinOcrConfig = builtinOcrConfig; exports.recognizeOcrPage = recognizeOcrPage; exports.reportModelDownload = reportModelDownload; exports.toOcrLine = toOcrLine; exports.pageLines = pageLines; exports.cellEdgeVerticals = cellEdgeVerticals; exports.cellEdgeHorizontals = cellEdgeHorizontals; exports.runPdfOcr = runPdfOcr; exports.ocrOnePage = ocrOnePage; exports.stretchFaintCrop = stretchFaintCrop; exports.groupOcrLines = groupOcrLines; exports.ocrItemsToBlocks = ocrItemsToBlocks; exports.markOcrHeadings = markOcrHeadings;
2787
- //# sourceMappingURL=chunk-LMHE4HDR.cjs.map
2973
+
2974
+ exports.rescueEmptyCells = rescueEmptyCells; exports.getOcrEngine = getOcrEngine; exports.detectRulingLines = detectRulingLines; exports.rulingToPdfLines = rulingToPdfLines; exports.deskewPage = deskewPage; exports.rotateQuarter = rotateQuarter; exports.MAX_OCR_PIXELS = MAX_OCR_PIXELS; exports.DEFAULT_BUILTIN_OCR = DEFAULT_BUILTIN_OCR; exports.builtinOcrConfig = builtinOcrConfig; exports.recognizeOcrPage = recognizeOcrPage; exports.reportModelDownload = reportModelDownload; exports.toOcrLine = toOcrLine; exports.pageLines = pageLines; exports.cellEdgeVerticals = cellEdgeVerticals; exports.cellEdgeHorizontals = cellEdgeHorizontals; exports.runPdfOcr = runPdfOcr; exports.ocrOnePage = ocrOnePage; exports.stretchFaintCrop = stretchFaintCrop; exports.groupOcrLines = groupOcrLines; exports.ocrItemsToBlocks = ocrItemsToBlocks; exports.markOcrHeadings = markOcrHeadings;
2975
+ //# sourceMappingURL=chunk-PVV6OY4M.cjs.map