kordoc 4.22.3 → 4.22.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -6
- package/dist/{-AOWV7MNY.js → -HAK3YFWW.js} +11 -11
- package/dist/{chunk-M2X766AY.js → chunk-36DK6AOX.js} +2 -2
- package/dist/{chunk-3H2IEU4V.js → chunk-3TUJ34V7.js} +2 -2
- package/dist/{chunk-NLGOMLGU.cjs → chunk-4X7AR4EH.cjs} +34 -28
- package/dist/chunk-4X7AR4EH.cjs.map +1 -0
- package/dist/{chunk-DKJ2RNDG.js → chunk-5ARHF54C.js} +2 -2
- package/dist/{chunk-6LIBF2ZB.js → chunk-A3SKXHAN.js} +2 -2
- package/dist/{chunk-4NQ4EZEE.js → chunk-AYV5VRHL.js} +2 -2
- package/dist/{chunk-SKRWKVVW.js → chunk-C5J5LDWM.js} +14 -8
- package/dist/{chunk-SKRWKVVW.js.map → chunk-C5J5LDWM.js.map} +1 -1
- package/dist/{chunk-FDFXL7VJ.js → chunk-CWBH66IQ.js} +3 -3
- package/dist/{chunk-MEIQ476H.js → chunk-DEFT7Z3B.js} +2 -2
- package/dist/{chunk-YOGMCRM7.js → chunk-EVL6HZQL.js} +80 -69
- package/dist/chunk-EVL6HZQL.js.map +1 -0
- package/dist/{chunk-O3OS6FAW.cjs → chunk-EYQLJ57Y.cjs} +3 -3
- package/dist/{chunk-O3OS6FAW.cjs.map → chunk-EYQLJ57Y.cjs.map} +1 -1
- package/dist/{chunk-3ANXRVI2.js → chunk-F3AWNFMO.js} +3 -3
- package/dist/{chunk-AXX5AQT4.js → chunk-FAFSBCU2.js} +4 -4
- package/dist/{chunk-KBGNPGVY.js → chunk-G2325K2F.js} +2 -2
- package/dist/{chunk-7XITVUAK.js → chunk-G4KNI7EO.js} +11 -11
- package/dist/{chunk-OIF5HRVP.js → chunk-HN3QMHTT.js} +15 -9
- package/dist/{chunk-OIF5HRVP.js.map → chunk-HN3QMHTT.js.map} +1 -1
- package/dist/{chunk-SJ5OZXEL.cjs → chunk-K2NWHLCD.cjs} +6 -6
- package/dist/{chunk-SJ5OZXEL.cjs.map → chunk-K2NWHLCD.cjs.map} +1 -1
- package/dist/{chunk-24YLYR6Q.js → chunk-LVVSMYG4.js} +4 -4
- package/dist/{chunk-MI655NV5.cjs → chunk-MJSHXESK.cjs} +2 -2
- package/dist/{chunk-MI655NV5.cjs.map → chunk-MJSHXESK.cjs.map} +1 -1
- package/dist/{chunk-VJCQOSMT.js → chunk-MYTMZSQO.js} +2 -2
- package/dist/{chunk-X45Q7EAC.js → chunk-Q65HT2BL.js} +2 -2
- package/dist/{chunk-BS2XWGT5.js → chunk-Q6SVCBMK.js} +2 -2
- package/dist/{chunk-6QBBGZST.js → chunk-RPSILMQY.js} +2 -2
- package/dist/{chunk-NJEMRAIF.cjs → chunk-S45M7IQH.cjs} +24 -24
- package/dist/{chunk-NJEMRAIF.cjs.map → chunk-S45M7IQH.cjs.map} +1 -1
- package/dist/{chunk-O5E25RHU.js → chunk-SSL3TKJY.js} +2 -2
- package/dist/{chunk-J5PYESLX.js → chunk-UJVVL6BI.js} +2 -2
- package/dist/{chunk-2BCQVQO2.cjs → chunk-VXQWAPC6.cjs} +3 -3
- package/dist/{chunk-2BCQVQO2.cjs.map → chunk-VXQWAPC6.cjs.map} +1 -1
- package/dist/{chunk-UCLDUUBX.js → chunk-WCTC3LSV.js} +2 -2
- package/dist/{chunk-IRNWAHHZ.js → chunk-WNW77CAY.js} +2 -2
- package/dist/chunks-3N7OFSA4.js +10 -0
- package/dist/cli.js +30 -30
- package/dist/{formula-5V2WG4BH.cjs → formula-JGFYGFYX.cjs} +9 -9
- package/dist/{formula-5V2WG4BH.cjs.map → formula-JGFYGFYX.cjs.map} +1 -1
- package/dist/{formula-C26FMMGO.js → formula-KSTY73DQ.js} +3 -3
- package/dist/{formula-W4OL33YQ.js → formula-PWAUR5PF.js} +4 -4
- package/dist/{image-ocr-T72HMX2W.js → image-ocr-RASJHOAK.js} +6 -6
- package/dist/{image-ocr-NSQ34Y6T.js → image-ocr-RPBPO3VT.js} +9 -9
- package/dist/{image-ocr-BELHEWPX.cjs → image-ocr-UULNAC5Y.cjs} +17 -17
- package/dist/{image-ocr-BELHEWPX.cjs.map → image-ocr-UULNAC5Y.cjs.map} +1 -1
- package/dist/index.cjs +489 -478
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +80 -69
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +22 -22
- package/dist/{model-bundle-34T2LJB4.js → model-bundle-ZPQ4IFT7.js} +5 -5
- package/dist/{models-TQH5EM6V.js → models-YJQ5VHOR.js} +5 -5
- package/dist/{parse-worker-v2-YEYLILGJ.js → parse-worker-v2-7PNZYASF.js} +12 -12
- package/dist/{parser-E6BG3ECD.js → parser-DR6ZHYEB.js} +59 -10
- package/dist/parser-DR6ZHYEB.js.map +1 -0
- package/dist/{parser-SJHCBL7T.js → parser-ER3VLB37.js} +62 -13
- package/dist/parser-ER3VLB37.js.map +1 -0
- package/dist/{parser-OAXCXVQ4.cjs → parser-ZFXVZZKQ.cjs} +323 -274
- package/dist/parser-ZFXVZZKQ.cjs.map +1 -0
- package/dist/{pdf-ocr-LGPSJM22.js → pdf-ocr-BYT7XVID.js} +6 -6
- package/dist/{pdf-ocr-T5ASSUKK.js → pdf-ocr-DRQN5BXA.js} +9 -9
- package/dist/pdf-ocr-QWTGWYQT.cjs +31 -0
- package/dist/{pdf-ocr-RKXDY3ZA.cjs.map → pdf-ocr-QWTGWYQT.cjs.map} +1 -1
- package/dist/{profile-io-KMCAFTMG.js → profile-io-3QYTSPNH.js} +3 -3
- package/dist/{rasterize-M52AKY7R.js → rasterize-LPLWCBXV.js} +3 -3
- package/dist/{redact-doc-SWJC27LL.js → redact-doc-HDA6ZG3N.js} +11 -11
- package/dist/{render-45AB5YZR.js → render-MYZGD3SB.js} +7 -7
- package/dist/seal-XA5V6A6V.js +10 -0
- package/dist/{setup-5PBMUI6M.js → setup-EF5TQVAI.js} +3 -3
- package/dist/visual-DB7NJOID.js +21 -0
- package/dist/{watch-QOGKV52T.js → watch-PM5PRSFW.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-NLGOMLGU.cjs.map +0 -1
- package/dist/chunk-YOGMCRM7.js.map +0 -1
- package/dist/chunks-7KXTS7IV.js +0 -10
- package/dist/parser-E6BG3ECD.js.map +0 -1
- package/dist/parser-OAXCXVQ4.cjs.map +0 -1
- package/dist/parser-SJHCBL7T.js.map +0 -1
- package/dist/pdf-ocr-RKXDY3ZA.cjs +0 -31
- package/dist/seal-7KWG6VHS.js +0 -10
- package/dist/visual-OMJNXLNZ.js +0 -21
- /package/dist/{-AOWV7MNY.js.map → -HAK3YFWW.js.map} +0 -0
- /package/dist/{chunk-M2X766AY.js.map → chunk-36DK6AOX.js.map} +0 -0
- /package/dist/{chunk-3H2IEU4V.js.map → chunk-3TUJ34V7.js.map} +0 -0
- /package/dist/{chunk-DKJ2RNDG.js.map → chunk-5ARHF54C.js.map} +0 -0
- /package/dist/{chunk-6LIBF2ZB.js.map → chunk-A3SKXHAN.js.map} +0 -0
- /package/dist/{chunk-4NQ4EZEE.js.map → chunk-AYV5VRHL.js.map} +0 -0
- /package/dist/{chunk-FDFXL7VJ.js.map → chunk-CWBH66IQ.js.map} +0 -0
- /package/dist/{chunk-MEIQ476H.js.map → chunk-DEFT7Z3B.js.map} +0 -0
- /package/dist/{chunk-3ANXRVI2.js.map → chunk-F3AWNFMO.js.map} +0 -0
- /package/dist/{chunk-AXX5AQT4.js.map → chunk-FAFSBCU2.js.map} +0 -0
- /package/dist/{chunk-KBGNPGVY.js.map → chunk-G2325K2F.js.map} +0 -0
- /package/dist/{chunk-7XITVUAK.js.map → chunk-G4KNI7EO.js.map} +0 -0
- /package/dist/{chunk-24YLYR6Q.js.map → chunk-LVVSMYG4.js.map} +0 -0
- /package/dist/{chunk-VJCQOSMT.js.map → chunk-MYTMZSQO.js.map} +0 -0
- /package/dist/{chunk-X45Q7EAC.js.map → chunk-Q65HT2BL.js.map} +0 -0
- /package/dist/{chunk-BS2XWGT5.js.map → chunk-Q6SVCBMK.js.map} +0 -0
- /package/dist/{chunk-6QBBGZST.js.map → chunk-RPSILMQY.js.map} +0 -0
- /package/dist/{chunk-O5E25RHU.js.map → chunk-SSL3TKJY.js.map} +0 -0
- /package/dist/{chunk-J5PYESLX.js.map → chunk-UJVVL6BI.js.map} +0 -0
- /package/dist/{chunk-UCLDUUBX.js.map → chunk-WCTC3LSV.js.map} +0 -0
- /package/dist/{chunk-IRNWAHHZ.js.map → chunk-WNW77CAY.js.map} +0 -0
- /package/dist/{chunks-7KXTS7IV.js.map → chunks-3N7OFSA4.js.map} +0 -0
- /package/dist/{formula-C26FMMGO.js.map → formula-KSTY73DQ.js.map} +0 -0
- /package/dist/{formula-W4OL33YQ.js.map → formula-PWAUR5PF.js.map} +0 -0
- /package/dist/{image-ocr-T72HMX2W.js.map → image-ocr-RASJHOAK.js.map} +0 -0
- /package/dist/{image-ocr-NSQ34Y6T.js.map → image-ocr-RPBPO3VT.js.map} +0 -0
- /package/dist/{model-bundle-34T2LJB4.js.map → model-bundle-ZPQ4IFT7.js.map} +0 -0
- /package/dist/{models-TQH5EM6V.js.map → models-YJQ5VHOR.js.map} +0 -0
- /package/dist/{parse-worker-v2-YEYLILGJ.js.map → parse-worker-v2-7PNZYASF.js.map} +0 -0
- /package/dist/{pdf-ocr-LGPSJM22.js.map → pdf-ocr-BYT7XVID.js.map} +0 -0
- /package/dist/{pdf-ocr-T5ASSUKK.js.map → pdf-ocr-DRQN5BXA.js.map} +0 -0
- /package/dist/{profile-io-KMCAFTMG.js.map → profile-io-3QYTSPNH.js.map} +0 -0
- /package/dist/{rasterize-M52AKY7R.js.map → rasterize-LPLWCBXV.js.map} +0 -0
- /package/dist/{redact-doc-SWJC27LL.js.map → redact-doc-HDA6ZG3N.js.map} +0 -0
- /package/dist/{render-45AB5YZR.js.map → render-MYZGD3SB.js.map} +0 -0
- /package/dist/{seal-7KWG6VHS.js.map → seal-XA5V6A6V.js.map} +0 -0
- /package/dist/{setup-5PBMUI6M.js.map → setup-EF5TQVAI.js.map} +0 -0
- /package/dist/{visual-OMJNXLNZ.js.map → visual-DB7NJOID.js.map} +0 -0
- /package/dist/{watch-QOGKV52T.js.map → watch-PM5PRSFW.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
blocksToPages
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-G2325K2F.js";
|
|
5
5
|
import {
|
|
6
6
|
encodePng
|
|
7
7
|
} from "./chunk-VKVDMH7X.js";
|
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
stripAbsorbedRunningLines,
|
|
63
63
|
trimTrailingEmptyTableCols,
|
|
64
64
|
wrapJoiner
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-C5J5LDWM.js";
|
|
66
66
|
import {
|
|
67
67
|
validateOcrOptions
|
|
68
68
|
} from "./chunk-BHVOY6V4.js";
|
|
@@ -74,23 +74,23 @@ import {
|
|
|
74
74
|
escapeLiteralTags,
|
|
75
75
|
stripScriptTags,
|
|
76
76
|
unframeLayoutTables
|
|
77
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-AYV5VRHL.js";
|
|
78
78
|
import {
|
|
79
79
|
WINGDINGS,
|
|
80
80
|
assignTableIds,
|
|
81
81
|
blocksToMarkdown,
|
|
82
82
|
escapeLiteralDollar
|
|
83
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-Q6SVCBMK.js";
|
|
84
84
|
import {
|
|
85
85
|
ocrModelsCached,
|
|
86
86
|
resolveOcrModels
|
|
87
|
-
} from "./chunk-
|
|
88
|
-
import "./chunk-
|
|
89
|
-
import "./chunk-
|
|
87
|
+
} from "./chunk-MYTMZSQO.js";
|
|
88
|
+
import "./chunk-36DK6AOX.js";
|
|
89
|
+
import "./chunk-3TUJ34V7.js";
|
|
90
90
|
import {
|
|
91
91
|
KordocError,
|
|
92
92
|
sanitizeHref
|
|
93
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-5ARHF54C.js";
|
|
94
94
|
|
|
95
95
|
// src/pdf/image-extract.ts
|
|
96
96
|
import { createHash } from "crypto";
|
|
@@ -621,6 +621,55 @@ function ocrVectorOps(opList, paths) {
|
|
|
621
621
|
// src/pdf/split-row-pattern.ts
|
|
622
622
|
var textOf = (cell) => cell.text.replace(/<\/?u>|~~/g, "").trim();
|
|
623
623
|
var plain = (cell) => !cell.blocks?.length && !IMAGE_CELLS.has(cell);
|
|
624
|
+
var labelsOf = (cell) => {
|
|
625
|
+
const labels = textOf(cell).split("\n").map((s) => s.trim()).filter(Boolean);
|
|
626
|
+
return labels.length && labels.every((s) => /^\p{L}[\p{L}\p{N} ]{0,15}[::]$/u.test(s)) ? labels.map((s) => s.replace(/\s+/g, "").replace(/:/g, ":")) : void 0;
|
|
627
|
+
};
|
|
628
|
+
var alignedLabels = (label, value, count) => {
|
|
629
|
+
const L = CELL_LINES.get(label), V = CELL_LINES.get(value);
|
|
630
|
+
let next = 0;
|
|
631
|
+
return !!L && !!V && L.length === count && V.length >= count && Math.abs(L[0].y - V[0].y) <= 1 && L.every((l) => {
|
|
632
|
+
while (next < V.length && Math.abs(l.y - V[next].y) > 1) next++;
|
|
633
|
+
return next++ < V.length;
|
|
634
|
+
});
|
|
635
|
+
};
|
|
636
|
+
function matchesCompleteAlignedLabelListRow(table, owner, first) {
|
|
637
|
+
const pairs = [];
|
|
638
|
+
let carried = false;
|
|
639
|
+
for (let c = 0; c < table.cols; ) {
|
|
640
|
+
const u = owner[first - 1]?.[c], d = owner[first]?.[c];
|
|
641
|
+
if (u && u === d) {
|
|
642
|
+
carried = true;
|
|
643
|
+
c = u.c + u.cs;
|
|
644
|
+
continue;
|
|
645
|
+
}
|
|
646
|
+
const upper = u ? table.cells[u.r][u.c] : void 0, lower = d ? table.cells[d.r][d.c] : void 0;
|
|
647
|
+
if (!upper?.text.trim() && !lower?.text.trim()) {
|
|
648
|
+
c++;
|
|
649
|
+
continue;
|
|
650
|
+
}
|
|
651
|
+
if (!u || !d || !upper || !lower || u.r !== first - 1 || d.r !== first || u.c !== c || d.c !== c || u.rs !== 1 || d.rs !== 1 || u.cs !== d.cs || !plain(upper) || !plain(lower)) return false;
|
|
652
|
+
pairs.push({ c, cs: u.cs, upper, lower });
|
|
653
|
+
c += u.cs;
|
|
654
|
+
}
|
|
655
|
+
const filled = pairs.filter((p) => textOf(p.upper) && textOf(p.lower));
|
|
656
|
+
if (!carried || filled.length !== 2) return false;
|
|
657
|
+
const keyed = filled.filter((p) => labelsOf(p.upper) && labelsOf(p.lower));
|
|
658
|
+
if (keyed.length !== 1) return false;
|
|
659
|
+
const label = keyed[0], value = filled.find((p) => p !== label);
|
|
660
|
+
const U = labelsOf(label.upper), D = labelsOf(label.lower), sequence = [...U, ...D];
|
|
661
|
+
if (D.length < 2 || sequence.length < 3 || new Set(sequence).size !== sequence.length || value.c !== label.c + label.cs || pairs.some((p) => p !== label && p !== value && textOf(p.lower)) || !pairs.some((p) => p.c < label.c && textOf(p.upper) && !textOf(p.lower)) || !alignedLabels(label.upper, value.upper, U.length) || !alignedLabels(label.lower, value.lower, D.length)) return false;
|
|
662
|
+
let peers = 0;
|
|
663
|
+
for (let r = 0; r < table.rows; r++) {
|
|
664
|
+
if (r === first - 1 || r === first) continue;
|
|
665
|
+
const L = owner[r]?.[label.c], V = owner[r]?.[value.c];
|
|
666
|
+
if (L?.r !== r || V?.r !== r || L.c !== label.c || V.c !== value.c || L.rs !== 1 || V.rs !== 1 || L.cs !== label.cs || V.cs !== value.cs) continue;
|
|
667
|
+
const l = table.cells[r][label.c], v = table.cells[r][value.c];
|
|
668
|
+
if (!plain(l) || !plain(v) || !textOf(v) || labelsOf(l)?.join("|") !== sequence.join("|") || !alignedLabels(l, v, sequence.length)) continue;
|
|
669
|
+
if (++peers >= 2) return true;
|
|
670
|
+
}
|
|
671
|
+
return false;
|
|
672
|
+
}
|
|
624
673
|
function matchesIndependentRowPair(table, owner, first) {
|
|
625
674
|
const norm = (cell) => textOf(cell).replace(/\s+/g, "");
|
|
626
675
|
const pairs = [];
|
|
@@ -1405,7 +1454,7 @@ function mergeSplitRow(table, owner, first, colXs, textOnly = false, cut = NO_CU
|
|
|
1405
1454
|
if (!(cut.open && !newCell)) {
|
|
1406
1455
|
if (pairs.some((p) => p[1].rs > 1 && !flows(p))) return false;
|
|
1407
1456
|
const one = pairs.filter(([, d]) => d.rs === 1);
|
|
1408
|
-
if (!matchesCompleteSiblingRow(table, owner, first) && !matchesCompleteRubricRow(table, owner, first) && !(cut.ruled && matchesCompleteContextRow(table, owner, first)) && !outlineOnly(pairs, cell) && !one.some(flows) && (cut.list === "none" || !one.some(([u, d]) => listContinues(cell(u), cell(d), cut.list === "multi")))) return false;
|
|
1457
|
+
if (!matchesCompleteSiblingRow(table, owner, first) && !matchesCompleteRubricRow(table, owner, first) && !(cut.ruled && (matchesCompleteContextRow(table, owner, first) || matchesCompleteAlignedLabelListRow(table, owner, first))) && !outlineOnly(pairs, cell) && !one.some(flows) && (cut.list === "none" || !one.some(([u, d]) => listContinues(cell(u), cell(d), cut.list === "multi")))) return false;
|
|
1409
1458
|
}
|
|
1410
1459
|
}
|
|
1411
1460
|
for (const [u, d] of pairs) {
|
|
@@ -3433,7 +3482,7 @@ function mergeLinkRuns(markdown) {
|
|
|
3433
3482
|
|
|
3434
3483
|
// src/pdf/formula-ocr.ts
|
|
3435
3484
|
async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
|
|
3436
|
-
const formulaMod = await import("./formula-
|
|
3485
|
+
const formulaMod = await import("./formula-PWAUR5PF.js");
|
|
3437
3486
|
const { FormulaPipeline, ensureFormulaModels } = formulaMod;
|
|
3438
3487
|
await ensureFormulaModels((p) => {
|
|
3439
3488
|
if (p.phase === "download" && p.total) {
|
|
@@ -3859,10 +3908,10 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3859
3908
|
}
|
|
3860
3909
|
if (targets.size > 0) {
|
|
3861
3910
|
try {
|
|
3862
|
-
const { runPdfOcr } = await import("./pdf-ocr-
|
|
3911
|
+
const { runPdfOcr } = await import("./pdf-ocr-DRQN5BXA.js");
|
|
3863
3912
|
const mode = typeof options?.ocr === "function" ? options.ocr : "builtin";
|
|
3864
3913
|
const regionPages = new Map([...ocrRegions].filter(([p]) => options?.ocr !== "force" && !isImageBased && !pageQuality.find((q) => q.page === p)?.needsOcr));
|
|
3865
|
-
const { builtinOcrConfig } = await import("./pdf-ocr-
|
|
3914
|
+
const { builtinOcrConfig } = await import("./pdf-ocr-DRQN5BXA.js");
|
|
3866
3915
|
const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, options?.onProgress, options?.tables !== false, vectorPageOps, regionPages, builtinOcrConfig(options), ocrLinesOut);
|
|
3867
3916
|
for (const obs of ocrPageBlocks.values()) stripScriptTags({ blocks: obs });
|
|
3868
3917
|
if (ocrPageBlocks.size > 0) {
|
|
@@ -4107,4 +4156,4 @@ export {
|
|
|
4107
4156
|
parsePdfDocument,
|
|
4108
4157
|
removeHeaderFooterBlocks
|
|
4109
4158
|
};
|
|
4110
|
-
//# sourceMappingURL=parser-
|
|
4159
|
+
//# sourceMappingURL=parser-ER3VLB37.js.map
|