kordoc 4.17.0 → 4.17.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.
- package/README.md +6 -3
- package/dist/{-PRAKO6M4.js → -2UA2JHVA.js} +11 -11
- package/dist/{chunk-I5DJOP62.js → chunk-2XHXABCX.js} +2 -2
- package/dist/{chunk-4XVNQAK5.js → chunk-3N272C5L.js} +244 -115
- package/dist/chunk-3N272C5L.js.map +1 -0
- package/dist/{chunk-6RGGYQQC.js → chunk-4HRJISJF.js} +3 -3
- package/dist/{chunk-WN6OD2CQ.js → chunk-4TSYMJDL.js} +243 -114
- package/dist/chunk-4TSYMJDL.js.map +1 -0
- package/dist/{chunk-EFO6JZY6.js → chunk-5JZEY5IL.js} +119 -77
- package/dist/chunk-5JZEY5IL.js.map +1 -0
- package/dist/{chunk-WYON5ANU.cjs → chunk-6DOCSYEM.cjs} +113 -71
- package/dist/chunk-6DOCSYEM.cjs.map +1 -0
- package/dist/{chunk-BZG7K44Z.js → chunk-6OCKAXIS.js} +2 -2
- package/dist/{chunk-ZF6KHPB7.js → chunk-A2W2JQ3S.js} +11 -5
- package/dist/chunk-A2W2JQ3S.js.map +1 -0
- package/dist/{chunk-N6V7LQBL.js → chunk-C4MVZXB5.js} +2 -2
- package/dist/{chunk-4GSF2R7T.js → chunk-FGL4IGOT.js} +4 -4
- package/dist/{chunk-R2BUANHQ.cjs → chunk-GPC72VSF.cjs} +6 -6
- package/dist/chunk-GPC72VSF.cjs.map +1 -0
- package/dist/chunk-GS7T56RP.cjs.map +1 -1
- package/dist/{chunk-TDQ6XDB3.js → chunk-GYTL6WT3.js} +3 -3
- package/dist/{chunk-O7OUX6NU.cjs → chunk-HAW2VL62.cjs} +12 -12
- package/dist/chunk-HAW2VL62.cjs.map +1 -0
- package/dist/chunk-J55UQC5H.cjs.map +1 -1
- package/dist/{chunk-QJWVMPB6.js → chunk-JY2NBFIG.js} +15 -13
- package/dist/chunk-JY2NBFIG.js.map +1 -0
- package/dist/{chunk-A55JGNKD.js → chunk-KQIYC2ZU.js} +2 -2
- package/dist/{chunk-QNJLLF4J.cjs → chunk-KZVQK5NS.cjs} +11 -5
- package/dist/chunk-KZVQK5NS.cjs.map +1 -0
- package/dist/{chunk-PHID6WNG.js → chunk-MDCTITUG.js} +2 -2
- package/dist/{chunk-2KF5WZCR.js → chunk-O4CB7D2Q.js} +2 -2
- package/dist/{chunk-YZ5HHS6A.js → chunk-SDRKHEVT.js} +2 -2
- package/dist/{chunk-MJBCXW5R.js → chunk-UX3HHAWH.js} +1 -1
- package/dist/{chunk-MJBCXW5R.js.map → chunk-UX3HHAWH.js.map} +1 -1
- package/dist/{chunk-K2VYABZ3.js → chunk-VU26WGE5.js} +102 -38
- package/dist/chunk-VU26WGE5.js.map +1 -0
- package/dist/{chunk-BFT5IM2R.js → chunk-WJLICIYV.js} +2 -2
- package/dist/{chunk-5CDUL6PH.js → chunk-WL3BWROT.js} +1 -1
- package/dist/{chunk-5CDUL6PH.js.map → chunk-WL3BWROT.js.map} +1 -1
- package/dist/{chunk-XEPKOC2O.cjs → chunk-WWMKIHF7.cjs} +344 -215
- package/dist/chunk-WWMKIHF7.cjs.map +1 -0
- package/dist/{chunk-BLPR4HRF.js → chunk-XZA6X34R.js} +121 -77
- package/dist/chunk-XZA6X34R.js.map +1 -0
- package/dist/{chunk-ML4NHUR7.js → chunk-YGKC6E6A.js} +11 -5
- package/dist/chunk-YGKC6E6A.js.map +1 -0
- package/dist/{chunk-AKB72TEH.cjs → chunk-YIANW5QX.cjs} +1 -1
- package/dist/chunk-YIANW5QX.cjs.map +1 -0
- package/dist/{chunk-WY5JAR4O.js → chunk-ZDX5PIWR.js} +2 -2
- package/dist/chunks-EBWJR55V.js +10 -0
- package/dist/cli.js +26 -26
- package/dist/{formula-ECNOZT36.cjs → formula-5RETDCIC.cjs} +9 -9
- package/dist/formula-5RETDCIC.cjs.map +1 -0
- package/dist/{formula-7MMFBRGJ.js → formula-MBLN2DG4.js} +4 -4
- package/dist/{formula-SHBXRXOJ.js → formula-QZZDW5GW.js} +3 -3
- package/dist/{image-ocr-P6ECJCT2.js → image-ocr-CJSO3QSR.js} +8 -8
- package/dist/{image-ocr-QCT3A7X5.js → image-ocr-EREKAS47.js} +6 -6
- package/dist/{image-ocr-VUDSP2B4.cjs → image-ocr-PSPVRLB5.cjs} +15 -15
- package/dist/image-ocr-PSPVRLB5.cjs.map +1 -0
- package/dist/index.cjs +688 -622
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +106 -40
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +22 -22
- package/dist/{model-bundle-OUHGCEZY.js → model-bundle-MA4MMCRJ.js} +5 -5
- package/dist/{models-6D6LMOTH.js → models-SEJ7LNSN.js} +5 -5
- package/dist/page-range-QHHFTL7X.cjs.map +1 -1
- package/dist/{parser-ZPRQ3SSU.js → parser-M5WHRX25.js} +41 -23
- package/dist/parser-M5WHRX25.js.map +1 -0
- package/dist/{parser-RQ4PJRTJ.cjs → parser-QILYPWSI.cjs} +215 -197
- package/dist/parser-QILYPWSI.cjs.map +1 -0
- package/dist/{parser-CTRB7PKD.js → parser-VH3F4EQU.js} +38 -20
- package/dist/parser-VH3F4EQU.js.map +1 -0
- package/dist/pdf-ocr-3SZUM3CN.cjs +16 -0
- package/dist/pdf-ocr-3SZUM3CN.cjs.map +1 -0
- package/dist/pdf-ocr-QB2TB5W5.js +18 -0
- package/dist/pdf-ocr-XC33L43D.js +15 -0
- package/dist/{profile-io-YZUW6MAN.js → profile-io-5YB627EO.js} +3 -3
- package/dist/{rasterize-OUR2QJXX.js → rasterize-V2XHHS2I.js} +3 -3
- package/dist/{redact-doc-4OQKG4SM.js → redact-doc-5MK5L5IQ.js} +11 -11
- package/dist/{render-XNO6PZJO.js → render-SYZMHYK6.js} +7 -7
- package/dist/seal-IPKIQHYB.js +10 -0
- package/dist/{setup-UU3EIHNI.js → setup-ZPLJENSK.js} +3 -3
- package/dist/visual-RTTGNOAE.js +20 -0
- package/dist/{watch-SR6Q5SQN.js → watch-FNWHVKK3.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-4XVNQAK5.js.map +0 -1
- package/dist/chunk-AKB72TEH.cjs.map +0 -1
- package/dist/chunk-BLPR4HRF.js.map +0 -1
- package/dist/chunk-EFO6JZY6.js.map +0 -1
- package/dist/chunk-K2VYABZ3.js.map +0 -1
- package/dist/chunk-ML4NHUR7.js.map +0 -1
- package/dist/chunk-O7OUX6NU.cjs.map +0 -1
- package/dist/chunk-QJWVMPB6.js.map +0 -1
- package/dist/chunk-QNJLLF4J.cjs.map +0 -1
- package/dist/chunk-R2BUANHQ.cjs.map +0 -1
- package/dist/chunk-WN6OD2CQ.js.map +0 -1
- package/dist/chunk-WYON5ANU.cjs.map +0 -1
- package/dist/chunk-XEPKOC2O.cjs.map +0 -1
- package/dist/chunk-ZF6KHPB7.js.map +0 -1
- package/dist/chunks-YBFBLJ4G.js +0 -10
- package/dist/formula-ECNOZT36.cjs.map +0 -1
- package/dist/image-ocr-VUDSP2B4.cjs.map +0 -1
- package/dist/parser-CTRB7PKD.js.map +0 -1
- package/dist/parser-RQ4PJRTJ.cjs.map +0 -1
- package/dist/parser-ZPRQ3SSU.js.map +0 -1
- package/dist/pdf-ocr-462ZFSHX.js +0 -15
- package/dist/pdf-ocr-L35FQYGP.js +0 -18
- package/dist/pdf-ocr-STK5EQFF.cjs +0 -16
- package/dist/pdf-ocr-STK5EQFF.cjs.map +0 -1
- package/dist/seal-CJ7C44JN.js +0 -10
- package/dist/visual-QRMRFPUK.js +0 -20
- /package/dist/{-PRAKO6M4.js.map → -2UA2JHVA.js.map} +0 -0
- /package/dist/{chunk-I5DJOP62.js.map → chunk-2XHXABCX.js.map} +0 -0
- /package/dist/{chunk-6RGGYQQC.js.map → chunk-4HRJISJF.js.map} +0 -0
- /package/dist/{chunk-BZG7K44Z.js.map → chunk-6OCKAXIS.js.map} +0 -0
- /package/dist/{chunk-N6V7LQBL.js.map → chunk-C4MVZXB5.js.map} +0 -0
- /package/dist/{chunk-4GSF2R7T.js.map → chunk-FGL4IGOT.js.map} +0 -0
- /package/dist/{chunk-TDQ6XDB3.js.map → chunk-GYTL6WT3.js.map} +0 -0
- /package/dist/{chunk-A55JGNKD.js.map → chunk-KQIYC2ZU.js.map} +0 -0
- /package/dist/{chunk-PHID6WNG.js.map → chunk-MDCTITUG.js.map} +0 -0
- /package/dist/{chunk-2KF5WZCR.js.map → chunk-O4CB7D2Q.js.map} +0 -0
- /package/dist/{chunk-YZ5HHS6A.js.map → chunk-SDRKHEVT.js.map} +0 -0
- /package/dist/{chunk-BFT5IM2R.js.map → chunk-WJLICIYV.js.map} +0 -0
- /package/dist/{chunk-WY5JAR4O.js.map → chunk-ZDX5PIWR.js.map} +0 -0
- /package/dist/{chunks-YBFBLJ4G.js.map → chunks-EBWJR55V.js.map} +0 -0
- /package/dist/{formula-7MMFBRGJ.js.map → formula-MBLN2DG4.js.map} +0 -0
- /package/dist/{formula-SHBXRXOJ.js.map → formula-QZZDW5GW.js.map} +0 -0
- /package/dist/{image-ocr-P6ECJCT2.js.map → image-ocr-CJSO3QSR.js.map} +0 -0
- /package/dist/{image-ocr-QCT3A7X5.js.map → image-ocr-EREKAS47.js.map} +0 -0
- /package/dist/{model-bundle-OUHGCEZY.js.map → model-bundle-MA4MMCRJ.js.map} +0 -0
- /package/dist/{models-6D6LMOTH.js.map → models-SEJ7LNSN.js.map} +0 -0
- /package/dist/{pdf-ocr-462ZFSHX.js.map → pdf-ocr-QB2TB5W5.js.map} +0 -0
- /package/dist/{pdf-ocr-L35FQYGP.js.map → pdf-ocr-XC33L43D.js.map} +0 -0
- /package/dist/{profile-io-YZUW6MAN.js.map → profile-io-5YB627EO.js.map} +0 -0
- /package/dist/{rasterize-OUR2QJXX.js.map → rasterize-V2XHHS2I.js.map} +0 -0
- /package/dist/{redact-doc-4OQKG4SM.js.map → redact-doc-5MK5L5IQ.js.map} +0 -0
- /package/dist/{render-XNO6PZJO.js.map → render-SYZMHYK6.js.map} +0 -0
- /package/dist/{seal-CJ7C44JN.js.map → seal-IPKIQHYB.js.map} +0 -0
- /package/dist/{setup-UU3EIHNI.js.map → setup-ZPLJENSK.js.map} +0 -0
- /package/dist/{visual-QRMRFPUK.js.map → visual-RTTGNOAE.js.map} +0 -0
- /package/dist/{watch-SR6Q5SQN.js.map → watch-FNWHVKK3.js.map} +0 -0
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
blocksToPages,
|
|
5
5
|
encodePng,
|
|
6
6
|
escapeLiteralDollar
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-SDRKHEVT.js";
|
|
8
8
|
import {
|
|
9
9
|
hasRequestedPagesAfter,
|
|
10
10
|
parsePageRange
|
|
@@ -50,18 +50,18 @@ import {
|
|
|
50
50
|
startsNewItem,
|
|
51
51
|
trimTrailingEmptyTableCols,
|
|
52
52
|
wrapJoiner
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-3N272C5L.js";
|
|
54
54
|
import {
|
|
55
55
|
CELL_EDGES,
|
|
56
56
|
CONTENT_CELLS,
|
|
57
57
|
stripScriptTags,
|
|
58
58
|
unframeLayoutTables
|
|
59
|
-
} from "./chunk-
|
|
60
|
-
import "./chunk-
|
|
59
|
+
} from "./chunk-UX3HHAWH.js";
|
|
60
|
+
import "./chunk-5JZEY5IL.js";
|
|
61
61
|
import {
|
|
62
62
|
KordocError,
|
|
63
63
|
sanitizeHref
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-YGKC6E6A.js";
|
|
65
65
|
|
|
66
66
|
// src/pdf/ocr-region-merge.ts
|
|
67
67
|
function mergeOcrImageRegions(blocks, page, regions, ocrBlocks) {
|
|
@@ -681,6 +681,7 @@ function splitContactTables(blocks) {
|
|
|
681
681
|
}
|
|
682
682
|
|
|
683
683
|
// src/pdf/table-parts.ts
|
|
684
|
+
var flowText = (text) => text.replace(/<\/?u>|~~/g, "");
|
|
684
685
|
var PART_COL_TOL = 1;
|
|
685
686
|
var PART_COL_SNAP = 0.3;
|
|
686
687
|
function anchorsOf(table) {
|
|
@@ -728,7 +729,7 @@ var indexOf = (coords, x) => {
|
|
|
728
729
|
}
|
|
729
730
|
return bestD <= PART_COL_TOL ? best : -1;
|
|
730
731
|
};
|
|
731
|
-
var rowText = (anchors, r) => anchors.filter((a) => a.r === r).map((a) => a.cell.text.replace(/\s+/g, "")).join("|");
|
|
732
|
+
var rowText = (anchors, r) => anchors.filter((a) => a.r === r).map((a) => flowText(a.cell.text).replace(/\s+/g, "")).join("|");
|
|
732
733
|
var hasText = (t) => t.replace(/\|/g, "") !== "";
|
|
733
734
|
function joinSplitParts(prev, pcx, curr, ccx, dx = 0, prevBottom, lex) {
|
|
734
735
|
if (pcx.length !== prev.cols + 1 || ccx.length !== curr.cols + 1) return null;
|
|
@@ -944,8 +945,8 @@ function continuesAcross(u, d, x1, x2) {
|
|
|
944
945
|
var OUTLINE_HEAD = /^[□■]\s*\S/;
|
|
945
946
|
var OUTLINE_ITEM = /^[ㅇ○◦\-‐–·․‧※*]\s*\S/;
|
|
946
947
|
function outlineContinues(u, d) {
|
|
947
|
-
const U = u.text.split("\n").map((l) => l.trim()).filter(Boolean);
|
|
948
|
-
const D = d.text.split("\n").map((l) => l.trim()).filter(Boolean);
|
|
948
|
+
const U = flowText(u.text).split("\n").map((l) => l.trim()).filter(Boolean);
|
|
949
|
+
const D = flowText(d.text).split("\n").map((l) => l.trim()).filter(Boolean);
|
|
949
950
|
return U.length >= 2 && D.length >= 1 && U.some((l) => OUTLINE_HEAD.test(l)) && OUTLINE_ITEM.test(D[0]);
|
|
950
951
|
}
|
|
951
952
|
function lineEnded(c, x1, x2, next) {
|
|
@@ -957,7 +958,7 @@ function lineEnded(c, x1, x2, next) {
|
|
|
957
958
|
return x2 - l.r - (l.l - x1) >= Math.max(LABEL_ROOM, firstWordUnits(next?.text ?? "")) * h;
|
|
958
959
|
}
|
|
959
960
|
function firstWordUnits(text) {
|
|
960
|
-
const word = text.trim().replace(/^([(\[「『<〈])\s+/, "$1").split(/\s+/)[0] ?? "";
|
|
961
|
+
const word = flowText(text).trim().replace(/^([(\[「『<〈])\s+/, "$1").split(/\s+/)[0] ?? "";
|
|
961
962
|
let units = 0;
|
|
962
963
|
for (const ch of word) units += /[가-힣\u3400-\u9fff]/.test(ch) ? 1 : 0.55;
|
|
963
964
|
return units;
|
|
@@ -977,7 +978,7 @@ var batchim = (ch) => {
|
|
|
977
978
|
return k >= 0 && k < 11172 && k % 28 !== 0;
|
|
978
979
|
};
|
|
979
980
|
function clauseContinues(u, d) {
|
|
980
|
-
const tail = u.text.trim().split(/\s+/).pop() ?? "", head = d.text.trim();
|
|
981
|
+
const tail = flowText(u.text).trim().split(/\s+/).pop() ?? "", head = flowText(d.text).trim();
|
|
981
982
|
if (!/^[가-힣]{2,}$/.test(tail) || !/^[가-힣]/.test(head) || startsNewItem(u.text, head)) return false;
|
|
982
983
|
const last = tail[tail.length - 1], before = tail[tail.length - 2];
|
|
983
984
|
return last === "\uC744" && batchim(before) || last === "\uB97C" && !batchim(before) || CLAUSE_OPEN_ENDING.test(tail);
|
|
@@ -990,6 +991,7 @@ function wordOverflows(u, d, x1, x2) {
|
|
|
990
991
|
}
|
|
991
992
|
var KO_ORDER = "\uAC00\uB098\uB2E4\uB77C\uB9C8\uBC14\uC0AC\uC544\uC790\uCC28\uCE74\uD0C0\uD30C\uD558";
|
|
992
993
|
function itemMark(line) {
|
|
994
|
+
line = flowText(line).trim();
|
|
993
995
|
let m = /^(\d{1,2})([.)])(?!\d)/.exec(line);
|
|
994
996
|
if (m) return { style: "1" + m[2], n: +m[1] };
|
|
995
997
|
if (m = /^\((\d{1,2})\)/.exec(line)) return { style: "(1)", n: +m[1] };
|
|
@@ -1041,7 +1043,7 @@ function mergeSplitRow(table, owner, first, colXs, textOnly = false, cut = NO_CU
|
|
|
1041
1043
|
const contentPairs = pairs.filter(([u, d]) => hasContent(u.cell) && hasContent(d.cell));
|
|
1042
1044
|
const carriedSplit = !textOnly && carried && !newCell && (contentPairs.length <= 1 || contentPairs.every(([, d]) => d.rs > 1) || !cut.ruled && contentPairs.some(([u, d]) => wordOverflows(cell(u), cell(d), colXs[u.c], colXs[u.c + u.cs])));
|
|
1043
1045
|
if (!carriedSplit) {
|
|
1044
|
-
const norm = (c) => c.text.replace(/\s+/g, "");
|
|
1046
|
+
const norm = (c) => flowText(c.text).replace(/\s+/g, "");
|
|
1045
1047
|
if (pairs.some(([u, d]) => hasContent(d.cell) && norm(cell(d)) !== norm(cell(u)) && lineEnded(cell(u), colXs[u.c], colXs[u.c + u.cs], cell(d)))) return false;
|
|
1046
1048
|
const flows = ([u, d]) => continuesAcross(cell(u), cell(d), colXs[u.c], colXs[u.c + u.cs]) || clauseContinues(cell(u), cell(d));
|
|
1047
1049
|
if (!(cut.open && !newCell)) {
|
|
@@ -1138,6 +1140,20 @@ function mergeCrossPageTables(blocks, pageHeights, lex) {
|
|
|
1138
1140
|
blocks.splice(j, 1);
|
|
1139
1141
|
continue;
|
|
1140
1142
|
}
|
|
1143
|
+
if (px && cx && !CLIP_TABLES.has(prev.table) && !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 && CELL_LINES.has(c))) {
|
|
1144
|
+
const dx = px[0] - cx[0];
|
|
1145
|
+
const part = joinSplitParts(prev.table, px, curr.table, cx.map((x) => x + dx), dx, void 0, lex);
|
|
1146
|
+
if (part?.split && part.table.rows === prev.table.rows + currCells.length - 1) {
|
|
1147
|
+
const last = prev.table.rows - 1;
|
|
1148
|
+
for (let c = 0; c < part.table.cols; c++) {
|
|
1149
|
+
const U = CELL_LINES.get(prev.table.cells[last][c]), D = CELL_LINES.get(currCells[0][c]);
|
|
1150
|
+
CELL_LINES.set(part.table.cells[last][c], U.concat(D.map((l) => ({ ...l, l: l.l + dx, r: l.r + dx }))));
|
|
1151
|
+
}
|
|
1152
|
+
TABLE_COLXS.set(part.table, part.colXs);
|
|
1153
|
+
placeJoined(blocks, i, j, part.table);
|
|
1154
|
+
continue;
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1141
1157
|
const merged = {
|
|
1142
1158
|
rows: prev.table.rows + currCells.length,
|
|
1143
1159
|
cols: prev.table.cols,
|
|
@@ -1222,7 +1238,7 @@ function prevLacksLeftCols(prev, px, xs, pageHeights) {
|
|
|
1222
1238
|
return xs[0] < px[0] && xs.slice(1, -1).some((x) => Math.abs(x - px[0]) <= CONTINUATION_COL_TOL);
|
|
1223
1239
|
}
|
|
1224
1240
|
function headingRow(row) {
|
|
1225
|
-
const heads = row.map((c) => c.text.replace(/\s+/g, "")).filter(Boolean);
|
|
1241
|
+
const heads = row.map((c) => flowText(c.text).replace(/\s+/g, "")).filter(Boolean);
|
|
1226
1242
|
if (heads.length === 1) return heads[0].length <= 8 || /^[①-⑳❶-❿]/.test(heads[0]);
|
|
1227
1243
|
return heads.length === 2 && /^(?:\d{1,2}|[ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩ]+|[①-⑳❶-❿])$/.test(heads[0]);
|
|
1228
1244
|
}
|
|
@@ -1233,7 +1249,7 @@ function looksContinued(prev, curr, pageHeights) {
|
|
|
1233
1249
|
const firstRow = curr.table.cells[0] ?? [];
|
|
1234
1250
|
const firstText = firstRow.find((c) => c.text.trim())?.text ?? "";
|
|
1235
1251
|
if (!ANNEX_HEAD_RE.test(firstText)) return true;
|
|
1236
|
-
const filled = firstRow.map((c) => c.text.replace(/\s+/g, "")).filter(Boolean);
|
|
1252
|
+
const filled = firstRow.map((c) => flowText(c.text).replace(/\s+/g, "")).filter(Boolean);
|
|
1237
1253
|
return filled.length >= 2 && filled.every((t) => t === filled[0]);
|
|
1238
1254
|
}
|
|
1239
1255
|
function pushedLead(prev, curr) {
|
|
@@ -1262,7 +1278,7 @@ function tailOf(b) {
|
|
|
1262
1278
|
function firstRowSig(t) {
|
|
1263
1279
|
const x = TABLE_COLXS.get(t);
|
|
1264
1280
|
if (!x || x.length !== t.cols + 1) return null;
|
|
1265
|
-
return anchorsOf(t).filter((a) => a.r === 0).map((a) => ({ x1: x[a.c], x2: x[a.c + a.cs], t: a.cell.text.replace(/\s+/g, "") }));
|
|
1281
|
+
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, "") }));
|
|
1266
1282
|
}
|
|
1267
1283
|
function restartsTable(blocks, i, curr, pageHeights) {
|
|
1268
1284
|
const cs = firstRowSig(curr);
|
|
@@ -1287,7 +1303,7 @@ function restartsTitledForm(head, curr) {
|
|
|
1287
1303
|
if (head.rows < 2 || curr.rows < 2 || head.cols !== curr.cols) return false;
|
|
1288
1304
|
const full = (t) => t.cells[0][0]?.colSpan === t.cols;
|
|
1289
1305
|
if (!full(head) || !full(curr)) return false;
|
|
1290
|
-
const norm = (c) => (c?.text ?? "").replace(/\s+/g, "");
|
|
1306
|
+
const norm = (c) => flowText(c?.text ?? "").replace(/\s+/g, "");
|
|
1291
1307
|
const ht = norm(head.cells[0][0]), ct = norm(curr.cells[0][0]);
|
|
1292
1308
|
if (!ht || !ct || ht === ct) return false;
|
|
1293
1309
|
const titleLike = (t) => t.length <= TITLE_ROW_MAX_CHARS && !/^[ㅇ○◦•·\-–※*□■▪☞]/.test(t);
|
|
@@ -1323,7 +1339,7 @@ function chainHead(blocks, i, pageHeights) {
|
|
|
1323
1339
|
}
|
|
1324
1340
|
function rowTextsEqual(a, b) {
|
|
1325
1341
|
if (a.length !== b.length) return false;
|
|
1326
|
-
const norm = (t) => t.replace(/\s+/g, "");
|
|
1342
|
+
const norm = (t) => flowText(t).replace(/\s+/g, "");
|
|
1327
1343
|
for (let i = 0; i < a.length; i++) {
|
|
1328
1344
|
if (norm(a[i].text) !== norm(b[i].text)) return false;
|
|
1329
1345
|
}
|
|
@@ -2688,7 +2704,7 @@ function mergeLinkRuns(markdown) {
|
|
|
2688
2704
|
|
|
2689
2705
|
// src/pdf/formula-ocr.ts
|
|
2690
2706
|
async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
|
|
2691
|
-
const formulaMod = await import("./formula-
|
|
2707
|
+
const formulaMod = await import("./formula-QZZDW5GW.js");
|
|
2692
2708
|
const { FormulaPipeline, ensureFormulaModels } = formulaMod;
|
|
2693
2709
|
await ensureFormulaModels((p) => {
|
|
2694
2710
|
if (p.phase === "download" && p.total) {
|
|
@@ -3071,7 +3087,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3071
3087
|
}
|
|
3072
3088
|
if (targets.size > 0) {
|
|
3073
3089
|
try {
|
|
3074
|
-
const { runPdfOcr } = await import("./pdf-ocr-
|
|
3090
|
+
const { runPdfOcr } = await import("./pdf-ocr-XC33L43D.js");
|
|
3075
3091
|
const mode = typeof options?.ocr === "function" ? options.ocr : "builtin";
|
|
3076
3092
|
const regionPages = new Map([...ocrRegions].filter(([p]) => options?.ocr !== "force" && !isImageBased && !pageQuality.find((q) => q.page === p)?.needsOcr));
|
|
3077
3093
|
const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, options?.onProgress, options?.tables !== false, vectorPageOps, regionPages);
|
|
@@ -3196,7 +3212,8 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3196
3212
|
return b.bbox.y > h * 0.1 && b.bbox.y + b.bbox.height < h * 0.9;
|
|
3197
3213
|
});
|
|
3198
3214
|
joinLatinCellWraps(outBlocks);
|
|
3199
|
-
if (options?.layoutTables !== "keep"
|
|
3215
|
+
if (options?.layoutTables !== "keep") {
|
|
3216
|
+
const hancom = await isHancomPdf(doc);
|
|
3200
3217
|
const shown = /* @__PURE__ */ new Map();
|
|
3201
3218
|
const markContent = (bs) => {
|
|
3202
3219
|
for (const b of bs ?? []) if (b.table) for (const row of b.table.cells) for (const c of row) {
|
|
@@ -3206,6 +3223,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3206
3223
|
};
|
|
3207
3224
|
const visual = (bs) => bs.flatMap((b) => {
|
|
3208
3225
|
if (b.type !== "table") return [b];
|
|
3226
|
+
if (!hancom && b.table && CLIP_TABLES.has(b.table)) return [b];
|
|
3209
3227
|
let v = shown.get(b);
|
|
3210
3228
|
if (!v) {
|
|
3211
3229
|
markContent([b]);
|
|
@@ -3301,4 +3319,4 @@ export {
|
|
|
3301
3319
|
parsePdfDocument,
|
|
3302
3320
|
removeHeaderFooterBlocks
|
|
3303
3321
|
};
|
|
3304
|
-
//# sourceMappingURL=parser-
|
|
3322
|
+
//# sourceMappingURL=parser-VH3F4EQU.js.map
|