kordoc 4.22.2 → 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 +11 -6
- package/dist/{-C437ZARA.js → -HAK3YFWW.js} +11 -11
- package/dist/{chunk-UV2G6XFA.js → chunk-36DK6AOX.js} +2 -2
- package/dist/{chunk-CNMUT5YW.js → chunk-3TUJ34V7.js} +2 -2
- package/dist/{chunk-I4BS4BXE.cjs → chunk-4X7AR4EH.cjs} +34 -28
- package/dist/chunk-4X7AR4EH.cjs.map +1 -0
- package/dist/{chunk-4BJZGXNM.js → chunk-5ARHF54C.js} +2 -2
- package/dist/{chunk-56GBOIOE.js → chunk-A3SKXHAN.js} +2 -2
- package/dist/{chunk-GVBQVXXB.js → chunk-AYV5VRHL.js} +14 -4
- package/dist/chunk-AYV5VRHL.js.map +1 -0
- package/dist/{chunk-3LJ6QO53.js → chunk-C5J5LDWM.js} +14 -8
- package/dist/{chunk-3LJ6QO53.js.map → chunk-C5J5LDWM.js.map} +1 -1
- package/dist/{chunk-IRP6QS3K.js → chunk-CWBH66IQ.js} +3 -3
- package/dist/{chunk-YTEMFVZB.js → chunk-DEFT7Z3B.js} +2 -2
- package/dist/{chunk-L6N4OMKR.js → chunk-EVL6HZQL.js} +128 -70
- package/dist/chunk-EVL6HZQL.js.map +1 -0
- package/dist/{chunk-ZLFUZM7H.cjs → chunk-EYQLJ57Y.cjs} +3 -3
- package/dist/{chunk-ZLFUZM7H.cjs.map → chunk-EYQLJ57Y.cjs.map} +1 -1
- package/dist/{chunk-GFQIKYBV.js → chunk-F3AWNFMO.js} +3 -3
- package/dist/{chunk-S4KQUVBV.js → chunk-FAFSBCU2.js} +4 -4
- package/dist/{chunk-AXR7OKQY.js → chunk-G2325K2F.js} +2 -2
- package/dist/{chunk-FPUBEM3F.js → chunk-G4KNI7EO.js} +11 -11
- package/dist/{chunk-NGDMJICC.js → chunk-HN3QMHTT.js} +15 -9
- package/dist/{chunk-NGDMJICC.js.map → chunk-HN3QMHTT.js.map} +1 -1
- package/dist/{chunk-MED2MR6O.cjs → chunk-K2NWHLCD.cjs} +23 -13
- package/dist/chunk-K2NWHLCD.cjs.map +1 -0
- package/dist/{chunk-UMNKY2EZ.js → chunk-LVVSMYG4.js} +4 -4
- package/dist/{chunk-AUWO57ED.cjs → chunk-MJSHXESK.cjs} +2 -2
- package/dist/{chunk-AUWO57ED.cjs.map → chunk-MJSHXESK.cjs.map} +1 -1
- package/dist/{chunk-L6PFPBTK.js → chunk-MYTMZSQO.js} +2 -2
- package/dist/{chunk-DQXP3ELP.js → chunk-Q65HT2BL.js} +2 -2
- package/dist/{chunk-U3TZVR7A.js → chunk-Q6SVCBMK.js} +2 -2
- package/dist/{chunk-2X64TI7I.js → chunk-RPSILMQY.js} +2 -2
- package/dist/{chunk-ENV25MPM.cjs → chunk-S45M7IQH.cjs} +24 -24
- package/dist/{chunk-ENV25MPM.cjs.map → chunk-S45M7IQH.cjs.map} +1 -1
- package/dist/{chunk-4GCS7WJJ.js → chunk-SSL3TKJY.js} +2 -2
- package/dist/{chunk-QFJCEHY7.js → chunk-UJVVL6BI.js} +14 -4
- package/dist/chunk-UJVVL6BI.js.map +1 -0
- package/dist/{chunk-EKKZNKJD.cjs → chunk-VXQWAPC6.cjs} +3 -3
- package/dist/{chunk-EKKZNKJD.cjs.map → chunk-VXQWAPC6.cjs.map} +1 -1
- package/dist/{chunk-VUC4JJUM.js → chunk-WCTC3LSV.js} +2 -2
- package/dist/{chunk-YOFKJ7IM.js → chunk-WNW77CAY.js} +2 -2
- package/dist/chunks-3N7OFSA4.js +10 -0
- package/dist/cli.js +30 -30
- package/dist/{formula-3TVRNJ66.cjs → formula-JGFYGFYX.cjs} +9 -9
- package/dist/{formula-3TVRNJ66.cjs.map → formula-JGFYGFYX.cjs.map} +1 -1
- package/dist/{formula-HUENRCPJ.js → formula-KSTY73DQ.js} +3 -3
- package/dist/{formula-43QBPAL5.js → formula-PWAUR5PF.js} +4 -4
- package/dist/{image-ocr-BAHDLDV5.js → image-ocr-RASJHOAK.js} +6 -6
- package/dist/{image-ocr-HYAKWJGE.js → image-ocr-RPBPO3VT.js} +9 -9
- package/dist/{image-ocr-OC3TCXMV.cjs → image-ocr-UULNAC5Y.cjs} +17 -17
- package/dist/{image-ocr-OC3TCXMV.cjs.map → image-ocr-UULNAC5Y.cjs.map} +1 -1
- package/dist/index.cjs +536 -478
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +128 -70
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +22 -22
- package/dist/{model-bundle-23WBSECG.js → model-bundle-ZPQ4IFT7.js} +5 -5
- package/dist/{models-NRZQY45P.js → models-YJQ5VHOR.js} +5 -5
- package/dist/{parse-worker-v2-DPNXGJ73.js → parse-worker-v2-7PNZYASF.js} +12 -12
- package/dist/{parser-XNOLC3MZ.js → parser-DR6ZHYEB.js} +121 -12
- package/dist/parser-DR6ZHYEB.js.map +1 -0
- package/dist/{parser-FNUQW2F3.js → parser-ER3VLB37.js} +124 -15
- package/dist/parser-ER3VLB37.js.map +1 -0
- package/dist/{parser-OKAQRZKM.cjs → parser-ZFXVZZKQ.cjs} +376 -267
- package/dist/parser-ZFXVZZKQ.cjs.map +1 -0
- package/dist/{pdf-ocr-FAGA3O6B.js → pdf-ocr-BYT7XVID.js} +6 -6
- package/dist/{pdf-ocr-N5LYC5LA.js → pdf-ocr-DRQN5BXA.js} +9 -9
- package/dist/pdf-ocr-QWTGWYQT.cjs +31 -0
- package/dist/{pdf-ocr-6UXBIQE6.cjs.map → pdf-ocr-QWTGWYQT.cjs.map} +1 -1
- package/dist/{profile-io-HC6FMYX4.js → profile-io-3QYTSPNH.js} +3 -3
- package/dist/{rasterize-QLTROEV2.js → rasterize-LPLWCBXV.js} +3 -3
- package/dist/{redact-doc-V4KMM2QV.js → redact-doc-HDA6ZG3N.js} +11 -11
- package/dist/{render-V4S3QLTR.js → render-MYZGD3SB.js} +7 -7
- package/dist/seal-XA5V6A6V.js +10 -0
- package/dist/{setup-HU7ZOQNM.js → setup-EF5TQVAI.js} +3 -3
- package/dist/visual-DB7NJOID.js +21 -0
- package/dist/{watch-NPIZ6DSJ.js → watch-PM5PRSFW.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-GVBQVXXB.js.map +0 -1
- package/dist/chunk-I4BS4BXE.cjs.map +0 -1
- package/dist/chunk-L6N4OMKR.js.map +0 -1
- package/dist/chunk-MED2MR6O.cjs.map +0 -1
- package/dist/chunk-QFJCEHY7.js.map +0 -1
- package/dist/chunks-MPOOHZVO.js +0 -10
- package/dist/parser-FNUQW2F3.js.map +0 -1
- package/dist/parser-OKAQRZKM.cjs.map +0 -1
- package/dist/parser-XNOLC3MZ.js.map +0 -1
- package/dist/pdf-ocr-6UXBIQE6.cjs +0 -31
- package/dist/seal-MQ5TB5YZ.js +0 -10
- package/dist/visual-RLIFC4XC.js +0 -21
- /package/dist/{-C437ZARA.js.map → -HAK3YFWW.js.map} +0 -0
- /package/dist/{chunk-UV2G6XFA.js.map → chunk-36DK6AOX.js.map} +0 -0
- /package/dist/{chunk-CNMUT5YW.js.map → chunk-3TUJ34V7.js.map} +0 -0
- /package/dist/{chunk-4BJZGXNM.js.map → chunk-5ARHF54C.js.map} +0 -0
- /package/dist/{chunk-56GBOIOE.js.map → chunk-A3SKXHAN.js.map} +0 -0
- /package/dist/{chunk-IRP6QS3K.js.map → chunk-CWBH66IQ.js.map} +0 -0
- /package/dist/{chunk-YTEMFVZB.js.map → chunk-DEFT7Z3B.js.map} +0 -0
- /package/dist/{chunk-GFQIKYBV.js.map → chunk-F3AWNFMO.js.map} +0 -0
- /package/dist/{chunk-S4KQUVBV.js.map → chunk-FAFSBCU2.js.map} +0 -0
- /package/dist/{chunk-AXR7OKQY.js.map → chunk-G2325K2F.js.map} +0 -0
- /package/dist/{chunk-FPUBEM3F.js.map → chunk-G4KNI7EO.js.map} +0 -0
- /package/dist/{chunk-UMNKY2EZ.js.map → chunk-LVVSMYG4.js.map} +0 -0
- /package/dist/{chunk-L6PFPBTK.js.map → chunk-MYTMZSQO.js.map} +0 -0
- /package/dist/{chunk-DQXP3ELP.js.map → chunk-Q65HT2BL.js.map} +0 -0
- /package/dist/{chunk-U3TZVR7A.js.map → chunk-Q6SVCBMK.js.map} +0 -0
- /package/dist/{chunk-2X64TI7I.js.map → chunk-RPSILMQY.js.map} +0 -0
- /package/dist/{chunk-4GCS7WJJ.js.map → chunk-SSL3TKJY.js.map} +0 -0
- /package/dist/{chunk-VUC4JJUM.js.map → chunk-WCTC3LSV.js.map} +0 -0
- /package/dist/{chunk-YOFKJ7IM.js.map → chunk-WNW77CAY.js.map} +0 -0
- /package/dist/{chunks-MPOOHZVO.js.map → chunks-3N7OFSA4.js.map} +0 -0
- /package/dist/{formula-HUENRCPJ.js.map → formula-KSTY73DQ.js.map} +0 -0
- /package/dist/{formula-43QBPAL5.js.map → formula-PWAUR5PF.js.map} +0 -0
- /package/dist/{image-ocr-BAHDLDV5.js.map → image-ocr-RASJHOAK.js.map} +0 -0
- /package/dist/{image-ocr-HYAKWJGE.js.map → image-ocr-RPBPO3VT.js.map} +0 -0
- /package/dist/{model-bundle-23WBSECG.js.map → model-bundle-ZPQ4IFT7.js.map} +0 -0
- /package/dist/{models-NRZQY45P.js.map → models-YJQ5VHOR.js.map} +0 -0
- /package/dist/{parse-worker-v2-DPNXGJ73.js.map → parse-worker-v2-7PNZYASF.js.map} +0 -0
- /package/dist/{pdf-ocr-FAGA3O6B.js.map → pdf-ocr-BYT7XVID.js.map} +0 -0
- /package/dist/{pdf-ocr-N5LYC5LA.js.map → pdf-ocr-DRQN5BXA.js.map} +0 -0
- /package/dist/{profile-io-HC6FMYX4.js.map → profile-io-3QYTSPNH.js.map} +0 -0
- /package/dist/{rasterize-QLTROEV2.js.map → rasterize-LPLWCBXV.js.map} +0 -0
- /package/dist/{redact-doc-V4KMM2QV.js.map → redact-doc-HDA6ZG3N.js.map} +0 -0
- /package/dist/{render-V4S3QLTR.js.map → render-MYZGD3SB.js.map} +0 -0
- /package/dist/{seal-MQ5TB5YZ.js.map → seal-XA5V6A6V.js.map} +0 -0
- /package/dist/{setup-HU7ZOQNM.js.map → setup-EF5TQVAI.js.map} +0 -0
- /package/dist/{visual-RLIFC4XC.js.map → visual-DB7NJOID.js.map} +0 -0
- /package/dist/{watch-NPIZ6DSJ.js.map → watch-PM5PRSFW.js.map} +0 -0
package/dist/mcp.js
CHANGED
|
@@ -38,33 +38,33 @@ import {
|
|
|
38
38
|
resolveBuiltinTemplate,
|
|
39
39
|
unknownFontWarnings,
|
|
40
40
|
usesGaejosikMunche
|
|
41
|
-
} from "./chunk-
|
|
42
|
-
import "./chunk-
|
|
41
|
+
} from "./chunk-G4KNI7EO.js";
|
|
42
|
+
import "./chunk-A3SKXHAN.js";
|
|
43
43
|
import {
|
|
44
44
|
detectFormat,
|
|
45
45
|
detectOle2Format,
|
|
46
46
|
detectZipFormat,
|
|
47
47
|
extractHwp5MetadataOnly
|
|
48
|
-
} from "./chunk-
|
|
49
|
-
import "./chunk-
|
|
50
|
-
import "./chunk-
|
|
48
|
+
} from "./chunk-EVL6HZQL.js";
|
|
49
|
+
import "./chunk-RPSILMQY.js";
|
|
50
|
+
import "./chunk-G2325K2F.js";
|
|
51
51
|
import "./chunk-VKVDMH7X.js";
|
|
52
52
|
import "./chunk-VQFA55IC.js";
|
|
53
53
|
import "./chunk-BHVOY6V4.js";
|
|
54
|
-
import "./chunk-
|
|
54
|
+
import "./chunk-AYV5VRHL.js";
|
|
55
55
|
import {
|
|
56
56
|
blocksToMarkdown
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-Q6SVCBMK.js";
|
|
58
58
|
import {
|
|
59
59
|
assertWithinRoot,
|
|
60
60
|
getAccessRoot,
|
|
61
61
|
isOfflineMode
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-3TUJ34V7.js";
|
|
63
63
|
import {
|
|
64
64
|
extractFormFields,
|
|
65
65
|
fillWithUniqueGuard
|
|
66
|
-
} from "./chunk-
|
|
67
|
-
import "./chunk-
|
|
66
|
+
} from "./chunk-F3AWNFMO.js";
|
|
67
|
+
import "./chunk-WCTC3LSV.js";
|
|
68
68
|
import {
|
|
69
69
|
KordocError,
|
|
70
70
|
VERSION,
|
|
@@ -72,7 +72,7 @@ import {
|
|
|
72
72
|
routeConsoleToStderr,
|
|
73
73
|
sanitizeError,
|
|
74
74
|
toArrayBuffer
|
|
75
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-5ARHF54C.js";
|
|
76
76
|
import "./chunk-3WSNLH4B.js";
|
|
77
77
|
|
|
78
78
|
// src/mcp.ts
|
|
@@ -371,7 +371,7 @@ ${markdown}`);
|
|
|
371
371
|
break;
|
|
372
372
|
case "pdf":
|
|
373
373
|
try {
|
|
374
|
-
const { extractPdfMetadataOnly } = await import("./parser-
|
|
374
|
+
const { extractPdfMetadataOnly } = await import("./parser-ER3VLB37.js");
|
|
375
375
|
metadata = await extractPdfMetadataOnly(buffer);
|
|
376
376
|
} catch {
|
|
377
377
|
metadata = void 0;
|
|
@@ -548,7 +548,7 @@ ${tableMarkdown}` }]
|
|
|
548
548
|
if (!parsed.success) {
|
|
549
549
|
return { content: [{ type: "text", text: `\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}` }], isError: true };
|
|
550
550
|
}
|
|
551
|
-
const { blocksToChunks } = await import("./chunks-
|
|
551
|
+
const { blocksToChunks } = await import("./chunks-3N7OFSA4.js");
|
|
552
552
|
const chunks = blocksToChunks(parsed.blocks, { granularity, includeTableCells: include_table_cells });
|
|
553
553
|
return { content: [{ type: "text", text: capResponseText(JSON.stringify(chunks, null, 2)) }] };
|
|
554
554
|
} catch (err) {
|
|
@@ -818,7 +818,7 @@ ${previewMd}` }]
|
|
|
818
818
|
}
|
|
819
819
|
const image = new Uint8Array(await readFile2(imgResolved));
|
|
820
820
|
const ext = extname2(imgResolved).slice(1).toLowerCase();
|
|
821
|
-
const { placeSealHwpx } = await import("./seal-
|
|
821
|
+
const { placeSealHwpx } = await import("./seal-XA5V6A6V.js");
|
|
822
822
|
const result = await placeSealHwpx(buffer, [{
|
|
823
823
|
anchor,
|
|
824
824
|
occurrence,
|
|
@@ -935,7 +935,7 @@ ${previewMd}` }]
|
|
|
935
935
|
if (outPath && await isSameFile(outPath, resolved)) {
|
|
936
936
|
return { content: [{ type: "text", text: "output_path\uAC00 \uC785\uB825 \uD30C\uC77C\uACFC \uAC19\uC2B5\uB2C8\uB2E4 \u2014 \uC6D0\uBCF8\uC744 \uB36E\uC5B4\uC4F0\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. \uB2E4\uB978 \uACBD\uB85C\uB97C \uC9C0\uC815\uD558\uC138\uC694." }], isError: true };
|
|
937
937
|
}
|
|
938
|
-
const { redactDocument } = await import("./redact-doc-
|
|
938
|
+
const { redactDocument } = await import("./redact-doc-HDA6ZG3N.js");
|
|
939
939
|
const r = await redactDocument(buffer, { rules, maskChar: mask_char, filePath: file_path, dryRun: dry_run });
|
|
940
940
|
const MAX_LINES = 50;
|
|
941
941
|
const listed = r.fileHits.length > 0 ? r.fileHits.map((h) => ` - [${h.rule}] ${h.masked} (${h.where} @ ${h.part})`) : r.markdownHits.map((h) => ` - [${h.rule}] ${h.masked}`);
|
|
@@ -1009,7 +1009,7 @@ function registerRenderTools(server2) {
|
|
|
1009
1009
|
const { buffer, resolved } = await readValidatedFile(file_path, MAX_FILE_SIZE, /* @__PURE__ */ new Set([".hwpx", ".hwp"]));
|
|
1010
1010
|
const isHwp5 = resolved.toLowerCase().endsWith(".hwp");
|
|
1011
1011
|
if (!isHwp5 && !pages && (format === "png" || format === "svg")) {
|
|
1012
|
-
const { renderHwpxToSvg } = await import("./render-
|
|
1012
|
+
const { renderHwpxToSvg } = await import("./render-MYZGD3SB.js");
|
|
1013
1013
|
const result = await renderHwpxToSvg(buffer, { highlights, reflow: true, reflowMode: reflow_mode });
|
|
1014
1014
|
const summary2 = [
|
|
1015
1015
|
`\uB80C\uB354 \uC644\uB8CC: ${result.pageCount}\uD398\uC774\uC9C0, ${Math.round(result.width)}x${Math.round(result.height)}pt (\uD14D\uC2A4\uD2B8 ${result.stats.texts}\xB7\uC774\uBBF8\uC9C0 ${result.stats.images}\xB7\uD45C ${result.stats.tables})`,
|
|
@@ -1021,7 +1021,7 @@ function registerRenderTools(server2) {
|
|
|
1021
1021
|
summary2.push(`\uC800\uC7A5: ${outPath}`);
|
|
1022
1022
|
return { content: [{ type: "text", text: summary2.join("\n") }] };
|
|
1023
1023
|
}
|
|
1024
|
-
const { rasterizeSvg } = await import("./rasterize-
|
|
1024
|
+
const { rasterizeSvg } = await import("./rasterize-LPLWCBXV.js");
|
|
1025
1025
|
const raster = await rasterizeSvg(result.svg, result.width, result.height, max_width_px ? { maxWidthPx: max_width_px } : void 0);
|
|
1026
1026
|
if (outPath) {
|
|
1027
1027
|
await mkdir2(dirname3(outPath), { recursive: true });
|
|
@@ -1036,7 +1036,7 @@ function registerRenderTools(server2) {
|
|
|
1036
1036
|
]
|
|
1037
1037
|
};
|
|
1038
1038
|
}
|
|
1039
|
-
const { renderDocument } = await import("./render-
|
|
1039
|
+
const { renderDocument } = await import("./render-MYZGD3SB.js");
|
|
1040
1040
|
const { scene, assets } = await renderDocument(buffer, { format, pages, highlights, reflow: true, reflowMode: reflow_mode, maxWidthPx: max_width_px });
|
|
1041
1041
|
const summary = [
|
|
1042
1042
|
`\uB80C\uB354 \uC644\uB8CC: \uBB38\uC11C ${scene.pages.length}\uD398\uC774\uC9C0 \uC911 ${assets.filter((a) => a.page !== void 0).length || 1}\uAC74 (\uD14D\uC2A4\uD2B8 ${scene.stats.texts}\xB7\uC774\uBBF8\uC9C0 ${scene.stats.images}\xB7\uD45C ${scene.stats.tables}\xB7\uB3C4\uD615 ${scene.stats.shapes})`,
|
|
@@ -1086,7 +1086,7 @@ function registerRenderTools(server2) {
|
|
|
1086
1086
|
try {
|
|
1087
1087
|
const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, /* @__PURE__ */ new Set([".hwpx", ".hwp"]));
|
|
1088
1088
|
const dir = safeOutputPath(join2(output_dir, "regions.json"), /* @__PURE__ */ new Set([".json"])).replace(/[\\/]regions\.json$/, "");
|
|
1089
|
-
const { extractRenderedRegions } = await import("./render-
|
|
1089
|
+
const { extractRenderedRegions } = await import("./render-MYZGD3SB.js");
|
|
1090
1090
|
const regions = await extractRenderedRegions(buffer, { types: target, format, pages, paddingPt: padding_pt, reflow: true });
|
|
1091
1091
|
await mkdir2(dir, { recursive: true });
|
|
1092
1092
|
const ext = format === "jpeg" ? "jpg" : "png";
|
|
@@ -1122,7 +1122,7 @@ function registerRenderTools(server2) {
|
|
|
1122
1122
|
}
|
|
1123
1123
|
const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, /* @__PURE__ */ new Set([".hwpx", ".hwp"]));
|
|
1124
1124
|
const dir = output_dir ? safeOutputPath(join2(output_dir, "tables.json"), /* @__PURE__ */ new Set([".json"])).replace(/[\\/]tables\.json$/, "") : void 0;
|
|
1125
|
-
const { extractTables } = await import("./visual-
|
|
1125
|
+
const { extractTables } = await import("./visual-DB7NJOID.js");
|
|
1126
1126
|
const tables = await extractTables(buffer, { policy: visual, format, paddingPt: padding_pt });
|
|
1127
1127
|
if (dir) await mkdir2(dir, { recursive: true });
|
|
1128
1128
|
const ext = format === "jpeg" ? "jpg" : "png";
|
|
@@ -1179,7 +1179,7 @@ function registerGenerateTools(server2) {
|
|
|
1179
1179
|
try {
|
|
1180
1180
|
const out = safeOutputPath(output_path, PROFILE_EXTENSIONS);
|
|
1181
1181
|
const { buffer } = await readValidatedFile(hwpx_path);
|
|
1182
|
-
const { hwpxToProfile } = await import("./-
|
|
1182
|
+
const { hwpxToProfile } = await import("./-HAK3YFWW.js");
|
|
1183
1183
|
const profile = await hwpxToProfile(buffer);
|
|
1184
1184
|
await mkdir3(dirname4(out), { recursive: true });
|
|
1185
1185
|
await writeOutputFile(out, JSON.stringify(profile, null, 2));
|
|
@@ -1292,7 +1292,7 @@ function registerGenerateTools(server2) {
|
|
|
1292
1292
|
}
|
|
1293
1293
|
let profile;
|
|
1294
1294
|
if (profile_path) {
|
|
1295
|
-
const { parseFormatProfileJson } = await import("./profile-io-
|
|
1295
|
+
const { parseFormatProfileJson } = await import("./profile-io-3QYTSPNH.js");
|
|
1296
1296
|
profile = parseFormatProfileJson(await readFile3(safePath(profile_path, PROFILE_EXTENSIONS), "utf-8"));
|
|
1297
1297
|
}
|
|
1298
1298
|
const out = safeOutputPath(output_path, /* @__PURE__ */ new Set([".hwpx"]));
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ALL_OCR_MODELS
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MYTMZSQO.js";
|
|
5
5
|
import {
|
|
6
6
|
ALL_FORMULA_MODELS,
|
|
7
7
|
getModelStatusIn,
|
|
8
8
|
getModelsDir
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-36DK6AOX.js";
|
|
10
|
+
import "./chunk-3TUJ34V7.js";
|
|
11
|
+
import "./chunk-5ARHF54C.js";
|
|
12
12
|
|
|
13
13
|
// src/shared/model-bundle.ts
|
|
14
14
|
import { copyFile, mkdir } from "fs/promises";
|
|
@@ -101,4 +101,4 @@ export {
|
|
|
101
101
|
importModels,
|
|
102
102
|
modelCacheStatus
|
|
103
103
|
};
|
|
104
|
-
//# sourceMappingURL=model-bundle-
|
|
104
|
+
//# sourceMappingURL=model-bundle-ZPQ4IFT7.js.map
|
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
ocrSourcePath,
|
|
17
17
|
parseCharacterDict,
|
|
18
18
|
resolveOcrModels
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
19
|
+
} from "./chunk-MYTMZSQO.js";
|
|
20
|
+
import "./chunk-36DK6AOX.js";
|
|
21
|
+
import "./chunk-3TUJ34V7.js";
|
|
22
|
+
import "./chunk-5ARHF54C.js";
|
|
23
23
|
export {
|
|
24
24
|
ALL_OCR_MODELS,
|
|
25
25
|
DEFAULT_OCR_MODELS,
|
|
@@ -38,4 +38,4 @@ export {
|
|
|
38
38
|
parseCharacterDict,
|
|
39
39
|
resolveOcrModels
|
|
40
40
|
};
|
|
41
|
-
//# sourceMappingURL=models-
|
|
41
|
+
//# sourceMappingURL=models-YJQ5VHOR.js.map
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
parseWorkerFile
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-CWBH66IQ.js";
|
|
5
|
+
import "./chunk-G4KNI7EO.js";
|
|
6
|
+
import "./chunk-A3SKXHAN.js";
|
|
7
|
+
import "./chunk-EVL6HZQL.js";
|
|
8
|
+
import "./chunk-RPSILMQY.js";
|
|
9
|
+
import "./chunk-G2325K2F.js";
|
|
10
10
|
import "./chunk-VKVDMH7X.js";
|
|
11
11
|
import "./chunk-VQFA55IC.js";
|
|
12
12
|
import {
|
|
13
13
|
validateOcrOptions
|
|
14
14
|
} from "./chunk-BHVOY6V4.js";
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-AYV5VRHL.js";
|
|
16
|
+
import "./chunk-Q6SVCBMK.js";
|
|
17
|
+
import "./chunk-F3AWNFMO.js";
|
|
18
|
+
import "./chunk-WCTC3LSV.js";
|
|
19
19
|
import {
|
|
20
20
|
VERSION,
|
|
21
21
|
sanitizeError
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-5ARHF54C.js";
|
|
23
23
|
import "./chunk-3WSNLH4B.js";
|
|
24
24
|
|
|
25
25
|
// src/cli/parse-worker-v2.ts
|
|
@@ -311,4 +311,4 @@ export {
|
|
|
311
311
|
runParseWorkerV2,
|
|
312
312
|
toParseOptions
|
|
313
313
|
};
|
|
314
|
-
//# sourceMappingURL=parse-worker-v2-
|
|
314
|
+
//# sourceMappingURL=parse-worker-v2-7PNZYASF.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
blocksToPages,
|
|
3
3
|
encodePng
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WNW77CAY.js";
|
|
5
5
|
import {
|
|
6
6
|
hasRequestedPagesAfter,
|
|
7
7
|
parsePageRange
|
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
stripAbsorbedRunningLines,
|
|
62
62
|
trimTrailingEmptyTableCols,
|
|
63
63
|
wrapJoiner
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-HN3QMHTT.js";
|
|
65
65
|
import {
|
|
66
66
|
CELL_BASELINES,
|
|
67
67
|
CELL_EDGES,
|
|
@@ -75,12 +75,12 @@ import {
|
|
|
75
75
|
stripScriptTags,
|
|
76
76
|
unframeLayoutTables,
|
|
77
77
|
validateOcrOptions
|
|
78
|
-
} from "./chunk-
|
|
79
|
-
import "./chunk-
|
|
78
|
+
} from "./chunk-UJVVL6BI.js";
|
|
79
|
+
import "./chunk-SSL3TKJY.js";
|
|
80
80
|
import {
|
|
81
81
|
KordocError,
|
|
82
82
|
sanitizeHref
|
|
83
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-Q65HT2BL.js";
|
|
84
84
|
|
|
85
85
|
// src/pdf/image-extract.ts
|
|
86
86
|
import { createHash } from "crypto";
|
|
@@ -611,6 +611,110 @@ function ocrVectorOps(opList, paths) {
|
|
|
611
611
|
// src/pdf/split-row-pattern.ts
|
|
612
612
|
var textOf = (cell) => cell.text.replace(/<\/?u>|~~/g, "").trim();
|
|
613
613
|
var plain = (cell) => !cell.blocks?.length && !IMAGE_CELLS.has(cell);
|
|
614
|
+
var labelsOf = (cell) => {
|
|
615
|
+
const labels = textOf(cell).split("\n").map((s) => s.trim()).filter(Boolean);
|
|
616
|
+
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;
|
|
617
|
+
};
|
|
618
|
+
var alignedLabels = (label, value, count) => {
|
|
619
|
+
const L = CELL_LINES.get(label), V = CELL_LINES.get(value);
|
|
620
|
+
let next = 0;
|
|
621
|
+
return !!L && !!V && L.length === count && V.length >= count && Math.abs(L[0].y - V[0].y) <= 1 && L.every((l) => {
|
|
622
|
+
while (next < V.length && Math.abs(l.y - V[next].y) > 1) next++;
|
|
623
|
+
return next++ < V.length;
|
|
624
|
+
});
|
|
625
|
+
};
|
|
626
|
+
function matchesCompleteAlignedLabelListRow(table, owner, first) {
|
|
627
|
+
const pairs = [];
|
|
628
|
+
let carried = false;
|
|
629
|
+
for (let c = 0; c < table.cols; ) {
|
|
630
|
+
const u = owner[first - 1]?.[c], d = owner[first]?.[c];
|
|
631
|
+
if (u && u === d) {
|
|
632
|
+
carried = true;
|
|
633
|
+
c = u.c + u.cs;
|
|
634
|
+
continue;
|
|
635
|
+
}
|
|
636
|
+
const upper = u ? table.cells[u.r][u.c] : void 0, lower = d ? table.cells[d.r][d.c] : void 0;
|
|
637
|
+
if (!upper?.text.trim() && !lower?.text.trim()) {
|
|
638
|
+
c++;
|
|
639
|
+
continue;
|
|
640
|
+
}
|
|
641
|
+
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;
|
|
642
|
+
pairs.push({ c, cs: u.cs, upper, lower });
|
|
643
|
+
c += u.cs;
|
|
644
|
+
}
|
|
645
|
+
const filled = pairs.filter((p) => textOf(p.upper) && textOf(p.lower));
|
|
646
|
+
if (!carried || filled.length !== 2) return false;
|
|
647
|
+
const keyed = filled.filter((p) => labelsOf(p.upper) && labelsOf(p.lower));
|
|
648
|
+
if (keyed.length !== 1) return false;
|
|
649
|
+
const label = keyed[0], value = filled.find((p) => p !== label);
|
|
650
|
+
const U = labelsOf(label.upper), D = labelsOf(label.lower), sequence = [...U, ...D];
|
|
651
|
+
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;
|
|
652
|
+
let peers = 0;
|
|
653
|
+
for (let r = 0; r < table.rows; r++) {
|
|
654
|
+
if (r === first - 1 || r === first) continue;
|
|
655
|
+
const L = owner[r]?.[label.c], V = owner[r]?.[value.c];
|
|
656
|
+
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;
|
|
657
|
+
const l = table.cells[r][label.c], v = table.cells[r][value.c];
|
|
658
|
+
if (!plain(l) || !plain(v) || !textOf(v) || labelsOf(l)?.join("|") !== sequence.join("|") || !alignedLabels(l, v, sequence.length)) continue;
|
|
659
|
+
if (++peers >= 2) return true;
|
|
660
|
+
}
|
|
661
|
+
return false;
|
|
662
|
+
}
|
|
663
|
+
function matchesIndependentRowPair(table, owner, first) {
|
|
664
|
+
const norm = (cell) => textOf(cell).replace(/\s+/g, "");
|
|
665
|
+
const pairs = [];
|
|
666
|
+
for (let c = 0; c < table.cols; ) {
|
|
667
|
+
const u = owner[first - 1]?.[c], d = owner[first]?.[c];
|
|
668
|
+
if (u && u === d) {
|
|
669
|
+
c = u.c + u.cs;
|
|
670
|
+
continue;
|
|
671
|
+
}
|
|
672
|
+
const upper = u ? table.cells[u.r][u.c] : void 0, lower = d ? table.cells[d.r][d.c] : void 0;
|
|
673
|
+
if (!upper?.text.trim() && !lower?.text.trim()) {
|
|
674
|
+
c++;
|
|
675
|
+
continue;
|
|
676
|
+
}
|
|
677
|
+
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) || !norm(upper) || !norm(lower)) return false;
|
|
678
|
+
pairs.push({ c, cs: u.cs, upper: norm(upper), lower: norm(lower) });
|
|
679
|
+
c += u.cs;
|
|
680
|
+
}
|
|
681
|
+
if (pairs.length < 2 || pairs.every((p) => p.upper === p.lower)) return false;
|
|
682
|
+
return table.cells.some((_, r) => {
|
|
683
|
+
if (r + 1 >= table.rows || r + 1 >= first - 1 && r <= first) return false;
|
|
684
|
+
return pairs.every((p) => [p.upper, p.lower].every((text, i) => {
|
|
685
|
+
const a = owner[r + i]?.[p.c], cell = table.cells[r + i]?.[p.c];
|
|
686
|
+
return a?.r === r + i && a.c === p.c && a.rs === 1 && a.cs === p.cs && !!cell && plain(cell) && norm(cell) === text;
|
|
687
|
+
}));
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
function matchesCompleteContextRow(table, owner, first) {
|
|
691
|
+
const norm = (s) => s.replace(/\s+/g, "");
|
|
692
|
+
const context = [];
|
|
693
|
+
let value;
|
|
694
|
+
for (let c = 0; c < table.cols; ) {
|
|
695
|
+
const u = owner[first - 1]?.[c], d = owner[first]?.[c];
|
|
696
|
+
if (u && u === d) {
|
|
697
|
+
const cell = table.cells[u.r][u.c];
|
|
698
|
+
if (u.r === first - 1 && u.rs === 2 && plain(cell) && textOf(cell)) context.push({ c, cs: u.cs, text: norm(textOf(cell)) });
|
|
699
|
+
c = u.c + u.cs;
|
|
700
|
+
continue;
|
|
701
|
+
}
|
|
702
|
+
const upper = u ? table.cells[u.r][u.c] : void 0, lower = d ? table.cells[d.r][d.c] : void 0;
|
|
703
|
+
if (!upper?.text.trim() && !lower?.text.trim()) {
|
|
704
|
+
c++;
|
|
705
|
+
continue;
|
|
706
|
+
}
|
|
707
|
+
if (value || !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) || !textOf(upper) || !textOf(lower)) return false;
|
|
708
|
+
value = { c, cs: u.cs, text: norm(textOf(upper) + textOf(lower)) };
|
|
709
|
+
c += u.cs;
|
|
710
|
+
}
|
|
711
|
+
if (!value || !context.length) return false;
|
|
712
|
+
const proof = [...context, value];
|
|
713
|
+
return table.cells.some((row, r) => r !== first - 1 && r !== first && proof.every((p) => {
|
|
714
|
+
const a = owner[r]?.[p.c], cell = row[p.c];
|
|
715
|
+
return a?.r === r && a.c === p.c && a.rs === 1 && a.cs === p.cs && !!cell && plain(cell) && norm(textOf(cell)) === p.text;
|
|
716
|
+
}));
|
|
717
|
+
}
|
|
614
718
|
function matchesCompleteSiblingRow(table, owner, first) {
|
|
615
719
|
const pairs = [];
|
|
616
720
|
for (let c = 0; c < table.cols; ) {
|
|
@@ -1328,6 +1432,7 @@ function mergeSplitRow(table, owner, first, colXs, textOnly = false, cut = NO_CU
|
|
|
1328
1432
|
return a !== null && b === a + 1;
|
|
1329
1433
|
})) return false;
|
|
1330
1434
|
if (cut.ruled && hasNumberedRowSequence(table, owner, first)) return false;
|
|
1435
|
+
if (cut.ruled && matchesIndependentRowPair(table, owner, first)) return false;
|
|
1331
1436
|
const contentPairs = pairs.filter(([u, d]) => hasContent(u.cell) && hasContent(d.cell));
|
|
1332
1437
|
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])));
|
|
1333
1438
|
if (!carriedSplit) {
|
|
@@ -1339,7 +1444,7 @@ function mergeSplitRow(table, owner, first, colXs, textOnly = false, cut = NO_CU
|
|
|
1339
1444
|
if (!(cut.open && !newCell)) {
|
|
1340
1445
|
if (pairs.some((p) => p[1].rs > 1 && !flows(p))) return false;
|
|
1341
1446
|
const one = pairs.filter(([, d]) => d.rs === 1);
|
|
1342
|
-
if (!matchesCompleteSiblingRow(table, owner, first) && !matchesCompleteRubricRow(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;
|
|
1447
|
+
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;
|
|
1343
1448
|
}
|
|
1344
1449
|
}
|
|
1345
1450
|
for (const [u, d] of pairs) {
|
|
@@ -1727,7 +1832,10 @@ function mergeContinuedCells(blocks, pageHeights) {
|
|
|
1727
1832
|
for (let j = blocks.length - 1; j > 0; j--) {
|
|
1728
1833
|
const part = blocks[j];
|
|
1729
1834
|
const from = part.table ? CONT_PARTS.get(part.table) : void 0;
|
|
1730
|
-
if (!from || !part.table)
|
|
1835
|
+
if (!from || !part.table) {
|
|
1836
|
+
unwrapContinuedTable(blocks, j, pageHeights, true);
|
|
1837
|
+
continue;
|
|
1838
|
+
}
|
|
1731
1839
|
let i = j - 1;
|
|
1732
1840
|
while (i >= 0 && blocks[i].type !== "table") i--;
|
|
1733
1841
|
const prev = blocks[i];
|
|
@@ -1754,7 +1862,7 @@ function mergeContinuedCells(blocks, pageHeights) {
|
|
|
1754
1862
|
if (cell.blocks) mergeCrossPageTables(cell.blocks, pageHeights);
|
|
1755
1863
|
}
|
|
1756
1864
|
}
|
|
1757
|
-
function unwrapContinuedTable(blocks, at, pageHeights) {
|
|
1865
|
+
function unwrapContinuedTable(blocks, at, pageHeights, splitOnly = false) {
|
|
1758
1866
|
const prev = blocks[at - 1], frame = blocks[at];
|
|
1759
1867
|
if (!prev?.table || !frame?.table || frame.table.rows !== 1 || frame.table.cols !== 1 || !CLIP_TABLES.has(frame.table)) return;
|
|
1760
1868
|
const inner = frame.table.cells[0]?.[0]?.blocks;
|
|
@@ -1764,6 +1872,7 @@ function unwrapContinuedTable(blocks, at, pageHeights) {
|
|
|
1764
1872
|
if (!px || !nx || px.length !== nx.length || px.some((x, i) => Math.abs(x - nx[i]) > COL_MATCH_TOL)) return;
|
|
1765
1873
|
const ph = pageHeights?.get(prev.pageNumber), nh = pageHeights?.get(next.pageNumber);
|
|
1766
1874
|
if (!ph || !nh || prev.bbox.y > ph * CONTINUED_TABLE_PAGE_BAND || next.bbox.y + next.bbox.height < nh * (1 - CONTINUED_TABLE_PAGE_BAND)) return;
|
|
1875
|
+
if (splitOnly && (inner.length !== 1 || !joinSplitParts(prev.table, px, next.table, nx, 0, prev.bbox.y)?.split)) return;
|
|
1767
1876
|
blocks.splice(at, 1, ...inner);
|
|
1768
1877
|
}
|
|
1769
1878
|
function fillNestedContinuation(blocks, at) {
|
|
@@ -3363,7 +3472,7 @@ function mergeLinkRuns(markdown) {
|
|
|
3363
3472
|
|
|
3364
3473
|
// src/pdf/formula-ocr.ts
|
|
3365
3474
|
async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
|
|
3366
|
-
const formulaMod = await import("./formula-
|
|
3475
|
+
const formulaMod = await import("./formula-KSTY73DQ.js");
|
|
3367
3476
|
const { FormulaPipeline, ensureFormulaModels } = formulaMod;
|
|
3368
3477
|
await ensureFormulaModels((p) => {
|
|
3369
3478
|
if (p.phase === "download" && p.total) {
|
|
@@ -3789,10 +3898,10 @@ async function parsePdfDocument(buffer, options) {
|
|
|
3789
3898
|
}
|
|
3790
3899
|
if (targets.size > 0) {
|
|
3791
3900
|
try {
|
|
3792
|
-
const { runPdfOcr } = await import("./pdf-ocr-
|
|
3901
|
+
const { runPdfOcr } = await import("./pdf-ocr-BYT7XVID.js");
|
|
3793
3902
|
const mode = typeof options?.ocr === "function" ? options.ocr : "builtin";
|
|
3794
3903
|
const regionPages = new Map([...ocrRegions].filter(([p]) => options?.ocr !== "force" && !isImageBased && !pageQuality.find((q) => q.page === p)?.needsOcr));
|
|
3795
|
-
const { builtinOcrConfig } = await import("./pdf-ocr-
|
|
3904
|
+
const { builtinOcrConfig } = await import("./pdf-ocr-BYT7XVID.js");
|
|
3796
3905
|
const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, options?.onProgress, options?.tables !== false, vectorPageOps, regionPages, builtinOcrConfig(options), ocrLinesOut);
|
|
3797
3906
|
for (const obs of ocrPageBlocks.values()) stripScriptTags({ blocks: obs });
|
|
3798
3907
|
if (ocrPageBlocks.size > 0) {
|
|
@@ -4037,4 +4146,4 @@ export {
|
|
|
4037
4146
|
parsePdfDocument,
|
|
4038
4147
|
removeHeaderFooterBlocks
|
|
4039
4148
|
};
|
|
4040
|
-
//# sourceMappingURL=parser-
|
|
4149
|
+
//# sourceMappingURL=parser-DR6ZHYEB.js.map
|