kordoc 4.22.0 → 4.22.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 +18 -9
- package/dist/{-KRYEEYOX.js → -C437ZARA.js} +11 -11
- package/dist/{chunk-HIM23MJP.js → chunk-2X64TI7I.js} +2 -2
- package/dist/{chunk-SP3DBTDN.js → chunk-3LJ6QO53.js} +28 -6
- package/dist/chunk-3LJ6QO53.js.map +1 -0
- package/dist/{chunk-PPYQUI3X.js → chunk-4BJZGXNM.js} +2 -2
- package/dist/{chunk-NKWY4UJ4.js → chunk-4GCS7WJJ.js} +2 -2
- package/dist/{chunk-BKEDPKXS.js → chunk-56GBOIOE.js} +2 -2
- package/dist/{chunk-GQJ4MFLT.cjs → chunk-AUWO57ED.cjs} +2 -2
- package/dist/{chunk-GQJ4MFLT.cjs.map → chunk-AUWO57ED.cjs.map} +1 -1
- package/dist/{chunk-2ZRU6WJQ.js → chunk-AXR7OKQY.js} +2 -2
- package/dist/{chunk-HI45PG3J.js → chunk-CNMUT5YW.js} +2 -2
- package/dist/{chunk-B4IKM3CG.js → chunk-DQXP3ELP.js} +2 -2
- package/dist/{chunk-EFO7H2D4.cjs → chunk-EKKZNKJD.cjs} +3 -3
- package/dist/{chunk-EFO7H2D4.cjs.map → chunk-EKKZNKJD.cjs.map} +1 -1
- package/dist/{chunk-LJSZ3HCI.cjs → chunk-ENV25MPM.cjs} +27 -26
- package/dist/chunk-ENV25MPM.cjs.map +1 -0
- package/dist/{chunk-7BJDDE7V.js → chunk-FPUBEM3F.js} +11 -11
- package/dist/{chunk-4W7GCW3Z.js → chunk-GFQIKYBV.js} +3 -3
- package/dist/{chunk-BXBOFBHR.js → chunk-GVBQVXXB.js} +2 -2
- package/dist/{chunk-BXBOFBHR.js.map → chunk-GVBQVXXB.js.map} +1 -1
- package/dist/{chunk-EXKBLZUH.cjs → chunk-I4BS4BXE.cjs} +188 -166
- package/dist/{chunk-EXKBLZUH.cjs.map → chunk-I4BS4BXE.cjs.map} +1 -1
- package/dist/{chunk-72DOHOTQ.js → chunk-IRP6QS3K.js} +3 -3
- package/dist/{chunk-VHDD33Q4.js → chunk-L6N4OMKR.js} +60 -28
- package/dist/chunk-L6N4OMKR.js.map +1 -0
- package/dist/{chunk-GWJV3FYA.js → chunk-L6PFPBTK.js} +2 -2
- package/dist/{chunk-DKSQ22RU.cjs → chunk-MED2MR6O.cjs} +6 -6
- package/dist/{chunk-DKSQ22RU.cjs.map → chunk-MED2MR6O.cjs.map} +1 -1
- package/dist/{chunk-7YVDZCHF.js → chunk-NGDMJICC.js} +29 -7
- package/dist/{chunk-SP3DBTDN.js.map → chunk-NGDMJICC.js.map} +1 -1
- package/dist/{chunk-PMVM7BS6.js → chunk-QFJCEHY7.js} +2 -2
- package/dist/{chunk-PMVM7BS6.js.map → chunk-QFJCEHY7.js.map} +1 -1
- package/dist/{chunk-DCXK7PYL.js → chunk-S4KQUVBV.js} +6 -5
- package/dist/{chunk-POPIFZOT.js.map → chunk-S4KQUVBV.js.map} +1 -1
- package/dist/{chunk-PWCVNTMX.js → chunk-U3TZVR7A.js} +2 -2
- package/dist/{chunk-POPIFZOT.js → chunk-UMNKY2EZ.js} +6 -5
- package/dist/{chunk-DCXK7PYL.js.map → chunk-UMNKY2EZ.js.map} +1 -1
- package/dist/{chunk-NNGZXPPA.js → chunk-UV2G6XFA.js} +2 -2
- package/dist/{chunk-746T2J3U.js → chunk-VUC4JJUM.js} +2 -2
- package/dist/{chunk-D5DRW3S5.js → chunk-YOFKJ7IM.js} +2 -2
- package/dist/{chunk-DZFGZBMV.js → chunk-YTEMFVZB.js} +2 -2
- package/dist/{chunk-GBQXV6MI.cjs → chunk-ZLFUZM7H.cjs} +3 -3
- package/dist/{chunk-GBQXV6MI.cjs.map → chunk-ZLFUZM7H.cjs.map} +1 -1
- package/dist/chunks-MPOOHZVO.js +10 -0
- package/dist/cli.js +30 -30
- package/dist/{formula-QPKCUYLS.cjs → formula-3TVRNJ66.cjs} +9 -9
- package/dist/{formula-QPKCUYLS.cjs.map → formula-3TVRNJ66.cjs.map} +1 -1
- package/dist/{formula-XSXXXRA6.js → formula-43QBPAL5.js} +4 -4
- package/dist/{formula-2G43QHEV.js → formula-HUENRCPJ.js} +3 -3
- package/dist/{image-ocr-XY3TUBYK.js → image-ocr-BAHDLDV5.js} +6 -6
- package/dist/{image-ocr-L46V4HIX.js → image-ocr-HYAKWJGE.js} +9 -9
- package/dist/{image-ocr-ZQMWJHKE.cjs → image-ocr-OC3TCXMV.cjs} +17 -17
- package/dist/{image-ocr-ZQMWJHKE.cjs.map → image-ocr-OC3TCXMV.cjs.map} +1 -1
- package/dist/index.cjs +356 -324
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +60 -28
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +22 -22
- package/dist/{model-bundle-QFDCCCI2.js → model-bundle-23WBSECG.js} +5 -5
- package/dist/{models-T2QBJSY5.js → models-NRZQY45P.js} +5 -5
- package/dist/{parse-worker-v2-PT6LULNS.js → parse-worker-v2-DPNXGJ73.js} +12 -12
- package/dist/{parser-2EIOJGOS.js → parser-FNUQW2F3.js} +73 -27
- package/dist/parser-FNUQW2F3.js.map +1 -0
- package/dist/{parser-BGSWEVUB.cjs → parser-OKAQRZKM.cjs} +318 -272
- package/dist/parser-OKAQRZKM.cjs.map +1 -0
- package/dist/{parser-LM6FNKVB.js → parser-XNOLC3MZ.js} +70 -24
- package/dist/parser-XNOLC3MZ.js.map +1 -0
- package/dist/pdf-ocr-6UXBIQE6.cjs +31 -0
- package/dist/pdf-ocr-6UXBIQE6.cjs.map +1 -0
- package/dist/{pdf-ocr-GSELGUFG.js → pdf-ocr-FAGA3O6B.js} +8 -6
- package/dist/{pdf-ocr-C5OFY2RY.js → pdf-ocr-N5LYC5LA.js} +11 -9
- package/dist/{profile-io-Y2TLZ62F.js → profile-io-HC6FMYX4.js} +3 -3
- package/dist/{rasterize-FB6MFPS3.js → rasterize-QLTROEV2.js} +3 -3
- package/dist/{redact-doc-AV2EOKPP.js → redact-doc-V4KMM2QV.js} +11 -11
- package/dist/{render-M5BW4TLH.js → render-V4S3QLTR.js} +7 -7
- package/dist/seal-MQ5TB5YZ.js +10 -0
- package/dist/{setup-DVKUFC73.js → setup-HU7ZOQNM.js} +3 -3
- package/dist/visual-RLIFC4XC.js +21 -0
- package/dist/{watch-S35AWINM.js → watch-NPIZ6DSJ.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-7YVDZCHF.js.map +0 -1
- package/dist/chunk-LJSZ3HCI.cjs.map +0 -1
- package/dist/chunk-VHDD33Q4.js.map +0 -1
- package/dist/chunks-5AVQEPIH.js +0 -10
- package/dist/parser-2EIOJGOS.js.map +0 -1
- package/dist/parser-BGSWEVUB.cjs.map +0 -1
- package/dist/parser-LM6FNKVB.js.map +0 -1
- package/dist/pdf-ocr-A2UWUATF.cjs +0 -29
- package/dist/pdf-ocr-A2UWUATF.cjs.map +0 -1
- package/dist/seal-JXYWI5CN.js +0 -10
- package/dist/visual-DBVBTOAV.js +0 -21
- /package/dist/{-KRYEEYOX.js.map → -C437ZARA.js.map} +0 -0
- /package/dist/{chunk-HIM23MJP.js.map → chunk-2X64TI7I.js.map} +0 -0
- /package/dist/{chunk-PPYQUI3X.js.map → chunk-4BJZGXNM.js.map} +0 -0
- /package/dist/{chunk-NKWY4UJ4.js.map → chunk-4GCS7WJJ.js.map} +0 -0
- /package/dist/{chunk-BKEDPKXS.js.map → chunk-56GBOIOE.js.map} +0 -0
- /package/dist/{chunk-2ZRU6WJQ.js.map → chunk-AXR7OKQY.js.map} +0 -0
- /package/dist/{chunk-HI45PG3J.js.map → chunk-CNMUT5YW.js.map} +0 -0
- /package/dist/{chunk-B4IKM3CG.js.map → chunk-DQXP3ELP.js.map} +0 -0
- /package/dist/{chunk-7BJDDE7V.js.map → chunk-FPUBEM3F.js.map} +0 -0
- /package/dist/{chunk-4W7GCW3Z.js.map → chunk-GFQIKYBV.js.map} +0 -0
- /package/dist/{chunk-72DOHOTQ.js.map → chunk-IRP6QS3K.js.map} +0 -0
- /package/dist/{chunk-GWJV3FYA.js.map → chunk-L6PFPBTK.js.map} +0 -0
- /package/dist/{chunk-PWCVNTMX.js.map → chunk-U3TZVR7A.js.map} +0 -0
- /package/dist/{chunk-NNGZXPPA.js.map → chunk-UV2G6XFA.js.map} +0 -0
- /package/dist/{chunk-746T2J3U.js.map → chunk-VUC4JJUM.js.map} +0 -0
- /package/dist/{chunk-D5DRW3S5.js.map → chunk-YOFKJ7IM.js.map} +0 -0
- /package/dist/{chunk-DZFGZBMV.js.map → chunk-YTEMFVZB.js.map} +0 -0
- /package/dist/{chunks-5AVQEPIH.js.map → chunks-MPOOHZVO.js.map} +0 -0
- /package/dist/{formula-XSXXXRA6.js.map → formula-43QBPAL5.js.map} +0 -0
- /package/dist/{formula-2G43QHEV.js.map → formula-HUENRCPJ.js.map} +0 -0
- /package/dist/{image-ocr-XY3TUBYK.js.map → image-ocr-BAHDLDV5.js.map} +0 -0
- /package/dist/{image-ocr-L46V4HIX.js.map → image-ocr-HYAKWJGE.js.map} +0 -0
- /package/dist/{model-bundle-QFDCCCI2.js.map → model-bundle-23WBSECG.js.map} +0 -0
- /package/dist/{models-T2QBJSY5.js.map → models-NRZQY45P.js.map} +0 -0
- /package/dist/{parse-worker-v2-PT6LULNS.js.map → parse-worker-v2-DPNXGJ73.js.map} +0 -0
- /package/dist/{pdf-ocr-C5OFY2RY.js.map → pdf-ocr-FAGA3O6B.js.map} +0 -0
- /package/dist/{pdf-ocr-GSELGUFG.js.map → pdf-ocr-N5LYC5LA.js.map} +0 -0
- /package/dist/{profile-io-Y2TLZ62F.js.map → profile-io-HC6FMYX4.js.map} +0 -0
- /package/dist/{rasterize-FB6MFPS3.js.map → rasterize-QLTROEV2.js.map} +0 -0
- /package/dist/{redact-doc-AV2EOKPP.js.map → redact-doc-V4KMM2QV.js.map} +0 -0
- /package/dist/{render-M5BW4TLH.js.map → render-V4S3QLTR.js.map} +0 -0
- /package/dist/{seal-JXYWI5CN.js.map → seal-MQ5TB5YZ.js.map} +0 -0
- /package/dist/{setup-DVKUFC73.js.map → setup-HU7ZOQNM.js.map} +0 -0
- /package/dist/{visual-DBVBTOAV.js.map → visual-RLIFC4XC.js.map} +0 -0
- /package/dist/{watch-S35AWINM.js.map → watch-NPIZ6DSJ.js.map} +0 -0
|
@@ -4,15 +4,15 @@ import {
|
|
|
4
4
|
HEADING_RATIO_H2,
|
|
5
5
|
HEADING_RATIO_H3,
|
|
6
6
|
tidyScriptTags
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-QFJCEHY7.js";
|
|
8
8
|
import {
|
|
9
9
|
ensureModelsIn,
|
|
10
10
|
getModelsDir
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4GCS7WJJ.js";
|
|
12
12
|
import {
|
|
13
13
|
safeMax,
|
|
14
14
|
safeMin
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-DQXP3ELP.js";
|
|
16
16
|
|
|
17
17
|
// src/ocr/models.ts
|
|
18
18
|
import { join } from "path";
|
|
@@ -969,6 +969,28 @@ function bridgeSkippedRowVerticals(horizontals, verticals, items) {
|
|
|
969
969
|
// src/pdf/line-types.ts
|
|
970
970
|
var VERTEX_MERGE_FACTOR = 4;
|
|
971
971
|
|
|
972
|
+
// src/pdf/shaded-row-bands.ts
|
|
973
|
+
function hasShadedRowBands(host, clips, fills, verticals, horizontals) {
|
|
974
|
+
const tol = 1.5;
|
|
975
|
+
const near2 = (a, b) => Math.abs(a - b) <= tol;
|
|
976
|
+
const bands = clips.filter((c) => Math.min(c.bbox.x2, host.bbox.x2) > Math.max(c.bbox.x1, host.bbox.x1) && Math.min(c.bbox.y2, host.bbox.y2) > Math.max(c.bbox.y1, host.bbox.y1));
|
|
977
|
+
if (bands.length < 2 || host.colXs.length < 3) return false;
|
|
978
|
+
if (!host.colXs.slice(1, -1).every((x) => verticals.some((v) => !v.fromFill && near2(v.x1, x) && v.y1 <= host.bbox.y1 + tol && v.y2 >= host.bbox.y2 - tol))) return false;
|
|
979
|
+
const covered = /* @__PURE__ */ new Set();
|
|
980
|
+
for (const band of bands) {
|
|
981
|
+
if (band.clipParent || !band.cells?.length || band.colXs.length !== host.colXs.length || !band.colXs.every((x, i) => near2(x, host.colXs[i]))) return false;
|
|
982
|
+
const start = host.rowYs.findIndex((y) => near2(y, band.rowYs[0]));
|
|
983
|
+
if (start < 0 || !band.rowYs.every((y, i) => near2(y, host.rowYs[start + i]))) return false;
|
|
984
|
+
if (!band.rowYs.every((y) => horizontals.some((h) => !h.fromFill && near2(h.y1, y) && h.x1 <= host.bbox.x1 + tol && h.x2 >= host.bbox.x2 - tol))) return false;
|
|
985
|
+
if (band.cells.length !== (band.rowYs.length - 1) * (band.colXs.length - 1) || !band.cells.every((cell) => !cell.filler && cell.rowSpan === 1 && cell.colSpan === 1 && near2(cell.bbox.x1, band.colXs[cell.col]) && near2(cell.bbox.x2, band.colXs[cell.col + 1]) && near2(cell.bbox.y2, band.rowYs[cell.row]) && near2(cell.bbox.y1, band.rowYs[cell.row + 1]) && fills.some((f) => near2(f.x1, cell.bbox.x1) && near2(f.x2, cell.bbox.x2) && near2(f.y1, cell.bbox.y1) && near2(f.y2, cell.bbox.y2)))) return false;
|
|
986
|
+
for (let i = 0; i < band.rowYs.length - 1; i++) {
|
|
987
|
+
if (covered.has(start + i)) return false;
|
|
988
|
+
covered.add(start + i);
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
return covered.size < host.rowYs.length - 1;
|
|
992
|
+
}
|
|
993
|
+
|
|
972
994
|
// src/pdf/table-grid.ts
|
|
973
995
|
var CONNECT_TOL = 5;
|
|
974
996
|
var MIN_COL_WIDTH = 15;
|
|
@@ -1179,7 +1201,7 @@ function buildTableGrids(horizontals, verticals, narrowRuns = true) {
|
|
|
1179
1201
|
}
|
|
1180
1202
|
var SHADE_CLIP_TOL = 1.5;
|
|
1181
1203
|
var SHADE_CLIP_MAX_AREA = 0.5;
|
|
1182
|
-
function dropShadingClipGrids(clipGrids, lineGrids, fillRects, verticals = []) {
|
|
1204
|
+
function dropShadingClipGrids(clipGrids, lineGrids, fillRects, verticals = [], horizontals = []) {
|
|
1183
1205
|
if (clipGrids.length === 0 || lineGrids.length === 0 || fillRects.length === 0) return clipGrids;
|
|
1184
1206
|
const near2 = (a, b) => Math.abs(a - b) <= SHADE_CLIP_TOL;
|
|
1185
1207
|
const area = (b) => Math.max(0, b.x2 - b.x1) * Math.max(0, b.y2 - b.y1);
|
|
@@ -1195,7 +1217,7 @@ function dropShadingClipGrids(clipGrids, lineGrids, fillRects, verticals = []) {
|
|
|
1195
1217
|
const host = lineGrids.find((l) => (
|
|
1196
1218
|
// Inferred filler cells carry no boundary evidence. Replace their frame only
|
|
1197
1219
|
// with a finer ruled grid of the same extent, never a larger surrounding form.
|
|
1198
|
-
(!c.cells.some((cell) => cell.filler) || near2(c.bbox.x1, l.bbox.x1) && near2(c.bbox.x2, l.bbox.x2) && near2(c.bbox.y1, l.bbox.y1) && near2(c.bbox.y2, l.bbox.y2) && l.rowYs.length > c.rowYs.length && sourceCells.every((cell) => [cell.bbox.y1, cell.bbox.y2].every((y) => l.rowYs.some((ly) => near2(y, ly))))) && c.bbox.x1 >= l.bbox.x1 - SHADE_CLIP_TOL && c.bbox.x2 <= l.bbox.x2 + SHADE_CLIP_TOL && c.bbox.y1 >= l.bbox.y1 - SHADE_CLIP_TOL && c.bbox.y2 <= l.bbox.y2 + SHADE_CLIP_TOL && c.colXs.every((x) => l.colXs.some((lx) => near2(lx, x))) && (clipGrids.reduce((s, o) => s + (o.cells?.some((cell) => cell.filler) ? o.cells.filter((cell) => !cell.filler).reduce((a, cell) => a + inter(cell.bbox, l.bbox), 0) : inter(o.bbox, l.bbox)), 0) <= area(l.bbox) * SHADE_CLIP_MAX_AREA || l.rowYs.length === c.rowYs.length + 1 && c.rowYs.every((y, i) => near2(y, l.rowYs[i])) && l.colXs.length === c.colXs.length && c.colXs.every((x, i) => near2(x, l.colXs[i])) && !clipGrids.some((o) => o !== c && inter(o.bbox, l.bbox) > 0))
|
|
1220
|
+
(!c.cells.some((cell) => cell.filler) || near2(c.bbox.x1, l.bbox.x1) && near2(c.bbox.x2, l.bbox.x2) && near2(c.bbox.y1, l.bbox.y1) && near2(c.bbox.y2, l.bbox.y2) && l.rowYs.length > c.rowYs.length && sourceCells.every((cell) => [cell.bbox.y1, cell.bbox.y2].every((y) => l.rowYs.some((ly) => near2(y, ly))))) && c.bbox.x1 >= l.bbox.x1 - SHADE_CLIP_TOL && c.bbox.x2 <= l.bbox.x2 + SHADE_CLIP_TOL && c.bbox.y1 >= l.bbox.y1 - SHADE_CLIP_TOL && c.bbox.y2 <= l.bbox.y2 + SHADE_CLIP_TOL && c.colXs.every((x) => l.colXs.some((lx) => near2(lx, x))) && (clipGrids.reduce((s, o) => s + (o.cells?.some((cell) => cell.filler) ? o.cells.filter((cell) => !cell.filler).reduce((a, cell) => a + inter(cell.bbox, l.bbox), 0) : inter(o.bbox, l.bbox)), 0) <= area(l.bbox) * SHADE_CLIP_MAX_AREA || l.rowYs.length === c.rowYs.length + 1 && c.rowYs.every((y, i) => near2(y, l.rowYs[i])) && l.colXs.length === c.colXs.length && c.colXs.every((x, i) => near2(x, l.colXs[i])) && !clipGrids.some((o) => o !== c && inter(o.bbox, l.bbox) > 0) || hasShadedRowBands(l, clipGrids, fillRects, verticals, horizontals))
|
|
1199
1221
|
));
|
|
1200
1222
|
return !host;
|
|
1201
1223
|
});
|
|
@@ -8099,7 +8121,7 @@ function extractPageBlocksWithLines(items, pageNum, opList, pageWidth, pageHeigh
|
|
|
8099
8121
|
if (shadedEdges) ({ horizontals, verticals } = shadedEdges);
|
|
8100
8122
|
const lineGrids = detectTables ? buildTableGrids(horizontals, verticals, !(items.length > 0 && items.every((it) => it.fontName === "ocr"))) : [];
|
|
8101
8123
|
if (shadedEdges) nestRestoredShadedGrids(lineGrids, shadedEdges.restored, horizontals, verticals);
|
|
8102
|
-
const tableClipGrids = dropHeadBandClipGrids(dropInsetClipGrids(dropShadingClipGrids(clipGrids, lineGrids, extracted.fillRects, verticals), lineGrids), lineGrids);
|
|
8124
|
+
const tableClipGrids = dropHeadBandClipGrids(dropInsetClipGrids(dropShadingClipGrids(clipGrids, lineGrids, extracted.fillRects, verticals, horizontals), lineGrids), lineGrids);
|
|
8103
8125
|
recordClipCellEdges(
|
|
8104
8126
|
extendNestedShadedHeaders(tableClipGrids, lineGrids, horizontals, verticals, extracted.fillRects),
|
|
8105
8127
|
extracted.horizontals.concat(extracted.shortH),
|
|
@@ -9074,4 +9096,4 @@ export {
|
|
|
9074
9096
|
UNRULED_REGION_TABLES,
|
|
9075
9097
|
mergeOcrImageRegions
|
|
9076
9098
|
};
|
|
9077
|
-
//# sourceMappingURL=chunk-
|
|
9099
|
+
//# sourceMappingURL=chunk-NGDMJICC.js.map
|