kordoc 4.17.2 → 4.17.3
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.
- package/dist/{-2UA2JHVA.js → -WP4ZCXHV.js} +11 -11
- package/dist/{chunk-HAW2VL62.cjs → chunk-2VMTMIGD.cjs} +12 -12
- package/dist/{chunk-HAW2VL62.cjs.map → chunk-2VMTMIGD.cjs.map} +1 -1
- package/dist/{chunk-5JZEY5IL.js → chunk-4PY2V33D.js} +2 -2
- package/dist/{chunk-A2W2JQ3S.js → chunk-5BDNDGUI.js} +2 -2
- package/dist/{chunk-O4CB7D2Q.js → chunk-5HIJXVED.js} +2 -2
- package/dist/chunk-BAEABKCB.js +170 -0
- package/dist/chunk-BAEABKCB.js.map +1 -0
- package/dist/{chunk-WJLICIYV.js → chunk-C3MC7HOB.js} +24 -21
- package/dist/{chunk-WJLICIYV.js.map → chunk-C3MC7HOB.js.map} +1 -1
- package/dist/{chunk-JY2NBFIG.js → chunk-CKF5HTM6.js} +6 -6
- package/dist/{chunk-YGKC6E6A.js → chunk-DPMDJYHX.js} +2 -2
- package/dist/chunk-DUHHMIPS.cjs +170 -0
- package/dist/chunk-DUHHMIPS.cjs.map +1 -0
- package/dist/{chunk-6OCKAXIS.js → chunk-EM2J3MAE.js} +2 -2
- package/dist/{chunk-GPC72VSF.cjs → chunk-HNPRQKLZ.cjs} +262 -171
- package/dist/chunk-HNPRQKLZ.cjs.map +1 -0
- package/dist/{chunk-MDCTITUG.js → chunk-JNCWHGJG.js} +2 -2
- package/dist/{chunk-C4MVZXB5.js → chunk-JORDNRVS.js} +2 -2
- package/dist/{chunk-ZDX5PIWR.js → chunk-JPQNRW7C.js} +2 -2
- package/dist/{chunk-WWMKIHF7.cjs → chunk-K2GXTJPK.cjs} +21 -21
- package/dist/{chunk-WWMKIHF7.cjs.map → chunk-K2GXTJPK.cjs.map} +1 -1
- package/dist/{chunk-4TSYMJDL.js → chunk-K7W5L4GI.js} +3 -3
- package/dist/{chunk-FGL4IGOT.js → chunk-OOUW3ROZ.js} +4 -4
- package/dist/{chunk-2XHXABCX.js → chunk-Q7SPGAAA.js} +2 -2
- package/dist/{chunk-XZA6X34R.js → chunk-TOPQ7T4N.js} +2 -2
- package/dist/{chunk-4HRJISJF.js → chunk-TTSXZO2A.js} +3 -3
- package/dist/{chunk-SDRKHEVT.js → chunk-UHGWEWZI.js} +255 -164
- package/dist/chunk-UHGWEWZI.js.map +1 -0
- package/dist/{chunk-VU26WGE5.js → chunk-UJZABAVA.js} +10 -10
- package/dist/{chunk-WL3BWROT.js → chunk-UTKVDI22.js} +22 -12
- package/dist/chunk-UTKVDI22.js.map +1 -0
- package/dist/{chunk-3N272C5L.js → chunk-VNDVI3MJ.js} +4 -4
- package/dist/{chunk-KQIYC2ZU.js → chunk-WFXZRYFS.js} +2 -2
- package/dist/{chunk-GYTL6WT3.js → chunk-YDWHS7FP.js} +3 -3
- package/dist/{chunk-6DOCSYEM.cjs → chunk-YKL7GP7E.cjs} +3 -3
- package/dist/{chunk-6DOCSYEM.cjs.map → chunk-YKL7GP7E.cjs.map} +1 -1
- package/dist/{chunk-KZVQK5NS.cjs → chunk-ZWPINXUX.cjs} +2 -2
- package/dist/{chunk-KZVQK5NS.cjs.map → chunk-ZWPINXUX.cjs.map} +1 -1
- package/dist/chunks-S7XODMX4.js +10 -0
- package/dist/cli.js +26 -26
- package/dist/{formula-MBLN2DG4.js → formula-H2NAOQHD.js} +4 -4
- package/dist/{formula-QZZDW5GW.js → formula-NZ7G4AXC.js} +3 -3
- package/dist/{formula-5RETDCIC.cjs → formula-Y3L3RPPI.cjs} +9 -9
- package/dist/{formula-5RETDCIC.cjs.map → formula-Y3L3RPPI.cjs.map} +1 -1
- package/dist/{image-ocr-EREKAS47.js → image-ocr-BGMQPELF.js} +6 -6
- package/dist/{image-ocr-PSPVRLB5.cjs → image-ocr-QYLWWB7R.cjs} +15 -15
- package/dist/{image-ocr-PSPVRLB5.cjs.map → image-ocr-QYLWWB7R.cjs.map} +1 -1
- package/dist/{image-ocr-CJSO3QSR.js → image-ocr-UTSJ2Q4Q.js} +9 -8
- package/dist/{image-ocr-CJSO3QSR.js.map → image-ocr-UTSJ2Q4Q.js.map} +1 -1
- package/dist/index.cjs +259 -259
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -16
- package/dist/mcp.js +22 -22
- package/dist/{model-bundle-MA4MMCRJ.js → model-bundle-QHZYIAUP.js} +5 -5
- package/dist/{models-SEJ7LNSN.js → models-MCBWWGBX.js} +5 -5
- package/dist/{parser-M5WHRX25.js → parser-72NGANOD.js} +11 -11
- package/dist/{parser-QILYPWSI.cjs → parser-BEPVGAMI.cjs} +114 -114
- package/dist/{parser-QILYPWSI.cjs.map → parser-BEPVGAMI.cjs.map} +1 -1
- package/dist/{parser-VH3F4EQU.js → parser-IGTNLJ6E.js} +12 -12
- package/dist/pdf-ocr-BW6RUT4H.cjs +16 -0
- package/dist/{pdf-ocr-3SZUM3CN.cjs.map → pdf-ocr-BW6RUT4H.cjs.map} +1 -1
- package/dist/pdf-ocr-EWG24RNY.js +15 -0
- package/dist/pdf-ocr-TCDSJFQT.js +19 -0
- package/dist/{profile-io-5YB627EO.js → profile-io-H2BCBNRL.js} +3 -3
- package/dist/{rasterize-V2XHHS2I.js → rasterize-HIEA3MGV.js} +3 -3
- package/dist/{redact-doc-5MK5L5IQ.js → redact-doc-MHIY4AWT.js} +11 -11
- package/dist/{render-SYZMHYK6.js → render-NIX6VP3C.js} +7 -7
- package/dist/seal-QTCJFT7G.js +10 -0
- package/dist/{setup-ZPLJENSK.js → setup-DU5WIHAX.js} +3 -3
- package/dist/visual-TU2BS63P.js +20 -0
- package/dist/{watch-FNWHVKK3.js → watch-XW6CSLL7.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-GPC72VSF.cjs.map +0 -1
- package/dist/chunk-SDRKHEVT.js.map +0 -1
- package/dist/chunk-UX3HHAWH.js +0 -248
- package/dist/chunk-UX3HHAWH.js.map +0 -1
- package/dist/chunk-WL3BWROT.js.map +0 -1
- package/dist/chunk-YIANW5QX.cjs +0 -248
- package/dist/chunk-YIANW5QX.cjs.map +0 -1
- package/dist/chunks-EBWJR55V.js +0 -10
- package/dist/pdf-ocr-3SZUM3CN.cjs +0 -16
- package/dist/pdf-ocr-QB2TB5W5.js +0 -18
- package/dist/pdf-ocr-XC33L43D.js +0 -15
- package/dist/seal-IPKIQHYB.js +0 -10
- package/dist/visual-RTTGNOAE.js +0 -20
- /package/dist/{-2UA2JHVA.js.map → -WP4ZCXHV.js.map} +0 -0
- /package/dist/{chunk-5JZEY5IL.js.map → chunk-4PY2V33D.js.map} +0 -0
- /package/dist/{chunk-A2W2JQ3S.js.map → chunk-5BDNDGUI.js.map} +0 -0
- /package/dist/{chunk-O4CB7D2Q.js.map → chunk-5HIJXVED.js.map} +0 -0
- /package/dist/{chunk-JY2NBFIG.js.map → chunk-CKF5HTM6.js.map} +0 -0
- /package/dist/{chunk-YGKC6E6A.js.map → chunk-DPMDJYHX.js.map} +0 -0
- /package/dist/{chunk-6OCKAXIS.js.map → chunk-EM2J3MAE.js.map} +0 -0
- /package/dist/{chunk-MDCTITUG.js.map → chunk-JNCWHGJG.js.map} +0 -0
- /package/dist/{chunk-C4MVZXB5.js.map → chunk-JORDNRVS.js.map} +0 -0
- /package/dist/{chunk-ZDX5PIWR.js.map → chunk-JPQNRW7C.js.map} +0 -0
- /package/dist/{chunk-4TSYMJDL.js.map → chunk-K7W5L4GI.js.map} +0 -0
- /package/dist/{chunk-FGL4IGOT.js.map → chunk-OOUW3ROZ.js.map} +0 -0
- /package/dist/{chunk-2XHXABCX.js.map → chunk-Q7SPGAAA.js.map} +0 -0
- /package/dist/{chunk-XZA6X34R.js.map → chunk-TOPQ7T4N.js.map} +0 -0
- /package/dist/{chunk-4HRJISJF.js.map → chunk-TTSXZO2A.js.map} +0 -0
- /package/dist/{chunk-VU26WGE5.js.map → chunk-UJZABAVA.js.map} +0 -0
- /package/dist/{chunk-3N272C5L.js.map → chunk-VNDVI3MJ.js.map} +0 -0
- /package/dist/{chunk-KQIYC2ZU.js.map → chunk-WFXZRYFS.js.map} +0 -0
- /package/dist/{chunk-GYTL6WT3.js.map → chunk-YDWHS7FP.js.map} +0 -0
- /package/dist/{chunks-EBWJR55V.js.map → chunks-S7XODMX4.js.map} +0 -0
- /package/dist/{formula-MBLN2DG4.js.map → formula-H2NAOQHD.js.map} +0 -0
- /package/dist/{formula-QZZDW5GW.js.map → formula-NZ7G4AXC.js.map} +0 -0
- /package/dist/{image-ocr-EREKAS47.js.map → image-ocr-BGMQPELF.js.map} +0 -0
- /package/dist/{model-bundle-MA4MMCRJ.js.map → model-bundle-QHZYIAUP.js.map} +0 -0
- /package/dist/{models-SEJ7LNSN.js.map → models-MCBWWGBX.js.map} +0 -0
- /package/dist/{parser-M5WHRX25.js.map → parser-72NGANOD.js.map} +0 -0
- /package/dist/{parser-VH3F4EQU.js.map → parser-IGTNLJ6E.js.map} +0 -0
- /package/dist/{pdf-ocr-QB2TB5W5.js.map → pdf-ocr-EWG24RNY.js.map} +0 -0
- /package/dist/{pdf-ocr-XC33L43D.js.map → pdf-ocr-TCDSJFQT.js.map} +0 -0
- /package/dist/{profile-io-5YB627EO.js.map → profile-io-H2BCBNRL.js.map} +0 -0
- /package/dist/{rasterize-V2XHHS2I.js.map → rasterize-HIEA3MGV.js.map} +0 -0
- /package/dist/{redact-doc-5MK5L5IQ.js.map → redact-doc-MHIY4AWT.js.map} +0 -0
- /package/dist/{render-SYZMHYK6.js.map → render-NIX6VP3C.js.map} +0 -0
- /package/dist/{seal-IPKIQHYB.js.map → seal-QTCJFT7G.js.map} +0 -0
- /package/dist/{setup-ZPLJENSK.js.map → setup-DU5WIHAX.js.map} +0 -0
- /package/dist/{visual-RTTGNOAE.js.map → visual-TU2BS63P.js.map} +0 -0
- /package/dist/{watch-FNWHVKK3.js.map → watch-XW6CSLL7.js.map} +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
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 _chunkDUHHMIPScjs = require('./chunk-DUHHMIPS.cjs');
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
|
|
7
|
-
var
|
|
8
|
+
var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
|
|
11
|
-
var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
@@ -47,21 +47,21 @@ var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
|
|
50
|
+
var _chunkK2GXTJPKcjs = require('./chunk-K2GXTJPK.cjs');
|
|
50
51
|
|
|
51
52
|
|
|
52
53
|
|
|
53
|
-
var _chunkWWMKIHF7cjs = require('./chunk-WWMKIHF7.cjs');
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
var
|
|
60
|
-
require('./chunk-
|
|
59
|
+
var _chunkHNPRQKLZcjs = require('./chunk-HNPRQKLZ.cjs');
|
|
60
|
+
require('./chunk-YKL7GP7E.cjs');
|
|
61
61
|
|
|
62
62
|
|
|
63
63
|
|
|
64
|
-
var
|
|
64
|
+
var _chunkZWPINXUXcjs = require('./chunk-ZWPINXUX.cjs');
|
|
65
65
|
|
|
66
66
|
|
|
67
67
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
@@ -255,7 +255,7 @@ async function extractPageImages(page, fnArray, argsArray, pageNumber, state, wa
|
|
|
255
255
|
const filename = `image_${String(state.imageIndex).padStart(3, "0")}.png`;
|
|
256
256
|
state.seen.set(hash, filename);
|
|
257
257
|
if (withBytes) {
|
|
258
|
-
const png =
|
|
258
|
+
const png = _chunkDUHHMIPScjs.encodePng.call(void 0, w, h, rgba);
|
|
259
259
|
state.totalBytes += png.length;
|
|
260
260
|
images.push({ filename, data: png, mimeType: "image/png" });
|
|
261
261
|
}
|
|
@@ -770,19 +770,19 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
770
770
|
if (r + dr < rows) owner[r + dr][dc] = placed;
|
|
771
771
|
}
|
|
772
772
|
grid[r][c1] = { ...a.cell, colSpan: c2 - c1, rowSpan: a.rs };
|
|
773
|
-
const lines =
|
|
774
|
-
if (lines)
|
|
775
|
-
if (
|
|
776
|
-
const edges =
|
|
773
|
+
const lines = _chunkK2GXTJPKcjs.CELL_LINES.get(a.cell);
|
|
774
|
+
if (lines) _chunkK2GXTJPKcjs.CELL_LINES.set(grid[r][c1], shift ? lines.map((l) => ({ ...l, l: l.l + shift, r: l.r + shift })) : lines);
|
|
775
|
+
if (_chunkK2GXTJPKcjs.IMAGE_CELLS.has(a.cell)) _chunkK2GXTJPKcjs.IMAGE_CELLS.add(grid[r][c1]);
|
|
776
|
+
const edges = _chunkHNPRQKLZcjs.CELL_EDGES.get(a.cell);
|
|
777
777
|
if (edges) {
|
|
778
|
-
|
|
778
|
+
_chunkHNPRQKLZcjs.CELL_EDGES.set(grid[r][c1], edges);
|
|
779
779
|
edged = true;
|
|
780
780
|
}
|
|
781
781
|
return true;
|
|
782
782
|
};
|
|
783
|
-
for (const a of pa) if (!
|
|
783
|
+
for (const a of pa) if (!_chunkK2GXTJPKcjs.FILLER_CELLS.has(a.cell) && !place(a, pcx, 0)) return null;
|
|
784
784
|
for (const a of ca) {
|
|
785
|
-
if (a.r < skip ||
|
|
785
|
+
if (a.r < skip || _chunkK2GXTJPKcjs.FILLER_CELLS.has(a.cell)) continue;
|
|
786
786
|
if (!place(a, cxU, prev.rows - skip, dx)) return null;
|
|
787
787
|
}
|
|
788
788
|
const first = prev.rows;
|
|
@@ -806,9 +806,9 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
806
806
|
const grown = { ...above, rs: newRs };
|
|
807
807
|
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
808
|
}
|
|
809
|
-
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null)
|
|
809
|
+
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkK2GXTJPKcjs.FILLER_CELLS.add(grid[r][c]);
|
|
810
810
|
if (edged) {
|
|
811
|
-
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null)
|
|
811
|
+
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) if (owner[r][c] === null) _chunkHNPRQKLZcjs.CELL_EDGES.set(grid[r][c], _chunkK2GXTJPKcjs.NO_EDGES);
|
|
812
812
|
}
|
|
813
813
|
for (let c = 0; c < cols && U[c + 1] <= pcx[0] + PART_COL_TOL; c++) {
|
|
814
814
|
let r = prev.rows;
|
|
@@ -817,7 +817,7 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
817
817
|
for (let rr = 0; rr < r; rr++) owner[rr][c] = through;
|
|
818
818
|
}
|
|
819
819
|
const table = { rows, cols, cells: grid, hasHeader: prev.hasHeader, ...prev.caption ? { caption: prev.caption } : {} };
|
|
820
|
-
const pr =
|
|
820
|
+
const pr = _chunkK2GXTJPKcjs.ROW_RULES.get(prev), cr = _chunkK2GXTJPKcjs.ROW_RULES.get(curr);
|
|
821
821
|
const shifted = dx !== 0;
|
|
822
822
|
const cut = {
|
|
823
823
|
open: !!pr && !!cr && !pr.bottom && !cr.top && pr.innerOpen + cr.innerOpen === 0 && pr.innerRuled + cr.innerRuled > 0,
|
|
@@ -828,7 +828,7 @@ function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
|
828
828
|
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
829
|
if (pr && cr) {
|
|
830
830
|
const cutRuled = pr.bottom || cr.top;
|
|
831
|
-
|
|
831
|
+
_chunkK2GXTJPKcjs.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
832
|
}
|
|
833
833
|
return { table, colXs: U, split, header: ca.filter((a) => a.r < skip && a.cell.text.trim()).length >= 2 };
|
|
834
834
|
}
|
|
@@ -882,7 +882,7 @@ function mergeStraddlingCells(table, owner, first, prevBottom, lex, colXs) {
|
|
|
882
882
|
if (!crossed.has(shape(u, d)) && !(u.rs >= 2 && u.c + u.cs <= firstNew && hasContent(a) && !hasContent(b))) {
|
|
883
883
|
if (!straddles && !midWord) continue;
|
|
884
884
|
if (u.r >= last && d.rs < 2) continue;
|
|
885
|
-
const U =
|
|
885
|
+
const U = _chunkK2GXTJPKcjs.CELL_LINES.get(a);
|
|
886
886
|
if (!_optionalChain([U, 'optionalAccess', _33 => _33.length]) || !hasContent(b)) continue;
|
|
887
887
|
if (!(straddles && filledToBottom(U, prevBottom) && clauseContinues(a, b))) {
|
|
888
888
|
if (U.length > STRADDLE_MAX_LINES) continue;
|
|
@@ -918,7 +918,7 @@ var LABEL_ROOM = 1.5;
|
|
|
918
918
|
var HANGING_MIN = 0.5;
|
|
919
919
|
var HANGING_TOL = 1;
|
|
920
920
|
function continuesAcross(u, d, x1, x2) {
|
|
921
|
-
const U =
|
|
921
|
+
const U = _chunkK2GXTJPKcjs.CELL_LINES.get(u), D = _chunkK2GXTJPKcjs.CELL_LINES.get(d);
|
|
922
922
|
if (!_optionalChain([U, 'optionalAccess', _34 => _34.length]) || !_optionalChain([D, 'optionalAccess', _35 => _35.length])) return false;
|
|
923
923
|
const last = U[U.length - 1];
|
|
924
924
|
const fs = last.h || 10;
|
|
@@ -936,7 +936,7 @@ function continuesAcross(u, d, x1, x2) {
|
|
|
936
936
|
if (U.length === 1 && x2 - last.r > Math.max(FULL_LINE_EDGE_MIN, SINGLE_LINE_WORD_GAP * fs)) return false;
|
|
937
937
|
const indented = last.l - minL >= HANGING_MIN * fs;
|
|
938
938
|
if (last.r - last.l < FULL_LINE_MIN_FRAC * (indented ? x2 - last.l : x2 - x1)) return false;
|
|
939
|
-
const newItem =
|
|
939
|
+
const newItem = _chunkK2GXTJPKcjs.startsNewItem.call(void 0, u.text, d.text);
|
|
940
940
|
const all = D.length ? U.concat(D) : U;
|
|
941
941
|
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
942
|
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 +953,10 @@ function outlineContinues(u, d) {
|
|
|
953
953
|
return U.length >= 2 && D.length >= 1 && U.some((l) => OUTLINE_HEAD.test(l)) && OUTLINE_ITEM.test(D[0]);
|
|
954
954
|
}
|
|
955
955
|
function lineEnded(c, x1, x2, next) {
|
|
956
|
-
const L =
|
|
956
|
+
const L = _chunkK2GXTJPKcjs.CELL_LINES.get(c);
|
|
957
957
|
if (!L || L.length !== 1) return false;
|
|
958
958
|
const l = L[0], h = l.h || 10;
|
|
959
|
-
const d0 = next ? _optionalChain([
|
|
959
|
+
const d0 = next ? _optionalChain([_chunkK2GXTJPKcjs.CELL_LINES, 'access', _36 => _36.get, 'call', _37 => _37(next), 'optionalAccess', _38 => _38[0]]) : void 0;
|
|
960
960
|
if (d0 && d0.l - l.l >= HANGING_MIN * h) return false;
|
|
961
961
|
return x2 - l.r - (l.l - x1) >= Math.max(LABEL_ROOM, firstWordUnits(_nullishCoalesce(_optionalChain([next, 'optionalAccess', _39 => _39.text]), () => ( "")))) * h;
|
|
962
962
|
}
|
|
@@ -972,9 +972,9 @@ function appendCell(a, b) {
|
|
|
972
972
|
a.blocks = [...asBlocks(a), ...asBlocks(b)];
|
|
973
973
|
}
|
|
974
974
|
if (b.text.trim()) a.text = a.text.trim() ? a.text + "\n" + b.text : b.text;
|
|
975
|
-
|
|
975
|
+
_chunkK2GXTJPKcjs.joinCellEdges.call(void 0, a, b);
|
|
976
976
|
}
|
|
977
|
-
var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _46 => _46.blocks, 'optionalAccess', _47 => _47.length]) ||
|
|
977
|
+
var hasContent = (cell) => !!cell.text.trim() || !!_optionalChain([cell, 'access', _46 => _46.blocks, 'optionalAccess', _47 => _47.length]) || _chunkK2GXTJPKcjs.IMAGE_CELLS.has(cell);
|
|
978
978
|
var CLAUSE_OPEN_ENDING = /(?:하는|되는|하고|하며|하여|되어|되고|되며|이며|으며|어야|아야|여야)$/;
|
|
979
979
|
var batchim = (ch) => {
|
|
980
980
|
const k = ch.charCodeAt(0) - 44032;
|
|
@@ -982,13 +982,13 @@ var batchim = (ch) => {
|
|
|
982
982
|
};
|
|
983
983
|
function clauseContinues(u, d) {
|
|
984
984
|
const tail = _nullishCoalesce(flowText(u.text).trim().split(/\s+/).pop(), () => ( "")), head = flowText(d.text).trim();
|
|
985
|
-
if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) ||
|
|
985
|
+
if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) || _chunkK2GXTJPKcjs.startsNewItem.call(void 0, u.text, head)) return false;
|
|
986
986
|
const last = tail[tail.length - 1], before = tail[tail.length - 2];
|
|
987
987
|
return last === "\uC744" && batchim(before) || last === "\uB97C" && !batchim(before) || CLAUSE_OPEN_ENDING.test(tail);
|
|
988
988
|
}
|
|
989
989
|
function wordOverflows(u, d, x1, x2) {
|
|
990
|
-
const U =
|
|
991
|
-
if (!_optionalChain([U, 'optionalAccess', _48 => _48.length]) ||
|
|
990
|
+
const U = _chunkK2GXTJPKcjs.CELL_LINES.get(u);
|
|
991
|
+
if (!_optionalChain([U, 'optionalAccess', _48 => _48.length]) || _chunkK2GXTJPKcjs.startsNewItem.call(void 0, u.text, d.text)) return false;
|
|
992
992
|
const last = U[U.length - 1], units = firstWordUnits(d.text);
|
|
993
993
|
return units > 0 && last.r - last.l + units * (last.h || 10) > x2 - x1;
|
|
994
994
|
}
|
|
@@ -1121,19 +1121,19 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
|
|
|
1121
1121
|
placeJoined(blocks, i, j, joined);
|
|
1122
1122
|
continue;
|
|
1123
1123
|
}
|
|
1124
|
-
if (
|
|
1124
|
+
if (_chunkK2GXTJPKcjs.EMPTY_PARTS.has(curr.table)) {
|
|
1125
1125
|
blocks.splice(j, 1);
|
|
1126
1126
|
i++;
|
|
1127
1127
|
continue;
|
|
1128
1128
|
}
|
|
1129
1129
|
if (joined === null) continue;
|
|
1130
|
-
if (prev.table.cols !== curr.table.cols || prev.table.renderAsTable !== curr.table.renderAsTable ||
|
|
1130
|
+
if (prev.table.cols !== curr.table.cols || prev.table.renderAsTable !== curr.table.renderAsTable || _chunkK2GXTJPKcjs.EMPTY_PARTS.has(prev.table)) continue;
|
|
1131
1131
|
const width = Math.max(prev.bbox.width, curr.bbox.width, 1);
|
|
1132
1132
|
const leftDiff = Math.abs(prev.bbox.x - curr.bbox.x);
|
|
1133
1133
|
const rightDiff = Math.abs(prev.bbox.x + prev.bbox.width - (curr.bbox.x + curr.bbox.width));
|
|
1134
1134
|
if (leftDiff > width * NEIGHBOR_TABLE_EPSILON || rightDiff > width * NEIGHBOR_TABLE_EPSILON) continue;
|
|
1135
|
-
const px =
|
|
1136
|
-
if (px && cx && !shiftedSame(px, cx, !
|
|
1135
|
+
const px = _chunkK2GXTJPKcjs.TABLE_COLXS.get(prev.table), cx = _chunkK2GXTJPKcjs.TABLE_COLXS.get(curr.table);
|
|
1136
|
+
if (px && cx && !shiftedSame(px, cx, !_chunkK2GXTJPKcjs.CLIP_TABLES.has(prev.table) && !_chunkK2GXTJPKcjs.CLIP_TABLES.has(curr.table))) continue;
|
|
1137
1137
|
if (!rowTextsEqual(prev.table.cells[0], curr.table.cells[0]) && sameHeadShape(prev.table.cells[0], curr.table.cells[0])) continue;
|
|
1138
1138
|
let currCells = curr.table.cells;
|
|
1139
1139
|
if (currCells.length > 1 && prev.table.cells.length > 0 && rowTextsEqual(prev.table.cells[0], currCells[0])) {
|
|
@@ -1143,16 +1143,16 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
|
|
|
1143
1143
|
blocks.splice(j, 1);
|
|
1144
1144
|
continue;
|
|
1145
1145
|
}
|
|
1146
|
-
if (px && cx && !
|
|
1146
|
+
if (px && cx && !_chunkK2GXTJPKcjs.CLIP_TABLES.has(prev.table) && !_chunkK2GXTJPKcjs.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 && _chunkK2GXTJPKcjs.CELL_LINES.has(c))) {
|
|
1147
1147
|
const dx = px[0] - cx[0];
|
|
1148
1148
|
const part = joinSplitParts(prev.table, px, curr.table, cx.map((x) => x + dx), dx, void 0, lex);
|
|
1149
1149
|
if (_optionalChain([part, 'optionalAccess', _61 => _61.split]) && part.table.rows === prev.table.rows + currCells.length - 1) {
|
|
1150
1150
|
const last = prev.table.rows - 1;
|
|
1151
1151
|
for (let c = 0; c < part.table.cols; c++) {
|
|
1152
|
-
const U =
|
|
1153
|
-
|
|
1152
|
+
const U = _chunkK2GXTJPKcjs.CELL_LINES.get(prev.table.cells[last][c]), D = _chunkK2GXTJPKcjs.CELL_LINES.get(currCells[0][c]);
|
|
1153
|
+
_chunkK2GXTJPKcjs.CELL_LINES.set(part.table.cells[last][c], U.concat(D.map((l) => ({ ...l, l: l.l + dx, r: l.r + dx }))));
|
|
1154
1154
|
}
|
|
1155
|
-
|
|
1155
|
+
_chunkK2GXTJPKcjs.TABLE_COLXS.set(part.table, part.colXs);
|
|
1156
1156
|
placeJoined(blocks, i, j, part.table);
|
|
1157
1157
|
continue;
|
|
1158
1158
|
}
|
|
@@ -1165,20 +1165,20 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
|
|
|
1165
1165
|
caption: prev.table.caption,
|
|
1166
1166
|
...prev.table.renderAsTable ? { renderAsTable: true } : {}
|
|
1167
1167
|
};
|
|
1168
|
-
if (_nullishCoalesce(px, () => ( cx)))
|
|
1169
|
-
if (
|
|
1168
|
+
if (_nullishCoalesce(px, () => ( cx))) _chunkK2GXTJPKcjs.TABLE_COLXS.set(merged, _nullishCoalesce(px, () => ( cx)));
|
|
1169
|
+
if (_chunkK2GXTJPKcjs.CLIP_TABLES.has(prev.table) || _chunkK2GXTJPKcjs.CLIP_TABLES.has(curr.table)) _chunkK2GXTJPKcjs.CLIP_TABLES.add(merged);
|
|
1170
1170
|
placeJoined(blocks, i, j, merged);
|
|
1171
1171
|
}
|
|
1172
1172
|
for (let i = blocks.length - 1; i >= 0; i--) {
|
|
1173
1173
|
const t = blocks[i].table;
|
|
1174
|
-
if (blocks[i].type === "table" && t &&
|
|
1174
|
+
if (blocks[i].type === "table" && t && _chunkK2GXTJPKcjs.EMPTY_PARTS.has(t)) blocks.splice(i, 1);
|
|
1175
1175
|
}
|
|
1176
1176
|
}
|
|
1177
1177
|
function mergeColumnFlow(blocks, pageHeights, lex) {
|
|
1178
1178
|
if (!pageHeights) return;
|
|
1179
1179
|
for (let i = 0; i < blocks.length; i++) {
|
|
1180
1180
|
const L = blocks[i];
|
|
1181
|
-
if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !
|
|
1181
|
+
if (L.type !== "table" || !L.table || !L.bbox || !L.pageNumber || !_chunkK2GXTJPKcjs.CLIP_TABLES.has(L.table) || _chunkK2GXTJPKcjs.EMPTY_PARTS.has(L.table)) continue;
|
|
1182
1182
|
const ph = pageHeights.get(L.pageNumber);
|
|
1183
1183
|
if (!ph || L.bbox.y > ph * PAGE_EDGE_BAND) continue;
|
|
1184
1184
|
let s0 = i, s1 = i;
|
|
@@ -1207,8 +1207,8 @@ function mergeColumnFlow(blocks, pageHeights, lex) {
|
|
|
1207
1207
|
}
|
|
1208
1208
|
function joinClipParts(prev, curr, pageHeights, lex) {
|
|
1209
1209
|
const pt = prev.table, ct = curr.table;
|
|
1210
|
-
if (!
|
|
1211
|
-
const px =
|
|
1210
|
+
if (!_chunkK2GXTJPKcjs.CLIP_TABLES.has(pt) || !_chunkK2GXTJPKcjs.CLIP_TABLES.has(ct)) return null;
|
|
1211
|
+
const px = _chunkK2GXTJPKcjs.TABLE_COLXS.get(pt), cx = _chunkK2GXTJPKcjs.TABLE_COLXS.get(ct);
|
|
1212
1212
|
if (!px || !cx) return null;
|
|
1213
1213
|
let xs = cx, shifted = false, dx = 0, foreign = false, within = false;
|
|
1214
1214
|
if (!shiftedSame(px, cx, false)) {
|
|
@@ -1224,15 +1224,15 @@ function joinClipParts(prev, curr, pageHeights, lex) {
|
|
|
1224
1224
|
const inner = b.slice(1, -1).map((x) => x + dx);
|
|
1225
1225
|
return inner.length > 0 && !inner.some((x) => px.some((p) => Math.abs(p - x) <= CONTINUATION_COL_TOL));
|
|
1226
1226
|
};
|
|
1227
|
-
foreign = unrelated(cx) && unrelated(_nullishCoalesce(
|
|
1227
|
+
foreign = unrelated(cx) && unrelated(_nullishCoalesce(_chunkK2GXTJPKcjs.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);
|
|
1228
1228
|
}
|
|
1229
1229
|
const res = joinSplitParts(pt, px, ct, xs, dx, _optionalChain([prev, 'access', _66 => _66.bbox, 'optionalAccess', _67 => _67.y]), lex);
|
|
1230
1230
|
if (!res || (shifted || foreign || within) && !res.split && !res.header) return null;
|
|
1231
|
-
|
|
1232
|
-
const ys =
|
|
1233
|
-
if (ys)
|
|
1234
|
-
|
|
1235
|
-
|
|
1231
|
+
_chunkK2GXTJPKcjs.TABLE_COLXS.set(res.table, res.colXs);
|
|
1232
|
+
const ys = _chunkK2GXTJPKcjs.TABLE_ROWYS.get(pt);
|
|
1233
|
+
if (ys) _chunkK2GXTJPKcjs.TABLE_ROWYS.set(res.table, ys);
|
|
1234
|
+
_chunkK2GXTJPKcjs.PART_COLXS.set(res.table, _nullishCoalesce(_chunkK2GXTJPKcjs.PART_COLXS.get(pt), () => ( px)));
|
|
1235
|
+
_chunkK2GXTJPKcjs.CLIP_TABLES.add(res.table);
|
|
1236
1236
|
return res.table;
|
|
1237
1237
|
}
|
|
1238
1238
|
function prevLacksLeftCols(prev, px, xs, pageHeights) {
|
|
@@ -1256,12 +1256,12 @@ function looksContinued(prev, curr, pageHeights) {
|
|
|
1256
1256
|
return filled.length >= 2 && filled.every((t) => t === filled[0]);
|
|
1257
1257
|
}
|
|
1258
1258
|
function pushedLead(prev, curr) {
|
|
1259
|
-
if (!
|
|
1259
|
+
if (!_chunkK2GXTJPKcjs.CLIP_TABLES.has(prev.table) || !_chunkK2GXTJPKcjs.CLIP_TABLES.has(curr.table)) return false;
|
|
1260
1260
|
const lead = leadRows(curr.table);
|
|
1261
1261
|
return lead.image && lead.height > prev.bbox.y;
|
|
1262
1262
|
}
|
|
1263
1263
|
function leadRows(t) {
|
|
1264
|
-
const ys =
|
|
1264
|
+
const ys = _chunkK2GXTJPKcjs.TABLE_ROWYS.get(t);
|
|
1265
1265
|
if (!ys || ys.length < 2) return { height: 0, image: false };
|
|
1266
1266
|
const anchors = anchorsOf(t);
|
|
1267
1267
|
let end = 1, image = false;
|
|
@@ -1269,17 +1269,17 @@ function leadRows(t) {
|
|
|
1269
1269
|
for (const a of anchors) {
|
|
1270
1270
|
if (a.r !== r) continue;
|
|
1271
1271
|
end = Math.max(end, r + a.rs);
|
|
1272
|
-
if (
|
|
1272
|
+
if (_chunkK2GXTJPKcjs.IMAGE_CELLS.has(a.cell)) image = true;
|
|
1273
1273
|
}
|
|
1274
1274
|
}
|
|
1275
1275
|
return { height: ys[0] - ys[Math.min(end, ys.length - 1)], image };
|
|
1276
1276
|
}
|
|
1277
1277
|
function tailOf(b) {
|
|
1278
|
-
const t = b.table &&
|
|
1278
|
+
const t = b.table && _chunkK2GXTJPKcjs.TABLE_TAIL.get(b.table);
|
|
1279
1279
|
return t && b.bbox ? { ...b, pageNumber: t.page, bbox: { ...b.bbox, page: t.page, y: t.y, height: t.height } } : b;
|
|
1280
1280
|
}
|
|
1281
1281
|
function firstRowSig(t) {
|
|
1282
|
-
const x =
|
|
1282
|
+
const x = _chunkK2GXTJPKcjs.TABLE_COLXS.get(t);
|
|
1283
1283
|
if (!x || x.length !== t.cols + 1) return null;
|
|
1284
1284
|
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, "") }));
|
|
1285
1285
|
}
|
|
@@ -1332,7 +1332,7 @@ function chainHead(blocks, i, pageHeights) {
|
|
|
1332
1332
|
if (pb.pageNumber !== (_nullishCoalesce(cur.pageNumber, () => ( 0))) - 1) break;
|
|
1333
1333
|
if (!blocks.slice(p + 1, k).every((b) => besideOwn(b, pb, cur) || insideTable(b, pb))) break;
|
|
1334
1334
|
if (!looksContinued(pb, cur, pageHeights)) break;
|
|
1335
|
-
const px =
|
|
1335
|
+
const px = _chunkK2GXTJPKcjs.TABLE_COLXS.get(pb.table), cx = _chunkK2GXTJPKcjs.TABLE_COLXS.get(cur.table);
|
|
1336
1336
|
if (!px || !cx) break;
|
|
1337
1337
|
const dx = px[px.length - 1] - cx[cx.length - 1];
|
|
1338
1338
|
if (!shiftedSame(px, cx) && !px.some((x) => Math.abs(x - (cx[0] + dx)) <= CONTINUATION_COL_TOL) && !prevLacksLeftCols(pb, px, cx, pageHeights)) break;
|
|
@@ -1364,7 +1364,7 @@ var RESTART_LOOKBACK_PAGES = 5;
|
|
|
1364
1364
|
var COL_MATCH_TOL = 0.5;
|
|
1365
1365
|
var CONTINUED_TABLE_PAGE_BAND = 0.16;
|
|
1366
1366
|
function lastRowCell(t, x1, x2) {
|
|
1367
|
-
const xs =
|
|
1367
|
+
const xs = _chunkK2GXTJPKcjs.TABLE_COLXS.get(t);
|
|
1368
1368
|
const covered = /* @__PURE__ */ new Set();
|
|
1369
1369
|
for (let r = 0; r < t.rows; r++) {
|
|
1370
1370
|
for (let c = 0; c < t.cols; c++) {
|
|
@@ -1382,7 +1382,7 @@ var cellBlocks = (cell, pageNumber) => _nullishCoalesce(cell.blocks, () => ( cel
|
|
|
1382
1382
|
function mergeContinuedCells(blocks, pageHeights) {
|
|
1383
1383
|
for (let j = blocks.length - 1; j > 0; j--) {
|
|
1384
1384
|
const part = blocks[j];
|
|
1385
|
-
const from = part.table ?
|
|
1385
|
+
const from = part.table ? _chunkK2GXTJPKcjs.CONT_PARTS.get(part.table) : void 0;
|
|
1386
1386
|
if (!from || !part.table) continue;
|
|
1387
1387
|
let i = j - 1;
|
|
1388
1388
|
while (i >= 0 && blocks[i].type !== "table") i--;
|
|
@@ -1394,11 +1394,11 @@ function mergeContinuedCells(blocks, pageHeights) {
|
|
|
1394
1394
|
const at = cell.blocks || add.blocks ? cellBlocks(cell, prev.pageNumber).length : -1;
|
|
1395
1395
|
if (cell.blocks || add.blocks) cell.blocks = [...cellBlocks(cell, prev.pageNumber), ...cellBlocks(add, part.pageNumber)];
|
|
1396
1396
|
cell.text = [cell.text, add.text].filter((s) => s.trim()).join("\n");
|
|
1397
|
-
|
|
1398
|
-
const lines =
|
|
1399
|
-
if (_optionalChain([lines, 'optionalAccess', _89 => _89.length]))
|
|
1400
|
-
if (part.pageNumber && part.bbox)
|
|
1401
|
-
if (cell.text.trim() || _optionalChain([cell, 'access', _90 => _90.blocks, 'optionalAccess', _91 => _91.length]))
|
|
1397
|
+
_chunkK2GXTJPKcjs.joinCellEdges.call(void 0, cell, add);
|
|
1398
|
+
const lines = _chunkK2GXTJPKcjs.CELL_LINES.get(add);
|
|
1399
|
+
if (_optionalChain([lines, 'optionalAccess', _89 => _89.length])) _chunkK2GXTJPKcjs.CELL_LINES.set(cell, [..._nullishCoalesce(_chunkK2GXTJPKcjs.CELL_LINES.get(cell), () => ( [])), ...lines]);
|
|
1400
|
+
if (part.pageNumber && part.bbox) _chunkK2GXTJPKcjs.TABLE_TAIL.set(prev.table, _nullishCoalesce(_chunkK2GXTJPKcjs.TABLE_TAIL.get(part.table), () => ( { page: part.pageNumber, y: part.bbox.y, height: part.bbox.height })));
|
|
1401
|
+
if (cell.text.trim() || _optionalChain([cell, 'access', _90 => _90.blocks, 'optionalAccess', _91 => _91.length])) _chunkK2GXTJPKcjs.EMPTY_PARTS.delete(prev.table);
|
|
1402
1402
|
blocks.splice(j, 1);
|
|
1403
1403
|
if (cell.blocks && at > 0) {
|
|
1404
1404
|
const nextAt = cell.blocks[at];
|
|
@@ -1410,11 +1410,11 @@ function mergeContinuedCells(blocks, pageHeights) {
|
|
|
1410
1410
|
}
|
|
1411
1411
|
function unwrapContinuedTable(blocks, at, pageHeights) {
|
|
1412
1412
|
const prev = blocks[at - 1], frame = blocks[at];
|
|
1413
|
-
if (!_optionalChain([prev, 'optionalAccess', _92 => _92.table]) || !_optionalChain([frame, 'optionalAccess', _93 => _93.table]) || frame.table.rows !== 1 || frame.table.cols !== 1 || !
|
|
1413
|
+
if (!_optionalChain([prev, 'optionalAccess', _92 => _92.table]) || !_optionalChain([frame, 'optionalAccess', _93 => _93.table]) || frame.table.rows !== 1 || frame.table.cols !== 1 || !_chunkK2GXTJPKcjs.CLIP_TABLES.has(frame.table)) return;
|
|
1414
1414
|
const inner = _optionalChain([frame, 'access', _94 => _94.table, 'access', _95 => _95.cells, 'access', _96 => _96[0], 'optionalAccess', _97 => _97[0], 'optionalAccess', _98 => _98.blocks]);
|
|
1415
1415
|
const next = _optionalChain([inner, 'optionalAccess', _99 => _99[0]]);
|
|
1416
|
-
if (!inner || !_optionalChain([next, 'optionalAccess', _100 => _100.table]) || !prev.bbox || !next.bbox || !prev.pageNumber || next.pageNumber !== prev.pageNumber + 1 || !
|
|
1417
|
-
const px =
|
|
1416
|
+
if (!inner || !_optionalChain([next, 'optionalAccess', _100 => _100.table]) || !prev.bbox || !next.bbox || !prev.pageNumber || next.pageNumber !== prev.pageNumber + 1 || !_chunkK2GXTJPKcjs.CLIP_TABLES.has(prev.table) || !_chunkK2GXTJPKcjs.CLIP_TABLES.has(next.table) || prev.table.cols !== next.table.cols) return;
|
|
1417
|
+
const px = _chunkK2GXTJPKcjs.TABLE_COLXS.get(prev.table), nx = _chunkK2GXTJPKcjs.TABLE_COLXS.get(next.table);
|
|
1418
1418
|
if (!px || !nx || px.length !== nx.length || px.some((x, i) => Math.abs(x - nx[i]) > COL_MATCH_TOL)) return;
|
|
1419
1419
|
const ph = _optionalChain([pageHeights, 'optionalAccess', _101 => _101.get, 'call', _102 => _102(prev.pageNumber)]), nh = _optionalChain([pageHeights, 'optionalAccess', _103 => _103.get, 'call', _104 => _104(next.pageNumber)]);
|
|
1420
1420
|
if (!ph || !nh || prev.bbox.y > ph * CONTINUED_TABLE_PAGE_BAND || next.bbox.y + next.bbox.height < nh * (1 - CONTINUED_TABLE_PAGE_BAND)) return;
|
|
@@ -1423,14 +1423,14 @@ function unwrapContinuedTable(blocks, at, pageHeights) {
|
|
|
1423
1423
|
function fillNestedContinuation(blocks, at) {
|
|
1424
1424
|
const prev = blocks[at - 1], next = blocks[at];
|
|
1425
1425
|
const t = _optionalChain([prev, 'optionalAccess', _105 => _105.table]), u = _optionalChain([next, 'optionalAccess', _106 => _106.table]);
|
|
1426
|
-
if (!t || !u || u.rows !== 1 || u.cols !== 1 || !
|
|
1427
|
-
const xs =
|
|
1426
|
+
if (!t || !u || u.rows !== 1 || u.cols !== 1 || !_chunkK2GXTJPKcjs.CLIP_TABLES.has(t) || !_chunkK2GXTJPKcjs.CLIP_TABLES.has(u) || next.pageNumber !== (_nullishCoalesce(prev.pageNumber, () => ( 0))) + 1) return;
|
|
1427
|
+
const xs = _chunkK2GXTJPKcjs.TABLE_COLXS.get(u);
|
|
1428
1428
|
const cell = xs ? lastRowCell(t, xs[0], xs[xs.length - 1]) : void 0;
|
|
1429
1429
|
const add = _optionalChain([u, 'access', _107 => _107.cells, 'access', _108 => _108[0], 'optionalAccess', _109 => _109[0]]);
|
|
1430
1430
|
if (!cell || !add || cell.text.trim() || _optionalChain([cell, 'access', _110 => _110.blocks, 'optionalAccess', _111 => _111.length])) return;
|
|
1431
1431
|
cell.text = add.text;
|
|
1432
1432
|
if (add.blocks) cell.blocks = add.blocks;
|
|
1433
|
-
|
|
1433
|
+
_chunkK2GXTJPKcjs.joinCellEdges.call(void 0, cell, add);
|
|
1434
1434
|
blocks.splice(at, 1);
|
|
1435
1435
|
}
|
|
1436
1436
|
|
|
@@ -1466,7 +1466,7 @@ var WINANSI_REVERSE = {
|
|
|
1466
1466
|
};
|
|
1467
1467
|
function symbolFontTable(fontName) {
|
|
1468
1468
|
if (!fontName) return void 0;
|
|
1469
|
-
if (/wingdings(?![\s-]*[23])/i.test(fontName)) return
|
|
1469
|
+
if (/wingdings(?![\s-]*[23])/i.test(fontName)) return _chunkHNPRQKLZcjs.WINGDINGS;
|
|
1470
1470
|
return void 0;
|
|
1471
1471
|
}
|
|
1472
1472
|
function remapSymbolText(text, table) {
|
|
@@ -2486,7 +2486,7 @@ function demoteNonHeadingRoles(blocks, pageHeights, faceNames) {
|
|
|
2486
2486
|
if (block.type !== "heading" || !block.text) continue;
|
|
2487
2487
|
const text = block.text.replace(/<[^>]+>/g, "").trim();
|
|
2488
2488
|
const fsz = _nullishCoalesce(_optionalChain([block, 'access', _144 => _144.style, 'optionalAccess', _145 => _145.fontSize]), () => ( 0));
|
|
2489
|
-
const tocEntry = i > 0 &&
|
|
2489
|
+
const tocEntry = i > 0 && _chunkK2GXTJPKcjs.TOC_BLOCKS.has(blocks[i - 1]) && _chunkK2GXTJPKcjs.TOC_BLOCKS.has(blocks[i + 1]);
|
|
2490
2490
|
const page = _nullishCoalesce(byPage.get(_nullishCoalesce(block.pageNumber, () => ( 0))), () => ( []));
|
|
2491
2491
|
const proseStyle = _optionalChain([block, 'access', _146 => _146.style, 'optionalAccess', _147 => _147.fontName]) && bodyStyle.get(_nullishCoalesce(block.pageNumber, () => ( 0))) === `${block.style.fontName}:${block.style.fontSize}` && text.length > 60;
|
|
2492
2492
|
const next = blocks[i + 1];
|
|
@@ -2595,7 +2595,7 @@ function joinLatinCellWraps(blocks) {
|
|
|
2595
2595
|
const lines = cell.text.split("\n");
|
|
2596
2596
|
const out = [lines[0]];
|
|
2597
2597
|
for (const line of lines.slice(1)) {
|
|
2598
|
-
if (
|
|
2598
|
+
if (_chunkK2GXTJPKcjs.latinSoftWrap.call(void 0, out[out.length - 1], line)) out[out.length - 1] = out[out.length - 1].trimEnd() + " " + line.trim();
|
|
2599
2599
|
else out.push(line);
|
|
2600
2600
|
}
|
|
2601
2601
|
cell.text = out.join("\n");
|
|
@@ -2615,10 +2615,10 @@ function cleanPdfText(text, opts) {
|
|
|
2615
2615
|
).replace(/^(?!\| ---).*$/gm, (line) => {
|
|
2616
2616
|
if (/^\s*\${1,2}.+\${1,2}\s*$/.test(line)) return line;
|
|
2617
2617
|
if (line.startsWith("|")) {
|
|
2618
|
-
return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) =>
|
|
2618
|
+
return line.replace(/(?:\\.|[^|\\])+/g, (cell) => cell.split("<br>").map((seg) => seg.replace(/\S(?:.*\S)?/, (t) => _chunkK2GXTJPKcjs.collapseEvenSpacing.call(void 0, t, false))).join("<br>"));
|
|
2619
2619
|
}
|
|
2620
2620
|
const mark = _nullishCoalesce(_optionalChain([/^(?:#{1,6}|-) /, 'access', _219 => _219.exec, 'call', _220 => _220(line), 'optionalAccess', _221 => _221[0]]), () => ( ""));
|
|
2621
|
-
return mark +
|
|
2621
|
+
return mark + _chunkK2GXTJPKcjs.collapseEvenSpacing.call(void 0, line.slice(mark.length), false);
|
|
2622
2622
|
}).replace(/\\~\\~/g, "~~").replace(/~~~~/g, "").replace(/<u>\s*<\/u>/g, "").replace(/<(sup|sub)>\s*<\/\1>/g, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
2623
2623
|
}
|
|
2624
2624
|
function startsWithMarker(line) {
|
|
@@ -2650,7 +2650,7 @@ function mergeKoreanLines(text) {
|
|
|
2650
2650
|
continue;
|
|
2651
2651
|
}
|
|
2652
2652
|
if (/[가-힣·,\-]$/.test(prev) && /^[가-힣(]/.test(curr) && !startsWithMarker(curr) && !isStandaloneHeader(prev) && !startsWithMarker(prev)) {
|
|
2653
|
-
result[result.length - 1] = prev +
|
|
2653
|
+
result[result.length - 1] = prev + _chunkK2GXTJPKcjs.wrapJoiner.call(void 0, prev, curr) + curr;
|
|
2654
2654
|
} else {
|
|
2655
2655
|
result.push(curr);
|
|
2656
2656
|
}
|
|
@@ -2666,7 +2666,7 @@ function applyLinkAnnotations(items, annots) {
|
|
|
2666
2666
|
const wrapped = /* @__PURE__ */ new Set();
|
|
2667
2667
|
for (const a of annots) {
|
|
2668
2668
|
if (a.subtype !== "Link" || !a.url || !a.rect || a.rect.length < 4) continue;
|
|
2669
|
-
const url =
|
|
2669
|
+
const url = _chunkZWPINXUXcjs.sanitizeHref.call(void 0, a.url);
|
|
2670
2670
|
if (!url) continue;
|
|
2671
2671
|
const x1 = Math.min(a.rect[0], a.rect[2]), x2 = Math.max(a.rect[0], a.rect[2]);
|
|
2672
2672
|
const y1 = Math.min(a.rect[1], a.rect[3]), y2 = Math.max(a.rect[1], a.rect[3]);
|
|
@@ -2707,7 +2707,7 @@ function mergeLinkRuns(markdown) {
|
|
|
2707
2707
|
|
|
2708
2708
|
// src/pdf/formula-ocr.ts
|
|
2709
2709
|
async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
|
|
2710
|
-
const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-
|
|
2710
|
+
const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-Y3L3RPPI.cjs")));
|
|
2711
2711
|
const { FormulaPipeline, ensureFormulaModels } = formulaMod;
|
|
2712
2712
|
await ensureFormulaModels((p) => {
|
|
2713
2713
|
if (p.phase === "download" && p.total) {
|
|
@@ -2886,13 +2886,13 @@ async function loadPdfWithTimeout(buffer) {
|
|
|
2886
2886
|
try {
|
|
2887
2887
|
return await Promise.race([
|
|
2888
2888
|
loadingTask.promise.catch((e) => {
|
|
2889
|
-
if (e instanceof Error && e.name === "PasswordException") throw new (0,
|
|
2889
|
+
if (e instanceof Error && e.name === "PasswordException") throw new (0, _chunkZWPINXUXcjs.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)");
|
|
2890
2890
|
throw e;
|
|
2891
2891
|
}),
|
|
2892
2892
|
new Promise((_, reject) => {
|
|
2893
2893
|
timer = setTimeout(() => {
|
|
2894
2894
|
loadingTask.destroy();
|
|
2895
|
-
reject(new (0,
|
|
2895
|
+
reject(new (0, _chunkZWPINXUXcjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
|
|
2896
2896
|
}, PDF_LOAD_TIMEOUT_MS);
|
|
2897
2897
|
})
|
|
2898
2898
|
]);
|
|
@@ -2902,12 +2902,12 @@ async function loadPdfWithTimeout(buffer) {
|
|
|
2902
2902
|
}
|
|
2903
2903
|
async function parsePdfDocument(buffer, options) {
|
|
2904
2904
|
const formulaBuffer = _optionalChain([options, 'optionalAccess', _222 => _222.formulaOcr]) ? buffer : null;
|
|
2905
|
-
const autoOcr = _optionalChain([options, 'optionalAccess', _223 => _223.ocr]) === void 0 && await
|
|
2905
|
+
const autoOcr = _optionalChain([options, 'optionalAccess', _223 => _223.ocr]) === void 0 && await _chunkK2GXTJPKcjs.ocrModelsCached.call(void 0, );
|
|
2906
2906
|
const ocrBuffer = _optionalChain([options, 'optionalAccess', _224 => _224.ocr]) || autoOcr ? buffer : null;
|
|
2907
2907
|
const doc = await loadPdfWithTimeout(buffer);
|
|
2908
2908
|
try {
|
|
2909
2909
|
const pageCount = doc.numPages;
|
|
2910
|
-
if (pageCount === 0) throw new (0,
|
|
2910
|
+
if (pageCount === 0) throw new (0, _chunkZWPINXUXcjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
2911
2911
|
const metadata = { pageCount, pageMode: "layout" };
|
|
2912
2912
|
await extractPdfMetadata(doc, metadata);
|
|
2913
2913
|
const blocks = [];
|
|
@@ -2934,7 +2934,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
2934
2934
|
const pageImageBlocks = /* @__PURE__ */ new Map();
|
|
2935
2935
|
const carry = {};
|
|
2936
2936
|
const vectorPageOps = /* @__PURE__ */ new Map();
|
|
2937
|
-
const wrapLexicon = new (0,
|
|
2937
|
+
const wrapLexicon = new (0, _chunkK2GXTJPKcjs.WrapLexicon)();
|
|
2938
2938
|
const noteMarks = /* @__PURE__ */ new Map();
|
|
2939
2939
|
let parsedPages = 0;
|
|
2940
2940
|
for (let i = 1; i <= effectivePageCount; i++) {
|
|
@@ -2962,8 +2962,8 @@ async function parsePdfDocument(buffer, options) {
|
|
|
2962
2962
|
restoreTrackedSpacing(rawItems, rawOps.fnArray, rawOps.argsArray);
|
|
2963
2963
|
markSyntheticSpaces(rawItems, rawOps.fnArray, rawOps.argsArray);
|
|
2964
2964
|
const occluded = occludedTextItems(rawItems, rawOps.fnArray, rawOps.argsArray);
|
|
2965
|
-
const items =
|
|
2966
|
-
const filtered =
|
|
2965
|
+
const items = _chunkK2GXTJPKcjs.normalizeItems.call(void 0, occluded.size ? rawItems.filter((it) => !occluded.has(it)) : rawItems);
|
|
2966
|
+
const filtered = _chunkK2GXTJPKcjs.filterHiddenText.call(void 0, items, pageW, pageH, viewX1, viewY1);
|
|
2967
2967
|
const joined = joinVerticalColumns(filtered.visible);
|
|
2968
2968
|
const visible = dropTabLeaderDots(joined);
|
|
2969
2969
|
const hiddenCount = filtered.hiddenCount + occluded.size;
|
|
@@ -3001,11 +3001,11 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3001
3001
|
it.fontName = face;
|
|
3002
3002
|
if (!faceNames.has(face)) faceNames.set(face, (_nullishCoalesce(_optionalChain([fontObj, 'call', _234 => _234(face), 'optionalAccess', _235 => _235.name]), () => ( ""))).replace(/^[A-Z]{6}\+/, ""));
|
|
3003
3003
|
}
|
|
3004
|
-
for (const it of visible) if (it.text.includes("$")) it.text =
|
|
3004
|
+
for (const it of visible) if (it.text.includes("$")) it.text = _chunkHNPRQKLZcjs.escapeLiteralDollar.call(void 0, it.text);
|
|
3005
3005
|
wrapEquationRuns(visible, (face) => faceNames.get(face));
|
|
3006
3006
|
const pageArea = pageW * pageH;
|
|
3007
3007
|
if (pageArea > 0) {
|
|
3008
|
-
const imageRegions =
|
|
3008
|
+
const imageRegions = _chunkK2GXTJPKcjs.extractImageRegions.call(void 0, opList.fnArray, opList.argsArray);
|
|
3009
3009
|
let uncovered = 0;
|
|
3010
3010
|
for (const r of imageRegions) {
|
|
3011
3011
|
const area = (r.x2 - r.x1) * (r.y2 - r.y1);
|
|
@@ -3031,10 +3031,10 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3031
3031
|
if (uncovered > 0) skippedImagePages.set(i, uncovered);
|
|
3032
3032
|
}
|
|
3033
3033
|
const marks = superscriptNoteMarks(visible);
|
|
3034
|
-
if (marks.length) noteMarks.set(i, { marks, seps: footnoteSeparators(
|
|
3034
|
+
if (marks.length) noteMarks.set(i, { marks, seps: footnoteSeparators(_chunkK2GXTJPKcjs.extractLines.call(void 0, opList.fnArray, opList.argsArray).horizontals, pageW, pageH) });
|
|
3035
3035
|
const stamp = marginStamp(visible);
|
|
3036
3036
|
const flow = stamp.length ? visible.filter((it) => !stamp.includes(it)) : visible;
|
|
3037
|
-
const pageBlocks = orderTwoUpPage(
|
|
3037
|
+
const pageBlocks = orderTwoUpPage(_chunkK2GXTJPKcjs.extractPageBlocksWithLines.call(void 0, flow, i, opList, pageW, pageH, void 0, _optionalChain([options, 'optionalAccess', _236 => _236.tables]) !== false, carry, wrapLexicon), pageW, pageH);
|
|
3038
3038
|
if (stamp.length) pageBlocks.unshift({ type: "paragraph", text: [...stamp].sort((a, b) => a.y - b.y).map((it) => it.text).join(" "), pageNumber: i });
|
|
3039
3039
|
for (const b of pageBlocks) blocks.push(b);
|
|
3040
3040
|
try {
|
|
@@ -3060,11 +3060,11 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3060
3060
|
if (_optionalChain([options, 'optionalAccess', _238 => _238.ocr]) && quality.ocrReason === "vector_text" && page.rotate % 360 === 0 && page.view[0] === 0 && page.view[1] === 0) {
|
|
3061
3061
|
vectorPageOps.set(i, ocrVectorOps(opList, vector.paths));
|
|
3062
3062
|
}
|
|
3063
|
-
if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0,
|
|
3063
|
+
if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunkZWPINXUXcjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
|
|
3064
3064
|
parsedPages++;
|
|
3065
3065
|
_optionalChain([options, 'optionalAccess', _239 => _239.onProgress, 'optionalCall', _240 => _240(parsedPages, totalTarget)]);
|
|
3066
3066
|
} catch (pageErr) {
|
|
3067
|
-
if (pageErr instanceof
|
|
3067
|
+
if (pageErr instanceof _chunkZWPINXUXcjs.KordocError) throw pageErr;
|
|
3068
3068
|
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" });
|
|
3069
3069
|
} finally {
|
|
3070
3070
|
_optionalChain([loadedPage, 'optionalAccess', _241 => _241.cleanup, 'call', _242 => _242()]);
|
|
@@ -3090,11 +3090,11 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3090
3090
|
}
|
|
3091
3091
|
if (targets.size > 0) {
|
|
3092
3092
|
try {
|
|
3093
|
-
const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-
|
|
3093
|
+
const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-BW6RUT4H.cjs")));
|
|
3094
3094
|
const mode = typeof _optionalChain([options, 'optionalAccess', _247 => _247.ocr]) === "function" ? options.ocr : "builtin";
|
|
3095
3095
|
const regionPages = new Map([...ocrRegions].filter(([p]) => _optionalChain([options, 'optionalAccess', _248 => _248.ocr]) !== "force" && !isImageBased && !_optionalChain([pageQuality, 'access', _249 => _249.find, 'call', _250 => _250((q) => q.page === p), 'optionalAccess', _251 => _251.needsOcr])));
|
|
3096
3096
|
const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, _optionalChain([options, 'optionalAccess', _252 => _252.onProgress]), _optionalChain([options, 'optionalAccess', _253 => _253.tables]) !== false, vectorPageOps, regionPages);
|
|
3097
|
-
for (const obs of ocrPageBlocks.values())
|
|
3097
|
+
for (const obs of ocrPageBlocks.values()) _chunkHNPRQKLZcjs.stripScriptTags.call(void 0, { blocks: obs });
|
|
3098
3098
|
if (ocrPageBlocks.size > 0) {
|
|
3099
3099
|
const replacePages = /* @__PURE__ */ new Set();
|
|
3100
3100
|
for (const [p, obs] of ocrPageBlocks) {
|
|
@@ -3158,7 +3158,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3158
3158
|
}
|
|
3159
3159
|
}
|
|
3160
3160
|
if (_optionalChain([options, 'optionalAccess', _261 => _261.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
|
|
3161
|
-
const removed =
|
|
3161
|
+
const removed = _chunkK2GXTJPKcjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks);
|
|
3162
3162
|
for (let ri = removed.length - 1; ri >= 0; ri--) {
|
|
3163
3163
|
blocks.splice(removed[ri], 1);
|
|
3164
3164
|
}
|
|
@@ -3171,12 +3171,12 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3171
3171
|
mergeContinuedCells(blocks, pageHeights);
|
|
3172
3172
|
mergeCrossPageTables(blocks, pageHeights, wrapLexicon);
|
|
3173
3173
|
if (_optionalChain([options, 'optionalAccess', _262 => _262.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
|
|
3174
|
-
const boxes =
|
|
3174
|
+
const boxes = _chunkK2GXTJPKcjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings, noteMarks, true);
|
|
3175
3175
|
for (let ri = boxes.length - 1; ri >= 0; ri--) blocks.splice(boxes[ri], 1);
|
|
3176
3176
|
}
|
|
3177
3177
|
splitContactTables(blocks);
|
|
3178
|
-
if (!_optionalChain([options, 'optionalAccess', _263 => _263.keepTrailingEmptyCols]))
|
|
3179
|
-
|
|
3178
|
+
if (!_optionalChain([options, 'optionalAccess', _263 => _263.keepTrailingEmptyCols])) _chunkK2GXTJPKcjs.trimTrailingEmptyTableCols.call(void 0, blocks);
|
|
3179
|
+
_chunkK2GXTJPKcjs.joinPageBreakWraps.call(void 0, blocks, wrapLexicon);
|
|
3180
3180
|
injectPageImageBlocks(blocks, pageImageBlocks);
|
|
3181
3181
|
if (_optionalChain([options, 'optionalAccess', _264 => _264.formulaOcr]) && formulaBuffer) {
|
|
3182
3182
|
try {
|
|
@@ -3188,21 +3188,21 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3188
3188
|
});
|
|
3189
3189
|
}
|
|
3190
3190
|
}
|
|
3191
|
-
const medianFontSize =
|
|
3191
|
+
const medianFontSize = _chunkK2GXTJPKcjs.computeMedianFontSizeFromFreq.call(void 0, fontSizeFreq);
|
|
3192
3192
|
if (medianFontSize > 0) {
|
|
3193
|
-
|
|
3194
|
-
}
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3193
|
+
_chunkK2GXTJPKcjs.detectHeadings.call(void 0, blocks, medianFontSize);
|
|
3194
|
+
}
|
|
3195
|
+
_chunkK2GXTJPKcjs.detectDocumentStyleHeadings.call(void 0, blocks);
|
|
3196
|
+
_chunkK2GXTJPKcjs.detectTypographyHeadings.call(void 0, blocks);
|
|
3197
|
+
_chunkK2GXTJPKcjs.detectSiblingStyleHeadings.call(void 0, blocks);
|
|
3198
|
+
_chunkK2GXTJPKcjs.detectRepeatedPageLabels.call(void 0, blocks);
|
|
3199
|
+
_chunkK2GXTJPKcjs.detectPageLeadHeadings.call(void 0, blocks);
|
|
3200
|
+
_chunkK2GXTJPKcjs.mergeStackedHeadingLines.call(void 0, blocks, medianFontSize);
|
|
3201
|
+
_chunkK2GXTJPKcjs.refineDocumentStyleHeadings.call(void 0, blocks);
|
|
3202
|
+
_chunkK2GXTJPKcjs.detectMarkerHeadings.call(void 0, blocks);
|
|
3203
3203
|
demoteNonHeadingRoles(blocks, pageHeights, faceNames);
|
|
3204
|
-
|
|
3205
|
-
|
|
3204
|
+
_chunkK2GXTJPKcjs.detectTableCaptions.call(void 0, blocks);
|
|
3205
|
+
_chunkK2GXTJPKcjs.detectKoreanListBlocks.call(void 0, blocks);
|
|
3206
3206
|
const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
3207
3207
|
sanitizeBlockControlChars(blocks);
|
|
3208
3208
|
let outBlocks = splitSingleCellTables(blocks);
|
|
@@ -3220,17 +3220,17 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3220
3220
|
const shown = /* @__PURE__ */ new Map();
|
|
3221
3221
|
const markContent = (bs) => {
|
|
3222
3222
|
for (const b of _nullishCoalesce(bs, () => ( []))) if (b.table) for (const row of b.table.cells) for (const c of row) {
|
|
3223
|
-
if (
|
|
3223
|
+
if (_chunkK2GXTJPKcjs.IMAGE_CELLS.has(c)) _chunkHNPRQKLZcjs.CONTENT_CELLS.add(c);
|
|
3224
3224
|
markContent(c.blocks);
|
|
3225
3225
|
}
|
|
3226
3226
|
};
|
|
3227
3227
|
const visual = (bs) => bs.flatMap((b) => {
|
|
3228
3228
|
if (b.type !== "table") return [b];
|
|
3229
|
-
if (!hancom && b.table &&
|
|
3229
|
+
if (!hancom && b.table && _chunkK2GXTJPKcjs.CLIP_TABLES.has(b.table)) return [b];
|
|
3230
3230
|
let v = shown.get(b);
|
|
3231
3231
|
if (!v) {
|
|
3232
3232
|
markContent([b]);
|
|
3233
|
-
shown.set(b, v =
|
|
3233
|
+
shown.set(b, v = _chunkHNPRQKLZcjs.unframeLayoutTables.call(void 0, [b], !!_optionalChain([options, 'optionalAccess', _267 => _267.keepTrailingEmptyCols])));
|
|
3234
3234
|
}
|
|
3235
3235
|
return v;
|
|
3236
3236
|
});
|
|
@@ -3239,11 +3239,11 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3239
3239
|
blocks.length = 0;
|
|
3240
3240
|
for (const b of kept) blocks.push(b);
|
|
3241
3241
|
}
|
|
3242
|
-
const finishMarkdown = (bs) => mergeLinkRuns(cleanPdfText(
|
|
3242
|
+
const finishMarkdown = (bs) => mergeLinkRuns(cleanPdfText(_chunkHNPRQKLZcjs.blocksToMarkdown.call(void 0, bs), { keepLoneNumbers: true }));
|
|
3243
3243
|
let markdown = finishMarkdown(outBlocks);
|
|
3244
3244
|
return {
|
|
3245
3245
|
markdown,
|
|
3246
|
-
pages:
|
|
3246
|
+
pages: _chunkDUHHMIPScjs.blocksToPages.call(void 0, outBlocks, finishMarkdown),
|
|
3247
3247
|
blocks,
|
|
3248
3248
|
metadata,
|
|
3249
3249
|
outline: outline.length > 0 ? outline : void 0,
|
|
@@ -3321,5 +3321,5 @@ function marginStamp(items) {
|
|
|
3321
3321
|
|
|
3322
3322
|
|
|
3323
3323
|
|
|
3324
|
-
exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks =
|
|
3325
|
-
//# sourceMappingURL=parser-
|
|
3324
|
+
exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks = _chunkK2GXTJPKcjs.detectKoreanListBlocks; exports.detectTableCaptions = _chunkK2GXTJPKcjs.detectTableCaptions; exports.extractPdfMetadataOnly = extractPdfMetadataOnly; exports.mergeCrossPageTables = mergeCrossPageTables; exports.ocrImageRegions = ocrImageRegions; exports.parsePdfDocument = parsePdfDocument; exports.removeHeaderFooterBlocks = _chunkK2GXTJPKcjs.removeHeaderFooterBlocks;
|
|
3325
|
+
//# sourceMappingURL=parser-BEPVGAMI.cjs.map
|