kordoc 4.2.7 → 4.2.8
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/dist/{-7TEU6IRU.js → -SCTT2TBZ.js} +9 -9
- package/dist/{chunk-VWXA47AW.cjs → chunk-2BTKLDNX.cjs} +4 -4
- package/dist/{chunk-VWXA47AW.cjs.map → chunk-2BTKLDNX.cjs.map} +1 -1
- package/dist/{chunk-T6BTWUTC.js → chunk-4FTXKIGT.js} +2 -2
- package/dist/{chunk-ESV4KOSE.js → chunk-55QIELGV.js} +3 -3
- package/dist/{chunk-G2AS6ICC.js → chunk-7GEBDS6B.js} +2 -2
- package/dist/{chunk-YTRJDQ4Q.cjs → chunk-CELJIGBQ.cjs} +3 -3
- package/dist/{chunk-YTRJDQ4Q.cjs.map → chunk-CELJIGBQ.cjs.map} +1 -1
- package/dist/{chunk-PK5GLL5C.js → chunk-COHHXQSP.js} +2 -2
- package/dist/{chunk-FSUCQ6ZM.js → chunk-EOVJ27WC.js} +3 -3
- package/dist/{chunk-5HFKMCAX.js → chunk-FS3XQ3ZQ.js} +2 -2
- package/dist/{chunk-NAWC6HTC.js → chunk-GKSFNCVP.js} +2 -2
- package/dist/chunk-GKSFNCVP.js.map +1 -0
- package/dist/{chunk-AES6PHIG.js → chunk-IJUAWDOS.js} +3 -3
- package/dist/{chunk-2CHFQQXM.js → chunk-JP5MNHUK.js} +2 -2
- package/dist/{chunk-GJO3ORFW.js → chunk-LM7C6HI2.js} +1 -1
- package/dist/chunk-LM7C6HI2.js.map +1 -0
- package/dist/{chunk-HH4SD5RE.cjs → chunk-OQNFGKRY.cjs} +2 -2
- package/dist/{chunk-HH4SD5RE.cjs.map → chunk-OQNFGKRY.cjs.map} +1 -1
- package/dist/{chunk-YAQRGQUJ.js → chunk-QZCAIFUW.js} +2 -2
- package/dist/{chunk-RS5OID2J.cjs → chunk-ROKHZE76.cjs} +9 -9
- package/dist/{chunk-RS5OID2J.cjs.map → chunk-ROKHZE76.cjs.map} +1 -1
- package/dist/{chunk-62DHK6KT.js → chunk-UKEZ46VL.js} +2 -2
- package/dist/{chunk-NKERQ6GB.js → chunk-URKX77GB.js} +2 -2
- package/dist/{chunk-IVX3YLQH.js → chunk-WP4VD5T7.js} +2 -2
- package/dist/chunk-WP4VD5T7.js.map +1 -0
- package/dist/{chunk-LPRNVK4G.js → chunk-YNAPK4H6.js} +54 -30
- package/dist/chunk-YNAPK4H6.js.map +1 -0
- package/dist/chunks-KKYJDJT7.js +10 -0
- package/dist/cli.js +17 -17
- package/dist/{image-ocr-OS4ETBOL.js → image-ocr-ANSXR5KJ.js} +4 -4
- package/dist/{image-ocr-UX4QM35J.cjs → image-ocr-GHQ6YKJH.cjs} +9 -9
- package/dist/{image-ocr-UX4QM35J.cjs.map → image-ocr-GHQ6YKJH.cjs.map} +1 -1
- package/dist/{image-ocr-PGQ7JPDP.js → image-ocr-ORATZW73.js} +5 -5
- package/dist/index.cjs +480 -456
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +49 -25
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +15 -15
- package/dist/{parser-2JAC5WMM.js → parser-BPVTYM5K.js} +5 -5
- package/dist/{parser-T74C7Q57.js → parser-GZDOZCHM.js} +6 -6
- package/dist/{parser-GAZROLSA.cjs → parser-KTNIUF2N.cjs} +24 -24
- package/dist/{parser-GAZROLSA.cjs.map → parser-KTNIUF2N.cjs.map} +1 -1
- package/dist/pdf-ocr-6XKLXZTF.cjs +13 -0
- package/dist/{pdf-ocr-2SKGRXIR.cjs.map → pdf-ocr-6XKLXZTF.cjs.map} +1 -1
- package/dist/pdf-ocr-HWPNMKKC.js +12 -0
- package/dist/{pdf-ocr-3A3QLPID.js → pdf-ocr-W2PA2K3U.js} +5 -5
- package/dist/{profile-io-6GX564CO.js → profile-io-I2TH44EO.js} +3 -3
- package/dist/{rasterize-4V7PKE7A.js → rasterize-QBA43YAQ.js} +2 -2
- package/dist/render-MDJDKKNH.js +10 -0
- package/dist/seal-Z52JR2GX.js +10 -0
- package/dist/{watch-JVRAAJNA.js → watch-7V6X7LHV.js} +9 -9
- package/package.json +1 -1
- package/dist/chunk-GJO3ORFW.js.map +0 -1
- package/dist/chunk-IVX3YLQH.js.map +0 -1
- package/dist/chunk-LPRNVK4G.js.map +0 -1
- package/dist/chunk-NAWC6HTC.js.map +0 -1
- package/dist/chunks-TLAOHNPB.js +0 -10
- package/dist/pdf-ocr-2SKGRXIR.cjs +0 -13
- package/dist/pdf-ocr-WBOTDQ4D.js +0 -12
- package/dist/render-2AF7GZVN.js +0 -10
- package/dist/seal-2ES6UAN6.js +0 -10
- /package/dist/{-7TEU6IRU.js.map → -SCTT2TBZ.js.map} +0 -0
- /package/dist/{chunk-T6BTWUTC.js.map → chunk-4FTXKIGT.js.map} +0 -0
- /package/dist/{chunk-ESV4KOSE.js.map → chunk-55QIELGV.js.map} +0 -0
- /package/dist/{chunk-G2AS6ICC.js.map → chunk-7GEBDS6B.js.map} +0 -0
- /package/dist/{chunk-PK5GLL5C.js.map → chunk-COHHXQSP.js.map} +0 -0
- /package/dist/{chunk-FSUCQ6ZM.js.map → chunk-EOVJ27WC.js.map} +0 -0
- /package/dist/{chunk-5HFKMCAX.js.map → chunk-FS3XQ3ZQ.js.map} +0 -0
- /package/dist/{chunk-AES6PHIG.js.map → chunk-IJUAWDOS.js.map} +0 -0
- /package/dist/{chunk-2CHFQQXM.js.map → chunk-JP5MNHUK.js.map} +0 -0
- /package/dist/{chunk-YAQRGQUJ.js.map → chunk-QZCAIFUW.js.map} +0 -0
- /package/dist/{chunk-62DHK6KT.js.map → chunk-UKEZ46VL.js.map} +0 -0
- /package/dist/{chunk-NKERQ6GB.js.map → chunk-URKX77GB.js.map} +0 -0
- /package/dist/{chunks-TLAOHNPB.js.map → chunks-KKYJDJT7.js.map} +0 -0
- /package/dist/{image-ocr-OS4ETBOL.js.map → image-ocr-ANSXR5KJ.js.map} +0 -0
- /package/dist/{image-ocr-PGQ7JPDP.js.map → image-ocr-ORATZW73.js.map} +0 -0
- /package/dist/{parser-2JAC5WMM.js.map → parser-BPVTYM5K.js.map} +0 -0
- /package/dist/{parser-T74C7Q57.js.map → parser-GZDOZCHM.js.map} +0 -0
- /package/dist/{pdf-ocr-3A3QLPID.js.map → pdf-ocr-HWPNMKKC.js.map} +0 -0
- /package/dist/{pdf-ocr-WBOTDQ4D.js.map → pdf-ocr-W2PA2K3U.js.map} +0 -0
- /package/dist/{profile-io-6GX564CO.js.map → profile-io-I2TH44EO.js.map} +0 -0
- /package/dist/{rasterize-4V7PKE7A.js.map → rasterize-QBA43YAQ.js.map} +0 -0
- /package/dist/{render-2AF7GZVN.js.map → render-MDJDKKNH.js.map} +0 -0
- /package/dist/{seal-2ES6UAN6.js.map → seal-Z52JR2GX.js.map} +0 -0
- /package/dist/{watch-JVRAAJNA.js.map → watch-7V6X7LHV.js.map} +0 -0
package/dist/mcp.js
CHANGED
|
@@ -31,29 +31,29 @@ import {
|
|
|
31
31
|
patchHwp,
|
|
32
32
|
patchHwpx,
|
|
33
33
|
unknownFontWarnings
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-YNAPK4H6.js";
|
|
35
35
|
import "./chunk-7FCNOKOR.js";
|
|
36
|
-
import "./chunk-
|
|
36
|
+
import "./chunk-LM7C6HI2.js";
|
|
37
37
|
import {
|
|
38
38
|
detectFormat,
|
|
39
39
|
detectZipFormat
|
|
40
40
|
} from "./chunk-TCJRGFYY.js";
|
|
41
41
|
import "./chunk-MOL7MDBG.js";
|
|
42
|
-
import "./chunk-
|
|
42
|
+
import "./chunk-55QIELGV.js";
|
|
43
43
|
import "./chunk-DZIXKL7E.js";
|
|
44
|
-
import "./chunk-
|
|
44
|
+
import "./chunk-COHHXQSP.js";
|
|
45
45
|
import {
|
|
46
46
|
blocksToMarkdown
|
|
47
|
-
} from "./chunk-
|
|
48
|
-
import "./chunk-
|
|
49
|
-
import "./chunk-
|
|
47
|
+
} from "./chunk-4FTXKIGT.js";
|
|
48
|
+
import "./chunk-EOVJ27WC.js";
|
|
49
|
+
import "./chunk-GKSFNCVP.js";
|
|
50
50
|
import {
|
|
51
51
|
KordocError,
|
|
52
52
|
VERSION,
|
|
53
53
|
classifyError,
|
|
54
54
|
sanitizeError,
|
|
55
55
|
toArrayBuffer
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-7GEBDS6B.js";
|
|
57
57
|
|
|
58
58
|
// src/mcp.ts
|
|
59
59
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -274,7 +274,7 @@ server.tool(
|
|
|
274
274
|
break;
|
|
275
275
|
case "pdf":
|
|
276
276
|
try {
|
|
277
|
-
const { extractPdfMetadataOnly } = await import("./parser-
|
|
277
|
+
const { extractPdfMetadataOnly } = await import("./parser-GZDOZCHM.js");
|
|
278
278
|
metadata = await extractPdfMetadataOnly(buffer);
|
|
279
279
|
} catch {
|
|
280
280
|
metadata = void 0;
|
|
@@ -631,7 +631,7 @@ server.tool(
|
|
|
631
631
|
}
|
|
632
632
|
const image = new Uint8Array(readFileSync(imgResolved));
|
|
633
633
|
const ext = extname(imgResolved).slice(1).toLowerCase();
|
|
634
|
-
const { placeSealHwpx } = await import("./seal-
|
|
634
|
+
const { placeSealHwpx } = await import("./seal-Z52JR2GX.js");
|
|
635
635
|
const result = await placeSealHwpx(buffer, [{
|
|
636
636
|
anchor,
|
|
637
637
|
occurrence,
|
|
@@ -733,7 +733,7 @@ server.tool(
|
|
|
733
733
|
}
|
|
734
734
|
const outPath = output_path ? safeOutputPath(output_path, /* @__PURE__ */ new Set([format === "png" ? ".png" : ".svg"])) : void 0;
|
|
735
735
|
const { buffer } = readValidatedFile(file_path, MAX_FILE_SIZE, /* @__PURE__ */ new Set([".hwpx"]));
|
|
736
|
-
const { renderHwpxToSvg } = await import("./render-
|
|
736
|
+
const { renderHwpxToSvg } = await import("./render-MDJDKKNH.js");
|
|
737
737
|
const result = await renderHwpxToSvg(buffer, { highlights, reflow: true, reflowMode: reflow_mode });
|
|
738
738
|
const summary = [
|
|
739
739
|
`\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})`,
|
|
@@ -745,7 +745,7 @@ server.tool(
|
|
|
745
745
|
summary.push(`\uC800\uC7A5: ${outPath}`);
|
|
746
746
|
return { content: [{ type: "text", text: summary.join("\n") }] };
|
|
747
747
|
}
|
|
748
|
-
const { rasterizeSvg } = await import("./rasterize-
|
|
748
|
+
const { rasterizeSvg } = await import("./rasterize-QBA43YAQ.js");
|
|
749
749
|
const raster = await rasterizeSvg(result.svg, result.width, result.height);
|
|
750
750
|
if (outPath) {
|
|
751
751
|
mkdirSync(dirname(outPath), { recursive: true });
|
|
@@ -843,7 +843,7 @@ server.tool(
|
|
|
843
843
|
if (!parsed.success) {
|
|
844
844
|
return { content: [{ type: "text", text: `\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}` }], isError: true };
|
|
845
845
|
}
|
|
846
|
-
const { blocksToChunks } = await import("./chunks-
|
|
846
|
+
const { blocksToChunks } = await import("./chunks-KKYJDJT7.js");
|
|
847
847
|
const chunks = blocksToChunks(parsed.blocks, { granularity, includeTableCells: include_table_cells });
|
|
848
848
|
return { content: [{ type: "text", text: capResponseText(JSON.stringify(chunks, null, 2)) }] };
|
|
849
849
|
} catch (err) {
|
|
@@ -862,7 +862,7 @@ server.tool(
|
|
|
862
862
|
try {
|
|
863
863
|
const out = safeOutputPath(output_path, PROFILE_EXTENSIONS);
|
|
864
864
|
const { buffer } = readValidatedFile(hwpx_path);
|
|
865
|
-
const { hwpxToProfile } = await import("./-
|
|
865
|
+
const { hwpxToProfile } = await import("./-SCTT2TBZ.js");
|
|
866
866
|
const profile = await hwpxToProfile(buffer);
|
|
867
867
|
mkdirSync(dirname(out), { recursive: true });
|
|
868
868
|
writeFileSync(out, JSON.stringify(profile, null, 2));
|
|
@@ -945,7 +945,7 @@ server.tool(
|
|
|
945
945
|
}
|
|
946
946
|
let profile;
|
|
947
947
|
if (profile_path) {
|
|
948
|
-
const { parseFormatProfileJson } = await import("./profile-io-
|
|
948
|
+
const { parseFormatProfileJson } = await import("./profile-io-I2TH44EO.js");
|
|
949
949
|
profile = parseFormatProfileJson(readFileSync(safePath(profile_path, PROFILE_EXTENSIONS), "utf-8"));
|
|
950
950
|
}
|
|
951
951
|
const out = safeOutputPath(output_path, /* @__PURE__ */ new Set([".hwpx"]));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
blocksToMarkdown,
|
|
3
3
|
encodePng
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QZCAIFUW.js";
|
|
5
5
|
import {
|
|
6
6
|
parsePageRange
|
|
7
7
|
} from "./chunk-GE43BE46.js";
|
|
@@ -18,10 +18,10 @@ import {
|
|
|
18
18
|
mergeCrossPageTables,
|
|
19
19
|
normalizeItems,
|
|
20
20
|
removeHeaderFooterBlocks
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-UKEZ46VL.js";
|
|
22
22
|
import {
|
|
23
23
|
KordocError
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-WP4VD5T7.js";
|
|
25
25
|
|
|
26
26
|
// src/pdf/image-extract.ts
|
|
27
27
|
import { OPS, ImageKind } from "pdfjs-dist/legacy/build/pdf.mjs";
|
|
@@ -661,7 +661,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
661
661
|
}
|
|
662
662
|
if (targets.size > 0) {
|
|
663
663
|
try {
|
|
664
|
-
const { runPdfOcr } = await import("./pdf-ocr-
|
|
664
|
+
const { runPdfOcr } = await import("./pdf-ocr-HWPNMKKC.js");
|
|
665
665
|
const mode = typeof options.ocr === "function" ? options.ocr : "builtin";
|
|
666
666
|
const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, options.onProgress);
|
|
667
667
|
if (ocrPageBlocks.size > 0) {
|
|
@@ -797,4 +797,4 @@ export {
|
|
|
797
797
|
parsePdfDocument,
|
|
798
798
|
removeHeaderFooterBlocks
|
|
799
799
|
};
|
|
800
|
-
//# sourceMappingURL=parser-
|
|
800
|
+
//# sourceMappingURL=parser-BPVTYM5K.js.map
|
|
@@ -12,20 +12,20 @@ import {
|
|
|
12
12
|
mergeCrossPageTables,
|
|
13
13
|
normalizeItems,
|
|
14
14
|
removeHeaderFooterBlocks
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-IJUAWDOS.js";
|
|
16
16
|
import {
|
|
17
17
|
encodePng
|
|
18
18
|
} from "./chunk-7FCNOKOR.js";
|
|
19
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-LM7C6HI2.js";
|
|
20
20
|
import {
|
|
21
21
|
parsePageRange
|
|
22
22
|
} from "./chunk-MOL7MDBG.js";
|
|
23
23
|
import {
|
|
24
24
|
blocksToMarkdown
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-4FTXKIGT.js";
|
|
26
26
|
import {
|
|
27
27
|
KordocError
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-7GEBDS6B.js";
|
|
29
29
|
|
|
30
30
|
// src/pdf/image-extract.ts
|
|
31
31
|
import { OPS, ImageKind } from "pdfjs-dist/legacy/build/pdf.mjs";
|
|
@@ -665,7 +665,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
665
665
|
}
|
|
666
666
|
if (targets.size > 0) {
|
|
667
667
|
try {
|
|
668
|
-
const { runPdfOcr } = await import("./pdf-ocr-
|
|
668
|
+
const { runPdfOcr } = await import("./pdf-ocr-W2PA2K3U.js");
|
|
669
669
|
const mode = typeof options.ocr === "function" ? options.ocr : "builtin";
|
|
670
670
|
const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, options.onProgress);
|
|
671
671
|
if (ocrPageBlocks.size > 0) {
|
|
@@ -801,4 +801,4 @@ export {
|
|
|
801
801
|
parsePdfDocument,
|
|
802
802
|
removeHeaderFooterBlocks
|
|
803
803
|
};
|
|
804
|
-
//# sourceMappingURL=parser-
|
|
804
|
+
//# sourceMappingURL=parser-GZDOZCHM.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 _chunk2BTKLDNXcjs = require('./chunk-2BTKLDNX.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
@@ -18,10 +18,10 @@ var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkROKHZE76cjs = require('./chunk-ROKHZE76.cjs');
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _chunkOQNFGKRYcjs = require('./chunk-OQNFGKRY.cjs');
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
@@ -147,7 +147,7 @@ async function extractPageImages(page, fnArray, argsArray, pageNumber, state, wa
|
|
|
147
147
|
if (state.seen.has(hash)) continue;
|
|
148
148
|
const rgba = toRgba(imgData);
|
|
149
149
|
if (!rgba) continue;
|
|
150
|
-
const png =
|
|
150
|
+
const png = _chunk2BTKLDNXcjs.encodePng.call(void 0, w, h, rgba);
|
|
151
151
|
state.imageIndex++;
|
|
152
152
|
state.totalBytes += png.length;
|
|
153
153
|
const filename = `image_${String(state.imageIndex).padStart(3, "0")}.png`;
|
|
@@ -342,7 +342,7 @@ function cleanPdfText(text) {
|
|
|
342
342
|
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, "")
|
|
343
343
|
).replace(/^(?!\| ---).*$/gm, (line) => {
|
|
344
344
|
if (/^\s*\${1,2}.+\${1,2}\s*$/.test(line)) return line;
|
|
345
|
-
return
|
|
345
|
+
return _chunkROKHZE76cjs.collapseEvenSpacing.call(void 0, line);
|
|
346
346
|
}).replace(/([□■◆○●▶ㅇ])\s+([가-힣])\s+([가-힣])/g, "$1 $2$3").replace(/\\~\\~/g, "~~").replace(/~~~~/g, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
347
347
|
}
|
|
348
348
|
function startsWithMarker(line) {
|
|
@@ -552,7 +552,7 @@ async function loadPdfWithTimeout(buffer) {
|
|
|
552
552
|
new Promise((_, reject) => {
|
|
553
553
|
timer = setTimeout(() => {
|
|
554
554
|
loadingTask.destroy();
|
|
555
|
-
reject(new (0,
|
|
555
|
+
reject(new (0, _chunkOQNFGKRYcjs.KordocError)("PDF \uB85C\uB529 \uD0C0\uC784\uC544\uC6C3 (30\uCD08 \uCD08\uACFC)"));
|
|
556
556
|
}, PDF_LOAD_TIMEOUT_MS);
|
|
557
557
|
})
|
|
558
558
|
]);
|
|
@@ -566,7 +566,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
566
566
|
const doc = await loadPdfWithTimeout(buffer);
|
|
567
567
|
try {
|
|
568
568
|
const pageCount = doc.numPages;
|
|
569
|
-
if (pageCount === 0) throw new (0,
|
|
569
|
+
if (pageCount === 0) throw new (0, _chunkOQNFGKRYcjs.KordocError)("PDF\uC5D0 \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
570
570
|
const metadata = { pageCount };
|
|
571
571
|
await extractPdfMetadata(doc, metadata);
|
|
572
572
|
const blocks = [];
|
|
@@ -593,8 +593,8 @@ async function parsePdfDocument(buffer, options) {
|
|
|
593
593
|
const viewport = page.getViewport({ scale: 1 });
|
|
594
594
|
pageHeights.set(i, viewport.height);
|
|
595
595
|
const rawItems = tc.items;
|
|
596
|
-
const items =
|
|
597
|
-
const { visible, hiddenCount } =
|
|
596
|
+
const items = _chunkROKHZE76cjs.normalizeItems.call(void 0, rawItems);
|
|
597
|
+
const { visible, hiddenCount } = _chunkROKHZE76cjs.filterHiddenText.call(void 0, items, viewport.width, viewport.height);
|
|
598
598
|
if (hiddenCount > 0) {
|
|
599
599
|
warnings.push({ page: i, message: `${hiddenCount}\uAC1C \uC228\uACA8\uC9C4 \uD14D\uC2A4\uD2B8 \uC694\uC18C \uD544\uD130\uB9C1\uB428`, code: "HIDDEN_TEXT_FILTERED" });
|
|
600
600
|
}
|
|
@@ -604,7 +604,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
604
604
|
const opList = await page.getOperatorList();
|
|
605
605
|
const pageArea = viewport.width * viewport.height;
|
|
606
606
|
if (pageArea > 0) {
|
|
607
|
-
const imageRegions =
|
|
607
|
+
const imageRegions = _chunkROKHZE76cjs.extractImageRegions.call(void 0, opList.fnArray, opList.argsArray);
|
|
608
608
|
let uncovered = 0;
|
|
609
609
|
for (const r of imageRegions) {
|
|
610
610
|
const area = (r.x2 - r.x1) * (r.y2 - r.y1);
|
|
@@ -619,7 +619,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
619
619
|
}
|
|
620
620
|
if (uncovered > 0) skippedImagePages.set(i, uncovered);
|
|
621
621
|
}
|
|
622
|
-
const pageBlocks =
|
|
622
|
+
const pageBlocks = _chunkROKHZE76cjs.extractPageBlocksWithLines.call(void 0, visible, i, opList, viewport.width, viewport.height);
|
|
623
623
|
for (const b of pageBlocks) blocks.push(b);
|
|
624
624
|
try {
|
|
625
625
|
const { blocks: imgBlocks, images: pageImages } = await extractPageImages(page, opList.fnArray, opList.argsArray, i, imageState, warnings);
|
|
@@ -639,11 +639,11 @@ async function parsePdfDocument(buffer, options) {
|
|
|
639
639
|
pageText += pageText ? "\n" + t : t;
|
|
640
640
|
}
|
|
641
641
|
pageQuality.push(computePageQuality(i, pageText));
|
|
642
|
-
if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0,
|
|
642
|
+
if (totalTextBytes > MAX_TOTAL_TEXT) throw new (0, _chunkOQNFGKRYcjs.KordocError)("\uD14D\uC2A4\uD2B8 \uCD94\uCD9C \uD06C\uAE30 \uCD08\uACFC");
|
|
643
643
|
parsedPages++;
|
|
644
644
|
_optionalChain([options, 'optionalAccess', _10 => _10.onProgress, 'optionalCall', _11 => _11(parsedPages, totalTarget)]);
|
|
645
645
|
} catch (pageErr) {
|
|
646
|
-
if (pageErr instanceof
|
|
646
|
+
if (pageErr instanceof _chunkOQNFGKRYcjs.KordocError) throw pageErr;
|
|
647
647
|
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" });
|
|
648
648
|
}
|
|
649
649
|
}
|
|
@@ -664,7 +664,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
664
664
|
}
|
|
665
665
|
if (targets.size > 0) {
|
|
666
666
|
try {
|
|
667
|
-
const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-
|
|
667
|
+
const { runPdfOcr } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pdf-ocr-6XKLXZTF.cjs")));
|
|
668
668
|
const mode = typeof options.ocr === "function" ? options.ocr : "builtin";
|
|
669
669
|
const ocrPageBlocks = await runPdfOcr(ocrBuffer, targets, mode, warnings, options.onProgress);
|
|
670
670
|
if (ocrPageBlocks.size > 0) {
|
|
@@ -714,12 +714,12 @@ async function parsePdfDocument(buffer, options) {
|
|
|
714
714
|
}
|
|
715
715
|
}
|
|
716
716
|
if (_optionalChain([options, 'optionalAccess', _13 => _13.removeHeaderFooter]) !== false && parsedPageCount >= 3) {
|
|
717
|
-
const removed =
|
|
717
|
+
const removed = _chunkROKHZE76cjs.removeHeaderFooterBlocks.call(void 0, blocks, pageHeights, warnings);
|
|
718
718
|
for (let ri = removed.length - 1; ri >= 0; ri--) {
|
|
719
719
|
blocks.splice(removed[ri], 1);
|
|
720
720
|
}
|
|
721
721
|
}
|
|
722
|
-
|
|
722
|
+
_chunkROKHZE76cjs.mergeCrossPageTables.call(void 0, blocks);
|
|
723
723
|
injectPageImageBlocks(blocks, pageImageBlocks);
|
|
724
724
|
if (_optionalChain([options, 'optionalAccess', _14 => _14.formulaOcr]) && formulaBuffer) {
|
|
725
725
|
try {
|
|
@@ -731,16 +731,16 @@ async function parsePdfDocument(buffer, options) {
|
|
|
731
731
|
});
|
|
732
732
|
}
|
|
733
733
|
}
|
|
734
|
-
const medianFontSize =
|
|
734
|
+
const medianFontSize = _chunkROKHZE76cjs.computeMedianFontSizeFromFreq.call(void 0, fontSizeFreq);
|
|
735
735
|
if (medianFontSize > 0) {
|
|
736
|
-
|
|
736
|
+
_chunkROKHZE76cjs.detectHeadings.call(void 0, blocks, medianFontSize);
|
|
737
737
|
}
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
738
|
+
_chunkROKHZE76cjs.detectMarkerHeadings.call(void 0, blocks);
|
|
739
|
+
_chunkROKHZE76cjs.detectTableCaptions.call(void 0, blocks);
|
|
740
|
+
_chunkROKHZE76cjs.detectKoreanListBlocks.call(void 0, blocks);
|
|
741
741
|
const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
742
742
|
sanitizeBlockControlChars(blocks);
|
|
743
|
-
let markdown = cleanPdfText(
|
|
743
|
+
let markdown = cleanPdfText(_chunk2BTKLDNXcjs.blocksToMarkdown.call(void 0, blocks));
|
|
744
744
|
return {
|
|
745
745
|
markdown,
|
|
746
746
|
blocks,
|
|
@@ -799,5 +799,5 @@ async function extractPdfMetadataOnly(buffer) {
|
|
|
799
799
|
|
|
800
800
|
|
|
801
801
|
|
|
802
|
-
exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks =
|
|
803
|
-
//# sourceMappingURL=parser-
|
|
802
|
+
exports.cleanPdfText = cleanPdfText; exports.detectKoreanListBlocks = _chunkROKHZE76cjs.detectKoreanListBlocks; exports.detectTableCaptions = _chunkROKHZE76cjs.detectTableCaptions; exports.extractPdfMetadataOnly = extractPdfMetadataOnly; exports.mergeCrossPageTables = _chunkROKHZE76cjs.mergeCrossPageTables; exports.parsePdfDocument = parsePdfDocument; exports.removeHeaderFooterBlocks = _chunkROKHZE76cjs.removeHeaderFooterBlocks;
|
|
803
|
+
//# sourceMappingURL=parser-KTNIUF2N.cjs.map
|