kordoc 4.9.1 → 4.9.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 +7 -0
- package/dist/{-KIYHEVUW.js → -Z4LCTGQR.js} +8 -8
- package/dist/{chunk-3PY5YCJP.js → chunk-5ZPXRDS2.js} +2 -2
- package/dist/{chunk-JHXAQDXS.js → chunk-6WYMV73J.js} +40 -14
- package/dist/{chunk-JHXAQDXS.js.map → chunk-6WYMV73J.js.map} +1 -1
- package/dist/{chunk-65TL66UD.cjs → chunk-BAJVZXC7.cjs} +3 -3
- package/dist/{chunk-65TL66UD.cjs.map → chunk-BAJVZXC7.cjs.map} +1 -1
- package/dist/{chunk-GNRBCV4R.js → chunk-GL6BCNJV.js} +3 -3
- package/dist/{chunk-Q3IVAWOK.js → chunk-JHPEDWJX.js} +3 -3
- package/dist/{chunk-4R73ASZF.cjs → chunk-KATZTHWA.cjs} +2 -2
- package/dist/{chunk-4R73ASZF.cjs.map → chunk-KATZTHWA.cjs.map} +1 -1
- package/dist/{chunk-SFSB3FAL.js → chunk-LJP3PK2S.js} +2 -2
- package/dist/{chunk-SGTGSV4A.js → chunk-LKZQ4564.js} +2 -2
- package/dist/{chunk-5CAKNM2K.js → chunk-LREEDIEF.js} +2 -2
- package/dist/{chunk-HG7GXBVP.js → chunk-LUY46O7O.js} +2 -2
- package/dist/{chunk-55Q76S6S.js → chunk-NIBRVLGS.js} +2 -2
- package/dist/{chunk-D7EMDOX7.cjs → chunk-NIQ4JCQF.cjs} +6 -6
- package/dist/{chunk-D7EMDOX7.cjs.map → chunk-NIQ4JCQF.cjs.map} +1 -1
- package/dist/{chunk-UIQWUYOJ.js → chunk-NOEYLJGJ.js} +3 -3
- package/dist/{chunk-INV3W43Y.js → chunk-OOT54JF2.js} +2 -2
- package/dist/{chunk-VGRIWMTQ.js → chunk-OYQL3D4B.js} +2 -2
- package/dist/{chunk-L27YEW3T.js → chunk-PIUPP3FL.js} +3 -3
- package/dist/{chunk-TC7EDYZD.js → chunk-PKCDYIIJ.js} +2 -2
- package/dist/{chunk-HOSNMNKU.cjs → chunk-SHBVD23C.cjs} +7 -7
- package/dist/{chunk-HOSNMNKU.cjs.map → chunk-SHBVD23C.cjs.map} +1 -1
- package/dist/{chunk-HFZIYAQQ.js → chunk-TK7WUS47.js} +2 -2
- package/dist/{chunk-2ULV2DX4.cjs → chunk-V3Q6I2AQ.cjs} +4 -4
- package/dist/{chunk-2ULV2DX4.cjs.map → chunk-V3Q6I2AQ.cjs.map} +1 -1
- package/dist/{chunk-TN6AALZG.js → chunk-VYGNPB2X.js} +2 -2
- package/dist/{chunk-Z2SX4E7K.js → chunk-WLZX2HTC.js} +2 -2
- package/dist/{chunk-GU4NCNCT.js → chunk-Y7QB4IB6.js} +2 -2
- package/dist/chunks-TRJGNO4N.js +10 -0
- package/dist/cli.js +20 -20
- package/dist/{formula-S4O7SBN3.js → formula-77TJPACH.js} +3 -3
- package/dist/{formula-I5D3UNLV.cjs → formula-JVBJ6QRG.cjs} +9 -9
- package/dist/{formula-I5D3UNLV.cjs.map → formula-JVBJ6QRG.cjs.map} +1 -1
- package/dist/{formula-5DQQ4MFT.js → formula-LFWZG7T7.js} +4 -4
- package/dist/{image-ocr-SQXFTNYR.js → image-ocr-6SY623KL.js} +7 -7
- package/dist/{image-ocr-BKUYR4WU.cjs → image-ocr-YTGAUHEP.cjs} +11 -11
- package/dist/{image-ocr-BKUYR4WU.cjs.map → image-ocr-YTGAUHEP.cjs.map} +1 -1
- package/dist/{image-ocr-LIH2E7WC.js → image-ocr-YZ56O63S.js} +5 -5
- package/dist/index.cjs +207 -181
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +36 -10
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +15 -15
- package/dist/{model-bundle-4JMY5E37.js → model-bundle-W7B3BIYS.js} +5 -5
- package/dist/{models-D7X5YBWX.js → models-FUKPEVPE.js} +5 -5
- package/dist/{parser-MY7JJISJ.js → parser-6UL2HLDH.js} +6 -6
- package/dist/{parser-GHRXWFJN.js → parser-GDYZDBZI.js} +6 -6
- package/dist/{parser-ZLHOAZAA.cjs → parser-WIRWVN5E.cjs} +26 -26
- package/dist/{parser-ZLHOAZAA.cjs.map → parser-WIRWVN5E.cjs.map} +1 -1
- package/dist/pdf-ocr-O373AAN6.cjs +14 -0
- package/dist/{pdf-ocr-FESGFQYN.cjs.map → pdf-ocr-O373AAN6.cjs.map} +1 -1
- package/dist/pdf-ocr-OHUAQQMN.js +16 -0
- package/dist/pdf-ocr-XTE234WC.js +13 -0
- package/dist/{profile-io-EAPI6M7O.js → profile-io-4EE64K6Y.js} +3 -3
- package/dist/{rasterize-UIDZAEWB.js → rasterize-QW7SSKHB.js} +2 -2
- package/dist/render-2NID54BX.js +10 -0
- package/dist/seal-PTP4TWYR.js +10 -0
- package/dist/{setup-UHX3HHWY.js → setup-JS7E2HFM.js} +3 -3
- package/dist/{watch-23MV3PBX.js → watch-YISVPGW3.js} +9 -9
- package/package.json +1 -1
- package/dist/chunks-FB344JZT.js +0 -10
- package/dist/pdf-ocr-FESGFQYN.cjs +0 -14
- package/dist/pdf-ocr-IEAXGG3D.js +0 -13
- package/dist/pdf-ocr-Z6CHIYEM.js +0 -16
- package/dist/render-XL7ZVAHK.js +0 -10
- package/dist/seal-CY7EIWDJ.js +0 -10
- /package/dist/{-KIYHEVUW.js.map → -Z4LCTGQR.js.map} +0 -0
- /package/dist/{chunk-3PY5YCJP.js.map → chunk-5ZPXRDS2.js.map} +0 -0
- /package/dist/{chunk-GNRBCV4R.js.map → chunk-GL6BCNJV.js.map} +0 -0
- /package/dist/{chunk-Q3IVAWOK.js.map → chunk-JHPEDWJX.js.map} +0 -0
- /package/dist/{chunk-SFSB3FAL.js.map → chunk-LJP3PK2S.js.map} +0 -0
- /package/dist/{chunk-SGTGSV4A.js.map → chunk-LKZQ4564.js.map} +0 -0
- /package/dist/{chunk-5CAKNM2K.js.map → chunk-LREEDIEF.js.map} +0 -0
- /package/dist/{chunk-HG7GXBVP.js.map → chunk-LUY46O7O.js.map} +0 -0
- /package/dist/{chunk-55Q76S6S.js.map → chunk-NIBRVLGS.js.map} +0 -0
- /package/dist/{chunk-UIQWUYOJ.js.map → chunk-NOEYLJGJ.js.map} +0 -0
- /package/dist/{chunk-INV3W43Y.js.map → chunk-OOT54JF2.js.map} +0 -0
- /package/dist/{chunk-VGRIWMTQ.js.map → chunk-OYQL3D4B.js.map} +0 -0
- /package/dist/{chunk-L27YEW3T.js.map → chunk-PIUPP3FL.js.map} +0 -0
- /package/dist/{chunk-TC7EDYZD.js.map → chunk-PKCDYIIJ.js.map} +0 -0
- /package/dist/{chunk-HFZIYAQQ.js.map → chunk-TK7WUS47.js.map} +0 -0
- /package/dist/{chunk-TN6AALZG.js.map → chunk-VYGNPB2X.js.map} +0 -0
- /package/dist/{chunk-Z2SX4E7K.js.map → chunk-WLZX2HTC.js.map} +0 -0
- /package/dist/{chunk-GU4NCNCT.js.map → chunk-Y7QB4IB6.js.map} +0 -0
- /package/dist/{chunks-FB344JZT.js.map → chunks-TRJGNO4N.js.map} +0 -0
- /package/dist/{formula-S4O7SBN3.js.map → formula-77TJPACH.js.map} +0 -0
- /package/dist/{formula-5DQQ4MFT.js.map → formula-LFWZG7T7.js.map} +0 -0
- /package/dist/{image-ocr-SQXFTNYR.js.map → image-ocr-6SY623KL.js.map} +0 -0
- /package/dist/{image-ocr-LIH2E7WC.js.map → image-ocr-YZ56O63S.js.map} +0 -0
- /package/dist/{model-bundle-4JMY5E37.js.map → model-bundle-W7B3BIYS.js.map} +0 -0
- /package/dist/{models-D7X5YBWX.js.map → models-FUKPEVPE.js.map} +0 -0
- /package/dist/{parser-MY7JJISJ.js.map → parser-6UL2HLDH.js.map} +0 -0
- /package/dist/{parser-GHRXWFJN.js.map → parser-GDYZDBZI.js.map} +0 -0
- /package/dist/{pdf-ocr-IEAXGG3D.js.map → pdf-ocr-OHUAQQMN.js.map} +0 -0
- /package/dist/{pdf-ocr-Z6CHIYEM.js.map → pdf-ocr-XTE234WC.js.map} +0 -0
- /package/dist/{profile-io-EAPI6M7O.js.map → profile-io-4EE64K6Y.js.map} +0 -0
- /package/dist/{rasterize-UIDZAEWB.js.map → rasterize-QW7SSKHB.js.map} +0 -0
- /package/dist/{render-XL7ZVAHK.js.map → render-2NID54BX.js.map} +0 -0
- /package/dist/{seal-CY7EIWDJ.js.map → seal-PTP4TWYR.js.map} +0 -0
- /package/dist/{setup-UHX3HHWY.js.map → setup-JS7E2HFM.js.map} +0 -0
- /package/dist/{watch-23MV3PBX.js.map → watch-YISVPGW3.js.map} +0 -0
package/dist/mcp.js
CHANGED
|
@@ -39,30 +39,30 @@ import {
|
|
|
39
39
|
resolveBuiltinTemplate,
|
|
40
40
|
unknownFontWarnings,
|
|
41
41
|
usesGaejosikMunche
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-6WYMV73J.js";
|
|
43
43
|
import "./chunk-7FCNOKOR.js";
|
|
44
44
|
import "./chunk-XINP35F4.js";
|
|
45
45
|
import "./chunk-MOL7MDBG.js";
|
|
46
|
-
import "./chunk-
|
|
46
|
+
import "./chunk-JHPEDWJX.js";
|
|
47
47
|
import "./chunk-DZIXKL7E.js";
|
|
48
|
-
import "./chunk-
|
|
48
|
+
import "./chunk-OYQL3D4B.js";
|
|
49
49
|
import {
|
|
50
50
|
blocksToMarkdown
|
|
51
|
-
} from "./chunk-
|
|
52
|
-
import "./chunk-
|
|
53
|
-
import "./chunk-
|
|
51
|
+
} from "./chunk-LUY46O7O.js";
|
|
52
|
+
import "./chunk-NOEYLJGJ.js";
|
|
53
|
+
import "./chunk-PKCDYIIJ.js";
|
|
54
54
|
import {
|
|
55
55
|
assertWithinRoot,
|
|
56
56
|
getAccessRoot,
|
|
57
57
|
isOfflineMode
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-TK7WUS47.js";
|
|
59
59
|
import {
|
|
60
60
|
KordocError,
|
|
61
61
|
VERSION,
|
|
62
62
|
classifyError,
|
|
63
63
|
sanitizeError,
|
|
64
64
|
toArrayBuffer
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-5ZPXRDS2.js";
|
|
66
66
|
|
|
67
67
|
// src/mcp.ts
|
|
68
68
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -312,7 +312,7 @@ server.tool(
|
|
|
312
312
|
break;
|
|
313
313
|
case "pdf":
|
|
314
314
|
try {
|
|
315
|
-
const { extractPdfMetadataOnly } = await import("./parser-
|
|
315
|
+
const { extractPdfMetadataOnly } = await import("./parser-GDYZDBZI.js");
|
|
316
316
|
metadata = await extractPdfMetadataOnly(buffer);
|
|
317
317
|
} catch {
|
|
318
318
|
metadata = void 0;
|
|
@@ -694,7 +694,7 @@ server.tool(
|
|
|
694
694
|
}
|
|
695
695
|
const image = new Uint8Array(await readFile(imgResolved));
|
|
696
696
|
const ext = extname(imgResolved).slice(1).toLowerCase();
|
|
697
|
-
const { placeSealHwpx } = await import("./seal-
|
|
697
|
+
const { placeSealHwpx } = await import("./seal-PTP4TWYR.js");
|
|
698
698
|
const result = await placeSealHwpx(buffer, [{
|
|
699
699
|
anchor,
|
|
700
700
|
occurrence,
|
|
@@ -796,7 +796,7 @@ server.tool(
|
|
|
796
796
|
}
|
|
797
797
|
const outPath = output_path ? safeOutputPath(output_path, /* @__PURE__ */ new Set([format === "png" ? ".png" : ".svg"])) : void 0;
|
|
798
798
|
const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, /* @__PURE__ */ new Set([".hwpx"]));
|
|
799
|
-
const { renderHwpxToSvg } = await import("./render-
|
|
799
|
+
const { renderHwpxToSvg } = await import("./render-2NID54BX.js");
|
|
800
800
|
const result = await renderHwpxToSvg(buffer, { highlights, reflow: true, reflowMode: reflow_mode });
|
|
801
801
|
const summary = [
|
|
802
802
|
`\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})`,
|
|
@@ -808,7 +808,7 @@ server.tool(
|
|
|
808
808
|
summary.push(`\uC800\uC7A5: ${outPath}`);
|
|
809
809
|
return { content: [{ type: "text", text: summary.join("\n") }] };
|
|
810
810
|
}
|
|
811
|
-
const { rasterizeSvg } = await import("./rasterize-
|
|
811
|
+
const { rasterizeSvg } = await import("./rasterize-QW7SSKHB.js");
|
|
812
812
|
const raster = await rasterizeSvg(result.svg, result.width, result.height);
|
|
813
813
|
if (outPath) {
|
|
814
814
|
await mkdir(dirname(outPath), { recursive: true });
|
|
@@ -906,7 +906,7 @@ server.tool(
|
|
|
906
906
|
if (!parsed.success) {
|
|
907
907
|
return { content: [{ type: "text", text: `\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}` }], isError: true };
|
|
908
908
|
}
|
|
909
|
-
const { blocksToChunks } = await import("./chunks-
|
|
909
|
+
const { blocksToChunks } = await import("./chunks-TRJGNO4N.js");
|
|
910
910
|
const chunks = blocksToChunks(parsed.blocks, { granularity, includeTableCells: include_table_cells });
|
|
911
911
|
return { content: [{ type: "text", text: capResponseText(JSON.stringify(chunks, null, 2)) }] };
|
|
912
912
|
} catch (err) {
|
|
@@ -925,7 +925,7 @@ server.tool(
|
|
|
925
925
|
try {
|
|
926
926
|
const out = safeOutputPath(output_path, PROFILE_EXTENSIONS);
|
|
927
927
|
const { buffer } = await readValidatedFile(hwpx_path);
|
|
928
|
-
const { hwpxToProfile } = await import("./-
|
|
928
|
+
const { hwpxToProfile } = await import("./-Z4LCTGQR.js");
|
|
929
929
|
const profile = await hwpxToProfile(buffer);
|
|
930
930
|
await mkdir(dirname(out), { recursive: true });
|
|
931
931
|
await writeFile(out, JSON.stringify(profile, null, 2));
|
|
@@ -1014,7 +1014,7 @@ server.tool(
|
|
|
1014
1014
|
}
|
|
1015
1015
|
let profile;
|
|
1016
1016
|
if (profile_path) {
|
|
1017
|
-
const { parseFormatProfileJson } = await import("./profile-io-
|
|
1017
|
+
const { parseFormatProfileJson } = await import("./profile-io-4EE64K6Y.js");
|
|
1018
1018
|
profile = parseFormatProfileJson(await readFile(safePath(profile_path, PROFILE_EXTENSIONS), "utf-8"));
|
|
1019
1019
|
}
|
|
1020
1020
|
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-Y7QB4IB6.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-LJP3PK2S.js";
|
|
10
|
+
import "./chunk-TK7WUS47.js";
|
|
11
|
+
import "./chunk-5ZPXRDS2.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-W7B3BIYS.js.map
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
getOcrModelsDir,
|
|
10
10
|
ocrModelPath,
|
|
11
11
|
parseCharacterDict
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-Y7QB4IB6.js";
|
|
13
|
+
import "./chunk-LJP3PK2S.js";
|
|
14
|
+
import "./chunk-TK7WUS47.js";
|
|
15
|
+
import "./chunk-5ZPXRDS2.js";
|
|
16
16
|
export {
|
|
17
17
|
ALL_OCR_MODELS,
|
|
18
18
|
OCR_DET_MODEL,
|
|
@@ -24,4 +24,4 @@ export {
|
|
|
24
24
|
ocrModelPath,
|
|
25
25
|
parseCharacterDict
|
|
26
26
|
};
|
|
27
|
-
//# sourceMappingURL=models-
|
|
27
|
+
//# sourceMappingURL=models-FUKPEVPE.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
blocksToMarkdown,
|
|
3
3
|
encodePng
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-VYGNPB2X.js";
|
|
5
5
|
import {
|
|
6
6
|
parsePageRange
|
|
7
7
|
} from "./chunk-GE43BE46.js";
|
|
@@ -18,12 +18,12 @@ import {
|
|
|
18
18
|
mergeCrossPageTables,
|
|
19
19
|
normalizeItems,
|
|
20
20
|
removeHeaderFooterBlocks
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-NIBRVLGS.js";
|
|
22
22
|
import "./chunk-BN33O25L.js";
|
|
23
23
|
import {
|
|
24
24
|
KordocError,
|
|
25
25
|
sanitizeHref
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-OOT54JF2.js";
|
|
27
27
|
|
|
28
28
|
// src/pdf/image-extract.ts
|
|
29
29
|
import { OPS, ImageKind } from "pdfjs-dist/legacy/build/pdf.mjs";
|
|
@@ -420,7 +420,7 @@ function applyLinkAnnotations(items, annots) {
|
|
|
420
420
|
|
|
421
421
|
// src/pdf/formula-ocr.ts
|
|
422
422
|
async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
|
|
423
|
-
const formulaMod = await import("./formula-
|
|
423
|
+
const formulaMod = await import("./formula-77TJPACH.js");
|
|
424
424
|
const { FormulaPipeline, ensureFormulaModels } = formulaMod;
|
|
425
425
|
await ensureFormulaModels((p) => {
|
|
426
426
|
if (p.phase === "download" && p.total) {
|
|
@@ -705,7 +705,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
705
705
|
}
|
|
706
706
|
if (targets.size > 0) {
|
|
707
707
|
try {
|
|
708
|
-
const { runPdfOcr } = await import("./pdf-ocr-
|
|
708
|
+
const { runPdfOcr } = await import("./pdf-ocr-XTE234WC.js");
|
|
709
709
|
const mode = typeof options.ocr === "function" ? options.ocr : "builtin";
|
|
710
710
|
const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, options.onProgress, options.tables !== false);
|
|
711
711
|
if (ocrPageBlocks.size > 0) {
|
|
@@ -841,4 +841,4 @@ export {
|
|
|
841
841
|
parsePdfDocument,
|
|
842
842
|
removeHeaderFooterBlocks
|
|
843
843
|
};
|
|
844
|
-
//# sourceMappingURL=parser-
|
|
844
|
+
//# sourceMappingURL=parser-6UL2HLDH.js.map
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
mergeCrossPageTables,
|
|
13
13
|
normalizeItems,
|
|
14
14
|
removeHeaderFooterBlocks
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-WLZX2HTC.js";
|
|
16
16
|
import {
|
|
17
17
|
encodePng
|
|
18
18
|
} from "./chunk-7FCNOKOR.js";
|
|
@@ -22,11 +22,11 @@ import {
|
|
|
22
22
|
} from "./chunk-MOL7MDBG.js";
|
|
23
23
|
import {
|
|
24
24
|
blocksToMarkdown
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-LUY46O7O.js";
|
|
26
26
|
import {
|
|
27
27
|
KordocError,
|
|
28
28
|
sanitizeHref
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-5ZPXRDS2.js";
|
|
30
30
|
|
|
31
31
|
// src/pdf/image-extract.ts
|
|
32
32
|
import { OPS, ImageKind } from "pdfjs-dist/legacy/build/pdf.mjs";
|
|
@@ -423,7 +423,7 @@ function applyLinkAnnotations(items, annots) {
|
|
|
423
423
|
|
|
424
424
|
// src/pdf/formula-ocr.ts
|
|
425
425
|
async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
|
|
426
|
-
const formulaMod = await import("./formula-
|
|
426
|
+
const formulaMod = await import("./formula-LFWZG7T7.js");
|
|
427
427
|
const { FormulaPipeline, ensureFormulaModels } = formulaMod;
|
|
428
428
|
await ensureFormulaModels((p) => {
|
|
429
429
|
if (p.phase === "download" && p.total) {
|
|
@@ -708,7 +708,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
708
708
|
}
|
|
709
709
|
if (targets.size > 0) {
|
|
710
710
|
try {
|
|
711
|
-
const { runPdfOcr } = await import("./pdf-ocr-
|
|
711
|
+
const { runPdfOcr } = await import("./pdf-ocr-OHUAQQMN.js");
|
|
712
712
|
const mode = typeof options.ocr === "function" ? options.ocr : "builtin";
|
|
713
713
|
const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, options.onProgress, options.tables !== false);
|
|
714
714
|
if (ocrPageBlocks.size > 0) {
|
|
@@ -844,4 +844,4 @@ export {
|
|
|
844
844
|
parsePdfDocument,
|
|
845
845
|
removeHeaderFooterBlocks
|
|
846
846
|
};
|
|
847
|
-
//# sourceMappingURL=parser-
|
|
847
|
+
//# sourceMappingURL=parser-GDYZDBZI.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
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; } var _class;
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkV3Q6I2AQcjs = require('./chunk-V3Q6I2AQ.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
@@ -18,12 +18,12 @@ var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkSHBVD23Ccjs = require('./chunk-SHBVD23C.cjs');
|
|
22
22
|
require('./chunk-L5CDTOC3.cjs');
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _chunkKATZTHWAcjs = require('./chunk-KATZTHWA.cjs');
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
@@ -149,7 +149,7 @@ async function extractPageImages(page, fnArray, argsArray, pageNumber, state, wa
|
|
|
149
149
|
if (state.seen.has(hash)) continue;
|
|
150
150
|
const rgba = toRgba(imgData);
|
|
151
151
|
if (!rgba) continue;
|
|
152
|
-
const png =
|
|
152
|
+
const png = _chunkV3Q6I2AQcjs.encodePng.call(void 0, w, h, rgba);
|
|
153
153
|
state.imageIndex++;
|
|
154
154
|
state.totalBytes += png.length;
|
|
155
155
|
const filename = `image_${String(state.imageIndex).padStart(3, "0")}.png`;
|
|
@@ -344,7 +344,7 @@ function cleanPdfText(text) {
|
|
|
344
344
|
stripControlChars(text).replace(/^\d{1,4}\n/, "").replace(/^[\s]*[-–—]\s*[-–—]?\d+[-–—]?[\s]*[-–—]?[\s]*$/gm, "").replace(/^\s*\d+\s*\/\s*\d+\s*$/gm, "").replace(/\n\d{1,4}\n/g, "\n").replace(/\n\d{1,4}$/, "").replace(/^#{1,6}\s*\d{1,4}\s*$/gm, "")
|
|
345
345
|
).replace(/^(?!\| ---).*$/gm, (line) => {
|
|
346
346
|
if (/^\s*\${1,2}.+\${1,2}\s*$/.test(line)) return line;
|
|
347
|
-
return
|
|
347
|
+
return _chunkSHBVD23Ccjs.collapseEvenSpacing.call(void 0, line);
|
|
348
348
|
}).replace(/([□■◆○●▶ㅇ])\s+([가-힣])\s+([가-힣])/g, "$1 $2$3").replace(/\\~\\~/g, "~~").replace(/~~~~/g, "").replace(/<u>\s*<\/u>/g, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
349
349
|
}
|
|
350
350
|
function startsWithMarker(line) {
|
|
@@ -392,7 +392,7 @@ function applyLinkAnnotations(items, annots) {
|
|
|
392
392
|
const wrapped = /* @__PURE__ */ new Set();
|
|
393
393
|
for (const a of annots) {
|
|
394
394
|
if (a.subtype !== "Link" || !a.url || !a.rect || a.rect.length < 4) continue;
|
|
395
|
-
const url =
|
|
395
|
+
const url = _chunkKATZTHWAcjs.sanitizeHref.call(void 0, a.url);
|
|
396
396
|
if (!url) continue;
|
|
397
397
|
const x1 = Math.min(a.rect[0], a.rect[2]), x2 = Math.max(a.rect[0], a.rect[2]);
|
|
398
398
|
const y1 = Math.min(a.rect[1], a.rect[3]), y2 = Math.max(a.rect[1], a.rect[3]);
|
|
@@ -423,7 +423,7 @@ function applyLinkAnnotations(items, annots) {
|
|
|
423
423
|
|
|
424
424
|
// src/pdf/formula-ocr.ts
|
|
425
425
|
async function applyFormulaOcr(buffer, blocks, pageFilter, effectivePageCount, warnings, _onProgress) {
|
|
426
|
-
const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-
|
|
426
|
+
const formulaMod = await Promise.resolve().then(() => _interopRequireWildcard(require("./formula-JVBJ6QRG.cjs")));
|
|
427
427
|
const { FormulaPipeline, ensureFormulaModels } = formulaMod;
|
|
428
428
|
await ensureFormulaModels((p) => {
|
|
429
429
|
if (p.phase === "download" && p.total) {
|
|
@@ -591,7 +591,7 @@ async function loadPdfWithTimeout(buffer) {
|
|
|
591
591
|
new Promise((_, reject) => {
|
|
592
592
|
timer = setTimeout(() => {
|
|
593
593
|
loadingTask.destroy();
|
|
594
|
-
reject(new (0,
|
|
594
|
+
reject(new (0, _chunkKATZTHWAcjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
|
|
595
595
|
}, PDF_LOAD_TIMEOUT_MS);
|
|
596
596
|
})
|
|
597
597
|
]);
|
|
@@ -605,7 +605,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
605
605
|
const doc = await loadPdfWithTimeout(buffer);
|
|
606
606
|
try {
|
|
607
607
|
const pageCount = doc.numPages;
|
|
608
|
-
if (pageCount === 0) throw new (0,
|
|
608
|
+
if (pageCount === 0) throw new (0, _chunkKATZTHWAcjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
609
609
|
const metadata = { pageCount, pageMode: "layout" };
|
|
610
610
|
await extractPdfMetadata(doc, metadata);
|
|
611
611
|
const blocks = [];
|
|
@@ -632,8 +632,8 @@ async function parsePdfDocument(buffer, options) {
|
|
|
632
632
|
const viewport = page.getViewport({ scale: 1 });
|
|
633
633
|
pageHeights.set(i, viewport.height);
|
|
634
634
|
const rawItems = tc.items;
|
|
635
|
-
const items =
|
|
636
|
-
const { visible, hiddenCount } =
|
|
635
|
+
const items = _chunkSHBVD23Ccjs.normalizeItems.call(void 0, rawItems);
|
|
636
|
+
const { visible, hiddenCount } = _chunkSHBVD23Ccjs.filterHiddenText.call(void 0, items, viewport.width, viewport.height);
|
|
637
637
|
if (hiddenCount > 0) {
|
|
638
638
|
warnings.push({ page: i, message: `${hiddenCount}\uAC1C \uC228\uACA8\uC9C4 \uD14D\uC2A4\uD2B8 \uC694\uC18C \uD544\uD130\uB9C1\uB428`, code: "HIDDEN_TEXT_FILTERED" });
|
|
639
639
|
}
|
|
@@ -648,7 +648,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
648
648
|
const opList = await page.getOperatorList();
|
|
649
649
|
const pageArea = viewport.width * viewport.height;
|
|
650
650
|
if (pageArea > 0) {
|
|
651
|
-
const imageRegions =
|
|
651
|
+
const imageRegions = _chunkSHBVD23Ccjs.extractImageRegions.call(void 0, opList.fnArray, opList.argsArray);
|
|
652
652
|
let uncovered = 0;
|
|
653
653
|
for (const r of imageRegions) {
|
|
654
654
|
const area = (r.x2 - r.x1) * (r.y2 - r.y1);
|
|
@@ -663,7 +663,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
663
663
|
}
|
|
664
664
|
if (uncovered > 0) skippedImagePages.set(i, uncovered);
|
|
665
665
|
}
|
|
666
|
-
const pageBlocks =
|
|
666
|
+
const pageBlocks = _chunkSHBVD23Ccjs.extractPageBlocksWithLines.call(void 0, visible, i, opList, viewport.width, viewport.height, void 0, _optionalChain([options, 'optionalAccess', _10 => _10.tables]) !== false);
|
|
667
667
|
for (const b of pageBlocks) blocks.push(b);
|
|
668
668
|
try {
|
|
669
669
|
const { blocks: imgBlocks, images: pageImages } = await extractPageImages(page, opList.fnArray, opList.argsArray, i, imageState, warnings);
|
|
@@ -683,11 +683,11 @@ async function parsePdfDocument(buffer, options) {
|
|
|
683
683
|
pageText += pageText ? "\n" + t : t;
|
|
684
684
|
}
|
|
685
685
|
pageQuality.push(computePageQuality(i, pageText));
|
|
686
|
-
if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0,
|
|
686
|
+
if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunkKATZTHWAcjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
|
|
687
687
|
parsedPages++;
|
|
688
688
|
_optionalChain([options, 'optionalAccess', _11 => _11.onProgress, 'optionalCall', _12 => _12(parsedPages, totalTarget)]);
|
|
689
689
|
} catch (pageErr) {
|
|
690
|
-
if (pageErr instanceof
|
|
690
|
+
if (pageErr instanceof _chunkKATZTHWAcjs.KordocError) throw pageErr;
|
|
691
691
|
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" });
|
|
692
692
|
}
|
|
693
693
|
}
|
|
@@ -708,7 +708,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
708
708
|
}
|
|
709
709
|
if (targets.size > 0) {
|
|
710
710
|
try {
|
|
711
|
-
const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-
|
|
711
|
+
const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-O373AAN6.cjs")));
|
|
712
712
|
const mode = typeof options.ocr === "function" ? options.ocr : "builtin";
|
|
713
713
|
const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, options.onProgress, options.tables !== false);
|
|
714
714
|
if (ocrPageBlocks.size > 0) {
|
|
@@ -758,12 +758,12 @@ async function parsePdfDocument(buffer, options) {
|
|
|
758
758
|
}
|
|
759
759
|
}
|
|
760
760
|
if (_optionalChain([options, 'optionalAccess', _14 => _14.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
|
|
761
|
-
const removed =
|
|
761
|
+
const removed = _chunkSHBVD23Ccjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings);
|
|
762
762
|
for (let ri = removed.length - 1; ri >= 0; ri--) {
|
|
763
763
|
blocks.splice(removed[ri], 1);
|
|
764
764
|
}
|
|
765
765
|
}
|
|
766
|
-
|
|
766
|
+
_chunkSHBVD23Ccjs.mergeCrossPageTables.call(void 0, blocks);
|
|
767
767
|
injectPageImageBlocks(blocks, pageImageBlocks);
|
|
768
768
|
if (_optionalChain([options, 'optionalAccess', _15 => _15.formulaOcr]) && formulaBuffer) {
|
|
769
769
|
try {
|
|
@@ -775,16 +775,16 @@ async function parsePdfDocument(buffer, options) {
|
|
|
775
775
|
});
|
|
776
776
|
}
|
|
777
777
|
}
|
|
778
|
-
const medianFontSize =
|
|
778
|
+
const medianFontSize = _chunkSHBVD23Ccjs.computeMedianFontSizeFromFreq.call(void 0, fontSizeFreq);
|
|
779
779
|
if (medianFontSize > 0) {
|
|
780
|
-
|
|
780
|
+
_chunkSHBVD23Ccjs.detectHeadings.call(void 0, blocks, medianFontSize);
|
|
781
781
|
}
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
782
|
+
_chunkSHBVD23Ccjs.detectMarkerHeadings.call(void 0, blocks);
|
|
783
|
+
_chunkSHBVD23Ccjs.detectTableCaptions.call(void 0, blocks);
|
|
784
|
+
_chunkSHBVD23Ccjs.detectKoreanListBlocks.call(void 0, blocks);
|
|
785
785
|
const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
786
786
|
sanitizeBlockControlChars(blocks);
|
|
787
|
-
let markdown = cleanPdfText(
|
|
787
|
+
let markdown = cleanPdfText(_chunkV3Q6I2AQcjs.blocksToMarkdown.call(void 0, blocks));
|
|
788
788
|
return {
|
|
789
789
|
markdown,
|
|
790
790
|
blocks,
|
|
@@ -843,5 +843,5 @@ async function extractPdfMetadataOnly(buffer) {
|
|
|
843
843
|
|
|
844
844
|
|
|
845
845
|
|
|
846
|
-
exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks =
|
|
847
|
-
//# sourceMappingURL=parser-
|
|
846
|
+
exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks = _chunkSHBVD23Ccjs.detectKoreanListBlocks; exports.detectTableCaptions = _chunkSHBVD23Ccjs.detectTableCaptions; exports.extractPdfMetadataOnly = extractPdfMetadataOnly; exports.mergeCrossPageTables = _chunkSHBVD23Ccjs.mergeCrossPageTables; exports.parsePdfDocument = parsePdfDocument; exports.removeHeaderFooterBlocks = _chunkSHBVD23Ccjs.removeHeaderFooterBlocks;
|
|
847
|
+
//# sourceMappingURL=parser-WIRWVN5E.cjs.map
|