kordoc 4.24.37 → 4.24.39

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 (193) hide show
  1. package/README.md +4 -4
  2. package/dist/{-HX3RWDQF.js → -7VE547IT.js} +60 -60
  3. package/dist/{chunk-4MWGWS3B.js → chunk-2XXTL4S4.js} +2 -2
  4. package/dist/{chunk-J26TNCL7.js → chunk-346W5O2J.js} +2 -2
  5. package/dist/{chunk-LM7LYH54.js → chunk-3MHRL3OO.js} +2 -2
  6. package/dist/{chunk-TQBNSAAS.js → chunk-4FWLCWNU.js} +2 -2
  7. package/dist/{chunk-6QK6ZQTF.js → chunk-7AYP2XO6.js} +3 -3
  8. package/dist/{chunk-YNIZLSM4.js → chunk-7BQWFZJO.js} +8 -8
  9. package/dist/{chunk-OTB6UOIB.js → chunk-7ZRUR4TZ.js} +2 -2
  10. package/dist/{chunk-IWCWO3GP.js → chunk-BWBR5GWQ.js} +2 -2
  11. package/dist/{chunk-P3SZJJRK.js → chunk-COH7WXBK.js} +7 -7
  12. package/dist/{chunk-524MGRNW.js → chunk-CS76UPUC.js} +125 -21
  13. package/dist/chunk-CS76UPUC.js.map +1 -0
  14. package/dist/{chunk-LWSMZJLR.js → chunk-F2JYJ2SP.js} +2 -2
  15. package/dist/{chunk-MTSWWXSB.js → chunk-FRMJTW3C.js} +2 -2
  16. package/dist/{chunk-JRVZBYQ2.js → chunk-FZMZUX7B.js} +130 -21
  17. package/dist/chunk-FZMZUX7B.js.map +1 -0
  18. package/dist/{chunk-J42O5KBX.js → chunk-GXED6LJX.js} +2 -2
  19. package/dist/{chunk-E527FG6I.cjs → chunk-IM5SIGUN.cjs} +3 -3
  20. package/dist/{chunk-E527FG6I.cjs.map → chunk-IM5SIGUN.cjs.map} +1 -1
  21. package/dist/{chunk-RR2FKPFN.js → chunk-IZWZ3RQC.js} +2 -2
  22. package/dist/{chunk-RR2FKPFN.js.map → chunk-IZWZ3RQC.js.map} +1 -1
  23. package/dist/{chunk-BT5RPLV4.js → chunk-L23XOAKF.js} +19 -19
  24. package/dist/{chunk-WZUTLJP2.cjs → chunk-LE3733C2.cjs} +212 -108
  25. package/dist/chunk-LE3733C2.cjs.map +1 -0
  26. package/dist/{chunk-2LDFUVVF.js → chunk-LOJYJISM.js} +16 -7
  27. package/dist/chunk-LOJYJISM.js.map +1 -0
  28. package/dist/{chunk-KGX4TLBX.cjs → chunk-LU7X6LLW.cjs} +3 -3
  29. package/dist/{chunk-KGX4TLBX.cjs.map → chunk-LU7X6LLW.cjs.map} +1 -1
  30. package/dist/{chunk-DRDW5ULI.js → chunk-M2ZRTYQ5.js} +14 -14
  31. package/dist/{chunk-QWYIYVIZ.cjs → chunk-MANE7HAZ.cjs} +2 -2
  32. package/dist/{chunk-QWYIYVIZ.cjs.map → chunk-MANE7HAZ.cjs.map} +1 -1
  33. package/dist/{chunk-XCMDIXWE.js → chunk-NL5OTD2E.js} +32 -32
  34. package/dist/{chunk-ONCXLQV4.js → chunk-NQJL3664.js} +3 -3
  35. package/dist/{chunk-KFJKRST5.js → chunk-PFHMNNW7.js} +126 -17
  36. package/dist/chunk-PFHMNNW7.js.map +1 -0
  37. package/dist/{chunk-OHLJEWS6.js → chunk-PHVAJBHM.js} +2 -2
  38. package/dist/{chunk-7GN7O3K2.js → chunk-PQIIYKNL.js} +51 -51
  39. package/dist/{chunk-T7K3CLXM.js → chunk-QDPYTJ4Y.js} +2 -2
  40. package/dist/{chunk-7MGZWDO4.js → chunk-QDQPAC4L.js} +2 -2
  41. package/dist/{chunk-7MGZWDO4.js.map → chunk-QDQPAC4L.js.map} +1 -1
  42. package/dist/{chunk-LG4SU2D4.cjs → chunk-RJNHXCMP.cjs} +69 -60
  43. package/dist/chunk-RJNHXCMP.cjs.map +1 -0
  44. package/dist/{chunk-33BKUIIC.js → chunk-RPAEXGWZ.js} +2 -2
  45. package/dist/{chunk-VRCXXZHT.js → chunk-SFLHCRO6.js} +2 -2
  46. package/dist/{chunk-GCFG67SF.js → chunk-U5OV6D66.js} +50 -50
  47. package/dist/{chunk-RBCDHT55.cjs → chunk-UKTRLJII.cjs} +98 -98
  48. package/dist/{chunk-RBCDHT55.cjs.map → chunk-UKTRLJII.cjs.map} +1 -1
  49. package/dist/{chunk-BYOAA442.js → chunk-V2RIY72D.js} +2 -2
  50. package/dist/{chunk-EJKCEP3Q.cjs → chunk-V3IMDOZE.cjs} +6 -6
  51. package/dist/{chunk-EJKCEP3Q.cjs.map → chunk-V3IMDOZE.cjs.map} +1 -1
  52. package/dist/{chunk-4OWD6WRS.js → chunk-WPIG3KUV.js} +121 -17
  53. package/dist/chunk-WPIG3KUV.js.map +1 -0
  54. package/dist/{chunk-6XOJ6CEK.js → chunk-WVER4OWF.js} +3 -3
  55. package/dist/{chunk-IOABX3GR.cjs → chunk-XYVTCXAG.cjs} +265 -156
  56. package/dist/chunk-XYVTCXAG.cjs.map +1 -0
  57. package/dist/{chunk-6SVVVZLV.js → chunk-Y5O4DS56.js} +2 -2
  58. package/dist/{chunk-UMQADPM5.js → chunk-YXKU6UJD.js} +2 -2
  59. package/dist/{chunk-B2VRTOQZ.js → chunk-ZDMLZRS4.js} +18 -9
  60. package/dist/chunk-ZDMLZRS4.js.map +1 -0
  61. package/dist/{chunk-64MVXWS5.js → chunk-ZVAX6E63.js} +2 -2
  62. package/dist/chunks-WTYZ4KG2.js +11 -0
  63. package/dist/cli.js +61 -60
  64. package/dist/cli.js.map +1 -1
  65. package/dist/{formula-DLZUYM6F.js → formula-MMLDES2Z.js} +20 -17
  66. package/dist/{formula-DLZUYM6F.js.map → formula-MMLDES2Z.js.map} +1 -1
  67. package/dist/{formula-2MQWKUKR.js → formula-PFSZZNPP.js} +19 -16
  68. package/dist/{formula-2MQWKUKR.js.map → formula-PFSZZNPP.js.map} +1 -1
  69. package/dist/{formula-T2YY77JT.cjs → formula-UI2UR74M.cjs} +25 -22
  70. package/dist/formula-UI2UR74M.cjs.map +1 -0
  71. package/dist/generator-C3SCP3ZG.js +10 -0
  72. package/dist/generator-CHBOCLYX.cjs +11 -0
  73. package/dist/{generator-YBWCA6B5.cjs.map → generator-CHBOCLYX.cjs.map} +1 -1
  74. package/dist/generator-RTSNDZJB.js +17 -0
  75. package/dist/hancom-3V3USCW5.js +84 -0
  76. package/dist/hancom-3V3USCW5.js.map +1 -0
  77. package/dist/hancom-GV5TTF5H.cjs +85 -0
  78. package/dist/hancom-GV5TTF5H.cjs.map +1 -0
  79. package/dist/hancom-XO52GNC3.js +85 -0
  80. package/dist/hancom-XO52GNC3.js.map +1 -0
  81. package/dist/image-ocr-2WKCFABH.cjs +211 -0
  82. package/dist/image-ocr-2WKCFABH.cjs.map +1 -0
  83. package/dist/{image-ocr-3NF3QJM7.js → image-ocr-R2ASFKHX.js} +99 -15
  84. package/dist/image-ocr-R2ASFKHX.js.map +1 -0
  85. package/dist/{image-ocr-XRKFK7AA.js → image-ocr-SU4RPHBF.js} +94 -10
  86. package/dist/image-ocr-SU4RPHBF.js.map +1 -0
  87. package/dist/index.cjs +1110 -1110
  88. package/dist/index.cjs.map +1 -1
  89. package/dist/index.d.cts +7 -1
  90. package/dist/index.d.ts +7 -1
  91. package/dist/index.js +70 -70
  92. package/dist/mcp.js +57 -56
  93. package/dist/mcp.js.map +1 -1
  94. package/dist/memo-U4RZJRU2.js +17 -0
  95. package/dist/{model-bundle-MO5I26AO.js → model-bundle-JMSH2F4A.js} +5 -5
  96. package/dist/{models-IIP4GZ57.js → models-D5SATVOZ.js} +5 -5
  97. package/dist/{parse-worker-v2-GWOL3TTO.js → parse-worker-v2-WIIZQFRX.js} +28 -28
  98. package/dist/{parser-UCLUVQPA.js → parser-KCY43TBS.js} +16 -16
  99. package/dist/{parser-R6UJQ6CV.cjs → parser-MFBTEGJA.cjs} +162 -162
  100. package/dist/{parser-R6UJQ6CV.cjs.map → parser-MFBTEGJA.cjs.map} +1 -1
  101. package/dist/{parser-DJQFM6VE.js → parser-SBJKV5GS.js} +16 -16
  102. package/dist/{pdf-ocr-EWXGN4JB.js → pdf-ocr-I6GNQEFS.js} +8 -6
  103. package/dist/pdf-ocr-L2O4SQUK.cjs +40 -0
  104. package/dist/pdf-ocr-L2O4SQUK.cjs.map +1 -0
  105. package/dist/{pdf-ocr-7PSNKQOI.js → pdf-ocr-UU5PSZ7Z.js} +12 -10
  106. package/dist/{profile-io-NUU3VKNW.js → profile-io-HZK4ZZ2O.js} +3 -3
  107. package/dist/{rasterize-RARCMBJ3.js → rasterize-VNP4ULXM.js} +3 -3
  108. package/dist/{redact-doc-JKGDXGNJ.js → redact-doc-SPHSBCPN.js} +37 -37
  109. package/dist/{render-SGLKO3PG.js → render-CKTTIDU2.js} +14 -14
  110. package/dist/{rewrite-fallback-7YZXSR5K.js → rewrite-fallback-H2KMJV6G.js} +21 -21
  111. package/dist/seal-MSY5G3UR.js +16 -0
  112. package/dist/{setup-5IYW4FZ7.js → setup-GJVOXJN7.js} +3 -3
  113. package/dist/{to-hwpx-QMANIAWY.js → to-hwpx-5UIBNW3D.js} +9 -9
  114. package/dist/to-hwpx-6BQNMA6P.cjs +16 -0
  115. package/dist/{to-hwpx-DEBHREDM.cjs.map → to-hwpx-6BQNMA6P.cjs.map} +1 -1
  116. package/dist/{to-hwpx-4PM6XV2L.js → to-hwpx-JJHDCYER.js} +4 -4
  117. package/dist/visual-Q6PIMKSA.js +37 -0
  118. package/dist/{watch-YZS76EOS.js → watch-YZZES36Q.js} +27 -27
  119. package/package.json +1 -1
  120. package/dist/chunk-2LDFUVVF.js.map +0 -1
  121. package/dist/chunk-4OWD6WRS.js.map +0 -1
  122. package/dist/chunk-524MGRNW.js.map +0 -1
  123. package/dist/chunk-B2VRTOQZ.js.map +0 -1
  124. package/dist/chunk-IOABX3GR.cjs.map +0 -1
  125. package/dist/chunk-JRVZBYQ2.js.map +0 -1
  126. package/dist/chunk-KFJKRST5.js.map +0 -1
  127. package/dist/chunk-LG4SU2D4.cjs.map +0 -1
  128. package/dist/chunk-WZUTLJP2.cjs.map +0 -1
  129. package/dist/chunks-NRA4GFK2.js +0 -11
  130. package/dist/formula-T2YY77JT.cjs.map +0 -1
  131. package/dist/generator-2WFWLJFG.js +0 -10
  132. package/dist/generator-5NWKWLOO.js +0 -17
  133. package/dist/generator-YBWCA6B5.cjs +0 -11
  134. package/dist/image-ocr-3NF3QJM7.js.map +0 -1
  135. package/dist/image-ocr-N7UKGSRY.cjs +0 -127
  136. package/dist/image-ocr-N7UKGSRY.cjs.map +0 -1
  137. package/dist/image-ocr-XRKFK7AA.js.map +0 -1
  138. package/dist/memo-XJ4NBV4J.js +0 -17
  139. package/dist/pdf-ocr-HECUBUMU.cjs +0 -38
  140. package/dist/pdf-ocr-HECUBUMU.cjs.map +0 -1
  141. package/dist/seal-LSS7WY6Z.js +0 -16
  142. package/dist/to-hwpx-DEBHREDM.cjs +0 -16
  143. package/dist/visual-QXYBJJ5D.js +0 -37
  144. /package/dist/{-HX3RWDQF.js.map → -7VE547IT.js.map} +0 -0
  145. /package/dist/{chunk-4MWGWS3B.js.map → chunk-2XXTL4S4.js.map} +0 -0
  146. /package/dist/{chunk-J26TNCL7.js.map → chunk-346W5O2J.js.map} +0 -0
  147. /package/dist/{chunk-LM7LYH54.js.map → chunk-3MHRL3OO.js.map} +0 -0
  148. /package/dist/{chunk-TQBNSAAS.js.map → chunk-4FWLCWNU.js.map} +0 -0
  149. /package/dist/{chunk-6QK6ZQTF.js.map → chunk-7AYP2XO6.js.map} +0 -0
  150. /package/dist/{chunk-YNIZLSM4.js.map → chunk-7BQWFZJO.js.map} +0 -0
  151. /package/dist/{chunk-OTB6UOIB.js.map → chunk-7ZRUR4TZ.js.map} +0 -0
  152. /package/dist/{chunk-IWCWO3GP.js.map → chunk-BWBR5GWQ.js.map} +0 -0
  153. /package/dist/{chunk-P3SZJJRK.js.map → chunk-COH7WXBK.js.map} +0 -0
  154. /package/dist/{chunk-LWSMZJLR.js.map → chunk-F2JYJ2SP.js.map} +0 -0
  155. /package/dist/{chunk-MTSWWXSB.js.map → chunk-FRMJTW3C.js.map} +0 -0
  156. /package/dist/{chunk-J42O5KBX.js.map → chunk-GXED6LJX.js.map} +0 -0
  157. /package/dist/{chunk-BT5RPLV4.js.map → chunk-L23XOAKF.js.map} +0 -0
  158. /package/dist/{chunk-DRDW5ULI.js.map → chunk-M2ZRTYQ5.js.map} +0 -0
  159. /package/dist/{chunk-XCMDIXWE.js.map → chunk-NL5OTD2E.js.map} +0 -0
  160. /package/dist/{chunk-ONCXLQV4.js.map → chunk-NQJL3664.js.map} +0 -0
  161. /package/dist/{chunk-OHLJEWS6.js.map → chunk-PHVAJBHM.js.map} +0 -0
  162. /package/dist/{chunk-7GN7O3K2.js.map → chunk-PQIIYKNL.js.map} +0 -0
  163. /package/dist/{chunk-T7K3CLXM.js.map → chunk-QDPYTJ4Y.js.map} +0 -0
  164. /package/dist/{chunk-33BKUIIC.js.map → chunk-RPAEXGWZ.js.map} +0 -0
  165. /package/dist/{chunk-VRCXXZHT.js.map → chunk-SFLHCRO6.js.map} +0 -0
  166. /package/dist/{chunk-GCFG67SF.js.map → chunk-U5OV6D66.js.map} +0 -0
  167. /package/dist/{chunk-BYOAA442.js.map → chunk-V2RIY72D.js.map} +0 -0
  168. /package/dist/{chunk-6XOJ6CEK.js.map → chunk-WVER4OWF.js.map} +0 -0
  169. /package/dist/{chunk-6SVVVZLV.js.map → chunk-Y5O4DS56.js.map} +0 -0
  170. /package/dist/{chunk-UMQADPM5.js.map → chunk-YXKU6UJD.js.map} +0 -0
  171. /package/dist/{chunk-64MVXWS5.js.map → chunk-ZVAX6E63.js.map} +0 -0
  172. /package/dist/{chunks-NRA4GFK2.js.map → chunks-WTYZ4KG2.js.map} +0 -0
  173. /package/dist/{generator-2WFWLJFG.js.map → generator-C3SCP3ZG.js.map} +0 -0
  174. /package/dist/{generator-5NWKWLOO.js.map → generator-RTSNDZJB.js.map} +0 -0
  175. /package/dist/{memo-XJ4NBV4J.js.map → memo-U4RZJRU2.js.map} +0 -0
  176. /package/dist/{model-bundle-MO5I26AO.js.map → model-bundle-JMSH2F4A.js.map} +0 -0
  177. /package/dist/{models-IIP4GZ57.js.map → models-D5SATVOZ.js.map} +0 -0
  178. /package/dist/{parse-worker-v2-GWOL3TTO.js.map → parse-worker-v2-WIIZQFRX.js.map} +0 -0
  179. /package/dist/{parser-UCLUVQPA.js.map → parser-KCY43TBS.js.map} +0 -0
  180. /package/dist/{parser-DJQFM6VE.js.map → parser-SBJKV5GS.js.map} +0 -0
  181. /package/dist/{pdf-ocr-7PSNKQOI.js.map → pdf-ocr-I6GNQEFS.js.map} +0 -0
  182. /package/dist/{pdf-ocr-EWXGN4JB.js.map → pdf-ocr-UU5PSZ7Z.js.map} +0 -0
  183. /package/dist/{profile-io-NUU3VKNW.js.map → profile-io-HZK4ZZ2O.js.map} +0 -0
  184. /package/dist/{rasterize-RARCMBJ3.js.map → rasterize-VNP4ULXM.js.map} +0 -0
  185. /package/dist/{redact-doc-JKGDXGNJ.js.map → redact-doc-SPHSBCPN.js.map} +0 -0
  186. /package/dist/{render-SGLKO3PG.js.map → render-CKTTIDU2.js.map} +0 -0
  187. /package/dist/{rewrite-fallback-7YZXSR5K.js.map → rewrite-fallback-H2KMJV6G.js.map} +0 -0
  188. /package/dist/{seal-LSS7WY6Z.js.map → seal-MSY5G3UR.js.map} +0 -0
  189. /package/dist/{setup-5IYW4FZ7.js.map → setup-GJVOXJN7.js.map} +0 -0
  190. /package/dist/{to-hwpx-4PM6XV2L.js.map → to-hwpx-5UIBNW3D.js.map} +0 -0
  191. /package/dist/{to-hwpx-QMANIAWY.js.map → to-hwpx-JJHDCYER.js.map} +0 -0
  192. /package/dist/{visual-QXYBJJ5D.js.map → visual-Q6PIMKSA.js.map} +0 -0
  193. /package/dist/{watch-YZS76EOS.js.map → watch-YZZES36Q.js.map} +0 -0
@@ -34,7 +34,7 @@
34
34
 
35
35
 
36
36
 
37
- var _chunkIOABX3GRcjs = require('./chunk-IOABX3GR.cjs');
37
+ var _chunkXYVTCXAGcjs = require('./chunk-XYVTCXAG.cjs');
38
38
 
39
39
 
40
40
  var _chunkZTN3T3GHcjs = require('./chunk-ZTN3T3GH.cjs');
@@ -44,7 +44,7 @@ var _chunkTK3FDAEEcjs = require('./chunk-TK3FDAEE.cjs');
44
44
 
45
45
 
46
46
 
47
- var _chunkQWYIYVIZcjs = require('./chunk-QWYIYVIZ.cjs');
47
+ var _chunkMANE7HAZcjs = require('./chunk-MANE7HAZ.cjs');
48
48
 
49
49
  // src/ocr/ocr-stacked-rows.ts
50
50
  var NUMERIC = /^[-+−△▲▽▼]?[\d.,]+[%p]?$|^[-–—·∼~]$|^\([-+−△▲▽▼]?[\d.,]+\)$/;
@@ -514,8 +514,8 @@ var INKLESS_DELTA = 32;
514
514
  function restoreGlyphs(rgba, pageW, box, text, steps, stepPx, note = {}) {
515
515
  const chars = [...text];
516
516
  if (chars.length !== steps.length) return text;
517
- const gray = _chunkIOABX3GRcjs.grayCrop.call(void 0, rgba, pageW, box);
518
- const c = { chars, cx: (i) => (steps[i] + 0.5) * stepPx, gray, w: box.w, h: box.h, ink: _chunkIOABX3GRcjs.inkStats.call(void 0, gray) };
517
+ const gray = _chunkXYVTCXAGcjs.grayCrop.call(void 0, rgba, pageW, box);
518
+ const c = { chars, cx: (i) => (steps[i] + 0.5) * stepPx, gray, w: box.w, h: box.h, ink: _chunkXYVTCXAGcjs.inkStats.call(void 0, gray) };
519
519
  if (/[[\]]/.test(text)) brackets(c);
520
520
  if (text.includes("'")) cornerQuotes(c);
521
521
  if (/['"]/.test(text)) quotes(c);
@@ -533,7 +533,7 @@ function restoreGlyphs(rgba, pageW, box, text, steps, stepPx, note = {}) {
533
533
  function trimInklessEnds(rgba, pageW, box, text, steps, stepPx) {
534
534
  const chars = [...text], { w, h } = box;
535
535
  if (chars.length !== steps.length || steps.some((s) => (s + 0.5) * stepPx > w + stepPx)) return { text, steps };
536
- const gray = _chunkIOABX3GRcjs.grayCrop.call(void 0, rgba, pageW, box);
536
+ const gray = _chunkXYVTCXAGcjs.grayCrop.call(void 0, rgba, pageW, box);
537
537
  const hist = new Uint32Array(256);
538
538
  for (const v of gray) hist[v]++;
539
539
  let bg = 0;
@@ -564,8 +564,8 @@ function cornerCommas({ chars, cx, gray, w, h, ink }) {
564
564
  continue;
565
565
  }
566
566
  if (open > 0) {
567
- const f = _chunkIOABX3GRcjs.bracketFeatures.call(void 0, gray, w, h, ink, cx(i));
568
- if (f && _chunkIOABX3GRcjs.bracketShape.call(void 0, f, true) === "\u300D") {
567
+ const f = _chunkXYVTCXAGcjs.bracketFeatures.call(void 0, gray, w, h, ink, cx(i));
568
+ if (f && _chunkXYVTCXAGcjs.bracketShape.call(void 0, f, true) === "\u300D") {
569
569
  chars[i] = "\u300D";
570
570
  open--;
571
571
  }
@@ -575,12 +575,12 @@ function cornerCommas({ chars, cx, gray, w, h, ink }) {
575
575
  function cornerQuotes({ chars, cx, gray, w, h, ink }) {
576
576
  for (let i = 0; i < chars.length; i++) {
577
577
  if (chars[i] !== "'" || !/^[가-힣]/.test(_nullishCoalesce(chars[i + 1], () => ( "")))) continue;
578
- const f = _chunkIOABX3GRcjs.bracketFeatures.call(void 0, gray, w, h, ink, cx(i));
579
- if (!f || f.ch < f.charH * 0.45 || _chunkIOABX3GRcjs.bracketShape.call(void 0, f, false) !== "\u300C") continue;
578
+ const f = _chunkXYVTCXAGcjs.bracketFeatures.call(void 0, gray, w, h, ink, cx(i));
579
+ if (!f || f.ch < f.charH * 0.45 || _chunkXYVTCXAGcjs.bracketShape.call(void 0, f, false) !== "\u300C") continue;
580
580
  const rest = chars.slice(i + 1), end = rest.findIndex((c) => c === "'" || c === "\u300D" || c === ",");
581
581
  const pair = end >= 0 && rest[end] !== "'" && (rest[end] === "\u300D" || (() => {
582
- const g = _chunkIOABX3GRcjs.bracketFeatures.call(void 0, gray, w, h, ink, cx(i + 1 + end));
583
- return !!g && _chunkIOABX3GRcjs.bracketShape.call(void 0, g, true) === "\u300D";
582
+ const g = _chunkXYVTCXAGcjs.bracketFeatures.call(void 0, gray, w, h, ink, cx(i + 1 + end));
583
+ return !!g && _chunkXYVTCXAGcjs.bracketShape.call(void 0, g, true) === "\u300D";
584
584
  })());
585
585
  if (pair) chars[i] = "\u300C";
586
586
  }
@@ -588,8 +588,8 @@ function cornerQuotes({ chars, cx, gray, w, h, ink }) {
588
588
  function brackets({ chars, cx, gray, w, h, ink }) {
589
589
  const shape = chars.map((c, i) => {
590
590
  if (c !== "[" && c !== "]") return null;
591
- const f = _chunkIOABX3GRcjs.bracketFeatures.call(void 0, gray, w, h, ink, cx(i));
592
- return f && _chunkIOABX3GRcjs.bracketShape.call(void 0, f, c === "]");
591
+ const f = _chunkXYVTCXAGcjs.bracketFeatures.call(void 0, gray, w, h, ink, cx(i));
592
+ return f && _chunkXYVTCXAGcjs.bracketShape.call(void 0, f, c === "]");
593
593
  });
594
594
  for (let i = 0; i < chars.length; i++) {
595
595
  if (chars[i] !== "[") continue;
@@ -621,7 +621,7 @@ function quotes({ chars, cx, gray, w, h, ink }) {
621
621
  continue;
622
622
  }
623
623
  if (!year(i) && !single[kind]) continue;
624
- const r = _chunkIOABX3GRcjs.quoteHead.call(void 0, gray, w, h, ink, cx(i));
624
+ const r = _chunkXYVTCXAGcjs.quoteHead.call(void 0, gray, w, h, ink, cx(i));
625
625
  if (r !== null && r >= 0.47) {
626
626
  chars[i] = kind === "'" ? "\u2018" : "\u201C";
627
627
  open[kind] = true;
@@ -632,7 +632,7 @@ function dashes({ chars, cx, gray, w, h, ink }) {
632
632
  const head = chars.findIndex((c) => c.trim()), letters = chars.some((c) => /[가-힣A-Za-z]/.test(c));
633
633
  for (let i = 0; i < chars.length; i++) {
634
634
  if (!/^[-\u2013\u2014]$/.test(chars[i])) continue;
635
- const r = _chunkIOABX3GRcjs.dashRatio.call(void 0, gray, w, h, ink, cx(i));
635
+ const r = _chunkXYVTCXAGcjs.dashRatio.call(void 0, gray, w, h, ink, cx(i));
636
636
  if (r === null) continue;
637
637
  if (r < 0.65) chars[i] = "-";
638
638
  else if (r > 0.75 && i === head && letters) chars[i] = "\u2014";
@@ -641,7 +641,7 @@ function dashes({ chars, cx, gray, w, h, ink }) {
641
641
  function circled({ chars, cx, gray, w, h, ink }) {
642
642
  const at = chars.flatMap((c, i) => /^[1-9]$/.test(c) && !/\d/.test(_nullishCoalesce(chars[i - 1], () => ( ""))) && !/\d/.test(_nullishCoalesce(chars[i + 1], () => ( ""))) ? [i] : []);
643
643
  if (!at.length) return;
644
- const hit = _chunkIOABX3GRcjs.circledAt.call(void 0, gray, w, h, ink, at.map(cx));
644
+ const hit = _chunkXYVTCXAGcjs.circledAt.call(void 0, gray, w, h, ink, at.map(cx));
645
645
  at.forEach((i, k) => {
646
646
  if (hit[k]) chars[i] = String.fromCharCode(9311 + Number(chars[i]));
647
647
  });
@@ -651,16 +651,16 @@ function stars({ chars, cx, gray, w, h, ink }) {
651
651
  if (chars[i] !== "*" || chars[i - 1] === "*") continue;
652
652
  let e = i;
653
653
  while (chars[e + 1] === "*") e++;
654
- const n = _chunkIOABX3GRcjs.starRun.call(void 0, gray, w, h, ink, cx(i));
654
+ const n = _chunkXYVTCXAGcjs.starRun.call(void 0, gray, w, h, ink, cx(i));
655
655
  if (n > e - i + 1 && n <= 4) chars[e] += "*".repeat(n - (e - i + 1));
656
656
  i = e;
657
657
  }
658
658
  }
659
659
  function discs({ chars, cx, gray, w, h, ink }) {
660
- for (let i = 0; i < chars.length; i++) if (/^[\u00b7\u2022]$/.test(chars[i]) && _chunkIOABX3GRcjs.discAt.call(void 0, gray, w, h, ink, cx(i))) chars[i] = "\u25CF";
660
+ for (let i = 0; i < chars.length; i++) if (/^[\u00b7\u2022]$/.test(chars[i]) && _chunkXYVTCXAGcjs.discAt.call(void 0, gray, w, h, ink, cx(i))) chars[i] = "\u25CF";
661
661
  }
662
662
  function gaps({ chars, cx, gray, w, h, ink }) {
663
- const { glyphs, bandH } = _chunkIOABX3GRcjs.gapGlyphs.call(void 0, gray, w, h, ink);
663
+ const { glyphs, bandH } = _chunkXYVTCXAGcjs.gapGlyphs.call(void 0, gray, w, h, ink);
664
664
  if (!glyphs.length) return;
665
665
  const live = chars.map((c, i) => i).filter((i) => chars[i].trim());
666
666
  if (!live.length) return;
@@ -731,18 +731,18 @@ function ring({ chars, cx, gray, w, h, ink }) {
731
731
  const rest = chars.slice(k + 1).join("").trimStart();
732
732
  const live = chars.map((c, i) => i).filter((i) => chars[i].trim());
733
733
  if (live.length <= 3 && live.every((i) => /^[Oo]$/.test(chars[i]))) {
734
- if (_optionalChain([_chunkIOABX3GRcjs.leadingBullet.call(void 0, gray, w, h, ink, cx(live[0])), 'optionalAccess', _7 => _7.mark]) === "\u25CE") return false;
735
- if (!live.every((i) => _chunkIOABX3GRcjs.ringBullet.call(void 0, gray, w, h, ink, cx(i)) === "\u25CB")) return false;
734
+ if (_optionalChain([_chunkXYVTCXAGcjs.leadingBullet.call(void 0, gray, w, h, ink, cx(live[0])), 'optionalAccess', _7 => _7.mark]) === "\u25CE") return false;
735
+ if (!live.every((i) => _chunkXYVTCXAGcjs.ringBullet.call(void 0, gray, w, h, ink, cx(i)) === "\u25CB")) return false;
736
736
  for (const i of live) chars[i] = "\u25CB";
737
737
  return true;
738
738
  }
739
739
  if (/^[A-Z]{2,}/.test(rest) && /^[Oo0]$/.test(chars[k])) {
740
- if (_chunkIOABX3GRcjs.ringBullet.call(void 0, gray, w, h, ink, cx(k)) !== "\u25CB") return false;
740
+ if (_chunkXYVTCXAGcjs.ringBullet.call(void 0, gray, w, h, ink, cx(k)) !== "\u25CB") return false;
741
741
  chars[k] = chars[k + 1] === " " ? "\u25CB" : "\u25CB ";
742
742
  return true;
743
743
  }
744
744
  if (!/^[(\[「【<]?\d*[가-힣]/.test(rest)) return false;
745
- const r = _chunkIOABX3GRcjs.ringBullet.call(void 0, gray, w, h, ink, cx(k));
745
+ const r = _chunkXYVTCXAGcjs.ringBullet.call(void 0, gray, w, h, ink, cx(k));
746
746
  if (/^[Cc]$/.test(chars[k]) && r !== "\u25CB") return false;
747
747
  if (r) chars[k] = r;
748
748
  return r !== null;
@@ -759,7 +759,7 @@ function parallels({ chars, cx, gray, w, h, ink }) {
759
759
  let p = s - 1, q = e + 1;
760
760
  while (p >= 0 && !chars[p].trim()) p--;
761
761
  while (q < chars.length && !chars[q].trim()) q++;
762
- if (_chunkIOABX3GRcjs.slantedPair.call(void 0, gray, w, h, ink, p >= 0 ? cx(p) : -Infinity, q < chars.length ? cx(q) : Infinity)) {
762
+ if (_chunkXYVTCXAGcjs.slantedPair.call(void 0, gray, w, h, ink, p >= 0 ? cx(p) : -Infinity, q < chars.length ? cx(q) : Infinity)) {
763
763
  chars[s] = "\u2225";
764
764
  for (let k = s + 1; k <= e; k++) chars[k] = "";
765
765
  }
@@ -771,7 +771,7 @@ function roman({ chars, cx, gray, w, h, ink }) {
771
771
  const ROMAN = /^[IⅠ-Ⅲ]$/, LATIN = /[A-Za-z]$/;
772
772
  for (let i = 0; i < chars.length; i++) {
773
773
  if (chars[i] !== "1" || /[\dA-Za-z]$/.test(_nullishCoalesce(chars[i - 1], () => ( ""))) || /^[\dA-Za-z,]/.test(_nullishCoalesce(chars[i + 1], () => ( "")))) continue;
774
- if (_chunkIOABX3GRcjs.serifOne.call(void 0, gray, w, h, ink, cx(i))) chars[i] = "\u2160";
774
+ if (_chunkXYVTCXAGcjs.serifOne.call(void 0, gray, w, h, ink, cx(i))) chars[i] = "\u2160";
775
775
  }
776
776
  for (let i = 0; i < chars.length; i++) {
777
777
  const hangul = /^[파피]$/.test(chars[i]);
@@ -781,13 +781,13 @@ function roman({ chars, cx, gray, w, h, ink }) {
781
781
  while (q < chars.length && !chars[q].trim()) q++;
782
782
  const glued = hangul ? chars[p] === "(" && chars[q] === "-" : /[가-힣]$/.test(_nullishCoalesce(chars[i - 1], () => ( ""))) || (_nullishCoalesce(chars[i + 1], () => ( ""))) === "." || chars[p] === "-" && chars[q] === "-";
783
783
  if (!glued) continue;
784
- const n = _chunkIOABX3GRcjs.romanStems.call(void 0, gray, w, h, ink, p >= 0 ? cx(p) : -Infinity, q < chars.length ? cx(q) : Infinity, /[가-힣]$/.test(_nullishCoalesce(chars[p], () => ( ""))));
784
+ const n = _chunkXYVTCXAGcjs.romanStems.call(void 0, gray, w, h, ink, p >= 0 ? cx(p) : -Infinity, q < chars.length ? cx(q) : Infinity, /[가-힣]$/.test(_nullishCoalesce(chars[p], () => ( ""))));
785
785
  if (n) chars[i] = String.fromCharCode(8543 + n);
786
786
  }
787
787
  const inRoman = (i) => ROMAN.test(chars[i]) || chars[i] === "1" && (ROMAN.test(_nullishCoalesce(chars[i - 1], () => ( ""))) || ROMAN.test(_nullishCoalesce(chars[i + 1], () => ( ""))));
788
788
  const k = chars.findIndex((c) => c.trim());
789
789
  if (chars[k] === "." && chars.slice(k + 1).some((c) => /[가-힣A-Za-z0-9]/.test(c))) {
790
- const n = _chunkIOABX3GRcjs.romanStems.call(void 0, gray, w, h, ink, -Infinity, cx(k));
790
+ const n = _chunkXYVTCXAGcjs.romanStems.call(void 0, gray, w, h, ink, -Infinity, cx(k));
791
791
  if (n) chars[k] = String.fromCharCode(8543 + n) + chars[k];
792
792
  }
793
793
  for (let s = 0; s < chars.length; ) {
@@ -805,7 +805,7 @@ function roman({ chars, cx, gray, w, h, ink }) {
805
805
  let p = s - 1, q = e;
806
806
  while (p >= 0 && !chars[p].trim()) p--;
807
807
  while (q < chars.length && !chars[q].trim()) q++;
808
- const n = _chunkIOABX3GRcjs.romanStems.call(void 0, gray, w, h, ink, p >= 0 ? cx(p) : -Infinity, q < chars.length ? cx(q) : Infinity, /[가-힣]$/.test(_nullishCoalesce(chars[p], () => ( ""))));
808
+ const n = _chunkXYVTCXAGcjs.romanStems.call(void 0, gray, w, h, ink, p >= 0 ? cx(p) : -Infinity, q < chars.length ? cx(q) : Infinity, /[가-힣]$/.test(_nullishCoalesce(chars[p], () => ( ""))));
809
809
  const canon = n ? [["\u2160", "I"], ["\u2161", "II"], ["\u2162", "III"]][n - 1] : null;
810
810
  if (canon && !canon.includes(tok)) {
811
811
  chars[s] = canon[0];
@@ -1058,7 +1058,8 @@ var DEFAULT_OCR_TUNING = Object.freeze({
1058
1058
  minInkContrast: 35,
1059
1059
  postprocess: true,
1060
1060
  tightBoxes: true,
1061
- splitLeaders: true
1061
+ splitLeaders: true,
1062
+ orientPage: true
1062
1063
  });
1063
1064
  var DET_MIN_SIZE = 3;
1064
1065
  var DET_MAX_BOXES = 3e3;
@@ -1066,6 +1067,11 @@ var REC_MIN_WIDTH = 320;
1066
1067
  var REC_BATCH_MAX_PIXELS = 48 * 16e3;
1067
1068
  var TALL_RATIO = 1.5;
1068
1069
  var ROTATE_RATIO = 3;
1070
+ var ORIENT_MIN_BOXES = 20;
1071
+ var ORIENT_TALL_SHARE = 0.6;
1072
+ var ORIENT_SAMPLE = 12;
1073
+ var ORIENT_MIN_CONF = 0.7;
1074
+ var ORIENT_GAIN = 0.1;
1069
1075
  var KEEP_MARGIN = 0.06;
1070
1076
  var RETRY_SCORE = 0.9;
1071
1077
  var LEADER_MIN_DOTS = 4;
@@ -1180,8 +1186,8 @@ function joinGapLeaders(rgba, width, items) {
1180
1186
  if (g1 - g0 < h * 3) continue;
1181
1187
  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));
1182
1188
  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 };
1183
- const gray = _chunkIOABX3GRcjs.grayCrop.call(void 0, rgba, width, box);
1184
- const runs = _chunkIOABX3GRcjs.leaderRuns.call(void 0, gray, box.w, box.h, _chunkIOABX3GRcjs.inkStats.call(void 0, gray), LEADER_MIN_DOTS);
1189
+ const gray = _chunkXYVTCXAGcjs.grayCrop.call(void 0, rgba, width, box);
1190
+ const runs = _chunkXYVTCXAGcjs.leaderRuns.call(void 0, gray, box.w, box.h, _chunkXYVTCXAGcjs.inkStats.call(void 0, gray), LEADER_MIN_DOTS);
1185
1191
  const cover = runs.reduce((k, [a, b]) => k + Math.max(0, Math.min(b, g1 - box.x) - Math.max(a, g0 - box.x)), 0);
1186
1192
  if (cover < (g1 - g0) * 0.6) continue;
1187
1193
  for (const o of items) if (junk(o) && sameLine(o, num) && o.x >= g0 - 2 && o.x + o.w <= g1 + 2) gone.add(o);
@@ -1448,7 +1454,7 @@ var OcrEngine = class _OcrEngine {
1448
1454
  this.ort = parts.ort;
1449
1455
  this.sharp = parts.sharp;
1450
1456
  }
1451
- static async create(models = _chunkIOABX3GRcjs.DEFAULT_OCR_MODELS) {
1457
+ static async create(models = _chunkXYVTCXAGcjs.DEFAULT_OCR_MODELS) {
1452
1458
  _chunkTK3FDAEEcjs.disableOrtTelemetry.call(void 0, );
1453
1459
  const [ortMod, sharpModRaw] = await Promise.all([
1454
1460
  tryImport("onnxruntime-node", () => Promise.resolve().then(() => _interopRequireWildcard(require("onnxruntime-node")))),
@@ -1468,16 +1474,16 @@ var OcrEngine = class _OcrEngine {
1468
1474
  const local = (s) => "spec" in s ? Promise.resolve(null) : verifiedBytes(s);
1469
1475
  const [detBytes, recBytes, dictBytes] = await Promise.all([local(models.det), local(models.rec), local(models.dict)]);
1470
1476
  const session = (s, bytes) => bytes ? ortMod.InferenceSession.create(bytes, sessionOpts).catch(() => {
1471
- throw new (0, _chunkQWYIYVIZcjs.KordocError)(`OCR \uBAA8\uB378\uC744 \uC5F4\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: ${_path.basename.call(void 0, _chunkIOABX3GRcjs.ocrSourcePath.call(void 0, s))} \u2014 ONNX \uBAA8\uB378\uC774 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB410\uC2B5\uB2C8\uB2E4`);
1472
- }) : ortMod.InferenceSession.create(_chunkIOABX3GRcjs.ocrSourcePath.call(void 0, s), sessionOpts);
1477
+ throw new (0, _chunkMANE7HAZcjs.KordocError)(`OCR \uBAA8\uB378\uC744 \uC5F4\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: ${_path.basename.call(void 0, _chunkXYVTCXAGcjs.ocrSourcePath.call(void 0, s))} \u2014 ONNX \uBAA8\uB378\uC774 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB410\uC2B5\uB2C8\uB2E4`);
1478
+ }) : ortMod.InferenceSession.create(_chunkXYVTCXAGcjs.ocrSourcePath.call(void 0, s), sessionOpts);
1473
1479
  const [det, rec, dictYml] = await Promise.all([
1474
1480
  session(models.det, detBytes),
1475
1481
  session(models.rec, recBytes),
1476
- dictBytes ? new TextDecoder().decode(dictBytes) : _promises.readFile.call(void 0, _chunkIOABX3GRcjs.ocrSourcePath.call(void 0, models.dict), "utf-8")
1482
+ dictBytes ? new TextDecoder().decode(dictBytes) : _promises.readFile.call(void 0, _chunkXYVTCXAGcjs.ocrSourcePath.call(void 0, models.dict), "utf-8")
1477
1483
  ]);
1478
- const dict = _chunkIOABX3GRcjs.parseCharacterDict.call(void 0, dictYml);
1484
+ const dict = _chunkXYVTCXAGcjs.parseCharacterDict.call(void 0, dictYml);
1479
1485
  if (dict.length === 0) {
1480
- 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, _chunkQWYIYVIZcjs.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`);
1486
+ 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, _chunkMANE7HAZcjs.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`);
1481
1487
  }
1482
1488
  return new _OcrEngine({ det, rec, dict, ort: ortMod, sharp: sharpMod });
1483
1489
  }
@@ -1509,10 +1515,10 @@ var OcrEngine = class _OcrEngine {
1509
1515
  if (it.x - x < it.h * 0.8) return;
1510
1516
  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;
1511
1517
  const box = { x, y: it.y, w: it.x + it.w - x, h: it.h };
1512
- const g = _chunkIOABX3GRcjs.grayCrop.call(void 0, rgba, width, box);
1513
- const b = _chunkIOABX3GRcjs.leadingBullet.call(void 0, g, box.w, box.h, _chunkIOABX3GRcjs.inkStats.call(void 0, g), it.x - x, 1.05);
1518
+ const g = _chunkXYVTCXAGcjs.grayCrop.call(void 0, rgba, width, box);
1519
+ const b = _chunkXYVTCXAGcjs.leadingBullet.call(void 0, g, box.w, box.h, _chunkXYVTCXAGcjs.inkStats.call(void 0, g), it.x - x, 1.05);
1514
1520
  if (_optionalChain([b, 'optionalAccess', _32 => _32.mark]) !== "\u25A1" || b.covers) return;
1515
- const ink = _chunkIOABX3GRcjs.inkStats.call(void 0, g), on = (v) => ink.darkInk ? v <= ink.threshold : v > ink.threshold;
1521
+ const ink = _chunkXYVTCXAGcjs.inkStats.call(void 0, g), on = (v) => ink.darkInk ? v <= ink.threshold : v > ink.threshold;
1516
1522
  let left = 0;
1517
1523
  while (left < it.x - x && !Array.from({ length: box.h }, (_, y) => g[y * box.w + left]).some(on)) left++;
1518
1524
  it.text = "\u25A1 " + it.text;
@@ -1522,6 +1528,21 @@ var OcrEngine = class _OcrEngine {
1522
1528
  async recognizePage(rgba, width, height, stats, tuning = DEFAULT_OCR_TUNING, cellRules = [], rowRules = []) {
1523
1529
  if (width < DET_MIN_SIZE || height < DET_MIN_SIZE) return [];
1524
1530
  const detected = await this.detect(rgba, width, height, tuning, stats);
1531
+ if (tuning.orientPage && stats && detected.length >= ORIENT_MIN_BOXES) {
1532
+ const tall = detected.filter((b) => b.h >= b.w * TALL_RATIO);
1533
+ if (tall.length >= detected.length * ORIENT_TALL_SHARE) {
1534
+ const sample = [...tall].sort((a, b) => b.h - a.h).slice(0, ORIENT_SAMPLE);
1535
+ const rots = [0, 90, 270];
1536
+ const probe = await this.recognizeJobs(rgba, width, sample.flatMap((box, group2) => rots.map((rot) => ({ box, rot, group: group2 }))), tuning.recBatch);
1537
+ const mean = (k) => sample.reduce((sum, _, i) => sum + (_nullishCoalesce(_optionalChain([probe, 'access', _33 => _33[i * rots.length + k], 'optionalAccess', _34 => _34.confidence]), () => ( 0))), 0) / sample.length;
1538
+ const [m0, m90, m270] = rots.map((_, k) => mean(k));
1539
+ const best2 = Math.max(m90, m270);
1540
+ if (best2 >= ORIENT_MIN_CONF && best2 >= m0 + ORIENT_GAIN) {
1541
+ stats.pageRotation = m90 >= m270 ? 90 : 270;
1542
+ return [];
1543
+ }
1544
+ }
1545
+ }
1525
1546
  const rows = rowRules.length ? detected.flatMap((b) => splitBoxAtRowRules(b, rowRules)) : detected;
1526
1547
  const boxes = cellRules.length ? rows.flatMap((b) => splitBoxAtCellRules(b, cellRules)) : rows;
1527
1548
  const footer = tuning.postprocess ? footerInkBox(rgba, width, height, boxes) : null;
@@ -1529,12 +1550,12 @@ var OcrEngine = class _OcrEngine {
1529
1550
  const joins = [];
1530
1551
  let group = 0;
1531
1552
  for (const b of boxes) {
1532
- const gray = _chunkIOABX3GRcjs.grayCrop.call(void 0, rgba, width, b);
1533
- const ink = _chunkIOABX3GRcjs.inkStats.call(void 0, gray);
1553
+ const gray = _chunkXYVTCXAGcjs.grayCrop.call(void 0, rgba, width, b);
1554
+ const ink = _chunkXYVTCXAGcjs.inkStats.call(void 0, gray);
1534
1555
  if (tuning.minInkContrast > 0 && ink.contrast < tuning.minInkContrast) continue;
1535
1556
  if (tuning.minInkContrast > 0 && ink.inkRatio < MIN_INK_RATIO) continue;
1536
1557
  if (tuning.splitTall && b.h >= b.w * TALL_RATIO) {
1537
- const bands = _chunkIOABX3GRcjs.splitRowBands.call(void 0, gray, b.w, b.h, ink, 0.45);
1558
+ const bands = _chunkXYVTCXAGcjs.splitRowBands.call(void 0, gray, b.w, b.h, ink, 0.45);
1538
1559
  if (bands.length >= 2) {
1539
1560
  for (const sub of bandBoxes(b, bands, height)) jobs.push({ box: sub, rot: 0, group: group++ });
1540
1561
  continue;
@@ -1545,9 +1566,9 @@ var OcrEngine = class _OcrEngine {
1545
1566
  continue;
1546
1567
  }
1547
1568
  }
1548
- const trim = tuning.trimEdges ? _chunkIOABX3GRcjs.edgeTrim.call(void 0, gray, b.w, b.h, ink) : null;
1569
+ const trim = tuning.trimEdges ? _chunkXYVTCXAGcjs.edgeTrim.call(void 0, gray, b.w, b.h, ink) : null;
1549
1570
  const keep = trim ? { ...trim, bg: median(gray) } : void 0;
1550
- const leaders = tuning.splitLeaders ? _chunkIOABX3GRcjs.leaderRuns.call(void 0, gray, b.w, b.h, ink, LEADER_MIN_DOTS) : [];
1571
+ const leaders = tuning.splitLeaders ? _chunkXYVTCXAGcjs.leaderRuns.call(void 0, gray, b.w, b.h, ink, LEADER_MIN_DOTS) : [];
1551
1572
  if (leaders.length) {
1552
1573
  const join = joins.length;
1553
1574
  joins.push({ box: b, parts: [], trailDots: false });
@@ -1556,7 +1577,7 @@ var OcrEngine = class _OcrEngine {
1556
1577
  const bare = { x: b.x + x0, y: b.y, w: a - x0, h: b.h };
1557
1578
  const end = c > a ? Math.min(c, a + Math.round(b.h * LEADER_CONTEXT)) : a;
1558
1579
  x0 = c;
1559
- if (bare.w >= DET_MIN_SIZE && _chunkIOABX3GRcjs.inkStats.call(void 0, _chunkIOABX3GRcjs.grayCrop.call(void 0, rgba, width, bare)).contrast >= Math.max(1, tuning.minInkContrast)) {
1580
+ if (bare.w >= DET_MIN_SIZE && _chunkXYVTCXAGcjs.inkStats.call(void 0, _chunkXYVTCXAGcjs.grayCrop.call(void 0, rgba, width, bare)).contrast >= Math.max(1, tuning.minInkContrast)) {
1560
1581
  jobs.push({ box: { ...bare, w: end - (bare.x - b.x) }, rot: 0, group: group++, join, dotsBefore: dots, trimDots: end > a });
1561
1582
  dots = false;
1562
1583
  }
@@ -1594,40 +1615,40 @@ var OcrEngine = class _OcrEngine {
1594
1615
  let text = tuning.postprocess ? restoreSymbols(raw.trim(), note.ringLead) : raw;
1595
1616
  if (!text.trim()) continue;
1596
1617
  if (tuning.postprocess && job.rot === 0 && text !== "/" && /^[(:;/)]+$/.test(text) && text.includes("/")) {
1597
- const g = _chunkIOABX3GRcjs.grayCrop.call(void 0, rgba, width, job.box);
1598
- if (_chunkIOABX3GRcjs.tallInkCount.call(void 0, g, job.box.w, job.box.h, _chunkIOABX3GRcjs.inkStats.call(void 0, g)) === 1) text = "/";
1618
+ const g = _chunkXYVTCXAGcjs.grayCrop.call(void 0, rgba, width, job.box);
1619
+ if (_chunkXYVTCXAGcjs.tallInkCount.call(void 0, g, job.box.w, job.box.h, _chunkXYVTCXAGcjs.inkStats.call(void 0, g)) === 1) text = "/";
1599
1620
  }
1600
1621
  let ringByShape = false;
1601
1622
  if (tuning.postprocess && job.rot === 0 && !/^[◎●▪□■▣❐❏○ㅇ◆◇◈]/.test(text)) {
1602
1623
  const chars = [...read], k = chars.findIndex((c) => c.trim());
1603
1624
  if (k >= 0 && steps.length === chars.length) {
1604
- const g = _chunkIOABX3GRcjs.grayCrop.call(void 0, rgba, width, job.box);
1605
- const b = _chunkIOABX3GRcjs.leadingBullet.call(void 0, g, job.box.w, job.box.h, _chunkIOABX3GRcjs.inkStats.call(void 0, g), (steps[k] + 0.5) * stepPx);
1625
+ const g = _chunkXYVTCXAGcjs.grayCrop.call(void 0, rgba, width, job.box);
1626
+ const b = _chunkXYVTCXAGcjs.leadingBullet.call(void 0, g, job.box.w, job.box.h, _chunkXYVTCXAGcjs.inkStats.call(void 0, g), (steps[k] + 0.5) * stepPx);
1606
1627
  const body = (_nullishCoalesce(text.match(/[가-힣]/g), () => ( []))).length >= 4;
1607
1628
  const miss = /^[Oo0•·ㆍ∙‧○]/.test(text);
1608
- if (_optionalChain([b, 'optionalAccess', _33 => _33.mark]) === "\u25CE" && b.covers && /^[Oo0○©]/.test(text)) {
1629
+ if (_optionalChain([b, 'optionalAccess', _35 => _35.mark]) === "\u25CE" && b.covers && /^[Oo0○©]/.test(text)) {
1609
1630
  text = b.mark + " " + text.slice(1).trimStart();
1610
1631
  ringByShape = true;
1611
- } else if (_optionalChain([b, 'optionalAccess', _34 => _34.mark]) === "\u25A1" || _optionalChain([b, 'optionalAccess', _35 => _35.mark]) === "\u25A3") {
1632
+ } else if (_optionalChain([b, 'optionalAccess', _36 => _36.mark]) === "\u25A1" || _optionalChain([b, 'optionalAccess', _37 => _37.mark]) === "\u25A3") {
1612
1633
  if (!b.covers && body) text = b.mark + " " + text;
1613
- } else if (_optionalChain([b, 'optionalAccess', _36 => _36.mark]) === "\u25C6" || _optionalChain([b, 'optionalAccess', _37 => _37.mark]) === "\u25C7" || _optionalChain([b, 'optionalAccess', _38 => _38.mark]) === "\u25C8") {
1634
+ } else if (_optionalChain([b, 'optionalAccess', _38 => _38.mark]) === "\u25C6" || _optionalChain([b, 'optionalAccess', _39 => _39.mark]) === "\u25C7" || _optionalChain([b, 'optionalAccess', _40 => _40.mark]) === "\u25C8") {
1614
1635
  if (b.covers ? /^[\p{S}\p{P}]/u.test(text) : body) text = b.covers ? b.mark + " " + text.slice(1).trimStart() : b.mark + " " + text;
1615
- } else if (_optionalChain([b, 'optionalAccess', _39 => _39.mark]) === "\u2023") {
1636
+ } else if (_optionalChain([b, 'optionalAccess', _41 => _41.mark]) === "\u2023") {
1616
1637
  if (b.covers ? text.startsWith("\u2192") : body) text = b.covers ? b.mark + " " + text.slice(1).trimStart() : b.mark + " " + text;
1617
- } else if (_optionalChain([b, 'optionalAccess', _40 => _40.mark]) === "\u2750" || _optionalChain([b, 'optionalAccess', _41 => _41.mark]) === "\u274F") {
1638
+ } else if (_optionalChain([b, 'optionalAccess', _42 => _42.mark]) === "\u2750" || _optionalChain([b, 'optionalAccess', _43 => _43.mark]) === "\u274F") {
1618
1639
  if (b.covers ? /^[ㅁ口]/.test(text) : body) text = b.covers ? b.mark + text.slice(1) : b.mark + " " + text;
1619
1640
  } else if (b && b.mark !== "\u25CE" && body) text = b.covers ? miss ? b.mark + " " + text.slice(1).trimStart() : text : b.mark + " " + text;
1620
- else if (!b && body && /^[가-힣]/.test(chars[k]) && _chunkIOABX3GRcjs.leadingRing.call(void 0, g, job.box.w, job.box.h, _chunkIOABX3GRcjs.inkStats.call(void 0, g), (steps[k] + 0.5) * stepPx)) text = "\u25CB " + text;
1641
+ else if (!b && body && /^[가-힣]/.test(chars[k]) && _chunkXYVTCXAGcjs.leadingRing.call(void 0, g, job.box.w, job.box.h, _chunkXYVTCXAGcjs.inkStats.call(void 0, g), (steps[k] + 0.5) * stepPx)) text = "\u25CB " + text;
1621
1642
  }
1622
1643
  }
1623
1644
  if (tuning.postprocess && /^\d/.test(text) && job.rot === 0) {
1624
- const g = _chunkIOABX3GRcjs.grayCrop.call(void 0, rgba, width, job.box);
1625
- const tri = _chunkIOABX3GRcjs.leadingTriangle.call(void 0, g, job.box.w, job.box.h, _chunkIOABX3GRcjs.inkStats.call(void 0, g));
1645
+ const g = _chunkXYVTCXAGcjs.grayCrop.call(void 0, rgba, width, job.box);
1646
+ const tri = _chunkXYVTCXAGcjs.leadingTriangle.call(void 0, g, job.box.w, job.box.h, _chunkXYVTCXAGcjs.inkStats.call(void 0, g));
1626
1647
  if (tri) text = tri + text;
1627
1648
  }
1628
1649
  if (tuning.postprocess && text === "\u2192" && job.rot === 0 && job.join === void 0) {
1629
- const g = _chunkIOABX3GRcjs.grayCrop.call(void 0, rgba, width, job.box);
1630
- text = _nullishCoalesce(_chunkIOABX3GRcjs.arrowGlyph.call(void 0, g, job.box.w, job.box.h, _chunkIOABX3GRcjs.inkStats.call(void 0, g)), () => ( text));
1650
+ const g = _chunkXYVTCXAGcjs.grayCrop.call(void 0, rgba, width, job.box);
1651
+ text = _nullishCoalesce(_chunkXYVTCXAGcjs.arrowGlyph.call(void 0, g, job.box.w, job.box.h, _chunkXYVTCXAGcjs.inkStats.call(void 0, g)), () => ( text));
1631
1652
  }
1632
1653
  if (job.footer) {
1633
1654
  if (!/^[-\u2013\u2014]?\s*(?:\d{1,4}|[ivxIVXⅰ-ⅹⅠ-Ⅹ]{1,4})\s*[-\u2013\u2014]?$/.test(text.trim())) continue;
@@ -1638,7 +1659,7 @@ var OcrEngine = class _OcrEngine {
1638
1659
  if (tuning.postprocess && job.rot === 0 && job.join === void 0 && !job.footer) retry.push(job.box);
1639
1660
  if (stats) {
1640
1661
  stats.droppedLowConf++;
1641
- _optionalChain([stats, 'access', _42 => _42.dropped, 'optionalAccess', _43 => _43.push, 'call', _44 => _44({ text, ...this.itemBox(rgba, width, job.box, tuning), confidence })]);
1662
+ _optionalChain([stats, 'access', _44 => _44.dropped, 'optionalAccess', _45 => _45.push, 'call', _46 => _46({ text, ...this.itemBox(rgba, width, job.box, tuning), confidence })]);
1642
1663
  }
1643
1664
  continue;
1644
1665
  }
@@ -1648,14 +1669,14 @@ var OcrEngine = class _OcrEngine {
1648
1669
  continue;
1649
1670
  }
1650
1671
  const item = { text, ...this.itemBox(rgba, width, job.box, tuning), confidence };
1651
- if (job.rot === 0) _chunkIOABX3GRcjs.rememberOcrTextGaps.call(void 0, item, _chunkIOABX3GRcjs.findOcrTextGaps.call(void 0, rgba, width, job.box, read, text, steps, stepPx));
1672
+ if (job.rot === 0) _chunkXYVTCXAGcjs.rememberOcrTextGaps.call(void 0, item, _chunkXYVTCXAGcjs.findOcrTextGaps.call(void 0, rgba, width, job.box, read, text, steps, stepPx));
1652
1673
  items.push(item);
1653
1674
  }
1654
1675
  if (retry.length) {
1655
1676
  const subs = [];
1656
1677
  for (const b of retry) {
1657
- const gray = _chunkIOABX3GRcjs.grayCrop.call(void 0, rgba, width, b);
1658
- const cut = midBlankRow(gray, b.w, b.h, _chunkIOABX3GRcjs.inkStats.call(void 0, gray));
1678
+ const gray = _chunkXYVTCXAGcjs.grayCrop.call(void 0, rgba, width, b);
1679
+ const cut = midBlankRow(gray, b.w, b.h, _chunkXYVTCXAGcjs.inkStats.call(void 0, gray));
1659
1680
  if (cut && b.w >= 3 * Math.max(cut[0], b.h - cut[1])) subs.push({ ...b, h: cut[0] }, { ...b, y: b.y + cut[1], h: b.h - cut[1] });
1660
1681
  }
1661
1682
  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));
@@ -1697,16 +1718,16 @@ var OcrEngine = class _OcrEngine {
1697
1718
  if (tails.length) {
1698
1719
  const res = await this.recognizeJobs(rgba, width, tails.map((box, k) => ({ box, rot: 0, group: k })), tuning.recBatch);
1699
1720
  tails.forEach((box, k) => {
1700
- const t = _nullishCoalesce(_optionalChain([res, 'access', _45 => _45[k], 'optionalAccess', _46 => _46.text, 'access', _47 => _47.trim, 'call', _48 => _48()]), () => ( ""));
1701
- if (/^\d{1,4}$/.test(t) && (_nullishCoalesce(_optionalChain([res, 'access', _49 => _49[k], 'optionalAccess', _50 => _50.confidence]), () => ( 0))) >= tuning.textScore) items.push({ text: t, ...this.itemBox(rgba, width, box, tuning), confidence: res[k].confidence });
1721
+ const t = _nullishCoalesce(_optionalChain([res, 'access', _47 => _47[k], 'optionalAccess', _48 => _48.text, 'access', _49 => _49.trim, 'call', _50 => _50()]), () => ( ""));
1722
+ if (/^\d{1,4}$/.test(t) && (_nullishCoalesce(_optionalChain([res, 'access', _51 => _51[k], 'optionalAccess', _52 => _52.confidence]), () => ( 0))) >= tuning.textScore) items.push({ text: t, ...this.itemBox(rgba, width, box, tuning), confidence: res[k].confidence });
1702
1723
  });
1703
1724
  }
1704
1725
  const heads = rowHeadBoxes(rgba, width, items);
1705
1726
  if (heads.length) {
1706
1727
  const res = await this.recognizeJobs(rgba, width, heads.map((box, k) => ({ box, rot: 0, group: k })), tuning.recBatch);
1707
1728
  heads.forEach((box, k) => {
1708
- const t = _nullishCoalesce(_optionalChain([res, 'access', _51 => _51[k], 'optionalAccess', _52 => _52.text, 'access', _53 => _53.trim, 'call', _54 => _54()]), () => ( ""));
1709
- if (/^(?:[IVXⅠ-Ⅻ]{1,4}|\d{1,2})\s?\.$/.test(t) && (_nullishCoalesce(_optionalChain([res, 'access', _55 => _55[k], 'optionalAccess', _56 => _56.confidence]), () => ( 0))) >= tuning.textScore) items.push({ text: t, ...this.itemBox(rgba, width, box, tuning), confidence: res[k].confidence });
1729
+ const t = _nullishCoalesce(_optionalChain([res, 'access', _53 => _53[k], 'optionalAccess', _54 => _54.text, 'access', _55 => _55.trim, 'call', _56 => _56()]), () => ( ""));
1730
+ if (/^(?:[IVXⅠ-Ⅻ]{1,4}|\d{1,2})\s?\.$/.test(t) && (_nullishCoalesce(_optionalChain([res, 'access', _57 => _57[k], 'optionalAccess', _58 => _58.confidence]), () => ( 0))) >= tuning.textScore) items.push({ text: t, ...this.itemBox(rgba, width, box, tuning), confidence: res[k].confidence });
1710
1731
  });
1711
1732
  }
1712
1733
  }
@@ -1718,8 +1739,8 @@ var OcrEngine = class _OcrEngine {
1718
1739
  /** 결과 좌표 — det 박스 그대로 또는 박스 안 잉크 외곽 (tightBoxes) */
1719
1740
  itemBox(rgba, width, b, tuning) {
1720
1741
  if (!tuning.tightBoxes) return b;
1721
- const gray = _chunkIOABX3GRcjs.grayCrop.call(void 0, rgba, width, b);
1722
- const t = _chunkIOABX3GRcjs.inkBounds.call(void 0, gray, b.w, b.h, _chunkIOABX3GRcjs.inkStats.call(void 0, gray));
1742
+ const gray = _chunkXYVTCXAGcjs.grayCrop.call(void 0, rgba, width, b);
1743
+ const t = _chunkXYVTCXAGcjs.inkBounds.call(void 0, gray, b.w, b.h, _chunkXYVTCXAGcjs.inkStats.call(void 0, gray));
1723
1744
  return { x: b.x + t.x0, y: b.y + t.y0, w: t.x1 - t.x0, h: t.y1 - t.y0 };
1724
1745
  }
1725
1746
  // ─── det ─────────────────────────────────────────────
@@ -1792,7 +1813,7 @@ var OcrEngine = class _OcrEngine {
1792
1813
  const out = await this.rec.run({ [this.rec.inputNames[0]]: tensor });
1793
1814
  const logits = out[this.rec.outputNames[0]];
1794
1815
  const [, T, C] = logits.dims;
1795
- if (C !== this.dict.length + 2) throw new (0, _chunkQWYIYVIZcjs.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`);
1816
+ if (C !== this.dict.length + 2) throw new (0, _chunkMANE7HAZcjs.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`);
1796
1817
  const data = logits.data;
1797
1818
  idx.forEach((ci, k) => {
1798
1819
  const r = ctcDecode(data.subarray(k * T * C, (k + 1) * T * C), T, C, this.dict);
@@ -1802,9 +1823,9 @@ var OcrEngine = class _OcrEngine {
1802
1823
  const chars = r ? [...r.text] : [];
1803
1824
  if (r && job.rot === 0 && chars.length === r.steps.length && r.steps.some((t) => t > last) && !r.text.includes("(cid:")) {
1804
1825
  const tallCh = (c) => !/[\s.,:;\u00b7\u2026'"\u2018-\u201d`\-_~]/.test(c);
1805
- const g = _chunkIOABX3GRcjs.grayCrop.call(void 0, rgba, pageW, job.box);
1826
+ const g = _chunkXYVTCXAGcjs.grayCrop.call(void 0, rgba, pageW, job.box);
1806
1827
  const inside = chars.filter((c, i) => r.steps[i] <= last && tallCh(c)).length;
1807
- let budget = inside <= 2 ? _chunkIOABX3GRcjs.tallInkCount.call(void 0, g, job.box.w, job.box.h, _chunkIOABX3GRcjs.inkStats.call(void 0, g)) - inside : Infinity;
1828
+ let budget = inside <= 2 ? _chunkXYVTCXAGcjs.tallInkCount.call(void 0, g, job.box.w, job.box.h, _chunkXYVTCXAGcjs.inkStats.call(void 0, g)) - inside : Infinity;
1808
1829
  const keep = chars.map((c, i) => r.steps[i] <= last || !tallCh(c) || budget-- > 0);
1809
1830
  if (!keep.every(Boolean)) kept = { ...r, text: chars.filter((_, i) => keep[i]).join(""), steps: r.steps.filter((_, i) => keep[i]) };
1810
1831
  }
@@ -1915,13 +1936,13 @@ async function tryImport(name, loader) {
1915
1936
  return await loader();
1916
1937
  } catch (e) {
1917
1938
  throw new Error(
1918
- `\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.${_chunkQWYIYVIZcjs.OPTIONAL_DEP_INSTALL_HINT} \uC6D0\uC778: ${e.message}`
1939
+ `\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.${_chunkMANE7HAZcjs.OPTIONAL_DEP_INSTALL_HINT} \uC6D0\uC778: ${e.message}`
1919
1940
  );
1920
1941
  }
1921
1942
  }
1922
1943
  async function verifiedBytes(s) {
1923
1944
  const name = _path.basename.call(void 0, s.file.path);
1924
- const fail = (why2) => new (0, _chunkQWYIYVIZcjs.KordocError)(`OCR \uBAA8\uB378 \uD30C\uC77C\uC744 \uC77D\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: ${name} (${why2})`);
1945
+ const fail = (why2) => new (0, _chunkMANE7HAZcjs.KordocError)(`OCR \uBAA8\uB378 \uD30C\uC77C\uC744 \uC77D\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: ${name} (${why2})`);
1925
1946
  const why = (e) => {
1926
1947
  const code = e.code;
1927
1948
  return code === "ENOENT" ? "\uD30C\uC77C\uC774 \uC5C6\uC74C" : code === "EACCES" || code === "EPERM" ? "\uAD8C\uD55C \uC5C6\uC74C" : "\uC77D\uAE30 \uC2E4\uD328";
@@ -1942,13 +1963,13 @@ async function verifiedBytes(s) {
1942
1963
  }
1943
1964
  const actual = _crypto.createHash.call(void 0, "sha256").update(bytes).digest("hex");
1944
1965
  if (actual !== s.file.sha256) {
1945
- throw new (0, _chunkQWYIYVIZcjs.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)`);
1966
+ throw new (0, _chunkMANE7HAZcjs.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)`);
1946
1967
  }
1947
1968
  return bytes;
1948
1969
  }
1949
1970
  var engines = /* @__PURE__ */ new Map();
1950
- function getOcrEngine(models = _chunkIOABX3GRcjs.DEFAULT_OCR_MODELS) {
1951
- const key = _chunkIOABX3GRcjs.ocrSelectionKey.call(void 0, models);
1971
+ function getOcrEngine(models = _chunkXYVTCXAGcjs.DEFAULT_OCR_MODELS) {
1972
+ const key = _chunkXYVTCXAGcjs.ocrSelectionKey.call(void 0, models);
1952
1973
  let p = engines.get(key);
1953
1974
  if (!p) {
1954
1975
  p = OcrEngine.create(models).catch((err) => {
@@ -2015,6 +2036,20 @@ function deskewPage(rgba, width, height) {
2015
2036
  if (Math.abs(est.angle) < MIN_APPLY_DEG || est.gain < MIN_GAIN) return { rgba, angle: 0 };
2016
2037
  return { rgba: rotateRgba(rgba, width, height, est.angle), angle: est.angle };
2017
2038
  }
2039
+ function rotateQuarter(rgba, width, height, rot) {
2040
+ const out = new Uint8Array(rgba.length);
2041
+ for (let v = 0; v < width; v++) {
2042
+ for (let u = 0; u < height; u++) {
2043
+ const px = rot === 90 ? width - 1 - v : v, py = rot === 90 ? u : height - 1 - u;
2044
+ const o = (v * height + u) * 4, i = (py * width + px) * 4;
2045
+ out[o] = rgba[i];
2046
+ out[o + 1] = rgba[i + 1];
2047
+ out[o + 2] = rgba[i + 2];
2048
+ out[o + 3] = rgba[i + 3];
2049
+ }
2050
+ }
2051
+ return { rgba: out, width: height, height: width };
2052
+ }
2018
2053
  function rotateRgba(rgba, width, height, deg) {
2019
2054
  const out = new Uint8Array(rgba.length);
2020
2055
  const t = deg * Math.PI / 180;
@@ -2051,15 +2086,15 @@ function rotateRgba(rgba, width, height, deg) {
2051
2086
  var OCR_RENDER_SCALE = 3;
2052
2087
  var MAX_OCR_PIXELS = 24e6;
2053
2088
  var PAGE_TIMEOUT_MS = 12e4;
2054
- var DEFAULT_BUILTIN_OCR = Object.freeze({ models: _chunkIOABX3GRcjs.DEFAULT_OCR_MODELS, tuning: DEFAULT_OCR_TUNING });
2089
+ var DEFAULT_BUILTIN_OCR = Object.freeze({ models: _chunkXYVTCXAGcjs.DEFAULT_OCR_MODELS, tuning: DEFAULT_OCR_TUNING });
2055
2090
  function builtinOcrConfig(o) {
2056
2091
  if (!o || o.ocrDet === void 0 && o.ocrDetLongSide === void 0 && o.ocrRec === void 0 && o.ocrRecDict === void 0 && !o.ocrLines) return DEFAULT_BUILTIN_OCR;
2057
2092
  const bad = _chunkZTN3T3GHcjs.validateOcrOptions.call(void 0, o);
2058
- if (bad) throw new (0, _chunkQWYIYVIZcjs.KordocError)(bad);
2059
- const models = _chunkIOABX3GRcjs.resolveOcrModels.call(void 0, o);
2093
+ if (bad) throw new (0, _chunkMANE7HAZcjs.KordocError)(bad);
2094
+ const models = _chunkXYVTCXAGcjs.resolveOcrModels.call(void 0, o);
2060
2095
  return {
2061
2096
  models,
2062
- ...o.ocrRec === "auto" ? { handwriting: _chunkIOABX3GRcjs.handwritingFallbackModels.call(void 0, models) } : {},
2097
+ ...o.ocrRec === "auto" ? { handwriting: _chunkXYVTCXAGcjs.handwritingFallbackModels.call(void 0, models) } : {},
2063
2098
  tuning: o.ocrDetLongSide === void 0 ? DEFAULT_OCR_TUNING : { ...DEFAULT_OCR_TUNING, detLongSide: o.ocrDetLongSide },
2064
2099
  lines: o.ocrLines === "all" ? "all" : o.ocrLines ? "kept" : void 0
2065
2100
  };
@@ -2068,7 +2103,7 @@ var AUTO_REC_PAGE_CONF = 0.9;
2068
2103
  var AUTO_REC_GAIN = 0.06;
2069
2104
  async function recognizeOcrPage(engine, config, tuning, rgba, width, height, stats, cellRules, rowRules) {
2070
2105
  const items = await engine.recognizePage(rgba, width, height, stats, tuning, cellRules, rowRules);
2071
- if (!config.handwriting) return items;
2106
+ if (!config.handwriting || stats.pageRotation) return items;
2072
2107
  const base = meanConfidence(items);
2073
2108
  if (base >= AUTO_REC_PAGE_CONF) return items;
2074
2109
  const altStats = { droppedLowConf: 0, ...stats.dropped ? { dropped: [] } : {} };
@@ -2106,8 +2141,8 @@ async function runPdfOcr(buffer, targets, mode, warnings, onProgress, detectTabl
2106
2141
  "@hyzyla/pdfium",
2107
2142
  () => Promise.resolve().then(() => _interopRequireWildcard(require("@hyzyla/pdfium")))
2108
2143
  );
2109
- if (mode === "builtin") await _chunkIOABX3GRcjs.ensureOcrModelsFor.call(void 0, config.models, reportModelDownload);
2110
- if (mode === "builtin" && config.handwriting) await _chunkIOABX3GRcjs.ensureOcrModelsFor.call(void 0, config.handwriting, reportModelDownload);
2144
+ if (mode === "builtin") await _chunkXYVTCXAGcjs.ensureOcrModelsFor.call(void 0, config.models, reportModelDownload);
2145
+ if (mode === "builtin" && config.handwriting) await _chunkXYVTCXAGcjs.ensureOcrModelsFor.call(void 0, config.handwriting, reportModelDownload);
2111
2146
  const engine = mode === "builtin" ? await getOcrEngine(config.models) : null;
2112
2147
  const pdfium = await pdfiumMod.PDFiumLibrary.init();
2113
2148
  const doc = await pdfium.loadDocument(new Uint8Array(buffer));
@@ -2116,15 +2151,15 @@ async function runPdfOcr(buffer, targets, mode, warnings, onProgress, detectTabl
2116
2151
  const count = doc.getPageCount();
2117
2152
  for (const pageNo of [...targets].filter((p) => p >= 1 && p <= count).sort((a, b) => a - b)) {
2118
2153
  const page = doc.getPage(pageNo - 1);
2119
- _optionalChain([onProgress, 'optionalCall', _57 => _57(++done, targets.size)]);
2154
+ _optionalChain([onProgress, 'optionalCall', _59 => _59(++done, targets.size)]);
2120
2155
  try {
2121
2156
  const { blocks, lines } = await withTimeout(
2122
- ocrOnePage(page, pageNo, mode, engine, warnings, detectTables, _optionalChain([vectorOps, 'optionalAccess', _58 => _58.get, 'call', _59 => _59(pageNo)]), _optionalChain([imageRegions, 'optionalAccess', _60 => _60.get, 'call', _61 => _61(pageNo)]), config),
2157
+ ocrOnePage(page, pageNo, mode, engine, warnings, detectTables, _optionalChain([vectorOps, 'optionalAccess', _60 => _60.get, 'call', _61 => _61(pageNo)]), _optionalChain([imageRegions, 'optionalAccess', _62 => _62.get, 'call', _63 => _63(pageNo)]), config),
2123
2158
  PAGE_TIMEOUT_MS,
2124
2159
  `OCR \uD398\uC774\uC9C0 ${pageNo} \uD0C0\uC784\uC544\uC6C3 (${PAGE_TIMEOUT_MS / 1e3}\uCD08)`
2125
2160
  );
2126
2161
  result.set(pageNo, blocks);
2127
- if (lines) _optionalChain([linesOut, 'optionalAccess', _62 => _62.set, 'call', _63 => _63(pageNo, lines)]);
2162
+ if (lines) _optionalChain([linesOut, 'optionalAccess', _64 => _64.set, 'call', _65 => _65(pageNo, lines)]);
2128
2163
  } catch (e) {
2129
2164
  warnings.push({
2130
2165
  page: pageNo,
@@ -2140,7 +2175,7 @@ async function runPdfOcr(buffer, targets, mode, warnings, onProgress, detectTabl
2140
2175
  return result;
2141
2176
  }
2142
2177
  async function ocrOnePage(page, pageNo, mode, engine, warnings, detectTables, vectorOps, regions, config = DEFAULT_BUILTIN_OCR) {
2143
- const { originalWidth: pdfW, originalHeight: pdfH } = page.getOriginalSize();
2178
+ let { originalWidth: pdfW, originalHeight: pdfH } = page.getOriginalSize();
2144
2179
  const renderScale = Math.min(OCR_RENDER_SCALE, Math.sqrt(MAX_OCR_PIXELS / Math.max(1, pdfW * pdfH)));
2145
2180
  if (renderScale < OCR_RENDER_SCALE) {
2146
2181
  warnings.push({ page: pageNo, code: "PARTIAL_PARSE", message: `OCR \uB798\uC2A4\uD130 \uD53D\uC140 \uC0C1\uD55C\uC73C\uB85C \uB80C\uB354 \uD574\uC0C1\uB3C4\uB97C \uCD95\uC18C\uD588\uC2B5\uB2C8\uB2E4 (\uC791\uC740 \uAE00\uC790 \uC778\uC2DD \uACB0\uC190 \uAC00\uB2A5)` });
@@ -2151,13 +2186,13 @@ async function ocrOnePage(page, pageNo, mode, engine, warnings, detectTables, ve
2151
2186
  render: async ({ data }) => data
2152
2187
  });
2153
2188
  const hiRgba = closer ? bgraToRgba(rendered.data) : null;
2154
- const { rgba, width: rw, height: rh } = hiRgba ? halve(hiRgba, rendered.width, rendered.height) : { rgba: bgraToRgba(rendered.data), width: rendered.width, height: rendered.height };
2189
+ let { rgba, width: rw, height: rh } = hiRgba ? halve(hiRgba, rendered.width, rendered.height) : { rgba: bgraToRgba(rendered.data), width: rendered.width, height: rendered.height };
2155
2190
  if (mode === "builtin") {
2156
- const { rgba: upright, angle } = vectorOps || regions ? { rgba, angle: 0 } : deskewPage(rgba, rw, rh);
2191
+ let { rgba: upright, angle } = vectorOps || regions ? { rgba, angle: 0 } : deskewPage(rgba, rw, rh);
2157
2192
  const stats = { droppedLowConf: 0, ...config.lines === "all" ? { dropped: [] } : {} };
2158
- const ruling = vectorOps ? void 0 : detectRulingLines(upright, rw, rh, rh / pdfH);
2159
- const tuning = regions ? regionTuning(config.tuning) : config.tuning;
2160
- const items = await recognizeOcrPage(
2193
+ let ruling = vectorOps ? void 0 : detectRulingLines(upright, rw, rh, rh / pdfH);
2194
+ const tuning = regions ? regionTuning(config.tuning) : vectorOps ? { ...config.tuning, orientPage: false } : config.tuning;
2195
+ let items = await recognizeOcrPage(
2161
2196
  engine,
2162
2197
  config,
2163
2198
  tuning,
@@ -2168,6 +2203,23 @@ async function ocrOnePage(page, pageNo, mode, engine, warnings, detectTables, ve
2168
2203
  ruling ? [..._nullishCoalesce(ruling.cellDividers, () => ( [])), ...cellEdgeVerticals(ruling)] : void 0,
2169
2204
  ruling ? cellEdgeHorizontals(ruling) : void 0
2170
2205
  );
2206
+ if (stats.pageRotation) {
2207
+ ({ rgba: upright, width: rw, height: rh } = rotateQuarter(upright, rw, rh, stats.pageRotation));
2208
+ [pdfW, pdfH] = [pdfH, pdfW];
2209
+ delete stats.pageRotation;
2210
+ ruling = detectRulingLines(upright, rw, rh, rh / pdfH);
2211
+ items = await recognizeOcrPage(
2212
+ engine,
2213
+ config,
2214
+ { ...tuning, orientPage: false },
2215
+ upright,
2216
+ rw,
2217
+ rh,
2218
+ stats,
2219
+ [..._nullishCoalesce(ruling.cellDividers, () => ( [])), ...cellEdgeVerticals(ruling)],
2220
+ cellEdgeHorizontals(ruling)
2221
+ );
2222
+ }
2171
2223
  if (stats.droppedLowConf > 0) {
2172
2224
  warnings.push({
2173
2225
  page: pageNo,
@@ -2191,7 +2243,7 @@ async function ocrOnePage(page, pageNo, mode, engine, warnings, detectTables, ve
2191
2243
  const regionBlocks = regions.flatMap((r, k) => {
2192
2244
  let own = items.filter((it) => inside(it, r));
2193
2245
  const near = reads[k];
2194
- if (_optionalChain([near, 'optionalAccess', _64 => _64.length]) && meanConfidence(near) > meanConfidence(own)) {
2246
+ if (_optionalChain([near, 'optionalAccess', _66 => _66.length]) && meanConfidence(near) > meanConfidence(own)) {
2195
2247
  own = near;
2196
2248
  reread.add(k);
2197
2249
  }
@@ -2199,9 +2251,9 @@ async function ocrOnePage(page, pageNo, mode, engine, warnings, detectTables, ve
2199
2251
  for (const it of own) used.add(it);
2200
2252
  const blocks = ocrItemsToBlocks(own, pageNo, pdfW, pdfH, scale, ruling && rulingToPdfLines(ruling, scale, pdfH), detectTables, void 0, true);
2201
2253
  const x1 = r.x1 * scale - 2, x2 = r.x2 * scale + 2, y1 = (pdfH - r.y2) * scale - 2, y2 = (pdfH - r.y1) * scale + 2;
2202
- const columnRules = _nullishCoalesce(_optionalChain([ruling, 'optionalAccess', _65 => _65.verticals, 'access', _66 => _66.filter, 'call', _67 => _67((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', _68 => _68.length]), () => ( 0));
2254
+ const columnRules = _nullishCoalesce(_optionalChain([ruling, 'optionalAccess', _67 => _67.verticals, 'access', _68 => _68.filter, 'call', _69 => _69((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', _70 => _70.length]), () => ( 0));
2203
2255
  if (columnRules < 2) {
2204
- for (const b of blocks) if (b.type === "table") _chunkIOABX3GRcjs.UNRULED_REGION_TABLES.add(b);
2256
+ for (const b of blocks) if (b.type === "table") _chunkXYVTCXAGcjs.UNRULED_REGION_TABLES.add(b);
2205
2257
  }
2206
2258
  return blocks;
2207
2259
  });
@@ -2235,8 +2287,8 @@ function halve(src, w, h) {
2235
2287
  }
2236
2288
  return { rgba: out, width: W, height: H };
2237
2289
  }
2238
- var REGION_TUNING = Object.freeze({ ...DEFAULT_OCR_TUNING, trimEdges: false });
2239
- var regionTuning = (t) => t === DEFAULT_OCR_TUNING ? REGION_TUNING : { ...t, trimEdges: false };
2290
+ var REGION_TUNING = Object.freeze({ ...DEFAULT_OCR_TUNING, trimEdges: false, orientPage: false });
2291
+ var regionTuning = (t) => t === DEFAULT_OCR_TUNING ? REGION_TUNING : { ...t, trimEdges: false, orientPage: false };
2240
2292
  function meanConfidence(items) {
2241
2293
  let n = 0, sum = 0;
2242
2294
  for (const it of items) {
@@ -2260,7 +2312,7 @@ async function closerReads(rgba, rw, rh, pdfH, hi, regions, engine, tuning = REG
2260
2312
  const items = await engine.recognizePage(crop, cw, ch, void 0, tuning);
2261
2313
  out.push(items.map((it) => {
2262
2314
  const placed = { ...it, x: (it.x + x0) / 2, y: (it.y + y0) / 2, w: it.w / 2, h: it.h / 2 };
2263
- _chunkIOABX3GRcjs.copyOcrTextGaps.call(void 0, it, placed, 0.5, x0 / 2);
2315
+ _chunkXYVTCXAGcjs.copyOcrTextGaps.call(void 0, it, placed, 0.5, x0 / 2);
2264
2316
  return placed;
2265
2317
  }));
2266
2318
  }
@@ -2268,7 +2320,7 @@ async function closerReads(rgba, rw, rh, pdfH, hi, regions, engine, tuning = REG
2268
2320
  }
2269
2321
  var proseBox = (b) => {
2270
2322
  const t = b.text.replace(/\s/g, "");
2271
- return b.w >= b.h * 7 && (_nullishCoalesce(_optionalChain([t, 'access', _69 => _69.match, 'call', _70 => _70(/\d/g), 'optionalAccess', _71 => _71.length]), () => ( 0))) < t.length * 0.3;
2323
+ return b.w >= b.h * 7 && (_nullishCoalesce(_optionalChain([t, 'access', _71 => _71.match, 'call', _72 => _72(/\d/g), 'optionalAccess', _73 => _73.length]), () => ( 0))) < t.length * 0.3;
2272
2324
  };
2273
2325
  function groupOcrLines(items, figureRegion = false) {
2274
2326
  const order = items.map((_, i) => i).sort((a, b) => items[a].y + items[a].h / 2 - (items[b].y + items[b].h / 2));
@@ -2311,6 +2363,7 @@ function groupOcrLines(items, figureRegion = false) {
2311
2363
  function ocrItemsToBlocks(items, pageNumber, pdfW, pdfH, scale, extraLines, detectTables = true, opList = { fnArray: [], argsArray: [] }, figureRegion = false) {
2312
2364
  const bottoms = items.map((it) => it.y + it.h);
2313
2365
  const xs = items.map((it) => ({ x: it.x, r: it.x + it.w, space: false }));
2366
+ const texts = items.map((it) => it.text);
2314
2367
  for (const line of groupOcrLines(items, figureRegion)) {
2315
2368
  if (line.length < 2) continue;
2316
2369
  const sorted = line.map((j) => items[j].y + items[j].h).sort((a, b) => a - b);
@@ -2319,6 +2372,13 @@ function ocrItemsToBlocks(items, pageNumber, pdfW, pdfH, scale, extraLines, dete
2319
2372
  for (let k = 1; k < byX.length; k++) {
2320
2373
  const L = xs[byX[k - 1]], R = xs[byX[k]];
2321
2374
  if (R.x >= L.r) continue;
2375
+ const lt = [...texts[byX[k - 1]]], rt = [...texts[byX[k]]], per = items[byX[k]].w / Math.max(1, rt.length);
2376
+ for (let n = Math.min(3, rt.length, lt.length); n >= 1; n--) {
2377
+ if (lt.slice(-n).join("") === rt.slice(0, n).join("") && /[가-힣]/.test(rt[0]) && L.r - R.x >= per * n * 0.5) {
2378
+ texts[byX[k]] = rt.slice(n).join("");
2379
+ break;
2380
+ }
2381
+ }
2322
2382
  const mid = (R.x + L.r) / 2, half = Math.min(items[byX[k - 1]].h, items[byX[k]].h) * 0.15;
2323
2383
  L.r = Math.max(L.x + 1, mid - half);
2324
2384
  R.x = Math.min(R.r - 1, mid + half);
@@ -2328,7 +2388,7 @@ function ocrItemsToBlocks(items, pageNumber, pdfW, pdfH, scale, extraLines, dete
2328
2388
  const norm = items.map((it, i) => {
2329
2389
  const h = (figureRegion ? Math.max(1, bottoms[i] - it.y) : it.h) / scale;
2330
2390
  const normalized = {
2331
- text: it.text,
2391
+ text: texts[i],
2332
2392
  x: Math.round(xs[i].x / scale),
2333
2393
  // NormItem.y 는 pdfjs transform[5] = 베이스라인 (bottom-up) — 잉크 하단으로 근사
2334
2394
  y: Math.round(pdfH - bottoms[i] / scale),
@@ -2340,17 +2400,59 @@ function ocrItemsToBlocks(items, pageNumber, pdfW, pdfH, scale, extraLines, dete
2340
2400
  isHidden: false,
2341
2401
  ...xs[i].space ? { hasSpaceBefore: true } : {}
2342
2402
  };
2343
- _chunkIOABX3GRcjs.copyOcrTextGaps.call(void 0, it, normalized, 1 / scale);
2403
+ _chunkXYVTCXAGcjs.copyOcrTextGaps.call(void 0, it, normalized, 1 / scale);
2344
2404
  return normalized;
2345
- });
2346
- return unframeOcrLayoutTables(splitStackedOcrRows(_chunkIOABX3GRcjs.extractPageBlocksWithLines.call(void 0, norm, pageNumber, opList, pdfW, pdfH, extraLines, detectTables)), pdfH);
2405
+ }).filter((it) => it.text);
2406
+ const blocks = unframeOcrLayoutTables(splitStackedOcrRows(_chunkXYVTCXAGcjs.extractPageBlocksWithLines.call(void 0, norm, pageNumber, opList, pdfW, pdfH, extraLines, detectTables)), pdfH);
2407
+ if (!figureRegion) markOcrHeadings(blocks);
2408
+ return blocks;
2409
+ }
2410
+ function markOcrHeadings(blocks) {
2411
+ const sized = blocks.filter((b) => b.type === "paragraph" && b.text && _optionalChain([b, 'access', _74 => _74.style, 'optionalAccess', _75 => _75.fontSize]));
2412
+ const weights = sized.map((b) => [b.style.fontSize, b.text.length]);
2413
+ const total = weights.reduce((n, [, w]) => n + w, 0);
2414
+ if (total < 100) return;
2415
+ weights.sort((a, b) => a[0] - b[0]);
2416
+ let acc = 0, body = 0;
2417
+ for (const [size, w] of weights) {
2418
+ acc += w;
2419
+ if (acc >= total / 2) {
2420
+ body = size;
2421
+ break;
2422
+ }
2423
+ }
2424
+ if (!body) return;
2425
+ for (const b of sized) {
2426
+ const text = b.text.trim(), size = b.style.fontSize;
2427
+ const ratio = size / body;
2428
+ if (ratio < 1.3) continue;
2429
+ if (text.length < 2 || text.length > (ratio >= 1.5 ? 60 : 40) || /[.!?。]$|다\.?$/.test(text) || /^[\d\s.,%·-]+$/.test(text)) continue;
2430
+ if (b.bbox && b.bbox.height > size * (ratio >= 1.5 ? 3.2 : 1.6)) continue;
2431
+ b.type = "heading";
2432
+ b.level = ratio >= 1.5 ? 1 : 2;
2433
+ }
2434
+ for (let i = blocks.length - 1; i > 0; i--) {
2435
+ const a = blocks[i - 1], b = blocks[i];
2436
+ if (a.type !== "heading" || b.type !== "heading" || !a.bbox || !b.bbox) continue;
2437
+ const marker = /^(?:제\s*\d+\s*[장절편부]|chapter\s*\d+|part\s*\d+)$/i.test(a.text.trim());
2438
+ const sa = _nullishCoalesce(_optionalChain([a, 'access', _76 => _76.style, 'optionalAccess', _77 => _77.fontSize]), () => ( 0)), sb = _nullishCoalesce(_optionalChain([b, 'access', _78 => _78.style, 'optionalAccess', _79 => _79.fontSize]), () => ( 0));
2439
+ if (!marker && (a.level !== b.level || Math.max(sa, sb) > Math.min(sa, sb) * 1.3)) continue;
2440
+ const gap = a.bbox.y - (b.bbox.y + b.bbox.height), size = Math.max(_nullishCoalesce(_optionalChain([a, 'access', _80 => _80.style, 'optionalAccess', _81 => _81.fontSize]), () => ( 0)), _nullishCoalesce(_optionalChain([b, 'access', _82 => _82.style, 'optionalAccess', _83 => _83.fontSize]), () => ( 0)));
2441
+ const across = Math.min(a.bbox.x + a.bbox.width, b.bbox.x + b.bbox.width) - Math.max(a.bbox.x, b.bbox.x);
2442
+ if (gap < 0 || gap > size * (marker ? 3 : 1.2) || across <= 0) continue;
2443
+ a.level = Math.min(_nullishCoalesce(a.level, () => ( 2)), _nullishCoalesce(b.level, () => ( 2)));
2444
+ a.text = `${a.text.trim()} ${b.text.trim()}`;
2445
+ const x = Math.min(a.bbox.x, b.bbox.x);
2446
+ a.bbox = { ...a.bbox, x, y: b.bbox.y, width: Math.max(a.bbox.x + a.bbox.width, b.bbox.x + b.bbox.width) - x, height: a.bbox.y + a.bbox.height - b.bbox.y };
2447
+ blocks.splice(i, 1);
2448
+ }
2347
2449
  }
2348
2450
  async function tryImport2(name, loader) {
2349
2451
  try {
2350
2452
  return await loader();
2351
2453
  } catch (e) {
2352
2454
  throw new Error(
2353
- `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.${_chunkQWYIYVIZcjs.OPTIONAL_DEP_INSTALL_HINT} \uC6D0\uC778: ${e.message}`
2455
+ `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.${_chunkMANE7HAZcjs.OPTIONAL_DEP_INSTALL_HINT} \uC6D0\uC778: ${e.message}`
2354
2456
  );
2355
2457
  }
2356
2458
  }
@@ -2398,5 +2500,7 @@ function bgraToRgba(bgra) {
2398
2500
 
2399
2501
 
2400
2502
 
2401
- exports.getOcrEngine = getOcrEngine; exports.detectRulingLines = detectRulingLines; exports.rulingToPdfLines = rulingToPdfLines; exports.deskewPage = deskewPage; 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.groupOcrLines = groupOcrLines; exports.ocrItemsToBlocks = ocrItemsToBlocks;
2402
- //# sourceMappingURL=chunk-WZUTLJP2.cjs.map
2503
+
2504
+
2505
+ 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.groupOcrLines = groupOcrLines; exports.ocrItemsToBlocks = ocrItemsToBlocks; exports.markOcrHeadings = markOcrHeadings;
2506
+ //# sourceMappingURL=chunk-LE3733C2.cjs.map