kordoc 4.18.1 → 4.18.2

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 (144) hide show
  1. package/README.md +7 -6
  2. package/dist/{-X4KTLQC6.js → -I3CP33G4.js} +13 -11
  3. package/dist/{chunk-NQR3VKWN.js → chunk-4B2EXELH.js} +2 -2
  4. package/dist/{chunk-SQQ4ITJ5.js → chunk-6OKBTY72.js} +2 -2
  5. package/dist/{chunk-HUGBJVAA.js → chunk-B2E6C2LH.js} +12 -7
  6. package/dist/chunk-B2E6C2LH.js.map +1 -0
  7. package/dist/{chunk-X625PCZM.js → chunk-BL7KRE6X.js} +3 -3
  8. package/dist/{chunk-5PNQIF3V.js → chunk-C2CVOC5K.js} +4 -4
  9. package/dist/{chunk-AQUNBGXH.js → chunk-CKUIFTXJ.js} +2 -2
  10. package/dist/{chunk-TMC4A3FM.js → chunk-F5HING4Y.js} +10 -5
  11. package/dist/chunk-F5HING4Y.js.map +1 -0
  12. package/dist/{chunk-PWRY4W6Q.js → chunk-GM7XIZF2.js} +2 -2
  13. package/dist/chunk-GS7T56RP.cjs.map +1 -1
  14. package/dist/{chunk-K35WIYBD.js → chunk-IA3UKDHA.js} +4 -4
  15. package/dist/chunk-IA3UKDHA.js.map +1 -0
  16. package/dist/chunk-J55UQC5H.cjs.map +1 -1
  17. package/dist/{chunk-7DC2KL3V.cjs → chunk-KDMAYOWH.cjs} +158 -43
  18. package/dist/chunk-KDMAYOWH.cjs.map +1 -0
  19. package/dist/{chunk-Z4KCEERM.js → chunk-L5RLJPI3.js} +3 -3
  20. package/dist/{chunk-WWOTHS2E.js → chunk-L64QRUMK.js} +202 -7
  21. package/dist/chunk-L64QRUMK.js.map +1 -0
  22. package/dist/{chunk-6N5BOPJI.js → chunk-LACO375L.js} +2 -2
  23. package/dist/{chunk-KXR4CTFT.js → chunk-LSOD2A6N.js} +2 -2
  24. package/dist/{chunk-UTVMLJZE.js → chunk-M4P7YS2N.js} +389 -57
  25. package/dist/chunk-M4P7YS2N.js.map +1 -0
  26. package/dist/{chunk-VDIXNEWV.js → chunk-N5DQFA7L.js} +2 -2
  27. package/dist/{chunk-R2IFWAHI.js → chunk-NZM2SSI4.js} +2 -2
  28. package/dist/{chunk-KBZ3MQJX.js → chunk-O2DI4GHD.js} +2 -2
  29. package/dist/{chunk-I7YWXECO.js → chunk-OBILAVWC.js} +2 -2
  30. package/dist/{chunk-6V7QRQY3.js → chunk-OGAYGUJF.js} +122 -87
  31. package/dist/chunk-OGAYGUJF.js.map +1 -0
  32. package/dist/{chunk-IUMV45TX.cjs → chunk-OI5ZSSIC.cjs} +12 -12
  33. package/dist/chunk-OI5ZSSIC.cjs.map +1 -0
  34. package/dist/{chunk-Q5N4YS3T.cjs → chunk-QGFZU3JE.cjs} +16 -11
  35. package/dist/chunk-QGFZU3JE.cjs.map +1 -0
  36. package/dist/{chunk-2VFZQ634.js → chunk-QP7IXF7R.js} +2 -2
  37. package/dist/{chunk-CWJ5KY2F.js → chunk-T4MXCSBP.js} +137 -27
  38. package/dist/chunk-T4MXCSBP.js.map +1 -0
  39. package/dist/{chunk-PCSOJ523.cjs → chunk-UZGZRGYM.cjs} +2 -2
  40. package/dist/chunk-UZGZRGYM.cjs.map +1 -0
  41. package/dist/{chunk-MTTYJEKA.js → chunk-VSY5PAJ5.js} +2 -2
  42. package/dist/{chunk-IXAXI2S3.cjs → chunk-W2YYBPW5.cjs} +3 -3
  43. package/dist/chunk-W2YYBPW5.cjs.map +1 -0
  44. package/dist/{chunk-SIZ63E5G.cjs → chunk-YNLW6EGU.cjs} +3 -3
  45. package/dist/chunk-YNLW6EGU.cjs.map +1 -0
  46. package/dist/chunks-IFFRC5IQ.js +10 -0
  47. package/dist/cli.js +26 -26
  48. package/dist/{formula-LICM6K27.js → formula-AQZODKZF.js} +3 -3
  49. package/dist/{formula-T4Q2UHWO.js → formula-E3N7KDDG.js} +4 -4
  50. package/dist/{formula-W3GQC6L6.cjs → formula-VY4ITOMN.cjs} +9 -9
  51. package/dist/formula-VY4ITOMN.cjs.map +1 -0
  52. package/dist/{image-ocr-7PNHBD2G.cjs → image-ocr-6LYEBMVR.cjs} +15 -15
  53. package/dist/image-ocr-6LYEBMVR.cjs.map +1 -0
  54. package/dist/{image-ocr-WZJURDX6.js → image-ocr-IMYXOHHV.js} +6 -6
  55. package/dist/{image-ocr-XB2NFKGZ.js → image-ocr-LN3GSQPW.js} +9 -9
  56. package/dist/index.cjs +1037 -603
  57. package/dist/index.cjs.map +1 -1
  58. package/dist/index.d.cts +7 -5
  59. package/dist/index.d.ts +7 -5
  60. package/dist/index.js +523 -89
  61. package/dist/index.js.map +1 -1
  62. package/dist/mcp.js +26 -27
  63. package/dist/mcp.js.map +1 -1
  64. package/dist/{model-bundle-O2XYR54X.js → model-bundle-IHKNDLOT.js} +5 -5
  65. package/dist/{models-SKK3NH3V.js → models-YXITRAMR.js} +5 -5
  66. package/dist/page-range-QHHFTL7X.cjs.map +1 -1
  67. package/dist/{parser-PJUZSMFR.cjs → parser-7KECZTTP.cjs} +176 -228
  68. package/dist/parser-7KECZTTP.cjs.map +1 -0
  69. package/dist/{parser-4D2M5BKY.js → parser-KB4BYQBZ.js} +14 -66
  70. package/dist/parser-KB4BYQBZ.js.map +1 -0
  71. package/dist/{parser-5G5G7HHG.js → parser-M3T2EWUN.js} +11 -63
  72. package/dist/parser-M3T2EWUN.js.map +1 -0
  73. package/dist/pdf-ocr-4S2OAHUX.js +15 -0
  74. package/dist/pdf-ocr-IGYCZ7G2.cjs +16 -0
  75. package/dist/pdf-ocr-IGYCZ7G2.cjs.map +1 -0
  76. package/dist/pdf-ocr-YEBFWU2K.js +19 -0
  77. package/dist/{profile-io-BAQTYPK7.js → profile-io-GQWQR7YQ.js} +3 -3
  78. package/dist/{rasterize-A2ZEACKV.js → rasterize-Y6TVFQ3M.js} +3 -3
  79. package/dist/{redact-doc-26KN2LSZ.js → redact-doc-TRPZ3HNW.js} +11 -11
  80. package/dist/{render-62ZUDMHB.js → render-GHT5HKBO.js} +7 -7
  81. package/dist/seal-3YTXSABW.js +10 -0
  82. package/dist/{setup-2A3E6WRE.js → setup-AGSCEHDB.js} +3 -3
  83. package/dist/visual-R3E35Q2K.js +20 -0
  84. package/dist/{watch-D2T5FEKT.js → watch-ALSEW4GB.js} +13 -13
  85. package/dist/watch-ALSEW4GB.js.map +1 -0
  86. package/package.json +1 -1
  87. package/dist/chunk-6V7QRQY3.js.map +0 -1
  88. package/dist/chunk-7DC2KL3V.cjs.map +0 -1
  89. package/dist/chunk-CWJ5KY2F.js.map +0 -1
  90. package/dist/chunk-HUGBJVAA.js.map +0 -1
  91. package/dist/chunk-IUMV45TX.cjs.map +0 -1
  92. package/dist/chunk-IXAXI2S3.cjs.map +0 -1
  93. package/dist/chunk-K35WIYBD.js.map +0 -1
  94. package/dist/chunk-PCSOJ523.cjs.map +0 -1
  95. package/dist/chunk-Q5N4YS3T.cjs.map +0 -1
  96. package/dist/chunk-SIZ63E5G.cjs.map +0 -1
  97. package/dist/chunk-TMC4A3FM.js.map +0 -1
  98. package/dist/chunk-UTVMLJZE.js.map +0 -1
  99. package/dist/chunk-WWOTHS2E.js.map +0 -1
  100. package/dist/chunks-ACUC63N3.js +0 -10
  101. package/dist/formula-W3GQC6L6.cjs.map +0 -1
  102. package/dist/image-ocr-7PNHBD2G.cjs.map +0 -1
  103. package/dist/parser-4D2M5BKY.js.map +0 -1
  104. package/dist/parser-5G5G7HHG.js.map +0 -1
  105. package/dist/parser-PJUZSMFR.cjs.map +0 -1
  106. package/dist/pdf-ocr-EGWOIB6O.cjs +0 -16
  107. package/dist/pdf-ocr-EGWOIB6O.cjs.map +0 -1
  108. package/dist/pdf-ocr-NJTFXBRC.js +0 -19
  109. package/dist/pdf-ocr-ZXR6Q6BK.js +0 -15
  110. package/dist/seal-3GXC2API.js +0 -10
  111. package/dist/visual-4ZBZRMCM.js +0 -20
  112. package/dist/watch-D2T5FEKT.js.map +0 -1
  113. /package/dist/{-X4KTLQC6.js.map → -I3CP33G4.js.map} +0 -0
  114. /package/dist/{chunk-NQR3VKWN.js.map → chunk-4B2EXELH.js.map} +0 -0
  115. /package/dist/{chunk-SQQ4ITJ5.js.map → chunk-6OKBTY72.js.map} +0 -0
  116. /package/dist/{chunk-X625PCZM.js.map → chunk-BL7KRE6X.js.map} +0 -0
  117. /package/dist/{chunk-5PNQIF3V.js.map → chunk-C2CVOC5K.js.map} +0 -0
  118. /package/dist/{chunk-AQUNBGXH.js.map → chunk-CKUIFTXJ.js.map} +0 -0
  119. /package/dist/{chunk-PWRY4W6Q.js.map → chunk-GM7XIZF2.js.map} +0 -0
  120. /package/dist/{chunk-Z4KCEERM.js.map → chunk-L5RLJPI3.js.map} +0 -0
  121. /package/dist/{chunk-6N5BOPJI.js.map → chunk-LACO375L.js.map} +0 -0
  122. /package/dist/{chunk-KXR4CTFT.js.map → chunk-LSOD2A6N.js.map} +0 -0
  123. /package/dist/{chunk-VDIXNEWV.js.map → chunk-N5DQFA7L.js.map} +0 -0
  124. /package/dist/{chunk-R2IFWAHI.js.map → chunk-NZM2SSI4.js.map} +0 -0
  125. /package/dist/{chunk-KBZ3MQJX.js.map → chunk-O2DI4GHD.js.map} +0 -0
  126. /package/dist/{chunk-I7YWXECO.js.map → chunk-OBILAVWC.js.map} +0 -0
  127. /package/dist/{chunk-2VFZQ634.js.map → chunk-QP7IXF7R.js.map} +0 -0
  128. /package/dist/{chunk-MTTYJEKA.js.map → chunk-VSY5PAJ5.js.map} +0 -0
  129. /package/dist/{chunks-ACUC63N3.js.map → chunks-IFFRC5IQ.js.map} +0 -0
  130. /package/dist/{formula-LICM6K27.js.map → formula-AQZODKZF.js.map} +0 -0
  131. /package/dist/{formula-T4Q2UHWO.js.map → formula-E3N7KDDG.js.map} +0 -0
  132. /package/dist/{image-ocr-WZJURDX6.js.map → image-ocr-IMYXOHHV.js.map} +0 -0
  133. /package/dist/{image-ocr-XB2NFKGZ.js.map → image-ocr-LN3GSQPW.js.map} +0 -0
  134. /package/dist/{model-bundle-O2XYR54X.js.map → model-bundle-IHKNDLOT.js.map} +0 -0
  135. /package/dist/{models-SKK3NH3V.js.map → models-YXITRAMR.js.map} +0 -0
  136. /package/dist/{pdf-ocr-NJTFXBRC.js.map → pdf-ocr-4S2OAHUX.js.map} +0 -0
  137. /package/dist/{pdf-ocr-ZXR6Q6BK.js.map → pdf-ocr-YEBFWU2K.js.map} +0 -0
  138. /package/dist/{profile-io-BAQTYPK7.js.map → profile-io-GQWQR7YQ.js.map} +0 -0
  139. /package/dist/{rasterize-A2ZEACKV.js.map → rasterize-Y6TVFQ3M.js.map} +0 -0
  140. /package/dist/{redact-doc-26KN2LSZ.js.map → redact-doc-TRPZ3HNW.js.map} +0 -0
  141. /package/dist/{render-62ZUDMHB.js.map → render-GHT5HKBO.js.map} +0 -0
  142. /package/dist/{seal-3GXC2API.js.map → seal-3YTXSABW.js.map} +0 -0
  143. /package/dist/{setup-2A3E6WRE.js.map → setup-AGSCEHDB.js.map} +0 -0
  144. /package/dist/{visual-4ZBZRMCM.js.map → visual-R3E35Q2K.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 _chunkIXAXI2S3cjs = require('./chunk-IXAXI2S3.cjs');
4
+ var _chunkW2YYBPW5cjs = require('./chunk-W2YYBPW5.cjs');
5
5
 
6
6
 
7
7
 
@@ -47,8 +47,8 @@ var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
47
47
 
48
48
 
49
49
 
50
- var _chunk7DC2KL3Vcjs = require('./chunk-7DC2KL3V.cjs');
51
50
 
51
+ var _chunkKDMAYOWHcjs = require('./chunk-KDMAYOWH.cjs');
52
52
 
53
53
 
54
54
 
@@ -56,12 +56,14 @@ var _chunk7DC2KL3Vcjs = require('./chunk-7DC2KL3V.cjs');
56
56
 
57
57
 
58
58
 
59
- var _chunkQ5N4YS3Tcjs = require('./chunk-Q5N4YS3T.cjs');
60
- require('./chunk-SIZ63E5G.cjs');
61
59
 
62
60
 
61
+ var _chunkQGFZU3JEcjs = require('./chunk-QGFZU3JE.cjs');
62
+ require('./chunk-YNLW6EGU.cjs');
63
63
 
64
- var _chunkPCSOJ523cjs = require('./chunk-PCSOJ523.cjs');
64
+
65
+
66
+ var _chunkUZGZRGYMcjs = require('./chunk-UZGZRGYM.cjs');
65
67
 
66
68
 
67
69
  var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
@@ -255,7 +257,7 @@ async function extractPageImages(page, fnArray, argsArray, pageNumber, state, wa
255
257
  const filename = `image_${String(state.imageIndex).padStart(3, "0")}.png`;
256
258
  state.seen.set(hash, filename);
257
259
  if (withBytes) {
258
- const png = _chunkIXAXI2S3cjs.encodePng.call(void 0, w, h, rgba);
260
+ const png = _chunkW2YYBPW5cjs.encodePng.call(void 0, w, h, rgba);
259
261
  state.totalBytes += png.length;
260
262
  images.push({ filename, data: png, mimeType: "image/png" });
261
263
  }
@@ -770,19 +772,19 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
770
772
  if (r + dr < rows) owner[r + dr][dc] = placed;
771
773
  }
772
774
  grid[r][c1] = { ...a.cell, colSpan: c2 - c1, rowSpan: a.rs };
773
- const lines = _chunk7DC2KL3Vcjs.CELL_LINES.get(a.cell);
774
- if (lines) _chunk7DC2KL3Vcjs.CELL_LINES.set(grid[r][c1], shift ? lines.map((l) => ({ ...l, l: l.l + shift, r: l.r + shift })) : lines);
775
- if (_chunk7DC2KL3Vcjs.IMAGE_CELLS.has(a.cell)) _chunk7DC2KL3Vcjs.IMAGE_CELLS.add(grid[r][c1]);
776
- const edges = _chunkQ5N4YS3Tcjs.CELL_EDGES.get(a.cell);
775
+ const lines = _chunkKDMAYOWHcjs.CELL_LINES.get(a.cell);
776
+ if (lines) _chunkKDMAYOWHcjs.CELL_LINES.set(grid[r][c1], shift ? lines.map((l) => ({ ...l, l: l.l + shift, r: l.r + shift })) : lines);
777
+ if (_chunkKDMAYOWHcjs.IMAGE_CELLS.has(a.cell)) _chunkKDMAYOWHcjs.IMAGE_CELLS.add(grid[r][c1]);
778
+ const edges = _chunkQGFZU3JEcjs.CELL_EDGES.get(a.cell);
777
779
  if (edges) {
778
- _chunkQ5N4YS3Tcjs.CELL_EDGES.set(grid[r][c1], edges);
780
+ _chunkQGFZU3JEcjs.CELL_EDGES.set(grid[r][c1], edges);
779
781
  edged = true;
780
782
  }
781
783
  return true;
782
784
  };
783
- for (const a of pa) if (!_chunk7DC2KL3Vcjs.FILLER_CELLS.has(a.cell) && !place(a, pcx, 0)) return null;
785
+ for (const a of pa) if (!_chunkKDMAYOWHcjs.FILLER_CELLS.has(a.cell) && !place(a, pcx, 0)) return null;
784
786
  for (const a of ca) {
785
- if (a.r < skip || _chunk7DC2KL3Vcjs.FILLER_CELLS.has(a.cell)) continue;
787
+ if (a.r < skip || _chunkKDMAYOWHcjs.FILLER_CELLS.has(a.cell)) continue;
786
788
  if (!place(a, cxU, prev.rows - skip, dx)) return null;
787
789
  }
788
790
  const first = prev.rows;
@@ -806,9 +808,9 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
806
808
  const grown = { ...above, rs: newRs };
807
809
  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;
808
810
  }
809
- for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunk7DC2KL3Vcjs.FILLER_CELLS.add(grid[r][c]);
811
+ for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkKDMAYOWHcjs.FILLER_CELLS.add(grid[r][c]);
810
812
  if (edged) {
811
- for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkQ5N4YS3Tcjs.CELL_EDGES.set(grid[r][c], _chunk7DC2KL3Vcjs.NO_EDGES);
813
+ for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkQGFZU3JEcjs.CELL_EDGES.set(grid[r][c], _chunkKDMAYOWHcjs.NO_EDGES);
812
814
  }
813
815
  for (let c = 0; c < cols && U[c + 1] <= pcx[0] + PART_COL_TOL; c++) {
814
816
  let r = prev.rows;
@@ -817,7 +819,7 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
817
819
  for (let rr = 0; rr < r; rr++) owner[rr][c] = through;
818
820
  }
819
821
  const table = { rows, cols, cells: grid, hasHeader: prev.hasHeader, ...prev.caption ? { caption: prev.caption } : {} };
820
- const pr = _chunk7DC2KL3Vcjs.ROW_RULES.get(prev), cr = _chunk7DC2KL3Vcjs.ROW_RULES.get(curr);
822
+ const pr = _chunkKDMAYOWHcjs.ROW_RULES.get(prev), cr = _chunkKDMAYOWHcjs.ROW_RULES.get(curr);
821
823
  const shifted = dx !== 0;
822
824
  const cut = {
823
825
  open: !!pr && !!cr && !pr.bottom && !cr.top && pr.innerOpen + cr.innerOpen === 0 && pr.innerRuled + cr.innerRuled > 0,
@@ -828,7 +830,7 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
828
830
  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 });
829
831
  if (pr && cr) {
830
832
  const cutRuled = pr.bottom || cr.top;
831
- _chunk7DC2KL3Vcjs.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) });
833
+ _chunkKDMAYOWHcjs.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) });
832
834
  }
833
835
  return { table, colXs: U, split, header: ca.filter((a) => a.r < skip && a.cell.text.trim()).length >= 2 };
834
836
  }
@@ -882,7 +884,7 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs) {
882
884
  if (!crossed.has(shape(u, d)) && !(u.rs >= 2 && u.c + u.cs <= firstNew && hasContent(a) && !hasContent(b))) {
883
885
  if (!straddles && !midWord) continue;
884
886
  if (u.r >= last && d.rs < 2) continue;
885
- const U = _chunk7DC2KL3Vcjs.CELL_LINES.get(a);
887
+ const U = _chunkKDMAYOWHcjs.CELL_LINES.get(a);
886
888
  if (!_optionalChain([U, 'optionalAccess', _33 => _33.length]) || !hasContent(b)) continue;
887
889
  if (!(straddles && filledToBottom(U, prevBottom) && clauseContinues(a, b))) {
888
890
  if (U.length > STRADDLE_MAX_LINES) continue;
@@ -918,7 +920,7 @@ var LABEL_ROOM = 1.5;
918
920
  var HANGING_MIN = 0.5;
919
921
  var HANGING_TOL = 1;
920
922
  function continuesAcross(u, d, x1, x2) {
921
- const U = _chunk7DC2KL3Vcjs.CELL_LINES.get(u), D = _chunk7DC2KL3Vcjs.CELL_LINES.get(d);
923
+ const U = _chunkKDMAYOWHcjs.CELL_LINES.get(u), D = _chunkKDMAYOWHcjs.CELL_LINES.get(d);
922
924
  if (!_optionalChain([U, 'optionalAccess', _34 => _34.length]) || !_optionalChain([D, 'optionalAccess', _35 => _35.length])) return false;
923
925
  const last = U[U.length - 1];
924
926
  const fs = last.h || 10;
@@ -936,7 +938,7 @@ function continuesAcross(u, d, x1, x2) {
936
938
  if (U.length === 1 && x2 - last.r > Math.max(FULL_LINE_EDGE_MIN, SINGLE_LINE_WORD_GAP * fs)) return false;
937
939
  const indented = last.l - minL >= HANGING_MIN * fs;
938
940
  if (last.r - last.l < FULL_LINE_MIN_FRAC * (indented ? x2 - last.l : x2 - x1)) return false;
939
- const newItem = _chunk7DC2KL3Vcjs.startsNewItem.call(void 0, u.text, d.text);
941
+ const newItem = _chunkKDMAYOWHcjs.startsNewItem.call(void 0, u.text, d.text);
940
942
  const all = D.length ? U.concat(D) : U;
941
943
  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));
942
944
  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;
@@ -953,10 +955,10 @@ function outlineContinues(u, d) {
953
955
  return U.length >= 2 && D.length >= 1 && U.some((l) => OUTLINE_HEAD.test(l)) && OUTLINE_ITEM.test(D[0]);
954
956
  }
955
957
  function lineEnded(c, x1, x2, next) {
956
- const L = _chunk7DC2KL3Vcjs.CELL_LINES.get(c);
958
+ const L = _chunkKDMAYOWHcjs.CELL_LINES.get(c);
957
959
  if (!L || L.length !== 1) return false;
958
960
  const l = L[0], h = l.h || 10;
959
- const d0 = next ? _optionalChain([_chunk7DC2KL3Vcjs.CELL_LINES, 'access', _36 => _36.get, 'call', _37 => _37(next), 'optionalAccess', _38 => _38[0]]) : void 0;
961
+ const d0 = next ? _optionalChain([_chunkKDMAYOWHcjs.CELL_LINES, 'access', _36 => _36.get, 'call', _37 => _37(next), 'optionalAccess', _38 => _38[0]]) : void 0;
960
962
  if (d0 && d0.l - l.l >= HANGING_MIN * h) return false;
961
963
  return x2 - l.r - (l.l - x1) >= Math.max(LABEL_ROOM, firstWordUnits(_nullishCoalesce(_optionalChain([next, 'optionalAccess', _39 => _39.text]), () => ( "")))) * h;
962
964
  }
@@ -972,9 +974,9 @@ function appendCell(a, b) {
972
974
  a.blocks = [...asBlocks(a), ...asBlocks(b)];
973
975
  }
974
976
  if (b.text.trim()) a.text = a.text.trim() ? a.text + "\n" + b.text : b.text;
975
- _chunk7DC2KL3Vcjs.joinCellEdges.call(void 0, a, b);
977
+ _chunkKDMAYOWHcjs.joinCellEdges.call(void 0, a, b);
976
978
  }
977
- var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _46 => _46.blocks, 'optionalAccess', _47 => _47.length]) || _chunk7DC2KL3Vcjs.IMAGE_CELLS.has(cell);
979
+ var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _46 => _46.blocks, 'optionalAccess', _47 => _47.length]) || _chunkKDMAYOWHcjs.IMAGE_CELLS.has(cell);
978
980
  var CLAUSE_OPEN_ENDING = /(?:하는|되는|하고|하며|하여|되어|되고|되며|이며|으며|어야|아야|여야)$/;
979
981
  var batchim = (ch) => {
980
982
  const k = ch.charCodeAt(0) - 44032;
@@ -982,13 +984,13 @@ var batchim = (ch) => {
982
984
  };
983
985
  function clauseContinues(u, d) {
984
986
  const tail = _nullishCoalesce(flowText(u.text).trim().split(/\s+/).pop(), () => ( "")), head = flowText(d.text).trim();
985
- if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) || _chunk7DC2KL3Vcjs.startsNewItem.call(void 0, u.text, head)) return false;
987
+ if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) || _chunkKDMAYOWHcjs.startsNewItem.call(void 0, u.text, head)) return false;
986
988
  const last = tail[tail.length - 1], before = tail[tail.length - 2];
987
989
  return last === "\uC744" && batchim(before) || last === "\uB97C" && !batchim(before) || CLAUSE_OPEN_ENDING.test(tail);
988
990
  }
989
991
  function wordOverflows(u, d, x1, x2) {
990
- const U = _chunk7DC2KL3Vcjs.CELL_LINES.get(u);
991
- if (!_optionalChain([U, 'optionalAccess', _48 => _48.length]) || _chunk7DC2KL3Vcjs.startsNewItem.call(void 0, u.text, d.text)) return false;
992
+ const U = _chunkKDMAYOWHcjs.CELL_LINES.get(u);
993
+ if (!_optionalChain([U, 'optionalAccess', _48 => _48.length]) || _chunkKDMAYOWHcjs.startsNewItem.call(void 0, u.text, d.text)) return false;
992
994
  const last = U[U.length - 1], units = firstWordUnits(d.text);
993
995
  return units > 0 && last.r - last.l + units * (last.h || 10) > x2 - x1;
994
996
  }
@@ -1130,19 +1132,19 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
1130
1132
  placeJoined(blocks, i, j, joined);
1131
1133
  continue;
1132
1134
  }
1133
- if (_chunk7DC2KL3Vcjs.EMPTY_PARTS.has(curr.table)) {
1135
+ if (_chunkKDMAYOWHcjs.EMPTY_PARTS.has(curr.table)) {
1134
1136
  blocks.splice(j, 1);
1135
1137
  i++;
1136
1138
  continue;
1137
1139
  }
1138
1140
  if (joined === null) continue;
1139
- if (prev.table.cols !== curr.table.cols || prev.table.renderAsTable !== curr.table.renderAsTable || _chunk7DC2KL3Vcjs.EMPTY_PARTS.has(prev.table)) continue;
1141
+ if (prev.table.cols !== curr.table.cols || prev.table.renderAsTable !== curr.table.renderAsTable || _chunkKDMAYOWHcjs.EMPTY_PARTS.has(prev.table)) continue;
1140
1142
  const width = Math.max(prev.bbox.width, curr.bbox.width, 1);
1141
1143
  const leftDiff = Math.abs(prev.bbox.x - curr.bbox.x);
1142
1144
  const rightDiff = Math.abs(prev.bbox.x + prev.bbox.width - (curr.bbox.x + curr.bbox.width));
1143
1145
  if (leftDiff > width * NEIGHBOR_TABLE_EPSILON || rightDiff > width * NEIGHBOR_TABLE_EPSILON) continue;
1144
- const px = _chunk7DC2KL3Vcjs.TABLE_COLXS.get(prev.table), cx = _chunk7DC2KL3Vcjs.TABLE_COLXS.get(curr.table);
1145
- if (px && cx && !shiftedSame(px, cx, !_chunk7DC2KL3Vcjs.CLIP_TABLES.has(prev.table) && !_chunk7DC2KL3Vcjs.CLIP_TABLES.has(curr.table))) continue;
1146
+ const px = _chunkKDMAYOWHcjs.TABLE_COLXS.get(prev.table), cx = _chunkKDMAYOWHcjs.TABLE_COLXS.get(curr.table);
1147
+ if (px && cx && !shiftedSame(px, cx, !_chunkKDMAYOWHcjs.CLIP_TABLES.has(prev.table) && !_chunkKDMAYOWHcjs.CLIP_TABLES.has(curr.table))) continue;
1146
1148
  if (!rowTextsEqual(prev.table.cells[0], curr.table.cells[0]) && sameHeadShape(prev.table.cells[0], curr.table.cells[0])) continue;
1147
1149
  let currCells = curr.table.cells;
1148
1150
  if (currCells.length > 1 && prev.table.cells.length > 0 && rowTextsEqual(prev.table.cells[0], currCells[0])) {
@@ -1152,16 +1154,16 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
1152
1154
  blocks.splice(j, 1);
1153
1155
  continue;
1154
1156
  }
1155
- if (px && cx && !_chunk7DC2KL3Vcjs.CLIP_TABLES.has(prev.table) && !_chunk7DC2KL3Vcjs.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 && _chunk7DC2KL3Vcjs.CELL_LINES.has(c))) {
1157
+ if (px && cx && !_chunkKDMAYOWHcjs.CLIP_TABLES.has(prev.table) && !_chunkKDMAYOWHcjs.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 && _chunkKDMAYOWHcjs.CELL_LINES.has(c))) {
1156
1158
  const dx = px[0] - cx[0];
1157
1159
  const part = joinSplitParts(prev.table, px, curr.table, cx.map((x) => x + dx), dx, void 0, lex);
1158
1160
  if (_optionalChain([part, 'optionalAccess', _66 => _66.split]) && part.table.rows === prev.table.rows + currCells.length - 1) {
1159
1161
  const last = prev.table.rows - 1;
1160
1162
  for (let c = 0; c < part.table.cols; c++) {
1161
- const U = _chunk7DC2KL3Vcjs.CELL_LINES.get(prev.table.cells[last][c]), D = _chunk7DC2KL3Vcjs.CELL_LINES.get(currCells[0][c]);
1162
- _chunk7DC2KL3Vcjs.CELL_LINES.set(part.table.cells[last][c], U.concat(D.map((l) => ({ ...l, l: l.l + dx, r: l.r + dx }))));
1163
+ const U = _chunkKDMAYOWHcjs.CELL_LINES.get(prev.table.cells[last][c]), D = _chunkKDMAYOWHcjs.CELL_LINES.get(currCells[0][c]);
1164
+ _chunkKDMAYOWHcjs.CELL_LINES.set(part.table.cells[last][c], U.concat(D.map((l) => ({ ...l, l: l.l + dx, r: l.r + dx }))));
1163
1165
  }
1164
- _chunk7DC2KL3Vcjs.TABLE_COLXS.set(part.table, part.colXs);
1166
+ _chunkKDMAYOWHcjs.TABLE_COLXS.set(part.table, part.colXs);
1165
1167
  placeJoined(blocks, i, j, part.table);
1166
1168
  continue;
1167
1169
  }
@@ -1174,20 +1176,20 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
1174
1176
  caption: prev.table.caption,
1175
1177
  ...prev.table.renderAsTable ? { renderAsTable: true } : {}
1176
1178
  };
1177
- if (_nullishCoalesce(px, () => ( cx))) _chunk7DC2KL3Vcjs.TABLE_COLXS.set(merged, _nullishCoalesce(px, () => ( cx)));
1178
- if (_chunk7DC2KL3Vcjs.CLIP_TABLES.has(prev.table) || _chunk7DC2KL3Vcjs.CLIP_TABLES.has(curr.table)) _chunk7DC2KL3Vcjs.CLIP_TABLES.add(merged);
1179
+ if (_nullishCoalesce(px, () => ( cx))) _chunkKDMAYOWHcjs.TABLE_COLXS.set(merged, _nullishCoalesce(px, () => ( cx)));
1180
+ if (_chunkKDMAYOWHcjs.CLIP_TABLES.has(prev.table) || _chunkKDMAYOWHcjs.CLIP_TABLES.has(curr.table)) _chunkKDMAYOWHcjs.CLIP_TABLES.add(merged);
1179
1181
  placeJoined(blocks, i, j, merged);
1180
1182
  }
1181
1183
  for (let i = blocks.length - 1; i >= 0; i--) {
1182
1184
  const t = blocks[i].table;
1183
- if (blocks[i].type === "table" && t && _chunk7DC2KL3Vcjs.EMPTY_PARTS.has(t)) blocks.splice(i, 1);
1185
+ if (blocks[i].type === "table" && t && _chunkKDMAYOWHcjs.EMPTY_PARTS.has(t)) blocks.splice(i, 1);
1184
1186
  }
1185
1187
  }
1186
1188
  function mergeColumnFlow(blocks, pageHeights, lex) {
1187
1189
  if (!pageHeights) return;
1188
1190
  for (let i = 0; i < blocks.length; i++) {
1189
1191
  const L = blocks[i];
1190
- if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !_chunk7DC2KL3Vcjs.CLIP_TABLES.has(L.table) || _chunk7DC2KL3Vcjs.EMPTY_PARTS.has(L.table)) continue;
1192
+ if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !_chunkKDMAYOWHcjs.CLIP_TABLES.has(L.table) || _chunkKDMAYOWHcjs.EMPTY_PARTS.has(L.table)) continue;
1191
1193
  const ph = pageHeights.get(L.pageNumber);
1192
1194
  if (!ph || L.bbox.y > ph * PAGE_EDGE_BAND) continue;
1193
1195
  let s0 = i, s1 = i;
@@ -1216,8 +1218,8 @@ function mergeColumnFlow(blocks, pageHeights, lex) {
1216
1218
  }
1217
1219
  function joinClipParts(prev, curr, pageHeights, lex) {
1218
1220
  const pt = prev.table, ct = curr.table;
1219
- if (!_chunk7DC2KL3Vcjs.CLIP_TABLES.has(pt) || !_chunk7DC2KL3Vcjs.CLIP_TABLES.has(ct)) return null;
1220
- const px = _chunk7DC2KL3Vcjs.TABLE_COLXS.get(pt), cx = _chunk7DC2KL3Vcjs.TABLE_COLXS.get(ct);
1221
+ if (!_chunkKDMAYOWHcjs.CLIP_TABLES.has(pt) || !_chunkKDMAYOWHcjs.CLIP_TABLES.has(ct)) return null;
1222
+ const px = _chunkKDMAYOWHcjs.TABLE_COLXS.get(pt), cx = _chunkKDMAYOWHcjs.TABLE_COLXS.get(ct);
1221
1223
  if (!px || !cx) return null;
1222
1224
  let xs = cx, shifted = false, dx = 0, foreign = false, within = false;
1223
1225
  if (!shiftedSame(px, cx, false)) {
@@ -1233,15 +1235,15 @@ function joinClipParts(prev, curr, pageHeights, lex) {
1233
1235
  const inner = b.slice(1, -1).map((x) => x + dx);
1234
1236
  return inner.length > 0 && !inner.some((x) => px.some((p) => Math.abs(p - x) <= CONTINUATION_COL_TOL));
1235
1237
  };
1236
- foreign = unrelated(cx) && unrelated(_nullishCoalesce(_chunk7DC2KL3Vcjs.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);
1238
+ foreign = unrelated(cx) && unrelated(_nullishCoalesce(_chunkKDMAYOWHcjs.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);
1237
1239
  }
1238
1240
  const res = joinSplitParts(pt, px, ct, xs, dx, _optionalChain([prev, 'access', _71 => _71.bbox, 'optionalAccess', _72 => _72.y]), lex);
1239
1241
  if (!res || (shifted || foreign || within) && !res.split && !res.header) return null;
1240
- _chunk7DC2KL3Vcjs.TABLE_COLXS.set(res.table, res.colXs);
1241
- const ys = _chunk7DC2KL3Vcjs.TABLE_ROWYS.get(pt);
1242
- if (ys) _chunk7DC2KL3Vcjs.TABLE_ROWYS.set(res.table, ys);
1243
- _chunk7DC2KL3Vcjs.PART_COLXS.set(res.table, _nullishCoalesce(_chunk7DC2KL3Vcjs.PART_COLXS.get(pt), () => ( px)));
1244
- _chunk7DC2KL3Vcjs.CLIP_TABLES.add(res.table);
1242
+ _chunkKDMAYOWHcjs.TABLE_COLXS.set(res.table, res.colXs);
1243
+ const ys = _chunkKDMAYOWHcjs.TABLE_ROWYS.get(pt);
1244
+ if (ys) _chunkKDMAYOWHcjs.TABLE_ROWYS.set(res.table, ys);
1245
+ _chunkKDMAYOWHcjs.PART_COLXS.set(res.table, _nullishCoalesce(_chunkKDMAYOWHcjs.PART_COLXS.get(pt), () => ( px)));
1246
+ _chunkKDMAYOWHcjs.CLIP_TABLES.add(res.table);
1245
1247
  return res.table;
1246
1248
  }
1247
1249
  function prevLacksLeftCols(prev, px, xs, pageHeights) {
@@ -1265,12 +1267,12 @@ function looksContinued(prev, curr, pageHeights) {
1265
1267
  return filled.length >= 2 && filled.every((t) => t === filled[0]);
1266
1268
  }
1267
1269
  function pushedLead(prev, curr) {
1268
- if (!_chunk7DC2KL3Vcjs.CLIP_TABLES.has(prev.table) || !_chunk7DC2KL3Vcjs.CLIP_TABLES.has(curr.table)) return false;
1270
+ if (!_chunkKDMAYOWHcjs.CLIP_TABLES.has(prev.table) || !_chunkKDMAYOWHcjs.CLIP_TABLES.has(curr.table)) return false;
1269
1271
  const lead = leadRows(curr.table);
1270
1272
  return lead.image && lead.height > prev.bbox.y;
1271
1273
  }
1272
1274
  function leadRows(t) {
1273
- const ys = _chunk7DC2KL3Vcjs.TABLE_ROWYS.get(t);
1275
+ const ys = _chunkKDMAYOWHcjs.TABLE_ROWYS.get(t);
1274
1276
  if (!ys || ys.length < 2) return { height: 0, image: false };
1275
1277
  const anchors = anchorsOf(t);
1276
1278
  let end = 1, image = false;
@@ -1278,17 +1280,17 @@ function leadRows(t) {
1278
1280
  for (const a of anchors) {
1279
1281
  if (a.r !== r) continue;
1280
1282
  end = Math.max(end, r + a.rs);
1281
- if (_chunk7DC2KL3Vcjs.IMAGE_CELLS.has(a.cell)) image = true;
1283
+ if (_chunkKDMAYOWHcjs.IMAGE_CELLS.has(a.cell)) image = true;
1282
1284
  }
1283
1285
  }
1284
1286
  return { height: ys[0] - ys[Math.min(end, ys.length - 1)], image };
1285
1287
  }
1286
1288
  function tailOf(b) {
1287
- const t = b.table && _chunk7DC2KL3Vcjs.TABLE_TAIL.get(b.table);
1289
+ const t = b.table && _chunkKDMAYOWHcjs.TABLE_TAIL.get(b.table);
1288
1290
  return t && b.bbox ? { ...b, pageNumber: t.page, bbox: { ...b.bbox, page: t.page, y: t.y, height: t.height } } : b;
1289
1291
  }
1290
1292
  function firstRowSig(t) {
1291
- const x = _chunk7DC2KL3Vcjs.TABLE_COLXS.get(t);
1293
+ const x = _chunkKDMAYOWHcjs.TABLE_COLXS.get(t);
1292
1294
  if (!x || x.length !== t.cols + 1) return null;
1293
1295
  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, "") }));
1294
1296
  }
@@ -1341,7 +1343,7 @@ function chainHead(blocks, i, pageHeights) {
1341
1343
  if (pb.pageNumber !== (_nullishCoalesce(cur.pageNumber, () => ( 0))) - 1) break;
1342
1344
  if (!blocks.slice(p + 1, k).every((b) => besideOwn(b, pb, cur) || insideTable(b, pb) || pageNumberBetween(b, pb, cur, pageHeights))) break;
1343
1345
  if (!looksContinued(pb, cur, pageHeights)) break;
1344
- const px = _chunk7DC2KL3Vcjs.TABLE_COLXS.get(pb.table), cx = _chunk7DC2KL3Vcjs.TABLE_COLXS.get(cur.table);
1346
+ const px = _chunkKDMAYOWHcjs.TABLE_COLXS.get(pb.table), cx = _chunkKDMAYOWHcjs.TABLE_COLXS.get(cur.table);
1345
1347
  if (!px || !cx) break;
1346
1348
  const dx = px[px.length - 1] - cx[cx.length - 1];
1347
1349
  if (!shiftedSame(px, cx) && !px.some((x) => Math.abs(x - (cx[0] + dx)) <= CONTINUATION_COL_TOL) && !prevLacksLeftCols(pb, px, cx, pageHeights)) break;
@@ -1373,7 +1375,7 @@ var RESTART_LOOKBACK_PAGES = 5;
1373
1375
  var COL_MATCH_TOL = 0.5;
1374
1376
  var CONTINUED_TABLE_PAGE_BAND = 0.16;
1375
1377
  function lastRowCell(t, x1, x2) {
1376
- const xs = _chunk7DC2KL3Vcjs.TABLE_COLXS.get(t);
1378
+ const xs = _chunkKDMAYOWHcjs.TABLE_COLXS.get(t);
1377
1379
  const covered = /* @__PURE__ */ new Set();
1378
1380
  for (let r = 0; r < t.rows; r++) {
1379
1381
  for (let c = 0; c < t.cols; c++) {
@@ -1391,7 +1393,7 @@ var cellBlocks = (cell, pageNumber) => _nullishCoalesce(cell.blocks, () => ( cel
1391
1393
  function mergeContinuedCells(blocks, pageHeights) {
1392
1394
  for (let j = blocks.length - 1; j > 0; j--) {
1393
1395
  const part = blocks[j];
1394
- const from = part.table ? _chunk7DC2KL3Vcjs.CONT_PARTS.get(part.table) : void 0;
1396
+ const from = part.table ? _chunkKDMAYOWHcjs.CONT_PARTS.get(part.table) : void 0;
1395
1397
  if (!from || !part.table) continue;
1396
1398
  let i = j - 1;
1397
1399
  while (i >= 0 && blocks[i].type !== "table") i--;
@@ -1403,11 +1405,11 @@ function mergeContinuedCells(blocks, pageHeights) {
1403
1405
  const at = cell.blocks || add.blocks ? cellBlocks(cell, prev.pageNumber).length : -1;
1404
1406
  if (cell.blocks || add.blocks) cell.blocks = [...cellBlocks(cell, prev.pageNumber), ...cellBlocks(add, part.pageNumber)];
1405
1407
  cell.text = [cell.text, add.text].filter((s) => s.trim()).join("\n");
1406
- _chunk7DC2KL3Vcjs.joinCellEdges.call(void 0, cell, add);
1407
- const lines = _chunk7DC2KL3Vcjs.CELL_LINES.get(add);
1408
- if (_optionalChain([lines, 'optionalAccess', _94 => _94.length])) _chunk7DC2KL3Vcjs.CELL_LINES.set(cell, [..._nullishCoalesce(_chunk7DC2KL3Vcjs.CELL_LINES.get(cell), () => ( [])), ...lines]);
1409
- if (part.pageNumber && part.bbox) _chunk7DC2KL3Vcjs.TABLE_TAIL.set(prev.table, _nullishCoalesce(_chunk7DC2KL3Vcjs.TABLE_TAIL.get(part.table), () => ( { page: part.pageNumber, y: part.bbox.y, height: part.bbox.height })));
1410
- if (cell.text.trim() || _optionalChain([cell, 'access', _95 => _95.blocks, 'optionalAccess', _96 => _96.length])) _chunk7DC2KL3Vcjs.EMPTY_PARTS.delete(prev.table);
1408
+ _chunkKDMAYOWHcjs.joinCellEdges.call(void 0, cell, add);
1409
+ const lines = _chunkKDMAYOWHcjs.CELL_LINES.get(add);
1410
+ if (_optionalChain([lines, 'optionalAccess', _94 => _94.length])) _chunkKDMAYOWHcjs.CELL_LINES.set(cell, [..._nullishCoalesce(_chunkKDMAYOWHcjs.CELL_LINES.get(cell), () => ( [])), ...lines]);
1411
+ if (part.pageNumber && part.bbox) _chunkKDMAYOWHcjs.TABLE_TAIL.set(prev.table, _nullishCoalesce(_chunkKDMAYOWHcjs.TABLE_TAIL.get(part.table), () => ( { page: part.pageNumber, y: part.bbox.y, height: part.bbox.height })));
1412
+ if (cell.text.trim() || _optionalChain([cell, 'access', _95 => _95.blocks, 'optionalAccess', _96 => _96.length])) _chunkKDMAYOWHcjs.EMPTY_PARTS.delete(prev.table);
1411
1413
  blocks.splice(j, 1);
1412
1414
  if (cell.blocks && at > 0) {
1413
1415
  const nextAt = cell.blocks[at];
@@ -1419,11 +1421,11 @@ function mergeContinuedCells(blocks, pageHeights) {
1419
1421
  }
1420
1422
  function unwrapContinuedTable(blocks, at, pageHeights) {
1421
1423
  const prev = blocks[at - 1], frame = blocks[at];
1422
- if (!_optionalChain([prev, 'optionalAccess', _97 => _97.table]) || !_optionalChain([frame, 'optionalAccess', _98 => _98.table]) || frame.table.rows !== 1 || frame.table.cols !== 1 || !_chunk7DC2KL3Vcjs.CLIP_TABLES.has(frame.table)) return;
1424
+ if (!_optionalChain([prev, 'optionalAccess', _97 => _97.table]) || !_optionalChain([frame, 'optionalAccess', _98 => _98.table]) || frame.table.rows !== 1 || frame.table.cols !== 1 || !_chunkKDMAYOWHcjs.CLIP_TABLES.has(frame.table)) return;
1423
1425
  const inner = _optionalChain([frame, 'access', _99 => _99.table, 'access', _100 => _100.cells, 'access', _101 => _101[0], 'optionalAccess', _102 => _102[0], 'optionalAccess', _103 => _103.blocks]);
1424
1426
  const next = _optionalChain([inner, 'optionalAccess', _104 => _104[0]]);
1425
- if (!inner || !_optionalChain([next, 'optionalAccess', _105 => _105.table]) || !prev.bbox || !next.bbox || !prev.pageNumber || next.pageNumber !== prev.pageNumber + 1 || !_chunk7DC2KL3Vcjs.CLIP_TABLES.has(prev.table) || !_chunk7DC2KL3Vcjs.CLIP_TABLES.has(next.table) || prev.table.cols !== next.table.cols) return;
1426
- const px = _chunk7DC2KL3Vcjs.TABLE_COLXS.get(prev.table), nx = _chunk7DC2KL3Vcjs.TABLE_COLXS.get(next.table);
1427
+ if (!inner || !_optionalChain([next, 'optionalAccess', _105 => _105.table]) || !prev.bbox || !next.bbox || !prev.pageNumber || next.pageNumber !== prev.pageNumber + 1 || !_chunkKDMAYOWHcjs.CLIP_TABLES.has(prev.table) || !_chunkKDMAYOWHcjs.CLIP_TABLES.has(next.table) || prev.table.cols !== next.table.cols) return;
1428
+ const px = _chunkKDMAYOWHcjs.TABLE_COLXS.get(prev.table), nx = _chunkKDMAYOWHcjs.TABLE_COLXS.get(next.table);
1427
1429
  if (!px || !nx || px.length !== nx.length || px.some((x, i) => Math.abs(x - nx[i]) > COL_MATCH_TOL)) return;
1428
1430
  const ph = _optionalChain([pageHeights, 'optionalAccess', _106 => _106.get, 'call', _107 => _107(prev.pageNumber)]), nh = _optionalChain([pageHeights, 'optionalAccess', _108 => _108.get, 'call', _109 => _109(next.pageNumber)]);
1429
1431
  if (!ph || !nh || prev.bbox.y > ph * CONTINUED_TABLE_PAGE_BAND || next.bbox.y + next.bbox.height < nh * (1 - CONTINUED_TABLE_PAGE_BAND)) return;
@@ -1432,14 +1434,14 @@ function unwrapContinuedTable(blocks, at, pageHeights) {
1432
1434
  function fillNestedContinuation(blocks, at) {
1433
1435
  const prev = blocks[at - 1], next = blocks[at];
1434
1436
  const t = _optionalChain([prev, 'optionalAccess', _110 => _110.table]), u = _optionalChain([next, 'optionalAccess', _111 => _111.table]);
1435
- if (!t || !u || u.rows !== 1 || u.cols !== 1 || !_chunk7DC2KL3Vcjs.CLIP_TABLES.has(t) || !_chunk7DC2KL3Vcjs.CLIP_TABLES.has(u) || next.pageNumber !== (_nullishCoalesce(prev.pageNumber, () => ( 0))) + 1) return;
1436
- const xs = _chunk7DC2KL3Vcjs.TABLE_COLXS.get(u);
1437
+ if (!t || !u || u.rows !== 1 || u.cols !== 1 || !_chunkKDMAYOWHcjs.CLIP_TABLES.has(t) || !_chunkKDMAYOWHcjs.CLIP_TABLES.has(u) || next.pageNumber !== (_nullishCoalesce(prev.pageNumber, () => ( 0))) + 1) return;
1438
+ const xs = _chunkKDMAYOWHcjs.TABLE_COLXS.get(u);
1437
1439
  const cell = xs ? lastRowCell(t, xs[0], xs[xs.length - 1]) : void 0;
1438
1440
  const add = _optionalChain([u, 'access', _112 => _112.cells, 'access', _113 => _113[0], 'optionalAccess', _114 => _114[0]]);
1439
1441
  if (!cell || !add || cell.text.trim() || _optionalChain([cell, 'access', _115 => _115.blocks, 'optionalAccess', _116 => _116.length])) return;
1440
1442
  cell.text = add.text;
1441
1443
  if (add.blocks) cell.blocks = add.blocks;
1442
- _chunk7DC2KL3Vcjs.joinCellEdges.call(void 0, cell, add);
1444
+ _chunkKDMAYOWHcjs.joinCellEdges.call(void 0, cell, add);
1443
1445
  blocks.splice(at, 1);
1444
1446
  }
1445
1447
 
@@ -1475,7 +1477,7 @@ var WINANSI_REVERSE = {
1475
1477
  };
1476
1478
  function symbolFontTable(fontName) {
1477
1479
  if (!fontName) return void 0;
1478
- if (/wingdings(?![\s-]*[23])/i.test(fontName)) return _chunkQ5N4YS3Tcjs.WINGDINGS;
1480
+ if (/wingdings(?![\s-]*[23])/i.test(fontName)) return _chunkQGFZU3JEcjs.WINGDINGS;
1479
1481
  return void 0;
1480
1482
  }
1481
1483
  function remapSymbolText(text, table) {
@@ -2330,61 +2332,6 @@ function orderTwoUpPage(blocks, pageWidth, pageHeight) {
2330
2332
  return [...left, ...right, ...rest];
2331
2333
  }
2332
2334
 
2333
- // src/pdf/side-tabs.ts
2334
- var BAND = 0.12;
2335
- var MAX_CHARS = 10;
2336
- var MIN_REPEAT = 3;
2337
- var RUN_GAP = 5;
2338
- function removeSideTabs(blocks, pageWidths) {
2339
- const edges = /* @__PURE__ */ new Map();
2340
- for (const b of blocks) {
2341
- if (!b.bbox || b.pageNumber === void 0 || [..._nullishCoalesce(_optionalChain([b, 'access', _126 => _126.text, 'optionalAccess', _127 => _127.trim, 'call', _128 => _128()]), () => ( ""))].length <= MAX_CHARS) continue;
2342
- const e = _nullishCoalesce(edges.get(b.pageNumber), () => ( { lefts: [], rights: [] }));
2343
- e.lefts.push(b.bbox.x);
2344
- e.rights.push(b.bbox.x + b.bbox.width);
2345
- edges.set(b.pageNumber, e);
2346
- }
2347
- const q = (xs, p) => {
2348
- const v = [...xs].sort((a, b) => a - b);
2349
- return v[Math.min(v.length - 1, Math.floor(p * v.length))];
2350
- };
2351
- const body = /* @__PURE__ */ new Map();
2352
- for (const [page, e] of edges) body.set(page, { left: q(e.lefts, 0.2), right: q(e.rights, 0.8) });
2353
- const all = [...body.values()];
2354
- const fallback = all.length ? { left: q(all.map((e) => e.left), 0.5), right: q(all.map((e) => e.right), 0.5) } : void 0;
2355
- const key = (b) => {
2356
- const w = b.pageNumber !== void 0 ? pageWidths.get(b.pageNumber) : void 0;
2357
- const text = _optionalChain([b, 'access', _129 => _129.text, 'optionalAccess', _130 => _130.trim, 'call', _131 => _131()]);
2358
- const area = _nullishCoalesce((b.pageNumber !== void 0 ? body.get(b.pageNumber) : void 0), () => ( fallback));
2359
- if (!w || !area || !b.bbox || !text || b.type === "table" || [...text].length > MAX_CHARS) return null;
2360
- const side = b.bbox.x + b.bbox.width <= Math.min(w * BAND, area.left - 1) ? "L" : b.bbox.x >= Math.max(w * (1 - BAND), area.right + 1) ? "R" : null;
2361
- return side && text.replace(/\s+/g, "");
2362
- };
2363
- const pages = /* @__PURE__ */ new Map();
2364
- for (const b of blocks) {
2365
- const k = key(b);
2366
- if (k) pages.set(k, (_nullishCoalesce(pages.get(k), () => ( /* @__PURE__ */ new Set()))).add(b.pageNumber));
2367
- }
2368
- const running = /* @__PURE__ */ new Set();
2369
- for (const [k, ps] of pages) {
2370
- const list = [...ps].sort((a, b) => a - b);
2371
- let run = [];
2372
- const flush = () => {
2373
- if (run.length >= MIN_REPEAT && run.length >= (run[run.length - 1] - run[0] + 1) * 0.4) for (const p of run) running.add(`${p}\0${k}`);
2374
- run = [];
2375
- };
2376
- for (const p of list) {
2377
- if (run.length && p - run[run.length - 1] > RUN_GAP) flush();
2378
- run.push(p);
2379
- }
2380
- flush();
2381
- }
2382
- return running.size ? blocks.filter((b) => {
2383
- const k = key(b);
2384
- return !k || !running.has(`${b.pageNumber}\0${k}`);
2385
- }) : blocks;
2386
- }
2387
-
2388
2335
  // src/pdf/footnotes.ts
2389
2336
  var MARK = /^\d{1,3}\)$/;
2390
2337
  function footnoteSeparators(horizontals, pageWidth, pageHeight) {
@@ -2430,7 +2377,7 @@ function inlineFootnotes(blocks, pages) {
2430
2377
  open = true;
2431
2378
  continue;
2432
2379
  }
2433
- const prev = pb[j - 1], line = (_nullishCoalesce(_nullishCoalesce(_optionalChain([b, 'access', _132 => _132.style, 'optionalAccess', _133 => _133.fontSize]), () => ( _optionalChain([b, 'access', _134 => _134.bbox, 'optionalAccess', _135 => _135.height]))), () => ( 10))) * 1.5;
2380
+ const prev = pb[j - 1], line = (_nullishCoalesce(_nullishCoalesce(_optionalChain([b, 'access', _126 => _126.style, 'optionalAccess', _127 => _127.fontSize]), () => ( _optionalChain([b, 'access', _128 => _128.bbox, 'optionalAccess', _129 => _129.height]))), () => ( 10))) * 1.5;
2434
2381
  if (open && b.bbox && prev.bbox && prev.bbox.y - top(b) <= line && !/^[-–—\s\d]+$/.test(b.text)) {
2435
2382
  notes[notes.length - 1].text += " " + b.text.trim();
2436
2383
  notes[notes.length - 1].blocks.push(b);
@@ -2453,7 +2400,7 @@ var CAPTION = /^(?:Table|Figure|Fig\.?)\s*\d+(?:\.\d+)*\s*[.:]/i;
2453
2400
  var EQUATION_NUMBER = /\t\(\d{1,3}[a-z]?\)\s*$/;
2454
2401
  var DISPLAY_MATH = /=|[√∑∏∫∂∇≤≥≈≠∈∀∃]/;
2455
2402
  function isRunningHead(block, page, pageHeight) {
2456
- const box = block.bbox, text = _optionalChain([block, 'access', _136 => _136.text, 'optionalAccess', _137 => _137.trim, 'call', _138 => _138()]);
2403
+ const box = block.bbox, text = _optionalChain([block, 'access', _130 => _130.text, 'optionalAccess', _131 => _131.trim, 'call', _132 => _132()]);
2457
2404
  if (!box || !text || !pageHeight) return false;
2458
2405
  const top = box.y + box.height >= pageHeight * 0.9;
2459
2406
  const bottom = box.y <= pageHeight * 0.1;
@@ -2461,7 +2408,7 @@ function isRunningHead(block, page, pageHeight) {
2461
2408
  const others = page.filter((o) => o !== block && o.bbox && o.type !== "image" && o.type !== "separator");
2462
2409
  if (top && others.some((o) => o.bbox.y + o.bbox.height > box.y + box.height)) return false;
2463
2410
  if (bottom && others.some((o) => o.bbox.y < box.y)) return false;
2464
- if (bottom && box.height <= (_nullishCoalesce(_optionalChain([block, 'access', _139 => _139.style, 'optionalAccess', _140 => _140.fontSize]), () => ( 0))) * 1.6) return true;
2411
+ if (bottom && box.height <= (_nullishCoalesce(_optionalChain([block, 'access', _133 => _133.style, 'optionalAccess', _134 => _134.fontSize]), () => ( 0))) * 1.6) return true;
2465
2412
  if (!text.includes(" ")) return false;
2466
2413
  const parts = text.split(/\t+/).map((part) => part.trim()).filter(Boolean);
2467
2414
  if (parts.length >= 2 && (PAGE_NUMBER.test(parts[0]) || PAGE_NUMBER.test(parts[parts.length - 1]))) return true;
@@ -2470,7 +2417,7 @@ function isRunningHead(block, page, pageHeight) {
2470
2417
  return right > left && box.width >= (right - left) * 0.6;
2471
2418
  }
2472
2419
  function unbalancedClose(text) {
2473
- return (_nullishCoalesce(_optionalChain([text, 'access', _141 => _141.match, 'call', _142 => _142(/\)/g), 'optionalAccess', _143 => _143.length]), () => ( 0))) > (_nullishCoalesce(_optionalChain([text, 'access', _144 => _144.match, 'call', _145 => _145(/\(/g), 'optionalAccess', _146 => _146.length]), () => ( 0)));
2420
+ return (_nullishCoalesce(_optionalChain([text, 'access', _135 => _135.match, 'call', _136 => _136(/\)/g), 'optionalAccess', _137 => _137.length]), () => ( 0))) > (_nullishCoalesce(_optionalChain([text, 'access', _138 => _138.match, 'call', _139 => _139(/\(/g), 'optionalAccess', _140 => _140.length]), () => ( 0)));
2474
2421
  }
2475
2422
  function demoteNonHeadingRoles(blocks, pageHeights, faceNames) {
2476
2423
  const byPage = /* @__PURE__ */ new Map();
@@ -2486,7 +2433,7 @@ function demoteNonHeadingRoles(blocks, pageHeights, faceNames) {
2486
2433
  const sizes = /* @__PURE__ */ new Map();
2487
2434
  let proseChars = 0;
2488
2435
  for (const b of page) {
2489
- if (b.type !== "paragraph" && b.type !== "heading" || !b.text || !_optionalChain([b, 'access', _147 => _147.style, 'optionalAccess', _148 => _148.fontName]) || !b.style.fontSize) continue;
2436
+ if (b.type !== "paragraph" && b.type !== "heading" || !b.text || !_optionalChain([b, 'access', _141 => _141.style, 'optionalAccess', _142 => _142.fontName]) || !b.style.fontSize) continue;
2490
2437
  const key2 = `${b.style.fontName}:${b.style.fontSize}`;
2491
2438
  chars.set(key2, (_nullishCoalesce(chars.get(key2), () => ( 0))) + b.text.length);
2492
2439
  if (b.type === "paragraph" && b.style.fontName === "ocr") {
@@ -2511,49 +2458,49 @@ function demoteNonHeadingRoles(blocks, pageHeights, faceNames) {
2511
2458
  const block = blocks[i];
2512
2459
  if (block.type !== "heading" || !block.text) continue;
2513
2460
  const text = block.text.replace(/<[^>]+>/g, "").trim();
2514
- const fsz = _nullishCoalesce(_optionalChain([block, 'access', _149 => _149.style, 'optionalAccess', _150 => _150.fontSize]), () => ( 0));
2515
- const tocEntry = i > 0 && _chunk7DC2KL3Vcjs.TOC_BLOCKS.has(blocks[i - 1]) && _chunk7DC2KL3Vcjs.TOC_BLOCKS.has(blocks[i + 1]);
2461
+ const fsz = _nullishCoalesce(_optionalChain([block, 'access', _143 => _143.style, 'optionalAccess', _144 => _144.fontSize]), () => ( 0));
2462
+ const tocEntry = i > 0 && _chunkKDMAYOWHcjs.TOC_BLOCKS.has(blocks[i - 1]) && _chunkKDMAYOWHcjs.TOC_BLOCKS.has(blocks[i + 1]);
2516
2463
  const page = _nullishCoalesce(byPage.get(_nullishCoalesce(block.pageNumber, () => ( 0))), () => ( []));
2517
- const proseStyle = _optionalChain([block, 'access', _151 => _151.style, 'optionalAccess', _152 => _152.fontName]) && bodyStyle.get(_nullishCoalesce(block.pageNumber, () => ( 0))) === `${block.style.fontName}:${block.style.fontSize}` && text.length > 60;
2464
+ const proseStyle = _optionalChain([block, 'access', _145 => _145.style, 'optionalAccess', _146 => _146.fontName]) && bodyStyle.get(_nullishCoalesce(block.pageNumber, () => ( 0))) === `${block.style.fontName}:${block.style.fontSize}` && text.length > 60;
2518
2465
  const next = blocks[i + 1];
2519
- const nb = _optionalChain([next, 'optionalAccess', _153 => _153.bbox]), bb = block.bbox;
2520
- const chapterNumber = !!nb && !!bb && fsz >= (_nullishCoalesce(_optionalChain([next, 'optionalAccess', _154 => _154.style, 'optionalAccess', _155 => _155.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;
2521
- if (/^\d+(?:\.\d+)*\.?$/.test(text) && _optionalChain([next, 'optionalAccess', _156 => _156.type]) === "heading" && next.text && next.pageNumber === block.pageNumber && !chapterNumber) {
2466
+ const nb = _optionalChain([next, 'optionalAccess', _147 => _147.bbox]), bb = block.bbox;
2467
+ const chapterNumber = !!nb && !!bb && fsz >= (_nullishCoalesce(_optionalChain([next, 'optionalAccess', _148 => _148.style, 'optionalAccess', _149 => _149.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;
2468
+ if (/^\d+(?:\.\d+)*\.?$/.test(text) && _optionalChain([next, 'optionalAccess', _150 => _150.type]) === "heading" && next.text && next.pageNumber === block.pageNumber && !chapterNumber) {
2522
2469
  next.text = `${block.text.trim()} ${next.text.trim()}`;
2523
2470
  blocks.splice(i--, 1);
2524
2471
  continue;
2525
2472
  }
2526
- if ((_optionalChain([next, 'optionalAccess', _157 => _157.type]) === "paragraph" || _optionalChain([next, 'optionalAccess', _158 => _158.type]) === "heading" && !CAPTION.test(text)) && next.pageNumber === block.pageNumber && next.text && next.bbox && block.bbox && _optionalChain([next, 'access', _159 => _159.style, 'optionalAccess', _160 => _160.fontName]) === _optionalChain([block, 'access', _161 => _161.style, 'optionalAccess', _162 => _162.fontName]) && _optionalChain([next, 'access', _163 => _163.style, 'optionalAccess', _164 => _164.fontSize]) === _optionalChain([block, 'access', _165 => _165.style, 'optionalAccess', _166 => _166.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) {
2473
+ if ((_optionalChain([next, 'optionalAccess', _151 => _151.type]) === "paragraph" || _optionalChain([next, 'optionalAccess', _152 => _152.type]) === "heading" && !CAPTION.test(text)) && next.pageNumber === block.pageNumber && next.text && next.bbox && block.bbox && _optionalChain([next, 'access', _153 => _153.style, 'optionalAccess', _154 => _154.fontName]) === _optionalChain([block, 'access', _155 => _155.style, 'optionalAccess', _156 => _156.fontName]) && _optionalChain([next, 'access', _157 => _157.style, 'optionalAccess', _158 => _158.fontSize]) === _optionalChain([block, 'access', _159 => _159.style, 'optionalAccess', _160 => _160.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) {
2527
2474
  block.text = `${block.text.trim()} ${next.text.trim()}`;
2528
2475
  block.bbox = { ...block.bbox, y: next.bbox.y, height: block.bbox.y + block.bbox.height - next.bbox.y };
2529
2476
  blocks.splice(i + 1, 1);
2530
2477
  }
2531
2478
  const after = blocks[i + 2];
2532
- if ((_optionalChain([next, 'optionalAccess', _167 => _167.type]) === "paragraph" || _optionalChain([next, 'optionalAccess', _168 => _168.type]) === "heading") && /^(?:&|\+|and|or)$/i.test(_nullishCoalesce(_optionalChain([next, 'access', _169 => _169.text, 'optionalAccess', _170 => _170.trim, 'call', _171 => _171()]), () => ( ""))) && _optionalChain([after, 'optionalAccess', _172 => _172.type]) === "heading" && after.text && after.pageNumber === block.pageNumber && next.pageNumber === block.pageNumber && _optionalChain([after, 'access', _173 => _173.style, 'optionalAccess', _174 => _174.fontSize]) === _optionalChain([block, 'access', _175 => _175.style, 'optionalAccess', _176 => _176.fontSize])) {
2479
+ if ((_optionalChain([next, 'optionalAccess', _161 => _161.type]) === "paragraph" || _optionalChain([next, 'optionalAccess', _162 => _162.type]) === "heading") && /^(?:&|\+|and|or)$/i.test(_nullishCoalesce(_optionalChain([next, 'access', _163 => _163.text, 'optionalAccess', _164 => _164.trim, 'call', _165 => _165()]), () => ( ""))) && _optionalChain([after, 'optionalAccess', _166 => _166.type]) === "heading" && after.text && after.pageNumber === block.pageNumber && next.pageNumber === block.pageNumber && _optionalChain([after, 'access', _167 => _167.style, 'optionalAccess', _168 => _168.fontSize]) === _optionalChain([block, 'access', _169 => _169.style, 'optionalAccess', _170 => _170.fontSize])) {
2533
2480
  block.text = `${block.text.trim()} ${next.text.trim()} ${after.text.trim()}`;
2534
2481
  blocks.splice(i + 1, 2);
2535
2482
  }
2536
2483
  const tiny = fsz > 0 && fsz < 7.5;
2537
2484
  const prev = blocks[i - 1];
2538
- if (_optionalChain([prev, 'optionalAccess', _177 => _177.type]) === "paragraph" && prev.pageNumber === block.pageNumber && /^[a-z]{1,3}[.)]$/.test(_nullishCoalesce(_optionalChain([prev, 'access', _178 => _178.text, 'optionalAccess', _179 => _179.trim, 'call', _180 => _180()]), () => ( ""))) && prev.bbox && block.bbox && Math.abs(prev.bbox.y - block.bbox.y) < 2 && prev.bbox.x + prev.bbox.width <= block.bbox.x) {
2485
+ if (_optionalChain([prev, 'optionalAccess', _171 => _171.type]) === "paragraph" && prev.pageNumber === block.pageNumber && /^[a-z]{1,3}[.)]$/.test(_nullishCoalesce(_optionalChain([prev, 'access', _172 => _172.text, 'optionalAccess', _173 => _173.trim, 'call', _174 => _174()]), () => ( ""))) && prev.bbox && block.bbox && Math.abs(prev.bbox.y - block.bbox.y) < 2 && prev.bbox.x + prev.bbox.width <= block.bbox.x) {
2539
2486
  prev.text = `${prev.text.trim()} ${block.text.trim()}`;
2540
2487
  prev.bbox = { ...prev.bbox, width: block.bbox.x + block.bbox.width - prev.bbox.x };
2541
2488
  blocks.splice(i--, 1);
2542
2489
  continue;
2543
2490
  }
2544
- if (_optionalChain([prev, 'optionalAccess', _181 => _181.type]) === "paragraph" && prev.pageNumber === block.pageNumber && /^\d{1,2}(?:\.\d{1,2})*\.?$/.test(_nullishCoalesce(_optionalChain([prev, 'access', _182 => _182.text, 'optionalAccess', _183 => _183.trim, 'call', _184 => _184()]), () => ( ""))) && 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', _185 => _185.style, 'optionalAccess', _186 => _186.fontSize]), () => ( 0))) >= fsz && prev.bbox.y - (block.bbox.y + block.bbox.height) < fsz * 1.5)) {
2491
+ if (_optionalChain([prev, 'optionalAccess', _175 => _175.type]) === "paragraph" && prev.pageNumber === block.pageNumber && /^\d{1,2}(?:\.\d{1,2})*\.?$/.test(_nullishCoalesce(_optionalChain([prev, 'access', _176 => _176.text, 'optionalAccess', _177 => _177.trim, 'call', _178 => _178()]), () => ( ""))) && 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', _179 => _179.style, 'optionalAccess', _180 => _180.fontSize]), () => ( 0))) >= fsz && prev.bbox.y - (block.bbox.y + block.bbox.height) < fsz * 1.5)) {
2545
2492
  block.text = `${prev.text.trim()} ${block.text.trim()}`;
2546
2493
  blocks.splice(i - 1, 1);
2547
2494
  i -= 2;
2548
2495
  continue;
2549
2496
  }
2550
- const box = block.bbox, size = _nullishCoalesce(_optionalChain([block, 'access', _187 => _187.style, 'optionalAccess', _188 => _188.fontSize]), () => ( 0));
2551
- const kicker = !!box && size > 0 && _optionalChain([next, 'optionalAccess', _189 => _189.type]) === "heading" && next.pageNumber === block.pageNumber && !!next.bbox && (_optionalChain([block, 'access', _190 => _190.style, 'optionalAccess', _191 => _191.fontName]) !== "ocr" || size < (_nullishCoalesce(bodySizes.get(_nullishCoalesce(block.pageNumber, () => ( 0))), () => ( Infinity))) * 2) && (_nullishCoalesce(_optionalChain([next, 'access', _192 => _192.style, 'optionalAccess', _193 => _193.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");
2552
- const face = _nullishCoalesce(_optionalChain([faceNames, 'optionalAccess', _194 => _194.get, 'call', _195 => _195(_nullishCoalesce(_optionalChain([block, 'access', _196 => _196.style, 'optionalAccess', _197 => _197.fontName]), () => ( "")))]), () => ( ""));
2497
+ const box = block.bbox, size = _nullishCoalesce(_optionalChain([block, 'access', _181 => _181.style, 'optionalAccess', _182 => _182.fontSize]), () => ( 0));
2498
+ const kicker = !!box && size > 0 && _optionalChain([next, 'optionalAccess', _183 => _183.type]) === "heading" && next.pageNumber === block.pageNumber && !!next.bbox && (_optionalChain([block, 'access', _184 => _184.style, 'optionalAccess', _185 => _185.fontName]) !== "ocr" || size < (_nullishCoalesce(bodySizes.get(_nullishCoalesce(block.pageNumber, () => ( 0))), () => ( Infinity))) * 2) && (_nullishCoalesce(_optionalChain([next, 'access', _186 => _186.style, 'optionalAccess', _187 => _187.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");
2499
+ const face = _nullishCoalesce(_optionalChain([faceNames, 'optionalAccess', _188 => _188.get, 'call', _189 => _189(_nullishCoalesce(_optionalChain([block, 'access', _190 => _190.style, 'optionalAccess', _191 => _191.fontName]), () => ( "")))]), () => ( ""));
2553
2500
  const [bodyFace, bodySize] = (_nullishCoalesce(bodyStyle.get(_nullishCoalesce(block.pageNumber, () => ( 0))), () => ( ""))).split(":");
2554
- const byline = /Italic|Oblique/i.test(face) && !/Bold|Black|Heavy|Semibold/i.test(face) && !!bodyFace && size <= Number(bodySize) + 0.5 && _optionalChain([blocks, 'access', _198 => _198[i - 1], 'optionalAccess', _199 => _199.type]) === "heading" && blocks[i - 1].pageNumber === block.pageNumber;
2555
- const ocrFragment = _optionalChain([block, 'access', _200 => _200.style, 'optionalAccess', _201 => _201.fontName]) === "ocr" && (/^[.,;:…·•-]/.test(text) || text.includes("\u2026") || (_nullishCoalesce(_optionalChain([text, 'access', _202 => _202.match, 'call', _203 => _203(/\p{L}/gu), 'optionalAccess', _204 => _204.length]), () => ( 0))) < 2 || text.split(/\s+/).length > 7);
2556
- const crowdedOcr = _optionalChain([block, 'access', _205 => _205.style, 'optionalAccess', _206 => _206.fontName]) === "ocr" && !!box && [prev, next].every((o) => _optionalChain([o, 'optionalAccess', _207 => _207.type]) === "paragraph" && o.pageNumber === block.pageNumber && _optionalChain([o, 'access', _208 => _208.style, 'optionalAccess', _209 => _209.fontName]) === "ocr" && !!o.bbox && (_nullishCoalesce(_optionalChain([o, 'access', _210 => _210.text, 'optionalAccess', _211 => _211.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;
2501
+ const byline = /Italic|Oblique/i.test(face) && !/Bold|Black|Heavy|Semibold/i.test(face) && !!bodyFace && size <= Number(bodySize) + 0.5 && _optionalChain([blocks, 'access', _192 => _192[i - 1], 'optionalAccess', _193 => _193.type]) === "heading" && blocks[i - 1].pageNumber === block.pageNumber;
2502
+ const ocrFragment = _optionalChain([block, 'access', _194 => _194.style, 'optionalAccess', _195 => _195.fontName]) === "ocr" && (/^[.,;:…·•-]/.test(text) || text.includes("\u2026") || (_nullishCoalesce(_optionalChain([text, 'access', _196 => _196.match, 'call', _197 => _197(/\p{L}/gu), 'optionalAccess', _198 => _198.length]), () => ( 0))) < 2 || text.split(/\s+/).length > 7);
2503
+ const crowdedOcr = _optionalChain([block, 'access', _199 => _199.style, 'optionalAccess', _200 => _200.fontName]) === "ocr" && !!box && [prev, next].every((o) => _optionalChain([o, 'optionalAccess', _201 => _201.type]) === "paragraph" && o.pageNumber === block.pageNumber && _optionalChain([o, 'access', _202 => _202.style, 'optionalAccess', _203 => _203.fontName]) === "ocr" && !!o.bbox && (_nullishCoalesce(_optionalChain([o, 'access', _204 => _204.text, 'optionalAccess', _205 => _205.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;
2557
2504
  if (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)"·"가)" 앞머리 번호는 빼고 센다
2558
2505
  unbalancedClose(text.replace(/^\s*[\dA-Za-z가-힣ⅰ-ⅹ]{1,3}\)\s*/, "")) || isRunningHead(block, page, pageHeights.get(_nullishCoalesce(block.pageNumber, () => ( 0))))) {
2559
2506
  block.type = "paragraph";
@@ -2588,28 +2535,28 @@ var CAPTION_LABEL = /^(?:figure|fig\.|diagram|table|chart|graph|exhibit|box)\s*[
2588
2535
  function captionTableText(t) {
2589
2536
  if (!t || t.rows !== 1 || t.cols !== 2) return null;
2590
2537
  const [label, body] = t.cells[0];
2591
- if (!label || !body || _optionalChain([label, 'access', _212 => _212.blocks, 'optionalAccess', _213 => _213.length]) || _optionalChain([body, 'access', _214 => _214.blocks, 'optionalAccess', _215 => _215.length]) || !CAPTION_LABEL.test(label.text.trim()) || !body.text.trim()) return null;
2538
+ if (!label || !body || _optionalChain([label, 'access', _206 => _206.blocks, 'optionalAccess', _207 => _207.length]) || _optionalChain([body, 'access', _208 => _208.blocks, 'optionalAccess', _209 => _209.length]) || !CAPTION_LABEL.test(label.text.trim()) || !body.text.trim()) return null;
2592
2539
  return `${label.text.trim()} ${body.text.replace(/\s*\n\s*/g, " ").trim()}`;
2593
2540
  }
2594
2541
  function splitSingleCellTables(blocks) {
2595
2542
  const out = [];
2596
2543
  for (const b of blocks) {
2597
2544
  const t = b.type === "table" ? b.table : void 0;
2598
- const only = t && t.rows === 1 && t.cols === 1 && _optionalChain([t, 'access', _216 => _216.cells, 'access', _217 => _217[0], 'optionalAccess', _218 => _218[0], 'optionalAccess', _219 => _219.blocks, 'optionalAccess', _220 => _220.length]) === 1 ? t.cells[0][0].blocks[0] : void 0;
2545
+ const only = t && t.rows === 1 && t.cols === 1 && _optionalChain([t, 'access', _210 => _210.cells, 'access', _211 => _211[0], 'optionalAccess', _212 => _212[0], 'optionalAccess', _213 => _213.blocks, 'optionalAccess', _214 => _214.length]) === 1 ? t.cells[0][0].blocks[0] : void 0;
2599
2546
  const squash = (s) => s.replace(/\s/g, "");
2600
2547
  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;
2601
- const caption = _nullishCoalesce(captionTableText(t), () => ( (_optionalChain([inner, 'optionalAccess', _221 => _221.type]) === "table" ? captionTableText(inner.table) : null)));
2548
+ const caption = _nullishCoalesce(captionTableText(t), () => ( (_optionalChain([inner, 'optionalAccess', _215 => _215.type]) === "table" ? captionTableText(inner.table) : null)));
2602
2549
  if (caption) {
2603
2550
  out.push({ type: "paragraph", text: caption, pageNumber: b.pageNumber, bbox: b.bbox });
2604
2551
  continue;
2605
2552
  }
2606
- const cell = t && t.rows === 1 && t.cols === 1 ? _optionalChain([t, 'access', _222 => _222.cells, 'access', _223 => _223[0], 'optionalAccess', _224 => _224[0]]) : void 0;
2607
- if (!cell || _optionalChain([cell, 'access', _225 => _225.blocks, 'optionalAccess', _226 => _226.some, 'call', _227 => _227((x) => x.type === "table")])) {
2553
+ const cell = t && t.rows === 1 && t.cols === 1 ? _optionalChain([t, 'access', _216 => _216.cells, 'access', _217 => _217[0], 'optionalAccess', _218 => _218[0]]) : void 0;
2554
+ if (!cell || _optionalChain([cell, 'access', _219 => _219.blocks, 'optionalAccess', _220 => _220.some, 'call', _221 => _221((x) => x.type === "table")])) {
2608
2555
  out.push(b);
2609
2556
  continue;
2610
2557
  }
2611
2558
  const lines = (_nullishCoalesce(cell.text, () => ( ""))).split(/\n/).map((l) => l.trim()).filter(Boolean);
2612
- if (_optionalChain([t, 'optionalAccess', _228 => _228.caption, 'optionalAccess', _229 => _229.trim, 'call', _230 => _230()])) out.push({ type: "paragraph", text: t.caption.trim(), pageNumber: b.pageNumber, bbox: b.bbox });
2559
+ if (_optionalChain([t, 'optionalAccess', _222 => _222.caption, 'optionalAccess', _223 => _223.trim, 'call', _224 => _224()])) out.push({ type: "paragraph", text: t.caption.trim(), pageNumber: b.pageNumber, bbox: b.bbox });
2613
2560
  for (const text of lines) out.push({ type: "paragraph", text, pageNumber: b.pageNumber, bbox: b.bbox });
2614
2561
  }
2615
2562
  return out;
@@ -2622,7 +2569,7 @@ function joinLatinCellWraps(blocks) {
2622
2569
  const lines = cell.text.split("\n");
2623
2570
  const out = [lines[0]];
2624
2571
  for (const line of lines.slice(1)) {
2625
- if (_chunk7DC2KL3Vcjs.latinSoftWrap.call(void 0, out[out.length - 1], line)) out[out.length - 1] = out[out.length - 1].trimEnd() + " " + line.trim();
2572
+ if (_chunkKDMAYOWHcjs.latinSoftWrap.call(void 0, out[out.length - 1], line)) out[out.length - 1] = out[out.length - 1].trimEnd() + " " + line.trim();
2626
2573
  else out.push(line);
2627
2574
  }
2628
2575
  cell.text = out.join("\n");
@@ -2633,19 +2580,19 @@ function joinLatinCellWraps(blocks) {
2633
2580
  }
2634
2581
  function cleanPdfText(text, opts) {
2635
2582
  let clean = normalizeAraea(stripControlChars(text));
2636
- if (!_optionalChain([opts, 'optionalAccess', _231 => _231.keepLoneNumbers])) {
2583
+ if (!_optionalChain([opts, 'optionalAccess', _225 => _225.keepLoneNumbers])) {
2637
2584
  clean = clean.replace(/^\d{1,4}\n/, "").replace(/\n\d{1,4}\n/g, "\n").replace(/\n\d{1,4}$/, "");
2638
2585
  }
2639
- if (!_optionalChain([opts, 'optionalAccess', _232 => _232.keepLoneNumbers])) clean = clean.replace(/^#{1,6}\s*\d{1,4}\s*$/gm, "");
2586
+ if (!_optionalChain([opts, 'optionalAccess', _226 => _226.keepLoneNumbers])) clean = clean.replace(/^#{1,6}\s*\d{1,4}\s*$/gm, "");
2640
2587
  return mergeKoreanLines(
2641
2588
  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))
2642
2589
  ).replace(/^(?!\| ---).*$/gm, (line) => {
2643
2590
  if (/^\s*\${1,2}.+\${1,2}\s*$/.test(line)) return line;
2644
2591
  if (line.startsWith("|")) {
2645
- return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) => _chunk7DC2KL3Vcjs.collapseEvenSpacing.call(void 0, t, false))).join("<br>"));
2592
+ return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) => _chunkKDMAYOWHcjs.collapseEvenSpacing.call(void 0, t, false))).join("<br>"));
2646
2593
  }
2647
- const mark = _nullishCoalesce(_optionalChain([/^(?:#{1,6}|-) /, 'access', _233 => _233.exec, 'call', _234 => _234(line), 'optionalAccess', _235 => _235[0]]), () => ( ""));
2648
- return mark + _chunk7DC2KL3Vcjs.collapseEvenSpacing.call(void 0, line.slice(mark.length), false);
2594
+ const mark = _nullishCoalesce(_optionalChain([/^(?:#{1,6}|-) /, 'access', _227 => _227.exec, 'call', _228 => _228(line), 'optionalAccess', _229 => _229[0]]), () => ( ""));
2595
+ return mark + _chunkKDMAYOWHcjs.collapseEvenSpacing.call(void 0, line.slice(mark.length), false);
2649
2596
  }).replace(/\\~\\~/g, "~~").replace(/~~~~/g, "").replace(/<u>\s*<\/u>/g, "").replace(/<(sup|sub)>\s*<\/\1>/g, "").replace(/\n{3,}/g, "\n\n").trim();
2650
2597
  }
2651
2598
  function startsWithMarker(line) {
@@ -2677,7 +2624,7 @@ function mergeKoreanLines(text) {
2677
2624
  continue;
2678
2625
  }
2679
2626
  if (/[가-힣·,\-]$/.test(prev) && /^[가-힣(]/.test(curr) && !startsWithMarker(curr) && !isStandaloneHeader(prev) && !startsWithMarker(prev)) {
2680
- result[result.length - 1] = prev + _chunk7DC2KL3Vcjs.wrapJoiner.call(void 0, prev, curr) + curr;
2627
+ result[result.length - 1] = prev + _chunkKDMAYOWHcjs.wrapJoiner.call(void 0, prev, curr) + curr;
2681
2628
  } else {
2682
2629
  result.push(curr);
2683
2630
  }
@@ -2693,7 +2640,7 @@ function applyLinkAnnotations(items, annots) {
2693
2640
  const wrapped = /* @__PURE__ */ new Set();
2694
2641
  for (const a of annots) {
2695
2642
  if (a.subtype !== "Link" || !a.url || !a.rect || a.rect.length < 4) continue;
2696
- const url = _chunkPCSOJ523cjs.sanitizeHref.call(void 0, a.url);
2643
+ const url = _chunkUZGZRGYMcjs.sanitizeHref.call(void 0, a.url);
2697
2644
  if (!url) continue;
2698
2645
  const x1 = Math.min(a.rect[0], a.rect[2]), x2 = Math.max(a.rect[0], a.rect[2]);
2699
2646
  const y1 = Math.min(a.rect[1], a.rect[3]), y2 = Math.max(a.rect[1], a.rect[3]);
@@ -2734,7 +2681,7 @@ function mergeLinkRuns(markdown) {
2734
2681
 
2735
2682
  // src/pdf/formula-ocr.ts
2736
2683
  async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
2737
- const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-W3GQC6L6.cjs")));
2684
+ const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-VY4ITOMN.cjs")));
2738
2685
  const { FormulaPipeline, ensureFormulaModels } = formulaMod;
2739
2686
  await ensureFormulaModels((p) => {
2740
2687
  if (p.phase === "download" && p.total) {
@@ -2913,13 +2860,13 @@ async function loadPdfWithTimeout(buffer) {
2913
2860
  try {
2914
2861
  return await Promise.race([
2915
2862
  loadingTask.promise.catch((e) => {
2916
- if (e instanceof Error && e.name === "PasswordException") throw new (0, _chunkPCSOJ523cjs.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)");
2863
+ if (e instanceof Error && e.name === "PasswordException") throw new (0, _chunkUZGZRGYMcjs.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)");
2917
2864
  throw e;
2918
2865
  }),
2919
2866
  new Promise((_, reject) => {
2920
2867
  timer = setTimeout(() => {
2921
2868
  loadingTask.destroy();
2922
- reject(new (0, _chunkPCSOJ523cjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
2869
+ reject(new (0, _chunkUZGZRGYMcjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
2923
2870
  }, PDF_LOAD_TIMEOUT_MS);
2924
2871
  })
2925
2872
  ]);
@@ -2928,13 +2875,13 @@ async function loadPdfWithTimeout(buffer) {
2928
2875
  }
2929
2876
  }
2930
2877
  async function parsePdfDocument(buffer, options) {
2931
- const formulaBuffer = _optionalChain([options, 'optionalAccess', _236 => _236.formulaOcr]) ? buffer : null;
2932
- const autoOcr = _optionalChain([options, 'optionalAccess', _237 => _237.ocr]) === void 0 && await _chunk7DC2KL3Vcjs.ocrModelsCached.call(void 0, );
2933
- const ocrBuffer = _optionalChain([options, 'optionalAccess', _238 => _238.ocr]) || autoOcr ? buffer : null;
2878
+ const formulaBuffer = _optionalChain([options, 'optionalAccess', _230 => _230.formulaOcr]) ? buffer : null;
2879
+ const autoOcr = _optionalChain([options, 'optionalAccess', _231 => _231.ocr]) === void 0 && await _chunkKDMAYOWHcjs.ocrModelsCached.call(void 0, );
2880
+ const ocrBuffer = _optionalChain([options, 'optionalAccess', _232 => _232.ocr]) || autoOcr ? buffer : null;
2934
2881
  const doc = await loadPdfWithTimeout(buffer);
2935
2882
  try {
2936
2883
  const pageCount = doc.numPages;
2937
- if (pageCount === 0) throw new (0, _chunkPCSOJ523cjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
2884
+ if (pageCount === 0) throw new (0, _chunkUZGZRGYMcjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
2938
2885
  const metadata = { pageCount, pageMode: "layout" };
2939
2886
  await extractPdfMetadata(doc, metadata);
2940
2887
  const blocks = [];
@@ -2943,8 +2890,8 @@ async function parsePdfDocument(buffer, options) {
2943
2890
  let totalChars = 0;
2944
2891
  let totalTextBytes = 0;
2945
2892
  const effectivePageCount = Math.min(pageCount, MAX_PAGES);
2946
- const pageFilter = _optionalChain([options, 'optionalAccess', _239 => _239.pages]) ? _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, effectivePageCount) : null;
2947
- if (pageCount > MAX_PAGES && (!_optionalChain([options, 'optionalAccess', _240 => _240.pages]) || _chunkJ55UQC5Hcjs.hasRequestedPagesAfter.call(void 0, options.pages, MAX_PAGES, pageCount))) {
2893
+ const pageFilter = _optionalChain([options, 'optionalAccess', _233 => _233.pages]) ? _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, effectivePageCount) : null;
2894
+ if (pageCount > MAX_PAGES && (!_optionalChain([options, 'optionalAccess', _234 => _234.pages]) || _chunkJ55UQC5Hcjs.hasRequestedPagesAfter.call(void 0, options.pages, MAX_PAGES, pageCount))) {
2948
2895
  warnings.push({ message: `${pageCount}\uCABD \uC911 \uC55E ${MAX_PAGES}\uCABD\uB9CC \uD30C\uC2F1\uD588\uC2B5\uB2C8\uB2E4 (\uCABD \uC218 \uC0C1\uD55C)`, code: "PARTIAL_PARSE" });
2949
2896
  }
2950
2897
  const totalTarget = pageFilter ? pageFilter.size : effectivePageCount;
@@ -2961,7 +2908,7 @@ async function parsePdfDocument(buffer, options) {
2961
2908
  const pageImageBlocks = /* @__PURE__ */ new Map();
2962
2909
  const carry = {};
2963
2910
  const vectorPageOps = /* @__PURE__ */ new Map();
2964
- const wrapLexicon = new (0, _chunk7DC2KL3Vcjs.WrapLexicon)();
2911
+ const wrapLexicon = new (0, _chunkKDMAYOWHcjs.WrapLexicon)();
2965
2912
  const noteMarks = /* @__PURE__ */ new Map();
2966
2913
  let parsedPages = 0;
2967
2914
  for (let i = 1; i <= effectivePageCount; i++) {
@@ -2984,13 +2931,13 @@ async function parsePdfDocument(buffer, options) {
2984
2931
  return void 0;
2985
2932
  }
2986
2933
  };
2987
- const differencesOf = (loadedName) => _optionalChain([fontObj, 'call', _241 => _241(loadedName), 'optionalAccess', _242 => _242.differences]);
2988
- restoreNamedGlyphs(rawItems, rawOps.fnArray, rawOps.argsArray, differencesOf, (n) => _optionalChain([fontObj, 'call', _243 => _243(n), 'optionalAccess', _244 => _244.name]));
2934
+ const differencesOf = (loadedName) => _optionalChain([fontObj, 'call', _235 => _235(loadedName), 'optionalAccess', _236 => _236.differences]);
2935
+ restoreNamedGlyphs(rawItems, rawOps.fnArray, rawOps.argsArray, differencesOf, (n) => _optionalChain([fontObj, 'call', _237 => _237(n), 'optionalAccess', _238 => _238.name]));
2989
2936
  restoreTrackedSpacing(rawItems, rawOps.fnArray, rawOps.argsArray);
2990
2937
  markSyntheticSpaces(rawItems, rawOps.fnArray, rawOps.argsArray);
2991
2938
  const occluded = occludedTextItems(rawItems, rawOps.fnArray, rawOps.argsArray);
2992
- const items = _chunk7DC2KL3Vcjs.normalizeItems.call(void 0, occluded.size ? rawItems.filter((it) => !occluded.has(it)) : rawItems);
2993
- const filtered = _chunk7DC2KL3Vcjs.filterHiddenText.call(void 0, items, pageW, pageH, viewX1, viewY1);
2939
+ const items = _chunkKDMAYOWHcjs.normalizeItems.call(void 0, occluded.size ? rawItems.filter((it) => !occluded.has(it)) : rawItems);
2940
+ const filtered = _chunkKDMAYOWHcjs.filterHiddenText.call(void 0, items, pageW, pageH, viewX1, viewY1);
2994
2941
  const joined = joinVerticalColumns(filtered.visible);
2995
2942
  const visible = dropTabLeaderDots(joined);
2996
2943
  const hiddenCount = filtered.hiddenCount + occluded.size;
@@ -3014,7 +2961,7 @@ async function parsePdfDocument(buffer, options) {
3014
2961
  fnArray: [_pdfmjs.OPS.transform, ...rawOps.fnArray],
3015
2962
  argsArray: [[1, 0, 0, 1, -viewX1, -viewY1], ...rawOps.argsArray]
3016
2963
  } : rawOps;
3017
- remapSymbolFontItems(visible, (loadedName) => _optionalChain([fontObj, 'call', _245 => _245(loadedName), 'optionalAccess', _246 => _246.name]));
2964
+ remapSymbolFontItems(visible, (loadedName) => _optionalChain([fontObj, 'call', _239 => _239(loadedName), 'optionalAccess', _240 => _240.name]));
3018
2965
  remapControlGlyphs(visible, differencesOf);
3019
2966
  const faces = /* @__PURE__ */ new Map();
3020
2967
  for (const it of visible) {
@@ -3022,17 +2969,18 @@ async function parsePdfDocument(buffer, options) {
3022
2969
  let face = faces.get(it.fontName);
3023
2970
  if (face === void 0) {
3024
2971
  const obj = fontObj(it.fontName);
3025
- face = _optionalChain([obj, 'optionalAccess', _247 => _247.isType3Font]) && /^[A-Z]{6}\+./.test(_nullishCoalesce(obj.name, () => ( ""))) && obj.name.slice(7) || it.fontName;
2972
+ face = _optionalChain([obj, 'optionalAccess', _241 => _241.isType3Font]) && /^[A-Z]{6}\+./.test(_nullishCoalesce(obj.name, () => ( ""))) && obj.name.slice(7) || it.fontName;
3026
2973
  faces.set(it.fontName, face);
3027
2974
  }
3028
2975
  it.fontName = face;
3029
- if (!faceNames.has(face)) faceNames.set(face, (_nullishCoalesce(_optionalChain([fontObj, 'call', _248 => _248(face), 'optionalAccess', _249 => _249.name]), () => ( ""))).replace(/^[A-Z]{6}\+/, ""));
2976
+ if (!faceNames.has(face)) faceNames.set(face, (_nullishCoalesce(_optionalChain([fontObj, 'call', _242 => _242(face), 'optionalAccess', _243 => _243.name]), () => ( ""))).replace(/^[A-Z]{6}\+/, ""));
3030
2977
  }
3031
- for (const it of visible) if (it.text.includes("$")) it.text = _chunkQ5N4YS3Tcjs.escapeLiteralDollar.call(void 0, it.text);
2978
+ for (const it of visible) if (it.text.includes("$")) it.text = _chunkQGFZU3JEcjs.escapeLiteralDollar.call(void 0, it.text);
2979
+ for (const it of visible) if (it.text.includes("<")) it.text = _chunkQGFZU3JEcjs.escapeLiteralTags.call(void 0, it.text);
3032
2980
  wrapEquationRuns(visible, (face) => faceNames.get(face));
3033
2981
  const pageArea = pageW * pageH;
3034
2982
  if (pageArea > 0) {
3035
- const imageRegions = _chunk7DC2KL3Vcjs.extractImageRegions.call(void 0, opList.fnArray, opList.argsArray);
2983
+ const imageRegions = _chunkKDMAYOWHcjs.extractImageRegions.call(void 0, opList.fnArray, opList.argsArray);
3036
2984
  let uncovered = 0;
3037
2985
  for (const r of imageRegions) {
3038
2986
  const area = (r.x2 - r.x1) * (r.y2 - r.y1);
@@ -3058,14 +3006,14 @@ async function parsePdfDocument(buffer, options) {
3058
3006
  if (uncovered > 0) skippedImagePages.set(i, uncovered);
3059
3007
  }
3060
3008
  const marks = superscriptNoteMarks(visible);
3061
- if (marks.length) noteMarks.set(i, { marks, seps: footnoteSeparators(_chunk7DC2KL3Vcjs.extractLines.call(void 0, opList.fnArray, opList.argsArray).horizontals, pageW, pageH) });
3009
+ if (marks.length) noteMarks.set(i, { marks, seps: footnoteSeparators(_chunkKDMAYOWHcjs.extractLines.call(void 0, opList.fnArray, opList.argsArray).horizontals, pageW, pageH) });
3062
3010
  const stamp = marginStamp(visible);
3063
3011
  const flow = stamp.length ? visible.filter((it) => !stamp.includes(it)) : visible;
3064
- const pageBlocks = orderTwoUpPage(_chunk7DC2KL3Vcjs.extractPageBlocksWithLines.call(void 0, flow, i, opList, pageW, pageH, void 0, _optionalChain([options, 'optionalAccess', _250 => _250.tables]) !== false, carry, wrapLexicon), pageW, pageH);
3012
+ const pageBlocks = orderTwoUpPage(_chunkKDMAYOWHcjs.extractPageBlocksWithLines.call(void 0, flow, i, opList, pageW, pageH, void 0, _optionalChain([options, 'optionalAccess', _244 => _244.tables]) !== false, carry, wrapLexicon), pageW, pageH);
3065
3013
  if (stamp.length) pageBlocks.unshift({ type: "paragraph", text: [...stamp].sort((a, b) => a.y - b.y).map((it) => it.text).join(" "), pageNumber: i });
3066
3014
  for (const b of pageBlocks) blocks.push(b);
3067
3015
  try {
3068
- const { blocks: imgBlocks, images: pageImages } = await extractPageImages(page, opList.fnArray, opList.argsArray, i, imageState, warnings, _optionalChain([options, 'optionalAccess', _251 => _251.images]) !== false);
3016
+ const { blocks: imgBlocks, images: pageImages } = await extractPageImages(page, opList.fnArray, opList.argsArray, i, imageState, warnings, _optionalChain([options, 'optionalAccess', _245 => _245.images]) !== false);
3069
3017
  if (imgBlocks.length > 0) pageImageBlocks.set(i, imgBlocks);
3070
3018
  extractedImages.push(...pageImages);
3071
3019
  } catch (e6) {
@@ -3084,27 +3032,27 @@ async function parsePdfDocument(buffer, options) {
3084
3032
  const vector = scanVectorGlyphs(opList.fnArray, opList.argsArray, visible);
3085
3033
  const quality = computePageQuality(i, pageText, vector.glyphs);
3086
3034
  pageQuality.push(quality);
3087
- if (_optionalChain([options, 'optionalAccess', _252 => _252.ocr]) && quality.ocrReason === "vector_text" && page.rotate % 360 === 0 && page.view[0] === 0 && page.view[1] === 0) {
3035
+ if (_optionalChain([options, 'optionalAccess', _246 => _246.ocr]) && quality.ocrReason === "vector_text" && page.rotate % 360 === 0 && page.view[0] === 0 && page.view[1] === 0) {
3088
3036
  vectorPageOps.set(i, ocrVectorOps(opList, vector.paths));
3089
3037
  }
3090
- if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunkPCSOJ523cjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
3038
+ if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunkUZGZRGYMcjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
3091
3039
  parsedPages++;
3092
- _optionalChain([options, 'optionalAccess', _253 => _253.onProgress, 'optionalCall', _254 => _254(parsedPages, totalTarget)]);
3040
+ _optionalChain([options, 'optionalAccess', _247 => _247.onProgress, 'optionalCall', _248 => _248(parsedPages, totalTarget)]);
3093
3041
  } catch (pageErr) {
3094
- if (pageErr instanceof _chunkPCSOJ523cjs.KordocError) throw pageErr;
3042
+ if (pageErr instanceof _chunkUZGZRGYMcjs.KordocError) throw pageErr;
3095
3043
  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" });
3096
3044
  } finally {
3097
- _optionalChain([loadedPage, 'optionalAccess', _255 => _255.cleanup, 'call', _256 => _256()]);
3045
+ _optionalChain([loadedPage, 'optionalAccess', _249 => _249.cleanup, 'call', _250 => _250()]);
3098
3046
  }
3099
3047
  }
3100
3048
  const parsedPageCount = parsedPages || (pageFilter ? pageFilter.size : effectivePageCount);
3101
- const isImageBased = _optionalChain([pageFilter, 'optionalAccess', _257 => _257.size]) !== 0 && totalChars / Math.max(parsedPageCount, 1) < 10;
3049
+ const isImageBased = _optionalChain([pageFilter, 'optionalAccess', _251 => _251.size]) !== 0 && totalChars / Math.max(parsedPageCount, 1) < 10;
3102
3050
  const ocrDone = /* @__PURE__ */ new Set();
3103
- const ocrRegions = _optionalChain([options, 'optionalAccess', _258 => _258.ocr]) === true || autoOcr ? ocrImageRegions(uncoveredImageRegions, largeImageRegions, _optionalChain([options, 'optionalAccess', _259 => _259.ocr]) === true) : /* @__PURE__ */ new Map();
3051
+ const ocrRegions = _optionalChain([options, 'optionalAccess', _252 => _252.ocr]) === true || autoOcr ? ocrImageRegions(uncoveredImageRegions, largeImageRegions, _optionalChain([options, 'optionalAccess', _253 => _253.ocr]) === true) : /* @__PURE__ */ new Map();
3104
3052
  if (ocrBuffer) {
3105
3053
  const inScope = (p) => !pageFilter || pageFilter.has(p);
3106
3054
  const targets = /* @__PURE__ */ new Set();
3107
- if (_optionalChain([options, 'optionalAccess', _260 => _260.ocr]) === "force" || isImageBased) {
3055
+ if (_optionalChain([options, 'optionalAccess', _254 => _254.ocr]) === "force" || isImageBased) {
3108
3056
  for (let i = 1; i <= effectivePageCount; i++) if (inScope(i)) targets.add(i);
3109
3057
  } else {
3110
3058
  for (const pq of pageQuality) {
@@ -3117,16 +3065,16 @@ async function parsePdfDocument(buffer, options) {
3117
3065
  }
3118
3066
  if (targets.size > 0) {
3119
3067
  try {
3120
- const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-EGWOIB6O.cjs")));
3121
- const mode = typeof _optionalChain([options, 'optionalAccess', _261 => _261.ocr]) === "function" ? options.ocr : "builtin";
3122
- const regionPages = new Map([...ocrRegions].filter(([p]) => _optionalChain([options, 'optionalAccess', _262 => _262.ocr]) !== "force" && !isImageBased && !_optionalChain([pageQuality, 'access', _263 => _263.find, 'call', _264 => _264((q) => q.page === p), 'optionalAccess', _265 => _265.needsOcr])));
3123
- const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, _optionalChain([options, 'optionalAccess', _266 => _266.onProgress]), _optionalChain([options, 'optionalAccess', _267 => _267.tables]) !== false, vectorPageOps, regionPages);
3124
- for (const obs of ocrPageBlocks.values()) _chunkQ5N4YS3Tcjs.stripScriptTags.call(void 0, { blocks: obs });
3068
+ const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-IGYCZ7G2.cjs")));
3069
+ const mode = typeof _optionalChain([options, 'optionalAccess', _255 => _255.ocr]) === "function" ? options.ocr : "builtin";
3070
+ const regionPages = new Map([...ocrRegions].filter(([p]) => _optionalChain([options, 'optionalAccess', _256 => _256.ocr]) !== "force" && !isImageBased && !_optionalChain([pageQuality, 'access', _257 => _257.find, 'call', _258 => _258((q) => q.page === p), 'optionalAccess', _259 => _259.needsOcr])));
3071
+ const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, _optionalChain([options, 'optionalAccess', _260 => _260.onProgress]), _optionalChain([options, 'optionalAccess', _261 => _261.tables]) !== false, vectorPageOps, regionPages);
3072
+ for (const obs of ocrPageBlocks.values()) _chunkQGFZU3JEcjs.stripScriptTags.call(void 0, { blocks: obs });
3125
3073
  if (ocrPageBlocks.size > 0) {
3126
3074
  const replacePages = /* @__PURE__ */ new Set();
3127
3075
  for (const [p, obs] of ocrPageBlocks) {
3128
- const needsOcr = _optionalChain([pageQuality, 'access', _268 => _268.find, 'call', _269 => _269((q) => q.page === p), 'optionalAccess', _270 => _270.needsOcr]);
3129
- if (_optionalChain([options, 'optionalAccess', _271 => _271.ocr]) === "force" || isImageBased || needsOcr) {
3076
+ const needsOcr = _optionalChain([pageQuality, 'access', _262 => _262.find, 'call', _263 => _263((q) => q.page === p), 'optionalAccess', _264 => _264.needsOcr]);
3077
+ if (_optionalChain([options, 'optionalAccess', _265 => _265.ocr]) === "force" || isImageBased || needsOcr) {
3130
3078
  replacePages.add(p);
3131
3079
  ocrDone.add(p);
3132
3080
  continue;
@@ -3134,7 +3082,7 @@ async function parsePdfDocument(buffer, options) {
3134
3082
  const regions = ocrRegions.get(p);
3135
3083
  if (!regions || mergeOcrImageRegions(blocks, p, regions, obs) === 0) continue;
3136
3084
  ocrDone.add(p);
3137
- if (_optionalChain([pageImageBlocks, 'access', _272 => _272.get, 'call', _273 => _273(p), 'optionalAccess', _274 => _274.length]) === 1) pageImageBlocks.delete(p);
3085
+ if (_optionalChain([pageImageBlocks, 'access', _266 => _266.get, 'call', _267 => _267(p), 'optionalAccess', _268 => _268.length]) === 1) pageImageBlocks.delete(p);
3138
3086
  }
3139
3087
  if (replacePages.size) {
3140
3088
  const merged = blocks.filter((b) => !(b.pageNumber && replacePages.has(b.pageNumber)));
@@ -3184,12 +3132,12 @@ async function parsePdfDocument(buffer, options) {
3184
3132
  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" });
3185
3133
  }
3186
3134
  }
3187
- if (_optionalChain([options, 'optionalAccess', _275 => _275.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
3188
- const removed = _chunk7DC2KL3Vcjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks);
3135
+ if (_optionalChain([options, 'optionalAccess', _269 => _269.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
3136
+ const removed = _chunkKDMAYOWHcjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks);
3189
3137
  for (let ri = removed.length - 1; ri >= 0; ri--) {
3190
3138
  blocks.splice(removed[ri], 1);
3191
3139
  }
3192
- const kept = removeSideTabs(blocks, pageWidths);
3140
+ const kept = _chunkKDMAYOWHcjs.removeSideTabs.call(void 0, blocks, pageWidths);
3193
3141
  if (kept !== blocks) {
3194
3142
  blocks.length = 0;
3195
3143
  blocks.push(...kept);
@@ -3197,15 +3145,15 @@ async function parsePdfDocument(buffer, options) {
3197
3145
  }
3198
3146
  mergeContinuedCells(blocks, pageHeights);
3199
3147
  mergeCrossPageTables(blocks, pageHeights, wrapLexicon);
3200
- if (_optionalChain([options, 'optionalAccess', _276 => _276.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
3201
- const boxes = _chunk7DC2KL3Vcjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, true);
3148
+ if (_optionalChain([options, 'optionalAccess', _270 => _270.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
3149
+ const boxes = _chunkKDMAYOWHcjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, true);
3202
3150
  for (let ri = boxes.length - 1; ri >= 0; ri--) blocks.splice(boxes[ri], 1);
3203
3151
  }
3204
3152
  splitContactTables(blocks);
3205
- if (!_optionalChain([options, 'optionalAccess', _277 => _277.keepTrailingEmptyCols])) _chunk7DC2KL3Vcjs.trimTrailingEmptyTableCols.call(void 0, blocks);
3206
- _chunk7DC2KL3Vcjs.joinPageBreakWraps.call(void 0, blocks, wrapLexicon);
3153
+ if (!_optionalChain([options, 'optionalAccess', _271 => _271.keepTrailingEmptyCols])) _chunkKDMAYOWHcjs.trimTrailingEmptyTableCols.call(void 0, blocks);
3154
+ _chunkKDMAYOWHcjs.joinPageBreakWraps.call(void 0, blocks, wrapLexicon);
3207
3155
  injectPageImageBlocks(blocks, pageImageBlocks);
3208
- if (_optionalChain([options, 'optionalAccess', _278 => _278.formulaOcr]) && formulaBuffer) {
3156
+ if (_optionalChain([options, 'optionalAccess', _272 => _272.formulaOcr]) && formulaBuffer) {
3209
3157
  try {
3210
3158
  await applyFormulaOcr(formulaBuffer, blocks, pageFilter, effectivePageCount, warnings, options.onProgress);
3211
3159
  } catch (e) {
@@ -3215,49 +3163,49 @@ async function parsePdfDocument(buffer, options) {
3215
3163
  });
3216
3164
  }
3217
3165
  }
3218
- const medianFontSize = _chunk7DC2KL3Vcjs.computeMedianFontSizeFromFreq.call(void 0, fontSizeFreq);
3166
+ const medianFontSize = _chunkKDMAYOWHcjs.computeMedianFontSizeFromFreq.call(void 0, fontSizeFreq);
3219
3167
  if (medianFontSize > 0) {
3220
- _chunk7DC2KL3Vcjs.detectHeadings.call(void 0, blocks, medianFontSize);
3221
- }
3222
- _chunk7DC2KL3Vcjs.detectDocumentStyleHeadings.call(void 0, blocks);
3223
- _chunk7DC2KL3Vcjs.detectTypographyHeadings.call(void 0, blocks);
3224
- _chunk7DC2KL3Vcjs.detectSiblingStyleHeadings.call(void 0, blocks);
3225
- _chunk7DC2KL3Vcjs.detectRepeatedPageLabels.call(void 0, blocks);
3226
- _chunk7DC2KL3Vcjs.detectPageLeadHeadings.call(void 0, blocks);
3227
- _chunk7DC2KL3Vcjs.mergeStackedHeadingLines.call(void 0, blocks, medianFontSize);
3228
- _chunk7DC2KL3Vcjs.refineDocumentStyleHeadings.call(void 0, blocks);
3229
- _chunk7DC2KL3Vcjs.detectMarkerHeadings.call(void 0, blocks);
3168
+ _chunkKDMAYOWHcjs.detectHeadings.call(void 0, blocks, medianFontSize);
3169
+ }
3170
+ _chunkKDMAYOWHcjs.detectDocumentStyleHeadings.call(void 0, blocks);
3171
+ _chunkKDMAYOWHcjs.detectTypographyHeadings.call(void 0, blocks);
3172
+ _chunkKDMAYOWHcjs.detectSiblingStyleHeadings.call(void 0, blocks);
3173
+ _chunkKDMAYOWHcjs.detectRepeatedPageLabels.call(void 0, blocks);
3174
+ _chunkKDMAYOWHcjs.detectPageLeadHeadings.call(void 0, blocks);
3175
+ _chunkKDMAYOWHcjs.mergeStackedHeadingLines.call(void 0, blocks, medianFontSize);
3176
+ _chunkKDMAYOWHcjs.refineDocumentStyleHeadings.call(void 0, blocks);
3177
+ _chunkKDMAYOWHcjs.detectMarkerHeadings.call(void 0, blocks);
3230
3178
  demoteNonHeadingRoles(blocks, pageHeights, faceNames);
3231
- _chunk7DC2KL3Vcjs.detectTableCaptions.call(void 0, blocks);
3232
- _chunk7DC2KL3Vcjs.detectKoreanListBlocks.call(void 0, blocks);
3179
+ _chunkKDMAYOWHcjs.detectTableCaptions.call(void 0, blocks);
3180
+ _chunkKDMAYOWHcjs.detectKoreanListBlocks.call(void 0, blocks);
3233
3181
  const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
3234
3182
  sanitizeBlockControlChars(blocks);
3235
3183
  let outBlocks = splitSingleCellTables(blocks);
3236
3184
  outBlocks = inlineFootnotes(outBlocks, noteMarks);
3237
3185
  outBlocks = relocateEndnotes(outBlocks);
3238
- if (_optionalChain([options, 'optionalAccess', _279 => _279.removeHeaderFooter]) !== false) outBlocks = outBlocks.filter((b) => {
3186
+ if (_optionalChain([options, 'optionalAccess', _273 => _273.removeHeaderFooter]) !== false) outBlocks = outBlocks.filter((b) => {
3239
3187
  if (b.type !== "paragraph" || !/^\s*\d{1,4}\s*$/.test(_nullishCoalesce(b.text, () => ( "")))) return true;
3240
3188
  const h = pageHeights.get(_nullishCoalesce(b.pageNumber, () => ( 0)));
3241
3189
  if (!b.bbox || !h) return false;
3242
3190
  return b.bbox.y > h * 0.1 && b.bbox.y + b.bbox.height < h * 0.9;
3243
3191
  });
3244
3192
  joinLatinCellWraps(outBlocks);
3245
- if (_optionalChain([options, 'optionalAccess', _280 => _280.layoutTables]) !== "keep") {
3193
+ if (_optionalChain([options, 'optionalAccess', _274 => _274.layoutTables]) !== "keep") {
3246
3194
  const hancom = await isHancomPdf(doc);
3247
3195
  const shown = /* @__PURE__ */ new Map();
3248
3196
  const markContent = (bs) => {
3249
3197
  for (const b of _nullishCoalesce(bs, () => ( []))) if (b.table) for (const row of b.table.cells) for (const c of row) {
3250
- if (_chunk7DC2KL3Vcjs.IMAGE_CELLS.has(c)) _chunkQ5N4YS3Tcjs.CONTENT_CELLS.add(c);
3198
+ if (_chunkKDMAYOWHcjs.IMAGE_CELLS.has(c)) _chunkQGFZU3JEcjs.CONTENT_CELLS.add(c);
3251
3199
  markContent(c.blocks);
3252
3200
  }
3253
3201
  };
3254
3202
  const visual = (bs) => bs.flatMap((b) => {
3255
3203
  if (b.type !== "table") return [b];
3256
- if (!hancom && b.table && _chunk7DC2KL3Vcjs.CLIP_TABLES.has(b.table)) return [b];
3204
+ if (!hancom && b.table && _chunkKDMAYOWHcjs.CLIP_TABLES.has(b.table)) return [b];
3257
3205
  let v = shown.get(b);
3258
3206
  if (!v) {
3259
3207
  markContent([b]);
3260
- shown.set(b, v = _chunkQ5N4YS3Tcjs.unframeLayoutTables.call(void 0, [b], !!_optionalChain([options, 'optionalAccess', _281 => _281.keepTrailingEmptyCols])));
3208
+ shown.set(b, v = _chunkQGFZU3JEcjs.unframeLayoutTables.call(void 0, [b], !!_optionalChain([options, 'optionalAccess', _275 => _275.keepTrailingEmptyCols])));
3261
3209
  }
3262
3210
  return v;
3263
3211
  });
@@ -3266,11 +3214,11 @@ async function parsePdfDocument(buffer, options) {
3266
3214
  blocks.length = 0;
3267
3215
  for (const b of kept) blocks.push(b);
3268
3216
  }
3269
- const finishMarkdown = (bs) => mergeLinkRuns(cleanPdfText(_chunkQ5N4YS3Tcjs.blocksToMarkdown.call(void 0, bs), { keepLoneNumbers: true }));
3217
+ const finishMarkdown = (bs) => mergeLinkRuns(cleanPdfText(_chunkQGFZU3JEcjs.blocksToMarkdown.call(void 0, bs), { keepLoneNumbers: true }));
3270
3218
  let markdown = finishMarkdown(outBlocks);
3271
3219
  return {
3272
3220
  markdown,
3273
- pages: _chunkIXAXI2S3cjs.blocksToPages.call(void 0, outBlocks, finishMarkdown),
3221
+ pages: _chunkW2YYBPW5cjs.blocksToPages.call(void 0, outBlocks, finishMarkdown),
3274
3222
  blocks,
3275
3223
  metadata,
3276
3224
  outline: outline.length > 0 ? outline : void 0,
@@ -3288,7 +3236,7 @@ async function parsePdfDocument(buffer, options) {
3288
3236
  async function extractPdfMetadata(doc, metadata) {
3289
3237
  try {
3290
3238
  const result = await doc.getMetadata();
3291
- if (!_optionalChain([result, 'optionalAccess', _282 => _282.info])) return;
3239
+ if (!_optionalChain([result, 'optionalAccess', _276 => _276.info])) return;
3292
3240
  const info = result.info;
3293
3241
  if (typeof info.Title === "string" && info.Title.trim()) metadata.title = info.Title.trim();
3294
3242
  if (typeof info.Author === "string" && info.Author.trim()) metadata.author = info.Author.trim();
@@ -3304,8 +3252,8 @@ async function extractPdfMetadata(doc, metadata) {
3304
3252
  }
3305
3253
  async function isHancomPdf(doc) {
3306
3254
  try {
3307
- const info = await _asyncOptionalChain([(await doc.getMetadata()), 'optionalAccess', async _283 => _283.info]);
3308
- return [_optionalChain([info, 'optionalAccess', _284 => _284.Producer]), _optionalChain([info, 'optionalAccess', _285 => _285.Creator])].some((v) => typeof v === "string" && /^\s*(?:hancom\b|hwp\b)/i.test(v));
3255
+ const info = await _asyncOptionalChain([(await doc.getMetadata()), 'optionalAccess', async _277 => _277.info]);
3256
+ return [_optionalChain([info, 'optionalAccess', _278 => _278.Producer]), _optionalChain([info, 'optionalAccess', _279 => _279.Creator])].some((v) => typeof v === "string" && /^\s*(?:hancom\b|hwp\b)/i.test(v));
3309
3257
  } catch (e8) {
3310
3258
  return false;
3311
3259
  }
@@ -3348,5 +3296,5 @@ function marginStamp(items) {
3348
3296
 
3349
3297
 
3350
3298
 
3351
- exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks = _chunk7DC2KL3Vcjs.detectKoreanListBlocks; exports.detectTableCaptions = _chunk7DC2KL3Vcjs.detectTableCaptions; exports.extractPdfMetadataOnly = extractPdfMetadataOnly; exports.mergeCrossPageTables = mergeCrossPageTables; exports.ocrImageRegions = ocrImageRegions; exports.parsePdfDocument = parsePdfDocument; exports.removeHeaderFooterBlocks = _chunk7DC2KL3Vcjs.removeHeaderFooterBlocks;
3352
- //# sourceMappingURL=parser-PJUZSMFR.cjs.map
3299
+ exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks = _chunkKDMAYOWHcjs.detectKoreanListBlocks; exports.detectTableCaptions = _chunkKDMAYOWHcjs.detectTableCaptions; exports.extractPdfMetadataOnly = extractPdfMetadataOnly; exports.mergeCrossPageTables = mergeCrossPageTables; exports.ocrImageRegions = ocrImageRegions; exports.parsePdfDocument = parsePdfDocument; exports.removeHeaderFooterBlocks = _chunkKDMAYOWHcjs.removeHeaderFooterBlocks;
3300
+ //# sourceMappingURL=parser-7KECZTTP.cjs.map