kordoc 4.24.71 → 4.24.73

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 (182) hide show
  1. package/README.md +4 -4
  2. package/dist/{-F7GLIIGT.js → -CNXSUEGZ.js} +21 -21
  3. package/dist/{chunk-YPRIJDH6.js → chunk-2JA4FJJM.js} +2 -2
  4. package/dist/{chunk-M27VBFO6.js → chunk-32NWTEPA.js} +26 -6
  5. package/dist/chunk-32NWTEPA.js.map +1 -0
  6. package/dist/{chunk-SMEBVDM2.js → chunk-376JPHHC.js} +5 -5
  7. package/dist/{chunk-OW2XKTQA.cjs → chunk-5MBQW3KP.cjs} +8 -8
  8. package/dist/{chunk-OW2XKTQA.cjs.map → chunk-5MBQW3KP.cjs.map} +1 -1
  9. package/dist/{chunk-TYGZ6O2A.js → chunk-64QDDZO3.js} +11 -11
  10. package/dist/{chunk-RWU3Y5YK.js → chunk-A6YD5KUQ.js} +18 -16
  11. package/dist/chunk-A6YD5KUQ.js.map +1 -0
  12. package/dist/{chunk-OUHMNF2A.js → chunk-AAXWKG3C.js} +2 -2
  13. package/dist/{chunk-BHYBZSOC.js → chunk-ABNK5QI2.js} +2 -2
  14. package/dist/{chunk-KLUI4SAZ.js → chunk-AUGOG3KY.js} +2 -2
  15. package/dist/{chunk-O7PJFEOC.js → chunk-B5F7B5NL.js} +2 -2
  16. package/dist/{chunk-7KVDHXP2.js → chunk-BK55EX56.js} +4 -4
  17. package/dist/{chunk-T7MHZIFG.js → chunk-BUB3O7LS.js} +27 -7
  18. package/dist/chunk-BUB3O7LS.js.map +1 -0
  19. package/dist/{chunk-KGCJNPAI.js → chunk-BX23BOYN.js} +5 -5
  20. package/dist/{chunk-2CPEW6WC.js → chunk-CBGH37CU.js} +3 -3
  21. package/dist/{chunk-AUHQRRKM.js → chunk-CGOCVSWC.js} +3 -3
  22. package/dist/{chunk-MHXPW72E.js → chunk-E3G3JTXW.js} +2 -2
  23. package/dist/{chunk-NPBNJCXZ.js → chunk-G7QVY67O.js} +2 -2
  24. package/dist/{chunk-LFTO5QAP.cjs → chunk-HMHIF6QF.cjs} +2 -2
  25. package/dist/{chunk-LFTO5QAP.cjs.map → chunk-HMHIF6QF.cjs.map} +1 -1
  26. package/dist/{chunk-5WWGC5SG.js → chunk-IV6UP7MO.js} +2 -2
  27. package/dist/{chunk-HIYRMYAS.js → chunk-JDGPQVTX.js} +2 -2
  28. package/dist/{chunk-GRCIFCGC.js → chunk-JY4YMR6F.js} +2 -2
  29. package/dist/{chunk-2VBRCIPI.js → chunk-LMHDQWQM.js} +2 -2
  30. package/dist/{chunk-YISBYF7X.cjs → chunk-LUQH3SUU.cjs} +58 -58
  31. package/dist/{chunk-YISBYF7X.cjs.map → chunk-LUQH3SUU.cjs.map} +1 -1
  32. package/dist/{chunk-LNWURZ2Z.js → chunk-M4QZCXT4.js} +7 -7
  33. package/dist/{chunk-SK5AOGYK.cjs → chunk-MDDQRVA4.cjs} +104 -104
  34. package/dist/{chunk-SK5AOGYK.cjs.map → chunk-MDDQRVA4.cjs.map} +1 -1
  35. package/dist/{chunk-GFAWIBHG.js → chunk-MHLTXTP2.js} +10 -10
  36. package/dist/{chunk-IMT5TVVM.js → chunk-NQL7NCSE.js} +2 -2
  37. package/dist/{chunk-YTP7FPA5.cjs → chunk-O4TKUBCF.cjs} +3 -3
  38. package/dist/{chunk-YTP7FPA5.cjs.map → chunk-O4TKUBCF.cjs.map} +1 -1
  39. package/dist/{chunk-H2VOH7X3.cjs → chunk-OOD35TZR.cjs} +203 -183
  40. package/dist/chunk-OOD35TZR.cjs.map +1 -0
  41. package/dist/{chunk-2OF2YWIZ.js → chunk-P4FHTYVX.js} +2 -2
  42. package/dist/{chunk-BNP3WXTB.cjs → chunk-QLUFTCAE.cjs} +3 -3
  43. package/dist/{chunk-BNP3WXTB.cjs.map → chunk-QLUFTCAE.cjs.map} +1 -1
  44. package/dist/{chunk-WMA4GJHC.js → chunk-RJ26GRDB.js} +5 -5
  45. package/dist/{chunk-YJ2YVG6N.cjs → chunk-ROYGVYLL.cjs} +88 -88
  46. package/dist/{chunk-YJ2YVG6N.cjs.map → chunk-ROYGVYLL.cjs.map} +1 -1
  47. package/dist/{chunk-QK5KCWLE.js → chunk-S366ICXS.js} +2 -2
  48. package/dist/{chunk-EZNUMAAJ.js → chunk-S6K222FM.js} +2 -2
  49. package/dist/{chunk-ZPJZXTEG.js → chunk-TTIJTR5Z.js} +6 -6
  50. package/dist/{chunk-D4UFBXMT.js → chunk-UMVL776E.js} +2 -2
  51. package/dist/{chunk-YTDHH362.js → chunk-VMM5PVOA.js} +2 -2
  52. package/dist/{chunk-OJK4FLS5.js → chunk-VSWGRKTF.js} +3 -3
  53. package/dist/{chunk-6ZA4V4QS.js → chunk-X4HNVXJI.js} +2 -2
  54. package/dist/{chunk-RUUUGCXS.js → chunk-XSDVY4S6.js} +6 -6
  55. package/dist/{chunk-DSCT67WF.js → chunk-YLC25Z64.js} +3 -3
  56. package/dist/{chunk-UJQRIX4L.js → chunk-ZH322FQG.js} +2 -2
  57. package/dist/chunks-7XYOWREB.js +11 -0
  58. package/dist/cli.js +45 -45
  59. package/dist/{formula-3PJYUQMG.js → formula-7Q6CKLK2.js} +36 -6
  60. package/dist/formula-7Q6CKLK2.js.map +1 -0
  61. package/dist/{formula-RTPZD2IM.cjs → formula-AORKEC66.cjs} +41 -11
  62. package/dist/formula-AORKEC66.cjs.map +1 -0
  63. package/dist/{formula-UJF4RZ6W.js → formula-IP2SLKUY.js} +35 -5
  64. package/dist/formula-IP2SLKUY.js.map +1 -0
  65. package/dist/generator-BPEAWT2P.cjs +12 -0
  66. package/dist/{generator-INMUN6KB.cjs.map → generator-BPEAWT2P.cjs.map} +1 -1
  67. package/dist/generator-NLWOHWUW.js +18 -0
  68. package/dist/generator-VBJWJI3E.js +11 -0
  69. package/dist/{hancom-P3SUQXM4.js → hancom-DVWCKSEN.js} +2 -2
  70. package/dist/{hancom-MVPEYI4X.cjs → hancom-J2SWJYM6.cjs} +5 -5
  71. package/dist/{hancom-MVPEYI4X.cjs.map → hancom-J2SWJYM6.cjs.map} +1 -1
  72. package/dist/{hancom-RYIZHWJ5.js → hancom-P34JL3HX.js} +2 -2
  73. package/dist/{image-ocr-ZS4EMQN3.cjs → image-ocr-3CJ4KVOT.cjs} +28 -28
  74. package/dist/{image-ocr-ZS4EMQN3.cjs.map → image-ocr-3CJ4KVOT.cjs.map} +1 -1
  75. package/dist/{image-ocr-ZXLHPQI2.js → image-ocr-5RBEPJPK.js} +7 -7
  76. package/dist/{image-ocr-GL5YVCNU.js → image-ocr-7EOTOS42.js} +10 -10
  77. package/dist/index.cjs +1118 -1116
  78. package/dist/index.cjs.map +1 -1
  79. package/dist/index.js +12 -10
  80. package/dist/index.js.map +1 -1
  81. package/dist/mcp.js +36 -36
  82. package/dist/memo-ARHG3OC5.js +17 -0
  83. package/dist/{model-bundle-VCUAKBF3.js → model-bundle-7YL3PW4N.js} +5 -5
  84. package/dist/{models-UACAGYBI.js → models-ZXDUWX64.js} +5 -5
  85. package/dist/{parse-worker-v2-LJB4QXGF.js → parse-worker-v2-SGBIWVYJ.js} +22 -22
  86. package/dist/{parser-T4HAQ3QW.cjs → parser-6M4IIKSU.cjs} +166 -166
  87. package/dist/{parser-T4HAQ3QW.cjs.map → parser-6M4IIKSU.cjs.map} +1 -1
  88. package/dist/{parser-5GZUD22P.js → parser-HZANYZZA.js} +12 -12
  89. package/dist/{parser-HCZD4DUO.js → parser-RYPZ245J.js} +9 -9
  90. package/dist/pdf-ocr-26AWXUHX.cjs +43 -0
  91. package/dist/{pdf-ocr-H4DKZSOB.cjs.map → pdf-ocr-26AWXUHX.cjs.map} +1 -1
  92. package/dist/{pdf-ocr-JXVGK5MR.js → pdf-ocr-J5BIUOOQ.js} +6 -6
  93. package/dist/{pdf-ocr-YCMC2VL4.js → pdf-ocr-VMB4NOXR.js} +9 -9
  94. package/dist/{profile-io-MVTEOXAU.js → profile-io-F6WUV5PU.js} +3 -3
  95. package/dist/{rasterize-VWT3C3RW.js → rasterize-AFUYHCSP.js} +3 -3
  96. package/dist/{redact-doc-SU3JDC6F.js → redact-doc-UKYOAVBS.js} +21 -21
  97. package/dist/{render-D5N4FKWB.js → render-VRZS47LX.js} +12 -12
  98. package/dist/{rewrite-fallback-QXTWSPGY.js → rewrite-fallback-PNSM4XRC.js} +13 -13
  99. package/dist/seal-CJOUVTMN.js +16 -0
  100. package/dist/{setup-TXNJYX6P.js → setup-VV6ERJGY.js} +3 -3
  101. package/dist/to-hwpx-3OWX37Q4.cjs +16 -0
  102. package/dist/{to-hwpx-KZTTH7EY.cjs.map → to-hwpx-3OWX37Q4.cjs.map} +1 -1
  103. package/dist/{to-hwpx-Z7NHUMUD.js → to-hwpx-WBMWA54L.js} +7 -7
  104. package/dist/{to-hwpx-YHGVFTBO.js → to-hwpx-YYMXNCCW.js} +4 -4
  105. package/dist/visual-YY2BPPCJ.js +38 -0
  106. package/dist/{watch-EI5QYDT2.js → watch-BTAIN7LZ.js} +22 -22
  107. package/package.json +1 -1
  108. package/dist/chunk-H2VOH7X3.cjs.map +0 -1
  109. package/dist/chunk-M27VBFO6.js.map +0 -1
  110. package/dist/chunk-RWU3Y5YK.js.map +0 -1
  111. package/dist/chunk-T7MHZIFG.js.map +0 -1
  112. package/dist/chunks-JAD5Z5YY.js +0 -11
  113. package/dist/formula-3PJYUQMG.js.map +0 -1
  114. package/dist/formula-RTPZD2IM.cjs.map +0 -1
  115. package/dist/formula-UJF4RZ6W.js.map +0 -1
  116. package/dist/generator-EB2436BE.js +0 -18
  117. package/dist/generator-INMUN6KB.cjs +0 -12
  118. package/dist/generator-K5KMPSLC.js +0 -11
  119. package/dist/memo-JNMSGIO7.js +0 -17
  120. package/dist/pdf-ocr-H4DKZSOB.cjs +0 -43
  121. package/dist/seal-Q3BD6CRB.js +0 -16
  122. package/dist/to-hwpx-KZTTH7EY.cjs +0 -16
  123. package/dist/visual-LNHFYJDL.js +0 -38
  124. /package/dist/{-F7GLIIGT.js.map → -CNXSUEGZ.js.map} +0 -0
  125. /package/dist/{chunk-YPRIJDH6.js.map → chunk-2JA4FJJM.js.map} +0 -0
  126. /package/dist/{chunk-SMEBVDM2.js.map → chunk-376JPHHC.js.map} +0 -0
  127. /package/dist/{chunk-TYGZ6O2A.js.map → chunk-64QDDZO3.js.map} +0 -0
  128. /package/dist/{chunk-OUHMNF2A.js.map → chunk-AAXWKG3C.js.map} +0 -0
  129. /package/dist/{chunk-BHYBZSOC.js.map → chunk-ABNK5QI2.js.map} +0 -0
  130. /package/dist/{chunk-KLUI4SAZ.js.map → chunk-AUGOG3KY.js.map} +0 -0
  131. /package/dist/{chunk-O7PJFEOC.js.map → chunk-B5F7B5NL.js.map} +0 -0
  132. /package/dist/{chunk-7KVDHXP2.js.map → chunk-BK55EX56.js.map} +0 -0
  133. /package/dist/{chunk-KGCJNPAI.js.map → chunk-BX23BOYN.js.map} +0 -0
  134. /package/dist/{chunk-2CPEW6WC.js.map → chunk-CBGH37CU.js.map} +0 -0
  135. /package/dist/{chunk-AUHQRRKM.js.map → chunk-CGOCVSWC.js.map} +0 -0
  136. /package/dist/{chunk-MHXPW72E.js.map → chunk-E3G3JTXW.js.map} +0 -0
  137. /package/dist/{chunk-NPBNJCXZ.js.map → chunk-G7QVY67O.js.map} +0 -0
  138. /package/dist/{chunk-5WWGC5SG.js.map → chunk-IV6UP7MO.js.map} +0 -0
  139. /package/dist/{chunk-HIYRMYAS.js.map → chunk-JDGPQVTX.js.map} +0 -0
  140. /package/dist/{chunk-GRCIFCGC.js.map → chunk-JY4YMR6F.js.map} +0 -0
  141. /package/dist/{chunk-2VBRCIPI.js.map → chunk-LMHDQWQM.js.map} +0 -0
  142. /package/dist/{chunk-LNWURZ2Z.js.map → chunk-M4QZCXT4.js.map} +0 -0
  143. /package/dist/{chunk-GFAWIBHG.js.map → chunk-MHLTXTP2.js.map} +0 -0
  144. /package/dist/{chunk-IMT5TVVM.js.map → chunk-NQL7NCSE.js.map} +0 -0
  145. /package/dist/{chunk-2OF2YWIZ.js.map → chunk-P4FHTYVX.js.map} +0 -0
  146. /package/dist/{chunk-WMA4GJHC.js.map → chunk-RJ26GRDB.js.map} +0 -0
  147. /package/dist/{chunk-QK5KCWLE.js.map → chunk-S366ICXS.js.map} +0 -0
  148. /package/dist/{chunk-EZNUMAAJ.js.map → chunk-S6K222FM.js.map} +0 -0
  149. /package/dist/{chunk-ZPJZXTEG.js.map → chunk-TTIJTR5Z.js.map} +0 -0
  150. /package/dist/{chunk-D4UFBXMT.js.map → chunk-UMVL776E.js.map} +0 -0
  151. /package/dist/{chunk-YTDHH362.js.map → chunk-VMM5PVOA.js.map} +0 -0
  152. /package/dist/{chunk-OJK4FLS5.js.map → chunk-VSWGRKTF.js.map} +0 -0
  153. /package/dist/{chunk-6ZA4V4QS.js.map → chunk-X4HNVXJI.js.map} +0 -0
  154. /package/dist/{chunk-RUUUGCXS.js.map → chunk-XSDVY4S6.js.map} +0 -0
  155. /package/dist/{chunk-DSCT67WF.js.map → chunk-YLC25Z64.js.map} +0 -0
  156. /package/dist/{chunk-UJQRIX4L.js.map → chunk-ZH322FQG.js.map} +0 -0
  157. /package/dist/{chunks-JAD5Z5YY.js.map → chunks-7XYOWREB.js.map} +0 -0
  158. /package/dist/{generator-EB2436BE.js.map → generator-NLWOHWUW.js.map} +0 -0
  159. /package/dist/{generator-K5KMPSLC.js.map → generator-VBJWJI3E.js.map} +0 -0
  160. /package/dist/{hancom-P3SUQXM4.js.map → hancom-DVWCKSEN.js.map} +0 -0
  161. /package/dist/{hancom-RYIZHWJ5.js.map → hancom-P34JL3HX.js.map} +0 -0
  162. /package/dist/{image-ocr-ZXLHPQI2.js.map → image-ocr-5RBEPJPK.js.map} +0 -0
  163. /package/dist/{image-ocr-GL5YVCNU.js.map → image-ocr-7EOTOS42.js.map} +0 -0
  164. /package/dist/{memo-JNMSGIO7.js.map → memo-ARHG3OC5.js.map} +0 -0
  165. /package/dist/{model-bundle-VCUAKBF3.js.map → model-bundle-7YL3PW4N.js.map} +0 -0
  166. /package/dist/{models-UACAGYBI.js.map → models-ZXDUWX64.js.map} +0 -0
  167. /package/dist/{parse-worker-v2-LJB4QXGF.js.map → parse-worker-v2-SGBIWVYJ.js.map} +0 -0
  168. /package/dist/{parser-5GZUD22P.js.map → parser-HZANYZZA.js.map} +0 -0
  169. /package/dist/{parser-HCZD4DUO.js.map → parser-RYPZ245J.js.map} +0 -0
  170. /package/dist/{pdf-ocr-JXVGK5MR.js.map → pdf-ocr-J5BIUOOQ.js.map} +0 -0
  171. /package/dist/{pdf-ocr-YCMC2VL4.js.map → pdf-ocr-VMB4NOXR.js.map} +0 -0
  172. /package/dist/{profile-io-MVTEOXAU.js.map → profile-io-F6WUV5PU.js.map} +0 -0
  173. /package/dist/{rasterize-VWT3C3RW.js.map → rasterize-AFUYHCSP.js.map} +0 -0
  174. /package/dist/{redact-doc-SU3JDC6F.js.map → redact-doc-UKYOAVBS.js.map} +0 -0
  175. /package/dist/{render-D5N4FKWB.js.map → render-VRZS47LX.js.map} +0 -0
  176. /package/dist/{rewrite-fallback-QXTWSPGY.js.map → rewrite-fallback-PNSM4XRC.js.map} +0 -0
  177. /package/dist/{seal-Q3BD6CRB.js.map → seal-CJOUVTMN.js.map} +0 -0
  178. /package/dist/{setup-TXNJYX6P.js.map → setup-VV6ERJGY.js.map} +0 -0
  179. /package/dist/{to-hwpx-YHGVFTBO.js.map → to-hwpx-WBMWA54L.js.map} +0 -0
  180. /package/dist/{to-hwpx-Z7NHUMUD.js.map → to-hwpx-YYMXNCCW.js.map} +0 -0
  181. /package/dist/{visual-LNHFYJDL.js.map → visual-YY2BPPCJ.js.map} +0 -0
  182. /package/dist/{watch-EI5QYDT2.js.map → watch-BTAIN7LZ.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;
2
2
 
3
3
 
4
- var _chunkYTP7FPA5cjs = require('./chunk-YTP7FPA5.cjs');
4
+ var _chunkO4TKUBCFcjs = require('./chunk-O4TKUBCF.cjs');
5
5
 
6
6
 
7
7
 
@@ -9,11 +9,11 @@ var _chunkYTP7FPA5cjs = require('./chunk-YTP7FPA5.cjs');
9
9
 
10
10
 
11
11
 
12
- var _chunkOW2XKTQAcjs = require('./chunk-OW2XKTQA.cjs');
12
+ var _chunk5MBQW3KPcjs = require('./chunk-5MBQW3KP.cjs');
13
13
 
14
14
 
15
15
 
16
- var _chunkLFTO5QAPcjs = require('./chunk-LFTO5QAP.cjs');
16
+ var _chunkHMHIF6QFcjs = require('./chunk-HMHIF6QF.cjs');
17
17
 
18
18
  // src/ocr/models.ts
19
19
  var _path = require('path');
@@ -65,7 +65,7 @@ var OCR_REC_DICT = {
65
65
  sizeMb: 1
66
66
  };
67
67
  function getOcrModelsDir() {
68
- return _chunkYTP7FPA5cjs.getModelsDir.call(void 0, "ppocr");
68
+ return _chunkO4TKUBCFcjs.getModelsDir.call(void 0, "ppocr");
69
69
  }
70
70
  var DEFAULT_OCR_MODELS = Object.freeze({
71
71
  det: { spec: OCR_DET_MODEL },
@@ -110,7 +110,7 @@ async function ensureOcrModelsFor(sel, onProgress) {
110
110
  if (!stamp || verifiedInProcess.get(path) !== stamp) todo.push(s.spec);
111
111
  }
112
112
  if (!todo.length) return;
113
- await _chunkYTP7FPA5cjs.ensureModelsIn.call(void 0, dir, todo, onProgress);
113
+ await _chunkO4TKUBCFcjs.ensureModelsIn.call(void 0, dir, todo, onProgress);
114
114
  for (const spec of todo) {
115
115
  const path = _path.join.call(void 0, dir, spec.filename), stamp = await fileStamp(path);
116
116
  if (stamp) verifiedInProcess.set(path, stamp);
@@ -3414,16 +3414,16 @@ function recordOpenEndCellEdges(grid, cells, horizontals) {
3414
3414
  }
3415
3415
  function takeClipCellEdges(from, to) {
3416
3416
  const e = CLIP_CELL_EDGES.get(from);
3417
- if (e) _chunkOW2XKTQAcjs.CELL_EDGES.set(to, e);
3417
+ if (e) _chunk5MBQW3KPcjs.CELL_EDGES.set(to, e);
3418
3418
  }
3419
3419
  function hasOpenCellSeam(a, b) {
3420
- const u = _chunkOW2XKTQAcjs.CELL_EDGES.get(a), d = _chunkOW2XKTQAcjs.CELL_EDGES.get(b);
3420
+ const u = _chunk5MBQW3KPcjs.CELL_EDGES.get(a), d = _chunk5MBQW3KPcjs.CELL_EDGES.get(b);
3421
3421
  return !!u && !!d && u.t && !u.b && !d.t && d.b && u.l && u.r && d.l && d.r;
3422
3422
  }
3423
3423
  function joinCellEdges(a, b) {
3424
- const u = _chunkOW2XKTQAcjs.CELL_EDGES.get(a), d = _chunkOW2XKTQAcjs.CELL_EDGES.get(b);
3424
+ const u = _chunk5MBQW3KPcjs.CELL_EDGES.get(a), d = _chunk5MBQW3KPcjs.CELL_EDGES.get(b);
3425
3425
  if (!u || !d) return;
3426
- _chunkOW2XKTQAcjs.CELL_EDGES.set(a, { t: u.t, b: d.b, l: u.l || d.l, r: u.r || d.r });
3426
+ _chunk5MBQW3KPcjs.CELL_EDGES.set(a, { t: u.t, b: d.b, l: u.l || d.l, r: u.r || d.r });
3427
3427
  }
3428
3428
 
3429
3429
  // src/pdf/cell-extract.ts
@@ -3608,7 +3608,7 @@ function tagScripts(text, lines) {
3608
3608
  const [s, e, kind] = marks[m];
3609
3609
  out = out.slice(0, s) + `<${kind}>` + out.slice(s, e) + `</${kind}>` + out.slice(e);
3610
3610
  }
3611
- return _chunkOW2XKTQAcjs.tidyScriptTags.call(void 0, out);
3611
+ return _chunk5MBQW3KPcjs.tidyScriptTags.call(void 0, out);
3612
3612
  }
3613
3613
 
3614
3614
  // src/pdf/line-wrap.ts
@@ -3624,7 +3624,7 @@ var bump2 = (m, k1, k2) => {
3624
3624
  if (!inner) m.set(k1, inner = /* @__PURE__ */ new Map());
3625
3625
  bump(inner, k2);
3626
3626
  };
3627
- var WrapLexicon = (_class = class {constructor() { _class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);_class.prototype.__init6.call(this);_class.prototype.__init7.call(this);_class.prototype.__init8.call(this);_class.prototype.__init9.call(this);_class.prototype.__init10.call(this); }
3627
+ var WrapLexicon = (_class = class {constructor() { _class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);_class.prototype.__init6.call(this);_class.prototype.__init7.call(this);_class.prototype.__init8.call(this);_class.prototype.__init9.call(this);_class.prototype.__init10.call(this);_class.prototype.__init11.call(this); }
3628
3628
  __init() {this.joined1 = /* @__PURE__ */ new Map()}
3629
3629
  __init2() {this.joined2 = /* @__PURE__ */ new Map()}
3630
3630
  __init3() {this.spaced1 = /* @__PURE__ */ new Map()}
@@ -3642,6 +3642,8 @@ var WrapLexicon = (_class = class {constructor() { _class.prototype.__init.call(
3642
3642
  __init9() {this.cites = /* @__PURE__ */ new Map()}
3643
3643
  /** 쪽 줄 흐름에서 넓은 줄 사이 기준선 간격(글자 크기별) — 줄 둘뿐인 묶음은 묶음 안에 견줄 간격이 없어 넓은 줄 간격 본문을 문단 경계로 봤다 */
3644
3644
  __init10() {this.pitches = []}
3645
+ /** 줄 안 한글 바로 뒤 여는 괄호 — 붙여 쓴 "주택(아파트)" 수와 띄운 "주택 (아파트)" 수 */
3646
+ __init11() {this.parens = { joined: 0, spaced: 0 }}
3645
3647
  /** 줄 흐름의 이웃한 넓은 두 줄(같은 글자 크기) 사이 간격 하나를 더한다 */
3646
3648
  addPitch(fontSize, pitch) {
3647
3649
  if (fontSize > 0 && pitch > 0 && pitch < 4 * fontSize) this.pitches.push({ fs: fontSize, pitch });
@@ -3654,6 +3656,8 @@ var WrapLexicon = (_class = class {constructor() { _class.prototype.__init.call(
3654
3656
  /** 줄 글 한 줄을 증거로 더한다 — 탭(큰 갭)으로 나뉜 조각은 다른 칸·단이라 조각 사이는 어절 경계 증거로 쓰지 않는다 */
3655
3657
  addLine(text) {
3656
3658
  for (const seg of text.replace(MARKUP, "").split(" ")) {
3659
+ this.parens.joined += _nullishCoalesce(_optionalChain([seg, 'access', _59 => _59.match, 'call', _60 => _60(/[가-힣]\(/g), 'optionalAccess', _61 => _61.length]), () => ( 0));
3660
+ this.parens.spaced += _nullishCoalesce(_optionalChain([seg, 'access', _62 => _62.match, 'call', _63 => _63(/[가-힣] \(/g), 'optionalAccess', _64 => _64.length]), () => ( 0));
3657
3661
  for (const m of seg.matchAll(CITE_LINK)) {
3658
3662
  const c = _nullishCoalesce(this.cites.get(m[1]), () => ( { joined: 0, spaced: 0 }));
3659
3663
  if (m[2]) c.spaced++;
@@ -3665,12 +3669,12 @@ var WrapLexicon = (_class = class {constructor() { _class.prototype.__init.call(
3665
3669
  const t = toks[i], n = t.length;
3666
3670
  if (i > 0 && i < toks.length - 1) {
3667
3671
  bump(this.words, t);
3668
- const run = _nullishCoalesce(_optionalChain([t, 'access', _59 => _59.match, 'call', _60 => _60(/^[가-힣]+/), 'optionalAccess', _61 => _61[0]]), () => ( ""));
3672
+ const run = _nullishCoalesce(_optionalChain([t, 'access', _65 => _65.match, 'call', _66 => _66(/^[가-힣]+/), 'optionalAccess', _67 => _67[0]]), () => ( ""));
3669
3673
  for (let j = 2; j <= Math.min(run.length, 6); j++) this.heads.add(run.slice(0, j));
3670
3674
  }
3671
3675
  if (i + 1 < toks.length) {
3672
3676
  this.pairs.add(t + " " + toks[i + 1]);
3673
- const tail = _optionalChain([t, 'access', _62 => _62.match, 'call', _63 => _63(/[가-힣]+$/), 'optionalAccess', _64 => _64[0]]);
3677
+ const tail = _optionalChain([t, 'access', _68 => _68.match, 'call', _69 => _69(/[가-힣]+$/), 'optionalAccess', _70 => _70[0]]);
3674
3678
  if (tail) this.spacedHeads.add(tail + " " + toks[i + 1].charAt(0));
3675
3679
  }
3676
3680
  for (let a = 0; a + 1 < n; a++) {
@@ -3691,6 +3695,13 @@ var WrapLexicon = (_class = class {constructor() { _class.prototype.__init.call(
3691
3695
  const c = this.cites.get(unit);
3692
3696
  return !c || c.joined === c.spaced ? null : c.joined > c.spaced;
3693
3697
  }
3698
+ /** 한글 뒤 여는 괄호로 꺾인 줄을 붙일까 — 문서 줄 안에서 붙여 쓴 쪽이 셋 넘고 띄운 쪽의 네 배 넘으면 true, 거꾸로면 false, 그 밖 null */
3699
+ parenJoins() {
3700
+ const { joined, spaced } = this.parens;
3701
+ if (joined >= 3 && joined >= 4 * spaced) return true;
3702
+ if (spaced >= 3 && spaced >= 4 * joined) return false;
3703
+ return null;
3704
+ }
3694
3705
  /** 문서 줄 안에서 홀로 선 어절로 나온 적 있나 */
3695
3706
  isWord(word) {
3696
3707
  return (_nullishCoalesce(this.words.get(word), () => ( 0))) > 0;
@@ -3699,6 +3710,10 @@ var WrapLexicon = (_class = class {constructor() { _class.prototype.__init.call(
3699
3710
  joinedWord(left, right) {
3700
3711
  return this.isWord(left + right) && !this.pairs.has(left + " " + right);
3701
3712
  }
3713
+ /** 두 어절을 줄 안에서 띄어 쓴 이웃으로 쓴 적 있나 */
3714
+ spacedPair(left, right) {
3715
+ return this.pairs.has(left + " " + right);
3716
+ }
3702
3717
  /** 줄 안 어절이 이 한글로 시작한 적 있나 */
3703
3718
  startsWord(head) {
3704
3719
  return this.heads.has(head);
@@ -3712,14 +3727,14 @@ var WrapLexicon = (_class = class {constructor() { _class.prototype.__init.call(
3712
3727
  const n = left.length;
3713
3728
  if (n < 2 || right.length < 2) return null;
3714
3729
  const k1 = pairKey(left.charCodeAt(n - 2), left.charCodeAt(n - 1)), k2 = pairKey(right.charCodeAt(0), right.charCodeAt(1));
3715
- return decideCounts(_nullishCoalesce(_optionalChain([this, 'access', _65 => _65.joined2, 'access', _66 => _66.get, 'call', _67 => _67(k1), 'optionalAccess', _68 => _68.get, 'call', _69 => _69(k2)]), () => ( 0)), _nullishCoalesce(_optionalChain([this, 'access', _70 => _70.spaced2, 'access', _71 => _71.get, 'call', _72 => _72(k1), 'optionalAccess', _73 => _73.get, 'call', _74 => _74(k2)]), () => ( 0)));
3730
+ return decideCounts(_nullishCoalesce(_optionalChain([this, 'access', _71 => _71.joined2, 'access', _72 => _72.get, 'call', _73 => _73(k1), 'optionalAccess', _74 => _74.get, 'call', _75 => _75(k2)]), () => ( 0)), _nullishCoalesce(_optionalChain([this, 'access', _76 => _76.spaced2, 'access', _77 => _77.get, 'call', _78 => _78(k1), 'optionalAccess', _79 => _79.get, 'call', _80 => _80(k2)]), () => ( 0)));
3716
3731
  }
3717
3732
  /** 꺾인 자리 증거: "" 붙음 · " " 띄움 · null 모름 (두 글자 증거가 갈리거나 없으면 한 글자) */
3718
3733
  evidence(left, right) {
3719
3734
  const n = left.length;
3720
3735
  if (n >= 2 && right.length >= 2) {
3721
3736
  const k1 = pairKey(left.charCodeAt(n - 2), left.charCodeAt(n - 1)), k2 = pairKey(right.charCodeAt(0), right.charCodeAt(1));
3722
- const v = decideCounts(_nullishCoalesce(_optionalChain([this, 'access', _75 => _75.joined2, 'access', _76 => _76.get, 'call', _77 => _77(k1), 'optionalAccess', _78 => _78.get, 'call', _79 => _79(k2)]), () => ( 0)), _nullishCoalesce(_optionalChain([this, 'access', _80 => _80.spaced2, 'access', _81 => _81.get, 'call', _82 => _82(k1), 'optionalAccess', _83 => _83.get, 'call', _84 => _84(k2)]), () => ( 0)));
3737
+ const v = decideCounts(_nullishCoalesce(_optionalChain([this, 'access', _81 => _81.joined2, 'access', _82 => _82.get, 'call', _83 => _83(k1), 'optionalAccess', _84 => _84.get, 'call', _85 => _85(k2)]), () => ( 0)), _nullishCoalesce(_optionalChain([this, 'access', _86 => _86.spaced2, 'access', _87 => _87.get, 'call', _88 => _88(k1), 'optionalAccess', _89 => _89.get, 'call', _90 => _90(k2)]), () => ( 0)));
3723
3738
  if (v !== null) return v;
3724
3739
  }
3725
3740
  if (n && right.length) {
@@ -3736,9 +3751,9 @@ var hasBatchim = (c) => {
3736
3751
  };
3737
3752
  var CJK = /[\u3000-\u303F\u3040-\u30FF\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF\uFF00-\uFFEF]/;
3738
3753
  var unspacedCjkBoundary = (prev, next) => CJK.test(prev.trimEnd().slice(-1)) && CJK.test(next.trimStart().charAt(0)) && !/[가-힣ㄱ-ㅎㅏ-ㅣ]/.test(prev + next);
3739
- var CLOSE_TAIL = /[’”」』)\]〉》>]+$/;
3754
+ var CLOSE_TAIL = /[’”」』)\]〉》>*]+$/;
3740
3755
  var TAIL = "[.,)\u300D\u300F\u2019\u201D]*";
3741
- var PARTICLE = new RegExp(`^(?:\uB2E4\\.|\uC758|\uC5D0|\uC5D0\uC11C|\uC5D0\uB294|\uC5D0\uAC8C|\uC5D0\uB3C4|\uC5D0\uC11C\uB294|\uAE4C\uC9C0|\uBD80\uD130|\uCC98\uB7FC|\uB9C8\uB2E4|\uB9CC|\uB3C4|\uB4E4|\uB4E4\uC774|\uB4E4\uC758|\uB4E4\uC740|\uB4E4\uC744|\uB4E4\uC5D0\uAC8C|\uC11C\uB294|\uC11C\uB3C4|\uB77C\uACE0|\uB77C\uBA70|\uC740|\uB294|\uC744|\uB97C|\uC73C\uB85C|\uB85C|\uC73C\uB85C\uC11C|\uB85C\uC11C|\uC73C\uB85C\uC368|\uB85C\uC368|\uC5D0\uC11C\uB3C4|\uC5D0\uC11C\uC758|\uC5D0\uC11C\uB9CC|\uC5D0\uC11C\uBD80\uD130|\uC5D0\uB9CC|\uC5D0\uC758|\uC5D0\uAC8C\uB294|\uC5D0\uAC8C\uB3C4|\uAED8\uC11C|\uAED8\uC11C\uB294|\uAED8\uC11C\uB3C4|\uC73C\uB85C\uB294|\uB85C\uB294|\uC73C\uB85C\uB3C4|\uB85C\uB3C4|\uC73C\uB85C\uBD80\uD130|\uB85C\uBD80\uD130|\uBD80\uD130\uB294|\uAE4C\uC9C0\uB294|\uAE4C\uC9C0\uB3C4|\uBCF4\uB2E4\uB3C4|\uB77C\uB3C4|\uC774\uB77C\uB3C4|\uAE4C\uC9C0\uC640|\uAE4C\uC9C0\uC758|\uC5D0\uC11C\uC640|\uC73C\uB85C\uC758|\uB85C\uC758|\uB4E4\uACFC|\uB4E4\uACFC\uC758|\uB4E4\uB85C|\uB4E4\uB3C4|\uB4E4\uC5D0|\uB4E4\uC5D0\uC11C|\uB4E4\uB9CC|\uC774\uB2E4|\uC774\uBA70|\uC774\uB098|\uC774\uB77C\uB294|\uC774\uB77C\uACE0|\uC774\uB77C\uBA70|\uC778\uB370|\uC774\uBBC0\uB85C|\uC774\uC9C0\uB9CC|\uC774\uBA74\uC11C)${TAIL}$`);
3756
+ var PARTICLE = new RegExp(`^(?:\uB2E4\\.|\uC758|\uC5D0|\uC5D0\uC11C|\uC5D0\uB294|\uC5D0\uAC8C|\uC5D0\uB3C4|\uC5D0\uC11C\uB294|\uAE4C\uC9C0|\uBD80\uD130|\uCC98\uB7FC|\uB9C8\uB2E4|\uB9CC|\uB3C4|\uB4E4|\uB4E4\uC774|\uB4E4\uC758|\uB4E4\uC740|\uB4E4\uC744|\uB4E4\uC5D0\uAC8C|\uC11C\uB294|\uC11C\uB3C4|\uB77C\uACE0|\uB77C\uBA70|\uC740|\uB294|\uC744|\uB97C|\uC73C\uB85C|\uB85C|\uC73C\uB85C\uC11C|\uB85C\uC11C|\uC73C\uB85C\uC368|\uB85C\uC368|\uC5D0\uC11C\uB3C4|\uC5D0\uC11C\uC758|\uC5D0\uC11C\uB9CC|\uC5D0\uC11C\uBD80\uD130|\uC5D0\uB9CC|\uC5D0\uC758|\uC5D0\uAC8C\uB294|\uC5D0\uAC8C\uB3C4|\uAED8\uC11C|\uAED8\uC11C\uB294|\uAED8\uC11C\uB3C4|\uC73C\uB85C\uB294|\uB85C\uB294|\uC73C\uB85C\uB3C4|\uB85C\uB3C4|\uC73C\uB85C\uBD80\uD130|\uB85C\uBD80\uD130|\uBD80\uD130\uB294|\uAE4C\uC9C0\uB294|\uAE4C\uC9C0\uB3C4|\uBCF4\uB2E4\uB3C4|\uB77C\uB3C4|\uC774\uB77C\uB3C4|\uAE4C\uC9C0\uC640|\uAE4C\uC9C0\uC758|\uC5D0\uC11C\uC640|\uC73C\uB85C\uC758|\uB85C\uC758|\uB4E4\uACFC|\uB4E4\uACFC\uC758|\uB4E4\uB85C|\uB4E4\uB3C4|\uB4E4\uC5D0|\uB4E4\uC5D0\uC11C|\uB4E4\uB9CC|\uC774\uB2E4|\uC774\uBA70|\uC774\uB098|\uC774\uB77C\uB294|\uC774\uB77C\uACE0|\uC774\uB77C\uBA70|\uC774\uB77C\uBA74\uC11C|\uB77C\uBA74\uC11C|\uC778\uB370|\uC774\uBBC0\uB85C|\uC774\uC9C0\uB9CC|\uC774\uBA74\uC11C)${TAIL}$`);
3742
3757
  var PARTICLE_AFTER_CONS = new RegExp(`^(?:\uC774|\uACFC|\uACFC\uC758|\uC774\uACE0|\uC778|\uC778\uC9C0|\uC784|\uC784\uC744|\uC784\uC5D0\uB3C4|\uC774\uC5B4\uC57C)${TAIL}$`);
3743
3758
  var PARTICLE_AFTER_VOWEL = new RegExp(`^(?:\uAC00|\uC640|\uC640\uC758|\uB77C\uB294)${TAIL}$`);
3744
3759
  var ENDING = new RegExp(`^(?:\uC5B4\uC57C|\uC544\uC57C|\uC5EC\uC57C|\uBBC0\uB85C|\uC73C\uBBC0\uB85C|\uC9C0\uB9CC|\uBA74\uC11C|\uC73C\uBA74\uC11C|\uC73C\uBA70|\uAC70\uB098|\uB354\uB77C\uB3C4|\uB4E0\uC9C0|\uC5C8\uB2E4|\uC558\uB2E4|\uC600\uB2E4|\uC5C8\uC73C\uBA70|\uC558\uC73C\uBA70|\uC600\uC73C\uBA70|\uC5C8\uACE0|\uC558\uACE0|\uC600\uACE0|\uC600\uB358|\uC84C\uB2E4|\uC84C\uC73C\uBA70|\uC84C\uACE0|\uC84C\uB358|\uB294\uB370|\uACA0\uB2E4|\uACA0\uACE0|\uACA0\uC73C\uBA70|\uC2B5\uB2C8\uB2E4|\uB2C8\uB2E4|\uB2C8\uAE4C)${TAIL}$`);
@@ -3800,17 +3815,22 @@ function wrapJoiner(prevText, nextText, lex, heads = true) {
3800
3815
  if (particleContinues(left, right)) return "";
3801
3816
  if (endsAsWord(left)) return " ";
3802
3817
  if (/[A-Za-z]-$/.test(left) && /^[A-Za-z]/.test(right) && !/[가-힣]/.test(prev + next)) {
3803
- return _optionalChain([lex, 'optionalAccess', _85 => _85.joinedWord, 'call', _86 => _86(left, right.replace(/[.,;:!?)]*$/, ""))]) ? "" : " ";
3818
+ return _optionalChain([lex, 'optionalAccess', _91 => _91.joinedWord, 'call', _92 => _92(left, right.replace(/[.,;:!?)]*$/, ""))]) ? "" : " ";
3804
3819
  }
3805
- if (/[·ㆍ‧-]/.test(a) && !/[·ㆍ‧…]{2}$/.test(prev) && /[가-힣A-Za-z0-9]/.test(b)) return "";
3820
+ if (/[·ㆍ‧・․-]/.test(a) && !/[·ㆍ‧・․…]{2}$/.test(prev) && /[가-힣A-Za-z0-9]/.test(b)) return "";
3821
+ if (heads && /[가-힣A-Za-z0-9]/.test(a) && /^[·ㆍ‧・․-][가-힣A-Za-z0-9]/.test(next)) return "";
3806
3822
  if (/[A-Za-z]/.test(a) && /[A-Za-z]/.test(b) || /\d/.test(a) && /\d/.test(b)) return " ";
3807
3823
  if (/(?:^|[^가-힣])제$/.test(left) && /^\d+(?:조|항|호|목|장|절|편|관)/.test(right)) return "";
3808
3824
  const cite = left.match(/제\d+(조|항|호)(?:의\d+)?$/);
3809
3825
  if (cite && /^제\d+(?:항|호|목)/.test(right)) {
3810
- const joins = _optionalChain([lex, 'optionalAccess', _87 => _87.citationJoins, 'call', _88 => _88(cite[1])]);
3826
+ const joins = _optionalChain([lex, 'optionalAccess', _93 => _93.citationJoins, 'call', _94 => _94(cite[1])]);
3827
+ if (joins != null) return joins ? "" : " ";
3828
+ }
3829
+ if (heads && b === "(" && /[가-힣]$/.test(left) && !endsAsWord(left) && !/(?:함|음|됨|임|다)$/.test(left) && !/^\([^()]*\)\s*$/.test(next) && !/^\([^()]*\s[^()]*\)\s/.test(next) && !_optionalChain([lex, 'optionalAccess', _95 => _95.spacedPair, 'call', _96 => _96(left, right)])) {
3830
+ const joins = _optionalChain([lex, 'optionalAccess', _97 => _97.parenJoins, 'call', _98 => _98()]);
3811
3831
  if (joins != null) return joins ? "" : " ";
3812
3832
  }
3813
- const ev = _optionalChain([lex, 'optionalAccess', _89 => _89.evidence, 'call', _90 => _90(left, right)]);
3833
+ const ev = _optionalChain([lex, 'optionalAccess', _99 => _99.evidence, 'call', _100 => _100(left, right)]);
3814
3834
  if (ev != null) return ev;
3815
3835
  if (lex && /[가-힣A-Za-z0-9]$/.test(left) && /^[가-힣A-Za-z0-9]/.test(right) && lex.joinedWord(left, right.replace(/[.,)」』’”;:]+$/, ""))) return "";
3816
3836
  if (/\d$/.test(left) && COUNTER.test(right)) return "";
@@ -3818,7 +3838,7 @@ function wrapJoiner(prevText, nextText, lex, heads = true) {
3818
3838
  const r1 = right.replace(/[.,)」』’”]+$/, "");
3819
3839
  if (lex && /[가-힣]$/.test(left) && /^[가-힣]$/.test(r1) && !STANDALONE_SYLLABLE.test(r1) && !lex.isWord(r1) && !lex.isWord(right)) return "";
3820
3840
  if (lex && heads) {
3821
- const tail = _optionalChain([left, 'access', _91 => _91.match, 'call', _92 => _92(/[가-힣]+$/), 'optionalAccess', _93 => _93[0]]), run = _optionalChain([right, 'access', _94 => _94.match, 'call', _95 => _95(/^[가-힣]+/), 'optionalAccess', _96 => _96[0]]);
3841
+ const tail = _optionalChain([left, 'access', _101 => _101.match, 'call', _102 => _102(/[가-힣]+$/), 'optionalAccess', _103 => _103[0]]), run = _optionalChain([right, 'access', _104 => _104.match, 'call', _105 => _105(/^[가-힣]+/), 'optionalAccess', _106 => _106[0]]);
3822
3842
  if (tail && run && !STANDALONE_SYLLABLE.test(tail) && lex.startsWord(tail + run.slice(0, 2)) && !lex.spacedHead(tail, run[0])) return "";
3823
3843
  if (/[가-힣]{2}$/.test(left) && /^\([^()\s]*\)/.test(right) && !endsAsWord(left) && !/(?:함|음|됨|임|다)$/.test(left) && !BARE_UNIT_PAREN.test(right) && !/^\(\d/.test(right)) return "";
3824
3844
  }
@@ -3855,14 +3875,14 @@ function joinPageBreakWraps(blocks, lex) {
3855
3875
  const last = a.bbox && PARA_LAST_LINE.get(a.bbox), fs = last ? last.fontSize : 0;
3856
3876
  const hang = !/[가-힣]/.test(a.text) && CJK.test(a.text.replace(MARKUP, "").trimEnd().slice(-1)) ? fs : 0;
3857
3877
  if (!last || fs <= 0 || (_nullishCoalesce(pageRight.get(a.pageNumber), () => ( Infinity))) - last.right >= BODY_FULL_TOL * fs + hang) continue;
3858
- if (last.width < BODY_MIN_WIDTH_EM * fs || Math.abs((_nullishCoalesce(_optionalChain([b, 'access', _97 => _97.style, 'optionalAccess', _98 => _98.fontSize]), () => ( 0))) - fs) > 0.15 * fs) continue;
3878
+ if (last.width < BODY_MIN_WIDTH_EM * fs || Math.abs((_nullishCoalesce(_optionalChain([b, 'access', _107 => _107.style, 'optionalAccess', _108 => _108.fontSize]), () => ( 0))) - fs) > 0.15 * fs) continue;
3859
3879
  const bt = b.text.replace(MARKUP, "");
3860
3880
  if (startsNewItem(a.text, b.text) || PAGE_REF_TAIL.test(a.text) || PAGE_ITEM_HEAD.test(bt)) continue;
3861
3881
  if (PAGE_HEAD_MARK.test(bt) && !(/^[\u25a0-\u25ff]/.test(bt) && a.text.includes(bt[0]))) continue;
3862
3882
  const firstLeft = b.bbox && PARA_FIRST_LEFT.get(b.bbox);
3863
3883
  const indented = firstLeft === void 0 || firstLeft - (_nullishCoalesce(pageLeft.get(b.pageNumber), () => ( firstLeft))) >= 0.3 * fs;
3864
3884
  if (indented && SENTENCE_END.test(a.text.replace(MARKUP, "").trimEnd())) continue;
3865
- if (Math.round(_nullishCoalesce(_optionalChain([b, 'access', _99 => _99.style, 'optionalAccess', _100 => _100.fontSize]), () => ( 0))) !== Math.round(fs) && titleLike(b.text)) continue;
3885
+ if (Math.round(_nullishCoalesce(_optionalChain([b, 'access', _109 => _109.style, 'optionalAccess', _110 => _110.fontSize]), () => ( 0))) !== Math.round(fs) && titleLike(b.text)) continue;
3866
3886
  if (/\t/.test(a.text.slice(a.text.lastIndexOf("\n") + 1).replace(/^\S{1,8}\t/, "")) && titleLike(bt.trim().split("\n")[0])) continue;
3867
3887
  const joined = wrapJoiner(a.text, b.text, lex);
3868
3888
  const head = a.text, joiner = joined === "" && last.spaceAfter ? " " : joined;
@@ -3878,9 +3898,9 @@ function joinPageBreakWraps(blocks, lex) {
3878
3898
  }
3879
3899
  function footnoteBetween(a, f, b) {
3880
3900
  if (f.type !== "paragraph" || !f.text || !a.pageNumber || f.pageNumber !== a.pageNumber || b.pageNumber !== a.pageNumber + 1) return false;
3881
- const afs = _nullishCoalesce(_optionalChain([a, 'access', _101 => _101.style, 'optionalAccess', _102 => _102.fontSize]), () => ( 0)), ffs = _nullishCoalesce(_optionalChain([f, 'access', _103 => _103.style, 'optionalAccess', _104 => _104.fontSize]), () => ( 0));
3901
+ const afs = _nullishCoalesce(_optionalChain([a, 'access', _111 => _111.style, 'optionalAccess', _112 => _112.fontSize]), () => ( 0)), ffs = _nullishCoalesce(_optionalChain([f, 'access', _113 => _113.style, 'optionalAccess', _114 => _114.fontSize]), () => ( 0));
3882
3902
  if (!afs || !ffs || ffs > afs * 0.95 || !a.bbox || !f.bbox || f.bbox.y + f.bbox.height > a.bbox.y + 1) return false;
3883
- const at = _nullishCoalesce(_optionalChain([a, 'access', _105 => _105.text, 'optionalAccess', _106 => _106.replace, 'call', _107 => _107(MARKUP, ""), 'access', _108 => _108.trimEnd, 'call', _109 => _109()]), () => ( ""));
3903
+ const at = _nullishCoalesce(_optionalChain([a, 'access', _115 => _115.text, 'optionalAccess', _116 => _116.replace, 'call', _117 => _117(MARKUP, ""), 'access', _118 => _118.trimEnd, 'call', _119 => _119()]), () => ( ""));
3884
3904
  if (/[가-힣]/.test(at) || SENTENCE_END.test(at)) return false;
3885
3905
  return /^(?:\d{1,2}\)?\s|\*|※)/.test(f.text.replace(MARKUP, "").trimStart());
3886
3906
  }
@@ -3920,7 +3940,7 @@ function bodyLineJoins(lines, lex) {
3920
3940
  for (const l of lines) if (!HANGING.test(l.text) && l.right > inner) inner = l.right;
3921
3941
  const full = (l) => right - l.right < BODY_FULL_TOL * l.fontSize || right - inner <= 1.2 * l.fontSize && inner - l.right < BODY_FULL_TOL * l.fontSize;
3922
3942
  const nextWordNoRoom = (a, b) => {
3923
- const w = _optionalChain([b, 'access', _110 => _110.text, 'access', _111 => _111.trim, 'call', _112 => _112(), 'access', _113 => _113.match, 'call', _114 => _114(/^\S+/), 'optionalAccess', _115 => _115[0]]);
3943
+ const w = _optionalChain([b, 'access', _120 => _120.text, 'access', _121 => _121.trim, 'call', _122 => _122(), 'access', _123 => _123.match, 'call', _124 => _124(/^\S+/), 'optionalAccess', _125 => _125[0]]);
3924
3944
  const n = [...b.text.trim()].length;
3925
3945
  if (!w || n === 0) return false;
3926
3946
  const em = (b.right - b.left) / n;
@@ -3946,7 +3966,7 @@ function bodyLineJoins(lines, lex) {
3946
3966
  const a = lines[i], b = lines[i + 1];
3947
3967
  const fs = a.fontSize;
3948
3968
  const own = i === i1 ? p2 : p1;
3949
- const others = Number.isFinite(own) ? own : _nullishCoalesce(_optionalChain([lex, 'optionalAccess', _116 => _116.bodyPitch, 'call', _117 => _117(fs)]), () => ( Infinity));
3969
+ const others = Number.isFinite(own) ? own : _nullishCoalesce(_optionalChain([lex, 'optionalAccess', _126 => _126.bodyPitch, 'call', _127 => _127(fs)]), () => ( Infinity));
3950
3970
  const maxPitch = Number.isFinite(others) ? Math.min(BODY_MAX_PITCH_ABS_EM * fs, Math.max(BODY_MAX_PITCH_EM * fs, others * BODY_PITCH_REL)) : BODY_MAX_PITCH_EM * fs;
3951
3971
  const wordWrap = ragged && !full(a) && nextWordNoRoom(a, b) && !MULTI_LEVEL_NUMBER.test(b.text.trimStart());
3952
3972
  const wraps = fs > 0 && (full(a) || wordWrap) && a.right - a.left >= BODY_MIN_WIDTH_EM * fs && a.y - b.y > 0 && (a.y - b.y < maxPitch || indentedCjkFirstLine(a, b, fs)) && Math.abs(b.fontSize - fs) <= 0.15 * fs && !startsNewItem(a.text, b.text) && !(SENTENCE_END.test(a.text.trimEnd()) && MULTI_LEVEL_NUMBER.test(b.text.trimStart()));
@@ -4123,7 +4143,7 @@ function cellTextToString(items, wrap) {
4123
4143
  const merged = mergeSuperscriptRows(lines).map((line) => sortLineByX(line));
4124
4144
  const textLines = merged.map((s) => {
4125
4145
  if (s.length === 1) return s[0].text;
4126
- if (s.length === 2 && /^[가-힣]$/.test(s[0].text) && /^[가-힣]$/.test(s[1].text) && !!_optionalChain([wrap, 'optionalAccess', _118 => _118.lex]) && (wrap.lex.isWord(s[0].text + s[1].text) || wrap.lex.evidence(s[0].text, s[1].text) === "" || REGION_LABELS.has(s[0].text + s[1].text)) && s[1].x - (s[0].x + s[0].w) >= Math.max(s[0].fontSize, s[1].fontSize) * 1.5 && s[1].x + s[1].w - s[0].x >= wrap.box.x2 - wrap.box.x1 - Math.max(s[0].fontSize, s[1].fontSize) * 2) return s[0].text + s[1].text;
4146
+ if (s.length === 2 && /^[가-힣]$/.test(s[0].text) && /^[가-힣]$/.test(s[1].text) && !!_optionalChain([wrap, 'optionalAccess', _128 => _128.lex]) && (wrap.lex.isWord(s[0].text + s[1].text) || wrap.lex.evidence(s[0].text, s[1].text) === "" || REGION_LABELS.has(s[0].text + s[1].text)) && s[1].x - (s[0].x + s[0].w) >= Math.max(s[0].fontSize, s[1].fontSize) * 1.5 && s[1].x + s[1].w - s[0].x >= wrap.box.x2 - wrap.box.x1 - Math.max(s[0].fontSize, s[1].fontSize) * 2) return s[0].text + s[1].text;
4127
4147
  const evenSpaced = detectEvenSpacedItems(s, true);
4128
4148
  const tracked = trackedSpaces(s);
4129
4149
  const hangulLine = s.some((it) => /[가-힣]/.test(it.text));
@@ -4139,7 +4159,7 @@ function cellTextToString(items, wrap) {
4139
4159
  result += s[j].text;
4140
4160
  } else if (s[j].hasSpaceBefore && exactGap(s[j - 1], s[j], gap) >= avgFs * 0.05) {
4141
4161
  result += " " + s[j].text;
4142
- } else if (gap > spaceGapThreshold(avgFs) || _optionalChain([tracked, 'optionalAccess', _119 => _119[j]])) {
4162
+ } else if (gap > spaceGapThreshold(avgFs) || _optionalChain([tracked, 'optionalAccess', _129 => _129[j]])) {
4143
4163
  result += " " + s[j].text;
4144
4164
  } else {
4145
4165
  result += s[j].text;
@@ -4266,12 +4286,12 @@ function markEvenRun(items, visible, result, start, end) {
4266
4286
  }
4267
4287
  function mergeCellTextLines(textLines, wrap) {
4268
4288
  if (textLines.length <= 1) return textLines[0] || "";
4269
- const numberWrapped = (k) => !!_optionalChain([wrap, 'optionalAccess', _120 => _120.wraps, 'access', _121 => _121[k]]) && (_nullishCoalesce(_optionalChain([wrap, 'access', _122 => _122.wide, 'optionalAccess', _123 => _123[k]]), () => ( true)));
4289
+ const numberWrapped = (k) => !!_optionalChain([wrap, 'optionalAccess', _130 => _130.wraps, 'access', _131 => _131[k]]) && (_nullishCoalesce(_optionalChain([wrap, 'access', _132 => _132.wide, 'optionalAccess', _133 => _133[k]]), () => ( true)));
4270
4290
  const merged = [textLines[0]];
4271
4291
  for (let i = 1; i < textLines.length; i++) {
4272
4292
  const prev = merged[merged.length - 1];
4273
4293
  const curr = textLines[i];
4274
- if (wrap ? wrap.wraps[i - 1] && !_optionalChain([wrap, 'access', _124 => _124.spaced, 'optionalAccess', _125 => _125[i - 1]]) && !startsNewItem(prev, curr) && wrapJoiner(prev, curr, wrap.lex, false) === "" : /[가-힣]$/.test(prev) && /^[가-힣]+$/.test(curr) && curr.length <= 8 && !curr.includes(" ")) {
4294
+ if (wrap ? wrap.wraps[i - 1] && !_optionalChain([wrap, 'access', _134 => _134.spaced, 'optionalAccess', _135 => _135[i - 1]]) && !startsNewItem(prev, curr) && wrapJoiner(prev, curr, wrap.lex, false) === "" : /[가-힣]$/.test(prev) && /^[가-힣]+$/.test(curr) && curr.length <= 8 && !curr.includes(" ")) {
4275
4295
  merged[merged.length - 1] = prev + curr;
4276
4296
  } else if (curr.trim().length <= 3 && /^[)\]%}]/.test(curr.trim())) {
4277
4297
  merged[merged.length - 1] = prev + curr.trim();
@@ -4411,34 +4431,34 @@ function normalizeUndersegmentedTable(originalCells, colXs, items, rowYs, kept,
4411
4431
  if (numRows > maxRows || numCols < MIN_UNDERSEGMENTED_COLUMNS) return null;
4412
4432
  if (items.length === 0) return null;
4413
4433
  if (numRows >= 3) {
4414
- if (_optionalChain([rowYs, 'optionalAccess', _126 => _126.length]) !== numRows + 1) return null;
4434
+ if (_optionalChain([rowYs, 'optionalAccess', _136 => _136.length]) !== numRows + 1) return null;
4415
4435
  const rebuilt2 = [];
4416
4436
  let expanded = 0;
4417
4437
  const ocr = items.every((it) => it.fontName === "ocr");
4418
4438
  for (let r = 0; r < numRows; r++) {
4419
4439
  const row = originalCells[r].map((cell) => cell.text);
4420
4440
  if (r === 0 || numRows === 3 && r === 1) {
4421
- _optionalChain([kept, 'optionalAccess', _127 => _127.set, 'call', _128 => _128(rebuilt2.length, r)]);
4441
+ _optionalChain([kept, 'optionalAccess', _137 => _137.set, 'call', _138 => _138(rebuilt2.length, r)]);
4422
4442
  rebuilt2.push(row);
4423
4443
  continue;
4424
4444
  }
4425
4445
  const span2 = Math.min(numRows - r, Math.max(1, ...originalCells[r].map((cell) => _nullishCoalesce(cell.rowSpan, () => ( 1)))));
4426
4446
  const filled = originalCells[r].filter((cell) => cell.text.trim());
4427
4447
  const spanning = filled.filter((cell) => (_nullishCoalesce(cell.rowSpan, () => ( 1))) >= span2);
4428
- const loose = ocr && filled.length >= MIN_UNDERSEGMENTED_COLUMNS && spanning.length * 2 > filled.length && originalCells.slice(r + 1, r + span2).every((cells) => cells.every((cell, c) => !cell.text.trim() || (_nullishCoalesce(_optionalChain([originalCells, 'access', _129 => _129[r], 'access', _130 => _130[c], 'optionalAccess', _131 => _131.rowSpan]), () => ( 1))) === 1));
4448
+ const loose = ocr && filled.length >= MIN_UNDERSEGMENTED_COLUMNS && spanning.length * 2 > filled.length && originalCells.slice(r + 1, r + span2).every((cells) => cells.every((cell, c) => !cell.text.trim() || (_nullishCoalesce(_optionalChain([originalCells, 'access', _139 => _139[r], 'access', _140 => _140[c], 'optionalAccess', _141 => _141.rowSpan]), () => ( 1))) === 1));
4429
4449
  const band = span2 > 1 && (loose || originalCells.slice(r + 1, r + span2).every((cells) => cells.every((cell) => !cell.text.trim()))) ? span2 : 1;
4430
4450
  const rowItems = items.filter((item) => itemCenterY(item) <= rowYs[r] + 1 && itemCenterY(item) >= rowYs[r + band] - 1);
4431
4451
  const body = normalizeUndersegmentedTable([originalCells[r]], colXs, rowItems, void 0, void 0, void 0, band > 1 ? 2 : MIN_ALIGNED_LINES);
4432
4452
  if (body) {
4433
4453
  originalCells[r].forEach((cell, c) => {
4434
4454
  const cols = Array.from({ length: Math.max(1, _nullishCoalesce(cell.colSpan, () => ( 1))) }, (_, k) => c + k);
4435
- if (cell.text.trim() && body.every((cells) => cols.every((k) => !_optionalChain([cells, 'access', _132 => _132[k], 'optionalAccess', _133 => _133.trim, 'call', _134 => _134()])))) body[0][c] = cell.text;
4455
+ if (cell.text.trim() && body.every((cells) => cols.every((k) => !_optionalChain([cells, 'access', _142 => _142[k], 'optionalAccess', _143 => _143.trim, 'call', _144 => _144()])))) body[0][c] = cell.text;
4436
4456
  });
4437
4457
  rebuilt2.push(...body);
4438
4458
  expanded++;
4439
4459
  r += band - 1;
4440
4460
  } else {
4441
- _optionalChain([kept, 'optionalAccess', _135 => _135.set, 'call', _136 => _136(rebuilt2.length, r)]);
4461
+ _optionalChain([kept, 'optionalAccess', _145 => _145.set, 'call', _146 => _146(rebuilt2.length, r)]);
4442
4462
  rebuilt2.push(row);
4443
4463
  }
4444
4464
  }
@@ -4522,7 +4542,7 @@ function sortLineByX(items) {
4522
4542
  e++;
4523
4543
  }
4524
4544
  const run = items.slice(s, e), seqs = run.map((i) => i.seq);
4525
- const ok = !wide ? !run.some((i) => _optionalChain([i, 'access', _137 => _137.text, 'optionalAccess', _138 => _138.startsWith, 'call', _139 => _139("$")])) : Math.max(...seqs) - Math.min(...seqs) <= 2 * (e - s - 1) && run.every((i) => Math.abs((_nullishCoalesce(i.fontSize, () => ( 0))) - (_nullishCoalesce(run[0].fontSize, () => ( 0)))) <= 0.5);
4545
+ const ok = !wide ? !run.some((i) => _optionalChain([i, 'access', _147 => _147.text, 'optionalAccess', _148 => _148.startsWith, 'call', _149 => _149("$")])) : Math.max(...seqs) - Math.min(...seqs) <= 2 * (e - s - 1) && run.every((i) => Math.abs((_nullishCoalesce(i.fontSize, () => ( 0))) - (_nullishCoalesce(run[0].fontSize, () => ( 0)))) <= 0.5);
4526
4546
  if (e - s > 1 && seqs.every((q) => q !== void 0) && ok) {
4527
4547
  run.sort((a, b) => a.seq - b.seq);
4528
4548
  for (let k = 0; k < run.length; k++) items[s + k] = run[k];
@@ -4597,7 +4617,7 @@ function dominantStyle(items) {
4597
4617
  let maxCount = 0, dominantSize = 0;
4598
4618
  for (const i of items) {
4599
4619
  if (i.fontSize <= 0) continue;
4600
- const count = (freq.get(i.fontSize) || 0) + Math.max(1, _nullishCoalesce(_optionalChain([i, 'access', _140 => _140.text, 'access', _141 => _141.match, 'call', _142 => _142(/[\p{L}\p{N}]/gu), 'optionalAccess', _143 => _143.length]), () => ( 0)));
4620
+ const count = (freq.get(i.fontSize) || 0) + Math.max(1, _nullishCoalesce(_optionalChain([i, 'access', _150 => _150.text, 'access', _151 => _151.match, 'call', _152 => _152(/[\p{L}\p{N}]/gu), 'optionalAccess', _153 => _153.length]), () => ( 0)));
4601
4621
  freq.set(i.fontSize, count);
4602
4622
  if (count > maxCount) {
4603
4623
  maxCount = count;
@@ -4605,7 +4625,7 @@ function dominantStyle(items) {
4605
4625
  }
4606
4626
  }
4607
4627
  if (dominantSize === 0) return void 0;
4608
- const fontName = _optionalChain([items, 'access', _144 => _144.find, 'call', _145 => _145((i) => i.fontSize === dominantSize), 'optionalAccess', _146 => _146.fontName]) || void 0;
4628
+ const fontName = _optionalChain([items, 'access', _154 => _154.find, 'call', _155 => _155((i) => i.fontSize === dominantSize), 'optionalAccess', _156 => _156.fontName]) || void 0;
4609
4629
  return fontName ? { fontSize: dominantSize, fontName } : { fontSize: dominantSize };
4610
4630
  }
4611
4631
  function normalizeItems(rawItems) {
@@ -4760,7 +4780,7 @@ function splitAroundOverlays(c, overlays) {
4760
4780
  const ov = overlays.filter((o) => {
4761
4781
  for (let at = c.text.indexOf(o.text); at >= 0; at = c.text.indexOf(o.text, at + 1)) {
4762
4782
  const prefix = c.text.slice(0, at);
4763
- const est = c.x + glyphUnits(prefix.replace(/\s+/g, "")) * a0 + (_nullishCoalesce(_optionalChain([prefix, 'access', _147 => _147.match, 'call', _148 => _148(/\s+/g), 'optionalAccess', _149 => _149.length]), () => ( 0))) * ws;
4783
+ const est = c.x + glyphUnits(prefix.replace(/\s+/g, "")) * a0 + (_nullishCoalesce(_optionalChain([prefix, 'access', _157 => _157.match, 'call', _158 => _158(/\s+/g), 'optionalAccess', _159 => _159.length]), () => ( 0))) * ws;
4764
4784
  if (Math.abs(est - o.x) <= OVERLAY_DUP_EM * fs) return false;
4765
4785
  }
4766
4786
  return true;
@@ -4922,7 +4942,7 @@ function trackedSpaces(sorted, med = trackingShift([sorted])) {
4922
4942
  });
4923
4943
  }
4924
4944
  function mergeLineSimple(items) {
4925
- if (items.length <= 1) return _optionalChain([items, 'access', _150 => _150[0], 'optionalAccess', _151 => _151.text]) || "";
4945
+ if (items.length <= 1) return _optionalChain([items, 'access', _160 => _160[0], 'optionalAccess', _161 => _161.text]) || "";
4926
4946
  const sorted = sortLineByX([...items]);
4927
4947
  const tracked = trackedSpaces(sorted);
4928
4948
  const isEvenSpaced = detectEvenSpacedItems(sorted);
@@ -4957,7 +4977,7 @@ function mergeLineSimple(items) {
4957
4977
  result += sorted[i].text;
4958
4978
  continue;
4959
4979
  }
4960
- if (gap > spaceGapThreshold(avgFs) || _optionalChain([tracked, 'optionalAccess', _152 => _152[i]])) result += " ";
4980
+ if (gap > spaceGapThreshold(avgFs) || _optionalChain([tracked, 'optionalAccess', _162 => _162[i]])) result += " ";
4961
4981
  result += sorted[i].text;
4962
4982
  }
4963
4983
  return result;
@@ -5014,7 +5034,7 @@ function isProseTable(table) {
5014
5034
  if (!(long > 0 && long >= total * 0.5 && longRows >= rows * 0.4)) return false;
5015
5035
  for (let c = 0; c < table.cols; c++) {
5016
5036
  const filled = table.cells.map((row) => row[c]).filter((cell) => cell && cell.colSpan < table.cols && cell.text.trim()).map((cell) => cell.text.trim());
5017
- if (filled.length >= 3 && filled.length >= rows * 0.6 && filled.every((text) => text.length <= 30 && (_nullishCoalesce(_optionalChain([text, 'access', _153 => _153.match, 'call', _154 => _154(/\p{L}/gu), 'optionalAccess', _155 => _155.length]), () => ( 0))) >= 2)) return false;
5037
+ if (filled.length >= 3 && filled.length >= rows * 0.6 && filled.every((text) => text.length <= 30 && (_nullishCoalesce(_optionalChain([text, 'access', _163 => _163.match, 'call', _164 => _164(/\p{L}/gu), 'optionalAccess', _165 => _165.length]), () => ( 0))) >= 2)) return false;
5018
5038
  }
5019
5039
  return true;
5020
5040
  }
@@ -5043,7 +5063,7 @@ var TICK = /^-?[\d,]+(?:\.\d+)?%?$/;
5043
5063
  var QUANTITY = /^[-−–]?[\d,]*\.?\d+%?$/;
5044
5064
  var quantity = (token) => Number(token.replace(/^[−–]/, "-").replace(/[,%]/g, ""));
5045
5065
  function isValueAxisColumn(table, c) {
5046
- const lines = table.cells.flatMap((row) => (_nullishCoalesce(_optionalChain([row, 'access', _156 => _156[c], 'optionalAccess', _157 => _157.text]), () => ( ""))).split("\n").map((line) => line.trim().split(/\s+/)));
5066
+ const lines = table.cells.flatMap((row) => (_nullishCoalesce(_optionalChain([row, 'access', _166 => _166[c], 'optionalAccess', _167 => _167.text]), () => ( ""))).split("\n").map((line) => line.trim().split(/\s+/)));
5047
5067
  const others = table.cells.flatMap((row) => row.filter((_, k) => k !== c).map((cell) => cell.text.trim().split(/\s+/))).filter((tokens) => tokens.every((token) => QUANTITY.test(token))).flat().map(quantity).filter((v) => !(Number.isInteger(v) && v >= 1900 && v <= 2100));
5048
5068
  for (const ticks of [lines.flat().filter((t) => TICK.test(t)).map(quantity), lines.map((tokens) => tokens[0]).filter((t) => TICK.test(t)).map(quantity)]) {
5049
5069
  const run = fallingRun(ticks);
@@ -5076,7 +5096,7 @@ function isChartTable(table, ocr = false) {
5076
5096
  if (numeric < texts.length * 0.5) return false;
5077
5097
  if (ocr && table.cols >= 3 && table.cells.slice(0, 3).some((row) => row.filter((cell) => /[가-힣]{2}/.test(cell.text)).length >= 2)) return false;
5078
5098
  for (let c = 0; c < table.cols; c++) {
5079
- if (!ocr ? isValueAxisColumn(table, c) : hasValueAxis(table.cells.flatMap((row) => (_nullishCoalesce(_optionalChain([row, 'access', _158 => _158[c], 'optionalAccess', _159 => _159.text]), () => ( ""))).split(/\s+/)).filter((t) => TICK.test(t)).map((t) => Number(t.replace(/[,%]/g, ""))))) return true;
5099
+ if (!ocr ? isValueAxisColumn(table, c) : hasValueAxis(table.cells.flatMap((row) => (_nullishCoalesce(_optionalChain([row, 'access', _168 => _168[c], 'optionalAccess', _169 => _169.text]), () => ( ""))).split(/\s+/)).filter((t) => TICK.test(t)).map((t) => Number(t.replace(/[,%]/g, ""))))) return true;
5080
5100
  }
5081
5101
  const values = texts.filter((text) => text.split(/\s+/).every((token) => QUANTITY.test(token))).length;
5082
5102
  const cells = table.rows * table.cols;
@@ -5085,7 +5105,7 @@ function isChartTable(table, ocr = false) {
5085
5105
  function isProseFragmentTable(table) {
5086
5106
  const texts = table.cells.flat().map((cell) => cell.text.trim()).filter(Boolean);
5087
5107
  if (texts.length < 4) return false;
5088
- const hangul = (text) => _nullishCoalesce(_optionalChain([text, 'access', _160 => _160.match, 'call', _161 => _161(/[가-힣]/g), 'optionalAccess', _162 => _162.length]), () => ( 0));
5108
+ const hangul = (text) => _nullishCoalesce(_optionalChain([text, 'access', _170 => _170.match, 'call', _171 => _171(/[가-힣]/g), 'optionalAccess', _172 => _172.length]), () => ( 0));
5089
5109
  if (texts.filter((text) => hangul(text) >= 2).length < texts.length * 0.7) return false;
5090
5110
  if (texts.length >= 12 && texts.filter((text) => hangul(text) >= 15 && !text.includes("\n")).length >= texts.length * 0.4) return true;
5091
5111
  return texts.filter((text) => /(?:[다요고서는을를에게지며면어아야니까던]|[.,?!])$/.test(text)).length >= texts.length * 0.3;
@@ -5138,7 +5158,7 @@ function clusterCellLines(items) {
5138
5158
  }
5139
5159
  var WRAP_INDENT_MAX = 3;
5140
5160
  function joinClusterCellLines(lines, box, lex) {
5141
- let out = _nullishCoalesce(_optionalChain([lines, 'access', _163 => _163[0], 'optionalAccess', _164 => _164.text]), () => ( ""));
5161
+ let out = _nullishCoalesce(_optionalChain([lines, 'access', _173 => _173[0], 'optionalAccess', _174 => _174.text]), () => ( ""));
5142
5162
  for (let i = 1; i < lines.length; i++) {
5143
5163
  const a = lines[i - 1], b = lines[i];
5144
5164
  const join2 = !a.spaceAfter && cellLineWraps(box, box.x1, a.right, a.fontSize, b.firstCharW) && a.left - box.x1 <= WRAP_INDENT_MAX * a.fontSize && b.left - box.x1 <= WRAP_INDENT_MAX * b.fontSize && /<\/u>$/.test(a.text) === /^<u>/.test(b.text) && !startsNewItem(out, b.text) && wrapJoiner(out, b.text, lex, false) === "";
@@ -5483,7 +5503,7 @@ function detectAlignedTwoColumnTables(rows, pageNum) {
5483
5503
  continue;
5484
5504
  }
5485
5505
  const top = rows[i - 1];
5486
- const title = _optionalChain([top, 'optionalAccess', _165 => _165.items, 'access', _166 => _166.length]) === 1 && Math.abs(top.items[0].x - first[0].x) <= 5 && top.items[0].text.length <= 65 && top.y - first[0].y <= Math.max(24, first[0].fontSize * 2.8) ? top : void 0;
5506
+ const title = _optionalChain([top, 'optionalAccess', _175 => _175.items, 'access', _176 => _176.length]) === 1 && Math.abs(top.items[0].x - first[0].x) <= 5 && top.items[0].text.length <= 65 && top.y - first[0].y <= Math.max(24, first[0].fontSize * 2.8) ? top : void 0;
5487
5507
  const tableRows = [...title ? [title] : [], ...body.flatMap((b) => b.rows)];
5488
5508
  const cells = [
5489
5509
  ...title ? [[{ text: title.items[0].text, colSpan: 2, rowSpan: 1 }, { text: "", colSpan: 1, rowSpan: 1 }]] : [],
@@ -5539,12 +5559,12 @@ function isTwoColumnProse(r) {
5539
5559
  if (t.rows < (ocr ? 6 : 8)) return false;
5540
5560
  const dense = [];
5541
5561
  for (let c = 0; c < t.cols; c++) {
5542
- const filled = t.cells.filter((row) => _optionalChain([row, 'access', _167 => _167[c], 'optionalAccess', _168 => _168.text, 'access', _169 => _169.trim, 'call', _170 => _170()])).length;
5562
+ const filled = t.cells.filter((row) => _optionalChain([row, 'access', _177 => _177[c], 'optionalAccess', _178 => _178.text, 'access', _179 => _179.trim, 'call', _180 => _180()])).length;
5543
5563
  if (filled / t.rows >= 0.3) dense.push(c);
5544
5564
  }
5545
5565
  if (dense.length !== 2) return false;
5546
5566
  for (const c of dense) {
5547
- const lens = t.cells.map((row) => _nullishCoalesce(_optionalChain([row, 'access', _171 => _171[c], 'optionalAccess', _172 => _172.text, 'access', _173 => _173.replace, 'call', _174 => _174(/\s+/g, ""), 'access', _175 => _175.length]), () => ( 0))).filter((n) => n > 0);
5567
+ const lens = t.cells.map((row) => _nullishCoalesce(_optionalChain([row, 'access', _181 => _181[c], 'optionalAccess', _182 => _182.text, 'access', _183 => _183.replace, 'call', _184 => _184(/\s+/g, ""), 'access', _185 => _185.length]), () => ( 0))).filter((n) => n > 0);
5548
5568
  const avg = lens.reduce((s, v) => s + v, 0) / (lens.length || 1);
5549
5569
  if (avg < (ocr ? 15 : 12)) return false;
5550
5570
  }
@@ -6006,7 +6026,7 @@ function assignRowItems(items, columns, numCols, headerFace) {
6006
6026
  const runs = [];
6007
6027
  for (const it of sorted) {
6008
6028
  const last = runs[runs.length - 1];
6009
- const prev = _optionalChain([last, 'optionalAccess', _176 => _176[last.length - 1]]);
6029
+ const prev = _optionalChain([last, 'optionalAccess', _186 => _186[last.length - 1]]);
6010
6030
  if (prev && it.x - (prev.x + prev.w) <= Math.max(0.5, it.fontSize * 0.05) && !it.hasSpaceBefore) last.push(it);
6011
6031
  else runs.push([it]);
6012
6032
  }
@@ -6057,7 +6077,7 @@ function assignRowItems(items, columns, numCols, headerFace) {
6057
6077
  assignedGroups.add(gi);
6058
6078
  usedCols.add(ci);
6059
6079
  }
6060
- const colOf = groups.map((g) => _nullishCoalesce(_optionalChain([result, 'access', _177 => _177.find, 'call', _178 => _178((a) => a.items === g), 'optionalAccess', _179 => _179.col]), () => ( -1)));
6080
+ const colOf = groups.map((g) => _nullishCoalesce(_optionalChain([result, 'access', _187 => _187.find, 'call', _188 => _188((a) => a.items === g), 'optionalAccess', _189 => _189.col]), () => ( -1)));
6061
6081
  if (groups.length <= numCols && colOf.some((c, g) => g > 0 && c < colOf[g - 1])) {
6062
6082
  const G = groups.length, cost = (g, c2) => Math.abs(groupCenters[g] - colCenters[c2]);
6063
6083
  const best = groups.map(() => new Array(numCols).fill(Infinity)), from = groups.map(() => new Array(numCols).fill(-1));
@@ -6094,7 +6114,7 @@ function assignRowItems(items, columns, numCols, headerFace) {
6094
6114
  function buildClusterTable(rows, columns, pageNum, lex) {
6095
6115
  const numRows = rows.length;
6096
6116
  if (numRows < MIN_ROWS || columns.length < MIN_COLS) return null;
6097
- const headFaces = new Set(_optionalChain([rows, 'access', _180 => _180[0], 'optionalAccess', _181 => _181.items, 'access', _182 => _182.map, 'call', _183 => _183((i) => i.fontName)]));
6117
+ const headFaces = new Set(_optionalChain([rows, 'access', _190 => _190[0], 'optionalAccess', _191 => _191.items, 'access', _192 => _192.map, 'call', _193 => _193((i) => i.fontName)]));
6098
6118
  const headerFace = headFaces.size === 1 && rows.slice(1).every((row) => row.items.every((i) => !headFaces.has(i.fontName))) ? [...headFaces][0] : void 0;
6099
6119
  const assigned = rows.map((row, r) => assignRowItems(row.items, columns, columns.length, r === 0 ? headerFace : void 0));
6100
6120
  const cuts = supportedOcrColumnCuts(assigned);
@@ -6165,7 +6185,7 @@ function buildClusterTable(rows, columns, pageNum, lex) {
6165
6185
  const nonEmptyCols = cells[r].filter((c) => c.text.trim()).length;
6166
6186
  if (nonEmptyCols !== 1) continue;
6167
6187
  if (cells[r][0].text.trim() !== "") continue;
6168
- const contentText = _optionalChain([cells, 'access', _184 => _184[r], 'access', _185 => _185.find, 'call', _186 => _186((c) => c.text.trim()), 'optionalAccess', _187 => _187.text, 'access', _188 => _188.trim, 'call', _189 => _189()]) || "";
6188
+ const contentText = _optionalChain([cells, 'access', _194 => _194[r], 'access', _195 => _195.find, 'call', _196 => _196((c) => c.text.trim()), 'optionalAccess', _197 => _197.text, 'access', _198 => _198.trim, 'call', _199 => _199()]) || "";
6169
6189
  if (/^[○●▶\-·]/.test(contentText)) continue;
6170
6190
  for (let pr = r - 1; pr >= 0; pr--) {
6171
6191
  if (cells[pr].some((c) => c.text.trim())) {
@@ -6398,7 +6418,7 @@ function stackedTableBands(items) {
6398
6418
  const caption = (start, end) => lines.slice(start, end).some((line) => /^Table\s+\d+\s*[:.]/i.test(mergeLineSimple(line).trim()));
6399
6419
  while (runs.length > 0 && !caption(runs[runs.length - 1].end, lines.length)) runs.pop();
6400
6420
  if (runs.length < 2) return null;
6401
- if (runs.some((run, i) => !caption(run.end, _nullishCoalesce(_optionalChain([runs, 'access', _190 => _190[i + 1], 'optionalAccess', _191 => _191.start]), () => ( lines.length))))) return null;
6421
+ if (runs.some((run, i) => !caption(run.end, _nullishCoalesce(_optionalChain([runs, 'access', _200 => _200[i + 1], 'optionalAccess', _201 => _201.start]), () => ( lines.length))))) return null;
6402
6422
  const tables = runs.map((run) => lines.slice(run.start, run.end).flat());
6403
6423
  const between = runs.slice(0, -1).map((run, i) => lines.slice(run.end, runs[i + 1].start).flat());
6404
6424
  const tail = lines.slice(runs[runs.length - 1].end);
@@ -6666,7 +6686,7 @@ function splitTrailingColumnRegion(items) {
6666
6686
  }
6667
6687
  function panelBlocks(items, panel, pageNum) {
6668
6688
  const lines = groupByY([...items].sort((a, b) => b.y - a.y || a.x - b.x));
6669
- const faceOf = (line) => _nullishCoalesce(_optionalChain([dominantStyle, 'call', _192 => _192(line), 'optionalAccess', _193 => _193.fontName]), () => ( ""));
6689
+ const faceOf = (line) => _nullishCoalesce(_optionalChain([dominantStyle, 'call', _202 => _202(line), 'optionalAccess', _203 => _203.fontName]), () => ( ""));
6670
6690
  const runs = [];
6671
6691
  for (const line of lines) {
6672
6692
  const last = runs[runs.length - 1];
@@ -6873,7 +6893,7 @@ function validWrapBands(items, bands) {
6873
6893
  }
6874
6894
  function inheritedWrapBands(items) {
6875
6895
  const source = XY_WRAP_ITEMS.get(items[0]);
6876
- const present = _optionalChain([source, 'optionalAccess', _194 => _194.length]) === items.length ? new Set(items) : null;
6896
+ const present = _optionalChain([source, 'optionalAccess', _204 => _204.length]) === items.length ? new Set(items) : null;
6877
6897
  const sameLeaf = present && source.every((item) => present.has(item));
6878
6898
  return sameLeaf ? validWrapBands(items, _nullishCoalesce(XY_WRAP_BANDS.get(items[0]), () => ( []))) : [];
6879
6899
  }
@@ -6908,7 +6928,7 @@ function splitsLoneRowTail(items, x) {
6908
6928
  const tail = right[0], box = computeBBox(items, 0), tailBox = computeBBox(tail, 0);
6909
6929
  const head = left.find((r) => Math.abs(r[0].y - tail[0].y) <= 2);
6910
6930
  if (!head) return false;
6911
- const headBox = computeBBox(head, 0), fs = _nullishCoalesce(_optionalChain([dominantStyle, 'call', _195 => _195(tail), 'optionalAccess', _196 => _196.fontSize]), () => ( 10));
6931
+ const headBox = computeBBox(head, 0), fs = _nullishCoalesce(_optionalChain([dominantStyle, 'call', _205 => _205(tail), 'optionalAccess', _206 => _206.fontSize]), () => ( 10));
6912
6932
  const gap = tailBox.x - (headBox.x + headBox.width), fills = tailBox.x + tailBox.width >= box.x + box.width - fs;
6913
6933
  if (gap <= fs * 3 && fills && headBox.width >= box.width / 2) return true;
6914
6934
  const text = [...head, ...tail].map((i) => i.text).join("");
@@ -6924,7 +6944,7 @@ function wrappedLineBands(items, inherited, lex) {
6924
6944
  left: box.x,
6925
6945
  right: box.x + box.width,
6926
6946
  y: row.reduce((n, i) => n + i.y, 0) / row.length,
6927
- fontSize: _nullishCoalesce(_optionalChain([dominantStyle, 'call', _197 => _197(row), 'optionalAccess', _198 => _198.fontSize]), () => ( 0)),
6947
+ fontSize: _nullishCoalesce(_optionalChain([dominantStyle, 'call', _207 => _207(row), 'optionalAccess', _208 => _208.fontSize]), () => ( 0)),
6928
6948
  sources: row.map((item) => ({ item, state: { ...item } }))
6929
6949
  };
6930
6950
  });
@@ -7060,10 +7080,10 @@ function pushLineParagraphs(out, yLines, pageNum, lex) {
7060
7080
  const lines = attachDropCaps(yLines).map((items) => ({ items, text: mergeLineSimple(items) })).filter((l) => l.text.trim());
7061
7081
  const geo = lines.map((l) => {
7062
7082
  const b = computeBBox(l.items, pageNum);
7063
- return { text: l.text, left: b.x, right: b.x + b.width, y: l.items.reduce((s, i) => s + i.y, 0) / l.items.length, fontSize: _nullishCoalesce(_optionalChain([dominantStyle, 'call', _199 => _199(l.items), 'optionalAccess', _200 => _200.fontSize]), () => ( 0)) };
7083
+ return { text: l.text, left: b.x, right: b.x + b.width, y: l.items.reduce((s, i) => s + i.y, 0) / l.items.length, fontSize: _nullishCoalesce(_optionalChain([dominantStyle, 'call', _209 => _209(l.items), 'optionalAccess', _210 => _210.fontSize]), () => ( 0)) };
7064
7084
  });
7065
7085
  const joins = bodyLineJoins(geo, lex);
7066
- const first = _optionalChain([lines, 'access', _201 => _201[0], 'optionalAccess', _202 => _202.items, 'access', _203 => _203[0]]);
7086
+ const first = _optionalChain([lines, 'access', _211 => _211[0], 'optionalAccess', _212 => _212.items, 'access', _213 => _213[0]]);
7067
7087
  const bands = first ? _nullishCoalesce(XY_WRAP_BANDS.get(first), () => ( [])) : [];
7068
7088
  const hasBand = (top, bottom) => {
7069
7089
  let lo = 0, hi = bands.length;
@@ -7140,15 +7160,15 @@ function computeMedianFontSizeFromFreq(freq) {
7140
7160
  function detectHeadings(blocks, medianFontSize) {
7141
7161
  for (let bi = 0; bi < blocks.length; bi++) {
7142
7162
  const block = blocks[bi];
7143
- if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _204 => _204.style, 'optionalAccess', _205 => _205.fontSize])) continue;
7163
+ if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _214 => _214.style, 'optionalAccess', _215 => _215.fontSize])) continue;
7144
7164
  const text = block.text.trim();
7145
7165
  if (text.length === 0 || text.length > 200) continue;
7146
7166
  if (/^\d+$/.test(text) && !isChapterNumber(block, blocks[bi + 1], medianFontSize)) continue;
7147
7167
  const ratio = block.style.fontSize / medianFontSize;
7148
7168
  let level = 0;
7149
- if (ratio >= _chunkOW2XKTQAcjs.HEADING_RATIO_H1) level = 1;
7150
- else if (ratio >= _chunkOW2XKTQAcjs.HEADING_RATIO_H2) level = 2;
7151
- else if (ratio >= _chunkOW2XKTQAcjs.HEADING_RATIO_H3) level = 3;
7169
+ if (ratio >= _chunk5MBQW3KPcjs.HEADING_RATIO_H1) level = 1;
7170
+ else if (ratio >= _chunk5MBQW3KPcjs.HEADING_RATIO_H2) level = 2;
7171
+ else if (ratio >= _chunk5MBQW3KPcjs.HEADING_RATIO_H3) level = 3;
7152
7172
  if (level > 0) {
7153
7173
  block.type = "heading";
7154
7174
  block.level = level;
@@ -7157,21 +7177,21 @@ function detectHeadings(blocks, medianFontSize) {
7157
7177
  }
7158
7178
  }
7159
7179
  function isChapterNumber(block, next, medianFontSize) {
7160
- const size = _nullishCoalesce(_optionalChain([block, 'access', _206 => _206.style, 'optionalAccess', _207 => _207.fontSize]), () => ( 0));
7161
- const nextSize = _nullishCoalesce(_optionalChain([next, 'optionalAccess', _208 => _208.style, 'optionalAccess', _209 => _209.fontSize]), () => ( 0));
7162
- const text = _nullishCoalesce(_optionalChain([next, 'optionalAccess', _210 => _210.text, 'optionalAccess', _211 => _211.trim, 'call', _212 => _212()]), () => ( ""));
7163
- const a = block.bbox, b = _optionalChain([next, 'optionalAccess', _213 => _213.bbox]);
7164
- return /^\d{1,2}$/.test(_nullishCoalesce(_optionalChain([block, 'access', _214 => _214.text, 'optionalAccess', _215 => _215.trim, 'call', _216 => _216()]), () => ( ""))) && size >= medianFontSize * 2.5 && !!next && (next.type === "paragraph" || next.type === "heading") && next.pageNumber === block.pageNumber && nextSize >= medianFontSize * _chunkOW2XKTQAcjs.HEADING_RATIO_H1 && text.length > 0 && text.length <= 80 && !/^[\d\s.]+$/.test(text) && !!a && !!b && a.y > b.y && a.y - (b.y + b.height) <= size * 2;
7180
+ const size = _nullishCoalesce(_optionalChain([block, 'access', _216 => _216.style, 'optionalAccess', _217 => _217.fontSize]), () => ( 0));
7181
+ const nextSize = _nullishCoalesce(_optionalChain([next, 'optionalAccess', _218 => _218.style, 'optionalAccess', _219 => _219.fontSize]), () => ( 0));
7182
+ const text = _nullishCoalesce(_optionalChain([next, 'optionalAccess', _220 => _220.text, 'optionalAccess', _221 => _221.trim, 'call', _222 => _222()]), () => ( ""));
7183
+ const a = block.bbox, b = _optionalChain([next, 'optionalAccess', _223 => _223.bbox]);
7184
+ return /^\d{1,2}$/.test(_nullishCoalesce(_optionalChain([block, 'access', _224 => _224.text, 'optionalAccess', _225 => _225.trim, 'call', _226 => _226()]), () => ( ""))) && size >= medianFontSize * 2.5 && !!next && (next.type === "paragraph" || next.type === "heading") && next.pageNumber === block.pageNumber && nextSize >= medianFontSize * _chunk5MBQW3KPcjs.HEADING_RATIO_H1 && text.length > 0 && text.length <= 80 && !/^[\d\s.]+$/.test(text) && !!a && !!b && a.y > b.y && a.y - (b.y + b.height) <= size * 2;
7165
7185
  }
7166
7186
  function mergeStackedHeadingLines(blocks, medianFontSize) {
7167
7187
  for (let i = 0; i < blocks.length - 1; ) {
7168
7188
  const a = blocks[i], b = blocks[i + 1];
7169
7189
  const ab = a.bbox, bb = b.bbox;
7170
- const af = _nullishCoalesce(_optionalChain([a, 'access', _217 => _217.style, 'optionalAccess', _218 => _218.fontSize]), () => ( 0)), bf = _nullishCoalesce(_optionalChain([b, 'access', _219 => _219.style, 'optionalAccess', _220 => _220.fontSize]), () => ( 0));
7190
+ const af = _nullishCoalesce(_optionalChain([a, 'access', _227 => _227.style, 'optionalAccess', _228 => _228.fontSize]), () => ( 0)), bf = _nullishCoalesce(_optionalChain([b, 'access', _229 => _229.style, 'optionalAccess', _230 => _230.fontSize]), () => ( 0));
7171
7191
  const gap = ab && bb ? ab.y - (bb.y + bb.height) : Infinity;
7172
- const centered = ab && bb && _optionalChain([a, 'access', _221 => _221.style, 'optionalAccess', _222 => _222.fontName]) === _optionalChain([b, 'access', _223 => _223.style, 'optionalAccess', _224 => _224.fontName]) && Math.abs(ab.x + ab.width / 2 - (bb.x + bb.width / 2)) <= Math.max(5, af * 0.5);
7192
+ const centered = ab && bb && _optionalChain([a, 'access', _231 => _231.style, 'optionalAccess', _232 => _232.fontName]) === _optionalChain([b, 'access', _233 => _233.style, 'optionalAccess', _234 => _234.fontName]) && Math.abs(ab.x + ab.width / 2 - (bb.x + bb.width / 2)) <= Math.max(5, af * 0.5);
7173
7193
  const sameAnchor = ab && bb && Math.abs(ab.x - bb.x) <= 5;
7174
- const wrapped = sameAnchor && _optionalChain([a, 'access', _225 => _225.style, 'optionalAccess', _226 => _226.fontName]) === _optionalChain([b, 'access', _227 => _227.style, 'optionalAccess', _228 => _228.fontName]) && af === bf && ab.width >= bb.width * 0.95 && (_nullishCoalesce(_optionalChain([a, 'access', _229 => _229.text, 'optionalAccess', _230 => _230.trim, 'call', _231 => _231(), 'access', _232 => _232.split, 'call', _233 => _233(/\s+/), 'access', _234 => _234.length]), () => ( 0))) >= 3;
7194
+ const wrapped = sameAnchor && _optionalChain([a, 'access', _235 => _235.style, 'optionalAccess', _236 => _236.fontName]) === _optionalChain([b, 'access', _237 => _237.style, 'optionalAccess', _238 => _238.fontName]) && af === bf && ab.width >= bb.width * 0.95 && (_nullishCoalesce(_optionalChain([a, 'access', _239 => _239.text, 'optionalAccess', _240 => _240.trim, 'call', _241 => _241(), 'access', _242 => _242.split, 'call', _243 => _243(/\s+/), 'access', _244 => _244.length]), () => ( 0))) >= 3;
7175
7195
  const displayStack = centered && gap <= Math.min(af, bf) * 0.3 && Math.max(af, bf) <= Math.min(af, bf) * 1.45;
7176
7196
  if (a.type !== "heading" || b.type !== "heading" || !a.text || !b.text || /^\d+$/.test(a.text.trim()) || !ab || !bb || ab.page !== bb.page || !(sameAnchor && af >= medianFontSize * 2 && bf >= medianFontSize * 2) && !wrapped && !(centered && af >= medianFontSize * 1.25 && bf >= medianFontSize * 1.25) || Math.abs(af - bf) > Math.max(af, bf) * 0.15 && !displayStack || gap < -2 || gap > Math.max(af, bf) * 0.45 || a.text.length > (centered ? 120 : 50) || b.text.length > (centered ? 120 : 50)) {
7177
7197
  i++;
@@ -7200,25 +7220,25 @@ function detectTypographyHeadings(blocks) {
7200
7220
  if (page.some((block) => block.type === "heading")) continue;
7201
7221
  const faceWeight = /* @__PURE__ */ new Map();
7202
7222
  for (const block of page) {
7203
- if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _235 => _235.style, 'optionalAccess', _236 => _236.fontName])) continue;
7223
+ if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _245 => _245.style, 'optionalAccess', _246 => _246.fontName])) continue;
7204
7224
  const faces = FACE_CHARS.get(block);
7205
7225
  if (faces) for (const [face, n] of faces) faceWeight.set(face, (_nullishCoalesce(faceWeight.get(face), () => ( 0))) + n);
7206
7226
  else faceWeight.set(block.style.fontName, (_nullishCoalesce(faceWeight.get(block.style.fontName), () => ( 0))) + block.text.length);
7207
7227
  }
7208
- const bodyFace = _optionalChain([[...faceWeight], 'access', _237 => _237.sort, 'call', _238 => _238((a, b) => b[1] - a[1]), 'access', _239 => _239[0], 'optionalAccess', _240 => _240[0]]);
7228
+ const bodyFace = _optionalChain([[...faceWeight], 'access', _247 => _247.sort, 'call', _248 => _248((a, b) => b[1] - a[1]), 'access', _249 => _249[0], 'optionalAccess', _250 => _250[0]]);
7209
7229
  if (!bodyFace || (_nullishCoalesce(faceWeight.get(bodyFace), () => ( 0))) < 250) continue;
7210
7230
  const sizeWeight = /* @__PURE__ */ new Map();
7211
7231
  for (const block of page) {
7212
- if (block.type !== "paragraph" || !_optionalChain([block, 'access', _241 => _241.style, 'optionalAccess', _242 => _242.fontSize])) continue;
7232
+ if (block.type !== "paragraph" || !_optionalChain([block, 'access', _251 => _251.style, 'optionalAccess', _252 => _252.fontSize])) continue;
7213
7233
  const faces = FACE_CHARS.get(block);
7214
- const chars = faces ? _nullishCoalesce(faces.get(bodyFace), () => ( 0)) : block.style.fontName === bodyFace ? _nullishCoalesce(_optionalChain([block, 'access', _243 => _243.text, 'optionalAccess', _244 => _244.length]), () => ( 0)) : 0;
7234
+ const chars = faces ? _nullishCoalesce(faces.get(bodyFace), () => ( 0)) : block.style.fontName === bodyFace ? _nullishCoalesce(_optionalChain([block, 'access', _253 => _253.text, 'optionalAccess', _254 => _254.length]), () => ( 0)) : 0;
7215
7235
  if (chars) sizeWeight.set(block.style.fontSize, (_nullishCoalesce(sizeWeight.get(block.style.fontSize), () => ( 0))) + chars);
7216
7236
  }
7217
- const bodySize = _nullishCoalesce(_optionalChain([[...sizeWeight], 'access', _245 => _245.sort, 'call', _246 => _246((a, b) => b[1] - a[1]), 'access', _247 => _247[0], 'optionalAccess', _248 => _248[0]]), () => ( 0));
7237
+ const bodySize = _nullishCoalesce(_optionalChain([[...sizeWeight], 'access', _255 => _255.sort, 'call', _256 => _256((a, b) => b[1] - a[1]), 'access', _257 => _257[0], 'optionalAccess', _258 => _258[0]]), () => ( 0));
7218
7238
  for (let i = 0; i < page.length; i++) {
7219
7239
  const block = page[i];
7220
7240
  const { text, bbox, style } = block;
7221
- if (block.type !== "paragraph" || !text || !bbox || !_optionalChain([style, 'optionalAccess', _249 => _249.fontName]) || !style.fontSize) continue;
7241
+ if (block.type !== "paragraph" || !text || !bbox || !_optionalChain([style, 'optionalAccess', _259 => _259.fontName]) || !style.fontSize) continue;
7222
7242
  const title = text.trim();
7223
7243
  const numbered = /^\d+(?:\.\d+)*\.?\s+[A-Z가-힣]/.test(title);
7224
7244
  const faces = FACE_CHARS.get(block);
@@ -7248,16 +7268,16 @@ function detectDocumentStyleHeadings(blocks) {
7248
7268
  for (const page of byPage.values()) {
7249
7269
  const faceChars = /* @__PURE__ */ new Map();
7250
7270
  for (const block of page) {
7251
- if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _250 => _250.style, 'optionalAccess', _251 => _251.fontName])) continue;
7271
+ if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _260 => _260.style, 'optionalAccess', _261 => _261.fontName])) continue;
7252
7272
  faceChars.set(block.style.fontName, (_nullishCoalesce(faceChars.get(block.style.fontName), () => ( 0))) + block.text.length);
7253
7273
  }
7254
- const bodyFace = _optionalChain([[...faceChars], 'access', _252 => _252.sort, 'call', _253 => _253((a, b) => b[1] - a[1]), 'access', _254 => _254[0], 'optionalAccess', _255 => _255[0]]);
7274
+ const bodyFace = _optionalChain([[...faceChars], 'access', _262 => _262.sort, 'call', _263 => _263((a, b) => b[1] - a[1]), 'access', _264 => _264[0], 'optionalAccess', _265 => _265[0]]);
7255
7275
  if (!bodyFace || (_nullishCoalesce(faceChars.get(bodyFace), () => ( 0))) < 100) continue;
7256
- const labels = page.filter((b) => b.type === "paragraph" && b.text && b.bbox && _optionalChain([b, 'access', _256 => _256.style, 'optionalAccess', _257 => _257.fontName]) && b.style.fontName !== bodyFace && b.text.trim().length >= 3 && b.text.trim().length <= 40);
7276
+ const labels = page.filter((b) => b.type === "paragraph" && b.text && b.bbox && _optionalChain([b, 'access', _266 => _266.style, 'optionalAccess', _267 => _267.fontName]) && b.style.fontName !== bodyFace && b.text.trim().length >= 3 && b.text.trim().length <= 40);
7257
7277
  for (const label of labels) {
7258
- const peers = labels.filter((b) => _optionalChain([b, 'access', _258 => _258.style, 'optionalAccess', _259 => _259.fontName]) === _optionalChain([label, 'access', _260 => _260.style, 'optionalAccess', _261 => _261.fontName]) && Math.abs(b.bbox.y - label.bbox.y) <= 3 && Math.abs(b.bbox.x - label.bbox.x) >= 60);
7278
+ const peers = labels.filter((b) => _optionalChain([b, 'access', _268 => _268.style, 'optionalAccess', _269 => _269.fontName]) === _optionalChain([label, 'access', _270 => _270.style, 'optionalAccess', _271 => _271.fontName]) && Math.abs(b.bbox.y - label.bbox.y) <= 3 && Math.abs(b.bbox.x - label.bbox.x) >= 60);
7259
7279
  if (peers.length < 2) continue;
7260
- const value = page.find((b) => b.type === "paragraph" && b.bbox && _optionalChain([b, 'access', _262 => _262.style, 'optionalAccess', _263 => _263.fontName]) !== _optionalChain([label, 'access', _264 => _264.style, 'optionalAccess', _265 => _265.fontName]) && b.bbox.x >= label.bbox.x - 5 && b.bbox.x <= label.bbox.x + 20 && b.bbox.y < label.bbox.y && label.bbox.y - (b.bbox.y + b.bbox.height) <= 60);
7280
+ const value = page.find((b) => b.type === "paragraph" && b.bbox && _optionalChain([b, 'access', _272 => _272.style, 'optionalAccess', _273 => _273.fontName]) !== _optionalChain([label, 'access', _274 => _274.style, 'optionalAccess', _275 => _275.fontName]) && b.bbox.x >= label.bbox.x - 5 && b.bbox.x <= label.bbox.x + 20 && b.bbox.y < label.bbox.y && label.bbox.y - (b.bbox.y + b.bbox.height) <= 60);
7261
7281
  if (value) {
7262
7282
  label.type = "heading";
7263
7283
  label.level = 2;
@@ -7266,7 +7286,7 @@ function detectDocumentStyleHeadings(blocks) {
7266
7286
  const first = page.find((b) => b.type !== "image" && b.type !== "separator");
7267
7287
  const second = page[page.indexOf(first) + 1];
7268
7288
  const third = page[page.indexOf(first) + 2];
7269
- if (!first || !second || !third || first.type !== "list" && first.type !== "paragraph" || second.type !== "paragraph" || !first.text || !second.text || !first.bbox || !second.bbox || !_optionalChain([first, 'access', _266 => _266.style, 'optionalAccess', _267 => _267.fontName]) || !_optionalChain([second, 'access', _268 => _268.style, 'optionalAccess', _269 => _269.fontName]) || !/^\d+(?:\.\d+)*\.\s+/.test(first.text.trim()) || first.style.fontName === bodyFace || second.style.fontName === bodyFace || first.text.length + second.text.length > 140 || Math.abs(first.bbox.x - second.bbox.x) > 30 || first.bbox.y - (second.bbox.y + second.bbox.height) > (_nullishCoalesce(first.style.fontSize, () => ( 0))) * 1.5 || _optionalChain([third, 'access', _270 => _270.style, 'optionalAccess', _271 => _271.fontName]) !== bodyFace) continue;
7289
+ if (!first || !second || !third || first.type !== "list" && first.type !== "paragraph" || second.type !== "paragraph" || !first.text || !second.text || !first.bbox || !second.bbox || !_optionalChain([first, 'access', _276 => _276.style, 'optionalAccess', _277 => _277.fontName]) || !_optionalChain([second, 'access', _278 => _278.style, 'optionalAccess', _279 => _279.fontName]) || !/^\d+(?:\.\d+)*\.\s+/.test(first.text.trim()) || first.style.fontName === bodyFace || second.style.fontName === bodyFace || first.text.length + second.text.length > 140 || Math.abs(first.bbox.x - second.bbox.x) > 30 || first.bbox.y - (second.bbox.y + second.bbox.height) > (_nullishCoalesce(first.style.fontSize, () => ( 0))) * 1.5 || _optionalChain([third, 'access', _280 => _280.style, 'optionalAccess', _281 => _281.fontName]) !== bodyFace) continue;
7270
7290
  first.type = "heading";
7271
7291
  first.level = 1;
7272
7292
  first.text = `${first.text.trim()} ${second.text.trim()}`;
@@ -7290,18 +7310,18 @@ function detectSiblingStyleHeadings(blocks) {
7290
7310
  for (const page of byPage.values()) {
7291
7311
  const bodyChars = /* @__PURE__ */ new Map();
7292
7312
  for (const block of page) {
7293
- if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _272 => _272.style, 'optionalAccess', _273 => _273.fontName])) continue;
7313
+ if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _282 => _282.style, 'optionalAccess', _283 => _283.fontName])) continue;
7294
7314
  const face = block.style.fontName;
7295
7315
  bodyChars.set(face, (_nullishCoalesce(bodyChars.get(face), () => ( 0))) + block.text.length);
7296
7316
  }
7297
- const bodyFace = _optionalChain([[...bodyChars], 'access', _274 => _274.sort, 'call', _275 => _275((a, b) => b[1] - a[1]), 'access', _276 => _276[0], 'optionalAccess', _277 => _277[0]]);
7298
- const anchors = page.filter((b) => b.type === "heading" && b.text && _optionalChain([b, 'access', _278 => _278.style, 'optionalAccess', _279 => _279.fontName]) && b.style.fontName !== bodyFace);
7317
+ const bodyFace = _optionalChain([[...bodyChars], 'access', _284 => _284.sort, 'call', _285 => _285((a, b) => b[1] - a[1]), 'access', _286 => _286[0], 'optionalAccess', _287 => _287[0]]);
7318
+ const anchors = page.filter((b) => b.type === "heading" && b.text && _optionalChain([b, 'access', _288 => _288.style, 'optionalAccess', _289 => _289.fontName]) && b.style.fontName !== bodyFace);
7299
7319
  for (const anchor of anchors) {
7300
7320
  const numbered = /^([A-Z])\.\d+\s+/.exec(anchor.text.trim());
7301
7321
  const lettered = /^([A-Z])\s+/.exec(anchor.text.trim());
7302
- const peers = anchors.filter((b) => _optionalChain([b, 'access', _280 => _280.style, 'optionalAccess', _281 => _281.fontName]) === _optionalChain([anchor, 'access', _282 => _282.style, 'optionalAccess', _283 => _283.fontName]) && Math.abs((_nullishCoalesce(_optionalChain([b, 'access', _284 => _284.style, 'optionalAccess', _285 => _285.fontSize]), () => ( 0))) - (_nullishCoalesce(_optionalChain([anchor, 'access', _286 => _286.style, 'optionalAccess', _287 => _287.fontSize]), () => ( 0)))) < 0.5);
7322
+ const peers = anchors.filter((b) => _optionalChain([b, 'access', _290 => _290.style, 'optionalAccess', _291 => _291.fontName]) === _optionalChain([anchor, 'access', _292 => _292.style, 'optionalAccess', _293 => _293.fontName]) && Math.abs((_nullishCoalesce(_optionalChain([b, 'access', _294 => _294.style, 'optionalAccess', _295 => _295.fontSize]), () => ( 0))) - (_nullishCoalesce(_optionalChain([anchor, 'access', _296 => _296.style, 'optionalAccess', _297 => _297.fontSize]), () => ( 0)))) < 0.5);
7303
7323
  if (peers.length < 2 && !numbered && !lettered) continue;
7304
- const candidates = page.filter((b) => b.type === "paragraph" && b.text && b.bbox && _optionalChain([b, 'access', _288 => _288.style, 'optionalAccess', _289 => _289.fontName]) === _optionalChain([anchor, 'access', _290 => _290.style, 'optionalAccess', _291 => _291.fontName]) && Math.abs((_nullishCoalesce(_optionalChain([b, 'access', _292 => _292.style, 'optionalAccess', _293 => _293.fontSize]), () => ( 0))) - (_nullishCoalesce(_optionalChain([anchor, 'access', _294 => _294.style, 'optionalAccess', _295 => _295.fontSize]), () => ( 0)))) < 0.5 && b.text.trim().length >= 3 && b.text.trim().length <= 80 && b.bbox.height <= (_nullishCoalesce(_optionalChain([b, 'access', _296 => _296.style, 'optionalAccess', _297 => _297.fontSize]), () => ( 0))) * 1.6 && /^[A-Z]/.test(b.text.trim()) && !/[.!?:;,]$/.test(b.text.trim()) && !/^(?:Table|Figure|Fig\.?|Appendix)\s+\d/i.test(b.text.trim()));
7324
+ const candidates = page.filter((b) => b.type === "paragraph" && b.text && b.bbox && _optionalChain([b, 'access', _298 => _298.style, 'optionalAccess', _299 => _299.fontName]) === _optionalChain([anchor, 'access', _300 => _300.style, 'optionalAccess', _301 => _301.fontName]) && Math.abs((_nullishCoalesce(_optionalChain([b, 'access', _302 => _302.style, 'optionalAccess', _303 => _303.fontSize]), () => ( 0))) - (_nullishCoalesce(_optionalChain([anchor, 'access', _304 => _304.style, 'optionalAccess', _305 => _305.fontSize]), () => ( 0)))) < 0.5 && b.text.trim().length >= 3 && b.text.trim().length <= 80 && b.bbox.height <= (_nullishCoalesce(_optionalChain([b, 'access', _306 => _306.style, 'optionalAccess', _307 => _307.fontSize]), () => ( 0))) * 1.6 && /^[A-Z]/.test(b.text.trim()) && !/[.!?:;,]$/.test(b.text.trim()) && !/^(?:Table|Figure|Fig\.?|Appendix)\s+\d/i.test(b.text.trim()));
7305
7325
  const siblings = candidates.filter((b) => numbered ? new RegExp(`^${numbered[1]}\\.\\d+\\s+`).test(b.text.trim()) : lettered ? /^[A-Z]\s+/.test(b.text.trim()) && Math.abs(anchor.bbox.x - b.bbox.x) < 8 : peers.some((h) => h.bbox && Math.abs(h.bbox.x - b.bbox.x) < 8));
7306
7326
  if (siblings.length < (numbered || lettered ? 1 : 2)) continue;
7307
7327
  for (const sibling of siblings) {
@@ -7320,13 +7340,13 @@ function detectRepeatedPageLabels(blocks) {
7320
7340
  }
7321
7341
  for (const page of byPage.values()) {
7322
7342
  const bodyChars = /* @__PURE__ */ new Map();
7323
- for (const b of page) if (b.type === "paragraph" && b.text && _optionalChain([b, 'access', _298 => _298.style, 'optionalAccess', _299 => _299.fontName])) {
7343
+ for (const b of page) if (b.type === "paragraph" && b.text && _optionalChain([b, 'access', _308 => _308.style, 'optionalAccess', _309 => _309.fontName])) {
7324
7344
  const faces = FACE_CHARS.get(b);
7325
7345
  if (faces) for (const [face, n] of faces) bodyChars.set(face, (_nullishCoalesce(bodyChars.get(face), () => ( 0))) + n);
7326
7346
  else bodyChars.set(b.style.fontName, (_nullishCoalesce(bodyChars.get(b.style.fontName), () => ( 0))) + b.text.length);
7327
7347
  }
7328
- const bodyFace = _optionalChain([[...bodyChars], 'access', _300 => _300.sort, 'call', _301 => _301((a, b) => b[1] - a[1]), 'access', _302 => _302[0], 'optionalAccess', _303 => _303[0]]);
7329
- const candidates = page.filter((b) => b.type === "paragraph" && b.text && b.bbox && _optionalChain([b, 'access', _304 => _304.style, 'optionalAccess', _305 => _305.fontName]) && b.style.fontName !== bodyFace && b.bbox.height <= (_nullishCoalesce(b.style.fontSize, () => ( 0))) * 1.6 && b.text.trim().length >= 5 && b.text.trim().length <= 80);
7348
+ const bodyFace = _optionalChain([[...bodyChars], 'access', _310 => _310.sort, 'call', _311 => _311((a, b) => b[1] - a[1]), 'access', _312 => _312[0], 'optionalAccess', _313 => _313[0]]);
7349
+ const candidates = page.filter((b) => b.type === "paragraph" && b.text && b.bbox && _optionalChain([b, 'access', _314 => _314.style, 'optionalAccess', _315 => _315.fontName]) && b.style.fontName !== bodyFace && b.bbox.height <= (_nullishCoalesce(b.style.fontSize, () => ( 0))) * 1.6 && b.text.trim().length >= 5 && b.text.trim().length <= 80);
7330
7350
  const groups = /* @__PURE__ */ new Map();
7331
7351
  for (const b of candidates) {
7332
7352
  const key = `${b.style.fontName}:${b.style.fontSize}`;
@@ -7362,19 +7382,19 @@ function detectPageLeadHeadings(blocks) {
7362
7382
  for (const page of byPage.values()) {
7363
7383
  const content = page.filter((b) => b.type !== "image" && b.type !== "separator" && !(b.type === "paragraph" && !b.style));
7364
7384
  const [first, second, third] = content;
7365
- if (!_optionalChain([first, 'optionalAccess', _306 => _306.bbox]) || !first.text || !_optionalChain([first, 'access', _307 => _307.style, 'optionalAccess', _308 => _308.fontSize]) || !second) continue;
7385
+ if (!_optionalChain([first, 'optionalAccess', _316 => _316.bbox]) || !first.text || !_optionalChain([first, 'access', _317 => _317.style, 'optionalAccess', _318 => _318.fontSize]) || !second) continue;
7366
7386
  const firstText = first.text.trim();
7367
7387
  const captionLike = /^(?:Figure|Fig\.?|Table|표|그림)\s*\d/i;
7368
7388
  const hasImage = page.some((b) => b.type === "image");
7369
- const firstIsTitle = first.type === "paragraph" && firstText.length >= 5 && firstText.length <= 80 && first.bbox.height <= first.style.fontSize * 1.6 && (/^(?:CONTENTS|Table of Contents)$/i.test(firstText) || hasImage && /^[A-Z]/.test(firstText) && !captionLike.test(firstText) && second.type === "paragraph" && /^[A-Z]/.test(_nullishCoalesce(_optionalChain([second, 'access', _309 => _309.text, 'optionalAccess', _310 => _310.trim, 'call', _311 => _311()]), () => ( ""))) && (_nullishCoalesce(_optionalChain([second, 'access', _312 => _312.text, 'optionalAccess', _313 => _313.length]), () => ( 0))) >= 100 && second.bbox && first.bbox.y - (second.bbox.y + second.bbox.height) >= first.style.fontSize);
7389
+ const firstIsTitle = first.type === "paragraph" && firstText.length >= 5 && firstText.length <= 80 && first.bbox.height <= first.style.fontSize * 1.6 && (/^(?:CONTENTS|Table of Contents)$/i.test(firstText) || hasImage && /^[A-Z]/.test(firstText) && !captionLike.test(firstText) && second.type === "paragraph" && /^[A-Z]/.test(_nullishCoalesce(_optionalChain([second, 'access', _319 => _319.text, 'optionalAccess', _320 => _320.trim, 'call', _321 => _321()]), () => ( ""))) && (_nullishCoalesce(_optionalChain([second, 'access', _322 => _322.text, 'optionalAccess', _323 => _323.length]), () => ( 0))) >= 100 && second.bbox && first.bbox.y - (second.bbox.y + second.bbox.height) >= first.style.fontSize);
7370
7390
  const firstAboveProse = first.type === "paragraph" && firstText.length >= 5 && firstText.length <= 80 && first.bbox.height <= first.style.fontSize * 2 && second.type === "paragraph" && second.bbox && second.bbox.height >= first.style.fontSize * 4 && Math.abs(first.bbox.x - second.bbox.x) <= first.style.fontSize * 2 && first.bbox.y - (second.bbox.y + second.bbox.height) >= first.style.fontSize * 2 && !captionLike.test(firstText) && !/^(?:doi:|https?:|www\.)/i.test(firstText);
7371
- const firstIsSection = first.type === "list" && /^\d+\.\s+[A-Z][A-Z\s]{12,}$/.test(firstText) && second.type === "paragraph" && (_nullishCoalesce(_optionalChain([second, 'access', _314 => _314.text, 'optionalAccess', _315 => _315.length]), () => ( 0))) >= 100;
7391
+ const firstIsSection = first.type === "list" && /^\d+\.\s+[A-Z][A-Z\s]{12,}$/.test(firstText) && second.type === "paragraph" && (_nullishCoalesce(_optionalChain([second, 'access', _324 => _324.text, 'optionalAccess', _325 => _325.length]), () => ( 0))) >= 100;
7372
7392
  if (firstIsTitle || firstAboveProse || firstIsSection) {
7373
7393
  first.type = "heading";
7374
7394
  first.level = 1;
7375
7395
  }
7376
- if (first.type !== "heading" || captionLike.test(firstText) || second.type !== "paragraph" || !second.text || !second.bbox || !_optionalChain([second, 'access', _316 => _316.style, 'optionalAccess', _317 => _317.fontName]) || !second.style.fontSize || !_optionalChain([third, 'optionalAccess', _318 => _318.text]) || !third.bbox || second.text.trim().length < 5 || second.text.trim().length > 80 || captionLike.test(second.text.trim()) || /^(?:doi:|https?:)/i.test(second.text.trim()) || second.bbox.height > second.style.fontSize * 1.6 || Math.abs(second.bbox.x - third.bbox.x) > 30) continue;
7377
- const distinctFace = _optionalChain([third, 'access', _319 => _319.style, 'optionalAccess', _320 => _320.fontName]) !== second.style.fontName;
7396
+ if (first.type !== "heading" || captionLike.test(firstText) || second.type !== "paragraph" || !second.text || !second.bbox || !_optionalChain([second, 'access', _326 => _326.style, 'optionalAccess', _327 => _327.fontName]) || !second.style.fontSize || !_optionalChain([third, 'optionalAccess', _328 => _328.text]) || !third.bbox || second.text.trim().length < 5 || second.text.trim().length > 80 || captionLike.test(second.text.trim()) || /^(?:doi:|https?:)/i.test(second.text.trim()) || second.bbox.height > second.style.fontSize * 1.6 || Math.abs(second.bbox.x - third.bbox.x) > 30) continue;
7397
+ const distinctFace = _optionalChain([third, 'access', _329 => _329.style, 'optionalAccess', _330 => _330.fontName]) !== second.style.fontName;
7378
7398
  const namedContents = /^Table of Contents$/i.test(second.text.trim());
7379
7399
  if (distinctFace && third.text.length >= 60 || namedContents) {
7380
7400
  second.type = "heading";
@@ -7385,24 +7405,24 @@ function detectPageLeadHeadings(blocks) {
7385
7405
  function refineDocumentStyleHeadings(blocks) {
7386
7406
  const faceChars = /* @__PURE__ */ new Map();
7387
7407
  for (const block of blocks) {
7388
- if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _321 => _321.style, 'optionalAccess', _322 => _322.fontName])) continue;
7408
+ if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _331 => _331.style, 'optionalAccess', _332 => _332.fontName])) continue;
7389
7409
  faceChars.set(block.style.fontName, (_nullishCoalesce(faceChars.get(block.style.fontName), () => ( 0))) + block.text.length);
7390
7410
  }
7391
7411
  const [bodyFace, bodyChars] = _nullishCoalesce([...faceChars].sort((a, b) => b[1] - a[1])[0], () => ( []));
7392
7412
  if (!bodyFace || !bodyChars || bodyChars < 300) return;
7393
7413
  for (let i = 0; i < blocks.length; i++) {
7394
7414
  const block = blocks[i];
7395
- const text = _nullishCoalesce(_optionalChain([block, 'access', _323 => _323.text, 'optionalAccess', _324 => _324.trim, 'call', _325 => _325()]), () => ( ""));
7415
+ const text = _nullishCoalesce(_optionalChain([block, 'access', _333 => _333.text, 'optionalAccess', _334 => _334.trim, 'call', _335 => _335()]), () => ( ""));
7396
7416
  if (block.type === "heading" && /(?:https?:\/\/|www\.|^arxiv:|^doi:)/i.test(text)) {
7397
7417
  block.type = "paragraph";
7398
7418
  block.level = void 0;
7399
7419
  continue;
7400
7420
  }
7401
7421
  const box = block.bbox, style = block.style;
7402
- if (block.type !== "paragraph" || !box || !_optionalChain([style, 'optionalAccess', _326 => _326.fontName]) || !style.fontSize || style.fontName === bodyFace || (_nullishCoalesce(faceChars.get(style.fontName), () => ( 0))) > bodyChars * 0.25 || text.length < 3 || text.length > 70 || text.includes("\n") || box.height > style.fontSize * 1.6 || /^(?:table|figure|fig\.?|source|doi:|arxiv:|https?:|www\.|[•●○▪▫⮚*∗†])/i.test(text) || /(?:https?:\/\/|www\.|@|[=¼≪þ])/i.test(text) || /^definition\s+\d+[.:]?\s+.*\b(?:is|are|means)\b/i.test(text) || /^[\d\s.,:%+\-–]+$/.test(text)) continue;
7422
+ if (block.type !== "paragraph" || !box || !_optionalChain([style, 'optionalAccess', _336 => _336.fontName]) || !style.fontSize || style.fontName === bodyFace || (_nullishCoalesce(faceChars.get(style.fontName), () => ( 0))) > bodyChars * 0.25 || text.length < 3 || text.length > 70 || text.includes("\n") || box.height > style.fontSize * 1.6 || /^(?:table|figure|fig\.?|source|doi:|arxiv:|https?:|www\.|[•●○▪▫⮚*∗†])/i.test(text) || /(?:https?:\/\/|www\.|@|[=¼≪þ])/i.test(text) || /^definition\s+\d+[.:]?\s+.*\b(?:is|are|means)\b/i.test(text) || /^[\d\s.,:%+\-–]+$/.test(text)) continue;
7403
7423
  const previous = blocks[i - 1], next = blocks[i + 1];
7404
- const pb = _optionalChain([previous, 'optionalAccess', _327 => _327.bbox]), nb = _optionalChain([next, 'optionalAccess', _328 => _328.bbox]);
7405
- if (!pb || !nb || previous.pageNumber !== block.pageNumber || next.pageNumber !== block.pageNumber || previous.type !== "paragraph" && previous.type !== "heading" || next.type !== "paragraph" || _optionalChain([next, 'access', _329 => _329.style, 'optionalAccess', _330 => _330.fontName]) !== bodyFace || !next.text || next.text.length < 40 || style.fontSize < (_nullishCoalesce(next.style.fontSize, () => ( 0))) * 0.95 || pb.y - (box.y + box.height) < style.fontSize * 0.5 || box.y - (nb.y + nb.height) < 0 || box.y - (nb.y + nb.height) > style.fontSize * 2 || box.x + box.width / 2 < nb.x - 10 || box.x + box.width / 2 > nb.x + nb.width + 10) continue;
7424
+ const pb = _optionalChain([previous, 'optionalAccess', _337 => _337.bbox]), nb = _optionalChain([next, 'optionalAccess', _338 => _338.bbox]);
7425
+ if (!pb || !nb || previous.pageNumber !== block.pageNumber || next.pageNumber !== block.pageNumber || previous.type !== "paragraph" && previous.type !== "heading" || next.type !== "paragraph" || _optionalChain([next, 'access', _339 => _339.style, 'optionalAccess', _340 => _340.fontName]) !== bodyFace || !next.text || next.text.length < 40 || style.fontSize < (_nullishCoalesce(next.style.fontSize, () => ( 0))) * 0.95 || pb.y - (box.y + box.height) < style.fontSize * 0.5 || box.y - (nb.y + nb.height) < 0 || box.y - (nb.y + nb.height) > style.fontSize * 2 || box.x + box.width / 2 < nb.x - 10 || box.x + box.width / 2 > nb.x + nb.width + 10) continue;
7406
7426
  block.type = "heading";
7407
7427
  block.level = 2;
7408
7428
  }
@@ -7452,7 +7472,7 @@ function detectMarkerHeadings(blocks) {
7452
7472
  block.level = 4;
7453
7473
  continue;
7454
7474
  }
7455
- if (/^[가-힣]{2,6}$/.test(text) && _optionalChain([block, 'access', _331 => _331.style, 'optionalAccess', _332 => _332.fontSize])) {
7475
+ if (/^[가-힣]{2,6}$/.test(text) && _optionalChain([block, 'access', _341 => _341.style, 'optionalAccess', _342 => _342.fontSize])) {
7456
7476
  const prev = blocks[i - 1];
7457
7477
  const next = blocks[i + 1];
7458
7478
  const prevIsStructural = !prev || prev.type === "table" || prev.type === "heading" || prev.type === "separator";
@@ -7493,7 +7513,7 @@ function detectTableCaptions(blocks) {
7493
7513
  block.table.caption = blocks[i - 1].text.trim();
7494
7514
  blocks.splice(i - 1, 1);
7495
7515
  i--;
7496
- } else if (isCaptionCandidate(blocks[i + 1], block) && _optionalChain([blocks, 'access', _333 => _333[i + 2], 'optionalAccess', _334 => _334.type]) !== "table") {
7516
+ } else if (isCaptionCandidate(blocks[i + 1], block) && _optionalChain([blocks, 'access', _343 => _343[i + 2], 'optionalAccess', _344 => _344.type]) !== "table") {
7497
7517
  const cap = blocks[i + 1].bbox, tbl = block.bbox;
7498
7518
  block.table.caption = blocks[i + 1].text.trim();
7499
7519
  if (cap && tbl && cap.y + cap.height <= tbl.y + 1) block.table.captionBelow = true;
@@ -7578,7 +7598,7 @@ function detectKoreanListBlocks(blocks) {
7578
7598
  }
7579
7599
  const listType = label.family === "arabicDot" ? "ordered" : "unordered";
7580
7600
  const listBlock = { ...b, type: "list", listType };
7581
- const pb = _optionalChain([lastTopLevelList, 'optionalAccess', _335 => _335.bbox]), cb = b.bbox;
7601
+ const pb = _optionalChain([lastTopLevelList, 'optionalAccess', _345 => _345.bbox]), cb = b.bbox;
7582
7602
  const notIndented = depth > 0 && !!pb && !!cb && pb.page === cb.page && cb.x >= pb.x + pb.width && cb.y >= pb.y + pb.height;
7583
7603
  if (notIndented) familyStack = [label.family];
7584
7604
  if (depth === 0 || notIndented) {
@@ -7736,7 +7756,7 @@ function removeHeaderFooterBlocks(blocks, pageHeights, warnings, notes, tables =
7736
7756
  const b = blocks[bi];
7737
7757
  const cellTexts = b.type === "table" && b.table ? b.table.cells.flat().map((c) => c.text.trim()).filter(Boolean) : [];
7738
7758
  const headBox = cellTexts.length <= 4 && !!b.bbox && b.bbox.height <= (_nullishCoalesce(pageHeights.get(b.bbox.page), () => ( Infinity))) * 0.05;
7739
- const text = !tables ? _optionalChain([b, 'access', _336 => _336.text, 'optionalAccess', _337 => _337.trim, 'call', _338 => _338()]) : cellTexts.length ? (headBox ? [...cellTexts].sort() : cellTexts).join(" | ") : void 0;
7759
+ const text = !tables ? _optionalChain([b, 'access', _346 => _346.text, 'optionalAccess', _347 => _347.trim, 'call', _348 => _348()]) : cellTexts.length ? (headBox ? [...cellTexts].sort() : cellTexts).join(" | ") : void 0;
7740
7760
  if (!b.bbox || !b.pageNumber || !text) continue;
7741
7761
  const ph = pageHeights.get(b.bbox.page) || pageHeights.get(b.pageNumber);
7742
7762
  if (!ph) continue;
@@ -7769,7 +7789,7 @@ function removeHeaderFooterBlocks(blocks, pageHeights, warnings, notes, tables =
7769
7789
  for (const [p, count] of patternCount) {
7770
7790
  const pages = [..._nullishCoalesce(patternPages.get(p), () => ( []))];
7771
7791
  const span2 = pages.length ? Math.max(...pages) - Math.min(...pages) + 1 : 0;
7772
- const varying = !tables && (_nullishCoalesce(_optionalChain([patternNumbers, 'access', _339 => _339.get, 'call', _340 => _340(p), 'optionalAccess', _341 => _341.size]), () => ( 0))) > 1;
7792
+ const varying = !tables && (_nullishCoalesce(_optionalChain([patternNumbers, 'access', _349 => _349.get, 'call', _350 => _350(p), 'optionalAccess', _351 => _351.size]), () => ( 0))) > 1;
7773
7793
  const occ = _nullishCoalesce(patternOcc.get(p), () => ( []));
7774
7794
  const dense = pages.length >= span2 * 0.4;
7775
7795
  const loose = looseVaryingNumber(occ, entries === topEntries) && (entries === bottomEntries || dense || tracksPages(occ));
@@ -7781,8 +7801,8 @@ function removeHeaderFooterBlocks(blocks, pageHeights, warnings, notes, tables =
7781
7801
  for (const e of entries) {
7782
7802
  const norm = e.text.replace(/\d+/g, "#");
7783
7803
  if (!repeatedPatterns.has(norm)) continue;
7784
- const noteMark = _optionalChain([e, 'access', _342 => _342.text, 'access', _343 => _343.match, 'call', _344 => _344(/^\d{1,3}\)/), 'optionalAccess', _345 => _345[0]]);
7785
- if (noteMark && _optionalChain([notes, 'optionalAccess', _346 => _346.get, 'call', _347 => _347(e.page), 'optionalAccess', _348 => _348.marks, 'access', _349 => _349.some, 'call', _350 => _350((m) => m.mark === noteMark)])) continue;
7804
+ const noteMark = _optionalChain([e, 'access', _352 => _352.text, 'access', _353 => _353.match, 'call', _354 => _354(/^\d{1,3}\)/), 'optionalAccess', _355 => _355[0]]);
7805
+ if (noteMark && _optionalChain([notes, 'optionalAccess', _356 => _356.get, 'call', _357 => _357(e.page), 'optionalAccess', _358 => _358.marks, 'access', _359 => _359.some, 'call', _360 => _360((m) => m.mark === noteMark)])) continue;
7786
7806
  const cand = blocks[e.blockIdx];
7787
7807
  const cb = cand.bbox;
7788
7808
  const tableNote = /^(?:주\s*(?:\d+\s*[).:]|[::])|(?:자료|출처)\s*[::]|\*\s+\S)/.test(e.text.replace(/ \| /g, " ")) && blocks.some((o) => {
@@ -7796,7 +7816,7 @@ function removeHeaderFooterBlocks(blocks, pageHeights, warnings, notes, tables =
7796
7816
  if (bi === e.blockIdx) continue;
7797
7817
  const o = blocks[bi];
7798
7818
  if (!o.bbox || o.bbox.page !== cb.page) continue;
7799
- const oNorm = _optionalChain([o, 'access', _351 => _351.text, 'optionalAccess', _352 => _352.trim, 'call', _353 => _353(), 'access', _354 => _354.replace, 'call', _355 => _355(/\d+/g, "#")]);
7819
+ const oNorm = _optionalChain([o, 'access', _361 => _361.text, 'optionalAccess', _362 => _362.trim, 'call', _363 => _363(), 'access', _364 => _364.replace, 'call', _365 => _365(/\d+/g, "#")]);
7800
7820
  if (oNorm && repeatedPatterns.has(oNorm)) continue;
7801
7821
  const overlap2 = Math.min(cb.y + cb.height, o.bbox.y + o.bbox.height) - Math.max(cb.y, o.bbox.y);
7802
7822
  if (overlap2 >= cb.height * 0.5) {
@@ -7924,7 +7944,7 @@ function recordRowRules(table, cells, bbox, hs) {
7924
7944
  function markImageCell(cell) {
7925
7945
  IMAGE_CELLS.add(cell);
7926
7946
  }
7927
- var emptyCell = (cell) => !cell || !_optionalChain([cell, 'access', _356 => _356.text, 'optionalAccess', _357 => _357.trim, 'call', _358 => _358()]) && !_optionalChain([cell, 'access', _359 => _359.blocks, 'optionalAccess', _360 => _360.length]) && !IMAGE_CELLS.has(cell);
7947
+ var emptyCell = (cell) => !cell || !_optionalChain([cell, 'access', _366 => _366.text, 'optionalAccess', _367 => _367.trim, 'call', _368 => _368()]) && !_optionalChain([cell, 'access', _369 => _369.blocks, 'optionalAccess', _370 => _370.length]) && !IMAGE_CELLS.has(cell);
7928
7948
  function trimTable(table) {
7929
7949
  let cols = table.cols;
7930
7950
  while (cols > 0 && table.cells.every((row) => emptyCell(row[cols - 1]))) cols--;
@@ -7940,7 +7960,7 @@ function trimTable(table) {
7940
7960
  function trimTrailingEmptyTableCols(blocks) {
7941
7961
  for (const b of blocks) {
7942
7962
  if (b.type !== "table" || !b.table) continue;
7943
- for (const row of b.table.cells) for (const cell of row) if (_optionalChain([cell, 'access', _361 => _361.blocks, 'optionalAccess', _362 => _362.length])) trimTrailingEmptyTableCols(cell.blocks);
7963
+ for (const row of b.table.cells) for (const cell of row) if (_optionalChain([cell, 'access', _371 => _371.blocks, 'optionalAccess', _372 => _372.length])) trimTrailingEmptyTableCols(cell.blocks);
7944
7964
  trimTable(b.table);
7945
7965
  }
7946
7966
  }
@@ -7960,7 +7980,7 @@ function mergeSliverColumns(grid, colXs, maxWidth) {
7960
7980
  }
7961
7981
  const ok = owner.every((row) => {
7962
7982
  const o = row[c];
7963
- return !!o && (o.colSpan > 1 || !o.text.trim() && !_optionalChain([o, 'access', _363 => _363.blocks, 'optionalAccess', _364 => _364.length]));
7983
+ return !!o && (o.colSpan > 1 || !o.text.trim() && !_optionalChain([o, 'access', _373 => _373.blocks, 'optionalAccess', _374 => _374.length]));
7964
7984
  });
7965
7985
  if (!ok) continue;
7966
7986
  const spanning = /* @__PURE__ */ new Set();
@@ -7987,7 +8007,7 @@ var multiply = (m, t) => [
7987
8007
  m[1] * t[4] + m[3] * t[5] + m[5]
7988
8008
  ];
7989
8009
  function hollowCircle(image) {
7990
- if (!_optionalChain([image, 'optionalAccess', _365 => _365.data]) || image.width < 16 || image.width > 128 || image.height < 16 || image.height > 128 || Math.abs(image.width - image.height) > Math.min(image.width, image.height) * 0.1) return false;
8010
+ if (!_optionalChain([image, 'optionalAccess', _375 => _375.data]) || image.width < 16 || image.width > 128 || image.height < 16 || image.height > 128 || Math.abs(image.width - image.height) > Math.min(image.width, image.height) * 0.1) return false;
7991
8011
  const stride = image.kind === _pdfmjs.ImageKind.RGB_24BPP ? 3 : image.kind === _pdfmjs.ImageKind.RGBA_32BPP ? 4 : 0;
7992
8012
  const { width, height, data } = image;
7993
8013
  if (!stride || data.length < width * height * stride) return false;
@@ -8052,9 +8072,9 @@ function smallVisibleImagePaints(fnArray, argsArray) {
8052
8072
  const op = fnArray[i], args = argsArray[i];
8053
8073
  if (op === _pdfmjs.OPS.save || op === _pdfmjs.OPS.paintFormXObjectBegin) {
8054
8074
  stack.push({ ctm, alpha, clip, unknownClip });
8055
- const matrix = op === _pdfmjs.OPS.paintFormXObjectBegin ? _optionalChain([args, 'optionalAccess', _366 => _366[0]]) : void 0;
8075
+ const matrix = op === _pdfmjs.OPS.paintFormXObjectBegin ? _optionalChain([args, 'optionalAccess', _376 => _376[0]]) : void 0;
8056
8076
  if (Array.isArray(matrix) && matrix.length >= 6) ctm = multiply(ctm, matrix);
8057
- const bounds = op === _pdfmjs.OPS.paintFormXObjectBegin ? _optionalChain([args, 'optionalAccess', _367 => _367[1]]) : void 0;
8077
+ const bounds = op === _pdfmjs.OPS.paintFormXObjectBegin ? _optionalChain([args, 'optionalAccess', _377 => _377[1]]) : void 0;
8058
8078
  if (Array.isArray(bounds) && bounds.length === 4) {
8059
8079
  const box = rectangle(bounds[0], bounds[1], bounds[2] - bounds[0], bounds[3] - bounds[1]);
8060
8080
  if (box && ctm[1] === 0 && ctm[2] === 0) intersectClip(box);
@@ -8062,17 +8082,17 @@ function smallVisibleImagePaints(fnArray, argsArray) {
8062
8082
  }
8063
8083
  } else if (op === _pdfmjs.OPS.restore || op === _pdfmjs.OPS.paintFormXObjectEnd) {
8064
8084
  const state = stack.pop();
8065
- ctm = _nullishCoalesce(_optionalChain([state, 'optionalAccess', _368 => _368.ctm]), () => ( [1, 0, 0, 1, 0, 0]));
8066
- alpha = _nullishCoalesce(_optionalChain([state, 'optionalAccess', _369 => _369.alpha]), () => ( 1));
8067
- clip = _nullishCoalesce(_optionalChain([state, 'optionalAccess', _370 => _370.clip]), () => ( null));
8068
- unknownClip = _nullishCoalesce(_optionalChain([state, 'optionalAccess', _371 => _371.unknownClip]), () => ( false));
8085
+ ctm = _nullishCoalesce(_optionalChain([state, 'optionalAccess', _378 => _378.ctm]), () => ( [1, 0, 0, 1, 0, 0]));
8086
+ alpha = _nullishCoalesce(_optionalChain([state, 'optionalAccess', _379 => _379.alpha]), () => ( 1));
8087
+ clip = _nullishCoalesce(_optionalChain([state, 'optionalAccess', _380 => _380.clip]), () => ( null));
8088
+ unknownClip = _nullishCoalesce(_optionalChain([state, 'optionalAccess', _381 => _381.unknownClip]), () => ( false));
8069
8089
  } else if (op === _pdfmjs.OPS.setGState) {
8070
- for (const [key, value] of _nullishCoalesce(_optionalChain([args, 'optionalAccess', _372 => _372[0]]), () => ( []))) {
8090
+ for (const [key, value] of _nullishCoalesce(_optionalChain([args, 'optionalAccess', _382 => _382[0]]), () => ( []))) {
8071
8091
  if (key === "ca") alpha = typeof value === "number" ? value : 0;
8072
8092
  }
8073
8093
  } else if (op === _pdfmjs.OPS.constructPath) {
8074
8094
  const [operations, coordinates] = args;
8075
- pathRect = pathRect === void 0 && _optionalChain([operations, 'optionalAccess', _373 => _373.length]) === 1 && operations[0] === _pdfmjs.OPS.rectangle && _optionalChain([coordinates, 'optionalAccess', _374 => _374.length]) >= 4 && ctm[1] === 0 && ctm[2] === 0 ? rectangle(coordinates[0], coordinates[1], coordinates[2], coordinates[3]) : null;
8095
+ pathRect = pathRect === void 0 && _optionalChain([operations, 'optionalAccess', _383 => _383.length]) === 1 && operations[0] === _pdfmjs.OPS.rectangle && _optionalChain([coordinates, 'optionalAccess', _384 => _384.length]) >= 4 && ctm[1] === 0 && ctm[2] === 0 ? rectangle(coordinates[0], coordinates[1], coordinates[2], coordinates[3]) : null;
8076
8096
  } else if (op === _pdfmjs.OPS.clip || op === _pdfmjs.OPS.eoClip) pendingClip = true;
8077
8097
  else if ([
8078
8098
  _pdfmjs.OPS.endPath,
@@ -8092,7 +8112,7 @@ function smallVisibleImagePaints(fnArray, argsArray) {
8092
8112
  pendingClip = false;
8093
8113
  pathRect = void 0;
8094
8114
  } else if (op === _pdfmjs.OPS.transform && Array.isArray(args) && args.length >= 6) ctm = multiply(ctm, args);
8095
- else if (op === _pdfmjs.OPS.paintImageXObject && typeof _optionalChain([args, 'optionalAccess', _375 => _375[0]]) === "string") {
8115
+ else if (op === _pdfmjs.OPS.paintImageXObject && typeof _optionalChain([args, 'optionalAccess', _385 => _385[0]]) === "string") {
8096
8116
  if (typeof args[1] !== "number" || typeof args[2] !== "number" || args[1] < 16 || args[1] > 128 || args[2] < 16 || args[2] > 128) continue;
8097
8117
  const box = extractImageRegions([_pdfmjs.OPS.transform, _pdfmjs.OPS.paintImageXObject], [ctm, args])[0];
8098
8118
  if (!box || ctm[1] !== 0 || ctm[2] !== 0 || alpha < 0.99 || unknownClip || clip && (box.x1 + (box.x2 - box.x1) * 0.03 < clip.x1 || box.y1 + (box.y2 - box.y1) * 0.03 < clip.y1 || box.x2 - (box.x2 - box.x1) * 0.03 > clip.x2 || box.y2 - (box.y2 - box.y1) * 0.03 > clip.y2)) continue;
@@ -8111,14 +8131,14 @@ async function restoreImageBullets(items, page, fnArray, argsArray, shapes = /*
8111
8131
  const line = items.filter((item) => !item.isHidden && item.fontSize > 0 && item.x >= box.x2 && item.x - box.x2 <= item.fontSize * 0.7 && Math.abs(item.y + item.h / 2 - (box.y1 + box.y2) / 2) <= item.fontSize * 0.4 && height >= item.fontSize * 0.5 && height <= item.fontSize * 1.2).sort((a, b) => a.x - b.x)[0];
8112
8132
  if (!line || /^[○●•◦□■∙]/.test(line.text.trim()) || !/\p{L}/u.test(line.text)) continue;
8113
8133
  const row = items.filter((item) => Math.abs(item.y - line.y) <= 2 && item.x >= line.x);
8114
- if (row.reduce((n, item) => n + (_nullishCoalesce(_optionalChain([item, 'access', _376 => _376.text, 'access', _377 => _377.match, 'call', _378 => _378(/\p{L}/gu), 'optionalAccess', _379 => _379.length]), () => ( 0))), 0) < 12 || items.some((item) => item !== line && Math.abs(item.y - line.y) <= 2 && item.x < line.x)) continue;
8134
+ if (row.reduce((n, item) => n + (_nullishCoalesce(_optionalChain([item, 'access', _386 => _386.text, 'access', _387 => _387.match, 'call', _388 => _388(/\p{L}/gu), 'optionalAccess', _389 => _389.length]), () => ( 0))), 0) < 12 || items.some((item) => item !== line && Math.abs(item.y - line.y) <= 2 && item.x < line.x)) continue;
8115
8135
  candidates.push({ id, x: box.x1, width, line });
8116
8136
  }
8117
8137
  let restored = 0;
8118
8138
  const used = /* @__PURE__ */ new Set();
8119
8139
  for (const candidate of candidates) {
8120
8140
  const same = candidates.filter((other) => other.id === candidate.id && other.line !== candidate.line && Math.abs(other.line.x - candidate.line.x) <= 1 && Math.abs(other.x - candidate.x) <= 1 && Math.abs(other.width - candidate.width) <= 1 && other.line.fontSize === candidate.line.fontSize && Math.abs(other.line.y - candidate.line.y) >= candidate.line.fontSize * 2);
8121
- const numbered = items.filter((item) => !item.isHidden && /^[①-⑮]\s*/.test(item.text.trim()) && item.fontName === candidate.line.fontName && item.fontSize === candidate.line.fontSize && Math.abs(item.x - candidate.x) <= 1 && (_nullishCoalesce(_optionalChain([item, 'access', _380 => _380.text, 'access', _381 => _381.match, 'call', _382 => _382(/\p{L}/gu), 'optionalAccess', _383 => _383.length]), () => ( 0))) >= 12).sort((a, b) => b.y - a.y);
8141
+ const numbered = items.filter((item) => !item.isHidden && /^[①-⑮]\s*/.test(item.text.trim()) && item.fontName === candidate.line.fontName && item.fontSize === candidate.line.fontSize && Math.abs(item.x - candidate.x) <= 1 && (_nullishCoalesce(_optionalChain([item, 'access', _390 => _390.text, 'access', _391 => _391.match, 'call', _392 => _392(/\p{L}/gu), 'optionalAccess', _393 => _393.length]), () => ( 0))) >= 12).sort((a, b) => b.y - a.y);
8122
8142
  const numberedList = numbered.some((item, index) => index > 0 && item.text.trim().charCodeAt(0) === numbered[index - 1].text.trim().charCodeAt(0) + 1);
8123
8143
  if (!same.length && !numberedList || used.has(candidate.line)) continue;
8124
8144
  if (!shapes.has(candidate.id)) shapes.set(candidate.id, hollowCircle(await resolveImagePixels(page, candidate.id)));
@@ -8184,7 +8204,7 @@ function groupFlowBoxUnits(blocks, grids, hs, vs, images) {
8184
8204
  return units;
8185
8205
  }
8186
8206
  function arrowDirection(image) {
8187
- if (!_optionalChain([image, 'optionalAccess', _384 => _384.data]) || image.width < 16 || image.width > 128 || image.height < 16 || image.height > 128) return 0;
8207
+ if (!_optionalChain([image, 'optionalAccess', _394 => _394.data]) || image.width < 16 || image.width > 128 || image.height < 16 || image.height > 128) return 0;
8188
8208
  const { width, height, data } = image;
8189
8209
  const stride = image.kind === _pdfmjs.ImageKind.RGB_24BPP ? 3 : image.kind === _pdfmjs.ImageKind.RGBA_32BPP ? 4 : 0;
8190
8210
  if (!stride || data.length < width * height * stride) return 0;
@@ -8252,7 +8272,7 @@ function isSideTabTable(box, table, others, pageWidth, pageHeight) {
8252
8272
  function removeSideTabs(blocks, pageWidths) {
8253
8273
  const edges = /* @__PURE__ */ new Map();
8254
8274
  for (const b of blocks) {
8255
- if (!b.bbox || b.pageNumber === void 0 || [..._nullishCoalesce(_optionalChain([b, 'access', _385 => _385.text, 'optionalAccess', _386 => _386.trim, 'call', _387 => _387()]), () => ( ""))].length <= MAX_CHARS) continue;
8275
+ if (!b.bbox || b.pageNumber === void 0 || [..._nullishCoalesce(_optionalChain([b, 'access', _395 => _395.text, 'optionalAccess', _396 => _396.trim, 'call', _397 => _397()]), () => ( ""))].length <= MAX_CHARS) continue;
8256
8276
  const e = _nullishCoalesce(edges.get(b.pageNumber), () => ( { lefts: [], rights: [] }));
8257
8277
  e.lefts.push(b.bbox.x);
8258
8278
  e.rights.push(b.bbox.x + b.bbox.width);
@@ -8268,7 +8288,7 @@ function removeSideTabs(blocks, pageWidths) {
8268
8288
  const fallback = all.length ? { left: q(all.map((e) => e.left), 0.5), right: q(all.map((e) => e.right), 0.5) } : void 0;
8269
8289
  const key = (b) => {
8270
8290
  const w = b.pageNumber !== void 0 ? pageWidths.get(b.pageNumber) : void 0;
8271
- const text = _optionalChain([b, 'access', _388 => _388.text, 'optionalAccess', _389 => _389.trim, 'call', _390 => _390()]);
8291
+ const text = _optionalChain([b, 'access', _398 => _398.text, 'optionalAccess', _399 => _399.trim, 'call', _400 => _400()]);
8272
8292
  const area = _nullishCoalesce((b.pageNumber !== void 0 ? body.get(b.pageNumber) : void 0), () => ( fallback));
8273
8293
  if (b.type === "table") {
8274
8294
  if (!w || !b.bbox || !b.table || !SIDE_TAB_TABLES.has(b.table)) return null;
@@ -8934,16 +8954,16 @@ function isProseSpread(items) {
8934
8954
  for (let i = 1; i < sorted.length; i++) {
8935
8955
  gaps.push(sorted[i].x - (sorted[i - 1].x + sorted[i - 1].w));
8936
8956
  }
8937
- const maxGap = _chunkLFTO5QAPcjs.safeMax.call(void 0, gaps);
8957
+ const maxGap = _chunkHMHIF6QFcjs.safeMax.call(void 0, gaps);
8938
8958
  const avgLen = items.reduce((s, i) => s + i.text.length, 0) / items.length;
8939
8959
  if (items.length >= 4 && maxGap < 40 && avgLen < 5) return true;
8940
- const minGap = _chunkLFTO5QAPcjs.safeMin.call(void 0, gaps);
8960
+ const minGap = _chunkHMHIF6QFcjs.safeMin.call(void 0, gaps);
8941
8961
  return minGap > 0 && maxGap - minGap <= Math.max(2, maxGap * 0.15) && (items.filter((i) => /^\P{L}*\p{Ll}/u.test(i.text)).length * 2 >= items.length || items.some((i) => /\p{L}[,.;:]["”’)]?$/u.test(i.text)));
8942
8962
  }
8943
8963
  function detectColumns(yLines) {
8944
8964
  const allItems = yLines.flat();
8945
8965
  if (allItems.length === 0) return null;
8946
- const pageWidth = _chunkLFTO5QAPcjs.safeMax.call(void 0, allItems.map((i) => i.x + i.w)) - _chunkLFTO5QAPcjs.safeMin.call(void 0, allItems.map((i) => i.x));
8966
+ const pageWidth = _chunkHMHIF6QFcjs.safeMax.call(void 0, allItems.map((i) => i.x + i.w)) - _chunkHMHIF6QFcjs.safeMin.call(void 0, allItems.map((i) => i.x));
8947
8967
  if (pageWidth < 100) return null;
8948
8968
  let bigoLineIdx = -1;
8949
8969
  for (let i = 0; i < yLines.length; i++) {
@@ -9168,7 +9188,7 @@ var UNDER_BOX_PAIR_MAX_EM = 2.2;
9168
9188
  var UNDER_BOX_PAIR_OVERLAP = 0.8;
9169
9189
  function markUnderlineItems(items, horizontals, verticals, nonRules) {
9170
9190
  const underlines = [];
9171
- if (_optionalChain([nonRules, 'optionalAccess', _391 => _391.size])) horizontals = horizontals.filter((line) => !nonRules.has(line));
9191
+ if (_optionalChain([nonRules, 'optionalAccess', _401 => _401.size])) horizontals = horizontals.filter((line) => !nonRules.has(line));
9172
9192
  if (items.length === 0 || horizontals.length === 0) return underlines;
9173
9193
  const tightOwners = /* @__PURE__ */ new Map();
9174
9194
  const tightlyOwned = (line) => {
@@ -9274,7 +9294,7 @@ function hasBoxTopPair(line, maxH, horizontals, cellItems) {
9274
9294
  if (ow <= 0) continue;
9275
9295
  const overlap2 = Math.min(line.x2, o.x2) - Math.max(line.x1, o.x1);
9276
9296
  if (overlap2 / Math.max(w, ow) < UNDER_BOX_PAIR_OVERLAP) continue;
9277
- const covered = _nullishCoalesce(_optionalChain([cellItems, 'optionalAccess', _392 => _392.reduce, 'call', _393 => _393((sum, item) => {
9297
+ const covered = _nullishCoalesce(_optionalChain([cellItems, 'optionalAccess', _402 => _402.reduce, 'call', _403 => _403((sum, item) => {
9278
9298
  const below = item.y - o.y1;
9279
9299
  if (below < 0.5 || below > 3 || !item.text.trim()) return sum;
9280
9300
  return sum + Math.max(0, Math.min(o.x2, item.x + item.w) - Math.max(o.x1, item.x));
@@ -9341,13 +9361,13 @@ function partTex(group) {
9341
9361
  const base = Math.min(...g.filter((i) => i.fontSize >= size * SCRIPT_SIZE_RATIO).map((i) => i.y));
9342
9362
  let s = "", run = "";
9343
9363
  const flush = () => {
9344
- if (run) s += _chunkOW2XKTQAcjs.toTex.call(void 0, run);
9364
+ if (run) s += _chunk5MBQW3KPcjs.toTex.call(void 0, run);
9345
9365
  run = "";
9346
9366
  };
9347
9367
  g.forEach((it, k) => {
9348
9368
  if (it.fontSize < size * SCRIPT_SIZE_RATIO && it.y - base >= size * SCRIPT_RISE_EM) {
9349
9369
  flush();
9350
- s += `^{${_chunkOW2XKTQAcjs.toTex.call(void 0, it.text)}}`;
9370
+ s += `^{${_chunk5MBQW3KPcjs.toTex.call(void 0, it.text)}}`;
9351
9371
  return;
9352
9372
  }
9353
9373
  if (k && it.x - (g[k - 1].x + g[k - 1].w) > spaceGapThreshold(it.fontSize)) run += " ";
@@ -9520,12 +9540,12 @@ function rebuildUnitLine(items, grid) {
9520
9540
  function prependUnitRow(cells, cols, line, usedItems) {
9521
9541
  const text = cleanCellText(line.map((item) => item.text).join(""));
9522
9542
  cells.unshift(Array.from({ length: cols }, (_, c) => ({ text: c === 0 ? text : "", colSpan: c === 0 ? cols : 1, rowSpan: 1 })));
9523
- for (const cell of cells[0]) _chunkOW2XKTQAcjs.CELL_EDGES.set(cell, NO_EDGES);
9543
+ for (const cell of cells[0]) _chunk5MBQW3KPcjs.CELL_EDGES.set(cell, NO_EDGES);
9524
9544
  for (const item of line) usedItems.add(item);
9525
9545
  }
9526
9546
  function attachUnitRow(items, grid, cells, cols, usedItems) {
9527
9547
  const all = cells.flat();
9528
- if (all.filter((c) => c.text.trim()).length * 2 < all.length || UNIT.test(_nullishCoalesce(_optionalChain([cells, 'access', _394 => _394[0], 'optionalAccess', _395 => _395[0], 'optionalAccess', _396 => _396.text]), () => ( "")))) return false;
9548
+ if (all.filter((c) => c.text.trim()).length * 2 < all.length || UNIT.test(_nullishCoalesce(_optionalChain([cells, 'access', _404 => _404[0], 'optionalAccess', _405 => _405[0], 'optionalAccess', _406 => _406.text]), () => ( "")))) return false;
9529
9549
  const above = items.filter((it) => !usedItems.has(it) && it.y >= grid.bbox.y2 && it.y - grid.bbox.y2 <= 8 && it.x >= grid.bbox.x1 - 3 && it.x + it.w <= grid.bbox.x2 + 3);
9530
9550
  let nearest = Infinity;
9531
9551
  for (const it of above) nearest = Math.min(nearest, it.y);
@@ -9560,7 +9580,7 @@ function closeShadedTableEdges(clipGrids, horizontals, verticals, fillRects) {
9560
9580
  let hs = horizontals, vs = verticals;
9561
9581
  const restored = [];
9562
9582
  for (const grid of clipGrids) {
9563
- if (grid.clipParent || grid.rowYs.length !== 2 || grid.colXs.length < 3 || !_optionalChain([grid, 'access', _397 => _397.cells, 'optionalAccess', _398 => _398.length]) || grid.cells.some((c) => c.filler || c.rowSpan !== 1 || c.colSpan !== 1)) continue;
9583
+ if (grid.clipParent || grid.rowYs.length !== 2 || grid.colXs.length < 3 || !_optionalChain([grid, 'access', _407 => _407.cells, 'optionalAccess', _408 => _408.length]) || grid.cells.some((c) => c.filler || c.rowSpan !== 1 || c.colSpan !== 1)) continue;
9564
9584
  const { x1, x2, y1: mid, y2: top } = grid.bbox;
9565
9585
  if (!grid.cells.every((c) => fillRects.some((f) => near2(f.x1, c.bbox.x1) && near2(f.x2, c.bbox.x2) && near2(f.y1, c.bbox.y1) && near2(f.y2, c.bbox.y2)))) continue;
9566
9586
  const topRule = hs.find((h) => near2(h.y1, top) && near2(h.x1, x1) && near2(h.x2, x2));
@@ -10024,7 +10044,7 @@ function takeFrameSpanningText(items, cutX, pageNum, lex) {
10024
10044
  const rows = groupByY([...items].sort((a, b) => b.y - a.y || a.x - b.x)).map((line) => {
10025
10045
  const runs = [];
10026
10046
  for (const item of [...line].sort((a, b) => a.x - b.x)) {
10027
- const run = runs[runs.length - 1], prev = _optionalChain([run, 'optionalAccess', _399 => _399[run.length - 1]]);
10047
+ const run = runs[runs.length - 1], prev = _optionalChain([run, 'optionalAccess', _409 => _409[run.length - 1]]);
10028
10048
  if (prev && item.x - (prev.x + prev.w) <= Math.max(prev.fontSize, item.fontSize) * 0.6) run.push(item);
10029
10049
  else runs.push([item]);
10030
10050
  }
@@ -10068,7 +10088,7 @@ function groupFrameParagraphUnits(units, frames) {
10068
10088
  for (const unit of units) for (const block of unit) source.set(block, unit);
10069
10089
  const members = /* @__PURE__ */ new Map(), emitted = /* @__PURE__ */ new Set();
10070
10090
  for (const frame of frames) {
10071
- if (frame.length < 2 || frame.some((block) => block.type !== "paragraph" || _optionalChain([source, 'access', _400 => _400.get, 'call', _401 => _401(block), 'optionalAccess', _402 => _402.length]) !== 1)) continue;
10091
+ if (frame.length < 2 || frame.some((block) => block.type !== "paragraph" || _optionalChain([source, 'access', _410 => _410.get, 'call', _411 => _411(block), 'optionalAccess', _412 => _412.length]) !== 1)) continue;
10072
10092
  for (const block of frame) members.set(block, frame);
10073
10093
  }
10074
10094
  const out = [];
@@ -10081,7 +10101,7 @@ function groupFrameParagraphUnits(units, frames) {
10081
10101
  }
10082
10102
  }
10083
10103
  for (const unit of out) {
10084
- if (unit.length < 2 || _optionalChain([FRAME_READING_UNITS, 'access', _403 => _403.get, 'call', _404 => _404(unit[0]), 'optionalAccess', _405 => _405.blocks]) === unit) continue;
10104
+ if (unit.length < 2 || _optionalChain([FRAME_READING_UNITS, 'access', _413 => _413.get, 'call', _414 => _414(unit[0]), 'optionalAccess', _415 => _415.blocks]) === unit) continue;
10085
10105
  const bs = unit.map((b) => b.bbox).filter((b) => !!b);
10086
10106
  if (bs.length !== unit.length) continue;
10087
10107
  const x = Math.min(...bs.map((b) => b.x)), y = Math.min(...bs.map((b) => b.y));
@@ -10098,14 +10118,14 @@ function groupFrameParagraphUnits(units, frames) {
10098
10118
  function recordFrameTitle(table, source, pageNum) {
10099
10119
  if (!CLIP_TABLES.has(table) || table.rows !== 1 || table.cols !== 3 || source.length < 2) return;
10100
10120
  const cells = table.cells[0];
10101
- if (cells.length !== 3 || cells.some((c) => c.colSpan !== 1 || c.rowSpan !== 1 || _optionalChain([c, 'access', _406 => _406.blocks, 'optionalAccess', _407 => _407.length]) || c.text.includes("\n"))) return;
10121
+ if (cells.length !== 3 || cells.some((c) => c.colSpan !== 1 || c.rowSpan !== 1 || _optionalChain([c, 'access', _416 => _416.blocks, 'optionalAccess', _417 => _417.length]) || c.text.includes("\n"))) return;
10102
10122
  const [label, spacer, title] = cells;
10103
10123
  if (!/^(?:붙임|별첨|첨부|부록)\s*\d{1,3}$/.test(label.text.trim()) || spacer.text.trim() || !title.text.trim()) return;
10104
10124
  if (cells.some((c) => {
10105
- const e = _chunkOW2XKTQAcjs.CELL_EDGES.get(c);
10125
+ const e = _chunk5MBQW3KPcjs.CELL_EDGES.get(c);
10106
10126
  return !e || e.t || e.b || e.l || e.r;
10107
10127
  })) return;
10108
- const xs = TABLE_COLXS.get(table), style = dominantStyle(source), fs = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _408 => _408.fontSize]), () => ( 0));
10128
+ const xs = TABLE_COLXS.get(table), style = dominantStyle(source), fs = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _418 => _418.fontSize]), () => ( 0));
10109
10129
  if (!xs || xs.length !== 4 || fs <= 0) return;
10110
10130
  const width = xs[3] - xs[0], gap = xs[2] - xs[1];
10111
10131
  if (width < fs * 12 || gap <= 0 || gap > fs * 1.5 || xs[1] - xs[0] > width * 0.25 || xs[3] - xs[2] < width * 0.6) return;
@@ -10169,7 +10189,7 @@ function extendNestedShadedHeaders(clipGrids, lineGrids, horizontals, verticals,
10169
10189
  const extended = [];
10170
10190
  for (let i = 0; i < clipGrids.length; i++) {
10171
10191
  const c = clipGrids[i], parent = c.clipParent;
10172
- if (!parent || c.rowYs.length !== 2 || c.colXs.length < 3 || !_optionalChain([c, 'access', _409 => _409.cells, 'optionalAccess', _410 => _410.length]) || c.cells.some((cell) => cell.filler || cell.rowSpan !== 1 || cell.colSpan !== 1)) continue;
10192
+ if (!parent || c.rowYs.length !== 2 || c.colXs.length < 3 || !_optionalChain([c, 'access', _419 => _419.cells, 'optionalAccess', _420 => _420.length]) || c.cells.some((cell) => cell.filler || cell.rowSpan !== 1 || cell.colSpan !== 1)) continue;
10173
10193
  if (!clipGrids.some((g) => g.rowYs.length === 2 && g.colXs.length === 2 && near2(g.bbox.x1, parent.x1) && near2(g.bbox.x2, parent.x2) && near2(g.bbox.y1, parent.y1) && near2(g.bbox.y2, parent.y2))) continue;
10174
10194
  if (!c.cells.every((cell) => fills.some((f) => near2(f.x1, cell.bbox.x1) && near2(f.x2, cell.bbox.x2) && near2(f.y1, cell.bbox.y1) && near2(f.y2, cell.bbox.y2)))) continue;
10175
10195
  const host = lineGrids.find((l) => l.rowYs.length > 2 && l.colXs.length === c.colXs.length && c.colXs.every((x, k) => near2(x, l.colXs[k])) && c.rowYs.every((y, k) => near2(y, l.rowYs[k])) && contains4(parent, l.bbox) && l.rowYs.every((y) => horizontals.some((h) => near2(h.y1, y) && near2(h.x1, l.bbox.x1) && near2(h.x2, l.bbox.x2))) && l.colXs.every((x) => verticals.some((v) => near2(v.x1, x) && v.y1 <= l.bbox.y1 + 1.5 && v.y2 >= l.bbox.y2 - 1.5)) && !clipGrids.some((o) => o !== c && !contains4(o.bbox, l.bbox) && Math.min(o.bbox.x2, l.bbox.x2) > Math.max(o.bbox.x1, l.bbox.x1) && Math.min(o.bbox.y2, l.bbox.y2) > Math.max(o.bbox.y1, l.bbox.y1)));
@@ -10192,7 +10212,7 @@ function attachSideTabBlocks(tab, body, pageNum) {
10192
10212
  bbox: computeBBox(items, pageNum),
10193
10213
  style: dominantStyle(items)
10194
10214
  });
10195
- const prefix = ordered.filter((g) => !_optionalChain([caps, 'optionalAccess', _411 => _411.has, 'call', _412 => _412(g)])).map((g) => ({
10215
+ const prefix = ordered.filter((g) => !_optionalChain([caps, 'optionalAccess', _421 => _421.has, 'call', _422 => _422(g)])).map((g) => ({
10196
10216
  type: "paragraph",
10197
10217
  text: g.text.trim(),
10198
10218
  pageNumber: pageNum,
@@ -10201,7 +10221,7 @@ function attachSideTabBlocks(tab, body, pageNum) {
10201
10221
  }));
10202
10222
  const groups = /* @__PURE__ */ new Map();
10203
10223
  for (const g of ordered) {
10204
- const cap = _optionalChain([caps, 'optionalAccess', _413 => _413.get, 'call', _414 => _414(g)]);
10224
+ const cap = _optionalChain([caps, 'optionalAccess', _423 => _423.get, 'call', _424 => _424(g)]);
10205
10225
  if (cap) groups.set(cap, [..._nullishCoalesce(groups.get(cap), () => ( [])), g]);
10206
10226
  }
10207
10227
  for (const [cap, glyphs] of groups) {
@@ -10233,7 +10253,7 @@ function extractPageBlocksWithLines(items, pageNum, opList, pageWidth, pageHeigh
10233
10253
  let prev = null;
10234
10254
  for (const line of streamLines(items)) {
10235
10255
  lex.addLine(mergeLineSimple(line));
10236
- const fs = _nullishCoalesce(_optionalChain([dominantStyle, 'call', _415 => _415(line), 'optionalAccess', _416 => _416.fontSize]), () => ( 0));
10256
+ const fs = _nullishCoalesce(_optionalChain([dominantStyle, 'call', _425 => _425(line), 'optionalAccess', _426 => _426.fontSize]), () => ( 0));
10237
10257
  const left = Math.min(...line.map((i) => i.x)), right = Math.max(...line.map((i) => i.x + i.w));
10238
10258
  const y = line.reduce((n, i) => n + i.y, 0) / line.length;
10239
10259
  const wide = fs > 0 && right - left >= 12 * fs;
@@ -10247,7 +10267,7 @@ function extractPageBlocksWithLines(items, pageNum, opList, pageWidth, pageHeigh
10247
10267
  const filled = fillBlanks(items, horizontals, verticals);
10248
10268
  items = filled.items;
10249
10269
  horizontals = filled.horizontals;
10250
- const prevPage = _optionalChain([carry, 'optionalAccess', _417 => _417.page]) === pageNum - 1 ? carry.clip : void 0;
10270
+ const prevPage = _optionalChain([carry, 'optionalAccess', _427 => _427.page]) === pageNum - 1 ? carry.clip : void 0;
10251
10271
  const images = extractImageRegions(opList.fnArray, opList.argsArray);
10252
10272
  const clipRects = images.length ? withoutImageOnlyClips(extracted.clipRects, images) : extracted.clipRects;
10253
10273
  const clipResult = detectTables ? buildClipCellGrids(clipRects, horizontals, verticals, pageWidth, pageHeight, items.map((it) => ({ x: it.x + it.w / 2, y: it.y + it.h / 2 })), extracted.fillRects, prevPage) : { grids: [], containers: [], page: void 0 };
@@ -10545,7 +10565,7 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
10545
10565
  const nested = pendingNested.length ? takePendingNested(pendingNested, cell.bbox, !!grid.cells) : [];
10546
10566
  const lone = nested.length === 1 && !cellItems.length ? nested[0] : null;
10547
10567
  const cw = cell.bbox.x2 - cell.bbox.x1;
10548
- if (_optionalChain([lone, 'optionalAccess', _418 => _418.table]) && lone.bbox && lone.table.rows === 1 && lone.table.cols === 1 && CLIP_TABLES.has(lone.table) && !_optionalChain([lone, 'access', _419 => _419.table, 'access', _420 => _420.cells, 'access', _421 => _421[0], 'access', _422 => _422[0], 'access', _423 => _423.blocks, 'optionalAccess', _424 => _424.some, 'call', _425 => _425((b2) => b2.type === "table")]) && lone.bbox.width >= cw * 0.9 && /^[^\n]{1,30}$/.test(lone.table.cells[0][0].text.trim())) {
10568
+ if (_optionalChain([lone, 'optionalAccess', _428 => _428.table]) && lone.bbox && lone.table.rows === 1 && lone.table.cols === 1 && CLIP_TABLES.has(lone.table) && !_optionalChain([lone, 'access', _429 => _429.table, 'access', _430 => _430.cells, 'access', _431 => _431[0], 'access', _432 => _432[0], 'access', _433 => _433.blocks, 'optionalAccess', _434 => _434.some, 'call', _435 => _435((b2) => b2.type === "table")]) && lone.bbox.width >= cw * 0.9 && /^[^\n]{1,30}$/.test(lone.table.cells[0][0].text.trim())) {
10549
10569
  irGrid[cell.row][cell.col] = { text: lone.table.cells[0][0].text, colSpan: cell.colSpan, rowSpan: cell.rowSpan };
10550
10570
  takeClipCellEdges(cell, irGrid[cell.row][cell.col]);
10551
10571
  continue;
@@ -10595,10 +10615,10 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
10595
10615
  const ls = irGrid.slice(1).flat().flatMap((c) => c.text.split("\n")).map((t) => t.trim()).filter(Boolean);
10596
10616
  const numericLine = (t) => {
10597
10617
  const cs = t.replace(/\s+/g, "");
10598
- return cs.length > 0 && (_nullishCoalesce(_optionalChain([cs, 'access', _426 => _426.match, 'call', _427 => _427(/[\d.,%()+\-−–—△▲▽▼]/g), 'optionalAccess', _428 => _428.length]), () => ( 0))) >= cs.length * 0.85;
10618
+ return cs.length > 0 && (_nullishCoalesce(_optionalChain([cs, 'access', _436 => _436.match, 'call', _437 => _437(/[\d.,%()+\-−–—△▲▽▼]/g), 'optionalAccess', _438 => _438.length]), () => ( 0))) >= cs.length * 0.85;
10599
10619
  };
10600
10620
  const labelValueLine = (t) => {
10601
- const hangul = _nullishCoalesce(_optionalChain([t, 'access', _429 => _429.match, 'call', _430 => _430(/[가-힣]/g), 'optionalAccess', _431 => _431.length]), () => ( 0));
10621
+ const hangul = _nullishCoalesce(_optionalChain([t, 'access', _439 => _439.match, 'call', _440 => _440(/[가-힣]/g), 'optionalAccess', _441 => _441.length]), () => ( 0));
10602
10622
  return hangul > 0 && hangul <= 6 && /\d,\d{3}/.test(t) && numericLine(t.replace(/[가-힣()]/g, ""));
10603
10623
  };
10604
10624
  const bulletLine = (t) => /^\s*[○◦•□■▪]/.test(t) || /^\s*-\s*[^\d\s.,−-]/.test(t) && t.replace(/\s+/g, "").length > 7;
@@ -10608,14 +10628,14 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
10608
10628
  const share = ls.filter((t) => numericLine(t) || lvLines.has(t)).length / ls.length;
10609
10629
  if (share >= 0.5) return true;
10610
10630
  const colShares = Array.from({ length: numCols }, (_, c) => {
10611
- const cl = irGrid.slice(1).flatMap((row) => (_nullishCoalesce(_optionalChain([row, 'access', _432 => _432[c], 'optionalAccess', _433 => _433.text]), () => ( ""))).split("\n")).map((t) => t.trim()).filter(Boolean);
10631
+ const cl = irGrid.slice(1).flatMap((row) => (_nullishCoalesce(_optionalChain([row, 'access', _442 => _442[c], 'optionalAccess', _443 => _443.text]), () => ( ""))).split("\n")).map((t) => t.trim()).filter(Boolean);
10612
10632
  return cl.length ? cl.filter(numericLine).length / cl.length : null;
10613
10633
  }).filter((v) => v !== null);
10614
10634
  return share >= 0.35 && colShares.some((v) => v >= 0.8) && colShares.every((v) => v >= 0.8 || v <= 0.2);
10615
10635
  })();
10616
10636
  const layoutProse = irGrid.some((row) => row.some((c) => c.colSpan >= numCols - 1 && c.text.length > 60));
10617
10637
  const maxRows = numericBody ? layoutProse ? OCR_NUMERIC_MAX_ROWS_FRAMED : OCR_NUMERIC_MAX_ROWS : 5;
10618
- const proseLine = (t) => (_nullishCoalesce(_optionalChain([t, 'access', _434 => _434.match, 'call', _435 => _435(/[가-힣]/g), 'optionalAccess', _436 => _436.length]), () => ( 0))) > 6 && !/^[-−]?[\d,.]+$/.test(t.replace(/\s+/g, ""));
10638
+ const proseLine = (t) => (_nullishCoalesce(_optionalChain([t, 'access', _444 => _444.match, 'call', _445 => _445(/[가-힣]/g), 'optionalAccess', _446 => _446.length]), () => ( 0))) > 6 && !/^[-−]?[\d,.]+$/.test(t.replace(/\s+/g, ""));
10619
10639
  const proseCols = numRows === 2 ? (_nullishCoalesce(irGrid[1], () => ( []))).filter((c) => {
10620
10640
  const ls = c.text.split("\n").map((t) => t.trim()).filter(Boolean);
10621
10641
  return ls.length >= 3 && ls.filter(proseLine).length >= ls.length * 0.6;
@@ -10636,8 +10656,8 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
10636
10656
  finalGrid = rebuilt.map((row, i) => {
10637
10657
  const o = kept.get(i);
10638
10658
  return row.map((rawText, c) => {
10639
- const src = o === void 0 ? void 0 : _optionalChain([irGrid, 'access', _437 => _437[o], 'optionalAccess', _438 => _438[c]]);
10640
- return { text: cleanCellText(rawText), colSpan: _nullishCoalesce(_optionalChain([src, 'optionalAccess', _439 => _439.colSpan]), () => ( 1)), rowSpan: src ? spanRows(o, src.rowSpan) : 1 };
10659
+ const src = o === void 0 ? void 0 : _optionalChain([irGrid, 'access', _447 => _447[o], 'optionalAccess', _448 => _448[c]]);
10660
+ return { text: cleanCellText(rawText), colSpan: _nullishCoalesce(_optionalChain([src, 'optionalAccess', _449 => _449.colSpan]), () => ( 1)), rowSpan: src ? spanRows(o, src.rowSpan) : 1 };
10641
10661
  });
10642
10662
  });
10643
10663
  finalRows = finalGrid.length;
@@ -10657,14 +10677,14 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
10657
10677
  if (!assignedItems.has(textItems[ti]) && !inExpanded(textItems[ti])) usedItems.delete(owners[ti]);
10658
10678
  }
10659
10679
  }
10660
- if (unitLine.length > 0 && rebuiltUsed && !/^\s*\(\s*단위\s*[::]/.test(_nullishCoalesce(_optionalChain([finalGrid, 'access', _440 => _440[0], 'optionalAccess', _441 => _441[0], 'optionalAccess', _442 => _442.text]), () => ( "")))) {
10680
+ if (unitLine.length > 0 && rebuiltUsed && !/^\s*\(\s*단위\s*[::]/.test(_nullishCoalesce(_optionalChain([finalGrid, 'access', _450 => _450[0], 'optionalAccess', _451 => _451[0], 'optionalAccess', _452 => _452.text]), () => ( "")))) {
10661
10681
  prependUnitRow(finalGrid, numCols, unitLine, usedItems);
10662
10682
  finalRows++;
10663
10683
  }
10664
10684
  if (!rebuiltUsed && attachUnitRow(items, grid, finalGrid, numCols, usedItems)) finalRows++;
10665
10685
  let semanticOneColumn = false;
10666
10686
  if (!grid.cells && !nestedAttached && numCols === 1 && numGridRows >= 2) {
10667
- const populatedRows = finalGrid.filter((row) => _optionalChain([row, 'access', _443 => _443[0], 'optionalAccess', _444 => _444.text, 'access', _445 => _445.trim, 'call', _446 => _446()]));
10687
+ const populatedRows = finalGrid.filter((row) => _optionalChain([row, 'access', _453 => _453[0], 'optionalAccess', _454 => _454.text, 'access', _455 => _455.trim, 'call', _456 => _456()]));
10668
10688
  if (populatedRows.length >= 4) {
10669
10689
  const fontSizes = tableItems.map((item) => item.fontSize).filter((size) => size > 0).sort((a, b) => a - b);
10670
10690
  const medianFont = _nullishCoalesce(fontSizes[Math.floor(fontSizes.length / 2)], () => ( 0));
@@ -10762,7 +10782,7 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
10762
10782
  height: grid.bbox.y2 - grid.bbox.y1
10763
10783
  };
10764
10784
  if (numRows === 1 && numCols === 1 && gridW < pageWidth * 0.35) {
10765
- const prose = _nullishCoalesce(_optionalChain([finalGrid, 'access', _447 => _447[0], 'optionalAccess', _448 => _448[0], 'optionalAccess', _449 => _449.text]), () => ( ""));
10785
+ const prose = _nullishCoalesce(_optionalChain([finalGrid, 'access', _457 => _457[0], 'optionalAccess', _458 => _458[0], 'optionalAccess', _459 => _459.text]), () => ( ""));
10766
10786
  const besideLines = (side) => new Set(side.map((it) => Math.round(it.y / 3))).size;
10767
10787
  const rightLines = items.filter((it) => it.x >= grid.bbox.x2 + 3 && it.y >= grid.bbox.y1 && it.y <= grid.bbox.y2);
10768
10788
  const leftLines = items.filter((it) => it.x + it.w <= grid.bbox.x1 - 3 && it.y >= grid.bbox.y1 && it.y <= grid.bbox.y2);
@@ -10781,8 +10801,8 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
10781
10801
  }
10782
10802
  }
10783
10803
  if (!grid.cells && !nestedAttached && shouldDemoteTable(irTable)) {
10784
- const paragraphs = numRows === 1 && numCols === 1 ? _optionalChain([irTable, 'access', _450 => _450.cells, 'access', _451 => _451[0], 'optionalAccess', _452 => _452[0], 'optionalAccess', _453 => _453.blocks]) : void 0;
10785
- if (_optionalChain([paragraphs, 'optionalAccess', _454 => _454.length])) {
10804
+ const paragraphs = numRows === 1 && numCols === 1 ? _optionalChain([irTable, 'access', _460 => _460.cells, 'access', _461 => _461[0], 'optionalAccess', _462 => _462[0], 'optionalAccess', _463 => _463.blocks]) : void 0;
10805
+ if (_optionalChain([paragraphs, 'optionalAccess', _464 => _464.length])) {
10786
10806
  blocks.push(...paragraphs);
10787
10807
  frameParagraphUnits.push(paragraphs);
10788
10808
  recordFrameReadingUnit(paragraphs, tableBbox);
@@ -10829,7 +10849,7 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
10829
10849
  const clusterResults = (proseColumns ? [] : detectClusterTables(clusterItems, pageNum, void 0, lex)).filter((cr) => {
10830
10850
  const b = cr.bbox;
10831
10851
  const overlapX = (x) => Math.min(x.x + x.width, b.x + b.width) - Math.max(x.x, b.x);
10832
- return !blocks.some((x) => x.bbox && x.bbox.y >= b.y - 2 && x.bbox.y + x.bbox.height <= b.y + b.height + 2 && (x.type === "paragraph" ? (_nullishCoalesce(_optionalChain([x, 'access', _455 => _455.text, 'optionalAccess', _456 => _456.match, 'call', _457 => _457(/\p{L}/gu), 'optionalAccess', _458 => _458.length]), () => ( 0))) >= 10 && overlapX(x.bbox) >= 0.8 * b.width : x.type === "table" && !ocrPage && _optionalChain([x, 'access', _459 => _459.table, 'optionalAccess', _460 => _460.cols]) === cr.table.cols && overlapX(x.bbox) >= 0.5 * Math.min(x.bbox.width, b.width)));
10852
+ return !blocks.some((x) => x.bbox && x.bbox.y >= b.y - 2 && x.bbox.y + x.bbox.height <= b.y + b.height + 2 && (x.type === "paragraph" ? (_nullishCoalesce(_optionalChain([x, 'access', _465 => _465.text, 'optionalAccess', _466 => _466.match, 'call', _467 => _467(/\p{L}/gu), 'optionalAccess', _468 => _468.length]), () => ( 0))) >= 10 && overlapX(x.bbox) >= 0.8 * b.width : x.type === "table" && !ocrPage && _optionalChain([x, 'access', _469 => _469.table, 'optionalAccess', _470 => _470.cols]) === cr.table.cols && overlapX(x.bbox) >= 0.5 * Math.min(x.bbox.width, b.width)));
10833
10853
  });
10834
10854
  if (clusterResults.length > 0) {
10835
10855
  const ciToIdx = /* @__PURE__ */ new Map();
@@ -10866,7 +10886,7 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
10866
10886
  groupSizes.push(1);
10867
10887
  }
10868
10888
  const allY = remaining.map((i) => i.y);
10869
- const pageH = _chunkLFTO5QAPcjs.safeMax.call(void 0, allY) - _chunkLFTO5QAPcjs.safeMin.call(void 0, allY);
10889
+ const pageH = _chunkHMHIF6QFcjs.safeMax.call(void 0, allY) - _chunkHMHIF6QFcjs.safeMin.call(void 0, allY);
10870
10890
  const gapThreshold = Math.max(15, pageH * 0.03);
10871
10891
  const sides = frameColumnTextBands(remaining, spanning, gx);
10872
10892
  const textBlocks = [];
@@ -10882,7 +10902,7 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
10882
10902
  finalTextBlocks.push(...detectListBlocks(textBlocks));
10883
10903
  } else {
10884
10904
  const allY = remaining.map((i) => i.y);
10885
- const pageH = _chunkLFTO5QAPcjs.safeMax.call(void 0, allY) - _chunkLFTO5QAPcjs.safeMin.call(void 0, allY);
10905
+ const pageH = _chunkHMHIF6QFcjs.safeMax.call(void 0, allY) - _chunkHMHIF6QFcjs.safeMin.call(void 0, allY);
10886
10906
  const gapThreshold = Math.max(15, pageH * 0.03);
10887
10907
  const groups = xyCutOrder(remaining, gapThreshold, 0, void 0, 0, lex);
10888
10908
  const textBlocks = [];
@@ -11244,7 +11264,7 @@ function extractPageBlocksFallback(items, pageNum, fullPage = false, detectTable
11244
11264
  blocks.push(...columnTextToBlocks(tableText, pageNum, bbox, dominantStyle(items)));
11245
11265
  } else {
11246
11266
  const allY = items.map((i) => i.y);
11247
- const pageHeight = _chunkLFTO5QAPcjs.safeMax.call(void 0, allY) - _chunkLFTO5QAPcjs.safeMin.call(void 0, allY);
11267
+ const pageHeight = _chunkHMHIF6QFcjs.safeMax.call(void 0, allY) - _chunkHMHIF6QFcjs.safeMin.call(void 0, allY);
11248
11268
  const gapThreshold = Math.max(15, pageHeight * 0.03);
11249
11269
  const orderedGroups = proseCutX !== null ? splitTwoColumnProse(items, proseCutX) : xyCutOrder(items, gapThreshold, 0, void 0, minGap, lex);
11250
11270
  for (const group of orderedGroups) {
@@ -11301,19 +11321,19 @@ function mergeOcrImageRegions(blocks, page, regions, ocrBlocks) {
11301
11321
  const overlapH = Math.max(0, Math.min(b.y + b.height, region.y2) - Math.max(b.y, region.y1));
11302
11322
  return overlapW * overlapH >= b.width * b.height * 0.8;
11303
11323
  });
11304
- const labels = candidates.filter((b) => b.type === "paragraph" && b.bbox.height <= 24 && (_nullishCoalesce(_optionalChain([b, 'access', _461 => _461.text, 'optionalAccess', _462 => _462.match, 'call', _463 => _463(/[\p{L}\p{N}]/gu), 'optionalAccess', _464 => _464.length]), () => ( 0))) >= 2);
11324
+ const labels = candidates.filter((b) => b.type === "paragraph" && b.bbox.height <= 24 && (_nullishCoalesce(_optionalChain([b, 'access', _471 => _471.text, 'optionalAccess', _472 => _472.match, 'call', _473 => _473(/[\p{L}\p{N}]/gu), 'optionalAccess', _474 => _474.length]), () => ( 0))) >= 2);
11305
11325
  const axisFragments = rotatedAxisFragments(candidates);
11306
11326
  const accepted = candidates.filter((b) => {
11307
- if (b.type === "paragraph") return (_nullishCoalesce(_optionalChain([b, 'access', _465 => _465.text, 'optionalAccess', _466 => _466.match, 'call', _467 => _467(/[\p{L}\p{N}]/gu), 'optionalAccess', _468 => _468.length]), () => ( 0))) >= 2 || !axisFragments.has(b) && (supportedDiagramLabel(b, labels, region) || axisTick(b, candidates));
11327
+ if (b.type === "paragraph") return (_nullishCoalesce(_optionalChain([b, 'access', _475 => _475.text, 'optionalAccess', _476 => _476.match, 'call', _477 => _477(/[\p{L}\p{N}]/gu), 'optionalAccess', _478 => _478.length]), () => ( 0))) >= 2 || !axisFragments.has(b) && (supportedDiagramLabel(b, labels, region) || axisTick(b, candidates));
11308
11328
  const t = b.table;
11309
11329
  if (b.type !== "table" || !t || UNRULED_REGION_TABLES.has(b)) return false;
11310
11330
  const lone = t.cells.filter((row) => row.filter((c) => c.text.trim()).length === 1 && row.some((c) => c.colSpan === t.cols)).length;
11311
11331
  if (t.rows >= 2 && lone * 2 >= t.rows) return false;
11312
11332
  if (t.rows === 1 && t.cols === 1) {
11313
- const text = _nullishCoalesce(_optionalChain([t, 'access', _469 => _469.cells, 'access', _470 => _470[0], 'optionalAccess', _471 => _471[0], 'optionalAccess', _472 => _472.text]), () => ( ""));
11314
- return (_nullishCoalesce(_optionalChain([text, 'access', _473 => _473.match, 'call', _474 => _474(/\n/g), 'optionalAccess', _475 => _475.length]), () => ( 0))) >= 5 && (_nullishCoalesce(_optionalChain([text, 'access', _476 => _476.match, 'call', _477 => _477(/\d/g), 'optionalAccess', _478 => _478.length]), () => ( 0))) >= text.length * 0.25;
11333
+ const text = _nullishCoalesce(_optionalChain([t, 'access', _479 => _479.cells, 'access', _480 => _480[0], 'optionalAccess', _481 => _481[0], 'optionalAccess', _482 => _482.text]), () => ( ""));
11334
+ return (_nullishCoalesce(_optionalChain([text, 'access', _483 => _483.match, 'call', _484 => _484(/\n/g), 'optionalAccess', _485 => _485.length]), () => ( 0))) >= 5 && (_nullishCoalesce(_optionalChain([text, 'access', _486 => _486.match, 'call', _487 => _487(/\d/g), 'optionalAccess', _488 => _488.length]), () => ( 0))) >= text.length * 0.25;
11315
11335
  }
11316
- const headerLabels = _nullishCoalesce(_optionalChain([t, 'access', _479 => _479.cells, 'access', _480 => _480[0], 'optionalAccess', _481 => _481.filter, 'call', _482 => _482((c) => c.text.replace(/[^A-Za-z가-힣]/g, "").length >= 2), 'access', _483 => _483.length]), () => ( 0));
11336
+ const headerLabels = _nullishCoalesce(_optionalChain([t, 'access', _489 => _489.cells, 'access', _490 => _490[0], 'optionalAccess', _491 => _491.filter, 'call', _492 => _492((c) => c.text.replace(/[^A-Za-z가-힣]/g, "").length >= 2), 'access', _493 => _493.length]), () => ( 0));
11317
11337
  return t.rows >= 2 && t.cols >= 2 && headerLabels >= t.cols * 0.75 && t.cells.slice(1).some((row) => row.filter((c) => c.text.trim()).length >= 2);
11318
11338
  });
11319
11339
  const selected = candidates.flatMap((b) => accepted.includes(b) ? [b] : b.type === "table" && b.table ? rowParagraphs(b).filter((p) => /[\p{L}\p{N}]{2}/u.test(_nullishCoalesce(p.text, () => ( "")))) : []);
@@ -11330,14 +11350,14 @@ function mergeOcrImageRegions(blocks, page, regions, ocrBlocks) {
11330
11350
  for (const block of selected) {
11331
11351
  if (seen2.has(block)) continue;
11332
11352
  const frame = FRAME_READING_UNITS.get(block);
11333
- const source = _optionalChain([frame, 'optionalAccess', _484 => _484.blocks, 'access', _485 => _485.every, 'call', _486 => _486((member) => selectedSet.has(member))]) ? frame.blocks : [block];
11353
+ const source = _optionalChain([frame, 'optionalAccess', _494 => _494.blocks, 'access', _495 => _495.every, 'call', _496 => _496((member) => selectedSet.has(member))]) ? frame.blocks : [block];
11334
11354
  source.forEach((member) => seen2.add(member));
11335
11355
  const available = source.filter((member) => !hasOriginal(member));
11336
11356
  const units = frame && available.length === source.length && source === frame.blocks ? [{ blocks: available, bbox: frame.bbox, atomic: true }] : available.map((member) => ({ blocks: [member], bbox: member.bbox, atomic: false }));
11337
11357
  for (const unit of units) {
11338
11358
  const b = unit.bbox;
11339
11359
  const index = blocks.findIndex((existing) => {
11340
- const e = _nullishCoalesce(_optionalChain([FRAME_READING_UNITS, 'access', _487 => _487.get, 'call', _488 => _488(existing), 'optionalAccess', _489 => _489.bbox]), () => ( existing.bbox));
11360
+ const e = _nullishCoalesce(_optionalChain([FRAME_READING_UNITS, 'access', _497 => _497.get, 'call', _498 => _498(existing), 'optionalAccess', _499 => _499.bbox]), () => ( existing.bbox));
11341
11361
  if (existing.pageNumber !== page || !e) return false;
11342
11362
  const beside = e.y < region.y2 && e.y + e.height > region.y1 && e.x >= region.x2 - 1;
11343
11363
  if (placedHere.has(existing) && Math.abs(e.y + e.height / 2 - b.y - b.height / 2) <= Math.min(e.height, b.height) * 0.25) return e.x > b.x;
@@ -11355,16 +11375,16 @@ function mergeOcrImageRegions(blocks, page, regions, ocrBlocks) {
11355
11375
  }
11356
11376
  function axisTick(block, candidates) {
11357
11377
  const b = block.bbox;
11358
- if (!/^\d$/u.test(_nullishCoalesce(_optionalChain([block, 'access', _490 => _490.text, 'optionalAccess', _491 => _491.trim, 'call', _492 => _492()]), () => ( "")))) return false;
11359
- const numeric = candidates.filter((o) => o !== block && o.type === "paragraph" && o.bbox && /^[\d\s.,%+−-]+$/u.test(_nullishCoalesce(_optionalChain([o, 'access', _493 => _493.text, 'optionalAccess', _494 => _494.trim, 'call', _495 => _495()]), () => ( ""))) && /\d/u.test(_nullishCoalesce(o.text, () => ( ""))) && Math.max(o.bbox.height, b.height) <= Math.min(o.bbox.height, b.height) * 2);
11378
+ if (!/^\d$/u.test(_nullishCoalesce(_optionalChain([block, 'access', _500 => _500.text, 'optionalAccess', _501 => _501.trim, 'call', _502 => _502()]), () => ( "")))) return false;
11379
+ const numeric = candidates.filter((o) => o !== block && o.type === "paragraph" && o.bbox && /^[\d\s.,%+−-]+$/u.test(_nullishCoalesce(_optionalChain([o, 'access', _503 => _503.text, 'optionalAccess', _504 => _504.trim, 'call', _505 => _505()]), () => ( ""))) && /\d/u.test(_nullishCoalesce(o.text, () => ( ""))) && Math.max(o.bbox.height, b.height) <= Math.min(o.bbox.height, b.height) * 2);
11360
11380
  const cy = b.y + b.height / 2, right = b.x + b.width;
11361
11381
  const row = numeric.filter((o) => Math.abs(o.bbox.y + o.bbox.height / 2 - cy) <= Math.min(o.bbox.height, b.height) * 0.35);
11362
11382
  const column = numeric.filter((o) => Math.abs(o.bbox.x + o.bbox.width - right) <= Math.max(o.bbox.height, b.height) * 0.5);
11363
11383
  return row.length >= 2 || column.length >= 2;
11364
11384
  }
11365
11385
  function supportedDiagramLabel(block, labels, region) {
11366
- const b = block.bbox, text = _nullishCoalesce(_optionalChain([block, 'access', _496 => _496.text, 'optionalAccess', _497 => _497.trim, 'call', _498 => _498()]), () => ( ""));
11367
- if (!b || !/^[\p{L}\p{N}]$/u.test(text) || b.height < 4 || b.width < 1 || b.width > b.height * 2 || b.x < region.x1 || b.y < region.y1 || b.x + b.width > region.x2 || b.y + b.height > region.y2 || b.width * b.height > (region.x2 - region.x1) * (region.y2 - region.y1) * 5e-3 || labels.length < 3 || !labels.some((l) => /\p{L}{3}/u.test(_nullishCoalesce(l.text, () => ( "")))) || labels.filter((l) => !/\p{L}/u.test(_nullishCoalesce(l.text, () => ( ""))) && (_nullishCoalesce(_optionalChain([l, 'access', _499 => _499.text, 'optionalAccess', _500 => _500.match, 'call', _501 => _501(/\p{N}/gu), 'optionalAccess', _502 => _502.length]), () => ( 0))) >= 2).length < 2) return false;
11386
+ const b = block.bbox, text = _nullishCoalesce(_optionalChain([block, 'access', _506 => _506.text, 'optionalAccess', _507 => _507.trim, 'call', _508 => _508()]), () => ( ""));
11387
+ if (!b || !/^[\p{L}\p{N}]$/u.test(text) || b.height < 4 || b.width < 1 || b.width > b.height * 2 || b.x < region.x1 || b.y < region.y1 || b.x + b.width > region.x2 || b.y + b.height > region.y2 || b.width * b.height > (region.x2 - region.x1) * (region.y2 - region.y1) * 5e-3 || labels.length < 3 || !labels.some((l) => /\p{L}{3}/u.test(_nullishCoalesce(l.text, () => ( "")))) || labels.filter((l) => !/\p{L}/u.test(_nullishCoalesce(l.text, () => ( ""))) && (_nullishCoalesce(_optionalChain([l, 'access', _509 => _509.text, 'optionalAccess', _510 => _510.match, 'call', _511 => _511(/\p{N}/gu), 'optionalAccess', _512 => _512.length]), () => ( 0))) >= 2).length < 2) return false;
11368
11388
  let above = false, below = false;
11369
11389
  for (const label of labels) {
11370
11390
  const a = label.bbox, em = Math.max(b.height, a.height);
@@ -11379,7 +11399,7 @@ function rotatedAxisFragments(candidates) {
11379
11399
  const paragraphs = candidates.filter((b) => b.type === "paragraph" && b.bbox.height <= 24);
11380
11400
  const axes = [];
11381
11401
  for (const block of paragraphs) {
11382
- const b = block.bbox, text = _nullishCoalesce(_optionalChain([block, 'access', _503 => _503.text, 'optionalAccess', _504 => _504.trim, 'call', _505 => _505()]), () => ( ""));
11402
+ const b = block.bbox, text = _nullishCoalesce(_optionalChain([block, 'access', _513 => _513.text, 'optionalAccess', _514 => _514.trim, 'call', _515 => _515()]), () => ( ""));
11383
11403
  if (!/^[\d\s.,%+−-]+$/u.test(text) || !/\d/u.test(text) || b.width > b.height * 6) continue;
11384
11404
  const axis = axes.find((a) => Math.abs(a[0].bbox.x + a[0].bbox.width - b.x - b.width) <= Math.max(a[0].bbox.height, b.height) * 0.5);
11385
11405
  if (axis) axis.push(block);
@@ -11396,8 +11416,8 @@ function rotatedAxisFragments(candidates) {
11396
11416
  const em = Math.max(...axis.map((a) => a.bbox.height)), right = axis[0].bbox.x + axis[0].bbox.width;
11397
11417
  if (top - bottom < em * 6) continue;
11398
11418
  const left = paragraphs.filter((block) => {
11399
- const b = block.bbox, text = _nullishCoalesce(_optionalChain([block, 'access', _506 => _506.text, 'optionalAccess', _507 => _507.trim, 'call', _508 => _508()]), () => ( ""));
11400
- return /\p{Script=Latin}/u.test(text) && (_nullishCoalesce(_optionalChain([text, 'access', _509 => _509.match, 'call', _510 => _510(/[\p{L}\p{N}]/gu), 'optionalAccess', _511 => _511.length]), () => ( 0))) <= 3 && b.width <= b.height * 3 && b.x + b.width >= right - em * 6 && b.x + b.width <= right - Math.max(em, b.height) && b.y >= bottom && b.y + b.height <= top;
11419
+ const b = block.bbox, text = _nullishCoalesce(_optionalChain([block, 'access', _516 => _516.text, 'optionalAccess', _517 => _517.trim, 'call', _518 => _518()]), () => ( ""));
11420
+ return /\p{Script=Latin}/u.test(text) && (_nullishCoalesce(_optionalChain([text, 'access', _519 => _519.match, 'call', _520 => _520(/[\p{L}\p{N}]/gu), 'optionalAccess', _521 => _521.length]), () => ( 0))) <= 3 && b.width <= b.height * 3 && b.x + b.width >= right - em * 6 && b.x + b.width <= right - Math.max(em, b.height) && b.y >= bottom && b.y + b.height <= top;
11401
11421
  });
11402
11422
  const stack = left.filter((a) => left.some((b) => {
11403
11423
  if (a === b || !aligned(a, b)) return false;
@@ -11407,7 +11427,7 @@ function rotatedAxisFragments(candidates) {
11407
11427
  if (stack.length < 2) continue;
11408
11428
  for (const block of paragraphs) {
11409
11429
  const b = block.bbox;
11410
- if (b.y >= bottom && b.y + b.height <= top && b.x + b.width >= right - em * 6 && b.x + b.width <= right - Math.max(em, b.height) && /^[\p{L}\p{N}]$/u.test(_nullishCoalesce(_optionalChain([block, 'access', _512 => _512.text, 'optionalAccess', _513 => _513.trim, 'call', _514 => _514()]), () => ( ""))) && stack.some((s) => aligned(s, block))) fragments.add(block);
11430
+ if (b.y >= bottom && b.y + b.height <= top && b.x + b.width >= right - em * 6 && b.x + b.width <= right - Math.max(em, b.height) && /^[\p{L}\p{N}]$/u.test(_nullishCoalesce(_optionalChain([block, 'access', _522 => _522.text, 'optionalAccess', _523 => _523.trim, 'call', _524 => _524()]), () => ( ""))) && stack.some((s) => aligned(s, block))) fragments.add(block);
11411
11431
  }
11412
11432
  }
11413
11433
  return fragments;
@@ -11514,4 +11534,4 @@ function rowParagraphs(block) {
11514
11534
 
11515
11535
 
11516
11536
  exports.DEFAULT_OCR_MODELS = DEFAULT_OCR_MODELS; exports.resolveOcrModels = resolveOcrModels; exports.handwritingFallbackModels = handwritingFallbackModels; exports.ocrSelectionKey = ocrSelectionKey; exports.ocrSourcePath = ocrSourcePath; exports.ensureOcrModelsFor = ensureOcrModelsFor; exports.ocrModelsCached = ocrModelsCached; exports.parseCharacterDict = parseCharacterDict; exports.grayCrop = grayCrop; exports.inkStats = inkStats; exports.splitRowBands = splitRowBands; exports.leadingTriangle = leadingTriangle; exports.arrowGlyph = arrowGlyph; exports.leaderRuns = leaderRuns; exports.inkBounds = inkBounds; exports.bracketFeatures = bracketFeatures; exports.slantedPair = slantedPair; exports.romanStems = romanStems; exports.circledAt = circledAt; exports.ringBoxes = ringBoxes; exports.quoteHead = quoteHead; exports.edgeTrim = edgeTrim; exports.tallInkCount = tallInkCount; exports.gapGlyphs = gapGlyphs; exports.ringBullet = ringBullet; exports.dashRatio = dashRatio; exports.leadingRing = leadingRing; exports.discAt = discAt; exports.serifOne = serifOne; exports.starRun = starRun; exports.bracketShape = bracketShape; exports.leadingBullet = leadingBullet; exports.stackedGlyphBands = stackedGlyphBands; exports.rememberOcrTextGaps = rememberOcrTextGaps; exports.copyOcrTextGaps = copyOcrTextGaps; exports.findOcrTextGaps = findOcrTextGaps; exports.extractLines = extractLines; exports.extractImageRegions = extractImageRegions; exports.NO_EDGES = NO_EDGES; exports.hasOpenCellSeam = hasOpenCellSeam; exports.joinCellEdges = joinCellEdges; exports.filterHiddenText = filterHiddenText; exports.collapseEvenSpacing = collapseEvenSpacing; exports.computeBBox = computeBBox; exports.dominantStyle = dominantStyle; exports.normalizeItems = normalizeItems; exports.groupByY = groupByY; exports.mergeLineSimple = mergeLineSimple; exports.WrapLexicon = WrapLexicon; exports.startsNewItem = startsNewItem; exports.wrapJoiner = wrapJoiner; exports.joinPageBreakWraps = joinPageBreakWraps; exports.splitPageBreakWraps = splitPageBreakWraps; exports.latinSoftWrap = latinSoftWrap; exports.TOC_BLOCKS = TOC_BLOCKS; exports.computeMedianFontSizeFromFreq = computeMedianFontSizeFromFreq; exports.detectHeadings = detectHeadings; exports.mergeStackedHeadingLines = mergeStackedHeadingLines; exports.detectTypographyHeadings = detectTypographyHeadings; exports.detectDocumentStyleHeadings = detectDocumentStyleHeadings; exports.detectSiblingStyleHeadings = detectSiblingStyleHeadings; exports.detectRepeatedPageLabels = detectRepeatedPageLabels; exports.detectPageLeadHeadings = detectPageLeadHeadings; exports.refineDocumentStyleHeadings = refineDocumentStyleHeadings; exports.detectMarkerHeadings = detectMarkerHeadings; exports.detectTableCaptions = detectTableCaptions; exports.detectKoreanListBlocks = detectKoreanListBlocks; exports.removeHeaderFooterBlocks = removeHeaderFooterBlocks; exports.runningLinePatterns = runningLinePatterns; exports.stripAbsorbedRunningLines = stripAbsorbedRunningLines; exports.CLIP_TABLES = CLIP_TABLES; exports.FRAME_TITLE_BLOCKS = FRAME_TITLE_BLOCKS; exports.TABLE_COLXS = TABLE_COLXS; exports.TABLE_ROWYS = TABLE_ROWYS; exports.TABLE_TAIL = TABLE_TAIL; exports.PART_COLXS = PART_COLXS; exports.EMPTY_PARTS = EMPTY_PARTS; exports.IMAGE_CELLS = IMAGE_CELLS; exports.FILLER_CELLS = FILLER_CELLS; exports.CONT_PARTS = CONT_PARTS; exports.CELL_LINES = CELL_LINES; exports.ROW_RULES = ROW_RULES; exports.trimTrailingEmptyTableCols = trimTrailingEmptyTableCols; exports.restoreImageBullets = restoreImageBullets; exports.detectRightArrowRegions = detectRightArrowRegions; exports.removeSideTabs = removeSideTabs; exports.extractPageBlocksWithLines = extractPageBlocksWithLines; exports.UNRULED_REGION_TABLES = UNRULED_REGION_TABLES; exports.mergeOcrImageRegions = mergeOcrImageRegions;
11517
- //# sourceMappingURL=chunk-H2VOH7X3.cjs.map
11537
+ //# sourceMappingURL=chunk-OOD35TZR.cjs.map