kordoc 4.22.2 → 4.22.4

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 (128) hide show
  1. package/README.md +11 -6
  2. package/dist/{-C437ZARA.js → -HAK3YFWW.js} +11 -11
  3. package/dist/{chunk-UV2G6XFA.js → chunk-36DK6AOX.js} +2 -2
  4. package/dist/{chunk-CNMUT5YW.js → chunk-3TUJ34V7.js} +2 -2
  5. package/dist/{chunk-I4BS4BXE.cjs → chunk-4X7AR4EH.cjs} +34 -28
  6. package/dist/chunk-4X7AR4EH.cjs.map +1 -0
  7. package/dist/{chunk-4BJZGXNM.js → chunk-5ARHF54C.js} +2 -2
  8. package/dist/{chunk-56GBOIOE.js → chunk-A3SKXHAN.js} +2 -2
  9. package/dist/{chunk-GVBQVXXB.js → chunk-AYV5VRHL.js} +14 -4
  10. package/dist/chunk-AYV5VRHL.js.map +1 -0
  11. package/dist/{chunk-3LJ6QO53.js → chunk-C5J5LDWM.js} +14 -8
  12. package/dist/{chunk-3LJ6QO53.js.map → chunk-C5J5LDWM.js.map} +1 -1
  13. package/dist/{chunk-IRP6QS3K.js → chunk-CWBH66IQ.js} +3 -3
  14. package/dist/{chunk-YTEMFVZB.js → chunk-DEFT7Z3B.js} +2 -2
  15. package/dist/{chunk-L6N4OMKR.js → chunk-EVL6HZQL.js} +128 -70
  16. package/dist/chunk-EVL6HZQL.js.map +1 -0
  17. package/dist/{chunk-ZLFUZM7H.cjs → chunk-EYQLJ57Y.cjs} +3 -3
  18. package/dist/{chunk-ZLFUZM7H.cjs.map → chunk-EYQLJ57Y.cjs.map} +1 -1
  19. package/dist/{chunk-GFQIKYBV.js → chunk-F3AWNFMO.js} +3 -3
  20. package/dist/{chunk-S4KQUVBV.js → chunk-FAFSBCU2.js} +4 -4
  21. package/dist/{chunk-AXR7OKQY.js → chunk-G2325K2F.js} +2 -2
  22. package/dist/{chunk-FPUBEM3F.js → chunk-G4KNI7EO.js} +11 -11
  23. package/dist/{chunk-NGDMJICC.js → chunk-HN3QMHTT.js} +15 -9
  24. package/dist/{chunk-NGDMJICC.js.map → chunk-HN3QMHTT.js.map} +1 -1
  25. package/dist/{chunk-MED2MR6O.cjs → chunk-K2NWHLCD.cjs} +23 -13
  26. package/dist/chunk-K2NWHLCD.cjs.map +1 -0
  27. package/dist/{chunk-UMNKY2EZ.js → chunk-LVVSMYG4.js} +4 -4
  28. package/dist/{chunk-AUWO57ED.cjs → chunk-MJSHXESK.cjs} +2 -2
  29. package/dist/{chunk-AUWO57ED.cjs.map → chunk-MJSHXESK.cjs.map} +1 -1
  30. package/dist/{chunk-L6PFPBTK.js → chunk-MYTMZSQO.js} +2 -2
  31. package/dist/{chunk-DQXP3ELP.js → chunk-Q65HT2BL.js} +2 -2
  32. package/dist/{chunk-U3TZVR7A.js → chunk-Q6SVCBMK.js} +2 -2
  33. package/dist/{chunk-2X64TI7I.js → chunk-RPSILMQY.js} +2 -2
  34. package/dist/{chunk-ENV25MPM.cjs → chunk-S45M7IQH.cjs} +24 -24
  35. package/dist/{chunk-ENV25MPM.cjs.map → chunk-S45M7IQH.cjs.map} +1 -1
  36. package/dist/{chunk-4GCS7WJJ.js → chunk-SSL3TKJY.js} +2 -2
  37. package/dist/{chunk-QFJCEHY7.js → chunk-UJVVL6BI.js} +14 -4
  38. package/dist/chunk-UJVVL6BI.js.map +1 -0
  39. package/dist/{chunk-EKKZNKJD.cjs → chunk-VXQWAPC6.cjs} +3 -3
  40. package/dist/{chunk-EKKZNKJD.cjs.map → chunk-VXQWAPC6.cjs.map} +1 -1
  41. package/dist/{chunk-VUC4JJUM.js → chunk-WCTC3LSV.js} +2 -2
  42. package/dist/{chunk-YOFKJ7IM.js → chunk-WNW77CAY.js} +2 -2
  43. package/dist/chunks-3N7OFSA4.js +10 -0
  44. package/dist/cli.js +30 -30
  45. package/dist/{formula-3TVRNJ66.cjs → formula-JGFYGFYX.cjs} +9 -9
  46. package/dist/{formula-3TVRNJ66.cjs.map → formula-JGFYGFYX.cjs.map} +1 -1
  47. package/dist/{formula-HUENRCPJ.js → formula-KSTY73DQ.js} +3 -3
  48. package/dist/{formula-43QBPAL5.js → formula-PWAUR5PF.js} +4 -4
  49. package/dist/{image-ocr-BAHDLDV5.js → image-ocr-RASJHOAK.js} +6 -6
  50. package/dist/{image-ocr-HYAKWJGE.js → image-ocr-RPBPO3VT.js} +9 -9
  51. package/dist/{image-ocr-OC3TCXMV.cjs → image-ocr-UULNAC5Y.cjs} +17 -17
  52. package/dist/{image-ocr-OC3TCXMV.cjs.map → image-ocr-UULNAC5Y.cjs.map} +1 -1
  53. package/dist/index.cjs +536 -478
  54. package/dist/index.cjs.map +1 -1
  55. package/dist/index.js +128 -70
  56. package/dist/index.js.map +1 -1
  57. package/dist/mcp.js +22 -22
  58. package/dist/{model-bundle-23WBSECG.js → model-bundle-ZPQ4IFT7.js} +5 -5
  59. package/dist/{models-NRZQY45P.js → models-YJQ5VHOR.js} +5 -5
  60. package/dist/{parse-worker-v2-DPNXGJ73.js → parse-worker-v2-7PNZYASF.js} +12 -12
  61. package/dist/{parser-XNOLC3MZ.js → parser-DR6ZHYEB.js} +121 -12
  62. package/dist/parser-DR6ZHYEB.js.map +1 -0
  63. package/dist/{parser-FNUQW2F3.js → parser-ER3VLB37.js} +124 -15
  64. package/dist/parser-ER3VLB37.js.map +1 -0
  65. package/dist/{parser-OKAQRZKM.cjs → parser-ZFXVZZKQ.cjs} +376 -267
  66. package/dist/parser-ZFXVZZKQ.cjs.map +1 -0
  67. package/dist/{pdf-ocr-FAGA3O6B.js → pdf-ocr-BYT7XVID.js} +6 -6
  68. package/dist/{pdf-ocr-N5LYC5LA.js → pdf-ocr-DRQN5BXA.js} +9 -9
  69. package/dist/pdf-ocr-QWTGWYQT.cjs +31 -0
  70. package/dist/{pdf-ocr-6UXBIQE6.cjs.map → pdf-ocr-QWTGWYQT.cjs.map} +1 -1
  71. package/dist/{profile-io-HC6FMYX4.js → profile-io-3QYTSPNH.js} +3 -3
  72. package/dist/{rasterize-QLTROEV2.js → rasterize-LPLWCBXV.js} +3 -3
  73. package/dist/{redact-doc-V4KMM2QV.js → redact-doc-HDA6ZG3N.js} +11 -11
  74. package/dist/{render-V4S3QLTR.js → render-MYZGD3SB.js} +7 -7
  75. package/dist/seal-XA5V6A6V.js +10 -0
  76. package/dist/{setup-HU7ZOQNM.js → setup-EF5TQVAI.js} +3 -3
  77. package/dist/visual-DB7NJOID.js +21 -0
  78. package/dist/{watch-NPIZ6DSJ.js → watch-PM5PRSFW.js} +12 -12
  79. package/package.json +1 -1
  80. package/dist/chunk-GVBQVXXB.js.map +0 -1
  81. package/dist/chunk-I4BS4BXE.cjs.map +0 -1
  82. package/dist/chunk-L6N4OMKR.js.map +0 -1
  83. package/dist/chunk-MED2MR6O.cjs.map +0 -1
  84. package/dist/chunk-QFJCEHY7.js.map +0 -1
  85. package/dist/chunks-MPOOHZVO.js +0 -10
  86. package/dist/parser-FNUQW2F3.js.map +0 -1
  87. package/dist/parser-OKAQRZKM.cjs.map +0 -1
  88. package/dist/parser-XNOLC3MZ.js.map +0 -1
  89. package/dist/pdf-ocr-6UXBIQE6.cjs +0 -31
  90. package/dist/seal-MQ5TB5YZ.js +0 -10
  91. package/dist/visual-RLIFC4XC.js +0 -21
  92. /package/dist/{-C437ZARA.js.map → -HAK3YFWW.js.map} +0 -0
  93. /package/dist/{chunk-UV2G6XFA.js.map → chunk-36DK6AOX.js.map} +0 -0
  94. /package/dist/{chunk-CNMUT5YW.js.map → chunk-3TUJ34V7.js.map} +0 -0
  95. /package/dist/{chunk-4BJZGXNM.js.map → chunk-5ARHF54C.js.map} +0 -0
  96. /package/dist/{chunk-56GBOIOE.js.map → chunk-A3SKXHAN.js.map} +0 -0
  97. /package/dist/{chunk-IRP6QS3K.js.map → chunk-CWBH66IQ.js.map} +0 -0
  98. /package/dist/{chunk-YTEMFVZB.js.map → chunk-DEFT7Z3B.js.map} +0 -0
  99. /package/dist/{chunk-GFQIKYBV.js.map → chunk-F3AWNFMO.js.map} +0 -0
  100. /package/dist/{chunk-S4KQUVBV.js.map → chunk-FAFSBCU2.js.map} +0 -0
  101. /package/dist/{chunk-AXR7OKQY.js.map → chunk-G2325K2F.js.map} +0 -0
  102. /package/dist/{chunk-FPUBEM3F.js.map → chunk-G4KNI7EO.js.map} +0 -0
  103. /package/dist/{chunk-UMNKY2EZ.js.map → chunk-LVVSMYG4.js.map} +0 -0
  104. /package/dist/{chunk-L6PFPBTK.js.map → chunk-MYTMZSQO.js.map} +0 -0
  105. /package/dist/{chunk-DQXP3ELP.js.map → chunk-Q65HT2BL.js.map} +0 -0
  106. /package/dist/{chunk-U3TZVR7A.js.map → chunk-Q6SVCBMK.js.map} +0 -0
  107. /package/dist/{chunk-2X64TI7I.js.map → chunk-RPSILMQY.js.map} +0 -0
  108. /package/dist/{chunk-4GCS7WJJ.js.map → chunk-SSL3TKJY.js.map} +0 -0
  109. /package/dist/{chunk-VUC4JJUM.js.map → chunk-WCTC3LSV.js.map} +0 -0
  110. /package/dist/{chunk-YOFKJ7IM.js.map → chunk-WNW77CAY.js.map} +0 -0
  111. /package/dist/{chunks-MPOOHZVO.js.map → chunks-3N7OFSA4.js.map} +0 -0
  112. /package/dist/{formula-HUENRCPJ.js.map → formula-KSTY73DQ.js.map} +0 -0
  113. /package/dist/{formula-43QBPAL5.js.map → formula-PWAUR5PF.js.map} +0 -0
  114. /package/dist/{image-ocr-BAHDLDV5.js.map → image-ocr-RASJHOAK.js.map} +0 -0
  115. /package/dist/{image-ocr-HYAKWJGE.js.map → image-ocr-RPBPO3VT.js.map} +0 -0
  116. /package/dist/{model-bundle-23WBSECG.js.map → model-bundle-ZPQ4IFT7.js.map} +0 -0
  117. /package/dist/{models-NRZQY45P.js.map → models-YJQ5VHOR.js.map} +0 -0
  118. /package/dist/{parse-worker-v2-DPNXGJ73.js.map → parse-worker-v2-7PNZYASF.js.map} +0 -0
  119. /package/dist/{pdf-ocr-FAGA3O6B.js.map → pdf-ocr-BYT7XVID.js.map} +0 -0
  120. /package/dist/{pdf-ocr-N5LYC5LA.js.map → pdf-ocr-DRQN5BXA.js.map} +0 -0
  121. /package/dist/{profile-io-HC6FMYX4.js.map → profile-io-3QYTSPNH.js.map} +0 -0
  122. /package/dist/{rasterize-QLTROEV2.js.map → rasterize-LPLWCBXV.js.map} +0 -0
  123. /package/dist/{redact-doc-V4KMM2QV.js.map → redact-doc-HDA6ZG3N.js.map} +0 -0
  124. /package/dist/{render-V4S3QLTR.js.map → render-MYZGD3SB.js.map} +0 -0
  125. /package/dist/{seal-MQ5TB5YZ.js.map → seal-XA5V6A6V.js.map} +0 -0
  126. /package/dist/{setup-HU7ZOQNM.js.map → setup-EF5TQVAI.js.map} +0 -0
  127. /package/dist/{visual-RLIFC4XC.js.map → visual-DB7NJOID.js.map} +0 -0
  128. /package/dist/{watch-NPIZ6DSJ.js.map → watch-PM5PRSFW.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } async function _asyncOptionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = await fn(value); } else if (op === 'call' || op === 'optionalCall') { value = await fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;
2
2
 
3
3
 
4
- var _chunkEKKZNKJDcjs = require('./chunk-EKKZNKJD.cjs');
4
+ var _chunkVXQWAPC6cjs = require('./chunk-VXQWAPC6.cjs');
5
5
 
6
6
 
7
7
 
@@ -61,7 +61,7 @@ var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
61
61
 
62
62
 
63
63
 
64
- var _chunkI4BS4BXEcjs = require('./chunk-I4BS4BXE.cjs');
64
+ var _chunk4X7AR4EHcjs = require('./chunk-4X7AR4EH.cjs');
65
65
 
66
66
 
67
67
 
@@ -75,12 +75,12 @@ var _chunkI4BS4BXEcjs = require('./chunk-I4BS4BXE.cjs');
75
75
 
76
76
 
77
77
 
78
- var _chunkMED2MR6Ocjs = require('./chunk-MED2MR6O.cjs');
79
- require('./chunk-ZLFUZM7H.cjs');
78
+ var _chunkK2NWHLCDcjs = require('./chunk-K2NWHLCD.cjs');
79
+ require('./chunk-EYQLJ57Y.cjs');
80
80
 
81
81
 
82
82
 
83
- var _chunkAUWO57EDcjs = require('./chunk-AUWO57ED.cjs');
83
+ var _chunkMJSHXESKcjs = require('./chunk-MJSHXESK.cjs');
84
84
 
85
85
 
86
86
  var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
@@ -217,7 +217,7 @@ async function extractPageImages(page, fnArray, argsArray, pageNumber, state, wa
217
217
  const filename = `image_${String(state.imageIndex).padStart(3, "0")}.png`;
218
218
  state.seen.set(hash, filename);
219
219
  if (withBytes) {
220
- const png = _chunkEKKZNKJDcjs.encodePng.call(void 0, w, h, rgba);
220
+ const png = _chunkVXQWAPC6cjs.encodePng.call(void 0, w, h, rgba);
221
221
  state.totalBytes += png.length;
222
222
  images.push({ filename, data: png, mimeType: "image/png" });
223
223
  }
@@ -613,7 +613,111 @@ function ocrVectorOps(opList, paths) {
613
613
 
614
614
  // src/pdf/split-row-pattern.ts
615
615
  var textOf = (cell) => cell.text.replace(/<\/?u>|~~/g, "").trim();
616
- var plain = (cell) => !_optionalChain([cell, 'access', _9 => _9.blocks, 'optionalAccess', _10 => _10.length]) && !_chunkI4BS4BXEcjs.IMAGE_CELLS.has(cell);
616
+ var plain = (cell) => !_optionalChain([cell, 'access', _9 => _9.blocks, 'optionalAccess', _10 => _10.length]) && !_chunk4X7AR4EHcjs.IMAGE_CELLS.has(cell);
617
+ var labelsOf = (cell) => {
618
+ const labels = textOf(cell).split("\n").map((s) => s.trim()).filter(Boolean);
619
+ return labels.length && labels.every((s) => /^\p{L}[\p{L}\p{N} ]{0,15}[::]$/u.test(s)) ? labels.map((s) => s.replace(/\s+/g, "").replace(/:/g, ":")) : void 0;
620
+ };
621
+ var alignedLabels = (label, value, count) => {
622
+ const L = _chunk4X7AR4EHcjs.CELL_LINES.get(label), V = _chunk4X7AR4EHcjs.CELL_LINES.get(value);
623
+ let next = 0;
624
+ return !!L && !!V && L.length === count && V.length >= count && Math.abs(L[0].y - V[0].y) <= 1 && L.every((l) => {
625
+ while (next < V.length && Math.abs(l.y - V[next].y) > 1) next++;
626
+ return next++ < V.length;
627
+ });
628
+ };
629
+ function matchesCompleteAlignedLabelListRow(table, owner, first) {
630
+ const pairs = [];
631
+ let carried = false;
632
+ for (let c = 0; c < table.cols; ) {
633
+ const u = _optionalChain([owner, 'access', _11 => _11[first - 1], 'optionalAccess', _12 => _12[c]]), d = _optionalChain([owner, 'access', _13 => _13[first], 'optionalAccess', _14 => _14[c]]);
634
+ if (u && u === d) {
635
+ carried = true;
636
+ c = u.c + u.cs;
637
+ continue;
638
+ }
639
+ const upper = u ? table.cells[u.r][u.c] : void 0, lower = d ? table.cells[d.r][d.c] : void 0;
640
+ if (!_optionalChain([upper, 'optionalAccess', _15 => _15.text, 'access', _16 => _16.trim, 'call', _17 => _17()]) && !_optionalChain([lower, 'optionalAccess', _18 => _18.text, 'access', _19 => _19.trim, 'call', _20 => _20()])) {
641
+ c++;
642
+ continue;
643
+ }
644
+ if (!u || !d || !upper || !lower || u.r !== first - 1 || d.r !== first || u.c !== c || d.c !== c || u.rs !== 1 || d.rs !== 1 || u.cs !== d.cs || !plain(upper) || !plain(lower)) return false;
645
+ pairs.push({ c, cs: u.cs, upper, lower });
646
+ c += u.cs;
647
+ }
648
+ const filled = pairs.filter((p) => textOf(p.upper) && textOf(p.lower));
649
+ if (!carried || filled.length !== 2) return false;
650
+ const keyed = filled.filter((p) => labelsOf(p.upper) && labelsOf(p.lower));
651
+ if (keyed.length !== 1) return false;
652
+ const label = keyed[0], value = filled.find((p) => p !== label);
653
+ const U = labelsOf(label.upper), D = labelsOf(label.lower), sequence = [...U, ...D];
654
+ if (D.length < 2 || sequence.length < 3 || new Set(sequence).size !== sequence.length || value.c !== label.c + label.cs || pairs.some((p) => p !== label && p !== value && textOf(p.lower)) || !pairs.some((p) => p.c < label.c && textOf(p.upper) && !textOf(p.lower)) || !alignedLabels(label.upper, value.upper, U.length) || !alignedLabels(label.lower, value.lower, D.length)) return false;
655
+ let peers = 0;
656
+ for (let r = 0; r < table.rows; r++) {
657
+ if (r === first - 1 || r === first) continue;
658
+ const L = _optionalChain([owner, 'access', _21 => _21[r], 'optionalAccess', _22 => _22[label.c]]), V = _optionalChain([owner, 'access', _23 => _23[r], 'optionalAccess', _24 => _24[value.c]]);
659
+ if (_optionalChain([L, 'optionalAccess', _25 => _25.r]) !== r || _optionalChain([V, 'optionalAccess', _26 => _26.r]) !== r || L.c !== label.c || V.c !== value.c || L.rs !== 1 || V.rs !== 1 || L.cs !== label.cs || V.cs !== value.cs) continue;
660
+ const l = table.cells[r][label.c], v = table.cells[r][value.c];
661
+ if (!plain(l) || !plain(v) || !textOf(v) || _optionalChain([labelsOf, 'call', _27 => _27(l), 'optionalAccess', _28 => _28.join, 'call', _29 => _29("|")]) !== sequence.join("|") || !alignedLabels(l, v, sequence.length)) continue;
662
+ if (++peers >= 2) return true;
663
+ }
664
+ return false;
665
+ }
666
+ function matchesIndependentRowPair(table, owner, first) {
667
+ const norm = (cell) => textOf(cell).replace(/\s+/g, "");
668
+ const pairs = [];
669
+ for (let c = 0; c < table.cols; ) {
670
+ const u = _optionalChain([owner, 'access', _30 => _30[first - 1], 'optionalAccess', _31 => _31[c]]), d = _optionalChain([owner, 'access', _32 => _32[first], 'optionalAccess', _33 => _33[c]]);
671
+ if (u && u === d) {
672
+ c = u.c + u.cs;
673
+ continue;
674
+ }
675
+ const upper = u ? table.cells[u.r][u.c] : void 0, lower = d ? table.cells[d.r][d.c] : void 0;
676
+ if (!_optionalChain([upper, 'optionalAccess', _34 => _34.text, 'access', _35 => _35.trim, 'call', _36 => _36()]) && !_optionalChain([lower, 'optionalAccess', _37 => _37.text, 'access', _38 => _38.trim, 'call', _39 => _39()])) {
677
+ c++;
678
+ continue;
679
+ }
680
+ if (!u || !d || !upper || !lower || u.r !== first - 1 || d.r !== first || u.c !== c || d.c !== c || u.rs !== 1 || d.rs !== 1 || u.cs !== d.cs || !plain(upper) || !plain(lower) || !norm(upper) || !norm(lower)) return false;
681
+ pairs.push({ c, cs: u.cs, upper: norm(upper), lower: norm(lower) });
682
+ c += u.cs;
683
+ }
684
+ if (pairs.length < 2 || pairs.every((p) => p.upper === p.lower)) return false;
685
+ return table.cells.some((_, r) => {
686
+ if (r + 1 >= table.rows || r + 1 >= first - 1 && r <= first) return false;
687
+ return pairs.every((p) => [p.upper, p.lower].every((text, i) => {
688
+ const a = _optionalChain([owner, 'access', _40 => _40[r + i], 'optionalAccess', _41 => _41[p.c]]), cell = _optionalChain([table, 'access', _42 => _42.cells, 'access', _43 => _43[r + i], 'optionalAccess', _44 => _44[p.c]]);
689
+ return _optionalChain([a, 'optionalAccess', _45 => _45.r]) === r + i && a.c === p.c && a.rs === 1 && a.cs === p.cs && !!cell && plain(cell) && norm(cell) === text;
690
+ }));
691
+ });
692
+ }
693
+ function matchesCompleteContextRow(table, owner, first) {
694
+ const norm = (s) => s.replace(/\s+/g, "");
695
+ const context = [];
696
+ let value;
697
+ for (let c = 0; c < table.cols; ) {
698
+ const u = _optionalChain([owner, 'access', _46 => _46[first - 1], 'optionalAccess', _47 => _47[c]]), d = _optionalChain([owner, 'access', _48 => _48[first], 'optionalAccess', _49 => _49[c]]);
699
+ if (u && u === d) {
700
+ const cell = table.cells[u.r][u.c];
701
+ if (u.r === first - 1 && u.rs === 2 && plain(cell) && textOf(cell)) context.push({ c, cs: u.cs, text: norm(textOf(cell)) });
702
+ c = u.c + u.cs;
703
+ continue;
704
+ }
705
+ const upper = u ? table.cells[u.r][u.c] : void 0, lower = d ? table.cells[d.r][d.c] : void 0;
706
+ if (!_optionalChain([upper, 'optionalAccess', _50 => _50.text, 'access', _51 => _51.trim, 'call', _52 => _52()]) && !_optionalChain([lower, 'optionalAccess', _53 => _53.text, 'access', _54 => _54.trim, 'call', _55 => _55()])) {
707
+ c++;
708
+ continue;
709
+ }
710
+ if (value || !u || !d || !upper || !lower || u.r !== first - 1 || d.r !== first || u.c !== c || d.c !== c || u.rs !== 1 || d.rs !== 1 || u.cs !== d.cs || !plain(upper) || !plain(lower) || !textOf(upper) || !textOf(lower)) return false;
711
+ value = { c, cs: u.cs, text: norm(textOf(upper) + textOf(lower)) };
712
+ c += u.cs;
713
+ }
714
+ if (!value || !context.length) return false;
715
+ const proof = [...context, value];
716
+ return table.cells.some((row, r) => r !== first - 1 && r !== first && proof.every((p) => {
717
+ const a = _optionalChain([owner, 'access', _56 => _56[r], 'optionalAccess', _57 => _57[p.c]]), cell = row[p.c];
718
+ return _optionalChain([a, 'optionalAccess', _58 => _58.r]) === r && a.c === p.c && a.rs === 1 && a.cs === p.cs && !!cell && plain(cell) && norm(textOf(cell)) === p.text;
719
+ }));
720
+ }
617
721
  function matchesCompleteSiblingRow(table, owner, first) {
618
722
  const pairs = [];
619
723
  for (let c = 0; c < table.cols; ) {
@@ -639,7 +743,7 @@ function matchesCompleteSiblingRow(table, owner, first) {
639
743
  const norm = (s, title) => (title ? s.replace(/^[가-힣]\.\s*/, "") : s).replace(/\s+/g, "");
640
744
  return table.cells.some((row, r) => r !== first - 1 && r !== first && pairs.every((p) => {
641
745
  const anchor = owner[r][p.c], peer = row[p.c];
642
- return _optionalChain([anchor, 'optionalAccess', _11 => _11.r]) === r && anchor.c === p.c && anchor.rs === 1 && anchor.cs === p.cs && plain(peer) && norm(textOf(peer), p === main) === norm(textOf(p.upper) + "\n" + textOf(p.lower), p === main);
746
+ return _optionalChain([anchor, 'optionalAccess', _59 => _59.r]) === r && anchor.c === p.c && anchor.rs === 1 && anchor.cs === p.cs && plain(peer) && norm(textOf(peer), p === main) === norm(textOf(p.upper) + "\n" + textOf(p.lower), p === main);
643
747
  }));
644
748
  }
645
749
  function matchesCompleteRubricRow(table, owner, first) {
@@ -673,7 +777,7 @@ function matchesCompleteRubricRow(table, owner, first) {
673
777
  return table.cells.some((row, r) => {
674
778
  if (r === first - 1 || r === first || !pairs.every((p) => {
675
779
  const a = owner[r][p.c];
676
- return _optionalChain([a, 'optionalAccess', _12 => _12.r]) === r && a.c === p.c && a.rs === 1 && a.cs === p.cs && plain(row[p.c]);
780
+ return _optionalChain([a, 'optionalAccess', _60 => _60.r]) === r && a.c === p.c && a.rs === 1 && a.cs === p.cs && plain(row[p.c]);
677
781
  })) return false;
678
782
  const peer = textOf(row[main.c]), peerMarks = items(peer);
679
783
  return peerMarks.length === marks.length && peerMarks.every((m, i) => m.n === marks[i].n) && values(row[score.c]).join("|") === scores.join("|") && norm(peer.slice(peerMarks[peerMarks.length - 1].at)) === tail;
@@ -695,11 +799,11 @@ function hasNumberedRowSequence(table, owner, first) {
695
799
  if (first < 3) return false;
696
800
  const rows = [first - 3, first - 2, first - 1, first];
697
801
  const separate = (c, cs) => rows.every((r) => {
698
- const a = _optionalChain([owner, 'access', _13 => _13[r], 'optionalAccess', _14 => _14[c]]), cell = _optionalChain([table, 'access', _15 => _15.cells, 'access', _16 => _16[r], 'optionalAccess', _17 => _17[c]]);
699
- return _optionalChain([a, 'optionalAccess', _18 => _18.r]) === r && a.c === c && a.rs === 1 && a.cs === cs && !!cell && plain(cell) && !!textOf(cell);
802
+ const a = _optionalChain([owner, 'access', _61 => _61[r], 'optionalAccess', _62 => _62[c]]), cell = _optionalChain([table, 'access', _63 => _63.cells, 'access', _64 => _64[r], 'optionalAccess', _65 => _65[c]]);
803
+ return _optionalChain([a, 'optionalAccess', _66 => _66.r]) === r && a.c === c && a.rs === 1 && a.cs === cs && !!cell && plain(cell) && !!textOf(cell);
700
804
  });
701
805
  for (let c = 0; c < table.cols; c++) {
702
- const a = _optionalChain([owner, 'access', _19 => _19[first], 'optionalAccess', _20 => _20[c]]);
806
+ const a = _optionalChain([owner, 'access', _67 => _67[first], 'optionalAccess', _68 => _68[c]]);
703
807
  if (!a || !separate(c, a.cs)) continue;
704
808
  const marks = rows.map((r) => {
705
809
  const lines = textOf(table.cells[r][c]).split("\n"), firstMark = itemMark(lines[0]);
@@ -708,7 +812,7 @@ function hasNumberedRowSequence(table, owner, first) {
708
812
  const head = marks[0];
709
813
  if (!head || marks.some((m, i) => !m || m.style !== head.style || m.n !== head.n + i)) continue;
710
814
  for (let d = 0; d < table.cols; d++) {
711
- const side = _optionalChain([owner, 'access', _21 => _21[first], 'optionalAccess', _22 => _22[d]]);
815
+ const side = _optionalChain([owner, 'access', _69 => _69[first], 'optionalAccess', _70 => _70[d]]);
712
816
  if (side && (d + side.cs <= c || d >= c + a.cs) && separate(d, side.cs)) return true;
713
817
  }
714
818
  }
@@ -781,7 +885,7 @@ var CELL_SPLITS = /* @__PURE__ */ new WeakMap();
781
885
  function relocate(src, dst, from = 0) {
782
886
  const out = [];
783
887
  for (const s of _nullishCoalesce(CELL_SPLITS.get(src), () => ( []))) {
784
- const at = dst.text.indexOf(src.text.slice(s.at, s.at + 20).trimEnd(), Math.max(from, _nullishCoalesce(_optionalChain([out, 'access', _23 => _23.at, 'call', _24 => _24(-1), 'optionalAccess', _25 => _25.at]), () => ( 0))));
888
+ const at = dst.text.indexOf(src.text.slice(s.at, s.at + 20).trimEnd(), Math.max(from, _nullishCoalesce(_optionalChain([out, 'access', _71 => _71.at, 'call', _72 => _72(-1), 'optionalAccess', _73 => _73.at]), () => ( 0))));
785
889
  if (at >= 0) out.push({ at, page: s.page });
786
890
  }
787
891
  return out;
@@ -805,7 +909,7 @@ function rowStarts(t) {
805
909
  const starts = [];
806
910
  for (let c = 0; c < t.cols; c++) {
807
911
  if (covered.has(r * 1e5 + c)) continue;
808
- const cell = _optionalChain([t, 'access', _26 => _26.cells, 'access', _27 => _27[r], 'optionalAccess', _28 => _28[c]]);
912
+ const cell = _optionalChain([t, 'access', _74 => _74.cells, 'access', _75 => _75[r], 'optionalAccess', _76 => _76[c]]);
809
913
  if (!cell) continue;
810
914
  for (let dr = 0; dr < cell.rowSpan; dr++) for (let dc = 0; dc < cell.colSpan; dc++) if (dr || dc) covered.add((r + dr) * 1e5 + c + dc);
811
915
  starts.push({ cell, c });
@@ -816,8 +920,8 @@ function rowStarts(t) {
816
920
  }
817
921
  var covering = (t, r) => rowStarts(t).slice(0, r + 1).flatMap((starts, rr) => starts.filter((s) => rr + s.cell.rowSpan > r).map((s) => s.cell));
818
922
  function cellPage(cell) {
819
- const p = _chunkMED2MR6Ocjs.CELL_PAGES.get(cell);
820
- if (p !== void 0 || !_optionalChain([cell, 'access', _29 => _29.blocks, 'optionalAccess', _30 => _30.length]) || cell.blocks.some((b) => b.pageNumber === void 0)) return p;
923
+ const p = _chunkK2NWHLCDcjs.CELL_PAGES.get(cell);
924
+ if (p !== void 0 || !_optionalChain([cell, 'access', _77 => _77.blocks, 'optionalAccess', _78 => _78.length]) || cell.blocks.some((b) => b.pageNumber === void 0)) return p;
821
925
  return Math.min(...cell.blocks.map((b) => b.pageNumber));
822
926
  }
823
927
  function tableRowPages(t, pageNumber) {
@@ -828,7 +932,7 @@ function tableRowPages(t, pageNumber) {
828
932
  for (const { cell } of starts) {
829
933
  const p = cellPage(cell);
830
934
  if (p !== void 0) mark = Math.max(_nullishCoalesce(mark, () => ( p)), p);
831
- else if (cell.text.trim() || _optionalChain([cell, 'access', _31 => _31.blocks, 'optionalAccess', _32 => _32.length])) text = true;
935
+ else if (cell.text.trim() || _optionalChain([cell, 'access', _79 => _79.blocks, 'optionalAccess', _80 => _80.length])) text = true;
832
936
  }
833
937
  const page = _nullishCoalesce(mark, () => ( (text ? pageNumber : prev)));
834
938
  prev = page !== void 0 && prev !== void 0 ? Math.max(prev, page) : _nullishCoalesce(page, () => ( prev));
@@ -845,8 +949,8 @@ function markJoinedPages(table, prev, curr) {
845
949
  rows.forEach((starts, r) => {
846
950
  const page2 = r < pt.rows ? pp[r] : cp[r - off];
847
951
  for (const { cell } of starts) {
848
- if (page2 !== void 0 && page2 !== prev.pageNumber) _chunkMED2MR6Ocjs.CELL_PAGES.set(cell, page2);
849
- const src = _optionalChain([(r < pt.rows ? ptRows[r] : ctRows[r - off]), 'optionalAccess', _33 => _33.find, 'call', _34 => _34((s) => s.cell !== cell && s.cell.text === cell.text && CELL_SPLITS.has(s.cell))]);
952
+ if (page2 !== void 0 && page2 !== prev.pageNumber) _chunkK2NWHLCDcjs.CELL_PAGES.set(cell, page2);
953
+ const src = _optionalChain([(r < pt.rows ? ptRows[r] : ctRows[r - off]), 'optionalAccess', _81 => _81.find, 'call', _82 => _82((s) => s.cell !== cell && s.cell.text === cell.text && CELL_SPLITS.has(s.cell))]);
850
954
  if (src) setSplits(cell, relocate(src.cell, cell));
851
955
  }
852
956
  });
@@ -856,7 +960,7 @@ function markJoinedPages(table, prev, curr) {
856
960
  for (const { cell } of ctRows[cr]) for (const b of _nullishCoalesce(cell.blocks, () => ( []))) b.pageNumber ??= page;
857
961
  const heads = covering(pt, pt.rows - 1);
858
962
  for (const cell of covering(table, pt.rows - 1)) {
859
- if (_optionalChain([cell, 'access', _35 => _35.blocks, 'optionalAccess', _36 => _36.length])) continue;
963
+ if (_optionalChain([cell, 'access', _83 => _83.blocks, 'optionalAccess', _84 => _84.length])) continue;
860
964
  const head = heads.filter((h) => h.text.trim() && cell.text.startsWith(h.text.trimEnd()) && cell.text.trim().length > h.text.trim().length).sort((a, b) => b.text.length - a.text.length)[0];
861
965
  if (!head) continue;
862
966
  const from = head.text.trimEnd().length;
@@ -867,7 +971,7 @@ function markJoinedPages(table, prev, curr) {
867
971
  }
868
972
  function splitCell(cell, page) {
869
973
  if (page === void 0) return null;
870
- if (_optionalChain([cell, 'access', _37 => _37.blocks, 'optionalAccess', _38 => _38.length])) {
974
+ if (_optionalChain([cell, 'access', _85 => _85.blocks, 'optionalAccess', _86 => _86.length])) {
871
975
  const k2 = cell.blocks.findIndex((b) => (_nullishCoalesce(b.pageNumber, () => ( page))) > page);
872
976
  if (k2 <= 0) return null;
873
977
  const head = cell.blocks.slice(0, k2), tail = cell.blocks.slice(k2);
@@ -894,8 +998,8 @@ function splitCrossPageRows(t, pageNumber) {
894
998
  if (!splits.length) continue;
895
999
  const clone = (cell, patch) => {
896
1000
  const out = { ...cell, ...patch };
897
- const p = _chunkMED2MR6Ocjs.CELL_PAGES.get(cell);
898
- if (p !== void 0) _chunkMED2MR6Ocjs.CELL_PAGES.set(out, p);
1001
+ const p = _chunkK2NWHLCDcjs.CELL_PAGES.get(cell);
1002
+ if (p !== void 0) _chunkK2NWHLCDcjs.CELL_PAGES.set(out, p);
899
1003
  if (!("text" in patch) && CELL_SPLITS.has(cell)) CELL_SPLITS.set(out, CELL_SPLITS.get(cell));
900
1004
  return out;
901
1005
  };
@@ -905,7 +1009,7 @@ function splitCrossPageRows(t, pageNumber) {
905
1009
  for (const { cell, c, split } of splits) {
906
1010
  cells[r][c] = clone(cell, split.head);
907
1011
  const tail = { ...cell, ...split.tail, rowSpan: 1 };
908
- _chunkMED2MR6Ocjs.CELL_PAGES.set(tail, split.page);
1012
+ _chunkK2NWHLCDcjs.CELL_PAGES.set(tail, split.page);
909
1013
  setSplits(tail, split.rest);
910
1014
  row[c] = tail;
911
1015
  }
@@ -947,7 +1051,7 @@ function anchorsOf(table) {
947
1051
  for (let r = 0; r < table.rows; r++) {
948
1052
  for (let c = 0; c < table.cols; c++) {
949
1053
  if (covered.has(r * 1e5 + c)) continue;
950
- const cell = _optionalChain([table, 'access', _39 => _39.cells, 'access', _40 => _40[r], 'optionalAccess', _41 => _41[c]]);
1054
+ const cell = _optionalChain([table, 'access', _87 => _87.cells, 'access', _88 => _88[r], 'optionalAccess', _89 => _89[c]]);
951
1055
  if (!cell) continue;
952
1056
  out.push({ r, c, rs: cell.rowSpan, cs: cell.colSpan, cell });
953
1057
  for (let dr = 0; dr < cell.rowSpan; dr++) {
@@ -1024,24 +1128,24 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
1024
1128
  if (r + dr < rows) owner[r + dr][dc] = placed;
1025
1129
  }
1026
1130
  grid[r][c1] = { ...a.cell, colSpan: c2 - c1, rowSpan: a.rs };
1027
- const lines = _chunkI4BS4BXEcjs.CELL_LINES.get(a.cell);
1028
- if (lines) _chunkI4BS4BXEcjs.CELL_LINES.set(grid[r][c1], shift ? lines.map((l) => ({ ...l, l: l.l + shift, r: l.r + shift })) : lines);
1029
- if (_chunkI4BS4BXEcjs.IMAGE_CELLS.has(a.cell)) _chunkI4BS4BXEcjs.IMAGE_CELLS.add(grid[r][c1]);
1030
- const edges = _chunkMED2MR6Ocjs.CELL_EDGES.get(a.cell);
1131
+ const lines = _chunk4X7AR4EHcjs.CELL_LINES.get(a.cell);
1132
+ if (lines) _chunk4X7AR4EHcjs.CELL_LINES.set(grid[r][c1], shift ? lines.map((l) => ({ ...l, l: l.l + shift, r: l.r + shift })) : lines);
1133
+ if (_chunk4X7AR4EHcjs.IMAGE_CELLS.has(a.cell)) _chunk4X7AR4EHcjs.IMAGE_CELLS.add(grid[r][c1]);
1134
+ const edges = _chunkK2NWHLCDcjs.CELL_EDGES.get(a.cell);
1031
1135
  if (edges) {
1032
- _chunkMED2MR6Ocjs.CELL_EDGES.set(grid[r][c1], edges);
1136
+ _chunkK2NWHLCDcjs.CELL_EDGES.set(grid[r][c1], edges);
1033
1137
  edged = true;
1034
1138
  }
1035
1139
  return true;
1036
1140
  };
1037
- for (const a of pa) if (!_chunkI4BS4BXEcjs.FILLER_CELLS.has(a.cell) && !place(a, pcx, 0)) return null;
1141
+ for (const a of pa) if (!_chunk4X7AR4EHcjs.FILLER_CELLS.has(a.cell) && !place(a, pcx, 0)) return null;
1038
1142
  for (const a of ca) {
1039
- if (a.r < skip || _chunkI4BS4BXEcjs.FILLER_CELLS.has(a.cell)) continue;
1143
+ if (a.r < skip || _chunk4X7AR4EHcjs.FILLER_CELLS.has(a.cell)) continue;
1040
1144
  if (!place(a, cxU, prev.rows - skip, dx)) return null;
1041
1145
  }
1042
1146
  const first = prev.rows;
1043
1147
  for (let c = 0; c < cols; c++) {
1044
- const above = _optionalChain([owner, 'access', _42 => _42[first - 1], 'optionalAccess', _43 => _43[c]]);
1148
+ const above = _optionalChain([owner, 'access', _90 => _90[first - 1], 'optionalAccess', _91 => _91[c]]);
1045
1149
  if (!above) continue;
1046
1150
  let r = first;
1047
1151
  while (r < rows && owner[r][c] === null) r++;
@@ -1060,9 +1164,9 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
1060
1164
  const grown = { ...above, rs: newRs };
1061
1165
  for (let rr = above.r; rr < above.r + newRs; rr++) for (let dc = above.c; dc < above.c + above.cs; dc++) owner[rr][dc] = grown;
1062
1166
  }
1063
- for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkI4BS4BXEcjs.FILLER_CELLS.add(grid[r][c]);
1167
+ for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunk4X7AR4EHcjs.FILLER_CELLS.add(grid[r][c]);
1064
1168
  if (edged) {
1065
- for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkMED2MR6Ocjs.CELL_EDGES.set(grid[r][c], _chunkI4BS4BXEcjs.NO_EDGES);
1169
+ for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkK2NWHLCDcjs.CELL_EDGES.set(grid[r][c], _chunk4X7AR4EHcjs.NO_EDGES);
1066
1170
  }
1067
1171
  for (let c = 0; c < cols && U[c + 1] <= pcx[0] + PART_COL_TOL; c++) {
1068
1172
  let r = prev.rows;
@@ -1071,7 +1175,7 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
1071
1175
  for (let rr = 0; rr < r; rr++) owner[rr][c] = through;
1072
1176
  }
1073
1177
  const table = { rows, cols, cells: grid, hasHeader: prev.hasHeader, ...prev.caption ? { caption: prev.caption } : {} };
1074
- const pr = _chunkI4BS4BXEcjs.ROW_RULES.get(prev), cr = _chunkI4BS4BXEcjs.ROW_RULES.get(curr);
1178
+ const pr = _chunk4X7AR4EHcjs.ROW_RULES.get(prev), cr = _chunk4X7AR4EHcjs.ROW_RULES.get(curr);
1075
1179
  const shifted = dx !== 0;
1076
1180
  const cut = {
1077
1181
  open: !!pr && !!cr && !pr.bottom && !cr.top && pr.innerOpen + cr.innerOpen === 0 && pr.innerRuled + cr.innerRuled > 0,
@@ -1082,7 +1186,7 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
1082
1186
  if (rows > prev.rows && !split && prevBottom !== void 0 && mergeStraddlingCells(table, owner, prev.rows, prevBottom, lex, U)) split = mergeSplitRow(table, owner, prev.rows, U, true, { ...cut, open: false });
1083
1187
  if (pr && cr) {
1084
1188
  const cutRuled = pr.bottom || cr.top;
1085
- _chunkI4BS4BXEcjs.ROW_RULES.set(table, { top: pr.top, bottom: cr.bottom, innerRuled: pr.innerRuled + cr.innerRuled + (!split && cutRuled ? 1 : 0), innerOpen: pr.innerOpen + cr.innerOpen + (!split && !cutRuled ? 1 : 0) });
1189
+ _chunk4X7AR4EHcjs.ROW_RULES.set(table, { top: pr.top, bottom: cr.bottom, innerRuled: pr.innerRuled + cr.innerRuled + (!split && cutRuled ? 1 : 0), innerOpen: pr.innerOpen + cr.innerOpen + (!split && !cutRuled ? 1 : 0) });
1086
1190
  }
1087
1191
  return { table, colXs: U, split, header: ca.filter((a) => a.r < skip && a.cell.text.trim()).length >= 2 };
1088
1192
  }
@@ -1143,19 +1247,19 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs) {
1143
1247
  c = u.c + u.cs;
1144
1248
  if (!d || d === u || u.r + u.rs - 1 !== last || d.r !== first || d.c !== u.c || d.cs !== u.cs) continue;
1145
1249
  const a = table.cells[u.r][u.c], b = table.cells[first][d.c];
1146
- const flowsOn = itemBreak && straddles && !!colXs && hasContent(a) && hasContent(b) && longLastLine(a) && !_chunkI4BS4BXEcjs.startsNewItem.call(void 0, a.text, b.text) && continuesAcross(a, b, colXs[u.c], colXs[u.c + u.cs]);
1147
- const openSeam = hasContent(a) && hasContent(b) && _chunkI4BS4BXEcjs.hasOpenCellSeam.call(void 0, a, b) && !owner.some((row, r) => {
1250
+ const flowsOn = itemBreak && straddles && !!colXs && hasContent(a) && hasContent(b) && longLastLine(a) && !_chunk4X7AR4EHcjs.startsNewItem.call(void 0, a.text, b.text) && continuesAcross(a, b, colXs[u.c], colXs[u.c + u.cs]);
1251
+ const openSeam = hasContent(a) && hasContent(b) && _chunk4X7AR4EHcjs.hasOpenCellSeam.call(void 0, a, b) && !owner.some((row, r) => {
1148
1252
  if (!r || r === first) return false;
1149
1253
  const up = owner[r - 1][u.c], down = row[u.c];
1150
1254
  if (!up || !down || up === down || up.c !== u.c || down.c !== u.c || up.cs !== u.cs || down.cs !== u.cs) return false;
1151
- const ue = _chunkMED2MR6Ocjs.CELL_EDGES.get(table.cells[up.r][up.c]), de = _chunkMED2MR6Ocjs.CELL_EDGES.get(table.cells[down.r][down.c]);
1255
+ const ue = _chunkK2NWHLCDcjs.CELL_EDGES.get(table.cells[up.r][up.c]), de = _chunkK2NWHLCDcjs.CELL_EDGES.get(table.cells[down.r][down.c]);
1152
1256
  return !!ue && !!de && !ue.b && !de.t;
1153
1257
  });
1154
1258
  if (!openSeam && !flowsOn && !crossed.has(shape(u, d)) && !(u.rs >= 2 && u.c + u.cs <= firstNew && hasContent(a) && !hasContent(b))) {
1155
1259
  if (!straddles && !midWord) continue;
1156
1260
  if (u.r >= last && d.rs < 2) continue;
1157
- const U = _chunkI4BS4BXEcjs.CELL_LINES.get(a);
1158
- if (!_optionalChain([U, 'optionalAccess', _44 => _44.length]) || !hasContent(b)) continue;
1261
+ const U = _chunk4X7AR4EHcjs.CELL_LINES.get(a);
1262
+ if (!_optionalChain([U, 'optionalAccess', _92 => _92.length]) || !hasContent(b)) continue;
1159
1263
  if (!(straddles && filledToBottom(U, prevBottom) && clauseContinues(a, b))) {
1160
1264
  if (U.length > STRADDLE_MAX_LINES) continue;
1161
1265
  const lu = U[U.length - 1];
@@ -1172,7 +1276,7 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs) {
1172
1276
  return merged;
1173
1277
  }
1174
1278
  function longLastLine(c) {
1175
- const L = _chunkI4BS4BXEcjs.CELL_LINES.get(c), l = _optionalChain([L, 'optionalAccess', _45 => _45[L.length - 1]]);
1279
+ const L = _chunk4X7AR4EHcjs.CELL_LINES.get(c), l = _optionalChain([L, 'optionalAccess', _93 => _93[L.length - 1]]);
1176
1280
  return !!l && l.r - l.l >= 6 * (l.h || 10);
1177
1281
  }
1178
1282
  function filledToBottom(U, bottom) {
@@ -1205,8 +1309,8 @@ function nextItemHead(prev, next) {
1205
1309
  return false;
1206
1310
  }
1207
1311
  function continuesAcross(u, d, x1, x2) {
1208
- const U = _chunkI4BS4BXEcjs.CELL_LINES.get(u), D = _chunkI4BS4BXEcjs.CELL_LINES.get(d);
1209
- if (!_optionalChain([U, 'optionalAccess', _46 => _46.length]) || !_optionalChain([D, 'optionalAccess', _47 => _47.length])) return false;
1312
+ const U = _chunk4X7AR4EHcjs.CELL_LINES.get(u), D = _chunk4X7AR4EHcjs.CELL_LINES.get(d);
1313
+ if (!_optionalChain([U, 'optionalAccess', _94 => _94.length]) || !_optionalChain([D, 'optionalAccess', _95 => _95.length])) return false;
1210
1314
  const last = U[U.length - 1];
1211
1315
  const fs = last.h || 10;
1212
1316
  let minL = Infinity, maxR = -Infinity;
@@ -1223,7 +1327,7 @@ function continuesAcross(u, d, x1, x2) {
1223
1327
  if (U.length === 1 && x2 - last.r > Math.max(FULL_LINE_EDGE_MIN, SINGLE_LINE_WORD_GAP * fs)) return false;
1224
1328
  const indented = last.l - minL >= HANGING_MIN * fs;
1225
1329
  if (last.r - last.l < FULL_LINE_MIN_FRAC * (indented ? x2 - last.l : x2 - x1)) return false;
1226
- const newItem = _chunkI4BS4BXEcjs.startsNewItem.call(void 0, u.text, d.text);
1330
+ const newItem = _chunk4X7AR4EHcjs.startsNewItem.call(void 0, u.text, d.text);
1227
1331
  const all = D.length ? U.concat(D) : U;
1228
1332
  const leftAligned = (l) => maxR - l.r > SHORT_LINE_GAP * fs && (l.l - minL <= fs || !newItem && all.some((o) => o !== l && Math.abs(o.l - l.l) <= HANGING_TOL && Math.abs(o.r - l.r) >= HANGING_MIN * fs));
1229
1333
  const hanging = U.length >= 2 && U.every((l) => maxR - l.r <= FULL_LINE_TOL * fs) && indented && Math.abs(D[0].l - last.l) <= HANGING_TOL;
@@ -1240,12 +1344,12 @@ function outlineContinues(u, d) {
1240
1344
  return U.length >= 2 && D.length >= 1 && U.some((l) => OUTLINE_HEAD.test(l)) && OUTLINE_ITEM.test(D[0]);
1241
1345
  }
1242
1346
  function lineEnded(c, x1, x2, next) {
1243
- const L = _chunkI4BS4BXEcjs.CELL_LINES.get(c);
1347
+ const L = _chunk4X7AR4EHcjs.CELL_LINES.get(c);
1244
1348
  if (!L || L.length !== 1) return false;
1245
1349
  const l = L[0], h = l.h || 10;
1246
- const d0 = next ? _optionalChain([_chunkI4BS4BXEcjs.CELL_LINES, 'access', _48 => _48.get, 'call', _49 => _49(next), 'optionalAccess', _50 => _50[0]]) : void 0;
1350
+ const d0 = next ? _optionalChain([_chunk4X7AR4EHcjs.CELL_LINES, 'access', _96 => _96.get, 'call', _97 => _97(next), 'optionalAccess', _98 => _98[0]]) : void 0;
1247
1351
  if (d0 && d0.l - l.l >= HANGING_MIN * h) return false;
1248
- return x2 - l.r - (l.l - x1) >= Math.max(LABEL_ROOM, firstWordUnits(_nullishCoalesce(_optionalChain([next, 'optionalAccess', _51 => _51.text]), () => ( "")))) * h;
1352
+ return x2 - l.r - (l.l - x1) >= Math.max(LABEL_ROOM, firstWordUnits(_nullishCoalesce(_optionalChain([next, 'optionalAccess', _99 => _99.text]), () => ( "")))) * h;
1249
1353
  }
1250
1354
  function firstWordUnits(text) {
1251
1355
  const word = _nullishCoalesce(flowText(text).trim().replace(/^([(\[「『<〈])\s+/, "$1").split(/\s+/)[0], () => ( ""));
@@ -1254,15 +1358,15 @@ function firstWordUnits(text) {
1254
1358
  return units;
1255
1359
  }
1256
1360
  function appendCell(a, b) {
1257
- if (_chunkI4BS4BXEcjs.IMAGE_CELLS.has(b)) _chunkI4BS4BXEcjs.IMAGE_CELLS.add(a);
1258
- if (_optionalChain([a, 'access', _52 => _52.blocks, 'optionalAccess', _53 => _53.length]) || _optionalChain([b, 'access', _54 => _54.blocks, 'optionalAccess', _55 => _55.length])) {
1259
- const asBlocks = (c) => _optionalChain([c, 'access', _56 => _56.blocks, 'optionalAccess', _57 => _57.length]) ? c.blocks : c.text.split("\n").map((l) => l.trim()).filter(Boolean).map((text) => ({ type: "paragraph", text }));
1361
+ if (_chunk4X7AR4EHcjs.IMAGE_CELLS.has(b)) _chunk4X7AR4EHcjs.IMAGE_CELLS.add(a);
1362
+ if (_optionalChain([a, 'access', _100 => _100.blocks, 'optionalAccess', _101 => _101.length]) || _optionalChain([b, 'access', _102 => _102.blocks, 'optionalAccess', _103 => _103.length])) {
1363
+ const asBlocks = (c) => _optionalChain([c, 'access', _104 => _104.blocks, 'optionalAccess', _105 => _105.length]) ? c.blocks : c.text.split("\n").map((l) => l.trim()).filter(Boolean).map((text) => ({ type: "paragraph", text }));
1260
1364
  a.blocks = [...asBlocks(a), ...asBlocks(b)];
1261
1365
  }
1262
1366
  if (b.text.trim()) a.text = a.text.trim() ? a.text + "\n" + b.text : b.text;
1263
- _chunkI4BS4BXEcjs.joinCellEdges.call(void 0, a, b);
1367
+ _chunk4X7AR4EHcjs.joinCellEdges.call(void 0, a, b);
1264
1368
  }
1265
- var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _58 => _58.blocks, 'optionalAccess', _59 => _59.length]) || _chunkI4BS4BXEcjs.IMAGE_CELLS.has(cell);
1369
+ var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _106 => _106.blocks, 'optionalAccess', _107 => _107.length]) || _chunk4X7AR4EHcjs.IMAGE_CELLS.has(cell);
1266
1370
  var CLAUSE_OPEN_ENDING = /(?:하는|되는|하고|하며|하여|되어|되고|되며|이며|으며|어야|아야|여야)$/;
1267
1371
  var batchim = (ch) => {
1268
1372
  const k = ch.charCodeAt(0) - 44032;
@@ -1270,7 +1374,7 @@ var batchim = (ch) => {
1270
1374
  };
1271
1375
  function clauseContinues(u, d) {
1272
1376
  const tail = _nullishCoalesce(flowText(u.text).trim().split(/\s+/).pop(), () => ( "")), head = flowText(d.text).trim();
1273
- if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) || _chunkI4BS4BXEcjs.startsNewItem.call(void 0, u.text, head)) return false;
1377
+ if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) || _chunk4X7AR4EHcjs.startsNewItem.call(void 0, u.text, head)) return false;
1274
1378
  const last = tail[tail.length - 1], before = tail[tail.length - 2];
1275
1379
  return last === "\uC744" && batchim(before) || last === "\uB97C" && !batchim(before) || CLAUSE_OPEN_ENDING.test(tail);
1276
1380
  }
@@ -1278,8 +1382,8 @@ function quantityContinues(u, d) {
1278
1382
  return /\d[\d,.]*\s*(?:%|[가-힣]{1,2})?$/.test(flowText(u.text).trim()) && /^(?:미만|이상|이하|초과)(?![가-힣])/.test(flowText(d.text).trim());
1279
1383
  }
1280
1384
  function wordOverflows(u, d, x1, x2) {
1281
- const U = _chunkI4BS4BXEcjs.CELL_LINES.get(u);
1282
- if (!_optionalChain([U, 'optionalAccess', _60 => _60.length]) || _chunkI4BS4BXEcjs.startsNewItem.call(void 0, u.text, d.text)) return false;
1385
+ const U = _chunk4X7AR4EHcjs.CELL_LINES.get(u);
1386
+ if (!_optionalChain([U, 'optionalAccess', _108 => _108.length]) || _chunk4X7AR4EHcjs.startsNewItem.call(void 0, u.text, d.text)) return false;
1283
1387
  const last = U[U.length - 1], units = firstWordUnits(d.text);
1284
1388
  return units > 0 && last.r - last.l + units * (last.h || 10) > x2 - x1;
1285
1389
  }
@@ -1289,7 +1393,7 @@ function listContinues(u, d, multi = false) {
1289
1393
  const marks = u.text.split("\n").map((l) => itemMark(l.trim()));
1290
1394
  let last = -1, count = 0;
1291
1395
  marks.forEach((m, i) => {
1292
- if (_optionalChain([m, 'optionalAccess', _61 => _61.style]) === head.style) {
1396
+ if (_optionalChain([m, 'optionalAccess', _109 => _109.style]) === head.style) {
1293
1397
  last = i;
1294
1398
  count++;
1295
1399
  }
@@ -1331,18 +1435,19 @@ function mergeSplitRow(table, owner, first, colXs, textOnly = false, cut = NO_CU
1331
1435
  return a !== null && b === a + 1;
1332
1436
  })) return false;
1333
1437
  if (cut.ruled && hasNumberedRowSequence(table, owner, first)) return false;
1438
+ if (cut.ruled && matchesIndependentRowPair(table, owner, first)) return false;
1334
1439
  const contentPairs = pairs.filter(([u, d]) => hasContent(u.cell) && hasContent(d.cell));
1335
1440
  const carriedSplit = !textOnly && carried && !newCell && (contentPairs.length <= 1 || contentPairs.every(([, d]) => d.rs > 1) || !cut.ruled && contentPairs.some(([u, d]) => wordOverflows(cell(u), cell(d), colXs[u.c], colXs[u.c + u.cs])));
1336
1441
  if (!carriedSplit) {
1337
1442
  const norm = (c) => flowText(c.text).replace(/\s+/g, "");
1338
1443
  if (pairs.some(([u, d]) => hasContent(d.cell) && norm(cell(d)) !== norm(cell(u)) && lineEnded(cell(u), colXs[u.c], colXs[u.c + u.cs], cell(d)))) return false;
1339
- const oneLine = (c) => _optionalChain([_chunkI4BS4BXEcjs.CELL_LINES, 'access', _62 => _62.get, 'call', _63 => _63(c), 'optionalAccess', _64 => _64.length]) === 1;
1444
+ const oneLine = (c) => _optionalChain([_chunk4X7AR4EHcjs.CELL_LINES, 'access', _110 => _110.get, 'call', _111 => _111(c), 'optionalAccess', _112 => _112.length]) === 1;
1340
1445
  if (pairs.some(([u, d]) => nextItemHead(cell(u).text, cell(d).text)) && pairs.some(([u, d]) => hasContent(u.cell) && hasContent(d.cell) && oneLine(cell(u)) && oneLine(cell(d)) && norm(cell(u)) !== norm(cell(d)))) return false;
1341
1446
  const flows = ([u, d]) => continuesAcross(cell(u), cell(d), colXs[u.c], colXs[u.c + u.cs]) || clauseContinues(cell(u), cell(d)) || quantityContinues(cell(u), cell(d));
1342
1447
  if (!(cut.open && !newCell)) {
1343
1448
  if (pairs.some((p) => p[1].rs > 1 && !flows(p))) return false;
1344
1449
  const one = pairs.filter(([, d]) => d.rs === 1);
1345
- if (!matchesCompleteSiblingRow(table, owner, first) && !matchesCompleteRubricRow(table, owner, first) && !outlineOnly(pairs, cell) && !one.some(flows) && (cut.list === "none" || !one.some(([u, d]) => listContinues(cell(u), cell(d), cut.list === "multi")))) return false;
1450
+ if (!matchesCompleteSiblingRow(table, owner, first) && !matchesCompleteRubricRow(table, owner, first) && !(cut.ruled && (matchesCompleteContextRow(table, owner, first) || matchesCompleteAlignedLabelListRow(table, owner, first))) && !outlineOnly(pairs, cell) && !one.some(flows) && (cut.list === "none" || !one.some(([u, d]) => listContinues(cell(u), cell(d), cut.list === "multi")))) return false;
1346
1451
  }
1347
1452
  }
1348
1453
  for (const [u, d] of pairs) {
@@ -1367,8 +1472,8 @@ function besideOwn(b, p, c) {
1367
1472
  }
1368
1473
  var PAGE_NUMBER_TEXT = /^[-–—]?\s*\d{1,4}\s*[-–—]?$/;
1369
1474
  function pageNumberBetween(b, p, c, pageHeights) {
1370
- if (b.type !== "paragraph" || !b.bbox || !PAGE_NUMBER_TEXT.test(_nullishCoalesce(_optionalChain([b, 'access', _65 => _65.text, 'optionalAccess', _66 => _66.trim, 'call', _67 => _67()]), () => ( "")))) return false;
1371
- const h = b.pageNumber ? _optionalChain([pageHeights, 'optionalAccess', _68 => _68.get, 'call', _69 => _69(b.pageNumber)]) : void 0;
1475
+ if (b.type !== "paragraph" || !b.bbox || !PAGE_NUMBER_TEXT.test(_nullishCoalesce(_optionalChain([b, 'access', _113 => _113.text, 'optionalAccess', _114 => _114.trim, 'call', _115 => _115()]), () => ( "")))) return false;
1476
+ const h = b.pageNumber ? _optionalChain([pageHeights, 'optionalAccess', _116 => _116.get, 'call', _117 => _117(b.pageNumber)]) : void 0;
1372
1477
  if (!h) return false;
1373
1478
  if (b.pageNumber === p.pageNumber) return b.bbox.y + b.bbox.height <= Math.min(p.bbox.y, h * PAGE_EDGE_BAND) + 1;
1374
1479
  if (b.pageNumber === c.pageNumber) return b.bbox.y >= Math.max(c.bbox.y + c.bbox.height, h * (1 - PAGE_EDGE_BAND)) - 1;
@@ -1392,7 +1497,7 @@ function insideTable(b, t) {
1392
1497
  return b.bbox.x >= o.x - 1 && b.bbox.x + b.bbox.width <= o.x + o.width + 1 && b.bbox.y >= o.y - 1 && b.bbox.y + b.bbox.height <= o.y + o.height + 1;
1393
1498
  }
1394
1499
  function startsWithUnitRow(table) {
1395
- return /^\s*\(\s*단위\s*[::]/.test(_nullishCoalesce(_optionalChain([table, 'access', _70 => _70.cells, 'access', _71 => _71[0], 'optionalAccess', _72 => _72[0], 'optionalAccess', _73 => _73.text]), () => ( ""))) && _optionalChain([table, 'access', _74 => _74.cells, 'access', _75 => _75[0], 'optionalAccess', _76 => _76.slice, 'call', _77 => _77(1), 'access', _78 => _78.every, 'call', _79 => _79((c) => !c.text.trim())]);
1500
+ return /^\s*\(\s*단위\s*[::]/.test(_nullishCoalesce(_optionalChain([table, 'access', _118 => _118.cells, 'access', _119 => _119[0], 'optionalAccess', _120 => _120[0], 'optionalAccess', _121 => _121.text]), () => ( ""))) && _optionalChain([table, 'access', _122 => _122.cells, 'access', _123 => _123[0], 'optionalAccess', _124 => _124.slice, 'call', _125 => _125(1), 'access', _126 => _126.every, 'call', _127 => _127((c) => !c.text.trim())]);
1396
1501
  }
1397
1502
  function sameHeadShape(a, b) {
1398
1503
  if (!a || !b || a.length !== b.length) return false;
@@ -1404,7 +1509,7 @@ function sameHeadShape(a, b) {
1404
1509
  return tall;
1405
1510
  }
1406
1511
  function hasBoxTitle(t) {
1407
- const titles = _nullishCoalesce(_optionalChain([t, 'access', _80 => _80.cells, 'access', _81 => _81[0], 'optionalAccess', _82 => _82.filter, 'call', _83 => _83((c) => c.text.trim())]), () => ( []));
1512
+ const titles = _nullishCoalesce(_optionalChain([t, 'access', _128 => _128.cells, 'access', _129 => _129[0], 'optionalAccess', _130 => _130.filter, 'call', _131 => _131((c) => c.text.trim())]), () => ( []));
1408
1513
  if (titles.length !== 1 || titles[0].rowSpan < 2) return false;
1409
1514
  const body = t.cells[titles[0].rowSpan];
1410
1515
  return !!body && body[0].colSpan === t.cols && !!body[0].text.trim();
@@ -1418,7 +1523,7 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
1418
1523
  const skip = (b) => b.type !== "table" || [blocks[i], tail].some((t) => insideTable(b, t) || leftColumnOf(b, t));
1419
1524
  while (j < blocks.length && skip(blocks[j]) && (_nullishCoalesce(blocks[j].pageNumber, () => ( 0))) <= tail.pageNumber + 1) j++;
1420
1525
  const curr = blocks[j];
1421
- const prev = tail !== blocks[i] && _optionalChain([curr, 'optionalAccess', _84 => _84.pageNumber]) === tail.pageNumber ? blocks[i] : tail;
1526
+ const prev = tail !== blocks[i] && _optionalChain([curr, 'optionalAccess', _132 => _132.pageNumber]) === tail.pageNumber ? blocks[i] : tail;
1422
1527
  if (!prev.table || !prev.bbox || !prev.pageNumber) continue;
1423
1528
  if (!curr || curr.type !== "table" || !curr.table || !curr.bbox || curr.pageNumber !== prev.pageNumber + 1) continue;
1424
1529
  if (startsWithUnitRow(prev.table) && startsWithUnitRow(curr.table)) continue;
@@ -1428,19 +1533,19 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
1428
1533
  placeJoined(blocks, i, j, joined);
1429
1534
  continue;
1430
1535
  }
1431
- if (_chunkI4BS4BXEcjs.EMPTY_PARTS.has(curr.table)) {
1536
+ if (_chunk4X7AR4EHcjs.EMPTY_PARTS.has(curr.table)) {
1432
1537
  blocks.splice(j, 1);
1433
1538
  i++;
1434
1539
  continue;
1435
1540
  }
1436
1541
  if (joined === null) continue;
1437
- if (prev.table.cols !== curr.table.cols || prev.table.renderAsTable !== curr.table.renderAsTable || _chunkI4BS4BXEcjs.EMPTY_PARTS.has(prev.table)) continue;
1542
+ if (prev.table.cols !== curr.table.cols || prev.table.renderAsTable !== curr.table.renderAsTable || _chunk4X7AR4EHcjs.EMPTY_PARTS.has(prev.table)) continue;
1438
1543
  const width = Math.max(prev.bbox.width, curr.bbox.width, 1);
1439
1544
  const leftDiff = Math.abs(prev.bbox.x - curr.bbox.x);
1440
1545
  const rightDiff = Math.abs(prev.bbox.x + prev.bbox.width - (curr.bbox.x + curr.bbox.width));
1441
1546
  if (leftDiff > width * NEIGHBOR_TABLE_EPSILON || rightDiff > width * NEIGHBOR_TABLE_EPSILON) continue;
1442
- const px = _chunkI4BS4BXEcjs.TABLE_COLXS.get(prev.table), cx = _chunkI4BS4BXEcjs.TABLE_COLXS.get(curr.table);
1443
- if (px && cx && !shiftedSame(px, cx, !_chunkI4BS4BXEcjs.CLIP_TABLES.has(prev.table) && !_chunkI4BS4BXEcjs.CLIP_TABLES.has(curr.table))) continue;
1547
+ const px = _chunk4X7AR4EHcjs.TABLE_COLXS.get(prev.table), cx = _chunk4X7AR4EHcjs.TABLE_COLXS.get(curr.table);
1548
+ if (px && cx && !shiftedSame(px, cx, !_chunk4X7AR4EHcjs.CLIP_TABLES.has(prev.table) && !_chunk4X7AR4EHcjs.CLIP_TABLES.has(curr.table))) continue;
1444
1549
  if (!rowTextsEqual(prev.table.cells[0], curr.table.cells[0]) && sameHeadShape(prev.table.cells[0], curr.table.cells[0])) continue;
1445
1550
  let currCells = curr.table.cells;
1446
1551
  const headRows = repeatedHeaderRows(prev.table, curr.table);
@@ -1451,16 +1556,16 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
1451
1556
  blocks.splice(j, 1);
1452
1557
  continue;
1453
1558
  }
1454
- if (px && cx && !_chunkI4BS4BXEcjs.CLIP_TABLES.has(prev.table) && !_chunkI4BS4BXEcjs.CLIP_TABLES.has(curr.table) && currCells.length < curr.table.cells.length && curr.table.cells[0].filter((c) => c.text.trim()).length >= 2 && prev.table.cells.at(-1).concat(currCells[0]).every((c) => c.rowSpan === 1 && c.colSpan === 1 && _chunkI4BS4BXEcjs.CELL_LINES.has(c))) {
1559
+ if (px && cx && !_chunk4X7AR4EHcjs.CLIP_TABLES.has(prev.table) && !_chunk4X7AR4EHcjs.CLIP_TABLES.has(curr.table) && currCells.length < curr.table.cells.length && curr.table.cells[0].filter((c) => c.text.trim()).length >= 2 && prev.table.cells.at(-1).concat(currCells[0]).every((c) => c.rowSpan === 1 && c.colSpan === 1 && _chunk4X7AR4EHcjs.CELL_LINES.has(c))) {
1455
1560
  const dx = px[0] - cx[0];
1456
1561
  const part = joinSplitParts(prev.table, px, curr.table, cx.map((x) => x + dx), dx, void 0, lex);
1457
- if (_optionalChain([part, 'optionalAccess', _85 => _85.split]) && part.table.rows === prev.table.rows + currCells.length - 1) {
1562
+ if (_optionalChain([part, 'optionalAccess', _133 => _133.split]) && part.table.rows === prev.table.rows + currCells.length - 1) {
1458
1563
  const last = prev.table.rows - 1;
1459
1564
  for (let c = 0; c < part.table.cols; c++) {
1460
- const U = _chunkI4BS4BXEcjs.CELL_LINES.get(prev.table.cells[last][c]), D = _chunkI4BS4BXEcjs.CELL_LINES.get(currCells[0][c]);
1461
- _chunkI4BS4BXEcjs.CELL_LINES.set(part.table.cells[last][c], U.concat(D.map((l) => ({ ...l, l: l.l + dx, r: l.r + dx }))));
1565
+ const U = _chunk4X7AR4EHcjs.CELL_LINES.get(prev.table.cells[last][c]), D = _chunk4X7AR4EHcjs.CELL_LINES.get(currCells[0][c]);
1566
+ _chunk4X7AR4EHcjs.CELL_LINES.set(part.table.cells[last][c], U.concat(D.map((l) => ({ ...l, l: l.l + dx, r: l.r + dx }))));
1462
1567
  }
1463
- _chunkI4BS4BXEcjs.TABLE_COLXS.set(part.table, part.colXs);
1568
+ _chunk4X7AR4EHcjs.TABLE_COLXS.set(part.table, part.colXs);
1464
1569
  placeJoined(blocks, i, j, part.table);
1465
1570
  continue;
1466
1571
  }
@@ -1473,20 +1578,20 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
1473
1578
  caption: prev.table.caption,
1474
1579
  ...prev.table.renderAsTable ? { renderAsTable: true } : {}
1475
1580
  };
1476
- if (_nullishCoalesce(px, () => ( cx))) _chunkI4BS4BXEcjs.TABLE_COLXS.set(merged, _nullishCoalesce(px, () => ( cx)));
1477
- if (_chunkI4BS4BXEcjs.CLIP_TABLES.has(prev.table) || _chunkI4BS4BXEcjs.CLIP_TABLES.has(curr.table)) _chunkI4BS4BXEcjs.CLIP_TABLES.add(merged);
1581
+ if (_nullishCoalesce(px, () => ( cx))) _chunk4X7AR4EHcjs.TABLE_COLXS.set(merged, _nullishCoalesce(px, () => ( cx)));
1582
+ if (_chunk4X7AR4EHcjs.CLIP_TABLES.has(prev.table) || _chunk4X7AR4EHcjs.CLIP_TABLES.has(curr.table)) _chunk4X7AR4EHcjs.CLIP_TABLES.add(merged);
1478
1583
  placeJoined(blocks, i, j, merged);
1479
1584
  }
1480
1585
  for (let i = blocks.length - 1; i >= 0; i--) {
1481
1586
  const t = blocks[i].table;
1482
- if (blocks[i].type === "table" && t && _chunkI4BS4BXEcjs.EMPTY_PARTS.has(t)) blocks.splice(i, 1);
1587
+ if (blocks[i].type === "table" && t && _chunk4X7AR4EHcjs.EMPTY_PARTS.has(t)) blocks.splice(i, 1);
1483
1588
  }
1484
1589
  }
1485
1590
  function mergeColumnFlow(blocks, pageHeights, lex) {
1486
1591
  if (!pageHeights) return;
1487
1592
  for (let i = 0; i < blocks.length; i++) {
1488
1593
  const L = blocks[i];
1489
- if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !_chunkI4BS4BXEcjs.CLIP_TABLES.has(L.table) || _chunkI4BS4BXEcjs.EMPTY_PARTS.has(L.table)) continue;
1594
+ if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !_chunk4X7AR4EHcjs.CLIP_TABLES.has(L.table) || _chunk4X7AR4EHcjs.EMPTY_PARTS.has(L.table)) continue;
1490
1595
  const ph = pageHeights.get(L.pageNumber);
1491
1596
  if (!ph || L.bbox.y > ph * PAGE_EDGE_BAND) continue;
1492
1597
  let s0 = i, s1 = i;
@@ -1515,12 +1620,12 @@ function mergeColumnFlow(blocks, pageHeights, lex) {
1515
1620
  }
1516
1621
  function joinClipParts(prev, curr, pageHeights, lex) {
1517
1622
  const pt = prev.table, ct = curr.table;
1518
- if (!_chunkI4BS4BXEcjs.CLIP_TABLES.has(pt) || !_chunkI4BS4BXEcjs.CLIP_TABLES.has(ct)) return null;
1519
- const px = _chunkI4BS4BXEcjs.TABLE_COLXS.get(pt), cx = _chunkI4BS4BXEcjs.TABLE_COLXS.get(ct);
1623
+ if (!_chunk4X7AR4EHcjs.CLIP_TABLES.has(pt) || !_chunk4X7AR4EHcjs.CLIP_TABLES.has(ct)) return null;
1624
+ const px = _chunk4X7AR4EHcjs.TABLE_COLXS.get(pt), cx = _chunk4X7AR4EHcjs.TABLE_COLXS.get(ct);
1520
1625
  if (!px || !cx) return null;
1521
1626
  let xs = cx, shifted = false, dx = 0, foreign = false, within = false;
1522
1627
  if (!shiftedSame(px, cx, false)) {
1523
- if (!_optionalChain([pageHeights, 'optionalAccess', _86 => _86.get, 'call', _87 => _87(prev.pageNumber)]) || !_optionalChain([pageHeights, 'optionalAccess', _88 => _88.get, 'call', _89 => _89(curr.pageNumber)])) return null;
1628
+ if (!_optionalChain([pageHeights, 'optionalAccess', _134 => _134.get, 'call', _135 => _135(prev.pageNumber)]) || !_optionalChain([pageHeights, 'optionalAccess', _136 => _136.get, 'call', _137 => _137(curr.pageNumber)])) return null;
1524
1629
  dx = px[px.length - 1] - cx[cx.length - 1];
1525
1630
  within = Math.abs(dx) > CONTINUATION_COL_TOL && cx.length >= 3 && cx.every((x) => px.some((p) => Math.abs(p - x) <= CONTINUATION_COL_TOL));
1526
1631
  if (Math.abs(dx) > CONTINUATION_COL_TOL && !within) {
@@ -1532,19 +1637,19 @@ function joinClipParts(prev, curr, pageHeights, lex) {
1532
1637
  const inner = b.slice(1, -1).map((x) => x + dx);
1533
1638
  return inner.length > 0 && !inner.some((x) => px.some((p) => Math.abs(p - x) <= CONTINUATION_COL_TOL));
1534
1639
  };
1535
- foreign = unrelated(cx) && unrelated(_nullishCoalesce(_chunkI4BS4BXEcjs.PART_COLXS.get(ct), () => ( cx))) && (headingRow(_nullishCoalesce(ct.cells[0], () => ( []))) || px.length > FOREIGN_FIRST_ROW_CELLS && anchorsOf(ct).filter((a) => a.r === 0).length >= FOREIGN_FIRST_ROW_CELLS);
1640
+ foreign = unrelated(cx) && unrelated(_nullishCoalesce(_chunk4X7AR4EHcjs.PART_COLXS.get(ct), () => ( cx))) && (headingRow(_nullishCoalesce(ct.cells[0], () => ( []))) || px.length > FOREIGN_FIRST_ROW_CELLS && anchorsOf(ct).filter((a) => a.r === 0).length >= FOREIGN_FIRST_ROW_CELLS);
1536
1641
  }
1537
- const res = joinSplitParts(pt, px, ct, xs, dx, _optionalChain([prev, 'access', _90 => _90.bbox, 'optionalAccess', _91 => _91.y]), lex);
1642
+ const res = joinSplitParts(pt, px, ct, xs, dx, _optionalChain([prev, 'access', _138 => _138.bbox, 'optionalAccess', _139 => _139.y]), lex);
1538
1643
  if (!res || (shifted || foreign || within) && !res.split && !res.header) return null;
1539
- _chunkI4BS4BXEcjs.TABLE_COLXS.set(res.table, res.colXs);
1540
- const ys = _chunkI4BS4BXEcjs.TABLE_ROWYS.get(pt);
1541
- if (ys) _chunkI4BS4BXEcjs.TABLE_ROWYS.set(res.table, ys);
1542
- _chunkI4BS4BXEcjs.PART_COLXS.set(res.table, _nullishCoalesce(_chunkI4BS4BXEcjs.PART_COLXS.get(pt), () => ( px)));
1543
- _chunkI4BS4BXEcjs.CLIP_TABLES.add(res.table);
1644
+ _chunk4X7AR4EHcjs.TABLE_COLXS.set(res.table, res.colXs);
1645
+ const ys = _chunk4X7AR4EHcjs.TABLE_ROWYS.get(pt);
1646
+ if (ys) _chunk4X7AR4EHcjs.TABLE_ROWYS.set(res.table, ys);
1647
+ _chunk4X7AR4EHcjs.PART_COLXS.set(res.table, _nullishCoalesce(_chunk4X7AR4EHcjs.PART_COLXS.get(pt), () => ( px)));
1648
+ _chunk4X7AR4EHcjs.CLIP_TABLES.add(res.table);
1544
1649
  return res.table;
1545
1650
  }
1546
1651
  function prevLacksLeftCols(prev, px, xs, pageHeights) {
1547
- const ph = _optionalChain([pageHeights, 'optionalAccess', _92 => _92.get, 'call', _93 => _93(prev.pageNumber)]);
1652
+ const ph = _optionalChain([pageHeights, 'optionalAccess', _140 => _140.get, 'call', _141 => _141(prev.pageNumber)]);
1548
1653
  if (!ph || prev.bbox.y + prev.bbox.height < ph * (1 - PAGE_EDGE_BAND)) return false;
1549
1654
  return xs[0] < px[0] && xs.slice(1, -1).some((x) => Math.abs(x - px[0]) <= CONTINUATION_COL_TOL);
1550
1655
  }
@@ -1555,21 +1660,21 @@ function headingRow(row) {
1555
1660
  }
1556
1661
  var ANNEX_HEAD_RE = /^\s*[<\[(【]?\s*(?:붙\s*임|참\s*고|별\s*첨|별\s*지|별\s*표|첨\s*부|부\s*록)(?:\s*\d|\s*$|\s*[>\])】])|^\s*■/;
1557
1662
  function looksContinued(prev, curr, pageHeights) {
1558
- const ph = _optionalChain([pageHeights, 'optionalAccess', _94 => _94.get, 'call', _95 => _95(prev.pageNumber)]), ch = _optionalChain([pageHeights, 'optionalAccess', _96 => _96.get, 'call', _97 => _97(curr.pageNumber)]);
1663
+ const ph = _optionalChain([pageHeights, 'optionalAccess', _142 => _142.get, 'call', _143 => _143(prev.pageNumber)]), ch = _optionalChain([pageHeights, 'optionalAccess', _144 => _144.get, 'call', _145 => _145(curr.pageNumber)]);
1559
1664
  if (ph && ch && (prev.bbox.y > ph * PAGE_EDGE_BAND && !pushedLead(prev, curr) || curr.bbox.y + curr.bbox.height < ch * (1 - PAGE_EDGE_BAND))) return false;
1560
1665
  const firstRow = _nullishCoalesce(curr.table.cells[0], () => ( []));
1561
- const firstText = _nullishCoalesce(_optionalChain([firstRow, 'access', _98 => _98.find, 'call', _99 => _99((c) => c.text.trim()), 'optionalAccess', _100 => _100.text]), () => ( ""));
1666
+ const firstText = _nullishCoalesce(_optionalChain([firstRow, 'access', _146 => _146.find, 'call', _147 => _147((c) => c.text.trim()), 'optionalAccess', _148 => _148.text]), () => ( ""));
1562
1667
  if (!ANNEX_HEAD_RE.test(firstText)) return true;
1563
1668
  const filled = firstRow.map((c) => flowText(c.text).replace(/\s+/g, "")).filter(Boolean);
1564
1669
  return filled.length >= 2 && filled.every((t) => t === filled[0]);
1565
1670
  }
1566
1671
  function pushedLead(prev, curr) {
1567
- if (!_chunkI4BS4BXEcjs.CLIP_TABLES.has(prev.table) || !_chunkI4BS4BXEcjs.CLIP_TABLES.has(curr.table)) return false;
1672
+ if (!_chunk4X7AR4EHcjs.CLIP_TABLES.has(prev.table) || !_chunk4X7AR4EHcjs.CLIP_TABLES.has(curr.table)) return false;
1568
1673
  const lead = leadRows(curr.table);
1569
1674
  return lead.image && lead.height > prev.bbox.y;
1570
1675
  }
1571
1676
  function leadRows(t) {
1572
- const ys = _chunkI4BS4BXEcjs.TABLE_ROWYS.get(t);
1677
+ const ys = _chunk4X7AR4EHcjs.TABLE_ROWYS.get(t);
1573
1678
  if (!ys || ys.length < 2) return { height: 0, image: false };
1574
1679
  const anchors = anchorsOf(t);
1575
1680
  let end = 1, image = false;
@@ -1577,17 +1682,17 @@ function leadRows(t) {
1577
1682
  for (const a of anchors) {
1578
1683
  if (a.r !== r) continue;
1579
1684
  end = Math.max(end, r + a.rs);
1580
- if (_chunkI4BS4BXEcjs.IMAGE_CELLS.has(a.cell)) image = true;
1685
+ if (_chunk4X7AR4EHcjs.IMAGE_CELLS.has(a.cell)) image = true;
1581
1686
  }
1582
1687
  }
1583
1688
  return { height: ys[0] - ys[Math.min(end, ys.length - 1)], image };
1584
1689
  }
1585
1690
  function tailOf(b) {
1586
- const t = b.table && _chunkI4BS4BXEcjs.TABLE_TAIL.get(b.table);
1691
+ const t = b.table && _chunk4X7AR4EHcjs.TABLE_TAIL.get(b.table);
1587
1692
  return t && b.bbox ? { ...b, pageNumber: t.page, bbox: { ...b.bbox, page: t.page, y: t.y, height: t.height } } : b;
1588
1693
  }
1589
1694
  function firstRowSig(t) {
1590
- const x = _chunkI4BS4BXEcjs.TABLE_COLXS.get(t);
1695
+ const x = _chunk4X7AR4EHcjs.TABLE_COLXS.get(t);
1591
1696
  if (!x || x.length !== t.cols + 1) return null;
1592
1697
  return anchorsOf(t).filter((a) => a.r === 0).map((a) => ({ x1: x[a.c], x2: x[a.c + a.cs], t: flowText(a.cell.text).replace(/\s+/g, "") }));
1593
1698
  }
@@ -1612,9 +1717,9 @@ function restartsTable(blocks, i, curr, pageHeights) {
1612
1717
  }
1613
1718
  function restartsTitledForm(head, curr) {
1614
1719
  if (head.rows < 2 || curr.rows < 2 || head.cols !== curr.cols) return false;
1615
- const full = (t) => _optionalChain([t, 'access', _101 => _101.cells, 'access', _102 => _102[0], 'access', _103 => _103[0], 'optionalAccess', _104 => _104.colSpan]) === t.cols;
1720
+ const full = (t) => _optionalChain([t, 'access', _149 => _149.cells, 'access', _150 => _150[0], 'access', _151 => _151[0], 'optionalAccess', _152 => _152.colSpan]) === t.cols;
1616
1721
  if (!full(head) || !full(curr)) return false;
1617
- const norm = (c) => flowText(_nullishCoalesce(_optionalChain([c, 'optionalAccess', _105 => _105.text]), () => ( ""))).replace(/\s+/g, "");
1722
+ const norm = (c) => flowText(_nullishCoalesce(_optionalChain([c, 'optionalAccess', _153 => _153.text]), () => ( ""))).replace(/\s+/g, "");
1618
1723
  const ht = norm(head.cells[0][0]), ct = norm(curr.cells[0][0]);
1619
1724
  if (!ht || !ct || ht === ct) return false;
1620
1725
  const titleLike = (t) => t.length <= TITLE_ROW_MAX_CHARS && !/^[ㅇ○◦•·\-–※*□■▪☞]/.test(t);
@@ -1640,7 +1745,7 @@ function chainHead(blocks, i, pageHeights) {
1640
1745
  if (pb.pageNumber !== (_nullishCoalesce(cur.pageNumber, () => ( 0))) - 1) break;
1641
1746
  if (!blocks.slice(p + 1, k).every((b) => besideOwn(b, pb, cur) || insideTable(b, pb) || pageNumberBetween(b, pb, cur, pageHeights))) break;
1642
1747
  if (!looksContinued(pb, cur, pageHeights)) break;
1643
- const px = _chunkI4BS4BXEcjs.TABLE_COLXS.get(pb.table), cx = _chunkI4BS4BXEcjs.TABLE_COLXS.get(cur.table);
1748
+ const px = _chunk4X7AR4EHcjs.TABLE_COLXS.get(pb.table), cx = _chunk4X7AR4EHcjs.TABLE_COLXS.get(cur.table);
1644
1749
  if (!px || !cx) break;
1645
1750
  const dx = px[px.length - 1] - cx[cx.length - 1];
1646
1751
  if (!shiftedSame(px, cx) && !px.some((x) => Math.abs(x - (cx[0] + dx)) <= CONTINUATION_COL_TOL) && !prevLacksLeftCols(pb, px, cx, pageHeights)) break;
@@ -1657,7 +1762,7 @@ function continueRowSpans(prevCells, currCells) {
1657
1762
  if (hasContent(cell) || (cell.rowSpan || 1) < 2) continue;
1658
1763
  let anchor;
1659
1764
  for (let r = last - 1; r >= 0 && !anchor; r--) {
1660
- const a = _optionalChain([prevCells, 'access', _106 => _106[r], 'optionalAccess', _107 => _107[c]]);
1765
+ const a = _optionalChain([prevCells, 'access', _154 => _154[r], 'optionalAccess', _155 => _155[c]]);
1661
1766
  if (a && r + (a.rowSpan || 1) === last && (a.colSpan || 1) === (cell.colSpan || 1) && (hasContent(a) || a.rowSpan >= 2)) anchor = a;
1662
1767
  }
1663
1768
  if (!anchor) continue;
@@ -1711,12 +1816,12 @@ var RESTART_LOOKBACK_PAGES = 5;
1711
1816
  var COL_MATCH_TOL = 0.5;
1712
1817
  var CONTINUED_TABLE_PAGE_BAND = 0.16;
1713
1818
  function lastRowCell(t, x1, x2) {
1714
- const xs = _chunkI4BS4BXEcjs.TABLE_COLXS.get(t);
1819
+ const xs = _chunk4X7AR4EHcjs.TABLE_COLXS.get(t);
1715
1820
  const covered = /* @__PURE__ */ new Set();
1716
1821
  for (let r = 0; r < t.rows; r++) {
1717
1822
  for (let c = 0; c < t.cols; c++) {
1718
1823
  if (covered.has(r * 1e5 + c)) continue;
1719
- const cell = _optionalChain([t, 'access', _108 => _108.cells, 'access', _109 => _109[r], 'optionalAccess', _110 => _110[c]]);
1824
+ const cell = _optionalChain([t, 'access', _156 => _156.cells, 'access', _157 => _157[r], 'optionalAccess', _158 => _158[c]]);
1720
1825
  if (!cell) continue;
1721
1826
  for (let dr = 0; dr < cell.rowSpan; dr++) for (let dc = 0; dc < cell.colSpan; dc++) covered.add((r + dr) * 1e5 + c + dc);
1722
1827
  if (r + cell.rowSpan !== t.rows) continue;
@@ -1729,25 +1834,28 @@ var cellBlocks = (cell, pageNumber) => _nullishCoalesce(cell.blocks, () => ( cel
1729
1834
  function mergeContinuedCells(blocks, pageHeights) {
1730
1835
  for (let j = blocks.length - 1; j > 0; j--) {
1731
1836
  const part = blocks[j];
1732
- const from = part.table ? _chunkI4BS4BXEcjs.CONT_PARTS.get(part.table) : void 0;
1733
- if (!from || !part.table) continue;
1837
+ const from = part.table ? _chunk4X7AR4EHcjs.CONT_PARTS.get(part.table) : void 0;
1838
+ if (!from || !part.table) {
1839
+ unwrapContinuedTable(blocks, j, pageHeights, true);
1840
+ continue;
1841
+ }
1734
1842
  let i = j - 1;
1735
1843
  while (i >= 0 && blocks[i].type !== "table") i--;
1736
1844
  const prev = blocks[i];
1737
1845
  if (i < 0 || !prev.table || prev.pageNumber !== (_nullishCoalesce(part.pageNumber, () => ( 0))) - 1) continue;
1738
1846
  const cell = lastRowCell(prev.table, from.x1, from.x2);
1739
- const add = _optionalChain([part, 'access', _111 => _111.table, 'access', _112 => _112.cells, 'access', _113 => _113[0], 'optionalAccess', _114 => _114[0]]);
1847
+ const add = _optionalChain([part, 'access', _159 => _159.table, 'access', _160 => _160.cells, 'access', _161 => _161[0], 'optionalAccess', _162 => _162[0]]);
1740
1848
  if (!cell || !add) continue;
1741
1849
  const at = cell.blocks || add.blocks ? cellBlocks(cell, prev.pageNumber).length : -1;
1742
1850
  if (cell.blocks || add.blocks) cell.blocks = [...cellBlocks(cell, prev.pageNumber), ...cellBlocks(add, part.pageNumber)];
1743
1851
  else if (part.pageNumber) markContinuedText(cell, add, part.pageNumber);
1744
1852
  cell.text = [cell.text, add.text].filter((s) => s.trim()).join("\n");
1745
- if (_chunkI4BS4BXEcjs.IMAGE_CELLS.has(add)) _chunkI4BS4BXEcjs.IMAGE_CELLS.add(cell);
1746
- _chunkI4BS4BXEcjs.joinCellEdges.call(void 0, cell, add);
1747
- const lines = _chunkI4BS4BXEcjs.CELL_LINES.get(add);
1748
- if (_optionalChain([lines, 'optionalAccess', _115 => _115.length])) _chunkI4BS4BXEcjs.CELL_LINES.set(cell, [..._nullishCoalesce(_chunkI4BS4BXEcjs.CELL_LINES.get(cell), () => ( [])), ...lines]);
1749
- if (part.pageNumber && part.bbox) _chunkI4BS4BXEcjs.TABLE_TAIL.set(prev.table, _nullishCoalesce(_chunkI4BS4BXEcjs.TABLE_TAIL.get(part.table), () => ( { page: part.pageNumber, y: part.bbox.y, height: part.bbox.height })));
1750
- if (cell.text.trim() || _optionalChain([cell, 'access', _116 => _116.blocks, 'optionalAccess', _117 => _117.length]) || _chunkI4BS4BXEcjs.IMAGE_CELLS.has(cell)) _chunkI4BS4BXEcjs.EMPTY_PARTS.delete(prev.table);
1853
+ if (_chunk4X7AR4EHcjs.IMAGE_CELLS.has(add)) _chunk4X7AR4EHcjs.IMAGE_CELLS.add(cell);
1854
+ _chunk4X7AR4EHcjs.joinCellEdges.call(void 0, cell, add);
1855
+ const lines = _chunk4X7AR4EHcjs.CELL_LINES.get(add);
1856
+ if (_optionalChain([lines, 'optionalAccess', _163 => _163.length])) _chunk4X7AR4EHcjs.CELL_LINES.set(cell, [..._nullishCoalesce(_chunk4X7AR4EHcjs.CELL_LINES.get(cell), () => ( [])), ...lines]);
1857
+ if (part.pageNumber && part.bbox) _chunk4X7AR4EHcjs.TABLE_TAIL.set(prev.table, _nullishCoalesce(_chunk4X7AR4EHcjs.TABLE_TAIL.get(part.table), () => ( { page: part.pageNumber, y: part.bbox.y, height: part.bbox.height })));
1858
+ if (cell.text.trim() || _optionalChain([cell, 'access', _164 => _164.blocks, 'optionalAccess', _165 => _165.length]) || _chunk4X7AR4EHcjs.IMAGE_CELLS.has(cell)) _chunk4X7AR4EHcjs.EMPTY_PARTS.delete(prev.table);
1751
1859
  blocks.splice(j, 1);
1752
1860
  if (cell.blocks && at > 0) {
1753
1861
  const nextAt = cell.blocks[at];
@@ -1757,30 +1865,31 @@ function mergeContinuedCells(blocks, pageHeights) {
1757
1865
  if (cell.blocks) mergeCrossPageTables(cell.blocks, pageHeights);
1758
1866
  }
1759
1867
  }
1760
- function unwrapContinuedTable(blocks, at, pageHeights) {
1868
+ function unwrapContinuedTable(blocks, at, pageHeights, splitOnly = false) {
1761
1869
  const prev = blocks[at - 1], frame = blocks[at];
1762
- if (!_optionalChain([prev, 'optionalAccess', _118 => _118.table]) || !_optionalChain([frame, 'optionalAccess', _119 => _119.table]) || frame.table.rows !== 1 || frame.table.cols !== 1 || !_chunkI4BS4BXEcjs.CLIP_TABLES.has(frame.table)) return;
1763
- const inner = _optionalChain([frame, 'access', _120 => _120.table, 'access', _121 => _121.cells, 'access', _122 => _122[0], 'optionalAccess', _123 => _123[0], 'optionalAccess', _124 => _124.blocks]);
1764
- const next = _optionalChain([inner, 'optionalAccess', _125 => _125[0]]);
1765
- if (!inner || !_optionalChain([next, 'optionalAccess', _126 => _126.table]) || !prev.bbox || !next.bbox || !prev.pageNumber || next.pageNumber !== prev.pageNumber + 1 || !_chunkI4BS4BXEcjs.CLIP_TABLES.has(prev.table) || !_chunkI4BS4BXEcjs.CLIP_TABLES.has(next.table) || prev.table.cols !== next.table.cols) return;
1766
- const px = _chunkI4BS4BXEcjs.TABLE_COLXS.get(prev.table), nx = _chunkI4BS4BXEcjs.TABLE_COLXS.get(next.table);
1870
+ if (!_optionalChain([prev, 'optionalAccess', _166 => _166.table]) || !_optionalChain([frame, 'optionalAccess', _167 => _167.table]) || frame.table.rows !== 1 || frame.table.cols !== 1 || !_chunk4X7AR4EHcjs.CLIP_TABLES.has(frame.table)) return;
1871
+ const inner = _optionalChain([frame, 'access', _168 => _168.table, 'access', _169 => _169.cells, 'access', _170 => _170[0], 'optionalAccess', _171 => _171[0], 'optionalAccess', _172 => _172.blocks]);
1872
+ const next = _optionalChain([inner, 'optionalAccess', _173 => _173[0]]);
1873
+ if (!inner || !_optionalChain([next, 'optionalAccess', _174 => _174.table]) || !prev.bbox || !next.bbox || !prev.pageNumber || next.pageNumber !== prev.pageNumber + 1 || !_chunk4X7AR4EHcjs.CLIP_TABLES.has(prev.table) || !_chunk4X7AR4EHcjs.CLIP_TABLES.has(next.table) || prev.table.cols !== next.table.cols) return;
1874
+ const px = _chunk4X7AR4EHcjs.TABLE_COLXS.get(prev.table), nx = _chunk4X7AR4EHcjs.TABLE_COLXS.get(next.table);
1767
1875
  if (!px || !nx || px.length !== nx.length || px.some((x, i) => Math.abs(x - nx[i]) > COL_MATCH_TOL)) return;
1768
- const ph = _optionalChain([pageHeights, 'optionalAccess', _127 => _127.get, 'call', _128 => _128(prev.pageNumber)]), nh = _optionalChain([pageHeights, 'optionalAccess', _129 => _129.get, 'call', _130 => _130(next.pageNumber)]);
1876
+ const ph = _optionalChain([pageHeights, 'optionalAccess', _175 => _175.get, 'call', _176 => _176(prev.pageNumber)]), nh = _optionalChain([pageHeights, 'optionalAccess', _177 => _177.get, 'call', _178 => _178(next.pageNumber)]);
1769
1877
  if (!ph || !nh || prev.bbox.y > ph * CONTINUED_TABLE_PAGE_BAND || next.bbox.y + next.bbox.height < nh * (1 - CONTINUED_TABLE_PAGE_BAND)) return;
1878
+ if (splitOnly && (inner.length !== 1 || !_optionalChain([joinSplitParts, 'call', _179 => _179(prev.table, px, next.table, nx, 0, prev.bbox.y), 'optionalAccess', _180 => _180.split]))) return;
1770
1879
  blocks.splice(at, 1, ...inner);
1771
1880
  }
1772
1881
  function fillNestedContinuation(blocks, at) {
1773
1882
  const prev = blocks[at - 1], next = blocks[at];
1774
- const t = _optionalChain([prev, 'optionalAccess', _131 => _131.table]), u = _optionalChain([next, 'optionalAccess', _132 => _132.table]);
1775
- if (!t || !u || u.rows !== 1 || u.cols !== 1 || !_chunkI4BS4BXEcjs.CLIP_TABLES.has(t) || !_chunkI4BS4BXEcjs.CLIP_TABLES.has(u) || next.pageNumber !== (_nullishCoalesce(prev.pageNumber, () => ( 0))) + 1) return;
1776
- const xs = _chunkI4BS4BXEcjs.TABLE_COLXS.get(u);
1883
+ const t = _optionalChain([prev, 'optionalAccess', _181 => _181.table]), u = _optionalChain([next, 'optionalAccess', _182 => _182.table]);
1884
+ if (!t || !u || u.rows !== 1 || u.cols !== 1 || !_chunk4X7AR4EHcjs.CLIP_TABLES.has(t) || !_chunk4X7AR4EHcjs.CLIP_TABLES.has(u) || next.pageNumber !== (_nullishCoalesce(prev.pageNumber, () => ( 0))) + 1) return;
1885
+ const xs = _chunk4X7AR4EHcjs.TABLE_COLXS.get(u);
1777
1886
  const cell = xs ? lastRowCell(t, xs[0], xs[xs.length - 1]) : void 0;
1778
- const add = _optionalChain([u, 'access', _133 => _133.cells, 'access', _134 => _134[0], 'optionalAccess', _135 => _135[0]]);
1779
- if (!cell || !add || cell.text.trim() || _optionalChain([cell, 'access', _136 => _136.blocks, 'optionalAccess', _137 => _137.length]) || _chunkI4BS4BXEcjs.IMAGE_CELLS.has(cell)) return;
1887
+ const add = _optionalChain([u, 'access', _183 => _183.cells, 'access', _184 => _184[0], 'optionalAccess', _185 => _185[0]]);
1888
+ if (!cell || !add || cell.text.trim() || _optionalChain([cell, 'access', _186 => _186.blocks, 'optionalAccess', _187 => _187.length]) || _chunk4X7AR4EHcjs.IMAGE_CELLS.has(cell)) return;
1780
1889
  cell.text = add.text;
1781
1890
  if (add.blocks) cell.blocks = add.blocks;
1782
- if (_chunkI4BS4BXEcjs.IMAGE_CELLS.has(add)) _chunkI4BS4BXEcjs.IMAGE_CELLS.add(cell);
1783
- _chunkI4BS4BXEcjs.joinCellEdges.call(void 0, cell, add);
1891
+ if (_chunk4X7AR4EHcjs.IMAGE_CELLS.has(add)) _chunk4X7AR4EHcjs.IMAGE_CELLS.add(cell);
1892
+ _chunk4X7AR4EHcjs.joinCellEdges.call(void 0, cell, add);
1784
1893
  blocks.splice(at, 1);
1785
1894
  }
1786
1895
 
@@ -1953,7 +2062,7 @@ function restoreUnmappedGlyphs(items, fnArray, argsArray, fontObj) {
1953
2062
  if (!cache.has(key)) {
1954
2063
  let sym = null;
1955
2064
  try {
1956
- const data = _optionalChain([fontObj, 'call', _138 => _138(font), 'optionalAccess', _139 => _139.data]);
2065
+ const data = _optionalChain([fontObj, 'call', _188 => _188(font), 'optionalAccess', _189 => _189.data]);
1957
2066
  const code = glyph.fontChar.codePointAt(0);
1958
2067
  const outline = data && code !== void 0 ? readOutline(data, code) : null;
1959
2068
  if (outline) sym = classifyOutline(outline);
@@ -1977,7 +2086,7 @@ function restoreUnmappedGlyphs(items, fnArray, argsArray, fontObj) {
1977
2086
  }
1978
2087
  for (const [f, list] of byFont) {
1979
2088
  const q = queues.get(f);
1980
- const want = list.reduce((n, it) => n + (_nullishCoalesce(_optionalChain([it, 'access', _140 => _140.str, 'access', _141 => _141.match, 'call', _142 => _142(//g), 'optionalAccess', _143 => _143.length]), () => ( 0))), 0);
2089
+ const want = list.reduce((n, it) => n + (_nullishCoalesce(_optionalChain([it, 'access', _190 => _190.str, 'access', _191 => _191.match, 'call', _192 => _192(//g), 'optionalAccess', _193 => _193.length]), () => ( 0))), 0);
1981
2090
  if (!q || q.length !== want) continue;
1982
2091
  let k = 0;
1983
2092
  for (const it of list) it.str = it.str.replace(//g, () => q[k++]);
@@ -2000,15 +2109,15 @@ function selectionContextPages(selected, pageCount) {
2000
2109
  function marginContextBlocks(raw, page, view) {
2001
2110
  const [x1, y1, x2, y2] = view;
2002
2111
  const width = x2 - x1, height = y2 - y1;
2003
- const items = _chunkI4BS4BXEcjs.filterHiddenText.call(void 0, _chunkI4BS4BXEcjs.normalizeItems.call(void 0, raw), width, height, x1, y1).visible;
2112
+ const items = _chunk4X7AR4EHcjs.filterHiddenText.call(void 0, _chunk4X7AR4EHcjs.normalizeItems.call(void 0, raw), width, height, x1, y1).visible;
2004
2113
  for (const item of items) {
2005
2114
  item.x -= x1;
2006
2115
  item.y -= y1;
2007
2116
  }
2008
- return _chunkI4BS4BXEcjs.groupByY.call(void 0, items).flatMap((line) => {
2009
- const bbox = _chunkI4BS4BXEcjs.computeBBox.call(void 0, line, page);
2117
+ return _chunk4X7AR4EHcjs.groupByY.call(void 0, items).flatMap((line) => {
2118
+ const bbox = _chunk4X7AR4EHcjs.computeBBox.call(void 0, line, page);
2010
2119
  if (bbox.y + bbox.height < height * 0.88 && bbox.y > height * 0.12) return [];
2011
- return [{ type: "paragraph", text: _chunkI4BS4BXEcjs.mergeLineSimple.call(void 0, line), pageNumber: page, bbox, style: _chunkI4BS4BXEcjs.dominantStyle.call(void 0, line) }];
2120
+ return [{ type: "paragraph", text: _chunk4X7AR4EHcjs.mergeLineSimple.call(void 0, line), pageNumber: page, bbox, style: _chunk4X7AR4EHcjs.dominantStyle.call(void 0, line) }];
2012
2121
  });
2013
2122
  }
2014
2123
 
@@ -2044,7 +2153,7 @@ var WINANSI_REVERSE = {
2044
2153
  };
2045
2154
  function symbolFontTable(fontName) {
2046
2155
  if (!fontName) return void 0;
2047
- if (/wingdings(?![\s-]*[23])/i.test(fontName)) return _chunkMED2MR6Ocjs.WINGDINGS;
2156
+ if (/wingdings(?![\s-]*[23])/i.test(fontName)) return _chunkK2NWHLCDcjs.WINGDINGS;
2048
2157
  return void 0;
2049
2158
  }
2050
2159
  function remapSymbolText(text, table) {
@@ -2172,7 +2281,7 @@ function layout(toks) {
2172
2281
  const bar = rest.find((t) => t.bar && t.x >= rt.x && t.x <= rt.x + rt.w + 2 && Math.abs(t.y - rt.y) <= size * 1.5);
2173
2282
  if (!bar) continue;
2174
2283
  const inner = rest.filter((t) => !t.bar && t !== rt && t.x + t.w / 2 > bar.x && t.x + t.w / 2 < bar.x + bar.w && bar.y - t.y > 0 && bar.y - t.y <= size * 1.4);
2175
- const tok = { text: `\\sqrt{${linear(inner)}}`, x: rt.x, w: bar.x + bar.w - rt.x, y: _nullishCoalesce(_optionalChain([inner, 'access', _144 => _144[0], 'optionalAccess', _145 => _145.y]), () => ( rt.y)), size: Math.max(rt.size, ...inner.map((t) => t.size)), bar: false };
2284
+ const tok = { text: `\\sqrt{${linear(inner)}}`, x: rt.x, w: bar.x + bar.w - rt.x, y: _nullishCoalesce(_optionalChain([inner, 'access', _194 => _194[0], 'optionalAccess', _195 => _195.y]), () => ( rt.y)), size: Math.max(rt.size, ...inner.map((t) => t.size)), bar: false };
2176
2285
  rest = [...rest.filter((t) => t !== rt && t !== bar && !inner.includes(t)), tok];
2177
2286
  }
2178
2287
  const bars = rest.filter((t) => t.bar).sort((a, b) => a.w - b.w);
@@ -2274,7 +2383,7 @@ function wrapEquationRuns(items, faceName) {
2274
2383
  for (const i of mains) ys.set(i.y, (_nullishCoalesce(ys.get(i.y), () => ( 0))) + 1);
2275
2384
  const top = [...ys].sort((p, q) => q[1] - p[1]);
2276
2385
  const bar = cur.find(isBarItem);
2277
- const lineY = bar && top.length > 1 && top[0][1] === top[1][1] ? Math.round(bar.y + size * 0.3) : _nullishCoalesce(_optionalChain([top, 'access', _146 => _146[0], 'optionalAccess', _147 => _147[0]]), () => ( cur[0].y));
2386
+ const lineY = bar && top.length > 1 && top[0][1] === top[1][1] ? Math.round(bar.y + size * 0.3) : _nullishCoalesce(_optionalChain([top, 'access', _196 => _196[0], 'optionalAccess', _197 => _197[0]]), () => ( cur[0].y));
2278
2387
  const base = { ..._nullishCoalesce(mains[0], () => ( cur[0])), y: lineY, fontSize: size || cur[0].fontSize };
2279
2388
  const x1 = Math.min(...cur.map((i) => i.x)), x2 = Math.max(...cur.map((i) => i.x + i.w));
2280
2389
  added.push({ ...base, text: `$${tex}$`, x: x1, w: x2 - x1, hasSpaceBefore: true });
@@ -2631,7 +2740,7 @@ function joinVerticalColumns(items) {
2631
2740
  const groups = [];
2632
2741
  for (const col of columns) {
2633
2742
  const g2 = groups[groups.length - 1];
2634
- const last = _optionalChain([g2, 'optionalAccess', _148 => _148[g2.length - 1]]);
2743
+ const last = _optionalChain([g2, 'optionalAccess', _198 => _198[g2.length - 1]]);
2635
2744
  const fs = col.items[0].fontSize;
2636
2745
  if (last && last.x - col.x >= fs * 1.2 && last.x - col.x <= fs * 4 && Math.abs(last.items[0].y - col.items[0].y) <= fs * 1.2) g2.push(col);
2637
2746
  else groups.push([col]);
@@ -2847,7 +2956,7 @@ function relocateEndnotes(blocks) {
2847
2956
  }
2848
2957
  const shapes = /* @__PURE__ */ new Map();
2849
2958
  for (const h of heads) shapes.set(h.shape, (_nullishCoalesce(shapes.get(h.shape), () => ( 0))) + 1);
2850
- const main = _optionalChain([[...shapes], 'access', _149 => _149.sort, 'call', _150 => _150((a, b) => b[1] - a[1]), 'access', _151 => _151[0], 'optionalAccess', _152 => _152[0]]);
2959
+ const main = _optionalChain([[...shapes], 'access', _199 => _199.sort, 'call', _200 => _200((a, b) => b[1] - a[1]), 'access', _201 => _201[0], 'optionalAccess', _202 => _202[0]]);
2851
2960
  if (!main || !/#/.test(main)) return blocks;
2852
2961
  const lastRun = (hs) => {
2853
2962
  let run2 = [];
@@ -2910,7 +3019,7 @@ function dropTabLeaderDots(items) {
2910
3019
  let run = [];
2911
3020
  const flush = () => {
2912
3021
  const last = run[run.length - 1];
2913
- const tailPage = _optionalChain([DOTS_PAGE, 'access', _153 => _153.exec, 'call', _154 => _154(last.text.trim()), 'optionalAccess', _155 => _155[1]]);
3022
+ const tailPage = _optionalChain([DOTS_PAGE, 'access', _203 => _203.exec, 'call', _204 => _204(last.text.trim()), 'optionalAccess', _205 => _205[1]]);
2914
3023
  const dots = run.reduce((n, d) => n + d.text.trim().replace(/\d+$/, "").length, 0);
2915
3024
  if (dots >= MIN_DOTS && (tailPage ? run.length > 1 : pageNoAfter(last.x + last.w, last))) {
2916
3025
  const body = tailPage ? run.slice(0, -1) : run;
@@ -2998,7 +3107,7 @@ function inlineFootnotes(blocks, pages) {
2998
3107
  open = true;
2999
3108
  continue;
3000
3109
  }
3001
- const prev = pb[j - 1], line = (_nullishCoalesce(_nullishCoalesce(_optionalChain([b, 'access', _156 => _156.style, 'optionalAccess', _157 => _157.fontSize]), () => ( _optionalChain([b, 'access', _158 => _158.bbox, 'optionalAccess', _159 => _159.height]))), () => ( 10))) * 1.5;
3110
+ const prev = pb[j - 1], line = (_nullishCoalesce(_nullishCoalesce(_optionalChain([b, 'access', _206 => _206.style, 'optionalAccess', _207 => _207.fontSize]), () => ( _optionalChain([b, 'access', _208 => _208.bbox, 'optionalAccess', _209 => _209.height]))), () => ( 10))) * 1.5;
3002
3111
  if (open && b.bbox && prev.bbox && prev.bbox.y - top(b) <= line && !/^[-–—\s\d]+$/.test(b.text)) {
3003
3112
  notes[notes.length - 1].text += " " + b.text.trim();
3004
3113
  notes[notes.length - 1].blocks.push(b);
@@ -3021,7 +3130,7 @@ var CAPTION = /^(?:Table|Figure|Fig\.?)\s*\d+(?:\.\d+)*\s*[.:]/i;
3021
3130
  var EQUATION_NUMBER = /\t\(\d{1,3}[a-z]?\)\s*$/;
3022
3131
  var DISPLAY_MATH = /=|[√∑∏∫∂∇≤≥≈≠∈∀∃]/;
3023
3132
  function isRunningHead(block, page, pageHeight) {
3024
- const box = block.bbox, text = _optionalChain([block, 'access', _160 => _160.text, 'optionalAccess', _161 => _161.trim, 'call', _162 => _162()]);
3133
+ const box = block.bbox, text = _optionalChain([block, 'access', _210 => _210.text, 'optionalAccess', _211 => _211.trim, 'call', _212 => _212()]);
3025
3134
  if (!box || !text || !pageHeight) return false;
3026
3135
  const top = box.y + box.height >= pageHeight * 0.9;
3027
3136
  const bottom = box.y <= pageHeight * 0.1;
@@ -3029,7 +3138,7 @@ function isRunningHead(block, page, pageHeight) {
3029
3138
  const others = page.filter((o) => o !== block && o.bbox && o.type !== "image" && o.type !== "separator");
3030
3139
  if (top && others.some((o) => o.bbox.y + o.bbox.height > box.y + box.height)) return false;
3031
3140
  if (bottom && others.some((o) => o.bbox.y < box.y)) return false;
3032
- if (bottom && box.height <= (_nullishCoalesce(_optionalChain([block, 'access', _163 => _163.style, 'optionalAccess', _164 => _164.fontSize]), () => ( 0))) * 1.6) return true;
3141
+ if (bottom && box.height <= (_nullishCoalesce(_optionalChain([block, 'access', _213 => _213.style, 'optionalAccess', _214 => _214.fontSize]), () => ( 0))) * 1.6) return true;
3033
3142
  if (!text.includes(" ")) return false;
3034
3143
  const parts = text.split(/\t+/).map((part) => part.trim()).filter(Boolean);
3035
3144
  if (parts.length >= 2 && (PAGE_NUMBER.test(parts[0]) || PAGE_NUMBER.test(parts[parts.length - 1]))) return true;
@@ -3038,7 +3147,7 @@ function isRunningHead(block, page, pageHeight) {
3038
3147
  return right > left && box.width >= (right - left) * 0.6;
3039
3148
  }
3040
3149
  function unbalancedClose(text) {
3041
- return (_nullishCoalesce(_optionalChain([text, 'access', _165 => _165.match, 'call', _166 => _166(/\)/g), 'optionalAccess', _167 => _167.length]), () => ( 0))) > (_nullishCoalesce(_optionalChain([text, 'access', _168 => _168.match, 'call', _169 => _169(/\(/g), 'optionalAccess', _170 => _170.length]), () => ( 0)));
3150
+ return (_nullishCoalesce(_optionalChain([text, 'access', _215 => _215.match, 'call', _216 => _216(/\)/g), 'optionalAccess', _217 => _217.length]), () => ( 0))) > (_nullishCoalesce(_optionalChain([text, 'access', _218 => _218.match, 'call', _219 => _219(/\(/g), 'optionalAccess', _220 => _220.length]), () => ( 0)));
3042
3151
  }
3043
3152
  function demoteNonHeadingRoles(blocks, pageHeights, faceNames) {
3044
3153
  const byPage = /* @__PURE__ */ new Map();
@@ -3054,7 +3163,7 @@ function demoteNonHeadingRoles(blocks, pageHeights, faceNames) {
3054
3163
  const sizes = /* @__PURE__ */ new Map();
3055
3164
  let proseChars = 0;
3056
3165
  for (const b of page) {
3057
- if (b.type !== "paragraph" && b.type !== "heading" || !b.text || !_optionalChain([b, 'access', _171 => _171.style, 'optionalAccess', _172 => _172.fontName]) || !b.style.fontSize) continue;
3166
+ if (b.type !== "paragraph" && b.type !== "heading" || !b.text || !_optionalChain([b, 'access', _221 => _221.style, 'optionalAccess', _222 => _222.fontName]) || !b.style.fontSize) continue;
3058
3167
  const key2 = `${b.style.fontName}:${b.style.fontSize}`;
3059
3168
  chars.set(key2, (_nullishCoalesce(chars.get(key2), () => ( 0))) + b.text.length);
3060
3169
  if (b.type === "paragraph" && b.style.fontName === "ocr") {
@@ -3078,13 +3187,13 @@ function demoteNonHeadingRoles(blocks, pageHeights, faceNames) {
3078
3187
  const citedProse = /* @__PURE__ */ new Set();
3079
3188
  const numberedProse = /* @__PURE__ */ new Set();
3080
3189
  for (const page of byPage.values()) {
3081
- const numbered = page.filter((b) => (b.type === "heading" || b.type === "paragraph") && /^[①-⑮]\s*/.test(_nullishCoalesce(_optionalChain([b, 'access', _173 => _173.text, 'optionalAccess', _174 => _174.trim, 'call', _175 => _175()]), () => ( ""))) && b.bbox && _optionalChain([b, 'access', _176 => _176.style, 'optionalAccess', _177 => _177.fontName]) && b.style.fontSize && !/Bold|Black|Heavy|Semibold/i.test(_nullishCoalesce(_optionalChain([faceNames, 'optionalAccess', _178 => _178.get, 'call', _179 => _179(b.style.fontName)]), () => ( ""))));
3190
+ const numbered = page.filter((b) => (b.type === "heading" || b.type === "paragraph") && /^[①-⑮]\s*/.test(_nullishCoalesce(_optionalChain([b, 'access', _223 => _223.text, 'optionalAccess', _224 => _224.trim, 'call', _225 => _225()]), () => ( ""))) && b.bbox && _optionalChain([b, 'access', _226 => _226.style, 'optionalAccess', _227 => _227.fontName]) && b.style.fontSize && !/Bold|Black|Heavy|Semibold/i.test(_nullishCoalesce(_optionalChain([faceNames, 'optionalAccess', _228 => _228.get, 'call', _229 => _229(b.style.fontName)]), () => ( ""))));
3082
3191
  let chain = [];
3083
3192
  const finish = () => {
3084
- if (chain.length < 3 || !chain.some((b) => (_nullishCoalesce(_optionalChain([b, 'access', _180 => _180.text, 'optionalAccess', _181 => _181.length]), () => ( 0))) >= 40 && b.bbox.height >= b.style.fontSize * 2.4)) return;
3193
+ if (chain.length < 3 || !chain.some((b) => (_nullishCoalesce(_optionalChain([b, 'access', _230 => _230.text, 'optionalAccess', _231 => _231.length]), () => ( 0))) >= 40 && b.bbox.height >= b.style.fontSize * 2.4)) return;
3085
3194
  for (const b of chain) numberedProse.add(b);
3086
3195
  const first = chain[0], size = first.style.fontSize;
3087
- for (const b of page) if (/^[○●•◦]\s/.test(_nullishCoalesce(_optionalChain([b, 'access', _182 => _182.text, 'optionalAccess', _183 => _183.trim, 'call', _184 => _184()]), () => ( ""))) && _optionalChain([b, 'access', _185 => _185.style, 'optionalAccess', _186 => _186.fontName]) === _optionalChain([first, 'access', _187 => _187.style, 'optionalAccess', _188 => _188.fontName]) && _optionalChain([b, 'access', _189 => _189.style, 'optionalAccess', _190 => _190.fontSize]) === size && b.bbox && Math.abs(b.bbox.x - first.bbox.x) <= size * 0.5 && (_nullishCoalesce(_optionalChain([b, 'access', _191 => _191.text, 'optionalAccess', _192 => _192.length]), () => ( 0))) >= 15) numberedProse.add(b);
3196
+ for (const b of page) if (/^[○●•◦]\s/.test(_nullishCoalesce(_optionalChain([b, 'access', _232 => _232.text, 'optionalAccess', _233 => _233.trim, 'call', _234 => _234()]), () => ( ""))) && _optionalChain([b, 'access', _235 => _235.style, 'optionalAccess', _236 => _236.fontName]) === _optionalChain([first, 'access', _237 => _237.style, 'optionalAccess', _238 => _238.fontName]) && _optionalChain([b, 'access', _239 => _239.style, 'optionalAccess', _240 => _240.fontSize]) === size && b.bbox && Math.abs(b.bbox.x - first.bbox.x) <= size * 0.5 && (_nullishCoalesce(_optionalChain([b, 'access', _241 => _241.text, 'optionalAccess', _242 => _242.length]), () => ( 0))) >= 15) numberedProse.add(b);
3088
3197
  };
3089
3198
  for (const b of numbered) {
3090
3199
  const prev = chain.at(-1), size = b.style.fontSize;
@@ -3098,9 +3207,9 @@ function demoteNonHeadingRoles(blocks, pageHeights, faceNames) {
3098
3207
  }
3099
3208
  for (let i = 0; i + 1 < blocks.length; i++) {
3100
3209
  const prose = blocks[i], reference = blocks[i + 1];
3101
- const a = prose.bbox, b = reference.bbox, size = _nullishCoalesce(_optionalChain([prose, 'access', _193 => _193.style, 'optionalAccess', _194 => _194.fontSize]), () => ( 0));
3102
- const source = _nullishCoalesce(_optionalChain([reference, 'access', _195 => _195.text, 'optionalAccess', _196 => _196.replace, 'call', _197 => _197(/<[^>]+>/g, ""), 'access', _198 => _198.trim, 'call', _199 => _199()]), () => ( ""));
3103
- if (prose.type !== "heading" && prose.type !== "paragraph" && prose.type !== "list" || reference.type !== "heading" && reference.type !== "paragraph" || (_nullishCoalesce(_optionalChain([prose, 'access', _200 => _200.text, 'optionalAccess', _201 => _201.length]), () => ( 0))) < 40 || !a || !b || size <= 0 || a.height < size * 2.4 || prose.pageNumber !== reference.pageNumber || _optionalChain([prose, 'access', _202 => _202.style, 'optionalAccess', _203 => _203.fontName]) !== _optionalChain([reference, 'access', _204 => _204.style, 'optionalAccess', _205 => _205.fontName]) || _optionalChain([prose, 'access', _206 => _206.style, 'optionalAccess', _207 => _207.fontSize]) !== _optionalChain([reference, 'access', _208 => _208.style, 'optionalAccess', _209 => _209.fontSize]) || Math.abs(a.x - b.x) > size && !(/^[○●•◦]\s/.test(_nullishCoalesce(prose.text, () => ( ""))) && b.x >= a.x && b.x - a.x <= size * 2) || a.y - (b.y + b.height) < 0 || a.y - (b.y + b.height) > size || !/^[((].*(?:제\s*\d+\s*조|(?:Article|Section)\s+\d+).*[))]$/i.test(source)) continue;
3210
+ const a = prose.bbox, b = reference.bbox, size = _nullishCoalesce(_optionalChain([prose, 'access', _243 => _243.style, 'optionalAccess', _244 => _244.fontSize]), () => ( 0));
3211
+ const source = _nullishCoalesce(_optionalChain([reference, 'access', _245 => _245.text, 'optionalAccess', _246 => _246.replace, 'call', _247 => _247(/<[^>]+>/g, ""), 'access', _248 => _248.trim, 'call', _249 => _249()]), () => ( ""));
3212
+ if (prose.type !== "heading" && prose.type !== "paragraph" && prose.type !== "list" || reference.type !== "heading" && reference.type !== "paragraph" || (_nullishCoalesce(_optionalChain([prose, 'access', _250 => _250.text, 'optionalAccess', _251 => _251.length]), () => ( 0))) < 40 || !a || !b || size <= 0 || a.height < size * 2.4 || prose.pageNumber !== reference.pageNumber || _optionalChain([prose, 'access', _252 => _252.style, 'optionalAccess', _253 => _253.fontName]) !== _optionalChain([reference, 'access', _254 => _254.style, 'optionalAccess', _255 => _255.fontName]) || _optionalChain([prose, 'access', _256 => _256.style, 'optionalAccess', _257 => _257.fontSize]) !== _optionalChain([reference, 'access', _258 => _258.style, 'optionalAccess', _259 => _259.fontSize]) || Math.abs(a.x - b.x) > size && !(/^[○●•◦]\s/.test(_nullishCoalesce(prose.text, () => ( ""))) && b.x >= a.x && b.x - a.x <= size * 2) || a.y - (b.y + b.height) < 0 || a.y - (b.y + b.height) > size || !/^[((].*(?:제\s*\d+\s*조|(?:Article|Section)\s+\d+).*[))]$/i.test(source)) continue;
3104
3213
  citedProse.add(prose);
3105
3214
  citedProse.add(reference);
3106
3215
  }
@@ -3108,49 +3217,49 @@ function demoteNonHeadingRoles(blocks, pageHeights, faceNames) {
3108
3217
  const block = blocks[i];
3109
3218
  if (block.type !== "heading" || !block.text) continue;
3110
3219
  const text = block.text.replace(/<[^>]+>/g, "").trim();
3111
- const fsz = _nullishCoalesce(_optionalChain([block, 'access', _210 => _210.style, 'optionalAccess', _211 => _211.fontSize]), () => ( 0));
3112
- const tocEntry = i > 0 && _chunkI4BS4BXEcjs.TOC_BLOCKS.has(blocks[i - 1]) && _chunkI4BS4BXEcjs.TOC_BLOCKS.has(blocks[i + 1]);
3220
+ const fsz = _nullishCoalesce(_optionalChain([block, 'access', _260 => _260.style, 'optionalAccess', _261 => _261.fontSize]), () => ( 0));
3221
+ const tocEntry = i > 0 && _chunk4X7AR4EHcjs.TOC_BLOCKS.has(blocks[i - 1]) && _chunk4X7AR4EHcjs.TOC_BLOCKS.has(blocks[i + 1]);
3113
3222
  const page = _nullishCoalesce(byPage.get(_nullishCoalesce(block.pageNumber, () => ( 0))), () => ( []));
3114
- const proseStyle = _optionalChain([block, 'access', _212 => _212.style, 'optionalAccess', _213 => _213.fontName]) && bodyStyle.get(_nullishCoalesce(block.pageNumber, () => ( 0))) === `${block.style.fontName}:${block.style.fontSize}` && text.length > 60;
3223
+ const proseStyle = _optionalChain([block, 'access', _262 => _262.style, 'optionalAccess', _263 => _263.fontName]) && bodyStyle.get(_nullishCoalesce(block.pageNumber, () => ( 0))) === `${block.style.fontName}:${block.style.fontSize}` && text.length > 60;
3115
3224
  const next = blocks[i + 1];
3116
- const nb = _optionalChain([next, 'optionalAccess', _214 => _214.bbox]), bb = block.bbox;
3117
- const chapterNumber = !!nb && !!bb && fsz >= (_nullishCoalesce(_optionalChain([next, 'optionalAccess', _215 => _215.style, 'optionalAccess', _216 => _216.fontSize]), () => ( 0))) * 1.2 && Math.abs(bb.x - nb.x) > fsz && Math.abs(bb.x + bb.width / 2 - (nb.x + nb.width / 2)) < nb.width * 0.1;
3118
- if (/^\d+(?:\.\d+)*\.?$/.test(text) && _optionalChain([next, 'optionalAccess', _217 => _217.type]) === "heading" && next.text && next.pageNumber === block.pageNumber && !chapterNumber) {
3225
+ const nb = _optionalChain([next, 'optionalAccess', _264 => _264.bbox]), bb = block.bbox;
3226
+ const chapterNumber = !!nb && !!bb && fsz >= (_nullishCoalesce(_optionalChain([next, 'optionalAccess', _265 => _265.style, 'optionalAccess', _266 => _266.fontSize]), () => ( 0))) * 1.2 && Math.abs(bb.x - nb.x) > fsz && Math.abs(bb.x + bb.width / 2 - (nb.x + nb.width / 2)) < nb.width * 0.1;
3227
+ if (/^\d+(?:\.\d+)*\.?$/.test(text) && _optionalChain([next, 'optionalAccess', _267 => _267.type]) === "heading" && next.text && next.pageNumber === block.pageNumber && !chapterNumber) {
3119
3228
  next.text = `${block.text.trim()} ${next.text.trim()}`;
3120
3229
  blocks.splice(i--, 1);
3121
3230
  continue;
3122
3231
  }
3123
- if ((_optionalChain([next, 'optionalAccess', _218 => _218.type]) === "paragraph" || _optionalChain([next, 'optionalAccess', _219 => _219.type]) === "heading" && !CAPTION.test(text)) && next.pageNumber === block.pageNumber && next.text && next.bbox && block.bbox && _optionalChain([next, 'access', _220 => _220.style, 'optionalAccess', _221 => _221.fontName]) === _optionalChain([block, 'access', _222 => _222.style, 'optionalAccess', _223 => _223.fontName]) && _optionalChain([next, 'access', _224 => _224.style, 'optionalAccess', _225 => _225.fontSize]) === _optionalChain([block, 'access', _226 => _226.style, 'optionalAccess', _227 => _227.fontSize]) && fsz > 0 && /^[a-z]/.test(next.text.trim()) && next.text.trim().length <= 40 && !/[.:;!?]$/.test(next.text.trim()) && block.bbox.y - (next.bbox.y + next.bbox.height) < fsz * 1.2 && Math.abs(next.bbox.x - block.bbox.x) < fsz) {
3232
+ if ((_optionalChain([next, 'optionalAccess', _268 => _268.type]) === "paragraph" || _optionalChain([next, 'optionalAccess', _269 => _269.type]) === "heading" && !CAPTION.test(text)) && next.pageNumber === block.pageNumber && next.text && next.bbox && block.bbox && _optionalChain([next, 'access', _270 => _270.style, 'optionalAccess', _271 => _271.fontName]) === _optionalChain([block, 'access', _272 => _272.style, 'optionalAccess', _273 => _273.fontName]) && _optionalChain([next, 'access', _274 => _274.style, 'optionalAccess', _275 => _275.fontSize]) === _optionalChain([block, 'access', _276 => _276.style, 'optionalAccess', _277 => _277.fontSize]) && fsz > 0 && /^[a-z]/.test(next.text.trim()) && next.text.trim().length <= 40 && !/[.:;!?]$/.test(next.text.trim()) && block.bbox.y - (next.bbox.y + next.bbox.height) < fsz * 1.2 && Math.abs(next.bbox.x - block.bbox.x) < fsz) {
3124
3233
  block.text = `${block.text.trim()} ${next.text.trim()}`;
3125
3234
  block.bbox = { ...block.bbox, y: next.bbox.y, height: block.bbox.y + block.bbox.height - next.bbox.y };
3126
3235
  blocks.splice(i + 1, 1);
3127
3236
  }
3128
3237
  const after = blocks[i + 2];
3129
- if ((_optionalChain([next, 'optionalAccess', _228 => _228.type]) === "paragraph" || _optionalChain([next, 'optionalAccess', _229 => _229.type]) === "heading") && /^(?:&|\+|and|or)$/i.test(_nullishCoalesce(_optionalChain([next, 'access', _230 => _230.text, 'optionalAccess', _231 => _231.trim, 'call', _232 => _232()]), () => ( ""))) && _optionalChain([after, 'optionalAccess', _233 => _233.type]) === "heading" && after.text && after.pageNumber === block.pageNumber && next.pageNumber === block.pageNumber && _optionalChain([after, 'access', _234 => _234.style, 'optionalAccess', _235 => _235.fontSize]) === _optionalChain([block, 'access', _236 => _236.style, 'optionalAccess', _237 => _237.fontSize])) {
3238
+ if ((_optionalChain([next, 'optionalAccess', _278 => _278.type]) === "paragraph" || _optionalChain([next, 'optionalAccess', _279 => _279.type]) === "heading") && /^(?:&|\+|and|or)$/i.test(_nullishCoalesce(_optionalChain([next, 'access', _280 => _280.text, 'optionalAccess', _281 => _281.trim, 'call', _282 => _282()]), () => ( ""))) && _optionalChain([after, 'optionalAccess', _283 => _283.type]) === "heading" && after.text && after.pageNumber === block.pageNumber && next.pageNumber === block.pageNumber && _optionalChain([after, 'access', _284 => _284.style, 'optionalAccess', _285 => _285.fontSize]) === _optionalChain([block, 'access', _286 => _286.style, 'optionalAccess', _287 => _287.fontSize])) {
3130
3239
  block.text = `${block.text.trim()} ${next.text.trim()} ${after.text.trim()}`;
3131
3240
  blocks.splice(i + 1, 2);
3132
3241
  }
3133
3242
  const tiny = fsz > 0 && fsz < 7.5;
3134
3243
  const prev = blocks[i - 1];
3135
- if (_optionalChain([prev, 'optionalAccess', _238 => _238.type]) === "paragraph" && prev.pageNumber === block.pageNumber && /^[a-z]{1,3}[.)]$/.test(_nullishCoalesce(_optionalChain([prev, 'access', _239 => _239.text, 'optionalAccess', _240 => _240.trim, 'call', _241 => _241()]), () => ( ""))) && prev.bbox && block.bbox && Math.abs(prev.bbox.y - block.bbox.y) < 2 && prev.bbox.x + prev.bbox.width <= block.bbox.x) {
3244
+ if (_optionalChain([prev, 'optionalAccess', _288 => _288.type]) === "paragraph" && prev.pageNumber === block.pageNumber && /^[a-z]{1,3}[.)]$/.test(_nullishCoalesce(_optionalChain([prev, 'access', _289 => _289.text, 'optionalAccess', _290 => _290.trim, 'call', _291 => _291()]), () => ( ""))) && prev.bbox && block.bbox && Math.abs(prev.bbox.y - block.bbox.y) < 2 && prev.bbox.x + prev.bbox.width <= block.bbox.x) {
3136
3245
  prev.text = `${prev.text.trim()} ${block.text.trim()}`;
3137
3246
  prev.bbox = { ...prev.bbox, width: block.bbox.x + block.bbox.width - prev.bbox.x };
3138
3247
  blocks.splice(i--, 1);
3139
3248
  continue;
3140
3249
  }
3141
- if (_optionalChain([prev, 'optionalAccess', _242 => _242.type]) === "paragraph" && prev.pageNumber === block.pageNumber && /^\d{1,2}(?:\.\d{1,2})*\.?$/.test(_nullishCoalesce(_optionalChain([prev, 'access', _243 => _243.text, 'optionalAccess', _244 => _244.trim, 'call', _245 => _245()]), () => ( ""))) && prev.bbox && block.bbox && fsz > 0 && (Math.abs(prev.bbox.y - block.bbox.y) < 2 && prev.bbox.x + prev.bbox.width <= block.bbox.x && block.bbox.x - (prev.bbox.x + prev.bbox.width) < fsz * 3 || Math.abs(prev.bbox.x - block.bbox.x) < 2 && (_nullishCoalesce(_optionalChain([prev, 'access', _246 => _246.style, 'optionalAccess', _247 => _247.fontSize]), () => ( 0))) >= fsz && prev.bbox.y - (block.bbox.y + block.bbox.height) < fsz * 1.5)) {
3250
+ if (_optionalChain([prev, 'optionalAccess', _292 => _292.type]) === "paragraph" && prev.pageNumber === block.pageNumber && /^\d{1,2}(?:\.\d{1,2})*\.?$/.test(_nullishCoalesce(_optionalChain([prev, 'access', _293 => _293.text, 'optionalAccess', _294 => _294.trim, 'call', _295 => _295()]), () => ( ""))) && prev.bbox && block.bbox && fsz > 0 && (Math.abs(prev.bbox.y - block.bbox.y) < 2 && prev.bbox.x + prev.bbox.width <= block.bbox.x && block.bbox.x - (prev.bbox.x + prev.bbox.width) < fsz * 3 || Math.abs(prev.bbox.x - block.bbox.x) < 2 && (_nullishCoalesce(_optionalChain([prev, 'access', _296 => _296.style, 'optionalAccess', _297 => _297.fontSize]), () => ( 0))) >= fsz && prev.bbox.y - (block.bbox.y + block.bbox.height) < fsz * 1.5)) {
3142
3251
  block.text = `${prev.text.trim()} ${block.text.trim()}`;
3143
3252
  blocks.splice(i - 1, 1);
3144
3253
  i -= 2;
3145
3254
  continue;
3146
3255
  }
3147
- const box = block.bbox, size = _nullishCoalesce(_optionalChain([block, 'access', _248 => _248.style, 'optionalAccess', _249 => _249.fontSize]), () => ( 0));
3148
- const kicker = !!box && size > 0 && _optionalChain([next, 'optionalAccess', _250 => _250.type]) === "heading" && next.pageNumber === block.pageNumber && !!next.bbox && (_optionalChain([block, 'access', _251 => _251.style, 'optionalAccess', _252 => _252.fontName]) !== "ocr" || size < (_nullishCoalesce(bodySizes.get(_nullishCoalesce(block.pageNumber, () => ( 0))), () => ( Infinity))) * 2) && (_nullishCoalesce(_optionalChain([next, 'access', _253 => _253.style, 'optionalAccess', _254 => _254.fontSize]), () => ( 0))) >= size * 1.3 && box.y - (next.bbox.y + next.bbox.height) <= size * 3 && Math.min(box.x + box.width, next.bbox.x + next.bbox.width) - Math.max(box.x, next.bbox.x) >= Math.min(box.width, next.bbox.width) * 0.5 && !page.some((o) => o !== block && o.bbox && o.bbox.y > box.y + box.height && o.type !== "image");
3149
- const face = _nullishCoalesce(_optionalChain([faceNames, 'optionalAccess', _255 => _255.get, 'call', _256 => _256(_nullishCoalesce(_optionalChain([block, 'access', _257 => _257.style, 'optionalAccess', _258 => _258.fontName]), () => ( "")))]), () => ( ""));
3256
+ const box = block.bbox, size = _nullishCoalesce(_optionalChain([block, 'access', _298 => _298.style, 'optionalAccess', _299 => _299.fontSize]), () => ( 0));
3257
+ const kicker = !!box && size > 0 && _optionalChain([next, 'optionalAccess', _300 => _300.type]) === "heading" && next.pageNumber === block.pageNumber && !!next.bbox && (_optionalChain([block, 'access', _301 => _301.style, 'optionalAccess', _302 => _302.fontName]) !== "ocr" || size < (_nullishCoalesce(bodySizes.get(_nullishCoalesce(block.pageNumber, () => ( 0))), () => ( Infinity))) * 2) && (_nullishCoalesce(_optionalChain([next, 'access', _303 => _303.style, 'optionalAccess', _304 => _304.fontSize]), () => ( 0))) >= size * 1.3 && box.y - (next.bbox.y + next.bbox.height) <= size * 3 && Math.min(box.x + box.width, next.bbox.x + next.bbox.width) - Math.max(box.x, next.bbox.x) >= Math.min(box.width, next.bbox.width) * 0.5 && !page.some((o) => o !== block && o.bbox && o.bbox.y > box.y + box.height && o.type !== "image");
3258
+ const face = _nullishCoalesce(_optionalChain([faceNames, 'optionalAccess', _305 => _305.get, 'call', _306 => _306(_nullishCoalesce(_optionalChain([block, 'access', _307 => _307.style, 'optionalAccess', _308 => _308.fontName]), () => ( "")))]), () => ( ""));
3150
3259
  const [bodyFace, bodySize] = (_nullishCoalesce(bodyStyle.get(_nullishCoalesce(block.pageNumber, () => ( 0))), () => ( ""))).split(":");
3151
- const byline = /Italic|Oblique/i.test(face) && !/Bold|Black|Heavy|Semibold/i.test(face) && !!bodyFace && size <= Number(bodySize) + 0.5 && _optionalChain([blocks, 'access', _259 => _259[i - 1], 'optionalAccess', _260 => _260.type]) === "heading" && blocks[i - 1].pageNumber === block.pageNumber;
3152
- const ocrFragment = _optionalChain([block, 'access', _261 => _261.style, 'optionalAccess', _262 => _262.fontName]) === "ocr" && (/^[.,;:…·•-]/.test(text) || text.includes("\u2026") || (_nullishCoalesce(_optionalChain([text, 'access', _263 => _263.match, 'call', _264 => _264(/\p{L}/gu), 'optionalAccess', _265 => _265.length]), () => ( 0))) < 2 || text.split(/\s+/).length > 7);
3153
- const crowdedOcr = _optionalChain([block, 'access', _266 => _266.style, 'optionalAccess', _267 => _267.fontName]) === "ocr" && !!box && [prev, next].every((o) => _optionalChain([o, 'optionalAccess', _268 => _268.type]) === "paragraph" && o.pageNumber === block.pageNumber && _optionalChain([o, 'access', _269 => _269.style, 'optionalAccess', _270 => _270.fontName]) === "ocr" && !!o.bbox && (_nullishCoalesce(_optionalChain([o, 'access', _271 => _271.text, 'optionalAccess', _272 => _272.length]), () => ( 0))) >= 15 && Math.abs(o.bbox.x - box.x) <= size * 0.25 && Math.min(o.bbox.y + o.bbox.height, box.y + box.height) - Math.max(o.bbox.y, box.y) >= o.bbox.height * 0.2) && prev.bbox.y > box.y && next.bbox.y < box.y;
3260
+ const byline = /Italic|Oblique/i.test(face) && !/Bold|Black|Heavy|Semibold/i.test(face) && !!bodyFace && size <= Number(bodySize) + 0.5 && _optionalChain([blocks, 'access', _309 => _309[i - 1], 'optionalAccess', _310 => _310.type]) === "heading" && blocks[i - 1].pageNumber === block.pageNumber;
3261
+ const ocrFragment = _optionalChain([block, 'access', _311 => _311.style, 'optionalAccess', _312 => _312.fontName]) === "ocr" && (/^[.,;:…·•-]/.test(text) || text.includes("\u2026") || (_nullishCoalesce(_optionalChain([text, 'access', _313 => _313.match, 'call', _314 => _314(/\p{L}/gu), 'optionalAccess', _315 => _315.length]), () => ( 0))) < 2 || text.split(/\s+/).length > 7);
3262
+ const crowdedOcr = _optionalChain([block, 'access', _316 => _316.style, 'optionalAccess', _317 => _317.fontName]) === "ocr" && !!box && [prev, next].every((o) => _optionalChain([o, 'optionalAccess', _318 => _318.type]) === "paragraph" && o.pageNumber === block.pageNumber && _optionalChain([o, 'access', _319 => _319.style, 'optionalAccess', _320 => _320.fontName]) === "ocr" && !!o.bbox && (_nullishCoalesce(_optionalChain([o, 'access', _321 => _321.text, 'optionalAccess', _322 => _322.length]), () => ( 0))) >= 15 && Math.abs(o.bbox.x - box.x) <= size * 0.25 && Math.min(o.bbox.y + o.bbox.height, box.y + box.height) - Math.max(o.bbox.y, box.y) >= o.bbox.height * 0.2) && prev.bbox.y > box.y && next.bbox.y < box.y;
3154
3263
  if (numberedProse.has(block) || citedProse.has(block) || ocrFragment || crowdedOcr || tocEntry || proseStyle || kicker || byline || tiny || !/\p{L}/u.test(text) && !chapterNumber || /^[a-z]/.test(text) || CAPTION.test(text) || EQUATION_NUMBER.test(block.text) || DISPLAY_MATH.test(text) || // 닫는 괄호가 여는 괄호보다 많으면 앞 줄에서 이어진 문장 조각이다 ("Fact-checking) and is used …") — "1)"·"가)" 앞머리 번호는 빼고 센다
3155
3264
  unbalancedClose(text.replace(/^\s*[\dA-Za-z가-힣ⅰ-ⅹ]{1,3}\)\s*/, "")) || isRunningHead(block, page, pageHeights.get(_nullishCoalesce(block.pageNumber, () => ( 0))))) {
3156
3265
  block.type = "paragraph";
@@ -3200,34 +3309,34 @@ var CAPTION_LABEL = /^(?:figure|fig\.|diagram|table|chart|graph|exhibit|box)\s*[
3200
3309
  function captionTableText(t) {
3201
3310
  if (!t || t.rows !== 1 || t.cols !== 2) return null;
3202
3311
  const [label, body] = t.cells[0];
3203
- if (!label || !body || _optionalChain([label, 'access', _273 => _273.blocks, 'optionalAccess', _274 => _274.length]) || _optionalChain([body, 'access', _275 => _275.blocks, 'optionalAccess', _276 => _276.length]) || !CAPTION_LABEL.test(label.text.trim()) || !body.text.trim()) return null;
3312
+ if (!label || !body || _optionalChain([label, 'access', _323 => _323.blocks, 'optionalAccess', _324 => _324.length]) || _optionalChain([body, 'access', _325 => _325.blocks, 'optionalAccess', _326 => _326.length]) || !CAPTION_LABEL.test(label.text.trim()) || !body.text.trim()) return null;
3204
3313
  return `${label.text.trim()} ${body.text.replace(/\s*\n\s*/g, " ").trim()}`;
3205
3314
  }
3206
3315
  function splitSingleCellTables(blocks) {
3207
3316
  const out = [];
3208
3317
  for (const b of blocks) {
3209
3318
  const t = b.type === "table" ? b.table : void 0;
3210
- const title = t && _chunkI4BS4BXEcjs.FRAME_TITLE_BLOCKS.get(t);
3319
+ const title = t && _chunk4X7AR4EHcjs.FRAME_TITLE_BLOCKS.get(t);
3211
3320
  if (title) {
3212
3321
  out.push({ ...title, text: `${t.cells[0][0].text.trim()} ${t.cells[0][2].text.trim()}` });
3213
3322
  continue;
3214
3323
  }
3215
- const only = t && t.rows === 1 && t.cols === 1 && _optionalChain([t, 'access', _277 => _277.cells, 'access', _278 => _278[0], 'optionalAccess', _279 => _279[0], 'optionalAccess', _280 => _280.blocks, 'optionalAccess', _281 => _281.length]) === 1 ? t.cells[0][0].blocks[0] : void 0;
3324
+ const only = t && t.rows === 1 && t.cols === 1 && _optionalChain([t, 'access', _327 => _327.cells, 'access', _328 => _328[0], 'optionalAccess', _329 => _329[0], 'optionalAccess', _330 => _330.blocks, 'optionalAccess', _331 => _331.length]) === 1 ? t.cells[0][0].blocks[0] : void 0;
3216
3325
  const squash = (s) => s.replace(/\s/g, "");
3217
3326
  const inner = only && (!squash(t.cells[0][0].text) || only.type === "table" && squash(t.cells[0][0].text) === squash(only.table.cells.flat().map((c) => c.text).join(""))) ? only : void 0;
3218
- const caption = _nullishCoalesce(captionTableText(t), () => ( (_optionalChain([inner, 'optionalAccess', _282 => _282.type]) === "table" ? captionTableText(inner.table) : null)));
3327
+ const caption = _nullishCoalesce(captionTableText(t), () => ( (_optionalChain([inner, 'optionalAccess', _332 => _332.type]) === "table" ? captionTableText(inner.table) : null)));
3219
3328
  if (caption) {
3220
3329
  out.push({ type: "paragraph", text: caption, pageNumber: b.pageNumber, bbox: b.bbox });
3221
3330
  continue;
3222
3331
  }
3223
- const cell = t && t.rows === 1 && t.cols === 1 ? _optionalChain([t, 'access', _283 => _283.cells, 'access', _284 => _284[0], 'optionalAccess', _285 => _285[0]]) : void 0;
3332
+ const cell = t && t.rows === 1 && t.cols === 1 ? _optionalChain([t, 'access', _333 => _333.cells, 'access', _334 => _334[0], 'optionalAccess', _335 => _335[0]]) : void 0;
3224
3333
  if (!cell) {
3225
3334
  out.push(b);
3226
3335
  continue;
3227
3336
  }
3228
3337
  const lines = (_nullishCoalesce(cell.text, () => ( ""))).split(/\n/).map((l) => l.trim()).filter(Boolean);
3229
- if (_optionalChain([t, 'optionalAccess', _286 => _286.caption, 'optionalAccess', _287 => _287.trim, 'call', _288 => _288()])) out.push({ type: "paragraph", text: t.caption.trim(), pageNumber: b.pageNumber, bbox: b.bbox });
3230
- if (_optionalChain([cell, 'access', _289 => _289.blocks, 'optionalAccess', _290 => _290.length])) {
3338
+ if (_optionalChain([t, 'optionalAccess', _336 => _336.caption, 'optionalAccess', _337 => _337.trim, 'call', _338 => _338()])) out.push({ type: "paragraph", text: t.caption.trim(), pageNumber: b.pageNumber, bbox: b.bbox });
3339
+ if (_optionalChain([cell, 'access', _339 => _339.blocks, 'optionalAccess', _340 => _340.length])) {
3231
3340
  out.push(...splitSingleCellTables(cell.blocks));
3232
3341
  continue;
3233
3342
  }
@@ -3243,7 +3352,7 @@ function joinLatinCellWraps(blocks) {
3243
3352
  const lines = cell.text.split("\n");
3244
3353
  const out = [lines[0]];
3245
3354
  for (const line of lines.slice(1)) {
3246
- if (_chunkI4BS4BXEcjs.latinSoftWrap.call(void 0, out[out.length - 1], line)) out[out.length - 1] = out[out.length - 1].trimEnd() + " " + line.trim();
3355
+ if (_chunk4X7AR4EHcjs.latinSoftWrap.call(void 0, out[out.length - 1], line)) out[out.length - 1] = out[out.length - 1].trimEnd() + " " + line.trim();
3247
3356
  else out.push(line);
3248
3357
  }
3249
3358
  cell.text = out.join("\n");
@@ -3254,19 +3363,19 @@ function joinLatinCellWraps(blocks) {
3254
3363
  }
3255
3364
  function cleanPdfText(text, opts) {
3256
3365
  let clean = normalizeAraea(stripControlChars(text));
3257
- if (!_optionalChain([opts, 'optionalAccess', _291 => _291.keepLoneNumbers])) {
3366
+ if (!_optionalChain([opts, 'optionalAccess', _341 => _341.keepLoneNumbers])) {
3258
3367
  clean = clean.replace(/^\d{1,4}\n/, "").replace(/\n\d{1,4}\n/g, "\n").replace(/\n\d{1,4}$/, "");
3259
3368
  }
3260
- if (!_optionalChain([opts, 'optionalAccess', _292 => _292.keepLoneNumbers])) clean = clean.replace(/^#{1,6}\s*\d{1,4}\s*$/gm, "");
3369
+ if (!_optionalChain([opts, 'optionalAccess', _342 => _342.keepLoneNumbers])) clean = clean.replace(/^#{1,6}\s*\d{1,4}\s*$/gm, "");
3261
3370
  return mergeKoreanLines(
3262
3371
  clean.replace(/^[\s]*[-–—]\s*[-–—]?\d+[-–—]?[\s]*[-–—]?[\s]*$/gm, "").replace(/^\s*\d+\s*\/\s*\d+\s*$/gm, "").replace(/\.(?: \.){3,}/g, (m) => ".".repeat(m.length + 1 >> 1))
3263
3372
  ).replace(/^(?!\| ---).*$/gm, (line) => {
3264
3373
  if (/^\s*\${1,2}.+\${1,2}\s*$/.test(line)) return line;
3265
3374
  if (line.startsWith("|")) {
3266
- return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) => _chunkI4BS4BXEcjs.collapseEvenSpacing.call(void 0, t, false))).join("<br>"));
3375
+ return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) => _chunk4X7AR4EHcjs.collapseEvenSpacing.call(void 0, t, false))).join("<br>"));
3267
3376
  }
3268
- const mark = _nullishCoalesce(_optionalChain([/^(?:#{1,6}|-) /, 'access', _293 => _293.exec, 'call', _294 => _294(line), 'optionalAccess', _295 => _295[0]]), () => ( ""));
3269
- return mark + _chunkI4BS4BXEcjs.collapseEvenSpacing.call(void 0, line.slice(mark.length), false);
3377
+ const mark = _nullishCoalesce(_optionalChain([/^(?:#{1,6}|-) /, 'access', _343 => _343.exec, 'call', _344 => _344(line), 'optionalAccess', _345 => _345[0]]), () => ( ""));
3378
+ return mark + _chunk4X7AR4EHcjs.collapseEvenSpacing.call(void 0, line.slice(mark.length), false);
3270
3379
  }).replace(/\\~\\~/g, "~~").replace(/~~~~/g, "").replace(/<u>\s*<\/u>/g, "").replace(/<(sup|sub)>\s*<\/\1>/g, "").replace(/\n{3,}/g, "\n\n").trim();
3271
3380
  }
3272
3381
  function startsWithMarker(line) {
@@ -3298,7 +3407,7 @@ function mergeKoreanLines(text) {
3298
3407
  continue;
3299
3408
  }
3300
3409
  if (/[가-힣·,\-]$/.test(prev) && /^[가-힣(]/.test(curr) && !startsWithMarker(curr) && !isStandaloneHeader(prev) && !startsWithMarker(prev)) {
3301
- result[result.length - 1] = prev + _chunkI4BS4BXEcjs.wrapJoiner.call(void 0, prev, curr) + curr;
3410
+ result[result.length - 1] = prev + _chunk4X7AR4EHcjs.wrapJoiner.call(void 0, prev, curr) + curr;
3302
3411
  } else {
3303
3412
  result.push(curr);
3304
3413
  }
@@ -3314,7 +3423,7 @@ function applyLinkAnnotations(items, annots) {
3314
3423
  const wrapped = /* @__PURE__ */ new Set();
3315
3424
  for (const a of annots) {
3316
3425
  if (a.subtype !== "Link" || !a.url || !a.rect || a.rect.length < 4) continue;
3317
- const url = _chunkAUWO57EDcjs.sanitizeHref.call(void 0, a.url);
3426
+ const url = _chunkMJSHXESKcjs.sanitizeHref.call(void 0, a.url);
3318
3427
  if (!url) continue;
3319
3428
  const x1 = Math.min(a.rect[0], a.rect[2]), x2 = Math.max(a.rect[0], a.rect[2]);
3320
3429
  const y1 = Math.min(a.rect[1], a.rect[3]), y2 = Math.max(a.rect[1], a.rect[3]);
@@ -3366,7 +3475,7 @@ function mergeLinkRuns(markdown) {
3366
3475
 
3367
3476
  // src/pdf/formula-ocr.ts
3368
3477
  async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
3369
- const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-3TVRNJ66.cjs")));
3478
+ const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-JGFYGFYX.cjs")));
3370
3479
  const { FormulaPipeline, ensureFormulaModels } = formulaMod;
3371
3480
  await ensureFormulaModels((p) => {
3372
3481
  if (p.phase === "download" && p.total) {
@@ -3557,13 +3666,13 @@ async function loadPdfWithTimeout(buffer) {
3557
3666
  try {
3558
3667
  return await Promise.race([
3559
3668
  loadingTask.promise.catch((e) => {
3560
- if (e instanceof Error && e.name === "PasswordException") throw new (0, _chunkAUWO57EDcjs.KordocError)("\uC554\uD638\uB85C \uBCF4\uD638\uB41C PDF \uD30C\uC77C\uC785\uB2C8\uB2E4 (PDF \uC5F4\uAE30 \uC554\uD638\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4)");
3669
+ if (e instanceof Error && e.name === "PasswordException") throw new (0, _chunkMJSHXESKcjs.KordocError)("\uC554\uD638\uB85C \uBCF4\uD638\uB41C PDF \uD30C\uC77C\uC785\uB2C8\uB2E4 (PDF \uC5F4\uAE30 \uC554\uD638\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4)");
3561
3670
  throw e;
3562
3671
  }),
3563
3672
  new Promise((_, reject) => {
3564
3673
  timer = setTimeout(() => {
3565
3674
  loadingTask.destroy();
3566
- reject(new (0, _chunkAUWO57EDcjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
3675
+ reject(new (0, _chunkMJSHXESKcjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
3567
3676
  }, PDF_LOAD_TIMEOUT_MS);
3568
3677
  })
3569
3678
  ]);
@@ -3572,15 +3681,15 @@ async function loadPdfWithTimeout(buffer) {
3572
3681
  }
3573
3682
  }
3574
3683
  async function parsePdfDocument(buffer, options) {
3575
- const formulaBuffer = _optionalChain([options, 'optionalAccess', _296 => _296.formulaOcr]) ? buffer : null;
3576
- const ocrOptionError = _chunkMED2MR6Ocjs.validateOcrOptions.call(void 0, options);
3577
- if (ocrOptionError) throw new (0, _chunkAUWO57EDcjs.KordocError)(ocrOptionError);
3578
- const autoOcr = _optionalChain([options, 'optionalAccess', _297 => _297.ocr]) === void 0 && await _chunkI4BS4BXEcjs.ocrModelsCached.call(void 0, _chunkI4BS4BXEcjs.resolveOcrModels.call(void 0, options));
3579
- const ocrBuffer = _optionalChain([options, 'optionalAccess', _298 => _298.ocr]) || autoOcr ? buffer : null;
3684
+ const formulaBuffer = _optionalChain([options, 'optionalAccess', _346 => _346.formulaOcr]) ? buffer : null;
3685
+ const ocrOptionError = _chunkK2NWHLCDcjs.validateOcrOptions.call(void 0, options);
3686
+ if (ocrOptionError) throw new (0, _chunkMJSHXESKcjs.KordocError)(ocrOptionError);
3687
+ const autoOcr = _optionalChain([options, 'optionalAccess', _347 => _347.ocr]) === void 0 && await _chunk4X7AR4EHcjs.ocrModelsCached.call(void 0, _chunk4X7AR4EHcjs.resolveOcrModels.call(void 0, options));
3688
+ const ocrBuffer = _optionalChain([options, 'optionalAccess', _348 => _348.ocr]) || autoOcr ? buffer : null;
3580
3689
  const doc = await loadPdfWithTimeout(buffer);
3581
3690
  try {
3582
3691
  const pageCount = doc.numPages;
3583
- if (pageCount === 0) throw new (0, _chunkAUWO57EDcjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
3692
+ if (pageCount === 0) throw new (0, _chunkMJSHXESKcjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
3584
3693
  const metadata = { pageCount, pageMode: "layout" };
3585
3694
  await extractPdfMetadata(doc, metadata);
3586
3695
  const blocks = [];
@@ -3589,8 +3698,8 @@ async function parsePdfDocument(buffer, options) {
3589
3698
  let totalChars = 0;
3590
3699
  let totalTextBytes = 0;
3591
3700
  const effectivePageCount = Math.min(pageCount, MAX_PAGES);
3592
- const pageFilter = _optionalChain([options, 'optionalAccess', _299 => _299.pages]) ? _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, effectivePageCount) : null;
3593
- if (pageCount > MAX_PAGES && (!_optionalChain([options, 'optionalAccess', _300 => _300.pages]) || _chunkJ55UQC5Hcjs.hasRequestedPagesAfter.call(void 0, options.pages, MAX_PAGES, pageCount))) {
3701
+ const pageFilter = _optionalChain([options, 'optionalAccess', _349 => _349.pages]) ? _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, effectivePageCount) : null;
3702
+ if (pageCount > MAX_PAGES && (!_optionalChain([options, 'optionalAccess', _350 => _350.pages]) || _chunkJ55UQC5Hcjs.hasRequestedPagesAfter.call(void 0, options.pages, MAX_PAGES, pageCount))) {
3594
3703
  warnings.push({ message: `${pageCount}\uCABD \uC911 \uC55E ${MAX_PAGES}\uCABD\uB9CC \uD30C\uC2F1\uD588\uC2B5\uB2C8\uB2E4 (\uCABD \uC218 \uC0C1\uD55C)`, code: "PARTIAL_PARSE" });
3595
3704
  }
3596
3705
  const totalTarget = pageFilter ? pageFilter.size : effectivePageCount;
@@ -3609,10 +3718,10 @@ async function parsePdfDocument(buffer, options) {
3609
3718
  const pageImageBlocks = /* @__PURE__ */ new Map();
3610
3719
  const carry = {};
3611
3720
  const vectorPageOps = /* @__PURE__ */ new Map();
3612
- const wrapLexicon = new (0, _chunkI4BS4BXEcjs.WrapLexicon)();
3721
+ const wrapLexicon = new (0, _chunk4X7AR4EHcjs.WrapLexicon)();
3613
3722
  const noteMarks = /* @__PURE__ */ new Map();
3614
3723
  const headerContext = [];
3615
- if (pageFilter && _optionalChain([options, 'optionalAccess', _301 => _301.removeHeaderFooter]) !== false && pageFilter.size < effectivePageCount) {
3724
+ if (pageFilter && _optionalChain([options, 'optionalAccess', _351 => _351.removeHeaderFooter]) !== false && pageFilter.size < effectivePageCount) {
3616
3725
  for (const number of selectionContextPages(pageFilter, effectivePageCount)) {
3617
3726
  let contextPage;
3618
3727
  try {
@@ -3622,7 +3731,7 @@ async function parsePdfDocument(buffer, options) {
3622
3731
  headerContext.push(...marginContextBlocks(content.items, number, contextPage.view));
3623
3732
  } catch (e6) {
3624
3733
  } finally {
3625
- _optionalChain([contextPage, 'optionalAccess', _302 => _302.cleanup, 'call', _303 => _303()]);
3734
+ _optionalChain([contextPage, 'optionalAccess', _352 => _352.cleanup, 'call', _353 => _353()]);
3626
3735
  }
3627
3736
  }
3628
3737
  }
@@ -3649,15 +3758,15 @@ async function parsePdfDocument(buffer, options) {
3649
3758
  return void 0;
3650
3759
  }
3651
3760
  };
3652
- const differencesOf = (loadedName) => _optionalChain([fontObj, 'call', _304 => _304(loadedName), 'optionalAccess', _305 => _305.differences]);
3761
+ const differencesOf = (loadedName) => _optionalChain([fontObj, 'call', _354 => _354(loadedName), 'optionalAccess', _355 => _355.differences]);
3653
3762
  const occluded = occludedTextItems(rawItems, rawOps.fnArray, rawOps.argsArray);
3654
3763
  markTrailingSpaceGlyphs(rawItems, rawOps.fnArray, rawOps.argsArray);
3655
- restoreNamedGlyphs(rawItems, rawOps.fnArray, rawOps.argsArray, differencesOf, (n) => _optionalChain([fontObj, 'call', _306 => _306(n), 'optionalAccess', _307 => _307.name]));
3764
+ restoreNamedGlyphs(rawItems, rawOps.fnArray, rawOps.argsArray, differencesOf, (n) => _optionalChain([fontObj, 'call', _356 => _356(n), 'optionalAccess', _357 => _357.name]));
3656
3765
  restoreUnmappedGlyphs(rawItems, rawOps.fnArray, rawOps.argsArray, (n) => fontObj(n));
3657
3766
  restoreTrackedSpacing(rawItems, rawOps.fnArray, rawOps.argsArray);
3658
3767
  markSyntheticSpaces(rawItems, rawOps.fnArray, rawOps.argsArray);
3659
- const items = _chunkI4BS4BXEcjs.normalizeItems.call(void 0, occluded.size ? rawItems.filter((it) => !occluded.has(it)) : rawItems);
3660
- const filtered = _chunkI4BS4BXEcjs.filterHiddenText.call(void 0, items, pageW, pageH, viewX1, viewY1);
3768
+ const items = _chunk4X7AR4EHcjs.normalizeItems.call(void 0, occluded.size ? rawItems.filter((it) => !occluded.has(it)) : rawItems);
3769
+ const filtered = _chunk4X7AR4EHcjs.filterHiddenText.call(void 0, items, pageW, pageH, viewX1, viewY1);
3661
3770
  const joined = joinVerticalColumns(filtered.visible);
3662
3771
  const visible = dropTabLeaderDots(joined);
3663
3772
  const hiddenCount = filtered.hiddenCount + occluded.size;
@@ -3681,27 +3790,27 @@ async function parsePdfDocument(buffer, options) {
3681
3790
  fnArray: [_pdfmjs.OPS.transform, ...rawOps.fnArray],
3682
3791
  argsArray: [[1, 0, 0, 1, -viewX1, -viewY1], ...rawOps.argsArray]
3683
3792
  } : rawOps;
3684
- remapSymbolFontItems(visible, (loadedName) => _optionalChain([fontObj, 'call', _308 => _308(loadedName), 'optionalAccess', _309 => _309.name]));
3793
+ remapSymbolFontItems(visible, (loadedName) => _optionalChain([fontObj, 'call', _358 => _358(loadedName), 'optionalAccess', _359 => _359.name]));
3685
3794
  remapControlGlyphs(visible, differencesOf);
3686
- await _chunkI4BS4BXEcjs.restoreImageBullets.call(void 0, visible, page, opList.fnArray, opList.argsArray, imageBulletShapes);
3795
+ await _chunk4X7AR4EHcjs.restoreImageBullets.call(void 0, visible, page, opList.fnArray, opList.argsArray, imageBulletShapes);
3687
3796
  const faces = /* @__PURE__ */ new Map();
3688
3797
  for (const it of visible) {
3689
3798
  if (!it.fontName) continue;
3690
3799
  let face = faces.get(it.fontName);
3691
3800
  if (face === void 0) {
3692
3801
  const obj = fontObj(it.fontName);
3693
- face = _optionalChain([obj, 'optionalAccess', _310 => _310.isType3Font]) && /^[A-Z]{6}\+./.test(_nullishCoalesce(obj.name, () => ( ""))) && obj.name.slice(7) || it.fontName;
3802
+ face = _optionalChain([obj, 'optionalAccess', _360 => _360.isType3Font]) && /^[A-Z]{6}\+./.test(_nullishCoalesce(obj.name, () => ( ""))) && obj.name.slice(7) || it.fontName;
3694
3803
  faces.set(it.fontName, face);
3695
3804
  }
3696
3805
  it.fontName = face;
3697
- if (!faceNames.has(face)) faceNames.set(face, (_nullishCoalesce(_optionalChain([fontObj, 'call', _311 => _311(face), 'optionalAccess', _312 => _312.name]), () => ( ""))).replace(/^[A-Z]{6}\+/, ""));
3806
+ if (!faceNames.has(face)) faceNames.set(face, (_nullishCoalesce(_optionalChain([fontObj, 'call', _361 => _361(face), 'optionalAccess', _362 => _362.name]), () => ( ""))).replace(/^[A-Z]{6}\+/, ""));
3698
3807
  }
3699
- for (const it of visible) if (it.text.includes("$")) it.text = _chunkMED2MR6Ocjs.escapeLiteralDollar.call(void 0, it.text);
3700
- for (const it of visible) if (it.text.includes("<")) it.text = _chunkMED2MR6Ocjs.escapeLiteralTags.call(void 0, it.text);
3808
+ for (const it of visible) if (it.text.includes("$")) it.text = _chunkK2NWHLCDcjs.escapeLiteralDollar.call(void 0, it.text);
3809
+ for (const it of visible) if (it.text.includes("<")) it.text = _chunkK2NWHLCDcjs.escapeLiteralTags.call(void 0, it.text);
3701
3810
  wrapEquationRuns(visible, (face) => faceNames.get(face));
3702
3811
  const pageArea = pageW * pageH;
3703
3812
  if (pageArea > 0) {
3704
- const imageRegions = _chunkI4BS4BXEcjs.extractImageRegions.call(void 0, opList.fnArray, opList.argsArray);
3813
+ const imageRegions = _chunk4X7AR4EHcjs.extractImageRegions.call(void 0, opList.fnArray, opList.argsArray);
3705
3814
  let uncovered = 0;
3706
3815
  for (const r of imageRegions) {
3707
3816
  const area = (r.x2 - r.x1) * (r.y2 - r.y1);
@@ -3727,15 +3836,15 @@ async function parsePdfDocument(buffer, options) {
3727
3836
  if (uncovered > 0) skippedImagePages.set(i, uncovered);
3728
3837
  }
3729
3838
  const marks = superscriptNoteMarks(visible);
3730
- if (marks.length) noteMarks.set(i, { marks, seps: footnoteSeparators(_chunkI4BS4BXEcjs.extractLines.call(void 0, opList.fnArray, opList.argsArray).horizontals, pageW, pageH) });
3839
+ if (marks.length) noteMarks.set(i, { marks, seps: footnoteSeparators(_chunk4X7AR4EHcjs.extractLines.call(void 0, opList.fnArray, opList.argsArray).horizontals, pageW, pageH) });
3731
3840
  const stamp = marginStamp(visible);
3732
3841
  const flow = stamp.length ? visible.filter((it) => !stamp.includes(it)) : visible;
3733
- const rightArrows = _optionalChain([options, 'optionalAccess', _313 => _313.tables]) !== false ? await _chunkI4BS4BXEcjs.detectRightArrowRegions.call(void 0, page, opList.fnArray, opList.argsArray, imageArrowDirections) : [];
3734
- const pageBlocks = orderTwoUpPage(_chunkI4BS4BXEcjs.extractPageBlocksWithLines.call(void 0, flow, i, opList, pageW, pageH, void 0, _optionalChain([options, 'optionalAccess', _314 => _314.tables]) !== false, carry, wrapLexicon, rightArrows), pageW, pageH);
3842
+ const rightArrows = _optionalChain([options, 'optionalAccess', _363 => _363.tables]) !== false ? await _chunk4X7AR4EHcjs.detectRightArrowRegions.call(void 0, page, opList.fnArray, opList.argsArray, imageArrowDirections) : [];
3843
+ const pageBlocks = orderTwoUpPage(_chunk4X7AR4EHcjs.extractPageBlocksWithLines.call(void 0, flow, i, opList, pageW, pageH, void 0, _optionalChain([options, 'optionalAccess', _364 => _364.tables]) !== false, carry, wrapLexicon, rightArrows), pageW, pageH);
3735
3844
  if (stamp.length) pageBlocks.unshift({ type: "paragraph", text: [...stamp].sort((a, b) => a.y - b.y).map((it) => it.text).join(" "), pageNumber: i });
3736
3845
  for (const b of pageBlocks) blocks.push(b);
3737
3846
  try {
3738
- const { blocks: imgBlocks, images: pageImages } = await extractPageImages(page, opList.fnArray, opList.argsArray, i, imageState, warnings, _optionalChain([options, 'optionalAccess', _315 => _315.images]) !== false);
3847
+ const { blocks: imgBlocks, images: pageImages } = await extractPageImages(page, opList.fnArray, opList.argsArray, i, imageState, warnings, _optionalChain([options, 'optionalAccess', _365 => _365.images]) !== false);
3739
3848
  if (imgBlocks.length > 0) pageImageBlocks.set(i, imgBlocks);
3740
3849
  extractedImages.push(...pageImages);
3741
3850
  } catch (e9) {
@@ -3754,17 +3863,17 @@ async function parsePdfDocument(buffer, options) {
3754
3863
  const vector = scanVectorGlyphs(opList.fnArray, opList.argsArray, visible);
3755
3864
  const quality = computePageQuality(i, pageText, vector.glyphs);
3756
3865
  pageQuality.push(quality);
3757
- if (_optionalChain([options, 'optionalAccess', _316 => _316.ocr]) && quality.ocrReason === "vector_text" && page.rotate % 360 === 0 && page.view[0] === 0 && page.view[1] === 0) {
3866
+ if (_optionalChain([options, 'optionalAccess', _366 => _366.ocr]) && quality.ocrReason === "vector_text" && page.rotate % 360 === 0 && page.view[0] === 0 && page.view[1] === 0) {
3758
3867
  vectorPageOps.set(i, ocrVectorOps(opList, vector.paths));
3759
3868
  }
3760
- if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunkAUWO57EDcjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
3869
+ if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunkMJSHXESKcjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
3761
3870
  parsedPages++;
3762
- _optionalChain([options, 'optionalAccess', _317 => _317.onProgress, 'optionalCall', _318 => _318(parsedPages, totalTarget)]);
3871
+ _optionalChain([options, 'optionalAccess', _367 => _367.onProgress, 'optionalCall', _368 => _368(parsedPages, totalTarget)]);
3763
3872
  } catch (pageErr) {
3764
- if (pageErr instanceof _chunkAUWO57EDcjs.KordocError) throw pageErr;
3873
+ if (pageErr instanceof _chunkMJSHXESKcjs.KordocError) throw pageErr;
3765
3874
  warnings.push({ page: i, message: `\uD398\uC774\uC9C0 ${i} \uD30C\uC2F1 \uC2E4\uD328: ${pageErr instanceof Error ? pageErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "PARTIAL_PARSE" });
3766
3875
  } finally {
3767
- _optionalChain([loadedPage, 'optionalAccess', _319 => _319.cleanup, 'call', _320 => _320()]);
3876
+ _optionalChain([loadedPage, 'optionalAccess', _369 => _369.cleanup, 'call', _370 => _370()]);
3768
3877
  }
3769
3878
  if (loadedFonts.size > FONT_CACHE_LIMIT) {
3770
3879
  await doc.cleanup();
@@ -3772,14 +3881,14 @@ async function parsePdfDocument(buffer, options) {
3772
3881
  }
3773
3882
  }
3774
3883
  const parsedPageCount = parsedPages || (pageFilter ? pageFilter.size : effectivePageCount);
3775
- const isImageBased = _optionalChain([pageFilter, 'optionalAccess', _321 => _321.size]) !== 0 && totalChars / Math.max(parsedPageCount, 1) < 10;
3884
+ const isImageBased = _optionalChain([pageFilter, 'optionalAccess', _371 => _371.size]) !== 0 && totalChars / Math.max(parsedPageCount, 1) < 10;
3776
3885
  const ocrDone = /* @__PURE__ */ new Set();
3777
3886
  const ocrLinesOut = /* @__PURE__ */ new Map();
3778
- const ocrRegions = _optionalChain([options, 'optionalAccess', _322 => _322.ocr]) === true || autoOcr ? ocrImageRegions(uncoveredImageRegions, largeImageRegions, _optionalChain([options, 'optionalAccess', _323 => _323.ocr]) === true) : /* @__PURE__ */ new Map();
3887
+ const ocrRegions = _optionalChain([options, 'optionalAccess', _372 => _372.ocr]) === true || autoOcr ? ocrImageRegions(uncoveredImageRegions, largeImageRegions, _optionalChain([options, 'optionalAccess', _373 => _373.ocr]) === true) : /* @__PURE__ */ new Map();
3779
3888
  if (ocrBuffer) {
3780
3889
  const inScope = (p) => !pageFilter || pageFilter.has(p);
3781
3890
  const targets = /* @__PURE__ */ new Set();
3782
- if (_optionalChain([options, 'optionalAccess', _324 => _324.ocr]) === "force" || isImageBased) {
3891
+ if (_optionalChain([options, 'optionalAccess', _374 => _374.ocr]) === "force" || isImageBased) {
3783
3892
  for (let i = 1; i <= effectivePageCount; i++) if (inScope(i)) targets.add(i);
3784
3893
  } else {
3785
3894
  for (const pq of pageQuality) {
@@ -3792,25 +3901,25 @@ async function parsePdfDocument(buffer, options) {
3792
3901
  }
3793
3902
  if (targets.size > 0) {
3794
3903
  try {
3795
- const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-6UXBIQE6.cjs")));
3796
- const mode = typeof _optionalChain([options, 'optionalAccess', _325 => _325.ocr]) === "function" ? options.ocr : "builtin";
3797
- const regionPages = new Map([...ocrRegions].filter(([p]) => _optionalChain([options, 'optionalAccess', _326 => _326.ocr]) !== "force" && !isImageBased && !_optionalChain([pageQuality, 'access', _327 => _327.find, 'call', _328 => _328((q) => q.page === p), 'optionalAccess', _329 => _329.needsOcr])));
3798
- const { builtinOcrConfig } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-6UXBIQE6.cjs")));
3799
- const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, _optionalChain([options, 'optionalAccess', _330 => _330.onProgress]), _optionalChain([options, 'optionalAccess', _331 => _331.tables]) !== false, vectorPageOps, regionPages, builtinOcrConfig(options), ocrLinesOut);
3800
- for (const obs of ocrPageBlocks.values()) _chunkMED2MR6Ocjs.stripScriptTags.call(void 0, { blocks: obs });
3904
+ const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-QWTGWYQT.cjs")));
3905
+ const mode = typeof _optionalChain([options, 'optionalAccess', _375 => _375.ocr]) === "function" ? options.ocr : "builtin";
3906
+ const regionPages = new Map([...ocrRegions].filter(([p]) => _optionalChain([options, 'optionalAccess', _376 => _376.ocr]) !== "force" && !isImageBased && !_optionalChain([pageQuality, 'access', _377 => _377.find, 'call', _378 => _378((q) => q.page === p), 'optionalAccess', _379 => _379.needsOcr])));
3907
+ const { builtinOcrConfig } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-QWTGWYQT.cjs")));
3908
+ const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, _optionalChain([options, 'optionalAccess', _380 => _380.onProgress]), _optionalChain([options, 'optionalAccess', _381 => _381.tables]) !== false, vectorPageOps, regionPages, builtinOcrConfig(options), ocrLinesOut);
3909
+ for (const obs of ocrPageBlocks.values()) _chunkK2NWHLCDcjs.stripScriptTags.call(void 0, { blocks: obs });
3801
3910
  if (ocrPageBlocks.size > 0) {
3802
3911
  const replacePages = /* @__PURE__ */ new Set();
3803
3912
  for (const [p, obs] of ocrPageBlocks) {
3804
- const needsOcr = _optionalChain([pageQuality, 'access', _332 => _332.find, 'call', _333 => _333((q) => q.page === p), 'optionalAccess', _334 => _334.needsOcr]);
3805
- if (_optionalChain([options, 'optionalAccess', _335 => _335.ocr]) === "force" || isImageBased || needsOcr) {
3913
+ const needsOcr = _optionalChain([pageQuality, 'access', _382 => _382.find, 'call', _383 => _383((q) => q.page === p), 'optionalAccess', _384 => _384.needsOcr]);
3914
+ if (_optionalChain([options, 'optionalAccess', _385 => _385.ocr]) === "force" || isImageBased || needsOcr) {
3806
3915
  replacePages.add(p);
3807
3916
  ocrDone.add(p);
3808
3917
  continue;
3809
3918
  }
3810
3919
  const regions = ocrRegions.get(p);
3811
- if (!regions || _chunkI4BS4BXEcjs.mergeOcrImageRegions.call(void 0, blocks, p, regions, obs) === 0) continue;
3920
+ if (!regions || _chunk4X7AR4EHcjs.mergeOcrImageRegions.call(void 0, blocks, p, regions, obs) === 0) continue;
3812
3921
  ocrDone.add(p);
3813
- if (_optionalChain([pageImageBlocks, 'access', _336 => _336.get, 'call', _337 => _337(p), 'optionalAccess', _338 => _338.length]) === 1) pageImageBlocks.delete(p);
3922
+ if (_optionalChain([pageImageBlocks, 'access', _386 => _386.get, 'call', _387 => _387(p), 'optionalAccess', _388 => _388.length]) === 1) pageImageBlocks.delete(p);
3814
3923
  }
3815
3924
  if (replacePages.size) {
3816
3925
  const merged = blocks.filter((b) => !(b.pageNumber && replacePages.has(b.pageNumber)));
@@ -3860,18 +3969,18 @@ async function parsePdfDocument(buffer, options) {
3860
3969
  warnings.push({ page, message: `${count}\uAC1C \uC774\uBBF8\uC9C0 \uC601\uC5ED\uC5D0 \uCD94\uCD9C \uAC00\uB2A5\uD55C \uD14D\uC2A4\uD2B8 \uC5C6\uC74C (\uADF8\uB9BC/\uCC28\uD2B8/\uB3C4\uC7A5 \uB0B4\uC6A9 \uB204\uB77D \uAC00\uB2A5 \u2014 \uADF8\uB9BC \uC18D \uAE00\uC740 ocr: true / CLI --ocr \uB85C \uC77D\uC2B5\uB2C8\uB2E4)`, code: "SKIPPED_IMAGE" });
3861
3970
  }
3862
3971
  }
3863
- if (_optionalChain([options, 'optionalAccess', _339 => _339.removeHeaderFooter]) !== false && (parsedPageCount >= 3 || headerContext.length)) {
3864
- const removed = _chunkI4BS4BXEcjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, false, headerContext);
3865
- const running = _chunkI4BS4BXEcjs.runningLinePatterns.call(void 0, removed.map((ri) => blocks[ri]), pageHeights);
3972
+ if (_optionalChain([options, 'optionalAccess', _389 => _389.removeHeaderFooter]) !== false && (parsedPageCount >= 3 || headerContext.length)) {
3973
+ const removed = _chunk4X7AR4EHcjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, false, headerContext);
3974
+ const running = _chunk4X7AR4EHcjs.runningLinePatterns.call(void 0, removed.map((ri) => blocks[ri]), pageHeights);
3866
3975
  for (let ri = removed.length - 1; ri >= 0; ri--) {
3867
3976
  blocks.splice(removed[ri], 1);
3868
3977
  }
3869
- const stripped = _chunkI4BS4BXEcjs.stripAbsorbedRunningLines.call(void 0, blocks, pageHeights, running);
3978
+ const stripped = _chunk4X7AR4EHcjs.stripAbsorbedRunningLines.call(void 0, blocks, pageHeights, running);
3870
3979
  if (stripped !== blocks) {
3871
3980
  blocks.length = 0;
3872
3981
  blocks.push(...stripped);
3873
3982
  }
3874
- const kept = _chunkI4BS4BXEcjs.removeSideTabs.call(void 0, blocks, pageWidths);
3983
+ const kept = _chunk4X7AR4EHcjs.removeSideTabs.call(void 0, blocks, pageWidths);
3875
3984
  if (kept !== blocks) {
3876
3985
  blocks.length = 0;
3877
3986
  blocks.push(...kept);
@@ -3879,15 +3988,15 @@ async function parsePdfDocument(buffer, options) {
3879
3988
  }
3880
3989
  mergeContinuedCells(blocks, pageHeights);
3881
3990
  mergeCrossPageTables(blocks, pageHeights, wrapLexicon);
3882
- if (_optionalChain([options, 'optionalAccess', _340 => _340.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
3883
- const boxes = _chunkI4BS4BXEcjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, true);
3991
+ if (_optionalChain([options, 'optionalAccess', _390 => _390.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
3992
+ const boxes = _chunk4X7AR4EHcjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, true);
3884
3993
  for (let ri = boxes.length - 1; ri >= 0; ri--) blocks.splice(boxes[ri], 1);
3885
3994
  }
3886
3995
  splitContactTables(blocks);
3887
- if (!_optionalChain([options, 'optionalAccess', _341 => _341.keepTrailingEmptyCols])) _chunkI4BS4BXEcjs.trimTrailingEmptyTableCols.call(void 0, blocks);
3888
- _chunkI4BS4BXEcjs.joinPageBreakWraps.call(void 0, blocks, wrapLexicon);
3996
+ if (!_optionalChain([options, 'optionalAccess', _391 => _391.keepTrailingEmptyCols])) _chunk4X7AR4EHcjs.trimTrailingEmptyTableCols.call(void 0, blocks);
3997
+ _chunk4X7AR4EHcjs.joinPageBreakWraps.call(void 0, blocks, wrapLexicon);
3889
3998
  injectPageImageBlocks(blocks, pageImageBlocks);
3890
- if (_optionalChain([options, 'optionalAccess', _342 => _342.formulaOcr]) && formulaBuffer) {
3999
+ if (_optionalChain([options, 'optionalAccess', _392 => _392.formulaOcr]) && formulaBuffer) {
3891
4000
  try {
3892
4001
  await applyFormulaOcr(formulaBuffer, blocks, pageFilter, effectivePageCount, warnings, options.onProgress);
3893
4002
  } catch (e) {
@@ -3897,54 +4006,54 @@ async function parsePdfDocument(buffer, options) {
3897
4006
  });
3898
4007
  }
3899
4008
  }
3900
- const medianFontSize = _chunkI4BS4BXEcjs.computeMedianFontSizeFromFreq.call(void 0, fontSizeFreq);
4009
+ const medianFontSize = _chunk4X7AR4EHcjs.computeMedianFontSizeFromFreq.call(void 0, fontSizeFreq);
3901
4010
  if (medianFontSize > 0) {
3902
- _chunkI4BS4BXEcjs.detectHeadings.call(void 0, blocks, medianFontSize);
3903
- }
3904
- _chunkI4BS4BXEcjs.detectDocumentStyleHeadings.call(void 0, blocks);
3905
- _chunkI4BS4BXEcjs.detectTypographyHeadings.call(void 0, blocks);
3906
- _chunkI4BS4BXEcjs.detectSiblingStyleHeadings.call(void 0, blocks);
3907
- _chunkI4BS4BXEcjs.detectRepeatedPageLabels.call(void 0, blocks);
3908
- _chunkI4BS4BXEcjs.detectPageLeadHeadings.call(void 0, blocks);
3909
- _chunkI4BS4BXEcjs.mergeStackedHeadingLines.call(void 0, blocks, medianFontSize);
3910
- _chunkI4BS4BXEcjs.refineDocumentStyleHeadings.call(void 0, blocks);
3911
- _chunkI4BS4BXEcjs.detectMarkerHeadings.call(void 0, blocks);
4011
+ _chunk4X7AR4EHcjs.detectHeadings.call(void 0, blocks, medianFontSize);
4012
+ }
4013
+ _chunk4X7AR4EHcjs.detectDocumentStyleHeadings.call(void 0, blocks);
4014
+ _chunk4X7AR4EHcjs.detectTypographyHeadings.call(void 0, blocks);
4015
+ _chunk4X7AR4EHcjs.detectSiblingStyleHeadings.call(void 0, blocks);
4016
+ _chunk4X7AR4EHcjs.detectRepeatedPageLabels.call(void 0, blocks);
4017
+ _chunk4X7AR4EHcjs.detectPageLeadHeadings.call(void 0, blocks);
4018
+ _chunk4X7AR4EHcjs.mergeStackedHeadingLines.call(void 0, blocks, medianFontSize);
4019
+ _chunk4X7AR4EHcjs.refineDocumentStyleHeadings.call(void 0, blocks);
4020
+ _chunk4X7AR4EHcjs.detectMarkerHeadings.call(void 0, blocks);
3912
4021
  demoteNonHeadingRoles(blocks, pageHeights, faceNames);
3913
- _chunkI4BS4BXEcjs.detectTableCaptions.call(void 0, blocks);
3914
- _chunkI4BS4BXEcjs.detectKoreanListBlocks.call(void 0, blocks);
4022
+ _chunk4X7AR4EHcjs.detectTableCaptions.call(void 0, blocks);
4023
+ _chunk4X7AR4EHcjs.detectKoreanListBlocks.call(void 0, blocks);
3915
4024
  sanitizeBlockControlChars(blocks);
3916
4025
  let outBlocks = splitSingleCellTables(blocks);
3917
- if (_optionalChain([options, 'optionalAccess', _343 => _343.layoutTables]) !== "keep") {
4026
+ if (_optionalChain([options, 'optionalAccess', _393 => _393.layoutTables]) !== "keep") {
3918
4027
  blocks.length = 0;
3919
4028
  for (const block of outBlocks) blocks.push(block);
3920
4029
  }
3921
4030
  outBlocks = inlineFootnotes(outBlocks, noteMarks);
3922
4031
  outBlocks = relocateEndnotes(outBlocks);
3923
- if (_optionalChain([options, 'optionalAccess', _344 => _344.removeHeaderFooter]) !== false) outBlocks = outBlocks.filter((b) => {
4032
+ if (_optionalChain([options, 'optionalAccess', _394 => _394.removeHeaderFooter]) !== false) outBlocks = outBlocks.filter((b) => {
3924
4033
  if (b.type !== "paragraph" || !/^\s*\d{1,4}\s*$/.test(_nullishCoalesce(b.text, () => ( "")))) return true;
3925
4034
  const h = pageHeights.get(_nullishCoalesce(b.pageNumber, () => ( 0)));
3926
4035
  if (!b.bbox || !h) return false;
3927
4036
  return b.bbox.y > h * 0.1 && b.bbox.y + b.bbox.height < h * 0.9;
3928
4037
  });
3929
4038
  joinLatinCellWraps(outBlocks);
3930
- if (_optionalChain([options, 'optionalAccess', _345 => _345.layoutTables]) !== "keep") {
4039
+ if (_optionalChain([options, 'optionalAccess', _395 => _395.layoutTables]) !== "keep") {
3931
4040
  const hancom = await isHancomPdf(doc);
3932
4041
  const shown = /* @__PURE__ */ new Map();
3933
4042
  const markContent = (bs) => {
3934
4043
  for (const b of _nullishCoalesce(bs, () => ( []))) if (b.table) for (const row of b.table.cells) for (const c of row) {
3935
- if (_chunkI4BS4BXEcjs.IMAGE_CELLS.has(c)) _chunkMED2MR6Ocjs.CONTENT_CELLS.add(c);
3936
- const lines = _chunkI4BS4BXEcjs.CELL_LINES.get(c);
3937
- if (lines) _chunkMED2MR6Ocjs.CELL_BASELINES.set(c, lines.map((l) => l.y));
4044
+ if (_chunk4X7AR4EHcjs.IMAGE_CELLS.has(c)) _chunkK2NWHLCDcjs.CONTENT_CELLS.add(c);
4045
+ const lines = _chunk4X7AR4EHcjs.CELL_LINES.get(c);
4046
+ if (lines) _chunkK2NWHLCDcjs.CELL_BASELINES.set(c, lines.map((l) => l.y));
3938
4047
  markContent(c.blocks);
3939
4048
  }
3940
4049
  };
3941
4050
  const visual = (bs) => bs.flatMap((b) => {
3942
4051
  if (b.type !== "table") return [b];
3943
- if (!hancom && b.table && _chunkI4BS4BXEcjs.CLIP_TABLES.has(b.table)) return [b];
4052
+ if (!hancom && b.table && _chunk4X7AR4EHcjs.CLIP_TABLES.has(b.table)) return [b];
3944
4053
  let v = shown.get(b);
3945
4054
  if (!v) {
3946
4055
  markContent([b]);
3947
- shown.set(b, v = _chunkMED2MR6Ocjs.unframeLayoutTables.call(void 0, [b], !!_optionalChain([options, 'optionalAccess', _346 => _346.keepTrailingEmptyCols])));
4056
+ shown.set(b, v = _chunkK2NWHLCDcjs.unframeLayoutTables.call(void 0, [b], !!_optionalChain([options, 'optionalAccess', _396 => _396.keepTrailingEmptyCols])));
3948
4057
  }
3949
4058
  return v;
3950
4059
  });
@@ -3953,13 +4062,13 @@ async function parsePdfDocument(buffer, options) {
3953
4062
  blocks.length = 0;
3954
4063
  for (const b of kept) blocks.push(b);
3955
4064
  }
3956
- const finishMarkdown = (bs) => mergeLinkRuns(cleanPdfText(_chunkMED2MR6Ocjs.blocksToMarkdown.call(void 0, bs, { tableFormat: _optionalChain([options, 'optionalAccess', _347 => _347.tableFormat]) }), { keepLoneNumbers: true }));
3957
- if (_optionalChain([options, 'optionalAccess', _348 => _348.tableFormat]) === "gfm") _chunkMED2MR6Ocjs.assignTableIds.call(void 0, blocks);
4065
+ const finishMarkdown = (bs) => mergeLinkRuns(cleanPdfText(_chunkK2NWHLCDcjs.blocksToMarkdown.call(void 0, bs, { tableFormat: _optionalChain([options, 'optionalAccess', _397 => _397.tableFormat]) }), { keepLoneNumbers: true }));
4066
+ if (_optionalChain([options, 'optionalAccess', _398 => _398.tableFormat]) === "gfm") _chunkK2NWHLCDcjs.assignTableIds.call(void 0, blocks);
3958
4067
  let markdown = finishMarkdown(outBlocks);
3959
4068
  const outline = collectPdfOutline(outBlocks);
3960
4069
  return {
3961
4070
  markdown,
3962
- pages: _chunkEKKZNKJDcjs.blocksToPages.call(void 0, splitPageTables(_chunkI4BS4BXEcjs.splitPageBreakWraps.call(void 0, outBlocks)), finishMarkdown),
4071
+ pages: _chunkVXQWAPC6cjs.blocksToPages.call(void 0, splitPageTables(_chunk4X7AR4EHcjs.splitPageBreakWraps.call(void 0, outBlocks)), finishMarkdown),
3963
4072
  blocks,
3964
4073
  metadata,
3965
4074
  outline: outline.length > 0 ? outline : void 0,
@@ -3968,7 +4077,7 @@ async function parsePdfDocument(buffer, options) {
3968
4077
  pageQuality,
3969
4078
  qualitySummary: summarizeDocumentQuality(pageQuality),
3970
4079
  images: extractedImages.length > 0 ? extractedImages : void 0,
3971
- ..._optionalChain([options, 'optionalAccess', _349 => _349.ocrLines]) ? { ocrLines: [...ocrLinesOut.values()].sort((a, b) => a.pageNumber - b.pageNumber) } : {}
4080
+ ..._optionalChain([options, 'optionalAccess', _399 => _399.ocrLines]) ? { ocrLines: [...ocrLinesOut.values()].sort((a, b) => a.pageNumber - b.pageNumber) } : {}
3972
4081
  };
3973
4082
  } finally {
3974
4083
  await doc.destroy().catch(() => {
@@ -3978,7 +4087,7 @@ async function parsePdfDocument(buffer, options) {
3978
4087
  async function extractPdfMetadata(doc, metadata) {
3979
4088
  try {
3980
4089
  const result = await doc.getMetadata();
3981
- if (!_optionalChain([result, 'optionalAccess', _350 => _350.info])) return;
4090
+ if (!_optionalChain([result, 'optionalAccess', _400 => _400.info])) return;
3982
4091
  const info = result.info;
3983
4092
  if (typeof info.Title === "string" && info.Title.trim()) metadata.title = info.Title.trim();
3984
4093
  if (typeof info.Author === "string" && info.Author.trim()) metadata.author = info.Author.trim();
@@ -3994,8 +4103,8 @@ async function extractPdfMetadata(doc, metadata) {
3994
4103
  }
3995
4104
  async function isHancomPdf(doc) {
3996
4105
  try {
3997
- const info = await _asyncOptionalChain([(await doc.getMetadata()), 'optionalAccess', async _351 => _351.info]);
3998
- return [_optionalChain([info, 'optionalAccess', _352 => _352.Producer]), _optionalChain([info, 'optionalAccess', _353 => _353.Creator])].some((v) => typeof v === "string" && /^\s*(?:hancom\b|hwp\b)/i.test(v));
4106
+ const info = await _asyncOptionalChain([(await doc.getMetadata()), 'optionalAccess', async _401 => _401.info]);
4107
+ return [_optionalChain([info, 'optionalAccess', _402 => _402.Producer]), _optionalChain([info, 'optionalAccess', _403 => _403.Creator])].some((v) => typeof v === "string" && /^\s*(?:hancom\b|hwp\b)/i.test(v));
3999
4108
  } catch (e11) {
4000
4109
  return false;
4001
4110
  }
@@ -4039,5 +4148,5 @@ function marginStamp(items) {
4039
4148
 
4040
4149
 
4041
4150
 
4042
- exports.PDFJS_DOCUMENT_OPTIONS = PDFJS_DOCUMENT_OPTIONS; exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks = _chunkI4BS4BXEcjs.detectKoreanListBlocks; exports.detectTableCaptions = _chunkI4BS4BXEcjs.detectTableCaptions; exports.extractPdfMetadataOnly = extractPdfMetadataOnly; exports.mergeCrossPageTables = mergeCrossPageTables; exports.ocrImageRegions = ocrImageRegions; exports.parsePdfDocument = parsePdfDocument; exports.removeHeaderFooterBlocks = _chunkI4BS4BXEcjs.removeHeaderFooterBlocks;
4043
- //# sourceMappingURL=parser-OKAQRZKM.cjs.map
4151
+ exports.PDFJS_DOCUMENT_OPTIONS = PDFJS_DOCUMENT_OPTIONS; exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks = _chunk4X7AR4EHcjs.detectKoreanListBlocks; exports.detectTableCaptions = _chunk4X7AR4EHcjs.detectTableCaptions; exports.extractPdfMetadataOnly = extractPdfMetadataOnly; exports.mergeCrossPageTables = mergeCrossPageTables; exports.ocrImageRegions = ocrImageRegions; exports.parsePdfDocument = parsePdfDocument; exports.removeHeaderFooterBlocks = _chunk4X7AR4EHcjs.removeHeaderFooterBlocks;
4152
+ //# sourceMappingURL=parser-ZFXVZZKQ.cjs.map