kordoc 4.22.5 → 4.22.7

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 (151) hide show
  1. package/NOTICE +23 -0
  2. package/README.md +12 -10
  3. package/dist/{-WFRWBH7T.js → -O7EP5UQ2.js} +12 -12
  4. package/dist/{chunk-DN55FTJP.js → chunk-5S4UCIGP.js} +2 -2
  5. package/dist/{chunk-63N6CEJE.js → chunk-5VCZDP2K.js} +2 -2
  6. package/dist/{chunk-35ZHXEJA.js → chunk-6U2O5LAV.js} +3 -3
  7. package/dist/{chunk-TOUJCO2P.js → chunk-BFAYABLC.js} +120 -28
  8. package/dist/chunk-BFAYABLC.js.map +1 -0
  9. package/dist/{chunk-CW67DAAH.js → chunk-BHSATDA7.js} +12 -3
  10. package/dist/chunk-BHSATDA7.js.map +1 -0
  11. package/dist/{chunk-PSORL4PA.js → chunk-BIF35Q4D.js} +21 -16
  12. package/dist/chunk-BIF35Q4D.js.map +1 -0
  13. package/dist/{chunk-BHVOY6V4.js → chunk-BYMPPVT3.js} +9 -5
  14. package/dist/chunk-BYMPPVT3.js.map +1 -0
  15. package/dist/{chunk-LE4VHWIT.js → chunk-CEOOL37E.js} +4 -4
  16. package/dist/{chunk-4SUB43EJ.cjs → chunk-CIDWITQN.cjs} +24 -24
  17. package/dist/chunk-CIDWITQN.cjs.map +1 -0
  18. package/dist/{chunk-RYKDIUHT.js → chunk-CRMEBMMW.js} +5 -5
  19. package/dist/{chunk-52HIK4C2.js → chunk-CVKSBUIO.js} +4 -3
  20. package/dist/chunk-CVKSBUIO.js.map +1 -0
  21. package/dist/{chunk-U3GUZQ54.js → chunk-D4YBFNWK.js} +35 -75
  22. package/dist/chunk-D4YBFNWK.js.map +1 -0
  23. package/dist/{chunk-4TWN7PWJ.js → chunk-DFBGN2TG.js} +2 -2
  24. package/dist/{chunk-HLPMC7L4.js → chunk-DLAPQKGK.js} +13 -5
  25. package/dist/chunk-DLAPQKGK.js.map +1 -0
  26. package/dist/{chunk-C3REGEQO.js → chunk-DXJRDFCT.js} +2 -2
  27. package/dist/{chunk-C3REGEQO.js.map → chunk-DXJRDFCT.js.map} +1 -1
  28. package/dist/{chunk-UCK6WGHY.cjs → chunk-F537QK7M.cjs} +3 -3
  29. package/dist/chunk-F537QK7M.cjs.map +1 -0
  30. package/dist/{chunk-AS25R4EU.cjs → chunk-FJ45NNLA.cjs} +2 -2
  31. package/dist/chunk-FJ45NNLA.cjs.map +1 -0
  32. package/dist/chunk-GS7T56RP.cjs.map +1 -1
  33. package/dist/chunk-J55UQC5H.cjs.map +1 -1
  34. package/dist/{chunk-3G3TLZDK.js → chunk-OTCH63U3.js} +2 -2
  35. package/dist/{chunk-6MQKNB6K.js → chunk-PILIRK7O.js} +3 -3
  36. package/dist/{chunk-CRSTBATY.js → chunk-QYFBXJGK.js} +2 -2
  37. package/dist/{chunk-C6B5GWN7.cjs → chunk-R3T4RTQL.cjs} +183 -175
  38. package/dist/chunk-R3T4RTQL.cjs.map +1 -0
  39. package/dist/{chunk-SETAYS6P.js → chunk-RHHRVPLL.js} +2 -2
  40. package/dist/{chunk-YG4GFQB7.cjs → chunk-S34OVRKD.cjs} +125 -33
  41. package/dist/chunk-S34OVRKD.cjs.map +1 -0
  42. package/dist/chunk-TK3FDAEE.cjs.map +1 -1
  43. package/dist/{chunk-N6KXGIIN.cjs → chunk-TN4SSNES.cjs} +3 -3
  44. package/dist/chunk-TN4SSNES.cjs.map +1 -0
  45. package/dist/{chunk-3BR7VKWL.js → chunk-V2SJJHJH.js} +112 -24
  46. package/dist/chunk-V2SJJHJH.js.map +1 -0
  47. package/dist/{chunk-6MCC2XNB.js → chunk-VYH2ATWU.js} +2 -2
  48. package/dist/{chunk-2L3Q7REU.js → chunk-WBR62IXV.js} +3 -3
  49. package/dist/{chunk-3YEL7P4L.js → chunk-YVRARYLN.js} +2 -2
  50. package/dist/{chunk-T7OZ7X6A.js → chunk-ZNSWN4JM.js} +2 -2
  51. package/dist/{chunk-CO7O3ZT6.js → chunk-ZW3RY4YT.js} +2 -2
  52. package/dist/chunks-MPPNEL5A.js +10 -0
  53. package/dist/cli.js +33 -33
  54. package/dist/cli.js.map +1 -1
  55. package/dist/{formula-QZGTF3DZ.cjs → formula-3M6U2J7S.cjs} +9 -9
  56. package/dist/formula-3M6U2J7S.cjs.map +1 -0
  57. package/dist/{formula-FSVHUQ6Y.js → formula-EQ2KQA5T.js} +4 -4
  58. package/dist/{formula-L625ULJP.js → formula-RH55FUJF.js} +3 -3
  59. package/dist/{image-ocr-AELVAU75.cjs → image-ocr-DP4YTLGN.cjs} +17 -17
  60. package/dist/image-ocr-DP4YTLGN.cjs.map +1 -0
  61. package/dist/{image-ocr-QTZNBP5V.js → image-ocr-KIKAO43E.js} +10 -10
  62. package/dist/{image-ocr-KE3RUS3R.js → image-ocr-LO2GZKA5.js} +6 -6
  63. package/dist/index.cjs +492 -522
  64. package/dist/index.cjs.map +1 -1
  65. package/dist/index.d.cts +4 -2
  66. package/dist/index.d.ts +4 -2
  67. package/dist/index.js +41 -71
  68. package/dist/index.js.map +1 -1
  69. package/dist/mcp.js +23 -23
  70. package/dist/{model-bundle-F6TU6ZAV.js → model-bundle-EAQ6LWS5.js} +5 -5
  71. package/dist/{models-ZHNNVH2W.js → models-ZN6JAI4Q.js} +7 -5
  72. package/dist/page-range-QHHFTL7X.cjs.map +1 -1
  73. package/dist/{parse-worker-v2-KQRG3NQO.js → parse-worker-v2-UKFFINUH.js} +14 -14
  74. package/dist/parse-worker-v2-UKFFINUH.js.map +1 -0
  75. package/dist/{parser-WNDH2X6N.cjs → parser-CGKXEB3U.cjs} +592 -173
  76. package/dist/parser-CGKXEB3U.cjs.map +1 -0
  77. package/dist/{parser-RVMH4PUB.js → parser-DFV3VDWX.js} +452 -33
  78. package/dist/parser-DFV3VDWX.js.map +1 -0
  79. package/dist/{parser-WBKVRDPV.js → parser-TJFS44BI.js} +447 -28
  80. package/dist/parser-TJFS44BI.js.map +1 -0
  81. package/dist/{pdf-ocr-X5XLGL5J.js → pdf-ocr-CATVQJ2I.js} +6 -6
  82. package/dist/{pdf-ocr-ZP2CUWSO.js → pdf-ocr-EQXJAKHB.js} +10 -10
  83. package/dist/pdf-ocr-U5MFMNCW.cjs +31 -0
  84. package/dist/pdf-ocr-U5MFMNCW.cjs.map +1 -0
  85. package/dist/{profile-io-B4VSI4LW.js → profile-io-5IG6SSMK.js} +3 -3
  86. package/dist/{rasterize-Y7NVUVXU.js → rasterize-W4TJFQBT.js} +3 -3
  87. package/dist/{redact-doc-GIBTFWCO.js → redact-doc-LZ3PY2LX.js} +12 -12
  88. package/dist/{render-JVCGYRRO.js → render-N2QA335I.js} +7 -7
  89. package/dist/seal-FYJZMW4G.js +10 -0
  90. package/dist/{setup-7L7EQPMG.js → setup-5Y2UAWZG.js} +3 -3
  91. package/dist/visual-VQGE67RU.js +21 -0
  92. package/dist/{watch-VYMFGX72.js → watch-2MLCRQZQ.js} +13 -13
  93. package/package.json +1 -1
  94. package/dist/chunk-3BR7VKWL.js.map +0 -1
  95. package/dist/chunk-4SUB43EJ.cjs.map +0 -1
  96. package/dist/chunk-52HIK4C2.js.map +0 -1
  97. package/dist/chunk-AS25R4EU.cjs.map +0 -1
  98. package/dist/chunk-BHVOY6V4.js.map +0 -1
  99. package/dist/chunk-C6B5GWN7.cjs.map +0 -1
  100. package/dist/chunk-CW67DAAH.js.map +0 -1
  101. package/dist/chunk-HLPMC7L4.js.map +0 -1
  102. package/dist/chunk-N6KXGIIN.cjs.map +0 -1
  103. package/dist/chunk-PSORL4PA.js.map +0 -1
  104. package/dist/chunk-TOUJCO2P.js.map +0 -1
  105. package/dist/chunk-U3GUZQ54.js.map +0 -1
  106. package/dist/chunk-UCK6WGHY.cjs.map +0 -1
  107. package/dist/chunk-YG4GFQB7.cjs.map +0 -1
  108. package/dist/chunks-NXABWR6G.js +0 -10
  109. package/dist/formula-QZGTF3DZ.cjs.map +0 -1
  110. package/dist/image-ocr-AELVAU75.cjs.map +0 -1
  111. package/dist/parse-worker-v2-KQRG3NQO.js.map +0 -1
  112. package/dist/parser-RVMH4PUB.js.map +0 -1
  113. package/dist/parser-WBKVRDPV.js.map +0 -1
  114. package/dist/parser-WNDH2X6N.cjs.map +0 -1
  115. package/dist/pdf-ocr-IOUZTPPH.cjs +0 -31
  116. package/dist/pdf-ocr-IOUZTPPH.cjs.map +0 -1
  117. package/dist/seal-WNX2ZJTK.js +0 -10
  118. package/dist/visual-VPWPXIHN.js +0 -21
  119. /package/dist/{-WFRWBH7T.js.map → -O7EP5UQ2.js.map} +0 -0
  120. /package/dist/{chunk-DN55FTJP.js.map → chunk-5S4UCIGP.js.map} +0 -0
  121. /package/dist/{chunk-63N6CEJE.js.map → chunk-5VCZDP2K.js.map} +0 -0
  122. /package/dist/{chunk-35ZHXEJA.js.map → chunk-6U2O5LAV.js.map} +0 -0
  123. /package/dist/{chunk-LE4VHWIT.js.map → chunk-CEOOL37E.js.map} +0 -0
  124. /package/dist/{chunk-RYKDIUHT.js.map → chunk-CRMEBMMW.js.map} +0 -0
  125. /package/dist/{chunk-4TWN7PWJ.js.map → chunk-DFBGN2TG.js.map} +0 -0
  126. /package/dist/{chunk-3G3TLZDK.js.map → chunk-OTCH63U3.js.map} +0 -0
  127. /package/dist/{chunk-6MQKNB6K.js.map → chunk-PILIRK7O.js.map} +0 -0
  128. /package/dist/{chunk-CRSTBATY.js.map → chunk-QYFBXJGK.js.map} +0 -0
  129. /package/dist/{chunk-SETAYS6P.js.map → chunk-RHHRVPLL.js.map} +0 -0
  130. /package/dist/{chunk-6MCC2XNB.js.map → chunk-VYH2ATWU.js.map} +0 -0
  131. /package/dist/{chunk-2L3Q7REU.js.map → chunk-WBR62IXV.js.map} +0 -0
  132. /package/dist/{chunk-3YEL7P4L.js.map → chunk-YVRARYLN.js.map} +0 -0
  133. /package/dist/{chunk-T7OZ7X6A.js.map → chunk-ZNSWN4JM.js.map} +0 -0
  134. /package/dist/{chunk-CO7O3ZT6.js.map → chunk-ZW3RY4YT.js.map} +0 -0
  135. /package/dist/{chunks-NXABWR6G.js.map → chunks-MPPNEL5A.js.map} +0 -0
  136. /package/dist/{formula-FSVHUQ6Y.js.map → formula-EQ2KQA5T.js.map} +0 -0
  137. /package/dist/{formula-L625ULJP.js.map → formula-RH55FUJF.js.map} +0 -0
  138. /package/dist/{image-ocr-QTZNBP5V.js.map → image-ocr-KIKAO43E.js.map} +0 -0
  139. /package/dist/{image-ocr-KE3RUS3R.js.map → image-ocr-LO2GZKA5.js.map} +0 -0
  140. /package/dist/{model-bundle-F6TU6ZAV.js.map → model-bundle-EAQ6LWS5.js.map} +0 -0
  141. /package/dist/{models-ZHNNVH2W.js.map → models-ZN6JAI4Q.js.map} +0 -0
  142. /package/dist/{pdf-ocr-X5XLGL5J.js.map → pdf-ocr-CATVQJ2I.js.map} +0 -0
  143. /package/dist/{pdf-ocr-ZP2CUWSO.js.map → pdf-ocr-EQXJAKHB.js.map} +0 -0
  144. /package/dist/{profile-io-B4VSI4LW.js.map → profile-io-5IG6SSMK.js.map} +0 -0
  145. /package/dist/{rasterize-Y7NVUVXU.js.map → rasterize-W4TJFQBT.js.map} +0 -0
  146. /package/dist/{redact-doc-GIBTFWCO.js.map → redact-doc-LZ3PY2LX.js.map} +0 -0
  147. /package/dist/{render-JVCGYRRO.js.map → render-N2QA335I.js.map} +0 -0
  148. /package/dist/{seal-WNX2ZJTK.js.map → seal-FYJZMW4G.js.map} +0 -0
  149. /package/dist/{setup-7L7EQPMG.js.map → setup-5Y2UAWZG.js.map} +0 -0
  150. /package/dist/{visual-VPWPXIHN.js.map → visual-VQGE67RU.js.map} +0 -0
  151. /package/dist/{watch-VYMFGX72.js.map → watch-2MLCRQZQ.js.map} +0 -0
@@ -4,15 +4,15 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkYG4GFQB7cjs = require('./chunk-YG4GFQB7.cjs');
7
+ var _chunkS34OVRKDcjs = require('./chunk-S34OVRKD.cjs');
8
8
 
9
9
 
10
10
 
11
- var _chunkUCK6WGHYcjs = require('./chunk-UCK6WGHY.cjs');
11
+ var _chunkF537QK7Mcjs = require('./chunk-F537QK7M.cjs');
12
12
 
13
13
 
14
14
 
15
- var _chunkAS25R4EUcjs = require('./chunk-AS25R4EU.cjs');
15
+ var _chunkFJ45NNLAcjs = require('./chunk-FJ45NNLA.cjs');
16
16
 
17
17
  // src/ocr/models.ts
18
18
  var _path = require('path');
@@ -40,6 +40,14 @@ var OCR_REC_MODEL = {
40
40
  sha256: "92f0b7785e64fc9090106a241cf4c1eb97472824558272751b88a2a4476d3a08",
41
41
  sizeMb: 13
42
42
  };
43
+ var OCR_HANDWRITING_REC_MODEL = {
44
+ name: "Korean handwriting rec",
45
+ filename: "rec_korean_hw.onnx",
46
+ url: "https://huggingface.co/Rebeccaaaaaaaa/korean-handwriting-rec/resolve/bb4c2714cf6b05e5d13bfe22199d0e6d30866597/model/rec_korean_hw.onnx",
47
+ sha256: "1655d6abd17989f1922855dd77922e532e74275fe237e5f07174b623993fef81",
48
+ sizeMb: 15,
49
+ offlineHint: "\uC628\uB77C\uC778 PC\uC5D0\uC11C \uBC1B\uC740 \uD30C\uC77C\uC744 \uC774 PC \uBAA8\uB378 \uCE90\uC2DC\uC758 ppocr/rec_korean_hw.onnx \uB85C \uBC18\uC785\uD558\uAC70\uB098(SHA-256 \uC744 \uAC80\uC99D\uD55C\uB2E4), ocrRec \uC5D0 \uB85C\uCEEC \uD30C\uC77C {path, sha256} \uC744 \uC9C0\uC815\uD558\uC138\uC694"
50
+ };
43
51
  var OCR_REC_DICT = {
44
52
  name: "PP-OCRv5 korean dict",
45
53
  filename: "rec_korean.yml",
@@ -48,7 +56,7 @@ var OCR_REC_DICT = {
48
56
  sizeMb: 1
49
57
  };
50
58
  function getOcrModelsDir() {
51
- return _chunkUCK6WGHYcjs.getModelsDir.call(void 0, "ppocr");
59
+ return _chunkF537QK7Mcjs.getModelsDir.call(void 0, "ppocr");
52
60
  }
53
61
  var DEFAULT_OCR_MODELS = Object.freeze({
54
62
  det: { spec: OCR_DET_MODEL },
@@ -60,8 +68,8 @@ function resolveOcrModels(o) {
60
68
  const det = _optionalChain([o, 'optionalAccess', _3 => _3.ocrDet]);
61
69
  return {
62
70
  det: det === void 0 || det === "mobile" ? DEFAULT_OCR_MODELS.det : det === "server" ? { spec: OCR_SERVER_DET_MODEL } : file(det),
63
- rec: _optionalChain([o, 'optionalAccess', _4 => _4.ocrRec]) ? file(o.ocrRec) : DEFAULT_OCR_MODELS.rec,
64
- dict: _optionalChain([o, 'optionalAccess', _5 => _5.ocrRecDict]) ? file(o.ocrRecDict) : DEFAULT_OCR_MODELS.dict
71
+ rec: _optionalChain([o, 'optionalAccess', _4 => _4.ocrRec]) === "handwriting" ? { spec: OCR_HANDWRITING_REC_MODEL } : _optionalChain([o, 'optionalAccess', _5 => _5.ocrRec]) ? file(o.ocrRec) : DEFAULT_OCR_MODELS.rec,
72
+ dict: _optionalChain([o, 'optionalAccess', _6 => _6.ocrRecDict]) ? file(o.ocrRecDict) : DEFAULT_OCR_MODELS.dict
65
73
  };
66
74
  }
67
75
  function ocrSelectionKey(sel) {
@@ -90,7 +98,7 @@ async function ensureOcrModelsFor(sel, onProgress) {
90
98
  if (!stamp || verifiedInProcess.get(path) !== stamp) todo.push(s.spec);
91
99
  }
92
100
  if (!todo.length) return;
93
- await _chunkUCK6WGHYcjs.ensureModelsIn.call(void 0, dir, todo, onProgress);
101
+ await _chunkF537QK7Mcjs.ensureModelsIn.call(void 0, dir, todo, onProgress);
94
102
  for (const spec of todo) {
95
103
  const path = _path.join.call(void 0, dir, spec.filename), stamp = await fileStamp(path);
96
104
  if (stamp) verifiedInProcess.set(path, stamp);
@@ -360,7 +368,7 @@ function extractLines(fnArray, argsArray) {
360
368
  } else {
361
369
  const afterOp = arg0;
362
370
  const dataArr = args[1];
363
- const pathData = _optionalChain([dataArr, 'optionalAccess', _6 => _6[0]]);
371
+ const pathData = _optionalChain([dataArr, 'optionalAccess', _7 => _7[0]]);
364
372
  if (pathData && typeof pathData === "object") {
365
373
  const len = Object.keys(pathData).length;
366
374
  let di = 0;
@@ -738,7 +746,7 @@ function mergeParallelLines(lines, dir, nonRules) {
738
746
  const overlap2 = Math.min(prevEnd, currEnd) - Math.max(prevStart, currStart);
739
747
  const minLen = Math.min(prevEnd - prevStart, currEnd - currStart);
740
748
  if (overlap2 > minLen * 0.3) {
741
- if (_optionalChain([nonRules, 'optionalAccess', _7 => _7.has, 'call', _8 => _8(prev)]) && !nonRules.has(curr)) nonRules.delete(prev);
749
+ if (_optionalChain([nonRules, 'optionalAccess', _8 => _8.has, 'call', _9 => _9(prev)]) && !nonRules.has(curr)) nonRules.delete(prev);
742
750
  if (dir === "h") {
743
751
  prev.x1 = Math.min(prev.x1, curr.x1);
744
752
  prev.x2 = Math.max(prev.x2, curr.x2);
@@ -806,8 +814,8 @@ function extractImageRegions(fnArray, argsArray, respectClip = false) {
806
814
  break;
807
815
  case _pdfmjs.OPS.restore: {
808
816
  const state = stack.pop();
809
- ctm = _nullishCoalesce(_optionalChain([state, 'optionalAccess', _9 => _9.ctm]), () => ( [1, 0, 0, 1, 0, 0]));
810
- clip = _nullishCoalesce(_optionalChain([state, 'optionalAccess', _10 => _10.clip]), () => ( null));
817
+ ctm = _nullishCoalesce(_optionalChain([state, 'optionalAccess', _10 => _10.ctm]), () => ( [1, 0, 0, 1, 0, 0]));
818
+ clip = _nullishCoalesce(_optionalChain([state, 'optionalAccess', _11 => _11.clip]), () => ( null));
811
819
  break;
812
820
  }
813
821
  case _pdfmjs.OPS.transform: {
@@ -818,19 +826,19 @@ function extractImageRegions(fnArray, argsArray, respectClip = false) {
818
826
  // Form XObject 는 /Matrix 공간에서 그린다 — pdfjs 인자 [matrix, bbox], End 에서 복원 (line-extract.ts 와 같음)
819
827
  case _pdfmjs.OPS.paintFormXObjectBegin: {
820
828
  stack.push({ ctm, clip });
821
- const m = _optionalChain([argsArray, 'access', _11 => _11[i], 'optionalAccess', _12 => _12[0]]);
829
+ const m = _optionalChain([argsArray, 'access', _12 => _12[i], 'optionalAccess', _13 => _13[0]]);
822
830
  if (Array.isArray(m) && m.length >= 6) ctm = multiplyTransform(ctm, m);
823
831
  break;
824
832
  }
825
833
  case _pdfmjs.OPS.paintFormXObjectEnd: {
826
834
  const state = stack.pop();
827
- ctm = _nullishCoalesce(_optionalChain([state, 'optionalAccess', _13 => _13.ctm]), () => ( [1, 0, 0, 1, 0, 0]));
828
- clip = _nullishCoalesce(_optionalChain([state, 'optionalAccess', _14 => _14.clip]), () => ( null));
835
+ ctm = _nullishCoalesce(_optionalChain([state, 'optionalAccess', _14 => _14.ctm]), () => ( [1, 0, 0, 1, 0, 0]));
836
+ clip = _nullishCoalesce(_optionalChain([state, 'optionalAccess', _15 => _15.clip]), () => ( null));
829
837
  break;
830
838
  }
831
839
  case _pdfmjs.OPS.constructPath: {
832
840
  const [ops, coords] = argsArray[i];
833
- pathRect = pathRect === void 0 && _optionalChain([ops, 'optionalAccess', _15 => _15.length]) === 1 && ops[0] === _pdfmjs.OPS.rectangle && _optionalChain([coords, 'optionalAccess', _16 => _16.length]) >= 4 ? transformedRect(ctm, coords[0], coords[1], coords[2], coords[3]) : null;
841
+ pathRect = pathRect === void 0 && _optionalChain([ops, 'optionalAccess', _16 => _16.length]) === 1 && ops[0] === _pdfmjs.OPS.rectangle && _optionalChain([coords, 'optionalAccess', _17 => _17.length]) >= 4 ? transformedRect(ctm, coords[0], coords[1], coords[2], coords[3]) : null;
834
842
  break;
835
843
  }
836
844
  case _pdfmjs.OPS.clip:
@@ -978,7 +986,7 @@ function hasShadedRowBands(host, clips, fills, verticals, horizontals) {
978
986
  if (!host.colXs.slice(1, -1).every((x) => verticals.some((v) => !v.fromFill && near2(v.x1, x) && v.y1 <= host.bbox.y1 + tol && v.y2 >= host.bbox.y2 - tol))) return false;
979
987
  const covered = /* @__PURE__ */ new Set();
980
988
  for (const band of bands) {
981
- if (band.clipParent || !_optionalChain([band, 'access', _17 => _17.cells, 'optionalAccess', _18 => _18.length]) || band.colXs.length !== host.colXs.length || !band.colXs.every((x, i) => near2(x, host.colXs[i]))) return false;
989
+ if (band.clipParent || !_optionalChain([band, 'access', _18 => _18.cells, 'optionalAccess', _19 => _19.length]) || band.colXs.length !== host.colXs.length || !band.colXs.every((x, i) => near2(x, host.colXs[i]))) return false;
982
990
  const start = host.rowYs.findIndex((y) => near2(y, band.rowYs[0]));
983
991
  if (start < 0 || !band.rowYs.every((y, i) => near2(y, host.rowYs[start + i]))) return false;
984
992
  if (!band.rowYs.every((y) => horizontals.some((h) => !h.fromFill && near2(h.y1, y) && h.x1 <= host.bbox.x1 + tol && h.x2 >= host.bbox.x2 - tol))) return false;
@@ -1080,7 +1088,7 @@ function mergeVertices(vertices) {
1080
1088
  const candidates = [];
1081
1089
  for (let dx = -1; dx <= 1; dx++) {
1082
1090
  for (let dy = -1; dy <= 1; dy++) {
1083
- const arr = _optionalChain([buckets, 'access', _19 => _19.get, 'call', _20 => _20(cx + dx), 'optionalAccess', _21 => _21.get, 'call', _22 => _22(cy + dy)]);
1091
+ const arr = _optionalChain([buckets, 'access', _20 => _20.get, 'call', _21 => _21(cx + dx), 'optionalAccess', _22 => _22.get, 'call', _23 => _23(cy + dy)]);
1084
1092
  if (!arr) continue;
1085
1093
  for (const j of arr) {
1086
1094
  if (j > i && !used[j]) candidates.push(j);
@@ -1207,7 +1215,7 @@ function dropShadingClipGrids(clipGrids, lineGrids, fillRects, verticals = [], h
1207
1215
  const area = (b) => Math.max(0, b.x2 - b.x1) * Math.max(0, b.y2 - b.y1);
1208
1216
  const inter = (a, b) => area({ x1: Math.max(a.x1, b.x1), y1: Math.max(a.y1, b.y1), x2: Math.min(a.x2, b.x2), y2: Math.min(a.y2, b.y2) });
1209
1217
  return clipGrids.filter((c) => {
1210
- if (!_optionalChain([c, 'access', _23 => _23.cells, 'optionalAccess', _24 => _24.length]) || c.clipParent) return true;
1218
+ if (!_optionalChain([c, 'access', _24 => _24.cells, 'optionalAccess', _25 => _25.length]) || c.clipParent) return true;
1211
1219
  const sourceCells = c.cells.filter((cell) => !cell.filler);
1212
1220
  if (sourceCells.length === 0) return true;
1213
1221
  const shaded = sourceCells.every((cell) => fillRects.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)));
@@ -1217,7 +1225,7 @@ function dropShadingClipGrids(clipGrids, lineGrids, fillRects, verticals = [], h
1217
1225
  const host = lineGrids.find((l) => (
1218
1226
  // Inferred filler cells carry no boundary evidence. Replace their frame only
1219
1227
  // with a finer ruled grid of the same extent, never a larger surrounding form.
1220
- (!c.cells.some((cell) => cell.filler) || near2(c.bbox.x1, l.bbox.x1) && near2(c.bbox.x2, l.bbox.x2) && near2(c.bbox.y1, l.bbox.y1) && near2(c.bbox.y2, l.bbox.y2) && l.rowYs.length > c.rowYs.length && sourceCells.every((cell) => [cell.bbox.y1, cell.bbox.y2].every((y) => l.rowYs.some((ly) => near2(y, ly))))) && c.bbox.x1 >= l.bbox.x1 - SHADE_CLIP_TOL && c.bbox.x2 <= l.bbox.x2 + SHADE_CLIP_TOL && c.bbox.y1 >= l.bbox.y1 - SHADE_CLIP_TOL && c.bbox.y2 <= l.bbox.y2 + SHADE_CLIP_TOL && c.colXs.every((x) => l.colXs.some((lx) => near2(lx, x))) && (clipGrids.reduce((s, o) => s + (_optionalChain([o, 'access', _25 => _25.cells, 'optionalAccess', _26 => _26.some, 'call', _27 => _27((cell) => cell.filler)]) ? o.cells.filter((cell) => !cell.filler).reduce((a, cell) => a + inter(cell.bbox, l.bbox), 0) : inter(o.bbox, l.bbox)), 0) <= area(l.bbox) * SHADE_CLIP_MAX_AREA || l.rowYs.length === c.rowYs.length + 1 && c.rowYs.every((y, i) => near2(y, l.rowYs[i])) && l.colXs.length === c.colXs.length && c.colXs.every((x, i) => near2(x, l.colXs[i])) && !clipGrids.some((o) => o !== c && inter(o.bbox, l.bbox) > 0) || hasShadedRowBands(l, clipGrids, fillRects, verticals, horizontals))
1228
+ (!c.cells.some((cell) => cell.filler) || near2(c.bbox.x1, l.bbox.x1) && near2(c.bbox.x2, l.bbox.x2) && near2(c.bbox.y1, l.bbox.y1) && near2(c.bbox.y2, l.bbox.y2) && l.rowYs.length > c.rowYs.length && sourceCells.every((cell) => [cell.bbox.y1, cell.bbox.y2].every((y) => l.rowYs.some((ly) => near2(y, ly))))) && c.bbox.x1 >= l.bbox.x1 - SHADE_CLIP_TOL && c.bbox.x2 <= l.bbox.x2 + SHADE_CLIP_TOL && c.bbox.y1 >= l.bbox.y1 - SHADE_CLIP_TOL && c.bbox.y2 <= l.bbox.y2 + SHADE_CLIP_TOL && c.colXs.every((x) => l.colXs.some((lx) => near2(lx, x))) && (clipGrids.reduce((s, o) => s + (_optionalChain([o, 'access', _26 => _26.cells, 'optionalAccess', _27 => _27.some, 'call', _28 => _28((cell) => cell.filler)]) ? o.cells.filter((cell) => !cell.filler).reduce((a, cell) => a + inter(cell.bbox, l.bbox), 0) : inter(o.bbox, l.bbox)), 0) <= area(l.bbox) * SHADE_CLIP_MAX_AREA || l.rowYs.length === c.rowYs.length + 1 && c.rowYs.every((y, i) => near2(y, l.rowYs[i])) && l.colXs.length === c.colXs.length && c.colXs.every((x, i) => near2(x, l.colXs[i])) && !clipGrids.some((o) => o !== c && inter(o.bbox, l.bbox) > 0) || hasShadedRowBands(l, clipGrids, fillRects, verticals, horizontals))
1221
1229
  ));
1222
1230
  return !host;
1223
1231
  });
@@ -1232,7 +1240,7 @@ function dropHeadBandClipGrids(clipGrids, lineGrids) {
1232
1240
  if (clipGrids.length === 0 || lineGrids.length === 0) return clipGrids;
1233
1241
  const near2 = (a, b) => Math.abs(a - b) <= SHADE_CLIP_TOL;
1234
1242
  const overlaps = (a, b) => Math.min(a.x2, b.x2) > Math.max(a.x1, b.x1) && Math.min(a.y2, b.y2) > Math.max(a.y1, b.y1);
1235
- return clipGrids.filter((c) => c.clipParent || !_optionalChain([c, 'access', _28 => _28.cells, 'optionalAccess', _29 => _29.length]) || !lineGrids.some((l) => l.rowYs.length > c.rowYs.length && 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])) && !clipGrids.some((o) => o !== c && overlaps(o.bbox, l.bbox))));
1243
+ return clipGrids.filter((c) => c.clipParent || !_optionalChain([c, 'access', _29 => _29.cells, 'optionalAccess', _30 => _30.length]) || !lineGrids.some((l) => l.rowYs.length > c.rowYs.length && 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])) && !clipGrids.some((o) => o !== c && overlaps(o.bbox, l.bbox))));
1236
1244
  }
1237
1245
  function enforceMinWidth(colXs, minWidth, narrowRuns = true) {
1238
1246
  if (colXs.length <= 2) return colXs;
@@ -1583,7 +1591,7 @@ function buildClipCellGrids(rects, strokedH, strokedV, pageWidth, pageHeight, te
1583
1591
  for (let dx = -1; dx <= 1 && !duplicate; dx++) {
1584
1592
  const ys2 = buckets.get(bx + dx);
1585
1593
  for (let dy = -1; dy <= 1 && !duplicate; dy++) {
1586
- duplicate = _nullishCoalesce(_optionalChain([ys2, 'optionalAccess', _30 => _30.get, 'call', _31 => _31(by + dy), 'optionalAccess', _32 => _32.some, 'call', _33 => _33((c) => sameRect(c, r))]), () => ( false));
1594
+ duplicate = _nullishCoalesce(_optionalChain([ys2, 'optionalAccess', _31 => _31.get, 'call', _32 => _32(by + dy), 'optionalAccess', _33 => _33.some, 'call', _34 => _34((c) => sameRect(c, r))]), () => ( false));
1587
1595
  }
1588
1596
  }
1589
1597
  if (duplicate) continue;
@@ -1731,7 +1739,7 @@ function buildClipCellGrids(rects, strokedH, strokedV, pageWidth, pageHeight, te
1731
1739
  else groups.set(r, [i]);
1732
1740
  }
1733
1741
  const containers = cells.filter((_, i) => isContainer[i]);
1734
- const groupSize = (i) => _nullishCoalesce(_optionalChain([groups, 'access', _34 => _34.get, 'call', _35 => _35(find(i)), 'optionalAccess', _36 => _36.length]), () => ( 0));
1742
+ const groupSize = (i) => _nullishCoalesce(_optionalChain([groups, 'access', _35 => _35.get, 'call', _36 => _36(find(i)), 'optionalAccess', _37 => _37.length]), () => ( 0));
1735
1743
  const isGridMember = (i) => groupSize(i) >= CLIP_MIN_GROUP;
1736
1744
  const framed = (r) => edgeStroked(strokedH, "h", r.y1, r.x1, r.x2) && edgeStroked(strokedH, "h", r.y2, r.x1, r.x2) && edgeStroked(strokedV, "v", r.x1, r.y1, r.y2) && edgeStroked(strokedV, "v", r.x2, r.y1, r.y2);
1737
1745
  const titledFrame = (r) => r.y1 >= pageHeight * TITLED_FRAME_MIN_TOP && r.x2 - r.x1 >= pageWidth * TITLED_FRAME_MIN_WIDTH && textPoints.some((p) => p.y < r.y1 && p.y > pageHeight * HEADER_BAND && p.x >= r.x1 - CLIP_EDGE_TOL && p.x <= r.x2 + CLIP_EDGE_TOL) && textPoints.some((p) => p.x > r.x1 && p.x < r.x2 && p.y > r.y1 && p.y < r.y2);
@@ -2109,8 +2117,8 @@ function childRules(r, grid) {
2109
2117
  }
2110
2118
  function recordClipCellEdges(grids, horizontals, verticals, nonRules) {
2111
2119
  if (!grids.some((g) => g.cells)) return;
2112
- const h = rules(_optionalChain([nonRules, 'optionalAccess', _37 => _37.size]) ? horizontals.filter((l) => !nonRules.has(l)) : horizontals, "h");
2113
- const v = rules(_optionalChain([nonRules, 'optionalAccess', _38 => _38.size]) ? verticals.filter((l) => !nonRules.has(l)) : verticals, "v");
2120
+ const h = rules(_optionalChain([nonRules, 'optionalAccess', _38 => _38.size]) ? horizontals.filter((l) => !nonRules.has(l)) : horizontals, "h");
2121
+ const v = rules(_optionalChain([nonRules, 'optionalAccess', _39 => _39.size]) ? verticals.filter((l) => !nonRules.has(l)) : verticals, "v");
2114
2122
  for (const g of grids) {
2115
2123
  if (!g.cells) continue;
2116
2124
  const ownH = childRules(h, g), ownV = childRules(v, g);
@@ -2126,9 +2134,9 @@ function recordOpenEndCellEdges(grid, cells, horizontals) {
2126
2134
  const end = horizontals.find((l) => OPEN_END_RULES.has(l) && Math.abs(l.y1 - b.y1) <= EDGE_NEAR2 && Math.abs(l.x1 - b.x1) <= EDGE_NEAR2 && Math.abs(l.x2 - b.x2) <= EDGE_NEAR2);
2127
2135
  const raw = end && OPEN_END_RULES.get(end);
2128
2136
  if (!raw) return;
2129
- const hs = raw.horizontals.filter((l) => !_optionalChain([raw, 'access', _39 => _39.nonRules, 'optionalAccess', _40 => _40.has, 'call', _41 => _41(l)]));
2137
+ const hs = raw.horizontals.filter((l) => !_optionalChain([raw, 'access', _40 => _40.nonRules, 'optionalAccess', _41 => _41.has, 'call', _42 => _42(l)]));
2130
2138
  if (hs.some((l) => Math.abs(l.y1 - b.y1) <= EDGE_NEAR2 && Math.min(l.x2, b.x2) - Math.max(l.x1, b.x1) > TIP_MAX)) return;
2131
- const h = rules(hs, "h"), v = rules(raw.verticals.filter((l) => !_optionalChain([raw, 'access', _42 => _42.nonRules, 'optionalAccess', _43 => _43.has, 'call', _44 => _44(l)])), "v");
2139
+ const h = rules(hs, "h"), v = rules(raw.verticals.filter((l) => !_optionalChain([raw, 'access', _43 => _43.nonRules, 'optionalAccess', _44 => _44.has, 'call', _45 => _45(l)])), "v");
2132
2140
  const edges = cells.map((c) => edgesOf(c.bbox, h, v));
2133
2141
  const last = grid.rowYs.length - 2;
2134
2142
  if (!cells.every((c, i) => {
@@ -2139,16 +2147,16 @@ function recordOpenEndCellEdges(grid, cells, horizontals) {
2139
2147
  }
2140
2148
  function takeClipCellEdges(from, to) {
2141
2149
  const e = CLIP_CELL_EDGES.get(from);
2142
- if (e) _chunkYG4GFQB7cjs.CELL_EDGES.set(to, e);
2150
+ if (e) _chunkS34OVRKDcjs.CELL_EDGES.set(to, e);
2143
2151
  }
2144
2152
  function hasOpenCellSeam(a, b) {
2145
- const u = _chunkYG4GFQB7cjs.CELL_EDGES.get(a), d = _chunkYG4GFQB7cjs.CELL_EDGES.get(b);
2153
+ const u = _chunkS34OVRKDcjs.CELL_EDGES.get(a), d = _chunkS34OVRKDcjs.CELL_EDGES.get(b);
2146
2154
  return !!u && !!d && u.t && !u.b && !d.t && d.b && u.l && u.r && d.l && d.r;
2147
2155
  }
2148
2156
  function joinCellEdges(a, b) {
2149
- const u = _chunkYG4GFQB7cjs.CELL_EDGES.get(a), d = _chunkYG4GFQB7cjs.CELL_EDGES.get(b);
2157
+ const u = _chunkS34OVRKDcjs.CELL_EDGES.get(a), d = _chunkS34OVRKDcjs.CELL_EDGES.get(b);
2150
2158
  if (!u || !d) return;
2151
- _chunkYG4GFQB7cjs.CELL_EDGES.set(a, { t: u.t, b: d.b, l: u.l || d.l, r: u.r || d.r });
2159
+ _chunkS34OVRKDcjs.CELL_EDGES.set(a, { t: u.t, b: d.b, l: u.l || d.l, r: u.r || d.r });
2152
2160
  }
2153
2161
 
2154
2162
  // src/pdf/cell-extract.ts
@@ -2324,7 +2332,7 @@ function tagScripts(text, lines) {
2324
2332
  const [s, e, kind] = marks[m];
2325
2333
  out = out.slice(0, s) + `<${kind}>` + out.slice(s, e) + `</${kind}>` + out.slice(e);
2326
2334
  }
2327
- return _chunkYG4GFQB7cjs.tidyScriptTags.call(void 0, out);
2335
+ return _chunkS34OVRKDcjs.tidyScriptTags.call(void 0, out);
2328
2336
  }
2329
2337
 
2330
2338
  // src/pdf/line-wrap.ts
@@ -2360,12 +2368,12 @@ var WrapLexicon = (_class = class {constructor() { _class.prototype.__init.call(
2360
2368
  const t = toks[i], n = t.length;
2361
2369
  if (i > 0 && i < toks.length - 1) {
2362
2370
  bump(this.words, t);
2363
- const run = _nullishCoalesce(_optionalChain([t, 'access', _45 => _45.match, 'call', _46 => _46(/^[가-힣]+/), 'optionalAccess', _47 => _47[0]]), () => ( ""));
2371
+ const run = _nullishCoalesce(_optionalChain([t, 'access', _46 => _46.match, 'call', _47 => _47(/^[가-힣]+/), 'optionalAccess', _48 => _48[0]]), () => ( ""));
2364
2372
  for (let j = 2; j <= Math.min(run.length, 6); j++) this.heads.add(run.slice(0, j));
2365
2373
  }
2366
2374
  if (i + 1 < toks.length) {
2367
2375
  this.pairs.add(t + " " + toks[i + 1]);
2368
- const tail = _optionalChain([t, 'access', _48 => _48.match, 'call', _49 => _49(/[가-힣]+$/), 'optionalAccess', _50 => _50[0]]);
2376
+ const tail = _optionalChain([t, 'access', _49 => _49.match, 'call', _50 => _50(/[가-힣]+$/), 'optionalAccess', _51 => _51[0]]);
2369
2377
  if (tail) this.spacedHeads.add(tail + " " + toks[i + 1].charAt(0));
2370
2378
  }
2371
2379
  for (let a = 0; a + 1 < n; a++) {
@@ -2402,14 +2410,14 @@ var WrapLexicon = (_class = class {constructor() { _class.prototype.__init.call(
2402
2410
  const n = left.length;
2403
2411
  if (n < 2 || right.length < 2) return null;
2404
2412
  const k1 = pairKey(left.charCodeAt(n - 2), left.charCodeAt(n - 1)), k2 = pairKey(right.charCodeAt(0), right.charCodeAt(1));
2405
- return decideCounts(_nullishCoalesce(_optionalChain([this, 'access', _51 => _51.joined2, 'access', _52 => _52.get, 'call', _53 => _53(k1), 'optionalAccess', _54 => _54.get, 'call', _55 => _55(k2)]), () => ( 0)), _nullishCoalesce(_optionalChain([this, 'access', _56 => _56.spaced2, 'access', _57 => _57.get, 'call', _58 => _58(k1), 'optionalAccess', _59 => _59.get, 'call', _60 => _60(k2)]), () => ( 0)));
2413
+ return decideCounts(_nullishCoalesce(_optionalChain([this, 'access', _52 => _52.joined2, 'access', _53 => _53.get, 'call', _54 => _54(k1), 'optionalAccess', _55 => _55.get, 'call', _56 => _56(k2)]), () => ( 0)), _nullishCoalesce(_optionalChain([this, 'access', _57 => _57.spaced2, 'access', _58 => _58.get, 'call', _59 => _59(k1), 'optionalAccess', _60 => _60.get, 'call', _61 => _61(k2)]), () => ( 0)));
2406
2414
  }
2407
2415
  /** 꺾인 자리 증거: "" 붙음 · " " 띄움 · null 모름 (두 글자 증거가 갈리거나 없으면 한 글자) */
2408
2416
  evidence(left, right) {
2409
2417
  const n = left.length;
2410
2418
  if (n >= 2 && right.length >= 2) {
2411
2419
  const k1 = pairKey(left.charCodeAt(n - 2), left.charCodeAt(n - 1)), k2 = pairKey(right.charCodeAt(0), right.charCodeAt(1));
2412
- const v = decideCounts(_nullishCoalesce(_optionalChain([this, 'access', _61 => _61.joined2, 'access', _62 => _62.get, 'call', _63 => _63(k1), 'optionalAccess', _64 => _64.get, 'call', _65 => _65(k2)]), () => ( 0)), _nullishCoalesce(_optionalChain([this, 'access', _66 => _66.spaced2, 'access', _67 => _67.get, 'call', _68 => _68(k1), 'optionalAccess', _69 => _69.get, 'call', _70 => _70(k2)]), () => ( 0)));
2420
+ const v = decideCounts(_nullishCoalesce(_optionalChain([this, 'access', _62 => _62.joined2, 'access', _63 => _63.get, 'call', _64 => _64(k1), 'optionalAccess', _65 => _65.get, 'call', _66 => _66(k2)]), () => ( 0)), _nullishCoalesce(_optionalChain([this, 'access', _67 => _67.spaced2, 'access', _68 => _68.get, 'call', _69 => _69(k1), 'optionalAccess', _70 => _70.get, 'call', _71 => _71(k2)]), () => ( 0)));
2413
2421
  if (v !== null) return v;
2414
2422
  }
2415
2423
  if (n && right.length) {
@@ -2484,11 +2492,11 @@ function wrapJoiner(prevText, nextText, lex, heads = true) {
2484
2492
  if (particleContinues(left, right)) return "";
2485
2493
  if (endsAsWord(left)) return " ";
2486
2494
  if (/[A-Za-z]-$/.test(left) && /^[A-Za-z]/.test(right) && !/[가-힣]/.test(prev + next)) {
2487
- return _optionalChain([lex, 'optionalAccess', _71 => _71.joinedWord, 'call', _72 => _72(left, right.replace(/[.,;:!?)]*$/, ""))]) ? "" : " ";
2495
+ return _optionalChain([lex, 'optionalAccess', _72 => _72.joinedWord, 'call', _73 => _73(left, right.replace(/[.,;:!?)]*$/, ""))]) ? "" : " ";
2488
2496
  }
2489
2497
  if (/[·ㆍ‧-]/.test(a) && !/[·ㆍ‧…]{2}$/.test(prev) && /[가-힣A-Za-z0-9]/.test(b)) return "";
2490
2498
  if (/[A-Za-z]/.test(a) && /[A-Za-z]/.test(b) || /\d/.test(a) && /\d/.test(b)) return " ";
2491
- const ev = _optionalChain([lex, 'optionalAccess', _73 => _73.evidence, 'call', _74 => _74(left, right)]);
2499
+ const ev = _optionalChain([lex, 'optionalAccess', _74 => _74.evidence, 'call', _75 => _75(left, right)]);
2492
2500
  if (ev != null) return ev;
2493
2501
  if (lex && /[가-힣A-Za-z0-9]$/.test(left) && /^[가-힣A-Za-z0-9]/.test(right) && lex.joinedWord(left, right.replace(/[.,)」』’”;:]+$/, ""))) return "";
2494
2502
  if (/\d$/.test(left) && COUNTER.test(right)) return "";
@@ -2496,7 +2504,7 @@ function wrapJoiner(prevText, nextText, lex, heads = true) {
2496
2504
  const r1 = right.replace(/[.,)」』’”]+$/, "");
2497
2505
  if (lex && /[가-힣]$/.test(left) && /^[가-힣]$/.test(r1) && !STANDALONE_SYLLABLE.test(r1) && !lex.isWord(r1) && !lex.isWord(right)) return "";
2498
2506
  if (lex && heads) {
2499
- const tail = _optionalChain([left, 'access', _75 => _75.match, 'call', _76 => _76(/[가-힣]+$/), 'optionalAccess', _77 => _77[0]]), run = _optionalChain([right, 'access', _78 => _78.match, 'call', _79 => _79(/^[가-힣]+/), 'optionalAccess', _80 => _80[0]]);
2507
+ const tail = _optionalChain([left, 'access', _76 => _76.match, 'call', _77 => _77(/[가-힣]+$/), 'optionalAccess', _78 => _78[0]]), run = _optionalChain([right, 'access', _79 => _79.match, 'call', _80 => _80(/^[가-힣]+/), 'optionalAccess', _81 => _81[0]]);
2500
2508
  if (tail && run && !STANDALONE_SYLLABLE.test(tail) && lex.startsWord(tail + run.slice(0, 2)) && !lex.spacedHead(tail, run[0])) return "";
2501
2509
  if (/[가-힣]{2}$/.test(left) && /^\([^()\s]*\)/.test(right) && !endsAsWord(left) && !/(?:함|음|됨|임|다)$/.test(left) && !BARE_UNIT_PAREN.test(right) && !/^\(\d/.test(right)) return "";
2502
2510
  }
@@ -2531,14 +2539,14 @@ function joinPageBreakWraps(blocks, lex) {
2531
2539
  if (a.type !== "paragraph" && a.type !== "list" || b.type !== "paragraph") continue;
2532
2540
  const last = a.bbox && PARA_LAST_LINE.get(a.bbox), fs = last ? last.fontSize : 0;
2533
2541
  if (!last || fs <= 0 || (_nullishCoalesce(pageRight.get(a.pageNumber), () => ( Infinity))) - last.right >= BODY_FULL_TOL * fs) continue;
2534
- if (last.width < BODY_MIN_WIDTH_EM * fs || Math.abs((_nullishCoalesce(_optionalChain([b, 'access', _81 => _81.style, 'optionalAccess', _82 => _82.fontSize]), () => ( 0))) - fs) > 0.15 * fs) continue;
2542
+ if (last.width < BODY_MIN_WIDTH_EM * fs || Math.abs((_nullishCoalesce(_optionalChain([b, 'access', _82 => _82.style, 'optionalAccess', _83 => _83.fontSize]), () => ( 0))) - fs) > 0.15 * fs) continue;
2535
2543
  const bt = b.text.replace(MARKUP, "");
2536
2544
  if (startsNewItem(a.text, b.text) || PAGE_REF_TAIL.test(a.text) || PAGE_ITEM_HEAD.test(bt)) continue;
2537
2545
  if (PAGE_HEAD_MARK.test(bt) && !(/^[\u25a0-\u25ff]/.test(bt) && a.text.includes(bt[0]))) continue;
2538
2546
  const firstLeft = b.bbox && PARA_FIRST_LEFT.get(b.bbox);
2539
2547
  const indented = firstLeft === void 0 || firstLeft - (_nullishCoalesce(pageLeft.get(b.pageNumber), () => ( firstLeft))) >= 0.3 * fs;
2540
2548
  if (indented && SENTENCE_END.test(a.text.replace(MARKUP, "").trimEnd())) continue;
2541
- if (Math.round(_nullishCoalesce(_optionalChain([b, 'access', _83 => _83.style, 'optionalAccess', _84 => _84.fontSize]), () => ( 0))) !== Math.round(fs) && titleLike(b.text)) continue;
2549
+ if (Math.round(_nullishCoalesce(_optionalChain([b, 'access', _84 => _84.style, 'optionalAccess', _85 => _85.fontSize]), () => ( 0))) !== Math.round(fs) && titleLike(b.text)) continue;
2542
2550
  if (/\t/.test(a.text.slice(a.text.lastIndexOf("\n") + 1).replace(/^\S{1,8}\t/, "")) && titleLike(bt.trim().split("\n")[0])) continue;
2543
2551
  const joined = wrapJoiner(a.text, b.text, lex);
2544
2552
  const head = a.text, joiner = joined === "" && last.spaceAfter ? " " : joined;
@@ -2587,7 +2595,7 @@ function bodyLineJoins(lines, lex) {
2587
2595
  for (const l of lines) if (!HANGING.test(l.text) && l.right > inner) inner = l.right;
2588
2596
  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;
2589
2597
  const nextWordNoRoom = (a, b) => {
2590
- const w = _optionalChain([b, 'access', _85 => _85.text, 'access', _86 => _86.trim, 'call', _87 => _87(), 'access', _88 => _88.match, 'call', _89 => _89(/^\S+/), 'optionalAccess', _90 => _90[0]]);
2598
+ const w = _optionalChain([b, 'access', _86 => _86.text, 'access', _87 => _87.trim, 'call', _88 => _88(), 'access', _89 => _89.match, 'call', _90 => _90(/^\S+/), 'optionalAccess', _91 => _91[0]]);
2591
2599
  const n = [...b.text.trim()].length;
2592
2600
  if (!w || n === 0) return false;
2593
2601
  const em = (b.right - b.left) / n;
@@ -2781,7 +2789,7 @@ function cellTextToString(items, wrap) {
2781
2789
  const merged = mergeSuperscriptRows(lines).map((line) => sortLineByX(line));
2782
2790
  const textLines = merged.map((s) => {
2783
2791
  if (s.length === 1) return s[0].text;
2784
- if (s.length === 2 && /^[가-힣]$/.test(s[0].text) && /^[가-힣]$/.test(s[1].text) && !!_optionalChain([wrap, 'optionalAccess', _91 => _91.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;
2792
+ if (s.length === 2 && /^[가-힣]$/.test(s[0].text) && /^[가-힣]$/.test(s[1].text) && !!_optionalChain([wrap, 'optionalAccess', _92 => _92.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;
2785
2793
  const evenSpaced = detectEvenSpacedItems(s, true);
2786
2794
  let result = s[0].text;
2787
2795
  for (let j = 1; j < s.length; j++) {
@@ -2926,12 +2934,12 @@ function markEvenRun(items, visible, result, start, end) {
2926
2934
  }
2927
2935
  function mergeCellTextLines(textLines, wrap) {
2928
2936
  if (textLines.length <= 1) return textLines[0] || "";
2929
- const numberWrapped = (k) => !!_optionalChain([wrap, 'optionalAccess', _92 => _92.wraps, 'access', _93 => _93[k]]) && (_nullishCoalesce(_optionalChain([wrap, 'access', _94 => _94.wide, 'optionalAccess', _95 => _95[k]]), () => ( true)));
2937
+ const numberWrapped = (k) => !!_optionalChain([wrap, 'optionalAccess', _93 => _93.wraps, 'access', _94 => _94[k]]) && (_nullishCoalesce(_optionalChain([wrap, 'access', _95 => _95.wide, 'optionalAccess', _96 => _96[k]]), () => ( true)));
2930
2938
  const merged = [textLines[0]];
2931
2939
  for (let i = 1; i < textLines.length; i++) {
2932
2940
  const prev = merged[merged.length - 1];
2933
2941
  const curr = textLines[i];
2934
- if (wrap ? wrap.wraps[i - 1] && !_optionalChain([wrap, 'access', _96 => _96.spaced, 'optionalAccess', _97 => _97[i - 1]]) && !startsNewItem(prev, curr) && wrapJoiner(prev, curr, wrap.lex, false) === "" : /[가-힣]$/.test(prev) && /^[가-힣]+$/.test(curr) && curr.length <= 8 && !curr.includes(" ")) {
2942
+ if (wrap ? wrap.wraps[i - 1] && !_optionalChain([wrap, 'access', _97 => _97.spaced, 'optionalAccess', _98 => _98[i - 1]]) && !startsNewItem(prev, curr) && wrapJoiner(prev, curr, wrap.lex, false) === "" : /[가-힣]$/.test(prev) && /^[가-힣]+$/.test(curr) && curr.length <= 8 && !curr.includes(" ")) {
2935
2943
  merged[merged.length - 1] = prev + curr;
2936
2944
  } else if (curr.trim().length <= 3 && /^[)\]%}]/.test(curr.trim())) {
2937
2945
  merged[merged.length - 1] = prev + curr.trim();
@@ -3009,7 +3017,7 @@ function normalizeUndersegmentedTable(originalCells, colXs, items, rowYs) {
3009
3017
  if (numRows > MAX_UNDERSEGMENTED_ROWS || numCols < MIN_UNDERSEGMENTED_COLUMNS) return null;
3010
3018
  if (items.length === 0) return null;
3011
3019
  if (numRows >= 3) {
3012
- if (_optionalChain([rowYs, 'optionalAccess', _98 => _98.length]) !== numRows + 1) return null;
3020
+ if (_optionalChain([rowYs, 'optionalAccess', _99 => _99.length]) !== numRows + 1) return null;
3013
3021
  const rebuilt2 = [];
3014
3022
  let expanded = 0;
3015
3023
  for (let r = 0; r < numRows; r++) {
@@ -3162,7 +3170,7 @@ function dominantStyle(items) {
3162
3170
  let maxCount = 0, dominantSize = 0;
3163
3171
  for (const i of items) {
3164
3172
  if (i.fontSize <= 0) continue;
3165
- const count = (freq.get(i.fontSize) || 0) + Math.max(1, _nullishCoalesce(_optionalChain([i, 'access', _99 => _99.text, 'access', _100 => _100.match, 'call', _101 => _101(/[\p{L}\p{N}]/gu), 'optionalAccess', _102 => _102.length]), () => ( 0)));
3173
+ const count = (freq.get(i.fontSize) || 0) + Math.max(1, _nullishCoalesce(_optionalChain([i, 'access', _100 => _100.text, 'access', _101 => _101.match, 'call', _102 => _102(/[\p{L}\p{N}]/gu), 'optionalAccess', _103 => _103.length]), () => ( 0)));
3166
3174
  freq.set(i.fontSize, count);
3167
3175
  if (count > maxCount) {
3168
3176
  maxCount = count;
@@ -3170,7 +3178,7 @@ function dominantStyle(items) {
3170
3178
  }
3171
3179
  }
3172
3180
  if (dominantSize === 0) return void 0;
3173
- const fontName = _optionalChain([items, 'access', _103 => _103.find, 'call', _104 => _104((i) => i.fontSize === dominantSize), 'optionalAccess', _105 => _105.fontName]) || void 0;
3181
+ const fontName = _optionalChain([items, 'access', _104 => _104.find, 'call', _105 => _105((i) => i.fontSize === dominantSize), 'optionalAccess', _106 => _106.fontName]) || void 0;
3174
3182
  return fontName ? { fontSize: dominantSize, fontName } : { fontSize: dominantSize };
3175
3183
  }
3176
3184
  function normalizeItems(rawItems) {
@@ -3315,7 +3323,7 @@ function splitAroundOverlays(c, overlays) {
3315
3323
  const ov = overlays.filter((o) => {
3316
3324
  for (let at = c.text.indexOf(o.text); at >= 0; at = c.text.indexOf(o.text, at + 1)) {
3317
3325
  const prefix = c.text.slice(0, at);
3318
- const est = c.x + glyphUnits(prefix.replace(/\s+/g, "")) * a0 + (_nullishCoalesce(_optionalChain([prefix, 'access', _106 => _106.match, 'call', _107 => _107(/\s+/g), 'optionalAccess', _108 => _108.length]), () => ( 0))) * ws;
3326
+ const est = c.x + glyphUnits(prefix.replace(/\s+/g, "")) * a0 + (_nullishCoalesce(_optionalChain([prefix, 'access', _107 => _107.match, 'call', _108 => _108(/\s+/g), 'optionalAccess', _109 => _109.length]), () => ( 0))) * ws;
3319
3327
  if (Math.abs(est - o.x) <= OVERLAY_DUP_EM * fs) return false;
3320
3328
  }
3321
3329
  return true;
@@ -3440,7 +3448,7 @@ function mergeSuperscriptLines(lines) {
3440
3448
  return result;
3441
3449
  }
3442
3450
  function mergeLineSimple(items) {
3443
- if (items.length <= 1) return _optionalChain([items, 'access', _109 => _109[0], 'optionalAccess', _110 => _110.text]) || "";
3451
+ if (items.length <= 1) return _optionalChain([items, 'access', _110 => _110[0], 'optionalAccess', _111 => _111.text]) || "";
3444
3452
  const sorted = sortLineByX([...items]);
3445
3453
  const isEvenSpaced = detectEvenSpacedItems(sorted);
3446
3454
  let result = sorted[0].text;
@@ -3528,7 +3536,7 @@ function isProseTable(table) {
3528
3536
  if (!(long > 0 && long >= total * 0.5 && longRows >= rows * 0.4)) return false;
3529
3537
  for (let c = 0; c < table.cols; c++) {
3530
3538
  const filled = table.cells.map((row) => row[c]).filter((cell) => cell && cell.colSpan < table.cols && cell.text.trim()).map((cell) => cell.text.trim());
3531
- if (filled.length >= 3 && filled.length >= rows * 0.6 && filled.every((text) => text.length <= 30 && (_nullishCoalesce(_optionalChain([text, 'access', _111 => _111.match, 'call', _112 => _112(/\p{L}/gu), 'optionalAccess', _113 => _113.length]), () => ( 0))) >= 2)) return false;
3539
+ if (filled.length >= 3 && filled.length >= rows * 0.6 && filled.every((text) => text.length <= 30 && (_nullishCoalesce(_optionalChain([text, 'access', _112 => _112.match, 'call', _113 => _113(/\p{L}/gu), 'optionalAccess', _114 => _114.length]), () => ( 0))) >= 2)) return false;
3532
3540
  }
3533
3541
  return true;
3534
3542
  }
@@ -3557,7 +3565,7 @@ var TICK = /^-?[\d,]+(?:\.\d+)?%?$/;
3557
3565
  var QUANTITY = /^[-−–]?[\d,]*\.?\d+%?$/;
3558
3566
  var quantity = (token) => Number(token.replace(/^[−–]/, "-").replace(/[,%]/g, ""));
3559
3567
  function isValueAxisColumn(table, c) {
3560
- const lines = table.cells.flatMap((row) => (_nullishCoalesce(_optionalChain([row, 'access', _114 => _114[c], 'optionalAccess', _115 => _115.text]), () => ( ""))).split("\n").map((line) => line.trim().split(/\s+/)));
3568
+ const lines = table.cells.flatMap((row) => (_nullishCoalesce(_optionalChain([row, 'access', _115 => _115[c], 'optionalAccess', _116 => _116.text]), () => ( ""))).split("\n").map((line) => line.trim().split(/\s+/)));
3561
3569
  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));
3562
3570
  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)]) {
3563
3571
  const run = fallingRun(ticks);
@@ -3589,7 +3597,7 @@ function isChartTable(table, ocr = false) {
3589
3597
  const numeric = texts.filter((text) => NUMERIC_CELL.test(text)).length;
3590
3598
  if (numeric < texts.length * 0.5) return false;
3591
3599
  for (let c = 0; c < table.cols; c++) {
3592
- if (!ocr ? isValueAxisColumn(table, c) : hasValueAxis(table.cells.flatMap((row) => (_nullishCoalesce(_optionalChain([row, 'access', _116 => _116[c], 'optionalAccess', _117 => _117.text]), () => ( ""))).split(/\s+/)).filter((t) => TICK.test(t)).map((t) => Number(t.replace(/[,%]/g, ""))))) return true;
3600
+ if (!ocr ? isValueAxisColumn(table, c) : hasValueAxis(table.cells.flatMap((row) => (_nullishCoalesce(_optionalChain([row, 'access', _117 => _117[c], 'optionalAccess', _118 => _118.text]), () => ( ""))).split(/\s+/)).filter((t) => TICK.test(t)).map((t) => Number(t.replace(/[,%]/g, ""))))) return true;
3593
3601
  }
3594
3602
  const values = texts.filter((text) => text.split(/\s+/).every((token) => QUANTITY.test(token))).length;
3595
3603
  const cells = table.rows * table.cols;
@@ -3642,7 +3650,7 @@ function clusterCellLines(items) {
3642
3650
  }
3643
3651
  var WRAP_INDENT_MAX = 3;
3644
3652
  function joinClusterCellLines(lines, box, lex) {
3645
- let out = _nullishCoalesce(_optionalChain([lines, 'access', _118 => _118[0], 'optionalAccess', _119 => _119.text]), () => ( ""));
3653
+ let out = _nullishCoalesce(_optionalChain([lines, 'access', _119 => _119[0], 'optionalAccess', _120 => _120.text]), () => ( ""));
3646
3654
  for (let i = 1; i < lines.length; i++) {
3647
3655
  const a = lines[i - 1], b = lines[i];
3648
3656
  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) === "";
@@ -3853,7 +3861,7 @@ function detectAlignedTwoColumnTables(rows, pageNum) {
3853
3861
  continue;
3854
3862
  }
3855
3863
  const top = rows[i - 1];
3856
- const title = _optionalChain([top, 'optionalAccess', _120 => _120.items, 'access', _121 => _121.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;
3864
+ const title = _optionalChain([top, 'optionalAccess', _121 => _121.items, 'access', _122 => _122.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;
3857
3865
  const tableRows = title ? [title, ...body] : body;
3858
3866
  const cells = tableRows.map((row, idx) => {
3859
3867
  if (title && idx === 0) return [{ text: row.items[0].text, colSpan: 2, rowSpan: 1 }, { text: "", colSpan: 1, rowSpan: 1 }];
@@ -3909,12 +3917,12 @@ function isTwoColumnProse(r) {
3909
3917
  if (t.rows < 8) return false;
3910
3918
  const dense = [];
3911
3919
  for (let c = 0; c < t.cols; c++) {
3912
- const filled = t.cells.filter((row) => _optionalChain([row, 'access', _122 => _122[c], 'optionalAccess', _123 => _123.text, 'access', _124 => _124.trim, 'call', _125 => _125()])).length;
3920
+ const filled = t.cells.filter((row) => _optionalChain([row, 'access', _123 => _123[c], 'optionalAccess', _124 => _124.text, 'access', _125 => _125.trim, 'call', _126 => _126()])).length;
3913
3921
  if (filled / t.rows >= 0.3) dense.push(c);
3914
3922
  }
3915
3923
  if (dense.length !== 2) return false;
3916
3924
  for (const c of dense) {
3917
- const lens = t.cells.map((row) => _nullishCoalesce(_optionalChain([row, 'access', _126 => _126[c], 'optionalAccess', _127 => _127.text, 'access', _128 => _128.replace, 'call', _129 => _129(/\s+/g, ""), 'access', _130 => _130.length]), () => ( 0))).filter((n) => n > 0);
3925
+ const lens = t.cells.map((row) => _nullishCoalesce(_optionalChain([row, 'access', _127 => _127[c], 'optionalAccess', _128 => _128.text, 'access', _129 => _129.replace, 'call', _130 => _130(/\s+/g, ""), 'access', _131 => _131.length]), () => ( 0))).filter((n) => n > 0);
3918
3926
  const avg = lens.reduce((s, v) => s + v, 0) / (lens.length || 1);
3919
3927
  if (avg < 12) return false;
3920
3928
  }
@@ -4328,7 +4336,7 @@ function assignRowItems(items, columns, numCols, headerFace) {
4328
4336
  const runs = [];
4329
4337
  for (const it of sorted) {
4330
4338
  const last = runs[runs.length - 1];
4331
- const prev = _optionalChain([last, 'optionalAccess', _131 => _131[last.length - 1]]);
4339
+ const prev = _optionalChain([last, 'optionalAccess', _132 => _132[last.length - 1]]);
4332
4340
  if (prev && it.x - (prev.x + prev.w) <= Math.max(0.5, it.fontSize * 0.05) && !it.hasSpaceBefore) last.push(it);
4333
4341
  else runs.push([it]);
4334
4342
  }
@@ -4403,7 +4411,7 @@ function buildClusterTable(rows, columns, pageNum, lex) {
4403
4411
  );
4404
4412
  const usedItems = /* @__PURE__ */ new Set();
4405
4413
  const lines = cells.map((row) => row.map(() => []));
4406
- const headFaces = new Set(_optionalChain([rows, 'access', _132 => _132[0], 'optionalAccess', _133 => _133.items, 'access', _134 => _134.map, 'call', _135 => _135((i) => i.fontName)]));
4414
+ const headFaces = new Set(_optionalChain([rows, 'access', _133 => _133[0], 'optionalAccess', _134 => _134.items, 'access', _135 => _135.map, 'call', _136 => _136((i) => i.fontName)]));
4407
4415
  const headerFace = headFaces.size === 1 && rows.slice(1).every((row) => row.items.every((i) => !headFaces.has(i.fontName))) ? [...headFaces][0] : void 0;
4408
4416
  for (let r = 0; r < numRows; r++) {
4409
4417
  const row = rows[r];
@@ -4439,7 +4447,7 @@ function buildClusterTable(rows, columns, pageNum, lex) {
4439
4447
  const nonEmptyCols = cells[r].filter((c) => c.text.trim()).length;
4440
4448
  if (nonEmptyCols !== 1) continue;
4441
4449
  if (cells[r][0].text.trim() !== "") continue;
4442
- const contentText = _optionalChain([cells, 'access', _136 => _136[r], 'access', _137 => _137.find, 'call', _138 => _138((c) => c.text.trim()), 'optionalAccess', _139 => _139.text, 'access', _140 => _140.trim, 'call', _141 => _141()]) || "";
4450
+ const contentText = _optionalChain([cells, 'access', _137 => _137[r], 'access', _138 => _138.find, 'call', _139 => _139((c) => c.text.trim()), 'optionalAccess', _140 => _140.text, 'access', _141 => _141.trim, 'call', _142 => _142()]) || "";
4443
4451
  if (/^[○●▶\-·]/.test(contentText)) continue;
4444
4452
  for (let pr = r - 1; pr >= 0; pr--) {
4445
4453
  if (cells[pr].some((c) => c.text.trim())) {
@@ -4672,7 +4680,7 @@ function stackedTableBands(items) {
4672
4680
  const caption = (start, end) => lines.slice(start, end).some((line) => /^Table\s+\d+\s*[:.]/i.test(mergeLineSimple(line).trim()));
4673
4681
  while (runs.length > 0 && !caption(runs[runs.length - 1].end, lines.length)) runs.pop();
4674
4682
  if (runs.length < 2) return null;
4675
- if (runs.some((run, i) => !caption(run.end, _nullishCoalesce(_optionalChain([runs, 'access', _142 => _142[i + 1], 'optionalAccess', _143 => _143.start]), () => ( lines.length))))) return null;
4683
+ if (runs.some((run, i) => !caption(run.end, _nullishCoalesce(_optionalChain([runs, 'access', _143 => _143[i + 1], 'optionalAccess', _144 => _144.start]), () => ( lines.length))))) return null;
4676
4684
  const tables = runs.map((run) => lines.slice(run.start, run.end).flat());
4677
4685
  const between = runs.slice(0, -1).map((run, i) => lines.slice(run.end, runs[i + 1].start).flat());
4678
4686
  const tail = lines.slice(runs[runs.length - 1].end);
@@ -4940,7 +4948,7 @@ function splitTrailingColumnRegion(items) {
4940
4948
  }
4941
4949
  function panelBlocks(items, panel, pageNum) {
4942
4950
  const lines = groupByY([...items].sort((a, b) => b.y - a.y || a.x - b.x));
4943
- const faceOf = (line) => _nullishCoalesce(_optionalChain([dominantStyle, 'call', _144 => _144(line), 'optionalAccess', _145 => _145.fontName]), () => ( ""));
4951
+ const faceOf = (line) => _nullishCoalesce(_optionalChain([dominantStyle, 'call', _145 => _145(line), 'optionalAccess', _146 => _146.fontName]), () => ( ""));
4944
4952
  const runs = [];
4945
4953
  for (const line of lines) {
4946
4954
  const last = runs[runs.length - 1];
@@ -5122,7 +5130,7 @@ function validWrapBands(items, bands) {
5122
5130
  }
5123
5131
  function inheritedWrapBands(items) {
5124
5132
  const source = XY_WRAP_ITEMS.get(items[0]);
5125
- const present = _optionalChain([source, 'optionalAccess', _146 => _146.length]) === items.length ? new Set(items) : null;
5133
+ const present = _optionalChain([source, 'optionalAccess', _147 => _147.length]) === items.length ? new Set(items) : null;
5126
5134
  const sameLeaf = present && source.every((item) => present.has(item));
5127
5135
  return sameLeaf ? validWrapBands(items, _nullishCoalesce(XY_WRAP_BANDS.get(items[0]), () => ( []))) : [];
5128
5136
  }
@@ -5161,7 +5169,7 @@ function wrappedLineBands(items, inherited) {
5161
5169
  left: box.x,
5162
5170
  right: box.x + box.width,
5163
5171
  y: row.reduce((n, i) => n + i.y, 0) / row.length,
5164
- fontSize: _nullishCoalesce(_optionalChain([dominantStyle, 'call', _147 => _147(row), 'optionalAccess', _148 => _148.fontSize]), () => ( 0)),
5172
+ fontSize: _nullishCoalesce(_optionalChain([dominantStyle, 'call', _148 => _148(row), 'optionalAccess', _149 => _149.fontSize]), () => ( 0)),
5165
5173
  sources: row.map((item) => ({ item, state: { ...item } }))
5166
5174
  };
5167
5175
  });
@@ -5297,10 +5305,10 @@ function pushLineParagraphs(out, yLines, pageNum, lex) {
5297
5305
  const lines = attachDropCaps(yLines).map((items) => ({ items, text: mergeLineSimple(items) })).filter((l) => l.text.trim());
5298
5306
  const geo = lines.map((l) => {
5299
5307
  const b = computeBBox(l.items, pageNum);
5300
- 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', _149 => _149(l.items), 'optionalAccess', _150 => _150.fontSize]), () => ( 0)) };
5308
+ 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', _150 => _150(l.items), 'optionalAccess', _151 => _151.fontSize]), () => ( 0)) };
5301
5309
  });
5302
5310
  const joins = bodyLineJoins(geo, lex);
5303
- const first = _optionalChain([lines, 'access', _151 => _151[0], 'optionalAccess', _152 => _152.items, 'access', _153 => _153[0]]);
5311
+ const first = _optionalChain([lines, 'access', _152 => _152[0], 'optionalAccess', _153 => _153.items, 'access', _154 => _154[0]]);
5304
5312
  const bands = first ? _nullishCoalesce(XY_WRAP_BANDS.get(first), () => ( [])) : [];
5305
5313
  const hasBand = (top, bottom) => {
5306
5314
  let lo = 0, hi = bands.length;
@@ -5377,15 +5385,15 @@ function computeMedianFontSizeFromFreq(freq) {
5377
5385
  function detectHeadings(blocks, medianFontSize) {
5378
5386
  for (let bi = 0; bi < blocks.length; bi++) {
5379
5387
  const block = blocks[bi];
5380
- if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _154 => _154.style, 'optionalAccess', _155 => _155.fontSize])) continue;
5388
+ if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _155 => _155.style, 'optionalAccess', _156 => _156.fontSize])) continue;
5381
5389
  const text = block.text.trim();
5382
5390
  if (text.length === 0 || text.length > 200) continue;
5383
5391
  if (/^\d+$/.test(text) && !isChapterNumber(block, blocks[bi + 1], medianFontSize)) continue;
5384
5392
  const ratio = block.style.fontSize / medianFontSize;
5385
5393
  let level = 0;
5386
- if (ratio >= _chunkYG4GFQB7cjs.HEADING_RATIO_H1) level = 1;
5387
- else if (ratio >= _chunkYG4GFQB7cjs.HEADING_RATIO_H2) level = 2;
5388
- else if (ratio >= _chunkYG4GFQB7cjs.HEADING_RATIO_H3) level = 3;
5394
+ if (ratio >= _chunkS34OVRKDcjs.HEADING_RATIO_H1) level = 1;
5395
+ else if (ratio >= _chunkS34OVRKDcjs.HEADING_RATIO_H2) level = 2;
5396
+ else if (ratio >= _chunkS34OVRKDcjs.HEADING_RATIO_H3) level = 3;
5389
5397
  if (level > 0) {
5390
5398
  block.type = "heading";
5391
5399
  block.level = level;
@@ -5394,21 +5402,21 @@ function detectHeadings(blocks, medianFontSize) {
5394
5402
  }
5395
5403
  }
5396
5404
  function isChapterNumber(block, next, medianFontSize) {
5397
- const size = _nullishCoalesce(_optionalChain([block, 'access', _156 => _156.style, 'optionalAccess', _157 => _157.fontSize]), () => ( 0));
5398
- const nextSize = _nullishCoalesce(_optionalChain([next, 'optionalAccess', _158 => _158.style, 'optionalAccess', _159 => _159.fontSize]), () => ( 0));
5399
- const text = _nullishCoalesce(_optionalChain([next, 'optionalAccess', _160 => _160.text, 'optionalAccess', _161 => _161.trim, 'call', _162 => _162()]), () => ( ""));
5400
- const a = block.bbox, b = _optionalChain([next, 'optionalAccess', _163 => _163.bbox]);
5401
- return /^\d{1,2}$/.test(_nullishCoalesce(_optionalChain([block, 'access', _164 => _164.text, 'optionalAccess', _165 => _165.trim, 'call', _166 => _166()]), () => ( ""))) && size >= medianFontSize * 2.5 && !!next && (next.type === "paragraph" || next.type === "heading") && next.pageNumber === block.pageNumber && nextSize >= medianFontSize * _chunkYG4GFQB7cjs.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;
5405
+ const size = _nullishCoalesce(_optionalChain([block, 'access', _157 => _157.style, 'optionalAccess', _158 => _158.fontSize]), () => ( 0));
5406
+ const nextSize = _nullishCoalesce(_optionalChain([next, 'optionalAccess', _159 => _159.style, 'optionalAccess', _160 => _160.fontSize]), () => ( 0));
5407
+ const text = _nullishCoalesce(_optionalChain([next, 'optionalAccess', _161 => _161.text, 'optionalAccess', _162 => _162.trim, 'call', _163 => _163()]), () => ( ""));
5408
+ const a = block.bbox, b = _optionalChain([next, 'optionalAccess', _164 => _164.bbox]);
5409
+ return /^\d{1,2}$/.test(_nullishCoalesce(_optionalChain([block, 'access', _165 => _165.text, 'optionalAccess', _166 => _166.trim, 'call', _167 => _167()]), () => ( ""))) && size >= medianFontSize * 2.5 && !!next && (next.type === "paragraph" || next.type === "heading") && next.pageNumber === block.pageNumber && nextSize >= medianFontSize * _chunkS34OVRKDcjs.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;
5402
5410
  }
5403
5411
  function mergeStackedHeadingLines(blocks, medianFontSize) {
5404
5412
  for (let i = 0; i < blocks.length - 1; ) {
5405
5413
  const a = blocks[i], b = blocks[i + 1];
5406
5414
  const ab = a.bbox, bb = b.bbox;
5407
- const af = _nullishCoalesce(_optionalChain([a, 'access', _167 => _167.style, 'optionalAccess', _168 => _168.fontSize]), () => ( 0)), bf = _nullishCoalesce(_optionalChain([b, 'access', _169 => _169.style, 'optionalAccess', _170 => _170.fontSize]), () => ( 0));
5415
+ const af = _nullishCoalesce(_optionalChain([a, 'access', _168 => _168.style, 'optionalAccess', _169 => _169.fontSize]), () => ( 0)), bf = _nullishCoalesce(_optionalChain([b, 'access', _170 => _170.style, 'optionalAccess', _171 => _171.fontSize]), () => ( 0));
5408
5416
  const gap = ab && bb ? ab.y - (bb.y + bb.height) : Infinity;
5409
- const centered = ab && bb && _optionalChain([a, 'access', _171 => _171.style, 'optionalAccess', _172 => _172.fontName]) === _optionalChain([b, 'access', _173 => _173.style, 'optionalAccess', _174 => _174.fontName]) && Math.abs(ab.x + ab.width / 2 - (bb.x + bb.width / 2)) <= Math.max(5, af * 0.5);
5417
+ const centered = ab && bb && _optionalChain([a, 'access', _172 => _172.style, 'optionalAccess', _173 => _173.fontName]) === _optionalChain([b, 'access', _174 => _174.style, 'optionalAccess', _175 => _175.fontName]) && Math.abs(ab.x + ab.width / 2 - (bb.x + bb.width / 2)) <= Math.max(5, af * 0.5);
5410
5418
  const sameAnchor = ab && bb && Math.abs(ab.x - bb.x) <= 5;
5411
- const wrapped = sameAnchor && _optionalChain([a, 'access', _175 => _175.style, 'optionalAccess', _176 => _176.fontName]) === _optionalChain([b, 'access', _177 => _177.style, 'optionalAccess', _178 => _178.fontName]) && af === bf && ab.width >= bb.width * 0.95 && (_nullishCoalesce(_optionalChain([a, 'access', _179 => _179.text, 'optionalAccess', _180 => _180.trim, 'call', _181 => _181(), 'access', _182 => _182.split, 'call', _183 => _183(/\s+/), 'access', _184 => _184.length]), () => ( 0))) >= 3;
5419
+ const wrapped = sameAnchor && _optionalChain([a, 'access', _176 => _176.style, 'optionalAccess', _177 => _177.fontName]) === _optionalChain([b, 'access', _178 => _178.style, 'optionalAccess', _179 => _179.fontName]) && af === bf && ab.width >= bb.width * 0.95 && (_nullishCoalesce(_optionalChain([a, 'access', _180 => _180.text, 'optionalAccess', _181 => _181.trim, 'call', _182 => _182(), 'access', _183 => _183.split, 'call', _184 => _184(/\s+/), 'access', _185 => _185.length]), () => ( 0))) >= 3;
5412
5420
  const displayStack = centered && gap <= Math.min(af, bf) * 0.3 && Math.max(af, bf) <= Math.min(af, bf) * 1.45;
5413
5421
  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)) {
5414
5422
  i++;
@@ -5437,25 +5445,25 @@ function detectTypographyHeadings(blocks) {
5437
5445
  if (page.some((block) => block.type === "heading")) continue;
5438
5446
  const faceWeight = /* @__PURE__ */ new Map();
5439
5447
  for (const block of page) {
5440
- if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _185 => _185.style, 'optionalAccess', _186 => _186.fontName])) continue;
5448
+ if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _186 => _186.style, 'optionalAccess', _187 => _187.fontName])) continue;
5441
5449
  const faces = FACE_CHARS.get(block);
5442
5450
  if (faces) for (const [face, n] of faces) faceWeight.set(face, (_nullishCoalesce(faceWeight.get(face), () => ( 0))) + n);
5443
5451
  else faceWeight.set(block.style.fontName, (_nullishCoalesce(faceWeight.get(block.style.fontName), () => ( 0))) + block.text.length);
5444
5452
  }
5445
- const bodyFace = _optionalChain([[...faceWeight], 'access', _187 => _187.sort, 'call', _188 => _188((a, b) => b[1] - a[1]), 'access', _189 => _189[0], 'optionalAccess', _190 => _190[0]]);
5453
+ const bodyFace = _optionalChain([[...faceWeight], 'access', _188 => _188.sort, 'call', _189 => _189((a, b) => b[1] - a[1]), 'access', _190 => _190[0], 'optionalAccess', _191 => _191[0]]);
5446
5454
  if (!bodyFace || (_nullishCoalesce(faceWeight.get(bodyFace), () => ( 0))) < 250) continue;
5447
5455
  const sizeWeight = /* @__PURE__ */ new Map();
5448
5456
  for (const block of page) {
5449
- if (block.type !== "paragraph" || !_optionalChain([block, 'access', _191 => _191.style, 'optionalAccess', _192 => _192.fontSize])) continue;
5457
+ if (block.type !== "paragraph" || !_optionalChain([block, 'access', _192 => _192.style, 'optionalAccess', _193 => _193.fontSize])) continue;
5450
5458
  const faces = FACE_CHARS.get(block);
5451
- const chars = faces ? _nullishCoalesce(faces.get(bodyFace), () => ( 0)) : block.style.fontName === bodyFace ? _nullishCoalesce(_optionalChain([block, 'access', _193 => _193.text, 'optionalAccess', _194 => _194.length]), () => ( 0)) : 0;
5459
+ const chars = faces ? _nullishCoalesce(faces.get(bodyFace), () => ( 0)) : block.style.fontName === bodyFace ? _nullishCoalesce(_optionalChain([block, 'access', _194 => _194.text, 'optionalAccess', _195 => _195.length]), () => ( 0)) : 0;
5452
5460
  if (chars) sizeWeight.set(block.style.fontSize, (_nullishCoalesce(sizeWeight.get(block.style.fontSize), () => ( 0))) + chars);
5453
5461
  }
5454
- const bodySize = _nullishCoalesce(_optionalChain([[...sizeWeight], 'access', _195 => _195.sort, 'call', _196 => _196((a, b) => b[1] - a[1]), 'access', _197 => _197[0], 'optionalAccess', _198 => _198[0]]), () => ( 0));
5462
+ const bodySize = _nullishCoalesce(_optionalChain([[...sizeWeight], 'access', _196 => _196.sort, 'call', _197 => _197((a, b) => b[1] - a[1]), 'access', _198 => _198[0], 'optionalAccess', _199 => _199[0]]), () => ( 0));
5455
5463
  for (let i = 0; i < page.length; i++) {
5456
5464
  const block = page[i];
5457
5465
  const { text, bbox, style } = block;
5458
- if (block.type !== "paragraph" || !text || !bbox || !_optionalChain([style, 'optionalAccess', _199 => _199.fontName]) || !style.fontSize) continue;
5466
+ if (block.type !== "paragraph" || !text || !bbox || !_optionalChain([style, 'optionalAccess', _200 => _200.fontName]) || !style.fontSize) continue;
5459
5467
  const title = text.trim();
5460
5468
  const numbered = /^\d+(?:\.\d+)*\.?\s+[A-Z가-힣]/.test(title);
5461
5469
  const faces = FACE_CHARS.get(block);
@@ -5485,16 +5493,16 @@ function detectDocumentStyleHeadings(blocks) {
5485
5493
  for (const page of byPage.values()) {
5486
5494
  const faceChars = /* @__PURE__ */ new Map();
5487
5495
  for (const block of page) {
5488
- if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _200 => _200.style, 'optionalAccess', _201 => _201.fontName])) continue;
5496
+ if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _201 => _201.style, 'optionalAccess', _202 => _202.fontName])) continue;
5489
5497
  faceChars.set(block.style.fontName, (_nullishCoalesce(faceChars.get(block.style.fontName), () => ( 0))) + block.text.length);
5490
5498
  }
5491
- const bodyFace = _optionalChain([[...faceChars], 'access', _202 => _202.sort, 'call', _203 => _203((a, b) => b[1] - a[1]), 'access', _204 => _204[0], 'optionalAccess', _205 => _205[0]]);
5499
+ const bodyFace = _optionalChain([[...faceChars], 'access', _203 => _203.sort, 'call', _204 => _204((a, b) => b[1] - a[1]), 'access', _205 => _205[0], 'optionalAccess', _206 => _206[0]]);
5492
5500
  if (!bodyFace || (_nullishCoalesce(faceChars.get(bodyFace), () => ( 0))) < 100) continue;
5493
- const labels = page.filter((b) => b.type === "paragraph" && b.text && b.bbox && _optionalChain([b, 'access', _206 => _206.style, 'optionalAccess', _207 => _207.fontName]) && b.style.fontName !== bodyFace && b.text.trim().length >= 3 && b.text.trim().length <= 40);
5501
+ const labels = page.filter((b) => b.type === "paragraph" && b.text && b.bbox && _optionalChain([b, 'access', _207 => _207.style, 'optionalAccess', _208 => _208.fontName]) && b.style.fontName !== bodyFace && b.text.trim().length >= 3 && b.text.trim().length <= 40);
5494
5502
  for (const label of labels) {
5495
- const peers = labels.filter((b) => _optionalChain([b, 'access', _208 => _208.style, 'optionalAccess', _209 => _209.fontName]) === _optionalChain([label, 'access', _210 => _210.style, 'optionalAccess', _211 => _211.fontName]) && Math.abs(b.bbox.y - label.bbox.y) <= 3 && Math.abs(b.bbox.x - label.bbox.x) >= 60);
5503
+ const peers = labels.filter((b) => _optionalChain([b, 'access', _209 => _209.style, 'optionalAccess', _210 => _210.fontName]) === _optionalChain([label, 'access', _211 => _211.style, 'optionalAccess', _212 => _212.fontName]) && Math.abs(b.bbox.y - label.bbox.y) <= 3 && Math.abs(b.bbox.x - label.bbox.x) >= 60);
5496
5504
  if (peers.length < 2) continue;
5497
- const value = page.find((b) => b.type === "paragraph" && b.bbox && _optionalChain([b, 'access', _212 => _212.style, 'optionalAccess', _213 => _213.fontName]) !== _optionalChain([label, 'access', _214 => _214.style, 'optionalAccess', _215 => _215.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);
5505
+ const value = page.find((b) => b.type === "paragraph" && b.bbox && _optionalChain([b, 'access', _213 => _213.style, 'optionalAccess', _214 => _214.fontName]) !== _optionalChain([label, 'access', _215 => _215.style, 'optionalAccess', _216 => _216.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);
5498
5506
  if (value) {
5499
5507
  label.type = "heading";
5500
5508
  label.level = 2;
@@ -5503,7 +5511,7 @@ function detectDocumentStyleHeadings(blocks) {
5503
5511
  const first = page.find((b) => b.type !== "image" && b.type !== "separator");
5504
5512
  const second = page[page.indexOf(first) + 1];
5505
5513
  const third = page[page.indexOf(first) + 2];
5506
- if (!first || !second || !third || first.type !== "list" && first.type !== "paragraph" || second.type !== "paragraph" || !first.text || !second.text || !first.bbox || !second.bbox || !_optionalChain([first, 'access', _216 => _216.style, 'optionalAccess', _217 => _217.fontName]) || !_optionalChain([second, 'access', _218 => _218.style, 'optionalAccess', _219 => _219.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', _220 => _220.style, 'optionalAccess', _221 => _221.fontName]) !== bodyFace) continue;
5514
+ if (!first || !second || !third || first.type !== "list" && first.type !== "paragraph" || second.type !== "paragraph" || !first.text || !second.text || !first.bbox || !second.bbox || !_optionalChain([first, 'access', _217 => _217.style, 'optionalAccess', _218 => _218.fontName]) || !_optionalChain([second, 'access', _219 => _219.style, 'optionalAccess', _220 => _220.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', _221 => _221.style, 'optionalAccess', _222 => _222.fontName]) !== bodyFace) continue;
5507
5515
  first.type = "heading";
5508
5516
  first.level = 1;
5509
5517
  first.text = `${first.text.trim()} ${second.text.trim()}`;
@@ -5527,18 +5535,18 @@ function detectSiblingStyleHeadings(blocks) {
5527
5535
  for (const page of byPage.values()) {
5528
5536
  const bodyChars = /* @__PURE__ */ new Map();
5529
5537
  for (const block of page) {
5530
- if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _222 => _222.style, 'optionalAccess', _223 => _223.fontName])) continue;
5538
+ if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _223 => _223.style, 'optionalAccess', _224 => _224.fontName])) continue;
5531
5539
  const face = block.style.fontName;
5532
5540
  bodyChars.set(face, (_nullishCoalesce(bodyChars.get(face), () => ( 0))) + block.text.length);
5533
5541
  }
5534
- const bodyFace = _optionalChain([[...bodyChars], 'access', _224 => _224.sort, 'call', _225 => _225((a, b) => b[1] - a[1]), 'access', _226 => _226[0], 'optionalAccess', _227 => _227[0]]);
5535
- const anchors = page.filter((b) => b.type === "heading" && b.text && _optionalChain([b, 'access', _228 => _228.style, 'optionalAccess', _229 => _229.fontName]) && b.style.fontName !== bodyFace);
5542
+ const bodyFace = _optionalChain([[...bodyChars], 'access', _225 => _225.sort, 'call', _226 => _226((a, b) => b[1] - a[1]), 'access', _227 => _227[0], 'optionalAccess', _228 => _228[0]]);
5543
+ const anchors = page.filter((b) => b.type === "heading" && b.text && _optionalChain([b, 'access', _229 => _229.style, 'optionalAccess', _230 => _230.fontName]) && b.style.fontName !== bodyFace);
5536
5544
  for (const anchor of anchors) {
5537
5545
  const numbered = /^([A-Z])\.\d+\s+/.exec(anchor.text.trim());
5538
5546
  const lettered = /^([A-Z])\s+/.exec(anchor.text.trim());
5539
- const peers = anchors.filter((b) => _optionalChain([b, 'access', _230 => _230.style, 'optionalAccess', _231 => _231.fontName]) === _optionalChain([anchor, 'access', _232 => _232.style, 'optionalAccess', _233 => _233.fontName]) && Math.abs((_nullishCoalesce(_optionalChain([b, 'access', _234 => _234.style, 'optionalAccess', _235 => _235.fontSize]), () => ( 0))) - (_nullishCoalesce(_optionalChain([anchor, 'access', _236 => _236.style, 'optionalAccess', _237 => _237.fontSize]), () => ( 0)))) < 0.5);
5547
+ const peers = anchors.filter((b) => _optionalChain([b, 'access', _231 => _231.style, 'optionalAccess', _232 => _232.fontName]) === _optionalChain([anchor, 'access', _233 => _233.style, 'optionalAccess', _234 => _234.fontName]) && Math.abs((_nullishCoalesce(_optionalChain([b, 'access', _235 => _235.style, 'optionalAccess', _236 => _236.fontSize]), () => ( 0))) - (_nullishCoalesce(_optionalChain([anchor, 'access', _237 => _237.style, 'optionalAccess', _238 => _238.fontSize]), () => ( 0)))) < 0.5);
5540
5548
  if (peers.length < 2 && !numbered && !lettered) continue;
5541
- const candidates = page.filter((b) => b.type === "paragraph" && b.text && b.bbox && _optionalChain([b, 'access', _238 => _238.style, 'optionalAccess', _239 => _239.fontName]) === _optionalChain([anchor, 'access', _240 => _240.style, 'optionalAccess', _241 => _241.fontName]) && Math.abs((_nullishCoalesce(_optionalChain([b, 'access', _242 => _242.style, 'optionalAccess', _243 => _243.fontSize]), () => ( 0))) - (_nullishCoalesce(_optionalChain([anchor, 'access', _244 => _244.style, 'optionalAccess', _245 => _245.fontSize]), () => ( 0)))) < 0.5 && b.text.trim().length >= 3 && b.text.trim().length <= 80 && b.bbox.height <= (_nullishCoalesce(_optionalChain([b, 'access', _246 => _246.style, 'optionalAccess', _247 => _247.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()));
5549
+ const candidates = page.filter((b) => b.type === "paragraph" && b.text && b.bbox && _optionalChain([b, 'access', _239 => _239.style, 'optionalAccess', _240 => _240.fontName]) === _optionalChain([anchor, 'access', _241 => _241.style, 'optionalAccess', _242 => _242.fontName]) && Math.abs((_nullishCoalesce(_optionalChain([b, 'access', _243 => _243.style, 'optionalAccess', _244 => _244.fontSize]), () => ( 0))) - (_nullishCoalesce(_optionalChain([anchor, 'access', _245 => _245.style, 'optionalAccess', _246 => _246.fontSize]), () => ( 0)))) < 0.5 && b.text.trim().length >= 3 && b.text.trim().length <= 80 && b.bbox.height <= (_nullishCoalesce(_optionalChain([b, 'access', _247 => _247.style, 'optionalAccess', _248 => _248.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()));
5542
5550
  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));
5543
5551
  if (siblings.length < (numbered || lettered ? 1 : 2)) continue;
5544
5552
  for (const sibling of siblings) {
@@ -5557,13 +5565,13 @@ function detectRepeatedPageLabels(blocks) {
5557
5565
  }
5558
5566
  for (const page of byPage.values()) {
5559
5567
  const bodyChars = /* @__PURE__ */ new Map();
5560
- for (const b of page) if (b.type === "paragraph" && b.text && _optionalChain([b, 'access', _248 => _248.style, 'optionalAccess', _249 => _249.fontName])) {
5568
+ for (const b of page) if (b.type === "paragraph" && b.text && _optionalChain([b, 'access', _249 => _249.style, 'optionalAccess', _250 => _250.fontName])) {
5561
5569
  const faces = FACE_CHARS.get(b);
5562
5570
  if (faces) for (const [face, n] of faces) bodyChars.set(face, (_nullishCoalesce(bodyChars.get(face), () => ( 0))) + n);
5563
5571
  else bodyChars.set(b.style.fontName, (_nullishCoalesce(bodyChars.get(b.style.fontName), () => ( 0))) + b.text.length);
5564
5572
  }
5565
- const bodyFace = _optionalChain([[...bodyChars], 'access', _250 => _250.sort, 'call', _251 => _251((a, b) => b[1] - a[1]), 'access', _252 => _252[0], 'optionalAccess', _253 => _253[0]]);
5566
- const candidates = page.filter((b) => b.type === "paragraph" && b.text && b.bbox && _optionalChain([b, 'access', _254 => _254.style, 'optionalAccess', _255 => _255.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);
5573
+ const bodyFace = _optionalChain([[...bodyChars], 'access', _251 => _251.sort, 'call', _252 => _252((a, b) => b[1] - a[1]), 'access', _253 => _253[0], 'optionalAccess', _254 => _254[0]]);
5574
+ const candidates = page.filter((b) => b.type === "paragraph" && b.text && b.bbox && _optionalChain([b, 'access', _255 => _255.style, 'optionalAccess', _256 => _256.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);
5567
5575
  const groups = /* @__PURE__ */ new Map();
5568
5576
  for (const b of candidates) {
5569
5577
  const key = `${b.style.fontName}:${b.style.fontSize}`;
@@ -5599,19 +5607,19 @@ function detectPageLeadHeadings(blocks) {
5599
5607
  for (const page of byPage.values()) {
5600
5608
  const content = page.filter((b) => b.type !== "image" && b.type !== "separator" && !(b.type === "paragraph" && !b.style));
5601
5609
  const [first, second, third] = content;
5602
- if (!_optionalChain([first, 'optionalAccess', _256 => _256.bbox]) || !first.text || !_optionalChain([first, 'access', _257 => _257.style, 'optionalAccess', _258 => _258.fontSize]) || !second) continue;
5610
+ if (!_optionalChain([first, 'optionalAccess', _257 => _257.bbox]) || !first.text || !_optionalChain([first, 'access', _258 => _258.style, 'optionalAccess', _259 => _259.fontSize]) || !second) continue;
5603
5611
  const firstText = first.text.trim();
5604
5612
  const captionLike = /^(?:Figure|Fig\.?|Table|표|그림)\s*\d/i;
5605
5613
  const hasImage = page.some((b) => b.type === "image");
5606
- 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', _259 => _259.text, 'optionalAccess', _260 => _260.trim, 'call', _261 => _261()]), () => ( ""))) && (_nullishCoalesce(_optionalChain([second, 'access', _262 => _262.text, 'optionalAccess', _263 => _263.length]), () => ( 0))) >= 100 && second.bbox && first.bbox.y - (second.bbox.y + second.bbox.height) >= first.style.fontSize);
5614
+ 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', _260 => _260.text, 'optionalAccess', _261 => _261.trim, 'call', _262 => _262()]), () => ( ""))) && (_nullishCoalesce(_optionalChain([second, 'access', _263 => _263.text, 'optionalAccess', _264 => _264.length]), () => ( 0))) >= 100 && second.bbox && first.bbox.y - (second.bbox.y + second.bbox.height) >= first.style.fontSize);
5607
5615
  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);
5608
- const firstIsSection = first.type === "list" && /^\d+\.\s+[A-Z][A-Z\s]{12,}$/.test(firstText) && second.type === "paragraph" && (_nullishCoalesce(_optionalChain([second, 'access', _264 => _264.text, 'optionalAccess', _265 => _265.length]), () => ( 0))) >= 100;
5616
+ const firstIsSection = first.type === "list" && /^\d+\.\s+[A-Z][A-Z\s]{12,}$/.test(firstText) && second.type === "paragraph" && (_nullishCoalesce(_optionalChain([second, 'access', _265 => _265.text, 'optionalAccess', _266 => _266.length]), () => ( 0))) >= 100;
5609
5617
  if (firstIsTitle || firstAboveProse || firstIsSection) {
5610
5618
  first.type = "heading";
5611
5619
  first.level = 1;
5612
5620
  }
5613
- if (first.type !== "heading" || captionLike.test(firstText) || second.type !== "paragraph" || !second.text || !second.bbox || !_optionalChain([second, 'access', _266 => _266.style, 'optionalAccess', _267 => _267.fontName]) || !second.style.fontSize || !_optionalChain([third, 'optionalAccess', _268 => _268.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;
5614
- const distinctFace = _optionalChain([third, 'access', _269 => _269.style, 'optionalAccess', _270 => _270.fontName]) !== second.style.fontName;
5621
+ if (first.type !== "heading" || captionLike.test(firstText) || second.type !== "paragraph" || !second.text || !second.bbox || !_optionalChain([second, 'access', _267 => _267.style, 'optionalAccess', _268 => _268.fontName]) || !second.style.fontSize || !_optionalChain([third, 'optionalAccess', _269 => _269.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;
5622
+ const distinctFace = _optionalChain([third, 'access', _270 => _270.style, 'optionalAccess', _271 => _271.fontName]) !== second.style.fontName;
5615
5623
  const namedContents = /^Table of Contents$/i.test(second.text.trim());
5616
5624
  if (distinctFace && third.text.length >= 60 || namedContents) {
5617
5625
  second.type = "heading";
@@ -5622,24 +5630,24 @@ function detectPageLeadHeadings(blocks) {
5622
5630
  function refineDocumentStyleHeadings(blocks) {
5623
5631
  const faceChars = /* @__PURE__ */ new Map();
5624
5632
  for (const block of blocks) {
5625
- if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _271 => _271.style, 'optionalAccess', _272 => _272.fontName])) continue;
5633
+ if (block.type !== "paragraph" || !block.text || !_optionalChain([block, 'access', _272 => _272.style, 'optionalAccess', _273 => _273.fontName])) continue;
5626
5634
  faceChars.set(block.style.fontName, (_nullishCoalesce(faceChars.get(block.style.fontName), () => ( 0))) + block.text.length);
5627
5635
  }
5628
5636
  const [bodyFace, bodyChars] = _nullishCoalesce([...faceChars].sort((a, b) => b[1] - a[1])[0], () => ( []));
5629
5637
  if (!bodyFace || !bodyChars || bodyChars < 300) return;
5630
5638
  for (let i = 0; i < blocks.length; i++) {
5631
5639
  const block = blocks[i];
5632
- const text = _nullishCoalesce(_optionalChain([block, 'access', _273 => _273.text, 'optionalAccess', _274 => _274.trim, 'call', _275 => _275()]), () => ( ""));
5640
+ const text = _nullishCoalesce(_optionalChain([block, 'access', _274 => _274.text, 'optionalAccess', _275 => _275.trim, 'call', _276 => _276()]), () => ( ""));
5633
5641
  if (block.type === "heading" && /(?:https?:\/\/|www\.|^arxiv:|^doi:)/i.test(text)) {
5634
5642
  block.type = "paragraph";
5635
5643
  block.level = void 0;
5636
5644
  continue;
5637
5645
  }
5638
5646
  const box = block.bbox, style = block.style;
5639
- if (block.type !== "paragraph" || !box || !_optionalChain([style, 'optionalAccess', _276 => _276.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;
5647
+ if (block.type !== "paragraph" || !box || !_optionalChain([style, 'optionalAccess', _277 => _277.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;
5640
5648
  const previous = blocks[i - 1], next = blocks[i + 1];
5641
- const pb = _optionalChain([previous, 'optionalAccess', _277 => _277.bbox]), nb = _optionalChain([next, 'optionalAccess', _278 => _278.bbox]);
5642
- if (!pb || !nb || previous.pageNumber !== block.pageNumber || next.pageNumber !== block.pageNumber || previous.type !== "paragraph" && previous.type !== "heading" || next.type !== "paragraph" || _optionalChain([next, 'access', _279 => _279.style, 'optionalAccess', _280 => _280.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;
5649
+ const pb = _optionalChain([previous, 'optionalAccess', _278 => _278.bbox]), nb = _optionalChain([next, 'optionalAccess', _279 => _279.bbox]);
5650
+ if (!pb || !nb || previous.pageNumber !== block.pageNumber || next.pageNumber !== block.pageNumber || previous.type !== "paragraph" && previous.type !== "heading" || next.type !== "paragraph" || _optionalChain([next, 'access', _280 => _280.style, 'optionalAccess', _281 => _281.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;
5643
5651
  block.type = "heading";
5644
5652
  block.level = 2;
5645
5653
  }
@@ -5689,7 +5697,7 @@ function detectMarkerHeadings(blocks) {
5689
5697
  block.level = 4;
5690
5698
  continue;
5691
5699
  }
5692
- if (/^[가-힣]{2,6}$/.test(text) && _optionalChain([block, 'access', _281 => _281.style, 'optionalAccess', _282 => _282.fontSize])) {
5700
+ if (/^[가-힣]{2,6}$/.test(text) && _optionalChain([block, 'access', _282 => _282.style, 'optionalAccess', _283 => _283.fontSize])) {
5693
5701
  const prev = blocks[i - 1];
5694
5702
  const next = blocks[i + 1];
5695
5703
  const prevIsStructural = !prev || prev.type === "table" || prev.type === "heading" || prev.type === "separator";
@@ -5730,7 +5738,7 @@ function detectTableCaptions(blocks) {
5730
5738
  block.table.caption = blocks[i - 1].text.trim();
5731
5739
  blocks.splice(i - 1, 1);
5732
5740
  i--;
5733
- } else if (isCaptionCandidate(blocks[i + 1], block) && _optionalChain([blocks, 'access', _283 => _283[i + 2], 'optionalAccess', _284 => _284.type]) !== "table") {
5741
+ } else if (isCaptionCandidate(blocks[i + 1], block) && _optionalChain([blocks, 'access', _284 => _284[i + 2], 'optionalAccess', _285 => _285.type]) !== "table") {
5734
5742
  block.table.caption = blocks[i + 1].text.trim();
5735
5743
  blocks.splice(i + 1, 1);
5736
5744
  }
@@ -5966,7 +5974,7 @@ function removeHeaderFooterBlocks(blocks, pageHeights, warnings, notes, tables =
5966
5974
  const bottomEntries = [];
5967
5975
  for (let bi = 0; bi < blocks.length; bi++) {
5968
5976
  const b = blocks[bi];
5969
- const text = !tables ? _optionalChain([b, 'access', _285 => _285.text, 'optionalAccess', _286 => _286.trim, 'call', _287 => _287()]) : b.type === "table" && b.table ? b.table.cells.flat().map((c) => c.text.trim()).filter(Boolean).join(" | ") : void 0;
5977
+ const text = !tables ? _optionalChain([b, 'access', _286 => _286.text, 'optionalAccess', _287 => _287.trim, 'call', _288 => _288()]) : b.type === "table" && b.table ? b.table.cells.flat().map((c) => c.text.trim()).filter(Boolean).join(" | ") : void 0;
5970
5978
  if (!b.bbox || !b.pageNumber || !text) continue;
5971
5979
  const ph = pageHeights.get(b.bbox.page) || pageHeights.get(b.pageNumber);
5972
5980
  if (!ph) continue;
@@ -5999,7 +6007,7 @@ function removeHeaderFooterBlocks(blocks, pageHeights, warnings, notes, tables =
5999
6007
  for (const [p, count] of patternCount) {
6000
6008
  const pages = [..._nullishCoalesce(patternPages.get(p), () => ( []))];
6001
6009
  const span2 = pages.length ? Math.max(...pages) - Math.min(...pages) + 1 : 0;
6002
- const varying = !tables && (_nullishCoalesce(_optionalChain([patternNumbers, 'access', _288 => _288.get, 'call', _289 => _289(p), 'optionalAccess', _290 => _290.size]), () => ( 0))) > 1;
6010
+ const varying = !tables && (_nullishCoalesce(_optionalChain([patternNumbers, 'access', _289 => _289.get, 'call', _290 => _290(p), 'optionalAccess', _291 => _291.size]), () => ( 0))) > 1;
6003
6011
  const occ = _nullishCoalesce(patternOcc.get(p), () => ( []));
6004
6012
  const dense = pages.length >= span2 * 0.4;
6005
6013
  const loose = looseVaryingNumber(occ, entries === topEntries) && (entries === bottomEntries || dense || tracksPages(occ));
@@ -6011,8 +6019,8 @@ function removeHeaderFooterBlocks(blocks, pageHeights, warnings, notes, tables =
6011
6019
  for (const e of entries) {
6012
6020
  const norm = e.text.replace(/\d+/g, "#");
6013
6021
  if (!repeatedPatterns.has(norm)) continue;
6014
- const noteMark = _optionalChain([e, 'access', _291 => _291.text, 'access', _292 => _292.match, 'call', _293 => _293(/^\d{1,3}\)/), 'optionalAccess', _294 => _294[0]]);
6015
- if (noteMark && _optionalChain([notes, 'optionalAccess', _295 => _295.get, 'call', _296 => _296(e.page), 'optionalAccess', _297 => _297.marks, 'access', _298 => _298.some, 'call', _299 => _299((m) => m.mark === noteMark)])) continue;
6022
+ const noteMark = _optionalChain([e, 'access', _292 => _292.text, 'access', _293 => _293.match, 'call', _294 => _294(/^\d{1,3}\)/), 'optionalAccess', _295 => _295[0]]);
6023
+ if (noteMark && _optionalChain([notes, 'optionalAccess', _296 => _296.get, 'call', _297 => _297(e.page), 'optionalAccess', _298 => _298.marks, 'access', _299 => _299.some, 'call', _300 => _300((m) => m.mark === noteMark)])) continue;
6016
6024
  const cand = blocks[e.blockIdx];
6017
6025
  const cb = cand.bbox;
6018
6026
  const tableNote = /^(?:주\s*(?:\d+\s*[).:]|[::])|(?:자료|출처)\s*[::]|\*\s+\S)/.test(e.text.replace(/ \| /g, " ")) && blocks.some((o) => {
@@ -6026,7 +6034,7 @@ function removeHeaderFooterBlocks(blocks, pageHeights, warnings, notes, tables =
6026
6034
  if (bi === e.blockIdx) continue;
6027
6035
  const o = blocks[bi];
6028
6036
  if (!o.bbox || o.bbox.page !== cb.page) continue;
6029
- const oNorm = _optionalChain([o, 'access', _300 => _300.text, 'optionalAccess', _301 => _301.trim, 'call', _302 => _302(), 'access', _303 => _303.replace, 'call', _304 => _304(/\d+/g, "#")]);
6037
+ const oNorm = _optionalChain([o, 'access', _301 => _301.text, 'optionalAccess', _302 => _302.trim, 'call', _303 => _303(), 'access', _304 => _304.replace, 'call', _305 => _305(/\d+/g, "#")]);
6030
6038
  if (oNorm && repeatedPatterns.has(oNorm)) continue;
6031
6039
  const overlap2 = Math.min(cb.y + cb.height, o.bbox.y + o.bbox.height) - Math.max(cb.y, o.bbox.y);
6032
6040
  if (overlap2 >= cb.height * 0.5) {
@@ -6154,7 +6162,7 @@ function recordRowRules(table, cells, bbox, hs) {
6154
6162
  function markImageCell(cell) {
6155
6163
  IMAGE_CELLS.add(cell);
6156
6164
  }
6157
- var emptyCell = (cell) => !cell || !_optionalChain([cell, 'access', _305 => _305.text, 'optionalAccess', _306 => _306.trim, 'call', _307 => _307()]) && !_optionalChain([cell, 'access', _308 => _308.blocks, 'optionalAccess', _309 => _309.length]) && !IMAGE_CELLS.has(cell);
6165
+ var emptyCell = (cell) => !cell || !_optionalChain([cell, 'access', _306 => _306.text, 'optionalAccess', _307 => _307.trim, 'call', _308 => _308()]) && !_optionalChain([cell, 'access', _309 => _309.blocks, 'optionalAccess', _310 => _310.length]) && !IMAGE_CELLS.has(cell);
6158
6166
  function trimTable(table) {
6159
6167
  let cols = table.cols;
6160
6168
  while (cols > 0 && table.cells.every((row) => emptyCell(row[cols - 1]))) cols--;
@@ -6170,7 +6178,7 @@ function trimTable(table) {
6170
6178
  function trimTrailingEmptyTableCols(blocks) {
6171
6179
  for (const b of blocks) {
6172
6180
  if (b.type !== "table" || !b.table) continue;
6173
- for (const row of b.table.cells) for (const cell of row) if (_optionalChain([cell, 'access', _310 => _310.blocks, 'optionalAccess', _311 => _311.length])) trimTrailingEmptyTableCols(cell.blocks);
6181
+ for (const row of b.table.cells) for (const cell of row) if (_optionalChain([cell, 'access', _311 => _311.blocks, 'optionalAccess', _312 => _312.length])) trimTrailingEmptyTableCols(cell.blocks);
6174
6182
  trimTable(b.table);
6175
6183
  }
6176
6184
  }
@@ -6190,7 +6198,7 @@ function mergeSliverColumns(grid, colXs, maxWidth) {
6190
6198
  }
6191
6199
  const ok = owner.every((row) => {
6192
6200
  const o = row[c];
6193
- return !!o && (o.colSpan > 1 || !o.text.trim() && !_optionalChain([o, 'access', _312 => _312.blocks, 'optionalAccess', _313 => _313.length]));
6201
+ return !!o && (o.colSpan > 1 || !o.text.trim() && !_optionalChain([o, 'access', _313 => _313.blocks, 'optionalAccess', _314 => _314.length]));
6194
6202
  });
6195
6203
  if (!ok) continue;
6196
6204
  const spanning = /* @__PURE__ */ new Set();
@@ -6217,7 +6225,7 @@ var multiply = (m, t) => [
6217
6225
  m[1] * t[4] + m[3] * t[5] + m[5]
6218
6226
  ];
6219
6227
  function hollowCircle(image) {
6220
- if (!_optionalChain([image, 'optionalAccess', _314 => _314.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;
6228
+ if (!_optionalChain([image, 'optionalAccess', _315 => _315.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;
6221
6229
  const stride = image.kind === _pdfmjs.ImageKind.RGB_24BPP ? 3 : image.kind === _pdfmjs.ImageKind.RGBA_32BPP ? 4 : 0;
6222
6230
  const { width, height, data } = image;
6223
6231
  if (!stride || data.length < width * height * stride) return false;
@@ -6282,9 +6290,9 @@ function smallVisibleImagePaints(fnArray, argsArray) {
6282
6290
  const op = fnArray[i], args = argsArray[i];
6283
6291
  if (op === _pdfmjs.OPS.save || op === _pdfmjs.OPS.paintFormXObjectBegin) {
6284
6292
  stack.push({ ctm, alpha, clip, unknownClip });
6285
- const matrix = op === _pdfmjs.OPS.paintFormXObjectBegin ? _optionalChain([args, 'optionalAccess', _315 => _315[0]]) : void 0;
6293
+ const matrix = op === _pdfmjs.OPS.paintFormXObjectBegin ? _optionalChain([args, 'optionalAccess', _316 => _316[0]]) : void 0;
6286
6294
  if (Array.isArray(matrix) && matrix.length >= 6) ctm = multiply(ctm, matrix);
6287
- const bounds = op === _pdfmjs.OPS.paintFormXObjectBegin ? _optionalChain([args, 'optionalAccess', _316 => _316[1]]) : void 0;
6295
+ const bounds = op === _pdfmjs.OPS.paintFormXObjectBegin ? _optionalChain([args, 'optionalAccess', _317 => _317[1]]) : void 0;
6288
6296
  if (Array.isArray(bounds) && bounds.length === 4) {
6289
6297
  const box = rectangle(bounds[0], bounds[1], bounds[2] - bounds[0], bounds[3] - bounds[1]);
6290
6298
  if (box && ctm[1] === 0 && ctm[2] === 0) intersectClip(box);
@@ -6292,17 +6300,17 @@ function smallVisibleImagePaints(fnArray, argsArray) {
6292
6300
  }
6293
6301
  } else if (op === _pdfmjs.OPS.restore || op === _pdfmjs.OPS.paintFormXObjectEnd) {
6294
6302
  const state = stack.pop();
6295
- ctm = _nullishCoalesce(_optionalChain([state, 'optionalAccess', _317 => _317.ctm]), () => ( [1, 0, 0, 1, 0, 0]));
6296
- alpha = _nullishCoalesce(_optionalChain([state, 'optionalAccess', _318 => _318.alpha]), () => ( 1));
6297
- clip = _nullishCoalesce(_optionalChain([state, 'optionalAccess', _319 => _319.clip]), () => ( null));
6298
- unknownClip = _nullishCoalesce(_optionalChain([state, 'optionalAccess', _320 => _320.unknownClip]), () => ( false));
6303
+ ctm = _nullishCoalesce(_optionalChain([state, 'optionalAccess', _318 => _318.ctm]), () => ( [1, 0, 0, 1, 0, 0]));
6304
+ alpha = _nullishCoalesce(_optionalChain([state, 'optionalAccess', _319 => _319.alpha]), () => ( 1));
6305
+ clip = _nullishCoalesce(_optionalChain([state, 'optionalAccess', _320 => _320.clip]), () => ( null));
6306
+ unknownClip = _nullishCoalesce(_optionalChain([state, 'optionalAccess', _321 => _321.unknownClip]), () => ( false));
6299
6307
  } else if (op === _pdfmjs.OPS.setGState) {
6300
- for (const [key, value] of _nullishCoalesce(_optionalChain([args, 'optionalAccess', _321 => _321[0]]), () => ( []))) {
6308
+ for (const [key, value] of _nullishCoalesce(_optionalChain([args, 'optionalAccess', _322 => _322[0]]), () => ( []))) {
6301
6309
  if (key === "ca") alpha = typeof value === "number" ? value : 0;
6302
6310
  }
6303
6311
  } else if (op === _pdfmjs.OPS.constructPath) {
6304
6312
  const [operations, coordinates] = args;
6305
- pathRect = pathRect === void 0 && _optionalChain([operations, 'optionalAccess', _322 => _322.length]) === 1 && operations[0] === _pdfmjs.OPS.rectangle && _optionalChain([coordinates, 'optionalAccess', _323 => _323.length]) >= 4 && ctm[1] === 0 && ctm[2] === 0 ? rectangle(coordinates[0], coordinates[1], coordinates[2], coordinates[3]) : null;
6313
+ pathRect = pathRect === void 0 && _optionalChain([operations, 'optionalAccess', _323 => _323.length]) === 1 && operations[0] === _pdfmjs.OPS.rectangle && _optionalChain([coordinates, 'optionalAccess', _324 => _324.length]) >= 4 && ctm[1] === 0 && ctm[2] === 0 ? rectangle(coordinates[0], coordinates[1], coordinates[2], coordinates[3]) : null;
6306
6314
  } else if (op === _pdfmjs.OPS.clip || op === _pdfmjs.OPS.eoClip) pendingClip = true;
6307
6315
  else if ([
6308
6316
  _pdfmjs.OPS.endPath,
@@ -6322,7 +6330,7 @@ function smallVisibleImagePaints(fnArray, argsArray) {
6322
6330
  pendingClip = false;
6323
6331
  pathRect = void 0;
6324
6332
  } else if (op === _pdfmjs.OPS.transform && Array.isArray(args) && args.length >= 6) ctm = multiply(ctm, args);
6325
- else if (op === _pdfmjs.OPS.paintImageXObject && typeof _optionalChain([args, 'optionalAccess', _324 => _324[0]]) === "string") {
6333
+ else if (op === _pdfmjs.OPS.paintImageXObject && typeof _optionalChain([args, 'optionalAccess', _325 => _325[0]]) === "string") {
6326
6334
  if (typeof args[1] !== "number" || typeof args[2] !== "number" || args[1] < 16 || args[1] > 128 || args[2] < 16 || args[2] > 128) continue;
6327
6335
  const box = extractImageRegions([_pdfmjs.OPS.transform, _pdfmjs.OPS.paintImageXObject], [ctm, args])[0];
6328
6336
  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;
@@ -6341,14 +6349,14 @@ async function restoreImageBullets(items, page, fnArray, argsArray, shapes = /*
6341
6349
  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];
6342
6350
  if (!line || /^[○●•◦□■∙]/.test(line.text.trim()) || !/\p{L}/u.test(line.text)) continue;
6343
6351
  const row = items.filter((item) => Math.abs(item.y - line.y) <= 2 && item.x >= line.x);
6344
- if (row.reduce((n, item) => n + (_nullishCoalesce(_optionalChain([item, 'access', _325 => _325.text, 'access', _326 => _326.match, 'call', _327 => _327(/\p{L}/gu), 'optionalAccess', _328 => _328.length]), () => ( 0))), 0) < 12 || items.some((item) => item !== line && Math.abs(item.y - line.y) <= 2 && item.x < line.x)) continue;
6352
+ if (row.reduce((n, item) => n + (_nullishCoalesce(_optionalChain([item, 'access', _326 => _326.text, 'access', _327 => _327.match, 'call', _328 => _328(/\p{L}/gu), 'optionalAccess', _329 => _329.length]), () => ( 0))), 0) < 12 || items.some((item) => item !== line && Math.abs(item.y - line.y) <= 2 && item.x < line.x)) continue;
6345
6353
  candidates.push({ id, x: box.x1, width, line });
6346
6354
  }
6347
6355
  let restored = 0;
6348
6356
  const used = /* @__PURE__ */ new Set();
6349
6357
  for (const candidate of candidates) {
6350
6358
  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);
6351
- 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', _329 => _329.text, 'access', _330 => _330.match, 'call', _331 => _331(/\p{L}/gu), 'optionalAccess', _332 => _332.length]), () => ( 0))) >= 12).sort((a, b) => b.y - a.y);
6359
+ 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', _330 => _330.text, 'access', _331 => _331.match, 'call', _332 => _332(/\p{L}/gu), 'optionalAccess', _333 => _333.length]), () => ( 0))) >= 12).sort((a, b) => b.y - a.y);
6352
6360
  const numberedList = numbered.some((item, index) => index > 0 && item.text.trim().charCodeAt(0) === numbered[index - 1].text.trim().charCodeAt(0) + 1);
6353
6361
  if (!same.length && !numberedList || used.has(candidate.line)) continue;
6354
6362
  if (!shapes.has(candidate.id)) shapes.set(candidate.id, hollowCircle(await resolveImagePixels(page, candidate.id)));
@@ -6414,7 +6422,7 @@ function groupFlowBoxUnits(blocks, grids, hs, vs, images) {
6414
6422
  return units;
6415
6423
  }
6416
6424
  function arrowDirection(image) {
6417
- if (!_optionalChain([image, 'optionalAccess', _333 => _333.data]) || image.width < 16 || image.width > 128 || image.height < 16 || image.height > 128) return 0;
6425
+ if (!_optionalChain([image, 'optionalAccess', _334 => _334.data]) || image.width < 16 || image.width > 128 || image.height < 16 || image.height > 128) return 0;
6418
6426
  const { width, height, data } = image;
6419
6427
  const stride = image.kind === _pdfmjs.ImageKind.RGB_24BPP ? 3 : image.kind === _pdfmjs.ImageKind.RGBA_32BPP ? 4 : 0;
6420
6428
  if (!stride || data.length < width * height * stride) return 0;
@@ -6482,7 +6490,7 @@ function isSideTabTable(box, table, others, pageWidth, pageHeight) {
6482
6490
  function removeSideTabs(blocks, pageWidths) {
6483
6491
  const edges = /* @__PURE__ */ new Map();
6484
6492
  for (const b of blocks) {
6485
- if (!b.bbox || b.pageNumber === void 0 || [..._nullishCoalesce(_optionalChain([b, 'access', _334 => _334.text, 'optionalAccess', _335 => _335.trim, 'call', _336 => _336()]), () => ( ""))].length <= MAX_CHARS) continue;
6493
+ if (!b.bbox || b.pageNumber === void 0 || [..._nullishCoalesce(_optionalChain([b, 'access', _335 => _335.text, 'optionalAccess', _336 => _336.trim, 'call', _337 => _337()]), () => ( ""))].length <= MAX_CHARS) continue;
6486
6494
  const e = _nullishCoalesce(edges.get(b.pageNumber), () => ( { lefts: [], rights: [] }));
6487
6495
  e.lefts.push(b.bbox.x);
6488
6496
  e.rights.push(b.bbox.x + b.bbox.width);
@@ -6498,7 +6506,7 @@ function removeSideTabs(blocks, pageWidths) {
6498
6506
  const fallback = all.length ? { left: q(all.map((e) => e.left), 0.5), right: q(all.map((e) => e.right), 0.5) } : void 0;
6499
6507
  const key = (b) => {
6500
6508
  const w = b.pageNumber !== void 0 ? pageWidths.get(b.pageNumber) : void 0;
6501
- const text = _optionalChain([b, 'access', _337 => _337.text, 'optionalAccess', _338 => _338.trim, 'call', _339 => _339()]);
6509
+ const text = _optionalChain([b, 'access', _338 => _338.text, 'optionalAccess', _339 => _339.trim, 'call', _340 => _340()]);
6502
6510
  const area = _nullishCoalesce((b.pageNumber !== void 0 ? body.get(b.pageNumber) : void 0), () => ( fallback));
6503
6511
  if (b.type === "table") {
6504
6512
  if (!w || !b.bbox || !b.table || !SIDE_TAB_TABLES.has(b.table)) return null;
@@ -6931,16 +6939,16 @@ function isProseSpread(items) {
6931
6939
  for (let i = 1; i < sorted.length; i++) {
6932
6940
  gaps.push(sorted[i].x - (sorted[i - 1].x + sorted[i - 1].w));
6933
6941
  }
6934
- const maxGap = _chunkAS25R4EUcjs.safeMax.call(void 0, gaps);
6942
+ const maxGap = _chunkFJ45NNLAcjs.safeMax.call(void 0, gaps);
6935
6943
  const avgLen = items.reduce((s, i) => s + i.text.length, 0) / items.length;
6936
6944
  if (items.length >= 4 && maxGap < 40 && avgLen < 5) return true;
6937
- const minGap = _chunkAS25R4EUcjs.safeMin.call(void 0, gaps);
6945
+ const minGap = _chunkFJ45NNLAcjs.safeMin.call(void 0, gaps);
6938
6946
  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)));
6939
6947
  }
6940
6948
  function detectColumns(yLines) {
6941
6949
  const allItems = yLines.flat();
6942
6950
  if (allItems.length === 0) return null;
6943
- const pageWidth = _chunkAS25R4EUcjs.safeMax.call(void 0, allItems.map((i) => i.x + i.w)) - _chunkAS25R4EUcjs.safeMin.call(void 0, allItems.map((i) => i.x));
6951
+ const pageWidth = _chunkFJ45NNLAcjs.safeMax.call(void 0, allItems.map((i) => i.x + i.w)) - _chunkFJ45NNLAcjs.safeMin.call(void 0, allItems.map((i) => i.x));
6944
6952
  if (pageWidth < 100) return null;
6945
6953
  let bigoLineIdx = -1;
6946
6954
  for (let i = 0; i < yLines.length; i++) {
@@ -7165,7 +7173,7 @@ var UNDER_BOX_PAIR_MAX_EM = 2.2;
7165
7173
  var UNDER_BOX_PAIR_OVERLAP = 0.8;
7166
7174
  function markUnderlineItems(items, horizontals, verticals, nonRules) {
7167
7175
  const underlines = [];
7168
- if (_optionalChain([nonRules, 'optionalAccess', _340 => _340.size])) horizontals = horizontals.filter((line) => !nonRules.has(line));
7176
+ if (_optionalChain([nonRules, 'optionalAccess', _341 => _341.size])) horizontals = horizontals.filter((line) => !nonRules.has(line));
7169
7177
  if (items.length === 0 || horizontals.length === 0) return underlines;
7170
7178
  const tightOwners = /* @__PURE__ */ new Map();
7171
7179
  const tightlyOwned = (line) => {
@@ -7271,7 +7279,7 @@ function hasBoxTopPair(line, maxH, horizontals, cellItems) {
7271
7279
  if (ow <= 0) continue;
7272
7280
  const overlap2 = Math.min(line.x2, o.x2) - Math.max(line.x1, o.x1);
7273
7281
  if (overlap2 / Math.max(w, ow) < UNDER_BOX_PAIR_OVERLAP) continue;
7274
- const covered = _nullishCoalesce(_optionalChain([cellItems, 'optionalAccess', _341 => _341.reduce, 'call', _342 => _342((sum, item) => {
7282
+ const covered = _nullishCoalesce(_optionalChain([cellItems, 'optionalAccess', _342 => _342.reduce, 'call', _343 => _343((sum, item) => {
7275
7283
  const below = item.y - o.y1;
7276
7284
  if (below < 0.5 || below > 3 || !item.text.trim()) return sum;
7277
7285
  return sum + Math.max(0, Math.min(o.x2, item.x + item.w) - Math.max(o.x1, item.x));
@@ -7432,12 +7440,12 @@ function rebuildUnitLine(items, grid) {
7432
7440
  function prependUnitRow(cells, cols, line, usedItems) {
7433
7441
  const text = cleanCellText(line.map((item) => item.text).join(""));
7434
7442
  cells.unshift(Array.from({ length: cols }, (_, c) => ({ text: c === 0 ? text : "", colSpan: c === 0 ? cols : 1, rowSpan: 1 })));
7435
- for (const cell of cells[0]) _chunkYG4GFQB7cjs.CELL_EDGES.set(cell, NO_EDGES);
7443
+ for (const cell of cells[0]) _chunkS34OVRKDcjs.CELL_EDGES.set(cell, NO_EDGES);
7436
7444
  for (const item of line) usedItems.add(item);
7437
7445
  }
7438
7446
  function attachUnitRow(items, grid, cells, cols, usedItems) {
7439
7447
  const all = cells.flat();
7440
- if (all.filter((c) => c.text.trim()).length * 2 < all.length || UNIT.test(_nullishCoalesce(_optionalChain([cells, 'access', _343 => _343[0], 'optionalAccess', _344 => _344[0], 'optionalAccess', _345 => _345.text]), () => ( "")))) return false;
7448
+ if (all.filter((c) => c.text.trim()).length * 2 < all.length || UNIT.test(_nullishCoalesce(_optionalChain([cells, 'access', _344 => _344[0], 'optionalAccess', _345 => _345[0], 'optionalAccess', _346 => _346.text]), () => ( "")))) return false;
7441
7449
  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);
7442
7450
  let nearest = Infinity;
7443
7451
  for (const it of above) nearest = Math.min(nearest, it.y);
@@ -7472,7 +7480,7 @@ function closeShadedTableEdges(clipGrids, horizontals, verticals, fillRects) {
7472
7480
  let hs = horizontals, vs = verticals;
7473
7481
  const restored = [];
7474
7482
  for (const grid of clipGrids) {
7475
- if (grid.clipParent || grid.rowYs.length !== 2 || grid.colXs.length < 3 || !_optionalChain([grid, 'access', _346 => _346.cells, 'optionalAccess', _347 => _347.length]) || grid.cells.some((c) => c.filler || c.rowSpan !== 1 || c.colSpan !== 1)) continue;
7483
+ if (grid.clipParent || grid.rowYs.length !== 2 || grid.colXs.length < 3 || !_optionalChain([grid, 'access', _347 => _347.cells, 'optionalAccess', _348 => _348.length]) || grid.cells.some((c) => c.filler || c.rowSpan !== 1 || c.colSpan !== 1)) continue;
7476
7484
  const { x1, x2, y1: mid, y2: top } = grid.bbox;
7477
7485
  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;
7478
7486
  const topRule = hs.find((h) => near2(h.y1, top) && near2(h.x1, x1) && near2(h.x2, x2));
@@ -7886,7 +7894,7 @@ function takeFrameSpanningText(items, cutX, pageNum, lex) {
7886
7894
  const rows = groupByY([...items].sort((a, b) => b.y - a.y || a.x - b.x)).map((line) => {
7887
7895
  const runs = [];
7888
7896
  for (const item of [...line].sort((a, b) => a.x - b.x)) {
7889
- const run = runs[runs.length - 1], prev = _optionalChain([run, 'optionalAccess', _348 => _348[run.length - 1]]);
7897
+ const run = runs[runs.length - 1], prev = _optionalChain([run, 'optionalAccess', _349 => _349[run.length - 1]]);
7890
7898
  if (prev && item.x - (prev.x + prev.w) <= Math.max(prev.fontSize, item.fontSize) * 0.6) run.push(item);
7891
7899
  else runs.push([item]);
7892
7900
  }
@@ -7930,7 +7938,7 @@ function groupFrameParagraphUnits(units, frames) {
7930
7938
  for (const unit of units) for (const block of unit) source.set(block, unit);
7931
7939
  const members = /* @__PURE__ */ new Map(), emitted = /* @__PURE__ */ new Set();
7932
7940
  for (const frame of frames) {
7933
- if (frame.length < 2 || frame.some((block) => block.type !== "paragraph" || _optionalChain([source, 'access', _349 => _349.get, 'call', _350 => _350(block), 'optionalAccess', _351 => _351.length]) !== 1)) continue;
7941
+ if (frame.length < 2 || frame.some((block) => block.type !== "paragraph" || _optionalChain([source, 'access', _350 => _350.get, 'call', _351 => _351(block), 'optionalAccess', _352 => _352.length]) !== 1)) continue;
7934
7942
  for (const block of frame) members.set(block, frame);
7935
7943
  }
7936
7944
  const out = [];
@@ -7943,7 +7951,7 @@ function groupFrameParagraphUnits(units, frames) {
7943
7951
  }
7944
7952
  }
7945
7953
  for (const unit of out) {
7946
- if (unit.length < 2 || _optionalChain([FRAME_READING_UNITS, 'access', _352 => _352.get, 'call', _353 => _353(unit[0]), 'optionalAccess', _354 => _354.blocks]) === unit) continue;
7954
+ if (unit.length < 2 || _optionalChain([FRAME_READING_UNITS, 'access', _353 => _353.get, 'call', _354 => _354(unit[0]), 'optionalAccess', _355 => _355.blocks]) === unit) continue;
7947
7955
  const bs = unit.map((b) => b.bbox).filter((b) => !!b);
7948
7956
  if (bs.length !== unit.length) continue;
7949
7957
  const x = Math.min(...bs.map((b) => b.x)), y = Math.min(...bs.map((b) => b.y));
@@ -7960,14 +7968,14 @@ function groupFrameParagraphUnits(units, frames) {
7960
7968
  function recordFrameTitle(table, source, pageNum) {
7961
7969
  if (!CLIP_TABLES.has(table) || table.rows !== 1 || table.cols !== 3 || source.length < 2) return;
7962
7970
  const cells = table.cells[0];
7963
- if (cells.length !== 3 || cells.some((c) => c.colSpan !== 1 || c.rowSpan !== 1 || _optionalChain([c, 'access', _355 => _355.blocks, 'optionalAccess', _356 => _356.length]) || c.text.includes("\n"))) return;
7971
+ if (cells.length !== 3 || cells.some((c) => c.colSpan !== 1 || c.rowSpan !== 1 || _optionalChain([c, 'access', _356 => _356.blocks, 'optionalAccess', _357 => _357.length]) || c.text.includes("\n"))) return;
7964
7972
  const [label, spacer, title] = cells;
7965
7973
  if (!/^(?:붙임|별첨|첨부|부록)\s*\d{1,3}$/.test(label.text.trim()) || spacer.text.trim() || !title.text.trim()) return;
7966
7974
  if (cells.some((c) => {
7967
- const e = _chunkYG4GFQB7cjs.CELL_EDGES.get(c);
7975
+ const e = _chunkS34OVRKDcjs.CELL_EDGES.get(c);
7968
7976
  return !e || e.t || e.b || e.l || e.r;
7969
7977
  })) return;
7970
- const xs = TABLE_COLXS.get(table), style = dominantStyle(source), fs = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _357 => _357.fontSize]), () => ( 0));
7978
+ const xs = TABLE_COLXS.get(table), style = dominantStyle(source), fs = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _358 => _358.fontSize]), () => ( 0));
7971
7979
  if (!xs || xs.length !== 4 || fs <= 0) return;
7972
7980
  const width = xs[3] - xs[0], gap = xs[2] - xs[1];
7973
7981
  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;
@@ -8025,7 +8033,7 @@ function extendNestedShadedHeaders(clipGrids, lineGrids, horizontals, verticals,
8025
8033
  const extended = [];
8026
8034
  for (let i = 0; i < clipGrids.length; i++) {
8027
8035
  const c = clipGrids[i], parent = c.clipParent;
8028
- if (!parent || c.rowYs.length !== 2 || c.colXs.length < 3 || !_optionalChain([c, 'access', _358 => _358.cells, 'optionalAccess', _359 => _359.length]) || c.cells.some((cell) => cell.filler || cell.rowSpan !== 1 || cell.colSpan !== 1)) continue;
8036
+ if (!parent || c.rowYs.length !== 2 || c.colXs.length < 3 || !_optionalChain([c, 'access', _359 => _359.cells, 'optionalAccess', _360 => _360.length]) || c.cells.some((cell) => cell.filler || cell.rowSpan !== 1 || cell.colSpan !== 1)) continue;
8029
8037
  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;
8030
8038
  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;
8031
8039
  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)));
@@ -8048,7 +8056,7 @@ function attachSideTabBlocks(tab, body, pageNum) {
8048
8056
  bbox: computeBBox(items, pageNum),
8049
8057
  style: dominantStyle(items)
8050
8058
  });
8051
- const prefix = ordered.filter((g) => !_optionalChain([caps, 'optionalAccess', _360 => _360.has, 'call', _361 => _361(g)])).map((g) => ({
8059
+ const prefix = ordered.filter((g) => !_optionalChain([caps, 'optionalAccess', _361 => _361.has, 'call', _362 => _362(g)])).map((g) => ({
8052
8060
  type: "paragraph",
8053
8061
  text: g.text.trim(),
8054
8062
  pageNumber: pageNum,
@@ -8057,7 +8065,7 @@ function attachSideTabBlocks(tab, body, pageNum) {
8057
8065
  }));
8058
8066
  const groups = /* @__PURE__ */ new Map();
8059
8067
  for (const g of ordered) {
8060
- const cap = _optionalChain([caps, 'optionalAccess', _362 => _362.get, 'call', _363 => _363(g)]);
8068
+ const cap = _optionalChain([caps, 'optionalAccess', _363 => _363.get, 'call', _364 => _364(g)]);
8061
8069
  if (cap) groups.set(cap, [..._nullishCoalesce(groups.get(cap), () => ( [])), g]);
8062
8070
  }
8063
8071
  for (const [cap, glyphs] of groups) {
@@ -8091,7 +8099,7 @@ function extractPageBlocksWithLines(items, pageNum, opList, pageWidth, pageHeigh
8091
8099
  const filled = fillBlanks(items, horizontals, verticals);
8092
8100
  items = filled.items;
8093
8101
  horizontals = filled.horizontals;
8094
- const prevPage = _optionalChain([carry, 'optionalAccess', _364 => _364.page]) === pageNum - 1 ? carry.clip : void 0;
8102
+ const prevPage = _optionalChain([carry, 'optionalAccess', _365 => _365.page]) === pageNum - 1 ? carry.clip : void 0;
8095
8103
  const clipResult = detectTables ? buildClipCellGrids(extracted.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 };
8096
8104
  if (carry) {
8097
8105
  carry.page = pageNum;
@@ -8342,14 +8350,14 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
8342
8350
  if (!assignedItems.has(textItems[ti])) usedItems.delete(owners[ti]);
8343
8351
  }
8344
8352
  }
8345
- if (unitLine.length > 0 && rebuiltUsed && !/^\s*\(\s*단위\s*[::]/.test(_nullishCoalesce(_optionalChain([finalGrid, 'access', _365 => _365[0], 'optionalAccess', _366 => _366[0], 'optionalAccess', _367 => _367.text]), () => ( "")))) {
8353
+ if (unitLine.length > 0 && rebuiltUsed && !/^\s*\(\s*단위\s*[::]/.test(_nullishCoalesce(_optionalChain([finalGrid, 'access', _366 => _366[0], 'optionalAccess', _367 => _367[0], 'optionalAccess', _368 => _368.text]), () => ( "")))) {
8346
8354
  prependUnitRow(finalGrid, numCols, unitLine, usedItems);
8347
8355
  finalRows++;
8348
8356
  }
8349
8357
  if (!rebuiltUsed && attachUnitRow(items, grid, finalGrid, numCols, usedItems)) finalRows++;
8350
8358
  let semanticOneColumn = false;
8351
8359
  if (!grid.cells && !nestedAttached && numCols === 1 && numGridRows >= 2) {
8352
- const populatedRows = finalGrid.filter((row) => _optionalChain([row, 'access', _368 => _368[0], 'optionalAccess', _369 => _369.text, 'access', _370 => _370.trim, 'call', _371 => _371()]));
8360
+ const populatedRows = finalGrid.filter((row) => _optionalChain([row, 'access', _369 => _369[0], 'optionalAccess', _370 => _370.text, 'access', _371 => _371.trim, 'call', _372 => _372()]));
8353
8361
  if (populatedRows.length >= 4) {
8354
8362
  const fontSizes = tableItems.map((item) => item.fontSize).filter((size) => size > 0).sort((a, b) => a - b);
8355
8363
  const medianFont = _nullishCoalesce(fontSizes[Math.floor(fontSizes.length / 2)], () => ( 0));
@@ -8445,7 +8453,7 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
8445
8453
  height: grid.bbox.y2 - grid.bbox.y1
8446
8454
  };
8447
8455
  if (numRows === 1 && numCols === 1 && gridW < pageWidth * 0.35) {
8448
- const prose = _nullishCoalesce(_optionalChain([finalGrid, 'access', _372 => _372[0], 'optionalAccess', _373 => _373[0], 'optionalAccess', _374 => _374.text]), () => ( ""));
8456
+ const prose = _nullishCoalesce(_optionalChain([finalGrid, 'access', _373 => _373[0], 'optionalAccess', _374 => _374[0], 'optionalAccess', _375 => _375.text]), () => ( ""));
8449
8457
  const besideLines = (side) => new Set(side.map((it) => Math.round(it.y / 3))).size;
8450
8458
  const rightLines = items.filter((it) => it.x >= grid.bbox.x2 + 3 && it.y >= grid.bbox.y1 && it.y <= grid.bbox.y2);
8451
8459
  const leftLines = items.filter((it) => it.x + it.w <= grid.bbox.x1 - 3 && it.y >= grid.bbox.y1 && it.y <= grid.bbox.y2);
@@ -8464,8 +8472,8 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
8464
8472
  }
8465
8473
  }
8466
8474
  if (!grid.cells && !nestedAttached && shouldDemoteTable(irTable)) {
8467
- const paragraphs = numRows === 1 && numCols === 1 ? _optionalChain([irTable, 'access', _375 => _375.cells, 'access', _376 => _376[0], 'optionalAccess', _377 => _377[0], 'optionalAccess', _378 => _378.blocks]) : void 0;
8468
- if (_optionalChain([paragraphs, 'optionalAccess', _379 => _379.length])) {
8475
+ const paragraphs = numRows === 1 && numCols === 1 ? _optionalChain([irTable, 'access', _376 => _376.cells, 'access', _377 => _377[0], 'optionalAccess', _378 => _378[0], 'optionalAccess', _379 => _379.blocks]) : void 0;
8476
+ if (_optionalChain([paragraphs, 'optionalAccess', _380 => _380.length])) {
8469
8477
  blocks.push(...paragraphs);
8470
8478
  frameParagraphUnits.push(paragraphs);
8471
8479
  recordFrameReadingUnit(paragraphs, tableBbox);
@@ -8508,7 +8516,7 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
8508
8516
  const clusterResults = (proseColumns ? [] : detectClusterTables(clusterItems, pageNum, void 0, lex)).filter((cr) => {
8509
8517
  const b = cr.bbox;
8510
8518
  const overlapX = (x) => Math.min(x.x + x.width, b.x + b.width) - Math.max(x.x, b.x);
8511
- 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', _380 => _380.text, 'optionalAccess', _381 => _381.match, 'call', _382 => _382(/\p{L}/gu), 'optionalAccess', _383 => _383.length]), () => ( 0))) >= 10 && overlapX(x.bbox) >= 0.8 * b.width : x.type === "table" && !ocrPage && _optionalChain([x, 'access', _384 => _384.table, 'optionalAccess', _385 => _385.cols]) === cr.table.cols && overlapX(x.bbox) >= 0.5 * Math.min(x.bbox.width, b.width)));
8519
+ 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', _381 => _381.text, 'optionalAccess', _382 => _382.match, 'call', _383 => _383(/\p{L}/gu), 'optionalAccess', _384 => _384.length]), () => ( 0))) >= 10 && overlapX(x.bbox) >= 0.8 * b.width : x.type === "table" && !ocrPage && _optionalChain([x, 'access', _385 => _385.table, 'optionalAccess', _386 => _386.cols]) === cr.table.cols && overlapX(x.bbox) >= 0.5 * Math.min(x.bbox.width, b.width)));
8512
8520
  });
8513
8521
  if (clusterResults.length > 0) {
8514
8522
  const ciToIdx = /* @__PURE__ */ new Map();
@@ -8545,7 +8553,7 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
8545
8553
  groupSizes.push(1);
8546
8554
  }
8547
8555
  const allY = remaining.map((i) => i.y);
8548
- const pageH = _chunkAS25R4EUcjs.safeMax.call(void 0, allY) - _chunkAS25R4EUcjs.safeMin.call(void 0, allY);
8556
+ const pageH = _chunkFJ45NNLAcjs.safeMax.call(void 0, allY) - _chunkFJ45NNLAcjs.safeMin.call(void 0, allY);
8549
8557
  const gapThreshold = Math.max(15, pageH * 0.03);
8550
8558
  const sides = frameColumnTextBands(remaining, spanning, gx);
8551
8559
  const textBlocks = [];
@@ -8561,7 +8569,7 @@ function extractBlocksWithGrids(items, pageNum, pageWidth, pageHeight, grids, ho
8561
8569
  finalTextBlocks.push(...detectListBlocks(textBlocks));
8562
8570
  } else {
8563
8571
  const allY = remaining.map((i) => i.y);
8564
- const pageH = _chunkAS25R4EUcjs.safeMax.call(void 0, allY) - _chunkAS25R4EUcjs.safeMin.call(void 0, allY);
8572
+ const pageH = _chunkFJ45NNLAcjs.safeMax.call(void 0, allY) - _chunkFJ45NNLAcjs.safeMin.call(void 0, allY);
8565
8573
  const gapThreshold = Math.max(15, pageH * 0.03);
8566
8574
  const groups = xyCutOrder(remaining, gapThreshold);
8567
8575
  const textBlocks = [];
@@ -8889,7 +8897,7 @@ function extractPageBlocksFallback(items, pageNum, fullPage = false, detectTable
8889
8897
  blocks.push(...columnTextToBlocks(tableText, pageNum, bbox, dominantStyle(items)));
8890
8898
  } else {
8891
8899
  const allY = items.map((i) => i.y);
8892
- const pageHeight = _chunkAS25R4EUcjs.safeMax.call(void 0, allY) - _chunkAS25R4EUcjs.safeMin.call(void 0, allY);
8900
+ const pageHeight = _chunkFJ45NNLAcjs.safeMax.call(void 0, allY) - _chunkFJ45NNLAcjs.safeMin.call(void 0, allY);
8893
8901
  const gapThreshold = Math.max(15, pageHeight * 0.03);
8894
8902
  const orderedGroups = proseCutX !== null ? splitTwoColumnProse(items, proseCutX) : xyCutOrder(items, gapThreshold, 0, void 0, minGap);
8895
8903
  for (const group of orderedGroups) {
@@ -8921,17 +8929,17 @@ function mergeOcrImageRegions(blocks, page, regions, ocrBlocks) {
8921
8929
  const overlapH = Math.max(0, Math.min(b.y + b.height, region.y2) - Math.max(b.y, region.y1));
8922
8930
  return overlapW * overlapH >= b.width * b.height * 0.8;
8923
8931
  });
8924
- const labels = candidates.filter((b) => b.type === "paragraph" && b.bbox.height <= 24 && (_nullishCoalesce(_optionalChain([b, 'access', _386 => _386.text, 'optionalAccess', _387 => _387.match, 'call', _388 => _388(/[\p{L}\p{N}]/gu), 'optionalAccess', _389 => _389.length]), () => ( 0))) >= 2);
8932
+ const labels = candidates.filter((b) => b.type === "paragraph" && b.bbox.height <= 24 && (_nullishCoalesce(_optionalChain([b, 'access', _387 => _387.text, 'optionalAccess', _388 => _388.match, 'call', _389 => _389(/[\p{L}\p{N}]/gu), 'optionalAccess', _390 => _390.length]), () => ( 0))) >= 2);
8925
8933
  const axisFragments = rotatedAxisFragments(candidates);
8926
8934
  const accepted = candidates.filter((b) => {
8927
- if (b.type === "paragraph") return (_nullishCoalesce(_optionalChain([b, 'access', _390 => _390.text, 'optionalAccess', _391 => _391.match, 'call', _392 => _392(/[\p{L}\p{N}]/gu), 'optionalAccess', _393 => _393.length]), () => ( 0))) >= 2 || !axisFragments.has(b) && (supportedDiagramLabel(b, labels, region) || axisTick(b, candidates));
8935
+ if (b.type === "paragraph") return (_nullishCoalesce(_optionalChain([b, 'access', _391 => _391.text, 'optionalAccess', _392 => _392.match, 'call', _393 => _393(/[\p{L}\p{N}]/gu), 'optionalAccess', _394 => _394.length]), () => ( 0))) >= 2 || !axisFragments.has(b) && (supportedDiagramLabel(b, labels, region) || axisTick(b, candidates));
8928
8936
  const t = b.table;
8929
8937
  if (b.type !== "table" || !t || UNRULED_REGION_TABLES.has(b)) return false;
8930
8938
  if (t.rows === 1 && t.cols === 1) {
8931
- const text = _nullishCoalesce(_optionalChain([t, 'access', _394 => _394.cells, 'access', _395 => _395[0], 'optionalAccess', _396 => _396[0], 'optionalAccess', _397 => _397.text]), () => ( ""));
8932
- return (_nullishCoalesce(_optionalChain([text, 'access', _398 => _398.match, 'call', _399 => _399(/\n/g), 'optionalAccess', _400 => _400.length]), () => ( 0))) >= 5 && (_nullishCoalesce(_optionalChain([text, 'access', _401 => _401.match, 'call', _402 => _402(/\d/g), 'optionalAccess', _403 => _403.length]), () => ( 0))) >= text.length * 0.25;
8939
+ const text = _nullishCoalesce(_optionalChain([t, 'access', _395 => _395.cells, 'access', _396 => _396[0], 'optionalAccess', _397 => _397[0], 'optionalAccess', _398 => _398.text]), () => ( ""));
8940
+ return (_nullishCoalesce(_optionalChain([text, 'access', _399 => _399.match, 'call', _400 => _400(/\n/g), 'optionalAccess', _401 => _401.length]), () => ( 0))) >= 5 && (_nullishCoalesce(_optionalChain([text, 'access', _402 => _402.match, 'call', _403 => _403(/\d/g), 'optionalAccess', _404 => _404.length]), () => ( 0))) >= text.length * 0.25;
8933
8941
  }
8934
- const headerLabels = _nullishCoalesce(_optionalChain([t, 'access', _404 => _404.cells, 'access', _405 => _405[0], 'optionalAccess', _406 => _406.filter, 'call', _407 => _407((c) => c.text.replace(/[^A-Za-z가-힣]/g, "").length >= 2), 'access', _408 => _408.length]), () => ( 0));
8942
+ const headerLabels = _nullishCoalesce(_optionalChain([t, 'access', _405 => _405.cells, 'access', _406 => _406[0], 'optionalAccess', _407 => _407.filter, 'call', _408 => _408((c) => c.text.replace(/[^A-Za-z가-힣]/g, "").length >= 2), 'access', _409 => _409.length]), () => ( 0));
8935
8943
  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);
8936
8944
  });
8937
8945
  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, () => ( "")))) : []);
@@ -8948,14 +8956,14 @@ function mergeOcrImageRegions(blocks, page, regions, ocrBlocks) {
8948
8956
  for (const block of selected) {
8949
8957
  if (seen2.has(block)) continue;
8950
8958
  const frame = FRAME_READING_UNITS.get(block);
8951
- const source = _optionalChain([frame, 'optionalAccess', _409 => _409.blocks, 'access', _410 => _410.every, 'call', _411 => _411((member) => selectedSet.has(member))]) ? frame.blocks : [block];
8959
+ const source = _optionalChain([frame, 'optionalAccess', _410 => _410.blocks, 'access', _411 => _411.every, 'call', _412 => _412((member) => selectedSet.has(member))]) ? frame.blocks : [block];
8952
8960
  source.forEach((member) => seen2.add(member));
8953
8961
  const available = source.filter((member) => !hasOriginal(member));
8954
8962
  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 }));
8955
8963
  for (const unit of units) {
8956
8964
  const b = unit.bbox;
8957
8965
  const index = blocks.findIndex((existing) => {
8958
- const e = _nullishCoalesce(_optionalChain([FRAME_READING_UNITS, 'access', _412 => _412.get, 'call', _413 => _413(existing), 'optionalAccess', _414 => _414.bbox]), () => ( existing.bbox));
8966
+ const e = _nullishCoalesce(_optionalChain([FRAME_READING_UNITS, 'access', _413 => _413.get, 'call', _414 => _414(existing), 'optionalAccess', _415 => _415.bbox]), () => ( existing.bbox));
8959
8967
  if (existing.pageNumber !== page || !e) return false;
8960
8968
  const beside = e.y < region.y2 && e.y + e.height > region.y1 && e.x >= region.x2 - 1;
8961
8969
  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;
@@ -8973,16 +8981,16 @@ function mergeOcrImageRegions(blocks, page, regions, ocrBlocks) {
8973
8981
  }
8974
8982
  function axisTick(block, candidates) {
8975
8983
  const b = block.bbox;
8976
- if (!/^\d$/u.test(_nullishCoalesce(_optionalChain([block, 'access', _415 => _415.text, 'optionalAccess', _416 => _416.trim, 'call', _417 => _417()]), () => ( "")))) return false;
8977
- const numeric = candidates.filter((o) => o !== block && o.type === "paragraph" && o.bbox && /^[\d\s.,%+−-]+$/u.test(_nullishCoalesce(_optionalChain([o, 'access', _418 => _418.text, 'optionalAccess', _419 => _419.trim, 'call', _420 => _420()]), () => ( ""))) && /\d/u.test(_nullishCoalesce(o.text, () => ( ""))) && Math.max(o.bbox.height, b.height) <= Math.min(o.bbox.height, b.height) * 2);
8984
+ if (!/^\d$/u.test(_nullishCoalesce(_optionalChain([block, 'access', _416 => _416.text, 'optionalAccess', _417 => _417.trim, 'call', _418 => _418()]), () => ( "")))) return false;
8985
+ const numeric = candidates.filter((o) => o !== block && o.type === "paragraph" && o.bbox && /^[\d\s.,%+−-]+$/u.test(_nullishCoalesce(_optionalChain([o, 'access', _419 => _419.text, 'optionalAccess', _420 => _420.trim, 'call', _421 => _421()]), () => ( ""))) && /\d/u.test(_nullishCoalesce(o.text, () => ( ""))) && Math.max(o.bbox.height, b.height) <= Math.min(o.bbox.height, b.height) * 2);
8978
8986
  const cy = b.y + b.height / 2, right = b.x + b.width;
8979
8987
  const row = numeric.filter((o) => Math.abs(o.bbox.y + o.bbox.height / 2 - cy) <= Math.min(o.bbox.height, b.height) * 0.35);
8980
8988
  const column = numeric.filter((o) => Math.abs(o.bbox.x + o.bbox.width - right) <= Math.max(o.bbox.height, b.height) * 0.5);
8981
8989
  return row.length >= 2 || column.length >= 2;
8982
8990
  }
8983
8991
  function supportedDiagramLabel(block, labels, region) {
8984
- const b = block.bbox, text = _nullishCoalesce(_optionalChain([block, 'access', _421 => _421.text, 'optionalAccess', _422 => _422.trim, 'call', _423 => _423()]), () => ( ""));
8985
- 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', _424 => _424.text, 'optionalAccess', _425 => _425.match, 'call', _426 => _426(/\p{N}/gu), 'optionalAccess', _427 => _427.length]), () => ( 0))) >= 2).length < 2) return false;
8992
+ const b = block.bbox, text = _nullishCoalesce(_optionalChain([block, 'access', _422 => _422.text, 'optionalAccess', _423 => _423.trim, 'call', _424 => _424()]), () => ( ""));
8993
+ 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', _425 => _425.text, 'optionalAccess', _426 => _426.match, 'call', _427 => _427(/\p{N}/gu), 'optionalAccess', _428 => _428.length]), () => ( 0))) >= 2).length < 2) return false;
8986
8994
  let above = false, below = false;
8987
8995
  for (const label of labels) {
8988
8996
  const a = label.bbox, em = Math.max(b.height, a.height);
@@ -8997,7 +9005,7 @@ function rotatedAxisFragments(candidates) {
8997
9005
  const paragraphs = candidates.filter((b) => b.type === "paragraph" && b.bbox.height <= 24);
8998
9006
  const axes = [];
8999
9007
  for (const block of paragraphs) {
9000
- const b = block.bbox, text = _nullishCoalesce(_optionalChain([block, 'access', _428 => _428.text, 'optionalAccess', _429 => _429.trim, 'call', _430 => _430()]), () => ( ""));
9008
+ const b = block.bbox, text = _nullishCoalesce(_optionalChain([block, 'access', _429 => _429.text, 'optionalAccess', _430 => _430.trim, 'call', _431 => _431()]), () => ( ""));
9001
9009
  if (!/^[\d\s.,%+−-]+$/u.test(text) || !/\d/u.test(text) || b.width > b.height * 6) continue;
9002
9010
  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);
9003
9011
  if (axis) axis.push(block);
@@ -9014,8 +9022,8 @@ function rotatedAxisFragments(candidates) {
9014
9022
  const em = Math.max(...axis.map((a) => a.bbox.height)), right = axis[0].bbox.x + axis[0].bbox.width;
9015
9023
  if (top - bottom < em * 6) continue;
9016
9024
  const left = paragraphs.filter((block) => {
9017
- const b = block.bbox, text = _nullishCoalesce(_optionalChain([block, 'access', _431 => _431.text, 'optionalAccess', _432 => _432.trim, 'call', _433 => _433()]), () => ( ""));
9018
- return /\p{Script=Latin}/u.test(text) && (_nullishCoalesce(_optionalChain([text, 'access', _434 => _434.match, 'call', _435 => _435(/[\p{L}\p{N}]/gu), 'optionalAccess', _436 => _436.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;
9025
+ const b = block.bbox, text = _nullishCoalesce(_optionalChain([block, 'access', _432 => _432.text, 'optionalAccess', _433 => _433.trim, 'call', _434 => _434()]), () => ( ""));
9026
+ return /\p{Script=Latin}/u.test(text) && (_nullishCoalesce(_optionalChain([text, 'access', _435 => _435.match, 'call', _436 => _436(/[\p{L}\p{N}]/gu), 'optionalAccess', _437 => _437.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;
9019
9027
  });
9020
9028
  const stack = left.filter((a) => left.some((b) => {
9021
9029
  if (a === b || !aligned(a, b)) return false;
@@ -9025,7 +9033,7 @@ function rotatedAxisFragments(candidates) {
9025
9033
  if (stack.length < 2) continue;
9026
9034
  for (const block of paragraphs) {
9027
9035
  const b = block.bbox;
9028
- 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', _437 => _437.text, 'optionalAccess', _438 => _438.trim, 'call', _439 => _439()]), () => ( ""))) && stack.some((s) => aligned(s, block))) fragments.add(block);
9036
+ 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', _438 => _438.text, 'optionalAccess', _439 => _439.trim, 'call', _440 => _440()]), () => ( ""))) && stack.some((s) => aligned(s, block))) fragments.add(block);
9029
9037
  }
9030
9038
  }
9031
9039
  return fragments;
@@ -9103,4 +9111,4 @@ function rowParagraphs(block) {
9103
9111
 
9104
9112
 
9105
9113
  exports.DEFAULT_OCR_MODELS = DEFAULT_OCR_MODELS; exports.resolveOcrModels = resolveOcrModels; exports.ocrSelectionKey = ocrSelectionKey; exports.ocrSourcePath = ocrSourcePath; exports.ensureOcrModelsFor = ensureOcrModelsFor; exports.ocrModelsCached = ocrModelsCached; exports.parseCharacterDict = parseCharacterDict; 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;
9106
- //# sourceMappingURL=chunk-C6B5GWN7.cjs.map
9114
+ //# sourceMappingURL=chunk-R3T4RTQL.cjs.map